df-ae-forms-package 1.0.49 → 1.0.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dist/index.d.ts +62 -3
  2. package/dist/index.esm.js +2 -2
  3. package/dist/index.esm.js.map +1 -1
  4. package/dist/index.js +12 -12
  5. package/dist/index.js.map +1 -1
  6. package/package.json +1 -1
  7. package/dist/ComponentActionFeatures.d.ts +0 -19
  8. package/dist/ComponentActionFeatures.d.ts.map +0 -1
  9. package/dist/DfFormPreview.d.ts +0 -24
  10. package/dist/DfFormPreview.d.ts.map +0 -1
  11. package/dist/ThresholdAlert.d.ts +0 -15
  12. package/dist/ThresholdAlert.d.ts.map +0 -1
  13. package/dist/components/ComponentSubmissionActions.d.ts +0 -9
  14. package/dist/components/ComponentSubmissionActions.d.ts.map +0 -1
  15. package/dist/components/RaiseIssueModal.d.ts +0 -24
  16. package/dist/components/RaiseIssueModal.d.ts.map +0 -1
  17. package/dist/df-form-controls/df-form-checkbox/DfFormCheckbox.d.ts +0 -22
  18. package/dist/df-form-controls/df-form-checkbox/DfFormCheckbox.d.ts.map +0 -1
  19. package/dist/df-form-controls/df-form-checkbox/index.d.ts +0 -3
  20. package/dist/df-form-controls/df-form-checkbox/index.d.ts.map +0 -1
  21. package/dist/df-form-controls/df-form-comments/DfFormComments.d.ts +0 -12
  22. package/dist/df-form-controls/df-form-comments/DfFormComments.d.ts.map +0 -1
  23. package/dist/df-form-controls/df-form-comments/index.d.ts +0 -3
  24. package/dist/df-form-controls/df-form-comments/index.d.ts.map +0 -1
  25. package/dist/df-form-controls/df-form-date-time/DfFormDateTime.d.ts +0 -21
  26. package/dist/df-form-controls/df-form-date-time/DfFormDateTime.d.ts.map +0 -1
  27. package/dist/df-form-controls/df-form-date-time/index.d.ts +0 -3
  28. package/dist/df-form-controls/df-form-date-time/index.d.ts.map +0 -1
  29. package/dist/df-form-controls/df-form-error-msg/DfFormErrorMsg.d.ts +0 -5
  30. package/dist/df-form-controls/df-form-error-msg/DfFormErrorMsg.d.ts.map +0 -1
  31. package/dist/df-form-controls/df-form-error-msg/index.d.ts +0 -3
  32. package/dist/df-form-controls/df-form-error-msg/index.d.ts.map +0 -1
  33. package/dist/df-form-controls/df-form-file-upload/DfFormFileUpload.d.ts +0 -33
  34. package/dist/df-form-controls/df-form-file-upload/DfFormFileUpload.d.ts.map +0 -1
  35. package/dist/df-form-controls/df-form-file-upload/example.d.ts +0 -8
  36. package/dist/df-form-controls/df-form-file-upload/example.d.ts.map +0 -1
  37. package/dist/df-form-controls/df-form-file-upload/index.d.ts +0 -3
  38. package/dist/df-form-controls/df-form-file-upload/index.d.ts.map +0 -1
  39. package/dist/df-form-controls/df-form-grid/df-form-grid.d.ts +0 -41
  40. package/dist/df-form-controls/df-form-grid/df-form-grid.d.ts.map +0 -1
  41. package/dist/df-form-controls/df-form-heading/DfFormHeading.d.ts +0 -12
  42. package/dist/df-form-controls/df-form-heading/DfFormHeading.d.ts.map +0 -1
  43. package/dist/df-form-controls/df-form-heading/index.d.ts +0 -3
  44. package/dist/df-form-controls/df-form-heading/index.d.ts.map +0 -1
  45. package/dist/df-form-controls/df-form-input/DfFormInput.d.ts +0 -25
  46. package/dist/df-form-controls/df-form-input/DfFormInput.d.ts.map +0 -1
  47. package/dist/df-form-controls/df-form-input/index.d.ts +0 -3
  48. package/dist/df-form-controls/df-form-input/index.d.ts.map +0 -1
  49. package/dist/df-form-controls/df-form-instruction/DfFormInstruction.d.ts +0 -13
  50. package/dist/df-form-controls/df-form-instruction/DfFormInstruction.d.ts.map +0 -1
  51. package/dist/df-form-controls/df-form-instruction/index.d.ts +0 -3
  52. package/dist/df-form-controls/df-form-instruction/index.d.ts.map +0 -1
  53. package/dist/df-form-controls/df-form-location/DfFormLocation.d.ts +0 -31
  54. package/dist/df-form-controls/df-form-location/DfFormLocation.d.ts.map +0 -1
  55. package/dist/df-form-controls/df-form-location/index.d.ts +0 -3
  56. package/dist/df-form-controls/df-form-location/index.d.ts.map +0 -1
  57. package/dist/df-form-controls/df-form-preview-interfaces.d.ts +0 -389
  58. package/dist/df-form-controls/df-form-preview-interfaces.d.ts.map +0 -1
  59. package/dist/df-form-controls/df-form-radio/DfFormRadio.d.ts +0 -22
  60. package/dist/df-form-controls/df-form-radio/DfFormRadio.d.ts.map +0 -1
  61. package/dist/df-form-controls/df-form-radio/index.d.ts +0 -3
  62. package/dist/df-form-controls/df-form-radio/index.d.ts.map +0 -1
  63. package/dist/df-form-controls/df-form-section/df-form-section.d.ts +0 -35
  64. package/dist/df-form-controls/df-form-section/df-form-section.d.ts.map +0 -1
  65. package/dist/df-form-controls/df-form-segment/DfFormSegment.d.ts +0 -23
  66. package/dist/df-form-controls/df-form-segment/DfFormSegment.d.ts.map +0 -1
  67. package/dist/df-form-controls/df-form-segment/index.d.ts +0 -3
  68. package/dist/df-form-controls/df-form-segment/index.d.ts.map +0 -1
  69. package/dist/df-form-controls/df-form-select/DfFormSelect.d.ts +0 -22
  70. package/dist/df-form-controls/df-form-select/DfFormSelect.d.ts.map +0 -1
  71. package/dist/df-form-controls/df-form-select/index.d.ts +0 -3
  72. package/dist/df-form-controls/df-form-select/index.d.ts.map +0 -1
  73. package/dist/df-form-controls/df-form-signature/DfFormSignature.d.ts +0 -21
  74. package/dist/df-form-controls/df-form-signature/DfFormSignature.d.ts.map +0 -1
  75. package/dist/df-form-controls/df-form-signature/index.d.ts +0 -3
  76. package/dist/df-form-controls/df-form-signature/index.d.ts.map +0 -1
  77. package/dist/df-form-controls/df-form-table/df-form-table.d.ts +0 -43
  78. package/dist/df-form-controls/df-form-table/df-form-table.d.ts.map +0 -1
  79. package/dist/df-form-controls/df-form-textarea/DfFormTextarea.d.ts +0 -21
  80. package/dist/df-form-controls/df-form-textarea/DfFormTextarea.d.ts.map +0 -1
  81. package/dist/df-form-controls/df-form-textarea/index.d.ts +0 -3
  82. package/dist/df-form-controls/df-form-textarea/index.d.ts.map +0 -1
  83. package/dist/index.d.ts.map +0 -1
  84. package/dist/services/conditionalLogicService.d.ts +0 -47
  85. package/dist/services/conditionalLogicService.d.ts.map +0 -1
  86. package/dist/services/toast.service.d.ts +0 -27
  87. package/dist/services/toast.service.d.ts.map +0 -1
  88. package/dist/types/form-builder-schema.model.d.ts +0 -75
  89. package/dist/types/form-builder-schema.model.d.ts.map +0 -1
package/dist/index.esm.js CHANGED
@@ -7,7 +7,7 @@ import t,{useState as e,useEffect as A,useCallback as r,useRef as n,useMemo as i
7
7
  *
8
8
  * This source code is licensed under the MIT license found in the
9
9
  * LICENSE file in the root directory of this source tree.
10
- */"production"===process.env.NODE_ENV?z.exports=function(){if(V)return G;V=1;var e=t,A=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function a(t,e,r){var a,o={},l=null,c=null;for(a in void 0!==r&&(l=""+r),void 0!==e.key&&(l=""+e.key),void 0!==e.ref&&(c=e.ref),e)n.call(e,a)&&!s.hasOwnProperty(a)&&(o[a]=e[a]);if(t&&t.defaultProps)for(a in e=t.defaultProps)void 0===o[a]&&(o[a]=e[a]);return{$$typeof:A,type:t,key:l,ref:c,props:o,_owner:i.current}}return G.Fragment=r,G.jsx=a,G.jsxs=a,G}():z.exports=(q||(q=1,"production"!==process.env.NODE_ENV&&function(){var e,A=t,r=Symbol.for("react.element"),n=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),g=Symbol.iterator,m=A.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function w(t){for(var e=arguments.length,A=new Array(e>1?e-1:0),r=1;r<e;r++)A[r-1]=arguments[r];!function(t,e,A){var r=m.ReactDebugCurrentFrame.getStackAddendum();""!==r&&(e+="%s",A=A.concat([r]));var n=A.map(function(t){return String(t)});n.unshift("Warning: "+e),Function.prototype.apply.call(console[t],console,n)}("error",t,A)}function B(t){return t.displayName||"Context"}function y(t){if(null==t)return null;if("number"==typeof t.tag&&w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),"function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t;switch(t){case i:return"Fragment";case n:return"Portal";case a:return"Profiler";case s:return"StrictMode";case u:return"Suspense";case h:return"SuspenseList"}if("object"==typeof t)switch(t.$$typeof){case l:return B(t)+".Consumer";case o:return B(t._context)+".Provider";case c:return function(t,e,A){var r=t.displayName;if(r)return r;var n=e.displayName||e.name||"";return""!==n?A+"("+n+")":A}(t,t.render,"ForwardRef");case d:var e=t.displayName||null;return null!==e?e:y(t.type)||"Memo";case f:var A=t,r=A._payload,p=A._init;try{return y(p(r))}catch(t){return null}}return null}e=Symbol.for("react.module.reference");var b,v,C,x,F,Q,U,E=Object.assign,N=0;function S(){}S.__reactDisabledLog=!0;var L,I=m.ReactCurrentDispatcher;function _(t,e,A){if(void 0===L)try{throw Error()}catch(t){var r=t.stack.trim().match(/\n( *(at )?)/);L=r&&r[1]||""}return"\n"+L+t}var k,T=!1,H="function"==typeof WeakMap?WeakMap:Map;function O(t,e){if(!t||T)return"";var A,r=k.get(t);if(void 0!==r)return r;T=!0;var n,i=Error.prepareStackTrace;Error.prepareStackTrace=void 0,n=I.current,I.current=null,function(){if(0===N){b=console.log,v=console.info,C=console.warn,x=console.error,F=console.group,Q=console.groupCollapsed,U=console.groupEnd;var t={configurable:!0,enumerable:!0,value:S,writable:!0};Object.defineProperties(console,{info:t,log:t,warn:t,error:t,group:t,groupCollapsed:t,groupEnd:t})}N++}();try{if(e){var s=function(){throw Error()};if(Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(s,[])}catch(t){A=t}Reflect.construct(t,[],s)}else{try{s.call()}catch(t){A=t}t.call(s.prototype)}}else{try{throw Error()}catch(t){A=t}t()}}catch(e){if(e&&A&&"string"==typeof e.stack){for(var a=e.stack.split("\n"),o=A.stack.split("\n"),l=a.length-1,c=o.length-1;l>=1&&c>=0&&a[l]!==o[c];)c--;for(;l>=1&&c>=0;l--,c--)if(a[l]!==o[c]){if(1!==l||1!==c)do{if(l--,--c<0||a[l]!==o[c]){var u="\n"+a[l].replace(" at new "," at ");return t.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",t.displayName)),"function"==typeof t&&k.set(t,u),u}}while(l>=1&&c>=0);break}}}finally{T=!1,I.current=n,function(){if(0===--N){var t={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:E({},t,{value:b}),info:E({},t,{value:v}),warn:E({},t,{value:C}),error:E({},t,{value:x}),group:E({},t,{value:F}),groupCollapsed:E({},t,{value:Q}),groupEnd:E({},t,{value:U})})}N<0&&w("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=i}var h=t?t.displayName||t.name:"",d=h?_(h):"";return"function"==typeof t&&k.set(t,d),d}function P(t,e,A){if(null==t)return"";if("function"==typeof t)return O(t,!(!(r=t.prototype)||!r.isReactComponent));var r;if("string"==typeof t)return _(t);switch(t){case u:return _("Suspense");case h:return _("SuspenseList")}if("object"==typeof t)switch(t.$$typeof){case c:return O(t.render,!1);case d:return P(t.type,e,A);case f:var n=t,i=n._payload,s=n._init;try{return P(s(i),e,A)}catch(t){}}return""}k=new H;var D=Object.prototype.hasOwnProperty,M={},j=m.ReactDebugCurrentFrame;function R(t){if(t){var e=t._owner,A=P(t.type,t._source,e?e.type:null);j.setExtraStackFrame(A)}else j.setExtraStackFrame(null)}var K=Array.isArray;function V(t){return K(t)}function z(t){return""+t}function G(t){if(function(t){try{return z(t),!1}catch(t){return!0}}(t))return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",function(t){return"function"==typeof Symbol&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object"}(t)),z(t)}var q,X,Y,J=m.ReactCurrentOwner,$={key:!0,ref:!0,__self:!0,__source:!0};function Z(t,e,A,n,i){var s,a={},o=null,l=null;for(s in void 0!==A&&(G(A),o=""+A),function(t){if(D.call(t,"key")){var e=Object.getOwnPropertyDescriptor(t,"key").get;if(e&&e.isReactWarning)return!1}return void 0!==t.key}(e)&&(G(e.key),o=""+e.key),function(t){if(D.call(t,"ref")){var e=Object.getOwnPropertyDescriptor(t,"ref").get;if(e&&e.isReactWarning)return!1}return void 0!==t.ref}(e)&&(l=e.ref,function(t,e){if("string"==typeof t.ref&&J.current&&e&&J.current.stateNode!==e){var A=y(J.current.type);Y[A]||(w('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',y(J.current.type),t.ref),Y[A]=!0)}}(e,i)),e)D.call(e,s)&&!$.hasOwnProperty(s)&&(a[s]=e[s]);if(t&&t.defaultProps){var c=t.defaultProps;for(s in c)void 0===a[s]&&(a[s]=c[s])}if(o||l){var u="function"==typeof t?t.displayName||t.name||"Unknown":t;o&&function(t,e){var A=function(){q||(q=!0,w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",e))};A.isReactWarning=!0,Object.defineProperty(t,"key",{get:A,configurable:!0})}(a,u),l&&function(t,e){var A=function(){X||(X=!0,w("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",e))};A.isReactWarning=!0,Object.defineProperty(t,"ref",{get:A,configurable:!0})}(a,u)}return function(t,e,A,n,i,s,a){var o={$$typeof:r,type:t,key:e,ref:A,props:a,_owner:s,_store:{}};return Object.defineProperty(o._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(o,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(o,"_source",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.freeze&&(Object.freeze(o.props),Object.freeze(o)),o}(t,o,l,i,n,J.current,a)}Y={};var tt,et=m.ReactCurrentOwner,At=m.ReactDebugCurrentFrame;function rt(t){if(t){var e=t._owner,A=P(t.type,t._source,e?e.type:null);At.setExtraStackFrame(A)}else At.setExtraStackFrame(null)}function nt(t){return"object"==typeof t&&null!==t&&t.$$typeof===r}function it(){if(et.current){var t=y(et.current.type);if(t)return"\n\nCheck the render method of `"+t+"`."}return""}tt=!1;var st={};function at(t,e){if(t._store&&!t._store.validated&&null==t.key){t._store.validated=!0;var A=function(t){var e=it();if(!e){var A="string"==typeof t?t:t.displayName||t.name;A&&(e="\n\nCheck the top-level render call using <"+A+">.")}return e}(e);if(!st[A]){st[A]=!0;var r="";t&&t._owner&&t._owner!==et.current&&(r=" It was passed a child from "+y(t._owner.type)+"."),rt(t),w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',A,r),rt(null)}}}function ot(t,e){if("object"==typeof t)if(V(t))for(var A=0;A<t.length;A++){var r=t[A];nt(r)&&at(r,e)}else if(nt(t))t._store&&(t._store.validated=!0);else if(t){var n=function(t){if(null===t||"object"!=typeof t)return null;var e=g&&t[g]||t["@@iterator"];return"function"==typeof e?e:null}(t);if("function"==typeof n&&n!==t.entries)for(var i,s=n.call(t);!(i=s.next()).done;)nt(i.value)&&at(i.value,e)}}function lt(t){var e,A=t.type;if(null!=A&&"string"!=typeof A){if("function"==typeof A)e=A.propTypes;else{if("object"!=typeof A||A.$$typeof!==c&&A.$$typeof!==d)return;e=A.propTypes}if(e){var r=y(A);!function(t,e,A,r,n){var i=Function.call.bind(D);for(var s in t)if(i(t,s)){var a=void 0;try{if("function"!=typeof t[s]){var o=Error((r||"React class")+": "+A+" type `"+s+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof t[s]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw o.name="Invariant Violation",o}a=t[s](e,s,r,A,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(t){a=t}!a||a instanceof Error||(R(n),w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",r||"React class",A,s,typeof a),R(null)),a instanceof Error&&!(a.message in M)&&(M[a.message]=!0,R(n),w("Failed %s type: %s",A,a.message),R(null))}}(e,t.props,"prop",r,t)}else void 0===A.PropTypes||tt||(tt=!0,w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",y(A)||"Unknown"));"function"!=typeof A.getDefaultProps||A.getDefaultProps.isReactClassApproved||w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}var ct={};function ut(t,A,n,g,m,B){var b=function(t){return"string"==typeof t||"function"==typeof t||t===i||t===a||t===s||t===u||t===h||t===p||"object"==typeof t&&null!==t&&(t.$$typeof===f||t.$$typeof===d||t.$$typeof===o||t.$$typeof===l||t.$$typeof===c||t.$$typeof===e||void 0!==t.getModuleId)}(t);if(!b){var v="";(void 0===t||"object"==typeof t&&null!==t&&0===Object.keys(t).length)&&(v+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var C,x=function(t){return void 0!==t?"\n\nCheck your code at "+t.fileName.replace(/^.*[\\\/]/,"")+":"+t.lineNumber+".":""}(m);v+=x||it(),null===t?C="null":V(t)?C="array":void 0!==t&&t.$$typeof===r?(C="<"+(y(t.type)||"Unknown")+" />",v=" Did you accidentally export a JSX literal instead of a component?"):C=typeof t,w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",C,v)}var F=Z(t,A,n,m,B);if(null==F)return F;if(b){var Q=A.children;if(void 0!==Q)if(g)if(V(Q)){for(var U=0;U<Q.length;U++)ot(Q[U],t);Object.freeze&&Object.freeze(Q)}else w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else ot(Q,t)}if(D.call(A,"key")){var E=y(t),N=Object.keys(A).filter(function(t){return"key"!==t}),S=N.length>0?"{key: someKey, "+N.join(": ..., ")+": ...}":"{key: someKey}";ct[E+S]||(w('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',S,E,N.length>0?"{"+N.join(": ..., ")+": ...}":"{}",E),ct[E+S]=!0)}return t===i?function(t){for(var e=Object.keys(t.props),A=0;A<e.length;A++){var r=e[A];if("children"!==r&&"key"!==r){rt(t),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",r),rt(null);break}}null!==t.ref&&(rt(t),w("Invalid attribute `ref` supplied to `React.Fragment`."),rt(null))}(F):lt(F),F}var ht=function(t,e,A){return ut(t,e,A,!1)},dt=function(t,e,A){return ut(t,e,A,!0)};W.Fragment=i,W.jsx=ht,W.jsxs=dt}()),W);var X=z.exports;class Y{constructor(){}static getInstance(){return Y.instance||(Y.instance=new Y),Y.instance}getAvailableComponentsForConditional(t,e){if(!t||!Array.isArray(t))return[];const A=t.filter(t=>!e||t.id!==e).map(t=>({id:t.id,label:t.basic?.label||t.id,type:t.name,key:t.id})).sort((t,e)=>t.label.localeCompare(e.label));return A}getApplicableOperators(t){switch(t){case"text-input":case"email-input":case"textarea":return["equals","notEquals","contains","notContains","isEmpty","isNotEmpty"];case"number-input":case"date-picker":case"datetime-picker":return["equals","notEquals","greaterThan","lessThan","greaterThanOrEqual","lessThanOrEqual","isEmpty","isNotEmpty"];case"select":case"radio":case"segment":default:return["equals","notEquals","isEmpty","isNotEmpty"];case"checkbox":return["contains","notContains","isEmpty","isNotEmpty"]}}validateConditionalLogic(t,e){const A=[];return t?(["show","hide","always"].includes(t.action)||A.push("Invalid conditional action"),["all","any"].includes(t.when)||A.push("Invalid when condition"),t.conditions&&0!==t.conditions.length?t.conditions.forEach((t,r)=>{const n=e.find(e=>e.id===t.when);if(!n)return void A.push(`Condition ${r+1}: Component not found`);this.getApplicableOperators(n.name).includes(t.operator)||A.push(`Condition ${r+1}: Operator not applicable for component type`),this.isValidConditionValue(t.value,n.name,t.operator)||A.push(`Condition ${r+1}: Invalid condition value`)}):A.push("At least one condition is required"),{isValid:0===A.length,errors:A}):{isValid:!0,errors:[]}}evaluateConditionalLogic(t,e,A){try{if(!t||"always"===t.action)return{shouldShow:!0,evaluatedConditions:[]};if(!t.conditions||0===t.conditions.length)return{shouldShow:!0,evaluatedConditions:[]};const r=t.conditions.map(t=>{try{const r=this.getComponentValue(t.when,e,A);return{condition:t,result:this.evaluateCondition(t,r),componentValue:r}}catch(e){return console.error("[ConditionalLogicService] Error evaluating condition:",e),{condition:t,result:!1,componentValue:void 0}}});return{shouldShow:this.determineFinalResult(t,r),evaluatedConditions:r}}catch(t){return console.error("[ConditionalLogicService] Error in evaluateConditionalLogic:",t),{shouldShow:!0,evaluatedConditions:[]}}}getComponentValue(t,e,A){const r=e=>{for(const A of e){if(A.id===t||A.basic?.label===t)return A;if("section"===A.name&&A.children){const t=r(A.children);if(t)return t}if("table"===A.name&&A.cells)for(const t of A.cells)for(const e of t)if(e.components){const t=r(e.components);if(t)return t}if("datagrid"===A.name&&A.entries)for(const t of A.entries)if(t.components){const e=r(t.components);if(e)return e}}},n=r(e);return n?A&&void 0!==A[n.id]?A[n.id]:n.basic&&"defaultValue"in n.basic?n.basic.defaultValue:void 0:A&&void 0!==A[t]?A[t]:void 0}evaluateCondition(t,e){const{operator:A,value:r}=t;if("checked"===r||"notChecked"===r)return this.evaluateCheckboxCondition(e,r);switch(A){case"equals":return this.isEqual(e,r);case"notEquals":return!this.isEqual(e,r);case"isEmpty":return this.isEmpty(e);case"isNotEmpty":return!this.isEmpty(e);case"contains":return this.contains(e,r);case"notContains":return!this.contains(e,r);case"greaterThan":return this.isGreaterThan(e,r);case"lessThan":return this.isLessThan(e,r);case"greaterThanOrEqual":return this.isGreaterThanOrEqual(e,r);case"lessThanOrEqual":return this.isLessThanOrEqual(e,r);default:return!1}}evaluateCheckboxCondition(t,e){const A=this.isCheckboxChecked(t);return"checked"===e?A:"notChecked"===e&&!A}isCheckboxChecked(t){return null!=t&&("boolean"==typeof t?t:"string"==typeof t?"true"===t.toLowerCase()||"1"===t:Array.isArray(t)?t.length>0:"number"==typeof t&&t>0)}determineFinalResult(t,e){let A,r;return A="all"===t.when?e.every(t=>t.result):"any"===t.when&&e.some(t=>t.result),r="show"===t.action?A:"hide"===t.action?!A:(t.action,!0),r}isEqual(t,e){if(t===e)return!0;if(null==t||null==e)return!1;if(Array.isArray(t)&&Array.isArray(e))return t.length===e.length&&t.every((t,A)=>this.isEqual(t,e[A]));if("object"==typeof t&&"object"==typeof e){const A=Object.keys(t),r=Object.keys(e);return A.length===r.length&&A.every(A=>this.isEqual(t[A],e[A]))}return!1}isEmpty(t){return null==t||void 0===t||("string"==typeof t?""===t.trim():Array.isArray(t)?0===t.length:"object"==typeof t&&0===Object.keys(t).length)}contains(t,e){return null!=t&&null!=e&&("string"==typeof t?t.toLowerCase().includes(String(e).toLowerCase()):!!Array.isArray(t)&&t.some(t=>this.isEqual(t,e)))}isGreaterThan(t,e){const A=Number(t),r=Number(e);return!isNaN(A)&&!isNaN(r)&&A>r}isLessThan(t,e){const A=Number(t),r=Number(e);return!isNaN(A)&&!isNaN(r)&&A<r}isGreaterThanOrEqual(t,e){const A=Number(t),r=Number(e);return!isNaN(A)&&!isNaN(r)&&A>=r}isLessThanOrEqual(t,e){const A=Number(t),r=Number(e);return!isNaN(A)&&!isNaN(r)&&A<=r}isValidConditionValue(t,e,A){if(null==t)return["isEmpty","isNotEmpty"].includes(A);switch(e){case"number-input":return!isNaN(Number(t))||["isEmpty","isNotEmpty"].includes(A);case"date-picker":case"datetime-picker":return!isNaN(Date.parse(t))||["isEmpty","isNotEmpty"].includes(A);case"checkbox":return Array.isArray(t)||"string"==typeof t||"number"==typeof t;default:return!0}}createDefaultConditionalLogic(){return{action:"show",when:"all",conditions:[]}}getOperatorDisplayText(t){return{equals:"Is Equal To",notEquals:"Is Not Equal To",contains:"Contains",notContains:"Does Not Contain",isEmpty:"Is Empty",isNotEmpty:"Is Not Empty",greaterThan:"Is Greater Than",lessThan:"Is Less Than",greaterThanOrEqual:"Is Greater Than Or Equal To",lessThanOrEqual:"Is Less Than Or Equal To"}[t]||t}getActionDisplayText(t){return{show:"Show this field when",hide:"Hide this field when",always:"Always show this field"}[t]||t}getConditionalLogicSummary(t,e){if(!t||0===t.conditions.length)return"No conditions";if("always"===t.action)return"Always show";const A=this.getActionDisplayText(t.action),r=t.conditions.map(t=>{const A=e.find(e=>e.id===t.when);return`${A?.basic.label||"Unknown component"} ${this.getOperatorDisplayText(t.operator)} ${this.formatConditionValue(t.value)}`}),n="all"===t.when?" and ":" or ";return`${A} ${r.join(n)}`}formatConditionValue(t){return null==t?"empty":Array.isArray(t)?`[${t.join(", ")}]`:"string"==typeof t?`"${t}"`:String(t)}}const J=Y.getInstance();const $=new class{constructor(){this.toasts=[],this.listeners=[],this.defaultDuration=3e3,this.timeouts={}}generateId(){return Date.now().toString(36)+Math.random().toString(36).substr(2)}notifyListeners(){this.listeners.forEach(t=>t([...this.toasts]))}addToast(t){try{this.toasts.push(t),this.notifyListeners(),this.timeouts[t.id]=setTimeout(()=>{this.removeToast(t.id)},t.duration||this.defaultDuration)}catch(t){console.error("Error displaying toast message:",t)}}removeToast(t){this.timeouts[t]&&(clearTimeout(this.timeouts[t]),delete this.timeouts[t]),this.toasts=this.toasts.filter(e=>e.id!==t),this.notifyListeners()}showSuccess(t,e=3e3){const A={id:this.generateId(),message:t,type:"success",duration:e};this.addToast(A)}showError(t,e=5e3){const A={id:this.generateId(),message:t,type:"danger",duration:e};this.addToast(A)}showWarning(t,e){const A={id:this.generateId(),message:t,type:"warning",duration:e};this.addToast(A)}showInfo(t,e){const A={id:this.generateId(),message:t,type:"info",duration:e};this.addToast(A)}show(t,e="success",A){const r={id:this.generateId(),message:t,type:e,duration:A};this.addToast(r)}clearAll(){Object.values(this.timeouts).forEach(t=>clearTimeout(t)),this.timeouts={},this.toasts=[],this.notifyListeners()}subscribe(t){return this.listeners.push(t),()=>{this.listeners=this.listeners.filter(e=>e!==t)}}getToasts(){return[...this.toasts]}},Z=({validationErrors:t,fieldId:e,touchedFields:A,formSubmitted:r,properties:n,localValidation:i,isTouched:s,mode:a})=>{const o=t=>{const e=n.basic.label||"This field",A=n.name||"",r=n.validation?.customValidationMessage;if("number-input"===A)switch(t){case"required":return`${e} is required`;case"lowerLimit":return"Number is below the lower limit";case"upperLimit":return"Number is above the upper limit";default:return""}if(r)return r;const i="date-picker"===A||"datetime-picker"===A?n.basic?.dateTimeMode||("datetime-picker"===A?"datetime":"date"):null;switch(t){case"required":return`${e} is required`;case"invalidDate":return"time"===i?"Please select a valid time":"datetime"===i?"Please select a valid date and time":"date"===i?"Please select a valid date":`${e} is invalid`;case"minLength":return`${e} must be at least ${n.validation.minLength} characters long`;case"maxLength":return`${e} must be no more than ${n.validation.maxLength} characters long`;case"min":return`${e} must be at least ${n.validation.min}`;case"max":return`${e} must be no more than ${n.validation.max}`;case"lowerLimit":const t=n.validation,A=t?.lowerLimit;return`You are under the limit. ${e} must be at least ${A}`;case"upperLimit":const r=n.validation,s=r?.upperLimit;return`You crossed the limit. ${e} must be no more than ${s}`;case"pattern":return`${e} format is invalid`;case"email":return`${e} must be a valid email address`;default:return`${e} is invalid`}},l=(()=>{if("test"!==a)return"";if(!(s||A[e]||r))return"";if(i&&i.isValid)return"";if(i&&!i.isValid&&Object.keys(i.errors).length>0){const t=Object.keys(i.errors).filter(t=>!0===i.errors[t]);if(t.length>0){const e=t[0],A=n.name||"";return"pattern"===e&&"number-input"===A?"":o(e)}}const l=t[e];if(l&&"string"==typeof l&&""!==l.trim()){const t=n.name||"";if("number-input"===t&&i){const t=n.validation,e=t&&"lowerLimit"in t&&void 0!==t.lowerLimit&&null!==t.lowerLimit&&0!==t.lowerLimit,A=t&&"upperLimit"in t&&void 0!==t.upperLimit&&null!==t.upperLimit&&0!==t.upperLimit;return!l.includes("limit")&&!l.includes("Limit")||e||A?(i.isValid,""):""}if(("date-picker"===t||"datetime-picker"===t)&&l.includes("valid date")){const e=n.basic?.dateTimeMode||("datetime-picker"===t?"datetime":"date");if("time"===e)return"Please select a valid time";if("datetime"===e)return"Please select a valid date and time"}return l}return""})();return l?X.jsx("div",{className:"form-error-msg",children:l}):null},tt=t=>{if(null==t||""===t)return null;if(t instanceof Date)return isNaN(t.getTime())?null:t;if("number"==typeof t){const e=new Date(t);return isNaN(e.getTime())?null:e}if("string"==typeof t){let e=t.trim();e.match(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}/)&&(e=e.replace(" ","T"));const A=new Date(e);return isNaN(A.getTime())?null:A}return null};var et;!function(t){t.OPEN="Open",t.IN_PROGRESS="In-Progress",t.REJECTED="Rejected",t.RESOLVE="Resolve"}(et||(et={}));const At=({isOpen:r,onClose:n,onSuccess:i,component:d,formTemplateId:f,notes:p="",attachments:g=null,issue:m=null,onCreateIssue:w,onUpdateIssue:B,user:y,availableUsers:b=["Priya Das","Maria Garcia","John Smith","Sarah Johnson"],workOrderNumber:v,assetNumber:C,isStandalone:x,isEdit:F})=>{const[Q,U]=e(""),[E,N]=e(""),[S,L]=e(""),[I,k]=e(""),[T,H]=e("Medium"),[O,P]=e(et.OPEN),[D,M]=e(""),[j,R]=e(""),[K,V]=e(!1),[z,G]=e(g||[]),[q,W]=e(!1),Y=t.useRef(null),J=void 0!==F?F:!!m;A(()=>{m?.attachments&&m.attachments.length>0?G(m.attachments):g&&G(g)},[g,m]);const Z=t=>{if(!t)return"Attachment";if(t instanceof File)return t.name;if("string"==typeof t){if(t.startsWith("data:"))return"Attachment";const e=t.split("/");return e[e.length-1]||"Attachment"}return t.fileName||t.filename||t.name||"Attachment"},At=t=>{if(!t)return null;const e=t=>/\.(jpg|jpeg|png|gif|webp)$/i.test(t),A=t=>t.startsWith("data:image");return t instanceof File?t.type.startsWith("image/")?URL.createObjectURL(t):null:"string"==typeof t?A(t)||e(t)?t:null:t.data&&A(t.data)||t.fileName&&e(t.fileName)&&t.data?t.data:null};A(()=>{if(r)if(m||J){U(m?.title||""),N(m?.description||""),L(m?.workOrderNumber||v||""),k(m?.assetNumber||C||""),H(m?.priority||"Medium");const t=m?.status||et.OPEN,e=t===et.OPEN||t===et.IN_PROGRESS||t===et.REJECTED||t===et.RESOLVE?t:et.OPEN;P(e),M(m?.assignTo||m?.assignee||""),R(m?.comments||"")}else d&&(d.basic,U(""),N(""),R(p||""),v&&L(v),C&&k(C))},[r,d,p,m,v,C]);const rt=t.useMemo(()=>{if(!Q.trim())return!1;if(!E.trim())return!1;if(!O)return!1;if(!D)return!1;if(!x){if(!S.trim())return!1;if(!I.trim())return!1}return!0},[Q,E,O,D,x,S,I]),nt=async t=>{if(m){V(!0);try{const e={title:String(Q||"").trim(),description:String(E||"").trim(),workOrderNumber:String(S||"").trim()||void 0,assetNumber:String(I||"").trim()||void 0,formTemplateId:m.formTemplateId||"",component:m.component||{},priority:T,assignee:String(D||"").trim()||void 0,status:t,comments:String(j||"").trim()||""};B&&m._id&&await B(m._id,e),P(t);const A={[et.IN_PROGRESS]:"Issue accepted and moved to In-Progress",[et.RESOLVE]:"Issue resolved successfully",[et.REJECTED]:"Issue rejected"};$.showSuccess(A[t]||"Issue status updated successfully"),i&&i(),n()}catch(t){const e=t?.message||t?.error?.message||"Failed to update issue status. Please try again.";$.showError(e)}finally{V(!1)}}};if(!r)return null;const it=X.jsx("div",{className:"raise-issue-modal-overlay",onClick:n,children:X.jsxs("div",{className:"raise-issue-modal",onClick:t=>t.stopPropagation(),children:[X.jsxs("div",{className:"raise-issue-modal-header",children:[X.jsxs("div",{className:"raise-issue-modal-header-left",children:[X.jsx(s,{className:"raise-issue-modal-icon",size:20}),X.jsx("div",{className:"raise-issue-modal-header-text",children:X.jsx("div",{className:"raise-issue-modal-title-main",children:J?"Edit Issue":"Create Issue"})})]}),X.jsx("button",{className:"raise-issue-modal-close",onClick:n,"aria-label":"Close",children:X.jsx(a,{size:18})})]}),X.jsx("div",{className:"raise-issue-modal-content",children:X.jsxs("div",{className:"raise-issue-fields-grid",children:[J&&m?.issueNumber&&X.jsxs("div",{className:"raise-issue-field",children:[X.jsx("label",{className:"raise-issue-field-label",children:"Issue ID"}),X.jsx("input",{type:"text",className:"raise-issue-field-input raise-issue-field-readonly",value:m.issueNumber,readOnly:!0})]}),X.jsxs("div",{className:"raise-issue-field",children:[X.jsx("label",{className:"raise-issue-field-label",children:"Task"}),X.jsx("input",{type:"text",className:"raise-issue-field-input raise-issue-field-readonly",value:J?m?.component?.basic?.label||"":d?.basic?.label||"",readOnly:!0})]}),X.jsxs("div",{className:"raise-issue-field",children:[X.jsx("label",{className:"raise-issue-field-label",children:"Task Value"}),X.jsx("input",{type:"text",className:"raise-issue-field-input raise-issue-field-readonly",value:J?m?.component?.basic?.value||"":d?.basic?.value||"",readOnly:!0})]}),X.jsxs("div",{className:"raise-issue-field",children:[X.jsxs("label",{className:"raise-issue-field-label",children:["Title ",X.jsx("span",{className:"raise-issue-required",children:"*"})]}),X.jsx("input",{type:"text",className:"raise-issue-field-input "+(J?"raise-issue-field-readonly":""),value:Q,onChange:t=>U(t.target.value),placeholder:"Enter issue title",readOnly:J})]}),!x&&X.jsxs("div",{className:"raise-issue-field",children:[X.jsxs("label",{className:"raise-issue-field-label",children:["Work Order ",X.jsx("span",{className:"raise-issue-required",children:"*"})]}),X.jsx("input",{type:"text",className:"raise-issue-field-input "+(J?"raise-issue-field-readonly":""),value:S,onChange:t=>L(t.target.value),placeholder:"N/A",readOnly:J})]}),!x&&X.jsxs("div",{className:"raise-issue-field",children:[X.jsxs("label",{className:"raise-issue-field-label",children:["Asset Number ",X.jsx("span",{className:"raise-issue-required",children:"*"})]}),X.jsx("input",{type:"text",className:"raise-issue-field-input "+(J?"raise-issue-field-readonly":""),value:I,onChange:t=>k(t.target.value),placeholder:"Enter asset number",readOnly:J})]}),X.jsxs("div",{className:"raise-issue-field",children:[X.jsxs("label",{className:"raise-issue-field-label",children:["Raised By ",X.jsx("span",{className:"raise-issue-required",children:"*"})]}),X.jsxs("div",{className:"raise-issue-field-value-with-icon",children:[X.jsx(o,{size:16}),X.jsx("span",{children:y&&`${y.firstName||""} ${y.lastName||""}`.trim()||"User"})]})]}),X.jsxs("div",{className:"raise-issue-field",children:[X.jsx("label",{className:"raise-issue-field-label",children:"Created On"}),X.jsxs("div",{className:"raise-issue-field-value-with-icon",children:[X.jsx(l,{size:16}),X.jsx("span",{children:J&&m?.createdAt?(tt(m.createdAt)||new Date).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0}):(new Date).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0})})]})]}),X.jsxs("div",{className:"raise-issue-field raise-issue-field-full-width",children:[X.jsxs("label",{className:"raise-issue-field-label",children:["Description ",X.jsx("span",{className:"raise-issue-required",children:"*"})]}),X.jsx("textarea",{className:"raise-issue-field-textarea "+(J?"raise-issue-field-readonly":""),value:E,onChange:t=>N(t.target.value),placeholder:"Enter issue description",rows:4,readOnly:J})]}),X.jsxs("div",{className:"raise-issue-field",children:[X.jsxs("label",{className:"raise-issue-field-label",children:["Status ",X.jsx("span",{className:"raise-issue-required",children:"*"})]}),X.jsxs("select",{className:"raise-issue-field-select "+(J?"":"raise-issue-field-readonly"),value:O,onChange:t=>P(t.target.value),disabled:!J,children:[X.jsx("option",{value:et.OPEN,children:et.OPEN}),X.jsx("option",{value:et.IN_PROGRESS,children:et.IN_PROGRESS}),X.jsx("option",{value:et.REJECTED,children:et.REJECTED}),X.jsx("option",{value:et.RESOLVE,children:et.RESOLVE})]})]}),X.jsxs("div",{className:"raise-issue-field",children:[X.jsxs("label",{className:"raise-issue-field-label",children:["Assign to ",X.jsx("span",{className:"raise-issue-required",children:"*"})]}),X.jsxs("select",{className:"raise-issue-field-select",value:D,onChange:t=>M(t.target.value),children:[X.jsx("option",{value:"",children:"Unassigned"}),b.map(t=>X.jsx("option",{value:t,children:t},t))]})]}),X.jsxs("div",{className:"raise-issue-field raise-issue-field-full-width",children:[X.jsxs("label",{className:"raise-issue-field-label",children:["Priority ",X.jsx("span",{className:"raise-issue-required",children:"*"})]}),X.jsxs("div",{className:"raise-issue-priority-buttons",children:[X.jsx("button",{type:"button",className:"priority-button priority-low "+("Low"===T?"active":""),onClick:()=>H("Low"),children:"Low"}),X.jsx("button",{type:"button",className:"priority-button priority-medium "+("Medium"===T?"active":""),onClick:()=>H("Medium"),children:"Medium"}),X.jsx("button",{type:"button",className:"priority-button priority-high "+("High"===T?"active":""),onClick:()=>H("High"),children:"High"})]})]}),X.jsxs("div",{className:"raise-issue-field raise-issue-field-full-width",children:[X.jsxs("label",{className:"raise-issue-field-label-with-icon",children:[X.jsx(c,{size:16}),X.jsx("span",{children:"Comments"})]}),!j&&X.jsx("div",{className:"raise-issue-no-comments",children:"No comments yet"}),X.jsx("textarea",{className:"raise-issue-field-textarea raise-issue-comments-textarea "+(J?"raise-issue-field-readonly":""),value:j,onChange:t=>R(t.target.value),placeholder:"Add a comment...",rows:4,readOnly:J})]}),X.jsxs("div",{className:"raise-issue-field raise-issue-field-full-width",style:{marginTop:"1rem"},children:[X.jsx("label",{className:"raise-issue-field-label",children:"Attachments"}),X.jsxs("div",{className:"raise-issue-attachments-container",children:[!J&&X.jsxs("div",{className:"raise-issue-dropzone "+(q?"dragging":""),onDragOver:t=>{t.preventDefault(),W(!0)},onDragLeave:t=>{t.preventDefault(),W(!1)},onDrop:t=>{if(t.preventDefault(),W(!1),t.dataTransfer.files&&t.dataTransfer.files.length>0){const e=Array.from(t.dataTransfer.files);G(t=>[...t,...e])}},onClick:()=>Y.current?.click(),children:[X.jsx("input",{type:"file",ref:Y,style:{display:"none"},onChange:t=>{if(t.target.files&&t.target.files.length>0){const e=Array.from(t.target.files);G(t=>[...t,...e]),Y.current&&(Y.current.value="")}},multiple:!0}),X.jsx("div",{className:"raise-issue-dropzone-icon",children:X.jsx(u,{size:24})}),X.jsx("div",{className:"raise-issue-dropzone-text",children:"Click to upload or drag and drop"}),X.jsx("div",{className:"raise-issue-dropzone-hint",children:"PNG, JPG up to 10MB"})]}),z.length>0&&X.jsx("div",{className:"raise-issue-attachments-list",children:z.map((t,e)=>X.jsxs("div",{className:"raise-issue-attachment-item",children:[X.jsx("div",{className:"raise-issue-attachment-thumbnail",children:At(t)?X.jsx("img",{src:At(t),alt:"Thumbnail"}):X.jsx(h,{size:20,color:"#9ca3af"})}),X.jsxs("div",{className:"raise-issue-attachment-info",children:[X.jsx("span",{className:"attachment-name",title:Z(t),children:Z(t)}),t instanceof File&&X.jsxs("span",{className:"attachment-size",children:[(t.size/1024).toFixed(1)," KB"]})]}),!J&&X.jsx("button",{type:"button",className:"attachment-remove-btn",onClick:()=>(t=>{G(e=>e.filter((e,A)=>A!==t))})(e),title:"Remove",children:X.jsx(a,{size:12})})]},e))})]})]})]})}),X.jsx("div",{className:"raise-issue-modal-actions",children:X.jsxs("div",{className:"raise-issue-modal-actions-buttons",children:[J&&m&&X.jsxs(X.Fragment,{children:[O===et.OPEN&&X.jsx("button",{className:"raise-issue-modal-button raise-issue-modal-button-accept",onClick:async()=>{await nt(et.IN_PROGRESS)},disabled:K,children:K?"Processing...":"Accept"}),O===et.IN_PROGRESS&&X.jsx("button",{className:"raise-issue-modal-button raise-issue-modal-button-resolve",onClick:async()=>{await nt(et.RESOLVE)},disabled:K,children:K?"Processing...":"Resolve"}),(O===et.OPEN||O===et.IN_PROGRESS)&&X.jsx("button",{className:"raise-issue-modal-button raise-issue-modal-button-reject",onClick:async()=>{await nt(et.REJECTED)},disabled:K,children:K?"Processing...":"Reject"})]}),!J&&X.jsx("button",{className:"raise-issue-modal-button raise-issue-modal-button-save "+(rt?"":"disabled"),onClick:async()=>{if(String(Q||"").trim())if(String(E||"").trim())if(x||String(S||"").trim())if(x||String(I||"").trim())if(String(D||"").trim()){V(!0);try{if(J&&m){const t={title:String(Q||"").trim(),description:String(E||"").trim(),workOrderNumber:String(S||"").trim()||void 0,assetNumber:String(I||"").trim()||void 0,formTemplateId:m.formTemplateId||"",component:m.component||{},priority:T,assignTo:String(D||"").trim()||void 0,status:O,comments:String(j||"").trim()||"",task:m.component?.basic?.label||"",taskValue:m.component?.basic?.value||""};B&&m._id&&await B(m._id,t),$.showSuccess("Issue updated successfully"),i&&i(),n()}else{if(!d)return $.showError("Component is required"),void V(!1);if(!f||""===String(f||"").trim())return $.showError("Form template is required"),void V(!1);const t={...d,basic:{...d.basic,comments:String(p||"")}},e=y?`${y.firstName||""} ${y.lastName||""}`.trim():"User",A={title:String(Q||"").trim(),workOrderNumber:String(S||"").trim()||void 0,assetNumber:String(I||"").trim()||void 0,component:t,description:String(E||"").trim(),formTemplateId:f,assignTo:String(D||"").trim()||void 0,priority:T,status:O,comments:String(j||"").trim()||"",createdBy:e,task:d?.basic?.label||"",taskValue:d?.basic?.value||""};let r;if(w&&(r=await w(A,z)),$.showSuccess("Issue raised successfully"),i){const t={_id:r?._id||"temp-id",issueNumber:r?.issueNumber||"",title:A.title,description:A.description,status:A.status,priority:A.priority,createdAt:r?.createdAt||(new Date).toISOString(),updatedAt:r?.updatedAt||(new Date).toISOString(),component:A.component,workOrderNumber:A.workOrderNumber,assetNumber:A.assetNumber,assignee:A.assignTo,comments:A.comments,attachments:r?.attachments||z,...r};i(t)}n()}}catch(t){const e=t?.message||t?.error?.message||(J?"Failed to update issue. Please try again.":"Failed to raise issue. Please try again.");$.showError(e)}finally{V(!1)}}else $.showError("Assignee is required");else $.showError("Asset Number is required");else $.showError("Work Order is required");else $.showError("Description is required");else $.showError("Title is required")},disabled:K||!rt,children:K?"Creating...":"Create Issue"})]})})]})});return _(it,document.body)},rt=({component:t,condition:n,currentValue:i,thresholdValue:a,formTemplateId:o,workOrderNumber:l,assetNumber:c,user:u,onIssueRaised:h,isIssueRaised:d=!1,compact:f=!1})=>{const[p,g]=e(!1),[m,w]=e(null),[B,y]=e(!1),[b,v]=e(!1);A(()=>{d&&v(!0)},[d]),A(()=>{v(!1)},[n?.id]);const C=t=>({greaterThan:">",lessThan:"<",greaterThanOrEqual:"≥",lessThanOrEqual:"≤",equals:"=",notEquals:"≠"}[t]||t),x=r(async()=>{if(d||b){if(m)return void g(!0);y(!0);try{w(null),g(!0)}catch(t){console.error("Error fetching issue:",t),$.showError("Failed to load issue details")}finally{y(!1)}}else w(null),g(!0)},[d,b,o,t,m]),F=r(()=>{g(!1),d||b||w(null)},[d,b]),Q=r(t=>{g(!1),w(t||null),v(!0),h&&n?.id&&h(n.id)},[h,n]);return d||b?X.jsx(X.Fragment,{children:p&&X.jsx(At,{isOpen:p,onClose:F,onSuccess:Q,component:t,formTemplateId:o,workOrderNumber:l,assetNumber:c,user:u,notes:"",attachments:null,issue:m})}):f?X.jsxs(X.Fragment,{children:[X.jsxs("div",{className:"threshold-alert threshold-alert-unresolved threshold-alert-compact",children:[X.jsx("div",{className:"threshold-alert-border"}),X.jsxs("div",{className:"threshold-alert-content-compact",children:[X.jsx(s,{className:"threshold-alert-icon-compact",size:14}),X.jsx("span",{className:"threshold-alert-message-compact",children:`Threshold ${C(n.operator)} ${a}`}),X.jsx("button",{type:"button",onClick:x,className:"threshold-alert-raise-issue-btn-compact",title:"Raise Issue",children:"Raise Issue"})]})]}),p&&X.jsx(At,{isOpen:p,onClose:F,onSuccess:Q,component:t,formTemplateId:o,workOrderNumber:l,assetNumber:c,user:u,notes:"",attachments:null,issue:m})]}):X.jsxs(X.Fragment,{children:[X.jsxs("div",{className:"threshold-alert threshold-alert-unresolved",children:[X.jsx("div",{className:"threshold-alert-border"}),X.jsxs("div",{className:"threshold-alert-content",children:[X.jsx("div",{className:"threshold-alert-header",children:X.jsxs("div",{className:"threshold-alert-title-group",children:[X.jsx(s,{className:"threshold-alert-icon",size:20}),X.jsx("span",{className:"threshold-alert-title",children:"Threshold Condition Met - Action Required"})]})}),X.jsxs("div",{className:"threshold-alert-message",children:[(()=>{const e=C(n.operator);return`${t.basic?.label||"Value"}: Value ${i} exceeds threshold ${e} ${a}`})(),X.jsx("span",{className:"threshold-alert-warning",children:" You must raise an issue before submitting the form."})]}),X.jsx("div",{className:"threshold-alert-buttons",children:X.jsx("button",{type:"button",onClick:x,className:"threshold-alert-raise-issue-btn",children:"Raise Issue Now"})})]})]}),p&&X.jsx(At,{isOpen:p,onClose:F,onSuccess:Q,component:t,formTemplateId:o,workOrderNumber:l,assetNumber:c,user:u,notes:"",attachments:null,issue:m})]})},nt=({id:t,properties:s,validationErrors:a={},formValue:o="",inputType:l="text",readonly:c=!1,disabled:u=!1,touchedFields:h={},formSubmitted:d=!1,mode:f="test",onValueChange:p,onBlur:g,onFocus:m,className:w="",hideLabel:B=!1,formTemplateId:y,onThresholdIssueRaised:b,raisedThresholdIssues:v=new Set,workOrderNumber:C,assetNumber:x,user:F})=>{const Q=t=>null==t?"":"string"==typeof t?t:"number"==typeof t||"boolean"==typeof t?String(t):"object"==typeof t?Array.isArray(t)?"":"value"in t?Q(t.value):"label"in t?Q(t.label):"":String(t||""),U=n(t),E=n(null);A(()=>{t!==U.current&&(console.warn(`[DfFormInput] Component ID changed from ${U.current} to ${t}`),U.current=t)},[t]);const N=Q(o||s?.basic?.defaultValue||""),[S,L]=e(N),[I,_]=e(!1),[k,T]=e(!1),[H,O]=e(new Set),[P,D]=e(N),M=()=>{if(l)return l;const t=s?.name;return"text-input"===t?"text":"number-input"===t?"number":"email-input"===t?"email":"text"},j=r(t=>{const e=(()=>{const t={};if(s?.validation?.required&&(t.required=!0),"email"===M()&&(t.email=!0),"text"===M()){const e=s.validation;e?.minLength&&(t.minLength=e.minLength),e?.maxLength&&(t.maxLength=e.maxLength)}if("number"===M()){const e=s.validation;e&&"lowerLimit"in e&&void 0!==e.lowerLimit&&null!==e.lowerLimit&&0!==e.lowerLimit&&(t.lowerLimit=e.lowerLimit),e&&"upperLimit"in e&&void 0!==e.upperLimit&&null!==e.upperLimit&&0!==e.upperLimit&&(t.upperLimit=e.upperLimit)}return t})(),A={};let r=!0;const n="string"==typeof t?t:null!=t?String(t):"";if(!e.required||n&&""!==n.trim()||(A.required=!0,r=!1),e.email&&n&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(n)&&(A.email=!0,r=!1),e.minLength&&n&&n.length<e.minLength&&(A.minLength=!0,r=!1),e.maxLength&&n&&n.length>e.maxLength&&(A.maxLength=!0,r=!1),"number"===M())if(delete A.pattern,delete A.min,delete A.max,n&&""!==n.trim()){const t=n.trim(),i=parseFloat(t);isNaN(i)||("lowerLimit"in e&&void 0!==e.lowerLimit&&null!==e.lowerLimit&&0!==e.lowerLimit&&i<e.lowerLimit&&(A.lowerLimit=!0,r=!1),"upperLimit"in e&&void 0!==e.upperLimit&&null!==e.upperLimit&&0!==e.upperLimit&&i>e.upperLimit&&(A.upperLimit=!0,r=!1))}else delete A.lowerLimit,delete A.upperLimit;return{isValid:r,errors:A}},[s,M]),R=r(e=>{const A="string"==typeof e?e:null!=e?String(e):"";if(L(A),p){const e=j(A),r=U.current,n={id:r,value:A,isValid:e.isValid,errors:e.errors};r!==t&&console.error(`[DfFormInput] ID mismatch in handleValueChange! ref: ${r}, prop: ${t}`),p(n)}},[t,p,j,U]);A(()=>{I&&(h[t]=!0)},[I,t,h]),A(()=>{if("edit"===f){_(!1);L(s?.basic?.defaultValue||"")}else"test"===f&&(_(!1),L(""))},[f,s?.basic?.defaultValue]),A(()=>{const e=U.current,A=Q(o||s?.basic?.defaultValue||"");A===S||k||""===A&&""!==String(S||"").trim()?""===A&&String(S||"").trim():null!=o&&(e===t?L(A):console.error(`[DfFormInput] ID mismatch! componentIdRef: ${e}, prop id: ${t}`))},[o,S,k,s?.basic?.defaultValue,t]),A(()=>{d&&_(!0)},[d]),A(()=>{"test"!==f&&L("")},[f]);const K=r((t,e)=>{if(!e||""===e)return!1;const A="string"==typeof e?parseFloat(e):e,r="string"==typeof t.value?parseFloat(t.value):t.value;if(isNaN(A)||isNaN(r))return!1;switch(t.operator){case"greaterThan":return A>r;case"lessThan":return A<r;case"greaterThanOrEqual":return A>=r;case"lessThanOrEqual":return A<=r;case"equals":return A===r;case"notEquals":return A!==r;default:return!1}},[]),V=i(()=>s?.condition?.conditions||[],[s?.condition]);A(()=>{S!==P&&(O(new Set),D(S))},[S,P]);const z=i(()=>{if("test"!==f||!S||""===S)return null;const t=V.filter(t=>K(t,S));if(0===t.length)return null;for(const e of t)if(!H.has(e.id))return e;return null},[S,V,H,f,K,v]),G=r(t=>{O(e=>new Set(e).add(t))},[]),q=M(),W=u||c||s?.validation?.readonly;return X.jsxs(X.Fragment,{children:[X.jsxs("div",{className:`form-group ${(()=>{const t=s?.styles?.labelAlignment;return"left"===t?"label-left":"label-top"})()}`,children:[!B&&s.basic.label&&X.jsxs("label",{htmlFor:t,className:"form-label",children:[s.basic.label,s.validation.required&&X.jsx("span",{className:"required-indicator",children:"*"})]}),X.jsxs("div",{className:"input-wrapper",ref:E,children:[X.jsx("input",{type:q,id:t,value:S,onChange:t=>{const e=t.target.value;R(e)},onFocus:()=>{T(!0),m&&m()},onBlur:()=>{if(T(!1),_(!0),"test"===f&&p){const e="string"==typeof S?S:null!=S?String(S):"",A=j(e),r={id:t,value:e,isValid:A.isValid,errors:A.errors};p(r)}g&&g()},placeholder:s.basic.placeholder,disabled:W,readOnly:c||s?.validation?.readonly,className:(()=>{const e="form-control";if("test"===f){const A="string"==typeof S?S:null!=S?String(S):"",r=j(A);if(r.isValid)return`${e} ${w}`.trim();const n=!r.isValid&&I,i=a[t]&&(I||d)&&!r;return`${e} ${n||i?"is-invalid":""} ${w}`.trim()}return`${e} ${w}`.trim()})()}),X.jsx(Z,{validationErrors:a,fieldId:t,touchedFields:h,formSubmitted:d,properties:s,localValidation:j(S),isTouched:I,mode:f})]})]}),z&&"test"===f&&(()=>{const t=v?.has(z.id)||!1,e=null!==E.current?.closest(".table-cell")||null!==E.current?.closest(".cell-content")||null!==E.current?.closest(".datagrid-table-view")||null!==E.current?.closest(".datagrid-list-view")||w.includes("table-cell")||w.includes("cell-content");return X.jsx(rt,{component:s,condition:z,currentValue:S,thresholdValue:z.value,formTemplateId:y,workOrderNumber:C,assetNumber:x,user:F,onDismiss:()=>G(z.id),onIssueRaised:b,isIssueRaised:t,compact:e},`${z.id}-${t}`)})()]})},it=({id:t,properties:n,validationErrors:i={},formValue:s="",readonly:a=!1,disabled:o=!1,touchedFields:l={},formSubmitted:c=!1,mode:u="preview",onValueChange:h,onBlur:d,onFocus:f,className:p="",hideLabel:g=!1})=>{const[m,w]=e(s),[B,y]=e(!1),b=r(t=>{const e={};let A=!0;return!n?.validation?.required||t&&""!==t.trim()||(e.required=!0,A=!1),n?.validation?.minLength&&t&&t.length<n.validation.minLength&&(e.minLength=!0,A=!1),n?.validation?.maxLength&&t&&t.length>n.validation.maxLength&&(e.maxLength=!0,A=!1),{isValid:A,errors:e}},[n]),v=r(e=>{if(w(e),h){const A=b(e),r={id:t,value:e,isValid:A.isValid,errors:A.errors};h(r)}},[t,h,b]);A(()=>{B&&(l[t]=!0)},[B,t,l]),A(()=>{""===m&&""!==s&&w(s)},[s]),A(()=>{c&&y(!0)},[c]),A(()=>{"test"!==u&&w("")},[u]);const C=o||a||n?.validation?.readonly,x=n?.validation?.rows||4;return X.jsxs("div",{className:`form-group ${(()=>{const t=n?.styles?.labelAlignment;return"left"===t?"label-left":"label-top"})()}`,children:[!g&&n.basic.label&&X.jsxs("label",{htmlFor:t,className:"form-label",children:[n.basic.label,n.validation.required&&X.jsx("span",{className:"required-indicator",children:"*"})]}),X.jsxs("div",{className:"input-wrapper",children:[X.jsx("textarea",{id:t,value:m,onChange:t=>{const e=t.target.value;v(e)},onFocus:()=>{f&&f()},onBlur:()=>{y(!0),d&&d()},placeholder:n.basic.placeholder,disabled:C,readOnly:a||n?.validation?.readonly,rows:x,className:`form-textarea ${!b(m).isValid&&B?"is-invalid":""} ${p}`.trim()}),X.jsx(Z,{validationErrors:i,fieldId:t,touchedFields:l,formSubmitted:c,properties:n,localValidation:b(m),isTouched:B,mode:u})]})]})},st=({id:t,properties:n,validationErrors:i={},formValue:s="",readonly:a=!1,disabled:o=!1,touchedFields:l={},formSubmitted:c=!1,mode:u="preview",onValueChange:h,onBlur:d,onFocus:f,className:p="",hideLabel:g=!1})=>{const[m,w]=e(s),[B,y]=e(!1),b=n?.validation?.multiple||!1,v=r(t=>{const e={};let A=!0;return n?.validation?.required&&(b?Array.isArray(t)&&0!==t.length||(e.required=!0,A=!1):(!t||"string"==typeof t&&""===t.trim())&&(e.required=!0,A=!1)),{isValid:A,errors:e}},[n,b]),C=r(e=>{if(w(e),h){const A=v(e),r={id:t,value:e,isValid:A.isValid,errors:A.errors};h(r)}},[t,h,v]);A(()=>{B&&(l[t]=!0)},[B,t,l]),A(()=>{JSON.stringify(s)!==JSON.stringify(m)&&w(s)},[s,m]),A(()=>{c&&y(!0)},[c]);const x=o||a||n?.validation?.readonly;return X.jsxs("div",{className:`form-group ${(()=>{const t=n?.styles?.labelAlignment;return"left"===t?"label-left":"label-top"})()}`,children:[!g&&n.basic.label&&X.jsxs("label",{htmlFor:t,className:"form-label",children:[n.basic.label,n.validation.required&&X.jsx("span",{className:"required-indicator",children:"*"})]}),X.jsxs("div",{className:"input-wrapper",children:[X.jsxs("select",{id:t,value:m,onChange:t=>{if(b){const e=Array.from(t.target.selectedOptions,t=>t.value);C(e)}else C(t.target.value)},onFocus:()=>{f&&f()},onBlur:()=>{y(!0),d&&d()},disabled:x,multiple:b,className:`form-select ${!v(m).isValid&&B?"is-invalid":""} ${p}`.trim(),children:[!b&&X.jsx("option",{value:"",children:n.basic.placeholder||"Select an option"}),(n.options||[]).map((t,e)=>X.jsx("option",{value:t.value,disabled:t.disabled,children:t.label},e))]}),X.jsx(Z,{validationErrors:i,fieldId:t,touchedFields:l,formSubmitted:c,properties:n,localValidation:v(m),isTouched:B,mode:u})]})]})},at=({id:t,properties:n,validationErrors:i={},formValue:s=[],readonly:a=!1,disabled:o=!1,touchedFields:l={},formSubmitted:c=!1,mode:u="preview",onValueChange:h,onBlur:d,onFocus:f,className:p="",hideLabel:g=!1})=>{const[m,w]=e(!1),B=Array.isArray(s)?s:[],y=r(t=>{const e={};let A=!0;return n?.validation?.required&&0===t.length&&(e.required=!0,A=!1),{isValid:A,errors:e}},[n]),b=r(e=>{if(h){const A=y(e),r={id:t,value:e,isValid:A.isValid,errors:A.errors};h(r)}},[t,h,y,B]),v=(t,e)=>{let A;A=e?[...B,t]:B.filter(e=>e!==t),b(A)},C=()=>{f&&f()},x=()=>{w(!0),d&&d()};A(()=>{m&&(l[t]=!0)},[m,t,l]),A(()=>{},[s,t,B]),A(()=>{c&&w(!0)},[c]);const F=o||a||n?.validation?.readonly;return X.jsx(X.Fragment,{children:X.jsx("div",{className:`form-group checkbox-group ${(()=>{const t=n?.styles?.labelAlignment;return"left"===t?"label-left":"label-top"})()} ${n?.basic?.inlineLayout?"inline-layout":"vertical-layout"} ${p}`,children:!g&&n.basic.label?X.jsxs(X.Fragment,{children:[X.jsxs("label",{className:"form-label",children:[n.basic.label,n.validation.required&&X.jsx("span",{className:"required-indicator",children:"*"})]}),X.jsxs("div",{className:"input-wrapper",children:[X.jsx("div",{className:"mt-2 "+(n?.basic?.inlineLayout?"inline-options-grid":"space-y-2"),children:(n.options||[]).map((e,A)=>X.jsxs("div",{className:"form-check",children:[X.jsx("input",{type:"checkbox",id:`${t}-${A}`,name:t,value:e.value,checked:B.includes(e.value),onChange:t=>{v(e.value,t.target.checked)},onFocus:C,onBlur:x,disabled:F||e.disabled,className:"form-check-input"}),X.jsx("label",{htmlFor:`${t}-${A}`,className:"form-check-label",children:e.label})]},A))}),X.jsx(Z,{validationErrors:i,fieldId:t,touchedFields:l,formSubmitted:c,properties:n,localValidation:y(B),isTouched:m,mode:u})]})]}):X.jsxs("div",{className:"input-wrapper",children:[X.jsx("div",{className:"mt-2 "+(n?.basic?.inlineLayout?"inline-options-grid":"space-y-2"),children:(n.options||[]).map((e,A)=>X.jsxs("div",{className:"form-check",children:[X.jsx("input",{type:"checkbox",id:`${t}-${A}`,name:t,value:e.value,checked:B.includes(e.value),onChange:t=>{v(e.value,t.target.checked)},onFocus:C,onBlur:x,disabled:F||e.disabled,className:"form-check-input"}),X.jsx("label",{htmlFor:`${t}-${A}`,className:"form-check-label",children:e.label})]},A))}),X.jsx(Z,{validationErrors:i,fieldId:t,touchedFields:l,formSubmitted:c,properties:n,localValidation:y(B),isTouched:m,mode:u})]})})})},ot=({id:t,properties:n,validationErrors:i={},formValue:s="",readonly:a=!1,disabled:o=!1,touchedFields:l={},formSubmitted:c=!1,mode:u="preview",onValueChange:h,onBlur:d,onFocus:f,className:p="",hideLabel:g=!1})=>{const[m,w]=e(s),[B,y]=e(!1),b=r(t=>{const e={};let A=!0;return!n?.validation?.required||t&&""!==t.trim()||(e.required=!0,A=!1),{isValid:A,errors:e}},[n]),v=r(e=>{if(w(e),h){const A=b(e),r={id:t,value:e,isValid:A.isValid,errors:A.errors};h(r)}},[t,h,b]),C=t=>{v(t)},x=()=>{f&&f()},F=()=>{y(!0),d&&d()};A(()=>{B&&(l[t]=!0)},[B,t,l]),A(()=>{s!==m&&w(s)},[s,m]),A(()=>{c&&y(!0)},[c]);const Q=o||a||n?.validation?.readonly;return X.jsx(X.Fragment,{children:X.jsx("div",{className:`form-group radio-group ${(()=>{const t=n?.styles?.labelAlignment;return"left"===t?"label-left":"label-top"})()} ${n?.basic?.inlineLayout?"inline-layout":"vertical-layout"} ${p}`,children:!g&&n.basic.label?X.jsxs(X.Fragment,{children:[X.jsxs("label",{className:"form-label",children:[n.basic.label,n.validation.required&&X.jsx("span",{className:"required-indicator",children:"*"})]}),X.jsxs("div",{className:"input-wrapper",children:[X.jsx("div",{className:"mt-2 "+(n?.basic?.inlineLayout?"inline-options-grid":"space-y-2"),children:(n.options||[]).map((e,A)=>X.jsxs("div",{className:"form-check",children:[X.jsx("input",{type:"radio",id:`${t}-${A}`,name:t,value:e.value,checked:m===e.value,onChange:()=>C(e.value),onFocus:x,onBlur:F,disabled:Q||e.disabled,className:"form-check-input"}),X.jsx("label",{htmlFor:`${t}-${A}`,className:"form-check-label",children:e.label})]},A))}),X.jsx(Z,{validationErrors:i,fieldId:t,touchedFields:l,formSubmitted:c,properties:n,localValidation:b(m),isTouched:B,mode:u})]})]}):X.jsxs("div",{className:"input-wrapper",children:[X.jsx("div",{className:"mt-2 "+(n?.basic?.inlineLayout?"inline-options-grid":"space-y-2"),children:(n.options||[]).map((e,A)=>X.jsxs("div",{className:"form-check",children:[X.jsx("input",{type:"radio",id:`${t}-${A}`,name:t,value:e.value,checked:m===e.value,onChange:()=>C(e.value),onFocus:x,onBlur:F,disabled:Q||e.disabled,className:"form-check-input"}),X.jsx("label",{htmlFor:`${t}-${A}`,className:"form-check-label",children:e.label})]},A))}),X.jsx(Z,{validationErrors:i,fieldId:t,touchedFields:l,formSubmitted:c,properties:n,localValidation:b(m),isTouched:B,mode:u})]})})})},lt=({id:t,properties:n,validationErrors:i={},formValue:s="",readonly:a=!1,disabled:o=!1,touchedFields:l={},formSubmitted:c=!1,mode:u="preview",onValueChange:h,onBlur:d,onFocus:f,className:p="",hideLabel:g=!1})=>{const[m,w]=e(s),[B,y]=e(!1),b=r(t=>{const e={};let A=!0;return!n?.validation?.required||t&&""!==t.trim()||(e.required=!0,A=!1),{isValid:A,errors:e}},[n]),v=r(e=>{if(w(e),y(!0),h){const A=b(e),r={id:t,value:e,isValid:A.isValid,errors:A.errors};h(r)}},[t,h,b]),C=()=>{f&&f()},x=()=>{y(!0),d&&d()};A(()=>{B&&(l[t]=!0)},[B,t,l]),A(()=>{s!==m&&w(s)},[s,m]),A(()=>{c&&y(!0)},[c]);const F=()=>n?.basic?.inlineLayout?"inline-layout":"grid-layout",Q=t=>{const e=t?.toLowerCase();return"pass"===e||"yes"===e?"pass":"fail"===e||"no"===e?"fail":"pass"},U=t=>{if(void 0!==t?.icon&&""!==t.icon)return t.icon;return"pass"===Q(t?.value||t)?"✓":"×"},E=(t,e)=>t?.color||t?.backgroundColor?{color:e?"#ffffff":t.color||"#00814b",backgroundColor:e?t.color||"#00814b":t.backgroundColor||"#34bd4914",borderColor:t.color||"#00814b"}:{},N=t=>{if(t?.color||t?.backgroundColor)return"segment-button-label segment-button-custom";return"segment-button-label "+("pass"===Q(t?.value||t)?"pass-button":"fail-button")},S=o||a||n?.validation?.readonly;return X.jsxs(X.Fragment,{children:[X.jsx("div",{className:`form-group segment-group ${(()=>{const t=n?.styles?.labelAlignment;return"left"===t?"label-left":"label-top"})()} ${p}`,children:!g&&n.basic.label?X.jsxs(X.Fragment,{children:[X.jsxs("label",{className:"form-label",children:[n.basic.label,n.validation.required&&X.jsx("span",{className:"required-indicator",children:"*"})]}),X.jsx("div",{className:"form-segment-wrapper",children:X.jsx("div",{className:`form-segment-container ${F()}`,children:(n.options||[]).map((e,A)=>{const r=m===e.value,n=E(e,r),i=N(e),s=U(e);return X.jsxs("div",{className:"form-segment-option "+(r?"selected":""),children:[X.jsx("input",{type:"radio",id:`${t}_option_${A}`,name:t,value:e.value,checked:r,onChange:()=>!S&&!e.disabled&&v(e.value),onFocus:C,onBlur:x,disabled:S||e.disabled,className:"form-segment-radio"}),X.jsxs("label",{htmlFor:`${t}_option_${A}`,className:i,style:Object.keys(n).length>0?n:void 0,children:[s&&X.jsx("span",{className:"segment-icon",children:s}),X.jsx("span",{className:"segment-text",children:e.value})]})]},A)})})})]}):X.jsx("div",{className:"form-segment-wrapper",children:X.jsx("div",{className:`form-segment-container ${F()}`,children:(n.options||[]).map((e,A)=>{const r=m===e.value,n=E(e,r),i=N(e),s=U(e);return X.jsxs("div",{className:"form-segment-option "+(r?"selected":""),children:[X.jsx("input",{type:"radio",id:`${t}_option_${A}`,name:t,value:e.value,checked:r,onChange:()=>!S&&!e.disabled&&v(e.value),onFocus:C,onBlur:x,disabled:S||e.disabled,className:"form-segment-radio"}),X.jsxs("label",{htmlFor:`${t}_option_${A}`,className:i,style:Object.keys(n).length>0?n:void 0,children:[s&&X.jsx("span",{className:"segment-icon",children:s}),X.jsx("span",{className:"segment-text",children:e.value})]})]},A)})})})}),X.jsx(Z,{validationErrors:i,fieldId:t,touchedFields:l,formSubmitted:c,properties:n,localValidation:b(m),isTouched:B,mode:u})]})},ct=({id:t,properties:n,validationErrors:i={},formValue:s="",readonly:a=!1,disabled:o=!1,touchedFields:l={},formSubmitted:c=!1,mode:u="preview",onValueChange:h,onBlur:d,onFocus:f,className:p="",hideLabel:g=!1})=>{const m=r(t=>{if(!t)return"";if("string"==typeof t){if(/^\d{4}-\d{2}-\d{2}$/.test(t))return t;if(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(t))return t;const e=tt(t);if(e&&!isNaN(e.getTime())){const t=n.name||"",A=n.basic?.dateTimeMode||("datetime-picker"===t?"datetime":"date");if("datetime"===A){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}T${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`}if("time"===A){return`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`}return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}return t}if(t instanceof Date){if(isNaN(t.getTime()))return"";const e=n.name||"",A=n.basic?.dateTimeMode||("datetime-picker"===e?"datetime":"date");if("datetime"===A){return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}T${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}if("time"===A){return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}if("object"==typeof t&&null!==t){if("value"in t&&t.value)return m(t.value);if("date"in t&&t.date)return m(t.date);try{const e=String(t),A=tt(e);if(A&&!isNaN(A.getTime()))return m(A)}catch(t){}return""}return""},[n]),w=m(s),[B,y]=e(w),[b,v]=e(!1),[C,x]=e(!1),F=r(t=>{const e={};let A=!0;const r=n.name||"",i=n.basic?.dateTimeMode||("datetime-picker"===r?"datetime":"date"),s=t?String(t).trim():"";if(n?.validation?.required&&(!s||""===s))return e.required=!0,A=!1,{isValid:A,errors:e};if(s&&""!==s)if("time"===i){if(!/^([0-1][0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?$/.test(s))return e.invalidDate=!0,A=!1,{isValid:A,errors:e}}else if("datetime"===i){const t=tt(s);if(!t||isNaN(t.getTime()))return e.invalidDate=!0,A=!1,{isValid:A,errors:e};if(n?.validation?.minDate){const r=tt(n.validation.minDate);r&&t<r&&(e.minDate=!0,e.minDateMessage=`Date and time must be on or after ${r.toLocaleDateString()}`,A=!1)}if(n?.validation?.maxDate){const r=tt(n.validation.maxDate);r&&t>r&&(e.maxDate=!0,e.maxDateMessage=`Date and time must be on or before ${r.toLocaleDateString()}`,A=!1)}}else{const t=tt(s);if(!t||isNaN(t.getTime()))return e.invalidDate=!0,A=!1,{isValid:A,errors:e};if(n?.validation?.minDate){const r=tt(n.validation.minDate);r&&t<r&&(e.minDate=!0,e.minDateMessage=`Date must be on or after ${r.toLocaleDateString()}`,A=!1)}if(n?.validation?.maxDate){const r=tt(n.validation.maxDate);r&&t>r&&(e.maxDate=!0,e.maxDateMessage=`Date must be on or before ${r.toLocaleDateString()}`,A=!1)}}return{isValid:A,errors:e}},[n]),Q=r(e=>{if(y(e),h){const A=F(e),r={id:t,value:e,isValid:A.isValid,errors:A.errors};h(r)}},[t,h,F]);A(()=>{b&&(l[t]=!0)},[b,t,l]),A(()=>{const t=m(s);t===B||C||y(t)},[s,B,C,m]),A(()=>{c&&v(!0)},[c]);const U=o||a||n?.validation?.readonly,E=n.name||"",N=n.basic?.dateTimeMode||("datetime-picker"===E?"datetime":"date"),S=(()=>{switch(N){case"time":return"time";case"datetime":return"datetime-local";default:return"date"}})();return X.jsxs("div",{className:`form-group ${(()=>{const t=n?.styles?.labelAlignment;return"left"===t?"label-left":"label-top"})()}`,children:[!g&&n.basic.label&&X.jsxs("label",{htmlFor:t,className:"form-label",children:[n.basic.label,n.validation.required&&X.jsx("span",{className:"required-indicator",children:"*"})]}),X.jsxs("div",{className:"input-wrapper",children:[X.jsx("input",{type:S,id:t,value:B,onChange:t=>{const e=t.target.value;Q(e)},onFocus:()=>{x(!0),f&&f()},onBlur:()=>{if(x(!1),v(!0),h){const e=F(B),A={id:t,value:B,isValid:e.isValid,errors:e.errors};h(A)}d&&d()},disabled:U,readOnly:a||n?.validation?.readonly,min:n?.validation?.minDate,max:n?.validation?.maxDate,className:`form-date ${!F(B).isValid&&b?"is-invalid":""} ${p}`.trim()}),X.jsx(Z,{validationErrors:i,fieldId:t,touchedFields:l,formSubmitted:c,properties:n,localValidation:F(B),isTouched:b,mode:u})]})]})},ut=({id:t,properties:i,validationErrors:s={},formValue:a="",readonly:o=!1,disabled:l=!1,touchedFields:c={},formSubmitted:u=!1,mode:h="preview",onValueChange:d,onBlur:f,onFocus:p,className:g="",hideLabel:m=!1})=>{const w=n(null),[B,y]=e(!1),[b,v]=e(!1),[C,x]=e(a),[F,Q]=e(!1),U=r(t=>{const e={};let A=!0;return!i?.validation?.required||t&&""!==t.trim()||(e.required=!0,A=!1),{isValid:A,errors:e}},[i]),E=r(e=>{if(x(e),d){const A=U(e),r={id:t,value:e,isValid:A.isValid,errors:A.errors};d(r)}},[t,d,U]),N=r(()=>{const t=document.documentElement.classList.contains("dark")||"dark"===document.documentElement.getAttribute("data-theme");let e=getComputedStyle(document.documentElement).getPropertyValue("--df-color-fb-input-bg").trim();e||(e=t?"#2c2e34":"#ffffff");return{strokeColor:t?"#ffffff":"#000000",backgroundColor:e}},[]),S=r(e=>{if(!e)return;const A=w.current;if(!A)return;const r=A.getContext("2d");if(!r)return;const n=new Image;n.onload=()=>{r.clearRect(0,0,A.width,A.height);const t=N();r.fillStyle=t.backgroundColor,r.fillRect(0,0,A.width,A.height);const e=A.width/A.height,i=n.width/n.height;let s=A.width,a=A.height,o=0,l=0;i>e?(a=A.width/i,l=(A.height-a)/2):(s=A.height*i,o=(A.width-s)/2),r.drawImage(n,o,l,s,a)},n.onerror=A=>{console.error("DfFormSignature: error loading image",{id:t,error:A,dataURL:e.substring(0,50)+"..."})},n.src=e},[N,t]),L=r(()=>{const t=w.current;if(!t)return;const e=t.getContext("2d");if(!e)return;const A=t.getBoundingClientRect();t.width=A.width,t.height=A.height,t.style.width=A.width+"px",t.style.height=A.height+"px";const r=N();e.strokeStyle=r.strokeColor,e.lineWidth=2,e.lineCap="round",e.lineJoin="round",C?S(C):(e.fillStyle=r.backgroundColor,e.fillRect(0,0,t.width,t.height))},[C,N,S]),I=r(()=>{setTimeout(()=>{L()},100)},[L]);A(()=>{const t=()=>{I()},e=new MutationObserver(t=>{t.forEach(t=>{if("attributes"===t.type&&"class"===t.attributeName){const e=t.target;e.classList.contains("form-canvas-container")&&(e.classList.contains("mobile-view")||e.classList.contains("tablet-view")||e.classList.contains("desktop-view"))&&I()}})});return e.observe(document.body,{attributes:!0,attributeFilter:["class"],subtree:!0}),window.addEventListener("resize",t),()=>{e.disconnect(),window.removeEventListener("resize",t)}},[I]);const _=r(t=>{const e=w.current;if(!e)return{x:0,y:0};const A=e.getBoundingClientRect(),r=e.width/A.width,n=e.height/A.height,i=t.type.includes("mouse")?t.clientX:t.touches[0].clientX,s=t.type.includes("mouse")?t.clientY:t.touches[0].clientY;return{x:(i-A.left)*r,y:(s-A.top)*n}},[]),k=t=>{if(o||l||i?.validation?.readonly)return;if(t.target.closest(".clear-signature-btn"))return;t.preventDefault(),t.stopPropagation(),y(!0),v(!0);const e=w.current;if(!e)return;const A=e.getContext("2d");if(!A)return;const{x:r,y:n}=_(t),s=N();A.strokeStyle=s.strokeColor,A.lineWidth=2,A.lineCap="round",A.lineJoin="round",A.beginPath(),A.moveTo(r,n)},T=t=>{if(!B)return;t.preventDefault(),t.stopPropagation();const e=w.current;if(!e)return;const A=e.getContext("2d");if(!A)return;const{x:r,y:n}=_(t);A.lineTo(r,n),A.stroke()},H=()=>{if(!B)return;y(!1),Q(!0);const t=w.current;if(t){(t=>{const e=t.getContext("2d");if(!e)return!1;const A=e.getImageData(0,0,t.width,t.height).data;for(let t=0;t<A.length;t+=4){const e=A[t],r=A[t+1],n=A[t+2];if(A[t+3]>0&&(e<255||r<255||n<255))return!0}})(t);const e=t.toDataURL("image/png");x(e),E(e),setTimeout(()=>{Q(!1)},100)}else Q(!1)},O=r(()=>{const t=w.current;if(!t)return;const e=t.getContext("2d");if(!e)return;const A=N();if(e.strokeStyle=A.strokeColor,C){const r=C,n=t.getBoundingClientRect();e.fillStyle=A.backgroundColor,e.fillRect(0,0,n.width,n.height),r&&S(r)}else{const r=t.getBoundingClientRect();e.fillStyle=A.backgroundColor,e.fillRect(0,0,r.width,r.height)}},[N,C,S]);A(()=>{const t=new MutationObserver(t=>{t.forEach(t=>{"attributes"!==t.type||"class"!==t.attributeName&&"data-theme"!==t.attributeName||O()})});return t.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme"]}),()=>{t.disconnect()}},[O]);A(()=>{b&&(c[t]=!0)},[b,t,c]),A(()=>{if(!(a===C||B||F||""!==C&&""===a)){if(a===C)return;x(a),a&&S(a)}},[a,C,B,F]),A(()=>{u&&v(!0)},[u]),A(()=>{if("test"!==h){x("");const t=w.current;if(t){const e=t.getContext("2d");if(e){const A=t.getBoundingClientRect();t.width=A.width,t.height=A.height;const r=N();e.fillStyle=r.backgroundColor,e.fillRect(0,0,A.width,A.height)}}}},[h]),A(()=>{L()},[h]);const P=l||o||i?.validation?.readonly;return X.jsxs("div",{className:`form-group ${(()=>{const t=i?.styles?.labelAlignment;return"left"===t?"label-left":"label-top"})()}`,children:[!m&&i.basic.label&&X.jsxs("label",{htmlFor:t,className:"form-label",children:[i.basic.label,i.validation.required&&X.jsx("span",{className:"required-indicator",children:"*"})]}),X.jsxs("div",{className:"input-wrapper",children:[X.jsxs("div",{className:"signature-container",style:{position:"relative",width:"100%",maxWidth:"100%",overflow:"hidden"},children:[X.jsx("canvas",{ref:w,id:t,className:`form-signature ${!U(C).isValid&&b?"is-invalid":""} ${g}`.trim(),onMouseDown:k,onMouseMove:T,onMouseUp:H,onMouseLeave:H,onTouchStart:k,onTouchMove:T,onTouchEnd:H,onFocus:()=>{p&&p()},onBlur:()=>{f&&f()},style:{width:"100%",height:"150px",border:"2px solid var(--df-color-primary-border)",borderRadius:"6px",cursor:P?"not-allowed":"crosshair",backgroundColor:"var(--df-color-fb-input-bg)",touchAction:"none",userSelect:"none"}}),!P&&X.jsx("button",{type:"button",onClick:t=>(t=>{t?.preventDefault(),t?.stopPropagation();const e=w.current;if(!e)return;const A=e.getBoundingClientRect();e.width=A.width,e.height=A.height;const r=e.getContext("2d");if(!r)return;const n=N();r.fillStyle=n.backgroundColor,r.fillRect(0,0,A.width,A.height),r.strokeStyle=n.strokeColor,r.lineWidth=2,r.lineCap="round",r.lineJoin="round",x(""),E("")})(t),className:"clear-signature-btn",style:{position:"absolute",bottom:"8px",right:"8px",padding:"4px 8px",backgroundColor:"var(--df-color-error-primary)",color:"white",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:"0.75rem",fontWeight:"500",zIndex:10,transition:"all 0.2s ease",minWidth:"60px",minHeight:"28px"},onMouseEnter:t=>{t.currentTarget.style.backgroundColor="var(--df-color-error-dark, #dc2626)",t.currentTarget.style.transform="scale(1.05)"},onMouseLeave:t=>{t.currentTarget.style.backgroundColor="var(--df-color-error-primary)",t.currentTarget.style.transform="scale(1)"},children:"Clear"})]}),X.jsx(Z,{validationErrors:s,fieldId:t,touchedFields:c,formSubmitted:u,properties:i,localValidation:U(C),isTouched:b,mode:h})]})]})},ht=({id:t,properties:i,validationErrors:s={},formValue:a=null,readonly:o=!1,disabled:l=!1,touchedFields:c={},formSubmitted:u=!1,mode:h="test",onValueChange:d,onBlur:f,onFocus:p,className:g="",hideLabel:m=!1})=>{const[w,B]=e([]),[y,b]=e(!1),[v,C]=e(!1),x=n(null),F=r(e=>{if(!e)return[];const A=Array.isArray(e)?e:Array.from(e),r=[],n=(t,e,A)=>{try{return new File(t,e,A)}catch(r){const n=new Blob(t,A);return n.name=e,n.lastModifiedDate=new Date,n.lastModified=Date.now(),n}};return A.forEach((e,A)=>{if(e&&"object"==typeof e&&!(e instanceof File)&&!(e instanceof Blob)){const i=e;if(i.data||i.url||i.name&&i.type){const e=i.name||i.fileName||`file-${A}`,s=i.size||i.fileSize||0,a=i.type||i.fileType||i.mimeType||"";let o;if(i.url)o=i.url;else if(i.data){const t=i.data;if("string"==typeof t)if(t.startsWith("data:"))o=t;else{const e=t.replace(/\s/g,"");if(/^[A-Za-z0-9+/=]+$/.test(e)&&e.length>10){let t=a;t||(t=e.startsWith("/9j/")||e.startsWith("iVBORw0KGgoAAAANSUhEUgAA")?"image/jpeg":e.startsWith("iVBORw0KGgo")?"image/png":e.startsWith("R0lGOD")?"image/gif":e.startsWith("UklGR")?"image/webp":"image/png"),o=`data:${t};base64,${e}`}else o=t}}const l=n([],e,{type:a});return void r.push({file:l,id:`${t}-file-${A}`,size:s,type:a,name:e,preview:o})}}let i,s,a=0,o="",l="";if(e instanceof File||e instanceof Blob){const t=e;if(a=t.size||0,o=t.type||"",l=t.name||`file-${A}`,s=t,o.startsWith("image/"))try{i=URL.createObjectURL(t)}catch(t){console.error("Error creating object URL:",t),i=void 0}}else if("string"==typeof e){const t=e,r=t.replace(/\s/g,""),a=r.length>50&&/^[A-Za-z0-9+/=]+$/.test(r)&&!t.startsWith("http")&&!t.startsWith("https")&&!t.startsWith("data:")&&!t.startsWith("blob:")&&!t.startsWith("/");let c=t;if(a){let t="image/png";r.startsWith("/9j/")||r.startsWith("iVBORw0KGgoAAAANSUhEUgAA")?t="image/jpeg":r.startsWith("iVBORw0KGgo")?t="image/png":r.startsWith("R0lGOD")?t="image/gif":r.startsWith("UklGR")&&(t="image/webp"),c=`data:${t};base64,${r}`}let u="";if(c.startsWith("data:")){const t=c.match(/filename=([^;]+)/i);if(t)u=decodeURIComponent(t[1]);else{const t=c.match(/data:([^;]+)/);if(t){const e=t[1];u=`file-${A+1}.${e.includes("image")?e.includes("jpeg")?"jpg":"png":e.includes("pdf")?"pdf":e.includes("word")?"doc":e.includes("excel")?"xls":"file"}`}else u=`file-${A+1}`}}else if(c.startsWith("http://")||c.startsWith("https://")||c.startsWith("blob:"))try{const e=new URL(t),r=e.pathname.split("/").pop()||"";if(r&&r.includes("."))u=decodeURIComponent(r);else{const t=e.searchParams.get("filename")||e.searchParams.get("name");u=t?decodeURIComponent(t):`file-${A+1}`}}catch(e){const r=t.lastIndexOf("/"),n=r>=0?t.substring(r+1):t,i=n.indexOf("?"),s=i>=0?n.substring(0,i):n;u=s&&s.includes(".")?decodeURIComponent(s):`file-${A+1}`}else u=`file-${A+1}`;if(l=u||`file-${A+1}`,c.startsWith("data:")){const t=c.indexOf(";");o=t>5?c.substring(5,t):"application/octet-stream"}else{const t=c.match(/\.(jpg|jpeg|png|gif|webp|svg|pdf|doc|docx|xls|xlsx|zip|rar)$/i)||l.match(/\.(jpg|jpeg|png|gif|webp|svg|pdf|doc|docx|xls|xlsx|zip|rar)$/i);if(t){o={jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",zip:"application/zip",rar:"application/x-rar-compressed"}[t[1].toLowerCase()]||"application/octet-stream"}else o=a?"image/png":"application/octet-stream"}(c.startsWith("data:image")||c.startsWith("http://")||c.startsWith("https://")||c.startsWith("blob:"))&&(i=c),s=n([],l,{type:o})}else{if(!e||"object"!=typeof e)return;{const t=e;if(l=t.name||t.fileName||`file-${A}`,a=t.size||t.fileSize||0,o=t.type||t.fileType||t.mimeType||"",t.url||t.path)i=t.url||t.path;else if(o.startsWith("image/")&&t.data){const e=t.data;if("string"==typeof e)if(e.startsWith("data:"))i=e;else{const t=e.replace(/\s/g,"");i=/^[A-Za-z0-9+/=]+$/.test(t)&&t.length>50?`data:${o};base64,${t}`:e}else i=void 0}s=n([],l,{type:o})}}r.push({file:s,id:`${t}-file-${A}`,size:a,type:o,name:l,preview:i})}),r},[t]),Q=r(()=>({isValid:!0,errors:{}}),[]),U=r(e=>{if(o||l)return;const A=F(e),r=w.length>0?[...w,...A]:A,n=i?.validation?.maxFiles||1/0,s=r.slice(0,n);if(B(s),C(!0),d){const e=Q(),A={id:t,value:s.map(t=>t.file),isValid:e.isValid,errors:e.errors};d(A)}},[w,i,o,l,d,Q,F,t]),E=t=>{if(0===t)return"0 Bytes";const e=Math.floor(Math.log(t)/Math.log(1024));return parseFloat((t/Math.pow(1024,e)).toFixed(2))+" "+["Bytes","KB","MB","GB"][e]},N=t=>t.startsWith("image/")?"🖼️":t.startsWith("video/")?"🎥":t.startsWith("audio/")?"🎵":t.includes("pdf")?"📄":t.includes("word")||t.includes("document")?"📝":t.includes("excel")||t.includes("spreadsheet")?"📊":t.includes("zip")||t.includes("rar")?"📦":"📁";A(()=>{v&&(c[t]=!0)},[v,t,c]),A(()=>{("edit"===h||"test"===h)&&C(!1)},[h]),A(()=>{const t=F(a);null!=a&&(Array.isArray(a)&&a.length>0||"string"==typeof a&&""!==String(a).trim()||"object"==typeof a&&!Array.isArray(a)&&Object.keys(a).length>0)||0===w.length&&null!=a?B(t):(null==a||Array.isArray(a)&&0===a.length)&&w.length>0&&B([])},[a,F,w.length]),A(()=>{u&&C(!0)},[u]),A(()=>()=>{w.forEach(t=>{if(t.preview&&t.preview.startsWith("blob:"))try{URL.revokeObjectURL(t.preview)}catch(t){console.error("Error revoking object URL:",t)}})},[w]);const S=()=>{const t=i?.styles?.labelAlignment;return"left"===t?"label-left":"label-top"},L=l||o||i?.validation?.readonly,I=i?.validation?.multiple||!1,_=i?.validation?.accept||"*/*",k=i?.validation?.maxFiles||1/0,T=w.length<k&&(I||k>1),H="edit"===h,O="preview"===h||"test"===h,P=w.filter(t=>t.type.startsWith("image/")),D=w.filter(t=>!t.type.startsWith("image/")),M=P.length>0;return O&&M?X.jsxs("div",{className:`form-group ${S()}`,children:[!m&&X.jsxs("label",{htmlFor:t,className:"form-label",children:[i.basic?.label||"Attachments",i.validation?.required&&X.jsx("span",{className:"required-indicator",children:"*"})]}),X.jsxs("div",{className:"file-upload-wrapper",children:[X.jsxs("div",{className:"file-image-display",children:[P.map(t=>X.jsxs("div",{className:"file-image-container",children:[t.preview&&X.jsx("img",{src:t.preview,alt:t.name,className:"file-image-preview"}),X.jsxs("div",{className:"file-image-info",children:[X.jsx("div",{className:"file-name",title:t.name,children:t.name}),X.jsx("div",{className:"file-size",children:E(t.size)})]})]},t.id)),D.length>0&&X.jsxs("div",{className:"file-other-files",children:[X.jsx("div",{className:"file-other-files-label",children:"Other Files:"}),D.map(t=>X.jsxs("div",{className:"file-item-minimal",children:[X.jsx("div",{className:"file-icon",children:N(t.type)}),X.jsxs("div",{className:"file-info",children:[X.jsx("div",{className:"file-name",title:t.name,children:t.name}),X.jsx("div",{className:"file-size",children:E(t.size)})]})]},t.id))]})]}),X.jsx(Z,{validationErrors:s,fieldId:t,touchedFields:c,formSubmitted:u,properties:i,localValidation:Q(),isTouched:v,mode:h})]})]}):X.jsxs("div",{className:`form-group ${S()}`,children:[!m&&X.jsxs("label",{htmlFor:t,className:"form-label",children:[i.basic?.label||"Attachments",i.validation?.required&&X.jsx("span",{className:"required-indicator",children:"*"})]}),X.jsxs("div",{className:"file-upload-wrapper",children:[X.jsxs("div",{className:`file-upload-area ${y?"drag-over":""} ${o?"readonly":""} ${l?"disabled":""} ${g}`.trim(),onDragOver:t=>{t.preventDefault(),o||l||b(!0)},onDragLeave:t=>{t.preventDefault(),b(!1)},onDrop:t=>{if(t.preventDefault(),b(!1),o||l)return;const e=t.dataTransfer.files;e.length>0&&U(e)},onClick:t=>{const e=t.target,A=null!==e.closest(".file-item"),r=null!==e.closest(".file-remove");!H||L||0!==w.length||A||r||x.current?.click()},onFocus:()=>{p&&p()},onBlur:()=>{if(C(!0),"test"===h&&d){const e=Q(),A={id:t,value:w.map(t=>t.file),isValid:e.isValid,errors:e.errors};d(A)}f&&f()},tabIndex:L?-1:0,children:[X.jsx("input",{ref:x,type:"file",id:t,multiple:I,accept:_,onChange:t=>{const e=t.target.files;e&&e.length>0&&(U(e),t.target.value="")},disabled:L,style:{display:"none"}}),0===w.length?X.jsxs("div",{className:"upload-placeholder",onClick:t=>{t.stopPropagation(),H&&!L&&x.current?.click()},children:[X.jsx("div",{className:"upload-icon",children:"📁"}),X.jsx("div",{className:"upload-text",children:i.basic.placeholder&&X.jsx("p",{className:"upload-hint",children:i.basic.placeholder})})]}):X.jsx("div",{className:"file-list",children:w.map(e=>X.jsxs("div",{className:"file-item",children:[X.jsx("div",{className:"file-preview",children:e.preview?X.jsx("img",{src:e.preview,alt:e.name,className:"file-image"}):X.jsx("div",{className:"file-icon",children:N(e.type)})}),X.jsxs("div",{className:"file-info",children:[X.jsx("div",{className:"file-name",title:e.name,children:e.name}),X.jsx("div",{className:"file-size",children:E(e.size)})]}),H&&!L&&X.jsx("button",{type:"button",className:"file-remove",onClick:A=>{A.stopPropagation(),(e=>{if(o||l)return;const A=w.filter(t=>t.id!==e);if(B(A),C(!0),d){const e=Q(),r={id:t,value:A.map(t=>t.file),isValid:e.isValid,errors:e.errors};d(r)}})(e.id)},"aria-label":`Remove ${e.name}`,children:"✕"})]},e.id))})]}),w.length>0&&T&&!L&&H&&X.jsxs("button",{type:"button",className:"file-add-more",onClick:t=>{t.stopPropagation(),!L&&x.current&&H&&(x.current.value="",x.current.click())},"aria-label":"Add more files",children:[X.jsx("svg",{className:"file-add-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:X.jsx("path",{d:"M12 5v14M5 12h14"})}),X.jsx("span",{className:"file-add-text",children:"Add More Files"})]}),X.jsx(Z,{validationErrors:s,fieldId:t,touchedFields:c,formSubmitted:u,properties:i,localValidation:Q(),isTouched:v,mode:h})]})]})},dt=({id:t,properties:i,validationErrors:s={},formValue:o=null,readonly:l=!1,disabled:c=!1,touchedFields:u={},formSubmitted:h=!1,mode:g="test",onValueChange:m,onBlur:w,onFocus:B,className:y="",hideLabel:b=!1})=>{const[v,C]=e(o),[x,F]=e(!1),[Q,U]=e(""),[E,N]=e(!1),[S,L]=e(!1),[I,_]=e({lat:40.7128,lng:-74.006}),[k,T]=e(null),[H,O]=e(10),[P,D]=e(""),[M,j]=e(!1),R=n(null),[K,V]=e(!1),[z,G]=e(null),[q,W]=e(!1);A(()=>{if(o&&o.latitude&&o.longitude){40.7128===o.latitude&&-74.006===o.longitude||(C(o),T({lat:o.latitude,lng:o.longitude,isCurrentLocation:!1}),_({lat:o.latitude,lng:o.longitude}))}else null==o&&(C(null),T(null))},[o]),A(()=>{S&&40.7128===I.lat&&I.lng},[S,I]),A(()=>{(l||c)&&(S&&L(!1),P&&D(""),K&&(V(!1),G(null)))},[l,c]);const Y=r(async(t,e)=>{W(!0);try{const A=await fetch(`https://nominatim.openstreetmap.org/reverse?format=json&lat=${t}&lon=${e}&addressdetails=1&zoom=18`),r=await A.json();if(r&&r.address){const t=r.address;return{placeName:r.display_name||"",city:t.city||t.town||t.village||t.municipality||"",country:t.country||""}}}catch(t){console.error("Reverse geocoding failed:",t)}finally{W(!1)}return{placeName:"",city:"",country:""}},[]),J=r(async(e,A,r)=>{const n=await Y(e,A),i={latitude:e,longitude:A,timestamp:Date.now(),placeName:n.placeName,city:n.city,country:n.country,address:n.placeName,...r};if(C(i),T({lat:e,lng:A,isCurrentLocation:!1}),N(!0),m){m({id:t,value:i,isValid:!0,errors:{}})}},[Y,t,m]),$=r(async()=>{if(l||c)return;F(!0),U("");if(void 0!==window.Capacitor)try{const{Geolocation:t}=window.Capacitor.Plugins;if(t)try{if("granted"!==(await t.requestPermissions()).location)return F(!1),void U("Location permission is required. Please enable location access in your device settings.");const e=await t.getCurrentPosition({enableHighAccuracy:i.validation?.enableHighAccuracy??!0,timeout:i.validation?.timeout??1e4,maximumAge:i.validation?.maximumAge??3e5}),A=e.coords.latitude,r=e.coords.longitude;return T({lat:A,lng:r,isCurrentLocation:!0}),_({lat:A,lng:r}),N(!0),await J(A,r,{accuracy:e.coords.accuracy,timestamp:Date.now()}),F(!1),void U("")}catch(t){return F(!1),void(t.message?.includes("permission")||t.message?.includes("denied")?U("Location permission is required. Please enable location access in your device settings."):t.message?.includes("timeout")?U("Location request timed out. Please try again."):U("Unable to retrieve your location. Please try again."))}}catch(t){console.warn("Capacitor Geolocation not available, falling back to web geolocation")}if(!navigator.geolocation)return F(!1),void U("Geolocation is not supported by this browser.");const t={enableHighAccuracy:i.validation?.enableHighAccuracy??!0,timeout:i.validation?.timeout??1e4,maximumAge:i.validation?.maximumAge??3e5};navigator.geolocation.getCurrentPosition(async t=>{const e=t.coords.latitude,A=t.coords.longitude;T({lat:e,lng:A,isCurrentLocation:!0}),_({lat:e,lng:A}),N(!0),await J(e,A,{accuracy:t.coords.accuracy,timestamp:t.timestamp}),F(!1),U("")},t=>{F(!1);let e="Unable to retrieve your location.";switch(t.code){case t.PERMISSION_DENIED:e="Location access denied by user. Please enable location access in your browser/device settings.";break;case t.POSITION_UNAVAILABLE:e="Location information is unavailable.";break;case t.TIMEOUT:e="Location request timed out. Please try again."}U(e)},t)},[l,c,i,J]),et=r(()=>{if(!l&&!c&&(C(null),T(null),U(""),N(!0),m)){m({id:t,value:null,isValid:!0,errors:{}})}},[l,c,t,m]),At=r(()=>{l||c||L(!S)},[l,c,S]),rt=r((t,e,A,r,n,i)=>{const s=t-n/2,a=e-i/2,o=156543.03392*Math.cos(A.lat*Math.PI/180)/Math.pow(2,r),l=s*o,c=a*o;return{lat:A.lat+c/111320,lng:A.lng+l/(111320*Math.cos(A.lat*Math.PI/180))}},[]),nt=r(t=>{l||c||!R.current||0===t.button&&(V(!0),G({x:t.clientX,y:t.clientY}),t.preventDefault())},[l,c]),it=r(t=>{if(!K||!z||!R.current)return;const e=t.clientX-z.x,A=t.clientY-z.y,r=156543.03392*Math.cos(I.lat*Math.PI/180)/Math.pow(2,H),n=-A*r/111320,i=e*r/(111320*Math.cos(I.lat*Math.PI/180));_({lat:I.lat+n,lng:I.lng+i}),G({x:t.clientX,y:t.clientY})},[K,z,I,H]),st=r(async t=>{if(!R.current)return;if(K&&z){const e=Math.abs(t.clientX-z.x),A=Math.abs(t.clientY-z.y);if(e>5||A>5)return V(!1),void G(null)}if(l||c)return V(!1),void G(null);const e=R.current.getBoundingClientRect(),A=t.clientX-e.left,r=t.clientY-e.top,{lat:n,lng:i}=rt(A,r,I,H,e.width,e.height);await J(n,i),V(!1),G(null)},[l,c,R,I,H,rt,J,K,z]),at=r(async e=>{if(e.trim()&&!l&&!c){j(!0),U("");try{const A=await fetch(`https://nominatim.openstreetmap.org/search?format=json&q=${encodeURIComponent(e)}&limit=5&addressdetails=1`),r=await A.json();if(r&&r.length>0){const e=r[0],A=parseFloat(e.lat),n=parseFloat(e.lon),i=e.address||{},s={latitude:A,longitude:n,address:e.display_name,placeName:e.display_name,city:i.city||i.town||i.village||i.municipality||"",country:i.country||"",timestamp:Date.now()};if(C(s),T({lat:A,lng:n,isCurrentLocation:!1}),_({lat:A,lng:n}),N(!0),m){m({id:t,value:s,isValid:!0,errors:{}})}}else U("No locations found for your search.")}catch(t){U("Failed to search for location. Please try again.")}finally{j(!1)}}},[l,c,t,m]),ot=()=>{B&&B()},lt=()=>{N(!0),w&&w()},ct=c||l||i?.validation?.readonly,ut=i?.basic?.label||"Location",ht=i?.basic?.description||"";return X.jsxs("div",{className:`form-group ${b?"no-label":""} ${y}`,children:[!b&&X.jsxs("label",{htmlFor:t,className:"form-label",children:[ut,i?.validation?.required&&X.jsx("span",{className:"required-indicator",children:"*"})]}),ht&&X.jsx("div",{className:"form-group-description",children:ht}),X.jsxs("div",{className:"location-wrapper",children:[!(l&&v)&&X.jsxs("div",{className:"location-controls",children:[X.jsx("button",{type:"button",className:"location-btn "+(x?"loading":""),onClick:$,disabled:ct||x,onFocus:ot,onBlur:lt,tabIndex:ct?-1:0,children:x?X.jsxs(X.Fragment,{children:[X.jsx(d,{size:16,className:"loading-spinner"}),"Getting Location..."]}):X.jsxs(X.Fragment,{children:[X.jsx(f,{size:16}),"Get Current Location"]})}),X.jsxs("button",{type:"button",className:"location-btn secondary",onClick:At,disabled:ct,onFocus:ot,onBlur:lt,tabIndex:ct?-1:0,children:[X.jsx(p,{size:16}),S?"Hide Map":"Choose on Map"]})]}),v&&X.jsxs("div",{className:"location-display",children:[!l&&X.jsx("button",{type:"button",className:"location-clear-btn",onClick:et,disabled:ct,title:"Clear location",children:X.jsx(a,{size:16})}),v.placeName&&X.jsxs("div",{className:"location-place-name",children:[X.jsx("strong",{children:"Place:"})," ",v.placeName]}),(v.city||v.country)&&X.jsxs("div",{className:"location-address",children:[X.jsx("strong",{children:"Address:"})," ",[v.city,v.country].filter(Boolean).join(", ")]}),X.jsxs("div",{className:"location-coordinates",children:[X.jsx("strong",{children:"Coordinates:"})," ",(ft=v.latitude,pt=v.longitude,void 0===ft||void 0===pt||isNaN(ft)||isNaN(pt)?"":`${Number(ft).toFixed(6)}, ${Number(pt).toFixed(6)}`)]}),v.accuracy&&X.jsxs("div",{className:"location-accuracy",children:[X.jsx("strong",{children:"Accuracy:"})," ",(dt=v.accuracy,dt?`±${Math.round(dt)}m`:"")]}),v.timestamp&&X.jsxs("div",{className:"location-timestamp",children:[X.jsx("strong",{children:"Captured:"})," ",(tt(v.timestamp)||new Date).toLocaleString()]})]}),S&&!l&&X.jsxs("div",{className:"location-map-container",children:[X.jsxs("div",{className:"location-map-header",children:[X.jsx("h4",{children:"Select Location on Map"}),X.jsx("p",{children:"Search for a place or click on the map to select a location"})]}),X.jsx("div",{className:"location-search",children:X.jsx("form",{onSubmit:t=>{t.preventDefault(),P.trim()&&at(P)},className:"search-form",children:X.jsxs("div",{className:"search-input-group",children:[X.jsx("input",{type:"text",value:P,onChange:t=>{D(t.target.value)},placeholder:"Search for a place (e.g., New York, Paris, Tokyo)",className:"search-input",disabled:ct||M}),X.jsx("button",{type:"submit",className:"search-btn",disabled:ct||M||!P.trim(),children:M?X.jsx(d,{size:16,className:"loading-spinner"}):"Search"})]})})}),X.jsxs("div",{ref:R,className:"location-map "+(K?"dragging":""),onMouseDown:nt,onMouseMove:it,onMouseUp:st,onMouseLeave:()=>{V(!1),G(null)},style:{position:"relative",height:"400px",border:"2px solid var(--df-color-fb-border)",borderRadius:"8px",overflow:"hidden",cursor:K?"grabbing":"grab",background:`url(https://tile.openstreetmap.org/${H}/${Math.floor((I.lng+180)/360*Math.pow(2,H))}/${Math.floor((1-Math.log(Math.tan(I.lat*Math.PI/180)+1/Math.cos(I.lat*Math.PI/180))/Math.PI)/2*Math.pow(2,H))}.png) center/cover no-repeat`,userSelect:"none"},children:[k&&X.jsx("div",{className:"map-marker "+(k.isCurrentLocation?"current-location":"selected-location"),style:{position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -100%)",zIndex:10},children:X.jsx(p,{size:24})}),X.jsx("div",{className:"map-center-indicator",style:{position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",width:"4px",height:"4px",backgroundColor:"var(--df-color-primary)",borderRadius:"50%",zIndex:5}}),X.jsxs("div",{className:"map-controls",children:[X.jsx("button",{type:"button",className:"map-zoom-btn",onClick:()=>O(t=>Math.min(18,t+1)),disabled:H>=18,children:"+"}),X.jsx("button",{type:"button",className:"map-zoom-btn",onClick:()=>O(t=>Math.max(1,t-1)),disabled:H<=1,children:"−"})]})]}),X.jsxs("div",{className:"location-map-instructions",children:[X.jsx("p",{children:X.jsx("strong",{children:"Instructions:"})}),X.jsxs("ul",{children:[X.jsx("li",{children:"Search for a place using the search box above"}),X.jsx("li",{children:"Click anywhere on the map to select a location"}),X.jsx("li",{children:"Drag the map to pan around"}),X.jsx("li",{children:"Use the zoom buttons (+/−) to zoom in/out"}),X.jsx("li",{children:'Use "Get Current Location" to automatically detect your position'})]})]}),q&&X.jsxs("div",{className:"location-loading",children:[X.jsx(d,{size:16,className:"loading-spinner"}),X.jsx("span",{children:"Loading address details..."})]})]}),Q&&X.jsx("div",{className:"location-error",children:Q})]}),X.jsx(Z,{validationErrors:s,fieldId:t,touchedFields:u,formSubmitted:h,properties:i,localValidation:{isValid:!0,errors:{}},isTouched:E,mode:g})]});var dt,ft,pt},ft=({id:t,properties:e,className:A="",hideLabel:r=!1})=>{const n=e.styles?.level??e.basic.level??1,i=e.basic.label,s=()=>{const t={};return e?.styles?.fontSize&&(t.fontSize=e.styles.fontSize),e?.styles?.color&&(t.color=e.styles.color),t};return r?null:(()=>{const r={id:t,className:`form-heading h${n} ${e?.styles?.textAlign?`text-${e.styles.textAlign}`:""} ${A}`.trim(),style:s()};switch(n){case 1:default:return X.jsx("h1",{...r,children:i});case 2:return X.jsx("h2",{...r,children:i});case 3:return X.jsx("h3",{...r,children:i});case 4:return X.jsx("h4",{...r,children:i});case 5:return X.jsx("h5",{...r,children:i});case 6:return X.jsx("h6",{...r,children:i})}})()},pt=({id:t,properties:i,mode:s="preview",formValue:a,onValueChange:o,className:l="",hideLabel:c=!1})=>{const[u,h]=e(""),[d,f]=e(i.validation?.listStyle||"numbers"),[p,b]=e("#000000"),v=n(null),C=n(null),x=n(!1),F="edit"===s,Q=n({instructions:[],listStyle:"numbers",formValue:void 0}),U=n(s);A(()=>{let t=[],e="numbers";if(null!=a&&("object"==typeof a&&a.instructions?(Array.isArray(a.instructions)?t=a.instructions:"string"==typeof a.instructions&&(t=[a.instructions]),a.listStyle&&(e=a.listStyle)):Array.isArray(a)?t=a:"string"==typeof a&&(t=[a])),0===t.length&&i.basic?.value){const A=i.basic.value;A&&"object"==typeof A&&!Array.isArray(A)&&A.instructions?(Array.isArray(A.instructions)?t=A.instructions:"string"==typeof A.instructions&&(t=[A.instructions]),A.listStyle&&"string"==typeof A.listStyle&&(e=A.listStyle)):Array.isArray(A)?t=A:"string"==typeof A&&(t=[A])}0===t.length&&i.basic?.instructions&&(Array.isArray(i.basic.instructions)?t=i.basic.instructions:"string"==typeof i.basic.instructions&&(t=[i.basic.instructions])),e&&"numbers"!==e||(e=i.validation?.listStyle||i.basic?.value?.listStyle||"numbers");const A=JSON.stringify(t)!==JSON.stringify(Q.current.instructions)||e!==Q.current.listStyle,r=s!==U.current,n=JSON.stringify(a)!==JSON.stringify(Q.current.formValue),o=!Q.current.formValue||Array.isArray(Q.current.formValue)&&0===Q.current.formValue.length||"string"==typeof Q.current.formValue&&""===Q.current.formValue.trim(),l=null!=a&&(Array.isArray(a)&&a.length>0||"string"==typeof a&&""!==a.trim()||"object"==typeof a&&Object.keys(a).length>0);if(A||r||n||o&&l){const n=t=>"string"!=typeof t?t:t.replace(/\\u([0-9a-fA-F]{4})/g,(t,e)=>String.fromCharCode(parseInt(e,16))),i=t.map(t=>"string"==typeof t?n(t):t),o=i.some(t=>"string"==typeof t&&/<[^>]+>/.test(t));let l="";if(i.length>0)if(o)l=i.join("");else{const t="numbers"===e?"ol":"bullets"===e?"ul":"div",A=i.filter(t=>t&&"string"==typeof t).map(t=>`<li>${t.replace(/\n/g,"<br>")}</li>`).join("");l="div"===t?i.filter(t=>t&&"string"==typeof t).map(t=>`<div>${t.replace(/\n/g,"<br>")}</div>`).join(""):`<${t}>${A}</${t}>`}f(e),h(l),F&&v.current&&(r||A&&v.current.innerHTML.trim()!==l.trim())&&(v.current.innerHTML=l),Q.current={instructions:t,listStyle:e,formValue:a},U.current=s}},[a,i.basic?.instructions,i.validation?.listStyle,s,F]),A(()=>{if(F&&v.current){const t=v.current.innerHTML.trim();u.trim()===t||x.current||(v.current.innerHTML=u)}if(x.current){const t=setTimeout(()=>{x.current=!1},200);return()=>clearTimeout(t)}},[u,F]);const E=r(()=>{if(!v.current)return;x.current=!0;const e=v.current.innerHTML.trim();if(o){o({id:t,value:{instructions:e?[e]:[],listStyle:d},isValid:!0,errors:{}})}e!==u&&h(e)},[t,d,o,u]),N=r(()=>{if(!v.current)return;const e=v.current.innerHTML.trim();if(o){o({id:t,value:{instructions:e?[e]:[],listStyle:d},isValid:!0,errors:{}})}h(e),x.current=!1},[t,d,o]),S=r((t,e)=>{document.execCommand(t,!1,e),v.current?.focus(),E()},[E]),L=r(()=>{S("bold")},[S]),I=r(()=>{S("italic")},[S]),_=r(t=>{const e=t.target.value;b(e),S("foreColor",e)},[S]),k=r(e=>{if(f(e),!v.current)return;const A=window.getSelection(),r=A&&A.rangeCount>0?A.getRangeAt(0):null;let n=v.current.innerHTML;if("numbers"===e){if(n=n.replace(/<ul>/gi,"<ol>").replace(/<\/ul>/gi,"</ol>"),!n.includes("<ol>")&&!n.includes("<ul>")){const t=n.split(/<br\s*\/?>/i).filter(t=>t.trim());t.length>0&&(n="<ol>"+t.map(t=>`<li>${t}</li>`).join("")+"</ol>")}}else if("bullets"===e){if(n=n.replace(/<ol>/gi,"<ul>").replace(/<\/ol>/gi,"</ul>"),!n.includes("<ol>")&&!n.includes("<ul>")){const t=n.split(/<br\s*\/?>/i).filter(t=>t.trim());t.length>0&&(n="<ul>"+t.map(t=>`<li>${t}</li>`).join("")+"</ul>")}}else n=n.replace(/<\/?[ou]l>/gi,"").replace(/<li>/gi,"<div>").replace(/<\/li>/gi,"</div>");if(v.current.innerHTML=n,h(n),r&&A)try{A.removeAllRanges(),A.addRange(r)}catch(t){}if(E(),o){o({id:t,value:{instructions:n?[n]:[],listStyle:e},isValid:!0,errors:{}})}},[t,E,o]),T=r(t=>{const e=t.target.files?.[0];if(!e||!e.type.startsWith("image/"))return;const A=new FileReader;A.onload=t=>{const e=t.target?.result;if(e&&v.current){const t=document.createElement("img");t.src=e,t.style.maxWidth="100%",t.style.height="auto";const A=window.getSelection();if(A&&A.rangeCount>0){const e=A.getRangeAt(0);e.deleteContents(),e.insertNode(t)}else v.current.appendChild(t);E()}},A.readAsDataURL(e),C.current&&(C.current.value="")},[E]),H=r(t=>{t.preventDefault();const e=t.clipboardData.getData("text/plain"),A=window.getSelection();if(A&&A.rangeCount>0){const t=A.getRangeAt(0);t.deleteContents();const r=document.createTextNode(e);t.insertNode(r),t.setStartAfter(r),t.collapse(!0),A.removeAllRanges(),A.addRange(t)}E()},[E]),O=r(t=>document.queryCommandState(t),[]);return X.jsxs("div",{className:`form-group instruction-group ${l}`,children:[!c&&X.jsx("label",{htmlFor:t,className:"instruction-label",children:"Instructions"}),F?X.jsxs("div",{className:"instruction-rich-editor",children:[X.jsxs("div",{className:"instruction-toolbar",children:[X.jsxs("div",{className:"toolbar-group",children:[X.jsx("button",{type:"button",className:"toolbar-btn "+(O("bold")?"active":""),onClick:L,title:"Bold","aria-label":"Bold",children:X.jsx(g,{size:16})}),X.jsx("button",{type:"button",className:"toolbar-btn "+(O("italic")?"active":""),onClick:I,title:"Italic","aria-label":"Italic",children:X.jsx(m,{size:16})})]}),X.jsx("div",{className:"toolbar-separator"}),X.jsx("div",{className:"toolbar-group",children:X.jsxs("div",{className:"color-picker-wrapper",children:[X.jsx("input",{type:"color",value:p,onChange:_,className:"color-picker-input",title:"Text Color"}),X.jsx("label",{className:"color-picker-label",title:"Text Color",children:X.jsx("span",{style:{color:p},children:"A"})})]})}),X.jsx("div",{className:"toolbar-separator"}),X.jsxs("div",{className:"toolbar-group",children:[X.jsx("button",{type:"button",className:"toolbar-btn "+("bullets"===d?"active":""),onClick:()=>k("bullets"),title:"Bullet List","aria-label":"Bullet List",children:X.jsx(w,{size:16})}),X.jsx("button",{type:"button",className:"toolbar-btn "+("numbers"===d?"active":""),onClick:()=>k("numbers"),title:"Numbered List","aria-label":"Numbered List",children:X.jsx(B,{size:16})})]}),X.jsx("div",{className:"toolbar-separator"}),X.jsxs("div",{className:"toolbar-group",children:[X.jsx("button",{type:"button",className:"toolbar-btn",onClick:()=>C.current?.click(),title:"Insert Image","aria-label":"Insert Image",children:X.jsx(y,{size:16})}),X.jsx("input",{ref:C,type:"file",accept:"image/*",onChange:T,style:{display:"none"}})]})]}),X.jsx("div",{ref:v,contentEditable:!0,className:"instruction-editor-content",onInput:E,onBlur:N,onPaste:H,"data-placeholder":"Enter instructions (press Enter for a new line)...",suppressContentEditableWarning:!0})]}):X.jsx("div",{className:"instruction-preview-wrapper "+("numbers"===d?"instruction-list-numbers":"bullets"===d?"instruction-list-bullets":""),children:u?X.jsx("div",{className:"instruction-preview-content",dangerouslySetInnerHTML:{__html:u}}):X.jsx("div",{className:"instruction-empty",children:X.jsx("p",{children:"No instructions provided"})})})]})},gt=({attachments:t,onRemove:r})=>{const[n,i]=e(new Map);return A(()=>{if(!t)return void i(t=>(t.forEach(t=>URL.revokeObjectURL(t)),new Map));const e=new Map;return t.forEach((t,A)=>{if(t&&t.type&&"string"==typeof t.type&&t.type.startsWith("image/")){const r=URL.createObjectURL(t);e.set(A,r)}}),i(t=>(t.forEach((t,A)=>{e.has(A)||URL.revokeObjectURL(t)}),e)),()=>{e.forEach(t=>URL.revokeObjectURL(t))}},[t]),t&&0!==t.length?X.jsx("div",{className:"attachment-thumbnails-container",children:t.map((t,e)=>{const A=t&&t.type&&"string"==typeof t.type&&t.type.startsWith("image/"),i=n.get(e);return X.jsx("div",{className:"attachment-thumbnail",children:A&&i?X.jsxs(X.Fragment,{children:[X.jsx("img",{src:i,alt:t?t.name:"Attachment"}),X.jsx("button",{type:"button",className:"thumbnail-remove-btn",onClick:()=>r(e),title:"Remove attachment",children:X.jsx(a,{size:14})})]}):X.jsxs(X.Fragment,{children:[X.jsx("div",{className:"file-icon-placeholder",children:X.jsx(h,{size:20})}),X.jsx("span",{className:"file-name",children:t?t.name:"Unknown File"}),X.jsx("button",{type:"button",className:"thumbnail-remove-btn",onClick:()=>r(e),title:"Remove attachment",children:X.jsx(a,{size:14})})]})},e)})}):null},mt=({component:t,mode:i,formTemplateId:s,formValue:a,formData:o,onNotesChange:l,onAttachmentChange:u,notes:d="",attachments:f=null,onThresholdActionCompletion:p,onThresholdIssueRaised:g,onBasicPropertyActionCompletion:m,workOrderNumber:w,assetNumber:B,isStandalone:y,user:Q,onCreateIssue:U,onUpdateIssue:E})=>{const N=void 0!==a?a:o?o[t.id]:void 0,[S,L]=e(d||""),[I,_]=e(f||null),[k,T]=e(!1),[H,O]=e(!1),[P,D]=e(!1),[M,j]=e(!1),[R,K]=e(null),[V,z]=e(!1),G=n(null),q=n(N),W=n(!1),Y=n(!1);A(()=>{d&&d!==S&&!W.current&&(L(d),W.current=!0)},[d,S]),A(()=>{f&&f!==I&&!Y.current&&(_(f),Y.current=!0)},[f,I]),A(()=>{if(W.current&&!k&&null!=d){const t="string"==typeof d?d:String(d||"");S&&""!==String(S||"").trim()||!t||""===t.trim()?t&&""!==t.trim()&&t!==S&&L(t):L(t)}},[d,k,S]),A(()=>{Y.current&&void 0!==f&&(!I||f&&f.length>0&&f!==I)&&_(f)},[f,I]),A(()=>{const e=["select","radio","checkbox","segment"].includes(t.name||"");if(e){const e=q.current,A=N;let r=!1;if("checkbox"===t.name){const t=Array.isArray(e)?e:e?[e]:[],n=Array.isArray(A)?A:A?[A]:[];r=JSON.stringify(t.sort())!==JSON.stringify(n.sort())}else r=e!==A&&void 0!==e;r&&(D(!1),j(!1),K(null),O(!1),T(!1),z(!1),d&&""!==d.trim()||L(""),f&&0!==f.length||_(null)),q.current=A}e||(q.current=N)},[N,t.name,d,f]);const J=r((t,e)=>{const{operator:A,value:r}=t,n=String(e).toLowerCase(),i=String(r).toLowerCase();switch(A){case"equals":return n===i||String(e)===String(r);case"notEquals":return n!==i&&String(e)!==String(r);case"greaterThan":return Number(e)>Number(r);case"lessThan":return Number(e)<Number(r);case"greaterThanOrEqual":return Number(e)>=Number(r);case"lessThanOrEqual":return Number(e)<=Number(r);default:return!1}},[]),$=r(()=>{if(!(null!=N&&""!==N&&!(Array.isArray(N)&&0===N.length)))return[];const e=t.condition;if(!e||!e.conditions||0===e.conditions.length)return[];const A=[];if("checkbox"===t.name&&Array.isArray(N))N.forEach(t=>{const r=e.conditions.find(e=>J(e,t));r&&!A.find(t=>t.id===r.id)&&A.push(r)});else{const t=e.conditions.find(t=>J(t,N));t&&A.push(t)}return A},[t,N,J]),Z=r(e=>{const A=e.target.value;L(A),l&&l(A);const r=$(),n=A.trim().length>0;r.forEach(t=>{!0===t.enableNotes&&p&&p(t.id,"notes",n)});const i=t.condition;!(i&&i.conditions&&i.conditions.length>0)&&m&&m("notes",n)},[l,$,p,t,m]),tt=r(()=>{if(l){const t="string"==typeof S?S:String(S||"");l(t),setTimeout(()=>{T(!1)},0)}else T(!1)},[S,l]),et=r(()=>{tt()},[tt]),rt=r(t=>{(t.ctrlKey||t.metaKey)&&"Enter"===t.key&&(t.preventDefault(),tt())},[tt]),nt=r(()=>{T(!0)},[]),it=r(()=>{T(!0)},[]),st=r(()=>{G.current?.click()},[]),at=r(e=>{const A=e.target.files;if(A&&A.length>0){const e=Array.from(A);_(e),u&&u(e);$().forEach(t=>{!0===t.enableAttachment&&p&&p(t.id,"attachments",!0)});const r=t.condition;!(r&&r.conditions&&r.conditions.length>0)&&m&&m("attachments",!0)}G.current&&(G.current.value="")},[u,$,p,t,m]),ot=r(e=>{if(I){const A=I.filter((t,A)=>A!==e);if(0===A.length){_(null),u&&u(null);$().forEach(t=>{!0===t.enableAttachment&&p&&p(t.id,"attachments",!1)});const e=t.condition;!(e&&e.conditions&&e.conditions.length>0)&&m&&m("attachments",!1)}else _(A),u&&u(A)}},[I,u,$,p,t,m]),lt=r(()=>{D(!0);$().forEach(t=>{!0===t.enableSendEmail&&p&&p(t.id,"email",!0)});const e=t.condition;!(e&&e.conditions&&e.conditions.length>0)&&m&&m("email",!0),setTimeout(()=>{D(!1)},3e3)},[$,p,t,m]),ct=r(()=>{M||O(!0)},[M]),ut=r(()=>{O(!1)},[]),ht=r(e=>{O(!1),j(!0),e&&K(e);const A=t.condition;if(A&&A.conditions&&A.conditions.length>0){$().forEach(t=>{!0===t.enableRaiseIssue&&g&&g(t.id)})}else m&&m("issue",!0)},[t,m,$,g]);if("test"!==i)return null;const dt=["select","radio","checkbox","segment"].includes(t.name||""),ft=t.basic?.options||t.options||[];let pt=!1,mt=!1,wt=!1,Bt=!1,yt=null;const bt=null!=N&&""!==N&&!(Array.isArray(N)&&0===N.length),vt=t.condition,Ct=vt&&vt.conditions&&vt.conditions.length>0;if(Ct&&bt)if("checkbox"===t.name&&Array.isArray(N)){const t=N;for(const e of t){const t=vt.conditions.find(t=>J(t,e));t&&(pt=pt||!0===t.enableNotes,mt=mt||!0===t.enableAttachment,wt=wt||!0===t.enableRaiseIssue,Bt=Bt||!0===t.enableSendEmail)}}else if(dt){const t=vt.conditions.find(t=>J(t,N));t&&(pt=!0===t.enableNotes,mt=!0===t.enableAttachment,wt=!0===t.enableRaiseIssue,Bt=!0===t.enableSendEmail)}else{const t=vt.conditions.find(t=>J(t,N));t&&(pt=!0===t.enableNotes,mt=!0===t.enableAttachment,wt=!0===t.enableRaiseIssue,Bt=!0===t.enableSendEmail)}if(!Ct){const e=t.basic,A=!0===e?.enableNotes,r=!0===e?.enableAttachment,n=!0===e?.enableRaiseIssue,i=!0===e?.enableSendEmail;if(dt)if(bt)if("checkbox"===t.name){(Array.isArray(N)?N:[N]).forEach(t=>{const e=ft.find(e=>!(!e||!e.value)&&(e.value===t||(String(e.value)===String(t)||(e.label===t||String(e.label)===String(t)))));e&&(pt=pt||!0===e.enableNotes,mt=mt||!0===e.enableAttachment,wt=wt||!0===e.enableRaiseIssue,Bt=Bt||!0===e.enableSendEmail,yt||(yt=e))}),pt=pt||A,mt=mt||r,wt=wt||n,Bt=Bt||i}else if(yt=ft.find(t=>!(!t||!t.value)&&(t.value===N||(String(t.value)===String(N)||(t.label===N||String(t.label)===String(N))))),yt){const t=!0===yt.enableNotes,e=!0===yt.enableAttachment,s=!0===yt.enableRaiseIssue,a=!0===yt.enableSendEmail;pt=t||A,mt=e||r,wt=s||n,Bt=a||i}else pt=A,mt=r,wt=n,Bt=i;else pt=A,mt=r,wt=n,Bt=i;else pt=A,mt=r,wt=n,Bt=i}if(!(pt||mt||wt||Bt))return null;const xt=$(),Ft=t.condition,Qt=Ft&&Ft.conditions&&Ft.conditions.length>0,Ut=!!Qt&&xt.some(t=>!0===t.enableNotes),Et=!!Qt&&xt.some(t=>!0===t.enableAttachment),Nt=!!Qt&&xt.some(t=>!0===t.enableSendEmail),St=!!Qt&&xt.some(t=>!0===t.enableRaiseIssue),Lt=S.trim().length>0,It=I&&I.length>0,_t=I?I.length:0;return X.jsxs(X.Fragment,{children:[X.jsxs("div",{className:"component-action-features",children:[X.jsxs("div",{className:"action-icons-toolbar",children:[pt&&X.jsxs("button",{type:"button",className:`action-icon-button ${Lt?"active":""} ${Ut?"mandatory":""}`,onClick:nt,title:"Add Notes",children:[X.jsx(c,{size:14,fill:Lt?"currentColor":"none"}),Ut&&X.jsx("span",{className:"mandatory-indicator",children:"*"})]}),mt&&X.jsxs("button",{type:"button",className:`action-icon-button ${It?"active":""} ${Et?"mandatory":""}`,onClick:st,title:"Add Attachment",children:[X.jsx(h,{size:14,fill:It?"currentColor":"none"}),_t>0&&X.jsx("span",{className:"attachment-count-badge",children:_t}),Et&&X.jsx("span",{className:"mandatory-indicator",children:"*"})]}),Bt&&X.jsxs("button",{type:"button",className:`action-icon-button ${P?"active sent":""} ${Nt?"mandatory":""}`,onClick:lt,disabled:P,title:"Send Email",children:[P?X.jsx(X.Fragment,{children:X.jsx(b,{size:14})}):X.jsx(v,{size:14,fill:P?"currentColor":"none"}),Nt&&X.jsx("span",{className:"mandatory-indicator",children:"*"})]}),wt&&X.jsxs("button",{type:"button",className:`action-icon-button ${M?"active":""} ${St?"mandatory":""}`,onClick:ct,title:"Raise an Issue",children:[X.jsx(C,{size:14,fill:M?"currentColor":"none"}),St&&X.jsx("span",{className:"mandatory-indicator",children:"*"})]}),(Lt&&pt||It&&mt)&&X.jsx("button",{type:"button",className:"action-icon-button accordion-toggle",onClick:()=>z(!V),title:V?"Collapse":"Expand",children:V?X.jsx(x,{size:14}):X.jsx(F,{size:14})})]}),k&&pt&&X.jsxs("div",{className:"notes-input-overlay",children:[X.jsx("textarea",{className:"action-notes-textarea",value:S,onChange:Z,onBlur:et,onKeyDown:rt,placeholder:"Explain which protocols were not followed (Press Ctrl+Enter to save)",rows:4,autoFocus:!0}),X.jsxs("div",{className:"notes-input-actions",children:[X.jsx("button",{type:"button",className:"notes-save-button",onClick:tt,title:"Save notes (Ctrl+Enter)",children:"Save"}),X.jsx("button",{type:"button",className:"notes-cancel-button",onClick:()=>{T(!1)},title:"Cancel",children:"Cancel"})]})]}),V&&X.jsxs("div",{className:"actions-content",children:[!k&&Lt&&pt&&X.jsx("div",{className:"notes-summary-section",children:X.jsxs("div",{className:"notes-full-text",onClick:it,children:[X.jsx("span",{className:"notes-label",children:"Notes:"})," ",S]})}),It&&mt&&X.jsx("div",{className:"attachments-section",children:X.jsx(gt,{attachments:I,onRemove:ot})})]}),mt&&X.jsx("input",{ref:G,type:"file",multiple:!0,accept:"image/*,.pdf",onChange:at,style:{display:"none"}})]}),H&&X.jsx(At,{isOpen:H,onClose:ut,onSuccess:ht,issue:R,component:(()=>{const e=null!=N?Array.isArray(N)?N.join(", "):String(N):t.basic?.value||"",A={...t,basic:{...t.basic||{},value:e}};return yt&&(A.basic.label=`${t.basic?.label||"Component"} - ${yt.label||yt.value}`,A.basic.value=yt.value||e),A})(),formTemplateId:s||"",notes:S,attachments:I,isStandalone:y,workOrderNumber:w,assetNumber:B,user:Q,onCreateIssue:U,onUpdateIssue:E})]})},wt=({attachments:t})=>t&&0!==t.length?X.jsx("div",{className:"attachment-thumbnails-container",children:t.map((t,e)=>{const A=t.type?.startsWith("image/")||!1,r=A?(t=>t.data?t.data.startsWith("data:")?t.data:`data:${t.type||"image/png"};base64,${t.data}`:"")(t):"";return X.jsx("div",{className:"attachment-thumbnail",children:A&&r?X.jsx("img",{src:r,alt:t.name||`Attachment ${e+1}`}):X.jsxs("div",{className:"file-icon-placeholder",children:[X.jsx(h,{size:20}),X.jsx("span",{className:"file-name",children:t.name||`File ${e+1}`})]})},e)})}):null,Bt=({component:t})=>{const e=t.basic?.notes||"",A=t.basic?.attachments||[],r=e&&e.trim().length>0,n=A&&A.length>0;return r||n?X.jsx("div",{className:"component-submission-actions",children:X.jsxs("div",{className:"actions-content",children:[r&&X.jsx("div",{className:"notes-summary-section",children:X.jsxs("div",{className:"notes-full-text",children:[X.jsx("span",{className:"notes-label",children:"Notes:"})," ",e]})}),n&&X.jsx("div",{className:"attachments-section",children:X.jsx(wt,{attachments:A})})]})}):null},yt=({component:t,selectedComponent:e,mode:A,onComponentSelect:r,onComponentDelete:n,onComponentEdit:i,renderFormComponent:s,isOverlay:a=!1,formData:o={},formTemplateId:l,onThresholdActionCompletion:c,onThresholdIssueRaised:u,onNotesChange:h,onAttachmentChange:d,workOrderNumber:f,assetNumber:p,user:g,onCreateIssue:m,onUpdateIssue:w})=>{const B=o[t.id],y="preview"===A&&(t.basic?.notes&&t.basic.notes.trim().length>0||t.basic?.attachments&&Array.isArray(t.basic.attachments)&&t.basic.attachments.length>0),{attributes:b,listeners:v,setNodeRef:C,transform:x,transition:F,isDragging:Q,isSorting:U}=O({id:t.id,disabled:a}),L={transform:D.Transform.toString(x),transition:F,opacity:Q?.3:1,zIndex:Q?1e3:"auto"};return X.jsxs("div",{ref:C,style:{...L,border:e?.id===t.id?"2px solid #3b82f6":"1px solid var(--df-color-fb-border)",borderRadius:"8px",backgroundColor:"var(--df-color-fb-container)",padding:"12px",position:"relative",minHeight:"80px",transition:"all 0.2s ease",boxShadow:e?.id===t.id?"0 4px 12px rgba(59, 130, 246, 0.15)":"0 1px 3px rgba(0, 0, 0, 0.1)",cursor:"pointer"},className:`form-component grid-component ${e?.id===t.id?"selected":""} ${Q?"dragging":""} ${U?"sorting":""}`,onClick:()=>!Q&&r(t),role:"button",tabIndex:0,children:["edit"===A&&X.jsx("div",{className:"component-drag-handle",...v,...b,onClick:t=>t.stopPropagation(),style:{position:"absolute",top:"50%",left:"4px",transform:"translateY(-50%)",padding:"4px",backgroundColor:"#f3f4f6",borderRadius:"4px",cursor:"grab",opacity:1,zIndex:10,display:"flex",alignItems:"center",justifyContent:"center"},children:X.jsx(E,{size:12,color:"var(--df-color-text-light)"})}),X.jsxs("div",{className:"component-content",style:{paddingTop:"edit"===A?"24px":"0",paddingLeft:"edit"===A?"28px":"0",minHeight:"60px"},children:[s(t),!["section","table","heading","file","instructions","signature","location","datagrid"].includes(t.name)&&X.jsx(mt,{component:t,mode:"test",formTemplateId:l,formValue:B,formData:o,onThresholdActionCompletion:c,onThresholdIssueRaised:u,onNotesChange:h?e=>h(t.id,e):void 0,onAttachmentChange:d?e=>d(t.id,e):void 0,workOrderNumber:f,assetNumber:p,user:g,onCreateIssue:m,onUpdateIssue:w}),y&&X.jsx(Bt,{component:t})]}),"edit"===A&&X.jsxs("div",{className:"component-actions",style:{position:"absolute",top:"4px",right:"4px",display:"flex",gap:"4px",opacity:1,zIndex:10},children:[i&&X.jsx("button",{className:"component-edit-btn",onClick:e=>{e.stopPropagation(),i(t)},type:"button",title:"Edit Component",style:{padding:"4px",backgroundColor:"#3b82f6",color:"#ffffff",border:"none",borderRadius:"4px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease"},onMouseEnter:t=>{t.currentTarget.style.backgroundColor="#2563eb"},onMouseLeave:t=>{t.currentTarget.style.backgroundColor="#3b82f6"},children:X.jsx(N,{size:12})}),X.jsx("button",{className:"component-delete-btn",onClick:e=>{e.stopPropagation(),n(t,e)},type:"button",title:"Delete Component",style:{padding:"4px",backgroundColor:"#ef4444",color:"#ffffff",border:"none",borderRadius:"4px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease"},onMouseEnter:t=>{t.currentTarget.style.backgroundColor="#dc2626"},onMouseLeave:t=>{t.currentTarget.style.backgroundColor="#ef4444"},children:X.jsx(S,{size:12})})]})]})},bt=({gridComponents:t,mode:e,onComponentSelect:A,onComponentDelete:r,onComponentEdit:n,onComponentUpdate:i,selectedComponent:s,renderFormComponent:a,gridId:o,formData:l={},formTemplateId:c,onThresholdActionCompletion:u,onThresholdIssueRaised:h,onNotesChange:d,onAttachmentChange:f,workOrderNumber:p,assetNumber:g,user:m,onCreateIssue:w,onUpdateIssue:B})=>{const{setNodeRef:y,isOver:b}=k({id:`grid-drop-zone-${o}`,disabled:"edit"!==e});return X.jsx("div",{ref:y,className:"grid-drop-zone",style:{border:b?"2px dashed #3b82f6":"2px dashed #d1d5db",borderRadius:"8px",padding:"16px",backgroundColor:b?"var(--df-color-primary-light)":"var(--df-color-fb-container)",minHeight:"120px",transition:"all 0.2s ease",position:"relative"},children:t.length>0?X.jsxs(X.Fragment,{children:[X.jsx(T,{items:t.map(t=>t.id),strategy:H,children:X.jsx("div",{style:{display:"flex",flexDirection:"row",flexWrap:"nowrap",gap:"12px",alignItems:"start",marginBottom:t.length>0?"12px":"0",overflowX:"auto",width:"100%"},children:t.map(t=>X.jsx("div",{style:{flex:"1 1 0",minWidth:"200px",maxWidth:"100%"},children:X.jsx(yt,{component:t,selectedComponent:s,mode:e,onComponentSelect:A,onComponentDelete:r,onComponentEdit:n,onComponentUpdate:i,renderFormComponent:a,formData:l,formTemplateId:c,onThresholdActionCompletion:u,onThresholdIssueRaised:h,onNotesChange:d,onAttachmentChange:f,workOrderNumber:p,assetNumber:g,user:m,onCreateIssue:w,onUpdateIssue:B})},t.id))})}),X.jsx("div",{style:{border:b?"2px dashed #3b82f6":"1px dashed var(--df-color-fb-border)",borderRadius:"6px",padding:"12px",backgroundColor:b?"var(--df-color-primary-light)":"var(--df-color-fb-container)",textAlign:"center",color:"var(--df-color-text-light)",fontSize:"12px",transition:"all 0.2s ease",minHeight:"40px",display:"flex",alignItems:"center",justifyContent:"center"},children:b?X.jsx("span",{style:{color:"#3b82f6",fontWeight:"500"},children:"Drop component here to add to grid"}):X.jsx("span",{children:"+ Drop more components here"})})]}):X.jsxs("div",{style:{textAlign:"center",color:"var(--df-color-text-light)",fontSize:"14px",padding:"40px 20px",display:"flex",flexDirection:"column",alignItems:"center",gap:"8px",backgroundColor:"var(--df-color-fb-container)",border:"1px dashed var(--df-color-fb-border)",borderRadius:"8px"},children:[X.jsx("div",{style:{fontWeight:"500",color:b?"var(--df-color-primary)":"var(--df-color-text-dark)"},children:b?"Drop components here":"Empty DataGrid"}),X.jsx("div",{style:{fontSize:"12px",color:"#9ca3af"},children:"Drag and drop components here to create your grid"})]})})},vt=({templateComponents:t,dataEntries:e,renderFormComponent:A,renderComponent:r,mode:n="preview",allowAddRemoveEntries:i=!0,addAnotherText:s="Add Another",removeText:a="Remove",maxEntries:o=10,minEntries:l=1,displayAsGrid:c=!0,onAddEntry:u,onRemoveEntry:h,formData:d={},formTemplateId:f,onThresholdActionCompletion:p,onThresholdIssueRaised:g,onNotesChange:m,onAttachmentChange:w,datagridId:B="",workOrderNumber:y,assetNumber:b,user:v,onCreateIssue:C,onUpdateIssue:x})=>0===t.length?X.jsxs("div",{style:{textAlign:"center",padding:"40px",color:"var(--df-color-text-light)",border:"1px dashed #d1d5db",borderRadius:"8px",backgroundColor:"var(--df-color-fb-container)"},children:["No components defined. Add components to see the ",c?"table":"list"," view."]}):c?X.jsxs("div",{className:"datagrid-table-view",style:{border:"1px solid var(--df-color-fb-border)",borderRadius:"8px",overflow:"hidden",backgroundColor:"var(--df-color-fb-container)",maxWidth:"100%"},children:[X.jsx("div",{style:{position:"absolute",top:"8px",right:"8px",zIndex:10,fontSize:"12px",color:"var(--df-color-text-light)",backgroundColor:"var(--df-color-fb-container)",padding:"4px 8px",borderRadius:"4px",border:"1px solid var(--df-color-fb-border)",opacity:t.length>4?1:0,transition:"opacity 0.2s ease"},children:"← Scroll →"}),X.jsxs("div",{className:"table-scroll-container",style:{overflowX:"auto",overflowY:"hidden",maxWidth:"100%",scrollbarWidth:"thin",scrollbarColor:"var(--df-color-fb-border) var(--df-color-fb-icon-bg)",position:"relative"},children:[X.jsx("div",{className:"table-headers",style:{display:"grid",gridTemplateColumns:`repeat(${t.length}, minmax(150px, 1fr))`,backgroundColor:"var(--df-color-fb-container)",borderBottom:"2px solid var(--df-color-fb-border)",minWidth:150*t.length+"px"},children:t.map((e,A)=>X.jsx("div",{style:{padding:"12px 16px",fontWeight:"600",color:"var(--df-color-text-dark)",borderRight:A<t.length-1?"1px solid var(--df-color-fb-border)":"none",fontSize:"14px",minWidth:"150px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.basic?.label||`Column ${A+1}`},`header-${e.id}`))}),e.length>0?e.map((s,o)=>X.jsxs("div",{className:"table-row",style:{display:"grid",gridTemplateColumns:`repeat(${t.length}, minmax(150px, 1fr))`,borderBottom:o<e.length-1?"1px solid var(--df-color-fb-border)":"none",backgroundColor:o%2==0?"var(--df-color-fb-container)":"var(--df-color-fb-bg)",position:"relative",minWidth:150*t.length+"px",isolation:"isolate"},children:[t.map((e,i)=>{let a=s.components?.[i];const l=`${e.id||`component-${i}`}-entry-${B}-${o}-${i}`;return a=a?a.id!==l?{...a,id:l,basic:{...a.basic,showLabel:!1}}:{...a,id:a.id,basic:{...a.basic,showLabel:!1}}:{...e,id:l,basic:{...e.basic,showLabel:!1,defaultValue:void 0,value:void 0}},X.jsxs("div",{style:{padding:"12px 16px",borderRight:i<t.length-1?"1px solid var(--df-color-fb-border)":"none",minHeight:"60px",minWidth:"150px",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",overflow:"visible",position:"relative",zIndex:1},children:[X.jsx("div",{style:{width:"100%",minWidth:"120px",overflow:"hidden",position:"relative",zIndex:1},children:r?r(a,!0):A(a,!0)}),!["section","table","heading","file","instructions","signature","location","datagrid"].includes(a.name)&&X.jsxs("div",{style:{marginTop:"8px",width:"100%"},children:[X.jsx(mt,{component:a,mode:"test",formTemplateId:f,formValue:d[a.id],formData:d,onThresholdActionCompletion:p,onThresholdIssueRaised:g,onNotesChange:m?t=>m(a.id,t):void 0,onAttachmentChange:w?t=>w(a.id,t):void 0,notes:a.basic?.notes||d[a.id]?.notes,attachments:a.basic?.attachments||d[a.id]?.attachments,workOrderNumber:y,assetNumber:b,user:v,onCreateIssue:C,onUpdateIssue:x}),"preview"===n&&(a.basic?.notes||a.basic?.attachments)&&X.jsx(Bt,{component:a})]})]},`${s.id}-${i}`)}),i&&e.length>l&&X.jsx("button",{type:"button",onClick:t=>{if(t.preventDefault(),t.stopPropagation(),!(e.length<=l)&&h)try{h(o)}catch(t){console.error("Error removing entry:",t)}},disabled:e.length<=l,style:{position:"absolute",top:"8px",right:"8px",padding:"4px 8px",backgroundColor:e.length<=l?"#f3f4f6":"#ef4444",color:e.length<=l?"#9ca3af":"#ffffff",border:"none",borderRadius:"4px",fontSize:"12px",fontWeight:"500",cursor:e.length<=l?"not-allowed":"pointer",display:"flex",alignItems:"center",gap:"4px",zIndex:1e3,minWidth:"24px",height:"24px",justifyContent:"center",transition:"all 0.2s ease",pointerEvents:"auto"},title:a,onMouseEnter:t=>{e.length>l&&(t.currentTarget.style.backgroundColor="#dc2626")},onMouseLeave:t=>{e.length>l&&(t.currentTarget.style.backgroundColor="#ef4444")},children:X.jsx("span",{style:{fontSize:"14px"},children:"×"})})]},s.id)):X.jsxs("div",{style:{padding:"40px",textAlign:"center",color:"var(--df-color-text-light)",backgroundColor:"var(--df-color-fb-container)",borderTop:"1px solid var(--df-color-fb-border)"},children:["No data entries. ",i?'Click "Add Another" to add entries.':"Use the properties panel to add entries."]})]}),i&&X.jsx("div",{style:{padding:"16px",backgroundColor:"var(--df-color-fb-bg)",borderTop:"1px solid var(--df-color-fb-border)",display:"flex",justifyContent:"center",position:"sticky",bottom:0,zIndex:5},children:X.jsxs("button",{type:"button",onClick:t=>{if(t.preventDefault(),t.stopPropagation(),!(e.length>=o)&&u)try{u()}catch(t){console.error("Error adding entry:",t)}},disabled:e.length>=o,style:{padding:"8px 16px",backgroundColor:e.length>=o?"#f3f4f6":"#10b981",color:e.length>=o?"#9ca3af":"#ffffff",border:"none",borderRadius:"6px",fontSize:"14px",fontWeight:"500",cursor:e.length>=o?"not-allowed":"pointer",display:"flex",alignItems:"center",gap:"6px",transition:"all 0.2s ease",pointerEvents:"auto",zIndex:1e3},onMouseEnter:t=>{e.length<o&&(t.currentTarget.style.backgroundColor="#059669")},onMouseLeave:t=>{e.length<o&&(t.currentTarget.style.backgroundColor="#10b981")},children:[X.jsx("span",{style:{fontSize:"16px"},children:"+"}),s]})})]}):X.jsxs("div",{className:"datagrid-list-view",style:{display:"flex",flexDirection:"column",gap:"12px",backgroundColor:"var(--df-color-fb-container)"},children:[e.length>0?e.map((s,o)=>X.jsxs("div",{className:"list-entry",style:{border:"1px solid var(--df-color-fb-border)",borderRadius:"8px",padding:"16px",backgroundColor:"var(--df-color-fb-container)",position:"relative",transition:"all 0.2s ease"},children:[X.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"12px",paddingBottom:"8px",borderBottom:"1px solid var(--df-color-fb-border)"},children:[X.jsxs("span",{style:{fontWeight:"600",color:"var(--df-color-text-dark)",fontSize:"14px"},children:["Entry #",o+1]}),i&&e.length>1&&X.jsx("button",{type:"button",onClick:t=>{if(t.preventDefault(),t.stopPropagation(),!(e.length<=l)&&h)try{h(o)}catch(t){console.error("Error removing entry:",t)}},disabled:e.length<=l,style:{padding:"4px 8px",backgroundColor:e.length<=l?"#f3f4f6":"#ef4444",color:e.length<=l?"#9ca3af":"#ffffff",border:"none",borderRadius:"4px",fontSize:"12px",fontWeight:"500",cursor:e.length<=l?"not-allowed":"pointer",display:"flex",alignItems:"center",gap:"4px",minWidth:"24px",height:"24px",justifyContent:"center",transition:"all 0.2s ease",pointerEvents:"auto",zIndex:1e3},title:a,onMouseEnter:t=>{e.length>l&&(t.currentTarget.style.backgroundColor="#dc2626")},onMouseLeave:t=>{e.length>l&&(t.currentTarget.style.backgroundColor="#ef4444")},children:X.jsx("span",{style:{fontSize:"14px"},children:"×"})})]}),X.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:"16px"},children:t.map((t,e)=>{let i=s.components?.[e];const a=`${t.id||`component-${e}`}-entry-${B}-${o}-${e}`;return i||(i=s.components?.find(e=>e.name===t.name&&e.basic?.label===t.basic?.label)),i=i?i.id!==a?{...i,id:a,basic:{...i.basic,showLabel:!1}}:{...i,id:i.id,basic:{...i.basic,showLabel:!1}}:{...t,id:a,basic:{...t.basic,showLabel:!1,defaultValue:void 0,value:void 0}},X.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[X.jsx("label",{style:{fontSize:"12px",fontWeight:"500",color:"var(--df-color-text-light)",textTransform:"uppercase",letterSpacing:"0.05em"},children:t.basic?.label||`Field ${e+1}`}),X.jsxs("div",{style:{minHeight:"40px",display:"flex",alignItems:"center",flexDirection:"column",width:"100%"},children:[r?r(i):A(i),!["section","table","heading","file","instructions","signature","location","datagrid"].includes(i.name)&&X.jsx(mt,{component:i,mode:"test",formTemplateId:f,formValue:d[i.id],onThresholdActionCompletion:p,onThresholdIssueRaised:g,onNotesChange:m?t=>m(i.id,t):void 0,onAttachmentChange:w?t=>w(i.id,t):void 0}),"preview"===n&&(i.basic?.notes&&i.basic.notes.trim().length>0||i.basic?.attachments&&Array.isArray(i.basic.attachments)&&i.basic.attachments.length>0?X.jsx(Bt,{component:i}):null)]})]},`${s.id}-${e}`)})})]},s.id)):X.jsxs("div",{style:{padding:"40px",textAlign:"center",color:"var(--df-color-text-light)",backgroundColor:"var(--df-color-fb-container)",border:"1px dashed #d1d5db",borderRadius:"8px"},children:["No data entries. ",i?'Click "Add Another" to add entries.':"Use the properties panel to add entries."]}),"test"===n&&i&&X.jsx("div",{style:{padding:"16px",backgroundColor:"#f8f9fa",border:"1px solid var(--df-color-fb-border)",borderRadius:"8px",display:"flex",justifyContent:"center"},children:X.jsxs("button",{type:"button",onClick:t=>{if(t.preventDefault(),t.stopPropagation(),!(e.length>=o)&&u)try{u()}catch(t){console.error("Error adding entry:",t)}},disabled:e.length>=o,style:{padding:"8px 16px",backgroundColor:e.length>=o?"#f3f4f6":"#10b981",color:e.length>=o?"#9ca3af":"#ffffff",border:"none",borderRadius:"6px",fontSize:"14px",fontWeight:"500",cursor:e.length>=o?"not-allowed":"pointer",display:"flex",alignItems:"center",gap:"8px",transition:"all 0.2s ease",pointerEvents:"auto",zIndex:1e3},onMouseEnter:t=>{e.length<o&&(t.currentTarget.style.backgroundColor="#059669")},onMouseLeave:t=>{e.length<o&&(t.currentTarget.style.backgroundColor="#10b981")},children:[X.jsx("span",{children:"+"}),s]})})]}),Ct=({id:t,properties:i,mode:s="edit",formData:a={},validationErrors:o={},touchedFields:l={},formSubmitted:c=!1,onValueChange:u,onSelect:h,isSelected:d=!1,className:f="",onDataGridSelect:p,onComponentSelect:g,onComponentDelete:m,onComponentEdit:w,onComponentUpdate:B,selectedComponent:y,renderFormComponent:b,onEntryAdd:v,onEntryRemove:C,formTemplateId:x,onThresholdActionCompletion:E,onThresholdIssueRaised:N,onNotesChange:S,onAttachmentChange:L,workOrderNumber:I,assetNumber:_,user:k,onCreateIssue:T,onUpdateIssue:H})=>{const[O,P]=e(!1),D=n(!1);let M=i.templateComponents||[];const j=i.entries||[];0===M.length&&j.length>0&&j[0].components&&(M=j[0].components.map(t=>({...t,id:t.id?.replace(/-entry-\d+$/,"")||t.id,basic:{...t.basic,showLabel:!0}}))),A(()=>{if("edit"===s&&!i.templateComponents&&u&&D.current){const e={...i,templateComponents:[]};JSON.stringify(e)!==JSON.stringify(i)&&u({id:t,value:e})}D.current=!0},[i.templateComponents,t,u,i,s]),A(()=>{if(M.length>0){if("test"===s&&0===j.length&&D.current){const e={id:`entry-${t}-0`,index:0,components:M.map((e,A)=>{const r=e.id||`component-${A}`;return{...e,id:`${r}-entry-${t}-0-${A}`,basic:{...e.basic,showLabel:!1,defaultValue:void 0,value:void 0}}}),styles:{}};if(u){const A={...i,entries:[e]};JSON.stringify(A)!==JSON.stringify(i)&&u({id:t,value:A})}return}if("edit"!==s||!D.current)return;const e=j.some(t=>t.components?.some((e,A)=>{const r=`${M[A]?.id}-entry-${t.index}-${A}`;return e.id!==r}));if(e&&u){const e=j.map(t=>({...t,components:t.components?.map((e,A)=>({...e,id:`${M[A]?.id}-entry-${t.index}-${A}`}))||[]})),A={...i,entries:e};return void(JSON.stringify(A)!==JSON.stringify(i)&&u({id:t,value:A}))}if(0===j.length&&"edit"===s){const e={id:`entry-${t}-0`,index:0,components:M.map((e,A)=>{const r=e.id||`component-${A}`;return{...e,id:`${r}-entry-${t}-0-${A}`,basic:{...e.basic,showLabel:!1,defaultValue:void 0,value:void 0}}}),styles:{}};if(u){const A={...i,entries:[e]};JSON.stringify(A)!==JSON.stringify(i)&&u({id:t,value:A})}}else if(j.length>0){if(j.some(t=>M.some((e,A)=>{const r=t.components?.[A];if(!r)return!0;const n=`${e.id}-entry-${t.index}-${A}`,i=r.id===n,s=JSON.stringify(r.basic?.options)!==JSON.stringify(e.basic?.options)||r.basic?.placeholder!==e.basic?.placeholder||r.basic?.defaultValue!==e.basic?.defaultValue||r.basic?.label!==e.basic?.label||r.validation?.required!==e.validation?.required;return!i||s}))&&u){const e=j.map(e=>{const A=M.map((A,r)=>{let n=e.components?.[r];n||(n=e.components?.find(t=>t.name===A.name&&t.basic?.label===A.basic?.label));const i=`${A.id||`component-${r}`}-entry-${t}-${e.index}-${r}`;if(n){return{...A,id:i,basic:{...A.basic,showLabel:!1,defaultValue:void 0,value:void 0}}}return{...A,id:i,basic:{...A.basic,showLabel:!1,defaultValue:void 0,value:void 0}}});return{...e,components:A}}),A={...i,entries:e};JSON.stringify(A)!==JSON.stringify(i)&&u({id:t,value:A})}}}},[M,j,t,u,i,s,i.templateComponents]);const R=r(t=>{t.stopPropagation(),h?.(),p?.(i)},[h,p,i]),K=r((e,A)=>{A.stopPropagation(),m&&m(e,A);const r=M.filter(t=>t.id!==e.id),n=j.map(t=>({...t,components:t.components?.filter(t=>!(t.name===e.name&&t.basic?.label===e.basic?.label))||[]}));u&&u({id:t,value:{...i,templateComponents:r,entries:n}})},[m,i,u,t,M,j]),V=r((e,A)=>{B&&B(e,A);const r=M.map(t=>t.id===e?{...t,...A}:t);u&&u({id:t,value:{...i,templateComponents:r}})},[B,i,u,t,M]),z=r(t=>{"test"===s&&u&&u({id:t.id,value:t.value})},[u]),G=r(()=>{const e=i.entries||[],A=e.length,r={id:`entry-${t}-${A}`,index:A,components:M.map((e,r)=>{const n=`${e.id||`component-${r}`}-entry-${t}-${A}-${r}`;return{...e,id:n,basic:{...e.basic,showLabel:!1,defaultValue:void 0,value:void 0}}}),styles:{}},n=[...e,r];u&&u({id:t,value:{...i,entries:n}}),v?.()},[i,u,t,v,M]),q=r(e=>{const A=i.entries.filter((t,A)=>A!==e).map((e,A)=>({...e,index:A,id:`entry-${t}-${A}`}));u&&u({id:t,value:{...i,entries:A}})},[i,u,t,C]),W=r((t,e=!1)=>{const A=a[t.id]||"defaultValue"in t.basic&&t.basic.defaultValue||"";let r=A;"number-input"===t.name&&"number"==typeof A?r=String(A):"number-input"===t.name&&null==A&&(r="");const n={id:t.id,properties:t,validationErrors:o||{},formValue:r,touchedFields:l||{},formSubmitted:c||!1,mode:s,hideLabel:e,onValueChange:z,onBlur:()=>{},onFocus:()=>{}};switch(t.name){case"text-input":case"email-input":case"number-input":return X.jsx(nt,{...n,properties:t,inputType:"text-input"===t.name?"text":"number-input"===t.name?"number":"email",readonly:!1,disabled:!1,hideLabel:e});case"textarea":return X.jsx(it,{...n,properties:t,readonly:!1,disabled:!1,hideLabel:e});case"select":const A={...t,options:t.basic?.options||[]};return X.jsx(st,{...n,properties:A,disabled:!1,hideLabel:e});case"checkbox":const r={...t,options:t.basic?.options||[]};return X.jsx(at,{...n,properties:r,formValue:[],disabled:!1,hideLabel:e});case"radio":const i={...t,options:t.basic?.options||[]};return X.jsx(ot,{...n,properties:i,readonly:!1,disabled:!1,hideLabel:e});case"date":case"date-picker":case"datetime-picker":return X.jsx(ct,{...n,properties:t,readonly:!1,disabled:!1,hideLabel:e});case"signature":return X.jsx(ut,{...n,properties:t,hideLabel:e});case"heading":return X.jsx(ft,{...n,properties:t,hideLabel:e});case"instructions":return X.jsx(pt,{...n,properties:t,hideLabel:e});case"location":return X.jsx(dt,{...n,properties:t,hideLabel:e});case"segment":const o={...t,options:t.basic?.options||[]};return X.jsx(lt,{...n,properties:o,hideLabel:e});case"datagrid":return X.jsx(Ct,{...n,properties:t,formData:a,mode:s,onNotesChange:()=>{},onAttachmentChange:()=>{}});default:return X.jsxs("div",{className:"unknown-component",children:["Unknown component: ",t.name]})}},[s,z,a,o,l,c]),Y={backgroundColor:i.styles.backgroundColor||"var(--df-color-fb-container)",borderColor:i.styles.borderColor||"var(--df-color-fb-border)",borderWidth:i.styles.borderWidth||"2px",borderRadius:i.styles.borderRadius||"8px",padding:i.styles.padding||"16px",margin:i.styles.margin||"16px 0"};return X.jsxs("div",{className:`form-group df-form-datagrid ${d?"selected":""} ${f}`,onClick:R,style:Y,children:[X.jsx("div",{className:"grid-header",children:X.jsx("div",{className:"grid-title",onClick:e=>{e.stopPropagation(),P(!O),u?.({id:t,value:{...i,basic:{...i.basic,collapsed:!O}}})},children:X.jsxs("div",{className:"title-content",style:{display:"flex",alignItems:"center",gap:"8px"},children:[O?X.jsx(Q,{size:16}):X.jsx(F,{size:16}),X.jsx(U,{size:16}),X.jsx("span",{className:"grid-label",style:{fontWeight:"600"},children:i.basic.label}),i.validation.required&&X.jsx("span",{className:"required-indicator",style:{color:"#ef4444"},children:"*"})]})})}),i.basic.description&&!O&&X.jsx("div",{className:"grid-description",style:{marginTop:"8px",color:"var(--df-color-text-light)",fontSize:"14px"},children:i.basic.description}),!O&&X.jsx("div",{className:"grid-content",style:{marginTop:"16px"},children:"edit"===s?X.jsx(bt,{gridComponents:M,mode:s,onComponentSelect:g||(()=>{}),onComponentDelete:K,onComponentEdit:w,onComponentUpdate:V,selectedComponent:y||null,renderFormComponent:b||W,gridId:t,formData:a,formTemplateId:x,onThresholdActionCompletion:E,onThresholdIssueRaised:N,onNotesChange:S,onAttachmentChange:L,workOrderNumber:I,assetNumber:_,user:k,onCreateIssue:T,onUpdateIssue:H}):X.jsx(vt,{templateComponents:M,dataEntries:j,renderFormComponent:b||W,mode:s,allowAddRemoveEntries:i.datagrid?.allowAddRemoveEntries??!0,addAnotherText:i.datagrid?.addAnotherText??"Add Entry",removeText:i.datagrid?.removeText??"Remove",maxEntries:i.datagrid?.maxEntries??10,minEntries:i.datagrid?.minEntries??1,displayAsGrid:i.datagrid?.displayAsGrid??!0,onAddEntry:v||G,onRemoveEntry:C||q,formData:a,formTemplateId:x,onThresholdActionCompletion:E,onThresholdIssueRaised:N,onNotesChange:S,onAttachmentChange:L,datagridId:t,workOrderNumber:I,assetNumber:_,user:k,onCreateIssue:T,onUpdateIssue:H})})]})},xt=({child:t,selectedChild:e,mode:A,onChildSelect:r,onChildDelete:n,renderFormComponent:i,isOverlay:s=!1,isChildrenEditMode:a=!1,formData:o={},formTemplateId:l,onThresholdActionCompletion:c,onThresholdIssueRaised:u,onNotesChange:h,onAttachmentChange:d,workOrderNumber:f,assetNumber:p,user:g,onCreateIssue:m,onUpdateIssue:w})=>{const B=o[t.id],y="preview"===A&&(t.basic?.notes&&t.basic.notes.trim().length>0||t.basic?.attachments&&Array.isArray(t.basic.attachments)&&t.basic.attachments.length>0),{attributes:b,listeners:v,setNodeRef:C,transform:x,transition:F,isDragging:Q,isSorting:U}=O({id:t.id,disabled:s||"edit"!==A}),L={transform:D.Transform.toString(x),transition:F,zIndex:Q?1e3:"auto"};return X.jsxs("div",{ref:C,style:L,className:`form-component section-child ${e?.id===t.id?"selected":""} ${Q?"dragging":""} ${U?"sorting":""} ${a?"children-edit-active":""}`,onClick:()=>!Q&&r(t),role:"button",tabIndex:0,children:[("edit"===A||a)&&X.jsx("div",{className:"child-drag-handle",...v,...b,onClick:t=>t.stopPropagation(),onMouseDown:t=>t.stopPropagation(),children:X.jsx(E,{size:14})}),X.jsxs("div",{className:"form-component-content section-child-content",children:[("edit"===A||a)&&X.jsxs("div",{className:"component-actions child-actions",children:[X.jsx("button",{className:"btn edit-btn",onClick:e=>{e.stopPropagation(),r(t)},onMouseDown:t=>t.stopPropagation(),title:"Edit properties",children:X.jsx(N,{size:12})}),X.jsx("button",{className:"btn delete-btn",onClick:e=>n(t,e),onMouseDown:t=>t.stopPropagation(),title:"Delete component",children:X.jsx(S,{size:12})})]}),X.jsxs("div",{className:"component-preview child-preview",children:[i(t),!["section","table","heading","file","instructions","signature","location","datagrid"].includes(t.name)&&X.jsx(mt,{component:t,mode:"test",formTemplateId:l,formValue:B,formData:o,onThresholdActionCompletion:c,onThresholdIssueRaised:u,onNotesChange:h?e=>h(t.id,e):void 0,onAttachmentChange:d?e=>d(t.id,e):void 0,workOrderNumber:f,assetNumber:p,user:g,onCreateIssue:m,onUpdateIssue:w}),y&&X.jsx(Bt,{component:t})]})]})]})},Ft=({id:t,properties:n,mode:i="edit",formData:s={},onValueChange:a,onSelect:o,isSelected:l=!1,className:c="",onSectionSelect:u,onChildSelect:h,onChildDelete:d,selectedChild:f,renderFormComponent:p,formTemplateId:g,onThresholdActionCompletion:m,onThresholdIssueRaised:w,onNotesChange:B,onAttachmentChange:y,workOrderNumber:b,assetNumber:v,user:C,onCreateIssue:x,onUpdateIssue:U})=>{const[E,N]=e(n.basic.collapsed),[S,L]=e(!1),[I,_]=e(!1),[H,O]=e(n.basic.label),[D,M]=e(n.basic.description),[j,R]=e(n.children||[]),[K,V]=e(!1);A(()=>{R(n.children||[])},[n.children]),A(()=>{O(n.basic.label),M(n.basic.description)},[n.basic.label,n.basic.description]);const{setNodeRef:z,isOver:G}=k({id:`section-${t}`,disabled:"edit"!==i}),q=!("preview"!==i&&"test"!==i||n.children&&n.children.length>0),W=r(e=>{O(e),a?.({id:t,value:{...n,basic:{...n.basic,label:e}}})},[t,n,a]),Y=r(e=>{M(e),a?.({id:t,value:{...n,basic:{...n.basic,description:e}}})},[t,n,a]),J=r(t=>{h?.(t)},[h]),$=r((t,e)=>{e.stopPropagation();const A=j.filter(e=>e.id!==t.id);R(A),d?.(t.id)},[d,j,t]),Z=r(()=>{u?.(n),o?.()},[u,o,n]),tt=r(t=>{t.stopPropagation(),"edit"===i&&j.length>0&&V(!K)},[i,j.length,K]),et=r(e=>{e.stopPropagation(),N(!E),a?.({id:t,value:{...n,basic:{...n.basic,collapsed:!E}}})},[E,t,n,a]),At=p||r(t=>{const e=s[t.id]||"defaultValue"in t.basic&&t.basic.defaultValue||"";let A=e;"number-input"===t.name&&"number"==typeof e?A=String(e):"number-input"===t.name&&null==e&&(A="");const r={id:t.id,properties:t,validationErrors:{},formValue:A,touchedFields:{},formSubmitted:!1,mode:i,onValueChange:a,onBlur:()=>{},onFocus:()=>{}};switch(t.name){case"text-input":case"email-input":case"number-input":return X.jsx(nt,{...r,properties:t,inputType:"text-input"===t.name?"text":"number-input"===t.name?"number":"email",readonly:!1,disabled:!1});case"textarea":return X.jsx(it,{...r,properties:t,readonly:!1,disabled:!1});case"select":const e={...t,options:t.basic?.options||[]};return X.jsx(st,{...r,properties:e,disabled:!1});case"checkbox":const A={...t,options:t.basic?.options||[]};return X.jsx(at,{...r,properties:A,formValue:[],disabled:!1});case"radio":const n={...t,options:t.basic?.options||[]};return X.jsx(ot,{...r,properties:n,readonly:!1,disabled:!1});case"date":case"date-picker":case"datetime-picker":return X.jsx(ct,{...r,properties:t,readonly:!1,disabled:!1});case"signature":return X.jsx(ut,{...r,properties:t});case"heading":return X.jsx(ft,{...r,properties:t});case"instructions":return X.jsx(pt,{...r,properties:t});case"location":return X.jsx(dt,{...r,properties:t});case"datagrid":return X.jsx(Ct,{...r,properties:t,formData:s,mode:i,onNotesChange:()=>{},onAttachmentChange:()=>{}});case"segment":const a={...t,options:t.basic?.options||[]};return X.jsx(lt,{...r,properties:a});default:return X.jsx("div",{className:"form-group",children:X.jsxs("div",{className:"form-group-label",children:["Unsupported Component: ",t.name]})})}},[i,a,s]);if(q)return null;const rt={backgroundColor:n.styles?.backgroundColor||"var(--df-color-fb-container)",borderColor:n.styles?.borderColor||"var(--df-color-fb-border)",borderWidth:n.styles?.borderWidth||"2px",borderRadius:n.styles?.borderRadius||"8px",padding:n.styles?.padding||"16px",margin:n.styles?.margin||"16px 0"};return X.jsxs("div",{ref:z,className:`df-form-section ${l?"selected":""} ${G?"drag-over":""} ${c}`,style:rt,children:[X.jsxs("div",{className:"section-header "+(K?"children-edit-mode":""),onClick:Z,onDoubleClick:tt,children:[X.jsx("div",{className:"section-header-content",children:X.jsxs("div",{className:"section-title",children:[X.jsx("span",{className:"section-toggle",title:E?"Expand section":"Collapse section",role:"button",tabIndex:0,onClick:t=>{t.stopPropagation(),et(t)},onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),et(t))},style:{marginRight:"8px",display:"inline-flex",alignItems:"center"},children:E?X.jsx(Q,{size:18}):X.jsx(F,{size:18})}),"edit"===i&&S?X.jsx("input",{type:"text",value:H,onChange:t=>O(t.target.value),onBlur:()=>{L(!1),W(H)},onKeyDown:t=>{"Enter"===t.key&&(L(!1),W(H))},className:"section-title-input",autoFocus:!0}):X.jsx("h3",{className:"section-title-text",onDoubleClick:()=>"edit"===i&&L(!0),style:{display:"inline",margin:0},children:H||"Untitled Section"})]})}),(D||"edit"===i)&&X.jsx("div",{className:"section-description",children:"edit"===i&&I?X.jsx("textarea",{value:D,onChange:t=>M(t.target.value),onBlur:()=>{_(!1),Y(D)},onKeyDown:t=>{"Enter"===t.key&&t.ctrlKey&&(_(!1),Y(D))},className:"section-description-input",placeholder:"Section description (optional)",autoFocus:!0}):X.jsx("p",{className:"section-description-text",onDoubleClick:()=>"edit"===i&&_(!0),children:D||"Section description"})})]}),!E&&X.jsx("div",{className:`section-content ${G?"drag-over":""} ${0===j.length?"empty":"has-children"}`,onClick:t=>{t.target===t.currentTarget&&Z()},children:X.jsx(T,{items:j.map(t=>t.id),strategy:P,children:0===j.length?X.jsxs("div",{className:"section-empty-state",onClick:Z,style:{textAlign:"center",color:"#6b7280",fontSize:"14px",padding:"40px 20px",display:"flex",flexDirection:"column",alignItems:"center",gap:"8px",cursor:"pointer",border:"2px dotted #d1d5db",borderRadius:"8px",backgroundColor:"var(--df-color-fb-container)",transition:"all 0.3s ease",margin:"16px 0"},children:[X.jsx("div",{style:{fontWeight:"500",color:G?"#3b82f6":"#374151"},children:G?"Drop components here":"Empty Section"}),X.jsx("div",{style:{fontSize:"12px",color:"#9ca3af"},children:"Drag and drop components here to create your section"})]}):j.map(t=>X.jsx(xt,{child:t,selectedChild:f||null,mode:i,onChildSelect:J,onChildDelete:$,renderFormComponent:At,isChildrenEditMode:K,formData:s,formTemplateId:g,onNotesChange:B,onAttachmentChange:y,onThresholdActionCompletion:m,onThresholdIssueRaised:w,workOrderNumber:b,assetNumber:v,user:C,onCreateIssue:x,onUpdateIssue:U},t.id))})})]})},Qt=t.lazy(()=>Promise.resolve().then(function(){return kt})),Ut=({formComponents:i=[],currentDevice:s="desktop",isPreviewMode:a=!1,initialFormData:o=[],onSubmit:l,onFormDataChange:c,formTitle:u,formDescription:h,formTemplateId:d,onComponentSelect:f,onComponentDelete:p,onComponentEdit:g,onComponentUpdate:m,selectedComponent:w,workOrderNumber:B,assetNumber:y,isStandalone:b,user:v,onCreateIssue:C,onUpdateIssue:x})=>{const[F,Q]=e({}),[U,E]=e({}),[N,S]=e(!1),[L,I]=e({}),[_,k]=e({}),[T,H]=e(new Set),[O,P]=e(new Map),[D,M]=e({isValid:!0}),[j,R]=e({}),[K,V]=e({});A(()=>{G()},[i,o]);const z=(t,e)=>{t.forEach(t=>{if(t.id&&(void 0!==e[t.id]||(t.basic&&"value"in t.basic&&void 0!==t.basic.value&&""!==t.basic.value&&null!==t.basic.value?e[t.id]=t.basic.value:t.basic&&"defaultValue"in t.basic&&void 0!==t.basic.defaultValue&&""!==t.basic.defaultValue&&null!==t.basic.defaultValue?e[t.id]=t.basic.defaultValue:"checkbox"===t.name||"select"===t.name?e[t.id]=[]:e[t.id]="")),t.cells&&Array.isArray(t.cells)&&t.cells.forEach((t,A)=>{Array.isArray(t)&&t.forEach((t,A)=>{t&&t.components&&Array.isArray(t.components)&&z(t.components,e)})}),t.entries&&Array.isArray(t.entries)&&t.entries.forEach((t,A)=>{t&&t.components&&Array.isArray(t.components)&&z(t.components,e)}),"file"===t.name&&t.basic){const A=t.basic.files||t.basic.attachments||t.basic.value;A&&(e[t.id]=A)}if(t.id&&t.basic&&t.basic.notes,"instructions"===t.name&&t.basic){t.basic.instructions||(t.basic.instructions=[]);const A=t.basic.value||t.basic.instructions;A&&(e[t.id]=A)}t.children&&Array.isArray(t.children)&&z(t.children,e)})},G=r(()=>{const t={},e={},A={},r=new Set,n=t=>{t.forEach(t=>{t.id&&((t.basic?.notes||t.basic?.comments)&&(e[t.id]=t.basic?.notes||t.basic?.comments),t.basic?.attachments&&(A[t.id]=t.basic.attachments)),t.children&&n(t.children),t.cells&&t.cells.forEach(t=>t.forEach(t=>{t.components&&n(t.components)})),t.entries&&t.entries.forEach(t=>{t.components&&n(t.components)})})},s=t=>t.map((t,e)=>{let A={...t};if(A.id&&"string"==typeof A.id&&""!==A.id.trim())r.has(A.id)&&(console.error(`[DfFormPreview] Duplicate component ID detected: ${A.id}`),A.id=`${A.id}-duplicate-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,console.warn(`[DfFormPreview] Generated new unique ID: ${A.id}`));else{const t=A.name||"component",r=(A.basic?.label||"").replace(/[^a-zA-Z0-9]/g,"").toLowerCase().substring(0,10);A.id=`${t}-${r||"gen"}-${Date.now()}-${Math.random().toString(36).substr(2,6)}-${e}`,console.warn(`[DfFormPreview] Assigned missing ID: ${A.id}`)}return r.add(A.id),A.children&&Array.isArray(A.children)&&(A.children=s(A.children)),A.cells&&Array.isArray(A.cells)&&(A.cells=A.cells.map(t=>Array.isArray(t)?t.map(t=>t&&t.components&&Array.isArray(t.components)?{...t,components:s(t.components)}:t):t)),A.entries&&Array.isArray(A.entries)&&(A.entries=A.entries.map(t=>t&&t.components&&Array.isArray(t.components)?{...t,components:s(t.components)}:t)),A});let a=i;i&&i.length>0&&(a=s(i),JSON.stringify(a)!==JSON.stringify(i)&&c?.(a));let l=o;o&&o.length>0&&(l=s(o)),l&&l.length>0&&z(l,t),a&&a.length>0&&(z(a,t),n(a)),Q(e=>({...t,...e})),R(t=>({...e,...t})),V(t=>({...A,...t})),W()},[o,i]),q=(t,e)=>{t.forEach(t=>{if(t.id)if("table"===t.name||"datagrid"===t.name)e[t.id]=!0;else if(t.conditional){const A=J.evaluateConditionalLogic(t.conditional,i,F);e[t.id]=A.shouldShow}else e[t.id]=!0;t.cells&&Array.isArray(t.cells)&&t.cells.forEach(t=>{t.forEach(t=>{t.components&&Array.isArray(t.components)&&q(t.components,e)})}),t.entries&&Array.isArray(t.entries)&&t.entries.forEach(t=>{t.components&&Array.isArray(t.components)&&q(t.components,e)}),t.children&&Array.isArray(t.children)&&q(t.children,e)})},W=r(()=>{const t={};i&&i.length>0&&q(i,t),k(t)},[i,F]),Y=r(t=>{const e=i.find(e=>e.id===t);if(e&&("table"===e.name||"datagrid"===e.name))return!0;return!1!==_[t]},[_,i]),Z=r(t=>{if(!t.id||"string"!=typeof t.id||""===t.id.trim())return void console.error("[DfFormPreview] Invalid component ID in onFormValueChange:",t);const e=i.filter(e=>e.id===t.id);if(e.length>1)return void console.error(`[DfFormPreview] ID COLLISION DETECTED! Multiple components share ID "${t.id}":`,e.map(t=>({id:t.id,name:t.name,label:t.basic?.label})));const A=F[t.id];void 0!==A&&A!==t.value&&console.log("[DfFormPreview] Updating form value:",{id:t.id,oldValue:A,newValue:t.value});const r={...F,[t.id]:t.value};Q(r);const n=i.find(e=>e.id===t.id);if(n){const t=n?.threshold;t&&t.conditions&&t.conditions.length>0&&H(e=>{const A=new Set(e);return t.conditions.forEach(t=>{A.delete(t.id)}),A})}const s=e=>e.map(e=>e.id===t.id&&"defaultValue"in e.basic?{...e,basic:{...e.basic,value:t.value??e.basic.defaultValue,defaultValue:t.value}}:"section"===e.name&&e.children?{...e,children:s(e.children)}:"table"===e.name&&e.cells?{...e,cells:e.cells.map(t=>t.map(t=>{const e={...t};return e.components&&(e.components=s(e.components)),e}))}:"datagrid"===e.name&&e.entries?{...e,entries:e.entries.map(t=>{const e={...t};return e.components&&(e.components=s(e.components)),e})}:e),o=s(i);if(c?.(o),U[t.id]&&E(e=>({...e,[t.id]:""})),!a){if(t.isValid)return void E(e=>{const A=e[t.id];return A&&""!==A.trim()?{...e,[t.id]:""}:e});setTimeout(()=>{et(t.id)},150)}setTimeout(()=>{const t={};i.forEach(e=>{if("table"===e.name||"datagrid"===e.name)t[e.id]=!0;else if(e.conditional){const A=J.evaluateConditionalLogic(e.conditional,i,r);t[e.id]=A.shouldShow}else t[e.id]=!0}),k(t)},0)},[i,F,U,c]),tt=r((t,e)=>{for(const A of t){if(A.id===e)return A;if("section"===A.name&&A.children){const t=tt(A.children,e);if(t)return t}if("table"===A.name&&A.cells)for(const t of A.cells)for(const A of t)if(A.components){const t=tt(A.components,e);if(t)return t}if("datagrid"===A.name&&A.entries)for(const t of A.entries)if(t.components){const A=tt(t.components,e);if(A)return A}}return null},[]),et=r(t=>{if(a)return;const e=tt(i,t);if(!e)return;const A=F[t]||"";if("number-input"===e.name&&(!A||""===A)){if(e.validation.required){const A=e.validation.customValidationMessage,r=e.basic.label||"This field",n=A||`${r} is required`;E(e=>({...e,[t]:n}))}else E(e=>({...e,[t]:""}));return}let r=!1;r=Array.isArray(A)?A.length>0:"string"==typeof A?""!==A.trim():null!=A;let n="";if(e.validation.required&&!r){const t=e.validation.customValidationMessage,A=e.basic.label||"This field";n=t||`${A} is required`}else if("email-input"===e.name&&r&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(A)){const t=e.validation.customValidationMessage,A=e.basic.label||"This field";n=t||`${A} must be a valid email`}else if(e.validation.minLength&&r&&A.length<e.validation.minLength){const t=e.validation.customValidationMessage,A=e.basic.label||"This field";n=t||`${A} must be at least ${e.validation.minLength} characters`}else if(e.validation.maxLength&&r&&A.length>e.validation.maxLength){const t=e.validation.customValidationMessage,A=e.basic.label||"This field";n=t||`${A} must be no more than ${e.validation.maxLength} characters`}else if("number-input"===e.name&&r){const t=String(A).trim(),r=parseFloat(t);if(!isNaN(r)){const t=e.validation;t&&"lowerLimit"in t&&void 0!==t.lowerLimit&&null!==t.lowerLimit&&0!==t.lowerLimit&&r<t.lowerLimit?n="Number is below the lower limit":t&&"upperLimit"in t&&void 0!==t.upperLimit&&null!==t.upperLimit&&0!==t.upperLimit&&r>t.upperLimit&&(n="Number is above the upper limit")}}E(e=>({...e,[t]:n}))},[i,a,F,tt]),At=r(t=>{I(e=>({...e,[t]:!0})),a||setTimeout(()=>{et(t)},0)},[a,et]),rt=r(t=>{U[t]&&E(e=>({...e,[t]:""}))},[U]),gt=r(()=>!Object.values(U).some(t=>t&&"string"==typeof t&&""!==t.trim())&&i.every(t=>{const e=F[t.id]||"";let A=!1;if(A=Array.isArray(e)?e.length>0:"string"==typeof e?""!==e.trim():null!=e,t.validation.required&&!A)return!1;if("number-input"===t.name&&A){const A=String(e).trim(),r=parseFloat(A);if(!isNaN(r)){const e=t.validation;if(e&&"lowerLimit"in e&&void 0!==e.lowerLimit&&null!==e.lowerLimit&&0!==e.lowerLimit&&r<e.lowerLimit)return!1;if(e&&"upperLimit"in e&&void 0!==e.upperLimit&&null!==e.upperLimit&&0!==e.upperLimit&&r>e.upperLimit)return!1}}return!0}),[i,F,U]),wt=r((t,e)=>{if(Array.isArray(e))return e.some(e=>wt(t,e));if(null==e||""===e)return!1;const A="string"==typeof e?parseFloat(e):e,r="string"==typeof t.value?parseFloat(t.value):t.value;if(!isNaN(A)&&!isNaN(r))switch(t.operator){case"greaterThan":return A>r;case"lessThan":return A<r;case"greaterThanOrEqual":return A>=r;case"lessThanOrEqual":return A<=r;case"equals":return A===r;case"notEquals":return A!==r;default:return!1}const n=String(e).toLowerCase(),i=String(t.value).toLowerCase();switch(t.operator){case"equals":return n===i||String(e)===String(t.value);case"notEquals":return n!==i&&String(e)!==String(t.value);default:return!1}},[]),yt=r(()=>{if(a)return[];const t=[];return i.forEach(e=>{const A=e?.condition;if(!A||!A.conditions||0===A.conditions.length)return;const r=F[e.id];null!=r&&""!==r&&!(Array.isArray(r)&&0===r.length)&&A.conditions.forEach(A=>{wt(A,r)&&t.push({componentId:e.id,condition:A,componentLabel:e.basic?.label||"Field"})})}),t},[i,F,a,wt]),bt=r(()=>{if(a)return{isValid:!0};const t=yt();if(0===t.length)return{isValid:!0};for(const{condition:e,componentLabel:A}of t){const t=O.get(e.id)||{notesCompleted:!1,attachmentsCompleted:!1,emailSent:!1},r=[];if(!0!==e.enableRaiseIssue||T.has(e.id)||r.push("raise an issue"),!0!==e.enableNotes||t.notesCompleted||r.push("add notes"),!0!==e.enableAttachment||t.attachmentsCompleted||r.push("add attachments"),!0!==e.enableSendEmail||t.emailSent||r.push("send email"),r.length>0){return{isValid:!1,errorMessage:`Please ${1===r.length?r[0]:r.slice(0,-1).join(", ")+" and "+r[r.length-1]} for the threshold condition met in "${A}". You cannot submit the form until all required actions are completed.`}}}return{isValid:!0}},[a,yt,T,O]),vt=r(t=>{t&&H(e=>{const A=new Set(e);return A.add(t),A})},[]),xt=r((t,e,A)=>{t&&P(r=>{const n=new Map(r),i=n.get(t)||{notesCompleted:!1,attachmentsCompleted:!1,emailSent:!1};return"notes"===e?n.set(t,{...i,notesCompleted:A}):"attachments"===e?n.set(t,{...i,attachmentsCompleted:A}):"email"===e&&n.set(t,{...i,emailSent:A}),n})},[]);A(()=>{if(!a){const t=bt();M(t)}},[F,T,O,a,bt]);const Ut=r(()=>{if(a)return!0;let t=!0;S(!0);const e={};return i.forEach(A=>{const r=F[A.id]||"";let n=!1;if(n=Array.isArray(r)?r.length>0:"string"==typeof r?""!==r.trim():null!=r,A.validation.required&&!n){const r=A.validation.customValidationMessage,n=A.basic.label||"This field",i=r||`${n} is required`;e[A.id]=i,t=!1}else if("number-input"===A.name&&n){const n=String(r).trim(),i=parseFloat(n);if(isNaN(i))e[A.id]="";else{const r=A.validation;r&&"lowerLimit"in r&&void 0!==r.lowerLimit&&null!==r.lowerLimit&&0!==r.lowerLimit&&i<r.lowerLimit?(e[A.id]="Number is below the lower limit",t=!1):r&&"upperLimit"in r&&void 0!==r.upperLimit&&null!==r.upperLimit&&0!==r.upperLimit&&i>r.upperLimit?(e[A.id]="Number is above the upper limit",t=!1):e[A.id]=""}}else e[A.id]="";I(t=>({...t,[A.id]:!0}))}),E(e),t},[i,a,F]),Et=r((t="Submitted")=>{if(S(!0),!Ut()){const t=i.find(t=>{const e=F[t.id]||"";let A=!1;return A=Array.isArray(e)?e.length>0:"string"==typeof e?""!==e.trim():null!=e,t.validation.required&&!A});if(t){const e=document.getElementById(t.id);e&&e.focus()}return}const e=bt();if(!e.isValid){e.errorMessage&&$.showError(e.errorMessage);const t=yt().find(({condition:t})=>!T.has(t.id));if(t){const e=document.getElementById(t.componentId);e&&e.scrollIntoView({behavior:"smooth",block:"center"})}return}const A=t=>t.map(t=>{let e=F[t.id];"text-input"===t.name&&t.basic,void 0===e&&(e="value"in t.basic&&void 0!==t.basic.value?t.basic.value:"defaultValue"in t.basic&&void 0!==t.basic.defaultValue?t.basic.defaultValue:""),"text-input"===t.name&&t.basic;const r={...t,basic:{...t.basic,value:e,defaultValue:e,notes:void 0!==j[t.id]?j[t.id]:t.basic?.notes,comments:void 0!==j[t.id]?j[t.id]:t.basic?.comments||t.basic?.notes,attachments:void 0!==K[t.id]?K[t.id]:t.basic?.attachments}};return"section"===r.name&&r.children&&(r.children=A(r.children)),"table"===r.name&&r.cells&&(r.cells=r.cells.map(t=>t.map(t=>{const e={...t};return e.components&&(e.components=A(e.components)),e}))),"datagrid"===r.name&&r.entries&&(r.entries=r.entries.map(t=>{const e={...t};return e.components&&(e.components=A(e.components)),e})),r}),r=A(i),n={...F,status:t};l?.(r,n)},[i,F,Ut,l,j,K]),Nt=r(()=>({[`device-${s}`]:!0,readonly:a}),[s,a]),St=r((t,e)=>{R(A=>({...A,[t]:e}))},[]),Lt=r((t,e)=>{V(A=>({...A,[t]:e||[]}))},[]),It=n(new Map),_t=n(0),kt=e=>{let A;if(e.id&&"string"==typeof e.id&&""!==e.id.trim())A=e.id;else{const t=e.basic?.label||"",r=e.name||"unknown",n=`${r}-${t}`;let i=It.current.get(n);i||(_t.current+=1,i=`generated-${r}-${_t.current}-${Math.random().toString(36).substr(2,9)}`,It.current.set(n,i),console.warn("[DfFormPreview] Generated and cached ID for component:",i,"key:",n)),A=i,e={...e,id:A}}const r=A,n=F[r];if(void 0!==n){const t=i.filter(t=>t.id!==r&&F[t.id]===n);t.length>0&&console.warn(`[DfFormPreview] Component ${r} shares form value with other components:`,t.map(t=>t.id))}const s={id:r,validationErrors:U,formValue:n,touchedFields:L,formSubmitted:N,mode:"test",readonly:!1,onValueChange:Z,onBlur:()=>At(r),onFocus:()=>rt(r)};switch(e.name){case"text-input":case"number-input":case"email-input":return X.jsx(nt,{...s,properties:e,inputType:"text-input"===e.name?"text":"number-input"===e.name?"number":"email",formTemplateId:d,onThresholdIssueRaised:vt,raisedThresholdIssues:T,workOrderNumber:B,assetNumber:y,user:v});case"textarea":return X.jsx(it,{...s,properties:e});case"select":const A={...e,options:e.basic?.options||[],basic:{...e.basic,comments:e.basic?.comments||""}};return X.jsx(st,{...s,properties:A});case"checkbox":const r={...e,options:e.basic?.options||[],basic:{...e.basic,comments:e.basic?.comments||""}};return X.jsx(at,{...s,properties:r});case"radio":const a={...e,options:e.basic?.options||[],basic:{...e.basic,comments:e.basic?.comments||""}};return X.jsx(ot,{...s,properties:a});case"segment":const o={...e,options:e.basic?.options||[],basic:{...e.basic,comments:e.basic?.comments||""}};return X.jsx(lt,{...s,properties:o});case"date":case"date-picker":case"datetime-picker":return X.jsx(ct,{...s,properties:e});case"signature":return X.jsx(ut,{...s,properties:e});case"heading":return X.jsx(ft,{...s,properties:e});case"instructions":const l=n||e.basic?.value||null;return X.jsx(pt,{...s,properties:e,formValue:l});case"location":return X.jsx(dt,{...s,properties:e});case"section":return X.jsx(Ft,{...s,properties:e,formData:F,formTemplateId:d,onThresholdActionCompletion:xt,onThresholdIssueRaised:vt,onNotesChange:St,onAttachmentChange:Lt,workOrderNumber:B,assetNumber:y,user:v,onCreateIssue:C,onUpdateIssue:x,renderFormComponent:t=>kt(t)});case"table":return X.jsx(t.Suspense,{fallback:X.jsx("div",{children:"Loading table..."}),children:X.jsx(Qt,{...s,properties:e,formData:F,formTemplateId:d,mode:s.mode,validationErrors:U,touchedFields:L,formSubmitted:N,onThresholdActionCompletion:xt,onThresholdIssueRaised:vt,workOrderNumber:B,assetNumber:y,onCreateIssue:C,onUpdateIssue:x,onNotesChange:(t,A)=>{const r=i.map(r=>{if(r.id===e.id&&r.cells){const e=r.cells.map(e=>e.map(e=>{if(e.components){const r=e.components.map(e=>e.id===t?{...e,basic:{...e.basic,notes:A}}:e);return{...e,components:r}}return e}));return{...r,cells:e}}return r});c?.(r)},onAttachmentChange:(t,A)=>{const r=i.map(r=>{if(r.id===e.id&&r.cells){const e=r.cells.map(e=>e.map(e=>{if(e.components){const r=e.components.map(e=>e.id===t?{...e,basic:{...e.basic,attachments:A||[]}}:e);return{...e,components:r}}return e}));return{...r,cells:e}}return r});c?.(r)},renderFormComponent:t=>kt(t)})});case"datagrid":return X.jsx(Ct,{...s,properties:e,formData:F,formTemplateId:d,mode:s.mode,validationErrors:U,touchedFields:L,formSubmitted:N,onThresholdActionCompletion:xt,onThresholdIssueRaised:vt,workOrderNumber:B,assetNumber:y,user:v,onComponentSelect:f,onComponentDelete:p,onComponentEdit:g,onCreateIssue:C,onUpdateIssue:x,onComponentUpdate:m,selectedComponent:w,onNotesChange:(t,A)=>{St(t,A);const r=i.map(r=>{if(r.id===e.id&&r.entries){const e=r.entries.map(e=>{if(e.components){const r=e.components.map(e=>e.id===t?{...e,basic:{...e.basic,notes:A||""}}:e);return{...e,components:r}}return e});return{...r,entries:e}}return r});c?.(r)},onAttachmentChange:(t,A)=>{Lt(t,A);const r=i.map(r=>{if(r.id===e.id&&r.entries){const e=r.entries.map(e=>{if(e.components){const r=e.components.map(e=>e.id===t?{...e,basic:{...e.basic,attachments:A||[]}}:e);return{...e,components:r}}return e});return{...r,entries:e}}return r});c?.(r)},onValueChange:t=>{if(t.id===e.id&&t.value&&"object"==typeof t.value&&"entries"in t.value){const A=i.map(A=>A.id===e.id?{...A,...t.value}:A);c?.(A),t.value.entries&&Array.isArray(t.value.entries)&&t.value.entries.forEach(t=>{t.components&&Array.isArray(t.components)&&t.components.forEach(t=>{if(void 0!==F[t.id]);else{const e=t.basic?.defaultValue;void 0!==e&&Q(A=>({...A,[t.id]:e}))}})})}else Z(t)},onEntryAdd:()=>{const t=i.find(t=>t.id===e.id);if(t&&t.entries){const t=i.map(t=>t.id===e.id?{...t,entries:t.entries||[]}:t);c?.(t)}else setTimeout(()=>{const t=F[e.id];if(t&&"object"==typeof t&&"entries"in t){const A=i.map(A=>A.id===e.id?{...A,entries:t.entries}:A);c?.(A)}},100)},onEntryRemove:t=>{const A=i.map(A=>{if(A.id===e.id&&A.entries){const e=(A.entries||[]).filter((e,A)=>A!==t).map((t,e)=>({...t,index:e,id:`entry-${A.id}-${e}`,components:t.components?.map((t,A)=>{const r=(t.templateComponents||[])[A];return{...t,id:r?`${r.id}-entry-${e}-${A}`:t.id}})||[]}));return{...A,entries:e}}return A});c?.(A)},renderFormComponent:t=>kt(t)});case"file":const u=n||e.basic?.value||e.basic?.files||e.basic?.attachments||null;return X.jsx(ht,{...s,properties:e,formValue:u});default:return X.jsx("div",{className:"form-group",children:X.jsxs("div",{className:"form-group-label",children:["Unsupported Component: ",e.name]})})}};return X.jsx("div",{className:"form-preview-container",children:X.jsx("div",{className:"form-preview-wrapper",children:X.jsxs("div",{className:`form-preview ${Object.entries(Nt()).map(([t,e])=>e?t:"").join(" ")}`,children:[X.jsx("div",{className:"form-canvas-header"}),0===i.length?X.jsx("div",{className:"empty-state",children:X.jsx("div",{className:"empty-state-card",children:X.jsx("div",{className:"empty-state-preview-area",children:X.jsx("span",{className:"empty-state-placeholder",children:"Add components to see the form preview"})})})}):X.jsxs("form",{className:"form-preview-form",onSubmit:t=>{t.preventDefault(),Et()},children:[(u||h)&&X.jsxs("div",{className:"form-header",children:[u&&X.jsx("h1",{className:"form-title",children:u}),h&&X.jsx("p",{className:"form-description",children:h})]}),i.map(t=>{const e=t.basic,A=F[t.id],r=["select","radio","checkbox","segment"].includes(t.name||""),n=t.options||e?.options||[],s=(()=>{const e=t?.styles?.column;return"section"===t.name||"table"===t.name||"datagrid"===t.name?"col-12":3===e?"col-3":6===e?"col-6":9===e?"col-9":"col-12"})();let o=!1;if(!a)if(r&&null!=A&&""!==A)if("checkbox"===t.name){o=(Array.isArray(A)?A:[A]).some(t=>{const e=n.find(e=>e.value===t);return e&&(e.enableNotes||e.enableAttachment||e.enableRaiseIssue||e.enableSendEmail)})}else{const t=n.find(t=>t.value===A);o=t&&(t.enableNotes||t.enableAttachment||t.enableRaiseIssue||t.enableSendEmail)}else o=e?.enableNotes||e?.enableAttachment||e?.enableRaiseIssue||e?.enableSendEmail;const l=a&&(t.basic?.notes&&t.basic.notes.trim().length>0||t.basic?.attachments&&Array.isArray(t.basic.attachments)&&t.basic.attachments.length>0);return X.jsxs("div",{className:`form-group ${s} ${o||l?"has-action-features":""}`,style:{display:Y(t.id)?"block":"none"},children:[kt(t),!a&&!["section","table","heading","file","instructions","signature","location","datagrid"].includes(t.name)&&X.jsx(mt,{component:t,mode:a?"preview":"test",formTemplateId:d,formValue:A,onThresholdActionCompletion:xt,onThresholdIssueRaised:vt,onNotesChange:e=>{R(A=>({...A,[t.id]:e}));const A=i.map(A=>A.id===t.id?{...A,basic:{...A.basic,notes:e||""}}:A);c?.(A)},onAttachmentChange:e=>{V(A=>({...A,[t.id]:e||[]}));const A=i.map(A=>A.id===t.id?{...A,basic:{...A.basic,attachments:e||[]}}:A);c?.(A)},notes:void 0!==j[t.id]?j[t.id]:t.basic?.notes||"",attachments:void 0!==K[t.id]?K[t.id]:t.basic?.attachments||null,workOrderNumber:B,assetNumber:y,isStandalone:b,user:v,onCreateIssue:C,onUpdateIssue:x}),a&&l&&X.jsx(Bt,{component:t})]},t.id)}),!a&&X.jsxs("div",{className:"form-actions",children:[X.jsx("button",{type:"button",onClick:()=>Et("Saved"),className:"form-save-button",disabled:N&&!gt(),children:"Save"}),X.jsx("button",{type:"button",disabled:!gt()||!D.isValid,className:"form-submit-button",title:D.isValid?"":D.errorMessage,onClick:()=>Et("Submitted"),children:"Submit"})]})]})]})})})},Et=({comment:t="",onSave:n,placeholder:i="Enter your reason...",className:s="",disabled:a=!1})=>{const[o,l]=e(!0),[c,u]=e(t),[h,d]=e(!1);A(()=>{u(t),d(!1)},[t]);const f=r(e=>{const A=e.target.value;u(A),d(A!==t)},[t]),p=r(()=>{h&&n&&!a&&(n(c),d(!1))},[h,n,c,a]),g=r(()=>{},[]),m=r(()=>{a||l(!o)},[o,a]);return X.jsxs("div",{className:`df-form-comments ${s}`,children:[X.jsxs("div",{className:"df-form-comments__header",children:[X.jsx("h3",{className:"df-form-comments__title",children:"Comments"}),X.jsx("button",{className:"df-form-comments__toggle",type:"button",onClick:m,"aria-expanded":o,"aria-label":"Toggle comments section",disabled:a,children:o?X.jsx("span",{className:"df-form-comments__toggle-icon",children:"▼"}):X.jsx("span",{className:"df-form-comments__toggle-icon",children:"▶"})})]}),X.jsx("div",{className:"df-form-comments__content "+(o?"df-form-comments__content--expanded":""),children:X.jsx("div",{className:"df-form-comments__input-container",children:X.jsx("div",{className:"df-form-comments__input-line",children:X.jsx("input",{type:"text",id:"comment-input",className:"df-form-comments__input",value:c,onChange:f,onBlur:p,onFocus:g,placeholder:i,disabled:a})})})})]})},Nt=t=>t.id?t:{...t,id:M()},St=({component:t,mode:e,renderFormComponent:A,formData:r={},formTemplateId:n,onThresholdActionCompletion:i,onThresholdIssueRaised:s,onNotesChange:a,onAttachmentChange:o,workOrderNumber:l,assetNumber:c,user:u,onCreateIssue:h,onUpdateIssue:d})=>{const f=r[t.id],p="preview"===e&&(t.basic?.notes&&t.basic.notes.trim().length>0||t.basic?.attachments&&Array.isArray(t.basic.attachments)&&t.basic.attachments.length>0);return X.jsxs("div",{className:"simple-table-component",children:[A(t),!["section","table","heading","file","instructions","signature","location","datagrid"].includes(t.name)&&X.jsx(mt,{component:t,mode:"test",formTemplateId:n,formValue:f,formData:r,onThresholdActionCompletion:i,onThresholdIssueRaised:s,onNotesChange:a?e=>a(t.id,e):void 0,onAttachmentChange:o?e=>o(t.id,e):void 0,workOrderNumber:l,assetNumber:c,user:u,onCreateIssue:h,onUpdateIssue:d}),p&&X.jsx(Bt,{component:t})]})},Lt=({component:t,selectedComponent:e,mode:A,onComponentSelect:r,onComponentDelete:n,onComponentEdit:i,renderFormComponent:s,isOverlay:a=!1})=>{const{attributes:o,listeners:l,setNodeRef:c,transform:u,transition:h,isDragging:d,isSorting:f}=O({id:t.id,disabled:a}),p={transform:D.Transform.toString(u),transition:h,opacity:d?.3:1,zIndex:d?1e3:"auto"};return X.jsxs("div",{ref:c,style:p,className:`form-component table-component ${e?.id===t.id?"selected":""} ${d?"dragging":""} ${f?"sorting":""}`,onClick:()=>!d&&r(t),role:"button",tabIndex:0,children:["edit"===A&&X.jsx("div",{className:"component-drag-handle",...l,...o,onClick:t=>t.stopPropagation(),style:{opacity:1},children:X.jsx(E,{size:14})}),X.jsx("div",{className:"component-content",children:s(t)}),"edit"===A&&X.jsxs("div",{className:"component-actions",style:{opacity:1},children:[i&&X.jsx("button",{className:"component-edit-btn",onClick:e=>{e.stopPropagation(),i(t)},type:"button",title:"Edit Component",children:X.jsx(N,{size:12})}),X.jsx("button",{className:"component-delete-btn",onClick:e=>{e.stopPropagation(),n(t,e)},type:"button",title:"Delete Component",children:X.jsx(S,{size:12})})]})]})},It=({cell:t,mode:e,onComponentSelect:A,onComponentDelete:r,onComponentEdit:n,selectedComponent:i,renderFormComponent:s,formData:a={},formTemplateId:o,onThresholdActionCompletion:l,onThresholdIssueRaised:c,tableId:u,onNotesChange:h,onAttachmentChange:d,workOrderNumber:f,assetNumber:p,user:g,onCreateIssue:m,onUpdateIssue:w})=>{const B=`table-cell-${u}-${t.row}-${t.column}`,{setNodeRef:y,isOver:b}=k({id:B,disabled:"edit"!==e,data:{type:"table-cell",tableId:u,cell:t,row:t.row,column:t.column}}),v={...t.styles,backgroundColor:b?"var(--df-color-primary-light)":t.styles?.backgroundColor||"transparent",minHeight:t.styles?.minHeight||"preview"===e||"test"===e?"40px":"60px",padding:(t.styles,"8px"),border:"preview"===e||"test"===e?"none":b?"2px dashed var(--df-color-primary)":t.styles?.borderColor?`1px solid ${t.styles.borderColor}`:"1px solid var(--df-color-fb-border)",borderRadius:"preview"===e||"test"===e?"0":"4px",position:"relative",verticalAlign:t.styles?.verticalAlign||"top"};return X.jsx("td",{ref:y,style:v,className:"table-cell "+(b?"drag-over":""),children:X.jsx("div",{className:"cell-content",children:t.components&&Array.isArray(t.components)&&t.components.length>0?"edit"===e?X.jsx(T,{items:t.components.map(t=>t.id||M()),strategy:P,children:t.components.map(t=>{const a=Nt(t);return X.jsx(Lt,{component:a,selectedComponent:i,mode:e,onComponentSelect:A,onComponentDelete:r,onComponentEdit:n,renderFormComponent:s},a.id)})}):t.components.map(t=>{const A=t.id?t:Nt(t);return X.jsx(St,{component:A,mode:e,renderFormComponent:s,formData:a,formTemplateId:o,onThresholdActionCompletion:l,onThresholdIssueRaised:c,onNotesChange:h,onAttachmentChange:d,workOrderNumber:f,assetNumber:p,user:g,onCreateIssue:m,onUpdateIssue:w},A.id)}):"edit"===e?X.jsx("div",{className:"empty-cell-placeholder",children:X.jsxs("div",{className:"cell-info",children:[X.jsx("span",{className:"drop-zone-text",children:"Drag and Drop a form component"}),X.jsxs("span",{className:"cell-coordinates",children:["Cell (",t.row+1,", ",t.column+1,")"]})]})}):X.jsx("div",{style:{minHeight:"20px",backgroundColor:"transparent",visibility:"hidden"},children:" "})})})},_t=({id:t,properties:n,mode:s="edit",formData:a={},validationErrors:o={},touchedFields:l={},formSubmitted:c=!1,onValueChange:u,onSelect:h,isSelected:d=!1,className:f="",onTableSelect:p,onComponentSelect:g,onComponentDelete:m,onComponentEdit:w,selectedComponent:B,renderFormComponent:y,formTemplateId:b,onThresholdActionCompletion:v,onThresholdIssueRaised:C,onNotesChange:x,onAttachmentChange:U,workOrderNumber:E,assetNumber:N,user:S,onCreateIssue:I,onUpdateIssue:_})=>{const[k,T]=e(!1),H=n.cells?.some(t=>t.some(t=>t.components&&t.components.length>0))||!1;A(()=>{},[n.table?.rows,n.table?.columns,n.basic?.rows,n.basic?.columns,n.cells,t,u]);const O=r(t=>{t.stopPropagation(),h?.(),p?.(n)},[h,p,n]),P=r((e,A)=>{A.stopPropagation();const r=n.cells.map(t=>t.map(t=>{if(t.components&&t.components.some(t=>t.id===e.id)){const A=t.components.filter(t=>t.id!==e.id);return{...t,components:A}}return t}));u&&u({id:t,value:{...n,cells:r}})},[m,n,u,t]),D=i(()=>n.cells?n.cells.map((e,A)=>e.map((e,r)=>({...e,components:e.components&&Array.isArray(e.components)?e.components.map((e,n)=>{if(e.id&&"string"==typeof e.id&&""!==e.id.trim())return e;const i=`${e.name||"component"}-table-${t}-row-${A}-cell-${r}-comp-${n}`;return{...e,id:i}}):[]}))):[],[n.cells,t]),M=y||r(t=>{const e=t.id?t:Nt(t),A=a[e.id]||"defaultValue"in e.basic&&e.basic.defaultValue||"";let r=A;"number-input"===e.name&&"number"==typeof A?r=String(A):"number-input"===e.name&&null==A&&(r="");const n={id:e.id,properties:e,validationErrors:{},formValue:r,touchedFields:{},formSubmitted:!1,mode:s,onValueChange:t=>{u?.(t)},onBlur:()=>{},onFocus:()=>{}};switch(e.name){case"text-input":case"email-input":case"number-input":return X.jsx(nt,{...n,properties:e,inputType:"text-input"===e.name?"text":"number-input"===e.name?"number":"email",readonly:!1,disabled:!1});case"textarea":return X.jsx(it,{...n,properties:e,readonly:!1,disabled:!1});case"select":const t={...e,options:e.basic?.options||[]};return X.jsx(st,{...n,properties:t,disabled:!1});case"checkbox":const A={...e,options:e.basic?.options||[]};return X.jsx(at,{...n,properties:A,formValue:[],disabled:!1});case"radio":const r={...e,options:e.basic?.options||[]};return X.jsx(ot,{...n,properties:r,readonly:!1,disabled:!1});case"date":case"date-picker":case"datetime-picker":return X.jsx(ct,{...n,properties:e,readonly:!1,disabled:!1});case"signature":return X.jsx(ut,{...n,properties:e});case"heading":return X.jsx(ft,{...n,properties:e});case"instructions":return X.jsx(pt,{...n,properties:e});case"location":return X.jsx(dt,{...n,properties:e});case"datagrid":return X.jsx(Ct,{...n,properties:e,formData:a,mode:s,onNotesChange:()=>{},onAttachmentChange:()=>{}});case"segment":const i={...e,options:e.basic?.options||[]};return X.jsx(lt,{...n,properties:i});default:return X.jsxs("div",{className:"unknown-component",children:["Unknown component: ",e.name]})}},[y,s,a,u]),j={backgroundColor:n.styles?.backgroundColor||"var(--df-color-fb-container)",borderColor:n.styles?.borderColor||"var(--df-color-fb-border)",borderWidth:n.styles?.borderWidth||"2px",borderRadius:n.styles?.borderRadius||"8px",padding:n.styles?.padding||"16px",margin:n.styles?.margin||"16px 0"},R={width:"100%",minWidth:"600px",borderCollapse:"preview"===s||"test"===s?"separate":"collapse",tableLayout:"fixed",border:"preview"===s||"test"===s?"1px solid var(--df-color-fb-border)":"none"};return H||"preview"!==s?X.jsxs("div",{className:`form-group df-form-table ${d?"selected":""} ${"preview"===s?"preview-mode":"test"===s?"test-mode":""} ${f}`,onClick:O,style:j,children:[X.jsx("div",{className:"table-header",children:X.jsx("div",{className:"table-title",onClick:e=>{e.stopPropagation(),T(!k),u?.({id:t,value:{...n,basic:{...n.basic||{},collapsed:!k}}})},children:X.jsxs("div",{className:"title-content",children:[k?X.jsx(Q,{size:16}):X.jsx(F,{size:16}),X.jsx(L,{size:16}),X.jsx("span",{className:"table-label",children:n.basic?.label||"Table"}),n.validation?.required&&X.jsx("span",{className:"required-indicator",children:"*"})]})})}),n.basic?.description&&!k&&X.jsx("div",{className:"table-description",children:n.basic.description}),!k&&X.jsxs("div",{className:"table-content",children:[null,X.jsxs("table",{style:R,children:[n.table?.displayAsTable&&("edit"===s||n.table?.showColumns)&&X.jsx("thead",{children:X.jsx("tr",{className:"table-header-row",children:Array.from({length:n.table?.columns||n.basic?.columns||3},(t,e)=>{const A=(n.table?.columnNames?.split(",").map(t=>t.trim())||[])[e]||`Column ${e+1}`;return X.jsx("th",{className:"table-header-cell",style:{backgroundColor:(n.styles.headerBackgroundColor,"var(--df-color-fb-container)"),color:n.styles.headerTextColor||"var(--df-color-text-dark)",padding:"12px",border:"1px solid var(--df-color-fb-border)",fontWeight:"600",fontSize:"14px",textAlign:"center"},children:A},`header-${e}`)})})}),X.jsx("tbody",{children:D.map((e,A)=>X.jsx("tr",{className:"table-row",children:e.map(e=>X.jsx(It,{cell:e,mode:s,onComponentSelect:g||(()=>{}),onComponentDelete:P,onComponentEdit:w,selectedComponent:B||null,renderFormComponent:M,formData:a,formTemplateId:b,onThresholdActionCompletion:v,onThresholdIssueRaised:C,tableId:t,onNotesChange:x,onAttachmentChange:U,workOrderNumber:E,assetNumber:N,user:S,onCreateIssue:I,onUpdateIssue:_},e.id))},A))})]})]})]}):null};var kt=Object.freeze({__proto__:null,DfFormTable:_t,default:_t});const Tt={page:{fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif',padding:"30px",backgroundColor:"#ffffff",color:"#000000",lineHeight:"1.4"},header:{marginBottom:"30px",paddingBottom:"15px",borderBottom:"2px solid #303992",display:"flex",justifyContent:"space-between",alignItems:"flex-end"},title:{margin:"0 0 5px 0",fontSize:"24px",fontWeight:"bold",color:"#303992"},description:{margin:"0",fontSize:"14px",color:"#666666"},submittedBy:{fontSize:"14px",color:"#333",textAlign:"right",whiteSpace:"nowrap",marginBottom:"2px"},formGroup:{marginBottom:"20px",breakInside:"avoid"},label:{fontWeight:"400",display:"block",marginBottom:"8px",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif',fontSize:"14px",lineHeight:"1.5",fontColor:"var(--df-color-text-dark)"},labelLeft:{fontWeight:"400",display:"block",marginRight:"10px",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif',fontSize:"14px",lineHeight:"1.5",width:"60%",fontColor:"var(--df-color-text-dark)"},valueContainer:{border:"1px solid #e2e8f0",borderRadius:"6px",padding:"8px 12px",backgroundColor:"#ffffff",minHeight:"20px",fontSize:"14px",flex:1},value:{fontSize:"14px",color:"#000000"},gridRow:{display:"flex",flexWrap:"wrap",gap:"16px",marginBottom:"20px"},gridCol:t=>({flex:`0 0 calc(${t/12*100}% - 8px)`,minWidth:"0"}),img:{maxWidth:"100%",maxHeight:"300px",border:"1px solid #ddd",borderRadius:"4px",display:"block",marginTop:"5px"},table:{width:"100%",borderCollapse:"collapse",border:"1px solid #ddd",marginTop:"10px",tableLayout:"fixed"},th:{border:"1px solid #ddd",padding:"8px",backgroundColor:"#f5f5f5",fontWeight:"bold",textAlign:"left",fontSize:"13px"},td:{border:"1px solid #ddd",padding:"8px",fontSize:"13px",verticalAlign:"top"},section:{marginBottom:"25px",breakInside:"avoid"},sectionHeader:{fontSize:"18px",marginBottom:"15px",display:"block",fontWeight:"600"},sectionChildren:{marginLeft:"20px",paddingLeft:"20px",borderLeft:"2px solid #3b82f6",marginTop:"15px"},notesSection:{marginTop:"10px",padding:"10px",backgroundColor:"rgba(48, 57, 146, 0.05)",borderLeft:"3px solid #303992",borderRadius:"4px",fontSize:"13px",boxSizing:"border-box"},notesLabel:{fontWeight:"bold",color:"#303992",marginRight:"5px"},attachmentsSection:{marginTop:"10px",padding:"10px",backgroundColor:"rgba(48, 57, 146, 0.05)",borderLeft:"3px solid #303992",borderRadius:"4px",display:"flex",flexWrap:"wrap",gap:"10px",boxSizing:"border-box"},attachmentThumbnail:{width:"60px",height:"60px",border:"1px solid #e5e7eb",borderRadius:"4px",overflow:"hidden",backgroundColor:"#fff",display:"flex",alignItems:"center",justifyContent:"center"},attachmentImg:{width:"100%",height:"100%",objectFit:"cover"},segmentContainer:{display:"flex",gap:"8px",flexWrap:"wrap",alignItems:"center"},segmentButton:{display:"flex",alignItems:"center",justifyContent:"center",padding:"4px 6px",borderRadius:"6px",border:"1px solid #e0e0e0",backgroundColor:"#ffffff",fontSize:"10px",fontWeight:600,minWidth:"30px",color:"#666"},segmentIcon:{marginRight:"4px",fontSize:"9px",fontWeight:"bold",display:"inline-block",lineHeight:"1"},checkboxItem:{display:"flex",alignItems:"center",padding:"10px 14px",backgroundColor:"#f8f9fa",borderRadius:"6px",marginBottom:"8px",width:"100%",boxSizing:"border-box"}},Ht=t=>{if(!t||"string"!=typeof t)return!1;const e=t.trim();return e.startsWith("data:image")||e.startsWith("iVBORw0KGgo")||e.startsWith("/9j/4AAQ")||e.startsWith("UklGR")||e.startsWith("R0lGOD")},Ot=(t,e)=>{if(!t)return"";const A=t.trim();return A.startsWith("data:")||A.startsWith("http")||A.startsWith("blob:")||A.startsWith("/")?A:A.startsWith("iVBORw0KGgo")?`data:image/png;base64,${A}`:A.startsWith("/9j/4AAQ")?`data:image/jpeg;base64,${A}`:A.startsWith("UklGR")?`data:image/webp;base64,${A}`:A.startsWith("R0lGOD")?`data:image/gif;base64,${A}`:e&&e.startsWith("image/")?`data:${e};base64,${A}`:A},Pt=t=>{const e=String(t||"").toLowerCase();return"pass"===e||"yes"===e?"pass":"fail"===e||"no"===e?"fail":"pass"},Dt=({component:t})=>{const e=t.basic?.notes||"",A=t.basic?.attachments||[];return e.trim()||0!==A.length?X.jsxs("div",{style:{marginTop:"5px"},children:[e.trim().length>0&&X.jsxs("div",{style:Tt.notesSection,children:[X.jsx("span",{style:Tt.notesLabel,children:"Notes:"}),e]}),A.length>0&&X.jsx("div",{style:Tt.attachmentsSection,children:A.map((t,e)=>{const A=!(!t.data&&!t.url),r=(t.type?.startsWith("image/")||Ht(t.data||t.url||""))&&A?Ot(t.data||t.url||"",t.type):null;return X.jsx("div",{style:Tt.attachmentThumbnail,children:r?X.jsx("img",{src:r,alt:t.name||"Attachment",style:Tt.attachmentImg}):X.jsx("span",{style:{fontSize:"20px",color:"#999"},children:"📎"})},e)})})]}):null},Mt=({component:t})=>{const e=void 0!==t.basic?.value?t.basic.value:t.basic?.defaultValue,{name:A}=t;if("signature"===A)return e&&Ht(e)?X.jsx("div",{style:{marginTop:"5px"},children:X.jsx("img",{src:Ot(e),alt:"Signature",style:{...Tt.img,maxHeight:"100px",width:"auto"}})}):X.jsx("span",{style:{color:"#999",fontStyle:"italic"},children:"No signature"});if("checkbox"===A){const A=t.basic?.options||[],r=(Array.isArray(e)?e:e?[e]:[]).map(t=>String(t));return X.jsx("div",{style:{marginTop:"5px",width:"100%"},children:A.map((t,e)=>{const A=r.includes(String(t.value));return X.jsxs("div",{style:Tt.checkboxItem,children:[X.jsx("div",{style:{width:"18px",height:"18px",minWidth:"18px",border:"2px solid "+(A?"#303992":"#cbd5e1"),borderRadius:"4px",marginRight:"12px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:A?"#303992":"#ffffff"},children:A&&X.jsx("span",{style:{color:"#ffffff",fontSize:"12px",fontWeight:"bold",lineHeight:1},children:"✓"})}),X.jsx("span",{style:{fontSize:"14px",fontWeight:500,color:"#334155"},children:t.label})]},e)})})}if("radio"===A){const A=t.basic?.options||[];return X.jsx("div",{style:{marginTop:"5px",width:"100%"},children:A.map((t,A)=>{const r=String(e||"")===String(t.value||"");return X.jsxs("div",{style:Tt.checkboxItem,children:[X.jsx("div",{style:{width:"18px",height:"18px",minWidth:"18px",border:"2px solid "+(r?"#303992":"#cbd5e1"),borderRadius:"50%",marginRight:"12px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#ffffff"},children:r&&X.jsx("div",{style:{width:"10px",height:"10px",borderRadius:"50%",backgroundColor:"#303992"}})}),X.jsx("span",{style:{fontSize:"14px",fontWeight:500,color:"#334155"},children:t.label})]},A)})})}if("segment"===A){const A=t.basic?.options||[],r=e;return X.jsx("div",{style:Tt.segmentContainer,children:A.map((t,e)=>{const A=String(r||"")===String(t.value||""),n=(t=>null!=t?.icon?t.icon:"pass"===Pt(t?.value||t)?"✓":"×")(t),i=t.color||t.backgroundColor,s=Pt(t.value);let a,o,l;i?A?(a=i,o="#ffffff",l=i):(a=`${i}20`,o=i,l=i):"pass"===s?A?(a="#00814b",o="#ffffff",l="#00814b"):(a="#34bd4914",o="#00814b",l="#e0e0e0"):A?(a="#dc3545",o="#ffffff",l="#dc3545"):(a="#fa323d14",o="#dc3545",l="#e0e0e0");const c={...Tt.segmentButton,backgroundColor:a,color:o,borderColor:l,borderWidth:"1px",borderStyle:"solid"};return X.jsxs("div",{style:c,children:[X.jsx("span",{style:Tt.segmentIcon,children:n}),X.jsx("span",{children:t.value})]},e)})})}if("file"===A){const t=(Array.isArray(e)?e:e?[e]:[]).filter(t=>{const e=!(!t.data&&!t.url),A=t.type&&t.type.startsWith("image/"),r=e&&Ht(t.data||t.url);return A||r});return t.length>0?X.jsx("div",{style:{marginTop:"10px"},children:t.map((t,e)=>{const A=Ot(t.data||t.url,t.type);return A?X.jsx("img",{src:A,alt:t.name||"File",style:{...Tt.img,marginBottom:"10px"}},e):null})}):X.jsx("div",{style:{color:"#999",fontStyle:"italic"},children:"No images uploaded"})}if("location"===A){if(e&&"object"==typeof e){const t=e;return X.jsxs("div",{style:{fontSize:"14px"},children:[t.placeName&&X.jsxs("div",{style:{marginBottom:"4px"},children:[X.jsx("strong",{children:"Place:"})," ",t.placeName]}),(t.city||t.country)&&X.jsxs("div",{style:{marginBottom:"4px"},children:[X.jsx("strong",{children:"Address:"})," ",[t.city,t.country].filter(Boolean).join(", ")]}),t.latitude&&t.longitude&&X.jsxs("div",{style:{marginBottom:"4px"},children:[X.jsx("strong",{children:"Coordinates:"})," ",t.latitude.toFixed(6),", ",t.longitude.toFixed(6)]}),t.timestamp&&X.jsxs("div",{children:[X.jsx("strong",{children:"Captured:"})," ",(tt(t.timestamp)||new Date).toLocaleString()]})]})}return X.jsx("div",{style:{color:"#999",fontStyle:"italic"},children:"No location data"})}if("instructions"===A){const e=t.basic?.instructions||[],A=t.validation?.listStyle||"numbers";if(!Array.isArray(e)||0===e.length)return X.jsx("div",{style:{color:"#999",fontStyle:"italic"},children:"No instructions"});const r=()=>X.jsx("div",{dangerouslySetInnerHTML:{__html:e.join("")}});return"numbers"===A?X.jsx("ol",{style:{margin:"10px 0",paddingLeft:"25px"},children:X.jsx(r,{})}):"bullets"===A?X.jsx("ul",{style:{margin:"10px 0",paddingLeft:"25px"},children:X.jsx(r,{})}):X.jsx("div",{style:{margin:"10px 0"},children:X.jsx(r,{})})}if("select"===A){const A=t.basic?.options||[],r=e;let n="";if(Array.isArray(r))n=r.map(t=>{const e=A.find(e=>String(e.value)===String(t));return e?e.label:t}).join(", ");else{const t=r,e=A.find(e=>String(e.value)===String(t));n=e?e.label||e.value:null!=t?String(t):""}return X.jsx("div",{style:Tt.valueContainer,children:X.jsx("div",{style:Tt.value,children:n})})}const r="object"==typeof e?JSON.stringify(e):String(e);if(!["signature","checkbox","radio","segment","file","instructions","heading","section","table","datagrid","select"].includes(A)){const t="textarea"===A;return X.jsx("div",{style:{...Tt.valueContainer,...t?{minHeight:"60px",whiteSpace:"pre-wrap"}:{}},children:X.jsx("div",{style:Tt.value,children:r})})}return X.jsx("div",{style:Tt.value,children:r})},jt=({component:t})=>{const{name:e,basic:A,styles:r,validation:n}=t,i=A?.label,s=n?.required,a="left"===(r?.labelAlignment||"top");if("section"===e){const e=r?.headerBackgroundColor,n=r?.headerTextColor,a={...Tt.sectionHeader,...e?{backgroundColor:e,padding:"8px",borderRadius:"4px"}:{},...n?{color:n}:{},display:"flex",alignItems:"center"};return X.jsxs("div",{style:Tt.section,children:[i&&X.jsx("label",{style:a,children:X.jsxs("span",{style:{flex:1},children:[i,s&&" *"]})}),A?.description&&X.jsx("p",{style:{...Tt.description,marginBottom:"15px"},children:A.description}),X.jsx(Dt,{component:t}),X.jsx("div",{style:Tt.sectionChildren,children:X.jsx(Rt,{components:t.children||[]})})]})}if("heading"===e){const t=`h${Math.max(1,Math.min(6,r?.level??A?.level??1))}`,e={...r?.headerBackgroundColor?{backgroundColor:r.headerBackgroundColor,padding:"8px",borderRadius:"4px"}:{},...r?.headerTextColor?{color:r.headerTextColor}:{},...r?.fontSize?{fontSize:r.fontSize}:{},...r?.textAlign?{textAlign:r.textAlign}:{},marginTop:0,marginBottom:"15px"};return X.jsx("div",{style:Tt.formGroup,children:X.jsx(t,{style:e,children:A?.label||A?.value})})}if("table"===e){const e=t.cells||[],A=Math.max(0,...e.map(t=>t?t.length:0)),n=A>0?100/A:100,a=r?.headerBackgroundColor,o=r?.headerTextColor,l={...Tt.label,...a?{backgroundColor:a,padding:"8px",borderRadius:"4px",marginBottom:"10px"}:{},...o?{color:o}:{}};return X.jsxs("div",{style:Tt.formGroup,children:[i&&X.jsxs("label",{style:l,children:[i,s&&" *"]}),X.jsx("table",{style:Tt.table,children:X.jsx("tbody",{children:e.map((t,e)=>X.jsx("tr",{children:t&&t.map((t,e)=>X.jsx("td",{style:{...Tt.td,width:`${n}%`},children:t.components&&t.components.map((t,e)=>X.jsxs("div",{style:{marginBottom:"8px"},children:[t.basic?.label&&X.jsxs("span",{style:{fontWeight:"bold",marginRight:"5px",fontSize:"12px"},children:[t.basic.label,":"]}),X.jsx(Mt,{component:t}),X.jsx(Dt,{component:t})]},e))},e))},e))})})]})}if("datagrid"===e){const e=t.entries||[];let A=t.templateComponents||[];0===A.length&&e.length>0&&e[0]?.components&&(A=e[0].components.map(t=>({...t,basic:{...t.basic,label:t.basic?.label||t.name}})));const n=r?.headerBackgroundColor,a=r?.headerTextColor,o={...Tt.label,...n?{backgroundColor:n,padding:"8px",borderRadius:"4px",marginBottom:"10px"}:{},...a?{color:a}:{}},l=e.filter(t=>!(!t.components||0===t.components.length)&&t.components.some(t=>{const e=void 0!==t.basic?.value?t.basic.value:t.basic?.defaultValue;return Array.isArray(e)?e.length>0:null!=e&&""!==String(e).trim()}));return 0===l.length?X.jsxs("div",{style:Tt.formGroup,children:[i&&X.jsxs("label",{style:o,children:[i,s&&" *"]}),X.jsx("div",{style:{fontStyle:"italic",color:"#999"},children:"No data"})]}):X.jsxs("div",{style:Tt.formGroup,children:[i&&X.jsxs("label",{style:o,children:[i,s&&" *"]}),X.jsxs("table",{style:Tt.table,children:[X.jsx("thead",{children:X.jsx("tr",{children:A.map((t,e)=>X.jsx("th",{style:Tt.th,children:t.basic?.label||t.name},e))})}),X.jsx("tbody",{children:l.map((t,e)=>X.jsx("tr",{children:A.map((e,A)=>{const r=t.components[A];return X.jsx("td",{style:Tt.td,children:r?X.jsxs(X.Fragment,{children:[X.jsx(Mt,{component:r}),X.jsx(Dt,{component:r})]}):"N/A"},A)})},e))})]})]})}if(a&&"instructions"!==e){const A=["segment"].includes(e);return X.jsxs("div",{style:Tt.formGroup,children:[X.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[i&&X.jsxs("label",{style:Tt.labelLeft,children:[i,s&&" *"]}),X.jsx("div",{style:{flex:1,...A?{display:"flex",justifyContent:"flex-end"}:{}},children:X.jsx(Mt,{component:t})})]}),X.jsx(Dt,{component:t})]})}return X.jsxs("div",{style:Tt.formGroup,children:[i&&X.jsxs("label",{style:Tt.label,children:[i,s&&" *"]}),X.jsx(Mt,{component:t}),X.jsx(Dt,{component:t})]})},Rt=({components:t})=>{if(!t||0===t.length)return null;const e=[];let A=[],r=0;return t.forEach(t=>{const n=["section","table","datagrid","heading","instructions"].includes(t.name),i=n?12:t.styles?.column||12;r+i>12&&A.length>0&&(e.push(A),A=[],r=0),A.push(t),r+=i,(n||r>=12)&&r>0&&(e.push(A),A=[],r=0)}),A.length>0&&e.push(A),X.jsx(X.Fragment,{children:e.map((t,e)=>1===t.length?X.jsx(jt,{component:t[0]},t[0].id||e):X.jsx("div",{style:Tt.gridRow,children:t.map((t,e)=>{const A=t.styles?.column||12;return X.jsx("div",{style:Tt.gridCol(A),children:X.jsx(jt,{component:t})},t.id||e)})},e))})},Kt=({formTitle:t,formDescription:e,userName:A,components:r})=>X.jsxs("div",{className:"pdf-container",style:Tt.page,children:[X.jsxs("div",{style:Tt.header,children:[X.jsxs("div",{children:[X.jsx("h1",{style:Tt.title,children:t}),e&&X.jsx("p",{style:Tt.description,children:e})]}),A&&X.jsxs("div",{style:Tt.submittedBy,children:[X.jsx("strong",{children:"Submitted By:"})," ",A]})]}),X.jsx("div",{className:"form-content",children:X.jsx(Rt,{components:r})})]});var Vt,zt=I;if("production"===process.env.NODE_ENV)Vt=zt.createRoot,zt.hydrateRoot;else{var Gt=zt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;Vt=function(t,e){Gt.usingClientEntryPoint=!0;try{return zt.createRoot(t,e)}finally{Gt.usingClientEntryPoint=!1}}}var qt={exports:{}};
10
+ */"production"===process.env.NODE_ENV?z.exports=function(){if(V)return G;V=1;var e=t,A=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function a(t,e,r){var a,o={},l=null,c=null;for(a in void 0!==r&&(l=""+r),void 0!==e.key&&(l=""+e.key),void 0!==e.ref&&(c=e.ref),e)n.call(e,a)&&!s.hasOwnProperty(a)&&(o[a]=e[a]);if(t&&t.defaultProps)for(a in e=t.defaultProps)void 0===o[a]&&(o[a]=e[a]);return{$$typeof:A,type:t,key:l,ref:c,props:o,_owner:i.current}}return G.Fragment=r,G.jsx=a,G.jsxs=a,G}():z.exports=(q||(q=1,"production"!==process.env.NODE_ENV&&function(){var e,A=t,r=Symbol.for("react.element"),n=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),g=Symbol.iterator,m=A.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function w(t){for(var e=arguments.length,A=new Array(e>1?e-1:0),r=1;r<e;r++)A[r-1]=arguments[r];!function(t,e,A){var r=m.ReactDebugCurrentFrame.getStackAddendum();""!==r&&(e+="%s",A=A.concat([r]));var n=A.map(function(t){return String(t)});n.unshift("Warning: "+e),Function.prototype.apply.call(console[t],console,n)}("error",t,A)}function B(t){return t.displayName||"Context"}function y(t){if(null==t)return null;if("number"==typeof t.tag&&w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),"function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t;switch(t){case i:return"Fragment";case n:return"Portal";case a:return"Profiler";case s:return"StrictMode";case u:return"Suspense";case h:return"SuspenseList"}if("object"==typeof t)switch(t.$$typeof){case l:return B(t)+".Consumer";case o:return B(t._context)+".Provider";case c:return function(t,e,A){var r=t.displayName;if(r)return r;var n=e.displayName||e.name||"";return""!==n?A+"("+n+")":A}(t,t.render,"ForwardRef");case d:var e=t.displayName||null;return null!==e?e:y(t.type)||"Memo";case f:var A=t,r=A._payload,p=A._init;try{return y(p(r))}catch(t){return null}}return null}e=Symbol.for("react.module.reference");var b,v,C,x,F,Q,U,E=Object.assign,N=0;function S(){}S.__reactDisabledLog=!0;var L,I=m.ReactCurrentDispatcher;function _(t,e,A){if(void 0===L)try{throw Error()}catch(t){var r=t.stack.trim().match(/\n( *(at )?)/);L=r&&r[1]||""}return"\n"+L+t}var k,T=!1,H="function"==typeof WeakMap?WeakMap:Map;function O(t,e){if(!t||T)return"";var A,r=k.get(t);if(void 0!==r)return r;T=!0;var n,i=Error.prepareStackTrace;Error.prepareStackTrace=void 0,n=I.current,I.current=null,function(){if(0===N){b=console.log,v=console.info,C=console.warn,x=console.error,F=console.group,Q=console.groupCollapsed,U=console.groupEnd;var t={configurable:!0,enumerable:!0,value:S,writable:!0};Object.defineProperties(console,{info:t,log:t,warn:t,error:t,group:t,groupCollapsed:t,groupEnd:t})}N++}();try{if(e){var s=function(){throw Error()};if(Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(s,[])}catch(t){A=t}Reflect.construct(t,[],s)}else{try{s.call()}catch(t){A=t}t.call(s.prototype)}}else{try{throw Error()}catch(t){A=t}t()}}catch(e){if(e&&A&&"string"==typeof e.stack){for(var a=e.stack.split("\n"),o=A.stack.split("\n"),l=a.length-1,c=o.length-1;l>=1&&c>=0&&a[l]!==o[c];)c--;for(;l>=1&&c>=0;l--,c--)if(a[l]!==o[c]){if(1!==l||1!==c)do{if(l--,--c<0||a[l]!==o[c]){var u="\n"+a[l].replace(" at new "," at ");return t.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",t.displayName)),"function"==typeof t&&k.set(t,u),u}}while(l>=1&&c>=0);break}}}finally{T=!1,I.current=n,function(){if(0===--N){var t={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:E({},t,{value:b}),info:E({},t,{value:v}),warn:E({},t,{value:C}),error:E({},t,{value:x}),group:E({},t,{value:F}),groupCollapsed:E({},t,{value:Q}),groupEnd:E({},t,{value:U})})}N<0&&w("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=i}var h=t?t.displayName||t.name:"",d=h?_(h):"";return"function"==typeof t&&k.set(t,d),d}function P(t,e,A){if(null==t)return"";if("function"==typeof t)return O(t,!(!(r=t.prototype)||!r.isReactComponent));var r;if("string"==typeof t)return _(t);switch(t){case u:return _("Suspense");case h:return _("SuspenseList")}if("object"==typeof t)switch(t.$$typeof){case c:return O(t.render,!1);case d:return P(t.type,e,A);case f:var n=t,i=n._payload,s=n._init;try{return P(s(i),e,A)}catch(t){}}return""}k=new H;var D=Object.prototype.hasOwnProperty,M={},j=m.ReactDebugCurrentFrame;function R(t){if(t){var e=t._owner,A=P(t.type,t._source,e?e.type:null);j.setExtraStackFrame(A)}else j.setExtraStackFrame(null)}var K=Array.isArray;function V(t){return K(t)}function z(t){return""+t}function G(t){if(function(t){try{return z(t),!1}catch(t){return!0}}(t))return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",function(t){return"function"==typeof Symbol&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object"}(t)),z(t)}var q,X,Y,J=m.ReactCurrentOwner,$={key:!0,ref:!0,__self:!0,__source:!0};function Z(t,e,A,n,i){var s,a={},o=null,l=null;for(s in void 0!==A&&(G(A),o=""+A),function(t){if(D.call(t,"key")){var e=Object.getOwnPropertyDescriptor(t,"key").get;if(e&&e.isReactWarning)return!1}return void 0!==t.key}(e)&&(G(e.key),o=""+e.key),function(t){if(D.call(t,"ref")){var e=Object.getOwnPropertyDescriptor(t,"ref").get;if(e&&e.isReactWarning)return!1}return void 0!==t.ref}(e)&&(l=e.ref,function(t,e){if("string"==typeof t.ref&&J.current&&e&&J.current.stateNode!==e){var A=y(J.current.type);Y[A]||(w('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',y(J.current.type),t.ref),Y[A]=!0)}}(e,i)),e)D.call(e,s)&&!$.hasOwnProperty(s)&&(a[s]=e[s]);if(t&&t.defaultProps){var c=t.defaultProps;for(s in c)void 0===a[s]&&(a[s]=c[s])}if(o||l){var u="function"==typeof t?t.displayName||t.name||"Unknown":t;o&&function(t,e){var A=function(){q||(q=!0,w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",e))};A.isReactWarning=!0,Object.defineProperty(t,"key",{get:A,configurable:!0})}(a,u),l&&function(t,e){var A=function(){X||(X=!0,w("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",e))};A.isReactWarning=!0,Object.defineProperty(t,"ref",{get:A,configurable:!0})}(a,u)}return function(t,e,A,n,i,s,a){var o={$$typeof:r,type:t,key:e,ref:A,props:a,_owner:s,_store:{}};return Object.defineProperty(o._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(o,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(o,"_source",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.freeze&&(Object.freeze(o.props),Object.freeze(o)),o}(t,o,l,i,n,J.current,a)}Y={};var tt,et=m.ReactCurrentOwner,At=m.ReactDebugCurrentFrame;function rt(t){if(t){var e=t._owner,A=P(t.type,t._source,e?e.type:null);At.setExtraStackFrame(A)}else At.setExtraStackFrame(null)}function nt(t){return"object"==typeof t&&null!==t&&t.$$typeof===r}function it(){if(et.current){var t=y(et.current.type);if(t)return"\n\nCheck the render method of `"+t+"`."}return""}tt=!1;var st={};function at(t,e){if(t._store&&!t._store.validated&&null==t.key){t._store.validated=!0;var A=function(t){var e=it();if(!e){var A="string"==typeof t?t:t.displayName||t.name;A&&(e="\n\nCheck the top-level render call using <"+A+">.")}return e}(e);if(!st[A]){st[A]=!0;var r="";t&&t._owner&&t._owner!==et.current&&(r=" It was passed a child from "+y(t._owner.type)+"."),rt(t),w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',A,r),rt(null)}}}function ot(t,e){if("object"==typeof t)if(V(t))for(var A=0;A<t.length;A++){var r=t[A];nt(r)&&at(r,e)}else if(nt(t))t._store&&(t._store.validated=!0);else if(t){var n=function(t){if(null===t||"object"!=typeof t)return null;var e=g&&t[g]||t["@@iterator"];return"function"==typeof e?e:null}(t);if("function"==typeof n&&n!==t.entries)for(var i,s=n.call(t);!(i=s.next()).done;)nt(i.value)&&at(i.value,e)}}function lt(t){var e,A=t.type;if(null!=A&&"string"!=typeof A){if("function"==typeof A)e=A.propTypes;else{if("object"!=typeof A||A.$$typeof!==c&&A.$$typeof!==d)return;e=A.propTypes}if(e){var r=y(A);!function(t,e,A,r,n){var i=Function.call.bind(D);for(var s in t)if(i(t,s)){var a=void 0;try{if("function"!=typeof t[s]){var o=Error((r||"React class")+": "+A+" type `"+s+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof t[s]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw o.name="Invariant Violation",o}a=t[s](e,s,r,A,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(t){a=t}!a||a instanceof Error||(R(n),w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",r||"React class",A,s,typeof a),R(null)),a instanceof Error&&!(a.message in M)&&(M[a.message]=!0,R(n),w("Failed %s type: %s",A,a.message),R(null))}}(e,t.props,"prop",r,t)}else void 0===A.PropTypes||tt||(tt=!0,w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",y(A)||"Unknown"));"function"!=typeof A.getDefaultProps||A.getDefaultProps.isReactClassApproved||w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}var ct={};function ut(t,A,n,g,m,B){var b=function(t){return"string"==typeof t||"function"==typeof t||t===i||t===a||t===s||t===u||t===h||t===p||"object"==typeof t&&null!==t&&(t.$$typeof===f||t.$$typeof===d||t.$$typeof===o||t.$$typeof===l||t.$$typeof===c||t.$$typeof===e||void 0!==t.getModuleId)}(t);if(!b){var v="";(void 0===t||"object"==typeof t&&null!==t&&0===Object.keys(t).length)&&(v+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var C,x=function(t){return void 0!==t?"\n\nCheck your code at "+t.fileName.replace(/^.*[\\\/]/,"")+":"+t.lineNumber+".":""}(m);v+=x||it(),null===t?C="null":V(t)?C="array":void 0!==t&&t.$$typeof===r?(C="<"+(y(t.type)||"Unknown")+" />",v=" Did you accidentally export a JSX literal instead of a component?"):C=typeof t,w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",C,v)}var F=Z(t,A,n,m,B);if(null==F)return F;if(b){var Q=A.children;if(void 0!==Q)if(g)if(V(Q)){for(var U=0;U<Q.length;U++)ot(Q[U],t);Object.freeze&&Object.freeze(Q)}else w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else ot(Q,t)}if(D.call(A,"key")){var E=y(t),N=Object.keys(A).filter(function(t){return"key"!==t}),S=N.length>0?"{key: someKey, "+N.join(": ..., ")+": ...}":"{key: someKey}";ct[E+S]||(w('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',S,E,N.length>0?"{"+N.join(": ..., ")+": ...}":"{}",E),ct[E+S]=!0)}return t===i?function(t){for(var e=Object.keys(t.props),A=0;A<e.length;A++){var r=e[A];if("children"!==r&&"key"!==r){rt(t),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",r),rt(null);break}}null!==t.ref&&(rt(t),w("Invalid attribute `ref` supplied to `React.Fragment`."),rt(null))}(F):lt(F),F}var ht=function(t,e,A){return ut(t,e,A,!1)},dt=function(t,e,A){return ut(t,e,A,!0)};W.Fragment=i,W.jsx=ht,W.jsxs=dt}()),W);var X=z.exports;class Y{constructor(){}static getInstance(){return Y.instance||(Y.instance=new Y),Y.instance}getAvailableComponentsForConditional(t,e){if(!t||!Array.isArray(t))return[];const A=t=>{let e=[];return t.forEach(t=>{e.push(t),"section"===t.name&&t.children&&(e=[...e,...A(t.children)]),"table"===t.name&&t.cells&&t.cells.forEach(t=>{t.forEach(t=>{t.components&&(e=[...e,...A(t.components)])})}),"datagrid"===t.name&&t.templateComponents&&(e=[...e,...A(t.templateComponents)])}),e},r=A(t).filter(t=>!e||t.id!==e).filter(t=>!["section","table","datagrid"].includes(t.name)).map(t=>{const e={id:t.id,label:t.basic?.label||t.id,type:t.name,key:t.id};return["segment","select","radio","checkbox"].includes(t.name)&&t.basic?.options&&(e.options=t.basic.options.map(t=>({label:t.label||t.value||String(t),value:String(void 0!==t.value?t.value:t)}))),e}).sort((t,e)=>t.label.localeCompare(e.label));return r}getApplicableOperators(t){switch(t){case"text-input":case"email-input":case"textarea":return["equals","notEquals","contains","notContains","isEmpty","isNotEmpty"];case"number-input":case"date-picker":case"datetime-picker":return["equals","notEquals","greaterThan","lessThan","greaterThanOrEqual","lessThanOrEqual","isEmpty","isNotEmpty"];case"select":case"radio":case"segment":default:return["equals","notEquals","isEmpty","isNotEmpty"];case"checkbox":return["checked","notChecked","contains","notContains","isEmpty","isNotEmpty"]}}findComponent(t,e){if(t&&Array.isArray(t))for(const A of t){if(A.id===e||A._id===e||A.basic?.label===e)return A;if("section"===A.name&&A.children){const t=this.findComponent(A.children,e);if(t)return t}if("table"===A.name&&A.cells)for(const t of A.cells)for(const A of t)if(A.components){const t=this.findComponent(A.components,e);if(t)return t}if("datagrid"===A.name&&A.templateComponents){const t=this.findComponent(A.templateComponents,e);if(t)return t}if("datagrid"===A.name&&A.entries)for(const t of A.entries)if(t.components){const A=this.findComponent(t.components,e);if(A)return A}}}getAllComponents(t){const e=[],A=t=>{if(t&&Array.isArray(t))for(const r of t){if(e.push(r),r.children&&A(r.children),r.templateComponents&&A(r.templateComponents),r.cells)for(const t of r.cells)for(const e of t)e.components&&A(e.components);if(r.entries)for(const t of r.entries)t.components&&A(t.components)}};return A(t),e}validateConditionalLogic(t,e){const A=[];return t?(["show","hide","always"].includes(t.action)||A.push("Invalid conditional action"),["all","any"].includes(t.when)||A.push("Invalid when condition"),t.conditions&&0!==t.conditions.length?t.conditions.forEach((t,r)=>{const n=this.findComponent(e,t.when);if(!n)return void A.push(`Condition ${r+1}: Component not found`);this.getApplicableOperators(n.name).includes(t.operator)||("checkbox"!==n.name||"checked"!==t.operator&&"notChecked"!==t.operator)&&A.push(`Condition ${r+1}: Operator not applicable for component type`),this.isValidConditionValue(t.value,n.name,t.operator)||A.push(`Condition ${r+1}: Invalid condition value`)}):A.push("At least one condition is required"),{isValid:0===A.length,errors:A}):{isValid:!0,errors:[]}}evaluateConditionalLogic(t,e,A){if("always"===t.action)return{shouldShow:!0,evaluatedConditions:[]};if(!t||!t.conditions||0===t.conditions.length)return{shouldShow:!0,evaluatedConditions:[]};const r=t.conditions.map(t=>{const r=this.getComponentValue(t.when,e,A);return{condition:t,result:this.evaluateCondition(t,r),componentValue:r}});return{shouldShow:this.determineFinalResult(t,r),evaluatedConditions:r}}getComponentValue(t,e,A){if(A&&void 0!==A[t])return A[t];let r=this.findComponent(e,t);if(!r){const t=this.getAllComponents(e),n=Object.keys(A||{});for(const e of t)if(n.includes(e.id)||n.includes(e._id)){r=e;break}}if(r){const t=[r.id,r._id,r.basic?.label].filter(Boolean);for(const e of t)if(A&&void 0!==A[e])return A[e];if(void 0!==r.basic?.value&&null!==r.basic?.value&&""!==r.basic?.value)return r.basic.value;if(void 0!==r.basic?.defaultValue&&null!==r.basic?.defaultValue&&""!==r.basic?.defaultValue)return r.basic.defaultValue}}evaluateCondition(t,e){const{operator:A,value:r}=t;if("checked"===r||"notChecked"===r||"checked"===A||"notChecked"===A){const t="checked"===r||"notChecked"===r?r:A;return this.evaluateCheckboxCondition(e,t)}switch(A){case"equals":return this.isEqual(e,r);case"notEquals":return!this.isEqual(e,r);case"isEmpty":return this.isEmpty(e);case"isNotEmpty":return!this.isEmpty(e);case"contains":return this.contains(e,r);case"notContains":return!this.contains(e,r);case"greaterThan":return this.isGreaterThan(e,r);case"lessThan":return this.isLessThan(e,r);case"greaterThanOrEqual":return this.isGreaterThanOrEqual(e,r);case"lessThanOrEqual":return this.isLessThanOrEqual(e,r);default:return!1}}evaluateCheckboxCondition(t,e){const A=this.isCheckboxChecked(t);return"checked"===e?A:"notChecked"===e&&!A}isCheckboxChecked(t){return null!=t&&("boolean"==typeof t?t:"string"==typeof t?"true"===t.toLowerCase()||"1"===t||"checked"===t.toLowerCase()||t.length>0:Array.isArray(t)?t.length>0:"number"==typeof t&&t>0)}determineFinalResult(t,e){let A,r;return A="all"===t.when?e.every(t=>t.result):"any"===t.when&&e.some(t=>t.result),r="show"===t.action?A:"hide"===t.action?!A:(t.action,!0),r}isEqual(t,e){if(t==e)return!0;if(null==t||null==e)return!1;try{const A=String(t).trim(),r=String(e).trim();if(""!==A&&""!==r&&!isNaN(Number(A))&&!isNaN(Number(r))&&Number(A)===Number(r))return!0;if(A.toLowerCase()===r.toLowerCase())return!0}catch(t){}if(!Array.isArray(t)&&Array.isArray(e))return e.some(e=>this.isEqual(t,e));if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;const A=[...t].sort(),r=[...e].sort();return A.every((t,e)=>this.isEqual(t,r[e]))}if("object"==typeof t&&"object"==typeof e){const A=Object.keys(t),r=Object.keys(e);return A.length===r.length&&A.every(A=>this.isEqual(t[A],e[A]))}return!1}isEmpty(t){return null==t||void 0===t||("string"==typeof t?""===t.trim():Array.isArray(t)?0===t.length:"object"==typeof t&&0===Object.keys(t).length)}contains(t,e){return null!=t&&null!=e&&("string"==typeof t?t.trim().toLowerCase().includes(String(e).trim().toLowerCase()):Array.isArray(t)?Array.isArray(e)?e.some(e=>t.some(t=>this.isEqual(t,e))):t.some(t=>this.isEqual(t,e)):!("string"!=typeof t||!Array.isArray(e))&&e.some(e=>t.trim().toLowerCase().includes(String(e).trim().toLowerCase())))}isGreaterThan(t,e){const A="number"==typeof t?t:parseFloat(String(t)),r="number"==typeof e?e:parseFloat(String(e));return!isNaN(A)&&!isNaN(r)&&A>r}isLessThan(t,e){const A="number"==typeof t?t:parseFloat(String(t)),r="number"==typeof e?e:parseFloat(String(e));return!isNaN(A)&&!isNaN(r)&&A<r}isGreaterThanOrEqual(t,e){const A="number"==typeof t?t:parseFloat(String(t)),r="number"==typeof e?e:parseFloat(String(e));return!isNaN(A)&&!isNaN(r)&&A>=r}isLessThanOrEqual(t,e){const A="number"==typeof t?t:parseFloat(String(t)),r="number"==typeof e?e:parseFloat(String(e));return!isNaN(A)&&!isNaN(r)&&A<=r}isValidConditionValue(t,e,A){if(null==t)return["isEmpty","isNotEmpty"].includes(A);switch(e){case"number-input":return!isNaN(Number(t))||["isEmpty","isNotEmpty"].includes(A);case"date-picker":case"datetime-picker":return!isNaN(Date.parse(t))||["isEmpty","isNotEmpty"].includes(A);case"checkbox":return Array.isArray(t)||"string"==typeof t||"number"==typeof t;default:return!0}}createDefaultConditionalLogic(){return{action:"show",when:"all",conditions:[]}}getOperatorDisplayText(t){return{equals:"Is Equal To",notEquals:"Is Not Equal To",contains:"Contains",notContains:"Does Not Contain",isEmpty:"Is Empty",isNotEmpty:"Is Not Empty",greaterThan:"Is Greater Than",lessThan:"Is Less Than",greaterThanOrEqual:"Is Greater Than Or Equal To",lessThanOrEqual:"Is Less Than Or Equal To",checked:"Is Checked",notChecked:"Is Not Checked"}[t]||t}getActionDisplayText(t){return{show:"Show this field when",hide:"Hide this field when",always:"Always show this field"}[t]||t}getConditionalLogicSummary(t,e){if(!t||0===t.conditions.length)return"No conditions";if("always"===t.action)return"Always show";const A=this.getActionDisplayText(t.action),r=t.conditions.map(t=>{const A=e.find(e=>e.id===t.when);return`${A?.basic.label||"Unknown component"} ${this.getOperatorDisplayText(t.operator)} ${this.formatConditionValue(t.value)}`}),n="all"===t.when?" and ":" or ";return`${A} ${r.join(n)}`}formatConditionValue(t){return null==t?"empty":Array.isArray(t)?`[${t.join(", ")}]`:"string"==typeof t?`"${t}"`:String(t)}}const J=Y.getInstance();const $=new class{constructor(){this.toasts=[],this.listeners=[],this.defaultDuration=3e3,this.timeouts={}}generateId(){return Date.now().toString(36)+Math.random().toString(36).substr(2)}notifyListeners(){this.listeners.forEach(t=>t([...this.toasts]))}addToast(t){try{this.toasts.push(t),this.notifyListeners(),this.timeouts[t.id]=setTimeout(()=>{this.removeToast(t.id)},t.duration||this.defaultDuration)}catch(t){console.error("Error displaying toast message:",t)}}removeToast(t){this.timeouts[t]&&(clearTimeout(this.timeouts[t]),delete this.timeouts[t]),this.toasts=this.toasts.filter(e=>e.id!==t),this.notifyListeners()}showSuccess(t,e=3e3){const A={id:this.generateId(),message:t,type:"success",duration:e};this.addToast(A)}showError(t,e=5e3){const A={id:this.generateId(),message:t,type:"danger",duration:e};this.addToast(A)}showWarning(t,e){const A={id:this.generateId(),message:t,type:"warning",duration:e};this.addToast(A)}showInfo(t,e){const A={id:this.generateId(),message:t,type:"info",duration:e};this.addToast(A)}show(t,e="success",A){const r={id:this.generateId(),message:t,type:e,duration:A};this.addToast(r)}clearAll(){Object.values(this.timeouts).forEach(t=>clearTimeout(t)),this.timeouts={},this.toasts=[],this.notifyListeners()}subscribe(t){return this.listeners.push(t),()=>{this.listeners=this.listeners.filter(e=>e!==t)}}getToasts(){return[...this.toasts]}},Z=({validationErrors:t,fieldId:e,touchedFields:A,formSubmitted:r,properties:n,localValidation:i,isTouched:s,mode:a})=>{const o=t=>{const e=n.basic.label||"This field",A=n.name||"",r=n.validation?.customValidationMessage;if("number-input"===A)switch(t){case"required":return`${e} is required`;case"lowerLimit":return"Number is below the lower limit";case"upperLimit":return"Number is above the upper limit";default:return""}if(r)return r;const i="date-picker"===A||"datetime-picker"===A?n.basic?.dateTimeMode||("datetime-picker"===A?"datetime":"date"):null;switch(t){case"required":return`${e} is required`;case"invalidDate":return"time"===i?"Please select a valid time":"datetime"===i?"Please select a valid date and time":"date"===i?"Please select a valid date":`${e} is invalid`;case"minLength":return`${e} must be at least ${n.validation.minLength} characters long`;case"maxLength":return`${e} must be no more than ${n.validation.maxLength} characters long`;case"min":return`${e} must be at least ${n.validation.min}`;case"max":return`${e} must be no more than ${n.validation.max}`;case"lowerLimit":const t=n.validation,A=t?.lowerLimit;return`You are under the limit. ${e} must be at least ${A}`;case"upperLimit":const r=n.validation,s=r?.upperLimit;return`You crossed the limit. ${e} must be no more than ${s}`;case"pattern":return`${e} format is invalid`;case"email":return`${e} must be a valid email address`;default:return`${e} is invalid`}},l=(()=>{if("test"!==a)return"";if(!(s||A[e]||r))return"";if(i&&i.isValid)return"";if(i&&!i.isValid&&Object.keys(i.errors).length>0){const t=Object.keys(i.errors).filter(t=>!0===i.errors[t]);if(t.length>0){const e=t[0],A=n.name||"";return"pattern"===e&&"number-input"===A?"":o(e)}}const l=t[e];if(l&&"string"==typeof l&&""!==l.trim()){const t=n.name||"";if("number-input"===t&&i){const t=n.validation,e=t&&"lowerLimit"in t&&void 0!==t.lowerLimit&&null!==t.lowerLimit&&0!==t.lowerLimit,A=t&&"upperLimit"in t&&void 0!==t.upperLimit&&null!==t.upperLimit&&0!==t.upperLimit;return!l.includes("limit")&&!l.includes("Limit")||e||A?(i.isValid,""):""}if(("date-picker"===t||"datetime-picker"===t)&&l.includes("valid date")){const e=n.basic?.dateTimeMode||("datetime-picker"===t?"datetime":"date");if("time"===e)return"Please select a valid time";if("datetime"===e)return"Please select a valid date and time"}return l}return""})();return l?X.jsx("div",{className:"form-error-msg",children:l}):null},tt=t=>{if(null==t||""===t)return null;if(t instanceof Date)return isNaN(t.getTime())?null:t;if("number"==typeof t){const e=new Date(t);return isNaN(e.getTime())?null:e}if("string"==typeof t){let e=t.trim();e.match(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}/)&&(e=e.replace(" ","T"));const A=new Date(e);return isNaN(A.getTime())?null:A}return null};var et;!function(t){t.OPEN="Open",t.IN_PROGRESS="In-Progress",t.REJECTED="Rejected",t.RESOLVE="Resolve"}(et||(et={}));const At=({isOpen:r,onClose:n,onSuccess:i,component:d,formTemplateId:f,notes:p="",attachments:g=null,issue:m=null,onCreateIssue:w,onUpdateIssue:B,user:y,availableUsers:b=["Priya Das","Maria Garcia","John Smith","Sarah Johnson"],workOrderNumber:v,assetNumber:C,isStandalone:x,isEdit:F})=>{const[Q,U]=e(""),[E,N]=e(""),[S,L]=e(""),[I,k]=e(""),[T,H]=e("Medium"),[O,P]=e(et.OPEN),[D,M]=e(""),[j,R]=e(""),[K,V]=e(!1),[z,G]=e(g||[]),[q,W]=e(!1),Y=t.useRef(null),J=void 0!==F?F:!!m;A(()=>{m?.attachments&&m.attachments.length>0?G(m.attachments):g&&G(g)},[g,m]);const Z=t=>{if(!t)return"Attachment";if(t instanceof File)return t.name;if("string"==typeof t){if(t.startsWith("data:"))return"Attachment";const e=t.split("/");return e[e.length-1]||"Attachment"}return t.fileName||t.filename||t.name||"Attachment"},At=t=>{if(!t)return null;const e=t=>/\.(jpg|jpeg|png|gif|webp)$/i.test(t),A=t=>t.startsWith("data:image");return t instanceof File?t.type.startsWith("image/")?URL.createObjectURL(t):null:"string"==typeof t?A(t)||e(t)?t:null:t.data&&A(t.data)||t.fileName&&e(t.fileName)&&t.data?t.data:null};A(()=>{if(r)if(m||J){U(m?.title||""),N(m?.description||""),L(m?.workOrderNumber||v||""),k(m?.assetNumber||C||""),H(m?.priority||"Medium");const t=m?.status||et.OPEN,e=t===et.OPEN||t===et.IN_PROGRESS||t===et.REJECTED||t===et.RESOLVE?t:et.OPEN;P(e),M(m?.assignTo||""),R(m?.comments||"")}else d&&(d.basic,U(""),N(""),R(p||""),v&&L(v),C&&k(C))},[r,d,p,m,v,C]);const rt=t.useMemo(()=>{if(!Q.trim())return!1;if(!E.trim())return!1;if(!O)return!1;if(!D)return!1;if(!x){if(!S.trim())return!1;if(!I.trim())return!1}return!0},[Q,E,O,D,x,S,I]),nt=async t=>{if(m){V(!0);try{const e={title:String(Q||"").trim(),description:String(E||"").trim(),workOrderNumber:String(S||"").trim()||void 0,assetNumber:String(I||"").trim()||void 0,formTemplateId:m.formTemplateId||"",component:m.component||{},priority:T,assignTo:String(D||"").trim()||void 0,status:t,comments:String(j||"").trim()||""};B&&m._id&&await B(m._id,e),P(t);const A={[et.IN_PROGRESS]:"Issue accepted and moved to In-Progress",[et.RESOLVE]:"Issue resolved successfully",[et.REJECTED]:"Issue rejected"};$.showSuccess(A[t]||"Issue status updated successfully"),i&&i(),n()}catch(t){const e=t?.message||t?.error?.message||"Failed to update issue status. Please try again.";$.showError(e)}finally{V(!1)}}};if(!r)return null;const it=X.jsx("div",{className:"raise-issue-modal-overlay",onClick:n,children:X.jsxs("div",{className:"raise-issue-modal",onClick:t=>t.stopPropagation(),children:[X.jsxs("div",{className:"raise-issue-modal-header",children:[X.jsxs("div",{className:"raise-issue-modal-header-left",children:[X.jsx(s,{className:"raise-issue-modal-icon",size:20}),X.jsx("div",{className:"raise-issue-modal-header-text",children:X.jsx("div",{className:"raise-issue-modal-title-main",children:J?"Issue Details":"Create Issue"})})]}),X.jsx("button",{className:"raise-issue-modal-close",onClick:n,"aria-label":"Close",children:X.jsx(a,{size:18})})]}),X.jsx("div",{className:"raise-issue-modal-content",children:X.jsxs("div",{className:"raise-issue-fields-grid",children:[J&&m?.issueNumber&&X.jsxs("div",{className:"raise-issue-field",children:[X.jsx("label",{className:"raise-issue-field-label",children:"Issue ID"}),X.jsx("input",{type:"text",className:"raise-issue-field-input raise-issue-field-readonly",value:m.issueNumber,readOnly:!0})]}),X.jsxs("div",{className:"raise-issue-field",children:[X.jsx("label",{className:"raise-issue-field-label",children:"Task"}),X.jsx("input",{type:"text",className:"raise-issue-field-input raise-issue-field-readonly",value:J?m?.component?.basic?.label||"":d?.basic?.label||"",readOnly:!0})]}),X.jsxs("div",{className:"raise-issue-field",children:[X.jsx("label",{className:"raise-issue-field-label",children:"Task Value"}),X.jsx("input",{type:"text",className:"raise-issue-field-input raise-issue-field-readonly",value:J?m?.component?.basic?.value||"":d?.basic?.value||"",readOnly:!0})]}),X.jsxs("div",{className:"raise-issue-field",children:[X.jsxs("label",{className:"raise-issue-field-label",children:["Title ",X.jsx("span",{className:"raise-issue-required",children:"*"})]}),X.jsx("input",{type:"text",className:"raise-issue-field-input "+(J?"raise-issue-field-readonly":""),value:Q,onChange:t=>U(t.target.value),placeholder:"Enter issue title",readOnly:J})]}),!x&&X.jsxs("div",{className:"raise-issue-field",children:[X.jsxs("label",{className:"raise-issue-field-label",children:["Work Order ",X.jsx("span",{className:"raise-issue-required",children:"*"})]}),X.jsx("input",{type:"text",className:"raise-issue-field-input "+(J?"raise-issue-field-readonly":""),value:S,onChange:t=>L(t.target.value),placeholder:"N/A",readOnly:J})]}),!x&&X.jsxs("div",{className:"raise-issue-field",children:[X.jsxs("label",{className:"raise-issue-field-label",children:["Asset Number ",X.jsx("span",{className:"raise-issue-required",children:"*"})]}),X.jsx("input",{type:"text",className:"raise-issue-field-input "+(J?"raise-issue-field-readonly":""),value:I,onChange:t=>k(t.target.value),placeholder:"Enter asset number",readOnly:J})]}),X.jsxs("div",{className:"raise-issue-field",children:[X.jsxs("label",{className:"raise-issue-field-label",children:["Raised By ",X.jsx("span",{className:"raise-issue-required",children:"*"})]}),X.jsxs("div",{className:"raise-issue-field-value-with-icon",children:[X.jsx(o,{size:16}),X.jsx("span",{children:y&&`${y.firstName||""} ${y.lastName||""}`.trim()||"User"})]})]}),X.jsxs("div",{className:"raise-issue-field",children:[X.jsx("label",{className:"raise-issue-field-label",children:"Created On"}),X.jsxs("div",{className:"raise-issue-field-value-with-icon",children:[X.jsx(l,{size:16}),X.jsx("span",{children:J&&m?.createdAt?(tt(m.createdAt)||new Date).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0}):(new Date).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0})})]})]}),X.jsxs("div",{className:"raise-issue-field raise-issue-field-full-width",children:[X.jsxs("label",{className:"raise-issue-field-label",children:["Description ",X.jsx("span",{className:"raise-issue-required",children:"*"})]}),X.jsx("textarea",{className:"raise-issue-field-textarea "+(J?"raise-issue-field-readonly":""),value:E,onChange:t=>N(t.target.value),placeholder:"Enter issue description",rows:4,readOnly:J})]}),X.jsxs("div",{className:"raise-issue-field",children:[X.jsxs("label",{className:"raise-issue-field-label",children:["Status ",X.jsx("span",{className:"raise-issue-required",children:"*"})]}),X.jsxs("select",{className:"raise-issue-field-select "+(J?"":"raise-issue-field-readonly"),value:O,onChange:t=>P(t.target.value),disabled:!J,children:[X.jsx("option",{value:et.OPEN,children:et.OPEN}),X.jsx("option",{value:et.IN_PROGRESS,children:et.IN_PROGRESS}),X.jsx("option",{value:et.REJECTED,children:et.REJECTED}),X.jsx("option",{value:et.RESOLVE,children:et.RESOLVE})]})]}),X.jsxs("div",{className:"raise-issue-field",children:[X.jsxs("label",{className:"raise-issue-field-label",children:["Assign to ",X.jsx("span",{className:"raise-issue-required",children:"*"})]}),X.jsxs("select",{className:"raise-issue-field-select",value:D,onChange:t=>M(t.target.value),children:[X.jsx("option",{value:"",children:"Unassigned"}),b.map(t=>X.jsx("option",{value:t,children:t},t))]})]}),X.jsxs("div",{className:"raise-issue-field raise-issue-field-full-width",children:[X.jsxs("label",{className:"raise-issue-field-label",children:["Priority ",X.jsx("span",{className:"raise-issue-required",children:"*"})]}),X.jsxs("div",{className:"raise-issue-priority-buttons",children:[X.jsx("button",{type:"button",className:"priority-button priority-low "+("Low"===T?"active":""),onClick:()=>H("Low"),children:"Low"}),X.jsx("button",{type:"button",className:"priority-button priority-medium "+("Medium"===T?"active":""),onClick:()=>H("Medium"),children:"Medium"}),X.jsx("button",{type:"button",className:"priority-button priority-high "+("High"===T?"active":""),onClick:()=>H("High"),children:"High"})]})]}),X.jsxs("div",{className:"raise-issue-field raise-issue-field-full-width",children:[X.jsxs("label",{className:"raise-issue-field-label-with-icon",children:[X.jsx(c,{size:16}),X.jsx("span",{children:"Comments"})]}),!j&&X.jsx("div",{className:"raise-issue-no-comments",children:"No comments yet"}),X.jsx("textarea",{className:"raise-issue-field-textarea raise-issue-comments-textarea "+(J?"raise-issue-field-readonly":""),value:j,onChange:t=>R(t.target.value),placeholder:"Add a comment...",rows:4,readOnly:J})]}),X.jsxs("div",{className:"raise-issue-field raise-issue-field-full-width",style:{marginTop:"1rem"},children:[X.jsx("label",{className:"raise-issue-field-label",children:"Attachments"}),X.jsxs("div",{className:"raise-issue-attachments-container",children:[!J&&X.jsxs("div",{className:"raise-issue-dropzone "+(q?"dragging":""),onDragOver:t=>{t.preventDefault(),W(!0)},onDragLeave:t=>{t.preventDefault(),W(!1)},onDrop:t=>{if(t.preventDefault(),W(!1),t.dataTransfer.files&&t.dataTransfer.files.length>0){const e=Array.from(t.dataTransfer.files);G(t=>[...t,...e])}},onClick:()=>Y.current?.click(),children:[X.jsx("input",{type:"file",ref:Y,style:{display:"none"},onChange:t=>{if(t.target.files&&t.target.files.length>0){const e=Array.from(t.target.files);G(t=>[...t,...e]),Y.current&&(Y.current.value="")}},multiple:!0}),X.jsx("div",{className:"raise-issue-dropzone-icon",children:X.jsx(u,{size:24})}),X.jsx("div",{className:"raise-issue-dropzone-text",children:"Click to upload or drag and drop"}),X.jsx("div",{className:"raise-issue-dropzone-hint",children:"PNG, JPG up to 10MB"})]}),z.length>0&&X.jsx("div",{className:"raise-issue-attachments-list",children:z.map((t,e)=>X.jsxs("div",{className:"raise-issue-attachment-item",children:[X.jsx("div",{className:"raise-issue-attachment-thumbnail",children:At(t)?X.jsx("img",{src:At(t),alt:"Thumbnail"}):X.jsx(h,{size:20,color:"#9ca3af"})}),X.jsxs("div",{className:"raise-issue-attachment-info",children:[X.jsx("span",{className:"attachment-name",title:Z(t),children:Z(t)}),t instanceof File&&X.jsxs("span",{className:"attachment-size",children:[(t.size/1024).toFixed(1)," KB"]})]}),!J&&X.jsx("button",{type:"button",className:"attachment-remove-btn",onClick:()=>(t=>{G(e=>e.filter((e,A)=>A!==t))})(e),title:"Remove",children:X.jsx(a,{size:12})})]},e))})]})]})]})}),X.jsx("div",{className:"raise-issue-modal-actions",children:X.jsxs("div",{className:"raise-issue-modal-actions-buttons",children:[J&&m&&X.jsxs(X.Fragment,{children:[O===et.OPEN&&X.jsx("button",{className:"raise-issue-modal-button raise-issue-modal-button-accept",onClick:async()=>{await nt(et.IN_PROGRESS)},disabled:K,children:K?"Processing...":"Accept"}),O===et.IN_PROGRESS&&X.jsx("button",{className:"raise-issue-modal-button raise-issue-modal-button-resolve",onClick:async()=>{await nt(et.RESOLVE)},disabled:K,children:K?"Processing...":"Resolve"}),(O===et.OPEN||O===et.IN_PROGRESS)&&X.jsx("button",{className:"raise-issue-modal-button raise-issue-modal-button-reject",onClick:async()=>{await nt(et.REJECTED)},disabled:K,children:K?"Processing...":"Reject"})]}),!J&&X.jsx("button",{className:"raise-issue-modal-button raise-issue-modal-button-save "+(rt?"":"disabled"),onClick:async()=>{if(String(Q||"").trim())if(String(E||"").trim())if(x||String(S||"").trim())if(x||String(I||"").trim())if(String(D||"").trim()){V(!0);try{if(J&&m){const t={title:String(Q||"").trim(),description:String(E||"").trim(),workOrderNumber:String(S||"").trim()||void 0,assetNumber:String(I||"").trim()||void 0,formTemplateId:m.formTemplateId||"",component:m.component||{},priority:T,assignTo:String(D||"").trim()||void 0,status:O,comments:String(j||"").trim()||"",task:m.component?.basic?.label||"",taskValue:m.component?.basic?.value||""};B&&m._id&&await B(m._id,t),$.showSuccess("Issue updated successfully"),i&&i(),n()}else{if(!d)return $.showError("Component is required"),void V(!1);if(!f||""===String(f||"").trim())return $.showError("Form template is required"),void V(!1);const t={...d,basic:{...d.basic,comments:String(p||"")}},e=y?`${y.firstName||""} ${y.lastName||""}`.trim():"User",A={title:String(Q||"").trim(),workOrderNumber:String(S||"").trim()||void 0,assetNumber:String(I||"").trim()||void 0,component:t,description:String(E||"").trim(),formTemplateId:f,assignTo:String(D||"").trim()||void 0,priority:T,status:O,comments:String(j||"").trim()||"",createdBy:e,task:d?.basic?.label||"",taskValue:d?.basic?.value||""};let r;if(w&&(r=await w(A,z)),$.showSuccess("Issue raised successfully"),i){const t={_id:r?._id||"temp-id",issueNumber:r?.issueNumber||"",title:A.title,description:A.description,status:A.status,priority:A.priority,createdAt:r?.createdAt||(new Date).toISOString(),updatedAt:r?.updatedAt||(new Date).toISOString(),component:A.component,workOrderNumber:A.workOrderNumber,assetNumber:A.assetNumber,assignTo:A.assignTo,comments:A.comments,attachments:r?.attachments||z,...r};i(t)}n()}}catch(t){const e=t?.message||t?.error?.message||(J?"Failed to update issue. Please try again.":"Failed to raise issue. Please try again.");$.showError(e)}finally{V(!1)}}else $.showError("Assignee is required");else $.showError("Asset Number is required");else $.showError("Work Order is required");else $.showError("Description is required");else $.showError("Title is required")},disabled:K||!rt,children:K?"Creating...":"Create Issue"})]})})]})});return _(it,document.body)},rt=({component:t,condition:n,currentValue:i,thresholdValue:a,formTemplateId:o,workOrderNumber:l,assetNumber:c,user:u,onIssueRaised:h,isIssueRaised:d=!1,compact:f=!1})=>{const[p,g]=e(!1),[m,w]=e(null),[B,y]=e(!1),[b,v]=e(!1);A(()=>{d&&v(!0)},[d]),A(()=>{v(!1)},[n?.id]);const C=t=>({greaterThan:">",lessThan:"<",greaterThanOrEqual:"≥",lessThanOrEqual:"≤",equals:"=",notEquals:"≠"}[t]||t),x=r(async()=>{if(d||b){if(m)return void g(!0);y(!0);try{w(null),g(!0)}catch(t){console.error("Error fetching issue:",t),$.showError("Failed to load issue details")}finally{y(!1)}}else w(null),g(!0)},[d,b,o,t,m]),F=r(()=>{g(!1),d||b||w(null)},[d,b]),Q=r(t=>{g(!1),w(t||null),v(!0),h&&n?.id&&h(n.id)},[h,n]);return d||b?X.jsx(X.Fragment,{children:p&&X.jsx(At,{isOpen:p,onClose:F,onSuccess:Q,component:t,formTemplateId:o,workOrderNumber:l,assetNumber:c,user:u,notes:"",attachments:null,issue:m})}):f?X.jsxs(X.Fragment,{children:[X.jsxs("div",{className:"threshold-alert threshold-alert-unresolved threshold-alert-compact",children:[X.jsx("div",{className:"threshold-alert-border"}),X.jsxs("div",{className:"threshold-alert-content-compact",children:[X.jsx(s,{className:"threshold-alert-icon-compact",size:14}),X.jsx("span",{className:"threshold-alert-message-compact",children:`Threshold ${C(n.operator)} ${a}`}),X.jsx("button",{type:"button",onClick:x,className:"threshold-alert-raise-issue-btn-compact",title:"Raise Issue",children:"Raise Issue"})]})]}),p&&X.jsx(At,{isOpen:p,onClose:F,onSuccess:Q,component:t,formTemplateId:o,workOrderNumber:l,assetNumber:c,user:u,notes:"",attachments:null,issue:m})]}):X.jsxs(X.Fragment,{children:[X.jsxs("div",{className:"threshold-alert threshold-alert-unresolved",children:[X.jsx("div",{className:"threshold-alert-border"}),X.jsxs("div",{className:"threshold-alert-content",children:[X.jsx("div",{className:"threshold-alert-header",children:X.jsxs("div",{className:"threshold-alert-title-group",children:[X.jsx(s,{className:"threshold-alert-icon",size:20}),X.jsx("span",{className:"threshold-alert-title",children:"Threshold Condition Met - Action Required"})]})}),X.jsxs("div",{className:"threshold-alert-message",children:[(()=>{const e=C(n.operator);return`${t.basic?.label||"Value"}: Value ${i} exceeds threshold ${e} ${a}`})(),X.jsx("span",{className:"threshold-alert-warning",children:" You must raise an issue before submitting the form."})]}),X.jsx("div",{className:"threshold-alert-buttons",children:X.jsx("button",{type:"button",onClick:x,className:"threshold-alert-raise-issue-btn",children:"Raise Issue Now"})})]})]}),p&&X.jsx(At,{isOpen:p,onClose:F,onSuccess:Q,component:t,formTemplateId:o,workOrderNumber:l,assetNumber:c,user:u,notes:"",attachments:null,issue:m})]})},nt=({id:t,properties:s,validationErrors:a={},formValue:o="",inputType:l="text",readonly:c=!1,disabled:u=!1,touchedFields:h={},formSubmitted:d=!1,mode:f="test",onValueChange:p,onBlur:g,onFocus:m,className:w="",hideLabel:B=!1,formTemplateId:y,onThresholdIssueRaised:b,raisedThresholdIssues:v=new Set,workOrderNumber:C,assetNumber:x,user:F})=>{const Q=t=>null==t?"":"string"==typeof t?t:"number"==typeof t||"boolean"==typeof t?String(t):"object"==typeof t?Array.isArray(t)?"":"value"in t?Q(t.value):"label"in t?Q(t.label):"":String(t||""),U=n(t),E=n(null);A(()=>{t!==U.current&&(console.warn(`[DfFormInput] Component ID changed from ${U.current} to ${t}`),U.current=t)},[t]);const N=Q(o||s?.basic?.defaultValue||""),[S,L]=e(N),[I,_]=e(!1),[k,T]=e(!1),[H,O]=e(new Set),[P,D]=e(N),M=()=>{if(l)return l;const t=s?.name;return"text-input"===t?"text":"number-input"===t?"number":"email-input"===t?"email":"text"},j=r(t=>{const e=(()=>{const t={};if(s?.validation?.required&&(t.required=!0),"email"===M()&&(t.email=!0),"text"===M()){const e=s.validation;e?.minLength&&(t.minLength=e.minLength),e?.maxLength&&(t.maxLength=e.maxLength)}if("number"===M()){const e=s.validation;e&&"lowerLimit"in e&&void 0!==e.lowerLimit&&null!==e.lowerLimit&&0!==e.lowerLimit&&(t.lowerLimit=e.lowerLimit),e&&"upperLimit"in e&&void 0!==e.upperLimit&&null!==e.upperLimit&&0!==e.upperLimit&&(t.upperLimit=e.upperLimit)}return t})(),A={};let r=!0;const n="string"==typeof t?t:null!=t?String(t):"";if(!e.required||n&&""!==n.trim()||(A.required=!0,r=!1),e.email&&n&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(n)&&(A.email=!0,r=!1),e.minLength&&n&&n.length<e.minLength&&(A.minLength=!0,r=!1),e.maxLength&&n&&n.length>e.maxLength&&(A.maxLength=!0,r=!1),"number"===M())if(delete A.pattern,delete A.min,delete A.max,n&&""!==n.trim()){const t=n.trim(),i=parseFloat(t);isNaN(i)||("lowerLimit"in e&&void 0!==e.lowerLimit&&null!==e.lowerLimit&&0!==e.lowerLimit&&i<e.lowerLimit&&(A.lowerLimit=!0,r=!1),"upperLimit"in e&&void 0!==e.upperLimit&&null!==e.upperLimit&&0!==e.upperLimit&&i>e.upperLimit&&(A.upperLimit=!0,r=!1))}else delete A.lowerLimit,delete A.upperLimit;return{isValid:r,errors:A}},[s,M]),R=r(e=>{const A="string"==typeof e?e:null!=e?String(e):"";if(L(A),p){const e=j(A),r=U.current,n={id:r,value:A,isValid:e.isValid,errors:e.errors};r!==t&&console.error(`[DfFormInput] ID mismatch in handleValueChange! ref: ${r}, prop: ${t}`),p(n)}},[t,p,j,U]);A(()=>{I&&(h[t]=!0)},[I,t,h]),A(()=>{if("edit"===f){_(!1);L(s?.basic?.defaultValue||"")}else"test"===f&&(_(!1),L(""))},[f,s?.basic?.defaultValue]),A(()=>{const e=U.current,A=Q(o||s?.basic?.defaultValue||"");A===S||k||""===A&&""!==String(S||"").trim()?""===A&&String(S||"").trim():null!=o&&(e===t?L(A):console.error(`[DfFormInput] ID mismatch! componentIdRef: ${e}, prop id: ${t}`))},[o,S,k,s?.basic?.defaultValue,t]),A(()=>{d&&_(!0)},[d]),A(()=>{"test"!==f&&L("")},[f]);const K=r((t,e)=>{if(!e||""===e)return!1;const A="string"==typeof e?parseFloat(e):e,r="string"==typeof t.value?parseFloat(t.value):t.value;if(isNaN(A)||isNaN(r))return!1;switch(t.operator){case"greaterThan":return A>r;case"lessThan":return A<r;case"greaterThanOrEqual":return A>=r;case"lessThanOrEqual":return A<=r;case"equals":return A===r;case"notEquals":return A!==r;default:return!1}},[]),V=i(()=>s?.condition?.conditions||[],[s?.condition]);A(()=>{S!==P&&(O(new Set),D(S))},[S,P]);const z=i(()=>{if("test"!==f||!S||""===S)return null;const t=V.filter(t=>K(t,S));if(0===t.length)return null;for(const e of t)if(!H.has(e.id))return e;return null},[S,V,H,f,K,v]),G=r(t=>{O(e=>new Set(e).add(t))},[]),q=M(),W=u||c||s?.validation?.readonly;return X.jsxs(X.Fragment,{children:[X.jsxs("div",{className:`form-group ${(()=>{const t=s?.styles?.labelAlignment;return"left"===t?"label-left":"label-top"})()}`,children:[!B&&s.basic.label&&X.jsxs("label",{htmlFor:t,className:"form-label",children:[s.basic.label,s.validation.required&&X.jsx("span",{className:"required-indicator",children:"*"})]}),X.jsxs("div",{className:"input-wrapper",ref:E,children:[X.jsx("input",{type:q,id:t,value:S,onChange:t=>{const e=t.target.value;R(e)},onFocus:()=>{T(!0),m&&m()},onBlur:()=>{if(T(!1),_(!0),"test"===f&&p){const e="string"==typeof S?S:null!=S?String(S):"",A=j(e),r={id:t,value:e,isValid:A.isValid,errors:A.errors};p(r)}g&&g()},placeholder:s.basic.placeholder,disabled:W,readOnly:c||s?.validation?.readonly,className:(()=>{const e="form-control";if("test"===f){const A="string"==typeof S?S:null!=S?String(S):"",r=j(A);if(r.isValid)return`${e} ${w}`.trim();const n=!r.isValid&&I,i=a[t]&&(I||d)&&!r;return`${e} ${n||i?"is-invalid":""} ${w}`.trim()}return`${e} ${w}`.trim()})()}),X.jsx(Z,{validationErrors:a,fieldId:t,touchedFields:h,formSubmitted:d,properties:s,localValidation:j(S),isTouched:I,mode:f})]})]}),z&&"test"===f&&(()=>{const t=v?.has(z.id)||!1,e=null!==E.current?.closest(".table-cell")||null!==E.current?.closest(".cell-content")||null!==E.current?.closest(".datagrid-table-view")||null!==E.current?.closest(".datagrid-list-view")||w.includes("table-cell")||w.includes("cell-content");return X.jsx(rt,{component:s,condition:z,currentValue:S,thresholdValue:z.value,formTemplateId:y,workOrderNumber:C,assetNumber:x,user:F,onDismiss:()=>G(z.id),onIssueRaised:b,isIssueRaised:t,compact:e},`${z.id}-${t}`)})()]})},it=({id:t,properties:n,validationErrors:i={},formValue:s="",readonly:a=!1,disabled:o=!1,touchedFields:l={},formSubmitted:c=!1,mode:u="preview",onValueChange:h,onBlur:d,onFocus:f,className:p="",hideLabel:g=!1})=>{const[m,w]=e(s),[B,y]=e(!1),b=r(t=>{const e={};let A=!0;return!n?.validation?.required||t&&""!==t.trim()||(e.required=!0,A=!1),n?.validation?.minLength&&t&&t.length<n.validation.minLength&&(e.minLength=!0,A=!1),n?.validation?.maxLength&&t&&t.length>n.validation.maxLength&&(e.maxLength=!0,A=!1),{isValid:A,errors:e}},[n]),v=r(e=>{if(w(e),h){const A=b(e),r={id:t,value:e,isValid:A.isValid,errors:A.errors};h(r)}},[t,h,b]);A(()=>{B&&(l[t]=!0)},[B,t,l]),A(()=>{""===m&&""!==s&&w(s)},[s]),A(()=>{c&&y(!0)},[c]),A(()=>{"test"!==u&&w("")},[u]);const C=o||a||n?.validation?.readonly,x=n?.validation?.rows||4;return X.jsxs("div",{className:`form-group ${(()=>{const t=n?.styles?.labelAlignment;return"left"===t?"label-left":"label-top"})()}`,children:[!g&&n.basic.label&&X.jsxs("label",{htmlFor:t,className:"form-label",children:[n.basic.label,n.validation.required&&X.jsx("span",{className:"required-indicator",children:"*"})]}),X.jsxs("div",{className:"input-wrapper",children:[X.jsx("textarea",{id:t,value:m,onChange:t=>{const e=t.target.value;v(e)},onFocus:()=>{f&&f()},onBlur:()=>{y(!0),d&&d()},placeholder:n.basic.placeholder,disabled:C,readOnly:a||n?.validation?.readonly,rows:x,className:`form-textarea ${!b(m).isValid&&B?"is-invalid":""} ${p}`.trim()}),X.jsx(Z,{validationErrors:i,fieldId:t,touchedFields:l,formSubmitted:c,properties:n,localValidation:b(m),isTouched:B,mode:u})]})]})},st=({id:t,properties:n,validationErrors:i={},formValue:s="",readonly:a=!1,disabled:o=!1,touchedFields:l={},formSubmitted:c=!1,mode:u="preview",onValueChange:h,onBlur:d,onFocus:f,className:p="",hideLabel:g=!1})=>{const[m,w]=e(s),[B,y]=e(!1),b=n?.validation?.multiple||!1,v=r(t=>{const e={};let A=!0;return n?.validation?.required&&(b?Array.isArray(t)&&0!==t.length||(e.required=!0,A=!1):(!t||"string"==typeof t&&""===t.trim())&&(e.required=!0,A=!1)),{isValid:A,errors:e}},[n,b]),C=r(e=>{if(w(e),h){const A=v(e),r={id:t,value:e,isValid:A.isValid,errors:A.errors};h(r)}},[t,h,v]);A(()=>{B&&(l[t]=!0)},[B,t,l]),A(()=>{JSON.stringify(s)!==JSON.stringify(m)&&w(s)},[s,m]),A(()=>{c&&y(!0)},[c]);const x=o||a||n?.validation?.readonly;return X.jsxs("div",{className:`form-group ${(()=>{const t=n?.styles?.labelAlignment;return"left"===t?"label-left":"label-top"})()}`,children:[!g&&n.basic.label&&X.jsxs("label",{htmlFor:t,className:"form-label",children:[n.basic.label,n.validation.required&&X.jsx("span",{className:"required-indicator",children:"*"})]}),X.jsxs("div",{className:"input-wrapper",children:[X.jsxs("select",{id:t,value:m,onChange:t=>{if(b){const e=Array.from(t.target.selectedOptions,t=>t.value);C(e)}else C(t.target.value)},onFocus:()=>{f&&f()},onBlur:()=>{y(!0),d&&d()},disabled:x,multiple:b,className:`form-select ${!v(m).isValid&&B?"is-invalid":""} ${p}`.trim(),children:[!b&&X.jsx("option",{value:"",children:n.basic.placeholder||"Select an option"}),(n.options||[]).map((t,e)=>X.jsx("option",{value:t.value,disabled:t.disabled,children:t.label},e))]}),X.jsx(Z,{validationErrors:i,fieldId:t,touchedFields:l,formSubmitted:c,properties:n,localValidation:v(m),isTouched:B,mode:u})]})]})},at=({id:t,properties:n,validationErrors:i={},formValue:s=[],readonly:a=!1,disabled:o=!1,touchedFields:l={},formSubmitted:c=!1,mode:u="preview",onValueChange:h,onBlur:d,onFocus:f,className:p="",hideLabel:g=!1})=>{const[m,w]=e(!1),B=Array.isArray(s)?s:[],y=r(t=>{const e={};let A=!0;return n?.validation?.required&&0===t.length&&(e.required=!0,A=!1),{isValid:A,errors:e}},[n]),b=r(e=>{if(h){const A=y(e),r={id:t,value:e,isValid:A.isValid,errors:A.errors};h(r)}},[t,h,y,B]),v=(t,e)=>{let A;A=e?[...B,t]:B.filter(e=>e!==t),b(A)},C=()=>{f&&f()},x=()=>{w(!0),d&&d()};A(()=>{m&&(l[t]=!0)},[m,t,l]),A(()=>{},[s,t,B]),A(()=>{c&&w(!0)},[c]);const F=o||a||n?.validation?.readonly;return X.jsx(X.Fragment,{children:X.jsx("div",{className:`form-group checkbox-group ${(()=>{const t=n?.styles?.labelAlignment;return"left"===t?"label-left":"label-top"})()} ${n?.basic?.inlineLayout?"inline-layout":"vertical-layout"} ${p}`,children:!g&&n.basic.label?X.jsxs(X.Fragment,{children:[X.jsxs("label",{className:"form-label",children:[n.basic.label,n.validation.required&&X.jsx("span",{className:"required-indicator",children:"*"})]}),X.jsxs("div",{className:"input-wrapper",children:[X.jsx("div",{className:"mt-2 "+(n?.basic?.inlineLayout?"inline-options-grid":"space-y-2"),children:(n.options||[]).map((e,A)=>X.jsxs("div",{className:"form-check",children:[X.jsx("input",{type:"checkbox",id:`${t}-${A}`,name:t,value:e.value,checked:B.includes(e.value),onChange:t=>{v(e.value,t.target.checked)},onFocus:C,onBlur:x,disabled:F||e.disabled,className:"form-check-input"}),X.jsx("label",{htmlFor:`${t}-${A}`,className:"form-check-label",children:e.label})]},A))}),X.jsx(Z,{validationErrors:i,fieldId:t,touchedFields:l,formSubmitted:c,properties:n,localValidation:y(B),isTouched:m,mode:u})]})]}):X.jsxs("div",{className:"input-wrapper",children:[X.jsx("div",{className:"mt-2 "+(n?.basic?.inlineLayout?"inline-options-grid":"space-y-2"),children:(n.options||[]).map((e,A)=>X.jsxs("div",{className:"form-check",children:[X.jsx("input",{type:"checkbox",id:`${t}-${A}`,name:t,value:e.value,checked:B.includes(e.value),onChange:t=>{v(e.value,t.target.checked)},onFocus:C,onBlur:x,disabled:F||e.disabled,className:"form-check-input"}),X.jsx("label",{htmlFor:`${t}-${A}`,className:"form-check-label",children:e.label})]},A))}),X.jsx(Z,{validationErrors:i,fieldId:t,touchedFields:l,formSubmitted:c,properties:n,localValidation:y(B),isTouched:m,mode:u})]})})})},ot=({id:t,properties:n,validationErrors:i={},formValue:s="",readonly:a=!1,disabled:o=!1,touchedFields:l={},formSubmitted:c=!1,mode:u="preview",onValueChange:h,onBlur:d,onFocus:f,className:p="",hideLabel:g=!1})=>{const[m,w]=e(s),[B,y]=e(!1),b=r(t=>{const e={};let A=!0;return!n?.validation?.required||t&&""!==t.trim()||(e.required=!0,A=!1),{isValid:A,errors:e}},[n]),v=r(e=>{if(w(e),h){const A=b(e),r={id:t,value:e,isValid:A.isValid,errors:A.errors};h(r)}},[t,h,b]),C=t=>{v(t)},x=()=>{f&&f()},F=()=>{y(!0),d&&d()};A(()=>{B&&(l[t]=!0)},[B,t,l]),A(()=>{s!==m&&w(s)},[s,m]),A(()=>{c&&y(!0)},[c]);const Q=o||a||n?.validation?.readonly;return X.jsx(X.Fragment,{children:X.jsx("div",{className:`form-group radio-group ${(()=>{const t=n?.styles?.labelAlignment;return"left"===t?"label-left":"label-top"})()} ${n?.basic?.inlineLayout?"inline-layout":"vertical-layout"} ${p}`,children:!g&&n.basic.label?X.jsxs(X.Fragment,{children:[X.jsxs("label",{className:"form-label",children:[n.basic.label,n.validation.required&&X.jsx("span",{className:"required-indicator",children:"*"})]}),X.jsxs("div",{className:"input-wrapper",children:[X.jsx("div",{className:"mt-2 "+(n?.basic?.inlineLayout?"inline-options-grid":"space-y-2"),children:(n.options||[]).map((e,A)=>X.jsxs("div",{className:"form-check",children:[X.jsx("input",{type:"radio",id:`${t}-${A}`,name:t,value:e.value,checked:m===e.value,onChange:()=>C(e.value),onFocus:x,onBlur:F,disabled:Q||e.disabled,className:"form-check-input"}),X.jsx("label",{htmlFor:`${t}-${A}`,className:"form-check-label",children:e.label})]},A))}),X.jsx(Z,{validationErrors:i,fieldId:t,touchedFields:l,formSubmitted:c,properties:n,localValidation:b(m),isTouched:B,mode:u})]})]}):X.jsxs("div",{className:"input-wrapper",children:[X.jsx("div",{className:"mt-2 "+(n?.basic?.inlineLayout?"inline-options-grid":"space-y-2"),children:(n.options||[]).map((e,A)=>X.jsxs("div",{className:"form-check",children:[X.jsx("input",{type:"radio",id:`${t}-${A}`,name:t,value:e.value,checked:m===e.value,onChange:()=>C(e.value),onFocus:x,onBlur:F,disabled:Q||e.disabled,className:"form-check-input"}),X.jsx("label",{htmlFor:`${t}-${A}`,className:"form-check-label",children:e.label})]},A))}),X.jsx(Z,{validationErrors:i,fieldId:t,touchedFields:l,formSubmitted:c,properties:n,localValidation:b(m),isTouched:B,mode:u})]})})})},lt=({id:t,properties:n,validationErrors:i={},formValue:s="",readonly:a=!1,disabled:o=!1,touchedFields:l={},formSubmitted:c=!1,mode:u="preview",onValueChange:h,onBlur:d,onFocus:f,className:p="",hideLabel:g=!1})=>{const[m,w]=e(s),[B,y]=e(!1),b=r(t=>{const e={};let A=!0;return!n?.validation?.required||t&&""!==t.trim()||(e.required=!0,A=!1),{isValid:A,errors:e}},[n]),v=r(e=>{if(w(e),y(!0),h){const A=b(e),r={id:t,value:e,isValid:A.isValid,errors:A.errors};h(r)}},[t,h,b]),C=()=>{f&&f()},x=()=>{y(!0),d&&d()};A(()=>{B&&(l[t]=!0)},[B,t,l]),A(()=>{s!==m&&w(s)},[s,m]),A(()=>{c&&y(!0)},[c]);const F=()=>n?.basic?.inlineLayout?"inline-layout":"grid-layout",Q=t=>{const e=t?.toLowerCase();return"pass"===e||"yes"===e?"pass":"fail"===e||"no"===e?"fail":"pass"},U=t=>{if(void 0!==t?.icon&&""!==t.icon)return t.icon;return"pass"===Q(t?.value||t)?"✓":"×"},E=(t,e)=>t?.color||t?.backgroundColor?{color:e?"#ffffff":t.color||"#00814b",backgroundColor:e?t.color||"#00814b":t.backgroundColor||"#34bd4914",borderColor:t.color||"#00814b"}:{},N=t=>{if(t?.color||t?.backgroundColor)return"segment-button-label segment-button-custom";return"segment-button-label "+("pass"===Q(t?.value||t)?"pass-button":"fail-button")},S=o||a||n?.validation?.readonly;return X.jsxs(X.Fragment,{children:[X.jsx("div",{className:`form-group segment-group ${(()=>{const t=n?.styles?.labelAlignment;return"left"===t?"label-left":"label-top"})()} ${p}`,children:!g&&n.basic.label?X.jsxs(X.Fragment,{children:[X.jsxs("label",{className:"form-label",children:[n.basic.label,n.validation.required&&X.jsx("span",{className:"required-indicator",children:"*"})]}),X.jsx("div",{className:"form-segment-wrapper",children:X.jsx("div",{className:`form-segment-container ${F()}`,children:(n.options||[]).map((e,A)=>{const r=m===e.value,n=E(e,r),i=N(e),s=U(e);return X.jsxs("div",{className:"form-segment-option "+(r?"selected":""),children:[X.jsx("input",{type:"radio",id:`${t}_option_${A}`,name:t,value:e.value,checked:r,onChange:()=>!S&&!e.disabled&&v(e.value),onFocus:C,onBlur:x,disabled:S||e.disabled,className:"form-segment-radio"}),X.jsxs("label",{htmlFor:`${t}_option_${A}`,className:i,style:Object.keys(n).length>0?n:void 0,children:[s&&X.jsx("span",{className:"segment-icon",children:s}),X.jsx("span",{className:"segment-text",children:e.value})]})]},A)})})})]}):X.jsx("div",{className:"form-segment-wrapper",children:X.jsx("div",{className:`form-segment-container ${F()}`,children:(n.options||[]).map((e,A)=>{const r=m===e.value,n=E(e,r),i=N(e),s=U(e);return X.jsxs("div",{className:"form-segment-option "+(r?"selected":""),children:[X.jsx("input",{type:"radio",id:`${t}_option_${A}`,name:t,value:e.value,checked:r,onChange:()=>!S&&!e.disabled&&v(e.value),onFocus:C,onBlur:x,disabled:S||e.disabled,className:"form-segment-radio"}),X.jsxs("label",{htmlFor:`${t}_option_${A}`,className:i,style:Object.keys(n).length>0?n:void 0,children:[s&&X.jsx("span",{className:"segment-icon",children:s}),X.jsx("span",{className:"segment-text",children:e.value})]})]},A)})})})}),X.jsx(Z,{validationErrors:i,fieldId:t,touchedFields:l,formSubmitted:c,properties:n,localValidation:b(m),isTouched:B,mode:u})]})},ct=({id:t,properties:n,validationErrors:i={},formValue:s="",readonly:a=!1,disabled:o=!1,touchedFields:l={},formSubmitted:c=!1,mode:u="preview",onValueChange:h,onBlur:d,onFocus:f,className:p="",hideLabel:g=!1})=>{const m=r(t=>{if(!t)return"";if("string"==typeof t){if(/^\d{4}-\d{2}-\d{2}$/.test(t))return t;if(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(t))return t;const e=tt(t);if(e&&!isNaN(e.getTime())){const t=n.name||"",A=n.basic?.dateTimeMode||("datetime-picker"===t?"datetime":"date");if("datetime"===A){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}T${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`}if("time"===A){return`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`}return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}return t}if(t instanceof Date){if(isNaN(t.getTime()))return"";const e=n.name||"",A=n.basic?.dateTimeMode||("datetime-picker"===e?"datetime":"date");if("datetime"===A){return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}T${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}if("time"===A){return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}if("object"==typeof t&&null!==t){if("value"in t&&t.value)return m(t.value);if("date"in t&&t.date)return m(t.date);try{const e=String(t),A=tt(e);if(A&&!isNaN(A.getTime()))return m(A)}catch(t){}return""}return""},[n]),w=m(s),[B,y]=e(w),[b,v]=e(!1),[C,x]=e(!1),F=r(t=>{const e={};let A=!0;const r=n.name||"",i=n.basic?.dateTimeMode||("datetime-picker"===r?"datetime":"date"),s=t?String(t).trim():"";if(n?.validation?.required&&(!s||""===s))return e.required=!0,A=!1,{isValid:A,errors:e};if(s&&""!==s)if("time"===i){if(!/^([0-1][0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?$/.test(s))return e.invalidDate=!0,A=!1,{isValid:A,errors:e}}else if("datetime"===i){const t=tt(s);if(!t||isNaN(t.getTime()))return e.invalidDate=!0,A=!1,{isValid:A,errors:e};if(n?.validation?.minDate){const r=tt(n.validation.minDate);r&&t<r&&(e.minDate=!0,e.minDateMessage=`Date and time must be on or after ${r.toLocaleDateString()}`,A=!1)}if(n?.validation?.maxDate){const r=tt(n.validation.maxDate);r&&t>r&&(e.maxDate=!0,e.maxDateMessage=`Date and time must be on or before ${r.toLocaleDateString()}`,A=!1)}}else{const t=tt(s);if(!t||isNaN(t.getTime()))return e.invalidDate=!0,A=!1,{isValid:A,errors:e};if(n?.validation?.minDate){const r=tt(n.validation.minDate);r&&t<r&&(e.minDate=!0,e.minDateMessage=`Date must be on or after ${r.toLocaleDateString()}`,A=!1)}if(n?.validation?.maxDate){const r=tt(n.validation.maxDate);r&&t>r&&(e.maxDate=!0,e.maxDateMessage=`Date must be on or before ${r.toLocaleDateString()}`,A=!1)}}return{isValid:A,errors:e}},[n]),Q=r(e=>{if(y(e),h){const A=F(e),r={id:t,value:e,isValid:A.isValid,errors:A.errors};h(r)}},[t,h,F]);A(()=>{b&&(l[t]=!0)},[b,t,l]),A(()=>{const t=m(s);t===B||C||y(t)},[s,B,C,m]),A(()=>{c&&v(!0)},[c]);const U=o||a||n?.validation?.readonly,E=n.name||"",N=n.basic?.dateTimeMode||("datetime-picker"===E?"datetime":"date"),S=(()=>{switch(N){case"time":return"time";case"datetime":return"datetime-local";default:return"date"}})();return X.jsxs("div",{className:`form-group ${(()=>{const t=n?.styles?.labelAlignment;return"left"===t?"label-left":"label-top"})()}`,children:[!g&&n.basic.label&&X.jsxs("label",{htmlFor:t,className:"form-label",children:[n.basic.label,n.validation.required&&X.jsx("span",{className:"required-indicator",children:"*"})]}),X.jsxs("div",{className:"input-wrapper",children:[X.jsx("input",{type:S,id:t,value:B,onChange:t=>{const e=t.target.value;Q(e)},onFocus:()=>{x(!0),f&&f()},onBlur:()=>{if(x(!1),v(!0),h){const e=F(B),A={id:t,value:B,isValid:e.isValid,errors:e.errors};h(A)}d&&d()},disabled:U,readOnly:a||n?.validation?.readonly,min:n?.validation?.minDate,max:n?.validation?.maxDate,className:`form-date ${!F(B).isValid&&b?"is-invalid":""} ${p}`.trim()}),X.jsx(Z,{validationErrors:i,fieldId:t,touchedFields:l,formSubmitted:c,properties:n,localValidation:F(B),isTouched:b,mode:u})]})]})},ut=({id:t,properties:i,validationErrors:s={},formValue:a="",readonly:o=!1,disabled:l=!1,touchedFields:c={},formSubmitted:u=!1,mode:h="preview",onValueChange:d,onBlur:f,onFocus:p,className:g="",hideLabel:m=!1})=>{const w=n(null),[B,y]=e(!1),[b,v]=e(!1),[C,x]=e(a),[F,Q]=e(!1),U=r(t=>{const e={};let A=!0;return!i?.validation?.required||t&&""!==t.trim()||(e.required=!0,A=!1),{isValid:A,errors:e}},[i]),E=r(e=>{if(x(e),d){const A=U(e),r={id:t,value:e,isValid:A.isValid,errors:A.errors};d(r)}},[t,d,U]),N=r(()=>{const t=document.documentElement.classList.contains("dark")||"dark"===document.documentElement.getAttribute("data-theme");let e=getComputedStyle(document.documentElement).getPropertyValue("--df-color-fb-input-bg").trim();e||(e=t?"#2c2e34":"#ffffff");return{strokeColor:t?"#ffffff":"#000000",backgroundColor:e}},[]),S=r(e=>{if(!e)return;const A=w.current;if(!A)return;const r=A.getContext("2d");if(!r)return;const n=new Image;n.onload=()=>{r.clearRect(0,0,A.width,A.height);const t=N();r.fillStyle=t.backgroundColor,r.fillRect(0,0,A.width,A.height);const e=A.width/A.height,i=n.width/n.height;let s=A.width,a=A.height,o=0,l=0;i>e?(a=A.width/i,l=(A.height-a)/2):(s=A.height*i,o=(A.width-s)/2),r.drawImage(n,o,l,s,a)},n.onerror=A=>{console.error("DfFormSignature: error loading image",{id:t,error:A,dataURL:e.substring(0,50)+"..."})},n.src=e},[N,t]),L=r(()=>{const t=w.current;if(!t)return;const e=t.getContext("2d");if(!e)return;const A=t.getBoundingClientRect();t.width=A.width,t.height=A.height,t.style.width=A.width+"px",t.style.height=A.height+"px";const r=N();e.strokeStyle=r.strokeColor,e.lineWidth=2,e.lineCap="round",e.lineJoin="round",C?S(C):(e.fillStyle=r.backgroundColor,e.fillRect(0,0,t.width,t.height))},[C,N,S]),I=r(()=>{setTimeout(()=>{L()},100)},[L]);A(()=>{const t=()=>{I()},e=new MutationObserver(t=>{t.forEach(t=>{if("attributes"===t.type&&"class"===t.attributeName){const e=t.target;e.classList.contains("form-canvas-container")&&(e.classList.contains("mobile-view")||e.classList.contains("tablet-view")||e.classList.contains("desktop-view"))&&I()}})});return e.observe(document.body,{attributes:!0,attributeFilter:["class"],subtree:!0}),window.addEventListener("resize",t),()=>{e.disconnect(),window.removeEventListener("resize",t)}},[I]);const _=r(t=>{const e=w.current;if(!e)return{x:0,y:0};const A=e.getBoundingClientRect(),r=e.width/A.width,n=e.height/A.height,i=t.type.includes("mouse")?t.clientX:t.touches[0].clientX,s=t.type.includes("mouse")?t.clientY:t.touches[0].clientY;return{x:(i-A.left)*r,y:(s-A.top)*n}},[]),k=t=>{if(o||l||i?.validation?.readonly)return;if(t.target.closest(".clear-signature-btn"))return;t.preventDefault(),t.stopPropagation(),y(!0),v(!0);const e=w.current;if(!e)return;const A=e.getContext("2d");if(!A)return;const{x:r,y:n}=_(t),s=N();A.strokeStyle=s.strokeColor,A.lineWidth=2,A.lineCap="round",A.lineJoin="round",A.beginPath(),A.moveTo(r,n)},T=t=>{if(!B)return;t.preventDefault(),t.stopPropagation();const e=w.current;if(!e)return;const A=e.getContext("2d");if(!A)return;const{x:r,y:n}=_(t);A.lineTo(r,n),A.stroke()},H=()=>{if(!B)return;y(!1),Q(!0);const t=w.current;if(t){(t=>{const e=t.getContext("2d");if(!e)return!1;const A=e.getImageData(0,0,t.width,t.height).data;for(let t=0;t<A.length;t+=4){const e=A[t],r=A[t+1],n=A[t+2];if(A[t+3]>0&&(e<255||r<255||n<255))return!0}})(t);const e=t.toDataURL("image/png");x(e),E(e),setTimeout(()=>{Q(!1)},100)}else Q(!1)},O=r(()=>{const t=w.current;if(!t)return;const e=t.getContext("2d");if(!e)return;const A=N();if(e.strokeStyle=A.strokeColor,C){const r=C,n=t.getBoundingClientRect();e.fillStyle=A.backgroundColor,e.fillRect(0,0,n.width,n.height),r&&S(r)}else{const r=t.getBoundingClientRect();e.fillStyle=A.backgroundColor,e.fillRect(0,0,r.width,r.height)}},[N,C,S]);A(()=>{const t=new MutationObserver(t=>{t.forEach(t=>{"attributes"!==t.type||"class"!==t.attributeName&&"data-theme"!==t.attributeName||O()})});return t.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme"]}),()=>{t.disconnect()}},[O]);A(()=>{b&&(c[t]=!0)},[b,t,c]),A(()=>{if(!(a===C||B||F||""!==C&&""===a)){if(a===C)return;x(a),a&&S(a)}},[a,C,B,F]),A(()=>{u&&v(!0)},[u]),A(()=>{if("test"!==h){x("");const t=w.current;if(t){const e=t.getContext("2d");if(e){const A=t.getBoundingClientRect();t.width=A.width,t.height=A.height;const r=N();e.fillStyle=r.backgroundColor,e.fillRect(0,0,A.width,A.height)}}}},[h]),A(()=>{L()},[h]);const P=l||o||i?.validation?.readonly;return X.jsxs("div",{className:`form-group ${(()=>{const t=i?.styles?.labelAlignment;return"left"===t?"label-left":"label-top"})()}`,children:[!m&&i.basic.label&&X.jsxs("label",{htmlFor:t,className:"form-label",children:[i.basic.label,i.validation.required&&X.jsx("span",{className:"required-indicator",children:"*"})]}),X.jsxs("div",{className:"input-wrapper",children:[X.jsxs("div",{className:"signature-container",style:{position:"relative",width:"100%",maxWidth:"100%",overflow:"hidden"},children:[X.jsx("canvas",{ref:w,id:t,className:`form-signature ${!U(C).isValid&&b?"is-invalid":""} ${g}`.trim(),onMouseDown:k,onMouseMove:T,onMouseUp:H,onMouseLeave:H,onTouchStart:k,onTouchMove:T,onTouchEnd:H,onFocus:()=>{p&&p()},onBlur:()=>{f&&f()},style:{width:"100%",height:"150px",border:"2px solid var(--df-color-primary-border)",borderRadius:"6px",cursor:P?"not-allowed":"crosshair",backgroundColor:"var(--df-color-fb-input-bg)",touchAction:"none",userSelect:"none"}}),!P&&X.jsx("button",{type:"button",onClick:t=>(t=>{t?.preventDefault(),t?.stopPropagation();const e=w.current;if(!e)return;const A=e.getBoundingClientRect();e.width=A.width,e.height=A.height;const r=e.getContext("2d");if(!r)return;const n=N();r.fillStyle=n.backgroundColor,r.fillRect(0,0,A.width,A.height),r.strokeStyle=n.strokeColor,r.lineWidth=2,r.lineCap="round",r.lineJoin="round",x(""),E("")})(t),className:"clear-signature-btn",style:{position:"absolute",bottom:"8px",right:"8px",padding:"4px 8px",backgroundColor:"var(--df-color-error-primary)",color:"white",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:"0.75rem",fontWeight:"500",zIndex:10,transition:"all 0.2s ease",minWidth:"60px",minHeight:"28px"},onMouseEnter:t=>{t.currentTarget.style.backgroundColor="var(--df-color-error-dark, #dc2626)",t.currentTarget.style.transform="scale(1.05)"},onMouseLeave:t=>{t.currentTarget.style.backgroundColor="var(--df-color-error-primary)",t.currentTarget.style.transform="scale(1)"},children:"Clear"})]}),X.jsx(Z,{validationErrors:s,fieldId:t,touchedFields:c,formSubmitted:u,properties:i,localValidation:U(C),isTouched:b,mode:h})]})]})},ht=({id:t,properties:i,validationErrors:s={},formValue:a=null,readonly:o=!1,disabled:l=!1,touchedFields:c={},formSubmitted:u=!1,mode:h="test",onValueChange:d,onBlur:f,onFocus:p,className:g="",hideLabel:m=!1})=>{const[w,B]=e([]),[y,b]=e(!1),[v,C]=e(!1),x=n(null),F=r(e=>{if(!e)return[];const A=Array.isArray(e)?e:Array.from(e),r=[],n=(t,e,A)=>{try{return new File(t,e,A)}catch(r){const n=new Blob(t,A);return n.name=e,n.lastModifiedDate=new Date,n.lastModified=Date.now(),n}};return A.forEach((e,A)=>{if(e&&"object"==typeof e&&!(e instanceof File)&&!(e instanceof Blob)){const i=e;if(i.data||i.url||i.name&&i.type){const e=i.name||i.fileName||`file-${A}`,s=i.size||i.fileSize||0,a=i.type||i.fileType||i.mimeType||"";let o;if(i.url)o=i.url;else if(i.data){const t=i.data;if("string"==typeof t)if(t.startsWith("data:"))o=t;else{const e=t.replace(/\s/g,"");if(/^[A-Za-z0-9+/=]+$/.test(e)&&e.length>10){let t=a;t||(t=e.startsWith("/9j/")||e.startsWith("iVBORw0KGgoAAAANSUhEUgAA")?"image/jpeg":e.startsWith("iVBORw0KGgo")?"image/png":e.startsWith("R0lGOD")?"image/gif":e.startsWith("UklGR")?"image/webp":"image/png"),o=`data:${t};base64,${e}`}else o=t}}const l=n([],e,{type:a});return void r.push({file:l,id:`${t}-file-${A}`,size:s,type:a,name:e,preview:o})}}let i,s,a=0,o="",l="";if(e instanceof File||e instanceof Blob){const t=e;if(a=t.size||0,o=t.type||"",l=t.name||`file-${A}`,s=t,o.startsWith("image/"))try{i=URL.createObjectURL(t)}catch(t){console.error("Error creating object URL:",t),i=void 0}}else if("string"==typeof e){const t=e,r=t.replace(/\s/g,""),a=r.length>50&&/^[A-Za-z0-9+/=]+$/.test(r)&&!t.startsWith("http")&&!t.startsWith("https")&&!t.startsWith("data:")&&!t.startsWith("blob:")&&!t.startsWith("/");let c=t;if(a){let t="image/png";r.startsWith("/9j/")||r.startsWith("iVBORw0KGgoAAAANSUhEUgAA")?t="image/jpeg":r.startsWith("iVBORw0KGgo")?t="image/png":r.startsWith("R0lGOD")?t="image/gif":r.startsWith("UklGR")&&(t="image/webp"),c=`data:${t};base64,${r}`}let u="";if(c.startsWith("data:")){const t=c.match(/filename=([^;]+)/i);if(t)u=decodeURIComponent(t[1]);else{const t=c.match(/data:([^;]+)/);if(t){const e=t[1];u=`file-${A+1}.${e.includes("image")?e.includes("jpeg")?"jpg":"png":e.includes("pdf")?"pdf":e.includes("word")?"doc":e.includes("excel")?"xls":"file"}`}else u=`file-${A+1}`}}else if(c.startsWith("http://")||c.startsWith("https://")||c.startsWith("blob:"))try{const e=new URL(t),r=e.pathname.split("/").pop()||"";if(r&&r.includes("."))u=decodeURIComponent(r);else{const t=e.searchParams.get("filename")||e.searchParams.get("name");u=t?decodeURIComponent(t):`file-${A+1}`}}catch(e){const r=t.lastIndexOf("/"),n=r>=0?t.substring(r+1):t,i=n.indexOf("?"),s=i>=0?n.substring(0,i):n;u=s&&s.includes(".")?decodeURIComponent(s):`file-${A+1}`}else u=`file-${A+1}`;if(l=u||`file-${A+1}`,c.startsWith("data:")){const t=c.indexOf(";");o=t>5?c.substring(5,t):"application/octet-stream"}else{const t=c.match(/\.(jpg|jpeg|png|gif|webp|svg|pdf|doc|docx|xls|xlsx|zip|rar)$/i)||l.match(/\.(jpg|jpeg|png|gif|webp|svg|pdf|doc|docx|xls|xlsx|zip|rar)$/i);if(t){o={jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",zip:"application/zip",rar:"application/x-rar-compressed"}[t[1].toLowerCase()]||"application/octet-stream"}else o=a?"image/png":"application/octet-stream"}(c.startsWith("data:image")||c.startsWith("http://")||c.startsWith("https://")||c.startsWith("blob:"))&&(i=c),s=n([],l,{type:o})}else{if(!e||"object"!=typeof e)return;{const t=e;if(l=t.name||t.fileName||`file-${A}`,a=t.size||t.fileSize||0,o=t.type||t.fileType||t.mimeType||"",t.url||t.path)i=t.url||t.path;else if(o.startsWith("image/")&&t.data){const e=t.data;if("string"==typeof e)if(e.startsWith("data:"))i=e;else{const t=e.replace(/\s/g,"");i=/^[A-Za-z0-9+/=]+$/.test(t)&&t.length>50?`data:${o};base64,${t}`:e}else i=void 0}s=n([],l,{type:o})}}r.push({file:s,id:`${t}-file-${A}`,size:a,type:o,name:l,preview:i})}),r},[t]),Q=r(()=>({isValid:!0,errors:{}}),[]),U=r(e=>{if(o||l)return;const A=F(e),r=w.length>0?[...w,...A]:A,n=i?.validation?.maxFiles||1/0,s=r.slice(0,n);if(B(s),C(!0),d){const e=Q(),A={id:t,value:s.map(t=>t.file),isValid:e.isValid,errors:e.errors};d(A)}},[w,i,o,l,d,Q,F,t]),E=t=>{if(0===t)return"0 Bytes";const e=Math.floor(Math.log(t)/Math.log(1024));return parseFloat((t/Math.pow(1024,e)).toFixed(2))+" "+["Bytes","KB","MB","GB"][e]},N=t=>t.startsWith("image/")?"🖼️":t.startsWith("video/")?"🎥":t.startsWith("audio/")?"🎵":t.includes("pdf")?"📄":t.includes("word")||t.includes("document")?"📝":t.includes("excel")||t.includes("spreadsheet")?"📊":t.includes("zip")||t.includes("rar")?"📦":"📁";A(()=>{v&&(c[t]=!0)},[v,t,c]),A(()=>{("edit"===h||"test"===h)&&C(!1)},[h]),A(()=>{const t=F(a);null!=a&&(Array.isArray(a)&&a.length>0||"string"==typeof a&&""!==String(a).trim()||"object"==typeof a&&!Array.isArray(a)&&Object.keys(a).length>0)||0===w.length&&null!=a?B(t):(null==a||Array.isArray(a)&&0===a.length)&&w.length>0&&B([])},[a,F,w.length]),A(()=>{u&&C(!0)},[u]),A(()=>()=>{w.forEach(t=>{if(t.preview&&t.preview.startsWith("blob:"))try{URL.revokeObjectURL(t.preview)}catch(t){console.error("Error revoking object URL:",t)}})},[w]);const S=()=>{const t=i?.styles?.labelAlignment;return"left"===t?"label-left":"label-top"},L=l||o||i?.validation?.readonly,I=i?.validation?.multiple||!1,_=i?.validation?.accept||"*/*",k=i?.validation?.maxFiles||1/0,T=w.length<k&&(I||k>1),H="edit"===h,O="preview"===h||"test"===h,P=w.filter(t=>t.type.startsWith("image/")),D=w.filter(t=>!t.type.startsWith("image/")),M=P.length>0;return O&&M?X.jsxs("div",{className:`form-group ${S()}`,children:[!m&&X.jsxs("label",{htmlFor:t,className:"form-label",children:[i.basic?.label||"Attachments",i.validation?.required&&X.jsx("span",{className:"required-indicator",children:"*"})]}),X.jsxs("div",{className:"file-upload-wrapper",children:[X.jsxs("div",{className:"file-image-display "+(i.basic?.horizontalView?"horizontal-view":"vertical-view"),children:[P.map(t=>X.jsxs("div",{className:"file-image-container",children:[t.preview&&X.jsx("img",{src:t.preview,alt:t.name,className:"file-image-preview"}),X.jsxs("div",{className:"file-image-info",children:[X.jsx("div",{className:"file-name",title:t.name,children:t.name}),X.jsx("div",{className:"file-size",children:E(t.size)})]})]},t.id)),D.length>0&&X.jsxs("div",{className:"file-other-files",children:[X.jsx("div",{className:"file-other-files-label",children:"Other Files:"}),D.map(t=>X.jsxs("div",{className:"file-item-minimal",children:[X.jsx("div",{className:"file-icon",children:N(t.type)}),X.jsxs("div",{className:"file-info",children:[X.jsx("div",{className:"file-name",title:t.name,children:t.name}),X.jsx("div",{className:"file-size",children:E(t.size)})]})]},t.id))]})]}),X.jsx(Z,{validationErrors:s,fieldId:t,touchedFields:c,formSubmitted:u,properties:i,localValidation:Q(),isTouched:v,mode:h})]})]}):X.jsxs("div",{className:`form-group ${S()}`,children:[!m&&X.jsxs("label",{htmlFor:t,className:"form-label",children:[i.basic?.label||"Attachments",i.validation?.required&&X.jsx("span",{className:"required-indicator",children:"*"})]}),X.jsxs("div",{className:"file-upload-wrapper",children:[X.jsxs("div",{className:`file-upload-area ${y?"drag-over":""} ${o?"readonly":""} ${l?"disabled":""} ${g}`.trim(),onDragOver:t=>{t.preventDefault(),o||l||b(!0)},onDragLeave:t=>{t.preventDefault(),b(!1)},onDrop:t=>{if(t.preventDefault(),b(!1),o||l)return;const e=t.dataTransfer.files;e.length>0&&U(e)},onClick:t=>{const e=t.target,A=null!==e.closest(".file-item"),r=null!==e.closest(".file-remove");!H||L||0!==w.length||A||r||x.current?.click()},onFocus:()=>{p&&p()},onBlur:()=>{if(C(!0),"test"===h&&d){const e=Q(),A={id:t,value:w.map(t=>t.file),isValid:e.isValid,errors:e.errors};d(A)}f&&f()},tabIndex:L?-1:0,children:[X.jsx("input",{ref:x,type:"file",id:t,multiple:I,accept:_,onChange:t=>{const e=t.target.files;e&&e.length>0&&(U(e),t.target.value="")},disabled:L,style:{display:"none"}}),0===w.length?X.jsxs("div",{className:"upload-placeholder",onClick:t=>{t.stopPropagation(),H&&!L&&x.current?.click()},children:[X.jsx("div",{className:"upload-icon",children:"📁"}),X.jsx("div",{className:"upload-text",children:i.basic.placeholder&&X.jsx("p",{className:"upload-hint",children:i.basic.placeholder})})]}):X.jsx("div",{className:"file-list "+(i.basic?.horizontalView?"horizontal-view":"vertical-view"),children:w.map(e=>X.jsxs("div",{className:"file-item",children:[X.jsx("div",{className:"file-preview",children:e.preview?X.jsx("img",{src:e.preview,alt:e.name,className:"file-image"}):X.jsx("div",{className:"file-icon",children:N(e.type)})}),X.jsxs("div",{className:"file-info",children:[X.jsx("div",{className:"file-name",title:e.name,children:e.name}),X.jsx("div",{className:"file-size",children:E(e.size)})]}),H&&!L&&X.jsx("button",{type:"button",className:"file-remove",onClick:A=>{A.stopPropagation(),(e=>{if(o||l)return;const A=w.filter(t=>t.id!==e);if(B(A),C(!0),d){const e=Q(),r={id:t,value:A.map(t=>t.file),isValid:e.isValid,errors:e.errors};d(r)}})(e.id)},"aria-label":`Remove ${e.name}`,children:"✕"})]},e.id))})]}),w.length>0&&T&&!L&&H&&X.jsxs("button",{type:"button",className:"file-add-more",onClick:t=>{t.stopPropagation(),!L&&x.current&&H&&(x.current.value="",x.current.click())},"aria-label":"Add more files",children:[X.jsx("svg",{className:"file-add-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:X.jsx("path",{d:"M12 5v14M5 12h14"})}),X.jsx("span",{className:"file-add-text",children:"Add More Files"})]}),X.jsx(Z,{validationErrors:s,fieldId:t,touchedFields:c,formSubmitted:u,properties:i,localValidation:Q(),isTouched:v,mode:h})]})]})},dt=({id:t,properties:i,validationErrors:s={},formValue:o=null,readonly:l=!1,disabled:c=!1,touchedFields:u={},formSubmitted:h=!1,mode:g="test",onValueChange:m,onBlur:w,onFocus:B,className:y="",hideLabel:b=!1})=>{const[v,C]=e(o),[x,F]=e(!1),[Q,U]=e(""),[E,N]=e(!1),[S,L]=e(!1),[I,_]=e({lat:40.7128,lng:-74.006}),[k,T]=e(null),[H,O]=e(10),[P,D]=e(""),[M,j]=e(!1),R=n(null),[K,V]=e(!1),[z,G]=e(null),[q,W]=e(!1);A(()=>{if(o&&o.latitude&&o.longitude){40.7128===o.latitude&&-74.006===o.longitude||(C(o),T({lat:o.latitude,lng:o.longitude,isCurrentLocation:!1}),_({lat:o.latitude,lng:o.longitude}))}else null==o&&(C(null),T(null))},[o]),A(()=>{S&&40.7128===I.lat&&I.lng},[S,I]),A(()=>{(l||c)&&(S&&L(!1),P&&D(""),K&&(V(!1),G(null)))},[l,c]);const Y=r(async(t,e)=>{W(!0);try{const A=await fetch(`https://nominatim.openstreetmap.org/reverse?format=json&lat=${t}&lon=${e}&addressdetails=1&zoom=18`),r=await A.json();if(r&&r.address){const t=r.address;return{placeName:r.display_name||"",city:t.city||t.town||t.village||t.municipality||"",country:t.country||""}}}catch(t){console.error("Reverse geocoding failed:",t)}finally{W(!1)}return{placeName:"",city:"",country:""}},[]),J=r(async(e,A,r)=>{const n=await Y(e,A),i={latitude:e,longitude:A,timestamp:Date.now(),placeName:n.placeName,city:n.city,country:n.country,address:n.placeName,...r};if(C(i),T({lat:e,lng:A,isCurrentLocation:!1}),N(!0),m){m({id:t,value:i,isValid:!0,errors:{}})}},[Y,t,m]),$=r(async()=>{if(l||c)return;F(!0),U("");if(void 0!==window.Capacitor)try{const{Geolocation:t}=window.Capacitor.Plugins;if(t)try{if("granted"!==(await t.requestPermissions()).location)return F(!1),void U("Location permission is required. Please enable location access in your device settings.");const e=await t.getCurrentPosition({enableHighAccuracy:i.validation?.enableHighAccuracy??!0,timeout:i.validation?.timeout??1e4,maximumAge:i.validation?.maximumAge??3e5}),A=e.coords.latitude,r=e.coords.longitude;return T({lat:A,lng:r,isCurrentLocation:!0}),_({lat:A,lng:r}),N(!0),await J(A,r,{accuracy:e.coords.accuracy,timestamp:Date.now()}),F(!1),void U("")}catch(t){return F(!1),void(t.message?.includes("permission")||t.message?.includes("denied")?U("Location permission is required. Please enable location access in your device settings."):t.message?.includes("timeout")?U("Location request timed out. Please try again."):U("Unable to retrieve your location. Please try again."))}}catch(t){console.warn("Capacitor Geolocation not available, falling back to web geolocation")}if(!navigator.geolocation)return F(!1),void U("Geolocation is not supported by this browser.");const t={enableHighAccuracy:i.validation?.enableHighAccuracy??!0,timeout:i.validation?.timeout??1e4,maximumAge:i.validation?.maximumAge??3e5};navigator.geolocation.getCurrentPosition(async t=>{const e=t.coords.latitude,A=t.coords.longitude;T({lat:e,lng:A,isCurrentLocation:!0}),_({lat:e,lng:A}),N(!0),await J(e,A,{accuracy:t.coords.accuracy,timestamp:t.timestamp}),F(!1),U("")},t=>{F(!1);let e="Unable to retrieve your location.";switch(t.code){case t.PERMISSION_DENIED:e="Location access denied by user. Please enable location access in your browser/device settings.";break;case t.POSITION_UNAVAILABLE:e="Location information is unavailable.";break;case t.TIMEOUT:e="Location request timed out. Please try again."}U(e)},t)},[l,c,i,J]),et=r(()=>{if(!l&&!c&&(C(null),T(null),U(""),N(!0),m)){m({id:t,value:null,isValid:!0,errors:{}})}},[l,c,t,m]),At=r(()=>{l||c||L(!S)},[l,c,S]),rt=r((t,e,A,r,n,i)=>{const s=t-n/2,a=e-i/2,o=156543.03392*Math.cos(A.lat*Math.PI/180)/Math.pow(2,r),l=s*o,c=a*o;return{lat:A.lat+c/111320,lng:A.lng+l/(111320*Math.cos(A.lat*Math.PI/180))}},[]),nt=r(t=>{l||c||!R.current||0===t.button&&(V(!0),G({x:t.clientX,y:t.clientY}),t.preventDefault())},[l,c]),it=r(t=>{if(!K||!z||!R.current)return;const e=t.clientX-z.x,A=t.clientY-z.y,r=156543.03392*Math.cos(I.lat*Math.PI/180)/Math.pow(2,H),n=-A*r/111320,i=e*r/(111320*Math.cos(I.lat*Math.PI/180));_({lat:I.lat+n,lng:I.lng+i}),G({x:t.clientX,y:t.clientY})},[K,z,I,H]),st=r(async t=>{if(!R.current)return;if(K&&z){const e=Math.abs(t.clientX-z.x),A=Math.abs(t.clientY-z.y);if(e>5||A>5)return V(!1),void G(null)}if(l||c)return V(!1),void G(null);const e=R.current.getBoundingClientRect(),A=t.clientX-e.left,r=t.clientY-e.top,{lat:n,lng:i}=rt(A,r,I,H,e.width,e.height);await J(n,i),V(!1),G(null)},[l,c,R,I,H,rt,J,K,z]),at=r(async e=>{if(e.trim()&&!l&&!c){j(!0),U("");try{const A=await fetch(`https://nominatim.openstreetmap.org/search?format=json&q=${encodeURIComponent(e)}&limit=5&addressdetails=1`),r=await A.json();if(r&&r.length>0){const e=r[0],A=parseFloat(e.lat),n=parseFloat(e.lon),i=e.address||{},s={latitude:A,longitude:n,address:e.display_name,placeName:e.display_name,city:i.city||i.town||i.village||i.municipality||"",country:i.country||"",timestamp:Date.now()};if(C(s),T({lat:A,lng:n,isCurrentLocation:!1}),_({lat:A,lng:n}),N(!0),m){m({id:t,value:s,isValid:!0,errors:{}})}}else U("No locations found for your search.")}catch(t){U("Failed to search for location. Please try again.")}finally{j(!1)}}},[l,c,t,m]),ot=()=>{B&&B()},lt=()=>{N(!0),w&&w()},ct=c||l||i?.validation?.readonly,ut=i?.basic?.label||"Location",ht=i?.basic?.description||"";return X.jsxs("div",{className:`form-group ${i.basic?.horizontalView?"horizontal-view":"vertical-view"} ${b?"no-label":""} ${y}`,children:[!b&&X.jsxs("label",{htmlFor:t,className:"form-label",children:[ut,i?.validation?.required&&X.jsx("span",{className:"required-indicator",children:"*"})]}),ht&&X.jsx("div",{className:"form-group-description",children:ht}),X.jsxs("div",{className:"location-wrapper",children:[!(l&&v)&&X.jsxs("div",{className:"location-controls",children:[X.jsx("button",{type:"button",className:"location-btn "+(x?"loading":""),onClick:$,disabled:ct||x,onFocus:ot,onBlur:lt,tabIndex:ct?-1:0,children:x?X.jsxs(X.Fragment,{children:[X.jsx(d,{size:16,className:"loading-spinner"}),"Getting Location..."]}):X.jsxs(X.Fragment,{children:[X.jsx(f,{size:16}),"Get Current Location"]})}),X.jsxs("button",{type:"button",className:"location-btn secondary",onClick:At,disabled:ct,onFocus:ot,onBlur:lt,tabIndex:ct?-1:0,children:[X.jsx(p,{size:16}),S?"Hide Map":"Choose on Map"]})]}),v&&X.jsxs("div",{className:"location-display",children:[!l&&X.jsx("button",{type:"button",className:"location-clear-btn",onClick:et,disabled:ct,title:"Clear location",children:X.jsx(a,{size:16})}),v.placeName&&X.jsxs("div",{className:"location-place-name",children:[X.jsx("strong",{children:"Place:"})," ",v.placeName]}),(v.city||v.country)&&X.jsxs("div",{className:"location-address",children:[X.jsx("strong",{children:"Address:"})," ",[v.city,v.country].filter(Boolean).join(", ")]}),X.jsxs("div",{className:"location-coordinates",children:[X.jsx("strong",{children:"Coordinates:"})," ",(ft=v.latitude,pt=v.longitude,void 0===ft||void 0===pt||isNaN(ft)||isNaN(pt)?"":`${Number(ft).toFixed(6)}, ${Number(pt).toFixed(6)}`)]}),v.accuracy&&X.jsxs("div",{className:"location-accuracy",children:[X.jsx("strong",{children:"Accuracy:"})," ",(dt=v.accuracy,dt?`±${Math.round(dt)}m`:"")]}),v.timestamp&&X.jsxs("div",{className:"location-timestamp",children:[X.jsx("strong",{children:"Captured:"})," ",(tt(v.timestamp)||new Date).toLocaleString()]})]}),S&&!l&&X.jsxs("div",{className:"location-map-container",children:[X.jsxs("div",{className:"location-map-header",children:[X.jsx("h4",{children:"Select Location on Map"}),X.jsx("p",{children:"Search for a place or click on the map to select a location"})]}),X.jsx("div",{className:"location-search",children:X.jsx("form",{onSubmit:t=>{t.preventDefault(),P.trim()&&at(P)},className:"search-form",children:X.jsxs("div",{className:"search-input-group",children:[X.jsx("input",{type:"text",value:P,onChange:t=>{D(t.target.value)},placeholder:"Search for a place (e.g., New York, Paris, Tokyo)",className:"search-input",disabled:ct||M}),X.jsx("button",{type:"submit",className:"search-btn",disabled:ct||M||!P.trim(),children:M?X.jsx(d,{size:16,className:"loading-spinner"}):"Search"})]})})}),X.jsxs("div",{ref:R,className:"location-map "+(K?"dragging":""),onMouseDown:nt,onMouseMove:it,onMouseUp:st,onMouseLeave:()=>{V(!1),G(null)},style:{position:"relative",height:"400px",border:"2px solid var(--df-color-fb-border)",borderRadius:"8px",overflow:"hidden",cursor:K?"grabbing":"grab",background:`url(https://tile.openstreetmap.org/${H}/${Math.floor((I.lng+180)/360*Math.pow(2,H))}/${Math.floor((1-Math.log(Math.tan(I.lat*Math.PI/180)+1/Math.cos(I.lat*Math.PI/180))/Math.PI)/2*Math.pow(2,H))}.png) center/cover no-repeat`,userSelect:"none"},children:[k&&X.jsx("div",{className:"map-marker "+(k.isCurrentLocation?"current-location":"selected-location"),style:{position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -100%)",zIndex:10},children:X.jsx(p,{size:24})}),X.jsx("div",{className:"map-center-indicator",style:{position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",width:"4px",height:"4px",backgroundColor:"var(--df-color-primary)",borderRadius:"50%",zIndex:5}}),X.jsxs("div",{className:"map-controls",children:[X.jsx("button",{type:"button",className:"map-zoom-btn",onClick:()=>O(t=>Math.min(18,t+1)),disabled:H>=18,children:"+"}),X.jsx("button",{type:"button",className:"map-zoom-btn",onClick:()=>O(t=>Math.max(1,t-1)),disabled:H<=1,children:"−"})]})]}),X.jsxs("div",{className:"location-map-instructions",children:[X.jsx("p",{children:X.jsx("strong",{children:"Instructions:"})}),X.jsxs("ul",{children:[X.jsx("li",{children:"Search for a place using the search box above"}),X.jsx("li",{children:"Click anywhere on the map to select a location"}),X.jsx("li",{children:"Drag the map to pan around"}),X.jsx("li",{children:"Use the zoom buttons (+/−) to zoom in/out"}),X.jsx("li",{children:'Use "Get Current Location" to automatically detect your position'})]})]}),q&&X.jsxs("div",{className:"location-loading",children:[X.jsx(d,{size:16,className:"loading-spinner"}),X.jsx("span",{children:"Loading address details..."})]})]}),Q&&X.jsx("div",{className:"location-error",children:Q})]}),X.jsx(Z,{validationErrors:s,fieldId:t,touchedFields:u,formSubmitted:h,properties:i,localValidation:{isValid:!0,errors:{}},isTouched:E,mode:g})]});var dt,ft,pt},ft=({id:t,properties:e,className:A="",hideLabel:r=!1})=>{const n=e.styles?.level??e.basic.level??1,i=e.basic.label,s=()=>{const t={};return e?.styles?.fontSize&&(t.fontSize=e.styles.fontSize),e?.styles?.color&&(t.color=e.styles.color),t};return r?null:(()=>{const r={id:t,className:`form-heading h${n} ${e?.styles?.textAlign?`text-${e.styles.textAlign}`:""} ${A}`.trim(),style:s()};switch(n){case 1:default:return X.jsx("h1",{...r,children:i});case 2:return X.jsx("h2",{...r,children:i});case 3:return X.jsx("h3",{...r,children:i});case 4:return X.jsx("h4",{...r,children:i});case 5:return X.jsx("h5",{...r,children:i});case 6:return X.jsx("h6",{...r,children:i})}})()},pt=({id:t,properties:i,mode:s="preview",formValue:a,onValueChange:o,className:l="",hideLabel:c=!1})=>{const[u,h]=e(""),[d,f]=e(i.validation?.listStyle||"numbers"),[p,b]=e("#000000"),v=n(null),C=n(null),x=n(!1),F="edit"===s,Q=n({instructions:[],listStyle:"numbers",formValue:void 0}),U=n(s);A(()=>{let t=[],e="numbers";if(null!=a&&("object"==typeof a&&a.instructions?(Array.isArray(a.instructions)?t=a.instructions:"string"==typeof a.instructions&&(t=[a.instructions]),a.listStyle&&(e=a.listStyle)):Array.isArray(a)?t=a:"string"==typeof a&&(t=[a])),0===t.length&&i.basic?.value){const A=i.basic.value;A&&"object"==typeof A&&!Array.isArray(A)&&A.instructions?(Array.isArray(A.instructions)?t=A.instructions:"string"==typeof A.instructions&&(t=[A.instructions]),A.listStyle&&"string"==typeof A.listStyle&&(e=A.listStyle)):Array.isArray(A)?t=A:"string"==typeof A&&(t=[A])}0===t.length&&i.basic?.instructions&&(Array.isArray(i.basic.instructions)?t=i.basic.instructions:"string"==typeof i.basic.instructions&&(t=[i.basic.instructions])),e&&"numbers"!==e||(e=i.validation?.listStyle||i.basic?.value?.listStyle||"numbers");const A=JSON.stringify(t)!==JSON.stringify(Q.current.instructions)||e!==Q.current.listStyle,r=s!==U.current,n=JSON.stringify(a)!==JSON.stringify(Q.current.formValue),o=!Q.current.formValue||Array.isArray(Q.current.formValue)&&0===Q.current.formValue.length||"string"==typeof Q.current.formValue&&""===Q.current.formValue.trim(),l=null!=a&&(Array.isArray(a)&&a.length>0||"string"==typeof a&&""!==a.trim()||"object"==typeof a&&Object.keys(a).length>0);if(A||r||n||o&&l){const n=t=>"string"!=typeof t?t:t.replace(/\\u([0-9a-fA-F]{4})/g,(t,e)=>String.fromCharCode(parseInt(e,16))),i=t.map(t=>"string"==typeof t?n(t):t),o=i.some(t=>"string"==typeof t&&/<[^>]+>/.test(t));let l="";if(i.length>0)if(o)l=i.join("");else{const t="numbers"===e?"ol":"bullets"===e?"ul":"div",A=i.filter(t=>t&&"string"==typeof t).map(t=>`<li>${t.replace(/\n/g,"<br>")}</li>`).join("");l="div"===t?i.filter(t=>t&&"string"==typeof t).map(t=>`<div>${t.replace(/\n/g,"<br>")}</div>`).join(""):`<${t}>${A}</${t}>`}f(e),h(l),F&&v.current&&(r||A&&v.current.innerHTML.trim()!==l.trim())&&(v.current.innerHTML=l),Q.current={instructions:t,listStyle:e,formValue:a},U.current=s}},[a,i.basic?.instructions,i.validation?.listStyle,s,F]),A(()=>{if(F&&v.current){const t=v.current.innerHTML.trim();u.trim()===t||x.current||(v.current.innerHTML=u)}if(x.current){const t=setTimeout(()=>{x.current=!1},200);return()=>clearTimeout(t)}},[u,F]);const E=r(()=>{if(!v.current)return;x.current=!0;const e=v.current.innerHTML.trim();if(o){o({id:t,value:{instructions:e?[e]:[],listStyle:d},isValid:!0,errors:{}})}e!==u&&h(e)},[t,d,o,u]),N=r(()=>{if(!v.current)return;const e=v.current.innerHTML.trim();if(o){o({id:t,value:{instructions:e?[e]:[],listStyle:d},isValid:!0,errors:{}})}h(e),x.current=!1},[t,d,o]),S=r((t,e)=>{document.execCommand(t,!1,e),v.current?.focus(),E()},[E]),L=r(()=>{S("bold")},[S]),I=r(()=>{S("italic")},[S]),_=r(t=>{const e=t.target.value;b(e),S("foreColor",e)},[S]),k=r(e=>{if(f(e),!v.current)return;const A=window.getSelection(),r=A&&A.rangeCount>0?A.getRangeAt(0):null;let n=v.current.innerHTML;if("numbers"===e){if(n=n.replace(/<ul>/gi,"<ol>").replace(/<\/ul>/gi,"</ol>"),!n.includes("<ol>")&&!n.includes("<ul>")){const t=n.split(/<br\s*\/?>/i).filter(t=>t.trim());t.length>0&&(n="<ol>"+t.map(t=>`<li>${t}</li>`).join("")+"</ol>")}}else if("bullets"===e){if(n=n.replace(/<ol>/gi,"<ul>").replace(/<\/ol>/gi,"</ul>"),!n.includes("<ol>")&&!n.includes("<ul>")){const t=n.split(/<br\s*\/?>/i).filter(t=>t.trim());t.length>0&&(n="<ul>"+t.map(t=>`<li>${t}</li>`).join("")+"</ul>")}}else n=n.replace(/<\/?[ou]l>/gi,"").replace(/<li>/gi,"<div>").replace(/<\/li>/gi,"</div>");if(v.current.innerHTML=n,h(n),r&&A)try{A.removeAllRanges(),A.addRange(r)}catch(t){}if(E(),o){o({id:t,value:{instructions:n?[n]:[],listStyle:e},isValid:!0,errors:{}})}},[t,E,o]),T=r(t=>{const e=t.target.files?.[0];if(!e||!e.type.startsWith("image/"))return;const A=new FileReader;A.onload=t=>{const e=t.target?.result;if(e&&v.current){const t=document.createElement("img");t.src=e,t.style.maxWidth="100%",t.style.height="auto";const A=window.getSelection();if(A&&A.rangeCount>0){const e=A.getRangeAt(0);e.deleteContents(),e.insertNode(t)}else v.current.appendChild(t);E()}},A.readAsDataURL(e),C.current&&(C.current.value="")},[E]),H=r(t=>{t.preventDefault();const e=t.clipboardData.getData("text/plain"),A=window.getSelection();if(A&&A.rangeCount>0){const t=A.getRangeAt(0);t.deleteContents();const r=document.createTextNode(e);t.insertNode(r),t.setStartAfter(r),t.collapse(!0),A.removeAllRanges(),A.addRange(t)}E()},[E]),O=r(t=>document.queryCommandState(t),[]);return X.jsxs("div",{className:`form-group instruction-group ${l}`,children:[!c&&X.jsx("label",{htmlFor:t,className:"instruction-label",children:"Instructions"}),F?X.jsxs("div",{className:"instruction-rich-editor",children:[X.jsxs("div",{className:"instruction-toolbar",children:[X.jsxs("div",{className:"toolbar-group",children:[X.jsx("button",{type:"button",className:"toolbar-btn "+(O("bold")?"active":""),onClick:L,title:"Bold","aria-label":"Bold",children:X.jsx(g,{size:16})}),X.jsx("button",{type:"button",className:"toolbar-btn "+(O("italic")?"active":""),onClick:I,title:"Italic","aria-label":"Italic",children:X.jsx(m,{size:16})})]}),X.jsx("div",{className:"toolbar-separator"}),X.jsx("div",{className:"toolbar-group",children:X.jsxs("div",{className:"color-picker-wrapper",children:[X.jsx("input",{type:"color",value:p,onChange:_,className:"color-picker-input",title:"Text Color"}),X.jsx("label",{className:"color-picker-label",title:"Text Color",children:X.jsx("span",{style:{color:p},children:"A"})})]})}),X.jsx("div",{className:"toolbar-separator"}),X.jsxs("div",{className:"toolbar-group",children:[X.jsx("button",{type:"button",className:"toolbar-btn "+("bullets"===d?"active":""),onClick:()=>k("bullets"),title:"Bullet List","aria-label":"Bullet List",children:X.jsx(w,{size:16})}),X.jsx("button",{type:"button",className:"toolbar-btn "+("numbers"===d?"active":""),onClick:()=>k("numbers"),title:"Numbered List","aria-label":"Numbered List",children:X.jsx(B,{size:16})})]}),X.jsx("div",{className:"toolbar-separator"}),X.jsxs("div",{className:"toolbar-group",children:[X.jsx("button",{type:"button",className:"toolbar-btn",onClick:()=>C.current?.click(),title:"Insert Image","aria-label":"Insert Image",children:X.jsx(y,{size:16})}),X.jsx("input",{ref:C,type:"file",accept:"image/*",onChange:T,style:{display:"none"}})]})]}),X.jsx("div",{ref:v,contentEditable:!0,className:"instruction-editor-content",onInput:E,onBlur:N,onPaste:H,"data-placeholder":"Enter instructions (press Enter for a new line)...",suppressContentEditableWarning:!0})]}):X.jsx("div",{className:"instruction-preview-wrapper "+("numbers"===d?"instruction-list-numbers":"bullets"===d?"instruction-list-bullets":""),children:u?X.jsx("div",{className:"instruction-preview-content",dangerouslySetInnerHTML:{__html:u}}):X.jsx("div",{className:"instruction-empty",children:X.jsx("p",{children:"No instructions provided"})})})]})},gt=({attachments:t,onRemove:r})=>{const[n,i]=e(new Map);return A(()=>{if(!t)return void i(t=>(t.forEach(t=>URL.revokeObjectURL(t)),new Map));const e=new Map;return t.forEach((t,A)=>{if((t instanceof Blob||"undefined"!=typeof File&&t instanceof File)&&t&&t.type&&"string"==typeof t.type&&t.type.startsWith("image/"))try{const r=URL.createObjectURL(t);e.set(A,r)}catch(t){console.warn("Failed to create object URL for attachment:",t)}else t&&t.url&&t.type&&t.type.startsWith("image/")&&e.set(A,t.url)}),i(t=>(t.forEach((t,A)=>{e.has(A)||URL.revokeObjectURL(t)}),e)),()=>{e.forEach(t=>URL.revokeObjectURL(t))}},[t]),t&&0!==t.length?X.jsx("div",{className:"attachment-thumbnails-container",children:t.map((t,e)=>{const A=t&&t.type&&"string"==typeof t.type&&t.type.startsWith("image/"),i=n.get(e);return X.jsx("div",{className:"attachment-thumbnail",children:A&&i?X.jsxs(X.Fragment,{children:[X.jsx("img",{src:i,alt:t?t.name:"Attachment"}),X.jsx("button",{type:"button",className:"thumbnail-remove-btn",onClick:()=>r(e),title:"Remove attachment",children:X.jsx(a,{size:14})})]}):X.jsxs(X.Fragment,{children:[X.jsx("div",{className:"file-icon-placeholder",children:X.jsx(h,{size:20})}),X.jsx("span",{className:"file-name",children:t?t.name:"Unknown File"}),X.jsx("button",{type:"button",className:"thumbnail-remove-btn",onClick:()=>r(e),title:"Remove attachment",children:X.jsx(a,{size:14})})]})},e)})}):null},mt=({component:t,mode:i,formTemplateId:s,formValue:a,formData:o,onNotesChange:l,onAttachmentChange:u,notes:d="",attachments:f=null,onThresholdActionCompletion:p,onThresholdIssueRaised:g,onBasicPropertyActionCompletion:m,workOrderNumber:w,assetNumber:B,isStandalone:y,user:Q,onCreateIssue:U,onUpdateIssue:E})=>{const N=void 0!==a?a:o?o[t.id]:void 0,[S,L]=e(d||""),[I,_]=e(f||null),[k,T]=e(!1),[H,O]=e(!1),[P,D]=e(!1),[M,j]=e(!1),[R,K]=e(null),[V,z]=e(!1),G=n(null),q=n(N),W=n(!1),Y=n(!1);A(()=>{d&&d!==S&&!W.current&&(L(d),W.current=!0)},[d,S]),A(()=>{f&&f!==I&&!Y.current&&(_(f),Y.current=!0)},[f,I]),A(()=>{if(W.current&&!k&&null!=d){const t="string"==typeof d?d:String(d||"");S&&""!==String(S||"").trim()||!t||""===t.trim()?t&&""!==t.trim()&&t!==S&&L(t):L(t)}},[d,k,S]),A(()=>{Y.current&&void 0!==f&&(!I||f&&f.length>0&&f!==I)&&_(f)},[f,I]),A(()=>{const e=["select","radio","checkbox","segment"].includes(t.name||"");if(e){const e=q.current,A=N;let r=!1;if("checkbox"===t.name){const t=Array.isArray(e)?e:e?[e]:[],n=Array.isArray(A)?A:A?[A]:[];r=JSON.stringify(t.sort())!==JSON.stringify(n.sort())}else r=e!==A&&void 0!==e;r&&(D(!1),j(!1),K(null),O(!1),T(!1),z(!1),d&&""!==d.trim()||L(""),f&&0!==f.length||_(null)),q.current=A}e||(q.current=N)},[N,t.name,d,f]);const J=r((t,e)=>{const{operator:A,value:r}=t,n=String(e).toLowerCase(),i=String(r).toLowerCase();switch(A){case"equals":return n===i||String(e)===String(r);case"notEquals":return n!==i&&String(e)!==String(r);case"greaterThan":return Number(e)>Number(r);case"lessThan":return Number(e)<Number(r);case"greaterThanOrEqual":return Number(e)>=Number(r);case"lessThanOrEqual":return Number(e)<=Number(r);default:return!1}},[]),$=r(()=>{if(!(null!=N&&""!==N&&!(Array.isArray(N)&&0===N.length)))return[];const e=t.condition;if(!e||!e.conditions||0===e.conditions.length)return[];const A=[];if("checkbox"===t.name&&Array.isArray(N))N.forEach(t=>{const r=e.conditions.find(e=>J(e,t));r&&!A.find(t=>t.id===r.id)&&A.push(r)});else{const t=e.conditions.find(t=>J(t,N));t&&A.push(t)}return A},[t,N,J]),Z=r(e=>{const A=e.target.value;L(A),l&&l(A);const r=$(),n=A.trim().length>0;r.forEach(t=>{!0===t.enableNotes&&p&&p(t.id,"notes",n)});const i=t.condition;!(i&&i.conditions&&i.conditions.length>0)&&m&&m("notes",n)},[l,$,p,t,m]),tt=r(()=>{if(l){const t="string"==typeof S?S:String(S||"");l(t),setTimeout(()=>{T(!1)},0)}else T(!1)},[S,l]),et=r(()=>{tt()},[tt]),rt=r(t=>{(t.ctrlKey||t.metaKey)&&"Enter"===t.key&&(t.preventDefault(),tt())},[tt]),nt=r(()=>{T(!0)},[]),it=r(()=>{T(!0)},[]),st=r(()=>{G.current?.click()},[]),at=r(e=>{const A=e.target.files;if(A&&A.length>0){const e=Array.from(A);_(e),u&&u(e);$().forEach(t=>{!0===t.enableAttachment&&p&&p(t.id,"attachments",!0)});const r=t.condition;!(r&&r.conditions&&r.conditions.length>0)&&m&&m("attachments",!0)}G.current&&(G.current.value="")},[u,$,p,t,m]),ot=r(e=>{if(I){const A=I.filter((t,A)=>A!==e);if(0===A.length){_(null),u&&u(null);$().forEach(t=>{!0===t.enableAttachment&&p&&p(t.id,"attachments",!1)});const e=t.condition;!(e&&e.conditions&&e.conditions.length>0)&&m&&m("attachments",!1)}else _(A),u&&u(A)}},[I,u,$,p,t,m]),lt=r(()=>{D(!0);$().forEach(t=>{!0===t.enableSendEmail&&p&&p(t.id,"email",!0)});const e=t.condition;!(e&&e.conditions&&e.conditions.length>0)&&m&&m("email",!0),setTimeout(()=>{D(!1)},3e3)},[$,p,t,m]),ct=r(()=>{M||O(!0)},[M]),ut=r(()=>{O(!1)},[]),ht=r(e=>{O(!1),j(!0),e&&K(e);const A=t.condition;if(A&&A.conditions&&A.conditions.length>0){$().forEach(t=>{!0===t.enableRaiseIssue&&g&&g(t.id)})}else m&&m("issue",!0)},[t,m,$,g]);if("test"!==i)return null;const dt=["select","radio","checkbox","segment"].includes(t.name||""),ft=t.basic?.options||t.options||[];let pt=!1,mt=!1,wt=!1,Bt=!1,yt=null;const bt=null!=N&&""!==N&&!(Array.isArray(N)&&0===N.length),vt=t.condition,Ct=vt&&vt.conditions&&vt.conditions.length>0;if(Ct&&bt)if("checkbox"===t.name&&Array.isArray(N)){const t=N;for(const e of t){const t=vt.conditions.find(t=>J(t,e));t&&(pt=pt||!0===t.enableNotes,mt=mt||!0===t.enableAttachment,wt=wt||!0===t.enableRaiseIssue,Bt=Bt||!0===t.enableSendEmail)}}else if(dt){const t=vt.conditions.find(t=>J(t,N));t&&(pt=!0===t.enableNotes,mt=!0===t.enableAttachment,wt=!0===t.enableRaiseIssue,Bt=!0===t.enableSendEmail)}else{const t=vt.conditions.find(t=>J(t,N));t&&(pt=!0===t.enableNotes,mt=!0===t.enableAttachment,wt=!0===t.enableRaiseIssue,Bt=!0===t.enableSendEmail)}if(!Ct){const e=t.basic,A=!0===e?.enableNotes,r=!0===e?.enableAttachment,n=!0===e?.enableRaiseIssue,i=!0===e?.enableSendEmail;if(dt)if(bt)if("checkbox"===t.name){(Array.isArray(N)?N:[N]).forEach(t=>{const e=ft.find(e=>!(!e||!e.value)&&(e.value===t||(String(e.value)===String(t)||(e.label===t||String(e.label)===String(t)))));e&&(pt=pt||!0===e.enableNotes,mt=mt||!0===e.enableAttachment,wt=wt||!0===e.enableRaiseIssue,Bt=Bt||!0===e.enableSendEmail,yt||(yt=e))}),pt=pt||A,mt=mt||r,wt=wt||n,Bt=Bt||i}else if(yt=ft.find(t=>!(!t||!t.value)&&(t.value===N||(String(t.value)===String(N)||(t.label===N||String(t.label)===String(N))))),yt){const t=!0===yt.enableNotes,e=!0===yt.enableAttachment,s=!0===yt.enableRaiseIssue,a=!0===yt.enableSendEmail;pt=t||A,mt=e||r,wt=s||n,Bt=a||i}else pt=A,mt=r,wt=n,Bt=i;else pt=A,mt=r,wt=n,Bt=i;else pt=A,mt=r,wt=n,Bt=i}if(!(pt||mt||wt||Bt))return null;const xt=$(),Ft=t.condition,Qt=Ft&&Ft.conditions&&Ft.conditions.length>0,Ut=!!Qt&&xt.some(t=>!0===t.enableNotes),Et=!!Qt&&xt.some(t=>!0===t.enableAttachment),Nt=!!Qt&&xt.some(t=>!0===t.enableSendEmail),St=!!Qt&&xt.some(t=>!0===t.enableRaiseIssue),Lt=S.trim().length>0,It=I&&I.length>0,_t=I?I.length:0;return X.jsxs(X.Fragment,{children:[X.jsxs("div",{className:"component-action-features",children:[X.jsxs("div",{className:"action-icons-toolbar",children:[pt&&X.jsxs("button",{type:"button",className:`action-icon-button ${Lt?"active":""} ${Ut?"mandatory":""}`,onClick:nt,title:"Add Notes",children:[X.jsx(c,{size:14,fill:Lt?"currentColor":"none"}),Ut&&X.jsx("span",{className:"mandatory-indicator",children:"*"})]}),mt&&X.jsxs("button",{type:"button",className:`action-icon-button ${It?"active":""} ${Et?"mandatory":""}`,onClick:st,title:"Add Attachment",children:[X.jsx(h,{size:14,fill:It?"currentColor":"none"}),_t>0&&X.jsx("span",{className:"attachment-count-badge",children:_t}),Et&&X.jsx("span",{className:"mandatory-indicator",children:"*"})]}),Bt&&X.jsxs("button",{type:"button",className:`action-icon-button ${P?"active sent":""} ${Nt?"mandatory":""}`,onClick:lt,disabled:P,title:"Send Email",children:[P?X.jsx(X.Fragment,{children:X.jsx(b,{size:14})}):X.jsx(v,{size:14,fill:P?"currentColor":"none"}),Nt&&X.jsx("span",{className:"mandatory-indicator",children:"*"})]}),wt&&X.jsxs("button",{type:"button",className:`action-icon-button ${M?"active":""} ${St?"mandatory":""}`,onClick:ct,title:"Raise an Issue",children:[X.jsx(C,{size:14,fill:M?"currentColor":"none"}),St&&X.jsx("span",{className:"mandatory-indicator",children:"*"})]}),(Lt&&pt||It&&mt)&&X.jsx("button",{type:"button",className:"action-icon-button accordion-toggle",onClick:()=>z(!V),title:V?"Collapse":"Expand",children:V?X.jsx(x,{size:14}):X.jsx(F,{size:14})})]}),k&&pt&&X.jsxs("div",{className:"notes-input-overlay",children:[X.jsx("textarea",{className:"action-notes-textarea",value:S,onChange:Z,onBlur:et,onKeyDown:rt,placeholder:"Explain which protocols were not followed (Press Ctrl+Enter to save)",rows:4,autoFocus:!0}),X.jsxs("div",{className:"notes-input-actions",children:[X.jsx("button",{type:"button",className:"notes-save-button",onClick:tt,title:"Save notes (Ctrl+Enter)",children:"Save"}),X.jsx("button",{type:"button",className:"notes-cancel-button",onClick:()=>{T(!1)},title:"Cancel",children:"Cancel"})]})]}),V&&X.jsxs("div",{className:"actions-content",children:[!k&&Lt&&pt&&X.jsx("div",{className:"notes-summary-section",children:X.jsxs("div",{className:"notes-full-text",onClick:it,children:[X.jsx("span",{className:"notes-label",children:"Notes:"})," ",S]})}),It&&mt&&X.jsx("div",{className:"attachments-section",children:X.jsx(gt,{attachments:I,onRemove:ot})})]}),mt&&X.jsx("input",{ref:G,type:"file",multiple:!0,accept:"image/*,.pdf",onChange:at,style:{display:"none"}})]}),H&&X.jsx(At,{isOpen:H,onClose:ut,onSuccess:ht,issue:R,component:(()=>{const e=null!=N?Array.isArray(N)?N.join(", "):String(N):t.basic?.value||"",A={...t,basic:{...t.basic||{},value:e}};return yt&&(A.basic.label=`${t.basic?.label||"Component"} - ${yt.label||yt.value}`,A.basic.value=yt.value||e),A})(),formTemplateId:s||"",notes:S,attachments:I,isStandalone:y,workOrderNumber:w,assetNumber:B,user:Q,onCreateIssue:U,onUpdateIssue:E})]})},wt=({attachments:t})=>t&&0!==t.length?X.jsx("div",{className:"attachment-thumbnails-container",children:t.map((t,e)=>{const A=t.type?.startsWith("image/")||!1,r=A?(t=>t.data?t.data.startsWith("data:")?t.data:`data:${t.type||"image/png"};base64,${t.data}`:"")(t):"";return X.jsx("div",{className:"attachment-thumbnail",children:A&&r?X.jsx("img",{src:r,alt:t.name||`Attachment ${e+1}`}):X.jsxs("div",{className:"file-icon-placeholder",children:[X.jsx(h,{size:20}),X.jsx("span",{className:"file-name",children:t.name||`File ${e+1}`})]})},e)})}):null,Bt=({component:t})=>{const e=t.basic?.notes||"",A=t.basic?.attachments||[],r=e&&e.trim().length>0,n=A&&A.length>0;return r||n?X.jsx("div",{className:"component-submission-actions",children:X.jsxs("div",{className:"actions-content",children:[r&&X.jsx("div",{className:"notes-summary-section",children:X.jsxs("div",{className:"notes-full-text",children:[X.jsx("span",{className:"notes-label",children:"Notes:"})," ",e]})}),n&&X.jsx("div",{className:"attachments-section",children:X.jsx(wt,{attachments:A})})]})}):null},yt=({component:t,selectedComponent:e,mode:A,onComponentSelect:r,onComponentDelete:n,onComponentEdit:i,renderFormComponent:s,isOverlay:a=!1,formData:o={},formTemplateId:l,onThresholdActionCompletion:c,onThresholdIssueRaised:u,onNotesChange:h,onAttachmentChange:d,workOrderNumber:f,assetNumber:p,user:g,onCreateIssue:m,onUpdateIssue:w})=>{const B=o[t.id],y="preview"===A&&(t.basic?.notes&&t.basic.notes.trim().length>0||t.basic?.attachments&&Array.isArray(t.basic.attachments)&&t.basic.attachments.length>0),{attributes:b,listeners:v,setNodeRef:C,transform:x,transition:F,isDragging:Q,isSorting:U}=O({id:t.id,disabled:a}),L={transform:D.Transform.toString(x),transition:F,opacity:Q?.3:1,zIndex:Q?1e3:"auto"};return X.jsxs("div",{ref:C,style:{...L,border:e?.id===t.id?"2px solid #3b82f6":"1px solid var(--df-color-fb-border)",borderRadius:"8px",backgroundColor:"var(--df-color-fb-container)",padding:"12px",position:"relative",minHeight:"80px",transition:"all 0.2s ease",boxShadow:e?.id===t.id?"0 4px 12px rgba(59, 130, 246, 0.15)":"0 1px 3px rgba(0, 0, 0, 0.1)",cursor:"pointer"},className:`form-component grid-component ${e?.id===t.id?"selected":""} ${Q?"dragging":""} ${U?"sorting":""}`,onClick:()=>!Q&&r(t),role:"button",tabIndex:0,children:["edit"===A&&X.jsx("div",{className:"component-drag-handle",...v,...b,onClick:t=>t.stopPropagation(),style:{position:"absolute",top:"50%",left:"4px",transform:"translateY(-50%)",padding:"4px",backgroundColor:"#f3f4f6",borderRadius:"4px",cursor:"grab",opacity:1,zIndex:10,display:"flex",alignItems:"center",justifyContent:"center"},children:X.jsx(E,{size:12,color:"var(--df-color-text-light)"})}),X.jsxs("div",{className:"component-content",style:{paddingTop:"edit"===A?"24px":"0",paddingLeft:"edit"===A?"28px":"0",minHeight:"60px"},children:[s(t),!["section","table","heading","file","instructions","signature","location","datagrid"].includes(t.name)&&X.jsx(mt,{component:t,mode:"test",formTemplateId:l,formValue:B,formData:o,onThresholdActionCompletion:c,onThresholdIssueRaised:u,onNotesChange:h?e=>h(t.id,e):void 0,onAttachmentChange:d?e=>d(t.id,e):void 0,workOrderNumber:f,assetNumber:p,user:g,onCreateIssue:m,onUpdateIssue:w}),y&&X.jsx(Bt,{component:t})]}),"edit"===A&&X.jsxs("div",{className:"component-actions",style:{position:"absolute",top:"4px",right:"4px",display:"flex",gap:"4px",opacity:1,zIndex:10},children:[i&&X.jsx("button",{className:"component-edit-btn",onClick:e=>{e.stopPropagation(),i(t)},type:"button",title:"Edit Component",style:{padding:"4px",backgroundColor:"#3b82f6",color:"#ffffff",border:"none",borderRadius:"4px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease"},onMouseEnter:t=>{t.currentTarget.style.backgroundColor="#2563eb"},onMouseLeave:t=>{t.currentTarget.style.backgroundColor="#3b82f6"},children:X.jsx(N,{size:12})}),X.jsx("button",{className:"component-delete-btn",onClick:e=>{e.stopPropagation(),n(t,e)},type:"button",title:"Delete Component",style:{padding:"4px",backgroundColor:"#ef4444",color:"#ffffff",border:"none",borderRadius:"4px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease"},onMouseEnter:t=>{t.currentTarget.style.backgroundColor="#dc2626"},onMouseLeave:t=>{t.currentTarget.style.backgroundColor="#ef4444"},children:X.jsx(S,{size:12})})]})]})},bt=({gridComponents:t,mode:e,onComponentSelect:A,onComponentDelete:r,onComponentEdit:n,onComponentUpdate:i,selectedComponent:s,renderFormComponent:a,gridId:o,formData:l={},formTemplateId:c,onThresholdActionCompletion:u,onThresholdIssueRaised:h,onNotesChange:d,onAttachmentChange:f,workOrderNumber:p,assetNumber:g,user:m,onCreateIssue:w,onUpdateIssue:B})=>{const{setNodeRef:y,isOver:b}=k({id:`grid-drop-zone-${o}`,disabled:"edit"!==e});return X.jsx("div",{ref:y,className:"grid-drop-zone",style:{border:b?"2px dashed #3b82f6":"2px dashed #d1d5db",borderRadius:"8px",padding:"16px",backgroundColor:b?"var(--df-color-primary-light)":"var(--df-color-fb-container)",minHeight:"120px",transition:"all 0.2s ease",position:"relative"},children:t.length>0?X.jsxs(X.Fragment,{children:[X.jsx(T,{items:t.map(t=>t.id),strategy:H,children:X.jsx("div",{style:{display:"flex",flexDirection:"row",flexWrap:"nowrap",gap:"12px",alignItems:"start",marginBottom:t.length>0?"12px":"0",overflowX:"auto",width:"100%"},children:t.map(t=>X.jsx("div",{style:{flex:"1 1 0",minWidth:"200px",maxWidth:"100%"},children:X.jsx(yt,{component:t,selectedComponent:s,mode:e,onComponentSelect:A,onComponentDelete:r,onComponentEdit:n,onComponentUpdate:i,renderFormComponent:a,formData:l,formTemplateId:c,onThresholdActionCompletion:u,onThresholdIssueRaised:h,onNotesChange:d,onAttachmentChange:f,workOrderNumber:p,assetNumber:g,user:m,onCreateIssue:w,onUpdateIssue:B})},t.id))})}),X.jsx("div",{style:{border:b?"2px dashed #3b82f6":"1px dashed var(--df-color-fb-border)",borderRadius:"6px",padding:"12px",backgroundColor:b?"var(--df-color-primary-light)":"var(--df-color-fb-container)",textAlign:"center",color:"var(--df-color-text-light)",fontSize:"12px",transition:"all 0.2s ease",minHeight:"40px",display:"flex",alignItems:"center",justifyContent:"center"},children:b?X.jsx("span",{style:{color:"#3b82f6",fontWeight:"500"},children:"Drop component here to add to grid"}):X.jsx("span",{children:"+ Drop more components here"})})]}):X.jsxs("div",{style:{textAlign:"center",color:"var(--df-color-text-light)",fontSize:"14px",padding:"40px 20px",display:"flex",flexDirection:"column",alignItems:"center",gap:"8px",backgroundColor:"var(--df-color-fb-container)",border:"1px dashed var(--df-color-fb-border)",borderRadius:"8px"},children:[X.jsx("div",{style:{fontWeight:"500",color:b?"var(--df-color-primary)":"var(--df-color-text-dark)"},children:b?"Drop components here":"Empty DataGrid"}),X.jsx("div",{style:{fontSize:"12px",color:"#9ca3af"},children:"Drag and drop components here to create your grid"})]})})},vt=({templateComponents:t,dataEntries:e,renderFormComponent:A,renderComponent:r,mode:n="preview",allowAddRemoveEntries:i=!0,addAnotherText:s="Add Another",removeText:a="Remove",maxEntries:o=10,minEntries:l=1,displayAsGrid:c=!0,onAddEntry:u,onRemoveEntry:h,formData:d={},formTemplateId:f,onThresholdActionCompletion:p,onThresholdIssueRaised:g,onNotesChange:m,onAttachmentChange:w,datagridId:B="",workOrderNumber:y,assetNumber:b,user:v,onCreateIssue:C,onUpdateIssue:x})=>0===t.length?X.jsxs("div",{style:{textAlign:"center",padding:"40px",color:"var(--df-color-text-light)",border:"1px dashed #d1d5db",borderRadius:"8px",backgroundColor:"var(--df-color-fb-container)"},children:["No components defined. Add components to see the ",c?"table":"list"," view."]}):c?X.jsxs("div",{className:"datagrid-table-view",style:{border:"1px solid var(--df-color-fb-border)",borderRadius:"8px",overflow:"hidden",backgroundColor:"var(--df-color-fb-container)",maxWidth:"100%"},children:[X.jsx("div",{style:{position:"absolute",top:"8px",right:"8px",zIndex:10,fontSize:"12px",color:"var(--df-color-text-light)",backgroundColor:"var(--df-color-fb-container)",padding:"4px 8px",borderRadius:"4px",border:"1px solid var(--df-color-fb-border)",opacity:t.length>4?1:0,transition:"opacity 0.2s ease"},children:"← Scroll →"}),X.jsxs("div",{className:"table-scroll-container",style:{overflowX:"auto",overflowY:"hidden",maxWidth:"100%",scrollbarWidth:"thin",scrollbarColor:"var(--df-color-fb-border) var(--df-color-fb-icon-bg)",position:"relative"},children:[X.jsx("div",{className:"table-headers",style:{display:"grid",gridTemplateColumns:`repeat(${t.length}, minmax(150px, 1fr))`,backgroundColor:"var(--df-color-fb-container)",borderBottom:"2px solid var(--df-color-fb-border)",minWidth:150*t.length+"px"},children:t.map((e,A)=>X.jsx("div",{style:{padding:"12px 16px",fontWeight:"600",color:"var(--df-color-text-dark)",borderRight:A<t.length-1?"1px solid var(--df-color-fb-border)":"none",fontSize:"14px",minWidth:"150px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.basic?.label||`Column ${A+1}`},`header-${e.id}`))}),e.length>0?e.map((s,o)=>X.jsxs("div",{className:"table-row",style:{display:"grid",gridTemplateColumns:`repeat(${t.length}, minmax(150px, 1fr))`,borderBottom:o<e.length-1?"1px solid var(--df-color-fb-border)":"none",backgroundColor:o%2==0?"var(--df-color-fb-container)":"var(--df-color-fb-bg)",position:"relative",minWidth:150*t.length+"px",isolation:"isolate"},children:[t.map((e,i)=>{let a=s.components?.[i];const l=`${e.id||`component-${i}`}-entry-${B}-${o}-${i}`;return a=a?a.id!==l?{...a,id:l,basic:{...a.basic,showLabel:!1}}:{...a,id:a.id,basic:{...a.basic,showLabel:!1}}:{...e,id:l,basic:{...e.basic,showLabel:!1,defaultValue:void 0,value:void 0}},X.jsxs("div",{style:{padding:"12px 16px",borderRight:i<t.length-1?"1px solid var(--df-color-fb-border)":"none",minHeight:"60px",minWidth:"150px",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",overflow:"visible",position:"relative",zIndex:1},children:[X.jsx("div",{style:{width:"100%",minWidth:"120px",overflow:"hidden",position:"relative",zIndex:1},children:r?r(a,!0):A(a,!0)}),!["section","table","heading","file","instructions","signature","location","datagrid"].includes(a.name)&&X.jsxs("div",{style:{marginTop:"8px",width:"100%"},children:[X.jsx(mt,{component:a,mode:"test",formTemplateId:f,formValue:d[a.id],formData:d,onThresholdActionCompletion:p,onThresholdIssueRaised:g,onNotesChange:m?t=>m(a.id,t):void 0,onAttachmentChange:w?t=>w(a.id,t):void 0,notes:a.basic?.notes||d[a.id]?.notes,attachments:a.basic?.attachments||d[a.id]?.attachments,workOrderNumber:y,assetNumber:b,user:v,onCreateIssue:C,onUpdateIssue:x}),"preview"===n&&(a.basic?.notes||a.basic?.attachments)&&X.jsx(Bt,{component:a})]})]},`${s.id}-${i}`)}),i&&e.length>l&&X.jsx("button",{type:"button",onClick:t=>{if(t.preventDefault(),t.stopPropagation(),!(e.length<=l)&&h)try{h(o)}catch(t){console.error("Error removing entry:",t)}},disabled:e.length<=l,style:{position:"absolute",top:"8px",right:"8px",padding:"4px 8px",backgroundColor:e.length<=l?"#f3f4f6":"#ef4444",color:e.length<=l?"#9ca3af":"#ffffff",border:"none",borderRadius:"4px",fontSize:"12px",fontWeight:"500",cursor:e.length<=l?"not-allowed":"pointer",display:"flex",alignItems:"center",gap:"4px",zIndex:1e3,minWidth:"24px",height:"24px",justifyContent:"center",transition:"all 0.2s ease",pointerEvents:"auto"},title:a,onMouseEnter:t=>{e.length>l&&(t.currentTarget.style.backgroundColor="#dc2626")},onMouseLeave:t=>{e.length>l&&(t.currentTarget.style.backgroundColor="#ef4444")},children:X.jsx("span",{style:{fontSize:"14px"},children:"×"})})]},s.id)):X.jsxs("div",{style:{padding:"40px",textAlign:"center",color:"var(--df-color-text-light)",backgroundColor:"var(--df-color-fb-container)",borderTop:"1px solid var(--df-color-fb-border)"},children:["No data entries. ",i?'Click "Add Another" to add entries.':"Use the properties panel to add entries."]})]}),i&&X.jsx("div",{style:{padding:"16px",backgroundColor:"var(--df-color-fb-bg)",borderTop:"1px solid var(--df-color-fb-border)",display:"flex",justifyContent:"center",position:"sticky",bottom:0,zIndex:5},children:X.jsxs("button",{type:"button",onClick:t=>{if(t.preventDefault(),t.stopPropagation(),!(e.length>=o)&&u)try{u()}catch(t){console.error("Error adding entry:",t)}},disabled:e.length>=o,style:{padding:"8px 16px",backgroundColor:e.length>=o?"#f3f4f6":"#10b981",color:e.length>=o?"#9ca3af":"#ffffff",border:"none",borderRadius:"6px",fontSize:"14px",fontWeight:"500",cursor:e.length>=o?"not-allowed":"pointer",display:"flex",alignItems:"center",gap:"6px",transition:"all 0.2s ease",pointerEvents:"auto",zIndex:1e3},onMouseEnter:t=>{e.length<o&&(t.currentTarget.style.backgroundColor="#059669")},onMouseLeave:t=>{e.length<o&&(t.currentTarget.style.backgroundColor="#10b981")},children:[X.jsx("span",{style:{fontSize:"16px"},children:"+"}),s]})})]}):X.jsxs("div",{className:"datagrid-list-view",style:{display:"flex",flexDirection:"column",gap:"12px",backgroundColor:"var(--df-color-fb-container)"},children:[e.length>0?e.map((s,o)=>X.jsxs("div",{className:"list-entry",style:{border:"1px solid var(--df-color-fb-border)",borderRadius:"8px",padding:"16px",backgroundColor:"var(--df-color-fb-container)",position:"relative",transition:"all 0.2s ease"},children:[X.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"12px",paddingBottom:"8px",borderBottom:"1px solid var(--df-color-fb-border)"},children:[X.jsxs("span",{style:{fontWeight:"600",color:"var(--df-color-text-dark)",fontSize:"14px"},children:["Entry #",o+1]}),i&&e.length>1&&X.jsx("button",{type:"button",onClick:t=>{if(t.preventDefault(),t.stopPropagation(),!(e.length<=l)&&h)try{h(o)}catch(t){console.error("Error removing entry:",t)}},disabled:e.length<=l,style:{padding:"4px 8px",backgroundColor:e.length<=l?"#f3f4f6":"#ef4444",color:e.length<=l?"#9ca3af":"#ffffff",border:"none",borderRadius:"4px",fontSize:"12px",fontWeight:"500",cursor:e.length<=l?"not-allowed":"pointer",display:"flex",alignItems:"center",gap:"4px",minWidth:"24px",height:"24px",justifyContent:"center",transition:"all 0.2s ease",pointerEvents:"auto",zIndex:1e3},title:a,onMouseEnter:t=>{e.length>l&&(t.currentTarget.style.backgroundColor="#dc2626")},onMouseLeave:t=>{e.length>l&&(t.currentTarget.style.backgroundColor="#ef4444")},children:X.jsx("span",{style:{fontSize:"14px"},children:"×"})})]}),X.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:"16px"},children:t.map((t,e)=>{let i=s.components?.[e];const a=`${t.id||`component-${e}`}-entry-${B}-${o}-${e}`;return i||(i=s.components?.find(e=>e.name===t.name&&e.basic?.label===t.basic?.label)),i=i?i.id!==a?{...i,id:a,basic:{...i.basic,showLabel:!1}}:{...i,id:i.id,basic:{...i.basic,showLabel:!1}}:{...t,id:a,basic:{...t.basic,showLabel:!1,defaultValue:void 0,value:void 0}},X.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[X.jsx("label",{style:{fontSize:"12px",fontWeight:"500",color:"var(--df-color-text-light)",textTransform:"uppercase",letterSpacing:"0.05em"},children:t.basic?.label||`Field ${e+1}`}),X.jsxs("div",{style:{minHeight:"40px",display:"flex",alignItems:"center",flexDirection:"column",width:"100%"},children:[r?r(i):A(i),!["section","table","heading","file","instructions","signature","location","datagrid"].includes(i.name)&&X.jsx(mt,{component:i,mode:"test",formTemplateId:f,formValue:d[i.id],onThresholdActionCompletion:p,onThresholdIssueRaised:g,onNotesChange:m?t=>m(i.id,t):void 0,onAttachmentChange:w?t=>w(i.id,t):void 0}),"preview"===n&&(i.basic?.notes&&i.basic.notes.trim().length>0||i.basic?.attachments&&Array.isArray(i.basic.attachments)&&i.basic.attachments.length>0?X.jsx(Bt,{component:i}):null)]})]},`${s.id}-${e}`)})})]},s.id)):X.jsxs("div",{style:{padding:"40px",textAlign:"center",color:"var(--df-color-text-light)",backgroundColor:"var(--df-color-fb-container)",border:"1px dashed #d1d5db",borderRadius:"8px"},children:["No data entries. ",i?'Click "Add Another" to add entries.':"Use the properties panel to add entries."]}),"test"===n&&i&&X.jsx("div",{style:{padding:"16px",backgroundColor:"#f8f9fa",border:"1px solid var(--df-color-fb-border)",borderRadius:"8px",display:"flex",justifyContent:"center"},children:X.jsxs("button",{type:"button",onClick:t=>{if(t.preventDefault(),t.stopPropagation(),!(e.length>=o)&&u)try{u()}catch(t){console.error("Error adding entry:",t)}},disabled:e.length>=o,style:{padding:"8px 16px",backgroundColor:e.length>=o?"#f3f4f6":"#10b981",color:e.length>=o?"#9ca3af":"#ffffff",border:"none",borderRadius:"6px",fontSize:"14px",fontWeight:"500",cursor:e.length>=o?"not-allowed":"pointer",display:"flex",alignItems:"center",gap:"8px",transition:"all 0.2s ease",pointerEvents:"auto",zIndex:1e3},onMouseEnter:t=>{e.length<o&&(t.currentTarget.style.backgroundColor="#059669")},onMouseLeave:t=>{e.length<o&&(t.currentTarget.style.backgroundColor="#10b981")},children:[X.jsx("span",{children:"+"}),s]})})]}),Ct=({id:t,properties:i,mode:s="edit",formData:a={},validationErrors:o={},touchedFields:l={},formSubmitted:c=!1,onValueChange:u,onSelect:h,isSelected:d=!1,className:f="",onDataGridSelect:p,onComponentSelect:g,onComponentDelete:m,onComponentEdit:w,onComponentUpdate:B,selectedComponent:y,renderFormComponent:b,onEntryAdd:v,onEntryRemove:C,formTemplateId:x,onThresholdActionCompletion:E,onThresholdIssueRaised:N,onNotesChange:S,onAttachmentChange:L,workOrderNumber:I,assetNumber:_,user:k,onCreateIssue:T,onUpdateIssue:H})=>{const[O,P]=e(!1),[D,M]=e(i.entries||[]),j=n(!1);A(()=>{i.entries&&i.entries!==D&&M(i.entries)},[i.entries]);let R=i.templateComponents||[];const K=D;0===R.length&&K.length>0&&K[0].components&&(R=K[0].components.map(t=>({...t,id:t.id?.replace(/-entry-\d+$/,"")||t.id,basic:{...t.basic,showLabel:!0}}))),A(()=>{if("edit"===s&&!i.templateComponents&&u&&j.current){const e={...i,templateComponents:[]};JSON.stringify(e)!==JSON.stringify(i)&&u({id:t,value:e})}j.current=!0},[i.templateComponents,t,u,i,s]),A(()=>{if(R.length>0){if("test"===s&&0===K.length&&j.current){const e={id:`entry-${t}-0`,index:0,components:R.map((e,A)=>{const r=e.id||`component-${A}`;return{...e,id:`${r}-entry-${t}-0-${A}`,basic:{...e.basic,showLabel:!1,defaultValue:void 0,value:void 0}}}),styles:{}};if(u){const A={...i,entries:[e]};JSON.stringify(A)!==JSON.stringify(i)&&u({id:t,value:A})}return}if("edit"!==s||!j.current)return;const e=K.some(t=>t.components?.some((e,A)=>{const r=`${R[A]?.id}-entry-${t.index}-${A}`;return e.id!==r}));if(e&&u){const e=K.map(t=>({...t,components:t.components?.map((e,A)=>({...e,id:`${R[A]?.id}-entry-${t.index}-${A}`}))||[]})),A={...i,entries:e};return void(JSON.stringify(A)!==JSON.stringify(i)&&u({id:t,value:A}))}if(0===K.length&&"edit"===s){const e={id:`entry-${t}-0`,index:0,components:R.map((e,A)=>{const r=e.id||`component-${A}`;return{...e,id:`${r}-entry-${t}-0-${A}`,basic:{...e.basic,showLabel:!1,defaultValue:void 0,value:void 0}}}),styles:{}};if(u){const A={...i,entries:[e]};JSON.stringify(A)!==JSON.stringify(i)&&u({id:t,value:A})}}else if(K.length>0){if(K.some(t=>R.some((e,A)=>{const r=t.components?.[A];if(!r)return!0;const n=`${e.id}-entry-${t.index}-${A}`,i=r.id===n,s=JSON.stringify(r.basic?.options)!==JSON.stringify(e.basic?.options)||r.basic?.placeholder!==e.basic?.placeholder||r.basic?.defaultValue!==e.basic?.defaultValue||r.basic?.label!==e.basic?.label||r.validation?.required!==e.validation?.required;return!i||s}))&&u){const e=K.map(e=>{const A=R.map((A,r)=>{let n=e.components?.[r];n||(n=e.components?.find(t=>t.name===A.name&&t.basic?.label===A.basic?.label));const i=`${A.id||`component-${r}`}-entry-${t}-${e.index}-${r}`;if(n){return{...A,id:i,basic:{...A.basic,showLabel:!1,defaultValue:void 0,value:void 0}}}return{...A,id:i,basic:{...A.basic,showLabel:!1,defaultValue:void 0,value:void 0}}});return{...e,components:A}}),A={...i,entries:e};JSON.stringify(A)!==JSON.stringify(i)&&u({id:t,value:A})}}}},[R,K,t,u,i,s,i.templateComponents]);const V=r(t=>{t.stopPropagation(),h?.(),p?.(i)},[h,p,i]),z=r((e,A)=>{A.stopPropagation(),m&&m(e,A);const r=R.filter(t=>t.id!==e.id),n=D.map(t=>({...t,components:t.components?.filter(t=>!(t.name===e.name&&t.basic?.label===e.basic?.label))||[]}));M(n),u&&u({id:t,value:{...i,templateComponents:r,entries:n}})},[m,i,u,t,R,K]),G=r((e,A)=>{B&&B(e,A);const r=R.map(t=>t.id===e?{...t,...A}:t);u&&u({id:t,value:{...i,templateComponents:r}})},[B,i,u,t,R]),q=r(t=>{"test"===s&&u&&u({id:t.id,value:t.value})},[u]),W=r(()=>{const e=D,A=e.length,r={id:`entry-${t}-${A}`,index:A,components:R.map((e,r)=>{const n=`${e.id||`component-${r}`}-entry-${t}-${A}-${r}`;return{...e,id:n,basic:{...e.basic,showLabel:!1,defaultValue:void 0,value:void 0}}}),styles:{}},n=[...e,r];M(n),u&&u({id:t,value:{...i,entries:n}}),v?.()},[i,u,t,v,R]),Y=r(e=>{const A=D.filter((t,A)=>A!==e).map((e,A)=>({...e,index:A,id:`entry-${t}-${A}`}));M(A),u&&u({id:t,value:{...i,entries:A}})},[i,u,t,C]),J=r((t,e=!1)=>{const A=a[t.id]||"defaultValue"in t.basic&&t.basic.defaultValue||"";let r=A;"number-input"===t.name&&"number"==typeof A?r=String(A):"number-input"===t.name&&null==A&&(r="");const n={id:t.id,properties:t,validationErrors:o||{},formValue:r,touchedFields:l||{},formSubmitted:c||!1,mode:s,hideLabel:e,onValueChange:q,onBlur:()=>{},onFocus:()=>{}};switch(t.name){case"text-input":case"email-input":case"number-input":return X.jsx(nt,{...n,properties:t,inputType:"text-input"===t.name?"text":"number-input"===t.name?"number":"email",readonly:!1,disabled:!1,hideLabel:e});case"textarea":return X.jsx(it,{...n,properties:t,readonly:!1,disabled:!1,hideLabel:e});case"select":const A={...t,options:t.basic?.options||[]};return X.jsx(st,{...n,properties:A,disabled:!1,hideLabel:e});case"checkbox":const r={...t,options:t.basic?.options||[]};return X.jsx(at,{...n,properties:r,formValue:[],disabled:!1,hideLabel:e});case"radio":const i={...t,options:t.basic?.options||[]};return X.jsx(ot,{...n,properties:i,readonly:!1,disabled:!1,hideLabel:e});case"date":case"date-picker":case"datetime-picker":return X.jsx(ct,{...n,properties:t,readonly:!1,disabled:!1,hideLabel:e});case"signature":return X.jsx(ut,{...n,properties:t,hideLabel:e});case"heading":return X.jsx(ft,{...n,properties:t,hideLabel:e});case"instructions":return X.jsx(pt,{...n,properties:t,hideLabel:e});case"location":return X.jsx(dt,{...n,properties:t,hideLabel:e});case"segment":const o={...t,options:t.basic?.options||[]};return X.jsx(lt,{...n,properties:o,hideLabel:e});case"datagrid":return X.jsx(Ct,{...n,properties:t,formData:a,mode:s,onNotesChange:()=>{},onAttachmentChange:()=>{}});default:return X.jsxs("div",{className:"unknown-component",children:["Unknown component: ",t.name]})}},[s,q,a,o,l,c]),$={backgroundColor:i.styles.backgroundColor||"var(--df-color-fb-container)",borderColor:i.styles.borderColor||"var(--df-color-fb-border)",borderWidth:i.styles.borderWidth||"2px",borderRadius:i.styles.borderRadius||"8px",padding:i.styles.padding||"16px",margin:i.styles.margin||"16px 0"};return X.jsxs("div",{className:`form-group df-form-datagrid ${d?"selected":""} ${f}`,onClick:V,style:$,children:[X.jsx("div",{className:"grid-header",children:X.jsx("div",{className:"grid-title",onClick:e=>{e.stopPropagation(),P(!O),u?.({id:t,value:{...i,basic:{...i.basic,collapsed:!O}}})},children:X.jsxs("div",{className:"title-content",style:{display:"flex",alignItems:"center",gap:"8px"},children:[O?X.jsx(Q,{size:16}):X.jsx(F,{size:16}),X.jsx(U,{size:16}),X.jsx("span",{className:"grid-label",style:{fontWeight:"600"},children:i.basic.label}),i.validation.required&&X.jsx("span",{className:"required-indicator",style:{color:"#ef4444"},children:"*"})]})})}),i.basic.description&&!O&&X.jsx("div",{className:"grid-description",style:{marginTop:"8px",color:"var(--df-color-text-light)",fontSize:"14px"},children:i.basic.description}),!O&&X.jsx("div",{className:"grid-content",style:{marginTop:"16px"},children:"edit"===s?X.jsx(bt,{gridComponents:R,mode:s,onComponentSelect:g||(()=>{}),onComponentDelete:z,onComponentEdit:w,onComponentUpdate:G,selectedComponent:y||null,renderFormComponent:b||J,gridId:t,formData:a,formTemplateId:x,onThresholdActionCompletion:E,onThresholdIssueRaised:N,onNotesChange:S,onAttachmentChange:L,workOrderNumber:I,assetNumber:_,user:k,onCreateIssue:T,onUpdateIssue:H}):X.jsx(vt,{templateComponents:R,dataEntries:K,renderFormComponent:b||J,mode:s,allowAddRemoveEntries:i.datagrid?.allowAddRemoveEntries??!0,addAnotherText:i.datagrid?.addAnotherText??"Add Entry",removeText:i.datagrid?.removeText??"Remove",maxEntries:i.datagrid?.maxEntries??10,minEntries:i.datagrid?.minEntries??1,displayAsGrid:i.datagrid?.displayAsGrid??!0,onAddEntry:v||W,onRemoveEntry:C||Y,formData:a,formTemplateId:x,onThresholdActionCompletion:E,onThresholdIssueRaised:N,onNotesChange:S,onAttachmentChange:L,datagridId:t,workOrderNumber:I,assetNumber:_,user:k,onCreateIssue:T,onUpdateIssue:H})})]})},xt=({child:t,selectedChild:e,mode:A,onChildSelect:r,onChildDelete:n,renderFormComponent:i,isOverlay:s=!1,isChildrenEditMode:a=!1,formData:o={},formTemplateId:l,onThresholdActionCompletion:c,onThresholdIssueRaised:u,onNotesChange:h,onAttachmentChange:d,workOrderNumber:f,assetNumber:p,user:g,onCreateIssue:m,onUpdateIssue:w})=>{const B=o[t.id],y="preview"===A&&(t.basic?.notes&&t.basic.notes.trim().length>0||t.basic?.attachments&&Array.isArray(t.basic.attachments)&&t.basic.attachments.length>0),{attributes:b,listeners:v,setNodeRef:C,transform:x,transition:F,isDragging:Q,isSorting:U}=O({id:t.id,disabled:s||"edit"!==A}),L={transform:D.Transform.toString(x),transition:F,zIndex:Q?1e3:"auto"};return X.jsxs("div",{ref:C,style:L,className:`form-component section-child ${e?.id===t.id?"selected":""} ${Q?"dragging":""} ${U?"sorting":""} ${a?"children-edit-active":""}`,onClick:()=>!Q&&r(t),role:"button",tabIndex:0,children:[("edit"===A||a)&&X.jsx("div",{className:"child-drag-handle",...v,...b,onClick:t=>t.stopPropagation(),onMouseDown:t=>t.stopPropagation(),children:X.jsx(E,{size:14})}),X.jsxs("div",{className:"form-component-content section-child-content",children:[("edit"===A||a)&&X.jsxs("div",{className:"component-actions child-actions",children:[X.jsx("button",{className:"btn edit-btn",onClick:e=>{e.stopPropagation(),r(t)},onMouseDown:t=>t.stopPropagation(),title:"Edit properties",children:X.jsx(N,{size:12})}),X.jsx("button",{className:"btn delete-btn",onClick:e=>n(t,e),onMouseDown:t=>t.stopPropagation(),title:"Delete component",children:X.jsx(S,{size:12})})]}),X.jsxs("div",{className:"component-preview child-preview",children:[i(t),!["section","table","heading","file","instructions","signature","location","datagrid"].includes(t.name)&&X.jsx(mt,{component:t,mode:"test",formTemplateId:l,formValue:B,formData:o,onThresholdActionCompletion:c,onThresholdIssueRaised:u,onNotesChange:h?e=>h(t.id,e):void 0,onAttachmentChange:d?e=>d(t.id,e):void 0,workOrderNumber:f,assetNumber:p,user:g,onCreateIssue:m,onUpdateIssue:w}),y&&X.jsx(Bt,{component:t})]})]})]})},Ft=({id:t,properties:n,mode:i="edit",formData:s={},onValueChange:a,onSelect:o,isSelected:l=!1,className:c="",onSectionSelect:u,onChildSelect:h,onChildDelete:d,selectedChild:f,renderFormComponent:p,formTemplateId:g,onThresholdActionCompletion:m,onThresholdIssueRaised:w,onNotesChange:B,onAttachmentChange:y,workOrderNumber:b,assetNumber:v,user:C,onCreateIssue:x,onUpdateIssue:U})=>{const[E,N]=e(n.basic.collapsed),[S,L]=e(!1),[I,_]=e(!1),[H,O]=e(n.basic.label),[D,M]=e(n.basic.description),[j,R]=e(n.children||[]),[K,V]=e(!1);A(()=>{R(n.children||[])},[n.children]),A(()=>{O(n.basic.label),M(n.basic.description)},[n.basic.label,n.basic.description]);const{setNodeRef:z,isOver:G}=k({id:`section-${t}`,disabled:"edit"!==i}),q=!("preview"!==i&&"test"!==i||n.children&&n.children.length>0),W=r(e=>{O(e),a?.({id:t,value:{...n,basic:{...n.basic,label:e}}})},[t,n,a]),Y=r(e=>{M(e),a?.({id:t,value:{...n,basic:{...n.basic,description:e}}})},[t,n,a]),J=r(t=>{h?.(t)},[h]),$=r((t,e)=>{e.stopPropagation();const A=j.filter(e=>e.id!==t.id);R(A),d?.(t.id)},[d,j,t]),Z=r(()=>{u?.(n),o?.()},[u,o,n]),tt=r(t=>{t.stopPropagation(),"edit"===i&&j.length>0&&V(!K)},[i,j.length,K]),et=r(e=>{e.stopPropagation(),N(!E),a?.({id:t,value:{...n,basic:{...n.basic,collapsed:!E}}})},[E,t,n,a]),At=p||r(t=>{const e=s[t.id]||"defaultValue"in t.basic&&t.basic.defaultValue||"";let A=e;"number-input"===t.name&&"number"==typeof e?A=String(e):"number-input"===t.name&&null==e&&(A="");const r={id:t.id,properties:t,validationErrors:{},formValue:A,touchedFields:{},formSubmitted:!1,mode:i,onValueChange:a,onBlur:()=>{},onFocus:()=>{}};switch(t.name){case"text-input":case"email-input":case"number-input":return X.jsx(nt,{...r,properties:t,inputType:"text-input"===t.name?"text":"number-input"===t.name?"number":"email",readonly:!1,disabled:!1});case"textarea":return X.jsx(it,{...r,properties:t,readonly:!1,disabled:!1});case"select":const e={...t,options:t.basic?.options||[]};return X.jsx(st,{...r,properties:e,disabled:!1});case"checkbox":const A={...t,options:t.basic?.options||[]};return X.jsx(at,{...r,properties:A,formValue:[],disabled:!1});case"radio":const n={...t,options:t.basic?.options||[]};return X.jsx(ot,{...r,properties:n,readonly:!1,disabled:!1});case"date":case"date-picker":case"datetime-picker":return X.jsx(ct,{...r,properties:t,readonly:!1,disabled:!1});case"signature":return X.jsx(ut,{...r,properties:t});case"heading":return X.jsx(ft,{...r,properties:t});case"instructions":return X.jsx(pt,{...r,properties:t});case"location":return X.jsx(dt,{...r,properties:t});case"datagrid":return X.jsx(Ct,{...r,properties:t,formData:s,mode:i,onNotesChange:()=>{},onAttachmentChange:()=>{}});case"segment":const a={...t,options:t.basic?.options||[]};return X.jsx(lt,{...r,properties:a});default:return X.jsx("div",{className:"form-group",children:X.jsxs("div",{className:"form-group-label",children:["Unsupported Component: ",t.name]})})}},[i,a,s]);if(q)return null;const rt={backgroundColor:n.styles?.backgroundColor||"var(--df-color-fb-container)",borderColor:n.styles?.borderColor||"var(--df-color-fb-border)",borderWidth:n.styles?.borderWidth||"2px",borderRadius:n.styles?.borderRadius||"8px",padding:n.styles?.padding||"16px",margin:n.styles?.margin||"16px 0"};return X.jsxs("div",{ref:z,className:`df-form-section ${l?"selected":""} ${G?"drag-over":""} ${c}`,style:rt,children:[X.jsxs("div",{className:"section-header "+(K?"children-edit-mode":""),onClick:Z,onDoubleClick:tt,children:[X.jsx("div",{className:"section-header-content",children:X.jsxs("div",{className:"section-title",children:[X.jsx("span",{className:"section-toggle",title:E?"Expand section":"Collapse section",role:"button",tabIndex:0,onClick:t=>{t.stopPropagation(),et(t)},onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),et(t))},style:{marginRight:"8px",display:"inline-flex",alignItems:"center"},children:E?X.jsx(Q,{size:18}):X.jsx(F,{size:18})}),"edit"===i&&S?X.jsx("input",{type:"text",value:H,onChange:t=>O(t.target.value),onBlur:()=>{L(!1),W(H)},onKeyDown:t=>{"Enter"===t.key&&(L(!1),W(H))},className:"section-title-input",autoFocus:!0}):X.jsx("h3",{className:"section-title-text",onDoubleClick:()=>"edit"===i&&L(!0),style:{display:"inline",margin:0},children:H||"Untitled Section"})]})}),(D||"edit"===i)&&X.jsx("div",{className:"section-description",children:"edit"===i&&I?X.jsx("textarea",{value:D,onChange:t=>M(t.target.value),onBlur:()=>{_(!1),Y(D)},onKeyDown:t=>{"Enter"===t.key&&t.ctrlKey&&(_(!1),Y(D))},className:"section-description-input",placeholder:"Section description (optional)",autoFocus:!0}):X.jsx("p",{className:"section-description-text",onDoubleClick:()=>"edit"===i&&_(!0),children:D||"Section description"})})]}),!E&&X.jsx("div",{className:`section-content ${G?"drag-over":""} ${0===j.length?"empty":"has-children"}`,onClick:t=>{t.target===t.currentTarget&&Z()},children:X.jsx(T,{items:j.map(t=>t.id),strategy:P,children:0===j.length?X.jsxs("div",{className:"section-empty-state",onClick:Z,style:{textAlign:"center",color:"#6b7280",fontSize:"14px",padding:"40px 20px",display:"flex",flexDirection:"column",alignItems:"center",gap:"8px",cursor:"pointer",border:"2px dotted #d1d5db",borderRadius:"8px",backgroundColor:"var(--df-color-fb-container)",transition:"all 0.3s ease",margin:"16px 0"},children:[X.jsx("div",{style:{fontWeight:"500",color:G?"#3b82f6":"#374151"},children:G?"Drop components here":"Empty Section"}),X.jsx("div",{style:{fontSize:"12px",color:"#9ca3af"},children:"Drag and drop components here to create your section"})]}):j.map(t=>X.jsx(xt,{child:t,selectedChild:f||null,mode:i,onChildSelect:J,onChildDelete:$,renderFormComponent:At,isChildrenEditMode:K,formData:s,formTemplateId:g,onNotesChange:B,onAttachmentChange:y,onThresholdActionCompletion:m,onThresholdIssueRaised:w,workOrderNumber:b,assetNumber:v,user:C,onCreateIssue:x,onUpdateIssue:U},t.id))})})]})},Qt=t.lazy(()=>Promise.resolve().then(function(){return kt})),Ut=({formComponents:i=[],currentDevice:s="desktop",isPreviewMode:a=!1,initialFormData:o=[],onSubmit:l,onFormDataChange:c,formTitle:u,formDescription:h,formTemplateId:d,onComponentSelect:f,onComponentDelete:p,onComponentEdit:g,onComponentUpdate:m,selectedComponent:w,workOrderNumber:B,assetNumber:y,isStandalone:b,user:v,onCreateIssue:C,onUpdateIssue:x})=>{const[F,Q]=e({}),[U,E]=e({}),[N,S]=e(!1),[L,I]=e({}),[_,k]=e({}),[T,H]=e(new Set),[O,P]=e(new Map),[D,M]=e({isValid:!0}),[j,R]=e({}),[K,V]=e({});A(()=>{G()},[i,o]);const z=(t,e)=>{t.forEach(t=>{if(t.id&&(void 0!==e[t.id]||(t.basic&&"value"in t.basic&&void 0!==t.basic.value&&""!==t.basic.value&&null!==t.basic.value?e[t.id]=t.basic.value:t.basic&&"defaultValue"in t.basic&&void 0!==t.basic.defaultValue&&""!==t.basic.defaultValue&&null!==t.basic.defaultValue?e[t.id]=t.basic.defaultValue:"checkbox"===t.name||"select"===t.name?e[t.id]=[]:e[t.id]="")),t.cells&&Array.isArray(t.cells)&&t.cells.forEach((t,A)=>{Array.isArray(t)&&t.forEach((t,A)=>{t&&t.components&&Array.isArray(t.components)&&z(t.components,e)})}),t.entries&&Array.isArray(t.entries)&&t.entries.forEach((t,A)=>{t&&t.components&&Array.isArray(t.components)&&z(t.components,e)}),"file"===t.name&&t.basic){const A=t.basic.files||t.basic.attachments||t.basic.value;A&&(e[t.id]=A)}if(t.id&&t.basic&&t.basic.notes,"instructions"===t.name&&t.basic){t.basic.instructions||(t.basic.instructions=[]);const A=t.basic.value||t.basic.instructions;A&&(e[t.id]=A)}t.children&&Array.isArray(t.children)&&z(t.children,e)})},G=r(()=>{const t={},e={},A={},r=new Set,n=t=>{t.forEach(t=>{t.id&&((t.basic?.notes||t.basic?.comments)&&(e[t.id]=t.basic?.notes||t.basic?.comments),t.basic?.attachments&&(A[t.id]=t.basic.attachments)),t.children&&n(t.children),t.cells&&t.cells.forEach(t=>t.forEach(t=>{t.components&&n(t.components)})),t.entries&&t.entries.forEach(t=>{t.components&&n(t.components)})})},s=t=>t.map((t,e)=>{let A={...t};if(A.id&&"string"==typeof A.id&&""!==A.id.trim())r.has(A.id)&&(console.error(`[DfFormPreview] Duplicate component ID detected: ${A.id}`),A.id=`${A.id}-duplicate-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,console.warn(`[DfFormPreview] Generated new unique ID: ${A.id}`));else{const t=A.name||"component",r=(A.basic?.label||"").replace(/[^a-zA-Z0-9]/g,"").toLowerCase().substring(0,10);A.id=`${t}-${r||"gen"}-${Date.now()}-${Math.random().toString(36).substr(2,6)}-${e}`,console.warn(`[DfFormPreview] Assigned missing ID: ${A.id}`)}return r.add(A.id),A.children&&Array.isArray(A.children)&&(A.children=s(A.children)),A.cells&&Array.isArray(A.cells)&&(A.cells=A.cells.map(t=>Array.isArray(t)?t.map(t=>t&&t.components&&Array.isArray(t.components)?{...t,components:s(t.components)}:t):t)),A.entries&&Array.isArray(A.entries)&&(A.entries=A.entries.map(t=>t&&t.components&&Array.isArray(t.components)?{...t,components:s(t.components)}:t)),A});let a=i;i&&i.length>0&&(a=s(i),JSON.stringify(a)!==JSON.stringify(i)&&c?.(a));let l=o;o&&o.length>0&&(l=s(o)),l&&l.length>0&&z(l,t),a&&a.length>0&&(z(a,t),n(a)),Q(e=>({...t,...e})),R(t=>({...e,...t})),V(t=>({...A,...t})),W()},[o,i]),q=(t,e,A,r)=>{t.forEach(t=>{if(t.id)if("table"===t.name||"datagrid"===t.name)e[t.id]=!0;else if(t.conditional){const n=J.evaluateConditionalLogic(t.conditional,r,A);e[t.id]=n.shouldShow,t._id&&(e[t._id]=n.shouldShow),t.basic?.label&&(e[t.basic.label]=n.shouldShow)}else e[t.id]=!0,t._id&&(e[t._id]=!0),t.basic?.label&&(e[t.basic.label]=!0);t.cells&&Array.isArray(t.cells)&&t.cells.forEach(t=>{t.forEach(t=>{t.components&&Array.isArray(t.components)&&q(t.components,e,A,r)})}),t.entries&&Array.isArray(t.entries)&&t.entries.forEach(t=>{t.components&&Array.isArray(t.components)&&q(t.components,e,A,r)}),t.children&&Array.isArray(t.children)&&q(t.children,e,A,r)})},W=r((t,e)=>{const A={},r=e||i,n=t||F;r&&r.length>0&&q(r,A,n,r),k(t=>JSON.stringify(t)===JSON.stringify(A)?t:A)},[i,F]),Y=r(t=>{const e=i.find(e=>e.id===t);if(e&&("table"===e.name||"datagrid"===e.name))return!0;return!1!==_[t]},[_,i]),Z=r(t=>{if(!t.id||"string"!=typeof t.id||""===t.id.trim())return void console.error("[DfFormPreview] Invalid component ID in onFormValueChange:",t);const e=i.filter(e=>e.id===t.id);if(e.length>1)return void console.error(`[DfFormPreview] ID COLLISION DETECTED! Multiple components share ID "${t.id}":`,e.map(t=>({id:t.id,name:t.name,label:t.basic?.label})));const A=F[t.id];void 0!==A&&t.value;const r=J.findComponent(i,t.id),n={...F};n[t.id]=t.value,r&&(r.id&&(n[r.id]=t.value),r._id&&(n[r._id]=t.value),r.basic?.label&&(n[r.basic.label]=t.value)),Q(n);const s=i.find(e=>e.id===t.id);if(s){const t=s?.threshold;t&&t.conditions&&t.conditions.length>0&&H(e=>{const A=new Set(e);return t.conditions.forEach(t=>{A.delete(t.id)}),A})}const o=e=>e.map(e=>e.id===t.id&&"defaultValue"in e.basic?{...e,basic:{...e.basic,value:t.value??e.basic.defaultValue,defaultValue:t.value}}:"section"===e.name&&e.children?{...e,children:o(e.children)}:"table"===e.name&&e.cells?{...e,cells:e.cells.map(t=>t.map(t=>{const e={...t};return e.components&&(e.components=o(e.components)),e}))}:"datagrid"===e.name&&e.entries?{...e,entries:e.entries.map(t=>{const e={...t};return e.components&&(e.components=o(e.components)),e})}:e),l=o(i);if(c?.(l),U[t.id]&&E(e=>({...e,[t.id]:""})),!a){if(t.isValid)return void E(e=>{const A=e[t.id];return A&&""!==A.trim()?{...e,[t.id]:""}:e});setTimeout(()=>{et(t.id)},150)}W(n,l)},[i,F,U,c,W]),tt=r((t,e)=>{for(const A of t){if(A.id===e)return A;if("section"===A.name&&A.children){const t=tt(A.children,e);if(t)return t}if("table"===A.name&&A.cells)for(const t of A.cells)for(const A of t)if(A.components){const t=tt(A.components,e);if(t)return t}if("datagrid"===A.name&&A.entries)for(const t of A.entries)if(t.components){const A=tt(t.components,e);if(A)return A}}return null},[]),et=r(t=>{if(a)return;const e=tt(i,t);if(!e)return;const A=F[t]||"";if("number-input"===e.name&&(!A||""===A)){if(e.validation.required){const A=e.validation.customValidationMessage,r=e.basic.label||"This field",n=A||`${r} is required`;E(e=>({...e,[t]:n}))}else E(e=>({...e,[t]:""}));return}let r=!1;r=Array.isArray(A)?A.length>0:"string"==typeof A?""!==A.trim():null!=A;let n="";if(e.validation.required&&!r){const t=e.validation.customValidationMessage,A=e.basic.label||"This field";n=t||`${A} is required`}else if("email-input"===e.name&&r&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(A)){const t=e.validation.customValidationMessage,A=e.basic.label||"This field";n=t||`${A} must be a valid email`}else if(e.validation.minLength&&r&&A.length<e.validation.minLength){const t=e.validation.customValidationMessage,A=e.basic.label||"This field";n=t||`${A} must be at least ${e.validation.minLength} characters`}else if(e.validation.maxLength&&r&&A.length>e.validation.maxLength){const t=e.validation.customValidationMessage,A=e.basic.label||"This field";n=t||`${A} must be no more than ${e.validation.maxLength} characters`}else if("number-input"===e.name&&r){const t=String(A).trim(),r=parseFloat(t);if(!isNaN(r)){const t=e.validation;t&&"lowerLimit"in t&&void 0!==t.lowerLimit&&null!==t.lowerLimit&&0!==t.lowerLimit&&r<t.lowerLimit?n="Number is below the lower limit":t&&"upperLimit"in t&&void 0!==t.upperLimit&&null!==t.upperLimit&&0!==t.upperLimit&&r>t.upperLimit&&(n="Number is above the upper limit")}}E(e=>({...e,[t]:n}))},[i,a,F,tt]),At=r(t=>{I(e=>({...e,[t]:!0})),a||setTimeout(()=>{et(t)},0)},[a,et]),rt=r(t=>{U[t]&&E(e=>({...e,[t]:""}))},[U]),gt=r(()=>!Object.values(U).some(t=>t&&"string"==typeof t&&""!==t.trim())&&i.every(t=>{const e=F[t.id]||"";let A=!1;if(A=Array.isArray(e)?e.length>0:"string"==typeof e?""!==e.trim():null!=e,t.validation.required&&!A)return!1;if("number-input"===t.name&&A){const A=String(e).trim(),r=parseFloat(A);if(!isNaN(r)){const e=t.validation;if(e&&"lowerLimit"in e&&void 0!==e.lowerLimit&&null!==e.lowerLimit&&0!==e.lowerLimit&&r<e.lowerLimit)return!1;if(e&&"upperLimit"in e&&void 0!==e.upperLimit&&null!==e.upperLimit&&0!==e.upperLimit&&r>e.upperLimit)return!1}}return!0}),[i,F,U]),wt=r((t,e)=>{if(Array.isArray(e))return e.some(e=>wt(t,e));if(null==e||""===e)return!1;const A="string"==typeof e?parseFloat(e):e,r="string"==typeof t.value?parseFloat(t.value):t.value;if(!isNaN(A)&&!isNaN(r))switch(t.operator){case"greaterThan":return A>r;case"lessThan":return A<r;case"greaterThanOrEqual":return A>=r;case"lessThanOrEqual":return A<=r;case"equals":return A===r;case"notEquals":return A!==r;default:return!1}const n=String(e).toLowerCase(),i=String(t.value).toLowerCase();switch(t.operator){case"equals":return n===i||String(e)===String(t.value);case"notEquals":return n!==i&&String(e)!==String(t.value);default:return!1}},[]),yt=r(()=>{if(a)return[];const t=[];return i.forEach(e=>{const A=e?.condition;if(!A||!A.conditions||0===A.conditions.length)return;const r=F[e.id];null!=r&&""!==r&&!(Array.isArray(r)&&0===r.length)&&A.conditions.forEach(A=>{wt(A,r)&&t.push({componentId:e.id,condition:A,componentLabel:e.basic?.label||"Field"})})}),t},[i,F,a,wt]),bt=r(()=>{if(a)return{isValid:!0};const t=yt();if(0===t.length)return{isValid:!0};for(const{condition:e,componentLabel:A}of t){const t=O.get(e.id)||{notesCompleted:!1,attachmentsCompleted:!1,emailSent:!1},r=[];if(!0!==e.enableRaiseIssue||T.has(e.id)||r.push("raise an issue"),!0!==e.enableNotes||t.notesCompleted||r.push("add notes"),!0!==e.enableAttachment||t.attachmentsCompleted||r.push("add attachments"),!0!==e.enableSendEmail||t.emailSent||r.push("send email"),r.length>0){return{isValid:!1,errorMessage:`Please ${1===r.length?r[0]:r.slice(0,-1).join(", ")+" and "+r[r.length-1]} for the threshold condition met in "${A}". You cannot submit the form until all required actions are completed.`}}}return{isValid:!0}},[a,yt,T,O]),vt=r(t=>{t&&H(e=>{const A=new Set(e);return A.add(t),A})},[]),xt=r((t,e,A)=>{t&&P(r=>{const n=new Map(r),i=n.get(t)||{notesCompleted:!1,attachmentsCompleted:!1,emailSent:!1};return"notes"===e?n.set(t,{...i,notesCompleted:A}):"attachments"===e?n.set(t,{...i,attachmentsCompleted:A}):"email"===e&&n.set(t,{...i,emailSent:A}),n})},[]);A(()=>{if(!a){const t=bt();M(t)}},[F,T,O,a,bt]);const Ut=r(()=>{if(a)return!0;let t=!0;S(!0);const e={};return i.forEach(A=>{const r=F[A.id]||"";let n=!1;if(n=Array.isArray(r)?r.length>0:"string"==typeof r?""!==r.trim():null!=r,A.validation.required&&!n){const r=A.validation.customValidationMessage,n=A.basic.label||"This field",i=r||`${n} is required`;e[A.id]=i,t=!1}else if("number-input"===A.name&&n){const n=String(r).trim(),i=parseFloat(n);if(isNaN(i))e[A.id]="";else{const r=A.validation;r&&"lowerLimit"in r&&void 0!==r.lowerLimit&&null!==r.lowerLimit&&0!==r.lowerLimit&&i<r.lowerLimit?(e[A.id]="Number is below the lower limit",t=!1):r&&"upperLimit"in r&&void 0!==r.upperLimit&&null!==r.upperLimit&&0!==r.upperLimit&&i>r.upperLimit?(e[A.id]="Number is above the upper limit",t=!1):e[A.id]=""}}else e[A.id]="";I(t=>({...t,[A.id]:!0}))}),E(e),t},[i,a,F]),Et=r((t="Submitted")=>{if(S(!0),!Ut()){const t=i.find(t=>{const e=F[t.id]||"";let A=!1;return A=Array.isArray(e)?e.length>0:"string"==typeof e?""!==e.trim():null!=e,t.validation.required&&!A});if(t){const e=document.getElementById(t.id);e&&e.focus()}return}const e=bt();if(!e.isValid){e.errorMessage&&$.showError(e.errorMessage);const t=yt().find(({condition:t})=>!T.has(t.id));if(t){const e=document.getElementById(t.componentId);e&&e.scrollIntoView({behavior:"smooth",block:"center"})}return}const A=t=>t.map(t=>{let e=F[t.id];"text-input"===t.name&&t.basic,void 0===e&&(e="value"in t.basic&&void 0!==t.basic.value?t.basic.value:"defaultValue"in t.basic&&void 0!==t.basic.defaultValue?t.basic.defaultValue:""),"text-input"===t.name&&t.basic;const r={...t,basic:{...t.basic,value:e,defaultValue:e,notes:void 0!==j[t.id]?j[t.id]:t.basic?.notes,comments:void 0!==j[t.id]?j[t.id]:t.basic?.comments||t.basic?.notes,attachments:void 0!==K[t.id]?K[t.id]:t.basic?.attachments}};return"section"===r.name&&r.children&&(r.children=A(r.children)),"table"===r.name&&r.cells&&(r.cells=r.cells.map(t=>t.map(t=>{const e={...t};return e.components&&(e.components=A(e.components)),e}))),"datagrid"===r.name&&r.entries&&(r.entries=r.entries.map(t=>{const e={...t};return e.components&&(e.components=A(e.components)),e})),r}),r=A(i),n={...F,status:t};l?.(r,n)},[i,F,Ut,l,j,K]),Nt=r(()=>({[`device-${s}`]:!0,readonly:a}),[s,a]),St=r((t,e)=>{R(A=>({...A,[t]:e}))},[]),Lt=r((t,e)=>{V(A=>({...A,[t]:e||[]}))},[]),It=n(new Map),_t=n(0),kt=e=>{let A;if(e.id&&"string"==typeof e.id&&""!==e.id.trim())A=e.id;else{const t=e.basic?.label||"",r=e.name||"unknown",n=`${r}-${t}`;let i=It.current.get(n);i||(_t.current+=1,i=`generated-${r}-${_t.current}-${Math.random().toString(36).substr(2,9)}`,It.current.set(n,i),console.warn("[DfFormPreview] Generated and cached ID for component:",i,"key:",n)),A=i,e={...e,id:A}}const r=A,n=F[r];if(void 0!==n){const t=i.filter(t=>t.id!==r&&F[t.id]===n);t.length>0&&console.warn(`[DfFormPreview] Component ${r} shares form value with other components:`,t.map(t=>t.id))}const s={id:r,validationErrors:U,formValue:n,touchedFields:L,formSubmitted:N,mode:"test",readonly:!1,onValueChange:Z,onBlur:()=>At(r),onFocus:()=>rt(r)};switch(e.name){case"text-input":case"number-input":case"email-input":return X.jsx(nt,{...s,properties:e,inputType:"text-input"===e.name?"text":"number-input"===e.name?"number":"email",formTemplateId:d,onThresholdIssueRaised:vt,raisedThresholdIssues:T,workOrderNumber:B,assetNumber:y,user:v});case"textarea":return X.jsx(it,{...s,properties:e});case"select":const A={...e,options:e.basic?.options||[],basic:{...e.basic,comments:e.basic?.comments||""}};return X.jsx(st,{...s,properties:A});case"checkbox":const r={...e,options:e.basic?.options||[],basic:{...e.basic,comments:e.basic?.comments||""}};return X.jsx(at,{...s,properties:r});case"radio":const a={...e,options:e.basic?.options||[],basic:{...e.basic,comments:e.basic?.comments||""}};return X.jsx(ot,{...s,properties:a});case"segment":const o={...e,options:e.basic?.options||[],basic:{...e.basic,comments:e.basic?.comments||""}};return X.jsx(lt,{...s,properties:o});case"date":case"date-picker":case"datetime-picker":return X.jsx(ct,{...s,properties:e});case"signature":return X.jsx(ut,{...s,properties:e});case"heading":return X.jsx(ft,{...s,properties:e});case"instructions":const l=n||e.basic?.value||null;return X.jsx(pt,{...s,properties:e,formValue:l});case"location":return X.jsx(dt,{...s,properties:e});case"section":return X.jsx(Ft,{...s,properties:e,formData:F,formTemplateId:d,onThresholdActionCompletion:xt,onThresholdIssueRaised:vt,onNotesChange:St,onAttachmentChange:Lt,workOrderNumber:B,assetNumber:y,user:v,onCreateIssue:C,onUpdateIssue:x,renderFormComponent:t=>kt(t)});case"table":return X.jsx(t.Suspense,{fallback:X.jsx("div",{children:"Loading table..."}),children:X.jsx(Qt,{...s,properties:e,formData:F,formTemplateId:d,mode:s.mode,validationErrors:U,touchedFields:L,formSubmitted:N,onThresholdActionCompletion:xt,onThresholdIssueRaised:vt,workOrderNumber:B,assetNumber:y,onCreateIssue:C,onUpdateIssue:x,onNotesChange:(t,A)=>{const r=i.map(r=>{if(r.id===e.id&&r.cells){const e=r.cells.map(e=>e.map(e=>{if(e.components){const r=e.components.map(e=>e.id===t?{...e,basic:{...e.basic,notes:A}}:e);return{...e,components:r}}return e}));return{...r,cells:e}}return r});c?.(r)},onAttachmentChange:(t,A)=>{const r=i.map(r=>{if(r.id===e.id&&r.cells){const e=r.cells.map(e=>e.map(e=>{if(e.components){const r=e.components.map(e=>e.id===t?{...e,basic:{...e.basic,attachments:A||[]}}:e);return{...e,components:r}}return e}));return{...r,cells:e}}return r});c?.(r)},renderFormComponent:t=>kt(t)})});case"datagrid":return X.jsx(Ct,{...s,properties:e,formData:F,formTemplateId:d,mode:s.mode,validationErrors:U,touchedFields:L,formSubmitted:N,onThresholdActionCompletion:xt,onThresholdIssueRaised:vt,workOrderNumber:B,assetNumber:y,user:v,onComponentSelect:f,onComponentDelete:p,onComponentEdit:g,onCreateIssue:C,onUpdateIssue:x,onComponentUpdate:m,selectedComponent:w,onNotesChange:(t,A)=>{St(t,A);const r=i.map(r=>{if(r.id===e.id&&r.entries){const e=r.entries.map(e=>{if(e.components){const r=e.components.map(e=>e.id===t?{...e,basic:{...e.basic,notes:A||""}}:e);return{...e,components:r}}return e});return{...r,entries:e}}return r});c?.(r)},onAttachmentChange:(t,A)=>{Lt(t,A);const r=i.map(r=>{if(r.id===e.id&&r.entries){const e=r.entries.map(e=>{if(e.components){const r=e.components.map(e=>e.id===t?{...e,basic:{...e.basic,attachments:A||[]}}:e);return{...e,components:r}}return e});return{...r,entries:e}}return r});c?.(r)},onValueChange:t=>{if(t.id===e.id&&t.value&&"object"==typeof t.value&&"entries"in t.value){const A=i.map(A=>A.id===e.id?{...A,...t.value}:A);c?.(A),t.value.entries&&Array.isArray(t.value.entries)&&t.value.entries.forEach(t=>{t.components&&Array.isArray(t.components)&&t.components.forEach(t=>{if(void 0!==F[t.id]);else{const e=t.basic?.defaultValue;void 0!==e&&Q(A=>({...A,[t.id]:e}))}})})}else Z(t)},onEntryAdd:()=>{const t=i.find(t=>t.id===e.id);if(t&&t.entries){const t=i.map(t=>t.id===e.id?{...t,entries:t.entries||[]}:t);c?.(t)}else setTimeout(()=>{const t=F[e.id];if(t&&"object"==typeof t&&"entries"in t){const A=i.map(A=>A.id===e.id?{...A,entries:t.entries}:A);c?.(A)}},100)},onEntryRemove:t=>{const A=i.map(A=>{if(A.id===e.id&&A.entries){const e=(A.entries||[]).filter((e,A)=>A!==t).map((t,e)=>({...t,index:e,id:`entry-${A.id}-${e}`,components:t.components?.map((t,A)=>{const r=(t.templateComponents||[])[A];return{...t,id:r?`${r.id}-entry-${e}-${A}`:t.id}})||[]}));return{...A,entries:e}}return A});c?.(A)},renderFormComponent:t=>kt(t)});case"file":const u=n||e.basic?.value||e.basic?.files||e.basic?.attachments||null;return X.jsx(ht,{...s,properties:e,formValue:u});default:return X.jsx("div",{className:"form-group",children:X.jsxs("div",{className:"form-group-label",children:["Unsupported Component: ",e.name]})})}};return X.jsx("div",{className:"form-preview-container",children:X.jsx("div",{className:"form-preview-wrapper",children:X.jsxs("div",{className:`form-preview ${Object.entries(Nt()).map(([t,e])=>e?t:"").join(" ")}`,children:[X.jsx("div",{className:"form-canvas-header"}),0===i.length?X.jsx("div",{className:"empty-state",children:X.jsx("div",{className:"empty-state-card",children:X.jsx("div",{className:"empty-state-preview-area",children:X.jsx("span",{className:"empty-state-placeholder",children:"Add components to see the form preview"})})})}):X.jsxs("form",{className:"form-preview-form",onSubmit:t=>{t.preventDefault(),Et()},children:[(u||h)&&X.jsxs("div",{className:"form-header",children:[u&&X.jsx("h1",{className:"form-title",children:u}),h&&X.jsx("p",{className:"form-description",children:h})]}),i.map(t=>{const e=t.basic,A=F[t.id],r=["select","radio","checkbox","segment"].includes(t.name||""),n=t.options||e?.options||[],s=(()=>{const e=t?.styles?.column;return"section"===t.name||"table"===t.name||"datagrid"===t.name?"col-12":3===e?"col-3":6===e?"col-6":9===e?"col-9":"col-12"})();let o=!1;if(!a)if(r&&null!=A&&""!==A)if("checkbox"===t.name){o=(Array.isArray(A)?A:[A]).some(t=>{const e=n.find(e=>e.value===t);return e&&(e.enableNotes||e.enableAttachment||e.enableRaiseIssue||e.enableSendEmail)})}else{const t=n.find(t=>t.value===A);o=t&&(t.enableNotes||t.enableAttachment||t.enableRaiseIssue||t.enableSendEmail)}else o=e?.enableNotes||e?.enableAttachment||e?.enableRaiseIssue||e?.enableSendEmail;const l=a&&(t.basic?.notes&&t.basic.notes.trim().length>0||t.basic?.attachments&&Array.isArray(t.basic.attachments)&&t.basic.attachments.length>0);return X.jsxs("div",{className:`form-group ${s} ${o||l?"has-action-features":""}`,style:{display:Y(t.id)?"block":"none"},children:[kt(t),!a&&!["section","table","heading","file","instructions","signature","location","datagrid"].includes(t.name)&&X.jsx(mt,{component:t,mode:a?"preview":"test",formTemplateId:d,formValue:A,onThresholdActionCompletion:xt,onThresholdIssueRaised:vt,onNotesChange:e=>{R(A=>({...A,[t.id]:e}));const A=i.map(A=>A.id===t.id?{...A,basic:{...A.basic,notes:e||""}}:A);c?.(A)},onAttachmentChange:e=>{V(A=>({...A,[t.id]:e||[]}));const A=i.map(A=>A.id===t.id?{...A,basic:{...A.basic,attachments:e||[]}}:A);c?.(A)},notes:void 0!==j[t.id]?j[t.id]:t.basic?.notes||"",attachments:void 0!==K[t.id]?K[t.id]:t.basic?.attachments||null,workOrderNumber:B,assetNumber:y,isStandalone:b,user:v,onCreateIssue:C,onUpdateIssue:x}),a&&l&&X.jsx(Bt,{component:t})]},t.id)}),!a&&X.jsxs("div",{className:"form-actions",children:[!N&&X.jsx("button",{type:"button",onClick:()=>Et("Saved"),className:"form-save-button",disabled:N&&!gt(),children:"Save"}),X.jsx("button",{type:"button",disabled:!gt()||!D.isValid,className:"form-submit-button",title:D.isValid?"":D.errorMessage,onClick:()=>Et("Submitted"),children:"Submit"})]})]})]})})})},Et=({comment:t="",onSave:n,placeholder:i="Enter your reason...",className:s="",disabled:a=!1})=>{const[o,l]=e(!0),[c,u]=e(t),[h,d]=e(!1);A(()=>{u(t),d(!1)},[t]);const f=r(e=>{const A=e.target.value;u(A),d(A!==t)},[t]),p=r(()=>{h&&n&&!a&&(n(c),d(!1))},[h,n,c,a]),g=r(()=>{},[]),m=r(()=>{a||l(!o)},[o,a]);return X.jsxs("div",{className:`df-form-comments ${s}`,children:[X.jsxs("div",{className:"df-form-comments__header",children:[X.jsx("h3",{className:"df-form-comments__title",children:"Comments"}),X.jsx("button",{className:"df-form-comments__toggle",type:"button",onClick:m,"aria-expanded":o,"aria-label":"Toggle comments section",disabled:a,children:o?X.jsx("span",{className:"df-form-comments__toggle-icon",children:"▼"}):X.jsx("span",{className:"df-form-comments__toggle-icon",children:"▶"})})]}),X.jsx("div",{className:"df-form-comments__content "+(o?"df-form-comments__content--expanded":""),children:X.jsx("div",{className:"df-form-comments__input-container",children:X.jsx("div",{className:"df-form-comments__input-line",children:X.jsx("input",{type:"text",id:"comment-input",className:"df-form-comments__input",value:c,onChange:f,onBlur:p,onFocus:g,placeholder:i,disabled:a})})})})]})},Nt=t=>t.id?t:{...t,id:M()},St=({component:t,mode:e,renderFormComponent:A,formData:r={},formTemplateId:n,onThresholdActionCompletion:i,onThresholdIssueRaised:s,onNotesChange:a,onAttachmentChange:o,workOrderNumber:l,assetNumber:c,user:u,onCreateIssue:h,onUpdateIssue:d})=>{const f=r[t.id],p="preview"===e&&(t.basic?.notes&&t.basic.notes.trim().length>0||t.basic?.attachments&&Array.isArray(t.basic.attachments)&&t.basic.attachments.length>0);return X.jsxs("div",{className:"simple-table-component",children:[A(t),!["section","table","heading","file","instructions","signature","location","datagrid"].includes(t.name)&&X.jsx(mt,{component:t,mode:"test",formTemplateId:n,formValue:f,formData:r,onThresholdActionCompletion:i,onThresholdIssueRaised:s,onNotesChange:a?e=>a(t.id,e):void 0,onAttachmentChange:o?e=>o(t.id,e):void 0,workOrderNumber:l,assetNumber:c,user:u,onCreateIssue:h,onUpdateIssue:d}),p&&X.jsx(Bt,{component:t})]})},Lt=({component:t,selectedComponent:e,mode:A,onComponentSelect:r,onComponentDelete:n,onComponentEdit:i,renderFormComponent:s,isOverlay:a=!1})=>{const{attributes:o,listeners:l,setNodeRef:c,transform:u,transition:h,isDragging:d,isSorting:f}=O({id:t.id,disabled:a}),p={transform:D.Transform.toString(u),transition:h,opacity:d?.3:1,zIndex:d?1e3:"auto"};return X.jsxs("div",{ref:c,style:p,className:`form-component table-component ${e?.id===t.id?"selected":""} ${d?"dragging":""} ${f?"sorting":""}`,onClick:()=>!d&&r(t),role:"button",tabIndex:0,children:["edit"===A&&X.jsx("div",{className:"component-drag-handle",...l,...o,onClick:t=>t.stopPropagation(),style:{opacity:1},children:X.jsx(E,{size:14})}),X.jsx("div",{className:"component-content",children:s(t)}),"edit"===A&&X.jsxs("div",{className:"component-actions",style:{opacity:1},children:[i&&X.jsx("button",{className:"component-edit-btn",onClick:e=>{e.stopPropagation(),i(t)},type:"button",title:"Edit Component",children:X.jsx(N,{size:12})}),X.jsx("button",{className:"component-delete-btn",onClick:e=>{e.stopPropagation(),n(t,e)},type:"button",title:"Delete Component",children:X.jsx(S,{size:12})})]})]})},It=({cell:t,mode:e,onComponentSelect:A,onComponentDelete:r,onComponentEdit:n,selectedComponent:i,renderFormComponent:s,formData:a={},formTemplateId:o,onThresholdActionCompletion:l,onThresholdIssueRaised:c,tableId:u,onNotesChange:h,onAttachmentChange:d,workOrderNumber:f,assetNumber:p,user:g,onCreateIssue:m,onUpdateIssue:w})=>{const B=`table-cell-${u}-${t.row}-${t.column}`,{setNodeRef:y,isOver:b}=k({id:B,disabled:"edit"!==e,data:{type:"table-cell",tableId:u,cell:t,row:t.row,column:t.column}}),v={...t.styles,backgroundColor:b?"var(--df-color-primary-light)":t.styles?.backgroundColor||"transparent",minHeight:t.styles?.minHeight||"preview"===e||"test"===e?"40px":"60px",padding:(t.styles,"8px"),border:"preview"===e||"test"===e?"none":b?"2px dashed var(--df-color-primary)":t.styles?.borderColor?`1px solid ${t.styles.borderColor}`:"1px solid var(--df-color-fb-border)",borderRadius:"preview"===e||"test"===e?"0":"4px",position:"relative",verticalAlign:t.styles?.verticalAlign||"top"};return X.jsx("td",{ref:y,style:v,className:"table-cell "+(b?"drag-over":""),children:X.jsx("div",{className:"cell-content",children:t.components&&Array.isArray(t.components)&&t.components.length>0?"edit"===e?X.jsx(T,{items:t.components.map(t=>t.id||M()),strategy:P,children:t.components.map(t=>{const a=Nt(t);return X.jsx(Lt,{component:a,selectedComponent:i,mode:e,onComponentSelect:A,onComponentDelete:r,onComponentEdit:n,renderFormComponent:s},a.id)})}):t.components.map(t=>{const A=t.id?t:Nt(t);return X.jsx(St,{component:A,mode:e,renderFormComponent:s,formData:a,formTemplateId:o,onThresholdActionCompletion:l,onThresholdIssueRaised:c,onNotesChange:h,onAttachmentChange:d,workOrderNumber:f,assetNumber:p,user:g,onCreateIssue:m,onUpdateIssue:w},A.id)}):"edit"===e?X.jsx("div",{className:"empty-cell-placeholder",children:X.jsxs("div",{className:"cell-info",children:[X.jsx("span",{className:"drop-zone-text",children:"Drag and Drop a form component"}),X.jsxs("span",{className:"cell-coordinates",children:["Cell (",t.row+1,", ",t.column+1,")"]})]})}):X.jsx("div",{style:{minHeight:"20px",backgroundColor:"transparent",visibility:"hidden"},children:" "})})})},_t=({id:t,properties:n,mode:s="edit",formData:a={},validationErrors:o={},touchedFields:l={},formSubmitted:c=!1,onValueChange:u,onSelect:h,isSelected:d=!1,className:f="",onTableSelect:p,onComponentSelect:g,onComponentDelete:m,onComponentEdit:w,selectedComponent:B,renderFormComponent:y,formTemplateId:b,onThresholdActionCompletion:v,onThresholdIssueRaised:C,onNotesChange:x,onAttachmentChange:U,workOrderNumber:E,assetNumber:N,user:S,onCreateIssue:I,onUpdateIssue:_})=>{const[k,T]=e(!1),H=n.cells?.some(t=>t.some(t=>t.components&&t.components.length>0))||!1;A(()=>{},[n.table?.rows,n.table?.columns,n.basic?.rows,n.basic?.columns,n.cells,t,u]);const O=r(t=>{t.stopPropagation(),h?.(),p?.(n)},[h,p,n]),P=r((e,A)=>{A.stopPropagation();const r=n.cells.map(t=>t.map(t=>{if(t.components&&t.components.some(t=>t.id===e.id)){const A=t.components.filter(t=>t.id!==e.id);return{...t,components:A}}return t}));u&&u({id:t,value:{...n,cells:r}})},[m,n,u,t]),D=i(()=>n.cells?n.cells.map((e,A)=>e.map((e,r)=>({...e,components:e.components&&Array.isArray(e.components)?e.components.map((e,n)=>{if(e.id&&"string"==typeof e.id&&""!==e.id.trim())return e;const i=`${e.name||"component"}-table-${t}-row-${A}-cell-${r}-comp-${n}`;return{...e,id:i}}):[]}))):[],[n.cells,t]),M=y||r(t=>{const e=t.id?t:Nt(t),A=a[e.id]||"defaultValue"in e.basic&&e.basic.defaultValue||"";let r=A;"number-input"===e.name&&"number"==typeof A?r=String(A):"number-input"===e.name&&null==A&&(r="");const n={id:e.id,properties:e,validationErrors:{},formValue:r,touchedFields:{},formSubmitted:!1,mode:s,onValueChange:t=>{u?.(t)},onBlur:()=>{},onFocus:()=>{}};switch(e.name){case"text-input":case"email-input":case"number-input":return X.jsx(nt,{...n,properties:e,inputType:"text-input"===e.name?"text":"number-input"===e.name?"number":"email",readonly:!1,disabled:!1});case"textarea":return X.jsx(it,{...n,properties:e,readonly:!1,disabled:!1});case"select":const t={...e,options:e.basic?.options||[]};return X.jsx(st,{...n,properties:t,disabled:!1});case"checkbox":const A={...e,options:e.basic?.options||[]};return X.jsx(at,{...n,properties:A,formValue:[],disabled:!1});case"radio":const r={...e,options:e.basic?.options||[]};return X.jsx(ot,{...n,properties:r,readonly:!1,disabled:!1});case"date":case"date-picker":case"datetime-picker":return X.jsx(ct,{...n,properties:e,readonly:!1,disabled:!1});case"signature":return X.jsx(ut,{...n,properties:e});case"heading":return X.jsx(ft,{...n,properties:e});case"instructions":return X.jsx(pt,{...n,properties:e});case"location":return X.jsx(dt,{...n,properties:e});case"datagrid":return X.jsx(Ct,{...n,properties:e,formData:a,mode:s,onNotesChange:()=>{},onAttachmentChange:()=>{}});case"segment":const i={...e,options:e.basic?.options||[]};return X.jsx(lt,{...n,properties:i});default:return X.jsxs("div",{className:"unknown-component",children:["Unknown component: ",e.name]})}},[y,s,a,u]),j={backgroundColor:n.styles?.backgroundColor||"var(--df-color-fb-container)",borderColor:n.styles?.borderColor||"var(--df-color-fb-border)",borderWidth:n.styles?.borderWidth||"2px",borderRadius:n.styles?.borderRadius||"8px",padding:n.styles?.padding||"16px",margin:n.styles?.margin||"16px 0"},R={width:"100%",minWidth:"600px",borderCollapse:"preview"===s||"test"===s?"separate":"collapse",tableLayout:"fixed",border:"preview"===s||"test"===s?"1px solid var(--df-color-fb-border)":"none"};return H||"preview"!==s?X.jsxs("div",{className:`form-group df-form-table ${d?"selected":""} ${"preview"===s?"preview-mode":"test"===s?"test-mode":""} ${f}`,onClick:O,style:j,children:[X.jsx("div",{className:"table-header",children:X.jsx("div",{className:"table-title",onClick:e=>{e.stopPropagation(),T(!k),u?.({id:t,value:{...n,basic:{...n.basic||{},collapsed:!k}}})},children:X.jsxs("div",{className:"title-content",children:[k?X.jsx(Q,{size:16}):X.jsx(F,{size:16}),X.jsx(L,{size:16}),X.jsx("span",{className:"table-label",children:n.basic?.label||"Table"}),n.validation?.required&&X.jsx("span",{className:"required-indicator",children:"*"})]})})}),n.basic?.description&&!k&&X.jsx("div",{className:"table-description",children:n.basic.description}),!k&&X.jsxs("div",{className:"table-content",children:[null,X.jsxs("table",{style:R,children:[n.table?.displayAsTable&&("edit"===s||n.table?.showColumns)&&X.jsx("thead",{children:X.jsx("tr",{className:"table-header-row",children:Array.from({length:n.table?.columns||n.basic?.columns||3},(t,e)=>{const A=(n.table?.columnNames?.split(",").map(t=>t.trim())||[])[e]||`Column ${e+1}`;return X.jsx("th",{className:"table-header-cell",style:{backgroundColor:(n.styles.headerBackgroundColor,"var(--df-color-fb-container)"),color:n.styles.headerTextColor||"var(--df-color-text-dark)",padding:"12px",border:"1px solid var(--df-color-fb-border)",fontWeight:"600",fontSize:"14px",textAlign:"center"},children:A},`header-${e}`)})})}),X.jsx("tbody",{children:D.map((e,A)=>X.jsx("tr",{className:"table-row",children:e.map(e=>X.jsx(It,{cell:e,mode:s,onComponentSelect:g||(()=>{}),onComponentDelete:P,onComponentEdit:w,selectedComponent:B||null,renderFormComponent:M,formData:a,formTemplateId:b,onThresholdActionCompletion:v,onThresholdIssueRaised:C,tableId:t,onNotesChange:x,onAttachmentChange:U,workOrderNumber:E,assetNumber:N,user:S,onCreateIssue:I,onUpdateIssue:_},e.id))},A))})]})]})]}):null};var kt=Object.freeze({__proto__:null,DfFormTable:_t,default:_t});const Tt={page:{fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif',padding:"30px",backgroundColor:"#ffffff",color:"#000000",lineHeight:"1.4"},header:{marginBottom:"30px",paddingBottom:"15px",borderBottom:"2px solid #303992",display:"flex",justifyContent:"space-between",alignItems:"flex-end"},title:{margin:"0 0 5px 0",fontSize:"24px",fontWeight:"bold",color:"#303992"},description:{margin:"0",fontSize:"14px",color:"#666666"},submittedBy:{fontSize:"14px",color:"#333",textAlign:"right",whiteSpace:"nowrap",marginBottom:"2px"},formGroup:{marginBottom:"20px",breakInside:"avoid"},label:{fontWeight:"400",display:"block",marginBottom:"8px",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif',fontSize:"14px",lineHeight:"1.5",fontColor:"var(--df-color-text-dark)"},labelLeft:{fontWeight:"400",display:"block",marginRight:"10px",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif',fontSize:"14px",lineHeight:"1.5",width:"60%",fontColor:"var(--df-color-text-dark)"},valueContainer:{border:"1px solid #e2e8f0",borderRadius:"6px",padding:"8px 12px",backgroundColor:"#ffffff",minHeight:"20px",fontSize:"14px",flex:1},value:{fontSize:"14px",color:"#000000"},gridRow:{display:"flex",flexWrap:"wrap",gap:"16px",marginBottom:"20px"},gridCol:t=>({flex:`0 0 calc(${t/12*100}% - 8px)`,minWidth:"0"}),img:{maxWidth:"100%",maxHeight:"300px",border:"1px solid #ddd",borderRadius:"4px",display:"block",marginTop:"5px"},table:{width:"100%",borderCollapse:"collapse",border:"1px solid #ddd",marginTop:"10px",tableLayout:"fixed"},th:{border:"1px solid #ddd",padding:"8px",backgroundColor:"#f5f5f5",fontWeight:"bold",textAlign:"left",fontSize:"13px"},td:{border:"1px solid #ddd",padding:"8px",fontSize:"13px",verticalAlign:"top"},section:{marginBottom:"25px",breakInside:"avoid"},sectionHeader:{fontSize:"18px",marginBottom:"15px",display:"block",fontWeight:"600"},sectionChildren:{marginLeft:"20px",paddingLeft:"20px",borderLeft:"2px solid #3b82f6",marginTop:"15px"},notesSection:{marginTop:"10px",padding:"10px",backgroundColor:"rgba(48, 57, 146, 0.05)",borderLeft:"3px solid #303992",borderRadius:"4px",fontSize:"13px",boxSizing:"border-box"},notesLabel:{fontWeight:"bold",color:"#303992",marginRight:"5px"},attachmentsSection:{marginTop:"10px",padding:"10px",backgroundColor:"rgba(48, 57, 146, 0.05)",borderLeft:"3px solid #303992",borderRadius:"4px",display:"flex",flexWrap:"wrap",gap:"10px",boxSizing:"border-box"},attachmentThumbnail:{width:"60px",height:"60px",border:"1px solid #e5e7eb",borderRadius:"4px",overflow:"hidden",backgroundColor:"#fff",display:"flex",alignItems:"center",justifyContent:"center"},attachmentImg:{width:"100%",height:"100%",objectFit:"cover"},segmentContainer:{display:"flex",gap:"8px",flexWrap:"wrap",alignItems:"center"},segmentButton:{display:"flex",alignItems:"center",justifyContent:"center",padding:"4px 6px",borderRadius:"6px",border:"1px solid #e0e0e0",backgroundColor:"#ffffff",fontSize:"10px",fontWeight:600,minWidth:"30px",color:"#666"},segmentIcon:{marginRight:"4px",fontSize:"9px",fontWeight:"bold",display:"inline-block",lineHeight:"1"},checkboxItem:{display:"flex",alignItems:"center",padding:"10px 14px",backgroundColor:"#f8f9fa",borderRadius:"6px",marginBottom:"8px",width:"100%",boxSizing:"border-box"}},Ht=t=>{if(!t||"string"!=typeof t)return!1;const e=t.trim();return e.startsWith("data:image")||e.startsWith("iVBORw0KGgo")||e.startsWith("/9j/4AAQ")||e.startsWith("UklGR")||e.startsWith("R0lGOD")},Ot=(t,e)=>{if(!t)return"";const A=t.trim();return A.startsWith("data:")||A.startsWith("http")||A.startsWith("blob:")||A.startsWith("/")?A:A.startsWith("iVBORw0KGgo")?`data:image/png;base64,${A}`:A.startsWith("/9j/4AAQ")?`data:image/jpeg;base64,${A}`:A.startsWith("UklGR")?`data:image/webp;base64,${A}`:A.startsWith("R0lGOD")?`data:image/gif;base64,${A}`:e&&e.startsWith("image/")?`data:${e};base64,${A}`:A},Pt=t=>{const e=String(t||"").toLowerCase();return"pass"===e||"yes"===e?"pass":"fail"===e||"no"===e?"fail":"pass"},Dt=({component:t})=>{const e=t.basic?.notes||"",A=t.basic?.attachments||[];return e.trim()||0!==A.length?X.jsxs("div",{style:{marginTop:"5px"},children:[e.trim().length>0&&X.jsxs("div",{style:Tt.notesSection,children:[X.jsx("span",{style:Tt.notesLabel,children:"Notes:"}),e]}),A.length>0&&X.jsx("div",{style:Tt.attachmentsSection,children:A.map((t,e)=>{const A=!(!t.data&&!t.url),r=(t.type?.startsWith("image/")||Ht(t.data||t.url||""))&&A?Ot(t.data||t.url||"",t.type):null;return X.jsx("div",{style:Tt.attachmentThumbnail,children:r?X.jsx("img",{src:r,alt:t.name||"Attachment",style:Tt.attachmentImg}):X.jsx("span",{style:{fontSize:"20px",color:"#999"},children:"📎"})},e)})})]}):null},Mt=({component:t})=>{const e=void 0!==t.basic?.value?t.basic.value:t.basic?.defaultValue,{name:A}=t;if("signature"===A)return e&&Ht(e)?X.jsx("div",{style:{marginTop:"5px"},children:X.jsx("img",{src:Ot(e),alt:"Signature",style:{...Tt.img,maxHeight:"100px",width:"auto"}})}):X.jsx("span",{style:{color:"#999",fontStyle:"italic"},children:"No signature"});if("checkbox"===A){const A=t.basic?.options||[],r=(Array.isArray(e)?e:e?[e]:[]).map(t=>String(t));return X.jsx("div",{style:{marginTop:"5px",width:"100%"},children:A.map((t,e)=>{const A=r.includes(String(t.value));return X.jsxs("div",{style:Tt.checkboxItem,children:[X.jsx("div",{style:{width:"18px",height:"18px",minWidth:"18px",border:"2px solid "+(A?"#303992":"#cbd5e1"),borderRadius:"4px",marginRight:"12px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:A?"#303992":"#ffffff"},children:A&&X.jsx("span",{style:{color:"#ffffff",fontSize:"12px",fontWeight:"bold",lineHeight:1},children:"✓"})}),X.jsx("span",{style:{fontSize:"14px",fontWeight:500,color:"#334155"},children:t.label})]},e)})})}if("radio"===A){const A=t.basic?.options||[];return X.jsx("div",{style:{marginTop:"5px",width:"100%"},children:A.map((t,A)=>{const r=String(e||"")===String(t.value||"");return X.jsxs("div",{style:Tt.checkboxItem,children:[X.jsx("div",{style:{width:"18px",height:"18px",minWidth:"18px",border:"2px solid "+(r?"#303992":"#cbd5e1"),borderRadius:"50%",marginRight:"12px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#ffffff"},children:r&&X.jsx("div",{style:{width:"10px",height:"10px",borderRadius:"50%",backgroundColor:"#303992"}})}),X.jsx("span",{style:{fontSize:"14px",fontWeight:500,color:"#334155"},children:t.label})]},A)})})}if("segment"===A){const A=t.basic?.options||[],r=e;return X.jsx("div",{style:Tt.segmentContainer,children:A.map((t,e)=>{const A=String(r||"")===String(t.value||""),n=(t=>null!=t?.icon?t.icon:"pass"===Pt(t?.value||t)?"✓":"×")(t),i=t.color||t.backgroundColor,s=Pt(t.value);let a,o,l;i?A?(a=i,o="#ffffff",l=i):(a=`${i}20`,o=i,l=i):"pass"===s?A?(a="#00814b",o="#ffffff",l="#00814b"):(a="#34bd4914",o="#00814b",l="#e0e0e0"):A?(a="#dc3545",o="#ffffff",l="#dc3545"):(a="#fa323d14",o="#dc3545",l="#e0e0e0");const c={...Tt.segmentButton,backgroundColor:a,color:o,borderColor:l,borderWidth:"1px",borderStyle:"solid"};return X.jsxs("div",{style:c,children:[X.jsx("span",{style:Tt.segmentIcon,children:n}),X.jsx("span",{children:t.value})]},e)})})}if("file"===A){const t=(Array.isArray(e)?e:e?[e]:[]).filter(t=>{const e=!(!t.data&&!t.url),A=t.type&&t.type.startsWith("image/"),r=e&&Ht(t.data||t.url);return A||r});return t.length>0?X.jsx("div",{style:{marginTop:"10px"},children:t.map((t,e)=>{const A=Ot(t.data||t.url,t.type);return A?X.jsx("img",{src:A,alt:t.name||"File",style:{...Tt.img,marginBottom:"10px"}},e):null})}):X.jsx("div",{style:{color:"#999",fontStyle:"italic"},children:"No images uploaded"})}if("location"===A){if(e&&"object"==typeof e){const t=e;return X.jsxs("div",{style:{fontSize:"14px"},children:[t.placeName&&X.jsxs("div",{style:{marginBottom:"4px"},children:[X.jsx("strong",{children:"Place:"})," ",t.placeName]}),(t.city||t.country)&&X.jsxs("div",{style:{marginBottom:"4px"},children:[X.jsx("strong",{children:"Address:"})," ",[t.city,t.country].filter(Boolean).join(", ")]}),t.latitude&&t.longitude&&X.jsxs("div",{style:{marginBottom:"4px"},children:[X.jsx("strong",{children:"Coordinates:"})," ",t.latitude.toFixed(6),", ",t.longitude.toFixed(6)]}),t.timestamp&&X.jsxs("div",{children:[X.jsx("strong",{children:"Captured:"})," ",(tt(t.timestamp)||new Date).toLocaleString()]})]})}return X.jsx("div",{style:{color:"#999",fontStyle:"italic"},children:"No location data"})}if("instructions"===A){const e=t.basic?.instructions||[],A=t.validation?.listStyle||"numbers";if(!Array.isArray(e)||0===e.length)return X.jsx("div",{style:{color:"#999",fontStyle:"italic"},children:"No instructions"});const r=()=>X.jsx("div",{dangerouslySetInnerHTML:{__html:e.join("")}});return"numbers"===A?X.jsx("ol",{style:{margin:"10px 0",paddingLeft:"25px"},children:X.jsx(r,{})}):"bullets"===A?X.jsx("ul",{style:{margin:"10px 0",paddingLeft:"25px"},children:X.jsx(r,{})}):X.jsx("div",{style:{margin:"10px 0"},children:X.jsx(r,{})})}if("select"===A){const A=t.basic?.options||[],r=e;let n="";if(Array.isArray(r))n=r.map(t=>{const e=A.find(e=>String(e.value)===String(t));return e?e.label:t}).join(", ");else{const t=r,e=A.find(e=>String(e.value)===String(t));n=e?e.label||e.value:null!=t?String(t):""}return X.jsx("div",{style:Tt.valueContainer,children:X.jsx("div",{style:Tt.value,children:n})})}const r="object"==typeof e?JSON.stringify(e):String(e);if(!["signature","checkbox","radio","segment","file","instructions","heading","section","table","datagrid","select"].includes(A)){const t="textarea"===A;return X.jsx("div",{style:{...Tt.valueContainer,...t?{minHeight:"60px",whiteSpace:"pre-wrap"}:{}},children:X.jsx("div",{style:Tt.value,children:r})})}return X.jsx("div",{style:Tt.value,children:r})},jt=({component:t})=>{const{name:e,basic:A,styles:r,validation:n}=t,i=A?.label,s=n?.required,a="left"===(r?.labelAlignment||"top");if("section"===e){const e=r?.headerBackgroundColor,n=r?.headerTextColor,a={...Tt.sectionHeader,...e?{backgroundColor:e,padding:"8px",borderRadius:"4px"}:{},...n?{color:n}:{},display:"flex",alignItems:"center"};return X.jsxs("div",{style:Tt.section,children:[i&&X.jsx("label",{style:a,children:X.jsxs("span",{style:{flex:1},children:[i,s&&" *"]})}),A?.description&&X.jsx("p",{style:{...Tt.description,marginBottom:"15px"},children:A.description}),X.jsx(Dt,{component:t}),X.jsx("div",{style:Tt.sectionChildren,children:X.jsx(Rt,{components:t.children||[]})})]})}if("heading"===e){const t=`h${Math.max(1,Math.min(6,r?.level??A?.level??1))}`,e={...r?.headerBackgroundColor?{backgroundColor:r.headerBackgroundColor,padding:"8px",borderRadius:"4px"}:{},...r?.headerTextColor?{color:r.headerTextColor}:{},...r?.fontSize?{fontSize:r.fontSize}:{},...r?.textAlign?{textAlign:r.textAlign}:{},marginTop:0,marginBottom:"15px"};return X.jsx("div",{style:Tt.formGroup,children:X.jsx(t,{style:e,children:A?.label||A?.value})})}if("table"===e){const e=t.cells||[],A=Math.max(0,...e.map(t=>t?t.length:0)),n=A>0?100/A:100,a=r?.headerBackgroundColor,o=r?.headerTextColor,l={...Tt.label,...a?{backgroundColor:a,padding:"8px",borderRadius:"4px",marginBottom:"10px"}:{},...o?{color:o}:{}};return X.jsxs("div",{style:Tt.formGroup,children:[i&&X.jsxs("label",{style:l,children:[i,s&&" *"]}),X.jsx("table",{style:Tt.table,children:X.jsx("tbody",{children:e.map((t,e)=>X.jsx("tr",{children:t&&t.map((t,e)=>X.jsx("td",{style:{...Tt.td,width:`${n}%`},children:t.components&&t.components.map((t,e)=>X.jsxs("div",{style:{marginBottom:"8px"},children:[t.basic?.label&&X.jsxs("span",{style:{fontWeight:"bold",marginRight:"5px",fontSize:"12px"},children:[t.basic.label,":"]}),X.jsx(Mt,{component:t}),X.jsx(Dt,{component:t})]},e))},e))},e))})})]})}if("datagrid"===e){const e=t.entries||[];let A=t.templateComponents||[];0===A.length&&e.length>0&&e[0]?.components&&(A=e[0].components.map(t=>({...t,basic:{...t.basic,label:t.basic?.label||t.name}})));const n=r?.headerBackgroundColor,a=r?.headerTextColor,o={...Tt.label,...n?{backgroundColor:n,padding:"8px",borderRadius:"4px",marginBottom:"10px"}:{},...a?{color:a}:{}},l=e.filter(t=>!(!t.components||0===t.components.length)&&t.components.some(t=>{const e=void 0!==t.basic?.value?t.basic.value:t.basic?.defaultValue;return Array.isArray(e)?e.length>0:null!=e&&""!==String(e).trim()}));return 0===l.length?X.jsxs("div",{style:Tt.formGroup,children:[i&&X.jsxs("label",{style:o,children:[i,s&&" *"]}),X.jsx("div",{style:{fontStyle:"italic",color:"#999"},children:"No data"})]}):X.jsxs("div",{style:Tt.formGroup,children:[i&&X.jsxs("label",{style:o,children:[i,s&&" *"]}),X.jsxs("table",{style:Tt.table,children:[X.jsx("thead",{children:X.jsx("tr",{children:A.map((t,e)=>X.jsx("th",{style:Tt.th,children:t.basic?.label||t.name},e))})}),X.jsx("tbody",{children:l.map((t,e)=>X.jsx("tr",{children:A.map((e,A)=>{const r=t.components[A];return X.jsx("td",{style:Tt.td,children:r?X.jsxs(X.Fragment,{children:[X.jsx(Mt,{component:r}),X.jsx(Dt,{component:r})]}):"N/A"},A)})},e))})]})]})}if(a&&"instructions"!==e){const A=["segment"].includes(e);return X.jsxs("div",{style:Tt.formGroup,children:[X.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[i&&X.jsxs("label",{style:Tt.labelLeft,children:[i,s&&" *"]}),X.jsx("div",{style:{flex:1,...A?{display:"flex",justifyContent:"flex-end"}:{}},children:X.jsx(Mt,{component:t})})]}),X.jsx(Dt,{component:t})]})}return X.jsxs("div",{style:Tt.formGroup,children:[i&&X.jsxs("label",{style:Tt.label,children:[i,s&&" *"]}),X.jsx(Mt,{component:t}),X.jsx(Dt,{component:t})]})},Rt=({components:t})=>{if(!t||0===t.length)return null;const e=[];let A=[],r=0;return t.forEach(t=>{const n=["section","table","datagrid","heading","instructions"].includes(t.name),i=n?12:t.styles?.column||12;r+i>12&&A.length>0&&(e.push(A),A=[],r=0),A.push(t),r+=i,(n||r>=12)&&r>0&&(e.push(A),A=[],r=0)}),A.length>0&&e.push(A),X.jsx(X.Fragment,{children:e.map((t,e)=>1===t.length?X.jsx(jt,{component:t[0]},t[0].id||e):X.jsx("div",{style:Tt.gridRow,children:t.map((t,e)=>{const A=t.styles?.column||12;return X.jsx("div",{style:Tt.gridCol(A),children:X.jsx(jt,{component:t})},t.id||e)})},e))})},Kt=({formTitle:t,formDescription:e,userName:A,components:r})=>X.jsxs("div",{className:"pdf-container",style:Tt.page,children:[X.jsxs("div",{style:Tt.header,children:[X.jsxs("div",{children:[X.jsx("h1",{style:Tt.title,children:t}),e&&X.jsx("p",{style:Tt.description,children:e})]}),A&&X.jsxs("div",{style:Tt.submittedBy,children:[X.jsx("strong",{children:"Submitted By:"})," ",A]})]}),X.jsx("div",{className:"form-content",children:X.jsx(Rt,{components:r})})]});var Vt,zt=I;if("production"===process.env.NODE_ENV)Vt=zt.createRoot,zt.hydrateRoot;else{var Gt=zt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;Vt=function(t,e){Gt.usingClientEntryPoint=!0;try{return zt.createRoot(t,e)}finally{Gt.usingClientEntryPoint=!1}}}var qt={exports:{}};
11
11
  /*!
12
12
  * html2canvas 1.4.1 <https://html2canvas.hertzen.com>
13
13
  * Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
@@ -306,7 +306,7 @@ function(t){var e=function(){return void 0===this.internal.vFS&&(this.internal.v
306
306
  */
307
307
  function(t){t.__bidiEngine__=t.prototype.__bidiEngine__=function(t){var A,r,n,i,s,a,o,l=e,c=[[0,3,0,1,0,0,0],[0,3,0,1,2,2,0],[0,3,0,17,2,0,1],[0,3,5,5,4,1,0],[0,3,21,21,4,0,1],[0,3,5,5,4,2,0]],u=[[2,0,1,1,0,1,0],[2,0,1,1,0,2,0],[2,0,2,1,3,2,0],[2,0,2,33,3,1,1]],h={L:0,R:1,EN:2,AN:3,N:4,B:5,S:6},d={0:0,5:1,6:2,7:3,32:4,251:5,254:6,255:7},f=["(",")","(","<",">","<","[","]","[","{","}","{","«","»","«","‹","›","‹","⁅","⁆","⁅","⁽","⁾","⁽","₍","₎","₍","≤","≥","≤","〈","〉","〈","﹙","﹚","﹙","﹛","﹜","﹛","﹝","﹞","﹝","﹤","﹥","﹤"],p=new RegExp(/^([1-4|9]|1[0-9]|2[0-9]|3[0168]|4[04589]|5[012]|7[78]|159|16[0-9]|17[0-2]|21[569]|22[03489]|250)$/),g=!1,m=0;this.__bidiEngine__={};var w=function(t){var e=t.charCodeAt(),A=e>>8,r=d[A];return void 0!==r?l[256*r+(255&e)]:252===A||253===A?"AL":p.test(A)?"L":8===A?"R":"N"},B=function(t){for(var e,A=0;A<t.length;A++){if("L"===(e=w(t.charAt(A))))return!1;if("R"===e)return!0}return!1},y=function(t,e,s,a){var o,l,c,u,h=e[a];switch(h){case"L":case"R":case"LRE":case"RLE":case"LRO":case"RLO":case"PDF":g=!1;break;case"N":case"AN":break;case"EN":g&&(h="AN");break;case"AL":g=!0,h="R";break;case"WS":case"BN":h="N";break;case"CS":a<1||a+1>=e.length||"EN"!==(o=s[a-1])&&"AN"!==o||"EN"!==(l=e[a+1])&&"AN"!==l?h="N":g&&(l="AN"),h=l===o?l:"N";break;case"ES":h="EN"===(o=a>0?s[a-1]:"B")&&a+1<e.length&&"EN"===e[a+1]?"EN":"N";break;case"ET":if(a>0&&"EN"===s[a-1]){h="EN";break}if(g){h="N";break}for(c=a+1,u=e.length;c<u&&"ET"===e[c];)c++;h=c<u&&"EN"===e[c]?"EN":"N";break;case"NSM":if(n&&!i){for(u=e.length,c=a+1;c<u&&"NSM"===e[c];)c++;if(c<u){var d=t[a],f=d>=1425&&d<=2303||64286===d;if(o=e[c],f&&("R"===o||"AL"===o)){h="R";break}}}h=a<1||"B"===(o=e[a-1])?"N":s[a-1];break;case"B":g=!1,A=!0,h=m;break;case"S":r=!0,h="N"}return h},b=function(t,e,A){var r=t.split("");return A&&v(r,A,{hiLevel:m}),r.reverse(),e&&e.reverse(),r.join("")},v=function(t,e,n){var i,s,a,o,l,d=-1,f=t.length,p=0,B=[],b=m?u:c,v=[];for(g=!1,A=!1,r=!1,s=0;s<f;s++)v[s]=w(t[s]);for(a=0;a<f;a++){if(l=p,B[a]=y(t,v,B,a),i=240&(p=b[l][h[B[a]]]),p&=15,e[a]=o=b[p][5],i>0)if(16===i){for(s=d;s<a;s++)e[s]=1;d=-1}else d=-1;if(b[p][6])-1===d&&(d=a);else if(d>-1){for(s=d;s<a;s++)e[s]=o;d=-1}"B"===v[a]&&(e[a]=0),n.hiLevel|=o}r&&function(t,e,A){for(var r=0;r<A;r++)if("S"===t[r]){e[r]=m;for(var n=r-1;n>=0&&"WS"===t[n];n--)e[n]=m}}(v,e,f)},C=function(t,e,r,n,i){if(!(i.hiLevel<t)){if(1===t&&1===m&&!A)return e.reverse(),void(r&&r.reverse());for(var s,a,o,l,c=e.length,u=0;u<c;){if(n[u]>=t){for(o=u+1;o<c&&n[o]>=t;)o++;for(l=u,a=o-1;l<a;l++,a--)s=e[l],e[l]=e[a],e[a]=s,r&&(s=r[l],r[l]=r[a],r[a]=s);u=o}u++}}},x=function(t,e,A){var r=t.split(""),n={hiLevel:m};return A||(A=[]),v(r,A,n),function(t,e,A){if(0!==A.hiLevel&&o)for(var r,n=0;n<t.length;n++)1===e[n]&&(r=f.indexOf(t[n]))>=0&&(t[n]=f[r+1])}(r,A,n),C(2,r,e,A,n),C(1,r,e,A,n),r.join("")};return this.__bidiEngine__.doBidiReorder=function(t,e,A){if(function(t,e){if(e)for(var A=0;A<t.length;A++)e[A]=A;void 0===i&&(i=B(t)),void 0===a&&(a=B(t))}(t,e),n||!s||a)if(n&&s&&i^a)m=i?1:0,t=b(t,e,A);else if(!n&&s&&a)m=i?1:0,t=x(t,e,A),t=b(t,e);else if(!n||i||s||a){if(n&&!s&&i^a)t=b(t,e),i?(m=0,t=x(t,e,A)):(m=1,t=x(t,e,A),t=b(t,e));else if(n&&i&&!s&&a)m=1,t=x(t,e,A),t=b(t,e);else if(!n&&!s&&i^a){var r=o;i?(m=1,t=x(t,e,A),m=0,o=!1,t=x(t,e,A),o=r):(m=0,t=x(t,e,A),t=b(t,e),m=1,o=!1,t=x(t,e,A),o=r,t=b(t,e))}}else m=0,t=x(t,e,A);else m=i?1:0,t=x(t,e,A);return t},this.__bidiEngine__.setOptions=function(t){t&&(n=t.isInputVisual,s=t.isOutputVisual,i=t.isInputRtl,a=t.isOutputRtl,o=t.isSymmetricSwapping)},this.__bidiEngine__.setOptions(t),this.__bidiEngine__};var e=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","N","N","ET","ET","ET","N","N","N","N","N","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","N","ET","ET","ET","ET","N","N","N","N","L","N","N","BN","N","N","ET","ET","EN","EN","N","L","N","N","N","EN","L","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","N","N","N","N","N","ET","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","R","NSM","R","NSM","NSM","R","NSM","NSM","R","NSM","N","N","N","N","N","N","N","N","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","N","N","N","N","N","R","R","R","R","R","N","N","N","N","N","N","N","N","N","N","N","AN","AN","AN","AN","AN","AN","N","N","AL","ET","ET","AL","CS","AL","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","AN","AN","AN","AN","AN","AN","AN","AN","AN","ET","AN","AN","AL","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","N","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","NSM","NSM","N","NSM","NSM","NSM","NSM","AL","AL","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","N","N","N","N","N","N","N","N","N","N","N","N","N","N","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","R","R","N","N","N","N","R","N","N","N","N","N","WS","WS","WS","WS","WS","WS","WS","WS","WS","WS","WS","BN","BN","BN","L","R","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","WS","B","LRE","RLE","PDF","LRO","RLO","CS","ET","ET","ET","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","CS","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","WS","BN","BN","BN","BN","BN","N","LRI","RLI","FSI","PDI","BN","BN","BN","BN","BN","BN","EN","L","N","N","EN","EN","EN","EN","EN","EN","ES","ES","N","N","N","L","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","ES","ES","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","L","L","N","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","N","N","N","N","N","R","NSM","R","R","R","R","R","R","R","R","R","R","ES","R","R","R","R","R","R","R","R","R","R","R","R","R","N","R","R","R","R","R","N","R","N","R","R","N","R","R","N","R","R","R","R","R","R","R","R","R","R","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","CS","N","CS","N","N","CS","N","N","N","N","N","N","N","N","N","ET","N","N","ES","ES","N","N","N","N","N","ET","ET","N","N","N","N","N","AL","AL","AL","AL","AL","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","N","BN","N","N","N","ET","ET","ET","N","N","N","N","N","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","L","L","L","L","L","L","N","N","L","L","L","L","L","L","N","N","L","L","L","L","L","L","N","N","L","L","L","N","N","N","ET","ET","N","N","N","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N"],A=new t.__bidiEngine__({isInputVisual:!0});t.API.events.push(["postProcessText",function(t){var e=t.text;t.x,t.y;var r=t.options||{};t.mutex,r.lang;var n=[];if(r.isInputVisual="boolean"!=typeof r.isInputVisual||r.isInputVisual,A.setOptions(r),"[object Array]"===Object.prototype.toString.call(e)){var i=0;for(n=[],i=0;i<e.length;i+=1)"[object Array]"===Object.prototype.toString.call(e[i])?n.push([A.doBidiReorder(e[i][0]),e[i][1],e[i][2]]):n.push([A.doBidiReorder(e[i])]);t.text=n}else t.text=A.doBidiReorder(e);A.setOptions({isInputVisual:!0})}])}(Ss),Ss.API.TTFFont=function(){function t(t){var e;if(this.rawData=t,e=this.contents=new ro(t),this.contents.pos=4,"ttcf"===e.readString(4))throw new Error("TTCF not supported.");e.pos=0,this.parse(),this.subset=new Co(this),this.registerTTF()}return t.open=function(e){return new t(e)},t.prototype.parse=function(){return this.directory=new no(this.contents),this.head=new ao(this),this.name=new po(this),this.cmap=new lo(this),this.toUnicode={},this.hhea=new co(this),this.maxp=new go(this),this.hmtx=new mo(this),this.post=new ho(this),this.os2=new uo(this),this.loca=new vo(this),this.glyf=new Bo(this),this.ascender=this.os2.exists&&this.os2.ascender||this.hhea.ascender,this.decender=this.os2.exists&&this.os2.decender||this.hhea.decender,this.lineGap=this.os2.exists&&this.os2.lineGap||this.hhea.lineGap,this.bbox=[this.head.xMin,this.head.yMin,this.head.xMax,this.head.yMax]},t.prototype.registerTTF=function(){var t,e,A,r,n;if(this.scaleFactor=1e3/this.head.unitsPerEm,this.bbox=function(){var e,A,r,n;for(n=[],e=0,A=(r=this.bbox).length;e<A;e++)t=r[e],n.push(Math.round(t*this.scaleFactor));return n}.call(this),this.stemV=0,this.post.exists?(A=255&(r=this.post.italic_angle),32768&(e=r>>16)&&(e=-(1+(65535^e))),this.italicAngle=+(e+"."+A)):this.italicAngle=0,this.ascender=Math.round(this.ascender*this.scaleFactor),this.decender=Math.round(this.decender*this.scaleFactor),this.lineGap=Math.round(this.lineGap*this.scaleFactor),this.capHeight=this.os2.exists&&this.os2.capHeight||this.ascender,this.xHeight=this.os2.exists&&this.os2.xHeight||0,this.familyClass=(this.os2.exists&&this.os2.familyClass||0)>>8,this.isSerif=1===(n=this.familyClass)||2===n||3===n||4===n||5===n||7===n,this.isScript=10===this.familyClass,this.flags=0,this.post.isFixedPitch&&(this.flags|=1),this.isSerif&&(this.flags|=2),this.isScript&&(this.flags|=8),0!==this.italicAngle&&(this.flags|=64),this.flags|=32,!this.cmap.unicode)throw new Error("No unicode cmap for font")},t.prototype.characterToGlyph=function(t){var e;return(null!=(e=this.cmap.unicode)?e.codeMap[t]:void 0)||0},t.prototype.widthOfGlyph=function(t){var e;return e=1e3/this.head.unitsPerEm,this.hmtx.forGlyph(t).advance*e},t.prototype.widthOfString=function(t,e,A){var r,n,i,s;for(i=0,n=0,s=(t=""+t).length;0<=s?n<s:n>s;n=0<=s?++n:--n)r=t.charCodeAt(n),i+=this.widthOfGlyph(this.characterToGlyph(r))+A*(1e3/e)||0;return i*(e/1e3)},t.prototype.lineHeight=function(t,e){var A;return null==e&&(e=!1),A=e?this.lineGap:0,(this.ascender+A-this.decender)/1e3*t},t}();var Ao,ro=function(){function t(t){this.data=null!=t?t:[],this.pos=0,this.length=this.data.length}return t.prototype.readByte=function(){return this.data[this.pos++]},t.prototype.writeByte=function(t){return this.data[this.pos++]=t},t.prototype.readUInt32=function(){return 16777216*this.readByte()+(this.readByte()<<16)+(this.readByte()<<8)+this.readByte()},t.prototype.writeUInt32=function(t){return this.writeByte(t>>>24&255),this.writeByte(t>>16&255),this.writeByte(t>>8&255),this.writeByte(255&t)},t.prototype.readInt32=function(){var t;return(t=this.readUInt32())>=2147483648?t-4294967296:t},t.prototype.writeInt32=function(t){return t<0&&(t+=4294967296),this.writeUInt32(t)},t.prototype.readUInt16=function(){return this.readByte()<<8|this.readByte()},t.prototype.writeUInt16=function(t){return this.writeByte(t>>8&255),this.writeByte(255&t)},t.prototype.readInt16=function(){var t;return(t=this.readUInt16())>=32768?t-65536:t},t.prototype.writeInt16=function(t){return t<0&&(t+=65536),this.writeUInt16(t)},t.prototype.readString=function(t){var e,A;for(A=[],e=0;0<=t?e<t:e>t;e=0<=t?++e:--e)A[e]=String.fromCharCode(this.readByte());return A.join("")},t.prototype.writeString=function(t){var e,A,r;for(r=[],e=0,A=t.length;0<=A?e<A:e>A;e=0<=A?++e:--e)r.push(this.writeByte(t.charCodeAt(e)));return r},t.prototype.readShort=function(){return this.readInt16()},t.prototype.writeShort=function(t){return this.writeInt16(t)},t.prototype.readLongLong=function(){var t,e,A,r,n,i,s,a;return t=this.readByte(),e=this.readByte(),A=this.readByte(),r=this.readByte(),n=this.readByte(),i=this.readByte(),s=this.readByte(),a=this.readByte(),128&t?-1*(72057594037927940*(255^t)+281474976710656*(255^e)+1099511627776*(255^A)+4294967296*(255^r)+16777216*(255^n)+65536*(255^i)+256*(255^s)+(255^a)+1):72057594037927940*t+281474976710656*e+1099511627776*A+4294967296*r+16777216*n+65536*i+256*s+a},t.prototype.writeLongLong=function(t){var e,A;return e=Math.floor(t/4294967296),A=4294967295&t,this.writeByte(e>>24&255),this.writeByte(e>>16&255),this.writeByte(e>>8&255),this.writeByte(255&e),this.writeByte(A>>24&255),this.writeByte(A>>16&255),this.writeByte(A>>8&255),this.writeByte(255&A)},t.prototype.readInt=function(){return this.readInt32()},t.prototype.writeInt=function(t){return this.writeInt32(t)},t.prototype.read=function(t){var e,A;for(e=[],A=0;0<=t?A<t:A>t;A=0<=t?++A:--A)e.push(this.readByte());return e},t.prototype.write=function(t){var e,A,r,n;for(n=[],A=0,r=t.length;A<r;A++)e=t[A],n.push(this.writeByte(e));return n},t}(),no=function(){var t;function e(t){var e,A,r;for(this.scalarType=t.readInt(),this.tableCount=t.readShort(),this.searchRange=t.readShort(),this.entrySelector=t.readShort(),this.rangeShift=t.readShort(),this.tables={},A=0,r=this.tableCount;0<=r?A<r:A>r;A=0<=r?++A:--A)e={tag:t.readString(4),checksum:t.readInt(),offset:t.readInt(),length:t.readInt()},this.tables[e.tag]=e}return e.prototype.encode=function(e){var A,r,n,i,s,a,o,l,c,u,h,d,f;for(f in h=Object.keys(e).length,a=Math.log(2),c=16*Math.floor(Math.log(h)/a),i=Math.floor(c/a),l=16*h-c,(r=new ro).writeInt(this.scalarType),r.writeShort(h),r.writeShort(c),r.writeShort(i),r.writeShort(l),n=16*h,o=r.pos+n,s=null,d=[],e)for(u=e[f],r.writeString(f),r.writeInt(t(u)),r.writeInt(o),r.writeInt(u.length),d=d.concat(u),"head"===f&&(s=o),o+=u.length;o%4;)d.push(0),o++;return r.write(d),A=2981146554-t(r.data),r.pos=s+8,r.writeUInt32(A),r.data},t=function(t){var e,A,r,n;for(t=wo.call(t);t.length%4;)t.push(0);for(r=new ro(t),A=0,e=0,n=t.length;e<n;e=e+=4)A+=r.readUInt32();return 4294967295&A},e}(),io={}.hasOwnProperty,so=function(t,e){for(var A in e)io.call(e,A)&&(t[A]=e[A]);function r(){this.constructor=t}return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t};Ao=function(){function t(t){var e;this.file=t,e=this.file.directory.tables[this.tag],this.exists=!!e,e&&(this.offset=e.offset,this.length=e.length,this.parse(this.file.contents))}return t.prototype.parse=function(){},t.prototype.encode=function(){},t.prototype.raw=function(){return this.exists?(this.file.contents.pos=this.offset,this.file.contents.read(this.length)):null},t}();var ao=function(){function t(){return t.__super__.constructor.apply(this,arguments)}return so(t,Ao),t.prototype.tag="head",t.prototype.parse=function(t){return t.pos=this.offset,this.version=t.readInt(),this.revision=t.readInt(),this.checkSumAdjustment=t.readInt(),this.magicNumber=t.readInt(),this.flags=t.readShort(),this.unitsPerEm=t.readShort(),this.created=t.readLongLong(),this.modified=t.readLongLong(),this.xMin=t.readShort(),this.yMin=t.readShort(),this.xMax=t.readShort(),this.yMax=t.readShort(),this.macStyle=t.readShort(),this.lowestRecPPEM=t.readShort(),this.fontDirectionHint=t.readShort(),this.indexToLocFormat=t.readShort(),this.glyphDataFormat=t.readShort()},t.prototype.encode=function(t){var e;return(e=new ro).writeInt(this.version),e.writeInt(this.revision),e.writeInt(this.checkSumAdjustment),e.writeInt(this.magicNumber),e.writeShort(this.flags),e.writeShort(this.unitsPerEm),e.writeLongLong(this.created),e.writeLongLong(this.modified),e.writeShort(this.xMin),e.writeShort(this.yMin),e.writeShort(this.xMax),e.writeShort(this.yMax),e.writeShort(this.macStyle),e.writeShort(this.lowestRecPPEM),e.writeShort(this.fontDirectionHint),e.writeShort(t),e.writeShort(this.glyphDataFormat),e.data},t}(),oo=function(){function t(t,e){var A,r,n,i,s,a,o,l,c,u,h,d,f,p,g,m,w;switch(this.platformID=t.readUInt16(),this.encodingID=t.readShort(),this.offset=e+t.readInt(),c=t.pos,t.pos=this.offset,this.format=t.readUInt16(),this.length=t.readUInt16(),this.language=t.readUInt16(),this.isUnicode=3===this.platformID&&1===this.encodingID&&4===this.format||0===this.platformID&&4===this.format,this.codeMap={},this.format){case 0:for(a=0;a<256;++a)this.codeMap[a]=t.readByte();break;case 4:for(h=t.readUInt16(),u=h/2,t.pos+=6,n=function(){var e,A;for(A=[],a=e=0;0<=u?e<u:e>u;a=0<=u?++e:--e)A.push(t.readUInt16());return A}(),t.pos+=2,f=function(){var e,A;for(A=[],a=e=0;0<=u?e<u:e>u;a=0<=u?++e:--e)A.push(t.readUInt16());return A}(),o=function(){var e,A;for(A=[],a=e=0;0<=u?e<u:e>u;a=0<=u?++e:--e)A.push(t.readUInt16());return A}(),l=function(){var e,A;for(A=[],a=e=0;0<=u?e<u:e>u;a=0<=u?++e:--e)A.push(t.readUInt16());return A}(),r=(this.length-t.pos+this.offset)/2,s=function(){var e,A;for(A=[],a=e=0;0<=r?e<r:e>r;a=0<=r?++e:--e)A.push(t.readUInt16());return A}(),a=g=0,w=n.length;g<w;a=++g)for(p=n[a],A=m=d=f[a];d<=p?m<=p:m>=p;A=d<=p?++m:--m)0===l[a]?i=A+o[a]:0!==(i=s[l[a]/2+(A-d)-(u-a)]||0)&&(i+=o[a]),this.codeMap[A]=65535&i}t.pos=c}return t.encode=function(t,e){var A,r,n,i,s,a,o,l,c,u,h,d,f,p,g,m,w,B,y,b,v,C,x,F,Q,U,E,N,S,L,I,_,k,T,H,O,P,D,M,j,R,K,V,z,G,q;switch(N=new ro,i=Object.keys(t).sort(function(t,e){return t-e}),e){case"macroman":for(f=0,p=function(){var t=[];for(d=0;d<256;++d)t.push(0);return t}(),m={0:0},n={},S=0,k=i.length;S<k;S++)null==m[V=t[r=i[S]]]&&(m[V]=++f),n[r]={old:t[r],new:m[t[r]]},p[r]=m[t[r]];return N.writeUInt16(1),N.writeUInt16(0),N.writeUInt32(12),N.writeUInt16(0),N.writeUInt16(262),N.writeUInt16(0),N.write(p),{charMap:n,subtable:N.data,maxGlyphID:f+1};case"unicode":for(U=[],c=[],w=0,m={},A={},g=o=null,L=0,T=i.length;L<T;L++)null==m[y=t[r=i[L]]]&&(m[y]=++w),A[r]={old:y,new:m[y]},s=m[y]-r,null!=g&&s===o||(g&&c.push(g),U.push(r),o=s),g=r;for(g&&c.push(g),c.push(65535),U.push(65535),F=2*(x=U.length),C=2*Math.pow(Math.log(x)/Math.LN2,2),u=Math.log(C/2)/Math.LN2,v=2*x-C,a=[],b=[],h=[],d=I=0,H=U.length;I<H;d=++I){if(Q=U[d],l=c[d],65535===Q){a.push(0),b.push(0);break}if(Q-(E=A[Q].new)>=32768)for(a.push(0),b.push(2*(h.length+x-d)),r=_=Q;Q<=l?_<=l:_>=l;r=Q<=l?++_:--_)h.push(A[r].new);else a.push(E-Q),b.push(0)}for(N.writeUInt16(3),N.writeUInt16(1),N.writeUInt32(12),N.writeUInt16(4),N.writeUInt16(16+8*x+2*h.length),N.writeUInt16(0),N.writeUInt16(F),N.writeUInt16(C),N.writeUInt16(u),N.writeUInt16(v),R=0,O=c.length;R<O;R++)r=c[R],N.writeUInt16(r);for(N.writeUInt16(0),K=0,P=U.length;K<P;K++)r=U[K],N.writeUInt16(r);for(z=0,D=a.length;z<D;z++)s=a[z],N.writeUInt16(s);for(G=0,M=b.length;G<M;G++)B=b[G],N.writeUInt16(B);for(q=0,j=h.length;q<j;q++)f=h[q],N.writeUInt16(f);return{charMap:A,subtable:N.data,maxGlyphID:w+1}}},t}(),lo=function(){function t(){return t.__super__.constructor.apply(this,arguments)}return so(t,Ao),t.prototype.tag="cmap",t.prototype.parse=function(t){var e,A,r;for(t.pos=this.offset,this.version=t.readUInt16(),r=t.readUInt16(),this.tables=[],this.unicode=null,A=0;0<=r?A<r:A>r;A=0<=r?++A:--A)e=new oo(t,this.offset),this.tables.push(e),e.isUnicode&&null==this.unicode&&(this.unicode=e);return!0},t.encode=function(t,e){var A,r;return null==e&&(e="macroman"),A=oo.encode(t,e),(r=new ro).writeUInt16(0),r.writeUInt16(1),A.table=r.data.concat(A.subtable),A},t}(),co=function(){function t(){return t.__super__.constructor.apply(this,arguments)}return so(t,Ao),t.prototype.tag="hhea",t.prototype.parse=function(t){return t.pos=this.offset,this.version=t.readInt(),this.ascender=t.readShort(),this.decender=t.readShort(),this.lineGap=t.readShort(),this.advanceWidthMax=t.readShort(),this.minLeftSideBearing=t.readShort(),this.minRightSideBearing=t.readShort(),this.xMaxExtent=t.readShort(),this.caretSlopeRise=t.readShort(),this.caretSlopeRun=t.readShort(),this.caretOffset=t.readShort(),t.pos+=8,this.metricDataFormat=t.readShort(),this.numberOfMetrics=t.readUInt16()},t}(),uo=function(){function t(){return t.__super__.constructor.apply(this,arguments)}return so(t,Ao),t.prototype.tag="OS/2",t.prototype.parse=function(t){if(t.pos=this.offset,this.version=t.readUInt16(),this.averageCharWidth=t.readShort(),this.weightClass=t.readUInt16(),this.widthClass=t.readUInt16(),this.type=t.readShort(),this.ySubscriptXSize=t.readShort(),this.ySubscriptYSize=t.readShort(),this.ySubscriptXOffset=t.readShort(),this.ySubscriptYOffset=t.readShort(),this.ySuperscriptXSize=t.readShort(),this.ySuperscriptYSize=t.readShort(),this.ySuperscriptXOffset=t.readShort(),this.ySuperscriptYOffset=t.readShort(),this.yStrikeoutSize=t.readShort(),this.yStrikeoutPosition=t.readShort(),this.familyClass=t.readShort(),this.panose=function(){var e,A;for(A=[],e=0;e<10;++e)A.push(t.readByte());return A}(),this.charRange=function(){var e,A;for(A=[],e=0;e<4;++e)A.push(t.readInt());return A}(),this.vendorID=t.readString(4),this.selection=t.readShort(),this.firstCharIndex=t.readShort(),this.lastCharIndex=t.readShort(),this.version>0&&(this.ascent=t.readShort(),this.descent=t.readShort(),this.lineGap=t.readShort(),this.winAscent=t.readShort(),this.winDescent=t.readShort(),this.codePageRange=function(){var e,A;for(A=[],e=0;e<2;e=++e)A.push(t.readInt());return A}(),this.version>1))return this.xHeight=t.readShort(),this.capHeight=t.readShort(),this.defaultChar=t.readShort(),this.breakChar=t.readShort(),this.maxContext=t.readShort()},t}(),ho=function(){function t(){return t.__super__.constructor.apply(this,arguments)}return so(t,Ao),t.prototype.tag="post",t.prototype.parse=function(t){var e,A,r;switch(t.pos=this.offset,this.format=t.readInt(),this.italicAngle=t.readInt(),this.underlinePosition=t.readShort(),this.underlineThickness=t.readShort(),this.isFixedPitch=t.readInt(),this.minMemType42=t.readInt(),this.maxMemType42=t.readInt(),this.minMemType1=t.readInt(),this.maxMemType1=t.readInt(),this.format){case 65536:case 196608:break;case 131072:var n;for(A=t.readUInt16(),this.glyphNameIndex=[],n=0;0<=A?n<A:n>A;n=0<=A?++n:--n)this.glyphNameIndex.push(t.readUInt16());for(this.names=[],r=[];t.pos<this.offset+this.length;)e=t.readByte(),r.push(this.names.push(t.readString(e)));return r;case 151552:return A=t.readUInt16(),this.offsets=t.read(A);case 262144:return this.map=function(){var e,A,r;for(r=[],n=e=0,A=this.file.maxp.numGlyphs;0<=A?e<A:e>A;n=0<=A?++e:--e)r.push(t.readUInt32());return r}.call(this)}},t}(),fo=function(t,e){this.raw=t,this.length=t.length,this.platformID=e.platformID,this.encodingID=e.encodingID,this.languageID=e.languageID},po=function(){function t(){return t.__super__.constructor.apply(this,arguments)}return so(t,Ao),t.prototype.tag="name",t.prototype.parse=function(t){var e,A,r,n,i,s,a,o,l,c,u;for(t.pos=this.offset,t.readShort(),e=t.readShort(),s=t.readShort(),A=[],n=0;0<=e?n<e:n>e;n=0<=e?++n:--n)A.push({platformID:t.readShort(),encodingID:t.readShort(),languageID:t.readShort(),nameID:t.readShort(),length:t.readShort(),offset:this.offset+s+t.readShort()});for(a={},n=l=0,c=A.length;l<c;n=++l)r=A[n],t.pos=r.offset,o=t.readString(r.length),i=new fo(o,r),null==a[u=r.nameID]&&(a[u]=[]),a[r.nameID].push(i);this.strings=a,this.copyright=a[0],this.fontFamily=a[1],this.fontSubfamily=a[2],this.uniqueSubfamily=a[3],this.fontName=a[4],this.version=a[5];try{this.postscriptName=a[6][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}catch(t){this.postscriptName=a[4][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}return this.trademark=a[7],this.manufacturer=a[8],this.designer=a[9],this.description=a[10],this.vendorUrl=a[11],this.designerUrl=a[12],this.license=a[13],this.licenseUrl=a[14],this.preferredFamily=a[15],this.preferredSubfamily=a[17],this.compatibleFull=a[18],this.sampleText=a[19]},t}(),go=function(){function t(){return t.__super__.constructor.apply(this,arguments)}return so(t,Ao),t.prototype.tag="maxp",t.prototype.parse=function(t){return t.pos=this.offset,this.version=t.readInt(),this.numGlyphs=t.readUInt16(),this.maxPoints=t.readUInt16(),this.maxContours=t.readUInt16(),this.maxCompositePoints=t.readUInt16(),this.maxComponentContours=t.readUInt16(),this.maxZones=t.readUInt16(),this.maxTwilightPoints=t.readUInt16(),this.maxStorage=t.readUInt16(),this.maxFunctionDefs=t.readUInt16(),this.maxInstructionDefs=t.readUInt16(),this.maxStackElements=t.readUInt16(),this.maxSizeOfInstructions=t.readUInt16(),this.maxComponentElements=t.readUInt16(),this.maxComponentDepth=t.readUInt16()},t}(),mo=function(){function t(){return t.__super__.constructor.apply(this,arguments)}return so(t,Ao),t.prototype.tag="hmtx",t.prototype.parse=function(t){var e,A,r,n,i,s,a;for(t.pos=this.offset,this.metrics=[],e=0,s=this.file.hhea.numberOfMetrics;0<=s?e<s:e>s;e=0<=s?++e:--e)this.metrics.push({advance:t.readUInt16(),lsb:t.readInt16()});for(r=this.file.maxp.numGlyphs-this.file.hhea.numberOfMetrics,this.leftSideBearings=function(){var A,n;for(n=[],e=A=0;0<=r?A<r:A>r;e=0<=r?++A:--A)n.push(t.readInt16());return n}(),this.widths=function(){var t,e,A,r;for(r=[],t=0,e=(A=this.metrics).length;t<e;t++)n=A[t],r.push(n.advance);return r}.call(this),A=this.widths[this.widths.length-1],a=[],e=i=0;0<=r?i<r:i>r;e=0<=r?++i:--i)a.push(this.widths.push(A));return a},t.prototype.forGlyph=function(t){return t in this.metrics?this.metrics[t]:{advance:this.metrics[this.metrics.length-1].advance,lsb:this.leftSideBearings[t-this.metrics.length]}},t}(),wo=[].slice,Bo=function(){function t(){return t.__super__.constructor.apply(this,arguments)}return so(t,Ao),t.prototype.tag="glyf",t.prototype.parse=function(){return this.cache={}},t.prototype.glyphFor=function(t){var e,A,r,n,i,s,a,o,l,c;return t in this.cache?this.cache[t]:(n=this.file.loca,e=this.file.contents,A=n.indexOf(t),0===(r=n.lengthOf(t))?this.cache[t]=null:(e.pos=this.offset+A,i=(s=new ro(e.read(r))).readShort(),o=s.readShort(),c=s.readShort(),a=s.readShort(),l=s.readShort(),this.cache[t]=-1===i?new bo(s,o,c,a,l):new yo(s,i,o,c,a,l),this.cache[t]))},t.prototype.encode=function(t,e,A){var r,n,i,s,a;for(i=[],n=[],s=0,a=e.length;s<a;s++)r=t[e[s]],n.push(i.length),r&&(i=i.concat(r.encode(A)));return n.push(i.length),{table:i,offsets:n}},t}(),yo=function(){function t(t,e,A,r,n,i){this.raw=t,this.numberOfContours=e,this.xMin=A,this.yMin=r,this.xMax=n,this.yMax=i,this.compound=!1}return t.prototype.encode=function(){return this.raw.data},t}(),bo=function(){function t(t,e,A,r,n){var i,s;for(this.raw=t,this.xMin=e,this.yMin=A,this.xMax=r,this.yMax=n,this.compound=!0,this.glyphIDs=[],this.glyphOffsets=[],i=this.raw;s=i.readShort(),this.glyphOffsets.push(i.pos),this.glyphIDs.push(i.readUInt16()),32&s;)i.pos+=1&s?4:2,128&s?i.pos+=8:64&s?i.pos+=4:8&s&&(i.pos+=2)}return t.prototype.encode=function(){var t,e,A;for(e=new ro(wo.call(this.raw.data)),t=0,A=this.glyphIDs.length;t<A;++t)e.pos=this.glyphOffsets[t];return e.data},t}(),vo=function(){function t(){return t.__super__.constructor.apply(this,arguments)}return so(t,Ao),t.prototype.tag="loca",t.prototype.parse=function(t){var e,A;return t.pos=this.offset,e=this.file.head.indexToLocFormat,this.offsets=0===e?function(){var e,r;for(r=[],A=0,e=this.length;A<e;A+=2)r.push(2*t.readUInt16());return r}.call(this):function(){var e,r;for(r=[],A=0,e=this.length;A<e;A+=4)r.push(t.readUInt32());return r}.call(this)},t.prototype.indexOf=function(t){return this.offsets[t]},t.prototype.lengthOf=function(t){return this.offsets[t+1]-this.offsets[t]},t.prototype.encode=function(t,e){for(var A=new Uint32Array(this.offsets.length),r=0,n=0,i=0;i<A.length;++i)if(A[i]=r,n<e.length&&e[n]==i){++n,A[i]=r;var s=this.offsets[i],a=this.offsets[i+1]-s;a>0&&(r+=a)}for(var o=new Array(4*A.length),l=0;l<A.length;++l)o[4*l+3]=255&A[l],o[4*l+2]=(65280&A[l])>>8,o[4*l+1]=(16711680&A[l])>>16,o[4*l]=(4278190080&A[l])>>24;return o},t}(),Co=function(){function t(t){this.font=t,this.subset={},this.unicodes={},this.next=33}return t.prototype.generateCmap=function(){var t,e,A,r,n;for(e in r=this.font.cmap.tables[0].codeMap,t={},n=this.subset)A=n[e],t[e]=r[A];return t},t.prototype.glyphsFor=function(t){var e,A,r,n,i,s,a;for(r={},i=0,s=t.length;i<s;i++)r[n=t[i]]=this.font.glyf.glyphFor(n);for(n in e=[],r)(null!=(A=r[n])?A.compound:void 0)&&e.push.apply(e,A.glyphIDs);if(e.length>0)for(n in a=this.glyphsFor(e))A=a[n],r[n]=A;return r},t.prototype.encode=function(t,e){var A,r,n,i,s,a,o,l,c,u,h,d,f,p,g;for(r in A=lo.encode(this.generateCmap(),"unicode"),i=this.glyphsFor(t),h={0:0},g=A.charMap)h[(a=g[r]).old]=a.new;for(d in u=A.maxGlyphID,i)d in h||(h[d]=u++);return l=function(t){var e,A;for(e in A={},t)A[t[e]]=e;return A}(h),c=Object.keys(l).sort(function(t,e){return t-e}),f=function(){var t,e,A;for(A=[],t=0,e=c.length;t<e;t++)s=c[t],A.push(l[s]);return A}(),n=this.font.glyf.encode(i,f,h),o=this.font.loca.encode(n.offsets,f),p={cmap:this.font.cmap.raw(),glyf:n.table,loca:o,hmtx:this.font.hmtx.raw(),hhea:this.font.hhea.raw(),maxp:this.font.maxp.raw(),post:this.font.post.raw(),name:this.font.name.raw(),head:this.font.head.encode(e)},this.font.os2.exists&&(p["OS/2"]=this.font.os2.raw()),this.font.directory.encode(p)},t}();Ss.API.PDFObject=function(){var t;function e(){}return t=function(t,e){return(Array(e+1).join("0")+t).slice(-e)},e.convert=function(A){var r,n,i,s;if(Array.isArray(A))return"["+function(){var t,n,i;for(i=[],t=0,n=A.length;t<n;t++)r=A[t],i.push(e.convert(r));return i}().join(" ")+"]";if("string"==typeof A)return"/"+A;if(null!=A?A.isString:void 0)return"("+A+")";if(A instanceof Date)return"(D:"+t(A.getUTCFullYear(),4)+t(A.getUTCMonth(),2)+t(A.getUTCDate(),2)+t(A.getUTCHours(),2)+t(A.getUTCMinutes(),2)+t(A.getUTCSeconds(),2)+"Z)";if("[object Object]"==={}.toString.call(A)){for(n in i=["<<"],A)s=A[n],i.push("/"+n+" "+e.convert(s));return i.push(">>"),i.join("\n")}return""+A},e}();const xo=async t=>new Promise(async(e,A)=>{let r=null,n=null;try{r=document.createElement("div"),r.style.position="absolute",r.style.top="-9999px",r.style.left="-9999px",r.style.width="794px",r.style.backgroundColor="#ffffff",r.style.zIndex="-1000",document.body.appendChild(r),n=Vt(r),n.render(X.jsx(Kt,{formTitle:t.formTitle,formDescription:t.formDescription,userName:t.userName,components:t.components})),await new Promise(t=>setTimeout(t,1e3));const A=await Xt(r,{scale:2,useCORS:!0,logging:!1,backgroundColor:"#ffffff",windowWidth:794}),i=A.toDataURL("image/jpeg",.95),s=new Ss({orientation:"portrait",unit:"mm",format:"a4"}),a=210,o=297,l=A.height*a/A.width;let c=l,u=0;for(s.addImage(i,"JPEG",0,u,a,l),c-=o;c>0;)u-=o,s.addPage(),s.addImage(i,"JPEG",0,u,a,l),c-=o;e(s.output("blob"))}catch(t){console.error("Error generating PDF:",t),A(t)}finally{n&&setTimeout(()=>{n.unmount(),r&&r.parentNode&&r.parentNode.removeChild(r)},100)}});var Fo;!function(t){t.Top="top",t.Left="left"}(Fo||(Fo={}));
308
308
  /*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */
309
- const{entries:Qo,setPrototypeOf:Uo,isFrozen:Eo,getPrototypeOf:No,getOwnPropertyDescriptor:So}=Object;let{freeze:Lo,seal:Io,create:_o}=Object,{apply:ko,construct:To}="undefined"!=typeof Reflect&&Reflect;Lo||(Lo=function(t){return t}),Io||(Io=function(t){return t}),ko||(ko=function(t,e){for(var A=arguments.length,r=new Array(A>2?A-2:0),n=2;n<A;n++)r[n-2]=arguments[n];return t.apply(e,r)}),To||(To=function(t){for(var e=arguments.length,A=new Array(e>1?e-1:0),r=1;r<e;r++)A[r-1]=arguments[r];return new t(...A)});const Ho=Jo(Array.prototype.forEach),Oo=Jo(Array.prototype.lastIndexOf),Po=Jo(Array.prototype.pop),Do=Jo(Array.prototype.push),Mo=Jo(Array.prototype.splice),jo=Jo(String.prototype.toLowerCase),Ro=Jo(String.prototype.toString),Ko=Jo(String.prototype.match),Vo=Jo(String.prototype.replace),zo=Jo(String.prototype.indexOf),Go=Jo(String.prototype.trim),qo=Jo(Object.prototype.hasOwnProperty),Wo=Jo(RegExp.prototype.test),Xo=(Yo=TypeError,function(){for(var t=arguments.length,e=new Array(t),A=0;A<t;A++)e[A]=arguments[A];return To(Yo,e)});var Yo;function Jo(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var A=arguments.length,r=new Array(A>1?A-1:0),n=1;n<A;n++)r[n-1]=arguments[n];return ko(t,e,r)}}function $o(t,e){let A=arguments.length>2&&void 0!==arguments[2]?arguments[2]:jo;Uo&&Uo(t,null);let r=e.length;for(;r--;){let n=e[r];if("string"==typeof n){const t=A(n);t!==n&&(Eo(e)||(e[r]=t),n=t)}t[n]=!0}return t}function Zo(t){for(let e=0;e<t.length;e++){qo(t,e)||(t[e]=null)}return t}function tl(t){const e=_o(null);for(const[A,r]of Qo(t)){qo(t,A)&&(Array.isArray(r)?e[A]=Zo(r):r&&"object"==typeof r&&r.constructor===Object?e[A]=tl(r):e[A]=r)}return e}function el(t,e){for(;null!==t;){const A=So(t,e);if(A){if(A.get)return Jo(A.get);if("function"==typeof A.value)return Jo(A.value)}t=No(t)}return function(){return null}}const Al=Lo(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),rl=Lo(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),nl=Lo(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),il=Lo(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),sl=Lo(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),al=Lo(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ol=Lo(["#text"]),ll=Lo(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),cl=Lo(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),ul=Lo(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),hl=Lo(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),dl=Io(/\{\{[\w\W]*|[\w\W]*\}\}/gm),fl=Io(/<%[\w\W]*|[\w\W]*%>/gm),pl=Io(/\$\{[\w\W]*/gm),gl=Io(/^data-[\-\w.\u00B7-\uFFFF]+$/),ml=Io(/^aria-[\-\w]+$/),wl=Io(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Bl=Io(/^(?:\w+script|data):/i),yl=Io(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),bl=Io(/^html$/i),vl=Io(/^[a-z][.\w]*(-[.\w]+)+$/i);var Cl=Object.freeze({__proto__:null,ARIA_ATTR:ml,ATTR_WHITESPACE:yl,CUSTOM_ELEMENT:vl,DATA_ATTR:gl,DOCTYPE_NAME:bl,ERB_EXPR:fl,IS_ALLOWED_URI:wl,IS_SCRIPT_OR_DATA:Bl,MUSTACHE_EXPR:dl,TMPLIT_EXPR:pl});const xl=1,Fl=3,Ql=7,Ul=8,El=9,Nl=function(){return"undefined"==typeof window?null:window};var Sl=function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Nl();const A=e=>t(e);if(A.version="3.3.1",A.removed=[],!e||!e.document||e.document.nodeType!==El||!e.Element)return A.isSupported=!1,A;let{document:r}=e;const n=r,i=n.currentScript,{DocumentFragment:s,HTMLTemplateElement:a,Node:o,Element:l,NodeFilter:c,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:h,DOMParser:d,trustedTypes:f}=e,p=l.prototype,g=el(p,"cloneNode"),m=el(p,"remove"),w=el(p,"nextSibling"),B=el(p,"childNodes"),y=el(p,"parentNode");if("function"==typeof a){const t=r.createElement("template");t.content&&t.content.ownerDocument&&(r=t.content.ownerDocument)}let b,v="";const{implementation:C,createNodeIterator:x,createDocumentFragment:F,getElementsByTagName:Q}=r,{importNode:U}=n;let E={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};A.isSupported="function"==typeof Qo&&"function"==typeof y&&C&&void 0!==C.createHTMLDocument;const{MUSTACHE_EXPR:N,ERB_EXPR:S,TMPLIT_EXPR:L,DATA_ATTR:I,ARIA_ATTR:_,IS_SCRIPT_OR_DATA:k,ATTR_WHITESPACE:T,CUSTOM_ELEMENT:H}=Cl;let{IS_ALLOWED_URI:O}=Cl,P=null;const D=$o({},[...Al,...rl,...nl,...sl,...ol]);let M=null;const j=$o({},[...ll,...cl,...ul,...hl]);let R=Object.seal(_o(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),K=null,V=null;const z=Object.seal(_o(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let G=!0,q=!0,W=!1,X=!0,Y=!1,J=!0,$=!1,Z=!1,tt=!1,et=!1,At=!1,rt=!1,nt=!0,it=!1,st=!0,at=!1,ot={},lt=null;const ct=$o({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ut=null;const ht=$o({},["audio","video","img","source","image","track"]);let dt=null;const ft=$o({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),pt="http://www.w3.org/1998/Math/MathML",gt="http://www.w3.org/2000/svg",mt="http://www.w3.org/1999/xhtml";let wt=mt,Bt=!1,yt=null;const bt=$o({},[pt,gt,mt],Ro);let vt=$o({},["mi","mo","mn","ms","mtext"]),Ct=$o({},["annotation-xml"]);const xt=$o({},["title","style","font","a","script"]);let Ft=null;const Qt=["application/xhtml+xml","text/html"];let Ut=null,Et=null;const Nt=r.createElement("form"),St=function(t){return t instanceof RegExp||t instanceof Function},Lt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Et||Et!==t){if(t&&"object"==typeof t||(t={}),t=tl(t),Ft=-1===Qt.indexOf(t.PARSER_MEDIA_TYPE)?"text/html":t.PARSER_MEDIA_TYPE,Ut="application/xhtml+xml"===Ft?Ro:jo,P=qo(t,"ALLOWED_TAGS")?$o({},t.ALLOWED_TAGS,Ut):D,M=qo(t,"ALLOWED_ATTR")?$o({},t.ALLOWED_ATTR,Ut):j,yt=qo(t,"ALLOWED_NAMESPACES")?$o({},t.ALLOWED_NAMESPACES,Ro):bt,dt=qo(t,"ADD_URI_SAFE_ATTR")?$o(tl(ft),t.ADD_URI_SAFE_ATTR,Ut):ft,ut=qo(t,"ADD_DATA_URI_TAGS")?$o(tl(ht),t.ADD_DATA_URI_TAGS,Ut):ht,lt=qo(t,"FORBID_CONTENTS")?$o({},t.FORBID_CONTENTS,Ut):ct,K=qo(t,"FORBID_TAGS")?$o({},t.FORBID_TAGS,Ut):tl({}),V=qo(t,"FORBID_ATTR")?$o({},t.FORBID_ATTR,Ut):tl({}),ot=!!qo(t,"USE_PROFILES")&&t.USE_PROFILES,G=!1!==t.ALLOW_ARIA_ATTR,q=!1!==t.ALLOW_DATA_ATTR,W=t.ALLOW_UNKNOWN_PROTOCOLS||!1,X=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,Y=t.SAFE_FOR_TEMPLATES||!1,J=!1!==t.SAFE_FOR_XML,$=t.WHOLE_DOCUMENT||!1,et=t.RETURN_DOM||!1,At=t.RETURN_DOM_FRAGMENT||!1,rt=t.RETURN_TRUSTED_TYPE||!1,tt=t.FORCE_BODY||!1,nt=!1!==t.SANITIZE_DOM,it=t.SANITIZE_NAMED_PROPS||!1,st=!1!==t.KEEP_CONTENT,at=t.IN_PLACE||!1,O=t.ALLOWED_URI_REGEXP||wl,wt=t.NAMESPACE||mt,vt=t.MATHML_TEXT_INTEGRATION_POINTS||vt,Ct=t.HTML_INTEGRATION_POINTS||Ct,R=t.CUSTOM_ELEMENT_HANDLING||{},t.CUSTOM_ELEMENT_HANDLING&&St(t.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(R.tagNameCheck=t.CUSTOM_ELEMENT_HANDLING.tagNameCheck),t.CUSTOM_ELEMENT_HANDLING&&St(t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(R.attributeNameCheck=t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),t.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(R.allowCustomizedBuiltInElements=t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Y&&(q=!1),At&&(et=!0),ot&&(P=$o({},ol),M=[],!0===ot.html&&($o(P,Al),$o(M,ll)),!0===ot.svg&&($o(P,rl),$o(M,cl),$o(M,hl)),!0===ot.svgFilters&&($o(P,nl),$o(M,cl),$o(M,hl)),!0===ot.mathMl&&($o(P,sl),$o(M,ul),$o(M,hl))),t.ADD_TAGS&&("function"==typeof t.ADD_TAGS?z.tagCheck=t.ADD_TAGS:(P===D&&(P=tl(P)),$o(P,t.ADD_TAGS,Ut))),t.ADD_ATTR&&("function"==typeof t.ADD_ATTR?z.attributeCheck=t.ADD_ATTR:(M===j&&(M=tl(M)),$o(M,t.ADD_ATTR,Ut))),t.ADD_URI_SAFE_ATTR&&$o(dt,t.ADD_URI_SAFE_ATTR,Ut),t.FORBID_CONTENTS&&(lt===ct&&(lt=tl(lt)),$o(lt,t.FORBID_CONTENTS,Ut)),t.ADD_FORBID_CONTENTS&&(lt===ct&&(lt=tl(lt)),$o(lt,t.ADD_FORBID_CONTENTS,Ut)),st&&(P["#text"]=!0),$&&$o(P,["html","head","body"]),P.table&&($o(P,["tbody"]),delete K.tbody),t.TRUSTED_TYPES_POLICY){if("function"!=typeof t.TRUSTED_TYPES_POLICY.createHTML)throw Xo('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof t.TRUSTED_TYPES_POLICY.createScriptURL)throw Xo('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');b=t.TRUSTED_TYPES_POLICY,v=b.createHTML("")}else void 0===b&&(b=function(t,e){if("object"!=typeof t||"function"!=typeof t.createPolicy)return null;let A=null;const r="data-tt-policy-suffix";e&&e.hasAttribute(r)&&(A=e.getAttribute(r));const n="dompurify"+(A?"#"+A:"");try{return t.createPolicy(n,{createHTML:t=>t,createScriptURL:t=>t})}catch(t){return console.warn("TrustedTypes policy "+n+" could not be created."),null}}(f,i)),null!==b&&"string"==typeof v&&(v=b.createHTML(""));Lo&&Lo(t),Et=t}},It=$o({},[...rl,...nl,...il]),_t=$o({},[...sl,...al]),kt=function(t){Do(A.removed,{element:t});try{y(t).removeChild(t)}catch(e){m(t)}},Tt=function(t,e){try{Do(A.removed,{attribute:e.getAttributeNode(t),from:e})}catch(t){Do(A.removed,{attribute:null,from:e})}if(e.removeAttribute(t),"is"===t)if(et||At)try{kt(e)}catch(t){}else try{e.setAttribute(t,"")}catch(t){}},Ht=function(t){let e=null,A=null;if(tt)t="<remove></remove>"+t;else{const e=Ko(t,/^[\r\n\t ]+/);A=e&&e[0]}"application/xhtml+xml"===Ft&&wt===mt&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");const n=b?b.createHTML(t):t;if(wt===mt)try{e=(new d).parseFromString(n,Ft)}catch(t){}if(!e||!e.documentElement){e=C.createDocument(wt,"template",null);try{e.documentElement.innerHTML=Bt?v:n}catch(t){}}const i=e.body||e.documentElement;return t&&A&&i.insertBefore(r.createTextNode(A),i.childNodes[0]||null),wt===mt?Q.call(e,$?"html":"body")[0]:$?e.documentElement:i},Ot=function(t){return x.call(t.ownerDocument||t,t,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Pt=function(t){return t instanceof h&&("string"!=typeof t.nodeName||"string"!=typeof t.textContent||"function"!=typeof t.removeChild||!(t.attributes instanceof u)||"function"!=typeof t.removeAttribute||"function"!=typeof t.setAttribute||"string"!=typeof t.namespaceURI||"function"!=typeof t.insertBefore||"function"!=typeof t.hasChildNodes)},Dt=function(t){return"function"==typeof o&&t instanceof o};function Mt(t,e,r){Ho(t,t=>{t.call(A,e,r,Et)})}const jt=function(t){let e=null;if(Mt(E.beforeSanitizeElements,t,null),Pt(t))return kt(t),!0;const r=Ut(t.nodeName);if(Mt(E.uponSanitizeElement,t,{tagName:r,allowedTags:P}),J&&t.hasChildNodes()&&!Dt(t.firstElementChild)&&Wo(/<[/\w!]/g,t.innerHTML)&&Wo(/<[/\w!]/g,t.textContent))return kt(t),!0;if(t.nodeType===Ql)return kt(t),!0;if(J&&t.nodeType===Ul&&Wo(/<[/\w]/g,t.data))return kt(t),!0;if(!(z.tagCheck instanceof Function&&z.tagCheck(r))&&(!P[r]||K[r])){if(!K[r]&&Kt(r)){if(R.tagNameCheck instanceof RegExp&&Wo(R.tagNameCheck,r))return!1;if(R.tagNameCheck instanceof Function&&R.tagNameCheck(r))return!1}if(st&&!lt[r]){const e=y(t)||t.parentNode,A=B(t)||t.childNodes;if(A&&e){for(let r=A.length-1;r>=0;--r){const n=g(A[r],!0);n.__removalCount=(t.__removalCount||0)+1,e.insertBefore(n,w(t))}}}return kt(t),!0}return t instanceof l&&!function(t){let e=y(t);e&&e.tagName||(e={namespaceURI:wt,tagName:"template"});const A=jo(t.tagName),r=jo(e.tagName);return!!yt[t.namespaceURI]&&(t.namespaceURI===gt?e.namespaceURI===mt?"svg"===A:e.namespaceURI===pt?"svg"===A&&("annotation-xml"===r||vt[r]):Boolean(It[A]):t.namespaceURI===pt?e.namespaceURI===mt?"math"===A:e.namespaceURI===gt?"math"===A&&Ct[r]:Boolean(_t[A]):t.namespaceURI===mt?!(e.namespaceURI===gt&&!Ct[r])&&!(e.namespaceURI===pt&&!vt[r])&&!_t[A]&&(xt[A]||!It[A]):!("application/xhtml+xml"!==Ft||!yt[t.namespaceURI]))}(t)?(kt(t),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!Wo(/<\/no(script|embed|frames)/i,t.innerHTML)?(Y&&t.nodeType===Fl&&(e=t.textContent,Ho([N,S,L],t=>{e=Vo(e,t," ")}),t.textContent!==e&&(Do(A.removed,{element:t.cloneNode()}),t.textContent=e)),Mt(E.afterSanitizeElements,t,null),!1):(kt(t),!0)},Rt=function(t,e,A){if(nt&&("id"===e||"name"===e)&&(A in r||A in Nt))return!1;if(q&&!V[e]&&Wo(I,e));else if(G&&Wo(_,e));else if(z.attributeCheck instanceof Function&&z.attributeCheck(e,t));else if(!M[e]||V[e]){if(!(Kt(t)&&(R.tagNameCheck instanceof RegExp&&Wo(R.tagNameCheck,t)||R.tagNameCheck instanceof Function&&R.tagNameCheck(t))&&(R.attributeNameCheck instanceof RegExp&&Wo(R.attributeNameCheck,e)||R.attributeNameCheck instanceof Function&&R.attributeNameCheck(e,t))||"is"===e&&R.allowCustomizedBuiltInElements&&(R.tagNameCheck instanceof RegExp&&Wo(R.tagNameCheck,A)||R.tagNameCheck instanceof Function&&R.tagNameCheck(A))))return!1}else if(dt[e]);else if(Wo(O,Vo(A,T,"")));else if("src"!==e&&"xlink:href"!==e&&"href"!==e||"script"===t||0!==zo(A,"data:")||!ut[t]){if(W&&!Wo(k,Vo(A,T,"")));else if(A)return!1}else;return!0},Kt=function(t){return"annotation-xml"!==t&&Ko(t,H)},Vt=function(t){Mt(E.beforeSanitizeAttributes,t,null);const{attributes:e}=t;if(!e||Pt(t))return;const r={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:M,forceKeepAttr:void 0};let n=e.length;for(;n--;){const i=e[n],{name:s,namespaceURI:a,value:o}=i,l=Ut(s),c=o;let u="value"===s?c:Go(c);if(r.attrName=l,r.attrValue=u,r.keepAttr=!0,r.forceKeepAttr=void 0,Mt(E.uponSanitizeAttribute,t,r),u=r.attrValue,!it||"id"!==l&&"name"!==l||(Tt(s,t),u="user-content-"+u),J&&Wo(/((--!?|])>)|<\/(style|title|textarea)/i,u)){Tt(s,t);continue}if("attributename"===l&&Ko(u,"href")){Tt(s,t);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){Tt(s,t);continue}if(!X&&Wo(/\/>/i,u)){Tt(s,t);continue}Y&&Ho([N,S,L],t=>{u=Vo(u,t," ")});const h=Ut(t.nodeName);if(Rt(h,l,u)){if(b&&"object"==typeof f&&"function"==typeof f.getAttributeType)if(a);else switch(f.getAttributeType(h,l)){case"TrustedHTML":u=b.createHTML(u);break;case"TrustedScriptURL":u=b.createScriptURL(u)}if(u!==c)try{a?t.setAttributeNS(a,s,u):t.setAttribute(s,u),Pt(t)?kt(t):Po(A.removed)}catch(e){Tt(s,t)}}else Tt(s,t)}Mt(E.afterSanitizeAttributes,t,null)},zt=function t(e){let A=null;const r=Ot(e);for(Mt(E.beforeSanitizeShadowDOM,e,null);A=r.nextNode();)Mt(E.uponSanitizeShadowNode,A,null),jt(A),Vt(A),A.content instanceof s&&t(A.content);Mt(E.afterSanitizeShadowDOM,e,null)};return A.sanitize=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,i=null,a=null,l=null;if(Bt=!t,Bt&&(t="\x3c!--\x3e"),"string"!=typeof t&&!Dt(t)){if("function"!=typeof t.toString)throw Xo("toString is not a function");if("string"!=typeof(t=t.toString()))throw Xo("dirty is not a string, aborting")}if(!A.isSupported)return t;if(Z||Lt(e),A.removed=[],"string"==typeof t&&(at=!1),at){if(t.nodeName){const e=Ut(t.nodeName);if(!P[e]||K[e])throw Xo("root node is forbidden and cannot be sanitized in-place")}}else if(t instanceof o)r=Ht("\x3c!----\x3e"),i=r.ownerDocument.importNode(t,!0),i.nodeType===xl&&"BODY"===i.nodeName||"HTML"===i.nodeName?r=i:r.appendChild(i);else{if(!et&&!Y&&!$&&-1===t.indexOf("<"))return b&&rt?b.createHTML(t):t;if(r=Ht(t),!r)return et?null:rt?v:""}r&&tt&&kt(r.firstChild);const c=Ot(at?t:r);for(;a=c.nextNode();)jt(a),Vt(a),a.content instanceof s&&zt(a.content);if(at)return t;if(et){if(At)for(l=F.call(r.ownerDocument);r.firstChild;)l.appendChild(r.firstChild);else l=r;return(M.shadowroot||M.shadowrootmode)&&(l=U.call(n,l,!0)),l}let u=$?r.outerHTML:r.innerHTML;return $&&P["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&Wo(bl,r.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+u),Y&&Ho([N,S,L],t=>{u=Vo(u,t," ")}),b&&rt?b.createHTML(u):u},A.setConfig=function(){Lt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Z=!0},A.clearConfig=function(){Et=null,Z=!1},A.isValidAttribute=function(t,e,A){Et||Lt({});const r=Ut(t),n=Ut(e);return Rt(r,n,A)},A.addHook=function(t,e){"function"==typeof e&&Do(E[t],e)},A.removeHook=function(t,e){if(void 0!==e){const A=Oo(E[t],e);return-1===A?void 0:Mo(E[t],A,1)[0]}return Po(E[t])},A.removeHooks=function(t){E[t]=[]},A.removeAllHooks=function(){E={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},A}(),Ll=Object.freeze({__proto__:null,default:Sl}),Il=function(t){return t&&t.Math===Math&&t},_l=Il("object"==typeof globalThis&&globalThis)||Il("object"==typeof window&&window)||Il("object"==typeof self&&self)||Il("object"==typeof R&&R)||Il("object"==typeof R&&R)||function(){return this}()||Function("return this")(),kl={},Tl=function(t){try{return!!t()}catch(t){return!0}},Hl=!Tl(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}),Ol=!Tl(function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}),Pl=Ol,Dl=Function.prototype.call,Ml=Pl?Dl.bind(Dl):function(){return Dl.apply(Dl,arguments)},jl={},Rl={}.propertyIsEnumerable,Kl=Object.getOwnPropertyDescriptor,Vl=Kl&&!Rl.call({1:2},1);jl.f=Vl?function(t){var e=Kl(this,t);return!!e&&e.enumerable}:Rl;var zl,Gl,ql=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},Wl=Ol,Xl=Function.prototype,Yl=Xl.call,Jl=Wl&&Xl.bind.bind(Yl,Yl),$l=Wl?Jl:function(t){return function(){return Yl.apply(t,arguments)}},Zl=$l,tc=Zl({}.toString),ec=Zl("".slice),Ac=function(t){return ec(tc(t),8,-1)},rc=Tl,nc=Ac,ic=Object,sc=$l("".split),ac=rc(function(){return!ic("z").propertyIsEnumerable(0)})?function(t){return"String"===nc(t)?sc(t,""):ic(t)}:ic,oc=function(t){return null==t},lc=oc,cc=TypeError,uc=function(t){if(lc(t))throw new cc("Can't call method on "+t);return t},hc=ac,dc=uc,fc=function(t){return hc(dc(t))},pc="object"==typeof document&&document.all,gc=void 0===pc&&void 0!==pc?function(t){return"function"==typeof t||t===pc}:function(t){return"function"==typeof t},mc=gc,wc=function(t){return"object"==typeof t?null!==t:mc(t)},Bc=_l,yc=gc,bc=function(t,e){return arguments.length<2?(A=Bc[t],yc(A)?A:void 0):Bc[t]&&Bc[t][e];var A},vc=$l({}.isPrototypeOf),Cc=_l.navigator,xc=Cc&&Cc.userAgent,Fc=xc?String(xc):"",Qc=_l,Uc=Fc,Ec=Qc.process,Nc=Qc.Deno,Sc=Ec&&Ec.versions||Nc&&Nc.version,Lc=Sc&&Sc.v8;Lc&&(Gl=(zl=Lc.split("."))[0]>0&&zl[0]<4?1:+(zl[0]+zl[1])),!Gl&&Uc&&(!(zl=Uc.match(/Edge\/(\d+)/))||zl[1]>=74)&&(zl=Uc.match(/Chrome\/(\d+)/))&&(Gl=+zl[1]);var Ic=Gl,_c=Ic,kc=Tl,Tc=_l.String,Hc=!!Object.getOwnPropertySymbols&&!kc(function(){var t=Symbol("symbol detection");return!Tc(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&_c&&_c<41}),Oc=Hc&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Pc=bc,Dc=gc,Mc=vc,jc=Object,Rc=Oc?function(t){return"symbol"==typeof t}:function(t){var e=Pc("Symbol");return Dc(e)&&Mc(e.prototype,jc(t))},Kc=String,Vc=function(t){try{return Kc(t)}catch(t){return"Object"}},zc=gc,Gc=Vc,qc=TypeError,Wc=function(t){if(zc(t))return t;throw new qc(Gc(t)+" is not a function")},Xc=Wc,Yc=oc,Jc=function(t,e){var A=t[e];return Yc(A)?void 0:Xc(A)},$c=Ml,Zc=gc,tu=wc,eu=TypeError,Au={exports:{}},ru=_l,nu=Object.defineProperty,iu=function(t,e){try{nu(ru,t,{value:e,configurable:!0,writable:!0})}catch(A){ru[t]=e}return e},su=_l,au=iu,ou="__core-js_shared__",lu=Au.exports=su[ou]||au(ou,{});(lu.versions||(lu.versions=[])).push({version:"3.47.0",mode:"global",copyright:"© 2014-2025 Denis Pushkarev (zloirock.ru), 2025 CoreJS Company (core-js.io)",license:"https://github.com/zloirock/core-js/blob/v3.47.0/LICENSE",source:"https://github.com/zloirock/core-js"});var cu=Au.exports,uu=cu,hu=function(t,e){return uu[t]||(uu[t]=e||{})},du=uc,fu=Object,pu=function(t){return fu(du(t))},gu=pu,mu=$l({}.hasOwnProperty),wu=Object.hasOwn||function(t,e){return mu(gu(t),e)},Bu=$l,yu=0,bu=Math.random(),vu=Bu(1.1.toString),Cu=function(t){return"Symbol("+(void 0===t?"":t)+")_"+vu(++yu+bu,36)},xu=hu,Fu=wu,Qu=Cu,Uu=Hc,Eu=Oc,Nu=_l.Symbol,Su=xu("wks"),Lu=Eu?Nu.for||Nu:Nu&&Nu.withoutSetter||Qu,Iu=function(t){return Fu(Su,t)||(Su[t]=Uu&&Fu(Nu,t)?Nu[t]:Lu("Symbol."+t)),Su[t]},_u=Ml,ku=wc,Tu=Rc,Hu=Jc,Ou=function(t,e){var A,r;if("string"===e&&Zc(A=t.toString)&&!tu(r=$c(A,t)))return r;if(Zc(A=t.valueOf)&&!tu(r=$c(A,t)))return r;if("string"!==e&&Zc(A=t.toString)&&!tu(r=$c(A,t)))return r;throw new eu("Can't convert object to primitive value")},Pu=TypeError,Du=Iu("toPrimitive"),Mu=function(t,e){if(!ku(t)||Tu(t))return t;var A,r=Hu(t,Du);if(r){if(void 0===e&&(e="default"),A=_u(r,t,e),!ku(A)||Tu(A))return A;throw new Pu("Can't convert object to primitive value")}return void 0===e&&(e="number"),Ou(t,e)},ju=Rc,Ru=function(t){var e=Mu(t,"string");return ju(e)?e:e+""},Ku=wc,Vu=_l.document,zu=Ku(Vu)&&Ku(Vu.createElement),Gu=function(t){return zu?Vu.createElement(t):{}},qu=Gu,Wu=!Hl&&!Tl(function(){return 7!==Object.defineProperty(qu("div"),"a",{get:function(){return 7}}).a}),Xu=Hl,Yu=Ml,Ju=jl,$u=ql,Zu=fc,th=Ru,eh=wu,Ah=Wu,rh=Object.getOwnPropertyDescriptor;kl.f=Xu?rh:function(t,e){if(t=Zu(t),e=th(e),Ah)try{return rh(t,e)}catch(t){}if(eh(t,e))return $u(!Yu(Ju.f,t,e),t[e])};var nh={},ih=Hl&&Tl(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype}),sh=wc,ah=String,oh=TypeError,lh=function(t){if(sh(t))return t;throw new oh(ah(t)+" is not an object")},ch=Hl,uh=Wu,hh=ih,dh=lh,fh=Ru,ph=TypeError,gh=Object.defineProperty,mh=Object.getOwnPropertyDescriptor,wh="enumerable",Bh="configurable",yh="writable";nh.f=ch?hh?function(t,e,A){if(dh(t),e=fh(e),dh(A),"function"==typeof t&&"prototype"===e&&"value"in A&&yh in A&&!A[yh]){var r=mh(t,e);r&&r[yh]&&(t[e]=A.value,A={configurable:Bh in A?A[Bh]:r[Bh],enumerable:wh in A?A[wh]:r[wh],writable:!1})}return gh(t,e,A)}:gh:function(t,e,A){if(dh(t),e=fh(e),dh(A),uh)try{return gh(t,e,A)}catch(t){}if("get"in A||"set"in A)throw new ph("Accessors not supported");return"value"in A&&(t[e]=A.value),t};var bh=nh,vh=ql,Ch=Hl?function(t,e,A){return bh.f(t,e,vh(1,A))}:function(t,e,A){return t[e]=A,t},xh={exports:{}},Fh=Hl,Qh=wu,Uh=Function.prototype,Eh=Fh&&Object.getOwnPropertyDescriptor,Nh=Qh(Uh,"name"),Sh={EXISTS:Nh,PROPER:Nh&&"something"===function(){}.name,CONFIGURABLE:Nh&&(!Fh||Fh&&Eh(Uh,"name").configurable)},Lh=gc,Ih=cu,_h=$l(Function.toString);Lh(Ih.inspectSource)||(Ih.inspectSource=function(t){return _h(t)});var kh,Th,Hh,Oh=Ih.inspectSource,Ph=gc,Dh=_l.WeakMap,Mh=Ph(Dh)&&/native code/.test(String(Dh)),jh=Cu,Rh=hu("keys"),Kh=function(t){return Rh[t]||(Rh[t]=jh(t))},Vh={},zh=Mh,Gh=_l,qh=wc,Wh=Ch,Xh=wu,Yh=cu,Jh=Kh,$h=Vh,Zh="Object already initialized",td=Gh.TypeError,ed=Gh.WeakMap;if(zh||Yh.state){var Ad=Yh.state||(Yh.state=new ed);Ad.get=Ad.get,Ad.has=Ad.has,Ad.set=Ad.set,kh=function(t,e){if(Ad.has(t))throw new td(Zh);return e.facade=t,Ad.set(t,e),e},Th=function(t){return Ad.get(t)||{}},Hh=function(t){return Ad.has(t)}}else{var rd=Jh("state");$h[rd]=!0,kh=function(t,e){if(Xh(t,rd))throw new td(Zh);return e.facade=t,Wh(t,rd,e),e},Th=function(t){return Xh(t,rd)?t[rd]:{}},Hh=function(t){return Xh(t,rd)}}var nd={set:kh,get:Th,has:Hh,enforce:function(t){return Hh(t)?Th(t):kh(t,{})},getterFor:function(t){return function(e){var A;if(!qh(e)||(A=Th(e)).type!==t)throw new td("Incompatible receiver, "+t+" required");return A}}},id=$l,sd=Tl,ad=gc,od=wu,ld=Hl,cd=Sh.CONFIGURABLE,ud=Oh,hd=nd.enforce,dd=nd.get,fd=String,pd=Object.defineProperty,gd=id("".slice),md=id("".replace),wd=id([].join),Bd=ld&&!sd(function(){return 8!==pd(function(){},"length",{value:8}).length}),yd=String(String).split("String"),bd=xh.exports=function(t,e,A){"Symbol("===gd(fd(e),0,7)&&(e="["+md(fd(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),A&&A.getter&&(e="get "+e),A&&A.setter&&(e="set "+e),(!od(t,"name")||cd&&t.name!==e)&&(ld?pd(t,"name",{value:e,configurable:!0}):t.name=e),Bd&&A&&od(A,"arity")&&t.length!==A.arity&&pd(t,"length",{value:A.arity});try{A&&od(A,"constructor")&&A.constructor?ld&&pd(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var r=hd(t);return od(r,"source")||(r.source=wd(yd,"string"==typeof e?e:"")),t};Function.prototype.toString=bd(function(){return ad(this)&&dd(this).source||ud(this)},"toString");var vd=xh.exports,Cd=gc,xd=nh,Fd=vd,Qd=iu,Ud=function(t,e,A,r){r||(r={});var n=r.enumerable,i=void 0!==r.name?r.name:e;if(Cd(A)&&Fd(A,i,r),r.global)n?t[e]=A:Qd(e,A);else{try{r.unsafe?t[e]&&(n=!0):delete t[e]}catch(t){}n?t[e]=A:xd.f(t,e,{value:A,enumerable:!1,configurable:!r.nonConfigurable,writable:!r.nonWritable})}return t},Ed={},Nd=Math.ceil,Sd=Math.floor,Ld=Math.trunc||function(t){var e=+t;return(e>0?Sd:Nd)(e)},Id=Ld,_d=function(t){var e=+t;return e!=e||0===e?0:Id(e)},kd=_d,Td=Math.max,Hd=Math.min,Od=_d,Pd=Math.min,Dd=function(t){var e=Od(t);return e>0?Pd(e,9007199254740991):0},Md=Dd,jd=function(t){return Md(t.length)},Rd=fc,Kd=function(t,e){var A=kd(t);return A<0?Td(A+e,0):Hd(A,e)},Vd=jd,zd=function(t){return function(e,A,r){var n=Rd(e),i=Vd(n);if(0===i)return!t&&-1;var s,a=Kd(r,i);if(t&&A!=A){for(;i>a;)if((s=n[a++])!=s)return!0}else for(;i>a;a++)if((t||a in n)&&n[a]===A)return t||a||0;return!t&&-1}},Gd={includes:zd(!0),indexOf:zd(!1)},qd=wu,Wd=fc,Xd=Gd.indexOf,Yd=Vh,Jd=$l([].push),$d=function(t,e){var A,r=Wd(t),n=0,i=[];for(A in r)!qd(Yd,A)&&qd(r,A)&&Jd(i,A);for(;e.length>n;)qd(r,A=e[n++])&&(~Xd(i,A)||Jd(i,A));return i},Zd=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],tf=$d,ef=Zd.concat("length","prototype");Ed.f=Object.getOwnPropertyNames||function(t){return tf(t,ef)};var Af={};Af.f=Object.getOwnPropertySymbols;var rf=bc,nf=Ed,sf=Af,af=lh,of=$l([].concat),lf=rf("Reflect","ownKeys")||function(t){var e=nf.f(af(t)),A=sf.f;return A?of(e,A(t)):e},cf=wu,uf=lf,hf=kl,df=nh,ff=Tl,pf=gc,gf=/#|\.prototype\./,mf=function(t,e){var A=Bf[wf(t)];return A===bf||A!==yf&&(pf(e)?ff(e):!!e)},wf=mf.normalize=function(t){return String(t).replace(gf,".").toLowerCase()},Bf=mf.data={},yf=mf.NATIVE="N",bf=mf.POLYFILL="P",vf=mf,Cf=_l,xf=kl.f,Ff=Ch,Qf=Ud,Uf=iu,Ef=function(t,e,A){for(var r=uf(e),n=df.f,i=hf.f,s=0;s<r.length;s++){var a=r[s];cf(t,a)||A&&cf(A,a)||n(t,a,i(e,a))}},Nf=vf,Sf=function(t,e){var A,r,n,i,s,a=t.target,o=t.global,l=t.stat;if(A=o?Cf:l?Cf[a]||Uf(a,{}):Cf[a]&&Cf[a].prototype)for(r in e){if(i=e[r],n=t.dontCallGetSet?(s=xf(A,r))&&s.value:A[r],!Nf(o?r:a+(l?".":"#")+r,t.forced)&&void 0!==n){if(typeof i==typeof n)continue;Ef(i,n)}(t.sham||n&&n.sham)&&Ff(i,"sham",!0),Qf(A,r,i,t)}},Lf=_l,If=Fc,_f=Ac,kf=function(t){return If.slice(0,t.length)===t},Tf=kf("Bun/")?"BUN":kf("Cloudflare-Workers")?"CLOUDFLARE":kf("Deno/")?"DENO":kf("Node.js/")?"NODE":Lf.Bun&&"string"==typeof Bun.version?"BUN":Lf.Deno&&"object"==typeof Deno.version?"DENO":"process"===_f(Lf.process)?"NODE":Lf.window&&Lf.document?"BROWSER":"REST",Hf="NODE"===Tf,Of=_l,Pf=$l,Df=Wc,Mf=wc,jf=function(t){return Mf(t)||null===t},Rf=String,Kf=TypeError,Vf=function(t,e,A){try{return Pf(Df(Object.getOwnPropertyDescriptor(t,e)[A]))}catch(t){}},zf=wc,Gf=uc,qf=function(t){if(jf(t))return t;throw new Kf("Can't set "+Rf(t)+" as a prototype")},Wf=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,A={};try{(t=Vf(Object.prototype,"__proto__","set"))(A,[]),e=A instanceof Array}catch(t){}return function(A,r){return Gf(A),qf(r),zf(A)?(e?t(A,r):A.__proto__=r,A):A}}():void 0),Xf=nh.f,Yf=wu,Jf=Iu("toStringTag"),$f=function(t,e,A){t&&!A&&(t=t.prototype),t&&!Yf(t,Jf)&&Xf(t,Jf,{configurable:!0,value:e})},Zf=vd,tp=nh,ep=bc,Ap=function(t,e,A){return A.get&&Zf(A.get,e,{getter:!0}),A.set&&Zf(A.set,e,{setter:!0}),tp.f(t,e,A)},rp=Hl,np=Iu("species"),ip=vc,sp=TypeError,ap={};ap[Iu("toStringTag")]="z";var op="[object z]"===String(ap),lp=gc,cp=Ac,up=Iu("toStringTag"),hp=Object,dp="Arguments"===cp(function(){return arguments}()),fp=op?cp:function(t){var e,A,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(A=function(t,e){try{return t[e]}catch(t){}}(e=hp(t),up))?A:dp?cp(e):"Object"===(r=cp(e))&&lp(e.callee)?"Arguments":r},pp=$l,gp=Tl,mp=gc,wp=fp,Bp=Oh,yp=function(){},bp=bc("Reflect","construct"),vp=/^\s*(?:class|function)\b/,Cp=pp(vp.exec),xp=!vp.test(yp),Fp=function(t){if(!mp(t))return!1;try{return bp(yp,[],t),!0}catch(t){return!1}},Qp=function(t){if(!mp(t))return!1;switch(wp(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return xp||!!Cp(vp,Bp(t))}catch(t){return!0}};Qp.sham=!0;var Up,Ep,Np,Sp,Lp=!bp||gp(function(){var t;return Fp(Fp.call)||!Fp(Object)||!Fp(function(){t=!0})||t})?Qp:Fp,Ip=Lp,_p=Vc,kp=TypeError,Tp=lh,Hp=function(t){if(Ip(t))return t;throw new kp(_p(t)+" is not a constructor")},Op=oc,Pp=Iu("species"),Dp=function(t,e){var A,r=Tp(t).constructor;return void 0===r||Op(A=Tp(r)[Pp])?e:Hp(A)},Mp=Ol,jp=Function.prototype,Rp=jp.apply,Kp=jp.call,Vp="object"==typeof Reflect&&Reflect.apply||(Mp?Kp.bind(Rp):function(){return Kp.apply(Rp,arguments)}),zp=Ac,Gp=$l,qp=function(t){if("Function"===zp(t))return Gp(t)},Wp=Wc,Xp=Ol,Yp=qp(qp.bind),Jp=function(t,e){return Wp(t),void 0===e?t:Xp?Yp(t,e):function(){return t.apply(e,arguments)}},$p=bc("document","documentElement"),Zp=$l([].slice),tg=TypeError,eg=/(?:ipad|iphone|ipod).*applewebkit/i.test(Fc),Ag=_l,rg=Vp,ng=Jp,ig=gc,sg=wu,ag=Tl,og=$p,lg=Zp,cg=Gu,ug=function(t,e){if(t<e)throw new tg("Not enough arguments");return t},hg=eg,dg=Hf,fg=Ag.setImmediate,pg=Ag.clearImmediate,gg=Ag.process,mg=Ag.Dispatch,wg=Ag.Function,Bg=Ag.MessageChannel,yg=Ag.String,bg=0,vg={},Cg="onreadystatechange";ag(function(){Up=Ag.location});var xg=function(t){if(sg(vg,t)){var e=vg[t];delete vg[t],e()}},Fg=function(t){return function(){xg(t)}},Qg=function(t){xg(t.data)},Ug=function(t){Ag.postMessage(yg(t),Up.protocol+"//"+Up.host)};fg&&pg||(fg=function(t){ug(arguments.length,1);var e=ig(t)?t:wg(t),A=lg(arguments,1);return vg[++bg]=function(){rg(e,void 0,A)},Ep(bg),bg},pg=function(t){delete vg[t]},dg?Ep=function(t){gg.nextTick(Fg(t))}:mg&&mg.now?Ep=function(t){mg.now(Fg(t))}:Bg&&!hg?(Sp=(Np=new Bg).port2,Np.port1.onmessage=Qg,Ep=ng(Sp.postMessage,Sp)):Ag.addEventListener&&ig(Ag.postMessage)&&!Ag.importScripts&&Up&&"file:"!==Up.protocol&&!ag(Ug)?(Ep=Ug,Ag.addEventListener("message",Qg,!1)):Ep=Cg in cg("script")?function(t){og.appendChild(cg("script"))[Cg]=function(){og.removeChild(this),xg(t)}}:function(t){setTimeout(Fg(t),0)});var Eg={set:fg,clear:pg},Ng=_l,Sg=Hl,Lg=Object.getOwnPropertyDescriptor,Ig=function(){this.head=null,this.tail=null};Ig.prototype={add:function(t){var e={item:t,next:null},A=this.tail;A?A.next=e:this.head=e,this.tail=e},get:function(){var t=this.head;if(t)return null===(this.head=t.next)&&(this.tail=null),t.item}};var _g,kg,Tg,Hg,Og,Pg=Ig,Dg=/ipad|iphone|ipod/i.test(Fc)&&"undefined"!=typeof Pebble,Mg=/web0s(?!.*chrome)/i.test(Fc),jg=_l,Rg=function(t){if(!Sg)return Ng[t];var e=Lg(Ng,t);return e&&e.value},Kg=Jp,Vg=Eg.set,zg=Pg,Gg=eg,qg=Dg,Wg=Mg,Xg=Hf,Yg=jg.MutationObserver||jg.WebKitMutationObserver,Jg=jg.document,$g=jg.process,Zg=jg.Promise,tm=Rg("queueMicrotask");if(!tm){var em=new zg,Am=function(){var t,e;for(Xg&&(t=$g.domain)&&t.exit();e=em.get();)try{e()}catch(t){throw em.head&&_g(),t}t&&t.enter()};Gg||Xg||Wg||!Yg||!Jg?!qg&&Zg&&Zg.resolve?((Hg=Zg.resolve(void 0)).constructor=Zg,Og=Kg(Hg.then,Hg),_g=function(){Og(Am)}):Xg?_g=function(){$g.nextTick(Am)}:(Vg=Kg(Vg,jg),_g=function(){Vg(Am)}):(kg=!0,Tg=Jg.createTextNode(""),new Yg(Am).observe(Tg,{characterData:!0}),_g=function(){Tg.data=kg=!kg}),tm=function(t){em.head||_g(),em.add(t)}}var rm=tm,nm=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}},im=_l.Promise,sm=_l,am=im,om=gc,lm=vf,cm=Oh,um=Iu,hm=Tf,dm=Ic;am&&am.prototype;var fm=um("species"),pm=!1,gm=om(sm.PromiseRejectionEvent),mm=lm("Promise",function(){var t=cm(am),e=t!==String(am);if(!e&&66===dm)return!0;if(!dm||dm<51||!/native code/.test(t)){var A=new am(function(t){t(1)}),r=function(t){t(function(){},function(){})};if((A.constructor={})[fm]=r,!(pm=A.then(function(){})instanceof r))return!0}return!(e||"BROWSER"!==hm&&"DENO"!==hm||gm)}),wm={CONSTRUCTOR:mm,REJECTION_EVENT:gm,SUBCLASSING:pm},Bm={},ym=Wc,bm=TypeError,vm=function(t){var e,A;this.promise=new t(function(t,r){if(void 0!==e||void 0!==A)throw new bm("Bad Promise constructor");e=t,A=r}),this.resolve=ym(e),this.reject=ym(A)};Bm.f=function(t){return new vm(t)};var Cm,xm,Fm,Qm,Um=Sf,Em=Hf,Nm=_l,Sm=Of,Lm=Ml,Im=Ud,_m=Wf,km=$f,Tm=function(t){var e=ep(t);rp&&e&&!e[np]&&Ap(e,np,{configurable:!0,get:function(){return this}})},Hm=Wc,Om=gc,Pm=wc,Dm=function(t,e){if(ip(e,t))return t;throw new sp("Incorrect invocation")},Mm=Dp,jm=Eg.set,Rm=rm,Km=function(t,e){try{1===arguments.length?console.error(t):console.error(t,e)}catch(t){}},Vm=nm,zm=Pg,Gm=nd,qm=im,Wm=Bm,Xm="Promise",Ym=wm.CONSTRUCTOR,Jm=wm.REJECTION_EVENT,$m=wm.SUBCLASSING,Zm=Gm.getterFor(Xm),tw=Gm.set,ew=qm&&qm.prototype,Aw=qm,rw=ew,nw=Nm.TypeError,iw=Nm.document,sw=Nm.process,aw=Wm.f,ow=aw,lw=!!(iw&&iw.createEvent&&Nm.dispatchEvent),cw="unhandledrejection",uw=function(t){var e;return!(!Pm(t)||!Om(e=t.then))&&e},hw=function(t,e){var A,r,n,i=e.value,s=1===e.state,a=s?t.ok:t.fail,o=t.resolve,l=t.reject,c=t.domain;try{a?(s||(2===e.rejection&&mw(e),e.rejection=1),!0===a?A=i:(c&&c.enter(),A=a(i),c&&(c.exit(),n=!0)),A===t.promise?l(new nw("Promise-chain cycle")):(r=uw(A))?Lm(r,A,o,l):o(A)):l(i)}catch(t){c&&!n&&c.exit(),l(t)}},dw=function(t,e){t.notified||(t.notified=!0,Rm(function(){for(var A,r=t.reactions;A=r.get();)hw(A,t);t.notified=!1,e&&!t.rejection&&pw(t)}))},fw=function(t,e,A){var r,n;lw?((r=iw.createEvent("Event")).promise=e,r.reason=A,r.initEvent(t,!1,!0),Nm.dispatchEvent(r)):r={promise:e,reason:A},!Jm&&(n=Nm["on"+t])?n(r):t===cw&&Km("Unhandled promise rejection",A)},pw=function(t){Lm(jm,Nm,function(){var e,A=t.facade,r=t.value;if(gw(t)&&(e=Vm(function(){Em?sw.emit("unhandledRejection",r,A):fw(cw,A,r)}),t.rejection=Em||gw(t)?2:1,e.error))throw e.value})},gw=function(t){return 1!==t.rejection&&!t.parent},mw=function(t){Lm(jm,Nm,function(){var e=t.facade;Em?sw.emit("rejectionHandled",e):fw("rejectionhandled",e,t.value)})},ww=function(t,e,A){return function(r){t(e,r,A)}},Bw=function(t,e,A){t.done||(t.done=!0,A&&(t=A),t.value=e,t.state=2,dw(t,!0))},yw=function(t,e,A){if(!t.done){t.done=!0,A&&(t=A);try{if(t.facade===e)throw new nw("Promise can't be resolved itself");var r=uw(e);r?Rm(function(){var A={done:!1};try{Lm(r,e,ww(yw,A,t),ww(Bw,A,t))}catch(e){Bw(A,e,t)}}):(t.value=e,t.state=1,dw(t,!1))}catch(e){Bw({done:!1},e,t)}}};if(Ym&&(rw=(Aw=function(t){Dm(this,rw),Hm(t),Lm(Cm,this);var e=Zm(this);try{t(ww(yw,e),ww(Bw,e))}catch(t){Bw(e,t)}}).prototype,(Cm=function(t){tw(this,{type:Xm,done:!1,notified:!1,parent:!1,reactions:new zm,rejection:!1,state:0,value:null})}).prototype=Im(rw,"then",function(t,e){var A=Zm(this),r=aw(Mm(this,Aw));return A.parent=!0,r.ok=!Om(t)||t,r.fail=Om(e)&&e,r.domain=Em?sw.domain:void 0,0===A.state?A.reactions.add(r):Rm(function(){hw(r,A)}),r.promise}),xm=function(){var t=new Cm,e=Zm(t);this.promise=t,this.resolve=ww(yw,e),this.reject=ww(Bw,e)},Wm.f=aw=function(t){return t===Aw||t===Fm?new xm(t):ow(t)},Om(qm)&&ew!==Object.prototype)){Qm=ew.then,$m||Im(ew,"then",function(t,e){var A=this;return new Aw(function(t,e){Lm(Qm,A,t,e)}).then(t,e)},{unsafe:!0});try{delete ew.constructor}catch(t){}_m&&_m(ew,rw)}Um({global:!0,constructor:!0,wrap:!0,forced:Ym},{Promise:Aw}),Fm=Sm.Promise,km(Aw,Xm,!1),Tm(Xm);var bw={},vw=bw,Cw=Iu("iterator"),xw=Array.prototype,Fw=fp,Qw=Jc,Uw=oc,Ew=bw,Nw=Iu("iterator"),Sw=function(t){if(!Uw(t))return Qw(t,Nw)||Qw(t,"@@iterator")||Ew[Fw(t)]},Lw=Ml,Iw=Wc,_w=lh,kw=Vc,Tw=Sw,Hw=TypeError,Ow=Ml,Pw=lh,Dw=Jc,Mw=Jp,jw=Ml,Rw=lh,Kw=Vc,Vw=function(t){return void 0!==t&&(vw.Array===t||xw[Cw]===t)},zw=jd,Gw=vc,qw=function(t,e){var A=arguments.length<2?Tw(t):e;if(Iw(A))return _w(Lw(A,t));throw new Hw(kw(t)+" is not iterable")},Ww=Sw,Xw=function(t,e,A){var r,n;Pw(t);try{if(!(r=Dw(t,"return"))){if("throw"===e)throw A;return A}r=Ow(r,t)}catch(t){n=!0,r=t}if("throw"===e)throw A;if(n)throw r;return Pw(r),A},Yw=TypeError,Jw=function(t,e){this.stopped=t,this.result=e},$w=Jw.prototype,Zw=function(t,e,A){var r,n,i,s,a,o,l,c=A&&A.that,u=!(!A||!A.AS_ENTRIES),h=!(!A||!A.IS_RECORD),d=!(!A||!A.IS_ITERATOR),f=!(!A||!A.INTERRUPTED),p=Mw(e,c),g=function(t){return r&&Xw(r,"normal"),new Jw(!0,t)},m=function(t){return u?(Rw(t),f?p(t[0],t[1],g):p(t[0],t[1])):f?p(t,g):p(t)};if(h)r=t.iterator;else if(d)r=t;else{if(!(n=Ww(t)))throw new Yw(Kw(t)+" is not iterable");if(Vw(n)){for(i=0,s=zw(t);s>i;i++)if((a=m(t[i]))&&Gw($w,a))return a;return new Jw(!1)}r=qw(t,n)}for(o=h?t.next:r.next;!(l=jw(o,r)).done;){try{a=m(l.value)}catch(t){Xw(r,"throw",t)}if("object"==typeof a&&a&&Gw($w,a))return a}return new Jw(!1)},tB=Iu("iterator"),eB=!1;try{var AB=0,rB={next:function(){return{done:!!AB++}},return:function(){eB=!0}};rB[tB]=function(){return this},Array.from(rB,function(){throw 2})}catch(t){}var nB=im,iB=function(t,e){try{if(!e&&!eB)return!1}catch(t){return!1}var A=!1;try{var r={};r[tB]=function(){return{next:function(){return{done:A=!0}}}},t(r)}catch(t){}return A},sB=wm.CONSTRUCTOR||!iB(function(t){nB.all(t).then(void 0,function(){})}),aB=Ml,oB=Wc,lB=Bm,cB=nm,uB=Zw;Sf({target:"Promise",stat:!0,forced:sB},{all:function(t){var e=this,A=lB.f(e),r=A.resolve,n=A.reject,i=cB(function(){var A=oB(e.resolve),i=[],s=0,a=1;uB(t,function(t){var o=s++,l=!1;a++,aB(A,e,t).then(function(t){l||(l=!0,i[o]=t,--a||r(i))},n)}),--a||r(i)});return i.error&&n(i.value),A.promise}});var hB=Sf,dB=wm.CONSTRUCTOR,fB=im,pB=bc,gB=gc,mB=Ud,wB=fB&&fB.prototype;if(hB({target:"Promise",proto:!0,forced:dB,real:!0},{catch:function(t){return this.then(void 0,t)}}),gB(fB)){var BB=pB("Promise").prototype.catch;wB.catch!==BB&&mB(wB,"catch",BB,{unsafe:!0})}var yB=Ml,bB=Wc,vB=Bm,CB=nm,xB=Zw;Sf({target:"Promise",stat:!0,forced:sB},{race:function(t){var e=this,A=vB.f(e),r=A.reject,n=CB(function(){var n=bB(e.resolve);xB(t,function(t){yB(n,e,t).then(A.resolve,r)})});return n.error&&r(n.value),A.promise}});var FB=Bm;Sf({target:"Promise",stat:!0,forced:wm.CONSTRUCTOR},{reject:function(t){var e=FB.f(this);return(0,e.reject)(t),e.promise}});var QB=lh,UB=wc,EB=Bm,NB=Sf,SB=wm.CONSTRUCTOR,LB=function(t,e){if(QB(t),UB(e)&&e.constructor===t)return e;var A=EB.f(t);return(0,A.resolve)(e),A.promise};function IB(t,e,A,r,n,i,s){try{var a=t[i](s),o=a.value}catch(t){return void A(t)}a.done?e(o):Promise.resolve(o).then(r,n)}function _B(t){return function(){var e=this,A=arguments;return new Promise(function(r,n){var i=t.apply(e,A);function s(t){IB(i,r,n,s,a,"next",t)}function a(t){IB(i,r,n,s,a,"throw",t)}s(void 0)})}}bc("Promise"),NB({target:"Promise",stat:!0,forced:SB},{resolve:function(t){return LB(this,t)}});var kB=fp,TB=String,HB=function(t){if("Symbol"===kB(t))throw new TypeError("Cannot convert a Symbol value to a string");return TB(t)},OB=lh,PB=function(){var t=OB(this),e="";return t.hasIndices&&(e+="d"),t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.unicodeSets&&(e+="v"),t.sticky&&(e+="y"),e},DB=Tl,MB=_l.RegExp,jB=DB(function(){var t=MB("a","y");return t.lastIndex=2,null!==t.exec("abcd")}),RB=jB||DB(function(){return!MB("a","y").sticky}),KB=jB||DB(function(){var t=MB("^r","gy");return t.lastIndex=2,null!==t.exec("str")}),VB={BROKEN_CARET:KB,MISSED_STICKY:RB,UNSUPPORTED_Y:jB},zB={},GB=$d,qB=Zd,WB=Object.keys||function(t){return GB(t,qB)},XB=Hl,YB=ih,JB=nh,$B=lh,ZB=fc,ty=WB;zB.f=XB&&!YB?Object.defineProperties:function(t,e){$B(t);for(var A,r=ZB(e),n=ty(e),i=n.length,s=0;i>s;)JB.f(t,A=n[s++],r[A]);return t};var ey,Ay=lh,ry=zB,ny=Zd,iy=Vh,sy=$p,ay=Gu,oy="prototype",ly="script",cy=Kh("IE_PROTO"),uy=function(){},hy=function(t){return"<"+ly+">"+t+"</"+ly+">"},dy=function(t){t.write(hy("")),t.close();var e=t.parentWindow.Object;return t=null,e},fy=function(){try{ey=new ActiveXObject("htmlfile")}catch(t){}var t,e,A;fy="undefined"!=typeof document?document.domain&&ey?dy(ey):(e=ay("iframe"),A="java"+ly+":",e.style.display="none",sy.appendChild(e),e.src=String(A),(t=e.contentWindow.document).open(),t.write(hy("document.F=Object")),t.close(),t.F):dy(ey);for(var r=ny.length;r--;)delete fy[oy][ny[r]];return fy()};iy[cy]=!0;var py,gy,my=Object.create||function(t,e){var A;return null!==t?(uy[oy]=Ay(t),A=new uy,uy[oy]=null,A[cy]=t):A=fy(),void 0===e?A:ry.f(A,e)},wy=Tl,By=_l.RegExp,yy=wy(function(){var t=By(".","s");return!(t.dotAll&&t.test("\n")&&"s"===t.flags)}),by=Tl,vy=_l.RegExp,Cy=by(function(){var t=vy("(?<a>b)","g");return"b"!==t.exec("b").groups.a||"bc"!=="b".replace(t,"$<a>c")}),xy=Ml,Fy=$l,Qy=HB,Uy=PB,Ey=VB,Ny=my,Sy=nd.get,Ly=yy,Iy=Cy,_y=hu("native-string-replace",String.prototype.replace),ky=RegExp.prototype.exec,Ty=ky,Hy=Fy("".charAt),Oy=Fy("".indexOf),Py=Fy("".replace),Dy=Fy("".slice),My=(gy=/b*/g,xy(ky,py=/a/,"a"),xy(ky,gy,"a"),0!==py.lastIndex||0!==gy.lastIndex),jy=Ey.BROKEN_CARET,Ry=void 0!==/()??/.exec("")[1];(My||Ry||jy||Ly||Iy)&&(Ty=function(t){var e,A,r,n,i,s,a,o=this,l=Sy(o),c=Qy(t),u=l.raw;if(u)return u.lastIndex=o.lastIndex,e=xy(Ty,u,c),o.lastIndex=u.lastIndex,e;var h=l.groups,d=jy&&o.sticky,f=xy(Uy,o),p=o.source,g=0,m=c;if(d&&(f=Py(f,"y",""),-1===Oy(f,"g")&&(f+="g"),m=Dy(c,o.lastIndex),o.lastIndex>0&&(!o.multiline||o.multiline&&"\n"!==Hy(c,o.lastIndex-1))&&(p="(?: "+p+")",m=" "+m,g++),A=new RegExp("^(?:"+p+")",f)),Ry&&(A=new RegExp("^"+p+"$(?!\\s)",f)),My&&(r=o.lastIndex),n=xy(ky,d?A:o,m),d?n?(n.input=Dy(n.input,g),n[0]=Dy(n[0],g),n.index=o.lastIndex,o.lastIndex+=n[0].length):o.lastIndex=0:My&&n&&(o.lastIndex=o.global?n.index+n[0].length:r),Ry&&n&&n.length>1&&xy(_y,n[0],A,function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(n[i]=void 0)}),n&&h)for(n.groups=s=Ny(null),i=0;i<h.length;i++)s[(a=h[i])[0]]=n[a[1]];return n});var Ky=Ty;Sf({target:"RegExp",proto:!0,forced:/./.exec!==Ky},{exec:Ky});var Vy=Ml,zy=Ud,Gy=Ky,qy=Tl,Wy=Iu,Xy=Ch,Yy=Wy("species"),Jy=RegExp.prototype,$y=function(t,e,A,r){var n=Wy(t),i=!qy(function(){var e={};return e[n]=function(){return 7},7!==""[t](e)}),s=i&&!qy(function(){var e=!1,A=/a/;if("split"===t){var r={};r[Yy]=function(){return A},(A={constructor:r,flags:""})[n]=/./[n]}return A.exec=function(){return e=!0,null},A[n](""),!e});if(!i||!s||A){var a=/./[n],o=e(n,""[t],function(t,e,A,r,n){var s=e.exec;return s===Gy||s===Jy.exec?i&&!n?{done:!0,value:Vy(a,e,A,r)}:{done:!0,value:Vy(t,A,e,r)}:{done:!1}});zy(String.prototype,t,o[0]),zy(Jy,n,o[1])}r&&Xy(Jy[n],"sham",!0)},Zy=$l,tb=_d,eb=HB,Ab=uc,rb=Zy("".charAt),nb=Zy("".charCodeAt),ib=Zy("".slice),sb=function(t){return function(e,A){var r,n,i=eb(Ab(e)),s=tb(A),a=i.length;return s<0||s>=a?t?"":void 0:(r=nb(i,s))<55296||r>56319||s+1===a||(n=nb(i,s+1))<56320||n>57343?t?rb(i,s):r:t?ib(i,s,s+2):n-56320+(r-55296<<10)+65536}},ab={codeAt:sb(!1),charAt:sb(!0)}.charAt,ob=function(t,e,A){return e+(A?ab(t,e).length:1)},lb=Tl,cb=_l.RegExp,ub=!lb(function(){var t=!0;try{cb(".","d")}catch(e){t=!1}var e={},A="",r=t?"dgimsy":"gimsy",n=function(t,r){Object.defineProperty(e,t,{get:function(){return A+=r,!0}})},i={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var s in t&&(i.hasIndices="d"),i)n(s,i[s]);return Object.getOwnPropertyDescriptor(cb.prototype,"flags").get.call(e)!==r||A!==r}),hb=Ml,db=wu,fb=vc,pb={correct:ub},gb=PB,mb=RegExp.prototype,wb=pb.correct?function(t){return t.flags}:function(t){return pb.correct||!fb(mb,t)||db(t,"flags")?t.flags:hb(gb,t)},Bb=Ml,yb=lh,bb=gc,vb=Ac,Cb=Ky,xb=TypeError,Fb=function(t,e){var A=t.exec;if(bb(A)){var r=Bb(A,t,e);return null!==r&&yb(r),r}if("RegExp"===vb(t))return Bb(Cb,t,e);throw new xb("RegExp#exec called on incompatible receiver")},Qb=Ml,Ub=$y,Eb=lh,Nb=wc,Sb=Dd,Lb=HB,Ib=uc,_b=Jc,kb=ob,Tb=wb,Hb=Fb,Ob=$l("".indexOf);Ub("match",function(t,e,A){return[function(e){var A=Ib(this),r=Nb(e)?_b(e,t):void 0;return r?Qb(r,e,A):new RegExp(e)[t](Lb(A))},function(t){var r=Eb(this),n=Lb(t),i=A(e,r,n);if(i.done)return i.value;var s=Lb(Tb(r));if(-1===Ob(s,"g"))return Hb(r,n);var a=-1!==Ob(s,"u");r.lastIndex=0;for(var o,l=[],c=0;null!==(o=Hb(r,n));){var u=Lb(o[0]);l[c]=u,""===u&&(r.lastIndex=kb(n,Sb(r.lastIndex),a)),c++}return 0===c?null:l}]});var Pb=$l,Db=pu,Mb=Math.floor,jb=Pb("".charAt),Rb=Pb("".replace),Kb=Pb("".slice),Vb=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,zb=/\$([$&'`]|\d{1,2})/g,Gb=Vp,qb=Ml,Wb=$l,Xb=$y,Yb=Tl,Jb=lh,$b=gc,Zb=wc,tv=_d,ev=Dd,Av=HB,rv=uc,nv=ob,iv=Jc,sv=function(t,e,A,r,n,i){var s=A+t.length,a=r.length,o=zb;return void 0!==n&&(n=Db(n),o=Vb),Rb(i,o,function(i,o){var l;switch(jb(o,0)){case"$":return"$";case"&":return t;case"`":return Kb(e,0,A);case"'":return Kb(e,s);case"<":l=n[Kb(o,1,-1)];break;default:var c=+o;if(0===c)return i;if(c>a){var u=Mb(c/10);return 0===u?i:u<=a?void 0===r[u-1]?jb(o,1):r[u-1]+jb(o,1):i}l=r[c-1]}return void 0===l?"":l})},av=wb,ov=Fb,lv=Iu("replace"),cv=Math.max,uv=Math.min,hv=Wb([].concat),dv=Wb([].push),fv=Wb("".indexOf),pv=Wb("".slice),gv=function(t){return void 0===t?t:String(t)},mv="$0"==="a".replace(/./,"$0"),wv=!!/./[lv]&&""===/./[lv]("a","$0"),Bv=!Yb(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")});Xb("replace",function(t,e,A){var r=wv?"$":"$0";return[function(t,A){var r=rv(this),n=Zb(t)?iv(t,lv):void 0;return n?qb(n,t,r,A):qb(e,Av(r),t,A)},function(t,n){var i=Jb(this),s=Av(t);if("string"==typeof n&&-1===fv(n,r)&&-1===fv(n,"$<")){var a=A(e,i,s,n);if(a.done)return a.value}var o=$b(n);o||(n=Av(n));var l,c=Av(av(i)),u=-1!==fv(c,"g");u&&(l=-1!==fv(c,"u"),i.lastIndex=0);for(var h,d=[];null!==(h=ov(i,s))&&(dv(d,h),u);){""===Av(h[0])&&(i.lastIndex=nv(s,ev(i.lastIndex),l))}for(var f="",p=0,g=0;g<d.length;g++){for(var m,w=Av((h=d[g])[0]),B=cv(uv(tv(h.index),s.length),0),y=[],b=1;b<h.length;b++)dv(y,gv(h[b]));var v=h.groups;if(o){var C=hv([w],y,B,s);void 0!==v&&dv(C,v),m=Av(Gb(n,void 0,C))}else m=sv(w,s,B,y,v,n);B>=p&&(f+=pv(s,p,B)+m,p=B+w.length)}return f+pv(s,p)}]},!Bv||!mv||wv);var yv,bv=wc,vv=Ac,Cv=Iu("match"),xv=function(t){var e;return bv(t)&&(void 0!==(e=t[Cv])?!!e:"RegExp"===vv(t))},Fv=TypeError,Qv=function(t){if(xv(t))throw new Fv("The method doesn't accept regular expressions");return t},Uv=Iu("match"),Ev=function(t){var e=/./;try{"/./"[t](e)}catch(A){try{return e[Uv]=!1,"/./"[t](e)}catch(t){}}return!1},Nv=Sf,Sv=qp,Lv=kl.f,Iv=Dd,_v=HB,kv=Qv,Tv=uc,Hv=Ev,Ov=Sv("".slice),Pv=Math.min,Dv=Hv("startsWith");Nv({target:"String",proto:!0,forced:!!(Dv||(yv=Lv(String.prototype,"startsWith"),!yv||yv.writable))&&!Dv},{startsWith:function(t){var e=_v(Tv(this));kv(t);var A=Iv(Pv(arguments.length>1?arguments[1]:void 0,e.length)),r=_v(t);return Ov(e,A,A+r.length)===r}});var Mv=Iu,jv=my,Rv=nh.f,Kv=Mv("unscopables"),Vv=Array.prototype;void 0===Vv[Kv]&&Rv(Vv,Kv,{configurable:!0,value:jv(null)});var zv,Gv,qv,Wv=!Tl(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}),Xv=wu,Yv=gc,Jv=pu,$v=Wv,Zv=Kh("IE_PROTO"),tC=Object,eC=tC.prototype,AC=$v?tC.getPrototypeOf:function(t){var e=Jv(t);if(Xv(e,Zv))return e[Zv];var A=e.constructor;return Yv(A)&&e instanceof A?A.prototype:e instanceof tC?eC:null},rC=Tl,nC=gc,iC=wc,sC=AC,aC=Ud,oC=Iu("iterator"),lC=!1;[].keys&&("next"in(qv=[].keys())?(Gv=sC(sC(qv)))!==Object.prototype&&(zv=Gv):lC=!0);var cC=!iC(zv)||rC(function(){var t={};return zv[oC].call(t)!==t});cC&&(zv={}),nC(zv[oC])||aC(zv,oC,function(){return this});var uC={IteratorPrototype:zv,BUGGY_SAFARI_ITERATORS:lC},hC=uC.IteratorPrototype,dC=my,fC=ql,pC=$f,gC=bw,mC=function(){return this},wC=Sf,BC=Ml,yC=gc,bC=function(t,e,A,r){var n=e+" Iterator";return t.prototype=dC(hC,{next:fC(+!r,A)}),pC(t,n,!1),gC[n]=mC,t},vC=AC,CC=Wf,xC=$f,FC=Ch,QC=Ud,UC=bw,EC=Sh.PROPER,NC=Sh.CONFIGURABLE,SC=uC.IteratorPrototype,LC=uC.BUGGY_SAFARI_ITERATORS,IC=Iu("iterator"),_C="keys",kC="values",TC="entries",HC=function(){return this},OC=fc,PC=function(t){Vv[Kv][t]=!0},DC=bw,MC=nd,jC=nh.f,RC=function(t,e,A,r,n,i,s){bC(A,e,r);var a,o,l,c=function(t){if(t===n&&p)return p;if(!LC&&t&&t in d)return d[t];switch(t){case _C:case kC:case TC:return function(){return new A(this,t)}}return function(){return new A(this)}},u=e+" Iterator",h=!1,d=t.prototype,f=d[IC]||d["@@iterator"]||n&&d[n],p=!LC&&f||c(n),g="Array"===e&&d.entries||f;if(g&&(a=vC(g.call(new t)))!==Object.prototype&&a.next&&(vC(a)!==SC&&(CC?CC(a,SC):yC(a[IC])||QC(a,IC,HC)),xC(a,u,!0)),EC&&n===kC&&f&&f.name!==kC&&(NC?FC(d,"name",kC):(h=!0,p=function(){return BC(f,this)})),n)if(o={values:c(kC),keys:i?p:c(_C),entries:c(TC)},s)for(l in o)(LC||h||!(l in d))&&QC(d,l,o[l]);else wC({target:e,proto:!0,forced:LC||h},o);return d[IC]!==p&&QC(d,IC,p,{name:n}),UC[e]=p,o},KC=function(t,e){return{value:t,done:e}},VC=Hl,zC="Array Iterator",GC=MC.set,qC=MC.getterFor(zC),WC=RC(Array,"Array",function(t,e){GC(this,{type:zC,target:OC(t),index:0,kind:e})},function(){var t=qC(this),e=t.target,A=t.index++;if(!e||A>=e.length)return t.target=null,KC(void 0,!0);switch(t.kind){case"keys":return KC(A,!1);case"values":return KC(e[A],!1)}return KC([A,e[A]],!1)},"values"),XC=DC.Arguments=DC.Array;if(PC("keys"),PC("values"),PC("entries"),VC&&"values"!==XC.name)try{jC(XC,"name",{value:"values"})}catch(t){}var YC=Gu("span").classList,JC=YC&&YC.constructor&&YC.constructor.prototype,$C=JC===Object.prototype?void 0:JC,ZC=_l,tx={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},ex=$C,Ax=WC,rx=Ch,nx=$f,ix=Iu("iterator"),sx=Ax.values,ax=function(t,e){if(t){if(t[ix]!==sx)try{rx(t,ix,sx)}catch(e){t[ix]=sx}if(nx(t,e,!0),tx[e])for(var A in Ax)if(t[A]!==Ax[A])try{rx(t,A,Ax[A])}catch(e){t[A]=Ax[A]}}};for(var ox in tx)ax(ZC[ox]&&ZC[ox].prototype,ox);function lx(t){var e=function(t,e){if("object"!=Jt(t)||!t)return t;var A=t[Symbol.toPrimitive];if(void 0!==A){var r=A.call(t,e||"default");if("object"!=Jt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Jt(e)?e:e+""}function cx(t,e,A){return(e=lx(e))in t?Object.defineProperty(t,e,{value:A,enumerable:!0,configurable:!0,writable:!0}):t[e]=A,t}ax(ex,"DOMTokenList");var ux=Wc,hx=pu,dx=ac,fx=jd,px=TypeError,gx="Reduce of empty array with no initial value",mx=function(t){return function(e,A,r,n){var i=hx(e),s=dx(i),a=fx(i);if(ux(A),0===a&&r<2)throw new px(gx);var o=t?a-1:0,l=t?-1:1;if(r<2)for(;;){if(o in s){n=s[o],o+=l;break}if(o+=l,t?o<0:a<=o)throw new px(gx)}for(;t?o>=0:a>o;o+=l)o in s&&(n=A(n,s[o],o,i));return n}},wx={left:mx(!1),right:mx(!0)},Bx=Tl,yx=function(t,e){var A=[][t];return!!A&&Bx(function(){A.call(null,e||function(){return 1},1)})},bx=wx.left;Sf({target:"Array",proto:!0,forced:!Hf&&Ic>79&&Ic<83||!yx("reduce")},{reduce:function(t){var e=arguments.length;return bx(this,t,e,e>1?arguments[1]:void 0)}});var vx=Sf,Cx=qp,xx=kl.f,Fx=Dd,Qx=HB,Ux=Qv,Ex=uc,Nx=Ev,Sx=Cx("".slice),Lx=Math.min,Ix=Nx("endsWith"),_x=!Ix&&!!function(){var t=xx(String.prototype,"endsWith");return t&&!t.writable}();vx({target:"String",proto:!0,forced:!_x&&!Ix},{endsWith:function(t){var e=Qx(Ex(this));Ux(t);var A=arguments.length>1?arguments[1]:void 0,r=e.length,n=void 0===A?r:Lx(Fx(A),r),i=Qx(t);return Sx(e,n-i.length,n)===i}});var kx=Ml,Tx=$l,Hx=$y,Ox=lh,Px=wc,Dx=uc,Mx=Dp,jx=ob,Rx=Dd,Kx=HB,Vx=Jc,zx=Fb,Gx=Tl,qx=VB.UNSUPPORTED_Y,Wx=Math.min,Xx=Tx([].push),Yx=Tx("".slice),Jx=!Gx(function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var A="ab".split(t);return 2!==A.length||"a"!==A[0]||"b"!==A[1]}),$x="c"==="abbc".split(/(b)*/)[1]||4!=="test".split(/(?:)/,-1).length||2!=="ab".split(/(?:ab)*/).length||4!==".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length;Hx("split",function(t,e,A){var r="0".split(void 0,0).length?function(t,A){return void 0===t&&0===A?[]:kx(e,this,t,A)}:e;return[function(e,A){var n=Dx(this),i=Px(e)?Vx(e,t):void 0;return i?kx(i,e,n,A):kx(r,Kx(n),e,A)},function(t,n){var i=Ox(this),s=Kx(t);if(!$x){var a=A(r,i,s,n,r!==e);if(a.done)return a.value}var o=Mx(i,RegExp),l=i.unicode,c=(i.ignoreCase?"i":"")+(i.multiline?"m":"")+(i.unicode?"u":"")+(qx?"g":"y"),u=new o(qx?"^(?:"+i.source+")":i,c),h=void 0===n?4294967295:n>>>0;if(0===h)return[];if(0===s.length)return null===zx(u,s)?[s]:[];for(var d=0,f=0,p=[];f<s.length;){u.lastIndex=qx?0:f;var g,m=zx(u,qx?Yx(s,f):s);if(null===m||(g=Wx(Rx(u.lastIndex+(qx?f:0)),s.length))===d)f=jx(s,f,l);else{if(Xx(p,Yx(s,d,f)),p.length===h)return p;for(var w=1;w<=m.length-1;w++)if(Xx(p,m[w]),p.length===h)return p;f=d=g}}return Xx(p,Yx(s,d)),p}]},$x||!Jx,qx);var Zx={exports:{}},tF={exports:{}};(function(){var t,e,A,r,n,i;"undefined"!=typeof performance&&null!==performance&&performance.now?tF.exports=function(){return performance.now()}:"undefined"!=typeof process&&null!==process&&process.hrtime?(tF.exports=function(){return(t()-n)/1e6},e=process.hrtime,r=(t=function(){var t;return 1e9*(t=e())[0]+t[1]})(),i=1e9*process.uptime(),n=r-i):Date.now?(tF.exports=function(){return Date.now()-A},A=Date.now()):(tF.exports=function(){return(new Date).getTime()-A},A=(new Date).getTime())}).call(R);for(var eF=tF.exports,AF="undefined"==typeof window?R:window,rF=["moz","webkit"],nF="AnimationFrame",iF=AF["request"+nF],sF=AF["cancel"+nF]||AF["cancelRequest"+nF],aF=0;!iF&&aF<rF.length;aF++)iF=AF[rF[aF]+"Request"+nF],sF=AF[rF[aF]+"Cancel"+nF]||AF[rF[aF]+"CancelRequest"+nF];if(!iF||!sF){var oF=0,lF=0,cF=[],uF=1e3/60;iF=function(t){if(0===cF.length){var e=eF(),A=Math.max(0,uF-(e-oF));oF=A+e,setTimeout(function(){var t=cF.slice(0);cF.length=0;for(var e=0;e<t.length;e++)if(!t[e].cancelled)try{t[e].callback(oF)}catch(t){setTimeout(function(){throw t},0)}},Math.round(A))}return cF.push({handle:++lF,callback:t,cancelled:!1}),lF},sF=function(t){for(var e=0;e<cF.length;e++)cF[e].handle===t&&(cF[e].cancelled=!0)}}Zx.exports=function(t){return iF.call(AF,t)},Zx.exports.cancel=function(){sF.apply(AF,arguments)},Zx.exports.polyfill=function(t){t||(t=AF),t.requestAnimationFrame=iF,t.cancelAnimationFrame=sF};var hF=K(Zx.exports),dF="\t\n\v\f\r                 \u2028\u2029\ufeff",fF=uc,pF=HB,gF=dF,mF=$l("".replace),wF=RegExp("^["+gF+"]+"),BF=RegExp("(^|[^"+gF+"])["+gF+"]+$"),yF=function(t){return function(e){var A=pF(fF(e));return 1&t&&(A=mF(A,wF,"")),2&t&&(A=mF(A,BF,"$1")),A}},bF={start:yF(1),end:yF(2),trim:yF(3)},vF=Sh.PROPER,CF=Tl,xF=dF,FF=bF.trim;Sf({target:"String",proto:!0,forced:function(t){return CF(function(){return!!xF[t]()||"​…᠎"!=="​…᠎"[t]()||vF&&xF[t].name!==t})}("trim")},{trim:function(){return FF(this)}});var QF=function(t){this.ok=!1,this.alpha=1,"#"==t.charAt(0)&&(t=t.substr(1,6)),t=(t=t.replace(/ /g,"")).toLowerCase();var e={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};t=e[t]||t;for(var A=[{re:/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*((?:\d?\.)?\d)\)$/,example:["rgba(123, 234, 45, 0.8)","rgba(255,234,245,1.0)"],process:function(t){return[parseInt(t[1]),parseInt(t[2]),parseInt(t[3]),parseFloat(t[4])]}},{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(t){return[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]}},{re:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,example:["#00ff00","336699"],process:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,example:["#fb0","f0f"],process:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}}],r=0;r<A.length;r++){var n=A[r].re,i=A[r].process,s=n.exec(t);if(s){var a=i(s);this.r=a[0],this.g=a[1],this.b=a[2],a.length>3&&(this.alpha=a[3]),this.ok=!0}}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.alpha=this.alpha<0?0:this.alpha>1||isNaN(this.alpha)?1:this.alpha,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toRGBA=function(){return"rgba("+this.r+", "+this.g+", "+this.b+", "+this.alpha+")"},this.toHex=function(){var t=this.r.toString(16),e=this.g.toString(16),A=this.b.toString(16);return 1==t.length&&(t="0"+t),1==e.length&&(e="0"+e),1==A.length&&(A="0"+A),"#"+t+e+A},this.getHelpXML=function(){for(var t=new Array,r=0;r<A.length;r++)for(var n=A[r].example,i=0;i<n.length;i++)t[t.length]=n[i];for(var s in e)t[t.length]=s;var a=document.createElement("ul");a.setAttribute("id","rgbcolor-examples");for(r=0;r<t.length;r++)try{var o=document.createElement("li"),l=new RGBColor(t[r]),c=document.createElement("div");c.style.cssText="margin: 3px; border: 1px solid black; background:"+l.toHex()+"; color:"+l.toHex(),c.appendChild(document.createTextNode("test"));var u=document.createTextNode(" "+t[r]+" -> "+l.toRGB()+" -> "+l.toHex());o.appendChild(c),o.appendChild(u),a.appendChild(o)}catch(t){}return a}},UF=K(QF),EF=Sf,NF=Gd.indexOf,SF=yx,LF=qp([].indexOf),IF=!!LF&&1/LF([1],1,-0)<0;EF({target:"Array",proto:!0,forced:IF||!SF("indexOf")},{indexOf:function(t){var e=arguments.length>1?arguments[1]:void 0;return IF?LF(this,t,e)||0:NF(this,t,e)}});var _F=Sf,kF=Qv,TF=uc,HF=HB,OF=Ev,PF=$l("".indexOf);_F({target:"String",proto:!0,forced:!OF("includes")},{includes:function(t){return!!~PF(HF(TF(this)),HF(kF(t)),arguments.length>1?arguments[1]:void 0)}});var DF=Ac,MF=Sf,jF=Array.isArray||function(t){return"Array"===DF(t)},RF=$l([].reverse),KF=[1,2];MF({target:"Array",proto:!0,forced:String(KF)===String(KF.reverse())},{reverse:function(){return jF(this)&&(this.length=this.length),RF(this)}});
309
+ const{entries:Qo,setPrototypeOf:Uo,isFrozen:Eo,getPrototypeOf:No,getOwnPropertyDescriptor:So}=Object;let{freeze:Lo,seal:Io,create:_o}=Object,{apply:ko,construct:To}="undefined"!=typeof Reflect&&Reflect;Lo||(Lo=function(t){return t}),Io||(Io=function(t){return t}),ko||(ko=function(t,e){for(var A=arguments.length,r=new Array(A>2?A-2:0),n=2;n<A;n++)r[n-2]=arguments[n];return t.apply(e,r)}),To||(To=function(t){for(var e=arguments.length,A=new Array(e>1?e-1:0),r=1;r<e;r++)A[r-1]=arguments[r];return new t(...A)});const Ho=Jo(Array.prototype.forEach),Oo=Jo(Array.prototype.lastIndexOf),Po=Jo(Array.prototype.pop),Do=Jo(Array.prototype.push),Mo=Jo(Array.prototype.splice),jo=Jo(String.prototype.toLowerCase),Ro=Jo(String.prototype.toString),Ko=Jo(String.prototype.match),Vo=Jo(String.prototype.replace),zo=Jo(String.prototype.indexOf),Go=Jo(String.prototype.trim),qo=Jo(Object.prototype.hasOwnProperty),Wo=Jo(RegExp.prototype.test),Xo=(Yo=TypeError,function(){for(var t=arguments.length,e=new Array(t),A=0;A<t;A++)e[A]=arguments[A];return To(Yo,e)});var Yo;function Jo(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var A=arguments.length,r=new Array(A>1?A-1:0),n=1;n<A;n++)r[n-1]=arguments[n];return ko(t,e,r)}}function $o(t,e){let A=arguments.length>2&&void 0!==arguments[2]?arguments[2]:jo;Uo&&Uo(t,null);let r=e.length;for(;r--;){let n=e[r];if("string"==typeof n){const t=A(n);t!==n&&(Eo(e)||(e[r]=t),n=t)}t[n]=!0}return t}function Zo(t){for(let e=0;e<t.length;e++){qo(t,e)||(t[e]=null)}return t}function tl(t){const e=_o(null);for(const[A,r]of Qo(t)){qo(t,A)&&(Array.isArray(r)?e[A]=Zo(r):r&&"object"==typeof r&&r.constructor===Object?e[A]=tl(r):e[A]=r)}return e}function el(t,e){for(;null!==t;){const A=So(t,e);if(A){if(A.get)return Jo(A.get);if("function"==typeof A.value)return Jo(A.value)}t=No(t)}return function(){return null}}const Al=Lo(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),rl=Lo(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),nl=Lo(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),il=Lo(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),sl=Lo(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),al=Lo(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ol=Lo(["#text"]),ll=Lo(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),cl=Lo(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),ul=Lo(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),hl=Lo(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),dl=Io(/\{\{[\w\W]*|[\w\W]*\}\}/gm),fl=Io(/<%[\w\W]*|[\w\W]*%>/gm),pl=Io(/\$\{[\w\W]*/gm),gl=Io(/^data-[\-\w.\u00B7-\uFFFF]+$/),ml=Io(/^aria-[\-\w]+$/),wl=Io(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Bl=Io(/^(?:\w+script|data):/i),yl=Io(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),bl=Io(/^html$/i),vl=Io(/^[a-z][.\w]*(-[.\w]+)+$/i);var Cl=Object.freeze({__proto__:null,ARIA_ATTR:ml,ATTR_WHITESPACE:yl,CUSTOM_ELEMENT:vl,DATA_ATTR:gl,DOCTYPE_NAME:bl,ERB_EXPR:fl,IS_ALLOWED_URI:wl,IS_SCRIPT_OR_DATA:Bl,MUSTACHE_EXPR:dl,TMPLIT_EXPR:pl});const xl=1,Fl=3,Ql=7,Ul=8,El=9,Nl=function(){return"undefined"==typeof window?null:window};var Sl=function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Nl();const A=e=>t(e);if(A.version="3.3.1",A.removed=[],!e||!e.document||e.document.nodeType!==El||!e.Element)return A.isSupported=!1,A;let{document:r}=e;const n=r,i=n.currentScript,{DocumentFragment:s,HTMLTemplateElement:a,Node:o,Element:l,NodeFilter:c,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:h,DOMParser:d,trustedTypes:f}=e,p=l.prototype,g=el(p,"cloneNode"),m=el(p,"remove"),w=el(p,"nextSibling"),B=el(p,"childNodes"),y=el(p,"parentNode");if("function"==typeof a){const t=r.createElement("template");t.content&&t.content.ownerDocument&&(r=t.content.ownerDocument)}let b,v="";const{implementation:C,createNodeIterator:x,createDocumentFragment:F,getElementsByTagName:Q}=r,{importNode:U}=n;let E={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};A.isSupported="function"==typeof Qo&&"function"==typeof y&&C&&void 0!==C.createHTMLDocument;const{MUSTACHE_EXPR:N,ERB_EXPR:S,TMPLIT_EXPR:L,DATA_ATTR:I,ARIA_ATTR:_,IS_SCRIPT_OR_DATA:k,ATTR_WHITESPACE:T,CUSTOM_ELEMENT:H}=Cl;let{IS_ALLOWED_URI:O}=Cl,P=null;const D=$o({},[...Al,...rl,...nl,...sl,...ol]);let M=null;const j=$o({},[...ll,...cl,...ul,...hl]);let R=Object.seal(_o(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),K=null,V=null;const z=Object.seal(_o(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let G=!0,q=!0,W=!1,X=!0,Y=!1,J=!0,$=!1,Z=!1,tt=!1,et=!1,At=!1,rt=!1,nt=!0,it=!1,st=!0,at=!1,ot={},lt=null;const ct=$o({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ut=null;const ht=$o({},["audio","video","img","source","image","track"]);let dt=null;const ft=$o({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),pt="http://www.w3.org/1998/Math/MathML",gt="http://www.w3.org/2000/svg",mt="http://www.w3.org/1999/xhtml";let wt=mt,Bt=!1,yt=null;const bt=$o({},[pt,gt,mt],Ro);let vt=$o({},["mi","mo","mn","ms","mtext"]),Ct=$o({},["annotation-xml"]);const xt=$o({},["title","style","font","a","script"]);let Ft=null;const Qt=["application/xhtml+xml","text/html"];let Ut=null,Et=null;const Nt=r.createElement("form"),St=function(t){return t instanceof RegExp||t instanceof Function},Lt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Et||Et!==t){if(t&&"object"==typeof t||(t={}),t=tl(t),Ft=-1===Qt.indexOf(t.PARSER_MEDIA_TYPE)?"text/html":t.PARSER_MEDIA_TYPE,Ut="application/xhtml+xml"===Ft?Ro:jo,P=qo(t,"ALLOWED_TAGS")?$o({},t.ALLOWED_TAGS,Ut):D,M=qo(t,"ALLOWED_ATTR")?$o({},t.ALLOWED_ATTR,Ut):j,yt=qo(t,"ALLOWED_NAMESPACES")?$o({},t.ALLOWED_NAMESPACES,Ro):bt,dt=qo(t,"ADD_URI_SAFE_ATTR")?$o(tl(ft),t.ADD_URI_SAFE_ATTR,Ut):ft,ut=qo(t,"ADD_DATA_URI_TAGS")?$o(tl(ht),t.ADD_DATA_URI_TAGS,Ut):ht,lt=qo(t,"FORBID_CONTENTS")?$o({},t.FORBID_CONTENTS,Ut):ct,K=qo(t,"FORBID_TAGS")?$o({},t.FORBID_TAGS,Ut):tl({}),V=qo(t,"FORBID_ATTR")?$o({},t.FORBID_ATTR,Ut):tl({}),ot=!!qo(t,"USE_PROFILES")&&t.USE_PROFILES,G=!1!==t.ALLOW_ARIA_ATTR,q=!1!==t.ALLOW_DATA_ATTR,W=t.ALLOW_UNKNOWN_PROTOCOLS||!1,X=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,Y=t.SAFE_FOR_TEMPLATES||!1,J=!1!==t.SAFE_FOR_XML,$=t.WHOLE_DOCUMENT||!1,et=t.RETURN_DOM||!1,At=t.RETURN_DOM_FRAGMENT||!1,rt=t.RETURN_TRUSTED_TYPE||!1,tt=t.FORCE_BODY||!1,nt=!1!==t.SANITIZE_DOM,it=t.SANITIZE_NAMED_PROPS||!1,st=!1!==t.KEEP_CONTENT,at=t.IN_PLACE||!1,O=t.ALLOWED_URI_REGEXP||wl,wt=t.NAMESPACE||mt,vt=t.MATHML_TEXT_INTEGRATION_POINTS||vt,Ct=t.HTML_INTEGRATION_POINTS||Ct,R=t.CUSTOM_ELEMENT_HANDLING||{},t.CUSTOM_ELEMENT_HANDLING&&St(t.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(R.tagNameCheck=t.CUSTOM_ELEMENT_HANDLING.tagNameCheck),t.CUSTOM_ELEMENT_HANDLING&&St(t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(R.attributeNameCheck=t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),t.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(R.allowCustomizedBuiltInElements=t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Y&&(q=!1),At&&(et=!0),ot&&(P=$o({},ol),M=[],!0===ot.html&&($o(P,Al),$o(M,ll)),!0===ot.svg&&($o(P,rl),$o(M,cl),$o(M,hl)),!0===ot.svgFilters&&($o(P,nl),$o(M,cl),$o(M,hl)),!0===ot.mathMl&&($o(P,sl),$o(M,ul),$o(M,hl))),t.ADD_TAGS&&("function"==typeof t.ADD_TAGS?z.tagCheck=t.ADD_TAGS:(P===D&&(P=tl(P)),$o(P,t.ADD_TAGS,Ut))),t.ADD_ATTR&&("function"==typeof t.ADD_ATTR?z.attributeCheck=t.ADD_ATTR:(M===j&&(M=tl(M)),$o(M,t.ADD_ATTR,Ut))),t.ADD_URI_SAFE_ATTR&&$o(dt,t.ADD_URI_SAFE_ATTR,Ut),t.FORBID_CONTENTS&&(lt===ct&&(lt=tl(lt)),$o(lt,t.FORBID_CONTENTS,Ut)),t.ADD_FORBID_CONTENTS&&(lt===ct&&(lt=tl(lt)),$o(lt,t.ADD_FORBID_CONTENTS,Ut)),st&&(P["#text"]=!0),$&&$o(P,["html","head","body"]),P.table&&($o(P,["tbody"]),delete K.tbody),t.TRUSTED_TYPES_POLICY){if("function"!=typeof t.TRUSTED_TYPES_POLICY.createHTML)throw Xo('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof t.TRUSTED_TYPES_POLICY.createScriptURL)throw Xo('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');b=t.TRUSTED_TYPES_POLICY,v=b.createHTML("")}else void 0===b&&(b=function(t,e){if("object"!=typeof t||"function"!=typeof t.createPolicy)return null;let A=null;const r="data-tt-policy-suffix";e&&e.hasAttribute(r)&&(A=e.getAttribute(r));const n="dompurify"+(A?"#"+A:"");try{return t.createPolicy(n,{createHTML:t=>t,createScriptURL:t=>t})}catch(t){return console.warn("TrustedTypes policy "+n+" could not be created."),null}}(f,i)),null!==b&&"string"==typeof v&&(v=b.createHTML(""));Lo&&Lo(t),Et=t}},It=$o({},[...rl,...nl,...il]),_t=$o({},[...sl,...al]),kt=function(t){Do(A.removed,{element:t});try{y(t).removeChild(t)}catch(e){m(t)}},Tt=function(t,e){try{Do(A.removed,{attribute:e.getAttributeNode(t),from:e})}catch(t){Do(A.removed,{attribute:null,from:e})}if(e.removeAttribute(t),"is"===t)if(et||At)try{kt(e)}catch(t){}else try{e.setAttribute(t,"")}catch(t){}},Ht=function(t){let e=null,A=null;if(tt)t="<remove></remove>"+t;else{const e=Ko(t,/^[\r\n\t ]+/);A=e&&e[0]}"application/xhtml+xml"===Ft&&wt===mt&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");const n=b?b.createHTML(t):t;if(wt===mt)try{e=(new d).parseFromString(n,Ft)}catch(t){}if(!e||!e.documentElement){e=C.createDocument(wt,"template",null);try{e.documentElement.innerHTML=Bt?v:n}catch(t){}}const i=e.body||e.documentElement;return t&&A&&i.insertBefore(r.createTextNode(A),i.childNodes[0]||null),wt===mt?Q.call(e,$?"html":"body")[0]:$?e.documentElement:i},Ot=function(t){return x.call(t.ownerDocument||t,t,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Pt=function(t){return t instanceof h&&("string"!=typeof t.nodeName||"string"!=typeof t.textContent||"function"!=typeof t.removeChild||!(t.attributes instanceof u)||"function"!=typeof t.removeAttribute||"function"!=typeof t.setAttribute||"string"!=typeof t.namespaceURI||"function"!=typeof t.insertBefore||"function"!=typeof t.hasChildNodes)},Dt=function(t){return"function"==typeof o&&t instanceof o};function Mt(t,e,r){Ho(t,t=>{t.call(A,e,r,Et)})}const jt=function(t){let e=null;if(Mt(E.beforeSanitizeElements,t,null),Pt(t))return kt(t),!0;const r=Ut(t.nodeName);if(Mt(E.uponSanitizeElement,t,{tagName:r,allowedTags:P}),J&&t.hasChildNodes()&&!Dt(t.firstElementChild)&&Wo(/<[/\w!]/g,t.innerHTML)&&Wo(/<[/\w!]/g,t.textContent))return kt(t),!0;if(t.nodeType===Ql)return kt(t),!0;if(J&&t.nodeType===Ul&&Wo(/<[/\w]/g,t.data))return kt(t),!0;if(!(z.tagCheck instanceof Function&&z.tagCheck(r))&&(!P[r]||K[r])){if(!K[r]&&Kt(r)){if(R.tagNameCheck instanceof RegExp&&Wo(R.tagNameCheck,r))return!1;if(R.tagNameCheck instanceof Function&&R.tagNameCheck(r))return!1}if(st&&!lt[r]){const e=y(t)||t.parentNode,A=B(t)||t.childNodes;if(A&&e){for(let r=A.length-1;r>=0;--r){const n=g(A[r],!0);n.__removalCount=(t.__removalCount||0)+1,e.insertBefore(n,w(t))}}}return kt(t),!0}return t instanceof l&&!function(t){let e=y(t);e&&e.tagName||(e={namespaceURI:wt,tagName:"template"});const A=jo(t.tagName),r=jo(e.tagName);return!!yt[t.namespaceURI]&&(t.namespaceURI===gt?e.namespaceURI===mt?"svg"===A:e.namespaceURI===pt?"svg"===A&&("annotation-xml"===r||vt[r]):Boolean(It[A]):t.namespaceURI===pt?e.namespaceURI===mt?"math"===A:e.namespaceURI===gt?"math"===A&&Ct[r]:Boolean(_t[A]):t.namespaceURI===mt?!(e.namespaceURI===gt&&!Ct[r])&&!(e.namespaceURI===pt&&!vt[r])&&!_t[A]&&(xt[A]||!It[A]):!("application/xhtml+xml"!==Ft||!yt[t.namespaceURI]))}(t)?(kt(t),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!Wo(/<\/no(script|embed|frames)/i,t.innerHTML)?(Y&&t.nodeType===Fl&&(e=t.textContent,Ho([N,S,L],t=>{e=Vo(e,t," ")}),t.textContent!==e&&(Do(A.removed,{element:t.cloneNode()}),t.textContent=e)),Mt(E.afterSanitizeElements,t,null),!1):(kt(t),!0)},Rt=function(t,e,A){if(nt&&("id"===e||"name"===e)&&(A in r||A in Nt))return!1;if(q&&!V[e]&&Wo(I,e));else if(G&&Wo(_,e));else if(z.attributeCheck instanceof Function&&z.attributeCheck(e,t));else if(!M[e]||V[e]){if(!(Kt(t)&&(R.tagNameCheck instanceof RegExp&&Wo(R.tagNameCheck,t)||R.tagNameCheck instanceof Function&&R.tagNameCheck(t))&&(R.attributeNameCheck instanceof RegExp&&Wo(R.attributeNameCheck,e)||R.attributeNameCheck instanceof Function&&R.attributeNameCheck(e,t))||"is"===e&&R.allowCustomizedBuiltInElements&&(R.tagNameCheck instanceof RegExp&&Wo(R.tagNameCheck,A)||R.tagNameCheck instanceof Function&&R.tagNameCheck(A))))return!1}else if(dt[e]);else if(Wo(O,Vo(A,T,"")));else if("src"!==e&&"xlink:href"!==e&&"href"!==e||"script"===t||0!==zo(A,"data:")||!ut[t]){if(W&&!Wo(k,Vo(A,T,"")));else if(A)return!1}else;return!0},Kt=function(t){return"annotation-xml"!==t&&Ko(t,H)},Vt=function(t){Mt(E.beforeSanitizeAttributes,t,null);const{attributes:e}=t;if(!e||Pt(t))return;const r={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:M,forceKeepAttr:void 0};let n=e.length;for(;n--;){const i=e[n],{name:s,namespaceURI:a,value:o}=i,l=Ut(s),c=o;let u="value"===s?c:Go(c);if(r.attrName=l,r.attrValue=u,r.keepAttr=!0,r.forceKeepAttr=void 0,Mt(E.uponSanitizeAttribute,t,r),u=r.attrValue,!it||"id"!==l&&"name"!==l||(Tt(s,t),u="user-content-"+u),J&&Wo(/((--!?|])>)|<\/(style|title|textarea)/i,u)){Tt(s,t);continue}if("attributename"===l&&Ko(u,"href")){Tt(s,t);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){Tt(s,t);continue}if(!X&&Wo(/\/>/i,u)){Tt(s,t);continue}Y&&Ho([N,S,L],t=>{u=Vo(u,t," ")});const h=Ut(t.nodeName);if(Rt(h,l,u)){if(b&&"object"==typeof f&&"function"==typeof f.getAttributeType)if(a);else switch(f.getAttributeType(h,l)){case"TrustedHTML":u=b.createHTML(u);break;case"TrustedScriptURL":u=b.createScriptURL(u)}if(u!==c)try{a?t.setAttributeNS(a,s,u):t.setAttribute(s,u),Pt(t)?kt(t):Po(A.removed)}catch(e){Tt(s,t)}}else Tt(s,t)}Mt(E.afterSanitizeAttributes,t,null)},zt=function t(e){let A=null;const r=Ot(e);for(Mt(E.beforeSanitizeShadowDOM,e,null);A=r.nextNode();)Mt(E.uponSanitizeShadowNode,A,null),jt(A),Vt(A),A.content instanceof s&&t(A.content);Mt(E.afterSanitizeShadowDOM,e,null)};return A.sanitize=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,i=null,a=null,l=null;if(Bt=!t,Bt&&(t="\x3c!--\x3e"),"string"!=typeof t&&!Dt(t)){if("function"!=typeof t.toString)throw Xo("toString is not a function");if("string"!=typeof(t=t.toString()))throw Xo("dirty is not a string, aborting")}if(!A.isSupported)return t;if(Z||Lt(e),A.removed=[],"string"==typeof t&&(at=!1),at){if(t.nodeName){const e=Ut(t.nodeName);if(!P[e]||K[e])throw Xo("root node is forbidden and cannot be sanitized in-place")}}else if(t instanceof o)r=Ht("\x3c!----\x3e"),i=r.ownerDocument.importNode(t,!0),i.nodeType===xl&&"BODY"===i.nodeName||"HTML"===i.nodeName?r=i:r.appendChild(i);else{if(!et&&!Y&&!$&&-1===t.indexOf("<"))return b&&rt?b.createHTML(t):t;if(r=Ht(t),!r)return et?null:rt?v:""}r&&tt&&kt(r.firstChild);const c=Ot(at?t:r);for(;a=c.nextNode();)jt(a),Vt(a),a.content instanceof s&&zt(a.content);if(at)return t;if(et){if(At)for(l=F.call(r.ownerDocument);r.firstChild;)l.appendChild(r.firstChild);else l=r;return(M.shadowroot||M.shadowrootmode)&&(l=U.call(n,l,!0)),l}let u=$?r.outerHTML:r.innerHTML;return $&&P["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&Wo(bl,r.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+u),Y&&Ho([N,S,L],t=>{u=Vo(u,t," ")}),b&&rt?b.createHTML(u):u},A.setConfig=function(){Lt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Z=!0},A.clearConfig=function(){Et=null,Z=!1},A.isValidAttribute=function(t,e,A){Et||Lt({});const r=Ut(t),n=Ut(e);return Rt(r,n,A)},A.addHook=function(t,e){"function"==typeof e&&Do(E[t],e)},A.removeHook=function(t,e){if(void 0!==e){const A=Oo(E[t],e);return-1===A?void 0:Mo(E[t],A,1)[0]}return Po(E[t])},A.removeHooks=function(t){E[t]=[]},A.removeAllHooks=function(){E={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},A}(),Ll=Object.freeze({__proto__:null,default:Sl}),Il=function(t){return t&&t.Math===Math&&t},_l=Il("object"==typeof globalThis&&globalThis)||Il("object"==typeof window&&window)||Il("object"==typeof self&&self)||Il("object"==typeof R&&R)||Il("object"==typeof R&&R)||function(){return this}()||Function("return this")(),kl={},Tl=function(t){try{return!!t()}catch(t){return!0}},Hl=!Tl(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}),Ol=!Tl(function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}),Pl=Ol,Dl=Function.prototype.call,Ml=Pl?Dl.bind(Dl):function(){return Dl.apply(Dl,arguments)},jl={},Rl={}.propertyIsEnumerable,Kl=Object.getOwnPropertyDescriptor,Vl=Kl&&!Rl.call({1:2},1);jl.f=Vl?function(t){var e=Kl(this,t);return!!e&&e.enumerable}:Rl;var zl,Gl,ql=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},Wl=Ol,Xl=Function.prototype,Yl=Xl.call,Jl=Wl&&Xl.bind.bind(Yl,Yl),$l=Wl?Jl:function(t){return function(){return Yl.apply(t,arguments)}},Zl=$l,tc=Zl({}.toString),ec=Zl("".slice),Ac=function(t){return ec(tc(t),8,-1)},rc=Tl,nc=Ac,ic=Object,sc=$l("".split),ac=rc(function(){return!ic("z").propertyIsEnumerable(0)})?function(t){return"String"===nc(t)?sc(t,""):ic(t)}:ic,oc=function(t){return null==t},lc=oc,cc=TypeError,uc=function(t){if(lc(t))throw new cc("Can't call method on "+t);return t},hc=ac,dc=uc,fc=function(t){return hc(dc(t))},pc="object"==typeof document&&document.all,gc=void 0===pc&&void 0!==pc?function(t){return"function"==typeof t||t===pc}:function(t){return"function"==typeof t},mc=gc,wc=function(t){return"object"==typeof t?null!==t:mc(t)},Bc=_l,yc=gc,bc=function(t,e){return arguments.length<2?(A=Bc[t],yc(A)?A:void 0):Bc[t]&&Bc[t][e];var A},vc=$l({}.isPrototypeOf),Cc=_l.navigator,xc=Cc&&Cc.userAgent,Fc=xc?String(xc):"",Qc=_l,Uc=Fc,Ec=Qc.process,Nc=Qc.Deno,Sc=Ec&&Ec.versions||Nc&&Nc.version,Lc=Sc&&Sc.v8;Lc&&(Gl=(zl=Lc.split("."))[0]>0&&zl[0]<4?1:+(zl[0]+zl[1])),!Gl&&Uc&&(!(zl=Uc.match(/Edge\/(\d+)/))||zl[1]>=74)&&(zl=Uc.match(/Chrome\/(\d+)/))&&(Gl=+zl[1]);var Ic=Gl,_c=Ic,kc=Tl,Tc=_l.String,Hc=!!Object.getOwnPropertySymbols&&!kc(function(){var t=Symbol("symbol detection");return!Tc(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&_c&&_c<41}),Oc=Hc&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Pc=bc,Dc=gc,Mc=vc,jc=Object,Rc=Oc?function(t){return"symbol"==typeof t}:function(t){var e=Pc("Symbol");return Dc(e)&&Mc(e.prototype,jc(t))},Kc=String,Vc=function(t){try{return Kc(t)}catch(t){return"Object"}},zc=gc,Gc=Vc,qc=TypeError,Wc=function(t){if(zc(t))return t;throw new qc(Gc(t)+" is not a function")},Xc=Wc,Yc=oc,Jc=function(t,e){var A=t[e];return Yc(A)?void 0:Xc(A)},$c=Ml,Zc=gc,tu=wc,eu=TypeError,Au={exports:{}},ru=_l,nu=Object.defineProperty,iu=function(t,e){try{nu(ru,t,{value:e,configurable:!0,writable:!0})}catch(A){ru[t]=e}return e},su=_l,au=iu,ou="__core-js_shared__",lu=Au.exports=su[ou]||au(ou,{});(lu.versions||(lu.versions=[])).push({version:"3.48.0",mode:"global",copyright:"© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.48.0/LICENSE",source:"https://github.com/zloirock/core-js"});var cu=Au.exports,uu=cu,hu=function(t,e){return uu[t]||(uu[t]=e||{})},du=uc,fu=Object,pu=function(t){return fu(du(t))},gu=pu,mu=$l({}.hasOwnProperty),wu=Object.hasOwn||function(t,e){return mu(gu(t),e)},Bu=$l,yu=0,bu=Math.random(),vu=Bu(1.1.toString),Cu=function(t){return"Symbol("+(void 0===t?"":t)+")_"+vu(++yu+bu,36)},xu=hu,Fu=wu,Qu=Cu,Uu=Hc,Eu=Oc,Nu=_l.Symbol,Su=xu("wks"),Lu=Eu?Nu.for||Nu:Nu&&Nu.withoutSetter||Qu,Iu=function(t){return Fu(Su,t)||(Su[t]=Uu&&Fu(Nu,t)?Nu[t]:Lu("Symbol."+t)),Su[t]},_u=Ml,ku=wc,Tu=Rc,Hu=Jc,Ou=function(t,e){var A,r;if("string"===e&&Zc(A=t.toString)&&!tu(r=$c(A,t)))return r;if(Zc(A=t.valueOf)&&!tu(r=$c(A,t)))return r;if("string"!==e&&Zc(A=t.toString)&&!tu(r=$c(A,t)))return r;throw new eu("Can't convert object to primitive value")},Pu=TypeError,Du=Iu("toPrimitive"),Mu=function(t,e){if(!ku(t)||Tu(t))return t;var A,r=Hu(t,Du);if(r){if(void 0===e&&(e="default"),A=_u(r,t,e),!ku(A)||Tu(A))return A;throw new Pu("Can't convert object to primitive value")}return void 0===e&&(e="number"),Ou(t,e)},ju=Rc,Ru=function(t){var e=Mu(t,"string");return ju(e)?e:e+""},Ku=wc,Vu=_l.document,zu=Ku(Vu)&&Ku(Vu.createElement),Gu=function(t){return zu?Vu.createElement(t):{}},qu=Gu,Wu=!Hl&&!Tl(function(){return 7!==Object.defineProperty(qu("div"),"a",{get:function(){return 7}}).a}),Xu=Hl,Yu=Ml,Ju=jl,$u=ql,Zu=fc,th=Ru,eh=wu,Ah=Wu,rh=Object.getOwnPropertyDescriptor;kl.f=Xu?rh:function(t,e){if(t=Zu(t),e=th(e),Ah)try{return rh(t,e)}catch(t){}if(eh(t,e))return $u(!Yu(Ju.f,t,e),t[e])};var nh={},ih=Hl&&Tl(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype}),sh=wc,ah=String,oh=TypeError,lh=function(t){if(sh(t))return t;throw new oh(ah(t)+" is not an object")},ch=Hl,uh=Wu,hh=ih,dh=lh,fh=Ru,ph=TypeError,gh=Object.defineProperty,mh=Object.getOwnPropertyDescriptor,wh="enumerable",Bh="configurable",yh="writable";nh.f=ch?hh?function(t,e,A){if(dh(t),e=fh(e),dh(A),"function"==typeof t&&"prototype"===e&&"value"in A&&yh in A&&!A[yh]){var r=mh(t,e);r&&r[yh]&&(t[e]=A.value,A={configurable:Bh in A?A[Bh]:r[Bh],enumerable:wh in A?A[wh]:r[wh],writable:!1})}return gh(t,e,A)}:gh:function(t,e,A){if(dh(t),e=fh(e),dh(A),uh)try{return gh(t,e,A)}catch(t){}if("get"in A||"set"in A)throw new ph("Accessors not supported");return"value"in A&&(t[e]=A.value),t};var bh=nh,vh=ql,Ch=Hl?function(t,e,A){return bh.f(t,e,vh(1,A))}:function(t,e,A){return t[e]=A,t},xh={exports:{}},Fh=Hl,Qh=wu,Uh=Function.prototype,Eh=Fh&&Object.getOwnPropertyDescriptor,Nh=Qh(Uh,"name"),Sh={EXISTS:Nh,PROPER:Nh&&"something"===function(){}.name,CONFIGURABLE:Nh&&(!Fh||Fh&&Eh(Uh,"name").configurable)},Lh=gc,Ih=cu,_h=$l(Function.toString);Lh(Ih.inspectSource)||(Ih.inspectSource=function(t){return _h(t)});var kh,Th,Hh,Oh=Ih.inspectSource,Ph=gc,Dh=_l.WeakMap,Mh=Ph(Dh)&&/native code/.test(String(Dh)),jh=Cu,Rh=hu("keys"),Kh=function(t){return Rh[t]||(Rh[t]=jh(t))},Vh={},zh=Mh,Gh=_l,qh=wc,Wh=Ch,Xh=wu,Yh=cu,Jh=Kh,$h=Vh,Zh="Object already initialized",td=Gh.TypeError,ed=Gh.WeakMap;if(zh||Yh.state){var Ad=Yh.state||(Yh.state=new ed);Ad.get=Ad.get,Ad.has=Ad.has,Ad.set=Ad.set,kh=function(t,e){if(Ad.has(t))throw new td(Zh);return e.facade=t,Ad.set(t,e),e},Th=function(t){return Ad.get(t)||{}},Hh=function(t){return Ad.has(t)}}else{var rd=Jh("state");$h[rd]=!0,kh=function(t,e){if(Xh(t,rd))throw new td(Zh);return e.facade=t,Wh(t,rd,e),e},Th=function(t){return Xh(t,rd)?t[rd]:{}},Hh=function(t){return Xh(t,rd)}}var nd={set:kh,get:Th,has:Hh,enforce:function(t){return Hh(t)?Th(t):kh(t,{})},getterFor:function(t){return function(e){var A;if(!qh(e)||(A=Th(e)).type!==t)throw new td("Incompatible receiver, "+t+" required");return A}}},id=$l,sd=Tl,ad=gc,od=wu,ld=Hl,cd=Sh.CONFIGURABLE,ud=Oh,hd=nd.enforce,dd=nd.get,fd=String,pd=Object.defineProperty,gd=id("".slice),md=id("".replace),wd=id([].join),Bd=ld&&!sd(function(){return 8!==pd(function(){},"length",{value:8}).length}),yd=String(String).split("String"),bd=xh.exports=function(t,e,A){"Symbol("===gd(fd(e),0,7)&&(e="["+md(fd(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),A&&A.getter&&(e="get "+e),A&&A.setter&&(e="set "+e),(!od(t,"name")||cd&&t.name!==e)&&(ld?pd(t,"name",{value:e,configurable:!0}):t.name=e),Bd&&A&&od(A,"arity")&&t.length!==A.arity&&pd(t,"length",{value:A.arity});try{A&&od(A,"constructor")&&A.constructor?ld&&pd(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var r=hd(t);return od(r,"source")||(r.source=wd(yd,"string"==typeof e?e:"")),t};Function.prototype.toString=bd(function(){return ad(this)&&dd(this).source||ud(this)},"toString");var vd=xh.exports,Cd=gc,xd=nh,Fd=vd,Qd=iu,Ud=function(t,e,A,r){r||(r={});var n=r.enumerable,i=void 0!==r.name?r.name:e;if(Cd(A)&&Fd(A,i,r),r.global)n?t[e]=A:Qd(e,A);else{try{r.unsafe?t[e]&&(n=!0):delete t[e]}catch(t){}n?t[e]=A:xd.f(t,e,{value:A,enumerable:!1,configurable:!r.nonConfigurable,writable:!r.nonWritable})}return t},Ed={},Nd=Math.ceil,Sd=Math.floor,Ld=Math.trunc||function(t){var e=+t;return(e>0?Sd:Nd)(e)},Id=Ld,_d=function(t){var e=+t;return e!=e||0===e?0:Id(e)},kd=_d,Td=Math.max,Hd=Math.min,Od=_d,Pd=Math.min,Dd=function(t){var e=Od(t);return e>0?Pd(e,9007199254740991):0},Md=Dd,jd=function(t){return Md(t.length)},Rd=fc,Kd=function(t,e){var A=kd(t);return A<0?Td(A+e,0):Hd(A,e)},Vd=jd,zd=function(t){return function(e,A,r){var n=Rd(e),i=Vd(n);if(0===i)return!t&&-1;var s,a=Kd(r,i);if(t&&A!=A){for(;i>a;)if((s=n[a++])!=s)return!0}else for(;i>a;a++)if((t||a in n)&&n[a]===A)return t||a||0;return!t&&-1}},Gd={includes:zd(!0),indexOf:zd(!1)},qd=wu,Wd=fc,Xd=Gd.indexOf,Yd=Vh,Jd=$l([].push),$d=function(t,e){var A,r=Wd(t),n=0,i=[];for(A in r)!qd(Yd,A)&&qd(r,A)&&Jd(i,A);for(;e.length>n;)qd(r,A=e[n++])&&(~Xd(i,A)||Jd(i,A));return i},Zd=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],tf=$d,ef=Zd.concat("length","prototype");Ed.f=Object.getOwnPropertyNames||function(t){return tf(t,ef)};var Af={};Af.f=Object.getOwnPropertySymbols;var rf=bc,nf=Ed,sf=Af,af=lh,of=$l([].concat),lf=rf("Reflect","ownKeys")||function(t){var e=nf.f(af(t)),A=sf.f;return A?of(e,A(t)):e},cf=wu,uf=lf,hf=kl,df=nh,ff=Tl,pf=gc,gf=/#|\.prototype\./,mf=function(t,e){var A=Bf[wf(t)];return A===bf||A!==yf&&(pf(e)?ff(e):!!e)},wf=mf.normalize=function(t){return String(t).replace(gf,".").toLowerCase()},Bf=mf.data={},yf=mf.NATIVE="N",bf=mf.POLYFILL="P",vf=mf,Cf=_l,xf=kl.f,Ff=Ch,Qf=Ud,Uf=iu,Ef=function(t,e,A){for(var r=uf(e),n=df.f,i=hf.f,s=0;s<r.length;s++){var a=r[s];cf(t,a)||A&&cf(A,a)||n(t,a,i(e,a))}},Nf=vf,Sf=function(t,e){var A,r,n,i,s,a=t.target,o=t.global,l=t.stat;if(A=o?Cf:l?Cf[a]||Uf(a,{}):Cf[a]&&Cf[a].prototype)for(r in e){if(i=e[r],n=t.dontCallGetSet?(s=xf(A,r))&&s.value:A[r],!Nf(o?r:a+(l?".":"#")+r,t.forced)&&void 0!==n){if(typeof i==typeof n)continue;Ef(i,n)}(t.sham||n&&n.sham)&&Ff(i,"sham",!0),Qf(A,r,i,t)}},Lf=_l,If=Fc,_f=Ac,kf=function(t){return If.slice(0,t.length)===t},Tf=kf("Bun/")?"BUN":kf("Cloudflare-Workers")?"CLOUDFLARE":kf("Deno/")?"DENO":kf("Node.js/")?"NODE":Lf.Bun&&"string"==typeof Bun.version?"BUN":Lf.Deno&&"object"==typeof Deno.version?"DENO":"process"===_f(Lf.process)?"NODE":Lf.window&&Lf.document?"BROWSER":"REST",Hf="NODE"===Tf,Of=_l,Pf=$l,Df=Wc,Mf=wc,jf=function(t){return Mf(t)||null===t},Rf=String,Kf=TypeError,Vf=function(t,e,A){try{return Pf(Df(Object.getOwnPropertyDescriptor(t,e)[A]))}catch(t){}},zf=wc,Gf=uc,qf=function(t){if(jf(t))return t;throw new Kf("Can't set "+Rf(t)+" as a prototype")},Wf=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,A={};try{(t=Vf(Object.prototype,"__proto__","set"))(A,[]),e=A instanceof Array}catch(t){}return function(A,r){return Gf(A),qf(r),zf(A)?(e?t(A,r):A.__proto__=r,A):A}}():void 0),Xf=nh.f,Yf=wu,Jf=Iu("toStringTag"),$f=function(t,e,A){t&&!A&&(t=t.prototype),t&&!Yf(t,Jf)&&Xf(t,Jf,{configurable:!0,value:e})},Zf=vd,tp=nh,ep=bc,Ap=function(t,e,A){return A.get&&Zf(A.get,e,{getter:!0}),A.set&&Zf(A.set,e,{setter:!0}),tp.f(t,e,A)},rp=Hl,np=Iu("species"),ip=vc,sp=TypeError,ap={};ap[Iu("toStringTag")]="z";var op="[object z]"===String(ap),lp=gc,cp=Ac,up=Iu("toStringTag"),hp=Object,dp="Arguments"===cp(function(){return arguments}()),fp=op?cp:function(t){var e,A,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(A=function(t,e){try{return t[e]}catch(t){}}(e=hp(t),up))?A:dp?cp(e):"Object"===(r=cp(e))&&lp(e.callee)?"Arguments":r},pp=$l,gp=Tl,mp=gc,wp=fp,Bp=Oh,yp=function(){},bp=bc("Reflect","construct"),vp=/^\s*(?:class|function)\b/,Cp=pp(vp.exec),xp=!vp.test(yp),Fp=function(t){if(!mp(t))return!1;try{return bp(yp,[],t),!0}catch(t){return!1}},Qp=function(t){if(!mp(t))return!1;switch(wp(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return xp||!!Cp(vp,Bp(t))}catch(t){return!0}};Qp.sham=!0;var Up,Ep,Np,Sp,Lp=!bp||gp(function(){var t;return Fp(Fp.call)||!Fp(Object)||!Fp(function(){t=!0})||t})?Qp:Fp,Ip=Lp,_p=Vc,kp=TypeError,Tp=lh,Hp=function(t){if(Ip(t))return t;throw new kp(_p(t)+" is not a constructor")},Op=oc,Pp=Iu("species"),Dp=function(t,e){var A,r=Tp(t).constructor;return void 0===r||Op(A=Tp(r)[Pp])?e:Hp(A)},Mp=Ol,jp=Function.prototype,Rp=jp.apply,Kp=jp.call,Vp="object"==typeof Reflect&&Reflect.apply||(Mp?Kp.bind(Rp):function(){return Kp.apply(Rp,arguments)}),zp=Ac,Gp=$l,qp=function(t){if("Function"===zp(t))return Gp(t)},Wp=Wc,Xp=Ol,Yp=qp(qp.bind),Jp=function(t,e){return Wp(t),void 0===e?t:Xp?Yp(t,e):function(){return t.apply(e,arguments)}},$p=bc("document","documentElement"),Zp=$l([].slice),tg=TypeError,eg=/(?:ipad|iphone|ipod).*applewebkit/i.test(Fc),Ag=_l,rg=Vp,ng=Jp,ig=gc,sg=wu,ag=Tl,og=$p,lg=Zp,cg=Gu,ug=function(t,e){if(t<e)throw new tg("Not enough arguments");return t},hg=eg,dg=Hf,fg=Ag.setImmediate,pg=Ag.clearImmediate,gg=Ag.process,mg=Ag.Dispatch,wg=Ag.Function,Bg=Ag.MessageChannel,yg=Ag.String,bg=0,vg={},Cg="onreadystatechange";ag(function(){Up=Ag.location});var xg=function(t){if(sg(vg,t)){var e=vg[t];delete vg[t],e()}},Fg=function(t){return function(){xg(t)}},Qg=function(t){xg(t.data)},Ug=function(t){Ag.postMessage(yg(t),Up.protocol+"//"+Up.host)};fg&&pg||(fg=function(t){ug(arguments.length,1);var e=ig(t)?t:wg(t),A=lg(arguments,1);return vg[++bg]=function(){rg(e,void 0,A)},Ep(bg),bg},pg=function(t){delete vg[t]},dg?Ep=function(t){gg.nextTick(Fg(t))}:mg&&mg.now?Ep=function(t){mg.now(Fg(t))}:Bg&&!hg?(Sp=(Np=new Bg).port2,Np.port1.onmessage=Qg,Ep=ng(Sp.postMessage,Sp)):Ag.addEventListener&&ig(Ag.postMessage)&&!Ag.importScripts&&Up&&"file:"!==Up.protocol&&!ag(Ug)?(Ep=Ug,Ag.addEventListener("message",Qg,!1)):Ep=Cg in cg("script")?function(t){og.appendChild(cg("script"))[Cg]=function(){og.removeChild(this),xg(t)}}:function(t){setTimeout(Fg(t),0)});var Eg={set:fg,clear:pg},Ng=_l,Sg=Hl,Lg=Object.getOwnPropertyDescriptor,Ig=function(){this.head=null,this.tail=null};Ig.prototype={add:function(t){var e={item:t,next:null},A=this.tail;A?A.next=e:this.head=e,this.tail=e},get:function(){var t=this.head;if(t)return null===(this.head=t.next)&&(this.tail=null),t.item}};var _g,kg,Tg,Hg,Og,Pg=Ig,Dg=/ipad|iphone|ipod/i.test(Fc)&&"undefined"!=typeof Pebble,Mg=/web0s(?!.*chrome)/i.test(Fc),jg=_l,Rg=function(t){if(!Sg)return Ng[t];var e=Lg(Ng,t);return e&&e.value},Kg=Jp,Vg=Eg.set,zg=Pg,Gg=eg,qg=Dg,Wg=Mg,Xg=Hf,Yg=jg.MutationObserver||jg.WebKitMutationObserver,Jg=jg.document,$g=jg.process,Zg=jg.Promise,tm=Rg("queueMicrotask");if(!tm){var em=new zg,Am=function(){var t,e;for(Xg&&(t=$g.domain)&&t.exit();e=em.get();)try{e()}catch(t){throw em.head&&_g(),t}t&&t.enter()};Gg||Xg||Wg||!Yg||!Jg?!qg&&Zg&&Zg.resolve?((Hg=Zg.resolve(void 0)).constructor=Zg,Og=Kg(Hg.then,Hg),_g=function(){Og(Am)}):Xg?_g=function(){$g.nextTick(Am)}:(Vg=Kg(Vg,jg),_g=function(){Vg(Am)}):(kg=!0,Tg=Jg.createTextNode(""),new Yg(Am).observe(Tg,{characterData:!0}),_g=function(){Tg.data=kg=!kg}),tm=function(t){em.head||_g(),em.add(t)}}var rm=tm,nm=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}},im=_l.Promise,sm=_l,am=im,om=gc,lm=vf,cm=Oh,um=Iu,hm=Tf,dm=Ic;am&&am.prototype;var fm=um("species"),pm=!1,gm=om(sm.PromiseRejectionEvent),mm=lm("Promise",function(){var t=cm(am),e=t!==String(am);if(!e&&66===dm)return!0;if(!dm||dm<51||!/native code/.test(t)){var A=new am(function(t){t(1)}),r=function(t){t(function(){},function(){})};if((A.constructor={})[fm]=r,!(pm=A.then(function(){})instanceof r))return!0}return!(e||"BROWSER"!==hm&&"DENO"!==hm||gm)}),wm={CONSTRUCTOR:mm,REJECTION_EVENT:gm,SUBCLASSING:pm},Bm={},ym=Wc,bm=TypeError,vm=function(t){var e,A;this.promise=new t(function(t,r){if(void 0!==e||void 0!==A)throw new bm("Bad Promise constructor");e=t,A=r}),this.resolve=ym(e),this.reject=ym(A)};Bm.f=function(t){return new vm(t)};var Cm,xm,Fm,Qm,Um=Sf,Em=Hf,Nm=_l,Sm=Of,Lm=Ml,Im=Ud,_m=Wf,km=$f,Tm=function(t){var e=ep(t);rp&&e&&!e[np]&&Ap(e,np,{configurable:!0,get:function(){return this}})},Hm=Wc,Om=gc,Pm=wc,Dm=function(t,e){if(ip(e,t))return t;throw new sp("Incorrect invocation")},Mm=Dp,jm=Eg.set,Rm=rm,Km=function(t,e){try{1===arguments.length?console.error(t):console.error(t,e)}catch(t){}},Vm=nm,zm=Pg,Gm=nd,qm=im,Wm=Bm,Xm="Promise",Ym=wm.CONSTRUCTOR,Jm=wm.REJECTION_EVENT,$m=wm.SUBCLASSING,Zm=Gm.getterFor(Xm),tw=Gm.set,ew=qm&&qm.prototype,Aw=qm,rw=ew,nw=Nm.TypeError,iw=Nm.document,sw=Nm.process,aw=Wm.f,ow=aw,lw=!!(iw&&iw.createEvent&&Nm.dispatchEvent),cw="unhandledrejection",uw=function(t){var e;return!(!Pm(t)||!Om(e=t.then))&&e},hw=function(t,e){var A,r,n,i=e.value,s=1===e.state,a=s?t.ok:t.fail,o=t.resolve,l=t.reject,c=t.domain;try{a?(s||(2===e.rejection&&mw(e),e.rejection=1),!0===a?A=i:(c&&c.enter(),A=a(i),c&&(c.exit(),n=!0)),A===t.promise?l(new nw("Promise-chain cycle")):(r=uw(A))?Lm(r,A,o,l):o(A)):l(i)}catch(t){c&&!n&&c.exit(),l(t)}},dw=function(t,e){t.notified||(t.notified=!0,Rm(function(){for(var A,r=t.reactions;A=r.get();)hw(A,t);t.notified=!1,e&&!t.rejection&&pw(t)}))},fw=function(t,e,A){var r,n;lw?((r=iw.createEvent("Event")).promise=e,r.reason=A,r.initEvent(t,!1,!0),Nm.dispatchEvent(r)):r={promise:e,reason:A},!Jm&&(n=Nm["on"+t])?n(r):t===cw&&Km("Unhandled promise rejection",A)},pw=function(t){Lm(jm,Nm,function(){var e,A=t.facade,r=t.value;if(gw(t)&&(e=Vm(function(){Em?sw.emit("unhandledRejection",r,A):fw(cw,A,r)}),t.rejection=Em||gw(t)?2:1,e.error))throw e.value})},gw=function(t){return 1!==t.rejection&&!t.parent},mw=function(t){Lm(jm,Nm,function(){var e=t.facade;Em?sw.emit("rejectionHandled",e):fw("rejectionhandled",e,t.value)})},ww=function(t,e,A){return function(r){t(e,r,A)}},Bw=function(t,e,A){t.done||(t.done=!0,A&&(t=A),t.value=e,t.state=2,dw(t,!0))},yw=function(t,e,A){if(!t.done){t.done=!0,A&&(t=A);try{if(t.facade===e)throw new nw("Promise can't be resolved itself");var r=uw(e);r?Rm(function(){var A={done:!1};try{Lm(r,e,ww(yw,A,t),ww(Bw,A,t))}catch(e){Bw(A,e,t)}}):(t.value=e,t.state=1,dw(t,!1))}catch(e){Bw({done:!1},e,t)}}};if(Ym&&(rw=(Aw=function(t){Dm(this,rw),Hm(t),Lm(Cm,this);var e=Zm(this);try{t(ww(yw,e),ww(Bw,e))}catch(t){Bw(e,t)}}).prototype,(Cm=function(t){tw(this,{type:Xm,done:!1,notified:!1,parent:!1,reactions:new zm,rejection:!1,state:0,value:null})}).prototype=Im(rw,"then",function(t,e){var A=Zm(this),r=aw(Mm(this,Aw));return A.parent=!0,r.ok=!Om(t)||t,r.fail=Om(e)&&e,r.domain=Em?sw.domain:void 0,0===A.state?A.reactions.add(r):Rm(function(){hw(r,A)}),r.promise}),xm=function(){var t=new Cm,e=Zm(t);this.promise=t,this.resolve=ww(yw,e),this.reject=ww(Bw,e)},Wm.f=aw=function(t){return t===Aw||t===Fm?new xm(t):ow(t)},Om(qm)&&ew!==Object.prototype)){Qm=ew.then,$m||Im(ew,"then",function(t,e){var A=this;return new Aw(function(t,e){Lm(Qm,A,t,e)}).then(t,e)},{unsafe:!0});try{delete ew.constructor}catch(t){}_m&&_m(ew,rw)}Um({global:!0,constructor:!0,wrap:!0,forced:Ym},{Promise:Aw}),Fm=Sm.Promise,km(Aw,Xm,!1),Tm(Xm);var bw={},vw=bw,Cw=Iu("iterator"),xw=Array.prototype,Fw=fp,Qw=Jc,Uw=oc,Ew=bw,Nw=Iu("iterator"),Sw=function(t){if(!Uw(t))return Qw(t,Nw)||Qw(t,"@@iterator")||Ew[Fw(t)]},Lw=Ml,Iw=Wc,_w=lh,kw=Vc,Tw=Sw,Hw=TypeError,Ow=Ml,Pw=lh,Dw=Jc,Mw=Jp,jw=Ml,Rw=lh,Kw=Vc,Vw=function(t){return void 0!==t&&(vw.Array===t||xw[Cw]===t)},zw=jd,Gw=vc,qw=function(t,e){var A=arguments.length<2?Tw(t):e;if(Iw(A))return _w(Lw(A,t));throw new Hw(kw(t)+" is not iterable")},Ww=Sw,Xw=function(t,e,A){var r,n;Pw(t);try{if(!(r=Dw(t,"return"))){if("throw"===e)throw A;return A}r=Ow(r,t)}catch(t){n=!0,r=t}if("throw"===e)throw A;if(n)throw r;return Pw(r),A},Yw=TypeError,Jw=function(t,e){this.stopped=t,this.result=e},$w=Jw.prototype,Zw=function(t,e,A){var r,n,i,s,a,o,l,c=A&&A.that,u=!(!A||!A.AS_ENTRIES),h=!(!A||!A.IS_RECORD),d=!(!A||!A.IS_ITERATOR),f=!(!A||!A.INTERRUPTED),p=Mw(e,c),g=function(t){return r&&Xw(r,"normal"),new Jw(!0,t)},m=function(t){return u?(Rw(t),f?p(t[0],t[1],g):p(t[0],t[1])):f?p(t,g):p(t)};if(h)r=t.iterator;else if(d)r=t;else{if(!(n=Ww(t)))throw new Yw(Kw(t)+" is not iterable");if(Vw(n)){for(i=0,s=zw(t);s>i;i++)if((a=m(t[i]))&&Gw($w,a))return a;return new Jw(!1)}r=qw(t,n)}for(o=h?t.next:r.next;!(l=jw(o,r)).done;){try{a=m(l.value)}catch(t){Xw(r,"throw",t)}if("object"==typeof a&&a&&Gw($w,a))return a}return new Jw(!1)},tB=Iu("iterator"),eB=!1;try{var AB=0,rB={next:function(){return{done:!!AB++}},return:function(){eB=!0}};rB[tB]=function(){return this},Array.from(rB,function(){throw 2})}catch(t){}var nB=im,iB=function(t,e){try{if(!e&&!eB)return!1}catch(t){return!1}var A=!1;try{var r={};r[tB]=function(){return{next:function(){return{done:A=!0}}}},t(r)}catch(t){}return A},sB=wm.CONSTRUCTOR||!iB(function(t){nB.all(t).then(void 0,function(){})}),aB=Ml,oB=Wc,lB=Bm,cB=nm,uB=Zw;Sf({target:"Promise",stat:!0,forced:sB},{all:function(t){var e=this,A=lB.f(e),r=A.resolve,n=A.reject,i=cB(function(){var A=oB(e.resolve),i=[],s=0,a=1;uB(t,function(t){var o=s++,l=!1;a++,aB(A,e,t).then(function(t){l||(l=!0,i[o]=t,--a||r(i))},n)}),--a||r(i)});return i.error&&n(i.value),A.promise}});var hB=Sf,dB=wm.CONSTRUCTOR,fB=im,pB=bc,gB=gc,mB=Ud,wB=fB&&fB.prototype;if(hB({target:"Promise",proto:!0,forced:dB,real:!0},{catch:function(t){return this.then(void 0,t)}}),gB(fB)){var BB=pB("Promise").prototype.catch;wB.catch!==BB&&mB(wB,"catch",BB,{unsafe:!0})}var yB=Ml,bB=Wc,vB=Bm,CB=nm,xB=Zw;Sf({target:"Promise",stat:!0,forced:sB},{race:function(t){var e=this,A=vB.f(e),r=A.reject,n=CB(function(){var n=bB(e.resolve);xB(t,function(t){yB(n,e,t).then(A.resolve,r)})});return n.error&&r(n.value),A.promise}});var FB=Bm;Sf({target:"Promise",stat:!0,forced:wm.CONSTRUCTOR},{reject:function(t){var e=FB.f(this);return(0,e.reject)(t),e.promise}});var QB=lh,UB=wc,EB=Bm,NB=Sf,SB=wm.CONSTRUCTOR,LB=function(t,e){if(QB(t),UB(e)&&e.constructor===t)return e;var A=EB.f(t);return(0,A.resolve)(e),A.promise};function IB(t,e,A,r,n,i,s){try{var a=t[i](s),o=a.value}catch(t){return void A(t)}a.done?e(o):Promise.resolve(o).then(r,n)}function _B(t){return function(){var e=this,A=arguments;return new Promise(function(r,n){var i=t.apply(e,A);function s(t){IB(i,r,n,s,a,"next",t)}function a(t){IB(i,r,n,s,a,"throw",t)}s(void 0)})}}bc("Promise"),NB({target:"Promise",stat:!0,forced:SB},{resolve:function(t){return LB(this,t)}});var kB=fp,TB=String,HB=function(t){if("Symbol"===kB(t))throw new TypeError("Cannot convert a Symbol value to a string");return TB(t)},OB=lh,PB=function(){var t=OB(this),e="";return t.hasIndices&&(e+="d"),t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.unicodeSets&&(e+="v"),t.sticky&&(e+="y"),e},DB=Tl,MB=_l.RegExp,jB=DB(function(){var t=MB("a","y");return t.lastIndex=2,null!==t.exec("abcd")}),RB=jB||DB(function(){return!MB("a","y").sticky}),KB=jB||DB(function(){var t=MB("^r","gy");return t.lastIndex=2,null!==t.exec("str")}),VB={BROKEN_CARET:KB,MISSED_STICKY:RB,UNSUPPORTED_Y:jB},zB={},GB=$d,qB=Zd,WB=Object.keys||function(t){return GB(t,qB)},XB=Hl,YB=ih,JB=nh,$B=lh,ZB=fc,ty=WB;zB.f=XB&&!YB?Object.defineProperties:function(t,e){$B(t);for(var A,r=ZB(e),n=ty(e),i=n.length,s=0;i>s;)JB.f(t,A=n[s++],r[A]);return t};var ey,Ay=lh,ry=zB,ny=Zd,iy=Vh,sy=$p,ay=Gu,oy="prototype",ly="script",cy=Kh("IE_PROTO"),uy=function(){},hy=function(t){return"<"+ly+">"+t+"</"+ly+">"},dy=function(t){t.write(hy("")),t.close();var e=t.parentWindow.Object;return t=null,e},fy=function(){try{ey=new ActiveXObject("htmlfile")}catch(t){}var t,e,A;fy="undefined"!=typeof document?document.domain&&ey?dy(ey):(e=ay("iframe"),A="java"+ly+":",e.style.display="none",sy.appendChild(e),e.src=String(A),(t=e.contentWindow.document).open(),t.write(hy("document.F=Object")),t.close(),t.F):dy(ey);for(var r=ny.length;r--;)delete fy[oy][ny[r]];return fy()};iy[cy]=!0;var py,gy,my=Object.create||function(t,e){var A;return null!==t?(uy[oy]=Ay(t),A=new uy,uy[oy]=null,A[cy]=t):A=fy(),void 0===e?A:ry.f(A,e)},wy=Tl,By=_l.RegExp,yy=wy(function(){var t=By(".","s");return!(t.dotAll&&t.test("\n")&&"s"===t.flags)}),by=Tl,vy=_l.RegExp,Cy=by(function(){var t=vy("(?<a>b)","g");return"b"!==t.exec("b").groups.a||"bc"!=="b".replace(t,"$<a>c")}),xy=Ml,Fy=$l,Qy=HB,Uy=PB,Ey=VB,Ny=my,Sy=nd.get,Ly=yy,Iy=Cy,_y=hu("native-string-replace",String.prototype.replace),ky=RegExp.prototype.exec,Ty=ky,Hy=Fy("".charAt),Oy=Fy("".indexOf),Py=Fy("".replace),Dy=Fy("".slice),My=(gy=/b*/g,xy(ky,py=/a/,"a"),xy(ky,gy,"a"),0!==py.lastIndex||0!==gy.lastIndex),jy=Ey.BROKEN_CARET,Ry=void 0!==/()??/.exec("")[1];(My||Ry||jy||Ly||Iy)&&(Ty=function(t){var e,A,r,n,i,s,a,o=this,l=Sy(o),c=Qy(t),u=l.raw;if(u)return u.lastIndex=o.lastIndex,e=xy(Ty,u,c),o.lastIndex=u.lastIndex,e;var h=l.groups,d=jy&&o.sticky,f=xy(Uy,o),p=o.source,g=0,m=c;if(d&&(f=Py(f,"y",""),-1===Oy(f,"g")&&(f+="g"),m=Dy(c,o.lastIndex),o.lastIndex>0&&(!o.multiline||o.multiline&&"\n"!==Hy(c,o.lastIndex-1))&&(p="(?: "+p+")",m=" "+m,g++),A=new RegExp("^(?:"+p+")",f)),Ry&&(A=new RegExp("^"+p+"$(?!\\s)",f)),My&&(r=o.lastIndex),n=xy(ky,d?A:o,m),d?n?(n.input=Dy(n.input,g),n[0]=Dy(n[0],g),n.index=o.lastIndex,o.lastIndex+=n[0].length):o.lastIndex=0:My&&n&&(o.lastIndex=o.global?n.index+n[0].length:r),Ry&&n&&n.length>1&&xy(_y,n[0],A,function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(n[i]=void 0)}),n&&h)for(n.groups=s=Ny(null),i=0;i<h.length;i++)s[(a=h[i])[0]]=n[a[1]];return n});var Ky=Ty;Sf({target:"RegExp",proto:!0,forced:/./.exec!==Ky},{exec:Ky});var Vy=Ml,zy=Ud,Gy=Ky,qy=Tl,Wy=Iu,Xy=Ch,Yy=Wy("species"),Jy=RegExp.prototype,$y=function(t,e,A,r){var n=Wy(t),i=!qy(function(){var e={};return e[n]=function(){return 7},7!==""[t](e)}),s=i&&!qy(function(){var e=!1,A=/a/;if("split"===t){var r={};r[Yy]=function(){return A},(A={constructor:r,flags:""})[n]=/./[n]}return A.exec=function(){return e=!0,null},A[n](""),!e});if(!i||!s||A){var a=/./[n],o=e(n,""[t],function(t,e,A,r,n){var s=e.exec;return s===Gy||s===Jy.exec?i&&!n?{done:!0,value:Vy(a,e,A,r)}:{done:!0,value:Vy(t,A,e,r)}:{done:!1}});zy(String.prototype,t,o[0]),zy(Jy,n,o[1])}r&&Xy(Jy[n],"sham",!0)},Zy=$l,tb=_d,eb=HB,Ab=uc,rb=Zy("".charAt),nb=Zy("".charCodeAt),ib=Zy("".slice),sb=function(t){return function(e,A){var r,n,i=eb(Ab(e)),s=tb(A),a=i.length;return s<0||s>=a?t?"":void 0:(r=nb(i,s))<55296||r>56319||s+1===a||(n=nb(i,s+1))<56320||n>57343?t?rb(i,s):r:t?ib(i,s,s+2):n-56320+(r-55296<<10)+65536}},ab={codeAt:sb(!1),charAt:sb(!0)}.charAt,ob=function(t,e,A){return e+(A?ab(t,e).length:1)},lb=Tl,cb=_l.RegExp,ub=!lb(function(){var t=!0;try{cb(".","d")}catch(e){t=!1}var e={},A="",r=t?"dgimsy":"gimsy",n=function(t,r){Object.defineProperty(e,t,{get:function(){return A+=r,!0}})},i={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var s in t&&(i.hasIndices="d"),i)n(s,i[s]);return Object.getOwnPropertyDescriptor(cb.prototype,"flags").get.call(e)!==r||A!==r}),hb=Ml,db=wu,fb=vc,pb={correct:ub},gb=PB,mb=RegExp.prototype,wb=pb.correct?function(t){return t.flags}:function(t){return pb.correct||!fb(mb,t)||db(t,"flags")?t.flags:hb(gb,t)},Bb=Ml,yb=lh,bb=gc,vb=Ac,Cb=Ky,xb=TypeError,Fb=function(t,e){var A=t.exec;if(bb(A)){var r=Bb(A,t,e);return null!==r&&yb(r),r}if("RegExp"===vb(t))return Bb(Cb,t,e);throw new xb("RegExp#exec called on incompatible receiver")},Qb=Ml,Ub=$y,Eb=lh,Nb=wc,Sb=Dd,Lb=HB,Ib=uc,_b=Jc,kb=ob,Tb=wb,Hb=Fb,Ob=$l("".indexOf);Ub("match",function(t,e,A){return[function(e){var A=Ib(this),r=Nb(e)?_b(e,t):void 0;return r?Qb(r,e,A):new RegExp(e)[t](Lb(A))},function(t){var r=Eb(this),n=Lb(t),i=A(e,r,n);if(i.done)return i.value;var s=Lb(Tb(r));if(-1===Ob(s,"g"))return Hb(r,n);var a=-1!==Ob(s,"u");r.lastIndex=0;for(var o,l=[],c=0;null!==(o=Hb(r,n));){var u=Lb(o[0]);l[c]=u,""===u&&(r.lastIndex=kb(n,Sb(r.lastIndex),a)),c++}return 0===c?null:l}]});var Pb=$l,Db=pu,Mb=Math.floor,jb=Pb("".charAt),Rb=Pb("".replace),Kb=Pb("".slice),Vb=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,zb=/\$([$&'`]|\d{1,2})/g,Gb=Vp,qb=Ml,Wb=$l,Xb=$y,Yb=Tl,Jb=lh,$b=gc,Zb=wc,tv=_d,ev=Dd,Av=HB,rv=uc,nv=ob,iv=Jc,sv=function(t,e,A,r,n,i){var s=A+t.length,a=r.length,o=zb;return void 0!==n&&(n=Db(n),o=Vb),Rb(i,o,function(i,o){var l;switch(jb(o,0)){case"$":return"$";case"&":return t;case"`":return Kb(e,0,A);case"'":return Kb(e,s);case"<":l=n[Kb(o,1,-1)];break;default:var c=+o;if(0===c)return i;if(c>a){var u=Mb(c/10);return 0===u?i:u<=a?void 0===r[u-1]?jb(o,1):r[u-1]+jb(o,1):i}l=r[c-1]}return void 0===l?"":l})},av=wb,ov=Fb,lv=Iu("replace"),cv=Math.max,uv=Math.min,hv=Wb([].concat),dv=Wb([].push),fv=Wb("".indexOf),pv=Wb("".slice),gv=function(t){return void 0===t?t:String(t)},mv="$0"==="a".replace(/./,"$0"),wv=!!/./[lv]&&""===/./[lv]("a","$0"),Bv=!Yb(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")});Xb("replace",function(t,e,A){var r=wv?"$":"$0";return[function(t,A){var r=rv(this),n=Zb(t)?iv(t,lv):void 0;return n?qb(n,t,r,A):qb(e,Av(r),t,A)},function(t,n){var i=Jb(this),s=Av(t);if("string"==typeof n&&-1===fv(n,r)&&-1===fv(n,"$<")){var a=A(e,i,s,n);if(a.done)return a.value}var o=$b(n);o||(n=Av(n));var l,c=Av(av(i)),u=-1!==fv(c,"g");u&&(l=-1!==fv(c,"u"),i.lastIndex=0);for(var h,d=[];null!==(h=ov(i,s))&&(dv(d,h),u);){""===Av(h[0])&&(i.lastIndex=nv(s,ev(i.lastIndex),l))}for(var f="",p=0,g=0;g<d.length;g++){for(var m,w=Av((h=d[g])[0]),B=cv(uv(tv(h.index),s.length),0),y=[],b=1;b<h.length;b++)dv(y,gv(h[b]));var v=h.groups;if(o){var C=hv([w],y,B,s);void 0!==v&&dv(C,v),m=Av(Gb(n,void 0,C))}else m=sv(w,s,B,y,v,n);B>=p&&(f+=pv(s,p,B)+m,p=B+w.length)}return f+pv(s,p)}]},!Bv||!mv||wv);var yv,bv=wc,vv=Ac,Cv=Iu("match"),xv=function(t){var e;return bv(t)&&(void 0!==(e=t[Cv])?!!e:"RegExp"===vv(t))},Fv=TypeError,Qv=function(t){if(xv(t))throw new Fv("The method doesn't accept regular expressions");return t},Uv=Iu("match"),Ev=function(t){var e=/./;try{"/./"[t](e)}catch(A){try{return e[Uv]=!1,"/./"[t](e)}catch(t){}}return!1},Nv=Sf,Sv=qp,Lv=kl.f,Iv=Dd,_v=HB,kv=Qv,Tv=uc,Hv=Ev,Ov=Sv("".slice),Pv=Math.min,Dv=Hv("startsWith");Nv({target:"String",proto:!0,forced:!!(Dv||(yv=Lv(String.prototype,"startsWith"),!yv||yv.writable))&&!Dv},{startsWith:function(t){var e=_v(Tv(this));kv(t);var A=Iv(Pv(arguments.length>1?arguments[1]:void 0,e.length)),r=_v(t);return Ov(e,A,A+r.length)===r}});var Mv=Iu,jv=my,Rv=nh.f,Kv=Mv("unscopables"),Vv=Array.prototype;void 0===Vv[Kv]&&Rv(Vv,Kv,{configurable:!0,value:jv(null)});var zv,Gv,qv,Wv=!Tl(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}),Xv=wu,Yv=gc,Jv=pu,$v=Wv,Zv=Kh("IE_PROTO"),tC=Object,eC=tC.prototype,AC=$v?tC.getPrototypeOf:function(t){var e=Jv(t);if(Xv(e,Zv))return e[Zv];var A=e.constructor;return Yv(A)&&e instanceof A?A.prototype:e instanceof tC?eC:null},rC=Tl,nC=gc,iC=wc,sC=AC,aC=Ud,oC=Iu("iterator"),lC=!1;[].keys&&("next"in(qv=[].keys())?(Gv=sC(sC(qv)))!==Object.prototype&&(zv=Gv):lC=!0);var cC=!iC(zv)||rC(function(){var t={};return zv[oC].call(t)!==t});cC&&(zv={}),nC(zv[oC])||aC(zv,oC,function(){return this});var uC={IteratorPrototype:zv,BUGGY_SAFARI_ITERATORS:lC},hC=uC.IteratorPrototype,dC=my,fC=ql,pC=$f,gC=bw,mC=function(){return this},wC=Sf,BC=Ml,yC=gc,bC=function(t,e,A,r){var n=e+" Iterator";return t.prototype=dC(hC,{next:fC(+!r,A)}),pC(t,n,!1),gC[n]=mC,t},vC=AC,CC=Wf,xC=$f,FC=Ch,QC=Ud,UC=bw,EC=Sh.PROPER,NC=Sh.CONFIGURABLE,SC=uC.IteratorPrototype,LC=uC.BUGGY_SAFARI_ITERATORS,IC=Iu("iterator"),_C="keys",kC="values",TC="entries",HC=function(){return this},OC=fc,PC=function(t){Vv[Kv][t]=!0},DC=bw,MC=nd,jC=nh.f,RC=function(t,e,A,r,n,i,s){bC(A,e,r);var a,o,l,c=function(t){if(t===n&&p)return p;if(!LC&&t&&t in d)return d[t];switch(t){case _C:case kC:case TC:return function(){return new A(this,t)}}return function(){return new A(this)}},u=e+" Iterator",h=!1,d=t.prototype,f=d[IC]||d["@@iterator"]||n&&d[n],p=!LC&&f||c(n),g="Array"===e&&d.entries||f;if(g&&(a=vC(g.call(new t)))!==Object.prototype&&a.next&&(vC(a)!==SC&&(CC?CC(a,SC):yC(a[IC])||QC(a,IC,HC)),xC(a,u,!0)),EC&&n===kC&&f&&f.name!==kC&&(NC?FC(d,"name",kC):(h=!0,p=function(){return BC(f,this)})),n)if(o={values:c(kC),keys:i?p:c(_C),entries:c(TC)},s)for(l in o)(LC||h||!(l in d))&&QC(d,l,o[l]);else wC({target:e,proto:!0,forced:LC||h},o);return d[IC]!==p&&QC(d,IC,p,{name:n}),UC[e]=p,o},KC=function(t,e){return{value:t,done:e}},VC=Hl,zC="Array Iterator",GC=MC.set,qC=MC.getterFor(zC),WC=RC(Array,"Array",function(t,e){GC(this,{type:zC,target:OC(t),index:0,kind:e})},function(){var t=qC(this),e=t.target,A=t.index++;if(!e||A>=e.length)return t.target=null,KC(void 0,!0);switch(t.kind){case"keys":return KC(A,!1);case"values":return KC(e[A],!1)}return KC([A,e[A]],!1)},"values"),XC=DC.Arguments=DC.Array;if(PC("keys"),PC("values"),PC("entries"),VC&&"values"!==XC.name)try{jC(XC,"name",{value:"values"})}catch(t){}var YC=Gu("span").classList,JC=YC&&YC.constructor&&YC.constructor.prototype,$C=JC===Object.prototype?void 0:JC,ZC=_l,tx={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},ex=$C,Ax=WC,rx=Ch,nx=$f,ix=Iu("iterator"),sx=Ax.values,ax=function(t,e){if(t){if(t[ix]!==sx)try{rx(t,ix,sx)}catch(e){t[ix]=sx}if(nx(t,e,!0),tx[e])for(var A in Ax)if(t[A]!==Ax[A])try{rx(t,A,Ax[A])}catch(e){t[A]=Ax[A]}}};for(var ox in tx)ax(ZC[ox]&&ZC[ox].prototype,ox);function lx(t){var e=function(t,e){if("object"!=Jt(t)||!t)return t;var A=t[Symbol.toPrimitive];if(void 0!==A){var r=A.call(t,e||"default");if("object"!=Jt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Jt(e)?e:e+""}function cx(t,e,A){return(e=lx(e))in t?Object.defineProperty(t,e,{value:A,enumerable:!0,configurable:!0,writable:!0}):t[e]=A,t}ax(ex,"DOMTokenList");var ux=Wc,hx=pu,dx=ac,fx=jd,px=TypeError,gx="Reduce of empty array with no initial value",mx=function(t){return function(e,A,r,n){var i=hx(e),s=dx(i),a=fx(i);if(ux(A),0===a&&r<2)throw new px(gx);var o=t?a-1:0,l=t?-1:1;if(r<2)for(;;){if(o in s){n=s[o],o+=l;break}if(o+=l,t?o<0:a<=o)throw new px(gx)}for(;t?o>=0:a>o;o+=l)o in s&&(n=A(n,s[o],o,i));return n}},wx={left:mx(!1),right:mx(!0)},Bx=Tl,yx=function(t,e){var A=[][t];return!!A&&Bx(function(){A.call(null,e||function(){return 1},1)})},bx=wx.left;Sf({target:"Array",proto:!0,forced:!Hf&&Ic>79&&Ic<83||!yx("reduce")},{reduce:function(t){var e=arguments.length;return bx(this,t,e,e>1?arguments[1]:void 0)}});var vx=Sf,Cx=qp,xx=kl.f,Fx=Dd,Qx=HB,Ux=Qv,Ex=uc,Nx=Ev,Sx=Cx("".slice),Lx=Math.min,Ix=Nx("endsWith"),_x=!Ix&&!!function(){var t=xx(String.prototype,"endsWith");return t&&!t.writable}();vx({target:"String",proto:!0,forced:!_x&&!Ix},{endsWith:function(t){var e=Qx(Ex(this));Ux(t);var A=arguments.length>1?arguments[1]:void 0,r=e.length,n=void 0===A?r:Lx(Fx(A),r),i=Qx(t);return Sx(e,n-i.length,n)===i}});var kx=Ml,Tx=$l,Hx=$y,Ox=lh,Px=wc,Dx=uc,Mx=Dp,jx=ob,Rx=Dd,Kx=HB,Vx=Jc,zx=Fb,Gx=Tl,qx=VB.UNSUPPORTED_Y,Wx=Math.min,Xx=Tx([].push),Yx=Tx("".slice),Jx=!Gx(function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var A="ab".split(t);return 2!==A.length||"a"!==A[0]||"b"!==A[1]}),$x="c"==="abbc".split(/(b)*/)[1]||4!=="test".split(/(?:)/,-1).length||2!=="ab".split(/(?:ab)*/).length||4!==".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length;Hx("split",function(t,e,A){var r="0".split(void 0,0).length?function(t,A){return void 0===t&&0===A?[]:kx(e,this,t,A)}:e;return[function(e,A){var n=Dx(this),i=Px(e)?Vx(e,t):void 0;return i?kx(i,e,n,A):kx(r,Kx(n),e,A)},function(t,n){var i=Ox(this),s=Kx(t);if(!$x){var a=A(r,i,s,n,r!==e);if(a.done)return a.value}var o=Mx(i,RegExp),l=i.unicode,c=(i.ignoreCase?"i":"")+(i.multiline?"m":"")+(i.unicode?"u":"")+(qx?"g":"y"),u=new o(qx?"^(?:"+i.source+")":i,c),h=void 0===n?4294967295:n>>>0;if(0===h)return[];if(0===s.length)return null===zx(u,s)?[s]:[];for(var d=0,f=0,p=[];f<s.length;){u.lastIndex=qx?0:f;var g,m=zx(u,qx?Yx(s,f):s);if(null===m||(g=Wx(Rx(u.lastIndex+(qx?f:0)),s.length))===d)f=jx(s,f,l);else{if(Xx(p,Yx(s,d,f)),p.length===h)return p;for(var w=1;w<=m.length-1;w++)if(Xx(p,m[w]),p.length===h)return p;f=d=g}}return Xx(p,Yx(s,d)),p}]},$x||!Jx,qx);var Zx={exports:{}},tF={exports:{}};(function(){var t,e,A,r,n,i;"undefined"!=typeof performance&&null!==performance&&performance.now?tF.exports=function(){return performance.now()}:"undefined"!=typeof process&&null!==process&&process.hrtime?(tF.exports=function(){return(t()-n)/1e6},e=process.hrtime,r=(t=function(){var t;return 1e9*(t=e())[0]+t[1]})(),i=1e9*process.uptime(),n=r-i):Date.now?(tF.exports=function(){return Date.now()-A},A=Date.now()):(tF.exports=function(){return(new Date).getTime()-A},A=(new Date).getTime())}).call(R);for(var eF=tF.exports,AF="undefined"==typeof window?R:window,rF=["moz","webkit"],nF="AnimationFrame",iF=AF["request"+nF],sF=AF["cancel"+nF]||AF["cancelRequest"+nF],aF=0;!iF&&aF<rF.length;aF++)iF=AF[rF[aF]+"Request"+nF],sF=AF[rF[aF]+"Cancel"+nF]||AF[rF[aF]+"CancelRequest"+nF];if(!iF||!sF){var oF=0,lF=0,cF=[],uF=1e3/60;iF=function(t){if(0===cF.length){var e=eF(),A=Math.max(0,uF-(e-oF));oF=A+e,setTimeout(function(){var t=cF.slice(0);cF.length=0;for(var e=0;e<t.length;e++)if(!t[e].cancelled)try{t[e].callback(oF)}catch(t){setTimeout(function(){throw t},0)}},Math.round(A))}return cF.push({handle:++lF,callback:t,cancelled:!1}),lF},sF=function(t){for(var e=0;e<cF.length;e++)cF[e].handle===t&&(cF[e].cancelled=!0)}}Zx.exports=function(t){return iF.call(AF,t)},Zx.exports.cancel=function(){sF.apply(AF,arguments)},Zx.exports.polyfill=function(t){t||(t=AF),t.requestAnimationFrame=iF,t.cancelAnimationFrame=sF};var hF=K(Zx.exports),dF="\t\n\v\f\r                 \u2028\u2029\ufeff",fF=uc,pF=HB,gF=dF,mF=$l("".replace),wF=RegExp("^["+gF+"]+"),BF=RegExp("(^|[^"+gF+"])["+gF+"]+$"),yF=function(t){return function(e){var A=pF(fF(e));return 1&t&&(A=mF(A,wF,"")),2&t&&(A=mF(A,BF,"$1")),A}},bF={start:yF(1),end:yF(2),trim:yF(3)},vF=Sh.PROPER,CF=Tl,xF=dF,FF=bF.trim;Sf({target:"String",proto:!0,forced:function(t){return CF(function(){return!!xF[t]()||"​…᠎"!=="​…᠎"[t]()||vF&&xF[t].name!==t})}("trim")},{trim:function(){return FF(this)}});var QF=function(t){this.ok=!1,this.alpha=1,"#"==t.charAt(0)&&(t=t.substr(1,6)),t=(t=t.replace(/ /g,"")).toLowerCase();var e={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};t=e[t]||t;for(var A=[{re:/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*((?:\d?\.)?\d)\)$/,example:["rgba(123, 234, 45, 0.8)","rgba(255,234,245,1.0)"],process:function(t){return[parseInt(t[1]),parseInt(t[2]),parseInt(t[3]),parseFloat(t[4])]}},{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(t){return[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]}},{re:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,example:["#00ff00","336699"],process:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,example:["#fb0","f0f"],process:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}}],r=0;r<A.length;r++){var n=A[r].re,i=A[r].process,s=n.exec(t);if(s){var a=i(s);this.r=a[0],this.g=a[1],this.b=a[2],a.length>3&&(this.alpha=a[3]),this.ok=!0}}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.alpha=this.alpha<0?0:this.alpha>1||isNaN(this.alpha)?1:this.alpha,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toRGBA=function(){return"rgba("+this.r+", "+this.g+", "+this.b+", "+this.alpha+")"},this.toHex=function(){var t=this.r.toString(16),e=this.g.toString(16),A=this.b.toString(16);return 1==t.length&&(t="0"+t),1==e.length&&(e="0"+e),1==A.length&&(A="0"+A),"#"+t+e+A},this.getHelpXML=function(){for(var t=new Array,r=0;r<A.length;r++)for(var n=A[r].example,i=0;i<n.length;i++)t[t.length]=n[i];for(var s in e)t[t.length]=s;var a=document.createElement("ul");a.setAttribute("id","rgbcolor-examples");for(r=0;r<t.length;r++)try{var o=document.createElement("li"),l=new RGBColor(t[r]),c=document.createElement("div");c.style.cssText="margin: 3px; border: 1px solid black; background:"+l.toHex()+"; color:"+l.toHex(),c.appendChild(document.createTextNode("test"));var u=document.createTextNode(" "+t[r]+" -> "+l.toRGB()+" -> "+l.toHex());o.appendChild(c),o.appendChild(u),a.appendChild(o)}catch(t){}return a}},UF=K(QF),EF=Sf,NF=Gd.indexOf,SF=yx,LF=qp([].indexOf),IF=!!LF&&1/LF([1],1,-0)<0;EF({target:"Array",proto:!0,forced:IF||!SF("indexOf")},{indexOf:function(t){var e=arguments.length>1?arguments[1]:void 0;return IF?LF(this,t,e)||0:NF(this,t,e)}});var _F=Sf,kF=Qv,TF=uc,HF=HB,OF=Ev,PF=$l("".indexOf);_F({target:"String",proto:!0,forced:!OF("includes")},{includes:function(t){return!!~PF(HF(TF(this)),HF(kF(t)),arguments.length>1?arguments[1]:void 0)}});var DF=Ac,MF=Sf,jF=Array.isArray||function(t){return"Array"===DF(t)},RF=$l([].reverse),KF=[1,2];MF({target:"Array",proto:!0,forced:String(KF)===String(KF.reverse())},{reverse:function(){return jF(this)&&(this.length=this.length),RF(this)}});
310
310
  /*! *****************************************************************************
311
311
  Copyright (c) Microsoft Corporation.
312
312