@unvired/turboforms-embed-sdk 2.0.81 → 2.0.83

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.
@@ -30017,8 +30017,8 @@ span.flatpickr-weekday {
30017
30017
  border-color: var(--tf-primary-color) !important;
30018
30018
  box-shadow: 0 0 0 1px rgba(9, 95, 23, 0.1) !important;
30019
30019
  }</style>
30020
- <style>.tf-embed-sdk .btn:not(.formio-button-remove-row):not(.choices__button):not(.footer-btn),
30021
- .tf-embed-sdk button:not(.formio-button-remove-row):not(.choices__button):not(.footer-btn) {
30020
+ <style>.tf-embed-sdk .btn:not(.formio-button-remove-row):not(.choices__button):not(.footer-btn):not(.tf-tabs-toggle):not(.tf-vertical-tabs-toggle):not(.tf-tabs-scroll-btn),
30021
+ .tf-embed-sdk button:not(.formio-button-remove-row):not(.choices__button):not(.footer-btn):not(.tf-tabs-toggle):not(.tf-vertical-tabs-toggle):not(.tf-tabs-scroll-btn) {
30022
30022
  font-family: var(--tf-app-font-family) !important;
30023
30023
  font-weight: 400 !important;
30024
30024
  background-color: var(--tf-primary-color) !important;
@@ -30027,8 +30027,8 @@ span.flatpickr-weekday {
30027
30027
  border-radius: 8px !important;
30028
30028
  font-size: var(--tf-app-font-size-base);
30029
30029
  }
30030
- .tf-embed-sdk .btn:hover:not(.formio-button-remove-row):not(.choices__button):not(.footer-btn),
30031
- .tf-embed-sdk button:hover:not(.formio-button-remove-row):not(.choices__button):not(.footer-btn) {
30030
+ .tf-embed-sdk .btn:hover:not(.formio-button-remove-row):not(.choices__button):not(.footer-btn):not(.tf-tabs-toggle):not(.tf-vertical-tabs-toggle):not(.tf-tabs-scroll-btn),
30031
+ .tf-embed-sdk button:hover:not(.formio-button-remove-row):not(.choices__button):not(.footer-btn):not(.tf-tabs-toggle):not(.tf-vertical-tabs-toggle):not(.tf-tabs-scroll-btn) {
30032
30032
  filter: brightness(1.1) !important;
30033
30033
  }
30034
30034
  .tf-embed-sdk .formio-button-remove-row {
@@ -30292,12 +30292,12 @@ span.flatpickr-weekday {
30292
30292
  }
30293
30293
  }
30294
30294
  .tf-embed-sdk .formio-component-columns label:not(.custom-control-label):not(.table label) {
30295
- display: inline-flex !important;
30296
- align-items: center !important;
30297
- max-width: 100% !important;
30298
- overflow: visible !important;
30295
+ display: inline-block !important;
30296
+ max-width: calc(100% - 16px) !important;
30297
+ overflow: hidden !important;
30299
30298
  text-overflow: ellipsis !important;
30300
30299
  white-space: nowrap !important;
30300
+ vertical-align: middle !important;
30301
30301
  }
30302
30302
  .tf-embed-sdk .formio-component-columns label [ref=tooltip] {
30303
30303
  flex-shrink: 0 !important;
@@ -30686,10 +30686,17 @@ span.flatpickr-weekday {
30686
30686
  background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
30687
30687
  background: transparent !important;
30688
30688
  color: #64748b !important;
30689
- display: flex !important;
30690
- align-items: center !important;
30691
- line-height: normal !important;
30689
+ font-size: var(--tf-app-font-size-base) !important;
30690
+ display: inline-block !important;
30691
+ max-width: calc(100% - 24px) !important;
30692
+ overflow: hidden !important;
30693
+ text-overflow: ellipsis !important;
30692
30694
  white-space: nowrap !important;
30695
+ line-height: normal !important;
30696
+ }
30697
+ .tf-embed-sdk .formio-component-select > .col-form-label,
30698
+ .tf-embed-sdk .formio-component-barcodeselect > .col-form-label {
30699
+ max-width: calc(100% - 36px) !important;
30693
30700
  }
30694
30701
  .tf-embed-sdk .col-form-label [ref=tooltip],
30695
30702
  .tf-embed-sdk .col-form-label .bi-question-circle,
@@ -30763,7 +30770,6 @@ span.flatpickr-weekday {
30763
30770
  .tf-embed-sdk .formio-component-tags .form-control,
30764
30771
  .tf-embed-sdk .formio-component-barcodeselect .form-control {
30765
30772
  min-height: 2.6rem !important;
30766
- padding-bottom: 0px !important;
30767
30773
  }
30768
30774
  .tf-embed-sdk .formio-component-textarea .form-control,
30769
30775
  .tf-embed-sdk .formio-component-textArea .form-control {
@@ -30930,7 +30936,7 @@ span.flatpickr-weekday {
30930
30936
  top: -8px !important;
30931
30937
  left: 12px !important;
30932
30938
  transform: translateY(0) !important;
30933
- font-size: calc(var(--tf-app-font-size-base) * 0.85) !important;
30939
+ font-size: var(--tf-app-font-size-base) !important;
30934
30940
  font-weight: 600 !important;
30935
30941
  color: var(--tf-text-override, var(--tf-app-floating-label-color)) !important;
30936
30942
  background: #ffffff !important;
@@ -30984,15 +30990,19 @@ span.flatpickr-weekday {
30984
30990
  .tf-embed-sdk .formio-component-select label:has(~ div .choices__list--single .choices__item:not(.choices__placeholder):not(:empty)),
30985
30991
  .tf-embed-sdk .formio-component-select:not(:has(.choices)):has(select option:checked:not([value=""]):not([value=" "])) > .col-form-label,
30986
30992
  .tf-embed-sdk .formio-component-select:not(:has(.choices)):has(select option:checked:not([value=""]):not([value=" "])) label {
30987
- top: -10px !important;
30993
+ top: -8px !important;
30988
30994
  left: 12px !important;
30989
30995
  transform: translateY(0) !important;
30990
- font-size: calc(var(--tf-app-font-size-base) * 0.85) !important;
30996
+ font-size: var(--tf-app-font-size-base) !important;
30991
30997
  font-weight: 600 !important;
30992
30998
  color: var(--tf-text-override, var(--tf-app-label-color)) !important;
30993
30999
  background: #ffffff !important;
30994
31000
  padding: 0 6px !important;
30995
31001
  z-index: 20 !important;
31002
+ max-width: calc(100% - 24px) !important;
31003
+ overflow: hidden !important;
31004
+ text-overflow: ellipsis !important;
31005
+ white-space: nowrap !important;
30996
31006
  }
30997
31007
  .tf-embed-sdk .formio-component-textfield:focus-within > .col-form-label,
30998
31008
  .tf-embed-sdk .formio-component-smartId:focus-within > .col-form-label,
@@ -31142,6 +31152,40 @@ span.flatpickr-weekday {
31142
31152
  .tf-embed-sdk.formio-dialog.formio-dialog-closing .col-form-label {
31143
31153
  opacity: 0 !important;
31144
31154
  transition: none !important;
31155
+ }
31156
+ @media (max-width: 480px) {
31157
+ .tf-embed-sdk .col-form-label {
31158
+ max-width: calc(100% - 20px) !important;
31159
+ }
31160
+ }
31161
+ @media (max-width: 360px) {
31162
+ .tf-embed-sdk .col-form-label {
31163
+ left: 8px !important;
31164
+ max-width: calc(100% - 16px) !important;
31165
+ }
31166
+ .tf-embed-sdk .formio-component-textfield > .col-form-label,
31167
+ .tf-embed-sdk .formio-component-smartId > .col-form-label,
31168
+ .tf-embed-sdk .formio-component-email > .col-form-label,
31169
+ .tf-embed-sdk .formio-component-password > .col-form-label,
31170
+ .tf-embed-sdk .formio-component-number > .col-form-label,
31171
+ .tf-embed-sdk .formio-component-phoneNumber > .col-form-label,
31172
+ .tf-embed-sdk .formio-component-textarea > .col-form-label,
31173
+ .tf-embed-sdk .formio-component-datetime > .col-form-label,
31174
+ .tf-embed-sdk .formio-component-dateTime > .col-form-label,
31175
+ .tf-embed-sdk .formio-component-time > .col-form-label,
31176
+ .tf-embed-sdk .formio-component-day > .col-form-label,
31177
+ .tf-embed-sdk .formio-component-currency > .col-form-label,
31178
+ .tf-embed-sdk .formio-component-select > .col-form-label,
31179
+ .tf-embed-sdk .formio-component-tags > .col-form-label,
31180
+ .tf-embed-sdk .formio-component-barcodeselect > .col-form-label,
31181
+ .tf-embed-sdk .formio-component-address > .col-form-label,
31182
+ .tf-embed-sdk .formio-component-location > .col-form-label,
31183
+ .tf-embed-sdk .formio-component-barcode .col-form-label,
31184
+ .tf-embed-sdk .formio-component-barcodeselect .col-form-label,
31185
+ .tf-embed-sdk .formio-component-url .col-form-label,
31186
+ .tf-embed-sdk .formio-component-website .col-form-label {
31187
+ left: 8px !important;
31188
+ }
31145
31189
  }</style>
31146
31190
  <style>.tf-embed-sdk.formio-form,
31147
31191
  .tf-embed-sdk .formio-form,
@@ -31944,7 +31988,7 @@ span.flatpickr-weekday {
31944
31988
  padding: 0.8rem !important;
31945
31989
  width: 100% !important;
31946
31990
  }
31947
- .tf-embed-sdk .formio-component-datagrid td[data-label]::before {
31991
+ .tf-embed-sdk .formio-component-datagrid td[data-label]:not([data-label=""]):not(:has(.tf-datagrid-mobile-label))::before {
31948
31992
  content: attr(data-label);
31949
31993
  display: block;
31950
31994
  font-family: var(--tf-app-font-family) !important;
@@ -31954,6 +31998,34 @@ span.flatpickr-weekday {
31954
31998
  color: var(--tf-app-font-color, #333);
31955
31999
  text-align: left;
31956
32000
  }
32001
+ .tf-embed-sdk .formio-component-datagrid td[data-label=""]::before,
32002
+ .tf-embed-sdk .formio-component-datagrid td:has([ref=removeRow])::before,
32003
+ .tf-embed-sdk .formio-component-datagrid td:has(.formio-button-remove-row)::before,
32004
+ .tf-embed-sdk .formio-component-datagrid td:has(.tf-datagrid-mobile-label)::before {
32005
+ display: none !important;
32006
+ content: none !important;
32007
+ }
32008
+ .tf-embed-sdk .formio-component-datagrid .tf-datagrid-mobile-label,
32009
+ .tf-embed-sdk .formio-component-datagrid table.datagrid-table > tbody > tr > td .tf-datagrid-mobile-label,
32010
+ .tf-embed-sdk .formio-component-datagrid table.datagrid-table > tbody > tr > td > .formio-component > label:not(.form-check-label):not(.custom-control-label),
32011
+ .tf-embed-sdk .formio-component-datagrid table.datagrid-table > tbody > tr > td > .formio-component > .col-form-label:not(.form-check-label),
32012
+ .tf-embed-sdk .formio-component-datagrid table.datagrid-table > tbody > tr > td > .formio-component > [ref=label]:not(.form-check-label),
32013
+ .tf-embed-sdk .formio-component-datagrid table.datagrid-table > tbody > tr > td > .formio-form-group > label:not(.form-check-label):not(.custom-control-label),
32014
+ .tf-embed-sdk .formio-component-datagrid table.datagrid-table > tbody > tr > td > .formio-form-group > .col-form-label:not(.form-check-label),
32015
+ .tf-embed-sdk .formio-component-datagrid table.datagrid-table > tbody > tr > td > .formio-form-group > [ref=label]:not(.form-check-label) {
32016
+ display: block !important;
32017
+ visibility: visible !important;
32018
+ position: static !important;
32019
+ transform: none !important;
32020
+ font-family: var(--tf-app-font-family) !important;
32021
+ font-weight: 600 !important;
32022
+ font-size: var(--tf-app-font-size-base) !important;
32023
+ color: var(--tf-app-font-color, #333) !important;
32024
+ margin-bottom: 0.25rem !important;
32025
+ height: auto !important;
32026
+ min-height: auto !important;
32027
+ line-height: var(--tf-app-line-height, 1.4) !important;
32028
+ }
31957
32029
  }
31958
32030
  .tf-embed-sdk .formio-component-datagrid .row [class*=col-] {
31959
32031
  min-width: 60px !important;
@@ -31963,23 +32035,31 @@ span.flatpickr-weekday {
31963
32035
  .tf-embed-sdk .formio-component-datagrid .row [class*=col-]:has(.formio-component-select) {
31964
32036
  min-width: 50px !important;
31965
32037
  }
31966
- .tf-embed-sdk .formio-component-datagrid table.datagrid-table > tbody > tr > td > .formio-component > label:not(.form-check-label):not(.custom-control-label),
31967
- .tf-embed-sdk .formio-component-datagrid table.datagrid-table > tbody > tr > td > .formio-component > .col-form-label,
31968
- .tf-embed-sdk .formio-component-datagrid table.datagrid-table > tbody > tr > td > .formio-component > [ref=label],
31969
- .tf-embed-sdk .formio-component-datagrid table.datagrid-table > tbody > tr > td > .formio-component > .control-label--hidden,
31970
- .tf-embed-sdk .formio-component-datagrid table.datagrid-table > tbody > tr > td > .formio-form-group > label:not(.form-check-label):not(.custom-control-label),
31971
- .tf-embed-sdk .formio-component-datagrid table.datagrid-table > tbody > tr > td > .formio-form-group > .col-form-label,
31972
- .tf-embed-sdk .formio-component-datagrid table.datagrid-table > tbody > tr > td > .formio-form-group > [ref=label],
31973
- .tf-embed-sdk .formio-component-datagrid table.datagrid-table > tbody > tr > td > .formio-form-group > .control-label--hidden {
31974
- display: none !important;
31975
- margin: 0 !important;
31976
- padding: 0 !important;
31977
- height: 0 !important;
31978
- min-height: 0 !important;
31979
- line-height: 0 !important;
31980
- font-size: 0 !important;
31981
- border: none !important;
31982
- visibility: hidden !important;
32038
+ @media (min-width: 769px) {
32039
+ .tf-embed-sdk .formio-component-datagrid .tf-datagrid-mobile-label,
32040
+ .tf-embed-sdk .formio-component-datagrid table.datagrid-table > tbody > tr > td .tf-datagrid-mobile-label,
32041
+ .tf-embed-sdk .formio-component-datagrid table.datagrid-table > tbody > tr > td > .formio-component > label:not(.form-check-label):not(.custom-control-label),
32042
+ .tf-embed-sdk .formio-component-datagrid table.datagrid-table > tbody > tr > td > .formio-component > .col-form-label,
32043
+ .tf-embed-sdk .formio-component-datagrid table.datagrid-table > tbody > tr > td > .formio-component > [ref=label],
32044
+ .tf-embed-sdk .formio-component-datagrid table.datagrid-table > tbody > tr > td > .formio-component > .control-label--hidden,
32045
+ .tf-embed-sdk .formio-component-datagrid table.datagrid-table > tbody > tr > td > .formio-form-group > label:not(.form-check-label):not(.custom-control-label),
32046
+ .tf-embed-sdk .formio-component-datagrid table.datagrid-table > tbody > tr > td > .formio-form-group > .col-form-label,
32047
+ .tf-embed-sdk .formio-component-datagrid table.datagrid-table > tbody > tr > td > .formio-form-group > [ref=label],
32048
+ .tf-embed-sdk .formio-component-datagrid table.datagrid-table > tbody > tr > td > .formio-form-group > .control-label--hidden {
32049
+ display: none !important;
32050
+ margin: 0 !important;
32051
+ padding: 0 !important;
32052
+ height: 0 !important;
32053
+ min-height: 0 !important;
32054
+ line-height: 0 !important;
32055
+ font-size: 0 !important;
32056
+ border: none !important;
32057
+ visibility: hidden !important;
32058
+ }
32059
+ }
32060
+ .tf-embed-sdk .formio-component-datagrid td .choices__list--single .choices__item {
32061
+ display: block !important;
32062
+ color: var(--tf-app-font-color, #1e293b) !important;
31983
32063
  }
31984
32064
  .tf-embed-sdk .formio-component-label-hidden > label.control-label--hidden,
31985
32065
  .tf-embed-sdk .formio-component-label-hidden > .control-label--hidden {
@@ -32008,14 +32088,113 @@ span.flatpickr-weekday {
32008
32088
  border-radius: 8px !important;
32009
32089
  overflow: hidden !important;
32010
32090
  }
32011
- .tf-embed-sdk .formio-component-tabs > .card > .card-header {
32091
+ .tf-embed-sdk .tf-tabs-scroll-btn {
32092
+ display: flex !important;
32093
+ align-items: center !important;
32094
+ justify-content: center !important;
32095
+ width: 28px !important;
32096
+ height: 28px !important;
32097
+ min-width: 28px !important;
32098
+ max-width: 28px !important;
32099
+ border-radius: 50% !important;
32100
+ border: 1px solid var(--tf-border-color, #cbd5e1) !important;
32012
32101
  background: #ffffff !important;
32013
- border-bottom: 0 !important;
32014
- padding: 0.5rem 1rem 0 !important;
32102
+ background-color: #ffffff !important;
32103
+ color: var(--tf-app-font-color, #475569) !important;
32104
+ cursor: pointer !important;
32105
+ flex-shrink: 0 !important;
32106
+ padding: 0 !important;
32107
+ margin: 0 4px !important;
32108
+ transition: all 0.2s ease !important;
32109
+ z-index: 2 !important;
32110
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
32111
+ }
32112
+ .tf-embed-sdk .tf-tabs-scroll-btn:hover {
32113
+ background: #f1f5f9 !important;
32114
+ background-color: #f1f5f9 !important;
32115
+ color: var(--tf-primary-color, #2563eb) !important;
32116
+ border-color: var(--tf-primary-color, #2563eb) !important;
32117
+ transform: scale(1.08) !important;
32118
+ }
32119
+ .tf-embed-sdk .tf-tabs-scroll-btn:disabled,
32120
+ .tf-embed-sdk .tf-tabs-scroll-btn.tf-scroll-disabled {
32121
+ opacity: 0.25 !important;
32122
+ cursor: not-allowed !important;
32123
+ transform: none !important;
32124
+ pointer-events: none !important;
32015
32125
  }
32016
- .tf-embed-sdk .formio-component-tabs > .card.card-vertical > .card-header {
32017
- padding: 1rem 0 !important;
32018
- border-right: 1px solid var(--tf-border-color) !important;
32126
+ .tf-embed-sdk .tf-tabs-scroll-btn.tf-scroll-hidden {
32127
+ display: none !important;
32128
+ }
32129
+ @media (min-width: 769px) {
32130
+ .tf-embed-sdk .formio-component-tabs > .card:not(.card-vertical) > .card-header {
32131
+ background: #ffffff !important;
32132
+ border-bottom: 0 !important;
32133
+ padding: 0.4rem 0.5rem 0 !important;
32134
+ display: flex !important;
32135
+ align-items: center !important;
32136
+ position: relative !important;
32137
+ overflow: hidden !important;
32138
+ }
32139
+ .tf-embed-sdk .formio-component-tabs > .card:not(.card-vertical) > .card-header > .tab-component-tabs.nav {
32140
+ display: flex !important;
32141
+ flex-wrap: nowrap !important;
32142
+ overflow-x: auto !important;
32143
+ overflow-y: hidden !important;
32144
+ scrollbar-width: none !important;
32145
+ -ms-overflow-style: none !important;
32146
+ flex: 1 1 auto !important;
32147
+ margin-bottom: 0 !important;
32148
+ gap: 0.5rem !important;
32149
+ border-bottom: none !important;
32150
+ scroll-behavior: smooth !important;
32151
+ }
32152
+ .tf-embed-sdk .formio-component-tabs > .card:not(.card-vertical) > .card-header > .tab-component-tabs.nav::-webkit-scrollbar {
32153
+ display: none !important;
32154
+ width: 0 !important;
32155
+ height: 0 !important;
32156
+ }
32157
+ .tf-embed-sdk .formio-component-tabs > .card:not(.card-vertical) .tab-component-tabs .nav-item {
32158
+ flex-shrink: 0 !important;
32159
+ white-space: nowrap !important;
32160
+ }
32161
+ .tf-embed-sdk .formio-component-tabs > .card:not(.card-vertical) .tab-component-tabs .nav-link {
32162
+ white-space: nowrap !important;
32163
+ padding: 0.5rem 0.5rem !important;
32164
+ }
32165
+ .tf-embed-sdk .formio-component-tabs > .card.card-vertical {
32166
+ display: flex !important;
32167
+ flex-direction: row !important;
32168
+ overflow: hidden !important;
32169
+ align-items: stretch !important;
32170
+ }
32171
+ .tf-embed-sdk .formio-component-tabs > .card.card-vertical > .card-header {
32172
+ padding: 0.5rem 0 !important;
32173
+ border-right: 1px solid var(--tf-border-color) !important;
32174
+ flex: 0 0 200px !important;
32175
+ width: 200px !important;
32176
+ min-width: 200px !important;
32177
+ max-width: 200px !important;
32178
+ box-sizing: border-box !important;
32179
+ overflow-x: hidden !important;
32180
+ overflow-y: auto !important;
32181
+ max-height: 75vh !important;
32182
+ scrollbar-width: thin !important;
32183
+ scrollbar-color: rgba(0, 0, 0, 0.2) transparent !important;
32184
+ }
32185
+ .tf-embed-sdk .formio-component-tabs > .card.card-vertical > .card-header::-webkit-scrollbar {
32186
+ width: 5px !important;
32187
+ }
32188
+ .tf-embed-sdk .formio-component-tabs > .card.card-vertical > .card-header::-webkit-scrollbar-track {
32189
+ background: transparent !important;
32190
+ }
32191
+ .tf-embed-sdk .formio-component-tabs > .card.card-vertical > .card-header::-webkit-scrollbar-thumb {
32192
+ background-color: rgba(0, 0, 0, 0.2) !important;
32193
+ border-radius: 4px !important;
32194
+ }
32195
+ .tf-embed-sdk .formio-component-tabs > .card.card-vertical > .card-header::-webkit-scrollbar-thumb:hover {
32196
+ background-color: rgba(0, 0, 0, 0.35) !important;
32197
+ }
32019
32198
  }
32020
32199
  .tf-embed-sdk .formio-component-tabs .card-header-tabs {
32021
32200
  margin-bottom: 0 !important;
@@ -32024,6 +32203,20 @@ span.flatpickr-weekday {
32024
32203
  border-bottom: none !important;
32025
32204
  gap: 0.5rem !important;
32026
32205
  }
32206
+ .tf-embed-sdk .formio-component-tabs .tab-component-tabs.nav-tabs-vertical,
32207
+ .tf-embed-sdk .nav-tabs-vertical {
32208
+ width: 100% !important;
32209
+ display: flex !important;
32210
+ flex-direction: column !important;
32211
+ border: none !important;
32212
+ border-right: 0 !important;
32213
+ border-bottom: 0 !important;
32214
+ }
32215
+ .tf-embed-sdk .formio-component-tabs .tab-component-tabs.nav-tabs-vertical .nav-item,
32216
+ .tf-embed-sdk .nav-tabs-vertical .nav-item {
32217
+ width: 100% !important;
32218
+ box-sizing: border-box !important;
32219
+ }
32027
32220
  .tf-embed-sdk .formio-component-tabs .tab-component-tabs .nav-link {
32028
32221
  color: var(--tf-app-font-color) !important;
32029
32222
  font-weight: var(--tf-app-font-weight) !important;
@@ -32036,9 +32229,16 @@ span.flatpickr-weekday {
32036
32229
  }
32037
32230
  .tf-embed-sdk .formio-component-tabs .tab-component-tabs.nav-tabs-vertical .nav-link {
32038
32231
  border-bottom: none !important;
32039
- border-left: 2px solid transparent !important;
32040
- padding: 0.5rem 1rem !important;
32041
- text-align: left;
32232
+ border-left: 3px solid transparent !important;
32233
+ padding: 0.6rem 0.75rem !important;
32234
+ text-align: left !important;
32235
+ white-space: normal !important;
32236
+ word-break: break-word !important;
32237
+ overflow-wrap: break-word !important;
32238
+ width: 100% !important;
32239
+ box-sizing: border-box !important;
32240
+ display: block !important;
32241
+ line-height: 1.35 !important;
32042
32242
  }
32043
32243
  .tf-embed-sdk .formio-component-tabs .tab-component-tabs .nav-link:hover {
32044
32244
  color: var(--tf-primary-color) !important;
@@ -32068,6 +32268,228 @@ span.flatpickr-weekday {
32068
32268
  }
32069
32269
  .tf-embed-sdk .formio-component-tabs > .card.card-vertical > .tab-pane.card-body {
32070
32270
  border-top: none !important;
32271
+ flex: 1 1 0% !important;
32272
+ min-width: 0 !important;
32273
+ overflow: visible !important;
32274
+ padding: 0.75rem !important;
32275
+ }
32276
+ .tf-embed-sdk .formio-component-tabs > .card.card-vertical .row {
32277
+ margin-left: 0 !important;
32278
+ margin-right: 0 !important;
32279
+ }
32280
+ .tf-embed-sdk .formio-component-tabs > .card.card-vertical .row > [class*=col-] {
32281
+ padding-left: 0.25rem !important;
32282
+ padding-right: 0.25rem !important;
32283
+ }
32284
+ .tf-embed-sdk .tf-tabs-mobile-bar,
32285
+ .tf-embed-sdk .tf-vertical-tabs-mobile-bar {
32286
+ display: none !important;
32287
+ }
32288
+ .tf-embed-sdk .tf-tabs-backdrop,
32289
+ .tf-embed-sdk .tf-vertical-tabs-backdrop {
32290
+ display: none !important;
32291
+ }
32292
+ @keyframes tf-tab-overlay-fade {
32293
+ from {
32294
+ opacity: 0;
32295
+ transform: translateY(-8px);
32296
+ }
32297
+ to {
32298
+ opacity: 1;
32299
+ transform: translateY(0);
32300
+ }
32301
+ }
32302
+ @media (max-width: 768px) {
32303
+ .tf-embed-sdk .formio-component-tabs > .card,
32304
+ .tf-embed-sdk .card:has(.tf-tabs-mobile-bar),
32305
+ .tf-embed-sdk .card:has(.tf-vertical-tabs-mobile-bar) {
32306
+ position: relative !important;
32307
+ overflow: visible !important;
32308
+ }
32309
+ .tf-embed-sdk .formio-component-tabs > .card.card-vertical,
32310
+ .tf-embed-sdk .card.card-vertical:has(.tf-tabs-mobile-bar) {
32311
+ flex-direction: column !important;
32312
+ }
32313
+ .tf-embed-sdk .tf-tabs-mobile-bar,
32314
+ .tf-embed-sdk .tf-vertical-tabs-mobile-bar {
32315
+ display: flex !important;
32316
+ align-items: center !important;
32317
+ width: 100% !important;
32318
+ background: #ffffff !important;
32319
+ border-bottom: 1px solid var(--tf-border-color, #e2e8f0) !important;
32320
+ padding: 0.5rem 0.75rem !important;
32321
+ box-sizing: border-box !important;
32322
+ z-index: 5 !important;
32323
+ }
32324
+ .tf-embed-sdk .tf-tabs-toggle,
32325
+ .tf-embed-sdk .tf-vertical-tabs-toggle {
32326
+ display: flex !important;
32327
+ align-items: center !important;
32328
+ justify-content: space-between !important;
32329
+ width: 100% !important;
32330
+ background: #f8fafc !important;
32331
+ border: 1px solid var(--tf-border-color, #cbd5e1) !important;
32332
+ border-radius: 6px !important;
32333
+ padding: 0.5rem 0.75rem !important;
32334
+ color: var(--tf-app-font-color, #1e293b) !important;
32335
+ font-size: 0.875rem !important;
32336
+ font-weight: 600 !important;
32337
+ cursor: pointer !important;
32338
+ box-sizing: border-box !important;
32339
+ transition: all 0.2s ease !important;
32340
+ }
32341
+ .tf-embed-sdk .tf-tabs-toggle:hover,
32342
+ .tf-embed-sdk .tf-tabs-toggle:focus,
32343
+ .tf-embed-sdk .tf-vertical-tabs-toggle:hover,
32344
+ .tf-embed-sdk .tf-vertical-tabs-toggle:focus {
32345
+ background: #f1f5f9 !important;
32346
+ border-color: var(--tf-primary-color, #2563eb) !important;
32347
+ outline: none !important;
32348
+ }
32349
+ .tf-embed-sdk .tf-tabs-current-title,
32350
+ .tf-embed-sdk .tf-vertical-tabs-current-title {
32351
+ flex: 1 1 auto !important;
32352
+ text-align: left !important;
32353
+ margin: 0 0.5rem !important;
32354
+ overflow: hidden !important;
32355
+ text-overflow: ellipsis !important;
32356
+ white-space: nowrap !important;
32357
+ }
32358
+ .tf-embed-sdk .tf-tabs-toggle-icon,
32359
+ .tf-embed-sdk .tf-vertical-tabs-toggle-icon {
32360
+ display: flex !important;
32361
+ align-items: center !important;
32362
+ color: var(--tf-primary-color, #2563eb) !important;
32363
+ flex-shrink: 0 !important;
32364
+ }
32365
+ .tf-embed-sdk .tf-tabs-toggle-arrow,
32366
+ .tf-embed-sdk .tf-vertical-tabs-toggle-arrow {
32367
+ display: flex !important;
32368
+ align-items: center !important;
32369
+ color: #64748b !important;
32370
+ flex-shrink: 0 !important;
32371
+ transition: transform 0.2s ease !important;
32372
+ }
32373
+ .tf-embed-sdk .tf-tabs-overlay-open .tf-tabs-toggle-arrow,
32374
+ .tf-embed-sdk .tf-tabs-overlay-open .tf-vertical-tabs-toggle-arrow {
32375
+ transform: rotate(180deg) !important;
32376
+ }
32377
+ .tf-embed-sdk .formio-component-tabs > .card > .card-header,
32378
+ .tf-embed-sdk .card:has(.tf-tabs-mobile-bar) > .card-header,
32379
+ .tf-embed-sdk .card:has(.tf-vertical-tabs-mobile-bar) > .card-header {
32380
+ position: absolute !important;
32381
+ top: 3.25rem !important;
32382
+ left: 0.5rem !important;
32383
+ right: 0.5rem !important;
32384
+ max-width: calc(100% - 1rem) !important;
32385
+ width: calc(100% - 1rem) !important;
32386
+ min-width: 0 !important;
32387
+ flex: none !important;
32388
+ max-height: 65vh !important;
32389
+ overflow-y: auto !important;
32390
+ overflow-x: hidden !important;
32391
+ background: #ffffff !important;
32392
+ border: 1px solid var(--tf-border-color, #cbd5e1) !important;
32393
+ border-radius: 8px !important;
32394
+ box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.18), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
32395
+ z-index: 1050 !important;
32396
+ padding: 0.4rem 0 !important;
32397
+ display: none !important;
32398
+ scrollbar-width: thin !important;
32399
+ scrollbar-color: rgba(0, 0, 0, 0.2) transparent !important;
32400
+ }
32401
+ .tf-embed-sdk .formio-component-tabs > .card.tf-tabs-overlay-open > .card-header,
32402
+ .tf-embed-sdk .card:has(.tf-tabs-mobile-bar).tf-tabs-overlay-open > .card-header,
32403
+ .tf-embed-sdk .card:has(.tf-vertical-tabs-mobile-bar).tf-tabs-overlay-open > .card-header {
32404
+ display: block !important;
32405
+ animation: tf-tab-overlay-fade 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
32406
+ }
32407
+ .tf-embed-sdk .formio-component-tabs .tf-tabs-backdrop,
32408
+ .tf-embed-sdk .formio-component-tabs .tf-vertical-tabs-backdrop {
32409
+ position: fixed !important;
32410
+ top: 0 !important;
32411
+ left: 0 !important;
32412
+ width: 100vw !important;
32413
+ height: 100vh !important;
32414
+ background: rgba(0, 0, 0, 0.35) !important;
32415
+ z-index: 1040 !important;
32416
+ display: none !important;
32417
+ }
32418
+ .tf-embed-sdk .formio-component-tabs > .card.tf-tabs-overlay-open .tf-tabs-backdrop,
32419
+ .tf-embed-sdk .formio-component-tabs > .card.tf-tabs-overlay-open .tf-vertical-tabs-backdrop {
32420
+ display: block !important;
32421
+ }
32422
+ .tf-embed-sdk .formio-component-tabs .tab-component-tabs.nav {
32423
+ display: flex !important;
32424
+ flex-direction: column !important;
32425
+ width: 100% !important;
32426
+ gap: 0 !important;
32427
+ border: none !important;
32428
+ margin: 0 !important;
32429
+ padding: 0 !important;
32430
+ }
32431
+ .tf-embed-sdk .formio-component-tabs .tab-component-tabs .nav-item {
32432
+ width: 100% !important;
32433
+ box-sizing: border-box !important;
32434
+ margin: 0 !important;
32435
+ padding: 0 !important;
32436
+ }
32437
+ .tf-embed-sdk .formio-component-tabs .tab-component-tabs .nav-link {
32438
+ padding: 0.65rem 1rem !important;
32439
+ font-size: 0.875rem !important;
32440
+ border: none !important;
32441
+ border-bottom: 1px solid #f1f5f9 !important;
32442
+ border-left: 3px solid transparent !important;
32443
+ border-radius: 0 !important;
32444
+ white-space: normal !important;
32445
+ word-break: break-word !important;
32446
+ text-align: left !important;
32447
+ width: 100% !important;
32448
+ box-sizing: border-box !important;
32449
+ display: block !important;
32450
+ line-height: 1.35 !important;
32451
+ color: var(--tf-app-font-color, #1e293b) !important;
32452
+ background: transparent !important;
32453
+ }
32454
+ .tf-embed-sdk .formio-component-tabs .tab-component-tabs .nav-link:hover {
32455
+ background-color: rgba(0, 0, 0, 0.05) !important;
32456
+ }
32457
+ .tf-embed-sdk .formio-component-tabs .tab-component-tabs .nav-link.active,
32458
+ .tf-embed-sdk .formio-component-tabs .tab-component-tabs .nav-item.active .nav-link {
32459
+ background-color: var(--tf-primary-color) !important;
32460
+ color: var(--tf-secondary-color, #ffffff) !important;
32461
+ border-left-color: var(--tf-primary-color) !important;
32462
+ border-bottom-color: transparent !important;
32463
+ }
32464
+ .tf-embed-sdk .formio-component-tabs > .card > .tab-pane.card-body {
32465
+ width: 100% !important;
32466
+ padding: 0.75rem !important;
32467
+ flex: 1 1 auto !important;
32468
+ box-sizing: border-box !important;
32469
+ border-top: none !important;
32470
+ }
32471
+ .tf-embed-sdk .formio-component-tabs > .card .row > [class*=col-] {
32472
+ flex: 0 0 100% !important;
32473
+ max-width: 100% !important;
32474
+ width: 100% !important;
32475
+ }
32476
+ .tf-embed-sdk .tf-tabs-scroll-btn {
32477
+ display: none !important;
32478
+ }
32479
+ }
32480
+ @media (max-width: 360px) {
32481
+ .tf-embed-sdk .formio-component-tabs .tf-tabs-mobile-bar,
32482
+ .tf-embed-sdk .formio-component-tabs .tf-vertical-tabs-mobile-bar {
32483
+ padding: 0.4rem 0.5rem !important;
32484
+ }
32485
+ .tf-embed-sdk .formio-component-tabs .tf-tabs-toggle,
32486
+ .tf-embed-sdk .formio-component-tabs .tf-vertical-tabs-toggle {
32487
+ font-size: 0.8rem !important;
32488
+ padding: 0.4rem 0.5rem !important;
32489
+ }
32490
+ .tf-embed-sdk .formio-component-tabs > .card > .tab-pane.card-body {
32491
+ padding: 0.4rem 0.25rem !important;
32492
+ }
32071
32493
  }</style>
32072
32494
  <style>.tf-embed-sdk [ref=tooltip] {
32073
32495
  cursor: help !important;
@@ -32603,39 +33025,83 @@ span.flatpickr-weekday {
32603
33025
  .tf-embed-sdk .formio-component-htmlelement li {
32604
33026
  display: list-item !important;
32605
33027
  }</style>
32606
- <style>.tf-embed-sdk ul.breadcrumb,
33028
+ <style>.tf-embed-sdk nav[aria-label="Wizard navigation"],
33029
+ .tf-embed-sdk nav[ref*=wizard],
33030
+ .tf-embed-sdk nav[ref$=-header] {
33031
+ width: 100% !important;
33032
+ max-width: 100% !important;
33033
+ overflow-x: auto !important;
33034
+ overflow-y: hidden !important;
33035
+ -webkit-overflow-scrolling: touch;
33036
+ scrollbar-width: thin;
33037
+ scrollbar-color: rgba(148, 163, 184, 0.3) transparent;
33038
+ }
33039
+ .tf-embed-sdk ul.breadcrumb,
32607
33040
  .tf-embed-sdk ul.pagination {
32608
33041
  display: flex !important;
33042
+ flex-wrap: nowrap !important;
32609
33043
  justify-content: center !important;
33044
+ align-items: flex-start !important;
32610
33045
  background-color: transparent !important;
32611
- padding: 20px 0 !important;
33046
+ padding: 20px 24px !important;
32612
33047
  margin-bottom: 2.5rem !important;
32613
33048
  list-style: none !important;
32614
33049
  position: relative !important;
32615
33050
  border: none !important;
32616
33051
  counter-reset: step-counter !important;
32617
33052
  gap: 2rem !important;
33053
+ width: max-content !important;
33054
+ min-width: 100% !important;
33055
+ box-sizing: border-box !important;
33056
+ overflow-x: auto !important;
33057
+ overflow-y: hidden !important;
33058
+ -webkit-overflow-scrolling: touch;
33059
+ scrollbar-width: thin;
33060
+ scrollbar-color: rgba(148, 163, 184, 0.3) transparent;
33061
+ }
33062
+ .tf-embed-sdk nav[aria-label="Wizard navigation"]::-webkit-scrollbar,
33063
+ .tf-embed-sdk nav[ref*=wizard]::-webkit-scrollbar,
33064
+ .tf-embed-sdk ul.breadcrumb::-webkit-scrollbar,
33065
+ .tf-embed-sdk ul.pagination::-webkit-scrollbar {
33066
+ height: 4px;
33067
+ }
33068
+ .tf-embed-sdk nav[aria-label="Wizard navigation"]::-webkit-scrollbar-track,
33069
+ .tf-embed-sdk nav[ref*=wizard]::-webkit-scrollbar-track,
33070
+ .tf-embed-sdk ul.breadcrumb::-webkit-scrollbar-track,
33071
+ .tf-embed-sdk ul.pagination::-webkit-scrollbar-track {
33072
+ background: transparent;
33073
+ }
33074
+ .tf-embed-sdk nav[aria-label="Wizard navigation"]::-webkit-scrollbar-thumb,
33075
+ .tf-embed-sdk nav[ref*=wizard]::-webkit-scrollbar-thumb,
33076
+ .tf-embed-sdk ul.breadcrumb::-webkit-scrollbar-thumb,
33077
+ .tf-embed-sdk ul.pagination::-webkit-scrollbar-thumb {
33078
+ background-color: rgba(148, 163, 184, 0.3);
33079
+ border-radius: 4px;
32618
33080
  }
32619
33081
  .tf-embed-sdk ul.breadcrumb::before,
32620
33082
  .tf-embed-sdk ul.pagination::before {
32621
33083
  content: "" !important;
32622
33084
  position: absolute !important;
32623
33085
  top: 36px !important;
32624
- left: 10% !important;
32625
- right: 10% !important;
33086
+ left: 40px !important;
33087
+ right: 40px !important;
32626
33088
  height: 3px !important;
32627
33089
  background: #e2e8f0 !important;
32628
33090
  z-index: 1 !important;
33091
+ pointer-events: none !important;
32629
33092
  }
32630
33093
  .tf-embed-sdk ul.breadcrumb li.breadcrumb-item,
32631
33094
  .tf-embed-sdk ul.pagination li.page-item {
32632
- flex: 0 1 auto !important;
33095
+ flex: 0 0 auto !important;
32633
33096
  text-align: center !important;
32634
33097
  position: relative !important;
32635
33098
  z-index: 2 !important;
32636
33099
  padding: 0 !important;
32637
33100
  background: transparent !important;
32638
- min-width: 100px !important;
33101
+ min-width: 90px !important;
33102
+ max-width: 160px !important;
33103
+ word-break: break-word !important;
33104
+ scroll-snap-align: center;
32639
33105
  }
32640
33106
  .tf-embed-sdk ul.breadcrumb li.breadcrumb-item::before,
32641
33107
  .tf-embed-sdk ul.pagination li.page-item button::before {
@@ -32784,6 +33250,78 @@ span.flatpickr-weekday {
32784
33250
  padding: 0 !important;
32785
33251
  margin: 0 !important;
32786
33252
  overflow: hidden !important;
33253
+ }
33254
+ @media (max-width: 768px) {
33255
+ .tf-embed-sdk nav[aria-label="Wizard navigation"],
33256
+ .tf-embed-sdk nav[ref*=wizard],
33257
+ .tf-embed-sdk nav[ref$=-header] {
33258
+ padding: 0 4px !important;
33259
+ margin-bottom: 1.5rem !important;
33260
+ scroll-snap-type: x proximity;
33261
+ }
33262
+ .tf-embed-sdk ul.breadcrumb,
33263
+ .tf-embed-sdk ul.pagination {
33264
+ padding: 14px 16px !important;
33265
+ margin-bottom: 1.5rem !important;
33266
+ gap: 1.25rem !important;
33267
+ justify-content: center !important;
33268
+ justify-content: safe center !important;
33269
+ margin-left: auto !important;
33270
+ margin-right: auto !important;
33271
+ }
33272
+ .tf-embed-sdk ul.breadcrumb::before,
33273
+ .tf-embed-sdk ul.pagination::before {
33274
+ top: 28px !important;
33275
+ left: 24px !important;
33276
+ right: 24px !important;
33277
+ }
33278
+ .tf-embed-sdk ul.breadcrumb li.breadcrumb-item,
33279
+ .tf-embed-sdk ul.pagination li.page-item {
33280
+ min-width: 75px !important;
33281
+ max-width: 120px !important;
33282
+ }
33283
+ .tf-embed-sdk ul.breadcrumb li.breadcrumb-item::before,
33284
+ .tf-embed-sdk ul.pagination li.page-item button::before {
33285
+ width: 28px !important;
33286
+ height: 28px !important;
33287
+ font-size: 0.8rem !important;
33288
+ margin: 0 auto 8px !important;
33289
+ }
33290
+ .tf-embed-sdk ul.pagination li.page-item button.page-link,
33291
+ .tf-embed-sdk ul.breadcrumb li.breadcrumb-item a,
33292
+ .tf-embed-sdk ul.breadcrumb li.breadcrumb-item span,
33293
+ .tf-embed-sdk ul.pagination li.page-item button span {
33294
+ font-size: 0.8rem !important;
33295
+ line-height: 1.2 !important;
33296
+ }
33297
+ }
33298
+ @media (max-width: 480px) {
33299
+ .tf-embed-sdk ul.breadcrumb,
33300
+ .tf-embed-sdk ul.pagination {
33301
+ gap: 0.85rem !important;
33302
+ padding: 10px 12px !important;
33303
+ justify-content: center !important;
33304
+ justify-content: safe center !important;
33305
+ margin-left: auto !important;
33306
+ margin-right: auto !important;
33307
+ }
33308
+ .tf-embed-sdk ul.breadcrumb li.breadcrumb-item,
33309
+ .tf-embed-sdk ul.pagination li.page-item {
33310
+ min-width: 65px !important;
33311
+ max-width: 100px !important;
33312
+ }
33313
+ .tf-embed-sdk ul.breadcrumb li.breadcrumb-item::before,
33314
+ .tf-embed-sdk ul.pagination li.page-item button::before {
33315
+ width: 26px !important;
33316
+ height: 26px !important;
33317
+ font-size: 0.75rem !important;
33318
+ }
33319
+ .tf-embed-sdk ul.breadcrumb::before,
33320
+ .tf-embed-sdk ul.pagination::before {
33321
+ top: 23px !important;
33322
+ left: 20px !important;
33323
+ right: 20px !important;
33324
+ }
32787
33325
  }</style>
32788
33326
  <style>.tf-embed-sdk .component-modal-wrapper img,
32789
33327
  .tf-embed-sdk [ref=modalContent] img,
@@ -36658,9 +37196,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
36658
37196
  }
36659
37197
  })
36660
37198
  `)}function compressOnWebWorker(e,t){return new Promise(function(n,r){var a=cnt+=1;imageCompressionLibUrl||(imageCompressionLibUrl=generateLib()),worker||(worker=generateWorkerScript()),worker.addEventListener("message",function i(c){if(c.data.id===a){if(c.data.progress!==void 0)return void t.onProgress(c.data.progress);worker.removeEventListener("message",i),c.data.error&&r(new Error(c.data.error)),n(c.data.file)}}),worker.addEventListener("error",r),worker.postMessage({file:e,id:a,imageCompressionLibUrl,options:_objectSpread2(_objectSpread2({},t),{},{onProgress:void 0})})})}function imageCompression(e,t){return new Promise(function(n,r){var a,i,c,s,u,l;if(a=_objectSpread2({},t),c=0,s=a.onProgress,a.maxSizeMB=a.maxSizeMB||Number.POSITIVE_INFINITY,u=typeof a.useWebWorker!="boolean"||a.useWebWorker,delete a.useWebWorker,a.onProgress=function(h){c=h,typeof s=="function"&&s(c)},!(e instanceof Blob||e instanceof CustomFile))return r(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(e.type))return r(new Error("The file given is not an image"));if(l=typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope,!u||typeof Worker!="function"||l)return compress(e,a).then(function(h){try{return i=h,d.call(this)}catch(g){return r(g)}}.bind(this),r);var p=function(){try{return d.call(this)}catch(h){return r(h)}}.bind(this),y=function(g){try{return compress(e,a).then(function(m){try{return i=m,p()}catch(A){return r(A)}},r)}catch(m){return r(m)}};try{return compressOnWebWorker(e,a).then(function(h){try{return i=h,p()}catch(g){return y()}},y)}catch(h){y()}function d(){try{i.name=e.name,i.lastModified=e.lastModified}catch(h){}return n(i)}})}return imageCompression.getDataUrlFromFile=getDataUrlFromFile,imageCompression.getFilefromDataUrl=getFilefromDataUrl,imageCompression.loadImage=loadImage,imageCompression.drawImageInCanvas=drawImageInCanvas,imageCompression.drawFileInCanvas=drawFileInCanvas,imageCompression.canvasToFile=canvasToFile,imageCompression.getExifOrientation=getExifOrientation,imageCompression.handleMaxWidthOrHeight=handleMaxWidthOrHeight,imageCompression.followExifOrientation=followExifOrientation,imageCompression.cleanupCanvasMemory=cleanupCanvasMemory,imageCompression.isAutoOrientationInBrowser=isAutoOrientationInBrowser,imageCompression.approximateBelowMaximumCanvasSizeOfBrowser=approximateBelowMaximumCanvasSizeOfBrowser,imageCompression.getBrowserName=getBrowserName,imageCompression.version="1.0.17",imageCompression})})();</script>
36661
- <script>var A=Object.defineProperty;var K=(S,c,l)=>c in S?A(S,c,{enumerable:!0,configurable:!0,writable:!0,value:l}):S[c]=l;var z=(S,c,l)=>K(S,typeof c!="symbol"?c+"":c,l);(function(){let S=!1;typeof Formio!="undefined"&&!window._&&(window._=Formio._);const l=class l{constructor(){}static get title(){return"SmartStorage"}static preInitialize(){return new l().createDb()}createDb(){return l._dbPromise?l._dbPromise:"indexedDB"in window?(l._listenerAdded||(document.addEventListener("deleteOriginalFileFromDB",async e=>{logger.info("[TF_SDK:207] \u2705 deleteOriginalFileFromDB event received",{fileId:e.detail.fileId}),await this.deleteFile(e.detail.fileId)},!1),l._listenerAdded=!0),l._dbPromise=new Promise((e,o)=>{const s=indexedDB.open("Forms-Attachments",3);logger.info("[TF_SDK:208] \u2705 Opening IndexedDB: Forms-Attachments v3"),s.onsuccess=n=>{const r=n.target.result;if(!r.objectStoreNames.contains("Files")){logger.warn("[TF_SDK:209] \u26A0\uFE0F Files store missing \u2014 recreating DB..."),r.close();const a=indexedDB.deleteDatabase("Forms-Attachments");a.onsuccess=()=>{const i=indexedDB.open("Forms-Attachments",3);i.onupgradeneeded=t=>{const d=t.target.result;d.objectStoreNames.contains("Files")||d.createObjectStore("Files")},i.onsuccess=t=>{logger.info("[TF_SDK:210] \u2705 DB recreated successfully"),e(t.target.result)},i.onerror=t=>{l._dbPromise=null,o(t)}},a.onerror=i=>{l._dbPromise=null,o(i)};return}e(r),logger.info("[TF_SDK:211] \u2705 DB opened successfully")},s.onupgradeneeded=n=>{const r=n.target.result;r.objectStoreNames.contains("Files")||r.createObjectStore("Files")},s.onerror=n=>{l._dbPromise=null,o(n)}}),l._dbPromise):(logger.warn("[TF_SDK:206] \u26A0\uFE0F IndexedDB not supported in this browser"),Promise.reject("IndexedDB not supported"))}isPlatform(){return window.platform&&(window.platform.isBrowser||window.platform.isAndroid||window.platform.iosPlatform)}async uploadFile(e,o,s,n){logger.info("[TF_SDK:212] \u{1F4BE} SmartStorage.uploadFile() called",{fileName:o,size:(e.size/1024).toFixed(1)+" KB",type:e.type});const r=await this.createDb(),a=new FileReader;return new Promise((i,t)=>{typeof n=="function"&&n({loaded:0,total:e.size}),a.onload=d=>{const b=new Blob([e],{type:e.type}),m=uuid.v4(),u=d.target.result,w={id:m,data:b,name:o,size:e.size,type:e.type,url:u,mode:"A"};if(this.isPlatform()){const p=r.transaction(["Files"],"readwrite"),y=p.objectStore("Files").put(w,m);y.onerror=F=>{logger.error("[TF_SDK:213] \u274C Error storing data in IndexedDB:",F),t(F)},p.onerror=F=>t(F),p.oncomplete=()=>{logger.info("[TF_SDK:214] \u2705 File stored in IndexedDB (Forms-Attachments -> Files)",{id:m,fileName:o,size:(e.size/1024).toFixed(1)+" KB"}),typeof n=="function"&&n({loaded:e.size,total:e.size}),logger.info(`[TF_SDK:215] \u2705 Initial file saved to IndexedDB: ${o} (ID: ${m})`),i({storage:"SmartStorage",name:o,size:e.size,type:e.type,url:u,id:m,mode:"A"})}}else i({storage:"SmartStorage",name:o,size:e.size,type:e.type,url:u,id:m,mode:"A"})},a.readAsDataURL(e)})}async deleteFile(e){if(!e)return;logger.info("[TF_SDK:216] \u2705 deleteFile() called",{Id:e});const o=await this.createDb();return new Promise((s,n)=>{if(this.isPlatform()){const r=o.transaction(["Files"],"readwrite"),a=r.objectStore("Files"),i=a.get(e);i.onsuccess=()=>{const t=i.result;t?(t.mode="D",a.put(t,e)):a.put({id:e,mode:"D"},e)},r.oncomplete=()=>{logger.info("[TF_SDK:217] \u2705 File marked as deleted (mode: D) in IndexedDB",{Id:e}),s(!0)},r.onerror=t=>n(t)}else s(!0)})}async updateFile(e,o,s,n){if(logger.info("[TF_SDK:216a] \u{1F4BE} SmartStorage.updateFile() called",{existingId:e,fileName:s,size:(o.size/1024).toFixed(1)+" KB",type:o.type}),!e)return logger.warn("[TF_SDK:216b] \u26A0\uFE0F SmartStorage.updateFile: no existingId provided, falling back to uploadFile"),this.uploadFile(o,s,null,n);const r=await this.createDb(),a=new FileReader;return new Promise((i,t)=>{typeof n=="function"&&n({loaded:0,total:o.size}),a.onload=d=>{const b=new Blob([o],{type:o.type}),m=d.target.result;if(this.isPlatform()){const u=r.transaction(["Files"],"readwrite"),w=u.objectStore("Files"),p=w.get(e);p.onsuccess=()=>{const D=p.result||{},y={...D,id:e,data:b,name:D.name||s,size:o.size,type:o.type||"image/jpeg",url:m,mode:"A"},F=w.put(y,e);F.onerror=g=>{logger.error("[TF_SDK:216c] \u274C Error updating file in IndexedDB:",g),t(g)}},p.onerror=D=>{logger.error("[TF_SDK:216d] \u274C Error reading existing file from IndexedDB:",D),t(D)},u.onerror=D=>t(D),u.oncomplete=()=>{logger.info("[TF_SDK:217a] \u2705 File updated in IndexedDB (Forms-Attachments -> Files)",{existingId:e,fileName:s,size:(o.size/1024).toFixed(1)+" KB",mode:"A"}),typeof n=="function"&&n({loaded:o.size,total:o.size}),i({storage:"SmartStorage",name:s,size:o.size,type:o.type,url:m,id:e,mode:"A"})}}else i({storage:"SmartStorage",name:s,size:o.size,type:o.type,url:m,id:e,mode:"A"})},a.onerror=d=>t(d),a.readAsDataURL(o)})}async downloadFile(e){logger.info("[TF_SDK:218] \u2705 downloadFile() called",{id:e.id,name:e.originalName||e.name});const o=await this.createDb(),s=new FileReader;return new Promise((n,r)=>{if(this.isPlatform())if(e.id){const a=o.transaction(["Files"],"readonly"),t=a.objectStore("Files").get(e.id);t.onsuccess=()=>{if(!t.result)return logger.warn("[TF_SDK:219] \u26A0\uFE0F File not found in IndexedDB",{id:e.id}),r("File not found");a.oncomplete=()=>{const d=t.result.data;logger.info("[TF_SDK:220] \u2705 File fetched from IndexedDB",{id:e.id,size:(d.size/1024).toFixed(1)+" KB"}),s.onload=()=>n(t.result),s.onerror=b=>r(b),s.readAsDataURL(d)}},t.onerror=d=>r(d),a.onerror=d=>r(d)}else{const a=e.url.indexOf(","),i=e.url.substring(a+1),t=atob(i),d=new Array(t.length);for(let u=0;u<t.length;u++)d[u]=t.charCodeAt(u);const b=new Uint8Array(d),m=new Blob([b],{type:e.type});s.onload=()=>{const u=e.uid,w={id:u,data:m,name:e.originalName,size:m.size,type:e.type,url:e.url,mode:e.mode||"G"},p=o.transaction(["Files"],"readwrite"),D=p.objectStore("Files"),y=D.put(w,u),F=D.get(u);y.onerror=g=>r(g),p.onerror=g=>r(g),F.onsuccess=()=>{if(!F.result)return r("File not found");p.oncomplete=()=>{const g=new FileReader,B=F.result.data;g.onload=()=>n(F.result),g.onerror=f=>r(f),g.readAsDataURL(B)}},F.onerror=g=>r(g)},s.onerror=u=>r(u),s.readAsDataURL(m)}else{if(e&&e.url)return n(e);const a=new Blob([e],{type:e.type});s.onload=()=>n({...e,url:s.result}),s.onerror=i=>r(i),s.readAsDataURL(a)}})}async markFileAsDeleted(e){if(logger.info("[TF_SDK:221] \u2705 markFileAsDeleted() called",{fileId:e}),!e)return;const o=await this.createDb();return new Promise((s,n)=>{if(this.isPlatform()){const r=o.transaction(["Files"],"readwrite"),a=r.objectStore("Files"),i=a.get(e);i.onsuccess=()=>{const t=i.result;if(!t)return n("File not found");t.mode="D";const d=a.put(t,e);d.onsuccess=()=>{r.oncomplete=()=>{logger.info("[TF_SDK:222] \u2705 File marked as deleted (mode=D)",{fileId:e}),s(t)}},d.onerror=b=>n(b)},i.onerror=t=>n(t),r.onerror=t=>n(t)}else n("Not supported on mobile platform")})}};z(l,"_dbPromise",null),z(l,"_listenerAdded",!1);let c=l;c.title="SmartStorage",typeof c!="undefined"&&(window.SmartStorage=c),typeof Formio!="undefined"&&(Formio.providers=Formio.providers||{},Formio.providers.storage=Formio.providers.storage||{},Formio.providers.storage.SmartStorage=c,Formio.providers.storage.smartstorage=c,Formio.Providers&&Formio.Providers.addProviders("storage",{SmartStorage:c,smartstorage:c}),document.dispatchEvent(new CustomEvent("smartStorageReady",{detail:{SmartStorage:c}})))})();</script>
37199
+ <script>var A=Object.defineProperty;var K=(y,u,c)=>u in y?A(y,u,{enumerable:!0,configurable:!0,writable:!0,value:c}):y[u]=c;var z=(y,u,c)=>K(y,typeof u!="symbol"?u+"":u,c);(function(){let y=!1;typeof Formio!="undefined"&&!window._&&(window._=Formio._);const c=class c{constructor(){}static get title(){return"SmartStorage"}static preInitialize(){return new c().createDb()}createDb(){return c._dbPromise?c._dbPromise:"indexedDB"in window?(c._listenerAdded||(document.addEventListener("deleteOriginalFileFromDB",async e=>{logger.info("[TF_SDK:207] \u2705 deleteOriginalFileFromDB event received",{fileId:e.detail.fileId}),await this.deleteFile(e.detail.fileId)},!1),c._listenerAdded=!0),c._dbPromise=new Promise((e,o)=>{const s=indexedDB.open("Forms-Attachments",3);logger.info("[TF_SDK:208] \u2705 Opening IndexedDB: Forms-Attachments v3"),s.onsuccess=n=>{const r=n.target.result;if(!r.objectStoreNames.contains("Files")){logger.warn("[TF_SDK:209] \u26A0\uFE0F Files store missing \u2014 recreating DB..."),r.close();const i=indexedDB.deleteDatabase("Forms-Attachments");i.onsuccess=()=>{const a=indexedDB.open("Forms-Attachments",3);a.onupgradeneeded=t=>{const d=t.target.result;d.objectStoreNames.contains("Files")||d.createObjectStore("Files")},a.onsuccess=t=>{logger.info("[TF_SDK:210] \u2705 DB recreated successfully"),e(t.target.result)},a.onerror=t=>{c._dbPromise=null,o(t)}},i.onerror=a=>{c._dbPromise=null,o(a)};return}e(r),logger.info("[TF_SDK:211] \u2705 DB opened successfully")},s.onupgradeneeded=n=>{const r=n.target.result;r.objectStoreNames.contains("Files")||r.createObjectStore("Files")},s.onerror=n=>{c._dbPromise=null,o(n)}}),c._dbPromise):(logger.warn("[TF_SDK:206] \u26A0\uFE0F IndexedDB not supported in this browser"),Promise.reject("IndexedDB not supported"))}isPlatform(){return window.platform&&(window.platform.isBrowser||window.platform.isAndroid||window.platform.iosPlatform)}async uploadFile(e,o,s,n){logger.info("[TF_SDK:212] \u{1F4BE} SmartStorage.uploadFile() called",{fileName:o,size:(e.size/1024).toFixed(1)+" KB",type:e.type});const r=await this.createDb(),i=new FileReader;return new Promise((a,t)=>{typeof n=="function"&&n({loaded:0,total:e.size}),i.onload=d=>{const w=new Blob([e],{type:e.type}),m=uuid.v4(),l=d.target.result,b={id:m,data:w,name:o,size:e.size,type:e.type,url:l,mode:"A"};if(this.isPlatform()){const p=r.transaction(["Files"],"readwrite"),g=p.objectStore("Files").put(b,m);g.onerror=F=>{logger.error("[TF_SDK:213] \u274C Error storing data in IndexedDB:",F),t(F)},p.onerror=F=>t(F),p.oncomplete=()=>{logger.info("[TF_SDK:214] \u2705 File stored in IndexedDB (Forms-Attachments -> Files)",{id:m,fileName:o,size:(e.size/1024).toFixed(1)+" KB"}),typeof n=="function"&&n({loaded:e.size,total:e.size}),logger.info(`[TF_SDK:215] \u2705 Initial file saved to IndexedDB: ${o} (ID: ${m})`),a({storage:"SmartStorage",name:o,size:e.size,type:e.type,url:l,id:m,mode:"A"})}}else a({storage:"SmartStorage",name:o,size:e.size,type:e.type,url:l,id:m,mode:"A"})},i.readAsDataURL(e)})}async deleteFile(e){if(!e)return;logger.info("[TF_SDK:216] \u2705 deleteFile() called",{Id:e});const o=await this.createDb();return new Promise((s,n)=>{if(this.isPlatform()){const r=o.transaction(["Files"],"readwrite"),i=r.objectStore("Files"),a=i.get(e);a.onsuccess=()=>{const t=a.result;t?(t.mode="D",i.put(t,e)):i.put({id:e,mode:"D"},e)},r.oncomplete=()=>{logger.info("[TF_SDK:217] \u2705 File marked as deleted (mode: D) in IndexedDB",{Id:e}),s(!0)},r.onerror=t=>n(t)}else s(!0)})}async updateFile(e,o,s,n){if(logger.info("[TF_SDK:216a] \u{1F4BE} SmartStorage.updateFile() called",{existingId:e,fileName:s,size:(o.size/1024).toFixed(1)+" KB",type:o.type}),!e)return logger.warn("[TF_SDK:216b] \u26A0\uFE0F SmartStorage.updateFile: no existingId provided, falling back to uploadFile"),this.uploadFile(o,s,null,n);const r=await this.createDb(),i=new FileReader;return new Promise((a,t)=>{typeof n=="function"&&n({loaded:0,total:o.size}),i.onload=d=>{const w=new Blob([o],{type:o.type}),m=d.target.result,l=typeof uuid!="undefined"&&uuid.v4?uuid.v4():"file_"+Date.now()+"_"+Math.random().toString(36).substr(2,9);if(this.isPlatform()){const b=r.transaction(["Files"],"readwrite"),p=b.objectStore("Files"),S=p.get(e);S.onsuccess=()=>{const g=S.result||{id:e};g.mode="D",p.put(g,e);const F={...g,id:l,data:w,name:g.name||s,originalName:g.originalName||s,size:o.size,type:o.type||"image/jpeg",url:m,mode:"A"},D=p.put(F,l);D.onerror=f=>{logger.error("[TF_SDK:216c] \u274C Error inserting new file in IndexedDB:",f),t(f)}},S.onerror=g=>{logger.error("[TF_SDK:216d] \u274C Error reading existing file from IndexedDB:",g),t(g)},b.onerror=g=>t(g),b.oncomplete=()=>{logger.info("[TF_SDK:217a] \u2705 File updated in IndexedDB: old id marked D, new id created A",{existingId:e,newId:l,fileName:s,size:(o.size/1024).toFixed(1)+" KB",mode:"A"}),typeof n=="function"&&n({loaded:o.size,total:o.size}),a({storage:"SmartStorage",name:s,size:o.size,type:o.type,url:m,id:l,mode:"A"})}}else a({storage:"SmartStorage",name:s,size:o.size,type:o.type,url:m,id:l,mode:"A"})},i.onerror=d=>t(d),i.readAsDataURL(o)})}async downloadFile(e){logger.info("[TF_SDK:218] \u2705 downloadFile() called",{id:e.id,name:e.originalName||e.name});const o=await this.createDb(),s=new FileReader;return new Promise((n,r)=>{if(this.isPlatform())if(e.id){const i=o.transaction(["Files"],"readonly"),t=i.objectStore("Files").get(e.id);t.onsuccess=()=>{if(!t.result)return logger.warn("[TF_SDK:219] \u26A0\uFE0F File not found in IndexedDB",{id:e.id}),r("File not found");i.oncomplete=()=>{const d=t.result.data;logger.info("[TF_SDK:220] \u2705 File fetched from IndexedDB",{id:e.id,size:(d.size/1024).toFixed(1)+" KB"}),s.onload=()=>n(t.result),s.onerror=w=>r(w),s.readAsDataURL(d)}},t.onerror=d=>r(d),i.onerror=d=>r(d)}else{const i=e.url.indexOf(","),a=e.url.substring(i+1),t=atob(a),d=new Array(t.length);for(let l=0;l<t.length;l++)d[l]=t.charCodeAt(l);const w=new Uint8Array(d),m=new Blob([w],{type:e.type});s.onload=()=>{const l=e.uid,b={id:l,data:m,name:e.originalName,size:m.size,type:e.type,url:e.url,mode:e.mode||"G"},p=o.transaction(["Files"],"readwrite"),S=p.objectStore("Files"),g=S.put(b,l),F=S.get(l);g.onerror=D=>r(D),p.onerror=D=>r(D),F.onsuccess=()=>{if(!F.result)return r("File not found");p.oncomplete=()=>{const D=new FileReader,f=F.result.data;D.onload=()=>n(F.result),D.onerror=B=>r(B),D.readAsDataURL(f)}},F.onerror=D=>r(D)},s.onerror=l=>r(l),s.readAsDataURL(m)}else{if(e&&e.url)return n(e);const i=new Blob([e],{type:e.type});s.onload=()=>n({...e,url:s.result}),s.onerror=a=>r(a),s.readAsDataURL(i)}})}async markFileAsDeleted(e){if(logger.info("[TF_SDK:221] \u2705 markFileAsDeleted() called",{fileId:e}),!e)return;const o=await this.createDb();return new Promise((s,n)=>{if(this.isPlatform()){const r=o.transaction(["Files"],"readwrite"),i=r.objectStore("Files"),a=i.get(e);a.onsuccess=()=>{const t=a.result;if(!t)return n("File not found");t.mode="D";const d=i.put(t,e);d.onsuccess=()=>{r.oncomplete=()=>{logger.info("[TF_SDK:222] \u2705 File marked as deleted (mode=D)",{fileId:e}),s(t)}},d.onerror=w=>n(w)},a.onerror=t=>n(t),r.onerror=t=>n(t)}else n("Not supported on mobile platform")})}};z(c,"_dbPromise",null),z(c,"_listenerAdded",!1);let u=c;u.title="SmartStorage",typeof u!="undefined"&&(window.SmartStorage=u),typeof Formio!="undefined"&&(Formio.providers=Formio.providers||{},Formio.providers.storage=Formio.providers.storage||{},Formio.providers.storage.SmartStorage=u,Formio.providers.storage.smartstorage=u,Formio.Providers&&Formio.Providers.addProviders("storage",{SmartStorage:u,smartstorage:u}),document.dispatchEvent(new CustomEvent("smartStorageReady",{detail:{SmartStorage:u}})))})();</script>
36662
37200
  <script>(function(){(function(i,w){typeof exports=="object"&&typeof module!="undefined"?w(exports):typeof define=="function"&&define.amd?define(["exports"],w):w((i=typeof globalThis!="undefined"?globalThis:i||self).uuid={})})(this,function(i){"use strict";var w,B=new Uint8Array(16);function N(){if(!w&&!(w=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return w(B)}var F=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function I(r){return typeof r=="string"&&F.test(r)}for(var _,k,v=[],S=0;S<256;++S)v.push((S+256).toString(16).substr(1));function C(r){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,c=(v[r[l+0]]+v[r[l+1]]+v[r[l+2]]+v[r[l+3]]+"-"+v[r[l+4]]+v[r[l+5]]+"-"+v[r[l+6]]+v[r[l+7]]+"-"+v[r[l+8]]+v[r[l+9]]+"-"+v[r[l+10]]+v[r[l+11]]+v[r[l+12]]+v[r[l+13]]+v[r[l+14]]+v[r[l+15]]).toLowerCase();if(!I(c))throw TypeError("Stringified UUID is invalid");return c}var j=0,q=0;function O(r){if(!I(r))throw TypeError("Invalid UUID");var l,c=new Uint8Array(16);return c[0]=(l=parseInt(r.slice(0,8),16))>>>24,c[1]=l>>>16&255,c[2]=l>>>8&255,c[3]=255&l,c[4]=(l=parseInt(r.slice(9,13),16))>>>8,c[5]=255&l,c[6]=(l=parseInt(r.slice(14,18),16))>>>8,c[7]=255&l,c[8]=(l=parseInt(r.slice(19,23),16))>>>8,c[9]=255&l,c[10]=(l=parseInt(r.slice(24,36),16))/1099511627776&255,c[11]=l/4294967296&255,c[12]=l>>>24&255,c[13]=l>>>16&255,c[14]=l>>>8&255,c[15]=255&l,c}function P(r,l,c){function n(d,u,e,s){if(typeof d=="string"&&(d=function(o){o=unescape(encodeURIComponent(o));for(var m=[],p=0;p<o.length;++p)m.push(o.charCodeAt(p));return m}(d)),typeof u=="string"&&(u=O(u)),u.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var t=new Uint8Array(16+d.length);if(t.set(u),t.set(d,u.length),(t=c(t))[6]=15&t[6]|l,t[8]=63&t[8]|128,e){s=s||0;for(var f=0;f<16;++f)e[s+f]=t[f];return e}return C(t)}try{n.name=r}catch(d){}return n.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",n.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",n}function $(r){return 14+(r+64>>>9<<4)+1}function b(r,l){var c=(65535&r)+(65535&l);return(r>>16)+(l>>16)+(c>>16)<<16|65535&c}function R(r,l,c,n,d,u){return b((e=b(b(l,r),b(n,u)))<<(s=d)|e>>>32-s,c);var e,s}function h(r,l,c,n,d,u,e){return R(l&c|~l&n,r,l,d,u,e)}function y(r,l,c,n,d,u,e){return R(l&n|c&~n,r,l,d,u,e)}function a(r,l,c,n,d,u,e){return R(l^c^n,r,l,d,u,e)}function g(r,l,c,n,d,u,e){return R(c^(l|~n),r,l,d,u,e)}var G=P("v3",48,function(r){if(typeof r=="string"){var l=unescape(encodeURIComponent(r));r=new Uint8Array(l.length);for(var c=0;c<l.length;++c)r[c]=l.charCodeAt(c)}return function(n){for(var d=[],u=32*n.length,e="0123456789abcdef",s=0;s<u;s+=8){var t=n[s>>5]>>>s%32&255,f=parseInt(e.charAt(t>>>4&15)+e.charAt(15&t),16);d.push(f)}return d}(function(n,d){n[d>>5]|=128<<d%32,n[$(d)-1]=d;for(var u=1732584193,e=-271733879,s=-1732584194,t=271733878,f=0;f<n.length;f+=16){var o=u,m=e,p=s,U=t;u=h(u,e,s,t,n[f],7,-680876936),t=h(t,u,e,s,n[f+1],12,-389564586),s=h(s,t,u,e,n[f+2],17,606105819),e=h(e,s,t,u,n[f+3],22,-1044525330),u=h(u,e,s,t,n[f+4],7,-176418897),t=h(t,u,e,s,n[f+5],12,1200080426),s=h(s,t,u,e,n[f+6],17,-1473231341),e=h(e,s,t,u,n[f+7],22,-45705983),u=h(u,e,s,t,n[f+8],7,1770035416),t=h(t,u,e,s,n[f+9],12,-1958414417),s=h(s,t,u,e,n[f+10],17,-42063),e=h(e,s,t,u,n[f+11],22,-1990404162),u=h(u,e,s,t,n[f+12],7,1804603682),t=h(t,u,e,s,n[f+13],12,-40341101),s=h(s,t,u,e,n[f+14],17,-1502002290),u=y(u,e=h(e,s,t,u,n[f+15],22,1236535329),s,t,n[f+1],5,-165796510),t=y(t,u,e,s,n[f+6],9,-1069501632),s=y(s,t,u,e,n[f+11],14,643717713),e=y(e,s,t,u,n[f],20,-373897302),u=y(u,e,s,t,n[f+5],5,-701558691),t=y(t,u,e,s,n[f+10],9,38016083),s=y(s,t,u,e,n[f+15],14,-660478335),e=y(e,s,t,u,n[f+4],20,-405537848),u=y(u,e,s,t,n[f+9],5,568446438),t=y(t,u,e,s,n[f+14],9,-1019803690),s=y(s,t,u,e,n[f+3],14,-187363961),e=y(e,s,t,u,n[f+8],20,1163531501),u=y(u,e,s,t,n[f+13],5,-1444681467),t=y(t,u,e,s,n[f+2],9,-51403784),s=y(s,t,u,e,n[f+7],14,1735328473),u=a(u,e=y(e,s,t,u,n[f+12],20,-1926607734),s,t,n[f+5],4,-378558),t=a(t,u,e,s,n[f+8],11,-2022574463),s=a(s,t,u,e,n[f+11],16,1839030562),e=a(e,s,t,u,n[f+14],23,-35309556),u=a(u,e,s,t,n[f+1],4,-1530992060),t=a(t,u,e,s,n[f+4],11,1272893353),s=a(s,t,u,e,n[f+7],16,-155497632),e=a(e,s,t,u,n[f+10],23,-1094730640),u=a(u,e,s,t,n[f+13],4,681279174),t=a(t,u,e,s,n[f],11,-358537222),s=a(s,t,u,e,n[f+3],16,-722521979),e=a(e,s,t,u,n[f+6],23,76029189),u=a(u,e,s,t,n[f+9],4,-640364487),t=a(t,u,e,s,n[f+12],11,-421815835),s=a(s,t,u,e,n[f+15],16,530742520),u=g(u,e=a(e,s,t,u,n[f+2],23,-995338651),s,t,n[f],6,-198630844),t=g(t,u,e,s,n[f+7],10,1126891415),s=g(s,t,u,e,n[f+14],15,-1416354905),e=g(e,s,t,u,n[f+5],21,-57434055),u=g(u,e,s,t,n[f+12],6,1700485571),t=g(t,u,e,s,n[f+3],10,-1894986606),s=g(s,t,u,e,n[f+10],15,-1051523),e=g(e,s,t,u,n[f+1],21,-2054922799),u=g(u,e,s,t,n[f+8],6,1873313359),t=g(t,u,e,s,n[f+15],10,-30611744),s=g(s,t,u,e,n[f+6],15,-1560198380),e=g(e,s,t,u,n[f+13],21,1309151649),u=g(u,e,s,t,n[f+4],6,-145523070),t=g(t,u,e,s,n[f+11],10,-1120210379),s=g(s,t,u,e,n[f+2],15,718787259),e=g(e,s,t,u,n[f+9],21,-343485551),u=b(u,o),e=b(e,m),s=b(s,p),t=b(t,U)}return[u,e,s,t]}(function(n){if(n.length===0)return[];for(var d=8*n.length,u=new Uint32Array($(d)),e=0;e<d;e+=8)u[e>>5]|=(255&n[e/8])<<e%32;return u}(r),8*r.length))});function H(r,l,c,n){switch(r){case 0:return l&c^~l&n;case 1:return l^c^n;case 2:return l&c^l&n^c&n;case 3:return l^c^n}}function x(r,l){return r<<l|r>>>32-l}var J=P("v5",80,function(r){var l=[1518500249,1859775393,2400959708,3395469782],c=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof r=="string"){var n=unescape(encodeURIComponent(r));r=[];for(var d=0;d<n.length;++d)r.push(n.charCodeAt(d))}else Array.isArray(r)||(r=Array.prototype.slice.call(r));r.push(128);for(var u=r.length/4+2,e=Math.ceil(u/16),s=new Array(e),t=0;t<e;++t){for(var f=new Uint32Array(16),o=0;o<16;++o)f[o]=r[64*t+4*o]<<24|r[64*t+4*o+1]<<16|r[64*t+4*o+2]<<8|r[64*t+4*o+3];s[t]=f}s[e-1][14]=8*(r.length-1)/Math.pow(2,32),s[e-1][14]=Math.floor(s[e-1][14]),s[e-1][15]=8*(r.length-1)&4294967295;for(var m=0;m<e;++m){for(var p=new Uint32Array(80),U=0;U<16;++U)p[U]=s[m][U];for(var A=16;A<80;++A)p[A]=x(p[A-3]^p[A-8]^p[A-14]^p[A-16],1);for(var E=c[0],M=c[1],T=c[2],D=c[3],L=c[4],V=0;V<80;++V){var z=Math.floor(V/20),K=x(E,5)+H(z,M,T,D)+L+l[z]+p[V]>>>0;L=D,D=T,T=x(M,30)>>>0,M=E,E=K}c[0]=c[0]+E>>>0,c[1]=c[1]+M>>>0,c[2]=c[2]+T>>>0,c[3]=c[3]+D>>>0,c[4]=c[4]+L>>>0}return[c[0]>>24&255,c[0]>>16&255,c[0]>>8&255,255&c[0],c[1]>>24&255,c[1]>>16&255,c[1]>>8&255,255&c[1],c[2]>>24&255,c[2]>>16&255,c[2]>>8&255,255&c[2],c[3]>>24&255,c[3]>>16&255,c[3]>>8&255,255&c[3],c[4]>>24&255,c[4]>>16&255,c[4]>>8&255,255&c[4]]});i.NIL="00000000-0000-0000-0000-000000000000",i.parse=O,i.stringify=C,i.v1=function(r,l,c){var n=l&&c||0,d=l||new Array(16),u=(r=r||{}).node||_,e=r.clockseq!==void 0?r.clockseq:k;if(u==null||e==null){var s=r.random||(r.rng||N)();u==null&&(u=_=[1|s[0],s[1],s[2],s[3],s[4],s[5]]),e==null&&(e=k=16383&(s[6]<<8|s[7]))}var t=r.msecs!==void 0?r.msecs:Date.now(),f=r.nsecs!==void 0?r.nsecs:q+1,o=t-j+(f-q)/1e4;if(o<0&&r.clockseq===void 0&&(e=e+1&16383),(o<0||t>j)&&r.nsecs===void 0&&(f=0),f>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");j=t,q=f,k=e;var m=(1e4*(268435455&(t+=122192928e5))+f)%4294967296;d[n++]=m>>>24&255,d[n++]=m>>>16&255,d[n++]=m>>>8&255,d[n++]=255&m;var p=t/4294967296*1e4&268435455;d[n++]=p>>>8&255,d[n++]=255&p,d[n++]=p>>>24&15|16,d[n++]=p>>>16&255,d[n++]=e>>>8|128,d[n++]=255&e;for(var U=0;U<6;++U)d[n+U]=u[U];return l||C(d)},i.v3=G,i.v4=function(r,l,c){var n=(r=r||{}).random||(r.rng||N)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,l){c=c||0;for(var d=0;d<16;++d)l[c+d]=n[d];return l}return C(n)},i.v5=J,i.validate=I,i.version=function(r){if(!I(r))throw TypeError("Invalid UUID");return parseInt(r.substr(14,1),16)},Object.defineProperty(i,"__esModule",{value:!0})})})();</script>
36663
- <script>(function(){logger.info("[TF_SDK:68] \u2705 Script loading started");var j=Formio.Components;const q=()=>({components:[]}),J=Promise;var R=Formio.Utils,K=window._,L,A=navigator.camera||L,W=R.uniqueName,Q=Formio.Components.components.field;const U=Formio.Components.components.field;U||logger.error("[TF_SDK:69] \u274C FieldComponent is undefined!");const Z=Formio.Templates;let N="",P=!1;const ee=["image/gif","image/jpeg","image/png"],G=R.getComponentSavedTypes,X=R.componentValueTypes;let $=!1;const M=typeof navigator!="undefined"&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);function V(D,e,t){return logger.info(`[TF_SDK:80a] \u{1F4BE} updateFileInIndexedDB called for id: ${D}, file: ${t}, size: ${(e.size/1024).toFixed(1)} KB`),D?e?new Promise((s,o)=>{logger.info("[TF_SDK:80d] \u{1F513} Opening IndexedDB 'Forms-Attachments' (v3)...");const n=indexedDB.open("Forms-Attachments",3);n.onupgradeneeded=c=>{const i=c.target.result;i.objectStoreNames.contains("Files")||i.createObjectStore("Files")},n.onerror=()=>{logger.error("[TF_SDK:80e] \u274C Failed to open IndexedDB:",n.error),o(n.error)},n.onsuccess=c=>{const i=c.target.result;if(logger.info("[TF_SDK:80f] \u2705 IndexedDB 'Forms-Attachments' opened. Reading Blob as DataURL..."),!i.objectStoreNames.contains("Files"))return i.close(),logger.error("[TF_SDK:80g] \u274C Files store not found in IndexedDB"),o(new Error("[TF_SDK] Files store not found in IndexedDB"));const r=new FileReader;r.onerror=()=>{logger.error("[TF_SDK:80h] \u274C FileReader error:",r.error),o(r.error)},r.onload=d=>{const a=d.target.result;logger.info(`[TF_SDK:80i] \u{1F4DD} FileReader finished. DataURL length: ${a.length}. Executing readwrite transaction on store 'Files'...`);try{const l=i.transaction(["Files"],"readwrite"),p=l.objectStore("Files"),u=p.get(D);u.onsuccess=()=>{const w=u.result||{},m={...w,id:D,data:e,name:w.name||t,size:e.size,type:e.type||"image/jpeg",url:a,mode:"A"},f=p.put(m,D);f.onerror=()=>{logger.error("[TF_SDK:80j] \u274C updateFileInIndexedDB put failed:",f.error),i.close(),o(f.error)}},u.onerror=()=>{logger.error("[TF_SDK:80k] \u274C updateFileInIndexedDB get failed:",u.error),i.close(),o(u.error)},l.oncomplete=()=>{logger.info(`[TF_SDK:80l] \u2705 IndexedDB transaction committed! Record updated in-place (mode=A): id=${D}, file=${t}, size=${(e.size/1024).toFixed(1)} KB`);try{const f=i.transaction(["Files"],"readonly").objectStore("Files").get(D);f.onsuccess=()=>{var h,y;const g=f.result;g?logger.info(`[TF_SDK:80m] \u{1F50D} Live IndexedDB Record Verified: ID="${g.id}", Name="${g.name}", Size=${(g.size/1024).toFixed(1)} KB (${g.size} bytes), BlobSize=${(((h=g.data)==null?void 0:h.size)/1024).toFixed(1)} KB, DataURLLength=${(y=g.url)==null?void 0:y.length}, Mode="${g.mode}"`):logger.warn(`[TF_SDK:80n] \u26A0\uFE0F Record not found on verify read for ID: ${D}`),i.close(),s({id:D,url:a,name:t,size:e.size,type:e.type,mode:"A"})},f.onerror=()=>{i.close(),s({id:D,url:a,name:t,size:e.size,type:e.type,mode:"A"})}}catch(w){i.close(),s({id:D,url:a,name:t,size:e.size,type:e.type,mode:"A"})}},l.onerror=()=>{logger.error("[TF_SDK:80o] \u274C updateFileInIndexedDB transaction error:",l.error),i.close(),o(l.error)},l.onabort=()=>{logger.error("[TF_SDK:80p] \u274C Transaction aborted:",l.error),i.close(),o(l.error||new Error("Transaction aborted"))}}catch(l){logger.error("[TF_SDK:80q] \u274C Exception during transaction:",l),i.close(),o(l)}},r.readAsDataURL(e)}}):(logger.error("[TF_SDK:80c] \u274C blob is required for updateFileInIndexedDB"),Promise.reject(new Error("[TF_SDK] blob is required for updateFileInIndexedDB"))):(logger.error("[TF_SDK:80b] \u274C existingId is required for updateFileInIndexedDB"),Promise.reject(new Error("[TF_SDK] existingId is required for updateFileInIndexedDB")))}function O(D){return logger.info(`[TF_SDK:IDB-D0] \u2705 deleteFileInIndexedDB called for id: ${D}`),D?new Promise((e,t)=>{const s=indexedDB.open("Forms-Attachments",3);s.onupgradeneeded=o=>{const n=o.target.result;n.objectStoreNames.contains("Files")||n.createObjectStore("Files")},s.onerror=()=>t(s.error),s.onsuccess=o=>{const n=o.target.result;if(!n.objectStoreNames.contains("Files"))return n.close(),t(new Error("[TF_SDK] Files store not found in IndexedDB"));try{const c=n.transaction(["Files"],"readwrite"),i=c.objectStore("Files"),r=i.get(D);r.onsuccess=()=>{const d=r.result||{id:D};d.mode="D",i.put(d,D)},c.oncomplete=()=>{logger.info(`[TF_SDK:IDB-D2] \u2705 IndexedDB record marked mode='D': id=${D}`),n.close(),e({id:D,mode:"D"})},c.onerror=()=>{logger.error("[TF_SDK:IDB-D3] \u274C deleteFileInIndexedDB transaction error:",c.error),n.close(),t(c.error)}}catch(c){logger.error("[TF_SDK:IDB-D4] \u274C Exception during transaction:",c),n.close(),t(c)}}}):Promise.reject(new Error("[TF_SDK] existingId is required for deleteFileInIndexedDB"))}typeof window!="undefined"&&(window.updateFileInIndexedDB=V,window.deleteFileInIndexedDB=O);let E;typeof window!="undefined"?E=window.HTMLCanvasElement:typeof globalThis!="undefined"&&(E=globalThis.HTMLCanvasElement),E&&!E.prototype.toBlob&&Object.defineProperty(E.prototype,"toBlob",{value:function(D,e,t){var s=this;setTimeout(function(){for(var o=atob(s.toDataURL(e,t).split(",")[1]),n=o.length,c=new Uint8Array(n),i=0;i<n;i++)c[i]=o.charCodeAt(i);D(new Blob([c],{type:e||"image/png"}))})}});const Y=()=>Math.random().toString(36).substring(2,15);class x extends U{static schema(...e){return U.schema({type:"file",label:"Upload",key:"file",image:!1,privateDownload:!1,imageSize:"200",filePattern:"*",fileMinSize:"0KB",fileMaxSize:"1GB",uploadOnly:!1},...e)}static get builderInfo(){return{title:"File",group:"premium",icon:"file",documentation:"/userguide/#file",weight:100,schema:x.schema()}}static get serverConditionSettings(){return U.conditionOperatorsSettings}static get conditionOperatorsSettings(){return{...super.conditionOperatorsSettings,operators:["isEmpty","isNotEmpty"]}}static savedValueTypes(e){return e=e||{},G(e)||[X.object]}constructor(e,t,s){super(e,t,s),logger.info(`[TF_SDK:70] \u2705 Constructor called for key: ${e.key}`),this.statuses=[],this.fileDropHidden=!1,this.filesToSync={filesToUpload:[],filesToDelete:[]},this.isSyncing=!1,this.abortUploads=[],this.pendingfiles=[],this.resolvedFiles=[]}init(){super.init(),A=navigator.camera||L;const e=typeof FileReader!="undefined",t=typeof window!="undefined"?!!window.FormData:!1,s=typeof window!="undefined"&&window.XMLHttpRequest?"upload"in new XMLHttpRequest:!1;this.support={filereader:e,formdata:t,hasWarning:!e||!t||!s,progress:s},this.cameraMode=!1}get dataReady(){return this.filesReady||Promise.resolve()}get defaultSchema(){return x.schema()}loadImage(e){return this.component.privateDownload&&(e.private=!0),this.fileService.downloadFile(e,this.component).then(t=>t.url)}get emptyValue(){return[]}getValueAsString(e,t){return t!=null&&t.review&&!this.component.uploadOnly?K.map(e,(s,o)=>`<a href="${s.url||"#"}" target="_blank" data-path='${this.path}' data-fileindex='${o}'>${s.originalName}</a>`).join(", "):K.isArray(e)?K.map(e,"originalName").join(", "):K.get(e,"originalName","")}getValue(){return this.dataValue}get defaultValue(){const e=super.defaultValue;return Array.isArray(e)?e:[]}get hasTypes(){return this.component.fileTypes&&Array.isArray(this.component.fileTypes)&&this.component.fileTypes.length!==0&&(this.component.fileTypes[0].label!==""||this.component.fileTypes[0].value!=="")}get fileDropHidden(){return this._fileBrowseHidden}set fileDropHidden(e){typeof e!="boolean"||this.component.multiple||(this._fileBrowseHidden=e)}get shouldSyncFiles(){return!!(this.filesToSync.filesToDelete.length||this.filesToSync.filesToUpload.length)}get autoSync(){return!1}get columnsSize(){const e=this.disabled?0:this.autoSync?2:1,t=this.hasTypes?2:0,s=2;return{name:12-e-t-s,size:s,type:t,actions:e}}render(){const{filesToDelete:e,filesToUpload:t}=this.filesToSync;return logger.info(`[TF_SDK:71] \u2705 render() called for key: ${this.component.key}`,{filesCount:(this.dataValue||[]).length,isSyncing:this.isSyncing}),super.render(this.renderTemplate("file",{fileSize:this.fileSize,files:this.dataValue||[],filesToDelete:e,filesToUpload:t,disabled:this.disabled,support:this.support,fileDropHidden:this.fileDropHidden,showSyncButton:this.autoSync&&(e.length||t.length),isSyncing:this.isSyncing,columns:this.columnsSize}))}getVideoStream(e){const t={audio:!1,video:{width:{min:640,ideal:1920},height:{min:360,ideal:1080},aspectRatio:{ideal:1.7777777777777777},...e}};return navigator.mediaDevices.getUserMedia(t)}stopVideoStream(e){e.getVideoTracks().forEach(t=>t.stop())}getFrame(e){return new Promise(t=>{const s=document.createElement("canvas");s.height=e.videoHeight,s.width=e.videoWidth,s.getContext("2d").drawImage(e,0,0),s.toBlob(t)})}startVideo(){this._cameraMode=!1}stopVideo(){this.videoStream&&(this.stopVideoStream(this.videoStream),this.videoStream=null),this._cameraMode=!1}takePicture(){let e=this.id;P=!1,window.isListenerSet=!1;let t=new CustomEvent("openCamera",{detail:{controlId:e}});document.dispatchEvent(t)}browseFiles(e={}){return new Promise(t=>{const s=this.ce("input",{type:"file",style:"height: 0; width: 0; visibility: hidden;",tabindex:"-1",...e});document.body.appendChild(s),this.addEventListener(s,"change",o=>{logger.info(`[TF_SDK:74] \u2705 Native file input change event triggered with ${o.target.files.length} files`),t(o.target.files),document.body.removeChild(s)},!0),typeof s.trigger=="function"?s.trigger("click"):s.click()})}set cameraMode(e){this._cameraMode=!1}get cameraMode(){return!1}get useWebViewCamera(){return this.imageUpload&&A}get imageUpload(){return!!this.component.image}get browseOptions(){const e={};this.component.multiple&&(e.multiple=!0),this.component.capture&&(e.capture=this.component.capture);const t=this.component.filePattern.trim()||"";if(this.isMobile.any)this.component.capture&&(t.includes("video")?e.accept="video/*":t.includes("audio")?e.accept="audio/*":e.accept="image/*");else{const s="image/*";this.imageUpload&&(!t||t==="*")?e.accept=s:this.imageUpload&&!t.includes(s)?e.accept=`${s},${t}`:e.accept=t}return e}get actions(){return{abort:this.abortRequest.bind(this)}}attach(e){logger.info(`[TF_SDK:75] \u2705 attach() called for key: ${this.component.key}`),this.loadRefs(e,{fileDrop:"single",fileBrowse:"single",galleryButton:"single",cameraButton:"single",takePictureButton:"single",toggleCameraMode:"single",videoPlayer:"single",fileLink:"multiple",removeLink:"multiple",fileToSyncRemove:"multiple",fileImage:"multiple",fileType:"multiple",fileProcessingLoader:"single",FileView:"multiple",DownloadFile:"multiple",syncNow:"single",restoreFile:"multiple",progress:"multiple",cropImage:"multiple",annotateImage:"multiple"}),this.refs.input=[];const t=super.attach(e);if(this.refs.fileDrop){const i=this;this.addEventListener(this.refs.fileDrop,"dragover",r=>{this.refs.fileDrop.className="fileSelector fileDragOver",r.preventDefault()}),this.addEventListener(this.refs.fileDrop,"dragleave",r=>{this.refs.fileDrop.className="fileSelector",r.preventDefault()}),this.addEventListener(this.refs.fileDrop,"drop",r=>{this.refs.fileDrop.className="fileSelector",r.preventDefault(),$=!1;const d=[],a=r.dataTransfer.files;for(let l=0;l<a.length;l++)d.push(a[l]);this.processAndUpload(d)}),this.addEventListener(this.refs.fileDrop,"click",r=>{r.target.tagName==="A"||r.target.closest("a")||r.target.closest("button")||r.target.closest&&(r.target.closest('[ref="cameraButton"]')||r.target.closest('[ref="toggleCameraMode"]')||r.target.closest('[ref="galleryButton"]'))||(r.preventDefault(),!(!this.component.multiple&&this.statuses.some(d=>d.status==="progress"))&&(this.statuses=[],this.browseFiles(this.browseOptions).then(d=>{$=!1;const a=[];for(let l=0;l<d.length;l++){let p=d[l];a.push(new Promise(u=>{const w=new FileReader;w.onloadend=m=>{const f=new Blob([new Uint8Array(m.target.result)],{type:p.type});f.name=p.name,f.lastModified=p.lastModified,f.lastModifiedDate=p.lastModifiedDate,P=!0,this.compressFile([f])},w.readAsArrayBuffer(p)}))}})))})}if(this.addEventListener(e,"click",i=>{this.handleAction(i)}),this.refs.fileBrowse&&this.addEventListener(this.refs.fileBrowse,"click",i=>{i.preventDefault(),!(!this.component.multiple&&this.statuses.some(r=>r.status==="progress"))&&(this.statuses=[],this.browseFiles(this.browseOptions).then(r=>{$=!1;const d=[];for(let a=0;a<r.length;a++){let l=r[a];d.push(new Promise(p=>{const u=new FileReader;u.onloadend=w=>{const m=new Blob([new Uint8Array(w.target.result)],{type:l.type});m.name=l.name,m.lastModified=l.lastModified,m.lastModifiedDate=l.lastModifiedDate,p(m)},u.readAsArrayBuffer(l)}))}Promise.all(d).then(a=>{logger.info(`[TF_SDK:76] \u2705 Selected ${a.length} files from browser`),P=!0,this.processAndUpload(a)})}))}),this.refs.fileLink&&this.refs.fileLink.forEach((i,r)=>{this.addEventListener(i,"click",d=>{d.preventDefault(),this.getFile(this.dataValue[r])})}),this.refs.removeLink&&this.refs.removeLink.forEach((i,r)=>{this.addEventListener(i,"click",d=>{d.preventDefault();const a=this.dataValue[r];this.handleFileToRemove(a)})}),this.refs.fileImage&&this.refs.fileImage.forEach((i,r)=>{this.addEventListener(i,"click",d=>{const a=this.dataValue[r];let l=new CustomEvent("openImagePreview",{detail:{data:a}});logger.info("[TF_SDK:78] \u2705 dispatching openImagePreview event"),document.dispatchEvent(l)})}),this.refs.cropImage&&this.refs.cropImage.forEach((i,r)=>{this.addEventListener(i,"click",d=>{var f;let a=this;const l=this.dataValue[r];logger.info(`[TF_SDK:81a] \u2702\uFE0F Crop button clicked for file: "${(l==null?void 0:l.originalName)||(l==null?void 0:l.name)}", index=${r}, ID=${l==null?void 0:l.id}`);let p=null;if(a.refs.fileImage&&a.refs.fileImage[r])p=a.refs.fileImage[r];else{const g=document.getElementsByClassName("fileImageData");for(var u=0;u<g.length;u++)if(g[u].alt==l.originalName&&(g[u].id==l.compnentId||a.component.key==l.key)){p=g[u];break}!p&&g.length>0&&(p=g[0])}p?(logger.info(`[TF_SDK:81b] \u{1F3AF} Target image element found for crop: src length=${((f=p.src)==null?void 0:f.length)||0}`),w(p)):logger.error("[TF_SDK:81c] \u274C Target image element not found for crop");function w(g){logger.info("[TF_SDK:81d] \u{1F5BC}\uFE0F Opening Cropro Crop modal UI..."),new cropro.Activator.addKey("CRPR-P238-M097-0451");const h=new cropro.CropArea(g);h.displayMode="popup",h.renderImageType="image/jpeg",h.renderImageQuality=.8,h.styles.settings.toolbarBackgroundColor="#2586c7",h.styles.settings.toolbarBackgroundHoverColor="#286f9f",h.addRenderEventListener(y=>{g.src=y,logger.info(`[TF_SDK:81e] \u{1F4BE} User clicked Crop Save (\u2713 right checkmark)! Rendered Base64 DataURL length=${y.length}`),a.dataValue[r].url=y,m(y.split(",")[1],"image/jpeg",a.dataValue[r].originalName)}),h.addCloseEventListener(()=>{logger.info("[TF_SDK:81f] \u{1F6AA} Crop modal closed.")}),h.show()}async function m(g,h,y){const I=atob(g),B=new Uint8Array(I.length);for(let S=0;S<I.length;S++)B[S]=I.charCodeAt(S);const v=new Blob([B],{type:h||"image/jpeg"});if(v.name=y,logger.info(`[TF_SDK:81g] \u2705 Cropped image Blob created. Size: ${(v.size/1024).toFixed(1)} KB (${(v.size/1024/1024).toFixed(2)} MB), Type: ${v.type}`),typeof imageCompression=="function")try{logger.info("[TF_SDK:81h] \u26A1 Compressing cropped image Blob...");const S=await imageCompression(v,{maxSizeMB:.2,maxWidthOrHeight:1600,useWebWorker:!M});S.name=y,logger.info(`[TF_SDK:81i] \u26A1 Cropped image compressed: ${(v.size/1024).toFixed(1)} KB -> ${(S.size/1024).toFixed(1)} KB`),v=S}catch(S){logger.warn("[TF_SDK:81j] \u26A0\uFE0F Compression failed for cropped image:",S)}logger.info(`[TF_SDK:81k] \u2705 Final cropped image size ready for IndexedDB update: ${(v.size/1024).toFixed(1)} KB`);const _=a.dataValue[r],F=_&&(_.id||_.uid||_._id);F?(logger.info(`[TF_SDK:81l] \u{1F4BE} Initiating in-place update in IndexedDB for ID: ${F}, File: "${y}"`),V(F,v,y).then(S=>{var k,b;if(logger.info(`[TF_SDK:81m] \u2705 IndexedDB updated in-place (crop) successfully for: "${y}", ID: ${F}`),a.dataValue[r]={...a.dataValue[r],url:S.url,size:S.size,mode:S.mode,originalName:y},a.resolvedFiles&&Array.isArray(a.resolvedFiles)){const T=a.resolvedFiles.find(C=>{var z,H;return((z=C.fileInfo)==null?void 0:z.id)===F||((H=C.fileInfo)==null?void 0:H.originalName)===y});T&&(T.fileInfo&&(T.fileInfo.size=S.size,T.fileInfo.url=S.url,T.fileInfo.mode=S.mode),T.fileToSync&&(T.fileToSync.size=S.size,T.fileToSync.file=v))}if((k=a.filesToSync)!=null&&k.filesToUpload&&Array.isArray(a.filesToSync.filesToUpload)){const T=a.filesToSync.filesToUpload.find(C=>C.id===F||C.originalName===y);T&&(T.size=S.size,T.file=v)}logger.info("[TF_SDK:81n] \u{1F504} Triggering component change and redrawing UI with updated cropped image..."),(b=a.triggerChange)==null||b.call(a,{modified:!0}),a.redraw(),logger.info("[TF_SDK:81o] \u2705 UI redraw completed. Cropped image process finished.")}).catch(S=>{logger.error("[TF_SDK:81p] \u274C updateFileInIndexedDB (crop) failed:",S)})):logger.warn(`[TF_SDK:81q] \u26A0\uFE0F No existingId found for crop update (index=${r})`)}})}),this.refs.annotateImage&&this.refs.annotateImage.forEach((i,r)=>{this.addEventListener(i,"click",d=>{let a=this;const l=this.dataValue[r];logger.info("[TF_SDK:82] \u2705 annotateImage clicked");let p=null;if(a.refs.fileImage&&a.refs.fileImage[r])p=a.refs.fileImage[r];else{const f=document.getElementsByClassName("fileImageData");for(var u=0;u<f.length;u++)if(f[u].alt==l.originalName&&(f[u].id==l.compnentId||a.component.key==l.key)){p=f[u];break}!p&&f.length>0&&(p=f[0])}p?w(p):logger.error("[TF_SDK:82a] \u274C Target image element not found for annotate");function w(f){new markerjs2.Activator.addKey("MJS2-P013-M397-4100");const g=new markerjs2.MarkerArea(f);g.settings.displayMode="popup",g.uiStyleSettings.toolbarBackgroundColor="#2586c7",g.uiStyleSettings.toolbarBackgroundHoverColor="#286f9f",g.addRenderEventListener(h=>{f.src=h,a.dataValue[r].url=h,m(h.split(",")[1],"image/jpeg",a.dataValue[r].originalName)}),g.show()}async function m(f,g,h){g=g||"image/jpeg";const y=atob(f),I=new Uint8Array(y.length);for(let F=0;F<y.length;F++)I[F]=y.charCodeAt(F);let B=new Blob([I],{type:g});if(B.name=h,typeof imageCompression=="function")try{const F=await imageCompression(B,{maxSizeMB:.2,maxWidthOrHeight:1600,useWebWorker:!M});F.name=h,logger.info(`[TF_SDK:83] \u26A1 Compressed annotated image: ${B.size} -> ${F.size} bytes`),B=F}catch(F){logger.warn("[TF_SDK:83a] \u26A0\uFE0F Compression failed:",F)}logger.info(`[TF_SDK:83b] \u2705 Annotated Image file size ${B.size/1024/1024} MB`);const v=a.dataValue[r],_=v&&(v.id||v.uid||v._id);_?V(_,B,h).then(F=>{var S,k;if(logger.info(`[TF_SDK:83c] \u2705 IndexedDB updated in-place (annotate) for: ${h}`),a.dataValue[r]={...a.dataValue[r],url:F.url,size:F.size,mode:F.mode,originalName:h},a.resolvedFiles&&Array.isArray(a.resolvedFiles)){const b=a.resolvedFiles.find(T=>{var C,z;return((C=T.fileInfo)==null?void 0:C.id)===_||((z=T.fileInfo)==null?void 0:z.originalName)===h});b&&(b.fileInfo&&(b.fileInfo.size=F.size,b.fileInfo.url=F.url,b.fileInfo.mode=F.mode),b.fileToSync&&(b.fileToSync.size=F.size,b.fileToSync.file=B))}if((S=a.filesToSync)!=null&&S.filesToUpload&&Array.isArray(a.filesToSync.filesToUpload)){const b=a.filesToSync.filesToUpload.find(T=>T.id===_||T.originalName===h);b&&(b.size=F.size,b.file=B)}(k=a.triggerChange)==null||k.call(a,{modified:!0}),a.redraw()}).catch(F=>{logger.error("[TF_SDK:83d] \u274C updateFileInIndexedDB (annotate) failed:",F)}):logger.warn(`[TF_SDK:83e] \u26A0\uFE0F No existingId found for annotate update (index=${r})`)}})}),this.refs.fileToSyncRemove&&this.refs.fileToSyncRemove.forEach((i,r)=>{this.addEventListener(i,"click",d=>{d.preventDefault(),this.filesToSync.filesToUpload.splice(r,1),this.redraw()})}),this.refs.fileStatusRemove&&this.refs.fileStatusRemove.forEach((i,r)=>{this.addEventListener(i,"click",d=>{d.preventDefault(),this.abortUpload&&this.abortUpload(),this.statuses.splice(r,1),this.redraw()})}),this.refs.restoreFile&&this.refs.restoreFile.forEach((i,r)=>{this.addEventListener(i,"click",d=>{var l;d.preventDefault();const a=this.filesToSync.filesToDelete[r];delete a.status,delete a.message,this.filesToSync.filesToDelete.splice(r,1),this.dataValue.push(a),(l=this.triggerChange)==null||l.call(this),this.redraw()})}),this.refs.galleryButton&&A&&this.addEventListener(this.refs.galleryButton,"click",i=>{i.preventDefault(),A.getPicture(r=>{window.resolveLocalFileSystemURL(r,d=>{d.file(a=>{const l=new FileReader;l.onloadend=p=>{const u=new Blob([new Uint8Array(p.target.result)],{type:a.type});u.name=a.name,$=!1,this.processAndUpload([u])},l.readAsArrayBuffer(a)})})},r=>{logger.error(r)},{sourceType:A.PictureSourceType.PHOTOLIBRARY})}),this.refs.cameraButton&&this.addEventListener(this.refs.cameraButton,"click",i=>{i.preventDefault(),i.stopPropagation(),typeof i.stopImmediatePropagation=="function"&&i.stopImmediatePropagation();let r=this.id;P=!1,window.isListenerSet=!1;let d=new CustomEvent("openCamera",{detail:{controlId:r}});window.parent&&window.parent!==window&&window.parent.postMessage({type:"OPEN_CAMERA",data:{controlId:r},status:"sucess",message:"camera triggerd"},"*"),logger.info("[TF_SDK:84a] \u2705 Dispatching openCamera event for controlId:",r),document.dispatchEvent(d)}),this.refs.takePictureButton&&this.addEventListener(this.refs.takePictureButton,"click",i=>{i.preventDefault(),i.stopPropagation(),this.takePicture()}),this.refs.toggleCameraMode&&this.addEventListener(this.refs.toggleCameraMode,"click",i=>{i.preventDefault(),i.stopPropagation(),typeof i.stopImmediatePropagation=="function"&&i.stopImmediatePropagation();let r=this.id;P=!1,window.isListenerSet=!1;let d=new CustomEvent("openCamera",{detail:{controlId:r}});window.parent&&window.parent!==window&&window.parent.postMessage({type:"OPEN_CAMERA",data:{controlId:r},status:"sucess",message:"camera triggerd"},"*"),logger.info("[TF_SDK:84b] \u2705 Dispatching openCamera event from toggleCameraMode for controlId:",r),document.dispatchEvent(d)}),this.refs.fileType.forEach((i,r)=>{this.dataValue[r]&&(this.dataValue[r].fileType=this.dataValue[r].fileType||this.component.fileTypes[0].label,this.addEventListener(i,"change",d=>{d.preventDefault();const a=this.component.fileTypes.find(l=>l.value===d.target.value);this.dataValue[r].fileType=a.label}))}),this.addEventListener(this.refs.syncNow,"click",i=>{i.preventDefault(),this.syncFiles()}),this.fileService){const i=[];this.filesReady=new Promise((r,d)=>{this.filesReadyResolve=r,this.filesReadyReject=d}),this.refs.fileImage.forEach((r,d)=>{i.push(this.loadImage(this.dataValue[d]).then(a=>r.src=a))}),i.length?Promise.all(i).then(()=>{this.filesReadyResolve()}).catch(()=>this.filesReadyReject()):this.filesReadyResolve()}let o=this;this.addEventListener(document,"capureImageData",function(i){var r;o.id==((r=i.detail)==null?void 0:r.controlId)&&(window.isListenerSet||(window.isListenerSet=!0,setTimeout(()=>{if(typeof i.detail.imageData=="string"&&i.detail.imageData.startsWith("data:")||typeof window.resolveLocalFileSystemURL!="function"){const l=((p,u,w="image/jpeg")=>{const m=p.split(","),f=m[0].match(/:(.*?);/)[1],g=atob(m[1]);let h=g.length;const y=new Uint8Array(h);for(;h--;)y[h]=g.charCodeAt(h);const I=new Blob([y],{type:w});return I.name=u,I})(i.detail.imageData,i.detail.fileName||`photo-${Date.now()}.jpg`);P=!1,$=!1,o.compressFile([l])}else window.resolveLocalFileSystemURL(i.detail.imageData,a=>{a.file(l=>{logger.info("[TF_SDK:85] \u2705 fileEntry ="+l);const p=new FileReader;p.onloadend=u=>{logger.info("[TF_SDK:86] \u2705 onloadend ="+u);const w=new Blob([new Uint8Array(u.target.result)],{type:l.type});w.name=l.name,logger.info("[TF_SDK:87] \u2705 file.name ="+l.name),logger.info("[TF_SDK:88] \u2705 blob instanceOf Blob ="+w),o.compressFile([w])},p.readAsArrayBuffer(l)})})},0)))},!1),this.addEventListener(document,"capureImageDataForAndroidBrowser",function(i){logger.info("[TF_SDK:89] \u2705 event.detail.controlId capureImageDataForAndroidBrowser ="+i.detail.controlId),o.id==i.detail.controlId&&(window.isListenerSet||(window.isListenerSet=!0,setTimeout(()=>{o.compressFile([i.detail.imageData])},0)))},!1),this.refs.FileView.forEach((i,r)=>{this.addEventListener(i,"click",d=>{d.preventDefault();let a=this.dataValue[r],l=c(a.url);n(l,a.type,a.originalName,!1)})}),this.refs.DownloadFile.forEach((i,r)=>{this.addEventListener(i,"click",d=>{d.preventDefault();let a=this.dataValue[r],l=c(a.url);n(l,a.type,a.originalName,!0)})});function n(i,r,d,a){try{const l=atob(i),p=[];for(let m=0;m<l.length;m+=512){const f=l.slice(m,m+512),g=new Array(f.length);for(let y=0;y<f.length;y++)g[y]=f.charCodeAt(y);const h=new Uint8Array(g);p.push(h)}const u=new Blob(p,{type:r}),w=URL.createObjectURL(u);if(a){const m=document.createElement("a");m.href=w,m.target="_blank",m.download=d,document.body.appendChild(m),m.click(),document.body.removeChild(m)}else window.open(w,"_blank")}catch(l){logger.error("[TF_SDK:93] \u274C Failed to open file:",l)}}function c(i){const r=i.indexOf(",");return r!==-1?i.slice(r+1):i}return t}fileSize(e,t,s,o,n){return`${(t=Math,s=t.log,o=1024,n=s(e)/s(o)|0,e/t.pow(o,n)).toFixed(2)} ${n?`${"kMGTPEZY"[--n]}B`:"Bytes"}`}globStringToRegex(e){e=e.replace(/\s/g,"");let t="",s=[];if(e.length>2&&e[0]==="/"&&e[e.length-1]==="/")t=e.substring(1,e.length-1);else{const o=e.split(",");if(o.length>1)for(let n=0;n<o.length;n++){const c=this.globStringToRegex(o[n]);c.regexp?(t+=`(${c.regexp})`,n<o.length-1&&(t+="|")):s=s.concat(c.excludes)}else e.startsWith("!")?s.push(`^((?!${this.globStringToRegex(e.substring(1)).regexp}).)*$`):(e.startsWith(".")&&(e=`*${e}`),t=`^${e.replace(new RegExp("[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\-]","g"),"\\$&")}$`,t=t.replace(/\\\*/g,".*").replace(/\\\?/g,"."))}return{regexp:t,excludes:s}}translateScalars(e){if(typeof e=="string"){if(e.search(/kb/i)===e.length-2)return parseFloat(e.substring(0,e.length-2)*1024);if(e.search(/mb/i)===e.length-2)return parseFloat(e.substring(0,e.length-2)*1024*1024);if(e.search(/gb/i)===e.length-2)return parseFloat(e.substring(0,e.length-2)*1024*1024*1024);if(e.search(/b/i)===e.length-1||e.search(/s/i)===e.length-1)return parseFloat(e.substring(0,e.length-1));if(e.search(/m/i)===e.length-1)return parseFloat(e.substring(0,e.length-1)*60);if(e.search(/h/i)===e.length-1)return parseFloat(e.substring(0,e.length-1)*3600)}return e}validatePattern(e,t){if(!t)return!0;const s=this.globStringToRegex(t);let o=!0;if(s.regexp&&s.regexp.length){const n=new RegExp(s.regexp,"i"),c=!K.isNil(e.type)&&n.test(e.type),i=!K.isNil(e.name)&&n.test(e.name);logger.info(`[TF_SDK:94] \u2705 Validating pattern "${t}":`,{fileName:e.name,fileType:e.type,regexp:s.regexp,typeMatches:c,nameMatches:i}),o=c||i}return o=s.excludes.reduce((n,c)=>{const i=new RegExp(c,"i");return n&&(K.isNil(e.type)||i.test(e.type))&&(K.isNil(e.name)||i.test(e.name))},o),o}validateMinSize(e,t){return e.size+.1>=this.translateScalars(t)}validateMaxSize(e,t){return e.size-.1<=this.translateScalars(t)}abortRequest(e){const t=this.abortUploads.find(s=>s.id===e);t&&t.abort()}handleAction(e){const t=e.target;if(!t.id)return;const[s,o]=t.id.split("-");!s||!o||!this.actions[s]||this.actions[s](o)}getFileName(e){return W(e.name,this.component.fileNameTemplate,this.evalContext())}getInitFileToSync(e){const t=e.name?e.name.replace(/</g,"&lt;").replace(/>/g,"&gt;"):e.name;return{id:Y(),dir:this.interpolate(this.component.dir||""),name:this.getFileName(e),originalName:t,fileKey:this.component.fileKey||"file",storage:this.component.storage,options:this.component.options,file:e,size:e.size,status:"info",message:this.t("Processing file. Please wait..."),hash:""}}async handleSubmissionRevisions(e){var o;if(((o=this.root)==null?void 0:o.form.submissionRevisions)!=="true")return"";const t=new BMF,s=await new Promise((n,c)=>{this.emit("fileUploadingStart"),t.md5(e,(i,r)=>i?c(i):n(r))});return this.emit("fileUploadingEnd"),s}validateFileName(e){const t=P?this.filesToSync.filesToUpload.some(o=>{var n;return((n=o.file)==null?void 0:n.name)===e.name}):this.dataValue.some(o=>o.url===N);return K.some(this.dataValue,o=>o.originalName===e.name)||t?{status:"error",message:this.t(`File with the same name is already ${t?"being ":""}uploaded`)}:{}}validateFileSettings(e){if(this.component.filePattern&&!this.validatePattern(e,this.component.filePattern))return{status:"error",message:this.t("File is the wrong type; it must be {{ pattern }}",{pattern:this.component.filePattern})};if(this.component.fileMinSize){const t=this.interpolate(this.component.fileMinSize,this.evalContext());if(!t)return{status:"error",message:"Please, check the entered parameters"};if(!this.validateMinSize(e,t))return{status:"error",message:this.t("fileTooSmall",{size:t})}}if(this.component.fileMaxSize){const t=this.interpolate(this.component.fileMaxSize,this.evalContext());if(!t)return{status:"error",message:"Please, check the entered parameters"};if(!this.validateMaxSize(e,t))return{status:"error",message:this.t("fileTooBig",{size:t})}}return{}}validateFileService(){const{fileService:e}=this;return e?{}:{status:"error",message:this.t("File Service not provided.")}}validateFile(e){const t=this.validateFileService();if(t.status==="error")return t;const s=this.validateFileName(e);return s.status==="error"?s:this.validateFileSettings(e)}getGroupPermissions(){var s;let e=null,t=null;return(s=this.root)==null||s.everyComponent(o=>{var n,c;((n=o.component)!=null&&n.submissionAccess||(c=o.component)!=null&&c.defaultPermission)&&(t=o.component.submissionAccess?o.component.submissionAccess:[{type:o.component.defaultPermission,roles:[]}],t.forEach(i=>{e=["admin","write","create"].includes(i.type)?o.component.key:null}))}),{groupKey:e,groupPermissions:t}}async triggerFileProcessor(e){var s,o;let t=null;if((s=this.root)!=null&&s.options.fileProcessor)try{this.refs.fileProcessingLoader&&(this.refs.fileProcessingLoader.style.display="block"),t=await fileProcessor(this.fileService,(o=this.root)==null?void 0:o.options.fileProcessor)(e,this.component.properties)}catch(n){return this.fileDropHidden=!1,{status:"error",message:this.t("File processing has been failed.")}}finally{this.refs.fileProcessingLoader&&(this.refs.fileProcessingLoader.style.display="none")}return{file:t}}async prepareFileToUpload(e){const t=this.getInitFileToSync(e);t.hash=await this.handleSubmissionRevisions(e);const{status:s,message:o}=this.validateFile(e);if(s==="error")return t.isValidationError=!0,t.status=s,t.message=o,this.filesToSync.filesToUpload.push(t);this.component.privateDownload&&(e.private=!0);const{groupKey:n,groupPermissions:c}=this.getGroupPermissions(),i=await this.triggerFileProcessor(e);if(i.status==="error")return t.status,t.message=i.message,this.filesToSync.filesToUpload.push(t);this.autoSync&&(t.message=this.t("Ready to be uploaded into storage")),this.filesToSync.filesToUpload.push({...t,message:t.message,file:i.file||e,url:this.interpolate(this.component.url,{file:t}),groupPermissions:c,groupResourceId:n?this.currentForm.submission.data[n]._id:null})}processAndUpload(e){logger.info(`[TF_SDK:100a] \u{1F4E5} Image upload process initiated for ${e.length} file(s)`);const t=(this.dataValue||[]).map(n=>n.originalName||n.name),s=Array.from(e).filter(n=>(logger.info(`[TF_SDK:100b] \u{1F4C4} Selected file: name="${n.name}", size=${(n.size/1024).toFixed(1)} KB, type="${n.type}"`),t.includes(n.name)?(logger.warn(`[TF_SDK:100c] \u26A0\uFE0F Duplicate blocked: ${n.name}`),typeof window.showToast=="function"&&window.showToast("File with the same name is already uploaded","danger"),!1):!0));if(s.length===0){logger.info("[TF_SDK:100d] \u2139\uFE0F All selected files are already uploaded. Skipping.");return}logger.info(`[TF_SDK:100e] \u26A1 Starting compression phase for ${s.length} file(s)...`);const o=[];for(let n=0;n<s.length;n++)o.push(this.compressFilePromise(s[n]));Promise.all(o).then(n=>{logger.info(`[TF_SDK:100f] \u2705 Compression phase complete for ${n.length} file(s)`),this.handleFilesToUpload(n)}).catch(n=>{logger.error("[TF_SDK:100g] \u274C processAndUpload failed:",n)})}compressFilePromise(e){return new Promise(t=>{if(e&&["image/gif","image/jpeg","image/png"].includes(e.type)){let o=this.component.fileCompressionSize||2,n=this.component.MaximumCompressionHeightOrWidth||2048;logger.info(`[TF_SDK:101a] \u26A1 Compressing image "${e.name}" (Original: ${(e.size/1024).toFixed(1)} KB)...`);const c={maxSizeMB:o,maxWidthOrHeight:n,useWebWorker:!M};imageCompression(e,c).then(i=>{i.name=e.name,logger.info(`[TF_SDK:101b] \u2705 Compressed "${e.name}" (${(e.size/1024).toFixed(1)} KB -> ${(i.size/1024).toFixed(1)} KB)`),this.blobToBase64(i).then(r=>{N=r,t(i)})}).catch(i=>{logger.warn(`[TF_SDK:101c] \u26A0\uFE0F Compression failed for "${e.name}", using original:`,i.message),t(e)})}else logger.info(`[TF_SDK:101d] \u2139\uFE0F File "${e.name}" is non-compressible type (${e.type}). Using original.`),t(e)})}compressFile(e){this.processAndUpload(e)}async prepareFilesToUpload(e){if(this.component.multiple||(e=Array.prototype.slice.call(e,0,1)),this.component.storage&&e&&e.length){this.fileDropHidden=!0;const t=await Promise.all([...e].map(async s=>await this.prepareFileToUpload(s)));return this.redraw(),typeof window!="undefined"&&window.requestAnimationFrame(()=>{document.body.offsetHeight}),t}else return Promise.resolve()}async handleFilesToUpload(e){logger.info(`[TF_SDK:102] \u2705 handleFilesToUpload received ${e.length} files`),await this.prepareFilesToUpload(e),this.autoSync||await this.syncFiles()}prepareFileToDelete(e){this.filesToSync.filesToDelete.push({...e,status:"info",message:this.autoSync?this.t("Ready to be removed from storage"):this.t("Preparing file to remove")}),e&&e.id&&O(e.id).catch(s=>{logger.warn("[TF_SDK:102c] \u26A0\uFE0F Failed to mark file mode='D' in IndexedDB:",s)});const t=this.dataValue.findIndex(s=>s===e||s.id&&s.id===e.id||s.name&&s.name===e.name);t!==-1?this.splice(t):logger.warn("[TF_SDK:102b] \u26A0\uFE0F Could not find file to delete in dataValue:",e),this.redraw()}handleFileToRemove(e){this.prepareFileToDelete(e),this.autoSync||this.syncFiles()}async deleteFile(e){const{options:t={}}=this.component;if(e&&["url","indexeddb","s3","azure","googledrive"].includes(this.component.storage)){const{fileService:s}=this;if(s&&typeof s.deleteFile=="function")return await s.deleteFile(e,t);{const o=this.options.formio||this.root&&this.root.formio;if(o)return await o.makeRequest("",e.url,"delete")}}}async delete(){return this.filesToSync.filesToDelete.length?await Promise.all(this.filesToSync.filesToDelete.map(async e=>{try{if(e.isValidationError)return{fileToSync:e};await this.deleteFile(e),e.status="success",e.message=this.t("Succefully removed")}catch(t){e.status="error",e.message=typeof t=="string"?t:t.toString()}finally{this.redraw()}return{fileToSync:e}})):Promise.resolve()}updateProgress(e,t){if(e.progress=parseInt(100*t.loaded/t.total),e.status!=="progress")e.status="progress",delete e.message,this.redraw();else{const s=Array.prototype.find.call(this.refs.progress,o=>o.id===e.id);s.innerHTML=`<span class="visually-hidden">${e.progress}% ${this.t("Complete")}</span>`,s.style.width=`${e.progress}%`,s.ariaValueNow=e.progress.toString()}}getMultipartOptions(e){let t=0;return this.component.useMultipartUpload&&this.component.multipart?{...this.component.multipart,progressCallback:s=>{t++,e.status="progress",e.progress=parseInt(100*t/s),delete e.message,this.redraw()},changeMessage:s=>{e.message=s,this.redraw()}}:!1}uploadFile(e){var r,d,a;const{storage:t,options:s={}}=this.component,o=this.interpolate(this.component.url,{file:e}),{groupKey:n,groupPermissions:c}=this.getGroupPermissions(),i=n&&((a=(d=(r=this.currentForm)==null?void 0:r.submission)==null?void 0:d.data[n])==null?void 0:a._id)||null;return this.fileService.uploadFile(t,e.file,e.name,e.dir,l=>{this.updateProgress(e,l)},o,s,e.fileKey,c,i,()=>{this.emit("fileUploadingStart")},l=>{this.abortUploads.push({id:e.id,abort:l})},this.getMultipartOptions(e))}async upload(){return this.filesToSync.filesToUpload.length?(logger.info(`[TF_SDK:102a] \u{1F4BE} Starting IndexedDB upload for ${this.filesToSync.filesToUpload.length} file(s)...`),await Promise.all(this.filesToSync.filesToUpload.map(async e=>{let t=null;try{if(e.isValidationError)return logger.warn(`[TF_SDK:102b] \u26A0\uFE0F Skipping upload for ${e.originalName} due to validation error`),{fileToSync:e,fileInfo:t};if(e.status==="success"){const o=this.resolvedFiles.find(n=>n.fileToSync.originalName===e.originalName);return{fileToSync:o.fileToSync,fileInfo:o.fileInfo}}logger.info(`[TF_SDK:102c] \u{1F4BE} Uploading file to IndexedDB: name="${e.originalName}", size=${(e.size/1024).toFixed(1)} KB`);const s=this.pendingfiles.find(o=>o.name===e.name);if(s)t=await s.fileInfoProm;else{const o=this.uploadFile(e);this.pendingfiles.push({name:e.name,fileInfoProm:o}),t=await o}this.pendingfiles=this.pendingfiles.filter(o=>o.name!==e.name),e.status="success",e.message=this.t("Succefully uploaded"),t.originalName=e.originalName,t.hash=e.hash,logger.info(`[TF_SDK:102d] \u2705 Saved to IndexedDB successfully: name="${e.originalName}", ID="${t==null?void 0:t.id}", Mode="${(t==null?void 0:t.mode)||"A"}"`),this.emit("fileUploadingEnd")}catch(s){logger.error(`[TF_SDK:102e] \u274C Upload to IndexedDB failed for ${e.originalName}:`,s),e.status="error",delete e.progress,e.message=typeof s=="string"?s:s.type==="abort"?this.t("Request was aborted"):s.toString(),this.emit("fileUploadingEnd"),this.emit("fileUploadError",{fileToSync:e,response:s})}finally{delete e.progress,this.redraw();const s=this.resolvedFiles.find(o=>o.fileInfo.originalName===e.originalName);t&&!s&&this.resolvedFiles.push({fileToSync:e,fileInfo:t})}return{fileToSync:e,fileInfo:t}}))):Promise.resolve()}async syncFiles(){var e,t,s;logger.info("[TF_SDK:108] \u2705 syncFiles started"),this.isSyncing=!0,this.fileDropHidden=!0,this.redraw();try{const[o=[],n=[]]=await Promise.all([this.delete(),this.upload()]);if(logger.info(`[TF_SDK:109] \u2705 syncFiles results: ${n.length} uploaded, ${o.length} deleted`),n.length!==((t=(e=this.filesToSync)==null?void 0:e.filesToUpload)==null?void 0:t.length))return;this.filesToSync.filesToDelete=o.filter(i=>{var r;return((r=i.fileToSync)==null?void 0:r.status)==="error"}).map(i=>i.fileToSync),this.filesToSync.filesToUpload=n.filter(i=>{var r;return((r=i.fileToSync)==null?void 0:r.status)==="error"}).map(i=>i.fileToSync),this.hasValue()||(this.dataValue=[]);const c=n.filter(i=>{var r;return((r=i.fileToSync)==null?void 0:r.status)==="success"}).map(i=>i.fileInfo);if(logger.info(`[TF_SDK:110] \u2705 syncFiles succeeded for ${c.length} new files`),$){$=!1;const i=c[0];if(!i)logger.warn("[TF_SDK:111a] \u26A0\uFE0F replace=true but no fileInfo available \u2014 skipping replace");else{let r;for(let d=0;d<this.dataValue.length;d++)this.dataValue[d].originalName==i.originalName&&(logger.info("[TF_SDK:111] \u2705 original name matches at index "+d),r=d);if(r!==void 0){let d=this.dataValue[r].id;logger.info("[TF_SDK:112] \u2705 originalFileId ="+d+", replacing with new id ="+i.id),this.dataValue[r]=i;let a=new CustomEvent("deleteOriginalFileFromDB",{detail:{fileId:d}});document.dispatchEvent(a)}else logger.warn("[TF_SDK:112a] \u26A0\uFE0F Could not find original file to replace in dataValue for: "+i.originalName),this.dataValue.push(i)}}else this.dataValue.push(...c);return(s=this.triggerChange)==null||s.call(this,{modified:!0}),Promise.resolve()}catch(o){return logger.error("[TF_SDK:113] \u274C syncFiles error:",o),Promise.reject()}finally{this.isSyncing=!1,this.fileDropHidden=!1,this.abortUploads=[],this.redraw()}}blobToBase64(e){return new Promise((t,s)=>{const o=new FileReader;o.onloadend=()=>t(o.result),o.readAsDataURL(e)})}getFile(e){const{options:t={}}=this.component,{fileService:s}=this;if(!s)return alert("File Service not provided");this.component.privateDownload&&(e.private=!0),s.downloadFile(e,t).then(o=>{o&&(["base64","indexeddb"].includes(o.storage)?download(o.url,o.originalName||o.name,o.type):window.open(o.url,"_blank"))}).catch(o=>{alert(o)})}focus(){"beforeFocus"in this.parent&&this.parent.beforeFocus(this),this.refs.fileBrowse&&this.refs.fileBrowse.focus()}async beforeSubmit(){try{return this.autoSync?(await this.syncFiles(),this.shouldSyncFiles?Promise.reject("Synchronization is failed"):Promise.resolve()):Promise.resolve()}catch(e){return Promise.reject(e.message)}}destroy(e){this.stopVideo(),super.destroy(e)}}x.editForm=q,j.addComponent("file",x),logger.info("[TF_SDK:114] \u2705 Script execution finished and component 'file' registered")})();</script>
37201
+ <script>(function(){logger.info("[TF_SDK:68] \u2705 Script loading started");var j=Formio.Components;const q=()=>({components:[]}),Q=Promise;var z=Formio.Utils,I=window._,L,E=navigator.camera||L,W=z.uniqueName,Z=Formio.Components.components.field;const R=Formio.Components.components.field;R||logger.error("[TF_SDK:69] \u274C FieldComponent is undefined!");const ee=Formio.Templates;let N="",C=!1;const te=["image/gif","image/jpeg","image/png"],G=z.getComponentSavedTypes,X=z.componentValueTypes;let P=!1;const M=typeof navigator!="undefined"&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);function Y(){return typeof uuid!="undefined"&&typeof uuid.v4=="function"?uuid.v4():typeof crypto!="undefined"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(v){const e=Math.random()*16|0;return(v==="x"?e:e&3|8).toString(16)})}function V(v,e,t){return logger.info(`[TF_SDK:80a] \u{1F4BE} updateFileInIndexedDB called for existing id: ${v}, file: ${t}, size: ${(e.size/1024).toFixed(1)} KB`),v?e?new Promise((s,o)=>{logger.info("[TF_SDK:80d] \u{1F513} Opening IndexedDB 'Forms-Attachments' (v3)...");const n=indexedDB.open("Forms-Attachments",3);n.onupgradeneeded=c=>{const i=c.target.result;i.objectStoreNames.contains("Files")||i.createObjectStore("Files")},n.onerror=()=>{logger.error("[TF_SDK:80e] \u274C Failed to open IndexedDB:",n.error),o(n.error)},n.onsuccess=c=>{const i=c.target.result;if(logger.info("[TF_SDK:80f] \u2705 IndexedDB 'Forms-Attachments' opened. Reading Blob as DataURL..."),!i.objectStoreNames.contains("Files"))return i.close(),logger.error("[TF_SDK:80g] \u274C Files store not found in IndexedDB"),o(new Error("[TF_SDK] Files store not found in IndexedDB"));const r=new FileReader;r.onerror=()=>{logger.error("[TF_SDK:80h] \u274C FileReader error:",r.error),o(r.error)},r.onload=d=>{const a=d.target.result;logger.info(`[TF_SDK:80i] \u{1F4DD} FileReader finished. DataURL length: ${a.length}. Executing readwrite transaction on store 'Files'...`);try{const l=i.transaction(["Files"],"readwrite"),g=l.objectStore("Files"),f=g.get(v),S=Y();f.onsuccess=()=>{const u=f.result||{id:v};u.mode="D",g.put(u,v);const F={...u,id:S,data:e,name:u.name||t,originalName:u.originalName||t,size:e.size,type:e.type||"image/jpeg",url:a,mode:"A"},h=g.put(F,S);h.onerror=()=>{logger.error("[TF_SDK:80j] \u274C updateFileInIndexedDB put new record failed:",h.error),i.close(),o(h.error)}},f.onerror=()=>{logger.error("[TF_SDK:80k] \u274C updateFileInIndexedDB get failed:",f.error),i.close(),o(f.error)},l.oncomplete=()=>{logger.info(`[TF_SDK:80l] \u2705 IndexedDB transaction committed! Old record marked mode=D (id=${v}), New record created mode=A (id=${S}), file=${t}, size=${(e.size/1024).toFixed(1)} KB`),i.close(),s({id:S,url:a,name:t,size:e.size,type:e.type,mode:"A"})},l.onerror=()=>{logger.error("[TF_SDK:80o] \u274C updateFileInIndexedDB transaction error:",l.error),i.close(),o(l.error)},l.onabort=()=>{logger.error("[TF_SDK:80p] \u274C Transaction aborted:",l.error),i.close(),o(l.error||new Error("Transaction aborted"))}}catch(l){logger.error("[TF_SDK:80q] \u274C Exception during transaction:",l),i.close(),o(l)}},r.readAsDataURL(e)}}):(logger.error("[TF_SDK:80c] \u274C blob is required for updateFileInIndexedDB"),Promise.reject(new Error("[TF_SDK] blob is required for updateFileInIndexedDB"))):(logger.error("[TF_SDK:80b] \u274C existingId is required for updateFileInIndexedDB"),Promise.reject(new Error("[TF_SDK] existingId is required for updateFileInIndexedDB")))}function O(v){return logger.info(`[TF_SDK:IDB-D0] \u2705 deleteFileInIndexedDB called for id: ${v}`),v?new Promise((e,t)=>{const s=indexedDB.open("Forms-Attachments",3);s.onupgradeneeded=o=>{const n=o.target.result;n.objectStoreNames.contains("Files")||n.createObjectStore("Files")},s.onerror=()=>t(s.error),s.onsuccess=o=>{const n=o.target.result;if(!n.objectStoreNames.contains("Files"))return n.close(),t(new Error("[TF_SDK] Files store not found in IndexedDB"));try{const c=n.transaction(["Files"],"readwrite"),i=c.objectStore("Files"),r=i.get(v);r.onsuccess=()=>{const d=r.result||{id:v};d.mode="D",i.put(d,v)},c.oncomplete=()=>{logger.info(`[TF_SDK:IDB-D2] \u2705 IndexedDB record marked mode='D': id=${v}`),n.close(),e({id:v,mode:"D"})},c.onerror=()=>{logger.error("[TF_SDK:IDB-D3] \u274C deleteFileInIndexedDB transaction error:",c.error),n.close(),t(c.error)}}catch(c){logger.error("[TF_SDK:IDB-D4] \u274C Exception during transaction:",c),n.close(),t(c)}}}):Promise.reject(new Error("[TF_SDK] existingId is required for deleteFileInIndexedDB"))}typeof window!="undefined"&&(window.updateFileInIndexedDB=V,window.deleteFileInIndexedDB=O);let $;typeof window!="undefined"?$=window.HTMLCanvasElement:typeof globalThis!="undefined"&&($=globalThis.HTMLCanvasElement),$&&!$.prototype.toBlob&&Object.defineProperty($.prototype,"toBlob",{value:function(v,e,t){var s=this;setTimeout(function(){for(var o=atob(s.toDataURL(e,t).split(",")[1]),n=o.length,c=new Uint8Array(n),i=0;i<n;i++)c[i]=o.charCodeAt(i);v(new Blob([c],{type:e||"image/png"}))})}});const J=()=>Math.random().toString(36).substring(2,15);class A extends R{static schema(...e){return R.schema({type:"file",label:"Upload",key:"file",image:!1,privateDownload:!1,imageSize:"200",filePattern:"*",fileMinSize:"0KB",fileMaxSize:"1GB",uploadOnly:!1},...e)}static get builderInfo(){return{title:"File",group:"premium",icon:"file",documentation:"/userguide/#file",weight:100,schema:A.schema()}}static get serverConditionSettings(){return R.conditionOperatorsSettings}static get conditionOperatorsSettings(){return{...super.conditionOperatorsSettings,operators:["isEmpty","isNotEmpty"]}}static savedValueTypes(e){return e=e||{},G(e)||[X.object]}constructor(e,t,s){super(e,t,s),logger.info(`[TF_SDK:70] \u2705 Constructor called for key: ${e.key}`),this.statuses=[],this.fileDropHidden=!1,this.filesToSync={filesToUpload:[],filesToDelete:[]},this.isSyncing=!1,this.abortUploads=[],this.pendingfiles=[],this.resolvedFiles=[]}init(){super.init(),E=navigator.camera||L;const e=typeof FileReader!="undefined",t=typeof window!="undefined"?!!window.FormData:!1,s=typeof window!="undefined"&&window.XMLHttpRequest?"upload"in new XMLHttpRequest:!1;this.support={filereader:e,formdata:t,hasWarning:!e||!t||!s,progress:s},this.cameraMode=!1}get dataReady(){return this.filesReady||Promise.resolve()}get defaultSchema(){return A.schema()}loadImage(e){return this.component.privateDownload&&(e.private=!0),this.fileService.downloadFile(e,this.component).then(t=>t.url)}get emptyValue(){return[]}getValueAsString(e,t){return t!=null&&t.review&&!this.component.uploadOnly?I.map(e,(s,o)=>`<a href="${s.url||"#"}" target="_blank" data-path='${this.path}' data-fileindex='${o}'>${s.originalName}</a>`).join(", "):I.isArray(e)?I.map(e,"originalName").join(", "):I.get(e,"originalName","")}getValue(){return this.dataValue}get defaultValue(){const e=super.defaultValue;return Array.isArray(e)?e:[]}get hasTypes(){return this.component.fileTypes&&Array.isArray(this.component.fileTypes)&&this.component.fileTypes.length!==0&&(this.component.fileTypes[0].label!==""||this.component.fileTypes[0].value!=="")}get fileDropHidden(){return this._fileBrowseHidden}set fileDropHidden(e){typeof e!="boolean"||this.component.multiple||(this._fileBrowseHidden=e)}get shouldSyncFiles(){return!!(this.filesToSync.filesToDelete.length||this.filesToSync.filesToUpload.length)}get autoSync(){return!1}get columnsSize(){const e=this.disabled?0:this.autoSync?2:1,t=this.hasTypes?2:0,s=2;return{name:12-e-t-s,size:s,type:t,actions:e}}render(){const{filesToDelete:e,filesToUpload:t}=this.filesToSync;return logger.info(`[TF_SDK:71] \u2705 render() called for key: ${this.component.key}`,{filesCount:(this.dataValue||[]).length,isSyncing:this.isSyncing}),super.render(this.renderTemplate("file",{fileSize:this.fileSize,files:this.dataValue||[],filesToDelete:e,filesToUpload:t,disabled:this.disabled,support:this.support,fileDropHidden:this.fileDropHidden,showSyncButton:this.autoSync&&(e.length||t.length),isSyncing:this.isSyncing,columns:this.columnsSize}))}getVideoStream(e){const t={audio:!1,video:{width:{min:640,ideal:1920},height:{min:360,ideal:1080},aspectRatio:{ideal:1.7777777777777777},...e}};return navigator.mediaDevices.getUserMedia(t)}stopVideoStream(e){e.getVideoTracks().forEach(t=>t.stop())}getFrame(e){return new Promise(t=>{const s=document.createElement("canvas");s.height=e.videoHeight,s.width=e.videoWidth,s.getContext("2d").drawImage(e,0,0),s.toBlob(t)})}startVideo(){this._cameraMode=!1}stopVideo(){this.videoStream&&(this.stopVideoStream(this.videoStream),this.videoStream=null),this._cameraMode=!1}takePicture(){let e=this.id;C=!1,window.isListenerSet=!1;let t=new CustomEvent("openCamera",{detail:{controlId:e}});document.dispatchEvent(t)}browseFiles(e={}){return new Promise(t=>{const s=this.ce("input",{type:"file",style:"height: 0; width: 0; visibility: hidden;",tabindex:"-1",...e});document.body.appendChild(s),this.addEventListener(s,"change",o=>{logger.info(`[TF_SDK:74] \u2705 Native file input change event triggered with ${o.target.files.length} files`),t(o.target.files),document.body.removeChild(s)},!0),typeof s.trigger=="function"?s.trigger("click"):s.click()})}set cameraMode(e){this._cameraMode=!1}get cameraMode(){return!1}get useWebViewCamera(){return this.imageUpload&&E}get imageUpload(){return!!this.component.image}get browseOptions(){const e={};this.component.multiple&&(e.multiple=!0),this.component.capture&&(e.capture=this.component.capture);const t=this.component.filePattern.trim()||"";if(this.isMobile.any)this.component.capture&&(t.includes("video")?e.accept="video/*":t.includes("audio")?e.accept="audio/*":e.accept="image/*");else{const s="image/*";this.imageUpload&&(!t||t==="*")?e.accept=s:this.imageUpload&&!t.includes(s)?e.accept=`${s},${t}`:e.accept=t}return e}get actions(){return{abort:this.abortRequest.bind(this)}}attach(e){logger.info(`[TF_SDK:75] \u2705 attach() called for key: ${this.component.key}`),this.loadRefs(e,{fileDrop:"single",fileBrowse:"single",galleryButton:"single",cameraButton:"single",takePictureButton:"single",toggleCameraMode:"single",videoPlayer:"single",fileLink:"multiple",removeLink:"multiple",fileToSyncRemove:"multiple",fileImage:"multiple",fileType:"multiple",fileProcessingLoader:"single",FileView:"multiple",DownloadFile:"multiple",syncNow:"single",restoreFile:"multiple",progress:"multiple",cropImage:"multiple",annotateImage:"multiple"}),this.refs.input=[];const t=super.attach(e);if(this.refs.fileDrop){const i=this;this.addEventListener(this.refs.fileDrop,"dragover",r=>{this.refs.fileDrop.className="fileSelector fileDragOver",r.preventDefault()}),this.addEventListener(this.refs.fileDrop,"dragleave",r=>{this.refs.fileDrop.className="fileSelector",r.preventDefault()}),this.addEventListener(this.refs.fileDrop,"drop",r=>{this.refs.fileDrop.className="fileSelector",r.preventDefault(),P=!1;const d=[],a=r.dataTransfer.files;for(let l=0;l<a.length;l++)d.push(a[l]);this.processAndUpload(d)}),this.addEventListener(this.refs.fileDrop,"click",r=>{r.target.tagName==="A"||r.target.closest("a")||r.target.closest("button")||r.target.closest&&(r.target.closest('[ref="cameraButton"]')||r.target.closest('[ref="toggleCameraMode"]')||r.target.closest('[ref="galleryButton"]'))||(r.preventDefault(),!(!this.component.multiple&&this.statuses.some(d=>d.status==="progress"))&&(this.statuses=[],this.browseFiles(this.browseOptions).then(d=>{P=!1;const a=[];for(let l=0;l<d.length;l++){let g=d[l];a.push(new Promise(f=>{const S=new FileReader;S.onloadend=u=>{const F=new Blob([new Uint8Array(u.target.result)],{type:g.type});F.name=g.name,F.lastModified=g.lastModified,F.lastModifiedDate=g.lastModifiedDate,C=!0,this.compressFile([F])},S.readAsArrayBuffer(g)}))}})))})}if(this.addEventListener(e,"click",i=>{this.handleAction(i)}),this.refs.fileBrowse&&this.addEventListener(this.refs.fileBrowse,"click",i=>{i.preventDefault(),!(!this.component.multiple&&this.statuses.some(r=>r.status==="progress"))&&(this.statuses=[],this.browseFiles(this.browseOptions).then(r=>{P=!1;const d=[];for(let a=0;a<r.length;a++){let l=r[a];d.push(new Promise(g=>{const f=new FileReader;f.onloadend=S=>{const u=new Blob([new Uint8Array(S.target.result)],{type:l.type});u.name=l.name,u.lastModified=l.lastModified,u.lastModifiedDate=l.lastModifiedDate,g(u)},f.readAsArrayBuffer(l)}))}Promise.all(d).then(a=>{logger.info(`[TF_SDK:76] \u2705 Selected ${a.length} files from browser`),C=!0,this.processAndUpload(a)})}))}),this.refs.fileLink&&this.refs.fileLink.forEach((i,r)=>{this.addEventListener(i,"click",d=>{d.preventDefault(),this.getFile(this.dataValue[r])})}),this.refs.removeLink&&this.refs.removeLink.forEach((i,r)=>{this.addEventListener(i,"click",d=>{d.preventDefault();const a=this.dataValue[r];this.handleFileToRemove(a)})}),this.refs.fileImage&&this.refs.fileImage.forEach((i,r)=>{this.addEventListener(i,"click",d=>{const a=this.dataValue[r];let l=new CustomEvent("openImagePreview",{detail:{data:a}});logger.info("[TF_SDK:78] \u2705 dispatching openImagePreview event"),document.dispatchEvent(l)})}),this.refs.cropImage&&this.refs.cropImage.forEach((i,r)=>{this.addEventListener(i,"click",d=>{var F;let a=this;const l=this.dataValue[r];logger.info(`[TF_SDK:81a] \u2702\uFE0F Crop button clicked for file: "${(l==null?void 0:l.originalName)||(l==null?void 0:l.name)}", index=${r}, ID=${l==null?void 0:l.id}`);let g=null;if(a.refs.fileImage&&a.refs.fileImage[r])g=a.refs.fileImage[r];else{const h=document.getElementsByClassName("fileImageData");for(var f=0;f<h.length;f++)if(h[f].alt==l.originalName&&(h[f].id==l.compnentId||a.component.key==l.key)){g=h[f];break}!g&&h.length>0&&(g=h[0])}g?(logger.info(`[TF_SDK:81b] \u{1F3AF} Target image element found for crop: src length=${((F=g.src)==null?void 0:F.length)||0}`),S(g)):logger.error("[TF_SDK:81c] \u274C Target image element not found for crop");function S(h){logger.info("[TF_SDK:81d] \u{1F5BC}\uFE0F Opening Cropro Crop modal UI..."),new cropro.Activator.addKey("CRPR-P238-M097-0451");const y=new cropro.CropArea(h);y.displayMode="popup",y.renderImageType="image/jpeg",y.renderImageQuality=.8,y.styles.settings.toolbarBackgroundColor="#2586c7",y.styles.settings.toolbarBackgroundHoverColor="#286f9f",y.addRenderEventListener(w=>{h.src=w,logger.info(`[TF_SDK:81e] \u{1F4BE} User clicked Crop Save (\u2713 right checkmark)! Rendered Base64 DataURL length=${w.length}`),a.dataValue[r].url=w,u(w.split(",")[1],"image/jpeg",a.dataValue[r].originalName)}),y.addCloseEventListener(()=>{logger.info("[TF_SDK:81f] \u{1F6AA} Crop modal closed.")}),y.show()}async function u(h,y,w){const K=atob(h),B=new Uint8Array(K.length);for(let m=0;m<K.length;m++)B[m]=K.charCodeAt(m);const b=new Blob([B],{type:y||"image/jpeg"});if(b.name=w,logger.info(`[TF_SDK:81g] \u2705 Cropped image Blob created. Size: ${(b.size/1024).toFixed(1)} KB (${(b.size/1024/1024).toFixed(2)} MB), Type: ${b.type}`),typeof imageCompression=="function")try{logger.info("[TF_SDK:81h] \u26A1 Compressing cropped image Blob...");const m=await imageCompression(b,{maxSizeMB:.2,maxWidthOrHeight:1600,useWebWorker:!M});m.name=w,logger.info(`[TF_SDK:81i] \u26A1 Cropped image compressed: ${(b.size/1024).toFixed(1)} KB -> ${(m.size/1024).toFixed(1)} KB`),b=m}catch(m){logger.warn("[TF_SDK:81j] \u26A0\uFE0F Compression failed for cropped image:",m)}logger.info(`[TF_SDK:81k] \u2705 Final cropped image size ready for IndexedDB update: ${(b.size/1024).toFixed(1)} KB`);const x=a.dataValue[r],p=x&&(x.id||x.uid||x._id);p?(logger.info(`[TF_SDK:81l] \u{1F4BE} Initiating IndexedDB replacement for old ID: ${p}, File: "${w}"`),V(p,b,w).then(m=>{var U,T;if(logger.info(`[TF_SDK:81m] \u2705 IndexedDB updated (crop) successfully for: "${w}", Old ID: ${p}, New ID: ${m.id}`),a.dataValue[r]={...a.dataValue[r],id:m.id,uid:m.id,url:m.url,size:m.size,mode:m.mode,originalName:w},a.resolvedFiles&&Array.isArray(a.resolvedFiles)){const D=a.resolvedFiles.find(_=>{var k,H;return((k=_.fileInfo)==null?void 0:k.id)===p||((H=_.fileInfo)==null?void 0:H.originalName)===w});D&&(D.fileInfo&&(D.fileInfo.id=m.id,D.fileInfo.uid=m.id,D.fileInfo.size=m.size,D.fileInfo.url=m.url,D.fileInfo.mode=m.mode),D.fileToSync&&(D.fileToSync.id=m.id,D.fileToSync.size=m.size,D.fileToSync.file=b))}if((U=a.filesToSync)!=null&&U.filesToUpload&&Array.isArray(a.filesToSync.filesToUpload)){const D=a.filesToSync.filesToUpload.find(_=>_.id===p||_.originalName===w);D&&(D.id=m.id,D.size=m.size,D.file=b)}logger.info("[TF_SDK:81n] \u{1F504} Triggering component change and redrawing UI with updated cropped image..."),(T=a.triggerChange)==null||T.call(a,{modified:!0}),a.redraw(),logger.info("[TF_SDK:81o] \u2705 UI redraw completed. Cropped image process finished.")}).catch(m=>{logger.error("[TF_SDK:81p] \u274C updateFileInIndexedDB (crop) failed:",m)})):logger.warn(`[TF_SDK:81q] \u26A0\uFE0F No existingId found for crop update (index=${r})`)}})}),this.refs.annotateImage&&this.refs.annotateImage.forEach((i,r)=>{this.addEventListener(i,"click",d=>{let a=this;const l=this.dataValue[r];logger.info("[TF_SDK:82] \u2705 annotateImage clicked");let g=null;if(a.refs.fileImage&&a.refs.fileImage[r])g=a.refs.fileImage[r];else{const F=document.getElementsByClassName("fileImageData");for(var f=0;f<F.length;f++)if(F[f].alt==l.originalName&&(F[f].id==l.compnentId||a.component.key==l.key)){g=F[f];break}!g&&F.length>0&&(g=F[0])}g?S(g):logger.error("[TF_SDK:82a] \u274C Target image element not found for annotate");function S(F){new markerjs2.Activator.addKey("MJS2-P013-M397-4100");const h=new markerjs2.MarkerArea(F);h.settings.displayMode="popup",h.uiStyleSettings.toolbarBackgroundColor="#2586c7",h.uiStyleSettings.toolbarBackgroundHoverColor="#286f9f",h.addRenderEventListener(y=>{F.src=y,a.dataValue[r].url=y,u(y.split(",")[1],"image/jpeg",a.dataValue[r].originalName)}),h.show()}async function u(F,h,y){h=h||"image/jpeg";const w=atob(F),K=new Uint8Array(w.length);for(let p=0;p<w.length;p++)K[p]=w.charCodeAt(p);let B=new Blob([K],{type:h});if(B.name=y,typeof imageCompression=="function")try{const p=await imageCompression(B,{maxSizeMB:.2,maxWidthOrHeight:1600,useWebWorker:!M});p.name=y,logger.info(`[TF_SDK:83] \u26A1 Compressed annotated image: ${B.size} -> ${p.size} bytes`),B=p}catch(p){logger.warn("[TF_SDK:83a] \u26A0\uFE0F Compression failed:",p)}logger.info(`[TF_SDK:83b] \u2705 Annotated Image file size ${B.size/1024/1024} MB`);const b=a.dataValue[r],x=b&&(b.id||b.uid||b._id);x?V(x,B,y).then(p=>{var m,U;if(logger.info(`[TF_SDK:83c] \u2705 IndexedDB updated (annotate) for: ${y}, Old ID: ${x}, New ID: ${p.id}`),a.dataValue[r]={...a.dataValue[r],id:p.id,uid:p.id,url:p.url,size:p.size,mode:p.mode,originalName:y},a.resolvedFiles&&Array.isArray(a.resolvedFiles)){const T=a.resolvedFiles.find(D=>{var _,k;return((_=D.fileInfo)==null?void 0:_.id)===x||((k=D.fileInfo)==null?void 0:k.originalName)===y});T&&(T.fileInfo&&(T.fileInfo.id=p.id,T.fileInfo.uid=p.id,T.fileInfo.size=p.size,T.fileInfo.url=p.url,T.fileInfo.mode=p.mode),T.fileToSync&&(T.fileToSync.id=p.id,T.fileToSync.size=p.size,T.fileToSync.file=B))}if((m=a.filesToSync)!=null&&m.filesToUpload&&Array.isArray(a.filesToSync.filesToUpload)){const T=a.filesToSync.filesToUpload.find(D=>D.id===x||D.originalName===y);T&&(T.id=p.id,T.size=p.size,T.file=B)}(U=a.triggerChange)==null||U.call(a,{modified:!0}),a.redraw()}).catch(p=>{logger.error("[TF_SDK:83d] \u274C updateFileInIndexedDB (annotate) failed:",p)}):logger.warn(`[TF_SDK:83e] \u26A0\uFE0F No existingId found for annotate update (index=${r})`)}})}),this.refs.fileToSyncRemove&&this.refs.fileToSyncRemove.forEach((i,r)=>{this.addEventListener(i,"click",d=>{d.preventDefault(),this.filesToSync.filesToUpload.splice(r,1),this.redraw()})}),this.refs.fileStatusRemove&&this.refs.fileStatusRemove.forEach((i,r)=>{this.addEventListener(i,"click",d=>{d.preventDefault(),this.abortUpload&&this.abortUpload(),this.statuses.splice(r,1),this.redraw()})}),this.refs.restoreFile&&this.refs.restoreFile.forEach((i,r)=>{this.addEventListener(i,"click",d=>{var l;d.preventDefault();const a=this.filesToSync.filesToDelete[r];delete a.status,delete a.message,this.filesToSync.filesToDelete.splice(r,1),this.dataValue.push(a),(l=this.triggerChange)==null||l.call(this),this.redraw()})}),this.refs.galleryButton&&E&&this.addEventListener(this.refs.galleryButton,"click",i=>{i.preventDefault(),E.getPicture(r=>{window.resolveLocalFileSystemURL(r,d=>{d.file(a=>{const l=new FileReader;l.onloadend=g=>{const f=new Blob([new Uint8Array(g.target.result)],{type:a.type});f.name=a.name,P=!1,this.processAndUpload([f])},l.readAsArrayBuffer(a)})})},r=>{logger.error(r)},{sourceType:E.PictureSourceType.PHOTOLIBRARY})}),this.refs.cameraButton&&this.addEventListener(this.refs.cameraButton,"click",i=>{i.preventDefault(),i.stopPropagation(),typeof i.stopImmediatePropagation=="function"&&i.stopImmediatePropagation();let r=this.id;C=!1,window.isListenerSet=!1;let d=new CustomEvent("openCamera",{detail:{controlId:r}});window.parent&&window.parent!==window&&window.parent.postMessage({type:"OPEN_CAMERA",data:{controlId:r},status:"sucess",message:"camera triggerd"},"*"),logger.info("[TF_SDK:84a] \u2705 Dispatching openCamera event for controlId:",r),document.dispatchEvent(d)}),this.refs.takePictureButton&&this.addEventListener(this.refs.takePictureButton,"click",i=>{i.preventDefault(),i.stopPropagation(),this.takePicture()}),this.refs.toggleCameraMode&&this.addEventListener(this.refs.toggleCameraMode,"click",i=>{i.preventDefault(),i.stopPropagation(),typeof i.stopImmediatePropagation=="function"&&i.stopImmediatePropagation();let r=this.id;C=!1,window.isListenerSet=!1;let d=new CustomEvent("openCamera",{detail:{controlId:r}});window.parent&&window.parent!==window&&window.parent.postMessage({type:"OPEN_CAMERA",data:{controlId:r},status:"sucess",message:"camera triggerd"},"*"),logger.info("[TF_SDK:84b] \u2705 Dispatching openCamera event from toggleCameraMode for controlId:",r),document.dispatchEvent(d)}),this.refs.fileType.forEach((i,r)=>{this.dataValue[r]&&(this.dataValue[r].fileType=this.dataValue[r].fileType||this.component.fileTypes[0].label,this.addEventListener(i,"change",d=>{d.preventDefault();const a=this.component.fileTypes.find(l=>l.value===d.target.value);this.dataValue[r].fileType=a.label}))}),this.addEventListener(this.refs.syncNow,"click",i=>{i.preventDefault(),this.syncFiles()}),this.fileService){const i=[];this.filesReady=new Promise((r,d)=>{this.filesReadyResolve=r,this.filesReadyReject=d}),this.refs.fileImage.forEach((r,d)=>{i.push(this.loadImage(this.dataValue[d]).then(a=>r.src=a))}),i.length?Promise.all(i).then(()=>{this.filesReadyResolve()}).catch(()=>this.filesReadyReject()):this.filesReadyResolve()}let o=this;this.addEventListener(document,"capureImageData",function(i){var r;o.id==((r=i.detail)==null?void 0:r.controlId)&&(window.isListenerSet||(window.isListenerSet=!0,setTimeout(()=>{if(typeof i.detail.imageData=="string"&&i.detail.imageData.startsWith("data:")||typeof window.resolveLocalFileSystemURL!="function"){const l=((g,f,S="image/jpeg")=>{const u=g.split(","),F=u[0].match(/:(.*?);/)[1],h=atob(u[1]);let y=h.length;const w=new Uint8Array(y);for(;y--;)w[y]=h.charCodeAt(y);const K=new Blob([w],{type:S});return K.name=f,K})(i.detail.imageData,i.detail.fileName||`photo-${Date.now()}.jpg`);C=!1,P=!1,o.compressFile([l])}else window.resolveLocalFileSystemURL(i.detail.imageData,a=>{a.file(l=>{logger.info("[TF_SDK:85] \u2705 fileEntry ="+l);const g=new FileReader;g.onloadend=f=>{logger.info("[TF_SDK:86] \u2705 onloadend ="+f);const S=new Blob([new Uint8Array(f.target.result)],{type:l.type});S.name=l.name,logger.info("[TF_SDK:87] \u2705 file.name ="+l.name),logger.info("[TF_SDK:88] \u2705 blob instanceOf Blob ="+S),o.compressFile([S])},g.readAsArrayBuffer(l)})})},0)))},!1),this.addEventListener(document,"capureImageDataForAndroidBrowser",function(i){logger.info("[TF_SDK:89] \u2705 event.detail.controlId capureImageDataForAndroidBrowser ="+i.detail.controlId),o.id==i.detail.controlId&&(window.isListenerSet||(window.isListenerSet=!0,setTimeout(()=>{o.compressFile([i.detail.imageData])},0)))},!1),this.refs.FileView.forEach((i,r)=>{this.addEventListener(i,"click",d=>{d.preventDefault();let a=this.dataValue[r],l=c(a.url);n(l,a.type,a.originalName,!1)})}),this.refs.DownloadFile.forEach((i,r)=>{this.addEventListener(i,"click",d=>{d.preventDefault();let a=this.dataValue[r],l=c(a.url);n(l,a.type,a.originalName,!0)})});function n(i,r,d,a){try{const l=atob(i),g=[];for(let u=0;u<l.length;u+=512){const F=l.slice(u,u+512),h=new Array(F.length);for(let w=0;w<F.length;w++)h[w]=F.charCodeAt(w);const y=new Uint8Array(h);g.push(y)}const f=new Blob(g,{type:r}),S=URL.createObjectURL(f);if(a){const u=document.createElement("a");u.href=S,u.target="_blank",u.download=d,document.body.appendChild(u),u.click(),document.body.removeChild(u)}else window.open(S,"_blank")}catch(l){logger.error("[TF_SDK:93] \u274C Failed to open file:",l)}}function c(i){const r=i.indexOf(",");return r!==-1?i.slice(r+1):i}return t}fileSize(e,t,s,o,n){return`${(t=Math,s=t.log,o=1024,n=s(e)/s(o)|0,e/t.pow(o,n)).toFixed(2)} ${n?`${"kMGTPEZY"[--n]}B`:"Bytes"}`}globStringToRegex(e){e=e.replace(/\s/g,"");let t="",s=[];if(e.length>2&&e[0]==="/"&&e[e.length-1]==="/")t=e.substring(1,e.length-1);else{const o=e.split(",");if(o.length>1)for(let n=0;n<o.length;n++){const c=this.globStringToRegex(o[n]);c.regexp?(t+=`(${c.regexp})`,n<o.length-1&&(t+="|")):s=s.concat(c.excludes)}else e.startsWith("!")?s.push(`^((?!${this.globStringToRegex(e.substring(1)).regexp}).)*$`):(e.startsWith(".")&&(e=`*${e}`),t=`^${e.replace(new RegExp("[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\-]","g"),"\\$&")}$`,t=t.replace(/\\\*/g,".*").replace(/\\\?/g,"."))}return{regexp:t,excludes:s}}translateScalars(e){if(typeof e=="string"){if(e.search(/kb/i)===e.length-2)return parseFloat(e.substring(0,e.length-2)*1024);if(e.search(/mb/i)===e.length-2)return parseFloat(e.substring(0,e.length-2)*1024*1024);if(e.search(/gb/i)===e.length-2)return parseFloat(e.substring(0,e.length-2)*1024*1024*1024);if(e.search(/b/i)===e.length-1||e.search(/s/i)===e.length-1)return parseFloat(e.substring(0,e.length-1));if(e.search(/m/i)===e.length-1)return parseFloat(e.substring(0,e.length-1)*60);if(e.search(/h/i)===e.length-1)return parseFloat(e.substring(0,e.length-1)*3600)}return e}validatePattern(e,t){if(!t)return!0;const s=this.globStringToRegex(t);let o=!0;if(s.regexp&&s.regexp.length){const n=new RegExp(s.regexp,"i"),c=!I.isNil(e.type)&&n.test(e.type),i=!I.isNil(e.name)&&n.test(e.name);logger.info(`[TF_SDK:94] \u2705 Validating pattern "${t}":`,{fileName:e.name,fileType:e.type,regexp:s.regexp,typeMatches:c,nameMatches:i}),o=c||i}return o=s.excludes.reduce((n,c)=>{const i=new RegExp(c,"i");return n&&(I.isNil(e.type)||i.test(e.type))&&(I.isNil(e.name)||i.test(e.name))},o),o}validateMinSize(e,t){return e.size+.1>=this.translateScalars(t)}validateMaxSize(e,t){return e.size-.1<=this.translateScalars(t)}abortRequest(e){const t=this.abortUploads.find(s=>s.id===e);t&&t.abort()}handleAction(e){const t=e.target;if(!t.id)return;const[s,o]=t.id.split("-");!s||!o||!this.actions[s]||this.actions[s](o)}getFileName(e){return W(e.name,this.component.fileNameTemplate,this.evalContext())}getInitFileToSync(e){const t=e.name?e.name.replace(/</g,"&lt;").replace(/>/g,"&gt;"):e.name;return{id:J(),dir:this.interpolate(this.component.dir||""),name:this.getFileName(e),originalName:t,fileKey:this.component.fileKey||"file",storage:this.component.storage,options:this.component.options,file:e,size:e.size,status:"info",message:this.t("Processing file. Please wait..."),hash:""}}async handleSubmissionRevisions(e){var o;if(((o=this.root)==null?void 0:o.form.submissionRevisions)!=="true")return"";const t=new BMF,s=await new Promise((n,c)=>{this.emit("fileUploadingStart"),t.md5(e,(i,r)=>i?c(i):n(r))});return this.emit("fileUploadingEnd"),s}validateFileName(e){const t=C?this.filesToSync.filesToUpload.some(o=>{var n;return((n=o.file)==null?void 0:n.name)===e.name}):this.dataValue.some(o=>o.url===N);return I.some(this.dataValue,o=>o.originalName===e.name)||t?{status:"error",message:this.t(`File with the same name is already ${t?"being ":""}uploaded`)}:{}}validateFileSettings(e){if(this.component.filePattern&&!this.validatePattern(e,this.component.filePattern))return{status:"error",message:this.t("File is the wrong type; it must be {{ pattern }}",{pattern:this.component.filePattern})};if(this.component.fileMinSize){const t=this.interpolate(this.component.fileMinSize,this.evalContext());if(!t)return{status:"error",message:"Please, check the entered parameters"};if(!this.validateMinSize(e,t))return{status:"error",message:this.t("fileTooSmall",{size:t})}}if(this.component.fileMaxSize){const t=this.interpolate(this.component.fileMaxSize,this.evalContext());if(!t)return{status:"error",message:"Please, check the entered parameters"};if(!this.validateMaxSize(e,t))return{status:"error",message:this.t("fileTooBig",{size:t})}}return{}}validateFileService(){const{fileService:e}=this;return e?{}:{status:"error",message:this.t("File Service not provided.")}}validateFile(e){const t=this.validateFileService();if(t.status==="error")return t;const s=this.validateFileName(e);return s.status==="error"?s:this.validateFileSettings(e)}getGroupPermissions(){var s;let e=null,t=null;return(s=this.root)==null||s.everyComponent(o=>{var n,c;((n=o.component)!=null&&n.submissionAccess||(c=o.component)!=null&&c.defaultPermission)&&(t=o.component.submissionAccess?o.component.submissionAccess:[{type:o.component.defaultPermission,roles:[]}],t.forEach(i=>{e=["admin","write","create"].includes(i.type)?o.component.key:null}))}),{groupKey:e,groupPermissions:t}}async triggerFileProcessor(e){var s,o;let t=null;if((s=this.root)!=null&&s.options.fileProcessor)try{this.refs.fileProcessingLoader&&(this.refs.fileProcessingLoader.style.display="block"),t=await fileProcessor(this.fileService,(o=this.root)==null?void 0:o.options.fileProcessor)(e,this.component.properties)}catch(n){return this.fileDropHidden=!1,{status:"error",message:this.t("File processing has been failed.")}}finally{this.refs.fileProcessingLoader&&(this.refs.fileProcessingLoader.style.display="none")}return{file:t}}async prepareFileToUpload(e){const t=this.getInitFileToSync(e);t.hash=await this.handleSubmissionRevisions(e);const{status:s,message:o}=this.validateFile(e);if(s==="error")return t.isValidationError=!0,t.status=s,t.message=o,this.filesToSync.filesToUpload.push(t);this.component.privateDownload&&(e.private=!0);const{groupKey:n,groupPermissions:c}=this.getGroupPermissions(),i=await this.triggerFileProcessor(e);if(i.status==="error")return t.status,t.message=i.message,this.filesToSync.filesToUpload.push(t);this.autoSync&&(t.message=this.t("Ready to be uploaded into storage")),this.filesToSync.filesToUpload.push({...t,message:t.message,file:i.file||e,url:this.interpolate(this.component.url,{file:t}),groupPermissions:c,groupResourceId:n?this.currentForm.submission.data[n]._id:null})}processAndUpload(e){logger.info(`[TF_SDK:100a] \u{1F4E5} Image upload process initiated for ${e.length} file(s)`);const t=(this.dataValue||[]).map(n=>n.originalName||n.name),s=Array.from(e).filter(n=>(logger.info(`[TF_SDK:100b] \u{1F4C4} Selected file: name="${n.name}", size=${(n.size/1024).toFixed(1)} KB, type="${n.type}"`),t.includes(n.name)?(logger.warn(`[TF_SDK:100c] \u26A0\uFE0F Duplicate blocked: ${n.name}`),typeof window.showToast=="function"&&window.showToast("File with the same name is already uploaded","danger"),!1):!0));if(s.length===0){logger.info("[TF_SDK:100d] \u2139\uFE0F All selected files are already uploaded. Skipping.");return}logger.info(`[TF_SDK:100e] \u26A1 Starting compression phase for ${s.length} file(s)...`);const o=[];for(let n=0;n<s.length;n++)o.push(this.compressFilePromise(s[n]));Promise.all(o).then(n=>{logger.info(`[TF_SDK:100f] \u2705 Compression phase complete for ${n.length} file(s)`),this.handleFilesToUpload(n)}).catch(n=>{logger.error("[TF_SDK:100g] \u274C processAndUpload failed:",n)})}compressFilePromise(e){return new Promise(t=>{if(e&&["image/gif","image/jpeg","image/png"].includes(e.type)){let o=this.component.fileCompressionSize||2,n=this.component.MaximumCompressionHeightOrWidth||2048;logger.info(`[TF_SDK:101a] \u26A1 Compressing image "${e.name}" (Original: ${(e.size/1024).toFixed(1)} KB)...`);const c={maxSizeMB:o,maxWidthOrHeight:n,useWebWorker:!M};imageCompression(e,c).then(i=>{i.name=e.name,logger.info(`[TF_SDK:101b] \u2705 Compressed "${e.name}" (${(e.size/1024).toFixed(1)} KB -> ${(i.size/1024).toFixed(1)} KB)`),this.blobToBase64(i).then(r=>{N=r,t(i)})}).catch(i=>{logger.warn(`[TF_SDK:101c] \u26A0\uFE0F Compression failed for "${e.name}", using original:`,i.message),t(e)})}else logger.info(`[TF_SDK:101d] \u2139\uFE0F File "${e.name}" is non-compressible type (${e.type}). Using original.`),t(e)})}compressFile(e){this.processAndUpload(e)}async prepareFilesToUpload(e){if(this.component.multiple||(e=Array.prototype.slice.call(e,0,1)),this.component.storage&&e&&e.length){this.fileDropHidden=!0;const t=await Promise.all([...e].map(async s=>await this.prepareFileToUpload(s)));return this.redraw(),typeof window!="undefined"&&window.requestAnimationFrame(()=>{document.body.offsetHeight}),t}else return Promise.resolve()}async handleFilesToUpload(e){logger.info(`[TF_SDK:102] \u2705 handleFilesToUpload received ${e.length} files`),await this.prepareFilesToUpload(e),this.autoSync||await this.syncFiles()}prepareFileToDelete(e){this.filesToSync.filesToDelete.push({...e,status:"info",message:this.autoSync?this.t("Ready to be removed from storage"):this.t("Preparing file to remove")}),e&&e.id&&O(e.id).catch(s=>{logger.warn("[TF_SDK:102c] \u26A0\uFE0F Failed to mark file mode='D' in IndexedDB:",s)});const t=this.dataValue.findIndex(s=>s===e||s.id&&s.id===e.id||s.name&&s.name===e.name);t!==-1?this.splice(t):logger.warn("[TF_SDK:102b] \u26A0\uFE0F Could not find file to delete in dataValue:",e),this.redraw()}handleFileToRemove(e){this.prepareFileToDelete(e),this.autoSync||this.syncFiles()}async deleteFile(e){const{options:t={}}=this.component;if(e&&["url","indexeddb","s3","azure","googledrive"].includes(this.component.storage)){const{fileService:s}=this;if(s&&typeof s.deleteFile=="function")return await s.deleteFile(e,t);{const o=this.options.formio||this.root&&this.root.formio;if(o)return await o.makeRequest("",e.url,"delete")}}}async delete(){return this.filesToSync.filesToDelete.length?await Promise.all(this.filesToSync.filesToDelete.map(async e=>{try{if(e.isValidationError)return{fileToSync:e};await this.deleteFile(e),e.status="success",e.message=this.t("Succefully removed")}catch(t){e.status="error",e.message=typeof t=="string"?t:t.toString()}finally{this.redraw()}return{fileToSync:e}})):Promise.resolve()}updateProgress(e,t){if(e.progress=parseInt(100*t.loaded/t.total),e.status!=="progress")e.status="progress",delete e.message,this.redraw();else{const s=Array.prototype.find.call(this.refs.progress,o=>o.id===e.id);s.innerHTML=`<span class="visually-hidden">${e.progress}% ${this.t("Complete")}</span>`,s.style.width=`${e.progress}%`,s.ariaValueNow=e.progress.toString()}}getMultipartOptions(e){let t=0;return this.component.useMultipartUpload&&this.component.multipart?{...this.component.multipart,progressCallback:s=>{t++,e.status="progress",e.progress=parseInt(100*t/s),delete e.message,this.redraw()},changeMessage:s=>{e.message=s,this.redraw()}}:!1}uploadFile(e){var r,d,a;const{storage:t,options:s={}}=this.component,o=this.interpolate(this.component.url,{file:e}),{groupKey:n,groupPermissions:c}=this.getGroupPermissions(),i=n&&((a=(d=(r=this.currentForm)==null?void 0:r.submission)==null?void 0:d.data[n])==null?void 0:a._id)||null;return this.fileService.uploadFile(t,e.file,e.name,e.dir,l=>{this.updateProgress(e,l)},o,s,e.fileKey,c,i,()=>{this.emit("fileUploadingStart")},l=>{this.abortUploads.push({id:e.id,abort:l})},this.getMultipartOptions(e))}async upload(){return this.filesToSync.filesToUpload.length?(logger.info(`[TF_SDK:102a] \u{1F4BE} Starting IndexedDB upload for ${this.filesToSync.filesToUpload.length} file(s)...`),await Promise.all(this.filesToSync.filesToUpload.map(async e=>{let t=null;try{if(e.isValidationError)return logger.warn(`[TF_SDK:102b] \u26A0\uFE0F Skipping upload for ${e.originalName} due to validation error`),{fileToSync:e,fileInfo:t};if(e.status==="success"){const o=this.resolvedFiles.find(n=>n.fileToSync.originalName===e.originalName);return{fileToSync:o.fileToSync,fileInfo:o.fileInfo}}logger.info(`[TF_SDK:102c] \u{1F4BE} Uploading file to IndexedDB: name="${e.originalName}", size=${(e.size/1024).toFixed(1)} KB`);const s=this.pendingfiles.find(o=>o.name===e.name);if(s)t=await s.fileInfoProm;else{const o=this.uploadFile(e);this.pendingfiles.push({name:e.name,fileInfoProm:o}),t=await o}this.pendingfiles=this.pendingfiles.filter(o=>o.name!==e.name),e.status="success",e.message=this.t("Succefully uploaded"),t.originalName=e.originalName,t.hash=e.hash,logger.info(`[TF_SDK:102d] \u2705 Saved to IndexedDB successfully: name="${e.originalName}", ID="${t==null?void 0:t.id}", Mode="${(t==null?void 0:t.mode)||"A"}"`),this.emit("fileUploadingEnd")}catch(s){logger.error(`[TF_SDK:102e] \u274C Upload to IndexedDB failed for ${e.originalName}:`,s),e.status="error",delete e.progress,e.message=typeof s=="string"?s:s.type==="abort"?this.t("Request was aborted"):s.toString(),this.emit("fileUploadingEnd"),this.emit("fileUploadError",{fileToSync:e,response:s})}finally{delete e.progress,this.redraw();const s=this.resolvedFiles.find(o=>o.fileInfo.originalName===e.originalName);t&&!s&&this.resolvedFiles.push({fileToSync:e,fileInfo:t})}return{fileToSync:e,fileInfo:t}}))):Promise.resolve()}async syncFiles(){var e,t,s;logger.info("[TF_SDK:108] \u2705 syncFiles started"),this.isSyncing=!0,this.fileDropHidden=!0,this.redraw();try{const[o=[],n=[]]=await Promise.all([this.delete(),this.upload()]);if(logger.info(`[TF_SDK:109] \u2705 syncFiles results: ${n.length} uploaded, ${o.length} deleted`),n.length!==((t=(e=this.filesToSync)==null?void 0:e.filesToUpload)==null?void 0:t.length))return;this.filesToSync.filesToDelete=o.filter(i=>{var r;return((r=i.fileToSync)==null?void 0:r.status)==="error"}).map(i=>i.fileToSync),this.filesToSync.filesToUpload=n.filter(i=>{var r;return((r=i.fileToSync)==null?void 0:r.status)==="error"}).map(i=>i.fileToSync),this.hasValue()||(this.dataValue=[]);const c=n.filter(i=>{var r;return((r=i.fileToSync)==null?void 0:r.status)==="success"}).map(i=>i.fileInfo);if(logger.info(`[TF_SDK:110] \u2705 syncFiles succeeded for ${c.length} new files`),P){P=!1;const i=c[0];if(!i)logger.warn("[TF_SDK:111a] \u26A0\uFE0F replace=true but no fileInfo available \u2014 skipping replace");else{let r;for(let d=0;d<this.dataValue.length;d++)this.dataValue[d].originalName==i.originalName&&(logger.info("[TF_SDK:111] \u2705 original name matches at index "+d),r=d);if(r!==void 0){let d=this.dataValue[r].id;logger.info("[TF_SDK:112] \u2705 originalFileId ="+d+", replacing with new id ="+i.id),this.dataValue[r]=i;let a=new CustomEvent("deleteOriginalFileFromDB",{detail:{fileId:d}});document.dispatchEvent(a)}else logger.warn("[TF_SDK:112a] \u26A0\uFE0F Could not find original file to replace in dataValue for: "+i.originalName),this.dataValue.push(i)}}else this.dataValue.push(...c);return(s=this.triggerChange)==null||s.call(this,{modified:!0}),Promise.resolve()}catch(o){return logger.error("[TF_SDK:113] \u274C syncFiles error:",o),Promise.reject()}finally{this.isSyncing=!1,this.fileDropHidden=!1,this.abortUploads=[],this.redraw()}}blobToBase64(e){return new Promise((t,s)=>{const o=new FileReader;o.onloadend=()=>t(o.result),o.readAsDataURL(e)})}getFile(e){const{options:t={}}=this.component,{fileService:s}=this;if(!s)return alert("File Service not provided");this.component.privateDownload&&(e.private=!0),s.downloadFile(e,t).then(o=>{o&&(["base64","indexeddb"].includes(o.storage)?download(o.url,o.originalName||o.name,o.type):window.open(o.url,"_blank"))}).catch(o=>{alert(o)})}focus(){"beforeFocus"in this.parent&&this.parent.beforeFocus(this),this.refs.fileBrowse&&this.refs.fileBrowse.focus()}async beforeSubmit(){try{return this.autoSync?(await this.syncFiles(),this.shouldSyncFiles?Promise.reject("Synchronization is failed"):Promise.resolve()):Promise.resolve()}catch(e){return Promise.reject(e.message)}}destroy(e){this.stopVideo(),super.destroy(e)}}A.editForm=q,j.addComponent("file",A),logger.info("[TF_SDK:114] \u2705 Script execution finished and component 'file' registered")})();</script>
36664
37202
  <script>(function(){window.openImagePreviewModal=function(W,$){let L="var(--tf-primary-color, #2586c7)",v="white",I="white";document.querySelector(".tf-embed-sdk")&&window.__unviredThemeData&&(window.__unviredThemeData.primaryColor&&(L=window.__unviredThemeData.primaryColor),window.__unviredThemeData.secondaryColor&&(v=window.__unviredThemeData.secondaryColor),window.__unviredThemeData.backgroundColor&&(I=window.__unviredThemeData.backgroundColor));const l=document.createElement("div");l.style.position="fixed",l.style.top="0",l.style.left="0",l.style.width="100vw",l.style.height="100vh",l.style.backgroundColor="rgba(0, 0, 0, 0.85)",l.style.display="flex",l.style.alignItems="center",l.style.justifyContent="center",l.style.zIndex="999999";const r=document.createElement("div");r.style.width="90vw",r.style.height="90vh",r.style.backgroundColor="#fff",r.style.borderRadius="8px",r.style.display="flex",r.style.flexDirection="column",r.style.overflow="hidden",r.style.boxShadow="0 4px 12px rgba(0,0,0,0.5)";const p=document.createElement("div");p.style.backgroundColor=L,p.style.color=v,p.style.padding="10px 15px",p.style.display="flex",p.style.justifyContent="space-between",p.style.alignItems="center",p.style.position="relative";const y=document.createElement("button");y.innerHTML="Reset",y.title="Reset Zoom",y.style.background="transparent",y.style.border=`1px solid ${v}`,y.style.borderRadius="4px",y.style.color=v,y.style.fontSize="12px",y.style.cursor="pointer",y.style.padding="4px 10px",p.appendChild(y);const d=document.createElement("span");d.textContent=$||"Preview",d.style.fontSize="16px",d.style.fontWeight="500",d.style.whiteSpace="nowrap",d.style.overflow="hidden",d.style.setProperty("color",v,"important"),d.style.textOverflow="ellipsis",d.style.position="absolute",d.style.left="50%",d.style.transform="translateX(-50%)",d.style.maxWidth="50%",p.appendChild(d);const h=document.createElement("button");h.innerHTML="\u2715",h.style.background="transparent",h.style.border="none",h.style.color=v,h.style.fontSize="20px",h.style.cursor="pointer",h.style.padding="0",h.style.lineHeight="1",h.addEventListener("click",t=>{t.stopPropagation(),document.body.removeChild(l)}),p.appendChild(h);const i=document.createElement("div");i.style.flex="1",i.style.display="flex",i.style.alignItems="center",i.style.justifyContent="center",i.style.backgroundColor=I,i.style.overflow="hidden";const u=document.createElement("img");u.src=W,u.style.maxWidth="100%",u.style.maxHeight="100%",u.style.objectFit="contain",u.style.transition="transform 0.2s ease-in-out",i.appendChild(u);let a=1,m=0,f=0;function x(t=!1){const o=i.offsetWidth,e=i.offsetHeight,s=u.offsetWidth*a,g=u.offsetHeight*a,n=Math.abs(s-o)/2,C=Math.abs(g-e)/2;m=Math.max(-n,Math.min(m,n)),f=Math.max(-C,Math.min(f,C)),t?u.style.transition="transform 0.2s ease-in-out":u.style.transition="none",u.style.transform=`translate(${m}px, ${f}px) scale(${a})`}x(),i.addEventListener("wheel",t=>{t.preventDefault();const e=Math.exp((t.deltaY<0?1:-1)*.1);let s=a*e;s<.5&&(s=.5),s>50&&(s=50);const g=s/a,n=i.getBoundingClientRect(),C=n.width/2,D=n.height/2,T=t.clientX-n.left-C,k=t.clientY-n.top-D;m=T-(T-m)*g,f=k-(k-f)*g,a=s,x(!1)},{passive:!1});let b=null;i.addEventListener("touchstart",t=>{t.touches.length===2&&(t.preventDefault(),b=Math.hypot(t.touches[0].clientX-t.touches[1].clientX,t.touches[0].clientY-t.touches[1].clientY))},{passive:!1}),i.addEventListener("touchmove",t=>{if(t.touches.length===2&&b!==null){t.preventDefault();const o=Math.hypot(t.touches[0].clientX-t.touches[1].clientX,t.touches[0].clientY-t.touches[1].clientY),e=o/b;let s=a*e;s<.5&&(s=.5),s>50&&(s=50);const g=s/a,n=i.getBoundingClientRect(),C=n.width/2,D=n.height/2,T=(t.touches[0].clientX+t.touches[1].clientX)/2,k=(t.touches[0].clientY+t.touches[1].clientY)/2,H=T-n.left-C,j=k-n.top-D;m=H-(H-m)*g,f=j-(j-f)*g,a=s,b=o,x(!1)}},{passive:!1}),i.addEventListener("touchend",t=>{t.touches.length<2&&(b=null)});const c=document.createElement("div");c.style.backgroundColor=L,c.style.color=v,c.style.padding="10px 15px",c.style.display="flex",c.style.justifyContent="center",c.style.alignItems="center",c.style.gap="15px";const w=(t,o)=>{const e=document.createElement("button");return e.innerHTML=t,e.title=o,e.style.background="transparent",e.style.border=`1px solid ${v}`,e.style.borderRadius="4px",e.style.color=v,e.style.fontSize="18px",e.style.fontWeight="bold",e.style.cursor="pointer",e.style.width="35px",e.style.height="35px",e.style.display="flex",e.style.alignItems="center",e.style.justifyContent="center",e},_=w("+","Zoom In"),P=w("\u2212","Zoom Out"),B=w("\u2190","Move Left"),S=w("\u2192","Move Right"),X=w("\u2191","Move Up"),Y=w("\u2193","Move Down");c.appendChild(_),c.appendChild(P),c.appendChild(B),c.appendChild(S),c.appendChild(X),c.appendChild(Y);const E=50;_.addEventListener("click",t=>{t.stopPropagation();let o=a+.5;o>50&&(o=50),a=o,x(!0)}),P.addEventListener("click",t=>{t.stopPropagation();let o=a-.5;o<.5&&(o=.5),a=o,x(!0)});let z=null,R=null;const M=(t,o,e)=>{const s=n=>{n.type==="touchstart"&&n.cancelable&&n.preventDefault(),n.stopPropagation(),m+=o,f+=e,x(!0),R=setTimeout(()=>{z=setInterval(()=>{m+=o*.4,f+=e*.4,x(!1)},20)},300)},g=()=>{clearTimeout(R),clearInterval(z)};t.addEventListener("mousedown",s),t.addEventListener("touchstart",s,{passive:!1}),["mouseup","mouseleave","touchend","touchcancel"].forEach(n=>{t.addEventListener(n,g)})};M(B,E,0),M(S,-E,0),M(X,0,E),M(Y,0,-E),y.addEventListener("click",t=>{t.stopPropagation(),a=1,m=0,f=0,x(!0)}),r.appendChild(p),r.appendChild(i),r.appendChild(c),l.addEventListener("click",t=>{t.target===l&&document.body.removeChild(l)}),l.appendChild(r),document.body.appendChild(l)}})();</script>
36665
37203
  <script>(function(){const n=typeof Formio!="undefined"?Formio:typeof window!="undefined"?window.Formio:void 0,a=n&&n.Components&&n.Components.components?n.Components.components.textfield:class{static schema(){return{}}};class i extends a{constructor(o,e,r){super(o,e,r)}static schema(...o){return a.schema({type:"smartId",label:"Smart ID",input:!0,key:"smartId",inputType:"text",inputFormat:"plain",disabled:!0},...o)}static get builderInfo(){return{title:"Smart Id",group:"premium",icon:"id-card-o",weight:40,documentation:"http://help.form.io/userguide/#textfield",schema:i.schema()}}static addTemplate(o,e){Templates.templates[o]=e}get defaultSchema(){return i.schema()}render(){return super.render(this.renderTemplate("input",{input:this.inputInfo}))}attach(o){let e=new Date,r="",s="";if(Number(e.getDate())<=9&&this.component.addLeadingZeros?r="0"+e.getDate():r=e.getDate(),Number(e.getMonth())<=9&&this.component.addLeadingZeros?s="0"+Number(e.getMonth()+1):s=Number(e.getMonth()+1),this.component.addLeadingZeros&&this.component.startCounter!="undefined"&&((this.component.startCounter=="undefined"||this.component.startCounter==null)&&(this.component.startCounter=1),this.component.digitsInConter&&(this.component.startCounter=String(this.component.startCounter).padStart(this.component.digitsInConter,0))),this.component.pattern){let t=this.component.pattern;t.includes("${counter}")?(t=t.replace("${day}",r),t=t.replace("${month}",s),t=t.replace("${year}",e.getFullYear()),t=t.replace("${day}",r),t=t.replace("${counter}",this.component.startCounter),this.setValue(t)):this.resetValue()}return super.attach(o)}}n&&n.Components?n.Components.addComponent("smartId",i):typeof Formio!="undefined"&&Formio.Components&&Formio.Components.addComponent("smartId",i)})();</script>
36666
37204
  <script>(function(){const m=Formio.Components.components.nested;class r extends m{static schema(...t){return m.schema({label:"Columns",key:"columns",type:"columns",columns:[{components:[],width:8,offset:0,push:0,pull:0,size:"md"},{components:[],width:8,offset:0,push:0,pull:0,size:"md"}],clearOnHide:!1,input:!1,tableView:!1,persistent:!1,autoAdjust:!1},...t)}static get builderInfo(){return{title:"Columns",icon:"columns",group:"layout",documentation:"/userguide/form-building/layout-components#columns",showPreview:!1,weight:10,schema:r.schema()}}constructor(t,e,o){super(t,e,o),this.rows=[]}get schema(){var e;const t=_.omit(super.schema,["components"]);return(e=t.columns)==null||e.map((o,s)=>{o.components.map((n,c)=>{const i=_.clone(n);i.internal=!0;const u=this.createComponent(i);delete u.component.internal,t.columns[s].components[c]=u.schema})}),t}get defaultSchema(){return r.schema()}get className(){return`row ${super.className}`}get columnKey(){return`column-${this.id}`}init(){super.init(),this.columns=[],_.each(this.component.columns,(t,e)=>{this.columns[e]=[],t.size||(t.size="md"),t.currentWidth=t.width||0,Array.isArray(t.components)||(t.components=[]),_.each(t.components,o=>{const s=this.createComponent(o);s.column=e,this.columns[e].push(s)})}),this.component.autoAdjust&&this.options.display!=="pdf"&&this.justify(),this.rows=this.groupByRow()}labelIsHidden(){return!0}render(){return super.render(this.renderTemplate("columns",{columnKey:this.columnKey,columnComponents:this.columns.map(t=>this.renderComponents(t))}))}justifyColumn(t,e){const o=_.every(t,i=>!i.visible),s=this.component.columns[e],n=o&&t.length?0:s.width,c=!_.isEqual(n,s.currentWidth);return s.currentWidth=n,c}justify(){return this.columns.reduce((t,e,o)=>this.justifyColumn(e,o)||t,!1)}attach(t){this.loadRefs(t,{[this.columnKey]:"multiple"});const e=super.attach(t);return this.refs[this.columnKey]&&this.refs[this.columnKey].forEach((o,s)=>this.attachComponents(o,this.columns[s],this.component.columns[s].components)),e}get gridSize(){return 12}groupByRow(){const t={stack:[],rows:[]},e=s=>s.component.width,o=_.reduce(this.components,(s,n)=>{const c=[...s.stack,n];return _.sumBy(c,e)<=this.gridSize?(s.stack=c,s):(s.rows=[...s.rows,s.stack],s.stack=[n],s)},t);return _.concat(o.rows,[o.stack])}checkData(t,e,o,s){const n=super.checkData(t,e,o,s);if(this.component.autoAdjust&&this.options.display!=="pdf"&&this.justify()){const i=document.activeElement;i&&(i.tagName==="INPUT"||i.tagName==="TEXTAREA"||i.classList.contains("choices__input"))||this.redraw()}return n}detach(t){super.detach(t)}destroy(){super.destroy(),this.columns=[]}}Formio.Components.addComponent("columns",r)})();</script>
@@ -38315,14 +38853,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
38315
38853
  Expecting `+b.join(", ")+", got '"+(this.terminals_[y]||y)+"'":x="Parse error on line "+(o+1)+": Unexpected "+(y==1?"end of input":"'"+(this.terminals_[y]||y)+"'"),this.parseError(x,{text:this.lexer.match,token:this.terminals_[y]||y,line:this.lexer.yylineno,loc:E,expected:b})}if(v==3){if(y==J)throw new Error(x||"Parsing halted.");T=this.lexer.yyleng,_=this.lexer.yytext,o=this.lexer.yylineno,E=this.lexer.yylloc,y=Y()}for(;!(N.toString()in r[g]);){if(g===0)throw new Error(x||"Parsing halted.");H(1),g=a[a.length-1]}O=y==2?null:y,y=N,g=a[a.length-1],m=r[g]&&r[g][N],v=3}if(m[0]instanceof Array&&m.length>1)throw new Error("Parse Error: multiple actions possible at state: "+g+", token: "+y);switch(m[0]){case 1:a.push(y),f.push(this.lexer.yytext),l.push(this.lexer.yylloc),a.push(m[1]),y=null,O?(y=O,O=null):(T=this.lexer.yyleng,_=this.lexer.yytext,o=this.lexer.yylineno,E=this.lexer.yylloc,v>0&&v--);break;case 2:if(u=this.productions_[m[1]][1],k.$=f[f.length-u],k._$={first_line:l[l.length-(u||1)].first_line,last_line:l[l.length-1].last_line,first_column:l[l.length-(u||1)].first_column,last_column:l[l.length-1].last_column},W&&(k._$.range=[l[l.length-(u||1)].range[0],l[l.length-1].range[1]]),z=this.performAction.call(k,_,T,o,this.yy,m[1],f,l),typeof z!="undefined")return z;u&&(a=a.slice(0,-1*u*2),f=f.slice(0,-1*u),l=l.slice(0,-1*u)),a.push(this.productions_[m[1]][0]),f.push(k.$),l.push(k._$),h=r[a[a.length-2]][a[a.length-1]],a.push(h);break;case 3:return!0}}return!0}},e=function(){var i={EOF:1,parseError:function(s,a){if(this.yy.parser)this.yy.parser.parseError(s,a);else throw new Error(s)},setInput:function(s){return this._input=s,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var a=s.match(/(?:\r\n?|\n).*/g);return a?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},unput:function(s){var a=s.length,f=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-a-1),this.offset-=a;var l=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),f.length-1&&(this.yylineno-=f.length-1);var r=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:f?(f.length===l.length?this.yylloc.first_column:0)+l[l.length-f.length].length-f[0].length:this.yylloc.first_column-a},this.options.ranges&&(this.yylloc.range=[r[0],r[0]+this.yyleng-a]),this},more:function(){return this._more=!0,this},less:function(s){this.unput(this.match.slice(s))},pastInput:function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var s=this.pastInput(),a=new Array(s.length+1).join("-");return s+this.upcomingInput()+`
38316
38854
  `+a+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var s,a,f,l,r;this._more||(this.yytext="",this.match="");for(var _=this._currentRules(),o=0;o<_.length&&(f=this._input.match(this.rules[_[o]]),!(f&&(!a||f[0].length>a[0].length)&&(a=f,l=o,!this.options.flex)));o++);return a?(r=a[0].match(/(?:\r\n?|\n).*/g),r&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+a[0].length},this.yytext+=a[0],this.match+=a[0],this.matches=a,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(a[0].length),this.matched+=a[0],s=this.performAction.call(this,this.yy,this,_[l],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),s||void 0):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
38317
38855
  `+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var s=this.next();return typeof s!="undefined"?s:this.lex()},begin:function(s){this.conditionStack.push(s)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(s){this.begin(s)}};return i.options={},i.performAction=function(s,a,f,l){switch(f){case 0:return"*";case 1:return"/";case 2:return"-";case 3:return"+";case 4:return"^";case 5:return"(";case 6:return")";case 7:return",";case 8:return"==";case 9:return"!=";case 10:return"~=";case 11:return">=";case 12:return"<=";case 13:return"<";case 14:return">";case 15:return"notIn";case 16:return"and";case 17:return"or";case 18:return"not";case 19:return"in";case 20:return"of";case 21:return"if";case 22:return"then";case 23:return"else";case 24:return"mod";case 25:break;case 26:return"Number";case 27:return a.yytext=JSON.stringify({name:a.yytext,type:"unescaped"}),"Symbol";case 28:return a.yytext=JSON.stringify({name:s.buildString("'",a.yytext),type:"single-quoted"}),"Symbol";case 29:return a.yytext=JSON.stringify(s.buildString('"',a.yytext)),"String";case 30:return"%";case 31:return"?";case 32:return":";case 33:return"EndOfExpression"}},i.rules=[/^(?:\*)/,/^(?:\/)/,/^(?:-)/,/^(?:\+)/,/^(?:\^)/,/^(?:\()/,/^(?:\))/,/^(?:\,)/,/^(?:==)/,/^(?:\!=)/,/^(?:\~=)/,/^(?:>=)/,/^(?:<=)/,/^(?:<)/,/^(?:>)/,/^(?:not\s+in[^\w])/,/^(?:and[^\w])/,/^(?:or[^\w])/,/^(?:not[^\w])/,/^(?:in[^\w])/,/^(?:of[^\w])/,/^(?:if[^\w])/,/^(?:then[^\w])/,/^(?:else[^\w])/,/^(?:mod[^\w])/,/^(?:\s+)/,/^(?:[0-9]+(?:\.[0-9]+)?(?![0-9\.]))/,/^(?:[a-zA-Z$_][\.a-zA-Z0-9$_]*)/,/^(?:'(?:\\'|\\\\|[^'\\])*')/,/^(?:"(?:\\"|\\\\|[^"\\])*")/,/^(?:\%)/,/^(?:\?)/,/^(?::)/,/^(?:$)/],i.conditions={INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33],inclusive:!0}},i}();t.lexer=e;function n(){this.yy={}}return n.prototype=t,t.Parser=n,new n}(),a1=s1;s1.Parser;var c1=function(t){function e(n){var i;return U(this,e),i=R(this,e,["Unknown function: ".concat(n,"()")]),C(i,"I18N_STRING","UNKNOWN_FUNCTION"),i.functionName=n,i}return B(e,t),M(e)}(S(ReferenceError)),V=function(t){function e(n){var i;return U(this,e),i=R(this,e,["Property \u201C".concat(n,"\u201D does not exist.")]),C(i,"I18N_STRING","UNKNOWN_PROPERTY"),i.propertyName=n,i}return B(e,t),M(e)}(S(ReferenceError)),w1=function(t){function e(n){var i;return U(this,e),i=R(this,e,["Unknown option: ".concat(n)]),C(i,"I18N_STRING","UNKNOWN_OPTION"),i.keyName=n,i}return B(e,t),M(e)}(S(TypeError)),D=function(t){function e(n,i){var c;return U(this,e),c=R(this,e,["Expected a ".concat(n,", but got a ").concat(i," instead.")]),C(c,"I18N_STRING","UNEXPECTED_TYPE"),c.expectedType=n,c.recievedType=i,c}return B(e,t),M(e)}(S(TypeError)),K=function(t){function e(n){var i;return U(this,e),i=R(this,e,[n]),C(i,"I18N_STRING","INTERNAL"),i}return B(e,t),M(e)}(S(Error));function I(t,e){return P(t)==="object"||typeof t=="function"?Object.prototype.hasOwnProperty.call(t,e):!1}function _1(t,e){return(t%e+e)%e}function v1(t){if(P(t)!=="object")return t;if(t instanceof Number||t instanceof String||t instanceof Boolean)return t.valueOf()}function G(t){return Array.isArray(t)&&t.length===1&&(t=t[0]),v1(t)}function L(t){return t=G(t),t===void 0?"undefined":t===null?"null":t===!0?"true":t===!1?"false":typeof t=="number"?"number":typeof t=="string"?"text":P(t)!=="object"&&typeof t!="function"?"unknown type":Array.isArray(t)?"list":"object"}function d(t){if(t=G(t),typeof t=="number")return t;throw new D("number",L(t))}function u1(t){if(t=G(t),typeof t=="string")return t;throw new D("text",L(t))}function $(t){if(t=G(t),typeof t=="string"||typeof t=="number")return t;throw new D("text or number",L(t))}function x1(t){if(t=G(t),typeof t=="boolean")return t;throw new D("logical value (\u201Ctrue\u201D or \u201Cfalse\u201D)",L(t))}function t1(t){if(t==null)throw new D("list",L(t));return Array.isArray(t)?t:[t]}function e1(t){for(var e=Q(t),n=[];e.length;){var i=e.pop();Array.isArray(i)?e.push.apply(e,Q(i)):n.push(i)}return n.reverse()}var l1={isfn:function(e,n){return I(e,n)&&typeof e[n]=="function"},unknown:function(e){throw new c1(e)},coerceArray:t1,coerceNumber:d,coerceNumberOrString:$,coerceBoolean:x1,isSubset:function(e,n){var i=t1(e),c=t1(n);return i.every(function(s){return c.includes(s)})},warnDeprecated:function(){var t=3,e={ternary:0,modulo:0};return function(n,i){switch(n){case"ternary":if(e.ternary++>=t)break;console.warn("The use of ? and : as conditional operators has been deprecated in Filtrex v3 in favor of the if..then..else ternary operator. See issue #34 for more information.");break;case"modulo":if(e.modulo++>=t)break;console.warn("The use of '%' as a modulo operator has been deprecated in Filtrex v3 in favor of the 'mod' operator. You can use it like this: '3 mod 2 == 1'. See issue #48 for more information.");break}return i}}(),buildString:function(e,n){e=String(e)[0],n=String(n);var i="";if(n[0]!==e||n[n.length-1]!==e)throw new K("Unexpected internal error: String literal doesn't begin/end with the right quotation mark.");for(var c=1;c<n.length-1;c++)if(n[c]==="\\"){if(c++,c>=n.length-1)throw new K("Unexpected internal error: Unescaped backslash at the end of string literal.");if(n[c]==="\\")i+="\\";else if(n[c]===e)i+=e;else throw new K("Unexpected internal error: Invalid escaped character in string literal: ".concat(n[c]))}else{if(n[c]===e)throw new K("Unexpected internal error: String literal contains unescaped quotation mark.");i+=n[c]}return i},reduceRelation:function(e){for(var n=[],i=[],c=e1([e[0]]).join(""),s=0,a=1;a<e.length-1;a+=2){var f=e1([e[a+1]]).join(""),l="tmp".concat(s++);i.push('ops["'.concat(e[a],'"](').concat(c,", ").concat(l," = ").concat(f,")")),c=l,n.push(l)}return"(function(){ var ".concat(n.join(", "),"; return ").concat(i.join(" && "),";})()")}};a1.yy=Object.create(l1);function k1(t,e,n,i){return n==null?n:e(t)}function S1(t,e,n,i){if(i==="single-quoted")return e(t);var c=t.split("."),s=r1(c),a;try{for(s.s();!(a=s.n()).done;){var f,l=a.value;if(I((f=n)!==null&&f!==void 0?f:{},l))n=n[l];else throw new V(l)}}catch(r){s.e(r)}finally{s.f()}return n}function E1(t,e,n,i){if(n==null)return n;if(i==="single-quoted")return e(t);var c=t.split("."),s=r1(c),a;try{for(s.s();!(a=s.n()).done;){var f=a.value;if(n==null)return n;n=n[f]}}catch(l){s.e(l)}finally{s.f()}return n}function O1(t,e){var n;if(arguments.length>2)throw new TypeError("Too many arguments.");e=P(e)==="object"?e:{};for(var i=["extraFunctions","constants","customProp","operators"],c=e,s=c.extraFunctions,a=c.constants,f=c.customProp,l=c.operators,r=0,_=Object.keys(e);r<_.length;r++){var o=_[r];if(!i.includes(o))throw new w1(o)}var T={abs:Math.abs,ceil:Math.ceil,floor:Math.floor,log:Math.log,log2:Math.log2,log10:Math.log10,max:Math.max,min:Math.min,round:Math.round,sqrt:Math.sqrt,exists:function(u){return u!=null},empty:function(u){return u==null||u===""||Array.isArray(u)&&u.length===0}};if(s)for(var v=0,N=Object.keys(s);v<N.length;v++){var J=N[v];T[J]=s[J]}var E={"+":function(u,h){return $(u)+$(h)},"-":function(u,h){return h===void 0?-d(u):d(u)-d(h)},"*":function(u,h){return d(u)*d(h)},"/":function(u,h){return d(u)/d(h)},"^":function(u,h){return Math.pow(d(u),d(h))},mod:function(u,h){return _1(d(u),d(h))},"==":function(u,h){return u===h},"!=":function(u,h){return u!==h},"<":function(u,h){return d(u)<d(h)},"<=":function(u,h){return d(u)<=d(h)},">=":function(u,h){return d(u)>=d(h)},">":function(u,h){return d(u)>d(h)},"~=":function(u,h){return RegExp(u1(h)).test(u1(u))}};if(l)for(var W=0,H=Object.keys(l);W<H.length;W++){var Y=H[W];E[Y]=l[Y]}l=E,a=(n=a)!==null&&n!==void 0?n:{};var y=e1(a1.parse(t));y.unshift("return "),y.push(";");function O(p,u,h){if(I(u!=null?u:{},p))return u[p];throw new V(p)}function g(p){return function(h){if(I(p!=null?p:{},h))return p[h];throw new V(h)}}typeof f=="function"&&(O=function(u,h,b){return f(u,g(h),h,b)});function m(p){return function(h){for(var b=h.name,x=arguments.length,w=new Array(x>1?x-1:0),Z=1;Z<x;Z++)w[Z-1]=arguments[Z];if(I(p,b)&&typeof p[b]=="function")return p[b].apply(p,w);throw new c1(b)}}function z(p,u){var h=p.name,b=p.type;return b==="unescaped"&&I(a,h)?a[h]:O(h,u,b)}var k=new Function("call","ops","std","prop","data",y.join(""));return function(p){try{return k(m(T),l,l1,z,p)}catch(u){return u}}}return A.compileExpression=O1,A.useDotAccessOperator=S1,A.useDotAccessOperatorAndOptionalChaining=E1,A.useOptionalChaining=k1,Object.defineProperty(A,"__esModule",{value:!0}),A}({})})();</script>
38318
- <script>(function(){const b=typeof Formio!="undefined"?Formio:typeof window!="undefined"?window.Formio:void 0,O=typeof FormioUtils!="undefined"?FormioUtils:b?b.Utils:typeof window!="undefined"?window.FormioUtils:void 0,C=b&&b.Components&&b.Components.components?b.Components.components.list:class{static schema(){return{}}},D=O&&O.getRandomComponentId?O.getRandomComponentId:()=>Math.random().toString(36).substring(7),F=O&&O.boolValue?O.boolValue:V=>!!V,L=V=>!!V&&typeof V.then=="function";var E=window.platform==="web";class I extends C{static schema(...e){return C.schema({type:"select",label:"Select",key:"select",idPath:"id",data:{values:[{label:"",value:""}],json:"",url:"",resource:"",custom:""},clearOnRefresh:!1,limit:100,dataSrc:"values",valueProperty:"",lazyLoad:!0,filter:"",searchEnabled:!0,searchDebounce:.3,searchField:"",minSearch:0,readOnlyValue:!1,authenticate:!1,ignoreCache:!1,template:"<span>{{ item.label }}</span>",selectFields:"",searchThreshold:.3,uniqueOptions:!1,tableView:!0,fuseOptions:{include:"score",threshold:.3},indexeddb:{filter:{}},customOptions:{},useExactSearch:!1},...e)}static get builderInfo(){return{title:"Select",group:"basic",icon:"th-list",weight:70,documentation:"/userguide/#select",schema:I.schema()}}static get serverConditionSettings(){return SelectComponent.conditionOperatorsSettings}static get conditionOperatorsSettings(){return{...super.conditionOperatorsSettings,valueComponent(e){const t={...e,type:"select"};return isSelectResourceWithObjectValue(e)&&(t.reference=!1,t.onSetItems=`
38856
+ <script>(function(){const b=typeof Formio!="undefined"?Formio:typeof window!="undefined"?window.Formio:void 0,v=typeof FormioUtils!="undefined"?FormioUtils:b?b.Utils:typeof window!="undefined"?window.FormioUtils:void 0,C=b&&b.Components&&b.Components.components?b.Components.components.list:class{static schema(){return{}}},D=v&&v.getRandomComponentId?v.getRandomComponentId:()=>Math.random().toString(36).substring(7),F=v&&v.boolValue?v.boolValue:V=>!!V,L=V=>!!V&&typeof V.then=="function";var E=window.platform==="web";class I extends C{static schema(...e){return C.schema({type:"select",label:"Select",key:"select",idPath:"id",data:{values:[{label:"",value:""}],json:"",url:"",resource:"",custom:""},clearOnRefresh:!1,limit:100,dataSrc:"values",valueProperty:"",lazyLoad:!0,filter:"",searchEnabled:!0,searchDebounce:.3,searchField:"",minSearch:0,readOnlyValue:!1,authenticate:!1,ignoreCache:!1,template:"<span>{{ item.label }}</span>",selectFields:"",searchThreshold:.3,uniqueOptions:!1,tableView:!0,fuseOptions:{include:"score",threshold:.3},indexeddb:{filter:{}},customOptions:{},useExactSearch:!1},...e)}static get builderInfo(){return{title:"Select",group:"basic",icon:"th-list",weight:70,documentation:"/userguide/#select",schema:I.schema()}}static get serverConditionSettings(){return SelectComponent.conditionOperatorsSettings}static get conditionOperatorsSettings(){return{...super.conditionOperatorsSettings,valueComponent(e){const t={...e,type:"select"};return isSelectResourceWithObjectValue(e)&&(t.reference=!1,t.onSetItems=`
38319
38857
  var templateKeys = FormioUtils.getItemTemplateKeys(component.template) || [];
38320
38858
  items = _.map(items || [], i => {
38321
38859
  var item = {};
38322
38860
  _.each(templateKeys, k => _.set(item, k, _.get(i, k)));
38323
38861
  return item;
38324
38862
  })
38325
- `),t}}}static savedValueTypes(e){const{boolean:t,string:o,number:i,object:r,array:s}=componentValueTypes,{dataType:l,reference:a}=e,h=getComponentSavedTypes(e);return h||(a?[r]:l==="object"?[r,s]:componentValueTypes[l]?[componentValueTypes[l]]:[t,o,i,r,s])}init(){super.init(),this.templateData={},this.validators=(this.validators||[]).concat(["select","onlyAvailableItems"]);let e=[];const t=_.debounce((...o)=>(e=[],this.updateItems.apply(this,o)),100);this.triggerUpdate=(...o)=>(typeof this.itemsLoadedResolve=="function"&&this.itemsLoadedResolve(),this.itemsLoaded=new Promise(i=>{this.itemsLoadedResolve=i}),o.length&&(e=o),t(...e)),this.selectOptions=[],this.itemsFromUrl&&(this.isFromSearch=!1,this.searchServerCount=null,this.defaultServerCount=null,this.isScrollLoading=!1,this.searchDownloadedResources=[],this.defaultDownloadedResources=[]),this.activated=!1,this.itemsLoaded=new Promise(o=>{this.itemsLoadedResolve=o}),this.shouldPositionDropdown=this.hasDataGridAncestor(),this.isHtmlRenderMode()&&this.activate(),this.getTemplateKeys()}getTemplateKeys(){const e=this.component.template;this.templateKeys=this.options.readOnly&&e?FormioUtils.getItemTemplateKeys(e):[]}get dataReady(){return this.root&&this.root.submissionSet&&!this.attached?Promise.resolve():this.itemsLoaded}get defaultSchema(){return I.schema()}get emptyValue(){if(this.component.multiple)return[];if(this.component.dataSrc==="json"&&this.component.data.json){const e=this.component.data.json[0];let t;return this.valueProperty?t=_.get(e,this.valueProperty):t=e,t&&typeof t=="string"?"":{}}return this.valueProperty?"":{}}get valueProperty(){return this.component.valueProperty?this.component.valueProperty:this.component.dataSrc==="values"?"value":""}get inputInfo(){const e=super.elementInfo();return e.type="select",e.changeEvent="change",e}get isSelectResource(){return this.component.dataSrc==="resource"}get isSelectMaterdata(){return this.component.dataSrc==="masterdata"}get isSelectURL(){return this.component.dataSrc==="url"}get itemsFromUrl(){return this.isSelectResource||this.isSelectURL||this.isSelectMaterdata}get isInfiniteScrollProvided(){return this.itemsFromUrl}get shouldDisabled(){return super.shouldDisabled||this.parentDisabled}get shouldInitialLoad(){return this.component.widget==="html5"&&this.isEntireObjectDisplay()&&this.component.searchField&&this.dataValue?!1:super.shouldLoad}isEntireObjectDisplay(){return this.component.dataSrc==="resource"&&this.valueProperty==="data"}findMasterdataItem(e){if(!this.component.masterdata||e==null)return null;const t=String(e),o=this.component.valueProperty||this.valueProperty;return this.component.masterdata.find(i=>{if(!i||typeof i!="object")return!1;if(o){let s=_.get(i,o);if(s!=null&&String(s)===t||o.startsWith("data.")&&(s=_.get(i,o.replace(/^data\./,"")),s!=null&&String(s)===t)||i[o]!==void 0&&i[o]!==null&&String(i[o])===t)return!0}const r=i.data||i;for(const s of Object.keys(r))if((/id$/i.test(s)||s==="value"||s==="_id"||s==="id")&&r[s]!==void 0&&r[s]!==null&&String(r[s])===t)return!0;return!1})}selectValueAndLabel(e){if((typeof e=="string"||typeof e=="number")&&this.component.dataSrc==="masterdata"&&this.component.masterdata){const o=this.findMasterdataItem(e);o&&(e=o)}const t=this.getOptionValue(this.isEntireObjectDisplay()&&!this.itemValue(e)?e:this.itemValue(e));return{value:t,label:this.itemTemplate(this.isEntireObjectDisplay()&&!_.isObject(e.data)?{data:e}:e,t)}}itemTemplate(e,t){if(!_.isNumber(e)&&_.isEmpty(e))return"";if((typeof e=="string"||typeof e=="number")&&this.component.dataSrc==="masterdata"&&this.component.masterdata){const r=this.findMasterdataItem(e);r&&(e=r)}if(this.options.readOnly&&this.component.readOnlyValue&&!this.component.template&&!this.component.labelProperty)return this.itemValue(e);if(e&&!this.component.template){const r=e.label||e,s=typeof r=="string"?this.t(r,{_userInput:!0}):r;return this.sanitize(s,this.shouldSanitizeValue)}if(this.component.multiple&&_.isArray(this.dataValue)?this.dataValue.find(r=>t===r):this.dataValue===t){const r=this.selectData;if(r){const s=this.component.reference&&t&&(t._id?t._id.toString():t);(!this.templateData||!this.templateData[s])&&this.getOptionTemplate(e,t),this.component.multiple?r[s]&&(e=r[s]):e=r}}if(typeof e=="string"||typeof e=="number")return this.sanitize(this.t(e,{_userInput:!0}),this.shouldSanitizeValue);if(Array.isArray(e))return e.map(r=>typeof r=="string"||typeof r=="number"?this.sanitize(this.t(r,{_userInput:!0}),this.shouldSanitizeValue):r);if(e.data){const r=/item\.data\.\w*/g.test(this.component.template);e.data=this.isEntireObjectDisplay()&&_.isObject(e.data)&&!r?JSON.stringify(e.data):e.data}let o=e;typeof e=="object"&&e!==null&&!e.data&&(o=Object.assign({data:e},e));const i=this.sanitize(this.component.template?this.interpolate(this.component.template,{item:o}):e.label);if(i){const r=i.replace(/<\/?[^>]+(>|$)/g,"");let s;return this.i18next&&this.i18next.translator&&(s=this.i18next.translator),!r||s&&!this.t(r,{_userInput:!0})?void 0:s?i.replace(r,this.t(r,{_userInput:!0})):r}else return JSON.stringify(e)}addOption(e,t,o={},i=D()){if(_.isNil(t))return;const r=this.component.idPath?this.component.idPath.split(".").reduceRight((a,h)=>({[h]:a}),i):{},s=Object.assign({value:this.getOptionValue(e),label:t},r);if(!(this.component.uniqueOptions&&this.selectOptions.find(a=>_.isEqual(a.value,s.value)))&&(e&&this.selectOptions.push(s),this.refs.selectContainer&&this.component.widget==="html5")){s.value&&_.isObject(s.value)&&_.isEmpty(s.value)&&(s.value="");const a=document.createElement("div");a.innerHTML=this.sanitize(this.renderTemplate("selectOption",{selected:_.isEqual(this.getOptionValue(this.dataValue),s.value),option:s,attrs:o,id:i,useId:(this.valueProperty===""||this.isEntireObjectDisplay())&&_.isObject(e)&&i}),this.shouldSanitizeValue).trim(),s.element=a.firstChild,this.refs.selectContainer.appendChild(s.element)}}addValueOptions(e){e=e||[];let t=!1,o=this.dataValue;if(this.options.pdf&&!e.length&&this.component.dataSrc==="url"&&this.valueProperty&&(o=Array.isArray(o)?o.map(i=>_.set({},this.valueProperty,i)):_.set({},this.valueProperty,o)),!this.selectOptions.length){const i=Array.isArray(o)&&this.component.multiple?o:[o];t=this.addCurrentChoices(i,e),!t&&!this.component.multiple&&this.addPlaceholder()}return t}disableInfiniteScroll(){this.downloadedResources&&(this.downloadedResources.serverCount=this.downloadedResources.length,this.serverCount=this.downloadedResources.length)}setItems(e,t){if(logger.info(`[TF_SDK:171] \u2705 setItems() called for '${this.key}'. Items length:`,e?e.length:0,"fromSearch:",t),this.selectItems=e,typeof e=="string")try{e=JSON.parse(e)}catch(h){logger.warn(h.message),e=[]}if(this.component.onSetItems){const h=typeof this.component.onSetItems=="function"?this.component.onSetItems(this,e):this.evaluate(this.component.onSetItems,{items:e},"items");h&&(e=h)}!this.choices&&this.refs.selectContainer&&this.empty(this.refs.selectContainer),this.component.selectValues&&(e=_.get(e,this.component.selectValues,e)||[]);let o;if(this.itemsFromUrl){o=this.isSelectURL?_.isEqual(e,this.downloadedResources):!1;const h=this.component.limit>e.length,n=o&&this.downloadedResources&&this.downloadedResources.length===e.length;h?this.disableInfiniteScroll():n?this.selectOptions=[]:this.serverCount=e.serverCount}if(this.isScrollLoading&&e)o||(this.downloadedResources=this.downloadedResources?this.downloadedResources.concat(e):e),this.downloadedResources.serverCount=e.serverCount||this.downloadedResources.serverCount;else if(this.downloadedResources=e||[],this.selectOptions=[],!_.isEmpty(this.dataValue)&&this.component.idPath){const h=_.get(this.dataValue,this.component.idPath,null),n=!_.isNil(h)&&e.find(c=>_.get(c,this.component.idPath)===h);n&&this.setValue(n)}if(t||this.addValueOptions(e),this.component.widget==="html5"&&!this.component.placeholder&&this.addOption(null,""),_.each(e,(h,n)=>{if(this.root&&this.root.options.editForm&&this.root.options.editForm._id&&this.root.options.editForm._id===h._id)return;const c=this.selectValueAndLabel(h);this.addOption(c.value,c.label,{},_.get(h,this.component.idPath,String(n)))}),logger.info(`[TF_SDK:172] \u2705 selectOptions generated for '${this.key}', length:`,this.selectOptions.length),this.choices)if(logger.info(`[TF_SDK:173] \u2705 this.choices is true for '${this.key}', dataSrc:`,this.component.dataSrc),this.component.dataSrc==="masterdata"&&this.component.masterdata)if(logger.info(`[TF_SDK:174] \u2705 Handling masterdata for '${this.key}'.`),this.selectOptions.sort(function(h,n){return h.value>n.value?1:h.value<n.value?-1:0}),this.isScrollLoading){let h=[];for(let n=0;n<e.length;n++)for(let c=0;c<this.selectOptions.length;c++)this.selectOptions[c].value===e[n][this.component.valueProperty]&&h.push(this.selectOptions[c]);logger.info(`[TF_SDK:175] \u2705 setChoices called (scrollLoading) for '${this.key}' with array length:`,h.length),this.choices.setChoices(h,"value","label",!1)}else logger.info(`[TF_SDK:176] \u2705 setChoices called (normal masterdata) for '${this.key}' with array length:`,this.selectOptions.length),this.choices.setChoices(this.selectOptions,"value","label",!0);else logger.info(`[TF_SDK:177] \u2705 setChoices called (non-masterdata) for '${this.key}' with array length:`,this.selectOptions.length),this.choices.setChoices(this.selectOptions,"value","label",!0);else this.loading;this.isScrollLoading=!1,this.loading=!1;let i=!1;if(this.choices&&this.choices.input&&this.choices.input.isFocussed&&(i=this.choices.input.isFocussed),!(t&&i))if(this.isEmpty()){if(this.shouldAddDefaultValue&&!this.options.readOnly){const h=this.defaultValue;this.isEmpty(h)||this.setValue(h)}}else if(localStorage.getItem("renderMode")==="html"){var s=this.component.template,l=s.substring(s.lastIndexOf(".")+1,s.length),a=l.substring(0,l.indexOf("}"),l.length);if(a=a.trim(),e.length>0&&this.component.multiple){let h=[];for(let n=0;n<e.length;n++)h.push(e[n][a]);this.setValue(h,{noUpdateEvent:!1})}}else this.setValue(this.dataValue,{noUpdateEvent:!0});this.itemsLoadedResolve()}getSingleItemValueForHTMLMode(e){const t=this.selectOptions&&this.selectOptions.find(({value:o})=>_.isEqual(o,e));return t&&t.label||e}itemValueForHTMLMode(e){return this.isHtmlRenderMode()?Array.isArray(e)?e.map(o=>Array.isArray(o)?this.itemValueForHTMLMode(o):this.getSingleItemValueForHTMLMode(o)).join(", "):this.getSingleItemValueForHTMLMode(e):super.itemValueForHTMLMode(e)}get defaultValue(){let e=super.defaultValue;return!e&&(this.component.defaultValue===!1||this.component.defaultValue===0)&&(e=this.component.defaultValue),e}get loadingError(){return!this.component.refreshOn&&!this.component.refreshOnBlur&&this.networkError}loadItems(e,t,o,i,r,s){if(i=i||{},!this.shouldLoad||!this.itemsFromUrl&&this.options.readOnly){this.isScrollLoading=!1,this.loading=!1,this.itemsLoadedResolve();return}const l=parseInt(this.component.minSearch,10);if(this.component.searchField&&l>0&&(!t||t.length<l))return this.setItems([]);r=r||"GET",r.toUpperCase()==="GET"&&(s=null);const a=this.component.limit||100,h=this.isScrollLoading?this.selectOptions.length:0,n=this.component.disableLimit?{}:{limit:a,skip:h};if(e=this.interpolate(e,{formioBase:Formio.getBaseUrl(),search:t,limit:a,skip:h,page:Math.abs(Math.floor(h/a))}),this.component.searchField&&t){const c=Array.isArray(t)?t.join(","):typeof t=="object"?JSON.stringify(t):t;n[this.component.searchField]=this.component.searchField.endsWith("__regex")?_.escapeRegExp(c):c}this.component.selectFields&&(n.select=this.component.selectFields),this.component.sort&&(n.sort=this.component.sort),_.isEmpty(n)||(e+=(e.includes("?")?"&":"?")+Formio.serialize(n,c=>this.interpolate(c))),this.component.filter&&(e+=(e.includes("?")?"&":"?")+this.interpolate(this.component.filter)),i.ignoreCache=this.component.ignoreCache,i.header=o,this.loading=!0,Formio.makeRequest(this.options.formio,"select",e,r,s,i).then(c=>{this.loading=!1,this.error=null,this.setItems(c,!!t)}).catch(c=>{this.itemsFromUrl&&(this.setItems([]),this.disableInfiniteScroll()),this.isScrollLoading=!1,this.handleLoadingError(c)})}handleLoadingError(e){this.loading=!1,e.networkError&&(this.networkError=!0),this.itemsLoadedResolve(),this.emit("componentError",{component:this.component,message:e.toString()}),logger.warn(`[TF_SDK:178] \u26A0\uFE0F Unable to load resources for ${this.key}`)}get requestHeaders(){const e=new Formio.Headers;if(this.component.data&&this.component.data.headers)try{_.each(this.component.data.headers,t=>{t.key&&e.set(t.key,this.interpolate(t.value))})}catch(t){logger.warn(t.message)}return e}getCustomItems(){const e=this.evaluate(this.component.data.custom,{values:[]},"values");return this.asyncValues=L(e),e}asyncCustomValues(){return _.isBoolean(this.asyncValues)||this.getCustomItems(),this.asyncValues}updateCustomItems(e){if(this.asyncCustomValues()){if(!e&&!this.active){this.itemsLoadedResolve();return}this.loading=!0,this.getCustomItems().then(t=>{this.loading=!1,this.setItems(t||[])}).catch(t=>{this.handleLoadingError(t)})}else this.setItems(this.getCustomItems()||[])}isEmpty(e=this.dataValue){return super.isEmpty(e)||e===void 0}refresh(e,t){if(this.component.clearOnRefresh){const o=t?t.instance:null;o&&!o.pristine&&this.setValue(this.emptyValue)}this.updateItems(null,!0)}get additionalResourcesAvailable(){return _.isNil(this.serverCount)||this.serverCount>this.downloadedResources.length}get serverCount(){return this.isFromSearch?this.searchServerCount:this.defaultServerCount}set serverCount(e){this.isFromSearch?this.searchServerCount=e:this.defaultServerCount=e}get downloadedResources(){return this.isFromSearch?this.searchDownloadedResources:this.defaultDownloadedResources}set downloadedResources(e){this.isFromSearch?this.searchDownloadedResources=e:this.defaultDownloadedResources=e}get filteredMasterdata(){if(!this.component.masterdata)return[];let e=[...this.component.masterdata];if(this.component.filter)try{const t=this.component.filter.replace(/(~=\s*)(\{\{.*?\}\})/g,'$1"$2"'),o=this.interpolate(t,{data:this.data}),i=filtrex.compileExpression(o,{customProp:filtrex.useDotAccessOperatorAndOptionalChaining,extraFunctions:{equalsIgnoreCase:(r,s)=>String(r).toLowerCase()===String(s).toLowerCase(),matchIgnoreCase:(r,s)=>new RegExp(s,"i").test(String(r))}});e=e.filter(r=>i({data:r}))}catch(t){return console.warn("[TF_SDK:153] \u26A0\uFE0F Filter error:",t),[]}return e}updateItems(e,t){if(logger.info(`[TF_SDK:179] \u2705 updateItems() called for '${this.key}'. searchInput:`,e,"forceUpdate:",t,"dataSrc:",this.component.dataSrc),this.itemsLoaded=new Promise(o=>{this.itemsLoadedResolve=o}),!this.component.data){logger.warn(`[TF_SDK:180] \u26A0\uFE0F Select component ${this.key} does not have data configuration.`),this.itemsLoadedResolve();return}if(!this.visible){this.itemsLoadedResolve();return}switch(this.component.dataSrc){case"values":this.setItems(this.component.data.values);break;case"json":this.setItems(this.component.data.json);break;case"custom":this.updateCustomItems();break;case"masterdata":logger.info(`[TF_SDK:181] \u2705 masterdata case for '${this.key}'. masterdata length:`,this.filteredMasterdata?this.filteredMasterdata.length:0);let o=this.filteredMasterdata||[];if(o.length>0&&(o=o.map(i=>i&&typeof i=="object"&&!i.data?Object.assign({data:i},i):i)),!this.isFromSearch&&!this.isScrollLoading&&!this.component.dropdownOpened)if(logger.info(`[TF_SDK:182] \u2705 masterdata: Initial/Unopened State for '${this.key}'`),this.defaultDownloadedResources&&this.defaultDownloadedResources.length>0&&this.defaultDownloadedResources.length<o.length)logger.info(`[TF_SDK:183] \u2705 masterdata: defaultDownloadedResources > 0 for '${this.key}'`),this.setItems(this.defaultDownloadedResources);else if(!this.component.dropdownOpened&&this.data[this.key]&&String(this.data[this.key]).trim().length>0){logger.info(`[TF_SDK:184] \u2705 masterdata: Has pre-existing value for '${this.key}'`,this.data[this.key]);let i=[];this.component.multiple&&o.length>0?this.data[this.key].forEach(s=>o.filter(l=>{const a=_.get(l,this.component.valueProperty);(typeof a!="string"?String(a):a).includes(s)&&i.push(l)})):o.length>0&&(i=o.filter(s=>{const l=_.get(s,this.component.valueProperty),a=typeof l!="string"?String(l):l;return a==null?void 0:a.includes(this.data[this.key])}));const r=i.filter((s,l)=>l===i.findIndex(a=>_.get(s,this.component.valueProperty)===_.get(a,this.component.valueProperty)));this.setItems(r)}else logger.info(`[TF_SDK:185] \u2705 masterdata: No pre-existing value, loading full list for '${this.key}' (length: ${o.length})`),this.setItems(o);else logger.info(`[TF_SDK:186/187] \u2705 masterdata: Search/Scroll/Opened State for '${this.key}', loading list (length: ${o.length})`),this.setItems(o);break;case"resource":{if(!this.component.data.resource||!t&&!this.active){this.itemsLoadedResolve();return}let i=this.options.formio?this.options.formio.formsUrl:`${Formio.getProjectUrl()}/form`;if(i+=`/${this.component.data.resource}/submission`,t||this.additionalResourcesAvailable||!this.serverCount)try{this.loadItems(i,e,this.requestHeaders)}catch(r){logger.warn(`[TF_SDK:188] \u26A0\uFE0F Unable to load resources for ${this.key}`)}else this.setItems(this.downloadedResources);break}case"url":{if(!t&&!this.active&&!this.calculatedValue){this.itemsLoadedResolve();return}let{url:i}=this.component.data,r,s;i.startsWith("/")&&(i=(i.startsWith("/project")?Formio.getBaseUrl():Formio.getProjectUrl()||Formio.getBaseUrl())+i),this.component.data.method?(r=this.component.data.method,r.toUpperCase()==="POST"?s=this.component.data.body:s=null):r="GET";const l=this.component.authenticate?{}:{noToken:!0};this.loadItems(i,e,this.requestHeaders,l,r,s);break}case"indexeddb":{if(typeof window=="undefined")return;if(window.indexedDB||window.alert("Your browser doesn't support current version of indexedDB"),this.component.indexeddb&&this.component.indexeddb.database&&this.component.indexeddb.table){const i=window.indexedDB.open(this.component.indexeddb.database);i.onupgradeneeded=r=>{if(this.component.customOptions){const s=r.target.result,l=s.createObjectStore(this.component.indexeddb.table,{keyPath:"myKey",autoIncrement:!0});l.transaction.oncomplete=()=>{const a=s.transaction(this.component.indexeddb.table,"readwrite");this.component.customOptions.forEach(h=>{a.objectStore(this.component.indexeddb.table).put(h)})}}},i.onerror=()=>{window.alert(i.errorCode)},i.onsuccess=r=>{const a=r.target.result.transaction(this.component.indexeddb.table,"readwrite").objectStore(this.component.indexeddb.table);new Promise(h=>{const n=[];a.getAll().onsuccess=c=>{c.target.result.forEach(d=>{n.push(d)}),h(n)}}).then(h=>{_.isEmpty(this.component.indexeddb.filter)||(h=_.filter(h,this.component.indexeddb.filter)),this.setItems(h)})}}}}}addPlaceholder(){!this.component.placeholder||!this.component.placeholder.trim()||this.addOption("",this.component.placeholder,{placeholder:!0})}activate(){(this.loading||!this.active)&&this.setLoadingItem(),!this.active&&(this.activated=!0,this.triggerUpdate())}setLoadingItem(e=!1){this.choices?e?this.choices.setChoices([{value:`${this.id}-loading`,label:"Loading...",disabled:!0}],"value","label"):this.choices.setChoices([{value:"",label:`<i class="${this.iconClass("refresh")}" style="font-size:1.3em;"></i>`,disabled:!0}],"value","label",!0):(this.component.dataSrc==="url"||this.component.dataSrc==="resource")&&this.addOption("",this.t("loading..."))}get active(){return this.component.dataSrc==="masterdata"&&this.component.masterdata?!this.component.lazyLoad||this.activated:!this.component.lazyLoad||this.activated}render(){const e=this.inputInfo;return e.attr=e.attr||{},e.multiple=this.component.multiple,super.render(this.wrapElement(this.renderTemplate("select",{input:e,selectOptions:"",index:null})))}wrapElement(e){return this.component.addResource&&!this.options.readOnly?this.renderTemplate("resourceAdd",{element:e}):e}choicesOptions(){const e=this.component.hasOwnProperty("searchEnabled")?this.component.searchEnabled:!0,t=this.t(this.component.placeholder,{_userInput:!0});let o=this.component.customOptions||{};if(typeof o=="string")try{o=JSON.parse(o)}catch(a){logger.warn(a.message),o={}}const i={maxPatternLength:1e3,distance:1e3};let r={tokenize:!0,matchAllTokens:!0},s={include:"score",threshold:_.get(this,"component.searchThreshold",.3)},l={removeItemButton:this.component.disabled?!1:_.get(this.component,"removeItemButton",!0),itemSelectText:"",classNames:{containerOuter:"choices form-group formio-choices",containerInner:this.transform("class","form-control ui fluid selection dropdown")},addItemText:!1,allowHTML:!0,placeholder:!!this.component.placeholder,placeholderValue:t,noResultsText:this.t("No results found"),noChoicesText:this.t("No choices to choose from"),searchPlaceholderValue:this.t("Type to search"),shouldSort:!1,position:this.component.dropdown?this.component.dropdown:window.platform&&window.platform.iosPlatform?"bottom":"auto",searchEnabled:e,searchChoices:!this.component.searchField,searchFields:_.get(this,"component.searchFields",["label"]),searchResultLimit:_.get(this,"component.searchResultLimit",this.component.limit||100),fuseOptions:this.component.useExactSearch?Object.assign(r,i):Object.assign({},_.get(this,"component.fuseOptions",{}),Object.assign(s,i)),valueComparer:_.isEqual,resetScrollPosition:!1};return Object.assign(l,o)}attach(e){this.component.dropdownOpened=!1;const t=super.attach(e);this.loadRefs(e,{selectContainer:"single",addResource:"single",autocompleteInput:"single"});const o=this.refs.autocompleteInput;o&&this.addEventListener(o,"change",a=>{this.setValue(a.target.value)});const i=this.refs.selectContainer;if(!i)return;if(this.addEventListener(i,this.inputInfo.changeEvent,()=>{if(this.isUpdatingChoices>0){logger.debug(`[TF_SDK] \u2139\uFE0F Ignored programmatic change event on '${this.key}'`);return}this.updateValue(null,{modified:!0})}),this.attachRefreshOnBlur(),this.component.widget==="html5"){this.addFocusBlurEvents(i),this.triggerUpdate(null,!0),this.visible&&this.setItems(this.selectOptions||[]),this.focusableElement=i,this.addEventListener(i,"focus",()=>this.update()),this.addEventListener(i,"keydown",a=>{const{key:h}=a;["Backspace","Delete"].includes(h)&&this.setValue(this.emptyValue)});return}const r=i.tabIndex;this.addPlaceholder(),i.setAttribute("dir",this.i18next.dir()),this.choices&&this.choices.containerOuter&&this.choices.containerOuter.element&&this.choices.containerOuter.element.parentNode&&this.choices.destroy();const s=this.choicesOptions();if(Choices&&(this.choices=new Choices(i,s),["setChoices","setValue","removeActiveItems","clearStore","removeItemsByValue","setChoiceByValue"].forEach(h=>{if(typeof this.choices[h]=="function"){const n=this.choices[h];this.choices[h]=(...c)=>{this.isUpdatingChoices=(this.isUpdatingChoices||0)+1;try{return n.apply(this.choices,c)}finally{this.isUpdatingChoices--}}}}),this.selectOptions&&this.selectOptions.length&&this.choices.setChoices(this.selectOptions,"value","label",!0),this.component.multiple?this.focusableElement=this.choices.input.element:(s.searchEnabled&&window.platform&&window.platform.iosPlatform?this.focusableElement=this.choices.input.element:this.focusableElement=this.choices.containerInner.element,this.choices.containerOuter.element.setAttribute("tabIndex","-1"),s.searchEnabled&&this.addEventListener(this.choices.containerOuter.element,"mousedown",()=>this.positionDropdown())),this.addFocusBlurEvents(this.focusableElement),this.itemsFromUrl&&!this.component.noRefreshOnScroll&&(this.scrollList=this.choices.choiceList.element,this.addEventListener(this.scrollList,"scroll",h=>{this.onScroll(h)})),s.removeItemButton&&this.addEventListener(i,"removeItem",()=>{if(this.isRemoveButtonPressed=!0,this.isUpdatingChoices>0){logger.debug(`[TF_SDK] \u2139\uFE0F Ignored programmatic removeItem event on '${this.key}' (standard list)`);return}this.isEmpty(this.dataValue)||this.updateValue(null,{modified:!0})})),window&&this.choices&&this.shouldPositionDropdown){const a=document.getElementById("formio-wrapper");a&&this.addEventListener(a,"scroll",()=>{this.positionDropdown(!0)},!1,!0),this.addEventListener(window.document,"scroll",()=>{this.positionDropdown(!0)},!1,!0)}if(this.focusableElement.setAttribute("tabIndex",r),this.component.searchField){if(this.choices&&this.choices.input&&this.choices.input.element){var l=(c,d)=>{let g;return function(){const u=this,p=arguments;clearTimeout(g),g=setTimeout(()=>c.apply(u,p),d)}};let n=this;this.addEventListener(this.choices.input.element,"input",l(function(c){if(logger.info(`[TF_SDK:INPUT] \u2328\uFE0F Choices input event triggered for '${n.key}'. Search input:`,c.target.value),n.isFromSearch=!!c.target.value,n.component.dataSrc==="masterdata"&&n.component.masterdata)if(c.target.value.length==0)logger.info(`[TF_SDK:INPUT] Search cleared for '${n.key}'`),n.triggerUpdate(),n.searchDownloadedResources=[],n.component.totalSearchResults=[],n.isFromSearch=!1,n.setItems(n.defaultDownloadedResources);else{let m=[];var d=n.component.template||"",g=d.lastIndexOf("."),u="label";if(g!==-1){var p=d.substring(g+1,d.length),y=p.indexOf("}");y!==-1&&(u=p.substring(0,y).trim())}if(logger.info(`[TF_SDK:INPUT] Parsed label key: '${u}', labelProperty: '${n.component.labelProperty}', limit: ${n.component.limit}, uniqueOptions: ${n.component.uniqueOptions}`),m=n.component.masterdata.filter(S=>{if(!S)return!1;let v;const f=[];n.component.labelProperty&&f.push(n.component.labelProperty),u&&!f.includes(u)&&f.push(u);const R=["Name","label","value","text","title"];for(const w of R)f.includes(w)||f.push(w);for(const w of f)if(S[w]!==void 0&&S[w]!==null){v=S[w];break}return v==null?Object.values(S).some(w=>w&&String(w).toLowerCase().includes(c.target.value.toLowerCase())):String(v).toLowerCase().includes(c.target.value.toLowerCase())}),logger.info(`[TF_SDK:INPUT] Found ${m.length} items matching '${c.target.value}' out of ${n.component.masterdata.length}`),m.length>n.component.limit){logger.info(`[TF_SDK:INPUT] Found items count ${m.length} exceeds limit ${n.component.limit}. Slicing.`),n.component.totalSearchResults=[],n.component.totalSearchResults=m;let S=n.component.totalSearchResults.slice(0,n.component.limit);n.setItems(S)}else logger.info(`[TF_SDK:INPUT] Setting items directly. Count: ${m.length}`),n.setItems(m)}else c.target.value?(n.serverCount=null,n.downloadedResources=[]):n.triggerUpdate()},1e3))}this.addEventListener(i,"choice",()=>{this.component.multiple&&this.component.dataSrc==="resource"&&this.isFromSearch&&this.triggerUpdate(),this.isFromSearch=!1});const a=this.component.searchField&&(this.isSelectResource||this.isSelectURL)?(this.component.searchDebounce===0?0:this.component.searchDebounce||this.defaultSchema.searchDebounce)*1e3:0,h=n=>{this.triggerUpdate(n.detail.value)};this.addEventListener(i,"search",_.debounce(n=>{h(n),this.positionDropdown()},a)),this.addEventListener(i,"stopSearch",()=>this.triggerUpdate()),this.addEventListener(i,"hideDropdown",()=>{if(this.component.dropdownOpened=!1,this.component.totalSearchResults=[],this.component.searchDownloadedResources=[],this.isFromSearch=!1,this.component.dataSrc==="masterdata"&&this.component.masterdata){let n,c={};c.limit=this.component.limit;const d=this.filteredMasterdata;this.data[this.key]&&String(this.data[this.key]).length>0&&(n=d.filter(u=>{const p=u[this.component.valueProperty],y=typeof p!="string"?String(p):p;return y==null?void 0:y.includes(this.data[this.key])})),this.defaultDownloadedResources.findIndex(u=>u[this.component.valueProperty]===String(this.data[this.key]))>-1||n&&n.length>0&&this.defaultDownloadedResources.push(n[0]),c=this.defaultDownloadedResources,c.serverCount=d.length,c.skip=this.defaultDownloadedResources.length+this.component.limit,this.setItems(this.defaultDownloadedResources)}}),this.addEventListener(i,"hideDropdown",()=>{const n=document.getElementById("form-container"),c=n?n.scrollTop:0;this.choices&&this.choices.input&&this.choices.input.element&&(this.choices.input.element.value=""),this.component.dataSrc==="masterdata"&&this.updateItems(null,!0),n&&c>0&&requestAnimationFrame(()=>{n.scrollTop===0&&!window._unv_selecting&&(n.scrollTop=c)})})}return this.addEventListener(i,"mousedown",()=>{window._unv_selecting=!0,window.platform&&window.platform.iosPlatform&&document.activeElement&&(document.activeElement.tagName==="INPUT"||document.activeElement.classList.contains("choices__input"))&&document.activeElement.blur(),setTimeout(()=>{window._unv_selecting=!1},500),this.positionDropdown()}),this.addEventListener(i,"showDropdown",()=>{this.activated||this.update(),this.positionDropdown(),this.component.dataSrc==="masterdata"&&this.component.masterdata&&(this.component.dropdownOpened=!0,(!this.defaultDownloadedResources||this.defaultDownloadedResources.length<this.filteredMasterdata.length)&&this.updateItems(null,!0))}),this.shouldPositionDropdown&&this.addEventListener(i,"highlightChoice",()=>{this.positionDropdown()}),this.addEventListener(i,"hideDropdown",()=>{this.component.dataSrc==="masterdata"&&this.component.masterdata&&(this.component.dropdownOpened=!1)}),this.addEventListener(i,"search",a=>{if(logger.info(`[TF_SDK:SEARCH] \u{1F50D} Choices search event triggered for '${this.key}'. Search input:`,a.detail.value),this.component.dataSrc==="masterdata"&&this.component.masterdata){var h=this.component.template||"",n=h.lastIndexOf("."),c="label";if(n!==-1){var d=h.substring(n+1,h.length),g=d.indexOf("}");g!==-1&&(c=d.substring(0,g).trim())}const u=this.component.searchField?this.component.searchField.replace(/__regex$/,""):"";logger.info(`[TF_SDK:SEARCH] Configured searchField: '${this.component.searchField}', clean: '${u}', parsedLabel: '${c}', limit: ${this.component.limit}, uniqueOptions: ${this.component.uniqueOptions}`),this.searchDownloadedResources=this.filteredMasterdata.filter(p=>{if(!p)return!1;let y;const m=[];this.component.searchField&&m.push(this.component.searchField),u&&!m.includes(u)&&m.push(u),this.component.labelProperty&&!m.includes(this.component.labelProperty)&&m.push(this.component.labelProperty),c&&!m.includes(c)&&m.push(c);const S=["Name","label","value","text","title"];for(const f of S)m.includes(f)||m.push(f);for(const f of m)if(p[f]!==void 0&&p[f]!==null){y=p[f];break}let v=!1;return y==null?v=Object.values(p).some(f=>f&&String(f).toLowerCase().includes(a.detail.value.toLowerCase())):v=String(y).toLowerCase().includes(a.detail.value.toLowerCase()),v}),logger.info(`[TF_SDK:SEARCH] Found ${this.searchDownloadedResources.length} matching resources out of ${this.filteredMasterdata.length}`),this.isFromSearch=!0}}),this.choices&&s.placeholderValue&&this.choices._isSelectOneElement&&(this.addPlaceholderItem(s.placeholderValue),this.addEventListener(i,"removeItem",()=>{if(this.addPlaceholderItem(s.placeholderValue),this.isUpdatingChoices>0){logger.debug(`[TF_SDK] \u2139\uFE0F Ignored programmatic removeItem event on '${this.key}' (placeholder list)`);return}this.isEmpty(this.dataValue)||this.updateValue(null,{modified:!0})})),this.addValueOptions(),this.setChoicesValue(this.dataValue),this.isSelectResource&&this.refs.addResource&&this.addEventListener(this.refs.addResource,"click",a=>{a.preventDefault();const h=this.ce("div"),n=this.createModal(h),d=`${_.get(this.root,"formio.projectUrl",Formio.getProjectUrl())}/form/${this.component.data.resource}`;new Form(h,d,{}).ready.then(g=>{g.on("submit",u=>{let p=this.valueProperty?_.get(u,this.valueProperty):u;this.component.multiple&&(p=[...this.dataValue,p]),this.setValue(p),this.triggerUpdate(),n.close()})})}),this.disabled=this.shouldDisabled,this.updateItems(),this.triggerUpdate(),this.component.lazyLoad||(this.activated=!0),t}setDropdownPosition(){let e,t;if(this.choices&&this.choices.dropdown&&this.choices.dropdown.element&&(e=this.choices.dropdown.element),this.choices&&this.choices.containerOuter&&this.choices.containerOuter.element&&(t=this.choices.containerOuter.element),!e||!t){console.warn("[TF_SELECT_LOG:ERR] \u26A0\uFE0F dropdown or container element not found in setDropdownPosition");return}const o=t.getBoundingClientRect(),i=window.visualViewport?window.visualViewport.height:window.innerHeight,r=i-(o.top+o.height),s=o.top;let l=t.classList.contains("is-flipped");!l&&r<180&&s>r?(l=!0,t.classList.add("is-flipped"),e.classList.add("is-flipped")):l&&r>=200&&(l=!1,t.classList.remove("is-flipped"),e.classList.remove("is-flipped"));const a=e.offsetHeight||220;let h,n;l?(n=Math.min(a,Math.max(120,s-20)),h=Math.max(10,o.top-n)):(h=o.top+o.height,n=Math.max(120,Math.min(a,i-h-15)));const c={left:`${o.left}px`,width:`${o.width}px`,position:"fixed",bottom:"unset",right:"unset",top:`${h}px`,maxHeight:`${n}px`};_.assign(e.style,c)}hasDataGridAncestor(e){return e=e||this,e.inDataGrid||e.type==="datagrid"?!0:e.parent?this.hasDataGridAncestor(e.parent):!1}positionDropdown(e){!this.shouldPositionDropdown||!this.choices||this.choices.dropdown&&!this.choices.dropdown.isActive&&e||(this.setDropdownPosition(),this.itemsLoaded.then(()=>{this.setDropdownPosition()}))}get isLoadingAvailable(){return!this.isScrollLoading&&this.additionalResourcesAvailable}onScroll(e){if(!this.isFromSearch)if(this.component.dataSrc==="masterdata"&&this.component.masterdata&&this.defaultDownloadedResources.length<this.filteredMasterdata.length){var t=e.target;E?t.scrollHeight-t.scrollTop===t.clientHeight&&(this.isScrollLoading=!0,this.triggerUpdate(this.choices.input.element.value),this.setMasterdata()):(this.isScrollLoading=!0,this.triggerUpdate(this.choices.input.element.value),this.setMasterdata())}else this.isLoadingAvailable&&(this.isScrollLoading=!0,this.setLoadingItem(!0),this.triggerUpdate(this.choices.input.element.value))}setMasterdata(){if(this.component.dataSrc==="masterdata"&&this.component.masterdata){let e={},t;e.limit=this.component.limit;let o;const i=this.filteredMasterdata;if(this.data[this.key]&&String(this.data[this.key]).trim().length>0&&(o=i.filter(r=>{const s=_.get(r,this.component.valueProperty),l=typeof s!="string"?String(s):s;return l==null?void 0:l.includes(this.data[this.key])})),this.isFromSearch&&this.searchDownloadedResources&&this.searchDownloadedResources.length>0){const r=this.component.totalSearchResults||this.searchDownloadedResources||[];t=r.slice(this.searchDownloadedResources.length,this.searchDownloadedResources.length+this.component.limit),e=t,e.serverCount=r.length,e.skip=this.searchDownloadedResources.length+this.component.limit}else{t=i.slice(this.defaultDownloadedResources.length,this.defaultDownloadedResources.length+this.component.limit);let r=this.defaultDownloadedResources.filter(a=>t.includes(a));if(r&&r.length>0){let a=t.findIndex(h=>_.get(h,this.component.valueProperty)===_.get(r[0],this.component.valueProperty));a>-1&&t.splice(a,1)}let s=t.findIndex(a=>_.get(a,this.component.valueProperty)===String(this.data[this.key]));s>-1&&t.splice(s,1),this.defaultDownloadedResources.findIndex(a=>_.get(a,this.component.valueProperty)===String(this.data[this.key]))>-1||o&&o.length>0&&t.push(o[0]),e=t,e.serverCount=i.length,e.skip=this.defaultDownloadedResources.length+this.component.limit}this.setItems(e)}}attachRefreshOnBlur(){this.component.refreshOnBlur&&this.on("blur",e=>{this.checkRefreshOn([{instance:e,value:e.dataValue}],{fromBlur:!0})})}addPlaceholderItem(e){this.choices._store.activeItems.length||this.choices._addItem({value:e,label:e,choiceId:0,groupId:-1,customProperties:null,placeholder:!0,keyCode:null})}update(){this.component.dataSrc==="custom"&&this.updateCustomItems(),this.activate()}set disabled(e){super.disabled=e,this.choices&&(e?(this.setDisabled(this.choices.containerInner.element,!0),this.focusableElement.removeAttribute("tabIndex"),this.choices.disable()):(this.setDisabled(this.choices.containerInner.element,!1),this.focusableElement.setAttribute("tabIndex",this.component.tabindex||0),this.choices.enable()))}get disabled(){return super.disabled}set visible(e){e&&!this._visible!=!e&&this.triggerUpdate(),super.visible=e}get visible(){return super.visible}addCurrentChoices(e,t,o){if(!e)return!1;const i=[],r=e.reduce((s,l)=>{if(!l||_.isEmpty(l))return s;let a=!1;const h=t===this.selectOptions;return t&&t.length&&_.each(t,n=>{if(n._id&&l._id&&n._id===l._id)return a=!0,!1;const c=o?n.value:this.itemValue(n,h);return a|=_.isEqual(c,l),!a}),a?a||s:(i.push(this.selectValueAndLabel(l)),!0)},!1);return this.component.dataSrc==="masterdata"&&this.component.masterdata?this.isFromSearch||i.length&&(this.choices&&this.choices.setChoices(i,"value","label"),i.map(s=>{this.addOption(s.value,s.label)})):i.length&&(this.choices&&this.choices.setChoices(i,"value","label"),i.map(s=>{this.addOption(s.value,s.label)})),r}getValueAsString(e,t){return this.component.multiple&&Array.isArray(e)?e.map(o=>this.asString(o,t)).join(", "):this.asString(e,t)}getValue(){if(this.viewOnly||this.loading||!this.component.lazyLoad&&!this.selectOptions.length||!this.element)return this.dataValue;let e=this.emptyValue;if(this.choices)e=this.choices.getValue(!0),!this.component.multiple&&this.component.placeholder&&e===this.t(this.component.placeholder,{_userInput:!0})&&(e=this.emptyValue);else if(this.refs.selectContainer){if(e=this.refs.selectContainer.value,this.valueProperty===""||this.isEntireObjectDisplay()){if(e==="")return{};const t=this.selectOptions[e]||this.selectOptions.find(o=>o.id===e);t&&_.isObject(t.value)&&(e=t.value)}}else e=this.dataValue;return e==null&&(e=""),e}redraw(){const e=super.redraw();return this.triggerUpdate(),e}normalizeSingleValue(e,t){if(_.isNil(e))return;const o=_.isObject(e);if(o&&Object.keys(e).length===0)return e;if(t){const s=this.component.reference&&e&&e._id?e._id.toString():e,l=!o||this.component.reference;if(s&&l&&this.templateData&&this.templateData[s]&&this.root&&this.root.submission){const a=this.root.submission;a.metadata||(a.metadata={}),a.metadata.selectData||(a.metadata.selectData={});let h=this.templateData[s];if(this.component.multiple){h={};const n=this.dataValue;n&&_.isArray(n)&&n.length&&n.forEach(c=>{const d=this.component.reference?c._id.toString():c;h[d]=this.templateData[d]}),h[e]=this.templateData[e]}_.set(a.metadata.selectData,this.path,h)}}const i=this.component.dataType||"auto",r={value:e,number(){const s=Number(this.value),l=e.toString()===s.toString();return!Number.isNaN(s)&&Number.isFinite(s)&&e!==""&&l&&(this.value=s),this},boolean(){return _.isString(this.value)&&(this.value.toLowerCase()==="true"||this.value.toLowerCase()==="false")&&(this.value=this.value.toLowerCase()==="true"),this},string(){return this.value=String(this.value),this},object(){return this},auto(){return _.isObject(this.value)?this.value=this.object().value:this.value=this.string().number().boolean().value,this}};try{return r[i]().value}catch(s){return logger.warn("[TF_SDK:189] \u26A0\uFE0F Failed to normalize value",s),e}}normalizeValue(e){return this.component.multiple&&Array.isArray(e)?e.map(t=>this.normalizeSingleValue(t,!0)):super.normalizeValue(this.normalizeSingleValue(e,!0))}updateValue(e,t){return this.isUpdatingChoices>0?(logger.debug(`[TF_SDK] \u2139\uFE0F Blocked updateValue call on '${this.key}' due to programmatic choices update.`),!1):super.updateValue(e,t)}setValue(e,t={}){if(e&&String(e).length>0&&$(".barcode-select-error").remove(),localStorage.getItem("renderMode")==="html"&&this.component.dataSrc==="values"&&this.component.data.values.filter(n=>{(e&&n.value===e||e&&n.value===String(e))&&(e=n.label)}),localStorage.getItem("renderMode")==="html"&&this.component.dataSrc==="masterdata"&&!this.component.multiple){var o=this.component.template,i=o.substring(o.lastIndexOf(".")+1,o.length),r=i.substring(0,i.indexOf("}"),i.length);r=r.trim(),this.component.masterdata.filter(n=>{(e&&n[this.component.valueProperty]===e||e&&n[this.component.valueProperty]===String(e))&&(e=n[r])})}const s=this.dataValue,l=this.updateValue(e,t);e=this.dataValue;const a=!this.isEmpty(s),h=!this.isEmpty(e);if(this.component.multiple&&Array.isArray(e)?e=e.map(n=>typeof n=="boolean"||typeof n=="number"?n.toString():n):(typeof e=="boolean"||typeof e=="number")&&(e=e.toString()),this.isHtmlRenderMode()&&t&&t.fromSubmission&&l)return this.itemsLoaded.then(()=>{this.redraw()}),l;if(this.loading)return l;if(this.isInitApiCallNeeded(h)){this.loading=!0,this.lazyLoadInit=!0;const n=this.component.searchField||this.component.valueProperty;return this.triggerUpdate(_.get(e.data||e,n,e),!0),l}return this.itemsLoaded.then(()=>{this.addValueOptions(),this.setChoicesValue(e,a,t)}),l}isInitApiCallNeeded(e){return this.component.lazyLoad&&!this.lazyLoadInit&&!this.active&&!this.selectOptions.length&&e&&this.shouldInitialLoad&&this.visible&&(this.component.searchField||this.component.valueProperty)}setChoicesValue(e,t,o={}){const i=!this.isEmpty(e)||o.fromSubmission;if(t=t===void 0?!0:t,this.choices)if(i)if(this.component.dataSrc==="masterdata"&&this.component.masterdata){if(!this.isFromSearch){this.choices.removeActiveItems();const r=Array.isArray(e)?e:[e];this.addCurrentChoices(r,this.selectOptions,!0)||this.choices.setChoices(this.selectOptions,"value","label",!0),this.choices.setChoiceByValue(e)}}else{this.choices.removeActiveItems();const r=Array.isArray(e)?e:[e];this.addCurrentChoices(r,this.selectOptions,!0)||this.choices.setChoices(this.selectOptions,"value","label",!0),this.choices.setChoiceByValue(e)}else(t||o.resetValue)&&this.choices.removeActiveItems();else if(i){const r=Array.isArray(e)?e:[e];if(!_.isEqual(this.dataValue,this.defaultValue)&&this.selectOptions.length<2||this.selectData&&o.fromSubmission){const{value:s,label:l}=this.selectValueAndLabel(this.dataValue);this.addOption(s,l)}_.each(this.selectOptions,s=>{_.each(r,l=>{if(s.value===""&&(s.value={}),_.isEqual(l,s.value)&&s.element)return s.element.selected=!0,s.element.setAttribute("selected","selected"),!1})})}else _.each(this.selectOptions,r=>{r.element&&(r.element.selected=!1,r.element.removeAttribute("selected"))})}get itemsLoaded(){return this._itemsLoaded||Promise.resolve()}set itemsLoaded(e){this._itemsLoaded=e}validateValueAvailability(e,t){if(!F(e)||!t)return!0;const o=this.getOptionsValues();if(o){if(_.isObject(t)){const i=r=>{const s=this.normalizeSingleValue(r,!0);if(!_.isObject(s))return!1;try{return JSON.stringify(s)===JSON.stringify(t)}catch(l){return logger.error("Error while comparing items",l),!1}};return o.findIndex(r=>i(r))!==-1}return o.findIndex(i=>this.normalizeSingleValue(i)===t)!==-1}return!1}getOptionValue(e){return _.isObject(e)&&this.isEntireObjectDisplay()?this.normalizeSingleValue(e):_.isObject(e)&&(this.valueProperty||this.component.key!=="resource")?e:_.isObject(e)&&!this.valueProperty?this.interpolate(this.component.template,{item:e}).replace(/<\/?[^>]+(>|$)/g,""):_.isNull(e)?this.emptyValue:String(this.normalizeSingleValue(e))}getOptionsValues(){let e=[];switch(this.component.dataSrc){case"values":e=this.component.data.values;break;case"json":e=this.component.data.json;break;case"custom":e=this.getCustomItems();break}if(typeof e=="string")try{e=JSON.parse(e)}catch(t){logger.warn(t.message),e=[]}if(Array.isArray(e))return e.map(t=>this.getOptionValue(this.itemValue(t)))}deleteValue(){this.setValue("",{noUpdateEvent:!0}),this.unset()}validateMultiple(){return!1}isBooleanOrNumber(e){return typeof e=="number"||typeof e=="boolean"}getNormalizedValues(){if(!(!this.component||!this.component.data||!this.component.data.values))return this.component.data.values.map(e=>({label:e.label,value:String(this.normalizeSingleValue(e.value))}))}asString(e,t={}){var r;e=e||this.getValue();const o=(s,l)=>l?(Array.isArray(s)?s.forEach(a=>a[l]=a[l].toString()):s[l]=s[l].toString(),s):(this.isBooleanOrNumber(s)&&(s=s.toString()),Array.isArray(s)&&s.some(a=>this.isBooleanOrNumber(a))&&(s=s.map(a=>{this.isBooleanOrNumber(a)&&(a=a.toString())})),s);if(e=o(e),this.component.dataSrc==="masterdata"&&this.component.masterdata){const s=l=>(typeof l=="string"||typeof l=="number")&&this.findMasterdataItem(l)||l;Array.isArray(e)?e=e.map(s):e!=null&&(e=s(e))}if(["values","custom"].includes(this.component.dataSrc)&&!this.asyncCustomValues()){const{items:s,valueProperty:l}=this.component.dataSrc==="values"?{items:o(this.getNormalizedValues(),"value"),valueProperty:"value"}:{items:o(this.getCustomItems(),this.valueProperty),valueProperty:this.valueProperty},a=()=>{const h=_.find(s,[l,e]),n=this.defaultSchema.data.values||[];return _.isEqual(h,n[0])?"-":h};e=this.component.multiple&&Array.isArray(e)?_.filter(s,h=>e.includes(h.value)):l?(r=a())!=null?r:{value:e,label:e}:e}if(_.isString(e)&&this.component.dataSrc!=="masterdata")return e;const i=s=>{const l=this.itemTemplate(s);return t.csv&&l?unescapeHTML(l):l};if(Array.isArray(e)){const s=[];return e.forEach(l=>s.push(i(l))),this.component.dataSrc==="resource"&&s.length>0?s.join(", "):s.length>0?s.join("<br />"):"-"}return this.isEntireObjectDisplay()&&_.isObject(e)?JSON.stringify(e):_.isNil(e)?"-":this.itemTemplate(e)}detach(){this.off("blur"),this.choices&&(this.choices&&this.choices.containerOuter&&this.choices.containerOuter.element&&this.choices.containerOuter.element.parentNode&&this.choices.destroy(),this.choices=null),super.detach()}focus(){this.focusableElement&&(super.focus.call(this),this.focusableElement.focus())}setErrorClasses(e,t,o,i,r=this.element){super.setErrorClasses(e,t,o,i,r),this.choices?super.setErrorClasses([this.choices.containerInner.element],t,o,i,r):super.setErrorClasses([this.refs.selectContainer],t,o,i,r)}addFocusBlurEvents(e){this.addEventListener(e,"focus",()=>{this.root.focusedComponent!==this?(this.root.pendingBlur&&this.root.pendingBlur(),this.root.focusedComponent=this,this.emit("focus",this)):this.root.focusedComponent===this&&this.root.pendingBlur&&(this.root.pendingBlur.cancel(),this.root.pendingBlur=null)}),this.addEventListener(e,"blur",()=>{this.root.pendingBlur=FormioUtils.delay(()=>{this.emit("blur",this),this.component.validateOn==="blur"&&this.root.triggerChange({fromBlur:!0},{instance:this,component:this.component,value:this.dataValue,flags:{fromBlur:!0}}),this.root.focusedComponent=null,this.root.pendingBlur=null})})}}b&&b.Components?b.Components.addComponent("select",I):typeof Formio!="undefined"&&Formio.Components&&Formio.Components.addComponent("select",I)})();</script>
38863
+ `),t}}}static savedValueTypes(e){const{boolean:t,string:n,number:o,object:r,array:s}=componentValueTypes,{dataType:h,reference:a}=e,l=getComponentSavedTypes(e);return l||(a?[r]:h==="object"?[r,s]:componentValueTypes[h]?[componentValueTypes[h]]:[t,n,o,r,s])}init(){super.init(),this.templateData={},this.validators=(this.validators||[]).concat(["select","onlyAvailableItems"]);let e=[];const t=_.debounce((...n)=>(e=[],this.updateItems.apply(this,n)),100);this.triggerUpdate=(...n)=>(typeof this.itemsLoadedResolve=="function"&&this.itemsLoadedResolve(),this.itemsLoaded=new Promise(o=>{this.itemsLoadedResolve=o}),n.length&&(e=n),t(...e)),this.selectOptions=[],this.itemsFromUrl&&(this.isFromSearch=!1,this.searchServerCount=null,this.defaultServerCount=null,this.isScrollLoading=!1,this.searchDownloadedResources=[],this.defaultDownloadedResources=[]),this.activated=!1,this.itemsLoaded=new Promise(n=>{this.itemsLoadedResolve=n}),this.shouldPositionDropdown=this.hasDataGridAncestor(),this.isHtmlRenderMode()&&this.activate(),this.getTemplateKeys()}getTemplateKeys(){const e=this.component.template;this.templateKeys=this.options.readOnly&&e?FormioUtils.getItemTemplateKeys(e):[]}get dataReady(){return this.root&&this.root.submissionSet&&!this.attached?Promise.resolve():this.itemsLoaded}get defaultSchema(){return I.schema()}get emptyValue(){if(this.component.multiple)return[];if(this.component.dataSrc==="json"&&this.component.data.json){const e=this.component.data.json[0];let t;return this.valueProperty?t=_.get(e,this.valueProperty):t=e,t&&typeof t=="string"?"":{}}return this.valueProperty?"":{}}get valueProperty(){return this.component.valueProperty?this.component.valueProperty:this.component.dataSrc==="values"?"value":""}get inputInfo(){const e=super.elementInfo();return e.type="select",e.changeEvent="change",e}get isSelectResource(){return this.component.dataSrc==="resource"}get isSelectMaterdata(){return this.component.dataSrc==="masterdata"}get isSelectURL(){return this.component.dataSrc==="url"}get itemsFromUrl(){return this.isSelectResource||this.isSelectURL||this.isSelectMaterdata}get isInfiniteScrollProvided(){return this.itemsFromUrl}get shouldDisabled(){return super.shouldDisabled||this.parentDisabled}get shouldInitialLoad(){return this.component.widget==="html5"&&this.isEntireObjectDisplay()&&this.component.searchField&&this.dataValue?!1:super.shouldLoad}isEntireObjectDisplay(){return(this.component.dataSrc==="resource"||this.component.dataSrc==="masterdata")&&(this.valueProperty==="data"||this.component.valueProperty==="data")}findMasterdataItem(e){if(!this.component.masterdata||e==null)return null;const t=String(e),n=this.component.valueProperty||this.valueProperty;return this.component.masterdata.find(o=>{if(!o||typeof o!="object")return!1;if(n){let s=_.get(o,n);if(s!=null&&String(s)===t||n.startsWith("data.")&&(s=_.get(o,n.replace(/^data\./,"")),s!=null&&String(s)===t)||o[n]!==void 0&&o[n]!==null&&String(o[n])===t)return!0}const r=o.data||o;for(const s of Object.keys(r))if((/id$/i.test(s)||s==="value"||s==="_id"||s==="id")&&r[s]!==void 0&&r[s]!==null&&String(r[s])===t)return!0;return!1})}selectValueAndLabel(e){if((typeof e=="string"||typeof e=="number")&&this.component.dataSrc==="masterdata"&&this.component.masterdata){const n=this.findMasterdataItem(e);n&&(e=n)}const t=this.getOptionValue(this.isEntireObjectDisplay()&&!this.itemValue(e)?e:this.itemValue(e));return{value:t,label:this.itemTemplate(this.isEntireObjectDisplay()&&!_.isObject(e.data)?{data:e}:e,t)}}itemTemplate(e,t){if(!_.isNumber(e)&&_.isEmpty(e))return"";if((typeof e=="string"||typeof e=="number")&&this.component.dataSrc==="masterdata"&&this.component.masterdata){const r=this.findMasterdataItem(e);r&&(e=r)}if(this.options.readOnly&&this.component.readOnlyValue&&!this.component.template&&!this.component.labelProperty)return this.itemValue(e);if(e&&!this.component.template){const r=e.label||e,s=typeof r=="string"?this.t(r,{_userInput:!0}):r;return this.sanitize(s,this.shouldSanitizeValue)}if(this.component.multiple&&_.isArray(this.dataValue)?this.dataValue.find(r=>t===r):this.dataValue===t){const r=this.selectData;if(r){const s=this.component.reference&&t&&(t._id?t._id.toString():t);(!this.templateData||!this.templateData[s])&&this.getOptionTemplate(e,t),this.component.multiple?r[s]&&(e=r[s]):e=r}}if(typeof e=="string"||typeof e=="number")return this.sanitize(this.t(e,{_userInput:!0}),this.shouldSanitizeValue);if(Array.isArray(e))return e.map(r=>typeof r=="string"||typeof r=="number"?this.sanitize(this.t(r,{_userInput:!0}),this.shouldSanitizeValue):r);if(e.data){const r=/item\.data\.\w*/g.test(this.component.template);e.data=this.isEntireObjectDisplay()&&_.isObject(e.data)&&!r?JSON.stringify(e.data):e.data}let n=e;typeof e=="object"&&e!==null&&!e.data&&(n=Object.assign({data:e},e));const o=this.sanitize(this.component.template?this.interpolate(this.component.template,{item:n}):e.label);if(o){const r=o.replace(/<\/?[^>]+(>|$)/g,"");let s;return this.i18next&&this.i18next.translator&&(s=this.i18next.translator),!r||s&&!this.t(r,{_userInput:!0})?void 0:s?o.replace(r,this.t(r,{_userInput:!0})):r}else return JSON.stringify(e)}addOption(e,t,n={},o=D()){if(_.isNil(t))return;const r=this.component.idPath?this.component.idPath.split(".").reduceRight((a,l)=>({[l]:a}),o):{},s=Object.assign({value:this.getOptionValue(e),label:t},r);if(!(this.component.uniqueOptions&&this.selectOptions.find(a=>_.isEqual(a.value,s.value)))&&(e&&this.selectOptions.push(s),this.refs.selectContainer&&this.component.widget==="html5")){s.value&&_.isObject(s.value)&&_.isEmpty(s.value)&&(s.value="");const a=document.createElement("div");a.innerHTML=this.sanitize(this.renderTemplate("selectOption",{selected:_.isEqual(this.getOptionValue(this.dataValue),s.value),option:s,attrs:n,id:o,useId:(this.valueProperty===""||this.isEntireObjectDisplay())&&_.isObject(e)&&o}),this.shouldSanitizeValue).trim(),s.element=a.firstChild,this.refs.selectContainer.appendChild(s.element)}}addValueOptions(e){e=e||[];let t=!1,n=this.dataValue;if(this.options.pdf&&!e.length&&this.component.dataSrc==="url"&&this.valueProperty&&(n=Array.isArray(n)?n.map(o=>_.set({},this.valueProperty,o)):_.set({},this.valueProperty,n)),!this.selectOptions.length){const o=Array.isArray(n)&&this.component.multiple?n:[n];t=this.addCurrentChoices(o,e),!t&&!this.component.multiple&&this.addPlaceholder()}return t}disableInfiniteScroll(){this.downloadedResources&&(this.downloadedResources.serverCount=this.downloadedResources.length,this.serverCount=this.downloadedResources.length)}setItems(e,t){if(logger.info(`[TF_SDK:171] \u2705 setItems() called for '${this.key}'. Items length:`,e?e.length:0,"fromSearch:",t),this.selectItems=e,typeof e=="string")try{e=JSON.parse(e)}catch(l){logger.warn(l.message),e=[]}if(this.component.onSetItems){const l=typeof this.component.onSetItems=="function"?this.component.onSetItems(this,e):this.evaluate(this.component.onSetItems,{items:e},"items");l&&(e=l)}!this.choices&&this.refs.selectContainer&&this.empty(this.refs.selectContainer),this.component.selectValues&&(e=_.get(e,this.component.selectValues,e)||[]);let n;if(this.itemsFromUrl){n=this.isSelectURL?_.isEqual(e,this.downloadedResources):!1;const l=this.component.limit>e.length,i=n&&this.downloadedResources&&this.downloadedResources.length===e.length;l?this.disableInfiniteScroll():i?this.selectOptions=[]:this.serverCount=e.serverCount}if(this.isScrollLoading&&e)n||(this.downloadedResources=this.downloadedResources?this.downloadedResources.concat(e):e),this.downloadedResources.serverCount=e.serverCount||this.downloadedResources.serverCount;else if(this.downloadedResources=e||[],this.selectOptions=[],!_.isEmpty(this.dataValue)&&this.component.idPath){const l=_.get(this.dataValue,this.component.idPath,null),i=!_.isNil(l)&&e.find(c=>_.get(c,this.component.idPath)===l);i&&this.setValue(i)}if(t||this.addValueOptions(e),this.component.widget==="html5"&&!this.component.placeholder&&this.addOption(null,""),_.each(e,(l,i)=>{if(this.root&&this.root.options.editForm&&this.root.options.editForm._id&&this.root.options.editForm._id===l._id)return;const c=this.selectValueAndLabel(l);this.addOption(c.value,c.label,{},_.get(l,this.component.idPath,String(i)))}),logger.info(`[TF_SDK:172] \u2705 selectOptions generated for '${this.key}', length:`,this.selectOptions.length),this.choices)if(logger.info(`[TF_SDK:173] \u2705 this.choices is true for '${this.key}', dataSrc:`,this.component.dataSrc),this.component.dataSrc==="masterdata"&&this.component.masterdata)if(this.selectOptions.sort(function(l,i){const c=typeof l.label=="string"?l.label:typeof l.value=="string"?l.value:"",d=typeof i.label=="string"?i.label:typeof i.value=="string"?i.value:"";return c.localeCompare?c.localeCompare(d):c>d?1:c<d?-1:0}),this.isScrollLoading){let l=[];for(let i=0;i<e.length;i++)for(let c=0;c<this.selectOptions.length;c++)this.selectOptions[c].value===e[i][this.component.valueProperty]&&l.push(this.selectOptions[c]);logger.info(`[TF_SDK:175] \u2705 setChoices called (scrollLoading) for '${this.key}' with array length:`,l.length),this.choices.setChoices(l,"value","label",!1)}else logger.info(`[TF_SDK:176] \u2705 setChoices called (normal masterdata) for '${this.key}' with array length:`,this.selectOptions.length),this.choices.setChoices(this.selectOptions,"value","label",!0);else logger.info(`[TF_SDK:177] \u2705 setChoices called (non-masterdata) for '${this.key}' with array length:`,this.selectOptions.length),this.choices.setChoices(this.selectOptions,"value","label",!0);else this.loading;this.isScrollLoading=!1,this.loading=!1;let o=!1;if(this.choices&&this.choices.input&&this.choices.input.isFocussed&&(o=this.choices.input.isFocussed),!(t&&o))if(this.isEmpty()){if(this.shouldAddDefaultValue&&!this.options.readOnly){const l=this.defaultValue;this.isEmpty(l)||this.setValue(l)}}else if(localStorage.getItem("renderMode")==="html"){var s=this.component.template,h=s.substring(s.lastIndexOf(".")+1,s.length),a=h.substring(0,h.indexOf("}"),h.length);if(a=a.trim(),e.length>0&&this.component.multiple){let l=[];for(let i=0;i<e.length;i++)l.push(e[i][a]);this.setValue(l,{noUpdateEvent:!1})}}else this.setValue(this.dataValue,{noUpdateEvent:!0});this.itemsLoadedResolve()}getSingleItemValueForHTMLMode(e){const t=this.selectOptions&&this.selectOptions.find(({value:n})=>_.isEqual(n,e));return t&&t.label||e}itemValueForHTMLMode(e){return this.isHtmlRenderMode()?Array.isArray(e)?e.map(n=>Array.isArray(n)?this.itemValueForHTMLMode(n):this.getSingleItemValueForHTMLMode(n)).join(", "):this.getSingleItemValueForHTMLMode(e):super.itemValueForHTMLMode(e)}get defaultValue(){let e=super.defaultValue;return!e&&(this.component.defaultValue===!1||this.component.defaultValue===0)&&(e=this.component.defaultValue),e}get loadingError(){return!this.component.refreshOn&&!this.component.refreshOnBlur&&this.networkError}loadItems(e,t,n,o,r,s){if(o=o||{},!this.shouldLoad||!this.itemsFromUrl&&this.options.readOnly){this.isScrollLoading=!1,this.loading=!1,this.itemsLoadedResolve();return}const h=parseInt(this.component.minSearch,10);if(this.component.searchField&&h>0&&(!t||t.length<h))return this.setItems([]);r=r||"GET",r.toUpperCase()==="GET"&&(s=null);const a=this.component.limit||100,l=this.isScrollLoading?this.selectOptions.length:0,i=this.component.disableLimit?{}:{limit:a,skip:l};if(e=this.interpolate(e,{formioBase:Formio.getBaseUrl(),search:t,limit:a,skip:l,page:Math.abs(Math.floor(l/a))}),this.component.searchField&&t){const c=Array.isArray(t)?t.join(","):typeof t=="object"?JSON.stringify(t):t;i[this.component.searchField]=this.component.searchField.endsWith("__regex")?_.escapeRegExp(c):c}this.component.selectFields&&(i.select=this.component.selectFields),this.component.sort&&(i.sort=this.component.sort),_.isEmpty(i)||(e+=(e.includes("?")?"&":"?")+Formio.serialize(i,c=>this.interpolate(c))),this.component.filter&&(e+=(e.includes("?")?"&":"?")+this.interpolate(this.component.filter)),o.ignoreCache=this.component.ignoreCache,o.header=n,this.loading=!0,Formio.makeRequest(this.options.formio,"select",e,r,s,o).then(c=>{this.loading=!1,this.error=null,this.setItems(c,!!t)}).catch(c=>{this.itemsFromUrl&&(this.setItems([]),this.disableInfiniteScroll()),this.isScrollLoading=!1,this.handleLoadingError(c)})}handleLoadingError(e){this.loading=!1,e.networkError&&(this.networkError=!0),this.itemsLoadedResolve(),this.emit("componentError",{component:this.component,message:e.toString()}),logger.warn(`[TF_SDK:178] \u26A0\uFE0F Unable to load resources for ${this.key}`)}get requestHeaders(){const e=new Formio.Headers;if(this.component.data&&this.component.data.headers)try{_.each(this.component.data.headers,t=>{t.key&&e.set(t.key,this.interpolate(t.value))})}catch(t){logger.warn(t.message)}return e}getCustomItems(){const e=this.evaluate(this.component.data.custom,{values:[]},"values");return this.asyncValues=L(e),e}asyncCustomValues(){return _.isBoolean(this.asyncValues)||this.getCustomItems(),this.asyncValues}updateCustomItems(e){if(this.asyncCustomValues()){if(!e&&!this.active){this.itemsLoadedResolve();return}this.loading=!0,this.getCustomItems().then(t=>{this.loading=!1,this.setItems(t||[])}).catch(t=>{this.handleLoadingError(t)})}else this.setItems(this.getCustomItems()||[])}isEmpty(e=this.dataValue){return super.isEmpty(e)||e===void 0}refresh(e,t){if(this.component.clearOnRefresh){const n=t?t.instance:null;n&&!n.pristine&&this.setValue(this.emptyValue)}this.updateItems(null,!0)}get additionalResourcesAvailable(){return _.isNil(this.serverCount)||this.serverCount>this.downloadedResources.length}get serverCount(){return this.isFromSearch?this.searchServerCount:this.defaultServerCount}set serverCount(e){this.isFromSearch?this.searchServerCount=e:this.defaultServerCount=e}get downloadedResources(){return this.isFromSearch?this.searchDownloadedResources:this.defaultDownloadedResources}set downloadedResources(e){this.isFromSearch?this.searchDownloadedResources=e:this.defaultDownloadedResources=e}get filteredMasterdata(){if(!this.component.masterdata)return[];let e=[...this.component.masterdata];if(this.component.filter)try{const t=this.component.filter.replace(/(~=\s*)(\{\{.*?\}\})/g,'$1"$2"'),n=this.interpolate(t,{data:this.data}),o=filtrex.compileExpression(n,{customProp:filtrex.useDotAccessOperatorAndOptionalChaining,extraFunctions:{equalsIgnoreCase:(r,s)=>String(r).toLowerCase()===String(s).toLowerCase(),matchIgnoreCase:(r,s)=>new RegExp(s,"i").test(String(r))}});e=e.filter(r=>o({data:r}))}catch(t){return console.warn("[TF_SDK:153] \u26A0\uFE0F Filter error:",t),[]}return e}updateItems(e,t){if(logger.info(`[TF_SDK:179] \u2705 updateItems() called for '${this.key}'. searchInput:`,e,"forceUpdate:",t,"dataSrc:",this.component.dataSrc),this.itemsLoaded=new Promise(n=>{this.itemsLoadedResolve=n}),!this.component.data){logger.warn(`[TF_SDK:180] \u26A0\uFE0F Select component ${this.key} does not have data configuration.`),this.itemsLoadedResolve();return}if(!this.visible){this.itemsLoadedResolve();return}switch(this.component.dataSrc){case"values":this.setItems(this.component.data.values);break;case"json":this.setItems(this.component.data.json);break;case"custom":this.updateCustomItems();break;case"masterdata":logger.info(`[TF_SDK:181] \u2705 masterdata case for '${this.key}'. masterdata length:`,this.filteredMasterdata?this.filteredMasterdata.length:0);let n=this.filteredMasterdata||[];if(n.length>0&&(n=n.map(o=>o&&typeof o=="object"&&!o.data?Object.assign({data:o},o):o)),!this.isFromSearch&&!this.isScrollLoading&&!this.component.dropdownOpened)if(logger.info(`[TF_SDK:182] \u2705 masterdata: Initial/Unopened State for '${this.key}'`),this.defaultDownloadedResources&&this.defaultDownloadedResources.length>0&&this.defaultDownloadedResources.length<n.length)logger.info(`[TF_SDK:183] \u2705 masterdata: defaultDownloadedResources > 0 for '${this.key}'`),this.setItems(this.defaultDownloadedResources);else if(!this.component.dropdownOpened&&this.data[this.key]&&String(this.data[this.key]).trim().length>0){logger.info(`[TF_SDK:184] \u2705 masterdata: Has pre-existing value for '${this.key}'`,this.data[this.key]);let o=[];this.component.multiple&&n.length>0?this.data[this.key].forEach(s=>n.filter(h=>{const a=_.get(h,this.component.valueProperty);(typeof a!="string"?String(a):a).includes(s)&&o.push(h)})):n.length>0&&(o=n.filter(s=>{const h=_.get(s,this.component.valueProperty),a=typeof h!="string"?String(h):h;return a==null?void 0:a.includes(this.data[this.key])}));const r=o.filter((s,h)=>h===o.findIndex(a=>_.get(s,this.component.valueProperty)===_.get(a,this.component.valueProperty)));this.setItems(r)}else logger.info(`[TF_SDK:185] \u2705 masterdata: No pre-existing value, loading full list for '${this.key}' (length: ${n.length})`),this.setItems(n);else logger.info(`[TF_SDK:186/187] \u2705 masterdata: Search/Scroll/Opened State for '${this.key}', loading list (length: ${n.length})`),this.setItems(n);break;case"resource":{if(!this.component.data.resource||!t&&!this.active){this.itemsLoadedResolve();return}let o=this.options.formio?this.options.formio.formsUrl:`${Formio.getProjectUrl()}/form`;if(o+=`/${this.component.data.resource}/submission`,t||this.additionalResourcesAvailable||!this.serverCount)try{this.loadItems(o,e,this.requestHeaders)}catch(r){logger.warn(`[TF_SDK:188] \u26A0\uFE0F Unable to load resources for ${this.key}`)}else this.setItems(this.downloadedResources);break}case"url":{if(!t&&!this.active&&!this.calculatedValue){this.itemsLoadedResolve();return}let{url:o}=this.component.data,r,s;o.startsWith("/")&&(o=(o.startsWith("/project")?Formio.getBaseUrl():Formio.getProjectUrl()||Formio.getBaseUrl())+o),this.component.data.method?(r=this.component.data.method,r.toUpperCase()==="POST"?s=this.component.data.body:s=null):r="GET";const h=this.component.authenticate?{}:{noToken:!0};this.loadItems(o,e,this.requestHeaders,h,r,s);break}case"indexeddb":{if(typeof window=="undefined")return;if(window.indexedDB||window.alert("Your browser doesn't support current version of indexedDB"),this.component.indexeddb&&this.component.indexeddb.database&&this.component.indexeddb.table){const o=window.indexedDB.open(this.component.indexeddb.database);o.onupgradeneeded=r=>{if(this.component.customOptions){const s=r.target.result,h=s.createObjectStore(this.component.indexeddb.table,{keyPath:"myKey",autoIncrement:!0});h.transaction.oncomplete=()=>{const a=s.transaction(this.component.indexeddb.table,"readwrite");this.component.customOptions.forEach(l=>{a.objectStore(this.component.indexeddb.table).put(l)})}}},o.onerror=()=>{window.alert(o.errorCode)},o.onsuccess=r=>{const a=r.target.result.transaction(this.component.indexeddb.table,"readwrite").objectStore(this.component.indexeddb.table);new Promise(l=>{const i=[];a.getAll().onsuccess=c=>{c.target.result.forEach(d=>{i.push(d)}),l(i)}}).then(l=>{_.isEmpty(this.component.indexeddb.filter)||(l=_.filter(l,this.component.indexeddb.filter)),this.setItems(l)})}}}}}addPlaceholder(){!this.component.placeholder||!this.component.placeholder.trim()||this.addOption("",this.component.placeholder,{placeholder:!0})}activate(){(this.loading||!this.active)&&this.setLoadingItem(),!this.active&&(this.activated=!0,this.triggerUpdate())}setLoadingItem(e=!1){this.choices?e?this.choices.setChoices([{value:`${this.id}-loading`,label:"Loading...",disabled:!0}],"value","label"):this.choices.setChoices([{value:"",label:`<i class="${this.iconClass("refresh")}" style="font-size:1.3em;"></i>`,disabled:!0}],"value","label",!0):(this.component.dataSrc==="url"||this.component.dataSrc==="resource")&&this.addOption("",this.t("loading..."))}get active(){return this.component.dataSrc==="masterdata"&&this.component.masterdata?!this.component.lazyLoad||this.activated:!this.component.lazyLoad||this.activated}render(){const e=this.inputInfo;return e.attr=e.attr||{},e.multiple=this.component.multiple,super.render(this.wrapElement(this.renderTemplate("select",{input:e,selectOptions:"",index:null})))}wrapElement(e){return this.component.addResource&&!this.options.readOnly?this.renderTemplate("resourceAdd",{element:e}):e}choicesOptions(){const e=this.component.hasOwnProperty("searchEnabled")?this.component.searchEnabled:!0,t=this.t(this.component.placeholder,{_userInput:!0});let n=this.component.customOptions||{};if(typeof n=="string")try{n=JSON.parse(n)}catch(a){logger.warn(a.message),n={}}const o={maxPatternLength:1e3,distance:1e3};let r={tokenize:!0,matchAllTokens:!0},s={include:"score",threshold:_.get(this,"component.searchThreshold",.3)},h={removeItemButton:this.component.disabled?!1:_.get(this.component,"removeItemButton",!0),itemSelectText:"",classNames:{containerOuter:"choices form-group formio-choices",containerInner:this.transform("class","form-control ui fluid selection dropdown")},addItemText:!1,allowHTML:!0,placeholder:!!this.component.placeholder,placeholderValue:t,noResultsText:this.t("No results found"),noChoicesText:this.t("No choices to choose from"),searchPlaceholderValue:this.t("Type to search"),shouldSort:!1,position:this.component.dropdown?this.component.dropdown:window.platform&&window.platform.iosPlatform?"bottom":"auto",searchEnabled:e,searchChoices:!this.component.searchField,searchFields:_.get(this,"component.searchFields",["label"]),searchResultLimit:_.get(this,"component.searchResultLimit",this.component.limit||100),fuseOptions:this.component.useExactSearch?Object.assign(r,o):Object.assign({},_.get(this,"component.fuseOptions",{}),Object.assign(s,o)),valueComparer:(a,l)=>{if(_.isEqual(a,l))return!0;if(a==null||l==null)return!1;if((typeof a=="string"||typeof a=="number")&&typeof l=="object"){const i=l.data||l;return i.id===a||i._id===a||i.value===a||this.component.valueProperty&&_.get(i,this.component.valueProperty)===a?!0:Object.values(i).some(c=>c===a||String(c)===String(a))}if((typeof l=="string"||typeof l=="number")&&typeof a=="object"){const i=a.data||a;return i.id===l||i._id===l||i.value===l||this.component.valueProperty&&_.get(i,this.component.valueProperty)===l?!0:Object.values(i).some(c=>c===l||String(c)===String(l))}if(typeof a=="object"&&typeof l=="object"){const i=a.data||a,c=l.data||l;if(_.isEqual(i,c))return!0;if(this.component.idPath){const d=_.get(a,this.component.idPath)||_.get(i,this.component.idPath),g=_.get(l,this.component.idPath)||_.get(c,this.component.idPath);if(d&&g&&d===g)return!0}if(i.id&&c.id&&String(i.id)===String(c.id)||i._id&&c._id&&String(i._id)===String(c._id))return!0}return!1},resetScrollPosition:!1};return Object.assign(h,n)}attach(e){this.component.dropdownOpened=!1;const t=super.attach(e);this.loadRefs(e,{selectContainer:"single",addResource:"single",autocompleteInput:"single"});const n=this.refs.autocompleteInput;n&&this.addEventListener(n,"change",a=>{this.setValue(a.target.value)});const o=this.refs.selectContainer;if(!o)return;if(this.addEventListener(o,this.inputInfo.changeEvent,()=>{if(this.isUpdatingChoices>0){logger.debug(`[TF_SDK] \u2139\uFE0F Ignored programmatic change event on '${this.key}'`);return}this.updateValue(null,{modified:!0})}),this.attachRefreshOnBlur(),this.component.widget==="html5"){this.addFocusBlurEvents(o),this.triggerUpdate(null,!0),this.visible&&this.setItems(this.selectOptions||[]),this.focusableElement=o,this.addEventListener(o,"focus",()=>this.update()),this.addEventListener(o,"keydown",a=>{const{key:l}=a;["Backspace","Delete"].includes(l)&&this.setValue(this.emptyValue)});return}const r=o.tabIndex;this.addPlaceholder(),o.setAttribute("dir",this.i18next.dir()),this.choices&&this.choices.containerOuter&&this.choices.containerOuter.element&&this.choices.containerOuter.element.parentNode&&this.choices.destroy();const s=this.choicesOptions();if(Choices&&(this.choices=new Choices(o,s),["setChoices","setValue","removeActiveItems","clearStore","removeItemsByValue","setChoiceByValue"].forEach(l=>{if(typeof this.choices[l]=="function"){const i=this.choices[l];this.choices[l]=(...c)=>{this.isUpdatingChoices=(this.isUpdatingChoices||0)+1;try{return i.apply(this.choices,c)}finally{this.isUpdatingChoices--}}}}),this.selectOptions&&this.selectOptions.length&&this.choices.setChoices(this.selectOptions,"value","label",!0),this.component.multiple?this.focusableElement=this.choices.input.element:(s.searchEnabled&&window.platform&&window.platform.iosPlatform?this.focusableElement=this.choices.input.element:this.focusableElement=this.choices.containerInner.element,this.choices.containerOuter.element.setAttribute("tabIndex","-1"),s.searchEnabled&&this.addEventListener(this.choices.containerOuter.element,"mousedown",()=>this.positionDropdown())),this.addFocusBlurEvents(this.focusableElement),this.itemsFromUrl&&!this.component.noRefreshOnScroll&&(this.scrollList=this.choices.choiceList.element,this.addEventListener(this.scrollList,"scroll",l=>{this.onScroll(l)})),s.removeItemButton&&this.addEventListener(o,"removeItem",()=>{if(this.isRemoveButtonPressed=!0,this.isUpdatingChoices>0){logger.debug(`[TF_SDK] \u2139\uFE0F Ignored programmatic removeItem event on '${this.key}' (standard list)`);return}this.isEmpty(this.dataValue)||this.updateValue(null,{modified:!0})})),window&&this.choices&&this.shouldPositionDropdown){const a=document.getElementById("formio-wrapper");a&&this.addEventListener(a,"scroll",()=>{this.positionDropdown(!0)},!1,!0),this.addEventListener(window.document,"scroll",()=>{this.positionDropdown(!0)},!1,!0)}if(this.focusableElement.setAttribute("tabIndex",r),this.component.searchField){if(this.choices&&this.choices.input&&this.choices.input.element){var h=(c,d)=>{let g;return function(){const u=this,p=arguments;clearTimeout(g),g=setTimeout(()=>c.apply(u,p),d)}};let i=this;this.addEventListener(this.choices.input.element,"input",h(function(c){if(logger.info(`[TF_SDK:INPUT] \u2328\uFE0F Choices input event triggered for '${i.key}'. Search input:`,c.target.value),i.isFromSearch=!!c.target.value,i.component.dataSrc==="masterdata"&&i.component.masterdata)if(c.target.value.length==0)logger.info(`[TF_SDK:INPUT] Search cleared for '${i.key}'`),i.triggerUpdate(),i.searchDownloadedResources=[],i.component.totalSearchResults=[],i.isFromSearch=!1,i.setItems(i.defaultDownloadedResources);else{let m=[];var d=i.component.template||"",g=d.lastIndexOf("."),u="label";if(g!==-1){var p=d.substring(g+1,d.length),y=p.indexOf("}");y!==-1&&(u=p.substring(0,y).trim())}if(logger.info(`[TF_SDK:INPUT] Parsed label key: '${u}', labelProperty: '${i.component.labelProperty}', limit: ${i.component.limit}, uniqueOptions: ${i.component.uniqueOptions}`),m=i.component.masterdata.filter(S=>{if(!S)return!1;let O;const f=[];i.component.labelProperty&&f.push(i.component.labelProperty),u&&!f.includes(u)&&f.push(u);const R=["Name","label","value","text","title"];for(const w of R)f.includes(w)||f.push(w);for(const w of f)if(S[w]!==void 0&&S[w]!==null){O=S[w];break}return O==null?Object.values(S).some(w=>w&&String(w).toLowerCase().includes(c.target.value.toLowerCase())):String(O).toLowerCase().includes(c.target.value.toLowerCase())}),logger.info(`[TF_SDK:INPUT] Found ${m.length} items matching '${c.target.value}' out of ${i.component.masterdata.length}`),m.length>i.component.limit){logger.info(`[TF_SDK:INPUT] Found items count ${m.length} exceeds limit ${i.component.limit}. Slicing.`),i.component.totalSearchResults=[],i.component.totalSearchResults=m;let S=i.component.totalSearchResults.slice(0,i.component.limit);i.setItems(S)}else logger.info(`[TF_SDK:INPUT] Setting items directly. Count: ${m.length}`),i.setItems(m)}else c.target.value?(i.serverCount=null,i.downloadedResources=[]):i.triggerUpdate()},1e3))}this.addEventListener(o,"choice",()=>{this.component.multiple&&this.component.dataSrc==="resource"&&this.isFromSearch&&this.triggerUpdate(),this.isFromSearch=!1});const a=this.component.searchField&&(this.isSelectResource||this.isSelectURL)?(this.component.searchDebounce===0?0:this.component.searchDebounce||this.defaultSchema.searchDebounce)*1e3:0,l=i=>{this.triggerUpdate(i.detail.value)};this.addEventListener(o,"search",_.debounce(i=>{l(i),this.positionDropdown()},a)),this.addEventListener(o,"stopSearch",()=>this.triggerUpdate()),this.addEventListener(o,"hideDropdown",()=>{if(this.component.dropdownOpened=!1,this.component.totalSearchResults=[],this.component.searchDownloadedResources=[],this.isFromSearch=!1,this.component.dataSrc==="masterdata"&&this.component.masterdata){let i,c={};c.limit=this.component.limit;const d=this.filteredMasterdata;this.data[this.key]&&String(this.data[this.key]).length>0&&(i=d.filter(u=>{const p=u[this.component.valueProperty],y=typeof p!="string"?String(p):p;return y==null?void 0:y.includes(this.data[this.key])})),this.defaultDownloadedResources.findIndex(u=>u[this.component.valueProperty]===String(this.data[this.key]))>-1||i&&i.length>0&&this.defaultDownloadedResources.push(i[0]),c=this.defaultDownloadedResources,c.serverCount=d.length,c.skip=this.defaultDownloadedResources.length+this.component.limit,this.setItems(this.defaultDownloadedResources)}}),this.addEventListener(o,"hideDropdown",()=>{const i=document.getElementById("form-container"),c=i?i.scrollTop:0;this.choices&&this.choices.input&&this.choices.input.element&&(this.choices.input.element.value=""),this.component.dataSrc==="masterdata"&&this.updateItems(null,!0),i&&c>0&&requestAnimationFrame(()=>{i.scrollTop===0&&!window._unv_selecting&&(i.scrollTop=c)})})}return this.addEventListener(o,"mousedown",()=>{window._unv_selecting=!0,window.platform&&window.platform.iosPlatform&&document.activeElement&&(document.activeElement.tagName==="INPUT"||document.activeElement.classList.contains("choices__input"))&&document.activeElement.blur(),setTimeout(()=>{window._unv_selecting=!1},500),this.positionDropdown()}),this.addEventListener(o,"showDropdown",()=>{this.activated||this.update(),this.positionDropdown(),this.component.dataSrc==="masterdata"&&this.component.masterdata&&(this.component.dropdownOpened=!0,(!this.defaultDownloadedResources||this.defaultDownloadedResources.length<this.filteredMasterdata.length)&&this.updateItems(null,!0))}),this.shouldPositionDropdown&&this.addEventListener(o,"highlightChoice",()=>{this.positionDropdown()}),this.addEventListener(o,"hideDropdown",()=>{this.component.dataSrc==="masterdata"&&this.component.masterdata&&(this.component.dropdownOpened=!1)}),this.addEventListener(o,"search",a=>{if(logger.info(`[TF_SDK:SEARCH] \u{1F50D} Choices search event triggered for '${this.key}'. Search input:`,a.detail.value),this.component.dataSrc==="masterdata"&&this.component.masterdata){var l=this.component.template||"",i=l.lastIndexOf("."),c="label";if(i!==-1){var d=l.substring(i+1,l.length),g=d.indexOf("}");g!==-1&&(c=d.substring(0,g).trim())}const u=this.component.searchField?this.component.searchField.replace(/__regex$/,""):"";logger.info(`[TF_SDK:SEARCH] Configured searchField: '${this.component.searchField}', clean: '${u}', parsedLabel: '${c}', limit: ${this.component.limit}, uniqueOptions: ${this.component.uniqueOptions}`),this.searchDownloadedResources=this.filteredMasterdata.filter(p=>{if(!p)return!1;let y;const m=[];this.component.searchField&&m.push(this.component.searchField),u&&!m.includes(u)&&m.push(u),this.component.labelProperty&&!m.includes(this.component.labelProperty)&&m.push(this.component.labelProperty),c&&!m.includes(c)&&m.push(c);const S=["Name","label","value","text","title"];for(const f of S)m.includes(f)||m.push(f);for(const f of m)if(p[f]!==void 0&&p[f]!==null){y=p[f];break}let O=!1;return y==null?O=Object.values(p).some(f=>f&&String(f).toLowerCase().includes(a.detail.value.toLowerCase())):O=String(y).toLowerCase().includes(a.detail.value.toLowerCase()),O}),logger.info(`[TF_SDK:SEARCH] Found ${this.searchDownloadedResources.length} matching resources out of ${this.filteredMasterdata.length}`),this.isFromSearch=!0}}),this.choices&&s.placeholderValue&&this.choices._isSelectOneElement&&(this.addPlaceholderItem(s.placeholderValue),this.addEventListener(o,"removeItem",()=>{if(this.addPlaceholderItem(s.placeholderValue),this.isUpdatingChoices>0){logger.debug(`[TF_SDK] \u2139\uFE0F Ignored programmatic removeItem event on '${this.key}' (placeholder list)`);return}this.isEmpty(this.dataValue)||this.updateValue(null,{modified:!0})})),this.addValueOptions(),this.setChoicesValue(this.dataValue),this.isSelectResource&&this.refs.addResource&&this.addEventListener(this.refs.addResource,"click",a=>{a.preventDefault();const l=this.ce("div"),i=this.createModal(l),d=`${_.get(this.root,"formio.projectUrl",Formio.getProjectUrl())}/form/${this.component.data.resource}`;new Form(l,d,{}).ready.then(g=>{g.on("submit",u=>{let p=this.valueProperty?_.get(u,this.valueProperty):u;this.component.multiple&&(p=[...this.dataValue,p]),this.setValue(p),this.triggerUpdate(),i.close()})})}),this.disabled=this.shouldDisabled,this.updateItems(),this.triggerUpdate(),this.component.lazyLoad||(this.activated=!0),t}setDropdownPosition(){let e,t;if(this.choices&&this.choices.dropdown&&this.choices.dropdown.element&&(e=this.choices.dropdown.element),this.choices&&this.choices.containerOuter&&this.choices.containerOuter.element&&(t=this.choices.containerOuter.element),!e||!t){console.warn("[TF_SELECT_LOG:ERR] \u26A0\uFE0F dropdown or container element not found in setDropdownPosition");return}const n=t.getBoundingClientRect(),o=window.visualViewport?window.visualViewport.height:window.innerHeight,r=o-(n.top+n.height),s=n.top;let h=t.classList.contains("is-flipped");!h&&r<180&&s>r?(h=!0,t.classList.add("is-flipped"),e.classList.add("is-flipped")):h&&r>=200&&(h=!1,t.classList.remove("is-flipped"),e.classList.remove("is-flipped"));const a=e.offsetHeight||220;let l,i;h?(i=Math.min(a,Math.max(120,s-20)),l=Math.max(10,n.top-i)):(l=n.top+n.height,i=Math.max(120,Math.min(a,o-l-15)));const c={left:`${n.left}px`,width:`${n.width}px`,position:"fixed",bottom:"unset",right:"unset",top:`${l}px`,maxHeight:`${i}px`};_.assign(e.style,c)}hasDataGridAncestor(e){return e=e||this,e.inDataGrid||e.type==="datagrid"?!0:e.parent?this.hasDataGridAncestor(e.parent):!1}positionDropdown(e){!this.shouldPositionDropdown||!this.choices||this.choices.dropdown&&!this.choices.dropdown.isActive&&e||(this.setDropdownPosition(),this.itemsLoaded.then(()=>{this.setDropdownPosition()}))}get isLoadingAvailable(){return!this.isScrollLoading&&this.additionalResourcesAvailable}onScroll(e){if(!this.isFromSearch)if(this.component.dataSrc==="masterdata"&&this.component.masterdata&&this.defaultDownloadedResources.length<this.filteredMasterdata.length){var t=e.target;E?t.scrollHeight-t.scrollTop===t.clientHeight&&(this.isScrollLoading=!0,this.triggerUpdate(this.choices.input.element.value),this.setMasterdata()):(this.isScrollLoading=!0,this.triggerUpdate(this.choices.input.element.value),this.setMasterdata())}else this.isLoadingAvailable&&(this.isScrollLoading=!0,this.setLoadingItem(!0),this.triggerUpdate(this.choices.input.element.value))}setMasterdata(){if(this.component.dataSrc==="masterdata"&&this.component.masterdata){let e={},t;e.limit=this.component.limit;let n;const o=this.filteredMasterdata;if(this.data[this.key]&&String(this.data[this.key]).trim().length>0&&(n=o.filter(r=>{const s=_.get(r,this.component.valueProperty),h=typeof s!="string"?String(s):s;return h==null?void 0:h.includes(this.data[this.key])})),this.isFromSearch&&this.searchDownloadedResources&&this.searchDownloadedResources.length>0){const r=this.component.totalSearchResults||this.searchDownloadedResources||[];t=r.slice(this.searchDownloadedResources.length,this.searchDownloadedResources.length+this.component.limit),e=t,e.serverCount=r.length,e.skip=this.searchDownloadedResources.length+this.component.limit}else{t=o.slice(this.defaultDownloadedResources.length,this.defaultDownloadedResources.length+this.component.limit);let r=this.defaultDownloadedResources.filter(a=>t.includes(a));if(r&&r.length>0){let a=t.findIndex(l=>_.get(l,this.component.valueProperty)===_.get(r[0],this.component.valueProperty));a>-1&&t.splice(a,1)}let s=t.findIndex(a=>_.get(a,this.component.valueProperty)===String(this.data[this.key]));s>-1&&t.splice(s,1),this.defaultDownloadedResources.findIndex(a=>_.get(a,this.component.valueProperty)===String(this.data[this.key]))>-1||n&&n.length>0&&t.push(n[0]),e=t,e.serverCount=o.length,e.skip=this.defaultDownloadedResources.length+this.component.limit}this.setItems(e)}}attachRefreshOnBlur(){this.component.refreshOnBlur&&this.on("blur",e=>{this.checkRefreshOn([{instance:e,value:e.dataValue}],{fromBlur:!0})})}addPlaceholderItem(e){this.choices._store.activeItems.length||this.choices._addItem({value:e,label:e,choiceId:0,groupId:-1,customProperties:null,placeholder:!0,keyCode:null})}update(){this.component.dataSrc==="custom"&&this.updateCustomItems(),this.activate()}set disabled(e){super.disabled=e,this.choices&&(e?(this.setDisabled(this.choices.containerInner.element,!0),this.focusableElement.removeAttribute("tabIndex"),this.choices.disable()):(this.setDisabled(this.choices.containerInner.element,!1),this.focusableElement.setAttribute("tabIndex",this.component.tabindex||0),this.choices.enable()))}get disabled(){return super.disabled}set visible(e){e&&!this._visible!=!e&&this.triggerUpdate(),super.visible=e}get visible(){return super.visible}addCurrentChoices(e,t,n){if(!e)return!1;const o=[],r=e.reduce((s,h)=>{if(!h||_.isEmpty(h))return s;let a=!1;const l=t===this.selectOptions;return t&&t.length&&_.each(t,i=>{if(i._id&&h._id&&i._id===h._id)return a=!0,!1;const c=n?i.value:this.itemValue(i,l);return a|=_.isEqual(c,h),!a}),a?a||s:(o.push(this.selectValueAndLabel(h)),!0)},!1);return this.component.dataSrc==="masterdata"&&this.component.masterdata?this.isFromSearch||o.length&&(this.choices&&this.choices.setChoices(o,"value","label"),o.map(s=>{this.addOption(s.value,s.label)})):o.length&&(this.choices&&this.choices.setChoices(o,"value","label"),o.map(s=>{this.addOption(s.value,s.label)})),r}getValueAsString(e,t){return this.component.multiple&&Array.isArray(e)?e.map(n=>this.asString(n,t)).join(", "):this.asString(e,t)}getValue(){if(this.viewOnly||this.loading||!this.component.lazyLoad&&!this.selectOptions.length||!this.element)return this.dataValue;let e=this.emptyValue;if(this.choices)e=this.choices.getValue(!0),!this.component.multiple&&this.component.placeholder&&e===this.t(this.component.placeholder,{_userInput:!0})&&(e=this.emptyValue);else if(this.refs.selectContainer){if(e=this.refs.selectContainer.value,this.valueProperty===""||this.isEntireObjectDisplay()){if(e==="")return{};const t=this.selectOptions[e]||this.selectOptions.find(n=>n.id===e);t&&_.isObject(t.value)&&(e=t.value)}}else e=this.dataValue;return e==null&&(e=""),e}redraw(){const e=super.redraw();return this.triggerUpdate(),e}normalizeSingleValue(e,t){if(_.isNil(e))return;const n=_.isObject(e);if(n&&Object.keys(e).length===0)return e;if(t){const s=this.component.reference&&e&&e._id?e._id.toString():e,h=!n||this.component.reference;if(s&&h&&this.templateData&&this.templateData[s]&&this.root&&this.root.submission){const a=this.root.submission;a.metadata||(a.metadata={}),a.metadata.selectData||(a.metadata.selectData={});let l=this.templateData[s];if(this.component.multiple){l={};const i=this.dataValue;i&&_.isArray(i)&&i.length&&i.forEach(c=>{const d=this.component.reference?c._id.toString():c;l[d]=this.templateData[d]}),l[e]=this.templateData[e]}_.set(a.metadata.selectData,this.path,l)}}const o=this.component.dataType||"auto",r={value:e,number(){const s=Number(this.value),h=e.toString()===s.toString();return!Number.isNaN(s)&&Number.isFinite(s)&&e!==""&&h&&(this.value=s),this},boolean(){return _.isString(this.value)&&(this.value.toLowerCase()==="true"||this.value.toLowerCase()==="false")&&(this.value=this.value.toLowerCase()==="true"),this},string(){return this.value=String(this.value),this},object(){return this},auto(){return _.isObject(this.value)?this.value=this.object().value:this.value=this.string().number().boolean().value,this}};try{return r[o]().value}catch(s){return logger.warn("[TF_SDK:189] \u26A0\uFE0F Failed to normalize value",s),e}}normalizeValue(e){return this.component.multiple&&Array.isArray(e)?e.map(t=>this.normalizeSingleValue(t,!0)):super.normalizeValue(this.normalizeSingleValue(e,!0))}updateValue(e,t){return this.isUpdatingChoices>0?(logger.debug(`[TF_SDK] \u2139\uFE0F Blocked updateValue call on '${this.key}' due to programmatic choices update.`),!1):super.updateValue(e,t)}setValue(e,t={}){if(e&&String(e).length>0&&$(".barcode-select-error").remove(),localStorage.getItem("renderMode")==="html"&&this.component.dataSrc==="values"&&this.component.data.values.filter(i=>{(e&&i.value===e||e&&i.value===String(e))&&(e=i.label)}),localStorage.getItem("renderMode")==="html"&&this.component.dataSrc==="masterdata"&&!this.component.multiple){var n=this.component.template,o=n.substring(n.lastIndexOf(".")+1,n.length),r=o.substring(0,o.indexOf("}"),o.length);r=r.trim(),this.component.masterdata.filter(i=>{(e&&i[this.component.valueProperty]===e||e&&i[this.component.valueProperty]===String(e))&&(e=i[r])})}const s=this.dataValue,h=this.updateValue(e,t);e=this.dataValue;const a=!this.isEmpty(s),l=!this.isEmpty(e);if(this.component.multiple&&Array.isArray(e)?e=e.map(i=>typeof i=="boolean"||typeof i=="number"?i.toString():i):(typeof e=="boolean"||typeof e=="number")&&(e=e.toString()),this.isHtmlRenderMode()&&t&&t.fromSubmission&&h)return this.itemsLoaded.then(()=>{this.redraw()}),h;if(this.loading)return h;if(this.isInitApiCallNeeded(l)){this.loading=!0,this.lazyLoadInit=!0;const i=this.component.searchField||this.component.valueProperty;return this.triggerUpdate(_.get(e.data||e,i,e),!0),h}return this.itemsLoaded.then(()=>{this.addValueOptions(),this.setChoicesValue(e,a,t)}),h}isInitApiCallNeeded(e){return this.component.lazyLoad&&!this.lazyLoadInit&&!this.active&&!this.selectOptions.length&&e&&this.shouldInitialLoad&&this.visible&&(this.component.searchField||this.component.valueProperty)}setChoicesValue(e,t,n={}){const o=!this.isEmpty(e)||n.fromSubmission;if(t=t===void 0?!0:t,this.choices)if(o)if(this.component.dataSrc==="masterdata"&&this.component.masterdata){if(!this.isFromSearch){this.choices.removeActiveItems();const r=Array.isArray(e)?e:[e];this.addCurrentChoices(r,this.selectOptions,!0)||this.choices.setChoices(this.selectOptions,"value","label",!0),this.choices.setChoiceByValue(e)}}else{this.choices.removeActiveItems();const r=Array.isArray(e)?e:[e];this.addCurrentChoices(r,this.selectOptions,!0)||this.choices.setChoices(this.selectOptions,"value","label",!0),this.choices.setChoiceByValue(e)}else(t||n.resetValue)&&this.choices.removeActiveItems();else if(o){const r=Array.isArray(e)?e:[e];if(!_.isEqual(this.dataValue,this.defaultValue)&&this.selectOptions.length<2||this.selectData&&n.fromSubmission){const{value:s,label:h}=this.selectValueAndLabel(this.dataValue);this.addOption(s,h)}_.each(this.selectOptions,s=>{_.each(r,h=>{if(s.value===""&&(s.value={}),_.isEqual(h,s.value)&&s.element)return s.element.selected=!0,s.element.setAttribute("selected","selected"),!1})})}else _.each(this.selectOptions,r=>{r.element&&(r.element.selected=!1,r.element.removeAttribute("selected"))})}get itemsLoaded(){return this._itemsLoaded||Promise.resolve()}set itemsLoaded(e){this._itemsLoaded=e}validateValueAvailability(e,t){if(!F(e)||!t)return!0;const n=this.getOptionsValues();if(n){if(_.isObject(t)){const o=r=>{const s=this.normalizeSingleValue(r,!0);if(!_.isObject(s))return!1;try{return JSON.stringify(s)===JSON.stringify(t)}catch(h){return logger.error("Error while comparing items",h),!1}};return n.findIndex(r=>o(r))!==-1}return n.findIndex(o=>this.normalizeSingleValue(o)===t)!==-1}return!1}getOptionValue(e){return _.isObject(e)&&this.isEntireObjectDisplay()?this.normalizeSingleValue(e):_.isObject(e)&&(this.valueProperty||this.component.key!=="resource")?e:_.isObject(e)&&!this.valueProperty?this.interpolate(this.component.template,{item:e}).replace(/<\/?[^>]+(>|$)/g,""):_.isNull(e)?this.emptyValue:String(this.normalizeSingleValue(e))}getOptionsValues(){let e=[];switch(this.component.dataSrc){case"values":e=this.component.data.values;break;case"json":e=this.component.data.json;break;case"custom":e=this.getCustomItems();break}if(typeof e=="string")try{e=JSON.parse(e)}catch(t){logger.warn(t.message),e=[]}if(Array.isArray(e))return e.map(t=>this.getOptionValue(this.itemValue(t)))}deleteValue(){this.setValue("",{noUpdateEvent:!0}),this.unset()}validateMultiple(){return!1}isBooleanOrNumber(e){return typeof e=="number"||typeof e=="boolean"}getNormalizedValues(){if(!(!this.component||!this.component.data||!this.component.data.values))return this.component.data.values.map(e=>({label:e.label,value:String(this.normalizeSingleValue(e.value))}))}asString(e,t={}){var r;e=e||this.getValue();const n=(s,h)=>h?(Array.isArray(s)?s.forEach(a=>a[h]=a[h].toString()):s[h]=s[h].toString(),s):(this.isBooleanOrNumber(s)&&(s=s.toString()),Array.isArray(s)&&s.some(a=>this.isBooleanOrNumber(a))&&(s=s.map(a=>{this.isBooleanOrNumber(a)&&(a=a.toString())})),s);if(e=n(e),this.component.dataSrc==="masterdata"&&this.component.masterdata){const s=h=>(typeof h=="string"||typeof h=="number")&&this.findMasterdataItem(h)||h;Array.isArray(e)?e=e.map(s):e!=null&&(e=s(e))}if(["values","custom"].includes(this.component.dataSrc)&&!this.asyncCustomValues()){const{items:s,valueProperty:h}=this.component.dataSrc==="values"?{items:n(this.getNormalizedValues(),"value"),valueProperty:"value"}:{items:n(this.getCustomItems(),this.valueProperty),valueProperty:this.valueProperty},a=()=>{const l=_.find(s,[h,e]),i=this.defaultSchema.data.values||[];return _.isEqual(l,i[0])?"-":l};e=this.component.multiple&&Array.isArray(e)?_.filter(s,l=>e.includes(l.value)):h?(r=a())!=null?r:{value:e,label:e}:e}if(_.isString(e)&&this.component.dataSrc!=="masterdata")return e;const o=s=>{const h=this.itemTemplate(s);return t.csv&&h?unescapeHTML(h):h};if(Array.isArray(e)){const s=[];return e.forEach(h=>s.push(o(h))),this.component.dataSrc==="resource"&&s.length>0?s.join(", "):s.length>0?s.join("<br />"):"-"}return this.isEntireObjectDisplay()&&_.isObject(e)?JSON.stringify(e):_.isNil(e)?"-":this.itemTemplate(e)}detach(){this.off("blur"),this.choices&&(this.choices&&this.choices.containerOuter&&this.choices.containerOuter.element&&this.choices.containerOuter.element.parentNode&&this.choices.destroy(),this.choices=null),super.detach()}focus(){this.focusableElement&&(super.focus.call(this),this.focusableElement.focus())}setErrorClasses(e,t,n,o,r=this.element){super.setErrorClasses(e,t,n,o,r),this.choices?super.setErrorClasses([this.choices.containerInner.element],t,n,o,r):super.setErrorClasses([this.refs.selectContainer],t,n,o,r)}addFocusBlurEvents(e){this.addEventListener(e,"focus",()=>{this.root.focusedComponent!==this?(this.root.pendingBlur&&this.root.pendingBlur(),this.root.focusedComponent=this,this.emit("focus",this)):this.root.focusedComponent===this&&this.root.pendingBlur&&(this.root.pendingBlur.cancel(),this.root.pendingBlur=null)}),this.addEventListener(e,"blur",()=>{this.root.pendingBlur=FormioUtils.delay(()=>{this.emit("blur",this),this.component.validateOn==="blur"&&this.root.triggerChange({fromBlur:!0},{instance:this,component:this.component,value:this.dataValue,flags:{fromBlur:!0}}),this.root.focusedComponent=null,this.root.pendingBlur=null})})}}b&&b.Components?b.Components.addComponent("select",I):typeof Formio!="undefined"&&Formio.Components&&Formio.Components.addComponent("select",I)})();</script>
38326
38864
  <script>(function(){var n=window._;const E=Promise,u=window.Formio;var S=u.Components;const F=u.Components.components.base,v=u.Components.components.componentmodal,w=window.EventEmitter3?window.EventEmitter3.EventEmitter||window.EventEmitter3:window.EventEmitter,V=u.Form,g=u.Utils.isMongoId,C=u.Utils.eachComponent,R=u.Utils.getStringFromComponentPath,D=u.Utils.getArrayFromComponentPath,O=()=>({components:[]});class p extends F{static schema(...t){return F.schema({label:"Form",type:"form",key:"form",src:"",reference:!0,form:"",path:"",tableView:!0},...t)}static get builderInfo(){return{title:"Smart Nested Form",group:"premium",icon:"wpforms",documentation:"/userguide/#smartnestedform",weight:110,schema:p.schema()}}static savedValueTypes(){return[u.Utils.componentValueTypes.object]}init(){if(super.init(),window.formdesign=window.formdesign||[],this.component.form){this.component.formdesign&&window.formdesign&&!window.formdesign.some(o=>o.key===this.component.key)&&window.formdesign.push({key:this.component.key,formdesign:this.component.formdesign,data:!0});let t=[];t=window.formdesign.filter(o=>o.key===this.component.key);let e=this;const s=e.component.form;let i=e.component.selNestedFormVersion;if(t.length>0&&!t[0].data||t.length==0)u.makeStaticRequest(`${localStorage.getItem("UMP_url")}/UMP/API/v3/applications/DIGITAL_FORMS/execute/DIGITAL_FORMS_PA_GET_FORM_DATA?queuedExecute=false&messageFormat=custom&inputMessage=%7B%22formId%22%3A%22${s}%22%2C%22type%22%3A%22form%22%2C%22version%22%3A%22${i}%22%7D&sensitive=undefined&externalReference=undefined`,"POST",null,{headers:{Authorization:"Bearer "+localStorage.getItem("token"),Accept:"application/json","Content-type":"application/json"}}).then(function(o){if(o){typeof o!="object"&&(o=JSON.parse(o));let r=e.getMasterdDataresource(o.formData,"dataSrc","masterdata");const h={key:e.component.key,formdesign:r,category:o.category,data:!0};window.formdesign.push(h),e.createSubForm().then(()=>{e.element&&e.attach(e.element)})}}).catch(o=>{logger.error("[TF_SDK:55] \u274C Error getting form data",o)});else if(window.formdesign&&this.component.form){for(let o=0;o<window.formdesign.length;o++)if(window.formdesign[o].key==this.component.key){let r=this.getMasterdDataresource(window.formdesign[o].formdesign,"dataSrc","masterdata");window.formdesign[o].formdesign=r}}}if(this.formObj={display:this.component.display,settings:this.component.settings,components:this.component.components},this.valueChanged=!1,this.subForm=null,this.formSrc="",this.component.src&&(this.formSrc=this.component.src),!this.component.src&&!this.options.formio&&(this.component.form||this.component.path)&&(this.component.project?(this.formSrc=u.getBaseUrl(),g(this.component.project)&&(this.formSrc+="/project"),this.formSrc+=`/${this.component.project}`,this.options.project=this.formSrc):(this.formSrc=u.getProjectUrl(),this.options.project=this.formSrc),this.component.form?g(this.component.form)?this.formSrc+=`/form/${this.component.form}`:this.formSrc+=`/${this.component.form}`:this.component.path&&(this.formSrc+=`/${this.component.path}`)),!this.formSrc&&this.options.formio){const t=this.options.formio.formsUrl;if(this.component.form&&g(this.component.form))this.formSrc=`${t}/${this.component.form}`;else{const e=this.component.path||this.component.form;this.formSrc=`${t.replace(/\/form$/,"")}/${e}`}}return this.builderMode&&this.component.hasOwnProperty("formRevision")&&(this.component.revision=this.component.formRevision,delete this.component.formRevision),(this.component.revision||this.component.revision===0||this.component.formRevision||this.component.formRevision===0||this.component.revisionId)&&this.setFormRevision(this.component.revisionId||this.component.revision||this.component.formRevision),this.createSubForm()}get dataReady(){var t;return((t=this.subForm)==null?void 0:t.dataReady)||this.subFormReady||Promise.resolve()}get defaultValue(){return this.subForm?super.defaultValue:null}get defaultSchema(){return p.schema()}get emptyValue(){return{data:{}}}get hasDefaultValue(){return!0}get ready(){return this.subFormReady||Promise.resolve()}get useOriginalRevision(){var t,e;return((t=this.component)==null?void 0:t.useOriginalRevision)&&!!((e=this.formObj)!=null&&e.revisions)}setFormRevision(t){this.formSrc=this.formSrc.replace(/\/v\/[0-9a-z]+/,"");const e=Number.parseInt(t);isNaN(e)?this.subFormRevision=void 0:(this.subFormRevision=t,this.formSrc+=`/v/${t}`)}getComponent(t){return this.subForm?this.subForm.getComponent(t):null}getSubOptions(t={}){return t.events=this.createEmitter(),n.set(t,"buttonSettings.showSubmit",!1),t.parent=this,this.options&&(this.options.base&&(t.base=this.options.base),this.options.project&&(t.project=this.options.project),(this.options.readOnly||this.component.disabled)&&(t.readOnly=this.options.readOnly||this.component.disabled),this.options.breadcrumbSettings&&(t.breadcrumbSettings=this.options.breadcrumbSettings),this.options.buttonSettings&&(t.buttonSettings=n.clone(this.options.buttonSettings)),this.options.viewAsHtml&&(t.viewAsHtml=this.options.viewAsHtml),this.options.language&&(t.language=this.options.language),this.options.template&&(t.template=this.options.template),this.options.templates&&(t.templates=this.options.templates),this.options.renderMode&&(t.renderMode=this.options.renderMode),this.options.attachMode&&(t.attachMode=this.options.attachMode),this.options.iconset&&(t.iconset=this.options.iconset),this.options.fileService&&(t.fileService=this.options.fileService),this.options.onChange&&(t.onChange=this.options.onChange),this.options.preview&&(t.preview=this.options.preview),this.options.inEditGrid&&(t.inEditGrid=this.options.inEditGrid),this.options.saveDraft&&(t.saveDraft=this.options.saveDraft,t.formio=new u(this.formSrc)),this.options.saveDraftThrottle&&(t.saveDraftThrottle=this.options.saveDraftThrottle),this.options.skipDraftRestore&&(t.skipDraftRestore=this.options.skipDraftRestore),t.parent=this),t}render(){if(this.builderMode)return super.render(this.component.label||"Nested form");const t=this.subForm?this.subForm.render():this.renderTemplate("loading");return super.render(t)}getMasterdDataresource(t,e,s){let i=[];for(let o in t)if(typeof t[o]=="object")i=i.concat(this.getMasterdDataresource(t[o],e,s));else if(o===e&&t[e]===s){let r;t.data&&typeof t.data=="object"&&t.data!==void 0&&t.data.masterdata&&(r=t.data.masterdata);let h=[];const c=localStorage.getItem("resourceData");let a=[];try{a=c?JSON.parse(c):[]}catch(d){a=[]}if(Array.isArray(a)&&r!==void 0&&r!==""){for(let d=0;d<a.length;d++)if((a[d]?a[d].resourceName:null)===r&&a[d].data)try{h.push(JSON.parse(a[d].data).data)}catch(M){}}else h=[];const l=t.template;let m="";if(l!==""){const d=l.substring(l.lastIndexOf(".")+1,l.length);m=d.substring(0,d.indexOf("}"),d.length);const b="<span>{{item."+m.trim()+"}}</span>";t.template=b}const f=t.valueProperty;let y="";f!==""&&(y=f.substring(f.lastIndexOf(".")+1,f.length),t.valueProperty=y),m=m.trim(),h=h.sort(function(d,b){return d[m]>b[m]?1:d[m]<b[m]?-1:0}),t.masterdata=h}return t}asString(t){return this.getValueAsString(t)}getValueAsString(t,e){if(!t)return"No data provided";if(!t.data&&t._id)return t._id;if(this.component.modalEdit)return this.component.label;if(e!=null&&e.email){let s=`
38327
38865
  <table border="1" style="width:100%">
38328
38866
  <tbody>
@@ -38461,24 +38999,48 @@ Expecting `+b.join(", ")+", got '"+(this.terminals_[y]||y)+"'":x="Parse error on
38461
38999
  </div>
38462
39000
  `,p=document.createElement("div");p.innerHTML=d.trim();const a=p.firstChild;s.appendChild(a);const u=setTimeout(()=>{a.parentNode&&(a.classList.remove("show"),a.style.transition="opacity 0.5s ease",a.style.opacity="0",setTimeout(()=>{a.parentNode&&a.remove()},500))},g),m=a.querySelector(".btn-close");m&&(m.onclick=()=>{clearTimeout(u),a.remove()})}window.showDynamicModal=w,window.showToast=x})();</script>
38463
39001
  <script>(function(){let v=!1,l=null;const g=window.innerHeight;function u(){return/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1||!!(window.platform&&window.platform.iosPlatform)}logger.info("[TF_SDK:254] \u2705 Focus script initialized. Initial Height:",g,"isIOS:",u());function h(o){if(o&&o.target&&o.target.closest&&o.target.closest(".flatpickr-calendar"))return;document.querySelector(".flatpickr-calendar.open, .flatpickr-calendar.show")&&(document.activeElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),document.querySelectorAll("input").forEach(n=>{n._flatpickr&&typeof n._flatpickr.close=="function"&&n._flatpickr.close()}),document.body.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0})))}window.addEventListener("scroll",h,!0),window.addEventListener("wheel",h,{capture:!0,passive:!0}),window.addEventListener("touchmove",h,{capture:!0,passive:!0});function w(o){if(!u())return;const e=document.getElementById("sticky-footer");e&&(o?e.style.display="none":e.style.display="flex")}function a(){if(!u()||!l)return;const o=l.closest(".formio-component")||l,e=window.visualViewport?window.visualViewport.height:window.innerHeight,n=o.getBoundingClientRect(),r=o.querySelector(".choices__list--dropdown.is-active, .choices__list--dropdown"),d=!!(r||o.querySelector(".choices")),s=d&&r?Math.max(140,r.offsetHeight||140):0,t=n.bottom+s>e-15,i=n.top<0;if(!t&&!i)return;if(typeof o.scrollIntoView=="function"){const m=d&&t?"center":"nearest";o.scrollIntoView({behavior:"smooth",block:m,inline:"nearest"})}const f=document.getElementById("formio-wrapper");if(f&&f.scrollHeight>f.clientHeight){let m=0,c=o;for(;c&&c!==f&&c!==null;)m+=c.offsetTop,c=c.offsetParent;if(t){const E=m-(e-o.offsetHeight-s-20);f.scrollTo({top:Math.max(0,E),behavior:"smooth"})}else i&&f.scrollTo({top:Math.max(0,m-20),behavior:"smooth"})}}document.addEventListener("focusin",o=>{if(!u())return;const e=o.target;if(!(!e||!["INPUT","TEXTAREA","SELECT"].includes(e.tagName))){if(w(!0),l=e,e.classList.contains("choices__input")||e.closest(".choices")){const n=e.closest(".choices")||e.closest(".formio-component-barcodeselect")||e.closest(".formio-component-select");n&&(l=n)}setTimeout(a,100),setTimeout(a,350)}}),document.addEventListener("focusout",o=>{u()&&setTimeout(()=>{const e=document.activeElement;!(e&&["INPUT","TEXTAREA","SELECT"].includes(e.tagName))&&!v&&w(!1)},250)}),window.visualViewport&&window.visualViewport.addEventListener("resize",()=>{if(!u())return;const e=window.visualViewport.height;e<g-60||e<screen.height-150?(v=!0,w(!0),l&&(setTimeout(a,150),setTimeout(a,350))):(v=!1,w(!1))}),document.addEventListener("showDropdown",o=>{if(!u())return;const e=o.target,n=e&&e.closest?e.closest(".formio-component-barcodeselect, .formio-component-select, .formio-component")||e:l;n&&(l=n,setTimeout(a,50),setTimeout(a,200),setTimeout(a,400))},!0),document.addEventListener("hideDropdown",()=>{u()&&setTimeout(a,80)},!0),document.addEventListener("FormRenderingComplete",()=>{const o=window.formObj;if(!o)return;let e=0;const n=setInterval(()=>{if(e++,e>8){clearInterval(n);return}let r=null;function d(s){if(!s)return null;for(let p=0;p<s.length;p++){const t=s[p];if(t){if(t.component&&t.component.autofocus){if(t.refs&&t.refs.input&&t.refs.input[0])return t.refs.input[0];if(t.element){const i=t.element.querySelector('input:not([type="hidden"]), textarea, select');if(i)return i}}if(t.components&&Array.isArray(t.components)){const i=d(t.components);if(i)return i}if(t.subForm&&t.subForm.components&&Array.isArray(t.subForm.components)){const i=d(t.subForm.components);if(i)return i}if(t.rows&&Array.isArray(t.rows))for(let i=0;i<t.rows.length;i++){const f=t.rows[i],m=Object.values(f||{}),c=d(m);if(c)return c}}}return null}if(r=d(o.components),r)if(document.activeElement!==r){if(logger.info(`[TF_SDK:262] \u2705 Forcing focus on schema-defined autofocus element (Attempt ${e})`),r.focus(),r.setSelectionRange&&r.value){const s=r.value.length;try{r.blur(),r.focus(),r.setSelectionRange(s,s)}catch(p){}}}else clearInterval(n)},500)})})();</script>
38464
- <script>(function(){var d=null,k=null,ne;let v=[],T=0,_=!1;function L(){sendEventCallback({type:FORM_EVENTS.BACK_NAVIGATION,message:"Back navigation triggered.",data:{}})}function W(e,t){var c,f;const o=document.getElementById("saveBtn"),n=document.getElementById("submitBtn"),r=document.getElementById("prevBtn"),i=document.getElementById("nextBtn"),l=document.getElementById("completeOption"),m=document.getElementById("saveOption"),p=document.getElementById("completeDivider"),y=document.getElementById("saveDivider");if(!o||!n)return;const s=e===!0||e==="true",g=e===!1||e==="false",u=String(t||"").toLowerCase(),a=(h,w,E)=>{h&&(E?h.style.setProperty("display","flex","important"):h.style.setProperty("display","none","important")),w&&(E?w.style.setProperty("display","block","important"):w.style.setProperty("display","none","important"))};a(l,p,!1),a(m,y,!1),u==="read"?(o.style.display="none",n.style.display="none"):g&&u==="writemultiple"?(o.style.display="none",n.style.display="",n.innerHTML='<i class="bi bi-check2-circle"></i> Complete',n.disabled=!0,a(l,p,!1),a(m,y,!1)):g&&u==="writesingle"?(o.style.display="none",n.style.display="",n.innerHTML='<i class="bi bi-check2-circle"></i> Submit',n.disabled=!0):s&&u==="writemultiple"?((c=window.__unviredFormsOptions)==null?void 0:c.showCompleteAlways)===!0||((f=window.__unviredFormsOptions)==null?void 0:f.showCompleteAlways)==="true"?(o.style.display="",n.style.display="",n.innerHTML='<i class="bi bi-check2-circle"></i> Complete',o.disabled=!0,n.disabled=!0,a(l,p,!1),a(m,y,!1)):(o.style.display="",n.style.display="none",o.disabled=!0,a(l,p,!1)):s&&u==="writesingle"?(o.style.display="none",n.style.display="",n.innerHTML='<i class="bi bi-check2-circle"></i> Complete',n.disabled=!0,a(m,y,!0)):(o.style.display="none",n.style.display="",n.innerHTML='<i class="bi bi-check2-circle"></i> Submit',n.disabled=!0),typeof window.checkMoreButtonVisibility=="function"&&window.checkMoreButtonVisibility()}function U(e,t,o,n){var C,F,O,A;const r=document.getElementById("saveBtn"),i=document.getElementById("submitBtn"),l=document.getElementById("prevBtn"),m=document.getElementById("nextBtn");if(!r||!i)return;const p=o===!0||o==="true",y=o===!1||o==="false",s=String(n||"").toLowerCase(),g=document.getElementById("completeOption"),u=document.getElementById("saveOption"),a=document.getElementById("completeDivider"),c=document.getElementById("saveDivider"),f=(b,S,M)=>{b&&(M?b.style.setProperty("display","flex","important"):b.style.setProperty("display","none","important")),S&&(M?S.style.setProperty("display","block","important"):S.style.setProperty("display","none","important"))},h=Object.values(t||{}).some(b=>b!=null&&b!==""&&b!==!1&&!(Array.isArray(b)&&b.length===0)&&!(typeof b=="object"&&!Array.isArray(b)&&Object.keys(b).length===0)),w=e>=100,E=((C=window.__unviredFormsOptions)==null?void 0:C.requireCompleteForm)!==!1&&((F=window.__unviredFormsOptions)==null?void 0:F.requireCompleteForm)!=="false";if(s==="read"){r.style.display="none",i.style.display="none";return}if(p&&s==="writesingle"){r.style.display="none",i.style.display="",i.disabled=!1,f(u,c,!0),f(g,a,!1),typeof window.checkMoreButtonVisibility=="function"&&window.checkMoreButtonVisibility();return}if(p&&s==="writemultiple"){((O=window.__unviredFormsOptions)==null?void 0:O.showCompleteAlways)===!0||((A=window.__unviredFormsOptions)==null?void 0:A.showCompleteAlways)==="true"?(r.style.display="",i.style.display="",i.innerHTML='<i class="bi bi-check2-circle"></i> Complete',r.disabled=!h,i.disabled=!1,f(g,a,!1),f(u,c,!1)):w?(r.style.display="none",i.style.display="",i.innerHTML='<i class="bi bi-check2-circle"></i> Complete',i.disabled=!1,f(u,c,!0),f(g,a,!1)):h?(r.style.display="",i.style.display="none",r.disabled=!1,f(g,a,!0),f(u,c,!1)):(r.style.display="",i.style.display="none",r.disabled=!0,f(g,a,!1),f(u,c,!1)),typeof window.checkMoreButtonVisibility=="function"&&window.checkMoreButtonVisibility();return}if(y&&s==="writemultiple"){r.style.display="none",i.style.display="",i.innerHTML='<i class="bi bi-check2-circle"></i> Complete',i.disabled=!1,f(g,a,!1),f(u,c,!1),typeof window.checkMoreButtonVisibility=="function"&&window.checkMoreButtonVisibility();return}if(y&&s==="writesingle"){r.style.display="none",i.style.display="",i.disabled=!1,f(g,a,!1),f(u,c,!1),typeof window.checkMoreButtonVisibility=="function"&&window.checkMoreButtonVisibility();return}r.style.display="none",i.style.display="",i.disabled=!1,typeof window.checkMoreButtonVisibility=="function"&&window.checkMoreButtonVisibility()}async function z(e,t,o,n,r,i,l,m,p,y){if(window.CURRENT_VIEW!=="comments"){if(H(),logger.info("[TF_SDK:296] \u2705 loadTRform() entered",{mode:n,permission:p,privateExternal:m,language:r}),v=y,typeof Formio=="undefined"){logger.error("[TF_SDK:297] \u274C Formio library not loaded"),sendEventCallback({type:"ERROR",errorMessage:"ErrorCode : 016, Formio library not loaded",data:{reason:"Formio library not loaded"}});return}try{if(logger.info("[TF_SDK:297] \u2705 Initializing loadTRform"),typeof Formio!="undefined"&&Formio.Components&&Formio.Components.components&&Formio.Components.components.component){const c=Formio.Components.components.component;if(!c._requiredFixApplied){c._requiredFixApplied=!0;const f=c.prototype.setCustomValidity;c.prototype.setCustomValidity=function(w,E,C){var F,O,A,b;if(typeof w=="string"&&(w.trim().toLowerCase()==="required"||w.includes("{{field}}"))){const S=(O=(F=this.component)==null?void 0:F.validate)==null?void 0:O.customMessage,M=((A=this.component)==null?void 0:A.errorLabel)||((b=this.component)==null?void 0:b.label)||this.key||"Field";w=S||`${M} is required`}if(f)return f.call(this,w,E,C)};const h=c.prototype.t;c.prototype.t=function(w,E){var C,F,O,A;if(typeof w=="string"&&w.trim().toLowerCase()==="required"){const b=(F=(C=this.component)==null?void 0:C.validate)==null?void 0:F.customMessage;return b||`${(E==null?void 0:E.field)||((O=this.component)==null?void 0:O.errorLabel)||((A=this.component)==null?void 0:A.label)||this.key||"Field"} is required`}return h?h.apply(this,arguments):w}}}let s={noAlerts:!0,scroll:!1,language:window.FORMIO_LANGUAGE||"en",i18n:window.FORMIO_I18N};if(W(m,p),n=="form")s.readOnly=!1,s.flatten=!1,s.viewHtml=!1;else if(n=="pdf"||n=="print"){s.readOnly=!0,s.flatten=!0,s.renderMode="flat",s.viewHtml=!0;const c=document.querySelector(".progress-container");c&&(c.style.display="none")}else if(n=="readOnly"||p=="read"){s.readOnly=!0,s.flatten=!1,s.viewHtml=!1;const c=document.querySelector(".progress-container");c&&(c.style.display="none");const f=document.getElementById("sticky-footer");f&&window.CURRENT_VIEW!=="comments"&&(f.style.display="none")}else s.readOnly=!1,s.flatten=!1,s.viewHtml=!1;const g=document.getElementById("formio");if(!g)throw new Error("DOM Element #formio not found");logger.info("[TF_SDK:298] \u2705 Creating Formio form...",e);try{d=await Formio.createForm(g,e,s)}catch(c){throw logger.error("[TF_SDK:298-ERR] \u274C Error in Formio.createForm:",c),c}let u=!1;if(d.on("change",()=>{if(!u){if(!k)try{k=JSON.parse(JSON.stringify(d.getValue().data))}catch(c){k=d.getValue().data}u=!0}}),document.dispatchEvent(new CustomEvent("LessRenderingComplete")),window.formObj=d,window.FORMIO_I18N&&Object.keys(window.FORMIO_I18N).length>0){const c=document.getElementById("languageSubMenu"),f=document.getElementById("languageMainOption"),h=document.getElementById("languageDivider");if(c&&f){c.innerHTML="";let w=Object.keys(window.FORMIO_I18N).filter(F=>typeof window.FORMIO_I18N[F]=="object"&&window.FORMIO_I18N[F]!==null);const E=window.FORMIO_LANGUAGE||"en";!w.includes(E)&&typeof window.FORMIO_I18N[E]=="object"&&w.unshift(E);let C=null;try{window.Intl&&typeof Intl.DisplayNames=="function"&&(C=new Intl.DisplayNames(["en"],{type:"language"}))}catch(F){logger.warn("Intl.DisplayNames not supported",F)}w.forEach(F=>{const O=document.createElement("div");O.className=f.className,O.style.cursor="pointer",O.style.padding="0.5rem 1rem",O.style.borderTop="none";let A=F.toUpperCase();try{A=C.of(F)||A}catch(S){}let b=F===E?'<i class="bi bi-check2 text-primary" style="margin-right: 8px;"></i>':'<i class="bi bi-check2" style="margin-right: 8px; visibility: hidden;"></i>';f.innerHTML.includes("icon chevron")&&(b=F===E?'<i class="icon check" style="margin-right: 8px;"></i>':'<i class="icon check" style="margin-right: 8px; visibility: hidden;"></i>'),O.innerHTML=`${b}${A}`,O.onclick=function(S){S.stopPropagation(),window.changeFormLanguage&&(window.changeFormLanguage(F),window.FORMIO_LANGUAGE=F);const M=c.children;for(let N=0;N<M.length;N++){const D=M[N].querySelector("i");D&&(w[N]===F?(D.style.visibility="visible",D.className.includes("bi")&&D.classList.add("text-primary")):(D.style.visibility="hidden",D.className.includes("bi")&&D.classList.remove("text-primary")))}window.toggleLanguageSubMenu&&window.toggleLanguageSubMenu(),window.showToast&&window.showToast(`Language set to ${A}`,"success")},c.appendChild(O)}),w.length>1?(f.style.display=f.className.includes("d-flex")?"flex":"block",h&&(h.style.display="block")):(f.style.display="none",h&&(h.style.display="none"))}}else{const c=document.getElementById("languageMainOption"),f=document.getElementById("languageDivider");c&&(c.style.display="none"),f&&(f.style.display="none")}if(!d){logger.error("[TF_SDK:299] \u274C Form not initialized.");return}const a=()=>{['button[type="submit"]',".formio-component-submit"].forEach(h=>{d.element.querySelectorAll(h).forEach(E=>{E.style.display="none"})}),d.element.querySelectorAll('input:not([type="file"]), textarea').forEach(h=>{h.getAttribute("autocomplete")!=="new-password"&&(h.setAttribute("autocomplete","new-password"),h.setAttribute("data-lpignore","true"),h.setAttribute("spellcheck","false"))})};a(),d.on("render",a),Q(m,p),d.formReady.then(()=>{if(logger.info("[TF_SDK:300] \u2705 formReady.then() triggered"),typeof window.initializeWizardLogic=="function"&&window.initializeWizardLogic(d,m,p),t?(logger.info("[TF_SDK:301] \u2705 Previous form data found:",t),d.submission={data:typeof t=="string"?JSON.parse(t):t},logger.info("[TF_SDK:302] \u2705 Previous submission data applied")):logger.info("[TF_SDK:303] \u2705 No previous form data found"),logger.info("[TF_SDK:304] \u2705 Calculating initial progress..."),executeProgressCalculation(m,p),logger.info("[TF_SDK:305] \u2705 Progress calculation completed"),n=="readOnly"){logger.info("[TF_SDK:306] \u2705 ReadOnly mode detected");const w=document.querySelectorAll(".formio-component-submit");logger.info(`[TF_SDK:307] \u2705 Found ${w.length} submit components`),w.forEach((E,C)=>{E.style.display="none",logger.info(`[TF_SDK:308] \u2705 Hidden submit component ${C+1}`)})}else logger.info("[TF_SDK:309] \u2705 Editable mode detected");logger.info("[TF_SDK:310] \u2705 Sending FORM_RENDER callback..."),sendEventCallback({type:FORM_EVENTS.FORM_RENDER,message:"Success: Form rendered successfully.",data:{submissionData:t,formTemplate:e}}),logger.info("[TF_SDK:311] \u2705 FORM_RENDER callback sent");const c=document.getElementById("sdk-form-loader");c?(logger.info("[TF_SDK:312] \u2705 Loader found, hiding..."),c.classList.add("hidden"),logger.info("[TF_SDK:313] \u2705 Loader hidden")):logger.warn("[TF_SDK:314] \u2705 Loader element not found"),document.querySelectorAll(".tf-form-loading").forEach(w=>w.classList.remove("tf-form-loading")),logger.info("[TF_SDK:315] \u2705 Dispatching FormRenderingComplete event...");let f=0;typeof window.getMaxTableWidth=="function"&&(f=window.getMaxTableWidth(document.getElementById("formio")||document.querySelector(".tf-embed-sdk")||document.body).maxWidth),sendEventCallback({type:FORM_EVENTS.FORM_LOADED,message:"Success: Form rendered complete.",data:{maxTableWidth:`${f}px`}}),document.dispatchEvent(new CustomEvent("FormRenderingComplete",{detail:{timestamp:new Date().toISOString(),status:"success",maxTableWidth:f}})),logger.info("[TF_SDK:316] \u2705 FormRenderingComplete event dispatched successfully");const h=document.querySelector('input[type="file"]');h?(h.setAttribute("accept","*/*"),logger.info("[TF_SDK:317] \u2705 File input found, accept=*/* applied")):logger.info("[TF_SDK:318] \u2705 No file input found"),logger.info("[TF_SDK:319] \u2705 Full formReady process completed")}).catch(c=>{logger.error("[TF_SDK:320] \u274C formReady.then() failed:",c)})}catch(s){logger.error("[TF_SDK:321] \u274C Error creating form (after retries):",s?s.message:"Unknown error",s?s.stack:"");const g=document.getElementById("sdk-form-loader");g&&g.classList.add("hidden"),document.querySelectorAll(".tf-form-loading").forEach(u=>u.classList.remove("tf-form-loading")),sendEventCallback({type:"ERROR",errorMessage:"ErrorCode : 005, Formio not rendered the forms",data:{reason:"Failed to render form after retries",technicalError:s}})}}}let B=null,V=null,I=null;function G(){if(I)return I;if(!d)return[];const e=[];function t(o,n=""){Array.isArray(o)&&o.forEach(r=>{var y;if(!r)return;const i=r.component||r;let l=n;if(["columns","panel","fieldset","well","table","tabs","content","htmlelement"].includes(i.type)||(l=n?`${n}.${i.key}`:i.key),["textfield","textarea","number","checkbox","radio","select","selectboxes","email","url","day","datetime","file","datamap","tree","survey","signature","datagrid","editgrid","container"].includes(i.type)&&((y=i.validate)!=null&&y.required)&&e.push({key:i.key,type:i.type,path:l,comp:i,instance:r}),Array.isArray(r.components)&&t(r.components,l),i.type==="form"){let s=l?`${l}.data`:"data";r.subForm&&Array.isArray(r.subForm.components)?t(r.subForm.components,s):Array.isArray(r.components)&&t(r.components,s)}Array.isArray(r.columns)&&r.columns.forEach(s=>{Array.isArray(s.components)&&t(s.components,l)})})}return t(d.components),I=e,e}window.executeProgressCalculation=function(e,t){if(!d)return;const o=d.data||{},n=JSON.stringify(o);if(!(d&&!!d.wizard)&&n===V)return;V=n;const i=G();let l=i.length,m=0;function p(u,a){if(Array.isArray(a)){if(!(["file","datagrid","editgrid","datamap","selectboxes"].includes(u.type)||u.multiple))return a.length>0&&a.every(h=>p(u,h));if(u.type==="file"&&a.length>0&&Array.isArray(a[0]))return a.every(h=>p(u,h))}switch(u.type){case"selectboxes":return Object.values(a||{}).some(Boolean);case"datamap":case"tree":return a&&Object.keys(a).length>0;case"survey":return u.questions&&Array.isArray(u.questions)?a&&Object.keys(a).length>=u.questions.length:a&&Object.keys(a).length>0;case"file":return Array.isArray(a)&&a.length>0;case"checkbox":return a===!0;case"editgrid":case"datagrid":return Array.isArray(a)&&a.length>0;case"signature":return!!a;default:return u.multiple?Array.isArray(a)&&a.length>0&&a.some(c=>c!=null&&c!==""):a!=null&&a!==""}}const y=[];i.forEach(u=>{let a=!0;u.instance&&(u.instance.visible===!1&&(a=!1),a&&typeof u.instance.checkCondition=="function"&&(u.instance.checkCondition(null,o)||(a=!1))),a&&(u.instance&&u.instance.parent&&u.instance.parent.visible===!1||y.push(u))}),l=y.length,m=0,y.forEach(({key:u,type:a,path:c,comp:f})=>{let h=x(o,c);p(f,h)&&m++});const s=l===0?100:Math.round(m/l*100);logger.info("[TF_SDK:322] \u2705 Progress:",{mandatory:l,filledMandatory:m,completion:s+"%"}),T=s,_=s>=100,U(s,d.data,e,t),typeof window.updateWizardNav=="function"&&window.updateWizardNav(d);const g=document.getElementById("progress-bar");if(g){const u=g.querySelector(".progress"),a=g.querySelector(".badge");u.style.width=`${s}%`,a.textContent=`${s}%`;let c=s;s<=0?(c=.5,u.style.width=`${.5}%`,window.innerWidth>768||window.innerWidth>480?a.style.transform="translateX(2%)":a.style.transform="translateX(1%)"):s>=100?(g.classList.add("complete"),c=99.5,window.innerWidth>768||window.innerWidth>480,a.style.transform="translateX(-100%)"):(g.classList.remove("complete"),a.style.transform="translateX(-50%)"),a.style.left=`${c-.25}%`}};function x(e,t){if(e==null||!t)return;if(t.indexOf(".")===-1)return Array.isArray(e)?e.map(r=>r[t]):e[t];const o=t.split(".");let n=e;for(let r=0;r<o.length;r++){const i=o[r];if(n==null)return;if(Array.isArray(n)){const l=o.slice(r).join(".");return n.map(m=>x(m,l))}n=n[i]}return n}function q(e){if(!e)return!0;let t=e.getValue?e.getValue():e.dataValue;return t==null||t===""||Array.isArray(t)&&(t.length===0||!t.some(n=>!(n==null||n===""||typeof n=="object"&&Object.keys(n).length===0)))||typeof t=="object"&&!Array.isArray(t)&&(Object.keys(t).length===0||!Object.values(t).some(n=>n!=null&&n!==""&&n!==!1))?!0:e.isEmpty?e.isEmpty(t):!1}function J(e,t){var r,i,l,m,p,y;if(!e||!t)return null;if(t.component&&t.component.element)return t.component;const o=t.path||((r=t.context)==null?void 0:r.path)||((i=t.context)==null?void 0:i.hasPath);if(o){let s=typeof e.getComponent=="function"?e.getComponent(o):null;if(s&&s.element)return s;const g=String(o).replace(/\[(\d+)\]/g,".$1");if(s=typeof e.getComponent=="function"?e.getComponent(g):null,s&&s.element)return s;const u=String(o).replace(/\.(\d+)\./g,"[$1].");if(s=typeof e.getComponent=="function"?e.getComponent(u):null,s&&s.element)return s}const n=((m=(l=t.context)==null?void 0:l.component)==null?void 0:m.key)||((p=t.component)==null?void 0:p.key)||(typeof((y=t.context)==null?void 0:y.component)=="string"?t.context.component:null);if(n&&typeof e.getComponent=="function"){const s=e.getComponent(n);if(s&&s.element)return s}return null}function P(e){if(!e||!e.element)return;e.error=null,typeof e.setCustomValidity=="function"&&e.setCustomValidity(""),e.element.classList.remove("has-error","formio-error-wrapper","is-invalid"),e.element.querySelectorAll(".choices__inner, .ui.selection.dropdown, .is-invalid").forEach(n=>{n.closest(".formio-component")===e.element&&n.classList.remove("is-invalid")}),e.element.querySelectorAll(".formio-errors, .invalid-feedback, [ref='messageContainer']").forEach(n=>{n.closest(".formio-component")===e.element&&(n.innerHTML="",n.style.display="none")})}function X(e){!e||typeof e.everyComponent!="function"||e.everyComponent(t=>{var l;if(!t||!t.element)return;const o=((l=t.component)==null?void 0:l.type)||t.type;if(["datagrid","editgrid","container","panel","columns","fieldset","well","tabs","form"].includes(o))return;const r=t.element.classList.contains("has-error")||t.element.classList.contains("formio-error-wrapper"),i=Array.from(t.element.querySelectorAll(".formio-errors, .invalid-feedback")).some(m=>m.style.display!=="none"&&m.innerHTML.trim()!==""&&m.closest(".formio-component")===t.element);(r||i)&&!q(t)&&P(t)})}function Y(e,t){var m,p,y,s;if(!e||!e.element)return;e.element.classList.add("has-error","formio-error-wrapper");const o=e.element.querySelector(".choices__inner, .ui.selection.dropdown");o&&o.closest(".formio-component")===e.element&&o.classList.add("is-invalid");const n=t.message||((p=(m=t.context)==null?void 0:m.component)!=null&&p.label?`${t.context.component.label} is required`:`${((y=e.component)==null?void 0:y.label)||e.key} is required`),i=`e-${e.id||((s=e.component)==null?void 0:s.id)||e.key}-${e.key}`;let l=Array.from(e.element.querySelectorAll(".formio-errors, [ref='messageContainer']")).find(g=>g.closest(".formio-component")===e.element);l?(l.setAttribute("ref","messageContainer"),l.classList.contains("invalid-feedback")||l.classList.add("invalid-feedback")):(l=document.createElement("div"),l.setAttribute("ref","messageContainer"),l.className="formio-errors invalid-feedback",e.element.appendChild(l)),l.innerHTML=`<div id="${i}" class="form-text error">${n}</div>`,l.style.display="block"}function Q(e,t){d&&d.on("change",o=>{var n,r;((r=(n=o.changed)==null?void 0:n.component)==null?void 0:r.type)==="datetime"&&document.activeElement.blur(),X(d),B&&clearTimeout(B),I=null,B=setTimeout(()=>{executeProgressCalculation(e,t)},300)})}function K(e,t=[]){let o={};if(!t||t.length===0||!e)return o;let n=e;if(typeof e=="string")try{n=JSON.parse(e)}catch(i){}const r=i=>{if(!(!i||typeof i!="object"))if(Array.isArray(i))i.forEach(r);else for(const l in i)t.includes(l)?o[l]?Array.isArray(o[l])&&Array.isArray(i[l])&&(o[l]=o[l].concat(i[l])):o[l]=i[l]:typeof i[l]=="object"&&r(i[l])};return r(n),o}function R(e,t=[]){if(!e||typeof e!="object")return e;const o=Array.isArray(e)?[...e]:{...e};for(const n in o){const r=o[n];Array.isArray(r)?t.length>0&&t.includes(n)?o[n]=r.map(i=>i&&typeof i=="object"&&(i.uid||i.id)?i.uid||i.id:i):r.length>0&&r.every(i=>i&&typeof i=="object"&&i.storage==="SmartStorage")?o[n]=r.map(i=>i.id||i.uid||i):o[n]=r.map(i=>typeof i=="object"&&i!==null?R(i,t):i):r&&typeof r=="object"&&(o[n]=R(r,t))}return o}function j(){var r,i;if(!d)return;const e=d.getValue(),t=R(e,v),o=K(e.data,v);if(!(((r=window.__unviredFormsOptions)==null?void 0:r.requireCompleteForm)!==!1&&((i=window.__unviredFormsOptions)==null?void 0:i.requireCompleteForm)!=="false")){sendEventCallback({type:FORM_EVENTS.SUBMIT,message:"Success: Form submitted successfully (Validation Bypassed).",data:{formData:t,completeFlag:_,completionPercentage:T,commentsData:FORM_COMMENTS_DATA,result:t,attachmentsData:o}});return}d.errors=[],d.submit().then(l=>{sendEventCallback({type:FORM_EVENTS.SUBMIT,message:"Success: Form submitted successfully.",data:{formData:t,completeFlag:_,completionPercentage:T,commentsData:FORM_COMMENTS_DATA,result:l,attachmentsData:o}})}).catch(l=>{let m=!1,p=[],y=[];if(d&&Array.isArray(d.errors)&&d.errors.length>0&&(y=y.concat(d.errors)),Array.isArray(l)?y=y.concat(l):l&&Array.isArray(l.errors)?y=y.concat(l.errors):l&&Array.isArray(l.details)?y=y.concat(l.details):l&&typeof l=="object"&&(l.message||l.context)&&y.push(l),y.length>0?y.forEach(g=>{const u=J(d,g);u&&u.element?q(u)?(m=!0,p.push(g),Y(u,g)):P(u):(m=!0,p.push(g))}):m=!0,!m){logger.warn("[TF_SDK:321a] \u26A0\uFE0F All reported errors were resolved/hallucinated. Forcing success submit."),sendEventCallback({type:FORM_EVENTS.SUBMIT,message:"Success: Form submitted successfully.",data:{formData:t,completeFlag:_,completionPercentage:T,commentsData:FORM_COMMENTS_DATA,result:t,attachmentsData:o}});return}logger.error("Form submit errors:",p);let s="Please fill in all required fields.";p.length===1&&p[0].message&&(s=p[0].message),showDynamicModal("Error",[{label:"OK"}],s),sendEventCallback({type:FORM_EVENTS.SUBMIT_ERROR,errorMessage:"ErrorCode : 006, Formio not submit the form",data:{reason:"Form submission failed",formData:t,completeFlag:_,completionPercentage:T,technicalError:p.length>0?p:l}})})}function H(){B=null,V=null,I=null}async function Z(){if(!d){logger.error("[TF_SDK:323] \u274C Form object not initialized");return}let e=d.getValue();window.FORM_SUB_TEMP=e;const t=window.FORM_TEMPLATE||{display:"form",type:"form",components:[]};try{typeof window.loadCommentsform=="function"?(await window.loadCommentsform(t,window.FORM_USER_DATA,window.FORM_COMMENTS_DATA,window.FORM_VOB_ARR,window.FORM_USERS_LIST||[]),showCommentsView()):logger.error("[TF_SDK:324] \u274C loadCommentsform is not a function")}catch(o){logger.error("[TF_SDK:325] \u274C Error while loading comments:",o)}}function $(){if(!d)return;const e=d.getValue().data;if(!Object.values(e||{}).some(o=>o!=null&&o!==""&&o!==!1&&!(Array.isArray(o)&&o.length===0)&&!(typeof o=="object"&&!Array.isArray(o)&&Object.keys(o).length===0))){showDynamicModal("Attention",[{label:"OK"}],"Please fill at least one field before saving.");return}showDynamicModal("Do you want to save the data?",[{label:"Yes",callback:()=>{const o=d.getValue(),n=R(o),r=K(o.data,v);sendEventCallback({type:FORM_EVENTS.SAVE,message:"Success: Data saved successfully.",data:{commentsData:FORM_COMMENTS_DATA,formData:n,completeFlag:_,completionPercentage:T,attachmentsData:r}})}},{label:"No",callback:()=>{}}])}function ee(){if(d&&d.options&&d.options.readOnly){L();return}let e;try{e=d?d.getValue().data:null}catch(o){e=null}JSON.stringify(e)===JSON.stringify(k)?L():showDynamicModal("Unsaved Form Data",[{label:"Discard",callback:L},{label:"Save",callback:$}],"Discard your changes or save them before leaving?")}function te(e,t,o){let n=new CustomEvent("capureImageData",{detail:{imageData:e,controlId:t,fileName:o}});document.dispatchEvent(n)}window.checkMoreButtonVisibility=function(){const e=document.getElementById("unvired-more-btn");if(!e)return;const t=window.__unviredFormsOptions||{};if(t.showMoreButton===!1){e.style.display="none";return}const o=document.getElementById("completeOption"),n=document.getElementById("saveOption"),r=document.getElementById("documentsOption"),i=document.getElementById("comments-item"),l=document.getElementById("help-item"),m=(y,s)=>y?s&&t[s]===!0?!0:y.style.display!=="none":!1;m(o)||m(n)||m(r)||t.showComments===!0||t.showHelp===!0?e.style.display="":e.style.display="none"},window.checkMoreButtonVisibility(),window.loadComments=Z,window.loadTRform=z,window.FormOnSave=$,window.FormOnBack=ee,window.setImageData=te,window.FormOnComplete=j,window.FormOnNext=function(){d&&typeof d.nextPage=="function"&&d.nextPage().then(()=>{typeof window.updateWizardNav=="function"&&window.updateWizardNav(d)})},window.FormOnPrevious=function(){d&&typeof d.prevPage=="function"&&d.prevPage().then(()=>{typeof window.updateWizardNav=="function"&&window.updateWizardNav(d)})},window.formOnCompleteFunction=j,window.resetFormCache=H,window.resetInitialFormData=function(){k=null},document.dispatchEvent(new CustomEvent("LoadRNformReady"))})();</script>
39002
+ <script>(function(){var d=null,_=null,ne;let v=[],T=0,k=!1;function L(){sendEventCallback({type:FORM_EVENTS.BACK_NAVIGATION,message:"Back navigation triggered.",data:{}})}function W(e,t){var c,f;const o=document.getElementById("saveBtn"),n=document.getElementById("submitBtn"),r=document.getElementById("prevBtn"),i=document.getElementById("nextBtn"),l=document.getElementById("completeOption"),m=document.getElementById("saveOption"),p=document.getElementById("completeDivider"),y=document.getElementById("saveDivider");if(!o||!n)return;const s=e===!0||e==="true",g=e===!1||e==="false",u=String(t||"").toLowerCase(),a=(h,w,E)=>{h&&(E?h.style.setProperty("display","flex","important"):h.style.setProperty("display","none","important")),w&&(E?w.style.setProperty("display","block","important"):w.style.setProperty("display","none","important"))};a(l,p,!1),a(m,y,!1),u==="read"?(o.style.display="none",n.style.display="none"):g&&u==="writemultiple"?(o.style.display="none",n.style.display="",n.innerHTML='<i class="bi bi-check2-circle"></i> Complete',n.disabled=!0,a(l,p,!1),a(m,y,!1)):g&&u==="writesingle"?(o.style.display="none",n.style.display="",n.innerHTML='<i class="bi bi-check2-circle"></i> Submit',n.disabled=!0):s&&u==="writemultiple"?((c=window.__unviredFormsOptions)==null?void 0:c.showCompleteAlways)===!0||((f=window.__unviredFormsOptions)==null?void 0:f.showCompleteAlways)==="true"?(o.style.display="",n.style.display="",n.innerHTML='<i class="bi bi-check2-circle"></i> Complete',o.disabled=!0,n.disabled=!0,a(l,p,!1),a(m,y,!1)):(o.style.display="",n.style.display="none",o.disabled=!0,a(l,p,!1)):s&&u==="writesingle"?(o.style.display="none",n.style.display="",n.innerHTML='<i class="bi bi-check2-circle"></i> Complete',n.disabled=!0,a(m,y,!0)):(o.style.display="none",n.style.display="",n.innerHTML='<i class="bi bi-check2-circle"></i> Submit',n.disabled=!0),typeof window.checkMoreButtonVisibility=="function"&&window.checkMoreButtonVisibility()}function U(e,t,o,n){var C,F,O,A;const r=document.getElementById("saveBtn"),i=document.getElementById("submitBtn"),l=document.getElementById("prevBtn"),m=document.getElementById("nextBtn");if(!r||!i)return;const p=o===!0||o==="true",y=o===!1||o==="false",s=String(n||"").toLowerCase(),g=document.getElementById("completeOption"),u=document.getElementById("saveOption"),a=document.getElementById("completeDivider"),c=document.getElementById("saveDivider"),f=(b,M,D)=>{b&&(D?b.style.setProperty("display","flex","important"):b.style.setProperty("display","none","important")),M&&(D?M.style.setProperty("display","block","important"):M.style.setProperty("display","none","important"))},h=Object.values(t||{}).some(b=>b!=null&&b!==""&&b!==!1&&!(Array.isArray(b)&&b.length===0)&&!(typeof b=="object"&&!Array.isArray(b)&&Object.keys(b).length===0)),w=e>=100,E=((C=window.__unviredFormsOptions)==null?void 0:C.requireCompleteForm)!==!1&&((F=window.__unviredFormsOptions)==null?void 0:F.requireCompleteForm)!=="false";if(s==="read"){r.style.display="none",i.style.display="none";return}if(p&&s==="writesingle"){r.style.display="none",i.style.display="",i.disabled=!1,f(u,c,!0),f(g,a,!1),typeof window.checkMoreButtonVisibility=="function"&&window.checkMoreButtonVisibility();return}if(p&&s==="writemultiple"){((O=window.__unviredFormsOptions)==null?void 0:O.showCompleteAlways)===!0||((A=window.__unviredFormsOptions)==null?void 0:A.showCompleteAlways)==="true"?(r.style.display="",i.style.display="",i.innerHTML='<i class="bi bi-check2-circle"></i> Complete',r.disabled=!h,i.disabled=!1,f(g,a,!1),f(u,c,!1)):w?(r.style.display="none",i.style.display="",i.innerHTML='<i class="bi bi-check2-circle"></i> Complete',i.disabled=!1,f(u,c,!0),f(g,a,!1)):h?(r.style.display="",i.style.display="none",r.disabled=!1,f(g,a,!0),f(u,c,!1)):(r.style.display="",i.style.display="none",r.disabled=!0,f(g,a,!1),f(u,c,!1)),typeof window.checkMoreButtonVisibility=="function"&&window.checkMoreButtonVisibility();return}if(y&&s==="writemultiple"){r.style.display="none",i.style.display="",i.innerHTML='<i class="bi bi-check2-circle"></i> Complete',i.disabled=!1,f(g,a,!1),f(u,c,!1),typeof window.checkMoreButtonVisibility=="function"&&window.checkMoreButtonVisibility();return}if(y&&s==="writesingle"){r.style.display="none",i.style.display="",i.disabled=!1,f(g,a,!1),f(u,c,!1),typeof window.checkMoreButtonVisibility=="function"&&window.checkMoreButtonVisibility();return}r.style.display="none",i.style.display="",i.disabled=!1,typeof window.checkMoreButtonVisibility=="function"&&window.checkMoreButtonVisibility()}async function z(e,t,o,n,r,i,l,m,p,y){if(window.CURRENT_VIEW!=="comments"){if(H(),logger.info("[TF_SDK:296] \u2705 loadTRform() entered",{mode:n,permission:p,privateExternal:m,language:r}),v=y,typeof Formio=="undefined"){logger.error("[TF_SDK:297] \u274C Formio library not loaded"),sendEventCallback({type:"ERROR",errorMessage:"ErrorCode : 016, Formio library not loaded",data:{reason:"Formio library not loaded"}});return}try{if(logger.info("[TF_SDK:297] \u2705 Initializing loadTRform"),typeof Formio!="undefined"&&Formio.Components&&Formio.Components.components&&Formio.Components.components.component){const c=Formio.Components.components.component;if(!c._requiredFixApplied){c._requiredFixApplied=!0;const f=c.prototype.setCustomValidity;c.prototype.setCustomValidity=function(w,E,C){var F,O,A,b;if(typeof w=="string"&&(w.trim().toLowerCase()==="required"||w.includes("{{field}}"))){const M=(O=(F=this.component)==null?void 0:F.validate)==null?void 0:O.customMessage,D=((A=this.component)==null?void 0:A.errorLabel)||((b=this.component)==null?void 0:b.label)||this.key||"Field";w=M||`${D} is required`}if(f)return f.call(this,w,E,C)};const h=c.prototype.t;c.prototype.t=function(w,E){var C,F,O,A;if(typeof w=="string"&&w.trim().toLowerCase()==="required"){const b=(F=(C=this.component)==null?void 0:C.validate)==null?void 0:F.customMessage;return b||`${(E==null?void 0:E.field)||((O=this.component)==null?void 0:O.errorLabel)||((A=this.component)==null?void 0:A.label)||this.key||"Field"} is required`}return h?h.apply(this,arguments):w}}}let s={noAlerts:!0,scroll:!1,language:window.FORMIO_LANGUAGE||"en",i18n:window.FORMIO_I18N};if(W(m,p),n=="form")s.readOnly=!1,s.flatten=!1,s.viewHtml=!1;else if(n=="pdf"||n=="print"){s.readOnly=!0,s.flatten=!0,s.renderMode="flat",s.viewHtml=!0;const c=document.querySelector(".progress-container");c&&(c.style.display="none")}else if(n=="readOnly"||p=="read"){s.readOnly=!0,s.flatten=!1,s.viewHtml=!1;const c=document.querySelector(".progress-container");c&&(c.style.display="none");const f=document.getElementById("sticky-footer");f&&window.CURRENT_VIEW!=="comments"&&(f.style.display="none")}else s.readOnly=!1,s.flatten=!1,s.viewHtml=!1;const g=document.getElementById("formio");if(!g)throw new Error("DOM Element #formio not found");logger.info("[TF_SDK:298] \u2705 Creating Formio form...",e);try{d=await Formio.createForm(g,e,s)}catch(c){throw logger.error("[TF_SDK:298-ERR] \u274C Error in Formio.createForm:",c),c}let u=!1;if(d.on("change",()=>{if(!u){if(!_)try{_=JSON.parse(JSON.stringify(d.getValue().data))}catch(c){_=d.getValue().data}u=!0}}),document.dispatchEvent(new CustomEvent("LessRenderingComplete")),window.formObj=d,window.FORMIO_I18N&&Object.keys(window.FORMIO_I18N).length>0){const c=document.getElementById("languageSubMenu"),f=document.getElementById("languageMainOption"),h=document.getElementById("languageDivider");if(c&&f){c.innerHTML="";let w=Object.keys(window.FORMIO_I18N).filter(F=>typeof window.FORMIO_I18N[F]=="object"&&window.FORMIO_I18N[F]!==null);const E=window.FORMIO_LANGUAGE||"en";!w.includes(E)&&typeof window.FORMIO_I18N[E]=="object"&&w.unshift(E);let C=null;try{window.Intl&&typeof Intl.DisplayNames=="function"&&(C=new Intl.DisplayNames(["en"],{type:"language"}))}catch(F){logger.warn("Intl.DisplayNames not supported",F)}w.forEach(F=>{const O=document.createElement("div");O.className=f.className,O.style.cursor="pointer",O.style.padding="0.5rem 1rem",O.style.borderTop="none";let A=F.toUpperCase();try{A=C.of(F)||A}catch(M){}let b=F===E?'<i class="bi bi-check2 text-primary" style="margin-right: 8px;"></i>':'<i class="bi bi-check2" style="margin-right: 8px; visibility: hidden;"></i>';f.innerHTML.includes("icon chevron")&&(b=F===E?'<i class="icon check" style="margin-right: 8px;"></i>':'<i class="icon check" style="margin-right: 8px; visibility: hidden;"></i>'),O.innerHTML=`${b}${A}`,O.onclick=function(M){M.stopPropagation(),window.changeFormLanguage&&(window.changeFormLanguage(F),window.FORMIO_LANGUAGE=F);const D=c.children;for(let N=0;N<D.length;N++){const S=D[N].querySelector("i");S&&(w[N]===F?(S.style.visibility="visible",S.className.includes("bi")&&S.classList.add("text-primary")):(S.style.visibility="hidden",S.className.includes("bi")&&S.classList.remove("text-primary")))}window.toggleLanguageSubMenu&&window.toggleLanguageSubMenu(),window.showToast&&window.showToast(`Language set to ${A}`,"success")},c.appendChild(O)}),w.length>1?(f.style.display=f.className.includes("d-flex")?"flex":"block",h&&(h.style.display="block")):(f.style.display="none",h&&(h.style.display="none"))}}else{const c=document.getElementById("languageMainOption"),f=document.getElementById("languageDivider");c&&(c.style.display="none"),f&&(f.style.display="none")}if(!d){logger.error("[TF_SDK:299] \u274C Form not initialized.");return}const a=()=>{['button[type="submit"]',".formio-component-submit"].forEach(h=>{d.element.querySelectorAll(h).forEach(E=>{E.style.display="none"})}),d.element.querySelectorAll('input:not([type="file"]), textarea').forEach(h=>{h.getAttribute("autocomplete")!=="new-password"&&(h.setAttribute("autocomplete","new-password"),h.setAttribute("data-lpignore","true"),h.setAttribute("spellcheck","false"))})};a(),d.on("render",a),Q(m,p),d.formReady.then(()=>{if(logger.info("[TF_SDK:300] \u2705 formReady.then() triggered"),typeof window.initializeWizardLogic=="function"&&window.initializeWizardLogic(d,m,p),t?(logger.info("[TF_SDK:301] \u2705 Previous form data found:",t),d.submission={data:typeof t=="string"?JSON.parse(t):t},logger.info("[TF_SDK:302] \u2705 Previous submission data applied")):logger.info("[TF_SDK:303] \u2705 No previous form data found"),logger.info("[TF_SDK:304] \u2705 Calculating initial progress..."),executeProgressCalculation(m,p),logger.info("[TF_SDK:305] \u2705 Progress calculation completed"),n=="readOnly"){logger.info("[TF_SDK:306] \u2705 ReadOnly mode detected");const w=document.querySelectorAll(".formio-component-submit");logger.info(`[TF_SDK:307] \u2705 Found ${w.length} submit components`),w.forEach((E,C)=>{E.style.display="none",logger.info(`[TF_SDK:308] \u2705 Hidden submit component ${C+1}`)})}else logger.info("[TF_SDK:309] \u2705 Editable mode detected");logger.info("[TF_SDK:310] \u2705 Sending FORM_RENDER callback..."),sendEventCallback({type:FORM_EVENTS.FORM_RENDER,message:"Success: Form rendered successfully.",data:{submissionData:t,formTemplate:e}}),logger.info("[TF_SDK:311] \u2705 FORM_RENDER callback sent");const c=document.getElementById("sdk-form-loader");c?(logger.info("[TF_SDK:312] \u2705 Loader found, hiding..."),c.classList.add("hidden"),logger.info("[TF_SDK:313] \u2705 Loader hidden")):logger.warn("[TF_SDK:314] \u2705 Loader element not found"),document.querySelectorAll(".tf-form-loading").forEach(w=>w.classList.remove("tf-form-loading")),logger.info("[TF_SDK:315] \u2705 Dispatching FormRenderingComplete event...");let f=0;typeof window.getMaxTableWidth=="function"&&(f=window.getMaxTableWidth(document.getElementById("formio")||document.querySelector(".tf-embed-sdk")||document.body).maxWidth),sendEventCallback({type:FORM_EVENTS.FORM_LOADED,message:"Success: Form rendered complete.",data:{maxTableWidth:`${f}px`}}),document.dispatchEvent(new CustomEvent("FormRenderingComplete",{detail:{timestamp:new Date().toISOString(),status:"success",maxTableWidth:f}})),logger.info("[TF_SDK:316] \u2705 FormRenderingComplete event dispatched successfully");const h=document.querySelector('input[type="file"]');h?(h.setAttribute("accept","*/*"),logger.info("[TF_SDK:317] \u2705 File input found, accept=*/* applied")):logger.info("[TF_SDK:318] \u2705 No file input found"),logger.info("[TF_SDK:319] \u2705 Full formReady process completed")}).catch(c=>{logger.error("[TF_SDK:320] \u274C formReady.then() failed:",c)})}catch(s){logger.error("[TF_SDK:321] \u274C Error creating form (after retries):",s?s.message:"Unknown error",s?s.stack:"");const g=document.getElementById("sdk-form-loader");g&&g.classList.add("hidden"),document.querySelectorAll(".tf-form-loading").forEach(u=>u.classList.remove("tf-form-loading")),sendEventCallback({type:"ERROR",errorMessage:"ErrorCode : 005, Formio not rendered the forms",data:{reason:"Failed to render form after retries",technicalError:s}})}}}let B=null,V=null,I=null;function G(){if(I)return I;if(!d)return[];const e=[];function t(o,n=""){Array.isArray(o)&&o.forEach(r=>{var y;if(!r)return;const i=r.component||r;let l=n;if(["columns","panel","fieldset","well","table","tabs","content","htmlelement"].includes(i.type)||(l=n?`${n}.${i.key}`:i.key),["textfield","textarea","number","checkbox","radio","select","selectboxes","email","url","day","datetime","file","datamap","tree","survey","signature","datagrid","editgrid","container"].includes(i.type)&&((y=i.validate)!=null&&y.required)&&e.push({key:i.key,type:i.type,path:l,comp:i,instance:r}),Array.isArray(r.components)&&t(r.components,l),i.type==="form"){let s=l?`${l}.data`:"data";r.subForm&&Array.isArray(r.subForm.components)?t(r.subForm.components,s):Array.isArray(r.components)&&t(r.components,s)}Array.isArray(r.columns)&&r.columns.forEach(s=>{Array.isArray(s.components)&&t(s.components,l)})})}return t(d.components),I=e,e}window.executeProgressCalculation=function(e,t){if(!d)return;const o=d.data||{},n=JSON.stringify(o);if(!(d&&!!d.wizard)&&n===V)return;V=n;const i=G();let l=i.length,m=0;function p(u,a){if(Array.isArray(a)){if(!(["file","datagrid","editgrid","datamap","selectboxes"].includes(u.type)||u.multiple))return a.length>0&&a.every(h=>p(u,h));if(u.type==="file"&&a.length>0&&Array.isArray(a[0]))return a.every(h=>p(u,h))}switch(u.type){case"selectboxes":return Object.values(a||{}).some(Boolean);case"datamap":case"tree":return a&&Object.keys(a).length>0;case"survey":return u.questions&&Array.isArray(u.questions)?a&&Object.keys(a).length>=u.questions.length:a&&Object.keys(a).length>0;case"file":return Array.isArray(a)&&a.length>0;case"checkbox":return a===!0;case"editgrid":case"datagrid":return Array.isArray(a)&&a.length>0;case"signature":return!!a;default:return u.multiple?Array.isArray(a)&&a.length>0&&a.some(c=>c!=null&&c!==""):a!=null&&a!==""}}const y=[];i.forEach(u=>{let a=!0;u.instance&&(u.instance.visible===!1&&(a=!1),a&&typeof u.instance.checkCondition=="function"&&(u.instance.checkCondition(null,o)||(a=!1))),a&&(u.instance&&u.instance.parent&&u.instance.parent.visible===!1||y.push(u))}),l=y.length,m=0,y.forEach(({key:u,type:a,path:c,comp:f})=>{let h=x(o,c);p(f,h)&&m++});const s=l===0?100:Math.round(m/l*100);logger.info("[TF_SDK:322] \u2705 Progress:",{mandatory:l,filledMandatory:m,completion:s+"%"}),T=s,k=s>=100,U(s,d.data,e,t),typeof window.updateWizardNav=="function"&&window.updateWizardNav(d);const g=document.getElementById("progress-bar");if(g){const u=g.querySelector(".progress"),a=g.querySelector(".badge");u.style.width=`${s}%`,a.textContent=`${s}%`;let c=s;s<=0?(c=.5,u.style.width=`${.5}%`,window.innerWidth>768||window.innerWidth>480?a.style.transform="translateX(2%)":a.style.transform="translateX(1%)"):s>=100?(g.classList.add("complete"),c=99.5,window.innerWidth>768||window.innerWidth>480,a.style.transform="translateX(-100%)"):(g.classList.remove("complete"),a.style.transform="translateX(-50%)"),a.style.left=`${c-.25}%`}};function x(e,t){if(e==null||!t)return;if(t.indexOf(".")===-1)return Array.isArray(e)?e.map(r=>r[t]):e[t];const o=t.split(".");let n=e;for(let r=0;r<o.length;r++){const i=o[r];if(n==null)return;if(Array.isArray(n)){const l=o.slice(r).join(".");return n.map(m=>x(m,l))}n=n[i]}return n}function q(e){if(!e)return!0;let t=e.getValue?e.getValue():e.dataValue;return t==null||t===""||Array.isArray(t)&&(t.length===0||!t.some(n=>!(n==null||n===""||typeof n=="object"&&Object.keys(n).length===0)))||typeof t=="object"&&!Array.isArray(t)&&(Object.keys(t).length===0||!Object.values(t).some(n=>n!=null&&n!==""&&n!==!1))?!0:e.isEmpty?e.isEmpty(t):!1}function J(e,t){var r,i,l,m,p,y;if(!e||!t)return null;if(t.component&&t.component.element)return t.component;const o=t.path||((r=t.context)==null?void 0:r.path)||((i=t.context)==null?void 0:i.hasPath);if(o){let s=typeof e.getComponent=="function"?e.getComponent(o):null;if(s&&s.element)return s;const g=String(o).replace(/\[(\d+)\]/g,".$1");if(s=typeof e.getComponent=="function"?e.getComponent(g):null,s&&s.element)return s;const u=String(o).replace(/\.(\d+)\./g,"[$1].");if(s=typeof e.getComponent=="function"?e.getComponent(u):null,s&&s.element)return s}const n=((m=(l=t.context)==null?void 0:l.component)==null?void 0:m.key)||((p=t.component)==null?void 0:p.key)||(typeof((y=t.context)==null?void 0:y.component)=="string"?t.context.component:null);if(n&&typeof e.getComponent=="function"){const s=e.getComponent(n);if(s&&s.element)return s}return null}function P(e){if(!e||!e.element)return;e.error=null,typeof e.setCustomValidity=="function"&&e.setCustomValidity(""),e.element.classList.remove("has-error","formio-error-wrapper","is-invalid"),e.element.querySelectorAll(".choices__inner, .ui.selection.dropdown, .is-invalid").forEach(n=>{n.closest(".formio-component")===e.element&&n.classList.remove("is-invalid")}),e.element.querySelectorAll(".formio-errors, .invalid-feedback, [ref='messageContainer']").forEach(n=>{n.closest(".formio-component")===e.element&&(n.innerHTML="",n.style.display="none")})}function X(e){!e||typeof e.everyComponent!="function"||e.everyComponent(t=>{var l;if(!t||!t.element)return;const o=((l=t.component)==null?void 0:l.type)||t.type;if(["datagrid","editgrid","container","panel","columns","fieldset","well","tabs","form"].includes(o))return;const r=t.element.classList.contains("has-error")||t.element.classList.contains("formio-error-wrapper"),i=Array.from(t.element.querySelectorAll(".formio-errors, .invalid-feedback")).some(m=>m.style.display!=="none"&&m.innerHTML.trim()!==""&&m.closest(".formio-component")===t.element);(r||i)&&!q(t)&&P(t)})}function Y(e,t){var m,p,y,s;if(!e||!e.element)return;e.element.classList.add("has-error","formio-error-wrapper");const o=e.element.querySelector(".choices__inner, .ui.selection.dropdown");o&&o.closest(".formio-component")===e.element&&o.classList.add("is-invalid");const n=t.message||((p=(m=t.context)==null?void 0:m.component)!=null&&p.label?`${t.context.component.label} is required`:`${((y=e.component)==null?void 0:y.label)||e.key} is required`),i=`e-${e.id||((s=e.component)==null?void 0:s.id)||e.key}-${e.key}`;let l=Array.from(e.element.querySelectorAll(".formio-errors, [ref='messageContainer']")).find(g=>g.closest(".formio-component")===e.element);l?(l.setAttribute("ref","messageContainer"),l.classList.contains("invalid-feedback")||l.classList.add("invalid-feedback")):(l=document.createElement("div"),l.setAttribute("ref","messageContainer"),l.className="formio-errors invalid-feedback",e.element.appendChild(l)),l.innerHTML=`<div id="${i}" class="form-text error">${n}</div>`,l.style.display="block"}function Q(e,t){d&&d.on("change",o=>{var n,r;((r=(n=o.changed)==null?void 0:n.component)==null?void 0:r.type)==="datetime"&&document.activeElement.blur(),X(d),B&&clearTimeout(B),I=null,B=setTimeout(()=>{executeProgressCalculation(e,t)},300)})}function K(e,t=[]){let o={};if(!t||t.length===0||!e)return o;let n=e;if(typeof e=="string")try{n=JSON.parse(e)}catch(i){}const r=i=>{if(!(!i||typeof i!="object"))if(Array.isArray(i))i.forEach(r);else for(const l in i)t.includes(l)?o[l]?Array.isArray(o[l])&&Array.isArray(i[l])&&(o[l]=o[l].concat(i[l])):o[l]=i[l]:typeof i[l]=="object"&&r(i[l])};return r(n),o}function R(e,t=[]){if(!e||typeof e!="object")return e;const o=Array.isArray(e)?[...e]:{...e};for(const n in o){const r=o[n];Array.isArray(r)?t.length>0&&t.includes(n)?o[n]=r.map(i=>i&&typeof i=="object"&&(i.uid||i.id)?i.uid||i.id:i):r.length>0&&r.every(i=>i&&typeof i=="object"&&i.storage==="SmartStorage")?o[n]=r.map(i=>i.id||i.uid||i):o[n]=r.map(i=>typeof i=="object"&&i!==null?R(i,t):i):r&&typeof r=="object"&&(o[n]=R(r,t))}return o}function j(){var r,i;if(!d)return;const e=d.getValue(),t=R(e,v),o=K(e.data,v);if(!(((r=window.__unviredFormsOptions)==null?void 0:r.requireCompleteForm)!==!1&&((i=window.__unviredFormsOptions)==null?void 0:i.requireCompleteForm)!=="false")){showDynamicModal("Are you sure you want to complete the form?",[{label:"Yes",callback:()=>{sendEventCallback({type:FORM_EVENTS.SUBMIT,message:"Success: Form submitted successfully (Validation Bypassed).",data:{formData:t,completeFlag:k,completionPercentage:T,commentsData:FORM_COMMENTS_DATA,result:t,attachmentsData:o}})}},{label:"No",callback:()=>{}}]);return}d.errors=[],d.submit().then(l=>{showDynamicModal("Are you sure you want to complete the form?",[{label:"Yes",callback:()=>{sendEventCallback({type:FORM_EVENTS.SUBMIT,message:"Success: Form submitted successfully.",data:{formData:t,completeFlag:k,completionPercentage:T,commentsData:FORM_COMMENTS_DATA,result:l,attachmentsData:o}})}},{label:"No",callback:()=>{}}])}).catch(l=>{let m=!1,p=[],y=[];if(d&&Array.isArray(d.errors)&&d.errors.length>0&&(y=y.concat(d.errors)),Array.isArray(l)?y=y.concat(l):l&&Array.isArray(l.errors)?y=y.concat(l.errors):l&&Array.isArray(l.details)?y=y.concat(l.details):l&&typeof l=="object"&&(l.message||l.context)&&y.push(l),y.length>0?y.forEach(g=>{const u=J(d,g);u&&u.element?q(u)?(m=!0,p.push(g),Y(u,g)):P(u):(m=!0,p.push(g))}):m=!0,!m){logger.warn("[TF_SDK:321a] \u26A0\uFE0F All reported errors were resolved/hallucinated. Forcing success submit."),showDynamicModal("Are you sure you want to complete the form?",[{label:"Yes",callback:()=>{sendEventCallback({type:FORM_EVENTS.SUBMIT,message:"Success: Form submitted successfully.",data:{formData:t,completeFlag:k,completionPercentage:T,commentsData:FORM_COMMENTS_DATA,result:t,attachmentsData:o}})}},{label:"No",callback:()=>{}}]);return}logger.error("Form submit errors:",p);let s="Please fill in all required fields.";p.length===1&&p[0].message&&(s=p[0].message),showDynamicModal("Error",[{label:"OK"}],s),sendEventCallback({type:FORM_EVENTS.SUBMIT_ERROR,errorMessage:"ErrorCode : 006, Formio not submit the form",data:{reason:"Form submission failed",formData:t,completeFlag:k,completionPercentage:T,technicalError:p.length>0?p:l}})})}function H(){B=null,V=null,I=null}async function Z(){if(!d){logger.error("[TF_SDK:323] \u274C Form object not initialized");return}let e=d.getValue();window.FORM_SUB_TEMP=e;const t=window.FORM_TEMPLATE||{display:"form",type:"form",components:[]};try{typeof window.loadCommentsform=="function"?(await window.loadCommentsform(t,window.FORM_USER_DATA,window.FORM_COMMENTS_DATA,window.FORM_VOB_ARR,window.FORM_USERS_LIST||[]),showCommentsView()):logger.error("[TF_SDK:324] \u274C loadCommentsform is not a function")}catch(o){logger.error("[TF_SDK:325] \u274C Error while loading comments:",o)}}function $(){if(!d)return;const e=d.getValue().data;if(!Object.values(e||{}).some(o=>o!=null&&o!==""&&o!==!1&&!(Array.isArray(o)&&o.length===0)&&!(typeof o=="object"&&!Array.isArray(o)&&Object.keys(o).length===0))){showDynamicModal("Attention",[{label:"OK"}],"Please fill at least one field before saving.");return}showDynamicModal("Do you want to save the data?",[{label:"Yes",callback:()=>{const o=d.getValue(),n=R(o),r=K(o.data,v);sendEventCallback({type:FORM_EVENTS.SAVE,message:"Success: Data saved successfully.",data:{commentsData:FORM_COMMENTS_DATA,formData:n,completeFlag:k,completionPercentage:T,attachmentsData:r}})}},{label:"No",callback:()=>{}}])}function ee(){if(d&&d.options&&d.options.readOnly){L();return}let e;try{e=d?d.getValue().data:null}catch(o){e=null}JSON.stringify(e)===JSON.stringify(_)?L():showDynamicModal("Unsaved Form Data",[{label:"Discard",callback:L},{label:"Save",callback:$}],"Discard your changes or save them before leaving?")}function te(e,t,o){let n=new CustomEvent("capureImageData",{detail:{imageData:e,controlId:t,fileName:o}});document.dispatchEvent(n)}window.checkMoreButtonVisibility=function(){const e=document.getElementById("unvired-more-btn");if(!e)return;const t=window.__unviredFormsOptions||{};if(t.showMoreButton===!1){e.style.display="none";return}const o=document.getElementById("completeOption"),n=document.getElementById("saveOption"),r=document.getElementById("documentsOption"),i=document.getElementById("comments-item"),l=document.getElementById("help-item"),m=(y,s)=>y?s&&t[s]===!0?!0:y.style.display!=="none":!1;m(o)||m(n)||m(r)||t.showComments===!0||t.showHelp===!0?e.style.display="":e.style.display="none"},window.checkMoreButtonVisibility(),window.loadComments=Z,window.loadTRform=z,window.FormOnSave=$,window.FormOnBack=ee,window.setImageData=te,window.FormOnComplete=j,window.FormOnNext=function(){d&&typeof d.nextPage=="function"&&d.nextPage().then(()=>{typeof window.updateWizardNav=="function"&&window.updateWizardNav(d)})},window.FormOnPrevious=function(){d&&typeof d.prevPage=="function"&&d.prevPage().then(()=>{typeof window.updateWizardNav=="function"&&window.updateWizardNav(d)})},window.formOnCompleteFunction=j,window.resetFormCache=H,window.resetInitialFormData=function(){_=null},document.dispatchEvent(new CustomEvent("LoadRNformReady"))})();</script>
38465
39003
  <script>(function(){function l(e){if(!e||([".formio-component-wizard_nav",".btn-wizard-nav-next",".btn-wizard-nav-previous",".btn-wizard-nav-cancel",".btn-wizard-nav-submit"].forEach(n=>{e.element.querySelectorAll(n).forEach(t=>{t.style.display="none"})}),typeof e.eachComponent=="function"&&e.eachComponent(n=>{if(n.type==="button"){const o=(n.component.action||"").toLowerCase(),t=(n.component.label||"").toLowerCase();(o==="next"||o==="previous"||o==="cancel"||t==="next"||t==="previous"||t==="cancel")&&(n.visible=!1,n.element&&(n.element.style.display="none"))}}),!e.wizard))return;const i=document.getElementById("prevBtn"),d=document.getElementById("nextBtn"),u=document.getElementById("submitBtn"),y=document.getElementById("saveBtn"),a=e.page||0,c=e.pages&&e.pages.length||0,g=a>=c-1;if(logger.info(`[TF_SDK:326] \u2705 Page: ${a+1}/${c}, isLastPage: ${g}`),i&&(i.style.display=a>0?"inline-block":"none"),d&&(d.style.display=a<c-1?"inline-block":"none"),g)logger.info("[TF_SDK:328] \u2705 Last page: Allowing normal button logic to take over"),typeof window.checkMoreButtonVisibility=="function"&&window.checkMoreButtonVisibility();else{logger.info("[TF_SDK:327] \u2705 Intermediate page: Hiding save/complete actions"),u&&(u.style.display="none"),y&&(y.style.display="none");const n=document.getElementById("completeOption"),o=document.getElementById("saveOption"),t=document.getElementById("completeDivider"),p=document.getElementById("saveDivider");n&&(n.style.display="none"),o&&(o.style.display="none"),t&&(t.style.display="none"),p&&(p.style.display="none");const r=document.getElementById("quickCompleteBtn"),w=document.getElementById("quickSaveBtn");r&&(r.style.display="none"),w&&(w.style.display="none"),typeof window.checkMoreButtonVisibility=="function"&&window.checkMoreButtonVisibility()}}function f(e,s,i){e&&(e.wizard&&(e.on("nextPage",()=>{l(e),typeof window.executeProgressCalculation=="function"&&window.executeProgressCalculation(s,i)}),e.on("prevPage",()=>{l(e),typeof window.executeProgressCalculation=="function"&&window.executeProgressCalculation(s,i)})),e.on("render",()=>{l(e)}))}window.updateWizardNav=l,window.initializeWizardLogic=function(e,s,i){logger.info("[TF_SDK:329] \u2705 Initializing wizard-specific logic..."),f(e,s,i),e.on("change",()=>{l(e)}),l(e)}})();</script>
38466
39004
  <script>(function(){async function d(o,e,n,w,i=[]){var a,c;logger.info("[TF_SDK:279] \u2705 loadCommentsform() called",{users:i==null?void 0:i.length,commentsData:n==null?void 0:n.length});const r=document.getElementById("formio-cmt");if(!r)return logger.error("[TF_SDK:280] \u274C formio-cmt container not found");if(window.commentsResponse){try{(c=(a=window.commentsResponse).destroy)==null||c.call(a)}catch(t){logger.warn("[TF_SDK:281] \u26A0\uFE0F Could not destroy previous Recogito instance",t)}window.commentsResponse=null}if(window.commentsFormObj&&window.commentsFormObj.destroy)try{await window.commentsFormObj.destroy()}catch(t){logger.warn("[TF_SDK:282] \u26A0\uFE0F Could not destroy previous comments Formio form",t)}r.innerHTML="",logger.info("[TF_SDK:283] \u2705 Creating Formio form in read-only mode for comments..."),window.commentsFormObj=await Formio.createForm(r,o,{renderMode:"html",flatten:!0,readOnly:!0,language:localStorage.getItem("language")||"en"}),window.commentsFormObj.nosubmit=!0,window.commentsFormObj.on("change",()=>{}),logger.info("[TF_SDK:284] \u2705 Initializing Recogito annotation overlay..."),window.commentsResponse=Recogito.init({content:document.getElementById("formio-cmt"),locale:localStorage.getItem("language"),widgets:[{widget:recogito.CommentsMention,userSuggestions:i,editable:"MINE_ONLY"},{widget:"TAG",vocabulary:w}],mode:"html"}),window.commentsResponse.setAuthInfo({id:e.email,displayName:e.firstName||e.email}),window.commentsResponse.on("createAnnotation",function(t){}),window.commentsResponse.on("updateAnnotation",function(t){}),window.commentsResponse.on("selectAnnotation",function(t){const g=new CustomEvent("annotateCss",{detail:!0});document.dispatchEvent(g)}),window.commentsFormObj.formReady.then(()=>{setTimeout(()=>{logger.info("[TF_SDK:285] \u2705 Annotations loaded",{count:n==null?void 0:n.length}),window.commentsResponse.setAnnotations(n)},500);const t=new CustomEvent("loadAnnotationComplete",{});document.dispatchEvent(t),logger.info("[TF_SDK:286] \u2705 loadAnnotationComplete dispatched")})}async function m(){logger.info("[TF_SDK:287] \u2705 goToformRender() \u2014 returning to form view");const o=document.getElementById("formio-cmt");if(o&&(o.innerHTML=""),typeof window.resetFormCache=="function"&&window.resetFormCache(),typeof window.showFormView=="function")try{window.commentsResponse&&window.commentsResponse.destroy&&(window.commentsResponse.destroy(),logger.info("[TF_SDK:288] \u2705 Previous Recogito instance destroyed")),window.commentsFormObj&&window.commentsFormObj.destroy&&(await window.commentsFormObj.destroy(),window.commentsFormObj=null),logger.info("[TF_SDK:289] \u2705 Instantly switching back to form view..."),window.showFormView()}catch(e){logger.error("[TF_SDK:290] \u274C Error restoring form view:",e),typeof sendEventCallback=="function"&&sendEventCallback({type:"ERROR",errorMessage:"ErrorCode : 005, Formio not rendered the forms",data:{reason:"Failed to restore form view",technicalError:e}})}else logger.error("[TF_SDK:291] \u274C showFormView is not defined")}function l(){logger.info("[TF_SDK:292] \u2705 CommentOnBack() \u2014 checking for unsaved changes");let o=window.commentsResponse.getAnnotations(),e=window.FORM_COMMENTS_DATA;const n=JSON.stringify(o)===JSON.stringify(e);logger.info("[TF_SDK:293] \u2705 Annotations changed:",!n),n?m():showDynamicModal("Unsaved Comments",[{label:"Discard",callback:m},{label:"Save",callback:s}],"Discard your comments or save them before leaving?")}function s(){logger.info("[TF_SDK:294] \u2705 submitComments() \u2014 sending annotation data to app");let o=window.commentsResponse.getAnnotations();logger.info("[TF_SDK:295] \u2705 Annotations collected",{count:o==null?void 0:o.length}),sendEventCallback({type:"COMMENTS_DATA",message:"Success: getcomments data.",data:{commentsData:o}}),window.FORM_COMMENTS_DATA=o,m()}window.submitComments=s,window.loadCommentsform=d,window.CommentOnBack=l})();</script>
38467
39005
 
38468
39006
  <script>(function(){window.applyBarcodeLayout=i=>{const n=i;if(!n||!n.querySelectorAll)return;n.querySelectorAll(".formio-component-barcode, .formio-component-barcodeselect").forEach(o=>{const c=o.querySelector('[ref="element"]')||o.querySelector(".choices")||o;if(c&&!o.querySelector(".barcode-custom-icon")){const e=document.createElement("span");e.className="barcode-custom-icon bi bi-barcode",e.title="Scan Barcode",e.setAttribute("role","button"),e.setAttribute("aria-label","Scan barcode"),e.addEventListener("click",r=>{r.preventDefault(),r.stopPropagation(),e.style.opacity="0.5",setTimeout(()=>e.style.opacity="1",200),logger.info("[TF_SDK:33] \u2705 Barcode Icon Clicked!");const t=o.querySelector("input"),a=t?t.id:o.id;logger.info("[TF_SDK:34] \u2705 Dispatching openBarcode for:",a);const l=new CustomEvent("openBarcode",{detail:{compObj:o,controlId:a}});document.dispatchEvent(l),t&&t.focus()}),c.prepend(e)}})}})();</script>
38469
- <script>(function(){function k(o){logger.info(`[TF_SDK:35] \u2705 Processing component: ${o.getAttribute("ref")||o.id}`);const q=!o.querySelector("ul"),E=o.querySelector("ul.list-group, div:not(.fileSelector):not(.formio-errors):not(.mb-2):not(.formio-errors)"),l=E?Array.from(E.children).filter(e=>["DIV","LI"].includes(e.nodeName)):[];l.forEach(e=>{if(!(e.classList.contains("formio-errors")||e.classList.contains("list-group-header"))){if(q){let n="";if(!e.querySelector(".file-preview-wrapper")&&!e.querySelector('[ref="fileImage"]')){const s=e.textContent.toLowerCase(),t=e.querySelector("a"),g=/\.(jpg|jpeg|png|gif|webp|svg)$/i;if(g.test(s)||t&&g.test(t.href)||e.querySelector("img.file-image")){const C=e.querySelector("img.file-image");if(C&&C.src?n=C.src:(t&&t.href&&g.test(t.href)||t&&t.href&&t.href.startsWith("data:image"))&&(n=t.href),n){const d=document.createElement("div");d.className="file-preview-wrapper";const v=document.createElement("img");v.src=n,v.className="file-preview-img",d.appendChild(v),e.firstChild?e.insertBefore(d,e.firstChild):e.appendChild(d)}}}if(!n){const s=e.querySelector('.file-preview-img, [ref="fileImage"]');if(s&&s.src)n=s.src;else{const t=e.querySelector("a"),g=/\.(jpg|jpeg|png|gif|webp|svg)$/i;t&&t.href&&(g.test(t.href)||t.href.startsWith("data:image"))&&(n=t.href)}}const a=[{class:"bi bi-eye",title:"Preview"},{class:"bi bi-pencil",title:"Edit"}];e.querySelectorAll('[ref="removeLink"]').forEach(s=>{if(s.closest(".file-actions-wrapper"))return;const t=document.createElement("div");t.className="file-actions-wrapper custom-scrollbar",s.after(t),s.className="action-item remove-action",s.innerHTML='<i class="bi bi-trash-fill"></i>',t.appendChild(s),a.forEach(g=>{const b=document.createElement("div");b.className="action-item",b.setAttribute("title",g.title),b.innerHTML=`<i class="${g.class}"></i>`,t.appendChild(b),b.addEventListener("click",C=>{var A,L;C.preventDefault(),C.stopPropagation();let d="";const v=e.querySelector('.file-preview-img, [ref="fileImage"]');if(v&&v.src)d=v.src;else{const i=e.querySelector("a"),r=/\.(jpg|jpeg|png|gif|webp|svg)$/i;i&&i.href&&(r.test(i.href)||i.href.startsWith("data:image"))&&(d=i.href)}if(g.title==="Preview"&&d&&typeof window.openImagePreviewModal=="function"){const i=((L=(A=e.querySelector("a"))==null?void 0:A.textContent)==null?void 0:L.trim())||"File Preview";window.openImagePreviewModal(d,i);return}if(g.title==="Edit"&&d&&typeof cropro!="undefined"){const i=new Image;i.src=d,i.style.position="fixed",i.style.visibility="hidden",i.style.pointerEvents="none",document.body.appendChild(i),i.onload=()=>{const r=new cropro.CropArea(i);if(r.displayMode="popup",r.renderImageType="image/jpeg",r.renderImageQuality=.8,r.renderAtNaturalSize=!0,r.popupMargin=60,r.styles&&r.styles.settings&&o.closest(".tf-embed-sdk")){const h=getComputedStyle(o);let p=h.getPropertyValue("--tf-primary-color").trim(),c=h.getPropertyValue("--tf-secondary-color").trim(),m=h.getPropertyValue("--tf-app-bg-color").trim();window.__unviredThemeData&&(p=p||window.__unviredThemeData.primaryColor,c=c||window.__unviredThemeData.secondaryColor,m=m||window.__unviredThemeData.backgroundColor),p=p||"#2586c7",c=c||"white",m=m||"white",r.styles.settings.toolbarBackgroundColor=m,r.styles.settings.toolbarBackgroundHoverColor=m,r.styles.settings.toolbarBackgroundActiveColor=m,r.styles.settings.toolbarColor=p,r.styles.settings.cropFrameColor=p,r.styles.settings.gripColor=p,r.styles.settings.gripFillColor=c}r.addRenderEventListener(async h=>{logger.info("[TF_SDK:35a] \u{1F3A8} Crop render event fired");const p=e.querySelector('.file-preview-img, [ref="fileImage"]');p&&(p.src=h);const c=o.componentInstance||o.component,m=l.indexOf(e);let f=null;c&&Array.isArray(c.dataValue)&&(f=c.dataValue[m]);const w=f?f.id||f.uid||f._id:null,D=f?f.originalName||f.name:"edited_image.jpg";for(var F=h.split(","),P=(F[0].match(/:(.*?);/)||[])[1]||"image/jpeg",T=atob(F[1]),I=T.length,N=new Uint8Array(I);I--;)N[I]=T.charCodeAt(I);let S=new Blob([N],{type:P});if(S.name=D,logger.info(`[TF_SDK:36] \u{1F4BE} Custom Renderer: User clicked Crop Save (\u2713)! Base64 DataURL length=${h.length}`),typeof imageCompression=="function"&&P.startsWith("image/"))try{const u={maxSizeMB:.2,maxWidthOrHeight:1600,initialQuality:.8,useWebWorker:!0},_=await imageCompression(S,u);_.name=D,logger.info(`[TF_SDK:37] \u26A1 Compressed cropped image: ${S.size} -> ${_.size} bytes`),S=_}catch(u){logger.warn("[TF_SDK:37a] \u26A0\uFE0F Compression skipped/failed:",u)}w&&typeof window.updateFileInIndexedDB=="function"?(logger.info(`[TF_SDK:38] \u{1F4BE} Custom Renderer: Calling updateFileInIndexedDB for id: ${w}`),window.updateFileInIndexedDB(w,S,D).then(u=>{logger.info("[TF_SDK:38a] \u2705 Custom Renderer: IndexedDB update successful for id:",w),f&&(f.url=u.url,f.size=u.size,f.mode=u.mode||"A"),c&&typeof c.triggerChange=="function"&&c.triggerChange({modified:!0})}).catch(u=>{logger.error("[TF_SDK:38b] \u274C Custom Renderer: IndexedDB update failed:",u)})):logger.warn("[TF_SDK:38c] \u26A0\uFE0F Cannot update IndexedDB: existingId missing or updateFileInIndexedDB function not available");const j=new CustomEvent("formio-file-updated",{detail:{element:o,row:e,dataUrl:h},bubbles:!0});o.dispatchEvent(j),document.body.removeChild(i)}),r.addCloseEventListener(()=>{i.parentNode&&document.body.removeChild(i)}),r.show()};return}const B=new CustomEvent("formio-file-action",{detail:{element:o,icon:g,row:e,imgSrc:d},bubbles:!0});b.dispatchEvent(B)})})})}e.classList.add("layout-processed"),e.style.setProperty("opacity","1","important"),e.style.visibility="visible"}});const y=o.querySelector('[ref="messageContainer"]');if(y){const e=Array.from(o.querySelectorAll(".status.text-danger, .alert-danger")).filter(a=>!y.contains(a));y.querySelectorAll(".cloned-err").forEach(a=>a.remove()),e.length>0&&(y.classList.add("d-block"),y.style.display="block",e.forEach(a=>{const x=a.textContent.toLowerCase();if(x.includes("already uploaded")||x.includes("already being uploaded")){a.style.setProperty("display","none","important");return}const s=a.cloneNode(!0);s.classList.add("cloned-err"),s.style.setProperty("display","block","important"),y.appendChild(s),a.style.setProperty("display","none","important")}))}}window.applyFileLayout=function(o){if(!o)return;o.querySelectorAll(".formio-component-file .fileSelector").forEach(l=>{l.classList.add("premium-dropzone")}),o.querySelectorAll(".formio-component-file").forEach(l=>{k(l),l._hasSafeObserver||(l._hasSafeObserver=new MutationObserver(y=>{let e=!1;for(let n of y){const a=l.querySelector('[ref="messageContainer"]');if(!(a&&a.contains(n.target))){if(n.addedNodes.length>0||n.removedNodes.length>0){e=!0;break}if(n.type==="attributes"&&!["class","style"].includes(n.attributeName)){e=!0;break}}}e&&k(l)}),l._hasSafeObserver.observe(l,{childList:!0,subtree:!0,attributes:!0}))})}})();</script>
39007
+ <script>(function(){function k(o){logger.info(`[TF_SDK:35] \u2705 Processing component: ${o.getAttribute("ref")||o.id}`);const q=!o.querySelector("ul"),E=o.querySelector("ul.list-group, div:not(.fileSelector):not(.formio-errors):not(.mb-2):not(.formio-errors)"),c=E?Array.from(E.children).filter(e=>["DIV","LI"].includes(e.nodeName)):[];c.forEach(e=>{if(!(e.classList.contains("formio-errors")||e.classList.contains("list-group-header"))){if(q){let n="";if(!e.querySelector(".file-preview-wrapper")&&!e.querySelector('[ref="fileImage"]')){const s=e.textContent.toLowerCase(),t=e.querySelector("a"),m=/\.(jpg|jpeg|png|gif|webp|svg)$/i;if(m.test(s)||t&&m.test(t.href)||e.querySelector("img.file-image")){const C=e.querySelector("img.file-image");if(C&&C.src?n=C.src:(t&&t.href&&m.test(t.href)||t&&t.href&&t.href.startsWith("data:image"))&&(n=t.href),n){const d=document.createElement("div");d.className="file-preview-wrapper";const v=document.createElement("img");v.src=n,v.className="file-preview-img",d.appendChild(v),e.firstChild?e.insertBefore(d,e.firstChild):e.appendChild(d)}}}if(!n){const s=e.querySelector('.file-preview-img, [ref="fileImage"]');if(s&&s.src)n=s.src;else{const t=e.querySelector("a"),m=/\.(jpg|jpeg|png|gif|webp|svg)$/i;t&&t.href&&(m.test(t.href)||t.href.startsWith("data:image"))&&(n=t.href)}}const a=[{class:"bi bi-eye",title:"Preview"},{class:"bi bi-pencil",title:"Edit"}];e.querySelectorAll('[ref="removeLink"]').forEach(s=>{if(s.closest(".file-actions-wrapper"))return;const t=document.createElement("div");t.className="file-actions-wrapper custom-scrollbar",s.after(t),s.className="action-item remove-action",s.innerHTML='<i class="bi bi-trash-fill"></i>',t.appendChild(s),a.forEach(m=>{const b=document.createElement("div");b.className="action-item",b.setAttribute("title",m.title),b.innerHTML=`<i class="${m.class}"></i>`,t.appendChild(b),b.addEventListener("click",C=>{var A,L;C.preventDefault(),C.stopPropagation();let d="";const v=e.querySelector('.file-preview-img, [ref="fileImage"]');if(v&&v.src)d=v.src;else{const r=e.querySelector("a"),i=/\.(jpg|jpeg|png|gif|webp|svg)$/i;r&&r.href&&(i.test(r.href)||r.href.startsWith("data:image"))&&(d=r.href)}if(m.title==="Preview"&&d&&typeof window.openImagePreviewModal=="function"){const r=((L=(A=e.querySelector("a"))==null?void 0:A.textContent)==null?void 0:L.trim())||"File Preview";window.openImagePreviewModal(d,r);return}if(m.title==="Edit"&&d&&typeof cropro!="undefined"){const r=new Image;r.src=d,r.style.position="fixed",r.style.visibility="hidden",r.style.pointerEvents="none",document.body.appendChild(r),r.onload=()=>{const i=new cropro.CropArea(r);if(i.displayMode="popup",i.renderImageType="image/jpeg",i.renderImageQuality=.8,i.renderAtNaturalSize=!0,i.popupMargin=60,i.styles&&i.styles.settings&&o.closest(".tf-embed-sdk")){const h=getComputedStyle(o);let p=h.getPropertyValue("--tf-primary-color").trim(),f=h.getPropertyValue("--tf-secondary-color").trim(),u=h.getPropertyValue("--tf-app-bg-color").trim();window.__unviredThemeData&&(p=p||window.__unviredThemeData.primaryColor,f=f||window.__unviredThemeData.secondaryColor,u=u||window.__unviredThemeData.backgroundColor),p=p||"#2586c7",f=f||"white",u=u||"white",i.styles.settings.toolbarBackgroundColor=u,i.styles.settings.toolbarBackgroundHoverColor=u,i.styles.settings.toolbarBackgroundActiveColor=u,i.styles.settings.toolbarColor=p,i.styles.settings.cropFrameColor=p,i.styles.settings.gripColor=p,i.styles.settings.gripFillColor=f}i.addRenderEventListener(async h=>{logger.info("[TF_SDK:35a] \u{1F3A8} Crop render event fired");const p=e.querySelector('.file-preview-img, [ref="fileImage"]');p&&(p.src=h);const f=o.componentInstance||o.component,u=c.indexOf(e);let l=null;f&&Array.isArray(f.dataValue)&&(l=f.dataValue[u]);const w=l?l.id||l.uid||l._id:null,D=l?l.originalName||l.name:"edited_image.jpg";for(var F=h.split(","),P=(F[0].match(/:(.*?);/)||[])[1]||"image/jpeg",T=atob(F[1]),I=T.length,N=new Uint8Array(I);I--;)N[I]=T.charCodeAt(I);let S=new Blob([N],{type:P});if(S.name=D,logger.info(`[TF_SDK:36] \u{1F4BE} Custom Renderer: User clicked Crop Save (\u2713)! Base64 DataURL length=${h.length}`),typeof imageCompression=="function"&&P.startsWith("image/"))try{const g={maxSizeMB:.2,maxWidthOrHeight:1600,initialQuality:.8,useWebWorker:!0},_=await imageCompression(S,g);_.name=D,logger.info(`[TF_SDK:37] \u26A1 Compressed cropped image: ${S.size} -> ${_.size} bytes`),S=_}catch(g){logger.warn("[TF_SDK:37a] \u26A0\uFE0F Compression skipped/failed:",g)}w&&typeof window.updateFileInIndexedDB=="function"?(logger.info(`[TF_SDK:38] \u{1F4BE} Custom Renderer: Calling updateFileInIndexedDB for id: ${w}`),window.updateFileInIndexedDB(w,S,D).then(g=>{logger.info("[TF_SDK:38a] \u2705 Custom Renderer: IndexedDB replacement successful, old id:",w,"new id:",g.id),l&&(l.id=g.id,l.uid=g.id,l.url=g.url,l.size=g.size,l.mode=g.mode||"A"),f&&typeof f.triggerChange=="function"&&f.triggerChange({modified:!0})}).catch(g=>{logger.error("[TF_SDK:38b] \u274C Custom Renderer: IndexedDB update failed:",g)})):logger.warn("[TF_SDK:38c] \u26A0\uFE0F Cannot update IndexedDB: existingId missing or updateFileInIndexedDB function not available");const j=new CustomEvent("formio-file-updated",{detail:{element:o,row:e,dataUrl:h},bubbles:!0});o.dispatchEvent(j),document.body.removeChild(r)}),i.addCloseEventListener(()=>{r.parentNode&&document.body.removeChild(r)}),i.show()};return}const B=new CustomEvent("formio-file-action",{detail:{element:o,icon:m,row:e,imgSrc:d},bubbles:!0});b.dispatchEvent(B)})})})}e.classList.add("layout-processed"),e.style.setProperty("opacity","1","important"),e.style.visibility="visible"}});const y=o.querySelector('[ref="messageContainer"]');if(y){const e=Array.from(o.querySelectorAll(".status.text-danger, .alert-danger")).filter(a=>!y.contains(a));y.querySelectorAll(".cloned-err").forEach(a=>a.remove()),e.length>0&&(y.classList.add("d-block"),y.style.display="block",e.forEach(a=>{const x=a.textContent.toLowerCase();if(x.includes("already uploaded")||x.includes("already being uploaded")){a.style.setProperty("display","none","important");return}const s=a.cloneNode(!0);s.classList.add("cloned-err"),s.style.setProperty("display","block","important"),y.appendChild(s),a.style.setProperty("display","none","important")}))}}window.applyFileLayout=function(o){if(!o)return;o.querySelectorAll(".formio-component-file .fileSelector").forEach(c=>{c.classList.add("premium-dropzone")}),o.querySelectorAll(".formio-component-file").forEach(c=>{k(c),c._hasSafeObserver||(c._hasSafeObserver=new MutationObserver(y=>{let e=!1;for(let n of y){const a=c.querySelector('[ref="messageContainer"]');if(!(a&&a.contains(n.target))){if(n.addedNodes.length>0||n.removedNodes.length>0){e=!0;break}if(n.type==="attributes"&&!["class","style"].includes(n.attributeName)){e=!0;break}}}e&&k(c)}),c._hasSafeObserver.observe(c,{childList:!0,subtree:!0,attributes:!0}))})}})();</script>
38470
39008
  <script>(function(){window.prepareFloating=o=>{!o||!Array.isArray(o)||o.forEach(e=>{if((["textfield","email","number","password","phoneNumber","textarea","datetime","dateTime","day","currency","time","barcode","location","barcodeselect","url","website","smartId","bio"].includes(e.type)||e.type==="select")&&(e.placeholder||(e.placeholder=" ")),(e.type==="htmlelement"||e.type==="content")&&e.content){let t=e.content;if(t.includes("<body")){const r=t.match(/<body[^>]*>([\s\S]*)<\/body>/i);r&&r[1]&&(t=r[1].trim())}t=t.replace(/<!DOCTYPE[^>]*>/gi,"").replace(/<\/?html[^>]*>/gi,"").replace(/<\/?head[^>]*>/gi,"").replace(/<\/?meta[^>]*>/gi,""),e.content=t.trim(),e.tag==="p"&&(t.includes("<div")||t.includes("<h")||t.includes("<p")||t.includes("<table"))&&(e.tag="div")}e.components&&Array.isArray(e.components)&&prepareFloating(e.components),e.pages&&Array.isArray(e.pages)&&prepareFloating(e.pages),e.rows&&Array.isArray(e.rows)&&e.rows.forEach(t=>{Array.isArray(t)&&t.forEach(r=>{r&&r.components&&prepareFloating(r.components)})}),e.columns&&Array.isArray(e.columns)&&e.columns.forEach(t=>{t&&t.components&&prepareFloating(t.components)})})},window.applyFloatingLabelsLayout=function(o){if(!o)return;o.querySelectorAll(".formio-component-time").forEach(t=>{t.querySelectorAll('input[type="time"]').forEach(a=>{const i=()=>{a.value&&a.value.trim()!==""?t.classList.add("has-value"):t.classList.remove("has-value")};a.addEventListener("change",i),a.addEventListener("input",i),i()})}),o.querySelectorAll(".formio-component-address").forEach(t=>{t.querySelectorAll('input[type="text"]').forEach(a=>{(!a.getAttribute("placeholder")||a.getAttribute("placeholder")==="")&&a.setAttribute("placeholder"," ")})})}})();</script>
38471
39009
  <script>(function(){window.applyColumnLayout=function(l){if(!l)return;l.querySelectorAll(".formio-component-columns").forEach(e=>{e.style.display="flex",e.style.flexWrap="wrap",e.style.marginRight="-15px",e.style.marginLeft="-15px",e.querySelectorAll(':scope > [class*="col-"]').forEach((t,s)=>{t.style.paddingLeft="15px",t.style.paddingRight="15px",window.innerWidth<992?t.style.marginBottom="1.5rem":t.style.marginBottom="0"})})}})();</script>
38472
39010
  <script>(function(){window.applyLocationLayout=n=>{if(n&&n.Components&&n.Components.components){const o=n,{textfield:e}=o.Components.components;!o.Components.components.location&&e&&o.Components.addComponent("location",e);return}const i=n;if(!i||!i.querySelectorAll)return;i.querySelectorAll(".formio-component-location").forEach(o=>{const e=o.querySelector('[ref="element"]');if(e&&!e.querySelector(".location-custom-icon")){const t=document.createElement("span");t.className="location-custom-icon bi bi-geo-alt-fill",t.title="Fetch Location",t.setAttribute("role","button"),t.setAttribute("aria-label","Get current location"),t.addEventListener("click",l=>{l.preventDefault(),l.stopPropagation(),t.style.opacity="0.5",setTimeout(()=>t.style.opacity="1",200),logger.info("[TF_SDK:36] \u2705 Location Icon Clicked!");const c=o.querySelector("input"),a=c?c.id:o.id;logger.info("[TF_SDK:37] \u2705 Dispatching getLocation for:",a);const r=new CustomEvent("getLocation",{detail:{compObj:o,controlId:a}});document.dispatchEvent(r),c&&c.focus()}),e.prepend(t)}})}})();</script>
38473
39011
  <script>(function(){function h(){var d,r,i,o;const s=window.firstName||((d=window.form)==null?void 0:d.firstName)||((r=window.FORM_USER_DATA)==null?void 0:r.firstName)||"",u=window.lastName||((i=window.form)==null?void 0:i.lastName)||((o=window.FORM_USER_DATA)==null?void 0:o.lastName)||"";return`${s} ${u}`.trim()||"Signer"}const S="cursive";window.applySignatureLayout=function(s){if(!s||!s.components)return;const u=new WeakMap,f=t=>t.querySelector(".signature-click-hint"),d=t=>{const e=document.createElement("span");return e.className="signature-click-hint",e.style.pointerEvents="none",e.innerHTML='Sign Here<br>Or<br><span class="signature-click-action" role="button" tabindex="0">Click To Sign</span>',t.appendChild(e),e},r=t=>{let e=f(t);e||(e=d(t)),e.style.display="inline-flex",e.style.opacity="1",e.style.pointerEvents="none"},i=t=>{const e=f(t);!e||e.style.display==="none"||(e.style.opacity="0",setTimeout(()=>{e.style.opacity==="0"&&(e.style.display="none")},420))},o=t=>{const e=t.dataValue;return!!(e&&typeof e=="string"&&e.length>10)};s.everyComponent(t=>{if(t.type!=="signature")return;const e=t.element;if(!e)return;const n=e.querySelector(".signature-pad-body");if(!n||n.dataset.sigBound==="true")return;n.dataset.sigBound="true";const a=e.querySelector(".signature-pad-canvas"),l=n.querySelector(".signature-pad-refresh");l&&l.classList.remove("btn","btn-sm","btn-light");const g={hasDrawn:o(t)};u.set(n,g),t.options&&t.options.readOnly||g.hasDrawn?i(n):r(n);let y=0;const w=c=>{if(!(c.target&&c.target.closest?c.target.closest(".signature-click-action"):null)||t.options&&t.options.readOnly)return;const p=Date.now();p-y<300||(y=p,c.cancelable&&c.preventDefault(),typeof t.drawSignatureFromName=="function"?(t.drawSignatureFromName(),i(n)):t.refs&&t.refs.clicktoSign&&(t.refs.clicktoSign.click(),i(n)))};n.addEventListener("click",w),n.addEventListener("touchend",w,{passive:!1}),a&&(a.addEventListener("pointerdown",()=>{i(n)}),a.addEventListener("mousedown",()=>i(n)),a.addEventListener("touchstart",()=>i(n),{passive:!0})),l&&l.addEventListener("click",()=>{g.hasDrawn=!1,setTimeout(()=>r(n),50)})}),s._sigHintListenerBound||(s._sigHintListenerBound=!0,s.on("change",()=>{setTimeout(()=>{s.everyComponent(t=>{if(t.type!=="signature")return;const e=t.element;if(!e)return;const n=e.querySelector(".signature-pad-body");if(!n)return;const a=u.get(n);if(!a)return;o(t)?(a.hasDrawn=!0,i(n)):a.hasDrawn||r(n)})},100)}))}})();</script>
38474
39012
  <script>(function(){window.applySurveyLayout=function(r){r.querySelectorAll(".formio-component-survey table").forEach(t=>{const i=Array.from(t.querySelectorAll("thead th")).map(l=>l.innerText.trim());t.querySelectorAll("tbody tr").forEach(l=>{l.querySelectorAll("td").forEach((n,o)=>{o>0&&i[o]&&n.setAttribute("data-label",i[o])})})})},window.prepareSurvey=function(r){!window.Formio||!window.Formio.Utils||window.Formio.Utils.eachComponent(r,function(e){if(e.type==="survey"&&e.validate&&e.validate.required){const t=e.label||"This field";e.validate.custom=`var keys = Object.keys(input || {}); valid = (keys.length === 0 || keys.length >= component.questions.length) ? true : '${t} requires you to fill all fields.';`}})}})();</script>
38475
- <script>(function(){window.applyTabsLayout=function(i){if(!i)return;i.querySelectorAll(".formio-component-tabs").forEach(c=>{if(c.dataset.tabsPatched==="true")return;const o=c.querySelectorAll(":scope > .card > .card-header .nav-item"),n=c.querySelectorAll(":scope > .card > .card-header .nav-link"),l=c.querySelectorAll(":scope > .card > .tab-pane");if(!n.length||!l.length)return;const d=e=>{o.forEach((t,a)=>{t.classList.toggle("active",a===e),t.setAttribute("role","tab")}),n.forEach((t,a)=>{const s=a===e;t.classList.toggle("active",s),t.setAttribute("aria-selected",s?"true":"false"),s?t.setAttribute("tabindex","0"):t.setAttribute("tabindex","-1")}),l.forEach((t,a)=>{const s=a===e;t.classList.toggle("active",s),t.style.display=s?"block":"none"}),window.dispatchEvent(new Event("resize"))};n.forEach((e,t)=>{e.addEventListener("click",a=>{a.preventDefault(),d(t)})});let r=Array.from(n).findIndex(e=>e.classList.contains("active"));r<0&&(r=Array.from(o).findIndex(e=>e.classList.contains("active"))),r<0&&(r=0),d(r),c.dataset.tabsPatched="true"})}})();</script>
39013
+ <script>(function(){window.applyTabsLayout=function(B){if(!B)return;B.querySelectorAll(".formio-component-tabs").forEach(A=>{if(A.dataset.tabsPatched==="true")return;const s=A.querySelector(":scope > .card");if(!s)return;const a=s.querySelector(":scope > .card-header"),m=a?a.querySelectorAll(".nav-item"):[],y=a?a.querySelectorAll(".nav-link"):[],x=s.querySelectorAll(":scope > .tab-pane");if(!y.length||!x.length)return;const E=s.classList.contains("card-vertical")||a&&a.querySelector(".nav-tabs-vertical"),o=a?a.querySelector(".tab-component-tabs")||a.querySelector(".nav-tabs"):null;let d=s.querySelector(".tf-tabs-mobile-bar, .tf-vertical-tabs-mobile-bar");d||(d=document.createElement("div"),d.className="tf-tabs-mobile-bar tf-vertical-tabs-mobile-bar",d.innerHTML=`
39014
+ <button type="button" class="tf-tabs-toggle tf-vertical-tabs-toggle" aria-label="Select tab" aria-expanded="false">
39015
+ <span class="tf-tabs-toggle-icon tf-vertical-tabs-toggle-icon">
39016
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
39017
+ <line x1="3" y1="12" x2="21" y2="12"></line>
39018
+ <line x1="3" y1="6" x2="21" y2="6"></line>
39019
+ <line x1="3" y1="18" x2="21" y2="18"></line>
39020
+ </svg>
39021
+ </span>
39022
+ <span class="tf-tabs-current-title tf-vertical-tabs-current-title"></span>
39023
+ <span class="tf-tabs-toggle-arrow tf-vertical-tabs-toggle-arrow">
39024
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
39025
+ <polyline points="6 9 12 15 18 9"></polyline>
39026
+ </svg>
39027
+ </span>
39028
+ </button>
39029
+ `,a?s.insertBefore(d,a):s.insertBefore(d,s.firstChild));let u=s.querySelector(".tf-tabs-backdrop, .tf-vertical-tabs-backdrop");u||(u=document.createElement("div"),u.className="tf-tabs-backdrop tf-vertical-tabs-backdrop",s.appendChild(u));const q=d.querySelector(".tf-tabs-current-title, .tf-vertical-tabs-current-title"),f=d.querySelector(".tf-tabs-toggle, .tf-vertical-tabs-toggle"),w=()=>{s.classList.remove("tf-tabs-overlay-open"),f&&f.setAttribute("aria-expanded","false")},W=t=>{t.stopPropagation();const e=s.classList.toggle("tf-tabs-overlay-open");f&&f.setAttribute("aria-expanded",e?"true":"false")};f&&!f.dataset.bound&&(f.addEventListener("click",W),f.dataset.bound="true"),u&&!u.dataset.bound&&(u.addEventListener("click",t=>{t.stopPropagation(),w()}),u.dataset.bound="true"),s.dataset.overlayListenerBound||(document.addEventListener("click",t=>{s.classList.contains("tf-tabs-overlay-open")&&!s.contains(t.target)&&w()}),s.dataset.overlayListenerBound="true");let L=()=>{};if(!E&&a&&o){let t=a.querySelector(".tf-tabs-scroll-left"),e=a.querySelector(".tf-tabs-scroll-right");t||(t=document.createElement("button"),t.type="button",t.className="tf-tabs-scroll-btn tf-tabs-scroll-left",t.setAttribute("aria-label","Scroll tabs left"),t.innerHTML=`
39030
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
39031
+ <polyline points="15 18 9 12 15 6"></polyline>
39032
+ </svg>
39033
+ `,a.insertBefore(t,o)),e||(e=document.createElement("button"),e.type="button",e.className="tf-tabs-scroll-btn tf-tabs-scroll-right",e.setAttribute("aria-label","Scroll tabs right"),e.innerHTML=`
39034
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
39035
+ <polyline points="9 18 15 12 9 6"></polyline>
39036
+ </svg>
39037
+ `,a.appendChild(e));let i=null,h=null,l=null,n=null;L=()=>{if(window.innerWidth<=768){i!==!0&&(t.classList.add("tf-scroll-hidden"),e.classList.add("tf-scroll-hidden"),i=!0,h=!0);return}const c=o.scrollWidth-o.clientWidth,p=c<=2;if(i!==p&&(t.classList.toggle("tf-scroll-hidden",p),e.classList.toggle("tf-scroll-hidden",p),i=p,h=p),!p){const D=o.scrollLeft,k=D<=2,S=D>=c-2;l!==k&&(t.classList.toggle("tf-scroll-disabled",k),k?t.setAttribute("disabled","true"):t.removeAttribute("disabled"),l=k),n!==S&&(e.classList.toggle("tf-scroll-disabled",S),S?e.setAttribute("disabled","true"):e.removeAttribute("disabled"),n=S)}};let r=null;const b=()=>{r&&cancelAnimationFrame(r),r=requestAnimationFrame(L)};t.dataset.bound||(t.addEventListener("click",c=>{c.preventDefault(),o.scrollBy({left:-220,behavior:"smooth"})}),t.dataset.bound="true"),e.dataset.bound||(e.addEventListener("click",c=>{c.preventDefault(),o.scrollBy({left:220,behavior:"smooth"})}),e.dataset.bound="true"),o.dataset.scrollBound||(o.addEventListener("scroll",b,{passive:!0}),o.dataset.scrollBound="true"),s.dataset.resizeBound||(window.addEventListener("resize",b),s.dataset.resizeBound="true"),setTimeout(L,50)}let T=-1,v=null;const C=(t,e=!1)=>{if(t===T&&!e)return;let i="";m.forEach((l,n)=>{l.classList.toggle("active",n===t),l.setAttribute("role","tab")}),y.forEach((l,n)=>{const r=n===t;l.classList.toggle("active",r),l.setAttribute("aria-selected",r?"true":"false"),r?(l.setAttribute("tabindex","0"),i=l.textContent.trim()):l.setAttribute("tabindex","-1")}),q&&i&&(q.textContent=i),w();const h=()=>{if(T=t,x.forEach((l,n)=>{const r=n===t;l.classList.toggle("active",r),l.style.display=r?"block":"none"}),!E&&o&&m[t])try{const l=m[t],n=o.scrollLeft,r=o.clientWidth,b=l.offsetLeft,c=l.offsetWidth;b<n?o.scrollTo({left:Math.max(0,b-20),behavior:"auto"}):b+c>n+r&&o.scrollTo({left:b+c-r+20,behavior:"auto"})}catch(l){}L()};e?(v&&(clearTimeout(v),v=null),h()):(v&&clearTimeout(v),v=setTimeout(h,50))};y.forEach((t,e)=>{t.addEventListener("click",i=>{i.preventDefault(),i.stopPropagation(),i.stopImmediatePropagation(),C(e)},!0)});let g=Array.from(y).findIndex(t=>t.classList.contains("active"));g<0&&(g=Array.from(m).findIndex(t=>t.classList.contains("active"))),g<0&&(g=0),C(g,!0),A.dataset.tabsPatched="true"})}})();</script>
38476
39038
 
38477
39039
  <script>(function(){window.applyDayLayout=function(s){if(!s)return;s.querySelectorAll(".formio-component-day").forEach(l=>{l.querySelectorAll("input, select").forEach(e=>{if(e.classList.contains("formio-select-autocomplete-input"))return;if(e.tagName==="SELECT"){const t=e.options[0];t&&(t.value===""||!t.value)&&(t.textContent=" ")}(!e.getAttribute("placeholder")||e.getAttribute("placeholder")==="")&&e.setAttribute("placeholder"," ");const o=()=>{const t=e.closest('[class*="col-"]');if(!t)return;const a=e.value;a!=null&&a.toString().trim()!==""?t.classList.add("has-value"):t.classList.remove("has-value")};e.addEventListener("change",o),e.addEventListener("input",o),o()}),l.classList.add("day-layout-ready")})}})();</script>
38478
39040
  <script>(function(){window.initializeTooltips=r=>{if(!window.tippy)return;if(!window.tippyDelegate){window.tippyDelegate=tippy.delegate(document.body,{target:'[data-tooltip], [data-content], [ref="tooltip"], [data-tippy-content]',trigger:"click",hideOnClick:!1,interactive:!0,touch:!0,appendTo:()=>document.body,boundary:"viewport",flipOnUpdate:!0,maxWidth:350,onShow(t){window.tippyDelegate&&window.tippyDelegate.instances&&window.tippyDelegate.instances.forEach(o=>{o!==t&&o.hide()}),t.reference.setAttribute("aria-expanded","true");const e=t.reference.getAttribute("data-tooltip")||t.reference.getAttribute("data-content")||t.reference.getAttribute("title");e&&t.setContent(e)},onHide(t){t.reference.setAttribute("aria-expanded","false")}}),document.body.addEventListener("click",t=>{!t.target.closest('[ref="tooltip"], .bi-question-circle')&&window.tippyDelegate&&window.tippyDelegate.instances&&window.tippyDelegate.instances.forEach(o=>o.hide())});const i=t=>{const e=t.target.closest('[ref="tooltip"], .bi-question-circle');e&&(t.stopPropagation(),(t.type==="touchstart"||t.type==="touchend"||e.closest("label"))&&t.cancelable&&t.preventDefault())};document.body.addEventListener("click",i,!0),document.body.addEventListener("touchstart",i,{capture:!0,passive:!1}),document.body.addEventListener("touchend",i,{capture:!0,passive:!1})}[].slice.call((r||document).querySelectorAll('[data-tooltip], [data-content], [ref="tooltip"]')).forEach(i=>i.removeAttribute("title"))}})();</script>
38479
39041
  <script>(function(){const t=i=>{(i||document).querySelectorAll(".formio-component-bio").forEach(e=>{const o=e.querySelector(".ck-editor__editable");o&&(o.addEventListener("focus",()=>{e.classList.add("is-focused")}),o.addEventListener("blur",()=>{e.classList.remove("is-focused")}))})};typeof themeHook!="undefined"&&themeHook.register("bio",t)})();</script>
38480
- <script>(function(){window.applyWizardLayout=r=>{if(!r)return;const t=r.querySelector(".breadcrumb")||r.querySelector(".pagination");if(!t)return;const a=Array.from(t.querySelectorAll(".breadcrumb-item, .page-item"));let s=!1;a.forEach(e=>{e.classList.contains("active")?(s=!0,e.classList.remove("completed")):s?e.classList.remove("completed"):e.classList.add("completed")})}})();</script>
38481
- <script>(function(){const c=t=>{if(typeof prepareFloating!="function"||!t)return;t.schema&&(t.schema.components||t.schema.pages)&&prepareFloating(t.schema.components||t.schema.pages||[]);const a=["textfield","email","number","password","phoneNumber","textarea","datetime","dateTime","day","currency","time","barcode","location","barcodeselect","url","website","smartId"];t.everyComponent(n=>{n.component&&a.includes(n.component.type)&&(n.component.placeholder||(n.component.placeholder=" "),n.input&&(Array.isArray(n.input)?n.input:[n.input]).forEach(e=>{e&&(e.placeholder===void 0||e.placeholder==="")&&(e.placeholder=" ")})),n.subForm&&c(n.subForm)})},y=t=>{if(!t||!t.element)return;const a=t.element;c(t),typeof applyCheckboxLayout=="function"&&applyCheckboxLayout(a),typeof applyTableLayout=="function"&&applyTableLayout(a),typeof applySurveyLayout=="function"&&applySurveyLayout(a),typeof applyLocationLayout=="function"&&applyLocationLayout(a),typeof applyTabsLayout=="function"&&applyTabsLayout(a),typeof applyColumnLayout=="function"&&applyColumnLayout(a),typeof applyFloatingLabelsLayout=="function"&&applyFloatingLabelsLayout(a),typeof applyBarcodeLayout=="function"&&applyBarcodeLayout(a),typeof applyFileLayout=="function"&&applyFileLayout(a),typeof applyDayLayout=="function"&&applyDayLayout(a),typeof applySignatureLayout=="function"&&applySignatureLayout(t),typeof applyWizardLayout=="function"&&applyWizardLayout(a),typeof initializeTooltips=="function"&&initializeTooltips(a)},f=()=>{const t=window.Formio;if(!t)return setTimeout(f,100);if(!t._themeIntegrated){if(t._themeIntegrated=!0,t.icons="bi",t.Templates.framework="bootstrap5",typeof applyBarcodeLayout=="function"&&applyBarcodeLayout(t),typeof applyLocationLayout=="function"&&applyLocationLayout(t),t.Components&&t.Components.components){const{select:i}=t.Components.components;if(!t.Components.components.barcodeselect&&i)try{t.Components.addComponent("barcodeselect",i)}catch(e){logger.warn("[TF_SDK:39] \u26A0\uFE0F Could not add barcodeselect component:",e)}}const a=i=>{!i||!Array.isArray(i)||i.forEach(e=>{(e.type==="datetime"||e.type==="day")&&(e.widget=e.widget||{type:"calendar"},e.widget.displayInModal=!1,e.widget.customOptions=e.widget.customOptions||{}),e.components&&Array.isArray(e.components)&&a(e.components),e.columns&&Array.isArray(e.columns)&&a(e.columns),e.rows&&Array.isArray(e.rows)&&e.rows.forEach(r=>{Array.isArray(r)&&r.forEach(o=>{o&&o.components&&a(o.components)})})})},n=t.createForm;t.createForm=async function(i,e,r={}){if(e&&(e.components||e.display)){const s=e.components||(e.display==="wizard"?e.components:[]);s.length>0&&typeof prepareFloating=="function"&&prepareFloating(s),s.length>0&&typeof prepareSurvey=="function"&&prepareSurvey(s),s.length>0&&a(s)}const o=await n.call(this,i,e,r);y(o);let l;const p=()=>{clearTimeout(l),l=setTimeout(()=>{y(o)},20)};return o.on("change",p),o.on("redraw",p),o.on("render",p),window.addEventListener("resize",p),logger.info("[TF_SDK:40] \u2705 Unvired Theme: Applied premium UI to form."),o},window._tfDialogObserver||(window._tfDialogObserver=new MutationObserver(i=>{i.forEach(e=>{e.addedNodes.forEach(r=>{if(r.nodeType===1){let o=null;if(r.classList&&r.classList.contains("formio-dialog")?o=r:typeof r.querySelector=="function"&&(o=r.querySelector(".formio-dialog")),o&&!o.classList.contains("tf-embed-sdk")){const l=document.querySelector(".tf-embed-sdk:not(.formio-dialog)");l&&(o.classList.add("tf-embed-sdk"),l.style&&l.style.cssText&&(o.style.cssText+=l.style.cssText))}}})})}),window._tfDialogObserver.observe(document.body,{childList:!0,subtree:!0}),document.querySelectorAll(".formio-dialog").forEach(i=>{const e=document.querySelector(".tf-embed-sdk:not(.formio-dialog)");!i.classList.contains("tf-embed-sdk")&&e&&(i.classList.add("tf-embed-sdk"),e.style&&e.style.cssText&&(i.style.cssText+=e.style.cssText))})),window._tfFlatpickrScrollFix||(window._tfFlatpickrScrollFix=!0,window.addEventListener("scroll",function(i){if(i.target&&i.target.classList&&i.target.classList.contains("flatpickr-calendar"))return;document.querySelectorAll(".flatpickr-calendar.open").length>0&&document.querySelectorAll(".flatpickr-input").forEach(o=>{o._flatpickr&&o._flatpickr.isOpen&&typeof o._flatpickr.close=="function"&&(o._flatpickr.close(),(document.activeElement===o||document.activeElement===o.nextSibling)&&document.activeElement.blur())})},{capture:!0,passive:!0})),logger.info("[TF_SDK:41] \u2705 Unvired Theme: Global Hook Active.")}};f()})();</script>
39042
+ <script>(function(){window.applyWizardLayout=r=>{if(!r)return;const t=r.querySelector(".breadcrumb")||r.querySelector(".pagination");if(!t)return;const c=Array.from(t.querySelectorAll(".breadcrumb-item, .page-item"));let s=!1;c.forEach(e=>{if(e.classList.contains("active")){s=!0,e.classList.remove("completed");try{e.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})}catch(o){}}else s?e.classList.remove("completed"):e.classList.add("completed")})}})();</script>
39043
+ <script>(function(){const c=t=>{if(typeof prepareFloating!="function"||!t)return;t.schema&&(t.schema.components||t.schema.pages)&&prepareFloating(t.schema.components||t.schema.pages||[]);const a=["textfield","email","number","password","phoneNumber","textarea","datetime","dateTime","day","currency","time","barcode","location","barcodeselect","url","website","smartId"];t.everyComponent(n=>{n.component&&a.includes(n.component.type)&&(n.component.placeholder||(n.component.placeholder=" "),n.input&&(Array.isArray(n.input)?n.input:[n.input]).forEach(e=>{e&&(e.placeholder===void 0||e.placeholder==="")&&(e.placeholder=" ")})),n.subForm&&c(n.subForm)})},y=t=>{if(!t||!t.element)return;const a=t.element;c(t),typeof applyCheckboxLayout=="function"&&applyCheckboxLayout(a),typeof applyTableLayout=="function"&&applyTableLayout(a),typeof applySurveyLayout=="function"&&applySurveyLayout(a),typeof applyLocationLayout=="function"&&applyLocationLayout(a),typeof applyTabsLayout=="function"&&applyTabsLayout(a),typeof applyColumnLayout=="function"&&applyColumnLayout(a),typeof applyFloatingLabelsLayout=="function"&&applyFloatingLabelsLayout(a),typeof applyBarcodeLayout=="function"&&applyBarcodeLayout(a),typeof applyFileLayout=="function"&&applyFileLayout(a),typeof applyDayLayout=="function"&&applyDayLayout(a),typeof applySignatureLayout=="function"&&applySignatureLayout(t),typeof applyWizardLayout=="function"&&applyWizardLayout(a),typeof initializeTooltips=="function"&&initializeTooltips(a)},f=()=>{const t=window.Formio;if(!t)return setTimeout(f,100);if(!t._themeIntegrated){if(t._themeIntegrated=!0,t.icons="bi",t.Templates.framework="bootstrap5",typeof applyBarcodeLayout=="function"&&applyBarcodeLayout(t),typeof applyLocationLayout=="function"&&applyLocationLayout(t),t.Components&&t.Components.components){const{select:i}=t.Components.components;if(!t.Components.components.barcodeselect&&i)try{t.Components.addComponent("barcodeselect",i)}catch(e){logger.warn("[TF_SDK:39] \u26A0\uFE0F Could not add barcodeselect component:",e)}}const a=i=>{!i||!Array.isArray(i)||i.forEach(e=>{(e.type==="datetime"||e.type==="day")&&(e.widget=e.widget||{type:"calendar"},e.widget.displayInModal=!1,e.widget.customOptions=e.widget.customOptions||{}),e.components&&Array.isArray(e.components)&&a(e.components),e.columns&&Array.isArray(e.columns)&&a(e.columns),e.rows&&Array.isArray(e.rows)&&e.rows.forEach(r=>{Array.isArray(r)&&r.forEach(o=>{o&&o.components&&a(o.components)})})})},n=t.createForm;t.createForm=async function(i,e,r={}){if(e&&(e.components||e.display)){const s=e.components||(e.display==="wizard"?e.components:[]);s.length>0&&typeof prepareFloating=="function"&&prepareFloating(s),s.length>0&&typeof prepareSurvey=="function"&&prepareSurvey(s),s.length>0&&a(s)}const o=await n.call(this,i,e,r);y(o);let l;const p=()=>{clearTimeout(l),l=setTimeout(()=>{y(o)},100)};return o.on("change",p),o.on("redraw",p),o.on("render",p),window.addEventListener("resize",p),logger.info("[TF_SDK:40] \u2705 Unvired Theme: Applied premium UI to form."),o},window._tfDialogObserver||(window._tfDialogObserver=new MutationObserver(i=>{i.forEach(e=>{e.addedNodes.forEach(r=>{if(r.nodeType===1){let o=null;if(r.classList&&r.classList.contains("formio-dialog")?o=r:typeof r.querySelector=="function"&&(o=r.querySelector(".formio-dialog")),o&&!o.classList.contains("tf-embed-sdk")){const l=document.querySelector(".tf-embed-sdk:not(.formio-dialog)");l&&(o.classList.add("tf-embed-sdk"),l.style&&l.style.cssText&&(o.style.cssText+=l.style.cssText))}}})})}),window._tfDialogObserver.observe(document.body,{childList:!0,subtree:!0}),document.querySelectorAll(".formio-dialog").forEach(i=>{const e=document.querySelector(".tf-embed-sdk:not(.formio-dialog)");!i.classList.contains("tf-embed-sdk")&&e&&(i.classList.add("tf-embed-sdk"),e.style&&e.style.cssText&&(i.style.cssText+=e.style.cssText))})),window._tfFlatpickrScrollFix||(window._tfFlatpickrScrollFix=!0,window.addEventListener("scroll",function(i){if(i.target&&i.target.classList&&i.target.classList.contains("flatpickr-calendar"))return;document.querySelectorAll(".flatpickr-calendar.open").length>0&&document.querySelectorAll(".flatpickr-input").forEach(o=>{o._flatpickr&&o._flatpickr.isOpen&&typeof o._flatpickr.close=="function"&&(o._flatpickr.close(),(document.activeElement===o||document.activeElement===o.nextSibling)&&document.activeElement.blur())})},{capture:!0,passive:!0})),logger.info("[TF_SDK:41] \u2705 Unvired Theme: Global Hook Active.")}};f()})();</script>
38482
39044
 
38483
39045
  </head>
38484
39046
 
@@ -38527,7 +39089,7 @@ Expecting `+b.join(", ")+", got '"+(this.terminals_[y]||y)+"'":x="Parse error on
38527
39089
 
38528
39090
 
38529
39091
  <div id="sticky-footer" class="footer-hidden" style="display: none;">
38530
- <div class="build-version">SDK v2.0.81</div>
39092
+ <div class="build-version">SDK v2.0.83</div>
38531
39093
 
38532
39094
  <button class="footer-btn footer-btn-secondary" id="prevBtn" style="display:none" onclick="FormOnPrevious()">
38533
39095
  <i class="bi bi-chevron-left"></i> Previous