@rjsf/core
Advanced tools
Comparing version 5.10.0 to 5.11.1
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("@rjsf/utils"),a=require("lodash/get"),i=require("lodash/isEmpty"),n=require("lodash/pick"),o=require("lodash/toPath"),s=require("lodash/cloneDeep"),l=require("lodash/isObject"),d=require("lodash/set"),u=require("nanoid"),c=require("lodash/omit"),m=require("lodash/unset"),p=require("markdown-to-jsx"),h=require("lodash/has");function f(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var g=f(a),v=f(i),y=f(n),S=f(o),b=f(s),x=f(l),C=f(d),F=f(c),j=f(m),O=f(p),D=f(h);function T(){return T=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},T.apply(this,arguments)}function E(e,r){e.prototype=Object.create(r.prototype),e.prototype.constructor=e,I(e,r)}function I(e,r){return I=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,r){return e.__proto__=r,e},I(e,r)}function N(e,r){if(null==e)return{};var t,a,i={},n=Object.keys(e);for(a=0;a<n.length;a++)r.indexOf(t=n[a])>=0||(i[t]=e[t]);return i}var k=["widget","title"],w=["widget","title"],A=["widget","title"];function B(){return u.nanoid()}function U(e){return Array.isArray(e)?e.map((function(e){return{key:B(),item:e}})):[]}function _(e){return Array.isArray(e)?e.map((function(e){return e.item})):[]}var P=function(r){function a(e){var a;(a=r.call(this,e)||this)._getNewFormDataRow=function(){var e=a.props,r=e.schema,i=e.registry.schemaUtils,n=r.items;return t.isFixedItems(r)&&t.allowAdditionalItems(r)&&(n=r.additionalItems),i.getDefaultFormState(n)},a.onAddClick=function(e){a._handleAddClick(e)},a.onAddIndexClick=function(e){return function(r){a._handleAddClick(r,e)}},a.onCopyIndexClick=function(e){return function(r){r&&r.preventDefault();var t=a.props.onChange,i=a.state.keyedFormData,n={key:B(),item:b.default(i[e].item)},o=[].concat(i);void 0!==e?o.splice(e+1,0,n):o.push(n),a.setState({keyedFormData:o,updatedKeyedFormData:!0},(function(){return t(_(o))}))}},a.onDropIndexClick=function(e){return function(r){r&&r.preventDefault();var t,i=a.props,n=i.onChange,o=i.errorSchema,s=a.state.keyedFormData;if(o)for(var l in t={},o){var d=parseInt(l);d<e?C.default(t,[d],o[l]):d>e&&C.default(t,[d-1],o[l])}var u=s.filter((function(r,t){return t!==e}));a.setState({keyedFormData:u,updatedKeyedFormData:!0},(function(){return n(_(u),t)}))}},a.onReorderClick=function(e,r){return function(t){t&&(t.preventDefault(),t.currentTarget.blur());var i,n=a.props,o=n.onChange,s=n.errorSchema;if(s)for(var l in i={},s){var d=parseInt(l);d==e?C.default(i,[r],s[e]):d==r?C.default(i,[e],s[r]):C.default(i,[l],s[d])}var u,c=a.state.keyedFormData,m=((u=c.slice()).splice(e,1),u.splice(r,0,c[e]),u);a.setState({keyedFormData:m},(function(){return o(_(m),i)}))}},a.onChangeForIndex=function(e){return function(r,t,i){var n,o=a.props,s=o.formData,l=o.errorSchema;(0,o.onChange)((Array.isArray(s)?s:[]).map((function(t,a){return e===a?void 0===r?null:r:t})),l&&l&&T({},l,((n={})[e]=t,n)),i)}},a.onSelectChange=function(e){var r=a.props,t=r.idSchema;(0,r.onChange)(e,void 0,t&&t.$id)};var i=e.formData,n=U(void 0===i?[]:i);return a.state={keyedFormData:n,updatedKeyedFormData:!1},a}E(a,r),a.getDerivedStateFromProps=function(e,r){if(r.updatedKeyedFormData)return{updatedKeyedFormData:!1};var t=Array.isArray(e.formData)?e.formData:[],a=r.keyedFormData||[];return{keyedFormData:t.length===a.length?a.map((function(e,r){return{key:e.key,item:t[r]}})):U(t)}};var i,n,o=a.prototype;return o.isItemRequired=function(e){return Array.isArray(e.type)?!e.type.includes("null"):"null"!==e.type},o.canAddItem=function(e){var r=this.props,a=r.schema,i=t.getUiOptions(r.uiSchema,r.registry.globalUiOptions).addable;return!1!==i&&(i=void 0===a.maxItems||e.length<a.maxItems),i},o._handleAddClick=function(e,r){e&&e.preventDefault();var t=this.props.onChange,a=this.state.keyedFormData,i={key:B(),item:this._getNewFormDataRow()},n=[].concat(a);void 0!==r?n.splice(r,0,i):n.push(i),this.setState({keyedFormData:n,updatedKeyedFormData:!0},(function(){return t(_(n))}))},o.render=function(){var r=this.props,a=r.schema,i=r.uiSchema,n=r.idSchema,o=r.registry,s=o.schemaUtils,l=o.translateString;if(!(t.ITEMS_KEY in a)){var d=t.getUiOptions(i),u=t.getTemplate("UnsupportedFieldTemplate",o,d);return e.jsx(u,{schema:a,idSchema:n,reason:l(t.TranslatableString.MissingItems),registry:o})}return s.isMultiSelect(a)?this.renderMultiSelect():t.isCustomWidget(i)?this.renderCustomWidget():t.isFixedItems(a)?this.renderFixedArray():s.isFilesArray(a,i)?this.renderFiles():this.renderNormalArray()},o.renderNormalArray=function(){var r=this,a=this.props,i=a.schema,n=a.uiSchema,o=void 0===n?{}:n,s=a.errorSchema,l=a.idSchema,d=a.name,u=a.disabled,c=void 0!==u&&u,m=a.readonly,p=void 0!==m&&m,h=a.autofocus,f=void 0!==h&&h,g=a.required,v=void 0!==g&&g,y=a.registry,S=a.onBlur,b=a.onFocus,C=a.idPrefix,F=a.idSeparator,j=void 0===F?"_":F,O=a.rawErrors,D=this.state.keyedFormData,E=void 0===i.title?d:i.title,I=y.schemaUtils,N=y.formContext,k=t.getUiOptions(o),w=x.default(i.items)?i.items:{},A=I.retrieveSchema(w),B=_(this.state.keyedFormData),U=this.canAddItem(B),P={canAdd:U,items:D.map((function(e,t){var a=e.key,i=e.item,n=I.retrieveSchema(w,i),u=s?s[t]:void 0,c=I.toIdSchema(n,l.$id+j+t,i,C,j);return r.renderArrayFieldItem({key:a,index:t,name:d&&d+"-"+t,canAdd:U,canMoveUp:t>0,canMoveDown:t<B.length-1,itemSchema:n,itemIdSchema:c,itemErrorSchema:u,itemData:i,itemUiSchema:o.items,autofocus:f&&0===t,onBlur:S,onFocus:b,rawErrors:O,totalItems:D.length})})),className:"field field-array field-array-of-"+A.type,disabled:c,idSchema:l,uiSchema:o,onAddClick:this.onAddClick,readonly:p,required:v,schema:i,title:E,formContext:N,formData:B,rawErrors:O,registry:y},q=t.getTemplate("ArrayFieldTemplate",y,k);return e.jsx(q,T({},P))},o.renderCustomWidget=function(){var r,a=this.props,i=a.schema,n=a.idSchema,o=a.uiSchema,s=a.disabled,l=void 0!==s&&s,d=a.readonly,u=void 0!==d&&d,c=a.autofocus,m=void 0!==c&&c,p=a.required,h=void 0!==p&&p,f=a.hideError,g=a.placeholder,v=a.onBlur,y=a.onFocus,S=a.formData,b=void 0===S?[]:S,x=a.registry,C=a.rawErrors,F=a.name,j=x.widgets,O=x.formContext,D=x.globalUiOptions,T=x.schemaUtils,E=t.getUiOptions(o,D),I=E.widget,w=E.title,A=N(E,k),B=t.getWidget(i,I,j),U=null!=(r=null!=w?w:i.title)?r:F,_=T.getDisplayLabel(i,o,D);return e.jsx(B,{id:n.$id,name:F,multiple:!0,onChange:this.onSelectChange,onBlur:v,onFocus:y,options:A,schema:i,uiSchema:o,registry:x,value:b,disabled:l,readonly:u,hideError:f,required:h,label:U,hideLabel:!_,placeholder:g,formContext:O,autofocus:m,rawErrors:C})},o.renderMultiSelect=function(){var r,a=this.props,i=a.schema,n=a.idSchema,o=a.uiSchema,s=a.formData,l=void 0===s?[]:s,d=a.disabled,u=void 0!==d&&d,c=a.readonly,m=void 0!==c&&c,p=a.autofocus,h=void 0!==p&&p,f=a.required,g=void 0!==f&&f,v=a.placeholder,y=a.onBlur,S=a.onFocus,b=a.registry,x=a.rawErrors,C=a.name,F=b.widgets,j=b.schemaUtils,O=b.formContext,D=b.globalUiOptions,E=j.retrieveSchema(i.items,l),I=t.optionsList(E),k=t.getUiOptions(o,D),A=k.widget,B=void 0===A?"select":A,U=k.title,_=N(k,w),P=t.getWidget(i,B,F),q=null!=(r=null!=U?U:i.title)?r:C,R=j.getDisplayLabel(i,o,D);return e.jsx(P,{id:n.$id,name:C,multiple:!0,onChange:this.onSelectChange,onBlur:y,onFocus:S,options:T({},_,{enumOptions:I}),schema:i,uiSchema:o,registry:b,value:l,disabled:u,readonly:m,required:g,label:q,hideLabel:!R,placeholder:v,formContext:O,autofocus:h,rawErrors:x})},o.renderFiles=function(){var r,a=this.props,i=a.schema,n=a.uiSchema,o=a.idSchema,s=a.name,l=a.disabled,d=void 0!==l&&l,u=a.readonly,c=void 0!==u&&u,m=a.autofocus,p=void 0!==m&&m,h=a.required,f=void 0!==h&&h,g=a.onBlur,v=a.onFocus,y=a.registry,S=a.formData,b=void 0===S?[]:S,x=a.rawErrors,C=y.widgets,F=y.formContext,j=y.globalUiOptions,O=y.schemaUtils,D=t.getUiOptions(n,j),T=D.widget,E=void 0===T?"files":T,I=D.title,k=N(D,A),w=t.getWidget(i,E,C),B=null!=(r=null!=I?I:i.title)?r:s,U=O.getDisplayLabel(i,n,j);return e.jsx(w,{options:k,id:o.$id,name:s,multiple:!0,onChange:this.onSelectChange,onBlur:g,onFocus:v,schema:i,uiSchema:n,value:b,disabled:d,readonly:c,required:f,registry:y,formContext:F,autofocus:p,rawErrors:x,label:B,hideLabel:!U})},o.renderFixedArray=function(){var r=this,a=this.props,i=a.schema,n=a.uiSchema,o=void 0===n?{}:n,s=a.formData,l=void 0===s?[]:s,d=a.errorSchema,u=a.idPrefix,c=a.idSeparator,m=void 0===c?"_":c,p=a.idSchema,h=a.name,f=a.disabled,g=void 0!==f&&f,v=a.readonly,y=void 0!==v&&v,S=a.autofocus,b=void 0!==S&&S,C=a.required,F=void 0!==C&&C,j=a.registry,O=a.onBlur,D=a.onFocus,E=a.rawErrors,I=this.state.keyedFormData,N=this.props.formData,k=void 0===N?[]:N,w=i.title||h,A=t.getUiOptions(o),B=j.schemaUtils,U=j.formContext,_=(x.default(i.items)?i.items:[]).map((function(e,r){return B.retrieveSchema(e,l[r])})),P=x.default(i.additionalItems)?B.retrieveSchema(i.additionalItems,l):null;(!k||k.length<_.length)&&(k=(k=k||[]).concat(new Array(_.length-k.length)));var q=this.canAddItem(k)&&!!P,R={canAdd:q,className:"field field-array field-array-fixed-items",disabled:g,idSchema:p,formData:l,items:I.map((function(e,t){var a=e.key,n=e.item,s=t>=_.length,l=s&&x.default(i.additionalItems)?B.retrieveSchema(i.additionalItems,n):_[t],c=B.toIdSchema(l,p.$id+m+t,n,u,m),f=s?o.additionalItems||{}:Array.isArray(o.items)?o.items[t]:o.items||{};return r.renderArrayFieldItem({key:a,index:t,name:h&&h+"-"+t,canAdd:q,canRemove:s,canMoveUp:t>=_.length+1,canMoveDown:s&&t<k.length-1,itemSchema:l,itemData:n,itemUiSchema:f,itemIdSchema:c,itemErrorSchema:d?d[t]:void 0,autofocus:b&&0===t,onBlur:O,onFocus:D,rawErrors:E,totalItems:I.length})})),onAddClick:this.onAddClick,readonly:y,required:F,registry:j,schema:i,uiSchema:o,title:w,formContext:U,rawErrors:E},L=t.getTemplate("ArrayFieldTemplate",j,A);return e.jsx(L,T({},R))},o.renderArrayFieldItem=function(r){var a=r.key,i=r.index,n=r.name,o=r.canAdd,s=r.canRemove,l=void 0===s||s,d=r.canMoveUp,u=r.canMoveDown,c=r.itemSchema,m=r.itemData,p=r.itemUiSchema,h=r.itemIdSchema,f=r.itemErrorSchema,g=r.autofocus,v=r.onBlur,y=r.onFocus,S=r.rawErrors,b=r.totalItems,x=this.props,C=x.disabled,F=x.hideError,j=x.idPrefix,O=x.idSeparator,D=x.readonly,T=x.registry,E=x.formContext,I=T.fields,N=I.ArraySchemaField||I.SchemaField,k=t.getUiOptions(x.uiSchema,T.globalUiOptions),w=k.orderable,A=void 0===w||w,B=k.removable,U=k.copyable,_={moveUp:A&&d,moveDown:A&&u,copy:void 0!==U&&U&&o,remove:(void 0===B||B)&&l,toolbar:!1};return _.toolbar=Object.keys(_).some((function(e){return _[e]})),{children:e.jsx(N,{name:n,index:i,schema:c,uiSchema:p,formData:m,formContext:E,errorSchema:f,idPrefix:j,idSeparator:O,idSchema:h,required:this.isItemRequired(c),onChange:this.onChangeForIndex(i),onBlur:v,onFocus:y,registry:T,disabled:C,readonly:D,hideError:F,autofocus:g,rawErrors:S}),className:"array-item",disabled:C,canAdd:o,hasCopy:_.copy,hasToolbar:_.toolbar,hasMoveUp:_.moveUp,hasMoveDown:_.moveDown,hasRemove:_.remove,index:i,totalItems:b,key:a,onAddIndexClick:this.onAddIndexClick,onCopyIndexClick:this.onCopyIndexClick,onDropIndexClick:this.onDropIndexClick,onReorderClick:this.onReorderClick,readonly:D,registry:T,schema:c,uiSchema:p}},i=a,(n=[{key:"itemTitle",get:function(){var e=this.props,r=e.schema;return g.default(r,[t.ITEMS_KEY,"title"],g.default(r,[t.ITEMS_KEY,"description"],(0,e.registry.translateString)(t.TranslatableString.ArrayItemTitle)))}}])&&function(e,r){for(var t=0;t<r.length;t++){var a=r[t];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,"symbol"==typeof(i=function(e,r){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(a.key))?i:String(i),a)}var i}(i.prototype,n),Object.defineProperty(i,"prototype",{writable:!1}),a}(r.Component),q=["widget","title","label"];function R(r){var a,i,n=r.schema,o=r.name,s=r.uiSchema,l=r.idSchema,d=r.formData,u=r.registry,c=r.required,m=r.disabled,p=r.readonly,h=r.autofocus,f=r.onChange,g=r.onFocus,v=r.onBlur,y=r.rawErrors,S=n.title,b=u.widgets,C=u.formContext,F=u.translateString,j=t.getUiOptions(s,u.globalUiOptions),O=j.widget,D=void 0===O?"checkbox":O,E=j.title,I=j.label,k=void 0===I||I,w=N(j,q),A=t.getWidget(n,D,b),B=F(t.TranslatableString.YesLabel),U=F(t.TranslatableString.NoLabel),_=null!=(a=null!=E?E:S)?a:o;if(Array.isArray(n.oneOf))i=t.optionsList({oneOf:n.oneOf.map((function(e){if(x.default(e))return T({},e,{title:e.title||(!0===e.const?B:U)})})).filter((function(e){return e}))});else{var P,R=n,L=null!=(P=n.enum)?P:[!0,!1];i=!R.enumNames&&2===L.length&&L.every((function(e){return"boolean"==typeof e}))?[{value:L[0],label:L[0]?B:U},{value:L[1],label:L[1]?B:U}]:t.optionsList({enum:L,enumNames:R.enumNames})}return e.jsx(A,{options:T({},w,{enumOptions:i}),schema:n,uiSchema:s,id:l.$id,name:o,onChange:f,onFocus:g,onBlur:v,label:_,hideLabel:!k,value:d,required:c,disabled:m,readonly:p,registry:u,formContext:C,autofocus:h,rawErrors:y})}var L=["widget","placeholder","autofocus","autocomplete","title"],V=["oneOf","anyOf"],K=function(r){function a(e){var t;(t=r.call(this,e)||this).onOptionChange=function(e){var r=t.state,a=r.selectedOption,i=r.retrievedOptions,n=t.props,o=n.formData,s=n.onChange,l=n.registry.schemaUtils,d=void 0!==e?parseInt(e,10):-1;if(d!==a){var u=d>=0?i[d]:void 0,c=l.sanitizeDataForNewSchema(u,a>=0?i[a]:void 0,o);c&&u&&(c=l.getDefaultFormState(u,c,"excludeObjectChildren")),s(c,void 0,t.getFieldId()),t.setState({selectedOption:d})}};var a=t.props,i=a.formData,n=a.registry.schemaUtils,o=a.options.map((function(e){return n.retrieveSchema(e,i)}));return t.state={retrievedOptions:o,selectedOption:t.getMatchingOption(0,i,o)},t}E(a,r);var i=a.prototype;return i.componentDidUpdate=function(e,r){var a=this.props,i=a.formData,n=a.options,o=a.idSchema,s=this.state.selectedOption,l=this.state;if(!t.deepEquals(e.options,n)){var d=this.props.registry.schemaUtils;l={selectedOption:s,retrievedOptions:n.map((function(e){return d.retrieveSchema(e,i)}))}}if(!t.deepEquals(i,e.formData)&&o.$id===e.idSchema.$id){var u=l.retrievedOptions,c=this.getMatchingOption(s,i,u);r&&c!==s&&(l={selectedOption:c,retrievedOptions:u})}l!==this.state&&this.setState(l)},i.getMatchingOption=function(e,r,a){var i=this.props,n=i.registry.schemaUtils,o=t.getDiscriminatorFieldFromSchema(i.schema);return n.getClosestMatchingOption(r,a,e,o)},i.getFieldId=function(){var e=this.props;return e.idSchema.$id+(e.schema.oneOf?"__oneof_select":"__anyof_select")},i.render=function(){var r,a=this.props,i=a.name,n=a.disabled,o=void 0!==n&&n,s=a.errorSchema,l=void 0===s?{}:s,d=a.formContext,u=a.onBlur,c=a.onFocus,m=a.registry,p=a.schema,h=a.uiSchema,f=m.widgets,y=m.translateString,S=m.globalUiOptions,b=m.schemaUtils,x=m.fields.SchemaField,C=this.state,O=C.selectedOption,D=C.retrievedOptions,E=t.getUiOptions(h,S),I=E.widget,k=void 0===I?"select":I,w=E.placeholder,A=E.autofocus,B=E.autocomplete,U=E.title,_=void 0===U?p.title:U,P=N(E,L),q=t.getWidget({type:"number"},k,f),R=g.default(l,t.ERRORS_KEY,[]),K=F.default(l,[t.ERRORS_KEY]),M=b.getDisplayLabel(p,h,S),W=O>=0&&D[O]||null;if(W){var Y=N(p,V);j.default(Y,t.ADDITIONAL_PROPERTY_FLAG),r=v.default(Y)?W:T({},Y,W)}var $=_?t.TranslatableString.TitleOptionPrefix:t.TranslatableString.OptionPrefix,z=_?[_]:[],G=D.map((function(e,r){return{label:e.title||y($,z.concat(String(r+1))),value:r}}));return e.jsxs("div",{className:"panel panel-default panel-body",children:[e.jsx("div",{className:"form-group",children:e.jsx(q,{id:this.getFieldId(),name:i+(p.oneOf?"__oneof_select":"__anyof_select"),schema:{type:"number",default:0},onChange:this.onOptionChange,onBlur:u,onFocus:c,disabled:o||v.default(G),multiple:!1,rawErrors:R,errorSchema:K,value:O>=0?O:void 0,options:T({enumOptions:G},P),registry:m,formContext:d,placeholder:w,autocomplete:B,autofocus:A,label:null!=_?_:i,hideLabel:!M})}),null!==W&&e.jsx(x,T({},this.props,{schema:r}))]})},a}(r.Component),M=/\.([0-9]*0)*$/,W=/[0.]0*$/;function Y(a){var i=a.registry,n=a.onChange,o=a.formData,s=r.useState(a.value),l=s[0],d=s[1],u=i.fields.StringField,c=o,m=r.useCallback((function(e){d(e),"."===(""+e).charAt(0)&&(e="0"+e);var r="string"==typeof e&&e.match(M)?t.asNumber(e.replace(W,"")):t.asNumber(e);n(r)}),[n]);if("string"==typeof l&&"number"==typeof c){var p=new RegExp((""+c).replace(".","\\.")+"\\.?0*$");l.match(p)&&(c=l)}return e.jsx(u,T({},a,{formData:c,onChange:m}))}var $=function(r){function a(){for(var e,a=arguments.length,i=new Array(a),n=0;n<a;n++)i[n]=arguments[n];return(e=r.call.apply(r,[this].concat(i))||this).state={wasPropertyKeyModified:!1,additionalProperties:{}},e.onPropertyChange=function(r,t){return void 0===t&&(t=!1),function(a,i,n){var o,s,l=e.props,d=l.errorSchema;void 0===a&&t&&(a=""),(0,l.onChange)(T({},l.formData,((o={})[r]=a,o)),d&&d&&T({},d,((s={})[r]=i,s)),n)}},e.onDropPropertyClick=function(r){return function(t){t.preventDefault();var a=e.props,i=a.onChange,n=T({},a.formData);j.default(n,r),i(n)}},e.getAvailableKey=function(r,a){for(var i=e.props,n=t.getUiOptions(i.uiSchema,i.registry.globalUiOptions).duplicateKeySuffixSeparator,o=void 0===n?"-":n,s=0,l=r;D.default(a,l);)l=""+r+o+ ++s;return l},e.onKeyChange=function(r){return function(t,a){var i,n;if(r!==t){var o=e.props,s=o.formData,l=o.onChange,d=o.errorSchema;t=e.getAvailableKey(t,s);var u=T({},s),c=((i={})[r]=t,i),m=Object.keys(u).map((function(e){var r;return(r={})[c[e]||e]=u[e],r})),p=Object.assign.apply(Object,[{}].concat(m));e.setState({wasPropertyKeyModified:!0}),l(p,d&&d&&T({},d,((n={})[t]=a,n)))}}},e.handleAddClick=function(r){return function(){if(r.additionalProperties){var a=e.props,i=a.formData,n=a.onChange,o=a.registry,s=T({},i),l=void 0;if(x.default(r.additionalProperties)){l=r.additionalProperties.type;var d=r.additionalProperties;t.REF_KEY in d&&(l=(d=o.schemaUtils.retrieveSchema({$ref:d[t.REF_KEY]},i)).type),l||!(t.ANY_OF_KEY in d)&&!(t.ONE_OF_KEY in d)||(l="object")}var u=e.getAvailableKey("newKey",s);C.default(s,u,e.getDefaultValue(l)),n(s)}}},e}E(a,r);var i=a.prototype;return i.isRequired=function(e){var r=this.props.schema;return Array.isArray(r.required)&&-1!==r.required.indexOf(e)},i.getDefaultValue=function(e){var r=this.props.registry.translateString;switch(e){case"array":return[];case"boolean":return!1;case"null":return null;case"number":return 0;case"object":return{};default:return r(t.TranslatableString.NewStringDefault)}},i.render=function(){var r,a,i,n,o=this,s=this.props,l=s.uiSchema,d=void 0===l?{}:l,u=s.formData,c=s.errorSchema,m=s.idSchema,p=s.name,h=s.required,f=void 0!==h&&h,v=s.disabled,y=void 0!==v&&v,S=s.readonly,b=void 0!==S&&S,x=s.hideError,C=s.idPrefix,F=s.idSeparator,j=s.onBlur,E=s.onFocus,I=s.registry,N=I.formContext,k=I.translateString,w=I.globalUiOptions,A=I.fields.SchemaField,B=I.schemaUtils.retrieveSchema(s.schema,u),U=t.getUiOptions(d,w),_=B.properties,P=void 0===_?{}:_,q=null!=(r=null!=(a=U.title)?a:B.title)?r:p,R=null!=(i=U.description)?i:B.description;try{var L=Object.keys(P);n=t.orderProperties(L,U.order)}catch(r){return e.jsxs("div",{children:[e.jsx("p",{className:"config-error",style:{color:"red"},children:e.jsx(O.default,{children:k(t.TranslatableString.InvalidObjectField,[p||"root",r.message])})}),e.jsx("pre",{children:JSON.stringify(B)})]})}var V=t.getTemplate("ObjectFieldTemplate",I,U),K={title:!1===U.label?"":q,description:!1===U.label?void 0:R,properties:n.map((function(r){var a=D.default(B,[t.PROPERTIES_KEY,r,t.ADDITIONAL_PROPERTY_FLAG]),i=a?d.additionalProperties:d[r],n="hidden"===t.getUiOptions(i).widget,s=g.default(m,[r],{});return{content:e.jsx(A,{name:r,required:o.isRequired(r),schema:g.default(B,[t.PROPERTIES_KEY,r],{}),uiSchema:i,errorSchema:g.default(c,r),idSchema:s,idPrefix:C,idSeparator:F,formData:g.default(u,r),formContext:N,wasPropertyKeyModified:o.state.wasPropertyKeyModified,onKeyChange:o.onKeyChange(r),onChange:o.onPropertyChange(r,a),onBlur:j,onFocus:E,registry:I,disabled:y,readonly:b,hideError:x,onDropPropertyClick:o.onDropPropertyClick},r),name:r,readonly:b,disabled:y,required:f,hidden:n}})),readonly:b,disabled:y,required:f,idSchema:m,uiSchema:d,errorSchema:c,schema:B,formData:u,formContext:N,registry:I};return e.jsx(V,T({},K,{onAddClick:this.handleAddClick}))},a}(r.Component),z=["__errors"],G={array:"ArrayField",boolean:"BooleanField",integer:"NumberField",number:"NumberField",object:"ObjectField",string:"StringField",null:"NullField"};function H(a){var i=a.schema,n=a.idSchema,o=a.uiSchema,s=a.formData,l=a.errorSchema,d=a.idPrefix,u=a.idSeparator,c=a.name,m=a.onChange,p=a.onKeyChange,h=a.onDropPropertyClick,f=a.required,g=a.registry,v=a.wasPropertyKeyModified,y=void 0!==v&&v,S=g.formContext,b=g.schemaUtils,C=g.globalUiOptions,j=t.getUiOptions(o,C),D=t.getTemplate("FieldTemplate",g,j),E=t.getTemplate("DescriptionFieldTemplate",g,j),I=t.getTemplate("FieldHelpTemplate",g,j),k=t.getTemplate("FieldErrorTemplate",g,j),w=b.retrieveSchema(i,s),A=n[t.ID_KEY],B=t.mergeObjects(b.toIdSchema(w,A,s,d,u),n),U=r.useCallback((function(e,r,t){return m(e,r,t||A)}),[A,m]),_=function(r,a,i,n){var o=a.field,s=n.fields,l=n.translateString;if("function"==typeof o)return o;if("string"==typeof o&&o in s)return s[o];var d=t.getSchemaType(r),u=Array.isArray(d)?d[0]:d||"",c=r.$id,m=G[u];return c&&c in s&&(m=c),m||!r.anyOf&&!r.oneOf?m in s?s[m]:function(){var o=t.getTemplate("UnsupportedFieldTemplate",n,a);return e.jsx(o,{schema:r,idSchema:i,reason:l(t.TranslatableString.UnknownFieldType,[String(r.type)]),registry:n})}:function(){return null}}(w,j,B,g),P=Boolean(a.disabled||j.disabled),q=Boolean(a.readonly||j.readonly||a.schema.readOnly||w.readOnly),R=j.hideError,L=void 0===R?a.hideError:Boolean(R),V=Boolean(a.autofocus||j.autofocus);if(0===Object.keys(w).length)return null;var K=b.getDisplayLabel(w,o,C),M=l||{},W=M.__errors,Y=N(M,z),$=F.default(o,["ui:classNames","classNames","ui:style"]);t.UI_OPTIONS_KEY in $&&($[t.UI_OPTIONS_KEY]=F.default($[t.UI_OPTIONS_KEY],["classNames","style"]));var H,J=e.jsx(_,T({},a,{onChange:U,idSchema:B,schema:w,uiSchema:$,disabled:P,readonly:q,hideError:L,autofocus:V,errorSchema:Y,formContext:S,rawErrors:W})),Q=B[t.ID_KEY];H=y||t.ADDITIONAL_PROPERTY_FLAG in w?c:j.title||a.schema.title||w.title||c;var X=j.description||a.schema.description||w.description||"",Z=j.enableMarkdownInDescription?e.jsx(O.default,{children:X}):X,ee=j.help,re="hidden"===j.widget,te=["form-group","field","field-"+t.getSchemaType(w)];!L&&W&&W.length>0&&te.push("field-error has-error has-danger"),null!=o&&o.classNames&&te.push(o.classNames),j.classNames&&te.push(j.classNames);var ae=e.jsx(I,{help:ee,idSchema:B,schema:w,uiSchema:o,hasErrors:!L&&W&&W.length>0,registry:g}),ie=L?void 0:e.jsx(k,{errors:W,errorSchema:l,idSchema:B,schema:w,uiSchema:o,registry:g}),ne={description:e.jsx(E,{id:t.descriptionId(Q),description:Z,schema:w,uiSchema:o,registry:g}),rawDescription:X,help:ae,rawHelp:"string"==typeof ee?ee:void 0,errors:ie,rawErrors:L?void 0:W,id:Q,label:H,hidden:re,onChange:m,onKeyChange:p,onDropPropertyClick:h,required:f,disabled:P,readonly:q,hideError:L,displayLabel:K,classNames:te.join(" ").trim(),style:j.style,formContext:S,formData:s,schema:w,uiSchema:o,registry:g},oe=g.fields.AnyOfField,se=g.fields.OneOfField,le=(null==o?void 0:o["ui:field"])&&!0===(null==o?void 0:o["ui:fieldReplacesAnyOrOneOf"]);return e.jsx(D,T({},ne,{children:e.jsxs(e.Fragment,{children:[J,w.anyOf&&!le&&!b.isSelect(w)&&e.jsx(oe,{name:c,disabled:P,readonly:q,hideError:L,errorSchema:l,formData:s,formContext:S,idPrefix:d,idSchema:B,idSeparator:u,onBlur:a.onBlur,onChange:a.onChange,onFocus:a.onFocus,options:w.anyOf.map((function(e){return b.retrieveSchema(x.default(e)?e:{},s)})),registry:g,schema:w,uiSchema:o}),w.oneOf&&!le&&!b.isSelect(w)&&e.jsx(se,{name:c,disabled:P,readonly:q,hideError:L,errorSchema:l,formData:s,formContext:S,idPrefix:d,idSchema:B,idSeparator:u,onBlur:a.onBlur,onChange:a.onChange,onFocus:a.onFocus,options:w.oneOf.map((function(e){return b.retrieveSchema(x.default(e)?e:{},s)})),registry:g,schema:w,uiSchema:o})]})}))}var J=function(r){function a(){return r.apply(this,arguments)||this}E(a,r);var i=a.prototype;return i.shouldComponentUpdate=function(e){return!t.deepEquals(this.props,e)},i.render=function(){return e.jsx(H,T({},this.props))},a}(r.Component),Q=["widget","placeholder","title"];function X(r){var a,i=r.schema,n=r.name,o=r.uiSchema,s=r.idSchema,l=r.formData,d=r.required,u=r.disabled,c=void 0!==u&&u,m=r.readonly,p=void 0!==m&&m,h=r.autofocus,f=void 0!==h&&h,g=r.onChange,v=r.onBlur,y=r.onFocus,S=r.registry,b=r.rawErrors,x=i.title,C=i.format,F=S.widgets,j=S.formContext,O=S.schemaUtils,D=S.globalUiOptions,E=O.isSelect(i)?t.optionsList(i):void 0,I=E?"select":"text";C&&t.hasWidget(i,C,F)&&(I=C);var k=t.getUiOptions(o),w=k.widget,A=void 0===w?I:w,B=k.placeholder,U=void 0===B?"":B,_=k.title,P=N(k,Q),q=O.getDisplayLabel(i,o,D),R=null!=(a=null!=_?_:x)?a:n,L=t.getWidget(i,A,F);return e.jsx(L,{options:T({},P,{enumOptions:E}),schema:i,uiSchema:o,id:s.$id,name:n,label:R,hideLabel:!q,value:l,onChange:g,onBlur:v,onFocus:y,required:d,disabled:c,readonly:p,formContext:j,autofocus:f,registry:S,placeholder:U,rawErrors:b})}function Z(e){var t=e.formData,a=e.onChange;return r.useEffect((function(){void 0===t&&a(null)}),[t,a]),null}function ee(r){var a=r.idSchema,i=r.description,n=r.registry,o=r.schema,s=r.uiSchema,l=t.getUiOptions(s,n.globalUiOptions),d=l.label;if(!i||void 0!==d&&!d)return null;var u=t.getTemplate("DescriptionFieldTemplate",n,l);return e.jsx(u,{id:t.descriptionId(a),description:i,schema:o,uiSchema:s,registry:n})}function re(r){var t=r.disabled,a=r.hasToolbar,i=r.hasMoveDown,n=r.hasMoveUp,o=r.hasRemove,s=r.hasCopy,l=r.index,d=r.onCopyIndexClick,u=r.onDropIndexClick,c=r.onReorderClick,m=r.readonly,p=r.registry,h=r.uiSchema,f=p.templates.ButtonTemplates,g=f.CopyButton,v=f.MoveDownButton,y=f.MoveUpButton,S=f.RemoveButton,b={flex:1,paddingLeft:6,paddingRight:6,fontWeight:"bold"};return e.jsxs("div",{className:r.className,children:[e.jsx("div",{className:a?"col-xs-9":"col-xs-12",children:r.children}),a&&e.jsx("div",{className:"col-xs-3 array-item-toolbox",children:e.jsxs("div",{className:"btn-group",style:{display:"flex",justifyContent:"space-around"},children:[(n||i)&&e.jsx(y,{style:b,disabled:t||m||!n,onClick:c(l,l-1),uiSchema:h,registry:p}),(n||i)&&e.jsx(v,{style:b,disabled:t||m||!i,onClick:c(l,l+1),uiSchema:h,registry:p}),s&&e.jsx(g,{style:b,disabled:t||m,onClick:d(l),uiSchema:h,registry:p}),o&&e.jsx(S,{style:b,disabled:t||m,onClick:u(l),uiSchema:h,registry:p})]})})]})}var te=["key"];function ae(r){var a=r.canAdd,i=r.className,n=r.disabled,o=r.idSchema,s=r.uiSchema,l=r.items,d=r.onAddClick,u=r.readonly,c=r.registry,m=r.required,p=r.schema,h=r.title,f=t.getUiOptions(s),g=t.getTemplate("ArrayFieldDescriptionTemplate",c,f),v=t.getTemplate("ArrayFieldItemTemplate",c,f),y=t.getTemplate("ArrayFieldTitleTemplate",c,f),S=c.templates.ButtonTemplates.AddButton;return e.jsxs("fieldset",{className:i,id:o.$id,children:[e.jsx(y,{idSchema:o,title:f.title||h,required:m,schema:p,uiSchema:s,registry:c}),e.jsx(g,{idSchema:o,description:f.description||p.description,schema:p,uiSchema:s,registry:c}),e.jsx("div",{className:"row array-item-list",children:l&&l.map((function(r){var t=r.key,a=N(r,te);return e.jsx(v,T({},a),t)}))}),a&&e.jsx(S,{className:"array-item-add",onClick:d,disabled:n||u,uiSchema:s,registry:c})]})}function ie(r){var a=r.idSchema,i=r.title,n=r.schema,o=r.uiSchema,s=r.required,l=r.registry,d=t.getUiOptions(o,l.globalUiOptions),u=d.label;if(!i||void 0!==u&&!u)return null;var c=t.getTemplate("TitleFieldTemplate",l,d);return e.jsx(c,{id:t.titleId(a),title:i,required:s,schema:n,uiSchema:o,registry:l})}var ne=["id","name","value","readonly","disabled","autofocus","onBlur","onFocus","onChange","onChangeOverride","options","schema","uiSchema","formContext","registry","rawErrors","type","hideLabel","hideError"];function oe(a){var i=a.id,n=a.value,o=a.readonly,s=a.disabled,l=a.autofocus,d=a.onBlur,u=a.onFocus,c=a.onChange,m=a.onChangeOverride,p=a.options,h=a.schema,f=a.type,g=N(a,ne);if(!i)throw console.log("No id for",a),new Error("no id for props "+JSON.stringify(a));var v,y=T({},g,t.getInputProps(h,f,p));v="number"===y.type||"integer"===y.type?n||0===n?n:"":null==n?"":n;var S=r.useCallback((function(e){var r=e.target.value;return c(""===r?p.emptyValue:r)}),[c,p]),b=r.useCallback((function(e){return d(i,e.target.value)}),[d,i]),x=r.useCallback((function(e){return u(i,e.target.value)}),[u,i]);return e.jsxs(e.Fragment,{children:[e.jsx("input",T({id:i,name:i,className:"form-control",readOnly:o,disabled:s,autoFocus:l,value:v},y,{list:h.examples?t.examplesId(i):void 0,onChange:m||S,onBlur:b,onFocus:x,"aria-describedby":t.ariaDescribedByIds(i,!!h.examples)})),Array.isArray(h.examples)&&e.jsx("datalist",{id:t.examplesId(i),children:h.examples.concat(h.default&&!h.examples.includes(h.default)?[h.default]:[]).map((function(r){return e.jsx("option",{value:r},r)}))},"datalist_"+i)]})}function se(r){var a=t.getSubmitButtonOptions(r.uiSchema),i=a.props,n=void 0===i?{}:i;return a.norender?null:e.jsx("div",{children:e.jsx("button",T({type:"submit"},n,{className:"btn btn-info "+(n.className||""),children:a.submitText}))})}var le=["iconType","icon","className","uiSchema","registry"];function de(r){var t=r.iconType,a=void 0===t?"default":t,i=r.icon,n=r.className,o=N(r,le);return e.jsx("button",T({type:"button",className:"btn btn-"+a+" "+n},o,{children:e.jsx("i",{className:"glyphicon glyphicon-"+i})}))}function ue(r){return e.jsx(de,T({title:(0,r.registry.translateString)(t.TranslatableString.CopyButton),className:"array-item-copy"},r,{icon:"copy"}))}function ce(r){return e.jsx(de,T({title:(0,r.registry.translateString)(t.TranslatableString.MoveDownButton),className:"array-item-move-down"},r,{icon:"arrow-down"}))}function me(r){return e.jsx(de,T({title:(0,r.registry.translateString)(t.TranslatableString.MoveUpButton),className:"array-item-move-up"},r,{icon:"arrow-up"}))}function pe(r){return e.jsx(de,T({title:(0,r.registry.translateString)(t.TranslatableString.RemoveButton),className:"array-item-remove"},r,{iconType:"danger",icon:"remove"}))}function he(r){var a=r.onClick,i=r.disabled,n=r.registry;return e.jsx("div",{className:"row",children:e.jsx("p",{className:"col-xs-3 col-xs-offset-9 text-right "+r.className,children:e.jsx(de,{iconType:"info",icon:"plus",className:"btn-add col-xs-12",title:(0,n.translateString)(t.TranslatableString.AddButton),onClick:a,disabled:i,registry:n})})})}function fe(r){var t=r.description;return t?e.jsx("string"==typeof t?"p":"div",{id:r.id,className:"field-description",children:t}):null}function ge(r){var a=r.errors;return e.jsxs("div",{className:"panel panel-danger errors",children:[e.jsx("div",{className:"panel-heading",children:e.jsx("h3",{className:"panel-title",children:(0,r.registry.translateString)(t.TranslatableString.ErrorsLabel)})}),e.jsx("ul",{className:"list-group",children:a.map((function(r,t){return e.jsx("li",{className:"list-group-item text-danger",children:r.stack},t)}))})]})}var ve="*";function ye(r){var t=r.label;return t?e.jsxs("label",{className:"control-label",htmlFor:r.id,children:[t,r.required&&e.jsx("span",{className:"required",children:ve})]}):null}function Se(r){var a=r.id,i=r.label,n=r.children,o=r.errors,s=r.help,l=r.description,d=r.hidden,u=r.required,c=r.displayLabel,m=r.registry,p=t.getUiOptions(r.uiSchema),h=t.getTemplate("WrapIfAdditionalTemplate",m,p);return d?e.jsx("div",{className:"hidden",children:n}):e.jsxs(h,T({},r,{children:[c&&e.jsx(ye,{label:i,required:u,id:a}),c&&l?l:null,n,o,s]}))}function be(r){var a=r.errors,i=void 0===a?[]:a;if(0===i.length)return null;var n=t.errorId(r.idSchema);return e.jsx("div",{children:e.jsx("ul",{id:n,className:"error-detail bs-callout bs-callout-info",children:i.filter((function(e){return!!e})).map((function(r,t){return e.jsx("li",{className:"text-danger",children:r},t)}))})})}function xe(r){var a=r.help;if(!a)return null;var i=t.helpId(r.idSchema);return e.jsx("string"==typeof a?"p":"div",{id:i,className:"help-block",children:a})}function Ce(r){var a=r.description,i=r.disabled,n=r.formData,o=r.idSchema,s=r.onAddClick,l=r.properties,d=r.readonly,u=r.registry,c=r.required,m=r.schema,p=r.title,h=r.uiSchema,f=t.getUiOptions(h),g=t.getTemplate("TitleFieldTemplate",u,f),v=t.getTemplate("DescriptionFieldTemplate",u,f),y=u.templates.ButtonTemplates.AddButton;return e.jsxs("fieldset",{id:o.$id,children:[p&&e.jsx(g,{id:t.titleId(o),title:p,required:c,schema:m,uiSchema:h,registry:u}),a&&e.jsx(v,{id:t.descriptionId(o),description:a,schema:m,uiSchema:h,registry:u}),l.map((function(e){return e.content})),t.canExpand(m,h,n)&&e.jsx(y,{className:"object-property-expand",onClick:s(m),disabled:i||d,uiSchema:h,registry:u})]})}var Fe="*";function je(r){return e.jsxs("legend",{id:r.id,children:[r.title,r.required&&e.jsx("span",{className:"required",children:Fe})]})}function Oe(r){var a=r.schema,i=r.idSchema,n=r.reason,o=r.registry.translateString,s=t.TranslatableString.UnsupportedField,l=[];return i&&i.$id&&(s=t.TranslatableString.UnsupportedFieldWithId,l.push(i.$id)),n&&(s=s===t.TranslatableString.UnsupportedField?t.TranslatableString.UnsupportedFieldWithReason:t.TranslatableString.UnsupportedFieldWithIdAndReason,l.push(n)),e.jsxs("div",{className:"unsupported-field",children:[e.jsx("p",{children:e.jsx(O.default,{children:o(s,l)})}),a&&e.jsx("pre",{children:JSON.stringify(a,null,2)})]})}function De(r){var a=r.id,i=r.classNames,n=r.style,o=r.disabled,s=r.label,l=r.onKeyChange,d=r.onDropPropertyClick,u=r.readonly,c=r.required,m=r.schema,p=r.children,h=r.uiSchema,f=r.registry,g=f.templates.ButtonTemplates.RemoveButton,v=(0,f.translateString)(t.TranslatableString.KeyLabel,[s]);return e.jsx("div",t.ADDITIONAL_PROPERTY_FLAG in m?{className:i,style:n,children:e.jsxs("div",{className:"row",children:[e.jsx("div",{className:"col-xs-5 form-additional",children:e.jsxs("div",{className:"form-group",children:[e.jsx(ye,{label:v,required:c,id:a+"-key"}),e.jsx("input",{className:"form-control",type:"text",id:a+"-key",onBlur:function(e){return l(e.target.value)},defaultValue:s})]})}),e.jsx("div",{className:"form-additional form-group col-xs-5",children:p}),e.jsx("div",{className:"col-xs-2",children:e.jsx(g,{className:"array-item-remove btn-block",style:{border:"0"},disabled:o||u,onClick:d(s),uiSchema:h,registry:f})})]})}:{className:i,style:n,children:p})}function Te(e,r){for(var a=[],i=e;i<=r;i++)a.push({value:i,label:t.pad(i,2)});return a}function Ee(e,r,t){void 0===t&&(t=[1900,(new Date).getFullYear()+2]);var a=[{type:"year",range:t,value:e.year},{type:"month",range:[1,12],value:e.month},{type:"day",range:[1,31],value:e.day}];return r&&a.push({type:"hour",range:[0,23],value:e.hour},{type:"minute",range:[0,59],value:e.minute},{type:"second",range:[0,59],value:e.second}),a}function Ie(r){var a=r.type,i=r.range,n=r.value,o=r.select,s=r.rootId,l=r.disabled,d=r.readonly,u=r.autofocus,c=r.registry,m=r.onBlur,p=r.onFocus;return e.jsx(c.widgets.SelectWidget,{schema:{type:"integer"},id:s+"_"+a,name:r.name,className:"form-control",options:{enumOptions:Te(i[0],i[1])},placeholder:a,value:n,disabled:l,readonly:d,autofocus:u,onChange:function(e){return o(a,e)},onBlur:m,onFocus:p,registry:c,label:"","aria-describedby":t.ariaDescribedByIds(s)})}function Ne(a){var i=a.time,n=void 0!==i&&i,o=a.disabled,s=void 0!==o&&o,l=a.readonly,d=void 0!==l&&l,u=a.autofocus,c=void 0!==u&&u,m=a.options,p=a.id,h=a.name,f=a.registry,g=a.onBlur,v=a.onFocus,y=a.onChange,S=a.value,b=f.translateString,x=r.useState(S),C=x[0],F=x[1],j=r.useReducer((function(e,r){return T({},e,r)}),t.parseDateString(S,n)),O=j[0],D=j[1];r.useEffect((function(){var e=t.toDateString(O,n);!function(e){return Object.values(e).every((function(e){return-1!==e}))}(O)||e===S?C!==S&&(F(S),D(t.parseDateString(S,n))):y(e)}),[n,S,y,O,C]);var E=r.useCallback((function(e,r){var t;D(((t={})[e]=r,t))}),[]),I=r.useCallback((function(e){if(e.preventDefault(),!s&&!d){var r=t.parseDateString((new Date).toJSON(),n);y(t.toDateString(r,n))}}),[s,d,n]),N=r.useCallback((function(e){e.preventDefault(),s||d||y(void 0)}),[s,d,y]);return e.jsxs("ul",{className:"list-inline",children:[Ee(O,n,m.yearsRange).map((function(r,t){return e.jsx("li",{className:"list-inline-item",children:e.jsx(Ie,T({rootId:p,name:h,select:E},r,{disabled:s,readonly:d,registry:f,onBlur:g,onFocus:v,autofocus:c&&0===t}))},t)})),("undefined"===m.hideNowButton||!m.hideNowButton)&&e.jsx("li",{className:"list-inline-item",children:e.jsx("a",{href:"#",className:"btn btn-info btn-now",onClick:I,children:b(t.TranslatableString.NowLabel)})}),("undefined"===m.hideClearButton||!m.hideClearButton)&&e.jsx("li",{className:"list-inline-item",children:e.jsx("a",{href:"#",className:"btn btn-warning btn-clear",onClick:N,children:b(t.TranslatableString.ClearLabel)})})]})}var ke=["time"];function we(r){var t=r.time,a=void 0===t||t,i=N(r,ke);return e.jsx(i.registry.widgets.AltDateWidget,T({time:a},i))}function Ae(a){var i,n=a.schema,o=a.uiSchema,s=a.options,l=a.id,d=a.value,u=a.disabled,c=a.readonly,m=a.label,p=a.hideLabel,h=a.autofocus,f=void 0!==h&&h,g=a.onBlur,v=a.onFocus,y=a.onChange,S=a.registry,b=t.getTemplate("DescriptionFieldTemplate",S,s),x=t.schemaRequiresTrueValue(n),C=r.useCallback((function(e){return y(e.target.checked)}),[y]),F=r.useCallback((function(e){return g(l,e.target.checked)}),[g,l]),j=r.useCallback((function(e){return v(l,e.target.checked)}),[v,l]),O=null!=(i=s.description)?i:n.description;return e.jsxs("div",{className:"checkbox "+(u||c?"disabled":""),children:[!p&&!!O&&e.jsx(b,{id:t.descriptionId(l),description:O,schema:n,uiSchema:o,registry:S}),e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",id:l,name:l,checked:void 0!==d&&d,required:x,disabled:u||c,autoFocus:f,onChange:C,onBlur:F,onFocus:j,"aria-describedby":t.ariaDescribedByIds(l)}),t.labelValue(e.jsx("span",{children:m}),p)]})]})}function Be(a){var i=a.id,n=a.disabled,o=a.options,s=o.inline,l=void 0!==s&&s,d=o.enumOptions,u=o.enumDisabled,c=o.emptyValue,m=a.value,p=a.autofocus,h=void 0!==p&&p,f=a.readonly,g=a.onChange,v=a.onBlur,y=a.onFocus,S=Array.isArray(m)?m:[m],b=r.useCallback((function(e){return v(i,t.enumOptionsValueForIndex(e.target.value,d,c))}),[v,i]),x=r.useCallback((function(e){return y(i,t.enumOptionsValueForIndex(e.target.value,d,c))}),[y,i]);return e.jsx("div",{className:"checkboxes",id:i,children:Array.isArray(d)&&d.map((function(r,a){var o=t.enumOptionsIsSelected(r.value,S),s=Array.isArray(u)&&-1!==u.indexOf(r.value),c=n||s||f?"disabled":"",m=e.jsxs("span",{children:[e.jsx("input",{type:"checkbox",id:t.optionId(i,a),name:i,checked:o,value:String(a),disabled:n||s||f,autoFocus:h&&0===a,onChange:function(e){g(e.target.checked?t.enumOptionsSelectValue(a,S,d):t.enumOptionsDeselectValue(a,S,d))},onBlur:b,onFocus:x,"aria-describedby":t.ariaDescribedByIds(i)}),e.jsx("span",{children:r.label})]});return l?e.jsx("label",{className:"checkbox-inline "+c,children:m},a):e.jsx("div",{className:"checkbox "+c,children:e.jsx("label",{children:m})},a)}))})}function Ue(r){var a=r.disabled,i=r.readonly,n=t.getTemplate("BaseInputTemplate",r.registry,r.options);return e.jsx(n,T({type:"color"},r,{disabled:a||i}))}function _e(a){var i=a.onChange,n=t.getTemplate("BaseInputTemplate",a.registry,a.options),o=r.useCallback((function(e){return i(e||void 0)}),[i]);return e.jsx(n,T({type:"date"},a,{onChange:o}))}function Pe(r){var a=r.onChange,i=r.value,n=t.getTemplate("BaseInputTemplate",r.registry,r.options);return e.jsx(n,T({type:"datetime-local"},r,{value:t.utcToLocal(i),onChange:function(e){return a(t.localToUTC(e))}}))}function qe(r){var a=t.getTemplate("BaseInputTemplate",r.registry,r.options);return e.jsx(a,T({type:"email"},r))}function Re(e,r){return null===e?null:e.replace(";base64",";name="+encodeURIComponent(r)+";base64")}function Le(e){var r=e.name,t=e.size,a=e.type;return new Promise((function(i,n){var o=new window.FileReader;o.onerror=n,o.onload=function(e){var n;"string"==typeof(null===(n=e.target)||void 0===n?void 0:n.result)?i({dataURL:Re(e.target.result,r),name:r,size:t,type:a}):i({dataURL:null,name:r,size:t,type:a})},o.readAsDataURL(e)}))}function Ve(r){var a=r.fileInfo,i=r.registry.translateString,n=a.dataURL,o=a.name;return n?-1!==a.type.indexOf("image")?e.jsx("img",{src:n,style:{maxWidth:"100%"},className:"file-preview"}):e.jsxs(e.Fragment,{children:[" ",e.jsx("a",{download:"preview-"+o,href:n,className:"file-download",children:i(t.TranslatableString.PreviewLabel)})]}):null}function Ke(r){var a=r.filesInfo,i=r.registry,n=r.preview;if(0===a.length)return null;var o=i.translateString;return e.jsx("ul",{className:"file-info",children:a.map((function(r,a){return e.jsxs("li",{children:[e.jsx(O.default,{children:o(t.TranslatableString.FilesInfo,[r.name,r.type,String(r.size)])}),n&&e.jsx(Ve,{fileInfo:r,registry:i})]},a)}))})}function Me(e){return e.filter((function(e){return e})).map((function(e){var r=t.dataURItoBlob(e),a=r.blob;return{dataURL:e,name:r.name,size:a.size,type:a.type}}))}function We(a){var i=a.disabled,n=a.readonly,o=a.required,s=a.multiple,l=a.onChange,d=a.value,u=a.options,c=a.registry,m=t.getTemplate("BaseInputTemplate",c,u),p=r.useState(Array.isArray(d)?Me(d):Me([d])),h=p[0],f=p[1],g=r.useCallback((function(e){var r;e.target.files&&(r=e.target.files,Promise.all(Array.from(r).map(Le))).then((function(e){var r=e.map((function(e){return e.dataURL}));s?(f(h.concat(e[0])),l(d.concat(r[0]))):(f(e),l(r[0]))}))}),[s,d,h,l]);return e.jsxs("div",{children:[e.jsx(m,T({},a,{disabled:i||n,type:"file",required:!d&&o,onChangeOverride:g,value:"",accept:u.accept?String(u.accept):void 0})),e.jsx(Ke,{filesInfo:h,registry:c,preview:u.filePreview})]})}function Ye(r){var t=r.id,a=r.value;return e.jsx("input",{type:"hidden",id:t,name:t,value:void 0===a?"":a})}function $e(r){var a=t.getTemplate("BaseInputTemplate",r.registry,r.options);return e.jsx(a,T({type:"password"},r))}function ze(a){var i=a.options,n=a.value,o=a.required,s=a.disabled,l=a.readonly,d=a.autofocus,u=void 0!==d&&d,c=a.onBlur,m=a.onFocus,p=a.onChange,h=a.id,f=i.enumOptions,g=i.enumDisabled,v=i.inline,y=i.emptyValue,S=r.useCallback((function(e){return c(h,t.enumOptionsValueForIndex(e.target.value,f,y))}),[c,h]),b=r.useCallback((function(e){return m(h,t.enumOptionsValueForIndex(e.target.value,f,y))}),[m,h]);return e.jsx("div",{className:"field-radio-group",id:h,children:Array.isArray(f)&&f.map((function(r,a){var i=t.enumOptionsIsSelected(r.value,n),d=Array.isArray(g)&&-1!==g.indexOf(r.value),c=s||d||l?"disabled":"",m=e.jsxs("span",{children:[e.jsx("input",{type:"radio",id:t.optionId(h,a),checked:i,name:h,required:o,value:String(a),disabled:s||d||l,autoFocus:u&&0===a,onChange:function(){return p(r.value)},onBlur:S,onFocus:b,"aria-describedby":t.ariaDescribedByIds(h)}),e.jsx("span",{children:r.label})]});return v?e.jsx("label",{className:"radio-inline "+c,children:m},a):e.jsx("div",{className:"radio "+c,children:e.jsx("label",{children:m})},a)}))})}function Ge(r){var t=r.value;return e.jsxs("div",{className:"field-range-wrapper",children:[e.jsx(r.registry.templates.BaseInputTemplate,T({type:"range"},r)),e.jsx("span",{className:"range-view",children:t})]})}function He(e,r){return r?Array.from(e.target.options).slice().filter((function(e){return e.selected})).map((function(e){return e.value})):e.target.value}function Je(a){var i=a.schema,n=a.id,o=a.options,s=a.value,l=a.required,d=a.disabled,u=a.readonly,c=a.multiple,m=void 0!==c&&c,p=a.autofocus,h=void 0!==p&&p,f=a.onChange,g=a.onBlur,v=a.onFocus,y=a.placeholder,S=o.enumOptions,b=o.enumDisabled,x=o.emptyValue,C=m?[]:"",F=r.useCallback((function(e){var r=He(e,m);return v(n,t.enumOptionsValueForIndex(r,S,x))}),[v,n,i,m,o]),j=r.useCallback((function(e){var r=He(e,m);return g(n,t.enumOptionsValueForIndex(r,S,x))}),[g,n,i,m,o]),O=r.useCallback((function(e){var r=He(e,m);return f(t.enumOptionsValueForIndex(r,S,x))}),[f,i,m,o]),D=t.enumOptionsIndexForValue(s,S,m);return e.jsxs("select",{id:n,name:n,multiple:m,className:"form-control",value:void 0===D?C:D,required:l,disabled:d||u,autoFocus:h,onBlur:j,onFocus:F,onChange:O,"aria-describedby":t.ariaDescribedByIds(n),children:[!m&&void 0===i.default&&e.jsx("option",{value:"",children:y}),Array.isArray(S)&&S.map((function(r,t){var a=r.label,i=b&&-1!==b.indexOf(r.value);return e.jsx("option",{value:String(t),disabled:i,children:a},t)}))]})}function Qe(a){var i=a.id,n=a.options,o=void 0===n?{}:n,s=a.placeholder,l=a.value,d=a.required,u=a.disabled,c=a.readonly,m=a.autofocus,p=void 0!==m&&m,h=a.onChange,f=a.onBlur,g=a.onFocus,v=r.useCallback((function(e){var r=e.target.value;return h(""===r?o.emptyValue:r)}),[h,o.emptyValue]),y=r.useCallback((function(e){return f(i,e.target.value)}),[f,i]),S=r.useCallback((function(e){return g(i,e.target.value)}),[i,g]);return e.jsx("textarea",{id:i,name:i,className:"form-control",value:l||"",placeholder:s,required:d,disabled:u,readOnly:c,autoFocus:p,rows:o.rows,onBlur:y,onFocus:S,onChange:v,"aria-describedby":t.ariaDescribedByIds(i)})}function Xe(r){var a=t.getTemplate("BaseInputTemplate",r.registry,r.options);return e.jsx(a,T({},r))}function Ze(a){var i=a.onChange,n=t.getTemplate("BaseInputTemplate",a.registry,a.options),o=r.useCallback((function(e){return i(e?e+":00":void 0)}),[i]);return e.jsx(n,T({type:"time"},a,{onChange:o}))}function er(r){var a=t.getTemplate("BaseInputTemplate",r.registry,r.options);return e.jsx(a,T({type:"url"},r))}function rr(r){var a=t.getTemplate("BaseInputTemplate",r.registry,r.options);return e.jsx(a,T({type:"number"},r))}function tr(){return{fields:{AnyOfField:K,ArrayField:P,BooleanField:R,NumberField:Y,ObjectField:$,OneOfField:K,SchemaField:J,StringField:X,NullField:Z},templates:{ArrayFieldDescriptionTemplate:ee,ArrayFieldItemTemplate:re,ArrayFieldTemplate:ae,ArrayFieldTitleTemplate:ie,ButtonTemplates:{SubmitButton:se,AddButton:he,CopyButton:ue,MoveDownButton:ce,MoveUpButton:me,RemoveButton:pe},BaseInputTemplate:oe,DescriptionFieldTemplate:fe,ErrorListTemplate:ge,FieldTemplate:Se,FieldErrorTemplate:be,FieldHelpTemplate:xe,ObjectFieldTemplate:Ce,TitleFieldTemplate:je,UnsupportedFieldTemplate:Oe,WrapIfAdditionalTemplate:De},widgets:{AltDateWidget:Ne,AltDateTimeWidget:we,CheckboxWidget:Ae,CheckboxesWidget:Be,ColorWidget:Ue,DateWidget:_e,DateTimeWidget:Pe,EmailWidget:qe,FileWidget:We,HiddenWidget:Ye,PasswordWidget:$e,RadioWidget:ze,RangeWidget:Ge,SelectWidget:Je,TextWidget:Xe,TextareaWidget:Qe,TimeWidget:Ze,UpDownWidget:rr,URLWidget:er},rootSchema:{},formContext:{},translateString:t.englishStringTranslator}}Qe.defaultProps={autofocus:!1,options:{}};var ar=function(a){function i(e){var i;if((i=a.call(this,e)||this).formElement=void 0,i.getUsedFormData=function(e,r){if(0===r.length&&"object"!=typeof e)return e;var t=y.default(e,r);return Array.isArray(e)?Object.keys(t).map((function(e){return t[e]})):t},i.getFieldNames=function(e,r){return function e(a,i,n){return void 0===i&&(i=[]),void 0===n&&(n=[[]]),Object.keys(a).forEach((function(o){if("object"==typeof a[o]){var s=n.map((function(e){return[].concat(e,[o])}));a[o][t.RJSF_ADDITONAL_PROPERTIES_FLAG]&&""!==a[o][t.NAME_KEY]?i.push(a[o][t.NAME_KEY]):e(a[o],i,s)}else o===t.NAME_KEY&&""!==a[o]&&n.forEach((function(e){var t=g.default(r,e);("object"!=typeof t||v.default(t))&&i.push(e)}))})),i}(e)},i.onChange=function(e,r,a){var n=i.props,o=n.extraErrors,s=n.omitExtraData,l=n.liveOmit,d=n.noValidate,u=n.liveValidate,c=n.onChange,m=i.state,p=m.schemaUtils,h=m.schema;(t.isObject(e)||Array.isArray(e))&&(e=i.getStateFromProps(i.props,e).formData);var f=!d&&u,g={formData:e,schema:h},v=e;if(!0===s&&!0===l){var y=p.retrieveSchema(h,e),S=p.toPathSchema(y,"",e),b=i.getFieldNames(S,e);v=i.getUsedFormData(e,b),g={formData:v}}if(f){var x=i.validate(v),C=x.errors,F=x.errorSchema,j=C,O=F;if(o){var D=t.validationDataMerge(x,o);F=D.errorSchema,C=D.errors}g={formData:v,errors:C,errorSchema:F,schemaValidationErrors:j,schemaValidationErrorSchema:O}}else if(!d&&r){var E=o?t.mergeObjects(r,o,"preventDuplicates"):r;g={formData:v,errorSchema:E,errors:t.toErrorList(E)}}i.setState(g,(function(){return c&&c(T({},i.state,g),a)}))},i.reset=function(){var e=i.props.onChange,r={formData:i.getStateFromProps(i.props,void 0).formData,errorSchema:{},errors:[],schemaValidationErrors:[],schemaValidationErrorSchema:{}};i.setState(r,(function(){return e&&e(T({},i.state,r))}))},i.onBlur=function(e,r){var t=i.props.onBlur;t&&t(e,r)},i.onFocus=function(e,r){var t=i.props.onFocus;t&&t(e,r)},i.onSubmit=function(e){if(e.preventDefault(),e.target===e.currentTarget){e.persist();var r=i.props,a=r.extraErrors,n=r.noValidate,o=r.onSubmit,s=i.state.formData,l=i.state,d=l.schemaUtils;if(!0===r.omitExtraData){var u=d.retrieveSchema(l.schema,s),c=d.toPathSchema(u,"",s),m=i.getFieldNames(c,s);s=i.getUsedFormData(s,m)}if(n||i.validateForm()){var p=a||{},h=a?t.toErrorList(a):[];i.setState({formData:s,errors:h,errorSchema:p,schemaValidationErrors:[],schemaValidationErrorSchema:{}},(function(){o&&o(T({},i.state,{formData:s,status:"submitted"}),e)}))}}},!e.validator)throw new Error("A validator is required for Form functionality to work");return i.state=i.getStateFromProps(e,e.formData),i.props.onChange&&!t.deepEquals(i.state.formData,i.props.formData)&&i.props.onChange(i.state),i.formElement=r.createRef(),i}E(i,a);var n=i.prototype;return n.UNSAFE_componentWillReceiveProps=function(e){var r=this.getStateFromProps(e,e.formData);t.deepEquals(r.formData,e.formData)||t.deepEquals(r.formData,this.state.formData)||!e.onChange||e.onChange(r),this.setState(r)},n.getStateFromProps=function(e,r){var a=this.state||{},i="schema"in e?e.schema:this.props.schema,n=("uiSchema"in e?e.uiSchema:this.props.uiSchema)||{},o=void 0!==r,s=o&&!e.noValidate&&("liveValidate"in e?e.liveValidate:this.props.liveValidate),l=i,d="experimental_defaultFormStateBehavior"in e?e.experimental_defaultFormStateBehavior:this.props.experimental_defaultFormStateBehavior,u=a.schemaUtils;u&&!u.doesSchemaUtilsDiffer(e.validator,l,d)||(u=t.createSchemaUtils(e.validator,l,d));var c,m,p=u.getDefaultFormState(i,r),h=u.retrieveSchema(i,p),f=a.schemaValidationErrors,g=a.schemaValidationErrorSchema;if(s){var v=this.validate(p,i,u);f=c=v.errors,g=m=v.errorSchema}else{var y=e.noValidate?{errors:[],errorSchema:{}}:e.liveValidate?{errors:a.errors||[],errorSchema:a.errorSchema||{}}:{errors:a.schemaValidationErrors||[],errorSchema:a.schemaValidationErrorSchema||{}};c=y.errors,m=y.errorSchema}if(e.extraErrors){var S=t.validationDataMerge({errorSchema:m,errors:c},e.extraErrors);m=S.errorSchema,c=S.errors}var b=u.toIdSchema(h,n["ui:rootFieldId"],p,e.idPrefix,e.idSeparator);return{schemaUtils:u,schema:i,uiSchema:n,idSchema:b,formData:p,edit:o,errors:c,errorSchema:m,schemaValidationErrors:f,schemaValidationErrorSchema:g}},n.shouldComponentUpdate=function(e,r){return t.shouldRender(this,e,r)},n.validate=function(e,r,t){void 0===r&&(r=this.props.schema);var a=t||this.state.schemaUtils,i=this.props,n=i.customValidate,o=i.transformErrors,s=i.uiSchema,l=a.retrieveSchema(r,e);return a.getValidator().validateFormData(e,l,n,o,s)},n.renderErrors=function(r){var a=this.state,i=a.errors,n=a.errorSchema,o=a.schema,s=a.uiSchema,l=this.props.formContext,d=t.getUiOptions(s),u=t.getTemplate("ErrorListTemplate",r,d);return i&&i.length?e.jsx(u,{errors:i,errorSchema:n||{},schema:o,uiSchema:s,formContext:l,registry:r}):null},n.getRegistry=function(){var e,r=this.props,a=r.translateString,i=r.uiSchema,n=void 0===i?{}:i,o=this.state.schemaUtils,s=tr(),l=s.templates,d=s.widgets,u=s.formContext,c=s.translateString;return{fields:T({},s.fields,this.props.fields),templates:T({},l,this.props.templates,{ButtonTemplates:T({},l.ButtonTemplates,null===(e=this.props.templates)||void 0===e?void 0:e.ButtonTemplates)}),widgets:T({},d,this.props.widgets),rootSchema:this.props.schema,formContext:this.props.formContext||u,schemaUtils:o,translateString:a||c,globalUiOptions:n[t.UI_GLOBAL_OPTIONS_KEY]}},n.submit=function(){this.formElement.current&&(this.formElement.current.dispatchEvent(new CustomEvent("submit",{cancelable:!0})),this.formElement.current.requestSubmit())},n.focusOnError=function(e){var r=this.props,t=r.idPrefix,a=void 0===t?"root":t,i=r.idSeparator,n=void 0===i?"_":i,o=S.default(e.property);""===o[0]?o[0]=a:o.unshift(a);var s=o.join(n),l=this.formElement.current.elements[s];l||(l=this.formElement.current.querySelector("input[id^="+s)),l&&l.length&&(l=l[0]),l&&l.focus()},n.validateForm=function(){var e=this.props,r=e.extraErrors,a=e.focusOnFirstError,i=e.onError,n=this.validate(this.state.formData),o=n.errors,s=n.errorSchema,l=o,d=s;if(o.length>0){if(r){var u=t.validationDataMerge(n,r);s=u.errorSchema,o=u.errors}return a&&("function"==typeof a?a(n.errors[0]):this.focusOnError(n.errors[0])),this.setState({errors:o,errorSchema:s,schemaValidationErrors:l,schemaValidationErrorSchema:d},(function(){i?i(o):console.error("Form validation failed",o)})),!1}return!0},n.render=function(){var r,a,i=this.props,n=i.children,o=i.id,s=i.idPrefix,l=i.idSeparator,d=i.className,u=void 0===d?"":d,c=i.tagName,m=i.name,p=i.method,h=i.target,f=i.action,g=i.autoComplete,v=i.enctype,y=i.acceptcharset,S=i.noHtml5Validate,b=void 0!==S&&S,x=i.disabled,C=void 0!==x&&x,F=i.readonly,j=void 0!==F&&F,O=i.formContext,D=i.showErrorList,E=void 0===D?"top":D,I=i._internalFormWrapper,N=this.state,k=N.schema,w=N.uiSchema,A=N.formData,B=N.errorSchema,U=N.idSchema,_=this.getRegistry(),P=_.fields.SchemaField,q=_.templates.ButtonTemplates.SubmitButton,R=I?c:void 0,L=I||c||"form",V=t.getUiOptions(w)[t.SUBMIT_BTN_OPTIONS_KEY],K=void 0===V?{}:V;C&&(K=T({},K,{props:T({},K.props,{disabled:!0})}));var M=((a={})[t.UI_OPTIONS_KEY]=((r={})[t.SUBMIT_BTN_OPTIONS_KEY]=K,r),a);return e.jsxs(L,{className:u||"rjsf",id:o,name:m,method:p,target:h,action:f,autoComplete:g,encType:v,acceptCharset:y,noValidate:b,onSubmit:this.onSubmit,as:R,ref:this.formElement,children:["top"===E&&this.renderErrors(_),e.jsx(P,{name:"",schema:k,uiSchema:w,errorSchema:B,idSchema:U,idPrefix:s,idSeparator:l,formContext:O,formData:A,onChange:this.onChange,onBlur:this.onBlur,onFocus:this.onFocus,registry:_,disabled:C,readonly:j}),n||e.jsx(q,{uiSchema:M,registry:_}),"bottom"===E&&this.renderErrors(_)]})},i}(r.Component),ir=["fields","widgets","templates"];exports.default=ar,exports.getDefaultRegistry=tr,exports.withTheme=function(t){return r.forwardRef((function(r,a){var i,n,o=r.fields,s=r.widgets,l=r.templates,d=N(r,ir);return o=T({},null==t?void 0:t.fields,o),s=T({},null==t?void 0:t.widgets,s),l=T({},null==t?void 0:t.templates,l,{ButtonTemplates:T({},null==t||null===(i=t.templates)||void 0===i?void 0:i.ButtonTemplates,null===(n=l)||void 0===n?void 0:n.ButtonTemplates)}),e.jsx(ar,T({},t,d,{fields:o,widgets:s,templates:l,ref:a}))}))}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("@rjsf/utils"),a=require("lodash/get"),i=require("lodash/isEmpty"),s=require("lodash/pick"),o=require("lodash/toPath"),n=require("lodash/cloneDeep"),l=require("lodash/isObject"),d=require("lodash/set"),c=require("nanoid"),m=require("lodash/omit"),u=require("lodash/unset"),h=require("markdown-to-jsx"),p=require("lodash/has");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=g(a),y=g(i),S=g(s),b=g(o),x=g(n),v=g(l),C=g(d),F=g(m),j=g(u),D=g(h),O=g(p);function T(){return c.nanoid()}function E(e){return Array.isArray(e)?e.map((e=>({key:T(),item:e}))):[]}function I(e){return Array.isArray(e)?e.map((e=>e.item)):[]}class N extends t.Component{constructor(e){super(e),this._getNewFormDataRow=()=>{const{schema:e,registry:t}=this.props,{schemaUtils:a}=t;let i=e.items;return r.isFixedItems(e)&&r.allowAdditionalItems(e)&&(i=e.additionalItems),a.getDefaultFormState(i)},this.onAddClick=e=>{this._handleAddClick(e)},this.onAddIndexClick=e=>t=>{this._handleAddClick(t,e)},this.onCopyIndexClick=e=>t=>{t&&t.preventDefault();const{onChange:r}=this.props,{keyedFormData:a}=this.state,i={key:T(),item:x.default(a[e].item)},s=[...a];void 0!==e?s.splice(e+1,0,i):s.push(i),this.setState({keyedFormData:s,updatedKeyedFormData:!0},(()=>r(I(s))))},this.onDropIndexClick=e=>t=>{t&&t.preventDefault();const{onChange:r,errorSchema:a}=this.props,{keyedFormData:i}=this.state;let s;if(a){s={};for(const t in a){const r=parseInt(t);r<e?C.default(s,[r],a[t]):r>e&&C.default(s,[r-1],a[t])}}const o=i.filter(((t,r)=>r!==e));this.setState({keyedFormData:o,updatedKeyedFormData:!0},(()=>r(I(o),s)))},this.onReorderClick=(e,t)=>r=>{r&&(r.preventDefault(),r.currentTarget.blur());const{onChange:a,errorSchema:i}=this.props;let s;if(i){s={};for(const r in i){const a=parseInt(r);a==e?C.default(s,[t],i[e]):a==t?C.default(s,[e],i[t]):C.default(s,[r],i[a])}}const{keyedFormData:o}=this.state,n=function(){const r=o.slice();return r.splice(e,1),r.splice(t,0,o[e]),r}();this.setState({keyedFormData:n},(()=>a(I(n),s)))},this.onChangeForIndex=e=>(t,r,a)=>{const{formData:i,onChange:s,errorSchema:o}=this.props;s((Array.isArray(i)?i:[]).map(((r,a)=>e===a?void 0===t?null:t:r)),o&&o&&{...o,[e]:r},a)},this.onSelectChange=e=>{const{onChange:t,idSchema:r}=this.props;t(e,void 0,r&&r.$id)};const{formData:t=[]}=e,a=E(t);this.state={keyedFormData:a,updatedKeyedFormData:!1}}static getDerivedStateFromProps(e,t){if(t.updatedKeyedFormData)return{updatedKeyedFormData:!1};const r=Array.isArray(e.formData)?e.formData:[],a=t.keyedFormData||[];return{keyedFormData:r.length===a.length?a.map(((e,t)=>({key:e.key,item:r[t]}))):E(r)}}get itemTitle(){const{schema:e,registry:t}=this.props,{translateString:a}=t;return f.default(e,[r.ITEMS_KEY,"title"],f.default(e,[r.ITEMS_KEY,"description"],a(r.TranslatableString.ArrayItemTitle)))}isItemRequired(e){return Array.isArray(e.type)?!e.type.includes("null"):"null"!==e.type}canAddItem(e){const{schema:t,uiSchema:a,registry:i}=this.props;let{addable:s}=r.getUiOptions(a,i.globalUiOptions);return!1!==s&&(s=void 0===t.maxItems||e.length<t.maxItems),s}_handleAddClick(e,t){e&&e.preventDefault();const{onChange:r}=this.props,{keyedFormData:a}=this.state,i={key:T(),item:this._getNewFormDataRow()},s=[...a];void 0!==t?s.splice(t,0,i):s.push(i),this.setState({keyedFormData:s,updatedKeyedFormData:!0},(()=>r(I(s))))}render(){const{schema:t,uiSchema:a,idSchema:i,registry:s}=this.props,{schemaUtils:o,translateString:n}=s;if(!(r.ITEMS_KEY in t)){const o=r.getUiOptions(a),l=r.getTemplate("UnsupportedFieldTemplate",s,o);return e.jsx(l,{schema:t,idSchema:i,reason:n(r.TranslatableString.MissingItems),registry:s})}return o.isMultiSelect(t)?this.renderMultiSelect():r.isCustomWidget(a)?this.renderCustomWidget():r.isFixedItems(t)?this.renderFixedArray():o.isFilesArray(t,a)?this.renderFiles():this.renderNormalArray()}renderNormalArray(){const{schema:t,uiSchema:a={},errorSchema:i,idSchema:s,name:o,disabled:n=!1,readonly:l=!1,autofocus:d=!1,required:c=!1,registry:m,onBlur:u,onFocus:h,idPrefix:p,idSeparator:g="_",rawErrors:f}=this.props,{keyedFormData:y}=this.state,S=void 0===t.title?o:t.title,{schemaUtils:b,formContext:x}=m,C=r.getUiOptions(a),F=v.default(t.items)?t.items:{},j=b.retrieveSchema(F),D=I(this.state.keyedFormData),O=this.canAddItem(D),T={canAdd:O,items:y.map(((e,t)=>{const{key:r,item:n}=e,l=n,c=b.retrieveSchema(F,l),m=i?i[t]:void 0,S=b.toIdSchema(c,s.$id+g+t,l,p,g);return this.renderArrayFieldItem({key:r,index:t,name:o&&`${o}-${t}`,canAdd:O,canMoveUp:t>0,canMoveDown:t<D.length-1,itemSchema:c,itemIdSchema:S,itemErrorSchema:m,itemData:l,itemUiSchema:a.items,autofocus:d&&0===t,onBlur:u,onFocus:h,rawErrors:f,totalItems:y.length})})),className:`field field-array field-array-of-${j.type}`,disabled:n,idSchema:s,uiSchema:a,onAddClick:this.onAddClick,readonly:l,required:c,schema:t,title:S,formContext:x,formData:D,rawErrors:f,registry:m},E=r.getTemplate("ArrayFieldTemplate",m,C);return e.jsx(E,{...T})}renderCustomWidget(){const{schema:t,idSchema:a,uiSchema:i,disabled:s=!1,readonly:o=!1,autofocus:n=!1,required:l=!1,hideError:d,placeholder:c,onBlur:m,onFocus:u,formData:h=[],registry:p,rawErrors:g,name:f}=this.props,{widgets:y,formContext:S,globalUiOptions:b,schemaUtils:x}=p,{widget:v,title:C,...F}=r.getUiOptions(i,b),j=r.getWidget(t,v,y),D=C??t.title??f,O=x.getDisplayLabel(t,i,b);return e.jsx(j,{id:a.$id,name:f,multiple:!0,onChange:this.onSelectChange,onBlur:m,onFocus:u,options:F,schema:t,uiSchema:i,registry:p,value:h,disabled:s,readonly:o,hideError:d,required:l,label:D,hideLabel:!O,placeholder:c,formContext:S,autofocus:n,rawErrors:g})}renderMultiSelect(){const{schema:t,idSchema:a,uiSchema:i,formData:s=[],disabled:o=!1,readonly:n=!1,autofocus:l=!1,required:d=!1,placeholder:c,onBlur:m,onFocus:u,registry:h,rawErrors:p,name:g}=this.props,{widgets:f,schemaUtils:y,formContext:S,globalUiOptions:b}=h,x=y.retrieveSchema(t.items,s),v=r.optionsList(x),{widget:C="select",title:F,...j}=r.getUiOptions(i,b),D=r.getWidget(t,C,f),O=F??t.title??g,T=y.getDisplayLabel(t,i,b);return e.jsx(D,{id:a.$id,name:g,multiple:!0,onChange:this.onSelectChange,onBlur:m,onFocus:u,options:{...j,enumOptions:v},schema:t,uiSchema:i,registry:h,value:s,disabled:o,readonly:n,required:d,label:O,hideLabel:!T,placeholder:c,formContext:S,autofocus:l,rawErrors:p})}renderFiles(){const{schema:t,uiSchema:a,idSchema:i,name:s,disabled:o=!1,readonly:n=!1,autofocus:l=!1,required:d=!1,onBlur:c,onFocus:m,registry:u,formData:h=[],rawErrors:p}=this.props,{widgets:g,formContext:f,globalUiOptions:y,schemaUtils:S}=u,{widget:b="files",title:x,...v}=r.getUiOptions(a,y),C=r.getWidget(t,b,g),F=x??t.title??s,j=S.getDisplayLabel(t,a,y);return e.jsx(C,{options:v,id:i.$id,name:s,multiple:!0,onChange:this.onSelectChange,onBlur:c,onFocus:m,schema:t,uiSchema:a,value:h,disabled:o,readonly:n,required:d,registry:u,formContext:f,autofocus:l,rawErrors:p,label:F,hideLabel:!j})}renderFixedArray(){const{schema:t,uiSchema:a={},formData:i=[],errorSchema:s,idPrefix:o,idSeparator:n="_",idSchema:l,name:d,disabled:c=!1,readonly:m=!1,autofocus:u=!1,required:h=!1,registry:p,onBlur:g,onFocus:f,rawErrors:y}=this.props,{keyedFormData:S}=this.state;let{formData:b=[]}=this.props;const x=t.title||d,C=r.getUiOptions(a),{schemaUtils:F,formContext:j}=p,D=(v.default(t.items)?t.items:[]).map(((e,t)=>F.retrieveSchema(e,i[t]))),O=v.default(t.additionalItems)?F.retrieveSchema(t.additionalItems,i):null;(!b||b.length<D.length)&&(b=b||[],b=b.concat(new Array(D.length-b.length)));const T=this.canAddItem(b)&&!!O,E={canAdd:T,className:"field field-array field-array-fixed-items",disabled:c,idSchema:l,formData:i,items:S.map(((e,r)=>{const{key:i,item:c}=e,m=c,h=r>=D.length,p=h&&v.default(t.additionalItems)?F.retrieveSchema(t.additionalItems,m):D[r],x=F.toIdSchema(p,l.$id+n+r,m,o,n),C=h?a.additionalItems||{}:Array.isArray(a.items)?a.items[r]:a.items||{};return this.renderArrayFieldItem({key:i,index:r,name:d&&`${d}-${r}`,canAdd:T,canRemove:h,canMoveUp:r>=D.length+1,canMoveDown:h&&r<b.length-1,itemSchema:p,itemData:m,itemUiSchema:C,itemIdSchema:x,itemErrorSchema:s?s[r]:void 0,autofocus:u&&0===r,onBlur:g,onFocus:f,rawErrors:y,totalItems:S.length})})),onAddClick:this.onAddClick,readonly:m,required:h,registry:p,schema:t,uiSchema:a,title:x,formContext:j,rawErrors:y},I=r.getTemplate("ArrayFieldTemplate",p,C);return e.jsx(I,{...E})}renderArrayFieldItem(t){const{key:a,index:i,name:s,canAdd:o,canRemove:n=!0,canMoveUp:l,canMoveDown:d,itemSchema:c,itemData:m,itemUiSchema:u,itemIdSchema:h,itemErrorSchema:p,autofocus:g,onBlur:f,onFocus:y,rawErrors:S,totalItems:b}=t,{disabled:x,hideError:v,idPrefix:C,idSeparator:F,readonly:j,uiSchema:D,registry:O,formContext:T}=this.props,{fields:{ArraySchemaField:E,SchemaField:I},globalUiOptions:N}=O,A=E||I,{orderable:k=!0,removable:w=!0,copyable:B=!1}=r.getUiOptions(D,N),U={moveUp:k&&l,moveDown:k&&d,copy:B&&o,remove:w&&n,toolbar:!1};return U.toolbar=Object.keys(U).some((e=>U[e])),{children:e.jsx(A,{name:s,index:i,schema:c,uiSchema:u,formData:m,formContext:T,errorSchema:p,idPrefix:C,idSeparator:F,idSchema:h,required:this.isItemRequired(c),onChange:this.onChangeForIndex(i),onBlur:f,onFocus:y,registry:O,disabled:x,readonly:j,hideError:v,autofocus:g,rawErrors:S}),className:"array-item",disabled:x,canAdd:o,hasCopy:U.copy,hasToolbar:U.toolbar,hasMoveUp:U.moveUp,hasMoveDown:U.moveDown,hasRemove:U.remove,index:i,totalItems:b,key:a,onAddIndexClick:this.onAddIndexClick,onCopyIndexClick:this.onCopyIndexClick,onDropIndexClick:this.onDropIndexClick,onReorderClick:this.onReorderClick,readonly:j,registry:O,schema:c,uiSchema:u}}}function A(t){const{schema:a,name:i,uiSchema:s,idSchema:o,formData:n,registry:l,required:d,disabled:c,readonly:m,autofocus:u,onChange:h,onFocus:p,onBlur:g,rawErrors:f}=t,{title:y}=a,{widgets:S,formContext:b,translateString:x,globalUiOptions:C}=l,{widget:F="checkbox",title:j,label:D=!0,...O}=r.getUiOptions(s,C),T=r.getWidget(a,F,S),E=x(r.TranslatableString.YesLabel),I=x(r.TranslatableString.NoLabel);let N;const A=j??y??i;if(Array.isArray(a.oneOf))N=r.optionsList({oneOf:a.oneOf.map((e=>{if(v.default(e))return{...e,title:e.title||(!0===e.const?E:I)}})).filter((e=>e))});else{const e=a,t=a.enum??[!0,!1];N=!e.enumNames&&2===t.length&&t.every((e=>"boolean"==typeof e))?[{value:t[0],label:t[0]?E:I},{value:t[1],label:t[1]?E:I}]:r.optionsList({enum:t,enumNames:e.enumNames})}return e.jsx(T,{options:{...O,enumOptions:N},schema:a,uiSchema:s,id:o.$id,name:i,onChange:h,onFocus:p,onBlur:g,label:A,hideLabel:!D,value:n,required:d,disabled:c,readonly:m,registry:l,formContext:b,autofocus:u,rawErrors:f})}class k extends t.Component{constructor(e){super(e),this.onOptionChange=e=>{const{selectedOption:t,retrievedOptions:r}=this.state,{formData:a,onChange:i,registry:s}=this.props,{schemaUtils:o}=s,n=void 0!==e?parseInt(e,10):-1;if(n===t)return;const l=n>=0?r[n]:void 0;let d=o.sanitizeDataForNewSchema(l,t>=0?r[t]:void 0,a);d&&l&&(d=o.getDefaultFormState(l,d,"excludeObjectChildren")),i(d,void 0,this.getFieldId()),this.setState({selectedOption:n})};const{formData:t,options:r,registry:{schemaUtils:a}}=this.props,i=r.map((e=>a.retrieveSchema(e,t)));this.state={retrievedOptions:i,selectedOption:this.getMatchingOption(0,t,i)}}componentDidUpdate(e,t){const{formData:a,options:i,idSchema:s}=this.props,{selectedOption:o}=this.state;let n=this.state;if(!r.deepEquals(e.options,i)){const{registry:{schemaUtils:e}}=this.props;n={selectedOption:o,retrievedOptions:i.map((t=>e.retrieveSchema(t,a)))}}if(!r.deepEquals(a,e.formData)&&s.$id===e.idSchema.$id){const{retrievedOptions:e}=n,r=this.getMatchingOption(o,a,e);t&&r!==o&&(n={selectedOption:r,retrievedOptions:e})}n!==this.state&&this.setState(n)}getMatchingOption(e,t,a){const{schema:i,registry:{schemaUtils:s}}=this.props,o=r.getDiscriminatorFieldFromSchema(i);return s.getClosestMatchingOption(t,a,e,o)}getFieldId(){const{idSchema:e,schema:t}=this.props;return`${e.$id}${t.oneOf?"__oneof_select":"__anyof_select"}`}render(){const{name:t,disabled:a=!1,errorSchema:i={},formContext:s,onBlur:o,onFocus:n,registry:l,schema:d,uiSchema:c}=this.props,{widgets:m,fields:u,translateString:h,globalUiOptions:p,schemaUtils:g}=l,{SchemaField:S}=u,{selectedOption:b,retrievedOptions:x}=this.state,{widget:v="select",placeholder:C,autofocus:D,autocomplete:O,title:T=d.title,...E}=r.getUiOptions(c,p),I=r.getWidget({type:"number"},v,m),N=f.default(i,r.ERRORS_KEY,[]),A=F.default(i,[r.ERRORS_KEY]),k=g.getDisplayLabel(d,c,p),w=b>=0&&x[b]||null;let B;if(w){const{oneOf:e,anyOf:t,...a}=d;j.default(a,r.ADDITIONAL_PROPERTY_FLAG),B=y.default(a)?w:r.mergeSchemas(a,w)}const U=T?r.TranslatableString.TitleOptionPrefix:r.TranslatableString.OptionPrefix,_=T?[T]:[],q=x.map(((e,t)=>({label:e.title||h(U,_.concat(String(t+1))),value:t})));return e.jsxs("div",{className:"panel panel-default panel-body",children:[e.jsx("div",{className:"form-group",children:e.jsx(I,{id:this.getFieldId(),name:`${t}${d.oneOf?"__oneof_select":"__anyof_select"}`,schema:{type:"number",default:0},onChange:this.onOptionChange,onBlur:o,onFocus:n,disabled:a||y.default(q),multiple:!1,rawErrors:N,errorSchema:A,value:b>=0?b:void 0,options:{enumOptions:q,...E},registry:l,formContext:s,placeholder:C,autocomplete:O,autofocus:D,label:T??t,hideLabel:!k})}),null!==w&&e.jsx(S,{...this.props,schema:B})]})}}const w=/\.([0-9]*0)*$/,B=/[0.]0*$/;function U(a){const{registry:i,onChange:s,formData:o,value:n}=a,[l,d]=t.useState(n),{StringField:c}=i.fields;let m=o;const u=t.useCallback((e=>{d(e),"."===`${e}`.charAt(0)&&(e=`0${e}`);const t="string"==typeof e&&e.match(w)?r.asNumber(e.replace(B,"")):r.asNumber(e);s(t)}),[s]);if("string"==typeof l&&"number"==typeof m){const e=new RegExp(`${m}`.replace(".","\\.")+"\\.?0*$");l.match(e)&&(m=l)}return e.jsx(c,{...a,formData:m,onChange:u})}class _ extends t.Component{constructor(...e){super(...e),this.state={wasPropertyKeyModified:!1,additionalProperties:{}},this.onPropertyChange=(e,t=!1)=>(r,a,i)=>{const{formData:s,onChange:o,errorSchema:n}=this.props;void 0===r&&t&&(r=""),o({...s,[e]:r},n&&n&&{...n,[e]:a},i)},this.onDropPropertyClick=e=>t=>{t.preventDefault();const{onChange:r,formData:a}=this.props,i={...a};j.default(i,e),r(i)},this.getAvailableKey=(e,t)=>{const{uiSchema:a,registry:i}=this.props,{duplicateKeySuffixSeparator:s="-"}=r.getUiOptions(a,i.globalUiOptions);let o=0,n=e;for(;O.default(t,n);)n=`${e}${s}${++o}`;return n},this.onKeyChange=e=>(t,r)=>{if(e===t)return;const{formData:a,onChange:i,errorSchema:s}=this.props;t=this.getAvailableKey(t,a);const o={...a},n={[e]:t},l=Object.keys(o).map((e=>({[n[e]||e]:o[e]}))),d=Object.assign({},...l);this.setState({wasPropertyKeyModified:!0}),i(d,s&&s&&{...s,[t]:r})},this.handleAddClick=e=>()=>{if(!e.additionalProperties)return;const{formData:t,onChange:a,registry:i}=this.props,s={...t};let o;if(v.default(e.additionalProperties)){o=e.additionalProperties.type;let a=e.additionalProperties;if(r.REF_KEY in a){const{schemaUtils:e}=i;a=e.retrieveSchema({$ref:a[r.REF_KEY]},t),o=a.type}o||!(r.ANY_OF_KEY in a)&&!(r.ONE_OF_KEY in a)||(o="object")}const n=this.getAvailableKey("newKey",s);C.default(s,n,this.getDefaultValue(o)),a(s)}}isRequired(e){const{schema:t}=this.props;return Array.isArray(t.required)&&-1!==t.required.indexOf(e)}getDefaultValue(e){const{registry:{translateString:t}}=this.props;switch(e){case"array":return[];case"boolean":return!1;case"null":return null;case"number":return 0;case"object":return{};default:return t(r.TranslatableString.NewStringDefault)}}render(){const{schema:t,uiSchema:a={},formData:i,errorSchema:s,idSchema:o,name:n,required:l=!1,disabled:d=!1,readonly:c=!1,hideError:m,idPrefix:u,idSeparator:h,onBlur:p,onFocus:g,registry:y}=this.props,{fields:S,formContext:b,schemaUtils:x,translateString:v,globalUiOptions:C}=y,{SchemaField:F}=S,j=x.retrieveSchema(t,i),T=r.getUiOptions(a,C),{properties:E={}}=j,I=T.title??j.title??n,N=T.description??j.description;let A;try{const e=Object.keys(E);A=r.orderProperties(e,T.order)}catch(t){return e.jsxs("div",{children:[e.jsx("p",{className:"config-error",style:{color:"red"},children:e.jsx(D.default,{children:v(r.TranslatableString.InvalidObjectField,[n||"root",t.message])})}),e.jsx("pre",{children:JSON.stringify(j)})]})}const k=r.getTemplate("ObjectFieldTemplate",y,T),w={title:!1===T.label?"":I,description:!1===T.label?void 0:N,properties:A.map((t=>{const n=O.default(j,[r.PROPERTIES_KEY,t,r.ADDITIONAL_PROPERTY_FLAG]),S=n?a.additionalProperties:a[t],x="hidden"===r.getUiOptions(S).widget,v=f.default(o,[t],{});return{content:e.jsx(F,{name:t,required:this.isRequired(t),schema:f.default(j,[r.PROPERTIES_KEY,t],{}),uiSchema:S,errorSchema:f.default(s,t),idSchema:v,idPrefix:u,idSeparator:h,formData:f.default(i,t),formContext:b,wasPropertyKeyModified:this.state.wasPropertyKeyModified,onKeyChange:this.onKeyChange(t),onChange:this.onPropertyChange(t,n),onBlur:p,onFocus:g,registry:y,disabled:d,readonly:c,hideError:m,onDropPropertyClick:this.onDropPropertyClick},t),name:t,readonly:c,disabled:d,required:l,hidden:x}})),readonly:c,disabled:d,required:l,idSchema:o,uiSchema:a,errorSchema:s,schema:j,formData:i,formContext:b,registry:y};return e.jsx(k,{...w,onAddClick:this.handleAddClick})}}const q={array:"ArrayField",boolean:"BooleanField",integer:"NumberField",number:"NumberField",object:"ObjectField",string:"StringField",null:"NullField"};function P(a){const{schema:i,idSchema:s,uiSchema:o,formData:n,errorSchema:l,idPrefix:d,idSeparator:c,name:m,onChange:u,onKeyChange:h,onDropPropertyClick:p,required:g,registry:f,wasPropertyKeyModified:y=!1}=a,{formContext:S,schemaUtils:b,globalUiOptions:x}=f,C=r.getUiOptions(o,x),j=r.getTemplate("FieldTemplate",f,C),O=r.getTemplate("DescriptionFieldTemplate",f,C),T=r.getTemplate("FieldHelpTemplate",f,C),E=r.getTemplate("FieldErrorTemplate",f,C),I=b.retrieveSchema(i,n),N=s[r.ID_KEY],A=r.mergeObjects(b.toIdSchema(I,N,n,d,c),s),k=t.useCallback(((e,t,r)=>u(e,t,r||N)),[N,u]),w=function(t,a,i,s){const o=a.field,{fields:n,translateString:l}=s;if("function"==typeof o)return o;if("string"==typeof o&&o in n)return n[o];const d=r.getSchemaType(t),c=Array.isArray(d)?d[0]:d||"",m=t.$id;let u=q[c];return m&&m in n&&(u=m),u||!t.anyOf&&!t.oneOf?u in n?n[u]:()=>{const o=r.getTemplate("UnsupportedFieldTemplate",s,a);return e.jsx(o,{schema:t,idSchema:i,reason:l(r.TranslatableString.UnknownFieldType,[String(t.type)]),registry:s})}:()=>null}(I,C,A,f),B=Boolean(a.disabled||C.disabled),U=Boolean(a.readonly||C.readonly||a.schema.readOnly||I.readOnly),_=C.hideError,P=void 0===_?a.hideError:Boolean(_),R=Boolean(a.autofocus||C.autofocus);if(0===Object.keys(I).length)return null;const L=b.getDisplayLabel(I,o,x),{__errors:$,...V}=l||{},K=F.default(o,["ui:classNames","classNames","ui:style"]);r.UI_OPTIONS_KEY in K&&(K[r.UI_OPTIONS_KEY]=F.default(K[r.UI_OPTIONS_KEY],["classNames","style"]));const M=e.jsx(w,{...a,onChange:k,idSchema:A,schema:I,uiSchema:K,disabled:B,readonly:U,hideError:P,autofocus:R,errorSchema:V,formContext:S,rawErrors:$}),W=A[r.ID_KEY];let Y;Y=y||r.ADDITIONAL_PROPERTY_FLAG in I?m:C.title||a.schema.title||I.title||m;const z=C.description||a.schema.description||I.description||"",G=C.enableMarkdownInDescription?e.jsx(D.default,{children:z}):z,H=C.help,J="hidden"===C.widget,Q=["form-group","field",`field-${r.getSchemaType(I)}`];!P&&$&&$.length>0&&Q.push("field-error has-error has-danger"),null!=o&&o.classNames&&Q.push(o.classNames),C.classNames&&Q.push(C.classNames);const X=e.jsx(T,{help:H,idSchema:A,schema:I,uiSchema:o,hasErrors:!P&&$&&$.length>0,registry:f}),Z=P||I.anyOf||I.oneOf?void 0:e.jsx(E,{errors:$,errorSchema:l,idSchema:A,schema:I,uiSchema:o,registry:f}),ee={description:e.jsx(O,{id:r.descriptionId(W),description:G,schema:I,uiSchema:o,registry:f}),rawDescription:z,help:X,rawHelp:"string"==typeof H?H:void 0,errors:Z,rawErrors:P?void 0:$,id:W,label:Y,hidden:J,onChange:u,onKeyChange:h,onDropPropertyClick:p,required:g,disabled:B,readonly:U,hideError:P,displayLabel:L,classNames:Q.join(" ").trim(),style:C.style,formContext:S,formData:n,schema:I,uiSchema:o,registry:f},te=f.fields.AnyOfField,re=f.fields.OneOfField,ae=(null==o?void 0:o["ui:field"])&&!0===(null==o?void 0:o["ui:fieldReplacesAnyOrOneOf"]);return e.jsx(j,{...ee,children:e.jsxs(e.Fragment,{children:[M,I.anyOf&&!ae&&!b.isSelect(I)&&e.jsx(te,{name:m,disabled:B,readonly:U,hideError:P,errorSchema:l,formData:n,formContext:S,idPrefix:d,idSchema:A,idSeparator:c,onBlur:a.onBlur,onChange:a.onChange,onFocus:a.onFocus,options:I.anyOf.map((e=>b.retrieveSchema(v.default(e)?e:{},n))),registry:f,schema:I,uiSchema:o}),I.oneOf&&!ae&&!b.isSelect(I)&&e.jsx(re,{name:m,disabled:B,readonly:U,hideError:P,errorSchema:l,formData:n,formContext:S,idPrefix:d,idSchema:A,idSeparator:c,onBlur:a.onBlur,onChange:a.onChange,onFocus:a.onFocus,options:I.oneOf.map((e=>b.retrieveSchema(v.default(e)?e:{},n))),registry:f,schema:I,uiSchema:o})]})})}class R extends t.Component{shouldComponentUpdate(e){return!r.deepEquals(this.props,e)}render(){return e.jsx(P,{...this.props})}}function L(t){const{schema:a,name:i,uiSchema:s,idSchema:o,formData:n,required:l,disabled:d=!1,readonly:c=!1,autofocus:m=!1,onChange:u,onBlur:h,onFocus:p,registry:g,rawErrors:f}=t,{title:y,format:S}=a,{widgets:b,formContext:x,schemaUtils:v,globalUiOptions:C}=g,F=v.isSelect(a)?r.optionsList(a):void 0;let j=F?"select":"text";S&&r.hasWidget(a,S,b)&&(j=S);const{widget:D=j,placeholder:O="",title:T,...E}=r.getUiOptions(s),I=v.getDisplayLabel(a,s,C),N=T??y??i,A=r.getWidget(a,D,b);return e.jsx(A,{options:{...E,enumOptions:F},schema:a,uiSchema:s,id:o.$id,name:i,label:N,hideLabel:!I,value:n,onChange:u,onBlur:h,onFocus:p,required:l,disabled:d,readonly:c,formContext:x,autofocus:m,registry:g,placeholder:O,rawErrors:f})}function $(e){const{formData:r,onChange:a}=e;return t.useEffect((()=>{void 0===r&&a(null)}),[r,a]),null}function V(t){const{idSchema:a,description:i,registry:s,schema:o,uiSchema:n}=t,l=r.getUiOptions(n,s.globalUiOptions),{label:d=!0}=l;if(!i||!d)return null;const c=r.getTemplate("DescriptionFieldTemplate",s,l);return e.jsx(c,{id:r.descriptionId(a),description:i,schema:o,uiSchema:n,registry:s})}function K(t){const{children:r,className:a,disabled:i,hasToolbar:s,hasMoveDown:o,hasMoveUp:n,hasRemove:l,hasCopy:d,index:c,onCopyIndexClick:m,onDropIndexClick:u,onReorderClick:h,readonly:p,registry:g,uiSchema:f}=t,{CopyButton:y,MoveDownButton:S,MoveUpButton:b,RemoveButton:x}=g.templates.ButtonTemplates,v={flex:1,paddingLeft:6,paddingRight:6,fontWeight:"bold"};return e.jsxs("div",{className:a,children:[e.jsx("div",{className:s?"col-xs-9":"col-xs-12",children:r}),s&&e.jsx("div",{className:"col-xs-3 array-item-toolbox",children:e.jsxs("div",{className:"btn-group",style:{display:"flex",justifyContent:"space-around"},children:[(n||o)&&e.jsx(b,{style:v,disabled:i||p||!n,onClick:h(c,c-1),uiSchema:f,registry:g}),(n||o)&&e.jsx(S,{style:v,disabled:i||p||!o,onClick:h(c,c+1),uiSchema:f,registry:g}),d&&e.jsx(y,{style:v,disabled:i||p,onClick:m(c),uiSchema:f,registry:g}),l&&e.jsx(x,{style:v,disabled:i||p,onClick:u(c),uiSchema:f,registry:g})]})})]})}function M(t){const{canAdd:a,className:i,disabled:s,idSchema:o,uiSchema:n,items:l,onAddClick:d,readonly:c,registry:m,required:u,schema:h,title:p}=t,g=r.getUiOptions(n),f=r.getTemplate("ArrayFieldDescriptionTemplate",m,g),y=r.getTemplate("ArrayFieldItemTemplate",m,g),S=r.getTemplate("ArrayFieldTitleTemplate",m,g),{ButtonTemplates:{AddButton:b}}=m.templates;return e.jsxs("fieldset",{className:i,id:o.$id,children:[e.jsx(S,{idSchema:o,title:g.title||p,required:u,schema:h,uiSchema:n,registry:m}),e.jsx(f,{idSchema:o,description:g.description||h.description,schema:h,uiSchema:n,registry:m}),e.jsx("div",{className:"row array-item-list",children:l&&l.map((({key:t,...r})=>e.jsx(y,{...r},t)))}),a&&e.jsx(b,{className:"array-item-add",onClick:d,disabled:s||c,uiSchema:n,registry:m})]})}function W(t){const{idSchema:a,title:i,schema:s,uiSchema:o,required:n,registry:l}=t,d=r.getUiOptions(o,l.globalUiOptions),{label:c=!0}=d;if(!i||!c)return null;const m=r.getTemplate("TitleFieldTemplate",l,d);return e.jsx(m,{id:r.titleId(a),title:i,required:n,schema:s,uiSchema:o,registry:l})}function Y(a){const{id:i,name:s,value:o,readonly:n,disabled:l,autofocus:d,onBlur:c,onFocus:m,onChange:u,onChangeOverride:h,options:p,schema:g,uiSchema:f,formContext:y,registry:S,rawErrors:b,type:x,hideLabel:v,hideError:C,...F}=a;if(!i)throw console.log("No id for",a),new Error(`no id for props ${JSON.stringify(a)}`);const j={...F,...r.getInputProps(g,x,p)};let D;D="number"===j.type||"integer"===j.type?o||0===o?o:"":null==o?"":o;const O=t.useCallback((({target:{value:e}})=>u(""===e?p.emptyValue:e)),[u,p]),T=t.useCallback((({target:{value:e}})=>c(i,e)),[c,i]),E=t.useCallback((({target:{value:e}})=>m(i,e)),[m,i]);return e.jsxs(e.Fragment,{children:[e.jsx("input",{id:i,name:i,className:"form-control",readOnly:n,disabled:l,autoFocus:d,value:D,...j,list:g.examples?r.examplesId(i):void 0,onChange:h||O,onBlur:T,onFocus:E,"aria-describedby":r.ariaDescribedByIds(i,!!g.examples)}),Array.isArray(g.examples)&&e.jsx("datalist",{id:r.examplesId(i),children:g.examples.concat(g.default&&!g.examples.includes(g.default)?[g.default]:[]).map((t=>e.jsx("option",{value:t},t)))},`datalist_${i}`)]})}function z({uiSchema:t}){const{submitText:a,norender:i,props:s={}}=r.getSubmitButtonOptions(t);return i?null:e.jsx("div",{children:e.jsx("button",{type:"submit",...s,className:`btn btn-info ${s.className||""}`,children:a})})}function G(t){const{iconType:r="default",icon:a,className:i,uiSchema:s,registry:o,...n}=t;return e.jsx("button",{type:"button",className:`btn btn-${r} ${i}`,...n,children:e.jsx("i",{className:`glyphicon glyphicon-${a}`})})}function H(t){const{registry:{translateString:a}}=t;return e.jsx(G,{title:a(r.TranslatableString.CopyButton),className:"array-item-copy",...t,icon:"copy"})}function J(t){const{registry:{translateString:a}}=t;return e.jsx(G,{title:a(r.TranslatableString.MoveDownButton),className:"array-item-move-down",...t,icon:"arrow-down"})}function Q(t){const{registry:{translateString:a}}=t;return e.jsx(G,{title:a(r.TranslatableString.MoveUpButton),className:"array-item-move-up",...t,icon:"arrow-up"})}function X(t){const{registry:{translateString:a}}=t;return e.jsx(G,{title:a(r.TranslatableString.RemoveButton),className:"array-item-remove",...t,iconType:"danger",icon:"remove"})}function Z({className:t,onClick:a,disabled:i,registry:s}){const{translateString:o}=s;return e.jsx("div",{className:"row",children:e.jsx("p",{className:`col-xs-3 col-xs-offset-9 text-right ${t}`,children:e.jsx(G,{iconType:"info",icon:"plus",className:"btn-add col-xs-12",title:o(r.TranslatableString.AddButton),onClick:a,disabled:i,registry:s})})})}function ee(t){const{id:r,description:a}=t;return a?e.jsx("string"==typeof a?"p":"div",{id:r,className:"field-description",children:a}):null}function te({errors:t,registry:a}){const{translateString:i}=a;return e.jsxs("div",{className:"panel panel-danger errors",children:[e.jsx("div",{className:"panel-heading",children:e.jsx("h3",{className:"panel-title",children:i(r.TranslatableString.ErrorsLabel)})}),e.jsx("ul",{className:"list-group",children:t.map(((t,r)=>e.jsx("li",{className:"list-group-item text-danger",children:t.stack},r)))})]})}const re="*";function ae(t){const{label:r,required:a,id:i}=t;return r?e.jsxs("label",{className:"control-label",htmlFor:i,children:[r,a&&e.jsx("span",{className:"required",children:re})]}):null}function ie(t){const{id:a,label:i,children:s,errors:o,help:n,description:l,hidden:d,required:c,displayLabel:m,registry:u,uiSchema:h}=t,p=r.getUiOptions(h),g=r.getTemplate("WrapIfAdditionalTemplate",u,p);return d?e.jsx("div",{className:"hidden",children:s}):e.jsxs(g,{...t,children:[m&&e.jsx(ae,{label:i,required:c,id:a}),m&&l?l:null,s,o,n]})}function se(t){const{errors:a=[],idSchema:i}=t;if(0===a.length)return null;const s=r.errorId(i);return e.jsx("div",{children:e.jsx("ul",{id:s,className:"error-detail bs-callout bs-callout-info",children:a.filter((e=>!!e)).map(((t,r)=>e.jsx("li",{className:"text-danger",children:t},r)))})})}function oe(t){const{idSchema:a,help:i}=t;if(!i)return null;const s=r.helpId(a);return e.jsx("string"==typeof i?"p":"div",{id:s,className:"help-block",children:i})}function ne(t){const{description:a,disabled:i,formData:s,idSchema:o,onAddClick:n,properties:l,readonly:d,registry:c,required:m,schema:u,title:h,uiSchema:p}=t,g=r.getUiOptions(p),f=r.getTemplate("TitleFieldTemplate",c,g),y=r.getTemplate("DescriptionFieldTemplate",c,g),{ButtonTemplates:{AddButton:S}}=c.templates;return e.jsxs("fieldset",{id:o.$id,children:[h&&e.jsx(f,{id:r.titleId(o),title:h,required:m,schema:u,uiSchema:p,registry:c}),a&&e.jsx(y,{id:r.descriptionId(o),description:a,schema:u,uiSchema:p,registry:c}),l.map((e=>e.content)),r.canExpand(u,p,s)&&e.jsx(S,{className:"object-property-expand",onClick:n(u),disabled:i||d,uiSchema:p,registry:c})]})}const le="*";function de(t){const{id:r,title:a,required:i}=t;return e.jsxs("legend",{id:r,children:[a,i&&e.jsx("span",{className:"required",children:le})]})}function ce(t){const{schema:a,idSchema:i,reason:s,registry:o}=t,{translateString:n}=o;let l=r.TranslatableString.UnsupportedField;const d=[];return i&&i.$id&&(l=r.TranslatableString.UnsupportedFieldWithId,d.push(i.$id)),s&&(l=l===r.TranslatableString.UnsupportedField?r.TranslatableString.UnsupportedFieldWithReason:r.TranslatableString.UnsupportedFieldWithIdAndReason,d.push(s)),e.jsxs("div",{className:"unsupported-field",children:[e.jsx("p",{children:e.jsx(D.default,{children:n(l,d)})}),a&&e.jsx("pre",{children:JSON.stringify(a,null,2)})]})}function me(t){const{id:a,classNames:i,style:s,disabled:o,label:n,onKeyChange:l,onDropPropertyClick:d,readonly:c,required:m,schema:u,children:h,uiSchema:p,registry:g}=t,{templates:f,translateString:y}=g,{RemoveButton:S}=f.ButtonTemplates,b=y(r.TranslatableString.KeyLabel,[n]);return e.jsx("div",r.ADDITIONAL_PROPERTY_FLAG in u?{className:i,style:s,children:e.jsxs("div",{className:"row",children:[e.jsx("div",{className:"col-xs-5 form-additional",children:e.jsxs("div",{className:"form-group",children:[e.jsx(ae,{label:b,required:m,id:`${a}-key`}),e.jsx("input",{className:"form-control",type:"text",id:`${a}-key`,onBlur:e=>l(e.target.value),defaultValue:n})]})}),e.jsx("div",{className:"form-additional form-group col-xs-5",children:h}),e.jsx("div",{className:"col-xs-2",children:e.jsx(S,{className:"array-item-remove btn-block",style:{border:"0"},disabled:o||c,onClick:d(n),uiSchema:p,registry:g})})]})}:{className:i,style:s,children:h})}function ue(e,t){const a=[];for(let i=e;i<=t;i++)a.push({value:i,label:r.pad(i,2)});return a}function he(e,t,r=[1900,(new Date).getFullYear()+2]){const{year:a,month:i,day:s,hour:o,minute:n,second:l}=e,d=[{type:"year",range:r,value:a},{type:"month",range:[1,12],value:i},{type:"day",range:[1,31],value:s}];return t&&d.push({type:"hour",range:[0,23],value:o},{type:"minute",range:[0,59],value:n},{type:"second",range:[0,59],value:l}),d}function pe({type:t,range:a,value:i,select:s,rootId:o,name:n,disabled:l,readonly:d,autofocus:c,registry:m,onBlur:u,onFocus:h}){const p=o+"_"+t,{SelectWidget:g}=m.widgets;return e.jsx(g,{schema:{type:"integer"},id:p,name:n,className:"form-control",options:{enumOptions:ue(a[0],a[1])},placeholder:t,value:i,disabled:l,readonly:d,autofocus:c,onChange:e=>s(t,e),onBlur:u,onFocus:h,registry:m,label:"","aria-describedby":r.ariaDescribedByIds(o)})}function ge({time:a=!1,disabled:i=!1,readonly:s=!1,autofocus:o=!1,options:n,id:l,name:d,registry:c,onBlur:m,onFocus:u,onChange:h,value:p}){const{translateString:g}=c,[f,y]=t.useState(p),[S,b]=t.useReducer(((e,t)=>({...e,...t})),r.parseDateString(p,a));t.useEffect((()=>{const e=r.toDateString(S,a);!function(e){return Object.values(e).every((e=>-1!==e))}(S)||e===p?f!==p&&(y(p),b(r.parseDateString(p,a))):h(e)}),[a,p,h,S,f]);const x=t.useCallback(((e,t)=>{b({[e]:t})}),[]),v=t.useCallback((e=>{if(e.preventDefault(),i||s)return;const t=r.parseDateString((new Date).toJSON(),a);h(r.toDateString(t,a))}),[i,s,a]),C=t.useCallback((e=>{e.preventDefault(),i||s||h(void 0)}),[i,s,h]);return e.jsxs("ul",{className:"list-inline",children:[he(S,a,n.yearsRange).map(((t,r)=>e.jsx("li",{className:"list-inline-item",children:e.jsx(pe,{rootId:l,name:d,select:x,...t,disabled:i,readonly:s,registry:c,onBlur:m,onFocus:u,autofocus:o&&0===r})},r))),("undefined"===n.hideNowButton||!n.hideNowButton)&&e.jsx("li",{className:"list-inline-item",children:e.jsx("a",{href:"#",className:"btn btn-info btn-now",onClick:v,children:g(r.TranslatableString.NowLabel)})}),("undefined"===n.hideClearButton||!n.hideClearButton)&&e.jsx("li",{className:"list-inline-item",children:e.jsx("a",{href:"#",className:"btn btn-warning btn-clear",onClick:C,children:g(r.TranslatableString.ClearLabel)})})]})}function fe({time:t=!0,...r}){const{AltDateWidget:a}=r.registry.widgets;return e.jsx(a,{time:t,...r})}function ye({schema:a,uiSchema:i,options:s,id:o,value:n,disabled:l,readonly:d,label:c,hideLabel:m,autofocus:u=!1,onBlur:h,onFocus:p,onChange:g,registry:f}){const y=r.getTemplate("DescriptionFieldTemplate",f,s),S=r.schemaRequiresTrueValue(a),b=t.useCallback((e=>g(e.target.checked)),[g]),x=t.useCallback((e=>h(o,e.target.checked)),[h,o]),v=t.useCallback((e=>p(o,e.target.checked)),[p,o]),C=s.description??a.description;return e.jsxs("div",{className:"checkbox "+(l||d?"disabled":""),children:[!m&&!!C&&e.jsx(y,{id:r.descriptionId(o),description:C,schema:a,uiSchema:i,registry:f}),e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",id:o,name:o,checked:void 0!==n&&n,required:S,disabled:l||d,autoFocus:u,onChange:b,onBlur:x,onFocus:v,"aria-describedby":r.ariaDescribedByIds(o)}),r.labelValue(e.jsx("span",{children:c}),m)]})]})}function Se({id:a,disabled:i,options:{inline:s=!1,enumOptions:o,enumDisabled:n,emptyValue:l},value:d,autofocus:c=!1,readonly:m,onChange:u,onBlur:h,onFocus:p}){const g=Array.isArray(d)?d:[d],f=t.useCallback((({target:{value:e}})=>h(a,r.enumOptionsValueForIndex(e,o,l))),[h,a]),y=t.useCallback((({target:{value:e}})=>p(a,r.enumOptionsValueForIndex(e,o,l))),[p,a]);return e.jsx("div",{className:"checkboxes",id:a,children:Array.isArray(o)&&o.map(((t,l)=>{const d=r.enumOptionsIsSelected(t.value,g),h=Array.isArray(n)&&-1!==n.indexOf(t.value),p=i||h||m?"disabled":"",S=e.jsxs("span",{children:[e.jsx("input",{type:"checkbox",id:r.optionId(a,l),name:a,checked:d,value:String(l),disabled:i||h||m,autoFocus:c&&0===l,onChange:e=>{u(e.target.checked?r.enumOptionsSelectValue(l,g,o):r.enumOptionsDeselectValue(l,g,o))},onBlur:f,onFocus:y,"aria-describedby":r.ariaDescribedByIds(a)}),e.jsx("span",{children:t.label})]});return s?e.jsx("label",{className:`checkbox-inline ${p}`,children:S},l):e.jsx("div",{className:`checkbox ${p}`,children:e.jsx("label",{children:S})},l)}))})}function be(t){const{disabled:a,readonly:i,options:s,registry:o}=t,n=r.getTemplate("BaseInputTemplate",o,s);return e.jsx(n,{type:"color",...t,disabled:a||i})}function xe(a){const{onChange:i,options:s,registry:o}=a,n=r.getTemplate("BaseInputTemplate",o,s),l=t.useCallback((e=>i(e||void 0)),[i]);return e.jsx(n,{type:"date",...a,onChange:l})}function ve(t){const{onChange:a,value:i,options:s,registry:o}=t,n=r.getTemplate("BaseInputTemplate",o,s);return e.jsx(n,{type:"datetime-local",...t,value:r.utcToLocal(i),onChange:e=>a(r.localToUTC(e))})}function Ce(t){const{options:a,registry:i}=t,s=r.getTemplate("BaseInputTemplate",i,a);return e.jsx(s,{type:"email",...t})}function Fe(e,t){return null===e?null:e.replace(";base64",`;name=${encodeURIComponent(t)};base64`)}function je(e){const{name:t,size:r,type:a}=e;return new Promise(((i,s)=>{const o=new window.FileReader;o.onerror=s,o.onload=e=>{var s;"string"==typeof(null===(s=e.target)||void 0===s?void 0:s.result)?i({dataURL:Fe(e.target.result,t),name:t,size:r,type:a}):i({dataURL:null,name:t,size:r,type:a})},o.readAsDataURL(e)}))}function De({fileInfo:t,registry:a}){const{translateString:i}=a,{dataURL:s,type:o,name:n}=t;return s?-1!==o.indexOf("image")?e.jsx("img",{src:s,style:{maxWidth:"100%"},className:"file-preview"}):e.jsxs(e.Fragment,{children:[" ",e.jsx("a",{download:`preview-${n}`,href:s,className:"file-download",children:i(r.TranslatableString.PreviewLabel)})]}):null}function Oe({filesInfo:t,registry:a,preview:i}){if(0===t.length)return null;const{translateString:s}=a;return e.jsx("ul",{className:"file-info",children:t.map(((t,o)=>{const{name:n,size:l,type:d}=t;return e.jsxs("li",{children:[e.jsx(D.default,{children:s(r.TranslatableString.FilesInfo,[n,d,String(l)])}),i&&e.jsx(De,{fileInfo:t,registry:a})]},o)}))})}function Te(e){return e.filter((e=>e)).map((e=>{const{blob:t,name:a}=r.dataURItoBlob(e);return{dataURL:e,name:a,size:t.size,type:t.type}}))}function Ee(a){const{disabled:i,readonly:s,required:o,multiple:n,onChange:l,value:d,options:c,registry:m}=a,u=r.getTemplate("BaseInputTemplate",m,c),[h,p]=t.useState(Array.isArray(d)?Te(d):Te([d])),g=t.useCallback((e=>{var t;e.target.files&&(t=e.target.files,Promise.all(Array.from(t).map(je))).then((e=>{const t=e.map((e=>e.dataURL));n?(p(h.concat(e[0])),l(d.concat(t[0]))):(p(e),l(t[0]))}))}),[n,d,h,l]);return e.jsxs("div",{children:[e.jsx(u,{...a,disabled:i||s,type:"file",required:!d&&o,onChangeOverride:g,value:"",accept:c.accept?String(c.accept):void 0}),e.jsx(Oe,{filesInfo:h,registry:m,preview:c.filePreview})]})}function Ie({id:t,value:r}){return e.jsx("input",{type:"hidden",id:t,name:t,value:void 0===r?"":r})}function Ne(t){const{options:a,registry:i}=t,s=r.getTemplate("BaseInputTemplate",i,a);return e.jsx(s,{type:"password",...t})}function Ae({options:a,value:i,required:s,disabled:o,readonly:n,autofocus:l=!1,onBlur:d,onFocus:c,onChange:m,id:u}){const{enumOptions:h,enumDisabled:p,inline:g,emptyValue:f}=a,y=t.useCallback((({target:{value:e}})=>d(u,r.enumOptionsValueForIndex(e,h,f))),[d,u]),S=t.useCallback((({target:{value:e}})=>c(u,r.enumOptionsValueForIndex(e,h,f))),[c,u]);return e.jsx("div",{className:"field-radio-group",id:u,children:Array.isArray(h)&&h.map(((t,a)=>{const d=r.enumOptionsIsSelected(t.value,i),c=Array.isArray(p)&&-1!==p.indexOf(t.value),h=o||c||n?"disabled":"",f=e.jsxs("span",{children:[e.jsx("input",{type:"radio",id:r.optionId(u,a),checked:d,name:u,required:s,value:String(a),disabled:o||c||n,autoFocus:l&&0===a,onChange:()=>m(t.value),onBlur:y,onFocus:S,"aria-describedby":r.ariaDescribedByIds(u)}),e.jsx("span",{children:t.label})]});return g?e.jsx("label",{className:`radio-inline ${h}`,children:f},a):e.jsx("div",{className:`radio ${h}`,children:e.jsx("label",{children:f})},a)}))})}function ke(t){const{value:r,registry:{templates:{BaseInputTemplate:a}}}=t;return e.jsxs("div",{className:"field-range-wrapper",children:[e.jsx(a,{type:"range",...t}),e.jsx("span",{className:"range-view",children:r})]})}function we(e,t){return t?Array.from(e.target.options).slice().filter((e=>e.selected)).map((e=>e.value)):e.target.value}function Be({schema:a,id:i,options:s,value:o,required:n,disabled:l,readonly:d,multiple:c=!1,autofocus:m=!1,onChange:u,onBlur:h,onFocus:p,placeholder:g}){const{enumOptions:f,enumDisabled:y,emptyValue:S}=s,b=c?[]:"",x=t.useCallback((e=>{const t=we(e,c);return p(i,r.enumOptionsValueForIndex(t,f,S))}),[p,i,a,c,s]),v=t.useCallback((e=>{const t=we(e,c);return h(i,r.enumOptionsValueForIndex(t,f,S))}),[h,i,a,c,s]),C=t.useCallback((e=>{const t=we(e,c);return u(r.enumOptionsValueForIndex(t,f,S))}),[u,a,c,s]),F=r.enumOptionsIndexForValue(o,f,c);return e.jsxs("select",{id:i,name:i,multiple:c,className:"form-control",value:void 0===F?b:F,required:n,disabled:l||d,autoFocus:m,onBlur:v,onFocus:x,onChange:C,"aria-describedby":r.ariaDescribedByIds(i),children:[!c&&void 0===a.default&&e.jsx("option",{value:"",children:g}),Array.isArray(f)&&f.map((({value:t,label:r},a)=>{const i=y&&-1!==y.indexOf(t);return e.jsx("option",{value:String(a),disabled:i,children:r},a)}))]})}function Ue({id:a,options:i={},placeholder:s,value:o,required:n,disabled:l,readonly:d,autofocus:c=!1,onChange:m,onBlur:u,onFocus:h}){const p=t.useCallback((({target:{value:e}})=>m(""===e?i.emptyValue:e)),[m,i.emptyValue]),g=t.useCallback((({target:{value:e}})=>u(a,e)),[u,a]),f=t.useCallback((({target:{value:e}})=>h(a,e)),[a,h]);return e.jsx("textarea",{id:a,name:a,className:"form-control",value:o||"",placeholder:s,required:n,disabled:l,readOnly:d,autoFocus:c,rows:i.rows,onBlur:g,onFocus:f,onChange:p,"aria-describedby":r.ariaDescribedByIds(a)})}function _e(t){const{options:a,registry:i}=t,s=r.getTemplate("BaseInputTemplate",i,a);return e.jsx(s,{...t})}function qe(a){const{onChange:i,options:s,registry:o}=a,n=r.getTemplate("BaseInputTemplate",o,s),l=t.useCallback((e=>i(e?`${e}:00`:void 0)),[i]);return e.jsx(n,{type:"time",...a,onChange:l})}function Pe(t){const{options:a,registry:i}=t,s=r.getTemplate("BaseInputTemplate",i,a);return e.jsx(s,{type:"url",...t})}function Re(t){const{options:a,registry:i}=t,s=r.getTemplate("BaseInputTemplate",i,a);return e.jsx(s,{type:"number",...t})}function Le(){return{fields:{AnyOfField:k,ArrayField:N,BooleanField:A,NumberField:U,ObjectField:_,OneOfField:k,SchemaField:R,StringField:L,NullField:$},templates:{ArrayFieldDescriptionTemplate:V,ArrayFieldItemTemplate:K,ArrayFieldTemplate:M,ArrayFieldTitleTemplate:W,ButtonTemplates:{SubmitButton:z,AddButton:Z,CopyButton:H,MoveDownButton:J,MoveUpButton:Q,RemoveButton:X},BaseInputTemplate:Y,DescriptionFieldTemplate:ee,ErrorListTemplate:te,FieldTemplate:ie,FieldErrorTemplate:se,FieldHelpTemplate:oe,ObjectFieldTemplate:ne,TitleFieldTemplate:de,UnsupportedFieldTemplate:ce,WrapIfAdditionalTemplate:me},widgets:{AltDateWidget:ge,AltDateTimeWidget:fe,CheckboxWidget:ye,CheckboxesWidget:Se,ColorWidget:be,DateWidget:xe,DateTimeWidget:ve,EmailWidget:Ce,FileWidget:Ee,HiddenWidget:Ie,PasswordWidget:Ne,RadioWidget:Ae,RangeWidget:ke,SelectWidget:Be,TextWidget:_e,TextareaWidget:Ue,TimeWidget:qe,UpDownWidget:Re,URLWidget:Pe},rootSchema:{},formContext:{},translateString:r.englishStringTranslator}}Ue.defaultProps={autofocus:!1,options:{}};class $e extends t.Component{constructor(e){if(super(e),this.formElement=void 0,this.getUsedFormData=(e,t)=>{if(0===t.length&&"object"!=typeof e)return e;const r=S.default(e,t);return Array.isArray(e)?Object.keys(r).map((e=>r[e])):r},this.getFieldNames=(e,t)=>{const a=(e,i=[],s=[[]])=>(Object.keys(e).forEach((o=>{if("object"==typeof e[o]){const t=s.map((e=>[...e,o]));e[o][r.RJSF_ADDITONAL_PROPERTIES_FLAG]&&""!==e[o][r.NAME_KEY]?i.push(e[o][r.NAME_KEY]):a(e[o],i,t)}else o===r.NAME_KEY&&""!==e[o]&&s.forEach((e=>{const r=f.default(t,e);("object"!=typeof r||y.default(r))&&i.push(e)}))})),i);return a(e)},this.onChange=(e,t,a)=>{const{extraErrors:i,omitExtraData:s,liveOmit:o,noValidate:n,liveValidate:l,onChange:d}=this.props,{schemaUtils:c,schema:m}=this.state;(r.isObject(e)||Array.isArray(e))&&(e=this.getStateFromProps(this.props,e).formData);const u=!n&&l;let h={formData:e,schema:m},p=e;if(!0===s&&!0===o){const t=c.retrieveSchema(m,e),r=c.toPathSchema(t,"",e),a=this.getFieldNames(r,e);p=this.getUsedFormData(e,a),h={formData:p}}if(u){const e=this.validate(p);let t=e.errors,a=e.errorSchema;const s=t,o=a;if(i){const s=r.validationDataMerge(e,i);a=s.errorSchema,t=s.errors}h={formData:p,errors:t,errorSchema:a,schemaValidationErrors:s,schemaValidationErrorSchema:o}}else if(!n&&t){const e=i?r.mergeObjects(t,i,"preventDuplicates"):t;h={formData:p,errorSchema:e,errors:r.toErrorList(e)}}this.setState(h,(()=>d&&d({...this.state,...h},a)))},this.reset=()=>{const{onChange:e}=this.props,t={formData:this.getStateFromProps(this.props,void 0).formData,errorSchema:{},errors:[],schemaValidationErrors:[],schemaValidationErrorSchema:{}};this.setState(t,(()=>e&&e({...this.state,...t})))},this.onBlur=(e,t)=>{const{onBlur:r}=this.props;r&&r(e,t)},this.onFocus=(e,t)=>{const{onFocus:r}=this.props;r&&r(e,t)},this.onSubmit=e=>{if(e.preventDefault(),e.target!==e.currentTarget)return;e.persist();const{omitExtraData:t,extraErrors:a,noValidate:i,onSubmit:s}=this.props;let{formData:o}=this.state;const{schema:n,schemaUtils:l}=this.state;if(!0===t){const e=l.retrieveSchema(n,o),t=l.toPathSchema(e,"",o),r=this.getFieldNames(t,o);o=this.getUsedFormData(o,r)}if(i||this.validateForm()){const t=a||{},i=a?r.toErrorList(a):[];this.setState({formData:o,errors:i,errorSchema:t,schemaValidationErrors:[],schemaValidationErrorSchema:{}},(()=>{s&&s({...this.state,formData:o,status:"submitted"},e)}))}},!e.validator)throw new Error("A validator is required for Form functionality to work");this.state=this.getStateFromProps(e,e.formData),this.props.onChange&&!r.deepEquals(this.state.formData,this.props.formData)&&this.props.onChange(this.state),this.formElement=t.createRef()}UNSAFE_componentWillReceiveProps(e){const t=this.getStateFromProps(e,e.formData);r.deepEquals(t.formData,e.formData)||r.deepEquals(t.formData,this.state.formData)||!e.onChange||e.onChange(t),this.setState(t)}getStateFromProps(e,t){const a=this.state||{},i="schema"in e?e.schema:this.props.schema,s=("uiSchema"in e?e.uiSchema:this.props.uiSchema)||{},o=void 0!==t,n=o&&!e.noValidate&&("liveValidate"in e?e.liveValidate:this.props.liveValidate),l=i,d="experimental_defaultFormStateBehavior"in e?e.experimental_defaultFormStateBehavior:this.props.experimental_defaultFormStateBehavior;let c=a.schemaUtils;c&&!c.doesSchemaUtilsDiffer(e.validator,l,d)||(c=r.createSchemaUtils(e.validator,l,d));const m=c.getDefaultFormState(i,t),u=c.retrieveSchema(i,m);let h,p,g=a.schemaValidationErrors,f=a.schemaValidationErrorSchema;if(n){const e=this.validate(m,i,c);h=e.errors,p=e.errorSchema,g=h,f=p}else{const t=e.noValidate?{errors:[],errorSchema:{}}:e.liveValidate?{errors:a.errors||[],errorSchema:a.errorSchema||{}}:{errors:a.schemaValidationErrors||[],errorSchema:a.schemaValidationErrorSchema||{}};h=t.errors,p=t.errorSchema}if(e.extraErrors){const t=r.validationDataMerge({errorSchema:p,errors:h},e.extraErrors);p=t.errorSchema,h=t.errors}const y=c.toIdSchema(u,s["ui:rootFieldId"],m,e.idPrefix,e.idSeparator);return{schemaUtils:c,schema:i,uiSchema:s,idSchema:y,formData:m,edit:o,errors:h,errorSchema:p,schemaValidationErrors:g,schemaValidationErrorSchema:f}}shouldComponentUpdate(e,t){return r.shouldRender(this,e,t)}validate(e,t=this.props.schema,r){const a=r||this.state.schemaUtils,{customValidate:i,transformErrors:s,uiSchema:o}=this.props,n=a.retrieveSchema(t,e);return a.getValidator().validateFormData(e,n,i,s,o)}renderErrors(t){const{errors:a,errorSchema:i,schema:s,uiSchema:o}=this.state,{formContext:n}=this.props,l=r.getUiOptions(o),d=r.getTemplate("ErrorListTemplate",t,l);return a&&a.length?e.jsx(d,{errors:a,errorSchema:i||{},schema:s,uiSchema:o,formContext:n,registry:t}):null}getRegistry(){var e;const{translateString:t,uiSchema:a={}}=this.props,{schemaUtils:i}=this.state,{fields:s,templates:o,widgets:n,formContext:l,translateString:d}=Le();return{fields:{...s,...this.props.fields},templates:{...o,...this.props.templates,ButtonTemplates:{...o.ButtonTemplates,...null===(e=this.props.templates)||void 0===e?void 0:e.ButtonTemplates}},widgets:{...n,...this.props.widgets},rootSchema:this.props.schema,formContext:this.props.formContext||l,schemaUtils:i,translateString:t||d,globalUiOptions:a[r.UI_GLOBAL_OPTIONS_KEY]}}submit(){this.formElement.current&&(this.formElement.current.dispatchEvent(new CustomEvent("submit",{cancelable:!0})),this.formElement.current.requestSubmit())}focusOnError(e){const{idPrefix:t="root",idSeparator:r="_"}=this.props,{property:a}=e,i=b.default(a);""===i[0]?i[0]=t:i.unshift(t);const s=i.join(r);let o=this.formElement.current.elements[s];o||(o=this.formElement.current.querySelector(`input[id^=${s}`)),o&&o.length&&(o=o[0]),o&&o.focus()}validateForm(){const{extraErrors:e,extraErrorsBlockSubmit:t,focusOnFirstError:a,onError:i}=this.props,{formData:s}=this.state,o=this.validate(s);let n=o.errors,l=o.errorSchema;const d=n,c=l;if(n.length>0||e&&t){if(e){const t=r.validationDataMerge(o,e);l=t.errorSchema,n=t.errors}return a&&("function"==typeof a?a(n[0]):this.focusOnError(n[0])),this.setState({errors:n,errorSchema:l,schemaValidationErrors:d,schemaValidationErrorSchema:c},(()=>{i?i(n):console.error("Form validation failed",n)})),!1}return!0}render(){const{children:t,id:a,idPrefix:i,idSeparator:s,className:o="",tagName:n,name:l,method:d,target:c,action:m,autoComplete:u,enctype:h,acceptcharset:p,noHtml5Validate:g=!1,disabled:f=!1,readonly:y=!1,formContext:S,showErrorList:b="top",_internalFormWrapper:x}=this.props,{schema:v,uiSchema:C,formData:F,errorSchema:j,idSchema:D}=this.state,O=this.getRegistry(),{SchemaField:T}=O.fields,{SubmitButton:E}=O.templates.ButtonTemplates,I=x?n:void 0,N=x||n||"form";let{[r.SUBMIT_BTN_OPTIONS_KEY]:A={}}=r.getUiOptions(C);f&&(A={...A,props:{...A.props,disabled:!0}});const k={[r.UI_OPTIONS_KEY]:{[r.SUBMIT_BTN_OPTIONS_KEY]:A}};return e.jsxs(N,{className:o||"rjsf",id:a,name:l,method:d,target:c,action:m,autoComplete:u,encType:h,acceptCharset:p,noValidate:g,onSubmit:this.onSubmit,as:I,ref:this.formElement,children:["top"===b&&this.renderErrors(O),e.jsx(T,{name:"",schema:v,uiSchema:C,errorSchema:j,idSchema:D,idPrefix:i,idSeparator:s,formContext:S,formData:F,onChange:this.onChange,onBlur:this.onBlur,onFocus:this.onFocus,registry:O,disabled:f,readonly:y}),t||e.jsx(E,{uiSchema:k,registry:O}),"bottom"===b&&this.renderErrors(O)]})}}exports.default=$e,exports.getDefaultRegistry=Le,exports.withTheme=function(r){return t.forwardRef((({fields:t,widgets:a,templates:i,...s},o)=>{var n,l;return t={...null==r?void 0:r.fields,...t},a={...null==r?void 0:r.widgets,...a},i={...null==r?void 0:r.templates,...i,ButtonTemplates:{...null==r||null===(n=r.templates)||void 0===n?void 0:n.ButtonTemplates,...null===(l=i)||void 0===l?void 0:l.ButtonTemplates}},e.jsx($e,{...r,...s,fields:t,widgets:a,templates:i,ref:o})}))}; | ||
//# sourceMappingURL=core.cjs.production.min.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("react/jsx-runtime"),require("react"),require("@rjsf/utils"),require("lodash-es/get"),require("lodash-es/isEmpty"),require("lodash-es/pick"),require("lodash-es/toPath"),require("lodash-es/cloneDeep"),require("lodash-es/isObject"),require("lodash-es/set"),require("nanoid"),require("lodash-es/omit"),require("lodash-es/unset"),require("markdown-to-jsx"),require("lodash-es/has")):"function"==typeof define&&define.amd?define(["exports","react/jsx-runtime","react","@rjsf/utils","lodash-es/get","lodash-es/isEmpty","lodash-es/pick","lodash-es/toPath","lodash-es/cloneDeep","lodash-es/isObject","lodash-es/set","nanoid","lodash-es/omit","lodash-es/unset","markdown-to-jsx","lodash-es/has"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self).JSONSchemaForm={},e.jsxRuntime,e.React,e.utils,e.get,e.isEmpty,e._pick,e._toPath,e.cloneDeep,e.isObject,e.set,e.nanoid,e.omit,e.unset,e.Markdown,e.has)}(this,(function(e,r,t,a,i,n,o,s,l,d,u,c,m,p,h,f){"use strict";function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var v=g(i),y=g(n),S=g(o),b=g(s),x=g(l),C=g(d),j=g(u),F=g(m),O=g(p),D=g(h),T=g(f);function E(){return E=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},E.apply(this,arguments)}function I(e,r){e.prototype=Object.create(r.prototype),e.prototype.constructor=e,N(e,r)}function N(e,r){return N=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,r){return e.__proto__=r,e},N(e,r)}function k(e,r){if(null==e)return{};var t,a,i={},n=Object.keys(e);for(a=0;a<n.length;a++)r.indexOf(t=n[a])>=0||(i[t]=e[t]);return i}var w=["widget","title"],A=["widget","title"],B=["widget","title"];function U(){return c.nanoid()}function _(e){return Array.isArray(e)?e.map((function(e){return{key:U(),item:e}})):[]}function P(e){return Array.isArray(e)?e.map((function(e){return e.item})):[]}var q=function(e){function t(r){var t;(t=e.call(this,r)||this)._getNewFormDataRow=function(){var e=t.props,r=e.schema,i=e.registry.schemaUtils,n=r.items;return a.isFixedItems(r)&&a.allowAdditionalItems(r)&&(n=r.additionalItems),i.getDefaultFormState(n)},t.onAddClick=function(e){t._handleAddClick(e)},t.onAddIndexClick=function(e){return function(r){t._handleAddClick(r,e)}},t.onCopyIndexClick=function(e){return function(r){r&&r.preventDefault();var a=t.props.onChange,i=t.state.keyedFormData,n={key:U(),item:x.default(i[e].item)},o=[].concat(i);void 0!==e?o.splice(e+1,0,n):o.push(n),t.setState({keyedFormData:o,updatedKeyedFormData:!0},(function(){return a(P(o))}))}},t.onDropIndexClick=function(e){return function(r){r&&r.preventDefault();var a,i=t.props,n=i.onChange,o=i.errorSchema,s=t.state.keyedFormData;if(o)for(var l in a={},o){var d=parseInt(l);d<e?j.default(a,[d],o[l]):d>e&&j.default(a,[d-1],o[l])}var u=s.filter((function(r,t){return t!==e}));t.setState({keyedFormData:u,updatedKeyedFormData:!0},(function(){return n(P(u),a)}))}},t.onReorderClick=function(e,r){return function(a){a&&(a.preventDefault(),a.currentTarget.blur());var i,n=t.props,o=n.onChange,s=n.errorSchema;if(s)for(var l in i={},s){var d=parseInt(l);d==e?j.default(i,[r],s[e]):d==r?j.default(i,[e],s[r]):j.default(i,[l],s[d])}var u,c=t.state.keyedFormData,m=((u=c.slice()).splice(e,1),u.splice(r,0,c[e]),u);t.setState({keyedFormData:m},(function(){return o(P(m),i)}))}},t.onChangeForIndex=function(e){return function(r,a,i){var n,o=t.props,s=o.formData,l=o.errorSchema;(0,o.onChange)((Array.isArray(s)?s:[]).map((function(t,a){return e===a?void 0===r?null:r:t})),l&&l&&E({},l,((n={})[e]=a,n)),i)}},t.onSelectChange=function(e){var r=t.props,a=r.idSchema;(0,r.onChange)(e,void 0,a&&a.$id)};var i=r.formData,n=_(void 0===i?[]:i);return t.state={keyedFormData:n,updatedKeyedFormData:!1},t}I(t,e),t.getDerivedStateFromProps=function(e,r){if(r.updatedKeyedFormData)return{updatedKeyedFormData:!1};var t=Array.isArray(e.formData)?e.formData:[],a=r.keyedFormData||[];return{keyedFormData:t.length===a.length?a.map((function(e,r){return{key:e.key,item:t[r]}})):_(t)}};var i,n,o=t.prototype;return o.isItemRequired=function(e){return Array.isArray(e.type)?!e.type.includes("null"):"null"!==e.type},o.canAddItem=function(e){var r=this.props,t=r.schema,i=a.getUiOptions(r.uiSchema,r.registry.globalUiOptions).addable;return!1!==i&&(i=void 0===t.maxItems||e.length<t.maxItems),i},o._handleAddClick=function(e,r){e&&e.preventDefault();var t=this.props.onChange,a=this.state.keyedFormData,i={key:U(),item:this._getNewFormDataRow()},n=[].concat(a);void 0!==r?n.splice(r,0,i):n.push(i),this.setState({keyedFormData:n,updatedKeyedFormData:!0},(function(){return t(P(n))}))},o.render=function(){var e=this.props,t=e.schema,i=e.uiSchema,n=e.idSchema,o=e.registry,s=o.schemaUtils,l=o.translateString;if(!(a.ITEMS_KEY in t)){var d=a.getUiOptions(i),u=a.getTemplate("UnsupportedFieldTemplate",o,d);return r.jsx(u,{schema:t,idSchema:n,reason:l(a.TranslatableString.MissingItems),registry:o})}return s.isMultiSelect(t)?this.renderMultiSelect():a.isCustomWidget(i)?this.renderCustomWidget():a.isFixedItems(t)?this.renderFixedArray():s.isFilesArray(t,i)?this.renderFiles():this.renderNormalArray()},o.renderNormalArray=function(){var e=this,t=this.props,i=t.schema,n=t.uiSchema,o=void 0===n?{}:n,s=t.errorSchema,l=t.idSchema,d=t.name,u=t.disabled,c=void 0!==u&&u,m=t.readonly,p=void 0!==m&&m,h=t.autofocus,f=void 0!==h&&h,g=t.required,v=void 0!==g&&g,y=t.registry,S=t.onBlur,b=t.onFocus,x=t.idPrefix,j=t.idSeparator,F=void 0===j?"_":j,O=t.rawErrors,D=this.state.keyedFormData,T=void 0===i.title?d:i.title,I=y.schemaUtils,N=y.formContext,k=a.getUiOptions(o),w=C.default(i.items)?i.items:{},A=I.retrieveSchema(w),B=P(this.state.keyedFormData),U=this.canAddItem(B),_={canAdd:U,items:D.map((function(r,t){var a=r.key,i=r.item,n=I.retrieveSchema(w,i),u=s?s[t]:void 0,c=I.toIdSchema(n,l.$id+F+t,i,x,F);return e.renderArrayFieldItem({key:a,index:t,name:d&&d+"-"+t,canAdd:U,canMoveUp:t>0,canMoveDown:t<B.length-1,itemSchema:n,itemIdSchema:c,itemErrorSchema:u,itemData:i,itemUiSchema:o.items,autofocus:f&&0===t,onBlur:S,onFocus:b,rawErrors:O,totalItems:D.length})})),className:"field field-array field-array-of-"+A.type,disabled:c,idSchema:l,uiSchema:o,onAddClick:this.onAddClick,readonly:p,required:v,schema:i,title:T,formContext:N,formData:B,rawErrors:O,registry:y},q=a.getTemplate("ArrayFieldTemplate",y,k);return r.jsx(q,E({},_))},o.renderCustomWidget=function(){var e,t=this.props,i=t.schema,n=t.idSchema,o=t.uiSchema,s=t.disabled,l=void 0!==s&&s,d=t.readonly,u=void 0!==d&&d,c=t.autofocus,m=void 0!==c&&c,p=t.required,h=void 0!==p&&p,f=t.hideError,g=t.placeholder,v=t.onBlur,y=t.onFocus,S=t.formData,b=void 0===S?[]:S,x=t.registry,C=t.rawErrors,j=t.name,F=x.widgets,O=x.formContext,D=x.globalUiOptions,T=x.schemaUtils,E=a.getUiOptions(o,D),I=E.widget,N=E.title,A=k(E,w),B=a.getWidget(i,I,F),U=null!=(e=null!=N?N:i.title)?e:j,_=T.getDisplayLabel(i,o,D);return r.jsx(B,{id:n.$id,name:j,multiple:!0,onChange:this.onSelectChange,onBlur:v,onFocus:y,options:A,schema:i,uiSchema:o,registry:x,value:b,disabled:l,readonly:u,hideError:f,required:h,label:U,hideLabel:!_,placeholder:g,formContext:O,autofocus:m,rawErrors:C})},o.renderMultiSelect=function(){var e,t=this.props,i=t.schema,n=t.idSchema,o=t.uiSchema,s=t.formData,l=void 0===s?[]:s,d=t.disabled,u=void 0!==d&&d,c=t.readonly,m=void 0!==c&&c,p=t.autofocus,h=void 0!==p&&p,f=t.required,g=void 0!==f&&f,v=t.placeholder,y=t.onBlur,S=t.onFocus,b=t.registry,x=t.rawErrors,C=t.name,j=b.widgets,F=b.schemaUtils,O=b.formContext,D=b.globalUiOptions,T=F.retrieveSchema(i.items,l),I=a.optionsList(T),N=a.getUiOptions(o,D),w=N.widget,B=void 0===w?"select":w,U=N.title,_=k(N,A),P=a.getWidget(i,B,j),q=null!=(e=null!=U?U:i.title)?e:C,R=F.getDisplayLabel(i,o,D);return r.jsx(P,{id:n.$id,name:C,multiple:!0,onChange:this.onSelectChange,onBlur:y,onFocus:S,options:E({},_,{enumOptions:I}),schema:i,uiSchema:o,registry:b,value:l,disabled:u,readonly:m,required:g,label:q,hideLabel:!R,placeholder:v,formContext:O,autofocus:h,rawErrors:x})},o.renderFiles=function(){var e,t=this.props,i=t.schema,n=t.uiSchema,o=t.idSchema,s=t.name,l=t.disabled,d=void 0!==l&&l,u=t.readonly,c=void 0!==u&&u,m=t.autofocus,p=void 0!==m&&m,h=t.required,f=void 0!==h&&h,g=t.onBlur,v=t.onFocus,y=t.registry,S=t.formData,b=void 0===S?[]:S,x=t.rawErrors,C=y.widgets,j=y.formContext,F=y.globalUiOptions,O=y.schemaUtils,D=a.getUiOptions(n,F),T=D.widget,E=void 0===T?"files":T,I=D.title,N=k(D,B),w=a.getWidget(i,E,C),A=null!=(e=null!=I?I:i.title)?e:s,U=O.getDisplayLabel(i,n,F);return r.jsx(w,{options:N,id:o.$id,name:s,multiple:!0,onChange:this.onSelectChange,onBlur:g,onFocus:v,schema:i,uiSchema:n,value:b,disabled:d,readonly:c,required:f,registry:y,formContext:j,autofocus:p,rawErrors:x,label:A,hideLabel:!U})},o.renderFixedArray=function(){var e=this,t=this.props,i=t.schema,n=t.uiSchema,o=void 0===n?{}:n,s=t.formData,l=void 0===s?[]:s,d=t.errorSchema,u=t.idPrefix,c=t.idSeparator,m=void 0===c?"_":c,p=t.idSchema,h=t.name,f=t.disabled,g=void 0!==f&&f,v=t.readonly,y=void 0!==v&&v,S=t.autofocus,b=void 0!==S&&S,x=t.required,j=void 0!==x&&x,F=t.registry,O=t.onBlur,D=t.onFocus,T=t.rawErrors,I=this.state.keyedFormData,N=this.props.formData,k=void 0===N?[]:N,w=i.title||h,A=a.getUiOptions(o),B=F.schemaUtils,U=F.formContext,_=(C.default(i.items)?i.items:[]).map((function(e,r){return B.retrieveSchema(e,l[r])})),P=C.default(i.additionalItems)?B.retrieveSchema(i.additionalItems,l):null;(!k||k.length<_.length)&&(k=(k=k||[]).concat(new Array(_.length-k.length)));var q=this.canAddItem(k)&&!!P,R={canAdd:q,className:"field field-array field-array-fixed-items",disabled:g,idSchema:p,formData:l,items:I.map((function(r,t){var a=r.key,n=r.item,s=t>=_.length,l=s&&C.default(i.additionalItems)?B.retrieveSchema(i.additionalItems,n):_[t],c=B.toIdSchema(l,p.$id+m+t,n,u,m),f=s?o.additionalItems||{}:Array.isArray(o.items)?o.items[t]:o.items||{};return e.renderArrayFieldItem({key:a,index:t,name:h&&h+"-"+t,canAdd:q,canRemove:s,canMoveUp:t>=_.length+1,canMoveDown:s&&t<k.length-1,itemSchema:l,itemData:n,itemUiSchema:f,itemIdSchema:c,itemErrorSchema:d?d[t]:void 0,autofocus:b&&0===t,onBlur:O,onFocus:D,rawErrors:T,totalItems:I.length})})),onAddClick:this.onAddClick,readonly:y,required:j,registry:F,schema:i,uiSchema:o,title:w,formContext:U,rawErrors:T},L=a.getTemplate("ArrayFieldTemplate",F,A);return r.jsx(L,E({},R))},o.renderArrayFieldItem=function(e){var t=e.key,i=e.index,n=e.name,o=e.canAdd,s=e.canRemove,l=void 0===s||s,d=e.canMoveUp,u=e.canMoveDown,c=e.itemSchema,m=e.itemData,p=e.itemUiSchema,h=e.itemIdSchema,f=e.itemErrorSchema,g=e.autofocus,v=e.onBlur,y=e.onFocus,S=e.rawErrors,b=e.totalItems,x=this.props,C=x.disabled,j=x.hideError,F=x.idPrefix,O=x.idSeparator,D=x.readonly,T=x.registry,E=x.formContext,I=T.fields,N=I.ArraySchemaField||I.SchemaField,k=a.getUiOptions(x.uiSchema,T.globalUiOptions),w=k.orderable,A=void 0===w||w,B=k.removable,U=k.copyable,_={moveUp:A&&d,moveDown:A&&u,copy:void 0!==U&&U&&o,remove:(void 0===B||B)&&l,toolbar:!1};return _.toolbar=Object.keys(_).some((function(e){return _[e]})),{children:r.jsx(N,{name:n,index:i,schema:c,uiSchema:p,formData:m,formContext:E,errorSchema:f,idPrefix:F,idSeparator:O,idSchema:h,required:this.isItemRequired(c),onChange:this.onChangeForIndex(i),onBlur:v,onFocus:y,registry:T,disabled:C,readonly:D,hideError:j,autofocus:g,rawErrors:S}),className:"array-item",disabled:C,canAdd:o,hasCopy:_.copy,hasToolbar:_.toolbar,hasMoveUp:_.moveUp,hasMoveDown:_.moveDown,hasRemove:_.remove,index:i,totalItems:b,key:t,onAddIndexClick:this.onAddIndexClick,onCopyIndexClick:this.onCopyIndexClick,onDropIndexClick:this.onDropIndexClick,onReorderClick:this.onReorderClick,readonly:D,registry:T,schema:c,uiSchema:p}},i=t,(n=[{key:"itemTitle",get:function(){var e=this.props,r=e.schema;return v.default(r,[a.ITEMS_KEY,"title"],v.default(r,[a.ITEMS_KEY,"description"],(0,e.registry.translateString)(a.TranslatableString.ArrayItemTitle)))}}])&&function(e,r){for(var t=0;t<r.length;t++){var a=r[t];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,"symbol"==typeof(i=function(e,r){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(a.key))?i:String(i),a)}var i}(i.prototype,n),Object.defineProperty(i,"prototype",{writable:!1}),t}(t.Component),R=["widget","title","label"];function L(e){var t,i,n=e.schema,o=e.name,s=e.uiSchema,l=e.idSchema,d=e.formData,u=e.registry,c=e.required,m=e.disabled,p=e.readonly,h=e.autofocus,f=e.onChange,g=e.onFocus,v=e.onBlur,y=e.rawErrors,S=n.title,b=u.widgets,x=u.formContext,j=u.translateString,F=a.getUiOptions(s,u.globalUiOptions),O=F.widget,D=void 0===O?"checkbox":O,T=F.title,I=F.label,N=void 0===I||I,w=k(F,R),A=a.getWidget(n,D,b),B=j(a.TranslatableString.YesLabel),U=j(a.TranslatableString.NoLabel),_=null!=(t=null!=T?T:S)?t:o;if(Array.isArray(n.oneOf))i=a.optionsList({oneOf:n.oneOf.map((function(e){if(C.default(e))return E({},e,{title:e.title||(!0===e.const?B:U)})})).filter((function(e){return e}))});else{var P,q=n,L=null!=(P=n.enum)?P:[!0,!1];i=!q.enumNames&&2===L.length&&L.every((function(e){return"boolean"==typeof e}))?[{value:L[0],label:L[0]?B:U},{value:L[1],label:L[1]?B:U}]:a.optionsList({enum:L,enumNames:q.enumNames})}return r.jsx(A,{options:E({},w,{enumOptions:i}),schema:n,uiSchema:s,id:l.$id,name:o,onChange:f,onFocus:g,onBlur:v,label:_,hideLabel:!N,value:d,required:c,disabled:m,readonly:p,registry:u,formContext:x,autofocus:h,rawErrors:y})}var V=["widget","placeholder","autofocus","autocomplete","title"],K=["oneOf","anyOf"],M=function(e){function t(r){var t;(t=e.call(this,r)||this).onOptionChange=function(e){var r=t.state,a=r.selectedOption,i=r.retrievedOptions,n=t.props,o=n.formData,s=n.onChange,l=n.registry.schemaUtils,d=void 0!==e?parseInt(e,10):-1;if(d!==a){var u=d>=0?i[d]:void 0,c=l.sanitizeDataForNewSchema(u,a>=0?i[a]:void 0,o);c&&u&&(c=l.getDefaultFormState(u,c,"excludeObjectChildren")),s(c,void 0,t.getFieldId()),t.setState({selectedOption:d})}};var a=t.props,i=a.formData,n=a.registry.schemaUtils,o=a.options.map((function(e){return n.retrieveSchema(e,i)}));return t.state={retrievedOptions:o,selectedOption:t.getMatchingOption(0,i,o)},t}I(t,e);var i=t.prototype;return i.componentDidUpdate=function(e,r){var t=this.props,i=t.formData,n=t.options,o=t.idSchema,s=this.state.selectedOption,l=this.state;if(!a.deepEquals(e.options,n)){var d=this.props.registry.schemaUtils;l={selectedOption:s,retrievedOptions:n.map((function(e){return d.retrieveSchema(e,i)}))}}if(!a.deepEquals(i,e.formData)&&o.$id===e.idSchema.$id){var u=l.retrievedOptions,c=this.getMatchingOption(s,i,u);r&&c!==s&&(l={selectedOption:c,retrievedOptions:u})}l!==this.state&&this.setState(l)},i.getMatchingOption=function(e,r,t){var i=this.props,n=i.registry.schemaUtils,o=a.getDiscriminatorFieldFromSchema(i.schema);return n.getClosestMatchingOption(r,t,e,o)},i.getFieldId=function(){var e=this.props;return e.idSchema.$id+(e.schema.oneOf?"__oneof_select":"__anyof_select")},i.render=function(){var e,t=this.props,i=t.name,n=t.disabled,o=void 0!==n&&n,s=t.errorSchema,l=void 0===s?{}:s,d=t.formContext,u=t.onBlur,c=t.onFocus,m=t.registry,p=t.schema,h=t.uiSchema,f=m.widgets,g=m.translateString,S=m.globalUiOptions,b=m.schemaUtils,x=m.fields.SchemaField,C=this.state,j=C.selectedOption,D=C.retrievedOptions,T=a.getUiOptions(h,S),I=T.widget,N=void 0===I?"select":I,w=T.placeholder,A=T.autofocus,B=T.autocomplete,U=T.title,_=void 0===U?p.title:U,P=k(T,V),q=a.getWidget({type:"number"},N,f),R=v.default(l,a.ERRORS_KEY,[]),L=F.default(l,[a.ERRORS_KEY]),M=b.getDisplayLabel(p,h,S),W=j>=0&&D[j]||null;if(W){var Y=k(p,K);O.default(Y,a.ADDITIONAL_PROPERTY_FLAG),e=y.default(Y)?W:E({},Y,W)}var $=_?a.TranslatableString.TitleOptionPrefix:a.TranslatableString.OptionPrefix,z=_?[_]:[],G=D.map((function(e,r){return{label:e.title||g($,z.concat(String(r+1))),value:r}}));return r.jsxs("div",{className:"panel panel-default panel-body",children:[r.jsx("div",{className:"form-group",children:r.jsx(q,{id:this.getFieldId(),name:i+(p.oneOf?"__oneof_select":"__anyof_select"),schema:{type:"number",default:0},onChange:this.onOptionChange,onBlur:u,onFocus:c,disabled:o||y.default(G),multiple:!1,rawErrors:R,errorSchema:L,value:j>=0?j:void 0,options:E({enumOptions:G},P),registry:m,formContext:d,placeholder:w,autocomplete:B,autofocus:A,label:null!=_?_:i,hideLabel:!M})}),null!==W&&r.jsx(x,E({},this.props,{schema:e}))]})},t}(t.Component),W=/\.([0-9]*0)*$/,Y=/[0.]0*$/;function $(e){var i=e.registry,n=e.onChange,o=e.formData,s=t.useState(e.value),l=s[0],d=s[1],u=i.fields.StringField,c=o,m=t.useCallback((function(e){d(e),"."===(""+e).charAt(0)&&(e="0"+e);var r="string"==typeof e&&e.match(W)?a.asNumber(e.replace(Y,"")):a.asNumber(e);n(r)}),[n]);if("string"==typeof l&&"number"==typeof c){var p=new RegExp((""+c).replace(".","\\.")+"\\.?0*$");l.match(p)&&(c=l)}return r.jsx(u,E({},e,{formData:c,onChange:m}))}var z=function(e){function t(){for(var r,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];return(r=e.call.apply(e,[this].concat(i))||this).state={wasPropertyKeyModified:!1,additionalProperties:{}},r.onPropertyChange=function(e,t){return void 0===t&&(t=!1),function(a,i,n){var o,s,l=r.props,d=l.errorSchema;void 0===a&&t&&(a=""),(0,l.onChange)(E({},l.formData,((o={})[e]=a,o)),d&&d&&E({},d,((s={})[e]=i,s)),n)}},r.onDropPropertyClick=function(e){return function(t){t.preventDefault();var a=r.props,i=a.onChange,n=E({},a.formData);O.default(n,e),i(n)}},r.getAvailableKey=function(e,t){for(var i=r.props,n=a.getUiOptions(i.uiSchema,i.registry.globalUiOptions).duplicateKeySuffixSeparator,o=void 0===n?"-":n,s=0,l=e;T.default(t,l);)l=""+e+o+ ++s;return l},r.onKeyChange=function(e){return function(t,a){var i,n;if(e!==t){var o=r.props,s=o.formData,l=o.onChange,d=o.errorSchema;t=r.getAvailableKey(t,s);var u=E({},s),c=((i={})[e]=t,i),m=Object.keys(u).map((function(e){var r;return(r={})[c[e]||e]=u[e],r})),p=Object.assign.apply(Object,[{}].concat(m));r.setState({wasPropertyKeyModified:!0}),l(p,d&&d&&E({},d,((n={})[t]=a,n)))}}},r.handleAddClick=function(e){return function(){if(e.additionalProperties){var t=r.props,i=t.formData,n=t.onChange,o=t.registry,s=E({},i),l=void 0;if(C.default(e.additionalProperties)){l=e.additionalProperties.type;var d=e.additionalProperties;a.REF_KEY in d&&(l=(d=o.schemaUtils.retrieveSchema({$ref:d[a.REF_KEY]},i)).type),l||!(a.ANY_OF_KEY in d)&&!(a.ONE_OF_KEY in d)||(l="object")}var u=r.getAvailableKey("newKey",s);j.default(s,u,r.getDefaultValue(l)),n(s)}}},r}I(t,e);var i=t.prototype;return i.isRequired=function(e){var r=this.props.schema;return Array.isArray(r.required)&&-1!==r.required.indexOf(e)},i.getDefaultValue=function(e){var r=this.props.registry.translateString;switch(e){case"array":return[];case"boolean":return!1;case"null":return null;case"number":return 0;case"object":return{};default:return r(a.TranslatableString.NewStringDefault)}},i.render=function(){var e,t,i,n,o=this,s=this.props,l=s.uiSchema,d=void 0===l?{}:l,u=s.formData,c=s.errorSchema,m=s.idSchema,p=s.name,h=s.required,f=void 0!==h&&h,g=s.disabled,y=void 0!==g&&g,S=s.readonly,b=void 0!==S&&S,x=s.hideError,C=s.idPrefix,j=s.idSeparator,F=s.onBlur,O=s.onFocus,I=s.registry,N=I.formContext,k=I.translateString,w=I.globalUiOptions,A=I.fields.SchemaField,B=I.schemaUtils.retrieveSchema(s.schema,u),U=a.getUiOptions(d,w),_=B.properties,P=void 0===_?{}:_,q=null!=(e=null!=(t=U.title)?t:B.title)?e:p,R=null!=(i=U.description)?i:B.description;try{var L=Object.keys(P);n=a.orderProperties(L,U.order)}catch(e){return r.jsxs("div",{children:[r.jsx("p",{className:"config-error",style:{color:"red"},children:r.jsx(D.default,{children:k(a.TranslatableString.InvalidObjectField,[p||"root",e.message])})}),r.jsx("pre",{children:JSON.stringify(B)})]})}var V=a.getTemplate("ObjectFieldTemplate",I,U),K={title:!1===U.label?"":q,description:!1===U.label?void 0:R,properties:n.map((function(e){var t=T.default(B,[a.PROPERTIES_KEY,e,a.ADDITIONAL_PROPERTY_FLAG]),i=t?d.additionalProperties:d[e],n="hidden"===a.getUiOptions(i).widget,s=v.default(m,[e],{});return{content:r.jsx(A,{name:e,required:o.isRequired(e),schema:v.default(B,[a.PROPERTIES_KEY,e],{}),uiSchema:i,errorSchema:v.default(c,e),idSchema:s,idPrefix:C,idSeparator:j,formData:v.default(u,e),formContext:N,wasPropertyKeyModified:o.state.wasPropertyKeyModified,onKeyChange:o.onKeyChange(e),onChange:o.onPropertyChange(e,t),onBlur:F,onFocus:O,registry:I,disabled:y,readonly:b,hideError:x,onDropPropertyClick:o.onDropPropertyClick},e),name:e,readonly:b,disabled:y,required:f,hidden:n}})),readonly:b,disabled:y,required:f,idSchema:m,uiSchema:d,errorSchema:c,schema:B,formData:u,formContext:N,registry:I};return r.jsx(V,E({},K,{onAddClick:this.handleAddClick}))},t}(t.Component),G=["__errors"],J={array:"ArrayField",boolean:"BooleanField",integer:"NumberField",number:"NumberField",object:"ObjectField",string:"StringField",null:"NullField"};function H(e){var i=e.schema,n=e.idSchema,o=e.uiSchema,s=e.formData,l=e.errorSchema,d=e.idPrefix,u=e.idSeparator,c=e.name,m=e.onChange,p=e.onKeyChange,h=e.onDropPropertyClick,f=e.required,g=e.registry,v=e.wasPropertyKeyModified,y=void 0!==v&&v,S=g.formContext,b=g.schemaUtils,x=g.globalUiOptions,j=a.getUiOptions(o,x),O=a.getTemplate("FieldTemplate",g,j),T=a.getTemplate("DescriptionFieldTemplate",g,j),I=a.getTemplate("FieldHelpTemplate",g,j),N=a.getTemplate("FieldErrorTemplate",g,j),w=b.retrieveSchema(i,s),A=n[a.ID_KEY],B=a.mergeObjects(b.toIdSchema(w,A,s,d,u),n),U=t.useCallback((function(e,r,t){return m(e,r,t||A)}),[A,m]),_=function(e,t,i,n){var o=t.field,s=n.fields,l=n.translateString;if("function"==typeof o)return o;if("string"==typeof o&&o in s)return s[o];var d=a.getSchemaType(e),u=Array.isArray(d)?d[0]:d||"",c=e.$id,m=J[u];return c&&c in s&&(m=c),m||!e.anyOf&&!e.oneOf?m in s?s[m]:function(){var o=a.getTemplate("UnsupportedFieldTemplate",n,t);return r.jsx(o,{schema:e,idSchema:i,reason:l(a.TranslatableString.UnknownFieldType,[String(e.type)]),registry:n})}:function(){return null}}(w,j,B,g),P=Boolean(e.disabled||j.disabled),q=Boolean(e.readonly||j.readonly||e.schema.readOnly||w.readOnly),R=j.hideError,L=void 0===R?e.hideError:Boolean(R),V=Boolean(e.autofocus||j.autofocus);if(0===Object.keys(w).length)return null;var K=b.getDisplayLabel(w,o,x),M=l||{},W=M.__errors,Y=k(M,G),$=F.default(o,["ui:classNames","classNames","ui:style"]);a.UI_OPTIONS_KEY in $&&($[a.UI_OPTIONS_KEY]=F.default($[a.UI_OPTIONS_KEY],["classNames","style"]));var z,H=r.jsx(_,E({},e,{onChange:U,idSchema:B,schema:w,uiSchema:$,disabled:P,readonly:q,hideError:L,autofocus:V,errorSchema:Y,formContext:S,rawErrors:W})),Q=B[a.ID_KEY];z=y||a.ADDITIONAL_PROPERTY_FLAG in w?c:j.title||e.schema.title||w.title||c;var X=j.description||e.schema.description||w.description||"",Z=j.enableMarkdownInDescription?r.jsx(D.default,{children:X}):X,ee=j.help,re="hidden"===j.widget,te=["form-group","field","field-"+a.getSchemaType(w)];!L&&W&&W.length>0&&te.push("field-error has-error has-danger"),null!=o&&o.classNames&&te.push(o.classNames),j.classNames&&te.push(j.classNames);var ae=r.jsx(I,{help:ee,idSchema:B,schema:w,uiSchema:o,hasErrors:!L&&W&&W.length>0,registry:g}),ie=L?void 0:r.jsx(N,{errors:W,errorSchema:l,idSchema:B,schema:w,uiSchema:o,registry:g}),ne={description:r.jsx(T,{id:a.descriptionId(Q),description:Z,schema:w,uiSchema:o,registry:g}),rawDescription:X,help:ae,rawHelp:"string"==typeof ee?ee:void 0,errors:ie,rawErrors:L?void 0:W,id:Q,label:z,hidden:re,onChange:m,onKeyChange:p,onDropPropertyClick:h,required:f,disabled:P,readonly:q,hideError:L,displayLabel:K,classNames:te.join(" ").trim(),style:j.style,formContext:S,formData:s,schema:w,uiSchema:o,registry:g},oe=g.fields.AnyOfField,se=g.fields.OneOfField,le=(null==o?void 0:o["ui:field"])&&!0===(null==o?void 0:o["ui:fieldReplacesAnyOrOneOf"]);return r.jsx(O,E({},ne,{children:r.jsxs(r.Fragment,{children:[H,w.anyOf&&!le&&!b.isSelect(w)&&r.jsx(oe,{name:c,disabled:P,readonly:q,hideError:L,errorSchema:l,formData:s,formContext:S,idPrefix:d,idSchema:B,idSeparator:u,onBlur:e.onBlur,onChange:e.onChange,onFocus:e.onFocus,options:w.anyOf.map((function(e){return b.retrieveSchema(C.default(e)?e:{},s)})),registry:g,schema:w,uiSchema:o}),w.oneOf&&!le&&!b.isSelect(w)&&r.jsx(se,{name:c,disabled:P,readonly:q,hideError:L,errorSchema:l,formData:s,formContext:S,idPrefix:d,idSchema:B,idSeparator:u,onBlur:e.onBlur,onChange:e.onChange,onFocus:e.onFocus,options:w.oneOf.map((function(e){return b.retrieveSchema(C.default(e)?e:{},s)})),registry:g,schema:w,uiSchema:o})]})}))}var Q=function(e){function t(){return e.apply(this,arguments)||this}I(t,e);var i=t.prototype;return i.shouldComponentUpdate=function(e){return!a.deepEquals(this.props,e)},i.render=function(){return r.jsx(H,E({},this.props))},t}(t.Component),X=["widget","placeholder","title"];function Z(e){var t,i=e.schema,n=e.name,o=e.uiSchema,s=e.idSchema,l=e.formData,d=e.required,u=e.disabled,c=void 0!==u&&u,m=e.readonly,p=void 0!==m&&m,h=e.autofocus,f=void 0!==h&&h,g=e.onChange,v=e.onBlur,y=e.onFocus,S=e.registry,b=e.rawErrors,x=i.title,C=i.format,j=S.widgets,F=S.formContext,O=S.schemaUtils,D=S.globalUiOptions,T=O.isSelect(i)?a.optionsList(i):void 0,I=T?"select":"text";C&&a.hasWidget(i,C,j)&&(I=C);var N=a.getUiOptions(o),w=N.widget,A=void 0===w?I:w,B=N.placeholder,U=void 0===B?"":B,_=N.title,P=k(N,X),q=O.getDisplayLabel(i,o,D),R=null!=(t=null!=_?_:x)?t:n,L=a.getWidget(i,A,j);return r.jsx(L,{options:E({},P,{enumOptions:T}),schema:i,uiSchema:o,id:s.$id,name:n,label:R,hideLabel:!q,value:l,onChange:g,onBlur:v,onFocus:y,required:d,disabled:c,readonly:p,formContext:F,autofocus:f,registry:S,placeholder:U,rawErrors:b})}function ee(e){var r=e.formData,a=e.onChange;return t.useEffect((function(){void 0===r&&a(null)}),[r,a]),null}function re(e){var t=e.idSchema,i=e.description,n=e.registry,o=e.schema,s=e.uiSchema,l=a.getUiOptions(s,n.globalUiOptions),d=l.label;if(!i||void 0!==d&&!d)return null;var u=a.getTemplate("DescriptionFieldTemplate",n,l);return r.jsx(u,{id:a.descriptionId(t),description:i,schema:o,uiSchema:s,registry:n})}function te(e){var t=e.disabled,a=e.hasToolbar,i=e.hasMoveDown,n=e.hasMoveUp,o=e.hasRemove,s=e.hasCopy,l=e.index,d=e.onCopyIndexClick,u=e.onDropIndexClick,c=e.onReorderClick,m=e.readonly,p=e.registry,h=e.uiSchema,f=p.templates.ButtonTemplates,g=f.CopyButton,v=f.MoveDownButton,y=f.MoveUpButton,S=f.RemoveButton,b={flex:1,paddingLeft:6,paddingRight:6,fontWeight:"bold"};return r.jsxs("div",{className:e.className,children:[r.jsx("div",{className:a?"col-xs-9":"col-xs-12",children:e.children}),a&&r.jsx("div",{className:"col-xs-3 array-item-toolbox",children:r.jsxs("div",{className:"btn-group",style:{display:"flex",justifyContent:"space-around"},children:[(n||i)&&r.jsx(y,{style:b,disabled:t||m||!n,onClick:c(l,l-1),uiSchema:h,registry:p}),(n||i)&&r.jsx(v,{style:b,disabled:t||m||!i,onClick:c(l,l+1),uiSchema:h,registry:p}),s&&r.jsx(g,{style:b,disabled:t||m,onClick:d(l),uiSchema:h,registry:p}),o&&r.jsx(S,{style:b,disabled:t||m,onClick:u(l),uiSchema:h,registry:p})]})})]})}var ae=["key"];function ie(e){var t=e.canAdd,i=e.className,n=e.disabled,o=e.idSchema,s=e.uiSchema,l=e.items,d=e.onAddClick,u=e.readonly,c=e.registry,m=e.required,p=e.schema,h=e.title,f=a.getUiOptions(s),g=a.getTemplate("ArrayFieldDescriptionTemplate",c,f),v=a.getTemplate("ArrayFieldItemTemplate",c,f),y=a.getTemplate("ArrayFieldTitleTemplate",c,f),S=c.templates.ButtonTemplates.AddButton;return r.jsxs("fieldset",{className:i,id:o.$id,children:[r.jsx(y,{idSchema:o,title:f.title||h,required:m,schema:p,uiSchema:s,registry:c}),r.jsx(g,{idSchema:o,description:f.description||p.description,schema:p,uiSchema:s,registry:c}),r.jsx("div",{className:"row array-item-list",children:l&&l.map((function(e){var t=e.key,a=k(e,ae);return r.jsx(v,E({},a),t)}))}),t&&r.jsx(S,{className:"array-item-add",onClick:d,disabled:n||u,uiSchema:s,registry:c})]})}function ne(e){var t=e.idSchema,i=e.title,n=e.schema,o=e.uiSchema,s=e.required,l=e.registry,d=a.getUiOptions(o,l.globalUiOptions),u=d.label;if(!i||void 0!==u&&!u)return null;var c=a.getTemplate("TitleFieldTemplate",l,d);return r.jsx(c,{id:a.titleId(t),title:i,required:s,schema:n,uiSchema:o,registry:l})}var oe=["id","name","value","readonly","disabled","autofocus","onBlur","onFocus","onChange","onChangeOverride","options","schema","uiSchema","formContext","registry","rawErrors","type","hideLabel","hideError"];function se(e){var i=e.id,n=e.value,o=e.readonly,s=e.disabled,l=e.autofocus,d=e.onBlur,u=e.onFocus,c=e.onChange,m=e.onChangeOverride,p=e.options,h=e.schema,f=e.type,g=k(e,oe);if(!i)throw console.log("No id for",e),new Error("no id for props "+JSON.stringify(e));var v,y=E({},g,a.getInputProps(h,f,p));v="number"===y.type||"integer"===y.type?n||0===n?n:"":null==n?"":n;var S=t.useCallback((function(e){var r=e.target.value;return c(""===r?p.emptyValue:r)}),[c,p]),b=t.useCallback((function(e){return d(i,e.target.value)}),[d,i]),x=t.useCallback((function(e){return u(i,e.target.value)}),[u,i]);return r.jsxs(r.Fragment,{children:[r.jsx("input",E({id:i,name:i,className:"form-control",readOnly:o,disabled:s,autoFocus:l,value:v},y,{list:h.examples?a.examplesId(i):void 0,onChange:m||S,onBlur:b,onFocus:x,"aria-describedby":a.ariaDescribedByIds(i,!!h.examples)})),Array.isArray(h.examples)&&r.jsx("datalist",{id:a.examplesId(i),children:h.examples.concat(h.default&&!h.examples.includes(h.default)?[h.default]:[]).map((function(e){return r.jsx("option",{value:e},e)}))},"datalist_"+i)]})}function le(e){var t=a.getSubmitButtonOptions(e.uiSchema),i=t.props,n=void 0===i?{}:i;return t.norender?null:r.jsx("div",{children:r.jsx("button",E({type:"submit"},n,{className:"btn btn-info "+(n.className||""),children:t.submitText}))})}var de=["iconType","icon","className","uiSchema","registry"];function ue(e){var t=e.iconType,a=void 0===t?"default":t,i=e.icon,n=e.className,o=k(e,de);return r.jsx("button",E({type:"button",className:"btn btn-"+a+" "+n},o,{children:r.jsx("i",{className:"glyphicon glyphicon-"+i})}))}function ce(e){return r.jsx(ue,E({title:(0,e.registry.translateString)(a.TranslatableString.CopyButton),className:"array-item-copy"},e,{icon:"copy"}))}function me(e){return r.jsx(ue,E({title:(0,e.registry.translateString)(a.TranslatableString.MoveDownButton),className:"array-item-move-down"},e,{icon:"arrow-down"}))}function pe(e){return r.jsx(ue,E({title:(0,e.registry.translateString)(a.TranslatableString.MoveUpButton),className:"array-item-move-up"},e,{icon:"arrow-up"}))}function he(e){return r.jsx(ue,E({title:(0,e.registry.translateString)(a.TranslatableString.RemoveButton),className:"array-item-remove"},e,{iconType:"danger",icon:"remove"}))}function fe(e){var t=e.onClick,i=e.disabled,n=e.registry;return r.jsx("div",{className:"row",children:r.jsx("p",{className:"col-xs-3 col-xs-offset-9 text-right "+e.className,children:r.jsx(ue,{iconType:"info",icon:"plus",className:"btn-add col-xs-12",title:(0,n.translateString)(a.TranslatableString.AddButton),onClick:t,disabled:i,registry:n})})})}function ge(e){var t=e.description;return t?r.jsx("string"==typeof t?"p":"div",{id:e.id,className:"field-description",children:t}):null}function ve(e){var t=e.errors;return r.jsxs("div",{className:"panel panel-danger errors",children:[r.jsx("div",{className:"panel-heading",children:r.jsx("h3",{className:"panel-title",children:(0,e.registry.translateString)(a.TranslatableString.ErrorsLabel)})}),r.jsx("ul",{className:"list-group",children:t.map((function(e,t){return r.jsx("li",{className:"list-group-item text-danger",children:e.stack},t)}))})]})}var ye="*";function Se(e){var t=e.label;return t?r.jsxs("label",{className:"control-label",htmlFor:e.id,children:[t,e.required&&r.jsx("span",{className:"required",children:ye})]}):null}function be(e){var t=e.id,i=e.label,n=e.children,o=e.errors,s=e.help,l=e.description,d=e.hidden,u=e.required,c=e.displayLabel,m=e.registry,p=a.getUiOptions(e.uiSchema),h=a.getTemplate("WrapIfAdditionalTemplate",m,p);return d?r.jsx("div",{className:"hidden",children:n}):r.jsxs(h,E({},e,{children:[c&&r.jsx(Se,{label:i,required:u,id:t}),c&&l?l:null,n,o,s]}))}function xe(e){var t=e.errors,i=void 0===t?[]:t;if(0===i.length)return null;var n=a.errorId(e.idSchema);return r.jsx("div",{children:r.jsx("ul",{id:n,className:"error-detail bs-callout bs-callout-info",children:i.filter((function(e){return!!e})).map((function(e,t){return r.jsx("li",{className:"text-danger",children:e},t)}))})})}function Ce(e){var t=e.help;if(!t)return null;var i=a.helpId(e.idSchema);return r.jsx("string"==typeof t?"p":"div",{id:i,className:"help-block",children:t})}function je(e){var t=e.description,i=e.disabled,n=e.formData,o=e.idSchema,s=e.onAddClick,l=e.properties,d=e.readonly,u=e.registry,c=e.required,m=e.schema,p=e.title,h=e.uiSchema,f=a.getUiOptions(h),g=a.getTemplate("TitleFieldTemplate",u,f),v=a.getTemplate("DescriptionFieldTemplate",u,f),y=u.templates.ButtonTemplates.AddButton;return r.jsxs("fieldset",{id:o.$id,children:[p&&r.jsx(g,{id:a.titleId(o),title:p,required:c,schema:m,uiSchema:h,registry:u}),t&&r.jsx(v,{id:a.descriptionId(o),description:t,schema:m,uiSchema:h,registry:u}),l.map((function(e){return e.content})),a.canExpand(m,h,n)&&r.jsx(y,{className:"object-property-expand",onClick:s(m),disabled:i||d,uiSchema:h,registry:u})]})}var Fe="*";function Oe(e){return r.jsxs("legend",{id:e.id,children:[e.title,e.required&&r.jsx("span",{className:"required",children:Fe})]})}function De(e){var t=e.schema,i=e.idSchema,n=e.reason,o=e.registry.translateString,s=a.TranslatableString.UnsupportedField,l=[];return i&&i.$id&&(s=a.TranslatableString.UnsupportedFieldWithId,l.push(i.$id)),n&&(s=s===a.TranslatableString.UnsupportedField?a.TranslatableString.UnsupportedFieldWithReason:a.TranslatableString.UnsupportedFieldWithIdAndReason,l.push(n)),r.jsxs("div",{className:"unsupported-field",children:[r.jsx("p",{children:r.jsx(D.default,{children:o(s,l)})}),t&&r.jsx("pre",{children:JSON.stringify(t,null,2)})]})}function Te(e){var t=e.id,i=e.classNames,n=e.style,o=e.disabled,s=e.label,l=e.onKeyChange,d=e.onDropPropertyClick,u=e.readonly,c=e.required,m=e.schema,p=e.children,h=e.uiSchema,f=e.registry,g=f.templates.ButtonTemplates.RemoveButton,v=(0,f.translateString)(a.TranslatableString.KeyLabel,[s]);return r.jsx("div",a.ADDITIONAL_PROPERTY_FLAG in m?{className:i,style:n,children:r.jsxs("div",{className:"row",children:[r.jsx("div",{className:"col-xs-5 form-additional",children:r.jsxs("div",{className:"form-group",children:[r.jsx(Se,{label:v,required:c,id:t+"-key"}),r.jsx("input",{className:"form-control",type:"text",id:t+"-key",onBlur:function(e){return l(e.target.value)},defaultValue:s})]})}),r.jsx("div",{className:"form-additional form-group col-xs-5",children:p}),r.jsx("div",{className:"col-xs-2",children:r.jsx(g,{className:"array-item-remove btn-block",style:{border:"0"},disabled:o||u,onClick:d(s),uiSchema:h,registry:f})})]})}:{className:i,style:n,children:p})}function Ee(e,r){for(var t=[],i=e;i<=r;i++)t.push({value:i,label:a.pad(i,2)});return t}function Ie(e,r,t){void 0===t&&(t=[1900,(new Date).getFullYear()+2]);var a=[{type:"year",range:t,value:e.year},{type:"month",range:[1,12],value:e.month},{type:"day",range:[1,31],value:e.day}];return r&&a.push({type:"hour",range:[0,23],value:e.hour},{type:"minute",range:[0,59],value:e.minute},{type:"second",range:[0,59],value:e.second}),a}function Ne(e){var t=e.type,i=e.range,n=e.value,o=e.select,s=e.rootId,l=e.disabled,d=e.readonly,u=e.autofocus,c=e.registry,m=e.onBlur,p=e.onFocus;return r.jsx(c.widgets.SelectWidget,{schema:{type:"integer"},id:s+"_"+t,name:e.name,className:"form-control",options:{enumOptions:Ee(i[0],i[1])},placeholder:t,value:n,disabled:l,readonly:d,autofocus:u,onChange:function(e){return o(t,e)},onBlur:m,onFocus:p,registry:c,label:"","aria-describedby":a.ariaDescribedByIds(s)})}function ke(e){var i=e.time,n=void 0!==i&&i,o=e.disabled,s=void 0!==o&&o,l=e.readonly,d=void 0!==l&&l,u=e.autofocus,c=void 0!==u&&u,m=e.options,p=e.id,h=e.name,f=e.registry,g=e.onBlur,v=e.onFocus,y=e.onChange,S=e.value,b=f.translateString,x=t.useState(S),C=x[0],j=x[1],F=t.useReducer((function(e,r){return E({},e,r)}),a.parseDateString(S,n)),O=F[0],D=F[1];t.useEffect((function(){var e=a.toDateString(O,n);!function(e){return Object.values(e).every((function(e){return-1!==e}))}(O)||e===S?C!==S&&(j(S),D(a.parseDateString(S,n))):y(e)}),[n,S,y,O,C]);var T=t.useCallback((function(e,r){var t;D(((t={})[e]=r,t))}),[]),I=t.useCallback((function(e){if(e.preventDefault(),!s&&!d){var r=a.parseDateString((new Date).toJSON(),n);y(a.toDateString(r,n))}}),[s,d,n]),N=t.useCallback((function(e){e.preventDefault(),s||d||y(void 0)}),[s,d,y]);return r.jsxs("ul",{className:"list-inline",children:[Ie(O,n,m.yearsRange).map((function(e,t){return r.jsx("li",{className:"list-inline-item",children:r.jsx(Ne,E({rootId:p,name:h,select:T},e,{disabled:s,readonly:d,registry:f,onBlur:g,onFocus:v,autofocus:c&&0===t}))},t)})),("undefined"===m.hideNowButton||!m.hideNowButton)&&r.jsx("li",{className:"list-inline-item",children:r.jsx("a",{href:"#",className:"btn btn-info btn-now",onClick:I,children:b(a.TranslatableString.NowLabel)})}),("undefined"===m.hideClearButton||!m.hideClearButton)&&r.jsx("li",{className:"list-inline-item",children:r.jsx("a",{href:"#",className:"btn btn-warning btn-clear",onClick:N,children:b(a.TranslatableString.ClearLabel)})})]})}var we=["time"];function Ae(e){var t=e.time,a=void 0===t||t,i=k(e,we);return r.jsx(i.registry.widgets.AltDateWidget,E({time:a},i))}function Be(e){var i,n=e.schema,o=e.uiSchema,s=e.options,l=e.id,d=e.value,u=e.disabled,c=e.readonly,m=e.label,p=e.hideLabel,h=e.autofocus,f=void 0!==h&&h,g=e.onBlur,v=e.onFocus,y=e.onChange,S=e.registry,b=a.getTemplate("DescriptionFieldTemplate",S,s),x=a.schemaRequiresTrueValue(n),C=t.useCallback((function(e){return y(e.target.checked)}),[y]),j=t.useCallback((function(e){return g(l,e.target.checked)}),[g,l]),F=t.useCallback((function(e){return v(l,e.target.checked)}),[v,l]),O=null!=(i=s.description)?i:n.description;return r.jsxs("div",{className:"checkbox "+(u||c?"disabled":""),children:[!p&&!!O&&r.jsx(b,{id:a.descriptionId(l),description:O,schema:n,uiSchema:o,registry:S}),r.jsxs("label",{children:[r.jsx("input",{type:"checkbox",id:l,name:l,checked:void 0!==d&&d,required:x,disabled:u||c,autoFocus:f,onChange:C,onBlur:j,onFocus:F,"aria-describedby":a.ariaDescribedByIds(l)}),a.labelValue(r.jsx("span",{children:m}),p)]})]})}function Ue(e){var i=e.id,n=e.disabled,o=e.options,s=o.inline,l=void 0!==s&&s,d=o.enumOptions,u=o.enumDisabled,c=o.emptyValue,m=e.value,p=e.autofocus,h=void 0!==p&&p,f=e.readonly,g=e.onChange,v=e.onBlur,y=e.onFocus,S=Array.isArray(m)?m:[m],b=t.useCallback((function(e){return v(i,a.enumOptionsValueForIndex(e.target.value,d,c))}),[v,i]),x=t.useCallback((function(e){return y(i,a.enumOptionsValueForIndex(e.target.value,d,c))}),[y,i]);return r.jsx("div",{className:"checkboxes",id:i,children:Array.isArray(d)&&d.map((function(e,t){var o=a.enumOptionsIsSelected(e.value,S),s=Array.isArray(u)&&-1!==u.indexOf(e.value),c=n||s||f?"disabled":"",m=r.jsxs("span",{children:[r.jsx("input",{type:"checkbox",id:a.optionId(i,t),name:i,checked:o,value:String(t),disabled:n||s||f,autoFocus:h&&0===t,onChange:function(e){g(e.target.checked?a.enumOptionsSelectValue(t,S,d):a.enumOptionsDeselectValue(t,S,d))},onBlur:b,onFocus:x,"aria-describedby":a.ariaDescribedByIds(i)}),r.jsx("span",{children:e.label})]});return l?r.jsx("label",{className:"checkbox-inline "+c,children:m},t):r.jsx("div",{className:"checkbox "+c,children:r.jsx("label",{children:m})},t)}))})}function _e(e){var t=e.disabled,i=e.readonly,n=a.getTemplate("BaseInputTemplate",e.registry,e.options);return r.jsx(n,E({type:"color"},e,{disabled:t||i}))}function Pe(e){var i=e.onChange,n=a.getTemplate("BaseInputTemplate",e.registry,e.options),o=t.useCallback((function(e){return i(e||void 0)}),[i]);return r.jsx(n,E({type:"date"},e,{onChange:o}))}function qe(e){var t=e.onChange,i=e.value,n=a.getTemplate("BaseInputTemplate",e.registry,e.options);return r.jsx(n,E({type:"datetime-local"},e,{value:a.utcToLocal(i),onChange:function(e){return t(a.localToUTC(e))}}))}function Re(e){var t=a.getTemplate("BaseInputTemplate",e.registry,e.options);return r.jsx(t,E({type:"email"},e))}function Le(e,r){return null===e?null:e.replace(";base64",";name="+encodeURIComponent(r)+";base64")}function Ve(e){var r=e.name,t=e.size,a=e.type;return new Promise((function(i,n){var o=new window.FileReader;o.onerror=n,o.onload=function(e){var n;"string"==typeof(null===(n=e.target)||void 0===n?void 0:n.result)?i({dataURL:Le(e.target.result,r),name:r,size:t,type:a}):i({dataURL:null,name:r,size:t,type:a})},o.readAsDataURL(e)}))}function Ke(e){var t=e.fileInfo,i=e.registry.translateString,n=t.dataURL,o=t.name;return n?-1!==t.type.indexOf("image")?r.jsx("img",{src:n,style:{maxWidth:"100%"},className:"file-preview"}):r.jsxs(r.Fragment,{children:[" ",r.jsx("a",{download:"preview-"+o,href:n,className:"file-download",children:i(a.TranslatableString.PreviewLabel)})]}):null}function Me(e){var t=e.filesInfo,i=e.registry,n=e.preview;if(0===t.length)return null;var o=i.translateString;return r.jsx("ul",{className:"file-info",children:t.map((function(e,t){return r.jsxs("li",{children:[r.jsx(D.default,{children:o(a.TranslatableString.FilesInfo,[e.name,e.type,String(e.size)])}),n&&r.jsx(Ke,{fileInfo:e,registry:i})]},t)}))})}function We(e){return e.filter((function(e){return e})).map((function(e){var r=a.dataURItoBlob(e),t=r.blob;return{dataURL:e,name:r.name,size:t.size,type:t.type}}))}function Ye(e){var i=e.disabled,n=e.readonly,o=e.required,s=e.multiple,l=e.onChange,d=e.value,u=e.options,c=e.registry,m=a.getTemplate("BaseInputTemplate",c,u),p=t.useState(Array.isArray(d)?We(d):We([d])),h=p[0],f=p[1],g=t.useCallback((function(e){var r;e.target.files&&(r=e.target.files,Promise.all(Array.from(r).map(Ve))).then((function(e){var r=e.map((function(e){return e.dataURL}));s?(f(h.concat(e[0])),l(d.concat(r[0]))):(f(e),l(r[0]))}))}),[s,d,h,l]);return r.jsxs("div",{children:[r.jsx(m,E({},e,{disabled:i||n,type:"file",required:!d&&o,onChangeOverride:g,value:"",accept:u.accept?String(u.accept):void 0})),r.jsx(Me,{filesInfo:h,registry:c,preview:u.filePreview})]})}function $e(e){var t=e.id,a=e.value;return r.jsx("input",{type:"hidden",id:t,name:t,value:void 0===a?"":a})}function ze(e){var t=a.getTemplate("BaseInputTemplate",e.registry,e.options);return r.jsx(t,E({type:"password"},e))}function Ge(e){var i=e.options,n=e.value,o=e.required,s=e.disabled,l=e.readonly,d=e.autofocus,u=void 0!==d&&d,c=e.onBlur,m=e.onFocus,p=e.onChange,h=e.id,f=i.enumOptions,g=i.enumDisabled,v=i.inline,y=i.emptyValue,S=t.useCallback((function(e){return c(h,a.enumOptionsValueForIndex(e.target.value,f,y))}),[c,h]),b=t.useCallback((function(e){return m(h,a.enumOptionsValueForIndex(e.target.value,f,y))}),[m,h]);return r.jsx("div",{className:"field-radio-group",id:h,children:Array.isArray(f)&&f.map((function(e,t){var i=a.enumOptionsIsSelected(e.value,n),d=Array.isArray(g)&&-1!==g.indexOf(e.value),c=s||d||l?"disabled":"",m=r.jsxs("span",{children:[r.jsx("input",{type:"radio",id:a.optionId(h,t),checked:i,name:h,required:o,value:String(t),disabled:s||d||l,autoFocus:u&&0===t,onChange:function(){return p(e.value)},onBlur:S,onFocus:b,"aria-describedby":a.ariaDescribedByIds(h)}),r.jsx("span",{children:e.label})]});return v?r.jsx("label",{className:"radio-inline "+c,children:m},t):r.jsx("div",{className:"radio "+c,children:r.jsx("label",{children:m})},t)}))})}function Je(e){var t=e.value;return r.jsxs("div",{className:"field-range-wrapper",children:[r.jsx(e.registry.templates.BaseInputTemplate,E({type:"range"},e)),r.jsx("span",{className:"range-view",children:t})]})}function He(e,r){return r?Array.from(e.target.options).slice().filter((function(e){return e.selected})).map((function(e){return e.value})):e.target.value}function Qe(e){var i=e.schema,n=e.id,o=e.options,s=e.value,l=e.required,d=e.disabled,u=e.readonly,c=e.multiple,m=void 0!==c&&c,p=e.autofocus,h=void 0!==p&&p,f=e.onChange,g=e.onBlur,v=e.onFocus,y=e.placeholder,S=o.enumOptions,b=o.enumDisabled,x=o.emptyValue,C=m?[]:"",j=t.useCallback((function(e){var r=He(e,m);return v(n,a.enumOptionsValueForIndex(r,S,x))}),[v,n,i,m,o]),F=t.useCallback((function(e){var r=He(e,m);return g(n,a.enumOptionsValueForIndex(r,S,x))}),[g,n,i,m,o]),O=t.useCallback((function(e){var r=He(e,m);return f(a.enumOptionsValueForIndex(r,S,x))}),[f,i,m,o]),D=a.enumOptionsIndexForValue(s,S,m);return r.jsxs("select",{id:n,name:n,multiple:m,className:"form-control",value:void 0===D?C:D,required:l,disabled:d||u,autoFocus:h,onBlur:F,onFocus:j,onChange:O,"aria-describedby":a.ariaDescribedByIds(n),children:[!m&&void 0===i.default&&r.jsx("option",{value:"",children:y}),Array.isArray(S)&&S.map((function(e,t){var a=e.label,i=b&&-1!==b.indexOf(e.value);return r.jsx("option",{value:String(t),disabled:i,children:a},t)}))]})}function Xe(e){var i=e.id,n=e.options,o=void 0===n?{}:n,s=e.placeholder,l=e.value,d=e.required,u=e.disabled,c=e.readonly,m=e.autofocus,p=void 0!==m&&m,h=e.onChange,f=e.onBlur,g=e.onFocus,v=t.useCallback((function(e){var r=e.target.value;return h(""===r?o.emptyValue:r)}),[h,o.emptyValue]),y=t.useCallback((function(e){return f(i,e.target.value)}),[f,i]),S=t.useCallback((function(e){return g(i,e.target.value)}),[i,g]);return r.jsx("textarea",{id:i,name:i,className:"form-control",value:l||"",placeholder:s,required:d,disabled:u,readOnly:c,autoFocus:p,rows:o.rows,onBlur:y,onFocus:S,onChange:v,"aria-describedby":a.ariaDescribedByIds(i)})}function Ze(e){var t=a.getTemplate("BaseInputTemplate",e.registry,e.options);return r.jsx(t,E({},e))}function er(e){var i=e.onChange,n=a.getTemplate("BaseInputTemplate",e.registry,e.options),o=t.useCallback((function(e){return i(e?e+":00":void 0)}),[i]);return r.jsx(n,E({type:"time"},e,{onChange:o}))}function rr(e){var t=a.getTemplate("BaseInputTemplate",e.registry,e.options);return r.jsx(t,E({type:"url"},e))}function tr(e){var t=a.getTemplate("BaseInputTemplate",e.registry,e.options);return r.jsx(t,E({type:"number"},e))}function ar(){return{fields:{AnyOfField:M,ArrayField:q,BooleanField:L,NumberField:$,ObjectField:z,OneOfField:M,SchemaField:Q,StringField:Z,NullField:ee},templates:{ArrayFieldDescriptionTemplate:re,ArrayFieldItemTemplate:te,ArrayFieldTemplate:ie,ArrayFieldTitleTemplate:ne,ButtonTemplates:{SubmitButton:le,AddButton:fe,CopyButton:ce,MoveDownButton:me,MoveUpButton:pe,RemoveButton:he},BaseInputTemplate:se,DescriptionFieldTemplate:ge,ErrorListTemplate:ve,FieldTemplate:be,FieldErrorTemplate:xe,FieldHelpTemplate:Ce,ObjectFieldTemplate:je,TitleFieldTemplate:Oe,UnsupportedFieldTemplate:De,WrapIfAdditionalTemplate:Te},widgets:{AltDateWidget:ke,AltDateTimeWidget:Ae,CheckboxWidget:Be,CheckboxesWidget:Ue,ColorWidget:_e,DateWidget:Pe,DateTimeWidget:qe,EmailWidget:Re,FileWidget:Ye,HiddenWidget:$e,PasswordWidget:ze,RadioWidget:Ge,RangeWidget:Je,SelectWidget:Qe,TextWidget:Ze,TextareaWidget:Xe,TimeWidget:er,UpDownWidget:tr,URLWidget:rr},rootSchema:{},formContext:{},translateString:a.englishStringTranslator}}Xe.defaultProps={autofocus:!1,options:{}};var ir=function(e){function i(r){var i;if((i=e.call(this,r)||this).formElement=void 0,i.getUsedFormData=function(e,r){if(0===r.length&&"object"!=typeof e)return e;var t=S.default(e,r);return Array.isArray(e)?Object.keys(t).map((function(e){return t[e]})):t},i.getFieldNames=function(e,r){return function e(t,i,n){return void 0===i&&(i=[]),void 0===n&&(n=[[]]),Object.keys(t).forEach((function(o){if("object"==typeof t[o]){var s=n.map((function(e){return[].concat(e,[o])}));t[o][a.RJSF_ADDITONAL_PROPERTIES_FLAG]&&""!==t[o][a.NAME_KEY]?i.push(t[o][a.NAME_KEY]):e(t[o],i,s)}else o===a.NAME_KEY&&""!==t[o]&&n.forEach((function(e){var t=v.default(r,e);("object"!=typeof t||y.default(t))&&i.push(e)}))})),i}(e)},i.onChange=function(e,r,t){var n=i.props,o=n.extraErrors,s=n.omitExtraData,l=n.liveOmit,d=n.noValidate,u=n.liveValidate,c=n.onChange,m=i.state,p=m.schemaUtils,h=m.schema;(a.isObject(e)||Array.isArray(e))&&(e=i.getStateFromProps(i.props,e).formData);var f=!d&&u,g={formData:e,schema:h},v=e;if(!0===s&&!0===l){var y=p.retrieveSchema(h,e),S=p.toPathSchema(y,"",e),b=i.getFieldNames(S,e);v=i.getUsedFormData(e,b),g={formData:v}}if(f){var x=i.validate(v),C=x.errors,j=x.errorSchema,F=C,O=j;if(o){var D=a.validationDataMerge(x,o);j=D.errorSchema,C=D.errors}g={formData:v,errors:C,errorSchema:j,schemaValidationErrors:F,schemaValidationErrorSchema:O}}else if(!d&&r){var T=o?a.mergeObjects(r,o,"preventDuplicates"):r;g={formData:v,errorSchema:T,errors:a.toErrorList(T)}}i.setState(g,(function(){return c&&c(E({},i.state,g),t)}))},i.reset=function(){var e=i.props.onChange,r={formData:i.getStateFromProps(i.props,void 0).formData,errorSchema:{},errors:[],schemaValidationErrors:[],schemaValidationErrorSchema:{}};i.setState(r,(function(){return e&&e(E({},i.state,r))}))},i.onBlur=function(e,r){var t=i.props.onBlur;t&&t(e,r)},i.onFocus=function(e,r){var t=i.props.onFocus;t&&t(e,r)},i.onSubmit=function(e){if(e.preventDefault(),e.target===e.currentTarget){e.persist();var r=i.props,t=r.extraErrors,n=r.noValidate,o=r.onSubmit,s=i.state.formData,l=i.state,d=l.schemaUtils;if(!0===r.omitExtraData){var u=d.retrieveSchema(l.schema,s),c=d.toPathSchema(u,"",s),m=i.getFieldNames(c,s);s=i.getUsedFormData(s,m)}if(n||i.validateForm()){var p=t||{},h=t?a.toErrorList(t):[];i.setState({formData:s,errors:h,errorSchema:p,schemaValidationErrors:[],schemaValidationErrorSchema:{}},(function(){o&&o(E({},i.state,{formData:s,status:"submitted"}),e)}))}}},!r.validator)throw new Error("A validator is required for Form functionality to work");return i.state=i.getStateFromProps(r,r.formData),i.props.onChange&&!a.deepEquals(i.state.formData,i.props.formData)&&i.props.onChange(i.state),i.formElement=t.createRef(),i}I(i,e);var n=i.prototype;return n.UNSAFE_componentWillReceiveProps=function(e){var r=this.getStateFromProps(e,e.formData);a.deepEquals(r.formData,e.formData)||a.deepEquals(r.formData,this.state.formData)||!e.onChange||e.onChange(r),this.setState(r)},n.getStateFromProps=function(e,r){var t=this.state||{},i="schema"in e?e.schema:this.props.schema,n=("uiSchema"in e?e.uiSchema:this.props.uiSchema)||{},o=void 0!==r,s=o&&!e.noValidate&&("liveValidate"in e?e.liveValidate:this.props.liveValidate),l=i,d="experimental_defaultFormStateBehavior"in e?e.experimental_defaultFormStateBehavior:this.props.experimental_defaultFormStateBehavior,u=t.schemaUtils;u&&!u.doesSchemaUtilsDiffer(e.validator,l,d)||(u=a.createSchemaUtils(e.validator,l,d));var c,m,p=u.getDefaultFormState(i,r),h=u.retrieveSchema(i,p),f=t.schemaValidationErrors,g=t.schemaValidationErrorSchema;if(s){var v=this.validate(p,i,u);f=c=v.errors,g=m=v.errorSchema}else{var y=e.noValidate?{errors:[],errorSchema:{}}:e.liveValidate?{errors:t.errors||[],errorSchema:t.errorSchema||{}}:{errors:t.schemaValidationErrors||[],errorSchema:t.schemaValidationErrorSchema||{}};c=y.errors,m=y.errorSchema}if(e.extraErrors){var S=a.validationDataMerge({errorSchema:m,errors:c},e.extraErrors);m=S.errorSchema,c=S.errors}var b=u.toIdSchema(h,n["ui:rootFieldId"],p,e.idPrefix,e.idSeparator);return{schemaUtils:u,schema:i,uiSchema:n,idSchema:b,formData:p,edit:o,errors:c,errorSchema:m,schemaValidationErrors:f,schemaValidationErrorSchema:g}},n.shouldComponentUpdate=function(e,r){return a.shouldRender(this,e,r)},n.validate=function(e,r,t){void 0===r&&(r=this.props.schema);var a=t||this.state.schemaUtils,i=this.props,n=i.customValidate,o=i.transformErrors,s=i.uiSchema,l=a.retrieveSchema(r,e);return a.getValidator().validateFormData(e,l,n,o,s)},n.renderErrors=function(e){var t=this.state,i=t.errors,n=t.errorSchema,o=t.schema,s=t.uiSchema,l=this.props.formContext,d=a.getUiOptions(s),u=a.getTemplate("ErrorListTemplate",e,d);return i&&i.length?r.jsx(u,{errors:i,errorSchema:n||{},schema:o,uiSchema:s,formContext:l,registry:e}):null},n.getRegistry=function(){var e,r=this.props,t=r.translateString,i=r.uiSchema,n=void 0===i?{}:i,o=this.state.schemaUtils,s=ar(),l=s.templates,d=s.widgets,u=s.formContext,c=s.translateString;return{fields:E({},s.fields,this.props.fields),templates:E({},l,this.props.templates,{ButtonTemplates:E({},l.ButtonTemplates,null===(e=this.props.templates)||void 0===e?void 0:e.ButtonTemplates)}),widgets:E({},d,this.props.widgets),rootSchema:this.props.schema,formContext:this.props.formContext||u,schemaUtils:o,translateString:t||c,globalUiOptions:n[a.UI_GLOBAL_OPTIONS_KEY]}},n.submit=function(){this.formElement.current&&(this.formElement.current.dispatchEvent(new CustomEvent("submit",{cancelable:!0})),this.formElement.current.requestSubmit())},n.focusOnError=function(e){var r=this.props,t=r.idPrefix,a=void 0===t?"root":t,i=r.idSeparator,n=void 0===i?"_":i,o=b.default(e.property);""===o[0]?o[0]=a:o.unshift(a);var s=o.join(n),l=this.formElement.current.elements[s];l||(l=this.formElement.current.querySelector("input[id^="+s)),l&&l.length&&(l=l[0]),l&&l.focus()},n.validateForm=function(){var e=this.props,r=e.extraErrors,t=e.focusOnFirstError,i=e.onError,n=this.validate(this.state.formData),o=n.errors,s=n.errorSchema,l=o,d=s;if(o.length>0){if(r){var u=a.validationDataMerge(n,r);s=u.errorSchema,o=u.errors}return t&&("function"==typeof t?t(n.errors[0]):this.focusOnError(n.errors[0])),this.setState({errors:o,errorSchema:s,schemaValidationErrors:l,schemaValidationErrorSchema:d},(function(){i?i(o):console.error("Form validation failed",o)})),!1}return!0},n.render=function(){var e,t,i=this.props,n=i.children,o=i.id,s=i.idPrefix,l=i.idSeparator,d=i.className,u=void 0===d?"":d,c=i.tagName,m=i.name,p=i.method,h=i.target,f=i.action,g=i.autoComplete,v=i.enctype,y=i.acceptcharset,S=i.noHtml5Validate,b=void 0!==S&&S,x=i.disabled,C=void 0!==x&&x,j=i.readonly,F=void 0!==j&&j,O=i.formContext,D=i.showErrorList,T=void 0===D?"top":D,I=i._internalFormWrapper,N=this.state,k=N.schema,w=N.uiSchema,A=N.formData,B=N.errorSchema,U=N.idSchema,_=this.getRegistry(),P=_.fields.SchemaField,q=_.templates.ButtonTemplates.SubmitButton,R=I?c:void 0,L=I||c||"form",V=a.getUiOptions(w)[a.SUBMIT_BTN_OPTIONS_KEY],K=void 0===V?{}:V;C&&(K=E({},K,{props:E({},K.props,{disabled:!0})}));var M=((t={})[a.UI_OPTIONS_KEY]=((e={})[a.SUBMIT_BTN_OPTIONS_KEY]=K,e),t);return r.jsxs(L,{className:u||"rjsf",id:o,name:m,method:p,target:h,action:f,autoComplete:g,encType:v,acceptCharset:y,noValidate:b,onSubmit:this.onSubmit,as:R,ref:this.formElement,children:["top"===T&&this.renderErrors(_),r.jsx(P,{name:"",schema:k,uiSchema:w,errorSchema:B,idSchema:U,idPrefix:s,idSeparator:l,formContext:O,formData:A,onChange:this.onChange,onBlur:this.onBlur,onFocus:this.onFocus,registry:_,disabled:C,readonly:F}),n||r.jsx(q,{uiSchema:M,registry:_}),"bottom"===T&&this.renderErrors(_)]})},i}(t.Component),nr=["fields","widgets","templates"];e.default=ir,e.getDefaultRegistry=ar,e.withTheme=function(e){return t.forwardRef((function(t,a){var i,n,o=t.fields,s=t.widgets,l=t.templates,d=k(t,nr);return o=E({},null==e?void 0:e.fields,o),s=E({},null==e?void 0:e.widgets,s),l=E({},null==e?void 0:e.templates,l,{ButtonTemplates:E({},null==e||null===(i=e.templates)||void 0===i?void 0:i.ButtonTemplates,null===(n=l)||void 0===n?void 0:n.ButtonTemplates)}),r.jsx(ir,E({},e,d,{fields:o,widgets:s,templates:l,ref:a}))}))},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react/jsx-runtime"),require("react"),require("@rjsf/utils"),require("lodash-es/get"),require("lodash-es/isEmpty"),require("lodash-es/pick"),require("lodash-es/toPath"),require("lodash-es/cloneDeep"),require("lodash-es/isObject"),require("lodash-es/set"),require("nanoid"),require("lodash-es/omit"),require("lodash-es/unset"),require("markdown-to-jsx"),require("lodash-es/has")):"function"==typeof define&&define.amd?define(["exports","react/jsx-runtime","react","@rjsf/utils","lodash-es/get","lodash-es/isEmpty","lodash-es/pick","lodash-es/toPath","lodash-es/cloneDeep","lodash-es/isObject","lodash-es/set","nanoid","lodash-es/omit","lodash-es/unset","markdown-to-jsx","lodash-es/has"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).JSONSchemaForm={},e.jsxRuntime,e.React,e.utils,e.get,e.isEmpty,e._pick,e._toPath,e.cloneDeep,e.isObject,e.set,e.nanoid,e.omit,e.unset,e.Markdown,e.has)}(this,(function(e,t,r,a,i,s,o,n,l,d,c,m,u,h,p,g){"use strict";function f(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var y=f(i),S=f(s),b=f(o),x=f(n),v=f(l),C=f(d),F=f(c),j=f(u),D=f(h),O=f(p),T=f(g);function E(){return m.nanoid()}function I(e){return Array.isArray(e)?e.map((e=>({key:E(),item:e}))):[]}function N(e){return Array.isArray(e)?e.map((e=>e.item)):[]}class k extends r.Component{constructor(e){super(e),this._getNewFormDataRow=()=>{const{schema:e,registry:t}=this.props,{schemaUtils:r}=t;let i=e.items;return a.isFixedItems(e)&&a.allowAdditionalItems(e)&&(i=e.additionalItems),r.getDefaultFormState(i)},this.onAddClick=e=>{this._handleAddClick(e)},this.onAddIndexClick=e=>t=>{this._handleAddClick(t,e)},this.onCopyIndexClick=e=>t=>{t&&t.preventDefault();const{onChange:r}=this.props,{keyedFormData:a}=this.state,i={key:E(),item:v.default(a[e].item)},s=[...a];void 0!==e?s.splice(e+1,0,i):s.push(i),this.setState({keyedFormData:s,updatedKeyedFormData:!0},(()=>r(N(s))))},this.onDropIndexClick=e=>t=>{t&&t.preventDefault();const{onChange:r,errorSchema:a}=this.props,{keyedFormData:i}=this.state;let s;if(a){s={};for(const t in a){const r=parseInt(t);r<e?F.default(s,[r],a[t]):r>e&&F.default(s,[r-1],a[t])}}const o=i.filter(((t,r)=>r!==e));this.setState({keyedFormData:o,updatedKeyedFormData:!0},(()=>r(N(o),s)))},this.onReorderClick=(e,t)=>r=>{r&&(r.preventDefault(),r.currentTarget.blur());const{onChange:a,errorSchema:i}=this.props;let s;if(i){s={};for(const r in i){const a=parseInt(r);a==e?F.default(s,[t],i[e]):a==t?F.default(s,[e],i[t]):F.default(s,[r],i[a])}}const{keyedFormData:o}=this.state,n=function(){const r=o.slice();return r.splice(e,1),r.splice(t,0,o[e]),r}();this.setState({keyedFormData:n},(()=>a(N(n),s)))},this.onChangeForIndex=e=>(t,r,a)=>{const{formData:i,onChange:s,errorSchema:o}=this.props;s((Array.isArray(i)?i:[]).map(((r,a)=>e===a?void 0===t?null:t:r)),o&&o&&{...o,[e]:r},a)},this.onSelectChange=e=>{const{onChange:t,idSchema:r}=this.props;t(e,void 0,r&&r.$id)};const{formData:t=[]}=e,r=I(t);this.state={keyedFormData:r,updatedKeyedFormData:!1}}static getDerivedStateFromProps(e,t){if(t.updatedKeyedFormData)return{updatedKeyedFormData:!1};const r=Array.isArray(e.formData)?e.formData:[],a=t.keyedFormData||[];return{keyedFormData:r.length===a.length?a.map(((e,t)=>({key:e.key,item:r[t]}))):I(r)}}get itemTitle(){const{schema:e,registry:t}=this.props,{translateString:r}=t;return y.default(e,[a.ITEMS_KEY,"title"],y.default(e,[a.ITEMS_KEY,"description"],r(a.TranslatableString.ArrayItemTitle)))}isItemRequired(e){return Array.isArray(e.type)?!e.type.includes("null"):"null"!==e.type}canAddItem(e){const{schema:t,uiSchema:r,registry:i}=this.props;let{addable:s}=a.getUiOptions(r,i.globalUiOptions);return!1!==s&&(s=void 0===t.maxItems||e.length<t.maxItems),s}_handleAddClick(e,t){e&&e.preventDefault();const{onChange:r}=this.props,{keyedFormData:a}=this.state,i={key:E(),item:this._getNewFormDataRow()},s=[...a];void 0!==t?s.splice(t,0,i):s.push(i),this.setState({keyedFormData:s,updatedKeyedFormData:!0},(()=>r(N(s))))}render(){const{schema:e,uiSchema:r,idSchema:i,registry:s}=this.props,{schemaUtils:o,translateString:n}=s;if(!(a.ITEMS_KEY in e)){const o=a.getUiOptions(r),l=a.getTemplate("UnsupportedFieldTemplate",s,o);return t.jsx(l,{schema:e,idSchema:i,reason:n(a.TranslatableString.MissingItems),registry:s})}return o.isMultiSelect(e)?this.renderMultiSelect():a.isCustomWidget(r)?this.renderCustomWidget():a.isFixedItems(e)?this.renderFixedArray():o.isFilesArray(e,r)?this.renderFiles():this.renderNormalArray()}renderNormalArray(){const{schema:e,uiSchema:r={},errorSchema:i,idSchema:s,name:o,disabled:n=!1,readonly:l=!1,autofocus:d=!1,required:c=!1,registry:m,onBlur:u,onFocus:h,idPrefix:p,idSeparator:g="_",rawErrors:f}=this.props,{keyedFormData:y}=this.state,S=void 0===e.title?o:e.title,{schemaUtils:b,formContext:x}=m,v=a.getUiOptions(r),F=C.default(e.items)?e.items:{},j=b.retrieveSchema(F),D=N(this.state.keyedFormData),O=this.canAddItem(D),T={canAdd:O,items:y.map(((e,t)=>{const{key:a,item:n}=e,l=n,c=b.retrieveSchema(F,l),m=i?i[t]:void 0,S=b.toIdSchema(c,s.$id+g+t,l,p,g);return this.renderArrayFieldItem({key:a,index:t,name:o&&`${o}-${t}`,canAdd:O,canMoveUp:t>0,canMoveDown:t<D.length-1,itemSchema:c,itemIdSchema:S,itemErrorSchema:m,itemData:l,itemUiSchema:r.items,autofocus:d&&0===t,onBlur:u,onFocus:h,rawErrors:f,totalItems:y.length})})),className:`field field-array field-array-of-${j.type}`,disabled:n,idSchema:s,uiSchema:r,onAddClick:this.onAddClick,readonly:l,required:c,schema:e,title:S,formContext:x,formData:D,rawErrors:f,registry:m},E=a.getTemplate("ArrayFieldTemplate",m,v);return t.jsx(E,{...T})}renderCustomWidget(){const{schema:e,idSchema:r,uiSchema:i,disabled:s=!1,readonly:o=!1,autofocus:n=!1,required:l=!1,hideError:d,placeholder:c,onBlur:m,onFocus:u,formData:h=[],registry:p,rawErrors:g,name:f}=this.props,{widgets:y,formContext:S,globalUiOptions:b,schemaUtils:x}=p,{widget:v,title:C,...F}=a.getUiOptions(i,b),j=a.getWidget(e,v,y),D=C??e.title??f,O=x.getDisplayLabel(e,i,b);return t.jsx(j,{id:r.$id,name:f,multiple:!0,onChange:this.onSelectChange,onBlur:m,onFocus:u,options:F,schema:e,uiSchema:i,registry:p,value:h,disabled:s,readonly:o,hideError:d,required:l,label:D,hideLabel:!O,placeholder:c,formContext:S,autofocus:n,rawErrors:g})}renderMultiSelect(){const{schema:e,idSchema:r,uiSchema:i,formData:s=[],disabled:o=!1,readonly:n=!1,autofocus:l=!1,required:d=!1,placeholder:c,onBlur:m,onFocus:u,registry:h,rawErrors:p,name:g}=this.props,{widgets:f,schemaUtils:y,formContext:S,globalUiOptions:b}=h,x=y.retrieveSchema(e.items,s),v=a.optionsList(x),{widget:C="select",title:F,...j}=a.getUiOptions(i,b),D=a.getWidget(e,C,f),O=F??e.title??g,T=y.getDisplayLabel(e,i,b);return t.jsx(D,{id:r.$id,name:g,multiple:!0,onChange:this.onSelectChange,onBlur:m,onFocus:u,options:{...j,enumOptions:v},schema:e,uiSchema:i,registry:h,value:s,disabled:o,readonly:n,required:d,label:O,hideLabel:!T,placeholder:c,formContext:S,autofocus:l,rawErrors:p})}renderFiles(){const{schema:e,uiSchema:r,idSchema:i,name:s,disabled:o=!1,readonly:n=!1,autofocus:l=!1,required:d=!1,onBlur:c,onFocus:m,registry:u,formData:h=[],rawErrors:p}=this.props,{widgets:g,formContext:f,globalUiOptions:y,schemaUtils:S}=u,{widget:b="files",title:x,...v}=a.getUiOptions(r,y),C=a.getWidget(e,b,g),F=x??e.title??s,j=S.getDisplayLabel(e,r,y);return t.jsx(C,{options:v,id:i.$id,name:s,multiple:!0,onChange:this.onSelectChange,onBlur:c,onFocus:m,schema:e,uiSchema:r,value:h,disabled:o,readonly:n,required:d,registry:u,formContext:f,autofocus:l,rawErrors:p,label:F,hideLabel:!j})}renderFixedArray(){const{schema:e,uiSchema:r={},formData:i=[],errorSchema:s,idPrefix:o,idSeparator:n="_",idSchema:l,name:d,disabled:c=!1,readonly:m=!1,autofocus:u=!1,required:h=!1,registry:p,onBlur:g,onFocus:f,rawErrors:y}=this.props,{keyedFormData:S}=this.state;let{formData:b=[]}=this.props;const x=e.title||d,v=a.getUiOptions(r),{schemaUtils:F,formContext:j}=p,D=(C.default(e.items)?e.items:[]).map(((e,t)=>F.retrieveSchema(e,i[t]))),O=C.default(e.additionalItems)?F.retrieveSchema(e.additionalItems,i):null;(!b||b.length<D.length)&&(b=b||[],b=b.concat(new Array(D.length-b.length)));const T=this.canAddItem(b)&&!!O,E={canAdd:T,className:"field field-array field-array-fixed-items",disabled:c,idSchema:l,formData:i,items:S.map(((t,a)=>{const{key:i,item:c}=t,m=c,h=a>=D.length,p=h&&C.default(e.additionalItems)?F.retrieveSchema(e.additionalItems,m):D[a],x=F.toIdSchema(p,l.$id+n+a,m,o,n),v=h?r.additionalItems||{}:Array.isArray(r.items)?r.items[a]:r.items||{};return this.renderArrayFieldItem({key:i,index:a,name:d&&`${d}-${a}`,canAdd:T,canRemove:h,canMoveUp:a>=D.length+1,canMoveDown:h&&a<b.length-1,itemSchema:p,itemData:m,itemUiSchema:v,itemIdSchema:x,itemErrorSchema:s?s[a]:void 0,autofocus:u&&0===a,onBlur:g,onFocus:f,rawErrors:y,totalItems:S.length})})),onAddClick:this.onAddClick,readonly:m,required:h,registry:p,schema:e,uiSchema:r,title:x,formContext:j,rawErrors:y},I=a.getTemplate("ArrayFieldTemplate",p,v);return t.jsx(I,{...E})}renderArrayFieldItem(e){const{key:r,index:i,name:s,canAdd:o,canRemove:n=!0,canMoveUp:l,canMoveDown:d,itemSchema:c,itemData:m,itemUiSchema:u,itemIdSchema:h,itemErrorSchema:p,autofocus:g,onBlur:f,onFocus:y,rawErrors:S,totalItems:b}=e,{disabled:x,hideError:v,idPrefix:C,idSeparator:F,readonly:j,uiSchema:D,registry:O,formContext:T}=this.props,{fields:{ArraySchemaField:E,SchemaField:I},globalUiOptions:N}=O,k=E||I,{orderable:A=!0,removable:w=!0,copyable:B=!1}=a.getUiOptions(D,N),U={moveUp:A&&l,moveDown:A&&d,copy:B&&o,remove:w&&n,toolbar:!1};return U.toolbar=Object.keys(U).some((e=>U[e])),{children:t.jsx(k,{name:s,index:i,schema:c,uiSchema:u,formData:m,formContext:T,errorSchema:p,idPrefix:C,idSeparator:F,idSchema:h,required:this.isItemRequired(c),onChange:this.onChangeForIndex(i),onBlur:f,onFocus:y,registry:O,disabled:x,readonly:j,hideError:v,autofocus:g,rawErrors:S}),className:"array-item",disabled:x,canAdd:o,hasCopy:U.copy,hasToolbar:U.toolbar,hasMoveUp:U.moveUp,hasMoveDown:U.moveDown,hasRemove:U.remove,index:i,totalItems:b,key:r,onAddIndexClick:this.onAddIndexClick,onCopyIndexClick:this.onCopyIndexClick,onDropIndexClick:this.onDropIndexClick,onReorderClick:this.onReorderClick,readonly:j,registry:O,schema:c,uiSchema:u}}}function A(e){const{schema:r,name:i,uiSchema:s,idSchema:o,formData:n,registry:l,required:d,disabled:c,readonly:m,autofocus:u,onChange:h,onFocus:p,onBlur:g,rawErrors:f}=e,{title:y}=r,{widgets:S,formContext:b,translateString:x,globalUiOptions:v}=l,{widget:F="checkbox",title:j,label:D=!0,...O}=a.getUiOptions(s,v),T=a.getWidget(r,F,S),E=x(a.TranslatableString.YesLabel),I=x(a.TranslatableString.NoLabel);let N;const k=j??y??i;if(Array.isArray(r.oneOf))N=a.optionsList({oneOf:r.oneOf.map((e=>{if(C.default(e))return{...e,title:e.title||(!0===e.const?E:I)}})).filter((e=>e))});else{const e=r,t=r.enum??[!0,!1];N=!e.enumNames&&2===t.length&&t.every((e=>"boolean"==typeof e))?[{value:t[0],label:t[0]?E:I},{value:t[1],label:t[1]?E:I}]:a.optionsList({enum:t,enumNames:e.enumNames})}return t.jsx(T,{options:{...O,enumOptions:N},schema:r,uiSchema:s,id:o.$id,name:i,onChange:h,onFocus:p,onBlur:g,label:k,hideLabel:!D,value:n,required:d,disabled:c,readonly:m,registry:l,formContext:b,autofocus:u,rawErrors:f})}class w extends r.Component{constructor(e){super(e),this.onOptionChange=e=>{const{selectedOption:t,retrievedOptions:r}=this.state,{formData:a,onChange:i,registry:s}=this.props,{schemaUtils:o}=s,n=void 0!==e?parseInt(e,10):-1;if(n===t)return;const l=n>=0?r[n]:void 0;let d=o.sanitizeDataForNewSchema(l,t>=0?r[t]:void 0,a);d&&l&&(d=o.getDefaultFormState(l,d,"excludeObjectChildren")),i(d,void 0,this.getFieldId()),this.setState({selectedOption:n})};const{formData:t,options:r,registry:{schemaUtils:a}}=this.props,i=r.map((e=>a.retrieveSchema(e,t)));this.state={retrievedOptions:i,selectedOption:this.getMatchingOption(0,t,i)}}componentDidUpdate(e,t){const{formData:r,options:i,idSchema:s}=this.props,{selectedOption:o}=this.state;let n=this.state;if(!a.deepEquals(e.options,i)){const{registry:{schemaUtils:e}}=this.props;n={selectedOption:o,retrievedOptions:i.map((t=>e.retrieveSchema(t,r)))}}if(!a.deepEquals(r,e.formData)&&s.$id===e.idSchema.$id){const{retrievedOptions:e}=n,a=this.getMatchingOption(o,r,e);t&&a!==o&&(n={selectedOption:a,retrievedOptions:e})}n!==this.state&&this.setState(n)}getMatchingOption(e,t,r){const{schema:i,registry:{schemaUtils:s}}=this.props,o=a.getDiscriminatorFieldFromSchema(i);return s.getClosestMatchingOption(t,r,e,o)}getFieldId(){const{idSchema:e,schema:t}=this.props;return`${e.$id}${t.oneOf?"__oneof_select":"__anyof_select"}`}render(){const{name:e,disabled:r=!1,errorSchema:i={},formContext:s,onBlur:o,onFocus:n,registry:l,schema:d,uiSchema:c}=this.props,{widgets:m,fields:u,translateString:h,globalUiOptions:p,schemaUtils:g}=l,{SchemaField:f}=u,{selectedOption:b,retrievedOptions:x}=this.state,{widget:v="select",placeholder:C,autofocus:F,autocomplete:O,title:T=d.title,...E}=a.getUiOptions(c,p),I=a.getWidget({type:"number"},v,m),N=y.default(i,a.ERRORS_KEY,[]),k=j.default(i,[a.ERRORS_KEY]),A=g.getDisplayLabel(d,c,p),w=b>=0&&x[b]||null;let B;if(w){const{oneOf:e,anyOf:t,...r}=d;D.default(r,a.ADDITIONAL_PROPERTY_FLAG),B=S.default(r)?w:a.mergeSchemas(r,w)}const U=T?a.TranslatableString.TitleOptionPrefix:a.TranslatableString.OptionPrefix,_=T?[T]:[],P=x.map(((e,t)=>({label:e.title||h(U,_.concat(String(t+1))),value:t})));return t.jsxs("div",{className:"panel panel-default panel-body",children:[t.jsx("div",{className:"form-group",children:t.jsx(I,{id:this.getFieldId(),name:`${e}${d.oneOf?"__oneof_select":"__anyof_select"}`,schema:{type:"number",default:0},onChange:this.onOptionChange,onBlur:o,onFocus:n,disabled:r||S.default(P),multiple:!1,rawErrors:N,errorSchema:k,value:b>=0?b:void 0,options:{enumOptions:P,...E},registry:l,formContext:s,placeholder:C,autocomplete:O,autofocus:F,label:T??e,hideLabel:!A})}),null!==w&&t.jsx(f,{...this.props,schema:B})]})}}const B=/\.([0-9]*0)*$/,U=/[0.]0*$/;function _(e){const{registry:i,onChange:s,formData:o,value:n}=e,[l,d]=r.useState(n),{StringField:c}=i.fields;let m=o;const u=r.useCallback((e=>{d(e),"."===`${e}`.charAt(0)&&(e=`0${e}`);const t="string"==typeof e&&e.match(B)?a.asNumber(e.replace(U,"")):a.asNumber(e);s(t)}),[s]);if("string"==typeof l&&"number"==typeof m){const e=new RegExp(`${m}`.replace(".","\\.")+"\\.?0*$");l.match(e)&&(m=l)}return t.jsx(c,{...e,formData:m,onChange:u})}class P extends r.Component{constructor(...e){super(...e),this.state={wasPropertyKeyModified:!1,additionalProperties:{}},this.onPropertyChange=(e,t=!1)=>(r,a,i)=>{const{formData:s,onChange:o,errorSchema:n}=this.props;void 0===r&&t&&(r=""),o({...s,[e]:r},n&&n&&{...n,[e]:a},i)},this.onDropPropertyClick=e=>t=>{t.preventDefault();const{onChange:r,formData:a}=this.props,i={...a};D.default(i,e),r(i)},this.getAvailableKey=(e,t)=>{const{uiSchema:r,registry:i}=this.props,{duplicateKeySuffixSeparator:s="-"}=a.getUiOptions(r,i.globalUiOptions);let o=0,n=e;for(;T.default(t,n);)n=`${e}${s}${++o}`;return n},this.onKeyChange=e=>(t,r)=>{if(e===t)return;const{formData:a,onChange:i,errorSchema:s}=this.props;t=this.getAvailableKey(t,a);const o={...a},n={[e]:t},l=Object.keys(o).map((e=>({[n[e]||e]:o[e]}))),d=Object.assign({},...l);this.setState({wasPropertyKeyModified:!0}),i(d,s&&s&&{...s,[t]:r})},this.handleAddClick=e=>()=>{if(!e.additionalProperties)return;const{formData:t,onChange:r,registry:i}=this.props,s={...t};let o;if(C.default(e.additionalProperties)){o=e.additionalProperties.type;let r=e.additionalProperties;if(a.REF_KEY in r){const{schemaUtils:e}=i;r=e.retrieveSchema({$ref:r[a.REF_KEY]},t),o=r.type}o||!(a.ANY_OF_KEY in r)&&!(a.ONE_OF_KEY in r)||(o="object")}const n=this.getAvailableKey("newKey",s);F.default(s,n,this.getDefaultValue(o)),r(s)}}isRequired(e){const{schema:t}=this.props;return Array.isArray(t.required)&&-1!==t.required.indexOf(e)}getDefaultValue(e){const{registry:{translateString:t}}=this.props;switch(e){case"array":return[];case"boolean":return!1;case"null":return null;case"number":return 0;case"object":return{};default:return t(a.TranslatableString.NewStringDefault)}}render(){const{schema:e,uiSchema:r={},formData:i,errorSchema:s,idSchema:o,name:n,required:l=!1,disabled:d=!1,readonly:c=!1,hideError:m,idPrefix:u,idSeparator:h,onBlur:p,onFocus:g,registry:f}=this.props,{fields:S,formContext:b,schemaUtils:x,translateString:v,globalUiOptions:C}=f,{SchemaField:F}=S,j=x.retrieveSchema(e,i),D=a.getUiOptions(r,C),{properties:E={}}=j,I=D.title??j.title??n,N=D.description??j.description;let k;try{const e=Object.keys(E);k=a.orderProperties(e,D.order)}catch(e){return t.jsxs("div",{children:[t.jsx("p",{className:"config-error",style:{color:"red"},children:t.jsx(O.default,{children:v(a.TranslatableString.InvalidObjectField,[n||"root",e.message])})}),t.jsx("pre",{children:JSON.stringify(j)})]})}const A=a.getTemplate("ObjectFieldTemplate",f,D),w={title:!1===D.label?"":I,description:!1===D.label?void 0:N,properties:k.map((e=>{const n=T.default(j,[a.PROPERTIES_KEY,e,a.ADDITIONAL_PROPERTY_FLAG]),S=n?r.additionalProperties:r[e],x="hidden"===a.getUiOptions(S).widget,v=y.default(o,[e],{});return{content:t.jsx(F,{name:e,required:this.isRequired(e),schema:y.default(j,[a.PROPERTIES_KEY,e],{}),uiSchema:S,errorSchema:y.default(s,e),idSchema:v,idPrefix:u,idSeparator:h,formData:y.default(i,e),formContext:b,wasPropertyKeyModified:this.state.wasPropertyKeyModified,onKeyChange:this.onKeyChange(e),onChange:this.onPropertyChange(e,n),onBlur:p,onFocus:g,registry:f,disabled:d,readonly:c,hideError:m,onDropPropertyClick:this.onDropPropertyClick},e),name:e,readonly:c,disabled:d,required:l,hidden:x}})),readonly:c,disabled:d,required:l,idSchema:o,uiSchema:r,errorSchema:s,schema:j,formData:i,formContext:b,registry:f};return t.jsx(A,{...w,onAddClick:this.handleAddClick})}}const q={array:"ArrayField",boolean:"BooleanField",integer:"NumberField",number:"NumberField",object:"ObjectField",string:"StringField",null:"NullField"};function R(e){const{schema:i,idSchema:s,uiSchema:o,formData:n,errorSchema:l,idPrefix:d,idSeparator:c,name:m,onChange:u,onKeyChange:h,onDropPropertyClick:p,required:g,registry:f,wasPropertyKeyModified:y=!1}=e,{formContext:S,schemaUtils:b,globalUiOptions:x}=f,v=a.getUiOptions(o,x),F=a.getTemplate("FieldTemplate",f,v),D=a.getTemplate("DescriptionFieldTemplate",f,v),T=a.getTemplate("FieldHelpTemplate",f,v),E=a.getTemplate("FieldErrorTemplate",f,v),I=b.retrieveSchema(i,n),N=s[a.ID_KEY],k=a.mergeObjects(b.toIdSchema(I,N,n,d,c),s),A=r.useCallback(((e,t,r)=>u(e,t,r||N)),[N,u]),w=function(e,r,i,s){const o=r.field,{fields:n,translateString:l}=s;if("function"==typeof o)return o;if("string"==typeof o&&o in n)return n[o];const d=a.getSchemaType(e),c=Array.isArray(d)?d[0]:d||"",m=e.$id;let u=q[c];return m&&m in n&&(u=m),u||!e.anyOf&&!e.oneOf?u in n?n[u]:()=>{const o=a.getTemplate("UnsupportedFieldTemplate",s,r);return t.jsx(o,{schema:e,idSchema:i,reason:l(a.TranslatableString.UnknownFieldType,[String(e.type)]),registry:s})}:()=>null}(I,v,k,f),B=Boolean(e.disabled||v.disabled),U=Boolean(e.readonly||v.readonly||e.schema.readOnly||I.readOnly),_=v.hideError,P=void 0===_?e.hideError:Boolean(_),R=Boolean(e.autofocus||v.autofocus);if(0===Object.keys(I).length)return null;const L=b.getDisplayLabel(I,o,x),{__errors:$,...V}=l||{},K=j.default(o,["ui:classNames","classNames","ui:style"]);a.UI_OPTIONS_KEY in K&&(K[a.UI_OPTIONS_KEY]=j.default(K[a.UI_OPTIONS_KEY],["classNames","style"]));const M=t.jsx(w,{...e,onChange:A,idSchema:k,schema:I,uiSchema:K,disabled:B,readonly:U,hideError:P,autofocus:R,errorSchema:V,formContext:S,rawErrors:$}),W=k[a.ID_KEY];let Y;Y=y||a.ADDITIONAL_PROPERTY_FLAG in I?m:v.title||e.schema.title||I.title||m;const z=v.description||e.schema.description||I.description||"",G=v.enableMarkdownInDescription?t.jsx(O.default,{children:z}):z,J=v.help,H="hidden"===v.widget,Q=["form-group","field",`field-${a.getSchemaType(I)}`];!P&&$&&$.length>0&&Q.push("field-error has-error has-danger"),null!=o&&o.classNames&&Q.push(o.classNames),v.classNames&&Q.push(v.classNames);const X=t.jsx(T,{help:J,idSchema:k,schema:I,uiSchema:o,hasErrors:!P&&$&&$.length>0,registry:f}),Z=P||I.anyOf||I.oneOf?void 0:t.jsx(E,{errors:$,errorSchema:l,idSchema:k,schema:I,uiSchema:o,registry:f}),ee={description:t.jsx(D,{id:a.descriptionId(W),description:G,schema:I,uiSchema:o,registry:f}),rawDescription:z,help:X,rawHelp:"string"==typeof J?J:void 0,errors:Z,rawErrors:P?void 0:$,id:W,label:Y,hidden:H,onChange:u,onKeyChange:h,onDropPropertyClick:p,required:g,disabled:B,readonly:U,hideError:P,displayLabel:L,classNames:Q.join(" ").trim(),style:v.style,formContext:S,formData:n,schema:I,uiSchema:o,registry:f},te=f.fields.AnyOfField,re=f.fields.OneOfField,ae=(null==o?void 0:o["ui:field"])&&!0===(null==o?void 0:o["ui:fieldReplacesAnyOrOneOf"]);return t.jsx(F,{...ee,children:t.jsxs(t.Fragment,{children:[M,I.anyOf&&!ae&&!b.isSelect(I)&&t.jsx(te,{name:m,disabled:B,readonly:U,hideError:P,errorSchema:l,formData:n,formContext:S,idPrefix:d,idSchema:k,idSeparator:c,onBlur:e.onBlur,onChange:e.onChange,onFocus:e.onFocus,options:I.anyOf.map((e=>b.retrieveSchema(C.default(e)?e:{},n))),registry:f,schema:I,uiSchema:o}),I.oneOf&&!ae&&!b.isSelect(I)&&t.jsx(re,{name:m,disabled:B,readonly:U,hideError:P,errorSchema:l,formData:n,formContext:S,idPrefix:d,idSchema:k,idSeparator:c,onBlur:e.onBlur,onChange:e.onChange,onFocus:e.onFocus,options:I.oneOf.map((e=>b.retrieveSchema(C.default(e)?e:{},n))),registry:f,schema:I,uiSchema:o})]})})}class L extends r.Component{shouldComponentUpdate(e){return!a.deepEquals(this.props,e)}render(){return t.jsx(R,{...this.props})}}function $(e){const{schema:r,name:i,uiSchema:s,idSchema:o,formData:n,required:l,disabled:d=!1,readonly:c=!1,autofocus:m=!1,onChange:u,onBlur:h,onFocus:p,registry:g,rawErrors:f}=e,{title:y,format:S}=r,{widgets:b,formContext:x,schemaUtils:v,globalUiOptions:C}=g,F=v.isSelect(r)?a.optionsList(r):void 0;let j=F?"select":"text";S&&a.hasWidget(r,S,b)&&(j=S);const{widget:D=j,placeholder:O="",title:T,...E}=a.getUiOptions(s),I=v.getDisplayLabel(r,s,C),N=T??y??i,k=a.getWidget(r,D,b);return t.jsx(k,{options:{...E,enumOptions:F},schema:r,uiSchema:s,id:o.$id,name:i,label:N,hideLabel:!I,value:n,onChange:u,onBlur:h,onFocus:p,required:l,disabled:d,readonly:c,formContext:x,autofocus:m,registry:g,placeholder:O,rawErrors:f})}function V(e){const{formData:t,onChange:a}=e;return r.useEffect((()=>{void 0===t&&a(null)}),[t,a]),null}function K(e){const{idSchema:r,description:i,registry:s,schema:o,uiSchema:n}=e,l=a.getUiOptions(n,s.globalUiOptions),{label:d=!0}=l;if(!i||!d)return null;const c=a.getTemplate("DescriptionFieldTemplate",s,l);return t.jsx(c,{id:a.descriptionId(r),description:i,schema:o,uiSchema:n,registry:s})}function M(e){const{children:r,className:a,disabled:i,hasToolbar:s,hasMoveDown:o,hasMoveUp:n,hasRemove:l,hasCopy:d,index:c,onCopyIndexClick:m,onDropIndexClick:u,onReorderClick:h,readonly:p,registry:g,uiSchema:f}=e,{CopyButton:y,MoveDownButton:S,MoveUpButton:b,RemoveButton:x}=g.templates.ButtonTemplates,v={flex:1,paddingLeft:6,paddingRight:6,fontWeight:"bold"};return t.jsxs("div",{className:a,children:[t.jsx("div",{className:s?"col-xs-9":"col-xs-12",children:r}),s&&t.jsx("div",{className:"col-xs-3 array-item-toolbox",children:t.jsxs("div",{className:"btn-group",style:{display:"flex",justifyContent:"space-around"},children:[(n||o)&&t.jsx(b,{style:v,disabled:i||p||!n,onClick:h(c,c-1),uiSchema:f,registry:g}),(n||o)&&t.jsx(S,{style:v,disabled:i||p||!o,onClick:h(c,c+1),uiSchema:f,registry:g}),d&&t.jsx(y,{style:v,disabled:i||p,onClick:m(c),uiSchema:f,registry:g}),l&&t.jsx(x,{style:v,disabled:i||p,onClick:u(c),uiSchema:f,registry:g})]})})]})}function W(e){const{canAdd:r,className:i,disabled:s,idSchema:o,uiSchema:n,items:l,onAddClick:d,readonly:c,registry:m,required:u,schema:h,title:p}=e,g=a.getUiOptions(n),f=a.getTemplate("ArrayFieldDescriptionTemplate",m,g),y=a.getTemplate("ArrayFieldItemTemplate",m,g),S=a.getTemplate("ArrayFieldTitleTemplate",m,g),{ButtonTemplates:{AddButton:b}}=m.templates;return t.jsxs("fieldset",{className:i,id:o.$id,children:[t.jsx(S,{idSchema:o,title:g.title||p,required:u,schema:h,uiSchema:n,registry:m}),t.jsx(f,{idSchema:o,description:g.description||h.description,schema:h,uiSchema:n,registry:m}),t.jsx("div",{className:"row array-item-list",children:l&&l.map((({key:e,...r})=>t.jsx(y,{...r},e)))}),r&&t.jsx(b,{className:"array-item-add",onClick:d,disabled:s||c,uiSchema:n,registry:m})]})}function Y(e){const{idSchema:r,title:i,schema:s,uiSchema:o,required:n,registry:l}=e,d=a.getUiOptions(o,l.globalUiOptions),{label:c=!0}=d;if(!i||!c)return null;const m=a.getTemplate("TitleFieldTemplate",l,d);return t.jsx(m,{id:a.titleId(r),title:i,required:n,schema:s,uiSchema:o,registry:l})}function z(e){const{id:i,name:s,value:o,readonly:n,disabled:l,autofocus:d,onBlur:c,onFocus:m,onChange:u,onChangeOverride:h,options:p,schema:g,uiSchema:f,formContext:y,registry:S,rawErrors:b,type:x,hideLabel:v,hideError:C,...F}=e;if(!i)throw console.log("No id for",e),new Error(`no id for props ${JSON.stringify(e)}`);const j={...F,...a.getInputProps(g,x,p)};let D;D="number"===j.type||"integer"===j.type?o||0===o?o:"":null==o?"":o;const O=r.useCallback((({target:{value:e}})=>u(""===e?p.emptyValue:e)),[u,p]),T=r.useCallback((({target:{value:e}})=>c(i,e)),[c,i]),E=r.useCallback((({target:{value:e}})=>m(i,e)),[m,i]);return t.jsxs(t.Fragment,{children:[t.jsx("input",{id:i,name:i,className:"form-control",readOnly:n,disabled:l,autoFocus:d,value:D,...j,list:g.examples?a.examplesId(i):void 0,onChange:h||O,onBlur:T,onFocus:E,"aria-describedby":a.ariaDescribedByIds(i,!!g.examples)}),Array.isArray(g.examples)&&t.jsx("datalist",{id:a.examplesId(i),children:g.examples.concat(g.default&&!g.examples.includes(g.default)?[g.default]:[]).map((e=>t.jsx("option",{value:e},e)))},`datalist_${i}`)]})}function G({uiSchema:e}){const{submitText:r,norender:i,props:s={}}=a.getSubmitButtonOptions(e);return i?null:t.jsx("div",{children:t.jsx("button",{type:"submit",...s,className:`btn btn-info ${s.className||""}`,children:r})})}function J(e){const{iconType:r="default",icon:a,className:i,uiSchema:s,registry:o,...n}=e;return t.jsx("button",{type:"button",className:`btn btn-${r} ${i}`,...n,children:t.jsx("i",{className:`glyphicon glyphicon-${a}`})})}function H(e){const{registry:{translateString:r}}=e;return t.jsx(J,{title:r(a.TranslatableString.CopyButton),className:"array-item-copy",...e,icon:"copy"})}function Q(e){const{registry:{translateString:r}}=e;return t.jsx(J,{title:r(a.TranslatableString.MoveDownButton),className:"array-item-move-down",...e,icon:"arrow-down"})}function X(e){const{registry:{translateString:r}}=e;return t.jsx(J,{title:r(a.TranslatableString.MoveUpButton),className:"array-item-move-up",...e,icon:"arrow-up"})}function Z(e){const{registry:{translateString:r}}=e;return t.jsx(J,{title:r(a.TranslatableString.RemoveButton),className:"array-item-remove",...e,iconType:"danger",icon:"remove"})}function ee({className:e,onClick:r,disabled:i,registry:s}){const{translateString:o}=s;return t.jsx("div",{className:"row",children:t.jsx("p",{className:`col-xs-3 col-xs-offset-9 text-right ${e}`,children:t.jsx(J,{iconType:"info",icon:"plus",className:"btn-add col-xs-12",title:o(a.TranslatableString.AddButton),onClick:r,disabled:i,registry:s})})})}function te(e){const{id:r,description:a}=e;return a?t.jsx("string"==typeof a?"p":"div",{id:r,className:"field-description",children:a}):null}function re({errors:e,registry:r}){const{translateString:i}=r;return t.jsxs("div",{className:"panel panel-danger errors",children:[t.jsx("div",{className:"panel-heading",children:t.jsx("h3",{className:"panel-title",children:i(a.TranslatableString.ErrorsLabel)})}),t.jsx("ul",{className:"list-group",children:e.map(((e,r)=>t.jsx("li",{className:"list-group-item text-danger",children:e.stack},r)))})]})}const ae="*";function ie(e){const{label:r,required:a,id:i}=e;return r?t.jsxs("label",{className:"control-label",htmlFor:i,children:[r,a&&t.jsx("span",{className:"required",children:ae})]}):null}function se(e){const{id:r,label:i,children:s,errors:o,help:n,description:l,hidden:d,required:c,displayLabel:m,registry:u,uiSchema:h}=e,p=a.getUiOptions(h),g=a.getTemplate("WrapIfAdditionalTemplate",u,p);return d?t.jsx("div",{className:"hidden",children:s}):t.jsxs(g,{...e,children:[m&&t.jsx(ie,{label:i,required:c,id:r}),m&&l?l:null,s,o,n]})}function oe(e){const{errors:r=[],idSchema:i}=e;if(0===r.length)return null;const s=a.errorId(i);return t.jsx("div",{children:t.jsx("ul",{id:s,className:"error-detail bs-callout bs-callout-info",children:r.filter((e=>!!e)).map(((e,r)=>t.jsx("li",{className:"text-danger",children:e},r)))})})}function ne(e){const{idSchema:r,help:i}=e;if(!i)return null;const s=a.helpId(r);return t.jsx("string"==typeof i?"p":"div",{id:s,className:"help-block",children:i})}function le(e){const{description:r,disabled:i,formData:s,idSchema:o,onAddClick:n,properties:l,readonly:d,registry:c,required:m,schema:u,title:h,uiSchema:p}=e,g=a.getUiOptions(p),f=a.getTemplate("TitleFieldTemplate",c,g),y=a.getTemplate("DescriptionFieldTemplate",c,g),{ButtonTemplates:{AddButton:S}}=c.templates;return t.jsxs("fieldset",{id:o.$id,children:[h&&t.jsx(f,{id:a.titleId(o),title:h,required:m,schema:u,uiSchema:p,registry:c}),r&&t.jsx(y,{id:a.descriptionId(o),description:r,schema:u,uiSchema:p,registry:c}),l.map((e=>e.content)),a.canExpand(u,p,s)&&t.jsx(S,{className:"object-property-expand",onClick:n(u),disabled:i||d,uiSchema:p,registry:c})]})}const de="*";function ce(e){const{id:r,title:a,required:i}=e;return t.jsxs("legend",{id:r,children:[a,i&&t.jsx("span",{className:"required",children:de})]})}function me(e){const{schema:r,idSchema:i,reason:s,registry:o}=e,{translateString:n}=o;let l=a.TranslatableString.UnsupportedField;const d=[];return i&&i.$id&&(l=a.TranslatableString.UnsupportedFieldWithId,d.push(i.$id)),s&&(l=l===a.TranslatableString.UnsupportedField?a.TranslatableString.UnsupportedFieldWithReason:a.TranslatableString.UnsupportedFieldWithIdAndReason,d.push(s)),t.jsxs("div",{className:"unsupported-field",children:[t.jsx("p",{children:t.jsx(O.default,{children:n(l,d)})}),r&&t.jsx("pre",{children:JSON.stringify(r,null,2)})]})}function ue(e){const{id:r,classNames:i,style:s,disabled:o,label:n,onKeyChange:l,onDropPropertyClick:d,readonly:c,required:m,schema:u,children:h,uiSchema:p,registry:g}=e,{templates:f,translateString:y}=g,{RemoveButton:S}=f.ButtonTemplates,b=y(a.TranslatableString.KeyLabel,[n]);return t.jsx("div",a.ADDITIONAL_PROPERTY_FLAG in u?{className:i,style:s,children:t.jsxs("div",{className:"row",children:[t.jsx("div",{className:"col-xs-5 form-additional",children:t.jsxs("div",{className:"form-group",children:[t.jsx(ie,{label:b,required:m,id:`${r}-key`}),t.jsx("input",{className:"form-control",type:"text",id:`${r}-key`,onBlur:e=>l(e.target.value),defaultValue:n})]})}),t.jsx("div",{className:"form-additional form-group col-xs-5",children:h}),t.jsx("div",{className:"col-xs-2",children:t.jsx(S,{className:"array-item-remove btn-block",style:{border:"0"},disabled:o||c,onClick:d(n),uiSchema:p,registry:g})})]})}:{className:i,style:s,children:h})}function he(e,t){const r=[];for(let i=e;i<=t;i++)r.push({value:i,label:a.pad(i,2)});return r}function pe(e,t,r=[1900,(new Date).getFullYear()+2]){const{year:a,month:i,day:s,hour:o,minute:n,second:l}=e,d=[{type:"year",range:r,value:a},{type:"month",range:[1,12],value:i},{type:"day",range:[1,31],value:s}];return t&&d.push({type:"hour",range:[0,23],value:o},{type:"minute",range:[0,59],value:n},{type:"second",range:[0,59],value:l}),d}function ge({type:e,range:r,value:i,select:s,rootId:o,name:n,disabled:l,readonly:d,autofocus:c,registry:m,onBlur:u,onFocus:h}){const p=o+"_"+e,{SelectWidget:g}=m.widgets;return t.jsx(g,{schema:{type:"integer"},id:p,name:n,className:"form-control",options:{enumOptions:he(r[0],r[1])},placeholder:e,value:i,disabled:l,readonly:d,autofocus:c,onChange:t=>s(e,t),onBlur:u,onFocus:h,registry:m,label:"","aria-describedby":a.ariaDescribedByIds(o)})}function fe({time:e=!1,disabled:i=!1,readonly:s=!1,autofocus:o=!1,options:n,id:l,name:d,registry:c,onBlur:m,onFocus:u,onChange:h,value:p}){const{translateString:g}=c,[f,y]=r.useState(p),[S,b]=r.useReducer(((e,t)=>({...e,...t})),a.parseDateString(p,e));r.useEffect((()=>{const t=a.toDateString(S,e);!function(e){return Object.values(e).every((e=>-1!==e))}(S)||t===p?f!==p&&(y(p),b(a.parseDateString(p,e))):h(t)}),[e,p,h,S,f]);const x=r.useCallback(((e,t)=>{b({[e]:t})}),[]),v=r.useCallback((t=>{if(t.preventDefault(),i||s)return;const r=a.parseDateString((new Date).toJSON(),e);h(a.toDateString(r,e))}),[i,s,e]),C=r.useCallback((e=>{e.preventDefault(),i||s||h(void 0)}),[i,s,h]);return t.jsxs("ul",{className:"list-inline",children:[pe(S,e,n.yearsRange).map(((e,r)=>t.jsx("li",{className:"list-inline-item",children:t.jsx(ge,{rootId:l,name:d,select:x,...e,disabled:i,readonly:s,registry:c,onBlur:m,onFocus:u,autofocus:o&&0===r})},r))),("undefined"===n.hideNowButton||!n.hideNowButton)&&t.jsx("li",{className:"list-inline-item",children:t.jsx("a",{href:"#",className:"btn btn-info btn-now",onClick:v,children:g(a.TranslatableString.NowLabel)})}),("undefined"===n.hideClearButton||!n.hideClearButton)&&t.jsx("li",{className:"list-inline-item",children:t.jsx("a",{href:"#",className:"btn btn-warning btn-clear",onClick:C,children:g(a.TranslatableString.ClearLabel)})})]})}function ye({time:e=!0,...r}){const{AltDateWidget:a}=r.registry.widgets;return t.jsx(a,{time:e,...r})}function Se({schema:e,uiSchema:i,options:s,id:o,value:n,disabled:l,readonly:d,label:c,hideLabel:m,autofocus:u=!1,onBlur:h,onFocus:p,onChange:g,registry:f}){const y=a.getTemplate("DescriptionFieldTemplate",f,s),S=a.schemaRequiresTrueValue(e),b=r.useCallback((e=>g(e.target.checked)),[g]),x=r.useCallback((e=>h(o,e.target.checked)),[h,o]),v=r.useCallback((e=>p(o,e.target.checked)),[p,o]),C=s.description??e.description;return t.jsxs("div",{className:"checkbox "+(l||d?"disabled":""),children:[!m&&!!C&&t.jsx(y,{id:a.descriptionId(o),description:C,schema:e,uiSchema:i,registry:f}),t.jsxs("label",{children:[t.jsx("input",{type:"checkbox",id:o,name:o,checked:void 0!==n&&n,required:S,disabled:l||d,autoFocus:u,onChange:b,onBlur:x,onFocus:v,"aria-describedby":a.ariaDescribedByIds(o)}),a.labelValue(t.jsx("span",{children:c}),m)]})]})}function be({id:e,disabled:i,options:{inline:s=!1,enumOptions:o,enumDisabled:n,emptyValue:l},value:d,autofocus:c=!1,readonly:m,onChange:u,onBlur:h,onFocus:p}){const g=Array.isArray(d)?d:[d],f=r.useCallback((({target:{value:t}})=>h(e,a.enumOptionsValueForIndex(t,o,l))),[h,e]),y=r.useCallback((({target:{value:t}})=>p(e,a.enumOptionsValueForIndex(t,o,l))),[p,e]);return t.jsx("div",{className:"checkboxes",id:e,children:Array.isArray(o)&&o.map(((r,l)=>{const d=a.enumOptionsIsSelected(r.value,g),h=Array.isArray(n)&&-1!==n.indexOf(r.value),p=i||h||m?"disabled":"",S=t.jsxs("span",{children:[t.jsx("input",{type:"checkbox",id:a.optionId(e,l),name:e,checked:d,value:String(l),disabled:i||h||m,autoFocus:c&&0===l,onChange:e=>{u(e.target.checked?a.enumOptionsSelectValue(l,g,o):a.enumOptionsDeselectValue(l,g,o))},onBlur:f,onFocus:y,"aria-describedby":a.ariaDescribedByIds(e)}),t.jsx("span",{children:r.label})]});return s?t.jsx("label",{className:`checkbox-inline ${p}`,children:S},l):t.jsx("div",{className:`checkbox ${p}`,children:t.jsx("label",{children:S})},l)}))})}function xe(e){const{disabled:r,readonly:i,options:s,registry:o}=e,n=a.getTemplate("BaseInputTemplate",o,s);return t.jsx(n,{type:"color",...e,disabled:r||i})}function ve(e){const{onChange:i,options:s,registry:o}=e,n=a.getTemplate("BaseInputTemplate",o,s),l=r.useCallback((e=>i(e||void 0)),[i]);return t.jsx(n,{type:"date",...e,onChange:l})}function Ce(e){const{onChange:r,value:i,options:s,registry:o}=e,n=a.getTemplate("BaseInputTemplate",o,s);return t.jsx(n,{type:"datetime-local",...e,value:a.utcToLocal(i),onChange:e=>r(a.localToUTC(e))})}function Fe(e){const{options:r,registry:i}=e,s=a.getTemplate("BaseInputTemplate",i,r);return t.jsx(s,{type:"email",...e})}function je(e,t){return null===e?null:e.replace(";base64",`;name=${encodeURIComponent(t)};base64`)}function De(e){const{name:t,size:r,type:a}=e;return new Promise(((i,s)=>{const o=new window.FileReader;o.onerror=s,o.onload=e=>{var s;"string"==typeof(null===(s=e.target)||void 0===s?void 0:s.result)?i({dataURL:je(e.target.result,t),name:t,size:r,type:a}):i({dataURL:null,name:t,size:r,type:a})},o.readAsDataURL(e)}))}function Oe({fileInfo:e,registry:r}){const{translateString:i}=r,{dataURL:s,type:o,name:n}=e;return s?-1!==o.indexOf("image")?t.jsx("img",{src:s,style:{maxWidth:"100%"},className:"file-preview"}):t.jsxs(t.Fragment,{children:[" ",t.jsx("a",{download:`preview-${n}`,href:s,className:"file-download",children:i(a.TranslatableString.PreviewLabel)})]}):null}function Te({filesInfo:e,registry:r,preview:i}){if(0===e.length)return null;const{translateString:s}=r;return t.jsx("ul",{className:"file-info",children:e.map(((e,o)=>{const{name:n,size:l,type:d}=e;return t.jsxs("li",{children:[t.jsx(O.default,{children:s(a.TranslatableString.FilesInfo,[n,d,String(l)])}),i&&t.jsx(Oe,{fileInfo:e,registry:r})]},o)}))})}function Ee(e){return e.filter((e=>e)).map((e=>{const{blob:t,name:r}=a.dataURItoBlob(e);return{dataURL:e,name:r,size:t.size,type:t.type}}))}function Ie(e){const{disabled:i,readonly:s,required:o,multiple:n,onChange:l,value:d,options:c,registry:m}=e,u=a.getTemplate("BaseInputTemplate",m,c),[h,p]=r.useState(Array.isArray(d)?Ee(d):Ee([d])),g=r.useCallback((e=>{var t;e.target.files&&(t=e.target.files,Promise.all(Array.from(t).map(De))).then((e=>{const t=e.map((e=>e.dataURL));n?(p(h.concat(e[0])),l(d.concat(t[0]))):(p(e),l(t[0]))}))}),[n,d,h,l]);return t.jsxs("div",{children:[t.jsx(u,{...e,disabled:i||s,type:"file",required:!d&&o,onChangeOverride:g,value:"",accept:c.accept?String(c.accept):void 0}),t.jsx(Te,{filesInfo:h,registry:m,preview:c.filePreview})]})}function Ne({id:e,value:r}){return t.jsx("input",{type:"hidden",id:e,name:e,value:void 0===r?"":r})}function ke(e){const{options:r,registry:i}=e,s=a.getTemplate("BaseInputTemplate",i,r);return t.jsx(s,{type:"password",...e})}function Ae({options:e,value:i,required:s,disabled:o,readonly:n,autofocus:l=!1,onBlur:d,onFocus:c,onChange:m,id:u}){const{enumOptions:h,enumDisabled:p,inline:g,emptyValue:f}=e,y=r.useCallback((({target:{value:e}})=>d(u,a.enumOptionsValueForIndex(e,h,f))),[d,u]),S=r.useCallback((({target:{value:e}})=>c(u,a.enumOptionsValueForIndex(e,h,f))),[c,u]);return t.jsx("div",{className:"field-radio-group",id:u,children:Array.isArray(h)&&h.map(((e,r)=>{const d=a.enumOptionsIsSelected(e.value,i),c=Array.isArray(p)&&-1!==p.indexOf(e.value),h=o||c||n?"disabled":"",f=t.jsxs("span",{children:[t.jsx("input",{type:"radio",id:a.optionId(u,r),checked:d,name:u,required:s,value:String(r),disabled:o||c||n,autoFocus:l&&0===r,onChange:()=>m(e.value),onBlur:y,onFocus:S,"aria-describedby":a.ariaDescribedByIds(u)}),t.jsx("span",{children:e.label})]});return g?t.jsx("label",{className:`radio-inline ${h}`,children:f},r):t.jsx("div",{className:`radio ${h}`,children:t.jsx("label",{children:f})},r)}))})}function we(e){const{value:r,registry:{templates:{BaseInputTemplate:a}}}=e;return t.jsxs("div",{className:"field-range-wrapper",children:[t.jsx(a,{type:"range",...e}),t.jsx("span",{className:"range-view",children:r})]})}function Be(e,t){return t?Array.from(e.target.options).slice().filter((e=>e.selected)).map((e=>e.value)):e.target.value}function Ue({schema:e,id:i,options:s,value:o,required:n,disabled:l,readonly:d,multiple:c=!1,autofocus:m=!1,onChange:u,onBlur:h,onFocus:p,placeholder:g}){const{enumOptions:f,enumDisabled:y,emptyValue:S}=s,b=c?[]:"",x=r.useCallback((e=>{const t=Be(e,c);return p(i,a.enumOptionsValueForIndex(t,f,S))}),[p,i,e,c,s]),v=r.useCallback((e=>{const t=Be(e,c);return h(i,a.enumOptionsValueForIndex(t,f,S))}),[h,i,e,c,s]),C=r.useCallback((e=>{const t=Be(e,c);return u(a.enumOptionsValueForIndex(t,f,S))}),[u,e,c,s]),F=a.enumOptionsIndexForValue(o,f,c);return t.jsxs("select",{id:i,name:i,multiple:c,className:"form-control",value:void 0===F?b:F,required:n,disabled:l||d,autoFocus:m,onBlur:v,onFocus:x,onChange:C,"aria-describedby":a.ariaDescribedByIds(i),children:[!c&&void 0===e.default&&t.jsx("option",{value:"",children:g}),Array.isArray(f)&&f.map((({value:e,label:r},a)=>{const i=y&&-1!==y.indexOf(e);return t.jsx("option",{value:String(a),disabled:i,children:r},a)}))]})}function _e({id:e,options:i={},placeholder:s,value:o,required:n,disabled:l,readonly:d,autofocus:c=!1,onChange:m,onBlur:u,onFocus:h}){const p=r.useCallback((({target:{value:e}})=>m(""===e?i.emptyValue:e)),[m,i.emptyValue]),g=r.useCallback((({target:{value:t}})=>u(e,t)),[u,e]),f=r.useCallback((({target:{value:t}})=>h(e,t)),[e,h]);return t.jsx("textarea",{id:e,name:e,className:"form-control",value:o||"",placeholder:s,required:n,disabled:l,readOnly:d,autoFocus:c,rows:i.rows,onBlur:g,onFocus:f,onChange:p,"aria-describedby":a.ariaDescribedByIds(e)})}function Pe(e){const{options:r,registry:i}=e,s=a.getTemplate("BaseInputTemplate",i,r);return t.jsx(s,{...e})}function qe(e){const{onChange:i,options:s,registry:o}=e,n=a.getTemplate("BaseInputTemplate",o,s),l=r.useCallback((e=>i(e?`${e}:00`:void 0)),[i]);return t.jsx(n,{type:"time",...e,onChange:l})}function Re(e){const{options:r,registry:i}=e,s=a.getTemplate("BaseInputTemplate",i,r);return t.jsx(s,{type:"url",...e})}function Le(e){const{options:r,registry:i}=e,s=a.getTemplate("BaseInputTemplate",i,r);return t.jsx(s,{type:"number",...e})}function $e(){return{fields:{AnyOfField:w,ArrayField:k,BooleanField:A,NumberField:_,ObjectField:P,OneOfField:w,SchemaField:L,StringField:$,NullField:V},templates:{ArrayFieldDescriptionTemplate:K,ArrayFieldItemTemplate:M,ArrayFieldTemplate:W,ArrayFieldTitleTemplate:Y,ButtonTemplates:{SubmitButton:G,AddButton:ee,CopyButton:H,MoveDownButton:Q,MoveUpButton:X,RemoveButton:Z},BaseInputTemplate:z,DescriptionFieldTemplate:te,ErrorListTemplate:re,FieldTemplate:se,FieldErrorTemplate:oe,FieldHelpTemplate:ne,ObjectFieldTemplate:le,TitleFieldTemplate:ce,UnsupportedFieldTemplate:me,WrapIfAdditionalTemplate:ue},widgets:{AltDateWidget:fe,AltDateTimeWidget:ye,CheckboxWidget:Se,CheckboxesWidget:be,ColorWidget:xe,DateWidget:ve,DateTimeWidget:Ce,EmailWidget:Fe,FileWidget:Ie,HiddenWidget:Ne,PasswordWidget:ke,RadioWidget:Ae,RangeWidget:we,SelectWidget:Ue,TextWidget:Pe,TextareaWidget:_e,TimeWidget:qe,UpDownWidget:Le,URLWidget:Re},rootSchema:{},formContext:{},translateString:a.englishStringTranslator}}_e.defaultProps={autofocus:!1,options:{}};class Ve extends r.Component{constructor(e){if(super(e),this.formElement=void 0,this.getUsedFormData=(e,t)=>{if(0===t.length&&"object"!=typeof e)return e;const r=b.default(e,t);return Array.isArray(e)?Object.keys(r).map((e=>r[e])):r},this.getFieldNames=(e,t)=>{const r=(e,i=[],s=[[]])=>(Object.keys(e).forEach((o=>{if("object"==typeof e[o]){const t=s.map((e=>[...e,o]));e[o][a.RJSF_ADDITONAL_PROPERTIES_FLAG]&&""!==e[o][a.NAME_KEY]?i.push(e[o][a.NAME_KEY]):r(e[o],i,t)}else o===a.NAME_KEY&&""!==e[o]&&s.forEach((e=>{const r=y.default(t,e);("object"!=typeof r||S.default(r))&&i.push(e)}))})),i);return r(e)},this.onChange=(e,t,r)=>{const{extraErrors:i,omitExtraData:s,liveOmit:o,noValidate:n,liveValidate:l,onChange:d}=this.props,{schemaUtils:c,schema:m}=this.state;(a.isObject(e)||Array.isArray(e))&&(e=this.getStateFromProps(this.props,e).formData);const u=!n&&l;let h={formData:e,schema:m},p=e;if(!0===s&&!0===o){const t=c.retrieveSchema(m,e),r=c.toPathSchema(t,"",e),a=this.getFieldNames(r,e);p=this.getUsedFormData(e,a),h={formData:p}}if(u){const e=this.validate(p);let t=e.errors,r=e.errorSchema;const s=t,o=r;if(i){const s=a.validationDataMerge(e,i);r=s.errorSchema,t=s.errors}h={formData:p,errors:t,errorSchema:r,schemaValidationErrors:s,schemaValidationErrorSchema:o}}else if(!n&&t){const e=i?a.mergeObjects(t,i,"preventDuplicates"):t;h={formData:p,errorSchema:e,errors:a.toErrorList(e)}}this.setState(h,(()=>d&&d({...this.state,...h},r)))},this.reset=()=>{const{onChange:e}=this.props,t={formData:this.getStateFromProps(this.props,void 0).formData,errorSchema:{},errors:[],schemaValidationErrors:[],schemaValidationErrorSchema:{}};this.setState(t,(()=>e&&e({...this.state,...t})))},this.onBlur=(e,t)=>{const{onBlur:r}=this.props;r&&r(e,t)},this.onFocus=(e,t)=>{const{onFocus:r}=this.props;r&&r(e,t)},this.onSubmit=e=>{if(e.preventDefault(),e.target!==e.currentTarget)return;e.persist();const{omitExtraData:t,extraErrors:r,noValidate:i,onSubmit:s}=this.props;let{formData:o}=this.state;const{schema:n,schemaUtils:l}=this.state;if(!0===t){const e=l.retrieveSchema(n,o),t=l.toPathSchema(e,"",o),r=this.getFieldNames(t,o);o=this.getUsedFormData(o,r)}if(i||this.validateForm()){const t=r||{},i=r?a.toErrorList(r):[];this.setState({formData:o,errors:i,errorSchema:t,schemaValidationErrors:[],schemaValidationErrorSchema:{}},(()=>{s&&s({...this.state,formData:o,status:"submitted"},e)}))}},!e.validator)throw new Error("A validator is required for Form functionality to work");this.state=this.getStateFromProps(e,e.formData),this.props.onChange&&!a.deepEquals(this.state.formData,this.props.formData)&&this.props.onChange(this.state),this.formElement=r.createRef()}UNSAFE_componentWillReceiveProps(e){const t=this.getStateFromProps(e,e.formData);a.deepEquals(t.formData,e.formData)||a.deepEquals(t.formData,this.state.formData)||!e.onChange||e.onChange(t),this.setState(t)}getStateFromProps(e,t){const r=this.state||{},i="schema"in e?e.schema:this.props.schema,s=("uiSchema"in e?e.uiSchema:this.props.uiSchema)||{},o=void 0!==t,n=o&&!e.noValidate&&("liveValidate"in e?e.liveValidate:this.props.liveValidate),l=i,d="experimental_defaultFormStateBehavior"in e?e.experimental_defaultFormStateBehavior:this.props.experimental_defaultFormStateBehavior;let c=r.schemaUtils;c&&!c.doesSchemaUtilsDiffer(e.validator,l,d)||(c=a.createSchemaUtils(e.validator,l,d));const m=c.getDefaultFormState(i,t),u=c.retrieveSchema(i,m);let h,p,g=r.schemaValidationErrors,f=r.schemaValidationErrorSchema;if(n){const e=this.validate(m,i,c);h=e.errors,p=e.errorSchema,g=h,f=p}else{const t=e.noValidate?{errors:[],errorSchema:{}}:e.liveValidate?{errors:r.errors||[],errorSchema:r.errorSchema||{}}:{errors:r.schemaValidationErrors||[],errorSchema:r.schemaValidationErrorSchema||{}};h=t.errors,p=t.errorSchema}if(e.extraErrors){const t=a.validationDataMerge({errorSchema:p,errors:h},e.extraErrors);p=t.errorSchema,h=t.errors}const y=c.toIdSchema(u,s["ui:rootFieldId"],m,e.idPrefix,e.idSeparator);return{schemaUtils:c,schema:i,uiSchema:s,idSchema:y,formData:m,edit:o,errors:h,errorSchema:p,schemaValidationErrors:g,schemaValidationErrorSchema:f}}shouldComponentUpdate(e,t){return a.shouldRender(this,e,t)}validate(e,t=this.props.schema,r){const a=r||this.state.schemaUtils,{customValidate:i,transformErrors:s,uiSchema:o}=this.props,n=a.retrieveSchema(t,e);return a.getValidator().validateFormData(e,n,i,s,o)}renderErrors(e){const{errors:r,errorSchema:i,schema:s,uiSchema:o}=this.state,{formContext:n}=this.props,l=a.getUiOptions(o),d=a.getTemplate("ErrorListTemplate",e,l);return r&&r.length?t.jsx(d,{errors:r,errorSchema:i||{},schema:s,uiSchema:o,formContext:n,registry:e}):null}getRegistry(){var e;const{translateString:t,uiSchema:r={}}=this.props,{schemaUtils:i}=this.state,{fields:s,templates:o,widgets:n,formContext:l,translateString:d}=$e();return{fields:{...s,...this.props.fields},templates:{...o,...this.props.templates,ButtonTemplates:{...o.ButtonTemplates,...null===(e=this.props.templates)||void 0===e?void 0:e.ButtonTemplates}},widgets:{...n,...this.props.widgets},rootSchema:this.props.schema,formContext:this.props.formContext||l,schemaUtils:i,translateString:t||d,globalUiOptions:r[a.UI_GLOBAL_OPTIONS_KEY]}}submit(){this.formElement.current&&(this.formElement.current.dispatchEvent(new CustomEvent("submit",{cancelable:!0})),this.formElement.current.requestSubmit())}focusOnError(e){const{idPrefix:t="root",idSeparator:r="_"}=this.props,{property:a}=e,i=x.default(a);""===i[0]?i[0]=t:i.unshift(t);const s=i.join(r);let o=this.formElement.current.elements[s];o||(o=this.formElement.current.querySelector(`input[id^=${s}`)),o&&o.length&&(o=o[0]),o&&o.focus()}validateForm(){const{extraErrors:e,extraErrorsBlockSubmit:t,focusOnFirstError:r,onError:i}=this.props,{formData:s}=this.state,o=this.validate(s);let n=o.errors,l=o.errorSchema;const d=n,c=l;if(n.length>0||e&&t){if(e){const t=a.validationDataMerge(o,e);l=t.errorSchema,n=t.errors}return r&&("function"==typeof r?r(n[0]):this.focusOnError(n[0])),this.setState({errors:n,errorSchema:l,schemaValidationErrors:d,schemaValidationErrorSchema:c},(()=>{i?i(n):console.error("Form validation failed",n)})),!1}return!0}render(){const{children:e,id:r,idPrefix:i,idSeparator:s,className:o="",tagName:n,name:l,method:d,target:c,action:m,autoComplete:u,enctype:h,acceptcharset:p,noHtml5Validate:g=!1,disabled:f=!1,readonly:y=!1,formContext:S,showErrorList:b="top",_internalFormWrapper:x}=this.props,{schema:v,uiSchema:C,formData:F,errorSchema:j,idSchema:D}=this.state,O=this.getRegistry(),{SchemaField:T}=O.fields,{SubmitButton:E}=O.templates.ButtonTemplates,I=x?n:void 0,N=x||n||"form";let{[a.SUBMIT_BTN_OPTIONS_KEY]:k={}}=a.getUiOptions(C);f&&(k={...k,props:{...k.props,disabled:!0}});const A={[a.UI_OPTIONS_KEY]:{[a.SUBMIT_BTN_OPTIONS_KEY]:k}};return t.jsxs(N,{className:o||"rjsf",id:r,name:l,method:d,target:c,action:m,autoComplete:u,encType:h,acceptCharset:p,noValidate:g,onSubmit:this.onSubmit,as:I,ref:this.formElement,children:["top"===b&&this.renderErrors(O),t.jsx(T,{name:"",schema:v,uiSchema:C,errorSchema:j,idSchema:D,idPrefix:i,idSeparator:s,formContext:S,formData:F,onChange:this.onChange,onBlur:this.onBlur,onFocus:this.onFocus,registry:O,disabled:f,readonly:y}),e||t.jsx(E,{uiSchema:A,registry:O}),"bottom"===b&&this.renderErrors(O)]})}}e.default=Ve,e.getDefaultRegistry=$e,e.withTheme=function(e){return r.forwardRef((({fields:r,widgets:a,templates:i,...s},o)=>{var n,l;return r={...null==e?void 0:e.fields,...r},a={...null==e?void 0:e.widgets,...a},i={...null==e?void 0:e.templates,...i,ButtonTemplates:{...null==e||null===(n=e.templates)||void 0===n?void 0:n.ButtonTemplates,...null===(l=i)||void 0===l?void 0:l.ButtonTemplates}},t.jsx(Ve,{...e,...s,fields:r,widgets:a,templates:i,ref:o})}))},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=core.umd.production.min.js.map |
@@ -101,5 +101,8 @@ import { ReactNode, FormEvent, ElementType, Ref, Component, RefObject, ComponentType } from 'react'; | ||
/** This prop allows passing in custom errors that are augmented with the existing JSON Schema errors on the form; it | ||
* can be used to implement asynchronous validation | ||
* can be used to implement asynchronous validation. By default, these are non-blocking errors, meaning that you can | ||
* still submit the form when these are the only errors displayed to the user. | ||
*/ | ||
extraErrors?: ErrorSchema<T>; | ||
/** If set to true, causes the `extraErrors` to become blocking when the form is submitted */ | ||
extraErrorsBlockSubmit?: boolean; | ||
/** If set to true, turns off HTML5 validation on the form; Set to `false` by default */ | ||
@@ -294,3 +297,3 @@ noHtml5Validate?: boolean; | ||
* `formData` in the state if `omitExtraData` is true. It will validate the resulting `formData`, reporting errors | ||
* via the `onError()` callback unless validation is disabled. Finally it will add in any `extraErrors` and then call | ||
* via the `onError()` callback unless validation is disabled. Finally, it will add in any `extraErrors` and then call | ||
* back the `onSubmit` callback if it was provided. | ||
@@ -297,0 +300,0 @@ * |
{ | ||
"name": "@rjsf/core", | ||
"version": "5.10.0", | ||
"version": "5.11.1", | ||
"description": "A simple React component capable of building HTML forms out of a JSON schema.", | ||
@@ -12,8 +12,7 @@ "scripts": { | ||
"publish-to-npm": "npm run build && npm publish", | ||
"test": "dts test", | ||
"test:debug": "node --inspect-brk node_modules/.bin/dts test", | ||
"test:update": "dts test --u", | ||
"test:watch": "dts test --watch", | ||
"test-coverage": "dts test --coverage", | ||
"bump-packages": "npm update --save --lockfile-version 2" | ||
"test": "jest", | ||
"test:debug": "node --inspect-brk node_modules/.bin/jest", | ||
"test:update": "jest --u", | ||
"test:watch": "jest --watch", | ||
"test-coverage": "jest --coverage" | ||
}, | ||
@@ -49,14 +48,11 @@ "lint-staged": { | ||
"devDependencies": { | ||
"@babel/cli": "^7.22.9", | ||
"@babel/core": "^7.22.9", | ||
"@babel/plugin-proposal-class-properties": "^7.18.6", | ||
"@babel/plugin-proposal-optional-chaining": "^7.21.0", | ||
"@babel/plugin-transform-object-assign": "^7.22.5", | ||
"@babel/plugin-transform-react-jsx": "^7.22.5", | ||
"@babel/preset-env": "^7.22.9", | ||
"@babel/preset-react": "^7.22.5", | ||
"@babel/register": "^7.22.5", | ||
"@rjsf/utils": "^5.10.0", | ||
"@rjsf/validator-ajv6": "^5.10.0", | ||
"@rjsf/validator-ajv8": "^5.10.0", | ||
"@babel/preset-typescript": "^7.22.5", | ||
"@rjsf/utils": "^5.11.1", | ||
"@rjsf/validator-ajv6": "^5.11.1", | ||
"@rjsf/validator-ajv8": "^5.11.1", | ||
"@types/lodash": "^4.14.195", | ||
@@ -68,2 +64,3 @@ "@types/react": "^17.0.62", | ||
"atob": "^2.1.2", | ||
"babel-jest": "^29.6.1", | ||
"chai": "^3.5.0", | ||
@@ -73,2 +70,4 @@ "dts-cli": "^1.6.3", | ||
"html": "^1.0.0", | ||
"jest": "^29.6.1", | ||
"jest-environment-jsdom": "^29.6.1", | ||
"jsdom": "^20.0.3", | ||
@@ -104,3 +103,3 @@ "mocha": "^10.2.0", | ||
}, | ||
"gitHead": "d05138f4dc678e0f6f85e13780dd3e17074791c8" | ||
"gitHead": "0a7771f489753b9743d15aa9ae69dbf0ce821541" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13750
1963639