@chobantonov/jsonforms-react-extended-renderers 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +17 -2
- package/lib/AgGridControlRenderer.impl-BO-Z1x0Y.js +2 -0
- package/lib/AgGridControlRenderer.impl-BO-Z1x0Y.js.map +1 -0
- package/lib/AgGridControlRenderer.impl-BZS8_ocu.mjs +429 -0
- package/lib/AgGridControlRenderer.impl-BZS8_ocu.mjs.map +1 -0
- package/lib/DynamicJSXRenderer-Cyw40Kz0.js +2 -0
- package/lib/DynamicJSXRenderer-Cyw40Kz0.js.map +1 -0
- package/lib/DynamicJSXRenderer-DyB3ZpZV.mjs +109 -0
- package/lib/DynamicJSXRenderer-DyB3ZpZV.mjs.map +1 -0
- package/lib/MarkupLabelRenderer.impl-CWfdcUuH.mjs +12 -0
- package/lib/MarkupLabelRenderer.impl-CWfdcUuH.mjs.map +1 -0
- package/lib/MarkupLabelRenderer.impl-DnuzIPQg.js +2 -0
- package/lib/MarkupLabelRenderer.impl-DnuzIPQg.js.map +1 -0
- package/lib/MonacoControlRenderer.impl-BwgLGNMK.js +3 -0
- package/lib/MonacoControlRenderer.impl-BwgLGNMK.js.map +1 -0
- package/lib/MonacoControlRenderer.impl-CyjMHbOd.mjs +186 -0
- package/lib/MonacoControlRenderer.impl-CyjMHbOd.mjs.map +1 -0
- package/lib/RactiveTemplate-7L44A38e.js +2 -0
- package/lib/RactiveTemplate-7L44A38e.js.map +1 -0
- package/lib/RactiveTemplate-Cat7CxUp.mjs +74 -0
- package/lib/RactiveTemplate-Cat7CxUp.mjs.map +1 -0
- package/lib/ajv-localizers.cjs.js +2 -0
- package/lib/ajv-localizers.cjs.js.map +1 -0
- package/lib/ajv-localizers.esm.js +7 -0
- package/lib/ajv-localizers.esm.js.map +1 -0
- package/lib/ajvI18n-2UTyJv5g.js +2 -0
- package/lib/ajvI18n-2UTyJv5g.js.map +1 -0
- package/lib/ajvI18n-DO8FFvx1.mjs +227 -0
- package/lib/ajvI18n-DO8FFvx1.mjs.map +1 -0
- package/lib/celTemplate-Cl0alaCz.js +3 -0
- package/lib/celTemplate-Cl0alaCz.js.map +1 -0
- package/lib/celTemplate-D_AGhaIL.mjs +137 -0
- package/lib/celTemplate-D_AGhaIL.mjs.map +1 -0
- package/lib/components/DynamicJSXRenderer.d.ts +7 -0
- package/lib/components/ExtendedJsonForms.d.ts +80 -0
- package/lib/components/GenericAdditionalProperties.d.ts +4 -0
- package/lib/components/InterpolatedText.d.ts +34 -0
- package/lib/components/RactiveTemplate.d.ts +37 -0
- package/lib/components/editorRendererTypes.d.ts +139 -0
- package/lib/components/elementRender.d.ts +15 -0
- package/lib/configNamespaces-BFclHtB8.mjs +1 -0
- package/lib/configNamespaces-sboXDudL.js +1 -0
- package/lib/core/ajv.d.ts +82 -0
- package/lib/core/ajvI18n/bg.d.ts +2 -0
- package/lib/core/ajvI18n/index.d.ts +118 -0
- package/lib/core/ajvI18n/localizers.d.ts +20 -0
- package/lib/core/dynamicDefaults.d.ts +34 -0
- package/lib/core/keywords.d.ts +24 -0
- package/lib/core/transform.d.ts +29 -0
- package/lib/core/uiSchema.d.ts +48 -0
- package/lib/elementRender-Dbp2e-Cc.js +2 -0
- package/lib/elementRender-Dbp2e-Cc.js.map +1 -0
- package/lib/elementRender-y8MK9CCE.mjs +5 -0
- package/lib/elementRender-y8MK9CCE.mjs.map +1 -0
- package/lib/index.d.ts +41 -0
- package/lib/jsonforms-react-extended.cjs.js +16 -0
- package/lib/jsonforms-react-extended.cjs.js.map +1 -0
- package/lib/jsonforms-react-extended.esm.js +2335 -0
- package/lib/jsonforms-react-extended.esm.js.map +1 -0
- package/lib/locale/bg.d.ts +14 -0
- package/lib/markdown-C_y73Q0w.mjs +123 -0
- package/lib/markdown-C_y73Q0w.mjs.map +1 -0
- package/lib/markdown-CuqtpGVd.js +2 -0
- package/lib/markdown-CuqtpGVd.js.map +1 -0
- package/lib/objectWithoutProperties-6zedhz76.js +2 -0
- package/lib/objectWithoutProperties-6zedhz76.js.map +1 -0
- package/lib/objectWithoutProperties-yjQMyZ0y.mjs +58 -0
- package/lib/objectWithoutProperties-yjQMyZ0y.mjs.map +1 -0
- package/lib/renderers/AgGridControlRenderer.d.ts +10 -0
- package/lib/renderers/AgGridControlRenderer.impl.d.ts +4 -0
- package/lib/renderers/ButtonRenderer.d.ts +83 -0
- package/lib/renderers/GenericMixedRenderer.d.ts +9 -0
- package/lib/renderers/HorizontalLayoutRenderer.d.ts +5 -0
- package/lib/renderers/ImageViewRenderer.d.ts +48 -0
- package/lib/renderers/LinkRenderer.d.ts +23 -0
- package/lib/renderers/MarkupLabelRenderer.d.ts +35 -0
- package/lib/renderers/MarkupLabelRenderer.impl.d.ts +17 -0
- package/lib/renderers/MonacoControlRenderer.d.ts +8 -0
- package/lib/renderers/MonacoControlRenderer.impl.d.ts +4 -0
- package/lib/renderers/RactiveTemplateLayoutRenderer.d.ts +6 -0
- package/lib/renderers/SeparatorRenderer.d.ts +17 -0
- package/lib/renderers/SlotRenderer.d.ts +5 -0
- package/lib/renderers/SpacerRenderer.d.ts +5 -0
- package/lib/renderers/SplitLayoutRenderer.d.ts +18 -0
- package/lib/renderers/TemplateLayoutRenderer.d.ts +13 -0
- package/lib/renderers/TemplateRenderer.d.ts +17 -0
- package/lib/renderers/TsxTemplateLayoutRenderer.d.ts +111 -0
- package/lib/renderers/index.d.ts +13 -0
- package/lib/renderers/templateEngines.d.ts +43 -0
- package/lib/util/actionContext.d.ts +23 -0
- package/lib/util/additionalErrors.d.ts +77 -0
- package/lib/util/celEnvironment.d.ts +23 -0
- package/lib/util/celTemplate.d.ts +47 -0
- package/lib/util/childNames.d.ts +46 -0
- package/lib/util/configNamespaces.d.ts +1 -0
- package/lib/util/cron.d.ts +122 -0
- package/lib/util/editorControls.d.ts +8 -0
- package/lib/util/editorDiagnostics.d.ts +56 -0
- package/lib/util/extendedControls.d.ts +4 -0
- package/lib/util/extendedLocale.d.ts +32 -0
- package/lib/util/fileFilterValue.d.ts +3 -0
- package/lib/util/formContext.d.ts +54 -0
- package/lib/util/gridColumns.d.ts +6 -0
- package/lib/util/horizontalLayout.d.ts +10 -0
- package/lib/util/i18nDefaults.d.ts +45 -0
- package/lib/util/interpolate.d.ts +105 -0
- package/lib/util/labelFilterValue.d.ts +2 -0
- package/lib/util/lazyControl.d.ts +36 -0
- package/lib/util/lazyTemplate.d.ts +18 -0
- package/lib/util/markdown.d.ts +55 -0
- package/lib/util/markdownEscape.d.ts +27 -0
- package/lib/util/markup.d.ts +74 -0
- package/lib/util/maskControls.d.ts +2 -0
- package/lib/util/templateLang.d.ts +87 -0
- package/lib/util/templateUrls.d.ts +40 -0
- package/lib/util/urlPolicy.d.ts +42 -0
- package/lib/util/useCronPicker.d.ts +24 -0
- package/lib/util/useDurationControl.d.ts +99 -0
- package/lib/util/useEditorAppearance.d.ts +21 -0
- package/lib/util/useExtendedTranslator.d.ts +10 -0
- package/lib/util/useMonacoShadowStyles.d.ts +2 -0
- package/package.json +110 -3
- package/src/components/DynamicJSXRenderer.tsx +274 -0
- package/src/components/ExtendedJsonForms.tsx +329 -0
- package/src/components/GenericAdditionalProperties.tsx +362 -0
- package/src/components/InterpolatedText.tsx +114 -0
- package/src/components/RactiveTemplate.tsx +161 -0
- package/src/components/editorRendererTypes.ts +135 -0
- package/src/components/elementRender.ts +15 -0
- package/src/core/ajv.ts +177 -0
- package/src/core/ajvI18n/bg.ts +203 -0
- package/src/core/ajvI18n/index.ts +267 -0
- package/src/core/ajvI18n/localizers.ts +25 -0
- package/src/core/dynamicDefaults.ts +170 -0
- package/src/core/keywords.ts +71 -0
- package/src/core/transform.ts +137 -0
- package/src/core/uiSchema.ts +53 -0
- package/src/index.tsx +196 -0
- package/src/locale/bg.ts +51 -0
- package/src/renderers/AgGridControlRenderer.impl.tsx +788 -0
- package/src/renderers/AgGridControlRenderer.tsx +24 -0
- package/src/renderers/ButtonRenderer.tsx +328 -0
- package/src/renderers/GenericMixedRenderer.tsx +224 -0
- package/src/renderers/HorizontalLayoutRenderer.tsx +93 -0
- package/src/renderers/ImageViewRenderer.tsx +328 -0
- package/src/renderers/LinkRenderer.tsx +92 -0
- package/src/renderers/MarkupLabelRenderer.impl.tsx +26 -0
- package/src/renderers/MarkupLabelRenderer.tsx +327 -0
- package/src/renderers/MonacoControlRenderer.impl.tsx +351 -0
- package/src/renderers/MonacoControlRenderer.tsx +24 -0
- package/src/renderers/RactiveTemplateLayoutRenderer.tsx +172 -0
- package/src/renderers/SeparatorRenderer.tsx +55 -0
- package/src/renderers/SlotRenderer.tsx +34 -0
- package/src/renderers/SpacerRenderer.tsx +69 -0
- package/src/renderers/SplitLayoutRenderer.tsx +220 -0
- package/src/renderers/TemplateLayoutRenderer.tsx +394 -0
- package/src/renderers/TemplateRenderer.tsx +71 -0
- package/src/renderers/TsxTemplateLayoutRenderer.tsx +258 -0
- package/src/renderers/index.ts +14 -0
- package/src/renderers/templateEngines.tsx +100 -0
- package/src/util/actionContext.ts +29 -0
- package/src/util/additionalErrors.tsx +391 -0
- package/src/util/celEnvironment.ts +300 -0
- package/src/util/celTemplate.ts +267 -0
- package/src/util/childNames.ts +135 -0
- package/src/util/configNamespaces.ts +6 -0
- package/src/util/cron.ts +433 -0
- package/src/util/editorControls.ts +58 -0
- package/src/util/editorDiagnostics.ts +103 -0
- package/src/util/extendedControls.ts +34 -0
- package/src/util/extendedLocale.ts +67 -0
- package/src/util/fileFilterValue.ts +28 -0
- package/src/util/formContext.ts +74 -0
- package/src/util/gridColumns.ts +80 -0
- package/src/util/horizontalLayout.ts +59 -0
- package/src/util/i18nDefaults.ts +80 -0
- package/src/util/interpolate.ts +218 -0
- package/src/util/labelFilterValue.ts +49 -0
- package/src/util/lazyControl.tsx +66 -0
- package/src/util/lazyTemplate.tsx +110 -0
- package/src/util/markdown.tsx +345 -0
- package/src/util/markdownEscape.ts +29 -0
- package/src/util/markup.ts +144 -0
- package/src/util/maskControls.ts +6 -0
- package/src/util/templateLang.ts +145 -0
- package/src/util/templateUrls.ts +274 -0
- package/src/util/urlPolicy.ts +115 -0
- package/src/util/useCronPicker.ts +102 -0
- package/src/util/useDurationControl.ts +272 -0
- package/src/util/useEditorAppearance.ts +86 -0
- package/src/util/useExtendedTranslator.ts +25 -0
- package/src/util/useMonacoShadowStyles.ts +47 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonforms-react-extended.esm.js","names":["DIAGNOSTIC_STYLE","LoadBoundary","elements","_Fragment","DIAGNOSTIC_STYLE","DIAGNOSTIC_STYLE","element","_Fragment","_Fragment","_Fragment","_Fragment","transform","createDefaultAjv","schemaMessageKey","_defineProperty","localizeBg","ajvTranslations","unwrapErrorMessageErrors","createAjvErrorTranslator","_objectSpread2","SCHEMA_MESSAGE","resolveExtendedOption","JSONFORMS_EXTENDED_CONFIG_KEY","extendedConfig","JSONFORMS_CONFIG_KEY","ElementRender","typographyEnabled","resolveMarkup","markdownEnabled","wantsMarkup","markdownProfile","escapeMarkdown","_objectWithoutProperties","React","ajvErrors","keywords","dynamicDefaults","capitalizeFn","startCaseFn","dayjs","customParsingPlugin","durationPlugin","timezonePlugin","utcPlugin","get","isEqual","sharedSplitLayoutTester","rankWith","and","or","uiTypeIs","_ui$options$variant","_ui$options","ui","splitCssSize","value","initialSplitSizes","weights","elements","_element$options","weight","element","total","sum","SharedSplitLayout","_layout$options","_splitCssSize","t","useI18n","layout","props","horizontal","useEffectiveElements","count","stored","setSizes","sizes","resizable","wrapRequested","drag","options","adjust","limited","original","index","delta","i","size","JsonFormsDispatch","event","rect","current","SharedSplitLayoutRenderer","withJsonFormsLayoutProps","resolveChildNames","children","names","byName","diagnostics","explicit","dynamicAuthoredElement","fallback","RACTIVE_TRANSITION_ATTRIBUTE","ractiveTransitionAttributes","found","match","template","useNamedChildren","useMemo","resolved","buildFormContext","_ctx$i18n","_ctx$i18n2","_ctx$core","_ctx$core2","_ctx$core$errors","_ctx$core3","_ctx$core$additionalE","_ctx$core4","ctx","schema","TEMPLATE_LANGS","DEFAULT_TEMPLATE_LANG","asLang","allowsScriptEvaluation","_extendedConfig","security","config","\"security\"","\"allowScriptEvaluation\"","resolveTemplateLang","requested","uischema","namespaced","configured","fromConfig","resolveTemplateEngine","templateLangTester","_schema","context","lang","unsupportedTemplateLangTester","DIAGNOSTIC_STYLE$3","TemplateDiagnostic","text","visible","message","extendedI18nDefaults","bgExtendedLocale","defaultExtendedLocales","catalogs","setExtendedLocales","next","getExtendedLocales","normalize","locale","registerExtendedLocale","catalog","resolveExtendedLocale","_catalogs$code","code","extendedDefault","_resolveExtendedLocal","_resolveExtendedLocal2","key","useExtendedTranslator","useJsonForms","translate","values","name","asyncGeneratorStep","n","c","u","o","_asyncToGenerator","e","_next","_throw","LoadBoundary$1","_args","error","createLazyTemplate","loaded","Lazy","lazy","component","load","LazyTemplate","_labels$renderError","labels","Suspense","defaultUrlPolicy","resolveUrlPolicy","extended","supplied","scheme","SCHEME","isAllowedUrl","_SCHEME$exec","url","candidate","policy","IMAGE_DATA_URL","isAllowedImageUrl","DynamicJSXRenderer","templateRendererTester","TemplateElementControl","TemplateLayoutRenderer","_uischema$elements","_ctx$core7","_ctx$core8","_ctx$core9","engine","effectiveChildren","useDynamicElements","path","childNames","nameDiagnostics","diagnostic","namedElements","cells","enabled","renderers","elementsByName","map","proxyElements","prop","target","external","useDynamicExternal","proxy","_ctx$core5","_ctx$core6","updateProxy","newValue","proxyTarget","deepMerge","source","item","result","dataProxy","errorsProxy","additionalErrorsProxy","rendererProps","components","jsxTemplate","k","RactiveTemplate","SLOT_ATTR","RactiveTemplateLayoutRenderer","_uischema$template","nameKey","eaten","partials","slots","bindings","_ref","_ctx$i18n$translate","_ctx$i18n$translate2","HandleActionContext","useHandleAction","tsxTemplateLayoutTester","SlotContext","Slot","_current$byName","Fragment","TsxTemplateLayoutRendererComponent","fireActionEvent","handleChange","useCallback","_ctx$dispatch","Actions","TsxTemplateLayoutRenderer","runScript","script","AsyncFunction","buttonRendererTester","DIAGNOSTIC_STYLE$2","createButtonRenderer","ButtonRenderer","_ref2","_ref3","_ref4","_deriveLabelForUISche","_element$action","handleAction","pending","setPending","useState","running","useRef","label","deriveLabelForUISchemaElement","action","params","_element$params","activate","useEffect","disabled","mappedProps","getButtonProps","ButtonComponent","buttonProps","withProps","withTranslateProps","TemplateSlotsContext","hasTemplateName","namedTemplateTester","TemplateRendererComponent","_context$uischemas","inherited","_element$elements","child","entry","TemplateRenderer","slotRendererTester","SlotRendererComponent","_slots$element$name","contents","SlotRenderer","spacerRendererTester","DEFAULT_SIZE","toCss","resolveSize","SpacerRendererComponent","_uischema$options","SpacerRenderer","imageViewRendererTester","permitsString","type","resolveImageView","_args$schema","_args$path","src","altField","alt","args","checkUrl","Resolve","dataPath","composePaths","toDataPath","DIAGNOSTIC_STYLE$1","ImageDiagnostic","open","setOpen","id","ImageViewRendererComponent","ImageViewRenderer","separatorRendererTester","SeparatorRendererComponent","SeparatorRenderer","linkRendererTester","linkRel","tokens","rel","required","LinkRendererComponent","href","LinkRenderer","DefaultLoading","DefaultLoadError","LoadBoundary","createLazyControl","_components$Loading","_components$LoadError","Loading","LoadError","Deferred","splitTemplate","segments","literal","flush","char","j","quote","closed","hasExpressions","segment","looksLikeMustache","dynamicValuesEnabled","_namespaced","\"dynamicValues\"","\"enabled\"","DYNAMIC_NAMESPACES","buildNamespaceScope","_input$locale","scope","input","_input$data","_input$config","_input$context","RESERVED_TEXT_NAMES","buildTextScope","reservedParamNames","textParams","wantsInterpolation","\"interpolate\"","LazyEvaluate","resolveTextParams","namespaceScope","rendered","renderTemplate","escape","InterpolatedText","asksForMarkup","markup","\"markup\"","markupLabelTester","_context","LazyMarkdownText","DIAGNOSTIC_STYLE","MarkupLabelRendererComponent","_ctx$i18n3","ownedText","request","content","Typography","typography","expressions","plainText","\"textParams\"","reserved","parsed","body","inner","node","extra","MarkupLabelRenderer","withJsonFormsLabelProps","createMarkupLabelRenderer","schemaForType","nextSchema","removeInapplicableKeywords","_nextSchema$additiona","items","resolveMixedArrayItems","rootSchema","ANY_TYPES","GenericMixedRendererComponent","translateType","useTranslator","jsonforms","uischemas","_jsonforms$uischemas","types","getSchemaTypes","dataType","getJsonDataType","data","selectedType","selectedSchema","detailUiSchema","findMixedDetailUiSchema","findUISchema","renderedControl","isStructuredType","nextType","createDefaultValue","isMixedSchema","isControl","schemaPath","currentDataSchema","resolveSchema","isMixedControl","mixedControlFor","genericMixedControlTester","GenericMixedRenderer","withJsonFormsControlProps","HORIZONTAL_COLUMNS","isValidColumns","horizontalLayoutWidths","fixed","rows","allAuto","used","minimum","indices","_fixed$index","autos","_fixed$index2","columns","fraction","gap","horizontalColumnsLayoutTester","HorizontalColumnsLayoutRendererComponent","_props$uischema$eleme","state","_context$core","isVisible","getAjv","getConfig","widths","row","position","HorizontalColumnsLayoutRenderer","getPropertyNamePattern","objectSchema","toObjectSchema","propertyNames","_resolveSchema","patterns","validatePropertyName","propertyName","currentPropertyName","pattern","GenericAdditionalProperties","newPropertyName","setNewPropertyName","renamingPropertyName","setRenamingPropertyName","renameValue","setRenameValue","useAdditionalPropertyItems","shouldShow","propertyNameError","addPropertyDisabled","readonly","appliedOptions","maxPropertiesReached","removePropertyDisabled","minPropertiesReached","addProperty","additionalProperty","toAdditionalPropertyItem","allowIfMissing","updatedData","objectData","removeProperty","propertyToRemove","renameProperty","trimmed","propertyToRename","renamePropertyKey","additionalPropertyItems","isRenaming","renameError","renameDisabled","transform","s","cfg","configKey","getDef","_getDef","cxt","it","tNames","getEnumCaseCfg","parentSchema","gen","stringify","parentData","transformExpr","parentDataProperty","ts","func","getProperty","arg","v","makeDynamic","allowScriptEvaluation","compiled","searchParams","_url$searchParams$get","hash","_URLSearchParams$get","nowOffset","duration","date","op","subtracting","offset","temporal","format","datetimeOffset","timeOffset","dateOffset","dateUnit","_arg","unit","registerAjvKeywords","_options$allowScriptE","ajv","defaults","DEFAULT_CRON","CRON_FIELDS","DAY_NAMES","MONTH_NAMES","FIELD_RANGE","namesFor","field","MACROS","splitCron","_MACROS$trimmed$toLow","expression","fields","joinCron","valueOf","number","low","high","parseField","all","selected","part","range","step","rest","by","from","to","start","end","first","last","each","left","right","labelFor","formatField","sorted","a","b","parts","validField","cronProblem","bad","BY_PERIOD","isEvery","periodOf","period","fieldsForPeriod","sameExpression","one","other","at","NOTHING_CHOSEN","COARSENESS","standDown","shown","_fields$index","withTimeDefaults","changed","_fields$index2","_excluded$1","COLOR","createFormsAjv","ajvOptions","createAjv","errorMessages","validate","formats","extendedKeywords","_ajv$opts","i18n","localizers","isNamedUISchemaElement","URL_REFUSED_DIAGNOSTIC","URL_PROPS","URL_ATTRS","IMAGE_SRC_ELEMENTS","kindFor","declared","tag","allowed","kind","splitUrlList","isList","report","onRefused","inspectable","permits","effective","sanitizeUrlProps","_sanitized3","sanitized","_sanitized","_sanitized2","sanitizeUrlAttributes","_root$matches","root","removed","selector","candidates","OWNED","isOwned","ownerOf","NO_STORE_DIAGNOSTIC","pathOf","instancePath","valueAt","createAdditionalErrorStore","owners","listeners","snapshot","rebuild","listener","publish","errors","owner","stamped","copy","clear","clearAll","pruneChanged","kept","_error$instancePath","_error$instancePath2","before","after","_next$additionalError","_next$additionalError2","defaultReducer","published","hostErrors","combined","_next$additionalError3","additionalErrorOwner","StoreContext","createContext","AdditionalErrorStoreProvider","store","useAdditionalErrorStore","useContext","useOwnedAdditionalErrors","wanted","latest","signature","clearOnChange","useAdditionalErrors","_excluded","canonicalUiOptions","entries","_ignored","normalized","canonicalConfig","AdditionalErrorsBridge","dispatch","coreRef","useLayoutEffect","core","ExtendedJsonForms","outerAction","schemaToUse","Generate","uischemaToUse","combinedMiddleware","middleware","innerState","innerAction","configToUse","rendererRegistry","withDynamicRenderers","cellRegistry","withDynamicCells","form","JsonFormsStateProvider","wrapped","DynamicUiProvider","handler","onAction","EDITOR_DIAGNOSTIC_KEYWORD","MONACO_SEVERITY_ERROR","countBlockingMarkers","markers","_marker$severity","marker","resolvePropagateErrors","own","elementOptions","\"propagateErrors\"","pointerFor","editorSummaryError","extendedColorTester","isStringControl","formatIs","optionIs","extendedDurationTester","extendedNullTester","schemaTypeIs","colorPickerValue","useCronPicker","_splitCron","setText","setPeriod","touched","setTouched","showActions","problem","localError","commit","draft","change","changeField","chosen","changeText","changePeriod","editedProblem","shownFields","_draft$CRON_FIELDS$in","emptyDurationParts","durationFields","durationComponentFields","isWeeksDuration","defaultComponentField","durationFieldMax","parseExtendedDuration","weeks","years","months","days","hours","minutes","seconds","formatExtendedDuration","safe","formatDurationComponents","useDurationControl","setDraft","setShown","mode","setModeState","unchangedFrom","commitParts","commitIfLive","activeFields","openFields","withValues","_parseExtendedDuratio","monacoControlTester","_ui$options2","extendedAgGridTester","resolveEditorLanguage","language","encodeEditorValue","convert","decodeEditorValue","_unused","useEditorAppearance","dark","setDark","_window$matchMedia","_window","ref","ancestors","_current$parentElemen","media","update","_color$match","observer","explicitTheme","isDark","createMonacoControlRenderer","createAgGridControl","createAgGridControlRenderer","createExtendedRenderers","_options$includeButto","componentsOrOptions","includeButtonRenderer","WrappedTemplateLayoutRenderer","TRUST_DYNAMIC_FUNCTIONS","extendedMaskTester","hasMaskPattern","isMaskPattern"],"sources":["../src/renderers/SplitLayoutRenderer.tsx","../src/util/childNames.ts","../src/util/formContext.ts","../src/util/templateLang.ts","../src/renderers/templateEngines.tsx","../src/util/i18nDefaults.ts","../src/locale/bg.ts","../src/util/extendedLocale.ts","../src/util/useExtendedTranslator.ts","../src/util/lazyTemplate.tsx","../src/util/urlPolicy.ts","../src/renderers/TemplateLayoutRenderer.tsx","../src/renderers/RactiveTemplateLayoutRenderer.tsx","../src/util/actionContext.ts","../src/renderers/TsxTemplateLayoutRenderer.tsx","../src/renderers/ButtonRenderer.tsx","../src/renderers/TemplateRenderer.tsx","../src/renderers/SlotRenderer.tsx","../src/renderers/SpacerRenderer.tsx","../src/renderers/ImageViewRenderer.tsx","../src/renderers/SeparatorRenderer.tsx","../src/renderers/LinkRenderer.tsx","../src/util/lazyControl.tsx","../src/util/interpolate.ts","../src/components/InterpolatedText.tsx","../src/renderers/MarkupLabelRenderer.tsx","../src/renderers/GenericMixedRenderer.tsx","../src/util/horizontalLayout.ts","../src/renderers/HorizontalLayoutRenderer.tsx","../src/components/GenericAdditionalProperties.tsx","../src/core/transform.ts","../src/core/dynamicDefaults.ts","../src/core/keywords.ts","../src/util/cron.ts","../src/core/ajv.ts","../src/core/uiSchema.ts","../src/util/templateUrls.ts","../src/util/additionalErrors.tsx","../src/components/ExtendedJsonForms.tsx","../src/util/editorDiagnostics.ts","../src/util/extendedControls.ts","../src/util/useCronPicker.ts","../src/util/useDurationControl.ts","../src/util/editorControls.ts","../src/util/useEditorAppearance.ts","../src/renderers/MonacoControlRenderer.tsx","../src/renderers/AgGridControlRenderer.tsx","../src/index.tsx"],"sourcesContent":["import { useI18n } from '@chobantonov/jsonforms-react-renderer-common/locale/translate';\nimport { useEffectiveElements } from '@chobantonov/jsonforms-react-renderer-common/layout/layoutContext';\nimport {\n Layout,\n LayoutProps,\n RankedTester,\n UISchemaElement,\n and,\n or,\n rankWith,\n uiTypeIs,\n} from '@jsonforms/core';\nimport { JsonFormsDispatch, withJsonFormsLayoutProps } from '@jsonforms/react';\nimport React from 'react';\n\nexport const sharedSplitLayoutTester: RankedTester = rankWith(\n 4,\n and(\n or(uiTypeIs('HorizontalLayout'), uiTypeIs('VerticalLayout')),\n (ui) => String(ui.options?.variant ?? '').toLowerCase() === 'splitter',\n ),\n);\n\nexport const splitCssSize = (value: unknown): string | undefined =>\n typeof value === 'number' && Number.isFinite(value) && value > 0\n ? `${value}px`\n : typeof value === 'string' && value.trim()\n ? value.trim()\n : undefined;\n\n/**\n * The initial share of each pane.\n *\n * \"Initial sizes use normal sizing\" - so a pane's `options.layout.weight`\n * decides its share, exactly as it would in an ordinary layout, and equal\n * shares are what Auto produces rather than a rule of their own.\n *\n * \"Span SHOULD NOT be used\" with a splitter, so it is ignored here; a pane\n * asking for one falls back to Auto rather than being sized against a grid\n * that a draggable pane does not have.\n */\nexport const initialSplitSizes = (elements: UISchemaElement[]): number[] => {\n const weights = elements.map((element) => {\n const weight = (element as any)?.options?.layout?.weight;\n return typeof weight === 'number' && Number.isFinite(weight) && weight > 0\n ? weight\n : 1;\n });\n const total = weights.reduce((sum, weight) => sum + weight, 0);\n return weights.map((weight) => (weight / total) * 100);\n};\n\nexport const SharedSplitLayout = (props: LayoutProps) => {\n const t = useI18n();\n const layout = props.uischema as Layout;\n const horizontal = layout.type === 'HorizontalLayout';\n /*\n \"Only effective visible UI-schema children participate. Hidden children\n leave layout.\" A hidden pane used to keep its share and its separator.\n */\n const elements = useEffectiveElements(\n layout.elements,\n props.path,\n props.config,\n );\n const count = elements.length;\n const [stored, setSizes] = React.useState<number[]>([]);\n const sizes = stored.length === count ? stored : initialSplitSizes(elements);\n /* \"`resizable` defaults true\"; false disables dragging without hiding panes. */\n const resizable =\n ({ ...props.config, ...layout.options } as any).resizable !== false;\n /*\n \"splitter+wrap unsupported\". Panes divide a single axis and a separator\n sits between neighbours, so there is no meaningful second row to wrap on\n to. Reported rather than ignored, because the author asked for something\n that will not happen.\n */\n const wrapRequested = (layout.options as any)?.wrap === true;\n const drag = React.useRef<{\n index: number;\n start: number;\n total: number;\n sizes: number[];\n }>();\n const options = { ...props.config, ...layout.options };\n const adjust = (index: number, delta: number, original = sizes) => {\n const limited = Math.max(\n 1 - original[index],\n Math.min(original[index + 1] - 1, delta),\n );\n setSizes(\n original.map((size, i) =>\n i === index ? size + limited : i === index + 1 ? size - limited : size,\n ),\n );\n };\n if (!props.visible) return null;\n return (\n <div\n {...(wrapRequested\n ? {\n 'data-layout-diagnostic':\n '`wrap` is not supported together with the splitter variant; ignored.',\n }\n : {})}\n style={{\n display: 'flex',\n flexDirection: horizontal ? 'row' : 'column',\n width: '100%',\n minWidth: 0,\n height: horizontal\n ? undefined\n : (splitCssSize(options.height) ?? '20rem'),\n minHeight: horizontal ? undefined : splitCssSize(options.minHeight),\n }}\n >\n {elements.map((element, index) => (\n <React.Fragment key={index}>\n <div\n /* See the antd splitter: padding outside the basis overflows. */\n style={{\n boxSizing: 'border-box',\n flex: `${sizes[index]} 1 0`,\n minWidth: 0,\n minHeight: 0,\n overflow: 'auto',\n padding: 8,\n }}\n >\n <JsonFormsDispatch\n schema={props.schema}\n uischema={element}\n path={props.path}\n enabled={props.enabled}\n renderers={props.renderers}\n cells={props.cells}\n />\n </div>\n {index < count - 1 && (\n <div\n role='separator'\n /*\n \"`resizable` defaults true.\" When false the separator still\n marks the boundary - it is a real separator either way - but it\n stops being focusable and stops responding to keys or pointers.\n */\n {...(resizable ? { tabIndex: 0 } : { 'aria-disabled': true })}\n aria-label={t('layout.resizePane', { index: index + 1 })}\n aria-orientation={horizontal ? 'vertical' : 'horizontal'}\n aria-valuemin={1}\n aria-valuemax={sizes[index] + sizes[index + 1] - 1}\n aria-valuenow={Math.round(sizes[index])}\n style={{\n flex: '0 0 6px',\n background: 'rgba(128,128,128,0.3)',\n cursor: resizable\n ? horizontal\n ? 'col-resize'\n : 'row-resize'\n : 'default',\n touchAction: 'none',\n }}\n onKeyDown={(event) => {\n if (!resizable) return;\n const delta =\n event.key === (horizontal ? 'ArrowRight' : 'ArrowDown')\n ? 2\n : event.key === (horizontal ? 'ArrowLeft' : 'ArrowUp')\n ? -2\n : 0;\n if (delta) {\n event.preventDefault();\n adjust(index, delta);\n }\n }}\n onPointerDown={(event) => {\n if (!resizable) return;\n const rect =\n event.currentTarget.parentElement!.getBoundingClientRect();\n const total = horizontal ? rect.width : rect.height;\n if (!total) return;\n event.preventDefault();\n drag.current = {\n index,\n start: horizontal ? event.clientX : event.clientY,\n total,\n sizes,\n };\n event.currentTarget.setPointerCapture(event.pointerId);\n }}\n onPointerMove={(event) => {\n const current = drag.current;\n if (current)\n adjust(\n current.index,\n (((horizontal ? event.clientX : event.clientY) -\n current.start) /\n current.total) *\n 100,\n current.sizes,\n );\n }}\n onPointerUp={() => {\n drag.current = undefined;\n }}\n onPointerCancel={() => {\n drag.current = undefined;\n }}\n onLostPointerCapture={() => {\n drag.current = undefined;\n }}\n />\n )}\n </React.Fragment>\n ))}\n </div>\n );\n};\nexport const SharedSplitLayoutRenderer =\n withJsonFormsLayoutProps(SharedSplitLayout);\n","import { useMemo } from 'react';\nimport { dynamicAuthoredElement } from '@chobantonov/jsonforms-react-renderer-common/dynamic/DynamicUiProvider';\nimport type { ExtendedUISchemaElement } from '../core/uiSchema';\n\n/**\n * Addressing a template's children.\n *\n * Section 13: \"each named child is available as a partial that mounts its\n * delegated renderer. Unnamed children receive their decimal index as a\n * fallback name.\"\n *\n * The fallback is where it gets interesting, and the section does not say what\n * happens when the two collide. They can: a child explicitly named `\"0\"` wants\n * the same key as the first child's index fallback. The previous\n * implementation let whichever came last win the map, so the **other child was\n * never placed at all** - no partial, no dispatch, no error. A control simply\n * was not on the form, and nothing said why.\n *\n * The rule here: an explicit name always keeps its key, because the author\n * asked for it. An index fallback applies **only if no explicit name has\n * claimed that index**, and when one has, the unnamed child is reported as\n * unaddressable rather than silently dropped or quietly given some other\n * number no template would reference.\n */\n\nexport interface ResolvedChildNames {\n /**\n * One entry per child, in order. `undefined` means the child could not be\n * given an address and no template can place it.\n */\n names: (string | undefined)[];\n /** Name to child index, for looking a child up from a template. */\n byName: Record<string, number>;\n /** Stable-coded messages for names that could not be assigned. */\n diagnostics: string[];\n}\n\nexport const resolveChildNames = (\n elements: readonly ExtendedUISchemaElement[] | undefined,\n): ResolvedChildNames => {\n const children = elements ?? [];\n const names: (string | undefined)[] = Array.from(\n { length: children.length },\n () => undefined,\n );\n const byName: Record<string, number> = {};\n const diagnostics: string[] = [];\n\n /*\n Explicit names first, so an index fallback can see every key that is\n already taken - including one belonging to a later child.\n */\n children.forEach((element, index) => {\n const explicit = element\n ? (dynamicAuthoredElement(element) as ExtendedUISchemaElement).name\n : undefined;\n if (typeof explicit !== 'string' || explicit === '') {\n return;\n }\n if (byName[explicit] !== undefined) {\n diagnostics.push(\n `template.duplicateChildName: children ${\n byName[explicit]\n } and ${index} are both named ${JSON.stringify(\n explicit,\n )}; the first one keeps the name.`,\n );\n return;\n }\n byName[explicit] = index;\n names[index] = explicit;\n });\n\n children.forEach((_element, index) => {\n if (names[index] !== undefined) {\n return;\n }\n const fallback = String(index);\n if (byName[fallback] !== undefined) {\n diagnostics.push(\n `template.childNameCollision: child ${index} has no name and its index ${JSON.stringify(\n fallback,\n )} is already the name of child ${\n byName[fallback]\n }, so it cannot be placed. Give it a name.`,\n );\n return;\n }\n byName[fallback] = index;\n names[index] = fallback;\n });\n\n return { names, byName, diagnostics };\n};\n\n/**\n * Attributes a Ractive template will silently eat.\n *\n * Ractive's parser reads **any** attribute matching `name-in`, `name-out` or\n * `name-in-out` as a transition directive:\n *\n * ```js\n * // ractive.js\n * var transitionPattern = /^([a-zA-Z](?:(?!-in-out)[-a-zA-Z_0-9])*)-(in|out|in-out)$/;\n * ```\n *\n * So `<p data-out>` is parsed as the transition named `data` and never\n * reaches the DOM, while `data-greeting` beside it is untouched. It is\n * hard-coded in the parser, with no option to turn it off.\n *\n * This renderer registers **no transitions**, so every such directive is dead\n * code here - which makes warning about all of them precise rather than\n * guesswork. An author who wanted a transition learns this profile has none;\n * an author who wanted an attribute learns why it vanished.\n */\nconst RACTIVE_TRANSITION_ATTRIBUTE =\n /\\s([a-zA-Z](?:(?!-in-out)[-a-zA-Z_0-9])*-(?:in|out|in-out))(?=[\\s/>=])/g;\n\nexport const ractiveTransitionAttributes = (template: string): string[] => {\n const found = new Set<string>();\n let match: RegExpExecArray | null;\n RACTIVE_TRANSITION_ATTRIBUTE.lastIndex = 0;\n while ((match = RACTIVE_TRANSITION_ATTRIBUTE.exec(template)) !== null) {\n found.add(match[1]);\n }\n return [...found];\n};\n\nexport function useNamedChildren(\n elements: ExtendedUISchemaElement[] | undefined,\n) {\n const children = useMemo(() => elements ?? [], [elements]);\n const resolved = useMemo(() => resolveChildNames(children), [children]);\n return { children, ...resolved };\n}\n","import type { JsonSchema, UISchemaElement } from '@jsonforms/core';\n\n/**\n * The `context` binding every template profile exposes.\n *\n * Section 3 declares the shape, and section 13 says the Ractive profile\n * \"exposes data…, errors…, **context (extended FormContext)**, elements, and\n * translate\", adding that \"context may expose additionalErrors and\n * application capabilities\".\n *\n * All three profiles used to pass something different and smaller - the JSX\n * engine a flat `locale` and no `context` at all, Ractive a `context` holding\n * only `{ locale }`. So `readonly` was unreachable from a template, which\n * matters as soon as a template draws its own widget: **readonly and disabled\n * are different states**, and a widget that wants to render as text rather\n * than as a greyed-out input has to be able to tell them apart.\n */\nexport interface FormContext {\n external?: Readonly<Record<string, unknown>>;\n [key: string]: unknown;\n config?: unknown;\n readonly?: boolean;\n locale?: string;\n translate?: unknown;\n data?: unknown;\n schema?: JsonSchema;\n uischema?: UISchemaElement;\n errors?: unknown[];\n additionalErrors?: unknown[];\n fireActionEvent?: unknown;\n}\n\nexport interface FormContextSources {\n external?: Readonly<Record<string, unknown>>;\n /** `useJsonForms()`. */\n ctx: {\n core?: {\n data?: unknown;\n schema?: JsonSchema;\n errors?: unknown[];\n additionalErrors?: unknown[];\n };\n i18n?: { locale?: string; translate?: unknown };\n readonly?: boolean;\n config?: unknown;\n };\n /** The schema at this element's path, which is narrower than the root. */\n schema?: JsonSchema;\n uischema?: UISchemaElement;\n /** The host's action handler, where one is registered. */\n fireActionEvent?: unknown;\n}\n\nexport const buildFormContext = ({\n ctx,\n schema,\n uischema,\n fireActionEvent,\n external,\n}: FormContextSources): FormContext => ({\n external,\n config: ctx.config,\n readonly: ctx.readonly === true,\n locale: ctx.i18n?.locale,\n translate: ctx.i18n?.translate,\n data: ctx.core?.data,\n // The schema *here*, not the root - a template is usually interested in the\n // part of the model it is rendering.\n schema: schema ?? ctx.core?.schema,\n uischema,\n errors: ctx.core?.errors ?? [],\n additionalErrors: ctx.core?.additionalErrors ?? [],\n fireActionEvent,\n});\n","import type { Layout, UISchemaElement } from '@jsonforms/core';\nimport type { ExtendedUISchemaElement } from '../core/uiSchema';\nimport { extendedConfig } from './configNamespaces';\n\n/**\n * Which engine renders a `TemplateLayout`, and whether it is allowed to run.\n *\n * \"optional top-level `lang` selects the engine. Resolve the language from\n * explicit lang, then the configured default, then ractive for the\n * default web profile. Keep that existing config name.\"\n *\n * `defaultTemplateLang` is read from `config.jsonformsExtended`.\n */\n\n/** The engines this renderer set implements. */\nexport const TEMPLATE_LANGS = ['ractive', 'jsx'] as const;\nexport type TemplateLang = (typeof TEMPLATE_LANGS)[number];\n\n/**\n * A `TemplateLayout` element.\n *\n * `lang` is **not** narrowed to {@link TemplateLang}, and that is deliberate.\n * The specification requires an unknown language to be *diagnosed* rather than\n * refused - \"unknown or unsupported languages must be diagnosed rather than\n * interpreted as another engine\" - and it names `vue` as a profile a web\n * renderer set need not implement. A closed union would make the diagnostic\n * path unauthorable: `lang: \"handlebars\"` would not compile, so the case the\n * renderer exists to report could never be written down.\n *\n * `TemplateLang | (string & {})` keeps editor completion for the two engines\n * this set implements while still accepting any string.\n */\nexport type TemplateLayoutElement = Omit<Layout, 'elements'> & {\n type: 'TemplateLayout';\n /** The template source. Required by section 13. */\n template: string;\n /** `ractive`, `jsx`, or anything else - which is diagnosed, not rejected. */\n lang?: TemplateLang | (string & NonNullable<unknown>);\n /** Lets a registered `Template` resolve this element by name. */\n name?: string;\n /**\n * Children; a named one is addressable from the template.\n *\n * Section 13: \"each named child is available as a partial that mounts its\n * delegated renderer\". The names come from the project's own element type,\n * since core declares none.\n */\n elements: ExtendedUISchemaElement[];\n};\n\n/** \"then ractive for the default web profile\" */\nconst DEFAULT_TEMPLATE_LANG: TemplateLang = 'ractive';\n\nexport interface ResolvedTemplateLang {\n /** The engine to use, or undefined when the request cannot be honoured. */\n lang?: TemplateLang;\n /** What was asked for, when it is not a language this set implements. */\n requested?: string;\n /**\n * Why nothing will render. `unsupported` is a language this set does not\n * implement; `evaluation-disabled` is a supported one the host has not\n * permitted.\n */\n diagnostic?: 'unsupported' | 'evaluation-disabled';\n}\n\nconst asLang = (value: unknown): TemplateLang | undefined =>\n typeof value === 'string' &&\n (TEMPLATE_LANGS as readonly string[]).includes(value.toLowerCase())\n ? (value.toLowerCase() as TemplateLang)\n : undefined;\n\n/**\n * Whether the host permits compiling strings into executable code.\n *\n * \"String evaluation requires\n * `jsonformsExtended.security.allowScriptEvaluation=true`… Enabling string\n * evaluation means the host treats the UI schema as trusted executable code.\"\n *\n * **Both** engines need it. JSX is compiled and handed to `new Function`;\n * Ractive compiles each `{{ }}` expression the same way. Neither is a sandbox,\n * and the default is therefore off.\n */\nexport const allowsScriptEvaluation = (config: unknown): boolean => {\n const security = extendedConfig(config)?.['security'];\n return (\n !!security &&\n typeof security === 'object' &&\n (security as Record<string, unknown>)['allowScriptEvaluation'] === true\n );\n};\n\n/**\n * The engine for one element, or a diagnostic saying why there is none.\n *\n * \"Unknown or unsupported languages must be diagnosed rather than interpreted\n * as another engine\" - so an unrecognized `lang` does **not** fall back to the\n * default. Falling back is what turns a typo into a form that renders the\n * wrong thing and says nothing.\n */\nexport const resolveTemplateLang = (\n uischema: UISchemaElement | undefined,\n config: unknown,\n): ResolvedTemplateLang => {\n const requested = (uischema as { lang?: unknown } | undefined)?.lang;\n\n if (requested !== undefined) {\n const explicit = asLang(requested);\n return explicit\n ? { lang: explicit }\n : { requested: String(requested), diagnostic: 'unsupported' };\n }\n\n const namespaced = extendedConfig(config) as\n | { defaultTemplateLang?: unknown }\n | undefined;\n const configured = namespaced?.defaultTemplateLang;\n if (configured !== undefined) {\n const fromConfig = asLang(configured);\n return fromConfig\n ? { lang: fromConfig }\n : { requested: String(configured), diagnostic: 'unsupported' };\n }\n\n return { lang: DEFAULT_TEMPLATE_LANG };\n};\n\n/**\n * The same resolution, plus the security gate, for a renderer about to run.\n *\n * Kept separate from {@link resolveTemplateLang} because the **testers** must\n * not consult it: a disabled host still needs the element to select a renderer,\n * so that renderer can report why nothing is shown. A tester returning `-1`\n * would leave the element unhandled and silent.\n */\nexport const resolveTemplateEngine = (\n uischema: UISchemaElement | undefined,\n config: unknown,\n): ResolvedTemplateLang => {\n const resolved = resolveTemplateLang(uischema, config);\n if (resolved.lang && !allowsScriptEvaluation(config)) {\n return { ...resolved, diagnostic: 'evaluation-disabled' };\n }\n return resolved;\n};\n","import { useI18n } from '@chobantonov/jsonforms-react-renderer-common/locale/translate';\nimport {\n RankedTester,\n UISchemaElement,\n rankWith,\n uiTypeIs,\n} from '@jsonforms/core';\nimport React from 'react';\nimport {\n TemplateLang,\n resolveTemplateEngine,\n resolveTemplateLang,\n} from '../util/templateLang';\n\n/**\n * Selecting a template engine, and refusing to run one.\n *\n * A `TemplateLayout` is dispatched to a renderer per **language**, so each\n * engine is an ordinary registry entry with its own tester rather than a\n * branch inside one component. The tester is where the choice belongs: a\n * `TesterContext` carries the form-wide `config`, which is what\n * `defaultTemplateLang` lives in.\n */\n\n/**\n * A tester for one engine.\n *\n * Deliberately does **not** consult `allowScriptEvaluation`. A tester that\n * returned `-1` for a disabled host would leave the element unmatched and the\n * form silent; the specification asks for the opposite - \"report\n * unsupported/evaluation-disabled behavior instead\". So the renderer is still\n * selected, and it explains itself.\n */\nexport const templateLangTester = (lang: TemplateLang): RankedTester =>\n rankWith(2, (uischema, _schema, context) => {\n if (!uiTypeIs('TemplateLayout')(uischema, _schema, context)) {\n return false;\n }\n return resolveTemplateLang(uischema, context?.config).lang === lang;\n });\n\n/**\n * The fallback for a `TemplateLayout` no engine claimed.\n *\n * \"Unknown or unsupported languages must be diagnosed rather than interpreted\n * as another engine.\" Ranked below the engines, so it only wins when the\n * resolution produced no supported language.\n */\nexport const unsupportedTemplateLangTester: RankedTester = rankWith(\n 1,\n uiTypeIs('TemplateLayout'),\n);\n\nexport interface TemplateDiagnosticProps {\n uischema: UISchemaElement;\n config?: unknown;\n visible?: boolean;\n}\n\nconst DIAGNOSTIC_STYLE: React.CSSProperties = {\n border: '1px solid currentColor',\n borderRadius: 4,\n padding: '0.75rem 1rem',\n opacity: 0.85,\n fontSize: '0.9rem',\n};\n\n/**\n * Says why a template is not being rendered, in place of rendering it.\n *\n * Both reasons are reported the same way and neither is an error state the\n * form can recover from by itself: one is an authoring mistake, the other a\n * deliberate host policy.\n */\nexport const TemplateDiagnostic = ({\n uischema,\n config,\n visible,\n}: TemplateDiagnosticProps) => {\n const text = useI18n();\n const resolved = resolveTemplateEngine(uischema, config);\n if (visible === false || !resolved.diagnostic) {\n return null;\n }\n const message =\n resolved.diagnostic === 'unsupported'\n ? text('template.unsupported', {\n language: JSON.stringify(resolved.requested),\n })\n : text('template.disabled');\n return (\n <div\n role='alert'\n data-template-diagnostic={resolved.diagnostic}\n style={DIAGNOSTIC_STYLE}\n >\n {message}\n </div>\n );\n};\n","/**\n * Default messages for strings this package renders. Every one goes through the\n * JSON Forms translator, so a host can override any of them per locale.\n */\nexport const extendedI18nDefaults = {\n 'array.addRow': 'Add row',\n 'array.removeSelected': 'Remove selected',\n 'grid.loading': 'Loading data grid...',\n 'grid.loadError': 'Unable to load the data grid.',\n 'editor.loading': 'Loading editor...',\n 'editor.loadError': 'Unable to load the editor.',\n 'editor.maximize': 'Maximize editor',\n 'editor.restore': 'Restore editor',\n 'editor.invalidJson': 'Enter valid JSON.',\n // `{count}` is substituted by the caller, the way the composite summaries do.\n 'editor.languageErrors':\n 'Code contains {count} errors. Review the marked locations in the editor.',\n 'editor.languageError':\n 'Code contains 1 error. Review the marked location in the editor.',\n 'editor.chooseColor': 'Choose a color',\n 'editor.chooseDuration': 'Choose a duration',\n // The color control's entry hint must \"reflect the configured\n // representation\" (spec section 18), so there is one per save format rather\n // than a single `#RRGGBB`. They are syntax rather than prose, but they go\n // through the translator like every other rendered string (Adjustment 6) so\n // a locale that writes its channel names differently can say so. There is no\n // `hsl` entry because there is no `hsl` output; see Adjustment 8.1.\n 'color.placeholder.hex': '#RRGGBB',\n 'color.placeholder.hex3': '#RGB',\n 'color.placeholder.rgb': 'rgb(r, g, b)',\n 'color.placeholder.hsb': 'hsb(h, s%, b%)',\n // Named by the specification itself: the guidance shown when three-digit hex\n // output is selected and the edit would carry transparency.\n 'color.hex3Transparency':\n 'Three-digit hex cannot store transparency. Enter an opaque color, or clear the value.',\n\n // Generic additional-properties editor. The antd package has its own\n // `additionalProperties.*` keys for the renderer it draws; these are the\n // same strings for the unstyled fallback, and are separate because neither\n // package depends on the other.\n 'additionalProperties.add': 'Add',\n 'additionalProperties.addLabel': 'Add property',\n 'additionalProperties.addTo': 'Add property to {label}',\n 'additionalProperties.namePlaceholder': 'Property name',\n 'additionalProperties.rename': 'Rename',\n 'additionalProperties.renameNamed': 'Rename {name}',\n 'additionalProperties.save': 'Save',\n 'additionalProperties.cancel': 'Cancel',\n 'additionalProperties.delete': 'Delete',\n 'additionalProperties.nameTaken': \"Property '{name}' already defined\",\n 'additionalProperties.nameInvalid': \"Property name '{name}' is invalid\",\n 'additionalProperties.namePattern':\n 'Property name must match pattern: {pattern}',\n\n // Template engines, which arrive in their own chunk. Loading and the two\n // failures are separate keys because they send the reader to different\n // places: a chunk that never arrived, or a template that threw.\n 'template.loading': 'Loading template engine…',\n 'template.loadError': 'The template engine could not be loaded.',\n 'template.renderError': 'The template could not be rendered.',\n // The Monaco control's accessible name when the control has no label.\n 'editor.ariaLabel': 'Code editor',\n // Shown under the duration control for text that is not a duration. Names\n // both spellings, since the picker can produce either.\n 'duration.invalid': 'Enter an ISO 8601 duration, for example P2DT3H or P2W.',\n // Shown beside the text when a markup request cannot be honoured. The text\n // is still rendered, so these explain why it looks unformatted rather than\n // standing in for it. `{markup}` is substituted by the caller.\n 'markup.markdownDisabled':\n 'Markdown is turned off for this form, so this text is shown as written.',\n 'markup.unsupported':\n 'Unsupported markup {markup}. This renderer set implements \"plain\" and \"markdown\".',\n // An expression that could not be resolved. `{detail}` carries the\n // evaluator's own message, which names the cause - an unknown identifier, a\n // missing key, a type mismatch - better than anything this layer could\n // invent. Developer-facing, shown beside the text rather than instead of it.\n 'markup.interpolationFailed': 'Could not resolve: {detail}',\n};\n\nexport type ExtendedI18nKey = keyof typeof extendedI18nDefaults;\n","import type { ExtendedLocaleCatalog } from '../util/extendedLocale';\n\n/**\n * Bulgarian for this package's own strings.\n *\n * ```ts\n * import { registerExtendedLocale, bgExtendedLocale } from '@chobantonov/jsonforms-react-extended-renderers';\n * registerExtendedLocale('bg', bgExtendedLocale);\n * ```\n *\n * The `color.placeholder.*` keys are deliberately absent: they are notations\n * (`#RRGGBB`, `rgb(r, g, b)`), not prose, and translating them would show a\n * pattern the control does not accept.\n */\nexport const bgExtendedLocale: ExtendedLocaleCatalog = {\n 'array.addRow': 'Добавяне на ред',\n 'array.removeSelected': 'Премахване на избраните',\n 'grid.loading': 'Таблицата се зарежда...',\n 'grid.loadError': 'Таблицата не може да бъде заредена.',\n 'editor.loading': 'Редакторът се зарежда...',\n 'editor.loadError': 'Редакторът не може да бъде зареден.',\n 'editor.maximize': 'Максимизиране на редактора',\n 'editor.restore': 'Възстановяване на редактора',\n 'editor.invalidJson': 'Въведете валиден JSON.',\n 'editor.chooseColor': 'Изберете цвят',\n 'editor.chooseDuration': 'Изберете продължителност',\n 'template.loading': 'Шаблонният механизъм се зарежда…',\n 'template.loadError': 'Шаблонният механизъм не може да бъде зареден.',\n 'template.renderError': 'Шаблонът не може да бъде изобразен.',\n 'editor.ariaLabel': 'Редактор на код',\n 'duration.invalid':\n 'Въведете продължителност по ISO 8601, например P2DT3H или P2W.',\n 'additionalProperties.add': 'Добавяне',\n 'additionalProperties.addLabel': 'Добавяне на свойство',\n 'additionalProperties.addTo': 'Добавяне на свойство към {label}',\n 'additionalProperties.namePlaceholder': 'Име на свойството',\n 'additionalProperties.rename': 'Преименуване',\n 'additionalProperties.renameNamed': 'Преименуване на {name}',\n 'additionalProperties.save': 'Запазване',\n 'additionalProperties.cancel': 'Отказ',\n 'additionalProperties.delete': 'Изтриване',\n 'additionalProperties.nameTaken': 'Свойството „{name}“ вече е дефинирано',\n 'additionalProperties.nameInvalid': 'Името „{name}“ не е допустимо',\n 'additionalProperties.namePattern':\n 'Името на свойството трябва да съответства на шаблона: {pattern}',\n 'markup.markdownDisabled':\n 'Markdown е изключен за тази форма, затова текстът се показва както е написан.',\n 'markup.unsupported':\n 'Неподдържано маркиране {markup}. Този набор от рендери поддържа „plain“ и „markdown“.',\n 'markup.interpolationFailed': 'Неуспешно изчисляване: {detail}',\n};\n","import { ExtendedI18nKey, extendedI18nDefaults } from './i18nDefaults';\nimport { bgExtendedLocale } from '../locale/bg';\n\n/**\n * Locale bundles for this package's **own** strings - the grid's \"Add row\",\n * the editor's loading and maximize labels, the colour and duration prompts.\n *\n * `extendedI18nDefaults` is one table of English, so those stayed English\n * however `i18n.locale` moved unless the form's catalog carried every key.\n * The antd package has the same mechanism (`rendererLocale.ts`) over its own\n * key space; the two are separate because neither package depends on the\n * other, and each owns the keys it draws.\n *\n * The lookup is synchronous rather than a set of `import()` loaders: these\n * strings are on screen as soon as a renderer mounts, so loading them\n * asynchronously would show English and then swap it out.\n */\nexport type ExtendedLocaleCatalog = Partial<Record<ExtendedI18nKey, string>>;\n\n/** `en` is present and empty on purpose: English *is* the defaults table. */\nexport const defaultExtendedLocales: Record<string, ExtendedLocaleCatalog> = {\n en: {},\n bg: bgExtendedLocale,\n};\n\nlet catalogs: Record<string, ExtendedLocaleCatalog> = defaultExtendedLocales;\n\n/** Replaces the supported set wholesale. */\nexport const setExtendedLocales = (\n next: Record<string, ExtendedLocaleCatalog>,\n): void => {\n catalogs = next;\n};\n\nexport const getExtendedLocales = (): Record<string, ExtendedLocaleCatalog> =>\n catalogs;\n\n/** `bg-BG`, `bg_BG` and `bg` are one locale. */\nconst normalize = (locale: string) => locale.toLowerCase().replace(/_/g, '-');\n\n/** Adds or replaces one language, leaving the others alone. */\nexport const registerExtendedLocale = (\n locale: string,\n catalog: ExtendedLocaleCatalog,\n): void => {\n catalogs = { ...catalogs, [normalize(locale)]: catalog };\n};\n\n/** The catalog for a locale, falling back to its language (`de-AT` -> `de`). */\nexport const resolveExtendedLocale = (\n locale: string | undefined,\n): ExtendedLocaleCatalog | undefined => {\n if (!locale) return undefined;\n const code = normalize(locale);\n return catalogs[code] ?? catalogs[code.split('-')[0]];\n};\n\n/**\n * What a key reads as before the form's own catalog is consulted.\n *\n * Handed to the translator as its *default message*, so the form's catalog\n * still wins where it has the key.\n */\nexport const extendedDefault = (\n locale: string | undefined,\n key: ExtendedI18nKey,\n): string => resolveExtendedLocale(locale)?.[key] ?? extendedI18nDefaults[key];\n","import { useJsonForms } from '@jsonforms/react';\nimport { ExtendedI18nKey } from './i18nDefaults';\nimport { extendedDefault } from './extendedLocale';\n\n/**\n * Translates this package's own strings, and substitutes {name} placeholders.\n *\n * Three sources, in order: the form's own catalog, the locale bundle\n * registered for the current locale, then English. The bundle's string is\n * passed as the translator's *default message*, which is what puts the form's\n * catalog first - see `extendedLocale.ts`.\n */\nexport const useExtendedTranslator = () => {\n const ctx = useJsonForms();\n const translate = ctx.i18n?.translate;\n const locale = ctx.i18n?.locale;\n return (key: ExtendedI18nKey, values?: Record<string, unknown>): string => {\n const fallback = extendedDefault(locale, key);\n const message = translate ? translate(key, fallback, values) : fallback;\n return Object.entries(values ?? {}).reduce(\n (text, [name, value]) => text.replace(`{${name}}`, String(value)),\n message ?? fallback,\n );\n };\n};\n","import React, { Suspense, lazy } from 'react';\nimport { ExtendedI18nKey } from './i18nDefaults';\nimport { useExtendedTranslator } from './useExtendedTranslator';\n\n/**\n * Defers a template engine's compiler until a template is actually rendered.\n *\n * Both engines carry a heavyweight dependency at module scope - Sucrase for\n * the JSX profile, Ractive for the Ractive one - and a form with no\n * `TemplateLayout` in it should download neither. `React.lazy` puts each\n * behind its own chunk, the same arrangement the AG Grid and Monaco controls\n * already use.\n *\n * Selection happens in the **tester**, so only the engine an element actually\n * asks for is ever fetched: a form of `lang: \"ractive\"` templates never loads\n * Sucrase, and vice versa.\n */\n\n/**\n * Suspense has no error path of its own, so a boundary catches import failures.\n *\n * It catches **render** failures too, which is not the same thing and must not\n * be reported as if it were: a template that throws while React reconciles its\n * output used to surface as \"The template engine could not be loaded\", which\n * sends the reader to look at chunks and network tabs instead of at their\n * template. `loaded` says which of the two happened.\n */\nclass LoadBoundary extends React.Component<\n React.PropsWithChildren<{ describe: () => React.ReactNode }>,\n { failed: boolean }\n> {\n state = { failed: false };\n static getDerivedStateFromError() {\n return { failed: true };\n }\n componentDidCatch(error: Error) {\n // oxlint-disable-next-line no-console\n console.error('template.failed:', error);\n }\n render() {\n return this.state.failed ? this.props.describe() : this.props.children;\n }\n}\n\n/**\n * Translation **keys**, not text.\n *\n * The labels are chosen where `createLazyTemplate` is called, which is module\n * scope - no hook can run there, and text fixed at module scope is text that\n * cannot follow the locale. Naming the keys here and translating them inside\n * the component is what lets these three strings be translated at all.\n */\nexport interface LazyTemplateLabels {\n loading: ExtendedI18nKey;\n /** Shown when the engine's chunk itself could not be fetched. */\n error: ExtendedI18nKey;\n /** Shown when the engine loaded and the template then threw. */\n renderError?: ExtendedI18nKey;\n}\n\nexport const createLazyTemplate = <P extends object>(\n load: () => Promise<React.ComponentType<P>>,\n labels: LazyTemplateLabels,\n): React.ComponentType<P> => {\n /*\n Module scope, so it survives a remount: once the chunk is in, a later\n failure can only be the template's own.\n */\n let loaded = false;\n // Created once per module, not per render, so the chunk is fetched once.\n const Lazy = lazy(async () => {\n const component = await load();\n loaded = true;\n return { default: component };\n });\n const LazyTemplate = (props: P) => {\n const t = useExtendedTranslator();\n return (\n <LoadBoundary\n describe={() => (\n <div\n role='alert'\n data-template-load-error={loaded ? undefined : true}\n data-template-render-error={loaded ? true : undefined}\n >\n {t(\n loaded\n ? (labels.renderError ?? 'template.renderError')\n : labels.error,\n )}\n </div>\n )}\n >\n <Suspense\n fallback={\n <div aria-busy='true' aria-live='polite' data-template-loading>\n {t(labels.loading)}\n </div>\n }\n >\n {/* The generic defeats React.lazy's prop inference; the call sites are typed. */}\n <Lazy {...(props as any)} />\n </Suspense>\n </LoadBoundary>\n );\n };\n // Named so React DevTools and the lint rule both have something to show.\n LazyTemplate.displayName = 'LazyTemplate';\n return LazyTemplate;\n};\n","import { JSONFORMS_EXTENDED_CONFIG_KEY } from './configNamespaces';\n\n/**\n * Which URLs a URL-bearing element may navigate to or load.\n *\n * Section 12 of the specification makes this a MUST for every URL-bearing\n * value - `Link.href`, `ImageView.src`, Markdown links and images - and fixes\n * the defaults below for when no configuration is supplied.\n */\nexport interface UrlPolicy {\n allowedSchemes: string[];\n allowRelative: boolean;\n allowImageDataUrls: boolean;\n}\n\nexport const defaultUrlPolicy: UrlPolicy = {\n allowedSchemes: ['https', 'http', 'mailto'],\n allowRelative: true,\n allowImageDataUrls: false,\n};\n\n/** Reads `config.jsonformsExtended.security.urlPolicy`, filling in defaults. */\nexport const resolveUrlPolicy = (config: unknown): UrlPolicy => {\n const extended = (config as Record<string, unknown> | undefined)?.[\n JSONFORMS_EXTENDED_CONFIG_KEY\n ] as Record<string, unknown> | undefined;\n const security = extended?.security as Record<string, unknown> | undefined;\n const supplied = security?.urlPolicy as Partial<UrlPolicy> | undefined;\n if (!supplied) {\n return defaultUrlPolicy;\n }\n return {\n allowedSchemes: Array.isArray(supplied.allowedSchemes)\n ? supplied.allowedSchemes.map((scheme) => String(scheme).toLowerCase())\n : defaultUrlPolicy.allowedSchemes,\n allowRelative:\n supplied.allowRelative === undefined\n ? defaultUrlPolicy.allowRelative\n : supplied.allowRelative === true,\n allowImageDataUrls:\n supplied.allowImageDataUrls === undefined\n ? defaultUrlPolicy.allowImageDataUrls\n : supplied.allowImageDataUrls === true,\n };\n};\n\n/** `scheme:` at the start of a URL. Deliberately strict about what counts. */\nconst SCHEME = /^([a-zA-Z][a-zA-Z0-9+.-]*):/;\n\n/**\n * Whether a URL may be used, under the supplied policy.\n *\n * A URL with no scheme is relative and governed by `allowRelative`. A URL with\n * a scheme must name one the policy allows - so `javascript:`, `data:` and\n * `vbscript:` are refused by default rather than being rendered into an\n * anchor. Protocol-relative `//host/path` counts as absolute, because it\n * inherits the page's scheme and can leave the origin.\n *\n * Leading control characters and whitespace are stripped before the test:\n * `java\\\\nscript:alert(1)` is a scheme, and browsers treat it as one.\n */\nexport const isAllowedUrl = (\n url: unknown,\n policy: UrlPolicy = defaultUrlPolicy,\n): boolean => {\n if (typeof url !== 'string') {\n return false;\n }\n // oxlint-disable-next-line no-control-regex\n const candidate = url.replace(/[\\u0000- ]/g, '');\n if (candidate === '') {\n // An empty href is explicitly allowed by section 13; the Link renderer\n // gives it non-navigating semantics rather than inventing a destination.\n return true;\n }\n if (candidate.startsWith('//')) {\n return false;\n }\n const scheme = SCHEME.exec(candidate)?.[1]?.toLowerCase();\n if (scheme === undefined) {\n return policy.allowRelative;\n }\n return policy.allowedSchemes.includes(scheme);\n};\n\n/** `data:image/<subtype>;...` - an inline image, and nothing else. */\nconst IMAGE_DATA_URL = /^data:image\\/[a-zA-Z0-9.+-]+[;,]/;\n\n/**\n * Whether a URL may be **loaded as an image**.\n *\n * Same policy as {@link isAllowedUrl}, plus `allowImageDataUrls`: a\n * `data:image/...` URL is a reasonable way to inline a small asset, and is\n * nothing like a `data:text/html` document handed to a link. The flag only\n * opens inline *images* - a `data:` URL of any other media type stays refused\n * whatever it is used for, so turning this on cannot become a way to smuggle\n * a document in.\n *\n * It is off by default, because an inline payload bypasses whatever CSP\n * `img-src` allow-list the host maintains.\n */\nexport const isAllowedImageUrl = (\n url: unknown,\n policy: UrlPolicy = defaultUrlPolicy,\n): boolean => {\n if (\n policy.allowImageDataUrls &&\n typeof url === 'string' &&\n // oxlint-disable-next-line no-control-regex\n IMAGE_DATA_URL.test(url.replace(/[\\u0000- ]/g, ''))\n ) {\n return true;\n }\n return isAllowedUrl(url, policy);\n};\n","import {\n useDynamicElements,\n useDynamicExternal,\n} from '@chobantonov/jsonforms-react-renderer-common/dynamic/DynamicUiProvider';\nimport {\n LayoutProps,\n RankedTester,\n rankWith,\n UISchemaElement,\n uiTypeIs,\n} from '@jsonforms/core';\nimport { JsonFormsDispatch, useJsonForms } from '@jsonforms/react';\nimport React, { useEffect, useMemo } from 'react';\nimport { proxy } from 'valtio';\nimport { resolveChildNames } from '../util/childNames';\nimport { buildFormContext } from '../util/formContext';\nimport {\n TemplateLayoutElement,\n resolveTemplateEngine,\n} from '../util/templateLang';\nimport { TemplateDiagnostic } from './templateEngines';\nimport { ElementRender } from '../components/elementRender';\nimport { createLazyTemplate } from '../util/lazyTemplate';\nimport { UrlPolicy, resolveUrlPolicy } from '../util/urlPolicy';\n\n/*\n The JSX engine is behind its own chunk: `DynamicJSXRenderer` imports Sucrase\n at module scope, and a form with no jsx template should not download a\n compiler. Only the marker symbol is imported eagerly, which is why it lives\n in a module of its own.\n*/\nconst DynamicJSXRenderer = createLazyTemplate<{\n jsxTemplate: string;\n props: Record<string, unknown>;\n urlPolicy: UrlPolicy;\n}>(async () => (await import('../components/DynamicJSXRenderer')).default, {\n loading: 'template.loading',\n error: 'template.loadError',\n renderError: 'template.renderError',\n});\n\nexport interface TemplateLayoutProps extends LayoutProps {\n uischema: TemplateLayoutElement;\n components?: Record<string, React.ComponentType<any>>;\n}\n\ntype RenderableElementProps = Pick<\n TemplateLayoutProps,\n 'schema' | 'enabled' | 'renderers' | 'cells'\n> & {\n path?: string;\n uischema: UISchemaElement;\n};\n\n/**\n * Default tester for a template layout.\n * @type {RankedTester}\n */\nexport const templateRendererTester: RankedTester = rankWith(\n 1,\n uiTypeIs('TemplateLayout'),\n);\n\n/**\n * Default renderer for a template layout.\n */\nconst TemplateElementControl = React.memo(function TemplateElementControl(\n props: RenderableElementProps,\n) {\n return <JsonFormsDispatch {...props} />;\n});\n\nexport const TemplateLayoutRenderer = ({\n path,\n enabled,\n schema,\n uischema,\n visible,\n renderers,\n cells,\n config,\n components = {}, // Default to an empty object\n}: TemplateLayoutProps) => {\n /*\n The `lang: \"jsx\"` profile. It compiles the template with Sucrase and\n evaluates it through `new Function`, which the portable contract calls\n string evaluation - so it runs only when the host has permitted it:\n \"String evaluation requires\n jsonformsExtended.security.allowScriptEvaluation=true.\"\n\n Reported rather than silently skipped, because a blank region where a\n template should be is indistinguishable from a broken template.\n */\n const engine = resolveTemplateEngine(uischema, config);\n\n const template = uischema.template;\n const effectiveChildren = useDynamicElements(\n uischema.elements ?? [],\n path ?? '',\n );\n\n const { names: childNames, diagnostics: nameDiagnostics } = useMemo(\n () => resolveChildNames(uischema.elements),\n [uischema.elements],\n );\n\n useEffect(() => {\n for (const diagnostic of nameDiagnostics) {\n // oxlint-disable-next-line no-console\n console.warn(diagnostic);\n }\n }, [nameDiagnostics]);\n\n /*\n The array a template receives as `elements`.\n\n Its items are the **elements themselves**, not wrappers. A template may\n render the whole array - `{elements}` mounts every child in order - so an\n item has to be something the JSX engine's `createElement` can process,\n which means the object carrying `[ElementRender]`. Returning\n `{ element, name }` here instead made `{elements}` throw \"Objects are not\n valid as a React child\", and the name belongs beside the array anyway\n because `childNames` already holds it positionally.\n */\n const namedElements = useMemo(() => {\n const elements = effectiveChildren;\n\n return elements.map((element, index) => {\n /*\n The name is computed, never written back. This used to do\n `element.name = index.toString()`, which mutates the **authored** UI\n schema - section 22 forbids that, and because JSON Forms holds one\n element object, a second form sharing the same schema inherited the\n first one's generated names.\n */\n const name = childNames[index];\n\n /*\n A child with no resolvable name is unaddressable, not unrenderable: it\n still has a position, so `{elements}` must mount it. The renderable is\n therefore keyed by something unique per position, and only a real name\n reaches `elementsByName` below.\n */\n const key = name ?? `\\u0000unnamed:${index}`;\n\n return {\n ...element,\n [ElementRender]: function TemplateElement() {\n return (\n <TemplateElementControl\n key={key}\n path={path}\n schema={schema}\n enabled={enabled}\n renderers={renderers}\n cells={cells}\n uischema={element}\n />\n );\n },\n };\n });\n }, [cells, enabled, renderers, schema, effectiveChildren, childNames, path]);\n\n const elementsByName = useMemo(() => {\n const map: Record<string, any> = {};\n namedElements.forEach((element, index) => {\n const name = childNames[index];\n if (name !== undefined) {\n map[name] = element;\n }\n });\n return map;\n }, [namedElements, childNames]);\n\n const proxyElements = useMemo(() => {\n return new Proxy(namedElements, {\n get(target, prop: string | symbol) {\n if (typeof prop === 'string' && elementsByName[prop]) {\n return elementsByName[prop];\n }\n return Reflect.get(target, prop);\n },\n });\n }, [namedElements, elementsByName]);\n\n const ctx = useJsonForms();\n const external = useDynamicExternal();\n\n // Create a stable proxy that gets updated with new data\n const [{ dataProxy, errorsProxy, additionalErrorsProxy }] = React.useState(\n () => {\n const dataProxy = proxy({ __val__: ctx.core?.data });\n const errorsProxy = proxy({ __val__: ctx.core?.errors });\n const additionalErrorsProxy = proxy({\n __val__: ctx.core?.additionalErrors,\n });\n return { dataProxy, errorsProxy, additionalErrorsProxy };\n },\n );\n\n // Update proxies efficiently\n useEffect(() => {\n const updateProxy = (proxyTarget: any, newValue: any) => {\n if (newValue === null || newValue === undefined) {\n proxyTarget.__val__ = newValue;\n return;\n }\n\n if (proxyTarget.__val__ === null || proxyTarget.__val__ === undefined) {\n proxyTarget.__val__ = newValue;\n return;\n }\n\n const deepMerge = (target: any, source: any) => {\n if (source === null || source === undefined) {\n return;\n }\n\n if (Array.isArray(source)) {\n if (!Array.isArray(target)) {\n // Replace with new array if target isn't an array\n return source;\n }\n // For arrays, properly merge without initially truncating\n source.forEach((item: any, index: number) => {\n if (item && typeof item === 'object' && !Array.isArray(item)) {\n // For objects in arrays, preserve existing object if it exists and is an object\n if (\n !target[index] ||\n typeof target[index] !== 'object' ||\n Array.isArray(target[index])\n ) {\n target[index] = {};\n }\n const result = deepMerge(target[index], item);\n if (result !== undefined) {\n target[index] = result;\n }\n } else if (Array.isArray(item)) {\n // For nested arrays, preserve existing array if it exists and is an array\n if (!Array.isArray(target[index])) {\n target[index] = [];\n }\n const result = deepMerge(target[index], item);\n if (result !== undefined) {\n target[index] = result;\n }\n } else {\n // For primitives, just assign\n target[index] = item;\n }\n });\n\n // Remove extra items from target array to match source length\n if (target.length > source.length) {\n target.splice(source.length);\n }\n return;\n }\n\n if (typeof source === 'object' && !Array.isArray(source)) {\n if (typeof target !== 'object' || Array.isArray(target)) {\n // Replace with new object if target isn't an object\n return source;\n }\n\n Object.keys(source).forEach((key) => {\n if (\n source[key] &&\n typeof source[key] === 'object' &&\n !Array.isArray(source[key])\n ) {\n // Preserve existing object if it exists and is an object (not array)\n if (\n !target[key] ||\n typeof target[key] !== 'object' ||\n Array.isArray(target[key])\n ) {\n target[key] = {};\n }\n const result = deepMerge(target[key], source[key]);\n if (result !== undefined) {\n target[key] = result;\n }\n } else {\n target[key] = source[key];\n }\n });\n return;\n }\n\n // For primitives, just return the new value\n return source;\n };\n\n const result = deepMerge(proxyTarget.__val__, newValue);\n if (result !== undefined) {\n proxyTarget.__val__ = result;\n }\n };\n\n updateProxy(dataProxy, ctx.core?.data);\n updateProxy(errorsProxy, ctx.core?.errors);\n updateProxy(additionalErrorsProxy, ctx.core?.additionalErrors);\n }, [\n ctx.core?.data,\n ctx.core?.errors,\n ctx.core?.additionalErrors,\n dataProxy,\n errorsProxy,\n additionalErrorsProxy,\n ]);\n\n const rendererProps = useMemo(\n () => ({\n elements: proxyElements,\n schema: schema,\n uischema: uischema,\n data: dataProxy,\n errors: errorsProxy,\n additionalErrors: additionalErrorsProxy,\n translate: ctx.i18n?.translate,\n locale: ctx.i18n?.locale,\n // Section 13's `context (extended FormContext)`, which this profile was\n // not exposing at all. The flat `locale` stays for templates using it.\n context: buildFormContext({\n ctx: ctx as any,\n schema,\n uischema,\n external,\n }),\n // Pass the generic components prop to the renderer\n ...components,\n }),\n [\n proxyElements,\n schema,\n uischema,\n dataProxy,\n errorsProxy,\n additionalErrorsProxy,\n ctx,\n components,\n external,\n ],\n );\n\n if (!visible) return null;\n\n // Dynamically destructure based on passed props\n const destructuringAssignment = `const { ${Object.keys(rendererProps)\n .filter((k) => !['data', 'errors', 'additionalErrors'].includes(k)) // remove these\n .join(', ')} } = props;`;\n\n const jsxTemplate = `\nfunction Template(props) {\n ${destructuringAssignment}\n\n const data = useTrackedSnapshot(props.data);\n const errors = useTrackedSnapshot(props.errors);\n const additionalErrors = useTrackedSnapshot(props.additionalErrors);\n\n return (\n <React.Fragment>\n ${template.replace(/<\\s*\\/\\s*React\\.Fragment\\s*>/g, '')}\n </React.Fragment>\n );\n}\n`;\n\n if (engine.diagnostic) {\n return (\n <TemplateDiagnostic\n uischema={uischema}\n config={config}\n visible={visible}\n />\n );\n }\n\n return (\n <DynamicJSXRenderer\n jsxTemplate={jsxTemplate}\n props={rendererProps}\n /*\n Section 12's policy, resolved from the form's config and handed to the\n pragma. A template's `href={data.url}` is a URL-bearing value like any\n other; it was the one that had never been checked.\n */\n urlPolicy={resolveUrlPolicy(config)}\n />\n );\n};\n","import { useDynamicExternal } from '@chobantonov/jsonforms-react-renderer-common/dynamic/DynamicUiProvider';\nimport { LayoutProps } from '@jsonforms/core';\nimport { JsonFormsDispatch, useJsonForms } from '@jsonforms/react';\nimport React, { useEffect, useMemo } from 'react';\nimport { createLazyTemplate } from '../util/lazyTemplate';\nimport type { RactiveTemplateProps } from '../components/RactiveTemplate';\n\n/*\n Ractive is ~100KB and is imported at module scope by the template component,\n so it is fetched only when a `lang: \"ractive\"` element actually renders.\n*/\nconst RactiveTemplate = createLazyTemplate<RactiveTemplateProps>(\n async () => (await import('../components/RactiveTemplate')).RactiveTemplate,\n {\n loading: 'template.loading',\n error: 'template.loadError',\n renderError: 'template.renderError',\n },\n);\nimport {\n ractiveTransitionAttributes,\n resolveChildNames,\n useNamedChildren,\n} from '../util/childNames';\nimport { buildFormContext } from '../util/formContext';\nimport { resolveUrlPolicy } from '../util/urlPolicy';\nimport {\n TemplateLayoutElement,\n resolveTemplateEngine,\n} from '../util/templateLang';\nimport { TemplateDiagnostic } from './templateEngines';\n\n/**\n * The `lang: \"ractive\"` profile - the specification's default web profile, and\n * the one the Svelte renderer family implements.\n *\n * Children are **partials**: `{{> body}}` renders the child named `body`.\n * Ractive cannot host a React subtree, so each partial resolves to a\n * placeholder element that React then portals the delegated renderer into. The\n * partial registry is generated from the child names rather than authored, so\n * a template never has to know about the placeholder attribute.\n *\n * The bindings are the ones the specification names: `data` (whole-form data),\n * `errors` (core schema errors), `context`, `elements` and `translate`.\n */\n\nconst SLOT_ATTR = 'data-jsonforms-slot';\n\nexport const RactiveTemplateLayoutRenderer = (\n props: LayoutProps & { uischema: TemplateLayoutElement },\n) => {\n const { uischema, schema, path, enabled, visible, renderers, cells, config } =\n props;\n const ctx = useJsonForms();\n const external = useDynamicExternal();\n const resolved = resolveTemplateEngine(uischema, config);\n\n const { children, names, diagnostics } = useNamedChildren(uischema.elements);\n\n const nameKey = JSON.stringify(names);\n\n /*\n Reported to the author rather than rendered: a child that cannot be\n addressed is a mistake in the UI schema, and the person filling in the\n form can do nothing about it. Same precedent as `Categorization`'s\n `initial` (adjustment 10.5).\n */\n useEffect(() => {\n for (const diagnostic of diagnostics) {\n // oxlint-disable-next-line no-console\n console.warn(diagnostic);\n }\n }, [diagnostics]);\n\n /*\n An attribute Ractive will eat as a transition directive. This profile\n registers no transitions, so it does nothing except disappear - and\n disappearing silently is how an hour goes missing.\n */\n const template = uischema.template ?? '';\n useEffect(() => {\n const eaten = ractiveTransitionAttributes(template);\n if (eaten.length > 0) {\n // oxlint-disable-next-line no-console\n console.warn(\n `template.ractiveTransitionAttribute: ${JSON.stringify(\n eaten,\n )} end in -in, -out or -in-out, which Ractive parses as transition directives. This profile registers no transitions, so they are dropped from the DOM. Rename them.`,\n );\n }\n }, [template]);\n\n /* One placeholder partial per child, so `{{> body}}` resolves. */\n const partials = useMemo(() => {\n const map: Record<string, string> = {};\n for (const name of JSON.parse(nameKey) as (string | null)[]) {\n if (name !== null) {\n map[name] = `<div ${SLOT_ATTR}=\"${name}\"></div>`;\n }\n }\n return map;\n }, [nameKey]);\n\n const slots = useMemo(() => {\n const map: Record<string, React.ReactNode> = {};\n const childNames = resolveChildNames(children).names;\n children.forEach((element, index) => {\n const name = childNames[index];\n if (name === undefined) {\n return;\n }\n map[name] = (\n <JsonFormsDispatch\n uischema={element}\n schema={schema}\n path={path}\n enabled={enabled}\n renderers={renderers}\n cells={cells}\n />\n );\n });\n return map;\n }, [children, schema, path, enabled, renderers, cells]);\n\n /*\n Rebuilt whenever a binding changes; the template component turns that into\n a keypath `set`, which is the surgical half. The object identity is the\n signal, the values inside are what Ractive diffs.\n */\n const bindings = useMemo(\n () => ({\n data: ctx.core?.data,\n errors: ctx.core?.errors,\n context: buildFormContext({\n ctx: ctx as any,\n schema,\n uischema,\n external,\n }),\n elements: resolveChildNames(uischema.elements ?? [])\n .names.filter((name): name is string => name !== undefined)\n .map((name) => ({ name })),\n translate: (key: string, fallback?: string) =>\n ctx.i18n?.translate?.(key, fallback) ?? fallback ?? key,\n }),\n [ctx, schema, uischema, external],\n );\n\n if (visible === false) {\n return null;\n }\n if (resolved.diagnostic) {\n return (\n <TemplateDiagnostic\n uischema={uischema}\n config={config}\n visible={visible}\n />\n );\n }\n\n return (\n <RactiveTemplate\n template={template}\n partials={partials}\n data={bindings}\n slots={slots}\n urlPolicy={resolveUrlPolicy(config)}\n />\n );\n};\n","import React from 'react';\nimport { UISchemaElement } from '@jsonforms/core';\n\nexport type ActionEvent = {\n action: string;\n label: string;\n /**\n * `params` from the element, passed through untouched.\n *\n * Section 14 makes this a top-level field on `Button`, and it is how one\n * command serves several buttons - `setLocale` with `{ \"locale\": \"bg\" }`\n * rather than a `setLocaleBg` action per language.\n */\n params?: Record<string, unknown>;\n /** The UI schema element that triggered the action. */\n element: UISchemaElement;\n /**\n * The JSON Forms context, reachable from a `script` as `this.context`.\n */\n context?: unknown;\n};\n\nexport type HandleAction = (event: ActionEvent) => void | Promise<void>;\n\nexport const HandleActionContext = React.createContext<\n HandleAction | undefined\n>(undefined);\n\nexport const useHandleAction = () => React.useContext(HandleActionContext);\n","import {\n useDynamicElements,\n useDynamicExternal,\n} from '@chobantonov/jsonforms-react-renderer-common/dynamic/DynamicUiProvider';\nimport {\n Actions,\n JsonSchema,\n LayoutProps,\n RankedTester,\n Translator,\n and,\n rankWith,\n uiTypeIs,\n} from '@jsonforms/core';\nimport {\n JsonFormsDispatch,\n useJsonForms,\n withJsonFormsLayoutProps,\n} from '@jsonforms/react';\nimport React, { useCallback, useEffect, useMemo } from 'react';\nimport type { ExtendedUISchemaElement } from '../core/uiSchema';\nimport { useNamedChildren } from '../util/childNames';\nimport { buildFormContext, type FormContext } from '../util/formContext';\nimport { useHandleAction } from '../util/actionContext';\nimport { UrlPolicy, resolveUrlPolicy } from '../util/urlPolicy';\nimport type { TemplateLayoutElement } from '../util/templateLang';\n\n/**\n * A `TemplateLayout` whose template is a **function**, not a string.\n *\n * The same element, authored in TypeScript instead of serialized. Nothing is\n * compiled from a string, so there is no parser and - importantly - **no\n * `allowScriptEvaluation`**: the permission exists because string evaluation\n * needs CSP `unsafe-eval`, and a function the build already compiled needs\n * nothing of the sort. A TSX template is strictly the safer of the two forms.\n *\n * It is not portable, and that is the deal: a function cannot be serialized,\n * so a form carrying one cannot be sent over the wire. The portable\n * `TemplateLayoutElement.template` stays a `string`; only the React-specific\n * `ReactTemplateLayoutElement` widens it.\n */\n\n/** What a `Slot` receives. `children` is the fallback, per section 13. */\nexport interface SlotProps {\n name: string;\n children?: React.ReactNode;\n}\n\n/**\n * Everything a TSX template is handed.\n *\n * Deliberately close to what the string engines expose, so the three forms\n * stay one idea - plus the pieces a function can actually use: the element\n * definitions for inspection, a guarded write, and the layout's own schema\n * and path.\n */\nexport interface TemplateRenderProps<T = unknown> {\n /** The whole form's data, as the string engines' `data` binding. */\n data: T;\n /** Where this layout sits, for addressing a write. */\n path: string;\n /** Core schema errors, unfiltered. */\n errors: unknown[];\n /** The schema at this layout's path. */\n schema: JsonSchema;\n /** This element, for its own `options`. */\n uischema: TemplateLayoutElement;\n /**\n * The child **elements**, by name - the definitions, not rendered output.\n * Read `.type`, `.scope`, `.options`, or reach a layout's own `.elements`.\n */\n elements: Record<string, ExtendedUISchemaElement>;\n /** Places a named child, with optional fallback content. */\n Slot: (props: SlotProps) => React.ReactElement | null;\n /** False when the form or this subtree is disabled or read-only. */\n enabled: boolean;\n /**\n * True when the form is read-only.\n *\n * Distinct from `enabled` on purpose. A read-only form sets `enabled` to\n * false as well, but the two mean different things to a widget: *disabled*\n * is \"not available right now\", *read-only* is \"display this, do not edit\n * it\" - and the second often wants text rather than a greyed-out input.\n */\n readonly: boolean;\n /**\n * Writes through the normal change dispatch.\n *\n * Section 13 requires that a template's two-way binding \"must not bypass\n * readonly/restrict or normal form change dispatch\", so this is a no-op\n * while `enabled` is false. It does **not** know about `restrict`, which is\n * per-renderer and has no shared guard a layout can consult - a template can\n * still write past an array's `maxItems`. Recorded rather than pretended\n * away.\n */\n handleChange: (path: string, value: unknown) => void;\n translate: Translator;\n /**\n * Section 12's URL policy, resolved from the form's config.\n *\n * **This profile has to apply it itself**, and that is not an oversight.\n * The string engines route every element through a `createElement` pragma\n * this package owns, so an `href` carrying `javascript:` is dropped before\n * the element exists. A TSX template is compiled by the *build*, with\n * React's own pragma, and there is nothing to intercept.\n *\n * The distinction is real: a string template is **data** and may arrive with\n * the form; a TSX template is **code** in this repository, which can already\n * do anything. What is still data either way is the *value* - so a template\n * writing `href={data.url}` should pass it through\n * `isAllowedUrl(url, urlPolicy)` first, which is why the policy is handed\n * over here rather than left to be imported and resolved again.\n */\n urlPolicy: UrlPolicy;\n /** Section 3's `FormContext`, in full. */\n context: FormContext;\n}\n\nexport type TemplateRender<T = unknown> = (\n props: TemplateRenderProps<T>,\n) => React.ReactNode;\n\n/** The React-only element: `template` may be a function here. */\nexport type ReactTemplateLayoutElement<T = unknown> = Omit<\n TemplateLayoutElement,\n 'template'\n> & { template: string | TemplateRender<T> };\n\n/**\n * Selected by the **shape of `template`**, not by `lang`.\n *\n * A function is not written in a template language, so routing it through\n * `lang` would be the wrong axis - and it must win over the string engines,\n * which a shared `uiTypeIs('TemplateLayout')` alone would not guarantee.\n */\nexport const tsxTemplateLayoutTester: RankedTester = rankWith(\n 5,\n and(\n uiTypeIs('TemplateLayout'),\n (uischema) =>\n typeof (uischema as { template?: unknown } | undefined)?.template ===\n 'function',\n ),\n);\n\ntype SlotContextValue = Pick<\n LayoutProps,\n 'schema' | 'path' | 'enabled' | 'renderers' | 'cells'\n> & {\n byName: Record<string, ExtendedUISchemaElement>;\n};\nconst SlotContext = React.createContext<SlotContextValue | undefined>(\n undefined,\n);\nconst Slot = ({ name, children: fallback }: SlotProps) => {\n const current = React.useContext(SlotContext);\n const element = current?.byName[name];\n if (!current || !element) {\n // oxlint-disable-next-line no-console\n console.warn(\n `template.unknownSlot: no child is named ${JSON.stringify(name)}; known names are ${JSON.stringify(Object.keys(current?.byName ?? {}))}.`,\n );\n return <>{fallback ?? null}</>;\n }\n return (\n <JsonFormsDispatch\n uischema={element}\n schema={current.schema}\n path={current.path}\n enabled={current.enabled}\n renderers={current.renderers}\n cells={current.cells}\n />\n );\n};\n\nexport const TsxTemplateLayoutRendererComponent = (\n props: LayoutProps & { uischema: ReactTemplateLayoutElement },\n) => {\n const { uischema, schema, path, enabled, visible, renderers, cells } = props;\n const ctx = useJsonForms();\n const external = useDynamicExternal();\n const fireActionEvent = useHandleAction();\n\n const { children, names, diagnostics } = useNamedChildren(uischema.elements);\n\n useEffect(() => {\n for (const diagnostic of diagnostics) {\n // oxlint-disable-next-line no-console\n console.warn(diagnostic);\n }\n }, [diagnostics]);\n\n const effectiveChildren = useDynamicElements(children, path ?? '');\n const byName = useMemo(() => {\n const map: Record<string, ExtendedUISchemaElement> = {};\n effectiveChildren.forEach((element, index) => {\n const name = names[index];\n if (name !== undefined) {\n map[name] = element;\n }\n });\n return map;\n }, [effectiveChildren, names]);\n\n const handleChange = useCallback(\n (target: string, value: unknown) => {\n if (enabled === false) {\n return;\n }\n ctx.dispatch?.(Actions.update(target, () => value));\n },\n [ctx, enabled],\n );\n\n if (visible === false) {\n return null;\n }\n\n const template = uischema.template;\n if (typeof template !== 'function') {\n // The tester guarantees otherwise; this keeps the type honest.\n return null;\n }\n\n return (\n <SlotContext.Provider\n value={{ byName, schema, path, enabled, renderers, cells }}\n >\n {template({\n data: ctx.core?.data,\n path: path ?? '',\n errors: ctx.core?.errors ?? [],\n schema,\n uischema: uischema as TemplateLayoutElement,\n elements: byName,\n Slot,\n enabled: enabled !== false,\n readonly: (ctx as { readonly?: boolean }).readonly === true,\n handleChange,\n translate: (ctx.i18n?.translate ??\n ((key: string) => key)) as Translator,\n urlPolicy: resolveUrlPolicy((ctx as { config?: unknown }).config),\n context: buildFormContext({\n ctx: ctx as any,\n schema,\n uischema,\n fireActionEvent,\n external,\n }),\n })}\n </SlotContext.Provider>\n );\n};\n\nexport const TsxTemplateLayoutRenderer = withJsonFormsLayoutProps(\n TsxTemplateLayoutRendererComponent as any,\n);\n","import { useI18n } from '@chobantonov/jsonforms-react-renderer-common/locale/translate';\nimport React, {\n useMemo,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport {\n BaseUISchemaElement,\n LayoutProps,\n RankedTester,\n UISchemaElement,\n deriveLabelForUISchemaElement,\n rankWith,\n uiTypeIs,\n} from '@jsonforms/core';\nimport {\n TranslateProps,\n useJsonForms,\n withJsonFormsLayoutProps,\n withTranslateProps,\n} from '@jsonforms/react';\nimport { useHandleAction, type ActionEvent } from '../util/actionContext';\nimport { allowsScriptEvaluation } from '../util/templateLang';\n\n/**\n * `Button` - invoking a command, as opposed to `Link`, which navigates.\n *\n * Section 14 puts `label`, `icon`, `color`, `params`, `action` and `script`\n * at the **top level** of the element. `options` is still read underneath\n * them, because forms in this repository were authored that way.\n *\n * `action` and `script` are mutually exclusive. The action path hands an\n * `ActionEvent` to the host and awaits it; the script path runs a string\n * directly and is gated on the script-evaluation permission.\n */\n\nexport type ButtonSemanticColor =\n | 'primary'\n | 'secondary'\n | 'alternative'\n | 'success'\n | 'warning'\n | 'error';\n\n/**\n * A `script` written in TypeScript rather than serialized.\n *\n * The event arrives as the **first argument**. `this` is bound to it as well,\n * so a body pasted across from the string form keeps working - but an\n * argument is the idiom, because `.call()` cannot bind an arrow function's\n * `this` and an arrow is what anyone writes by reflex:\n *\n * ```ts\n * script: (event) => console.log(event.context) // works\n * script: function () { console.log(this.context); } // also works\n * script: () => console.log(this.context) // `this` is undefined\n * ```\n *\n * Section 14 places function-valued scripts outside the portable model, so\n * this is a build-time authoring convenience and never appears on the wire.\n */\nexport type ButtonScript =\n | string\n | ((this: ActionEvent, event: ActionEvent) => void | Promise<void>);\n\n/*\n Built on `BaseUISchemaElement`, **not** `UISchemaElement`.\n\n In this core version `UISchemaElement` is a *union* of nine types, so\n intersecting it distributes across all of them - the XOR below would become\n twenty-seven members, TypeScript would report a mismatch against whichever\n it tried last (`HorizontalLayout`, typically), and an author would be told\n their Button was missing `elements`. `BaseUISchemaElement` is the single\n interface those nine share, and a Button is assignable to `UISchemaElement`\n through it either way.\n\n The literal `type: 'Button'` is the discriminant that lets TypeScript pick\n the right member and say something useful when it cannot.\n*/\nexport type ButtonUiSchemaBase = BaseUISchemaElement & {\n type: 'Button';\n label?: string;\n text?: string;\n name?: string;\n icon?: string;\n color?: ButtonSemanticColor;\n params?: Record<string, unknown>;\n options?: {\n disabled?: boolean;\n fullWidth?: boolean;\n [key: string]: unknown;\n };\n};\n\n/**\n * `action` and `script` are **mutually exclusive**, and the type says so.\n *\n * Section 14 states the exclusivity without saying which wins, because an\n * element carrying both is an authoring mistake. The `never` members make it\n * one TypeScript refuses to compile; the runtime still has to cope, because\n * JSON-authored forms never pass through this type.\n */\nexport type ButtonUiSchema =\n | (ButtonUiSchemaBase & { action: string; script?: never })\n | (ButtonUiSchemaBase & { script: ButtonScript; action?: never })\n | (ButtonUiSchemaBase & { action?: never; script?: never });\n\nexport type ButtonRendererComponentProps = LayoutProps &\n TranslateProps & {\n uischema: ButtonUiSchema;\n };\n\nexport type ButtonRendererOptions = {\n /** Return the component before JSON Forms prop injection for native adapter exports. */\n withProps?: boolean;\n ButtonComponent?: React.ComponentType<any>;\n buttonProps?: Record<string, any>;\n getButtonProps?: (\n props: ButtonRendererComponentProps & {\n pending: boolean;\n color?: ButtonSemanticColor;\n icon?: string;\n },\n ) => Record<string, any>;\n};\n\n/**\n * Builds and runs a `script`.\n *\n * Section 14: \"`script` is a string containing an async function body, with\n * top-level await supported. Invoke it with the ActionEvent as `this`,\n * equivalent to `await new AsyncFunction(script).call(source)`.\"\n */\nconst runScript = async (\n script: ButtonScript,\n source: ActionEvent,\n): Promise<void> => {\n if (typeof script === 'function') {\n /*\n Bound **and** passed. `.call()` cannot bind an arrow function's `this` -\n it is lexical - so a `() => this.context` compiles, runs and quietly\n reads the wrong thing. Handing the event as an argument as well means\n neither idiom can be got wrong, at the cost of one word.\n */\n await script.call(source, source);\n return;\n }\n const AsyncFunction = Object.getPrototypeOf(async function () {\n /* the async function constructor is not a global */\n }).constructor;\n await new AsyncFunction(script).call(source);\n};\n\nexport const buttonRendererTester: RankedTester = rankWith(\n 2,\n uiTypeIs('Button'),\n);\n\nconst DIAGNOSTIC_STYLE: React.CSSProperties = {\n border: '1px solid currentColor',\n borderRadius: 4,\n padding: '0.5rem 0.75rem',\n opacity: 0.85,\n fontSize: '0.85rem',\n};\n\nexport const createButtonRenderer = ({\n withProps = true,\n ButtonComponent = 'button' as any,\n buttonProps = {},\n getButtonProps,\n}: ButtonRendererOptions = {}) => {\n const ButtonRenderer = (props: ButtonRendererComponentProps) => {\n const { enabled, uischema, visible, config, t } = props;\n const text = useI18n();\n const handleAction = useHandleAction();\n const ctx = useJsonForms();\n\n /*\n \"Pending/loading covers the complete fireActionEvent promise. Duplicate\n activation SHOULD be prevented while pending.\" The ref is what actually\n prevents the second activation: a second click can arrive before React\n has re-rendered with the new state.\n */\n const [pending, setPending] = useState(false);\n const running = useRef(false);\n\n const element = uischema;\n const label =\n deriveLabelForUISchemaElement(element as any, t) ??\n element.label ??\n element.text ??\n element.name ??\n text('button.action');\n /*\n Deliberately **not** falling back to the label. The label is translated,\n so an action derived from it would change with the form's language - a\n host answering `setLocale` in English would stop recognising the command\n once the form was in Bulgarian. `name` is stable and is kept.\n */\n const script = element.script;\n const action =\n element.action ?? (script === undefined ? element.name : undefined);\n // \"Missing optional Button params are normalized to `{}` when\n // constructing ActionEvent\", so a host can read `event.params.x` without\n // guarding every access.\n const params = useMemo(() => element.params ?? {}, [element.params]);\n\n const activate = useCallback(async () => {\n if (running.current) {\n return;\n }\n running.current = true;\n setPending(true);\n const event = {\n action: action ?? '',\n label,\n params,\n element: element as UISchemaElement,\n context: ctx,\n };\n try {\n /*\n **Action first.** Section 14 states the exclusivity without saying\n which wins, so the question is which failure is least harmful when a\n form carries both - and the answer is the one the host can see.\n\n An action goes to the application's handler, where it can be logged,\n refused or authorised. A script runs arbitrary code with no such\n oversight, and the specification calls it \"a last-resort,\n non-portable runtime escape hatch\". Preferring the portable,\n auditable path is the same choice this project makes everywhere\n else. It also happens to be the only one available when a JSON form\n carries a string script and the host has not granted\n `allowScriptEvaluation`.\n */\n if (script !== undefined && action === undefined) {\n await runScript(script, event);\n } else {\n // Also the path for a button declaring neither, which fires an\n // event with an empty action rather than being a dead control.\n await handleAction?.(event);\n }\n } finally {\n // \"Rejection clears pending and propagates through existing\n // application/platform error handling\" - so the reset is in `finally`\n // and the rejection is not swallowed.\n running.current = false;\n setPending(false);\n }\n }, [action, label, params, script, element, handleAction, ctx]);\n\n /*\n Both present is an authoring mistake that the XOR type makes impossible\n in TypeScript and cannot prevent in JSON. A warning rather than a\n rendered message: replacing the button would break a form that works\n today the moment somebody adds a stray `action`, and the person filling\n it in can do nothing about either.\n */\n useEffect(() => {\n if (element.action !== undefined && element.script !== undefined) {\n // oxlint-disable-next-line no-console\n console.warn(\n `action.conflict: ${JSON.stringify(\n label,\n )} declares both an action and a script, which are mutually exclusive. The action is used.`,\n );\n }\n }, [element.action, element.script, label]);\n\n if (!visible) {\n return null;\n }\n\n /*\n \"String evaluation requires allowScriptEvaluation=true… the renderer\n MUST NOT weaken CSP and MUST report unsupported/evaluation-disabled\n behavior instead.\" A script button that silently did nothing would look\n like a broken command rather than a policy decision.\n */\n /*\n The gate is on **string** evaluation, which is what needs CSP\n `unsafe-eval`. A function the build already compiled needs no such\n permission, so requiring one would be theatre.\n */\n if (typeof script === 'string' && !allowsScriptEvaluation(config)) {\n return (\n <div\n role='alert'\n data-button-diagnostic='script.evaluationDisabled'\n style={DIAGNOSTIC_STYLE}\n >\n {text('button.scriptDisabled', { label })}\n </div>\n );\n }\n\n const disabled = !enabled || element.options?.disabled === true || pending;\n const mappedProps = getButtonProps?.({\n ...props,\n pending,\n color: element.color,\n icon: element.icon,\n });\n\n return (\n <ButtonComponent\n type='button'\n {...buttonProps}\n {...mappedProps}\n disabled={disabled}\n aria-busy={pending || undefined}\n data-button-pending={pending || undefined}\n onClick={activate}\n >\n {label}\n </ButtonComponent>\n );\n };\n\n return withProps\n ? withJsonFormsLayoutProps(withTranslateProps(ButtonRenderer as any) as any)\n : ButtonRenderer;\n};\n\nexport const ButtonRenderer = createButtonRenderer();\n","import {\n LayoutProps,\n RankedTester,\n UISchemaElement,\n and,\n rankWith,\n uiTypeIs,\n} from '@jsonforms/core';\nimport {\n JsonFormsDispatch,\n useJsonForms,\n withJsonFormsLayoutProps,\n} from '@jsonforms/react';\nimport React from 'react';\nimport type { ExtendedUISchemaElement } from '../core/uiSchema';\n\n/**\n * Kept as an alias so existing imports still resolve; the type itself is the\n * project-wide one, since `name` belongs to every element rather than to\n * templates. See `core/uiSchema`.\n */\nexport type NamedElement = ExtendedUISchemaElement & {\n elements?: UISchemaElement[];\n};\nexport type TemplateSlots = Record<string, UISchemaElement>;\nexport const TemplateSlotsContext = React.createContext<TemplateSlots>({});\n\nexport const hasTemplateName = (uischema: UISchemaElement): boolean =>\n typeof (uischema as NamedElement).name === 'string';\n\nexport const namedTemplateTester: RankedTester = rankWith(\n 2,\n and(uiTypeIs('Template'), hasTemplateName),\n);\n\nexport const TemplateRendererComponent = (props: LayoutProps) => {\n const context = useJsonForms();\n const inherited = React.useContext(TemplateSlotsContext);\n const element = props.uischema as NamedElement;\n const slots = React.useMemo(\n () => ({\n ...inherited,\n ...(element.elements ?? []).reduce<TemplateSlots>((result, child) => {\n const name = (child as NamedElement).name;\n if (name) result[name] = child;\n return result;\n }, {}),\n }),\n [element.elements, inherited],\n );\n const template = context.uischemas?.find(\n (entry) => (entry.uischema as NamedElement).name === element.name,\n )?.uischema;\n if (!props.visible || !template) return null;\n return (\n <TemplateSlotsContext.Provider value={slots}>\n <JsonFormsDispatch\n schema={props.schema}\n uischema={template}\n path={props.path}\n enabled={props.enabled}\n renderers={props.renderers}\n cells={props.cells}\n />\n </TemplateSlotsContext.Provider>\n );\n};\n\nexport const TemplateRenderer = withJsonFormsLayoutProps(\n TemplateRendererComponent,\n);\n","import {\n LayoutProps,\n RankedTester,\n UISchemaElement,\n rankWith,\n uiTypeIs,\n} from '@jsonforms/core';\nimport { JsonFormsDispatch, withJsonFormsLayoutProps } from '@jsonforms/react';\nimport React from 'react';\nimport { NamedElement, TemplateSlotsContext } from './TemplateRenderer';\n\nexport const slotRendererTester: RankedTester = rankWith(2, uiTypeIs('Slot'));\n\nexport const SlotRendererComponent = (props: LayoutProps) => {\n const slots = React.useContext(TemplateSlotsContext);\n const element = props.uischema as NamedElement;\n const fallback = element.elements?.[0];\n const contents: UISchemaElement | undefined = element.name\n ? (slots[element.name] ?? fallback)\n : fallback;\n if (!props.visible || !contents) return null;\n return (\n <JsonFormsDispatch\n schema={props.schema}\n uischema={contents}\n path={props.path}\n enabled={props.enabled}\n renderers={props.renderers}\n cells={props.cells}\n />\n );\n};\n\nexport const SlotRenderer = withJsonFormsLayoutProps(SlotRendererComponent);\n","import { LayoutProps, RankedTester, rankWith, uiTypeIs } from '@jsonforms/core';\nimport { withJsonFormsLayoutProps } from '@jsonforms/react';\nimport React from 'react';\n\nexport const spacerRendererTester: RankedTester = rankWith(\n 1,\n uiTypeIs('Spacer'),\n);\n\n/**\n * `{ \"type\": \"Spacer\", \"size\": 32 }` — intrinsic spacing, with no data binding.\n *\n * `size` is a top-level field. The axis follows the parent: width inside a\n * HorizontalLayout, height inside a VerticalLayout or at the top level.\n * `options.layout.weight` can allocate flexible space.\n *\n * \"It defaults to 32 and uses the shared non-negative Dimension type (numeric\n * values are CSS pixels on web).\"\n */\nconst DEFAULT_SIZE = 32;\n\nconst toCss = (value: number | string): string =>\n typeof value === 'number' ? `${value}px` : value;\n\nconst resolveSize = (uischema: any): number | string => {\n const candidate = uischema?.size;\n if (typeof candidate === 'number' && Number.isFinite(candidate)) {\n return Math.max(0, candidate);\n }\n if (typeof candidate === 'string' && candidate.trim().length > 0) {\n return candidate;\n }\n return DEFAULT_SIZE;\n};\n\nexport const SpacerRendererComponent = ({ uischema, visible }: LayoutProps) => {\n const size = resolveSize(uischema);\n const weight = (uischema as any)?.options?.layout?.weight;\n const flexible =\n typeof weight === 'number' && Number.isFinite(weight) && weight > 0;\n\n if (!visible) {\n return null;\n }\n\n /*\n The axis follows the parent, but the parent applies it: a layout reads a\n Spacer's top-level `size` and gives its slot a fixed main-axis basis -\n width in a row, height in a column. That keeps this package free of any\n dependency on a particular layout implementation.\n\n What is left here is the standalone case the specification also covers:\n \"top-level `size` supplies intrinsic spacing independently of parent layout\n support\", where the axis falls back to height.\n */\n return (\n <div\n aria-hidden='true'\n data-spacer\n style={\n flexible\n ? { flex: `${weight} 1 0`, minWidth: 0, minHeight: 0 }\n : { flexShrink: 0, height: toCss(size), width: '100%' }\n }\n />\n );\n};\n\nexport const SpacerRenderer = withJsonFormsLayoutProps(SpacerRendererComponent);\n","import { useI18n } from '@chobantonov/jsonforms-react-renderer-common/locale/translate';\nimport {\n JsonSchema,\n LayoutProps,\n RankedTester,\n Resolve,\n UISchemaElement,\n composePaths,\n rankWith,\n toDataPath,\n uiTypeIs,\n} from '@jsonforms/core';\nimport { useJsonForms, withJsonFormsLayoutProps } from '@jsonforms/react';\nimport React from 'react';\nimport { isAllowedImageUrl, resolveUrlPolicy } from '../util/urlPolicy';\n\n/**\n * `ImageView` - a display-only image, sourced directly or from the data.\n *\n * Section 13 puts `src`, `scope` and `alt` at the **top level** of the\n * element, not in `options`. At least one of `src` and `scope` must be\n * supplied, and the two are not interchangeable fallbacks for one another: a\n * defined `src` wins outright, *including the empty string*, which is how an\n * author says \"no image here\" without removing the element.\n */\n\nexport const imageViewRendererTester: RankedTester = rankWith(\n 1,\n uiTypeIs('ImageView'),\n);\n\nexport type ImageViewElement = UISchemaElement & {\n type: 'ImageView';\n src?: string;\n scope?: string;\n alt?: string;\n};\n\n/** Stable machine-readable codes, per section 21. */\nexport type ImageViewDiagnosticCode =\n | 'image.noSource'\n | 'image.missingAlt'\n | 'image.scopeNotString'\n | 'image.nonStringSource'\n | 'image.urlRefused';\n\nexport interface ImageViewDiagnostic {\n code: ImageViewDiagnosticCode;\n severity: 'warning' | 'error';\n message: string;\n values?: Record<string, unknown>;\n}\n\n/**\n * Whether a scoped schema permits a string.\n *\n * An untyped schema permits anything, so it passes. A `type` that is an array\n * passes if `string` is among its members - `[\"string\", \"null\"]` is a normal\n * way to spell an optional image.\n */\nconst permitsString = (schema: JsonSchema | undefined): boolean => {\n if (schema === undefined) {\n return false;\n }\n const type = (schema as { type?: unknown }).type;\n if (type === undefined) {\n return true;\n }\n return Array.isArray(type) ? type.includes('string') : type === 'string';\n};\n\nexport interface ResolvedImageView {\n /** The URL to render, or undefined for \"show no image\". */\n src?: string;\n alt: string;\n diagnostics: ImageViewDiagnostic[];\n}\n\n/**\n * The whole of section 13's source resolution, with no React in it.\n *\n * Kept separate from the component because the precedence is the part worth\n * testing directly: which of `src` and `scope` wins, when an empty value is a\n * deliberate blank rather than a missing one, and which failures are silent.\n */\nexport const resolveImageView = (\n element: ImageViewElement,\n args: {\n schema?: JsonSchema;\n rootSchema?: JsonSchema;\n data?: unknown;\n path?: string;\n config?: unknown;\n },\n): ResolvedImageView => {\n const diagnostics: ImageViewDiagnostic[] = [];\n const src = element.src;\n const altField = element.alt;\n\n /*\n `alt` is required, and `alt: \"\"` is the documented way to mark an image\n decorative. Defaulting a missing one to `\"\"` silently declares every image\n decorative, so the omission is reported - but the image still renders,\n since withholding content over a missing annotation helps nobody.\n */\n if (altField === undefined) {\n diagnostics.push({\n code: 'image.missingAlt',\n severity: 'warning',\n message:\n 'ImageView requires a top-level `alt`. Use `alt: \"\"` to mark the image decorative.',\n });\n }\n const alt = altField ?? '';\n\n const policy = resolveUrlPolicy(args.config);\n const checkUrl = (candidate: string): string | undefined => {\n if (candidate === '') {\n return undefined;\n }\n if (!isAllowedImageUrl(candidate, policy)) {\n diagnostics.push({\n code: 'image.urlRefused',\n severity: 'error',\n message:\n 'The image source is blocked by the configured URL policy. Use an allowed image URL or adjust the image URL policy.',\n });\n return undefined;\n }\n return candidate;\n };\n\n /*\n A defined `src` is the source, full stop. The specification is explicit\n that an invalid one \"does not silently fall through to scope\" - falling\n through would show a different image than the one the author named.\n */\n if (src !== undefined) {\n return { src: checkUrl(src), alt, diagnostics };\n }\n\n if (element.scope === undefined) {\n diagnostics.push({\n code: 'image.noSource',\n severity: 'error',\n message: 'ImageView requires at least one of `src` and `scope`.',\n });\n return { alt, diagnostics };\n }\n\n const scopedSchema = Resolve.schema(\n args.schema ?? (args.rootSchema as JsonSchema),\n element.scope,\n args.rootSchema as JsonSchema,\n );\n if (!permitsString(scopedSchema)) {\n diagnostics.push({\n code: 'image.scopeNotString',\n severity: 'error',\n message: `The schema at ${element.scope} does not permit strings.`,\n values: { scope: element.scope },\n });\n return { alt, diagnostics };\n }\n\n // Control scope semantics, so an ImageView inside an array item resolves\n // against that item rather than the root.\n const dataPath = composePaths(args.path ?? '', toDataPath(element.scope));\n const value = Resolve.data(args.data, dataPath);\n\n // \"Empty or missing source data displays no image\" - not an error; the\n // property simply has not been filled in yet.\n if (value === undefined || value === null || value === '') {\n return { alt, diagnostics };\n }\n if (typeof value !== 'string') {\n diagnostics.push({\n code: 'image.nonStringSource',\n severity: 'error',\n message: `The value at ${\n element.scope\n } is a ${typeof value}, not a URL string.`,\n values: { scope: element.scope, type: typeof value },\n });\n return { alt, diagnostics };\n }\n return { src: checkUrl(value), alt, diagnostics };\n};\n\nconst DIAGNOSTIC_STYLE: React.CSSProperties = {\n border: '1px solid currentColor',\n borderRadius: 4,\n padding: '0.5rem 0.75rem',\n boxSizing: 'border-box',\n minWidth: 0,\n maxWidth: '100%',\n display: 'flex',\n alignItems: 'center',\n gap: '0.5rem',\n overflowWrap: 'anywhere',\n fontSize: '0.85rem',\n};\n\nconst ImageDiagnostic = ({\n diagnostic,\n}: {\n diagnostic: ImageViewDiagnostic;\n}) => {\n const t = useI18n();\n const [open, setOpen] = React.useState(false);\n const id = React.useId();\n return (\n <div\n role='alert'\n data-image-diagnostic={diagnostic.code}\n style={DIAGNOSTIC_STYLE}\n >\n <span\n style={{ position: 'relative', display: 'inline-flex', flexShrink: 0 }}\n onMouseEnter={() => setOpen(true)}\n onMouseLeave={() => setOpen(false)}\n >\n <button\n type='button'\n aria-label={t('image.warningDetails')}\n aria-describedby={open ? id : undefined}\n onFocus={() => setOpen(true)}\n onBlur={() => setOpen(false)}\n onClick={() => setOpen(true)}\n onKeyDown={(event) => {\n if (event.key === 'Escape') setOpen(false);\n }}\n style={{\n display: 'inline-flex',\n padding: 0,\n border: 0,\n background: 'transparent',\n color: 'inherit',\n cursor: 'help',\n }}\n >\n <svg\n width='18'\n height='18'\n viewBox='0 0 24 24'\n fill='none'\n stroke='currentColor'\n strokeWidth='1.75'\n aria-hidden='true'\n >\n <path d='M12 3 2 21h20L12 3Z' />\n <path d='M12 9v5' />\n <circle cx='12' cy='17' r='.75' />\n </svg>\n </button>\n {open && (\n <span\n id={id}\n role='tooltip'\n style={{\n position: 'absolute',\n top: '100%',\n left: 0,\n zIndex: 10,\n width: 'min(22rem, 70vw)',\n boxSizing: 'border-box',\n padding: '0.5rem 0.75rem',\n background: 'Canvas',\n color: 'CanvasText',\n border: '1px solid currentColor',\n borderRadius: 4,\n overflowWrap: 'anywhere',\n fontWeight: 'normal',\n }}\n >\n {t(diagnostic.code, diagnostic.values)}\n </span>\n )}\n </span>\n <span>\n {diagnostic.code === 'image.urlRefused'\n ? t('image.blocked')\n : t('image.configurationWarning')}\n </span>\n </div>\n );\n};\n\nexport const ImageViewRendererComponent = ({\n config,\n uischema,\n schema,\n path,\n visible,\n}: LayoutProps) => {\n const ctx = useJsonForms();\n const element = uischema as ImageViewElement;\n const resolved = resolveImageView(element, {\n schema,\n rootSchema: ctx.core?.schema,\n data: ctx.core?.data,\n path,\n config,\n });\n\n if (visible === false) {\n return null;\n }\n\n return (\n <>\n {resolved.src !== undefined && (\n <img\n src={resolved.src}\n alt={resolved.alt}\n style={{ maxWidth: '100%', height: 'auto' }}\n />\n )}\n {resolved.diagnostics.map((diagnostic) => (\n <ImageDiagnostic key={diagnostic.code} diagnostic={diagnostic} />\n ))}\n </>\n );\n};\n\nexport const ImageViewRenderer = withJsonFormsLayoutProps(\n ImageViewRendererComponent,\n);\n","import { LayoutProps, RankedTester, rankWith, uiTypeIs } from '@jsonforms/core';\nimport { withJsonFormsLayoutProps } from '@jsonforms/react';\nimport React from 'react';\n\nexport const separatorRendererTester: RankedTester = rankWith(\n 1,\n uiTypeIs('Separator'),\n);\n\n/**\n * `Separator` - a static divider that reads and writes nothing.\n *\n * `options.vertical` is section 13's single orientation encoding, the same\n * convention `vertical` follows everywhere else in this project. An `<hr>` has\n * an implicit `separator` role whose default orientation is horizontal, so a\n * vertical one has to say so: `aria-orientation` is what tells a screen reader\n * the sections are side by side rather than stacked.\n *\n * The extent comes from the layout, as the specification requires - a vertical\n * separator needs usable height from its context, and supplies none itself.\n */\nexport const SeparatorRendererComponent = ({\n uischema,\n visible,\n}: LayoutProps) => {\n if (visible === false) {\n return null;\n }\n const vertical =\n (uischema as { options?: Record<string, unknown> }).options?.vertical ===\n true;\n return vertical ? (\n <hr\n aria-orientation='vertical'\n data-separator='vertical'\n style={{\n // `height: 100%` alone collapses in a flex row, where the default\n // `align-self: stretch` is what actually gives the rule its extent.\n alignSelf: 'stretch',\n width: 0,\n height: 'auto',\n margin: 0,\n borderLeft: '1px solid currentColor',\n borderTop: 0,\n opacity: 0.3,\n }}\n />\n ) : (\n <hr aria-orientation='horizontal' data-separator='horizontal' />\n );\n};\n\nexport const SeparatorRenderer = withJsonFormsLayoutProps(\n SeparatorRendererComponent,\n);\n","import {\n LayoutProps,\n RankedTester,\n UISchemaElement,\n deriveLabelForUISchemaElement,\n rankWith,\n uiTypeIs,\n} from '@jsonforms/core';\nimport {\n TranslateProps,\n withJsonFormsLayoutProps,\n withTranslateProps,\n} from '@jsonforms/react';\nimport React from 'react';\nimport { isAllowedUrl, resolveUrlPolicy } from '../util/urlPolicy';\n\nexport type LinkElement = UISchemaElement & {\n type: 'Link';\n label?: string;\n href?: string;\n target?: '_self' | '_blank' | '_parent' | '_top';\n rel?: string;\n};\n\nexport const linkRendererTester: RankedTester = rankWith(1, uiTypeIs('Link'));\n\n/**\n * `rel` for a link, given its target.\n *\n * `target=\"_blank\"` hands the opened page a `window.opener` reference to this\n * one unless `noopener` is set, which lets it navigate the form away. The\n * specification makes `noopener` a MUST and `noreferrer` a SHOULD. An\n * author-supplied `rel` is kept and these are added to it rather than\n * replacing it.\n */\nexport const linkRel = (\n target: string | undefined,\n rel: string | undefined,\n): string | undefined => {\n const tokens = (rel ?? '').split(/\\s+/).filter(Boolean);\n if (target === '_blank') {\n for (const required of ['noopener', 'noreferrer']) {\n if (!tokens.includes(required)) {\n tokens.push(required);\n }\n }\n }\n return tokens.length > 0 ? tokens.join(' ') : undefined;\n};\n\nexport const LinkRendererComponent = ({\n uischema,\n visible,\n config,\n t,\n}: LayoutProps & TranslateProps) => {\n const element = uischema as LinkElement;\n if (!visible) {\n return null;\n }\n // A Link has no scope, so - like a Group or a Category - only an explicit\n // `i18n` prefix can give it a translation key. Falling back to the href\n // keeps an unlabelled link readable rather than rendering nothing.\n const label =\n deriveLabelForUISchemaElement(element, t) ?? element.label ?? element.href;\n const href = element.href;\n const navigable =\n typeof href === 'string' &&\n href !== '' &&\n isAllowedUrl(href, resolveUrlPolicy(config));\n\n if (!navigable) {\n // Section 13: an empty href renders plain, non-navigating semantics rather\n // than inventing a destination. A URL the policy refuses is treated the\n // same way - the text stays visible, but it does not become a link.\n return <span data-link-inert>{label}</span>;\n }\n\n return (\n <a\n href={href}\n target={element.target}\n rel={linkRel(element.target, element.rel)}\n >\n {label}\n </a>\n );\n};\n\nexport const LinkRenderer = withTranslateProps(\n withJsonFormsLayoutProps(LinkRendererComponent),\n);\n","import React, { Suspense, lazy } from 'react';\nimport { ControlProps } from '@jsonforms/core';\nimport { EditorRendererComponents } from '../components/editorRendererTypes';\nimport { ExtendedI18nKey } from './i18nDefaults';\nimport { useExtendedTranslator } from './useExtendedTranslator';\n\nconst DefaultLoading = ({ label }: { label?: string }) => (\n <div aria-busy='true' aria-live='polite' style={{ minHeight: '4rem' }}>\n {label}\n </div>\n);\nconst DefaultLoadError = ({ label }: { label?: string }) => (\n <div role='alert'>{label}</div>\n);\n\n/**\n * Suspense has no error path of its own, so a boundary catches import\n * failures.\n *\n * Exported because every lazily-loaded renderer needs one, not only the ones\n * built by `createLazyControl`. Without it a chunk that fails to arrive - an\n * offline reload, a stale hash after a deploy - throws past Suspense and\n * takes the whole form down rather than degrading to whatever the caller\n * chose as a fallback.\n */\nexport class LoadBoundary extends React.Component<\n React.PropsWithChildren<{ fallback: React.ReactNode }>,\n { failed: boolean }\n> {\n state = { failed: false };\n static getDerivedStateFromError() {\n return { failed: true };\n }\n render() {\n return this.state.failed ? this.props.fallback : this.props.children;\n }\n}\n\n/**\n * Defers a renderer's heavy dependency until the control is actually rendered.\n * The import lives behind React.lazy so bundlers split it into its own chunk -\n * a form with no code editor or data grid never downloads them.\n */\nexport const createLazyControl = (\n load: () => Promise<React.ComponentType<ControlProps>>,\n components: EditorRendererComponents,\n labels: { loading: ExtendedI18nKey; error: ExtendedI18nKey },\n): React.ComponentType<ControlProps> => {\n const Loading = components.Loading ?? DefaultLoading;\n const LoadError = components.LoadError ?? DefaultLoadError;\n // Created once per renderer set, not per render, so the chunk is fetched once.\n const Lazy = lazy(async () => ({ default: await load() }));\n const Deferred = (props: ControlProps) => {\n // translated here so the fallbacks are localised like everything else\n const t = useExtendedTranslator();\n return (\n <LoadBoundary fallback={<LoadError label={t(labels.error)} />}>\n <Suspense fallback={<Loading label={t(labels.loading)} />}>\n <Lazy {...props} />\n </Suspense>\n </LoadBoundary>\n );\n };\n Deferred.displayName = `LazyControl(${labels.loading})`;\n return Deferred;\n};\n","import { JSONFORMS_EXTENDED_CONFIG_KEY } from './configNamespaces';\n\n/**\n * The template grammar, and what an expression is allowed to see.\n *\n * Deliberately free of any CEL import. Splitting a template is pure string\n * work, and doing it here means two things: the grammar can be tested without\n * the evaluator, and a label whose text turns out to contain **no**\n * placeholders never downloads one.\n */\n\n/** One piece of a split template. */\nexport type TemplateSegment =\n | { kind: 'literal'; text: string }\n | { kind: 'expression'; source: string };\n\n/**\n * Splits a template into literals and expressions.\n *\n * The grammar is section 11.4's, unchanged, because a second convention in\n * the same document is the thing worth avoiding: a **single** `{` opens a\n * placeholder, `{{` emits a literal `{`, and `}}` emits a literal `}`.\n *\n * This is inverted from Mustache and friends, so `{{data.firstName}}` is\n * literal text rather than a binding. That trap is the reason\n * {@link looksLikeMustache} exists.\n *\n * The scan is quote-aware: a `}` inside a quoted string does not close the\n * placeholder, so `{data.m['}']}` is one expression rather than a truncated\n * one. Quotes are tracked only to find the closing brace - what is inside\n * them is the evaluator's business.\n *\n * An unterminated placeholder is returned as a literal, so the author sees\n * their source text rather than losing the rest of the line.\n */\nexport const splitTemplate = (text: string): TemplateSegment[] => {\n const segments: TemplateSegment[] = [];\n let literal = '';\n let i = 0;\n\n const flush = () => {\n if (literal) {\n segments.push({ kind: 'literal', text: literal });\n literal = '';\n }\n };\n\n while (i < text.length) {\n const char = text[i];\n if (char === '{' && text[i + 1] === '{') {\n literal += '{';\n i += 2;\n continue;\n }\n if (char === '}' && text[i + 1] === '}') {\n literal += '}';\n i += 2;\n continue;\n }\n if (char !== '{') {\n literal += char;\n i += 1;\n continue;\n }\n // A placeholder. Find its closing brace, ignoring quoted content.\n let j = i + 1;\n let quote: string | undefined;\n let closed = false;\n while (j < text.length) {\n const c = text[j];\n if (quote) {\n // A backslash escapes the next character inside a quoted string.\n if (c === '\\\\') {\n j += 2;\n continue;\n }\n if (c === quote) {\n quote = undefined;\n }\n } else if (c === '\"' || c === \"'\") {\n quote = c;\n } else if (c === '}') {\n closed = true;\n break;\n }\n j += 1;\n }\n if (!closed) {\n // Unterminated: the rest is text, which is more use than nothing.\n literal += text.slice(i);\n break;\n }\n flush();\n segments.push({ kind: 'expression', source: text.slice(i + 1, j) });\n i = j + 1;\n }\n flush();\n return segments;\n};\n\n/** Whether a split template has anything to evaluate. */\nexport const hasExpressions = (segments: TemplateSegment[]): boolean =>\n segments.some((segment) => segment.kind === 'expression');\n\n/**\n * Whether the text looks like it expected Mustache's convention.\n *\n * `{{data.firstName}}` splits into the literal `{data.firstName}` - correct\n * per the grammar, and almost certainly not what the author meant. Section\n * 11.4 asks an implementation to warn about exactly this shape.\n */\nexport const looksLikeMustache = (text: string): boolean =>\n /\\{\\{\\s*[A-Za-z_$][\\w$]*(\\.[\\w$]+|\\[[^\\]]*\\])*\\s*\\}\\}/.test(text);\n\n// ------------------------------------------------------------- the scope\n\nconst namespaced = (config: unknown): Record<string, unknown> | undefined =>\n (config as Record<string, unknown> | undefined)?.[\n JSONFORMS_EXTENDED_CONFIG_KEY\n ] as Record<string, unknown> | undefined;\n\n/**\n * Whether the host permits an expression to read the form's data.\n *\n * Section 12's gate, and it defaults **closed** like the others - unlike the\n * Markdown gate, which opens a parser rather than a reader. What this opens\n * is exactly what section 11 calls dynamic resolution: values out of the\n * form's data and the host's context, into the UI.\n */\nexport const dynamicValuesEnabled = (config: unknown): boolean =>\n (\n namespaced(config)?.['dynamicValues'] as Record<string, unknown> | undefined\n )?.['enabled'] === true;\n\n/** The namespaces that only dynamic resolution may expose. */\nexport const DYNAMIC_NAMESPACES = ['data', 'item', 'config', 'context'];\n\nexport interface NamespaceScopeInput {\n data?: unknown;\n item?: unknown;\n locale?: string;\n config?: unknown;\n context?: unknown;\n dynamicAllowed: boolean;\n}\n\n/**\n * What a **`textParams` value** may reference.\n *\n * This is the only place the form's data is reachable. A parameter's value is\n * the right-hand side of a declaration the author wrote in the UI schema, and\n * the UI schema is where knowledge of the data model belongs.\n *\n * The four namespaces appear only when the gate is open, so a parameter that\n * reaches for `data` while it is shut fails with an unknown identifier rather\n * than quietly resolving.\n */\nexport const buildNamespaceScope = (\n input: NamespaceScopeInput,\n): Record<string, unknown> => {\n const scope: Record<string, unknown> = { locale: input.locale ?? 'en' };\n if (input.dynamicAllowed) {\n scope.data = input.data ?? {};\n Object.defineProperty(scope, 'item', {\n enumerable: true,\n get: () => input.item,\n });\n scope.config = input.config ?? {};\n scope.context = input.context ?? {};\n }\n return scope;\n};\n\n/**\n * Names the text scope keeps for itself.\n *\n * `locale` lets a message choose a word by language without a parameter for\n * it. A `textParams` entry of the same name would silently do nothing, so it\n * is reported rather than dropped - see {@link reservedParamNames}.\n */\nexport const RESERVED_TEXT_NAMES = ['locale'];\n\n/**\n * What the **text** may reference: the declared parameters, and nothing else.\n *\n * Deliberately **not** the namespaces. A translated string that reads\n * `{data.customerName}` couples the catalog to the schema: renaming a field\n * invalidates every translation of every language, and a translator is shown\n * a data path instead of a name for the thing. Restricting the text to\n * declared parameters is what makes `You are subscribed to {product}.` the\n * unit of translation.\n *\n * Expressions still work here, over those parameters. That is what keeps a\n * plural in the catalog where each language can write its own\n * (`{seats == 1 ? \"seat\" : \"seats\"}`) rather than in the UI schema where only\n * the authoring language can.\n */\nexport const buildTextScope = (\n params: Record<string, unknown>,\n locale: string | undefined,\n): Record<string, unknown> => ({\n ...params,\n // Assigned last: a reserved name is not shadowed by a parameter.\n locale: locale ?? 'en',\n});\n\n/** `textParams` entries that collide with a reserved name, so they can be reported. */\nexport const reservedParamNames = (\n textParams: Record<string, unknown> | undefined,\n): string[] =>\n Object.keys(textParams ?? {}).filter((name) =>\n RESERVED_TEXT_NAMES.includes(name),\n );\n\n/** Whether an element asks for interpolation at all. */\nexport const wantsInterpolation = (\n options: Record<string, unknown> | undefined,\n): boolean => options?.['interpolate'] === true;\n","import React, { Suspense, lazy } from 'react';\nimport { LoadBoundary } from '../util/lazyControl';\nimport { TemplateSegment, buildTextScope } from '../util/interpolate';\nimport type { TemplateResult } from '../util/celTemplate';\n\n/**\n * Resolves a split template, loading the evaluator only if there is one to\n * resolve.\n *\n * The chunk boundary is the point of this component. A label that asks for\n * interpolation but whose text contains no placeholder never requests the\n * evaluator, because the split has already happened - see `interpolate.ts`,\n * which is deliberately free of any CEL import so that the decision can be\n * made before the chunk is.\n *\n * Children are a render prop rather than an element, so the caller decides\n * what to do with the resolved string. That is what keeps the Markdown chunk\n * independent of this one: a label that interpolates without Markdown never\n * touches the parser, and one that does both loads two chunks rather than a\n * combined one.\n */\n\nexport interface InterpolatedTextProps {\n segments: TemplateSegment[];\n /** Declared parameters, unresolved: their values may be expressions. */\n textParams?: Record<string, unknown>;\n /** What a parameter's value may see - the namespaces, subject to the gate. */\n namespaceScope: Record<string, unknown>;\n locale?: string;\n /** The form's translator, so an expression can look a key up (§9). */\n translate?: (key: string, defaultMessage?: string) => string | undefined;\n escape?: (text: string) => string;\n children: (result: TemplateResult) => React.ReactNode;\n /** The unresolved text, shown while the chunk is in flight or if it fails. */\n fallback: string;\n}\n\nconst LazyEvaluate = lazy(async () => {\n const { renderTemplate, resolveTextParams } =\n await import('../util/celTemplate');\n const Evaluated = ({\n segments,\n textParams,\n namespaceScope,\n locale,\n translate,\n escape,\n children,\n }: Omit<InterpolatedTextProps, 'fallback'>) => {\n /*\n Two levels, in order. The parameters are resolved against the\n namespaces, then the text is resolved against the parameters - which is\n the whole point of the split: the text never sees `data`.\n */\n const resolved = resolveTextParams(\n textParams,\n namespaceScope,\n locale,\n translate,\n );\n const rendered = renderTemplate(\n segments,\n buildTextScope(resolved.params, locale),\n escape,\n locale,\n translate,\n );\n return (\n <>\n {children({\n text: rendered.text,\n failures: [...resolved.failures, ...rendered.failures],\n })}\n </>\n );\n };\n return { default: Evaluated };\n});\n\nexport const InterpolatedText = ({\n segments,\n textParams,\n namespaceScope,\n locale,\n translate,\n escape,\n children,\n fallback,\n}: InterpolatedTextProps) => (\n /*\n A pending evaluator shows a compact status indicator, never the authored\n template. The caller supplies safe literal content for a failed load.\n */\n <LoadBoundary fallback={fallback}>\n <Suspense\n fallback={\n <span role='status' aria-busy='true'>\n …\n </span>\n }\n >\n <LazyEvaluate\n segments={segments}\n textParams={textParams}\n namespaceScope={namespaceScope}\n locale={locale}\n translate={translate}\n escape={escape}\n >\n {children}\n </LazyEvaluate>\n </Suspense>\n </LoadBoundary>\n);\n","import { useI18n } from '@chobantonov/jsonforms-react-renderer-common/locale/translate';\nimport type { ItemContext } from '@chobantonov/jsonforms-react-renderer-common/cells/CellSummary';\nimport {\n LabelProps,\n RankedTester,\n UISchemaElement,\n rankWith,\n uiTypeIs,\n} from '@jsonforms/core';\nimport React, { Suspense, lazy } from 'react';\nimport { useJsonForms, withJsonFormsLabelProps } from '@jsonforms/react';\nimport { LoadBoundary } from '../util/lazyControl';\nimport {\n buildNamespaceScope,\n dynamicValuesEnabled,\n hasExpressions,\n reservedParamNames,\n splitTemplate,\n wantsInterpolation,\n} from '../util/interpolate';\nimport { escapeMarkdown } from '../util/markdownEscape';\nimport { markdownProfile, resolveMarkup } from '../util/markup';\nimport { InterpolatedText } from '../components/InterpolatedText';\nimport { resolveUrlPolicy } from '../util/urlPolicy';\nimport { useExtendedTranslator } from '../util/useExtendedTranslator';\nimport type { MarkdownTextProps } from './MarkupLabelRenderer.impl';\n\n/**\n * A `Label` whose text is more than a string.\n *\n * ## Why this is not a new element type\n *\n * It would have been simpler to define `MarkdownLabel` and give it its own\n * tester. It would also have been unusable: an element type nothing in the\n * base renderer set knows renders as **nothing at all**, so a form authored\n * against the extended set and opened on the base one would lose the text\n * entirely. `Label` with `options.markup` degrades instead - the base renderer\n * still claims it at rank 1 and still shows the text, unparsed. Section 1's\n * \"unknown options are preserved and ignored\" is what makes that work, and it\n * only works for options, not for types.\n */\n\n/**\n * Whether this element asks for markup or interpolation.\n *\n * Reads the **requested** values, not the resolved ones, so a request the\n * host has switched off still lands here and can be reported. Leaving it to\n * the base renderer would render the source silently, which is the failure\n * the diagnostics exist to prevent.\n */\nconst asksForMarkup = (uischema: UISchemaElement): boolean => {\n const options = uischema.options as Record<string, unknown> | undefined;\n const markup = options?.['markup'];\n return (\n wantsInterpolation(options) || (markup !== undefined && markup !== 'plain')\n );\n};\n\n/**\n * Rank 3, above the base `Label` renderer's 1.\n *\n * Not 2: the antd renderer set reserves 2 for its own overrides of core\n * elements, and a markup label has to beat those too.\n */\nexport const markupLabelTester: RankedTester = rankWith(\n 3,\n (uischema, _schema, _context) =>\n uiTypeIs('Label')(uischema, _schema, _context) && asksForMarkup(uischema),\n);\n\n/**\n * The UI library's own text component, if the binding package supplies one.\n *\n * `block` says what it is being handed. Parsed Markdown is already block\n * content - paragraphs, lists - while plain text is a single run, and a\n * library whose paragraph component renders an actual `<p>` must not wrap the\n * former in it: `<p>` accepts phrasing content only, so a `<p>` or a `<ul>`\n * inside one is invalid and the browser closes the outer tag early, leaving a\n * tree that does not match what React thinks it rendered.\n *\n * It is one slot with a flag rather than two components because for some\n * libraries the two coincide - antd's `Typography.Paragraph` renders a `div`,\n * so it is safe for both - and a binding should be able to say that by\n * ignoring the flag rather than by naming the same component twice.\n */\nexport type MarkupTypography = React.ComponentType<{\n block: boolean;\n children?: React.ReactNode;\n}>;\n\nexport interface MarkupLabelProps extends LabelProps {\n typography?: MarkupTypography;\n}\n\n/*\n Created once at module scope, so the chunk is requested once however many\n labels there are.\n*/\nconst LazyMarkdownText = lazy(async () => ({\n default: (await import('./MarkupLabelRenderer.impl'))\n .MarkdownText as React.ComponentType<MarkdownTextProps>,\n}));\n\nconst DIAGNOSTIC_STYLE: React.CSSProperties = {\n display: 'block',\n fontSize: '0.85em',\n opacity: 0.85,\n};\n\nexport const MarkupLabelRendererComponent = ({\n uischema,\n text,\n visible,\n config,\n typography,\n}: MarkupLabelProps) => {\n const t = useExtendedTranslator();\n const ownedText = useI18n();\n const ctx = useJsonForms();\n if (visible === false) {\n return null;\n }\n const options = uischema?.options as Record<string, unknown> | undefined;\n const request = resolveMarkup(options, config);\n const content = text ?? '';\n\n const diagnostic = request.diagnostic ? (\n <span\n role='alert'\n data-markup-diagnostic={request.diagnostic}\n style={DIAGNOSTIC_STYLE}\n >\n {request.diagnostic === 'markdownDisabled'\n ? t('markup.markdownDisabled')\n : t('markup.unsupported', { markup: JSON.stringify(options?.markup) })}\n </span>\n ) : null;\n\n const Typography = request.typography ? typography : undefined;\n\n /*\n Split eagerly. It is pure string work, it decides whether the evaluator is\n needed at all, and doing it here keeps that decision out of the chunk.\n */\n const segments = request.interpolate ? splitTemplate(content) : undefined;\n /*\n The segments only when there is something to evaluate, so the type itself\n carries the decision: every path below either has expressions or does not,\n and neither needs to assert it.\n */\n const expressions =\n segments && hasExpressions(segments) ? segments : undefined;\n /*\n The text with no expressions to resolve - which is **not** the authored\n text, because the grammar's brace escaping still has to be applied:\n `{{data.x}}` is the literal `{data.x}`, and a template made only of\n literals must still say so. Skipping the evaluator is right here; skipping\n the unescaping was a bug.\n */\n const plainText = segments\n ? segments\n .map((segment) => (segment.kind === 'literal' ? segment.text : ''))\n .join('')\n : content;\n const textParams = options?.['textParams'] as\n | Record<string, unknown>\n | undefined;\n /*\n The namespaces are for the PARAMETERS, not for the text. A translated\n string that reads `{data.customerName}` couples the catalog to the schema;\n one that reads `{product}` does not, and that is the whole reason the two\n scopes are separate.\n */\n const namespaceScope = expressions\n ? buildNamespaceScope({\n data: ctx.core?.data,\n get item() {\n return (ctx as typeof ctx & ItemContext).item;\n },\n locale: ctx.i18n?.locale,\n config,\n dynamicAllowed: dynamicValuesEnabled(config),\n })\n : {};\n const reserved = reservedParamNames(textParams);\n\n /*\n A refusal shows the diagnostic AND the text. A Label's text is inert\n content, not a program: the reason a refused template renders nothing is\n that running it is the whole point, whereas the words of a label are\n readable whether or not their asterisks became bold. Hiding them would\n turn a policy decision into missing information on the page.\n */\n /*\n Nothing to do beyond what the base renderer would do: no parsing, and no\n expression to resolve. The `expressions` half matters - `interpolate:\n true` over text with no placeholder must not reach for the evaluator.\n */\n if (!request.markdown && !expressions) {\n return (\n <label data-markup-label='plain'>\n {Typography ? (\n <Typography block={false}>{plainText}</Typography>\n ) : (\n plainText\n )}\n {diagnostic}\n </label>\n );\n }\n\n /*\n The parsed half, as a function of the text, because the text may still be\n on its way: when interpolation is in play this is called with the\n resolved string rather than the authored one.\n */\n const parsed = (source: string) => (\n /*\n Both fallbacks are the text itself, not a spinner and not an error.\n The chunk usually arrives within a frame, and a paragraph of prose\n replaced by \"Loading…\" and back again is a worse read than the same\n prose unparsed for a moment.\n\n The boundary is not optional. Suspense has no error path, so without it\n a chunk that never arrives - an offline reload, a stale hash after a\n deploy - throws past it and takes the whole form down, over a label.\n */\n <LoadBoundary fallback={source}>\n <Suspense fallback={source}>\n <LazyMarkdownText\n text={source}\n profile={markdownProfile(config)}\n urlPolicy={resolveUrlPolicy(config)}\n />\n </Suspense>\n </LoadBoundary>\n );\n\n const body = (source: string): React.ReactNode =>\n request.markdown ? parsed(source) : source;\n\n const wrap = (node: React.ReactNode, extra?: React.ReactNode) => {\n const inner = Typography ? (\n <Typography block={request.markdown}>{node}</Typography>\n ) : (\n node\n );\n /*\n A `div` once Markdown is parsed, because that is block content and\n `<label>` accepts phrasing content only; a `label` otherwise, which is\n what the base renderer draws.\n */\n return request.markdown ? (\n <div data-markup-label='markdown'>\n {inner}\n {extra}\n </div>\n ) : (\n <label data-markup-label='interpolated'>\n {inner}\n {extra}\n </label>\n );\n };\n\n if (!expressions) {\n return wrap(body(plainText), diagnostic);\n }\n\n /*\n The evaluator is fetched only when there is something to evaluate. A\n template with no placeholders is resolved here, for free, and never asks\n for the chunk - which is the difference between `interpolate: true` being\n a declaration of intent and a download.\n */\n /*\n The wrapper is outside the boundary on purpose. It depends only on what\n was *asked for*, never on what arrived, so the element, its typography and\n its `data-markup-label` are present while the chunk is in flight and stay\n present if it never lands. Wrapping inside the render prop instead left a\n failed load rendering a bare string with no element at all.\n */\n return wrap(\n <InterpolatedText\n segments={expressions}\n textParams={textParams}\n namespaceScope={namespaceScope}\n locale={ctx.i18n?.locale}\n translate={ctx.i18n?.translate}\n escape={request.markdown ? escapeMarkdown : undefined}\n fallback={plainText}\n >\n {(result) => (\n <>\n {body(result.text)}\n {result.failures.length > 0 || reserved.length > 0 ? (\n <span\n role='alert'\n data-markup-diagnostic='interpolationFailed'\n style={DIAGNOSTIC_STYLE}\n >\n {t('markup.interpolationFailed', {\n detail: [\n ...reserved.map((name) =>\n ownedText('markup.reservedParam', { name }),\n ),\n ...result.failures,\n ].join('; '),\n })}\n </span>\n ) : null}\n </>\n )}\n </InterpolatedText>,\n diagnostic,\n );\n};\n\nexport const MarkupLabelRenderer = withJsonFormsLabelProps(\n MarkupLabelRendererComponent,\n);\n\n/** Binds the typography slots, for a renderer set that has them. */\nexport const createMarkupLabelRenderer = (typography: MarkupTypography) =>\n withJsonFormsLabelProps((props: LabelProps) => (\n <MarkupLabelRendererComponent {...props} typography={typography} />\n ));\n","import {\n useTranslator,\n useI18n,\n} from '@chobantonov/jsonforms-react-renderer-common/locale/translate';\n\nimport { findMixedDetailUiSchema } from '@chobantonov/jsonforms-react-renderer-common/core/detailUiSchema';\nimport {\n ControlProps,\n createDefaultValue,\n findUISchema,\n isControl,\n JsonSchema,\n JsonSchema7,\n rankWith,\n RankedTester,\n resolveSchema,\n Scopable,\n TesterContext,\n UISchemaElement,\n} from '@jsonforms/core';\nimport {\n JsonFormsDispatch,\n useJsonForms,\n withJsonFormsControlProps,\n} from '@jsonforms/react';\nimport React, { useMemo } from 'react';\n\nimport {\n ANY_TYPES,\n getJsonDataType,\n getSchemaTypes,\n mixedControlFor,\n resolveMixedArrayItems,\n removeInapplicableKeywords,\n type JsonDataType,\n} from '@chobantonov/jsonforms-react-renderer-common/mixed/mixedSchema';\n\nexport const schemaForType = (\n schema: JsonSchema,\n type: JsonDataType,\n rootSchema: JsonSchema,\n): JsonSchema => {\n const nextSchema: JsonSchema7 = {\n ...(typeof schema === 'object' ? (schema as JsonSchema7) : {}),\n type,\n };\n delete nextSchema.anyOf;\n delete nextSchema.oneOf;\n delete nextSchema.allOf;\n removeInapplicableKeywords(nextSchema, type);\n\n if (type === 'object') {\n nextSchema.additionalProperties = nextSchema.additionalProperties ?? true;\n } else if (type === 'array') {\n const items = resolveMixedArrayItems(nextSchema.items, rootSchema);\n nextSchema.items =\n items && typeof items === 'object'\n ? (items as JsonSchema7 | JsonSchema7[])\n : { type: ANY_TYPES as JsonSchema7['type'] };\n }\n\n return nextSchema;\n};\n\nexport const GenericMixedRendererComponent = ({\n cells,\n data,\n enabled,\n handleChange,\n label,\n path,\n renderers,\n readonly,\n rootSchema,\n schema,\n uischema,\n visible,\n}: ControlProps) => {\n const text = useI18n();\n const translateType = useTranslator();\n const jsonforms = useJsonForms();\n const uischemas = useMemo(\n () => jsonforms.uischemas ?? [],\n [jsonforms.uischemas],\n );\n const types = useMemo(() => getSchemaTypes(schema), [schema]);\n const dataType = getJsonDataType(data);\n const selectedType =\n dataType && types.includes(dataType)\n ? dataType\n : dataType === 'integer' && types.includes('number')\n ? 'number'\n : null;\n const selectedSchema = useMemo(\n () =>\n selectedType\n ? schemaForType(schema, selectedType, rootSchema)\n : undefined,\n [rootSchema, schema, selectedType],\n );\n const detailUiSchema = useMemo(\n () =>\n selectedSchema\n ? findMixedDetailUiSchema(\n selectedSchema,\n uischema,\n path,\n rootSchema,\n uischemas ?? [],\n findUISchema,\n )\n : undefined,\n [path, rootSchema, selectedSchema, uischema, uischemas],\n );\n\n if (!visible) {\n return null;\n }\n\n const renderedControl =\n selectedType !== 'null' && selectedSchema && detailUiSchema ? (\n <JsonFormsDispatch\n schema={selectedSchema}\n uischema={detailUiSchema}\n path={path}\n enabled={enabled}\n renderers={renderers}\n cells={cells}\n readonly={readonly}\n />\n ) : null;\n const isStructuredType =\n selectedType === 'object' || selectedType === 'array';\n\n return (\n <div className='jsonforms-mixed-renderer'>\n <label className='jsonforms-mixed-renderer-type'>\n {label ? <span>{label}</span> : null}\n <select\n disabled={!enabled}\n value={selectedType ?? ''}\n onChange={(event) => {\n const nextType = event.currentTarget.value as JsonDataType;\n const nextSchema = schemaForType(schema, nextType, rootSchema);\n handleChange(path, createDefaultValue(nextSchema, rootSchema));\n }}\n >\n <option disabled value=''>\n {text('mixed.typePlaceholder')}\n </option>\n {types.map((type) => (\n <option\n key={translateType(`mixed.type.${type}`, type)}\n value={type}\n >\n {translateType(`mixed.type.${type}`, type)}\n </option>\n ))}\n </select>\n </label>\n {isStructuredType ? (\n <details\n className='jsonforms-mixed-renderer-detail'\n key={selectedType}\n open\n >\n <summary>{selectedType}</summary>\n {renderedControl}\n </details>\n ) : (\n renderedControl\n )}\n </div>\n );\n};\n\nexport const isMixedSchema = (\n uischema: UISchemaElement & Scopable,\n schema: JsonSchema,\n context: TesterContext,\n) => {\n if (schema && typeof schema === 'boolean') {\n return true;\n }\n\n if (!schema || typeof schema !== 'object') {\n return false;\n }\n\n if (Array.isArray(schema.type)) {\n return true;\n }\n\n if (schema.type === undefined && isControl(uischema)) {\n return true;\n }\n\n if (schema.type === 'object') {\n const schemaPath = uischema.scope;\n if (schemaPath) {\n const currentDataSchema = resolveSchema(\n schema,\n schemaPath,\n context?.rootSchema,\n );\n return Array.isArray(\n (currentDataSchema as JsonSchema7 | undefined)?.type,\n );\n }\n }\n\n return false;\n};\n\nexport const isMixedControl = mixedControlFor(isMixedSchema);\n\nexport const genericMixedControlTester: RankedTester = rankWith(\n 20,\n isMixedControl,\n);\n\nexport const GenericMixedRenderer = withJsonFormsControlProps(\n GenericMixedRendererComponent,\n);\n","import type { CSSProperties } from 'react';\n\nexport const HORIZONTAL_COLUMNS = 16;\n\nexport const isValidColumns = (value: unknown): boolean =>\n value === undefined ||\n value === null ||\n value === 'auto' ||\n (typeof value === 'number' &&\n Number.isInteger(value) &&\n value >= 2 &&\n value <= HORIZONTAL_COLUMNS);\n\n/** Allocate direct, visible children without changing their UI schemas. */\nexport const horizontalLayoutWidths = (\n values: readonly unknown[],\n gap = '1rem',\n) => {\n const fixed = values.map((value) =>\n typeof value === 'number' && isValidColumns(value) ? value : undefined,\n );\n const rows: number[][] = [[]];\n const allAuto = fixed.every((value) => value === undefined);\n let used = 0;\n fixed.forEach((value, index) => {\n const minimum = value ?? 2;\n if (!allAuto && used + minimum > HORIZONTAL_COLUMNS) {\n rows.push([]);\n used = 0;\n }\n rows[rows.length - 1].push(index);\n used += minimum;\n });\n return rows.flatMap((indices, row) => {\n const reserved = indices.reduce(\n (sum, index) => sum + (fixed[index] ?? 0),\n 0,\n );\n const autos = indices.filter((index) => fixed[index] === undefined).length;\n return indices.map((index) => {\n const columns = fixed[index] ?? (HORIZONTAL_COLUMNS - reserved) / autos;\n const fraction = columns / HORIZONTAL_COLUMNS;\n const style: CSSProperties = {\n flex: `0 0 calc(${fraction * 100}% - ${gap} * ${\n (indices.length - 1) * fraction\n })`,\n minWidth: 0,\n };\n return {\n row,\n columns,\n style,\n diagnostic: isValidColumns(values[index])\n ? undefined\n : 'Columns must be Auto or an integer from 2 through 16.',\n };\n });\n });\n};\n","import {\n getAjv,\n getConfig,\n isVisible,\n Layout,\n LayoutProps,\n RankedTester,\n rankWith,\n uiTypeIs,\n} from '@jsonforms/core';\nimport {\n JsonFormsDispatch,\n useJsonForms,\n withJsonFormsLayoutProps,\n} from '@jsonforms/react';\nimport React from 'react';\nimport { horizontalLayoutWidths } from '../util/horizontalLayout';\n\n// Above the base layouts, below specialized split layouts (rank 5).\nexport const horizontalColumnsLayoutTester: RankedTester = rankWith(\n 3,\n uiTypeIs('HorizontalLayout'),\n);\n\nexport const HorizontalColumnsLayoutRendererComponent = (\n props: LayoutProps,\n) => {\n const context = useJsonForms();\n const state = { jsonforms: context };\n const elements = ((props.uischema as Layout).elements ?? [])\n .map((element, index) => ({ element, index }))\n .filter(({ element }) =>\n isVisible(\n element,\n context.core?.data,\n props.path,\n getAjv(state),\n getConfig(state),\n ),\n );\n const gap = '1rem';\n const widths = horizontalLayoutWidths(\n elements.map(({ element }) => element.options?.columns),\n gap,\n );\n if (!props.visible) return null;\n\n return (\n <div\n style={{\n display: 'flex',\n flexDirection: 'column',\n gap,\n width: '100%',\n minWidth: 0,\n }}\n >\n {Array.from(new Set(widths.map(({ row }) => row))).map((row) => (\n <div\n key={row}\n data-columns-row={row}\n style={{ display: 'flex', gap, minWidth: 0 }}\n >\n {elements.map(({ element, index }, position) => {\n const item = widths[position];\n if (item.row !== row) return null;\n return (\n <div\n key={`${props.path}-${index}`}\n style={item.style}\n data-columns={item.columns}\n data-columns-diagnostic={item.diagnostic}\n >\n <JsonFormsDispatch\n schema={props.schema}\n uischema={element}\n path={props.path}\n enabled={props.enabled}\n renderers={props.renderers}\n cells={props.cells}\n />\n </div>\n );\n })}\n </div>\n ))}\n </div>\n );\n};\n\nexport const HorizontalColumnsLayoutRenderer = withJsonFormsLayoutProps(\n HorizontalColumnsLayoutRendererComponent,\n);\n","import {\n useAdditionalPropertyItems,\n type AdditionalPropertiesProps,\n} from '@chobantonov/jsonforms-react-renderer-common/objects/useAdditionalPropertyEntries';\nimport {\n renamePropertyKey,\n toObjectSchema,\n toAdditionalPropertyItem,\n} from '@chobantonov/jsonforms-react-renderer-common/objects/additionalProperties';\nimport {\n createDefaultValue,\n JsonSchema,\n JsonSchema7,\n resolveSchema,\n} from '@jsonforms/core';\nimport { JsonFormsDispatch } from '@jsonforms/react';\nimport { useExtendedTranslator } from '../util/useExtendedTranslator';\n\n/** The translator `useExtendedTranslator` returns. */\ntype ExtendedTranslator = ReturnType<typeof useExtendedTranslator>;\nimport React, { useState } from 'react';\n\nexport type GenericAdditionalPropertiesProps = Omit<\n AdditionalPropertiesProps,\n 'embedded'\n>;\n\nconst getPropertyNamePattern = (\n schema: JsonSchema,\n rootSchema: JsonSchema,\n): string | undefined => {\n const objectSchema = toObjectSchema(schema);\n let propertyNames = objectSchema.propertyNames as JsonSchema7 | undefined;\n if (\n typeof propertyNames === 'object' &&\n typeof propertyNames.$ref === 'string'\n ) {\n propertyNames =\n (resolveSchema(rootSchema, propertyNames.$ref, rootSchema) as\n | JsonSchema7\n | undefined) ?? propertyNames;\n }\n\n if (typeof propertyNames === 'object' && propertyNames.pattern) {\n return propertyNames.pattern;\n }\n\n if (\n objectSchema.additionalProperties === false &&\n objectSchema.patternProperties\n ) {\n const patterns = Object.keys(objectSchema.patternProperties);\n return patterns.length > 0 ? patterns.join('|') : undefined;\n }\n\n return undefined;\n};\n\n/*\n Takes the translator rather than calling the hook: it is a plain function,\n used twice per render (the add box and the row being renamed), and a hook\n cannot be called from either position.\n*/\nconst validatePropertyName = (\n t: ExtendedTranslator,\n propertyName: string,\n data: any,\n schema: JsonSchema,\n rootSchema: JsonSchema,\n currentPropertyName?: string,\n): string | undefined => {\n if (!propertyName) {\n return undefined;\n }\n\n if (\n typeof data === 'object' &&\n data !== null &&\n Object.prototype.hasOwnProperty.call(data, propertyName) &&\n propertyName !== currentPropertyName\n ) {\n return t('additionalProperties.nameTaken', { name: propertyName });\n }\n\n if (\n propertyName.includes('[') ||\n propertyName.includes(']') ||\n propertyName.includes('.')\n ) {\n return t('additionalProperties.nameInvalid', { name: propertyName });\n }\n\n const pattern = getPropertyNamePattern(schema, rootSchema);\n if (pattern && !new RegExp(pattern).test(propertyName)) {\n return t('additionalProperties.namePattern', { pattern });\n }\n\n return undefined;\n};\n\nexport const GenericAdditionalProperties = ({\n cells,\n config,\n data,\n enabled,\n handleChange,\n label,\n path,\n readonly,\n renderers,\n rootSchema,\n schema,\n uischema,\n}: GenericAdditionalPropertiesProps) => {\n const t = useExtendedTranslator();\n const [newPropertyName, setNewPropertyName] = useState('');\n const [renamingPropertyName, setRenamingPropertyName] = useState<\n string | null\n >(null);\n const [renameValue, setRenameValue] = useState('');\n const {\n maxPropertiesReached,\n minPropertiesReached,\n appliedOptions,\n objectData,\n allowIfMissing,\n additionalPropertyItems,\n shouldShow,\n } = useAdditionalPropertyItems({\n data,\n schema,\n rootSchema,\n path,\n uischema,\n config,\n });\n\n if (!shouldShow) {\n return null;\n }\n\n const propertyName = newPropertyName.trim();\n const propertyNameError = validatePropertyName(\n t,\n propertyName,\n data,\n schema,\n rootSchema,\n );\n const addPropertyDisabled =\n !enabled ||\n readonly ||\n (appliedOptions.restrict && maxPropertiesReached) ||\n Boolean(propertyNameError) ||\n !propertyName;\n const removePropertyDisabled =\n !enabled || readonly || (appliedOptions.restrict && minPropertiesReached);\n\n const addProperty = () => {\n if (addPropertyDisabled) {\n return;\n }\n\n const additionalProperty = toAdditionalPropertyItem(\n propertyName,\n path,\n schema,\n rootSchema,\n allowIfMissing,\n );\n const updatedData = objectData ? { ...objectData } : {};\n\n updatedData[propertyName] = createDefaultValue(\n additionalProperty.schema,\n rootSchema,\n );\n handleChange(path, updatedData);\n setNewPropertyName('');\n };\n\n const removeProperty = (propertyToRemove: string) => {\n if (removePropertyDisabled || !objectData) {\n return;\n }\n\n const updatedData = { ...objectData };\n delete updatedData[propertyToRemove];\n handleChange(path, updatedData);\n };\n\n const renameProperty = (propertyToRename: string) => {\n const trimmed = renameValue.trim();\n const renameError = validatePropertyName(\n t,\n trimmed,\n data,\n schema,\n rootSchema,\n propertyToRename,\n );\n if (\n renameError ||\n !trimmed ||\n trimmed === propertyToRename ||\n !objectData\n ) {\n return;\n }\n\n const updatedData = renamePropertyKey(\n objectData,\n propertyToRename,\n trimmed,\n );\n handleChange(path, updatedData);\n setRenamingPropertyName(null);\n setRenameValue('');\n };\n\n return (\n <div className='jsonforms-additional-properties'>\n <div className='jsonforms-additional-properties-add'>\n <input\n aria-label={\n label\n ? t('additionalProperties.addTo', { label })\n : t('additionalProperties.addLabel')\n }\n disabled={!enabled || readonly}\n placeholder={t('additionalProperties.namePlaceholder')}\n type='text'\n value={newPropertyName}\n onChange={(event) => setNewPropertyName(event.currentTarget.value)}\n onKeyDown={(event) => {\n if (event.key === 'Enter') {\n addProperty();\n }\n }}\n />\n <button\n disabled={addPropertyDisabled}\n type='button'\n onClick={addProperty}\n >\n {t('additionalProperties.add')}\n </button>\n </div>\n {propertyNameError ? (\n <div className='jsonforms-additional-properties-error'>\n {propertyNameError}\n </div>\n ) : null}\n <div className='jsonforms-additional-properties-list'>\n {additionalPropertyItems.map((item) => {\n const isRenaming = renamingPropertyName === item.propertyName;\n const renameError = validatePropertyName(\n t,\n renameValue.trim(),\n data,\n schema,\n rootSchema,\n item.propertyName,\n );\n const renameDisabled =\n !enabled ||\n readonly ||\n Boolean(renameError) ||\n !renameValue.trim() ||\n renameValue.trim() === item.propertyName;\n\n return (\n <div\n className='jsonforms-additional-property'\n key={item.propertyName}\n >\n <div className='jsonforms-additional-property-control'>\n <JsonFormsDispatch\n schema={item.schema}\n uischema={item.uischema}\n path={item.path}\n enabled={enabled}\n renderers={renderers}\n cells={cells}\n readonly={readonly}\n />\n </div>\n {enabled ? (\n <div className='jsonforms-additional-property-actions'>\n {isRenaming ? (\n <>\n <input\n aria-label={t('additionalProperties.renameNamed', {\n name: item.propertyName,\n })}\n autoFocus\n disabled={readonly}\n type='text'\n value={renameValue}\n onChange={(event) =>\n setRenameValue(event.currentTarget.value)\n }\n onKeyDown={(event) => {\n if (event.key === 'Enter') {\n renameProperty(item.propertyName);\n } else if (event.key === 'Escape') {\n setRenamingPropertyName(null);\n setRenameValue('');\n }\n }}\n />\n <button\n disabled={renameDisabled}\n type='button'\n onClick={() => renameProperty(item.propertyName)}\n >\n {t('additionalProperties.save')}\n </button>\n <button\n type='button'\n onClick={() => {\n setRenamingPropertyName(null);\n setRenameValue('');\n }}\n >\n {t('additionalProperties.cancel')}\n </button>\n {renameError ? (\n <div className='jsonforms-additional-properties-error'>\n {renameError}\n </div>\n ) : null}\n </>\n ) : (\n <>\n <button\n disabled={readonly}\n type='button'\n onClick={() => {\n setRenamingPropertyName(item.propertyName);\n setRenameValue(item.propertyName);\n }}\n >\n {t('additionalProperties.rename')}\n </button>\n <button\n disabled={removePropertyDisabled}\n type='button'\n onClick={() => removeProperty(item.propertyName)}\n >\n {t('additionalProperties.delete')}\n </button>\n </>\n )}\n </div>\n ) : null}\n </div>\n );\n })}\n </div>\n </div>\n );\n};\n","import type {\n CodeKeywordDefinition,\n AnySchemaObject,\n KeywordCxt,\n Code,\n Name,\n} from 'ajv';\nimport { _, stringify, getProperty } from 'ajv/dist/compile/codegen';\nimport capitalizeFn from 'lodash/capitalize';\nimport startCaseFn from 'lodash/startCase';\n\n/**\n * `transform`, with more transformations than `ajv-keywords` defines.\n *\n * Ported from the Vue 2 `common` package, which is the reference for what\n * forms in this organisation already author against. `ajv-keywords`' own\n * `transform` is **not extensible** - its transformation table is a module\n * constant with no registration hook - so the only way to add `capitalize`\n * and `startCase` is to remove its keyword and register this one in its place.\n * That is what `registerAjvKeywords` does, and it is why this file exists\n * rather than a three-line plugin.\n *\n * Note that `transform` **mutates the data** as a side effect of validation,\n * which is unusual for a validator and deliberate here: the legacy forms rely\n * on it to normalise input. It runs `before: 'enum'` so a transformed value is\n * what `enum` and `toEnumCase` compare against.\n */\n\ntype TransformName =\n | 'trimStart'\n | 'trimEnd'\n | 'trimLeft'\n | 'trimRight'\n | 'trim'\n | 'toLowerCase'\n | 'toUpperCase'\n | 'toEnumCase'\n | 'capitalize'\n | 'startCase';\n\ninterface TransformConfig {\n hash: Record<string, string | undefined>;\n}\n\ntype Transform = (s: string, cfg?: TransformConfig) => string;\n\nconst transform: { [key in TransformName]: Transform } = {\n trimStart: (s) => s.trimStart(),\n trimEnd: (s) => s.trimEnd(),\n trimLeft: (s) => s.trimStart(),\n trimRight: (s) => s.trimEnd(),\n trim: (s) => s.trim(),\n toLowerCase: (s) => s.toLowerCase(),\n toUpperCase: (s) => s.toUpperCase(),\n toEnumCase: (s, cfg) => cfg?.hash[configKey(s)] || s,\n capitalize: (s) => capitalizeFn(s),\n startCase: (s) => startCaseFn(s),\n};\n\nconst getDef: (() => CodeKeywordDefinition) & {\n transform: typeof transform;\n} = Object.assign(_getDef, { transform });\n\nfunction _getDef(): CodeKeywordDefinition {\n return {\n keyword: 'transform',\n schemaType: 'array',\n before: 'enum',\n code(cxt: KeywordCxt) {\n const { gen, data, schema, parentSchema, it } = cxt;\n const { parentData, parentDataProperty } = it;\n const tNames: string[] = schema;\n if (!tNames.length) return;\n let cfg: Name | undefined;\n if (tNames.includes('toEnumCase')) {\n const config = getEnumCaseCfg(parentSchema);\n cfg = gen.scopeValue('obj', { ref: config, code: stringify(config) });\n }\n gen.if(\n _`typeof ${data} == \"string\" && ${parentData} !== undefined`,\n () => {\n gen.assign(data, transformExpr(tNames.slice()));\n gen.assign(_`${parentData}[${parentDataProperty}]`, data);\n },\n );\n\n function transformExpr(ts: string[]): Code {\n if (!ts.length) return data;\n const t = ts.pop() as string;\n if (!(t in transform))\n throw new Error(`transform: unknown transformation ${t}`);\n const func = gen.scopeValue('func', {\n ref: transform[t as TransformName],\n code: _`require(\"ajv-keywords/dist/definitions/transform\").transform${getProperty(\n t,\n )}`,\n });\n const arg = transformExpr(ts);\n return cfg && t === 'toEnumCase'\n ? _`${func}(${arg}, ${cfg})`\n : _`${func}(${arg})`;\n }\n },\n metaSchema: {\n type: 'array',\n items: { type: 'string', enum: Object.keys(transform) },\n },\n };\n}\n\nfunction getEnumCaseCfg(parentSchema: AnySchemaObject): TransformConfig {\n // build hash table to enum values\n const cfg: TransformConfig = { hash: {} };\n\n // requires `enum` in the same schema as transform\n if (!parentSchema.enum)\n throw new Error('transform: \"toEnumCase\" requires \"enum\"');\n for (const v of parentSchema.enum) {\n if (typeof v !== 'string') continue;\n const k = configKey(v);\n // requires all `enum` values have unique keys\n if (cfg.hash[k]) {\n throw new Error(\n 'transform: \"toEnumCase\" requires all lowercased \"enum\" values to be unique',\n );\n }\n cfg.hash[k] = v;\n }\n\n return cfg;\n}\n\nfunction configKey(s: string): string {\n return s.toLowerCase();\n}\n\nexport default getDef;\n","import dayjs, { UnitType } from 'dayjs';\nimport customParsingPlugin from 'dayjs/plugin/customParseFormat';\nimport durationPlugin from 'dayjs/plugin/duration';\nimport timezonePlugin from 'dayjs/plugin/timezone'; // dependent on the utc plugin\nimport utcPlugin from 'dayjs/plugin/utc';\n\n/**\n * Extra `dynamicDefaults` generators, ported from the Vue 2 `common` package.\n *\n * `ajv-keywords`' `dynamicDefaults` ships `timestamp`, `datetime`, `date`,\n * `time`, `random`, `randomint` and `seq`. The set below replaces the temporal\n * ones with offset-aware versions - `{ \"func\": \"date\", \"args\": { \"duration\":\n * \"P1D\" } }` is \"tomorrow\" - and adds `searchParams` and `dynamic`.\n *\n * Unlike the rest of the validator profile these **write into the data**, so\n * they only run under `useDefaults`.\n */\n\n// Required for the custom save formats in the date, time and date-time pickers.\ndayjs.extend(customParsingPlugin);\ndayjs.extend(utcPlugin);\ndayjs.extend(timezonePlugin);\ndayjs.extend(durationPlugin);\n\ntype Generator = (args: unknown) => () => unknown;\n\nconst arg = (args: unknown, name: string): string | undefined => {\n const value = (args as Record<string, unknown> | undefined)?.[name];\n return typeof value === 'string' ? value : undefined;\n};\n\n/**\n * A default computed by a function **written in the schema**.\n *\n * ```json\n * { \"dynamicDefaults\": { \"ref\": { \"func\": \"dynamic\", \"args\": { \"func\": \"(a) => a.x\" } } } }\n * ```\n *\n * The Vue 2 original compiles that string with `new Function` unconditionally.\n * Here it is gated: a schema is data, it can arrive with the form, and\n * compiling a string out of it is the same capability the template engines and\n * `Button.script` need permission for. Section 14 is explicit - \"String\n * evaluation requires `jsonformsExtended.security.allowScriptEvaluation=true`\"\n * - and there is no reason this one entry point should be the exception.\n *\n * Without the permission it is **reported, not silently skipped**: a default\n * that quietly does not appear is indistinguishable from a schema that never\n * asked for one.\n */\nexport const makeDynamic = (\n allowScriptEvaluation: () => boolean,\n): Generator => {\n return (args: unknown) => {\n const source = arg(args, 'func');\n if (!source) {\n throw new Error(\n `missing argument 'func' for dynamicDefaults func 'dynamic'`,\n );\n }\n if (!allowScriptEvaluation()) {\n // oxlint-disable-next-line no-console\n console.warn(\n `dynamicDefaults.evaluationDisabled: the 'dynamic' default compiles a ` +\n `function from the schema, which requires ` +\n `jsonformsExtended.security.allowScriptEvaluation. No default was applied.`,\n );\n return () => undefined;\n }\n try {\n const compiled = new Function(\n 'args',\n `const func = ${source}; return func(args);`,\n );\n return () => {\n try {\n return compiled(args);\n } catch (error) {\n // oxlint-disable-next-line no-console\n console.error(`Error at dynamicDefaults 'dynamic': ${error}`);\n return undefined;\n }\n };\n } catch (error) {\n // oxlint-disable-next-line no-console\n console.error(`Error at dynamicDefaults 'dynamic': ${error}`);\n return () => undefined;\n }\n };\n};\n\n/**\n * A default taken from the page's query string, including one after the hash.\n *\n * Guarded for a non-browser host: this package is rendered in jsdom by its own\n * tests and may be server-rendered, where `window` is absent and the original\n * threw.\n */\nexport const searchParams: Generator = (args: unknown) => {\n const name = arg(args, 'param');\n if (!name || typeof window === 'undefined' || !window.location) {\n return () => undefined;\n }\n\n const url = new URL(window.location.href);\n let result = url.searchParams.get(name) ?? undefined;\n\n if (result === undefined) {\n // Also after the hash, where a hash-routed application puts them.\n const hash = url.hash;\n const index = hash.indexOf('?');\n if (index > 0 && index < hash.length - 1) {\n result =\n new URLSearchParams(hash.substring(index + 1)).get(name) ?? undefined;\n }\n }\n\n return () => result;\n};\n\n/**\n * \"now\", optionally shifted by an ISO 8601 duration.\n *\n * `{ \"date\": \"2024-01-01\", \"duration\": \"P1M\", \"op\": \"subtract\" }`. `date`\n * defaults to now, and the literal string `\"now\"` means the same thing.\n */\nconst nowOffset = (args: unknown) => {\n const duration = arg(args, 'duration');\n const supplied = arg(args, 'date');\n const date: string | Date =\n supplied && supplied !== 'now' ? supplied : new Date();\n\n /*\n `subtract`, and the original's misspelling. The Vue 2 version compares\n against `'substract'`, so every schema written against it spells it that\n way; accepting only the correct spelling would break them, and accepting\n only the misspelling would enshrine it.\n */\n const op = arg(args, 'op');\n const subtracting = op === 'subtract' || op === 'substract';\n\n let value = dayjs(date);\n if (value.isValid() && duration) {\n const offset = dayjs.duration(duration);\n value = subtracting ? value.subtract(offset) : value.add(offset);\n }\n return value;\n};\n\nconst temporal =\n (format: string): Generator =>\n (args: unknown) => {\n const value = nowOffset(args);\n const result = value.isValid() ? value.local().format(format) : undefined;\n return () => result;\n };\n\nexport const datetimeOffset = temporal('YYYY-MM-DDTHH:mm:ss.SSS');\nexport const timeOffset = temporal('HH:mm:ss.SSS');\nexport const dateOffset = temporal('YYYY-MM-DD');\n\n/** One component of the offset date - `{ \"unit\": \"year\" }`. */\nexport const dateUnit: Generator = (args: unknown) => {\n const value = nowOffset(args);\n if (!value.isValid()) {\n return () => undefined;\n }\n const unit = (arg(args, 'unit') ?? 'millisecond') as UnitType;\n const result = value.local().get(unit);\n return () => result;\n};\n","import type Ajv from 'ajv';\nimport keywords from 'ajv-keywords';\nimport dynamicDefaults from 'ajv-keywords/dist/definitions/dynamicDefaults';\nimport transform from './transform';\nimport {\n dateOffset,\n dateUnit,\n datetimeOffset,\n makeDynamic,\n searchParams,\n timeOffset,\n} from './dynamicDefaults';\n\n/**\n * `ajv-keywords`, plus the extensions the Vue 2 `common` package added.\n *\n * Two of the three registrations here are **global mutations of the\n * `ajv-keywords` module**, not of the Ajv instance: `dynamicDefaults.DEFAULTS`\n * is a module-level table, so a generator registered for one validator is\n * registered for every validator in the process. That is how the original\n * works and it cannot be made per-instance without forking the plugin, so it\n * is written down rather than hidden - and it is why {@link registerAjvKeywords}\n * is idempotent instead of assuming it runs once.\n */\n\nexport interface AjvKeywordOptions {\n /**\n * Whether the `dynamic` default - which compiles a function from the schema\n * - is permitted. Read when a schema compiles, so one validator can answer\n * differently for different forms.\n *\n * Off by default. Section 14: \"String evaluation requires\n * `jsonformsExtended.security.allowScriptEvaluation=true`.\"\n */\n allowScriptEvaluation?: () => boolean;\n}\n\nexport const registerAjvKeywords = (\n ajv: Ajv,\n options: AjvKeywordOptions = {},\n): Ajv => {\n keywords(ajv);\n\n /*\n `ajv-keywords`' own `transform` has a fixed transformation table with no\n registration hook, so adding `capitalize` and `startCase` means replacing\n the keyword outright. Removing first, because `addKeyword` on an existing\n keyword throws.\n */\n if (ajv.getKeyword('transform')) {\n ajv.removeKeyword('transform');\n }\n ajv.addKeyword(transform());\n\n const defaults = dynamicDefaults.DEFAULTS as Record<string, unknown>;\n defaults.dynamic = makeDynamic(\n options.allowScriptEvaluation ?? (() => false),\n );\n defaults.searchParams = searchParams;\n /*\n These three **replace** `ajv-keywords`' own `datetime`, `date` and `time`,\n which take no arguments. The replacements accept an offset, and with no\n arguments behave as the originals did.\n */\n defaults.datetime = datetimeOffset;\n defaults.date = dateOffset;\n defaults.time = timeOffset;\n defaults.dateUnit = dateUnit;\n\n return ajv;\n};\n","/**\n * Six-field cron, read and written.\n *\n * **Six fields, not five and not seven**: `second minute hour day-of-month month day-of-week`.\n * This is Spring's dialect — `org.springframework.scheduling.support.CronExpression`, which is\n * also what Quartz-adjacent Java schedulers accept minus the year field. It is deliberately not\n * Unix cron, which has no seconds, and not Quartz, which adds a seventh `year` field and ORs the\n * two day fields. An expression written for one and read as the other schedules the wrong thing\n * while looking correct, so the dialect is stated rather than guessed.\n *\n * Spring **ANDs** every field — `CronExpression.nextOrSame` applies them in sequence, with none of\n * Quartz's OR special case — and `?` is its alias for `*`, allowed only in the two day fields.\n *\n * The model here is **one value set per field**, which is what lets the picker offer a list to\n * choose from rather than a syntax to learn. A field that cannot be stated as a set — `L`, `W`,\n * `#` — is left as the text it is, and the control edits that field as text. Nothing is lost and\n * nothing is rewritten.\n */\n\n/** A placeholder for an empty field: every fifteen minutes, on the minute. */\nexport const DEFAULT_CRON = '0 0/15 * * * *';\n\n/** The six fields, in the order an expression writes them. */\nexport const CRON_FIELDS = [\n 'second',\n 'minute',\n 'hour',\n 'dayOfMonth',\n 'month',\n 'dayOfWeek',\n] as const;\n\nexport type CronField = (typeof CRON_FIELDS)[number];\n\n/** Day-of-week names Spring accepts, in the order it numbers them. */\nexport const DAY_NAMES = [\n 'SUN',\n 'MON',\n 'TUE',\n 'WED',\n 'THU',\n 'FRI',\n 'SAT',\n] as const;\n\n/** Month names Spring accepts. `JAN` is 1, so this list is offset by one from its values. */\nexport const MONTH_NAMES = [\n 'JAN',\n 'FEB',\n 'MAR',\n 'APR',\n 'MAY',\n 'JUN',\n 'JUL',\n 'AUG',\n 'SEP',\n 'OCT',\n 'NOV',\n 'DEC',\n] as const;\n\n/**\n * The range a field's **values** live in.\n *\n * Day-of-week stops at 6 although Spring also accepts `7` for Sunday: a set with two Sundays in it\n * would offer the same day twice in the picker. `7` is folded to `0` on the way in and never\n * written back out.\n */\nexport const FIELD_RANGE: Record<CronField, [number, number]> = {\n second: [0, 59],\n minute: [0, 59],\n hour: [0, 23],\n dayOfMonth: [1, 31],\n month: [1, 12],\n dayOfWeek: [0, 6],\n};\n\n/** The names a field's values may be written with, where it has any. */\nfunction namesFor(field: CronField): readonly string[] | undefined {\n if (field === 'dayOfWeek') return DAY_NAMES;\n if (field === 'month') return MONTH_NAMES;\n return undefined;\n}\n\n/** Macros Spring understands in place of all six fields. `@reboot` is not one of them. */\nconst MACROS: Record<string, string> = {\n '@yearly': '0 0 0 1 1 *',\n '@annually': '0 0 0 1 1 *',\n '@monthly': '0 0 0 1 * *',\n '@weekly': '0 0 0 * * 0',\n '@daily': '0 0 0 * * *',\n '@midnight': '0 0 0 * * *',\n '@hourly': '0 0 * * * *',\n};\n\n/** The six fields of an expression, or `undefined` when it does not have six. */\nexport function splitCron(expression: string): string[] | undefined {\n const trimmed = expression.trim();\n if (trimmed === '') return undefined;\n const expanded = MACROS[trimmed.toLowerCase()] ?? trimmed;\n const fields = expanded.split(/\\s+/);\n return fields.length === 6 ? fields : undefined;\n}\n\n/** A field's six parts joined back into an expression. */\nexport function joinCron(fields: readonly string[]): string {\n return fields.join(' ');\n}\n\n/** A named or numeric value as the number Spring reads it as. */\nfunction valueOf(text: string, field: CronField): number | undefined {\n const names = namesFor(field);\n if (names) {\n const index = names.indexOf(text.toUpperCase());\n if (index >= 0) return field === 'month' ? index + 1 : index;\n }\n if (!/^\\d+$/.test(text)) return undefined;\n const number = Number(text);\n // Both `0` and `7` are Sunday; the set keeps one of them.\n if (field === 'dayOfWeek' && number === 7) return 0;\n const [low, high] = FIELD_RANGE[field];\n return number >= low && number <= high ? number : undefined;\n}\n\n/**\n * The values one field selects, or `undefined` when it does not select a set.\n *\n * `undefined` is the honest answer for `L`, `W` and `#` — \"the last weekday of the month\" is not a\n * list of days, and turning it into one would change what the schedule does. It is also the answer\n * for anything malformed, which is what lets the caller tell a field it can offer choices for from\n * one it has to leave as text.\n */\nexport function parseField(\n text: string,\n field: CronField,\n): number[] | undefined {\n const [low, high] = FIELD_RANGE[field];\n const all = (): number[] =>\n Array.from({ length: high - low + 1 }, (_, index) => low + index);\n const value = text.trim();\n if (value === '') return undefined;\n // `?` is Spring's alias for `*`, and only in the two day fields.\n if (value === '*') return all();\n if (value === '?')\n return field === 'dayOfMonth' || field === 'dayOfWeek' ? all() : undefined;\n\n const selected = new Set<number>();\n for (const part of value.split(',')) {\n const [range, step, ...rest] = part.split('/');\n if (rest.length > 0) return undefined;\n let by = 1;\n if (step !== undefined) {\n if (!/^\\d+$/.test(step) || Number(step) < 1) return undefined;\n by = Number(step);\n }\n\n let from: number;\n let to: number;\n if (range === '*' || range === '?') {\n [from, to] = [low, high];\n } else {\n const [start, end, ...extra] = range.split('-');\n if (extra.length > 0) return undefined;\n const first = valueOf(start, field);\n if (first === undefined) return undefined;\n if (end === undefined) {\n // `5/10` means \"from 5, every 10\" — a bare value only when there is no step beside it.\n [from, to] = step === undefined ? [first, first] : [first, high];\n } else {\n const last = valueOf(end, field);\n if (last === undefined) return undefined;\n // A range that wraps the end of the week (`FRI-MON`) is legal and is not a set this can\n // state without inventing an order, so it is left as text.\n if (last < first) return undefined;\n [from, to] = [first, last];\n }\n }\n for (let each = from; each <= to; each += by) selected.add(each);\n }\n return [...selected].sort((left, right) => left - right);\n}\n\n/** One value as the picker shows it and the expression writes it: a name where the field has one. */\nexport function labelFor(value: number, field: CronField): string {\n const names = namesFor(field);\n if (!names) return String(value);\n return field === 'month' ? names[value - 1] : names[value];\n}\n\n/**\n * One field written as compactly as it can be said.\n *\n * Runs become ranges and an even spacing becomes a step, because that is how people write these\n * and a list of every value is not readable at a glance. Named fields are written with their names\n * and never with a step: a step on a name is not something every reader will be sure of, and the\n * list it would save is three characters long.\n */\nexport function formatField(\n values: readonly number[],\n field: CronField,\n): string {\n const [low, high] = FIELD_RANGE[field];\n const sorted = [...new Set(values)]\n .filter((value) => value >= low && value <= high)\n .sort((a, b) => a - b);\n // An empty selection is \"every\", which is what clearing a field means. It is never written as\n // nothing, which would not be an expression.\n if (sorted.length === 0 || sorted.length === high - low + 1) return '*';\n\n const named = namesFor(field) !== undefined;\n if (!named && sorted.length > 2) {\n const step = sorted[1] - sorted[0];\n const even = sorted.every(\n (value, index) => index === 0 || value - sorted[index - 1] === step,\n );\n // Only when the run really goes to the end of the field: `0,15,30` is evenly spaced too, and\n // writing it as a step would add 45 to the schedule.\n if (even && step > 1 && sorted[sorted.length - 1] + step > high) {\n return sorted[0] === low ? `*/${step}` : `${sorted[0]}/${step}`;\n }\n }\n\n const parts: string[] = [];\n let index = 0;\n while (index < sorted.length) {\n let end = index;\n while (end + 1 < sorted.length && sorted[end + 1] === sorted[end] + 1)\n end += 1;\n const first = labelFor(sorted[index], field);\n // Two in a row is written as two: `1-2` is no shorter than `1,2` and reads as less.\n if (end - index >= 2)\n parts.push(`${first}-${labelFor(sorted[end], field)}`);\n else\n for (let each = index; each <= end; each += 1)\n parts.push(labelFor(sorted[each], field));\n index = end + 1;\n }\n return parts.join(',');\n}\n\n/** Whether a field is something Spring would accept, set or not. */\nfunction validField(value: string, field: CronField): boolean {\n if (parseField(value, field) !== undefined) return true;\n if (\n field === 'dayOfMonth' &&\n (value === 'L' ||\n value === 'LW' ||\n /^L-\\d+$/.test(value) ||\n /^\\d+W$/.test(value))\n ) {\n return true;\n }\n // `5#2` is the second Friday and `FRI#2` is the same day written with a name; Spring accepts both\n // spellings, so a validator that only knew the numeric one would call a working schedule broken.\n if (\n field === 'dayOfWeek' &&\n (/^\\d?L$/.test(value) ||\n /^[A-Za-z]{3}L$/.test(value) ||\n /^(?:\\d|[A-Za-z]{3})#[1-5]$/.test(value))\n ) {\n return true;\n }\n // A wrapping range is legal and simply not a set. `FRI-MON`, `NOV-FEB`.\n const [start, end] = value.split('-');\n return (\n end !== undefined &&\n valueOf(start, field) !== undefined &&\n valueOf(end, field) !== undefined\n );\n}\n\n/** Why this expression cannot be scheduled, as a message key, or `undefined` when it can. */\nexport function cronProblem(expression: string): string | undefined {\n const fields = splitCron(expression);\n if (!fields) return 'sixFields';\n const bad = CRON_FIELDS.findIndex(\n (field, index) => !validField(fields[index], field),\n );\n return bad < 0 ? undefined : CRON_FIELDS[bad];\n}\n\n/**\n * How often the schedule repeats — the coarsest thing it puts a condition on.\n *\n * This is what the picker asks first, because it decides which of the six fields are worth showing:\n * a schedule that runs every hour has nothing to say about which day it is, and five dropdowns of\n * \"every\" is a form that hides its own answer. Derived rather than stored, so an expression typed\n * into the field opens on the period it actually describes.\n */\nexport type CronPeriod =\n | 'year'\n | 'month'\n | 'week'\n | 'day'\n | 'hour'\n | 'minute'\n | 'second';\n\n/** Coarsest first: the order a period is decided in, and the order the picker lists fields in. */\nconst BY_PERIOD: ReadonlyArray<readonly [CronPeriod, CronField]> = [\n ['year', 'month'],\n ['month', 'dayOfMonth'],\n ['week', 'dayOfWeek'],\n ['day', 'hour'],\n ['hour', 'minute'],\n ['minute', 'second'],\n];\n\n/** Whether a field says anything at all, rather than standing for every value it could take. */\nexport function isEvery(text: string, field: CronField): boolean {\n const values = parseField(text, field);\n const [low, high] = FIELD_RANGE[field];\n return values !== undefined && values.length === high - low + 1;\n}\n\nexport function periodOf(fields: readonly string[]): CronPeriod {\n for (const [period, field] of BY_PERIOD) {\n if (!isEvery(fields[CRON_FIELDS.indexOf(field)], field)) return period;\n }\n return 'second';\n}\n\n/**\n * The fields the picker shows for a period, coarsest first.\n *\n * Everything finer than the period, which is what \"repeats every X\" leaves to be decided. A period\n * of `week` hides the day of the month, since naming both days would mean \"the 5th, and only when\n * it is a Monday\" — legal under Spring's AND, and never what picking a weekday meant.\n */\nexport function fieldsForPeriod(period: CronPeriod): CronField[] {\n const from = BY_PERIOD.findIndex(([each]) => each === period);\n if (from < 0) return [];\n return (\n BY_PERIOD.slice(from)\n .map(([, field]) => field)\n // A weekly schedule picks weekdays, not days of the month.\n .filter((field) => !(period === 'week' && field === 'dayOfMonth'))\n );\n}\n\n/**\n * Whether two expressions schedule the same thing.\n *\n * The point is to **not write**. `0 0/15 * * * *` and its asterisk spelling select the same\n * minutes, and `@daily` is `0 0 0 * * *`; opening the picker on one and pressing OK without\n * touching anything must leave the field exactly as it was. Rewriting it would mark the field\n * dirty on its own and quietly replace what a server sent — the same rule the duration control\n * keeps for `P1DT0H` against `P1D`, and the one section 18 states as \"existing data must not be\n * silently normalized solely because the renderer is mounted\".\n *\n * Compared as **values**, field by field, which is the only comparison that answers this: the two\n * spellings are different strings and the same schedule. A field neither side can state as a set is\n * compared as text, because two pieces of syntax this does not model are only known to agree when\n * they are identical.\n */\nexport function sameExpression(left: string, right: string): boolean {\n if (left.trim() === right.trim()) return true;\n const a = splitCron(left);\n const b = splitCron(right);\n if (!a || !b) return false;\n return CRON_FIELDS.every((field, index) => {\n const one = parseField(a[index], field);\n const other = parseField(b[index], field);\n if (one === undefined || other === undefined) return a[index] === b[index];\n return (\n one.length === other.length &&\n one.every((value, at) => value === other[at])\n );\n });\n}\n\n/** Every field standing for every value: what a picker opened on nothing has chosen so far. */\nexport const NOTHING_CHOSEN: readonly string[] = ['*', '*', '*', '*', '*', '*'];\n\n/**\n * How coarse each field is, for deciding what is \"finer than\" what.\n *\n * The two day fields share a rank because they answer the same question — which day — by two\n * different routes, and neither is finer than the other.\n */\nconst COARSENESS: Record<CronField, number> = {\n month: 0,\n dayOfMonth: 1,\n dayOfWeek: 1,\n hour: 2,\n minute: 3,\n second: 4,\n};\n\n/**\n * A period's fields with everything coarser than it standing down to every.\n *\n * The period is a **lens**, not data: it decides which rows are worth showing and nothing else, so\n * this seeds nothing and selects nothing. The one thing it must do is drop the conditions the lens\n * is about to hide — a monthly schedule switched to daily that kept its day of the month would\n * still run once a month, with nothing on screen saying so, because the row that said it is gone.\n */\nexport function standDown(\n fields: readonly string[],\n period: CronPeriod,\n): string[] {\n const shown = new Set(fieldsForPeriod(period));\n return CRON_FIELDS.map((field, index) =>\n shown.has(field) ? (fields[index] ?? '*') : '*',\n );\n}\n\n/**\n * The time of day a choice implies, where it has not been said.\n *\n * Picking nine o'clock means **nine o'clock**, not every second of the hour after it — but in cron\n * a field left alone means every value, so `* * 9 * * *` is 3600 executions and not one. So\n * choosing a value pins the time fields below it that are still saying \"every\".\n *\n * Only downwards, only the time fields, and only when something was actually chosen. Clearing a\n * field pins nothing, and the day and month fields are never filled in on someone's behalf: that\n * would be the picker deciding which day the schedule runs, which is the question being asked.\n * Every pin it does make is one selection away from being undone, so \"every minute during the 9am\n * hour\" is still reachable — it is just no longer what picking an hour silently means.\n */\nexport function withTimeDefaults(\n fields: readonly string[],\n changed: CronField,\n): string[] {\n const from = COARSENESS[changed];\n return CRON_FIELDS.map((field, index) => {\n const text = fields[index] ?? '*';\n const isTime = field === 'hour' || field === 'minute' || field === 'second';\n if (!isTime || COARSENESS[field] <= from || !isEvery(text, field))\n return text;\n return formatField([FIELD_RANGE[field][0]], field);\n });\n}\n","import { createAjv as createDefaultAjv } from '@jsonforms/core';\nimport type { JsonFormsI18nState } from '@jsonforms/core';\nimport ajvErrors from 'ajv-errors';\nimport { AjvLocalizers, ajvTranslations } from './ajvI18n';\nimport { registerAjvKeywords } from './keywords';\nimport { cronProblem } from '../util/cron';\n\n/*\n Types taken from core's own factory rather than from `ajv` directly. `ajv` is\n not a dependency here - upstream resolves it by root hoisting - so importing\n it even for types makes the package build depend on that hoisting holding.\n*/\ntype Ajv = ReturnType<typeof createDefaultAjv>;\ntype Options = NonNullable<Parameters<typeof createDefaultAjv>[0]>;\n\n/**\n * The validator this renderer set is written against.\n *\n * JSON Forms' own `createAjv()` is deliberately plain, and three of the things\n * it leaves off are things forms here rely on. The Svelte renderer family\n * makes the same three choices, which is a useful check that this is the\n * shape of validator these renderers expect rather than a local preference.\n *\n * | Option | Why |\n * | --- | --- |\n * | `$data: true` | Without it a `$data` bound does not merely go unenforced - the schema **fails to compile**, and the whole form stops. See below. |\n * | `useDefaults: true` | A schema `default` is written into the data, which several renderers assume when they say a value \"is\" its default. |\n * | `discriminator: true` | Lets a discriminated `oneOf` report the branch's own errors instead of every branch's. |\n *\n * **`$data` is the one that bites.** Ajv rejects `{\"formatMinimum\": {\"$data\": \"1/from\"}}`\n * at compile time with `formatMinimum value must be [\"string\"]` unless the\n * option is set, so a date range written the obvious way takes the form down\n * rather than degrading. That is why this factory exists at all, and why the\n * web component uses it by default.\n */\nexport interface FormsAjvOptions extends Options {\n /** Extra formats to register, as `{ name: predicate }`. */\n formats?: Record<string, (value: string) => boolean>;\n /**\n * `ajv-keywords`, the extended `transform`, and the extra dynamic defaults.\n *\n * Not spelled `keywords`: Ajv already has an option by that name, which\n * takes a `Vocabulary`. Two different things called the same thing in one\n * options object is how a `true` ends up where a vocabulary was expected.\n *\n * On by default, and the reason is that **turning them off fails silently**.\n * JSON Forms' factory sets `strictSchema: false`, so Ajv ignores a keyword\n * it does not know: a schema carrying `transform` or `allRequired` compiles\n * without complaint, validates less than it says, and leaves the data\n * untransformed. Nothing throws and nothing is logged. These are what the\n * Vue 2 forms in this organisation are already authored against, so the\n * default has to be on.\n */\n extendedKeywords?: boolean;\n /**\n * `ajv-errors`, so a schema can carry its own `errorMessage`.\n *\n * On by default. Requires `allErrors`, which this factory therefore turns on\n * with it - see below.\n */\n errorMessages?: boolean;\n /**\n * Permits the `dynamic` dynamic default, which compiles a function from the\n * schema. Off by default; section 14 requires the permission.\n *\n * **A getter is accepted, and is usually what you want.** Everywhere else in\n * this project the permission comes from a *form's*\n * `config.jsonformsExtended.security.allowScriptEvaluation`, but a validator\n * is created once and shared by every form it validates - Ajv caches\n * compiled schemas, so building one per form would recompile on every\n * keystroke. A getter lets the one validator answer per form, the same way\n * `i18n` lets it answer per locale.\n *\n * It is read when a schema **compiles**, not when it validates, because that\n * is when `dynamicDefaults` generators are built.\n */\n allowScriptEvaluation?: boolean | (() => boolean);\n /**\n * The form's i18n state, read at validation time.\n *\n * Supplying it turns on `errorMessage` translation. Ajv's **own** messages\n * are localized only if `localizers` is supplied as well.\n */\n i18n?: () => JsonFormsI18nState | undefined;\n /**\n * Ajv's message localizers - `ajvLocalizers` from\n * `core/ajvI18n/localizers`, or a subset.\n */\n localizers?: AjvLocalizers;\n}\n\n/** `color` is not a JSON Schema format and `ajv-formats` does not define one. */\nconst COLOR =\n /^(#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})|rgba?\\(.*\\)|hsla?\\(.*\\)|hsb\\(.*\\)|transparent)$/i;\n\nexport const createFormsAjv = (options: FormsAjvOptions = {}): Ajv => {\n const {\n formats,\n extendedKeywords = true,\n errorMessages = true,\n allowScriptEvaluation = false,\n i18n,\n localizers,\n ...ajvOptions\n } = options;\n\n const ajv = createDefaultAjv({\n useDefaults: true,\n $data: true,\n discriminator: true,\n /*\n `ajv-errors` requires `allErrors`, and throws at plugin time without it.\n Turning it on here rather than asking every caller to remember is also\n what a form wants: JSON Forms shows every field's error at once, so\n stopping at the first failure would leave most of the form silent.\n\n A caller may still override it; `ajv-errors` is then skipped rather than\n allowed to throw.\n */\n ...(errorMessages ? { allErrors: true } : {}),\n ...ajvOptions,\n });\n\n ajv.addFormat('color', {\n type: 'string',\n validate: (value: string) => COLOR.test(value),\n });\n\n /*\n `cron` is not a JSON Schema format keyword, and without this the schema\n route selects the control and validates nothing - `format: \"cron\"` would be\n ignored with a warning, leaving a five-field expression to be reported by\n the renderer alone. Six fields, seconds first; see `util/cron.ts` for why\n the dialect has to be stated rather than guessed.\n */\n ajv.addFormat('cron', {\n type: 'string',\n validate: (value: string) => cronProblem(value) === undefined,\n });\n\n for (const [name, validate] of Object.entries(formats ?? {})) {\n ajv.addFormat(name, { type: 'string', validate });\n }\n\n if (extendedKeywords) {\n registerAjvKeywords(ajv as never, {\n allowScriptEvaluation:\n typeof allowScriptEvaluation === 'function'\n ? allowScriptEvaluation\n : () => allowScriptEvaluation === true,\n });\n }\n\n if (errorMessages) {\n if ((ajv as { opts?: { allErrors?: boolean } }).opts?.allErrors) {\n ajvErrors(ajv as never);\n } else {\n // oxlint-disable-next-line no-console\n console.warn(\n 'ajv.errorMessagesNeedAllErrors: `errorMessage` support was requested ' +\n 'but `allErrors` is off, which ajv-errors requires. Schema-authored ' +\n 'messages will not be applied.',\n );\n }\n }\n\n /*\n Last, because it wraps `ajv.compile`: anything registering keywords after\n this point would still work, but a second wrap would nest the error\n rewriting and unwrap an already-unwrapped list.\n */\n if (i18n || localizers) {\n ajvTranslations(ajv as never, { i18n, localizers });\n }\n\n return ajv;\n};\n","import type { Layout, UISchemaElement } from '@jsonforms/core';\n\n/**\n * What this project's UI model adds to core's element types.\n *\n * Section 2 lists the core types a TypeScript implementation may import, and\n * then declares one of its own:\n *\n * ```ts\n * export type NamedUISchemaElement = UISchemaElement & { name: string };\n * ```\n *\n * with \"`name` is used where an element must be referenced, for example\n * Categorization initial selection\". Core does not declare `name` on\n * `UISchemaElement` and this project does not control core, so the addition\n * lives here - once, rather than as a cast at each of the half-dozen places\n * that read it.\n *\n * **`name` is general, not a feature of any one element.** It is read by the\n * `Template` registry lookup, `Slot` resolution, a Ractive partial, a\n * `Button`'s action name and `Categorization.options.initial`. Any element in\n * this set may carry one.\n */\n\n/**\n * An element that **has** a name, as section 2 declares it.\n *\n * Use it where a name is required for the element to mean anything - a\n * `Template` invocation, a `Slot`, a registry entry looked up by name. `name`\n * is required here on purpose: the type is the guarantee.\n */\nexport type NamedUISchemaElement = UISchemaElement & { name: string };\n\n/**\n * Any element of this project's UI model: core's, plus an optional name.\n *\n * This is the type to read an arbitrary element through. It says what is true\n * of every element here - that it *may* carry a name - without claiming one\n * is present.\n */\nexport type ExtendedUISchemaElement = UISchemaElement & { name?: string };\n\n/** A layout whose children may be named. */\nexport type ExtendedLayout = Omit<Layout, 'elements'> & {\n elements: ExtendedUISchemaElement[];\n};\n\n/** Whether an element carries a usable name. */\nexport const isNamedUISchemaElement = (\n uischema: UISchemaElement | undefined,\n): uischema is NamedUISchemaElement =>\n typeof (uischema as ExtendedUISchemaElement | undefined)?.name === 'string' &&\n (uischema as NamedUISchemaElement).name !== '';\n","import {\n UrlPolicy,\n defaultUrlPolicy,\n isAllowedImageUrl,\n isAllowedUrl,\n} from './urlPolicy';\n\n/**\n * The URL policy, applied to whatever a **template** produced.\n *\n * Section 12 makes the policy a MUST for \"every URL-bearing value\", and the\n * `Link` and `ImageView` renderers have always honoured it. A template did\n * not: `<a href={data.url}>` put the value straight into the anchor, so a\n * `javascript:` URL arriving in form data became a working script the moment\n * somebody clicked it. Text interpolation was never the hole - React escapes\n * it - which is exactly why this one survived.\n *\n * The check belongs **below the engine**, not in it: there are three engines\n * and no reason for each to learn the policy separately.\n *\n * **A refused URL drops the attribute, not the element.** An `<a>` without an\n * `href` is text that cannot navigate; an `<img>` without a `src` shows its\n * `alt`. Removing the element instead would make a hostile value indistinguishable\n * from a missing one, and section 19 asks for honest rendering of bad data.\n */\n\n/** Stable code, so a host can grep for it. */\nexport const URL_REFUSED_DIAGNOSTIC = 'template.urlRefused';\n\n/**\n * How a URL-bearing attribute is judged.\n *\n * `image` additionally allows `data:image/...` when the host has opted in with\n * `allowImageDataUrls`; `link` never does. The split matters: an inline image\n * is a reasonable asset, and a `data:` document handed to an anchor is a\n * navigation to attacker-controlled HTML on this origin.\n */\ntype UrlKind = 'link' | 'image';\n\n/**\n * Attributes that carry a URL, by their **React prop** spelling.\n *\n * `srcSet` and `ping` hold *lists*; see {@link splitUrlList}. Deliberately\n * absent: `data`, which is a URL only on `<object>` and an ordinary prop name\n * everywhere else - it is handled per element below.\n */\nconst URL_PROPS: Record<string, UrlKind> = {\n href: 'link',\n src: 'link',\n srcSet: 'image',\n poster: 'image',\n background: 'image',\n action: 'link',\n formAction: 'link',\n cite: 'link',\n ping: 'link',\n manifest: 'link',\n profile: 'link',\n longDesc: 'link',\n codeBase: 'link',\n classID: 'link',\n xlinkHref: 'link',\n};\n\n/** The same set, spelled as DOM attributes, for an engine that owns its DOM. */\nconst URL_ATTRS: Record<string, UrlKind> = {\n href: 'link',\n src: 'link',\n srcset: 'image',\n poster: 'image',\n background: 'image',\n action: 'link',\n formaction: 'link',\n cite: 'link',\n ping: 'link',\n manifest: 'link',\n profile: 'link',\n longdesc: 'link',\n codebase: 'link',\n classid: 'link',\n 'xlink:href': 'link',\n};\n\n/** Elements whose `src` loads an image, so `allowImageDataUrls` applies. */\nconst IMAGE_SRC_ELEMENTS = new Set(['img', 'image', 'source', 'input']);\n\n/**\n * `src` is the one attribute whose kind depends on the element.\n *\n * On `<img>` it loads an image, so `allowImageDataUrls` may permit a\n * `data:image/...`. On `<iframe>`, `<embed>` or `<script>` the same attribute\n * loads a *document*, where that opt-in must not apply - which is why the\n * table cannot settle this on the attribute name alone.\n */\nconst kindFor = (type: unknown, name: string, declared: UrlKind): UrlKind => {\n if (name !== 'src') {\n return declared;\n }\n const tag = typeof type === 'string' ? type.toLowerCase() : '';\n return IMAGE_SRC_ELEMENTS.has(tag) ? 'image' : 'link';\n};\n\nconst allowed = (value: unknown, kind: UrlKind, policy: UrlPolicy): boolean =>\n kind === 'image'\n ? isAllowedImageUrl(value, policy)\n : isAllowedUrl(value, policy);\n\n/**\n * The candidate URLs inside a list-valued attribute.\n *\n * `srcSet` is comma-separated with an optional descriptor (`x.png 2x`), and\n * `ping` is space-separated. A list is refused **as a whole** when any\n * candidate is: keeping the survivors would silently change which image loads.\n */\nconst splitUrlList = (name: string, value: string): string[] =>\n name === 'ping'\n ? value.split(/\\s+/).filter(Boolean)\n : value\n .split(',')\n .map((candidate) => candidate.trim().split(/\\s+/)[0])\n .filter(Boolean);\n\nconst isList = (name: string) =>\n name === 'srcSet' || name === 'srcset' || name === 'ping';\n\nconst report = (\n onRefused: ((message: string) => void) | undefined,\n name: string,\n value: unknown,\n) => {\n const message = `${URL_REFUSED_DIAGNOSTIC}: ${name}=${JSON.stringify(\n String(value),\n )} is not permitted by the URL policy; the attribute was dropped.`;\n if (onRefused) {\n onRefused(message);\n return;\n }\n // oxlint-disable-next-line no-console\n console.warn(message);\n};\n\n/**\n * Whether a prop's value is worth judging as a URL.\n *\n * On an **intrinsic** element (`type` is a string like `'a'`) React writes\n * whatever it is given into the attribute, stringifying it on the way, so\n * anything non-null is inspected - including an object with a hostile\n * `toString`.\n *\n * On a **custom component** only strings are. A component is free to define\n * `src` as something structured, and dropping a legitimate object prop because\n * it is not a URL would break working templates to prevent nothing: the\n * component, not this pragma, decides what reaches the DOM - and when it does,\n * it goes through its own element, which passes back through here.\n */\nconst inspectable = (type: unknown, value: unknown): boolean =>\n typeof type === 'string' ? true : typeof value === 'string';\n\nconst permits = (\n type: unknown,\n name: string,\n kind: UrlKind,\n value: unknown,\n policy: UrlPolicy,\n): boolean => {\n const effective = kindFor(type, name, kind);\n if (isList(name) && typeof value === 'string') {\n const candidates = splitUrlList(name, value);\n return candidates.every((candidate) =>\n allowed(candidate, effective, policy),\n );\n }\n return allowed(value, effective, policy);\n};\n\n/**\n * Props with every refused URL removed.\n *\n * Returns the **same object** when nothing was refused, so the common path\n * allocates nothing and React's identity checks are unaffected.\n */\nexport const sanitizeUrlProps = (\n type: unknown,\n props: Record<string, unknown> | null | undefined,\n policy: UrlPolicy = defaultUrlPolicy,\n onRefused?: (message: string) => void,\n): Record<string, unknown> | null | undefined => {\n if (!props) {\n return props;\n }\n let sanitized: Record<string, unknown> | undefined;\n for (const [name, kind] of Object.entries(URL_PROPS)) {\n if (!Object.prototype.hasOwnProperty.call(props, name)) {\n continue;\n }\n const value = props[name];\n if (value === undefined || value === null) {\n continue;\n }\n if (!inspectable(type, value)) {\n continue;\n }\n if (permits(type, name, kind, String(value), policy)) {\n continue;\n }\n sanitized = sanitized ?? { ...props };\n delete sanitized[name];\n report(onRefused, name, value);\n }\n /*\n `data` is a URL on `<object>` and an ordinary prop everywhere else, so it\n cannot live in the table above - `<Foo data={{...}} />` must not be\n inspected as a URL.\n */\n if (\n typeof type === 'string' &&\n type.toLowerCase() === 'object' &&\n typeof props.data === 'string' &&\n !isAllowedUrl(props.data, policy)\n ) {\n sanitized = sanitized ?? { ...props };\n delete sanitized.data;\n report(onRefused, 'data', props.data);\n }\n return sanitized ?? props;\n};\n\n/**\n * The same policy, applied to a DOM subtree an engine rendered itself.\n *\n * Ractive owns its subtree and offers no hook for a bound attribute value, so\n * this runs immediately after it renders. That is a real difference from the\n * JSX profile, where the check happens *before* the element exists: here the\n * attribute is briefly present, so a `src` may already have started loading\n * even though it is removed in the same task. `javascript:` in an `href` -\n * the case that actually executes attacker code - needs a click, and is gone\n * long before one can arrive.\n */\nexport const sanitizeUrlAttributes = (\n root: Element | null | undefined,\n policy: UrlPolicy = defaultUrlPolicy,\n onRefused?: (message: string) => void,\n): number => {\n if (!root) {\n return 0;\n }\n let removed = 0;\n const names = Object.keys(URL_ATTRS);\n // Only `xlink:href` needs escaping, and `CSS.escape` is not guaranteed to\n // exist in every DOM implementation this runs in.\n const selector = names\n .map((name) => `[${name.replace(':', '\\\\:')}]`)\n .join(',');\n const candidates: Element[] = [\n ...(root.matches?.(selector) ? [root] : []),\n ...Array.from(root.querySelectorAll(selector)),\n ];\n for (const element of candidates) {\n const tag = element.tagName.toLowerCase();\n for (const name of names) {\n const value = element.getAttribute(name);\n if (value === null) {\n continue;\n }\n if (permits(tag, name, URL_ATTRS[name], value, policy)) {\n continue;\n }\n element.removeAttribute(name);\n removed += 1;\n report(onRefused, name, value);\n }\n }\n return removed;\n};\n","import React, {\n useLayoutEffect,\n createContext,\n useContext,\n useRef,\n} from 'react';\nimport type { JsonFormsCore, Middleware } from '@jsonforms/core';\nimport type { ErrorObject } from 'ajv';\nimport get from 'lodash/get';\nimport isEqual from 'lodash/isEqual';\n\n/**\n * Errors that have nothing to do with JSON Schema validation.\n *\n * A server rejects a submit and names two fields; a code editor's language\n * service finds a syntax error; a host wants to mark a field from somewhere\n * else entirely. JSON Forms calls these `additionalErrors` and treats them as\n * first-class - `getErrorsAt` merges them with schema errors, and\n * `validationMode` does not suppress them - but supplies no way for anything\n * inside the form to produce one.\n *\n * This is that way. A **store**, owner-keyed, delivered through JSON Forms'\n * own `middleware` hook.\n *\n * ```tsx\n * const store = useRef(createAdditionalErrorStore()).current;\n *\n * <JsonForms {...useAdditionalErrorProps(store)} … />\n *\n * store.publish('server', response.validationErrors); // after a submit\n * store.all(); // read them back\n * ```\n *\n * `useAdditionalErrorProps` supplies **both** halves, and both are needed:\n *\n * | | Does |\n * | --- | --- |\n * | `additionalErrors` | Carries the published errors in. Middleware is passive - publishing dispatches nothing, so without a prop change the form would not re-reduce until the user happened to type. |\n * | `middleware` | Clears on change, and merges. Only middleware sees `UPDATE` with the data before *and* after, which is what the clearing rule needs. |\n *\n * Neither alone is enough, and that is not an accident of this design: core\n * offers no action a renderer or a host can dispatch to add an additional\n * error, and no hook that fires when one should be withdrawn.\n *\n * ## What the store buys over passing the prop directly\n *\n * - **A renderer can publish**, because the store is reachable through context\n * rather than through the host's props.\n * - **Ownership.** One owner retracting cannot disturb another's errors, or\n * the host's. Two editors on one path, or an editor beside a server error,\n * coexist.\n * - **Clearing is automatic:** the store applies the clear-on-change rule.\n * - The errors are in core state, so `useJsonForms().core.additionalErrors`\n * reads them - the point is having them *on the form*, not only under one\n * control.\n *\n * **A host that already passes its own `additionalErrors` keeps working.**\n * The middleware filters out only what this store produced and leaves the rest\n * in place, so host-supplied errors and published ones coexist and neither\n * clears the other.\n *\n * ## Clearing\n *\n * By default an owner's error is dropped when **the value at its own\n * `instancePath` changes**. The store applies this clear-on-change rule in\n * every form that uses it. Comparison is by value, not by the action's path,\n * so an update that rewrites a field with what it already held clears nothing.\n *\n * An owner that manages its own lifecycle opts out with\n * `{ clearOnChange: false }`. The Monaco control does: it republishes or\n * retracts its summary as the language service reports, and a keystroke\n * clearing it would make the message flicker.\n */\n\n/** Marks an error this store produced, so host-supplied ones are left alone. */\nconst OWNED = Symbol.for('jsonforms.additionalError.owner');\n\nconst isOwned = (error: ErrorObject): boolean =>\n (error as unknown as Record<symbol, unknown>)[OWNED] !== undefined;\n\nconst ownerOf = (error: ErrorObject): string | undefined =>\n (error as unknown as Record<symbol, string>)[OWNED];\n\nexport interface PublishOptions {\n /**\n * Drop these errors when the value at their `instancePath` changes.\n * Default true.\n */\n clearOnChange?: boolean;\n}\n\ninterface OwnerEntry {\n errors: ErrorObject[];\n clearOnChange: boolean;\n}\n\n/** Stable code, so a host can grep for it. */\nexport const NO_STORE_DIAGNOSTIC = 'additionalErrors.noStore';\n\nexport interface AdditionalErrorStore {\n /**\n * True for the placeholder a renderer gets outside a provider.\n *\n * A renderer that was *asked* to publish - Monaco with `propagateErrors` on\n * - can then say so instead of going quiet, which is the difference between\n * a host learning it forgot the wiring and a host concluding the option\n * does not work.\n */\n readonly inert?: boolean;\n /** Replaces everything this owner had published. An empty list retracts. */\n publish: (\n owner: string,\n errors: ErrorObject[],\n options?: PublishOptions,\n ) => void;\n /** Retracts one owner's errors. */\n clear: (owner: string) => void;\n /** Retracts everything - a fresh submit, for instance. */\n clearAll: () => void;\n /** Everything published, in publication order. */\n all: () => ErrorObject[];\n /** Called after any change; returns an unsubscribe. */\n subscribe: (listener: () => void) => () => void;\n /** Hand this to `<JsonForms middleware={…} />`. */\n middleware: Middleware;\n}\n\n/** `/a/b/0/c` as lodash's `a.b.0.c`; the empty pointer is the whole document. */\nconst pathOf = (instancePath: string): string =>\n instancePath.replace(/^\\//, '').split('/').join('.');\n\nconst valueAt = (data: unknown, instancePath: string): unknown =>\n instancePath === '' || instancePath === '/'\n ? data\n : get(data, pathOf(instancePath));\n\nexport const createAdditionalErrorStore = (): AdditionalErrorStore => {\n const owners = new Map<string, OwnerEntry>();\n const listeners = new Set<() => void>();\n let snapshot: ErrorObject[] = [];\n\n const rebuild = () => {\n const next: ErrorObject[] = [];\n owners.forEach((entry) => next.push(...entry.errors));\n /*\n Identity follows content. Anything reading this - a React subscription,\n or the middleware deciding whether the state changed - would otherwise\n see a change on every rebuild and re-render or re-dispatch forever.\n */\n if (!isEqual(next, snapshot)) {\n snapshot = next;\n listeners.forEach((listener) => listener());\n return true;\n }\n return false;\n };\n\n const publish: AdditionalErrorStore['publish'] = (owner, errors, options) => {\n if (errors.length === 0) {\n if (owners.delete(owner)) {\n rebuild();\n }\n return;\n }\n /*\n Stamped on a copy, so a caller's array is never mutated and a host that\n hands the same objects to something else is unaffected. The marker is a\n `Symbol.for`, which cannot collide with a `params` key a host chose and\n does not appear in JSON.\n */\n const stamped = errors.map((error) => {\n const copy = { ...error } as ErrorObject;\n (copy as unknown as Record<symbol, string>)[OWNED] = owner;\n return copy;\n });\n owners.set(owner, {\n errors: stamped,\n clearOnChange: options?.clearOnChange !== false,\n });\n rebuild();\n };\n\n const clear: AdditionalErrorStore['clear'] = (owner) => {\n if (owners.delete(owner)) {\n rebuild();\n }\n };\n\n const clearAll = () => {\n if (owners.size > 0) {\n owners.clear();\n rebuild();\n }\n };\n\n /**\n * Drops the errors whose own value changed.\n *\n * Only owners that did not opt out, and only the individual errors that\n * point at something that moved - one server error going does not take its\n * siblings with it.\n */\n const pruneChanged = (before: unknown, after: unknown) => {\n let changed = false;\n owners.forEach((entry, owner) => {\n if (!entry.clearOnChange) {\n return;\n }\n const kept = entry.errors.filter((error) =>\n isEqual(\n valueAt(before, error.instancePath ?? ''),\n valueAt(after, error.instancePath ?? ''),\n ),\n );\n if (kept.length === entry.errors.length) {\n return;\n }\n changed = true;\n if (kept.length === 0) {\n owners.delete(owner);\n } else {\n owners.set(owner, { ...entry, errors: kept });\n }\n });\n if (changed) {\n rebuild();\n }\n };\n\n const middleware: Middleware = (state, action, defaultReducer) => {\n const next = defaultReducer(state, action) as JsonFormsCore;\n\n /*\n `UPDATE_DATA` is spelled `jsonforms/UPDATE`. The published middleware\n documentation names the constant, not the string, and the two do not\n match - a filter written against `'jsonforms/UPDATE_DATA'` silently\n never runs.\n */\n if (action?.type === 'jsonforms/UPDATE' && state !== next) {\n pruneChanged(state?.data, next.data);\n }\n\n const published = snapshot;\n /*\n Whatever the host supplied stays: only errors this store produced are\n replaced. That is what lets a form use the prop and this together, and\n what stops one owner's retraction from taking another's - or the host's\n - errors with it.\n */\n const hostErrors = (next.additionalErrors ?? []).filter(\n (error) => !isOwned(error),\n );\n const combined =\n published.length === 0 ? hostErrors : [...hostErrors, ...published];\n\n if (\n combined.length === (next.additionalErrors ?? []).length &&\n combined.every((error, index) => error === next.additionalErrors?.[index])\n ) {\n return next;\n }\n return { ...next, additionalErrors: combined };\n };\n\n return {\n publish,\n clear,\n clearAll,\n all: () => snapshot,\n subscribe: (listener) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n },\n middleware,\n };\n};\n\n/** Which owner an error belongs to, or undefined for a host-supplied one. */\nexport const additionalErrorOwner = (error: ErrorObject): string | undefined =>\n ownerOf(error);\n\nconst inertStore: AdditionalErrorStore = {\n inert: true,\n publish: () => undefined,\n clear: () => undefined,\n clearAll: () => undefined,\n all: () => [],\n subscribe: () => () => undefined,\n middleware: (state, action, defaultReducer) => defaultReducer(state, action),\n};\n\nconst StoreContext = createContext<AdditionalErrorStore>(inertStore);\n\nexport const AdditionalErrorStoreProvider = ({\n store,\n children,\n}: {\n store: AdditionalErrorStore;\n children: React.ReactNode;\n}) => <StoreContext.Provider value={store}>{children}</StoreContext.Provider>;\n\n/**\n * The store for the enclosing form, or an inert one.\n *\n * Inert rather than throwing, because a renderer must not require the host to\n * have wired anything: publication is what a host opts into, and a renderer\n * that also shows its diagnostic locally keeps doing so either way.\n */\nexport const useAdditionalErrorStore = (): AdditionalErrorStore =>\n useContext(StoreContext);\n\n/**\n * Publishes one owner's errors for as long as the component is mounted.\n *\n * Republished when the content changes, and **retracted on unmount** - an\n * error left behind by a control that is no longer on the form would make it\n * invalid with nothing on screen to explain why.\n */\nexport const useOwnedAdditionalErrors = (\n owner: string,\n errors: ErrorObject[],\n options?: PublishOptions,\n): void => {\n const store = useAdditionalErrorStore();\n\n /*\n Publication is a host opt-in, so having no store is not an error - but a\n renderer that has something to publish and nowhere to put it must say so.\n Silence here reads as \"the option does not work\".\n */\n const wanted = errors.length > 0;\n React.useEffect(() => {\n if (!store.inert || !wanted) {\n return;\n }\n // oxlint-disable-next-line no-console\n console.warn(\n `${NO_STORE_DIAGNOSTIC}: ${JSON.stringify(\n owner,\n )} has errors to publish, ` +\n `but this form installed no additional-error store, so they will not ` +\n `appear. Render the form with <ExtendedJsonForms>, or pass ` +\n `useAdditionalErrorProps(store) to <JsonForms> and wrap it in ` +\n `<AdditionalErrorStoreProvider>.`,\n );\n }, [store, owner, wanted]);\n const latest = useRef({ errors, options });\n useLayoutEffect(() => {\n latest.current = { errors, options };\n }, [errors, options]);\n\n const signature = errors\n .map((error) => `${error.instancePath}|${error.keyword}|${error.message}`)\n .join('\\u0000');\n const clearOnChange = options?.clearOnChange !== false;\n\n React.useEffect(() => {\n store.publish(owner, latest.current.errors, latest.current.options);\n }, [store, owner, signature, clearOnChange]);\n\n React.useEffect(\n () => () => {\n store.clear(owner);\n },\n [store, owner],\n );\n};\n\n/** Everything published, re-rendering the caller when it changes. */\nexport const useAdditionalErrors = (): ErrorObject[] => {\n const store = useAdditionalErrorStore();\n return React.useSyncExternalStore(store.subscribe, store.all, store.all);\n};\n\n/**\n * Read by `ExtendedJsonForms`, which is how a form should install a store.\n *\n * There is no `useAdditionalErrorProps` for a host assembling `<JsonForms>`\n * itself, and that is deliberate: delivering published errors through the\n * `additionalErrors` **prop** undoes the edit that provoked them.\n * `JsonFormsStateProvider` lists the prop in an effect's dependencies and\n * re-dispatches `updateCore(data, …)` with the prop data of that render, while\n * a renderer publishes from its own effect - which runs before the parent's\n * `onChange` has told the host about the edit. The re-dispatch then carries\n * the previous data.\n *\n * `ExtendedJsonForms` composes JSON Forms' own provider so it can dispatch\n * from **inside**, where the data comes from core and is current by\n * construction. A host that needs to assemble the form itself should copy that\n * arrangement rather than reach for the prop.\n */\n","import {\n DynamicUiProvider,\n withDynamicRenderers,\n withDynamicCells,\n} from '@chobantonov/jsonforms-react-renderer-common/dynamic/DynamicUiProvider';\nimport React, {\n useLayoutEffect,\n useState,\n useEffect,\n useMemo,\n useRef,\n} from 'react';\nimport { Actions, Generate } from '@jsonforms/core';\nimport {\n JsonFormsDispatch,\n JsonFormsInitStateProps,\n JsonFormsStateProvider,\n useJsonForms,\n} from '@jsonforms/react';\nimport type { JsonFormsReactProps } from '@jsonforms/react';\nimport {\n AdditionalErrorStore,\n AdditionalErrorStoreProvider,\n createAdditionalErrorStore,\n useAdditionalErrorStore,\n} from '../util/additionalErrors';\nimport {\n HandleAction,\n HandleActionContext,\n useHandleAction,\n} from '../util/actionContext';\n\n// Keep authored UI options at the published spellings before core resolves them.\nexport const canonicalUiOptions = <T,>(value: T): T => {\n if (Array.isArray(value)) return value.map(canonicalUiOptions) as T;\n if (\n value === null ||\n typeof value !== 'object' ||\n Object.getPrototypeOf(value) !== Object.prototype\n )\n return value;\n const entries = Object.entries(value);\n let changed = false;\n const result: Record<string, unknown> = {};\n for (const [key, child] of entries) {\n if (\n key === 'options' &&\n typeof (value as { type?: unknown }).type === 'string' &&\n child &&\n typeof child === 'object' &&\n !Array.isArray(child) &&\n Object.prototype.hasOwnProperty.call(child, 'readOnly')\n ) {\n const { readOnly: _ignored, ...rest } = child as Record<string, unknown>;\n result[key] = canonicalUiOptions(rest);\n changed = true;\n } else {\n const normalized = canonicalUiOptions(child);\n result[key] = normalized;\n changed ||= normalized !== child;\n }\n }\n return (changed ? result : value) as T;\n};\n\nconst canonicalConfig = <T extends Record<string, unknown> | undefined>(\n value: T,\n): T =>\n value && Object.prototype.hasOwnProperty.call(value, 'readOnly')\n ? (Object.fromEntries(\n Object.entries(value).filter(([key]) => key !== 'readOnly'),\n ) as T)\n : value;\n\n/**\n * `<JsonForms>` with this renderer set's integration already wired.\n *\n * The React counterpart of the Vue 2 `ResolvedJsonForms`, and it exists for\n * the same reason: the extended renderers need things a bare `<JsonForms>`\n * does not provide, and an application should not have to know what they are.\n *\n * | | Without this |\n * | --- | --- |\n * | The additional-error store | Two props that are only useful together, plus a provider |\n * | The action handler | A `HandleActionContext.Provider` around the form, or every `Button` is a no-op |\n *\n * ```tsx\n * <ExtendedJsonForms schema={schema} uischema={uischema} data={data}\n * renderers={renderers} cells={cells} onChange={onChange} />\n * ```\n *\n * A form using the Monaco control with `propagateErrors` and a plain\n * `<JsonForms>` publishes into nothing. It now says so - `additionalErrors.noStore`\n * - rather than going quiet, but this is the fix rather than the warning.\n *\n * **Bring your own store** when the application needs to publish too, which is\n * the ordinary case for server-side validation:\n *\n * ```tsx\n * const store = useRef(createAdditionalErrorStore()).current;\n *\n * <ExtendedJsonForms store={store} … />\n *\n * // after a rejected submit\n * store.publish('server', response.validationErrors);\n * ```\n *\n * ## What it deliberately does not do\n *\n * **Resolve `$ref`.** The Vue 2 wrapper does, and it is tempting to copy, but\n * the two cases are not the same:\n *\n * - A **local** `$ref` - `#/$defs/x`, `#/definitions/x` - already works.\n * JSON Forms resolves it while rendering and Ajv while validating; verified\n * against both spellings.\n * - A **remote** one, or a `schemaUrl`, does not. Resolving it is asynchronous,\n * so a wrapper that did it would have to hold the form unmounted while it\n * fetched, and would own a loading and a failure state.\n *\n * That is a different component with a different lifecycle, and putting it\n * here would make every form pay a mount delay for a capability most do not\n * use. If remote schemas are needed, they belong in a `ResolvedJsonForms` of\n * their own, wrapping this.\n */\nexport interface ExtendedJsonFormsProps\n extends JsonFormsInitStateProps, JsonFormsReactProps {\n /**\n * A store the application also publishes into.\n *\n * Absent, an enclosing `AdditionalErrorStoreProvider` is used if there is\n * one - it can only have been put there deliberately - and otherwise a store\n * is created for this form. Several forms under one provider therefore share\n * a store, which is the host's decision to make and means they see each\n * other's published errors.\n */\n store?: AdditionalErrorStore;\n /** Host-owned immutable values, independent of overlay activation. */\n external?: Readonly<Record<string, unknown>>;\n /**\n * What a `Button` hands its command to.\n *\n * Absent, an enclosing `HandleActionContext` is left in place rather than\n * shadowed with `undefined` - so a container that provides one for several\n * forms keeps working, and only a host that actually passes a handler\n * replaces it.\n */\n onAction?: HandleAction;\n}\n\n/**\n * Re-reduces the form when the store changes, so the middleware can inject.\n *\n * Middleware is **passive**: publishing an error dispatches nothing, so\n * without this the form would not see a published error until the user\n * happened to type.\n *\n * The obvious alternative - putting the errors in the `additionalErrors` prop\n * - looks simpler and is broken. `JsonFormsStateProvider` lists that prop in\n * an effect's dependencies and re-dispatches `updateCore(data, …)` with the\n * **prop** data of that render; a renderer publishes from its own effect,\n * which runs *before* the parent's `onChange` has told the host about the\n * edit that provoked it. So the re-dispatch carries the previous data and\n * undoes the edit. It showed up as a language select that would not move:\n * choosing a language made the editor publish, and publishing put the old\n * language back.\n *\n * Dispatching from **inside** the provider avoids the whole question - the\n * data comes from core, which is current by construction, and the prop never\n * changes.\n */\nconst AdditionalErrorsBridge = ({ store }: { store: AdditionalErrorStore }) => {\n const ctx = useJsonForms();\n const dispatch = ctx.dispatch;\n const coreRef = useRef(ctx.core);\n useLayoutEffect(() => {\n coreRef.current = ctx.core;\n }, [ctx.core]);\n\n useEffect(() => {\n if (!dispatch) {\n return undefined;\n }\n return store.subscribe(() => {\n const core = coreRef.current;\n if (!core) {\n return;\n }\n /*\n No `additionalErrors` option, so core keeps what it has and the\n middleware writes the store's current set over it. Data and schema\n come from core rather than from a prop, so this cannot move the form.\n */\n dispatch(\n Actions.updateCore(core.data, core.schema, core.uischema, {\n ajv: core.ajv,\n validationMode: core.validationMode,\n } as never),\n );\n });\n }, [store, dispatch]);\n\n return null;\n};\n\nexport const ExtendedJsonForms = ({\n external,\n store,\n onAction,\n ajv,\n data,\n schema,\n uischema,\n renderers,\n cells,\n config,\n uischemas,\n readonly,\n validationMode,\n i18n,\n additionalErrors,\n middleware,\n onChange,\n}: ExtendedJsonFormsProps) => {\n /*\n Per mounted form, not per render: a store is the identity errors are\n published against, and a new one each render would lose them.\n */\n const [fallback] = useState(createAdditionalErrorStore);\n const inherited = useAdditionalErrorStore();\n const outerAction = useHandleAction();\n const effective = store ?? (inherited.inert ? fallback : inherited);\n\n /*\n Composed from the same pieces `<JsonForms>` uses, rather than rendering it,\n because the bridge above has to sit **inside** the provider to reach its\n dispatch. Everything else here is what `JsonForms` itself does.\n */\n const schemaToUse = useMemo(\n () => (schema !== undefined ? schema : Generate.jsonSchema(data)),\n [schema, data],\n );\n const uischemaToUse = useMemo(\n () =>\n typeof uischema === 'object'\n ? canonicalUiOptions(uischema)\n : Generate.uiSchema(schemaToUse, undefined, undefined, schemaToUse),\n [uischema, schemaToUse],\n );\n\n const combinedMiddleware = useMemo(\n () =>\n middleware\n ? (state: never, action: never, defaultReducer: never) =>\n effective.middleware(state, action, ((innerState, innerAction) =>\n middleware(\n innerState,\n innerAction,\n defaultReducer as never,\n )) as never)\n : effective.middleware,\n [effective, middleware],\n ) as typeof effective.middleware;\n\n const configToUse = useMemo(() => canonicalConfig(config), [config]);\n\n const rendererRegistry = useMemo(\n () => withDynamicRenderers(renderers),\n [renderers],\n );\n const cellRegistry = useMemo(() => withDynamicCells(cells), [cells]);\n\n const form = (\n <JsonFormsStateProvider\n initState={{\n core: {\n ajv,\n data,\n schema: schemaToUse,\n uischema: uischemaToUse,\n validationMode,\n /*\n Only the host's own. What the store holds arrives through the\n middleware, so this prop never changes when something publishes -\n which is the entire point.\n */\n additionalErrors,\n } as never,\n config: configToUse,\n uischemas,\n renderers: rendererRegistry,\n cells: cellRegistry,\n readonly,\n i18n,\n }}\n onChange={onChange}\n middleware={combinedMiddleware}\n >\n <AdditionalErrorsBridge store={effective} />\n <JsonFormsDispatch />\n </JsonFormsStateProvider>\n );\n\n const wrapped = (\n <AdditionalErrorStoreProvider store={effective}>\n <DynamicUiProvider\n config={config}\n external={external}\n locale={i18n?.locale}\n translate={i18n?.translate}\n >\n {form}\n </DynamicUiProvider>\n </AdditionalErrorStoreProvider>\n );\n\n /*\n Only when this form was given one. Wrapping unconditionally would set the\n context to `undefined` for everything inside, which silently turns every\n `Button` into a no-op in a host whose provider sits further up.\n */\n const handler = onAction ?? outerAction;\n return handler === outerAction ? (\n wrapped\n ) : (\n <HandleActionContext.Provider value={handler}>\n {wrapped}\n </HandleActionContext.Provider>\n );\n};\n","import type { ErrorObject } from 'ajv';\nimport { extendedConfig } from './configNamespaces';\n\n/**\n * The one summary error an editor publishes, and when it publishes it.\n *\n * Section 21: \"publish **at most one summary additionalError per editor\n * instance**, regardless of the number of blocking diagnostics. Publish none\n * when that editor has no error-level diagnostics.\"\n */\n\n/** The keyword the specification names for this error. */\nexport const EDITOR_DIAGNOSTIC_KEYWORD = 'editor.language';\n\n/**\n * Monaco's `MarkerSeverity.Error`.\n *\n * A plain number rather than an import: `monaco-editor` is loaded as a chunk\n * by `@monaco-editor/react`, and importing the enum for one constant would\n * pull the whole editor into any bundle that touches this module. The values\n * are part of Monaco's public API - Hint 1, Info 2, Warning 4, Error 8.\n */\nexport const MONACO_SEVERITY_ERROR = 8;\n\nexport interface EditorMarker {\n severity?: number;\n message?: string;\n}\n\n/** Only error-level markers count. \"Warnings … stay inside Monaco.\" */\nexport const countBlockingMarkers = (markers: EditorMarker[] | undefined) =>\n (markers ?? []).filter(\n (marker) => (marker?.severity ?? 0) >= MONACO_SEVERITY_ERROR,\n ).length;\n\n/**\n * Whether this editor publishes into the form's additional errors.\n *\n * Resolution is element option, then namespaced form config.\n *\n * **The default is `false`, and the portable contract says `true`.** That is a\n * deliberate divergence, recorded in adjustment 31: publishing turns a\n * language-service diagnostic into something that can block a form, and this\n * project's position is that a host opts into that rather than inheriting it.\n * A form that wants the portable default sets the option once, form-wide.\n */\nexport const resolvePropagateErrors = (\n elementOptions: Record<string, unknown> | undefined,\n config: unknown,\n): boolean => {\n const own = elementOptions?.['propagateErrors'];\n if (own !== undefined) {\n return own === true;\n }\n const namespaced = extendedConfig(config) as\n | { propagateErrors?: unknown }\n | undefined;\n if (namespaced?.propagateErrors !== undefined) {\n return namespaced.propagateErrors === true;\n }\n return false;\n};\n\n/** `a.b.0.c` - JSON Forms' path spelling - as the JSON Pointer `/a/b/0/c`. */\nexport const pointerFor = (path: string): string =>\n path ? `/${path.split('.').join('/')}` : '';\n\nexport interface EditorSummaryInput {\n /** Unique per editor instance, so two editors never overwrite each other. */\n owner: string;\n path: string;\n language: string | undefined;\n errorCount: number;\n message: string;\n}\n\n/**\n * The summary, in the AJV-compatible shape the specification gives.\n *\n * `params.owner` is the addition: several renderers may own errors at one\n * path, so the host's registry needs to know whose is whose. Section 18 wants\n * that metadata \"in runtime integration state, outside business data and the\n * authored UI schema\", which an error's `params` is.\n */\nexport const editorSummaryError = ({\n owner,\n path,\n language,\n errorCount,\n message,\n}: EditorSummaryInput): ErrorObject =>\n ({\n instancePath: pointerFor(path),\n schemaPath: '',\n keyword: EDITOR_DIAGNOSTIC_KEYWORD,\n message,\n params: {\n source: 'monaco',\n language,\n errorCount,\n owner,\n },\n }) as ErrorObject;\n","import {\n and,\n formatIs,\n isStringControl,\n optionIs,\n or,\n rankWith,\n schemaTypeIs,\n uiTypeIs,\n} from '@jsonforms/core';\n\nexport const extendedColorTester = rankWith(\n 3,\n and(isStringControl, or(formatIs('color'), optionIs('format', 'color'))),\n);\nexport const extendedDurationTester = rankWith(\n 3,\n and(\n isStringControl,\n or(formatIs('duration'), optionIs('format', 'duration')),\n ),\n);\nexport const extendedNullTester = rankWith(\n 3,\n and(uiTypeIs('Control'), schemaTypeIs('null')),\n);\nexport const colorPickerValue = (value: unknown) => {\n if (typeof value !== 'string') return '#000000';\n if (/^#[a-f\\d]{6}$/i.test(value)) return value;\n if (/^#[a-f\\d]{3}$/i.test(value))\n return '#' + Array.from(value.slice(1), (c) => c + c).join('');\n if (/^#[a-f\\d]{8}$/i.test(value)) return value.slice(0, 7);\n return '#000000';\n};\n","import { useState } from 'react';\nimport type { ControlProps } from '@jsonforms/core';\nimport { useI18n } from '@chobantonov/jsonforms-react-renderer-common/locale/translate';\nimport {\n CRON_FIELDS,\n NOTHING_CHOSEN,\n cronProblem,\n fieldsForPeriod,\n joinCron,\n periodOf,\n parseField,\n sameExpression,\n splitCron,\n standDown,\n withTimeDefaults,\n type CronField,\n type CronPeriod,\n} from './cron';\n\n/** Keeps the cron expression, picker draft and displayed period in sync. */\nexport const useCronPicker = (props: ControlProps) => {\n const label = useI18n();\n const expression = typeof props.data === 'string' ? props.data : '';\n const [open, setOpen] = useState(false);\n const [text, setText] = useState('');\n const [period, setPeriod] = useState<CronPeriod>();\n const [touched, setTouched] = useState(false);\n const options = { ...props.config, ...props.uischema.options };\n const showActions = options.showActions !== false;\n const disabled = !props.enabled || Boolean(props.readonly);\n const problem =\n expression.trim() === '' ? undefined : cronProblem(expression);\n const localError = problem ? label(`cron.error.${problem}` as any) : '';\n const commit = (next: string) => {\n if (disabled || sameExpression(next, expression)) return;\n props.handleChange(props.path, next);\n };\n const draft = splitCron(text) ?? NOTHING_CHOSEN;\n const change = (next: string) => {\n setText(next);\n setTouched(true);\n if (!showActions) commit(next);\n };\n const changeField = (field: CronField, value: string) => {\n const next = [...draft];\n const chosen = value.trim() !== '' && value !== '*';\n next[CRON_FIELDS.indexOf(field)] = chosen ? value : '*';\n change(joinCron(chosen ? withTimeDefaults(next, field) : next));\n };\n const changeText = (next: string) => {\n const fields = splitCron(next);\n if (fields) setPeriod(periodOf(fields));\n change(next);\n };\n const changePeriod = (next: CronPeriod) => {\n if (disabled || next === period) return;\n setPeriod(next);\n if (next === 'second') change(joinCron(NOTHING_CHOSEN));\n else if (splitCron(text)) change(joinCron(standDown(draft, next)));\n };\n const editedProblem = text.trim() === '' ? undefined : cronProblem(text);\n const shownFields = period ? fieldsForPeriod(period) : [];\n const openOn = (next: boolean) => {\n if (disabled) return;\n if (next) {\n const fields = splitCron(expression);\n setText(expression);\n setPeriod(fields ? periodOf(fields) : undefined);\n setTouched(false);\n }\n setOpen(next);\n };\n const accept = () => {\n if (touched) commit(text);\n setOpen(false);\n };\n return {\n label,\n expression,\n open,\n setOpen,\n text,\n period,\n options,\n showActions,\n disabled,\n localError,\n draft,\n changeField,\n changeText,\n changePeriod,\n editedProblem,\n shownFields,\n hasCustomField: shownFields.some(\n (field) =>\n parseField(draft[CRON_FIELDS.indexOf(field)] ?? '*', field) ===\n undefined,\n ),\n openOn,\n accept,\n };\n};\n","import { formatDurationComponents } from '@chobantonov/jsonforms-react-renderer-common/formats/duration';\nimport { ControlProps } from '@jsonforms/core';\nimport { useState } from 'react';\nimport { useExtendedTranslator } from './useExtendedTranslator';\n\n/**\n * The picker's shape, and why it is not one field per component.\n *\n * ISO 8601 gives seven components, and showing all seven means five rows of\n * `0` for a value like \"2 days, 3 hours\" - the two that carry information are\n * found by scanning past the five that do not. So the picker shows only the\n * units **in play**, with the rest reachable through an add control.\n *\n * Weeks is the other half of it. ISO forbids combining `W` with anything else,\n * which the previous picker enforced by greying the Weeks row whenever another\n * field was non-zero. That is correct and unexplained: a user who wants weeks\n * has to work out that five other fields must be zeroed first. It is a\n * **mode**, not a component, so it is modelled as one.\n */\n\nexport const emptyDurationParts = {\n weeks: 0,\n years: 0,\n months: 0,\n days: 0,\n hours: 0,\n minutes: 0,\n seconds: 0,\n};\nexport type ExtendedDurationParts = typeof emptyDurationParts;\nexport const durationFields = Object.keys(emptyDurationParts) as Array<\n keyof ExtendedDurationParts\n>;\n\n/** The components, in magnitude order. Weeks is a mode and is not among them. */\nexport const durationComponentFields = durationFields.filter(\n (field) => field !== 'weeks',\n) as Array<Exclude<keyof ExtendedDurationParts, 'weeks'>>;\n\nexport type DurationMode = 'weeks' | 'components';\n\n/**\n * Whether a value is written in the weeks form.\n *\n * Not `parts.weeks > 0`: `P0W` is a valid duration - RFC 3339's\n * `dur-week = 1*DIGIT \"W\"` admits `0` - and it parses to a draft of all\n * zeros, which is indistinguishable from `P0D`. The **text** is what says\n * which form was written.\n */\nexport const isWeeksDuration = (value: unknown): boolean =>\n typeof value === 'string' && /^P\\d+W$/i.test(value.trim());\n\n/**\n * What an empty picker opens on.\n *\n * Something has to be on screen or the panel is a bare add control. Hours is\n * the unit forms ask for most often, and any other choice is one click away.\n */\nconst defaultComponentField: keyof ExtendedDurationParts = 'hours';\n/**\n * The largest value a component can hold - and it is not 59.\n *\n * A duration's components are **quantities, not clock fields**. ISO 8601\n * bounds none of them: `PT90M`, `PT3600S`, `P18M`, `P400D` and `PT1H591212M`\n * are all valid, and Ajv's `duration` format accepts every one of them. The\n * picker used to cap months at 11 and hours, minutes and seconds at 23 or 59,\n * which is the shape of a *time of day* and has nothing to do with a length\n * of time.\n *\n * The cap was not only wrong, it was **destructive**: `changePart` clamped to\n * it, so typing 90 into Minutes silently became 59. And `PT90M` is not\n * interchangeable with `PT1H30M` as stored data even though the two are the\n * same length - rewriting one into the other is the normalisation §32.1a\n * already forbids.\n *\n * What remains is the only real bound: the range in which an integer is\n * exact. Past it the formatted string would no longer say what was typed.\n */\nexport const durationFieldMax = Number.MAX_SAFE_INTEGER;\nexport const parseExtendedDuration = (\n value: unknown,\n): ExtendedDurationParts | null => {\n if (typeof value !== 'string') return null;\n const text = value.trim();\n const weeks = /^P(\\d+)W$/i.exec(text);\n if (weeks) return { ...emptyDurationParts, weeks: Number(weeks[1]) };\n const match =\n /^P(?:(\\d+)Y)?(?:(\\d+)M)?(?:(\\d+)D)?(?:T(?:(\\d+)H)?(?:(\\d+)M)?(?:(\\d+)S)?)?$/i.exec(\n text,\n );\n if (!match || !match.slice(1).some(Boolean) || /T$/i.test(text)) return null;\n const [, years, months, days, hours, minutes, seconds] = match;\n const parts = {\n weeks: 0,\n years: Number(years || 0),\n months: Number(months || 0),\n days: Number(days || 0),\n hours: Number(hours || 0),\n minutes: Number(minutes || 0),\n seconds: Number(seconds || 0),\n };\n return Object.values(parts).every(Number.isFinite) ? parts : null;\n};\nexport const formatExtendedDuration = (parts: ExtendedDurationParts) => {\n const safe = Object.fromEntries(\n Object.entries(parts).map(([key, value]) => [\n key,\n Number.isFinite(value) ? Math.max(0, Math.floor(value)) : 0,\n ]),\n ) as ExtendedDurationParts;\n if (safe.weeks) return `P${safe.weeks}W`;\n return formatDurationComponents(safe);\n};\nexport const useDurationControl = (props: ControlProps) => {\n const t = useExtendedTranslator();\n const [open, setOpen] = useState(false);\n const [draft, setDraft] = useState({ ...emptyDurationParts });\n /**\n * The components on screen.\n *\n * Not derived from \"value > 0\", because a unit the user has just added is\n * still zero and must stay visible until they type in it or remove it.\n */\n const [shown, setShown] = useState<Array<keyof ExtendedDurationParts>>([]);\n /**\n * Held, not derived from the draft.\n *\n * It used to be `draft.weeks > 0`, which meant clearing the Weeks box\n * flipped the whole panel into components mode mid-edit: the row the user\n * was typing in vanished and the segmented control jumped. A mode is a\n * thing the user chose; it must not depend on the value they are in the\n * middle of entering.\n */\n const [mode, setModeState] = useState<DurationMode>('components');\n const options = { ...props.config, ...props.uischema.options };\n const disabled = !props.enabled || Boolean(props.readonly);\n const value = typeof props.data === 'string' ? props.data : '';\n const commit = (next: string | undefined) => {\n if (!disabled) props.handleChange(props.path, next);\n };\n /**\n * Whether these parts are what the current value already says.\n *\n * Several spellings parse to the same duration - `P0W`, `P0D` and `PT0S`\n * are all \"nothing\", and `P1DT0H` is `P1D`. Writing the canonical form back\n * over an equal value is a rewrite of data the user did not touch: it marks\n * the field dirty on its own, and it silently replaces whatever a server\n * sent.\n *\n * The specification already forbids this in general - \"existing data must\n * not be silently normalized solely because the renderer is mounted\" - and\n * the zero rule (\"serialize zero as `P0D`\") says what to write when the\n * user *means* zero, not what to do with an equivalent value that arrived\n * from somewhere else.\n */\n const unchangedFrom = (next: ExtendedDurationParts) => {\n const current = parseExtendedDuration(value);\n return (\n current !== null &&\n durationFields.every((field) => current[field] === next[field])\n );\n };\n\n /** Commits, unless it would only rewrite the value into another spelling. */\n const commitParts = (next: ExtendedDurationParts) => {\n if (unchangedFrom(next)) return;\n commit(formatExtendedDuration(next));\n };\n\n const commitIfLive = (next: ExtendedDurationParts) => {\n if (options.showActions === false) commitParts(next);\n };\n\n /** In magnitude order however they were added. */\n const activeFields =\n mode === 'weeks'\n ? (['weeks'] as Array<keyof ExtendedDurationParts>)\n : durationComponentFields.filter((field) => shown.includes(field));\n\n const openFields = (parts: ExtendedDurationParts) => {\n const withValues = durationComponentFields.filter(\n (field) => parts[field] > 0,\n );\n return withValues.length ? withValues : [defaultComponentField];\n };\n\n return {\n open,\n draft,\n options,\n disabled,\n value,\n mode,\n /** The rows to draw, and the order to draw them in. */\n activeFields,\n /** What the add control may offer. Empty in weeks mode. */\n addableFields:\n mode === 'weeks'\n ? []\n : durationComponentFields.filter((field) => !shown.includes(field)),\n error:\n props.errors ||\n (value && !parseExtendedDuration(value) ? t('duration.invalid') : ''),\n showActions: options.showActions !== false,\n openPicker: () => {\n if (!disabled) {\n const parts = parseExtendedDuration(value) ?? {\n ...emptyDurationParts,\n };\n setDraft(parts);\n setModeState(isWeeksDuration(value) ? 'weeks' : 'components');\n setShown(openFields(parts));\n setOpen(true);\n }\n },\n close: () => setOpen(false),\n apply: () => {\n commitParts(draft);\n setOpen(false);\n },\n changeText: (next: string) => commit(next || undefined),\n /**\n * Switches between the two representations.\n *\n * They cannot coexist - `P2W3D` is not a duration - so switching clears\n * the other side rather than pretending to carry it across. The draft is\n * only committed on Apply, so Cancel still restores what was there.\n */\n setMode: (next: DurationMode) => {\n if (disabled || next === mode) return;\n /*\n Starting at zero rather than inventing a week: switching mode is not\n the user saying how long something is. Zero serializes as `P0D`,\n which section 21 requires regardless of which form was on screen -\n there is no distinct `P0W` to preserve, since `P0W` and `P0D` are the\n same duration.\n */\n const parts = { ...emptyDurationParts };\n setModeState(next);\n setDraft(parts);\n setShown(next === 'weeks' ? [] : openFields(parts));\n commitIfLive(parts);\n },\n /** Reveals a unit at zero, in magnitude order. */\n addField: (key: keyof ExtendedDurationParts) => {\n if (disabled || key === 'weeks') return;\n setShown((current) =>\n current.includes(key) ? current : [...current, key],\n );\n },\n /** Hides a unit *and clears it*, so the value matches what is on screen. */\n removeField: (key: keyof ExtendedDurationParts) => {\n if (disabled) return;\n setShown((current) => {\n const next = current.filter((field) => field !== key);\n return next.length ? next : [defaultComponentField];\n });\n const next = { ...draft, [key]: 0 };\n setDraft(next);\n commitIfLive(next);\n },\n changePart: (key: keyof ExtendedDurationParts, value: number) => {\n if (disabled) return;\n const next = {\n ...draft,\n [key]: Math.max(0, Math.min(durationFieldMax, Math.floor(value || 0))),\n };\n setDraft(next);\n commitIfLive(next);\n },\n };\n};\n","import {\n and,\n isStringControl,\n optionIs,\n or,\n rankWith,\n schemaTypeIs,\n uiTypeIs,\n Tester,\n Resolve,\n} from '@jsonforms/core';\nconst hasLanguage: Tester = (ui) =>\n typeof ui.options?.language === 'string' ||\n typeof ui.options?.[':language'] === 'string';\nexport const monacoControlTester = rankWith(\n 25,\n and(\n uiTypeIs('Control'),\n optionIs('format', 'code'),\n or(\n and(isStringControl, hasLanguage),\n and(optionIs('language', 'json'), optionIs('convertJson', true)),\n ),\n ),\n);\nexport const extendedAgGridTester = rankWith(\n 25,\n and(\n uiTypeIs('Control'),\n schemaTypeIs('array'),\n optionIs('variant', 'ag-grid'),\n ),\n);\nexport const resolveEditorLanguage = (\n options: Record<string, any>,\n data: unknown,\n): string => {\n const language =\n typeof options[':language'] === 'string'\n ? Resolve.data(data, options[':language'])\n : undefined;\n return typeof language === 'string' && language\n ? language\n : options.language || 'plaintext';\n};\nexport const encodeEditorValue = (data: unknown, convert: boolean) =>\n data == null ? '' : convert ? JSON.stringify(data, null, 2) : String(data);\nexport const decodeEditorValue = (\n value: string,\n convert: boolean,\n): { valid: boolean; value: unknown } => {\n if (!convert) return { valid: true, value: value || undefined };\n try {\n return { valid: true, value: JSON.parse(value) };\n } catch {\n return { valid: false, value };\n }\n};\n","import { RefObject, useEffect, useState } from 'react';\n\nexport type EditorAppearance = {\n /** Resolved light/dark for the control, whatever the source. */\n isDark: boolean;\n /**\n * A theme name the uischema supplied verbatim (i.e. not light/dark/system).\n * Only meaningful to renderers that understand named themes, such as Monaco.\n */\n customTheme?: string;\n};\n\nexport const useEditorAppearance = (\n ref: RefObject<HTMLElement>,\n explicitTheme?: string,\n /**\n * Authoritative light/dark from the host design system (e.g. antd's active\n * theme algorithm). When supplied it wins over the DOM luminance heuristic\n * below, which only guesses and silently falls back to prefers-color-scheme\n * when no ancestor paints an opaque background.\n */\n isDark?: boolean,\n) => {\n const [dark, setDark] = useState(false);\n useEffect(() => {\n const node = ref.current;\n if (!node) return;\n const ancestors: Element[] = [];\n let current: Element | null = node;\n while (current) {\n ancestors.push(current);\n const root = current.getRootNode();\n current =\n current.parentElement ??\n (root instanceof ShadowRoot ? root.host : null);\n }\n const media = window.matchMedia?.('(prefers-color-scheme: dark)');\n const update = () => {\n for (const element of ancestors) {\n const color = getComputedStyle(element).backgroundColor;\n const values = color.match(/[\\d.]+/g)?.map(Number);\n if (\n values &&\n values.length >= 3 &&\n (values.length < 4 || values[3] > 0.5)\n ) {\n setDark(\n values[0] * 0.299 + values[1] * 0.587 + values[2] * 0.114 < 128,\n );\n return;\n }\n }\n setDark(Boolean(media?.matches));\n };\n const observer = new MutationObserver(update);\n ancestors.forEach((element) =>\n observer.observe(element, {\n attributes: true,\n attributeFilter: ['class', 'style', 'mode', 'dark'],\n }),\n );\n media?.addEventListener('change', update);\n update();\n return () => {\n observer.disconnect();\n media?.removeEventListener('change', update);\n };\n }, [ref]);\n // Precedence: explicit uischema theme > host design system > DOM heuristic.\n // 'system' deliberately skips the design system and follows the environment.\n const named = ['light', 'dark', 'system'];\n return {\n customTheme:\n explicitTheme && !named.includes(explicitTheme)\n ? explicitTheme\n : undefined,\n isDark:\n explicitTheme === 'dark'\n ? true\n : explicitTheme === 'light'\n ? false\n : explicitTheme !== 'system' && isDark !== undefined\n ? isDark\n : dark,\n };\n};\n","import React from 'react';\nimport { ControlProps } from '@jsonforms/core';\nimport { withJsonFormsControlProps } from '@jsonforms/react';\nimport { createLazyControl } from '../util/lazyControl';\nimport { EditorRendererComponents } from '../components/editorRendererTypes';\n\n/**\n * @monaco-editor/react pulls in the Monaco loader; importing it here would put\n * it in the main bundle for every form, so the implementation is fetched only\n * once a code editor control is actually rendered.\n */\nexport const createMonacoControlRenderer = (\n components: EditorRendererComponents,\n) =>\n withJsonFormsControlProps(\n createLazyControl(\n async () =>\n (await import('./MonacoControlRenderer.impl')).createMonacoControl(\n components,\n ) as React.ComponentType<ControlProps>,\n components,\n { loading: 'editor.loading', error: 'editor.loadError' },\n ),\n );\n","import React from 'react';\nimport { ControlProps } from '@jsonforms/core';\nimport { withJsonFormsControlProps } from '@jsonforms/react';\nimport { createLazyControl } from '../util/lazyControl';\nimport { EditorRendererComponents } from '../components/editorRendererTypes';\n\n/**\n * ag-grid-community + ag-grid-react are ~1MB; importing them here would put\n * them in the main bundle for every form, so the implementation is fetched\n * only once a grid control is actually rendered.\n */\nexport const createAgGridControl = (components: EditorRendererComponents) =>\n createLazyControl(\n async () =>\n (await import('./AgGridControlRenderer.impl')).createAgGridControl(\n components,\n ) as React.ComponentType<ControlProps>,\n components,\n { loading: 'grid.loading', error: 'grid.loadError' },\n );\n\nexport const createAgGridControlRenderer = (\n components: EditorRendererComponents,\n) => withJsonFormsControlProps(createAgGridControl(components));\n","import {\n SharedSplitLayoutRenderer,\n sharedSplitLayoutTester,\n} from './renderers/SplitLayoutRenderer';\nimport { JsonFormsRendererRegistryEntry } from '@jsonforms/core';\nimport { withJsonFormsLayoutProps } from '@jsonforms/react';\nimport React from 'react';\nimport {\n TemplateLayoutProps,\n TemplateLayoutRenderer,\n} from './renderers/TemplateLayoutRenderer';\nimport { RactiveTemplateLayoutRenderer } from './renderers/RactiveTemplateLayoutRenderer';\nimport {\n TsxTemplateLayoutRenderer,\n tsxTemplateLayoutTester,\n} from './renderers/TsxTemplateLayoutRenderer';\nimport {\n TemplateDiagnostic,\n templateLangTester,\n unsupportedTemplateLangTester,\n} from './renderers/templateEngines';\nimport {\n ButtonRenderer,\n buttonRendererTester,\n} from './renderers/ButtonRenderer';\nimport {\n TemplateRenderer,\n namedTemplateTester,\n} from './renderers/TemplateRenderer';\nimport { SlotRenderer, slotRendererTester } from './renderers/SlotRenderer';\nimport {\n SpacerRenderer,\n spacerRendererTester,\n} from './renderers/SpacerRenderer';\nimport {\n ImageViewRenderer,\n imageViewRendererTester,\n} from './renderers/ImageViewRenderer';\nimport {\n SeparatorRenderer,\n separatorRendererTester,\n} from './renderers/SeparatorRenderer';\nimport { LinkRenderer, linkRendererTester } from './renderers/LinkRenderer';\nimport {\n MarkupLabelRenderer,\n markupLabelTester,\n} from './renderers/MarkupLabelRenderer';\n\nexport type CreateExtendedRenderersOptions = {\n components?: Record<string, React.ComponentType<any>>;\n includeButtonRenderer?: boolean;\n};\n\nexport const createExtendedRenderers = (\n componentsOrOptions?:\n | Record<string, React.ComponentType<any>>\n | CreateExtendedRenderersOptions,\n): JsonFormsRendererRegistryEntry[] => {\n const options: CreateExtendedRenderersOptions =\n componentsOrOptions && 'components' in componentsOrOptions\n ? (componentsOrOptions as CreateExtendedRenderersOptions)\n : {\n components: componentsOrOptions as\n | Record<string, React.ComponentType<any>>\n | undefined,\n };\n const components = options.components;\n const includeButtonRenderer = options.includeButtonRenderer ?? true;\n\n // Wrap the TemplateLayoutRenderer with JSON Forms props\n const WrappedTemplateLayoutRenderer = withJsonFormsLayoutProps(\n (props: TemplateLayoutProps) => (\n <TemplateLayoutRenderer {...props} components={components} />\n ),\n );\n\n return [\n { tester: sharedSplitLayoutTester, renderer: SharedSplitLayoutRenderer },\n /*\n The `columns` layout renderer is no longer registered. It encoded child\n width as `options.columns`, an integer from 2 to 16 against a fixed\n 16-column grid - the encoding the Svelte and Vuetify renderer families\n use, and one the portable contract replaces with `options.layout.span`\n against a configurable `gridColumns`.\n\n Registering it would have kept overriding the base HorizontalLayout at\n rank 3, so the sizing model could never take effect. The renderer and its\n tester are still exported for a host that wants the old behaviour back;\n a `columns` option now draws a diagnostic instead of silently sizing\n nothing. See Adjustment 21.\n */\n { tester: spacerRendererTester, renderer: SpacerRenderer },\n { tester: imageViewRendererTester, renderer: ImageViewRenderer },\n { tester: separatorRendererTester, renderer: SeparatorRenderer },\n { tester: linkRendererTester, renderer: LinkRenderer },\n /*\n A `Label` that asks for markup. Registered without typography slots: a\n renderer set that has them binds its own entry ahead of this one, and\n ties go to the earlier registration.\n */\n { tester: markupLabelTester, renderer: MarkupLabelRenderer },\n ...(includeButtonRenderer\n ? [\n {\n tester: buttonRendererTester,\n renderer: ButtonRenderer,\n },\n ]\n : []),\n /*\n One entry per template language. The engine is chosen in the **tester**,\n which sees the form-wide `config` and therefore `defaultTemplateLang`;\n resolution is explicit `lang`, then that config key, then `ractive`.\n */\n /*\n Above the string engines: a function template is selected by the shape\n of `template`, not by `lang`, and must win over them.\n */\n {\n tester: tsxTemplateLayoutTester,\n renderer: TsxTemplateLayoutRenderer,\n },\n {\n tester: templateLangTester('jsx'),\n renderer: WrappedTemplateLayoutRenderer,\n },\n {\n tester: templateLangTester('ractive'),\n renderer: withJsonFormsLayoutProps(RactiveTemplateLayoutRenderer),\n },\n /*\n Lower-ranked, so it only wins when neither engine claimed the element:\n \"unknown or unsupported languages must be diagnosed rather than\n interpreted as another engine\".\n */\n {\n tester: unsupportedTemplateLangTester,\n renderer: withJsonFormsLayoutProps(TemplateDiagnostic as any),\n },\n {\n tester: namedTemplateTester,\n renderer: TemplateRenderer,\n },\n {\n tester: slotRendererTester,\n renderer: SlotRenderer,\n },\n ];\n};\nexport * from './renderers';\nexport * from './components/GenericAdditionalProperties';\nexport * from './util/actionContext';\nexport * from './util/horizontalLayout';\n\nexport * from './core/ajv';\nexport * from './core/keywords';\nexport * from './core/dynamicDefaults';\nexport * from './core/ajvI18n';\nexport { default as extendedTransformKeyword } from './core/transform';\n/*\n `./core/ajvI18n/localizers` is deliberately **not** re-exported: it imports\n every language `ajv-i18n` ships, and re-exporting it here would put them in\n the bundle of every form that touches this package. It is imported by path.\n*/\nexport * from './core/uiSchema';\nexport * from './util/configNamespaces';\nexport * from './util/urlPolicy';\nexport * from './util/templateUrls';\nexport * from './util/additionalErrors';\nexport * from './components/ExtendedJsonForms';\nexport * from './util/editorDiagnostics';\nexport * from './util/extendedControls';\nexport * from './util/maskControls';\nexport * from './util/cron';\nexport * from './util/useCronPicker';\nexport * from './util/useDurationControl';\nexport * from './util/editorControls';\nexport * from './components/editorRendererTypes';\nexport * from './util/useEditorAppearance';\nexport * from './util/i18nDefaults';\nexport * from './util/useExtendedTranslator';\nexport * from './util/extendedLocale';\nexport * from './util/markup';\nexport * from './util/interpolate';\nexport * from './util/markdownEscape';\n/*\n `./util/markdown` is deliberately **not** re-exported, for the same reason\n as `./core/ajvI18n/localizers` above: it imports markdown-it statically, so\n naming it here would put the parser in the entry chunk of every form and\n undo the dynamic import in `MarkupLabelRenderer`. It is imported by path.\n*/\nexport * from './locale/bg';\nexport * from './renderers/MonacoControlRenderer';\nexport * from './renderers/AgGridControlRenderer';\n\nexport { TRUST_DYNAMIC_FUNCTIONS } from '@chobantonov/jsonforms-react-renderer-common/dynamic/dynamicConfig';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,IAAa8C,KAAwCC,EACnD,GACAC,EACEC,GAAGC,EAAS,kBAAkB,GAAGA,EAAS,gBAAgB,CAAC,IAC1D,MAAO;;CAAO,OAAA,QAAA,KAAA,IAAAG,EAAG,YAAA,OAAA,KAAA,IAAAD,EAAS,YAAA,OAAW,KAAXD,CAAa,CAAC,CAAC,YAAY,MAAM;AAAA,CAC9D,CACF,GAEaG,MAAgB,MAC3B,OAAOC,KAAU,YAAY,OAAO,SAASA,CAAK,KAAKA,IAAQ,IAC3D,GAAGA,EAA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