New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mstform

Package Overview
Dependencies
Maintainers
1
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mstform - npm Package Compare versions

Comparing version 0.12.0 to 0.12.1

5

CHANGES.md

@@ -0,1 +1,6 @@

# 0.12.1
- We claimed we exposed `mstform/antd` but didn't. Instead, export
`antd.validationProps`. You import `antd` from `mstform` directly.
# 0.12

@@ -2,0 +7,0 @@

2

dist/mstform.js

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("mobx"),require("mobx-state-tree")):"function"==typeof define&&define.amd?define(["mobx","mobx-state-tree"],e):"object"==typeof exports?exports.mstform=e(require("mobx"),require("mobx-state-tree")):t.mstform=e(t.mobx,t["mobx-state-tree"])}(window,function(t,e){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=2)}([function(e,r){e.exports=t},function(t,r){t.exports=e},function(t,e,r){"use strict";r.r(e);var n={value:function(t){return{value:t.raw,onChange:function(e){return t.setRaw(e.target.value)}}},checked:function(t){return{checked:t.raw,onChange:function(e){return t.setRaw(e.target.checked)}}},object:function(t){return{value:t.raw,onChange:function(e){return t.setRaw(e)}}}},o=function(t,e,r,n){return new(r||(r=Promise))(function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(s,a)}u((n=n.apply(t,e||[])).next())})},i=function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},s=function(){return function(t){this.value=t}}(),a=function(){function t(t){this.definition=t,this.emptyRaw=t.emptyRaw,this.defaultControlled=t.defaultControlled?t.defaultControlled:n.object}return t.prototype.convert=function(t){return o(this,void 0,void 0,function(){var e;return i(this,function(r){switch(r.label){case 0:return this.definition.rawValidate?[4,this.definition.rawValidate(t)]:[3,2];case 1:if(!r.sent())return[2,"ConversionError"];r.label=2;case 2:return e=this.definition.convert(t),this.definition.validate?[4,this.definition.validate(e)]:[3,4];case 3:if(!r.sent())return[2,"ConversionError"];r.label=4;case 4:return[2,new s(e)]}})})},t.prototype.render=function(t){return this.definition.render(t)},t}(),u=r(0),c=r(1),p=function(t,e,r,n){var o,i=arguments.length,s=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s},l=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},d=function(t,e,r,n){return new(r||(r=Promise))(function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(s,a)}u((n=n.apply(t,e||[])).next())})},f=function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},h=function(){return{}};function y(t){h=t}var v=function(){function t(t,e,r,n,o){this.state=t,this.definition=e,this.node=r,this.path=n,this.allowedKeys=o,this.keys=null!=o?o:Object.keys(this.definition)}return t.prototype.validate=function(){return d(this,void 0,void 0,function(){var t;return f(this,function(e){switch(e.label){case 0:return t=this.accessors.map(function(t){return t.validate()}),[4,Promise.all(t)];case 1:return[2,e.sent().every(function(t){return t})]}})})},Object.defineProperty(t.prototype,"isValid",{get:function(){return this.accessors.every(function(t){return t.isValid})},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"accessors",{get:function(){var t=this,e=[];return this.keys.forEach(function(r){var n=t.definition[r];n instanceof I?e.push(t.field(r)):n instanceof U&&e.push(t.repeatingForm(r))}),e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"flatAccessors",{get:function(){var t=[];return this.accessors.forEach(function(e){e instanceof g?t.push(e):e instanceof b&&(t.push.apply(t,e.flatAccessors),t.push(e))}),t},enumerable:!0,configurable:!0}),t.prototype.access=function(t){if(this.keys.includes(t))try{return this.field(t)}catch(e){try{return this.repeatingForm(t)}catch(t){return}}},t.prototype.accessBySteps=function(t){var e=t[0],r=t.slice(1),n=this.access(e);return 0===r.length?n:void 0===n?n:n.accessBySteps(r)},t.prototype.getDefinitionEntry=function(t){if(this.keys.includes(t))return this.definition[t]},t.prototype.restricted=function(e){var r=this;return e.forEach(function(t){if(!r.keys.includes(t))throw new Error("Cannot restrict FormAccessor to non-existent key: "+t)}),new t(this.state,this.definition,this.node,this.path,e)},t.prototype.field=function(t){var e=this.getDefinitionEntry(t);if(null==e)throw new Error("Field "+t+" is not in group");if(!(e instanceof I))throw new Error("Not accessing a Field instance");return new g(this.state,e,this.node,this.path,t)},t.prototype.repeatingForm=function(t){var e=this.getDefinitionEntry(t);if(null==e)throw new Error("RepeatingForm "+t+" is not in group");if(!(e instanceof U))throw new Error("Not accessing a RepeatingForm instance");var r=this.node[t];return new b(this.state,e,r,this.path,t)},t.prototype.repeatingField=function(t){},p([u.computed,l("design:type",Boolean),l("design:paramtypes",[])],t.prototype,"isValid",null),p([u.computed,l("design:type",Array),l("design:paramtypes",[])],t.prototype,"accessors",null),p([u.computed,l("design:type",Array),l("design:paramtypes",[])],t.prototype,"flatAccessors",null),t}(),g=function(){function t(t,e,r,n,o){var i=this;this.state=t,this.field=e,this.node=r,this.handleChange=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return d(i,void 0,void 0,function(){var e,r;return f(this,function(n){switch(n.label){case 0:return r=(e=this.field).getRaw.apply(e,t),[4,this.setRaw(r)];case 1:return n.sent(),[2]}})})},this.handleFocus=function(t){null!=i.state.focusFunc&&i.state.focusFunc(t,i)},this.name=o,this.path=n+"/"+o,this.createDerivedReaction()}var e,r,n;return t.prototype.createDerivedReaction=function(){var t=this,e=this.field.derivedFunc;if(null!=e&&!this.state.derivedDisposers.get(this.path)){var r=Object(u.reaction)(function(){return e(t.node)},function(e){t.setRaw(t.field.render(e))});this.state.setDerivedDisposer(this.path,r)}},Object.defineProperty(t.prototype,"addMode",{get:function(){return this.state.addMode(this.path)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"raw",{get:function(){var t=this.state.raw.get(this.path);return void 0!==t?!Object(u.isObservable)(t)||t instanceof Array?Object(u.toJS)(t):t:this.addMode?this.field.converter.emptyRaw:this.field.render(this.value)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){if(this.addMode)throw new Error("Cannot access field in add mode until it has been set once");return this.state.getValue(this.path)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"errorValue",{get:function(){return this.state.getError(this.path)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"canShowValidationMessages",{get:function(){if("rightAfter"===this.state.saveStatus)return!0;var t="before"===this.state.saveStatus?this.state.validationBeforeSave:this.state.validationAfterSave;return"immediate"===t||"no"!==t&&("blur"!==t&&"pause"!==t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"error",{get:function(){return this.canShowValidationMessages?this.errorValue:void 0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isValidating",{get:function(){return this.state.validating.get(this.path)||!1},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"disabled",{get:function(){return this.state.isDisabledFunc(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hidden",{get:function(){return this.state.isHiddenFunc(this)},enumerable:!0,configurable:!0}),t.prototype.validate=function(){return d(this,void 0,void 0,function(){return f(this,function(t){switch(t.label){case 0:return[4,this.setRaw(this.raw)];case 1:return t.sent(),[2,this.isValid]}})})},Object.defineProperty(t.prototype,"isValid",{get:function(){return void 0===this.errorValue},enumerable:!0,configurable:!0}),t.prototype.setRaw=function(t){return d(this,void 0,void 0,function(){var e,r,n,o;return f(this,function(i){switch(i.label){case 0:this.state.setRaw(this.path,t),this.state.setValidating(this.path,!0),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.field.process(t)];case 2:return e=i.sent(),[3,4];case 3:return i.sent(),this.state.setError(this.path,"Something went wrong"),this.state.setValidating(this.path,!1),[2];case 4:if(r=this.state.raw.get(this.path),!u.comparer.structural(r,t))return[2];if(this.state.setValidating(this.path,!1),e instanceof _)return this.state.setError(this.path,e.message),[2];if(this.state.deleteError(this.path),!(e instanceof W))throw new Error("Unknown process result");return"string"==typeof(n=this.state.extraValidationFunc(this,e.value))&&n&&this.state.setError(this.path,n),u.comparer.structural(this.value,e.value)?[2]:(this.state.setValueWithoutRawUpdate(this.path,e.value),null!=(o=this.field.changeFunc)&&o(this.node,e.value),[2])}})})},Object.defineProperty(t.prototype,"inputProps",{get:function(){var t=this.field.controlled(this);return t.disabled=this.disabled,null!=this.state.focusFunc&&(t.onFocus=this.handleFocus),t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"validationProps",{get:function(){return h(this)},enumerable:!0,configurable:!0}),t.prototype.accessBySteps=function(t){throw new Error("Cannot step through field accessor")},p([u.computed,l("design:type",Boolean),l("design:paramtypes",[])],t.prototype,"addMode",null),p([u.computed,l("design:type","function"==typeof(e="undefined"!=typeof R&&R)&&e||Object),l("design:paramtypes",[])],t.prototype,"raw",null),p([u.computed,l("design:type","function"==typeof(r="undefined"!=typeof V&&V)&&r||Object),l("design:paramtypes",[])],t.prototype,"value",null),p([u.computed,l("design:type",Object),l("design:paramtypes",[])],t.prototype,"errorValue",null),p([u.computed,l("design:type",Boolean),l("design:paramtypes",[])],t.prototype,"canShowValidationMessages",null),p([u.computed,l("design:type",Object),l("design:paramtypes",[])],t.prototype,"error",null),p([u.computed,l("design:type",Boolean),l("design:paramtypes",[])],t.prototype,"isValidating",null),p([u.computed,l("design:type",Boolean),l("design:paramtypes",[])],t.prototype,"disabled",null),p([u.computed,l("design:type",Boolean),l("design:paramtypes",[])],t.prototype,"hidden",null),p([u.computed,l("design:type",Boolean),l("design:paramtypes",[])],t.prototype,"isValid",null),p([u.action,l("design:type",Function),l("design:paramtypes",["function"==typeof(n="undefined"!=typeof R&&R)&&n||Object]),l("design:returntype",Promise)],t.prototype,"setRaw",null),p([u.computed,l("design:type",Object),l("design:paramtypes",[])],t.prototype,"inputProps",null),p([u.computed,l("design:type",Object),l("design:paramtypes",[])],t.prototype,"validationProps",null),t}(),b=function(){function t(t,e,r,n,o){this.state=t,this.repeatingForm=e,this.nodes=r,this.name=o,this.path=n+"/"+o}return t.prototype.validate=function(){return d(this,void 0,void 0,function(){var t,e,r,n;return f(this,function(o){switch(o.label){case 0:for(t=[],e=0,r=this.accessors;e<r.length;e++)n=r[e],t.push(n.validate());return[4,Promise.all(t)];case 1:return[2,o.sent().every(function(t){return t})]}})})},Object.defineProperty(t.prototype,"isValid",{get:function(){return this.accessors.every(function(t){return t.isValid})},enumerable:!0,configurable:!0}),t.prototype.index=function(t){return new m(this.state,this.repeatingForm.definition,this.nodes[t],this.path,t)},Object.defineProperty(t.prototype,"disabled",{get:function(){return this.state.isRepeatingFormDisabledFunc(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"accessors",{get:function(){for(var t=[],e=0;e<this.length;e++)t.push(this.index(e));return t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"flatAccessors",{get:function(){var t=[];return this.accessors.forEach(function(e){t.push.apply(t,e.flatAccessors)}),t},enumerable:!0,configurable:!0}),t.prototype.accessBySteps=function(t){var e=t[0],r=t.slice(1),n=parseInt(e,10);if(isNaN(n))throw new Error("Expected index of repeating form");return this.index(n).accessBySteps(r)},Object.defineProperty(t.prototype,"error",{get:function(){return this.state.errors.get(this.path)},enumerable:!0,configurable:!0}),t.prototype.insert=function(t,e){var r=this.path+"/"+t;Object(c.applyPatch)(this.state.node,[{op:"add",path:r,value:e}])},t.prototype.push=function(t){var e=Object(c.resolvePath)(this.state.node,this.path),r=this.path+"/"+e.length;Object(c.applyPatch)(this.state.node,[{op:"add",path:r,value:t}])},t.prototype.remove=function(t){var e=Object(c.resolvePath)(this.state.node,this.path).indexOf(t);if(-1===e)throw new Error("Cannot find node to remove.");Object(c.applyPatch)(this.state.node,[{op:"remove",path:this.path+"/"+e}])},Object.defineProperty(t.prototype,"length",{get:function(){return Object(c.resolvePath)(this.state.node,this.path).length},enumerable:!0,configurable:!0}),p([u.computed,l("design:type",Boolean),l("design:paramtypes",[])],t.prototype,"isValid",null),p([u.computed,l("design:type",Boolean),l("design:paramtypes",[])],t.prototype,"disabled",null),p([u.computed,l("design:type",Array),l("design:paramtypes",[])],t.prototype,"accessors",null),p([u.computed,l("design:type",Array),l("design:paramtypes",[])],t.prototype,"flatAccessors",null),p([u.computed,l("design:type",Object),l("design:paramtypes",[])],t.prototype,"error",null),t}(),m=function(){function t(t,e,r,n,o){this.state=t,this.definition=e,this.node=r,this.index=o,this.path=n+"/"+o,this.formAccessor=new v(t,e,r,n+"/"+o)}return t.prototype.validate=function(){return d(this,void 0,void 0,function(){return f(this,function(t){return[2,this.formAccessor.validate()]})})},Object.defineProperty(t.prototype,"isValid",{get:function(){return this.formAccessor.isValid},enumerable:!0,configurable:!0}),t.prototype.access=function(t){return this.formAccessor.access(t)},t.prototype.accessBySteps=function(t){var e=t[0],r=t.slice(1),n=this.access(e);return 0===r.length?n:void 0!==n?n.accessBySteps(t):void 0},t.prototype.restricted=function(t){return this.formAccessor.restricted(t)},t.prototype.field=function(t){return this.formAccessor.field(t)},t.prototype.repeatingForm=function(t){return this.formAccessor.repeatingForm(t)},Object.defineProperty(t.prototype,"accessors",{get:function(){return this.formAccessor.accessors},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"flatAccessors",{get:function(){return this.formAccessor.flatAccessors},enumerable:!0,configurable:!0}),p([u.computed,l("design:type",Boolean),l("design:paramtypes",[])],t.prototype,"isValid",null),p([u.computed,l("design:type",Array),l("design:paramtypes",[])],t.prototype,"accessors",null),p([u.computed,l("design:type",Array),l("design:paramtypes",[])],t.prototype,"flatAccessors",null),t}();function w(t){return t}function P(t){return t.startsWith("/")&&(t=t.slice(1)),t.split("/")}function j(t){var e=t.join("/");return e.startsWith("/")?e:"/"+e}function O(t){return Number.isInteger(parseInt(t,10))}function E(t,e){return function t(e,r){var n=r[0],o=r.slice(1);if(0===o.length)return e[n];var i=e[n];if(void 0===i)return;return t(i,o)}(t,P(e))}function F(t,e){return function t(e,r){var n=r[0],o=r.slice(1);0===o.length&&delete e[n];var i=e[n];if(void 0===i)return;t(i,o)}(t,P(e))}function S(t,e,r){var n=P(e),o=n[n.length-1],i=parseInt(o,10),s=j(n.slice(0,n.length-1)),a=new Map;return t.forEach(function(t,e){if(e.startsWith(s)){var n=P(e.slice(s.length+1)),o=parseInt(n[0],10);if(isNaN(o))a.set(e,t);else if(o<i)a.set(e,t);else if(o!==i){var u=n.slice(1),c=s+j([(o-1).toString()].concat(u));a.delete(e),a.set(c,t)}else null!=r&&r(t)}else a.set(e,t)}),a}function x(t,e){var r=P(e),n=r[r.length-1],o=parseInt(n,10);if(isNaN(o))return t;var i=j(r.slice(0,r.length-1)),s=new Map;return t.forEach(function(t,e){if(e.startsWith(i)){var r=P(e.slice(i.length+1)),n=parseInt(r[0],10);if(isNaN(n))s.set(e,t);else if(n<o)s.set(e,t);else{var a=r.slice(1),u=i+j([(n+1).toString()].concat(a));s.set(u,t)}}else s.set(e,t)}),s}var A=function(t,e,r,n){var o,i=arguments.length,s=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s},D=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},C=function(t,e,r,n){return new(r||(r=Promise))(function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(s,a)}u((n=n.apply(t,e||[])).next())})},M=function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},k=function(){function t(t,e,r){var n=this;if(this.form=t,this.node=e,this.saveStatus="before",this.raw=u.observable.map(),this.errors=u.observable.map(),this.validating=u.observable.map(),this.addModePaths=u.observable.map(),this.derivedDisposers=u.observable.map(),this.additionalErrorTree={},this.noRawUpdate=!1,Object(c.onPatch)(e,function(t){"remove"===t.op?n.removePath(t.path):"add"===t.op?n.addPath(t.path):"replace"===t.op&&n.setRawFromValue(t.path)}),this.formAccessor=new v(this,this.form.definition,e,""),null==r)this.saveFunc=B,this.isDisabledFunc=function(){return!1},this.isHiddenFunc=function(){return!1},this.isRepeatingFormDisabledFunc=function(){return!1},this.extraValidationFunc=function(){return!1},this.validationBeforeSave="immediate",this.validationAfterSave="immediate",this.validationPauseDuration=0,this.addModePaths.set("/",!1),this.focusFunc=null;else{this.saveFunc=r.save?r.save:B,this.isDisabledFunc=r.isDisabled?r.isDisabled:function(){return!1},this.isHiddenFunc=r.isHidden?r.isHidden:function(){return!1},this.isRepeatingFormDisabledFunc=r.isRepeatingFormDisabled?r.isRepeatingFormDisabled:function(){return!1},this.extraValidationFunc=r.extraValidation?r.extraValidation:function(){return!1},this.addModePaths.set("/",r.addMode||!1);var o=r.validation||{};this.validationBeforeSave=o.beforeSave||"immediate",this.validationAfterSave=o.afterSave||"immediate",this.validationPauseDuration=o.pauseDuration||0,this.focusFunc=r.focus?r.focus:null}}return t.prototype.setError=function(t,e){this.errors.set(t,e)},t.prototype.deleteError=function(t){this.errors.delete(t)},t.prototype.setValidating=function(t,e){this.validating.set(t,e)},t.prototype.setSaveStatus=function(t){this.saveStatus=t},t.prototype.setRaw=function(t,e){"rightAfter"===this.saveStatus&&this.setSaveStatus("after"),this.raw.set(t,e)},t.prototype.setRawFromValue=function(t){if(!this.noRawUpdate){var e=this.accessByPath(t);if(void 0!==e&&e instanceof g){var r=this.getValue(t);this.setRaw(t,e.field.render(r)),e.validate()}}},t.prototype.setValueWithoutRawUpdate=function(t,e){this.noRawUpdate=!0,Object(c.applyPatch)(this.node,[{op:"replace",path:t,value:e}]),this.noRawUpdate=!1},t.prototype.setDerivedDisposer=function(t,e){this.derivedDisposers.set(t,e)},t.prototype.removePath=function(t){this.raw=S(this.raw,t),this.errors=S(this.errors,t),this.validating=S(this.validating,t),this.addModePaths=S(this.addModePaths,t),this.derivedDisposers=S(this.derivedDisposers,t,function(t){t()}),this.addModePaths.set(t,!0)},t.prototype.addPath=function(t){this.raw=x(this.raw,t),this.errors=x(this.errors,t),this.validating=x(this.validating,t),this.addModePaths=x(this.addModePaths,t),this.derivedDisposers=x(this.derivedDisposers,t),this.addModePaths.set(t,!0)},t.prototype.validate=function(){return C(this,void 0,void 0,function(){return M(this,function(t){return[2,this.formAccessor.validate()]})})},Object.defineProperty(t.prototype,"isValid",{get:function(){return this.formAccessor.isValid},enumerable:!0,configurable:!0}),t.prototype.save=function(){return C(this,void 0,void 0,function(){var t,e;return M(this,function(r){switch(r.label){case 0:return[4,this.validate()];case 1:return t=r.sent(),this.setSaveStatus("rightAfter"),t?[4,this.saveFunc(this.node)]:[2,!1];case 2:return null!=(e=r.sent())?(this.setErrors(e),[2,!1]):(this.clearErrors(),[2,!0])}})})},t.prototype.setErrors=function(t){var e=this,r=function(t){return JSON.parse(JSON.stringify(t))}(t);this.flatAccessors.map(function(n){var o=E(t,n.path);null!=o&&(e.errors.set(n.path,o),F(r,n.path))}),this.additionalErrorTree=r},t.prototype.clearErrors=function(){this.additionalErrorTree={},this.errors.clear()},t.prototype.isKnownAddModePath=function(t){var e;return this.addModePaths.forEach(function(r,n){t.startsWith(n)&&(e=r)}),void 0!==e&&e},t.prototype.addMode=function(t){return this.isKnownAddModePath(t)&&void 0===this.raw.get(t)},t.prototype.getValue=function(t){return Object(c.resolvePath)(this.node,t)},t.prototype.getError=function(t){return this.errors.get(t)},t.prototype.getMstType=function(t){for(var e=P(t),r=this.form.model,n=0,o=e;n<o.length;n++){var i=o[n];O(i)?r=r.getChildType(i):r=r.getChildType(i)}return r},Object.defineProperty(t.prototype,"isValidating",{get:function(){return Array.from(this.validating.values()).filter(function(t){return t}).length>0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"accessors",{get:function(){return this.formAccessor.accessors},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"flatAccessors",{get:function(){return this.formAccessor.flatAccessors},enumerable:!0,configurable:!0}),t.prototype.accessByPath=function(t){var e=P(t);return this.accessBySteps(e)},t.prototype.accessBySteps=function(t){return this.formAccessor.accessBySteps(t)},t.prototype.access=function(t){return this.formAccessor.access(t)},t.prototype.restricted=function(t){return this.formAccessor.restricted(t)},t.prototype.field=function(t){return this.formAccessor.field(t)},t.prototype.repeatingForm=function(t){return this.formAccessor.repeatingForm(t)},t.prototype.repeatingField=function(t){},t.prototype.additionalError=function(t){var e=this.additionalErrorTree[t];if("string"==typeof e)return e},Object.defineProperty(t.prototype,"additionalErrors",{get:function(){var t=this,e=[];return Object.keys(this.additionalErrorTree).forEach(function(r){var n=t.additionalErrorTree[r];"string"==typeof n&&e.push(n)}),e.sort(),e},enumerable:!0,configurable:!0}),A([u.observable,D("design:type",Map)],t.prototype,"raw",void 0),A([u.observable,D("design:type",Map)],t.prototype,"errors",void 0),A([u.observable,D("design:type",Object)],t.prototype,"additionalErrorTree",void 0),A([u.observable,D("design:type",Map)],t.prototype,"validating",void 0),A([u.observable,D("design:type",Map)],t.prototype,"addModePaths",void 0),A([u.observable,D("design:type",Map)],t.prototype,"derivedDisposers",void 0),A([u.observable,D("design:type",String)],t.prototype,"saveStatus",void 0),A([u.action,D("design:type",Function),D("design:paramtypes",[String,String]),D("design:returntype",void 0)],t.prototype,"setError",null),A([u.action,D("design:type",Function),D("design:paramtypes",[String]),D("design:returntype",void 0)],t.prototype,"deleteError",null),A([u.action,D("design:type",Function),D("design:paramtypes",[String,Boolean]),D("design:returntype",void 0)],t.prototype,"setValidating",null),A([u.action,D("design:type",Function),D("design:paramtypes",[String]),D("design:returntype",void 0)],t.prototype,"setSaveStatus",null),A([u.action,D("design:type",Function),D("design:paramtypes",[String,Object]),D("design:returntype",void 0)],t.prototype,"setRaw",null),A([u.action,D("design:type",Function),D("design:paramtypes",[String]),D("design:returntype",void 0)],t.prototype,"setRawFromValue",null),A([u.action,D("design:type",Function),D("design:paramtypes",[String,Object]),D("design:returntype",void 0)],t.prototype,"setValueWithoutRawUpdate",null),A([u.action,D("design:type",Function),D("design:paramtypes",[String,Function]),D("design:returntype",void 0)],t.prototype,"setDerivedDisposer",null),A([u.action,D("design:type",Function),D("design:paramtypes",[String]),D("design:returntype",void 0)],t.prototype,"removePath",null),A([u.action,D("design:type",Function),D("design:paramtypes",[String]),D("design:returntype",void 0)],t.prototype,"addPath",null),A([u.computed,D("design:type",Boolean),D("design:paramtypes",[])],t.prototype,"isValid",null),A([u.action,D("design:type",Function),D("design:paramtypes",[]),D("design:returntype",Promise)],t.prototype,"save",null),A([u.action,D("design:type",Function),D("design:paramtypes",[Object]),D("design:returntype",void 0)],t.prototype,"setErrors",null),A([u.action,D("design:type",Function),D("design:paramtypes",[]),D("design:returntype",void 0)],t.prototype,"clearErrors",null),A([u.computed,D("design:type",Boolean),D("design:paramtypes",[])],t.prototype,"isValidating",null),A([u.computed,D("design:type",Array),D("design:paramtypes",[])],t.prototype,"accessors",null),A([u.computed,D("design:type",Array),D("design:paramtypes",[])],t.prototype,"flatAccessors",null),A([u.computed,D("design:type",Array),D("design:paramtypes",[])],t.prototype,"additionalErrors",null),t}();function B(){return C(this,void 0,void 0,function(){return M(this,function(t){return console.warn("No mstform save function configured"),[2,null]})})}var T=function(t,e,r,n){return new(r||(r=Promise))(function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(s,a)}u((n=n.apply(t,e||[])).next())})},N=function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},q=function(){function t(t,e){this.model=t,this.definition=e}return Object.defineProperty(t.prototype,"FormStateType",{get:function(){throw new Error("For introspection")},enumerable:!0,configurable:!0}),t.prototype.state=function(t,e){return new k(this,t,e)},t}(),_=function(){return function(t){this.message=t}}(),W=function(){return function(t){this.value=t}}(),I=function(){function t(t,e){if(this.converter=t,this.options=e,e){if(this.rawValidators=e.rawValidators?e.rawValidators:[],this.validators=e.validators?e.validators:[],this.conversionError=e.conversionError||"Could not convert",this.requiredError=e.requiredError||"Required",this.required=e.required||!1,e.fromEvent){if(e.getRaw)throw new Error("Cannot have fromEvent and getRaw defined at same time");this.getRaw=function(t){return t.target.value}}else this.getRaw=e.getRaw||w;this.derivedFunc=e.derived,this.changeFunc=e.change,this.controlled=e.controlled||this.createDefaultControlled()}else this.rawValidators=[],this.validators=[],this.conversionError="Could not convert",this.requiredError="Required",this.required=!1,this.getRaw=w,this.controlled=this.createDefaultControlled()}return t.prototype.createDefaultControlled=function(){var t=this;return this.getRaw!==w?function(e){return{value:e.raw,onChange:function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return e.setRaw(t.getRaw.apply(t,r))}}}:this.converter.defaultControlled},Object.defineProperty(t.prototype,"RawType",{get:function(){throw new Error("This is a function to enable type introspection")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"ValueType",{get:function(){throw new Error("This is a function to enable type introspection")},enumerable:!0,configurable:!0}),t.prototype.process=function(t){return T(this,void 0,void 0,function(){var e,r,n,o,i,s;return N(this,function(a){switch(a.label){case 0:if(t===this.converter.emptyRaw&&this.required)return[2,new _(this.requiredError)];e=0,r=this.rawValidators,a.label=1;case 1:return e<r.length?[4,(0,r[e])(t)]:[3,4];case 2:if("string"==typeof(s=a.sent())&&s)return[2,new _(s)];a.label=3;case 3:return e++,[3,1];case 4:return[4,this.converter.convert(t)];case 5:if("ConversionError"===(n=a.sent()))return t===this.converter.emptyRaw?[2,new _(this.requiredError)]:[2,new _(this.conversionError)];o=0,i=this.validators,a.label=6;case 6:return o<i.length?[4,(0,i[o])(n.value)]:[3,9];case 7:if("string"==typeof(s=a.sent())&&s)return[2,new _(s)];a.label=8;case 8:return o++,[3,6];case 9:return[2,new W(n.value)]}})})},t.prototype.render=function(t){return this.converter.render(t)},t}(),U=function(){return function(t){this.definition=t}}(),G=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),H=function(t,e,r,n){return new(r||(r=Promise))(function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(s,a)}u((n=n.apply(t,e||[])).next())})},K=function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},J=new RegExp("^-?(0|[1-9]\\d*)(\\.\\d*)?$"),$=new RegExp("^-?(0|[1-9]\\d*)$"),z=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.defaultControlled=n.value,e}return G(e,t),e}(a),L=new z({emptyRaw:"",convert:function(t){return t},render:function(t){return t}}),Q=new z({emptyRaw:"",rawValidate:function(t){return t.startsWith(".")&&(t="0"+t),J.test(t)},convert:function(t){return+t},render:function(t){return t.toString()}}),X=new z({emptyRaw:"",rawValidate:function(t){return $.test(t)},convert:function(t){return+t},render:function(t){return t.toString()}}),Y=new a({emptyRaw:!1,convert:function(t){return t},render:function(t){return t},defaultControlled:n.checked}),Z=function(){function t(t,e){this.maxWholeDigits=t,this.decimalPlaces=e,this.defaultControlled=n.value,this.emptyRaw="";var r=new RegExp("^-?(0|[1-9]\\d{0,"+(t-1)+"})(\\.\\d{0,"+e+"})?$");this.converter=new z({emptyRaw:"",rawValidate:function(t){return t.startsWith(".")&&(t="0"+t),r.test(t)},convert:function(t){return t},render:function(t){return t}})}return t.prototype.convert=function(t){return this.converter.convert(t)},t.prototype.render=function(t){return this.converter.render(t)},t.prototype.getRaw=function(t){return t},t}();var tt=new a({emptyRaw:[],convert:function(t){return u.observable.array(t)},render:function(t){return t.slice()}});var et=function(){function t(t){this.converter=t,this.defaultControlled=n.value,this.emptyRaw=""}return t.prototype.convert=function(t){return H(this,void 0,void 0,function(){return K(this,function(e){return""===t.trim()?[2,new s(null)]:[2,this.converter.convert(t)]})})},t.prototype.render=function(t){return null===t?"":this.converter.render(t)},t}(),rt=function(){function t(t){this.emptyRaw=null,this.defaultControlled=n.object}return t.prototype.convert=function(t){return H(this,void 0,void 0,function(){return K(this,function(e){return null===t?[2,"ConversionError"]:[2,new s(t)]})})},t.prototype.render=function(t){return t},t}();var nt={string:L,number:Q,integer:X,decimal:function(t,e){return new Z(t,e)},boolean:Y,stringArray:tt,maybe:function(t){return t instanceof z?new et(t):new a({emptyRaw:null,convert:w,render:w,defaultControlled:n.object})},model:function(t){return new rt(t)},object:new a({emptyRaw:null,convert:w,render:w})},ot=function(){function t(t,e){this.model=t,this.allowedKeys=e}return t.prototype.access=function(t){return t.restricted(this.allowedKeys)},t}();r.d(e,"Form",function(){return q}),r.d(e,"ValidationMessage",function(){return _}),r.d(e,"ProcessValue",function(){return W}),r.d(e,"Field",function(){return I}),r.d(e,"RepeatingForm",function(){return U}),r.d(e,"ConversionValue",function(){return s}),r.d(e,"CONVERSION_ERROR",function(){return"ConversionError"}),r.d(e,"Converter",function(){return a}),r.d(e,"StringConverter",function(){return z}),r.d(e,"converters",function(){return nt}),r.d(e,"setupValidationProps",function(){return y}),r.d(e,"FormAccessor",function(){return v}),r.d(e,"FieldAccessor",function(){return g}),r.d(e,"RepeatingFormAccessor",function(){return b}),r.d(e,"RepeatingFormIndexedAccessor",function(){return m}),r.d(e,"controlled",function(){return n}),r.d(e,"Group",function(){return ot})}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("mobx"),require("mobx-state-tree")):"function"==typeof define&&define.amd?define(["mobx","mobx-state-tree"],e):"object"==typeof exports?exports.mstform=e(require("mobx"),require("mobx-state-tree")):t.mstform=e(t.mobx,t["mobx-state-tree"])}(window,function(t,e){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=2)}([function(e,r){e.exports=t},function(t,r){t.exports=e},function(t,e,r){"use strict";r.r(e);var n={value:function(t){return{value:t.raw,onChange:function(e){return t.setRaw(e.target.value)}}},checked:function(t){return{checked:t.raw,onChange:function(e){return t.setRaw(e.target.checked)}}},object:function(t){return{value:t.raw,onChange:function(e){return t.setRaw(e)}}}},o=function(t,e,r,n){return new(r||(r=Promise))(function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(s,a)}u((n=n.apply(t,e||[])).next())})},i=function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},s=function(){return function(t){this.value=t}}(),a=function(){function t(t){this.definition=t,this.emptyRaw=t.emptyRaw,this.defaultControlled=t.defaultControlled?t.defaultControlled:n.object}return t.prototype.convert=function(t){return o(this,void 0,void 0,function(){var e;return i(this,function(r){switch(r.label){case 0:return this.definition.rawValidate?[4,this.definition.rawValidate(t)]:[3,2];case 1:if(!r.sent())return[2,"ConversionError"];r.label=2;case 2:return e=this.definition.convert(t),this.definition.validate?[4,this.definition.validate(e)]:[3,4];case 3:if(!r.sent())return[2,"ConversionError"];r.label=4;case 4:return[2,new s(e)]}})})},t.prototype.render=function(t){return this.definition.render(t)},t}(),u=r(0),c=r(1),p=function(t,e,r,n){var o,i=arguments.length,s=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s},l=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},d=function(t,e,r,n){return new(r||(r=Promise))(function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(s,a)}u((n=n.apply(t,e||[])).next())})},f=function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},h=function(){return{}};function y(t){h=t}var v=function(){function t(t,e,r,n,o){this.state=t,this.definition=e,this.node=r,this.path=n,this.allowedKeys=o,this.keys=null!=o?o:Object.keys(this.definition)}return t.prototype.validate=function(){return d(this,void 0,void 0,function(){var t;return f(this,function(e){switch(e.label){case 0:return t=this.accessors.map(function(t){return t.validate()}),[4,Promise.all(t)];case 1:return[2,e.sent().every(function(t){return t})]}})})},Object.defineProperty(t.prototype,"isValid",{get:function(){return this.accessors.every(function(t){return t.isValid})},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"accessors",{get:function(){var t=this,e=[];return this.keys.forEach(function(r){var n=t.definition[r];n instanceof I?e.push(t.field(r)):n instanceof U&&e.push(t.repeatingForm(r))}),e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"flatAccessors",{get:function(){var t=[];return this.accessors.forEach(function(e){e instanceof g?t.push(e):e instanceof b&&(t.push.apply(t,e.flatAccessors),t.push(e))}),t},enumerable:!0,configurable:!0}),t.prototype.access=function(t){if(this.keys.includes(t))try{return this.field(t)}catch(e){try{return this.repeatingForm(t)}catch(t){return}}},t.prototype.accessBySteps=function(t){var e=t[0],r=t.slice(1),n=this.access(e);return 0===r.length?n:void 0===n?n:n.accessBySteps(r)},t.prototype.getDefinitionEntry=function(t){if(this.keys.includes(t))return this.definition[t]},t.prototype.restricted=function(e){var r=this;return e.forEach(function(t){if(!r.keys.includes(t))throw new Error("Cannot restrict FormAccessor to non-existent key: "+t)}),new t(this.state,this.definition,this.node,this.path,e)},t.prototype.field=function(t){var e=this.getDefinitionEntry(t);if(null==e)throw new Error("Field "+t+" is not in group");if(!(e instanceof I))throw new Error("Not accessing a Field instance");return new g(this.state,e,this.node,this.path,t)},t.prototype.repeatingForm=function(t){var e=this.getDefinitionEntry(t);if(null==e)throw new Error("RepeatingForm "+t+" is not in group");if(!(e instanceof U))throw new Error("Not accessing a RepeatingForm instance");var r=this.node[t];return new b(this.state,e,r,this.path,t)},t.prototype.repeatingField=function(t){},p([u.computed,l("design:type",Boolean),l("design:paramtypes",[])],t.prototype,"isValid",null),p([u.computed,l("design:type",Array),l("design:paramtypes",[])],t.prototype,"accessors",null),p([u.computed,l("design:type",Array),l("design:paramtypes",[])],t.prototype,"flatAccessors",null),t}(),g=function(){function t(t,e,r,n,o){var i=this;this.state=t,this.field=e,this.node=r,this.handleChange=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return d(i,void 0,void 0,function(){var e,r;return f(this,function(n){switch(n.label){case 0:return r=(e=this.field).getRaw.apply(e,t),[4,this.setRaw(r)];case 1:return n.sent(),[2]}})})},this.handleFocus=function(t){null!=i.state.focusFunc&&i.state.focusFunc(t,i)},this.name=o,this.path=n+"/"+o,this.createDerivedReaction()}var e,r,n;return t.prototype.createDerivedReaction=function(){var t=this,e=this.field.derivedFunc;if(null!=e&&!this.state.derivedDisposers.get(this.path)){var r=Object(u.reaction)(function(){return e(t.node)},function(e){t.setRaw(t.field.render(e))});this.state.setDerivedDisposer(this.path,r)}},Object.defineProperty(t.prototype,"addMode",{get:function(){return this.state.addMode(this.path)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"raw",{get:function(){var t=this.state.raw.get(this.path);return void 0!==t?!Object(u.isObservable)(t)||t instanceof Array?Object(u.toJS)(t):t:this.addMode?this.field.converter.emptyRaw:this.field.render(this.value)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){if(this.addMode)throw new Error("Cannot access field in add mode until it has been set once");return this.state.getValue(this.path)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"errorValue",{get:function(){return this.state.getError(this.path)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"canShowValidationMessages",{get:function(){if("rightAfter"===this.state.saveStatus)return!0;var t="before"===this.state.saveStatus?this.state.validationBeforeSave:this.state.validationAfterSave;return"immediate"===t||"no"!==t&&("blur"!==t&&"pause"!==t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"error",{get:function(){return this.canShowValidationMessages?this.errorValue:void 0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isValidating",{get:function(){return this.state.validating.get(this.path)||!1},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"disabled",{get:function(){return this.state.isDisabledFunc(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hidden",{get:function(){return this.state.isHiddenFunc(this)},enumerable:!0,configurable:!0}),t.prototype.validate=function(){return d(this,void 0,void 0,function(){return f(this,function(t){switch(t.label){case 0:return[4,this.setRaw(this.raw)];case 1:return t.sent(),[2,this.isValid]}})})},Object.defineProperty(t.prototype,"isValid",{get:function(){return void 0===this.errorValue},enumerable:!0,configurable:!0}),t.prototype.setRaw=function(t){return d(this,void 0,void 0,function(){var e,r,n,o;return f(this,function(i){switch(i.label){case 0:this.state.setRaw(this.path,t),this.state.setValidating(this.path,!0),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.field.process(t)];case 2:return e=i.sent(),[3,4];case 3:return i.sent(),this.state.setError(this.path,"Something went wrong"),this.state.setValidating(this.path,!1),[2];case 4:if(r=this.state.raw.get(this.path),!u.comparer.structural(r,t))return[2];if(this.state.setValidating(this.path,!1),e instanceof _)return this.state.setError(this.path,e.message),[2];if(this.state.deleteError(this.path),!(e instanceof W))throw new Error("Unknown process result");return"string"==typeof(n=this.state.extraValidationFunc(this,e.value))&&n&&this.state.setError(this.path,n),u.comparer.structural(this.value,e.value)?[2]:(this.state.setValueWithoutRawUpdate(this.path,e.value),null!=(o=this.field.changeFunc)&&o(this.node,e.value),[2])}})})},Object.defineProperty(t.prototype,"inputProps",{get:function(){var t=this.field.controlled(this);return t.disabled=this.disabled,null!=this.state.focusFunc&&(t.onFocus=this.handleFocus),t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"validationProps",{get:function(){return h(this)},enumerable:!0,configurable:!0}),t.prototype.accessBySteps=function(t){throw new Error("Cannot step through field accessor")},p([u.computed,l("design:type",Boolean),l("design:paramtypes",[])],t.prototype,"addMode",null),p([u.computed,l("design:type","function"==typeof(e="undefined"!=typeof R&&R)&&e||Object),l("design:paramtypes",[])],t.prototype,"raw",null),p([u.computed,l("design:type","function"==typeof(r="undefined"!=typeof V&&V)&&r||Object),l("design:paramtypes",[])],t.prototype,"value",null),p([u.computed,l("design:type",Object),l("design:paramtypes",[])],t.prototype,"errorValue",null),p([u.computed,l("design:type",Boolean),l("design:paramtypes",[])],t.prototype,"canShowValidationMessages",null),p([u.computed,l("design:type",Object),l("design:paramtypes",[])],t.prototype,"error",null),p([u.computed,l("design:type",Boolean),l("design:paramtypes",[])],t.prototype,"isValidating",null),p([u.computed,l("design:type",Boolean),l("design:paramtypes",[])],t.prototype,"disabled",null),p([u.computed,l("design:type",Boolean),l("design:paramtypes",[])],t.prototype,"hidden",null),p([u.computed,l("design:type",Boolean),l("design:paramtypes",[])],t.prototype,"isValid",null),p([u.action,l("design:type",Function),l("design:paramtypes",["function"==typeof(n="undefined"!=typeof R&&R)&&n||Object]),l("design:returntype",Promise)],t.prototype,"setRaw",null),p([u.computed,l("design:type",Object),l("design:paramtypes",[])],t.prototype,"inputProps",null),p([u.computed,l("design:type",Object),l("design:paramtypes",[])],t.prototype,"validationProps",null),t}(),b=function(){function t(t,e,r,n,o){this.state=t,this.repeatingForm=e,this.nodes=r,this.name=o,this.path=n+"/"+o}return t.prototype.validate=function(){return d(this,void 0,void 0,function(){var t,e,r,n;return f(this,function(o){switch(o.label){case 0:for(t=[],e=0,r=this.accessors;e<r.length;e++)n=r[e],t.push(n.validate());return[4,Promise.all(t)];case 1:return[2,o.sent().every(function(t){return t})]}})})},Object.defineProperty(t.prototype,"isValid",{get:function(){return this.accessors.every(function(t){return t.isValid})},enumerable:!0,configurable:!0}),t.prototype.index=function(t){return new m(this.state,this.repeatingForm.definition,this.nodes[t],this.path,t)},Object.defineProperty(t.prototype,"disabled",{get:function(){return this.state.isRepeatingFormDisabledFunc(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"accessors",{get:function(){for(var t=[],e=0;e<this.length;e++)t.push(this.index(e));return t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"flatAccessors",{get:function(){var t=[];return this.accessors.forEach(function(e){t.push.apply(t,e.flatAccessors)}),t},enumerable:!0,configurable:!0}),t.prototype.accessBySteps=function(t){var e=t[0],r=t.slice(1),n=parseInt(e,10);if(isNaN(n))throw new Error("Expected index of repeating form");return this.index(n).accessBySteps(r)},Object.defineProperty(t.prototype,"error",{get:function(){return this.state.errors.get(this.path)},enumerable:!0,configurable:!0}),t.prototype.insert=function(t,e){var r=this.path+"/"+t;Object(c.applyPatch)(this.state.node,[{op:"add",path:r,value:e}])},t.prototype.push=function(t){var e=Object(c.resolvePath)(this.state.node,this.path),r=this.path+"/"+e.length;Object(c.applyPatch)(this.state.node,[{op:"add",path:r,value:t}])},t.prototype.remove=function(t){var e=Object(c.resolvePath)(this.state.node,this.path).indexOf(t);if(-1===e)throw new Error("Cannot find node to remove.");Object(c.applyPatch)(this.state.node,[{op:"remove",path:this.path+"/"+e}])},Object.defineProperty(t.prototype,"length",{get:function(){return Object(c.resolvePath)(this.state.node,this.path).length},enumerable:!0,configurable:!0}),p([u.computed,l("design:type",Boolean),l("design:paramtypes",[])],t.prototype,"isValid",null),p([u.computed,l("design:type",Boolean),l("design:paramtypes",[])],t.prototype,"disabled",null),p([u.computed,l("design:type",Array),l("design:paramtypes",[])],t.prototype,"accessors",null),p([u.computed,l("design:type",Array),l("design:paramtypes",[])],t.prototype,"flatAccessors",null),p([u.computed,l("design:type",Object),l("design:paramtypes",[])],t.prototype,"error",null),t}(),m=function(){function t(t,e,r,n,o){this.state=t,this.definition=e,this.node=r,this.index=o,this.path=n+"/"+o,this.formAccessor=new v(t,e,r,n+"/"+o)}return t.prototype.validate=function(){return d(this,void 0,void 0,function(){return f(this,function(t){return[2,this.formAccessor.validate()]})})},Object.defineProperty(t.prototype,"isValid",{get:function(){return this.formAccessor.isValid},enumerable:!0,configurable:!0}),t.prototype.access=function(t){return this.formAccessor.access(t)},t.prototype.accessBySteps=function(t){var e=t[0],r=t.slice(1),n=this.access(e);return 0===r.length?n:void 0!==n?n.accessBySteps(t):void 0},t.prototype.restricted=function(t){return this.formAccessor.restricted(t)},t.prototype.field=function(t){return this.formAccessor.field(t)},t.prototype.repeatingForm=function(t){return this.formAccessor.repeatingForm(t)},Object.defineProperty(t.prototype,"accessors",{get:function(){return this.formAccessor.accessors},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"flatAccessors",{get:function(){return this.formAccessor.flatAccessors},enumerable:!0,configurable:!0}),p([u.computed,l("design:type",Boolean),l("design:paramtypes",[])],t.prototype,"isValid",null),p([u.computed,l("design:type",Array),l("design:paramtypes",[])],t.prototype,"accessors",null),p([u.computed,l("design:type",Array),l("design:paramtypes",[])],t.prototype,"flatAccessors",null),t}();function w(t){return t}function P(t){return t.startsWith("/")&&(t=t.slice(1)),t.split("/")}function j(t){var e=t.join("/");return e.startsWith("/")?e:"/"+e}function O(t){return Number.isInteger(parseInt(t,10))}function E(t,e){return function t(e,r){var n=r[0],o=r.slice(1);if(0===o.length)return e[n];var i=e[n];if(void 0===i)return;return t(i,o)}(t,P(e))}function F(t,e){return function t(e,r){var n=r[0],o=r.slice(1);0===o.length&&delete e[n];var i=e[n];if(void 0===i)return;t(i,o)}(t,P(e))}function S(t,e,r){var n=P(e),o=n[n.length-1],i=parseInt(o,10),s=j(n.slice(0,n.length-1)),a=new Map;return t.forEach(function(t,e){if(e.startsWith(s)){var n=P(e.slice(s.length+1)),o=parseInt(n[0],10);if(isNaN(o))a.set(e,t);else if(o<i)a.set(e,t);else if(o!==i){var u=n.slice(1),c=s+j([(o-1).toString()].concat(u));a.delete(e),a.set(c,t)}else null!=r&&r(t)}else a.set(e,t)}),a}function x(t,e){var r=P(e),n=r[r.length-1],o=parseInt(n,10);if(isNaN(o))return t;var i=j(r.slice(0,r.length-1)),s=new Map;return t.forEach(function(t,e){if(e.startsWith(i)){var r=P(e.slice(i.length+1)),n=parseInt(r[0],10);if(isNaN(n))s.set(e,t);else if(n<o)s.set(e,t);else{var a=r.slice(1),u=i+j([(n+1).toString()].concat(a));s.set(u,t)}}else s.set(e,t)}),s}var A=function(t,e,r,n){var o,i=arguments.length,s=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s},D=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},C=function(t,e,r,n){return new(r||(r=Promise))(function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(s,a)}u((n=n.apply(t,e||[])).next())})},M=function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},k=function(){function t(t,e,r){var n=this;if(this.form=t,this.node=e,this.saveStatus="before",this.raw=u.observable.map(),this.errors=u.observable.map(),this.validating=u.observable.map(),this.addModePaths=u.observable.map(),this.derivedDisposers=u.observable.map(),this.additionalErrorTree={},this.noRawUpdate=!1,Object(c.onPatch)(e,function(t){"remove"===t.op?n.removePath(t.path):"add"===t.op?n.addPath(t.path):"replace"===t.op&&n.setRawFromValue(t.path)}),this.formAccessor=new v(this,this.form.definition,e,""),null==r)this.saveFunc=B,this.isDisabledFunc=function(){return!1},this.isHiddenFunc=function(){return!1},this.isRepeatingFormDisabledFunc=function(){return!1},this.extraValidationFunc=function(){return!1},this.validationBeforeSave="immediate",this.validationAfterSave="immediate",this.validationPauseDuration=0,this.addModePaths.set("/",!1),this.focusFunc=null;else{this.saveFunc=r.save?r.save:B,this.isDisabledFunc=r.isDisabled?r.isDisabled:function(){return!1},this.isHiddenFunc=r.isHidden?r.isHidden:function(){return!1},this.isRepeatingFormDisabledFunc=r.isRepeatingFormDisabled?r.isRepeatingFormDisabled:function(){return!1},this.extraValidationFunc=r.extraValidation?r.extraValidation:function(){return!1},this.addModePaths.set("/",r.addMode||!1);var o=r.validation||{};this.validationBeforeSave=o.beforeSave||"immediate",this.validationAfterSave=o.afterSave||"immediate",this.validationPauseDuration=o.pauseDuration||0,this.focusFunc=r.focus?r.focus:null}}return t.prototype.setError=function(t,e){this.errors.set(t,e)},t.prototype.deleteError=function(t){this.errors.delete(t)},t.prototype.setValidating=function(t,e){this.validating.set(t,e)},t.prototype.setSaveStatus=function(t){this.saveStatus=t},t.prototype.setRaw=function(t,e){"rightAfter"===this.saveStatus&&this.setSaveStatus("after"),this.raw.set(t,e)},t.prototype.setRawFromValue=function(t){if(!this.noRawUpdate){var e=this.accessByPath(t);if(void 0!==e&&e instanceof g){var r=this.getValue(t);this.setRaw(t,e.field.render(r)),e.validate()}}},t.prototype.setValueWithoutRawUpdate=function(t,e){this.noRawUpdate=!0,Object(c.applyPatch)(this.node,[{op:"replace",path:t,value:e}]),this.noRawUpdate=!1},t.prototype.setDerivedDisposer=function(t,e){this.derivedDisposers.set(t,e)},t.prototype.removePath=function(t){this.raw=S(this.raw,t),this.errors=S(this.errors,t),this.validating=S(this.validating,t),this.addModePaths=S(this.addModePaths,t),this.derivedDisposers=S(this.derivedDisposers,t,function(t){t()}),this.addModePaths.set(t,!0)},t.prototype.addPath=function(t){this.raw=x(this.raw,t),this.errors=x(this.errors,t),this.validating=x(this.validating,t),this.addModePaths=x(this.addModePaths,t),this.derivedDisposers=x(this.derivedDisposers,t),this.addModePaths.set(t,!0)},t.prototype.validate=function(){return C(this,void 0,void 0,function(){return M(this,function(t){return[2,this.formAccessor.validate()]})})},Object.defineProperty(t.prototype,"isValid",{get:function(){return this.formAccessor.isValid},enumerable:!0,configurable:!0}),t.prototype.save=function(){return C(this,void 0,void 0,function(){var t,e;return M(this,function(r){switch(r.label){case 0:return[4,this.validate()];case 1:return t=r.sent(),this.setSaveStatus("rightAfter"),t?[4,this.saveFunc(this.node)]:[2,!1];case 2:return null!=(e=r.sent())?(this.setErrors(e),[2,!1]):(this.clearErrors(),[2,!0])}})})},t.prototype.setErrors=function(t){var e=this,r=function(t){return JSON.parse(JSON.stringify(t))}(t);this.flatAccessors.map(function(n){var o=E(t,n.path);null!=o&&(e.errors.set(n.path,o),F(r,n.path))}),this.additionalErrorTree=r},t.prototype.clearErrors=function(){this.additionalErrorTree={},this.errors.clear()},t.prototype.isKnownAddModePath=function(t){var e;return this.addModePaths.forEach(function(r,n){t.startsWith(n)&&(e=r)}),void 0!==e&&e},t.prototype.addMode=function(t){return this.isKnownAddModePath(t)&&void 0===this.raw.get(t)},t.prototype.getValue=function(t){return Object(c.resolvePath)(this.node,t)},t.prototype.getError=function(t){return this.errors.get(t)},t.prototype.getMstType=function(t){for(var e=P(t),r=this.form.model,n=0,o=e;n<o.length;n++){var i=o[n];O(i)?r=r.getChildType(i):r=r.getChildType(i)}return r},Object.defineProperty(t.prototype,"isValidating",{get:function(){return Array.from(this.validating.values()).filter(function(t){return t}).length>0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"accessors",{get:function(){return this.formAccessor.accessors},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"flatAccessors",{get:function(){return this.formAccessor.flatAccessors},enumerable:!0,configurable:!0}),t.prototype.accessByPath=function(t){var e=P(t);return this.accessBySteps(e)},t.prototype.accessBySteps=function(t){return this.formAccessor.accessBySteps(t)},t.prototype.access=function(t){return this.formAccessor.access(t)},t.prototype.restricted=function(t){return this.formAccessor.restricted(t)},t.prototype.field=function(t){return this.formAccessor.field(t)},t.prototype.repeatingForm=function(t){return this.formAccessor.repeatingForm(t)},t.prototype.repeatingField=function(t){},t.prototype.additionalError=function(t){var e=this.additionalErrorTree[t];if("string"==typeof e)return e},Object.defineProperty(t.prototype,"additionalErrors",{get:function(){var t=this,e=[];return Object.keys(this.additionalErrorTree).forEach(function(r){var n=t.additionalErrorTree[r];"string"==typeof n&&e.push(n)}),e.sort(),e},enumerable:!0,configurable:!0}),A([u.observable,D("design:type",Map)],t.prototype,"raw",void 0),A([u.observable,D("design:type",Map)],t.prototype,"errors",void 0),A([u.observable,D("design:type",Object)],t.prototype,"additionalErrorTree",void 0),A([u.observable,D("design:type",Map)],t.prototype,"validating",void 0),A([u.observable,D("design:type",Map)],t.prototype,"addModePaths",void 0),A([u.observable,D("design:type",Map)],t.prototype,"derivedDisposers",void 0),A([u.observable,D("design:type",String)],t.prototype,"saveStatus",void 0),A([u.action,D("design:type",Function),D("design:paramtypes",[String,String]),D("design:returntype",void 0)],t.prototype,"setError",null),A([u.action,D("design:type",Function),D("design:paramtypes",[String]),D("design:returntype",void 0)],t.prototype,"deleteError",null),A([u.action,D("design:type",Function),D("design:paramtypes",[String,Boolean]),D("design:returntype",void 0)],t.prototype,"setValidating",null),A([u.action,D("design:type",Function),D("design:paramtypes",[String]),D("design:returntype",void 0)],t.prototype,"setSaveStatus",null),A([u.action,D("design:type",Function),D("design:paramtypes",[String,Object]),D("design:returntype",void 0)],t.prototype,"setRaw",null),A([u.action,D("design:type",Function),D("design:paramtypes",[String]),D("design:returntype",void 0)],t.prototype,"setRawFromValue",null),A([u.action,D("design:type",Function),D("design:paramtypes",[String,Object]),D("design:returntype",void 0)],t.prototype,"setValueWithoutRawUpdate",null),A([u.action,D("design:type",Function),D("design:paramtypes",[String,Function]),D("design:returntype",void 0)],t.prototype,"setDerivedDisposer",null),A([u.action,D("design:type",Function),D("design:paramtypes",[String]),D("design:returntype",void 0)],t.prototype,"removePath",null),A([u.action,D("design:type",Function),D("design:paramtypes",[String]),D("design:returntype",void 0)],t.prototype,"addPath",null),A([u.computed,D("design:type",Boolean),D("design:paramtypes",[])],t.prototype,"isValid",null),A([u.action,D("design:type",Function),D("design:paramtypes",[]),D("design:returntype",Promise)],t.prototype,"save",null),A([u.action,D("design:type",Function),D("design:paramtypes",[Object]),D("design:returntype",void 0)],t.prototype,"setErrors",null),A([u.action,D("design:type",Function),D("design:paramtypes",[]),D("design:returntype",void 0)],t.prototype,"clearErrors",null),A([u.computed,D("design:type",Boolean),D("design:paramtypes",[])],t.prototype,"isValidating",null),A([u.computed,D("design:type",Array),D("design:paramtypes",[])],t.prototype,"accessors",null),A([u.computed,D("design:type",Array),D("design:paramtypes",[])],t.prototype,"flatAccessors",null),A([u.computed,D("design:type",Array),D("design:paramtypes",[])],t.prototype,"additionalErrors",null),t}();function B(){return C(this,void 0,void 0,function(){return M(this,function(t){return console.warn("No mstform save function configured"),[2,null]})})}var T=function(t,e,r,n){return new(r||(r=Promise))(function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(s,a)}u((n=n.apply(t,e||[])).next())})},N=function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},q=function(){function t(t,e){this.model=t,this.definition=e}return Object.defineProperty(t.prototype,"FormStateType",{get:function(){throw new Error("For introspection")},enumerable:!0,configurable:!0}),t.prototype.state=function(t,e){return new k(this,t,e)},t}(),_=function(){return function(t){this.message=t}}(),W=function(){return function(t){this.value=t}}(),I=function(){function t(t,e){if(this.converter=t,this.options=e,e){if(this.rawValidators=e.rawValidators?e.rawValidators:[],this.validators=e.validators?e.validators:[],this.conversionError=e.conversionError||"Could not convert",this.requiredError=e.requiredError||"Required",this.required=e.required||!1,e.fromEvent){if(e.getRaw)throw new Error("Cannot have fromEvent and getRaw defined at same time");this.getRaw=function(t){return t.target.value}}else this.getRaw=e.getRaw||w;this.derivedFunc=e.derived,this.changeFunc=e.change,this.controlled=e.controlled||this.createDefaultControlled()}else this.rawValidators=[],this.validators=[],this.conversionError="Could not convert",this.requiredError="Required",this.required=!1,this.getRaw=w,this.controlled=this.createDefaultControlled()}return t.prototype.createDefaultControlled=function(){var t=this;return this.getRaw!==w?function(e){return{value:e.raw,onChange:function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return e.setRaw(t.getRaw.apply(t,r))}}}:this.converter.defaultControlled},Object.defineProperty(t.prototype,"RawType",{get:function(){throw new Error("This is a function to enable type introspection")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"ValueType",{get:function(){throw new Error("This is a function to enable type introspection")},enumerable:!0,configurable:!0}),t.prototype.process=function(t){return T(this,void 0,void 0,function(){var e,r,n,o,i,s;return N(this,function(a){switch(a.label){case 0:if(t===this.converter.emptyRaw&&this.required)return[2,new _(this.requiredError)];e=0,r=this.rawValidators,a.label=1;case 1:return e<r.length?[4,(0,r[e])(t)]:[3,4];case 2:if("string"==typeof(s=a.sent())&&s)return[2,new _(s)];a.label=3;case 3:return e++,[3,1];case 4:return[4,this.converter.convert(t)];case 5:if("ConversionError"===(n=a.sent()))return t===this.converter.emptyRaw?[2,new _(this.requiredError)]:[2,new _(this.conversionError)];o=0,i=this.validators,a.label=6;case 6:return o<i.length?[4,(0,i[o])(n.value)]:[3,9];case 7:if("string"==typeof(s=a.sent())&&s)return[2,new _(s)];a.label=8;case 8:return o++,[3,6];case 9:return[2,new W(n.value)]}})})},t.prototype.render=function(t){return this.converter.render(t)},t}(),U=function(){return function(t){this.definition=t}}(),G=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),H=function(t,e,r,n){return new(r||(r=Promise))(function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(s,a)}u((n=n.apply(t,e||[])).next())})},K=function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},J=new RegExp("^-?(0|[1-9]\\d*)(\\.\\d*)?$"),$=new RegExp("^-?(0|[1-9]\\d*)$"),z=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.defaultControlled=n.value,e}return G(e,t),e}(a),L=new z({emptyRaw:"",convert:function(t){return t},render:function(t){return t}}),Q=new z({emptyRaw:"",rawValidate:function(t){return t.startsWith(".")&&(t="0"+t),J.test(t)},convert:function(t){return+t},render:function(t){return t.toString()}}),X=new z({emptyRaw:"",rawValidate:function(t){return $.test(t)},convert:function(t){return+t},render:function(t){return t.toString()}}),Y=new a({emptyRaw:!1,convert:function(t){return t},render:function(t){return t},defaultControlled:n.checked}),Z=function(){function t(t,e){this.maxWholeDigits=t,this.decimalPlaces=e,this.defaultControlled=n.value,this.emptyRaw="";var r=new RegExp("^-?(0|[1-9]\\d{0,"+(t-1)+"})(\\.\\d{0,"+e+"})?$");this.converter=new z({emptyRaw:"",rawValidate:function(t){return t.startsWith(".")&&(t="0"+t),r.test(t)},convert:function(t){return t},render:function(t){return t}})}return t.prototype.convert=function(t){return this.converter.convert(t)},t.prototype.render=function(t){return this.converter.render(t)},t.prototype.getRaw=function(t){return t},t}();var tt=new a({emptyRaw:[],convert:function(t){return u.observable.array(t)},render:function(t){return t.slice()}});var et=function(){function t(t){this.converter=t,this.defaultControlled=n.value,this.emptyRaw=""}return t.prototype.convert=function(t){return H(this,void 0,void 0,function(){return K(this,function(e){return""===t.trim()?[2,new s(null)]:[2,this.converter.convert(t)]})})},t.prototype.render=function(t){return null===t?"":this.converter.render(t)},t}(),rt=function(){function t(t){this.emptyRaw=null,this.defaultControlled=n.object}return t.prototype.convert=function(t){return H(this,void 0,void 0,function(){return K(this,function(e){return null===t?[2,"ConversionError"]:[2,new s(t)]})})},t.prototype.render=function(t){return t},t}();var nt={string:L,number:Q,integer:X,decimal:function(t,e){return new Z(t,e)},boolean:Y,stringArray:tt,maybe:function(t){return t instanceof z?new et(t):new a({emptyRaw:null,convert:w,render:w,defaultControlled:n.object})},model:function(t){return new rt(t)},object:new a({emptyRaw:null,convert:w,render:w})},ot=function(){function t(t,e){this.model=t,this.allowedKeys=e}return t.prototype.access=function(t){return t.restricted(this.allowedKeys)},t}();var it={validationProps:function(t){var e=t.error,r=t.isValidating;return e?{validateStatus:r?"validating":"error",help:e}:{validateStatus:r?"validating":""}}};r.d(e,"Form",function(){return q}),r.d(e,"ValidationMessage",function(){return _}),r.d(e,"ProcessValue",function(){return W}),r.d(e,"Field",function(){return I}),r.d(e,"RepeatingForm",function(){return U}),r.d(e,"ConversionValue",function(){return s}),r.d(e,"CONVERSION_ERROR",function(){return"ConversionError"}),r.d(e,"Converter",function(){return a}),r.d(e,"StringConverter",function(){return z}),r.d(e,"converters",function(){return nt}),r.d(e,"setupValidationProps",function(){return y}),r.d(e,"FormAccessor",function(){return v}),r.d(e,"FieldAccessor",function(){return g}),r.d(e,"RepeatingFormAccessor",function(){return b}),r.d(e,"RepeatingFormIndexedAccessor",function(){return m}),r.d(e,"controlled",function(){return n}),r.d(e,"Group",function(){return ot}),r.d(e,"antd",function(){return it})}])});
//# sourceMappingURL=mstform.js.map
import { FieldAccessor } from "./accessor";
export declare function validationProps(accessor: FieldAccessor<any, any, any>): object;
declare function validationProps(accessor: FieldAccessor<any, any, any>): object;
export declare const antd: {
validationProps: typeof validationProps;
};
export {};

@@ -7,1 +7,2 @@ export * from "./form";

export * from "./group";
export * from "./antd";
{
"name": "mstform",
"version": "0.12.0",
"version": "0.12.1",
"description": "mobx-state-tree powered forms",

@@ -5,0 +5,0 @@ "main": "dist/mstform.js",

@@ -778,5 +778,5 @@ # mstform README

```js
import { validationProps } from "mstform/antd";
import { antd } from "mstform";
setupValidationProps(validationProps);
setupValidationProps(antd.validationProps);
```

@@ -783,0 +783,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc