@rjsf/core
Advanced tools
Comparing version 5.0.0-beta.18 to 5.0.0-beta.19
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@rjsf/utils"),r=require("lodash/get"),a=require("lodash/isEmpty"),i=require("lodash/pick"),n=require("lodash/isObject"),o=require("lodash/set"),l=require("nanoid"),s=require("lodash/omit"),d=require("lodash/has"),u=require("lodash/unset");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var m=c(e),f=c(r),p=c(a),h=c(i),v=c(n),y=c(o),g=c(s),E=c(d),S=c(u);function b(){return b=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},b.apply(this,arguments)}function C(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,F(e,t)}function F(e,t){return F=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},F(e,t)}function D(e,t){if(null==e)return{};var r,a,i={},n=Object.keys(e);for(a=0;a<n.length;a++)t.indexOf(r=n[a])>=0||(i[r]=e[r]);return i}var k=["widget"],O=["widget"],T=["widget"];function x(){return l.nanoid()}function A(e){return Array.isArray(e)?e.map((function(e){return{key:x(),item:e}})):[]}function N(e){return Array.isArray(e)?e.map((function(e){return e.item})):[]}var w=function(e){function r(r){var a;(a=e.call(this,r)||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(t){a._handleAddClick(t,e)}},a.onDropIndexClick=function(e){return function(t){t&&t.preventDefault();var r,i=a.props,n=i.onChange,o=i.errorSchema,l=a.state.keyedFormData;if(o)for(var s in r={},o){var d=parseInt(s);d<e?y.default(r,[d],o[s]):d>e&&y.default(r,[d-1],o[s])}var u=l.filter((function(t,r){return r!==e}));a.setState({keyedFormData:u,updatedKeyedFormData:!0},(function(){return n(N(u),r)}))}},a.onReorderClick=function(e,t){return function(r){r&&(r.preventDefault(),r.currentTarget.blur());var i,n=a.props,o=n.onChange,l=n.errorSchema;if(a.props.errorSchema)for(var s in i={},l){var d=parseInt(s);d==e?y.default(i,[t],l[e]):d==t?y.default(i,[e],l[t]):y.default(i,[s],l[d])}var u,c=a.state.keyedFormData,m=((u=c.slice()).splice(e,1),u.splice(t,0,c[e]),u);a.setState({keyedFormData:m},(function(){return o(N(m),i)}))}},a.onChangeForIndex=function(e){return function(t,r,i){var n,o=a.props,l=o.formData,s=o.errorSchema;(0,o.onChange)((Array.isArray(l)?l:[]).map((function(r,a){return e===a?void 0===t?null:t:r})),s&&s&&b({},s,((n={})[e]=r,n)),i)}},a.onSelectChange=function(e){var t=a.props,r=t.idSchema;(0,t.onChange)(e,void 0,r&&r.$id)};var i=r.formData,n=A(void 0===i?[]:i);return a.state={keyedFormData:n,updatedKeyedFormData:!1},a}C(r,e),r.getDerivedStateFromProps=function(e,t){if(t.updatedKeyedFormData)return{updatedKeyedFormData:!1};var r=Array.isArray(e.formData)?e.formData:[],a=t.keyedFormData||[];return{keyedFormData:r.length===a.length?a.map((function(e,t){return{key:e.key,item:r[t]}})):A(r)}};var a,i,n=r.prototype;return n.isItemRequired=function(e){return Array.isArray(e.type)?!e.type.includes("null"):"null"!==e.type},n.canAddItem=function(e){var r=this.props,a=r.schema,i=t.getUiOptions(r.uiSchema).addable;return!1!==i&&(i=void 0===a.maxItems||e.length<a.maxItems),i},n._handleAddClick=function(e,t){e&&e.preventDefault();var r=this.props.onChange,a=this.state.keyedFormData,i={key:x(),item:this._getNewFormDataRow()},n=[].concat(a);void 0!==t?n.splice(t,0,i):n.push(i),this.setState({keyedFormData:n,updatedKeyedFormData:!0},(function(){return r(N(n))}))},n.render=function(){var e=this.props,r=e.schema,a=e.uiSchema,i=e.idSchema,n=e.registry,o=n.schemaUtils;if(!(t.ITEMS_KEY in r)){var l=t.getUiOptions(a),s=t.getTemplate("UnsupportedFieldTemplate",n,l);return m.default.createElement(s,{schema:r,idSchema:i,reason:"Missing items definition",registry:n})}return o.isMultiSelect(r)?this.renderMultiSelect():t.isCustomWidget(a)?this.renderCustomWidget():t.isFixedItems(r)?this.renderFixedArray():o.isFilesArray(r,a)?this.renderFiles():this.renderNormalArray()},n.renderNormalArray=function(){var e=this,r=this.props,a=r.schema,i=r.uiSchema,n=void 0===i?{}:i,o=r.errorSchema,l=r.idSchema,s=r.name,d=r.disabled,u=void 0!==d&&d,c=r.readonly,f=void 0!==c&&c,p=r.autofocus,h=void 0!==p&&p,y=r.required,g=void 0!==y&&y,E=r.registry,S=r.onBlur,C=r.onFocus,F=r.idPrefix,D=r.idSeparator,k=void 0===D?"_":D,O=r.rawErrors,T=this.state.keyedFormData,x=void 0===a.title?s:a.title,A=E.schemaUtils,w=E.formContext,I=t.getUiOptions(n),B=v.default(a.items)?a.items:{},U=A.retrieveSchema(B),P=N(this.state.keyedFormData),q=this.canAddItem(P),R={canAdd:q,items:T.map((function(t,r){var a=t.key,i=t.item,d=A.retrieveSchema(B,i),u=o?o[r]:void 0,c=A.toIdSchema(d,l.$id+k+r,i,F,k);return e.renderArrayFieldItem({key:a,index:r,name:s&&s+"-"+r,canAdd:q,canMoveUp:r>0,canMoveDown:r<P.length-1,itemSchema:d,itemIdSchema:c,itemErrorSchema:u,itemData:i,itemUiSchema:n.items,autofocus:h&&0===r,onBlur:S,onFocus:C,rawErrors:O,totalItems:T.length})})),className:"field field-array field-array-of-"+U.type,disabled:u,idSchema:l,uiSchema:n,onAddClick:this.onAddClick,readonly:f,required:g,schema:a,title:x,formContext:w,formData:P,rawErrors:O,registry:E},_=t.getTemplate("ArrayFieldTemplate",E,I);return m.default.createElement(_,b({},R))},n.renderCustomWidget=function(){var e=this.props,r=e.schema,a=e.idSchema,i=e.uiSchema,n=e.disabled,o=void 0!==n&&n,l=e.readonly,s=void 0!==l&&l,d=e.autofocus,u=void 0!==d&&d,c=e.required,f=void 0!==c&&c,p=e.hideError,h=e.placeholder,v=e.onBlur,y=e.onFocus,g=e.formData,E=void 0===g?[]:g,S=e.registry,b=e.rawErrors,C=S.widgets,F=S.formContext,O=r.title||e.name,T=t.getUiOptions(i),x=T.widget,A=D(T,k),N=t.getWidget(r,x,C);return m.default.createElement(N,{id:a.$id,multiple:!0,onChange:this.onSelectChange,onBlur:v,onFocus:y,options:A,schema:r,uiSchema:i,registry:S,value:E,disabled:o,readonly:s,hideError:p,required:f,label:O,placeholder:h,formContext:F,autofocus:u,rawErrors:b})},n.renderMultiSelect=function(){var e=this.props,r=e.schema,a=e.idSchema,i=e.uiSchema,n=e.formData,o=void 0===n?[]:n,l=e.disabled,s=void 0!==l&&l,d=e.readonly,u=void 0!==d&&d,c=e.autofocus,f=void 0!==c&&c,p=e.required,h=void 0!==p&&p,v=e.placeholder,y=e.onBlur,g=e.onFocus,E=e.registry,S=e.rawErrors,C=e.name,F=E.widgets,k=E.formContext,T=E.schemaUtils.retrieveSchema(r.items,o),x=r.title||C,A=t.optionsList(T),N=t.getUiOptions(i),w=N.widget,I=void 0===w?"select":w,B=D(N,O),U=t.getWidget(r,I,F);return m.default.createElement(U,{id:a.$id,multiple:!0,onChange:this.onSelectChange,onBlur:y,onFocus:g,options:b({},B,{enumOptions:A}),schema:r,uiSchema:i,registry:E,value:o,disabled:s,readonly:u,required:h,label:x,placeholder:v,formContext:k,autofocus:f,rawErrors:S})},n.renderFiles=function(){var e=this.props,r=e.schema,a=e.uiSchema,i=e.idSchema,n=e.disabled,o=void 0!==n&&n,l=e.readonly,s=void 0!==l&&l,d=e.autofocus,u=void 0!==d&&d,c=e.required,f=void 0!==c&&c,p=e.onBlur,h=e.onFocus,v=e.registry,y=e.formData,g=void 0===y?[]:y,E=e.rawErrors,S=r.title||e.name,b=v.widgets,C=v.formContext,F=t.getUiOptions(a),k=F.widget,O=void 0===k?"files":k,x=D(F,T),A=t.getWidget(r,O,b);return m.default.createElement(A,{options:x,id:i.$id,multiple:!0,onChange:this.onSelectChange,onBlur:p,onFocus:h,schema:r,uiSchema:a,title:S,value:g,disabled:o,readonly:s,required:f,registry:v,formContext:C,autofocus:u,rawErrors:E,label:""})},n.renderFixedArray=function(){var e=this,r=this.props,a=r.schema,i=r.uiSchema,n=void 0===i?{}:i,o=r.formData,l=void 0===o?[]:o,s=r.errorSchema,d=r.idPrefix,u=r.idSeparator,c=void 0===u?"_":u,f=r.idSchema,p=r.name,h=r.disabled,y=void 0!==h&&h,g=r.readonly,E=void 0!==g&&g,S=r.autofocus,C=void 0!==S&&S,F=r.required,D=void 0!==F&&F,k=r.registry,O=r.onBlur,T=r.onFocus,x=r.rawErrors,A=this.state.keyedFormData,N=this.props.formData,w=void 0===N?[]:N,I=a.title||p,B=t.getUiOptions(n),U=k.schemaUtils,P=k.formContext,q=(v.default(a.items)?a.items:[]).map((function(e,t){return U.retrieveSchema(e,l[t])})),R=v.default(a.additionalItems)?U.retrieveSchema(a.additionalItems,l):null;(!w||w.length<q.length)&&(w=(w=w||[]).concat(new Array(q.length-w.length)));var _=this.canAddItem(w)&&!!R,j={canAdd:_,className:"field field-array field-array-fixed-items",disabled:y,idSchema:f,formData:l,items:A.map((function(t,r){var i=t.key,o=t.item,l=r>=q.length,u=l&&v.default(a.additionalItems)?U.retrieveSchema(a.additionalItems,o):q[r],m=U.toIdSchema(u,f.$id+c+r,o,d,c),h=l?n.additionalItems||{}:Array.isArray(n.items)?n.items[r]:n.items||{};return e.renderArrayFieldItem({key:i,index:r,name:p&&p+"-"+r,canAdd:_,canRemove:l,canMoveUp:r>=q.length+1,canMoveDown:l&&r<w.length-1,itemSchema:u,itemData:o,itemUiSchema:h,itemIdSchema:m,itemErrorSchema:s?s[r]:void 0,autofocus:C&&0===r,onBlur:O,onFocus:T,rawErrors:x,totalItems:A.length})})),onAddClick:this.onAddClick,readonly:E,required:D,registry:k,schema:a,uiSchema:n,title:I,formContext:P,rawErrors:x},V=t.getTemplate("ArrayFieldTemplate",k,B);return m.default.createElement(V,b({},j))},n.renderArrayFieldItem=function(e){var r=e.key,a=e.index,i=e.name,n=e.canAdd,o=e.canRemove,l=void 0===o||o,s=e.canMoveUp,d=void 0===s||s,u=e.canMoveDown,c=void 0===u||u,f=e.itemSchema,p=e.itemData,h=e.itemUiSchema,v=e.itemIdSchema,y=e.itemErrorSchema,g=e.autofocus,E=e.onBlur,S=e.onFocus,b=e.rawErrors,C=e.totalItems,F=this.props,D=F.disabled,k=F.hideError,O=F.idPrefix,T=F.idSeparator,x=F.readonly,A=F.registry,N=F.formContext,w=A.fields,I=w.ArraySchemaField||w.SchemaField,B=t.getUiOptions(F.uiSchema),U=B.orderable,P=void 0===U||U,q=B.removable,R={moveUp:P&&d,moveDown:P&&c,remove:(void 0===q||q)&&l,toolbar:!1};return R.toolbar=Object.keys(R).some((function(e){return R[e]})),{children:m.default.createElement(I,{name:i,index:a,schema:f,uiSchema:h,formData:p,formContext:N,errorSchema:y,idPrefix:O,idSeparator:T,idSchema:v,required:this.isItemRequired(f),onChange:this.onChangeForIndex(a),onBlur:E,onFocus:S,registry:A,disabled:D,readonly:x,hideError:k,autofocus:g,rawErrors:b}),className:"array-item",disabled:D,canAdd:n,hasToolbar:R.toolbar,hasMoveUp:R.moveUp,hasMoveDown:R.moveDown,hasRemove:R.remove,index:a,totalItems:C,key:r,onAddIndexClick:this.onAddIndexClick,onDropIndexClick:this.onDropIndexClick,onReorderClick:this.onReorderClick,readonly:x,registry:A,schema:f,uiSchema:h}},a=r,(i=[{key:"itemTitle",get:function(){var e=this.props.schema;return f.default(e,[t.ITEMS_KEY,"title"],f.default(e,[t.ITEMS_KEY,"description"],"Item"))}}])&&function(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,"symbol"==typeof(i=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var a=r.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}(a.prototype,i),Object.defineProperty(a,"prototype",{writable:!1}),r}(e.Component),I=["widget"];function B(e){var r,a=e.schema,i=e.name,n=e.uiSchema,o=e.idSchema,l=e.formData,s=e.registry,d=e.required,u=e.disabled,c=e.readonly,f=e.autofocus,p=e.onChange,h=e.onFocus,y=e.onBlur,g=e.rawErrors,E=a.title,S=s.widgets,C=s.formContext,F=t.getUiOptions(n),k=F.widget,O=void 0===k?"checkbox":k,T=D(F,I),x=t.getWidget(a,O,S);if(Array.isArray(a.oneOf))r=t.optionsList({oneOf:a.oneOf.map((function(e){if(v.default(e))return b({},e,{title:e.title||(!0===e.const?"Yes":"No")})})).filter((function(e){return e}))});else{var A,N=a,w=null!=(A=a.enum)?A:[!0,!1];r=!N.enumNames&&2===w.length&&w.every((function(e){return"boolean"==typeof e}))?[{value:w[0],label:w[0]?"Yes":"No"},{value:w[1],label:w[1]?"Yes":"No"}]:t.optionsList({enum:w,enumNames:N.enumNames})}return m.default.createElement(x,{options:b({},T,{enumOptions:r}),schema:a,uiSchema:n,id:o.$id,onChange:p,onFocus:h,onBlur:y,label:void 0===E?i:E,value:l,required:d,disabled:u,readonly:c,registry:s,formContext:C,autofocus:f,rawErrors:g})}var U=["widget","placeholder","autofocus","autocomplete"],P=function(e){function r(t){var r;(r=e.call(this,t)||this).onOptionChange=function(e){var t=r.state.selectedOption,a=r.props,i=a.formData,n=a.onChange,o=a.options,l=a.registry.schemaUtils,s=void 0!==e?parseInt(e,10):-1;if(s!==t){var d=s>=0?l.retrieveSchema(o[s],i):void 0,u=t>=0?l.retrieveSchema(o[t],i):void 0,c=l.sanitizeDataForNewSchema(d,u,i);c&&d&&(c=l.getDefaultFormState(d,c,"excludeObjectChildren")),n(c,void 0,r.getFieldId()),r.setState({selectedOption:s})}};var a=r.props;return r.state={selectedOption:r.getMatchingOption(0,a.formData,a.options)},r}C(r,e);var a=r.prototype;return a.componentDidUpdate=function(e,r){var a=this.props,i=a.formData,n=a.options,o=a.idSchema,l=this.state.selectedOption;if(!t.deepEquals(i,e.formData)&&o.$id===e.idSchema.$id){var s=this.getMatchingOption(l,i,n);if(!r||s===l)return;this.setState({selectedOption:s})}},a.getMatchingOption=function(e,t,r){var a=this.props.registry.schemaUtils.getClosestMatchingOption(t,r,e);return a>0?a:e||0},a.getFieldId=function(){var e=this.props;return e.idSchema.$id+(e.schema.oneOf?"__oneof_select":"__anyof_select")},a.render=function(){var e,r=this.props,a=r.baseType,i=r.disabled,n=void 0!==i&&i,o=r.errorSchema,l=void 0===o?{}:o,s=r.formContext,d=r.onBlur,u=r.onFocus,c=r.options,h=r.registry,v=h.widgets,y=h.fields.SchemaField,E=this.state.selectedOption,S=t.getUiOptions(r.uiSchema),C=S.widget,F=void 0===C?"select":C,k=S.placeholder,O=S.autofocus,T=S.autocomplete,x=D(S,U),A=t.getWidget({type:"number"},F,v),N=f.default(l,t.ERRORS_KEY,[]),w=g.default(l,[t.ERRORS_KEY]),I=c[E]||null;I&&(e=I.type?I:Object.assign({},I,{type:a}));var B=c.map((function(e,t){return{label:e.title||"Option "+(t+1),value:t}}));return m.default.createElement("div",{className:"panel panel-default panel-body"},m.default.createElement("div",{className:"form-group"},m.default.createElement(A,{id:this.getFieldId(),schema:{type:"number",default:0},onChange:this.onOptionChange,onBlur:d,onFocus:u,disabled:n||p.default(B),multiple:!1,rawErrors:N,errorSchema:w,value:E,options:b({enumOptions:B},x),registry:h,formContext:s,placeholder:k,autocomplete:T,autofocus:O,label:""})),null!==I&&m.default.createElement(y,b({},this.props,{schema:e})))},r}(e.Component),q=/\.([0-9]*0)*$/,R=/[0.]0*$/;function _(r){var a=r.registry,i=r.onChange,n=r.formData,o=e.useState(r.value),l=o[0],s=o[1],d=a.fields.StringField,u=n,c=e.useCallback((function(e){s(e),"."===(""+e).charAt(0)&&(e="0"+e);var r="string"==typeof e&&e.match(q)?t.asNumber(e.replace(R,"")):t.asNumber(e);i(r)}),[i]);if("string"==typeof l&&"number"==typeof u){var f=new RegExp((""+u).replace(".","\\.")+"\\.?0*$");l.match(f)&&(u=l)}return m.default.createElement(d,b({},r,{formData:u,onChange:c}))}var j=function(e){function r(){for(var r,a=arguments.length,i=new Array(a),n=0;n<a;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,l,s=r.props,d=s.errorSchema;void 0===a&&t&&(a=""),(0,s.onChange)(b({},s.formData,((o={})[e]=a,o)),d&&d&&b({},d,((l={})[e]=i,l)),n)}},r.onDropPropertyClick=function(e){return function(t){t.preventDefault();var a=r.props,i=a.onChange,n=b({},a.formData);S.default(n,e),i(n)}},r.getAvailableKey=function(e,a){for(var i=t.getUiOptions(r.props.uiSchema).duplicateKeySuffixSeparator,n=void 0===i?"-":i,o=0,l=e;E.default(a,l);)l=""+e+n+ ++o;return l},r.onKeyChange=function(e){return function(t,a){var i,n;if(e!==t){var o=r.props,l=o.formData,s=o.onChange,d=o.errorSchema;t=r.getAvailableKey(t,l);var u=b({},l),c=((i={})[e]=t,i),m=Object.keys(u).map((function(e){var t;return(t={})[c[e]||e]=u[e],t})),f=Object.assign.apply(Object,[{}].concat(m));r.setState({wasPropertyKeyModified:!0}),s(f,d&&d&&b({},d,((n={})[t]=a,n)))}}},r.handleAddClick=function(e){return function(){if(e.additionalProperties){var a=r.props,i=a.formData,n=a.onChange,o=a.registry,l=b({},i),s=void 0;if(v.default(e.additionalProperties)){s=e.additionalProperties.type;var d=e.additionalProperties;t.REF_KEY in d&&(s=(d=o.schemaUtils.retrieveSchema({$ref:d[t.REF_KEY]},i)).type),s||!(t.ANY_OF_KEY in d)&&!(t.ONE_OF_KEY in d)||(s="object")}var u=r.getAvailableKey("newKey",l);y.default(l,u,r.getDefaultValue(s)),n(l)}}},r}C(r,e);var a=r.prototype;return a.isRequired=function(e){var t=this.props.schema;return Array.isArray(t.required)&&-1!==t.required.indexOf(e)},a.getDefaultValue=function(e){switch(e){case"string":default:return"New Value";case"array":return[];case"boolean":return!1;case"null":return null;case"number":return 0;case"object":return{}}},a.render=function(){var e,r=this,a=this.props,i=a.uiSchema,n=void 0===i?{}:i,o=a.formData,l=a.errorSchema,s=a.idSchema,d=a.name,u=a.required,c=void 0!==u&&u,p=a.disabled,h=void 0!==p&&p,v=a.readonly,y=void 0!==v&&v,g=a.hideError,S=a.idPrefix,C=a.idSeparator,F=a.onBlur,D=a.onFocus,k=a.registry,O=k.formContext,T=k.fields.SchemaField,x=k.schemaUtils.retrieveSchema(a.schema,o),A=t.getUiOptions(n),N=x.properties,w=void 0===N?{}:N,I=void 0===x.title?d:x.title,B=A.description||x.description;try{var U=Object.keys(w);e=t.orderProperties(U,A.order)}catch(e){return m.default.createElement("div",null,m.default.createElement("p",{className:"config-error",style:{color:"red"}},"Invalid ",d||"root"," object field configuration:",m.default.createElement("em",null,e.message),"."),m.default.createElement("pre",null,JSON.stringify(x)))}var P=t.getTemplate("ObjectFieldTemplate",k,A),q={title:A.title||I,description:B,properties:e.map((function(e){var a=E.default(x,[t.PROPERTIES_KEY,e,t.ADDITIONAL_PROPERTY_FLAG]),i=a?n.additionalProperties:n[e],d="hidden"===t.getUiOptions(i).widget,u=f.default(s,[e],{});return{content:m.default.createElement(T,{key:e,name:e,required:r.isRequired(e),schema:f.default(x,[t.PROPERTIES_KEY,e],{}),uiSchema:i,errorSchema:f.default(l,e),idSchema:u,idPrefix:S,idSeparator:C,formData:f.default(o,e),formContext:O,wasPropertyKeyModified:r.state.wasPropertyKeyModified,onKeyChange:r.onKeyChange(e),onChange:r.onPropertyChange(e,a),onBlur:F,onFocus:D,registry:k,disabled:h,readonly:y,hideError:g,onDropPropertyClick:r.onDropPropertyClick}),name:e,readonly:y,disabled:h,required:c,hidden:d}})),readonly:y,disabled:h,required:c,idSchema:s,uiSchema:n,schema:x,formData:o,formContext:O,registry:k};return m.default.createElement(P,b({},q,{onAddClick:this.handleAddClick}))},r}(e.Component),V=["__errors"],K={array:"ArrayField",boolean:"BooleanField",integer:"NumberField",number:"NumberField",object:"ObjectField",string:"StringField",null:"NullField"};function M(e){var r=e.schema,a=e.idSchema,i=e.uiSchema,n=e.formData,o=e.errorSchema,l=e.idPrefix,s=e.idSeparator,d=e.name,u=e.onChange,c=e.onKeyChange,f=e.onDropPropertyClick,p=e.required,h=e.registry,y=e.wasPropertyKeyModified,E=void 0!==y&&y,S=h.formContext,C=h.schemaUtils,F=t.getUiOptions(i),k=t.getTemplate("FieldTemplate",h,F),O=t.getTemplate("DescriptionFieldTemplate",h,F),T=t.getTemplate("FieldHelpTemplate",h,F),x=t.getTemplate("FieldErrorTemplate",h,F),A=C.retrieveSchema(r,n),N=a[t.ID_KEY],w=t.mergeObjects(C.toIdSchema(A,N,n,l,s),a),I=m.default.useCallback((function(e,t,r){return u(e,t,r||N)}),[N,u]),B=function(e,r,a,i){var n=r.field,o=i.fields;if("function"==typeof n)return n;if("string"==typeof n&&n in o)return o[n];var l=t.getSchemaType(e),s=Array.isArray(l)?l[0]:l||"",d=K[s];return d||!e.anyOf&&!e.oneOf?d in o?o[d]:function(){var n=t.getTemplate("UnsupportedFieldTemplate",i,r);return m.default.createElement(n,{schema:e,idSchema:a,reason:"Unknown field type "+e.type,registry:i})}:function(){return null}}(A,F,w,h),U=Boolean(e.disabled||F.disabled),P=Boolean(e.readonly||F.readonly||e.schema.readOnly||A.readOnly),q=F.hideError,R=void 0===q?e.hideError:Boolean(q),_=Boolean(e.autofocus||F.autofocus);if(0===Object.keys(A).length)return null;var j=C.getDisplayLabel(A,i),M=o||{},W=M.__errors,L=D(M,V),Y=g.default(i,["ui:classNames","classNames","ui:style"]);t.UI_OPTIONS_KEY in Y&&(Y[t.UI_OPTIONS_KEY]=g.default(Y[t.UI_OPTIONS_KEY],["classNames","style"]));var $,z=m.default.createElement(B,b({},e,{onChange:I,idSchema:w,schema:A,uiSchema:Y,disabled:U,readonly:P,hideError:R,autofocus:_,errorSchema:L,formContext:S,rawErrors:W})),H=w[t.ID_KEY];$=E||t.ADDITIONAL_PROPERTY_FLAG in A?d:F.title||e.schema.title||A.title||d;var J=F.description||e.schema.description||A.description||"",G=F.help,Q="hidden"===F.widget,X=["form-group","field","field-"+A.type];!R&&W&&W.length>0&&X.push("field-error has-error has-danger"),null!=i&&i.classNames&&X.push(i.classNames),F.classNames&&X.push(F.classNames);var Z=m.default.createElement(T,{help:G,idSchema:w,schema:A,uiSchema:i,hasErrors:!R&&W&&W.length>0,registry:h}),ee=R?void 0:m.default.createElement(x,{errors:W,errorSchema:o,idSchema:w,schema:A,uiSchema:i,registry:h}),te={description:m.default.createElement(O,{id:t.descriptionId(H),description:J,schema:A,uiSchema:i,registry:h}),rawDescription:J,help:Z,rawHelp:"string"==typeof G?G:void 0,errors:ee,rawErrors:R?void 0:W,id:H,label:$,hidden:Q,onChange:u,onKeyChange:c,onDropPropertyClick:f,required:p,disabled:U,readonly:P,hideError:R,displayLabel:j,classNames:X.join(" ").trim(),style:F.style,formContext:S,formData:n,schema:A,uiSchema:i,registry:h},re=h.fields.AnyOfField,ae=h.fields.OneOfField;return m.default.createElement(k,b({},te),m.default.createElement(m.default.Fragment,null,z,A.anyOf&&!(null!=i&&i["ui:field"])&&!C.isSelect(A)&&m.default.createElement(re,{name:d,disabled:U,readonly:P,hideError:R,errorSchema:o,formData:n,formContext:S,idPrefix:l,idSchema:w,idSeparator:s,onBlur:e.onBlur,onChange:e.onChange,onFocus:e.onFocus,options:A.anyOf.map((function(e){return C.retrieveSchema(v.default(e)?e:{},n)})),baseType:A.type,registry:h,schema:A,uiSchema:i}),A.oneOf&&!(null!=i&&i["ui:field"])&&!C.isSelect(A)&&m.default.createElement(ae,{name:d,disabled:U,readonly:P,hideError:R,errorSchema:o,formData:n,formContext:S,idPrefix:l,idSchema:w,idSeparator:s,onBlur:e.onBlur,onChange:e.onChange,onFocus:e.onFocus,options:A.oneOf.map((function(e){return C.retrieveSchema(v.default(e)?e:{},n)})),baseType:A.type,registry:h,schema:A,uiSchema:i})))}var W=function(e){function r(){return e.apply(this,arguments)||this}C(r,e);var a=r.prototype;return a.shouldComponentUpdate=function(e){return!t.deepEquals(this.props,e)},a.render=function(){return m.default.createElement(M,b({},this.props))},r}(m.default.Component),L=["widget","placeholder"];function Y(e){var r=e.schema,a=e.name,i=e.uiSchema,n=e.idSchema,o=e.formData,l=e.required,s=e.disabled,d=void 0!==s&&s,u=e.readonly,c=void 0!==u&&u,f=e.autofocus,p=void 0!==f&&f,h=e.onChange,v=e.onBlur,y=e.onFocus,g=e.registry,E=e.rawErrors,S=r.title,C=r.format,F=g.widgets,k=g.formContext,O=g.schemaUtils.isSelect(r)?t.optionsList(r):void 0,T=O?"select":"text";C&&t.hasWidget(r,C,F)&&(T=C);var x=t.getUiOptions(i),A=x.widget,N=void 0===A?T:A,w=x.placeholder,I=void 0===w?"":w,B=D(x,L),U=t.getWidget(r,N,F);return m.default.createElement(U,{options:b({},B,{enumOptions:O}),schema:r,uiSchema:i,id:n.$id,label:void 0===S?a:S,value:o,onChange:h,onBlur:v,onFocus:y,required:l,disabled:d,readonly:c,formContext:k,autofocus:p,registry:g,placeholder:I,rawErrors:E})}function $(t){var r=t.formData,a=t.onChange;return e.useEffect((function(){void 0===r&&a(null)}),[r,a]),null}function z(e){var r=e.idSchema,a=e.description,i=e.registry,n=e.schema,o=e.uiSchema,l=t.getUiOptions(o),s=l.label;if(!a||void 0!==s&&!s)return null;var d=t.getTemplate("DescriptionFieldTemplate",i,l);return m.default.createElement(d,{id:t.descriptionId(r),description:a,schema:n,uiSchema:o,registry:i})}function H(e){var t=e.disabled,r=e.hasToolbar,a=e.hasMoveDown,i=e.hasMoveUp,n=e.hasRemove,o=e.index,l=e.onDropIndexClick,s=e.onReorderClick,d=e.readonly,u=e.registry,c=e.uiSchema,f=u.templates.ButtonTemplates,p=f.MoveDownButton,h=f.MoveUpButton,v=f.RemoveButton,y={flex:1,paddingLeft:6,paddingRight:6,fontWeight:"bold"};return m.default.createElement("div",{className:e.className},m.default.createElement("div",{className:r?"col-xs-9":"col-xs-12"},e.children),r&&m.default.createElement("div",{className:"col-xs-3 array-item-toolbox"},m.default.createElement("div",{className:"btn-group",style:{display:"flex",justifyContent:"space-around"}},(i||a)&&m.default.createElement(h,{style:y,disabled:t||d||!i,onClick:s(o,o-1),uiSchema:c,registry:u}),(i||a)&&m.default.createElement(p,{style:y,disabled:t||d||!a,onClick:s(o,o+1),uiSchema:c,registry:u}),n&&m.default.createElement(v,{style:y,disabled:t||d,onClick:l(o),uiSchema:c,registry:u}))))}var J=["key"];function G(e){var r=e.canAdd,a=e.className,i=e.disabled,n=e.idSchema,o=e.uiSchema,l=e.items,s=e.onAddClick,d=e.readonly,u=e.registry,c=e.required,f=e.schema,p=e.title,h=t.getUiOptions(o),v=t.getTemplate("ArrayFieldDescriptionTemplate",u,h),y=t.getTemplate("ArrayFieldItemTemplate",u,h),g=t.getTemplate("ArrayFieldTitleTemplate",u,h),E=u.templates.ButtonTemplates.AddButton;return m.default.createElement("fieldset",{className:a,id:n.$id},m.default.createElement(g,{idSchema:n,title:h.title||p,required:c,schema:f,uiSchema:o,registry:u}),m.default.createElement(v,{idSchema:n,description:h.description||f.description,schema:f,uiSchema:o,registry:u}),m.default.createElement("div",{className:"row array-item-list"},l&&l.map((function(e){var t=e.key,r=D(e,J);return m.default.createElement(y,b({key:t},r))}))),r&&m.default.createElement(E,{className:"array-item-add",onClick:s,disabled:i||d,uiSchema:o,registry:u}))}function Q(e){var r=e.idSchema,a=e.title,i=e.schema,n=e.uiSchema,o=e.required,l=e.registry,s=t.getUiOptions(n),d=s.label;if(!a||void 0!==d&&!d)return null;var u=t.getTemplate("TitleFieldTemplate",l,s);return m.default.createElement(u,{id:t.titleId(r),title:a,required:o,schema:i,uiSchema:n,registry:l})}var X=["id","value","readonly","disabled","autofocus","onBlur","onFocus","onChange","options","schema","uiSchema","formContext","registry","rawErrors","type"];function Z(r){var a=r.id,i=r.value,n=r.readonly,o=r.disabled,l=r.autofocus,s=r.onBlur,d=r.onFocus,u=r.onChange,c=r.options,f=r.schema,p=r.type,h=D(r,X);if(!a)throw console.log("No id for",r),new Error("no id for props "+JSON.stringify(r));var v,y=b({},h,t.getInputProps(f,p,c));v="number"===y.type||"integer"===y.type?i||0===i?i:"":null==i?"":i;var g=e.useCallback((function(e){var t=e.target.value;return u(""===t?c.emptyValue:t)}),[u,c]),E=e.useCallback((function(e){return s(a,e.target.value)}),[s,a]),S=e.useCallback((function(e){return d(a,e.target.value)}),[d,a]);return m.default.createElement(m.default.Fragment,null,m.default.createElement("input",b({id:a,name:a,className:"form-control",readOnly:n,disabled:o,autoFocus:l,value:v},y,{list:f.examples?t.examplesId(a):void 0,onChange:g,onBlur:E,onFocus:S,"aria-describedby":t.ariaDescribedByIds(a,!!f.examples)})),Array.isArray(f.examples)&&m.default.createElement("datalist",{key:"datalist_"+a,id:t.examplesId(a)},[].concat(new Set(f.examples.concat(f.default?[f.default]:[]))).map((function(e){return m.default.createElement("option",{key:e,value:e})}))))}function ee(e){var r=t.getSubmitButtonOptions(e.uiSchema),a=r.submitText,i=r.props,n=void 0===i?{}:i;return r.norender?null:m.default.createElement("div",null,m.default.createElement("button",b({type:"submit"},n,{className:"btn btn-info "+n.className}),a))}var te=["iconType","icon","className","uiSchema","registry"];function re(e){var t=e.iconType,r=void 0===t?"default":t,a=e.icon,i=e.className,n=D(e,te);return m.default.createElement("button",b({type:"button",className:"btn btn-"+r+" "+i},n),m.default.createElement("i",{className:"glyphicon glyphicon-"+a}))}function ae(e){return m.default.createElement(re,b({title:"Move down",className:"array-item-move-down"},e,{icon:"arrow-down"}))}function ie(e){return m.default.createElement(re,b({title:"Move up",className:"array-item-move-up"},e,{icon:"arrow-up"}))}function ne(e){return m.default.createElement(re,b({title:"Remove",className:"array-item-remove"},e,{iconType:"danger",icon:"remove"}))}function oe(e){return m.default.createElement("div",{className:"row"},m.default.createElement("p",{className:"col-xs-3 col-xs-offset-9 text-right "+e.className},m.default.createElement(re,{iconType:"info",icon:"plus",className:"btn-add col-xs-12",title:"Add",onClick:e.onClick,disabled:e.disabled,registry:e.registry})))}function le(e){var t=e.description;return t?m.default.createElement("string"==typeof t?"p":"div",{id:e.id,className:"field-description"},t):null}function se(e){var t=e.errors;return m.default.createElement("div",{className:"panel panel-danger errors"},m.default.createElement("div",{className:"panel-heading"},m.default.createElement("h3",{className:"panel-title"},"Errors")),m.default.createElement("ul",{className:"list-group"},t.map((function(e,t){return m.default.createElement("li",{key:t,className:"list-group-item text-danger"},e.stack)}))))}function de(e){var t=e.label;return t?m.default.createElement("label",{className:"control-label",htmlFor:e.id},t,e.required&&m.default.createElement("span",{className:"required"},"*")):null}function ue(e){var r=e.id,a=e.label,i=e.children,n=e.errors,o=e.help,l=e.description,s=e.hidden,d=e.required,u=e.displayLabel,c=e.registry,f=t.getUiOptions(e.uiSchema),p=t.getTemplate("WrapIfAdditionalTemplate",c,f);return s?m.default.createElement("div",{className:"hidden"},i):m.default.createElement(p,b({},e),u&&m.default.createElement(de,{label:a,required:d,id:r}),u&&l?l:null,i,n,o)}function ce(e){var r=e.errors,a=void 0===r?[]:r;if(0===a.length)return null;var i=t.errorId(e.idSchema);return m.default.createElement("div",null,m.default.createElement("ul",{id:i,className:"error-detail bs-callout bs-callout-info"},a.filter((function(e){return!!e})).map((function(e,t){return m.default.createElement("li",{className:"text-danger",key:t},e)}))))}function me(e){var r=e.help;if(!r)return null;var a=t.helpId(e.idSchema);return m.default.createElement("string"==typeof r?"p":"div",{id:a,className:"help-block"},r)}function fe(e){var r=e.description,a=e.disabled,i=e.formData,n=e.idSchema,o=e.onAddClick,l=e.properties,s=e.readonly,d=e.registry,u=e.required,c=e.schema,f=e.title,p=e.uiSchema,h=t.getUiOptions(p),v=t.getTemplate("TitleFieldTemplate",d,h),y=t.getTemplate("DescriptionFieldTemplate",d,h),g=d.templates.ButtonTemplates.AddButton;return m.default.createElement("fieldset",{id:n.$id},(h.title||f)&&m.default.createElement(v,{id:t.titleId(n),title:h.title||f,required:u,schema:c,uiSchema:p,registry:d}),(h.description||r)&&m.default.createElement(y,{id:t.descriptionId(n),description:h.description||r,schema:c,uiSchema:p,registry:d}),l.map((function(e){return e.content})),t.canExpand(c,p,i)&&m.default.createElement(g,{className:"object-property-expand",onClick:o(c),disabled:a||s,uiSchema:p,registry:d}))}function pe(e){return m.default.createElement("legend",{id:e.id},e.title,e.required&&m.default.createElement("span",{className:"required"},"*"))}function he(e){var t=e.schema,r=e.idSchema,a=e.reason;return m.default.createElement("div",{className:"unsupported-field"},m.default.createElement("p",null,"Unsupported field schema",r&&r.$id&&m.default.createElement("span",null," for"," field ",m.default.createElement("code",null,r.$id)),a&&m.default.createElement("em",null,": ",a),"."),t&&m.default.createElement("pre",null,JSON.stringify(t,null,2)))}function ve(e){var r=e.id,a=e.disabled,i=e.label,n=e.onKeyChange,o=e.onDropPropertyClick,l=e.readonly,s=e.children,d=e.uiSchema,u=e.registry,c=u.templates.ButtonTemplates.RemoveButton;return m.default.createElement("div",{className:e.classNames,style:e.style},t.ADDITIONAL_PROPERTY_FLAG in e.schema?m.default.createElement("div",{className:"row"},m.default.createElement("div",{className:"col-xs-5 form-additional"},m.default.createElement("div",{className:"form-group"},m.default.createElement(de,{label:i+" Key",required:e.required,id:r+"-key"}),m.default.createElement("input",{className:"form-control",type:"text",id:r+"-key",onBlur:function(e){return n(e.target.value)},defaultValue:i}))),m.default.createElement("div",{className:"form-additional form-group col-xs-5"},s),m.default.createElement("div",{className:"col-xs-2"},m.default.createElement(c,{className:"array-item-remove btn-block",style:{border:"0"},disabled:a||l,onClick:o(i),uiSchema:d,registry:u}))):s)}function ye(e,r){for(var a=[],i=e;i<=r;i++)a.push({value:i,label:t.pad(i,2)});return a}function ge(e){var r=e.type,a=e.range,i=e.value,n=e.select,o=e.rootId,l=e.disabled,s=e.readonly,d=e.autofocus,u=e.registry,c=e.onBlur,f=e.onFocus;return m.default.createElement(u.widgets.SelectWidget,{schema:{type:"integer"},id:o+"_"+r,className:"form-control",options:{enumOptions:ye(a[0],a[1])},placeholder:r,value:i,disabled:l,readonly:s,autofocus:d,onChange:function(e){return n(r,e)},onBlur:c,onFocus:f,registry:u,label:"","aria-describedby":t.ariaDescribedByIds(o)})}function Ee(r){var a=r.time,i=void 0!==a&&a,n=r.disabled,o=void 0!==n&&n,l=r.readonly,s=void 0!==l&&l,d=r.autofocus,u=void 0!==d&&d,c=r.options,f=r.id,p=r.registry,h=r.onBlur,v=r.onFocus,y=r.onChange,g=r.value,E=e.useReducer((function(e,t){return b({},e,t)}),t.parseDateString(g,i)),S=E[0],C=E[1];e.useEffect((function(){g&&g!==t.toDateString(S,i)&&C(t.parseDateString(g,i))}),[g,S,i]),e.useEffect((function(){(function(e){return Object.values(e).every((function(e){return-1!==e}))})(S)&&y(t.toDateString(S,i))}),[S,i,y]);var F=e.useCallback((function(e,t){var r;C(((r={})[e]=t,r))}),[]),D=e.useCallback((function(e){if(e.preventDefault(),!o&&!s){var r=t.parseDateString((new Date).toJSON(),i);C(r)}}),[o,s,i]),k=e.useCallback((function(e){e.preventDefault(),o||s||(C(t.parseDateString("",i)),y(void 0))}),[o,s,i,y]);return m.default.createElement("ul",{className:"list-inline"},function(e,t,r){void 0===r&&(r=[1900,(new Date).getFullYear()+2]);var a=[{type:"year",range:r,value:e.year},{type:"month",range:[1,12],value:e.month},{type:"day",range:[1,31],value:e.day}];return t&&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}(S,i,c.yearsRange).map((function(e,t){return m.default.createElement("li",{key:t},m.default.createElement(ge,b({rootId:f,select:F},e,{disabled:o,readonly:s,registry:p,onBlur:h,onFocus:v,autofocus:u&&0===t})))})),("undefined"===c.hideNowButton||!c.hideNowButton)&&m.default.createElement("li",null,m.default.createElement("a",{href:"#",className:"btn btn-info btn-now",onClick:D},"Now")),("undefined"===c.hideClearButton||!c.hideClearButton)&&m.default.createElement("li",null,m.default.createElement("a",{href:"#",className:"btn btn-warning btn-clear",onClick:k},"Clear")))}var Se=["time"];function be(e){var t=e.time,r=void 0===t||t,a=D(e,Se);return m.default.createElement(a.registry.widgets.AltDateWidget,b({time:r},a))}function Ce(r){var a=r.schema,i=r.uiSchema,n=r.id,o=r.value,l=r.disabled,s=r.readonly,d=r.label,u=r.autofocus,c=void 0!==u&&u,f=r.onBlur,p=r.onFocus,h=r.onChange,v=r.registry,y=t.getTemplate("DescriptionFieldTemplate",v,r.options),g=t.schemaRequiresTrueValue(a),E=e.useCallback((function(e){return h(e.target.checked)}),[h]),S=e.useCallback((function(e){return f(n,e.target.checked)}),[f,n]),b=e.useCallback((function(e){return p(n,e.target.checked)}),[p,n]);return m.default.createElement("div",{className:"checkbox "+(l||s?"disabled":"")},a.description&&m.default.createElement(y,{id:t.descriptionId(n),description:a.description,schema:a,uiSchema:i,registry:v}),m.default.createElement("label",null,m.default.createElement("input",{type:"checkbox",id:n,name:n,checked:void 0!==o&&o,required:g,disabled:l||s,autoFocus:c,onChange:E,onBlur:S,onFocus:b,"aria-describedby":t.ariaDescribedByIds(n)}),m.default.createElement("span",null,d)))}function Fe(e){var r=e.id,a=e.disabled,i=e.options,n=i.inline,o=void 0!==n&&n,l=i.enumOptions,s=i.enumDisabled,d=e.value,u=e.autofocus,c=void 0!==u&&u,f=e.readonly,p=e.onChange,h=Array.isArray(d)?d:[d];return m.default.createElement("div",{className:"checkboxes",id:r},Array.isArray(l)&&l.map((function(e,i){var n=h.includes(e.value),d=Array.isArray(s)&&-1!=s.indexOf(e.value),u=a||d||f?"disabled":"",v=m.default.createElement("span",null,m.default.createElement("input",{type:"checkbox",id:t.optionId(r,e),name:r,checked:n,disabled:a||d||f,autoFocus:c&&0===i,onChange:function(r){p(r.target.checked?t.enumOptionsSelectValue(e.value,h,l):t.enumOptionsDeselectValue(e.value,h))},"aria-describedby":t.ariaDescribedByIds(r)}),m.default.createElement("span",null,e.label));return o?m.default.createElement("label",{key:e.value,className:"checkbox-inline "+u},v):m.default.createElement("div",{key:e.value,className:"checkbox "+u},m.default.createElement("label",null,v))})))}function De(e){var r=e.disabled,a=e.readonly,i=t.getTemplate("BaseInputTemplate",e.registry,e.options);return m.default.createElement(i,b({type:"color"},e,{disabled:r||a}))}function ke(r){var a=r.onChange,i=t.getTemplate("BaseInputTemplate",r.registry,r.options),n=e.useCallback((function(e){return a(e||void 0)}),[a]);return m.default.createElement(i,b({type:"date"},r,{onChange:n}))}function Oe(e){var r=e.onChange,a=e.value,i=t.getTemplate("BaseInputTemplate",e.registry,e.options);return m.default.createElement(i,b({type:"datetime-local"},e,{value:t.utcToLocal(a),onChange:function(e){return r(t.localToUTC(e))}}))}function Te(e){var r=t.getTemplate("BaseInputTemplate",e.registry,e.options);return m.default.createElement(r,b({type:"email"},e))}function xe(e,t){return null===e?null:e.replace(";base64",";name="+encodeURIComponent(t)+";base64")}function Ae(e){var t=e.name,r=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:xe(e.target.result,t),name:t,size:r,type:a}):i({dataURL:null,name:t,size:r,type:a})},o.readAsDataURL(e)}))}function Ne(e){var t=e.filesInfo;return 0===t.length?null:m.default.createElement("ul",{className:"file-info"},t.map((function(e,t){var r=e.size,a=e.type;return m.default.createElement("li",{key:t},m.default.createElement("strong",null,e.name)," (",a,", ",r," bytes)")})))}function we(e){return e.filter((function(e){return void 0!==e})).map((function(e){var r=t.dataURItoBlob(e),a=r.blob;return{name:r.name,size:a.size,type:a.type}}))}function Ie(r){var a=r.multiple,i=r.id,n=r.readonly,o=r.disabled,l=r.onChange,s=r.value,d=r.autofocus,u=void 0!==d&&d,c=r.options,f=e.useMemo((function(){return Array.isArray(s)?we(s):we([s])}),[s]),p=e.useState(f),h=p[0],v=p[1],y=e.useCallback((function(e){var t;e.target.files&&(t=e.target.files,Promise.all(Array.from(t).map(Ae))).then((function(e){v(e);var t=e.map((function(e){return e.dataURL}));l(a?t:t[0])}))}),[a,l]);return m.default.createElement("div",null,m.default.createElement("p",null,m.default.createElement("input",{id:i,name:i,type:"file",disabled:n||o,onChange:y,defaultValue:"",autoFocus:u,multiple:a,accept:c.accept?String(c.accept):void 0,"aria-describedby":t.ariaDescribedByIds(i)})),m.default.createElement(Ne,{filesInfo:h}))}function Be(e){var t=e.id,r=e.value;return m.default.createElement("input",{type:"hidden",id:t,name:t,value:void 0===r?"":r})}function Ue(e){var r=t.getTemplate("BaseInputTemplate",e.registry,e.options);return m.default.createElement(r,b({type:"password"},e))}function Pe(r){var a=r.options,i=r.value,n=r.required,o=r.disabled,l=r.readonly,s=r.autofocus,d=void 0!==s&&s,u=r.onBlur,c=r.onFocus,f=r.onChange,p=r.id,h=Math.random().toString(),v=a.enumOptions,y=a.enumDisabled,g=a.inline,E=e.useCallback((function(e){return u(p,e.target.value)}),[u,p]),S=e.useCallback((function(e){return c(p,e.target.value)}),[c,p]);return m.default.createElement("div",{className:"field-radio-group",id:p},Array.isArray(v)&&v.map((function(e,r){var a=e.value===i,s=Array.isArray(y)&&-1!=y.indexOf(e.value),u=o||s||l?"disabled":"",c=m.default.createElement("span",null,m.default.createElement("input",{type:"radio",id:t.optionId(p,e),checked:a,name:h,required:n,value:e.value,disabled:o||s||l,autoFocus:d&&0===r,onChange:function(){return f(e.value)},onBlur:E,onFocus:S,"aria-describedby":t.ariaDescribedByIds(p)}),m.default.createElement("span",null,e.label));return g?m.default.createElement("label",{key:e.value,className:"radio-inline "+u},c):m.default.createElement("div",{key:e.value,className:"radio "+u},m.default.createElement("label",null,c))})))}function qe(e){var t=e.value;return m.default.createElement("div",{className:"field-range-wrapper"},m.default.createElement(e.registry.templates.BaseInputTemplate,b({type:"range"},e)),m.default.createElement("span",{className:"range-view"},t))}function Re(e,t){return t?Array.from(e.target.options).slice().filter((function(e){return e.selected})).map((function(e){return e.value})):e.target.value}function _e(r){var a=r.schema,i=r.id,n=r.options,o=r.value,l=r.required,s=r.disabled,d=r.readonly,u=r.multiple,c=void 0!==u&&u,f=r.autofocus,p=void 0!==f&&f,h=r.onChange,v=r.onBlur,y=r.onFocus,g=r.placeholder,E=n.enumOptions,S=n.enumDisabled,b=c?[]:"",C=e.useCallback((function(e){var r=Re(e,c);return y(i,t.processSelectValue(a,r,n))}),[y,i,a,c,n]),F=e.useCallback((function(e){var r=Re(e,c);return v(i,t.processSelectValue(a,r,n))}),[v,i,a,c,n]),D=e.useCallback((function(e){var r=Re(e,c);return h(t.processSelectValue(a,r,n))}),[h,a,c,n]);return m.default.createElement("select",{id:i,name:i,multiple:c,className:"form-control",value:void 0===o?b:o,required:l,disabled:s||d,autoFocus:p,onBlur:F,onFocus:C,onChange:D,"aria-describedby":t.ariaDescribedByIds(i)},!c&&void 0===a.default&&m.default.createElement("option",{value:""},g),Array.isArray(E)&&E.map((function(e,t){var r=e.value,a=e.label,i=S&&-1!=S.indexOf(r);return m.default.createElement("option",{key:t,value:r,disabled:i},a)})))}function je(r){var a=r.id,i=r.options,n=void 0===i?{}:i,o=r.placeholder,l=r.value,s=r.required,d=r.disabled,u=r.readonly,c=r.autofocus,f=void 0!==c&&c,p=r.onChange,h=r.onBlur,v=r.onFocus,y=e.useCallback((function(e){var t=e.target.value;return p(""===t?n.emptyValue:t)}),[p,n.emptyValue]),g=e.useCallback((function(e){return h(a,e.target.value)}),[h,a]),E=e.useCallback((function(e){return v(a,e.target.value)}),[a,v]);return m.default.createElement("textarea",{id:a,name:a,className:"form-control",value:l||"",placeholder:o,required:s,disabled:d,readOnly:u,autoFocus:f,rows:n.rows,onBlur:g,onFocus:E,onChange:y,"aria-describedby":t.ariaDescribedByIds(a)})}function Ve(e){var r=t.getTemplate("BaseInputTemplate",e.registry,e.options);return m.default.createElement(r,b({},e))}function Ke(e){var r=t.getTemplate("BaseInputTemplate",e.registry,e.options);return m.default.createElement(r,b({type:"url"},e))}function Me(e){var r=t.getTemplate("BaseInputTemplate",e.registry,e.options);return m.default.createElement(r,b({type:"number"},e))}function We(){return{fields:{AnyOfField:P,ArrayField:w,BooleanField:B,NumberField:_,ObjectField:j,OneOfField:P,SchemaField:W,StringField:Y,NullField:$},templates:{ArrayFieldDescriptionTemplate:z,ArrayFieldItemTemplate:H,ArrayFieldTemplate:G,ArrayFieldTitleTemplate:Q,ButtonTemplates:{SubmitButton:ee,AddButton:oe,MoveDownButton:ae,MoveUpButton:ie,RemoveButton:ne},BaseInputTemplate:Z,DescriptionFieldTemplate:le,ErrorListTemplate:se,FieldTemplate:ue,FieldErrorTemplate:ce,FieldHelpTemplate:me,ObjectFieldTemplate:fe,TitleFieldTemplate:pe,UnsupportedFieldTemplate:he,WrapIfAdditionalTemplate:ve},widgets:{PasswordWidget:Ue,RadioWidget:Pe,UpDownWidget:Me,RangeWidget:qe,SelectWidget:_e,TextWidget:Ve,DateWidget:ke,DateTimeWidget:Oe,AltDateWidget:Ee,AltDateTimeWidget:be,EmailWidget:Te,URLWidget:Ke,TextareaWidget:je,HiddenWidget:Be,ColorWidget:De,FileWidget:Ie,CheckboxWidget:Ce,CheckboxesWidget:Fe},rootSchema:{},formContext:{}}}je.defaultProps={autofocus:!1,options:{}};var Le=function(e){function r(r){var a;if((a=e.call(this,r)||this).formElement=void 0,a.getUsedFormData=function(e,t){if(0===t.length&&"object"!=typeof e)return e;var r=h.default(e,t);return Array.isArray(e)?Object.keys(r).map((function(e){return r[e]})):r},a.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 l=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,l)}else o===t.NAME_KEY&&""!==a[o]&&n.forEach((function(e){var t=f.default(r,e);("object"!=typeof t||p.default(t))&&i.push(e)}))})),i}(e)},a.onChange=function(e,r,i){var n=a.props,o=n.extraErrors,l=n.omitExtraData,s=n.liveOmit,d=n.noValidate,u=n.liveValidate,c=n.onChange,m=a.state,f=m.schemaUtils,p=m.schema;(t.isObject(e)||Array.isArray(e))&&(e=a.getStateFromProps(a.props,e).formData);var h=!d&&u,v={formData:e,schema:p},y=e;if(!0===l&&!0===s){var g=f.retrieveSchema(p,e),E=f.toPathSchema(g,"",e),S=a.getFieldNames(E,e);y=a.getUsedFormData(e,S),v={formData:y}}if(h){var C=a.validate(y),F=C.errors,D=C.errorSchema,k=F,O=D;if(o){var T=f.mergeValidationData(C,o);D=T.errorSchema,F=T.errors}v={formData:y,errors:F,errorSchema:D,schemaValidationErrors:k,schemaValidationErrorSchema:O}}else if(!d&&r){var x=o?t.mergeObjects(r,o,"preventDuplicates"):r;v={formData:y,errorSchema:x,errors:f.getValidator().toErrorList(x)}}a.setState(v,(function(){return c&&c(b({},a.state,v),i)}))},a.onBlur=function(e,t){var r=a.props.onBlur;r&&r(e,t)},a.onFocus=function(e,t){var r=a.props.onFocus;r&&r(e,t)},a.onSubmit=function(e){if(e.preventDefault(),e.target===e.currentTarget){e.persist();var t=a.props,r=t.extraErrors,i=t.noValidate,n=t.onSubmit,o=a.state.formData,l=a.state,s=l.schemaUtils;if(!0===t.omitExtraData){var d=s.retrieveSchema(l.schema,o),u=s.toPathSchema(d,"",o),c=a.getFieldNames(u,o);o=a.getUsedFormData(o,c)}if(i||a.validateForm()){var m=r||{},f=r?s.getValidator().toErrorList(r):[];a.setState({formData:o,errors:f,errorSchema:m,schemaValidationErrors:[],schemaValidationErrorSchema:{}},(function(){n&&n(b({},a.state,{formData:o,status:"submitted"}),e)}))}}},!r.validator)throw new Error("A validator is required for Form functionality to work");return a.state=a.getStateFromProps(r,r.formData),a.props.onChange&&!t.deepEquals(a.state.formData,a.props.formData)&&a.props.onChange(a.state),a.formElement=m.default.createRef(),a}C(r,e);var a=r.prototype;return a.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)},a.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,l=o&&!e.noValidate&&("liveValidate"in e?e.liveValidate:this.props.liveValidate),s=i,d=a.schemaUtils;d&&!d.doesSchemaUtilsDiffer(e.validator,s)||(d=t.createSchemaUtils(e.validator,s));var u,c,m=d.getDefaultFormState(i,r),f=d.retrieveSchema(i,m),p=a.schemaValidationErrors,h=a.schemaValidationErrorSchema;if(l){var v=this.validate(m,i,d);p=u=v.errors,h=c=v.errorSchema}else{var y=e.noValidate?{errors:[],errorSchema:{}}:e.liveValidate?{errors:a.errors||[],errorSchema:a.errorSchema||{}}:{errors:a.schemaValidationErrors||[],errorSchema:a.schemaValidationErrorSchema||{}};u=y.errors,c=y.errorSchema}if(e.extraErrors){var g=d.mergeValidationData({errorSchema:c,errors:u},e.extraErrors);c=g.errorSchema,u=g.errors}var E=d.toIdSchema(f,n["ui:rootFieldId"],m,e.idPrefix,e.idSeparator);return{schemaUtils:d,schema:i,uiSchema:n,idSchema:E,formData:m,edit:o,errors:u,errorSchema:c,schemaValidationErrors:p,schemaValidationErrorSchema:h}},a.shouldComponentUpdate=function(e,r){return t.shouldRender(this,e,r)},a.validate=function(e,t,r){void 0===t&&(t=this.props.schema);var a=r||this.state.schemaUtils,i=this.props,n=i.customValidate,o=i.transformErrors,l=i.uiSchema,s=a.retrieveSchema(t,e);return a.getValidator().validateFormData(e,s,n,o,l)},a.renderErrors=function(e){var r=this.state,a=r.errors,i=r.errorSchema,n=r.schema,o=r.uiSchema,l=this.props.formContext,s=t.getUiOptions(o),d=t.getTemplate("ErrorListTemplate",e,s);return a&&a.length?m.default.createElement(d,{errors:a,errorSchema:i||{},schema:n,uiSchema:o,formContext:l}):null},a.getRegistry=function(){var e,t=this.state.schemaUtils,r=We(),a=r.templates,i=r.widgets,n=r.formContext;return{fields:b({},r.fields,this.props.fields),templates:b({},a,this.props.templates,{ButtonTemplates:b({},a.ButtonTemplates,null===(e=this.props.templates)||void 0===e?void 0:e.ButtonTemplates)}),widgets:b({},i,this.props.widgets),rootSchema:this.props.schema,formContext:this.props.formContext||n,schemaUtils:t}},a.submit=function(){this.formElement.current&&(this.formElement.current.dispatchEvent(new CustomEvent("submit",{cancelable:!0})),this.formElement.current.requestSubmit())},a.validateForm=function(){var e=this.props,t=e.extraErrors,r=e.onError,a=this.state.schemaUtils,i=this.validate(this.state.formData),n=i.errors,o=i.errorSchema,l=n,s=o;if(n.length>0){if(t){var d=a.mergeValidationData(i,t);o=d.errorSchema,n=d.errors}return this.setState({errors:n,errorSchema:o,schemaValidationErrors:l,schemaValidationErrorSchema:s},(function(){r?r(n):console.error("Form validation failed",n)})),!1}return!0},a.render=function(){var e=this.props,t=e.children,r=e.id,a=e.idPrefix,i=e.idSeparator,n=e.className,o=void 0===n?"":n,l=e.tagName,s=e.name,d=e.method,u=e.target,c=e.action,f=e.autoComplete,p=e.enctype,h=e.acceptcharset,v=e.noHtml5Validate,y=void 0!==v&&v,g=e.disabled,E=void 0!==g&&g,S=e.readonly,b=void 0!==S&&S,C=e.formContext,F=e.showErrorList,D=void 0===F?"top":F,k=e._internalFormWrapper,O=this.state,T=O.schema,x=O.uiSchema,A=O.formData,N=O.errorSchema,w=O.idSchema,I=this.getRegistry(),B=I.fields.SchemaField,U=I.templates.ButtonTemplates.SubmitButton;return m.default.createElement(k||l||"form",{className:o||"rjsf",id:r,name:s,method:d,target:u,action:c,autoComplete:f,encType:p,acceptCharset:h,noValidate:y,onSubmit:this.onSubmit,as:k?l:void 0,ref:this.formElement},"top"===D&&this.renderErrors(I),m.default.createElement(B,{name:"",schema:T,uiSchema:x,errorSchema:N,idSchema:w,idPrefix:a,idSeparator:i,formContext:C,formData:A,onChange:this.onChange,onBlur:this.onBlur,onFocus:this.onFocus,registry:I,disabled:E,readonly:b}),t||m.default.createElement(U,{uiSchema:x,registry:I}),"bottom"===D&&this.renderErrors(I))},r}(e.Component),Ye=["fields","widgets","templates"];exports.default=Le,exports.getDefaultRegistry=We,exports.withTheme=function(t){return e.forwardRef((function(e,r){var a,i,n=e.fields,o=e.widgets,l=e.templates,s=D(e,Ye);return n=b({},null==t?void 0:t.fields,n),o=b({},null==t?void 0:t.widgets,o),l=b({},null==t?void 0:t.templates,l,{ButtonTemplates:b({},null==t||null===(a=t.templates)||void 0===a?void 0:a.ButtonTemplates,null===(i=l)||void 0===i?void 0:i.ButtonTemplates)}),m.default.createElement(Le,b({},t,s,{fields:n,widgets:o,templates:l,ref:r}))}))}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@rjsf/utils"),r=require("lodash/get"),a=require("lodash/isEmpty"),i=require("lodash/pick"),n=require("lodash/isObject"),o=require("lodash/set"),l=require("nanoid"),s=require("lodash/omit"),d=require("lodash/has"),u=require("lodash/unset");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var m=c(e),f=c(r),p=c(a),h=c(i),v=c(n),y=c(o),g=c(s),E=c(d),S=c(u);function b(){return b=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},b.apply(this,arguments)}function C(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,F(e,t)}function F(e,t){return F=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},F(e,t)}function D(e,t){if(null==e)return{};var r,a,i={},n=Object.keys(e);for(a=0;a<n.length;a++)t.indexOf(r=n[a])>=0||(i[r]=e[r]);return i}var O=["widget"],k=["widget"],T=["widget"];function x(){return l.nanoid()}function A(e){return Array.isArray(e)?e.map((function(e){return{key:x(),item:e}})):[]}function w(e){return Array.isArray(e)?e.map((function(e){return e.item})):[]}var N=function(e){function r(r){var a;(a=e.call(this,r)||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(t){a._handleAddClick(t,e)}},a.onDropIndexClick=function(e){return function(t){t&&t.preventDefault();var r,i=a.props,n=i.onChange,o=i.errorSchema,l=a.state.keyedFormData;if(o)for(var s in r={},o){var d=parseInt(s);d<e?y.default(r,[d],o[s]):d>e&&y.default(r,[d-1],o[s])}var u=l.filter((function(t,r){return r!==e}));a.setState({keyedFormData:u,updatedKeyedFormData:!0},(function(){return n(w(u),r)}))}},a.onReorderClick=function(e,t){return function(r){r&&(r.preventDefault(),r.currentTarget.blur());var i,n=a.props,o=n.onChange,l=n.errorSchema;if(a.props.errorSchema)for(var s in i={},l){var d=parseInt(s);d==e?y.default(i,[t],l[e]):d==t?y.default(i,[e],l[t]):y.default(i,[s],l[d])}var u,c=a.state.keyedFormData,m=((u=c.slice()).splice(e,1),u.splice(t,0,c[e]),u);a.setState({keyedFormData:m},(function(){return o(w(m),i)}))}},a.onChangeForIndex=function(e){return function(t,r,i){var n,o=a.props,l=o.formData,s=o.errorSchema;(0,o.onChange)((Array.isArray(l)?l:[]).map((function(r,a){return e===a?void 0===t?null:t:r})),s&&s&&b({},s,((n={})[e]=r,n)),i)}},a.onSelectChange=function(e){var t=a.props,r=t.idSchema;(0,t.onChange)(e,void 0,r&&r.$id)};var i=r.formData,n=A(void 0===i?[]:i);return a.state={keyedFormData:n,updatedKeyedFormData:!1},a}C(r,e),r.getDerivedStateFromProps=function(e,t){if(t.updatedKeyedFormData)return{updatedKeyedFormData:!1};var r=Array.isArray(e.formData)?e.formData:[],a=t.keyedFormData||[];return{keyedFormData:r.length===a.length?a.map((function(e,t){return{key:e.key,item:r[t]}})):A(r)}};var a,i,n=r.prototype;return n.isItemRequired=function(e){return Array.isArray(e.type)?!e.type.includes("null"):"null"!==e.type},n.canAddItem=function(e){var r=this.props,a=r.schema,i=t.getUiOptions(r.uiSchema).addable;return!1!==i&&(i=void 0===a.maxItems||e.length<a.maxItems),i},n._handleAddClick=function(e,t){e&&e.preventDefault();var r=this.props.onChange,a=this.state.keyedFormData,i={key:x(),item:this._getNewFormDataRow()},n=[].concat(a);void 0!==t?n.splice(t,0,i):n.push(i),this.setState({keyedFormData:n,updatedKeyedFormData:!0},(function(){return r(w(n))}))},n.render=function(){var e=this.props,r=e.schema,a=e.uiSchema,i=e.idSchema,n=e.registry,o=n.schemaUtils;if(!(t.ITEMS_KEY in r)){var l=t.getUiOptions(a),s=t.getTemplate("UnsupportedFieldTemplate",n,l);return m.default.createElement(s,{schema:r,idSchema:i,reason:"Missing items definition",registry:n})}return o.isMultiSelect(r)?this.renderMultiSelect():t.isCustomWidget(a)?this.renderCustomWidget():t.isFixedItems(r)?this.renderFixedArray():o.isFilesArray(r,a)?this.renderFiles():this.renderNormalArray()},n.renderNormalArray=function(){var e=this,r=this.props,a=r.schema,i=r.uiSchema,n=void 0===i?{}:i,o=r.errorSchema,l=r.idSchema,s=r.name,d=r.disabled,u=void 0!==d&&d,c=r.readonly,f=void 0!==c&&c,p=r.autofocus,h=void 0!==p&&p,y=r.required,g=void 0!==y&&y,E=r.registry,S=r.onBlur,C=r.onFocus,F=r.idPrefix,D=r.idSeparator,O=void 0===D?"_":D,k=r.rawErrors,T=this.state.keyedFormData,x=void 0===a.title?s:a.title,A=E.schemaUtils,N=E.formContext,I=t.getUiOptions(n),B=v.default(a.items)?a.items:{},U=A.retrieveSchema(B),q=w(this.state.keyedFormData),P=this.canAddItem(q),R={canAdd:P,items:T.map((function(t,r){var a=t.key,i=t.item,d=A.retrieveSchema(B,i),u=o?o[r]:void 0,c=A.toIdSchema(d,l.$id+O+r,i,F,O);return e.renderArrayFieldItem({key:a,index:r,name:s&&s+"-"+r,canAdd:P,canMoveUp:r>0,canMoveDown:r<q.length-1,itemSchema:d,itemIdSchema:c,itemErrorSchema:u,itemData:i,itemUiSchema:n.items,autofocus:h&&0===r,onBlur:S,onFocus:C,rawErrors:k,totalItems:T.length})})),className:"field field-array field-array-of-"+U.type,disabled:u,idSchema:l,uiSchema:n,onAddClick:this.onAddClick,readonly:f,required:g,schema:a,title:x,formContext:N,formData:q,rawErrors:k,registry:E},_=t.getTemplate("ArrayFieldTemplate",E,I);return m.default.createElement(_,b({},R))},n.renderCustomWidget=function(){var e=this.props,r=e.schema,a=e.idSchema,i=e.uiSchema,n=e.disabled,o=void 0!==n&&n,l=e.readonly,s=void 0!==l&&l,d=e.autofocus,u=void 0!==d&&d,c=e.required,f=void 0!==c&&c,p=e.hideError,h=e.placeholder,v=e.onBlur,y=e.onFocus,g=e.formData,E=void 0===g?[]:g,S=e.registry,b=e.rawErrors,C=S.widgets,F=S.formContext,k=r.title||e.name,T=t.getUiOptions(i),x=T.widget,A=D(T,O),w=t.getWidget(r,x,C);return m.default.createElement(w,{id:a.$id,multiple:!0,onChange:this.onSelectChange,onBlur:v,onFocus:y,options:A,schema:r,uiSchema:i,registry:S,value:E,disabled:o,readonly:s,hideError:p,required:f,label:k,placeholder:h,formContext:F,autofocus:u,rawErrors:b})},n.renderMultiSelect=function(){var e=this.props,r=e.schema,a=e.idSchema,i=e.uiSchema,n=e.formData,o=void 0===n?[]:n,l=e.disabled,s=void 0!==l&&l,d=e.readonly,u=void 0!==d&&d,c=e.autofocus,f=void 0!==c&&c,p=e.required,h=void 0!==p&&p,v=e.placeholder,y=e.onBlur,g=e.onFocus,E=e.registry,S=e.rawErrors,C=e.name,F=E.widgets,O=E.formContext,T=E.schemaUtils.retrieveSchema(r.items,o),x=r.title||C,A=t.optionsList(T),w=t.getUiOptions(i),N=w.widget,I=void 0===N?"select":N,B=D(w,k),U=t.getWidget(r,I,F);return m.default.createElement(U,{id:a.$id,multiple:!0,onChange:this.onSelectChange,onBlur:y,onFocus:g,options:b({},B,{enumOptions:A}),schema:r,uiSchema:i,registry:E,value:o,disabled:s,readonly:u,required:h,label:x,placeholder:v,formContext:O,autofocus:f,rawErrors:S})},n.renderFiles=function(){var e=this.props,r=e.schema,a=e.uiSchema,i=e.idSchema,n=e.disabled,o=void 0!==n&&n,l=e.readonly,s=void 0!==l&&l,d=e.autofocus,u=void 0!==d&&d,c=e.required,f=void 0!==c&&c,p=e.onBlur,h=e.onFocus,v=e.registry,y=e.formData,g=void 0===y?[]:y,E=e.rawErrors,S=r.title||e.name,b=v.widgets,C=v.formContext,F=t.getUiOptions(a),O=F.widget,k=void 0===O?"files":O,x=D(F,T),A=t.getWidget(r,k,b);return m.default.createElement(A,{options:x,id:i.$id,multiple:!0,onChange:this.onSelectChange,onBlur:p,onFocus:h,schema:r,uiSchema:a,title:S,value:g,disabled:o,readonly:s,required:f,registry:v,formContext:C,autofocus:u,rawErrors:E,label:""})},n.renderFixedArray=function(){var e=this,r=this.props,a=r.schema,i=r.uiSchema,n=void 0===i?{}:i,o=r.formData,l=void 0===o?[]:o,s=r.errorSchema,d=r.idPrefix,u=r.idSeparator,c=void 0===u?"_":u,f=r.idSchema,p=r.name,h=r.disabled,y=void 0!==h&&h,g=r.readonly,E=void 0!==g&&g,S=r.autofocus,C=void 0!==S&&S,F=r.required,D=void 0!==F&&F,O=r.registry,k=r.onBlur,T=r.onFocus,x=r.rawErrors,A=this.state.keyedFormData,w=this.props.formData,N=void 0===w?[]:w,I=a.title||p,B=t.getUiOptions(n),U=O.schemaUtils,q=O.formContext,P=(v.default(a.items)?a.items:[]).map((function(e,t){return U.retrieveSchema(e,l[t])})),R=v.default(a.additionalItems)?U.retrieveSchema(a.additionalItems,l):null;(!N||N.length<P.length)&&(N=(N=N||[]).concat(new Array(P.length-N.length)));var _=this.canAddItem(N)&&!!R,j={canAdd:_,className:"field field-array field-array-fixed-items",disabled:y,idSchema:f,formData:l,items:A.map((function(t,r){var i=t.key,o=t.item,l=r>=P.length,u=l&&v.default(a.additionalItems)?U.retrieveSchema(a.additionalItems,o):P[r],m=U.toIdSchema(u,f.$id+c+r,o,d,c),h=l?n.additionalItems||{}:Array.isArray(n.items)?n.items[r]:n.items||{};return e.renderArrayFieldItem({key:i,index:r,name:p&&p+"-"+r,canAdd:_,canRemove:l,canMoveUp:r>=P.length+1,canMoveDown:l&&r<N.length-1,itemSchema:u,itemData:o,itemUiSchema:h,itemIdSchema:m,itemErrorSchema:s?s[r]:void 0,autofocus:C&&0===r,onBlur:k,onFocus:T,rawErrors:x,totalItems:A.length})})),onAddClick:this.onAddClick,readonly:E,required:D,registry:O,schema:a,uiSchema:n,title:I,formContext:q,rawErrors:x},V=t.getTemplate("ArrayFieldTemplate",O,B);return m.default.createElement(V,b({},j))},n.renderArrayFieldItem=function(e){var r=e.key,a=e.index,i=e.name,n=e.canAdd,o=e.canRemove,l=void 0===o||o,s=e.canMoveUp,d=void 0===s||s,u=e.canMoveDown,c=void 0===u||u,f=e.itemSchema,p=e.itemData,h=e.itemUiSchema,v=e.itemIdSchema,y=e.itemErrorSchema,g=e.autofocus,E=e.onBlur,S=e.onFocus,b=e.rawErrors,C=e.totalItems,F=this.props,D=F.disabled,O=F.hideError,k=F.idPrefix,T=F.idSeparator,x=F.readonly,A=F.registry,w=F.formContext,N=A.fields,I=N.ArraySchemaField||N.SchemaField,B=t.getUiOptions(F.uiSchema),U=B.orderable,q=void 0===U||U,P=B.removable,R={moveUp:q&&d,moveDown:q&&c,remove:(void 0===P||P)&&l,toolbar:!1};return R.toolbar=Object.keys(R).some((function(e){return R[e]})),{children:m.default.createElement(I,{name:i,index:a,schema:f,uiSchema:h,formData:p,formContext:w,errorSchema:y,idPrefix:k,idSeparator:T,idSchema:v,required:this.isItemRequired(f),onChange:this.onChangeForIndex(a),onBlur:E,onFocus:S,registry:A,disabled:D,readonly:x,hideError:O,autofocus:g,rawErrors:b}),className:"array-item",disabled:D,canAdd:n,hasToolbar:R.toolbar,hasMoveUp:R.moveUp,hasMoveDown:R.moveDown,hasRemove:R.remove,index:a,totalItems:C,key:r,onAddIndexClick:this.onAddIndexClick,onDropIndexClick:this.onDropIndexClick,onReorderClick:this.onReorderClick,readonly:x,registry:A,schema:f,uiSchema:h}},a=r,(i=[{key:"itemTitle",get:function(){var e=this.props.schema;return f.default(e,[t.ITEMS_KEY,"title"],f.default(e,[t.ITEMS_KEY,"description"],"Item"))}}])&&function(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,"symbol"==typeof(i=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var a=r.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}(a.prototype,i),Object.defineProperty(a,"prototype",{writable:!1}),r}(e.Component),I=["widget"];function B(e){var r,a=e.schema,i=e.name,n=e.uiSchema,o=e.idSchema,l=e.formData,s=e.registry,d=e.required,u=e.disabled,c=e.readonly,f=e.autofocus,p=e.onChange,h=e.onFocus,y=e.onBlur,g=e.rawErrors,E=a.title,S=s.widgets,C=s.formContext,F=t.getUiOptions(n),O=F.widget,k=void 0===O?"checkbox":O,T=D(F,I),x=t.getWidget(a,k,S);if(Array.isArray(a.oneOf))r=t.optionsList({oneOf:a.oneOf.map((function(e){if(v.default(e))return b({},e,{title:e.title||(!0===e.const?"Yes":"No")})})).filter((function(e){return e}))});else{var A,w=a,N=null!=(A=a.enum)?A:[!0,!1];r=!w.enumNames&&2===N.length&&N.every((function(e){return"boolean"==typeof e}))?[{value:N[0],label:N[0]?"Yes":"No"},{value:N[1],label:N[1]?"Yes":"No"}]:t.optionsList({enum:N,enumNames:w.enumNames})}return m.default.createElement(x,{options:b({},T,{enumOptions:r}),schema:a,uiSchema:n,id:o.$id,onChange:p,onFocus:h,onBlur:y,label:void 0===E?i:E,value:l,required:d,disabled:u,readonly:c,registry:s,formContext:C,autofocus:f,rawErrors:g})}var U=["widget","placeholder","autofocus","autocomplete","title"],q=function(e){function r(t){var r;(r=e.call(this,t)||this).onOptionChange=function(e){var t=r.state,a=t.selectedOption,i=t.retrievedOptions,n=r.props,o=n.formData,l=n.onChange,s=n.registry.schemaUtils,d=void 0!==e?parseInt(e,10):-1;if(d!==a){var u=d>=0?i[d]:void 0,c=s.sanitizeDataForNewSchema(u,a>=0?i[a]:void 0,o);c&&u&&(c=s.getDefaultFormState(u,c,"excludeObjectChildren")),l(c,void 0,r.getFieldId()),r.setState({selectedOption:d})}};var a=r.props,i=a.formData,n=a.registry.schemaUtils,o=a.options.map((function(e){return n.retrieveSchema(e,i)}));return r.state={retrievedOptions:o,selectedOption:r.getMatchingOption(0,i,o)},r}C(r,e);var a=r.prototype;return a.componentDidUpdate=function(e,r){var a=this.props,i=a.formData,n=a.options,o=a.idSchema,l=this.state.selectedOption,s=this.state;if(!t.deepEquals(e.options,n)){var d=this.props.registry.schemaUtils;s={selectedOption:l,retrievedOptions:n.map((function(e){return d.retrieveSchema(e,i)}))}}if(!t.deepEquals(i,e.formData)&&o.$id===e.idSchema.$id){var u=s.retrievedOptions,c=this.getMatchingOption(l,i,u);r&&c!==l&&(s={selectedOption:c,retrievedOptions:u})}s!==this.state&&this.setState(s)},a.getMatchingOption=function(e,t,r){var a=this.props.registry.schemaUtils.getClosestMatchingOption(t,r,e);return a>0?a:e||0},a.getFieldId=function(){var e=this.props;return e.idSchema.$id+(e.schema.oneOf?"__oneof_select":"__anyof_select")},a.render=function(){var e,r=this.props,a=r.baseType,i=r.disabled,n=void 0!==i&&i,o=r.errorSchema,l=void 0===o?{}:o,s=r.formContext,d=r.onBlur,u=r.onFocus,c=r.registry,h=r.schema,v=c.widgets,y=c.fields.SchemaField,E=this.state,S=E.selectedOption,C=E.retrievedOptions,F=t.getUiOptions(r.uiSchema),O=F.widget,k=void 0===O?"select":O,T=F.placeholder,x=F.autofocus,A=F.autocomplete,w=F.title,N=void 0===w?h.title:w,I=D(F,U),B=t.getWidget({type:"number"},k,v),q=f.default(l,t.ERRORS_KEY,[]),P=g.default(l,[t.ERRORS_KEY]),R=C[S]||null;R&&(e=R.type?R:Object.assign({},R,{type:a}));var _=N?N+" "+"Option".toLowerCase():"Option",j=C.map((function(e,t){return{label:e.title||_+" "+(t+1),value:t}}));return m.default.createElement("div",{className:"panel panel-default panel-body"},m.default.createElement("div",{className:"form-group"},m.default.createElement(B,{id:this.getFieldId(),schema:{type:"number",default:0},onChange:this.onOptionChange,onBlur:d,onFocus:u,disabled:n||p.default(j),multiple:!1,rawErrors:q,errorSchema:P,value:S,options:b({enumOptions:j},I),registry:c,formContext:s,placeholder:T,autocomplete:A,autofocus:x,label:""})),null!==R&&m.default.createElement(y,b({},this.props,{schema:e})))},r}(e.Component),P=/\.([0-9]*0)*$/,R=/[0.]0*$/;function _(r){var a=r.registry,i=r.onChange,n=r.formData,o=e.useState(r.value),l=o[0],s=o[1],d=a.fields.StringField,u=n,c=e.useCallback((function(e){s(e),"."===(""+e).charAt(0)&&(e="0"+e);var r="string"==typeof e&&e.match(P)?t.asNumber(e.replace(R,"")):t.asNumber(e);i(r)}),[i]);if("string"==typeof l&&"number"==typeof u){var f=new RegExp((""+u).replace(".","\\.")+"\\.?0*$");l.match(f)&&(u=l)}return m.default.createElement(d,b({},r,{formData:u,onChange:c}))}var j=function(e){function r(){for(var r,a=arguments.length,i=new Array(a),n=0;n<a;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,l,s=r.props,d=s.errorSchema;void 0===a&&t&&(a=""),(0,s.onChange)(b({},s.formData,((o={})[e]=a,o)),d&&d&&b({},d,((l={})[e]=i,l)),n)}},r.onDropPropertyClick=function(e){return function(t){t.preventDefault();var a=r.props,i=a.onChange,n=b({},a.formData);S.default(n,e),i(n)}},r.getAvailableKey=function(e,a){for(var i=t.getUiOptions(r.props.uiSchema).duplicateKeySuffixSeparator,n=void 0===i?"-":i,o=0,l=e;E.default(a,l);)l=""+e+n+ ++o;return l},r.onKeyChange=function(e){return function(t,a){var i,n;if(e!==t){var o=r.props,l=o.formData,s=o.onChange,d=o.errorSchema;t=r.getAvailableKey(t,l);var u=b({},l),c=((i={})[e]=t,i),m=Object.keys(u).map((function(e){var t;return(t={})[c[e]||e]=u[e],t})),f=Object.assign.apply(Object,[{}].concat(m));r.setState({wasPropertyKeyModified:!0}),s(f,d&&d&&b({},d,((n={})[t]=a,n)))}}},r.handleAddClick=function(e){return function(){if(e.additionalProperties){var a=r.props,i=a.formData,n=a.onChange,o=a.registry,l=b({},i),s=void 0;if(v.default(e.additionalProperties)){s=e.additionalProperties.type;var d=e.additionalProperties;t.REF_KEY in d&&(s=(d=o.schemaUtils.retrieveSchema({$ref:d[t.REF_KEY]},i)).type),s||!(t.ANY_OF_KEY in d)&&!(t.ONE_OF_KEY in d)||(s="object")}var u=r.getAvailableKey("newKey",l);y.default(l,u,r.getDefaultValue(s)),n(l)}}},r}C(r,e);var a=r.prototype;return a.isRequired=function(e){var t=this.props.schema;return Array.isArray(t.required)&&-1!==t.required.indexOf(e)},a.getDefaultValue=function(e){switch(e){case"string":default:return"New Value";case"array":return[];case"boolean":return!1;case"null":return null;case"number":return 0;case"object":return{}}},a.render=function(){var e,r=this,a=this.props,i=a.uiSchema,n=void 0===i?{}:i,o=a.formData,l=a.errorSchema,s=a.idSchema,d=a.name,u=a.required,c=void 0!==u&&u,p=a.disabled,h=void 0!==p&&p,v=a.readonly,y=void 0!==v&&v,g=a.hideError,S=a.idPrefix,C=a.idSeparator,F=a.onBlur,D=a.onFocus,O=a.registry,k=O.formContext,T=O.fields.SchemaField,x=O.schemaUtils.retrieveSchema(a.schema,o),A=t.getUiOptions(n),w=x.properties,N=void 0===w?{}:w,I=void 0===x.title?d:x.title,B=A.description||x.description;try{var U=Object.keys(N);e=t.orderProperties(U,A.order)}catch(e){return m.default.createElement("div",null,m.default.createElement("p",{className:"config-error",style:{color:"red"}},"Invalid ",d||"root"," object field configuration:",m.default.createElement("em",null,e.message),"."),m.default.createElement("pre",null,JSON.stringify(x)))}var q=t.getTemplate("ObjectFieldTemplate",O,A),P={title:A.title||I,description:B,properties:e.map((function(e){var a=E.default(x,[t.PROPERTIES_KEY,e,t.ADDITIONAL_PROPERTY_FLAG]),i=a?n.additionalProperties:n[e],d="hidden"===t.getUiOptions(i).widget,u=f.default(s,[e],{});return{content:m.default.createElement(T,{key:e,name:e,required:r.isRequired(e),schema:f.default(x,[t.PROPERTIES_KEY,e],{}),uiSchema:i,errorSchema:f.default(l,e),idSchema:u,idPrefix:S,idSeparator:C,formData:f.default(o,e),formContext:k,wasPropertyKeyModified:r.state.wasPropertyKeyModified,onKeyChange:r.onKeyChange(e),onChange:r.onPropertyChange(e,a),onBlur:F,onFocus:D,registry:O,disabled:h,readonly:y,hideError:g,onDropPropertyClick:r.onDropPropertyClick}),name:e,readonly:y,disabled:h,required:c,hidden:d}})),readonly:y,disabled:h,required:c,idSchema:s,uiSchema:n,schema:x,formData:o,formContext:k,registry:O};return m.default.createElement(q,b({},P,{onAddClick:this.handleAddClick}))},r}(e.Component),V=["__errors"],K={array:"ArrayField",boolean:"BooleanField",integer:"NumberField",number:"NumberField",object:"ObjectField",string:"StringField",null:"NullField"};function M(e){var r=e.schema,a=e.idSchema,i=e.uiSchema,n=e.formData,o=e.errorSchema,l=e.idPrefix,s=e.idSeparator,d=e.name,u=e.onChange,c=e.onKeyChange,f=e.onDropPropertyClick,p=e.required,h=e.registry,y=e.wasPropertyKeyModified,E=void 0!==y&&y,S=h.formContext,C=h.schemaUtils,F=t.getUiOptions(i),O=t.getTemplate("FieldTemplate",h,F),k=t.getTemplate("DescriptionFieldTemplate",h,F),T=t.getTemplate("FieldHelpTemplate",h,F),x=t.getTemplate("FieldErrorTemplate",h,F),A=C.retrieveSchema(r,n),w=a[t.ID_KEY],N=t.mergeObjects(C.toIdSchema(A,w,n,l,s),a),I=m.default.useCallback((function(e,t,r){return u(e,t,r||w)}),[w,u]),B=function(e,r,a,i){var n=r.field,o=i.fields;if("function"==typeof n)return n;if("string"==typeof n&&n in o)return o[n];var l=t.getSchemaType(e),s=Array.isArray(l)?l[0]:l||"",d=K[s];return d||!e.anyOf&&!e.oneOf?d in o?o[d]:function(){var n=t.getTemplate("UnsupportedFieldTemplate",i,r);return m.default.createElement(n,{schema:e,idSchema:a,reason:"Unknown field type "+e.type,registry:i})}:function(){return null}}(A,F,N,h),U=Boolean(e.disabled||F.disabled),q=Boolean(e.readonly||F.readonly||e.schema.readOnly||A.readOnly),P=F.hideError,R=void 0===P?e.hideError:Boolean(P),_=Boolean(e.autofocus||F.autofocus);if(0===Object.keys(A).length)return null;var j=C.getDisplayLabel(A,i),M=o||{},W=M.__errors,L=D(M,V),Y=g.default(i,["ui:classNames","classNames","ui:style"]);t.UI_OPTIONS_KEY in Y&&(Y[t.UI_OPTIONS_KEY]=g.default(Y[t.UI_OPTIONS_KEY],["classNames","style"]));var $,z=m.default.createElement(B,b({},e,{onChange:I,idSchema:N,schema:A,uiSchema:Y,disabled:U,readonly:q,hideError:R,autofocus:_,errorSchema:L,formContext:S,rawErrors:W})),H=N[t.ID_KEY];$=E||t.ADDITIONAL_PROPERTY_FLAG in A?d:F.title||e.schema.title||A.title||d;var J=F.description||e.schema.description||A.description||"",G=F.help,Q="hidden"===F.widget,X=["form-group","field","field-"+A.type];!R&&W&&W.length>0&&X.push("field-error has-error has-danger"),null!=i&&i.classNames&&X.push(i.classNames),F.classNames&&X.push(F.classNames);var Z=m.default.createElement(T,{help:G,idSchema:N,schema:A,uiSchema:i,hasErrors:!R&&W&&W.length>0,registry:h}),ee=R?void 0:m.default.createElement(x,{errors:W,errorSchema:o,idSchema:N,schema:A,uiSchema:i,registry:h}),te={description:m.default.createElement(k,{id:t.descriptionId(H),description:J,schema:A,uiSchema:i,registry:h}),rawDescription:J,help:Z,rawHelp:"string"==typeof G?G:void 0,errors:ee,rawErrors:R?void 0:W,id:H,label:$,hidden:Q,onChange:u,onKeyChange:c,onDropPropertyClick:f,required:p,disabled:U,readonly:q,hideError:R,displayLabel:j,classNames:X.join(" ").trim(),style:F.style,formContext:S,formData:n,schema:A,uiSchema:i,registry:h},re=h.fields.AnyOfField,ae=h.fields.OneOfField,ie=(null==i?void 0:i["ui:field"])&&!0===(null==i?void 0:i["ui:fieldReplacesAnyOrOneOf"]);return m.default.createElement(O,b({},te),m.default.createElement(m.default.Fragment,null,z,A.anyOf&&!ie&&!C.isSelect(A)&&m.default.createElement(re,{name:d,disabled:U,readonly:q,hideError:R,errorSchema:o,formData:n,formContext:S,idPrefix:l,idSchema:N,idSeparator:s,onBlur:e.onBlur,onChange:e.onChange,onFocus:e.onFocus,options:A.anyOf.map((function(e){return C.retrieveSchema(v.default(e)?e:{},n)})),baseType:A.type,registry:h,schema:A,uiSchema:i}),A.oneOf&&!ie&&!C.isSelect(A)&&m.default.createElement(ae,{name:d,disabled:U,readonly:q,hideError:R,errorSchema:o,formData:n,formContext:S,idPrefix:l,idSchema:N,idSeparator:s,onBlur:e.onBlur,onChange:e.onChange,onFocus:e.onFocus,options:A.oneOf.map((function(e){return C.retrieveSchema(v.default(e)?e:{},n)})),baseType:A.type,registry:h,schema:A,uiSchema:i})))}var W=function(e){function r(){return e.apply(this,arguments)||this}C(r,e);var a=r.prototype;return a.shouldComponentUpdate=function(e){return!t.deepEquals(this.props,e)},a.render=function(){return m.default.createElement(M,b({},this.props))},r}(m.default.Component),L=["widget","placeholder"];function Y(e){var r=e.schema,a=e.name,i=e.uiSchema,n=e.idSchema,o=e.formData,l=e.required,s=e.disabled,d=void 0!==s&&s,u=e.readonly,c=void 0!==u&&u,f=e.autofocus,p=void 0!==f&&f,h=e.onChange,v=e.onBlur,y=e.onFocus,g=e.registry,E=e.rawErrors,S=r.title,C=r.format,F=g.widgets,O=g.formContext,k=g.schemaUtils.isSelect(r)?t.optionsList(r):void 0,T=k?"select":"text";C&&t.hasWidget(r,C,F)&&(T=C);var x=t.getUiOptions(i),A=x.widget,w=void 0===A?T:A,N=x.placeholder,I=void 0===N?"":N,B=D(x,L),U=t.getWidget(r,w,F);return m.default.createElement(U,{options:b({},B,{enumOptions:k}),schema:r,uiSchema:i,id:n.$id,label:void 0===S?a:S,value:o,onChange:h,onBlur:v,onFocus:y,required:l,disabled:d,readonly:c,formContext:O,autofocus:p,registry:g,placeholder:I,rawErrors:E})}function $(t){var r=t.formData,a=t.onChange;return e.useEffect((function(){void 0===r&&a(null)}),[r,a]),null}function z(e){var r=e.idSchema,a=e.description,i=e.registry,n=e.schema,o=e.uiSchema,l=t.getUiOptions(o),s=l.label;if(!a||void 0!==s&&!s)return null;var d=t.getTemplate("DescriptionFieldTemplate",i,l);return m.default.createElement(d,{id:t.descriptionId(r),description:a,schema:n,uiSchema:o,registry:i})}function H(e){var t=e.disabled,r=e.hasToolbar,a=e.hasMoveDown,i=e.hasMoveUp,n=e.hasRemove,o=e.index,l=e.onDropIndexClick,s=e.onReorderClick,d=e.readonly,u=e.registry,c=e.uiSchema,f=u.templates.ButtonTemplates,p=f.MoveDownButton,h=f.MoveUpButton,v=f.RemoveButton,y={flex:1,paddingLeft:6,paddingRight:6,fontWeight:"bold"};return m.default.createElement("div",{className:e.className},m.default.createElement("div",{className:r?"col-xs-9":"col-xs-12"},e.children),r&&m.default.createElement("div",{className:"col-xs-3 array-item-toolbox"},m.default.createElement("div",{className:"btn-group",style:{display:"flex",justifyContent:"space-around"}},(i||a)&&m.default.createElement(h,{style:y,disabled:t||d||!i,onClick:s(o,o-1),uiSchema:c,registry:u}),(i||a)&&m.default.createElement(p,{style:y,disabled:t||d||!a,onClick:s(o,o+1),uiSchema:c,registry:u}),n&&m.default.createElement(v,{style:y,disabled:t||d,onClick:l(o),uiSchema:c,registry:u}))))}var J=["key"];function G(e){var r=e.canAdd,a=e.className,i=e.disabled,n=e.idSchema,o=e.uiSchema,l=e.items,s=e.onAddClick,d=e.readonly,u=e.registry,c=e.required,f=e.schema,p=e.title,h=t.getUiOptions(o),v=t.getTemplate("ArrayFieldDescriptionTemplate",u,h),y=t.getTemplate("ArrayFieldItemTemplate",u,h),g=t.getTemplate("ArrayFieldTitleTemplate",u,h),E=u.templates.ButtonTemplates.AddButton;return m.default.createElement("fieldset",{className:a,id:n.$id},m.default.createElement(g,{idSchema:n,title:h.title||p,required:c,schema:f,uiSchema:o,registry:u}),m.default.createElement(v,{idSchema:n,description:h.description||f.description,schema:f,uiSchema:o,registry:u}),m.default.createElement("div",{className:"row array-item-list"},l&&l.map((function(e){var t=e.key,r=D(e,J);return m.default.createElement(y,b({key:t},r))}))),r&&m.default.createElement(E,{className:"array-item-add",onClick:s,disabled:i||d,uiSchema:o,registry:u}))}function Q(e){var r=e.idSchema,a=e.title,i=e.schema,n=e.uiSchema,o=e.required,l=e.registry,s=t.getUiOptions(n),d=s.label;if(!a||void 0!==d&&!d)return null;var u=t.getTemplate("TitleFieldTemplate",l,s);return m.default.createElement(u,{id:t.titleId(r),title:a,required:o,schema:i,uiSchema:n,registry:l})}var X=["id","value","readonly","disabled","autofocus","onBlur","onFocus","onChange","options","schema","uiSchema","formContext","registry","rawErrors","type"];function Z(r){var a=r.id,i=r.value,n=r.readonly,o=r.disabled,l=r.autofocus,s=r.onBlur,d=r.onFocus,u=r.onChange,c=r.options,f=r.schema,p=r.type,h=D(r,X);if(!a)throw console.log("No id for",r),new Error("no id for props "+JSON.stringify(r));var v,y=b({},h,t.getInputProps(f,p,c));v="number"===y.type||"integer"===y.type?i||0===i?i:"":null==i?"":i;var g=e.useCallback((function(e){var t=e.target.value;return u(""===t?c.emptyValue:t)}),[u,c]),E=e.useCallback((function(e){return s(a,e.target.value)}),[s,a]),S=e.useCallback((function(e){return d(a,e.target.value)}),[d,a]);return m.default.createElement(m.default.Fragment,null,m.default.createElement("input",b({id:a,name:a,className:"form-control",readOnly:n,disabled:o,autoFocus:l,value:v},y,{list:f.examples?t.examplesId(a):void 0,onChange:g,onBlur:E,onFocus:S,"aria-describedby":t.ariaDescribedByIds(a,!!f.examples)})),Array.isArray(f.examples)&&m.default.createElement("datalist",{key:"datalist_"+a,id:t.examplesId(a)},[].concat(new Set(f.examples.concat(f.default?[f.default]:[]))).map((function(e){return m.default.createElement("option",{key:e,value:e})}))))}function ee(e){var r=t.getSubmitButtonOptions(e.uiSchema),a=r.submitText,i=r.props,n=void 0===i?{}:i;return r.norender?null:m.default.createElement("div",null,m.default.createElement("button",b({type:"submit"},n,{className:"btn btn-info "+n.className}),a))}var te=["iconType","icon","className","uiSchema","registry"];function re(e){var t=e.iconType,r=void 0===t?"default":t,a=e.icon,i=e.className,n=D(e,te);return m.default.createElement("button",b({type:"button",className:"btn btn-"+r+" "+i},n),m.default.createElement("i",{className:"glyphicon glyphicon-"+a}))}function ae(e){return m.default.createElement(re,b({title:"Move down",className:"array-item-move-down"},e,{icon:"arrow-down"}))}function ie(e){return m.default.createElement(re,b({title:"Move up",className:"array-item-move-up"},e,{icon:"arrow-up"}))}function ne(e){return m.default.createElement(re,b({title:"Remove",className:"array-item-remove"},e,{iconType:"danger",icon:"remove"}))}function oe(e){return m.default.createElement("div",{className:"row"},m.default.createElement("p",{className:"col-xs-3 col-xs-offset-9 text-right "+e.className},m.default.createElement(re,{iconType:"info",icon:"plus",className:"btn-add col-xs-12",title:"Add",onClick:e.onClick,disabled:e.disabled,registry:e.registry})))}function le(e){var t=e.description;return t?m.default.createElement("string"==typeof t?"p":"div",{id:e.id,className:"field-description"},t):null}function se(e){var t=e.errors;return m.default.createElement("div",{className:"panel panel-danger errors"},m.default.createElement("div",{className:"panel-heading"},m.default.createElement("h3",{className:"panel-title"},"Errors")),m.default.createElement("ul",{className:"list-group"},t.map((function(e,t){return m.default.createElement("li",{key:t,className:"list-group-item text-danger"},e.stack)}))))}function de(e){var t=e.label;return t?m.default.createElement("label",{className:"control-label",htmlFor:e.id},t,e.required&&m.default.createElement("span",{className:"required"},"*")):null}function ue(e){var r=e.id,a=e.label,i=e.children,n=e.errors,o=e.help,l=e.description,s=e.hidden,d=e.required,u=e.displayLabel,c=e.registry,f=t.getUiOptions(e.uiSchema),p=t.getTemplate("WrapIfAdditionalTemplate",c,f);return s?m.default.createElement("div",{className:"hidden"},i):m.default.createElement(p,b({},e),u&&m.default.createElement(de,{label:a,required:d,id:r}),u&&l?l:null,i,n,o)}function ce(e){var r=e.errors,a=void 0===r?[]:r;if(0===a.length)return null;var i=t.errorId(e.idSchema);return m.default.createElement("div",null,m.default.createElement("ul",{id:i,className:"error-detail bs-callout bs-callout-info"},a.filter((function(e){return!!e})).map((function(e,t){return m.default.createElement("li",{className:"text-danger",key:t},e)}))))}function me(e){var r=e.help;if(!r)return null;var a=t.helpId(e.idSchema);return m.default.createElement("string"==typeof r?"p":"div",{id:a,className:"help-block"},r)}function fe(e){var r=e.description,a=e.disabled,i=e.formData,n=e.idSchema,o=e.onAddClick,l=e.properties,s=e.readonly,d=e.registry,u=e.required,c=e.schema,f=e.title,p=e.uiSchema,h=t.getUiOptions(p),v=t.getTemplate("TitleFieldTemplate",d,h),y=t.getTemplate("DescriptionFieldTemplate",d,h),g=d.templates.ButtonTemplates.AddButton;return m.default.createElement("fieldset",{id:n.$id},(h.title||f)&&m.default.createElement(v,{id:t.titleId(n),title:h.title||f,required:u,schema:c,uiSchema:p,registry:d}),(h.description||r)&&m.default.createElement(y,{id:t.descriptionId(n),description:h.description||r,schema:c,uiSchema:p,registry:d}),l.map((function(e){return e.content})),t.canExpand(c,p,i)&&m.default.createElement(g,{className:"object-property-expand",onClick:o(c),disabled:a||s,uiSchema:p,registry:d}))}function pe(e){return m.default.createElement("legend",{id:e.id},e.title,e.required&&m.default.createElement("span",{className:"required"},"*"))}function he(e){var t=e.schema,r=e.idSchema,a=e.reason;return m.default.createElement("div",{className:"unsupported-field"},m.default.createElement("p",null,"Unsupported field schema",r&&r.$id&&m.default.createElement("span",null," for"," field ",m.default.createElement("code",null,r.$id)),a&&m.default.createElement("em",null,": ",a),"."),t&&m.default.createElement("pre",null,JSON.stringify(t,null,2)))}function ve(e){var r=e.id,a=e.disabled,i=e.label,n=e.onKeyChange,o=e.onDropPropertyClick,l=e.readonly,s=e.children,d=e.uiSchema,u=e.registry,c=u.templates.ButtonTemplates.RemoveButton;return m.default.createElement("div",{className:e.classNames,style:e.style},t.ADDITIONAL_PROPERTY_FLAG in e.schema?m.default.createElement("div",{className:"row"},m.default.createElement("div",{className:"col-xs-5 form-additional"},m.default.createElement("div",{className:"form-group"},m.default.createElement(de,{label:i+" Key",required:e.required,id:r+"-key"}),m.default.createElement("input",{className:"form-control",type:"text",id:r+"-key",onBlur:function(e){return n(e.target.value)},defaultValue:i}))),m.default.createElement("div",{className:"form-additional form-group col-xs-5"},s),m.default.createElement("div",{className:"col-xs-2"},m.default.createElement(c,{className:"array-item-remove btn-block",style:{border:"0"},disabled:a||l,onClick:o(i),uiSchema:d,registry:u}))):s)}function ye(e,r){for(var a=[],i=e;i<=r;i++)a.push({value:i,label:t.pad(i,2)});return a}function ge(e){var r=e.type,a=e.range,i=e.value,n=e.select,o=e.rootId,l=e.disabled,s=e.readonly,d=e.autofocus,u=e.registry,c=e.onBlur,f=e.onFocus;return m.default.createElement(u.widgets.SelectWidget,{schema:{type:"integer"},id:o+"_"+r,className:"form-control",options:{enumOptions:ye(a[0],a[1])},placeholder:r,value:i,disabled:l,readonly:s,autofocus:d,onChange:function(e){return n(r,e)},onBlur:c,onFocus:f,registry:u,label:"","aria-describedby":t.ariaDescribedByIds(o)})}function Ee(r){var a=r.time,i=void 0!==a&&a,n=r.disabled,o=void 0!==n&&n,l=r.readonly,s=void 0!==l&&l,d=r.autofocus,u=void 0!==d&&d,c=r.options,f=r.id,p=r.registry,h=r.onBlur,v=r.onFocus,y=r.onChange,g=r.value,E=e.useReducer((function(e,t){return b({},e,t)}),t.parseDateString(g,i)),S=E[0],C=E[1];e.useEffect((function(){g&&g!==t.toDateString(S,i)&&C(t.parseDateString(g,i))}),[g,S,i]),e.useEffect((function(){(function(e){return Object.values(e).every((function(e){return-1!==e}))})(S)&&y(t.toDateString(S,i))}),[S,i,y]);var F=e.useCallback((function(e,t){var r;C(((r={})[e]=t,r))}),[]),D=e.useCallback((function(e){if(e.preventDefault(),!o&&!s){var r=t.parseDateString((new Date).toJSON(),i);C(r)}}),[o,s,i]),O=e.useCallback((function(e){e.preventDefault(),o||s||(C(t.parseDateString("",i)),y(void 0))}),[o,s,i,y]);return m.default.createElement("ul",{className:"list-inline"},function(e,t,r){void 0===r&&(r=[1900,(new Date).getFullYear()+2]);var a=[{type:"year",range:r,value:e.year},{type:"month",range:[1,12],value:e.month},{type:"day",range:[1,31],value:e.day}];return t&&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}(S,i,c.yearsRange).map((function(e,t){return m.default.createElement("li",{key:t},m.default.createElement(ge,b({rootId:f,select:F},e,{disabled:o,readonly:s,registry:p,onBlur:h,onFocus:v,autofocus:u&&0===t})))})),("undefined"===c.hideNowButton||!c.hideNowButton)&&m.default.createElement("li",null,m.default.createElement("a",{href:"#",className:"btn btn-info btn-now",onClick:D},"Now")),("undefined"===c.hideClearButton||!c.hideClearButton)&&m.default.createElement("li",null,m.default.createElement("a",{href:"#",className:"btn btn-warning btn-clear",onClick:O},"Clear")))}var Se=["time"];function be(e){var t=e.time,r=void 0===t||t,a=D(e,Se);return m.default.createElement(a.registry.widgets.AltDateWidget,b({time:r},a))}function Ce(r){var a=r.schema,i=r.uiSchema,n=r.id,o=r.value,l=r.disabled,s=r.readonly,d=r.label,u=r.autofocus,c=void 0!==u&&u,f=r.onBlur,p=r.onFocus,h=r.onChange,v=r.registry,y=t.getTemplate("DescriptionFieldTemplate",v,r.options),g=t.schemaRequiresTrueValue(a),E=e.useCallback((function(e){return h(e.target.checked)}),[h]),S=e.useCallback((function(e){return f(n,e.target.checked)}),[f,n]),b=e.useCallback((function(e){return p(n,e.target.checked)}),[p,n]);return m.default.createElement("div",{className:"checkbox "+(l||s?"disabled":"")},a.description&&m.default.createElement(y,{id:t.descriptionId(n),description:a.description,schema:a,uiSchema:i,registry:v}),m.default.createElement("label",null,m.default.createElement("input",{type:"checkbox",id:n,name:n,checked:void 0!==o&&o,required:g,disabled:l||s,autoFocus:c,onChange:E,onBlur:S,onFocus:b,"aria-describedby":t.ariaDescribedByIds(n)}),m.default.createElement("span",null,d)))}function Fe(e){var r=e.id,a=e.disabled,i=e.options,n=i.inline,o=void 0!==n&&n,l=i.enumOptions,s=i.enumDisabled,d=e.value,u=e.autofocus,c=void 0!==u&&u,f=e.readonly,p=e.onChange,h=Array.isArray(d)?d:[d];return m.default.createElement("div",{className:"checkboxes",id:r},Array.isArray(l)&&l.map((function(e,i){var n=h.includes(e.value),d=Array.isArray(s)&&-1!=s.indexOf(e.value),u=a||d||f?"disabled":"",v=m.default.createElement("span",null,m.default.createElement("input",{type:"checkbox",id:t.optionId(r,e),name:r,checked:n,disabled:a||d||f,autoFocus:c&&0===i,onChange:function(r){p(r.target.checked?t.enumOptionsSelectValue(e.value,h,l):t.enumOptionsDeselectValue(e.value,h))},"aria-describedby":t.ariaDescribedByIds(r)}),m.default.createElement("span",null,e.label));return o?m.default.createElement("label",{key:e.value,className:"checkbox-inline "+u},v):m.default.createElement("div",{key:e.value,className:"checkbox "+u},m.default.createElement("label",null,v))})))}function De(e){var r=e.disabled,a=e.readonly,i=t.getTemplate("BaseInputTemplate",e.registry,e.options);return m.default.createElement(i,b({type:"color"},e,{disabled:r||a}))}function Oe(r){var a=r.onChange,i=t.getTemplate("BaseInputTemplate",r.registry,r.options),n=e.useCallback((function(e){return a(e||void 0)}),[a]);return m.default.createElement(i,b({type:"date"},r,{onChange:n}))}function ke(e){var r=e.onChange,a=e.value,i=t.getTemplate("BaseInputTemplate",e.registry,e.options);return m.default.createElement(i,b({type:"datetime-local"},e,{value:t.utcToLocal(a),onChange:function(e){return r(t.localToUTC(e))}}))}function Te(e){var r=t.getTemplate("BaseInputTemplate",e.registry,e.options);return m.default.createElement(r,b({type:"email"},e))}function xe(e,t){return null===e?null:e.replace(";base64",";name="+encodeURIComponent(t)+";base64")}function Ae(e){var t=e.name,r=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:xe(e.target.result,t),name:t,size:r,type:a}):i({dataURL:null,name:t,size:r,type:a})},o.readAsDataURL(e)}))}function we(e){var t=e.filesInfo;return 0===t.length?null:m.default.createElement("ul",{className:"file-info"},t.map((function(e,t){var r=e.size,a=e.type;return m.default.createElement("li",{key:t},m.default.createElement("strong",null,e.name)," (",a,", ",r," bytes)")})))}function Ne(e){return e.filter((function(e){return void 0!==e})).map((function(e){var r=t.dataURItoBlob(e),a=r.blob;return{name:r.name,size:a.size,type:a.type}}))}function Ie(r){var a=r.multiple,i=r.id,n=r.readonly,o=r.disabled,l=r.onChange,s=r.value,d=r.autofocus,u=void 0!==d&&d,c=r.options,f=e.useMemo((function(){return Array.isArray(s)?Ne(s):Ne([s])}),[s]),p=e.useState(f),h=p[0],v=p[1],y=e.useCallback((function(e){var t;e.target.files&&(t=e.target.files,Promise.all(Array.from(t).map(Ae))).then((function(e){v(e);var t=e.map((function(e){return e.dataURL}));l(a?t:t[0])}))}),[a,l]);return m.default.createElement("div",null,m.default.createElement("p",null,m.default.createElement("input",{id:i,name:i,type:"file",disabled:n||o,onChange:y,defaultValue:"",autoFocus:u,multiple:a,accept:c.accept?String(c.accept):void 0,"aria-describedby":t.ariaDescribedByIds(i)})),m.default.createElement(we,{filesInfo:h}))}function Be(e){var t=e.id,r=e.value;return m.default.createElement("input",{type:"hidden",id:t,name:t,value:void 0===r?"":r})}function Ue(e){var r=t.getTemplate("BaseInputTemplate",e.registry,e.options);return m.default.createElement(r,b({type:"password"},e))}function qe(r){var a=r.options,i=r.value,n=r.required,o=r.disabled,l=r.readonly,s=r.autofocus,d=void 0!==s&&s,u=r.onBlur,c=r.onFocus,f=r.onChange,p=r.id,h=Math.random().toString(),v=a.enumOptions,y=a.enumDisabled,g=a.inline,E=e.useCallback((function(e){return u(p,e.target.value)}),[u,p]),S=e.useCallback((function(e){return c(p,e.target.value)}),[c,p]);return m.default.createElement("div",{className:"field-radio-group",id:p},Array.isArray(v)&&v.map((function(e,r){var a=e.value===i,s=Array.isArray(y)&&-1!=y.indexOf(e.value),u=o||s||l?"disabled":"",c=m.default.createElement("span",null,m.default.createElement("input",{type:"radio",id:t.optionId(p,e),checked:a,name:h,required:n,value:e.value,disabled:o||s||l,autoFocus:d&&0===r,onChange:function(){return f(e.value)},onBlur:E,onFocus:S,"aria-describedby":t.ariaDescribedByIds(p)}),m.default.createElement("span",null,e.label));return g?m.default.createElement("label",{key:e.value,className:"radio-inline "+u},c):m.default.createElement("div",{key:e.value,className:"radio "+u},m.default.createElement("label",null,c))})))}function Pe(e){var t=e.value;return m.default.createElement("div",{className:"field-range-wrapper"},m.default.createElement(e.registry.templates.BaseInputTemplate,b({type:"range"},e)),m.default.createElement("span",{className:"range-view"},t))}function Re(e,t){return t?Array.from(e.target.options).slice().filter((function(e){return e.selected})).map((function(e){return e.value})):e.target.value}function _e(r){var a=r.schema,i=r.id,n=r.options,o=r.value,l=r.required,s=r.disabled,d=r.readonly,u=r.multiple,c=void 0!==u&&u,f=r.autofocus,p=void 0!==f&&f,h=r.onChange,v=r.onBlur,y=r.onFocus,g=r.placeholder,E=n.enumOptions,S=n.enumDisabled,b=c?[]:"",C=e.useCallback((function(e){var r=Re(e,c);return y(i,t.processSelectValue(a,r,n))}),[y,i,a,c,n]),F=e.useCallback((function(e){var r=Re(e,c);return v(i,t.processSelectValue(a,r,n))}),[v,i,a,c,n]),D=e.useCallback((function(e){var r=Re(e,c);return h(t.processSelectValue(a,r,n))}),[h,a,c,n]);return m.default.createElement("select",{id:i,name:i,multiple:c,className:"form-control",value:void 0===o?b:o,required:l,disabled:s||d,autoFocus:p,onBlur:F,onFocus:C,onChange:D,"aria-describedby":t.ariaDescribedByIds(i)},!c&&void 0===a.default&&m.default.createElement("option",{value:""},g),Array.isArray(E)&&E.map((function(e,t){var r=e.value,a=e.label,i=S&&-1!=S.indexOf(r);return m.default.createElement("option",{key:t,value:r,disabled:i},a)})))}function je(r){var a=r.id,i=r.options,n=void 0===i?{}:i,o=r.placeholder,l=r.value,s=r.required,d=r.disabled,u=r.readonly,c=r.autofocus,f=void 0!==c&&c,p=r.onChange,h=r.onBlur,v=r.onFocus,y=e.useCallback((function(e){var t=e.target.value;return p(""===t?n.emptyValue:t)}),[p,n.emptyValue]),g=e.useCallback((function(e){return h(a,e.target.value)}),[h,a]),E=e.useCallback((function(e){return v(a,e.target.value)}),[a,v]);return m.default.createElement("textarea",{id:a,name:a,className:"form-control",value:l||"",placeholder:o,required:s,disabled:d,readOnly:u,autoFocus:f,rows:n.rows,onBlur:g,onFocus:E,onChange:y,"aria-describedby":t.ariaDescribedByIds(a)})}function Ve(e){var r=t.getTemplate("BaseInputTemplate",e.registry,e.options);return m.default.createElement(r,b({},e))}function Ke(e){var r=t.getTemplate("BaseInputTemplate",e.registry,e.options);return m.default.createElement(r,b({type:"url"},e))}function Me(e){var r=t.getTemplate("BaseInputTemplate",e.registry,e.options);return m.default.createElement(r,b({type:"number"},e))}function We(){return{fields:{AnyOfField:q,ArrayField:N,BooleanField:B,NumberField:_,ObjectField:j,OneOfField:q,SchemaField:W,StringField:Y,NullField:$},templates:{ArrayFieldDescriptionTemplate:z,ArrayFieldItemTemplate:H,ArrayFieldTemplate:G,ArrayFieldTitleTemplate:Q,ButtonTemplates:{SubmitButton:ee,AddButton:oe,MoveDownButton:ae,MoveUpButton:ie,RemoveButton:ne},BaseInputTemplate:Z,DescriptionFieldTemplate:le,ErrorListTemplate:se,FieldTemplate:ue,FieldErrorTemplate:ce,FieldHelpTemplate:me,ObjectFieldTemplate:fe,TitleFieldTemplate:pe,UnsupportedFieldTemplate:he,WrapIfAdditionalTemplate:ve},widgets:{PasswordWidget:Ue,RadioWidget:qe,UpDownWidget:Me,RangeWidget:Pe,SelectWidget:_e,TextWidget:Ve,DateWidget:Oe,DateTimeWidget:ke,AltDateWidget:Ee,AltDateTimeWidget:be,EmailWidget:Te,URLWidget:Ke,TextareaWidget:je,HiddenWidget:Be,ColorWidget:De,FileWidget:Ie,CheckboxWidget:Ce,CheckboxesWidget:Fe},rootSchema:{},formContext:{}}}je.defaultProps={autofocus:!1,options:{}};var Le=function(e){function r(r){var a;if((a=e.call(this,r)||this).formElement=void 0,a.getUsedFormData=function(e,t){if(0===t.length&&"object"!=typeof e)return e;var r=h.default(e,t);return Array.isArray(e)?Object.keys(r).map((function(e){return r[e]})):r},a.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 l=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,l)}else o===t.NAME_KEY&&""!==a[o]&&n.forEach((function(e){var t=f.default(r,e);("object"!=typeof t||p.default(t))&&i.push(e)}))})),i}(e)},a.onChange=function(e,r,i){var n=a.props,o=n.extraErrors,l=n.omitExtraData,s=n.liveOmit,d=n.noValidate,u=n.liveValidate,c=n.onChange,m=a.state,f=m.schemaUtils,p=m.schema;(t.isObject(e)||Array.isArray(e))&&(e=a.getStateFromProps(a.props,e).formData);var h=!d&&u,v={formData:e,schema:p},y=e;if(!0===l&&!0===s){var g=f.retrieveSchema(p,e),E=f.toPathSchema(g,"",e),S=a.getFieldNames(E,e);y=a.getUsedFormData(e,S),v={formData:y}}if(h){var C=a.validate(y),F=C.errors,D=C.errorSchema,O=F,k=D;if(o){var T=f.mergeValidationData(C,o);D=T.errorSchema,F=T.errors}v={formData:y,errors:F,errorSchema:D,schemaValidationErrors:O,schemaValidationErrorSchema:k}}else if(!d&&r){var x=o?t.mergeObjects(r,o,"preventDuplicates"):r;v={formData:y,errorSchema:x,errors:f.getValidator().toErrorList(x)}}a.setState(v,(function(){return c&&c(b({},a.state,v),i)}))},a.onBlur=function(e,t){var r=a.props.onBlur;r&&r(e,t)},a.onFocus=function(e,t){var r=a.props.onFocus;r&&r(e,t)},a.onSubmit=function(e){if(e.preventDefault(),e.target===e.currentTarget){e.persist();var t=a.props,r=t.extraErrors,i=t.noValidate,n=t.onSubmit,o=a.state.formData,l=a.state,s=l.schemaUtils;if(!0===t.omitExtraData){var d=s.retrieveSchema(l.schema,o),u=s.toPathSchema(d,"",o),c=a.getFieldNames(u,o);o=a.getUsedFormData(o,c)}if(i||a.validateForm()){var m=r||{},f=r?s.getValidator().toErrorList(r):[];a.setState({formData:o,errors:f,errorSchema:m,schemaValidationErrors:[],schemaValidationErrorSchema:{}},(function(){n&&n(b({},a.state,{formData:o,status:"submitted"}),e)}))}}},!r.validator)throw new Error("A validator is required for Form functionality to work");return a.state=a.getStateFromProps(r,r.formData),a.props.onChange&&!t.deepEquals(a.state.formData,a.props.formData)&&a.props.onChange(a.state),a.formElement=m.default.createRef(),a}C(r,e);var a=r.prototype;return a.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)},a.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,l=o&&!e.noValidate&&("liveValidate"in e?e.liveValidate:this.props.liveValidate),s=i,d=a.schemaUtils;d&&!d.doesSchemaUtilsDiffer(e.validator,s)||(d=t.createSchemaUtils(e.validator,s));var u,c,m=d.getDefaultFormState(i,r),f=d.retrieveSchema(i,m),p=a.schemaValidationErrors,h=a.schemaValidationErrorSchema;if(l){var v=this.validate(m,i,d);p=u=v.errors,h=c=v.errorSchema}else{var y=e.noValidate?{errors:[],errorSchema:{}}:e.liveValidate?{errors:a.errors||[],errorSchema:a.errorSchema||{}}:{errors:a.schemaValidationErrors||[],errorSchema:a.schemaValidationErrorSchema||{}};u=y.errors,c=y.errorSchema}if(e.extraErrors){var g=d.mergeValidationData({errorSchema:c,errors:u},e.extraErrors);c=g.errorSchema,u=g.errors}var E=d.toIdSchema(f,n["ui:rootFieldId"],m,e.idPrefix,e.idSeparator);return{schemaUtils:d,schema:i,uiSchema:n,idSchema:E,formData:m,edit:o,errors:u,errorSchema:c,schemaValidationErrors:p,schemaValidationErrorSchema:h}},a.shouldComponentUpdate=function(e,r){return t.shouldRender(this,e,r)},a.validate=function(e,t,r){void 0===t&&(t=this.props.schema);var a=r||this.state.schemaUtils,i=this.props,n=i.customValidate,o=i.transformErrors,l=i.uiSchema,s=a.retrieveSchema(t,e);return a.getValidator().validateFormData(e,s,n,o,l)},a.renderErrors=function(e){var r=this.state,a=r.errors,i=r.errorSchema,n=r.schema,o=r.uiSchema,l=this.props.formContext,s=t.getUiOptions(o),d=t.getTemplate("ErrorListTemplate",e,s);return a&&a.length?m.default.createElement(d,{errors:a,errorSchema:i||{},schema:n,uiSchema:o,formContext:l}):null},a.getRegistry=function(){var e,t=this.state.schemaUtils,r=We(),a=r.templates,i=r.widgets,n=r.formContext;return{fields:b({},r.fields,this.props.fields),templates:b({},a,this.props.templates,{ButtonTemplates:b({},a.ButtonTemplates,null===(e=this.props.templates)||void 0===e?void 0:e.ButtonTemplates)}),widgets:b({},i,this.props.widgets),rootSchema:this.props.schema,formContext:this.props.formContext||n,schemaUtils:t}},a.submit=function(){this.formElement.current&&(this.formElement.current.dispatchEvent(new CustomEvent("submit",{cancelable:!0})),this.formElement.current.requestSubmit())},a.validateForm=function(){var e=this.props,t=e.extraErrors,r=e.onError,a=this.state.schemaUtils,i=this.validate(this.state.formData),n=i.errors,o=i.errorSchema,l=n,s=o;if(n.length>0){if(t){var d=a.mergeValidationData(i,t);o=d.errorSchema,n=d.errors}return this.setState({errors:n,errorSchema:o,schemaValidationErrors:l,schemaValidationErrorSchema:s},(function(){r?r(n):console.error("Form validation failed",n)})),!1}return!0},a.render=function(){var e=this.props,t=e.children,r=e.id,a=e.idPrefix,i=e.idSeparator,n=e.className,o=void 0===n?"":n,l=e.tagName,s=e.name,d=e.method,u=e.target,c=e.action,f=e.autoComplete,p=e.enctype,h=e.acceptcharset,v=e.noHtml5Validate,y=void 0!==v&&v,g=e.disabled,E=void 0!==g&&g,S=e.readonly,b=void 0!==S&&S,C=e.formContext,F=e.showErrorList,D=void 0===F?"top":F,O=e._internalFormWrapper,k=this.state,T=k.schema,x=k.uiSchema,A=k.formData,w=k.errorSchema,N=k.idSchema,I=this.getRegistry(),B=I.fields.SchemaField,U=I.templates.ButtonTemplates.SubmitButton;return m.default.createElement(O||l||"form",{className:o||"rjsf",id:r,name:s,method:d,target:u,action:c,autoComplete:f,encType:p,acceptCharset:h,noValidate:y,onSubmit:this.onSubmit,as:O?l:void 0,ref:this.formElement},"top"===D&&this.renderErrors(I),m.default.createElement(B,{name:"",schema:T,uiSchema:x,errorSchema:w,idSchema:N,idPrefix:a,idSeparator:i,formContext:C,formData:A,onChange:this.onChange,onBlur:this.onBlur,onFocus:this.onFocus,registry:I,disabled:E,readonly:b}),t||m.default.createElement(U,{uiSchema:x,registry:I}),"bottom"===D&&this.renderErrors(I))},r}(e.Component),Ye=["fields","widgets","templates"];exports.default=Le,exports.getDefaultRegistry=We,exports.withTheme=function(t){return e.forwardRef((function(e,r){var a,i,n=e.fields,o=e.widgets,l=e.templates,s=D(e,Ye);return n=b({},null==t?void 0:t.fields,n),o=b({},null==t?void 0:t.widgets,o),l=b({},null==t?void 0:t.templates,l,{ButtonTemplates:b({},null==t||null===(a=t.templates)||void 0===a?void 0:a.ButtonTemplates,null===(i=l)||void 0===i?void 0:i.ButtonTemplates)}),m.default.createElement(Le,b({},t,s,{fields:n,widgets:o,templates:l,ref:r}))}))}; | ||
//# sourceMappingURL=core.cjs.production.min.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("@rjsf/utils"),require("lodash-es/get"),require("lodash-es/isEmpty"),require("lodash-es/pick"),require("lodash-es/isObject"),require("lodash-es/set"),require("nanoid"),require("lodash-es/omit"),require("lodash-es/has"),require("lodash-es/unset")):"function"==typeof define&&define.amd?define(["exports","react","@rjsf/utils","lodash-es/get","lodash-es/isEmpty","lodash-es/pick","lodash-es/isObject","lodash-es/set","nanoid","lodash-es/omit","lodash-es/has","lodash-es/unset"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).JSONSchemaForm={},e.React,e.utils,e.get,e.isEmpty,e._pick,e.isObject,e.set,e.nanoid,e.omit,e.has,e.unset)}(this,(function(e,t,r,a,i,n,o,l,s,d,u,c){"use strict";function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=m(t),p=m(a),h=m(i),v=m(n),y=m(o),g=m(l),E=m(d),S=m(u),b=m(c);function C(){return C=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},C.apply(this,arguments)}function F(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,D(e,t)}function D(e,t){return D=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},D(e,t)}function k(e,t){if(null==e)return{};var r,a,i={},n=Object.keys(e);for(a=0;a<n.length;a++)t.indexOf(r=n[a])>=0||(i[r]=e[r]);return i}var O=["widget"],T=["widget"],x=["widget"];function N(){return s.nanoid()}function A(e){return Array.isArray(e)?e.map((function(e){return{key:N(),item:e}})):[]}function w(e){return Array.isArray(e)?e.map((function(e){return e.item})):[]}var I=function(e){function t(t){var a;(a=e.call(this,t)||this)._getNewFormDataRow=function(){var e=a.props,t=e.schema,i=e.registry.schemaUtils,n=t.items;return r.isFixedItems(t)&&r.allowAdditionalItems(t)&&(n=t.additionalItems),i.getDefaultFormState(n)},a.onAddClick=function(e){a._handleAddClick(e)},a.onAddIndexClick=function(e){return function(t){a._handleAddClick(t,e)}},a.onDropIndexClick=function(e){return function(t){t&&t.preventDefault();var r,i=a.props,n=i.onChange,o=i.errorSchema,l=a.state.keyedFormData;if(o)for(var s in r={},o){var d=parseInt(s);d<e?g.default(r,[d],o[s]):d>e&&g.default(r,[d-1],o[s])}var u=l.filter((function(t,r){return r!==e}));a.setState({keyedFormData:u,updatedKeyedFormData:!0},(function(){return n(w(u),r)}))}},a.onReorderClick=function(e,t){return function(r){r&&(r.preventDefault(),r.currentTarget.blur());var i,n=a.props,o=n.onChange,l=n.errorSchema;if(a.props.errorSchema)for(var s in i={},l){var d=parseInt(s);d==e?g.default(i,[t],l[e]):d==t?g.default(i,[e],l[t]):g.default(i,[s],l[d])}var u,c=a.state.keyedFormData,m=((u=c.slice()).splice(e,1),u.splice(t,0,c[e]),u);a.setState({keyedFormData:m},(function(){return o(w(m),i)}))}},a.onChangeForIndex=function(e){return function(t,r,i){var n,o=a.props,l=o.formData,s=o.errorSchema;(0,o.onChange)((Array.isArray(l)?l:[]).map((function(r,a){return e===a?void 0===t?null:t:r})),s&&s&&C({},s,((n={})[e]=r,n)),i)}},a.onSelectChange=function(e){var t=a.props,r=t.idSchema;(0,t.onChange)(e,void 0,r&&r.$id)};var i=t.formData,n=A(void 0===i?[]:i);return a.state={keyedFormData:n,updatedKeyedFormData:!1},a}F(t,e),t.getDerivedStateFromProps=function(e,t){if(t.updatedKeyedFormData)return{updatedKeyedFormData:!1};var r=Array.isArray(e.formData)?e.formData:[],a=t.keyedFormData||[];return{keyedFormData:r.length===a.length?a.map((function(e,t){return{key:e.key,item:r[t]}})):A(r)}};var a,i,n=t.prototype;return n.isItemRequired=function(e){return Array.isArray(e.type)?!e.type.includes("null"):"null"!==e.type},n.canAddItem=function(e){var t=this.props,a=t.schema,i=r.getUiOptions(t.uiSchema).addable;return!1!==i&&(i=void 0===a.maxItems||e.length<a.maxItems),i},n._handleAddClick=function(e,t){e&&e.preventDefault();var r=this.props.onChange,a=this.state.keyedFormData,i={key:N(),item:this._getNewFormDataRow()},n=[].concat(a);void 0!==t?n.splice(t,0,i):n.push(i),this.setState({keyedFormData:n,updatedKeyedFormData:!0},(function(){return r(w(n))}))},n.render=function(){var e=this.props,t=e.schema,a=e.uiSchema,i=e.idSchema,n=e.registry,o=n.schemaUtils;if(!(r.ITEMS_KEY in t)){var l=r.getUiOptions(a),s=r.getTemplate("UnsupportedFieldTemplate",n,l);return f.default.createElement(s,{schema:t,idSchema:i,reason:"Missing items definition",registry:n})}return o.isMultiSelect(t)?this.renderMultiSelect():r.isCustomWidget(a)?this.renderCustomWidget():r.isFixedItems(t)?this.renderFixedArray():o.isFilesArray(t,a)?this.renderFiles():this.renderNormalArray()},n.renderNormalArray=function(){var e=this,t=this.props,a=t.schema,i=t.uiSchema,n=void 0===i?{}:i,o=t.errorSchema,l=t.idSchema,s=t.name,d=t.disabled,u=void 0!==d&&d,c=t.readonly,m=void 0!==c&&c,p=t.autofocus,h=void 0!==p&&p,v=t.required,g=void 0!==v&&v,E=t.registry,S=t.onBlur,b=t.onFocus,F=t.idPrefix,D=t.idSeparator,k=void 0===D?"_":D,O=t.rawErrors,T=this.state.keyedFormData,x=void 0===a.title?s:a.title,N=E.schemaUtils,A=E.formContext,I=r.getUiOptions(n),B=y.default(a.items)?a.items:{},U=N.retrieveSchema(B),P=w(this.state.keyedFormData),q=this.canAddItem(P),R={canAdd:q,items:T.map((function(t,r){var a=t.key,i=t.item,d=N.retrieveSchema(B,i),u=o?o[r]:void 0,c=N.toIdSchema(d,l.$id+k+r,i,F,k);return e.renderArrayFieldItem({key:a,index:r,name:s&&s+"-"+r,canAdd:q,canMoveUp:r>0,canMoveDown:r<P.length-1,itemSchema:d,itemIdSchema:c,itemErrorSchema:u,itemData:i,itemUiSchema:n.items,autofocus:h&&0===r,onBlur:S,onFocus:b,rawErrors:O,totalItems:T.length})})),className:"field field-array field-array-of-"+U.type,disabled:u,idSchema:l,uiSchema:n,onAddClick:this.onAddClick,readonly:m,required:g,schema:a,title:x,formContext:A,formData:P,rawErrors:O,registry:E},_=r.getTemplate("ArrayFieldTemplate",E,I);return f.default.createElement(_,C({},R))},n.renderCustomWidget=function(){var e=this.props,t=e.schema,a=e.idSchema,i=e.uiSchema,n=e.disabled,o=void 0!==n&&n,l=e.readonly,s=void 0!==l&&l,d=e.autofocus,u=void 0!==d&&d,c=e.required,m=void 0!==c&&c,p=e.hideError,h=e.placeholder,v=e.onBlur,y=e.onFocus,g=e.formData,E=void 0===g?[]:g,S=e.registry,b=e.rawErrors,C=S.widgets,F=S.formContext,D=t.title||e.name,T=r.getUiOptions(i),x=T.widget,N=k(T,O),A=r.getWidget(t,x,C);return f.default.createElement(A,{id:a.$id,multiple:!0,onChange:this.onSelectChange,onBlur:v,onFocus:y,options:N,schema:t,uiSchema:i,registry:S,value:E,disabled:o,readonly:s,hideError:p,required:m,label:D,placeholder:h,formContext:F,autofocus:u,rawErrors:b})},n.renderMultiSelect=function(){var e=this.props,t=e.schema,a=e.idSchema,i=e.uiSchema,n=e.formData,o=void 0===n?[]:n,l=e.disabled,s=void 0!==l&&l,d=e.readonly,u=void 0!==d&&d,c=e.autofocus,m=void 0!==c&&c,p=e.required,h=void 0!==p&&p,v=e.placeholder,y=e.onBlur,g=e.onFocus,E=e.registry,S=e.rawErrors,b=e.name,F=E.widgets,D=E.formContext,O=E.schemaUtils.retrieveSchema(t.items,o),x=t.title||b,N=r.optionsList(O),A=r.getUiOptions(i),w=A.widget,I=void 0===w?"select":w,B=k(A,T),U=r.getWidget(t,I,F);return f.default.createElement(U,{id:a.$id,multiple:!0,onChange:this.onSelectChange,onBlur:y,onFocus:g,options:C({},B,{enumOptions:N}),schema:t,uiSchema:i,registry:E,value:o,disabled:s,readonly:u,required:h,label:x,placeholder:v,formContext:D,autofocus:m,rawErrors:S})},n.renderFiles=function(){var e=this.props,t=e.schema,a=e.uiSchema,i=e.idSchema,n=e.disabled,o=void 0!==n&&n,l=e.readonly,s=void 0!==l&&l,d=e.autofocus,u=void 0!==d&&d,c=e.required,m=void 0!==c&&c,p=e.onBlur,h=e.onFocus,v=e.registry,y=e.formData,g=void 0===y?[]:y,E=e.rawErrors,S=t.title||e.name,b=v.widgets,C=v.formContext,F=r.getUiOptions(a),D=F.widget,O=void 0===D?"files":D,T=k(F,x),N=r.getWidget(t,O,b);return f.default.createElement(N,{options:T,id:i.$id,multiple:!0,onChange:this.onSelectChange,onBlur:p,onFocus:h,schema:t,uiSchema:a,title:S,value:g,disabled:o,readonly:s,required:m,registry:v,formContext:C,autofocus:u,rawErrors:E,label:""})},n.renderFixedArray=function(){var e=this,t=this.props,a=t.schema,i=t.uiSchema,n=void 0===i?{}:i,o=t.formData,l=void 0===o?[]:o,s=t.errorSchema,d=t.idPrefix,u=t.idSeparator,c=void 0===u?"_":u,m=t.idSchema,p=t.name,h=t.disabled,v=void 0!==h&&h,g=t.readonly,E=void 0!==g&&g,S=t.autofocus,b=void 0!==S&&S,F=t.required,D=void 0!==F&&F,k=t.registry,O=t.onBlur,T=t.onFocus,x=t.rawErrors,N=this.state.keyedFormData,A=this.props.formData,w=void 0===A?[]:A,I=a.title||p,B=r.getUiOptions(n),U=k.schemaUtils,P=k.formContext,q=(y.default(a.items)?a.items:[]).map((function(e,t){return U.retrieveSchema(e,l[t])})),R=y.default(a.additionalItems)?U.retrieveSchema(a.additionalItems,l):null;(!w||w.length<q.length)&&(w=(w=w||[]).concat(new Array(q.length-w.length)));var _=this.canAddItem(w)&&!!R,j={canAdd:_,className:"field field-array field-array-fixed-items",disabled:v,idSchema:m,formData:l,items:N.map((function(t,r){var i=t.key,o=t.item,l=r>=q.length,u=l&&y.default(a.additionalItems)?U.retrieveSchema(a.additionalItems,o):q[r],f=U.toIdSchema(u,m.$id+c+r,o,d,c),h=l?n.additionalItems||{}:Array.isArray(n.items)?n.items[r]:n.items||{};return e.renderArrayFieldItem({key:i,index:r,name:p&&p+"-"+r,canAdd:_,canRemove:l,canMoveUp:r>=q.length+1,canMoveDown:l&&r<w.length-1,itemSchema:u,itemData:o,itemUiSchema:h,itemIdSchema:f,itemErrorSchema:s?s[r]:void 0,autofocus:b&&0===r,onBlur:O,onFocus:T,rawErrors:x,totalItems:N.length})})),onAddClick:this.onAddClick,readonly:E,required:D,registry:k,schema:a,uiSchema:n,title:I,formContext:P,rawErrors:x},V=r.getTemplate("ArrayFieldTemplate",k,B);return f.default.createElement(V,C({},j))},n.renderArrayFieldItem=function(e){var t=e.key,a=e.index,i=e.name,n=e.canAdd,o=e.canRemove,l=void 0===o||o,s=e.canMoveUp,d=void 0===s||s,u=e.canMoveDown,c=void 0===u||u,m=e.itemSchema,p=e.itemData,h=e.itemUiSchema,v=e.itemIdSchema,y=e.itemErrorSchema,g=e.autofocus,E=e.onBlur,S=e.onFocus,b=e.rawErrors,C=e.totalItems,F=this.props,D=F.disabled,k=F.hideError,O=F.idPrefix,T=F.idSeparator,x=F.readonly,N=F.registry,A=F.formContext,w=N.fields,I=w.ArraySchemaField||w.SchemaField,B=r.getUiOptions(F.uiSchema),U=B.orderable,P=void 0===U||U,q=B.removable,R={moveUp:P&&d,moveDown:P&&c,remove:(void 0===q||q)&&l,toolbar:!1};return R.toolbar=Object.keys(R).some((function(e){return R[e]})),{children:f.default.createElement(I,{name:i,index:a,schema:m,uiSchema:h,formData:p,formContext:A,errorSchema:y,idPrefix:O,idSeparator:T,idSchema:v,required:this.isItemRequired(m),onChange:this.onChangeForIndex(a),onBlur:E,onFocus:S,registry:N,disabled:D,readonly:x,hideError:k,autofocus:g,rawErrors:b}),className:"array-item",disabled:D,canAdd:n,hasToolbar:R.toolbar,hasMoveUp:R.moveUp,hasMoveDown:R.moveDown,hasRemove:R.remove,index:a,totalItems:C,key:t,onAddIndexClick:this.onAddIndexClick,onDropIndexClick:this.onDropIndexClick,onReorderClick:this.onReorderClick,readonly:x,registry:N,schema:m,uiSchema:h}},a=t,(i=[{key:"itemTitle",get:function(){var e=this.props.schema;return p.default(e,[r.ITEMS_KEY,"title"],p.default(e,[r.ITEMS_KEY,"description"],"Item"))}}])&&function(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,"symbol"==typeof(i=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var a=r.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}(a.prototype,i),Object.defineProperty(a,"prototype",{writable:!1}),t}(t.Component),B=["widget"];function U(e){var t,a=e.schema,i=e.name,n=e.uiSchema,o=e.idSchema,l=e.formData,s=e.registry,d=e.required,u=e.disabled,c=e.readonly,m=e.autofocus,p=e.onChange,h=e.onFocus,v=e.onBlur,g=e.rawErrors,E=a.title,S=s.widgets,b=s.formContext,F=r.getUiOptions(n),D=F.widget,O=void 0===D?"checkbox":D,T=k(F,B),x=r.getWidget(a,O,S);if(Array.isArray(a.oneOf))t=r.optionsList({oneOf:a.oneOf.map((function(e){if(y.default(e))return C({},e,{title:e.title||(!0===e.const?"Yes":"No")})})).filter((function(e){return e}))});else{var N,A=a,w=null!=(N=a.enum)?N:[!0,!1];t=!A.enumNames&&2===w.length&&w.every((function(e){return"boolean"==typeof e}))?[{value:w[0],label:w[0]?"Yes":"No"},{value:w[1],label:w[1]?"Yes":"No"}]:r.optionsList({enum:w,enumNames:A.enumNames})}return f.default.createElement(x,{options:C({},T,{enumOptions:t}),schema:a,uiSchema:n,id:o.$id,onChange:p,onFocus:h,onBlur:v,label:void 0===E?i:E,value:l,required:d,disabled:u,readonly:c,registry:s,formContext:b,autofocus:m,rawErrors:g})}var P=["widget","placeholder","autofocus","autocomplete"],q=function(e){function t(t){var r;(r=e.call(this,t)||this).onOptionChange=function(e){var t=r.state.selectedOption,a=r.props,i=a.formData,n=a.onChange,o=a.options,l=a.registry.schemaUtils,s=void 0!==e?parseInt(e,10):-1;if(s!==t){var d=s>=0?l.retrieveSchema(o[s],i):void 0,u=t>=0?l.retrieveSchema(o[t],i):void 0,c=l.sanitizeDataForNewSchema(d,u,i);c&&d&&(c=l.getDefaultFormState(d,c,"excludeObjectChildren")),n(c,void 0,r.getFieldId()),r.setState({selectedOption:s})}};var a=r.props;return r.state={selectedOption:r.getMatchingOption(0,a.formData,a.options)},r}F(t,e);var a=t.prototype;return a.componentDidUpdate=function(e,t){var a=this.props,i=a.formData,n=a.options,o=a.idSchema,l=this.state.selectedOption;if(!r.deepEquals(i,e.formData)&&o.$id===e.idSchema.$id){var s=this.getMatchingOption(l,i,n);if(!t||s===l)return;this.setState({selectedOption:s})}},a.getMatchingOption=function(e,t,r){var a=this.props.registry.schemaUtils.getClosestMatchingOption(t,r,e);return a>0?a:e||0},a.getFieldId=function(){var e=this.props;return e.idSchema.$id+(e.schema.oneOf?"__oneof_select":"__anyof_select")},a.render=function(){var e,t=this.props,a=t.baseType,i=t.disabled,n=void 0!==i&&i,o=t.errorSchema,l=void 0===o?{}:o,s=t.formContext,d=t.onBlur,u=t.onFocus,c=t.options,m=t.registry,v=m.widgets,y=m.fields.SchemaField,g=this.state.selectedOption,S=r.getUiOptions(t.uiSchema),b=S.widget,F=void 0===b?"select":b,D=S.placeholder,O=S.autofocus,T=S.autocomplete,x=k(S,P),N=r.getWidget({type:"number"},F,v),A=p.default(l,r.ERRORS_KEY,[]),w=E.default(l,[r.ERRORS_KEY]),I=c[g]||null;I&&(e=I.type?I:Object.assign({},I,{type:a}));var B=c.map((function(e,t){return{label:e.title||"Option "+(t+1),value:t}}));return f.default.createElement("div",{className:"panel panel-default panel-body"},f.default.createElement("div",{className:"form-group"},f.default.createElement(N,{id:this.getFieldId(),schema:{type:"number",default:0},onChange:this.onOptionChange,onBlur:d,onFocus:u,disabled:n||h.default(B),multiple:!1,rawErrors:A,errorSchema:w,value:g,options:C({enumOptions:B},x),registry:m,formContext:s,placeholder:D,autocomplete:T,autofocus:O,label:""})),null!==I&&f.default.createElement(y,C({},this.props,{schema:e})))},t}(t.Component),R=/\.([0-9]*0)*$/,_=/[0.]0*$/;function j(e){var a=e.registry,i=e.onChange,n=e.formData,o=t.useState(e.value),l=o[0],s=o[1],d=a.fields.StringField,u=n,c=t.useCallback((function(e){s(e),"."===(""+e).charAt(0)&&(e="0"+e);var t="string"==typeof e&&e.match(R)?r.asNumber(e.replace(_,"")):r.asNumber(e);i(t)}),[i]);if("string"==typeof l&&"number"==typeof u){var m=new RegExp((""+u).replace(".","\\.")+"\\.?0*$");l.match(m)&&(u=l)}return f.default.createElement(d,C({},e,{formData:u,onChange:c}))}var V=function(e){function t(){for(var t,a=arguments.length,i=new Array(a),n=0;n<a;n++)i[n]=arguments[n];return(t=e.call.apply(e,[this].concat(i))||this).state={wasPropertyKeyModified:!1,additionalProperties:{}},t.onPropertyChange=function(e,r){return void 0===r&&(r=!1),function(a,i,n){var o,l,s=t.props,d=s.errorSchema;void 0===a&&r&&(a=""),(0,s.onChange)(C({},s.formData,((o={})[e]=a,o)),d&&d&&C({},d,((l={})[e]=i,l)),n)}},t.onDropPropertyClick=function(e){return function(r){r.preventDefault();var a=t.props,i=a.onChange,n=C({},a.formData);b.default(n,e),i(n)}},t.getAvailableKey=function(e,a){for(var i=r.getUiOptions(t.props.uiSchema).duplicateKeySuffixSeparator,n=void 0===i?"-":i,o=0,l=e;S.default(a,l);)l=""+e+n+ ++o;return l},t.onKeyChange=function(e){return function(r,a){var i,n;if(e!==r){var o=t.props,l=o.formData,s=o.onChange,d=o.errorSchema;r=t.getAvailableKey(r,l);var u=C({},l),c=((i={})[e]=r,i),m=Object.keys(u).map((function(e){var t;return(t={})[c[e]||e]=u[e],t})),f=Object.assign.apply(Object,[{}].concat(m));t.setState({wasPropertyKeyModified:!0}),s(f,d&&d&&C({},d,((n={})[r]=a,n)))}}},t.handleAddClick=function(e){return function(){if(e.additionalProperties){var a=t.props,i=a.formData,n=a.onChange,o=a.registry,l=C({},i),s=void 0;if(y.default(e.additionalProperties)){s=e.additionalProperties.type;var d=e.additionalProperties;r.REF_KEY in d&&(s=(d=o.schemaUtils.retrieveSchema({$ref:d[r.REF_KEY]},i)).type),s||!(r.ANY_OF_KEY in d)&&!(r.ONE_OF_KEY in d)||(s="object")}var u=t.getAvailableKey("newKey",l);g.default(l,u,t.getDefaultValue(s)),n(l)}}},t}F(t,e);var a=t.prototype;return a.isRequired=function(e){var t=this.props.schema;return Array.isArray(t.required)&&-1!==t.required.indexOf(e)},a.getDefaultValue=function(e){switch(e){case"string":default:return"New Value";case"array":return[];case"boolean":return!1;case"null":return null;case"number":return 0;case"object":return{}}},a.render=function(){var e,t=this,a=this.props,i=a.uiSchema,n=void 0===i?{}:i,o=a.formData,l=a.errorSchema,s=a.idSchema,d=a.name,u=a.required,c=void 0!==u&&u,m=a.disabled,h=void 0!==m&&m,v=a.readonly,y=void 0!==v&&v,g=a.hideError,E=a.idPrefix,b=a.idSeparator,F=a.onBlur,D=a.onFocus,k=a.registry,O=k.formContext,T=k.fields.SchemaField,x=k.schemaUtils.retrieveSchema(a.schema,o),N=r.getUiOptions(n),A=x.properties,w=void 0===A?{}:A,I=void 0===x.title?d:x.title,B=N.description||x.description;try{var U=Object.keys(w);e=r.orderProperties(U,N.order)}catch(e){return f.default.createElement("div",null,f.default.createElement("p",{className:"config-error",style:{color:"red"}},"Invalid ",d||"root"," object field configuration:",f.default.createElement("em",null,e.message),"."),f.default.createElement("pre",null,JSON.stringify(x)))}var P=r.getTemplate("ObjectFieldTemplate",k,N),q={title:N.title||I,description:B,properties:e.map((function(e){var a=S.default(x,[r.PROPERTIES_KEY,e,r.ADDITIONAL_PROPERTY_FLAG]),i=a?n.additionalProperties:n[e],d="hidden"===r.getUiOptions(i).widget,u=p.default(s,[e],{});return{content:f.default.createElement(T,{key:e,name:e,required:t.isRequired(e),schema:p.default(x,[r.PROPERTIES_KEY,e],{}),uiSchema:i,errorSchema:p.default(l,e),idSchema:u,idPrefix:E,idSeparator:b,formData:p.default(o,e),formContext:O,wasPropertyKeyModified:t.state.wasPropertyKeyModified,onKeyChange:t.onKeyChange(e),onChange:t.onPropertyChange(e,a),onBlur:F,onFocus:D,registry:k,disabled:h,readonly:y,hideError:g,onDropPropertyClick:t.onDropPropertyClick}),name:e,readonly:y,disabled:h,required:c,hidden:d}})),readonly:y,disabled:h,required:c,idSchema:s,uiSchema:n,schema:x,formData:o,formContext:O,registry:k};return f.default.createElement(P,C({},q,{onAddClick:this.handleAddClick}))},t}(t.Component),K=["__errors"],M={array:"ArrayField",boolean:"BooleanField",integer:"NumberField",number:"NumberField",object:"ObjectField",string:"StringField",null:"NullField"};function W(e){var t=e.schema,a=e.idSchema,i=e.uiSchema,n=e.formData,o=e.errorSchema,l=e.idPrefix,s=e.idSeparator,d=e.name,u=e.onChange,c=e.onKeyChange,m=e.onDropPropertyClick,p=e.required,h=e.registry,v=e.wasPropertyKeyModified,g=void 0!==v&&v,S=h.formContext,b=h.schemaUtils,F=r.getUiOptions(i),D=r.getTemplate("FieldTemplate",h,F),O=r.getTemplate("DescriptionFieldTemplate",h,F),T=r.getTemplate("FieldHelpTemplate",h,F),x=r.getTemplate("FieldErrorTemplate",h,F),N=b.retrieveSchema(t,n),A=a[r.ID_KEY],w=r.mergeObjects(b.toIdSchema(N,A,n,l,s),a),I=f.default.useCallback((function(e,t,r){return u(e,t,r||A)}),[A,u]),B=function(e,t,a,i){var n=t.field,o=i.fields;if("function"==typeof n)return n;if("string"==typeof n&&n in o)return o[n];var l=r.getSchemaType(e),s=Array.isArray(l)?l[0]:l||"",d=M[s];return d||!e.anyOf&&!e.oneOf?d in o?o[d]:function(){var n=r.getTemplate("UnsupportedFieldTemplate",i,t);return f.default.createElement(n,{schema:e,idSchema:a,reason:"Unknown field type "+e.type,registry:i})}:function(){return null}}(N,F,w,h),U=Boolean(e.disabled||F.disabled),P=Boolean(e.readonly||F.readonly||e.schema.readOnly||N.readOnly),q=F.hideError,R=void 0===q?e.hideError:Boolean(q),_=Boolean(e.autofocus||F.autofocus);if(0===Object.keys(N).length)return null;var j=b.getDisplayLabel(N,i),V=o||{},W=V.__errors,L=k(V,K),Y=E.default(i,["ui:classNames","classNames","ui:style"]);r.UI_OPTIONS_KEY in Y&&(Y[r.UI_OPTIONS_KEY]=E.default(Y[r.UI_OPTIONS_KEY],["classNames","style"]));var $,z=f.default.createElement(B,C({},e,{onChange:I,idSchema:w,schema:N,uiSchema:Y,disabled:U,readonly:P,hideError:R,autofocus:_,errorSchema:L,formContext:S,rawErrors:W})),J=w[r.ID_KEY];$=g||r.ADDITIONAL_PROPERTY_FLAG in N?d:F.title||e.schema.title||N.title||d;var H=F.description||e.schema.description||N.description||"",G=F.help,Q="hidden"===F.widget,X=["form-group","field","field-"+N.type];!R&&W&&W.length>0&&X.push("field-error has-error has-danger"),null!=i&&i.classNames&&X.push(i.classNames),F.classNames&&X.push(F.classNames);var Z=f.default.createElement(T,{help:G,idSchema:w,schema:N,uiSchema:i,hasErrors:!R&&W&&W.length>0,registry:h}),ee=R?void 0:f.default.createElement(x,{errors:W,errorSchema:o,idSchema:w,schema:N,uiSchema:i,registry:h}),te={description:f.default.createElement(O,{id:r.descriptionId(J),description:H,schema:N,uiSchema:i,registry:h}),rawDescription:H,help:Z,rawHelp:"string"==typeof G?G:void 0,errors:ee,rawErrors:R?void 0:W,id:J,label:$,hidden:Q,onChange:u,onKeyChange:c,onDropPropertyClick:m,required:p,disabled:U,readonly:P,hideError:R,displayLabel:j,classNames:X.join(" ").trim(),style:F.style,formContext:S,formData:n,schema:N,uiSchema:i,registry:h},re=h.fields.AnyOfField,ae=h.fields.OneOfField;return f.default.createElement(D,C({},te),f.default.createElement(f.default.Fragment,null,z,N.anyOf&&!(null!=i&&i["ui:field"])&&!b.isSelect(N)&&f.default.createElement(re,{name:d,disabled:U,readonly:P,hideError:R,errorSchema:o,formData:n,formContext:S,idPrefix:l,idSchema:w,idSeparator:s,onBlur:e.onBlur,onChange:e.onChange,onFocus:e.onFocus,options:N.anyOf.map((function(e){return b.retrieveSchema(y.default(e)?e:{},n)})),baseType:N.type,registry:h,schema:N,uiSchema:i}),N.oneOf&&!(null!=i&&i["ui:field"])&&!b.isSelect(N)&&f.default.createElement(ae,{name:d,disabled:U,readonly:P,hideError:R,errorSchema:o,formData:n,formContext:S,idPrefix:l,idSchema:w,idSeparator:s,onBlur:e.onBlur,onChange:e.onChange,onFocus:e.onFocus,options:N.oneOf.map((function(e){return b.retrieveSchema(y.default(e)?e:{},n)})),baseType:N.type,registry:h,schema:N,uiSchema:i})))}var L=function(e){function t(){return e.apply(this,arguments)||this}F(t,e);var a=t.prototype;return a.shouldComponentUpdate=function(e){return!r.deepEquals(this.props,e)},a.render=function(){return f.default.createElement(W,C({},this.props))},t}(f.default.Component),Y=["widget","placeholder"];function $(e){var t=e.schema,a=e.name,i=e.uiSchema,n=e.idSchema,o=e.formData,l=e.required,s=e.disabled,d=void 0!==s&&s,u=e.readonly,c=void 0!==u&&u,m=e.autofocus,p=void 0!==m&&m,h=e.onChange,v=e.onBlur,y=e.onFocus,g=e.registry,E=e.rawErrors,S=t.title,b=t.format,F=g.widgets,D=g.formContext,O=g.schemaUtils.isSelect(t)?r.optionsList(t):void 0,T=O?"select":"text";b&&r.hasWidget(t,b,F)&&(T=b);var x=r.getUiOptions(i),N=x.widget,A=void 0===N?T:N,w=x.placeholder,I=void 0===w?"":w,B=k(x,Y),U=r.getWidget(t,A,F);return f.default.createElement(U,{options:C({},B,{enumOptions:O}),schema:t,uiSchema:i,id:n.$id,label:void 0===S?a:S,value:o,onChange:h,onBlur:v,onFocus:y,required:l,disabled:d,readonly:c,formContext:D,autofocus:p,registry:g,placeholder:I,rawErrors:E})}function z(e){var r=e.formData,a=e.onChange;return t.useEffect((function(){void 0===r&&a(null)}),[r,a]),null}function J(e){var t=e.idSchema,a=e.description,i=e.registry,n=e.schema,o=e.uiSchema,l=r.getUiOptions(o),s=l.label;if(!a||void 0!==s&&!s)return null;var d=r.getTemplate("DescriptionFieldTemplate",i,l);return f.default.createElement(d,{id:r.descriptionId(t),description:a,schema:n,uiSchema:o,registry:i})}function H(e){var t=e.disabled,r=e.hasToolbar,a=e.hasMoveDown,i=e.hasMoveUp,n=e.hasRemove,o=e.index,l=e.onDropIndexClick,s=e.onReorderClick,d=e.readonly,u=e.registry,c=e.uiSchema,m=u.templates.ButtonTemplates,p=m.MoveDownButton,h=m.MoveUpButton,v=m.RemoveButton,y={flex:1,paddingLeft:6,paddingRight:6,fontWeight:"bold"};return f.default.createElement("div",{className:e.className},f.default.createElement("div",{className:r?"col-xs-9":"col-xs-12"},e.children),r&&f.default.createElement("div",{className:"col-xs-3 array-item-toolbox"},f.default.createElement("div",{className:"btn-group",style:{display:"flex",justifyContent:"space-around"}},(i||a)&&f.default.createElement(h,{style:y,disabled:t||d||!i,onClick:s(o,o-1),uiSchema:c,registry:u}),(i||a)&&f.default.createElement(p,{style:y,disabled:t||d||!a,onClick:s(o,o+1),uiSchema:c,registry:u}),n&&f.default.createElement(v,{style:y,disabled:t||d,onClick:l(o),uiSchema:c,registry:u}))))}var G=["key"];function Q(e){var t=e.canAdd,a=e.className,i=e.disabled,n=e.idSchema,o=e.uiSchema,l=e.items,s=e.onAddClick,d=e.readonly,u=e.registry,c=e.required,m=e.schema,p=e.title,h=r.getUiOptions(o),v=r.getTemplate("ArrayFieldDescriptionTemplate",u,h),y=r.getTemplate("ArrayFieldItemTemplate",u,h),g=r.getTemplate("ArrayFieldTitleTemplate",u,h),E=u.templates.ButtonTemplates.AddButton;return f.default.createElement("fieldset",{className:a,id:n.$id},f.default.createElement(g,{idSchema:n,title:h.title||p,required:c,schema:m,uiSchema:o,registry:u}),f.default.createElement(v,{idSchema:n,description:h.description||m.description,schema:m,uiSchema:o,registry:u}),f.default.createElement("div",{className:"row array-item-list"},l&&l.map((function(e){var t=e.key,r=k(e,G);return f.default.createElement(y,C({key:t},r))}))),t&&f.default.createElement(E,{className:"array-item-add",onClick:s,disabled:i||d,uiSchema:o,registry:u}))}function X(e){var t=e.idSchema,a=e.title,i=e.schema,n=e.uiSchema,o=e.required,l=e.registry,s=r.getUiOptions(n),d=s.label;if(!a||void 0!==d&&!d)return null;var u=r.getTemplate("TitleFieldTemplate",l,s);return f.default.createElement(u,{id:r.titleId(t),title:a,required:o,schema:i,uiSchema:n,registry:l})}var Z=["id","value","readonly","disabled","autofocus","onBlur","onFocus","onChange","options","schema","uiSchema","formContext","registry","rawErrors","type"];function ee(e){var a=e.id,i=e.value,n=e.readonly,o=e.disabled,l=e.autofocus,s=e.onBlur,d=e.onFocus,u=e.onChange,c=e.options,m=e.schema,p=e.type,h=k(e,Z);if(!a)throw console.log("No id for",e),new Error("no id for props "+JSON.stringify(e));var v,y=C({},h,r.getInputProps(m,p,c));v="number"===y.type||"integer"===y.type?i||0===i?i:"":null==i?"":i;var g=t.useCallback((function(e){var t=e.target.value;return u(""===t?c.emptyValue:t)}),[u,c]),E=t.useCallback((function(e){return s(a,e.target.value)}),[s,a]),S=t.useCallback((function(e){return d(a,e.target.value)}),[d,a]);return f.default.createElement(f.default.Fragment,null,f.default.createElement("input",C({id:a,name:a,className:"form-control",readOnly:n,disabled:o,autoFocus:l,value:v},y,{list:m.examples?r.examplesId(a):void 0,onChange:g,onBlur:E,onFocus:S,"aria-describedby":r.ariaDescribedByIds(a,!!m.examples)})),Array.isArray(m.examples)&&f.default.createElement("datalist",{key:"datalist_"+a,id:r.examplesId(a)},[].concat(new Set(m.examples.concat(m.default?[m.default]:[]))).map((function(e){return f.default.createElement("option",{key:e,value:e})}))))}function te(e){var t=r.getSubmitButtonOptions(e.uiSchema),a=t.submitText,i=t.props,n=void 0===i?{}:i;return t.norender?null:f.default.createElement("div",null,f.default.createElement("button",C({type:"submit"},n,{className:"btn btn-info "+n.className}),a))}var re=["iconType","icon","className","uiSchema","registry"];function ae(e){var t=e.iconType,r=void 0===t?"default":t,a=e.icon,i=e.className,n=k(e,re);return f.default.createElement("button",C({type:"button",className:"btn btn-"+r+" "+i},n),f.default.createElement("i",{className:"glyphicon glyphicon-"+a}))}function ie(e){return f.default.createElement(ae,C({title:"Move down",className:"array-item-move-down"},e,{icon:"arrow-down"}))}function ne(e){return f.default.createElement(ae,C({title:"Move up",className:"array-item-move-up"},e,{icon:"arrow-up"}))}function oe(e){return f.default.createElement(ae,C({title:"Remove",className:"array-item-remove"},e,{iconType:"danger",icon:"remove"}))}function le(e){return f.default.createElement("div",{className:"row"},f.default.createElement("p",{className:"col-xs-3 col-xs-offset-9 text-right "+e.className},f.default.createElement(ae,{iconType:"info",icon:"plus",className:"btn-add col-xs-12",title:"Add",onClick:e.onClick,disabled:e.disabled,registry:e.registry})))}function se(e){var t=e.description;return t?f.default.createElement("string"==typeof t?"p":"div",{id:e.id,className:"field-description"},t):null}function de(e){var t=e.errors;return f.default.createElement("div",{className:"panel panel-danger errors"},f.default.createElement("div",{className:"panel-heading"},f.default.createElement("h3",{className:"panel-title"},"Errors")),f.default.createElement("ul",{className:"list-group"},t.map((function(e,t){return f.default.createElement("li",{key:t,className:"list-group-item text-danger"},e.stack)}))))}function ue(e){var t=e.label;return t?f.default.createElement("label",{className:"control-label",htmlFor:e.id},t,e.required&&f.default.createElement("span",{className:"required"},"*")):null}function ce(e){var t=e.id,a=e.label,i=e.children,n=e.errors,o=e.help,l=e.description,s=e.hidden,d=e.required,u=e.displayLabel,c=e.registry,m=r.getUiOptions(e.uiSchema),p=r.getTemplate("WrapIfAdditionalTemplate",c,m);return s?f.default.createElement("div",{className:"hidden"},i):f.default.createElement(p,C({},e),u&&f.default.createElement(ue,{label:a,required:d,id:t}),u&&l?l:null,i,n,o)}function me(e){var t=e.errors,a=void 0===t?[]:t;if(0===a.length)return null;var i=r.errorId(e.idSchema);return f.default.createElement("div",null,f.default.createElement("ul",{id:i,className:"error-detail bs-callout bs-callout-info"},a.filter((function(e){return!!e})).map((function(e,t){return f.default.createElement("li",{className:"text-danger",key:t},e)}))))}function fe(e){var t=e.help;if(!t)return null;var a=r.helpId(e.idSchema);return f.default.createElement("string"==typeof t?"p":"div",{id:a,className:"help-block"},t)}function pe(e){var t=e.description,a=e.disabled,i=e.formData,n=e.idSchema,o=e.onAddClick,l=e.properties,s=e.readonly,d=e.registry,u=e.required,c=e.schema,m=e.title,p=e.uiSchema,h=r.getUiOptions(p),v=r.getTemplate("TitleFieldTemplate",d,h),y=r.getTemplate("DescriptionFieldTemplate",d,h),g=d.templates.ButtonTemplates.AddButton;return f.default.createElement("fieldset",{id:n.$id},(h.title||m)&&f.default.createElement(v,{id:r.titleId(n),title:h.title||m,required:u,schema:c,uiSchema:p,registry:d}),(h.description||t)&&f.default.createElement(y,{id:r.descriptionId(n),description:h.description||t,schema:c,uiSchema:p,registry:d}),l.map((function(e){return e.content})),r.canExpand(c,p,i)&&f.default.createElement(g,{className:"object-property-expand",onClick:o(c),disabled:a||s,uiSchema:p,registry:d}))}function he(e){return f.default.createElement("legend",{id:e.id},e.title,e.required&&f.default.createElement("span",{className:"required"},"*"))}function ve(e){var t=e.schema,r=e.idSchema,a=e.reason;return f.default.createElement("div",{className:"unsupported-field"},f.default.createElement("p",null,"Unsupported field schema",r&&r.$id&&f.default.createElement("span",null," for"," field ",f.default.createElement("code",null,r.$id)),a&&f.default.createElement("em",null,": ",a),"."),t&&f.default.createElement("pre",null,JSON.stringify(t,null,2)))}function ye(e){var t=e.id,a=e.disabled,i=e.label,n=e.onKeyChange,o=e.onDropPropertyClick,l=e.readonly,s=e.children,d=e.uiSchema,u=e.registry,c=u.templates.ButtonTemplates.RemoveButton;return f.default.createElement("div",{className:e.classNames,style:e.style},r.ADDITIONAL_PROPERTY_FLAG in e.schema?f.default.createElement("div",{className:"row"},f.default.createElement("div",{className:"col-xs-5 form-additional"},f.default.createElement("div",{className:"form-group"},f.default.createElement(ue,{label:i+" Key",required:e.required,id:t+"-key"}),f.default.createElement("input",{className:"form-control",type:"text",id:t+"-key",onBlur:function(e){return n(e.target.value)},defaultValue:i}))),f.default.createElement("div",{className:"form-additional form-group col-xs-5"},s),f.default.createElement("div",{className:"col-xs-2"},f.default.createElement(c,{className:"array-item-remove btn-block",style:{border:"0"},disabled:a||l,onClick:o(i),uiSchema:d,registry:u}))):s)}function ge(e,t){for(var a=[],i=e;i<=t;i++)a.push({value:i,label:r.pad(i,2)});return a}function Ee(e){var t=e.type,a=e.range,i=e.value,n=e.select,o=e.rootId,l=e.disabled,s=e.readonly,d=e.autofocus,u=e.registry,c=e.onBlur,m=e.onFocus;return f.default.createElement(u.widgets.SelectWidget,{schema:{type:"integer"},id:o+"_"+t,className:"form-control",options:{enumOptions:ge(a[0],a[1])},placeholder:t,value:i,disabled:l,readonly:s,autofocus:d,onChange:function(e){return n(t,e)},onBlur:c,onFocus:m,registry:u,label:"","aria-describedby":r.ariaDescribedByIds(o)})}function Se(e){var a=e.time,i=void 0!==a&&a,n=e.disabled,o=void 0!==n&&n,l=e.readonly,s=void 0!==l&&l,d=e.autofocus,u=void 0!==d&&d,c=e.options,m=e.id,p=e.registry,h=e.onBlur,v=e.onFocus,y=e.onChange,g=e.value,E=t.useReducer((function(e,t){return C({},e,t)}),r.parseDateString(g,i)),S=E[0],b=E[1];t.useEffect((function(){g&&g!==r.toDateString(S,i)&&b(r.parseDateString(g,i))}),[g,S,i]),t.useEffect((function(){(function(e){return Object.values(e).every((function(e){return-1!==e}))})(S)&&y(r.toDateString(S,i))}),[S,i,y]);var F=t.useCallback((function(e,t){var r;b(((r={})[e]=t,r))}),[]),D=t.useCallback((function(e){if(e.preventDefault(),!o&&!s){var t=r.parseDateString((new Date).toJSON(),i);b(t)}}),[o,s,i]),k=t.useCallback((function(e){e.preventDefault(),o||s||(b(r.parseDateString("",i)),y(void 0))}),[o,s,i,y]);return f.default.createElement("ul",{className:"list-inline"},function(e,t,r){void 0===r&&(r=[1900,(new Date).getFullYear()+2]);var a=[{type:"year",range:r,value:e.year},{type:"month",range:[1,12],value:e.month},{type:"day",range:[1,31],value:e.day}];return t&&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}(S,i,c.yearsRange).map((function(e,t){return f.default.createElement("li",{key:t},f.default.createElement(Ee,C({rootId:m,select:F},e,{disabled:o,readonly:s,registry:p,onBlur:h,onFocus:v,autofocus:u&&0===t})))})),("undefined"===c.hideNowButton||!c.hideNowButton)&&f.default.createElement("li",null,f.default.createElement("a",{href:"#",className:"btn btn-info btn-now",onClick:D},"Now")),("undefined"===c.hideClearButton||!c.hideClearButton)&&f.default.createElement("li",null,f.default.createElement("a",{href:"#",className:"btn btn-warning btn-clear",onClick:k},"Clear")))}var be=["time"];function Ce(e){var t=e.time,r=void 0===t||t,a=k(e,be);return f.default.createElement(a.registry.widgets.AltDateWidget,C({time:r},a))}function Fe(e){var a=e.schema,i=e.uiSchema,n=e.id,o=e.value,l=e.disabled,s=e.readonly,d=e.label,u=e.autofocus,c=void 0!==u&&u,m=e.onBlur,p=e.onFocus,h=e.onChange,v=e.registry,y=r.getTemplate("DescriptionFieldTemplate",v,e.options),g=r.schemaRequiresTrueValue(a),E=t.useCallback((function(e){return h(e.target.checked)}),[h]),S=t.useCallback((function(e){return m(n,e.target.checked)}),[m,n]),b=t.useCallback((function(e){return p(n,e.target.checked)}),[p,n]);return f.default.createElement("div",{className:"checkbox "+(l||s?"disabled":"")},a.description&&f.default.createElement(y,{id:r.descriptionId(n),description:a.description,schema:a,uiSchema:i,registry:v}),f.default.createElement("label",null,f.default.createElement("input",{type:"checkbox",id:n,name:n,checked:void 0!==o&&o,required:g,disabled:l||s,autoFocus:c,onChange:E,onBlur:S,onFocus:b,"aria-describedby":r.ariaDescribedByIds(n)}),f.default.createElement("span",null,d)))}function De(e){var t=e.id,a=e.disabled,i=e.options,n=i.inline,o=void 0!==n&&n,l=i.enumOptions,s=i.enumDisabled,d=e.value,u=e.autofocus,c=void 0!==u&&u,m=e.readonly,p=e.onChange,h=Array.isArray(d)?d:[d];return f.default.createElement("div",{className:"checkboxes",id:t},Array.isArray(l)&&l.map((function(e,i){var n=h.includes(e.value),d=Array.isArray(s)&&-1!=s.indexOf(e.value),u=a||d||m?"disabled":"",v=f.default.createElement("span",null,f.default.createElement("input",{type:"checkbox",id:r.optionId(t,e),name:t,checked:n,disabled:a||d||m,autoFocus:c&&0===i,onChange:function(t){p(t.target.checked?r.enumOptionsSelectValue(e.value,h,l):r.enumOptionsDeselectValue(e.value,h))},"aria-describedby":r.ariaDescribedByIds(t)}),f.default.createElement("span",null,e.label));return o?f.default.createElement("label",{key:e.value,className:"checkbox-inline "+u},v):f.default.createElement("div",{key:e.value,className:"checkbox "+u},f.default.createElement("label",null,v))})))}function ke(e){var t=e.disabled,a=e.readonly,i=r.getTemplate("BaseInputTemplate",e.registry,e.options);return f.default.createElement(i,C({type:"color"},e,{disabled:t||a}))}function Oe(e){var a=e.onChange,i=r.getTemplate("BaseInputTemplate",e.registry,e.options),n=t.useCallback((function(e){return a(e||void 0)}),[a]);return f.default.createElement(i,C({type:"date"},e,{onChange:n}))}function Te(e){var t=e.onChange,a=e.value,i=r.getTemplate("BaseInputTemplate",e.registry,e.options);return f.default.createElement(i,C({type:"datetime-local"},e,{value:r.utcToLocal(a),onChange:function(e){return t(r.localToUTC(e))}}))}function xe(e){var t=r.getTemplate("BaseInputTemplate",e.registry,e.options);return f.default.createElement(t,C({type:"email"},e))}function Ne(e,t){return null===e?null:e.replace(";base64",";name="+encodeURIComponent(t)+";base64")}function Ae(e){var t=e.name,r=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:Ne(e.target.result,t),name:t,size:r,type:a}):i({dataURL:null,name:t,size:r,type:a})},o.readAsDataURL(e)}))}function we(e){var t=e.filesInfo;return 0===t.length?null:f.default.createElement("ul",{className:"file-info"},t.map((function(e,t){var r=e.size,a=e.type;return f.default.createElement("li",{key:t},f.default.createElement("strong",null,e.name)," (",a,", ",r," bytes)")})))}function Ie(e){return e.filter((function(e){return void 0!==e})).map((function(e){var t=r.dataURItoBlob(e),a=t.blob;return{name:t.name,size:a.size,type:a.type}}))}function Be(e){var a=e.multiple,i=e.id,n=e.readonly,o=e.disabled,l=e.onChange,s=e.value,d=e.autofocus,u=void 0!==d&&d,c=e.options,m=t.useMemo((function(){return Array.isArray(s)?Ie(s):Ie([s])}),[s]),p=t.useState(m),h=p[0],v=p[1],y=t.useCallback((function(e){var t;e.target.files&&(t=e.target.files,Promise.all(Array.from(t).map(Ae))).then((function(e){v(e);var t=e.map((function(e){return e.dataURL}));l(a?t:t[0])}))}),[a,l]);return f.default.createElement("div",null,f.default.createElement("p",null,f.default.createElement("input",{id:i,name:i,type:"file",disabled:n||o,onChange:y,defaultValue:"",autoFocus:u,multiple:a,accept:c.accept?String(c.accept):void 0,"aria-describedby":r.ariaDescribedByIds(i)})),f.default.createElement(we,{filesInfo:h}))}function Ue(e){var t=e.id,r=e.value;return f.default.createElement("input",{type:"hidden",id:t,name:t,value:void 0===r?"":r})}function Pe(e){var t=r.getTemplate("BaseInputTemplate",e.registry,e.options);return f.default.createElement(t,C({type:"password"},e))}function qe(e){var a=e.options,i=e.value,n=e.required,o=e.disabled,l=e.readonly,s=e.autofocus,d=void 0!==s&&s,u=e.onBlur,c=e.onFocus,m=e.onChange,p=e.id,h=Math.random().toString(),v=a.enumOptions,y=a.enumDisabled,g=a.inline,E=t.useCallback((function(e){return u(p,e.target.value)}),[u,p]),S=t.useCallback((function(e){return c(p,e.target.value)}),[c,p]);return f.default.createElement("div",{className:"field-radio-group",id:p},Array.isArray(v)&&v.map((function(e,t){var a=e.value===i,s=Array.isArray(y)&&-1!=y.indexOf(e.value),u=o||s||l?"disabled":"",c=f.default.createElement("span",null,f.default.createElement("input",{type:"radio",id:r.optionId(p,e),checked:a,name:h,required:n,value:e.value,disabled:o||s||l,autoFocus:d&&0===t,onChange:function(){return m(e.value)},onBlur:E,onFocus:S,"aria-describedby":r.ariaDescribedByIds(p)}),f.default.createElement("span",null,e.label));return g?f.default.createElement("label",{key:e.value,className:"radio-inline "+u},c):f.default.createElement("div",{key:e.value,className:"radio "+u},f.default.createElement("label",null,c))})))}function Re(e){var t=e.value;return f.default.createElement("div",{className:"field-range-wrapper"},f.default.createElement(e.registry.templates.BaseInputTemplate,C({type:"range"},e)),f.default.createElement("span",{className:"range-view"},t))}function _e(e,t){return t?Array.from(e.target.options).slice().filter((function(e){return e.selected})).map((function(e){return e.value})):e.target.value}function je(e){var a=e.schema,i=e.id,n=e.options,o=e.value,l=e.required,s=e.disabled,d=e.readonly,u=e.multiple,c=void 0!==u&&u,m=e.autofocus,p=void 0!==m&&m,h=e.onChange,v=e.onBlur,y=e.onFocus,g=e.placeholder,E=n.enumOptions,S=n.enumDisabled,b=c?[]:"",C=t.useCallback((function(e){var t=_e(e,c);return y(i,r.processSelectValue(a,t,n))}),[y,i,a,c,n]),F=t.useCallback((function(e){var t=_e(e,c);return v(i,r.processSelectValue(a,t,n))}),[v,i,a,c,n]),D=t.useCallback((function(e){var t=_e(e,c);return h(r.processSelectValue(a,t,n))}),[h,a,c,n]);return f.default.createElement("select",{id:i,name:i,multiple:c,className:"form-control",value:void 0===o?b:o,required:l,disabled:s||d,autoFocus:p,onBlur:F,onFocus:C,onChange:D,"aria-describedby":r.ariaDescribedByIds(i)},!c&&void 0===a.default&&f.default.createElement("option",{value:""},g),Array.isArray(E)&&E.map((function(e,t){var r=e.value,a=e.label,i=S&&-1!=S.indexOf(r);return f.default.createElement("option",{key:t,value:r,disabled:i},a)})))}function Ve(e){var a=e.id,i=e.options,n=void 0===i?{}:i,o=e.placeholder,l=e.value,s=e.required,d=e.disabled,u=e.readonly,c=e.autofocus,m=void 0!==c&&c,p=e.onChange,h=e.onBlur,v=e.onFocus,y=t.useCallback((function(e){var t=e.target.value;return p(""===t?n.emptyValue:t)}),[p,n.emptyValue]),g=t.useCallback((function(e){return h(a,e.target.value)}),[h,a]),E=t.useCallback((function(e){return v(a,e.target.value)}),[a,v]);return f.default.createElement("textarea",{id:a,name:a,className:"form-control",value:l||"",placeholder:o,required:s,disabled:d,readOnly:u,autoFocus:m,rows:n.rows,onBlur:g,onFocus:E,onChange:y,"aria-describedby":r.ariaDescribedByIds(a)})}function Ke(e){var t=r.getTemplate("BaseInputTemplate",e.registry,e.options);return f.default.createElement(t,C({},e))}function Me(e){var t=r.getTemplate("BaseInputTemplate",e.registry,e.options);return f.default.createElement(t,C({type:"url"},e))}function We(e){var t=r.getTemplate("BaseInputTemplate",e.registry,e.options);return f.default.createElement(t,C({type:"number"},e))}function Le(){return{fields:{AnyOfField:q,ArrayField:I,BooleanField:U,NumberField:j,ObjectField:V,OneOfField:q,SchemaField:L,StringField:$,NullField:z},templates:{ArrayFieldDescriptionTemplate:J,ArrayFieldItemTemplate:H,ArrayFieldTemplate:Q,ArrayFieldTitleTemplate:X,ButtonTemplates:{SubmitButton:te,AddButton:le,MoveDownButton:ie,MoveUpButton:ne,RemoveButton:oe},BaseInputTemplate:ee,DescriptionFieldTemplate:se,ErrorListTemplate:de,FieldTemplate:ce,FieldErrorTemplate:me,FieldHelpTemplate:fe,ObjectFieldTemplate:pe,TitleFieldTemplate:he,UnsupportedFieldTemplate:ve,WrapIfAdditionalTemplate:ye},widgets:{PasswordWidget:Pe,RadioWidget:qe,UpDownWidget:We,RangeWidget:Re,SelectWidget:je,TextWidget:Ke,DateWidget:Oe,DateTimeWidget:Te,AltDateWidget:Se,AltDateTimeWidget:Ce,EmailWidget:xe,URLWidget:Me,TextareaWidget:Ve,HiddenWidget:Ue,ColorWidget:ke,FileWidget:Be,CheckboxWidget:Fe,CheckboxesWidget:De},rootSchema:{},formContext:{}}}Ve.defaultProps={autofocus:!1,options:{}};var Ye=function(e){function t(t){var a;if((a=e.call(this,t)||this).formElement=void 0,a.getUsedFormData=function(e,t){if(0===t.length&&"object"!=typeof e)return e;var r=v.default(e,t);return Array.isArray(e)?Object.keys(r).map((function(e){return r[e]})):r},a.getFieldNames=function(e,t){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 l=n.map((function(e){return[].concat(e,[o])}));a[o][r.RJSF_ADDITONAL_PROPERTIES_FLAG]&&""!==a[o][r.NAME_KEY]?i.push(a[o][r.NAME_KEY]):e(a[o],i,l)}else o===r.NAME_KEY&&""!==a[o]&&n.forEach((function(e){var r=p.default(t,e);("object"!=typeof r||h.default(r))&&i.push(e)}))})),i}(e)},a.onChange=function(e,t,i){var n=a.props,o=n.extraErrors,l=n.omitExtraData,s=n.liveOmit,d=n.noValidate,u=n.liveValidate,c=n.onChange,m=a.state,f=m.schemaUtils,p=m.schema;(r.isObject(e)||Array.isArray(e))&&(e=a.getStateFromProps(a.props,e).formData);var h=!d&&u,v={formData:e,schema:p},y=e;if(!0===l&&!0===s){var g=f.retrieveSchema(p,e),E=f.toPathSchema(g,"",e),S=a.getFieldNames(E,e);y=a.getUsedFormData(e,S),v={formData:y}}if(h){var b=a.validate(y),F=b.errors,D=b.errorSchema,k=F,O=D;if(o){var T=f.mergeValidationData(b,o);D=T.errorSchema,F=T.errors}v={formData:y,errors:F,errorSchema:D,schemaValidationErrors:k,schemaValidationErrorSchema:O}}else if(!d&&t){var x=o?r.mergeObjects(t,o,"preventDuplicates"):t;v={formData:y,errorSchema:x,errors:f.getValidator().toErrorList(x)}}a.setState(v,(function(){return c&&c(C({},a.state,v),i)}))},a.onBlur=function(e,t){var r=a.props.onBlur;r&&r(e,t)},a.onFocus=function(e,t){var r=a.props.onFocus;r&&r(e,t)},a.onSubmit=function(e){if(e.preventDefault(),e.target===e.currentTarget){e.persist();var t=a.props,r=t.extraErrors,i=t.noValidate,n=t.onSubmit,o=a.state.formData,l=a.state,s=l.schemaUtils;if(!0===t.omitExtraData){var d=s.retrieveSchema(l.schema,o),u=s.toPathSchema(d,"",o),c=a.getFieldNames(u,o);o=a.getUsedFormData(o,c)}if(i||a.validateForm()){var m=r||{},f=r?s.getValidator().toErrorList(r):[];a.setState({formData:o,errors:f,errorSchema:m,schemaValidationErrors:[],schemaValidationErrorSchema:{}},(function(){n&&n(C({},a.state,{formData:o,status:"submitted"}),e)}))}}},!t.validator)throw new Error("A validator is required for Form functionality to work");return a.state=a.getStateFromProps(t,t.formData),a.props.onChange&&!r.deepEquals(a.state.formData,a.props.formData)&&a.props.onChange(a.state),a.formElement=f.default.createRef(),a}F(t,e);var a=t.prototype;return a.UNSAFE_componentWillReceiveProps=function(e){var 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)},a.getStateFromProps=function(e,t){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!==t,l=o&&!e.noValidate&&("liveValidate"in e?e.liveValidate:this.props.liveValidate),s=i,d=a.schemaUtils;d&&!d.doesSchemaUtilsDiffer(e.validator,s)||(d=r.createSchemaUtils(e.validator,s));var u,c,m=d.getDefaultFormState(i,t),f=d.retrieveSchema(i,m),p=a.schemaValidationErrors,h=a.schemaValidationErrorSchema;if(l){var v=this.validate(m,i,d);p=u=v.errors,h=c=v.errorSchema}else{var y=e.noValidate?{errors:[],errorSchema:{}}:e.liveValidate?{errors:a.errors||[],errorSchema:a.errorSchema||{}}:{errors:a.schemaValidationErrors||[],errorSchema:a.schemaValidationErrorSchema||{}};u=y.errors,c=y.errorSchema}if(e.extraErrors){var g=d.mergeValidationData({errorSchema:c,errors:u},e.extraErrors);c=g.errorSchema,u=g.errors}var E=d.toIdSchema(f,n["ui:rootFieldId"],m,e.idPrefix,e.idSeparator);return{schemaUtils:d,schema:i,uiSchema:n,idSchema:E,formData:m,edit:o,errors:u,errorSchema:c,schemaValidationErrors:p,schemaValidationErrorSchema:h}},a.shouldComponentUpdate=function(e,t){return r.shouldRender(this,e,t)},a.validate=function(e,t,r){void 0===t&&(t=this.props.schema);var a=r||this.state.schemaUtils,i=this.props,n=i.customValidate,o=i.transformErrors,l=i.uiSchema,s=a.retrieveSchema(t,e);return a.getValidator().validateFormData(e,s,n,o,l)},a.renderErrors=function(e){var t=this.state,a=t.errors,i=t.errorSchema,n=t.schema,o=t.uiSchema,l=this.props.formContext,s=r.getUiOptions(o),d=r.getTemplate("ErrorListTemplate",e,s);return a&&a.length?f.default.createElement(d,{errors:a,errorSchema:i||{},schema:n,uiSchema:o,formContext:l}):null},a.getRegistry=function(){var e,t=this.state.schemaUtils,r=Le(),a=r.templates,i=r.widgets,n=r.formContext;return{fields:C({},r.fields,this.props.fields),templates:C({},a,this.props.templates,{ButtonTemplates:C({},a.ButtonTemplates,null===(e=this.props.templates)||void 0===e?void 0:e.ButtonTemplates)}),widgets:C({},i,this.props.widgets),rootSchema:this.props.schema,formContext:this.props.formContext||n,schemaUtils:t}},a.submit=function(){this.formElement.current&&(this.formElement.current.dispatchEvent(new CustomEvent("submit",{cancelable:!0})),this.formElement.current.requestSubmit())},a.validateForm=function(){var e=this.props,t=e.extraErrors,r=e.onError,a=this.state.schemaUtils,i=this.validate(this.state.formData),n=i.errors,o=i.errorSchema,l=n,s=o;if(n.length>0){if(t){var d=a.mergeValidationData(i,t);o=d.errorSchema,n=d.errors}return this.setState({errors:n,errorSchema:o,schemaValidationErrors:l,schemaValidationErrorSchema:s},(function(){r?r(n):console.error("Form validation failed",n)})),!1}return!0},a.render=function(){var e=this.props,t=e.children,r=e.id,a=e.idPrefix,i=e.idSeparator,n=e.className,o=void 0===n?"":n,l=e.tagName,s=e.name,d=e.method,u=e.target,c=e.action,m=e.autoComplete,p=e.enctype,h=e.acceptcharset,v=e.noHtml5Validate,y=void 0!==v&&v,g=e.disabled,E=void 0!==g&&g,S=e.readonly,b=void 0!==S&&S,C=e.formContext,F=e.showErrorList,D=void 0===F?"top":F,k=e._internalFormWrapper,O=this.state,T=O.schema,x=O.uiSchema,N=O.formData,A=O.errorSchema,w=O.idSchema,I=this.getRegistry(),B=I.fields.SchemaField,U=I.templates.ButtonTemplates.SubmitButton;return f.default.createElement(k||l||"form",{className:o||"rjsf",id:r,name:s,method:d,target:u,action:c,autoComplete:m,encType:p,acceptCharset:h,noValidate:y,onSubmit:this.onSubmit,as:k?l:void 0,ref:this.formElement},"top"===D&&this.renderErrors(I),f.default.createElement(B,{name:"",schema:T,uiSchema:x,errorSchema:A,idSchema:w,idPrefix:a,idSeparator:i,formContext:C,formData:N,onChange:this.onChange,onBlur:this.onBlur,onFocus:this.onFocus,registry:I,disabled:E,readonly:b}),t||f.default.createElement(U,{uiSchema:x,registry:I}),"bottom"===D&&this.renderErrors(I))},t}(t.Component),$e=["fields","widgets","templates"];e.default=Ye,e.getDefaultRegistry=Le,e.withTheme=function(e){return t.forwardRef((function(t,r){var a,i,n=t.fields,o=t.widgets,l=t.templates,s=k(t,$e);return n=C({},null==e?void 0:e.fields,n),o=C({},null==e?void 0:e.widgets,o),l=C({},null==e?void 0:e.templates,l,{ButtonTemplates:C({},null==e||null===(a=e.templates)||void 0===a?void 0:a.ButtonTemplates,null===(i=l)||void 0===i?void 0:i.ButtonTemplates)}),f.default.createElement(Ye,C({},e,s,{fields:n,widgets:o,templates:l,ref:r}))}))},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("@rjsf/utils"),require("lodash-es/get"),require("lodash-es/isEmpty"),require("lodash-es/pick"),require("lodash-es/isObject"),require("lodash-es/set"),require("nanoid"),require("lodash-es/omit"),require("lodash-es/has"),require("lodash-es/unset")):"function"==typeof define&&define.amd?define(["exports","react","@rjsf/utils","lodash-es/get","lodash-es/isEmpty","lodash-es/pick","lodash-es/isObject","lodash-es/set","nanoid","lodash-es/omit","lodash-es/has","lodash-es/unset"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).JSONSchemaForm={},e.React,e.utils,e.get,e.isEmpty,e._pick,e.isObject,e.set,e.nanoid,e.omit,e.has,e.unset)}(this,(function(e,t,r,a,i,n,o,l,s,d,u,c){"use strict";function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=m(t),p=m(a),h=m(i),v=m(n),y=m(o),g=m(l),E=m(d),S=m(u),b=m(c);function C(){return C=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},C.apply(this,arguments)}function F(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,D(e,t)}function D(e,t){return D=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},D(e,t)}function O(e,t){if(null==e)return{};var r,a,i={},n=Object.keys(e);for(a=0;a<n.length;a++)t.indexOf(r=n[a])>=0||(i[r]=e[r]);return i}var k=["widget"],T=["widget"],x=["widget"];function A(){return s.nanoid()}function N(e){return Array.isArray(e)?e.map((function(e){return{key:A(),item:e}})):[]}function w(e){return Array.isArray(e)?e.map((function(e){return e.item})):[]}var I=function(e){function t(t){var a;(a=e.call(this,t)||this)._getNewFormDataRow=function(){var e=a.props,t=e.schema,i=e.registry.schemaUtils,n=t.items;return r.isFixedItems(t)&&r.allowAdditionalItems(t)&&(n=t.additionalItems),i.getDefaultFormState(n)},a.onAddClick=function(e){a._handleAddClick(e)},a.onAddIndexClick=function(e){return function(t){a._handleAddClick(t,e)}},a.onDropIndexClick=function(e){return function(t){t&&t.preventDefault();var r,i=a.props,n=i.onChange,o=i.errorSchema,l=a.state.keyedFormData;if(o)for(var s in r={},o){var d=parseInt(s);d<e?g.default(r,[d],o[s]):d>e&&g.default(r,[d-1],o[s])}var u=l.filter((function(t,r){return r!==e}));a.setState({keyedFormData:u,updatedKeyedFormData:!0},(function(){return n(w(u),r)}))}},a.onReorderClick=function(e,t){return function(r){r&&(r.preventDefault(),r.currentTarget.blur());var i,n=a.props,o=n.onChange,l=n.errorSchema;if(a.props.errorSchema)for(var s in i={},l){var d=parseInt(s);d==e?g.default(i,[t],l[e]):d==t?g.default(i,[e],l[t]):g.default(i,[s],l[d])}var u,c=a.state.keyedFormData,m=((u=c.slice()).splice(e,1),u.splice(t,0,c[e]),u);a.setState({keyedFormData:m},(function(){return o(w(m),i)}))}},a.onChangeForIndex=function(e){return function(t,r,i){var n,o=a.props,l=o.formData,s=o.errorSchema;(0,o.onChange)((Array.isArray(l)?l:[]).map((function(r,a){return e===a?void 0===t?null:t:r})),s&&s&&C({},s,((n={})[e]=r,n)),i)}},a.onSelectChange=function(e){var t=a.props,r=t.idSchema;(0,t.onChange)(e,void 0,r&&r.$id)};var i=t.formData,n=N(void 0===i?[]:i);return a.state={keyedFormData:n,updatedKeyedFormData:!1},a}F(t,e),t.getDerivedStateFromProps=function(e,t){if(t.updatedKeyedFormData)return{updatedKeyedFormData:!1};var r=Array.isArray(e.formData)?e.formData:[],a=t.keyedFormData||[];return{keyedFormData:r.length===a.length?a.map((function(e,t){return{key:e.key,item:r[t]}})):N(r)}};var a,i,n=t.prototype;return n.isItemRequired=function(e){return Array.isArray(e.type)?!e.type.includes("null"):"null"!==e.type},n.canAddItem=function(e){var t=this.props,a=t.schema,i=r.getUiOptions(t.uiSchema).addable;return!1!==i&&(i=void 0===a.maxItems||e.length<a.maxItems),i},n._handleAddClick=function(e,t){e&&e.preventDefault();var r=this.props.onChange,a=this.state.keyedFormData,i={key:A(),item:this._getNewFormDataRow()},n=[].concat(a);void 0!==t?n.splice(t,0,i):n.push(i),this.setState({keyedFormData:n,updatedKeyedFormData:!0},(function(){return r(w(n))}))},n.render=function(){var e=this.props,t=e.schema,a=e.uiSchema,i=e.idSchema,n=e.registry,o=n.schemaUtils;if(!(r.ITEMS_KEY in t)){var l=r.getUiOptions(a),s=r.getTemplate("UnsupportedFieldTemplate",n,l);return f.default.createElement(s,{schema:t,idSchema:i,reason:"Missing items definition",registry:n})}return o.isMultiSelect(t)?this.renderMultiSelect():r.isCustomWidget(a)?this.renderCustomWidget():r.isFixedItems(t)?this.renderFixedArray():o.isFilesArray(t,a)?this.renderFiles():this.renderNormalArray()},n.renderNormalArray=function(){var e=this,t=this.props,a=t.schema,i=t.uiSchema,n=void 0===i?{}:i,o=t.errorSchema,l=t.idSchema,s=t.name,d=t.disabled,u=void 0!==d&&d,c=t.readonly,m=void 0!==c&&c,p=t.autofocus,h=void 0!==p&&p,v=t.required,g=void 0!==v&&v,E=t.registry,S=t.onBlur,b=t.onFocus,F=t.idPrefix,D=t.idSeparator,O=void 0===D?"_":D,k=t.rawErrors,T=this.state.keyedFormData,x=void 0===a.title?s:a.title,A=E.schemaUtils,N=E.formContext,I=r.getUiOptions(n),B=y.default(a.items)?a.items:{},U=A.retrieveSchema(B),q=w(this.state.keyedFormData),P=this.canAddItem(q),R={canAdd:P,items:T.map((function(t,r){var a=t.key,i=t.item,d=A.retrieveSchema(B,i),u=o?o[r]:void 0,c=A.toIdSchema(d,l.$id+O+r,i,F,O);return e.renderArrayFieldItem({key:a,index:r,name:s&&s+"-"+r,canAdd:P,canMoveUp:r>0,canMoveDown:r<q.length-1,itemSchema:d,itemIdSchema:c,itemErrorSchema:u,itemData:i,itemUiSchema:n.items,autofocus:h&&0===r,onBlur:S,onFocus:b,rawErrors:k,totalItems:T.length})})),className:"field field-array field-array-of-"+U.type,disabled:u,idSchema:l,uiSchema:n,onAddClick:this.onAddClick,readonly:m,required:g,schema:a,title:x,formContext:N,formData:q,rawErrors:k,registry:E},_=r.getTemplate("ArrayFieldTemplate",E,I);return f.default.createElement(_,C({},R))},n.renderCustomWidget=function(){var e=this.props,t=e.schema,a=e.idSchema,i=e.uiSchema,n=e.disabled,o=void 0!==n&&n,l=e.readonly,s=void 0!==l&&l,d=e.autofocus,u=void 0!==d&&d,c=e.required,m=void 0!==c&&c,p=e.hideError,h=e.placeholder,v=e.onBlur,y=e.onFocus,g=e.formData,E=void 0===g?[]:g,S=e.registry,b=e.rawErrors,C=S.widgets,F=S.formContext,D=t.title||e.name,T=r.getUiOptions(i),x=T.widget,A=O(T,k),N=r.getWidget(t,x,C);return f.default.createElement(N,{id:a.$id,multiple:!0,onChange:this.onSelectChange,onBlur:v,onFocus:y,options:A,schema:t,uiSchema:i,registry:S,value:E,disabled:o,readonly:s,hideError:p,required:m,label:D,placeholder:h,formContext:F,autofocus:u,rawErrors:b})},n.renderMultiSelect=function(){var e=this.props,t=e.schema,a=e.idSchema,i=e.uiSchema,n=e.formData,o=void 0===n?[]:n,l=e.disabled,s=void 0!==l&&l,d=e.readonly,u=void 0!==d&&d,c=e.autofocus,m=void 0!==c&&c,p=e.required,h=void 0!==p&&p,v=e.placeholder,y=e.onBlur,g=e.onFocus,E=e.registry,S=e.rawErrors,b=e.name,F=E.widgets,D=E.formContext,k=E.schemaUtils.retrieveSchema(t.items,o),x=t.title||b,A=r.optionsList(k),N=r.getUiOptions(i),w=N.widget,I=void 0===w?"select":w,B=O(N,T),U=r.getWidget(t,I,F);return f.default.createElement(U,{id:a.$id,multiple:!0,onChange:this.onSelectChange,onBlur:y,onFocus:g,options:C({},B,{enumOptions:A}),schema:t,uiSchema:i,registry:E,value:o,disabled:s,readonly:u,required:h,label:x,placeholder:v,formContext:D,autofocus:m,rawErrors:S})},n.renderFiles=function(){var e=this.props,t=e.schema,a=e.uiSchema,i=e.idSchema,n=e.disabled,o=void 0!==n&&n,l=e.readonly,s=void 0!==l&&l,d=e.autofocus,u=void 0!==d&&d,c=e.required,m=void 0!==c&&c,p=e.onBlur,h=e.onFocus,v=e.registry,y=e.formData,g=void 0===y?[]:y,E=e.rawErrors,S=t.title||e.name,b=v.widgets,C=v.formContext,F=r.getUiOptions(a),D=F.widget,k=void 0===D?"files":D,T=O(F,x),A=r.getWidget(t,k,b);return f.default.createElement(A,{options:T,id:i.$id,multiple:!0,onChange:this.onSelectChange,onBlur:p,onFocus:h,schema:t,uiSchema:a,title:S,value:g,disabled:o,readonly:s,required:m,registry:v,formContext:C,autofocus:u,rawErrors:E,label:""})},n.renderFixedArray=function(){var e=this,t=this.props,a=t.schema,i=t.uiSchema,n=void 0===i?{}:i,o=t.formData,l=void 0===o?[]:o,s=t.errorSchema,d=t.idPrefix,u=t.idSeparator,c=void 0===u?"_":u,m=t.idSchema,p=t.name,h=t.disabled,v=void 0!==h&&h,g=t.readonly,E=void 0!==g&&g,S=t.autofocus,b=void 0!==S&&S,F=t.required,D=void 0!==F&&F,O=t.registry,k=t.onBlur,T=t.onFocus,x=t.rawErrors,A=this.state.keyedFormData,N=this.props.formData,w=void 0===N?[]:N,I=a.title||p,B=r.getUiOptions(n),U=O.schemaUtils,q=O.formContext,P=(y.default(a.items)?a.items:[]).map((function(e,t){return U.retrieveSchema(e,l[t])})),R=y.default(a.additionalItems)?U.retrieveSchema(a.additionalItems,l):null;(!w||w.length<P.length)&&(w=(w=w||[]).concat(new Array(P.length-w.length)));var _=this.canAddItem(w)&&!!R,j={canAdd:_,className:"field field-array field-array-fixed-items",disabled:v,idSchema:m,formData:l,items:A.map((function(t,r){var i=t.key,o=t.item,l=r>=P.length,u=l&&y.default(a.additionalItems)?U.retrieveSchema(a.additionalItems,o):P[r],f=U.toIdSchema(u,m.$id+c+r,o,d,c),h=l?n.additionalItems||{}:Array.isArray(n.items)?n.items[r]:n.items||{};return e.renderArrayFieldItem({key:i,index:r,name:p&&p+"-"+r,canAdd:_,canRemove:l,canMoveUp:r>=P.length+1,canMoveDown:l&&r<w.length-1,itemSchema:u,itemData:o,itemUiSchema:h,itemIdSchema:f,itemErrorSchema:s?s[r]:void 0,autofocus:b&&0===r,onBlur:k,onFocus:T,rawErrors:x,totalItems:A.length})})),onAddClick:this.onAddClick,readonly:E,required:D,registry:O,schema:a,uiSchema:n,title:I,formContext:q,rawErrors:x},V=r.getTemplate("ArrayFieldTemplate",O,B);return f.default.createElement(V,C({},j))},n.renderArrayFieldItem=function(e){var t=e.key,a=e.index,i=e.name,n=e.canAdd,o=e.canRemove,l=void 0===o||o,s=e.canMoveUp,d=void 0===s||s,u=e.canMoveDown,c=void 0===u||u,m=e.itemSchema,p=e.itemData,h=e.itemUiSchema,v=e.itemIdSchema,y=e.itemErrorSchema,g=e.autofocus,E=e.onBlur,S=e.onFocus,b=e.rawErrors,C=e.totalItems,F=this.props,D=F.disabled,O=F.hideError,k=F.idPrefix,T=F.idSeparator,x=F.readonly,A=F.registry,N=F.formContext,w=A.fields,I=w.ArraySchemaField||w.SchemaField,B=r.getUiOptions(F.uiSchema),U=B.orderable,q=void 0===U||U,P=B.removable,R={moveUp:q&&d,moveDown:q&&c,remove:(void 0===P||P)&&l,toolbar:!1};return R.toolbar=Object.keys(R).some((function(e){return R[e]})),{children:f.default.createElement(I,{name:i,index:a,schema:m,uiSchema:h,formData:p,formContext:N,errorSchema:y,idPrefix:k,idSeparator:T,idSchema:v,required:this.isItemRequired(m),onChange:this.onChangeForIndex(a),onBlur:E,onFocus:S,registry:A,disabled:D,readonly:x,hideError:O,autofocus:g,rawErrors:b}),className:"array-item",disabled:D,canAdd:n,hasToolbar:R.toolbar,hasMoveUp:R.moveUp,hasMoveDown:R.moveDown,hasRemove:R.remove,index:a,totalItems:C,key:t,onAddIndexClick:this.onAddIndexClick,onDropIndexClick:this.onDropIndexClick,onReorderClick:this.onReorderClick,readonly:x,registry:A,schema:m,uiSchema:h}},a=t,(i=[{key:"itemTitle",get:function(){var e=this.props.schema;return p.default(e,[r.ITEMS_KEY,"title"],p.default(e,[r.ITEMS_KEY,"description"],"Item"))}}])&&function(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,"symbol"==typeof(i=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var a=r.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}(a.prototype,i),Object.defineProperty(a,"prototype",{writable:!1}),t}(t.Component),B=["widget"];function U(e){var t,a=e.schema,i=e.name,n=e.uiSchema,o=e.idSchema,l=e.formData,s=e.registry,d=e.required,u=e.disabled,c=e.readonly,m=e.autofocus,p=e.onChange,h=e.onFocus,v=e.onBlur,g=e.rawErrors,E=a.title,S=s.widgets,b=s.formContext,F=r.getUiOptions(n),D=F.widget,k=void 0===D?"checkbox":D,T=O(F,B),x=r.getWidget(a,k,S);if(Array.isArray(a.oneOf))t=r.optionsList({oneOf:a.oneOf.map((function(e){if(y.default(e))return C({},e,{title:e.title||(!0===e.const?"Yes":"No")})})).filter((function(e){return e}))});else{var A,N=a,w=null!=(A=a.enum)?A:[!0,!1];t=!N.enumNames&&2===w.length&&w.every((function(e){return"boolean"==typeof e}))?[{value:w[0],label:w[0]?"Yes":"No"},{value:w[1],label:w[1]?"Yes":"No"}]:r.optionsList({enum:w,enumNames:N.enumNames})}return f.default.createElement(x,{options:C({},T,{enumOptions:t}),schema:a,uiSchema:n,id:o.$id,onChange:p,onFocus:h,onBlur:v,label:void 0===E?i:E,value:l,required:d,disabled:u,readonly:c,registry:s,formContext:b,autofocus:m,rawErrors:g})}var q=["widget","placeholder","autofocus","autocomplete","title"],P="Option",R=function(e){function t(t){var r;(r=e.call(this,t)||this).onOptionChange=function(e){var t=r.state,a=t.selectedOption,i=t.retrievedOptions,n=r.props,o=n.formData,l=n.onChange,s=n.registry.schemaUtils,d=void 0!==e?parseInt(e,10):-1;if(d!==a){var u=d>=0?i[d]:void 0,c=s.sanitizeDataForNewSchema(u,a>=0?i[a]:void 0,o);c&&u&&(c=s.getDefaultFormState(u,c,"excludeObjectChildren")),l(c,void 0,r.getFieldId()),r.setState({selectedOption:d})}};var a=r.props,i=a.formData,n=a.registry.schemaUtils,o=a.options.map((function(e){return n.retrieveSchema(e,i)}));return r.state={retrievedOptions:o,selectedOption:r.getMatchingOption(0,i,o)},r}F(t,e);var a=t.prototype;return a.componentDidUpdate=function(e,t){var a=this.props,i=a.formData,n=a.options,o=a.idSchema,l=this.state.selectedOption,s=this.state;if(!r.deepEquals(e.options,n)){var d=this.props.registry.schemaUtils;s={selectedOption:l,retrievedOptions:n.map((function(e){return d.retrieveSchema(e,i)}))}}if(!r.deepEquals(i,e.formData)&&o.$id===e.idSchema.$id){var u=s.retrievedOptions,c=this.getMatchingOption(l,i,u);t&&c!==l&&(s={selectedOption:c,retrievedOptions:u})}s!==this.state&&this.setState(s)},a.getMatchingOption=function(e,t,r){var a=this.props.registry.schemaUtils.getClosestMatchingOption(t,r,e);return a>0?a:e||0},a.getFieldId=function(){var e=this.props;return e.idSchema.$id+(e.schema.oneOf?"__oneof_select":"__anyof_select")},a.render=function(){var e,t=this.props,a=t.baseType,i=t.disabled,n=void 0!==i&&i,o=t.errorSchema,l=void 0===o?{}:o,s=t.formContext,d=t.onBlur,u=t.onFocus,c=t.registry,m=t.schema,v=c.widgets,y=c.fields.SchemaField,g=this.state,S=g.selectedOption,b=g.retrievedOptions,F=r.getUiOptions(t.uiSchema),D=F.widget,k=void 0===D?"select":D,T=F.placeholder,x=F.autofocus,A=F.autocomplete,N=F.title,w=void 0===N?m.title:N,I=O(F,q),B=r.getWidget({type:"number"},k,v),U=p.default(l,r.ERRORS_KEY,[]),R=E.default(l,[r.ERRORS_KEY]),_=b[S]||null;_&&(e=_.type?_:Object.assign({},_,{type:a}));var j=w?w+" "+P.toLowerCase():P,V=b.map((function(e,t){return{label:e.title||j+" "+(t+1),value:t}}));return f.default.createElement("div",{className:"panel panel-default panel-body"},f.default.createElement("div",{className:"form-group"},f.default.createElement(B,{id:this.getFieldId(),schema:{type:"number",default:0},onChange:this.onOptionChange,onBlur:d,onFocus:u,disabled:n||h.default(V),multiple:!1,rawErrors:U,errorSchema:R,value:S,options:C({enumOptions:V},I),registry:c,formContext:s,placeholder:T,autocomplete:A,autofocus:x,label:""})),null!==_&&f.default.createElement(y,C({},this.props,{schema:e})))},t}(t.Component),_=/\.([0-9]*0)*$/,j=/[0.]0*$/;function V(e){var a=e.registry,i=e.onChange,n=e.formData,o=t.useState(e.value),l=o[0],s=o[1],d=a.fields.StringField,u=n,c=t.useCallback((function(e){s(e),"."===(""+e).charAt(0)&&(e="0"+e);var t="string"==typeof e&&e.match(_)?r.asNumber(e.replace(j,"")):r.asNumber(e);i(t)}),[i]);if("string"==typeof l&&"number"==typeof u){var m=new RegExp((""+u).replace(".","\\.")+"\\.?0*$");l.match(m)&&(u=l)}return f.default.createElement(d,C({},e,{formData:u,onChange:c}))}var K=function(e){function t(){for(var t,a=arguments.length,i=new Array(a),n=0;n<a;n++)i[n]=arguments[n];return(t=e.call.apply(e,[this].concat(i))||this).state={wasPropertyKeyModified:!1,additionalProperties:{}},t.onPropertyChange=function(e,r){return void 0===r&&(r=!1),function(a,i,n){var o,l,s=t.props,d=s.errorSchema;void 0===a&&r&&(a=""),(0,s.onChange)(C({},s.formData,((o={})[e]=a,o)),d&&d&&C({},d,((l={})[e]=i,l)),n)}},t.onDropPropertyClick=function(e){return function(r){r.preventDefault();var a=t.props,i=a.onChange,n=C({},a.formData);b.default(n,e),i(n)}},t.getAvailableKey=function(e,a){for(var i=r.getUiOptions(t.props.uiSchema).duplicateKeySuffixSeparator,n=void 0===i?"-":i,o=0,l=e;S.default(a,l);)l=""+e+n+ ++o;return l},t.onKeyChange=function(e){return function(r,a){var i,n;if(e!==r){var o=t.props,l=o.formData,s=o.onChange,d=o.errorSchema;r=t.getAvailableKey(r,l);var u=C({},l),c=((i={})[e]=r,i),m=Object.keys(u).map((function(e){var t;return(t={})[c[e]||e]=u[e],t})),f=Object.assign.apply(Object,[{}].concat(m));t.setState({wasPropertyKeyModified:!0}),s(f,d&&d&&C({},d,((n={})[r]=a,n)))}}},t.handleAddClick=function(e){return function(){if(e.additionalProperties){var a=t.props,i=a.formData,n=a.onChange,o=a.registry,l=C({},i),s=void 0;if(y.default(e.additionalProperties)){s=e.additionalProperties.type;var d=e.additionalProperties;r.REF_KEY in d&&(s=(d=o.schemaUtils.retrieveSchema({$ref:d[r.REF_KEY]},i)).type),s||!(r.ANY_OF_KEY in d)&&!(r.ONE_OF_KEY in d)||(s="object")}var u=t.getAvailableKey("newKey",l);g.default(l,u,t.getDefaultValue(s)),n(l)}}},t}F(t,e);var a=t.prototype;return a.isRequired=function(e){var t=this.props.schema;return Array.isArray(t.required)&&-1!==t.required.indexOf(e)},a.getDefaultValue=function(e){switch(e){case"string":default:return"New Value";case"array":return[];case"boolean":return!1;case"null":return null;case"number":return 0;case"object":return{}}},a.render=function(){var e,t=this,a=this.props,i=a.uiSchema,n=void 0===i?{}:i,o=a.formData,l=a.errorSchema,s=a.idSchema,d=a.name,u=a.required,c=void 0!==u&&u,m=a.disabled,h=void 0!==m&&m,v=a.readonly,y=void 0!==v&&v,g=a.hideError,E=a.idPrefix,b=a.idSeparator,F=a.onBlur,D=a.onFocus,O=a.registry,k=O.formContext,T=O.fields.SchemaField,x=O.schemaUtils.retrieveSchema(a.schema,o),A=r.getUiOptions(n),N=x.properties,w=void 0===N?{}:N,I=void 0===x.title?d:x.title,B=A.description||x.description;try{var U=Object.keys(w);e=r.orderProperties(U,A.order)}catch(e){return f.default.createElement("div",null,f.default.createElement("p",{className:"config-error",style:{color:"red"}},"Invalid ",d||"root"," object field configuration:",f.default.createElement("em",null,e.message),"."),f.default.createElement("pre",null,JSON.stringify(x)))}var q=r.getTemplate("ObjectFieldTemplate",O,A),P={title:A.title||I,description:B,properties:e.map((function(e){var a=S.default(x,[r.PROPERTIES_KEY,e,r.ADDITIONAL_PROPERTY_FLAG]),i=a?n.additionalProperties:n[e],d="hidden"===r.getUiOptions(i).widget,u=p.default(s,[e],{});return{content:f.default.createElement(T,{key:e,name:e,required:t.isRequired(e),schema:p.default(x,[r.PROPERTIES_KEY,e],{}),uiSchema:i,errorSchema:p.default(l,e),idSchema:u,idPrefix:E,idSeparator:b,formData:p.default(o,e),formContext:k,wasPropertyKeyModified:t.state.wasPropertyKeyModified,onKeyChange:t.onKeyChange(e),onChange:t.onPropertyChange(e,a),onBlur:F,onFocus:D,registry:O,disabled:h,readonly:y,hideError:g,onDropPropertyClick:t.onDropPropertyClick}),name:e,readonly:y,disabled:h,required:c,hidden:d}})),readonly:y,disabled:h,required:c,idSchema:s,uiSchema:n,schema:x,formData:o,formContext:k,registry:O};return f.default.createElement(q,C({},P,{onAddClick:this.handleAddClick}))},t}(t.Component),M=["__errors"],W={array:"ArrayField",boolean:"BooleanField",integer:"NumberField",number:"NumberField",object:"ObjectField",string:"StringField",null:"NullField"};function L(e){var t=e.schema,a=e.idSchema,i=e.uiSchema,n=e.formData,o=e.errorSchema,l=e.idPrefix,s=e.idSeparator,d=e.name,u=e.onChange,c=e.onKeyChange,m=e.onDropPropertyClick,p=e.required,h=e.registry,v=e.wasPropertyKeyModified,g=void 0!==v&&v,S=h.formContext,b=h.schemaUtils,F=r.getUiOptions(i),D=r.getTemplate("FieldTemplate",h,F),k=r.getTemplate("DescriptionFieldTemplate",h,F),T=r.getTemplate("FieldHelpTemplate",h,F),x=r.getTemplate("FieldErrorTemplate",h,F),A=b.retrieveSchema(t,n),N=a[r.ID_KEY],w=r.mergeObjects(b.toIdSchema(A,N,n,l,s),a),I=f.default.useCallback((function(e,t,r){return u(e,t,r||N)}),[N,u]),B=function(e,t,a,i){var n=t.field,o=i.fields;if("function"==typeof n)return n;if("string"==typeof n&&n in o)return o[n];var l=r.getSchemaType(e),s=Array.isArray(l)?l[0]:l||"",d=W[s];return d||!e.anyOf&&!e.oneOf?d in o?o[d]:function(){var n=r.getTemplate("UnsupportedFieldTemplate",i,t);return f.default.createElement(n,{schema:e,idSchema:a,reason:"Unknown field type "+e.type,registry:i})}:function(){return null}}(A,F,w,h),U=Boolean(e.disabled||F.disabled),q=Boolean(e.readonly||F.readonly||e.schema.readOnly||A.readOnly),P=F.hideError,R=void 0===P?e.hideError:Boolean(P),_=Boolean(e.autofocus||F.autofocus);if(0===Object.keys(A).length)return null;var j=b.getDisplayLabel(A,i),V=o||{},K=V.__errors,L=O(V,M),Y=E.default(i,["ui:classNames","classNames","ui:style"]);r.UI_OPTIONS_KEY in Y&&(Y[r.UI_OPTIONS_KEY]=E.default(Y[r.UI_OPTIONS_KEY],["classNames","style"]));var $,z=f.default.createElement(B,C({},e,{onChange:I,idSchema:w,schema:A,uiSchema:Y,disabled:U,readonly:q,hideError:R,autofocus:_,errorSchema:L,formContext:S,rawErrors:K})),J=w[r.ID_KEY];$=g||r.ADDITIONAL_PROPERTY_FLAG in A?d:F.title||e.schema.title||A.title||d;var H=F.description||e.schema.description||A.description||"",G=F.help,Q="hidden"===F.widget,X=["form-group","field","field-"+A.type];!R&&K&&K.length>0&&X.push("field-error has-error has-danger"),null!=i&&i.classNames&&X.push(i.classNames),F.classNames&&X.push(F.classNames);var Z=f.default.createElement(T,{help:G,idSchema:w,schema:A,uiSchema:i,hasErrors:!R&&K&&K.length>0,registry:h}),ee=R?void 0:f.default.createElement(x,{errors:K,errorSchema:o,idSchema:w,schema:A,uiSchema:i,registry:h}),te={description:f.default.createElement(k,{id:r.descriptionId(J),description:H,schema:A,uiSchema:i,registry:h}),rawDescription:H,help:Z,rawHelp:"string"==typeof G?G:void 0,errors:ee,rawErrors:R?void 0:K,id:J,label:$,hidden:Q,onChange:u,onKeyChange:c,onDropPropertyClick:m,required:p,disabled:U,readonly:q,hideError:R,displayLabel:j,classNames:X.join(" ").trim(),style:F.style,formContext:S,formData:n,schema:A,uiSchema:i,registry:h},re=h.fields.AnyOfField,ae=h.fields.OneOfField,ie=(null==i?void 0:i["ui:field"])&&!0===(null==i?void 0:i["ui:fieldReplacesAnyOrOneOf"]);return f.default.createElement(D,C({},te),f.default.createElement(f.default.Fragment,null,z,A.anyOf&&!ie&&!b.isSelect(A)&&f.default.createElement(re,{name:d,disabled:U,readonly:q,hideError:R,errorSchema:o,formData:n,formContext:S,idPrefix:l,idSchema:w,idSeparator:s,onBlur:e.onBlur,onChange:e.onChange,onFocus:e.onFocus,options:A.anyOf.map((function(e){return b.retrieveSchema(y.default(e)?e:{},n)})),baseType:A.type,registry:h,schema:A,uiSchema:i}),A.oneOf&&!ie&&!b.isSelect(A)&&f.default.createElement(ae,{name:d,disabled:U,readonly:q,hideError:R,errorSchema:o,formData:n,formContext:S,idPrefix:l,idSchema:w,idSeparator:s,onBlur:e.onBlur,onChange:e.onChange,onFocus:e.onFocus,options:A.oneOf.map((function(e){return b.retrieveSchema(y.default(e)?e:{},n)})),baseType:A.type,registry:h,schema:A,uiSchema:i})))}var Y=function(e){function t(){return e.apply(this,arguments)||this}F(t,e);var a=t.prototype;return a.shouldComponentUpdate=function(e){return!r.deepEquals(this.props,e)},a.render=function(){return f.default.createElement(L,C({},this.props))},t}(f.default.Component),$=["widget","placeholder"];function z(e){var t=e.schema,a=e.name,i=e.uiSchema,n=e.idSchema,o=e.formData,l=e.required,s=e.disabled,d=void 0!==s&&s,u=e.readonly,c=void 0!==u&&u,m=e.autofocus,p=void 0!==m&&m,h=e.onChange,v=e.onBlur,y=e.onFocus,g=e.registry,E=e.rawErrors,S=t.title,b=t.format,F=g.widgets,D=g.formContext,k=g.schemaUtils.isSelect(t)?r.optionsList(t):void 0,T=k?"select":"text";b&&r.hasWidget(t,b,F)&&(T=b);var x=r.getUiOptions(i),A=x.widget,N=void 0===A?T:A,w=x.placeholder,I=void 0===w?"":w,B=O(x,$),U=r.getWidget(t,N,F);return f.default.createElement(U,{options:C({},B,{enumOptions:k}),schema:t,uiSchema:i,id:n.$id,label:void 0===S?a:S,value:o,onChange:h,onBlur:v,onFocus:y,required:l,disabled:d,readonly:c,formContext:D,autofocus:p,registry:g,placeholder:I,rawErrors:E})}function J(e){var r=e.formData,a=e.onChange;return t.useEffect((function(){void 0===r&&a(null)}),[r,a]),null}function H(e){var t=e.idSchema,a=e.description,i=e.registry,n=e.schema,o=e.uiSchema,l=r.getUiOptions(o),s=l.label;if(!a||void 0!==s&&!s)return null;var d=r.getTemplate("DescriptionFieldTemplate",i,l);return f.default.createElement(d,{id:r.descriptionId(t),description:a,schema:n,uiSchema:o,registry:i})}function G(e){var t=e.disabled,r=e.hasToolbar,a=e.hasMoveDown,i=e.hasMoveUp,n=e.hasRemove,o=e.index,l=e.onDropIndexClick,s=e.onReorderClick,d=e.readonly,u=e.registry,c=e.uiSchema,m=u.templates.ButtonTemplates,p=m.MoveDownButton,h=m.MoveUpButton,v=m.RemoveButton,y={flex:1,paddingLeft:6,paddingRight:6,fontWeight:"bold"};return f.default.createElement("div",{className:e.className},f.default.createElement("div",{className:r?"col-xs-9":"col-xs-12"},e.children),r&&f.default.createElement("div",{className:"col-xs-3 array-item-toolbox"},f.default.createElement("div",{className:"btn-group",style:{display:"flex",justifyContent:"space-around"}},(i||a)&&f.default.createElement(h,{style:y,disabled:t||d||!i,onClick:s(o,o-1),uiSchema:c,registry:u}),(i||a)&&f.default.createElement(p,{style:y,disabled:t||d||!a,onClick:s(o,o+1),uiSchema:c,registry:u}),n&&f.default.createElement(v,{style:y,disabled:t||d,onClick:l(o),uiSchema:c,registry:u}))))}var Q=["key"];function X(e){var t=e.canAdd,a=e.className,i=e.disabled,n=e.idSchema,o=e.uiSchema,l=e.items,s=e.onAddClick,d=e.readonly,u=e.registry,c=e.required,m=e.schema,p=e.title,h=r.getUiOptions(o),v=r.getTemplate("ArrayFieldDescriptionTemplate",u,h),y=r.getTemplate("ArrayFieldItemTemplate",u,h),g=r.getTemplate("ArrayFieldTitleTemplate",u,h),E=u.templates.ButtonTemplates.AddButton;return f.default.createElement("fieldset",{className:a,id:n.$id},f.default.createElement(g,{idSchema:n,title:h.title||p,required:c,schema:m,uiSchema:o,registry:u}),f.default.createElement(v,{idSchema:n,description:h.description||m.description,schema:m,uiSchema:o,registry:u}),f.default.createElement("div",{className:"row array-item-list"},l&&l.map((function(e){var t=e.key,r=O(e,Q);return f.default.createElement(y,C({key:t},r))}))),t&&f.default.createElement(E,{className:"array-item-add",onClick:s,disabled:i||d,uiSchema:o,registry:u}))}function Z(e){var t=e.idSchema,a=e.title,i=e.schema,n=e.uiSchema,o=e.required,l=e.registry,s=r.getUiOptions(n),d=s.label;if(!a||void 0!==d&&!d)return null;var u=r.getTemplate("TitleFieldTemplate",l,s);return f.default.createElement(u,{id:r.titleId(t),title:a,required:o,schema:i,uiSchema:n,registry:l})}var ee=["id","value","readonly","disabled","autofocus","onBlur","onFocus","onChange","options","schema","uiSchema","formContext","registry","rawErrors","type"];function te(e){var a=e.id,i=e.value,n=e.readonly,o=e.disabled,l=e.autofocus,s=e.onBlur,d=e.onFocus,u=e.onChange,c=e.options,m=e.schema,p=e.type,h=O(e,ee);if(!a)throw console.log("No id for",e),new Error("no id for props "+JSON.stringify(e));var v,y=C({},h,r.getInputProps(m,p,c));v="number"===y.type||"integer"===y.type?i||0===i?i:"":null==i?"":i;var g=t.useCallback((function(e){var t=e.target.value;return u(""===t?c.emptyValue:t)}),[u,c]),E=t.useCallback((function(e){return s(a,e.target.value)}),[s,a]),S=t.useCallback((function(e){return d(a,e.target.value)}),[d,a]);return f.default.createElement(f.default.Fragment,null,f.default.createElement("input",C({id:a,name:a,className:"form-control",readOnly:n,disabled:o,autoFocus:l,value:v},y,{list:m.examples?r.examplesId(a):void 0,onChange:g,onBlur:E,onFocus:S,"aria-describedby":r.ariaDescribedByIds(a,!!m.examples)})),Array.isArray(m.examples)&&f.default.createElement("datalist",{key:"datalist_"+a,id:r.examplesId(a)},[].concat(new Set(m.examples.concat(m.default?[m.default]:[]))).map((function(e){return f.default.createElement("option",{key:e,value:e})}))))}function re(e){var t=r.getSubmitButtonOptions(e.uiSchema),a=t.submitText,i=t.props,n=void 0===i?{}:i;return t.norender?null:f.default.createElement("div",null,f.default.createElement("button",C({type:"submit"},n,{className:"btn btn-info "+n.className}),a))}var ae=["iconType","icon","className","uiSchema","registry"];function ie(e){var t=e.iconType,r=void 0===t?"default":t,a=e.icon,i=e.className,n=O(e,ae);return f.default.createElement("button",C({type:"button",className:"btn btn-"+r+" "+i},n),f.default.createElement("i",{className:"glyphicon glyphicon-"+a}))}function ne(e){return f.default.createElement(ie,C({title:"Move down",className:"array-item-move-down"},e,{icon:"arrow-down"}))}function oe(e){return f.default.createElement(ie,C({title:"Move up",className:"array-item-move-up"},e,{icon:"arrow-up"}))}function le(e){return f.default.createElement(ie,C({title:"Remove",className:"array-item-remove"},e,{iconType:"danger",icon:"remove"}))}function se(e){return f.default.createElement("div",{className:"row"},f.default.createElement("p",{className:"col-xs-3 col-xs-offset-9 text-right "+e.className},f.default.createElement(ie,{iconType:"info",icon:"plus",className:"btn-add col-xs-12",title:"Add",onClick:e.onClick,disabled:e.disabled,registry:e.registry})))}function de(e){var t=e.description;return t?f.default.createElement("string"==typeof t?"p":"div",{id:e.id,className:"field-description"},t):null}function ue(e){var t=e.errors;return f.default.createElement("div",{className:"panel panel-danger errors"},f.default.createElement("div",{className:"panel-heading"},f.default.createElement("h3",{className:"panel-title"},"Errors")),f.default.createElement("ul",{className:"list-group"},t.map((function(e,t){return f.default.createElement("li",{key:t,className:"list-group-item text-danger"},e.stack)}))))}function ce(e){var t=e.label;return t?f.default.createElement("label",{className:"control-label",htmlFor:e.id},t,e.required&&f.default.createElement("span",{className:"required"},"*")):null}function me(e){var t=e.id,a=e.label,i=e.children,n=e.errors,o=e.help,l=e.description,s=e.hidden,d=e.required,u=e.displayLabel,c=e.registry,m=r.getUiOptions(e.uiSchema),p=r.getTemplate("WrapIfAdditionalTemplate",c,m);return s?f.default.createElement("div",{className:"hidden"},i):f.default.createElement(p,C({},e),u&&f.default.createElement(ce,{label:a,required:d,id:t}),u&&l?l:null,i,n,o)}function fe(e){var t=e.errors,a=void 0===t?[]:t;if(0===a.length)return null;var i=r.errorId(e.idSchema);return f.default.createElement("div",null,f.default.createElement("ul",{id:i,className:"error-detail bs-callout bs-callout-info"},a.filter((function(e){return!!e})).map((function(e,t){return f.default.createElement("li",{className:"text-danger",key:t},e)}))))}function pe(e){var t=e.help;if(!t)return null;var a=r.helpId(e.idSchema);return f.default.createElement("string"==typeof t?"p":"div",{id:a,className:"help-block"},t)}function he(e){var t=e.description,a=e.disabled,i=e.formData,n=e.idSchema,o=e.onAddClick,l=e.properties,s=e.readonly,d=e.registry,u=e.required,c=e.schema,m=e.title,p=e.uiSchema,h=r.getUiOptions(p),v=r.getTemplate("TitleFieldTemplate",d,h),y=r.getTemplate("DescriptionFieldTemplate",d,h),g=d.templates.ButtonTemplates.AddButton;return f.default.createElement("fieldset",{id:n.$id},(h.title||m)&&f.default.createElement(v,{id:r.titleId(n),title:h.title||m,required:u,schema:c,uiSchema:p,registry:d}),(h.description||t)&&f.default.createElement(y,{id:r.descriptionId(n),description:h.description||t,schema:c,uiSchema:p,registry:d}),l.map((function(e){return e.content})),r.canExpand(c,p,i)&&f.default.createElement(g,{className:"object-property-expand",onClick:o(c),disabled:a||s,uiSchema:p,registry:d}))}function ve(e){return f.default.createElement("legend",{id:e.id},e.title,e.required&&f.default.createElement("span",{className:"required"},"*"))}function ye(e){var t=e.schema,r=e.idSchema,a=e.reason;return f.default.createElement("div",{className:"unsupported-field"},f.default.createElement("p",null,"Unsupported field schema",r&&r.$id&&f.default.createElement("span",null," for"," field ",f.default.createElement("code",null,r.$id)),a&&f.default.createElement("em",null,": ",a),"."),t&&f.default.createElement("pre",null,JSON.stringify(t,null,2)))}function ge(e){var t=e.id,a=e.disabled,i=e.label,n=e.onKeyChange,o=e.onDropPropertyClick,l=e.readonly,s=e.children,d=e.uiSchema,u=e.registry,c=u.templates.ButtonTemplates.RemoveButton;return f.default.createElement("div",{className:e.classNames,style:e.style},r.ADDITIONAL_PROPERTY_FLAG in e.schema?f.default.createElement("div",{className:"row"},f.default.createElement("div",{className:"col-xs-5 form-additional"},f.default.createElement("div",{className:"form-group"},f.default.createElement(ce,{label:i+" Key",required:e.required,id:t+"-key"}),f.default.createElement("input",{className:"form-control",type:"text",id:t+"-key",onBlur:function(e){return n(e.target.value)},defaultValue:i}))),f.default.createElement("div",{className:"form-additional form-group col-xs-5"},s),f.default.createElement("div",{className:"col-xs-2"},f.default.createElement(c,{className:"array-item-remove btn-block",style:{border:"0"},disabled:a||l,onClick:o(i),uiSchema:d,registry:u}))):s)}function Ee(e,t){for(var a=[],i=e;i<=t;i++)a.push({value:i,label:r.pad(i,2)});return a}function Se(e){var t=e.type,a=e.range,i=e.value,n=e.select,o=e.rootId,l=e.disabled,s=e.readonly,d=e.autofocus,u=e.registry,c=e.onBlur,m=e.onFocus;return f.default.createElement(u.widgets.SelectWidget,{schema:{type:"integer"},id:o+"_"+t,className:"form-control",options:{enumOptions:Ee(a[0],a[1])},placeholder:t,value:i,disabled:l,readonly:s,autofocus:d,onChange:function(e){return n(t,e)},onBlur:c,onFocus:m,registry:u,label:"","aria-describedby":r.ariaDescribedByIds(o)})}function be(e){var a=e.time,i=void 0!==a&&a,n=e.disabled,o=void 0!==n&&n,l=e.readonly,s=void 0!==l&&l,d=e.autofocus,u=void 0!==d&&d,c=e.options,m=e.id,p=e.registry,h=e.onBlur,v=e.onFocus,y=e.onChange,g=e.value,E=t.useReducer((function(e,t){return C({},e,t)}),r.parseDateString(g,i)),S=E[0],b=E[1];t.useEffect((function(){g&&g!==r.toDateString(S,i)&&b(r.parseDateString(g,i))}),[g,S,i]),t.useEffect((function(){(function(e){return Object.values(e).every((function(e){return-1!==e}))})(S)&&y(r.toDateString(S,i))}),[S,i,y]);var F=t.useCallback((function(e,t){var r;b(((r={})[e]=t,r))}),[]),D=t.useCallback((function(e){if(e.preventDefault(),!o&&!s){var t=r.parseDateString((new Date).toJSON(),i);b(t)}}),[o,s,i]),O=t.useCallback((function(e){e.preventDefault(),o||s||(b(r.parseDateString("",i)),y(void 0))}),[o,s,i,y]);return f.default.createElement("ul",{className:"list-inline"},function(e,t,r){void 0===r&&(r=[1900,(new Date).getFullYear()+2]);var a=[{type:"year",range:r,value:e.year},{type:"month",range:[1,12],value:e.month},{type:"day",range:[1,31],value:e.day}];return t&&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}(S,i,c.yearsRange).map((function(e,t){return f.default.createElement("li",{key:t},f.default.createElement(Se,C({rootId:m,select:F},e,{disabled:o,readonly:s,registry:p,onBlur:h,onFocus:v,autofocus:u&&0===t})))})),("undefined"===c.hideNowButton||!c.hideNowButton)&&f.default.createElement("li",null,f.default.createElement("a",{href:"#",className:"btn btn-info btn-now",onClick:D},"Now")),("undefined"===c.hideClearButton||!c.hideClearButton)&&f.default.createElement("li",null,f.default.createElement("a",{href:"#",className:"btn btn-warning btn-clear",onClick:O},"Clear")))}var Ce=["time"];function Fe(e){var t=e.time,r=void 0===t||t,a=O(e,Ce);return f.default.createElement(a.registry.widgets.AltDateWidget,C({time:r},a))}function De(e){var a=e.schema,i=e.uiSchema,n=e.id,o=e.value,l=e.disabled,s=e.readonly,d=e.label,u=e.autofocus,c=void 0!==u&&u,m=e.onBlur,p=e.onFocus,h=e.onChange,v=e.registry,y=r.getTemplate("DescriptionFieldTemplate",v,e.options),g=r.schemaRequiresTrueValue(a),E=t.useCallback((function(e){return h(e.target.checked)}),[h]),S=t.useCallback((function(e){return m(n,e.target.checked)}),[m,n]),b=t.useCallback((function(e){return p(n,e.target.checked)}),[p,n]);return f.default.createElement("div",{className:"checkbox "+(l||s?"disabled":"")},a.description&&f.default.createElement(y,{id:r.descriptionId(n),description:a.description,schema:a,uiSchema:i,registry:v}),f.default.createElement("label",null,f.default.createElement("input",{type:"checkbox",id:n,name:n,checked:void 0!==o&&o,required:g,disabled:l||s,autoFocus:c,onChange:E,onBlur:S,onFocus:b,"aria-describedby":r.ariaDescribedByIds(n)}),f.default.createElement("span",null,d)))}function Oe(e){var t=e.id,a=e.disabled,i=e.options,n=i.inline,o=void 0!==n&&n,l=i.enumOptions,s=i.enumDisabled,d=e.value,u=e.autofocus,c=void 0!==u&&u,m=e.readonly,p=e.onChange,h=Array.isArray(d)?d:[d];return f.default.createElement("div",{className:"checkboxes",id:t},Array.isArray(l)&&l.map((function(e,i){var n=h.includes(e.value),d=Array.isArray(s)&&-1!=s.indexOf(e.value),u=a||d||m?"disabled":"",v=f.default.createElement("span",null,f.default.createElement("input",{type:"checkbox",id:r.optionId(t,e),name:t,checked:n,disabled:a||d||m,autoFocus:c&&0===i,onChange:function(t){p(t.target.checked?r.enumOptionsSelectValue(e.value,h,l):r.enumOptionsDeselectValue(e.value,h))},"aria-describedby":r.ariaDescribedByIds(t)}),f.default.createElement("span",null,e.label));return o?f.default.createElement("label",{key:e.value,className:"checkbox-inline "+u},v):f.default.createElement("div",{key:e.value,className:"checkbox "+u},f.default.createElement("label",null,v))})))}function ke(e){var t=e.disabled,a=e.readonly,i=r.getTemplate("BaseInputTemplate",e.registry,e.options);return f.default.createElement(i,C({type:"color"},e,{disabled:t||a}))}function Te(e){var a=e.onChange,i=r.getTemplate("BaseInputTemplate",e.registry,e.options),n=t.useCallback((function(e){return a(e||void 0)}),[a]);return f.default.createElement(i,C({type:"date"},e,{onChange:n}))}function xe(e){var t=e.onChange,a=e.value,i=r.getTemplate("BaseInputTemplate",e.registry,e.options);return f.default.createElement(i,C({type:"datetime-local"},e,{value:r.utcToLocal(a),onChange:function(e){return t(r.localToUTC(e))}}))}function Ae(e){var t=r.getTemplate("BaseInputTemplate",e.registry,e.options);return f.default.createElement(t,C({type:"email"},e))}function Ne(e,t){return null===e?null:e.replace(";base64",";name="+encodeURIComponent(t)+";base64")}function we(e){var t=e.name,r=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:Ne(e.target.result,t),name:t,size:r,type:a}):i({dataURL:null,name:t,size:r,type:a})},o.readAsDataURL(e)}))}function Ie(e){var t=e.filesInfo;return 0===t.length?null:f.default.createElement("ul",{className:"file-info"},t.map((function(e,t){var r=e.size,a=e.type;return f.default.createElement("li",{key:t},f.default.createElement("strong",null,e.name)," (",a,", ",r," bytes)")})))}function Be(e){return e.filter((function(e){return void 0!==e})).map((function(e){var t=r.dataURItoBlob(e),a=t.blob;return{name:t.name,size:a.size,type:a.type}}))}function Ue(e){var a=e.multiple,i=e.id,n=e.readonly,o=e.disabled,l=e.onChange,s=e.value,d=e.autofocus,u=void 0!==d&&d,c=e.options,m=t.useMemo((function(){return Array.isArray(s)?Be(s):Be([s])}),[s]),p=t.useState(m),h=p[0],v=p[1],y=t.useCallback((function(e){var t;e.target.files&&(t=e.target.files,Promise.all(Array.from(t).map(we))).then((function(e){v(e);var t=e.map((function(e){return e.dataURL}));l(a?t:t[0])}))}),[a,l]);return f.default.createElement("div",null,f.default.createElement("p",null,f.default.createElement("input",{id:i,name:i,type:"file",disabled:n||o,onChange:y,defaultValue:"",autoFocus:u,multiple:a,accept:c.accept?String(c.accept):void 0,"aria-describedby":r.ariaDescribedByIds(i)})),f.default.createElement(Ie,{filesInfo:h}))}function qe(e){var t=e.id,r=e.value;return f.default.createElement("input",{type:"hidden",id:t,name:t,value:void 0===r?"":r})}function Pe(e){var t=r.getTemplate("BaseInputTemplate",e.registry,e.options);return f.default.createElement(t,C({type:"password"},e))}function Re(e){var a=e.options,i=e.value,n=e.required,o=e.disabled,l=e.readonly,s=e.autofocus,d=void 0!==s&&s,u=e.onBlur,c=e.onFocus,m=e.onChange,p=e.id,h=Math.random().toString(),v=a.enumOptions,y=a.enumDisabled,g=a.inline,E=t.useCallback((function(e){return u(p,e.target.value)}),[u,p]),S=t.useCallback((function(e){return c(p,e.target.value)}),[c,p]);return f.default.createElement("div",{className:"field-radio-group",id:p},Array.isArray(v)&&v.map((function(e,t){var a=e.value===i,s=Array.isArray(y)&&-1!=y.indexOf(e.value),u=o||s||l?"disabled":"",c=f.default.createElement("span",null,f.default.createElement("input",{type:"radio",id:r.optionId(p,e),checked:a,name:h,required:n,value:e.value,disabled:o||s||l,autoFocus:d&&0===t,onChange:function(){return m(e.value)},onBlur:E,onFocus:S,"aria-describedby":r.ariaDescribedByIds(p)}),f.default.createElement("span",null,e.label));return g?f.default.createElement("label",{key:e.value,className:"radio-inline "+u},c):f.default.createElement("div",{key:e.value,className:"radio "+u},f.default.createElement("label",null,c))})))}function _e(e){var t=e.value;return f.default.createElement("div",{className:"field-range-wrapper"},f.default.createElement(e.registry.templates.BaseInputTemplate,C({type:"range"},e)),f.default.createElement("span",{className:"range-view"},t))}function je(e,t){return t?Array.from(e.target.options).slice().filter((function(e){return e.selected})).map((function(e){return e.value})):e.target.value}function Ve(e){var a=e.schema,i=e.id,n=e.options,o=e.value,l=e.required,s=e.disabled,d=e.readonly,u=e.multiple,c=void 0!==u&&u,m=e.autofocus,p=void 0!==m&&m,h=e.onChange,v=e.onBlur,y=e.onFocus,g=e.placeholder,E=n.enumOptions,S=n.enumDisabled,b=c?[]:"",C=t.useCallback((function(e){var t=je(e,c);return y(i,r.processSelectValue(a,t,n))}),[y,i,a,c,n]),F=t.useCallback((function(e){var t=je(e,c);return v(i,r.processSelectValue(a,t,n))}),[v,i,a,c,n]),D=t.useCallback((function(e){var t=je(e,c);return h(r.processSelectValue(a,t,n))}),[h,a,c,n]);return f.default.createElement("select",{id:i,name:i,multiple:c,className:"form-control",value:void 0===o?b:o,required:l,disabled:s||d,autoFocus:p,onBlur:F,onFocus:C,onChange:D,"aria-describedby":r.ariaDescribedByIds(i)},!c&&void 0===a.default&&f.default.createElement("option",{value:""},g),Array.isArray(E)&&E.map((function(e,t){var r=e.value,a=e.label,i=S&&-1!=S.indexOf(r);return f.default.createElement("option",{key:t,value:r,disabled:i},a)})))}function Ke(e){var a=e.id,i=e.options,n=void 0===i?{}:i,o=e.placeholder,l=e.value,s=e.required,d=e.disabled,u=e.readonly,c=e.autofocus,m=void 0!==c&&c,p=e.onChange,h=e.onBlur,v=e.onFocus,y=t.useCallback((function(e){var t=e.target.value;return p(""===t?n.emptyValue:t)}),[p,n.emptyValue]),g=t.useCallback((function(e){return h(a,e.target.value)}),[h,a]),E=t.useCallback((function(e){return v(a,e.target.value)}),[a,v]);return f.default.createElement("textarea",{id:a,name:a,className:"form-control",value:l||"",placeholder:o,required:s,disabled:d,readOnly:u,autoFocus:m,rows:n.rows,onBlur:g,onFocus:E,onChange:y,"aria-describedby":r.ariaDescribedByIds(a)})}function Me(e){var t=r.getTemplate("BaseInputTemplate",e.registry,e.options);return f.default.createElement(t,C({},e))}function We(e){var t=r.getTemplate("BaseInputTemplate",e.registry,e.options);return f.default.createElement(t,C({type:"url"},e))}function Le(e){var t=r.getTemplate("BaseInputTemplate",e.registry,e.options);return f.default.createElement(t,C({type:"number"},e))}function Ye(){return{fields:{AnyOfField:R,ArrayField:I,BooleanField:U,NumberField:V,ObjectField:K,OneOfField:R,SchemaField:Y,StringField:z,NullField:J},templates:{ArrayFieldDescriptionTemplate:H,ArrayFieldItemTemplate:G,ArrayFieldTemplate:X,ArrayFieldTitleTemplate:Z,ButtonTemplates:{SubmitButton:re,AddButton:se,MoveDownButton:ne,MoveUpButton:oe,RemoveButton:le},BaseInputTemplate:te,DescriptionFieldTemplate:de,ErrorListTemplate:ue,FieldTemplate:me,FieldErrorTemplate:fe,FieldHelpTemplate:pe,ObjectFieldTemplate:he,TitleFieldTemplate:ve,UnsupportedFieldTemplate:ye,WrapIfAdditionalTemplate:ge},widgets:{PasswordWidget:Pe,RadioWidget:Re,UpDownWidget:Le,RangeWidget:_e,SelectWidget:Ve,TextWidget:Me,DateWidget:Te,DateTimeWidget:xe,AltDateWidget:be,AltDateTimeWidget:Fe,EmailWidget:Ae,URLWidget:We,TextareaWidget:Ke,HiddenWidget:qe,ColorWidget:ke,FileWidget:Ue,CheckboxWidget:De,CheckboxesWidget:Oe},rootSchema:{},formContext:{}}}Ke.defaultProps={autofocus:!1,options:{}};var $e=function(e){function t(t){var a;if((a=e.call(this,t)||this).formElement=void 0,a.getUsedFormData=function(e,t){if(0===t.length&&"object"!=typeof e)return e;var r=v.default(e,t);return Array.isArray(e)?Object.keys(r).map((function(e){return r[e]})):r},a.getFieldNames=function(e,t){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 l=n.map((function(e){return[].concat(e,[o])}));a[o][r.RJSF_ADDITONAL_PROPERTIES_FLAG]&&""!==a[o][r.NAME_KEY]?i.push(a[o][r.NAME_KEY]):e(a[o],i,l)}else o===r.NAME_KEY&&""!==a[o]&&n.forEach((function(e){var r=p.default(t,e);("object"!=typeof r||h.default(r))&&i.push(e)}))})),i}(e)},a.onChange=function(e,t,i){var n=a.props,o=n.extraErrors,l=n.omitExtraData,s=n.liveOmit,d=n.noValidate,u=n.liveValidate,c=n.onChange,m=a.state,f=m.schemaUtils,p=m.schema;(r.isObject(e)||Array.isArray(e))&&(e=a.getStateFromProps(a.props,e).formData);var h=!d&&u,v={formData:e,schema:p},y=e;if(!0===l&&!0===s){var g=f.retrieveSchema(p,e),E=f.toPathSchema(g,"",e),S=a.getFieldNames(E,e);y=a.getUsedFormData(e,S),v={formData:y}}if(h){var b=a.validate(y),F=b.errors,D=b.errorSchema,O=F,k=D;if(o){var T=f.mergeValidationData(b,o);D=T.errorSchema,F=T.errors}v={formData:y,errors:F,errorSchema:D,schemaValidationErrors:O,schemaValidationErrorSchema:k}}else if(!d&&t){var x=o?r.mergeObjects(t,o,"preventDuplicates"):t;v={formData:y,errorSchema:x,errors:f.getValidator().toErrorList(x)}}a.setState(v,(function(){return c&&c(C({},a.state,v),i)}))},a.onBlur=function(e,t){var r=a.props.onBlur;r&&r(e,t)},a.onFocus=function(e,t){var r=a.props.onFocus;r&&r(e,t)},a.onSubmit=function(e){if(e.preventDefault(),e.target===e.currentTarget){e.persist();var t=a.props,r=t.extraErrors,i=t.noValidate,n=t.onSubmit,o=a.state.formData,l=a.state,s=l.schemaUtils;if(!0===t.omitExtraData){var d=s.retrieveSchema(l.schema,o),u=s.toPathSchema(d,"",o),c=a.getFieldNames(u,o);o=a.getUsedFormData(o,c)}if(i||a.validateForm()){var m=r||{},f=r?s.getValidator().toErrorList(r):[];a.setState({formData:o,errors:f,errorSchema:m,schemaValidationErrors:[],schemaValidationErrorSchema:{}},(function(){n&&n(C({},a.state,{formData:o,status:"submitted"}),e)}))}}},!t.validator)throw new Error("A validator is required for Form functionality to work");return a.state=a.getStateFromProps(t,t.formData),a.props.onChange&&!r.deepEquals(a.state.formData,a.props.formData)&&a.props.onChange(a.state),a.formElement=f.default.createRef(),a}F(t,e);var a=t.prototype;return a.UNSAFE_componentWillReceiveProps=function(e){var 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)},a.getStateFromProps=function(e,t){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!==t,l=o&&!e.noValidate&&("liveValidate"in e?e.liveValidate:this.props.liveValidate),s=i,d=a.schemaUtils;d&&!d.doesSchemaUtilsDiffer(e.validator,s)||(d=r.createSchemaUtils(e.validator,s));var u,c,m=d.getDefaultFormState(i,t),f=d.retrieveSchema(i,m),p=a.schemaValidationErrors,h=a.schemaValidationErrorSchema;if(l){var v=this.validate(m,i,d);p=u=v.errors,h=c=v.errorSchema}else{var y=e.noValidate?{errors:[],errorSchema:{}}:e.liveValidate?{errors:a.errors||[],errorSchema:a.errorSchema||{}}:{errors:a.schemaValidationErrors||[],errorSchema:a.schemaValidationErrorSchema||{}};u=y.errors,c=y.errorSchema}if(e.extraErrors){var g=d.mergeValidationData({errorSchema:c,errors:u},e.extraErrors);c=g.errorSchema,u=g.errors}var E=d.toIdSchema(f,n["ui:rootFieldId"],m,e.idPrefix,e.idSeparator);return{schemaUtils:d,schema:i,uiSchema:n,idSchema:E,formData:m,edit:o,errors:u,errorSchema:c,schemaValidationErrors:p,schemaValidationErrorSchema:h}},a.shouldComponentUpdate=function(e,t){return r.shouldRender(this,e,t)},a.validate=function(e,t,r){void 0===t&&(t=this.props.schema);var a=r||this.state.schemaUtils,i=this.props,n=i.customValidate,o=i.transformErrors,l=i.uiSchema,s=a.retrieveSchema(t,e);return a.getValidator().validateFormData(e,s,n,o,l)},a.renderErrors=function(e){var t=this.state,a=t.errors,i=t.errorSchema,n=t.schema,o=t.uiSchema,l=this.props.formContext,s=r.getUiOptions(o),d=r.getTemplate("ErrorListTemplate",e,s);return a&&a.length?f.default.createElement(d,{errors:a,errorSchema:i||{},schema:n,uiSchema:o,formContext:l}):null},a.getRegistry=function(){var e,t=this.state.schemaUtils,r=Ye(),a=r.templates,i=r.widgets,n=r.formContext;return{fields:C({},r.fields,this.props.fields),templates:C({},a,this.props.templates,{ButtonTemplates:C({},a.ButtonTemplates,null===(e=this.props.templates)||void 0===e?void 0:e.ButtonTemplates)}),widgets:C({},i,this.props.widgets),rootSchema:this.props.schema,formContext:this.props.formContext||n,schemaUtils:t}},a.submit=function(){this.formElement.current&&(this.formElement.current.dispatchEvent(new CustomEvent("submit",{cancelable:!0})),this.formElement.current.requestSubmit())},a.validateForm=function(){var e=this.props,t=e.extraErrors,r=e.onError,a=this.state.schemaUtils,i=this.validate(this.state.formData),n=i.errors,o=i.errorSchema,l=n,s=o;if(n.length>0){if(t){var d=a.mergeValidationData(i,t);o=d.errorSchema,n=d.errors}return this.setState({errors:n,errorSchema:o,schemaValidationErrors:l,schemaValidationErrorSchema:s},(function(){r?r(n):console.error("Form validation failed",n)})),!1}return!0},a.render=function(){var e=this.props,t=e.children,r=e.id,a=e.idPrefix,i=e.idSeparator,n=e.className,o=void 0===n?"":n,l=e.tagName,s=e.name,d=e.method,u=e.target,c=e.action,m=e.autoComplete,p=e.enctype,h=e.acceptcharset,v=e.noHtml5Validate,y=void 0!==v&&v,g=e.disabled,E=void 0!==g&&g,S=e.readonly,b=void 0!==S&&S,C=e.formContext,F=e.showErrorList,D=void 0===F?"top":F,O=e._internalFormWrapper,k=this.state,T=k.schema,x=k.uiSchema,A=k.formData,N=k.errorSchema,w=k.idSchema,I=this.getRegistry(),B=I.fields.SchemaField,U=I.templates.ButtonTemplates.SubmitButton;return f.default.createElement(O||l||"form",{className:o||"rjsf",id:r,name:s,method:d,target:u,action:c,autoComplete:m,encType:p,acceptCharset:h,noValidate:y,onSubmit:this.onSubmit,as:O?l:void 0,ref:this.formElement},"top"===D&&this.renderErrors(I),f.default.createElement(B,{name:"",schema:T,uiSchema:x,errorSchema:N,idSchema:w,idPrefix:a,idSeparator:i,formContext:C,formData:A,onChange:this.onChange,onBlur:this.onBlur,onFocus:this.onFocus,registry:I,disabled:E,readonly:b}),t||f.default.createElement(U,{uiSchema:x,registry:I}),"bottom"===D&&this.renderErrors(I))},t}(t.Component),ze=["fields","widgets","templates"];e.default=$e,e.getDefaultRegistry=Ye,e.withTheme=function(e){return t.forwardRef((function(t,r){var a,i,n=t.fields,o=t.widgets,l=t.templates,s=O(t,ze);return n=C({},null==e?void 0:e.fields,n),o=C({},null==e?void 0:e.widgets,o),l=C({},null==e?void 0:e.templates,l,{ButtonTemplates:C({},null==e||null===(a=e.templates)||void 0===a?void 0:a.ButtonTemplates,null===(i=l)||void 0===i?void 0:i.ButtonTemplates)}),f.default.createElement($e,C({},e,s,{fields:n,widgets:o,templates:l,ref:r}))}))},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=core.umd.production.min.js.map |
{ | ||
"name": "@rjsf/core", | ||
"version": "5.0.0-beta.18", | ||
"version": "5.0.0-beta.19", | ||
"description": "A simple React component capable of building HTML forms out of a JSON schema.", | ||
@@ -55,5 +55,5 @@ "scripts": { | ||
"@babel/register": "^7.18.9", | ||
"@rjsf/utils": "^5.0.0-beta.18", | ||
"@rjsf/validator-ajv6": "^5.0.0-beta.18", | ||
"@rjsf/validator-ajv8": "^5.0.0-beta.18", | ||
"@rjsf/utils": "^5.0.0-beta.19", | ||
"@rjsf/validator-ajv6": "^5.0.0-beta.19", | ||
"@rjsf/validator-ajv8": "^5.0.0-beta.19", | ||
"@types/lodash": "^4.14.191", | ||
@@ -97,3 +97,3 @@ "@types/react": "^17.0.39", | ||
}, | ||
"gitHead": "93bb555d94ce60820b9e473733a699befcee9dc1" | ||
"gitHead": "acf8643a82b43841b01e63f6496edb5f8b65dae8" | ||
} |
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
1986043
11937