cft-builder 0.0.22 → 0.0.23

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.
@@ -1,4 +1,4 @@
1
- import { B as d, z as s, F as i, R as B } from "./main-B1fioFnq.js";
1
+ import { B as d, z as s, F as i, R as B } from "./main-DurNeSJN.js";
2
2
  export {
3
3
  d as BuilderItems,
4
4
  s as BuilderItemsRender,
@@ -4221,7 +4221,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
4221
4221
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vAe(t,e){if(t){if(typeof t=="string")return OU(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return OU(t,e)}}function OU(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function bAe(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r=[],i=!0,a=!1,s,o;try{for(n=n.call(t);!(i=(s=n.next()).done)&&(r.push(s.value),!(e&&r.length===e));i=!0);}catch(c){a=!0,o=c}finally{try{!i&&n.return!=null&&n.return()}finally{if(a)throw o}}return r}}function yAe(t){if(Array.isArray(t))return t}function AAe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function NU(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function xAe(t,e,n){return e&&NU(t.prototype,e),n&&NU(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}var wAe="["+d1+gg+"]+",SAe=new RegExp("^"+wAe+"$","i"),CAe="(?:["+zbe+"]["+d1+gg+"]*|["+d1+gg+"]+)",TAe=new RegExp("[^"+d1+gg+"]+.*$"),EAe=/[^\d\[\]]/,_Ae=function(){function t(e){var n=e.defaultCountry,r=e.defaultCallingCode,i=e.metadata,a=e.onNationalSignificantNumberChange;AAe(this,t),this.defaultCountry=n,this.defaultCallingCode=r,this.metadata=i,this.onNationalSignificantNumberChange=a}return xAe(t,[{key:"input",value:function(n,r){var i=OAe(n),a=DU(i,2),s=a[0],o=a[1],c=wh(s),u;return o&&(r.digits||(r.startInternationalNumber(),c||(u=!0))),c&&this.inputDigits(c,r),{digits:c,justLeadingPlus:u}}},{key:"inputDigits",value:function(n,r){var i=r.digits,a=i.length<3&&i.length+n.length>=3;if(r.appendDigits(n),a&&this.extractIddPrefix(r),this.isWaitingForCountryCallingCode(r)){if(!this.extractCountryCallingCode(r))return}else r.appendNationalSignificantNumberDigits(n);r.international||this.hasExtractedNationalSignificantNumber||this.extractNationalSignificantNumber(r.getNationalDigits(),function(s){return r.update(s)})}},{key:"isWaitingForCountryCallingCode",value:function(n){var r=n.international,i=n.callingCode;return r&&!i}},{key:"extractCountryCallingCode",value:function(n){var r=Mye("+"+n.getDigitsWithoutInternationalPrefix(),this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),i=r.countryCallingCode,a=r.number;if(i)return n.setCallingCode(i),n.update({nationalSignificantNumber:a}),!0}},{key:"reset",value:function(n){if(n){this.hasSelectedNumberingPlan=!0;var r=n._nationalPrefixForParsing();this.couldPossiblyExtractAnotherNationalSignificantNumber=r&&EAe.test(r)}else this.hasSelectedNumberingPlan=void 0,this.couldPossiblyExtractAnotherNationalSignificantNumber=void 0}},{key:"extractNationalSignificantNumber",value:function(n,r){if(this.hasSelectedNumberingPlan){var i=sw(n,this.metadata),a=i.nationalPrefix,s=i.nationalNumber,o=i.carrierCode;if(s!==n)return this.onExtractedNationalNumber(a,o,s,n,r),!0}}},{key:"extractAnotherNationalSignificantNumber",value:function(n,r,i){if(!this.hasExtractedNationalSignificantNumber)return this.extractNationalSignificantNumber(n,i);if(this.couldPossiblyExtractAnotherNationalSignificantNumber){var a=sw(n,this.metadata),s=a.nationalPrefix,o=a.nationalNumber,c=a.carrierCode;if(o!==r)return this.onExtractedNationalNumber(s,c,o,n,i),!0}}},{key:"onExtractedNationalNumber",value:function(n,r,i,a,s){var o,c,u=a.lastIndexOf(i);if(u>=0&&u===a.length-i.length){c=!0;var d=a.slice(0,u);d!==n&&(o=d)}s({nationalPrefix:n,carrierCode:r,nationalSignificantNumber:i,nationalSignificantNumberMatchesInput:c,complexPrefixBeforeNationalSignificantNumber:o}),this.hasExtractedNationalSignificantNumber=!0,this.onNationalSignificantNumberChange()}},{key:"reExtractNationalSignificantNumber",value:function(n){if(this.extractAnotherNationalSignificantNumber(n.getNationalDigits(),n.nationalSignificantNumber,function(r){return n.update(r)}))return!0;if(this.extractIddPrefix(n))return this.extractCallingCodeAndNationalSignificantNumber(n),!0;if(this.fixMissingPlus(n))return this.extractCallingCodeAndNationalSignificantNumber(n),!0}},{key:"extractIddPrefix",value:function(n){var r=n.international,i=n.IDDPrefix,a=n.digits;if(n.nationalSignificantNumber,!(r||i)){var s=fU(a,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata);if(s!==void 0&&s!==a)return n.update({IDDPrefix:a.slice(0,a.length-s.length)}),this.startInternationalNumber(n,{country:void 0,callingCode:void 0}),!0}}},{key:"fixMissingPlus",value:function(n){if(!n.international){var r=pU(n.digits,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),i=r.countryCallingCode;if(r.number,i)return n.update({missingPlus:!0}),this.startInternationalNumber(n,{country:n.country,callingCode:i}),!0}}},{key:"startInternationalNumber",value:function(n,r){var i=r.country,a=r.callingCode;n.startInternationalNumber(i,a),n.nationalSignificantNumber&&(n.resetNationalSignificantNumber(),this.onNationalSignificantNumberChange(),this.hasExtractedNationalSignificantNumber=void 0)}},{key:"extractCallingCodeAndNationalSignificantNumber",value:function(n){this.extractCountryCallingCode(n)&&this.extractNationalSignificantNumber(n.getNationalDigits(),function(r){return n.update(r)})}}]),t}();function IAe(t){var e=t.search(CAe);if(!(e<0)){t=t.slice(e);var n;return t[0]==="+"&&(n=!0,t=t.slice(1)),t=t.replace(TAe,""),n&&(t="+"+t),t}}function DAe(t){var e=IAe(t)||"";return e[0]==="+"?[e.slice(1),!0]:[e]}function OAe(t){var e=DAe(t),n=DU(e,2),r=n[0],i=n[1];return SAe.test(r)||(r=""),[r,i]}function NAe(t,e){return kAe(t)||MAe(t,e)||PAe(t,e)||FAe()}function FAe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
4222
4222
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function PAe(t,e){if(t){if(typeof t=="string")return FU(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return FU(t,e)}}function FU(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function MAe(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r=[],i=!0,a=!1,s,o;try{for(n=n.call(t);!(i=(s=n.next()).done)&&(r.push(s.value),!(e&&r.length===e));i=!0);}catch(c){a=!0,o=c}finally{try{!i&&n.return!=null&&n.return()}finally{if(a)throw o}}return r}}function kAe(t){if(Array.isArray(t))return t}function LAe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function PU(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function $Ae(t,e,n){return e&&PU(t.prototype,e),n&&PU(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}var sv=function(){function t(e,n){LAe(this,t),this.metadata=new ro(n);var r=this.getCountryAndCallingCode(e),i=NAe(r,2),a=i[0],s=i[1];this.defaultCountry=a,this.defaultCallingCode=s,this.reset()}return $Ae(t,[{key:"getCountryAndCallingCode",value:function(n){var r,i;return n&&(ev(n)?(r=n.defaultCountry,i=n.defaultCallingCode):r=n),r&&!this.metadata.hasCountry(r)&&(r=void 0),[r,i]}},{key:"input",value:function(n){var r=this.parser.input(n,this.state),i=r.digits,a=r.justLeadingPlus;if(a)this.formattedOutput="+";else if(i){this.determineTheCountryIfNeeded(),this.state.nationalSignificantNumber&&this.formatter.narrowDownMatchingFormats(this.state);var s;if(this.metadata.hasSelectedNumberingPlan()&&(s=this.formatter.format(i,this.state)),s===void 0&&this.parser.reExtractNationalSignificantNumber(this.state)){this.determineTheCountryIfNeeded();var o=this.state.getNationalDigits();o&&(s=this.formatter.format(o,this.state))}this.formattedOutput=s?this.getFullNumber(s):this.getNonFormattedNumber()}return this.formattedOutput}},{key:"reset",value:function(){var n=this;return this.state=new Uye({onCountryChange:function(i){n.country=i},onCallingCodeChange:function(i,a){n.metadata.selectNumberingPlan(a,i),n.formatter.reset(n.metadata.numberingPlan,n.state),n.parser.reset(n.metadata.numberingPlan)}}),this.formatter=new gAe({state:this.state,metadata:this.metadata}),this.parser=new _Ae({defaultCountry:this.defaultCountry,defaultCallingCode:this.defaultCallingCode,metadata:this.metadata,state:this.state,onNationalSignificantNumberChange:function(){n.determineTheCountryIfNeeded(),n.formatter.reset(n.metadata.numberingPlan,n.state)}}),this.state.reset({country:this.defaultCountry,callingCode:this.defaultCallingCode}),this.formattedOutput="",this}},{key:"isInternational",value:function(){return this.state.international}},{key:"getCallingCode",value:function(){if(this.isInternational())return this.state.callingCode}},{key:"getCountryCallingCode",value:function(){return this.getCallingCode()}},{key:"getCountry",value:function(){var n=this.state.digits;if(n)return this._getCountry()}},{key:"_getCountry",value:function(){var n=this.state.country;return n}},{key:"determineTheCountryIfNeeded",value:function(){(!this.state.country||this.isCountryCallingCodeAmbiguous())&&this.determineTheCountry()}},{key:"getFullNumber",value:function(n){var r=this;if(this.isInternational()){var i=function(o){return r.formatter.getInternationalPrefixBeforeCountryCallingCode(r.state,{spacing:!!o})+o},a=this.state.callingCode;return i(a?n?"".concat(a," ").concat(n):a:"".concat(this.state.getDigitsWithoutInternationalPrefix()))}return n}},{key:"getNonFormattedNationalNumberWithPrefix",value:function(){var n=this.state,r=n.nationalSignificantNumber,i=n.complexPrefixBeforeNationalSignificantNumber,a=n.nationalPrefix,s=r,o=i||a;return o&&(s=o+s),s}},{key:"getNonFormattedNumber",value:function(){var n=this.state.nationalSignificantNumberMatchesInput;return this.getFullNumber(n?this.getNonFormattedNationalNumberWithPrefix():this.state.getNationalDigits())}},{key:"getNonFormattedTemplate",value:function(){var n=this.getNonFormattedNumber();if(n)return n.replace(/[\+\d]/g,Nc)}},{key:"isCountryCallingCodeAmbiguous",value:function(){var n=this.state.callingCode,r=this.metadata.getCountryCodesForCallingCode(n);return r&&r.length>1}},{key:"determineTheCountry",value:function(){this.state.setCountry(Vye(this.isInternational()?this.state.callingCode:this.defaultCallingCode,{nationalNumber:this.state.nationalSignificantNumber,defaultCountry:this.defaultCountry,metadata:this.metadata}))}},{key:"getNumberValue",value:function(){var n=this.state,r=n.digits,i=n.callingCode,a=n.country,s=n.nationalSignificantNumber;if(r){if(this.isInternational())return i?"+"+i+s:"+"+r;if(a||i){var o=a?this.metadata.countryCallingCode():i;return"+"+o+s}}}},{key:"getNumber",value:function(){var n=this.state,r=n.nationalSignificantNumber,i=n.carrierCode,a=n.callingCode,s=this._getCountry();if(r&&!(!s&&!a)){if(s&&s===this.defaultCountry){var o=new ro(this.metadata.metadata);o.selectNumberingPlan(s);var c=o.numberingPlan.callingCode(),u=this.metadata.getCountryCodesForCallingCode(c);if(u.length>1){var d=mU(r,{countries:u,defaultCountry:this.defaultCountry,metadata:this.metadata.metadata});d&&(s=d)}}var f=new Iye(s||a,r,this.metadata.metadata);return i&&(f.carrierCode=i),f}}},{key:"isPossible",value:function(){var n=this.getNumber();return n?n.isPossible():!1}},{key:"isValid",value:function(){var n=this.getNumber();return n?n.isValid():!1}},{key:"getNationalNumber",value:function(){return this.state.nationalSignificantNumber}},{key:"getChars",value:function(){return(this.state.international?"+":"")+this.state.digits}},{key:"getTemplate",value:function(){return this.formatter.getTemplate(this.state)||this.getNonFormattedTemplate()||""}}]),t}();function VAe(t,e,n){return n||(n=e,e=void 0),new sv(e,n).input(t)}function MU(t){var e=t.country,n=t.international,r=t.withCountryCallingCode,i=t.metadata;return e&&n&&!r?"+".concat(F0(e,i)):""}function dw(t,e){return e&&(t=t.slice(e.length),t[0]===" "&&(t=t.slice(1))),t}function qAe(t,e,n){if(!(n&&n.ignoreRest)){var r=function(a){if(n)switch(a){case"end":n.ignoreRest=!0;break}};return JB(t,e,r)}}function kU(t){var e=t.onKeyDown,n=t.international;return k.useCallback(function(r){if(r.keyCode===BAe&&n&&r.target instanceof HTMLInputElement&&UAe(r.target)===jAe){r.preventDefault();return}e&&e(r)},[e,n])}var BAe=8;function UAe(t){return t.selectionStart}var jAe=1,zAe=["onKeyDown","country","international","withCountryCallingCode","metadata"];function fw(){return fw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},fw.apply(this,arguments)}function HAe(t,e){if(t==null)return{};var n=RAe(t,e),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)r=a[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function RAe(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,a;for(a=0;a<r.length;a++)i=r[a],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}function YAe(t){function e(n,r){var i=n.onKeyDown,a=n.country,s=n.international,o=n.withCountryCallingCode,c=n.metadata,u=c===void 0?t:c,d=HAe(n,zAe),f=k.useCallback(function(g){var m=new sv(a,u),b=MU({country:a,international:s,withCountryCallingCode:o,metadata:u}),w=m.input(b+g),x=m.getTemplate();return b&&(w=dw(w,b),x&&(x=dw(x,b))),{text:w,template:x}},[a,u]),p=kU({onKeyDown:i,international:s});return k.createElement(Mbe,fw({},d,{ref:r,parse:qAe,format:f,onKeyDown:p}))}return e=k.forwardRef(e),e.propTypes={value:At.string.isRequired,onChange:At.func.isRequired,onKeyDown:At.func,country:At.string,international:At.bool,withCountryCallingCode:At.bool,metadata:At.object},e}const XAe=YAe();var KAe=["value","onChange","onKeyDown","country","international","withCountryCallingCode","metadata","inputComponent"];function hw(){return hw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},hw.apply(this,arguments)}function GAe(t,e){if(t==null)return{};var n=WAe(t,e),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)r=a[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function WAe(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,a;for(a=0;a<r.length;a++)i=r[a],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}function QAe(t){function e(n,r){var i=n.value,a=n.onChange,s=n.onKeyDown,o=n.country,c=n.international,u=n.withCountryCallingCode,d=n.metadata,f=d===void 0?t:d,p=n.inputComponent,g=p===void 0?"input":p,m=GAe(n,KAe),b=MU({country:o,international:c,withCountryCallingCode:u,metadata:f}),w=k.useCallback(function(S){var C=iye(S.target.value);if(C===i){var T=LU(b,C,o,f);T.indexOf(S.target.value)===0&&(C=C.slice(0,-1))}a(C)},[b,i,a,o,f]),x=kU({onKeyDown:s,international:c});return k.createElement(g,hw({},m,{ref:r,value:LU(b,i,o,f),onChange:w,onKeyDown:x}))}return e=k.forwardRef(e),e.propTypes={value:At.string.isRequired,onChange:At.func.isRequired,onKeyDown:At.func,country:At.string,international:At.bool,withCountryCallingCode:At.bool,metadata:At.object,inputComponent:At.elementType},e}const JAe=QAe();function LU(t,e,n,r){return dw(VAe(t+e,n,r),t)}var ZAe=At.shape({country_calling_codes:At.object.isRequired,countries:At.object.isRequired});At.objectOf(At.string);function $U(t,e){var n="+"+F0(t,e);return n}function mg(t,e){return rxe(t)||nxe(t,e)||txe(t,e)||exe()}function exe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
4223
4223
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function txe(t,e){if(t){if(typeof t=="string")return VU(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return VU(t,e)}}function VU(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function nxe(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,a,s,o=[],c=!0,u=!1;try{if(a=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(o.push(r.value),o.length!==e);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw i}}return o}}function rxe(t){if(Array.isArray(t))return t}function ixe(t){var e=this,n=t.value,r=t.onChange,i=t.country,a=t.defaultCountry,s=t.international,o=t.withCountryCallingCode,c=t.useNationalFormatForDefaultCountryValue,u=t.metadata,d=k.useRef(),f=function(Y,ie,K){console.error("[react-phone-number-input] Expected phone number ".concat(Y," to correspond to country ").concat(ie," but ").concat(K?"in reality it corresponds to country "+K:"it doesn't",".")),d.current=!0},p=function(Y){return axe(n,i,s,o,a,c,u,function(){Y&&Y.onCountryMismatch&&Y.onCountryMismatch();for(var ie=arguments.length,K=new Array(ie),ne=0;ne<ie;ne++)K[ne]=arguments[ne];f.apply(e,K)})},g=k.useState(i),m=mg(g,2),b=m[0],w=m[1],x=k.useState(a),S=mg(x,2),C=S[0],T=S[1],A=k.useState(p()),I=mg(A,2),_=I[0],P=I[1],q=k.useState(n),U=mg(q,2),F=U[0],O=U[1],L=k.useState(),J=mg(L,2);J[0];var be=J[1],xe=k.useCallback(function(){return be({})},[be]);function le(fe){if(fe){i&&s&&!o&&(fe="+".concat(F0(i,u)).concat(fe));var Y=new sv(i||a,u);return Y.input(fe),Y.getNumberValue()}}k.useEffect(function(){n!==F&&(O(n),P(p()))},[n]),k.useEffect(function(){if(i!==b){w(i);var fe,Y=p({onCountryMismatch:function(){fe=!0}});P(Y),fe&&O(le(Y))}},[i]),k.useEffect(function(){a!==C&&(T(a),P(p()))},[a]),k.useEffect(function(){F!==n&&r(F)},[F]);var Z=k.useCallback(function(fe){var Y;if(i)if(s&&o){var ie=$U(i,u);if(fe.indexOf(ie)!==0){if(fe&&fe[0]!=="+")fe=ie+fe;else if(!d.current)return P(ie),O(void 0),xe()}}else fe&&fe[0]==="+"&&(fe=fe.slice(1));else a||fe&&fe[0]!=="+"&&(fe="+"+fe);fe&&(Y=le(fe)),P(fe),O(Y)},[i,s,o,a,u,P,O,xe,d]);return[_,Z]}function axe(t,e,n,r,i,a,s,o){if(e&&n&&r){var c=$U(e,s);return t?(t.indexOf(c)!==0&&o(t,e),t):c}if(!t)return"";if(!e&&!i)return t;var u=new sv(void 0,s);u.input(t);var d=u.getNumber();return d?e?(d.country&&d.country!==e?o(t,e,d.country):d.countryCallingCode!==F0(e,s)&&o(t,e),n?d.nationalNumber:wh(d.formatNational())):d.countryCallingCode&&d.countryCallingCode===F0(i,s)&&a?wh(d.formatNational()):t:""}var sxe=["Component","country","defaultCountry","useNationalFormatForDefaultCountryValue","value","onChange","metadata","international","withCountryCallingCode"];function pw(){return pw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},pw.apply(this,arguments)}function oxe(t,e){return dxe(t)||uxe(t,e)||cxe(t,e)||lxe()}function lxe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
4224
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cxe(t,e){if(t){if(typeof t=="string")return qU(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return qU(t,e)}}function qU(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function uxe(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,a,s,o=[],c=!0,u=!1;try{if(a=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(o.push(r.value),o.length!==e);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw i}}return o}}function dxe(t){if(Array.isArray(t))return t}function fxe(t,e){if(t==null)return{};var n=hxe(t,e),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)r=a[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function hxe(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,a;for(a=0;a<r.length;a++)i=r[a],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}function ov(t,e){var n=t.Component,r=t.country,i=t.defaultCountry,a=t.useNationalFormatForDefaultCountryValue,s=a===void 0?!0:a,o=t.value,c=t.onChange,u=t.metadata,d=t.international,f=t.withCountryCallingCode,p=fxe(t,sxe),g=ixe({value:o,onChange:c,country:r,defaultCountry:i,international:d,withCountryCallingCode:f,useNationalFormatForDefaultCountryValue:s,metadata:u}),m=oxe(g,2),b=m[0],w=m[1];return k.createElement(n,pw({},p,{ref:e,metadata:u,international:d,withCountryCallingCode:f,country:r||i,value:b,onChange:w}))}ov=k.forwardRef(ov),ov.propTypes={value:At.string,onChange:At.func.isRequired,country:At.string,defaultCountry:At.string,international:At.bool,withCountryCallingCode:At.bool,Component:At.elementType.isRequired,useNationalFormatForDefaultCountryValue:At.bool,metadata:ZAe};const pxe=ov;var gxe=["type","autoComplete","smartCaret","metadata"];function gw(){return gw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},gw.apply(this,arguments)}function mxe(t,e){if(t==null)return{};var n=vxe(t,e),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)r=a[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function vxe(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,a;for(a=0;a<r.length;a++)i=r[a],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}function BU(t){function e(n,r){var i=n.type,a=i===void 0?"tel":i,s=n.autoComplete,o=s===void 0?"tel":s,c=n.smartCaret,u=c===void 0?!0:c,d=n.metadata,f=d===void 0?t:d,p=mxe(n,gxe);return k.createElement(pxe,gw({},p,{type:a,autoComplete:o,metadata:f,ref:r,Component:u?XAe:JAe}))}return e=k.forwardRef(e),e.propTypes={type:At.string,autoComplete:At.string,smartCaret:At.bool,metadata:At.object},e}BU();const bxe=BU(fbe),mw=t=>{var ne,ue,ye,Ee,Fe,Te,me,ee,X,M,W;const{taskRegisterData:e,updateTaskRegisterData:n,updateTaskProgressValue:r,updateUserFormDataSubmit:i,userTaskSubmitFormData:a,TASK_PUBLISHED:s,task_status:o}=si(),{userSelectedLanguage:c,fieldSettingUpdate:u}=xn(),{isPreview:d,field:f,fieldIndex:p,sectionIndex:g,pageIndex:m,row:b,rowIndex:w,columnIndex:x,isAdmin:S,isRenderView:C}=t,[T,A]=k.useState(!1),[I,_]=k.useState(""),[P,q]=k.useState(0),[U,F]=k.useState(!1),[O,L]=k.useState(!1),J=()=>{L(!0)},be=()=>{L(!1)},xe=()=>{var G,he,Ne;if(b!=null&&b.rowIsRepeatable){if(b!=null&&b.repeatableFields){const Se=[...b.repeatableFields],Ae=St.findIndex(Se,function(Ve){return Ve.uuid===(f==null?void 0:f.uuid)});Ae>=0&&Se[Ae].fieldData?_(Se[Ae].fieldData):_("")}}else{const Se=a;if(Se!=null&&Se.length){for(const Ae of Se)if(Ae.fieldId===t.field.uuid&&((G=Ae==null?void 0:Ae.postData[0])==null?void 0:G.postValue)!==""&&((he=Ae==null?void 0:Ae.postData[0])!=null&&he.postValue)){_((Ne=Ae==null?void 0:Ae.postData[0])==null?void 0:Ne.postValue);break}}}F(!0)};k.useEffect(()=>{U||xe();const G=an.addListener("clearRepeatableFields",Ae=>{Ae===(b==null?void 0:b.uuid)&&(_(""),q(0),f.isValid=0,u(m,g,w,x,p,f))}),he=an.addListener("onSubmitUserForm",()=>{var Ae;(Ae=f==null?void 0:f.attributes)!=null&&Ae.required?I?f.isValid=1:f.isValid=0:f.isValid=1}),Ne=an.addListener("OnInvalidFieldCatch",Ae=>{f.uuid===(Ae==null?void 0:Ae.fieldId)?q(1):q(0)}),Se=an.addListener("OnGetFieldValue",Ae=>{var se;const Ve=(se=Ae==null?void 0:Ae.repeatableColumn)==null?void 0:se.filter((pe,z)=>(pe==null?void 0:pe.fieldUuid)===(f==null?void 0:f.uuid));Ve!=null&&Ve.length});return()=>{he.remove(),Ne.remove(),Se.remove(),G.remove()}});const le=G=>{A(G)},Z=()=>{A(!1)},fe=G=>{_(G);const he=a,Ne=St.cloneDeep(e);if(he!==null){if(G){if(Ne[f==null?void 0:f.uuid]=G,(he==null?void 0:he.length)>0)for(const Se of he)Se.fieldId===t.field.uuid&&(Se.postData[0]={postValue:G})}else if(delete Ne[f==null?void 0:f.uuid],(he==null?void 0:he.length)>0)for(const Se of he)Se.fieldId===t.field.uuid&&(Se.postData[0]={postValue:""})}if(!(b!=null&&b.rowIsRepeatable)){n(Ne);const Se=Object.keys(Ne).length;r(Se)}},Y=(G,he)=>{var Ne;if(a){const Se=[...a],Ae=St.findIndex(Se,function(se){return se.rowId===(b==null?void 0:b.uuid)});let Ve=(Ne=a[Ae])==null?void 0:Ne.repeatableFields;Ve={...Ve,[G==null?void 0:G.uuid]:he},Se[Ae]={...Se[Ae],repeatableFields:Ve},i(Se)}_(he),he!==""?G.isValid=1:G.isValid=0},ie=G=>{b!=null&&b.rowIsRepeatable?Y(f,G):fe(G)},K=l.jsxs("div",{onMouseOver:J,onMouseOut:be,children:[!C&&!d&&O&&l.jsx(qr,{handleFieldSettingsSidebar:le,...t}),l.jsxs("div",{className:`field ${d?" ":" builder-element-wrapper "}${(f==null?void 0:f.isFluid)===!0?" card py-3 px-4 p-fluid":"card py-3 px-4"}`,children:[l.jsx("div",{className:"grid",children:l.jsxs("div",{className:d?"col-12 ":"col-12 p-fluid",children:[(f==null?void 0:f.showHeaderText)&&l.jsx("h6",{children:(ne=f==null?void 0:f.headerText)==null?void 0:ne[c==null?void 0:c.type]}),(f==null?void 0:f.showLabel)&&l.jsxs("label",{htmlFor:p,className:"flex font-medium mb-3 text-700 text-2xl",children:[l.jsx(ea,{...t}),((ue=f==null?void 0:f.attributes)==null?void 0:ue.required)&&l.jsx("span",{className:"must-required mr-1",children:"*"})," ",d?l.jsx(l.Fragment,{children:(ye=f==null?void 0:f.label)==null?void 0:ye[c==null?void 0:c.type]}):l.jsx(Xi,{...t}),l.jsx("span",{className:"ml-3",children:(f==null?void 0:f.showToolTip)&&l.jsx(Fi,{message:(Ee=f==null?void 0:f.toolTip)==null?void 0:Ee[c==null?void 0:c.type],position:"right"})})]}),l.jsxs("div",{className:"mt-3",children:[l.jsxs("span",{className:"p-input-icon-"+(f==null?void 0:f.iconAlignment),children:[(f==null?void 0:f.showIcon)&&l.jsx("i",{className:"pi pi-"+((Te=(Fe=f==null?void 0:f.icon)==null?void 0:Fe.properties)==null?void 0:Te.name)}),l.jsx(bxe,{id:f==null?void 0:f.uuid,placeholder:(me=f==null?void 0:f.placeholder)==null?void 0:me[c==null?void 0:c.type],value:I,onFocus:()=>q(1),onChange:ie,international:!0,className:`${P===1&&((ee=f==null?void 0:f.attributes)!=null&&ee.required)?I?"valid":"invalid":"valid'"} p-inputtext`,readOnly:o===s})]}),l.jsx("div",{children:((X=f==null?void 0:f.attributes)==null?void 0:X.required)&&l.jsx("small",{className:"error",children:P===1&&!I?(M=f==null?void 0:f.validationMesssage)==null?void 0:M.english:""})}),l.jsx("div",{children:(f==null?void 0:f.showHelperText)&&l.jsx("small",{children:(W=f==null?void 0:f.helperText)==null?void 0:W[c==null?void 0:c.type]})})]})]})}),S&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{}),l.jsx(Ii,{...t})]})]})]});return l.jsxs(l.Fragment,{children:[T===!0&&l.jsx(Yi,{visibilty:T,closeSettingFieldSidebar:Z,...t}),l.jsx(xi,{...t,fieldWrap:K})]})};mw.defaultProps={field:{},isPreview:!1},mw.propTypes={field:At.any,isPreview:At.bool};const vw=t=>{var fe,Y,ie,K,ne,ue,ye,Ee,Fe,Te,me;const{isPreview:e,field:n,fieldIndex:r,isAdmin:i,pageIndex:a,sectionIndex:s,row:o,isRenderView:c}=t,{task_status:u,taskRegisterData:d,updateTaskRegisterData:f,updateTaskProgressValue:p,updateUserFormDataSubmit:g,userTaskSubmitFormData:m,TASK_PUBLISHED:b}=si(),{userSelectedLanguage:w}=xn(),[x,S]=k.useState(!1),[C,T]=k.useState(""),[A,I]=k.useState(0),[_,P]=k.useState(!1),q=()=>{P(!0)},U=()=>{P(!1)};k.useEffect(()=>{x||be();const ee=an.addListener("clearRepeatableFields",M=>{M===(o==null?void 0:o.uuid)&&(T(""),I(0),n.isValid=0)}),X=an.addListener("onSubmitUserForm",()=>{var M;(M=n==null?void 0:n.attributes)!=null&&M.required?C!==""&&eu.test(C)===!0?n.isValid=1:n.isValid=0:n.isValid=1});return()=>{X.remove(),ee.remove()}});const[F,O]=k.useState(!1),L=ee=>{O(ee)},J=()=>{O(!1)},be=()=>{var ee,X,M;if(o!=null&&o.rowIsRepeatable){if(o!=null&&o.repeatableFields){const W=[...o.repeatableFields],G=St.findIndex(W,function(he){return he.uuid===(n==null?void 0:n.uuid)});G>=0&&W[G].fieldData?T(W[G].fieldData):T("")}}else{const W=m;if(W!=null&&W.length){for(const G of W)if(G.fieldId===t.field.uuid&&((ee=G==null?void 0:G.postData[0])==null?void 0:ee.postValue)!==""&&((X=G==null?void 0:G.postData[0])!=null&&X.postValue)){T((M=G==null?void 0:G.postData[0])==null?void 0:M.postValue),S(!0);break}}}S(!0)},xe=(ee,X)=>{T(X);const M=m,W=St.cloneDeep(d);if(X!==""&&eu.test(X)===!0){if(W[n==null?void 0:n.uuid]=X,(M==null?void 0:M.length)>0)for(const G of M)G.fieldId===t.field.uuid&&(G.postData[0]={postValue:X})}else if(delete W[n==null?void 0:n.uuid],(M==null?void 0:M.length)>0)for(const G of M)G.fieldId===t.field.uuid&&(G.postData[0]={postValue:""});if(!(o!=null&&o.rowIsRepeatable)){f(W);const G=Object.keys(W).length;p(G)}},le=(ee,X,M,W)=>{var Se;const G=[...m],he=St.findIndex(G,function(Ae){return Ae.rowId===(o==null?void 0:o.uuid)});let Ne=(Se=m[he])==null?void 0:Se.repeatableFields;Ne={...Ne,[M==null?void 0:M.uuid]:W},G[he]={...G[he],repeatableFields:Ne},g(G),T(W),W!==""&&eu.test(W)===!0?n.isValid=1:n.isValid=0},Z=l.jsxs("div",{onMouseOver:q,onMouseOut:U,children:[!c&&!e&&_&&l.jsx(qr,{handleFieldSettingsSidebar:L,...t}),l.jsxs("div",{className:`field ${e?" ":" builder-element-wrapper "}${(n==null?void 0:n.isFluid)===!0?" card py-3 px-4 p-fluid":"card py-3 px-4"}`,children:[l.jsx("div",{className:"grid"}),(n==null?void 0:n.showHeaderText)&&l.jsx("h6",{children:(fe=n==null?void 0:n.headerText)==null?void 0:fe[w==null?void 0:w.type]}),(n==null?void 0:n.showLabel)&&l.jsxs("label",{htmlFor:r,className:"flex font-medium mb-3 text-700 text-2xl",children:[l.jsx(ea,{...t}),((Y=n==null?void 0:n.attributes)==null?void 0:Y.required)&&l.jsx("span",{className:"must-required mr-1",children:"*"})," ",e?l.jsx(l.Fragment,{children:(ie=n==null?void 0:n.label)==null?void 0:ie[w==null?void 0:w.type]}):l.jsx(Xi,{...t}),l.jsx("span",{className:"ml-3",children:(n==null?void 0:n.showToolTip)&&l.jsx(Fi,{message:(K=n==null?void 0:n.toolTip)==null?void 0:K[w==null?void 0:w.type],position:"right"})})]}),l.jsxs("span",{className:"p-input-icon-"+(n==null?void 0:n.iconAlignment),children:[(n==null?void 0:n.showIcon)&&l.jsx("i",{className:"pi pi-"+((ue=(ne=n==null?void 0:n.icon)==null?void 0:ne.properties)==null?void 0:ue.name)}),l.jsx(dn,{id:n==null?void 0:n.uuid,placeholder:(ye=n==null?void 0:n.placeholder)==null?void 0:ye[w==null?void 0:w.type],value:C,onFocus:()=>I(1),onChange:ee=>{o!=null&&o.rowIsRepeatable?le(a,s,n,ee.target.value):xe(ee,ee.target.value)},className:A===1&&((Ee=n==null?void 0:n.attributes)!=null&&Ee.required)?C?"valid":"invalid":"valid'",readOnly:u===b})]}),((Fe=n==null?void 0:n.attributes)==null?void 0:Fe.required)&&l.jsx("div",{children:l.jsx("small",{className:"error",children:A===1&&!C?(Te=n==null?void 0:n.validationMesssage)==null?void 0:Te[w==null?void 0:w.type]:""})}),C!==""&&A===1&&eu.test(C)===!1&&l.jsx("small",{className:"error",children:"Please enter correct url"}),(n==null?void 0:n.showHelperText)&&l.jsx("div",{children:l.jsx("small",{children:(me=n==null?void 0:n.helperText)==null?void 0:me[w==null?void 0:w.type]})})]}),i&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{}),l.jsx(Ii,{...t})]})]});return l.jsxs(l.Fragment,{children:[F===!0&&l.jsx(Yi,{visibilty:F,closeSettingFieldSidebar:J,...t},n==null?void 0:n.uuid),l.jsx(xi,{...t,fieldWrap:Z})]})};vw.defaultProps={field:{},isPreview:!1},vw.propTypes={field:At.any,isPreview:At.bool};const bw=t=>{var fe,Y,ie,K,ne,ue,ye,Ee,Fe;const{isPreview:e,field:n,fieldIndex:r,isAdmin:i,isRenderView:a,pageIndex:s,sectionIndex:o,row:c}=t,{task_status:u,taskRegisterData:d,updateTaskRegisterData:f,updateTaskProgressValue:p,updateUserFormDataSubmit:g,userTaskSubmitFormData:m,TASK_PUBLISHED:b}=si(),{userSelectedLanguage:w}=xn(),[x,S]=k.useState(!1),[C,T]=k.useState(""),[A,I]=k.useState(0),[_,P]=k.useState(!1),q=()=>{P(!0)},U=()=>{P(!1)};k.useEffect(()=>{x||be();const Te=an.addListener("clearRepeatableFields",ee=>{ee===(c==null?void 0:c.uuid)&&(T(""),I(0),n.isValid=0)}),me=an.addListener("onSubmitUserForm",()=>{var ee;(ee=n==null?void 0:n.attributes)!=null&&ee.required?C!==""&&eu.test(C)===!0?n.isValid=1:n.isValid=0:n.isValid=1});return()=>{me.remove(),Te.remove()}});const[F,O]=k.useState(!1),L=Te=>{O(Te)},J=()=>{O(!1)},be=()=>{var Te,me,ee;if(c!=null&&c.rowIsRepeatable){const X=[...(c==null?void 0:c.repeatableFields)||[]],M=St.findIndex(X,function(W){return W.uuid===(n==null?void 0:n.uuid)});M>=0&&X[M].fieldData?T(X[M].fieldData):T("")}else{const X=m;if(X!=null&&X.length){for(const M of X)if(M.fieldId===t.field.uuid&&((Te=M==null?void 0:M.postData[0])==null?void 0:Te.postValue)!==""&&((me=M==null?void 0:M.postData[0])!=null&&me.postValue)){T((ee=M==null?void 0:M.postData[0])==null?void 0:ee.postValue),S(!0);break}}}S(!0)},xe=(Te,me)=>{T(me);const ee=m,X=St.cloneDeep(d);if(ee!==null){if(me){if(X[n==null?void 0:n.uuid]=me,(ee==null?void 0:ee.length)>0)for(const M of ee)M.fieldId===t.field.uuid&&(M.postData[0]={postValue:me})}else if(delete X[n==null?void 0:n.uuid],(ee==null?void 0:ee.length)>0)for(const M of ee)M.fieldId===t.field.uuid&&(M.postData[0]={postValue:""})}if(!(c!=null&&c.rowIsRepeatable)){f(X);const M=Object.keys(X).length;p(M)}},le=(Te,me,ee,X)=>{var he;const M=[...m],W=St.findIndex(M,function(Ne){return Ne.rowId===(c==null?void 0:c.uuid)});let G=(he=m[W])==null?void 0:he.repeatableFields;G={...G,[ee==null?void 0:ee.uuid]:X},M[W]={...M[W],repeatableFields:G},g(M),T(X),X!==""&&eu.test(X)===!0?n.isValid=1:n.isValid=0},Z=l.jsxs("div",{onMouseOver:q,onMouseOut:U,children:[!a&&!e&&_&&l.jsx(qr,{handleFieldSettingsSidebar:L,...t}),l.jsxs("div",{className:`field ${e?" ":" builder-element-wrapper "}${(n==null?void 0:n.isFluid)===!0?" card py-3 px-4 p-fluid":"card py-3 px-4"}`,children:[l.jsx("div",{className:"grid",children:l.jsxs("div",{className:i?"col-6 ":"col-12 p-fluid",children:[(n==null?void 0:n.showHeaderText)&&l.jsx("h6",{children:(fe=n==null?void 0:n.headerText)==null?void 0:fe[w==null?void 0:w.type]}),(n==null?void 0:n.showLabel)&&l.jsxs("label",{htmlFor:r,className:"flex font-medium mb-3 text-700 text-2xl",children:[l.jsx(ea,{...t}),((Y=n==null?void 0:n.attributes)==null?void 0:Y.required)&&l.jsx("span",{className:"must-required mr-1",children:"*"})," ",e?l.jsx(l.Fragment,{children:(ie=n==null?void 0:n.label)==null?void 0:ie[w==null?void 0:w.type]}):l.jsx(Xi,{...t}),(n==null?void 0:n.showToolTip)&&l.jsx("span",{className:"ml-3",children:l.jsx(Fi,{message:(K=n==null?void 0:n.toolTip)==null?void 0:K[w==null?void 0:w.type],position:"right"})})]}),l.jsx("div",{className:"flex justify-content-center",children:l.jsx(o6,{cancelIcon:l.jsx("img",{src:"/assets/images/cancel.png",alt:"custom-cancel-image",width:"25px",height:"25px"}),offIcon:l.jsx("img",{src:"/assets/images/star_10961031.png",alt:"custom-image-active",width:"25px",height:"25px"}),onIcon:l.jsx("img",{src:"/assets/images/star_12259255.png",alt:"custom-image",width:"25px",height:"25px"}),id:n==null?void 0:n.uuid,placeholder:(ne=n==null?void 0:n.placeholder)==null?void 0:ne[w==null?void 0:w.type],value:C,onFocus:()=>I(1),onChange:Te=>{c!=null&&c.rowIsRepeatable?le(s,o,n,Te.value):xe(Te,Te.value)},className:A===1&&((ue=n==null?void 0:n.attributes)!=null&&ue.required)?C?"valid":"invalid":"valid'",readOnly:u===b})}),((ye=n==null?void 0:n.attributes)==null?void 0:ye.required)&&l.jsx("div",{children:l.jsx("small",{className:"error",children:A===1&&!C?(Ee=n==null?void 0:n.validationMesssage)==null?void 0:Ee[w==null?void 0:w.type]:""})}),(n==null?void 0:n.showHelperText)&&l.jsx("div",{children:l.jsx("small",{children:(Fe=n==null?void 0:n.helperText)==null?void 0:Fe[w==null?void 0:w.type]})})]})}),i&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{}),l.jsx(Ii,{...t})]})]})]});return l.jsxs(l.Fragment,{children:[F===!0&&l.jsx(Yi,{visibilty:F,closeSettingFieldSidebar:J,...t},n==null?void 0:n.uuid),l.jsx(xi,{...t,fieldWrap:Z})]})};bw.defaultProps={field:{},isPreview:!1},bw.propTypes={field:At.any,isPreview:At.bool};const yw=t=>{var fe,Y,ie,K,ne,ue,ye,Ee,Fe;const{isPreview:e,field:n,fieldIndex:r,isAdmin:i,isRenderView:a,pageIndex:s,sectionIndex:o,row:c}=t,{task_status:u,taskRegisterData:d,updateTaskRegisterData:f,updateTaskProgressValue:p,updateUserFormDataSubmit:g,userTaskSubmitFormData:m,TASK_PUBLISHED:b}=si(),{userSelectedLanguage:w}=xn(),[x,S]=k.useState(!1),[C,T]=k.useState(""),[A,I]=k.useState(0),[_,P]=k.useState(!1),q=()=>{P(!0)},U=()=>{P(!1)};k.useEffect(()=>{x||be();const Te=an.addListener("clearRepeatableFields",ee=>{ee===(c==null?void 0:c.uuid)&&(T(""),I(0),n.isValid=0)}),me=an.addListener("onSubmitUserForm",ee=>{var X;(X=n==null?void 0:n.attributes)!=null&&X.required?C!==""&&eu.test(C)===!0?n.isValid=1:n.isValid=0:n.isValid=1});return()=>{me.remove(),Te.remove()}});const[F,O]=k.useState(!1),L=Te=>{O(Te)},J=()=>{O(!1)},be=()=>{var Te,me,ee;if(c!=null&&c.rowIsRepeatable){if(c!=null&&c.repeatableFields){const X=[...c.repeatableFields],M=St.findIndex(X,function(W){return W.uuid===(n==null?void 0:n.uuid)});M>=0&&X[M].fieldData?T(X[M].fieldData):T("")}}else{const X=m;if(X!=null&&X.length){for(const M of X)if(M.fieldId===t.field.uuid&&((Te=M==null?void 0:M.postData[0])==null?void 0:Te.postValue)!==""&&((me=M==null?void 0:M.postData[0])!=null&&me.postValue)){T((ee=M==null?void 0:M.postData[0])==null?void 0:ee.postValue),S(!0);break}}}S(!0)},xe=(Te,me)=>{T(me);const ee=m,X=St.cloneDeep(d);if(ee!==null){if(me){if(X[n==null?void 0:n.uuid]=me,(ee==null?void 0:ee.length)>0)for(const M of ee)M.fieldId===t.field.uuid&&(M.postData[0]={postValue:me})}else if(delete X[n==null?void 0:n.uuid],(ee==null?void 0:ee.length)>0)for(const M of ee)M.fieldId===t.field.uuid&&(M.postData[0]={postValue:""})}if(!(c!=null&&c.rowIsRepeatable)){f(X);const M=Object.keys(X).length;p(M)}},le=(Te,me,ee,X)=>{var he;const M=[...m],W=St.findIndex(M,function(Ne){return Ne.rowId===(c==null?void 0:c.uuid)});let G=(he=m[W])==null?void 0:he.repeatableFields;G={...G,[ee==null?void 0:ee.uuid]:X},M[W]={...M[W],repeatableFields:G},g(M),T(X),X!==""&&eu.test(X)===!0?n.isValid=1:n.isValid=0},Z=l.jsxs("div",{onMouseOver:q,onMouseOut:U,children:[!a&&!e&&_&&l.jsx(qr,{handleFieldSettingsSidebar:L,...t}),l.jsx("div",{className:`field ${e?" ":" builder-element-wrapper "}${(n==null?void 0:n.isFluid)===!0?" card py-3 px-4 p-fluid":"card py-3 px-4"}`,children:l.jsxs("div",{className:"grid",children:[l.jsxs("div",{className:e?"col-12 p-fluid":"col-12 p-fluid field-form-builder",children:[(n==null?void 0:n.showHeaderText)&&l.jsx("h6",{children:(fe=n==null?void 0:n.headerText)==null?void 0:fe[w==null?void 0:w.type]}),(n==null?void 0:n.showLabel)&&l.jsxs("label",{htmlFor:r,className:"flex font-medium mb-3 text-700 text-2xl",children:[l.jsx(ea,{...t}),((Y=n==null?void 0:n.attributes)==null?void 0:Y.required)&&l.jsx("span",{className:"must-required mr-1",children:"*"})," ",e?l.jsx(l.Fragment,{children:(ie=n==null?void 0:n.label)==null?void 0:ie[w==null?void 0:w.type]}):l.jsx(Xi,{...t}),l.jsx("span",{className:"ml-3",children:(n==null?void 0:n.showToolTip)&&l.jsx(Fi,{message:(K=n==null?void 0:n.toolTip)==null?void 0:K[w==null?void 0:w.type],position:"right"})})]}),l.jsx(u6,{id:n==null?void 0:n.uuid,placeholder:(ne=n==null?void 0:n.placeholder)==null?void 0:ne[w==null?void 0:w.type],value:C,onFocus:()=>I(1),onChange:Te=>{c!=null&&c.rowIsRepeatable?le(s,o,n,Te.value):xe(Te,Te.value)},className:A===1&&((ue=n==null?void 0:n.attributes)!=null&&ue.required)?C?"valid":"invalid":"valid'",readOnly:u===b}),((ye=n==null?void 0:n.attributes)==null?void 0:ye.required)&&l.jsx("div",{children:l.jsx("small",{className:"error",children:A===1&&!C?(Ee=n==null?void 0:n.validationMesssage)==null?void 0:Ee[w==null?void 0:w.type]:""})}),(n==null?void 0:n.showHelperText)&&l.jsx("div",{children:l.jsx("small",{children:(Fe=n==null?void 0:n.helperText)==null?void 0:Fe[w==null?void 0:w.type]})})]}),i&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{}),l.jsx(Ii,{...t})]})]})})]});return l.jsxs(l.Fragment,{children:[F===!0&&l.jsx(Yi,{visibilty:F,closeSettingFieldSidebar:J,...t},n==null?void 0:n.uuid),l.jsx(xi,{...t,fieldWrap:Z})]})};yw.defaultProps={field:{},isPreview:!1},yw.propTypes={field:At.any,isPreview:At.bool};const Aw=t=>{var Z,fe,Y,ie,K,ne;const{isPreview:e,field:n,isAdmin:r,pageIndex:i,sectionIndex:a,row:s,isRenderView:o}=t,{task_status:c,taskRegisterData:u,updateTaskRegisterData:d,updateTaskProgressValue:f,updateUserFormDataSubmit:p,userTaskSubmitFormData:g,TASK_PUBLISHED:m}=si(),{userSelectedLanguage:b}=xn(),[w,x]=k.useState(!1),[S,C]=k.useState(""),[T,A]=k.useState(0),[I,_]=k.useState(!1),P=()=>{_(!0)},q=()=>{_(!1)};k.useEffect(()=>{w||J();const ue=an.addListener("clearRepeatableFields",Ee=>{Ee===(s==null?void 0:s.uuid)&&(C(""),A(0),n.isValid=0)}),ye=an.addListener("onSubmitUserForm",Ee=>{var Fe;(Fe=n==null?void 0:n.attributes)!=null&&Fe.required&&(S!==""&&eu.test(S)===!0?n.isValid=1:n.isValid=0)});return()=>{ye.remove(),ue.remove()}});const[U,F]=k.useState(!1),O=ue=>{F(ue)},L=()=>{F(!1)},J=()=>{var ue,ye,Ee;if(s!=null&&s.rowIsRepeatable){if(s!=null&&s.repeatableFields){const Fe=[...s.repeatableFields],Te=St.findIndex(Fe,function(me){return me.uuid===(n==null?void 0:n.uuid)});Te>=0&&Fe[Te].fieldData?C(Fe[Te].fieldData):C("")}}else{const Fe=g;if(Fe!=null&&Fe.length){for(const Te of Fe)if(Te.fieldId===t.field.uuid&&((ue=Te==null?void 0:Te.postData[0])==null?void 0:ue.postValue)!==""&&((ye=Te==null?void 0:Te.postData[0])!=null&&ye.postValue)){C((Ee=Te==null?void 0:Te.postData[0])==null?void 0:Ee.postValue),x(!0);break}}}x(!0)},be=(ue,ye)=>{C(ye);const Ee=g,Fe=St.cloneDeep(u);if(ye){if(Fe[n==null?void 0:n.uuid]=ye,(Ee==null?void 0:Ee.length)>0)for(const Te of Ee)Te.fieldId===t.field.uuid&&(Te.postData[0]={postValue:ye})}else if(delete Fe[n==null?void 0:n.uuid],(Ee==null?void 0:Ee.length)>0)for(const Te of Ee)Te.fieldId===t.field.uuid&&(Te.postData[0]={postValue:""});if(!(s!=null&&s.rowIsRepeatable)){d(Fe);const Te=Object.keys(Fe).length;f(Te)}},xe=(ue,ye,Ee,Fe)=>{var X;const Te=[...g],me=St.findIndex(Te,function(M){return M.rowId===(s==null?void 0:s.uuid)});let ee=(X=g[me])==null?void 0:X.repeatableFields;ee={...ee,[Ee==null?void 0:Ee.uuid]:Fe},Te[me]={...Te[me],repeatableFields:ee},p(Te),C(Fe),Fe!==""&&eu.test(Fe)===!0?n.isValid=1:n.isValid=0},le=l.jsxs("div",{onMouseOver:P,onMouseOut:q,children:[!o&&!e&&I&&l.jsx(qr,{handleFieldSettingsSidebar:O,...t}),l.jsxs("div",{className:`field ${e?" ":" builder-element-wrapper "}${(n==null?void 0:n.isFluid)===!0?" p-fluid ":" "} ${o?" ":" py-6 px-4 card"}`,children:[l.jsxs("div",{className:e?"p-fluid":"card p-fluid field-form-builder",children:[!e&&l.jsx("label",{className:"block font-medium mb-3 text-700 text-2xl",children:"Hidden field"}),l.jsx(dn,{type:e===!0?"hidden":"text",id:n==null?void 0:n.uuid,placeholder:(Z=n==null?void 0:n.placeholder)==null?void 0:Z[b==null?void 0:b.type],value:(fe=n==null?void 0:n.defaultValue)==null?void 0:fe[b==null?void 0:b.type],onFocus:()=>A(1),onLoad:()=>{s!=null&&s.rowIsRepeatable?xe(i,a,n,n==null?void 0:n.defaultValue):be("",n==null?void 0:n.defaultValue)},className:T===1&&((Y=n==null?void 0:n.attributes)!=null&&Y.required)?S?"valid":"invalid":"valid'",readOnly:c===m}),((ie=n==null?void 0:n.attributes)==null?void 0:ie.required)&&l.jsx("div",{children:l.jsx("small",{className:"error",children:T===1&&!S?(K=n==null?void 0:n.validationMesssage)==null?void 0:K[b==null?void 0:b.type]:""})}),(n==null?void 0:n.showHelperText)&&l.jsx("div",{children:l.jsx("small",{children:(ne=n==null?void 0:n.helperText)==null?void 0:ne[b==null?void 0:b.type]})})]}),r&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{}),l.jsx(Ii,{...t})]})]})]});return l.jsxs(l.Fragment,{children:[U===!0&&l.jsx(Yi,{visibilty:U,closeSettingFieldSidebar:L,...t}),l.jsx(xi,{...t,fieldWrap:le})]})};Aw.defaultProps={field:{},isPreview:!1},Aw.propTypes={field:At.any,isPreview:At.bool};const UU=t=>{var T;const{field:e,fieldIndex:n,pageIndex:r,sectionIndex:i,rowIndex:a,columnIndex:s,path:o,labelType:c,isPreview:u}=t,[d,f]=k.useState(e);k.useEffect(()=>{var A;return S((A=e[c])==null?void 0:A[p==null?void 0:p.type]),()=>{}},[e]);const{userSelectedLanguage:p,fieldSettingUpdate:g,fieldSettingUpdateInlineConditional:m,gridComponentFieldSettingUpdate:b}=xn(),w=(A,I,_)=>{f(P=>({...P,[A]:{...P[A],[I==null?void 0:I.type]:_}}))},[x,S]=k.useState((T=e[c])==null?void 0:T[p==null?void 0:p.type]);k.useEffect(()=>(C(),()=>{}),[d]);const C=()=>{const A=o.split("-");(t==null?void 0:t.fieldContainer)==="inline-condition-container"?m(A[ra],A[ia],A[oa],A[la],A[ca],A[ma],A[Vo],A[mo],d):(A==null?void 0:A.length)>ma&&(A==null?void 0:A.length)===Fl+1&&(e!=null&&e.componentType)&&(t==null?void 0:t.fieldContainer)==="grid-container"?b(A[ra],A[ia],A[oa],A[la],A[ca],A[5],A[6],A[7],d):g(r,i,a,s,n,{...e,[c]:d[c]})};return l.jsx(l.Fragment,{children:l.jsx(m3,{style:{display:"inline-block"},className:"builder-input-label-edit",html:x,disabled:u,onChange:A=>{var I;S(x3.sanitize((I=A==null?void 0:A.target)==null?void 0:I.value))},onBlur:A=>{var _;const I=x3.sanitize((_=A==null?void 0:A.target)==null?void 0:_.innerText);S(I),w(c,p,I)},tagName:"article"})})},xw=t=>{var K,ne,ue,ye,Ee,Fe,Te;const{taskRegisterData:e,updateTaskRegisterData:n,updateTaskProgressValue:r,updateUserFormDataSubmit:i,userTaskSubmitFormData:a}=si(),{userSelectedLanguage:s,fieldSettingUpdate:o}=xn(),{isPreview:c,field:u,fieldIndex:d,sectionIndex:f,pageIndex:p,row:g,rowIndex:m,columnIndex:b,isAdmin:w,isRenderView:x}=t,[S,C]=k.useState(!1),[T,A]=k.useState(""),[I,_]=k.useState(0),[P,q]=k.useState(!1),[U,F]=k.useState(!1),O=()=>{F(!0)},L=()=>{F(!1)},J=()=>{var me,ee,X;if(g!=null&&g.rowIsRepeatable){if(g!=null&&g.repeatableFields){const M=[...g.repeatableFields],W=St.findIndex(M,function(G){return G.uuid===(u==null?void 0:u.uuid)});W>=0&&M[W].fieldData?A(M[W].fieldData):A("")}}else{const M=a;if(M!=null&&M.length){for(const W of M)if(W.fieldId===t.field.uuid&&((me=W==null?void 0:W.postData[0])==null?void 0:me.postValue)!==""&&((ee=W==null?void 0:W.postData[0])!=null&&ee.postValue)){A((X=W==null?void 0:W.postData[0])==null?void 0:X.postValue);break}}}q(!0)};k.useEffect(()=>{P||J();const me=an.addListener("clearRepeatableFields",W=>{W===(g==null?void 0:g.uuid)&&(A(""),_(0),u.isValid=0,o(p,f,m,b,d,u))}),ee=an.addListener("onSubmitUserForm",W=>{var G;(G=u==null?void 0:u.attributes)!=null&&G.required?T?u.isValid=1:u.isValid=0:u.isValid=1}),X=an.addListener("OnInvalidFieldCatch",W=>{u.uuid===(W==null?void 0:W.fieldId)?_(1):_(0)}),M=an.addListener("OnGetFieldValue",W=>{var he;const G=(he=W==null?void 0:W.repeatableColumn)==null?void 0:he.filter(Ne=>(Ne==null?void 0:Ne.fieldUuid)===(u==null?void 0:u.uuid));G!=null&&G.length});return()=>{ee.remove(),X.remove(),M.remove(),me.remove()}});const be=me=>{C(me)},xe=()=>{C(!1)},le=me=>{var M,W;A(me.target.value);const ee=a,X=St.cloneDeep(e);if(ee!==null){if((M=me==null?void 0:me.target)!=null&&M.value){if(X[u==null?void 0:u.uuid]=(W=me==null?void 0:me.target)==null?void 0:W.value,(ee==null?void 0:ee.length)>0)for(const G of ee)G.fieldId===t.field.uuid&&(G.postData[0]={postValue:me.target.value})}else if(delete X[u==null?void 0:u.uuid],(ee==null?void 0:ee.length)>0)for(const G of ee)G.fieldId===t.field.uuid&&(G.postData[0]={postValue:""})}if(!(g!=null&&g.rowIsRepeatable)){n(X);const G=Object.keys(X).length;r(G)}},Z=(me,ee,X,M)=>{var W;if(a){const G=[...a],he=St.findIndex(G,function(Se){return Se.rowId===(g==null?void 0:g.uuid)});let Ne=(W=a[he])==null?void 0:W.repeatableFields;Ne={...Ne,[X==null?void 0:X.uuid]:M},G[he]={...G[he],repeatableFields:Ne},i(G)}A(M),M!==""?X.isValid=1:X.isValid=0},fe=10,Y=()=>{const me=[];for(let ee=0;ee<=fe;ee++)me.push(l.jsxs("label",{children:[l.jsx("input",{onChange:X=>{g!=null&&g.rowIsRepeatable?Z(p,f,u,X.target.value):le(X)},checked:parseInt(T)===ee,name:"liker-scale"+(u==null?void 0:u.uuid),type:"radio",value:ee}),l.jsx("span",{children:ee})]},`field-${u==null?void 0:u.uuid}-likertScale-${ee} ${parseInt(T)===ee?"scale-selected":""}`));return me},ie=l.jsxs("div",{onMouseOver:O,onMouseOut:L,children:[!x&&!c&&U&&l.jsx(qr,{handleFieldSettingsSidebar:be,...t}),l.jsxs("div",{className:`field ${c?" ":" builder-element-wrapper "}${(u==null?void 0:u.isFluid)===!0?" card py-3 px-4 p-fluid":"card py-3 px-4"}`,children:[l.jsxs("div",{className:"",children:[(u==null?void 0:u.showHeaderText)&&l.jsx("h6",{children:(K=u==null?void 0:u.headerText)==null?void 0:K[s==null?void 0:s.type]}),(u==null?void 0:u.showLabel)&&l.jsxs("label",{htmlFor:d,className:"flex font-medium mb-3 text-700 text-2xl",children:[l.jsx(ea,{...t}),((ne=u==null?void 0:u.attributes)==null?void 0:ne.required)&&l.jsx("span",{className:"must-required mr-1",children:"*"})," ",c?l.jsx(l.Fragment,{children:(ue=u==null?void 0:u.label)==null?void 0:ue[s==null?void 0:s.type]}):l.jsx(Xi,{...t}),l.jsx("span",{className:"ml-3",children:(u==null?void 0:u.showToolTip)&&l.jsx(Fi,{message:(ye=u==null?void 0:u.toolTip)==null?void 0:ye[s==null?void 0:s.type],position:"right"})})]}),l.jsx("div",{className:"flex justify-content-center",children:l.jsxs("div",{className:"mt-4",children:[l.jsxs("div",{className:"flex justify-content-between mb-3",children:[l.jsx("div",{className:"font-medium text-900 ",children:l.jsx(UU,{...t,labelType:"startingMessage"})}),l.jsx("div",{className:"font-medium text-900",children:l.jsx(UU,{...t,labelType:"endingMessage"})})]}),l.jsx("div",{className:"likert",children:Y()})]})}),l.jsx("div",{children:((Ee=u==null?void 0:u.attributes)==null?void 0:Ee.required)&&l.jsx("small",{className:"error",children:I===1&&!T?(Fe=u==null?void 0:u.validationMesssage)==null?void 0:Fe.english:""})}),l.jsx("div",{children:(u==null?void 0:u.showHelperText)&&l.jsx("small",{children:(Te=u==null?void 0:u.helperText)==null?void 0:Te[s==null?void 0:s.type]})})]}),w&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{}),l.jsx(Ii,{...t})]})]})]});return l.jsxs(l.Fragment,{children:[S===!0&&l.jsx(Yi,{visibilty:S,closeSettingFieldSidebar:xe,...t}),l.jsx(xi,{...t,fieldWrap:ie})]})};xw.defaultProps={field:{},isPreview:!1},xw.propTypes={field:At.any,isPreview:At.bool};const ww=t=>{var K,ne,ue,ye,Ee,Fe,Te,me,ee,X,M,W;const{taskRegisterData:e,updateTaskRegisterData:n,updateTaskProgressValue:r,updateUserFormDataSubmit:i,userTaskSubmitFormData:a,task_status:s,TASK_PUBLISHED:o}=si(),{userSelectedLanguage:c,fieldSettingUpdate:u}=xn(),{isPreview:d,field:f,fieldIndex:p,sectionIndex:g,pageIndex:m,row:b,rowIndex:w,columnIndex:x,isAdmin:S,isRenderView:C}=t,[T,A]=k.useState(!1),[I,_]=k.useState(""),[P,q]=k.useState(0),[U,F]=k.useState(!1),[O,L]=k.useState(!1),J=()=>{L(!0)},be=()=>{L(!1)},xe=()=>{var G,he,Ne;if(b!=null&&b.rowIsRepeatable){if(b!=null&&b.repeatableFields){const Se=[...b.repeatableFields],Ae=St.findIndex(Se,function(Ve){return Ve.uuid===(f==null?void 0:f.uuid)});Ae>=0&&Se[Ae].fieldData?_(Se[Ae].fieldData):_("")}}else{const Se=a;if(Se!=null&&Se.length){for(const Ae of Se)if(Ae.fieldId===t.field.uuid&&((G=Ae==null?void 0:Ae.postData[0])==null?void 0:G.postValue)!==""&&((he=Ae==null?void 0:Ae.postData[0])!=null&&he.postValue)){_((Ne=Ae==null?void 0:Ae.postData[0])==null?void 0:Ne.postValue);break}}}F(!0)};k.useEffect(()=>{U||xe();const G=an.addListener("clearRepeatableFields",Ae=>{Ae===(b==null?void 0:b.uuid)&&(_(""),q(0),f.isValid=0,u(m,g,w,x,p,f))}),he=an.addListener("onSubmitUserForm",()=>{var Ae;(Ae=f==null?void 0:f.attributes)!=null&&Ae.required?I?f.isValid=1:f.isValid=0:f.isValid=1}),Ne=an.addListener("OnInvalidFieldCatch",Ae=>{f.uuid===(Ae==null?void 0:Ae.fieldId)?q(1):q(0)}),Se=an.addListener("OnGetFieldValue",Ae=>{var se;const Ve=(se=Ae==null?void 0:Ae.repeatableColumn)==null?void 0:se.filter((pe,z)=>(pe==null?void 0:pe.fieldUuid)===(f==null?void 0:f.uuid));Ve!=null&&Ve.length});return()=>{he.remove(),Ne.remove(),Se.remove(),G.remove()}});const le=G=>{A(G)},Z=()=>{A(!1)},fe=G=>{var Se,Ae;_(G.target.value);const he=a,Ne=St.cloneDeep(e);if(he!==null){if((Se=G==null?void 0:G.target)!=null&&Se.value){if(Ne[f==null?void 0:f.uuid]=(Ae=G==null?void 0:G.target)==null?void 0:Ae.value,(he==null?void 0:he.length)>0)for(const Ve of he)Ve.fieldId===t.field.uuid&&(Ve.postData[0]={postValue:G.target.value})}else if(delete Ne[f==null?void 0:f.uuid],(he==null?void 0:he.length)>0)for(const Ve of he)Ve.fieldId===t.field.uuid&&(Ve.postData[0]={postValue:""})}if(!(b!=null&&b.rowIsRepeatable)){n(Ne);const Ve=Object.keys(Ne).length;r(Ve)}},Y=(G,he)=>{var Ne;if(a){const Se=[...a],Ae=St.findIndex(Se,function(se){return se.rowId===(b==null?void 0:b.uuid)});let Ve=(Ne=a[Ae])==null?void 0:Ne.repeatableFields;Ve={...Ve,[G==null?void 0:G.uuid]:he},Se[Ae]={...Se[Ae],repeatableFields:Ve},i(Se)}_(he),he!==""?G.isValid=1:G.isValid=0},ie=l.jsxs("div",{onMouseOver:J,onMouseOut:be,children:[!C&&!d&&O&&l.jsx(qr,{handleFieldSettingsSidebar:le,...t}),l.jsxs("div",{className:`field ${d?" ":" builder-element-wrapper "}${(f==null?void 0:f.isFluid)===!0?" card py-3 px-4 p-fluid":"card py-3 px-4"}`,children:[l.jsx("div",{className:"grid",children:l.jsxs("div",{className:d?"col-12 ":"col-12 p-fluid",children:[(f==null?void 0:f.showHeaderText)&&l.jsx("h6",{children:(K=f==null?void 0:f.headerText)==null?void 0:K[c==null?void 0:c.type]}),(f==null?void 0:f.showLabel)&&l.jsxs("label",{htmlFor:p,className:"flex font-medium mb-3 text-700 text-2xl",children:[l.jsx(ea,{...t}),((ne=f==null?void 0:f.attributes)==null?void 0:ne.required)&&l.jsx("span",{className:"must-required mr-1",children:"*"})," ",d?l.jsx(l.Fragment,{children:(ue=f==null?void 0:f.label)==null?void 0:ue[c==null?void 0:c.type]}):l.jsx(Xi,{...t}),l.jsx("span",{className:"ml-3",children:(f==null?void 0:f.showToolTip)&&l.jsx(Fi,{message:(ye=f==null?void 0:f.toolTip)==null?void 0:ye[c==null?void 0:c.type],position:"right"})})]}),l.jsxs("div",{className:"mt-3",children:[l.jsxs("span",{className:"p-input-icon-"+(f==null?void 0:f.iconAlignment),children:[(f==null?void 0:f.showIcon)&&l.jsx("i",{className:"pi pi-"+((Fe=(Ee=f==null?void 0:f.icon)==null?void 0:Ee.properties)==null?void 0:Fe.name)}),l.jsx(dn,{id:f==null?void 0:f.uuid,placeholder:(Te=f==null?void 0:f.placeholder)==null?void 0:Te[c==null?void 0:c.type],value:I,onFocus:()=>q(1),onChange:G=>{b!=null&&b.rowIsRepeatable?Y(f,G.target.value):fe(G)},className:P===1&&((me=f==null?void 0:f.attributes)!=null&&me.required)?I?"valid mt-2 mr-2":"invalid mt-2":"valid mt-2",readOnly:s===o})]}),l.jsx("div",{children:((ee=f==null?void 0:f.attributes)==null?void 0:ee.required)&&l.jsx("small",{className:"error",children:P===1&&!I?(X=f==null?void 0:f.validationMesssage)==null?void 0:X.english:""})}),l.jsx("div",{children:(f==null?void 0:f.showHelperText)&&l.jsx("small",{children:(M=f==null?void 0:f.helperText)==null?void 0:M[c==null?void 0:c.type]})})]})]})}),l.jsx("p",{className:"text-center",children:l.jsx("span",{className:`${(W=f==null?void 0:f.fontStyle)==null?void 0:W.font} text-center`,style:{fontSize:f==null?void 0:f.fontSize},children:I})}),S&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{}),l.jsx(Ii,{...t})]})]})]});return l.jsxs(l.Fragment,{children:[T===!0&&l.jsx(Yi,{visibilty:T,closeSettingFieldSidebar:Z,...t}),l.jsx(xi,{...t,fieldWrap:ie})]})};ww.defaultProps={field:{},isPreview:!1},ww.propTypes={field:At.any,isPreview:At.bool};const Sw=t=>{var me,ee,X,M,W,G,he,Ne,Se,Ae,Ve,se,pe,z,te,oe,de;const e=ge=>{const Ie=ge.collapsed?"pi pi-chevron-down":"pi pi-chevron-up",$e=`${ge.className} justify-content-start`,nt=`${ge.titleClassName} pl-1`;return l.jsxs("div",{className:$e,children:[l.jsxs("button",{className:ge.togglerClassName,onClick:ge.onTogglerClick,children:[l.jsx("span",{className:Ie}),l.jsx(In,{})]}),l.jsx("span",{className:nt,children:xe})]})},{globalIsAlignmentRight:n,taskRegisterData:r,updateTaskRegisterData:i,updateTaskProgressValue:a,userTaskSubmitFormData:s,TASK_PUBLISHED:o,task_status:c}=si(),{userSelectedLanguage:u,fieldSettingUpdate:d}=xn(),{isPreview:f,field:p,fieldIndex:g,sectionIndex:m,pageIndex:b,row:w,rowIndex:x,columnIndex:S,isAdmin:C,isRenderView:T}=t,[A,I]=k.useState(!1),[_,P]=k.useState(null),[q,U]=k.useState({country:null,city:null,state:null,addressOne:null,addressTwo:null,zipcode:null,isBillingAddressSame:!1,billingCountry:null,billingCity:null,billingState:null,billingAddressOne:null,billingAddressTwo:null,billingZipcode:null}),[F,O]=k.useState(!1),L=()=>{O(!0)},J=()=>{O(!1)},be=(ge,Ie)=>{let $e={...q};$e={...$e,[ge]:Ie},U($e),($e==null?void 0:$e.addressOne)!==""&&($e!=null&&$e.addressTwo)&&($e!=null&&$e.zipcode)&&Fe($e==null?void 0:$e.zipcode)?(p.isValid=1,ue($e,!0)):(p.isValid=0,ue(null,!1))},[xe]=k.useState((me=p==null?void 0:p.label)==null?void 0:me[u==null?void 0:u.type]),[le,Z]=k.useState(0),[fe,Y]=k.useState(!1),ie=()=>{var ge,Ie;if(!(w!=null&&w.rowIsRepeatable)){const $e=s;if($e!=null&&$e.length){for(const nt of $e)if(nt.fieldId===t.field.uuid&&((ge=nt==null?void 0:nt.postData[0])!=null&&ge.postValue)){U((Ie=nt==null?void 0:nt.postData[0])==null?void 0:Ie.postValue);break}}}Y(!0)};k.useEffect(()=>{fe||ie();const ge=an.addListener("clearRepeatableFields",Nt=>{Nt===(w==null?void 0:w.uuid)&&(Z(0),p.isValid=0,d(b,m,x,S,g,p))}),Ie=an.addListener("onSubmitUserForm",()=>{var Nt;(Nt=p==null?void 0:p.attributes)!=null&&Nt.required?(q==null?void 0:q.addressOne)!==""&&(q==null?void 0:q.zipcode)!==""&&Fe(q==null?void 0:q.zipcode)?p.isValid=1:p.isValid=0:p.isValid=1}),$e=an.addListener("OnInvalidFieldCatch",Nt=>{p.uuid===(Nt==null?void 0:Nt.fieldId)?Z(1):Z(0)}),nt=an.addListener("OnGetFieldValue",Nt=>{var xt;const gt=(xt=Nt==null?void 0:Nt.repeatableColumn)==null?void 0:xt.filter(tt=>(tt==null?void 0:tt.fieldUuid)===(p==null?void 0:p.uuid));gt!=null&&gt.length}),it=an.addListener("formFieldAdded",Nt=>{_===null&&P(Nt==null?void 0:Nt.uuid)});return()=>{Ie.remove(),$e.remove(),nt.remove(),ge.remove(),it.remove()}});const K=ge=>{I(ge)},ne=()=>{I(!1)},ue=(ge,Ie)=>{const $e=s,nt=St.cloneDeep(r);if(Ie){if(nt[p==null?void 0:p.uuid]=ge,($e==null?void 0:$e.length)>0)for(const it of $e)it.fieldId===t.field.uuid&&(it.postData[0]={postValue:ge})}else if(delete nt[p==null?void 0:p.uuid],($e==null?void 0:$e.length)>0)for(const it of $e)it.fieldId===t.field.uuid&&(it.postData[0]={postValue:ge});if(!(w!=null&&w.rowIsRepeatable)){i(nt);const it=Object.keys(nt).length;a(it)}},ye=()=>{let ge="";return f||(ge=ge+" field-form-builder"),c===o&&C===!0&&(ge=ge+" card"),ge},Ee=()=>{let ge=!1;return q.addressOne!==""&&q.zipcode!==""&&Fe(q.zipcode)&&(ge=!0),ge};function Fe(ge){const Ie=/\d/.test(ge),$e=/[a-zA-Z]/.test(ge);return Ie&&$e?!0:!!Ie}k.useEffect(()=>(_!==null&&setTimeout(()=>{P(null)},1e3),()=>{}),[_]);const Te=l.jsxs("div",{onMouseOver:L,onMouseOut:J,children:[!T&&!f&&F&&l.jsx(qr,{handleFieldSettingsSidebar:K,...t}),l.jsxs("div",{className:`field ${f?" ":" builder-element-wrapper "} ${(p==null?void 0:p.isFluid)===!0?" card py-3 px-4 p-fluid":"card p-4"} ${_===(p==null?void 0:p.uuid)?" new-field ":" card "}`,children:[l.jsx("div",{className:"grid",children:l.jsxs("div",{className:f?"col-12 ":"col-11 p-fluid",children:[(p==null?void 0:p.showHeaderText)&&l.jsx("h6",{children:(ee=p==null?void 0:p.headerText)==null?void 0:ee[u==null?void 0:u.type]}),(p==null?void 0:p.showLabel)&&l.jsxs("label",{htmlFor:g,className:"flex font-medium mb-3 text-700 text-2xl",children:[l.jsx(ea,{...t}),((X=p==null?void 0:p.attributes)==null?void 0:X.required)&&l.jsx("span",{className:"must-required mr-1",children:"*"})," ",f?l.jsx(l.Fragment,{children:(M=p==null?void 0:p.label)==null?void 0:M[u==null?void 0:u.type]}):l.jsx(Xi,{...t}),l.jsx("span",{className:"ml-3",children:(p==null?void 0:p.showToolTip)&&l.jsx(Fi,{message:(W=p==null?void 0:p.toolTip)==null?void 0:W[u==null?void 0:u.type],position:"right"})})]}),l.jsxs("div",{className:"mt-3 p-fluid",children:[l.jsx("div",{children:l.jsx("label",{className:"w-full",htmlFor:"",children:(G=p==null?void 0:p.addresslineFirstLabel)==null?void 0:G[u==null?void 0:u.type]})}),l.jsx(dn,{value:q.addressOne||"",onChange:ge=>be("addressOne",ge.target.value),className:"my-2 ",readOnly:c===o}),l.jsx("div",{children:l.jsx("label",{htmlFor:"",children:(he=p==null?void 0:p.addresslineSecondLabel)==null?void 0:he[u==null?void 0:u.type]})}),l.jsx(dn,{value:q.addressTwo||"",onChange:ge=>be("addressTwo",ge.target.value),className:"my-2",readOnly:c===o}),l.jsx("div",{children:l.jsx("label",{htmlFor:"",children:(Ne=p==null?void 0:p.postalcodeLabel)==null?void 0:Ne[u==null?void 0:u.type]})}),l.jsx(dn,{value:q.zipcode||"",onChange:ge=>be("zipcode",ge.target.value),className:"my-2",readOnly:c===o}),l.jsx("p",{children:!Fe(q.zipcode)&&l.jsx("small",{children:"Cannot be alphabetical only."})}),((Se=p==null?void 0:p.attributes)==null?void 0:Se.required)&&!Ee()&&l.jsx("small",{className:"error",children:le===1?(Ae=p==null?void 0:p.validationMesssage)==null?void 0:Ae.english:""}),(p==null?void 0:p.showBillingAddress)===!0&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"field-checkbox",children:[l.jsx(Dr,{inputId:"binary",checked:q.isBillingAddressSame,onChange:ge=>{be("isBillingAddressSame",ge.checked),ge.checked?U(Ie=>({...Ie,billingCountry:q.country,billingCity:q.city,billingState:q.state,billingAddressOne:q.addressOne,billingAddressTwo:q.addressTwo,billingZipcode:q.zipcode})):U(Ie=>({...Ie,billingCountry:null,billingCity:null,billingState:null,billingAddressOne:null,billingAddressTwo:null,billingZipcode:null}))},disabled:c===o}),l.jsx("label",{htmlFor:"binary",children:"Is Billing Address Same"})]}),q.isBillingAddressSame===!1&&l.jsxs(l.Fragment,{children:[(p==null?void 0:p.showLabel)&&l.jsxs("label",{htmlFor:g,className:"flex font-medium mb-3 text-700 text-2xl",children:[((Ve=p==null?void 0:p.attributes)==null?void 0:Ve.required)&&l.jsx("span",{className:"must-required",children:"*"})," ",(se=p==null?void 0:p.billingLabel)==null?void 0:se[u==null?void 0:u.type],l.jsx("span",{className:"ml-3",children:(p==null?void 0:p.showToolTip)&&l.jsx(Fi,{message:(pe=p==null?void 0:p.toolTip)==null?void 0:pe[u==null?void 0:u.type],position:"right"})})]}),l.jsx("label",{htmlFor:"",children:(z=p==null?void 0:p.addresslineFirstLabel)==null?void 0:z[u==null?void 0:u.type]}),l.jsx(dn,{value:q.billingAddressOne||"",onChange:ge=>be("billingAddressOne",ge.target.value),className:"my-2",readOnly:c===o}),l.jsx("label",{htmlFor:"",children:(te=p==null?void 0:p.addresslineSecondLabel)==null?void 0:te[u==null?void 0:u.type]}),l.jsx(dn,{value:q.billingAddressTwo||"",onChange:ge=>be("billingAddressTwo",ge.target.value),className:"my-2",readOnly:c===o}),l.jsx("label",{htmlFor:"",children:(oe=p==null?void 0:p.postalcodeLabel)==null?void 0:oe[u==null?void 0:u.type]}),l.jsx(dn,{value:q.billingZipcode||"",onChange:ge=>be("billingZipcode",ge.target.value),className:"my-2",readOnly:c===o}),!Fe(q.billingZipcode)&&l.jsx("small",{children:"Cannot be alphabetical only."})]})]}),l.jsx("div",{}),l.jsx("div",{children:(p==null?void 0:p.showHelperText)&&l.jsx("small",{children:(de=p==null?void 0:p.helperText)==null?void 0:de[u==null?void 0:u.type]})})]})]})}),C&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{}),l.jsx(Ii,{...t})]})]})]});return l.jsxs(l.Fragment,{children:[A===!0&&l.jsx(Yi,{visibilty:A,closeSettingFieldSidebar:ne,...t}),l.jsx("div",{dir:n?"rtl":"ltr",className:ye(),children:c===o&&C===!0?l.jsx(Pi,{headerTemplate:e,toggleable:!0,children:Te}):Te})]})};Sw.defaultProps={field:{},isPreview:!1},Sw.propTypes={field:At.any,isPreview:At.bool};const yxe=t=>{var x;const{isPreview:e,customColumn:n,indexes:r,customColumnIndex:i,handleDrop:a,path:s,field:o,onSetValuetoPostData:c,emitSocketData:u,fieldIndex:d,sectionIndex:f,pageIndex:p,rowIndex:g,columnIndex:m,isAdvanceView:b}=t,w=(S,C)=>{c(S,C)};return l.jsxs("div",{className:"p-2 py-4",children:[((x=o.children)==null?void 0:x.length)>0&&o.children.map((S,C)=>S[`${r.rowIndex}-${i}`]?l.jsx("div",{children:l.jsx(vg,{type:"grid",showFieldIcons:!1,onChange:w,data:S[`${r.rowIndex}-${i}`],field:S[`${r.rowIndex}-${i}`],path:`${s}-${r.rowIndex}-${i}-${C}`,isPreview:e,emitSocketData:u,sectionIndex:f,pageIndex:p,rowIndex:g,columnIndex:m,fieldIndex:C,fieldContainer:"grid-container"})},`${r.rowIndex}-${i}-${C}`):l.jsx(l.Fragment,{})),e===!1&&l.jsx("div",{className:"py-5",children:l.jsx(Ri,{isAdvanceView:b,fieldDropArea:!0,data:{path:`${s}-${r.rowIndex}-${i}`,childrenCount:1,droppedField:n},onDrop:a})})]})},jU=t=>{var A,I,_,P,q,U,F;const{field:e,isPreview:n,userSelectedLanguage:r,fieldIndex:i,customColumnHeaderTemplate:a,onSetValuetoPostData:s,setAllFields:o,allFields:c,actionHeaderTemplate:u,actionBodyTemplate:d,isFocus:f,inputValue:p,handleFieldSettingsSidebar:g,isAdmin:m,emitSocketData:b,isRenderView:w}=t,[x,S]=k.useState(!1),C=()=>{S(!0)},T=()=>{S(!1)};return l.jsxs("div",{onMouseOver:C,onMouseOut:T,children:[!w&&!n&&x&&l.jsx(qr,{handleFieldSettingsSidebar:g,...t}),l.jsxs("div",{className:`field ${n?" ":" builder-element-wrapper "}${(e==null?void 0:e.isFluid)===!0?" card py-3 px-4 ":"card py-3 px-4"}`,children:[l.jsx("div",{className:"grid",children:l.jsxs("div",{className:"col-12 ",children:[(e==null?void 0:e.showHeaderText)&&l.jsx("h6",{children:(A=e==null?void 0:e.headerText)==null?void 0:A[r==null?void 0:r.type]}),(e==null?void 0:e.showLabel)&&l.jsxs("label",{htmlFor:i,className:"flex font-medium mb-3 text-700 text-2xl",children:[l.jsx(ea,{...t}),((I=e==null?void 0:e.attributes)==null?void 0:I.required)&&l.jsx("span",{className:"must-required mr-1",children:"*"})," ",n?l.jsx(l.Fragment,{children:(_=e==null?void 0:e.label)==null?void 0:_[r==null?void 0:r.type]}):l.jsx(Xi,{...t}),l.jsx("span",{className:"ml-3",children:(e==null?void 0:e.showToolTip)&&l.jsx(Fi,{message:(P=e==null?void 0:e.toolTip)==null?void 0:P[r==null?void 0:r.type],position:"right"})})]}),l.jsxs("div",{className:"mt-3",children:[l.jsxs($o,{scrollable:!0,showGridlines:!0,columnResizeMode:"expand",resizableColumns:!0,value:e==null?void 0:e.options,tableStyle:{minWidth:"50rem"},children:[e==null?void 0:e.customColumnsForOptions.map((O,L)=>l.jsx(Ar,{style:{minWidth:350},header:a(O,L),body:(J,be)=>l.jsx(yxe,{customColumn:O,e:J,indexes:be,customColumnIndex:L,onSetValuetoPostData:s,setAllFields:o,allFields:c,emitSocketData:b,field:e,...t})},O==null?void 0:O.uuid)),!n&&l.jsx(Ar,{frozen:!0,header:O=>u(O),body:(O,L)=>d(O,L),headerStyle:{textAlign:"left"},bodyStyle:{textAlign:"left",overflow:"visible"}})]}),l.jsx("div",{children:((q=e==null?void 0:e.attributes)==null?void 0:q.required)&&l.jsx("small",{className:"error",children:f===1&&!p?(U=e==null?void 0:e.validationMesssage)==null?void 0:U.english:""})}),l.jsx("div",{children:(e==null?void 0:e.showHelperText)&&l.jsx("small",{children:(F=e==null?void 0:e.helperText)==null?void 0:F[r==null?void 0:r.type]})})]})]})}),m&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{}),l.jsx(Ii,{...t})]})]})]})},lv=t=>{var me;const e=ee=>{const X=ee.collapsed?"pi pi-chevron-down":"pi pi-chevron-up",M=`${ee.className} justify-content-start`,W=`${ee.titleClassName} pl-1`;return l.jsxs("div",{className:M,children:[l.jsxs("button",{className:ee.togglerClassName,onClick:ee.onTogglerClick,children:[l.jsx("span",{className:X}),l.jsx(In,{})]}),l.jsx("span",{className:W,children:T})]})},{userTaskSubmitFormData:n,TASK_PUBLISHED:r,task_status:i}=si(),{userSelectedLanguage:a,fieldSettingUpdate:s}=xn(),{isPreview:o,field:c,fieldIndex:u,sectionIndex:d,pageIndex:f,row:p,rowIndex:g,columnIndex:m,isAdmin:b}=t,[w,x]=k.useState(!1),[S,C]=k.useState(""),[T]=k.useState((me=c==null?void 0:c.label)==null?void 0:me[a==null?void 0:a.type]),[A,I]=k.useState(0),[_,P]=k.useState(!1),[q,U]=k.useState(null),[F,O]=k.useState([]),L=()=>{var ee,X,M;if(p!=null&&p.rowIsRepeatable){if(p!=null&&p.repeatableFields){const W=[...p.repeatableFields],G=St.findIndex(W,function(he){return he.uuid===(c==null?void 0:c.uuid)});G>=0&&W[G].fieldData?C(W[G].fieldData):C("")}}else{const W=n;if(W!=null&&W.length){for(const G of W)if(G.fieldId===t.field.uuid&&((ee=G==null?void 0:G.postData[0])==null?void 0:ee.postValue)!==""&&((X=G==null?void 0:G.postData[0])!=null&&X.postValue)){C((M=G==null?void 0:G.postData[0])==null?void 0:M.postValue);break}}}P(!0)},J=()=>{const ee=c;ee.customColumnsForOptions=[...ee.customColumnsForOptions,{customKey:"Column",uuid:Ze()}],Te(ee)},[be,xe]=k.useState(!1),le=(ee,X)=>{var M;return l.jsxs(l.Fragment,{children:[((M=c==null?void 0:c.options)==null?void 0:M.length)>1&&l.jsx(Rt,{text:!0,type:"button",className:"p-button-danger left-space ",icon:"pi pi-trash",onClick:()=>Y(ee==null?void 0:ee.uuid,X==null?void 0:X.rowIndex),rounded:!0,severity:"secondary","aria-label":"Bookmark",size:"small"}),l.jsx(Rt,{text:!0,type:"button",icon:"pi pi-plus",rounded:!0,severity:"secondary",onClick:()=>Ee(),"aria-label":"Add Row",size:"small"})]})},Z=(ee,X)=>{var M;return l.jsxs(l.Fragment,{children:[ee==null?void 0:ee.customKey,o===!1&&l.jsxs(l.Fragment,{children:[((M=c==null?void 0:c.customColumnsForOptions)==null?void 0:M.length)>1&&l.jsx("i",{className:"pi pi-trash ml-3",onClick:()=>ie(ee==null?void 0:ee.uuid,X)}),l.jsx("i",{className:"pi pi-cog ml-3",onClick:()=>{U(ee),xe(!0)}})]})]})},fe=ee=>l.jsx(l.Fragment,{children:l.jsx(Rt,{text:!0,icon:"pi pi-plus",onClick:()=>J(),rounded:!0,severity:"secondary","aria-label":"Cancel"})}),Y=(ee,X)=>{var Ne,Se;const M=(Ne=c==null?void 0:c.customColumnsForOptions)==null?void 0:Ne.length,W=[...(c==null?void 0:c.children)||[]];(Se=c==null?void 0:c.children)==null||Se.map(Ae=>{for(let Ve=0;Ve<M;Ve++)if(Ae[`${X}-${Ve}`]!==void 0){const se=St.findIndex(W,function(pe){return pe[`${X}-${Ve}`]!==void 0});W.splice(se,1)}});for(let Ae=0;Ae<(W==null?void 0:W.length);Ae++){const Ve=W[Ae],pe=Object.keys(Ve)[0].split("-");parseInt(pe[0])>X&&(W[Ae]={[`${parseInt(pe[0])-1}-${pe[1]}`]:W[Ae][`${parseInt(pe[0])}-${pe[1]}`]})}const G=c==null?void 0:c.options.filter(function(Ae){return(Ae==null?void 0:Ae.uuid)!==ee}),he={...c,children:[...W]};he.options=G,Te(he)},ie=(ee,X)=>{var Se,Ae;const M=St.findIndex(c==null?void 0:c.customColumnsForOptions,Ve=>Ve.uuid===ee),W=c==null?void 0:c.customColumnsForOptions.filter(function(Ve,se){return se!==M}),G=(Se=c==null?void 0:c.options)==null?void 0:Se.length,he=[...(c==null?void 0:c.children)||[]];(Ae=c==null?void 0:c.children)==null||Ae.map(Ve=>{for(let se=0;se<G;se++)if(Ve[`${se}-${X}`]!==void 0){const pe=St.findIndex(he,function(z){return z[`${se}-${X}`]!==void 0});he.splice(pe,1)}});for(let Ve=0;Ve<(he==null?void 0:he.length);Ve++){const se=he[Ve],z=Object.keys(se)[0].split("-");parseInt(z[1])>X&&(he[Ve]={[`${parseInt(z[0])}-${parseInt(z[1])-1}`]:he[Ve][`${parseInt(z[0])}-${z[1]}`]})}const Ne={...c,children:[...he]};Ne.customColumnsForOptions=W,Te(Ne)};k.useEffect(()=>{_||L();const ee=an.addListener("clearRepeatableFields",G=>{G===(p==null?void 0:p.uuid)&&(C(""),I(0),c.isValid=0,s(f,d,g,m,u,c))}),X=an.addListener("onSubmitUserForm",()=>{var G;(G=c==null?void 0:c.attributes)!=null&&G.required&&(c.isValid=1)}),M=an.addListener("OnInvalidFieldCatch",G=>{c.uuid===(G==null?void 0:G.fieldId)?I(1):I(0)}),W=an.addListener("OnGetFieldValue",G=>{var Ne;const he=(Ne=G==null?void 0:G.repeatableColumn)==null?void 0:Ne.filter((Se,Ae)=>(Se==null?void 0:Se.fieldUuid)===(c==null?void 0:c.uuid));he!=null&&he.length});return()=>{X.remove(),M.remove(),W.remove(),ee.remove()}});const K=ee=>{x(ee)},ne=()=>{x(!1)},ue=(ee,X)=>{var W;const M=n;if((M==null?void 0:M.length)>0)for(const G of M)G.fieldId===t.field.uuid&&(G.postData[0]={postValue:{...(W=G.postData[0])==null?void 0:W.postValue,[ee]:X}})},ye=()=>{let ee="";return o||(ee=ee+" field-form-builder"),i===r&&b===!0&&(ee=ee+" card"),ee},Ee=()=>{const ee=c;ee.options=[...ee.options,{uuid:Ze(),custom_values:{}}],Te(ee)},Fe=(ee,X)=>{U(he=>({...he,customKey:X}));const M=c.customColumnsForOptions,W=M.findIndex(he=>he.uuid===ee.uuid);M[W]={...M[W],customKey:X};const G=c;G.customColumnsForOptions=M,Te(G)},Te=ee=>{s(f,d,g,m,u,ee)};return l.jsxs(l.Fragment,{children:[l.jsx(Ms,{maximizable:!0,header:"Update Column Title",visible:be,style:{width:"20vw"},footer:()=>l.jsx(Rt,{text:!0,label:"Save",onClick:()=>xe(!1)}),onHide:()=>xe(!1),children:l.jsx("div",{className:"p-fluid",children:l.jsx(dn,{value:(q==null?void 0:q.customKey)||"",onChange:ee=>Fe(q,ee.target.value)})})}),l.jsx(Yi,{visibilty:w,closeSettingFieldSidebar:ne,...t}),l.jsx("div",{dir:"rtl",className:ye(),children:i===r&&b===!0?l.jsx(Pi,{headerTemplate:e,toggleable:!0,children:l.jsx(jU,{...t,field:c,isPreview:o,userSelectedLanguage:a,fieldIndex:u,customColumnHeaderTemplate:Z,onSetValuetoPostData:ue,setAllFields:O,allFields:F,actionHeaderTemplate:fe,actionBodyTemplate:le,addOption:Ee,isFocus:A,inputValue:S,handleFieldSettingsSidebar:K,isAdmin:b})}):l.jsx(jU,{...t,field:c,isPreview:o,userSelectedLanguage:a,fieldIndex:u,customColumnHeaderTemplate:Z,onSetValuetoPostData:ue,setAllFields:O,allFields:F,actionHeaderTemplate:fe,actionBodyTemplate:le,addOption:Ee,isFocus:A,inputValue:S,handleFieldSettingsSidebar:K,isAdmin:b})})]})};lv.defaultProps={field:{},isPreview:!1},lv.propTypes={field:At.any,isPreview:At.bool};const Axe=t=>{const{customColumn:e,e:n,indexes:r,customColumnIndex:i,setAllFields:a,allFields:s}=t,o=c=>{const u={...s};u[`${r==null?void 0:r.rowIndex}-${i}`]=c,a(u)};return l.jsx("div",{children:l.jsx(ga,{value:s[`${r==null?void 0:r.rowIndex}-${i}`],options:e.options,onChange:c=>o(c.value),optionLabel:"label",placeholder:"Select"})})},zU=t=>{var T,A,I,_,P,q,U;const{field:e,isPreview:n,userSelectedLanguage:r,fieldIndex:i,customColumnHeaderTemplate:a,customColumnRowBodyTemplate:s,setAllFields:o,allFields:c,actionHeaderTemplate:u,actionBodyTemplate:d,isFocus:f,inputValue:p,handleFieldSettingsSidebar:g,isAdmin:m,isRenderView:b}=t,[w,x]=k.useState(!1),S=()=>{x(!0)},C=()=>{x(!1)};return l.jsxs("div",{onMouseOver:S,onMouseOut:C,children:[!b&&!n&&w&&l.jsx(qr,{handleFieldSettingsSidebar:g,...t}),l.jsxs("div",{className:`field ${n?" ":" builder-element-wrapper "}${(e==null?void 0:e.isFluid)===!0?" card py-3 px-4 p-fluid":"card py-3 px-4"}`,children:[l.jsx("div",{className:"grid",children:l.jsxs("div",{className:n?"col-12 ":"col-11 p-fluid",children:[(e==null?void 0:e.showHeaderText)&&l.jsx("h6",{children:(T=e==null?void 0:e.headerText)==null?void 0:T[r==null?void 0:r.type]}),(e==null?void 0:e.showLabel)&&l.jsxs("label",{htmlFor:i,className:"flex font-medium mb-3 text-700 text-2xl",children:[l.jsx(ea,{...t}),((A=e==null?void 0:e.attributes)==null?void 0:A.required)&&l.jsx("span",{className:"must-required",children:"*"})," ",n?l.jsx(l.Fragment,{children:(I=e==null?void 0:e.label)==null?void 0:I[r==null?void 0:r.type]}):l.jsx(Xi,{...t}),l.jsx("span",{className:"ml-3",children:(e==null?void 0:e.showToolTip)&&l.jsx(Fi,{message:(_=e==null?void 0:e.toolTip)==null?void 0:_[r==null?void 0:r.type],position:"right"})})]}),l.jsxs("div",{className:"mt-3",children:[l.jsxs($o,{showGridlines:!0,value:e==null?void 0:e.rows,children:[l.jsx(Ar,{frozen:!0,header:"",headerStyle:{textAlign:"left"},bodyStyle:{textAlign:"left",overflow:"visible"},body:F=>s(F)}),e==null?void 0:e.customColumns.map((F,O)=>l.jsx(Ar,{header:a(F),headerStyle:{textAlign:"left"},bodyStyle:{textAlign:"left",overflow:"visible"},body:(L,J)=>l.jsx(Axe,{customColumn:F,e:L,indexes:J,customColumnIndex:O,setAllFields:o,allFields:c,field:e,...t})},F==null?void 0:F.uuid)),n===!1&&l.jsx(Ar,{frozen:!0,header:F=>u(F),body:F=>d(F),headerStyle:{textAlign:"left"},bodyStyle:{textAlign:"left",overflow:"visible"}})]}),l.jsx("div",{children:((P=e==null?void 0:e.attributes)==null?void 0:P.required)&&l.jsx("small",{className:"error",children:f===1&&!p?(q=e==null?void 0:e.validationMesssage)==null?void 0:q.english:""})}),l.jsx("div",{children:(e==null?void 0:e.showHelperText)&&l.jsx("small",{children:(U=e==null?void 0:e.helperText)==null?void 0:U[r==null?void 0:r.type]})})]})]})}),m&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{}),l.jsx(Ii,{...t})]})]})]})},Cw=(t,e)=>{var Ae,Ve;const n=se=>{const pe=se.collapsed?"pi pi-chevron-down":"pi pi-chevron-up",z=`${se.className} justify-content-start`,te=`${se.titleClassName} pl-1`;return l.jsxs("div",{className:z,children:[l.jsxs("button",{className:se.togglerClassName,onClick:se.onTogglerClick,children:[l.jsx("span",{className:pe}),l.jsx(In,{})]}),l.jsx("span",{className:te,children:A})]})},{userTaskSubmitFormData:r,TASK_PUBLISHED:i,task_status:a}=si(),{userSelectedLanguage:s,fieldSettingUpdate:o}=xn(),{isPreview:c,field:u,fieldIndex:d,sectionIndex:f,pageIndex:p,row:g,rowIndex:m,columnIndex:b,isAdmin:w}=t,[x,S]=k.useState(!1),[C,T]=k.useState(""),[A]=k.useState((Ae=u==null?void 0:u.label)==null?void 0:Ae[s==null?void 0:s.type]),[I,_]=k.useState(0),[P,q]=k.useState(!1),[U,F]=k.useState(null),[O,L]=k.useState(null),[J,be]=k.useState({}),xe=()=>{var se,pe,z;if(g!=null&&g.rowIsRepeatable){if(g!=null&&g.repeatableFields){const te=[...g.repeatableFields],oe=St.findIndex(te,function(de){return de.uuid===(u==null?void 0:u.uuid)});oe>=0&&te[oe].fieldData?T(te[oe].fieldData):T("")}}else{const te=r;if(te!=null&&te.length){for(const oe of te)if(oe.fieldId===t.field.uuid&&((se=oe==null?void 0:oe.postData[0])==null?void 0:se.postValue)!==""&&((pe=oe==null?void 0:oe.postData[0])!=null&&pe.postValue)){T((z=oe==null?void 0:oe.postData[0])==null?void 0:z.postValue);break}}}q(!0)},le=()=>{const se=u;se.customColumns=[...se.customColumns,{customKey:"Column",uuid:Ze(),options:[]}],G(se)},[Z,fe]=k.useState(!1),[Y,ie]=k.useState(!1),K=se=>{var pe;return l.jsxs(l.Fragment,{children:[((pe=u==null?void 0:u.options)==null?void 0:pe.length)>1&&l.jsx(Rt,{text:!0,type:"button",icon:"pi pi-trash",rounded:!0,severity:"secondary",onClick:()=>Ee(se==null?void 0:se.uuid),"aria-label":"Add Row"}),l.jsx(Rt,{text:!0,type:"button",icon:"pi pi-plus",rounded:!0,severity:"secondary",onClick:()=>X(),"aria-label":"Add Row"})]})},ne=se=>{var pe;return l.jsxs(l.Fragment,{children:[se==null?void 0:se.customKey,c===!1&&l.jsxs(l.Fragment,{children:[((pe=u==null?void 0:u.customColumns)==null?void 0:pe.length)>1&&l.jsx("i",{className:"pi pi-trash ml-3",onClick:()=>Fe(se==null?void 0:se.uuid)}),l.jsx("i",{className:"pi pi-cog ml-3",onClick:()=>{F(se),fe(!0)}})]})]})},ue=()=>l.jsx(l.Fragment,{children:l.jsx(Rt,{text:!0,type:"button",icon:"pi pi-plus",rounded:!0,severity:"secondary",onClick:se=>le(),"aria-label":"Add Column"})}),ye=se=>l.jsxs(l.Fragment,{children:[se==null?void 0:se.rowHeading,c===!1&&l.jsx(l.Fragment,{children:l.jsx("i",{className:"pi pi-cog ml-3",onClick:()=>{L(se),ie(!0)}})})]}),Ee=se=>{const pe=u==null?void 0:u.rows.filter(function(te,oe,de){return(te==null?void 0:te.uuid)!==se}),z=u;z.rows=pe,G(z)},Fe=se=>{const pe=St.findIndex(u==null?void 0:u.customColumns,oe=>oe.uuid===se),z=u==null?void 0:u.customColumns.filter(function(oe,de){return de!==pe}),te=u;te.customColumns=z,G(te)};k.useEffect(()=>{P||xe();const se=an.addListener("clearRepeatableFields",te=>{te===(g==null?void 0:g.uuid)&&(T(""),_(0),u.isValid=0,o(p,f,m,b,d,u))}),pe=an.addListener("OnInvalidFieldCatch",te=>{u.uuid===(te==null?void 0:te.fieldId)?_(1):_(0)}),z=an.addListener("OnGetFieldValue",te=>{var de;const oe=(de=te==null?void 0:te.repeatableColumn)==null?void 0:de.filter((ge,Ie)=>(ge==null?void 0:ge.fieldUuid)===(u==null?void 0:u.uuid));oe!=null&&oe.length});return()=>{pe.remove(),z.remove(),se.remove()}});const Te=se=>{S(se)},me=()=>{S(!1)},ee=()=>{let se="";return c||(se=se+" field-form-builder"),a===i&&w===!0&&(se=se+" card"),se},X=()=>{const se=u;se.rows=[...se.rows,{rowHeading:"Row",uuid:Ze(),custom_values:{}}],G(se)},M=(se,pe)=>{F(de=>({...de,customKey:pe}));const z=u.customColumns,te=z.findIndex(de=>de.uuid===se.uuid);z[te]={...z[te],customKey:pe};const oe=u;oe.customColumns=z,G(oe)},W=(se,pe)=>{L(de=>({...de,rowHeading:pe}));const z=u.rows,te=z.findIndex(de=>de.uuid===se.uuid);z[te]={...z[te],rowHeading:pe};const oe=u;oe.rows=z,G(oe)},G=se=>{o(p,f,m,b,d,se)};function he(se){return se.toLowerCase().replace(/ /g,"-").replace(/[^\w-]+/g,"")}const Ne=(se,pe,z,te)=>{const oe=u.customColumns,de=oe.findIndex(Ie=>Ie.uuid===U.uuid);oe[de].options[z][pe]=se,oe[de].options[z].value=he(se);const ge=u;ge.customColumns=oe,G(ge)},Se=()=>{const se=u.customColumns,pe=se.findIndex(te=>te.uuid===U.uuid);se[pe].options.push({label:"",value:"",uuid:Ze()});const z=u;z.customColumns=se,G(z)};return l.jsxs(l.Fragment,{children:[l.jsxs(Ms,{maximizable:!0,header:"Update Column Title",visible:Z,style:{width:"20vw"},footer:()=>l.jsxs(l.Fragment,{children:[" ",l.jsx(Rt,{text:!0,label:"Add Option",icon:"pi pi-plus",onClick:()=>Se()}),l.jsx(Rt,{text:!0,label:"Save",onClick:()=>fe(!1)})]}),onHide:()=>fe(!1),children:[l.jsx("div",{className:"p-fluid",children:l.jsx(dn,{value:(U==null?void 0:U.customKey)||"",onChange:se=>M(U,se.target.value)})}),l.jsx("hr",{}),l.jsx("h5",{children:"Options"}),((Ve=U==null?void 0:U.options)==null?void 0:Ve.length)>0&&(U==null?void 0:U.options.map((se,pe)=>l.jsxs("div",{className:"my-2 flex p-fluid",children:[l.jsx("span",{children:pe+1}),l.jsx(dn,{value:(se==null?void 0:se.label)||"",className:"ml-2",onChange:z=>Ne(z.target.value,"label",pe,se==null?void 0:se.uuid)})]},`custom_column_option_${pe}`)))]}),l.jsx(Ms,{maximizable:!0,header:"Update Row Title",visible:Y,style:{width:"20vw"},footer:()=>l.jsx(Rt,{text:!0,label:"Save",onClick:()=>ie(!1)}),onHide:()=>ie(!1),children:l.jsx("div",{className:"p-fluid",children:l.jsx(dn,{value:(O==null?void 0:O.rowHeading)||"",onChange:se=>W(O,se.target.value)})})}),l.jsx(Yi,{visibilty:x,closeSettingFieldSidebar:me,...t}),l.jsx("div",{dir:"rtl",className:ee(),children:a===i&&w===!0?l.jsx(Pi,{headerTemplate:n,toggleable:!0,children:l.jsx(zU,{ref:e,...t,field:u,isPreview:c,userSelectedLanguage:s,fieldIndex:d,customColumnHeaderTemplate:ne,customColumnRowBodyTemplate:ye,setAllFields:be,allFields:J,actionHeaderTemplate:ue,actionBodyTemplate:K,isFocus:I,inputValue:C,handleFieldSettingsSidebar:Te,isAdmin:w})}):l.jsx(zU,{ref:e,...t,field:u,isPreview:c,userSelectedLanguage:s,fieldIndex:d,customColumnHeaderTemplate:ne,customColumnRowBodyTemplate:ye,setAllFields:be,allFields:J,actionHeaderTemplate:ue,actionBodyTemplate:K,isFocus:I,inputValue:C,handleFieldSettingsSidebar:Te,isAdmin:w})})]})};Cw.defaultProps={field:{},isPreview:!1},Cw.propTypes={field:At.any,isPreview:At.bool};const xxe=t=>{const{customColumn:e,indexes:n,customColumnIndex:r,setAllFields:i,allFields:a}=t;return l.jsx("div",{children:l.jsx(dn,{value:a[`${n==null?void 0:n.rowIndex}-${r}`]})})},HU=t=>{var m,b,w,x,S,C,T;const{field:e,isPreview:n,userSelectedLanguage:r,fieldIndex:i,customColumnHeaderTemplate:a,setAllFields:s,allFields:o,actionHeaderTemplate:c,actionBodyTemplate:u,isFocus:d,inputValue:f,handleFieldSettingsSidebar:p,isAdmin:g}=t;return l.jsxs("div",{className:`field ${n?" ":" builder-element-wrapper "}${(e==null?void 0:e.isFluid)===!0?" card p-fluid py-6 px-4":"card py-3 px-4"}`,children:[" ",l.jsx("div",{className:"grid",children:l.jsxs("div",{className:"col-12 p-fluid",children:[(e==null?void 0:e.showHeaderText)&&l.jsx("h6",{children:(m=e==null?void 0:e.headerText)==null?void 0:m[r==null?void 0:r.type]}),(e==null?void 0:e.showLabel)&&l.jsxs("label",{htmlFor:i,className:"flex font-medium mb-3 text-700 text-2xl",children:[l.jsx(ea,{...t}),((b=e==null?void 0:e.attributes)==null?void 0:b.required)&&l.jsx("span",{className:"must-required",children:"*"})," ",n?l.jsx(l.Fragment,{children:(w=e==null?void 0:e.label)==null?void 0:w[r==null?void 0:r.type]}):l.jsx(Xi,{...t}),l.jsx("span",{className:"ml-3",children:(e==null?void 0:e.showToolTip)&&l.jsx(Fi,{message:(x=e==null?void 0:e.toolTip)==null?void 0:x[r==null?void 0:r.type],position:"right"})})]}),l.jsxs("div",{className:"mt-3",style:{backgroundColor:"#0a061a"},children:[l.jsxs($o,{scrollable:!0,showGridlines:!0,value:e==null?void 0:e.rows,children:[e==null?void 0:e.customColumns.map((A,I)=>l.jsx(Ar,{header:a(A),headerStyle:{textAlign:"left"},bodyStyle:{textAlign:"left",overflow:"visible"},body:(_,P)=>l.jsx(xxe,{customColumn:A,e:_,indexes:P,customColumnIndex:I,setAllFields:s,allFields:o,field:e,...t})},A==null?void 0:A.uuid)),n===!1&&l.jsx(Ar,{frozen:!0,header:A=>c(A),body:A=>u(A),headerStyle:{textAlign:"left"},bodyStyle:{textAlign:"left",overflow:"visible"}})]}),l.jsx("div",{children:((S=e==null?void 0:e.attributes)==null?void 0:S.required)&&l.jsx("small",{className:"error",children:d===1&&!f?(C=e==null?void 0:e.validationMesssage)==null?void 0:C.english:""})}),l.jsx("div",{children:(e==null?void 0:e.showHelperText)&&l.jsx("small",{children:(T=e==null?void 0:e.helperText)==null?void 0:T[r==null?void 0:r.type]})})]})]})}),g&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{}),l.jsx(Ii,{...t})]})]})},Tw=t=>{var Ve;const e=se=>{const pe=se.collapsed?"pi pi-chevron-down":"pi pi-chevron-up",z=`${se.className} justify-content-start`,te=`${se.titleClassName} pl-1`;return l.jsxs("div",{className:z,children:[l.jsxs("button",{className:se.togglerClassName,onClick:se.onTogglerClick,children:[l.jsx("span",{className:pe}),l.jsx(In,{})]}),l.jsx("span",{className:te,children:A})]})},{userTaskSubmitFormData:n,TASK_PUBLISHED:r,task_status:i}=si(),{userSelectedLanguage:a,fieldSettingUpdate:s}=xn(),{isPreview:o,field:c,fieldIndex:u,sectionIndex:d,pageIndex:f,row:p,rowIndex:g,columnIndex:m,isAdmin:b,isRenderView:w}=t,[x,S]=k.useState(!1),[C,T]=k.useState(""),[A]=k.useState((Ve=c==null?void 0:c.label)==null?void 0:Ve[a==null?void 0:a.type]),[I,_]=k.useState(0),[P,q]=k.useState(!1),[U,F]=k.useState(null),[O,L]=k.useState(null),[J,be]=k.useState({}),[xe,le]=k.useState(!1),Z=()=>{var se,pe,z;if(p!=null&&p.rowIsRepeatable){if(p!=null&&p.repeatableFields){const te=[...p.repeatableFields],oe=St.findIndex(te,function(de){return de.uuid===(c==null?void 0:c.uuid)});oe>=0&&te[oe].fieldData?T(te[oe].fieldData):T("")}}else{const te=n;if(te!=null&&te.length){for(const oe of te)if(oe.fieldId===t.field.uuid&&((se=oe==null?void 0:oe.postData[0])==null?void 0:se.postValue)!==""&&((pe=oe==null?void 0:oe.postData[0])!=null&&pe.postValue)){T((z=oe==null?void 0:oe.postData[0])==null?void 0:z.postValue);break}}}q(!0)},fe=()=>{const se=c;se.customColumns=[...se.customColumns,{customKey:"Column",uuid:Ze(),options:[]}],Ne(se)},[Y,ie]=k.useState(!1),[K,ne]=k.useState(!1),ue=se=>{var pe;return l.jsxs(l.Fragment,{children:[((pe=c==null?void 0:c.options)==null?void 0:pe.length)>1&&l.jsx(Rt,{text:!0,type:"button",icon:"pi pi-trash",rounded:!0,severity:"secondary",onClick:()=>Te(se==null?void 0:se.uuid),"aria-label":"Add Row",size:"small"}),l.jsx(Rt,{text:!0,type:"button",icon:"pi pi-plus",rounded:!0,severity:"secondary",onClick:()=>W(),"aria-label":"Add Row",size:"small"})]})},ye=se=>{var pe;return l.jsxs(l.Fragment,{children:[se==null?void 0:se.customKey,o===!1&&l.jsxs(l.Fragment,{children:[((pe=c==null?void 0:c.customColumns)==null?void 0:pe.length)>1&&l.jsx("i",{className:"pi pi-trash ml-3",onClick:()=>me(se==null?void 0:se.uuid)}),l.jsx("i",{className:"pi pi-cog ml-3",onClick:()=>{F(se),ie(!0)}})]})]})},Ee=()=>l.jsx(l.Fragment,{children:l.jsx(Rt,{text:!0,type:"button",icon:"pi pi-plus",rounded:!0,severity:"secondary",onClick:()=>fe(),"aria-label":"Add Column"})}),Fe=se=>l.jsxs(l.Fragment,{children:[se==null?void 0:se.rowHeading,o===!1&&l.jsx(l.Fragment,{children:l.jsx("i",{className:"pi pi-cog ml-3",onClick:()=>{L(se),ne(!0)}})})]}),Te=se=>{const pe=c==null?void 0:c.rows.filter(function(te){return(te==null?void 0:te.uuid)!==se}),z=c;z.rows=pe,Ne(z)},me=se=>{const pe=St.findIndex(c==null?void 0:c.customColumns,oe=>oe.uuid===se),z=c==null?void 0:c.customColumns.filter(function(oe,de){return de!==pe}),te=c;te.customColumns=z,Ne(te)};k.useEffect(()=>{P||Z();const se=an.addListener("clearRepeatableFields",oe=>{oe===(p==null?void 0:p.uuid)&&(T(""),_(0),c.isValid=0,s(f,d,g,m,u,c))}),pe=an.addListener("onSubmitUserForm",()=>{}),z=an.addListener("OnInvalidFieldCatch",oe=>{c.uuid===(oe==null?void 0:oe.fieldId)?_(1):_(0)}),te=an.addListener("OnGetFieldValue",oe=>{var ge;const de=(ge=oe==null?void 0:oe.repeatableColumn)==null?void 0:ge.filter(Ie=>(Ie==null?void 0:Ie.fieldUuid)===(c==null?void 0:c.uuid));de!=null&&de.length});return()=>{pe.remove(),z.remove(),te.remove(),se.remove()}});const ee=se=>{S(se)},X=()=>{S(!1)},M=()=>{let se="";return o||(se=se+" field-form-builder"),i===r&&b===!0&&(se=se+" card"),se},W=()=>{const se=c;se.rows=[...se.rows,{rowHeading:"Row",uuid:Ze(),custom_values:{}}],Ne(se)},G=(se,pe)=>{F(de=>({...de,customKey:pe}));const z=c.customColumns,te=z.findIndex(de=>de.uuid===se.uuid);z[te]={...z[te],customKey:pe};const oe=c;oe.customColumns=z,Ne(oe)},he=(se,pe)=>{L(de=>({...de,rowHeading:pe}));const z=c.rows,te=z.findIndex(de=>de.uuid===se.uuid);z[te]={...z[te],rowHeading:pe};const oe=c;oe.rows=z,Ne(oe)},Ne=se=>{s(f,d,g,m,u,se)},Se=()=>{le(!0)},Ae=()=>{le(!1)};return l.jsxs(l.Fragment,{children:[l.jsx(Ms,{maximizable:!0,header:"Update Column Title",visible:Y,style:{width:"20vw"},footer:()=>l.jsx(l.Fragment,{children:l.jsx(Rt,{text:!0,label:"Save",onClick:()=>ie(!1)})}),onHide:()=>ie(!1),children:l.jsx("div",{className:"p-fluid",children:l.jsx(dn,{value:(U==null?void 0:U.customKey)||"",onChange:se=>G(U,se.target.value)})})}),l.jsx(Ms,{maximizable:!0,header:"Update Row Title",visible:K,style:{width:"20vw"},footer:()=>l.jsx(Rt,{text:!0,label:"Save",onClick:()=>ne(!1)}),onHide:()=>ne(!1),children:l.jsx("div",{className:"p-fluid",children:l.jsx(dn,{value:(O==null?void 0:O.rowHeading)||"",onChange:se=>he(O,se.target.value)})})}),l.jsx(Yi,{visibilty:x,closeSettingFieldSidebar:X,...t}),l.jsx("div",{className:"field-form-builder",children:l.jsxs("div",{onMouseOver:Se,onMouseOut:Ae,children:[!w&&!o&&xe&&l.jsx(qr,{handleFieldSettingsSidebar:ee,...t}),l.jsx("div",{dir:"rtl",className:M(),children:i===r&&b===!0?l.jsx(Pi,{headerTemplate:e,toggleable:!0,children:l.jsx(HU,{...t,field:c,isPreview:o,userSelectedLanguage:a,fieldIndex:u,customColumnHeaderTemplate:ye,customColumnRowBodyTemplate:Fe,setAllFields:be,allFields:J,actionHeaderTemplate:Ee,actionBodyTemplate:ue,isFocus:I,inputValue:C,handleFieldSettingsSidebar:ee,isAdmin:b})}):l.jsx(HU,{...t,field:c,isPreview:o,userSelectedLanguage:a,fieldIndex:u,customColumnHeaderTemplate:ye,customColumnRowBodyTemplate:Fe,setAllFields:be,allFields:J,actionHeaderTemplate:Ee,actionBodyTemplate:ue,isFocus:I,inputValue:C,handleFieldSettingsSidebar:ee,isAdmin:b})})]})})]})};Tw.defaultProps={field:{},isPreview:!1},Tw.propTypes={field:At.any,isPreview:At.bool};const Ew=t=>{var ee,X,M,W,G,he,Ne,Se,Ae,Ve,se;const{task_status:e,taskRegisterData:n,updateTaskRegisterData:r,updateTaskProgressValue:i,userTaskSubmitFormData:a,updateUserFormDataSubmit:s,TASK_PUBLISHED:o}=si(),[c,u]=k.useState([]),{isPreview:d,field:f,fieldIndex:p,row:g,pageIndex:m,sectionIndex:b,isAdmin:w,section:x,page:S,rowIndex:C,columnIndex:T,isRenderView:A}=t,{userSelectedLanguage:I}=xn(),[_,P]=k.useState(!1),[q,U]=k.useState(null),[F,O]=k.useState(0),[L,J]=k.useState(!1),[be,xe]=k.useState(!1),le=()=>{xe(!0)},Z=()=>{xe(!1)},fe=pe=>{P(pe)},Y=()=>{P(!1)},ie=()=>{var z;null.get((z=f==null?void 0:f.dataSource)==null?void 0:z.api).then(te=>{u(te==null?void 0:te.data)})};k.useEffect(()=>((f==null?void 0:f.dataSourceType)==="custom"&&u(f==null?void 0:f.options),(f==null?void 0:f.dataSourceType)==="database"&&ie(),()=>{}));const K=()=>{var z,te,oe,de;let pe=null;if(g!=null&&g.rowIsRepeatable){if(g!=null&&g.repeatableFields){const ge=[...g.repeatableFields],Ie=St.findIndex(ge,function($e){return $e.uuid===(f==null?void 0:f.uuid)});Ie>=0&&ge[Ie].fieldData?(pe=ge[Ie].fieldData,U(ge[Ie].fieldData)):(f.isValid=0,U(""))}}else{const ge=a,Ie=St.cloneDeep(n);if(ge!=null&&ge.length){for(const $e of ge)if($e.fieldId===t.field.uuid&&((z=$e==null?void 0:$e.postData)!=null&&z.length)){pe=(te=$e==null?void 0:$e.postData[0])==null?void 0:te.postValue,U((oe=$e==null?void 0:$e.postData[0])==null?void 0:oe.postValue),Ie[f==null?void 0:f.uuid]=(de=$e==null?void 0:$e.postData[0])==null?void 0:de.postValue;const nt=Object.keys(Ie).length;i(nt);break}}}U(pe),setTimeout(()=>{J(!0)},2e3)};k.useEffect(()=>{!L&&(a==null?void 0:a.length)>0&&K();const pe=an.addListener("clearRepeatableFields",oe=>{oe===(g==null?void 0:g.uuid)&&(U(""),O(0),f.isValid=1)}),z=an.addListener("onSubmitUserForm",()=>{var oe;(oe=f==null?void 0:f.attributes)!=null&&oe.required?q!=null&&q.uuid&&(q!=null&&q.value)?f.isValid=1:f.isValid=0:f.isValid=1}),te=an.addListener("OnInvalidFieldCatch",oe=>{(f==null?void 0:f.uuid)===(oe==null?void 0:oe.fieldId)?O(1):O(0)});return()=>{z.remove(),te.remove(),pe.remove()}});const ne=(pe,z)=>{var te;if(a){const oe=[...a],de=St.findIndex(oe,function(Ie){return Ie.rowId===(g==null?void 0:g.uuid)});let ge=(te=a[de])==null?void 0:te.repeatableFields;ge={...ge,[pe==null?void 0:pe.uuid]:z==null?void 0:z.value},oe[de]={...oe[de],repeatableFields:ge},s(oe)}U(z),z!=null&&z.value?pe.isValid=1:pe.isValid=0},ue=pe=>{var z,te;U((z=pe==null?void 0:pe.target)==null?void 0:z.value),g!=null&&g.rowIsRepeatable?ne(f,(te=pe==null?void 0:pe.target)==null?void 0:te.value):Te(pe)},ye=()=>{if((f==null?void 0:f.dataSourceType)==="custom")return`optionText.${I.type}`;if((f==null?void 0:f.dataSourceType)==="database")return f==null?void 0:f.optionLabel},Ee=()=>{if((f==null?void 0:f.dataSourceType)==="custom")return`optionText.${I.type}`;if((f==null?void 0:f.dataSourceType)==="database")return f==null?void 0:f.optionLabel},Fe=()=>{var pe,z,te;if(((pe=f==null?void 0:f.fieldType)==null?void 0:pe.type)==="radio"){const oe=[];return c.map((de,ge)=>{var Ie,$e,nt,it;oe.push(l.jsxs("div",{className:"field-radiobutton field-radiobutton-builder",onClick:()=>{ue({target:{value:de}})},style:(q==null?void 0:q.uuid)===(de==null?void 0:de.uuid)?{backgroundColor:"#0F8BFD",padding:15,borderRadius:8}:{padding:15},children:[l.jsx(Zi,{onFocus:()=>O(1),inputId:`radio-option-${ge}-${de==null?void 0:de.uuid}-${d?"preview":"builder"}`,onChange:Nt=>{ue({target:{value:de}})},value:de,name:`radio-option-${ge}-${de==null?void 0:de.uuid}-${d?"preview":"builder"}`,checked:(q==null?void 0:q.uuid)===(de==null?void 0:de.uuid),disabled:e===o}),((Ie=de==null?void 0:de.hyperlinkText)==null?void 0:Ie[I==null?void 0:I.type])===""?l.jsx("label",{htmlFor:`radio-option-${ge}-${de==null?void 0:de.uuid}-${d?"preview":"builder"}`,children:($e=de==null?void 0:de.optionText)==null?void 0:$e[I==null?void 0:I.type]}):l.jsx("label",{children:l.jsx("a",{href:(nt=de==null?void 0:de.hyperlinkText)==null?void 0:nt[I==null?void 0:I.type],target:"_blank",rel:"noreferrer",children:(it=de==null?void 0:de.optionText)==null?void 0:it[I==null?void 0:I.type]})})]},ge))}),oe}if(((z=f==null?void 0:f.fieldType)==null?void 0:z.type)==="dropdown")return l.jsx(ga,{onFocus:()=>O(1),onChange:oe=>{g!=null&&g.rowIsRepeatable?ne(f,oe.target.value):Te(oe)},options:c,optionLabel:Ee(),optionValue:ye(),value:q,placeholder:(te=f==null?void 0:f.placeholder)==null?void 0:te[I==null?void 0:I.type],disabled:e===o})},Te=pe=>{var de,ge;const z=a,te=St.cloneDeep(n);if((de=pe==null?void 0:pe.target)!=null&&de.value&&(z==null?void 0:z.length)>0)for(const Ie of z)Ie.fieldId===((ge=t.field)==null?void 0:ge.uuid)&&(te[f==null?void 0:f.uuid]=pe==null?void 0:pe.value,Ie.postData[0]={postValue:pe.value});else delete te[f==null?void 0:f.uuid];r(te);const oe=Object.keys(te).length;i(oe)},me=l.jsxs("div",{onMouseOver:le,onMouseOut:Z,children:[!A&&!d&&be&&l.jsx(qr,{handleFieldSettingsSidebar:fe,...t}),l.jsx("div",{className:`field-${(f==null?void 0:f.isFluid)===!0?" card py-3 px-4 p-fluid":"card py-3 px-4"}`,children:l.jsxs("div",{className:"grid",children:[l.jsxs("div",{className:"col-12",children:[(f==null?void 0:f.showHeaderText)&&l.jsx("h6",{children:(ee=f==null?void 0:f.headerText)==null?void 0:ee[I==null?void 0:I.type]}),(f==null?void 0:f.showLabel)&&l.jsxs("label",{htmlFor:p,className:"flex font-medium mb-5 text-700 text-2xl",children:[l.jsx(ea,{...t}),((X=f==null?void 0:f.attributes)==null?void 0:X.required)&&l.jsx("span",{className:"must-required mr-1",children:"*"})," ",d?l.jsx(l.Fragment,{children:(M=f==null?void 0:f.label)==null?void 0:M[I==null?void 0:I.type]}):l.jsx(Xi,{...t}),l.jsx("span",{className:"ml-3",children:f!=null&&f.showToolTip?l.jsx(l.Fragment,{children:l.jsx(Fi,{message:(W=f==null?void 0:f.toolTip)==null?void 0:W[I==null?void 0:I.type],position:"right"})}):""})]}),Fe(),l.jsx("div",{children:((G=f==null?void 0:f.attributes)==null?void 0:G.required)&&l.jsx("small",{className:"error",children:F===1&&!q?(he=f==null?void 0:f.validationMesssage)==null?void 0:he.english:""})}),l.jsx("div",{children:(f==null?void 0:f.showHelperText)&&l.jsx("small",{children:(Ne=f==null?void 0:f.helperText)==null?void 0:Ne[I==null?void 0:I.type]})}),((Se=f==null?void 0:f.inlineConditionalRules)==null?void 0:Se.rules.length)>0&&d===!1&&l.jsx("p",{children:"Inline conditional rules"}),L===!0&&((Ve=(Ae=f==null?void 0:f.inlineConditionalRules)==null?void 0:Ae.rules)==null?void 0:Ve.length)>0&&((se=f==null?void 0:f.inlineConditionalRules)==null?void 0:se.rules.map((pe,z)=>d===!0?l.jsx("div",{children:pe==null?void 0:pe.conditions.map((te,oe)=>l.jsx(k.Fragment,{children:l.jsx(Gd,{isConditionTrue:(q==null?void 0:q.value)===te.value||!d,inputValue:q,condition:te,ruleIndex:z,conditionIndex:oe,isPreview:d,field:f,section:x,page:S,row:g,pageIndex:m,sectionIndex:b,rowIndex:C,columnIndex:T,isAdmin:w,...t})},`select-rule-${z}-`+oe))},`rule-${z}`):l.jsx(Pi,{className:"mt-4",header:`Rule ${z+1}`,children:l.jsx("div",{children:pe==null?void 0:pe.conditions.map((te,oe)=>l.jsx(k.Fragment,{children:l.jsx(Gd,{isConditionTrue:(q==null?void 0:q.value)===te.value||!d,inputValue:q,condition:te,ruleIndex:z,conditionIndex:oe,isPreview:d,field:f,section:x,page:S,row:g,pageIndex:m,sectionIndex:b,rowIndex:C,columnIndex:T,...t})},`select-rule-${z}-`+oe))},`rule-${z}`)},z)))]}),w&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{}),l.jsx(Ii,{...t})]})]})})]});return l.jsxs(l.Fragment,{children:[_===!0&&l.jsx(Yi,{visibilty:_,closeSettingFieldSidebar:Y,...t},f==null?void 0:f.uuid),l.jsx(xi,{...t,fieldWrap:me})]})};Ew.defaultProps={field:{},isPreview:!1},Ew.propTypes={field:At.any,isPreview:At.bool};const _w=t=>{var J,be,xe,le;const{taskRegisterData:e,updateTaskRegisterData:n,updateTaskProgressValue:r,userTaskSubmitFormData:i}=si(),{isPreview:a,field:s,row:o,isAdmin:c,isRenderView:u}=t,{userSelectedLanguage:d}=xn(),[f,p]=k.useState(!1),[g,m]=k.useState({}),[b,w]=k.useState(0),[x,S]=k.useState(!1),[C,T]=k.useState(!1),A=()=>{T(!0)},I=()=>{T(!1)},_=Z=>{p(Z)},P=()=>{p(!1)},q=()=>{var Z,fe,Y,ie;if((i==null?void 0:i.length)>0)if(o!=null&&o.rowIsRepeatable){if(o!=null&&o.repeatableFields){const K=[...o.repeatableFields],ne=St.findIndex(K,function(ue){return ue.uuid===(s==null?void 0:s.uuid)});ne>=0&&K[ne].fieldData?m(K[ne].fieldData):(s.isValid=0,m(""))}}else{const K=i,ne=St.cloneDeep(e);if(K!=null&&K.length){for(const ue of K)if(ue.fieldId===t.field.uuid&&((Z=ue==null?void 0:ue.postData)!=null&&Z.length)){(fe=ue==null?void 0:ue.postData[0])==null||fe.postValue,m((Y=ue==null?void 0:ue.postData[0])==null?void 0:Y.postValue),ne[s==null?void 0:s.uuid]=(ie=ue==null?void 0:ue.postData[0])==null?void 0:ie.postValue;const ye=Object.keys(ne).length;r(ye);break}}}setTimeout(()=>{S(!0)},2e3)};k.useEffect(()=>{x||q();const Z=an.addListener("clearRepeatableFields",ie=>{ie===(o==null?void 0:o.uuid)&&(m(""),w(0),s.isValid=1)}),fe=an.addListener("onSubmitUserForm",()=>{var ie;(ie=s==null?void 0:s.attributes)!=null&&ie.required?g!=null&&g[s.uuid]?s.isValid=1:s.isValid=0:s.isValid=1}),Y=an.addListener("OnInvalidFieldCatch",ie=>{(s==null?void 0:s.uuid)===(ie==null?void 0:ie.fieldId)?w(1):w(0)});return()=>{fe.remove(),Y.remove(),Z.remove()}});const U=(Z,fe,Y,ie,K)=>ie==null?void 0:ie.map(ne=>{var ue,ye;return{...ne,children:((ue=ne==null?void 0:ne.children)==null?void 0:ue.length)>0?[...((ye=ne==null?void 0:ne.children)==null?void 0:ye.map(Ee=>fe===(ne==null?void 0:ne.uuid)||K===!0?(Y!=null&&Y[Ee==null?void 0:Ee.uuid]&&delete Y[Ee==null?void 0:Ee.uuid],{...Ee,options:U(Z,fe,Y,Ee==null?void 0:Ee.options,!0)}):{...Ee,options:U(Z,fe,Y,Ee==null?void 0:Ee.options,!1)}))||[]]:[]}}),F=(Z,fe)=>{const Y={...g};U(Z,fe,Y,s==null?void 0:s.options,!1),Y[Z]=fe,m(Y),o!=null&&o.rowIsRepeatable||O(Y)},O=Z=>{var K;const fe=i,Y=St.cloneDeep(e);if(Z&&(fe==null?void 0:fe.length)>0)for(const ne of fe)ne.fieldId===((K=t.field)==null?void 0:K.uuid)&&(Y[s==null?void 0:s.uuid]=Z,ne.postData[0]={postValue:Z});else delete Y[s==null?void 0:s.uuid];n(Y);const ie=Object.keys(Y).length;r(ie)},L=l.jsxs("div",{onMouseOver:A,onMouseOut:I,children:[!u&&!a&&C&&l.jsx(qr,{handleFieldSettingsSidebar:_,...t}),l.jsx("div",{className:`field-${(s==null?void 0:s.isFluid)===!0?" card py-3 px-4 p-fluid":"card py-3 px-4"}`,children:l.jsxs("div",{className:"grid",children:[l.jsxs("div",{className:"col-12",children:[(s==null?void 0:s.showHeaderText)&&l.jsx("h6",{children:(J=s==null?void 0:s.headerText)==null?void 0:J[d==null?void 0:d.type]}),l.jsx(t7,{...t,isFirst:!0,isPreview:a,schema:s,field:s,value:g,update:(Z,fe)=>{F(Z,fe)}}),l.jsx("div",{children:((be=s==null?void 0:s.attributes)==null?void 0:be.required)&&l.jsx("small",{className:"error",children:b===1&&!g?(xe=s==null?void 0:s.validationMesssage)==null?void 0:xe.english:""})}),l.jsx("div",{children:(s==null?void 0:s.showHelperText)&&l.jsx("small",{children:(le=s==null?void 0:s.helperText)==null?void 0:le[d==null?void 0:d.type]})})]}),c&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{}),l.jsx(Ii,{...t})]})]})})]});return l.jsxs(l.Fragment,{children:[l.jsx(Yi,{visibilty:f,closeSettingFieldSidebar:P,...t},s==null?void 0:s.uuid),l.jsx(xi,{...t,fieldWrap:L})]})};_w.defaultProps={field:{},isPreview:!1},_w.propTypes={field:At.any,isPreview:At.bool};const Iw=t=>{var ue,ye,Ee,Fe,Te,me,ee,X,M,W;const{isPreview:e,field:n,fieldIndex:r,sectionIndex:i,pageIndex:a,row:s,rowIndex:o,columnIndex:c,isAdmin:u,isRenderView:d}=t,{taskRegisterData:f,updateTaskRegisterData:p,updateTaskProgressValue:g,updateUserFormDataSubmit:m,userTaskSubmitFormData:b,task_status:w,TASK_PUBLISHED:x}=si(),[S,C]=k.useState(!1),{userSelectedLanguage:T,fieldSettingUpdate:A}=xn(),[I,_]=k.useState(!1),[P,q]=k.useState(0),[U,F]=k.useState(""),[O,L]=k.useState(!1),J=()=>{L(!0)},be=()=>{L(!1)},xe=[{icon:"pi pi-thumbs-up",thumbValue:"up"},{icon:"pi pi-thumbs-down",thumbValue:"down"}],le=G=>l.jsx("span",{className:"m-2",children:l.jsx("i",{style:{fontSize:30},className:G.icon})}),Z=()=>{var G,he,Ne;if(s!=null&&s.rowIsRepeatable){if(s!=null&&s.repeatableFields){const Se=[...s.repeatableFields],Ae=St.findIndex(Se,function(Ve){return Ve.uuid===(n==null?void 0:n.uuid)});Ae>=0&&Se[Ae].fieldData?F(Se[Ae].fieldData):F("")}}else{const Se=b;if(Se!=null&&Se.length){for(const Ae of Se)if(Ae.fieldId===t.field.uuid&&((G=Ae==null?void 0:Ae.postData[0])==null?void 0:G.postValue)!==""&&((he=Ae==null?void 0:Ae.postData[0])!=null&&he.postValue)){F((Ne=Ae==null?void 0:Ae.postData[0])==null?void 0:Ne.postValue);break}}}_(!0)};k.useEffect(()=>{I||Z();const G=an.addListener("clearRepeatableFields",Ae=>{Ae===(s==null?void 0:s.uuid)&&(F(""),q(0),n.isValid=0,A(a,i,o,c,r,n))}),he=an.addListener("onSubmitUserForm",Ae=>{var Ve;(Ve=n==null?void 0:n.attributes)!=null&&Ve.required?U?n.isValid=1:n.isValid=0:n.isValid=1}),Ne=an.addListener("OnInvalidFieldCatch",Ae=>{n.uuid===(Ae==null?void 0:Ae.fieldId)?q(1):q(0)}),Se=an.addListener("OnGetFieldValue",Ae=>{var se;const Ve=(se=Ae==null?void 0:Ae.repeatableColumn)==null?void 0:se.filter((pe,z)=>(pe==null?void 0:pe.fieldUuid)===(n==null?void 0:n.uuid));Ve!=null&&Ve.length});return()=>{he.remove(),Ne.remove(),Se.remove(),G.remove()}});const fe=G=>{F(G.value);const he=b,Ne=St.cloneDeep(f);if(he!==null){if(G!=null&&G.value){if(Ne[n==null?void 0:n.uuid]=G==null?void 0:G.value,(he==null?void 0:he.length)>0)for(const Se of he)Se.fieldId===t.field.uuid&&(Se.postData[0]={postValue:G.value})}else if(delete Ne[n==null?void 0:n.uuid],(he==null?void 0:he.length)>0)for(const Se of he)Se.fieldId===t.field.uuid&&(Se.postData[0]={postValue:""})}if(!(s!=null&&s.rowIsRepeatable)){p(Ne);const Se=Object.keys(Ne).length;g(Se)}},Y=(G,he)=>{var Ne;if(b){const Se=[...b],Ae=St.findIndex(Se,function(se){return se.rowId===(s==null?void 0:s.uuid)});let Ve=(Ne=b[Ae])==null?void 0:Ne.repeatableFields;Ve={...Ve,[G==null?void 0:G.uuid]:he},Se[Ae]={...Se[Ae],repeatableFields:Ve},m(Se)}F(he),he!==""?G.isValid=1:G.isValid=0},ie=G=>{C(G)},K=()=>{C(!1)},ne=l.jsxs("div",{onMouseOver:J,onMouseOut:be,children:[!d&&!e&&O&&l.jsx(qr,{handleFieldSettingsSidebar:ie,...t}),l.jsx("div",{className:`field ${e?" ":" builder-element-wrapper "}${(n==null?void 0:n.isFluid)===!0?" card py-3 px-4 p-fluid":"card py-3 px-4"}`,children:l.jsxs("div",{className:"grid",children:[l.jsxs("div",{className:u?"col-6 ":"col-12 p-fluid",children:[(n==null?void 0:n.showHeaderText)&&l.jsx("h6",{children:(ue=n==null?void 0:n.headerText)==null?void 0:ue[T==null?void 0:T.type]}),(n==null?void 0:n.showLabel)&&l.jsxs("label",{htmlFor:r,className:"flex font-medium mb-3 text-700 text-2xl",children:[l.jsx(ea,{...t}),((ye=n==null?void 0:n.attributes)==null?void 0:ye.required)&&l.jsx("span",{className:"must-required mr-1",children:"*"})," ",e?l.jsx(l.Fragment,{children:(Ee=n==null?void 0:n.label)==null?void 0:Ee[T==null?void 0:T.type]}):l.jsx(Xi,{...t}),l.jsx("span",{className:"ml-3",children:(n==null?void 0:n.showToolTip)&&l.jsx(Fi,{message:(Fe=n==null?void 0:n.toolTip)==null?void 0:Fe[T==null?void 0:T.type],position:"right"})})]}),l.jsxs("span",{className:"p-input-icon-"+(n==null?void 0:n.iconAlignment),children:[(n==null?void 0:n.showIcon)&&l.jsx("i",{className:"pi pi-"+((me=(Te=n==null?void 0:n.icon)==null?void 0:Te.properties)==null?void 0:me.name)}),l.jsx("div",{className:"card flex justify-content-center",children:l.jsx(V1,{value:U,onChange:G=>{F(G.value),s!=null&&s.rowIsRepeatable?Y(n,G.value):fe(G)},itemTemplate:le,optionLabel:"value",onFocus:()=>q(1),options:xe,readOnly:w===x,className:P===1&&((ee=n==null?void 0:n.attributes)!=null&&ee.required)?U?"valid":"invalid":"valid'"})})]}),l.jsx("div",{children:((X=n==null?void 0:n.attributes)==null?void 0:X.required)&&l.jsx(l.Fragment,{children:l.jsx("small",{className:"error",children:P===1&&!U?(M=n==null?void 0:n.validationMesssage)==null?void 0:M.english:""})})}),l.jsx("div",{children:(n==null?void 0:n.showHelperText)&&l.jsx("small",{children:(W=n==null?void 0:n.helperText)==null?void 0:W[T==null?void 0:T.type]})})]}),u&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{}),l.jsx(Ii,{...t})]})]})})]});return l.jsxs(l.Fragment,{children:[l.jsx(Yi,{visibilty:S,closeSettingFieldSidebar:K,...t}),l.jsx(xi,{...t,fieldWrap:ne})]})};Iw.defaultProps={field:{},isPreview:!1},Iw.propTypes={field:At.any,isPreview:At.bool};const Dw=t=>{var K,ne,ue,ye,Ee,Fe,Te;const{taskRegisterData:e,updateTaskRegisterData:n,updateTaskProgressValue:r,updateUserFormDataSubmit:i,userTaskSubmitFormData:a}=si(),{userSelectedLanguage:s,fieldSettingUpdate:o}=xn(),{isPreview:c,field:u,fieldIndex:d,sectionIndex:f,pageIndex:p,row:g,rowIndex:m,columnIndex:b,isAdmin:w,isRenderView:x}=t,[S,C]=k.useState(!1),[T,A]=k.useState(""),[I,_]=k.useState(0),[P,q]=k.useState(!1),[U,F]=k.useState(!1),O=()=>{F(!0)},L=()=>{F(!1)},J=()=>{var me,ee,X;if(g!=null&&g.rowIsRepeatable){if(g!=null&&g.repeatableFields){const M=[...g.repeatableFields],W=St.findIndex(M,function(G){return G.uuid===(u==null?void 0:u.uuid)});W>=0&&M[W].fieldData?A(M[W].fieldData):A("")}}else{const M=a;if(M!=null&&M.length){for(const W of M)if(W.fieldId===t.field.uuid&&((me=W==null?void 0:W.postData[0])==null?void 0:me.postValue)!==""&&((ee=W==null?void 0:W.postData[0])!=null&&ee.postValue)){A((X=W==null?void 0:W.postData[0])==null?void 0:X.postValue);break}}}q(!0)};k.useEffect(()=>{P||J();const me=an.addListener("clearRepeatableFields",W=>{W===(g==null?void 0:g.uuid)&&(A(""),_(0),u.isValid=0,o(p,f,m,b,d,u))}),ee=an.addListener("onSubmitUserForm",W=>{var G;(G=u==null?void 0:u.attributes)!=null&&G.required?T?u.isValid=1:u.isValid=0:u.isValid=1}),X=an.addListener("OnInvalidFieldCatch",W=>{u.uuid===(W==null?void 0:W.fieldId)?_(1):_(0)}),M=an.addListener("OnGetFieldValue",W=>{var he;const G=(he=W==null?void 0:W.repeatableColumn)==null?void 0:he.filter(Ne=>(Ne==null?void 0:Ne.fieldUuid)===(u==null?void 0:u.uuid));G!=null&&G.length});return()=>{ee.remove(),X.remove(),M.remove(),me.remove()}});const be=me=>{C(me)},xe=()=>{C(!1)},le=me=>{var M,W;A(me.target.value);const ee=a,X=St.cloneDeep(e);if(ee!==null){if((M=me==null?void 0:me.target)!=null&&M.value){if(X[u==null?void 0:u.uuid]=(W=me==null?void 0:me.target)==null?void 0:W.value,(ee==null?void 0:ee.length)>0)for(const G of ee)G.fieldId===t.field.uuid&&(G.postData[0]={postValue:me.target.value})}else if(delete X[u==null?void 0:u.uuid],(ee==null?void 0:ee.length)>0)for(const G of ee)G.fieldId===t.field.uuid&&(G.postData[0]={postValue:""})}if(!(g!=null&&g.rowIsRepeatable)){n(X);const G=Object.keys(X).length;r(G)}},Z=(me,ee,X,M)=>{var W;if(a){const G=[...a],he=St.findIndex(G,function(Se){return Se.rowId===(g==null?void 0:g.uuid)});let Ne=(W=a[he])==null?void 0:W.repeatableFields;Ne={...Ne,[X==null?void 0:X.uuid]:M},G[he]={...G[he],repeatableFields:Ne},i(G)}A(M),M!==""?X.isValid=1:X.isValid=0},fe=5,Y=()=>{const me=[],ee=[aI,iI,sI,nI,rI],X=["Awful","Not Very Good","Okay","Really Good","Fantastic"];for(let M=0;M<fe;M++)me.push(l.jsxs("label",{children:[l.jsx("input",{onChange:W=>{g!=null&&g.rowIsRepeatable?Z(p,f,u,W.target.value):le(W)},checked:parseInt(T)===M,name:"liker-Emoji-scale"+(u==null?void 0:u.uuid),type:"radio",value:M}),l.jsxs("span",{className:"grid m-0",children:[l.jsx("div",{className:"col-12",children:l.jsx("img",{src:ee[M]})}),l.jsx("div",{children:X[M]})]})]},`field-${u==null?void 0:u.uuid}-likertEmojiScale-${M} ${parseInt(T)===M?"scale-selected":""}`));return me},ie=l.jsxs("div",{onMouseOver:O,onMouseOut:L,children:[!x&&!c&&U&&l.jsx(qr,{handleFieldSettingsSidebar:be,...t}),l.jsxs("div",{className:`field ${c?" ":" builder-element-wrapper "}${(u==null?void 0:u.isFluid)===!0?" card py-3 px-4 p-fluid":"card py-3 px-4"}`,children:[l.jsx("div",{className:"grid",children:l.jsxs("div",{className:"col-12 ",children:[(u==null?void 0:u.showHeaderText)&&l.jsx("h6",{children:(K=u==null?void 0:u.headerText)==null?void 0:K[s==null?void 0:s.type]}),(u==null?void 0:u.showLabel)&&l.jsxs("label",{htmlFor:d,className:"flex font-medium mb-3 text-700 text-2xl",children:[l.jsx(ea,{...t}),((ne=u==null?void 0:u.attributes)==null?void 0:ne.required)&&l.jsx("span",{className:"must-required mr-1",children:"*"})," ",c?l.jsx(l.Fragment,{children:(ue=u==null?void 0:u.label)==null?void 0:ue[s==null?void 0:s.type]}):l.jsx(Xi,{...t}),l.jsx("span",{className:"ml-3",children:(u==null?void 0:u.showToolTip)&&l.jsx(Fi,{message:(ye=u==null?void 0:u.toolTip)==null?void 0:ye[s==null?void 0:s.type],position:"right"})})]}),l.jsxs("div",{className:"mt-3",children:[l.jsx("div",{className:"flex justify-content-center w-full flex-wrap",children:l.jsx("div",{className:"emoji",children:Y()})}),l.jsx("div",{children:((Ee=u==null?void 0:u.attributes)==null?void 0:Ee.required)&&l.jsx("small",{className:"error",children:I===1&&!T?(Fe=u==null?void 0:u.validationMesssage)==null?void 0:Fe.english:""})}),l.jsx("div",{children:(u==null?void 0:u.showHelperText)&&l.jsx("small",{children:(Te=u==null?void 0:u.helperText)==null?void 0:Te[s==null?void 0:s.type]})})]})]})}),w&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{}),l.jsx(Ii,{...t})]})]})]});return l.jsxs(l.Fragment,{children:[l.jsx(Yi,{visibilty:S,closeSettingFieldSidebar:xe,...t}),l.jsx(xi,{...t,fieldWrap:ie})]})};Dw.defaultProps={field:{},isPreview:!1},Dw.propTypes={field:At.any,isPreview:At.bool};const Ow=t=>{var Y,ie,K,ne,ue,ye,Ee,Fe,Te,me,ee;const{taskRegisterData:e,updateTaskRegisterData:n,updateTaskProgressValue:r,updateUserFormDataSubmit:i,userTaskSubmitFormData:a,task_status:s,TASK_PUBLISHED:o}=si(),{userSelectedLanguage:c,fieldSettingUpdate:u}=xn(),{isPreview:d,field:f,fieldIndex:p,sectionIndex:g,pageIndex:m,row:b,rowIndex:w,columnIndex:x,isAdmin:S,isRenderView:C}=t,[T,A]=k.useState(!1),[I,_]=k.useState(""),[P,q]=k.useState(0),[U,F]=k.useState(!1),[O,L]=k.useState(!1),J=()=>{L(!0)},be=()=>{L(!1)},xe=()=>{var X,M,W;if(b!=null&&b.rowIsRepeatable){if(b!=null&&b.repeatableFields){const G=[...b.repeatableFields],he=St.findIndex(G,function(Ne){return Ne.uuid===(f==null?void 0:f.uuid)});he>=0&&G[he].fieldData?_(G[he].fieldData):_("")}}else{const G=a;if(G!=null&&G.length){for(const he of G)if(he.fieldId===t.field.uuid&&((X=he==null?void 0:he.postData[0])==null?void 0:X.postValue)!==""&&((M=he==null?void 0:he.postData[0])!=null&&M.postValue)){_((W=he==null?void 0:he.postData[0])==null?void 0:W.postValue);break}}}F(!0)};k.useEffect(()=>{U||xe();const X=an.addListener("clearRepeatableFields",he=>{he===(b==null?void 0:b.uuid)&&(_(""),q(0),f.isValid=0,u(m,g,w,x,p,f))}),M=an.addListener("onSubmitUserForm",he=>{var Ne,Se;(Ne=f==null?void 0:f.attributes)!=null&&Ne.required?I&&(I==null?void 0:I.length)<((Se=f==null?void 0:f.attributes)==null?void 0:Se.minLength)?f.isValid=1:f.isValid=0:f.isValid=1}),W=an.addListener("OnInvalidFieldCatch",he=>{f.uuid===(he==null?void 0:he.fieldId)?q(1):q(0)}),G=an.addListener("OnGetFieldValue",he=>{var Se;const Ne=(Se=he==null?void 0:he.repeatableColumn)==null?void 0:Se.filter((Ae,Ve)=>(Ae==null?void 0:Ae.fieldUuid)===(f==null?void 0:f.uuid));Ne!=null&&Ne.length});return()=>{M.remove(),W.remove(),G.remove(),X.remove()}});const le=X=>{A(X)},Z=()=>{A(!1)},fe=l.jsxs("div",{onMouseOver:J,onMouseOut:be,children:[!C&&!d&&O&&l.jsx(qr,{handleFieldSettingsSidebar:le,...t}),l.jsxs("div",{className:`field ${d?" ":" builder-element-wrapper "}${(f==null?void 0:f.isFluid)===!0?" card p-fluid ":"card"} ${C?" ":" py-6 px-4 "}`,children:[l.jsx("div",{className:"grid",children:l.jsxs("div",{className:S?"col-6 ":"col-12 p-fluid",children:[(f==null?void 0:f.showHeaderText)&&l.jsx("h6",{children:(Y=f==null?void 0:f.headerText)==null?void 0:Y[c==null?void 0:c.type]}),(f==null?void 0:f.showLabel)&&l.jsxs("label",{htmlFor:p,className:"flex font-medium mb-3 text-700 text-2xl",children:[l.jsx(ea,{...t}),((ie=f==null?void 0:f.attributes)==null?void 0:ie.required)&&l.jsx("span",{className:"must-required mr-1",children:"*"})," ",d?l.jsx(l.Fragment,{children:(K=f==null?void 0:f.label)==null?void 0:K[c==null?void 0:c.type]}):l.jsx(Xi,{...t}),(f==null?void 0:f.showToolTip)&&l.jsx("span",{className:"ml-3",children:l.jsx(Fi,{message:(ne=f==null?void 0:f.toolTip)==null?void 0:ne[c==null?void 0:c.type],position:"right"})})]}),l.jsxs("div",{className:"mt-3",children:[l.jsx("span",{className:"p-input-icon-"+(f==null?void 0:f.iconAlignment),children:(f==null?void 0:f.showIcon)&&l.jsx("i",{className:"pi pi-"+((ye=(ue=f==null?void 0:f.icon)==null?void 0:ue.properties)==null?void 0:ye.name)})}),l.jsx("div",{children:((Ee=f==null?void 0:f.attributes)==null?void 0:Ee.required)&&l.jsxs(l.Fragment,{children:[l.jsx("small",{className:"error",children:P===1&&!I?(Fe=f==null?void 0:f.validationMesssage)==null?void 0:Fe.english:""}),l.jsx("small",{className:"error",children:P===1&&(I==null?void 0:I.length)<((Te=f==null?void 0:f.attributes)==null?void 0:Te.minLength)?`Mini length ${(me=f==null?void 0:f.attributes)==null?void 0:me.minLength}`:""})]})}),l.jsx("div",{children:(f==null?void 0:f.showHelperText)&&l.jsx("small",{children:(ee=f==null?void 0:f.helperText)==null?void 0:ee[c==null?void 0:c.type]})})]})]})}),S&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{}),l.jsx(Ii,{...t})]})]})]});return l.jsxs(l.Fragment,{children:[l.jsx(Yi,{visibilty:T,closeSettingFieldSidebar:Z,...t}),l.jsx(xi,{...t,fieldWrap:fe})]})};Ow.defaultProps={field:{},isPreview:!1},Ow.propTypes={field:At.any,isPreview:At.bool};const vg=t=>{const{data:e,path:n,field:r,isPreview:i,handleDrop:a,renderType:s}=t,o=k.useRef(null),[c,u]=k.useState(!1),[{isDragging:d},f]=Yd({item:{...e,type:rf,uuid:e==null?void 0:e.uuid,path:n},type:rf,collect:x=>({isDragging:x.isDragging()})}),p=d?.25:1;f(o);const g=x=>{switch(r==null?void 0:r.componentType){case"text":return l.jsx(d7,{typeName:"Text",isPreview:i,field:r,...x});case"number":return l.jsx(f7,{typeName:"Number",isPreview:i,field:r,...x});case"email":return l.jsx(p7,{typeName:"Email",isPreview:i,field:r,...x});case"textarea":return l.jsx(g7,{typeName:"Text Area",isPreview:i,field:r,...x});case"editor":return l.jsx(A7,{typeName:"Editor",isPreview:i,field:r,...x});case"question":return l.jsx(F7,{typeName:"Exam",isPreview:i,field:r,...x});case"select":return l.jsx(b7,{typeName:"Select",isPreview:i,field:r,...x});case"multi-select":return l.jsx(_7,{typeName:"Multi Select",isPreview:i,field:r,...x});case"checkbox":return l.jsx(D7,{typeName:"Checkbox",isPreview:i,field:r,...x});case"radio":return l.jsx(kle,{typeName:"Radio",isPreview:i,field:r,handleDrop:a,...x});case"radio-hierarchal":return l.jsx(_w,{typeName:"Radio Progressive",isPreview:i,field:r,handleDrop:a,...x});case"href":return l.jsx(sle,{typeName:"Href",field:r,...x});case"heading":return l.jsx(N7,{typeName:"Heading",field:r,...x});case"paragraph":return l.jsx(jA,{typeName:"Paragraph",field:r,...x});case"image":return l.jsx(hb,{typeName:"Image",field:r,...x});case"video":return l.jsx(vA,{typeName:"Video",field:r,...x});case"hr":return l.jsx(bA,{typeName:"Hr",field:r,...x});case"date-picker":return l.jsx(yA,{typeName:"Date Picker",field:r,...x});case"signature":return l.jsx(AA,{typeName:"Signature",field:r,...x});case"file-upload":return l.jsx(X7e,{typeName:"File Upload",field:r,...x});case"facebook-login":return l.jsx(Ow,{typeName:"Facebook Login",field:r,...x});case"anchor":return l.jsx(l.Fragment,{});case"image-gallery":return l.jsx(UA,{typeName:"Image Gallery",field:r,...x});case"quiz":return l.jsx(Qx,{typeName:"Quiz",field:r,...x});case"document":return l.jsx(zx,{typeName:"Document",field:r,...x});case"list":return l.jsx(Jx,{typeName:"List",field:r,...x});case"country":return l.jsx(u7,{typeName:"Country",isPreview:i,field:r,...x});case"phone":return l.jsx(mw,{typeName:"Phone",isPreview:i,field:r,...x});case"web-url":return l.jsx(vw,{typeName:"Website Url",isPreview:i,field:r,...x});case"rating":return l.jsx(bw,{typeName:"Rating",isPreview:i,field:r,...x});case"slider":return l.jsx(yw,{typeName:"Rating",isPreview:i,field:r,...x});case"hidden-field":return l.jsx(Aw,{typeName:"Hidden Field",isPreview:i,field:r,...x});case"likert-scale":return l.jsx(xw,{typeName:"Likert Scale Field",isPreview:i,field:r,...x});case"type-signature":return l.jsx(ww,{typeName:"Likert Scale Field",isPreview:i,field:r,...x});case"address":return l.jsx(Sw,{typeName:"Address",isPreview:i,field:r,...x});case"grid-component":return l.jsx(lv,{typeName:"Grid",isPreview:i,field:r,...x});case"matrix-scale":return l.jsx(lv,{typeName:"Grid",isPreview:i,field:r,...x});case"matrix-dropdown":return l.jsx(Cw,{typeName:"Grid",isPreview:i,field:r,...x});case"thumbs":return l.jsx(Iw,{typeName:"Thumbs Up and Down",isPreview:i,field:r,...x});case"likert-emoji-scale":return l.jsx(Dw,{typeName:"Thumbs Up and Down",isPreview:i,field:r,...x});case"table":return l.jsx(Tw,{typeName:"Grid",isPreview:i,field:r,...x});case"dynamic-listing":return l.jsx(Ew,{typeName:"Grid",isPreview:i,field:r,...x});default:return l.jsx(l.Fragment,{children:"Empty"})}},m=()=>{u(!0)},b=()=>{u(!1)},w=()=>{let x="";return i?(x=x+" component ",s===Bu?x=x+" ":x=x+" px-2 "):(x=x+" component draggable field-form-builder-not-preview",s===Bu?x=x+" pdf-component":x=x+" px-2 pdf-component"),x};return l.jsx(l.Fragment,{children:l.jsxs("div",{style:{opacity:p},className:w(),onMouseOver:m,onMouseOut:b,children:[!i&&c&&l.jsx("i",{ref:i===!1?o:null,className:"elementDrag-icon pi pi-arrows-alt cursor-move",style:{fontSize:"1em"}}),g(t)]})})},RU=t=>{var T,A,I;const{userSelectedLanguage:e,formBuilderConfigurationType:n,builderTemplateName:r,formBuilderFormSchema:i}=xn(),a=[{label:"List main maintenance safety tips?",componentType:"question",questionText:{french:"Quels sont les principaux conseils de sécurité pour la maintenance?? ",English:"List main maintenance safety tips? "},answerOptions:[{answersText:{french:"Portez des gants et tous les équipements de protection individuelle requis. ",English:"Wear gloves and all required personnel protective equipment ",russian:"????????? ???????? ? ?????? ???????? ?????????????? ??????. ",romanian:"Purta?i m?nu?i ?i toate echipamentele individuale de protec?ie necesare. "},isCorrectAnswer:!1},{answersText:{french:"Délimitez les zones de maintenance pour maintenir les autres à distance (p.?ex., ruban de signalisation). ",English:"Keep maintenance areas marked off to keep others away (e.g., caution tape). ",russian:"?????????? ???? ???????????? ???????????, ????? ???????????? ?? ????????? ?????? ????? (????????, ?????????? ??????). ",romanian:"P?stra?i zonele de între?inere marcate pentru a ?ine la distan?? alte persoane (utiliza?i, de ex., band? de aten?ionare). "},isCorrectAnswer:!1},{answersText:{french:"Débranchez les outils électriques lorsqu’ils ne sont pas utilisés. ",English:"Unplug power tools when not in use. ",russian:"?????????? ??????????????????, ????? ??? ?? ????????????. ",romanian:"Deconecta?i sculele electrice atunci când nu le utiliza?i. "},isCorrectAnswer:"No"},{answersText:{french:"Travaillez seul(e) et ne communiquez avec personne. ",English:"Work alone and don’t communicate anyone. ",russian:"????????? ? ???????? ? ?????? ?? ????????? ? ???? ",romanian:"Lucra?i singur ?i nu comunica?i nim?nui. "},isCorrectAnswer:!0}],isHidden:!1,uuid:"rtest"}],{questions:s}=t,[o,c]=k.useState(null),[u,d]=k.useState([]),f={assessment_id:"abc123",name:`${n==null?void 0:n.name} - ${r}`,label:"Quiz 1",quizConfiguration:{quizPassMark:75,quizTimeLimit:2,quizMaxAttempts:99,quizSequentialAnswer:0,isAllCorrectMandatory:!0,quizRandomiseQuestions:1,quizUniqueAnswersPerAttempt:"1"},quizElements:(s==null?void 0:s.length)>0?s:a},[p,g]=k.useState(0),[m,b]=k.useState(!1);function w(_,P){return(_==null?void 0:_.length)<=P?_:(_==null?void 0:_.slice(0,P))+"..."}k.useEffect(()=>{b(!0)},[]);const x=()=>{p!==0&&g(p-1)},S=()=>{if(f!=null&&f.quizElements&&p+1!==(f==null?void 0:f.quizElements.length))g(p+1);else if((f==null?void 0:f.quizElements.length)===p+1)return},C=_=>{let P=[...u];_.checked?P.push(_.value):P=P.filter(q=>{var U;return(q==null?void 0:q[e==null?void 0:e.type])!==((U=_.value)==null?void 0:U[e==null?void 0:e.type])}),d(P)};return l.jsxs("div",{className:"scroll-height-200 mb-2",children:[m&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"grid",children:l.jsxs("div",{className:"col-12",children:[l.jsxs("h3",{children:[f==null?void 0:f.name," "]}),(T=f==null?void 0:f.quizElements)==null?void 0:T.map((_,P)=>{var q,U,F,O,L,J,be,xe,le;return(_==null?void 0:_.answerInputType)==="radio"?l.jsxs("div",{className:p===P?"card":" flex align-items-center p-field-radiobutton",children:[((q=_==null?void 0:_.questionTextImage)==null?void 0:q[e==null?void 0:e.type])&&((U=_==null?void 0:_.questionTextImage)==null?void 0:U[e==null?void 0:e.type])!==""&&l.jsx("div",{className:"text-center assessment_image_container",children:l.jsx(Bo,{mediaId:(F=_==null?void 0:_.questionTextImage)==null?void 0:F[e==null?void 0:e.type],style:{height:"100px",width:"100px",objectFit:"cover",borderRadius:100},className:"text-center",alt:"questionImage"})}),l.jsx("h3",{className:"mb-5",children:p===P&&((O=_==null?void 0:_.questionText)==null?void 0:O[e==null?void 0:e.type])}),p===P&&((L=_==null?void 0:_.answerOptions)==null?void 0:L.map((Z,fe)=>{var Y,ie,K,ne;return l.jsxs("div",{className:"field-radiobutton",children:[l.jsx(Zi,{inputId:`${fe}-preview`,value:Z==null?void 0:Z.answersText,checked:o===fe,onChange:ue=>{c(fe)}}),((Y=Z.answersTextImage)==null?void 0:Y[e==null?void 0:e.type])&&((ie=Z.answersTextImage)==null?void 0:ie[e==null?void 0:e.type])!==""&&l.jsx(Bo,{mediaId:(K=Z.answersTextImage)==null?void 0:K[e==null?void 0:e.type],className:"mx-3",alt:"questionImage",style:{width:"50px",height:"50px",borderRadius:50}}),l.jsx("label",{htmlFor:`${fe}-preview`,children:(ne=Z.answersText)==null?void 0:ne[e==null?void 0:e.type]})]},fe)}))]},P):(_==null?void 0:_.answerInputType)==="checkbox"?l.jsxs("div",{className:p===P?"card":" flex align-items-center p-field-radiobutton",children:[l.jsx("h3",{className:"mb-5",children:p===P&&((J=_==null?void 0:_.questionText)==null?void 0:J[e==null?void 0:e.type])}),p===P&&((be=_==null?void 0:_.answerOptions)==null?void 0:be.map((Z,fe)=>{var Y,ie,K,ne;return l.jsxs("div",{className:"field-radiobutton",children:[l.jsx(Dr,{inputId:fe,value:Z==null?void 0:Z.answersText,onChange:ue=>{C(ue)},checked:u.some(ue=>{var ye;return(ue==null?void 0:ue[e==null?void 0:e.type])===((ye=Z==null?void 0:Z.answersText)==null?void 0:ye[e==null?void 0:e.type])})}),((Y=Z.answersTextImage)==null?void 0:Y[e==null?void 0:e.type])&&((ie=Z.answersTextImage)==null?void 0:ie[e==null?void 0:e.type])!==""&&l.jsx(Bo,{mediaId:(K=Z.answersTextImage)==null?void 0:K[e==null?void 0:e.type],className:"mx-3",alt:"questionImage",style:{width:"50px",height:"50px",borderRadius:50}}),l.jsx("label",{htmlFor:fe,children:(ne=Z.answersText)==null?void 0:ne[e==null?void 0:e.type]})]},fe)}))]},P):l.jsxs("div",{className:p===P?"card":"",children:[l.jsx("h3",{className:"mb-5",children:p===P&&((xe=_==null?void 0:_.questionText)==null?void 0:xe[e==null?void 0:e.type])}),p===P&&((le=_==null?void 0:_.answerOptions)==null?void 0:le.map((Z,fe)=>{var Y,ie,K,ne;return l.jsxs("div",{className:"field-radiobutton",children:[l.jsx(Zi,{inputId:fe,value:Z==null?void 0:Z.answersText,onChange:()=>{}}),((Y=Z.answersTextImage)==null?void 0:Y[e==null?void 0:e.type])&&((ie=Z.answersTextImage)==null?void 0:ie[e==null?void 0:e.type])!==""&&l.jsx(Bo,{mediaId:(K=Z.answersTextImage)==null?void 0:K[e==null?void 0:e.type],className:"mx-3",alt:"questionImage",style:{width:"50px",height:"50px",borderRadius:50}}),l.jsx("label",{htmlFor:fe,children:(ne=Z.answersText)==null?void 0:ne[e==null?void 0:e.type]})]},fe)}))]},P)})]})}),l.jsxs("div",{className:"text-center my-5",children:[l.jsxs("div",{className:"mb-1",children:["Viewing:"," ",p+1+"/"+(f==null?void 0:f.quizElements.length)]}),l.jsx("br",{}),p>0&&l.jsx(Rt,{text:!0,className:"mx-2",label:"Previous",onClick:()=>x()}),l.jsx(Rt,{text:!0,label:(f==null?void 0:f.quizElements.length)===p+1?"Finish":"Next",onClick:_=>S()})]})]}),l.jsxs("div",{className:"surface-card p-4 shadow-2 border-round",children:[l.jsx("div",{className:"font-medium text-3xl text-900 mb-3",children:"Summary"}),l.jsx("div",{className:"text-500 mb-5",children:`${n==null?void 0:n.name} - ${r}`}),l.jsxs("ul",{className:"list-none p-0 m-0 border-top-1 surface-border",children:[l.jsxs("li",{className:"flex align-items-center py-3 px-2 flex-wrap surface-ground",children:[l.jsx("div",{className:"text-500 w-full md:w-3 font-medium",children:"Total Questions:"}),l.jsx("div",{className:"text-900 w-full md:w-9",children:(A=f==null?void 0:f.quizElements)==null?void 0:A.length})]}),l.jsxs("li",{className:"flex align-items-center py-3 px-2 flex-wrap",children:[l.jsx("div",{className:"text-500 w-full md:w-3 font-medium",children:"Has Maximum Number of questions:"}),l.jsxs("div",{className:"text-900 w-full md:w-9 line-height-3",children:[i==null?void 0:i.noOfAssessmentQuestions," "]})]}),l.jsxs("li",{className:"flex align-items-center py-3 px-2 flex-wrap",children:[l.jsx("div",{className:"text-500 w-full md:w-3 font-medium",children:"Show Answers Randomly"}),l.jsx("div",{className:"text-900 w-full md:w-9",children:i!=null&&i.randomiseAnswers?l.jsx(Xu,{className:"mr-2",severity:"success",value:"True"}):l.jsx(Xu,{className:"mr-2",severity:"warning",value:"False"})})]}),l.jsxs("li",{className:"flex align-items-center py-3 px-2 flex-wrap",children:[l.jsx("div",{className:"text-500 w-full md:w-3 font-medium",children:"Question Time Limit"}),l.jsx("div",{className:"text-900 w-full md:w-9",children:"0.45 seconds"})]}),l.jsxs("li",{className:"flex align-items-center py-3 px-2 flex-wrap",children:[l.jsx("div",{className:"text-500 w-full md:w-3 font-medium",children:"Exam Time Limit:"}),l.jsx("div",{className:"text-900 w-full md:w-9",children:"2 mins"})]}),l.jsxs("li",{className:"flex align-items-center py-3 px-2 flex-wrap surface-ground",children:[l.jsx("div",{className:"text-500 w-full md:w-3 font-medium",children:"Show Questions Randomly:"}),l.jsx("div",{className:"text-900 w-full md:w-9",children:l.jsx("div",{className:"grid mt-0 mr-0",children:(I=f==null?void 0:f.quizElements)==null?void 0:I.map((_,P)=>{var q;return l.jsx("div",{className:"col-12 md:col-6",children:l.jsx("div",{className:"p-3 border-1 surface-border border-round surface-card",children:l.jsx("div",{className:"text-700",children:w((q=_==null?void 0:_.questionText)==null?void 0:q[e==null?void 0:e.type],30)})})},`preview-question-${P}`)})})})]})]})]})]})},wxe={position:"relative"},Sxe=({data:t,components:e,handleDrop:n,path:r,pageIndex:i,sectionIndex:a,rowIndex:s,columnIndex:o,isPreview:c,renderType:u,section:d,row:f,isAdmin:p,emitSocketData:g,page:m,isRenderView:b,isAdvanceView:w})=>{var F,O,L,J,be,xe,le,Z,fe,Y;const x=k.useRef(null),{removeColumn:S,addColumn:C,cloneColumn:T,formBuilderFormLayout:A}=xn(),[{isDragging:I},_]=Yd({type:q1,item:{type:q1,uuid:t==null?void 0:t.uuid,children:t.children,path:r},collect:ie=>({isDragging:ie.isDragging()})}),P=I&&!b?.25:1;_(x);const q=(ie,K,ne,ue,ye,Ee,Fe)=>l.jsx(vg,{page:m,renderType:u,type:"field",row:f,section:d,handleDrop:n,isPreview:c,field:ie,data:ie,components:e,path:K,isRenderView:b,pageIndex:ne,sectionIndex:ue,rowIndex:ye,columnIndex:Ee,fieldIndex:Fe,isAdmin:p,emitSocketData:g},`component-${r}-${ie==null?void 0:ie.uuid}`),U=(ie,K,ne,ue,ye)=>{var me,ee,X,M;const Ee=ie.collapsed?"pi pi-chevron-down":"pi pi-chevron-up",Fe=`${ie.className} justify-content-space-between`,Te=`${ie.titleClassName} pl-1 text-primary`;return l.jsxs(l.Fragment,{children:[l.jsx(vn,{target:".clone-tool"}),l.jsx(vn,{target:".add-column-tool"}),l.jsxs("div",{className:Fe,children:[l.jsxs("span",{ref:c===!1?x:null,children:[l.jsx("button",{className:ie.togglerClassName,children:l.jsx("span",{className:"pi pi-sliders-h dragabble"})}),l.jsxs("button",{className:ie.togglerClassName,onClick:ie.onTogglerClick,children:[l.jsx("span",{className:Ee}),l.jsx(In,{})]}),l.jsx("span",{className:Te,children:"Column"})]}),c===!1&&l.jsxs("div",{className:"p-panel-icons",children:[l.jsx("span",{className:"add-column-tool","data-pr-tooltip":"Add Column",children:l.jsxs("button",{className:ie.togglerClassName,onClick:()=>{C(K,ne,ue),g()},children:[l.jsx("span",{className:"pi pi-plus"}),l.jsx(In,{})]})}),((M=(X=(ee=(me=A[K])==null?void 0:me.children[ne])==null?void 0:ee.children[ue])==null?void 0:X.children)==null?void 0:M.length)>1&&l.jsxs("button",{className:ie.togglerClassName,onClick:()=>{S(K,ne,ue,ye),g()},children:[l.jsx("span",{className:"pi pi-trash"}),l.jsx(In,{})]}),l.jsx("span",{className:"clone-tool","data-pr-tooltip":"Clone",children:l.jsxs("button",{className:ie.togglerClassName,onClick:()=>{T(t,K,ne,ue,ye),g()},children:[l.jsx("span",{className:"pi pi-clone"}),l.jsx(In,{})]})})]})]})]})};return l.jsxs("div",{style:w?{...wxe,opacity:P}:{},className:b?"form-builder-column container-column":"draggable form-builder-column container-column",children:[(u===Xc||u===qu||u===B1||u===U1||u===Uu)&&(c===!1?l.jsx(l.Fragment,{children:w===!0?l.jsxs(Pi,{className:"builder-row-column",header:"Column",toggleable:!0,headerTemplate:ie=>U(ie,i,a,s,o),children:[((F=t==null?void 0:t.children)==null?void 0:F.length)>0?(O=t==null?void 0:t.children)==null?void 0:O.map((ie,K)=>{const ne=`${r}-${K}`;return l.jsxs(k.Fragment,{children:[l.jsx(Ri,{isAdvanceView:w,fieldDropArea:!0,data:{path:ne,childrenCount:t.children.length,droppedField:t},onDrop:n}),q(ie,ne,i,a,s,o,K)]},ne)}):l.jsxs("span",{className:"pt-4 text-center text-primary",style:{display:"block",zIndex:-1,width:"99%"},children:["Please drop the element from the sidebar below",l.jsx("p",{children:l.jsx("i",{className:"pi pi-arrow-down py-2",style:{fontSize:"2em"}})})]}),l.jsx(Ri,{isAdvanceView:w,fieldDropArea:!0,data:{path:`${r}-${t.children.length}`,childrenCount:t.children.length,droppedField:t},onDrop:n,isLast:!0})]}):l.jsx(l.Fragment,{children:l.jsxs("div",{children:[((L=t==null?void 0:t.children)==null?void 0:L.length)>0?(J=t==null?void 0:t.children)==null?void 0:J.map((ie,K)=>{const ne=`${r}-${K}`;return l.jsxs(k.Fragment,{children:[l.jsx(Ri,{isAdvanceView:w,fieldDropArea:!0,data:{path:ne,childrenCount:t.children.length,droppedField:t},onDrop:n}),q(ie,ne,i,a,s,o,K)]},ne)}):l.jsx(l.Fragment,{children:l.jsxs("span",{className:"pt-4 text-center text-primary",style:{display:"block",zIndex:-1,width:"99%"},children:["Please drop the element from the sidebar below",l.jsx("p",{children:l.jsx("i",{className:"pi pi-arrow-down py-2",style:{fontSize:"2em"}})})]})}),l.jsx(Ri,{isAdvanceView:w,dropHereLastField:!0,fieldDropArea:!0,data:{path:`${r}-${t.children.length}`,childrenCount:t.children.length,droppedField:t},onDrop:n,isLast:!0})]})})}):l.jsx(l.Fragment,{children:(be=t==null?void 0:t.children)==null?void 0:be.map((ie,K)=>{const ne=`${r}-${K}`;return l.jsx(k.Fragment,{children:q(ie,ne,i,a,s,o,K)},ne)})})),u===Bu&&(c===!1?l.jsxs("div",{className:"builder-row-column",children:[((xe=t==null?void 0:t.children)==null?void 0:xe.length)>0?(le=t==null?void 0:t.children)==null?void 0:le.map((ie,K)=>{const ne=`${r}-${K}`;return l.jsxs(k.Fragment,{children:[l.jsx(Ri,{isAdvanceView:w,data:{path:ne,childrenCount:t.children.length,droppedField:t},onDrop:n}),q(ie,ne,i,a,s,o,K)]},ne)}):l.jsxs("span",{className:"pt-4 text-center text-primary",style:{display:"block"},children:["Please drop the element from the sidebar below",l.jsx("p",{children:l.jsx("i",{className:"pi pi-arrow-down py-2",style:{fontSize:"2em"}})})]}),l.jsx(Ri,{isAdvanceView:!0,data:{path:`${r}-${t.children.length}`,childrenCount:t.children.length,droppedField:t},onDrop:n,isLast:!0})]}):l.jsx(l.Fragment,{children:(Z=t==null?void 0:t.children)==null?void 0:Z.map((ie,K)=>{const ne=`${r}-${K}`;return l.jsx(k.Fragment,{children:q(ie,ne,i,a,s,o,K)},ne)})})),u===j1&&!c&&l.jsxs("div",{children:[(fe=t==null?void 0:t.children)==null?void 0:fe.map((ie,K)=>{const ne=`${r}-${K}`;return l.jsxs(k.Fragment,{children:[l.jsx(Ri,{fieldDropArea:!0,isAdvanceView:w,data:{path:ne,childrenCount:t.children.length,droppedField:t},onDrop:n}),q(ie,ne,i,a,s,o,K)]},ne)}),t.children.length===0&&l.jsx("p",{className:"text-center",children:"Add element by dragging and dropping element from the sidebar into the dropzone area"}),l.jsx(Ri,{fieldDropArea:!0,isAdvanceView:w,data:{path:`${r}-${t.children.length}`,childrenCount:t.children.length,droppedField:t},onDrop:n,isLast:!0})]}),u===Rd&&(c===!1?l.jsxs("div",{children:[t.children.length>0&&((Y=t==null?void 0:t.children)==null?void 0:Y.map((ie,K)=>{const ne=`${r}-${K}`;return l.jsxs(k.Fragment,{children:[l.jsx(Ri,{isAdvanceView:w,fieldDropArea:!0,data:{path:ne,childrenCount:t.children.length,droppedField:t},onDrop:n}),q(ie,ne,i,a,s,o,K)]},ne)})),t.children.length===0&&l.jsx("p",{className:"text-center",children:"Drag and drop from sidebar items"}),l.jsx(Ri,{isAdvanceView:w,dropHereLastField:!0,fieldDropArea:!0,data:{path:`${r}-${t.children.length}`,childrenCount:t.children.length,droppedField:t},onDrop:n,isLast:!0})]}):l.jsx(l.Fragment,{children:t.children.length>0?l.jsx(RU,{questions:t.children}):l.jsx("p",{className:"text-center",children:"No items to show"})}))]})},Cxe=t=>{var i,a,s;const{language:e,onHandleChange:n,stateRow:r}=t;return l.jsxs("form",{className:"p-fluid",children:[l.jsxs("div",{className:"field",children:[l.jsx("label",{children:"Row Heading"}),l.jsx(dn,{value:(i=r==null?void 0:r.heading)==null?void 0:i[e==null?void 0:e.type],onChange:o=>n("heading",e,o.target.value)})]}),l.jsxs("div",{className:"field",children:[l.jsx("label",{children:"Row Description"}),l.jsx(Ss,{value:(a=r==null?void 0:r.subHeadingText)==null?void 0:a[e==null?void 0:e.type],onChange:o=>n("subHeadingText",e,o.target.value)})]}),(r==null?void 0:r.rowIsRepeatable)===!0&&l.jsxs("div",{className:"field",children:[l.jsx("span",{className:"must-required",children:"*"})," ",l.jsx("label",{children:"Add To List Button Label"}),l.jsx(dn,{value:(s=r.addToListButtonLabel)==null?void 0:s[e==null?void 0:e.type],onChange:o=>n("addToListButtonLabel",e,o.target.value)})]})]})},Txe=t=>{const{stateRow:e,onHandleChangeAdvanceSetttings:n,renderType:r}=t;return l.jsxs("div",{className:"p-fluid",children:[r===Xc&&l.jsxs("div",{className:"field-checkbox",children:[l.jsx(Dr,{inputId:"rowIsRepeatable",checked:e==null?void 0:e.rowIsRepeatable,onChange:i=>n("rowIsRepeatable",i==null?void 0:i.checked)}),l.jsx("label",{htmlFor:"isRepeatable",children:"Row is repeatable ?"})]}),(e==null?void 0:e.rowIsRepeatable)&&l.jsxs("div",{className:"field",children:[l.jsx("span",{className:"must-required",children:"*"})," ",l.jsx("label",{children:"Row Minimum Entries"}),l.jsx(dn,{value:e==null?void 0:e.minimumEntries,onChange:i=>n("minimumEntries",i.target.value)})]}),l.jsxs("div",{className:"field-checkbox",children:[l.jsx(Dr,{inputId:"isManualEnumerationEnabled",checked:e==null?void 0:e.isManualEnumerationEnabled,onChange:i=>n("isManualEnumerationEnabled",i==null?void 0:i.checked)}),l.jsx("label",{htmlFor:"isManualEnumerationEnabled",children:"Enable manual enumeration for row components?"}),l.jsxs("small",{children:[" ","You need to set mannual enumeration for every component from its settings."," "]})]})]})},Exe=t=>{var g,m,b,w;const{onHandleChange:e,stateRow:n,onHandleChangePageMargin:r}=t,i=new fb,[a,s]=k.useState("");k.useEffect(()=>{},[]);const[o,c]=k.useState(null),u=()=>{},d=x=>{e("bgImage",x==null?void 0:x.url)},f=[{icon:"pi pi-image",value:"image"},{icon:"pi pi-palette ",value:"color"},{icon:"pi pi-microsoft ",value:"gradient"}],p=x=>l.jsx("i",{className:x.icon});return l.jsxs("div",{className:"",children:[l.jsxs("div",{className:" field",children:[l.jsxs("div",{className:"grid",children:[l.jsxs("div",{className:"field col-2 md:col-3",children:[l.jsx("label",{children:"Left"}),l.jsx(Ra,{value:(g=n==null?void 0:n.margin)==null?void 0:g.left,onChange:x=>{r("left",x.value)},mode:"decimal",showButtons:!0,min:0,max:100})]}),l.jsxs("div",{className:"field col-2 md:col-3",children:[l.jsx("label",{children:"Right"}),l.jsx(Ra,{value:(m=n==null?void 0:n.margin)==null?void 0:m.right,onChange:x=>{r("right",x.value)},mode:"decimal",showButtons:!0,min:0,max:100})]}),l.jsxs("div",{className:"field col-2 md:col-3",children:[l.jsx("label",{children:"Top"}),l.jsx(Ra,{value:(b=n==null?void 0:n.margin)==null?void 0:b.top,onChange:x=>{r("top",x.value)},mode:"decimal",showButtons:!0,min:0,max:100})]}),l.jsxs("div",{className:"field col-2 md:col-3",children:[l.jsx("label",{children:"Bottom"}),l.jsx(Ra,{value:(w=n==null?void 0:n.margin)==null?void 0:w.bottom,onChange:x=>{r("bottom",x.value)},mode:"decimal",showButtons:!0,min:0,max:100})]})]}),l.jsx("label",{children:"Background Type"}),l.jsx(V1,{value:n==null?void 0:n.bgType,options:f,onChange:x=>e("bgType",x.value),itemTemplate:p,optionLabel:"value"})]}),(n==null?void 0:n.bgType)==="color"&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"p-fluid field",children:l.jsx(Xd,{value:(n==null?void 0:n.bgColor)||"",onChange:x=>e("bgColor",x.value)})}),l.jsx(Xd,{value:(n==null?void 0:n.bgColor)||"",onChange:x=>e("bgColor",x.value),inline:!0})]}),(n==null?void 0:n.bgType)==="image"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"p-fluid field",children:[l.jsx("span",{className:"must-required",children:"*"}),l.jsx("label",{children:"Background image"}),l.jsx(dn,{value:(n==null?void 0:n.bgImage)||"",onChange:x=>e("bgImage",x.target.value),placeholder:"enter page title",id:"page_title",name:"page_title"})]}),l.jsxs("div",{className:"shadow-2 border-round surface-card p-4",children:[l.jsx("div",{className:"flex align-items-center justify-content-between mb-4",children:l.jsx("span",{className:"text-xl font-medium text-900",children:"Selected Files"})}),l.jsx("h5",{children:"Media Library"}),l.jsxs("div",{className:"grid",children:[l.jsx("div",{className:"col-8",children:l.jsxs("div",{className:"grid",children:[l.jsx("div",{className:"col-12 mb-5",children:l.jsxs("div",{className:"p-inputgroup",children:[l.jsx(dn,{placeholder:"Keyword",onChange:x=>s(x.target.value)}),l.jsx(Rt,{text:!0,icon:"pi pi-search",className:"p-button-info",onClick:()=>u()})]})}),l.jsx("div",{className:"col-12 mb-5",children:l.jsx("div",{className:"surface-section ",children:l.jsx("div",{className:"grid -mt-3 -ml-3 -mr-3"})})})]})}),l.jsx("div",{className:"col-4 card",children:o!==null&&l.jsxs("div",{className:"surface-card p-4 shadow-2 border-round",children:[l.jsx("img",{style:{height:"150px",width:"150px",objectFit:"contain"},src:o==null?void 0:o.url,className:"w-full mb-3 border-round-2xl",onError:x=>x.target.src="https://www.primefaces.org/wp-content/uploads/2020/05/placeholder.png",alt:"https://www.primefaces.org/wp-content/uploads/2020/05/placeholder.png"}),l.jsxs("ul",{className:"list-none p-0 m-0 border-top-1 surface-border",children:[l.jsxs("li",{className:"flex align-items-center py-1 px-2 flex-wrap surface-ground",children:[l.jsx("div",{className:"text-500 w-full md:w-4 font-medium",children:"Name"}),l.jsx("div",{className:"text-900 w-full md:w-8",children:o==null?void 0:o.name})]}),l.jsxs("li",{className:"flex align-items-center py-1 px-2 flex-wrap",children:[l.jsx("div",{className:"text-500 w-full md:w-4 font-medium",children:"Base URL:"}),l.jsx("div",{className:"text-900 w-full md:w-8 line-height-3",style:{wordWrap:"break-word"},children:l.jsx("a",{href:o==null?void 0:o.url,children:o==null?void 0:o.url})})]}),l.jsxs("li",{className:"flex align-items-center py-1 px-2 flex-wrap surface-ground",children:[l.jsx("div",{className:"text-500 w-full md:w-4 font-medium",children:"Base Name:"}),l.jsx("div",{className:"text-900 w-full md:w-8",children:o==null?void 0:o.basename})]}),l.jsxs("li",{className:"flex align-items-center py-1 px-2 flex-wrap",children:[l.jsx("div",{className:"text-500 w-full md:w-4 font-medium",children:"Dir Name:"}),l.jsx("div",{className:"text-900 w-full md:w-8",children:o==null?void 0:o.dirname})]}),l.jsxs("li",{className:"flex align-items-center py-1 px-2 flex-wrap surface-ground",children:[l.jsx("div",{className:"text-500 w-full md:w-4 font-medium",children:"Size:"}),l.jsx("div",{className:"text-900 w-full md:w-8",children:i.formatBytes(o==null?void 0:o.size)})]}),l.jsxs("li",{className:"flex align-items-center py-1 px-2 flex-wrap surface-ground",children:[l.jsx("div",{className:"text-500 w-full md:w-4 font-medium",children:"Creation Date:"}),l.jsx("div",{className:"text-900 w-full md:w-8",children:Nn(o==null?void 0:o.created_at).format("Do MMM YYYY - HH:mm")})]})]}),l.jsx(Rt,{text:!0,className:"mt-3 w-full",label:"Set Image",onClick:()=>d(o),"aria-label":"Update"})]})})]})]})]})]})},_xe=t=>{const{stateRow:e,setstateRow:n}=t,[r,i]=k.useState(""),[a,s]=k.useState([""]),[o,c]=k.useState(!1),[u,d]=k.useState(0),[f,p]=k.useState(!1),g=()=>{p(!0)},m=()=>{var L;const F=((L=e==null?void 0:e.reviewerChecklist)==null?void 0:L.length)>=0?[...e.reviewerChecklist]:[];F.push({uuid:Ze(),checklist:r,action:a,agree:null,selectAction:[],other:{isOther:!1,description:""},reviewerComments:""});const O={...e,reviewerChecklist:F};n(O),p(!1),i(""),s([""])},b=()=>{p(!1),i(""),s([""])},w=F=>{const O=[...e.reviewerChecklist];O.splice(F,1);const L={...e,reviewerChecklist:O};n(L)},x=(F,O)=>{c(!0);const{checklist:L,action:J}=F;p(!0),d(O),setTimeout(()=>{i(L),s(J)},1e3)},S=(F,O)=>l.jsxs(l.Fragment,{children:[l.jsx(Rt,{text:!0,type:"button",className:"p-button-info",icon:"pi pi-pencil",onClick:()=>x(F,O==null?void 0:O.rowIndex),size:"small"}),l.jsx(Rt,{text:!0,type:"button",className:"p-button-danger",icon:"pi pi-trash",onClick:()=>w(O==null?void 0:O.rowIndex),size:"small"})]}),C=F=>{var O;return l.jsx(l.Fragment,{children:(O=F==null?void 0:F.action)==null?void 0:O.length})},T=F=>{const O=[...a];O.splice(F,1),s(O)},A=()=>{const F=[...e.reviewerChecklist];F[u]={checklist:r,action:a};const O={...e,reviewerChecklist:F};n(O),p(!1),c(!1)},I=()=>l.jsx("div",{children:o?l.jsx(Rt,{text:!0,className:"mb-5 p-button-success",label:"Edit Checklist",onClick:()=>{A()}}):l.jsx(Rt,{text:!0,className:"mb-5 p-button-success",label:"Add Checklist",onClick:()=>{m()}})}),_=F=>{n(O=>({...O,reviewerChecklist:F==null?void 0:F.value}))},P=F=>{navigator.clipboard.writeText(JSON.stringify(F))};function q(F){try{JSON.parse(F)}catch{return!1}return!0}const U=async()=>{var O;const F=await navigator.clipboard.readText();if(q(F)){const L=JSON.parse(F);if((O=L[0])!=null&&O.checklist){const J={...St.cloneDeep(e),reviewerChecklist:L};n(J);return}}};return l.jsxs("div",{children:[l.jsxs(Ms,{maximizable:!0,header:"Add Checklist",visible:f,style:{width:"30vw"},onHide:()=>b(),footer:I(),children:[l.jsx("h5",{children:"Checklist"}),l.jsx(Ss,{rows:2,cols:50,value:r,onChange:F=>{var O;i((O=F==null?void 0:F.target)==null?void 0:O.value)}}),l.jsx("h5",{children:"Actions when user selects No"}),a.map((F,O)=>l.jsxs("div",{children:[O+1,"."," ",l.jsx(Ss,{value:F,onChange:L=>{var be;const J=[...a];J[O]=(be=L==null?void 0:L.target)==null?void 0:be.value,s(J)},rows:2,cols:50})," ",l.jsx(Rt,{text:!0,type:"button",icon:"pi pi-trash",className:"p-button-danger",onClick:()=>T(O)}),l.jsx("br",{}),l.jsx("br",{})]},`actionIndex-${O}`)),l.jsx(Rt,{text:!0,className:" p-button-info mr-2",onClick:()=>{s([...a,""])},children:"Add Action"})]})," ",l.jsx("h5",{children:"Reviewer Checklist"}),l.jsx(Rt,{text:!0,className:"mb-5 mr-2 p-button-success",label:"Add Review Checklist",onClick:()=>{g()}}),l.jsx(Rt,{text:!0,label:"Copy Schema ",onClick:()=>{P([...(e==null?void 0:e.reviewerChecklist)||[]])},className:"mb-5 mr-2"}),l.jsx(Rt,{text:!0,label:"Paste Checklist ",onClick:()=>{U()},className:"mb-5 p-button-info"}),l.jsx("div",{className:"card",children:l.jsxs($o,{value:e==null?void 0:e.reviewerChecklist,reorderableRows:!0,onRowReorder:_,children:[l.jsx(Ar,{rowReorder:!0,style:{width:"3em"}}),l.jsx(Ar,{field:"checklist",header:"Checklist"}),l.jsx(Ar,{field:"actions",header:"Actions",body:F=>C(F)}),l.jsx(Ar,{header:"",body:(F,O)=>S(F,O)})]})})]})},Ixe=t=>{var T;const{visibilty:e,setVisibility:n,row:r,pageIndex:i,sectionIndex:a,rowIndex:s,renderType:o,emitSocketData:c}=t,{formBuilderSchemaLanguages:u,rowSettingUpdate:d,userSelectedLanguage:f,formBuilderPublishedStatus:p}=xn(),[g,m]=k.useState(r),b=(A,I,_)=>{m(P=>({...P,[A]:{...P[A],[I==null?void 0:I.type]:_}}))},w=(A,I)=>{m(_=>({..._,[A]:I}))},x=()=>{const A={...g,children:r==null?void 0:r.children};d(i,a,s,A),c()},S=(A,I)=>{let _=g;_={..._,margin:{..._.margin,[A]:I}},m(_)},C=(A,I)=>{m(_=>({..._,[A]:I}))};return l.jsx(l.Fragment,{children:l.jsxs(vo,{visible:e,position:"left",className:"p-sidebar-lg",onHide:()=>n(!1),children:[l.jsxs("div",{className:"flex justify-content-between flex-wrap card-container ",children:[l.jsxs("div",{className:"flex align-items-center justify-content-center ",children:[" ",l.jsxs("h5",{children:["Row Settings - ",(T=r==null?void 0:r.heading)==null?void 0:T[f==null?void 0:f.type]]})," "]}),!p&&l.jsx("div",{className:"flex align-items-center justify-content-center",children:l.jsx(Rt,{className:"mt-3",label:"Update",onClick:()=>x(),"aria-label":"Update"})})]}),l.jsxs(Ya,{children:[l.jsx(tr,{header:"Text",children:l.jsx(Ws,{activeIndex:0,children:u!=null&&u.length?u.map((A,I)=>l.jsx(Gs,{tabIndex:I,header:A==null?void 0:A.language,children:l.jsx(Cxe,{language:A,stateRow:g,onHandleChange:b,...t})},I)):""})}),l.jsx(tr,{header:"Advance",children:l.jsx(Txe,{stateRow:g,onHandleChangeAdvanceSetttings:w,onHandleSubmitTextUpdate:x,renderType:o})}),l.jsx(tr,{header:"Layout",children:l.jsxs("div",{className:"p-fluid",children:[l.jsxs("div",{className:"field-checkbox",children:[l.jsx(Dr,{inputId:"showRowTitle",checked:g==null?void 0:g.showRowTitle,onChange:A=>w("showRowTitle",A==null?void 0:A.checked)}),l.jsx("label",{htmlFor:"showRowTitle",children:"Show Row Title?"})]}),l.jsxs("div",{className:"field-checkbox",children:[l.jsx(Dr,{inputId:"showRowSubTitle",checked:g==null?void 0:g.showRowSubTitle,onChange:A=>w("showRowSubTitle",A==null?void 0:A.checked)}),l.jsx("label",{htmlFor:"showRowSubTitle",children:"Show Row Sub Title?"})]})]})}),l.jsx(tr,{header:"Styling",children:l.jsx(Exe,{stateRow:g,onHandleChange:C,onHandleChangePageMargin:S,...t})}),(g==null?void 0:g.rowIsRepeatable)===!0&&l.jsx(tr,{header:"Admin",children:l.jsx(_xe,{stateRow:g,setstateRow:m})})]})]})})},Dxe={},Oxe=({data:t,components:e,handleDrop:n,path:r,pageIndex:i,sectionIndex:a,rowIndex:s,isPreview:o,renderType:c,section:u,isAdmin:d,emitSocketData:f,page:p,isRenderView:g,isAdvanceView:m})=>{var Ee,Fe,Te,me,ee,X,M,W,G,he,Ne,Se,Ae,Ve,se,pe;const b=k.useRef(null),{removeRow:w,addRow:x,cloneRow:S,formBuilderFormLayout:C,userSelectedLanguage:T}=xn(),{userTaskSubmitFormData:A,taskRegisterData:I,updateTaskRegisterData:_,updateTaskProgressValue:P,addUserDataFormSectionRepeatableData:q,removeUserDataFormSectionRepeatableData:U,task_status:F,TASK_PUBLISHED:O}=si(),[L,J]=k.useState(!1),[{isDragging:be},xe]=Yd({type:vp,item:{type:vp,uuid:t.uuid,children:t.children,path:r,data:t},collect:z=>({isDragging:z.isDragging()})}),le=be?.25:1;xe(b);const Z=(z,te,oe,de,ge,Ie)=>l.jsx(Sxe,{isAdvanceView:m,page:p,row:t,section:u,renderType:c,isPreview:o,isRenderView:g,data:z,components:e,handleDrop:n,path:te,pageIndex:oe,sectionIndex:de,rowIndex:ge,columnIndex:Ie,isAdmin:d,emitSocketData:f},`column-${r}-${z.uuid}`),fe=(z,te,oe,de)=>{var nt,it,Nt,gt;const ge=z.collapsed?"pi pi-chevron-down":"pi pi-chevron-up",Ie=`${z.className} justify-content-space-between`,$e=`${z.titleClassName} pl-1 text-primary`;return l.jsxs(l.Fragment,{children:[l.jsx(vn,{target:".clone-tool"}),l.jsx(vn,{target:".setting-tool"}),l.jsx(vn,{target:".add-row-tool"}),l.jsxs("div",{className:Ie,children:[l.jsxs("span",{ref:o===!1?b:null,children:[l.jsx("button",{className:z.togglerClassName,children:l.jsx("span",{className:"pi pi-sliders-h dragabble"})}),l.jsxs("button",{className:z.togglerClassName,onClick:z.onTogglerClick,children:[l.jsx("span",{className:ge}),l.jsx(In,{})]}),l.jsxs("span",{className:$e,children:["Row:"," ",((nt=t==null?void 0:t.heading)==null?void 0:nt[T==null?void 0:T.type])!==""?(it=t==null?void 0:t.heading)==null?void 0:it[T==null?void 0:T.type]:"Untitled"]})]}),o===!1&&l.jsxs("div",{className:"p-panel-icons",children:[l.jsx("span",{className:"add-row-tool","data-pr-tooltip":"Add Row",children:l.jsxs("button",{className:z.togglerClassName,onClick:()=>{x(te,oe),f()},children:[l.jsx("span",{className:"pi pi-plus"}),l.jsx(In,{})]})}),((gt=(Nt=C[te])==null?void 0:Nt.children[oe])==null?void 0:gt.children.length)>1&&l.jsxs("button",{className:z.togglerClassName,onClick:()=>{w(te,oe,de),f()},children:[l.jsx("span",{className:"pi pi-trash"}),l.jsx(In,{})]}),l.jsx("span",{className:"clone-tool","data-pr-tooltip":"Clone",children:l.jsxs("button",{className:z.togglerClassName,onClick:()=>{S(t,te,oe,de),f()},children:[l.jsx("span",{className:"pi pi-clone"}),l.jsx(In,{})]})}),l.jsx("span",{className:"setting-tool","data-pr-tooltip":"Settings",children:l.jsxs("button",{onClick:()=>J(!0),className:z.togglerClassName,children:[l.jsx("span",{className:"pi pi-cog"}),l.jsx(In,{})]})})]})]})]})},Y=St.findIndex(A,function(z){return(z==null?void 0:z.rowId)===(t==null?void 0:t.uuid)}),ie=()=>{var oe,de,ge;const z=St.cloneDeep(I);((de=(oe=A[Y])==null?void 0:oe.repeatableFieldsData)==null?void 0:de.length)>=(t==null?void 0:t.minimumEntries)?z[t==null?void 0:t.uuid]=(ge=A[Y])==null?void 0:ge.repeatableFields:delete z[t==null?void 0:t.uuid];const te=Object.keys(z).length;_(z),P(te)},K=(Ee=t==null?void 0:t.repeatableFields)==null?void 0:Ee.map(z=>{var te;return{fieldUuid:z==null?void 0:z.uuid,field:z==null?void 0:z.uuid,header:(te=z==null?void 0:z.label)==null?void 0:te.english}}),ne=K==null?void 0:K.map(z=>l.jsx(Ar,{field:z.field,header:z.header,body:te=>l.jsx(l.Fragment,{children:l.jsx("div",{className:"post__content_repetable",dangerouslySetInnerHTML:{__html:te[z==null?void 0:z.field]}})})},z.field)),ue=()=>{var de;const z=[...A],te=[];let oe=!0;e:for(const[,ge]of t.children.entries()){for(const[,Ie]of ge.children.entries())if(console.log("field.isValid",Ie.isValid),Ie!=null&&Ie.isPostField&&Ie.isValid!==1){const $e={fieldId:Ie.uuid,rowIndex:s};console.log("inValidData",$e),te.push($e),an.emit("OnInvalidFieldCatch",$e),oe=!1;break e}oe=!0}oe&&(te==null?void 0:te.length)===0&&(q(t==null?void 0:t.uuid,(de=z[Y])==null?void 0:de.repeatableFields),an.emit("clearRepeatableFields",t==null?void 0:t.uuid),ie())},ye=(z,te)=>l.jsx(l.Fragment,{children:l.jsx(Rt,{text:!0,type:"button",className:"p-button-danger ",onClick:()=>{U(t==null?void 0:t.uuid,te==null?void 0:te.rowIndex),setTimeout(()=>{ie()},1e3)},icon:"pi pi-trash"})});return l.jsxs("div",{style:{...Dxe,opacity:le,marginTop:`${(Fe=t==null?void 0:t.margin)==null?void 0:Fe.top}px`,marginBottom:`${(Te=t==null?void 0:t.margin)==null?void 0:Te.bottom}px`,marginLeft:`${(me=t==null?void 0:t.margin)==null?void 0:me.left}px`,marginRight:`${(ee=t==null?void 0:t.margin)==null?void 0:ee.right}px`},className:g?"row container-row":"draggable row container-row",children:[L&&l.jsx(Ixe,{renderType:c,visibilty:L,setVisibility:J,row:t,pageIndex:i,sectionIndex:a,rowIndex:s,emitSocketData:f},"row_settings_"+i+a+s),c===j1&&l.jsxs("div",{className:"form-builder-columns",children:[t.children.map((z,te)=>{const oe=`${r}-${te}`;return l.jsxs(k.Fragment,{children:[c===Rd&&l.jsx(Ri,{isAdvanceView:m,data:{path:oe,childrenCount:t.children.length},onDrop:n,className:"horizontalDrag"}),Z(z,oe,i,a,s,te)]},oe)}),l.jsx(Ri,{isAdvanceView:m,data:{path:`${r}-${t.children.length}`,childrenCount:t.children.length},onDrop:n,className:"horizontalDrag",isLast:!0})]}),(c===qu||c===Xc||c===B1||c===U1||c===Uu)&&(o===!1?l.jsx(l.Fragment,{children:m===!0?l.jsx(Pi,{header:"Row",toggleable:!0,headerTemplate:z=>fe(z,i,a,s),children:l.jsxs("div",{className:"form-builder-columns",style:{overflowX:"auto"},children:[(X=t==null?void 0:t.children)==null?void 0:X.map((z,te)=>{const oe=`${r}-${te}`;return l.jsxs(k.Fragment,{children:[l.jsx(Ri,{isAdvanceView:m,data:{path:oe,childrenCount:t.children.length},onDrop:n,className:"horizontalDrag"}),Z(z,oe,i,a,s,te)]},oe)}),l.jsx(Ri,{isAdvanceView:m,data:{path:`${r}-${t.children.length}`,childrenCount:t.children.length},onDrop:n,className:"horizontalDrag",isLast:!0})]})}):l.jsx(l.Fragment,{children:l.jsx("div",{className:m?"form-builder-columns":"",style:m?{overflowX:"auto"}:{},children:(M=t==null?void 0:t.children)==null?void 0:M.map((z,te)=>{const oe=`${r}-${te}`;return l.jsx(k.Fragment,{children:Z(z,oe,i,a,s,te)},oe)})})})}):l.jsx(l.Fragment,{children:!(t!=null&&t.rowIsRepeatable&&F===O)&&l.jsxs(l.Fragment,{children:[l.jsx("h5",{children:(W=t==null?void 0:t.heading)==null?void 0:W[T==null?void 0:T.type]}),l.jsx("span",{children:(G=t==null?void 0:t.subHeadingText)==null?void 0:G[T==null?void 0:T.type]}),l.jsx("div",{className:"form-builder-columns",children:t.children.map((z,te)=>{const oe=`${r}-${te}`;return l.jsx(k.Fragment,{children:Z(z,oe,i,a,s,te)},oe)})})]})})),c===Bu&&(o===!1?l.jsxs("div",{children:[l.jsx("span",{className:"row-setting-block-pdf-editor",children:l.jsxs("div",{className:"pdf-setting-container",children:[l.jsxs("button",{onClick:()=>{x(i,a),f()},children:[l.jsx("span",{className:"pi pi-plus"}),l.jsx(In,{})]}),((Ne=(he=C[i])==null?void 0:he.children[a])==null?void 0:Ne.children.length)>1&&l.jsxs("button",{onClick:()=>{w(i,a,s),f()},children:[l.jsx("span",{className:"pi pi-trash"}),l.jsx(In,{})]}),l.jsxs("button",{onClick:()=>{S(t,i,a,s),f()},children:[l.jsx("span",{className:"pi pi-clone"}),l.jsx(In,{})]}),l.jsxs("button",{onClick:()=>J(!0),children:[l.jsx("span",{className:"pi pi-cog"}),l.jsx(In,{})]})]})}),l.jsx("div",{className:"form-builder-columns",children:(Se=t==null?void 0:t.children)==null?void 0:Se.map((z,te)=>{const oe=`${r}-${te}`;return l.jsx(k.Fragment,{children:Z(z,oe,i,a,s,te)},oe)})})]}):l.jsx(l.Fragment,{children:!(t!=null&&t.rowIsRepeatable&&F===O)&&l.jsxs(l.Fragment,{children:[l.jsx("h5",{children:(Ae=t==null?void 0:t.heading)==null?void 0:Ae[T==null?void 0:T.type]}),l.jsx("span",{children:(Ve=t==null?void 0:t.subHeadingText)==null?void 0:Ve[T==null?void 0:T.type]}),l.jsx("div",{className:"form-builder-columns",children:t.children.map((z,te)=>{const oe=`${r}-${te}`;return l.jsx(k.Fragment,{children:Z(z,oe,i,a,s,te)},oe)})})]})})),c===Rd&&l.jsx("div",{className:"form-builder-columns",children:t.children.map((z,te)=>{const oe=`${r}-${te}`;return l.jsx(k.Fragment,{children:Z(z,oe,i,a,s,te)},oe)})}),(t==null?void 0:t.rowIsRepeatable)&&F!==O&&l.jsx(Rt,{text:!0,type:"button",className:"p-button-success mb-3",onClick:()=>ue(),label:(se=t.addToListButtonLabel)==null?void 0:se[T==null?void 0:T.type]}),(t==null?void 0:t.rowIsRepeatable)&&l.jsxs("div",{className:"card",children:[l.jsxs($o,{value:(A==null?void 0:A.length)>0?(pe=A[Y])==null?void 0:pe.repeatableFieldsData:[],children:[ne,F!==O&&l.jsx(Ar,{style:{width:"10%"},headerStyle:{textAlign:"center"},bodyStyle:{textAlign:"left",overflow:"visible"},body:(z,te)=>ye(z,te)})]}),d&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{}),l.jsx(Ii,{field:t})]})]})]})},Nxe=t=>{var i,a;const{language:e,onHandleChange:n,stateSection:r}=t;return l.jsxs("form",{className:"p-fluid",children:[l.jsxs("div",{className:"field",children:[l.jsx("label",{children:"Section Heading"}),l.jsx(dn,{value:(i=r.heading)==null?void 0:i[e==null?void 0:e.type],onChange:s=>n("heading",e,s.target.value)})]}),l.jsxs("div",{className:"field",children:[l.jsx("label",{children:"Section Description"}),l.jsx(Ss,{value:(a=r.subHeadingText)==null?void 0:a[e==null?void 0:e.type],onChange:s=>n("subHeadingText",e,s.target.value)})]})]})},Fxe=t=>{const{visibilty:e,setVisibility:n,section:r,pageIndex:i,sectionIndex:a,emitSocketData:s}=t,{formBuilderSchemaLanguages:o,sectionSettingUpdate:c,userSelectedLanguage:u,formBuilderPublishedStatus:d}=xn(),[f,p]=k.useState(r),g=(w,x,S)=>{p(C=>({...C,[w]:{...C[w],[x==null?void 0:x.type]:S}}))},m=(w,x)=>{p(S=>({...S,[w]:x}))},b=()=>{const w={...f,children:r==null?void 0:r.children};c(i,a,w),s()};return l.jsx(l.Fragment,{children:l.jsxs(vo,{visible:e,position:"left",className:"p-sidebar-lg",onHide:()=>n(!1),children:[l.jsxs("div",{className:"flex justify-content-between flex-wrap card-container ",children:[l.jsxs("div",{className:"flex align-items-center justify-content-center ",children:[" ",l.jsxs("h5",{children:["Section Settings - ",r==null?void 0:r.heading[u==null?void 0:u.type]," "]})," "]}),!d&&l.jsx("div",{className:"flex align-items-center justify-content-center",children:l.jsx(Rt,{className:"mt-3",label:"Update",onClick:()=>b(),"aria-label":"Update"})})]}),l.jsxs(Ya,{children:[l.jsx(tr,{header:"Text",children:l.jsx(Ws,{activeIndex:0,children:o!=null&&o.length?o.map((w,x)=>l.jsx(Gs,{tabIndex:x,header:w==null?void 0:w.language,children:l.jsx(Nxe,{language:w,stateSection:f,onHandleChange:g,...t})},x)):""})}),l.jsx(tr,{header:"Layout",children:l.jsxs("div",{className:"p-fluid",children:[l.jsxs("div",{className:"field-checkbox",children:[l.jsx(Dr,{inputId:"showSectionTitle",checked:f==null?void 0:f.showSectionHeader,onChange:w=>m("showSectionHeader",w==null?void 0:w.checked)}),l.jsx("label",{htmlFor:"showSectionTitle",children:"Show Section header?"})]}),l.jsxs("div",{className:"field-checkbox",children:[l.jsx(Dr,{inputId:"showSectionTitle",checked:f==null?void 0:f.showSectionTitle,onChange:w=>m("showSectionTitle",w==null?void 0:w.checked)}),l.jsx("label",{htmlFor:"showSectionTitle",children:"Show Section Title?"})]}),l.jsxs("div",{className:"field-checkbox",children:[l.jsx(Dr,{inputId:"showSectionSubTitle",checked:f==null?void 0:f.showSectionSubTitle,onChange:w=>m("showSectionSubTitle",w==null?void 0:w.checked)}),l.jsx("label",{htmlFor:"showSectionSubTitle",children:"Show Section Sub Title?"})]})]})})]})]})})},Pxe=t=>{const{saveBuilderElementModalData:e,saveElementModal:n,setSaveElementModal:r}=t,i=W8({initialValues:{builder_element_title:"",builder_element_description:""},validate:o=>{const c={};return o.builder_element_title||(c.builder_element_title="Title is required."),o.builder_element_description||(c.builder_element_description="Description is required."),c},onSubmit:o=>{({...o,reusable_template_schema:e==null||e.reusable_template_schema},r(!1))}}),a=o=>!!(i.touched[o]&&i.errors[o]),s=()=>l.jsx("div",{children:l.jsx(Rt,{text:!0,className:"p-button-success",label:"Save",icon:"pi pi-file",onClick:()=>{i.handleSubmit()},autoFocus:!0})});return l.jsxs(Ms,{header:"Save Custom Element",visible:n,style:{width:"20vw"},footer:s(),onHide:()=>r(!1),children:[l.jsxs("div",{className:"p-field field",children:[l.jsxs("label",{htmlFor:"username",children:[l.jsx("span",{className:"must-required",children:"*"})," Builder element title"]}),l.jsx(dn,{id:"builder_element_title",name:"builder_element_title",value:i.values.builder_element_title,onChange:i.handleChange,className:`${Km({invalid:a("builder_element_title")})} w-full`})]}),l.jsxs("div",{className:"p-field field",children:[l.jsxs("label",{htmlFor:"username",children:[l.jsx("span",{className:"must-required",children:"*"})," Builder element description"]}),l.jsx(Ss,{id:"builder_element_description",name:"builder_element_description",value:i.values.builder_element_description,onChange:i.handleChange,className:`${Km({invalid:a("builder_element_title")})} w-full`})]})]})},Mxe=({data:t,components:e,handleDrop:n,path:r,pageIndex:i,sectionIndex:a,isPreview:s,renderType:o,section:c,isAdmin:u,emitSocketData:d,page:f,isRenderView:p,isAdvanceView:g})=>{var Z,fe,Y,ie,K,ne,ue,ye,Ee,Fe,Te,me,ee;const{removeSection:m,addSection:b,cloneSection:w,formBuilderFormLayout:x,userSelectedLanguage:S}=xn(),[C,T]=k.useState(!1),[A,I]=k.useState(!1),[_,P]=k.useState(null),[q,U]=k.useState(!1),F=k.useRef(null),O=(X,M)=>{P(W=>({...W,[X]:M}))},[{isDragging:L},J]=Yd({type:Hd,item:{type:Hd,uuid:t.uuid,children:t.children,path:r},collect:X=>({isDragging:X.isDragging()})}),be=L?.25:1;J(F);const xe=(X,M,W,G,he)=>l.jsx(Oxe,{page:f,isRenderView:p,isAdvanceView:g,section:c,renderType:o,isPreview:s,data:X,components:e,handleDrop:n,path:M,pageIndex:W,sectionIndex:G,rowIndex:he,isAdmin:u,emitSocketData:d},`row-${r}-${X.uuid}`),le=(X,M,W)=>{var Se,Ae;const G=X.collapsed?"pi pi-chevron-down":"pi pi-chevron-up",he=`${X.className} justify-content-space-between panel-tab-section`,Ne=`${X.titleClassName} pl-1 text-primary`;return l.jsxs("div",{className:he,children:[l.jsxs("span",{ref:s===!1?F:null,children:[l.jsx("button",{className:X.togglerClassName,children:l.jsx("span",{className:"pi pi-sliders-h dragabble"})}),l.jsxs("button",{className:X.togglerClassName,onClick:X.onTogglerClick,children:[l.jsx("span",{className:G}),l.jsx(In,{})]}),l.jsxs("span",{className:Ne,children:[W+1," ",(Se=t==null?void 0:t.heading)==null?void 0:Se[S==null?void 0:S.type]]})]}),s===!1&&l.jsxs(l.Fragment,{children:[l.jsx(vn,{target:".clone-tool"}),l.jsx(vn,{target:".del-tool"}),l.jsx(vn,{target:".setting-tool"}),l.jsx(vn,{target:".add-section-tool"}),l.jsx(vn,{target:".save-tool"}),l.jsx(vn,{target:".settings-tool"}),l.jsxs("div",{className:"p-panel-icons",children:[l.jsx("span",{className:"add-section-tool","data-pr-tooltip":"Add Section",children:l.jsxs("button",{className:X.togglerClassName,onClick:()=>{b(M),d()},children:[l.jsx("span",{className:"pi pi-plus"}),l.jsx(In,{})]})}),((Ae=x[M])==null?void 0:Ae.children.length)>1&&l.jsx("span",{className:"del-tool","data-pr-tooltip":"Delete",children:l.jsxs("button",{className:X.togglerClassName,onClick:()=>{m(M,W),d()},children:[l.jsx("span",{className:"pi pi-trash"}),l.jsx(In,{})]})}),l.jsx("span",{className:"save-tool","data-pr-tooltip":"Save",children:l.jsxs("button",{className:X.togglerClassName,onClick:()=>{O("reusable_template_schema",t),I(!0)},children:[l.jsx("span",{className:"pi pi-save"}),l.jsx(In,{})]})}),l.jsx("span",{className:"clone-tool","data-pr-tooltip":"Clone",children:l.jsxs("button",{className:X.togglerClassName,onClick:()=>{w(t,M,W),d()},children:[l.jsx("span",{className:"pi pi-clone"}),l.jsx(In,{})]})}),l.jsx("span",{className:"settings-tool","data-pr-tooltip":"Settings",children:l.jsxs("button",{className:X.togglerClassName,onClick:()=>T(!0),children:[l.jsx("span",{className:"pi pi-cog"}),l.jsx(In,{})]})})]})]})]})};return l.jsxs("div",{style:{opacity:be,marginBottom:20},className:g?"draggable row":"",children:[s===!1&&l.jsx(Pxe,{saveBuilderElementModalData:_,setSaveBuilderElementModalData:P,saveElementModal:A,setSaveElementModal:I}),C===!0&&l.jsx(Fxe,{renderType:o,visibilty:C,setVisibility:T,section:t,pageIndex:i,sectionIndex:a,emitSocketData:d},"section_settings_"+i+a),o===j1&&(s===!1?l.jsxs(Pi,{className:"mb-5",header:(Z=t==null?void 0:t.heading)==null?void 0:Z.english,toggleable:!0,headerTemplate:X=>le(X,i,a),children:[l.jsx("p",{children:(fe=t==null?void 0:t.subHeadingText)==null?void 0:fe[S==null?void 0:S.type]}),l.jsxs("div",{className:"",children:[t.children.map((X,M)=>{const W=`${r}-${M}`;return l.jsx(k.Fragment,{children:xe(X,W,i,a,M)},W)}),l.jsx(Ri,{isAdvanceView:g,data:{path:`${r}-${t.children.length}`,childrenCount:t.children.length},onDrop:n,className:"horizontalDrag",isLast:!0})]})]}):l.jsx(l.Fragment,{})),(o===qu||o===Xc||o===B1||o===U1||o===Uu)&&(s===!1?l.jsx(l.Fragment,{children:g===!0?l.jsxs(Pi,{header:(Y=t==null?void 0:t.heading)==null?void 0:Y.english,toggleable:!0,headerTemplate:X=>le(X,i,a),onMouseEnter:()=>U(!0),onMouseLeave:()=>U(!1),children:[((ie=t==null?void 0:t.subHeadingText)==null?void 0:ie[S==null?void 0:S.type])&&l.jsx("p",{children:(K=t==null?void 0:t.subHeadingText)==null?void 0:K[S==null?void 0:S.type]}),l.jsxs("div",{children:[t.children.map((X,M)=>{const W=`${r}-${M}`;return l.jsxs(k.Fragment,{children:[l.jsx(Ri,{isAdvanceView:g,data:{path:W,childrenCount:t.children.length},onDrop:n}),xe(X,W,i,a,M)]},W)}),l.jsx(Ri,{isAdvanceView:g,data:{path:`${r}-${t.children.length}`,childrenCount:t.children.length,droppedField:t},onDrop:n,isLast:!0})]}),q&&l.jsxs("div",{className:"m-3 flex justify-content-end",children:[l.jsx("span",{className:"add-section-tool ","data-pr-tooltip":"Add Section",children:l.jsx("i",{className:"pi pi-plus",onClick:()=>{b(i),d()},children:l.jsx(In,{})})}),((ne=x[i])==null?void 0:ne.children.length)>1&&l.jsx("span",{className:"del-tool ml-2",children:l.jsx("i",{className:"pi pi-trash","data-pr-tooltip":"Delete",onClick:()=>{m(i,a),d()},children:l.jsx(In,{})})})]})]}):l.jsxs(l.Fragment,{children:[((ue=t==null?void 0:t.subHeadingText)==null?void 0:ue[S==null?void 0:S.type])&&l.jsx("p",{children:(ye=t==null?void 0:t.subHeadingText)==null?void 0:ye[S==null?void 0:S.type]}),l.jsx("div",{children:t.children.map((X,M)=>{const W=`${r}-${M}`;return l.jsx(k.Fragment,{children:xe(X,W,i,a,M)},W)})})]})}):l.jsx(l.Fragment,{children:l.jsxs("div",{className:"",children:[(t==null?void 0:t.showSectionHeader)&&l.jsxs(l.Fragment,{children:[l.jsx("h4",{children:(Ee=t==null?void 0:t.heading)==null?void 0:Ee[S==null?void 0:S.type]}),l.jsx("p",{children:(Fe=t==null?void 0:t.subHeadingText)==null?void 0:Fe[S==null?void 0:S.type]}),l.jsx("hr",{})]}),t.children.map((X,M)=>{const W=`${r}-${M}`;return l.jsx(k.Fragment,{children:l.jsx("div",{className:"",children:xe(X,W,i,a,M)},W)},W)})]})})),o===Bu&&(s===!1?l.jsx("div",{children:l.jsx("div",{children:t.children.map((X,M)=>{const W=`${r}-${M}`;return l.jsx(k.Fragment,{children:xe(X,W,i,a,M)},W)})})}):l.jsx(l.Fragment,{children:l.jsxs("div",{children:[(t==null?void 0:t.showSectionHeader)&&l.jsxs(l.Fragment,{children:[l.jsx("h4",{children:(Te=t==null?void 0:t.heading)==null?void 0:Te[S==null?void 0:S.type]}),((me=t==null?void 0:t.subHeadingText)==null?void 0:me[S==null?void 0:S.type])&&l.jsx("p",{children:(ee=t==null?void 0:t.subHeadingText)==null?void 0:ee[S==null?void 0:S.type]}),l.jsx("hr",{})]}),t.children.map((X,M)=>{const W=`${r}-${M}`;return l.jsx(k.Fragment,{children:l.jsx("div",{className:"",children:xe(X,W,i,a,M)},W)},W)})]})})),o===Rd&&l.jsx("div",{className:"",children:t.children.map((X,M)=>{const W=`${r}-${M}`;return l.jsx(k.Fragment,{children:xe(X,W,i,a,M)},W)})})]})},kxe=t=>{var p;const{renderType:e,isRenderView:n,isAdvanceView:r,isPreview:i,data:a,components:s,currentPath:o,pageIndex:c,isAdmin:u,emitSocketData:d}=t,f=k.useRef(null);return l.jsx(l.Fragment,{children:l.jsxs(VA,{ref:f,modules:[Y$,U4e],spaceBetween:50,slidesPerView:1,navigation:{prevEl:".prev",nextEl:".next"},pagination:{clickable:!1},scrollbar:{el:".swiper-scrollbar",draggable:!1},onSwiper:g=>console.log(g),onSlideChange:()=>console.log("slide change"),children:[(p=a==null?void 0:a.children)==null?void 0:p.map((g,m)=>{var b;return(b=g==null?void 0:g.children)==null?void 0:b.map((w,x)=>{var S;return(S=w==null?void 0:w.children)==null?void 0:S.map((C,T)=>{var A;return(A=C==null?void 0:C.children)==null?void 0:A.map((I,_)=>{const P=`${o}-${m}-${x}-${T}-${_}`;return l.jsx(qA,{children:l.jsx("div",{className:"",children:l.jsx(vg,{page:a,renderType:e,type:"field",row:w,section:g,isPreview:i,field:I,data:I,components:s,path:P,pageIndex:c,sectionIndex:m,rowIndex:x,columnIndex:T,fieldIndex:_,isAdmin:u,emitSocketData:d},`component-${P}-${I==null?void 0:I.uuid}`)})},`swiper_slide_${P}`)})})})}),l.jsxs("div",{className:"flex justify-content-center",children:[l.jsx(Rt,{className:"mr-2 p-button-info prev",size:"large",label:"Previous",icon:"pi pi-arrow-left",onClick:()=>{}}),l.jsx(Rt,{size:"large",className:"p-button-info next",icon:"pi pi-arrow-right",label:"Next"})]})]})})},Lxe={position:"relative"},$xe=({data:t,components:e,handleDrop:n,path:r,pageIndex:i,sectionIndex:a,rowIndex:s,columnIndex:o,isPreview:c,renderType:u,section:d,row:f,isAdmin:p,emitSocketData:g,page:m,isRenderView:b,isAdvanceView:w})=>{var I,_,P,q,U,F;const x=k.useRef(null);xn();const[{isDragging:S},C]=Yd({type:q1,item:{type:q1,uuid:t==null?void 0:t.uuid,children:t.children,path:r},collect:O=>({isDragging:O.isDragging()})}),T=S&&!b?.25:1;C(x);const A=(O,L,J,be,xe,le,Z)=>l.jsx(vg,{page:m,renderType:u,type:"field",row:f,section:d,handleDrop:n,isPreview:c,field:O,data:O,components:e,path:L,isRenderView:b,pageIndex:J,sectionIndex:be,rowIndex:xe,columnIndex:le,fieldIndex:Z,isAdmin:p,emitSocketData:g},`component-${r}-${O==null?void 0:O.uuid}`);return l.jsxs("div",{style:w?{...Lxe,opacity:T}:{},className:b?"":"draggable column container-column",children:[(u===Xc||u===qu||u===B1||u===U1||u===Uu)&&(c===!1?l.jsx(l.Fragment,{children:l.jsxs("div",{children:[((I=t==null?void 0:t.children)==null?void 0:I.length)>0?(_=t==null?void 0:t.children)==null?void 0:_.map((O,L)=>{const J=`${r}-${L}`;return l.jsxs(k.Fragment,{children:[l.jsx(Ri,{isAdvanceView:w,fieldDropArea:!0,data:{path:J,childrenCount:t.children.length,droppedField:t},onDrop:n}),A(O,J,i,a,s,o,L)]},J)}):l.jsx(l.Fragment,{}),l.jsx(Ri,{isAdvanceView:w,dropHereLastField:!0,fieldDropArea:!0,data:{path:`${r}-${t.children.length}`,childrenCount:t.children.length,droppedField:t},onDrop:n,isLast:!0})]})}):l.jsx(l.Fragment,{children:(P=t==null?void 0:t.children)==null?void 0:P.map((O,L)=>{const J=`${r}-${L}`;return l.jsx(k.Fragment,{children:A(O,J,i,a,s,o,L)},J)})})),u===Bu&&(c===!1?l.jsx(l.Fragment,{}):l.jsx(l.Fragment,{children:(q=t==null?void 0:t.children)==null?void 0:q.map((O,L)=>{const J=`${r}-${L}`;return l.jsx(k.Fragment,{children:A(O,J,i,a,s,o,L)},J)})})),u===j1&&!c&&l.jsxs("div",{children:[(U=t==null?void 0:t.children)==null?void 0:U.map((O,L)=>{const J=`${r}-${L}`;return l.jsxs(k.Fragment,{children:[l.jsx(Ri,{isAdvanceView:w,data:{path:J,childrenCount:t.children.length,droppedField:t},onDrop:n}),A(O,J,i,a,s,o,L)]},J)}),t.children.length===0&&l.jsx("p",{className:"text-center",children:"Add element by dragging and dropping element from the sidebar into the dropzone area"}),l.jsx(Ri,{isAdvanceView:w,data:{path:`${r}-${t.children.length}`,childrenCount:t.children.length,droppedField:t},onDrop:n,isLast:!0})]}),u===Rd&&(c===!1?l.jsxs("div",{children:[t.children.length>0&&((F=t==null?void 0:t.children)==null?void 0:F.map((O,L)=>{const J=`${r}-${L}`;return l.jsx(k.Fragment,{children:A(O,J,i,a,s,o,L)},J)})),t.children.length===0&&l.jsx("p",{className:"text-center",children:"Drag and drop from sidebar items"}),l.jsx(Ri,{isAdvanceView:w,data:{path:`${r}-${t.children.length}`,childrenCount:t.children.length,droppedField:t},onDrop:n,isLast:!0})]}):l.jsx(l.Fragment,{children:t.children.length>0?l.jsx(RU,{questions:t.children}):l.jsx("p",{className:"text-center",children:"No items to show"})}))]})},Vxe=t=>{var w;const{renderType:e,isRenderView:n,isAdvanceView:r,isPreview:i,data:a,page:s,section:o,components:c,handleDrop:u,currentPath:d,pageIndex:f,sectionIndex:p,isAdmin:g,emitSocketData:m}=t,b=(x,S,C,T,A,I,_,P)=>l.jsx($xe,{isAdvanceView:r,page:s,row:P,section:_,renderType:e,isPreview:i,isRenderView:n,data:x,components:c,handleDrop:u,path:`${C}-${T}-${A}-${I}`,pageIndex:C,sectionIndex:T,rowIndex:A,columnIndex:I,isAdmin:g,emitSocketData:m},`column-${d}-${x.uuid}`);return l.jsx(l.Fragment,{children:(w=a==null?void 0:a.children)==null?void 0:w.map((x,S)=>{var C;return(C=x==null?void 0:x.children)==null?void 0:C.map((T,A)=>{var I;return l.jsx(l.Fragment,{children:l.jsx("div",{className:r?"columns":"",style:r?{overflowX:"auto"}:{},children:(I=T==null?void 0:T.children)==null?void 0:I.map((_,P)=>{const q=`${d}-${S}-${A}-${P}`;return l.jsx(k.Fragment,{children:b(_,q,f,S,A,P,x,T)},q)})})})})})})},cv={},uv={height:"1280px",width:"100%"},qxe=({data:t,components:e,handleDrop:n,path:r,pageIndex:i,isPreview:a,renderType:s,isAdmin:o,emitSocketData:c,isRenderView:u,isAdvanceView:d})=>{var x,S,C,T;const{formBuilderFormSchema:f}=xn(),p=k.useRef(null),[{isDragging:g},m]=Yd({type:Hd,item:{type:Hd,uuid:t.uuid,children:t.children,path:r},collect:A=>({isDragging:A.isDragging()})}),b=g?0:1;m(p);const w=(A,I,_,P)=>l.jsx(Mxe,{renderType:s,isRenderView:u,isAdvanceView:d,isPreview:a,data:A,section:A,components:e,handleDrop:n,path:I,page:t,pageIndex:_,sectionIndex:P,isAdmin:o,emitSocketData:c},`section_${_}_${P}`);return l.jsxs("div",{style:{overflowX:"auto"},className:`${u?"":"draggable page-css p-3 pb-4"}`,"data-image-src":t==null?void 0:t.bgImage,"data-bg-color":`#${t==null?void 0:t.bgColor}`,children:[s===Rd&&l.jsx("div",{className:"",children:t.children.map((A,I)=>{const _=`${r}-${I}`;return l.jsx(k.Fragment,{children:w(A,_,i,I)},`section-${I}-${A.uuid}`)})}),s===j1&&(a?l.jsx(l.Fragment,{}):l.jsx("div",{className:"p-1",children:t.children.map((A,I)=>{const _=`${r}-${I}`;return l.jsx(k.Fragment,{children:w(A,_,i,I)},`section-${I}-${A.uuid}`)})})),(s===Xc||s===B1||s===U1||s===Uu)&&(a===!1?l.jsx(l.Fragment,{children:d?l.jsxs(l.Fragment,{children:[t.children.map((A,I)=>{const _=`${r}-${I}`;return l.jsxs(k.Fragment,{children:[d===!0&&l.jsx(Ri,{isAdvanceView:d,data:{path:_,childrenCount:t.children.length},onDrop:n}),w(A,_,i,I)]},`section-${I}-${A.uuid}`)}),d===!0&&l.jsx(Ri,{isAdvanceView:d,data:{path:`${r}-${t.children.length}`,childrenCount:t.children.length,droppedField:t},onDrop:n,isLast:!0})]}):l.jsx(l.Fragment,{children:l.jsx(Vxe,{page:t,renderType:s,isRenderView:u,isAdvanceView:d,isPreview:a,data:t,components:e,handleDrop:n,path:r,pageIndex:i,isAdmin:o,emitSocketData:c})})}):l.jsx(l.Fragment,{children:l.jsx("div",{className:"p-1",children:t.children.map((A,I)=>{const _=`${r}-${I}`;return l.jsx(k.Fragment,{children:f!=null&&f.showConditionalFields?l.jsx(l.Fragment,{children:l.jsx("div",{children:w(A,_,i,I)})}):((A==null?void 0:A.isHidden)===!1||!a)&&w(A,_,i,I)},`section-${I}-${A.uuid}`)})})})),s===qu&&(a===!1?l.jsxs(l.Fragment,{children:[t.children.map((A,I)=>{const _=`${r}-${I}`;return l.jsxs(k.Fragment,{children:[l.jsx(Ri,{isAdvanceView:d,data:{path:_,childrenCount:t.children.length},onDrop:n}),w(A,_,i,I)]},`section-${I}-${A.uuid}`)}),l.jsx(Ri,{isAdvanceView:d,data:{path:`${r}-${t.children.length}`,childrenCount:t.children.length,droppedField:t},onDrop:n,isLast:!0})]}):l.jsx(l.Fragment,{children:(f==null?void 0:f.surveyQuestionSlide)===!0?l.jsx(l.Fragment,{children:l.jsx(kxe,{renderType:s,isRenderView:u,isAdvanceView:d,isPreview:a,data:t,components:e,handleDrop:n,path:r,pageIndex:i,isAdmin:o,emitSocketData:c})}):l.jsx("div",{className:"p-1",children:t.children.map((A,I)=>{const _=`${r}-${I}`;return l.jsx(k.Fragment,{children:((A==null?void 0:A.isHidden)===!1||!a)&&w(A,_,i,I)},`section-${I}-${A.uuid}`)})})})),l.jsx("div",{className:"pdf flex justify-content-center",children:s===Bu&&(a===!1?l.jsx("div",{id:t==null?void 0:t.uuid,className:"page-block ",style:(t==null?void 0:t.bgType)==="image"?{...cv,...uv,opacity:b,backgroundImage:`url("${t==null?void 0:t.bgImage}")`}:{...cv,...uv,opacity:b,backgroundColor:`#${t==null?void 0:t.bgColor}`},children:((t==null?void 0:t.isCoverPage)===!1||(t==null?void 0:t.isCoverPage)===void 0)&&l.jsx(l.Fragment,{children:t.children.map((A,I)=>{const _=`${r}-${I}`;return l.jsx(k.Fragment,{children:w(A,_,i,I)},`section-${I}-${A.uuid}`)})})}):l.jsx(l.Fragment,{children:l.jsx("div",{className:"page-block",style:(t==null?void 0:t.bgType)==="image"?{...cv,...uv,opacity:b,backgroundImage:`url("${t==null?void 0:t.bgImage}")`,backgroundSize:"cover"}:{...cv,...uv,opacity:b,backgroundColor:`#${t==null?void 0:t.bgColor}`},children:l.jsx("div",{style:{marginTop:`${(x=t==null?void 0:t.margin)==null?void 0:x.top}px`,marginBottom:`${(S=t==null?void 0:t.margin)==null?void 0:S.bottom}px`,marginLeft:`${(C=t==null?void 0:t.margin)==null?void 0:C.left}px`,marginRight:`${(T=t==null?void 0:t.margin)==null?void 0:T.right}px`},children:t.children.map((A,I)=>{const _=`${r}-${I}`;return l.jsx(k.Fragment,{children:((A==null?void 0:A.isHidden)===!1||!a)&&w(A,_,i,I)},`section-${I}-${A.uuid}`)})})})}))})]})},Bxe=t=>{var i;const{language:e,onHandleChange:n,tabState:r}=t;return l.jsx("form",{className:"p-fluid",children:l.jsxs("div",{className:"field",children:[l.jsx("span",{className:"must-required",children:"*"}),l.jsx("label",{children:"Page Title"}),l.jsx(dn,{value:((i=r.title)==null?void 0:i[e==null?void 0:e.type])||"",onChange:a=>n("title",e,a.target.value),placeholder:"enter page title",id:"page_title",name:"page_title"})]})})},Uxe=t=>{var u,d,f,p;const{onHandleChange:e,tabState:n,onHandleChangePageMargin:r}=t,[i,a]=k.useState("");k.useEffect(()=>{},[]),k.useState(null);const s=()=>{},o=[{icon:"pi pi-image",value:"image"},{icon:"pi pi-palette ",value:"color"},{icon:"pi pi-microsoft ",value:"gradient"}],c=g=>l.jsx("i",{className:g.icon});return l.jsxs("div",{className:"",children:[l.jsxs("div",{className:" field",children:[l.jsxs("div",{className:"grid",children:[l.jsxs("div",{className:"field col-2 md:col-3",children:[l.jsx("label",{children:"Left"}),l.jsx(Ra,{value:(u=n==null?void 0:n.margin)==null?void 0:u.left,onChange:g=>{r("left",g.value)},mode:"decimal",showButtons:!0,min:0,max:100})]}),l.jsxs("div",{className:"field col-2 md:col-3",children:[l.jsx("label",{children:"Right"}),l.jsx(Ra,{value:(d=n==null?void 0:n.margin)==null?void 0:d.right,onChange:g=>{r("right",g.value)},mode:"decimal",showButtons:!0,min:0,max:100})]}),l.jsxs("div",{className:"field col-2 md:col-3",children:[l.jsx("label",{children:"Top"}),l.jsx(Ra,{value:(f=n==null?void 0:n.margin)==null?void 0:f.top,onChange:g=>{r("top",g.value)},mode:"decimal",showButtons:!0,min:0,max:100})]}),l.jsxs("div",{className:"field col-2 md:col-3",children:[l.jsx("label",{children:"Bottom"}),l.jsx(Ra,{value:(p=n==null?void 0:n.margin)==null?void 0:p.bottom,onChange:g=>{r("bottom",g.value)},mode:"decimal",showButtons:!0,min:0,max:100})]})]}),l.jsxs("div",{className:"field-checkbox",children:[l.jsx(Dr,{inputId:"binary",checked:n==null?void 0:n.isCoverPage,onChange:g=>e("isCoverPage",g.checked)}),l.jsx("label",{htmlFor:"binary",children:"Enable Cover Page"})]}),l.jsx("label",{children:"Background Type"}),l.jsx(V1,{value:n==null?void 0:n.bgType,options:o,onChange:g=>e("bgType",g.value),itemTemplate:c,optionLabel:"value"})]}),(n==null?void 0:n.bgType)==="color"&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"p-fluid field",children:l.jsx(Xd,{value:(n==null?void 0:n.bgColor)||"",onChange:g=>e("bgColor",g.value)})}),l.jsx(Xd,{value:(n==null?void 0:n.bgColor)||"",onChange:g=>e("bgColor",g.value),inline:!0})]}),(n==null?void 0:n.bgType)==="image"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"p-fluid field",children:[l.jsx("span",{className:"must-required",children:"*"}),l.jsx("label",{children:"Background image"}),l.jsx(dn,{value:(n==null?void 0:n.bgImage)||"",onChange:g=>e("bgImage",g.target.value),placeholder:"enter page title",id:"page_title",name:"page_title"})]}),l.jsxs("div",{className:"shadow-2 border-round surface-card p-4",children:[l.jsx("div",{className:"flex align-items-center justify-content-between mb-4",children:l.jsx("span",{className:"text-xl font-medium text-900",children:"Selected Files"})}),l.jsx("h5",{children:"Media Library"}),l.jsxs("div",{className:"grid",children:[l.jsx("div",{className:"col-8",children:l.jsxs("div",{className:"grid",children:[l.jsx("div",{className:"col-12 mb-5",children:l.jsxs("div",{className:"p-inputgroup",children:[l.jsx(dn,{placeholder:"Keyword",onChange:g=>a(g.target.value)}),l.jsx(Rt,{text:!0,icon:"pi pi-search",className:"p-button-info",onClick:()=>s()})]})}),l.jsx("div",{className:"col-12 mb-5",children:l.jsx("div",{className:"surface-section ",children:l.jsx("div",{className:"grid -mt-3 -ml-3 -mr-3"})})})]})}),l.jsx("div",{className:"col-4 card"})]})]})]})]})},bg=t=>{var b;const{visibilty:e,setVisibility:n,pageIndex:r,page:i,emitSocketData:a}=t,[s,o]=k.useState(i),{formBuilderSchemaLanguages:c,pageSettingUpdate:u,formBuilderPublishedStatus:d}=xn(),f=()=>{const w={...s,children:i==null?void 0:i.children};u(r,w),a()},p=(w,x,S)=>{o(C=>({...C,[w]:{...C[w],[x==null?void 0:x.type]:S}}))},g=(w,x)=>{let S=s;S={...S,margin:{...S.margin,[w]:x}},o(S)},m=(w,x)=>{o(S=>({...S,[w]:x}))};return l.jsx(l.Fragment,{children:l.jsxs(vo,{visible:e,position:"left",className:"p-sidebar-lg",onHide:()=>n(!1),children:[l.jsxs("div",{className:"flex justify-content-between flex-wrap card-container ",children:[l.jsxs("div",{className:"flex align-items-center justify-content-center ",children:[" ",l.jsxs("h5",{className:"mb-0",children:["Page Settings - ",(b=s==null?void 0:s.title)==null?void 0:b.english," "]})]}),!d&&l.jsx("div",{className:"flex align-items-center justify-content-center",children:l.jsx(Rt,{className:"mt-3",label:"Update",onClick:()=>f(),"aria-label":"Update"})})]}),l.jsxs(Ya,{children:[l.jsx(tr,{header:"Text",children:l.jsx(Ws,{activeIndex:0,children:c!=null&&c.length?c.map((w,x)=>l.jsx(Gs,{tabIndex:x,header:w==null?void 0:w.language,children:l.jsx(Bxe,{language:w,tabState:s,onHandleChange:p,...t})},x)):""})}),l.jsx(tr,{header:"Styling",children:l.jsx(Uxe,{tabState:s,onHandleChange:m,onHandleChangePageMargin:g,...t})})]})]})})},dv=t=>{const{reusableBuilderElementModalVisibility:e,setReusableBuilderElementModalVisibility:n,pageIndex:r}=t,i=()=>l.jsxs("div",{children:[l.jsx(Rt,{text:!0,label:"No",icon:"pi pi-times",className:"p-button-text"}),l.jsx(Rt,{text:!0,label:"Yes",icon:"pi pi-check",autoFocus:!0})]});return l.jsx(Ms,{maximizable:!0,header:"Reusale Elements",visible:e,style:{width:"50vw"},footer:i(),onHide:()=>n(!1)})},YU=t=>{var A,I,_;const{options:e,pageIndex:n,page:r,isPreview:i,setTabSidebarSetting:a,clonePage:s,emitSocketData:o,formBuilderFormLayout:c,userSelectedLanguage:u,removePage:d,setPageActiveIndex:f,pages:p}=t,{taskRegisterData:g,updateUserFormDataSubmit:m,userTaskSubmitFormData:b,updateProgressDataValuesHook:w,taskStatus:x,TASK_PENDING:S}=si(),{addTabs:C}=xn(),T=(P,q,U)=>{var O,L,J;const F=b;if(F!=null&&F.length){const be=g;for(const[le,Z]of q.children.entries())for(const[fe,Y]of Z.children.entries())if(Y!=null&&Y.rowIsRepeatable){const ie=St.findIndex(F,function(K){return K.rowId===Y.uuid});P?ie===-1&&(F.push({postData:[],tabId:q.uuid,rowId:Y==null?void 0:Y.uuid,tabIndex:U,sectionId:Z.uuid,minimumEntries:Z==null?void 0:Z.minimumEntries,sectionIndex:le,sectionHeading:Z.heading,subHeadingText:Z.subHeadingText,repeatableFields:{},repeatableFieldsData:[],language:"english",isHiddenSection:Z.isHidden&&Z.isHidden===1?1:0}),be[Y==null?void 0:Y.uuid]&&delete be[Y==null?void 0:Y.uuid]):F.splice(ie,1)}else for(const[ie,K]of Y.children.entries())for(const[ne,ue]of K.children.entries())if(!(Y!=null&&Y.rowIsRepeatable)&&(ue==null?void 0:ue.isPostField)===!0)if(((O=ue.children)==null?void 0:O.length)>0)for(const[,ye]of ue.children.entries()){const Ee=Object.keys(ye);if(Ee[0]){const Fe=ye[Ee[0]],Te=St.findIndex(F,function(me){return me.fieldId===ye.uuid});P?Te===-1&&(F.push({postData:[],logs:[],isSeen:!1,seenTime:null,tabId:q.uuid,tabIndex:U,componentType:ue==null?void 0:ue.componentType,sectionId:Z.uuid,sectionIndex:le,sectionHeading:Z.heading,subHeadingText:Z.subHeadingText,rowId:Y.uuid,rowIndex:fe,columnId:Z.uuid,columnIndex:ie,fieldIndex:ne,fieldId:Fe.uuid,fieldInputType:Fe.componentType,fieldTitle:(L=Fe.label)==null?void 0:L.english,fieldDescription:Fe.description||null,fieldHelperText:Fe.helperText||null,fieldHeaderText:Fe.headerText||null,fieldFooterText:Fe.footerText||null,fieldTitleAbb:Fe.abbreviationLabel||Fe.label,question_abb_table:Fe.textForTable||null,language:"english",isHiddenfield:Fe.isHidden&&Fe.isHidden===1?1:0,isHiddenSection:Z.isHidden&&Z.isHidden===1?1:0}),be[ye==null?void 0:ye.uuid]&&delete be[ye==null?void 0:ye.uuid]):(be[ye==null?void 0:ye.uuid]&&delete be[ye==null?void 0:ye.uuid],Te>=0&&F.splice(Te,1))}}else{const ye=St.findIndex(F,function(Ee){return Ee.fieldId===ue.uuid});P?ye===-1&&(F.push({postData:[],tabId:q.uuid,tabIndex:U,componentType:ue==null?void 0:ue.componentType,...ue.inlineConditionalRules?{inlineConditionalRules:ue.inlineConditionalRules}:{},...ue.conditionalTabRules?{conditionalTabRules:ue.conditionalTabRules}:{},...ue.conditionalSectionRules?{conditionalSectionRules:ue.conditionalSectionRules}:{},sectionId:Z.uuid,sectionIndex:le,sectionHeading:Z.heading,subHeadingText:Z.subHeadingText,reviewerChecklist:ue==null?void 0:ue.reviewerChecklist,rowId:Y.uuid,rowIndex:fe,columnId:Z.uuid,columnIndex:ie,fieldIndex:ne,fieldId:ue.uuid,fieldInputType:ue.componentType,fieldTitle:(J=ue.label)==null?void 0:J.english,fieldDescription:ue.description||null,fieldHelperText:ue.helperText||null,fieldHeaderText:ue.headerText||null,fieldFooterText:ue.footerText||null,fieldTitleAbb:ue.abbreviationLabel||ue.label,question_abb_table:ue.textForTable||null,language:"english",isHiddenfield:ue.isHidden&&ue.isHidden===1?1:0,isHiddenSection:Z.isHidden&&Z.isHidden===1?1:0}),be[ue==null?void 0:ue.uuid]&&delete be[ue==null?void 0:ue.uuid]):(be[ue==null?void 0:ue.uuid]&&delete be[ue==null?void 0:ue.uuid],ye>=0&&x===S&&F.splice(ye,1))}const xe=Object.keys(be).length;w({progressMaxValue:F==null?void 0:F.length,progressValue:xe}),m(F)}};return k.useEffect(()=>{const P=an.addListener("updatePageRender",()=>{T(!(r!=null&&r.isHidden),r,n)});return()=>{P.remove()}}),k.useEffect(()=>(T(!(r!=null&&r.isHidden),r,n),()=>{}),[]),l.jsxs("div",{className:`${e.className} page-panel`,onClick:e.onClick,children:[l.jsx(vn,{target:".clone-tool"}),l.jsx(vn,{target:".del-tool"}),l.jsx(vn,{target:".setting-tool"}),l.jsx(vn,{target:".addpage-tool"}),i===!1&&l.jsxs("span",{className:"page-pannel-icons",children:[l.jsx("i",{className:"pi pi-plus mr-1 p-text-secondary addpage-tool ",onClick:()=>{C(p==null?void 0:p.length),o()},"data-pr-tooltip":"Add Page"}),l.jsx("i",{className:"pi pi-cog mr-1 p-text-secondary setting-tool ",onClick:()=>a(!0),"data-pr-tooltip":"Settings"})," ",l.jsx("i",{className:"pi pi-clone mr-1 p-text-secondary clone-tool ",onClick:()=>{s(r,n),o()},"data-pr-tooltip":"Clone"})," ",(c==null?void 0:c.length)>1&&l.jsx("i",{className:"pi pi-trash mr-1 p-text-danger del-tool",onClick:()=>{d(n),setTimeout(()=>{f(p.length-2)},100),o()},"data-pr-tooltip":"Delete"})]}),"   ",l.jsx(l.Fragment,{children:((A=r==null?void 0:r.title)==null?void 0:A[u==null?void 0:u.type])===null||((I=r==null?void 0:r.title)==null?void 0:I[u==null?void 0:u.type])===void 0?l.jsxs("span",{style:{width:"100px"},children:["Tab ",n+1]}):(_=r==null?void 0:r.title)==null?void 0:_[u==null?void 0:u.type]})]},`pannel-${n}`)},XU=1,jxe=t=>{const{isAdvanceView:e,layout:n,isPreview:r,renderType:i,isAdmin:a,emitSocketData:s,isRenderView:o}=t,{removePage:c,setLayout:u,userSelectedLanguage:d,formBuilderFormLayout:f,clonePage:p,addFieldToRowRepeaptable:g,addFieldToInlineRuleCondtionFields:m,sectionImport:b,addFieldToGridComponentHook:w,gridComponentFieldDelete:x}=xn(),[S,C]=k.useState(!1),[T,A]=k.useState(!1),[I,_]=k.useState(0),P=k.useCallback((U,F)=>{var ee,X,M,W,G,he,Ne,Se;const O=U.path.split("-"),L=O.slice(0,-1).join("-"),J={uuid:F.uuid,type:F.type,reviewerChecklist:[]},be=0,xe=1,le=2,Z=3,fe=4,Y=5,ie=6,K=8,ne=7,ue=5,ye=6,Ee=8;if(F.type===Hd&&(F==null?void 0:F.schema)!==void 0){b(JSON.parse(F==null?void 0:F.schema),parseInt(O[be]));return}if(((ee=F==null?void 0:F.schema)==null?void 0:ee.componentType)==="question"&&((he=(G=(W=(M=(X=n[0])==null?void 0:X.children[0])==null?void 0:M.children[0])==null?void 0:W.children[0])==null?void 0:G.children)!=null&&he.some(Ae=>{var Ve,se,pe;return((Ve=Ae==null?void 0:Ae.questionText)==null?void 0:Ve[d.type])===((pe=(se=F==null?void 0:F.schema)==null?void 0:se.questionText)==null?void 0:pe[d.type])})))return;if(F.type===Rn){let Ae={type:rf,reviewerChecklist:[],...St.cloneDeep(F.schema)};if(Ae!=null&&Ae.options&&(Ae={...Ae,options:[{uuid:Ze(),optionText:{english:"Option 1"},value:"Option1",hyperlinkText:{english:""},abbreviationText:{english:"Option 1"},custom_values:{}},{uuid:Ze(),optionText:{english:"Option 2"},value:"Option2",hyperlinkText:{english:""},abbreviationText:{english:"Option 1"},custom_values:{}}]}),Ae.componentType==="grid-component"&&(Ae={...Ae,children:[],options:[{uuid:Ze(),custom_values:{}}]}),Ae.componentType==="radio-hierarchal"&&(Ae={...Ae,type:"radio",children:[],options:[{uuid:Ze(),label:"Yes",value:null,enableConditionalField:!0,children:[]},{uuid:Ze(),label:"No",value:null,enableConditionalField:!0,children:[]}]}),Ae={...Ae,uuid:Ze()},O.length===K){m(parseInt(O[be]),parseInt(O[xe]),parseInt(O[le]),parseInt(O[Z]),parseInt(O[fe]),parseInt(O[Y]),parseInt(O[ie]),Ae),s();return}if(O.length===ne){w(parseInt(O[be]),parseInt(O[xe]),parseInt(O[le]),parseInt(O[Z]),parseInt(O[fe]),parseInt(O[ue]),parseInt(O[ye]),Ae),s();return}if((Se=(Ne=n[O[be]].children[O[xe]])==null?void 0:Ne.children[O[le]])!=null&&Se.rowIsRepeatable&&(Ae==null?void 0:Ae.componentType)==="editor")return;u(vee(n,O,Ae)),s(),O.length>1&&g(O[be],O[xe],O[le],Ae);return}const Fe=F.path.split("-"),Te=Fe.slice(0,-1).join("-");if(Fe.length===O.length){if(Te===L){if((Fe==null?void 0:Fe.length)===Ee){u(pee(n,O,Fe));return}u(gee(n,O,Fe));return}const Ae={...J,...F};(F==null?void 0:F.id)===void 0&&(Ae.id=Ze()),u(iD(n,O,Fe,Ae));return}if((Fe==null?void 0:Fe.length)===8){const Ae={type:rf,reviewerChecklist:[],...F};w(parseInt(O[be]),parseInt(O[xe]),parseInt(O[le]),parseInt(O[Z]),parseInt(O[fe]),parseInt(O[ue]),parseInt(O[ye]),Ae),x(Fe[ra],Fe[ia],Fe[oa],Fe[la],Fe[ca],Fe[ue],Fe[ye],Fe[Fl]);return}const me={...J,...F};(F==null?void 0:F.id)===void 0&&(me.id=Ze()),u(iD(n,O,Fe,me))},[n,w,m,g,s,x,b,u,d.type]),q=(U,F,O,L)=>l.jsx(qxe,{emitSocketData:s,renderType:i,isPreview:L,data:U,handleDrop:P,path:F,pageIndex:O,isAdmin:a,isRenderView:o,isAdvanceView:e},`page-${U.uuid}`);return l.jsxs("div",{className:"page",children:[(i===qu||i===Xc||i===Uu)&&l.jsx(l.Fragment,{children:(n==null?void 0:n.length)===XU&&r===!0?l.jsx(l.Fragment,{children:(n==null?void 0:n.length)&&n.map((U,F)=>{const O=`${F}`;return l.jsx("div",{children:q(U,O,F,r)},`${U.uuid}-${F}`)})}):l.jsx(l.Fragment,{children:e===!0||r===!0?l.jsx(Ya,{activeIndex:I,onTabChange:U=>_(U.index),children:(n==null?void 0:n.length)&&n.map((U,F)=>{const O=`${F}`;return l.jsxs(tr,{disabled:!((U==null?void 0:U.isHidden)===!1||!r),header:"Page",headerTemplate:L=>l.jsx(YU,{options:L,pageIndex:F,page:U,isPreview:r,setTabSidebarSetting:C,clonePage:p,emitSocketData:s,formBuilderFormLayout:f,userSelectedLanguage:d,removePage:c,setPageActiveIndex:_,pages:n}),children:[r===!1&&l.jsx(dv,{reusableBuilderElementModalVisibility:T,setReusableBuilderElementModalVisibility:A,pageIndex:F}),l.jsx(bg,{setVisibility:C,visibilty:S,pageIndex:F,page:U,emitSocketData:s}),q(U,O,F,r)]},`${U.uuid}-${F}`)})}):l.jsx(l.Fragment,{children:(n==null?void 0:n.length)>0&&(n==null?void 0:n.map((U,F)=>{const O=`${F}`;return l.jsxs(k.Fragment,{children:[r===!1&&l.jsx(dv,{reusableBuilderElementModalVisibility:T,setReusableBuilderElementModalVisibility:A,pageIndex:F}),l.jsx(bg,{setVisibility:C,visibilty:S,pageIndex:F,page:U,emitSocketData:s}),q(U,O,F,r)]},`${U.uuid}-${F}`)}))})})}),i===Bu&&l.jsx(l.Fragment,{children:(n==null?void 0:n.length)===XU&&r===!0?l.jsx(l.Fragment,{children:(n==null?void 0:n.length)&&n.map((U,F)=>{const O=`${F}`;return l.jsx("div",{className:"scroll-height-400",children:q(U,O,F,r)},`${U.uuid}-${F}`)})}):l.jsx(l.Fragment,{children:r===!1?l.jsx(Ya,{activeIndex:I,onTabChange:U=>_(U.index),children:(n==null?void 0:n.length)&&n.map((U,F)=>{const O=`${F}`;if((U==null?void 0:U.isHidden)===!1||!r)return l.jsxs(tr,{header:"Page",headerTemplate:L=>l.jsx(YU,{options:L,pageIndex:F,page:U,isPreview:r,setTabSidebarSetting:C,clonePage:p,emitSocketData:s,formBuilderFormLayout:f,userSelectedLanguage:d,removePage:c,setPageActiveIndex:_,pages:n,isAdvanceView:e}),children:[r===!1&&l.jsx(dv,{reusableBuilderElementModalVisibility:T,setReusableBuilderElementModalVisibility:A,pageIndex:F}),l.jsxs("div",{className:"p-3",children:[l.jsx(bg,{setVisibility:C,visibilty:S,pageIndex:F,page:U,emitSocketData:s}),l.jsx("div",{children:q(U,O,F,r)})]})]},`${U.uuid}-${F}`)})}):l.jsx("div",{className:"",children:(n==null?void 0:n.length)&&n.map((U,F)=>{var L;const O=`${F}`;if((U==null?void 0:U.isHidden)===!1||!r)return l.jsxs("section",{id:U==null?void 0:U.uuid,"data-nav-title":(L=U==null?void 0:U.title)==null?void 0:L.english,"data-scrollspy":!0,children:[r===!1&&l.jsx(dv,{reusableBuilderElementModalVisibility:T,setReusableBuilderElementModalVisibility:A,pageIndex:F}),l.jsxs("div",{className:"p-3",children:[l.jsx(bg,{setVisibility:C,visibilty:S,pageIndex:F,page:U,emitSocketData:s}),l.jsx("div",{children:q(U,O,F,r)})]})]},`${U.uuid}-${F}`)})})})}),(i===B1||i===U1)&&l.jsx("div",{children:(n==null?void 0:n.length)&&n.map((U,F)=>{const O=`${F}`;if((U==null?void 0:U.isHidden)===!1||!r)return l.jsxs("div",{children:[l.jsx(bg,{setVisibility:C,visibilty:S,pageIndex:F,page:U,emitSocketData:s}),q(U,O,F,r)]},`policie-page-${F}`)})}),(i===Rd||i===j1)&&(n==null?void 0:n.length)&&n.map((U,F)=>{const O=`${F}`;return l.jsx("div",{children:q(U,O,F,r)},`exam-page-${F}`)})]})},Nw=t=>{const{isAdmin:e=!1,isAdvanceView:n=!1,formBuilderFormLayout:r,emitSocketData:i,isEditable:a,isRenderView:s,showPreview:o,userFormBuilderSettings:c,className:u=""}=t,d=Yp(),f=d==null?void 0:d.form_template_id,{builderIsChangesSaved:p,formBuilderConfigurationType:g,formBuilderFormSchema:m,saveFormProgress:b,userSelectedLanguage:w,formBuilderLoading:x,formatTableFieldsHook:S,schemaBuilderUpdate:C}=xn(),T=I=>{p===!1?(I.preventDefault(),I.returnValue=!1):window.location.reload()};k.useEffect(()=>(window.addEventListener("beforeunload",T),()=>{window.removeEventListener("beforeunload",T)}),[p]);const A=I=>{b(f,m,I)};return k.useEffect(()=>((m==null?void 0:m.enableAutoSaveBuilderSetting)===!0&&x===!1?A(!1):C({isChangesSaved:!1}),S(r),()=>{}),[r]),l.jsx(l.Fragment,{children:l.jsx("div",{className:"grid",children:l.jsx("div",{className:"col-12",children:l.jsx("div",{className:u,children:l.jsx(jxe,{isAdvanceView:n,isRenderView:s,isAdmin:e,layout:r,isPreview:o,renderType:g==null?void 0:g.key})})})})})},zxe={padding:"1rem 0.5rem",cursor:"move",textAlign:"center"},Sh=({data:t,showIcon:e,tags:n})=>{const[{opacity:r},i]=Yd({type:Rn,item:t,collect:s=>({opacity:s.isDragging()?0:1})});function a(s,o){return s.length<=o?s:s.slice(0,o)+"..."}return l.jsxs("div",{ref:i,className:`card shadow-2 question builder-sidebar-item ${t==null?void 0:t.element}`,style:{...zxe,opacity:r},children:[r&&(t!=null&&t.toolTip)?t==null?void 0:t.toolTip(t):"",a(t==null?void 0:t.label,80),l.jsxs("div",{className:"mt-2",children:[e&&l.jsx(Xu,{icon:"pi pi-check",severity:"warning",className:"mr-2",rounded:!0}),(n==null?void 0:n.length)>0&&(n==null?void 0:n.map((s,o)=>l.jsx(Xu,{severity:s==null?void 0:s.severity,className:"mr-2",value:s==null?void 0:s.label},`tagIndex-${o}`)))]})]})},Hxe=t=>{const{elementsBasedOnFormTypes:e}=t;return l.jsx(l.Fragment,{children:l.jsxs(Ya,{children:[(e==null?void 0:e.key)===qu&&l.jsx(tr,{header:"Survey",children:zW.map((n,r)=>l.jsx(Pi,{header:n==null?void 0:n.label,toggleable:!0,style:{marginBottom:10},children:l.jsx("div",{className:"grid",children:n==null?void 0:n.items.map((i,a)=>l.jsx("div",{className:"xl:col-6 lg:col-12 md:col-12 sm:col-12",children:l.jsx(Sh,{data:i},i.uuid)},"form_elements_"+a))})},`pannel-tab-${r}`))}),((e==null?void 0:e.key)===Xc||(e==null?void 0:e.key)===Uu)&&l.jsx(tr,{header:"Form",children:jW.map((n,r)=>l.jsx(Pi,{header:n==null?void 0:n.label,toggleable:!0,style:{marginBottom:10},children:l.jsx("div",{className:"grid",children:n==null?void 0:n.items.map((i,a)=>l.jsx("div",{className:"xl:col-6 lg:col-12 md:col-12 sm:col-12",children:l.jsx(Sh,{data:i},i.uuid)},"form_elements_"+a))})},`pannel-tab-${r}`))}),((e==null?void 0:e.key)===B1||(e==null?void 0:e.key)===U1||(e==null?void 0:e.key)===Bu)&&l.jsx(tr,{header:"Layout",children:UW.map((n,r)=>l.jsx(Pi,{header:n==null?void 0:n.label,toggleable:!0,style:{marginBottom:10},children:l.jsx("div",{className:"grid",children:n==null?void 0:n.items.map((i,a)=>l.jsx("div",{className:"col-6",children:l.jsx(Sh,{data:i},i.uuid)},"form_elements_"+a))})},`pannel-tab-${r}`))}),((e==null?void 0:e.key)===qu||(e==null?void 0:e.key)===Xc||(e==null?void 0:e.key)===Uu)&&l.jsx(tr,{header:"Layout",children:HW.map((n,r)=>l.jsx(Pi,{header:n==null?void 0:n.label,toggleable:!0,style:{marginBottom:10},children:l.jsx("div",{className:"grid",children:n==null?void 0:n.items.map((i,a)=>l.jsx("div",{className:"col-6",children:l.jsx(Sh,{data:i},i.uuid)},"form_elements_"+a))})},`pannel-tab-${r}`))}),(e==null?void 0:e.key)===Rd&&l.jsx(tr,{header:"Question Bank",children:l.jsxs("div",{className:"grid",children:[l.jsx("div",{className:"col-12",children:RW.map((n,r)=>l.jsx("div",{className:"grid",children:n==null?void 0:n.items.map((i,a)=>{const s=St.cloneDeep(i);return l.jsx("div",{className:"col-6",children:l.jsx(Sh,{data:s},i.uuid)},"form_elements_"+a)})},`new-quiz-${r}`))}),l.jsx("div",{className:"col-12 ",children:l.jsxs("div",{className:"p-inputgroup",children:[l.jsx(dn,{placeholder:"Keyword"}),l.jsx(Rt,{icon:"pi pi-search",className:"p-button-info"})]})})]})}),(e==null?void 0:e.key)===j1&&l.jsx(tr,{header:"Training",children:BW.map((n,r)=>l.jsx(Pi,{header:n==null?void 0:n.label,toggleable:!0,style:{marginBottom:10},children:l.jsx("div",{className:"grid",children:n==null?void 0:n.items.map((i,a)=>l.jsx("div",{className:"col-6",children:l.jsx(Sh,{data:i},i.uuid)},"form_elements_"+a))})},`pannel-tab-${r}`))}),((e==null?void 0:e.key)===qu||(e==null?void 0:e.key)===Xc||(e==null?void 0:e.key)===Uu)&&l.jsxs(tr,{header:"Custom",children:[l.jsx("h6",{children:"Custom Sections"}),l.jsx("div",{className:"grid"}),l.jsx("h6",{children:"Custom Matrix"}),l.jsx("div",{className:"grid"})]})]})})},Rxe=t=>{var r;const{section:e}=t,{userSelectedLanguage:n}=xn();return l.jsxs("div",{children:["   ",(r=e==null?void 0:e.heading)==null?void 0:r[n==null?void 0:n.type]," : "," ",l.jsx(Ra,{placeholder:"enter weight",max:100,min:0}),l.jsx("br",{}),l.jsx("br",{})]})};function Fw(){return Fw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Fw.apply(this,arguments)}function Yxe(t){if(Array.isArray(t))return t}function Xxe(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,a,s,o=[],c=!0,u=!1;try{if(a=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(o.push(r.value),o.length!==e);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw i}}return o}}function KU(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Kxe(t,e){if(t){if(typeof t=="string")return KU(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return KU(t,e)}}function Gxe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
4224
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cxe(t,e){if(t){if(typeof t=="string")return qU(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return qU(t,e)}}function qU(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function uxe(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,a,s,o=[],c=!0,u=!1;try{if(a=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(o.push(r.value),o.length!==e);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw i}}return o}}function dxe(t){if(Array.isArray(t))return t}function fxe(t,e){if(t==null)return{};var n=hxe(t,e),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)r=a[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function hxe(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,a;for(a=0;a<r.length;a++)i=r[a],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}function ov(t,e){var n=t.Component,r=t.country,i=t.defaultCountry,a=t.useNationalFormatForDefaultCountryValue,s=a===void 0?!0:a,o=t.value,c=t.onChange,u=t.metadata,d=t.international,f=t.withCountryCallingCode,p=fxe(t,sxe),g=ixe({value:o,onChange:c,country:r,defaultCountry:i,international:d,withCountryCallingCode:f,useNationalFormatForDefaultCountryValue:s,metadata:u}),m=oxe(g,2),b=m[0],w=m[1];return k.createElement(n,pw({},p,{ref:e,metadata:u,international:d,withCountryCallingCode:f,country:r||i,value:b,onChange:w}))}ov=k.forwardRef(ov),ov.propTypes={value:At.string,onChange:At.func.isRequired,country:At.string,defaultCountry:At.string,international:At.bool,withCountryCallingCode:At.bool,Component:At.elementType.isRequired,useNationalFormatForDefaultCountryValue:At.bool,metadata:ZAe};const pxe=ov;var gxe=["type","autoComplete","smartCaret","metadata"];function gw(){return gw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},gw.apply(this,arguments)}function mxe(t,e){if(t==null)return{};var n=vxe(t,e),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)r=a[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function vxe(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,a;for(a=0;a<r.length;a++)i=r[a],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}function BU(t){function e(n,r){var i=n.type,a=i===void 0?"tel":i,s=n.autoComplete,o=s===void 0?"tel":s,c=n.smartCaret,u=c===void 0?!0:c,d=n.metadata,f=d===void 0?t:d,p=mxe(n,gxe);return k.createElement(pxe,gw({},p,{type:a,autoComplete:o,metadata:f,ref:r,Component:u?XAe:JAe}))}return e=k.forwardRef(e),e.propTypes={type:At.string,autoComplete:At.string,smartCaret:At.bool,metadata:At.object},e}BU();const bxe=BU(fbe),mw=t=>{var ne,ue,ye,Ee,Fe,Te,me,ee,X,M,W;const{taskRegisterData:e,updateTaskRegisterData:n,updateTaskProgressValue:r,updateUserFormDataSubmit:i,userTaskSubmitFormData:a,TASK_PUBLISHED:s,task_status:o}=si(),{userSelectedLanguage:c,fieldSettingUpdate:u}=xn(),{isPreview:d,field:f,fieldIndex:p,sectionIndex:g,pageIndex:m,row:b,rowIndex:w,columnIndex:x,isAdmin:S,isRenderView:C}=t,[T,A]=k.useState(!1),[I,_]=k.useState(""),[P,q]=k.useState(0),[U,F]=k.useState(!1),[O,L]=k.useState(!1),J=()=>{L(!0)},be=()=>{L(!1)},xe=()=>{var G,he,Ne;if(b!=null&&b.rowIsRepeatable){if(b!=null&&b.repeatableFields){const Se=[...b.repeatableFields],Ae=St.findIndex(Se,function(Ve){return Ve.uuid===(f==null?void 0:f.uuid)});Ae>=0&&Se[Ae].fieldData?_(Se[Ae].fieldData):_("")}}else{const Se=a;if(Se!=null&&Se.length){for(const Ae of Se)if(Ae.fieldId===t.field.uuid&&((G=Ae==null?void 0:Ae.postData[0])==null?void 0:G.postValue)!==""&&((he=Ae==null?void 0:Ae.postData[0])!=null&&he.postValue)){_((Ne=Ae==null?void 0:Ae.postData[0])==null?void 0:Ne.postValue);break}}}F(!0)};k.useEffect(()=>{U||xe();const G=an.addListener("clearRepeatableFields",Ae=>{Ae===(b==null?void 0:b.uuid)&&(_(""),q(0),f.isValid=0,u(m,g,w,x,p,f))}),he=an.addListener("onSubmitUserForm",()=>{var Ae;(Ae=f==null?void 0:f.attributes)!=null&&Ae.required?I?f.isValid=1:f.isValid=0:f.isValid=1}),Ne=an.addListener("OnInvalidFieldCatch",Ae=>{f.uuid===(Ae==null?void 0:Ae.fieldId)?q(1):q(0)}),Se=an.addListener("OnGetFieldValue",Ae=>{var se;const Ve=(se=Ae==null?void 0:Ae.repeatableColumn)==null?void 0:se.filter((pe,z)=>(pe==null?void 0:pe.fieldUuid)===(f==null?void 0:f.uuid));Ve!=null&&Ve.length});return()=>{he.remove(),Ne.remove(),Se.remove(),G.remove()}});const le=G=>{A(G)},Z=()=>{A(!1)},fe=G=>{_(G);const he=a,Ne=St.cloneDeep(e);if(he!==null){if(G){if(Ne[f==null?void 0:f.uuid]=G,(he==null?void 0:he.length)>0)for(const Se of he)Se.fieldId===t.field.uuid&&(Se.postData[0]={postValue:G})}else if(delete Ne[f==null?void 0:f.uuid],(he==null?void 0:he.length)>0)for(const Se of he)Se.fieldId===t.field.uuid&&(Se.postData[0]={postValue:""})}if(!(b!=null&&b.rowIsRepeatable)){n(Ne);const Se=Object.keys(Ne).length;r(Se)}},Y=(G,he)=>{var Ne;if(a){const Se=[...a],Ae=St.findIndex(Se,function(se){return se.rowId===(b==null?void 0:b.uuid)});let Ve=(Ne=a[Ae])==null?void 0:Ne.repeatableFields;Ve={...Ve,[G==null?void 0:G.uuid]:he},Se[Ae]={...Se[Ae],repeatableFields:Ve},i(Se)}_(he),he!==""?G.isValid=1:G.isValid=0},ie=G=>{b!=null&&b.rowIsRepeatable?Y(f,G):fe(G)},K=l.jsxs("div",{onMouseOver:J,onMouseOut:be,children:[!C&&!d&&O&&l.jsx(qr,{handleFieldSettingsSidebar:le,...t}),l.jsxs("div",{className:`field ${d?" ":" builder-element-wrapper "}${(f==null?void 0:f.isFluid)===!0?" card py-3 px-4 p-fluid":"card py-3 px-4"}`,children:[l.jsx("div",{className:"grid",children:l.jsxs("div",{className:d?"col-12 ":"col-12 p-fluid",children:[(f==null?void 0:f.showHeaderText)&&l.jsx("h6",{children:(ne=f==null?void 0:f.headerText)==null?void 0:ne[c==null?void 0:c.type]}),(f==null?void 0:f.showLabel)&&l.jsxs("label",{htmlFor:p,className:"flex font-medium mb-3 text-700 text-2xl",children:[l.jsx(ea,{...t}),((ue=f==null?void 0:f.attributes)==null?void 0:ue.required)&&l.jsx("span",{className:"must-required mr-1",children:"*"})," ",d?l.jsx(l.Fragment,{children:(ye=f==null?void 0:f.label)==null?void 0:ye[c==null?void 0:c.type]}):l.jsx(Xi,{...t}),l.jsx("span",{className:"ml-3",children:(f==null?void 0:f.showToolTip)&&l.jsx(Fi,{message:(Ee=f==null?void 0:f.toolTip)==null?void 0:Ee[c==null?void 0:c.type],position:"right"})})]}),l.jsxs("div",{className:"mt-3",children:[l.jsxs("span",{className:"p-input-icon-"+(f==null?void 0:f.iconAlignment),children:[(f==null?void 0:f.showIcon)&&l.jsx("i",{className:"pi pi-"+((Te=(Fe=f==null?void 0:f.icon)==null?void 0:Fe.properties)==null?void 0:Te.name)}),l.jsx(bxe,{id:f==null?void 0:f.uuid,placeholder:(me=f==null?void 0:f.placeholder)==null?void 0:me[c==null?void 0:c.type],value:I,onFocus:()=>q(1),onChange:ie,international:!0,className:`${P===1&&((ee=f==null?void 0:f.attributes)!=null&&ee.required)?I?"valid":"invalid":"valid'"} p-inputtext`,readOnly:o===s})]}),l.jsx("div",{children:((X=f==null?void 0:f.attributes)==null?void 0:X.required)&&l.jsx("small",{className:"error",children:P===1&&!I?(M=f==null?void 0:f.validationMesssage)==null?void 0:M.english:""})}),l.jsx("div",{children:(f==null?void 0:f.showHelperText)&&l.jsx("small",{children:(W=f==null?void 0:f.helperText)==null?void 0:W[c==null?void 0:c.type]})})]})]})}),S&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{}),l.jsx(Ii,{...t})]})]})]});return l.jsxs(l.Fragment,{children:[T===!0&&l.jsx(Yi,{visibilty:T,closeSettingFieldSidebar:Z,...t}),l.jsx(xi,{...t,fieldWrap:K})]})};mw.defaultProps={field:{},isPreview:!1},mw.propTypes={field:At.any,isPreview:At.bool};const vw=t=>{var fe,Y,ie,K,ne,ue,ye,Ee,Fe,Te,me;const{isPreview:e,field:n,fieldIndex:r,isAdmin:i,pageIndex:a,sectionIndex:s,row:o,isRenderView:c}=t,{task_status:u,taskRegisterData:d,updateTaskRegisterData:f,updateTaskProgressValue:p,updateUserFormDataSubmit:g,userTaskSubmitFormData:m,TASK_PUBLISHED:b}=si(),{userSelectedLanguage:w}=xn(),[x,S]=k.useState(!1),[C,T]=k.useState(""),[A,I]=k.useState(0),[_,P]=k.useState(!1),q=()=>{P(!0)},U=()=>{P(!1)};k.useEffect(()=>{x||be();const ee=an.addListener("clearRepeatableFields",M=>{M===(o==null?void 0:o.uuid)&&(T(""),I(0),n.isValid=0)}),X=an.addListener("onSubmitUserForm",()=>{var M;(M=n==null?void 0:n.attributes)!=null&&M.required?C!==""&&eu.test(C)===!0?n.isValid=1:n.isValid=0:n.isValid=1});return()=>{X.remove(),ee.remove()}});const[F,O]=k.useState(!1),L=ee=>{O(ee)},J=()=>{O(!1)},be=()=>{var ee,X,M;if(o!=null&&o.rowIsRepeatable){if(o!=null&&o.repeatableFields){const W=[...o.repeatableFields],G=St.findIndex(W,function(he){return he.uuid===(n==null?void 0:n.uuid)});G>=0&&W[G].fieldData?T(W[G].fieldData):T("")}}else{const W=m;if(W!=null&&W.length){for(const G of W)if(G.fieldId===t.field.uuid&&((ee=G==null?void 0:G.postData[0])==null?void 0:ee.postValue)!==""&&((X=G==null?void 0:G.postData[0])!=null&&X.postValue)){T((M=G==null?void 0:G.postData[0])==null?void 0:M.postValue),S(!0);break}}}S(!0)},xe=(ee,X)=>{T(X);const M=m,W=St.cloneDeep(d);if(X!==""&&eu.test(X)===!0){if(W[n==null?void 0:n.uuid]=X,(M==null?void 0:M.length)>0)for(const G of M)G.fieldId===t.field.uuid&&(G.postData[0]={postValue:X})}else if(delete W[n==null?void 0:n.uuid],(M==null?void 0:M.length)>0)for(const G of M)G.fieldId===t.field.uuid&&(G.postData[0]={postValue:""});if(!(o!=null&&o.rowIsRepeatable)){f(W);const G=Object.keys(W).length;p(G)}},le=(ee,X,M,W)=>{var Se;const G=[...m],he=St.findIndex(G,function(Ae){return Ae.rowId===(o==null?void 0:o.uuid)});let Ne=(Se=m[he])==null?void 0:Se.repeatableFields;Ne={...Ne,[M==null?void 0:M.uuid]:W},G[he]={...G[he],repeatableFields:Ne},g(G),T(W),W!==""&&eu.test(W)===!0?n.isValid=1:n.isValid=0},Z=l.jsxs("div",{onMouseOver:q,onMouseOut:U,children:[!c&&!e&&_&&l.jsx(qr,{handleFieldSettingsSidebar:L,...t}),l.jsxs("div",{className:`field ${e?" ":" builder-element-wrapper "}${(n==null?void 0:n.isFluid)===!0?" card py-3 px-4 p-fluid":"card py-3 px-4"}`,children:[l.jsx("div",{className:"grid"}),(n==null?void 0:n.showHeaderText)&&l.jsx("h6",{children:(fe=n==null?void 0:n.headerText)==null?void 0:fe[w==null?void 0:w.type]}),(n==null?void 0:n.showLabel)&&l.jsxs("label",{htmlFor:r,className:"flex font-medium mb-3 text-700 text-2xl",children:[l.jsx(ea,{...t}),((Y=n==null?void 0:n.attributes)==null?void 0:Y.required)&&l.jsx("span",{className:"must-required mr-1",children:"*"})," ",e?l.jsx(l.Fragment,{children:(ie=n==null?void 0:n.label)==null?void 0:ie[w==null?void 0:w.type]}):l.jsx(Xi,{...t}),l.jsx("span",{className:"ml-3",children:(n==null?void 0:n.showToolTip)&&l.jsx(Fi,{message:(K=n==null?void 0:n.toolTip)==null?void 0:K[w==null?void 0:w.type],position:"right"})})]}),l.jsxs("span",{className:"p-input-icon-"+(n==null?void 0:n.iconAlignment),children:[(n==null?void 0:n.showIcon)&&l.jsx("i",{className:"pi pi-"+((ue=(ne=n==null?void 0:n.icon)==null?void 0:ne.properties)==null?void 0:ue.name)}),l.jsx(dn,{id:n==null?void 0:n.uuid,placeholder:(ye=n==null?void 0:n.placeholder)==null?void 0:ye[w==null?void 0:w.type],value:C,onFocus:()=>I(1),onChange:ee=>{o!=null&&o.rowIsRepeatable?le(a,s,n,ee.target.value):xe(ee,ee.target.value)},className:A===1&&((Ee=n==null?void 0:n.attributes)!=null&&Ee.required)?C?"valid":"invalid":"valid'",readOnly:u===b})]}),((Fe=n==null?void 0:n.attributes)==null?void 0:Fe.required)&&l.jsx("div",{children:l.jsx("small",{className:"error",children:A===1&&!C?(Te=n==null?void 0:n.validationMesssage)==null?void 0:Te[w==null?void 0:w.type]:""})}),C!==""&&A===1&&eu.test(C)===!1&&l.jsx("small",{className:"error",children:"Please enter correct url"}),(n==null?void 0:n.showHelperText)&&l.jsx("div",{children:l.jsx("small",{children:(me=n==null?void 0:n.helperText)==null?void 0:me[w==null?void 0:w.type]})})]}),i&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{}),l.jsx(Ii,{...t})]})]});return l.jsxs(l.Fragment,{children:[F===!0&&l.jsx(Yi,{visibilty:F,closeSettingFieldSidebar:J,...t},n==null?void 0:n.uuid),l.jsx(xi,{...t,fieldWrap:Z})]})};vw.defaultProps={field:{},isPreview:!1},vw.propTypes={field:At.any,isPreview:At.bool};const bw=t=>{var fe,Y,ie,K,ne,ue,ye,Ee,Fe;const{isPreview:e,field:n,fieldIndex:r,isAdmin:i,isRenderView:a,pageIndex:s,sectionIndex:o,row:c}=t,{task_status:u,taskRegisterData:d,updateTaskRegisterData:f,updateTaskProgressValue:p,updateUserFormDataSubmit:g,userTaskSubmitFormData:m,TASK_PUBLISHED:b}=si(),{userSelectedLanguage:w}=xn(),[x,S]=k.useState(!1),[C,T]=k.useState(""),[A,I]=k.useState(0),[_,P]=k.useState(!1),q=()=>{P(!0)},U=()=>{P(!1)};k.useEffect(()=>{x||be();const Te=an.addListener("clearRepeatableFields",ee=>{ee===(c==null?void 0:c.uuid)&&(T(""),I(0),n.isValid=0)}),me=an.addListener("onSubmitUserForm",()=>{var ee;(ee=n==null?void 0:n.attributes)!=null&&ee.required?C!==""&&eu.test(C)===!0?n.isValid=1:n.isValid=0:n.isValid=1});return()=>{me.remove(),Te.remove()}});const[F,O]=k.useState(!1),L=Te=>{O(Te)},J=()=>{O(!1)},be=()=>{var Te,me,ee;if(c!=null&&c.rowIsRepeatable){const X=[...(c==null?void 0:c.repeatableFields)||[]],M=St.findIndex(X,function(W){return W.uuid===(n==null?void 0:n.uuid)});M>=0&&X[M].fieldData?T(X[M].fieldData):T("")}else{const X=m;if(X!=null&&X.length){for(const M of X)if(M.fieldId===t.field.uuid&&((Te=M==null?void 0:M.postData[0])==null?void 0:Te.postValue)!==""&&((me=M==null?void 0:M.postData[0])!=null&&me.postValue)){T((ee=M==null?void 0:M.postData[0])==null?void 0:ee.postValue),S(!0);break}}}S(!0)},xe=(Te,me)=>{T(me);const ee=m,X=St.cloneDeep(d);if(ee!==null){if(me){if(X[n==null?void 0:n.uuid]=me,(ee==null?void 0:ee.length)>0)for(const M of ee)M.fieldId===t.field.uuid&&(M.postData[0]={postValue:me})}else if(delete X[n==null?void 0:n.uuid],(ee==null?void 0:ee.length)>0)for(const M of ee)M.fieldId===t.field.uuid&&(M.postData[0]={postValue:""})}if(!(c!=null&&c.rowIsRepeatable)){f(X);const M=Object.keys(X).length;p(M)}},le=(Te,me,ee,X)=>{var he;const M=[...m],W=St.findIndex(M,function(Ne){return Ne.rowId===(c==null?void 0:c.uuid)});let G=(he=m[W])==null?void 0:he.repeatableFields;G={...G,[ee==null?void 0:ee.uuid]:X},M[W]={...M[W],repeatableFields:G},g(M),T(X),X!==""&&eu.test(X)===!0?n.isValid=1:n.isValid=0},Z=l.jsxs("div",{onMouseOver:q,onMouseOut:U,children:[!a&&!e&&_&&l.jsx(qr,{handleFieldSettingsSidebar:L,...t}),l.jsxs("div",{className:`field ${e?" ":" builder-element-wrapper "}${(n==null?void 0:n.isFluid)===!0?" card py-3 px-4 p-fluid":"card py-3 px-4"}`,children:[l.jsx("div",{className:"grid",children:l.jsxs("div",{className:i?"col-6 ":"col-12 p-fluid",children:[(n==null?void 0:n.showHeaderText)&&l.jsx("h6",{children:(fe=n==null?void 0:n.headerText)==null?void 0:fe[w==null?void 0:w.type]}),(n==null?void 0:n.showLabel)&&l.jsxs("label",{htmlFor:r,className:"flex font-medium mb-3 text-700 text-2xl",children:[l.jsx(ea,{...t}),((Y=n==null?void 0:n.attributes)==null?void 0:Y.required)&&l.jsx("span",{className:"must-required mr-1",children:"*"})," ",e?l.jsx(l.Fragment,{children:(ie=n==null?void 0:n.label)==null?void 0:ie[w==null?void 0:w.type]}):l.jsx(Xi,{...t}),(n==null?void 0:n.showToolTip)&&l.jsx("span",{className:"ml-3",children:l.jsx(Fi,{message:(K=n==null?void 0:n.toolTip)==null?void 0:K[w==null?void 0:w.type],position:"right"})})]}),l.jsx("div",{className:"flex justify-content-center",children:l.jsx(o6,{cancelIcon:l.jsx("img",{src:"/assets/images/cancel.png",alt:"custom-cancel-image",width:"25px",height:"25px"}),offIcon:l.jsx("img",{src:"/assets/images/star_10961031.png",alt:"custom-image-active",width:"25px",height:"25px"}),onIcon:l.jsx("img",{src:"/assets/images/star_12259255.png",alt:"custom-image",width:"25px",height:"25px"}),id:n==null?void 0:n.uuid,placeholder:(ne=n==null?void 0:n.placeholder)==null?void 0:ne[w==null?void 0:w.type],value:C,onFocus:()=>I(1),onChange:Te=>{c!=null&&c.rowIsRepeatable?le(s,o,n,Te.value):xe(Te,Te.value)},className:A===1&&((ue=n==null?void 0:n.attributes)!=null&&ue.required)?C?"valid":"invalid":"valid'",readOnly:u===b})}),((ye=n==null?void 0:n.attributes)==null?void 0:ye.required)&&l.jsx("div",{children:l.jsx("small",{className:"error",children:A===1&&!C?(Ee=n==null?void 0:n.validationMesssage)==null?void 0:Ee[w==null?void 0:w.type]:""})}),(n==null?void 0:n.showHelperText)&&l.jsx("div",{children:l.jsx("small",{children:(Fe=n==null?void 0:n.helperText)==null?void 0:Fe[w==null?void 0:w.type]})})]})}),i&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{}),l.jsx(Ii,{...t})]})]})]});return l.jsxs(l.Fragment,{children:[F===!0&&l.jsx(Yi,{visibilty:F,closeSettingFieldSidebar:J,...t},n==null?void 0:n.uuid),l.jsx(xi,{...t,fieldWrap:Z})]})};bw.defaultProps={field:{},isPreview:!1},bw.propTypes={field:At.any,isPreview:At.bool};const yw=t=>{var fe,Y,ie,K,ne,ue,ye,Ee,Fe;const{isPreview:e,field:n,fieldIndex:r,isAdmin:i,isRenderView:a,pageIndex:s,sectionIndex:o,row:c}=t,{task_status:u,taskRegisterData:d,updateTaskRegisterData:f,updateTaskProgressValue:p,updateUserFormDataSubmit:g,userTaskSubmitFormData:m,TASK_PUBLISHED:b}=si(),{userSelectedLanguage:w}=xn(),[x,S]=k.useState(!1),[C,T]=k.useState(""),[A,I]=k.useState(0),[_,P]=k.useState(!1),q=()=>{P(!0)},U=()=>{P(!1)};k.useEffect(()=>{x||be();const Te=an.addListener("clearRepeatableFields",ee=>{ee===(c==null?void 0:c.uuid)&&(T(""),I(0),n.isValid=0)}),me=an.addListener("onSubmitUserForm",ee=>{var X;(X=n==null?void 0:n.attributes)!=null&&X.required?C!==""&&eu.test(C)===!0?n.isValid=1:n.isValid=0:n.isValid=1});return()=>{me.remove(),Te.remove()}});const[F,O]=k.useState(!1),L=Te=>{O(Te)},J=()=>{O(!1)},be=()=>{var Te,me,ee;if(c!=null&&c.rowIsRepeatable){if(c!=null&&c.repeatableFields){const X=[...c.repeatableFields],M=St.findIndex(X,function(W){return W.uuid===(n==null?void 0:n.uuid)});M>=0&&X[M].fieldData?T(X[M].fieldData):T("")}}else{const X=m;if(X!=null&&X.length){for(const M of X)if(M.fieldId===t.field.uuid&&((Te=M==null?void 0:M.postData[0])==null?void 0:Te.postValue)!==""&&((me=M==null?void 0:M.postData[0])!=null&&me.postValue)){T((ee=M==null?void 0:M.postData[0])==null?void 0:ee.postValue),S(!0);break}}}S(!0)},xe=(Te,me)=>{T(me);const ee=m,X=St.cloneDeep(d);if(ee!==null){if(me){if(X[n==null?void 0:n.uuid]=me,(ee==null?void 0:ee.length)>0)for(const M of ee)M.fieldId===t.field.uuid&&(M.postData[0]={postValue:me})}else if(delete X[n==null?void 0:n.uuid],(ee==null?void 0:ee.length)>0)for(const M of ee)M.fieldId===t.field.uuid&&(M.postData[0]={postValue:""})}if(!(c!=null&&c.rowIsRepeatable)){f(X);const M=Object.keys(X).length;p(M)}},le=(Te,me,ee,X)=>{var he;const M=[...m],W=St.findIndex(M,function(Ne){return Ne.rowId===(c==null?void 0:c.uuid)});let G=(he=m[W])==null?void 0:he.repeatableFields;G={...G,[ee==null?void 0:ee.uuid]:X},M[W]={...M[W],repeatableFields:G},g(M),T(X),X!==""&&eu.test(X)===!0?n.isValid=1:n.isValid=0},Z=l.jsxs("div",{onMouseOver:q,onMouseOut:U,children:[!a&&!e&&_&&l.jsx(qr,{handleFieldSettingsSidebar:L,...t}),l.jsx("div",{className:`field ${e?" ":" builder-element-wrapper "}${(n==null?void 0:n.isFluid)===!0?" card py-3 px-4 p-fluid":"card py-3 px-4"}`,children:l.jsxs("div",{className:"grid",children:[l.jsxs("div",{className:e?"col-12 p-fluid":"col-12 p-fluid field-form-builder",children:[(n==null?void 0:n.showHeaderText)&&l.jsx("h6",{children:(fe=n==null?void 0:n.headerText)==null?void 0:fe[w==null?void 0:w.type]}),(n==null?void 0:n.showLabel)&&l.jsxs("label",{htmlFor:r,className:"flex font-medium mb-3 text-700 text-2xl",children:[l.jsx(ea,{...t}),((Y=n==null?void 0:n.attributes)==null?void 0:Y.required)&&l.jsx("span",{className:"must-required mr-1",children:"*"})," ",e?l.jsx(l.Fragment,{children:(ie=n==null?void 0:n.label)==null?void 0:ie[w==null?void 0:w.type]}):l.jsx(Xi,{...t}),l.jsx("span",{className:"ml-3",children:(n==null?void 0:n.showToolTip)&&l.jsx(Fi,{message:(K=n==null?void 0:n.toolTip)==null?void 0:K[w==null?void 0:w.type],position:"right"})})]}),l.jsx(u6,{id:n==null?void 0:n.uuid,placeholder:(ne=n==null?void 0:n.placeholder)==null?void 0:ne[w==null?void 0:w.type],value:C,onFocus:()=>I(1),onChange:Te=>{c!=null&&c.rowIsRepeatable?le(s,o,n,Te.value):xe(Te,Te.value)},className:A===1&&((ue=n==null?void 0:n.attributes)!=null&&ue.required)?C?"valid":"invalid":"valid'",readOnly:u===b}),((ye=n==null?void 0:n.attributes)==null?void 0:ye.required)&&l.jsx("div",{children:l.jsx("small",{className:"error",children:A===1&&!C?(Ee=n==null?void 0:n.validationMesssage)==null?void 0:Ee[w==null?void 0:w.type]:""})}),(n==null?void 0:n.showHelperText)&&l.jsx("div",{children:l.jsx("small",{children:(Fe=n==null?void 0:n.helperText)==null?void 0:Fe[w==null?void 0:w.type]})})]}),i&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{}),l.jsx(Ii,{...t})]})]})})]});return l.jsxs(l.Fragment,{children:[F===!0&&l.jsx(Yi,{visibilty:F,closeSettingFieldSidebar:J,...t},n==null?void 0:n.uuid),l.jsx(xi,{...t,fieldWrap:Z})]})};yw.defaultProps={field:{},isPreview:!1},yw.propTypes={field:At.any,isPreview:At.bool};const Aw=t=>{var Z,fe,Y,ie,K,ne;const{isPreview:e,field:n,isAdmin:r,pageIndex:i,sectionIndex:a,row:s,isRenderView:o}=t,{task_status:c,taskRegisterData:u,updateTaskRegisterData:d,updateTaskProgressValue:f,updateUserFormDataSubmit:p,userTaskSubmitFormData:g,TASK_PUBLISHED:m}=si(),{userSelectedLanguage:b}=xn(),[w,x]=k.useState(!1),[S,C]=k.useState(""),[T,A]=k.useState(0),[I,_]=k.useState(!1),P=()=>{_(!0)},q=()=>{_(!1)};k.useEffect(()=>{w||J();const ue=an.addListener("clearRepeatableFields",Ee=>{Ee===(s==null?void 0:s.uuid)&&(C(""),A(0),n.isValid=0)}),ye=an.addListener("onSubmitUserForm",Ee=>{var Fe;(Fe=n==null?void 0:n.attributes)!=null&&Fe.required&&(S!==""&&eu.test(S)===!0?n.isValid=1:n.isValid=0)});return()=>{ye.remove(),ue.remove()}});const[U,F]=k.useState(!1),O=ue=>{F(ue)},L=()=>{F(!1)},J=()=>{var ue,ye,Ee;if(s!=null&&s.rowIsRepeatable){if(s!=null&&s.repeatableFields){const Fe=[...s.repeatableFields],Te=St.findIndex(Fe,function(me){return me.uuid===(n==null?void 0:n.uuid)});Te>=0&&Fe[Te].fieldData?C(Fe[Te].fieldData):C("")}}else{const Fe=g;if(Fe!=null&&Fe.length){for(const Te of Fe)if(Te.fieldId===t.field.uuid&&((ue=Te==null?void 0:Te.postData[0])==null?void 0:ue.postValue)!==""&&((ye=Te==null?void 0:Te.postData[0])!=null&&ye.postValue)){C((Ee=Te==null?void 0:Te.postData[0])==null?void 0:Ee.postValue),x(!0);break}}}x(!0)},be=(ue,ye)=>{C(ye);const Ee=g,Fe=St.cloneDeep(u);if(ye){if(Fe[n==null?void 0:n.uuid]=ye,(Ee==null?void 0:Ee.length)>0)for(const Te of Ee)Te.fieldId===t.field.uuid&&(Te.postData[0]={postValue:ye})}else if(delete Fe[n==null?void 0:n.uuid],(Ee==null?void 0:Ee.length)>0)for(const Te of Ee)Te.fieldId===t.field.uuid&&(Te.postData[0]={postValue:""});if(!(s!=null&&s.rowIsRepeatable)){d(Fe);const Te=Object.keys(Fe).length;f(Te)}},xe=(ue,ye,Ee,Fe)=>{var X;const Te=[...g],me=St.findIndex(Te,function(M){return M.rowId===(s==null?void 0:s.uuid)});let ee=(X=g[me])==null?void 0:X.repeatableFields;ee={...ee,[Ee==null?void 0:Ee.uuid]:Fe},Te[me]={...Te[me],repeatableFields:ee},p(Te),C(Fe),Fe!==""&&eu.test(Fe)===!0?n.isValid=1:n.isValid=0},le=l.jsxs("div",{onMouseOver:P,onMouseOut:q,children:[!o&&!e&&I&&l.jsx(qr,{handleFieldSettingsSidebar:O,...t}),l.jsxs("div",{className:`field ${e?" ":" builder-element-wrapper "}${(n==null?void 0:n.isFluid)===!0?" p-fluid ":" "} ${o?" ":" py-6 px-4 card"}`,children:[l.jsxs("div",{className:e?"p-fluid":"card p-fluid field-form-builder",children:[!e&&l.jsx("label",{className:"block font-medium mb-3 text-700 text-2xl",children:"Hidden field"}),l.jsx(dn,{type:e===!0?"hidden":"text",id:n==null?void 0:n.uuid,placeholder:(Z=n==null?void 0:n.placeholder)==null?void 0:Z[b==null?void 0:b.type],value:(fe=n==null?void 0:n.defaultValue)==null?void 0:fe[b==null?void 0:b.type],onFocus:()=>A(1),onLoad:()=>{s!=null&&s.rowIsRepeatable?xe(i,a,n,n==null?void 0:n.defaultValue):be("",n==null?void 0:n.defaultValue)},className:T===1&&((Y=n==null?void 0:n.attributes)!=null&&Y.required)?S?"valid":"invalid":"valid'",readOnly:c===m}),((ie=n==null?void 0:n.attributes)==null?void 0:ie.required)&&l.jsx("div",{children:l.jsx("small",{className:"error",children:T===1&&!S?(K=n==null?void 0:n.validationMesssage)==null?void 0:K[b==null?void 0:b.type]:""})}),(n==null?void 0:n.showHelperText)&&l.jsx("div",{children:l.jsx("small",{children:(ne=n==null?void 0:n.helperText)==null?void 0:ne[b==null?void 0:b.type]})})]}),r&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{}),l.jsx(Ii,{...t})]})]})]});return l.jsxs(l.Fragment,{children:[U===!0&&l.jsx(Yi,{visibilty:U,closeSettingFieldSidebar:L,...t}),l.jsx(xi,{...t,fieldWrap:le})]})};Aw.defaultProps={field:{},isPreview:!1},Aw.propTypes={field:At.any,isPreview:At.bool};const UU=t=>{var T;const{field:e,fieldIndex:n,pageIndex:r,sectionIndex:i,rowIndex:a,columnIndex:s,path:o,labelType:c,isPreview:u}=t,[d,f]=k.useState(e);k.useEffect(()=>{var A;return S((A=e[c])==null?void 0:A[p==null?void 0:p.type]),()=>{}},[e]);const{userSelectedLanguage:p,fieldSettingUpdate:g,fieldSettingUpdateInlineConditional:m,gridComponentFieldSettingUpdate:b}=xn(),w=(A,I,_)=>{f(P=>({...P,[A]:{...P[A],[I==null?void 0:I.type]:_}}))},[x,S]=k.useState((T=e[c])==null?void 0:T[p==null?void 0:p.type]);k.useEffect(()=>(C(),()=>{}),[d]);const C=()=>{const A=o.split("-");(t==null?void 0:t.fieldContainer)==="inline-condition-container"?m(A[ra],A[ia],A[oa],A[la],A[ca],A[ma],A[Vo],A[mo],d):(A==null?void 0:A.length)>ma&&(A==null?void 0:A.length)===Fl+1&&(e!=null&&e.componentType)&&(t==null?void 0:t.fieldContainer)==="grid-container"?b(A[ra],A[ia],A[oa],A[la],A[ca],A[5],A[6],A[7],d):g(r,i,a,s,n,{...e,[c]:d[c]})};return l.jsx(l.Fragment,{children:l.jsx(m3,{style:{display:"inline-block"},className:"builder-input-label-edit",html:x,disabled:u,onChange:A=>{var I;S(x3.sanitize((I=A==null?void 0:A.target)==null?void 0:I.value))},onBlur:A=>{var _;const I=x3.sanitize((_=A==null?void 0:A.target)==null?void 0:_.innerText);S(I),w(c,p,I)},tagName:"article"})})},xw=t=>{var K,ne,ue,ye,Ee,Fe,Te;const{taskRegisterData:e,updateTaskRegisterData:n,updateTaskProgressValue:r,updateUserFormDataSubmit:i,userTaskSubmitFormData:a}=si(),{userSelectedLanguage:s,fieldSettingUpdate:o}=xn(),{isPreview:c,field:u,fieldIndex:d,sectionIndex:f,pageIndex:p,row:g,rowIndex:m,columnIndex:b,isAdmin:w,isRenderView:x}=t,[S,C]=k.useState(!1),[T,A]=k.useState(""),[I,_]=k.useState(0),[P,q]=k.useState(!1),[U,F]=k.useState(!1),O=()=>{F(!0)},L=()=>{F(!1)},J=()=>{var me,ee,X;if(g!=null&&g.rowIsRepeatable){if(g!=null&&g.repeatableFields){const M=[...g.repeatableFields],W=St.findIndex(M,function(G){return G.uuid===(u==null?void 0:u.uuid)});W>=0&&M[W].fieldData?A(M[W].fieldData):A("")}}else{const M=a;if(M!=null&&M.length){for(const W of M)if(W.fieldId===t.field.uuid&&((me=W==null?void 0:W.postData[0])==null?void 0:me.postValue)!==""&&((ee=W==null?void 0:W.postData[0])!=null&&ee.postValue)){A((X=W==null?void 0:W.postData[0])==null?void 0:X.postValue);break}}}q(!0)};k.useEffect(()=>{P||J();const me=an.addListener("clearRepeatableFields",W=>{W===(g==null?void 0:g.uuid)&&(A(""),_(0),u.isValid=0,o(p,f,m,b,d,u))}),ee=an.addListener("onSubmitUserForm",W=>{var G;(G=u==null?void 0:u.attributes)!=null&&G.required?T?u.isValid=1:u.isValid=0:u.isValid=1}),X=an.addListener("OnInvalidFieldCatch",W=>{u.uuid===(W==null?void 0:W.fieldId)?_(1):_(0)}),M=an.addListener("OnGetFieldValue",W=>{var he;const G=(he=W==null?void 0:W.repeatableColumn)==null?void 0:he.filter(Ne=>(Ne==null?void 0:Ne.fieldUuid)===(u==null?void 0:u.uuid));G!=null&&G.length});return()=>{ee.remove(),X.remove(),M.remove(),me.remove()}});const be=me=>{C(me)},xe=()=>{C(!1)},le=me=>{var M,W;A(me.target.value);const ee=a,X=St.cloneDeep(e);if(ee!==null){if((M=me==null?void 0:me.target)!=null&&M.value){if(X[u==null?void 0:u.uuid]=(W=me==null?void 0:me.target)==null?void 0:W.value,(ee==null?void 0:ee.length)>0)for(const G of ee)G.fieldId===t.field.uuid&&(G.postData[0]={postValue:me.target.value})}else if(delete X[u==null?void 0:u.uuid],(ee==null?void 0:ee.length)>0)for(const G of ee)G.fieldId===t.field.uuid&&(G.postData[0]={postValue:""})}if(!(g!=null&&g.rowIsRepeatable)){n(X);const G=Object.keys(X).length;r(G)}},Z=(me,ee,X,M)=>{var W;if(a){const G=[...a],he=St.findIndex(G,function(Se){return Se.rowId===(g==null?void 0:g.uuid)});let Ne=(W=a[he])==null?void 0:W.repeatableFields;Ne={...Ne,[X==null?void 0:X.uuid]:M},G[he]={...G[he],repeatableFields:Ne},i(G)}A(M),M!==""?X.isValid=1:X.isValid=0},fe=10,Y=()=>{const me=[];for(let ee=0;ee<=fe;ee++)me.push(l.jsxs("label",{children:[l.jsx("input",{onChange:X=>{g!=null&&g.rowIsRepeatable?Z(p,f,u,X.target.value):le(X)},checked:parseInt(T)===ee,name:"liker-scale"+(u==null?void 0:u.uuid),type:"radio",value:ee}),l.jsx("span",{children:ee})]},`field-${u==null?void 0:u.uuid}-likertScale-${ee} ${parseInt(T)===ee?"scale-selected":""}`));return me},ie=l.jsxs("div",{onMouseOver:O,onMouseOut:L,children:[!x&&!c&&U&&l.jsx(qr,{handleFieldSettingsSidebar:be,...t}),l.jsxs("div",{className:`field ${c?" ":" builder-element-wrapper "}${(u==null?void 0:u.isFluid)===!0?" card py-3 px-4 p-fluid":"card py-3 px-4"}`,children:[l.jsxs("div",{className:"",children:[(u==null?void 0:u.showHeaderText)&&l.jsx("h6",{children:(K=u==null?void 0:u.headerText)==null?void 0:K[s==null?void 0:s.type]}),(u==null?void 0:u.showLabel)&&l.jsxs("label",{htmlFor:d,className:"flex font-medium mb-3 text-700 text-2xl",children:[l.jsx(ea,{...t}),((ne=u==null?void 0:u.attributes)==null?void 0:ne.required)&&l.jsx("span",{className:"must-required mr-1",children:"*"})," ",c?l.jsx(l.Fragment,{children:(ue=u==null?void 0:u.label)==null?void 0:ue[s==null?void 0:s.type]}):l.jsx(Xi,{...t}),l.jsx("span",{className:"ml-3",children:(u==null?void 0:u.showToolTip)&&l.jsx(Fi,{message:(ye=u==null?void 0:u.toolTip)==null?void 0:ye[s==null?void 0:s.type],position:"right"})})]}),l.jsx("div",{className:"flex justify-content-center",children:l.jsxs("div",{className:"mt-4",children:[l.jsxs("div",{className:"flex justify-content-between mb-3",children:[l.jsx("div",{className:"font-medium text-900 ",children:l.jsx(UU,{...t,labelType:"startingMessage"})}),l.jsx("div",{className:"font-medium text-900",children:l.jsx(UU,{...t,labelType:"endingMessage"})})]}),l.jsx("div",{className:"likert",children:Y()})]})}),l.jsx("div",{children:((Ee=u==null?void 0:u.attributes)==null?void 0:Ee.required)&&l.jsx("small",{className:"error",children:I===1&&!T?(Fe=u==null?void 0:u.validationMesssage)==null?void 0:Fe.english:""})}),l.jsx("div",{children:(u==null?void 0:u.showHelperText)&&l.jsx("small",{children:(Te=u==null?void 0:u.helperText)==null?void 0:Te[s==null?void 0:s.type]})})]}),w&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{}),l.jsx(Ii,{...t})]})]})]});return l.jsxs(l.Fragment,{children:[S===!0&&l.jsx(Yi,{visibilty:S,closeSettingFieldSidebar:xe,...t}),l.jsx(xi,{...t,fieldWrap:ie})]})};xw.defaultProps={field:{},isPreview:!1},xw.propTypes={field:At.any,isPreview:At.bool};const ww=t=>{var K,ne,ue,ye,Ee,Fe,Te,me,ee,X,M,W;const{taskRegisterData:e,updateTaskRegisterData:n,updateTaskProgressValue:r,updateUserFormDataSubmit:i,userTaskSubmitFormData:a,task_status:s,TASK_PUBLISHED:o}=si(),{userSelectedLanguage:c,fieldSettingUpdate:u}=xn(),{isPreview:d,field:f,fieldIndex:p,sectionIndex:g,pageIndex:m,row:b,rowIndex:w,columnIndex:x,isAdmin:S,isRenderView:C}=t,[T,A]=k.useState(!1),[I,_]=k.useState(""),[P,q]=k.useState(0),[U,F]=k.useState(!1),[O,L]=k.useState(!1),J=()=>{L(!0)},be=()=>{L(!1)},xe=()=>{var G,he,Ne;if(b!=null&&b.rowIsRepeatable){if(b!=null&&b.repeatableFields){const Se=[...b.repeatableFields],Ae=St.findIndex(Se,function(Ve){return Ve.uuid===(f==null?void 0:f.uuid)});Ae>=0&&Se[Ae].fieldData?_(Se[Ae].fieldData):_("")}}else{const Se=a;if(Se!=null&&Se.length){for(const Ae of Se)if(Ae.fieldId===t.field.uuid&&((G=Ae==null?void 0:Ae.postData[0])==null?void 0:G.postValue)!==""&&((he=Ae==null?void 0:Ae.postData[0])!=null&&he.postValue)){_((Ne=Ae==null?void 0:Ae.postData[0])==null?void 0:Ne.postValue);break}}}F(!0)};k.useEffect(()=>{U||xe();const G=an.addListener("clearRepeatableFields",Ae=>{Ae===(b==null?void 0:b.uuid)&&(_(""),q(0),f.isValid=0,u(m,g,w,x,p,f))}),he=an.addListener("onSubmitUserForm",()=>{var Ae;(Ae=f==null?void 0:f.attributes)!=null&&Ae.required?I?f.isValid=1:f.isValid=0:f.isValid=1}),Ne=an.addListener("OnInvalidFieldCatch",Ae=>{f.uuid===(Ae==null?void 0:Ae.fieldId)?q(1):q(0)}),Se=an.addListener("OnGetFieldValue",Ae=>{var se;const Ve=(se=Ae==null?void 0:Ae.repeatableColumn)==null?void 0:se.filter((pe,z)=>(pe==null?void 0:pe.fieldUuid)===(f==null?void 0:f.uuid));Ve!=null&&Ve.length});return()=>{he.remove(),Ne.remove(),Se.remove(),G.remove()}});const le=G=>{A(G)},Z=()=>{A(!1)},fe=G=>{var Se,Ae;_(G.target.value);const he=a,Ne=St.cloneDeep(e);if(he!==null){if((Se=G==null?void 0:G.target)!=null&&Se.value){if(Ne[f==null?void 0:f.uuid]=(Ae=G==null?void 0:G.target)==null?void 0:Ae.value,(he==null?void 0:he.length)>0)for(const Ve of he)Ve.fieldId===t.field.uuid&&(Ve.postData[0]={postValue:G.target.value})}else if(delete Ne[f==null?void 0:f.uuid],(he==null?void 0:he.length)>0)for(const Ve of he)Ve.fieldId===t.field.uuid&&(Ve.postData[0]={postValue:""})}if(!(b!=null&&b.rowIsRepeatable)){n(Ne);const Ve=Object.keys(Ne).length;r(Ve)}},Y=(G,he)=>{var Ne;if(a){const Se=[...a],Ae=St.findIndex(Se,function(se){return se.rowId===(b==null?void 0:b.uuid)});let Ve=(Ne=a[Ae])==null?void 0:Ne.repeatableFields;Ve={...Ve,[G==null?void 0:G.uuid]:he},Se[Ae]={...Se[Ae],repeatableFields:Ve},i(Se)}_(he),he!==""?G.isValid=1:G.isValid=0},ie=l.jsxs("div",{onMouseOver:J,onMouseOut:be,children:[!C&&!d&&O&&l.jsx(qr,{handleFieldSettingsSidebar:le,...t}),l.jsxs("div",{className:`field ${d?" ":" builder-element-wrapper "}${(f==null?void 0:f.isFluid)===!0?" card py-3 px-4 p-fluid":"card py-3 px-4"}`,children:[l.jsx("div",{className:"grid",children:l.jsxs("div",{className:d?"col-12 ":"col-12 p-fluid",children:[(f==null?void 0:f.showHeaderText)&&l.jsx("h6",{children:(K=f==null?void 0:f.headerText)==null?void 0:K[c==null?void 0:c.type]}),(f==null?void 0:f.showLabel)&&l.jsxs("label",{htmlFor:p,className:"flex font-medium mb-3 text-700 text-2xl",children:[l.jsx(ea,{...t}),((ne=f==null?void 0:f.attributes)==null?void 0:ne.required)&&l.jsx("span",{className:"must-required mr-1",children:"*"})," ",d?l.jsx(l.Fragment,{children:(ue=f==null?void 0:f.label)==null?void 0:ue[c==null?void 0:c.type]}):l.jsx(Xi,{...t}),l.jsx("span",{className:"ml-3",children:(f==null?void 0:f.showToolTip)&&l.jsx(Fi,{message:(ye=f==null?void 0:f.toolTip)==null?void 0:ye[c==null?void 0:c.type],position:"right"})})]}),l.jsxs("div",{className:"mt-3",children:[l.jsxs("span",{className:"p-input-icon-"+(f==null?void 0:f.iconAlignment),children:[(f==null?void 0:f.showIcon)&&l.jsx("i",{className:"pi pi-"+((Fe=(Ee=f==null?void 0:f.icon)==null?void 0:Ee.properties)==null?void 0:Fe.name)}),l.jsx(dn,{id:f==null?void 0:f.uuid,placeholder:(Te=f==null?void 0:f.placeholder)==null?void 0:Te[c==null?void 0:c.type],value:I,onFocus:()=>q(1),onChange:G=>{b!=null&&b.rowIsRepeatable?Y(f,G.target.value):fe(G)},className:P===1&&((me=f==null?void 0:f.attributes)!=null&&me.required)?I?"valid mt-2 mr-2":"invalid mt-2":"valid mt-2",readOnly:s===o})]}),l.jsx("div",{children:((ee=f==null?void 0:f.attributes)==null?void 0:ee.required)&&l.jsx("small",{className:"error",children:P===1&&!I?(X=f==null?void 0:f.validationMesssage)==null?void 0:X.english:""})}),l.jsx("div",{children:(f==null?void 0:f.showHelperText)&&l.jsx("small",{children:(M=f==null?void 0:f.helperText)==null?void 0:M[c==null?void 0:c.type]})})]})]})}),l.jsx("p",{className:"text-center",children:l.jsx("span",{className:`${(W=f==null?void 0:f.fontStyle)==null?void 0:W.font} text-center`,style:{fontSize:f==null?void 0:f.fontSize},children:I})}),S&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{}),l.jsx(Ii,{...t})]})]})]});return l.jsxs(l.Fragment,{children:[T===!0&&l.jsx(Yi,{visibilty:T,closeSettingFieldSidebar:Z,...t}),l.jsx(xi,{...t,fieldWrap:ie})]})};ww.defaultProps={field:{},isPreview:!1},ww.propTypes={field:At.any,isPreview:At.bool};const Sw=t=>{var me,ee,X,M,W,G,he,Ne,Se,Ae,Ve,se,pe,z,te,oe,de;const e=ge=>{const Ie=ge.collapsed?"pi pi-chevron-down":"pi pi-chevron-up",$e=`${ge.className} justify-content-start`,nt=`${ge.titleClassName} pl-1`;return l.jsxs("div",{className:$e,children:[l.jsxs("button",{className:ge.togglerClassName,onClick:ge.onTogglerClick,children:[l.jsx("span",{className:Ie}),l.jsx(In,{})]}),l.jsx("span",{className:nt,children:xe})]})},{globalIsAlignmentRight:n,taskRegisterData:r,updateTaskRegisterData:i,updateTaskProgressValue:a,userTaskSubmitFormData:s,TASK_PUBLISHED:o,task_status:c}=si(),{userSelectedLanguage:u,fieldSettingUpdate:d}=xn(),{isPreview:f,field:p,fieldIndex:g,sectionIndex:m,pageIndex:b,row:w,rowIndex:x,columnIndex:S,isAdmin:C,isRenderView:T}=t,[A,I]=k.useState(!1),[_,P]=k.useState(null),[q,U]=k.useState({country:null,city:null,state:null,addressOne:null,addressTwo:null,zipcode:null,isBillingAddressSame:!1,billingCountry:null,billingCity:null,billingState:null,billingAddressOne:null,billingAddressTwo:null,billingZipcode:null}),[F,O]=k.useState(!1),L=()=>{O(!0)},J=()=>{O(!1)},be=(ge,Ie)=>{let $e={...q};$e={...$e,[ge]:Ie},U($e),($e==null?void 0:$e.addressOne)!==""&&($e!=null&&$e.addressTwo)&&($e!=null&&$e.zipcode)&&Fe($e==null?void 0:$e.zipcode)?(p.isValid=1,ue($e,!0)):(p.isValid=0,ue(null,!1))},[xe]=k.useState((me=p==null?void 0:p.label)==null?void 0:me[u==null?void 0:u.type]),[le,Z]=k.useState(0),[fe,Y]=k.useState(!1),ie=()=>{var ge,Ie;if(!(w!=null&&w.rowIsRepeatable)){const $e=s;if($e!=null&&$e.length){for(const nt of $e)if(nt.fieldId===t.field.uuid&&((ge=nt==null?void 0:nt.postData[0])!=null&&ge.postValue)){U((Ie=nt==null?void 0:nt.postData[0])==null?void 0:Ie.postValue);break}}}Y(!0)};k.useEffect(()=>{fe||ie();const ge=an.addListener("clearRepeatableFields",Nt=>{Nt===(w==null?void 0:w.uuid)&&(Z(0),p.isValid=0,d(b,m,x,S,g,p))}),Ie=an.addListener("onSubmitUserForm",()=>{var Nt;(Nt=p==null?void 0:p.attributes)!=null&&Nt.required?(q==null?void 0:q.addressOne)!==""&&(q==null?void 0:q.zipcode)!==""&&Fe(q==null?void 0:q.zipcode)?p.isValid=1:p.isValid=0:p.isValid=1}),$e=an.addListener("OnInvalidFieldCatch",Nt=>{p.uuid===(Nt==null?void 0:Nt.fieldId)?Z(1):Z(0)}),nt=an.addListener("OnGetFieldValue",Nt=>{var xt;const gt=(xt=Nt==null?void 0:Nt.repeatableColumn)==null?void 0:xt.filter(tt=>(tt==null?void 0:tt.fieldUuid)===(p==null?void 0:p.uuid));gt!=null&&gt.length}),it=an.addListener("formFieldAdded",Nt=>{_===null&&P(Nt==null?void 0:Nt.uuid)});return()=>{Ie.remove(),$e.remove(),nt.remove(),ge.remove(),it.remove()}});const K=ge=>{I(ge)},ne=()=>{I(!1)},ue=(ge,Ie)=>{const $e=s,nt=St.cloneDeep(r);if(Ie){if(nt[p==null?void 0:p.uuid]=ge,($e==null?void 0:$e.length)>0)for(const it of $e)it.fieldId===t.field.uuid&&(it.postData[0]={postValue:ge})}else if(delete nt[p==null?void 0:p.uuid],($e==null?void 0:$e.length)>0)for(const it of $e)it.fieldId===t.field.uuid&&(it.postData[0]={postValue:ge});if(!(w!=null&&w.rowIsRepeatable)){i(nt);const it=Object.keys(nt).length;a(it)}},ye=()=>{let ge="";return f||(ge=ge+" field-form-builder"),c===o&&C===!0&&(ge=ge+" card"),ge},Ee=()=>{let ge=!1;return q.addressOne!==""&&q.zipcode!==""&&Fe(q.zipcode)&&(ge=!0),ge};function Fe(ge){const Ie=/\d/.test(ge),$e=/[a-zA-Z]/.test(ge);return Ie&&$e?!0:!!Ie}k.useEffect(()=>(_!==null&&setTimeout(()=>{P(null)},1e3),()=>{}),[_]);const Te=l.jsxs("div",{onMouseOver:L,onMouseOut:J,children:[!T&&!f&&F&&l.jsx(qr,{handleFieldSettingsSidebar:K,...t}),l.jsxs("div",{className:`field ${f?" ":" builder-element-wrapper "} ${(p==null?void 0:p.isFluid)===!0?" card py-3 px-4 p-fluid":"card p-4"} ${_===(p==null?void 0:p.uuid)?" new-field ":" card "}`,children:[l.jsx("div",{className:"grid",children:l.jsxs("div",{className:f?"col-12 ":"col-11 p-fluid",children:[(p==null?void 0:p.showHeaderText)&&l.jsx("h6",{children:(ee=p==null?void 0:p.headerText)==null?void 0:ee[u==null?void 0:u.type]}),(p==null?void 0:p.showLabel)&&l.jsxs("label",{htmlFor:g,className:"flex font-medium mb-3 text-700 text-2xl",children:[l.jsx(ea,{...t}),((X=p==null?void 0:p.attributes)==null?void 0:X.required)&&l.jsx("span",{className:"must-required mr-1",children:"*"})," ",f?l.jsx(l.Fragment,{children:(M=p==null?void 0:p.label)==null?void 0:M[u==null?void 0:u.type]}):l.jsx(Xi,{...t}),l.jsx("span",{className:"ml-3",children:(p==null?void 0:p.showToolTip)&&l.jsx(Fi,{message:(W=p==null?void 0:p.toolTip)==null?void 0:W[u==null?void 0:u.type],position:"right"})})]}),l.jsxs("div",{className:"mt-3 p-fluid",children:[l.jsx("div",{children:l.jsx("label",{className:"w-full",htmlFor:"",children:(G=p==null?void 0:p.addresslineFirstLabel)==null?void 0:G[u==null?void 0:u.type]})}),l.jsx(dn,{value:q.addressOne||"",onChange:ge=>be("addressOne",ge.target.value),className:"my-2 ",readOnly:c===o}),l.jsx("div",{children:l.jsx("label",{htmlFor:"",children:(he=p==null?void 0:p.addresslineSecondLabel)==null?void 0:he[u==null?void 0:u.type]})}),l.jsx(dn,{value:q.addressTwo||"",onChange:ge=>be("addressTwo",ge.target.value),className:"my-2",readOnly:c===o}),l.jsx("div",{children:l.jsx("label",{htmlFor:"",children:(Ne=p==null?void 0:p.postalcodeLabel)==null?void 0:Ne[u==null?void 0:u.type]})}),l.jsx(dn,{value:q.zipcode||"",onChange:ge=>be("zipcode",ge.target.value),className:"my-2",readOnly:c===o}),l.jsx("p",{children:!Fe(q.zipcode)&&l.jsx("small",{children:"Cannot be alphabetical only."})}),((Se=p==null?void 0:p.attributes)==null?void 0:Se.required)&&!Ee()&&l.jsx("small",{className:"error",children:le===1?(Ae=p==null?void 0:p.validationMesssage)==null?void 0:Ae.english:""}),(p==null?void 0:p.showBillingAddress)===!0&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"field-checkbox",children:[l.jsx(Dr,{inputId:"binary",checked:q.isBillingAddressSame,onChange:ge=>{be("isBillingAddressSame",ge.checked),ge.checked?U(Ie=>({...Ie,billingCountry:q.country,billingCity:q.city,billingState:q.state,billingAddressOne:q.addressOne,billingAddressTwo:q.addressTwo,billingZipcode:q.zipcode})):U(Ie=>({...Ie,billingCountry:null,billingCity:null,billingState:null,billingAddressOne:null,billingAddressTwo:null,billingZipcode:null}))},disabled:c===o}),l.jsx("label",{htmlFor:"binary",children:"Is Billing Address Same"})]}),q.isBillingAddressSame===!1&&l.jsxs(l.Fragment,{children:[(p==null?void 0:p.showLabel)&&l.jsxs("label",{htmlFor:g,className:"flex font-medium mb-3 text-700 text-2xl",children:[((Ve=p==null?void 0:p.attributes)==null?void 0:Ve.required)&&l.jsx("span",{className:"must-required",children:"*"})," ",(se=p==null?void 0:p.billingLabel)==null?void 0:se[u==null?void 0:u.type],l.jsx("span",{className:"ml-3",children:(p==null?void 0:p.showToolTip)&&l.jsx(Fi,{message:(pe=p==null?void 0:p.toolTip)==null?void 0:pe[u==null?void 0:u.type],position:"right"})})]}),l.jsx("label",{htmlFor:"",children:(z=p==null?void 0:p.addresslineFirstLabel)==null?void 0:z[u==null?void 0:u.type]}),l.jsx(dn,{value:q.billingAddressOne||"",onChange:ge=>be("billingAddressOne",ge.target.value),className:"my-2",readOnly:c===o}),l.jsx("label",{htmlFor:"",children:(te=p==null?void 0:p.addresslineSecondLabel)==null?void 0:te[u==null?void 0:u.type]}),l.jsx(dn,{value:q.billingAddressTwo||"",onChange:ge=>be("billingAddressTwo",ge.target.value),className:"my-2",readOnly:c===o}),l.jsx("label",{htmlFor:"",children:(oe=p==null?void 0:p.postalcodeLabel)==null?void 0:oe[u==null?void 0:u.type]}),l.jsx(dn,{value:q.billingZipcode||"",onChange:ge=>be("billingZipcode",ge.target.value),className:"my-2",readOnly:c===o}),!Fe(q.billingZipcode)&&l.jsx("small",{children:"Cannot be alphabetical only."})]})]}),l.jsx("div",{}),l.jsx("div",{children:(p==null?void 0:p.showHelperText)&&l.jsx("small",{children:(de=p==null?void 0:p.helperText)==null?void 0:de[u==null?void 0:u.type]})})]})]})}),C&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{}),l.jsx(Ii,{...t})]})]})]});return l.jsxs(l.Fragment,{children:[A===!0&&l.jsx(Yi,{visibilty:A,closeSettingFieldSidebar:ne,...t}),l.jsx("div",{dir:n?"rtl":"ltr",className:ye(),children:c===o&&C===!0?l.jsx(Pi,{headerTemplate:e,toggleable:!0,children:Te}):Te})]})};Sw.defaultProps={field:{},isPreview:!1},Sw.propTypes={field:At.any,isPreview:At.bool};const yxe=t=>{var x;const{isPreview:e,customColumn:n,indexes:r,customColumnIndex:i,handleDrop:a,path:s,field:o,onSetValuetoPostData:c,emitSocketData:u,fieldIndex:d,sectionIndex:f,pageIndex:p,rowIndex:g,columnIndex:m,isAdvanceView:b}=t,w=(S,C)=>{c(S,C)};return l.jsxs("div",{className:"p-2 py-4",children:[((x=o.children)==null?void 0:x.length)>0&&o.children.map((S,C)=>S[`${r.rowIndex}-${i}`]?l.jsx("div",{children:l.jsx(vg,{type:"grid",showFieldIcons:!1,onChange:w,data:S[`${r.rowIndex}-${i}`],field:S[`${r.rowIndex}-${i}`],path:`${s}-${r.rowIndex}-${i}-${C}`,isPreview:e,emitSocketData:u,sectionIndex:f,pageIndex:p,rowIndex:g,columnIndex:m,fieldIndex:C,fieldContainer:"grid-container"})},`${r.rowIndex}-${i}-${C}`):l.jsx(l.Fragment,{})),e===!1&&l.jsx("div",{className:"py-5",children:l.jsx(Ri,{isAdvanceView:b,fieldDropArea:!0,data:{path:`${s}-${r.rowIndex}-${i}`,childrenCount:1,droppedField:n},onDrop:a})})]})},jU=t=>{var A,I,_,P,q,U,F;const{field:e,isPreview:n,userSelectedLanguage:r,fieldIndex:i,customColumnHeaderTemplate:a,onSetValuetoPostData:s,setAllFields:o,allFields:c,actionHeaderTemplate:u,actionBodyTemplate:d,isFocus:f,inputValue:p,handleFieldSettingsSidebar:g,isAdmin:m,emitSocketData:b,isRenderView:w}=t,[x,S]=k.useState(!1),C=()=>{S(!0)},T=()=>{S(!1)};return l.jsxs("div",{onMouseOver:C,onMouseOut:T,children:[!w&&!n&&x&&l.jsx(qr,{handleFieldSettingsSidebar:g,...t}),l.jsxs("div",{className:`field ${n?" ":" builder-element-wrapper "}${(e==null?void 0:e.isFluid)===!0?" card py-3 px-4 ":"card py-3 px-4"}`,children:[l.jsx("div",{className:"grid",children:l.jsxs("div",{className:"col-12 ",children:[(e==null?void 0:e.showHeaderText)&&l.jsx("h6",{children:(A=e==null?void 0:e.headerText)==null?void 0:A[r==null?void 0:r.type]}),(e==null?void 0:e.showLabel)&&l.jsxs("label",{htmlFor:i,className:"flex font-medium mb-3 text-700 text-2xl",children:[l.jsx(ea,{...t}),((I=e==null?void 0:e.attributes)==null?void 0:I.required)&&l.jsx("span",{className:"must-required mr-1",children:"*"})," ",n?l.jsx(l.Fragment,{children:(_=e==null?void 0:e.label)==null?void 0:_[r==null?void 0:r.type]}):l.jsx(Xi,{...t}),l.jsx("span",{className:"ml-3",children:(e==null?void 0:e.showToolTip)&&l.jsx(Fi,{message:(P=e==null?void 0:e.toolTip)==null?void 0:P[r==null?void 0:r.type],position:"right"})})]}),l.jsxs("div",{className:"mt-3",children:[l.jsxs($o,{scrollable:!0,showGridlines:!0,columnResizeMode:"expand",resizableColumns:!0,value:e==null?void 0:e.options,tableStyle:{minWidth:"50rem"},children:[e==null?void 0:e.customColumnsForOptions.map((O,L)=>l.jsx(Ar,{style:{minWidth:350},header:a(O,L),body:(J,be)=>l.jsx(yxe,{customColumn:O,e:J,indexes:be,customColumnIndex:L,onSetValuetoPostData:s,setAllFields:o,allFields:c,emitSocketData:b,field:e,...t})},O==null?void 0:O.uuid)),!n&&l.jsx(Ar,{frozen:!0,header:O=>u(O),body:(O,L)=>d(O,L),headerStyle:{textAlign:"left"},bodyStyle:{textAlign:"left",overflow:"visible"}})]}),l.jsx("div",{children:((q=e==null?void 0:e.attributes)==null?void 0:q.required)&&l.jsx("small",{className:"error",children:f===1&&!p?(U=e==null?void 0:e.validationMesssage)==null?void 0:U.english:""})}),l.jsx("div",{children:(e==null?void 0:e.showHelperText)&&l.jsx("small",{children:(F=e==null?void 0:e.helperText)==null?void 0:F[r==null?void 0:r.type]})})]})]})}),m&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{}),l.jsx(Ii,{...t})]})]})]})},lv=t=>{var me;const e=ee=>{const X=ee.collapsed?"pi pi-chevron-down":"pi pi-chevron-up",M=`${ee.className} justify-content-start`,W=`${ee.titleClassName} pl-1`;return l.jsxs("div",{className:M,children:[l.jsxs("button",{className:ee.togglerClassName,onClick:ee.onTogglerClick,children:[l.jsx("span",{className:X}),l.jsx(In,{})]}),l.jsx("span",{className:W,children:T})]})},{userTaskSubmitFormData:n,TASK_PUBLISHED:r,task_status:i}=si(),{userSelectedLanguage:a,fieldSettingUpdate:s}=xn(),{isPreview:o,field:c,fieldIndex:u,sectionIndex:d,pageIndex:f,row:p,rowIndex:g,columnIndex:m,isAdmin:b}=t,[w,x]=k.useState(!1),[S,C]=k.useState(""),[T]=k.useState((me=c==null?void 0:c.label)==null?void 0:me[a==null?void 0:a.type]),[A,I]=k.useState(0),[_,P]=k.useState(!1),[q,U]=k.useState(null),[F,O]=k.useState([]),L=()=>{var ee,X,M;if(p!=null&&p.rowIsRepeatable){if(p!=null&&p.repeatableFields){const W=[...p.repeatableFields],G=St.findIndex(W,function(he){return he.uuid===(c==null?void 0:c.uuid)});G>=0&&W[G].fieldData?C(W[G].fieldData):C("")}}else{const W=n;if(W!=null&&W.length){for(const G of W)if(G.fieldId===t.field.uuid&&((ee=G==null?void 0:G.postData[0])==null?void 0:ee.postValue)!==""&&((X=G==null?void 0:G.postData[0])!=null&&X.postValue)){C((M=G==null?void 0:G.postData[0])==null?void 0:M.postValue);break}}}P(!0)},J=()=>{const ee=c;ee.customColumnsForOptions=[...ee.customColumnsForOptions,{customKey:"Column",uuid:Ze()}],Te(ee)},[be,xe]=k.useState(!1),le=(ee,X)=>{var M;return l.jsxs(l.Fragment,{children:[((M=c==null?void 0:c.options)==null?void 0:M.length)>1&&l.jsx(Rt,{text:!0,type:"button",className:"p-button-danger left-space ",icon:"pi pi-trash",onClick:()=>Y(ee==null?void 0:ee.uuid,X==null?void 0:X.rowIndex),rounded:!0,severity:"secondary","aria-label":"Bookmark",size:"small"}),l.jsx(Rt,{text:!0,type:"button",icon:"pi pi-plus",rounded:!0,severity:"secondary",onClick:()=>Ee(),"aria-label":"Add Row",size:"small"})]})},Z=(ee,X)=>{var M;return l.jsxs(l.Fragment,{children:[ee==null?void 0:ee.customKey,o===!1&&l.jsxs(l.Fragment,{children:[((M=c==null?void 0:c.customColumnsForOptions)==null?void 0:M.length)>1&&l.jsx("i",{className:"pi pi-trash ml-3",onClick:()=>ie(ee==null?void 0:ee.uuid,X)}),l.jsx("i",{className:"pi pi-cog ml-3",onClick:()=>{U(ee),xe(!0)}})]})]})},fe=ee=>l.jsx(l.Fragment,{children:l.jsx(Rt,{text:!0,icon:"pi pi-plus",onClick:()=>J(),rounded:!0,severity:"secondary","aria-label":"Cancel"})}),Y=(ee,X)=>{var Ne,Se;const M=(Ne=c==null?void 0:c.customColumnsForOptions)==null?void 0:Ne.length,W=[...(c==null?void 0:c.children)||[]];(Se=c==null?void 0:c.children)==null||Se.map(Ae=>{for(let Ve=0;Ve<M;Ve++)if(Ae[`${X}-${Ve}`]!==void 0){const se=St.findIndex(W,function(pe){return pe[`${X}-${Ve}`]!==void 0});W.splice(se,1)}});for(let Ae=0;Ae<(W==null?void 0:W.length);Ae++){const Ve=W[Ae],pe=Object.keys(Ve)[0].split("-");parseInt(pe[0])>X&&(W[Ae]={[`${parseInt(pe[0])-1}-${pe[1]}`]:W[Ae][`${parseInt(pe[0])}-${pe[1]}`]})}const G=c==null?void 0:c.options.filter(function(Ae){return(Ae==null?void 0:Ae.uuid)!==ee}),he={...c,children:[...W]};he.options=G,Te(he)},ie=(ee,X)=>{var Se,Ae;const M=St.findIndex(c==null?void 0:c.customColumnsForOptions,Ve=>Ve.uuid===ee),W=c==null?void 0:c.customColumnsForOptions.filter(function(Ve,se){return se!==M}),G=(Se=c==null?void 0:c.options)==null?void 0:Se.length,he=[...(c==null?void 0:c.children)||[]];(Ae=c==null?void 0:c.children)==null||Ae.map(Ve=>{for(let se=0;se<G;se++)if(Ve[`${se}-${X}`]!==void 0){const pe=St.findIndex(he,function(z){return z[`${se}-${X}`]!==void 0});he.splice(pe,1)}});for(let Ve=0;Ve<(he==null?void 0:he.length);Ve++){const se=he[Ve],z=Object.keys(se)[0].split("-");parseInt(z[1])>X&&(he[Ve]={[`${parseInt(z[0])}-${parseInt(z[1])-1}`]:he[Ve][`${parseInt(z[0])}-${z[1]}`]})}const Ne={...c,children:[...he]};Ne.customColumnsForOptions=W,Te(Ne)};k.useEffect(()=>{_||L();const ee=an.addListener("clearRepeatableFields",G=>{G===(p==null?void 0:p.uuid)&&(C(""),I(0),c.isValid=0,s(f,d,g,m,u,c))}),X=an.addListener("onSubmitUserForm",()=>{var G;(G=c==null?void 0:c.attributes)!=null&&G.required&&(c.isValid=1)}),M=an.addListener("OnInvalidFieldCatch",G=>{c.uuid===(G==null?void 0:G.fieldId)?I(1):I(0)}),W=an.addListener("OnGetFieldValue",G=>{var Ne;const he=(Ne=G==null?void 0:G.repeatableColumn)==null?void 0:Ne.filter((Se,Ae)=>(Se==null?void 0:Se.fieldUuid)===(c==null?void 0:c.uuid));he!=null&&he.length});return()=>{X.remove(),M.remove(),W.remove(),ee.remove()}});const K=ee=>{x(ee)},ne=()=>{x(!1)},ue=(ee,X)=>{var W;const M=n;if((M==null?void 0:M.length)>0)for(const G of M)G.fieldId===t.field.uuid&&(G.postData[0]={postValue:{...(W=G.postData[0])==null?void 0:W.postValue,[ee]:X}})},ye=()=>{let ee="";return o||(ee=ee+" field-form-builder"),i===r&&b===!0&&(ee=ee+" card"),ee},Ee=()=>{const ee=c;ee.options=[...ee.options,{uuid:Ze(),custom_values:{}}],Te(ee)},Fe=(ee,X)=>{U(he=>({...he,customKey:X}));const M=c.customColumnsForOptions,W=M.findIndex(he=>he.uuid===ee.uuid);M[W]={...M[W],customKey:X};const G=c;G.customColumnsForOptions=M,Te(G)},Te=ee=>{s(f,d,g,m,u,ee)};return l.jsxs(l.Fragment,{children:[l.jsx(Ms,{maximizable:!0,header:"Update Column Title",visible:be,style:{width:"20vw"},footer:()=>l.jsx(Rt,{text:!0,label:"Save",onClick:()=>xe(!1)}),onHide:()=>xe(!1),children:l.jsx("div",{className:"p-fluid",children:l.jsx(dn,{value:(q==null?void 0:q.customKey)||"",onChange:ee=>Fe(q,ee.target.value)})})}),l.jsx(Yi,{visibilty:w,closeSettingFieldSidebar:ne,...t}),l.jsx("div",{dir:"rtl",className:ye(),children:i===r&&b===!0?l.jsx(Pi,{headerTemplate:e,toggleable:!0,children:l.jsx(jU,{...t,field:c,isPreview:o,userSelectedLanguage:a,fieldIndex:u,customColumnHeaderTemplate:Z,onSetValuetoPostData:ue,setAllFields:O,allFields:F,actionHeaderTemplate:fe,actionBodyTemplate:le,addOption:Ee,isFocus:A,inputValue:S,handleFieldSettingsSidebar:K,isAdmin:b})}):l.jsx(jU,{...t,field:c,isPreview:o,userSelectedLanguage:a,fieldIndex:u,customColumnHeaderTemplate:Z,onSetValuetoPostData:ue,setAllFields:O,allFields:F,actionHeaderTemplate:fe,actionBodyTemplate:le,addOption:Ee,isFocus:A,inputValue:S,handleFieldSettingsSidebar:K,isAdmin:b})})]})};lv.defaultProps={field:{},isPreview:!1},lv.propTypes={field:At.any,isPreview:At.bool};const Axe=t=>{const{customColumn:e,e:n,indexes:r,customColumnIndex:i,setAllFields:a,allFields:s}=t,o=c=>{const u={...s};u[`${r==null?void 0:r.rowIndex}-${i}`]=c,a(u)};return l.jsx("div",{children:l.jsx(ga,{value:s[`${r==null?void 0:r.rowIndex}-${i}`],options:e.options,onChange:c=>o(c.value),optionLabel:"label",placeholder:"Select"})})},zU=t=>{var T,A,I,_,P,q,U;const{field:e,isPreview:n,userSelectedLanguage:r,fieldIndex:i,customColumnHeaderTemplate:a,customColumnRowBodyTemplate:s,setAllFields:o,allFields:c,actionHeaderTemplate:u,actionBodyTemplate:d,isFocus:f,inputValue:p,handleFieldSettingsSidebar:g,isAdmin:m,isRenderView:b}=t,[w,x]=k.useState(!1),S=()=>{x(!0)},C=()=>{x(!1)};return l.jsxs("div",{onMouseOver:S,onMouseOut:C,children:[!b&&!n&&w&&l.jsx(qr,{handleFieldSettingsSidebar:g,...t}),l.jsxs("div",{className:`field ${n?" ":" builder-element-wrapper "}${(e==null?void 0:e.isFluid)===!0?" card py-3 px-4 p-fluid":"card py-3 px-4"}`,children:[l.jsx("div",{className:"grid",children:l.jsxs("div",{className:n?"col-12 ":"col-11 p-fluid",children:[(e==null?void 0:e.showHeaderText)&&l.jsx("h6",{children:(T=e==null?void 0:e.headerText)==null?void 0:T[r==null?void 0:r.type]}),(e==null?void 0:e.showLabel)&&l.jsxs("label",{htmlFor:i,className:"flex font-medium mb-3 text-700 text-2xl",children:[l.jsx(ea,{...t}),((A=e==null?void 0:e.attributes)==null?void 0:A.required)&&l.jsx("span",{className:"must-required",children:"*"})," ",n?l.jsx(l.Fragment,{children:(I=e==null?void 0:e.label)==null?void 0:I[r==null?void 0:r.type]}):l.jsx(Xi,{...t}),l.jsx("span",{className:"ml-3",children:(e==null?void 0:e.showToolTip)&&l.jsx(Fi,{message:(_=e==null?void 0:e.toolTip)==null?void 0:_[r==null?void 0:r.type],position:"right"})})]}),l.jsxs("div",{className:"mt-3",children:[l.jsxs($o,{showGridlines:!0,value:e==null?void 0:e.rows,children:[l.jsx(Ar,{frozen:!0,header:"",headerStyle:{textAlign:"left"},bodyStyle:{textAlign:"left",overflow:"visible"},body:F=>s(F)}),e==null?void 0:e.customColumns.map((F,O)=>l.jsx(Ar,{header:a(F),headerStyle:{textAlign:"left"},bodyStyle:{textAlign:"left",overflow:"visible"},body:(L,J)=>l.jsx(Axe,{customColumn:F,e:L,indexes:J,customColumnIndex:O,setAllFields:o,allFields:c,field:e,...t})},F==null?void 0:F.uuid)),n===!1&&l.jsx(Ar,{frozen:!0,header:F=>u(F),body:F=>d(F),headerStyle:{textAlign:"left"},bodyStyle:{textAlign:"left",overflow:"visible"}})]}),l.jsx("div",{children:((P=e==null?void 0:e.attributes)==null?void 0:P.required)&&l.jsx("small",{className:"error",children:f===1&&!p?(q=e==null?void 0:e.validationMesssage)==null?void 0:q.english:""})}),l.jsx("div",{children:(e==null?void 0:e.showHelperText)&&l.jsx("small",{children:(U=e==null?void 0:e.helperText)==null?void 0:U[r==null?void 0:r.type]})})]})]})}),m&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{}),l.jsx(Ii,{...t})]})]})]})},Cw=(t,e)=>{var Ae,Ve;const n=se=>{const pe=se.collapsed?"pi pi-chevron-down":"pi pi-chevron-up",z=`${se.className} justify-content-start`,te=`${se.titleClassName} pl-1`;return l.jsxs("div",{className:z,children:[l.jsxs("button",{className:se.togglerClassName,onClick:se.onTogglerClick,children:[l.jsx("span",{className:pe}),l.jsx(In,{})]}),l.jsx("span",{className:te,children:A})]})},{userTaskSubmitFormData:r,TASK_PUBLISHED:i,task_status:a}=si(),{userSelectedLanguage:s,fieldSettingUpdate:o}=xn(),{isPreview:c,field:u,fieldIndex:d,sectionIndex:f,pageIndex:p,row:g,rowIndex:m,columnIndex:b,isAdmin:w}=t,[x,S]=k.useState(!1),[C,T]=k.useState(""),[A]=k.useState((Ae=u==null?void 0:u.label)==null?void 0:Ae[s==null?void 0:s.type]),[I,_]=k.useState(0),[P,q]=k.useState(!1),[U,F]=k.useState(null),[O,L]=k.useState(null),[J,be]=k.useState({}),xe=()=>{var se,pe,z;if(g!=null&&g.rowIsRepeatable){if(g!=null&&g.repeatableFields){const te=[...g.repeatableFields],oe=St.findIndex(te,function(de){return de.uuid===(u==null?void 0:u.uuid)});oe>=0&&te[oe].fieldData?T(te[oe].fieldData):T("")}}else{const te=r;if(te!=null&&te.length){for(const oe of te)if(oe.fieldId===t.field.uuid&&((se=oe==null?void 0:oe.postData[0])==null?void 0:se.postValue)!==""&&((pe=oe==null?void 0:oe.postData[0])!=null&&pe.postValue)){T((z=oe==null?void 0:oe.postData[0])==null?void 0:z.postValue);break}}}q(!0)},le=()=>{const se=u;se.customColumns=[...se.customColumns,{customKey:"Column",uuid:Ze(),options:[]}],G(se)},[Z,fe]=k.useState(!1),[Y,ie]=k.useState(!1),K=se=>{var pe;return l.jsxs(l.Fragment,{children:[((pe=u==null?void 0:u.options)==null?void 0:pe.length)>1&&l.jsx(Rt,{text:!0,type:"button",icon:"pi pi-trash",rounded:!0,severity:"secondary",onClick:()=>Ee(se==null?void 0:se.uuid),"aria-label":"Add Row"}),l.jsx(Rt,{text:!0,type:"button",icon:"pi pi-plus",rounded:!0,severity:"secondary",onClick:()=>X(),"aria-label":"Add Row"})]})},ne=se=>{var pe;return l.jsxs(l.Fragment,{children:[se==null?void 0:se.customKey,c===!1&&l.jsxs(l.Fragment,{children:[((pe=u==null?void 0:u.customColumns)==null?void 0:pe.length)>1&&l.jsx("i",{className:"pi pi-trash ml-3",onClick:()=>Fe(se==null?void 0:se.uuid)}),l.jsx("i",{className:"pi pi-cog ml-3",onClick:()=>{F(se),fe(!0)}})]})]})},ue=()=>l.jsx(l.Fragment,{children:l.jsx(Rt,{text:!0,type:"button",icon:"pi pi-plus",rounded:!0,severity:"secondary",onClick:se=>le(),"aria-label":"Add Column"})}),ye=se=>l.jsxs(l.Fragment,{children:[se==null?void 0:se.rowHeading,c===!1&&l.jsx(l.Fragment,{children:l.jsx("i",{className:"pi pi-cog ml-3",onClick:()=>{L(se),ie(!0)}})})]}),Ee=se=>{const pe=u==null?void 0:u.rows.filter(function(te,oe,de){return(te==null?void 0:te.uuid)!==se}),z=u;z.rows=pe,G(z)},Fe=se=>{const pe=St.findIndex(u==null?void 0:u.customColumns,oe=>oe.uuid===se),z=u==null?void 0:u.customColumns.filter(function(oe,de){return de!==pe}),te=u;te.customColumns=z,G(te)};k.useEffect(()=>{P||xe();const se=an.addListener("clearRepeatableFields",te=>{te===(g==null?void 0:g.uuid)&&(T(""),_(0),u.isValid=0,o(p,f,m,b,d,u))}),pe=an.addListener("OnInvalidFieldCatch",te=>{u.uuid===(te==null?void 0:te.fieldId)?_(1):_(0)}),z=an.addListener("OnGetFieldValue",te=>{var de;const oe=(de=te==null?void 0:te.repeatableColumn)==null?void 0:de.filter((ge,Ie)=>(ge==null?void 0:ge.fieldUuid)===(u==null?void 0:u.uuid));oe!=null&&oe.length});return()=>{pe.remove(),z.remove(),se.remove()}});const Te=se=>{S(se)},me=()=>{S(!1)},ee=()=>{let se="";return c||(se=se+" field-form-builder"),a===i&&w===!0&&(se=se+" card"),se},X=()=>{const se=u;se.rows=[...se.rows,{rowHeading:"Row",uuid:Ze(),custom_values:{}}],G(se)},M=(se,pe)=>{F(de=>({...de,customKey:pe}));const z=u.customColumns,te=z.findIndex(de=>de.uuid===se.uuid);z[te]={...z[te],customKey:pe};const oe=u;oe.customColumns=z,G(oe)},W=(se,pe)=>{L(de=>({...de,rowHeading:pe}));const z=u.rows,te=z.findIndex(de=>de.uuid===se.uuid);z[te]={...z[te],rowHeading:pe};const oe=u;oe.rows=z,G(oe)},G=se=>{o(p,f,m,b,d,se)};function he(se){return se.toLowerCase().replace(/ /g,"-").replace(/[^\w-]+/g,"")}const Ne=(se,pe,z,te)=>{const oe=u.customColumns,de=oe.findIndex(Ie=>Ie.uuid===U.uuid);oe[de].options[z][pe]=se,oe[de].options[z].value=he(se);const ge=u;ge.customColumns=oe,G(ge)},Se=()=>{const se=u.customColumns,pe=se.findIndex(te=>te.uuid===U.uuid);se[pe].options.push({label:"",value:"",uuid:Ze()});const z=u;z.customColumns=se,G(z)};return l.jsxs(l.Fragment,{children:[l.jsxs(Ms,{maximizable:!0,header:"Update Column Title",visible:Z,style:{width:"20vw"},footer:()=>l.jsxs(l.Fragment,{children:[" ",l.jsx(Rt,{text:!0,label:"Add Option",icon:"pi pi-plus",onClick:()=>Se()}),l.jsx(Rt,{text:!0,label:"Save",onClick:()=>fe(!1)})]}),onHide:()=>fe(!1),children:[l.jsx("div",{className:"p-fluid",children:l.jsx(dn,{value:(U==null?void 0:U.customKey)||"",onChange:se=>M(U,se.target.value)})}),l.jsx("hr",{}),l.jsx("h5",{children:"Options"}),((Ve=U==null?void 0:U.options)==null?void 0:Ve.length)>0&&(U==null?void 0:U.options.map((se,pe)=>l.jsxs("div",{className:"my-2 flex p-fluid",children:[l.jsx("span",{children:pe+1}),l.jsx(dn,{value:(se==null?void 0:se.label)||"",className:"ml-2",onChange:z=>Ne(z.target.value,"label",pe,se==null?void 0:se.uuid)})]},`custom_column_option_${pe}`)))]}),l.jsx(Ms,{maximizable:!0,header:"Update Row Title",visible:Y,style:{width:"20vw"},footer:()=>l.jsx(Rt,{text:!0,label:"Save",onClick:()=>ie(!1)}),onHide:()=>ie(!1),children:l.jsx("div",{className:"p-fluid",children:l.jsx(dn,{value:(O==null?void 0:O.rowHeading)||"",onChange:se=>W(O,se.target.value)})})}),l.jsx(Yi,{visibilty:x,closeSettingFieldSidebar:me,...t}),l.jsx("div",{dir:"rtl",className:ee(),children:a===i&&w===!0?l.jsx(Pi,{headerTemplate:n,toggleable:!0,children:l.jsx(zU,{ref:e,...t,field:u,isPreview:c,userSelectedLanguage:s,fieldIndex:d,customColumnHeaderTemplate:ne,customColumnRowBodyTemplate:ye,setAllFields:be,allFields:J,actionHeaderTemplate:ue,actionBodyTemplate:K,isFocus:I,inputValue:C,handleFieldSettingsSidebar:Te,isAdmin:w})}):l.jsx(zU,{ref:e,...t,field:u,isPreview:c,userSelectedLanguage:s,fieldIndex:d,customColumnHeaderTemplate:ne,customColumnRowBodyTemplate:ye,setAllFields:be,allFields:J,actionHeaderTemplate:ue,actionBodyTemplate:K,isFocus:I,inputValue:C,handleFieldSettingsSidebar:Te,isAdmin:w})})]})};Cw.defaultProps={field:{},isPreview:!1},Cw.propTypes={field:At.any,isPreview:At.bool};const xxe=t=>{const{customColumn:e,indexes:n,customColumnIndex:r,setAllFields:i,allFields:a}=t;return l.jsx("div",{children:l.jsx(dn,{value:a[`${n==null?void 0:n.rowIndex}-${r}`]})})},HU=t=>{var m,b,w,x,S,C,T;const{field:e,isPreview:n,userSelectedLanguage:r,fieldIndex:i,customColumnHeaderTemplate:a,setAllFields:s,allFields:o,actionHeaderTemplate:c,actionBodyTemplate:u,isFocus:d,inputValue:f,handleFieldSettingsSidebar:p,isAdmin:g}=t;return l.jsxs("div",{className:`field ${n?" ":" builder-element-wrapper "}${(e==null?void 0:e.isFluid)===!0?" card p-fluid py-6 px-4":"card py-3 px-4"}`,children:[" ",l.jsx("div",{className:"grid",children:l.jsxs("div",{className:"col-12 p-fluid",children:[(e==null?void 0:e.showHeaderText)&&l.jsx("h6",{children:(m=e==null?void 0:e.headerText)==null?void 0:m[r==null?void 0:r.type]}),(e==null?void 0:e.showLabel)&&l.jsxs("label",{htmlFor:i,className:"flex font-medium mb-3 text-700 text-2xl",children:[l.jsx(ea,{...t}),((b=e==null?void 0:e.attributes)==null?void 0:b.required)&&l.jsx("span",{className:"must-required",children:"*"})," ",n?l.jsx(l.Fragment,{children:(w=e==null?void 0:e.label)==null?void 0:w[r==null?void 0:r.type]}):l.jsx(Xi,{...t}),l.jsx("span",{className:"ml-3",children:(e==null?void 0:e.showToolTip)&&l.jsx(Fi,{message:(x=e==null?void 0:e.toolTip)==null?void 0:x[r==null?void 0:r.type],position:"right"})})]}),l.jsxs("div",{className:"mt-3",style:{backgroundColor:"#0a061a"},children:[l.jsxs($o,{scrollable:!0,showGridlines:!0,value:e==null?void 0:e.rows,children:[e==null?void 0:e.customColumns.map((A,I)=>l.jsx(Ar,{header:a(A),headerStyle:{textAlign:"left"},bodyStyle:{textAlign:"left",overflow:"visible"},body:(_,P)=>l.jsx(xxe,{customColumn:A,e:_,indexes:P,customColumnIndex:I,setAllFields:s,allFields:o,field:e,...t})},A==null?void 0:A.uuid)),n===!1&&l.jsx(Ar,{frozen:!0,header:A=>c(A),body:A=>u(A),headerStyle:{textAlign:"left"},bodyStyle:{textAlign:"left",overflow:"visible"}})]}),l.jsx("div",{children:((S=e==null?void 0:e.attributes)==null?void 0:S.required)&&l.jsx("small",{className:"error",children:d===1&&!f?(C=e==null?void 0:e.validationMesssage)==null?void 0:C.english:""})}),l.jsx("div",{children:(e==null?void 0:e.showHelperText)&&l.jsx("small",{children:(T=e==null?void 0:e.helperText)==null?void 0:T[r==null?void 0:r.type]})})]})]})}),g&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{}),l.jsx(Ii,{...t})]})]})},Tw=t=>{var Ve;const e=se=>{const pe=se.collapsed?"pi pi-chevron-down":"pi pi-chevron-up",z=`${se.className} justify-content-start`,te=`${se.titleClassName} pl-1`;return l.jsxs("div",{className:z,children:[l.jsxs("button",{className:se.togglerClassName,onClick:se.onTogglerClick,children:[l.jsx("span",{className:pe}),l.jsx(In,{})]}),l.jsx("span",{className:te,children:A})]})},{userTaskSubmitFormData:n,TASK_PUBLISHED:r,task_status:i}=si(),{userSelectedLanguage:a,fieldSettingUpdate:s}=xn(),{isPreview:o,field:c,fieldIndex:u,sectionIndex:d,pageIndex:f,row:p,rowIndex:g,columnIndex:m,isAdmin:b,isRenderView:w}=t,[x,S]=k.useState(!1),[C,T]=k.useState(""),[A]=k.useState((Ve=c==null?void 0:c.label)==null?void 0:Ve[a==null?void 0:a.type]),[I,_]=k.useState(0),[P,q]=k.useState(!1),[U,F]=k.useState(null),[O,L]=k.useState(null),[J,be]=k.useState({}),[xe,le]=k.useState(!1),Z=()=>{var se,pe,z;if(p!=null&&p.rowIsRepeatable){if(p!=null&&p.repeatableFields){const te=[...p.repeatableFields],oe=St.findIndex(te,function(de){return de.uuid===(c==null?void 0:c.uuid)});oe>=0&&te[oe].fieldData?T(te[oe].fieldData):T("")}}else{const te=n;if(te!=null&&te.length){for(const oe of te)if(oe.fieldId===t.field.uuid&&((se=oe==null?void 0:oe.postData[0])==null?void 0:se.postValue)!==""&&((pe=oe==null?void 0:oe.postData[0])!=null&&pe.postValue)){T((z=oe==null?void 0:oe.postData[0])==null?void 0:z.postValue);break}}}q(!0)},fe=()=>{const se=c;se.customColumns=[...se.customColumns,{customKey:"Column",uuid:Ze(),options:[]}],Ne(se)},[Y,ie]=k.useState(!1),[K,ne]=k.useState(!1),ue=se=>{var pe;return l.jsxs(l.Fragment,{children:[((pe=c==null?void 0:c.options)==null?void 0:pe.length)>1&&l.jsx(Rt,{text:!0,type:"button",icon:"pi pi-trash",rounded:!0,severity:"secondary",onClick:()=>Te(se==null?void 0:se.uuid),"aria-label":"Add Row",size:"small"}),l.jsx(Rt,{text:!0,type:"button",icon:"pi pi-plus",rounded:!0,severity:"secondary",onClick:()=>W(),"aria-label":"Add Row",size:"small"})]})},ye=se=>{var pe;return l.jsxs(l.Fragment,{children:[se==null?void 0:se.customKey,o===!1&&l.jsxs(l.Fragment,{children:[((pe=c==null?void 0:c.customColumns)==null?void 0:pe.length)>1&&l.jsx("i",{className:"pi pi-trash ml-3",onClick:()=>me(se==null?void 0:se.uuid)}),l.jsx("i",{className:"pi pi-cog ml-3",onClick:()=>{F(se),ie(!0)}})]})]})},Ee=()=>l.jsx(l.Fragment,{children:l.jsx(Rt,{text:!0,type:"button",icon:"pi pi-plus",rounded:!0,severity:"secondary",onClick:()=>fe(),"aria-label":"Add Column"})}),Fe=se=>l.jsxs(l.Fragment,{children:[se==null?void 0:se.rowHeading,o===!1&&l.jsx(l.Fragment,{children:l.jsx("i",{className:"pi pi-cog ml-3",onClick:()=>{L(se),ne(!0)}})})]}),Te=se=>{const pe=c==null?void 0:c.rows.filter(function(te){return(te==null?void 0:te.uuid)!==se}),z=c;z.rows=pe,Ne(z)},me=se=>{const pe=St.findIndex(c==null?void 0:c.customColumns,oe=>oe.uuid===se),z=c==null?void 0:c.customColumns.filter(function(oe,de){return de!==pe}),te=c;te.customColumns=z,Ne(te)};k.useEffect(()=>{P||Z();const se=an.addListener("clearRepeatableFields",oe=>{oe===(p==null?void 0:p.uuid)&&(T(""),_(0),c.isValid=0,s(f,d,g,m,u,c))}),pe=an.addListener("onSubmitUserForm",()=>{}),z=an.addListener("OnInvalidFieldCatch",oe=>{c.uuid===(oe==null?void 0:oe.fieldId)?_(1):_(0)}),te=an.addListener("OnGetFieldValue",oe=>{var ge;const de=(ge=oe==null?void 0:oe.repeatableColumn)==null?void 0:ge.filter(Ie=>(Ie==null?void 0:Ie.fieldUuid)===(c==null?void 0:c.uuid));de!=null&&de.length});return()=>{pe.remove(),z.remove(),te.remove(),se.remove()}});const ee=se=>{S(se)},X=()=>{S(!1)},M=()=>{let se="";return o||(se=se+" field-form-builder"),i===r&&b===!0&&(se=se+" card"),se},W=()=>{const se=c;se.rows=[...se.rows,{rowHeading:"Row",uuid:Ze(),custom_values:{}}],Ne(se)},G=(se,pe)=>{F(de=>({...de,customKey:pe}));const z=c.customColumns,te=z.findIndex(de=>de.uuid===se.uuid);z[te]={...z[te],customKey:pe};const oe=c;oe.customColumns=z,Ne(oe)},he=(se,pe)=>{L(de=>({...de,rowHeading:pe}));const z=c.rows,te=z.findIndex(de=>de.uuid===se.uuid);z[te]={...z[te],rowHeading:pe};const oe=c;oe.rows=z,Ne(oe)},Ne=se=>{s(f,d,g,m,u,se)},Se=()=>{le(!0)},Ae=()=>{le(!1)};return l.jsxs(l.Fragment,{children:[l.jsx(Ms,{maximizable:!0,header:"Update Column Title",visible:Y,style:{width:"20vw"},footer:()=>l.jsx(l.Fragment,{children:l.jsx(Rt,{text:!0,label:"Save",onClick:()=>ie(!1)})}),onHide:()=>ie(!1),children:l.jsx("div",{className:"p-fluid",children:l.jsx(dn,{value:(U==null?void 0:U.customKey)||"",onChange:se=>G(U,se.target.value)})})}),l.jsx(Ms,{maximizable:!0,header:"Update Row Title",visible:K,style:{width:"20vw"},footer:()=>l.jsx(Rt,{text:!0,label:"Save",onClick:()=>ne(!1)}),onHide:()=>ne(!1),children:l.jsx("div",{className:"p-fluid",children:l.jsx(dn,{value:(O==null?void 0:O.rowHeading)||"",onChange:se=>he(O,se.target.value)})})}),l.jsx(Yi,{visibilty:x,closeSettingFieldSidebar:X,...t}),l.jsx("div",{className:"field-form-builder",children:l.jsxs("div",{onMouseOver:Se,onMouseOut:Ae,children:[!w&&!o&&xe&&l.jsx(qr,{handleFieldSettingsSidebar:ee,...t}),l.jsx("div",{dir:"rtl",className:M(),children:i===r&&b===!0?l.jsx(Pi,{headerTemplate:e,toggleable:!0,children:l.jsx(HU,{...t,field:c,isPreview:o,userSelectedLanguage:a,fieldIndex:u,customColumnHeaderTemplate:ye,customColumnRowBodyTemplate:Fe,setAllFields:be,allFields:J,actionHeaderTemplate:Ee,actionBodyTemplate:ue,isFocus:I,inputValue:C,handleFieldSettingsSidebar:ee,isAdmin:b})}):l.jsx(HU,{...t,field:c,isPreview:o,userSelectedLanguage:a,fieldIndex:u,customColumnHeaderTemplate:ye,customColumnRowBodyTemplate:Fe,setAllFields:be,allFields:J,actionHeaderTemplate:Ee,actionBodyTemplate:ue,isFocus:I,inputValue:C,handleFieldSettingsSidebar:ee,isAdmin:b})})]})})]})};Tw.defaultProps={field:{},isPreview:!1},Tw.propTypes={field:At.any,isPreview:At.bool};const Ew=t=>{var ee,X,M,W,G,he,Ne,Se,Ae,Ve,se;const{task_status:e,taskRegisterData:n,updateTaskRegisterData:r,updateTaskProgressValue:i,userTaskSubmitFormData:a,updateUserFormDataSubmit:s,TASK_PUBLISHED:o}=si(),[c,u]=k.useState([]),{isPreview:d,field:f,fieldIndex:p,row:g,pageIndex:m,sectionIndex:b,isAdmin:w,section:x,page:S,rowIndex:C,columnIndex:T,isRenderView:A}=t,{userSelectedLanguage:I}=xn(),[_,P]=k.useState(!1),[q,U]=k.useState(null),[F,O]=k.useState(0),[L,J]=k.useState(!1),[be,xe]=k.useState(!1),le=()=>{xe(!0)},Z=()=>{xe(!1)},fe=pe=>{P(pe)},Y=()=>{P(!1)},ie=()=>{var z;null.get((z=f==null?void 0:f.dataSource)==null?void 0:z.api).then(te=>{u(te==null?void 0:te.data)})};k.useEffect(()=>((f==null?void 0:f.dataSourceType)==="custom"&&u(f==null?void 0:f.options),(f==null?void 0:f.dataSourceType)==="database"&&ie(),()=>{}));const K=()=>{var z,te,oe,de;let pe=null;if(g!=null&&g.rowIsRepeatable){if(g!=null&&g.repeatableFields){const ge=[...g.repeatableFields],Ie=St.findIndex(ge,function($e){return $e.uuid===(f==null?void 0:f.uuid)});Ie>=0&&ge[Ie].fieldData?(pe=ge[Ie].fieldData,U(ge[Ie].fieldData)):(f.isValid=0,U(""))}}else{const ge=a,Ie=St.cloneDeep(n);if(ge!=null&&ge.length){for(const $e of ge)if($e.fieldId===t.field.uuid&&((z=$e==null?void 0:$e.postData)!=null&&z.length)){pe=(te=$e==null?void 0:$e.postData[0])==null?void 0:te.postValue,U((oe=$e==null?void 0:$e.postData[0])==null?void 0:oe.postValue),Ie[f==null?void 0:f.uuid]=(de=$e==null?void 0:$e.postData[0])==null?void 0:de.postValue;const nt=Object.keys(Ie).length;i(nt);break}}}U(pe),setTimeout(()=>{J(!0)},2e3)};k.useEffect(()=>{!L&&(a==null?void 0:a.length)>0&&K();const pe=an.addListener("clearRepeatableFields",oe=>{oe===(g==null?void 0:g.uuid)&&(U(""),O(0),f.isValid=1)}),z=an.addListener("onSubmitUserForm",()=>{var oe;(oe=f==null?void 0:f.attributes)!=null&&oe.required?q!=null&&q.uuid&&(q!=null&&q.value)?f.isValid=1:f.isValid=0:f.isValid=1}),te=an.addListener("OnInvalidFieldCatch",oe=>{(f==null?void 0:f.uuid)===(oe==null?void 0:oe.fieldId)?O(1):O(0)});return()=>{z.remove(),te.remove(),pe.remove()}});const ne=(pe,z)=>{var te;if(a){const oe=[...a],de=St.findIndex(oe,function(Ie){return Ie.rowId===(g==null?void 0:g.uuid)});let ge=(te=a[de])==null?void 0:te.repeatableFields;ge={...ge,[pe==null?void 0:pe.uuid]:z==null?void 0:z.value},oe[de]={...oe[de],repeatableFields:ge},s(oe)}U(z),z!=null&&z.value?pe.isValid=1:pe.isValid=0},ue=pe=>{var z,te;U((z=pe==null?void 0:pe.target)==null?void 0:z.value),g!=null&&g.rowIsRepeatable?ne(f,(te=pe==null?void 0:pe.target)==null?void 0:te.value):Te(pe)},ye=()=>{if((f==null?void 0:f.dataSourceType)==="custom")return`optionText.${I.type}`;if((f==null?void 0:f.dataSourceType)==="database")return f==null?void 0:f.optionLabel},Ee=()=>{if((f==null?void 0:f.dataSourceType)==="custom")return`optionText.${I.type}`;if((f==null?void 0:f.dataSourceType)==="database")return f==null?void 0:f.optionLabel},Fe=()=>{var pe,z,te;if(((pe=f==null?void 0:f.fieldType)==null?void 0:pe.type)==="radio"){const oe=[];return c.map((de,ge)=>{var Ie,$e,nt,it;oe.push(l.jsxs("div",{className:"field-radiobutton field-radiobutton-builder",onClick:()=>{ue({target:{value:de}})},style:(q==null?void 0:q.uuid)===(de==null?void 0:de.uuid)?{backgroundColor:"#0F8BFD",padding:15,borderRadius:8}:{padding:15},children:[l.jsx(Zi,{onFocus:()=>O(1),inputId:`radio-option-${ge}-${de==null?void 0:de.uuid}-${d?"preview":"builder"}`,onChange:Nt=>{ue({target:{value:de}})},value:de,name:`radio-option-${ge}-${de==null?void 0:de.uuid}-${d?"preview":"builder"}`,checked:(q==null?void 0:q.uuid)===(de==null?void 0:de.uuid),disabled:e===o}),((Ie=de==null?void 0:de.hyperlinkText)==null?void 0:Ie[I==null?void 0:I.type])===""?l.jsx("label",{htmlFor:`radio-option-${ge}-${de==null?void 0:de.uuid}-${d?"preview":"builder"}`,children:($e=de==null?void 0:de.optionText)==null?void 0:$e[I==null?void 0:I.type]}):l.jsx("label",{children:l.jsx("a",{href:(nt=de==null?void 0:de.hyperlinkText)==null?void 0:nt[I==null?void 0:I.type],target:"_blank",rel:"noreferrer",children:(it=de==null?void 0:de.optionText)==null?void 0:it[I==null?void 0:I.type]})})]},ge))}),oe}if(((z=f==null?void 0:f.fieldType)==null?void 0:z.type)==="dropdown")return l.jsx(ga,{onFocus:()=>O(1),onChange:oe=>{g!=null&&g.rowIsRepeatable?ne(f,oe.target.value):Te(oe)},options:c,optionLabel:Ee(),optionValue:ye(),value:q,placeholder:(te=f==null?void 0:f.placeholder)==null?void 0:te[I==null?void 0:I.type],disabled:e===o})},Te=pe=>{var de,ge;const z=a,te=St.cloneDeep(n);if((de=pe==null?void 0:pe.target)!=null&&de.value&&(z==null?void 0:z.length)>0)for(const Ie of z)Ie.fieldId===((ge=t.field)==null?void 0:ge.uuid)&&(te[f==null?void 0:f.uuid]=pe==null?void 0:pe.value,Ie.postData[0]={postValue:pe.value});else delete te[f==null?void 0:f.uuid];r(te);const oe=Object.keys(te).length;i(oe)},me=l.jsxs("div",{onMouseOver:le,onMouseOut:Z,children:[!A&&!d&&be&&l.jsx(qr,{handleFieldSettingsSidebar:fe,...t}),l.jsx("div",{className:`field-${(f==null?void 0:f.isFluid)===!0?" card py-3 px-4 p-fluid":"card py-3 px-4"}`,children:l.jsxs("div",{className:"grid",children:[l.jsxs("div",{className:"col-12",children:[(f==null?void 0:f.showHeaderText)&&l.jsx("h6",{children:(ee=f==null?void 0:f.headerText)==null?void 0:ee[I==null?void 0:I.type]}),(f==null?void 0:f.showLabel)&&l.jsxs("label",{htmlFor:p,className:"flex font-medium mb-5 text-700 text-2xl",children:[l.jsx(ea,{...t}),((X=f==null?void 0:f.attributes)==null?void 0:X.required)&&l.jsx("span",{className:"must-required mr-1",children:"*"})," ",d?l.jsx(l.Fragment,{children:(M=f==null?void 0:f.label)==null?void 0:M[I==null?void 0:I.type]}):l.jsx(Xi,{...t}),l.jsx("span",{className:"ml-3",children:f!=null&&f.showToolTip?l.jsx(l.Fragment,{children:l.jsx(Fi,{message:(W=f==null?void 0:f.toolTip)==null?void 0:W[I==null?void 0:I.type],position:"right"})}):""})]}),Fe(),l.jsx("div",{children:((G=f==null?void 0:f.attributes)==null?void 0:G.required)&&l.jsx("small",{className:"error",children:F===1&&!q?(he=f==null?void 0:f.validationMesssage)==null?void 0:he.english:""})}),l.jsx("div",{children:(f==null?void 0:f.showHelperText)&&l.jsx("small",{children:(Ne=f==null?void 0:f.helperText)==null?void 0:Ne[I==null?void 0:I.type]})}),((Se=f==null?void 0:f.inlineConditionalRules)==null?void 0:Se.rules.length)>0&&d===!1&&l.jsx("p",{children:"Inline conditional rules"}),L===!0&&((Ve=(Ae=f==null?void 0:f.inlineConditionalRules)==null?void 0:Ae.rules)==null?void 0:Ve.length)>0&&((se=f==null?void 0:f.inlineConditionalRules)==null?void 0:se.rules.map((pe,z)=>d===!0?l.jsx("div",{children:pe==null?void 0:pe.conditions.map((te,oe)=>l.jsx(k.Fragment,{children:l.jsx(Gd,{isConditionTrue:(q==null?void 0:q.value)===te.value||!d,inputValue:q,condition:te,ruleIndex:z,conditionIndex:oe,isPreview:d,field:f,section:x,page:S,row:g,pageIndex:m,sectionIndex:b,rowIndex:C,columnIndex:T,isAdmin:w,...t})},`select-rule-${z}-`+oe))},`rule-${z}`):l.jsx(Pi,{className:"mt-4",header:`Rule ${z+1}`,children:l.jsx("div",{children:pe==null?void 0:pe.conditions.map((te,oe)=>l.jsx(k.Fragment,{children:l.jsx(Gd,{isConditionTrue:(q==null?void 0:q.value)===te.value||!d,inputValue:q,condition:te,ruleIndex:z,conditionIndex:oe,isPreview:d,field:f,section:x,page:S,row:g,pageIndex:m,sectionIndex:b,rowIndex:C,columnIndex:T,...t})},`select-rule-${z}-`+oe))},`rule-${z}`)},z)))]}),w&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{}),l.jsx(Ii,{...t})]})]})})]});return l.jsxs(l.Fragment,{children:[_===!0&&l.jsx(Yi,{visibilty:_,closeSettingFieldSidebar:Y,...t},f==null?void 0:f.uuid),l.jsx(xi,{...t,fieldWrap:me})]})};Ew.defaultProps={field:{},isPreview:!1},Ew.propTypes={field:At.any,isPreview:At.bool};const _w=t=>{var J,be,xe,le;const{taskRegisterData:e,updateTaskRegisterData:n,updateTaskProgressValue:r,userTaskSubmitFormData:i}=si(),{isPreview:a,field:s,row:o,isAdmin:c,isRenderView:u}=t,{userSelectedLanguage:d}=xn(),[f,p]=k.useState(!1),[g,m]=k.useState({}),[b,w]=k.useState(0),[x,S]=k.useState(!1),[C,T]=k.useState(!1),A=()=>{T(!0)},I=()=>{T(!1)},_=Z=>{p(Z)},P=()=>{p(!1)},q=()=>{var Z,fe,Y,ie;if((i==null?void 0:i.length)>0)if(o!=null&&o.rowIsRepeatable){if(o!=null&&o.repeatableFields){const K=[...o.repeatableFields],ne=St.findIndex(K,function(ue){return ue.uuid===(s==null?void 0:s.uuid)});ne>=0&&K[ne].fieldData?m(K[ne].fieldData):(s.isValid=0,m(""))}}else{const K=i,ne=St.cloneDeep(e);if(K!=null&&K.length){for(const ue of K)if(ue.fieldId===t.field.uuid&&((Z=ue==null?void 0:ue.postData)!=null&&Z.length)){(fe=ue==null?void 0:ue.postData[0])==null||fe.postValue,m((Y=ue==null?void 0:ue.postData[0])==null?void 0:Y.postValue),ne[s==null?void 0:s.uuid]=(ie=ue==null?void 0:ue.postData[0])==null?void 0:ie.postValue;const ye=Object.keys(ne).length;r(ye);break}}}setTimeout(()=>{S(!0)},2e3)};k.useEffect(()=>{x||q();const Z=an.addListener("clearRepeatableFields",ie=>{ie===(o==null?void 0:o.uuid)&&(m(""),w(0),s.isValid=1)}),fe=an.addListener("onSubmitUserForm",()=>{var ie;(ie=s==null?void 0:s.attributes)!=null&&ie.required?g!=null&&g[s.uuid]?s.isValid=1:s.isValid=0:s.isValid=1}),Y=an.addListener("OnInvalidFieldCatch",ie=>{(s==null?void 0:s.uuid)===(ie==null?void 0:ie.fieldId)?w(1):w(0)});return()=>{fe.remove(),Y.remove(),Z.remove()}});const U=(Z,fe,Y,ie,K)=>ie==null?void 0:ie.map(ne=>{var ue,ye;return{...ne,children:((ue=ne==null?void 0:ne.children)==null?void 0:ue.length)>0?[...((ye=ne==null?void 0:ne.children)==null?void 0:ye.map(Ee=>fe===(ne==null?void 0:ne.uuid)||K===!0?(Y!=null&&Y[Ee==null?void 0:Ee.uuid]&&delete Y[Ee==null?void 0:Ee.uuid],{...Ee,options:U(Z,fe,Y,Ee==null?void 0:Ee.options,!0)}):{...Ee,options:U(Z,fe,Y,Ee==null?void 0:Ee.options,!1)}))||[]]:[]}}),F=(Z,fe)=>{const Y={...g};U(Z,fe,Y,s==null?void 0:s.options,!1),Y[Z]=fe,m(Y),o!=null&&o.rowIsRepeatable||O(Y)},O=Z=>{var K;const fe=i,Y=St.cloneDeep(e);if(Z&&(fe==null?void 0:fe.length)>0)for(const ne of fe)ne.fieldId===((K=t.field)==null?void 0:K.uuid)&&(Y[s==null?void 0:s.uuid]=Z,ne.postData[0]={postValue:Z});else delete Y[s==null?void 0:s.uuid];n(Y);const ie=Object.keys(Y).length;r(ie)},L=l.jsxs("div",{onMouseOver:A,onMouseOut:I,children:[!u&&!a&&C&&l.jsx(qr,{handleFieldSettingsSidebar:_,...t}),l.jsx("div",{className:`field-${(s==null?void 0:s.isFluid)===!0?" card py-3 px-4 p-fluid":"card py-3 px-4"}`,children:l.jsxs("div",{className:"grid",children:[l.jsxs("div",{className:"col-12",children:[(s==null?void 0:s.showHeaderText)&&l.jsx("h6",{children:(J=s==null?void 0:s.headerText)==null?void 0:J[d==null?void 0:d.type]}),l.jsx(t7,{...t,isFirst:!0,isPreview:a,schema:s,field:s,value:g,update:(Z,fe)=>{F(Z,fe)}}),l.jsx("div",{children:((be=s==null?void 0:s.attributes)==null?void 0:be.required)&&l.jsx("small",{className:"error",children:b===1&&!g?(xe=s==null?void 0:s.validationMesssage)==null?void 0:xe.english:""})}),l.jsx("div",{children:(s==null?void 0:s.showHelperText)&&l.jsx("small",{children:(le=s==null?void 0:s.helperText)==null?void 0:le[d==null?void 0:d.type]})})]}),c&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{}),l.jsx(Ii,{...t})]})]})})]});return l.jsxs(l.Fragment,{children:[l.jsx(Yi,{visibilty:f,closeSettingFieldSidebar:P,...t},s==null?void 0:s.uuid),l.jsx(xi,{...t,fieldWrap:L})]})};_w.defaultProps={field:{},isPreview:!1},_w.propTypes={field:At.any,isPreview:At.bool};const Iw=t=>{var ue,ye,Ee,Fe,Te,me,ee,X,M,W;const{isPreview:e,field:n,fieldIndex:r,sectionIndex:i,pageIndex:a,row:s,rowIndex:o,columnIndex:c,isAdmin:u,isRenderView:d}=t,{taskRegisterData:f,updateTaskRegisterData:p,updateTaskProgressValue:g,updateUserFormDataSubmit:m,userTaskSubmitFormData:b,task_status:w,TASK_PUBLISHED:x}=si(),[S,C]=k.useState(!1),{userSelectedLanguage:T,fieldSettingUpdate:A}=xn(),[I,_]=k.useState(!1),[P,q]=k.useState(0),[U,F]=k.useState(""),[O,L]=k.useState(!1),J=()=>{L(!0)},be=()=>{L(!1)},xe=[{icon:"pi pi-thumbs-up",thumbValue:"up"},{icon:"pi pi-thumbs-down",thumbValue:"down"}],le=G=>l.jsx("span",{className:"m-2",children:l.jsx("i",{style:{fontSize:30},className:G.icon})}),Z=()=>{var G,he,Ne;if(s!=null&&s.rowIsRepeatable){if(s!=null&&s.repeatableFields){const Se=[...s.repeatableFields],Ae=St.findIndex(Se,function(Ve){return Ve.uuid===(n==null?void 0:n.uuid)});Ae>=0&&Se[Ae].fieldData?F(Se[Ae].fieldData):F("")}}else{const Se=b;if(Se!=null&&Se.length){for(const Ae of Se)if(Ae.fieldId===t.field.uuid&&((G=Ae==null?void 0:Ae.postData[0])==null?void 0:G.postValue)!==""&&((he=Ae==null?void 0:Ae.postData[0])!=null&&he.postValue)){F((Ne=Ae==null?void 0:Ae.postData[0])==null?void 0:Ne.postValue);break}}}_(!0)};k.useEffect(()=>{I||Z();const G=an.addListener("clearRepeatableFields",Ae=>{Ae===(s==null?void 0:s.uuid)&&(F(""),q(0),n.isValid=0,A(a,i,o,c,r,n))}),he=an.addListener("onSubmitUserForm",Ae=>{var Ve;(Ve=n==null?void 0:n.attributes)!=null&&Ve.required?U?n.isValid=1:n.isValid=0:n.isValid=1}),Ne=an.addListener("OnInvalidFieldCatch",Ae=>{n.uuid===(Ae==null?void 0:Ae.fieldId)?q(1):q(0)}),Se=an.addListener("OnGetFieldValue",Ae=>{var se;const Ve=(se=Ae==null?void 0:Ae.repeatableColumn)==null?void 0:se.filter((pe,z)=>(pe==null?void 0:pe.fieldUuid)===(n==null?void 0:n.uuid));Ve!=null&&Ve.length});return()=>{he.remove(),Ne.remove(),Se.remove(),G.remove()}});const fe=G=>{F(G.value);const he=b,Ne=St.cloneDeep(f);if(he!==null){if(G!=null&&G.value){if(Ne[n==null?void 0:n.uuid]=G==null?void 0:G.value,(he==null?void 0:he.length)>0)for(const Se of he)Se.fieldId===t.field.uuid&&(Se.postData[0]={postValue:G.value})}else if(delete Ne[n==null?void 0:n.uuid],(he==null?void 0:he.length)>0)for(const Se of he)Se.fieldId===t.field.uuid&&(Se.postData[0]={postValue:""})}if(!(s!=null&&s.rowIsRepeatable)){p(Ne);const Se=Object.keys(Ne).length;g(Se)}},Y=(G,he)=>{var Ne;if(b){const Se=[...b],Ae=St.findIndex(Se,function(se){return se.rowId===(s==null?void 0:s.uuid)});let Ve=(Ne=b[Ae])==null?void 0:Ne.repeatableFields;Ve={...Ve,[G==null?void 0:G.uuid]:he},Se[Ae]={...Se[Ae],repeatableFields:Ve},m(Se)}F(he),he!==""?G.isValid=1:G.isValid=0},ie=G=>{C(G)},K=()=>{C(!1)},ne=l.jsxs("div",{onMouseOver:J,onMouseOut:be,children:[!d&&!e&&O&&l.jsx(qr,{handleFieldSettingsSidebar:ie,...t}),l.jsx("div",{className:`field ${e?" ":" builder-element-wrapper "}${(n==null?void 0:n.isFluid)===!0?" card py-3 px-4 p-fluid":"card py-3 px-4"}`,children:l.jsxs("div",{className:"grid",children:[l.jsxs("div",{className:u?"col-6 ":"col-12 p-fluid",children:[(n==null?void 0:n.showHeaderText)&&l.jsx("h6",{children:(ue=n==null?void 0:n.headerText)==null?void 0:ue[T==null?void 0:T.type]}),(n==null?void 0:n.showLabel)&&l.jsxs("label",{htmlFor:r,className:"flex font-medium mb-3 text-700 text-2xl",children:[l.jsx(ea,{...t}),((ye=n==null?void 0:n.attributes)==null?void 0:ye.required)&&l.jsx("span",{className:"must-required mr-1",children:"*"})," ",e?l.jsx(l.Fragment,{children:(Ee=n==null?void 0:n.label)==null?void 0:Ee[T==null?void 0:T.type]}):l.jsx(Xi,{...t}),l.jsx("span",{className:"ml-3",children:(n==null?void 0:n.showToolTip)&&l.jsx(Fi,{message:(Fe=n==null?void 0:n.toolTip)==null?void 0:Fe[T==null?void 0:T.type],position:"right"})})]}),l.jsxs("span",{className:"p-input-icon-"+(n==null?void 0:n.iconAlignment),children:[(n==null?void 0:n.showIcon)&&l.jsx("i",{className:"pi pi-"+((me=(Te=n==null?void 0:n.icon)==null?void 0:Te.properties)==null?void 0:me.name)}),l.jsx("div",{className:"card flex justify-content-center",children:l.jsx(V1,{value:U,onChange:G=>{F(G.value),s!=null&&s.rowIsRepeatable?Y(n,G.value):fe(G)},itemTemplate:le,optionLabel:"value",onFocus:()=>q(1),options:xe,readOnly:w===x,className:P===1&&((ee=n==null?void 0:n.attributes)!=null&&ee.required)?U?"valid":"invalid":"valid'"})})]}),l.jsx("div",{children:((X=n==null?void 0:n.attributes)==null?void 0:X.required)&&l.jsx(l.Fragment,{children:l.jsx("small",{className:"error",children:P===1&&!U?(M=n==null?void 0:n.validationMesssage)==null?void 0:M.english:""})})}),l.jsx("div",{children:(n==null?void 0:n.showHelperText)&&l.jsx("small",{children:(W=n==null?void 0:n.helperText)==null?void 0:W[T==null?void 0:T.type]})})]}),u&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{}),l.jsx(Ii,{...t})]})]})})]});return l.jsxs(l.Fragment,{children:[l.jsx(Yi,{visibilty:S,closeSettingFieldSidebar:K,...t}),l.jsx(xi,{...t,fieldWrap:ne})]})};Iw.defaultProps={field:{},isPreview:!1},Iw.propTypes={field:At.any,isPreview:At.bool};const Dw=t=>{var K,ne,ue,ye,Ee,Fe,Te;const{taskRegisterData:e,updateTaskRegisterData:n,updateTaskProgressValue:r,updateUserFormDataSubmit:i,userTaskSubmitFormData:a}=si(),{userSelectedLanguage:s,fieldSettingUpdate:o}=xn(),{isPreview:c,field:u,fieldIndex:d,sectionIndex:f,pageIndex:p,row:g,rowIndex:m,columnIndex:b,isAdmin:w,isRenderView:x}=t,[S,C]=k.useState(!1),[T,A]=k.useState(""),[I,_]=k.useState(0),[P,q]=k.useState(!1),[U,F]=k.useState(!1),O=()=>{F(!0)},L=()=>{F(!1)},J=()=>{var me,ee,X;if(g!=null&&g.rowIsRepeatable){if(g!=null&&g.repeatableFields){const M=[...g.repeatableFields],W=St.findIndex(M,function(G){return G.uuid===(u==null?void 0:u.uuid)});W>=0&&M[W].fieldData?A(M[W].fieldData):A("")}}else{const M=a;if(M!=null&&M.length){for(const W of M)if(W.fieldId===t.field.uuid&&((me=W==null?void 0:W.postData[0])==null?void 0:me.postValue)!==""&&((ee=W==null?void 0:W.postData[0])!=null&&ee.postValue)){A((X=W==null?void 0:W.postData[0])==null?void 0:X.postValue);break}}}q(!0)};k.useEffect(()=>{P||J();const me=an.addListener("clearRepeatableFields",W=>{W===(g==null?void 0:g.uuid)&&(A(""),_(0),u.isValid=0,o(p,f,m,b,d,u))}),ee=an.addListener("onSubmitUserForm",W=>{var G;(G=u==null?void 0:u.attributes)!=null&&G.required?T?u.isValid=1:u.isValid=0:u.isValid=1}),X=an.addListener("OnInvalidFieldCatch",W=>{u.uuid===(W==null?void 0:W.fieldId)?_(1):_(0)}),M=an.addListener("OnGetFieldValue",W=>{var he;const G=(he=W==null?void 0:W.repeatableColumn)==null?void 0:he.filter(Ne=>(Ne==null?void 0:Ne.fieldUuid)===(u==null?void 0:u.uuid));G!=null&&G.length});return()=>{ee.remove(),X.remove(),M.remove(),me.remove()}});const be=me=>{C(me)},xe=()=>{C(!1)},le=me=>{var M,W;A(me.target.value);const ee=a,X=St.cloneDeep(e);if(ee!==null){if((M=me==null?void 0:me.target)!=null&&M.value){if(X[u==null?void 0:u.uuid]=(W=me==null?void 0:me.target)==null?void 0:W.value,(ee==null?void 0:ee.length)>0)for(const G of ee)G.fieldId===t.field.uuid&&(G.postData[0]={postValue:me.target.value})}else if(delete X[u==null?void 0:u.uuid],(ee==null?void 0:ee.length)>0)for(const G of ee)G.fieldId===t.field.uuid&&(G.postData[0]={postValue:""})}if(!(g!=null&&g.rowIsRepeatable)){n(X);const G=Object.keys(X).length;r(G)}},Z=(me,ee,X,M)=>{var W;if(a){const G=[...a],he=St.findIndex(G,function(Se){return Se.rowId===(g==null?void 0:g.uuid)});let Ne=(W=a[he])==null?void 0:W.repeatableFields;Ne={...Ne,[X==null?void 0:X.uuid]:M},G[he]={...G[he],repeatableFields:Ne},i(G)}A(M),M!==""?X.isValid=1:X.isValid=0},fe=5,Y=()=>{const me=[],ee=[aI,iI,sI,nI,rI],X=["Awful","Not Very Good","Okay","Really Good","Fantastic"];for(let M=0;M<fe;M++)me.push(l.jsxs("label",{children:[l.jsx("input",{onChange:W=>{g!=null&&g.rowIsRepeatable?Z(p,f,u,W.target.value):le(W)},checked:parseInt(T)===M,name:"liker-Emoji-scale"+(u==null?void 0:u.uuid),type:"radio",value:M}),l.jsxs("span",{className:"grid m-0",children:[l.jsx("div",{className:"col-12",children:l.jsx("img",{src:ee[M]})}),l.jsx("div",{children:X[M]})]})]},`field-${u==null?void 0:u.uuid}-likertEmojiScale-${M} ${parseInt(T)===M?"scale-selected":""}`));return me},ie=l.jsxs("div",{onMouseOver:O,onMouseOut:L,children:[!x&&!c&&U&&l.jsx(qr,{handleFieldSettingsSidebar:be,...t}),l.jsxs("div",{className:`field ${c?" ":" builder-element-wrapper "}${(u==null?void 0:u.isFluid)===!0?" card py-3 px-4 p-fluid":"card py-3 px-4"}`,children:[l.jsx("div",{className:"grid",children:l.jsxs("div",{className:"col-12 ",children:[(u==null?void 0:u.showHeaderText)&&l.jsx("h6",{children:(K=u==null?void 0:u.headerText)==null?void 0:K[s==null?void 0:s.type]}),(u==null?void 0:u.showLabel)&&l.jsxs("label",{htmlFor:d,className:"flex font-medium mb-3 text-700 text-2xl",children:[l.jsx(ea,{...t}),((ne=u==null?void 0:u.attributes)==null?void 0:ne.required)&&l.jsx("span",{className:"must-required mr-1",children:"*"})," ",c?l.jsx(l.Fragment,{children:(ue=u==null?void 0:u.label)==null?void 0:ue[s==null?void 0:s.type]}):l.jsx(Xi,{...t}),l.jsx("span",{className:"ml-3",children:(u==null?void 0:u.showToolTip)&&l.jsx(Fi,{message:(ye=u==null?void 0:u.toolTip)==null?void 0:ye[s==null?void 0:s.type],position:"right"})})]}),l.jsxs("div",{className:"mt-3",children:[l.jsx("div",{className:"flex justify-content-center w-full flex-wrap",children:l.jsx("div",{className:"emoji",children:Y()})}),l.jsx("div",{children:((Ee=u==null?void 0:u.attributes)==null?void 0:Ee.required)&&l.jsx("small",{className:"error",children:I===1&&!T?(Fe=u==null?void 0:u.validationMesssage)==null?void 0:Fe.english:""})}),l.jsx("div",{children:(u==null?void 0:u.showHelperText)&&l.jsx("small",{children:(Te=u==null?void 0:u.helperText)==null?void 0:Te[s==null?void 0:s.type]})})]})]})}),w&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{}),l.jsx(Ii,{...t})]})]})]});return l.jsxs(l.Fragment,{children:[l.jsx(Yi,{visibilty:S,closeSettingFieldSidebar:xe,...t}),l.jsx(xi,{...t,fieldWrap:ie})]})};Dw.defaultProps={field:{},isPreview:!1},Dw.propTypes={field:At.any,isPreview:At.bool};const Ow=t=>{var Y,ie,K,ne,ue,ye,Ee,Fe,Te,me,ee;const{taskRegisterData:e,updateTaskRegisterData:n,updateTaskProgressValue:r,updateUserFormDataSubmit:i,userTaskSubmitFormData:a,task_status:s,TASK_PUBLISHED:o}=si(),{userSelectedLanguage:c,fieldSettingUpdate:u}=xn(),{isPreview:d,field:f,fieldIndex:p,sectionIndex:g,pageIndex:m,row:b,rowIndex:w,columnIndex:x,isAdmin:S,isRenderView:C}=t,[T,A]=k.useState(!1),[I,_]=k.useState(""),[P,q]=k.useState(0),[U,F]=k.useState(!1),[O,L]=k.useState(!1),J=()=>{L(!0)},be=()=>{L(!1)},xe=()=>{var X,M,W;if(b!=null&&b.rowIsRepeatable){if(b!=null&&b.repeatableFields){const G=[...b.repeatableFields],he=St.findIndex(G,function(Ne){return Ne.uuid===(f==null?void 0:f.uuid)});he>=0&&G[he].fieldData?_(G[he].fieldData):_("")}}else{const G=a;if(G!=null&&G.length){for(const he of G)if(he.fieldId===t.field.uuid&&((X=he==null?void 0:he.postData[0])==null?void 0:X.postValue)!==""&&((M=he==null?void 0:he.postData[0])!=null&&M.postValue)){_((W=he==null?void 0:he.postData[0])==null?void 0:W.postValue);break}}}F(!0)};k.useEffect(()=>{U||xe();const X=an.addListener("clearRepeatableFields",he=>{he===(b==null?void 0:b.uuid)&&(_(""),q(0),f.isValid=0,u(m,g,w,x,p,f))}),M=an.addListener("onSubmitUserForm",he=>{var Ne,Se;(Ne=f==null?void 0:f.attributes)!=null&&Ne.required?I&&(I==null?void 0:I.length)<((Se=f==null?void 0:f.attributes)==null?void 0:Se.minLength)?f.isValid=1:f.isValid=0:f.isValid=1}),W=an.addListener("OnInvalidFieldCatch",he=>{f.uuid===(he==null?void 0:he.fieldId)?q(1):q(0)}),G=an.addListener("OnGetFieldValue",he=>{var Se;const Ne=(Se=he==null?void 0:he.repeatableColumn)==null?void 0:Se.filter((Ae,Ve)=>(Ae==null?void 0:Ae.fieldUuid)===(f==null?void 0:f.uuid));Ne!=null&&Ne.length});return()=>{M.remove(),W.remove(),G.remove(),X.remove()}});const le=X=>{A(X)},Z=()=>{A(!1)},fe=l.jsxs("div",{onMouseOver:J,onMouseOut:be,children:[!C&&!d&&O&&l.jsx(qr,{handleFieldSettingsSidebar:le,...t}),l.jsxs("div",{className:`field ${d?" ":" builder-element-wrapper "}${(f==null?void 0:f.isFluid)===!0?" card p-fluid ":"card"} ${C?" ":" py-6 px-4 "}`,children:[l.jsx("div",{className:"grid",children:l.jsxs("div",{className:S?"col-6 ":"col-12 p-fluid",children:[(f==null?void 0:f.showHeaderText)&&l.jsx("h6",{children:(Y=f==null?void 0:f.headerText)==null?void 0:Y[c==null?void 0:c.type]}),(f==null?void 0:f.showLabel)&&l.jsxs("label",{htmlFor:p,className:"flex font-medium mb-3 text-700 text-2xl",children:[l.jsx(ea,{...t}),((ie=f==null?void 0:f.attributes)==null?void 0:ie.required)&&l.jsx("span",{className:"must-required mr-1",children:"*"})," ",d?l.jsx(l.Fragment,{children:(K=f==null?void 0:f.label)==null?void 0:K[c==null?void 0:c.type]}):l.jsx(Xi,{...t}),(f==null?void 0:f.showToolTip)&&l.jsx("span",{className:"ml-3",children:l.jsx(Fi,{message:(ne=f==null?void 0:f.toolTip)==null?void 0:ne[c==null?void 0:c.type],position:"right"})})]}),l.jsxs("div",{className:"mt-3",children:[l.jsx("span",{className:"p-input-icon-"+(f==null?void 0:f.iconAlignment),children:(f==null?void 0:f.showIcon)&&l.jsx("i",{className:"pi pi-"+((ye=(ue=f==null?void 0:f.icon)==null?void 0:ue.properties)==null?void 0:ye.name)})}),l.jsx("div",{children:((Ee=f==null?void 0:f.attributes)==null?void 0:Ee.required)&&l.jsxs(l.Fragment,{children:[l.jsx("small",{className:"error",children:P===1&&!I?(Fe=f==null?void 0:f.validationMesssage)==null?void 0:Fe.english:""}),l.jsx("small",{className:"error",children:P===1&&(I==null?void 0:I.length)<((Te=f==null?void 0:f.attributes)==null?void 0:Te.minLength)?`Mini length ${(me=f==null?void 0:f.attributes)==null?void 0:me.minLength}`:""})]})}),l.jsx("div",{children:(f==null?void 0:f.showHelperText)&&l.jsx("small",{children:(ee=f==null?void 0:f.helperText)==null?void 0:ee[c==null?void 0:c.type]})})]})]})}),S&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{}),l.jsx(Ii,{...t})]})]})]});return l.jsxs(l.Fragment,{children:[l.jsx(Yi,{visibilty:T,closeSettingFieldSidebar:Z,...t}),l.jsx(xi,{...t,fieldWrap:fe})]})};Ow.defaultProps={field:{},isPreview:!1},Ow.propTypes={field:At.any,isPreview:At.bool};const vg=t=>{const{data:e,path:n,field:r,isPreview:i,handleDrop:a,renderType:s}=t,o=k.useRef(null),[c,u]=k.useState(!1),[{isDragging:d},f]=Yd({item:{...e,type:rf,uuid:e==null?void 0:e.uuid,path:n},type:rf,collect:x=>({isDragging:x.isDragging()})}),p=d?.25:1;f(o);const g=x=>{switch(r==null?void 0:r.componentType){case"text":return l.jsx(d7,{typeName:"Text",isPreview:i,field:r,...x});case"number":return l.jsx(f7,{typeName:"Number",isPreview:i,field:r,...x});case"email":return l.jsx(p7,{typeName:"Email",isPreview:i,field:r,...x});case"textarea":return l.jsx(g7,{typeName:"Text Area",isPreview:i,field:r,...x});case"editor":return l.jsx(A7,{typeName:"Editor",isPreview:i,field:r,...x});case"question":return l.jsx(F7,{typeName:"Exam",isPreview:i,field:r,...x});case"select":return l.jsx(b7,{typeName:"Select",isPreview:i,field:r,...x});case"multi-select":return l.jsx(_7,{typeName:"Multi Select",isPreview:i,field:r,...x});case"checkbox":return l.jsx(D7,{typeName:"Checkbox",isPreview:i,field:r,...x});case"radio":return l.jsx(kle,{typeName:"Radio",isPreview:i,field:r,handleDrop:a,...x});case"radio-hierarchal":return l.jsx(_w,{typeName:"Radio Progressive",isPreview:i,field:r,handleDrop:a,...x});case"href":return l.jsx(sle,{typeName:"Href",field:r,...x});case"heading":return l.jsx(N7,{typeName:"Heading",field:r,...x});case"paragraph":return l.jsx(jA,{typeName:"Paragraph",field:r,...x});case"image":return l.jsx(hb,{typeName:"Image",field:r,...x});case"video":return l.jsx(vA,{typeName:"Video",field:r,...x});case"hr":return l.jsx(bA,{typeName:"Hr",field:r,...x});case"date-picker":return l.jsx(yA,{typeName:"Date Picker",field:r,...x});case"signature":return l.jsx(AA,{typeName:"Signature",field:r,...x});case"file-upload":return l.jsx(X7e,{typeName:"File Upload",field:r,...x});case"facebook-login":return l.jsx(Ow,{typeName:"Facebook Login",field:r,...x});case"anchor":return l.jsx(l.Fragment,{});case"image-gallery":return l.jsx(UA,{typeName:"Image Gallery",field:r,...x});case"quiz":return l.jsx(Qx,{typeName:"Quiz",field:r,...x});case"document":return l.jsx(zx,{typeName:"Document",field:r,...x});case"list":return l.jsx(Jx,{typeName:"List",field:r,...x});case"country":return l.jsx(u7,{typeName:"Country",isPreview:i,field:r,...x});case"phone":return l.jsx(mw,{typeName:"Phone",isPreview:i,field:r,...x});case"web-url":return l.jsx(vw,{typeName:"Website Url",isPreview:i,field:r,...x});case"rating":return l.jsx(bw,{typeName:"Rating",isPreview:i,field:r,...x});case"slider":return l.jsx(yw,{typeName:"Rating",isPreview:i,field:r,...x});case"hidden-field":return l.jsx(Aw,{typeName:"Hidden Field",isPreview:i,field:r,...x});case"likert-scale":return l.jsx(xw,{typeName:"Likert Scale Field",isPreview:i,field:r,...x});case"type-signature":return l.jsx(ww,{typeName:"Likert Scale Field",isPreview:i,field:r,...x});case"address":return l.jsx(Sw,{typeName:"Address",isPreview:i,field:r,...x});case"grid-component":return l.jsx(lv,{typeName:"Grid",isPreview:i,field:r,...x});case"matrix-scale":return l.jsx(lv,{typeName:"Grid",isPreview:i,field:r,...x});case"matrix-dropdown":return l.jsx(Cw,{typeName:"Grid",isPreview:i,field:r,...x});case"thumbs":return l.jsx(Iw,{typeName:"Thumbs Up and Down",isPreview:i,field:r,...x});case"likert-emoji-scale":return l.jsx(Dw,{typeName:"Thumbs Up and Down",isPreview:i,field:r,...x});case"table":return l.jsx(Tw,{typeName:"Grid",isPreview:i,field:r,...x});case"dynamic-listing":return l.jsx(Ew,{typeName:"Grid",isPreview:i,field:r,...x});default:return l.jsx(l.Fragment,{children:"Empty"})}},m=()=>{u(!0)},b=()=>{u(!1)},w=()=>{let x="";return i?(x=x+" component ",s===Bu?x=x+" ":x=x+" px-2 "):(x=x+" component draggable field-form-builder-not-preview",s===Bu?x=x+" pdf-component":x=x+" px-2 pdf-component"),x};return l.jsx(l.Fragment,{children:l.jsxs("div",{style:{opacity:p},className:w(),onMouseOver:m,onMouseOut:b,children:[!i&&c&&l.jsx("i",{ref:i===!1?o:null,className:"elementDrag-icon pi pi-arrows-alt cursor-move",style:{fontSize:"1em"}}),g(t)]})})},RU=t=>{var T,A,I;const{userSelectedLanguage:e,formBuilderConfigurationType:n,builderTemplateName:r,formBuilderFormSchema:i}=xn(),a=[{label:"List main maintenance safety tips?",componentType:"question",questionText:{french:"Quels sont les principaux conseils de sécurité pour la maintenance?? ",English:"List main maintenance safety tips? "},answerOptions:[{answersText:{french:"Portez des gants et tous les équipements de protection individuelle requis. ",English:"Wear gloves and all required personnel protective equipment ",russian:"????????? ???????? ? ?????? ???????? ?????????????? ??????. ",romanian:"Purta?i m?nu?i ?i toate echipamentele individuale de protec?ie necesare. "},isCorrectAnswer:!1},{answersText:{french:"Délimitez les zones de maintenance pour maintenir les autres à distance (p.?ex., ruban de signalisation). ",English:"Keep maintenance areas marked off to keep others away (e.g., caution tape). ",russian:"?????????? ???? ???????????? ???????????, ????? ???????????? ?? ????????? ?????? ????? (????????, ?????????? ??????). ",romanian:"P?stra?i zonele de între?inere marcate pentru a ?ine la distan?? alte persoane (utiliza?i, de ex., band? de aten?ionare). "},isCorrectAnswer:!1},{answersText:{french:"Débranchez les outils électriques lorsqu’ils ne sont pas utilisés. ",English:"Unplug power tools when not in use. ",russian:"?????????? ??????????????????, ????? ??? ?? ????????????. ",romanian:"Deconecta?i sculele electrice atunci când nu le utiliza?i. "},isCorrectAnswer:"No"},{answersText:{french:"Travaillez seul(e) et ne communiquez avec personne. ",English:"Work alone and don’t communicate anyone. ",russian:"????????? ? ???????? ? ?????? ?? ????????? ? ???? ",romanian:"Lucra?i singur ?i nu comunica?i nim?nui. "},isCorrectAnswer:!0}],isHidden:!1,uuid:"rtest"}],{questions:s}=t,[o,c]=k.useState(null),[u,d]=k.useState([]),f={assessment_id:"abc123",name:`${n==null?void 0:n.name} - ${r}`,label:"Quiz 1",quizConfiguration:{quizPassMark:75,quizTimeLimit:2,quizMaxAttempts:99,quizSequentialAnswer:0,isAllCorrectMandatory:!0,quizRandomiseQuestions:1,quizUniqueAnswersPerAttempt:"1"},quizElements:(s==null?void 0:s.length)>0?s:a},[p,g]=k.useState(0),[m,b]=k.useState(!1);function w(_,P){return(_==null?void 0:_.length)<=P?_:(_==null?void 0:_.slice(0,P))+"..."}k.useEffect(()=>{b(!0)},[]);const x=()=>{p!==0&&g(p-1)},S=()=>{if(f!=null&&f.quizElements&&p+1!==(f==null?void 0:f.quizElements.length))g(p+1);else if((f==null?void 0:f.quizElements.length)===p+1)return},C=_=>{let P=[...u];_.checked?P.push(_.value):P=P.filter(q=>{var U;return(q==null?void 0:q[e==null?void 0:e.type])!==((U=_.value)==null?void 0:U[e==null?void 0:e.type])}),d(P)};return l.jsxs("div",{className:"scroll-height-200 mb-2",children:[m&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"grid",children:l.jsxs("div",{className:"col-12",children:[l.jsxs("h3",{children:[f==null?void 0:f.name," "]}),(T=f==null?void 0:f.quizElements)==null?void 0:T.map((_,P)=>{var q,U,F,O,L,J,be,xe,le;return(_==null?void 0:_.answerInputType)==="radio"?l.jsxs("div",{className:p===P?"card":" flex align-items-center p-field-radiobutton",children:[((q=_==null?void 0:_.questionTextImage)==null?void 0:q[e==null?void 0:e.type])&&((U=_==null?void 0:_.questionTextImage)==null?void 0:U[e==null?void 0:e.type])!==""&&l.jsx("div",{className:"text-center assessment_image_container",children:l.jsx(Bo,{mediaId:(F=_==null?void 0:_.questionTextImage)==null?void 0:F[e==null?void 0:e.type],style:{height:"100px",width:"100px",objectFit:"cover",borderRadius:100},className:"text-center",alt:"questionImage"})}),l.jsx("h3",{className:"mb-5",children:p===P&&((O=_==null?void 0:_.questionText)==null?void 0:O[e==null?void 0:e.type])}),p===P&&((L=_==null?void 0:_.answerOptions)==null?void 0:L.map((Z,fe)=>{var Y,ie,K,ne;return l.jsxs("div",{className:"field-radiobutton",children:[l.jsx(Zi,{inputId:`${fe}-preview`,value:Z==null?void 0:Z.answersText,checked:o===fe,onChange:ue=>{c(fe)}}),((Y=Z.answersTextImage)==null?void 0:Y[e==null?void 0:e.type])&&((ie=Z.answersTextImage)==null?void 0:ie[e==null?void 0:e.type])!==""&&l.jsx(Bo,{mediaId:(K=Z.answersTextImage)==null?void 0:K[e==null?void 0:e.type],className:"mx-3",alt:"questionImage",style:{width:"50px",height:"50px",borderRadius:50}}),l.jsx("label",{htmlFor:`${fe}-preview`,children:(ne=Z.answersText)==null?void 0:ne[e==null?void 0:e.type]})]},fe)}))]},P):(_==null?void 0:_.answerInputType)==="checkbox"?l.jsxs("div",{className:p===P?"card":" flex align-items-center p-field-radiobutton",children:[l.jsx("h3",{className:"mb-5",children:p===P&&((J=_==null?void 0:_.questionText)==null?void 0:J[e==null?void 0:e.type])}),p===P&&((be=_==null?void 0:_.answerOptions)==null?void 0:be.map((Z,fe)=>{var Y,ie,K,ne;return l.jsxs("div",{className:"field-radiobutton",children:[l.jsx(Dr,{inputId:fe,value:Z==null?void 0:Z.answersText,onChange:ue=>{C(ue)},checked:u.some(ue=>{var ye;return(ue==null?void 0:ue[e==null?void 0:e.type])===((ye=Z==null?void 0:Z.answersText)==null?void 0:ye[e==null?void 0:e.type])})}),((Y=Z.answersTextImage)==null?void 0:Y[e==null?void 0:e.type])&&((ie=Z.answersTextImage)==null?void 0:ie[e==null?void 0:e.type])!==""&&l.jsx(Bo,{mediaId:(K=Z.answersTextImage)==null?void 0:K[e==null?void 0:e.type],className:"mx-3",alt:"questionImage",style:{width:"50px",height:"50px",borderRadius:50}}),l.jsx("label",{htmlFor:fe,children:(ne=Z.answersText)==null?void 0:ne[e==null?void 0:e.type]})]},fe)}))]},P):l.jsxs("div",{className:p===P?"card":"",children:[l.jsx("h3",{className:"mb-5",children:p===P&&((xe=_==null?void 0:_.questionText)==null?void 0:xe[e==null?void 0:e.type])}),p===P&&((le=_==null?void 0:_.answerOptions)==null?void 0:le.map((Z,fe)=>{var Y,ie,K,ne;return l.jsxs("div",{className:"field-radiobutton",children:[l.jsx(Zi,{inputId:fe,value:Z==null?void 0:Z.answersText,onChange:()=>{}}),((Y=Z.answersTextImage)==null?void 0:Y[e==null?void 0:e.type])&&((ie=Z.answersTextImage)==null?void 0:ie[e==null?void 0:e.type])!==""&&l.jsx(Bo,{mediaId:(K=Z.answersTextImage)==null?void 0:K[e==null?void 0:e.type],className:"mx-3",alt:"questionImage",style:{width:"50px",height:"50px",borderRadius:50}}),l.jsx("label",{htmlFor:fe,children:(ne=Z.answersText)==null?void 0:ne[e==null?void 0:e.type]})]},fe)}))]},P)})]})}),l.jsxs("div",{className:"text-center my-5",children:[l.jsxs("div",{className:"mb-1",children:["Viewing:"," ",p+1+"/"+(f==null?void 0:f.quizElements.length)]}),l.jsx("br",{}),p>0&&l.jsx(Rt,{text:!0,className:"mx-2",label:"Previous",onClick:()=>x()}),l.jsx(Rt,{text:!0,label:(f==null?void 0:f.quizElements.length)===p+1?"Finish":"Next",onClick:_=>S()})]})]}),l.jsxs("div",{className:"surface-card p-4 shadow-2 border-round",children:[l.jsx("div",{className:"font-medium text-3xl text-900 mb-3",children:"Summary"}),l.jsx("div",{className:"text-500 mb-5",children:`${n==null?void 0:n.name} - ${r}`}),l.jsxs("ul",{className:"list-none p-0 m-0 border-top-1 surface-border",children:[l.jsxs("li",{className:"flex align-items-center py-3 px-2 flex-wrap surface-ground",children:[l.jsx("div",{className:"text-500 w-full md:w-3 font-medium",children:"Total Questions:"}),l.jsx("div",{className:"text-900 w-full md:w-9",children:(A=f==null?void 0:f.quizElements)==null?void 0:A.length})]}),l.jsxs("li",{className:"flex align-items-center py-3 px-2 flex-wrap",children:[l.jsx("div",{className:"text-500 w-full md:w-3 font-medium",children:"Has Maximum Number of questions:"}),l.jsxs("div",{className:"text-900 w-full md:w-9 line-height-3",children:[i==null?void 0:i.noOfAssessmentQuestions," "]})]}),l.jsxs("li",{className:"flex align-items-center py-3 px-2 flex-wrap",children:[l.jsx("div",{className:"text-500 w-full md:w-3 font-medium",children:"Show Answers Randomly"}),l.jsx("div",{className:"text-900 w-full md:w-9",children:i!=null&&i.randomiseAnswers?l.jsx(Xu,{className:"mr-2",severity:"success",value:"True"}):l.jsx(Xu,{className:"mr-2",severity:"warning",value:"False"})})]}),l.jsxs("li",{className:"flex align-items-center py-3 px-2 flex-wrap",children:[l.jsx("div",{className:"text-500 w-full md:w-3 font-medium",children:"Question Time Limit"}),l.jsx("div",{className:"text-900 w-full md:w-9",children:"0.45 seconds"})]}),l.jsxs("li",{className:"flex align-items-center py-3 px-2 flex-wrap",children:[l.jsx("div",{className:"text-500 w-full md:w-3 font-medium",children:"Exam Time Limit:"}),l.jsx("div",{className:"text-900 w-full md:w-9",children:"2 mins"})]}),l.jsxs("li",{className:"flex align-items-center py-3 px-2 flex-wrap surface-ground",children:[l.jsx("div",{className:"text-500 w-full md:w-3 font-medium",children:"Show Questions Randomly:"}),l.jsx("div",{className:"text-900 w-full md:w-9",children:l.jsx("div",{className:"grid mt-0 mr-0",children:(I=f==null?void 0:f.quizElements)==null?void 0:I.map((_,P)=>{var q;return l.jsx("div",{className:"col-12 md:col-6",children:l.jsx("div",{className:"p-3 border-1 surface-border border-round surface-card",children:l.jsx("div",{className:"text-700",children:w((q=_==null?void 0:_.questionText)==null?void 0:q[e==null?void 0:e.type],30)})})},`preview-question-${P}`)})})})]})]})]})]})},wxe={position:"relative"},Sxe=({data:t,components:e,handleDrop:n,path:r,pageIndex:i,sectionIndex:a,rowIndex:s,columnIndex:o,isPreview:c,renderType:u,section:d,row:f,isAdmin:p,emitSocketData:g,page:m,isRenderView:b,isAdvanceView:w})=>{var F,O,L,J,be,xe,le,Z,fe,Y;const x=k.useRef(null),{removeColumn:S,addColumn:C,cloneColumn:T,formBuilderFormLayout:A}=xn(),[{isDragging:I},_]=Yd({type:q1,item:{type:q1,uuid:t==null?void 0:t.uuid,children:t.children,path:r},collect:ie=>({isDragging:ie.isDragging()})}),P=I&&!b?.25:1;_(x);const q=(ie,K,ne,ue,ye,Ee,Fe)=>l.jsx(vg,{page:m,renderType:u,type:"field",row:f,section:d,handleDrop:n,isPreview:c,field:ie,data:ie,components:e,path:K,isRenderView:b,pageIndex:ne,sectionIndex:ue,rowIndex:ye,columnIndex:Ee,fieldIndex:Fe,isAdmin:p,emitSocketData:g},`component-${r}-${ie==null?void 0:ie.uuid}`),U=(ie,K,ne,ue,ye)=>{var me,ee,X,M;const Ee=ie.collapsed?"pi pi-chevron-down":"pi pi-chevron-up",Fe=`${ie.className} justify-content-space-between`,Te=`${ie.titleClassName} pl-1 text-primary`;return l.jsxs(l.Fragment,{children:[l.jsx(vn,{target:".clone-tool"}),l.jsx(vn,{target:".add-column-tool"}),l.jsxs("div",{className:Fe,children:[l.jsxs("span",{ref:c===!1?x:null,children:[l.jsx("button",{className:ie.togglerClassName,children:l.jsx("span",{className:"pi pi-sliders-h dragabble"})}),l.jsxs("button",{className:ie.togglerClassName,onClick:ie.onTogglerClick,children:[l.jsx("span",{className:Ee}),l.jsx(In,{})]}),l.jsx("span",{className:Te,children:"Column"})]}),c===!1&&l.jsxs("div",{className:"p-panel-icons",children:[l.jsx("span",{className:"add-column-tool","data-pr-tooltip":"Add Column",children:l.jsxs("button",{className:ie.togglerClassName,onClick:()=>{C(K,ne,ue),g()},children:[l.jsx("span",{className:"pi pi-plus"}),l.jsx(In,{})]})}),((M=(X=(ee=(me=A[K])==null?void 0:me.children[ne])==null?void 0:ee.children[ue])==null?void 0:X.children)==null?void 0:M.length)>1&&l.jsxs("button",{className:ie.togglerClassName,onClick:()=>{S(K,ne,ue,ye),g()},children:[l.jsx("span",{className:"pi pi-trash"}),l.jsx(In,{})]}),l.jsx("span",{className:"clone-tool","data-pr-tooltip":"Clone",children:l.jsxs("button",{className:ie.togglerClassName,onClick:()=>{T(t,K,ne,ue,ye),g()},children:[l.jsx("span",{className:"pi pi-clone"}),l.jsx(In,{})]})})]})]})]})};return l.jsxs("div",{style:w?{...wxe,opacity:P}:{},className:b?"form-builder-column container-column":"draggable form-builder-column container-column",children:[(u===Xc||u===qu||u===B1||u===U1||u===Uu)&&(c===!1?l.jsx(l.Fragment,{children:w===!0?l.jsxs(Pi,{className:"builder-row-column",header:"Column",toggleable:!0,headerTemplate:ie=>U(ie,i,a,s,o),children:[((F=t==null?void 0:t.children)==null?void 0:F.length)>0?(O=t==null?void 0:t.children)==null?void 0:O.map((ie,K)=>{const ne=`${r}-${K}`;return l.jsxs(k.Fragment,{children:[l.jsx(Ri,{isAdvanceView:w,fieldDropArea:!0,data:{path:ne,childrenCount:t.children.length,droppedField:t},onDrop:n}),q(ie,ne,i,a,s,o,K)]},ne)}):l.jsxs("span",{className:"pt-4 text-center text-primary",style:{display:"block",zIndex:-1,width:"99%"},children:["Please drop the element from the sidebar below",l.jsx("p",{children:l.jsx("i",{className:"pi pi-arrow-down py-2",style:{fontSize:"2em"}})})]}),l.jsx(Ri,{isAdvanceView:w,fieldDropArea:!0,data:{path:`${r}-${t.children.length}`,childrenCount:t.children.length,droppedField:t},onDrop:n,isLast:!0})]}):l.jsx(l.Fragment,{children:l.jsxs("div",{children:[((L=t==null?void 0:t.children)==null?void 0:L.length)>0?(J=t==null?void 0:t.children)==null?void 0:J.map((ie,K)=>{const ne=`${r}-${K}`;return l.jsxs(k.Fragment,{children:[l.jsx(Ri,{isAdvanceView:w,fieldDropArea:!0,data:{path:ne,childrenCount:t.children.length,droppedField:t},onDrop:n}),q(ie,ne,i,a,s,o,K)]},ne)}):l.jsx(l.Fragment,{children:l.jsxs("span",{className:"pt-4 text-center text-primary",style:{display:"block",zIndex:-1,width:"99%"},children:["Please drop the element from the sidebar below",l.jsx("p",{children:l.jsx("i",{className:"pi pi-arrow-down py-2",style:{fontSize:"2em"}})})]})}),l.jsx(Ri,{isAdvanceView:w,dropHereLastField:!0,fieldDropArea:!0,data:{path:`${r}-${t.children.length}`,childrenCount:t.children.length,droppedField:t},onDrop:n,isLast:!0})]})})}):l.jsx(l.Fragment,{children:(be=t==null?void 0:t.children)==null?void 0:be.map((ie,K)=>{const ne=`${r}-${K}`;return l.jsx(k.Fragment,{children:q(ie,ne,i,a,s,o,K)},ne)})})),u===Bu&&(c===!1?l.jsxs("div",{className:"builder-row-column",children:[((xe=t==null?void 0:t.children)==null?void 0:xe.length)>0?(le=t==null?void 0:t.children)==null?void 0:le.map((ie,K)=>{const ne=`${r}-${K}`;return l.jsxs(k.Fragment,{children:[l.jsx(Ri,{isAdvanceView:w,data:{path:ne,childrenCount:t.children.length,droppedField:t},onDrop:n}),q(ie,ne,i,a,s,o,K)]},ne)}):l.jsxs("span",{className:"pt-4 text-center text-primary",style:{display:"block"},children:["Please drop the element from the sidebar below",l.jsx("p",{children:l.jsx("i",{className:"pi pi-arrow-down py-2",style:{fontSize:"2em"}})})]}),l.jsx(Ri,{isAdvanceView:!0,data:{path:`${r}-${t.children.length}`,childrenCount:t.children.length,droppedField:t},onDrop:n,isLast:!0})]}):l.jsx(l.Fragment,{children:(Z=t==null?void 0:t.children)==null?void 0:Z.map((ie,K)=>{const ne=`${r}-${K}`;return l.jsx(k.Fragment,{children:q(ie,ne,i,a,s,o,K)},ne)})})),u===j1&&!c&&l.jsxs("div",{children:[(fe=t==null?void 0:t.children)==null?void 0:fe.map((ie,K)=>{const ne=`${r}-${K}`;return l.jsxs(k.Fragment,{children:[l.jsx(Ri,{fieldDropArea:!0,isAdvanceView:w,data:{path:ne,childrenCount:t.children.length,droppedField:t},onDrop:n}),q(ie,ne,i,a,s,o,K)]},ne)}),t.children.length===0&&l.jsx("p",{className:"text-center",children:"Add element by dragging and dropping element from the sidebar into the dropzone area"}),l.jsx(Ri,{fieldDropArea:!0,isAdvanceView:w,data:{path:`${r}-${t.children.length}`,childrenCount:t.children.length,droppedField:t},onDrop:n,isLast:!0})]}),u===Rd&&(c===!1?l.jsxs("div",{children:[t.children.length>0&&((Y=t==null?void 0:t.children)==null?void 0:Y.map((ie,K)=>{const ne=`${r}-${K}`;return l.jsxs(k.Fragment,{children:[l.jsx(Ri,{isAdvanceView:w,fieldDropArea:!0,data:{path:ne,childrenCount:t.children.length,droppedField:t},onDrop:n}),q(ie,ne,i,a,s,o,K)]},ne)})),t.children.length===0&&l.jsx("p",{className:"text-center",children:"Drag and drop from sidebar items"}),l.jsx(Ri,{isAdvanceView:w,dropHereLastField:!0,fieldDropArea:!0,data:{path:`${r}-${t.children.length}`,childrenCount:t.children.length,droppedField:t},onDrop:n,isLast:!0})]}):l.jsx(l.Fragment,{children:t.children.length>0?l.jsx(RU,{questions:t.children}):l.jsx("p",{className:"text-center",children:"No items to show"})}))]})},Cxe=t=>{var i,a,s;const{language:e,onHandleChange:n,stateRow:r}=t;return l.jsxs("form",{className:"p-fluid",children:[l.jsxs("div",{className:"field",children:[l.jsx("label",{children:"Row Heading"}),l.jsx(dn,{value:(i=r==null?void 0:r.heading)==null?void 0:i[e==null?void 0:e.type],onChange:o=>n("heading",e,o.target.value)})]}),l.jsxs("div",{className:"field",children:[l.jsx("label",{children:"Row Description"}),l.jsx(Ss,{value:(a=r==null?void 0:r.subHeadingText)==null?void 0:a[e==null?void 0:e.type],onChange:o=>n("subHeadingText",e,o.target.value)})]}),(r==null?void 0:r.rowIsRepeatable)===!0&&l.jsxs("div",{className:"field",children:[l.jsx("span",{className:"must-required",children:"*"})," ",l.jsx("label",{children:"Add To List Button Label"}),l.jsx(dn,{value:(s=r.addToListButtonLabel)==null?void 0:s[e==null?void 0:e.type],onChange:o=>n("addToListButtonLabel",e,o.target.value)})]})]})},Txe=t=>{const{stateRow:e,onHandleChangeAdvanceSetttings:n,renderType:r}=t;return l.jsxs("div",{className:"p-fluid",children:[r===Xc&&l.jsxs("div",{className:"field-checkbox",children:[l.jsx(Dr,{inputId:"rowIsRepeatable",checked:e==null?void 0:e.rowIsRepeatable,onChange:i=>n("rowIsRepeatable",i==null?void 0:i.checked)}),l.jsx("label",{htmlFor:"isRepeatable",children:"Row is repeatable ?"})]}),(e==null?void 0:e.rowIsRepeatable)&&l.jsxs("div",{className:"field",children:[l.jsx("span",{className:"must-required",children:"*"})," ",l.jsx("label",{children:"Row Minimum Entries"}),l.jsx(dn,{value:e==null?void 0:e.minimumEntries,onChange:i=>n("minimumEntries",i.target.value)})]}),l.jsxs("div",{className:"field-checkbox",children:[l.jsx(Dr,{inputId:"isManualEnumerationEnabled",checked:e==null?void 0:e.isManualEnumerationEnabled,onChange:i=>n("isManualEnumerationEnabled",i==null?void 0:i.checked)}),l.jsx("label",{htmlFor:"isManualEnumerationEnabled",children:"Enable manual enumeration for row components?"}),l.jsxs("small",{children:[" ","You need to set mannual enumeration for every component from its settings."," "]})]})]})},Exe=t=>{var g,m,b,w;const{onHandleChange:e,stateRow:n,onHandleChangePageMargin:r}=t,i=new fb,[a,s]=k.useState("");k.useEffect(()=>{},[]);const[o,c]=k.useState(null),u=()=>{},d=x=>{e("bgImage",x==null?void 0:x.url)},f=[{icon:"pi pi-image",value:"image"},{icon:"pi pi-palette ",value:"color"},{icon:"pi pi-microsoft ",value:"gradient"}],p=x=>l.jsx("i",{className:x.icon});return l.jsxs("div",{className:"",children:[l.jsxs("div",{className:" field",children:[l.jsxs("div",{className:"grid",children:[l.jsxs("div",{className:"field col-2 md:col-3",children:[l.jsx("label",{children:"Left"}),l.jsx(Ra,{value:(g=n==null?void 0:n.margin)==null?void 0:g.left,onChange:x=>{r("left",x.value)},mode:"decimal",showButtons:!0,min:0,max:100})]}),l.jsxs("div",{className:"field col-2 md:col-3",children:[l.jsx("label",{children:"Right"}),l.jsx(Ra,{value:(m=n==null?void 0:n.margin)==null?void 0:m.right,onChange:x=>{r("right",x.value)},mode:"decimal",showButtons:!0,min:0,max:100})]}),l.jsxs("div",{className:"field col-2 md:col-3",children:[l.jsx("label",{children:"Top"}),l.jsx(Ra,{value:(b=n==null?void 0:n.margin)==null?void 0:b.top,onChange:x=>{r("top",x.value)},mode:"decimal",showButtons:!0,min:0,max:100})]}),l.jsxs("div",{className:"field col-2 md:col-3",children:[l.jsx("label",{children:"Bottom"}),l.jsx(Ra,{value:(w=n==null?void 0:n.margin)==null?void 0:w.bottom,onChange:x=>{r("bottom",x.value)},mode:"decimal",showButtons:!0,min:0,max:100})]})]}),l.jsx("label",{children:"Background Type"}),l.jsx(V1,{value:n==null?void 0:n.bgType,options:f,onChange:x=>e("bgType",x.value),itemTemplate:p,optionLabel:"value"})]}),(n==null?void 0:n.bgType)==="color"&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"p-fluid field",children:l.jsx(Xd,{value:(n==null?void 0:n.bgColor)||"",onChange:x=>e("bgColor",x.value)})}),l.jsx(Xd,{value:(n==null?void 0:n.bgColor)||"",onChange:x=>e("bgColor",x.value),inline:!0})]}),(n==null?void 0:n.bgType)==="image"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"p-fluid field",children:[l.jsx("span",{className:"must-required",children:"*"}),l.jsx("label",{children:"Background image"}),l.jsx(dn,{value:(n==null?void 0:n.bgImage)||"",onChange:x=>e("bgImage",x.target.value),placeholder:"enter page title",id:"page_title",name:"page_title"})]}),l.jsxs("div",{className:"shadow-2 border-round surface-card p-4",children:[l.jsx("div",{className:"flex align-items-center justify-content-between mb-4",children:l.jsx("span",{className:"text-xl font-medium text-900",children:"Selected Files"})}),l.jsx("h5",{children:"Media Library"}),l.jsxs("div",{className:"grid",children:[l.jsx("div",{className:"col-8",children:l.jsxs("div",{className:"grid",children:[l.jsx("div",{className:"col-12 mb-5",children:l.jsxs("div",{className:"p-inputgroup",children:[l.jsx(dn,{placeholder:"Keyword",onChange:x=>s(x.target.value)}),l.jsx(Rt,{text:!0,icon:"pi pi-search",className:"p-button-info",onClick:()=>u()})]})}),l.jsx("div",{className:"col-12 mb-5",children:l.jsx("div",{className:"surface-section ",children:l.jsx("div",{className:"grid -mt-3 -ml-3 -mr-3"})})})]})}),l.jsx("div",{className:"col-4 card",children:o!==null&&l.jsxs("div",{className:"surface-card p-4 shadow-2 border-round",children:[l.jsx("img",{style:{height:"150px",width:"150px",objectFit:"contain"},src:o==null?void 0:o.url,className:"w-full mb-3 border-round-2xl",onError:x=>x.target.src="https://www.primefaces.org/wp-content/uploads/2020/05/placeholder.png",alt:"https://www.primefaces.org/wp-content/uploads/2020/05/placeholder.png"}),l.jsxs("ul",{className:"list-none p-0 m-0 border-top-1 surface-border",children:[l.jsxs("li",{className:"flex align-items-center py-1 px-2 flex-wrap surface-ground",children:[l.jsx("div",{className:"text-500 w-full md:w-4 font-medium",children:"Name"}),l.jsx("div",{className:"text-900 w-full md:w-8",children:o==null?void 0:o.name})]}),l.jsxs("li",{className:"flex align-items-center py-1 px-2 flex-wrap",children:[l.jsx("div",{className:"text-500 w-full md:w-4 font-medium",children:"Base URL:"}),l.jsx("div",{className:"text-900 w-full md:w-8 line-height-3",style:{wordWrap:"break-word"},children:l.jsx("a",{href:o==null?void 0:o.url,children:o==null?void 0:o.url})})]}),l.jsxs("li",{className:"flex align-items-center py-1 px-2 flex-wrap surface-ground",children:[l.jsx("div",{className:"text-500 w-full md:w-4 font-medium",children:"Base Name:"}),l.jsx("div",{className:"text-900 w-full md:w-8",children:o==null?void 0:o.basename})]}),l.jsxs("li",{className:"flex align-items-center py-1 px-2 flex-wrap",children:[l.jsx("div",{className:"text-500 w-full md:w-4 font-medium",children:"Dir Name:"}),l.jsx("div",{className:"text-900 w-full md:w-8",children:o==null?void 0:o.dirname})]}),l.jsxs("li",{className:"flex align-items-center py-1 px-2 flex-wrap surface-ground",children:[l.jsx("div",{className:"text-500 w-full md:w-4 font-medium",children:"Size:"}),l.jsx("div",{className:"text-900 w-full md:w-8",children:i.formatBytes(o==null?void 0:o.size)})]}),l.jsxs("li",{className:"flex align-items-center py-1 px-2 flex-wrap surface-ground",children:[l.jsx("div",{className:"text-500 w-full md:w-4 font-medium",children:"Creation Date:"}),l.jsx("div",{className:"text-900 w-full md:w-8",children:Nn(o==null?void 0:o.created_at).format("Do MMM YYYY - HH:mm")})]})]}),l.jsx(Rt,{text:!0,className:"mt-3 w-full",label:"Set Image",onClick:()=>d(o),"aria-label":"Update"})]})})]})]})]})]})},_xe=t=>{const{stateRow:e,setstateRow:n}=t,[r,i]=k.useState(""),[a,s]=k.useState([""]),[o,c]=k.useState(!1),[u,d]=k.useState(0),[f,p]=k.useState(!1),g=()=>{p(!0)},m=()=>{var L;const F=((L=e==null?void 0:e.reviewerChecklist)==null?void 0:L.length)>=0?[...e.reviewerChecklist]:[];F.push({uuid:Ze(),checklist:r,action:a,agree:null,selectAction:[],other:{isOther:!1,description:""},reviewerComments:""});const O={...e,reviewerChecklist:F};n(O),p(!1),i(""),s([""])},b=()=>{p(!1),i(""),s([""])},w=F=>{const O=[...e.reviewerChecklist];O.splice(F,1);const L={...e,reviewerChecklist:O};n(L)},x=(F,O)=>{c(!0);const{checklist:L,action:J}=F;p(!0),d(O),setTimeout(()=>{i(L),s(J)},1e3)},S=(F,O)=>l.jsxs(l.Fragment,{children:[l.jsx(Rt,{text:!0,type:"button",className:"p-button-info",icon:"pi pi-pencil",onClick:()=>x(F,O==null?void 0:O.rowIndex),size:"small"}),l.jsx(Rt,{text:!0,type:"button",className:"p-button-danger",icon:"pi pi-trash",onClick:()=>w(O==null?void 0:O.rowIndex),size:"small"})]}),C=F=>{var O;return l.jsx(l.Fragment,{children:(O=F==null?void 0:F.action)==null?void 0:O.length})},T=F=>{const O=[...a];O.splice(F,1),s(O)},A=()=>{const F=[...e.reviewerChecklist];F[u]={checklist:r,action:a};const O={...e,reviewerChecklist:F};n(O),p(!1),c(!1)},I=()=>l.jsx("div",{children:o?l.jsx(Rt,{text:!0,className:"mb-5 p-button-success",label:"Edit Checklist",onClick:()=>{A()}}):l.jsx(Rt,{text:!0,className:"mb-5 p-button-success",label:"Add Checklist",onClick:()=>{m()}})}),_=F=>{n(O=>({...O,reviewerChecklist:F==null?void 0:F.value}))},P=F=>{navigator.clipboard.writeText(JSON.stringify(F))};function q(F){try{JSON.parse(F)}catch{return!1}return!0}const U=async()=>{var O;const F=await navigator.clipboard.readText();if(q(F)){const L=JSON.parse(F);if((O=L[0])!=null&&O.checklist){const J={...St.cloneDeep(e),reviewerChecklist:L};n(J);return}}};return l.jsxs("div",{children:[l.jsxs(Ms,{maximizable:!0,header:"Add Checklist",visible:f,style:{width:"30vw"},onHide:()=>b(),footer:I(),children:[l.jsx("h5",{children:"Checklist"}),l.jsx(Ss,{rows:2,cols:50,value:r,onChange:F=>{var O;i((O=F==null?void 0:F.target)==null?void 0:O.value)}}),l.jsx("h5",{children:"Actions when user selects No"}),a.map((F,O)=>l.jsxs("div",{children:[O+1,"."," ",l.jsx(Ss,{value:F,onChange:L=>{var be;const J=[...a];J[O]=(be=L==null?void 0:L.target)==null?void 0:be.value,s(J)},rows:2,cols:50})," ",l.jsx(Rt,{text:!0,type:"button",icon:"pi pi-trash",className:"p-button-danger",onClick:()=>T(O)}),l.jsx("br",{}),l.jsx("br",{})]},`actionIndex-${O}`)),l.jsx(Rt,{text:!0,className:" p-button-info mr-2",onClick:()=>{s([...a,""])},children:"Add Action"})]})," ",l.jsx("h5",{children:"Reviewer Checklist"}),l.jsx(Rt,{text:!0,className:"mb-5 mr-2 p-button-success",label:"Add Review Checklist",onClick:()=>{g()}}),l.jsx(Rt,{text:!0,label:"Copy Schema ",onClick:()=>{P([...(e==null?void 0:e.reviewerChecklist)||[]])},className:"mb-5 mr-2"}),l.jsx(Rt,{text:!0,label:"Paste Checklist ",onClick:()=>{U()},className:"mb-5 p-button-info"}),l.jsx("div",{className:"card",children:l.jsxs($o,{value:e==null?void 0:e.reviewerChecklist,reorderableRows:!0,onRowReorder:_,children:[l.jsx(Ar,{rowReorder:!0,style:{width:"3em"}}),l.jsx(Ar,{field:"checklist",header:"Checklist"}),l.jsx(Ar,{field:"actions",header:"Actions",body:F=>C(F)}),l.jsx(Ar,{header:"",body:(F,O)=>S(F,O)})]})})]})},Ixe=t=>{var T;const{visibilty:e,setVisibility:n,row:r,pageIndex:i,sectionIndex:a,rowIndex:s,renderType:o,emitSocketData:c}=t,{formBuilderSchemaLanguages:u,rowSettingUpdate:d,userSelectedLanguage:f,formBuilderPublishedStatus:p}=xn(),[g,m]=k.useState(r),b=(A,I,_)=>{m(P=>({...P,[A]:{...P[A],[I==null?void 0:I.type]:_}}))},w=(A,I)=>{m(_=>({..._,[A]:I}))},x=()=>{const A={...g,children:r==null?void 0:r.children};d(i,a,s,A),c()},S=(A,I)=>{let _=g;_={..._,margin:{..._.margin,[A]:I}},m(_)},C=(A,I)=>{m(_=>({..._,[A]:I}))};return l.jsx(l.Fragment,{children:l.jsxs(vo,{visible:e,position:"left",className:"p-sidebar-lg",onHide:()=>n(!1),children:[l.jsxs("div",{className:"flex justify-content-between flex-wrap card-container ",children:[l.jsxs("div",{className:"flex align-items-center justify-content-center ",children:[" ",l.jsxs("h5",{children:["Row Settings - ",(T=r==null?void 0:r.heading)==null?void 0:T[f==null?void 0:f.type]]})," "]}),!p&&l.jsx("div",{className:"flex align-items-center justify-content-center",children:l.jsx(Rt,{className:"mt-3",label:"Update",onClick:()=>x(),"aria-label":"Update"})})]}),l.jsxs(Ya,{children:[l.jsx(tr,{header:"Text",children:l.jsx(Ws,{activeIndex:0,children:u!=null&&u.length?u.map((A,I)=>l.jsx(Gs,{tabIndex:I,header:A==null?void 0:A.language,children:l.jsx(Cxe,{language:A,stateRow:g,onHandleChange:b,...t})},I)):""})}),l.jsx(tr,{header:"Advance",children:l.jsx(Txe,{stateRow:g,onHandleChangeAdvanceSetttings:w,onHandleSubmitTextUpdate:x,renderType:o})}),l.jsx(tr,{header:"Layout",children:l.jsxs("div",{className:"p-fluid",children:[l.jsxs("div",{className:"field-checkbox",children:[l.jsx(Dr,{inputId:"showRowTitle",checked:g==null?void 0:g.showRowTitle,onChange:A=>w("showRowTitle",A==null?void 0:A.checked)}),l.jsx("label",{htmlFor:"showRowTitle",children:"Show Row Title?"})]}),l.jsxs("div",{className:"field-checkbox",children:[l.jsx(Dr,{inputId:"showRowSubTitle",checked:g==null?void 0:g.showRowSubTitle,onChange:A=>w("showRowSubTitle",A==null?void 0:A.checked)}),l.jsx("label",{htmlFor:"showRowSubTitle",children:"Show Row Sub Title?"})]})]})}),l.jsx(tr,{header:"Styling",children:l.jsx(Exe,{stateRow:g,onHandleChange:C,onHandleChangePageMargin:S,...t})}),(g==null?void 0:g.rowIsRepeatable)===!0&&l.jsx(tr,{header:"Admin",children:l.jsx(_xe,{stateRow:g,setstateRow:m})})]})]})})},Dxe={},Oxe=({data:t,components:e,handleDrop:n,path:r,pageIndex:i,sectionIndex:a,rowIndex:s,isPreview:o,renderType:c,section:u,isAdmin:d,emitSocketData:f,page:p,isRenderView:g,isAdvanceView:m})=>{var Ee,Fe,Te,me,ee,X,M,W,G,he,Ne,Se,Ae,Ve,se,pe;const b=k.useRef(null),{removeRow:w,addRow:x,cloneRow:S,formBuilderFormLayout:C,userSelectedLanguage:T}=xn(),{userTaskSubmitFormData:A,taskRegisterData:I,updateTaskRegisterData:_,updateTaskProgressValue:P,addUserDataFormSectionRepeatableData:q,removeUserDataFormSectionRepeatableData:U,task_status:F,TASK_PUBLISHED:O}=si(),[L,J]=k.useState(!1),[{isDragging:be},xe]=Yd({type:vp,item:{type:vp,uuid:t.uuid,children:t.children,path:r,data:t},collect:z=>({isDragging:z.isDragging()})}),le=be?.25:1;xe(b);const Z=(z,te,oe,de,ge,Ie)=>l.jsx(Sxe,{isAdvanceView:m,page:p,row:t,section:u,renderType:c,isPreview:o,isRenderView:g,data:z,components:e,handleDrop:n,path:te,pageIndex:oe,sectionIndex:de,rowIndex:ge,columnIndex:Ie,isAdmin:d,emitSocketData:f},`column-${r}-${z.uuid}`),fe=(z,te,oe,de)=>{var nt,it,Nt,gt;const ge=z.collapsed?"pi pi-chevron-down":"pi pi-chevron-up",Ie=`${z.className} justify-content-space-between`,$e=`${z.titleClassName} pl-1 text-primary`;return l.jsxs(l.Fragment,{children:[l.jsx(vn,{target:".clone-tool"}),l.jsx(vn,{target:".setting-tool"}),l.jsx(vn,{target:".add-row-tool"}),l.jsxs("div",{className:Ie,children:[l.jsxs("span",{ref:o===!1?b:null,children:[l.jsx("button",{className:z.togglerClassName,children:l.jsx("span",{className:"pi pi-sliders-h dragabble"})}),l.jsxs("button",{className:z.togglerClassName,onClick:z.onTogglerClick,children:[l.jsx("span",{className:ge}),l.jsx(In,{})]}),l.jsxs("span",{className:$e,children:["Row:"," ",((nt=t==null?void 0:t.heading)==null?void 0:nt[T==null?void 0:T.type])!==""?(it=t==null?void 0:t.heading)==null?void 0:it[T==null?void 0:T.type]:"Untitled"]})]}),o===!1&&l.jsxs("div",{className:"p-panel-icons",children:[l.jsx("span",{className:"add-row-tool","data-pr-tooltip":"Add Row",children:l.jsxs("button",{className:z.togglerClassName,onClick:()=>{x(te,oe),f()},children:[l.jsx("span",{className:"pi pi-plus"}),l.jsx(In,{})]})}),((gt=(Nt=C[te])==null?void 0:Nt.children[oe])==null?void 0:gt.children.length)>1&&l.jsxs("button",{className:z.togglerClassName,onClick:()=>{w(te,oe,de),f()},children:[l.jsx("span",{className:"pi pi-trash"}),l.jsx(In,{})]}),l.jsx("span",{className:"clone-tool","data-pr-tooltip":"Clone",children:l.jsxs("button",{className:z.togglerClassName,onClick:()=>{S(t,te,oe,de),f()},children:[l.jsx("span",{className:"pi pi-clone"}),l.jsx(In,{})]})}),l.jsx("span",{className:"setting-tool","data-pr-tooltip":"Settings",children:l.jsxs("button",{onClick:()=>J(!0),className:z.togglerClassName,children:[l.jsx("span",{className:"pi pi-cog"}),l.jsx(In,{})]})})]})]})]})},Y=St.findIndex(A,function(z){return(z==null?void 0:z.rowId)===(t==null?void 0:t.uuid)}),ie=()=>{var oe,de,ge;const z=St.cloneDeep(I);((de=(oe=A[Y])==null?void 0:oe.repeatableFieldsData)==null?void 0:de.length)>=(t==null?void 0:t.minimumEntries)?z[t==null?void 0:t.uuid]=(ge=A[Y])==null?void 0:ge.repeatableFields:delete z[t==null?void 0:t.uuid];const te=Object.keys(z).length;_(z),P(te)},K=(Ee=t==null?void 0:t.repeatableFields)==null?void 0:Ee.map(z=>{var te;return{fieldUuid:z==null?void 0:z.uuid,field:z==null?void 0:z.uuid,header:(te=z==null?void 0:z.label)==null?void 0:te.english}}),ne=K==null?void 0:K.map(z=>l.jsx(Ar,{field:z.field,header:z.header,body:te=>l.jsx(l.Fragment,{children:l.jsx("div",{className:"post__content_repetable",dangerouslySetInnerHTML:{__html:te[z==null?void 0:z.field]}})})},z.field)),ue=()=>{var de;const z=[...A],te=[];let oe=!0;e:for(const[,ge]of t.children.entries()){for(const[,Ie]of ge.children.entries())if(console.log("field.isValid",Ie.isValid),Ie!=null&&Ie.isPostField&&Ie.isValid!==1){const $e={fieldId:Ie.uuid,rowIndex:s};console.log("inValidData",$e),te.push($e),an.emit("OnInvalidFieldCatch",$e),oe=!1;break e}oe=!0}oe&&(te==null?void 0:te.length)===0&&(q(t==null?void 0:t.uuid,(de=z[Y])==null?void 0:de.repeatableFields),an.emit("clearRepeatableFields",t==null?void 0:t.uuid),ie())},ye=(z,te)=>l.jsx(l.Fragment,{children:l.jsx(Rt,{text:!0,type:"button",className:"p-button-danger ",onClick:()=>{U(t==null?void 0:t.uuid,te==null?void 0:te.rowIndex),setTimeout(()=>{ie()},1e3)},icon:"pi pi-trash"})});return l.jsxs("div",{style:{...Dxe,opacity:le,marginTop:`${(Fe=t==null?void 0:t.margin)==null?void 0:Fe.top}px`,marginBottom:`${(Te=t==null?void 0:t.margin)==null?void 0:Te.bottom}px`,marginLeft:`${(me=t==null?void 0:t.margin)==null?void 0:me.left}px`,marginRight:`${(ee=t==null?void 0:t.margin)==null?void 0:ee.right}px`},className:g?"row container-row":"draggable row container-row",children:[L&&l.jsx(Ixe,{renderType:c,visibilty:L,setVisibility:J,row:t,pageIndex:i,sectionIndex:a,rowIndex:s,emitSocketData:f},"row_settings_"+i+a+s),c===j1&&l.jsxs("div",{className:"form-builder-columns",children:[t.children.map((z,te)=>{const oe=`${r}-${te}`;return l.jsxs(k.Fragment,{children:[c===Rd&&l.jsx(Ri,{isAdvanceView:m,data:{path:oe,childrenCount:t.children.length},onDrop:n,className:"horizontalDrag"}),Z(z,oe,i,a,s,te)]},oe)}),l.jsx(Ri,{isAdvanceView:m,data:{path:`${r}-${t.children.length}`,childrenCount:t.children.length},onDrop:n,className:"horizontalDrag",isLast:!0})]}),(c===qu||c===Xc||c===B1||c===U1||c===Uu)&&(o===!1?l.jsx(l.Fragment,{children:m===!0?l.jsx(Pi,{header:"Row",toggleable:!0,headerTemplate:z=>fe(z,i,a,s),children:l.jsxs("div",{className:"form-builder-columns",style:{overflowX:"auto"},children:[(X=t==null?void 0:t.children)==null?void 0:X.map((z,te)=>{const oe=`${r}-${te}`;return l.jsxs(k.Fragment,{children:[l.jsx(Ri,{isAdvanceView:m,data:{path:oe,childrenCount:t.children.length},onDrop:n,className:"horizontalDrag"}),Z(z,oe,i,a,s,te)]},oe)}),l.jsx(Ri,{isAdvanceView:m,data:{path:`${r}-${t.children.length}`,childrenCount:t.children.length},onDrop:n,className:"horizontalDrag",isLast:!0})]})}):l.jsx(l.Fragment,{children:l.jsx("div",{className:m?"form-builder-columns":"",style:m?{overflowX:"auto"}:{},children:(M=t==null?void 0:t.children)==null?void 0:M.map((z,te)=>{const oe=`${r}-${te}`;return l.jsx(k.Fragment,{children:Z(z,oe,i,a,s,te)},oe)})})})}):l.jsx(l.Fragment,{children:!(t!=null&&t.rowIsRepeatable&&F===O)&&l.jsxs(l.Fragment,{children:[l.jsx("h5",{children:(W=t==null?void 0:t.heading)==null?void 0:W[T==null?void 0:T.type]}),l.jsx("span",{children:(G=t==null?void 0:t.subHeadingText)==null?void 0:G[T==null?void 0:T.type]}),l.jsx("div",{className:"form-builder-columns",children:t.children.map((z,te)=>{const oe=`${r}-${te}`;return l.jsx(k.Fragment,{children:Z(z,oe,i,a,s,te)},oe)})})]})})),c===Bu&&(o===!1?l.jsxs("div",{children:[l.jsx("span",{className:"row-setting-block-pdf-editor",children:l.jsxs("div",{className:"pdf-setting-container",children:[l.jsxs("button",{onClick:()=>{x(i,a),f()},children:[l.jsx("span",{className:"pi pi-plus"}),l.jsx(In,{})]}),((Ne=(he=C[i])==null?void 0:he.children[a])==null?void 0:Ne.children.length)>1&&l.jsxs("button",{onClick:()=>{w(i,a,s),f()},children:[l.jsx("span",{className:"pi pi-trash"}),l.jsx(In,{})]}),l.jsxs("button",{onClick:()=>{S(t,i,a,s),f()},children:[l.jsx("span",{className:"pi pi-clone"}),l.jsx(In,{})]}),l.jsxs("button",{onClick:()=>J(!0),children:[l.jsx("span",{className:"pi pi-cog"}),l.jsx(In,{})]})]})}),l.jsx("div",{className:"form-builder-columns",children:(Se=t==null?void 0:t.children)==null?void 0:Se.map((z,te)=>{const oe=`${r}-${te}`;return l.jsx(k.Fragment,{children:Z(z,oe,i,a,s,te)},oe)})})]}):l.jsx(l.Fragment,{children:!(t!=null&&t.rowIsRepeatable&&F===O)&&l.jsxs(l.Fragment,{children:[l.jsx("h5",{children:(Ae=t==null?void 0:t.heading)==null?void 0:Ae[T==null?void 0:T.type]}),l.jsx("span",{children:(Ve=t==null?void 0:t.subHeadingText)==null?void 0:Ve[T==null?void 0:T.type]}),l.jsx("div",{className:"form-builder-columns",children:t.children.map((z,te)=>{const oe=`${r}-${te}`;return l.jsx(k.Fragment,{children:Z(z,oe,i,a,s,te)},oe)})})]})})),c===Rd&&l.jsx("div",{className:"form-builder-columns",children:t.children.map((z,te)=>{const oe=`${r}-${te}`;return l.jsx(k.Fragment,{children:Z(z,oe,i,a,s,te)},oe)})}),(t==null?void 0:t.rowIsRepeatable)&&F!==O&&l.jsx(Rt,{text:!0,type:"button",className:"p-button-success mb-3",onClick:()=>ue(),label:(se=t.addToListButtonLabel)==null?void 0:se[T==null?void 0:T.type]}),(t==null?void 0:t.rowIsRepeatable)&&l.jsxs("div",{className:"card",children:[l.jsxs($o,{value:(A==null?void 0:A.length)>0?(pe=A[Y])==null?void 0:pe.repeatableFieldsData:[],children:[ne,F!==O&&l.jsx(Ar,{style:{width:"10%"},headerStyle:{textAlign:"center"},bodyStyle:{textAlign:"left",overflow:"visible"},body:(z,te)=>ye(z,te)})]}),d&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{}),l.jsx(Ii,{field:t})]})]})]})},Nxe=t=>{var i,a;const{language:e,onHandleChange:n,stateSection:r}=t;return l.jsxs("form",{className:"p-fluid",children:[l.jsxs("div",{className:"field",children:[l.jsx("label",{children:"Section Heading"}),l.jsx(dn,{value:(i=r.heading)==null?void 0:i[e==null?void 0:e.type],onChange:s=>n("heading",e,s.target.value)})]}),l.jsxs("div",{className:"field",children:[l.jsx("label",{children:"Section Description"}),l.jsx(Ss,{value:(a=r.subHeadingText)==null?void 0:a[e==null?void 0:e.type],onChange:s=>n("subHeadingText",e,s.target.value)})]})]})},Fxe=t=>{const{visibilty:e,setVisibility:n,section:r,pageIndex:i,sectionIndex:a,emitSocketData:s}=t,{formBuilderSchemaLanguages:o,sectionSettingUpdate:c,userSelectedLanguage:u,formBuilderPublishedStatus:d}=xn(),[f,p]=k.useState(r),g=(w,x,S)=>{p(C=>({...C,[w]:{...C[w],[x==null?void 0:x.type]:S}}))},m=(w,x)=>{p(S=>({...S,[w]:x}))},b=()=>{const w={...f,children:r==null?void 0:r.children};c(i,a,w),s()};return l.jsx(l.Fragment,{children:l.jsxs(vo,{visible:e,position:"left",className:"p-sidebar-lg",onHide:()=>n(!1),children:[l.jsxs("div",{className:"flex justify-content-between flex-wrap card-container ",children:[l.jsxs("div",{className:"flex align-items-center justify-content-center ",children:[" ",l.jsxs("h5",{children:["Section Settings - ",r==null?void 0:r.heading[u==null?void 0:u.type]," "]})," "]}),!d&&l.jsx("div",{className:"flex align-items-center justify-content-center",children:l.jsx(Rt,{className:"mt-3",label:"Update",onClick:()=>b(),"aria-label":"Update"})})]}),l.jsxs(Ya,{children:[l.jsx(tr,{header:"Text",children:l.jsx(Ws,{activeIndex:0,children:o!=null&&o.length?o.map((w,x)=>l.jsx(Gs,{tabIndex:x,header:w==null?void 0:w.language,children:l.jsx(Nxe,{language:w,stateSection:f,onHandleChange:g,...t})},x)):""})}),l.jsx(tr,{header:"Layout",children:l.jsxs("div",{className:"p-fluid",children:[l.jsxs("div",{className:"field-checkbox",children:[l.jsx(Dr,{inputId:"showSectionTitle",checked:f==null?void 0:f.showSectionHeader,onChange:w=>m("showSectionHeader",w==null?void 0:w.checked)}),l.jsx("label",{htmlFor:"showSectionTitle",children:"Show Section header?"})]}),l.jsxs("div",{className:"field-checkbox",children:[l.jsx(Dr,{inputId:"showSectionTitle",checked:f==null?void 0:f.showSectionTitle,onChange:w=>m("showSectionTitle",w==null?void 0:w.checked)}),l.jsx("label",{htmlFor:"showSectionTitle",children:"Show Section Title?"})]}),l.jsxs("div",{className:"field-checkbox",children:[l.jsx(Dr,{inputId:"showSectionSubTitle",checked:f==null?void 0:f.showSectionSubTitle,onChange:w=>m("showSectionSubTitle",w==null?void 0:w.checked)}),l.jsx("label",{htmlFor:"showSectionSubTitle",children:"Show Section Sub Title?"})]})]})})]})]})})},Pxe=t=>{const{saveBuilderElementModalData:e,saveElementModal:n,setSaveElementModal:r}=t,i=W8({initialValues:{builder_element_title:"",builder_element_description:""},validate:o=>{const c={};return o.builder_element_title||(c.builder_element_title="Title is required."),o.builder_element_description||(c.builder_element_description="Description is required."),c},onSubmit:o=>{({...o,reusable_template_schema:e==null||e.reusable_template_schema},r(!1))}}),a=o=>!!(i.touched[o]&&i.errors[o]),s=()=>l.jsx("div",{children:l.jsx(Rt,{text:!0,className:"p-button-success",label:"Save",icon:"pi pi-file",onClick:()=>{i.handleSubmit()},autoFocus:!0})});return l.jsxs(Ms,{header:"Save Custom Element",visible:n,style:{width:"20vw"},footer:s(),onHide:()=>r(!1),children:[l.jsxs("div",{className:"p-field field",children:[l.jsxs("label",{htmlFor:"username",children:[l.jsx("span",{className:"must-required",children:"*"})," Builder element title"]}),l.jsx(dn,{id:"builder_element_title",name:"builder_element_title",value:i.values.builder_element_title,onChange:i.handleChange,className:`${Km({invalid:a("builder_element_title")})} w-full`})]}),l.jsxs("div",{className:"p-field field",children:[l.jsxs("label",{htmlFor:"username",children:[l.jsx("span",{className:"must-required",children:"*"})," Builder element description"]}),l.jsx(Ss,{id:"builder_element_description",name:"builder_element_description",value:i.values.builder_element_description,onChange:i.handleChange,className:`${Km({invalid:a("builder_element_title")})} w-full`})]})]})},Mxe=({data:t,components:e,handleDrop:n,path:r,pageIndex:i,sectionIndex:a,isPreview:s,renderType:o,section:c,isAdmin:u,emitSocketData:d,page:f,isRenderView:p,isAdvanceView:g})=>{var Z,fe,Y,ie,K,ne,ue,ye,Ee,Fe,Te,me,ee;const{removeSection:m,addSection:b,cloneSection:w,formBuilderFormLayout:x,userSelectedLanguage:S}=xn(),[C,T]=k.useState(!1),[A,I]=k.useState(!1),[_,P]=k.useState(null),[q,U]=k.useState(!1),F=k.useRef(null),O=(X,M)=>{P(W=>({...W,[X]:M}))},[{isDragging:L},J]=Yd({type:Hd,item:{type:Hd,uuid:t.uuid,children:t.children,path:r},collect:X=>({isDragging:X.isDragging()})}),be=L?.25:1;J(F);const xe=(X,M,W,G,he)=>l.jsx(Oxe,{page:f,isRenderView:p,isAdvanceView:g,section:c,renderType:o,isPreview:s,data:X,components:e,handleDrop:n,path:M,pageIndex:W,sectionIndex:G,rowIndex:he,isAdmin:u,emitSocketData:d},`row-${r}-${X.uuid}`),le=(X,M,W)=>{var Se,Ae;const G=X.collapsed?"pi pi-chevron-down":"pi pi-chevron-up",he=`${X.className} justify-content-space-between panel-tab-section`,Ne=`${X.titleClassName} pl-1 text-primary`;return l.jsxs("div",{className:he,children:[l.jsxs("span",{ref:s===!1?F:null,children:[l.jsx("button",{className:X.togglerClassName,children:l.jsx("span",{className:"pi pi-sliders-h dragabble"})}),l.jsxs("button",{className:X.togglerClassName,onClick:X.onTogglerClick,children:[l.jsx("span",{className:G}),l.jsx(In,{})]}),l.jsxs("span",{className:Ne,children:[W+1," ",(Se=t==null?void 0:t.heading)==null?void 0:Se[S==null?void 0:S.type]]})]}),s===!1&&l.jsxs(l.Fragment,{children:[l.jsx(vn,{target:".clone-tool"}),l.jsx(vn,{target:".del-tool"}),l.jsx(vn,{target:".setting-tool"}),l.jsx(vn,{target:".add-section-tool"}),l.jsx(vn,{target:".save-tool"}),l.jsx(vn,{target:".settings-tool"}),l.jsxs("div",{className:"p-panel-icons",children:[l.jsx("span",{className:"add-section-tool","data-pr-tooltip":"Add Section",children:l.jsxs("button",{className:X.togglerClassName,onClick:()=>{b(M),d()},children:[l.jsx("span",{className:"pi pi-plus"}),l.jsx(In,{})]})}),((Ae=x[M])==null?void 0:Ae.children.length)>1&&l.jsx("span",{className:"del-tool","data-pr-tooltip":"Delete",children:l.jsxs("button",{className:X.togglerClassName,onClick:()=>{m(M,W),d()},children:[l.jsx("span",{className:"pi pi-trash"}),l.jsx(In,{})]})}),l.jsx("span",{className:"save-tool","data-pr-tooltip":"Save",children:l.jsxs("button",{className:X.togglerClassName,onClick:()=>{O("reusable_template_schema",t),I(!0)},children:[l.jsx("span",{className:"pi pi-save"}),l.jsx(In,{})]})}),l.jsx("span",{className:"clone-tool","data-pr-tooltip":"Clone",children:l.jsxs("button",{className:X.togglerClassName,onClick:()=>{w(t,M,W),d()},children:[l.jsx("span",{className:"pi pi-clone"}),l.jsx(In,{})]})}),l.jsx("span",{className:"settings-tool","data-pr-tooltip":"Settings",children:l.jsxs("button",{className:X.togglerClassName,onClick:()=>T(!0),children:[l.jsx("span",{className:"pi pi-cog"}),l.jsx(In,{})]})})]})]})]})};return l.jsxs("div",{style:{opacity:be,marginBottom:20},className:g?"draggable row":"",children:[s===!1&&l.jsx(Pxe,{saveBuilderElementModalData:_,setSaveBuilderElementModalData:P,saveElementModal:A,setSaveElementModal:I}),C===!0&&l.jsx(Fxe,{renderType:o,visibilty:C,setVisibility:T,section:t,pageIndex:i,sectionIndex:a,emitSocketData:d},"section_settings_"+i+a),o===j1&&(s===!1?l.jsxs(Pi,{className:"mb-5",header:(Z=t==null?void 0:t.heading)==null?void 0:Z.english,toggleable:!0,headerTemplate:X=>le(X,i,a),children:[l.jsx("p",{children:(fe=t==null?void 0:t.subHeadingText)==null?void 0:fe[S==null?void 0:S.type]}),l.jsxs("div",{className:"",children:[t.children.map((X,M)=>{const W=`${r}-${M}`;return l.jsx(k.Fragment,{children:xe(X,W,i,a,M)},W)}),l.jsx(Ri,{isAdvanceView:g,data:{path:`${r}-${t.children.length}`,childrenCount:t.children.length},onDrop:n,className:"horizontalDrag",isLast:!0})]})]}):l.jsx(l.Fragment,{})),(o===qu||o===Xc||o===B1||o===U1||o===Uu)&&(s===!1?l.jsx(l.Fragment,{children:g===!0?l.jsxs(Pi,{header:(Y=t==null?void 0:t.heading)==null?void 0:Y.english,toggleable:!0,headerTemplate:X=>le(X,i,a),onMouseEnter:()=>U(!0),onMouseLeave:()=>U(!1),children:[((ie=t==null?void 0:t.subHeadingText)==null?void 0:ie[S==null?void 0:S.type])&&l.jsx("p",{children:(K=t==null?void 0:t.subHeadingText)==null?void 0:K[S==null?void 0:S.type]}),l.jsxs("div",{children:[t.children.map((X,M)=>{const W=`${r}-${M}`;return l.jsxs(k.Fragment,{children:[l.jsx(Ri,{isAdvanceView:g,data:{path:W,childrenCount:t.children.length},onDrop:n}),xe(X,W,i,a,M)]},W)}),l.jsx(Ri,{isAdvanceView:g,data:{path:`${r}-${t.children.length}`,childrenCount:t.children.length,droppedField:t},onDrop:n,isLast:!0})]}),q&&l.jsxs("div",{className:"m-3 flex justify-content-end",children:[l.jsx("span",{className:"add-section-tool ","data-pr-tooltip":"Add Section",children:l.jsx("i",{className:"pi pi-plus",onClick:()=>{b(i),d()},children:l.jsx(In,{})})}),((ne=x[i])==null?void 0:ne.children.length)>1&&l.jsx("span",{className:"del-tool ml-2",children:l.jsx("i",{className:"pi pi-trash","data-pr-tooltip":"Delete",onClick:()=>{m(i,a),d()},children:l.jsx(In,{})})})]})]}):l.jsxs(l.Fragment,{children:[((ue=t==null?void 0:t.subHeadingText)==null?void 0:ue[S==null?void 0:S.type])&&l.jsx("p",{children:(ye=t==null?void 0:t.subHeadingText)==null?void 0:ye[S==null?void 0:S.type]}),l.jsx("div",{children:t.children.map((X,M)=>{const W=`${r}-${M}`;return l.jsx(k.Fragment,{children:xe(X,W,i,a,M)},W)})})]})}):l.jsx(l.Fragment,{children:l.jsxs("div",{className:"",children:[(t==null?void 0:t.showSectionHeader)&&l.jsxs(l.Fragment,{children:[l.jsx("h4",{children:(Ee=t==null?void 0:t.heading)==null?void 0:Ee[S==null?void 0:S.type]}),l.jsx("p",{children:(Fe=t==null?void 0:t.subHeadingText)==null?void 0:Fe[S==null?void 0:S.type]}),l.jsx("hr",{})]}),t.children.map((X,M)=>{const W=`${r}-${M}`;return l.jsx(k.Fragment,{children:l.jsx("div",{className:"",children:xe(X,W,i,a,M)},W)},W)})]})})),o===Bu&&(s===!1?l.jsx("div",{children:l.jsx("div",{children:t.children.map((X,M)=>{const W=`${r}-${M}`;return l.jsx(k.Fragment,{children:xe(X,W,i,a,M)},W)})})}):l.jsx(l.Fragment,{children:l.jsxs("div",{children:[(t==null?void 0:t.showSectionHeader)&&l.jsxs(l.Fragment,{children:[l.jsx("h4",{children:(Te=t==null?void 0:t.heading)==null?void 0:Te[S==null?void 0:S.type]}),((me=t==null?void 0:t.subHeadingText)==null?void 0:me[S==null?void 0:S.type])&&l.jsx("p",{children:(ee=t==null?void 0:t.subHeadingText)==null?void 0:ee[S==null?void 0:S.type]}),l.jsx("hr",{})]}),t.children.map((X,M)=>{const W=`${r}-${M}`;return l.jsx(k.Fragment,{children:l.jsx("div",{className:"",children:xe(X,W,i,a,M)},W)},W)})]})})),o===Rd&&l.jsx("div",{className:"",children:t.children.map((X,M)=>{const W=`${r}-${M}`;return l.jsx(k.Fragment,{children:xe(X,W,i,a,M)},W)})})]})},kxe=t=>{var p;const{renderType:e,isRenderView:n,isAdvanceView:r,isPreview:i,data:a,components:s,currentPath:o,pageIndex:c,isAdmin:u,emitSocketData:d}=t,f=k.useRef(null);return l.jsx(l.Fragment,{children:l.jsxs(VA,{ref:f,modules:[Y$,U4e],spaceBetween:50,slidesPerView:1,navigation:{prevEl:".prev",nextEl:".next"},pagination:{clickable:!1},scrollbar:{el:".swiper-scrollbar",draggable:!1},onSwiper:g=>console.log(g),onSlideChange:()=>console.log("slide change"),children:[(p=a==null?void 0:a.children)==null?void 0:p.map((g,m)=>{var b;return(b=g==null?void 0:g.children)==null?void 0:b.map((w,x)=>{var S;return(S=w==null?void 0:w.children)==null?void 0:S.map((C,T)=>{var A;return(A=C==null?void 0:C.children)==null?void 0:A.map((I,_)=>{const P=`${o}-${m}-${x}-${T}-${_}`;return l.jsx(qA,{children:l.jsx("div",{className:"",children:l.jsx(vg,{page:a,renderType:e,type:"field",row:w,section:g,isPreview:i,field:I,data:I,components:s,path:P,pageIndex:c,sectionIndex:m,rowIndex:x,columnIndex:T,fieldIndex:_,isAdmin:u,emitSocketData:d},`component-${P}-${I==null?void 0:I.uuid}`)})},`swiper_slide_${P}`)})})})}),l.jsxs("div",{className:"flex justify-content-center",children:[l.jsx(Rt,{className:"mr-2 p-button-info prev",size:"large",label:"Previous",icon:"pi pi-arrow-left",onClick:()=>{}}),l.jsx(Rt,{size:"large",className:"p-button-info next",icon:"pi pi-arrow-right",label:"Next"})]})]})})},Lxe={position:"relative"},$xe=({data:t,components:e,handleDrop:n,path:r,pageIndex:i,sectionIndex:a,rowIndex:s,columnIndex:o,isPreview:c,renderType:u,section:d,row:f,isAdmin:p,emitSocketData:g,page:m,isRenderView:b,isAdvanceView:w})=>{var I,_,P,q,U,F;const x=k.useRef(null);xn();const[{isDragging:S},C]=Yd({type:q1,item:{type:q1,uuid:t==null?void 0:t.uuid,children:t.children,path:r},collect:O=>({isDragging:O.isDragging()})}),T=S&&!b?.25:1;C(x);const A=(O,L,J,be,xe,le,Z)=>l.jsx(vg,{page:m,renderType:u,type:"field",row:f,section:d,handleDrop:n,isPreview:c,field:O,data:O,components:e,path:L,isRenderView:b,pageIndex:J,sectionIndex:be,rowIndex:xe,columnIndex:le,fieldIndex:Z,isAdmin:p,emitSocketData:g},`component-${r}-${O==null?void 0:O.uuid}`);return l.jsxs("div",{style:w?{...Lxe,opacity:T}:{},className:b?"":"draggable column container-column",children:[(u===Xc||u===qu||u===B1||u===U1||u===Uu)&&(c===!1?l.jsx(l.Fragment,{children:l.jsxs("div",{children:[((I=t==null?void 0:t.children)==null?void 0:I.length)>0?(_=t==null?void 0:t.children)==null?void 0:_.map((O,L)=>{const J=`${r}-${L}`;return l.jsxs(k.Fragment,{children:[l.jsx(Ri,{isAdvanceView:w,fieldDropArea:!0,data:{path:J,childrenCount:t.children.length,droppedField:t},onDrop:n}),A(O,J,i,a,s,o,L)]},J)}):l.jsx(l.Fragment,{}),l.jsx(Ri,{isAdvanceView:w,dropHereLastField:!0,fieldDropArea:!0,data:{path:`${r}-${t.children.length}`,childrenCount:t.children.length,droppedField:t},onDrop:n,isLast:!0})]})}):l.jsx(l.Fragment,{children:(P=t==null?void 0:t.children)==null?void 0:P.map((O,L)=>{const J=`${r}-${L}`;return l.jsx(k.Fragment,{children:A(O,J,i,a,s,o,L)},J)})})),u===Bu&&(c===!1?l.jsx(l.Fragment,{}):l.jsx(l.Fragment,{children:(q=t==null?void 0:t.children)==null?void 0:q.map((O,L)=>{const J=`${r}-${L}`;return l.jsx(k.Fragment,{children:A(O,J,i,a,s,o,L)},J)})})),u===j1&&!c&&l.jsxs("div",{children:[(U=t==null?void 0:t.children)==null?void 0:U.map((O,L)=>{const J=`${r}-${L}`;return l.jsxs(k.Fragment,{children:[l.jsx(Ri,{isAdvanceView:w,data:{path:J,childrenCount:t.children.length,droppedField:t},onDrop:n}),A(O,J,i,a,s,o,L)]},J)}),t.children.length===0&&l.jsx("p",{className:"text-center",children:"Add element by dragging and dropping element from the sidebar into the dropzone area"}),l.jsx(Ri,{isAdvanceView:w,data:{path:`${r}-${t.children.length}`,childrenCount:t.children.length,droppedField:t},onDrop:n,isLast:!0})]}),u===Rd&&(c===!1?l.jsxs("div",{children:[t.children.length>0&&((F=t==null?void 0:t.children)==null?void 0:F.map((O,L)=>{const J=`${r}-${L}`;return l.jsx(k.Fragment,{children:A(O,J,i,a,s,o,L)},J)})),t.children.length===0&&l.jsx("p",{className:"text-center",children:"Drag and drop from sidebar items"}),l.jsx(Ri,{isAdvanceView:w,data:{path:`${r}-${t.children.length}`,childrenCount:t.children.length,droppedField:t},onDrop:n,isLast:!0})]}):l.jsx(l.Fragment,{children:t.children.length>0?l.jsx(RU,{questions:t.children}):l.jsx("p",{className:"text-center",children:"No items to show"})}))]})},Vxe=t=>{var w;const{renderType:e,isRenderView:n,isAdvanceView:r,isPreview:i,data:a,page:s,section:o,components:c,handleDrop:u,currentPath:d,pageIndex:f,sectionIndex:p,isAdmin:g,emitSocketData:m}=t,b=(x,S,C,T,A,I,_,P)=>l.jsx($xe,{isAdvanceView:r,page:s,row:P,section:_,renderType:e,isPreview:i,isRenderView:n,data:x,components:c,handleDrop:u,path:`${C}-${T}-${A}-${I}`,pageIndex:C,sectionIndex:T,rowIndex:A,columnIndex:I,isAdmin:g,emitSocketData:m},`column-${d}-${x.uuid}`);return l.jsx(l.Fragment,{children:(w=a==null?void 0:a.children)==null?void 0:w.map((x,S)=>{var C;return(C=x==null?void 0:x.children)==null?void 0:C.map((T,A)=>{var I;return l.jsx(l.Fragment,{children:l.jsx("div",{className:r?"columns":"",style:r?{overflowX:"auto"}:{},children:(I=T==null?void 0:T.children)==null?void 0:I.map((_,P)=>{const q=`${d}-${S}-${A}-${P}`;return l.jsx(k.Fragment,{children:b(_,q,f,S,A,P,x,T)},q)})})})})})})},cv={},uv={height:"1280px",width:"100%"},qxe=({data:t,components:e,handleDrop:n,path:r,pageIndex:i,isPreview:a,renderType:s,isAdmin:o,emitSocketData:c,isRenderView:u,isAdvanceView:d})=>{var x,S,C,T;const{formBuilderFormSchema:f}=xn(),p=k.useRef(null),[{isDragging:g},m]=Yd({type:Hd,item:{type:Hd,uuid:t.uuid,children:t.children,path:r},collect:A=>({isDragging:A.isDragging()})}),b=g?0:1;m(p);const w=(A,I,_,P)=>l.jsx(Mxe,{renderType:s,isRenderView:u,isAdvanceView:d,isPreview:a,data:A,section:A,components:e,handleDrop:n,path:I,page:t,pageIndex:_,sectionIndex:P,isAdmin:o,emitSocketData:c},`section_${_}_${P}`);return l.jsxs("div",{style:{overflowX:"auto"},className:`${u?"":"draggable page-css p-3 pb-4"}`,"data-image-src":t==null?void 0:t.bgImage,"data-bg-color":`#${t==null?void 0:t.bgColor}`,children:[s===Rd&&l.jsx("div",{className:"",children:t.children.map((A,I)=>{const _=`${r}-${I}`;return l.jsx(k.Fragment,{children:w(A,_,i,I)},`section-${I}-${A.uuid}`)})}),s===j1&&(a?l.jsx(l.Fragment,{}):l.jsx("div",{className:"p-1",children:t.children.map((A,I)=>{const _=`${r}-${I}`;return l.jsx(k.Fragment,{children:w(A,_,i,I)},`section-${I}-${A.uuid}`)})})),(s===Xc||s===B1||s===U1||s===Uu)&&(a===!1?l.jsx(l.Fragment,{children:d?l.jsxs(l.Fragment,{children:[t.children.map((A,I)=>{const _=`${r}-${I}`;return l.jsxs(k.Fragment,{children:[d===!0&&l.jsx(Ri,{isAdvanceView:d,data:{path:_,childrenCount:t.children.length},onDrop:n}),w(A,_,i,I)]},`section-${I}-${A.uuid}`)}),d===!0&&l.jsx(Ri,{isAdvanceView:d,data:{path:`${r}-${t.children.length}`,childrenCount:t.children.length,droppedField:t},onDrop:n,isLast:!0})]}):l.jsx(l.Fragment,{children:l.jsx(Vxe,{page:t,renderType:s,isRenderView:u,isAdvanceView:d,isPreview:a,data:t,components:e,handleDrop:n,path:r,pageIndex:i,isAdmin:o,emitSocketData:c})})}):l.jsx(l.Fragment,{children:l.jsx("div",{className:"p-1",children:t.children.map((A,I)=>{const _=`${r}-${I}`;return l.jsx(k.Fragment,{children:f!=null&&f.showConditionalFields?l.jsx(l.Fragment,{children:l.jsx("div",{children:w(A,_,i,I)})}):((A==null?void 0:A.isHidden)===!1||!a)&&w(A,_,i,I)},`section-${I}-${A.uuid}`)})})})),s===qu&&(a===!1?l.jsxs(l.Fragment,{children:[t.children.map((A,I)=>{const _=`${r}-${I}`;return l.jsxs(k.Fragment,{children:[l.jsx(Ri,{isAdvanceView:d,data:{path:_,childrenCount:t.children.length},onDrop:n}),w(A,_,i,I)]},`section-${I}-${A.uuid}`)}),l.jsx(Ri,{isAdvanceView:d,data:{path:`${r}-${t.children.length}`,childrenCount:t.children.length,droppedField:t},onDrop:n,isLast:!0})]}):l.jsx(l.Fragment,{children:(f==null?void 0:f.surveyQuestionSlide)===!0?l.jsx(l.Fragment,{children:l.jsx(kxe,{renderType:s,isRenderView:u,isAdvanceView:d,isPreview:a,data:t,components:e,handleDrop:n,path:r,pageIndex:i,isAdmin:o,emitSocketData:c})}):l.jsx("div",{className:"p-1",children:t.children.map((A,I)=>{const _=`${r}-${I}`;return l.jsx(k.Fragment,{children:((A==null?void 0:A.isHidden)===!1||!a)&&w(A,_,i,I)},`section-${I}-${A.uuid}`)})})})),l.jsx("div",{className:"pdf flex justify-content-center",children:s===Bu&&(a===!1?l.jsx("div",{id:t==null?void 0:t.uuid,className:"page-block ",style:(t==null?void 0:t.bgType)==="image"?{...cv,...uv,opacity:b,backgroundImage:`url("${t==null?void 0:t.bgImage}")`}:{...cv,...uv,opacity:b,backgroundColor:`#${t==null?void 0:t.bgColor}`},children:((t==null?void 0:t.isCoverPage)===!1||(t==null?void 0:t.isCoverPage)===void 0)&&l.jsx(l.Fragment,{children:t.children.map((A,I)=>{const _=`${r}-${I}`;return l.jsx(k.Fragment,{children:w(A,_,i,I)},`section-${I}-${A.uuid}`)})})}):l.jsx(l.Fragment,{children:l.jsx("div",{className:"page-block",style:(t==null?void 0:t.bgType)==="image"?{...cv,...uv,opacity:b,backgroundImage:`url("${t==null?void 0:t.bgImage}")`,backgroundSize:"cover"}:{...cv,...uv,opacity:b,backgroundColor:`#${t==null?void 0:t.bgColor}`},children:l.jsx("div",{style:{marginTop:`${(x=t==null?void 0:t.margin)==null?void 0:x.top}px`,marginBottom:`${(S=t==null?void 0:t.margin)==null?void 0:S.bottom}px`,marginLeft:`${(C=t==null?void 0:t.margin)==null?void 0:C.left}px`,marginRight:`${(T=t==null?void 0:t.margin)==null?void 0:T.right}px`},children:t.children.map((A,I)=>{const _=`${r}-${I}`;return l.jsx(k.Fragment,{children:((A==null?void 0:A.isHidden)===!1||!a)&&w(A,_,i,I)},`section-${I}-${A.uuid}`)})})})}))})]})},Bxe=t=>{var i;const{language:e,onHandleChange:n,tabState:r}=t;return l.jsx("form",{className:"p-fluid",children:l.jsxs("div",{className:"field",children:[l.jsx("span",{className:"must-required",children:"*"}),l.jsx("label",{children:"Page Title"}),l.jsx(dn,{value:((i=r.title)==null?void 0:i[e==null?void 0:e.type])||"",onChange:a=>n("title",e,a.target.value),placeholder:"enter page title",id:"page_title",name:"page_title"})]})})},Uxe=t=>{var u,d,f,p;const{onHandleChange:e,tabState:n,onHandleChangePageMargin:r}=t,[i,a]=k.useState("");k.useEffect(()=>{},[]),k.useState(null);const s=()=>{},o=[{icon:"pi pi-image",value:"image"},{icon:"pi pi-palette ",value:"color"},{icon:"pi pi-microsoft ",value:"gradient"}],c=g=>l.jsx("i",{className:g.icon});return l.jsxs("div",{className:"",children:[l.jsxs("div",{className:" field",children:[l.jsxs("div",{className:"grid",children:[l.jsxs("div",{className:"field col-2 md:col-3",children:[l.jsx("label",{children:"Left"}),l.jsx(Ra,{value:(u=n==null?void 0:n.margin)==null?void 0:u.left,onChange:g=>{r("left",g.value)},mode:"decimal",showButtons:!0,min:0,max:100})]}),l.jsxs("div",{className:"field col-2 md:col-3",children:[l.jsx("label",{children:"Right"}),l.jsx(Ra,{value:(d=n==null?void 0:n.margin)==null?void 0:d.right,onChange:g=>{r("right",g.value)},mode:"decimal",showButtons:!0,min:0,max:100})]}),l.jsxs("div",{className:"field col-2 md:col-3",children:[l.jsx("label",{children:"Top"}),l.jsx(Ra,{value:(f=n==null?void 0:n.margin)==null?void 0:f.top,onChange:g=>{r("top",g.value)},mode:"decimal",showButtons:!0,min:0,max:100})]}),l.jsxs("div",{className:"field col-2 md:col-3",children:[l.jsx("label",{children:"Bottom"}),l.jsx(Ra,{value:(p=n==null?void 0:n.margin)==null?void 0:p.bottom,onChange:g=>{r("bottom",g.value)},mode:"decimal",showButtons:!0,min:0,max:100})]})]}),l.jsxs("div",{className:"field-checkbox",children:[l.jsx(Dr,{inputId:"binary",checked:n==null?void 0:n.isCoverPage,onChange:g=>e("isCoverPage",g.checked)}),l.jsx("label",{htmlFor:"binary",children:"Enable Cover Page"})]}),l.jsx("label",{children:"Background Type"}),l.jsx(V1,{value:n==null?void 0:n.bgType,options:o,onChange:g=>e("bgType",g.value),itemTemplate:c,optionLabel:"value"})]}),(n==null?void 0:n.bgType)==="color"&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"p-fluid field",children:l.jsx(Xd,{value:(n==null?void 0:n.bgColor)||"",onChange:g=>e("bgColor",g.value)})}),l.jsx(Xd,{value:(n==null?void 0:n.bgColor)||"",onChange:g=>e("bgColor",g.value),inline:!0})]}),(n==null?void 0:n.bgType)==="image"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"p-fluid field",children:[l.jsx("span",{className:"must-required",children:"*"}),l.jsx("label",{children:"Background image"}),l.jsx(dn,{value:(n==null?void 0:n.bgImage)||"",onChange:g=>e("bgImage",g.target.value),placeholder:"enter page title",id:"page_title",name:"page_title"})]}),l.jsxs("div",{className:"shadow-2 border-round surface-card p-4",children:[l.jsx("div",{className:"flex align-items-center justify-content-between mb-4",children:l.jsx("span",{className:"text-xl font-medium text-900",children:"Selected Files"})}),l.jsx("h5",{children:"Media Library"}),l.jsxs("div",{className:"grid",children:[l.jsx("div",{className:"col-8",children:l.jsxs("div",{className:"grid",children:[l.jsx("div",{className:"col-12 mb-5",children:l.jsxs("div",{className:"p-inputgroup",children:[l.jsx(dn,{placeholder:"Keyword",onChange:g=>a(g.target.value)}),l.jsx(Rt,{text:!0,icon:"pi pi-search",className:"p-button-info",onClick:()=>s()})]})}),l.jsx("div",{className:"col-12 mb-5",children:l.jsx("div",{className:"surface-section ",children:l.jsx("div",{className:"grid -mt-3 -ml-3 -mr-3"})})})]})}),l.jsx("div",{className:"col-4 card"})]})]})]})]})},bg=t=>{var b;const{visibilty:e,setVisibility:n,pageIndex:r,page:i,emitSocketData:a}=t,[s,o]=k.useState(i),{formBuilderSchemaLanguages:c,pageSettingUpdate:u,formBuilderPublishedStatus:d}=xn(),f=()=>{const w={...s,children:i==null?void 0:i.children};u(r,w),a()},p=(w,x,S)=>{o(C=>({...C,[w]:{...C[w],[x==null?void 0:x.type]:S}}))},g=(w,x)=>{let S=s;S={...S,margin:{...S.margin,[w]:x}},o(S)},m=(w,x)=>{o(S=>({...S,[w]:x}))};return l.jsx(l.Fragment,{children:l.jsxs(vo,{visible:e,position:"left",className:"p-sidebar-lg",onHide:()=>n(!1),children:[l.jsxs("div",{className:"flex justify-content-between flex-wrap card-container ",children:[l.jsxs("div",{className:"flex align-items-center justify-content-center ",children:[" ",l.jsxs("h5",{className:"mb-0",children:["Page Settings - ",(b=s==null?void 0:s.title)==null?void 0:b.english," "]})]}),!d&&l.jsx("div",{className:"flex align-items-center justify-content-center",children:l.jsx(Rt,{className:"mt-3",label:"Update",onClick:()=>f(),"aria-label":"Update"})})]}),l.jsxs(Ya,{children:[l.jsx(tr,{header:"Text",children:l.jsx(Ws,{activeIndex:0,children:c!=null&&c.length?c.map((w,x)=>l.jsx(Gs,{tabIndex:x,header:w==null?void 0:w.language,children:l.jsx(Bxe,{language:w,tabState:s,onHandleChange:p,...t})},x)):""})}),l.jsx(tr,{header:"Styling",children:l.jsx(Uxe,{tabState:s,onHandleChange:m,onHandleChangePageMargin:g,...t})})]})]})})},dv=t=>{const{reusableBuilderElementModalVisibility:e,setReusableBuilderElementModalVisibility:n,pageIndex:r}=t,i=()=>l.jsxs("div",{children:[l.jsx(Rt,{text:!0,label:"No",icon:"pi pi-times",className:"p-button-text"}),l.jsx(Rt,{text:!0,label:"Yes",icon:"pi pi-check",autoFocus:!0})]});return l.jsx(Ms,{maximizable:!0,header:"Reusale Elements",visible:e,style:{width:"50vw"},footer:i(),onHide:()=>n(!1)})},YU=t=>{var A,I,_;const{options:e,pageIndex:n,page:r,isPreview:i,setTabSidebarSetting:a,clonePage:s,emitSocketData:o,formBuilderFormLayout:c,userSelectedLanguage:u,removePage:d,setPageActiveIndex:f,pages:p}=t,{taskRegisterData:g,updateUserFormDataSubmit:m,userTaskSubmitFormData:b,updateProgressDataValuesHook:w,taskStatus:x,TASK_PENDING:S}=si(),{addTabs:C}=xn(),T=(P,q,U)=>{var O,L,J;const F=b;if(F!=null&&F.length){const be=g;for(const[le,Z]of q.children.entries())for(const[fe,Y]of Z.children.entries())if(Y!=null&&Y.rowIsRepeatable){const ie=St.findIndex(F,function(K){return K.rowId===Y.uuid});P?ie===-1&&(F.push({postData:[],tabId:q.uuid,rowId:Y==null?void 0:Y.uuid,tabIndex:U,sectionId:Z.uuid,minimumEntries:Z==null?void 0:Z.minimumEntries,sectionIndex:le,sectionHeading:Z.heading,subHeadingText:Z.subHeadingText,repeatableFields:{},repeatableFieldsData:[],language:"english",isHiddenSection:Z.isHidden&&Z.isHidden===1?1:0}),be[Y==null?void 0:Y.uuid]&&delete be[Y==null?void 0:Y.uuid]):F.splice(ie,1)}else for(const[ie,K]of Y.children.entries())for(const[ne,ue]of K.children.entries())if(!(Y!=null&&Y.rowIsRepeatable)&&(ue==null?void 0:ue.isPostField)===!0)if(((O=ue.children)==null?void 0:O.length)>0)for(const[,ye]of ue.children.entries()){const Ee=Object.keys(ye);if(Ee[0]){const Fe=ye[Ee[0]],Te=St.findIndex(F,function(me){return me.fieldId===ye.uuid});P?Te===-1&&(F.push({postData:[],logs:[],isSeen:!1,seenTime:null,tabId:q.uuid,tabIndex:U,componentType:ue==null?void 0:ue.componentType,sectionId:Z.uuid,sectionIndex:le,sectionHeading:Z.heading,subHeadingText:Z.subHeadingText,rowId:Y.uuid,rowIndex:fe,columnId:Z.uuid,columnIndex:ie,fieldIndex:ne,fieldId:Fe.uuid,fieldInputType:Fe.componentType,fieldTitle:(L=Fe.label)==null?void 0:L.english,fieldDescription:Fe.description||null,fieldHelperText:Fe.helperText||null,fieldHeaderText:Fe.headerText||null,fieldFooterText:Fe.footerText||null,fieldTitleAbb:Fe.abbreviationLabel||Fe.label,question_abb_table:Fe.textForTable||null,language:"english",isHiddenfield:Fe.isHidden&&Fe.isHidden===1?1:0,isHiddenSection:Z.isHidden&&Z.isHidden===1?1:0}),be[ye==null?void 0:ye.uuid]&&delete be[ye==null?void 0:ye.uuid]):(be[ye==null?void 0:ye.uuid]&&delete be[ye==null?void 0:ye.uuid],Te>=0&&F.splice(Te,1))}}else{const ye=St.findIndex(F,function(Ee){return Ee.fieldId===ue.uuid});P?ye===-1&&(F.push({postData:[],tabId:q.uuid,tabIndex:U,componentType:ue==null?void 0:ue.componentType,...ue.inlineConditionalRules?{inlineConditionalRules:ue.inlineConditionalRules}:{},...ue.conditionalTabRules?{conditionalTabRules:ue.conditionalTabRules}:{},...ue.conditionalSectionRules?{conditionalSectionRules:ue.conditionalSectionRules}:{},sectionId:Z.uuid,sectionIndex:le,sectionHeading:Z.heading,subHeadingText:Z.subHeadingText,reviewerChecklist:ue==null?void 0:ue.reviewerChecklist,rowId:Y.uuid,rowIndex:fe,columnId:Z.uuid,columnIndex:ie,fieldIndex:ne,fieldId:ue.uuid,fieldInputType:ue.componentType,fieldTitle:(J=ue.label)==null?void 0:J.english,fieldDescription:ue.description||null,fieldHelperText:ue.helperText||null,fieldHeaderText:ue.headerText||null,fieldFooterText:ue.footerText||null,fieldTitleAbb:ue.abbreviationLabel||ue.label,question_abb_table:ue.textForTable||null,language:"english",isHiddenfield:ue.isHidden&&ue.isHidden===1?1:0,isHiddenSection:Z.isHidden&&Z.isHidden===1?1:0}),be[ue==null?void 0:ue.uuid]&&delete be[ue==null?void 0:ue.uuid]):(be[ue==null?void 0:ue.uuid]&&delete be[ue==null?void 0:ue.uuid],ye>=0&&x===S&&F.splice(ye,1))}const xe=Object.keys(be).length;w({progressMaxValue:F==null?void 0:F.length,progressValue:xe}),m(F)}};return k.useEffect(()=>{const P=an.addListener("updatePageRender",()=>{T(!(r!=null&&r.isHidden),r,n)});return()=>{P.remove()}}),k.useEffect(()=>(T(!(r!=null&&r.isHidden),r,n),()=>{}),[]),l.jsxs("div",{className:`${e.className} page-panel`,onClick:e.onClick,children:[l.jsx(vn,{target:".clone-tool"}),l.jsx(vn,{target:".del-tool"}),l.jsx(vn,{target:".setting-tool"}),l.jsx(vn,{target:".addpage-tool"}),i===!1&&l.jsxs("span",{className:"page-pannel-icons",children:[l.jsx("i",{className:"pi pi-plus mr-1 p-text-secondary addpage-tool ",onClick:()=>{C(p==null?void 0:p.length),o()},"data-pr-tooltip":"Add Page"}),l.jsx("i",{className:"pi pi-cog mr-1 p-text-secondary setting-tool ",onClick:()=>a(!0),"data-pr-tooltip":"Settings"})," ",l.jsx("i",{className:"pi pi-clone mr-1 p-text-secondary clone-tool ",onClick:()=>{s(r,n),o()},"data-pr-tooltip":"Clone"})," ",(c==null?void 0:c.length)>1&&l.jsx("i",{className:"pi pi-trash mr-1 p-text-danger del-tool",onClick:()=>{d(n),setTimeout(()=>{f(p.length-2)},100),o()},"data-pr-tooltip":"Delete"})]}),"   ",l.jsx(l.Fragment,{children:((A=r==null?void 0:r.title)==null?void 0:A[u==null?void 0:u.type])===null||((I=r==null?void 0:r.title)==null?void 0:I[u==null?void 0:u.type])===void 0?l.jsxs("span",{style:{width:"100px"},children:["Tab ",n+1]}):(_=r==null?void 0:r.title)==null?void 0:_[u==null?void 0:u.type]})]},`pannel-${n}`)},XU=1,jxe=t=>{const{isAdvanceView:e,layout:n,isPreview:r,renderType:i,isAdmin:a,emitSocketData:s,isRenderView:o}=t,{removePage:c,setLayout:u,userSelectedLanguage:d,formBuilderFormLayout:f,clonePage:p,addFieldToRowRepeaptable:g,addFieldToInlineRuleCondtionFields:m,sectionImport:b,addFieldToGridComponentHook:w,gridComponentFieldDelete:x}=xn(),[S,C]=k.useState(!1),[T,A]=k.useState(!1),[I,_]=k.useState(0),P=k.useCallback((U,F)=>{var ee,X,M,W,G,he,Ne,Se;const O=U.path.split("-"),L=O.slice(0,-1).join("-"),J={uuid:F.uuid,type:F.type,reviewerChecklist:[]},be=0,xe=1,le=2,Z=3,fe=4,Y=5,ie=6,K=8,ne=7,ue=5,ye=6,Ee=8;if(F.type===Hd&&(F==null?void 0:F.schema)!==void 0){b(JSON.parse(F==null?void 0:F.schema),parseInt(O[be]));return}if(((ee=F==null?void 0:F.schema)==null?void 0:ee.componentType)==="question"&&((he=(G=(W=(M=(X=n[0])==null?void 0:X.children[0])==null?void 0:M.children[0])==null?void 0:W.children[0])==null?void 0:G.children)!=null&&he.some(Ae=>{var Ve,se,pe;return((Ve=Ae==null?void 0:Ae.questionText)==null?void 0:Ve[d.type])===((pe=(se=F==null?void 0:F.schema)==null?void 0:se.questionText)==null?void 0:pe[d.type])})))return;if(F.type===Rn){let Ae={type:rf,reviewerChecklist:[],...St.cloneDeep(F.schema)};if(Ae!=null&&Ae.options&&(Ae={...Ae,options:[{uuid:Ze(),optionText:{english:"Option 1"},value:"Option1",hyperlinkText:{english:""},abbreviationText:{english:"Option 1"},custom_values:{}},{uuid:Ze(),optionText:{english:"Option 2"},value:"Option2",hyperlinkText:{english:""},abbreviationText:{english:"Option 1"},custom_values:{}}]}),Ae.componentType==="grid-component"&&(Ae={...Ae,children:[],options:[{uuid:Ze(),custom_values:{}}]}),Ae.componentType==="radio-hierarchal"&&(Ae={...Ae,type:"radio",children:[],options:[{uuid:Ze(),label:"Yes",value:null,enableConditionalField:!0,children:[]},{uuid:Ze(),label:"No",value:null,enableConditionalField:!0,children:[]}]}),Ae={...Ae,uuid:Ze()},O.length===K){m(parseInt(O[be]),parseInt(O[xe]),parseInt(O[le]),parseInt(O[Z]),parseInt(O[fe]),parseInt(O[Y]),parseInt(O[ie]),Ae),s();return}if(O.length===ne){w(parseInt(O[be]),parseInt(O[xe]),parseInt(O[le]),parseInt(O[Z]),parseInt(O[fe]),parseInt(O[ue]),parseInt(O[ye]),Ae),s();return}if((Se=(Ne=n[O[be]].children[O[xe]])==null?void 0:Ne.children[O[le]])!=null&&Se.rowIsRepeatable&&(Ae==null?void 0:Ae.componentType)==="editor")return;u(vee(n,O,Ae)),s(),O.length>1&&g(O[be],O[xe],O[le],Ae);return}const Fe=F.path.split("-"),Te=Fe.slice(0,-1).join("-");if(Fe.length===O.length){if(Te===L){if((Fe==null?void 0:Fe.length)===Ee){u(pee(n,O,Fe));return}u(gee(n,O,Fe));return}const Ae={...J,...F};(F==null?void 0:F.id)===void 0&&(Ae.id=Ze()),u(iD(n,O,Fe,Ae));return}if((Fe==null?void 0:Fe.length)===8){const Ae={type:rf,reviewerChecklist:[],...F};w(parseInt(O[be]),parseInt(O[xe]),parseInt(O[le]),parseInt(O[Z]),parseInt(O[fe]),parseInt(O[ue]),parseInt(O[ye]),Ae),x(Fe[ra],Fe[ia],Fe[oa],Fe[la],Fe[ca],Fe[ue],Fe[ye],Fe[Fl]);return}const me={...J,...F};(F==null?void 0:F.id)===void 0&&(me.id=Ze()),u(iD(n,O,Fe,me))},[n,w,m,g,s,x,b,u,d.type]),q=(U,F,O,L)=>l.jsx(qxe,{emitSocketData:s,renderType:i,isPreview:L,data:U,handleDrop:P,path:F,pageIndex:O,isAdmin:a,isRenderView:o,isAdvanceView:e},`page-${U.uuid}`);return l.jsxs("div",{className:"page",children:[(i===qu||i===Xc||i===Uu)&&l.jsx(l.Fragment,{children:(n==null?void 0:n.length)===XU&&r===!0?l.jsx(l.Fragment,{children:(n==null?void 0:n.length)&&n.map((U,F)=>{const O=`${F}`;return l.jsx("div",{children:q(U,O,F,r)},`${U.uuid}-${F}`)})}):l.jsx(l.Fragment,{children:e===!0||r===!0?l.jsx(Ya,{activeIndex:I,onTabChange:U=>_(U.index),children:(n==null?void 0:n.length)&&n.map((U,F)=>{const O=`${F}`;return l.jsxs(tr,{disabled:!((U==null?void 0:U.isHidden)===!1||!r),header:"Page",headerTemplate:L=>l.jsx(YU,{options:L,pageIndex:F,page:U,isPreview:r,setTabSidebarSetting:C,clonePage:p,emitSocketData:s,formBuilderFormLayout:f,userSelectedLanguage:d,removePage:c,setPageActiveIndex:_,pages:n}),children:[r===!1&&l.jsx(dv,{reusableBuilderElementModalVisibility:T,setReusableBuilderElementModalVisibility:A,pageIndex:F}),l.jsx(bg,{setVisibility:C,visibilty:S,pageIndex:F,page:U,emitSocketData:s}),q(U,O,F,r)]},`${U.uuid}-${F}`)})}):l.jsx(l.Fragment,{children:(n==null?void 0:n.length)>0&&(n==null?void 0:n.map((U,F)=>{const O=`${F}`;return l.jsxs(k.Fragment,{children:[r===!1&&l.jsx(dv,{reusableBuilderElementModalVisibility:T,setReusableBuilderElementModalVisibility:A,pageIndex:F}),l.jsx(bg,{setVisibility:C,visibilty:S,pageIndex:F,page:U,emitSocketData:s}),q(U,O,F,r)]},`${U.uuid}-${F}`)}))})})}),i===Bu&&l.jsx(l.Fragment,{children:(n==null?void 0:n.length)===XU&&r===!0?l.jsx(l.Fragment,{children:(n==null?void 0:n.length)&&n.map((U,F)=>{const O=`${F}`;return l.jsx("div",{className:"scroll-height-400",children:q(U,O,F,r)},`${U.uuid}-${F}`)})}):l.jsx(l.Fragment,{children:r===!1?l.jsx(Ya,{activeIndex:I,onTabChange:U=>_(U.index),children:(n==null?void 0:n.length)&&n.map((U,F)=>{const O=`${F}`;if((U==null?void 0:U.isHidden)===!1||!r)return l.jsxs(tr,{header:"Page",headerTemplate:L=>l.jsx(YU,{options:L,pageIndex:F,page:U,isPreview:r,setTabSidebarSetting:C,clonePage:p,emitSocketData:s,formBuilderFormLayout:f,userSelectedLanguage:d,removePage:c,setPageActiveIndex:_,pages:n,isAdvanceView:e}),children:[r===!1&&l.jsx(dv,{reusableBuilderElementModalVisibility:T,setReusableBuilderElementModalVisibility:A,pageIndex:F}),l.jsxs("div",{className:"p-3",children:[l.jsx(bg,{setVisibility:C,visibilty:S,pageIndex:F,page:U,emitSocketData:s}),l.jsx("div",{children:q(U,O,F,r)})]})]},`${U.uuid}-${F}`)})}):l.jsx("div",{className:"",children:(n==null?void 0:n.length)&&n.map((U,F)=>{var L;const O=`${F}`;if((U==null?void 0:U.isHidden)===!1||!r)return l.jsxs("section",{id:U==null?void 0:U.uuid,"data-nav-title":(L=U==null?void 0:U.title)==null?void 0:L.english,"data-scrollspy":!0,children:[r===!1&&l.jsx(dv,{reusableBuilderElementModalVisibility:T,setReusableBuilderElementModalVisibility:A,pageIndex:F}),l.jsxs("div",{className:"p-3",children:[l.jsx(bg,{setVisibility:C,visibilty:S,pageIndex:F,page:U,emitSocketData:s}),l.jsx("div",{children:q(U,O,F,r)})]})]},`${U.uuid}-${F}`)})})})}),(i===B1||i===U1)&&l.jsx("div",{children:(n==null?void 0:n.length)&&n.map((U,F)=>{const O=`${F}`;if((U==null?void 0:U.isHidden)===!1||!r)return l.jsxs("div",{children:[l.jsx(bg,{setVisibility:C,visibilty:S,pageIndex:F,page:U,emitSocketData:s}),q(U,O,F,r)]},`policie-page-${F}`)})}),(i===Rd||i===j1)&&(n==null?void 0:n.length)&&n.map((U,F)=>{const O=`${F}`;return l.jsx("div",{children:q(U,O,F,r)},`exam-page-${F}`)})]})},Nw=t=>{const{isAdmin:e=!1,isAdvanceView:n=!1,formBuilderFormLayout:r,emitSocketData:i,isEditable:a,isRenderView:s,showPreview:o,userFormBuilderSettings:c,renderType:u,className:d=""}=t,f=Yp(),p=f==null?void 0:f.form_template_id,{builderIsChangesSaved:g,formBuilderFormSchema:m,saveFormProgress:b,userSelectedLanguage:w,formBuilderLoading:x,formatTableFieldsHook:S,schemaBuilderUpdate:C}=xn(),T=I=>{g===!1?(I.preventDefault(),I.returnValue=!1):window.location.reload()};k.useEffect(()=>(window.addEventListener("beforeunload",T),()=>{window.removeEventListener("beforeunload",T)}),[g]);const A=I=>{b(p,m,I)};return k.useEffect(()=>((m==null?void 0:m.enableAutoSaveBuilderSetting)===!0&&x===!1?A(!1):C({isChangesSaved:!1}),S(r),()=>{}),[r]),l.jsx(l.Fragment,{children:l.jsx("div",{className:"grid",children:l.jsx("div",{className:"col-12",children:l.jsx("div",{className:d,children:l.jsx(jxe,{isAdvanceView:n,isRenderView:s,isAdmin:e,layout:r,isPreview:o,renderType:u==null?void 0:u.key})})})})})},zxe={padding:"1rem 0.5rem",cursor:"move",textAlign:"center"},Sh=({data:t,showIcon:e,tags:n})=>{const[{opacity:r},i]=Yd({type:Rn,item:t,collect:s=>({opacity:s.isDragging()?0:1})});function a(s,o){return s.length<=o?s:s.slice(0,o)+"..."}return l.jsxs("div",{ref:i,className:`card shadow-2 question builder-sidebar-item ${t==null?void 0:t.element}`,style:{...zxe,opacity:r},children:[r&&(t!=null&&t.toolTip)?t==null?void 0:t.toolTip(t):"",a(t==null?void 0:t.label,80),l.jsxs("div",{className:"mt-2",children:[e&&l.jsx(Xu,{icon:"pi pi-check",severity:"warning",className:"mr-2",rounded:!0}),(n==null?void 0:n.length)>0&&(n==null?void 0:n.map((s,o)=>l.jsx(Xu,{severity:s==null?void 0:s.severity,className:"mr-2",value:s==null?void 0:s.label},`tagIndex-${o}`)))]})]})},Hxe=t=>{const{elementsBasedOnFormTypes:e}=t;return l.jsx(l.Fragment,{children:l.jsxs(Ya,{children:[(e==null?void 0:e.key)===qu&&l.jsx(tr,{header:"Survey",children:zW.map((n,r)=>l.jsx(Pi,{header:n==null?void 0:n.label,toggleable:!0,style:{marginBottom:10},children:l.jsx("div",{className:"grid",children:n==null?void 0:n.items.map((i,a)=>l.jsx("div",{className:"xl:col-6 lg:col-12 md:col-12 sm:col-12",children:l.jsx(Sh,{data:i},i.uuid)},"form_elements_"+a))})},`pannel-tab-${r}`))}),((e==null?void 0:e.key)===Xc||(e==null?void 0:e.key)===Uu)&&l.jsx(tr,{header:"Form",children:jW.map((n,r)=>l.jsx(Pi,{header:n==null?void 0:n.label,toggleable:!0,style:{marginBottom:10},children:l.jsx("div",{className:"grid",children:n==null?void 0:n.items.map((i,a)=>l.jsx("div",{className:"xl:col-6 lg:col-12 md:col-12 sm:col-12",children:l.jsx(Sh,{data:i},i.uuid)},"form_elements_"+a))})},`pannel-tab-${r}`))}),((e==null?void 0:e.key)===B1||(e==null?void 0:e.key)===U1||(e==null?void 0:e.key)===Bu)&&l.jsx(tr,{header:"Layout",children:UW.map((n,r)=>l.jsx(Pi,{header:n==null?void 0:n.label,toggleable:!0,style:{marginBottom:10},children:l.jsx("div",{className:"grid",children:n==null?void 0:n.items.map((i,a)=>l.jsx("div",{className:"col-6",children:l.jsx(Sh,{data:i},i.uuid)},"form_elements_"+a))})},`pannel-tab-${r}`))}),((e==null?void 0:e.key)===qu||(e==null?void 0:e.key)===Xc||(e==null?void 0:e.key)===Uu)&&l.jsx(tr,{header:"Layout",children:HW.map((n,r)=>l.jsx(Pi,{header:n==null?void 0:n.label,toggleable:!0,style:{marginBottom:10},children:l.jsx("div",{className:"grid",children:n==null?void 0:n.items.map((i,a)=>l.jsx("div",{className:"col-6",children:l.jsx(Sh,{data:i},i.uuid)},"form_elements_"+a))})},`pannel-tab-${r}`))}),(e==null?void 0:e.key)===Rd&&l.jsx(tr,{header:"Question Bank",children:l.jsxs("div",{className:"grid",children:[l.jsx("div",{className:"col-12",children:RW.map((n,r)=>l.jsx("div",{className:"grid",children:n==null?void 0:n.items.map((i,a)=>{const s=St.cloneDeep(i);return l.jsx("div",{className:"col-6",children:l.jsx(Sh,{data:s},i.uuid)},"form_elements_"+a)})},`new-quiz-${r}`))}),l.jsx("div",{className:"col-12 ",children:l.jsxs("div",{className:"p-inputgroup",children:[l.jsx(dn,{placeholder:"Keyword"}),l.jsx(Rt,{icon:"pi pi-search",className:"p-button-info"})]})})]})}),(e==null?void 0:e.key)===j1&&l.jsx(tr,{header:"Training",children:BW.map((n,r)=>l.jsx(Pi,{header:n==null?void 0:n.label,toggleable:!0,style:{marginBottom:10},children:l.jsx("div",{className:"grid",children:n==null?void 0:n.items.map((i,a)=>l.jsx("div",{className:"col-6",children:l.jsx(Sh,{data:i},i.uuid)},"form_elements_"+a))})},`pannel-tab-${r}`))}),((e==null?void 0:e.key)===qu||(e==null?void 0:e.key)===Xc||(e==null?void 0:e.key)===Uu)&&l.jsxs(tr,{header:"Custom",children:[l.jsx("h6",{children:"Custom Sections"}),l.jsx("div",{className:"grid"}),l.jsx("h6",{children:"Custom Matrix"}),l.jsx("div",{className:"grid"})]})]})})},Rxe=t=>{var r;const{section:e}=t,{userSelectedLanguage:n}=xn();return l.jsxs("div",{children:["   ",(r=e==null?void 0:e.heading)==null?void 0:r[n==null?void 0:n.type]," : "," ",l.jsx(Ra,{placeholder:"enter weight",max:100,min:0}),l.jsx("br",{}),l.jsx("br",{})]})};function Fw(){return Fw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Fw.apply(this,arguments)}function Yxe(t){if(Array.isArray(t))return t}function Xxe(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,a,s,o=[],c=!0,u=!1;try{if(a=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(o.push(r.value),o.length!==e);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw i}}return o}}function KU(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Kxe(t,e){if(t){if(typeof t=="string")return KU(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return KU(t,e)}}function Gxe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
4225
4225
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function GU(t,e){return Yxe(t)||Xxe(t,e)||Kxe(t,e)||Gxe()}function yg(t){"@babel/helpers - typeof";return yg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yg(t)}function Wxe(t,e){if(yg(t)!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(yg(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Qxe(t){var e=Wxe(t,"string");return yg(e)==="symbol"?e:String(e)}function Jxe(t,e,n){return e=Qxe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Zxe={root:"p-confirm-dialog",message:"p-confirm-dialog-message",icon:"p-confirm-dialog-icon",acceptButton:"p-confirm-dialog-accept",rejectButton:function(e){var n=e.getPropValue;return yt("p-confirm-dialog-reject",{"p-button-text":!n("rejectClassName")})}},fv=Ln.extend({defaultProps:{__TYPE:"ConfirmDialog",accept:null,acceptClassName:null,acceptIcon:null,acceptLabel:null,appendTo:null,breakpoints:null,children:void 0,className:null,defaultFocus:"accept",footer:null,icon:null,message:null,onHide:null,reject:null,rejectClassName:null,rejectIcon:null,rejectLabel:null,tagKey:void 0,visible:void 0},css:{classes:Zxe}});function WU(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ch(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?WU(Object(n),!0).forEach(function(r){Jxe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):WU(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}var QU=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};e=Ch(Ch({},e),{visible:e.visible===void 0?!0:e.visible}),e.visible&&fs.emit("confirm-dialog",e);var n=function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};fs.emit("confirm-dialog",Ch(Ch(Ch({},e),a),{visible:!0}))},r=function(){fs.emit("confirm-dialog",{visible:!1})};return{show:n,hide:r}},ewe=y.memo(y.forwardRef(function(t,e){var n=Gn(),r=y.useContext(er),i=fv.getProps(t,r),a=y.useState(i.visible),s=GU(a,2),o=s[0],c=s[1],u=y.useState(!1),d=GU(u,2),f=d[0],p=d[1],g=y.useRef(null),m=y.useRef(!1),b=y.useRef(null),w=function(){var fe=i.group;return g.current&&(fe=g.current.group),Object.assign({},i,g.current,{group:fe})},x=function(fe){return w()[fe]},S=function(fe){for(var Y=arguments.length,ie=new Array(Y>1?Y-1:0),K=1;K<Y;K++)ie[K-1]=arguments[K];return Oe.getPropValue(x(fe),ie)},C=x("acceptLabel")||Ir("accept"),T=x("rejectLabel")||Ir("reject"),A={props:i,state:{visible:o}},I=fv.setMetaData(A),_=I.ptm,P=I.cx,q=I.isUnstyled;_i(fv.css.styles,q,{name:"confirmdialog"});var U=function(){m.current||(m.current=!0,S("accept"),L("accept"))},F=function(){m.current||(m.current=!0,S("reject"),L("reject"))},O=function(){var fe=w();fe.group===i.group&&(c(!0),m.current=!1,b.current=document.activeElement)},L=function(){var fe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"cancel";c(!1),S("onHide",{result:fe}),Ce.focus(b.current),b.current=null},J=function(fe){if(fe.tagKey===i.tagKey){var Y=o!==fe.visible,ie=x("target")!==fe.target;ie&&!i.target?(L(),g.current=fe,p(!0)):Y&&(g.current=fe,fe.visible?O():L())}};y.useEffect(function(){i.visible?O():L()},[i.visible]),y.useEffect(function(){return!i.target&&!i.message&&fs.on("confirm-dialog",J),function(){fs.off("confirm-dialog",J)}},[i.target]),ar(function(){f&&O()},[f]),Va(function(){fs.off("confirm-dialog",J)}),y.useImperativeHandle(e,function(){return{props:i,confirm:J}});var be=function(){var fe=x("defaultFocus"),Y=yt("p-confirm-dialog-accept",x("acceptClassName")),ie=yt("p-confirm-dialog-reject",{"p-button-text":!x("rejectClassName")},x("rejectClassName")),K={label:T,autoFocus:fe==="reject",icon:x("rejectIcon"),className:yt(x("rejectClassName"),P("rejectButton",{getPropValue:x})),onClick:F,pt:_("rejectButton"),unstyled:i.unstyled,__parentMetadata:{parent:A}},ne=n({label:C,autoFocus:fe===void 0||fe==="accept",icon:x("acceptIcon"),className:yt(x("acceptClassName"),P("acceptButton")),onClick:U,pt:_("acceptButton"),unstyled:i.unstyled,__parentMetadata:{parent:A}},_("acceptButton")),ue=y.createElement(y.Fragment,null,y.createElement(Rt,K),y.createElement(Rt,ne));if(x("footer")){var ye={accept:U,reject:F,acceptClassName:Y,rejectClassName:ie,acceptLabel:C,rejectLabel:T,element:ue,props:w()};return Oe.getJSXElement(x("footer"),ye)}return ue},xe=function(){var fe=w(),Y=Oe.getJSXElement(x("message"),fe),ie=n({className:P("icon")},_("icon")),K=Hn.getJSXIcon(x("icon"),Ch({},ie),{props:fe}),ne=be(),ue=n({className:P("message")},_("message")),ye=n({visible:o,className:yt(x("className"),P("root")),footer:ne,onHide:L,breakpoints:x("breakpoints"),pt:fe.pt,unstyled:i.unstyled,appendTo:x("appendTo"),__parentMetadata:{parent:A}},fv.getOtherProps(fe));return y.createElement(Ms,Fw({},ye,{content:t==null?void 0:t.content}),K,y.createElement("span",ue,Y))},le=xe();return y.createElement(ll,{element:le,appendTo:x("appendTo")})}));ewe.displayName="ConfirmDialog";const twe=()=>{const t=Yp(),e=t==null?void 0:t.form_template_id,[n,r]=k.useState([]),{activeFormVersionById:i}=xn();return k.useEffect(()=>()=>{},[]),l.jsx("div",{className:"card",children:(n==null?void 0:n.length)>0&&(n==null?void 0:n.map((a,s)=>l.jsxs("div",{children:[l.jsx("ul",{className:"list-none p-0 m-0",children:l.jsxs("li",{className:"flex flex-column md:flex-row md:align-items-center md:justify-content-between mb-3",style:{borderRadius:"10px"},children:[l.jsx("div",{children:l.jsxs("div",{children:[l.jsx("span",{className:"inline-flex justify-content-center align-items-center w-2rem h-2rem border-circle border-1",children:(a==null?void 0:a.is_active)===1?l.jsx("i",{style:{color:"green"},className:"pi pi-check"}):l.jsx("i",{className:"pi pi-check"})}),l.jsxs("span",{className:" font-bold ml-2",children:[a==null?void 0:a.version_name,(a==null?void 0:a.is_active)===1?" - Active ":""]})]})}),l.jsx("div",{className:"flex align-items-center justify-content-between md:justify-content-end mt-3 md:mt-0",children:l.jsx("div",{className:"text-right ml-3",children:l.jsx("span",{className:" font-bold",children:(a==null?void 0:a.is_active)===1?"":l.jsx(Rt,{text:!0,onClick:()=>{i(e,a==null?void 0:a.form_template_version_id),setTimeout(()=>{},3e3)},severity:"success",label:"Make this version active",icon:"pi pi-check",size:"small"})})})})]})}),l.jsx("hr",{})]},`version-item-${s}`)))})},nwe=()=>{const{setLayout:t,formBuilderConfigurationType:e}=xn(),n=k.useRef(null),r=a=>{var s;switch((s=a==null?void 0:a.formType)==null?void 0:s.key){case(e==null?void 0:e.key):t(a==null?void 0:a.layout);break}};async function i(a){return new Promise((s,o)=>{const c=new FileReader;c.onload=u=>s(JSON.parse(u.target.result)),c.onerror=u=>o(u),c.readAsText(a)})}return l.jsxs(l.Fragment,{children:[l.jsx("input",{ref:n,type:"file",style:{display:"none"},id:"schema",name:"schema",onChange:async a=>{var o;const s=await i((o=a==null?void 0:a.target)==null?void 0:o.files[0]);r(s)}}),l.jsx(Rt,{text:!0,size:"small",className:"p-button-primary ml-3 mr-3",onClick:()=>{n.current.click()},label:"Import Template"})]})},rwe=()=>{const{builderTemplateName:t,formBuilderFormSchema:e}=xn(),n=function(){const r=document.createElement("a");return function(i,a){const s=JSON.stringify(i),o=new Blob([s],{type:"octet/stream"}),c=window.URL.createObjectURL(o);r.href=c,r.download=a,r.click(),window.URL.revokeObjectURL(c)}}();return l.jsx(Rt,{text:!0,size:"small",className:"p-button-info ml-3",onClick:()=>{const r=e,i=t+".json";n(r,i)},label:"Export Template"})};function Ag(){return Ag=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Ag.apply(this,arguments)}function xg(t){"@babel/helpers - typeof";return xg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},xg(t)}function iwe(t,e){if(xg(t)!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(xg(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function awe(t){var e=iwe(t,"string");return xg(e)==="symbol"?e:String(e)}function swe(t,e,n){return e=awe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function owe(t){if(Array.isArray(t))return t}function lwe(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,a,s,o=[],c=!0,u=!1;try{if(a=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(o.push(r.value),o.length!==e);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw i}}return o}}function JU(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function cwe(t,e){if(t){if(typeof t=="string")return JU(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return JU(t,e)}}function uwe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
4226
4226
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dwe(t,e){return owe(t)||lwe(t,e)||cwe(t,e)||uwe()}var fwe={root:function(e){var n=e.props,r=e.focusedState,i=e.checked;return yt("p-inputswitch p-component",{"p-inputswitch-checked":i,"p-disabled":n.disabled,"p-focus":r})},slider:"p-inputswitch-slider"},hwe=`
4227
4227
  @layer primereact {
@@ -56447,7 +56447,7 @@ var Cue = function() {
56447
56447
  theme: i.theme,
56448
56448
  formats: i.formats
56449
56449
  };
56450
- Cue ? (p.current = new Quill(d.current, T), b(), p.current && p.current.getModule("toolbar") && i.onLoad && i.onLoad(p.current)) : import("./quill-C012Lqrr.js").then(function(x) {
56450
+ Cue ? (p.current = new Quill(d.current, T), b(), p.current && p.current.getModule("toolbar") && i.onLoad && i.onLoad(p.current)) : import("./quill-C5OFccLz.js").then(function(x) {
56451
56451
  x && we.isExist(d.current) && (x.default ? p.current = new x.default(d.current, T) : p.current = new x(d.current, T), b());
56452
56452
  }).then(function() {
56453
56453
  p.current && p.current.getModule("toolbar") && i.onLoad && i.onLoad(p.current);
@@ -122959,10 +122959,11 @@ const Yp = (t) => {
122959
122959
  isRenderView: s,
122960
122960
  showPreview: o,
122961
122961
  userFormBuilderSettings: l,
122962
- className: u = ""
122963
- } = t, d = Ip(), f = d == null ? void 0 : d.form_template_id, {
122964
- builderIsChangesSaved: p,
122965
- formBuilderConfigurationType: m,
122962
+ renderType: u,
122963
+ className: d = ""
122964
+ } = t, f = Ip(), p = f == null ? void 0 : f.form_template_id, {
122965
+ builderIsChangesSaved: m,
122966
+ // formBuilderConfigurationType,
122966
122967
  formBuilderFormSchema: b,
122967
122968
  saveFormProgress: y,
122968
122969
  userSelectedLanguage: w,
@@ -122970,14 +122971,14 @@ const Yp = (t) => {
122970
122971
  formatTableFieldsHook: C,
122971
122972
  schemaBuilderUpdate: E
122972
122973
  } = xn(), T = (D) => {
122973
- p === !1 ? (D.preventDefault(), D.returnValue = !1) : window.location.reload();
122974
+ m === !1 ? (D.preventDefault(), D.returnValue = !1) : window.location.reload();
122974
122975
  };
122975
122976
  mn(() => (window.addEventListener("beforeunload", T), () => {
122976
122977
  window.removeEventListener("beforeunload", T);
122977
- }), [p]);
122978
+ }), [m]);
122978
122979
  const x = (D) => {
122979
122980
  y(
122980
- f,
122981
+ p,
122981
122982
  b,
122982
122983
  D
122983
122984
  );
@@ -122985,7 +122986,7 @@ const Yp = (t) => {
122985
122986
  return mn(() => ((b == null ? void 0 : b.enableAutoSaveBuilderSetting) === !0 && A === !1 ? x(!1) : E({
122986
122987
  isChangesSaved: !1
122987
122988
  }), C(r), () => {
122988
- }), [r]), /* @__PURE__ */ c(Le, { children: /* @__PURE__ */ c("div", { className: "grid", children: /* @__PURE__ */ c("div", { className: "col-12", children: /* @__PURE__ */ c("div", { className: u, children: /* @__PURE__ */ c(
122989
+ }), [r]), /* @__PURE__ */ c(Le, { children: /* @__PURE__ */ c("div", { className: "grid", children: /* @__PURE__ */ c("div", { className: "col-12", children: /* @__PURE__ */ c("div", { className: d, children: /* @__PURE__ */ c(
122989
122990
  dSe,
122990
122991
  {
122991
122992
  isAdvanceView: n,
@@ -122993,7 +122994,7 @@ const Yp = (t) => {
122993
122994
  isAdmin: e,
122994
122995
  layout: r,
122995
122996
  isPreview: o,
122996
- renderType: m == null ? void 0 : m.key
122997
+ renderType: u == null ? void 0 : u.key
122997
122998
  }
122998
122999
  ) }) }) }) });
122999
123000
  }, fSe = {
@@ -1,7 +1,7 @@
1
1
  var Ml = Object.defineProperty;
2
2
  var Dl = (n, t, e) => t in n ? Ml(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
3
  var T = (n, t, e) => (Dl(n, typeof t != "symbol" ? t + "" : t, e), e);
4
- import { d as ti, i as Rr, a as Hi, b as Ul, e as Br, M as Pl, S as ei, U as si, g as ni, c as ri, f as fr, h as zs, j as $i, k as Vs, l as dr, m as jl, n as Hl, o as Fi, p as $l, q as Fl, r as zl, s as Kl, t as ii, u as Gl, v as Vl, w as Ft, x as zi, y as xe } from "./main-B1fioFnq.js";
4
+ import { d as ti, i as Rr, a as Hi, b as Ul, e as Br, M as Pl, S as ei, U as si, g as ni, c as ri, f as fr, h as zs, j as $i, k as Vs, l as dr, m as jl, n as Hl, o as Fi, p as $l, q as Fl, r as zl, s as Kl, t as ii, u as Gl, v as Vl, w as Ft, x as zi, y as xe } from "./main-DurNeSJN.js";
5
5
  function Ki(n) {
6
6
  return n;
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cft-builder",
3
- "version": "0.0.22",
3
+ "version": "0.0.23",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"