3 lines
10 KiB
JavaScript
3 lines
10 KiB
JavaScript
|
var e,r;e=this,r=function(e){"use strict";var r,t,n,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")},a=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),f="undefined"!=typeof Symbol?Symbol("immer-nothing"):(n=!0,(t="immer-nothing")in(r={})?Object.defineProperty(r,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[t]=n,r),u="undefined"!=typeof Symbol?Symbol("immer-state"):"__$immer_state";function s(e){return!!e&&!!e[u]}function c(e){if(!e)return!1;if("object"!==(void 0===e?"undefined":o(e)))return!1;if(Array.isArray(e))return!0;var r=Object.getPrototypeOf(e);return null===r||r===Object.prototype}var l=Object.assign||function(e,r){for(var t in r)h(r,t)&&(e[t]=r[t]);return e};function p(e){if(Array.isArray(e))return e.slice();var r=void 0===e.__proto__?Object.create(null):{};return l(r,e)}function d(e,r){if(Array.isArray(e))for(var t=0;t<e.length;t++)r(t,e[t],e);else for(var n in e)r(n,e[n],e)}function h(e,r){return Object.prototype.hasOwnProperty.call(e,r)}function y(e,r){return e===r?0!==e||1/e==1/r:e!=e&&r!=r}function v(e,r,t,n){Array.isArray(e.base)?function(e,r,t,n){for(var o=e.base,i=e.copy,a=e.assigned,f=Math.min(o.length,i.length),u=0;u<f;u++)if(a[u]&&o[u]!==i[u]){var s=r.concat(u);t.push({op:"replace",path:s,value:i[u]}),n.push({op:"replace",path:s,value:o[u]})}if(f<i.length){for(var c=f;c<i.length;c++)t.push({op:"add",path:r.concat(c),value:i[c]});n.push({op:"replace",path:r.concat("length"),value:o.length})}else if(f<o.length){t.push({op:"replace",path:r.concat("length"),value:i.length});for(var l=f;l<o.length;l++)n.push({op:"add",path:r.concat(l),value:o[l]})}}(e,r,t,n):function(e,r,t,n){var o=e.base,i=e.copy;d(e.assigned,function(e,a){var f=o[e],u=i[e],s=a?e in o?"replace":"add":"remove";if(f!==o||"replace"!==s){var c=r.concat(e);t.push("remove"===s?{op:s,path:c}:{op:s,path:c,value:u}),n.push("add"===s?{op:"remove",path:c}:"remove"===s?{op:"add",path:c,value:f}:{op:"replace",path:c,value:f})}})}(e,r,t,n)}var b={},g=[],m=function(){return g[g.length-1]};function w(e,r){var t=void 0;if(s(e)){var n=e[u];n.finalizing=!0,t=p(n.draft),n.finalizing=!1}else t=p(e);d(e,function(e){Object.defineProperty(t,""+e,function(e){return b[e]||(b[e]={configurable:!0,enumerable:!0,get:function(){return function(e,r){A(e);var t=O(e)[r];if(!e.finalizing&&t===e.base[r]&&c(t))return j(e),e.copy[r]=w(t,e);return t}(this[u],e)},set:function(r){!function(e,r,t){if(A(e),e.assigned[r]=!0,!e.modified){if(y(O(e)[r],t))return;P(e),j(e)}e.copy[r]=t}(this[u],e,r)}})}(""+e))});var o,i,a,f={scope:r?r.scope:m(),modified:!1,finalizing:!1,finalized:!1,assigned:{},parent:r,base:e,draft:t,copy:null,revoke:z,revoked:!1};return o=t,i=u,a=f,Object.defineProperty(o,i,{value:a,enumerable:!1,writable:!0}),f.scope.push(f),t}function z(){this.revoked=!0}function O(e){return e.copy||e.base}function P(e){e.modified||(e.modified=!0,e.parent&&P(e.parent))}function j(e){e.copy||(e.copy=p(e.base))}function A(e){if(!0===e.revoked)throw new Error("Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+JSON.stringify(e.copy||e.base))}function k(e){for(var r=e.base,t=e.draft,n=Object.keys(t),o=n.length-1;o>=0;o--)if(void 0===r[n[o]]&&!h(r,n[o]))return!0;return n.length!==Object.keys(r).length}function E(e){var r=e.draft;if(r.length!==e.base.length)return!0;var t=Object.getOwnPropertyDescriptor(r,r.length-1);return!(!t||t.get)}var x=Object.freeze({scopes:g,currentScope:m,willFinalize:function(e,r,t){var n=m();n.forEach(function(e){return e.finalizing=!0}),void 0!==e&&e!==r||(t&&function e(r){if(r&&"object"===(void 0===r?"undefined":o(r))){var t=r[u];if(t){var n=t.ba
|
||
|
//# sourceMappingURL=immer.umd.js.map
|