!function e(r,t,n){function a(s,o){if(!t[s]){if(!r[s]){var u="function"==typeof require&&require;if(!o&&u)return u(s,!0);if(i)return i(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var c=t[s]={exports:{}};r[s][0].call(c.exports,function(e){var t=r[s][1][e];return a(t?t:e)},c,c.exports,e,r,t,n)}return t[s].exports}for(var i="function"==typeof require&&require,s=0;s=a)throw new Error("Unexpected operation!")}o.idArray.splice(a,0,JSON.stringify(n.id)),o.valArray.splice(a,0,n.content),r.push({type:"insert",object:o,index:a,value:n.content,length:1})}else{if("Delete"!==n.struct)throw new Error("Unexpected struct!");var a=o.idArray.indexOf(JSON.stringify(n.target));if(a>=0){var s=o.valArray[a];o.idArray.splice(a,1),o.valArray.splice(a,1),r.push({type:"delete",object:o,index:a,value:s,length:1})}}}o.eventHandler.callEventListeners(r)})}return i(r,[{key:"get",value:function(e){if(null==e||"number"!=typeof e)throw new Error("pos must be a number!");return this.valArray[e]}},{key:"toArray",value:function(){return this.valArray.slice()}},{key:"push",value:function(e){this.insert(this.idArray.length,e)}},{key:"insert",value:function(e,r){if("number"!=typeof e)throw new Error("pos must be a number!");if(!(r instanceof Array))throw new Error("contents must be an Array of objects!");if(0!==r.length){if(e>this.idArray.length||0>e)throw new Error("This position exceeds the range of the array!");for(var t=0===e?null:JSON.parse(this.idArray[e-1]),n=[],a=t,i=0;ithis.idArray.length||0>e||0>r)throw new Error("The deletion range exceeds the range of the array!");if(0!==r){for(var t=this.eventHandler,n=e>0?JSON.parse(this.idArray[e-1]):null,a=[],i=0;r>i;i++)a.push({target:JSON.parse(this.idArray[e+i]),struct:"Delete"});t.awaitAndPrematurelyCall(a),this.os.requestTransaction(regeneratorRuntime.mark(function s(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.delegateYield(this.applyCreatedOperations(a),"t0",1);case 1:t.awaitedDeletes(a.length,n);case 2:case"end":return e.stop()}},s,this)}))}}},{key:"observe",value:function(e){this.eventHandler.addEventListener(e)}},{key:"_changed",value:regeneratorRuntime.mark(function t(e,r){var n,a;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(r.deleted){t.next=13;break}if("Insert"!==r.struct){t.next=12;break}n=r.left;case 3:if(null==n){t.next=11;break}return t.delegateYield(e.getOperation(n),"t0",5);case 5:if(a=t.t0,a.deleted){t.next=8;break}return t.abrupt("break",11);case 8:n=a.left,t.next=3;break;case 11:r.left=n;case 12:this.eventHandler.receivedOp(r);case 13:case"end":return t.stop()}},t,this)})},{key:"length",get:function(){return this.idArray.length}}]),r}();e.extend("Array",new e.utils.CustomType({name:"Array","class":r,struct:"List",initType:regeneratorRuntime.mark(function t(n,a){var i,s;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return i=[],t.delegateYield(e.Struct.List.map.call(this,a,function(e){return i.push(e.content),JSON.stringify(e.id)}),"t0",2);case 2:return s=t.t0,t.abrupt("return",new r(n,a.id,s,i));case 4:case"end":return t.stop()}},t,this)})}))}var i=function(){function e(e,r){for(var t=0;t