OJ1;      !"#$%&'()*+,-./0123456789: Safe-Inferred!"(=K ;       ; Safe-Inferred2468Cursor position;Apply an operation to a document, producing a new document.Composes two operations a and b , producing c , such that c= has the same effect when applied to a document as applying a and b one after another.%Transforms two concurrent operations a and b , producing a' and b' such that b' " a == a' " b.<=>?@ABCDEFGHIJKLMNOP<=>?@ABCDEFGHIJKLMNOPNone +2346=BKAn edit on plain text documents. An operation consists of multiple actions that change the document at the current cursor position or advance the cursor. After applying all actions, the cursor must be at the end of the document.JAn action changes the text at the current position or advances the cursor.Delete the next n characters..Insert the given text at the current position.Skip the next n characters.Q[Merges actions, removes empty ops and makes insert ops come before delete ops. Properties: Idempotence: 0canonicalize op = canonicalize (canonicalize op)"Preserves the effect under apply: *apply op doc = apply (canonicalize op) docCComputes the inverse of an operation. Useful for implementing undo.RSTQ An operation"Document to apply the operation toUVWXYZ[\RSTQUVWXYZ[\None6=BKA selection consists of a list of ranges. Each range may represent a selected part of the document or a cursor in the document." Range has anchor and ]B properties, which are zero-based indices into the document. The anchor1 is the side of the selection that stays fixed, ]g is the side of the selection where the cursor is. When both are equal, the range represents a cursor.&,Create a selection that represents a cursor.'*Does the selection contain any characters?(Number of selected characters !"#$%&'(^_`abcdef  !"#$%&'( "#$% !&(' !"#$%&'(^_`abcdef Safe-Inferred)(b " a)(d) = a(b(d)) where a and b% are two consecutive operations and d is the initial document.*b'(a(d)) = a'(b(d))where a and b are random operations, d is the initial document and (a', b') = transform(a, b).+b' " a = a' " bwhere a and b are random operations and (a', b') = transform(a, b). Note that this is a stronger property than prop_transform_apply, because prop_transform_compose and prop_compose_apply imply prop_transform_apply.,lTransformation is compatible with composition on the left. That is, if we have two consecutive operations a and b and a concurrent operation c:, then it doesn't make a difference whether we transform c against a and then against b or transform c against the composition of a and b. In other terms,  c'_1 = c'_2 where (_, c'_1) = transform(b " a, c), (_, c') = transform(a, c) and (_, c'_2) = transform(b, c').-6Transformation is compatible with composition on the right.gh)*+,-)*+,-)*+,-gh)*+,- Safe-Inferred.6At every moment, the client is in one of three states./pThe client is waiting for an acknowledgement for a pending operation and the client is buffering local changes.0_The client has sent an operation to the server and it is still waiting for an acknowledgement.1DAll of the client's operations have been acknowledged by the server.2;The state a newly connected client starts in (synonym for 1).3!Handle user-generated operations.4+Handle incoming operations from the server.5Handle acknowledgements../0123;The operation the user has performed on the local document.TWhether to send the operation to the server and the new client state (or an error).4bThe transformed operation that must be applied to local document and the new state (or an error).5TAn optional operation that must be sent to the server if present and the new state../012345.10/2345.10/2345 Safe-Inferred6yThe server keeps the current revision number and a list of previous operations to transform incoming operations against.:Handles incoming operations.6789:]The latest operation that the client has received from the server when it sent the operation.'The operation received from the client.6The clients cursor position after the operation. (Use () if not needed.)The operation and the cursor to broadcast to all connected clients (except the client which has created the operation; that client must be sent an acknowledgement) and the new state (or an error).6789:8679:6789:i      !"##$%%&'()*+,-./01234567889:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijkl ot-0.2.0.0&Control.OperationalTransformation.List!Control.OperationalTransformation&Control.OperationalTransformation.Text+Control.OperationalTransformation.Selection,Control.OperationalTransformation.Properties(Control.OperationalTransformation.Client(Control.OperationalTransformation.ServerTransformedPairTP OperationDeleteOpInsertOpRetainOpEmptyOpVectorConsVEmptyVNSZapplycompose transformOTCursor updateCursorOTSystemOTComposableOperation OTOperation TextOperationActionDeleteInsertRetaininvertOperation SelectionrangesRange rangeAnchor rangeHead createCursorsomethingSelectedsizeprop_compose_applyprop_transform_applyprop_transform_composeprop_transform_compose_compat_lprop_transform_compose_compat_r ClientStateClientWaitingWithBuffer ClientWaitingClientSynchronizedinitialClientState applyClient applyServer serverAck ServerStateRevisioninitialServerStateapplyOperation addDeleteOp$fOTSystem(,,,,)(,,,,)$fOTComposableOperation(,,,,)$fOTOperation(,,,,)$fOTSystem(,,,)(,,,)$fOTComposableOperation(,,,)$fOTOperation(,,,)$fOTSystem(,,)(,,)$fOTComposableOperation(,,)$fOTOperation(,,)$fOTSystem(,)(,)$fOTComposableOperation(,)$fOTOperation(,)$fOTCursor(,,,,)op$fOTCursor(,,,)op$fOTCursor(,,)op$fOTCursor(,)op$fOTCursor[]op$fOTCursor()op$fOTSystemdoc[]$fOTComposableOperation[]$fOTOperation[] canonicalize addRetain addInsert addDelete$fOTSystemTextTextOperation$$fOTComposableOperationTextOperation$fOTOperationTextOperation$fEqTextOperation$fIsListTextOperation$fFromJSONAction$fToJSONAction$fBinaryActionbaseGHC.Listhead$fIsListSelection$fFromJSONSelection$fToJSONSelection$fOrdSelection $fEqSelection $fOTCursorSelectionTextOperation$fOTCursorRangeTextOperation$fFromJSONRange $fToJSONRange==?eitherProperty