Files
yjs/build/browser/Frameworks/TextFramework.min.js

1 line
26 KiB
JavaScript
Raw Normal View History

!function e(t,n,r){function i(s,p){if(!n[s]){if(!t[s]){var a="function"==typeof require&&require;if(!p&&a)return a(s,!0);if(o)return o(s,!0);throw new Error("Cannot find module '"+s+"'")}var l=n[s]={exports:{}};t[s][0].call(l.exports,function(e){var n=t[s][1][e];return i(n?n:e)},l,l.exports,e,t,n,r)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(e,t){var n;n=function(){function e(e,t){this.HB=e,this.parser=t,this.unprocessed_ops=[]}return e.prototype.parseOperation=function(e){var t;if(t=this.parser[e.type],null!=t)return t(e);throw new Error("You forgot to specify a parser for type "+e.type+". The message is "+JSON.stringify(e)+".")},e.prototype.applyOpsBundle=function(e){var t,n,r,i,o,s,p,a;for(n=[],r=0,s=e.length;s>r;r++)t=e[r],n.push(this.parseOperation(t));for(i=0,p=n.length;p>i;i++)t=n[i],this.HB.addOperation(t);for(o=0,a=n.length;a>o;o++)t=n[o],t.execute()||this.unprocessed_ops.push(t);return this.tryUnprocessed()},e.prototype.applyOpsCheckDouble=function(e){var t,n,r,i;for(i=[],n=0,r=e.length;r>n;n++)t=e[n],null==this.HB.getOperation(t.uid)?i.push(this.applyOp(t)):i.push(void 0);return i},e.prototype.applyOps=function(e){var t,n,r,i;for(i=[],n=0,r=e.length;r>n;n++)t=e[n],i.push(this.applyOp(t));return i},e.prototype.applyOp=function(e){var t;return t=this.parseOperation(e),this.HB.addToCounter(t),t.execute()?this.HB.addOperation(t):this.unprocessed_ops.push(t),this.tryUnprocessed()},e.prototype.tryUnprocessed=function(){var e,t,n,r,i,o,s;for(s=[];;){for(e=this.unprocessed_ops.length,n=[],o=this.unprocessed_ops,r=0,i=o.length;i>r;r++)t=o[r],t.execute()?this.HB.addOperation(t):n.push(t);if(this.unprocessed_ops=n,this.unprocessed_ops.length===e)break;s.push(void 0)}return s},e}(),t.exports=n},{}],2:[function(e,t){var n,r,i,o;o=e("../Types/TextTypes"),r=e("../HistoryBuffer"),n=e("../Engine"),i=function(){function e(e,t){var i,s,p,a,l,u,c,h;this.HB=new r(e),l=o(this.HB),this.types=l.types,this.engine=new n(this.HB,l.parser),this.connector=new t(this.engine,this.HB,l.execution_listener,this),s=this.HB.addOperation(new this.types.Delimiter({creator:"_",op_number:"_beginning"},void 0,void 0)),p=this.HB.addOperation(new this.types.Delimiter({creator:"_",op_number:"_end"},s,void 0)),s.next_cl=p,s.execute(),p.execute(),a=new this.types.WordType({creator:"_",op_number:"_"},s,p),this.HB.addOperation(a).execute(),h={creator:"_",op_number:"RM"},u={creator:"_",op_number:"_RM_beginning"},c={creator:"_",op_number:"_RM_end"},i=this.HB.addOperation(new this.types.Delimiter(u,void 0,c)).execute(),p=this.HB.addOperation(new this.types.Delimiter(c,i,void 0)).execute(),this.root_element=this.HB.addOperation(new this.types.ReplaceManager(void 0,h,i,p)).execute(),this.root_element.replace(a,{creator:"_",op_number:"Replaceable"})}return e.prototype.getSharedObject=function(){return this.root_element.val()},e.prototype.getConnector=function(){return this.connector},e.prototype.getHistoryBuffer=function(){return this.HB},e.prototype.getUserId=function(){return this.HB.getUserId()},e.prototype.val=function(){return this.getSharedObject().val()},e.prototype.insertText=function(e,t){return this.getSharedObject().insertText(e,t)},e.prototype.deleteText=function(e,t){return this.getSharedObject().deleteText(e,t)},e.prototype.bind=function(e){return this.getSharedObject().bind(e)},e.prototype.replaceText=function(e){return this.getSharedObject().replaceText(e)},e.prototype.on=function(){var e;return(e=this.root_element).on.apply(e,arguments)},e}(),t.exports=i,"undefined"!=typeof window&&null!==window&&(null==window.Y&&(window.Y={}),window.Y.TextFramework=i)},{"../Engine":1,"../HistoryBuffer":3,"../Types/TextTypes":6}],3:[function(e,t){var n,r=function(e,t){return function(){return e.apply(t,arguments)}};n=function(){function e(e){this.user_id=e,this.emptyGarbage=r(this.emptyGarbage,this),this.operation_counter={},this.buffer={},this.change_listeners=[],this.garbage=[],this.trash=[],this.performGarbageCollection=!0,this.garbageCollectTimeout=1e3,this.reserved_identifier_counter=0