UNPKG

tree-snap-shot

Version:
2 lines 19.7 kB
/*! For license information please see index.js.LICENSE.txt */ (()=>{"use strict";var t={amdO:{},n:e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}};t.r({});const e=new(function(){function t(){var e,r;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),r={maxDepth:100,ignore:null,copyIfDiff:null,listKey:"id",listItemSimiliarity:.6,cacheSurvivalTime:1e3},(e="global")in this?Object.defineProperty(this,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):this[e]=r;var n=this;this.unImmutableData={equal:function(t,e){return"function"==typeof n.global.equal?n.global.equal(t,e):t===e},copy:function(t){return"function"==typeof n.global.copy?n.global.copy(t):t}}}var e;return(e=[{key:"set",value:function(t){this.global.maxDepth=(t.maxDepth?parseInt(t.maxDepth):20)||20,this.global.listKey=t.listKey||"_id",this.global.listItemSimiliarity=Math.max(t.listItemSimiliarity,.1)||.6,this.global.copyAllIfDiff=t.copyAllIfDiff,this.global.ignore=t.ignore,this.global.copy=t.copy,this.global.equal=t.equal}}])&&function(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}(t.prototype,e),t}());var r=require("immutable"),n=t.n(r),o=require("kind-of"),i=t.n(o);function a(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}r=require("isobject"),o=t.n(r);const u=new(function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),a(this,"cache",{}),a(this,"throttle",null)}var r;return(r=[{key:"set",value:function(t,e,r){n().isImmutable(t)&&n().isImmutable(e)?this.cache[n().hash(t)+"_"+n().hash(e)]=r:n().isImmutable(t)&&void 0!==e&&(this.cache[n().hash(t)]=e)}},{key:"get",value:function(t,e){return n().isImmutable(t)&&n().isImmutable(e)?this.cache[n().hash(t)+"_"+n().hash(e)]:n().isImmutable(t)&&void 0===e?this.cache[n().hash(t)]:null}},{key:"size",value:function(){return Object.getOwnPropertyNames(this.cache).length}},{key:"clear",value:function(){this.cache={}}},{key:"start",value:function(){var t=this;clearTimeout(this.throttle),this.throttle=setTimeout((function(){t.clear()}),e.global.cacheSurvivalTime)}}])&&function(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}(t.prototype,r),t}());function l(t){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var f=Object.prototype.toString;function c(t){return"object"===l(t)&&(S(t)||Array.isArray(t)||function(t){if(!t||"object"!==l(t)||"[object Object]"!==f.call(t))return!1;if(null===(t=Object.getPrototypeOf(t)))return!0;for(var e=t,r=Object.getPrototypeOf(t);null!==r;)e=r,r=Object.getPrototypeOf(e);return e===t}(t))}function s(t){return"string"==typeof t||"number"==typeof t||"symbol"===l(t)||"boolean"==typeof t||null==t}function p(t,e){var r=1<arguments.length&&void 0!==e&&e;if(n().isImmutable(t)){if(e=t.toString(),!r)return"Immutable "+e.split(" ")[0];if(0==e.indexOf("Map"))return"object";if(0==e.indexOf("List"))return"array";t=t.toJS()}return i()(t)}function m(t){return void 0===t}function y(t){return"object"===("undefined"==typeof HTMLElement?"undefined":l(HTMLElement))?t instanceof HTMLElement:t&&"object"===l(t)&&(1===t.nodeType||9===t.nodeType)&&"string"==typeof t.nodeName}var h=o();function g(t){var e=0;return c(t)?(t=n().fromJS(t),u.get(t)?u.get(t):(t.map((function(t){e+=g(t)})),e&&u.set(t,e),e)):1}var b=n().fromJS,d=n().toJS,v=n().fromJS,S=n().isImmutable;function j(t){return(j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var I=function(t){return!(!(e=t)||"object"!==j(e)||(e=t,"[object RegExp]"===(t=Object.prototype.toString.call(e))||"[object Date]"===t||function(t){return t.$$typeof===O}(e)));var e},O="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function L(t){return Object.keys(t).concat((e=t,Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]));var e}function x(t,e){try{return e in t}catch(t){return!1}}function J(t,e,r){return void 0===e?t:((r=r||{}).isMergeableObject=r.isMergeableObject||I,"object"===j(t)&&null!==t&&t!==e&&I(e)&&I(t)?function(t,e,r){var n=t||{};return r.isMergeableObject(t)&&L(t).forEach((function(e){n[e]=t[e]})),L(e).forEach((function(o){var i,a;(!x(i=t,a=o)||Object.hasOwnProperty.call(i,a)&&Object.propertyIsEnumerable.call(i,a))&&(x(t,o)&&r.isMergeableObject(e[o])?n[o]=(i=o,((a=r).customMerge&&"function"==typeof(i=a.customMerge(i))?i:J)(t[o],e[o],r)):n[o]=e[o])})),n}(t,e,r):e)}function w(t){return(w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function A(t,e,r){var n=h(t)?{}:[];return e.forEach((function(t,e){var o,i=r[e],a=n;t.map((function(e,r){o=i.get(r),r===t.size-1?a[e]=P(o,!0):void 0===a[e]?h(o)?a=a[e]={}:Array.isArray(o)&&(a=a[e]=[]):a=a[e]}))})),n}function k(t){return n().isImmutable(t)?t.toJS():t}function E(t,e){if(!c(t)||!c(e))return t;var r=[],o=[];return function t(e,i,a,u){var l,f,c,s,p;for(p in a||(a=n().fromJS([]),u=n().fromJS([])),i)l=e[p],f=i[p],c=a.push(p),s=u.push(l),void 0!==l&&(null!==f&&l!==f?"object"==w(l)&&"object"==w(f)&&t(l,f,c,s):(r.push(c),o.push(s)))}(t=k(t),e=k(e)),A(t,r,o)}function M(t,e){if(!c(t)||!c(e))return t;var r=[],o=[];return function t(e,i,a,u){var l,f,c,s,p;for(p in a||(a=n().fromJS([]),u=n().fromJS([])),e)l=e[p],f=i[p],c=a.push(p),s=u.push(l),null!==f&&l!==f&&("object"==w(l)&&"object"==w(f)?t(l,f,c,s):(r.push(c),o.push(s)))}(t=k(t),e=k(e)),A(t,r,o)}function D(t,e){if(!h(t)&&!Array.isArray(t))return t;var r=[],o=[];return t=k(t),"function"!=typeof e?t:(function t(i,a,u){for(var l in a||(a=n().fromJS([]),u=n().fromJS([])),i){var f=i[l],c=a.push(l);l=u.push(f),!0!==e(c.toJS(),f)?(h(f)||Array.isArray(f))&&t(f,c,l):(r.push(c),o.push(l))}}(t),A(t,r,o))}function P(t){var r=1<arguments.length&&void 0!==arguments[1]&&arguments[1];if(y(t)||s(t))return t;if(n().isImmutable(t))return r?t.toJS():t;var o=n().fromJS(t);return n().isImmutable(o)?n().isImmutable(o)&&r?o.toJS():o:e.unImmutableData.copy(t)}function T(t){if(c(t)||!I(t))return t;var e=Object.getOwnPropertyNames(t||0);if(!e.length)return t;var r={};return e.forEach((function(e){r[e]=t[e]})),r}function q(t){return function(t){if(Array.isArray(t))return K(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return K(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Map"===(r="Object"===r&&t.constructor?t.constructor.name:r)||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?K(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function K(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function z(t){return(z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function C(t,e,r){if(t=n().fromJS(t).toJS(),"function"!=typeof r||!1!==r(t)){if("add"==t[0]||"del"==t[0]||"update"==t[0]||"replace"==t[0])return function(t,e){if("object"!=z(t))throw new Error("请输入Object");if("add"==e[0]||"update"==e[0])return J(t,e[1]);if("del"==e[0])!function t(e,r,o){for(var i in o=o||n().List([]),e)"object"!=z(e[i])||Array.isArray(e[i])?Array.isArray(e[i])?e[i].forEach((function(t){return r(o.push(i).push(t))})):r(o.push(i).push(e[i])):e[i]?t(e[i],r,o.push(i)):r(o.push(i))}(e[1],(function(e){var r=t;e.map((function(t,n){n<(e.length||e.size)-1?r=r[t]:delete r[t]}))}));else if("replace"==e[0]){var r=t,o=e[1];if(o.map((function(t,e){e<o.length-1&&"object"==z(r)&&r&&(r=r[t])})),"object"!=z(r)||!r)throw new Error("not existed path : ",o);r[o[o.length-1]]=e[2]}return t}(e,t);if("diff"==t[0])return function(t,e){var r=1<arguments.length&&void 0!==e?e:[],n=0,o=(e=r[1],t);e.map((function(t){o=o[t]})),r[2].forEach((function(t){if("add"==t[0])o.splice.apply(o,[t[1]+n,0].concat(q(t.slice(2)))),n+=t.length-2;else if("del"==t[0])for(var e=1;e<t.length;e++)o.splice(t[e]+n,1),n--;else"update"==t[0]&&(o[t[1]+n]=t[2])}))}(e,t),0;if("init"==t[0]){if(I(e))return J(e,t[1]);throw new Error("target must be a mergeable object")}}}function _(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function N(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function H(t,e,r){return e&&N(t.prototype,e),r&&N(t,r),t}function $(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var G=new(function(){function t(){_(this,t),$(this,"mergeLog",{}),$(this,"log",[]),$(this,"cache",[])}return H(t,[{key:"push",value:function(t){switch(t.operation){case"add":case"update":case"del":return void(this.mergeLog[t.operation]=function(t,e,r){var o=0<arguments.length&&void 0!==t?t:{},i=(e=1<arguments.length?e:void 0,2<arguments.length&&void 0!==r?r:["add","update","del"]);if("object"!=z(o))throw new Error("请输入Object");return(e=Array.isArray(e)?e:[e]).map((function(t){if(i.includes(t.operation))for(var e,r=t.path,a=(r=n().isImmutable(r)?r.toArray():r,t.type),u=(a=n().isImmutable(a)?a.toArray():a,o),l=0;l<r.length;l++){if(e=r[l],"del"==t.operation&&1==r.length){u[e]=null;break}if("del"==t.operation&&l==r.length-1){void 0!==u[e]?Array.isArray(u[e])?u[e].push(null):u[e]=[u[e],null]:u[e]=null;break}var f=a[l+1];("object"==f||"array"==f)&&l<r.length-1?(u[e]||(u[e]={}),u=u[e]):u[e]=n().isImmutable(t.value.to)?t.value.to.toJS():t.value.to}})),o}(this.mergeLog[t.operation],t,[t.operation]));case"diff":return void this.log.push([t.operation,t.path,t.steps]);case"init":return void this.log.push([t.operation,t.value,t.options]);case"replace":return void this.log.push([t.operation,t.path,t.value.to])}}},{key:"remove",value:function(t){for(var e in this.mergeLog)!1===t([""+e,this.mergeLog[e]])&&delete this.mergeLog[e];this.log=this.log.filter((function(e){return!1!==t(e)}))}},{key:"update",value:function(t){for(var e in this.mergeLog)!1===t(this.mergeLog[e])&&delete this.mergeLog[e];this.log=this.log.map((function(e){return t(e)||e}))}},{key:"getDiff",value:function(){return this.exportLog().filter((function(t){return"init"!=t[0]}))}},{key:"exportLog",value:function(){if(this.cache.length)return this.cache;var t=this.log.filter((function(t){return"init"!=t[0]}));return this.mergeLog.del&&t.unshift(["del",this.mergeLog.del]),this.mergeLog.add&&t.unshift(["add",this.mergeLog.add]),this.mergeLog.update&&t.unshift(["update",this.mergeLog.update]),this.mergeLog.merge&&t.unshift(["merge",this.mergeLog.merge]),t.unshift(this.log[0]),this.cache=t}},{key:"init",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[];this.mergeLog={},this.cache=[],this.log=[],Array.isArray(t)&&(this.log=t)}}]),t}());function R(){return JSON.stringify(this.map((function(t){return c(t)?n().fromJS(t).toJS():t})))}function U(){return n().fromJS(this).toJS()}function B(t,e,r){if(Array.isArray(t))G.init(t);else{if(!n().isList(t))throw new Error("请输入快照");t=t.toArray()}var o,i;return o=e,i=r,t.map((function(t){C(t,o,i)})),e}(r=function(){function t(){_(this,t),$(this,"proto",null),G.init()}return H(t,[{key:"replay",value:function(t,e,r){return this.proto=B(t,e,r),this}},{key:"step",value:function(t,e,r){C(t,e,r)}},{key:"rollback",value:function(t,e){var r=this;return this.reverseLog(t,e).exportLog((function(t){r.replay(t,e)})),this}},{key:"reverseLog",value:function(t,e){if(Array.isArray(t))G.init(t);else{if(!n().isList(t))throw new Error("请输入快照");t=t.toArray()}var r,o;c(e)?J(e,B(t)):e=B(t);for(var i=0;i<t.length;i++)if("init"==(o=t[i])[0]){r=o[1];break}return Z(e,r),this}},{key:"exportLog",value:function(t){var e=G.exportLog();return Object.getPrototypeOf(e).toString=R,Object.getPrototypeOf(e).toJS=U,"function"==typeof t&&t(e),this}}]),t}()).prototype.getDiff=function(t){var e=G.getDiff();return Object.getPrototypeOf(e).toString=R,Object.getPrototypeOf(e).toJS=U,"function"==typeof t&&t(e),this},r.prototype.init=function(t,e){G.init(),G.push({operation:"init",value:t,options:e})},r.prototype.add=function(t){"function"==typeof e.global.ignore&&e.global.ignore(t.path.toJS(),t.type.last())||G.push(t)};const F=new r;function Q(t,e){for(var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:function(t,e){return t===e},n=t.size,o=e.size,i={1:0},a={0:{1:0}},u=0;u<=n+o;u++){for(var l={},f=-u;f<=u;f+=2){for(var c=f==-u||f!=u&&i[f+1]>i[f-1],s=c?f+1:f-1,p=i[s],m=p=c?p:p+1,y=p-f;m<n&&y<o&&r(t.get(m),e.get(y));)m++,y++;if(i[f]=m,(l[f]=m)==n&&y==o)return a[u]=l,function(t,e,r){var n=[],o=0;t.forEach((function(t,i){var a=t[0],u=t[1],l=t[2],f=a;if(0===i&&0!==a)for(var c=0;c<a;c++)n.push({operation:"",value:e.get(c),index:[c,o]}),o++;u-a==1?(n.push({operation:"del",value:e.get(a),index:[a,o]}),f=u):(n.push({operation:"add",value:r.get(o),index:[a,o]}),o++);for(var s=0;s<l-f;s++)n.push({operation:"",value:e.get(f+s),index:[f+s,o]}),o++}));for(var i,a=null,u=null,l=[],f=0;f<n.length;f++)a=n[f],u=n[f+1],"del"==(null===(i=a)||void 0===i?void 0:i.operation)&&"add"==(null===(i=u)||void 0===i?void 0:i.operation)&&a.index[1]==u.index[1]?(l.push({operation:"update",value:u.value,index:a.index}),f++):l.push(a);return l}(function(t,e,r,n){for(var o=[],i={x:e,y:r};0<n;n--){var a=t[n],u=t[n-1],l=i.x-i.y,f=a[l],c=(a=(u=u[a=(c=l==-n||l!=n&&u[1+l]>u[l-1])?1+l:l-1])-a,c?u:u+1);o.unshift([u,c,f]),i.x=u,i.y=a}return o}(a,n,o,u),t,e)}a[u]=l}}var V=function(t,r){return s(t)||s(r)?t===r:n().isImmutable(t)&&n().isImmutable(r)?n().is(t,r):c(t)&&c(r)?n().is(n().fromJS(t),n().fromJS(r)):(n().isImmutable(t)&&(t=t.toJS()),n().isImmutable(r)&&(r=r.toJS()),"function"==typeof e.unImmutableData.equal?e.unImmutableData.equal(t,r):n().is(t,r))};function W(t,r){var o=0,i=0;if(c(t)){if(t=n().fromJS(t),r=n().fromJS(r),p(t)==p(r)){var a=u.get(t,r);if(!a){if("Immutable Map"==p(t))return function(t,e){var r=0,o=0,i=0,a=0,l={};e.map((function(e,r){m(e)||(l[r]=e,m(t.get(r))&&o++)})),t.map((function(t,e){m(t)||(m(l[e])?c(t)?i+=g(t):i++:n().is(t,l[e])?a+=g(t):(e=W(t,l[e]),r+=e.update,i+=e.del,o+=e.add,a+=e.unchanged))}));var f={unchanged:a,add:o,del:i,update:r,similarity:Math.round(a/(o+i+r+a)*100)/100};return u.set(t,e,f),f}(t,r);if("Immutable List"==p(t))return function(t,r){var n,o,i,a,l=0,f=0,c=0,m=0,y=Q(t,r,(function(t,r){return s(t)||s(r)?t===r:"Immutable Map"==p(t)&&"Immutable Map"==p(r)&&t.get(e.listKey)&&r.get(e.listKey)?t.get(e.listKey)===r.get(e.listKey):W(t,r).similarity>=e.global.listItemSimiliarity})),h={unchanged:m+=(h=t,a=i=o=n=0,(y=y).length?y.forEach((function(t){t.operation?"add"==t.operation?o++:"del"==t.operation?i+=g(t.value):"update"==t.operation&&(a+=g(t.value)):n+=g(t.value)})):n=g(h),h=Math.round(n/(o+i+a+n)*100)/100,h={unchanged:n,add:o,del:i,update:a,similarity:h}).unchanged,add:f+=h.add,del:c+=h.del,update:l+=h.update,similarity:Math.round(m/(f+c+l+m)*100)/100};return u.set(t,r,h),h}(t,r)}return a}o+=g(t)}else t===r?i+=1:o+=1;return i={unchanged:i,add:0,del:0,update:o,similarity:Math.round(i/(o+i)*100)/100},u.set(t,r,i),i}function X(t,e){return n().is(t,e)}function Y(t,r,o,i,a){if(g=t,b=r,d=o,!(e.global.maxDepth<=d.size)&&("function"!=typeof e.global.copyIfDiff||!e.global.copyIfDiff(d.toJS(),n().isImmutable(g)?g.toJS():g))&&c(g)&&c(b)){if(t=n().fromJS(t),r=n().fromJS(r),n().is(t,r))return;if((b=p(t))==p(r)){if("Immutable List"==b)return function(t,r,n,o,i){var a=Q(t,r,(function(t,r){return s(t)||s(r)?t===r:(o=n,e.global.maxDepth<=o.size||1<=e.global.listItemSimiliarity?X(t,r):"Immutable Map"==p(t)&&"Immutable Map"==p(r)&&t.get(e.listKey)&&r.get(e.listKey)?t.get(e.listKey)===r.get(e.listKey):W(t,r).similarity>=e.global.listItemSimiliarity);var o}));a.length?(a.forEach((function(e){if(!(e.operation||"Immutable Map"!=p(e.value)&&"Immutable List"!=p(e.value)||X(t.get(e.index[0]),r.get(e.index[1]))))return i(t.get(e.index[0]),r.get(e.index[1]),n.push(e.index[0]),o,i)})),F.add({path:n,type:o,operation:"diff",steps:function(t){for(var e,r,n=null,o=[],i=0;i<t.length;i++)null!==(n=t[i])&&void 0!==n&&n.operation&&(r=[n.operation,n.index[0]],"add"==(null==n?void 0:n.operation)?("add"==(null===(e=o[o.length-1])||void 0===e?void 0:e[0])&&o[o.length-1][1]==n.index[0]?r=o[o.length-1]:o.push(r),r.push(n.value)):"del"==(null==n?void 0:n.operation)?"del"==(null===(e=o[o.length-1])||void 0===e?void 0:e[0])?(r=o[o.length-1]).push(n.index[0]):o.push(r):(r.push(n.value),o.push(r)));return o}(a)})):(t.length||t.size)&&t.map((function(t,e){if(!X(t,r.get(e)))return i(t,r.get(e),n.push(e),o,i)}))}(t,r,o,i.push(p(t,!0)),a);if("Immutable Map"==b)return u=t,l=r,f=o,y=i.push(p(t,!0)),h=a,l.map((function(t,e){m(t)||m(u.get(e))&&F.add({path:f.push(e),operation:"add",type:y,value:{from:void 0,to:P(l.get(e))}})})),void u.map((function(t,e){var r=l.get(e+="");if(!m(t)&&!V(t,r)){if(!m(r))return h(t,r,f.push(e),y,h);F.add({path:f.push(e),operation:"del",type:y.push(p(t,!0)),value:{from:P(t),to:void 0}})}}))}}var u,l,f,y,h,g,b,d;V(t,r)||F.add({path:o,type:i.push(p(t,!0)),operation:c(t)&&c(r)?"replace":"update",value:{from:P(t),to:P(r)}})}function Z(t,r){var o=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return t=T(t),r=T(r),t=n().fromJS(t),F.init(t,o),u.start(),e.set(o),Y(t,n().fromJS(r),n().List([]),n().List([]),Y),F.compare=Z,F}function tt(t){return(tt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function et(t,e){return u.start(),W(t,e)}o=void 0,r=function(t){var e={compare:Z,similarity:et,getDiff:F.getDiff,replay:F.replay,exportLog:F.exportLog,clearCache:u.clear,reverseLog:F.reverseLog,rollback:F.rollback,step:F.step,deepClone:P,deepEqual:V,isImmutableStructure:c,isImmutable:S,isPrimitive:s,toImmutable:b,conditionalGraft:D,union:E,difference:M,toJS:d,fromJS:v};t.default=e,t.compare=Z,t.similarity=et,t.getDiff=F.getDiff,t.replay=F.replay,t.step=F.step,t.exportLog=F.exportLog,t.clearCache=u.clear,t.reverseLog=F.reverseLog,t.rollback=F.rollback,t.deepClone=P,t.deepEqual=V,t.isImmutableStructure=c,t.isImmutable=S,t.isPrimitive=s,t.toImmutable=b,t.conditionalGraft=D,t.union=E,t.difference=M,t.toJS=d,t.fromJS=v},"object"===("undefined"==typeof exports?"undefined":tt(exports))?r(exports):"function"==typeof define&&t.amdO?define(["exports"],r):r((o="undefined"!=typeof globalThis?globalThis:o||self).TreeDiff={})})();