!function(n){var r={};function o(t){if(r[t])return r[t].exports;var e=r[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,o),e.l=!0,e.exports}o.m=n,o.c=r,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=12)}([function(t,i,e){e(2),e(3);i.BaseOperation=function(){},i.add_op=function(t,e,n){t.prototype.type=[e.module_name,n],"op_map"in e||(e.op_map={}),e.op_map[n]=t};var a=e(4),s=e(22),u=e(9),f=e(6),p=e(23);i.NO_OP=a.NO_OP,i.SET=a.SET,i.MATH=a.MATH,i.PATCH=s.PATCH,i.SPLICE=s.SPLICE,i.ATINDEX=s.ATINDEX,i.MAP=s.MAP,i.PUT=u.PUT,i.REM=u.REM,i.APPLY=u.APPLY,i.LIST=f.LIST,i.COPY=p.COPY,i.diff=e(25).diff,i.BaseOperation.prototype.isNoOp=function(){return this instanceof a.NO_OP},i.BaseOperation.prototype.visit=function(t){return t(this)||this},i.BaseOperation.prototype.toJSON=function(t,e){var n={};if(void 0===e)e=1,n._ver=e;else if(1!==e)throw new Error("Invalid protocol version: "+e);return n._type=this.type[0]+"."+this.type[1],this.internalToJSON(n,e),n},i.opFromJSON=function(t,e,n){if("object"!=typeof t)throw new Error("Not an operation.");if(void 0===e){if(1!==(e=t._ver))throw new Error("JOT serialized data structure is missing protocol version and one wasn't provided as an argument.")}else{if(1!==e)throw new Error("Invalid protocol version provided: "+e);if("_ver"in t)throw new Error("JOT serialized data structure should not have protocol version because it was provided as an argument.")}if(!n){function r(t){for(var e in n[t.module_name]={},t.op_map)n[t.module_name][e]=t.op_map[e]}n={},r(a),r(s),r(u),r(f),r(p)}if("string"!=typeof t._type)throw new Error("Not an operation.");var o=t._type.split(/\./g,2);if(2!=o.length)throw new Error("Not an operation.");return n[o[0]][o[1]].internalFromJSON(t,e,n)},i.BaseOperation.prototype.serialize=function(){return JSON.stringify(this)},i.deserialize=function(t){return i.opFromJSON(JSON.parse(t))},i.BaseOperation.prototype.compose=function(t,e){if(!(t instanceof i.BaseOperation))throw new Error("Argument must be an operation.");if(this instanceof a.NO_OP)return t;if(t instanceof a.NO_OP)return this;if(t instanceof a.SET)return t;if(this.atomic_compose){var n=this.atomic_compose(t);if(null!=n)return n}return e?null:new f.LIST([this,t]).simplify()},i.BaseOperation.prototype.rebase=function(t,e,n){for(var r=0;r<(null!=this.rebase_functions?this.rebase_functions.length:0);r++){if(t instanceof this.rebase_functions[r][0])if(null!=(o=this.rebase_functions[r][1].call(this,t,e))&&null!=o[0])return n&&n("rebase",this,"on",t,e?"conflictless":"","document"in e?JSON.stringify(e.document):"","=>",o[0]),o[0]}for(r=0;r<(null!=t.rebase_functions?t.rebase_functions.length:0);r++){var o;if(this instanceof t.rebase_functions[r][0])if(null!=(o=t.rebase_functions[r][1].call(t,this,e))&&null!=o[1])return n&&n("rebase",this,"on",t,e?"conflictless":"","document"in e?JSON.stringify(e.document):"","=>",o[0]),o[1]}if(this instanceof f.LIST||t instanceof f.LIST){var i=f.rebase(t,this,e,n);return n&&n("rebase",this,"on",t,"=>",i),i}if(e){if(t instanceof p.COPY&&void 0!==e.document)return t.clone_operation(this,e.document);if(this instanceof a.SET)return n&&n("rebase",this,"on",t,"=>",this),this;if(t instanceof a.SET)return n&&n("rebase",this,"on",t,"=>",new a.NO_OP),new a.NO_OP;throw new Error("Rebase failed between "+this.inspect()+" and "+t.inspect()+".")}return null},i.createRandomValue=function(t){var e=[];if(e.push(null),e.push(!1),e.push(!0),e.push(1e3*Math.floor(Math.random()-.5)),e.push(Math.random()-.5),e.push(1e3*(Math.random()-.5)),e.push(Math.random().toString(36).substring(7)),Math.random()t.length?n:t}),f.value=c.join("")}else f.value=n.slice(s,s+f.count).join("");s+=f.count,f.added||(u+=f.count)}}var l=e[a-1];return 1=l&&h<=r+1)return c([{value:f.join(""),count:f.length}]);function o(){for(var t=-1*d;t<=d;t+=2){var e=void 0,n=y[t-1],r=y[t+1],o=(r?r.newPos:0)-t;n&&(y[t-1]=void 0);var i=n&&n.newPos+1=l&&h<=o+1)return c(g(p,e.components,f,u,p.useLongestToken));y[t]=e}else y[t]=void 0}var s;d++}if(e)!function t(){setTimeout(function(){if(n=Math.abs(this.operand[1]))throw new Error("MATH[rot]'s first operand, the increment, must be less than its second operand, the modulus.")}Object.freeze(this)},u.MATH.prototype=Object.create(f.BaseOperation.prototype),f.add_op(u.MATH,u,"MATH"),u.NO_OP.prototype.inspect=function(t){return""},u.NO_OP.prototype.internalToJSON=function(t,e){},u.NO_OP.internalFromJSON=function(t,e,n){return new u.NO_OP},u.NO_OP.prototype.apply=function(t){return t},u.NO_OP.prototype.simplify=function(){return this},u.NO_OP.prototype.drilldown=function(t){return new values.NO_OP},u.NO_OP.prototype.inverse=function(t){return this},u.NO_OP.prototype.atomic_compose=function(t){return t},u.NO_OP.prototype.rebase_functions=[[f.BaseOperation,function(t,e){return[this,t]}]],u.NO_OP.prototype.get_length_change=function(t){return 0},u.NO_OP.prototype.decompose=function(t,e){return[this,this]},u.SET.prototype.inspect=function(t){return n.format("",(e=this.value)===p?"~":n.format("%j",e));var e},u.SET.prototype.internalToJSON=function(t,e){this.value===p?t.value_missing=!0:t.value=this.value},u.SET.internalFromJSON=function(t,e,n){return t.value_missing?new u.SET(p):new u.SET(t.value)},u.SET.prototype.apply=function(t){return this.value},u.SET.prototype.simplify=function(){return this},u.SET.prototype.drilldown=function(t){return"object"==typeof this.value&&Array.isArray(this.value)&&Number.isInteger(t)&&t",this.operator,"number"!=typeof this.operand||"and"!=this.operator&&"or"!=this.operator&&"xor"!=this.operator?n.format("%j",this.operand):"0x"+this.operand.toString(16))},u.MATH.prototype.internalToJSON=function(t,e){t.operator=this.operator,t.operand=this.operand},u.MATH.internalFromJSON=function(t,e,n){return new u.MATH(t.operator,t.operand)},u.MATH.prototype.apply=function(t){if("number"==typeof t){if("add"==this.operator)return t+this.operand;if("mult"==this.operator)return t*this.operand;if(Number.isInteger(t)){if("rot"==this.operator)return(t+this.operand[0])%this.operand[1];if("and"==this.operator)return t&this.operand;if("or"==this.operator)return t|this.operand;if("xor"==this.operator)return t^this.operand;if("not"==this.operator)return~t}throw new Error("MATH operator "+this.operator+" cannot apply to "+t+".")}if("boolean"!=typeof t)throw new Error("MATH operations only apply to number and boolean values, not "+f.type_name(t)+".");if("and"==this.operator)return t&&this.operand;if("or"==this.operator)return t||this.operand;if("xor"==this.operator)return!!(t^this.operand);if("not"==this.operator)return!t;throw new Error("MATH operator "+this.operator+" does not apply to boolean values.")},u.MATH.prototype.simplify=function(){return"add"==this.operator&&0==this.operand?new u.NO_OP:"rot"==this.operator&&0==this.operand[0]?new u.NO_OP:"mult"==this.operator&&1==this.operand?new u.NO_OP:"and"==this.operator&&0===this.operand?new u.SET(0):"and"==this.operator&&!1===this.operand?new u.SET(!1):"or"==this.operator&&0===this.operand?new u.NO_OP:"or"==this.operator&&!1===this.operand?new u.NO_OP:"xor"==this.operator&&0==this.operand?new u.NO_OP:this},u.MATH.prototype.drilldown=function(t){return new u.NO_OP},u.MATH.prototype.inverse=function(t){return"add"==this.operator?new u.MATH("add",-this.operand):"rot"==this.operator?new u.MATH("rot",[-this.operand[0],this.operand[1]]):"mult"==this.operator?new u.MATH("mult",1/this.operand):"and"==this.operator?new u.MATH("or",t&~this.operand):"or"==this.operator?new u.MATH("xor",~t&this.operand):"xor"==this.operator?this:"not"==this.operator?this:void 0},u.MATH.prototype.atomic_compose=function(t){if(t instanceof u.MATH){if(this.operator==t.operator&&"add"==this.operator)return new u.MATH("add",this.operand+t.operand).simplify();if(this.operator==t.operator&&"rot"==this.operator&&this.operand[1]==t.operand[1])return new u.MATH("rot",[this.operand[0]+t.operand[0],this.operand[1]]).simplify();if(this.operator==t.operator&&"mult"==this.operator)return new u.MATH("mult",this.operand*t.operand).simplify();if(this.operator==t.operator&&"and"==this.operator&&typeof this.operand==typeof t.operand&&"number"==typeof this.operand)return new u.MATH("and",this.operand&t.operand).simplify();if(this.operator==t.operator&&"and"==this.operator&&typeof this.operand==typeof t.operand&&"boolean"==typeof this.operand)return new u.MATH("and",this.operand&&t.operand).simplify();if(this.operator==t.operator&&"or"==this.operator&&typeof this.operand==typeof t.operand&&"number"==typeof this.operand)return new u.MATH("or",this.operand|t.operand).simplify();if(this.operator==t.operator&&"or"==this.operator&&typeof this.operand==typeof t.operand&&"boolean"==typeof this.operand)return new u.MATH("or",this.operand||t.operand).simplify();if(this.operator==t.operator&&"xor"==this.operator&&typeof this.operand==typeof t.operand&&"number"==typeof this.operand)return new u.MATH("xor",this.operand^t.operand).simplify();if(this.operator==t.operator&&"xor"==this.operator&&typeof this.operand==typeof t.operand&&"boolean"==typeof this.operand)return new u.MATH("xor",!!(this.operand^t.operand)).simplify();if(this.operator==t.operator&&"not"==this.operator)return new u.NO_OP;if("and"==this.operator&&"or"==t.operator&&this.operand===t.operand)return new u.SET(this.operand);if("or"==this.operator&&"xor"==t.operator&&this.operand===t.operand&&"number"==typeof this.operand)return new u.MATH("and",~this.operand);if("or"==this.operator&&"xor"==t.operator&&this.operand===t.operand&&"boolean"==typeof this.operand)return new u.MATH("and",!this.operand)}return null},u.MATH.prototype.rebase_functions=[[u.MATH,function(t,e){return this.operator!=t.operator||"rot"==this.operator&&this.operand[1]!=t.operand[1]?e&&"document"in e&&f.cmp([this.operator,this.operand],[t.operator,t.operand])<0?[new u.SET(this.compose(t).apply(e.document)),t]:null:[this,t]}]],u.createRandomOp=function(r,t){var e=[];if(e.push(function(){return new u.NO_OP}),e.push(function(){return new u.SET(r)}),"string-elem"!=t&&"string"!=t&&e.push(function(){return new u.SET(f.createRandomValue())}),"object"==t&&e.push(function(){return new u.SET(p)}),"boolean"==typeof r&&e.push(function(){return new u.SET(!r)}),"number"==typeof r&&(Number.isInteger(r)?e.push(function(){return new u.SET(r+Math.floor(100*(Math.random()+.5)))}):e.push(function(){return new u.SET(r*(Math.random()+.5))})),("string"==typeof r||Array.isArray(r))&&"string-elem"!=t){if(0",this.ops.map(function(t){return t.inspect(e-1)}).join(", "))},i.LIST.prototype.visit=function(e){var t=new i.LIST(this.ops.map(function(t){return t.visit(e)}));return e(t)||t},i.LIST.prototype.internalToJSON=function(t,e){t.ops=this.ops.map(function(t){return t.toJSON(void 0,e)})},i.LIST.internalFromJSON=function(t,e,n){var r=t.ops.map(function(t){return y.opFromJSON(t,e,n)});return new i.LIST(r)},i.LIST.prototype.apply=function(t){for(var e=0;e"].concat(Array.from(arguments));a.apply(null,t)}}{if(1==e.length){if(e[0]instanceof g.NO_OP)return n;var s=n.slice(0,1),u=n.slice(1),f=t(e,s,r,o);if(null==f)return null;var p=t(s,e,r,o);if(null==p)return null;var c=null;r&&"document"in(c=d(r))&&(c.document=s[0].apply(c.document));var l=t(p,u,c,o);return null==l?null:f.concat(l)}r=r?d(r):null;for(var h=0;h",n.join(", "))},a.APPLY.prototype.visit=function(t){var e={};for(var n in this.ops)e[n]=this.ops[n].visit(t);var r=new a.APPLY(e);return t(r)||r},a.APPLY.prototype.internalToJSON=function(t,e){for(var n in t.ops={},this.ops)t.ops[n]=this.ops[n].toJSON(void 0,e)},a.APPLY.internalFromJSON=function(t,e,n){var r={};for(var o in t.ops)r[o]=i.opFromJSON(t.ops[o],e,n);return new a.APPLY(r)},a.APPLY.prototype.apply=function(t){var e={};for(var n in t)e[n]=t[n];for(var r in this.ops){var o=this.ops[r].apply(e[r],[e,r]);o===a.MISSING?delete e[r]:e[r]=o}return e},a.APPLY.prototype.simplify=function(){var t={},e=!1;for(var n in this.ops)t[n]=this.ops[n].simplify(),t[n]instanceof u.NO_OP?delete t[n]:e=!0;return e?new a.APPLY(t):new u.NO_OP},a.APPLY.prototype.inverse=function(t){var e={};for(var n in this.ops)e[n]=this.ops[n].inverse(n in t?t[n]:a.MISSING);return new a.APPLY(e)},a.APPLY.prototype.atomic_compose=function(t){if(t instanceof a.APPLY){var e=s(this.ops);for(var n in t.ops)if(n in e){var r=e[n].compose(t.ops[n]);r instanceof u.NO_OP?delete e[n]:e[n]=r}else e[n]=t.ops[n];return new a.APPLY(e).simplify()}return null},a.APPLY.prototype.rebase_functions=[[a.APPLY,function(t,n){function e(t){if(!(n&&"document"in n))return n;var e=s(n);return t in n.document?e.document=n.document[t]:e.document=a.MISSING,e}var r={};for(var o in this.ops)if(r[o]=this.ops[o],o in t.ops&&(r[o]=r[o].rebase(t.ops[o],e(o))),null===r[o])return null;var i={};for(var o in t.ops)if(i[o]=t.ops[o],o in this.ops&&(i[o]=i[o].rebase(this.ops[o],e(o))),null===i[o])return null;return[new a.APPLY(r).simplify(),new a.APPLY(i).simplify()]}]],a.APPLY.prototype.drilldown=function(t){return"string"==typeof t&&t in this.ops?this.ops[t]:new u.NO_OP},a.createRandomOp=function(e,t){var n=[];return n.push(function(){return new a.PUT("k"+Math.floor(1e3*Math.random()),i.createRandomValue())}),Object.keys(e).forEach(function(t){n.push(function(){return i.createRandomOp(e[t],"object")})}),n[Math.floor(Math.random()*n.length)]()}},function(t,e,n){"use strict";e.__esModule=!0,e.generateOptions=function(t,e){if("function"==typeof t)e.callback=t;else if(t)for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}},function(t,e,n){"use strict";e.__esModule=!0,e.parsePatch=function(t){var s=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],u=t.split("\n"),o=[],f=0;function e(){var t={};for(o.push(t);f",this.hunks.map(function(t){return 1==t.length&&t.op instanceof d.MAP?n.format(" +%d %s",t.offset,t.op.op.inspect(e-1)):n.format(" +%dx%d %s",t.offset,t.length,t.op instanceof g.SET?n.format("%j",t.op.value):t.op.inspect(e-1))}).join(","))},d.PATCH.prototype.visit=function(n){var t=new d.PATCH(this.hunks.map(function(t){var e=h(t);return e.op=e.op.visit(n),e}));return n(t)||t},d.PATCH.prototype.internalToJSON=function(t,n){t.hunks=this.hunks.map(function(t){var e=h(t);return e.op=e.op.toJSON(void 0,n),e})},d.PATCH.internalFromJSON=function(t,n,r){var e=t.hunks.map(function(t){var e=h(t);return e.op=y.opFromJSON(t.op,n,r),e});return new d.PATCH(e)},d.PATCH.prototype.apply=function(n){var r=0,o=n.slice(0,0);return this.hunks.forEach(function(t){if(r+t.offset+t.length>n.length)throw new Error("offset past end of document");o=a(o,n.slice(r,r+t.offset)),r+=t.offset;var e=t.op.apply(n.slice(r,r+t.length));if("string"==typeof n&&"string"!=typeof e)throw new Error("operation yielded invalid substring");if(Array.isArray(n)&&!Array.isArray(e))throw new Error("operation yielded invalid subarray");o=a(o,e),r+=t.length}),o=a(o,n.slice(r))},d.PATCH.prototype.simplify=function(){var r=null;this.hunks.forEach(function(t){t.op instanceof g.SET&&("string"==typeof t.op.value?r="string":Array.isArray(t.op.value)&&(r="array"))});var o=[],i=0;return this.hunks.forEach(function(t){var e=t.op.simplify();if(e.isNoOp())i+=t.offset+t.length;else if(0!=t.length||0!=t.op.get_length_change(t.length))if(0",this.op.inspect(t-1))},d.MAP.prototype.visit=function(t){var e=new d.MAP(this.op.visit(t));return t(e)||e},d.MAP.prototype.internalToJSON=function(t,e){t.op=this.op.toJSON(void 0,e)},d.MAP.internalFromJSON=function(t,e,n){return new d.MAP(y.opFromJSON(t.op,e,n))},d.MAP.prototype.apply=function(t){var e;e="string"==typeof t?t.split(/.{0}/):t.slice();for(var n=0;n",this.pathpairs.map(function(t){return a(t[0])+" => "+a(t[1])}).join(", "))},o.COPY.prototype.visit=function(t){return t(this)||this},o.COPY.prototype.internalToJSON=function(t,e){t.pathpairs=this.pathpairs.map(function(t){return[a(t[0]),a(t[1])]})},o.COPY.internalFromJSON=function(t,e,n){return new o.COPY(t.pathpairs)},o.COPY.prototype.apply=function(n){return this.pathpairs.forEach(function(t){var e=t[0].get(n);n=t[1].replace(n,e)}),n},o.COPY.prototype.simplify=function(t){return this},o.COPY.prototype.inverse=function(e){return new i.LIST(this.pathpairs.map(function(t){return u(t[1],e,new i.SET(t[1].get(e)))}))},o.COPY.prototype.atomic_compose=function(t){if(t instanceof o.COPY)return new o.COPY(this.pathpairs.concat(t.pathpairs)).simplify()},o.rebase=function(t,e,n,r){},o.COPY.prototype.clone_operation=function(n,r){var o=[n];return this.pathpairs.forEach(function(t){var e=function(t,e,n){for(var r=s(t,e),o=0;ot.length)throw new p("Add operation must not attempt to create a sparse array!");t.splice(e,0,n)}else t[e]=n;return t},e)},a.prototype.remove=function(t,e){if(0!==this.length)return this._action(t,function(t,e){if(!Object.hasOwnProperty.call(t,e))throw new p("Remove operation must point to an existing value!");return u(t)?t.splice(e,1):delete t[e],t},e)},a.prototype.replace=function(t,n,e){return 0===this.length?n:this._action(t,function(t,e){if(!Object.hasOwnProperty.call(t,e))throw new p("Replace operation must point to an existing value!");return u(t)?t.splice(e,1,n):t[e]=n,t},e)},a.prototype.get=function(t){var n;return 0===this.length?t:(this._action(t,function(t,e){if(!Object.hasOwnProperty.call(t,e))throw new p("Path not found in document");return n=t[e],t},!0),n)},a.prototype.subsetOf=function(t){if(this.length<=t.length)return!1;for(var e=0;ee.length)throw new Error("out of range");if(s+t.items.length>n.length)throw new Error("out of range");r.push({type:"equal",ai:e.slice(o,o+t.items.length),bi:n.slice(s,s+t.items.length)}),o+=t.items.length,s+=t.items.length}}),r.forEach(function(t){if(a<1&&0=d.length-2&&n.length<=h.context){var f=/\n$/.test(c),p=/\n$/.test(l);0!=n.length||f?f&&p||w.push("\\ No newline at end of file"):w.splice(u.oldLines,0,"\\ No newline at end of file")}g.push(u),v=m=0,w=[]}O+=n.length,b+=n.length}},i=0;i/g,">")).replace(/"/g,""")}e.__esModule=!0,e.convertChangesToXML=function(t){for(var e=[],n=0;n"):r.removed&&e.push(""),e.push(o(r.value)),r.added?e.push(""):r.removed&&e.push("")}return e.join("")}},function(t,e,n){"use strict";t.exports=function(t,e,n){n=n||h;for(var r=t.length,o=e.length,i=r+o,a={},s=[],u=a[1]=0;u<=i;u+=1){for(var f=-u;f<=u;f+=2){var p,c;for(p=f===-u||f!==u&&a[f-1]