;/*FB_PKG_DELIM*/
__d("useUnifiedEditorSaveVideoMutation_Mutation_facebookRelayOperation",[],(function(a,b,c,d,e,f){e.exports="4817846931647660"}),null);
__d("useUnifiedEditorSaveVideoMutation_Mutation.graphql",["useUnifiedEditorSaveVideoMutation_Mutation_facebookRelayOperation"],(function(a,b,c,d,e,f){"use strict";a=function(){var a=[{defaultValue:null,kind:"LocalArgument",name:"input"}],c=[{alias:null,args:[{kind:"Variable",name:"data",variableName:"input"}],concreteType:"SaveUeVideoResponsePayload",kind:"LinkedField",name:"save_ue_video",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"success",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:a,kind:"Fragment",metadata:null,name:"useUnifiedEditorSaveVideoMutation_Mutation",selections:c,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:a,kind:"Operation",name:"useUnifiedEditorSaveVideoMutation_Mutation",selections:c},params:{id:b("useUnifiedEditorSaveVideoMutation_Mutation_facebookRelayOperation"),metadata:{},name:"useUnifiedEditorSaveVideoMutation_Mutation",operationKind:"mutation",text:null}}}();e.exports=a}),null);
__d("UEComponentMatcher_component.graphql",[],(function(a,b,c,d,e,f){"use strict";a={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"UEComponentMatcher_component",selections:[{kind:"InlineFragment",selections:[{args:null,documentName:"UEComponentMatcher_component",fragmentName:"UEImage_component",fragmentPropName:"component",kind:"ModuleImport"}],type:"XFBUEImageData",abstractKey:null},{kind:"InlineFragment",selections:[{args:null,documentName:"UEComponentMatcher_component",fragmentName:"UEVideo_component",fragmentPropName:"component",kind:"ModuleImport"}],type:"XFBUEVideoData",abstractKey:null}],type:"XFBUEComponentData",abstractKey:"__isXFBUEComponentData"};e.exports=a}),null);
__d("UEComponentQueryContainerQuery_facebookRelayOperation",[],(function(a,b,c,d,e,f){e.exports="7681710328522567"}),null);
__d("UEComponentQueryContainerQuery.graphql",["UEComponentQueryContainerQuery_facebookRelayOperation"],(function(a,b,c,d,e,f){"use strict";a=function(){var a=[{defaultValue:null,kind:"LocalArgument",name:"components"}],c=[{kind:"Variable",name:"components",variableName:"components"}];return{fragment:{argumentDefinitions:a,kind:"Fragment",metadata:null,name:"UEComponentQueryContainerQuery",selections:[{kind:"RequiredField",field:{alias:"componentValues",args:c,concreteType:"XFBUEComponentMap",kind:"LinkedField",name:"xfb_ue_components",plural:!1,selections:[{kind:"RequiredField",field:{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"components",plural:!0,selections:[{args:null,kind:"FragmentSpread",name:"UEComponentMatcher_component"}],storageKey:null},action:"THROW",path:"componentValues.components"}],storageKey:null},action:"THROW",path:"componentValues"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:a,kind:"Operation",name:"UEComponentQueryContainerQuery",selections:[{alias:"componentValues",args:c,concreteType:"XFBUEComponentMap",kind:"LinkedField",name:"xfb_ue_components",plural:!1,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"components",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"TypeDiscriminator",abstractKey:"__isXFBUEComponentData"},{kind:"InlineFragment",selections:[{args:null,documentName:"UEComponentMatcher_component",fragmentName:"UEImage_component",fragmentPropName:"component",kind:"ModuleImport"}],type:"XFBUEImageData",abstractKey:null},{kind:"InlineFragment",selections:[{args:null,documentName:"UEComponentMatcher_component",fragmentName:"UEVideo_component",fragmentPropName:"component",kind:"ModuleImport"}],type:"XFBUEVideoData",abstractKey:null},{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],storageKey:null}],storageKey:null}]},params:{id:b("UEComponentQueryContainerQuery_facebookRelayOperation"),metadata:{},name:"UEComponentQueryContainerQuery",operationKind:"query",text:null}}}();e.exports=a}),null);
__d("UEVideoComponentGlimmerEncodingQuery_facebookRelayOperation",[],(function(a,b,c,d,e,f){e.exports="5155780134487741"}),null);
__d("UEVideoComponentGlimmerEncodingQuery.graphql",["UEVideoComponentGlimmerEncodingQuery_facebookRelayOperation"],(function(a,b,c,d,e,f){"use strict";a=function(){var a=[{defaultValue:null,kind:"LocalArgument",name:"videoID"}],c=[{kind:"Variable",name:"id",variableName:"videoID"}],d={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},e={alias:null,args:null,kind:"ScalarField",name:"video_status_type",storageKey:null};return{fragment:{argumentDefinitions:a,kind:"Fragment",metadata:null,name:"UEVideoComponentGlimmerEncodingQuery",selections:[{alias:null,args:c,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{kind:"InlineFragment",selections:[d,e],type:"Video",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:a,kind:"Operation",name:"UEVideoComponentGlimmerEncodingQuery",selections:[{alias:null,args:c,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},d,{kind:"InlineFragment",selections:[e],type:"Video",abstractKey:null}],storageKey:null}]},params:{id:b("UEVideoComponentGlimmerEncodingQuery_facebookRelayOperation"),metadata:{live:{polling_interval:1500}},name:"UEVideoComponentGlimmerEncodingQuery",operationKind:"query",text:null}}}();e.exports=a}),null);
__d("KnowledgeNotesReadPermalinkGeminiRootQuery$Parameters",["KnowledgeNotesReadPermalinkGeminiRootQuery_facebookRelayOperation"],(function(a,b,c,d,e,f){"use strict";a={kind:"PreloadableConcreteRequest",params:{id:b("KnowledgeNotesReadPermalinkGeminiRootQuery_facebookRelayOperation"),metadata:{},name:"KnowledgeNotesReadPermalinkGeminiRootQuery",operationKind:"query",text:null}};e.exports=a}),null);
__d("BladerunnerCafTypes",["$InternalEnum"],(function(a,b,c,d,e,f){"use strict";c=(a=b("$InternalEnum"))({UNKNOWN:0,INTERNAL_INFRA_ERROR:1,WWW_HANDLER_ROUTING_ERROR:2,INTERNAL_APP_JS_HANDLER_ERROR:3,NOT_ALLOWED_TO_CREATE_ENTITY:20,APP_FAILED_TO_CREATE_ENTITY:21,INFRA_FAILED_TO_CREATE_ENTITY:22,FAILED_TO_INITIALIZE_DEFAULT_ENTITY:23,NOT_ALLOWED_TO_GET_ENTITY:30,APP_FAILED_TO_GET_ENTITY:31,INFRA_FAILED_TO_GET_ENTITY:32,FAILED_TO_SUBSCRIBE_FOR_UPDATES:40,SUBSCRIPTION_FAILURE:41,NOT_ALLOWED_TO_MAKE_UPDATE:50,APP_FAILED_TO_CHECK_PUBLISH_PRIVACY:51,INFRA_FAILED_TO_PUBLISH:52,NOT_ALLOWED_TO_SEE_UPDATES_FROM_OTHERS:60,APP_FAILED_TO_CHECK_ENTITY_PRIVACY:61,APP_FAILED_TO_CHECK_AUTHORIZATION:62,NOT_AUTHORIZED:63,FAILED_TO_FETCH_CLIENT_STATES:70,FAILED_TO_INSERT_CLIENT_STATE:71,FAILED_TO_DELETE_CLIENT_STATE:72,FAILED_TO_ADD_CLIENT_STATE:73,APP_FAILED_TO_TRANSFORM_ENTITY_UPDATE:80,INFRA_FAILED_TO_TRANSFORM_ENTITY_UPDATE:81,APP_FAILED_TO_TRANSFORM_CLIENT_STATE_UPDATE:82,INFRA_FAILED_TO_TRANSFORM_CLIENT_STATE_UPDATE:83,APP_FAILED_TO_TRANSFORM_CLIENT_PRESENCE_UPDATE:84,INFRA_FAILED_TO_TRANSFORM_CLIENT_PRESENCE_UPDATE:85,APP_FAILED_TO_TRANSFORM_SESSION_STATE:86,INFRA_FAILED_TO_TRANSFORM_SESSION_STATE:87,APP_WWW_FAILED_TO_TRANSFORM:88,APP_FAILED_TO_SAVE_SNAPSHOT:90,GLOBAL_SNAPSHOT_IS_NEWER:91,CLIENT_STATE_UPDATE_FAILED:100,ENTITY_UPDATE_FAILED:101,CLIENT_MISSING_ENTITY_PAYLOAD_DETECTED:104,CLIENT_MISSING_PRESENCE_PAYLOAD_DETECTED:105,CLIENT_MISSING_STATE_PAYLOAD_DETECTED:106,CLIENT_DROPPED_IN_FLIGHT_UPDATES_ON_CLOSE:107,CLIENT_FAILED_TO_PUBLISH_AFTER_RETRIES:108});d=a({EntityInfo:"entityInfo",Error:"error"});f=a({EntityInfo:"entityInfo",Error:"error"});b=a({Result:"result",Error:"error"});var g=a({Passed:"passed",Error:"error"});a=a({AuthorizationFlags:"authorizationFlags",Error:"error"});e.exports={AuthorizeResponse$Types:a,CheckEntityPrivacyResponse$Types:g,CreateEntityResponse$Types:f,ErrorCode:c,GetEntityResponse$Types:d,TransformResponse$Types:b}}),null);
__d("CollaborativeAppClientEventType",["$InternalEnum"],(function(a,b,c,d,e,f){a=b("$InternalEnum")({UNKNOWN:0,CLIENT_JOINED:1,CLIENT_LEFT:2});c=a;f["default"]=c}),66);
__d("CollaborativeAppClientUtils",["BladeRunnerStreamStatus","RequestStreamCommonRequestStreamCommonTypes"],(function(a,b,c,d,e,f,g){"use strict";function a(a){switch(a){case d("RequestStreamCommonRequestStreamCommonTypes").FlowStatus.Accepted:return d("BladeRunnerStreamStatus").StreamStatus.ACCEPTED;case d("RequestStreamCommonRequestStreamCommonTypes").FlowStatus.Started:return d("BladeRunnerStreamStatus").StreamStatus.STARTED;case d("RequestStreamCommonRequestStreamCommonTypes").FlowStatus.Stopped:return d("BladeRunnerStreamStatus").StreamStatus.STOPPED}}g.flowStatusToStreamStatus=a}),98);
__d("CollaborativeAppTypes",["$InternalEnum"],(function(a,b,c,d,e,f){a=b("$InternalEnum")({GUARANTEED:0,BEST_EFFORT:1});f.DeliveryMethod=a}),66);
__d("CollaborativeAppClient",["BladeRunnerClient","BladeRunnerStreamHandler","BladeRunnerStreamStatus","BladerunnerCafTypes","CollaborativeAppClientEventType","CollaborativeAppClientUtils","CollaborativeAppTypes","FBLogger","GuaranteedUpdateHandler","ODS","Promise","TransportSelectingClientSingleton","err","nullthrows","regeneratorRuntime","uuidv4"],(function(a,b,c,d,e,f,g){"use strict";var h,i;a=function(){function a(b,e){var f=this;this.$10=!1;this.$12=!1;this.$14=function(a,b){b=b===void 0?{}:b;b=b.deliveryMethod;a=[a];b!=null&&a.push(d("CollaborativeAppTypes").DeliveryMethod.getName(b).toLowerCase());a.push(f.$3.usecase);(i||(i=d("ODS"))).bumpEntityKey(4566,"CollaborativeAppClient",a.join("."))};this.$18=function(b){b=JSON.parse(b);var e=f.$5;switch(b.dataType){case"entity":f.$14(b.dataType+"_received");f.$6=b.entityInfo.entityId;f.$7=b.entityInfo.lastCursor;e.handleEntity&&e.handleEntity({serializedEntity:b.entityInfo.entity,entityId:b.entityInfo.entityId,lastCursor:b.entityInfo.lastCursor});break;case"session_state":f.$14(b.dataType+"_received");var g=c("nullthrows")(b.transformedResponse);f.$4=b.currentClientId;f.$8=a.$1;f.$9=null;e.handleSession&&e.handleSession({serializedSession:g,currentClientId:b.currentClientId});break;case"entity_update":f.$14(b.dataType+"_received",{deliveryMethod:b.deliveryMethod});b.amendmentId!=null&&f.$13.responseReceived(b.amendmentId,b.dataType);if(b.deliveryMethod===d("CollaborativeAppTypes").DeliveryMethod.GUARANTEED){if(!f.$21(b.updateInfo.previousCursor)){f.$22(b.updateInfo.previousCursor);break}f.$7=b.updateInfo.cursor}if(f.$23(b.senderClientId,b.dataType))return;g=c("nullthrows")(b.updateInfo.update);e.handleEntityUpdate&&e.handleEntityUpdate({update:g,senderClientId:b.senderClientId,cursor:b.updateInfo.cursor,serverConflict:b.serverConflict,deliveryMethod:b.deliveryMethod});break;case"client_presence_update":f.$14(b.dataType+"_"+c("CollaborativeAppClientEventType").getName(b.eventType).toLowerCase()+"_received");if(!f.$24(b.previousCursor)){g="Client presence update in-order delivery failed (entity id = '"+String(f.$6)+"', last cursor processed = '"+String(f.$9)+"', previous cursor received = '"+b.previousCursor+"')";f.$25({errorCode:d("BladerunnerCafTypes").ErrorCode.CLIENT_MISSING_PRESENCE_PAYLOAD_DETECTED,message:g})}f.$9=b.cursor;if(f.$23(b.senderClientId,b.dataType))return;g=c("nullthrows")(b.transformedResponse);e.handlePresenceUpdate&&e.handlePresenceUpdate({update:g,senderClientId:b.senderClientId,eventType:b.eventType,cursor:b.cursor});break;case"client_state_update":f.$14(b.dataType+"_received");if(!f.$26(b.updateInfo.previousCursor)){f.$27(b.updateInfo.previousCursor);break}f.$8=b.updateInfo.cursor;if(f.$23(b.senderClientId,b.dataType))return;g=c("nullthrows")(b.updateInfo.update);e.handleClientStateUpdate&&e.handleClientStateUpdate({update:g,senderClientId:b.senderClientId,cursor:b.updateInfo.cursor});break;case"error":f.$14(b.dataType+"_"+f.$28(b.errorCode)+"_received");f.$25({errorCode:b.errorCode});break}};this.$3=b;this.$5=e;this.$13=new(d("GuaranteedUpdateHandler").GuaranteedUpdateHandler)({retryPolicy:this.$3.retryPolicy,amendAckTimeoutInMs:this.$3.amendAckTimeoutInMs,maxInflightAmendsQueueSize:this.$3.maxInflightAmendsQueueSize,bumpCounter:this.$14})}var e=a.prototype;e.genCreateNewEntity=function(a){a=a===void 0?{}:a;var b=a.context;a=a.wwwTier;return this.$15({requestType:"create",usecase:this.$3.usecase,context:b,wwwTier:a})};e.genOpenEntity=function(a,b){b=b===void 0?{}:b;var c=b.context;b=b.wwwTier;this.$6=a;return this.$15({requestType:"open",usecase:this.$3.usecase,context:c,entityId:a,wwwTier:b})};e.$16=function(){if(this.$12)throw c("err")("genCreateNewEntity or genOpenEnitty has already been called once. To call again, create a new instance of CollaborativeAppClient.");this.$12=!0};e.$15=function(a){var e=this;this.$16();return new(h||(h=b("Promise")))(function(f,g){var h,i,j;return b("regeneratorRuntime").async(function(k){while(1)switch(k.prev=k.next){case 0:e.$14(a.requestType+"_attempt");h={method:(g=e.$3.methodName)!=null?g:e.$17(e.$3.usecase)};i=new(c("BladeRunnerStreamHandler"))(e.$18,null,function(b){switch(b){case d("BladeRunnerStreamStatus").StreamStatus.STARTED:e.$14(a.requestType+"_success");f({kind:"success"});break;case d("BladeRunnerStreamStatus").StreamStatus.REJECTED:e.$14(a.requestType+"_failure");c("FBLogger")(e.constructor.name).warn("onStatus rejected");f({kind:"failure",error:{errorCode:d("BladerunnerCafTypes").ErrorCode.INTERNAL_INFRA_ERROR}});break}e.$5.handleConnectionStatusChange&&e.$5.handleConnectionStatusChange(b)});if(!(e.$10&&e.$11)){k.next=6;break}k.next=6;return b("regeneratorRuntime").awrap(e.$11);case 6:e.$19();if(!e.$20()){k.next=13;break}k.next=10;return b("regeneratorRuntime").awrap(c("TransportSelectingClientSingleton").requestStream(h,JSON.stringify(a),{onData:e.$18,onFlowStatus:function(a){return i.onStatusUpdate(d("CollaborativeAppClientUtils").flowStatusToStreamStatus(a))},onTermination:function(){i.onStatusUpdate(d("BladeRunnerStreamStatus").StreamStatus.CLOSED)}}));case 10:e.$2=k.sent;k.next=15;break;case 13:j=new(c("BladeRunnerClient"))(),e.$2=j.requestStream(h,JSON.stringify(a),i);case 15:e.$13.setStream(e.$2);case 16:case"end":return k.stop()}},null,this)})};e.$17=function(a){return a.charAt(0).toUpperCase()+a.slice(1).replace(/([-_][a-z0-9])/gi,function(a){return a.toUpperCase().replace("-","").replace("_","")})};e.$23=function(a,b){if(this.$4===a){this.$14("received_same_client_update."+b);return this.$3.dropSameClientUpdates===!0}return!1};e.genSendEntityUpdate=function(a,c){var e,f,g,h;return b("regeneratorRuntime").async(function(i){while(1)switch(i.prev=i.next){case 0:f="entity_update";g=(e=c==null?void 0:c.deliveryMethod)!=null?e:d("CollaborativeAppTypes").DeliveryMethod.GUARANTEED;this.$14(f+"_attempt",{deliveryMethod:g});if(!(g===d("CollaborativeAppTypes").DeliveryMethod.BEST_EFFORT)){i.next=7;break}h=this.$29(a,f);i.next=10;break;case 7:i.next=9;return b("regeneratorRuntime").awrap(this.$30(a,f));case 9:h=i.sent;case 10:h.kind==="success"?this.$14(f+"_success",{deliveryMethod:g}):this.$14(f+"_failure."+this.$28(h.error.errorCode),{deliveryMethod:g});return i.abrupt("return",h);case 12:case"end":return i.stop()}},null,this)};e.$29=function(a,b){this.$14(b+"_attempt");try{var c;a={update:a,amendmentType:b,deliveryMethod:d("CollaborativeAppTypes").DeliveryMethod.BEST_EFFORT};(c=this.$2)==null?void 0:c.amendWithoutAck(JSON.stringify(a));this.$14(b+"_success");return{kind:"success"}}catch(d){if((d==null?void 0:d.message)!=null)c=d.message,a="error_thrown";else{var e;c=(e=d)!=null?e:"null message";a="amend_rejected"}return this.$31(b,a,c)}};e.sendClientStateUpdate=function(a){return this.$29(a,"client_state_update")};e.$30=function(a,e){var f,g,h,i;return b("regeneratorRuntime").async(function(j){while(1)switch(j.prev=j.next){case 0:j.prev=0;if(!this.$10){j.next=3;break}throw c("err")("stream terminating");case 3:f=c("uuidv4")();g=JSON.stringify({amendmentId:f,amendmentType:e,update:a,deliveryMethod:d("CollaborativeAppTypes").DeliveryMethod.GUARANTEED});j.next=7;return b("regeneratorRuntime").awrap(this.$13.genSendUpdate(f,e,a,g));case 7:h=j.sent;if(!(h!=null)){j.next=11;break}this.$19({errorCode:d("BladerunnerCafTypes").ErrorCode.CLIENT_FAILED_TO_PUBLISH_AFTER_RETRIES,message:"Failed to publish after retries"});return j.abrupt("return",this.$31(e,h.failureCause,h.message));case 11:return j.abrupt("return",{kind:"success",amendmentId:f});case 14:j.prev=14;j.t0=j["catch"](0);return j.abrupt("return",this.$31(e,"error_thrown",(i=j.t0.message)!=null?i:"null_message"));case 17:case"end":return j.stop()}},null,this,[[0,14]])};e.$31=function(a,b,e){this.$14(a+"_failure."+b);b=a+" failed with type "+b+": "+(e!=null?e:"");c("FBLogger")(this.constructor.name).warn(b);e=a==="client_state_update"?d("BladerunnerCafTypes").ErrorCode.CLIENT_STATE_UPDATE_FAILED:d("BladerunnerCafTypes").ErrorCode.ENTITY_UPDATE_FAILED;return{kind:"failure",error:{errorCode:e,message:b}}};e.genClose=function(a){var c=this;this.$14("close_attempt");this.$11=new(h||(h=b("Promise")))(function(e,f){var g,i;return b("regeneratorRuntime").async(function(j){while(1)switch(j.prev=j.next){case 0:g=!0;c.$10=!0;a!=null&&(i=setTimeout(function(){g=!c.$13.anyInflightUpdate(),g||c.$19({errorCode:d("BladerunnerCafTypes").ErrorCode.CLIENT_DROPPED_IN_FLIGHT_UPDATES_ON_CLOSE,message:"Force closing the stream while there are inflight updates."})},a));f=c.$13.getInflightUpdatePromises();j.next=6;return b("regeneratorRuntime").awrap((h||(h=b("Promise"))).allSettled(f));case 6:clearTimeout(i),c.$32(),g&&c.$14("close_success"),e(g);case 10:case"end":return j.stop()}},null,this)});return this.$11};e.$32=function(){var a;(a=this.$2)==null?void 0:a.cancel();this.$2=null;this.$10=!1;this.$13.setStream(null)};e.getInflightEntityUpdates=function(){return this.$13.getInflightUpdateOperations()};e.$19=function(a){var b;this.$13.anyInflightUpdate()&&(b=this.$13.getInflightUpdatePayloads(),this.$13.rejectInflightUpdates(c("err")("stream terminating")));a!=null&&this.$2!=null&&this.$25(a,b);this.$32()};e.$21=function(a){return this.$7===a};e.$26=function(b){return[a.$1,b].includes(this.$8)};e.$24=function(a){return this.$9==null||this.$9===a};e.$22=function(a){a="Entity update in-order delivery failed (entity id = '"+String(this.$6)+"', last cursor processed = '"+String(this.$7)+"', previous cursor received = '"+String(a)+"')";this.$33({message:a,errorCode:d("BladerunnerCafTypes").ErrorCode.CLIENT_MISSING_ENTITY_PAYLOAD_DETECTED})};e.$27=function(a){a="Client state update in-order delivery failed (entity id = '"+String(this.$6)+"', last cursor processed = '"+String(this.$8)+"', previous cursor received = '"+String(a)+"')";this.$33({message:a,errorCode:d("BladerunnerCafTypes").ErrorCode.CLIENT_MISSING_STATE_PAYLOAD_DETECTED})};e.$33=function(a){this.$19(a);if((a==null?void 0:a.message)!=null){a=a==null?void 0:a.message;c("FBLogger")(this.constructor.name).warn(a)}};e.$25=function(a,b){this.$14("error_"+this.$28(a.errorCode)),this.$5.handleError==null?void 0:this.$5.handleError({error:a,inflightUpdates:b})};e.$28=function(a){return a==null?"error-code-missing":d("BladerunnerCafTypes").ErrorCode.getName(a).toLowerCase()};e.$20=function(){return this.$3.usecase!=="collabri"?!1:!0};return a}();a.$1={};g["default"]=a}),98);
__d("CollaborativeAppWwwTier",["$InternalEnum"],(function(a,b,c,d,e,f){a=b("$InternalEnum")({INTERN:"intern",PROD:"prod"});c=a;f["default"]=c}),66);
__d("CollabriErrorCode",[],(function(a,b,c,d,e,f){"use strict";a={APPLY_LOCAL_CHANGE_TO_COLLABRI:"-3",APPLY_LOCAL_CHANGE_TO_MODEL:"-4",APPLY_REMOTE_CHANGE_FROM_CAF:"-1",CONNECTION_FAILURE:"-5",EMPTY_CURSOR:"-6",SEND_CHANGE_BY_CAF:"-2"};b=a;f["default"]=b}),66);
__d("CollabriErrorFalcoEvent",["FalcoLoggerInternal","getFalcoLogPolicy_DO_NOT_USE"],(function(a,b,c,d,e,f,g){"use strict";a=c("getFalcoLogPolicy_DO_NOT_USE")("1598");b=d("FalcoLoggerInternal").create("collabri_error",a);e=b;g["default"]=e}),98);
__d("CollabriDraftUtils",[],(function(a,b,c,d,e,f){"use strict";var g={},h=Math.pow(2,24);function a(){var a;while(a===void 0||Object.prototype.hasOwnProperty.call(g,a)||!isNaN(+a))a=Math.floor(Math.random()*h).toString(32);g[a]=!0;return a}f.generateRandomKey=a}),66);
__d("CollabriMutex",[],(function(a,b,c,d,e,f){"use strict";a=function(){var a=!0;return function(b,c){if(a){a=!1;try{b()}finally{a=!0}}else c!==void 0&&c()}};f.createMutex=a}),66);
__d("CollabriTypes",["$InternalEnum"],(function(a,b,c,d,e,f){a=b("$InternalEnum").Mirrored(["Monaco","Quill","Draft","UnifiedEditor","Lexical"]);c=function(){function a(){}var b=a.prototype;b.getDoc=function(){return this.$1};b.setDoc=function(a){this.$1=a};b.getParent=function(){return this.$2};b.setParent=function(a){this.$2=a};b.getRaw=function(){throw new Error("implement in subclass")};b.createRelativePosition=function(a){throw new Error("implement in subclass")};return a}();f.CollabriDocumentType=a;f.CollabriAbstractType=c}),66);
__d("CollabriYjsUpdate",[],(function(a,b,c,d,e,f){"use strict";a=function(){function a(a){this.$2=!0,this.$1=a}var b=a.prototype;b.getUpdate=function(){return this.$1};b.shouldPropagate=function(){return this.$2};b.stopPropagation=function(){this.$2=!1};b.serialize=function(){return JSON.stringify(this.$1)};a.deserialize=function(b){b=JSON.parse(b);return new a(b)};return a}();f["default"]=a}),66);
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @nolint
* @providesModule yjs
* @preserve-header
* @preserve-whitespace
* @no-auto-requires
* @generated
* @preventMunge
* @preserve-invariant-messages
* @generated
* @preserve-whitespace
*
* yjs@13.5.42
* https://docs.yjs.dev
*
* Yjs is a CRDT implementation that exposes its internal data structure as
* shared types. Shared types are common data types like Map or Array with
* superpowers: changes are automatically distributed to other peers and merged
* without merge conflicts.
*
* Copyright: 2020 Kevin Jahns
*
* License: MIT
*/
__d("yjs",[],(function $module_yjs(global,require,requireDynamic,requireLazy,module,exports){
"use strict";var t,e;function n(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */n=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},u=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,n){return t[e]=n}}function f(t,e,n,r){var o=e&&e.prototype instanceof v?e:v,u=Object.create(o.prototype),c=new D(r||[]);return i(u,"_invoke",{value:S(t,n,c)}),u}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=f;var d={};function v(){}function g(){}function p(){}var y={};s(y,u,(function(){return this}));var k=Object.getPrototypeOf,w=k&&k(k(A([])));w&&w!==e&&r.call(w,u)&&(y=w);var m=p.prototype=v.prototype=Object.create(y);function b(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function n(i,o,u,c){var l=h(t[i],t,o);if("throw"!==l.type){var s=l.arg,f=s.value;return f&&"object"==a(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,u,c)}),(function(t){n("throw",t,u,c)})):e.resolve(f).then((function(t){s.value=t,u(s)}),(function(t){return n("throw",t,u,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return o=o?o.then(i,i):i()}})}function S(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return O()}for(n.method=i,n.arg=o;;){var u=n.delegate;if(u){var c=E(u,n);if(c){if(c===d)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var l=h(t,e,n);if("normal"===l.type){if(r=n.done?"completed":"suspendedYield",l.arg===d)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r="completed",n.method="throw",n.arg=l.arg)}}}function E(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,E(t,e),"throw"===e.method))return d;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var r=h(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,d;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,d):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function D(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function A(t){if(t){var e=t[u];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n=0;--i){var o=this.tryEntries[i],u=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var c=r.call(o,"catchLoc"),l=r.call(o,"finallyLoc");if(c&&l){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;C(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:A(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},t}var r=n().mark(Hn);function i(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function o(t){for(var e=1;e=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,c=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return u=t.done,t},e:function(t){c=!0,o=t},f:function(){try{u||null==n.return||n.return()}finally{if(c)throw o}}}}function _(t,e){if(t){if("string"==typeof t)return S(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?S(t,e):void 0}}function S(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);ne?t:e},P=function(t){return 0!==t?t<0:1/t<0},V=/^\s*/g,F=/([A-Z])/g,J=function(t,e){return function(t){return t.replace(V,"")}(t.replace(F,(function(t){return"".concat(e).concat(function(t){return t.toLowerCase()}(t))})))},B="undefined"!=typeof TextEncoder?new TextEncoder:null,z=B?function(t){return B.encode(t)}:function(t){for(var e=unescape(encodeURIComponent(t)),n=e.length,r=new Uint8Array(n),i=0;i2&&void 0!==arguments[2]?arguments[2]:0;try{for(;rct)throw new Error("Integer out of range!")}},gt=function(t){var e=t.arr[t.pos++],n=63&e,r=64,i=(64&e)>0?-1:1;if(0==(128&e))return i*n;for(;;){if(n+=(127&(e=t.arr[t.pos++]))*r,r*=128,e<128)return i*n;if(n>ct)throw new Error("Integer out of range!")}},pt=W?function(t){return W.decode(ht(t))}:function(t){var e=vt(t);if(0===e)return"";var n=String.fromCodePoint(dt(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(dt(t));else for(;e>0;){var r=e<1e4?e:1e4,i=t.arr.subarray(t.pos,t.pos+r);t.pos+=r,n+=String.fromCodePoint.apply(null,i),e-=r}return decodeURIComponent(escape(n))},yt=function(t,e){var n=new DataView(t.arr.buffer,t.arr.byteOffset+t.pos,e);return t.pos+=e,n},kt=[function(t){},function(t){return null},gt,function(t){return yt(t,4).getFloat32(0,!1)},function(t){return yt(t,8).getFloat64(0,!1)},function(t){return yt(t,8).getBigInt64(0,!1)},function(t){return!1},function(t){return!0},pt,function(t){for(var e=vt(t),n={},r=0;r127;)Ot(t,128|127&e),e=U(e/128);Ot(t,127&e)},Mt=function(t,e){var n=P(e);for(n&&(e=-e),Ot(t,(e>63?128:0)|(n?64:0)|63&e),e=U(e/64);e>0;)Ot(t,(e>127?128:0)|127&e),e=U(e/128)},Tt=new Uint8Array(3e4),Ut=Tt.length/3,Rt=B&&B.encodeInto?function(t,e){if(e.length0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(N(2*n,o)),t.cbuf.set(e.subarray(i)),t.cpos=o)},Pt=function(t,e){Lt(t,e.byteLength),Nt(t,e)},Vt=function(t,e){!function(t,e){var n=t.cbuf.length;n-t.cpos0&&Lt(this,this.count-1),this.count=1,this.w(this,t),this.s=t)}}]),n}(),zt=function(t){t.count>0&&(Mt(t.encoder,1===t.count?t.s:-t.s),t.count>1&&Lt(t.encoder,t.count-2))},Wt=function(){function t(){y(this,t),this.encoder=new Ct,this.s=0,this.count=0}return w(t,[{key:"write",value:function(t){this.s===t?this.count++:(zt(this),this.count=1,this.s=t)}},{key:"toUint8Array",value:function(){return zt(this),At(this.encoder)}}]),t}(),Gt=function(t){if(t.count>0){var e=2*t.diff+(1===t.count?0:1);Mt(t.encoder,e),t.count>1&&Lt(t.encoder,t.count-2)}},Yt=function(){function t(){y(this,t),this.encoder=new Ct,this.s=0,this.count=0,this.diff=0}return w(t,[{key:"write",value:function(t){this.diff===t-this.s?(this.s=t,this.count++):(Gt(this),this.count=1,this.diff=t-this.s,this.s=t)}},{key:"toUint8Array",value:function(){return Gt(this),At(this.encoder)}}]),t}(),Ht=function(){function t(){y(this,t),this.sarr=[],this.s="",this.lensE=new Wt}return w(t,[{key:"write",value:function(t){this.s+=t,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(t.length)}},{key:"toUint8Array",value:function(){var t=new Ct;return this.sarr.push(this.s),this.s="",Rt(t,this.sarr.join("")),Nt(t,this.lensE.toUint8Array()),At(t)}}]),t}(),Kt=w((function t(e,n){y(this,t),this.clock=e,this.len=n})),Xt=w((function t(){y(this,t),this.clients=new Map})),$t=function(t,e,n){return e.clients.forEach((function(e,r){for(var i=t.doc.store.clients.get(r),o=0;o=i.clock?r.len=N(r.len,i.clock+i.len-r.clock):(n0&&e.clients.set(n,r)})),e},re=function(t,e){Lt(t.restEncoder,e.clients.size),e.clients.forEach((function(e,n){t.resetDsCurVal(),Lt(t.restEncoder,n);var r=e.length;Lt(t.restEncoder,r);for(var i=0;i0)for(var u=C(e.clients,i,(function(){return[]})),c=0;c0){var g=new xe;return Lt(g.restEncoder,0),re(g,r),g.toUint8Array()}return null},ue="undefined"==typeof crypto?null:crypto,ce=null!==ue?function(t){var e=new ArrayBuffer(t),n=new Uint8Array(e);return ue.getRandomValues(n),e}:function(t){for(var e=new ArrayBuffer(t),n=new Uint8Array(e),r=0;r>>0);return e},le=function(){return new Uint32Array(ce(4))[0]},ae=[1e7]+-1e3+-4e3+-8e3+-1e11,se=function(){return ae.replace(/[018]/g,(function(t){return(t^le()&15>>t/4).toString(16)}))},fe=Date.now,he=function(t){return new Promise(t)},de=le,ve=function(t){s(n,M);var e=h(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=r.guid,o=void 0===i?se():i,u=r.collectionid,c=void 0===u?null:u,l=r.gc,a=void 0===l||l,s=r.gcFilter,f=void 0===s?function(){return!0}:s,h=r.meta,d=void 0===h?null:h,g=r.autoLoad,p=void 0!==g&&g,k=r.shouldLoad,w=void 0===k||k;return y(this,n),(t=e.call(this)).gc=a,t.gcFilter=f,t.clientID=de(),t.guid=o,t.collectionid=c,t.share=new Map,t.store=new cn,t._transaction=null,t._transactionCleanups=[],t.subdocs=new Set,t._item=null,t.shouldLoad=w,t.autoLoad=p,t.meta=d,t.isLoaded=!1,t.whenLoaded=he((function(e){t.on("load",(function(){t.isLoaded=!0,e(v(t))}))})),t}return w(n,[{key:"load",value:function(){var t=this,e=this._item;null===e||this.shouldLoad||Bn(e.parent.doc,(function(e){e.subdocsLoaded.add(t)}),null,!0),this.shouldLoad=!0}},{key:"getSubdocs",value:function(){return this.subdocs}},{key:"getSubdocGuids",value:function(){return new Set(Array.from(this.subdocs).map((function(t){return t.guid})))}},{key:"transact",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;Bn(this,t,e)}},{key:"get",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:wr,r=C(this.share,t,(function(){var t=new n;return t._integrate(e,null),t})),i=r.constructor;if(n!==wr&&i!==n){if(i===wr){var o=new n;o._map=r._map,r._map.forEach((function(t){for(;null!==t;t=t.left)t.parent=o})),o._start=r._start;for(var u=o._start;null!==u;u=u.right)u.parent=o;return o._length=r._length,this.share.set(t,o),o._integrate(this,null),o}throw new Error("Type with the name ".concat(t," has already been defined with a different constructor"))}return r}},{key:"getArray",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return this.get(t,jr)}},{key:"getText",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return this.get(t,Qr)}},{key:"getMap",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return this.get(t,Pr)}},{key:"getXmlFragment",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return this.get(t,ei)}},{key:"toJSON",value:function(){var t={};return this.share.forEach((function(e,n){t[n]=e.toJSON()})),t}},{key:"destroy",value:function(){var t=this;I(this.subdocs).forEach((function(t){return t.destroy()}));var e=this._item;if(null!==e){this._item=null;var r=e.content;r.doc=new n(o(o({guid:this.guid},r.opts),{},{shouldLoad:!1})),r.doc._item=e,Bn(e.parent.doc,(function(n){var i=r.doc;e.deleted||n.subdocsAdded.add(i),n.subdocsRemoved.add(t)}),null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),c(g(n.prototype),"destroy",this).call(this)}},{key:"on",value:function(t,e){c(g(n.prototype),"on",this).call(this,t,e)}},{key:"off",value:function(t,e){c(g(n.prototype),"off",this).call(this,t,e)}}]),n}(),ge=function(){function t(e){y(this,t),this.restDecoder=e}return w(t,[{key:"resetDsCurVal",value:function(){}},{key:"readDsClock",value:function(){return vt(this.restDecoder)}},{key:"readDsLen",value:function(){return vt(this.restDecoder)}}]),t}(),pe=function(t){s(n,ge);var e=h(n);function n(){return y(this,n),e.apply(this,arguments)}return w(n,[{key:"readLeftID",value:function(){return We(vt(this.restDecoder),vt(this.restDecoder))}},{key:"readRightID",value:function(){return We(vt(this.restDecoder),vt(this.restDecoder))}},{key:"readClient",value:function(){return vt(this.restDecoder)}},{key:"readInfo",value:function(){return dt(this.restDecoder)}},{key:"readString",value:function(){return pt(this.restDecoder)}},{key:"readParentInfo",value:function(){return 1===vt(this.restDecoder)}},{key:"readTypeRef",value:function(){return vt(this.restDecoder)}},{key:"readLen",value:function(){return vt(this.restDecoder)}},{key:"readAny",value:function(){return wt(this.restDecoder)}},{key:"readBuf",value:function(){return xt(ht(this.restDecoder))}},{key:"readJSON",value:function(){return JSON.parse(pt(this.restDecoder))}},{key:"readKey",value:function(){return pt(this.restDecoder)}}]),n}(),ye=function(){function t(e){y(this,t),this.dsCurrVal=0,this.restDecoder=e}return w(t,[{key:"resetDsCurVal",value:function(){this.dsCurrVal=0}},{key:"readDsClock",value:function(){return this.dsCurrVal+=vt(this.restDecoder),this.dsCurrVal}},{key:"readDsLen",value:function(){var t=vt(this.restDecoder)+1;return this.dsCurrVal+=t,t}}]),t}(),ke=function(t){s(n,ye);var e=h(n);function n(t){var r;return y(this,n),(r=e.call(this,t)).keys=[],vt(t),r.keyClockDecoder=new _t(ht(t)),r.clientDecoder=new bt(ht(t)),r.leftClockDecoder=new _t(ht(t)),r.rightClockDecoder=new _t(ht(t)),r.infoDecoder=new mt(ht(t),dt),r.stringDecoder=new St(ht(t)),r.parentInfoDecoder=new mt(ht(t),dt),r.typeRefDecoder=new bt(ht(t)),r.lenDecoder=new bt(ht(t)),r}return w(n,[{key:"readLeftID",value:function(){return new Be(this.clientDecoder.read(),this.leftClockDecoder.read())}},{key:"readRightID",value:function(){return new Be(this.clientDecoder.read(),this.rightClockDecoder.read())}},{key:"readClient",value:function(){return this.clientDecoder.read()}},{key:"readInfo",value:function(){return this.infoDecoder.read()}},{key:"readString",value:function(){return this.stringDecoder.read()}},{key:"readParentInfo",value:function(){return 1===this.parentInfoDecoder.read()}},{key:"readTypeRef",value:function(){return this.typeRefDecoder.read()}},{key:"readLen",value:function(){return this.lenDecoder.read()}},{key:"readAny",value:function(){return wt(this.restDecoder)}},{key:"readBuf",value:function(){return ht(this.restDecoder)}},{key:"readJSON",value:function(){return wt(this.restDecoder)}},{key:"readKey",value:function(){var t=this.keyClockDecoder.read();if(tt&&r.set(n,t)})),ln(e).forEach((function(t,e){n.has(e)||r.set(e,0)})),Lt(t.restEncoder,r.size),Array.from(r.entries()).sort((function(t,e){return e[0]-t[0]})).forEach((function(n){var r=m(n,2),i=r[0],o=r[1];!function(t,e,n,r){r=N(r,e[0].id.clock);var i=fn(e,r);Lt(t.restEncoder,e.length-i),t.writeClient(n),Lt(t.restEncoder,r);var o=e[i];o.write(t,r-o.id.clock);for(var u=i+1;u0))return null;t=n.get(i[i.length-1])}return t},u=o();if(null===u&&0===r.length)return null;for(var c=new cn,l=new Map,a=function(t,e){var n=l.get(t);(null==n||n>e)&&l.set(t,e)},s=u.refs[u.i++],f=new Map,h=function(){var t,e=b(r);try{var o=function(){var e=t.value,r=e.id.client,o=n.get(r);o?(o.i--,c.clients.set(r,o.refs.slice(o.i)),n.delete(r),o.i=0,o.refs=[]):c.clients.set(r,[e]),i=i.filter((function(t){return t!==r}))};for(e.s();!(t=e.n()).done;)o()}catch(t){e.e(t)}finally{e.f()}r.length=0};;){if(s.constructor!==Ti){var d=C(f,s.id.client,(function(){return an(e,s.id.client)}))-s.id.clock;if(d<0)r.push(s),a(s.id.client,s.id.clock-1),h();else{var v=s.getMissing(t,e);if(null!==v){r.push(s);var g=n.get(v)||{refs:[],i:0};if(g.refs.length!==g.i){s=g.refs[g.i++];continue}a(v,an(e,v)),h()}else(0===d||d0)s=r.pop();else if(null!==u&&u.i0){var p=new xe;return Ce(p,c,new Map),Lt(p.restEncoder,0),{missing:l,update:p.toUint8Array()}}return null},Oe=function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new ke(t);return Bn(e,(function(t){t.local=!1;var e=!1,n=t.doc,i=n.store,o=De(r,n),u=Ae(t,i,o),c=i.pendingStructs;if(c){var l,a=b(c.missing);try{for(a.s();!(l=a.n()).done;){var s=m(l.value,2),f=s[0];if(s[1]p)&&c.missing.set(g,p)}}catch(t){d.e(t)}finally{d.f()}c.update=nr([c.update,u.update])}}else i.pendingStructs=u;var k=oe(r,t,i);if(i.pendingDs){var w=new ke(st(i.pendingDs));vt(w.restDecoder);var _=oe(w,t,i);i.pendingDs=k&&_?nr([k,_]):k||_}else i.pendingDs=k;if(e){var S=i.pendingStructs.update;i.pendingStructs=null,Ie(t.doc,S)}}),n,!1)},Ie=function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:ke,i=st(e);Oe(i,t,n,new r(i))},Le=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Map;Ce(t,e.store,n),re(t,ne(e.store))},Me=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Uint8Array([0]),n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new xe,r=Ue(e);Le(n,t,r);var i=[n.toUint8Array()];if(t.store.pendingDs&&i.push(t.store.pendingDs),t.store.pendingStructs&&i.push(rr(t.store.pendingStructs.update,e)),i.length>1){if(n.constructor===Se)return Zn(i.map((function(t,e){return 0===e?t:lr(t)})));if(n.constructor===xe)return nr(i)}return i[0]},Te=function(t){for(var e=new Map,n=vt(t.restDecoder),r=0;r1&&void 0!==arguments[1]?arguments[1]:e.getMap("users");y(this,t);var i=new Map;this.yusers=r,this.doc=e,this.clients=new Map,this.dss=i;var o=function(t,e){var r=t.get("ds"),i=t.get("ids"),o=function(t){return n.clients.set(t,e)};r.observe((function(t){t.changes.added.forEach((function(t){t.content.getContent().forEach((function(t){t instanceof Uint8Array&&n.dss.set(e,Qt([n.dss.get(e)||ee(),ie(new ge(st(t)))]))}))}))})),n.dss.set(e,Qt(r.map((function(t){return ie(new ge(st(t)))})))),i.observe((function(t){return t.changes.added.forEach((function(t){return t.content.getContent().forEach(o)}))})),i.forEach(o)};r.observe((function(t){t.keysChanged.forEach((function(t){return o(r.get(t),t)}))})),r.forEach(o)}return w(t,[{key:"setUserMapping",value:function(t,e,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i.filter,u=void 0===o?function(){return!0}:o,c=this.yusers,l=c.get(n);l||((l=new Pr).set("ids",new jr),l.set("ds",new jr),c.set(n,l)),l.get("ids").push([e]),c.observe((function(t){setTimeout((function(){var t=c.get(n);if(t!==l){l=t,r.clients.forEach((function(t,e){n===t&&l.get("ids").push([e])}));var e=new _e,i=r.dss.get(n);i&&(re(e,i),l.get("ds").push([e.toUint8Array()]))}}),0)})),t.on("afterTransaction",(function(t){setTimeout((function(){var e=l.get("ds"),n=t.deleteSet;if(t.local&&n.clients.size>0&&u(t,n)){var r=new _e;re(r,n),e.push([r.toUint8Array()])}}))}))}},{key:"getUserByClientId",value:function(t){return this.clients.get(t)||null}},{key:"getUserByDeletedId",value:function(t){var e,n=b(this.dss.entries());try{for(n.s();!(e=n.n()).done;){var r=m(e.value,2),i=r[0],o=r[1];if(qt(o,t))return i}}catch(t){n.e(t)}finally{n.f()}return null}}]),t}(),$e=w((function t(e,n,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;y(this,t),this.type=e,this.tname=n,this.item=r,this.assoc=i})),qe=w((function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;y(this,t),this.type=e,this.index=n,this.assoc=r})),Ze=function(t,e,n){var r=null,i=null;return null===t._item?i=He(t):r=We(t._item.id.client,t._item.id.clock),new $e(r,i,e,n)},Qe=w((function t(e,n){y(this,t),this.ds=e,this.sv=n})),tn=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ee;return re(e,t.ds),Re(e,t.sv),e.toUint8Array()},en=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new ye(st(t));return new Qe(ie(e),Te(e))},nn=function(t,e){return new Qe(t,e)},rn=nn(ee(),new Map),on=function(t,e){return void 0===e?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!qt(e.ds,t.id)},un=function t(e,n){var r=C(e.meta,t,D),i=e.doc.store;r.has(n)||(n.sv.forEach((function(t,n){t0&&(e.push("[0m"),n.push(e.join("")));r0||l.length>0?(e.push("%c"+u),n.push(l)):e.push(u)}}for(o>0&&(i=n).unshift(e.join(""));o0&&n.push(e.join(""));r=0;a--)for(var s=c[a],f=s.clock+s.len,h=fn(l,s.clock),d=l[h];h=0;i--)for(var o=t[i],u=j(r.length-1,1+fn(r,o.clock+o.len-1)),c=r[u];u>0&&c.id.clock>=o.clock;c=r[--u])Pn(r,u)}))},Jn=function t(e,n){if(n=u;c--)Pn(i,c)}));for(var a=0;a0&&Pn(d,v)}if(r.local||r.afterState.get(i.clientID)===r.beforeState.get(i.clientID)||(Tn(An,bn,"[yjs] ",_n,Cn,"Changed the client-id because another client seems to be using it."),i.clientID=de()),i.emit("afterTransactionCleanup",[r,i]),i._observers.has("update")){var g=new Se;jn(g,r)&&i.emit("update",[g.toUint8Array(),r.origin,i,r])}if(i._observers.has("updateV2")){var p=new xe;jn(p,r)&&i.emit("updateV2",[p.toUint8Array(),r.origin,i,r])}var y=r.subdocsAdded,k=r.subdocsLoaded,w=r.subdocsRemoved;(y.size>0||w.size>0||k.size>0)&&(y.forEach((function(t){t.clientID=i.clientID,null==t.collectionid&&(t.collectionid=i.collectionid),i.subdocs.add(t)})),w.forEach((function(t){return i.subdocs.delete(t)})),i.emit("subdocs",[{loaded:k,added:y,removed:w},i,r]),w.forEach((function(t){return t.destroy()}))),e.length<=n+1?(i._transactionCleanups=[],i.emit("afterAllTransactions",[i,e])):t(e,n+1)}}},Bn=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=t._transactionCleanups,o=!1;null===t._transaction&&(o=!0,t._transaction=new Rn(t,n,r),i.push(t._transaction),1===i.length&&t.emit("beforeAllTransactions",[t]),t.emit("beforeTransaction",[t._transaction,t]));try{e(t._transaction)}finally{o&&i[0]===t._transaction&&Jn(i,0)}},zn=w((function t(e,n){y(this,t),this.insertions=n,this.deletions=e,this.meta=new Map})),Wn=function(t,e,n){$t(t,n.deletions,(function(t){t instanceof Ii&&e.scope.some((function(e){return Ke(e,t)}))&&Di(t,!1)}))},Gn=function(t,e,n){var r=null,i=null,o=t.doc,u=t.scope;if(Bn(o,(function(n){for(var c=function(){var i=o.store,c=e.pop(),l=new Set,a=[],s=!1;$t(n,c.insertions,(function(t){if(t instanceof Ii){if(null!==t.redone){var e=Ci(i,t.id),r=e.item,o=e.diff;o>0&&(r=vn(n,We(r.id.client,r.id.clock+o))),t=r}!t.deleted&&u.some((function(e){return Ke(e,t)}))&&a.push(t)}})),$t(n,c.deletions,(function(t){t instanceof Ii&&u.some((function(e){return Ke(e,t)}))&&!qt(c.insertions,t.id)&&l.add(t)})),l.forEach((function(e){s=null!==Oi(n,e,l,c.insertions,t.ignoreRemoteMapChanges)||s}));for(var f=a.length-1;f>=0;f--){var h=a[f];t.deleteFilter(h)&&(h.delete(n),s=!0)}r=s?c:null};e.length>0&&null===r;)c();n.changed.forEach((function(t,e){t.has(null)&&e._searchMarker&&(e._searchMarker.length=0)})),i=n}),t),null!=r){var c=i.changedParentTypes;t.emit("stack-item-popped",[{stackItem:r,type:n,changedParentTypes:c},t])}return r},Yn=function(t){s(n,M);var e=h(n);function n(t){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=i.captureTimeout,u=void 0===o?500:o,c=i.captureTransaction,l=void 0===c?function(t){return!0}:c,a=i.deleteFilter,s=void 0===a?function(){return!0}:a,f=i.trackedOrigins,h=void 0===f?new Set([null]):f,d=i.ignoreRemoteMapChanges,g=void 0!==d&&d,p=i.doc,k=void 0===p?L(t)?t[0].doc:t.doc:p;return y(this,n),(r=e.call(this)).scope=[],r.addToScope(t),r.deleteFilter=s,h.add(v(r)),r.trackedOrigins=h,r.captureTransaction=l,r.undoStack=[],r.redoStack=[],r.undoing=!1,r.redoing=!1,r.doc=k,r.lastChange=0,r.ignoreRemoteMapChanges=g,r.captureTimeout=u,r.afterTransactionHandler=function(t){if(r.captureTransaction(t)&&r.scope.some((function(e){return t.changedParentTypes.has(e)}))&&(r.trackedOrigins.has(t.origin)||t.origin&&r.trackedOrigins.has(t.origin.constructor))){var e=r.undoing,n=r.redoing,i=e?r.redoStack:r.undoStack;e?r.stopCapturing():n||r.clear(!1,!0);var o=new Xt;t.afterState.forEach((function(e,n){var r=t.beforeState.get(n)||0,i=e-r;i>0&&te(o,n,r,i)}));var u=fe(),c=!1;if(r.lastChange>0&&u-r.lastChange0&&!e&&!n){var l=i[i.length-1];l.deletions=Qt([l.deletions,t.deleteSet]),l.insertions=Qt([l.insertions,o])}else i.push(new zn(t.deleteSet,o)),c=!0;e||n||(r.lastChange=u),$t(t,t.deleteSet,(function(t){t instanceof Ii&&r.scope.some((function(e){return Ke(e,t)}))&&Di(t,!0)}));var a=[{stackItem:i[i.length-1],origin:t.origin,type:e?"redo":"undo",changedParentTypes:t.changedParentTypes},v(r)];c?r.emit("stack-item-added",a):r.emit("stack-item-updated",a)}},r.doc.on("afterTransaction",r.afterTransactionHandler),r.doc.on("destroy",(function(){r.destroy()})),r}return w(n,[{key:"addToScope",value:function(t){var e=this;(t=L(t)?t:[t]).forEach((function(t){e.scope.every((function(e){return e!==t}))&&e.scope.push(t)}))}},{key:"addTrackedOrigin",value:function(t){this.trackedOrigins.add(t)}},{key:"removeTrackedOrigin",value:function(t){this.trackedOrigins.delete(t)}},{key:"clear",value:function(){var t=this,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];(e&&this.canUndo()||n&&this.canRedo())&&this.doc.transact((function(r){e&&(t.undoStack.forEach((function(e){return Wn(r,t,e)})),t.undoStack=[]),n&&(t.redoStack.forEach((function(e){return Wn(r,t,e)})),t.redoStack=[]),t.emit("stack-cleared",[{undoStackCleared:e,redoStackCleared:n}])}))}},{key:"stopCapturing",value:function(){this.lastChange=0}},{key:"undo",value:function(){var t;this.undoing=!0;try{t=Gn(this,this.undoStack,"undo")}finally{this.undoing=!1}return t}},{key:"redo",value:function(){var t;this.redoing=!0;try{t=Gn(this,this.redoStack,"redo")}finally{this.redoing=!1}return t}},{key:"canUndo",value:function(){return this.undoStack.length>0}},{key:"canRedo",value:function(){return this.redoStack.length>0}},{key:"destroy",value:function(){this.trackedOrigins.delete(this),this.doc.off("afterTransaction",this.afterTransactionHandler),c(g(n.prototype),"destroy",this).call(this)}}]),n}();function Hn(t){var e,i,o,u,c,l,a,s,f,h,d;return n().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:e=vt(t.restDecoder),i=0;case 2:if(!(i1&&void 0!==arguments[1]?arguments[1]:ke,n=[],r=new e(st(t)),i=new Kn(r,!1),o=i.curr;null!==o;o=i.next())n.push(o);Tn("Structs: ",n);var u=ie(r);Tn("DeleteSet: ",u)},$n=function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ke,n=[],r=new e(st(t)),i=new Kn(r,!1),o=i.curr;null!==o;o=i.next())n.push(o);return{structs:n,ds:ie(r)}},qn=w((function t(e){y(this,t),this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]})),Zn=function(t){return nr(t,pe,Se)},Qn=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ee,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ke,r=new e,i=new Kn(new n(st(t)),!1),o=i.curr;if(null!==o){for(var u=0,c=o.id.client,l=0!==o.id.clock,a=l?0:o.id.clock+o.length;null!==o;o=i.next())c!==o.id.client&&(0!==a&&(u++,Lt(r.restEncoder,c),Lt(r.restEncoder,a)),c=o.id.client,a=0,l=0!==o.id.clock),o.constructor===Ti&&(l=!0),l||(a=o.id.clock+o.length);0!==a&&(u++,Lt(r.restEncoder,c),Lt(r.restEncoder,a));var s=Dt();return Lt(s,u),jt(s,r.restEncoder),r.restEncoder=s,r.toUint8Array()}return Lt(r.restEncoder,0),r.toUint8Array()},tr=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ke,n=new Map,r=new Map,i=new Kn(new e(st(t)),!1),o=i.curr;if(null!==o){var u=o.id.client,c=o.id.clock;for(n.set(u,c);null!==o;o=i.next())u!==o.id.client&&(r.set(u,c),n.set(o.id.client,o.id.clock),u=o.id.client),c=o.id.clock+o.length;r.set(u,c)}return{from:n,to:r}},er=function(t,e){if(t.constructor===ci){var n=t.id,r=n.client,i=n.clock;return new ci(We(r,i+e),t.length-e)}if(t.constructor===Ti){var o=t.id,u=o.client,c=o.clock;return new Ti(We(u,c+e),t.length-e)}var l=t,a=l.id,s=a.client,f=a.clock;return new Ii(We(s,f+e),null,We(s,f+e-1),null,l.rightOrigin,l.parent,l.parentSub,l.content.splice(e))},nr=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ke,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:xe;if(1===t.length)return t[0];for(var r=t.map((function(t){return new e(st(t))})),i=r.map((function(t){return new Kn(t,!0)})),o=null,u=new n,c=new qn(u);(i=i.filter((function(t){return null!==t.curr}))).sort((function(t,e){if(t.curr.id.client===e.curr.id.client){var n=t.curr.id.clock-e.curr.id.clock;return 0===n?t.curr.constructor===e.curr.constructor?0:t.curr.constructor===Ti?1:-1:n}return e.curr.id.client-t.curr.id.client})),0!==i.length;){var l=i[0],a=l.curr.id.client;if(null!==o){for(var s=l.curr,f=!1;null!==s&&s.id.clock+s.length<=o.struct.id.clock+o.struct.length&&s.id.client>=o.struct.id.client;)s=l.next(),f=!0;if(null===s||s.id.client!==a||f&&s.id.clock>o.struct.id.clock+o.struct.length)continue;if(a!==o.struct.id.client)or(c,o.struct,o.offset),o={struct:s,offset:0},l.next();else if(o.struct.id.clock+o.struct.length0&&(o.struct.constructor===Ti?o.struct.length-=v:s=er(s,v)),o.struct.mergeWith(s)||(or(c,o.struct,o.offset),o={struct:s,offset:0},l.next())}}else o={struct:l.curr,offset:0},l.next();for(var g=l.curr;null!==g&&g.id.client===a&&g.id.clock===o.struct.id.clock+o.struct.length&&g.constructor!==Ti;g=l.next())or(c,o.struct,o.offset),o={struct:g,offset:0}}null!==o&&(or(c,o.struct,o.offset),o=null),ur(c);var p=r.map((function(t){return ie(t)})),y=Qt(p);return re(u,y),u.toUint8Array()},rr=function(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ke,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:xe,i=Ue(e),o=new r,u=new qn(o),c=new n(st(t)),l=new Kn(c,!1);l.curr;){var a=l.curr,s=a.id.client,f=i.get(s)||0;if(l.curr.constructor!==Ti)if(a.id.clock+a.length>f)for(or(u,a,N(f-a.id.clock,0)),l.next();l.curr&&l.curr.id.client===s;)or(u,l.curr,0),l.next();else for(;l.curr&&l.curr.id.client===s&&l.curr.id.clock+l.curr.length<=f;)l.next();else l.next()}ur(u);var h=ie(c);return re(o,h),o.toUint8Array()},ir=function(t){t.written>0&&(t.clientStructs.push({written:t.written,restEncoder:At(t.encoder.restEncoder)}),t.encoder.restEncoder=Dt(),t.written=0)},or=function(t,e,n){t.written>0&&t.currClient!==e.id.client&&ir(t),0===t.written&&(t.currClient=e.id.client,t.encoder.writeClient(e.id.client),Lt(t.encoder.restEncoder,e.id.clock+n)),e.write(t.encoder,n),t.written++},ur=function(t){ir(t);var e=t.encoder.restEncoder;Lt(e,t.clientStructs.length);for(var n=0;n=(this.transaction.beforeState.get(t.id.client)||0)}},{key:"changes",get:function(){var t=this._changes;if(null===t){var e=this.target,n=D(),r=D(),i=[];if(t={added:n,deleted:r,delta:i,keys:this.keys},this.transaction.changed.get(e).has(null)){for(var o=null,u=function(){o&&i.push(o)},c=e._start;null!==c;c=c.right)c.deleted?this.deletes(c)&&!this.adds(c)&&(null!==o&&void 0!==o.delete||(u(),o={delete:0}),o.delete+=c.length,r.add(c)):this.adds(c)?(null!==o&&void 0!==o.insert||(u(),o={insert:[]}),o.insert=o.insert.concat(c.content.getContent()),n.add(c)):(null!==o&&void 0!==o.retain||(u(),o={retain:0}),o.retain+=c.length);null!==o&&void 0===o.retain&&u()}this._changes=t}return t}}]),t}(),sr=function(t,e){for(var n=[];null!==e._item&&e!==t;){if(null!==e._item.parentSub)n.unshift(e._item.parentSub);else{for(var r=0,i=e._item.parent._start;i!==e._item&&null!==i;)i.deleted||r++,i=i.right;n.unshift(r)}e=e._item.parent}return n},fr=function(t){var e;return u(e={},Symbol.iterator,(function(){return this})),u(e,"next",t),e},hr=function(t,e){return fr((function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e(i)}}))},dr=0,vr=w((function t(e,n){y(this,t),e.marker=!0,this.p=e,this.index=n,this.timestamp=dr++})),gr=function(t,e,n){t.p.marker=!1,t.p=e,e.marker=!0,t.index=n,t.timestamp=dr++},pr=function(t,e){if(null===t._start||0===e||null===t._searchMarker)return null;var n=0===t._searchMarker.length?null:t._searchMarker.reduce((function(t,n){return R(e-t.index)e;)!(r=r.left).deleted&&r.countable&&(i-=r.length);for(;null!==r.left&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)!(r=r.left).deleted&&r.countable&&(i-=r.length);return null!==n&&R(n.index-i)=80){var r=t.reduce((function(t,e){return t.timestamp=0;r--){var i=t[r];if(n>0){var o=i.p;for(o.marker=!1;o&&(o.deleted||!o.countable);)(o=o.left)&&!o.deleted&&o.countable&&(i.index-=o.length);if(null===o||!0===o.marker){t.splice(r,1);continue}i.p=o,o.marker=!0}(e0&&e===i.index)&&(i.index=N(e,i.index+n))}},kr=function(t,e,n){for(var r=t,i=e.changedParentTypes;C(i,t,(function(){return[]})).push(n),null!==t._item;)t=t._item.parent;Je(r._eH,n,e)},wr=function(){function t(){y(this,t),this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=Pe(),this._dEH=Pe(),this._searchMarker=null}return w(t,[{key:"parent",get:function(){return this._item?this._item.parent:null}},{key:"_integrate",value:function(t,e){this.doc=t,this._item=e}},{key:"_copy",value:function(){throw me()}},{key:"clone",value:function(){throw me()}},{key:"_write",value:function(t){}},{key:"_first",get:function(){for(var t=this._start;null!==t&&t.deleted;)t=t.right;return t}},{key:"_callObserver",value:function(t,e){!t.local&&this._searchMarker&&(this._searchMarker.length=0)}},{key:"observe",value:function(t){Ve(this._eH,t)}},{key:"observeDeep",value:function(t){Ve(this._dEH,t)}},{key:"unobserve",value:function(t){Fe(this._eH,t)}},{key:"unobserveDeep",value:function(t){Fe(this._dEH,t)}},{key:"toJSON",value:function(){}}]),t}(),mr=function(t,e,n){e<0&&(e=t._length+e),n<0&&(n=t._length+n);for(var r=n-e,i=[],o=t._start;null!==o&&r>0;){if(o.countable&&!o.deleted){var u=o.content.getContent();if(u.length<=e)e-=u.length;else{for(var c=e;c0;c++)i.push(u[c]),r--;e=0}}o=o.right}return i},br=function(t){for(var e=[],n=t._start;null!==n;){if(n.countable&&!n.deleted)for(var r=n.content.getContent(),i=0;i0&&((i=new Ii(We(u,an(c,u)),i,i&&i.lastId,l,l&&l.id,e,null,new gi(a))).integrate(t,0),a=[])};r.forEach((function(n){if(null===n)a.push(n);else switch(n.constructor){case Number:case Object:case Boolean:case Array:case String:a.push(n);break;default:switch(s(),n.constructor){case Uint8Array:case ArrayBuffer:(i=new Ii(We(u,an(c,u)),i,i&&i.lastId,l,l&&l.id,e,null,new li(new Uint8Array(n)))).integrate(t,0);break;case ve:(i=new Ii(We(u,an(c,u)),i,i&&i.lastId,l,l&&l.id,e,null,new fi(n))).integrate(t,0);break;default:if(!(n instanceof wr))throw new Error("Unexpected content type in insert operation");(i=new Ii(We(u,an(c,u)),i,i&&i.lastId,l,l&&l.id,e,null,new xi(n))).integrate(t,0)}}})),s()},Cr=we("Length exceeded!"),Dr=function(t,e,n,r){if(n>e._length)throw Cr;if(0===n)return e._searchMarker&&yr(e._searchMarker,n,r.length),xr(t,e,null,r);var i=n,o=pr(e,n),u=e._start;for(null!==o&&(u=o.p,0===(n-=o.index)&&(n+=(u=u.prev)&&u.countable&&!u.deleted?u.length:0));null!==u;u=u.right)if(!u.deleted&&u.countable){if(n<=u.length){n0;c=c.right)!c.deleted&&c.countable&&(n0&&null!==c;)c.deleted||(r0)throw Cr;e._searchMarker&&yr(e._searchMarker,i,-o+r)}},Or=function(t,e,n){var r=e._map.get(n);void 0!==r&&r.delete(t)},Ir=function(t,e,n,r){var i,o=e._map.get(n)||null,u=t.doc,c=u.clientID;if(null==r)i=new gi([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:i=new gi([r]);break;case Uint8Array:i=new li(r);break;case ve:i=new fi(r);break;default:if(!(r instanceof wr))throw new Error("Unexpected content type");i=new xi(r)}new Ii(We(c,an(u.store,c)),o,o&&o.lastId,null,null,e,n,i).integrate(t,0)},Lr=function(t,e){var n=t._map.get(e);return void 0===n||n.deleted?void 0:n.content.getContent()[n.length-1]},Mr=function(t){var e={};return t._map.forEach((function(t,n){t.deleted||(e[n]=t.content.getContent()[t.length-1])})),e},Tr=function(t,e){var n=t._map.get(e);return void 0!==n&&!n.deleted},Ur=function(t){return e=t.entries(),n=function(t){return!t[1].deleted},fr((function(){var t;do{t=e.next()}while(!t.done&&!n(t.value));return t}));var e,n},Rr=function(t){s(n,ar);var e=h(n);function n(t,r){var i;return y(this,n),(i=e.call(this,t,r))._transaction=r,i}return w(n)}(),jr=function(t,e){s(r,t);var n=h(r);function r(){var t;return y(this,r),(t=n.call(this))._prelimContent=[],t._searchMarker=[],t}return w(r,[{key:"_integrate",value:function(t,e){c(g(r.prototype),"_integrate",this).call(this,t,e),this.insert(0,this._prelimContent),this._prelimContent=null}},{key:"_copy",value:function(){return new r}},{key:"clone",value:function(){var t=new r;return t.insert(0,this.toArray().map((function(t){return t instanceof wr?t.clone():t}))),t}},{key:"length",get:function(){return null===this._prelimContent?this._length:this._prelimContent.length}},{key:"_callObserver",value:function(t,e){c(g(r.prototype),"_callObserver",this).call(this,t,e),kr(this,t,new Rr(this,t))}},{key:"insert",value:function(t,e){var n,r=this;null!==this.doc?Bn(this.doc,(function(n){Dr(n,r,t,e)})):(n=this._prelimContent).splice.apply(n,[t,0].concat(p(e)))}},{key:"push",value:function(t){var e,n=this;null!==this.doc?Bn(this.doc,(function(e){!function(t,e,n){var r=(e._searchMarker||[]).reduce((function(t,e){return e.index>t.index?e:t}),{index:0,p:e._start}).p;if(r)for(;r.right;)r=r.right;xr(t,e,r,n)}(e,n,t)})):(e=this._prelimContent).push.apply(e,p(t))}},{key:"unshift",value:function(t){this.insert(0,t)}},{key:"delete",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;null!==this.doc?Bn(this.doc,(function(r){Ar(r,e,t,n)})):this._prelimContent.splice(t,n)}},{key:"get",value:function(t){return Er(this,t)}},{key:"toArray",value:function(){return br(this)}},{key:"slice",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length;return mr(this,t,e)}},{key:"toJSON",value:function(){return this.map((function(t){return t instanceof wr?t.toJSON():t}))}},{key:"map",value:function(t){return Sr(this,t)}},{key:"forEach",value:function(t){_r(this,t)}},{key:e,value:function(){return e=this._start,n=null,r=0,u(t={},Symbol.iterator,(function(){return this})),u(t,"next",(function(){if(null===n){for(;null!==e&&e.deleted;)e=e.right;if(null===e)return{done:!0,value:void 0};n=e.content.getContent(),r=0,e=e.right}var t=n[r++];return n.length<=r&&(n=null),{done:!1,value:t}})),t;var t,e,n,r}},{key:"_write",value:function(t){t.writeTypeRef(ki)}}],[{key:"from",value:function(t){var e=new r;return e.push(t),e}}]),r}(wr,Symbol.iterator),Nr=function(t){s(n,ar);var e=h(n);function n(t,r,i){var o;return y(this,n),(o=e.call(this,t,r)).keysChanged=i,o}return w(n)}(),Pr=function(t,e){s(r,t);var n=h(r);function r(t){var e;return y(this,r),(e=n.call(this))._prelimContent=null,e._prelimContent=void 0===t?new Map:new Map(t),e}return w(r,[{key:"_integrate",value:function(t,e){var n=this;c(g(r.prototype),"_integrate",this).call(this,t,e),this._prelimContent.forEach((function(t,e){n.set(e,t)})),this._prelimContent=null}},{key:"_copy",value:function(){return new r}},{key:"clone",value:function(){var t=new r;return this.forEach((function(e,n){t.set(n,e instanceof wr?e.clone():e)})),t}},{key:"_callObserver",value:function(t,e){kr(this,t,new Nr(this,t,e))}},{key:"toJSON",value:function(){var t={};return this._map.forEach((function(e,n){if(!e.deleted){var r=e.content.getContent()[e.length-1];t[n]=r instanceof wr?r.toJSON():r}})),t}},{key:"size",get:function(){return p(Ur(this._map)).length}},{key:"keys",value:function(){return hr(Ur(this._map),(function(t){return t[0]}))}},{key:"values",value:function(){return hr(Ur(this._map),(function(t){return t[1].content.getContent()[t[1].length-1]}))}},{key:"entries",value:function(){return hr(Ur(this._map),(function(t){return[t[0],t[1].content.getContent()[t[1].length-1]]}))}},{key:"forEach",value:function(t){var e=this;this._map.forEach((function(n,r){n.deleted||t(n.content.getContent()[n.length-1],r,e)}))}},{key:e,value:function(){return this.entries()}},{key:"delete",value:function(t){var e=this;null!==this.doc?Bn(this.doc,(function(n){Or(n,e,t)})):this._prelimContent.delete(t)}},{key:"set",value:function(t,e){var n=this;return null!==this.doc?Bn(this.doc,(function(r){Ir(r,n,t,e)})):this._prelimContent.set(t,e),e}},{key:"get",value:function(t){return Lr(this,t)}},{key:"has",value:function(t){return Tr(this,t)}},{key:"clear",value:function(){var t=this;null!==this.doc?Bn(this.doc,(function(e){t.forEach((function(t,n,r){Or(e,r,n)}))})):this._prelimContent.clear()}},{key:"_write",value:function(t){t.writeTypeRef(wi)}}]),r}(wr,Symbol.iterator),Vr=function(t,e){return t===e||"object"===a(t)&&"object"===a(e)&&t&&e&&tt(t,e)},Fr=function(){function t(e,n,r,i){y(this,t),this.left=e,this.right=n,this.index=r,this.currentAttributes=i}return w(t,[{key:"forward",value:function(){if(null===this.right&&be(),this.right.content.constructor===di)this.right.deleted||Wr(this.currentAttributes,this.right.content);else this.right.deleted||(this.index+=this.right.length);this.left=this.right,this.right=this.right.right}}]),t}(),Jr=function(t,e,n){for(;null!==e.right&&n>0;){if(e.right.content.constructor===di)e.right.deleted||Wr(e.currentAttributes,e.right.content);else e.right.deleted||(n0||c.size>0&&(n.right.deleted||n.right.content.constructor===di));){if(!n.right.deleted)if(n.right.content.constructor===di){var l=n.right.content,a=l.key,s=l.value,f=i[a];if(void 0!==f){if(Vr(f,s))c.delete(a);else{if(0===r)break t;c.set(a,s)}n.right.delete(t)}else n.currentAttributes.set(a,s)}else r0){for(var h="";r>0;r--)h+="\n";n.right=new Ii(We(u,an(o.store,u)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,e,null,new pi(h)),n.right.integrate(t,0),n.forward()}zr(t,e,n,c)},Xr=function(t,e,n,r,i){for(var o=n,u=x(i);o&&(!o.countable||o.deleted);)o.deleted||o.content.constructor!==di||Wr(u,o.content),o=o.right;for(var c=0,l=!1;e!==o;){if(n===e&&(l=!0),!e.deleted){var a=e.content;if(a.constructor===di){var s=a.key,f=a.value;(u.get(s)||null)===f&&(r.get(s)||null)!==f||(e.delete(t),c++,l||(i.get(s)||null)!==f||(r.get(s)||null)===f||i.delete(s))}}e=e.right}return c},$r=function(t){var e=0;return Bn(t.doc,(function(n){for(var r=t._start,i=t._start,o=E(),u=x(o);i;){if(!1===i.deleted)if(i.content.constructor===di)Wr(u,i.content);else e+=Xr(n,r,i,o,u),o=x(u),r=i;i=i.right}})),e},qr=function(t,e,n){for(var r=n,i=x(e.currentAttributes),o=e.right;n>0&&null!==e.right;){if(!1===e.right.deleted)switch(e.right.content.constructor){case xi:case hi:case pi:n0&&(t.attributes={},r.forEach((function(e,n){null!==e&&(t.attributes[n]=e)}))),l="";break;case"retain":if(t={retain:a},Object.keys(c).length>0)for(var e in t.attributes={},c)t.attributes[e]=c[e];a=0}n.push(t),u=null}};null!==o;){switch(o.content.constructor){case xi:case hi:t.adds(o)?t.deletes(o)||(f(),u="insert",l=o.content.getContent()[0],f()):t.deletes(o)?("delete"!==u&&(f(),u="delete"),s+=1):o.deleted||("retain"!==u&&(f(),u="retain"),a+=1);break;case pi:t.adds(o)?t.deletes(o)||("insert"!==u&&(f(),u="insert"),l+=o.content.str):t.deletes(o)?("delete"!==u&&(f(),u="delete"),s+=o.length):o.deleted||("retain"!==u&&(f(),u="retain"),a+=o.length);break;case di:var h=o.content,d=h.key,v=h.value;if(t.adds(o)){if(!t.deletes(o)){var g=r.get(d)||null;Vr(g,v)?null!==v&&o.delete(e):("retain"===u&&f(),Vr(v,i.get(d)||null)?delete c[d]:c[d]=v)}}else if(t.deletes(o)){i.set(d,v);var p=r.get(d)||null;Vr(p,v)||("retain"===u&&f(),c[d]=p)}else if(!o.deleted){i.set(d,v);var y=c[d];void 0!==y&&(Vr(y,v)?null!==y&&o.delete(e):("retain"===u&&f(),null===v?delete c[d]:c[d]=v))}o.deleted||("insert"===u&&f(),Wr(r,o.content))}o=o.right}for(f();n.length>0;){var k=n[n.length-1];if(void 0===k.retain||void 0!==k.attributes)break;n.pop()}})),this._delta=n}return this._delta}}]),n}(),Qr=function(t){s(n,wr);var e=h(n);function n(t){var r;return y(this,n),(r=e.call(this))._pending=void 0!==t?[function(){return r.insert(0,t)}]:[],r._searchMarker=[],r}return w(n,[{key:"length",get:function(){return this._length}},{key:"_integrate",value:function(t,e){c(g(n.prototype),"_integrate",this).call(this,t,e);try{this._pending.forEach((function(t){return t()}))}catch(t){console.error(t)}this._pending=null}},{key:"_copy",value:function(){return new n}},{key:"clone",value:function(){var t=new n;return t.applyDelta(this.toDelta()),t}},{key:"_callObserver",value:function(t,e){var r=this;c(g(n.prototype),"_callObserver",this).call(this,t,e);var i=new Zr(this,t,e),o=t.doc;if(kr(this,t,i),!t.local){var u,l=!1,a=b(t.afterState.entries());try{for(a.s();!(u=a.n()).done;){var s=m(u.value,2),f=s[0],h=s[1],d=t.beforeState.get(f)||0;if(h!==d&&(pn(t,o.store.clients.get(f),d,h,(function(t){t.deleted||t.content.constructor!==di||(l=!0)})),l))break}}catch(t){a.e(t)}finally{a.f()}l||$t(t,t.deleteSet,(function(t){t instanceof ci||l||t.parent===r&&t.content.constructor===di&&(l=!0)})),Bn(o,(function(t){l?$r(r):$t(t,t.deleteSet,(function(e){e instanceof ci||e.parent===r&&function(t,e){for(;e&&e.right&&(e.right.deleted||!e.right.countable);)e=e.right;for(var n=new Set;e&&(e.deleted||!e.countable);){if(!e.deleted&&e.content.constructor===di){var r=e.content.key;n.has(r)?e.delete(t):n.add(r)}e=e.left}}(t,e)}))}))}}},{key:"toString",value:function(){for(var t="",e=this._start;null!==e;)!e.deleted&&e.countable&&e.content.constructor===pi&&(t+=e.content.str),e=e.right;return t}},{key:"toJSON",value:function(){return this.toString()}},{key:"applyDelta",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.sanitize,i=void 0===r||r;null!==this.doc?Bn(this.doc,(function(n){for(var r=new Fr(null,e._start,0,new Map),o=0;o0)&&Hr(n,e,r,c,u.attributes||{})}else void 0!==u.retain?Kr(n,e,r,u.retain,u.attributes||{}):void 0!==u.delete&&qr(n,r,u.delete)}})):this._pending.push((function(){return e.applyDelta(t)}))}},{key:"toDelta",value:function(t,e,n){var r=[],i=new Map,o=this.doc,u="",c=this._start;function l(){if(u.length>0){var t={},e=!1;i.forEach((function(n,r){e=!0,t[r]=n}));var n={insert:u};e&&(n.attributes=t),r.push(n),u=""}}return Bn(o,(function(o){for(t&&un(o,t),e&&un(o,e);null!==c;){if(on(c,t)||void 0!==e&&on(c,e))switch(c.content.constructor){case pi:var a=i.get("ychange");void 0===t||on(c,t)?void 0===e||on(c,e)?void 0!==a&&(l(),i.delete("ychange")):void 0!==a&&a.user===c.id.client&&"added"===a.type||(l(),i.set("ychange",n?n("added",c.id):{type:"added"})):void 0!==a&&a.user===c.id.client&&"removed"===a.type||(l(),i.set("ychange",n?n("removed",c.id):{type:"removed"})),u+=c.content.str;break;case xi:case hi:l();var s={insert:c.content.getContent()[0]};i.size>0&&function(){var t={};s.attributes=t,i.forEach((function(e,n){t[n]=e}))}(),r.push(s);break;case di:on(c,t)&&(l(),Wr(i,c.content))}c=c.right}l()}),un),r}},{key:"insert",value:function(t,e,n){var r=this;if(!(e.length<=0)){var i=this.doc;null!==i?Bn(i,(function(i){var o=Br(i,r,t);n||(n={},o.currentAttributes.forEach((function(t,e){n[e]=t}))),Hr(i,r,o,e,n)})):this._pending.push((function(){return r.insert(t,e,n)}))}}},{key:"insertEmbed",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=this.doc;null!==i?Bn(i,(function(i){var o=Br(i,n,t);Hr(i,n,o,e,r)})):this._pending.push((function(){return n.insertEmbed(t,e,r)}))}},{key:"delete",value:function(t,e){var n=this;if(0!==e){var r=this.doc;null!==r?Bn(r,(function(r){qr(r,Br(r,n,t),e)})):this._pending.push((function(){return n.delete(t,e)}))}}},{key:"format",value:function(t,e,n){var r=this;if(0!==e){var i=this.doc;null!==i?Bn(i,(function(i){var o=Br(i,r,t);null!==o.right&&Kr(i,r,o,e,n)})):this._pending.push((function(){return r.format(t,e,n)}))}}},{key:"removeAttribute",value:function(t){var e=this;null!==this.doc?Bn(this.doc,(function(n){Or(n,e,t)})):this._pending.push((function(){return e.removeAttribute(t)}))}},{key:"setAttribute",value:function(t,e){var n=this;null!==this.doc?Bn(this.doc,(function(r){Ir(r,n,t,e)})):this._pending.push((function(){return n.setAttribute(t,e)}))}},{key:"getAttribute",value:function(t){return Lr(this,t)}},{key:"getAttributes",value:function(t){return Mr(this)}},{key:"_write",value:function(t){t.writeTypeRef(mi)}}]),n}(),ti=function(t){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return!0};y(this,e),this._filter=n,this._root=t,this._currentNode=t._start,this._firstCall=!0}return w(e,[{key:Symbol.iterator,value:function(){return this}},{key:"next",value:function(){var t=this._currentNode,e=t&&t.content&&t.content.type;if(null!==t&&(!this._firstCall||t.deleted||!this._filter(e)))do{if(e=t.content.type,t.deleted||e.constructor!==ni&&e.constructor!==ei||null===e._start)for(;null!==t;){if(null!==t.right){t=t.right;break}t=t.parent===this._root?null:t.parent._item}else t=e._start}while(null!==t&&(t.deleted||!this._filter(t.content.type)));return this._firstCall=!1,null===t?{value:void 0,done:!0}:(this._currentNode=t,{value:t.content.type,done:!1})}}]),e}(),ei=function(t){s(n,wr);var e=h(n);function n(){var t;return y(this,n),(t=e.call(this))._prelimContent=[],t}return w(n,[{key:"firstChild",get:function(){var t=this._first;return t?t.content.getContent()[0]:null}},{key:"_integrate",value:function(t,e){c(g(n.prototype),"_integrate",this).call(this,t,e),this.insert(0,this._prelimContent),this._prelimContent=null}},{key:"_copy",value:function(){return new n}},{key:"clone",value:function(){var t=new n;return t.insert(0,this.toArray().map((function(t){return t instanceof wr?t.clone():t}))),t}},{key:"length",get:function(){return null===this._prelimContent?this._length:this._prelimContent.length}},{key:"createTreeWalker",value:function(t){return new ti(this,t)}},{key:"querySelector",value:function(t){t=t.toUpperCase();var e=new ti(this,(function(e){return e.nodeName&&e.nodeName.toUpperCase()===t})).next();return e.done?null:e.value}},{key:"querySelectorAll",value:function(t){return t=t.toUpperCase(),Array.from(new ti(this,(function(e){return e.nodeName&&e.nodeName.toUpperCase()===t})))}},{key:"_callObserver",value:function(t,e){kr(this,t,new ri(this,e,t))}},{key:"toString",value:function(){return Sr(this,(function(t){return t.toString()})).join("")}},{key:"toJSON",value:function(){return this.toString()}},{key:"toDOM",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,r=t.createDocumentFragment();return void 0!==n&&n._createAssociation(r,this),_r(this,(function(i){r.insertBefore(i.toDOM(t,e,n),null)})),r}},{key:"insert",value:function(t,e){var n,r=this;null!==this.doc?Bn(this.doc,(function(n){Dr(n,r,t,e)})):(n=this._prelimContent).splice.apply(n,[t,0].concat(p(e)))}},{key:"insertAfter",value:function(t,e){var n=this;if(null!==this.doc)Bn(this.doc,(function(r){var i=t&&t instanceof wr?t._item:t;xr(r,n,i,e)}));else{var r=this._prelimContent,i=null===t?0:r.findIndex((function(e){return e===t}))+1;if(0===i&&null!==t)throw we("Reference item not found");r.splice.apply(r,[i,0].concat(p(e)))}}},{key:"delete",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;null!==this.doc?Bn(this.doc,(function(r){Ar(r,e,t,n)})):this._prelimContent.splice(t,n)}},{key:"toArray",value:function(){return br(this)}},{key:"push",value:function(t){this.insert(this.length,t)}},{key:"unshift",value:function(t){this.insert(0,t)}},{key:"get",value:function(t){return Er(this,t)}},{key:"slice",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length;return mr(this,t,e)}},{key:"forEach",value:function(t){_r(this,t)}},{key:"_write",value:function(t){t.writeTypeRef(_i)}}]),n}(),ni=function(t){s(n,ei);var e=h(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"UNDEFINED";return y(this,n),(t=e.call(this)).nodeName=r,t._prelimAttrs=new Map,t}return w(n,[{key:"nextSibling",get:function(){var t=this._item?this._item.next:null;return t?t.content.type:null}},{key:"prevSibling",get:function(){var t=this._item?this._item.prev:null;return t?t.content.type:null}},{key:"_integrate",value:function(t,e){var r=this;c(g(n.prototype),"_integrate",this).call(this,t,e),this._prelimAttrs.forEach((function(t,e){r.setAttribute(e,t)})),this._prelimAttrs=null}},{key:"_copy",value:function(){return new n(this.nodeName)}},{key:"clone",value:function(){var t=new n(this.nodeName),e=this.getAttributes();for(var r in e)t.setAttribute(r,e[r]);return t.insert(0,this.toArray().map((function(t){return t instanceof wr?t.clone():t}))),t}},{key:"toString",value:function(){var t=this.getAttributes(),e=[],r=[];for(var i in t)r.push(i);r.sort();for(var o=r.length,u=0;u0?" "+e.join(" "):"";return"<".concat(a).concat(s,">").concat(c(g(n.prototype),"toString",this).call(this),"").concat(a,">")}},{key:"removeAttribute",value:function(t){var e=this;null!==this.doc?Bn(this.doc,(function(n){Or(n,e,t)})):this._prelimAttrs.delete(t)}},{key:"setAttribute",value:function(t,e){var n=this;null!==this.doc?Bn(this.doc,(function(r){Ir(r,n,t,e)})):this._prelimAttrs.set(t,e)}},{key:"getAttribute",value:function(t){return Lr(this,t)}},{key:"hasAttribute",value:function(t){return Tr(this,t)}},{key:"getAttributes",value:function(t){return Mr(this)}},{key:"toDOM",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,r=t.createElement(this.nodeName),i=this.getAttributes();for(var o in i)r.setAttribute(o,i[o]);return _r(this,(function(i){r.appendChild(i.toDOM(t,e,n))})),void 0!==n&&n._createAssociation(r,this),r}},{key:"_write",value:function(t){t.writeTypeRef(bi),t.writeKey(this.nodeName)}}]),n}(),ri=function(t){s(n,ar);var e=h(n);function n(t,r,i){var o;return y(this,n),(o=e.call(this,t,i)).childListChanged=!1,o.attributesChanged=new Set,r.forEach((function(t){null===t?o.childListChanged=!0:o.attributesChanged.add(t)})),o}return w(n)}(),ii=function(t){s(n,Pr);var e=h(n);function n(t){var r;return y(this,n),(r=e.call(this)).hookName=t,r}return w(n,[{key:"_copy",value:function(){return new n(this.hookName)}},{key:"clone",value:function(){var t=new n(this.hookName);return this.forEach((function(e,n){t.set(n,e)})),t}},{key:"toDOM",value:function(){arguments.length>0&&void 0!==arguments[0]||document;var t,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,r=e[this.hookName];return(t=void 0!==r?r.createDom(this):document.createElement(this.hookName)).setAttribute("data-yjs-hook",this.hookName),void 0!==n&&n._createAssociation(t,this),t}},{key:"_write",value:function(t){t.writeTypeRef(Si),t.writeKey(this.hookName)}}]),n}(),oi=function(t){s(n,Qr);var e=h(n);function n(){return y(this,n),e.apply(this,arguments)}return w(n,[{key:"nextSibling",get:function(){var t=this._item?this._item.next:null;return t?t.content.type:null}},{key:"prevSibling",get:function(){var t=this._item?this._item.prev:null;return t?t.content.type:null}},{key:"_copy",value:function(){return new n}},{key:"clone",value:function(){var t=new n;return t.applyDelta(this.toDelta()),t}},{key:"toDOM",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=arguments.length>2?arguments[2]:void 0,n=t.createTextNode(this.toString());return void 0!==e&&e._createAssociation(n,this),n}},{key:"toString",value:function(){return this.toDelta().map((function(t){var e=[];for(var n in t.attributes){var r=[];for(var i in t.attributes[n])r.push({key:i,value:t.attributes[n][i]});r.sort((function(t,e){return t.key"}o+=t.insert;for(var s=e.length-1;s>=0;s--)o+="".concat(e[s].nodeName,">");return o})).join("")}},{key:"toJSON",value:function(){return this.toString()}},{key:"_write",value:function(t){t.writeTypeRef(Ei)}}]),n}(),ui=function(){function t(e,n){y(this,t),this.id=e,this.length=n}return w(t,[{key:"deleted",get:function(){throw me()}},{key:"mergeWith",value:function(t){return!1}},{key:"write",value:function(t,e,n){throw me()}},{key:"integrate",value:function(t,e){throw me()}}]),t}(),ci=function(t){s(n,ui);var e=h(n);function n(){return y(this,n),e.apply(this,arguments)}return w(n,[{key:"deleted",get:function(){return!0}},{key:"delete",value:function(){}},{key:"mergeWith",value:function(t){return this.constructor===t.constructor&&(this.length+=t.length,!0)}},{key:"integrate",value:function(t,e){e>0&&(this.id.clock+=e,this.length-=e),sn(t.doc.store,this)}},{key:"write",value:function(t,e){t.writeInfo(0),t.writeLen(this.length-e)}},{key:"getMissing",value:function(t,e){return null}}]),n}(),li=function(){function t(e){y(this,t),this.content=e}return w(t,[{key:"getLength",value:function(){return 1}},{key:"getContent",value:function(){return[this.content]}},{key:"isCountable",value:function(){return!0}},{key:"copy",value:function(){return new t(this.content)}},{key:"splice",value:function(t){throw me()}},{key:"mergeWith",value:function(t){return!1}},{key:"integrate",value:function(t,e){}},{key:"delete",value:function(t){}},{key:"gc",value:function(t){}},{key:"write",value:function(t,e){t.writeBuf(this.content)}},{key:"getRef",value:function(){return 3}}]),t}(),ai=function(){function t(e){y(this,t),this.len=e}return w(t,[{key:"getLength",value:function(){return this.len}},{key:"getContent",value:function(){return[]}},{key:"isCountable",value:function(){return!1}},{key:"copy",value:function(){return new t(this.len)}},{key:"splice",value:function(e){var n=new t(this.len-e);return this.len=e,n}},{key:"mergeWith",value:function(t){return this.len+=t.len,!0}},{key:"integrate",value:function(t,e){te(t.deleteSet,e.id.client,e.id.clock,this.len),e.markDeleted()}},{key:"delete",value:function(t){}},{key:"gc",value:function(t){}},{key:"write",value:function(t,e){t.writeLen(this.len-e)}},{key:"getRef",value:function(){return 1}}]),t}(),si=function(t,e){return new ve(o(o({guid:t},e),{},{shouldLoad:e.shouldLoad||e.autoLoad||!1}))},fi=function(){function t(e){y(this,t),e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;var n={};this.opts=n,e.gc||(n.gc=!1),e.autoLoad&&(n.autoLoad=!0),null!==e.meta&&(n.meta=e.meta)}return w(t,[{key:"getLength",value:function(){return 1}},{key:"getContent",value:function(){return[this.doc]}},{key:"isCountable",value:function(){return!0}},{key:"copy",value:function(){return new t(si(this.doc.guid,this.opts))}},{key:"splice",value:function(t){throw me()}},{key:"mergeWith",value:function(t){return!1}},{key:"integrate",value:function(t,e){this.doc._item=e,t.subdocsAdded.add(this.doc),this.doc.shouldLoad&&t.subdocsLoaded.add(this.doc)}},{key:"delete",value:function(t){t.subdocsAdded.has(this.doc)?t.subdocsAdded.delete(this.doc):t.subdocsRemoved.add(this.doc)}},{key:"gc",value:function(t){}},{key:"write",value:function(t,e){t.writeString(this.doc.guid),t.writeAny(this.opts)}},{key:"getRef",value:function(){return 9}}]),t}(),hi=function(){function t(e){y(this,t),this.embed=e}return w(t,[{key:"getLength",value:function(){return 1}},{key:"getContent",value:function(){return[this.embed]}},{key:"isCountable",value:function(){return!0}},{key:"copy",value:function(){return new t(this.embed)}},{key:"splice",value:function(t){throw me()}},{key:"mergeWith",value:function(t){return!1}},{key:"integrate",value:function(t,e){}},{key:"delete",value:function(t){}},{key:"gc",value:function(t){}},{key:"write",value:function(t,e){t.writeJSON(this.embed)}},{key:"getRef",value:function(){return 5}}]),t}(),di=function(){function t(e,n){y(this,t),this.key=e,this.value=n}return w(t,[{key:"getLength",value:function(){return 1}},{key:"getContent",value:function(){return[]}},{key:"isCountable",value:function(){return!1}},{key:"copy",value:function(){return new t(this.key,this.value)}},{key:"splice",value:function(t){throw me()}},{key:"mergeWith",value:function(t){return!1}},{key:"integrate",value:function(t,e){e.parent._searchMarker=null}},{key:"delete",value:function(t){}},{key:"gc",value:function(t){}},{key:"write",value:function(t,e){t.writeKey(this.key),t.writeJSON(this.value)}},{key:"getRef",value:function(){return 6}}]),t}(),vi=function(){function t(e){y(this,t),this.arr=e}return w(t,[{key:"getLength",value:function(){return this.arr.length}},{key:"getContent",value:function(){return this.arr}},{key:"isCountable",value:function(){return!0}},{key:"copy",value:function(){return new t(this.arr)}},{key:"splice",value:function(e){var n=new t(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}},{key:"mergeWith",value:function(t){return this.arr=this.arr.concat(t.arr),!0}},{key:"integrate",value:function(t,e){}},{key:"delete",value:function(t){}},{key:"gc",value:function(t){}},{key:"write",value:function(t,e){var n=this.arr.length;t.writeLen(n-e);for(var r=e;r=55296&&r<=56319&&(this.str=this.str.slice(0,e-1)+"�",n.str="�"+n.str.slice(1)),n}},{key:"mergeWith",value:function(t){return this.str+=t.str,!0}},{key:"integrate",value:function(t,e){}},{key:"delete",value:function(t){}},{key:"gc",value:function(t){}},{key:"write",value:function(t,e){t.writeString(0===e?this.str:this.str.slice(e))}},{key:"getRef",value:function(){return 4}}]),t}(),yi=[function(t){return new jr},function(t){return new Pr},function(t){return new Qr},function(t){return new ni(t.readKey())},function(t){return new ei},function(t){return new ii(t.readKey())},function(t){return new oi}],ki=0,wi=1,mi=2,bi=3,_i=4,Si=5,Ei=6,xi=function(){function t(e){y(this,t),this.type=e}return w(t,[{key:"getLength",value:function(){return 1}},{key:"getContent",value:function(){return[this.type]}},{key:"isCountable",value:function(){return!0}},{key:"copy",value:function(){return new t(this.type._copy())}},{key:"splice",value:function(t){throw me()}},{key:"mergeWith",value:function(t){return!1}},{key:"integrate",value:function(t,e){this.type._integrate(t.doc,e)}},{key:"delete",value:function(t){for(var e=this.type._start;null!==e;)e.deleted?t._mergeStructs.push(e):e.delete(t),e=e.right;this.type._map.forEach((function(e){e.deleted?t._mergeStructs.push(e):e.delete(t)})),t.changed.delete(this.type)}},{key:"gc",value:function(t){for(var e=this.type._start;null!==e;)e.gc(t,!0),e=e.right;this.type._start=null,this.type._map.forEach((function(e){for(;null!==e;)e.gc(t,!0),e=e.left})),this.type._map=new Map}},{key:"write",value:function(t,e){this.type._write(t)}},{key:"getRef",value:function(){return 7}}]),t}(),Ci=function(t,e){var n,r=e,i=0;do{i>0&&(r=We(r.client,r.clock+i)),n=hn(t,r),i=r.clock-n.id.clock,r=n.redone}while(null!==r&&n instanceof Ii);return{item:n,diff:i}},Di=function(t,e){for(;null!==t&&t.keep!==e;)t.keep=e,t=t.parent._item},Ai=function(t,e,n){var r=e.id,i=r.client,o=r.clock,u=new Ii(We(i,o+n),e,We(i,o+n-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(n));return e.deleted&&u.markDeleted(),e.keep&&(u.keep=!0),null!==e.redone&&(u.redone=We(e.redone.client,e.redone.clock+n)),e.right=u,null!==u.right&&(u.right.left=u),t._mergeStructs.push(u),null!==u.parentSub&&null===u.right&&u.parent._map.set(u.parentSub,u),e.length=n,u},Oi=function t(e,n,r,i,o){var u=e.doc,c=u.store,l=u.clientID,a=n.redone;if(null!==a)return vn(e,a);var s,f=n.parent._item,h=null;if(null!==f&&!0===f.deleted){if(null===f.redone&&(!r.has(f)||null===t(e,f,r,i,o)))return null;for(;null!==f.redone;)f=vn(e,f.redone)}var d=null===f?n.parent:f.content.type;if(null===n.parentSub){for(h=n.left,s=n;null!==h;){for(var v=h;null!==v&&v.parent._item!==f;)v=null===v.redone?null:vn(e,v.redone);if(null!==v&&v.parent._item===f){h=v;break}h=h.left}for(;null!==s;){for(var g=s;null!==g&&g.parent._item!==f;)g=null===g.redone?null:vn(e,g.redone);if(null!==g&&g.parent._item===f){s=g;break}s=s.right}}else if(s=null,n.right&&!o){for(h=n;null!==h&&null!==h.right&&qt(i,h.right.id);)h=h.right;for(;null!==h&&null!==h.redone;)h=vn(e,h.redone);if(h&&null!==h.right)return null}else h=d._map.get(n.parentSub)||null;var p=an(c,l),y=We(l,p),k=new Ii(y,h,h&&h.lastId,s,s&&s.id,d,n.parentSub,n.content.copy());return n.redone=y,Di(k,!0),k.integrate(e,0),k},Ii=function(t){s(n,ui);var e=h(n);function n(t,r,i,o,u,c,l,a){var s;return y(this,n),(s=e.call(this,t,a.getLength())).origin=i,s.left=r,s.right=o,s.rightOrigin=u,s.parent=c,s.parentSub=l,s.redone=null,s.content=a,s.info=s.content.isCountable()?2:0,s}return w(n,[{key:"marker",get:function(){return(8&this.info)>0},set:function(t){(8&this.info)>0!==t&&(this.info^=8)}},{key:"keep",get:function(){return(1&this.info)>0},set:function(t){this.keep!==t&&(this.info^=1)}},{key:"countable",get:function(){return(2&this.info)>0}},{key:"deleted",get:function(){return(4&this.info)>0},set:function(t){this.deleted!==t&&(this.info^=4)}},{key:"markDeleted",value:function(){this.info|=4}},{key:"getMissing",value:function(t,e){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=an(e,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=an(e,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===Be&&this.id.client!==this.parent.client&&this.parent.clock>=an(e,this.parent.client))return this.parent.client;if(this.origin&&(this.left=gn(t,e,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=vn(t,this.rightOrigin),this.rightOrigin=this.right.id),(this.left&&this.left.constructor===ci||this.right&&this.right.constructor===ci)&&(this.parent=null),this.parent){if(this.parent.constructor===Be){var r=hn(e,this.parent);r.constructor===ci?this.parent=null:this.parent=r.content.type}}else this.left&&this.left.constructor===n&&(this.parent=this.left.parent,this.parentSub=this.left.parentSub),this.right&&this.right.constructor===n&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);return null}},{key:"integrate",value:function(t,e){if(e>0&&(this.id.clock+=e,this.left=gn(t,t.doc.store,We(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(e),this.length-=e),this.parent){if(!this.left&&(!this.right||null!==this.right.left)||this.left&&this.left.right!==this.right){var n,r=this.left;if(null!==r)n=r.right;else if(null!==this.parentSub)for(n=this.parent._map.get(this.parentSub)||null;null!==n&&null!==n.left;)n=n.left;else n=this.parent._start;for(var i=new Set,o=new Set;null!==n&&n!==this.right;){if(o.add(n),i.add(n),ze(this.origin,n.origin)){if(n.id.client0?We(this.id.client,this.id.clock+e-1):this.origin,r=this.rightOrigin,i=this.parentSub,o=31&this.content.getRef()|(null===n?0:128)|(null===r?0:64)|(null===i?0:32);if(t.writeInfo(o),null!==n&&t.writeLeftID(n),null!==r&&t.writeRightID(r),null===n&&null===r){var u=this.parent;if(void 0!==u._item){var c=u._item;if(null===c){var l=He(u);t.writeParentInfo(!0),t.writeString(l)}else t.writeParentInfo(!1),t.writeLeftID(c.id)}else u.constructor===String?(t.writeParentInfo(!0),t.writeString(u)):u.constructor===Be?(t.writeParentInfo(!1),t.writeLeftID(u)):be();null!==i&&t.writeString(i)}this.content.write(t,e)}}]),n}(),Li=function(t,e){return Mi[31&e](t)},Mi=[function(){be()},function(t){return new ai(t.readLen())},function(t){for(var e=t.readLen(),n=[],r=0;r=0?0:1);for(var f=s.left;null!==f;)!f.deleted&&f.countable&&(l+=f.length),f=f.left}}else{if(null!==o)c=e.get(o);else{if(null===i)throw be();if(an(n,i.client)<=i.clock)return null;var h=Ci(n,i).item;if(!(h instanceof Ii&&h.content instanceof xi))return null;c=h.content.type}l=u>=0?c._length:0}return function(t,e){return new qe(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:0)}(c,l,t.assoc)},exports.createDeleteSet=ee,exports.createDeleteSetFromStructStore=ne,exports.createDocFromSnapshot=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new ve;if(t.gc)throw new Error("originDoc must not be garbage collected");var r=e.sv,i=e.ds,o=new xe;return t.transact((function(e){var n=0;r.forEach((function(t){t>0&&n++})),Lt(o.restEncoder,n);var u,c=b(r);try{for(c.s();!(u=c.n()).done;){var l=m(u.value,2),a=l[0],s=l[1];if(0!==s){s2&&void 0!==arguments[2]?arguments[2]:0,r=t._start;if(n<0){if(0===e)return Ze(t,null,n);e--}for(;null!==r;){if(!r.deleted&&r.countable){if(r.length>e)return Ze(t,We(r.id.client,r.id.clock+e),n);e-=r.length}if(null===r.right&&n<0)return Ze(t,r.lastId,n);r=r.right}return Ze(t,null,n)},exports.createSnapshot=nn,exports.decodeRelativePosition=function(t){return function(t){var e=null,n=null,r=null;switch(vt(t)){case 0:r=Ye(t);break;case 1:n=pt(t);break;case 2:e=Ye(t)}var i=ft(t)?gt(t):0;return new $e(e,n,r,i)}(st(t))},exports.decodeSnapshot=function(t){return en(t,new ge(st(t)))},exports.decodeSnapshotV2=en,exports.decodeStateVector=Ue,exports.decodeUpdate=function(t){return $n(t,pe)},exports.decodeUpdateV2=$n,exports.diffUpdate=function(t,e){return rr(t,e,pe,Se)},exports.diffUpdateV2=rr,exports.emptySnapshot=rn,exports.encodeRelativePosition=function(t){var e=Dt();return function(t,e){var n=e.type,r=e.tname,i=e.item,o=e.assoc;if(null!==i)Lt(t,0),Ge(t,i);else if(null!==r)It(t,1),Rt(t,r);else{if(null===n)throw be();It(t,2),Ge(t,n)}Mt(t,o)}(e,t),At(e)},exports.encodeSnapshot=function(t){return tn(t,new _e)},exports.encodeSnapshotV2=tn,exports.encodeStateAsUpdate=function(t,e){return Me(t,e,new Se)},exports.encodeStateAsUpdateV2=Me,exports.encodeStateVector=function(t){return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ee;return t instanceof Map?Re(e,t):je(e,t),e.toUint8Array()}(t,new _e)},exports.encodeStateVectorFromUpdate=function(t){return Qn(t,_e,pe)},exports.encodeStateVectorFromUpdateV2=Qn,exports.equalSnapshots=function(t,e){var n=t.ds.clients,r=e.ds.clients,i=t.sv,o=e.sv;if(i.size!==o.size||n.size!==r.size)return!1;var u,c=b(i.entries());try{for(c.s();!(u=c.n()).done;){var l=m(u.value,2),a=l[0],s=l[1];if(o.get(a)!==s)return!1}}catch(t){c.e(t)}finally{c.f()}var f,h=b(n.entries());try{for(h.s();!(f=h.n()).done;){var d=m(f.value,2),v=d[0],g=d[1],p=r.get(v)||[];if(g.length!==p.length)return!1;for(var y=0;y=(n.sv.get(r.id.client)||0));)r=r.left;return null!==r&&on(r,n)?r.content.getContent()[r.length-1]:void 0};
/* */}),null);
__d("CollabriYjsTypes",["CollabriYjsUpdate","yjs"],(function(a,b,c,d,e,f,g){"use strict";function h(a,b,c){if(a.setDoc!=null&&a.setParent!=null&&a.getRaw!=null){a.setDoc(b);a.setParent(c);return a.getRaw()}return a}function i(a,b,c){var e;a instanceof d("yjs").Map?e=new k(a):a instanceof d("yjs").Array?e=new m(a):a instanceof d("yjs").Text?e=new l(a):e=a;a.setDoc!=null&&a.setParent!=null&&(e.setDoc(b),e.setParent(c));return e}function j(a){var b;if(a instanceof d("yjs").Map)b=new k(a);else if(a instanceof d("yjs").Array)b=new m(a);else if(a instanceof d("yjs").Text)b=new l(a);else throw new Error("Expected abstract type to be map, array, or text");return b}var k=function(){function a(a){this.$3=a!=null?a:new(d("yjs").Map)()}var b=a.prototype;b.getDoc=function(){return this.$1};b.setDoc=function(a){this.$1=a};b.getParent=function(){return this.$2};b.setParent=function(a){this.$2=a};b.set=function(a,b){return this.$3.set(a,h(b,this.getDoc(),this))};b.get=function(a){return this.$3.get(a)};b["delete"]=function(a){this.$3["delete"](a)};b.has=function(a){return this.$3.has(a)};b.forEach=function(a){var b=this,c=this.getDoc();this.$3.forEach(function(d,e,f){return a(i(d,c,b),e,b)})};b.entries=function(){var a=this.getDoc(),b=[];for(var c=this.$3.entries(),d=Array.isArray(c),e=0,c=d?c:c[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var f;if(d){if(e>=c.length)break;f=c[e++]}else{e=c.next();if(e.done)break;f=e.value}f=f;var g=f[0];f=f[1];b.push([g,i(f,a,this)])}return b};b.keys=function(){return this.$3.keys()};b.observe=function(a){var b=this,c=function(b,c){b={changes:{keys:b.changes.keys},keysChanged:b.keysChanged};c={origin:c==null?void 0:c.origin};a(b,c)};this.$3.observe(c);return{dispose:function(){b.$3.unobserve(c)}}};b.observeDeep=function(a){var b=this,c=function(b,c){b=[];c={origin:c==null?void 0:c.origin};a(b,c)};this.$3.observeDeep(c);return{dispose:function(){b.$3.unobserveDeep(c)}}};b.size=function(){return this.$3.size};b.getRaw=function(){return this.$3};b.createRelativePosition=function(a){return d("yjs").createRelativePositionFromTypeIndex(this.$3,a)};return a}(),l=function(){function a(a){this.$3=a instanceof d("yjs").Text?a:new(d("yjs").Text)(a)}var b=a.prototype;b.getDoc=function(){return this.$1};b.setDoc=function(a){this.$1=a};b.getParent=function(){return this.$2};b.setParent=function(a){this.$2=a};b.length=function(){return this.$3.length};b.insertAt=function(a,b,c){this.$3.insert(a,b,c)};b.formatAt=function(a,b,c){this.$3.format(a,b,c)};b.applyDelta=function(a){this.$3.applyDelta(a)};b.deleteAt=function(a,b){this.$3["delete"](a,b)};b.toString=function(){return this.$3.toString()};b.toDelta=function(){return this.$3.toDelta()};b.observe=function(a){var b=this,c=function(b,c){b={delta:b.delta};c={origin:c==null?void 0:c.origin};a(b,c)};this.$3.observe(c);return{dispose:function(){b.$3.unobserve(c)}}};b.observeDeep=function(a){var b=this,c=function(b,c){b=[];c={origin:c==null?void 0:c.origin};a(b,c)};this.$3.observe(c);return{dispose:function(){b.$3.unobserve(c)}}};b.getRaw=function(){return this.$3};b.createRelativePosition=function(a){return d("yjs").createRelativePositionFromTypeIndex(this.$3,a)};return a}(),m=function(){function a(a){this.$3=a!=null?a:new(d("yjs").Array)()}var b=a.prototype;b.getDoc=function(){return this.$1};b.setDoc=function(a){this.$1=a};b.getParent=function(){return this.$2};b.setParent=function(a){this.$2=a};b.length=function(){return this.$3.length};b.insertAt=function(a,b){var c=this,d=this.getDoc();b=b.map(function(a){return h(a,d,c)});this.$3.insert(a,b)};b.deleteAt=function(a,b){this.$3["delete"](a,b)};b.push=function(a){var b=this,c=this.getDoc();a=a.map(function(a){return h(a,c,b)});this.$3.push(a)};b.unshift=function(a){this.$3.unshift(a)};b.get=function(a){a=this.$3.get(a);return i(a,this.getDoc(),this)};b.slice=function(a,b){var c=this,d=this.getDoc();return this.$3.slice(a,b).map(function(a){return i(a,d,c)})};b.forEach=function(a){var b=this,c=this.getDoc();this.$3.forEach(function(d,e,f){a(i(d,c,b),e,b)})};b.map=function(a){var b=this,c=this.getDoc();return this.$3.map(function(d,e,f){return a(i(d,c,b),e,b)})};b.observe=function(a){var b=this,c=function(b,c){b={};c={origin:c==null?void 0:c.origin};a(b,c)};this.$3.observe(c);return{dispose:function(){b.$3.unobserve(c)}}};b.observeDeep=function(a){var b=this,c=function(b,c){b=[];c={origin:c==null?void 0:c.origin};a(b,c)};this.$3.observeDeep(c);return{dispose:function(){b.$3.unobserveDeep(c)}}};b.toArray=function(){return this.$3.toArray()};b.getRaw=function(){return this.$3};b.createRelativePosition=function(a){return d("yjs").createRelativePositionFromTypeIndex(this.$3,a)};return a}();a=function(){function a(a){this.$1=a!=null?a:new(d("yjs").Doc)()}var b=a.prototype;b.getText=function(a){a=this.$1.getText(a);a=new l(a);a.setDoc(this);return a};b.getMap=function(a){a=this.$1.getMap(a);a=new k(a);a.setDoc(this);return a};b.getArray=function(a){a=this.$1.getArray(a);a=new m(a);a.setDoc(this);return a};b.onUpdate=function(a){var b=this,d=function(d,e,f){f=Array.from(d);d=new(c("CollabriYjsUpdate"))(f);a(d,e,b)};this.$1.on("update",d);return{dispose:function(){b.$1.off("update",d)}}};b.onBeforeAllTransactions=function(a){var b=this,c=function(c){a(b)};this.$1.on("beforeAllTransactions",c);return{dispose:function(){b.$1.off("beforeAllTransactions",c)}}};b.onBeforeTransaction=function(a){var b=this,c=function(c){a(b)};this.$1.on("beforeTransaction",c);return{dispose:function(){b.$1.off("beforeTransaction",c)}}};b.onAfterAllTransactions=function(a){var b=this,c=function(c){a(b)};this.$1.on("afterAllTransactions",c);return{dispose:function(){b.$1.off("afterAllTransactions",c)}}};b.onAfterTransaction=function(a){var b=this,c=function(c){a(b)};this.$1.on("afterTransaction",c);return{dispose:function(){b.$1.off("afterTransaction",c)}}};b.onDestroy=function(a){var b=this,c=function(c){a(b)};this.$1.on("destroy",c);return{dispose:function(){b.$1.off("destroy",c)}}};b.transact=function(a,b){this.$1.transact(function(b){a({origin:b.origin})},b)};b.toJSON=function(){this.$1.toJSON()};b.destroy=function(){this.$1.destroy()};b.getRaw=function(){return this.$1};b.createAbsolutePosition=function(a){a=d("yjs").createAbsolutePositionFromRelativePosition(a,this.$1);var b=a.type;a=a.index;b=j(b);return{type:b,index:a}};return a}();g.CollabriYjsMap=k;g.CollabriYjsText=l;g.CollabriYjsArray=m;g.CollabriYjsDoc=a}),98);
__d("UECollabriYjsTypes",[],(function(a,b,c,d,e,f){"use strict";a="componentContainer";b="componentContainerNode";c="rtsChildren";f.COMPONENT_CONTAINER=a;f.COMPONENT_CONTAINER_NODE=b;f.RTS_CHILDREN=c}),66);
__d("CollabriYjs",["CollabriDraftUtils","CollabriMutex","CollabriTypes","CollabriYjsTypes","CollabriYjsUpdate","UECollabriYjsTypes","yjs"],(function(a,b,c,d,e,f,g){"use strict";a=function(){function a(){this.$1=d("CollabriMutex").createMutex()}var b=a.prototype;b.createDoc=function(a){if(a==null)return new(d("CollabriYjsTypes").CollabriYjsDoc)();switch(a){case d("CollabriTypes").CollabriDocumentType.Monaco:return this.$2();case d("CollabriTypes").CollabriDocumentType.Quill:return this.$3();case d("CollabriTypes").CollabriDocumentType.Draft:return this.$4();case d("CollabriTypes").CollabriDocumentType.UnifiedEditor:return this.$5();case d("CollabriTypes").CollabriDocumentType.Lexical:return this.$6()}};b.createMap=function(){return new(d("CollabriYjsTypes").CollabriYjsMap)()};b.createArray=function(){return new(d("CollabriYjsTypes").CollabriYjsArray)()};b.createText=function(){return new(d("CollabriYjsTypes").CollabriYjsText)()};b.applyUpdate=function(a,b,c){b=b.getUpdate();var e=Uint8Array.from(b),f=a.getRaw(),g=c?{isUpdateRemote:c}:null;this.$1(function(){d("yjs").applyUpdate(f,e,g)})};b.serialize=function(a){a=a.getRaw();a=d("yjs").encodeStateAsUpdate(a);a=Array.from(a);return JSON.stringify(a)};b.deserialize=function(a){a=JSON.parse(a);a=Uint8Array.from(a);var b=new(d("yjs").Doc)();d("yjs").applyUpdate(b,a,{isUpdateRemote:!0});return new(d("CollabriYjsTypes").CollabriYjsDoc)(b)};b.deserializeUpdate=function(a){return c("CollabriYjsUpdate").deserialize(a)};b.registerDocUpdate=function(a,b){var d=this,e=function(a){d.$1(function(){var d=Array.from(a);b(new(c("CollabriYjsUpdate"))(d))})},f=a.getRaw();f.on("update",e);return{dispose:function(){f.off("update",e)}}};b.$2=function(){var a=new(d("CollabriYjsTypes").CollabriYjsDoc)(),b=a.getText("code");b.insertAt(0,"");return a};b.$3=function(){var a=new(d("CollabriYjsTypes").CollabriYjsDoc)(),b=a.getText("text");b.insertAt(0,"");return a};b.$4=function(){var a=new(d("yjs").Doc)(),b=new(d("yjs").Map)();b.set("data",{});b.set("depth",0);b.set("entityRanges",[]);b.set("inlineStyleRanges",[]);b.set("key",d("CollabriDraftUtils").generateRandomKey());b.set("type",0);var c=new(d("yjs").Text)("");b.set("text",c);c=a.getArray("blocks");c.push([b]);a.getMap("entityMap");return new(d("CollabriYjsTypes").CollabriYjsDoc)(a)};b.$5=function(){var a,b=new((a=d("yjs")).Doc)(),c=b.getMap("documentNodeContainer"),e=new a.Map();e.set("version","1.0");var f=new a.Array(),g=new a.Map(),i=new a.Map(),j=new a.Map(),k=new a.Array(),l=new a.Map(),m=new a.Map(),n=new a.Map(),o=new a.Array(),p=new a.Map(),q=new a.Map(),r=new a.Array(),s=new a.Map(),t=new a.Map(),u=new a.Array(),v=new a.Map(),w=new a.Map(),x=new a.Text();a=new a.Array();x.insert(0,"\n",{INVISIBLE_PARAGRAPH:"UNSET",PARAGRAPH_STYLES:"UNSET"});w.set("text",x);w.set("children",a);v.set("node",w);v.set("type","RICH-TEXT-STRING");v.set("id",h());u.push([v]);t.set("children",u);s.set("node",t);s.set("type","RICH-TEXT-FRAME");s.set("id",h());r.push([s]);q.set("children",r);p.set("node",q);p.set("type","SECTION");p.set("id",h());f.push([p]);e.set("children",f);i.set("styles",j);i.set("children",k);g.set("node",i);g.set("type","STYLE-SHEET");g.set("id",h());e.set("styleSheet",g);m.set(d("UECollabriYjsTypes").COMPONENT_CONTAINER,n);m.set("children",o);l.set("node",m);l.set("type","COMPONENT-CONTAINER");l.set("id",h());e.set(d("UECollabriYjsTypes").COMPONENT_CONTAINER_NODE,l);c.set("node",e);c.set("type","DOCUMENT");c.set("id",h());return new(d("CollabriYjsTypes").CollabriYjsDoc)(b)};b.$6=function(){var a=new(d("yjs").Doc)(),b=a.get("root",d("yjs").XmlText),c=new(d("yjs").XmlText)(),e={__type:"paragraph",__format:0,__indent:0,__dir:null};for(var f in e)c.setAttribute(f,e[f]);b instanceof d("yjs").XmlText&&b.insertEmbed(0,c);return new(d("CollabriYjsTypes").CollabriYjsDoc)(a)};return a}();function h(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=Math.random()*16|0;a=a=="x"?b:b&3|8;return a.toString(16)})}g["default"]=a}),98);
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @nolint
* @providesModule lib0
* @preserve-header
* @preserve-whitespace
* @no-auto-requires
* @generated
* @preventMunge
* @preserve-invariant-messages
* @generated
* @preserve-whitespace
*
* lib0@0.2.43
* https://github.com/dmonad/lib0#readme
*
* This library is meant to replace all global JavaScript functions with
* isomorphic module imports.
*
* Copyright: 2020 Kevin Jahns
*
* License: MIT
*/
__d("lib0",[],(function $module_lib0(global,require,requireDynamic,requireLazy,module,exports){
"use strict";var t,n;function e(){return e="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,n,e){var o=r(t,n);if(o){var i=Object.getOwnPropertyDescriptor(o,n);return i.get?i.get.call(arguments.length<3?t:e):i.value}},e.apply(this,arguments)}function r(t,n){for(;!Object.prototype.hasOwnProperty.call(t,n)&&null!==(t=l(t)););return t}function o(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}function i(t){return function(t){if(Array.isArray(t))return m(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||b(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 u(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),n&&a(t,n)}function a(t,n){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},a(t,n)}function c(t){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=l(t);if(n){var o=l(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return f(this,e)}}function f(t,n){if(n&&("object"===h(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return s(t)}function s(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function l(t){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},l(t)}function h(t){return h="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},h(t)}function p(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function d(t,n){for(var e=0;e=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==e.return||e.return()}finally{if(a)throw i}}}}function b(t,n){if(t){if("string"==typeof t)return m(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?m(t,n):void 0}}function m(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e0;){var o=n<1e4?n:1e4,i=t.subarray(r,r+o);r+=o,e+=String.fromCodePoint.apply(null,i),n-=o}return decodeURIComponent(escape(e))},F="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});F&&1===F.decode(new Uint8Array).length&&(F=null);var V=function(t){return F.decode(t)},q=F?V:z,W=Object.freeze({__proto__:null,fromCharCode:x,fromCodePoint:U,trimLeft:D,fromCamelCase:R,utf8ByteLength:function(t){return unescape(encodeURIComponent(t)).length},_encodeUtf8Polyfill:C,utf8TextEncoder:M,_encodeUtf8Native:P,encodeUtf8:L,_decodeUtf8Polyfill:z,get utf8TextDecoder(){return F},_decodeUtf8Native:V,decodeUtf8:q}),K=function(t){return void 0===t?null:t},G=Object.freeze({__proto__:null,undefinedToNull:K}),J=new(function(){function t(){p(this,t),this.map=new Map}return v(t,[{key:"setItem",value:function(t,n){this.map.set(t,n)}},{key:"getItem",value:function(t){return this.map.get(t)}}]),t}()),Y=!0;try{"undefined"!=typeof localStorage&&(J=localStorage,Y=!1)}catch(t){}var H,X=J,Z="undefined"!=typeof process&&process.release&&/node|io\.js/.test(process.release.name),$="undefined"!=typeof window&&!Z,Q="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),tt=function(){if(void 0===H)if(Z){H=B();for(var t=process.argv,n=null,e=0;en?t:n},bt=Number.isNaN,mt=Math.pow,_t=function(t){return Math.pow(10,t)},wt=Math.sign,kt=function(t){return 0!==t?t<0:1/t<0},Tt=Object.freeze({__proto__:null,floor:ut,ceil:at,abs:ct,imul:ft,round:st,log10:lt,log2:ht,log:pt,sqrt:dt,add:vt,min:gt,max:yt,isNaN:bt,pow:mt,exp10:_t,sign:wt,isNegativeZero:kt}),It=Number.MAX_SAFE_INTEGER,Et=Number.MIN_SAFE_INTEGER,Bt=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&ut(t)===t},St=Number.isNaN,Ot=Number.parseInt,At=Object.freeze({__proto__:null,MAX_SAFE_INTEGER:It,MIN_SAFE_INTEGER:Et,LOWEST_INT32:1<<31,HIGHEST_INT32:2147483647,isInteger:Bt,isNaN:St,parseInt:Ot}),xt=v((function t(){p(this,t),this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]})),Ut=function(){return new xt},Nt=function(t){for(var n=t.cpos,e=0;e127;)jt(t,128|127&n),n>>>=7;jt(t,127&n)},Lt=function(t,n){var e=kt(n);for(e&&(n=-n),jt(t,(n>63?128:0)|(e?64:0)|63&n),n>>>=6;n>0;)jt(t,(n>127?128:0)|127&n),n>>>=7},zt=function(t,n){var e=unescape(encodeURIComponent(n)),r=e.length;Pt(t,r);for(var o=0;o0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(yt(2*e,i)),t.cbuf.set(n.subarray(o)),t.cpos=i)},Vt=function(t,n){Pt(t,n.byteLength),Ft(t,n)},qt=function(t,n){!function(t,n){var e=t.cbuf.length;e-t.cpos0&&Pt(this,this.count-1),this.count=1,this.w(this,t),this.s=t)}}]),e}(),Xt=function(t){u(e,xt);var n=c(e);function e(t){var r;return p(this,e),(r=n.call(this)).s=t,r}return v(e,[{key:"write",value:function(t){Lt(this,t-this.s),this.s=t}}]),e}(),Zt=function(t){u(e,xt);var n=c(e);function e(t){var r;return p(this,e),(r=n.call(this)).s=t,r.count=0,r}return v(e,[{key:"write",value:function(t){this.s===t&&this.count>0?this.count++:(this.count>0&&Pt(this,this.count-1),this.count=1,Lt(this,t-this.s),this.s=t)}}]),e}(),$t=function(t){t.count>0&&(Lt(t.encoder,1===t.count?t.s:-t.s),t.count>1&&Pt(t.encoder,t.count-2))},Qt=function(){function t(){p(this,t),this.encoder=new xt,this.s=0,this.count=0}return v(t,[{key:"write",value:function(t){this.s===t?this.count++:($t(this),this.count=1,this.s=t)}},{key:"toUint8Array",value:function(){return $t(this),Dt(this.encoder)}}]),t}(),tn=function(){function t(){p(this,t),this.encoder=new xt,this.s=0,this.count=0}return v(t,[{key:"write",value:function(t){this.s+this.count===t?this.count++:($t(this),this.count=1,this.s=t)}},{key:"toUint8Array",value:function(){return $t(this),Dt(this.encoder)}}]),t}(),nn=function(t){if(t.count>0){var n=t.diff<<1|(1===t.count?0:1);Lt(t.encoder,n),t.count>1&&Pt(t.encoder,t.count-2)}},en=function(){function t(){p(this,t),this.encoder=new xt,this.s=0,this.count=0,this.diff=0}return v(t,[{key:"write",value:function(t){this.diff===t-this.s?(this.s=t,this.count++):(nn(this),this.count=1,this.diff=t-this.s,this.s=t)}},{key:"toUint8Array",value:function(){return nn(this),Dt(this.encoder)}}]),t}(),rn=function(){function t(){p(this,t),this.sarr=[],this.s="",this.lensE=new Qt}return v(t,[{key:"write",value:function(t){this.s+=t,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(t.length)}},{key:"toUint8Array",value:function(){var t=new xt;return this.sarr.push(this.s),this.s="",zt(t,this.sarr.join("")),Ft(t,this.lensE.toUint8Array()),Dt(t)}}]),t}(),on=Object.freeze({__proto__:null,Encoder:xt,createEncoder:Ut,length:Nt,toUint8Array:Dt,write:jt,set:Rt,writeUint8:Ct,setUint8:Mt,writeUint16:function(t,n){jt(t,255&n),jt(t,n>>>8&255)},setUint16:function(t,n,e){Rt(t,n,255&e),Rt(t,n+1,e>>>8&255)},writeUint32:function(t,n){for(var e=0;e<4;e++)jt(t,255&n),n>>>=8},writeUint32BigEndian:function(t,n){for(var e=3;e>=0;e--)jt(t,n>>>8*e&255)},setUint32:function(t,n,e){for(var r=0;r<4;r++)Rt(t,n+r,255&e),e>>>=8},writeVarUint:Pt,writeVarInt:Lt,writeVarString:zt,writeBinaryEncoder:function(t,n){return Ft(t,Dt(n))},writeUint8Array:Ft,writeVarUint8Array:Vt,writeOnDataView:qt,writeFloat32:Wt,writeFloat64:Kt,writeBigInt64:Gt,writeBigUint64:function(t,n){return qt(t,8).setBigUint64(0,n,!1)},writeAny:Yt,RleEncoder:Ht,IntDiffEncoder:Xt,RleIntDiffEncoder:Zt,UintOptRleEncoder:Qt,IncUintOptRleEncoder:tn,IntDiffOptRleEncoder:en,StringEncoder:rn}),un=v((function t(n){p(this,t),this.arr=n,this.pos=0})),an=function(t){return new un(t)},cn=function(t){return t.pos!==t.arr.length},fn=function(t,n){var e=xn(t.arr.buffer,t.pos+t.arr.byteOffset,n);return t.pos+=n,e},sn=function(t){return fn(t,hn(t))},ln=function(t){return t.arr[t.pos++]},hn=function(t){for(var n=0,e=0;;){var r=t.arr[t.pos++];if(n|=(127&r)<>>0;if((e+=7)>35)throw new Error("Integer out of range!")}},pn=function(t){var n=t.arr[t.pos++],e=63&n,r=6,o=(64&n)>0?-1:1;if(0==(128&n))return o*e;for(;;){if(e|=(127&(n=t.arr[t.pos++]))<>>0);if((r+=7)>41)throw new Error("Integer out of range!")}},dn=function(t){var n=hn(t);if(0===n)return"";var e=String.fromCodePoint(ln(t));if(--n<100)for(;n--;)e+=String.fromCodePoint(ln(t));else for(;n>0;){var r=n<1e4?n:1e4,o=t.arr.subarray(t.pos,t.pos+r);t.pos+=r,e+=String.fromCodePoint.apply(null,o),n-=r}return decodeURIComponent(escape(e))},vn=function(t,n){var e=new DataView(t.arr.buffer,t.arr.byteOffset+t.pos,n);return t.pos+=n,e},gn=function(t){return vn(t,4).getFloat32(0,!1)},yn=function(t){return vn(t,8).getFloat64(0,!1)},bn=function(t){return vn(t,8).getBigInt64(0,!1)},mn=[function(t){},function(t){return null},pn,gn,yn,bn,function(t){return!1},function(t){return!0},dn,function(t){for(var n=hn(t),e={},r=0;r>1,this.count=1,n&&(this.count=hn(this)+2)}return this.s+=this.diff,this.count--,this.s}}]),e}(),Sn=function(){function t(n){p(this,t),this.decoder=new In(n),this.str=dn(this.decoder),this.spos=0}return v(t,[{key:"read",value:function(){var t=this.spos+this.decoder.read(),n=this.str.slice(this.spos,t);return this.spos=t,n}}]),t}(),On=Object.freeze({__proto__:null,Decoder:un,createDecoder:an,hasContent:cn,clone:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.pos,e=an(t.arr);return e.pos=n,e},readUint8Array:fn,readVarUint8Array:sn,readTailAsUint8Array:function(t){return fn(t,t.arr.length-t.pos)},skip8:function(t){return t.pos++},readUint8:ln,readUint16:function(t){var n=t.arr[t.pos]+(t.arr[t.pos+1]<<8);return t.pos+=2,n},readUint32:function(t){var n=t.arr[t.pos]+(t.arr[t.pos+1]<<8)+(t.arr[t.pos+2]<<16)+(t.arr[t.pos+3]<<24)>>>0;return t.pos+=4,n},readUint32BigEndian:function(t){var n=t.arr[t.pos+3]+(t.arr[t.pos+2]<<8)+(t.arr[t.pos+1]<<16)+(t.arr[t.pos]<<24)>>>0;return t.pos+=4,n},peekUint8:function(t){return t.arr[t.pos]},peekUint16:function(t){return t.arr[t.pos]+(t.arr[t.pos+1]<<8)},peekUint32:function(t){return t.arr[t.pos]+(t.arr[t.pos+1]<<8)+(t.arr[t.pos+2]<<16)+(t.arr[t.pos+3]<<24)>>>0},readVarUint:hn,readVarInt:pn,peekVarUint:function(t){var n=t.pos,e=hn(t);return t.pos=n,e},peekVarInt:function(t){var n=t.pos,e=pn(t);return t.pos=n,e},readVarString:dn,peekVarString:function(t){var n=t.pos,e=dn(t);return t.pos=n,e},readFromDataView:vn,readFloat32:gn,readFloat64:yn,readBigInt64:bn,readBigUint64:function(t){return vn(t,8).getBigUint64(0,!1)},readAny:_n,RleDecoder:wn,IntDiffDecoder:kn,RleIntDiffDecoder:Tn,UintOptRleDecoder:In,IncUintOptRleDecoder:En,IntDiffOptRleDecoder:Bn,StringDecoder:Sn}),An=function(t){return new Uint8Array(t)},xn=function(t,n,e){return new Uint8Array(t,n,e)},Un=function(t){return new Uint8Array(t)},Nn=$?function(t){for(var n="",e=0;e2&&void 0!==arguments[2]?arguments[2]:0;try{for(;r2&&void 0!==arguments[2]?arguments[2]:Yn,r=0,o=0;r1&&void 0!==arguments[1]?arguments[1]:[],e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return se(ce(oe(t),n),e)},de=ue,ve=function(t){return"".concat(t.left,":").concat(t.right,";")},ge=function(t){return O(t,(function(t,n){return"".concat(n,":").concat(t,";")})).join("")},ye=function(t){return ae.parseFromString("".concat(t,""),"text/html").body},be=function(t,n){return t.appendChild(n)},me=re.ELEMENT_NODE,_e=re.TEXT_NODE,we=re.CDATA_SECTION_NODE,ke=re.COMMENT_NODE,Te=re.DOCUMENT_NODE,Ie=re.DOCUMENT_TYPE_NODE,Ee=re.DOCUMENT_FRAGMENT_NODE,Be=Object.freeze({__proto__:null,doc:re,createElement:oe,createDocumentFragment:ie,createTextNode:ue,domParser:ae,emitCustomEvent:function(t,n,e){return t.dispatchEvent(new CustomEvent(n,e))},setAttributes:ce,setAttributesMap:function(t,n){return n.forEach((function(n,e){t.setAttribute(e,n)})),t},fragment:fe,append:se,remove:function(t){return t.remove()},addEventListener:le,removeEventListener:he,addEventListeners:function(t,n){return ne(n,(function(n,e){return le(t,n,e)})),t},removeEventListeners:function(t,n){return ne(n,(function(n,e){return he(t,n,e)})),t},element:pe,canvas:function(t,n){var e=oe("canvas");return e.height=n,e.width=t,e},text:de,pairToStyleString:ve,pairsToStyleString:function(t){return t.map(ve).join("")},mapToStyleString:ge,querySelector:function(t,n){return t.querySelector(n)},querySelectorAll:function(t,n){return t.querySelectorAll(n)},getElementById:function(t){return re.getElementById(t)},parseFragment:function(t){return fe(ye(t).childNodes)},parseElement:function(t){return ye(t).firstElementChild},replaceWith:function(t,n){return t.replaceWith(n)},insertBefore:function(t,n,e){return t.insertBefore(n,e)},appendChild:be,ELEMENT_NODE:me,TEXT_NODE:_e,CDATA_SECTION_NODE:we,COMMENT_NODE:ke,DOCUMENT_NODE:Te,DOCUMENT_TYPE_NODE:Ie,DOCUMENT_FRAGMENT_NODE:Ee,checkNodeType:function(t,n){return t.nodeType===n},isParentOf:function(t,n){for(var e=n.parentNode;e&&e!==t;)e=e.parentNode;return e===t}}),Se=function(t){return new Error(t)},Oe=Object.freeze({__proto__:null,create:Se,methodUnimplemented:function(){throw Se("Method unimplemented")},unexpectedCase:function(){throw Se("Unexpected case")}}),Ae=[],xe=function(){for(var t=0;t1&&void 0!==arguments[1]?arguments[1]:0,e=0===t?0:lt(t),r=0;e<3*r&&n>-8;)n--,r--;for(;e>=3+3*r&&n<8;)n++,r++;var o=n<0?ze[-n]:Le[n];return{n:st(1e12*(r>0?t/_t(3*r):t*_t(-3*r)))/1e12,prefix:o}}(t,-1);return st(100*n.n)/100+n.prefix+"s"}var e=(t=ut(t/1e3))%60,r=ut(t/60)%60,o=ut(t/3600)%24,i=ut(t/86400);return i>0?i+"d"+(o>0||r>30?" "+(r>30?o+1:o)+"h":""):o>0?o+"h"+(r>0||e>30?" "+(e>30?r+1:r)+"min":""):r+"min"+(e>0?" "+e+"s":"")}}),qe=function(t){return new Promise(t)},We=function(t){return Promise.all(t)},Ke=Object.freeze({__proto__:null,create:qe,createEmpty:function(t){return new Promise(t)},all:We,reject:function(t){return Promise.reject(t)},resolve:function(t){return Promise.resolve(t)},resolveWith:function(t){return Promise.resolve(t)},until:function(t,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;return qe((function(r,o){var i=Fe(),u=t>0,a=setInterval((function(){n()?(clearInterval(a),r()):u&&Fe()-i>t&&(clearInterval(a),o(new Error("Timeout")))}),e)}))},wait:function(t){return qe((function(n,e){return setTimeout(n,t)}))},isPromise:function(t){return t instanceof Promise||t&&t.then&&t.catch&&t.finally}}),Ge=function(t){return qe((function(n,e){t.onerror=function(t){return e(new Error(t.target.error))},t.onblocked=function(){return location.reload()},t.onsuccess=function(t){return n(t.target.result)}}))},Je=function(t,n){return Ge(t.getAll(n))},Ye=function(t,n){return Ge(t.getAllKeys(n))},He=function(t,n,e){var r=null;return Ze(t,n,(function(t){return r=t,!1}),e).then((function(){return r}))},Xe=function(t,n){return qe((function(e,r){t.onerror=r,t.onsuccess=function(t){var r=t.target.result;if(null===r||!1===n(r))return e();r.continue()}}))},Ze=function(t,n,e){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"next";return Xe(t.openKeyCursor(n,r),(function(t){return e(t.key)}))},$e=function(t,n){return t.objectStore(n)},Qe=Object.freeze({__proto__:null,rtop:Ge,openDB:function(t,n){return qe((function(e,r){var o=indexedDB.open(t);o.onupgradeneeded=function(t){return n(t.target.result)},o.onerror=function(t){return r(Se(t.target.error))},o.onblocked=function(){return location.reload()},o.onsuccess=function(t){var n=t.target.result;n.onversionchange=function(){n.close()},"undefined"!=typeof addEventListener&&addEventListener("unload",(function(){return n.close()})),e(n)}}))},deleteDB:function(t){return Ge(indexedDB.deleteDatabase(t))},createStores:function(t,n){return n.forEach((function(n){return t.createObjectStore.apply(t,n)}))},transact:function(t,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"readwrite",r=t.transaction(n,e);return n.map((function(t){return $e(r,t)}))},count:function(t,n){return Ge(t.count(n))},get:function(t,n){return Ge(t.get(n))},del:function(t,n){return Ge(t.delete(n))},put:function(t,n,e){return Ge(t.put(n,e))},add:function(t,n,e){return Ge(t.add(n,e))},addAutoKey:function(t,n){return Ge(t.add(n))},getAll:Je,getAllKeys:Ye,queryFirst:He,getLastKey:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return He(t,n,"prev")},getFirstKey:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return He(t,n,"next")},getAllKeysValues:function(t,n){return We([Ye(t,n),Je(t,n)]).then((function(t){var n=g(t,2),e=n[0],r=n[1];return e.map((function(t,n){return{k:t,v:r[n]}}))}))},iterate:function(t,n,e){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"next";return Xe(t.openCursor(n,r),(function(t){return e(t.value,t.key)}))},iterateKeys:Ze,getStore:$e,createIDBKeyRangeBound:function(t,n,e,r){return IDBKeyRange.bound(t,n,e,r)},createIDBKeyRangeUpperBound:function(t,n){return IDBKeyRange.upperBound(t,n)},createIDBKeyRangeLowerBound:function(t,n){return IDBKeyRange.lowerBound(t,n)}}),tr=function(t){var n;return o(n={},Symbol.iterator,(function(){return this})),o(n,"next",t),n},nr=Object.freeze({__proto__:null,mapIterator:function(t,n){var e;return o(e={},Symbol.iterator,(function(){return this})),o(e,"next",(function(){var e=t.next();return{value:e.done?void 0:n(e.value),done:e.done}})),e},createIterator:tr,iteratorFilter:function(t,n){return tr((function(){var e;do{e=t.next()}while(!e.done&&!n(e.value));return e}))},iteratorMap:function(t,n){return tr((function(){var e=t.next(),r=e.done,o=e.value;return{done:r,value:r?void 0:n(o)}}))}}),er=JSON.stringify,rr=JSON.parse,or=Object.freeze({__proto__:null,stringify:er,parse:rr}),ir=Symbol,ur=Object.freeze({__proto__:null,create:ir,isSymbol:function(t){return"symbol"===h(t)}}),ar=ir(),cr=ir(),fr=ir(),sr=ir(),lr=ir(),hr=ir(),pr=ir(),dr=ir(),vr=ir(),gr=(o(t={},ar,te("font-weight","bold")),o(t,cr,te("font-weight","normal")),o(t,fr,te("color","blue")),o(t,lr,te("color","green")),o(t,sr,te("color","grey")),o(t,hr,te("color","red")),o(t,pr,te("color","purple")),o(t,dr,te("color","orange")),o(t,vr,te("color","black")),t),yr=(o(n={},ar,"[1m"),o(n,cr,"[2m"),o(n,fr,"[34m"),o(n,lr,"[32m"),o(n,sr,"[37m"),o(n,hr,"[31m"),o(n,pr,"[35m"),o(n,dr,"[38;5;208m"),o(n,vr,"[0m"),n),br=Z?function(t){for(var n=[],e=[],r=0;r0&&(n.push("[0m"),e.push(n.join("")));r0||c.length>0?(n.push("%c"+u),e.push(c)):n.push(u)}}for(i>0&&(o=e).unshift(n.join(""));i1&&void 0!==arguments[1]&&arguments[1];Ue((function(){var r=pe("span",[te("hidden",e),te("style","color:grey;font-size:120%;")],[de("â–¼")]),o=pe("span",[te("hidden",!e),te("style","color:grey;font-size:125%;")],[de("â–¶")]),i=pe("div",[te("style","".concat(Tr,";padding-left:").concat(10*n.depth,"px"))],[r,o,de(" ")].concat(kr(t))),u=pe("div",[te("hidden",e)]),a=pe("div",[],[i,u]);se(n.ccontainer,[a]),n.ccontainer=u,n.depth++,le(i,"click",(function(t){u.toggleAttribute("hidden"),r.toggleAttribute("hidden"),o.toggleAttribute("hidden")}))}))}},{key:"groupCollapsed",value:function(t){this.group(t,!0)}},{key:"groupEnd",value:function(){var t=this;Ue((function(){t.depth>0&&(t.depth--,t.ccontainer=t.ccontainer.parentElement.parentElement)}))}},{key:"print",value:function(t){var n=this;Ue((function(){se(n.ccontainer,[pe("div",[te("style","".concat(Tr,";padding-left:").concat(10*n.depth,"px"))],kr(t))])}))}},{key:"printError",value:function(t){this.print([hr,ar,t.toString()])}},{key:"printImg",value:function(t,n){var e=this;Ue((function(){se(e.ccontainer,[pe("img",[te("src",t),te("height","".concat(st(1.5*n),"px"))])])}))}},{key:"printDom",value:function(t){var n=this;Ue((function(){se(n.ccontainer,[t])}))}},{key:"destroy",value:function(){var t=this;Ue((function(){wr.delete(t)}))}}]),t}(),Er=[lr,pr,dr,fr],Br=0,Sr=Fe(),Or=Object.freeze({__proto__:null,BOLD:ar,UNBOLD:cr,BLUE:fr,GREY:sr,GREEN:lr,RED:hr,PURPLE:pr,ORANGE:dr,UNCOLOR:vr,print:mr,warn:function(){for(var t,n=arguments.length,e=new Array(n),r=0;r>17,t^=t<<5,this._state=t,(t>>>0)/(I+1)}}]),t}(),Ur=function(){function t(n){p(this,t),this.seed=n;var e=new xr(n);this.state=new Uint32Array(4);for(var r=0;r<4;r++)this.state[r]=e.next()*I;this._fresh=!0}return v(t,[{key:"next",value:function(){var t=this.state;if(this._fresh)return this._fresh=!1,(t[0]+t[2]>>>0)/(I+1);this._fresh=!0;var n=t[0],e=t[1],r=t[2]^n,o=t[3]^e;return t[0]=(e<<23|n>>>9)^r^(r<<14|o>>>18),t[1]=(n<<23|e>>>9)^o^o<<14,t[2]=o<<4|r>>>28,t[3]=r<<4|o>>>28,(t[1]+t[3]>>>0)/(I+1)}}]),t}(),Nr=function(t,n,e){return ut(t.next()*(e+1-n)+n)},Dr=function(t,n,e){return ut(t.next()*(e+1-n)+n)},jr=function(t,n,e){return Dr(t,n,e)},Rr=function(t){return x(jr(t,97,122))},Cr=function(t){var n=jr(t,0,256);return U(n)},Mr=function(t,n){for(var e=An(n),r=0;r=.5},int53:Nr,uint53:function(t,n,e){return ct(Nr(t,n,e))},int32:Dr,uint32:function(t,n,e){return Dr(t,n,e)>>>0},int31:jr,real53:function(t){return t.next()},char:function(t){return x(jr(t,32,126))},letter:Rr,word:function(t){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:20,r=jr(t,n,e),o="",i=0;i1&&void 0!==arguments[1]?arguments[1]:20,e=jr(t,0,n),r="",o=0;o0&&r(t[i-1],t[i])>0;i--){var u=t[i];t[i]=t[i-1],t[i-1]=u}},Vr=function t(n,e,r,o){if(r-e<42)Fr(n,e,r,o);else{for(var i=n[ut((e+r)/2)],u=e,a=r;;){for(;o(i,n[u])>0;)u++;for(;o(n[a],i)>0;)a--;if(u>=a)break;var c=n[u];n[u++]=n[a],n[a--]=c}t(n,e,a,o),t(n,a+1,r,o)}},qr=Object.freeze({__proto__:null,_insertionSort:Fr,insertionSort:function(t,n){Fr(t,0,t.length-1,n)},quicksort:function(t,n){Vr(t,0,t.length-1,n)}}),Wr=Object.freeze({__proto__:null,median:function(t){return 0===t.length?NaN:t.length%2==1?t[(t.length-1)/2]:(t[ut((t.length-1)/2)]+t[at((t.length-1)/2)])/2},average:function(t){return t.reduce(vt,0)/t.length}}),Kr=function(t,n,e,r){if(null===n)t.root=e,e._parent=null;else if(n.left===r)n.left=e;else{if(n.right!==r)throw new Error("The elements are wrongly connected!");n.right=e}},Gr=function(){function t(n){p(this,t),this.val=n,this.color=!0,this._left=null,this._right=null,this._parent=null}return v(t,[{key:"isRed",value:function(){return this.color}},{key:"isBlack",value:function(){return!this.color}},{key:"redden",value:function(){return this.color=!0,this}},{key:"blacken",value:function(){return this.color=!1,this}},{key:"grandparent",get:function(){return this.parent.parent}},{key:"parent",get:function(){return this._parent}},{key:"sibling",get:function(){return this===this.parent.left?this.parent.right:this.parent.left}},{key:"left",get:function(){return this._left},set:function(t){null!==t&&(t._parent=this),this._left=t}},{key:"right",get:function(){return this._right},set:function(t){null!==t&&(t._parent=this),this._right=t}},{key:"rotateLeft",value:function(t){var n=this.parent,e=this.right,r=this.right.left;e.left=this,this.right=r,Kr(t,n,e,this)}},{key:"next",value:function(){if(null!==this.right){for(var t=this.right;null!==t.left;)t=t.left;return t}for(var n=this;null!==n.parent&&n!==n.parent.left;)n=n.parent;return n.parent}},{key:"prev",value:function(){if(null!==this.left){for(var t=this.left;null!==t.right;)t=t.right;return t}for(var n=this;null!==n.parent&&n!==n.parent.right;)n=n.parent;return n.parent}},{key:"rotateRight",value:function(t){var n=this.parent,e=this.left,r=this.left.right;e.right=this,this.left=r,Kr(t,n,e,this)}},{key:"getUncle",value:function(){return this.parent===this.parent.parent.left?this.parent.parent.right:this.parent.parent.left}}]),t}(),Jr=function(t){return null===t||t.isBlack()},Yr=function(t){return null!==t&&t.isRed()},Hr=function(){function t(){p(this,t),this.root=null,this.length=0}return v(t,[{key:"findNext",value:function(t){var n=t.clone();return n.clock+=1,this.findWithLowerBound(n)}},{key:"findPrev",value:function(t){var n=t.clone();return n.clock-=1,this.findWithUpperBound(n)}},{key:"findNodeWithLowerBound",value:function(t){var n=this.root;if(null===n)return null;for(;;)if(null===t||t.lessThan(n.val._id)&&null!==n.left)n=n.left;else{if(null===t||!n.val._id.lessThan(t))return n;if(null===n.right)return n.next();n=n.right}}},{key:"findNodeWithUpperBound",value:function(t){if(void 0===t)throw new Error("You must define from!");var n=this.root;if(null===n)return null;for(;;)if(null!==t&&!n.val._id.lessThan(t)||null===n.right){if(null===t||!t.lessThan(n.val._id))return n;if(null===n.left)return n.prev();n=n.left}else n=n.right}},{key:"findSmallestNode",value:function(){for(var t=this.root;null!=t&&null!=t.left;)t=t.left;return t}},{key:"findWithLowerBound",value:function(t){var n=this.findNodeWithLowerBound(t);return null==n?null:n.val}},{key:"findWithUpperBound",value:function(t){var n=this.findNodeWithUpperBound(t);return null==n?null:n.val}},{key:"iterate",value:function(t,n,e){var r;for(r=null===t?this.findSmallestNode():this.findNodeWithLowerBound(t);null!==r&&(null===n||r.val._id.lessThan(n)||r.val._id.equals(n));)e(r.val),r=r.next()}},{key:"find",value:function(t){var n=this.findNode(t);return null!==n?n.val:null}},{key:"findNode",value:function(t){var n=this.root;if(null===n)return null;for(;;){if(null===n)return null;if(t.lessThan(n.val._id))n=n.left;else{if(!n.val._id.lessThan(t))return n;n=n.right}}}},{key:"delete",value:function(t){var n=this.findNode(t);if(null!=n){if(this.length--,null!==n.left&&null!==n.right){for(var e=n.left;null!==e.right;)e=e.right;n.val=e.val,n=e}var r,o=n.left||n.right;if(null===o?(r=!0,(o=new Gr(null)).blacken(),n.right=o):r=!1,null!==n.parent){if(n.parent.left===n)n.parent.left=o;else{if(n.parent.right!==n)throw new Error("Impossible!");n.parent.right=o}if(n.isBlack()&&(o.isRed()?o.blacken():this._fixDelete(o)),this.root.blacken(),r)if(o.parent.left===o)o.parent.left=null;else{if(o.parent.right!==o)throw new Error("Impossible #3");o.parent.right=null}}else r?this.root=null:(this.root=o,o.blacken(),o._parent=null)}}},{key:"_fixDelete",value:function(t){if(null!==t.parent){var n=t.sibling;if(Yr(n)){if(t.parent.redden(),n.blacken(),t===t.parent.left)t.parent.rotateLeft(this);else{if(t!==t.parent.right)throw new Error("Impossible #2");t.parent.rotateRight(this)}n=t.sibling}t.parent.isBlack()&&n.isBlack()&&Jr(n.left)&&Jr(n.right)?(n.redden(),this._fixDelete(t.parent)):t.parent.isRed()&&n.isBlack()&&Jr(n.left)&&Jr(n.right)?(n.redden(),t.parent.blacken()):(t===t.parent.left&&n.isBlack()&&Yr(n.left)&&Jr(n.right)?(n.redden(),n.left.blacken(),n.rotateRight(this),n=t.sibling):t===t.parent.right&&n.isBlack()&&Yr(n.right)&&Jr(n.left)&&(n.redden(),n.right.blacken(),n.rotateLeft(this),n=t.sibling),n.color=t.parent.color,t.parent.blacken(),t===t.parent.left?(n.right.blacken(),t.parent.rotateLeft(this)):(n.left.blacken(),t.parent.rotateRight(this)))}}},{key:"put",value:function(t){var n=new Gr(t);if(null!==this.root){for(var e=this.root;;)if(n.val._id.lessThan(e.val._id)){if(null===e.left){e.left=n;break}e=e.left}else{if(!e.val._id.lessThan(n.val._id))return e.val=n.val,e;if(null===e.right){e.right=n;break}e=e.right}this._fixInsert(n)}else this.root=n;return this.length++,this.root.blacken(),n}},{key:"_fixInsert",value:function(t){if(null!==t.parent){if(!t.parent.isBlack()){var n=t.getUncle();null!==n&&n.isRed()?(t.parent.blacken(),n.blacken(),t.grandparent.redden(),this._fixInsert(t.grandparent)):(t===t.parent.right&&t.parent===t.grandparent.left?(t.parent.rotateLeft(this),t=t.left):t===t.parent.left&&t.parent===t.grandparent.right&&(t.parent.rotateRight(this),t=t.right),t.parent.blacken(),t.grandparent.redden(),t===t.parent.left?t.grandparent.rotateRight(this):t.grandparent.rotateLeft(this))}}else t.blacken()}}]),t}(),Xr=Object.freeze({__proto__:null,Tree:Hr}),Zr=function(){function t(){p(this,t),this._observers=B()}return v(t,[{key:"on",value:function(t,n){S(this._observers,t,Lr).add(n)}},{key:"once",value:function(t,n){var e=this;this.on(t,(function r(){e.off(t,r),n.apply(void 0,arguments)}))}},{key:"off",value:function(t,n){var e=this._observers.get(t);void 0!==e&&(e.delete(n),0===e.size&&this._observers.delete(t))}},{key:"emit",value:function(t,n){return _((this._observers.get(t)||B()).values()).forEach((function(t){return t.apply(void 0,i(n))}))}},{key:"destroy",value:function(){this._observers=B()}}]),t}(),$r=function t(n){if(n.shouldConnect&&null===n.ws){var e=new WebSocket(n.url),r=n.binaryType,o=null;r&&(e.binaryType=r),n.ws=e,n.connecting=!0,n.connected=!1,e.onmessage=function(t){n.lastMessageReceived=Fe();var e=t.data,r="string"==typeof e?JSON.parse(e):e;r&&"pong"===r.type&&(clearTimeout(o),o=setTimeout(u,15e3)),n.emit("message",[r,n])};var i=function(e){null!==n.ws&&(n.ws=null,n.connecting=!1,n.connected?(n.connected=!1,n.emit("disconnect",[{type:"disconnect",error:e},n])):n.unsuccessfulReconnects++,setTimeout(t,gt(1200*lt(n.unsuccessfulReconnects+1),2500),n)),clearTimeout(o)},u=function(){n.ws===e&&n.send({type:"ping"})};e.onclose=function(){return i(null)},e.onerror=function(t){return i(t)},e.onopen=function(){n.lastMessageReceived=Fe(),n.connecting=!1,n.connected=!0,n.unsuccessfulReconnects=0,n.emit("connect",[{type:"connect"},n]),o=setTimeout(u,15e3)}}},Qr=function(t){u(r,Zr);var n=c(r);function r(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=o.binaryType;return p(this,r),(e=n.call(this)).url=t,e.ws=null,e.binaryType=i||null,e.connected=!1,e.connecting=!1,e.unsuccessfulReconnects=0,e.lastMessageReceived=0,e.shouldConnect=!0,e._checkInterval=setInterval((function(){e.connected&&3e4
*
* License: MIT
*/
__d("y-protocols",[],(function $module_y_protocols(global,require,requireDynamic,requireLazy,module,exports){
"use strict";function t(e){return t="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(e)}function e(){return e="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var o=n(t,e);if(o){var a=Object.getOwnPropertyDescriptor(o,e);return a.get?a.get.call(arguments.length<3?t:r):a.value}},e.apply(this,arguments)}function n(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=i(t)););return t}function r(t,e){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},r(t,e)}function o(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=i(t);if(e){var o=i(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return a(this,n)}}function a(e,n){if(n&&("object"===t(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return u(e)}function u(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function i(t){return i=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},i(t)}function c(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=s(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,i=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return u=t.done,t},e:function(t){i=!0,a=t},f:function(){try{u||null==n.return||n.return()}finally{if(i)throw a}}}}function f(t){return function(t){if(Array.isArray(t))return l(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||s(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 s(t,e){if(t){if("string"==typeof t)return l(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(t,e):void 0}}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);nw)throw new Error("Integer out of range!")}},U=b?function(t){return b.decode(O(t))}:function(t){var e=I(t);if(0===e)return"";var n=String.fromCodePoint(k(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(k(t));else for(;e>0;){var r=e<1e4?e:1e4,o=t.arr.subarray(t.pos,t.pos+r);t.pos+=r,n+=String.fromCodePoint.apply(null,o),e-=r}return decodeURIComponent(escape(n))},_=function(t,e,n){return new Uint8Array(t,e,n)},j=p((function t(){h(this,t),this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]})),P=function(){return new j},E=function(t){for(var e=new Uint8Array(function(t){for(var e=t.cpos,n=0;n127;)L(t,128|127&e),e=m(e/128);L(t,127&e)},R=new Uint8Array(3e4),T=R.length/3,x=y?function(t,e){if(e.length0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(function(t,e){return t>e?t:e}(2*o,i)),t.cbuf.set(e.subarray(u)),t.cpos=i)}(t,e)},M=Date.now,z=function(){return new Set},N=Array.from,B=function(){function t(){h(this,t),this._observers=g()}return p(t,[{key:"on",value:function(t,e){var n,r,o,a;(n=this._observers,r=t,o=z,a=n.get(r),void 0===a&&n.set(r,a=o()),a).add(e)}},{key:"once",value:function(t,e){var n=this;this.on(t,(function r(){n.off(t,r),e.apply(void 0,arguments)}))}},{key:"off",value:function(t,e){var n=this._observers.get(t);void 0!==n&&(n.delete(e),0===n.size&&this._observers.delete(t))}},{key:"emit",value:function(t,e){return N((this._observers.get(t)||g()).values()).forEach((function(t){return t.apply(void 0,f(e))}))}},{key:"destroy",value:function(){this._observers=g()}}]),t}(),J=Object.keys,F=function(t){return J(t).length},G=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},X=function t(e,n){if(null==e||null==n)return function(t,e){return t===e}(e,n);if(e.constructor!==n.constructor)return!1;if(e===n)return!0;switch(e.constructor){case ArrayBuffer:e=new Uint8Array(e),n=new Uint8Array(n);case Uint8Array:if(e.byteLength!==n.byteLength)return!1;for(var r=0;r0&&q(u(e),n,"timeout")}),m(3e3)),t.on("destroy",(function(){e.destroy()})),e.setLocalState({}),e}return p(a,[{key:"destroy",value:function(){this.emit("destroy",[this]),this.setLocalState(null),e(i(a.prototype),"destroy",this).call(this),clearInterval(this._checkInterval)}},{key:"getLocalState",value:function(){return this.states.get(this.clientID)||null}},{key:"setLocalState",value:function(t){var e=this.clientID,n=this.meta.get(e),r=void 0===n?0:n.clock+1,o=this.states.get(e);null===t?this.states.delete(e):this.states.set(e,t),this.meta.set(e,{clock:r,lastUpdated:M()});var a=[],u=[],i=[],c=[];null===t?c.push(e):null==o?null!=t&&a.push(e):(u.push(e),X(o,t)||i.push(e)),(a.length>0||i.length>0||c.length>0)&&this.emit("change",[{added:a,updated:i,removed:c},"local"]),this.emit("update",[{added:a,updated:u,removed:c},"local"])}},{key:"setLocalStateField",value:function(t,e){var n=this.getLocalState();null!==n&&(n[t]=e,this.setLocalState(n))}},{key:"getStates",value:function(){return this.states}}]),a}(),q=function(t,e,n){for(var r=[],o=0;o0&&(t.emit("change",[{added:[],updated:[],removed:r},n]),t.emit("update",[{added:[],updated:[],removed:r},n]))},H={awareness:Object.freeze({__proto__:null,outdatedTimeout:3e4,Awareness:$,removeAwarenessStates:q,encodeAwarenessUpdate:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.states,r=e.length,o=P();D(o,r);for(var a=0;a0||i.length>0||c.length>0)&&t.emit("change",[{added:a,updated:i,removed:c},n]),(a.length>0||u.length>0||c.length>0)&&t.emit("update",[{added:a,updated:u,removed:c},n])}})};module.exports=H;
/* */}),null);
__d("CollabriClientProd",["BladeRunnerStreamStatus","BladerunnerCafTypes","CollaborativeAppClient","CollabriErrorCode","CollabriErrorFalcoEvent","CollabriYjs","CollabriYjsTypes","CollabriYjsUpdate","CurrentUser","EventEmitter","FBLogger","Promise","RetryLib","Run","URI","asyncToGeneratorRuntime","lib0","nullthrows","unrecoverableViolation","uuidv4","y-protocols","yjs"],(function(a,b,c,d,e,f,g){"use strict";var h,i;function j(a,b){var c=b.user;return!a.some(function(a){return a.user_id===c.user_id})}function k(a,b){return a.filter(function(a){return a.user.user_id===b.user.user_id}).length<1}function l(a){return new(i||(i=b("Promise")))(function(b){return window.setTimeout(b,a)})}var m={AWARENESS:1,QUERY_AWARENESS:3},n=function(a,b,e){e=d("lib0").decoding.createDecoder(e);var f=d("lib0").encoding.createEncoder(),g=d("lib0").decoding.readVarUint(e);switch(g){case m.QUERY_AWARENESS:d("lib0").encoding.writeVarUint(f,m.AWARENESS);d("lib0").encoding.writeVarUint8Array(f,d("y-protocols").awareness.encodeAwarenessUpdate(b,Array.from(b.getStates().keys())));break;case m.AWARENESS:d("y-protocols").awareness.applyAwarenessUpdate(b,d("lib0").decoding.readVarUint8Array(e),a);break;default:throw c("unrecoverableViolation")("unable to compute message","unified_editor")}return f};a=function(a){babelHelpers.inheritsLoose(e,a);function e(b,e,f,g){var h;g===void 0&&(g="prod");h=a.call(this)||this;h.users=[];h.presences=[];h.$CollabriClientProd$p_6=new(c("CollabriYjs"))();h.$CollabriClientProd$p_10=!1;h.$CollabriClientProd$p_11=!1;h.$CollabriClientProd$p_12=!1;h.$CollabriClientProd$p_14=!1;h.$CollabriClientProd$p_15=[];h.$CollabriClientProd$p_16=0;h.$CollabriClientProd$p_23=function(a){c("FBLogger")("CollabriProd").debug("CollabriClient status changed: "+a);h.status=a;switch(a){case d("BladeRunnerStreamStatus").StreamStatus.STARTED:h.$CollabriClientProd$p_11=!0;h.emit("onConnectionStatusChange",h.$CollabriClientProd$p_11);break;case d("BladeRunnerStreamStatus").StreamStatus.STOPPED:case d("BladeRunnerStreamStatus").StreamStatus.CLOSED:h.offline();h.$CollabriClientProd$p_11=!1;h.emit("onConnectionStatusChange",h.$CollabriClientProd$p_11);break}h.emit("onSteamStatusChanged",a)};h.$CollabriClientProd$p_24=function(a){var b=a.entityId,e=a.lastCursor;a=a.serializedEntity;h.$CollabriClientProd$p_2==null&&h.updateUrl(h.$CollabriClientProd$p_3,{entity:a,entityId:b,lastCursor:e});c("FBLogger")("collabriProd").debug("Entity data: "+a+" "+b+" "+e);b=h.getDocEnforce();e=JSON.parse(a);a=Uint8Array.from(e);d("yjs").applyUpdate(b.getRaw(),a,{isUpdateRemote:!0});h.$CollabriClientProd$p_9=h.$CollabriClientProd$p_6.registerDocUpdate(b,h.$CollabriClientProd$p_30);h.$CollabriClientProd$p_17=h.createBinding(b);h.suspendRemote();h.emit("onDocLoad",b);h.online()};h.$CollabriClientProd$p_25=function(a){a=a.update;try{var b=c("nullthrows")(h.$CollabriClientProd$p_5);a=c("CollabriYjsUpdate").deserialize(a);h.isRemoteSuspend()?h.$CollabriClientProd$p_15.push(a):(h.$CollabriClientProd$p_6.applyUpdate(b,a,!0),h.emit("onDocUpdate",b))}catch(a){c("CollabriErrorFalcoEvent").log(function(){return{client_id:h.$CollabriClientProd$p_1,collabri_surface:h.$CollabriClientProd$p_19,document_identifier:c("nullthrows")(h.$CollabriClientProd$p_2),error_code:c("CollabriErrorCode").APPLY_REMOTE_CHANGE_FROM_CAF,exception_message:a.message}}),h.emit("onError",{code:c("CollabriErrorCode").APPLY_REMOTE_CHANGE_FROM_CAF,message:"surface error while applying a remote update",title:null})}};h.$CollabriClientProd$p_28=function(a){var b=a.currentClientId;a=a.serializedSession;var d=h.clientId!==b;h.clientId=b;d&&h.emit("onClientIDChange",h.clientId);b=JSON.parse(a);d=new Map();a=[];for(var e of Object.keys(b)){var f=b[e],g=f.color;f=f.user;a.push({clientId:e,color:g,user:f});d.has(f.user_id)||d.set(f.user_id,f)}g=Array.from(d.values()).filter(function(a){return a.user_id!==c("CurrentUser").getID()});h.users=g;h.presences=a;h.emit("onUserUpdate",[].concat(g));h.emit("onPresenceUpdate",[].concat(a))};h.$CollabriClientProd$p_27=function(a){var b=a.eventType;a=a.update;var d=JSON.parse(a);switch(b){case 1:h.presences.push(d);h.emit("onPresenceJoin",d);h.emit("onPresenceUpdate",[].concat(h.presences));j(h.users,d)&&c("CurrentUser").getID()!==d.user.user_id&&(h.users.push(d.user),h.emit("onUserJoin",d.user),h.emit("onUserUpdate",[].concat(h.users)));break;case 2:h.presences=h.presences.filter(function(a){return a.clientId!==d.clientId});h.emit("onPresenceLeft",d);h.emit("onPresenceUpdate",[].concat(h.presences));k(h.presences,d)&&c("CurrentUser").getID()!==d.user.user_id&&(h.users=h.users.filter(function(a){return a.user_id!==d.user.user_id}),h.emit("onUserLeft",d.user),h.emit("onUserUpdate",[].concat(h.users)));break;default:throw c("unrecoverableViolation")("Unexpected client event type: "+String(b),"unified_editor")}};h.$CollabriClientProd$p_22=function(a){var b=a.senderClientId;a=a.update;a=JSON.parse(a);if(a.type==="awareness"){var c=h.$CollabriClientProd$p_7;if(c!=null){var d=Uint8Array.from(a.serializedState);n(babelHelpers.assertThisInitialized(h),c,d)}}h.emit("onClientStateUpdate",b,a)};h.$CollabriClientProd$p_30=function(a){h.emit("onLocalUpdate",a),h.$CollabriClientProd$p_11&&h.$CollabriClientProd$p_10&&a.shouldPropagate()?h.broadcastUpdate(a):h.$CollabriClientProd$p_10||(h.$CollabriClientProd$p_13.push({timestamp:Date.now(),update:a}),h.emit("onLocalUpdateCacheChange",h.$CollabriClientProd$p_13))};h.$CollabriClientProd$p_26=function(a){var b=a.error;c("CollabriErrorFalcoEvent").log(function(){return{client_id:h.$CollabriClientProd$p_1,collabri_surface:h.$CollabriClientProd$p_19,document_identifier:c("nullthrows")(h.$CollabriClientProd$p_2),error_code:String(b.errorCode),exception_message:b.message}});if(b.errorCode===d("BladerunnerCafTypes").ErrorCode.CLIENT_MISSING_PRESENCE_PAYLOAD_DETECTED)return;h.emit("onError",{code:String(b.errorCode),message:b.message,title:null})};h.$CollabriClientProd$p_20=function(a,b){b=a.added;var c=a.removed;a=a.updated;b=b.concat(a).concat(c);h.$CollabriClientProd$p_32(b)};h.$CollabriClientProd$p_1=c("uuidv4")();h.$CollabriClientProd$p_5=new(d("CollabriYjsTypes").CollabriYjsDoc)(new(d("yjs").Doc)());h.$CollabriClientProd$p_2=b;h.$CollabriClientProd$p_3=e;h.$CollabriClientProd$p_7=new(d("y-protocols").awareness.Awareness)(h.$CollabriClientProd$p_5.getRaw());h.$CollabriClientProd$p_7.on("update",h.$CollabriClientProd$p_20);h.$CollabriClientProd$p_13=[];h.$CollabriClientProd$p_18=g;h.$CollabriClientProd$p_19=f;h.$CollabriClientProd$p_4=h.$CollabriClientProd$p_21();h.$CollabriClientProd$p_8=d("Run").onUnload(function(){var a=h.$CollabriClientProd$p_7,b=h.$CollabriClientProd$p_5;if(a!=null&&b!=null){b=b.getRaw();d("y-protocols").awareness.removeAwarenessStates(a,[b.clientID],"window unload")}});return h}var f=e.prototype;f.$CollabriClientProd$p_21=function(){return new(c("CollaborativeAppClient"))({dropSameClientUpdates:!0,retryPolicy:{backoffFunction:d("RetryLib").Backoffs.exponential(100,2),maxTries:5,retryCondition:d("RetryLib").RetryConditions.always()},usecase:"collabri"},{handleClientStateUpdate:this.$CollabriClientProd$p_22,handleConnectionStatusChange:this.$CollabriClientProd$p_23,handleEntity:this.$CollabriClientProd$p_24,handleEntityUpdate:this.$CollabriClientProd$p_25,handleError:this.$CollabriClientProd$p_26,handlePresenceUpdate:this.$CollabriClientProd$p_27,handleSession:this.$CollabriClientProd$p_28})};f.createBinding=function(a){throw c("unrecoverableViolation")("createBinding must be implemented","unified_editor")};f.getDoc=function(){return this.$CollabriClientProd$p_5};f.getDocEnforce=function(){if(this.$CollabriClientProd$p_5==null)throw c("unrecoverableViolation")("unexpected doc not exist","unified_editor");return this.$CollabriClientProd$p_5};f.setDoc_TEST_ONLY_DO_NOT_USE=function(a){this.$CollabriClientProd$p_5=a};f.isOnline=function(){return this.$CollabriClientProd$p_10};f.isConnected=function(){return this.$CollabriClientProd$p_11};f.isConnecting=function(){return this.$CollabriClientProd$p_12};f.isRemoteSuspend=function(){return this.$CollabriClientProd$p_14};f.connect=function(){var a=b("asyncToGeneratorRuntime").asyncToGenerator(function*(){var a=this;if(this.$CollabriClientProd$p_11||this.$CollabriClientProd$p_12)return(i||(i=b("Promise"))).resolve();this.$CollabriClientProd$p_12=!0;var d=JSON.stringify({documentType:this.$CollabriClientProd$p_3}),e=this.$CollabriClientProd$p_18;d=(yield this.$CollabriClientProd$p_2==null?this.$CollabriClientProd$p_4.genCreateNewEntity({context:d,wwwTier:e}):this.$CollabriClientProd$p_4.genOpenEntity(this.$CollabriClientProd$p_2,{context:d,wwwTier:e}));if(d.kind==="success"){c("CollabriErrorFalcoEvent").log(function(){return{client_id:a.$CollabriClientProd$p_1,collabri_surface:a.$CollabriClientProd$p_19,document_identifier:c("nullthrows")(a.$CollabriClientProd$p_2),error_code:"-9999",exception_message:"connected to CAF"}});this.$CollabriClientProd$p_12=!1;return(i||(i=b("Promise"))).resolve()}else{this.$CollabriClientProd$p_12=!1;return(i||(i=b("Promise"))).reject()}});function d(){return a.apply(this,arguments)}return d}();f.disconnect=function(){var a;this.offline();this.$CollabriClientProd$p_11=!1;this.emit("onConnectionStatusChange",this.$CollabriClientProd$p_11);this.$CollabriClientProd$p_4.genClose(1e3);this.$CollabriClientProd$p_4=this.$CollabriClientProd$p_21();(a=this.$CollabriClientProd$p_17)==null?void 0:a.destroy();(a=this.$CollabriClientProd$p_9)==null?void 0:a.dispose();this.$CollabriClientProd$p_7.off("update",this.$CollabriClientProd$p_20);(a=this.$CollabriClientProd$p_5)==null?void 0:a.destroy();this.$CollabriClientProd$p_5=new(d("CollabriYjsTypes").CollabriYjsDoc)(new(d("yjs").Doc)());this.$CollabriClientProd$p_7=new(d("y-protocols").awareness.Awareness)(this.$CollabriClientProd$p_5.getRaw());this.$CollabriClientProd$p_7.on("update",this.$CollabriClientProd$p_20);this.suspendRemote();this.users=[];this.presences=[];this.emit("onUserUpdate",[].concat(this.users));this.emit("onPresenceUpdate",[].concat(this.presences))};f.broadcastState=function(a){if(!this.$CollabriClientProd$p_10)return;var b=JSON.stringify(a);this.status===d("BladeRunnerStreamStatus").StreamStatus.STARTED&&b!=null?this.$CollabriClientProd$p_4.sendClientStateUpdate(b):c("FBLogger")("collabriProd").warn("ERROR STATE: stream status "+String(this.status)+", "+(JSON.stringify(a,null,2)||""))};f.suspendRemote=function(){this.$CollabriClientProd$p_14=!0};f.resumeRemote=function(){var a=this,b=c("nullthrows")(this.$CollabriClientProd$p_5);this.$CollabriClientProd$p_15.forEach(function(c){a.$CollabriClientProd$p_6.applyUpdate(b,c,!0)});this.emit("onDocUpdate",b);this.$CollabriClientProd$p_14=!1};f.online=function(a){this.$CollabriClientProd$p_10=!0,this.$CollabriClientProd$p_29(a),this.emit("onOnlineStatusChange",this.$CollabriClientProd$p_10)};f.offline=function(){this.clientId=null,this.$CollabriClientProd$p_10=!1,this.emit("onOnlineStatusChange",this.$CollabriClientProd$p_10)};f.getAwareness=function(){return this.$CollabriClientProd$p_7};f.broadcastUpdate=function(a){var b=this;this.status===d("BladeRunnerStreamStatus").StreamStatus.STARTED?(this.$CollabriClientProd$p_31(!0),this.$CollabriClientProd$p_4.genSendEntityUpdate(a.serialize()).then(function(a){if(a.kind==="failure"){var d;c("CollabriErrorFalcoEvent").log(function(){return{client_id:b.$CollabriClientProd$p_1,collabri_surface:b.$CollabriClientProd$p_19,document_identifier:c("nullthrows")(b.$CollabriClientProd$p_2),error_code:String(a.error.errorCode),exception_message:a.error.message}});d=(d=a.error.message)!=null?d:"";b.emit("onError",{code:String(a.error.errorCode)==="101"?"101":c("CollabriErrorCode").SEND_CHANGE_BY_CAF,message:"error sending out updates from CAF "+d,title:null})}else c("CollabriErrorFalcoEvent").log(function(){return{client_id:b.$CollabriClientProd$p_1,collabri_surface:b.$CollabriClientProd$p_19,document_identifier:c("nullthrows")(b.$CollabriClientProd$p_2),error_code:"-9998",exception_message:"send out updates"}})})["finally"](function(){b.$CollabriClientProd$p_31(!1)})):c("FBLogger")("collabriProd").warn("ERROR STATE: stream status "+String(this.status))};f.$CollabriClientProd$p_31=function(a){this.$CollabriClientProd$p_16+=a?1:-1,this.emit("onInFlightCountChange",this.$CollabriClientProd$p_16)};f.$CollabriClientProd$p_29=function(){var a=b("asyncToGeneratorRuntime").asyncToGenerator(function*(a){a===void 0&&(a=!1);var b;while(this.$CollabriClientProd$p_13.length>0){var c=this.$CollabriClientProd$p_13.splice(0,1);c=c[0];b==null&&(b=c.timestamp);a&&(yield l(c.timestamp-b));this.broadcastUpdate(c.update);b=c.timestamp;this.emit("onLocalUpdateCacheChange",this.$CollabriClientProd$p_13)}});function c(b){return a.apply(this,arguments)}return c}();f.$CollabriClientProd$p_32=function(a){var b=this.$CollabriClientProd$p_7;if(b!=null){var c,e=(c=d("lib0")).encoding.createEncoder();c.encoding.writeVarUint(e,m.AWARENESS);c.encoding.writeVarUint8Array(e,d("y-protocols").awareness.encodeAwarenessUpdate(b,a));b=c.encoding.toUint8Array(e);a=Array.from(b);this.broadcastState({serializedState:a,type:"awareness"})}};f.hasPendingChanges=function(){return this.$CollabriClientProd$p_16>0||this.$CollabriClientProd$p_4.getInflightEntityUpdates().length>0};f.updateUrl=function(a,b){a=(h||(h=c("URI"))).getRequestURI();a.addQueryData("collabriDocID",b.entityId);h.goURIOnNewWindow(a)};return e}(c("EventEmitter"));g["default"]=a}),98);
__d("UECollabriClient",["CollabriClientProd","CollabriTypes","UECollabUndoManager"],(function(a,b,c,d,e,f,g){"use strict";a=function(a){babelHelpers.inheritsLoose(b,a);function b(b,e){var f;f=a.call(this,b,d("CollabriTypes").CollabriDocumentType.UnifiedEditor,e)||this;f.$UECollabriClient$p_1=new Map();f.$UECollabriClient$p_2="documentNodeContainer";f.$UECollabriClient$p_3=null;f.addListener("onClientIDChange",function(a){var b=f.getDocumentNodeContainer();f.$UECollabriClient$p_3!=null&&f.$UECollabriClient$p_3.clear();f.$UECollabriClient$p_3=new(c("UECollabUndoManager"))(b,new Set([a]),5e3)});return f}var e=b.prototype;e.createBinding=function(a){return{destroy:function(){}}};e.runUndo=function(){var a;(a=this.$UECollabriClient$p_3)==null?void 0:a.runUndo()};e.runRedo=function(){var a;(a=this.$UECollabriClient$p_3)==null?void 0:a.runRedo()};e.willRunDiff=function(a){var b;(b=this.$UECollabriClient$p_3)==null?void 0:b.willRunDiff(a)};e.getDocumentNodeContainer=function(){return this.getDocEnforce().getMap(this.$UECollabriClient$p_2)};e.subscribeToStatus=function(a){var b=this.addListener("onOnlineStatusChange",function(b){a(b)});this.$UECollabriClient$p_1.set("onOnlineStatusChange",b)};e.unsubscribeFromStatus=function(){var a;(a=this.$UECollabriClient$p_1.get("onOnlineStatusChange"))==null?void 0:a.remove()};e.subscribeToErrors=function(a){var b=this.addListener("onError",function(b){a(b)});this.$UECollabriClient$p_1.set("onError",b)};e.unsubscribeFromErrors=function(){var a;(a=this.$UECollabriClient$p_1.get("onError"))==null?void 0:a.remove()};e.subscribeToInFlightCountChange=function(a){a=this.addListener("onInFlightCountChange",a);this.$UECollabriClient$p_1.set("onInFlightCountChange",a)};e.unsubscribeFromInFlightCountChange=function(){var a;(a=this.$UECollabriClient$p_1.get("onInFlightCountChange"))==null?void 0:a.remove()};e.subscribeToUserJoinLeft=function(a,b){var c=this.addListener("onUserJoin",function(b){a(b)}),d=this.addListener("onUserLeft",function(a){b(a)});this.$UECollabriClient$p_1.set("onUserJoin",c);this.$UECollabriClient$p_1.set("onUserLeft",d)};e.unsubscribeFromUserJoinLeft=function(){var a;(a=this.$UECollabriClient$p_1.get("onUserJoin"))==null?void 0:a.remove();(a=this.$UECollabriClient$p_1.get("onUserLeft"))==null?void 0:a.remove()};e.subscribeToUserUpdate=function(a){var b=this.addListener("onUserUpdate",function(b){a(b)});this.$UECollabriClient$p_1.set("onUserUpdate",b)};e.unsubscribeFromUserUpdate=function(){var a;(a=this.$UECollabriClient$p_1.get("onUserUpdate"))==null?void 0:a.remove()};e.subscribeToPresenceJoinLeft=function(a,b){var c=this.addListener("onPresenceJoin",function(b){a(b)}),d=this.addListener("onPresenceLeft",function(a){b(a)});this.$UECollabriClient$p_1.set("onPresenceJoin",c);this.$UECollabriClient$p_1.set("onPresenceLeft",d)};e.unsubscribeFromPresenceJoinLeft=function(){var a;(a=this.$UECollabriClient$p_1.get("onPresenceJoin"))==null?void 0:a.remove();(a=this.$UECollabriClient$p_1.get("onPresenceLeft"))==null?void 0:a.remove()};e.subscribeToPresenceUpdate=function(a){var b=this.addListener("onPresenceUpdate",function(b){a(b)});this.$UECollabriClient$p_1.set("onPresenceUpdate",b)};e.unsubscribeFromPresenceUpdate=function(){var a;(a=this.$UECollabriClient$p_1.get("onPresenceUpdate"))==null?void 0:a.remove()};e.registerOnDocLoad=function(a,b,c,d,e){var f=this,g=this.addListener("onDocLoad",function(g){a(b,f,c,g,d,e),window.setTimeout(function(){f.resumeRemote()},1e3)});this.$UECollabriClient$p_1.set("onDocLoad",g)};e.unsubscribeAll=function(){Array.from(this.$UECollabriClient$p_1.values()).forEach(function(a){return a.remove()});return this};return b}(c("CollabriClientProd"));g["default"]=a}),98);
__d("UECollabSelectionUtils",["CollabriYjsTypes","UESelectionUtils","yjs"],(function(a,b,c,d,e,f,g){"use strict";var h=function(){function a(a,b,c){this.$1=a,this.$2=b,this.$3=c}var b=a.prototype;b.getRange=function(){var a=this.$1.createAbsolutePosition(this.$2);a=a.index;var b=this.$1.createAbsolutePosition(this.$3);b=b.index;return{charIndex:a,length:Math.max(b-a,0)}};b.isEqual=function(b){return b instanceof a&&d("yjs").compareRelativePositions(this.$2,b.$2)&&d("yjs").compareRelativePositions(this.$3,b.$3)};return a}();function a(a,b){if(a.length!==b.length)return!1;for(var c=0;c0&&b.deleteAt(i.charIndex,i.length);j.length>0&&b.insertAt(i.charIndex,j,d("UERichTextCollabConstant").UNSET_ATTRIBUTES)}else if(h.type==="UPDATE_TEXT_ATTRIBUTE"){i=h.attribute;j=h.attributeType;var k=h.textRange;b.formatAt(k.charIndex,k.length,(b={},b[j.toString()]=(k=i)!=null?k:d("UERichTextCollabConstant").NULL_ATTRIBUTE_VALUE,b))}else if(h.type==="INSERT"&&h.value.type==="style")e.set(h.value.value.id,h.value.value);else if(h.type==="INSERT"&&h.value.type==="node"){if(c("gkx")("5304")&&(h.type==="INSERT"&&h.value.type==="node")){j=h.value.value;g.insertAt(g.length(),[j.toRDFBJsonString()])}}else if(h.type==="INSERT_COMPONENT")f.set(h.componentID,h.component.getProperties());else if(h.type==="UPDATE_COMPONENT"){i=f.get(h.componentID);i!=null&&(i[h.key]=h.value,f.set(h.componentID,i))}else h.type==="REMOVE_COMPONENT"&&f["delete"](h.componentID);return a}g["default"]=a}),98);
__d("runDiffWithCollabriClient",["CollabriYjsTypes","UECollabriYjsTypes","UEHeadlessUtils","runDiffOnCollabri","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b,e){if(e.isCollabri())throw c("unrecoverableViolation")("Expected instance to be UE diff","unified_editor");var f=b.getDocumentNodeContainer();f=d("UEHeadlessUtils").assertNonNull(f.get("node"),"cannot get document map from collabri doc");var g=d("UEHeadlessUtils").assertNonNull(f.get("styleSheet"),"cannot get stylesheet map from collabri doc").get("node"),h=g.get("styles");g=d("UEHeadlessUtils").assertNonNull(f.get(d("UECollabriYjsTypes").COMPONENT_CONTAINER_NODE),"cannot get components map from collabri doc").get("node");var i=g.get(d("UECollabriYjsTypes").COMPONENT_CONTAINER);g=d("UEHeadlessUtils").assertNonNull(f.get("children"),"cannot get children map from collabri doc");f=d("UEHeadlessUtils").assertNonNull(g.get(0).get("node"),"cannot get section map from collabri doc");g=d("UEHeadlessUtils").assertNonNull(f.get("children"),"cannot get children map from collabri doc");f=d("UEHeadlessUtils").assertNonNull(g.get(0).get("node"),"cannot get rtf map from collabri doc");g=d("UEHeadlessUtils").assertNonNull(f.get("children"),"cannot get children map from collabri doc");f=d("UEHeadlessUtils").assertNonNull(g.get(0).get("node"),"cannot get rts map from collabri doc");var j=f.get("text"),k=f.get("children");g=b.getDocEnforce();g.transact(function(){var b;c("runDiffOnCollabri")(a,new((b=d("CollabriYjsTypes")).CollabriYjsText)(j),new b.CollabriYjsMap(h),new b.CollabriYjsMap(i),new b.CollabriYjsArray(k),e)},b.clientId)}g["default"]=a}),98);
__d("createCollabroationAgentAPIForUECollabriClient",["FBLogger","UECollabSelectionUtils","UERichTextStringUtils","emptyFunction","runDiffWithCollabriClient"],(function(a,b,c,d,e,f,g){"use strict";function a(a){var b,e=function(b){c("runDiffWithCollabriClient")(d("UERichTextStringUtils").createEmptyTextMutationResults(),a,b)},f=function(b){var e=a.clientId;if(e!=null){var f=a.getDocEnforce(),g=d("UECollabSelectionUtils").getCollabSelectionMap(f);f=d("UECollabSelectionUtils").createCollabWireSelectionFromUESelection(f,b);g.set(e,f)}else c("FBLogger")("unified_editor").warn("Client ID was null for UE Collaboration Agent")};return{didRunLocalDiff:b=c("emptyFunction"),isActive:function(){return a.isOnline()},isSuspended:b.thatReturnsFalse,resume:b,runDiff:e,runRemoteDiffs:b,suspend:b,updateSelection:f,willRunLocalDiff:b.thatReturnsArgument}}g["default"]=a}),98);
__d("UEDefaultComponentGlimmer.react",["BaseLoadingStateElement.react","CometCard.react","CometGlimmer.react","react"],(function(a,b,c,d,e,f,g){"use strict";var h,i=h||d("react"),j={body:{paddingTop:"xyamay9",paddingEnd:"x1pi30zi",paddingBottom:"x1l90r2v",paddingStart:"x1swvt13",$$css:!0},glimmerLine:{borderTopStartRadius:"x1a2cdl4",borderTopEndRadius:"xnhgr82",borderBottomEndRadius:"x1qt0ttw",borderBottomStartRadius:"xgk8upj",height:"xlup9mm",marginBottom:"x12nagc",$$css:!0}};function a(a){a.layout;return i.jsx(c("BaseLoadingStateElement.react"),{children:i.jsx(c("CometCard.react"),{background:"white",border:"solid",children:i.jsxs("div",{className:"xyamay9 x1pi30zi x1l90r2v x1swvt13",children:[i.jsx(c("CometGlimmer.react"),{index:0,xstyle:j.glimmerLine}),i.jsx(c("CometGlimmer.react"),{index:1,xstyle:j.glimmerLine}),i.jsx(c("CometGlimmer.react"),{index:2,xstyle:j.glimmerLine})]})})})}a.displayName=a.name+" [from "+f.id+"]";g["default"]=a}),98);
__d("XFBUEComponentType.facebook",["$InternalEnum"],(function(a,b,c,d,e,f){a=b("$InternalEnum").Mirrored(["BASE","BULLETIN_ARTICLE","BULLETIN_AUDIO","BULLETIN_DIVIDER","BULLETIN_FACEBOOK_POST","BULLETIN_GATED_CONTENT","BULLETIN_GATED_CONTENT_END","BULLETIN_INSTAGRAM_POST","BULLETIN_MEDIA_EMBED","BULLETIN_TWITTER_POST","EXAMPLE","IMAGE","PERSON","PET","POLL","VIDEO"]);c=a;f["default"]=c}),66);
__d("UEComponentBehaviorBase",["fbt","UEDefaultComponentGlimmer.react","deepEquals","unrecoverableViolation"],(function(a,b,c,d,e,f,g,h){"use strict";a=function(){function a(a){this.$1=this.coerceProperties(a)}var b=a.prototype;b.isEqual=function(a){return c("deepEquals")(a.toRDFBJson(),this.toRDFBJson())};b.getLoadingType=function(){return{placeholderFallback:c("UEDefaultComponentGlimmer.react"),type:"relay"}};b.coerceProperties=function(a){throw c("unrecoverableViolation")("coerceProperties of UEComponent must be overridden by subclasses","unified_editor")};b.clone=function(){return new this.constructor(this.$1)};b.getProperties=function(){return this.$1};b.getType=function(){return this.constructor.type};b.setProperties_DO_NOT_USE_OUTSIDE_OF_MODEL_MUTATOR=function(a){a=this.coerceProperties(a);this.$1=a};b.toRDFBJson=function(){return{properties:this.$1,type:this.constructor.type,version:this.constructor.version}};b.getAriaLabel=function(){return h._("__JHASH__VIYSN7NtByn__JHASH__")};return a}();a.type="BASE";a.version="1.0.0";g.UEComponentBehaviorBase=a}),98);
__d("UEMediaComponentGlimmer.react",["fbt","BaseLoadingStateElement.react","CometCard.react","CometGlimmer.react","TetraText.react","react"],(function(a,b,c,d,e,f,g,h){"use strict";var i,j=i||d("react"),k={body:{alignItems:"x6s0dn4",display:"x1rg5ohu",height:"xrlp1an",paddingStart:"xurb0ha",paddingLeft:null,paddingRight:null,paddingEnd:"x1sxyh0",width:"xh8yej3",$$css:!0},cardHeight:{height:"xrlp1an",$$css:!0},glimmerLine:{alignItems:"x6s0dn4",borderTopStartRadius:"x1lcm9me",borderTopEndRadius:"x1yr5g0i",borderBottomEndRadius:"xrt01vj",borderBottomStartRadius:"x10y3i5r",display:"x78zum5",height:"xrlp1an",justifyContent:"xl56j7k",$$css:!0}};function a(a){a.layout;return j.jsx(c("BaseLoadingStateElement.react"),{xstyle:k.body,children:j.jsx(c("CometCard.react"),{background:"white",border:"solid",xstyle:k.cardHeight,children:j.jsx(c("CometGlimmer.react"),{index:0,xstyle:k.glimmerLine,children:j.jsx(c("TetraText.react"),{type:"body1",children:h._("__JHASH__KsyhLANV-v9__JHASH__")})})})})}a.displayName=a.name+" [from "+f.id+"]";g["default"]=a}),98);
__d("UEImage",["fbt","UEComponentBehaviorBase","UEMediaComponentGlimmer.react","refine"],(function(a,b,c,d,e,f,g,h){"use strict";var i={CENTER:"CENTER",LEFT:"LEFT",RIGHT:"RIGHT"},j={BLOCK:"BLOCK",INLINE:"INLINE"},k={END:"END",NONE:"NONE",START:"START"};a=function(a){babelHelpers.inheritsLoose(b,a);function b(){var b,c;for(var d=arguments.length,e=new Array(d),f=0;f0&&j(d,e,b)}return c("saveAsRDFBJsonDoc")(d)}function i(a){Array.from(a.getElementsByTagName("img")).forEach(function(a){if(a.src.indexOf("file:")!==-1){var b;(b=a.parentNode)==null?void 0:b.removeChild(a)}})}function j(a,b,d){if(b.length===0)throw c("unrecoverableViolation")("No inline text ranges provided","unified_editor");var e=l(b,d.getContent().getText().length);b=b.map(function(a){return{textRange:a,type:"image"}}).concat(e.map(function(a){return{textRange:a,type:"rich-text"}})).sort(function(a,b){return a.textRange.charIndex-b.textRange.charIndex});b.forEach(function(b){k(a,d,b)});a.getChildAtIdx(0).removeChildAtIdx(0)}function k(a,b,e){var f=a.getChildAtIdx(0);switch(e.type){case"rich-text":b=d("UERichTextStringPersistenceUtils").cloneRichTextFrame(b,e.textRange,!0);f.appendChild(b);b.setParent(f);b.onAddedToDocument(a);break;case"image":e=c("uuidv4")();b=new(c("UEImage"))({display:"BLOCK",isPlaceholder:!0});var g=a.getComponentContainer();g.insertComponentWithID(e,b);g=c("UEComponentNode").create(e);f.appendChild(g);g.setParent(f);g.onAddedToDocument(a);break;default:throw c("unrecoverableViolation")("Unknown NodeRange type","unified_editor")}}function l(a,b){var c=[],d=0;a.forEach(function(a){var b=a.charIndex,e=a.charIndex-d;e>0&&c.push({charIndex:d,length:e});d=b+a.length});d").join("").split("
").join(""):a}function e(a){a=h(a,!0);return k(a)}function k(a){var b=new Document(),c=b.createElement("html");b.append(c);var d=0;a.forEach(function(e){e=l(e,c);d++;d!==a.size&&e&&c.append(b.createElement("br"))});return c.outerHTML}function l(a,b){a=a.toHTML();if(a==null)return!1;a=d("UEHeadlessUtils").assertNonNull(a.documentElement,"HTML node should be in document");a.childNodes.forEach(function(a){a=a.cloneNode(!0);b.append(a)});return!0}g.createNodeMapFromLeanDocument=h;g.serializeNodesToPlainText=a;g.serializeSingleEditorDocumentToHTML=b;g.serializeDocumentToHTML=e}),98);
__d("pushMutatorErrorToast",["fbt","cometPushToast"],(function(a,b,c,d,e,f,g,h){"use strict";var i=3e4;function a(a){switch(a){case"OFFLINE":d("cometPushToast").cometPushErrorToast({message:h._("__JHASH__8j33sELAajC__JHASH__")},i);break;case"BLOCK_EDITING":d("cometPushToast").cometPushErrorToast({message:h._("__JHASH__2xoj_Zouyph__JHASH__")},i);break;default:break}return}g["default"]=a}),98);
__d("UECollaborationAgent",["CollabriErrorCode","CollabriErrorFalcoEvent","UEModelMutator","UERichTextStringUtils","gkx","nullthrows","pushMutatorErrorToast","uuidv4"],(function(a,b,c,d,e,f,g){"use strict";a=function(){function a(a,b){this.$4=!1,this.$1=a,this.$2=b,this.$3=c("uuidv4")()}var b=a.prototype;b.didRunLocalDiff=function(a){this.$2.didRunLocalDiff(a)};b.isActive=function(){return this.$2.isActive()};b.isSuspended=function(){return this.$2.isSuspended()};b.resume=function(){this.$2.resume()};b.runDiff=function(a,b){var e=this;if(c("gkx")("409")===!1){var f=b;if(this.$2.isActive()===!0&&b.isFromCollabri()===!1){this.$1.setLocalDiffFromCollabri(null);this.$2.runDiff(b);f=this.$1.getLocalDiffFromCollabri();if(f==null)return d("UERichTextStringUtils").createEmptyTextMutationResults();this.$1.setLocalDiffFromCollabri(null)}return d("UEModelMutator").applyDiff(a,f)}else{if(this.$4){c("pushMutatorErrorToast")("BLOCK_EDITING");return d("UERichTextStringUtils").createEmptyTextMutationResults()}f=b;if(this.$2.isActive()===!0&&b.isFromCollabri()===!1){this.$1.setLocalDiffFromCollabri(null);try{this.$2.runDiff(b)}catch(a){c("CollabriErrorFalcoEvent").log(function(){var b;return{client_id:e.$3,collabri_surface:"DEFAULT",document_identifier:c("nullthrows")((b=e.$1.getLoggingInformation())==null?void 0:b.documentID),error_code:c("CollabriErrorCode").APPLY_LOCAL_CHANGE_TO_COLLABRI,exception_message:a.message}});this.$4=!0;return d("UERichTextStringUtils").createEmptyTextMutationResults()}f=this.$1.getLocalDiffFromCollabri();if(f==null)return d("UERichTextStringUtils").createEmptyTextMutationResults();this.$1.setLocalDiffFromCollabri(null)}try{return d("UEModelMutator").applyDiff(a,f)}catch(a){c("CollabriErrorFalcoEvent").log(function(){var b;return{client_id:e.$3,collabri_surface:"DEFAULT",document_identifier:c("nullthrows")((b=e.$1.getLoggingInformation())==null?void 0:b.documentID),error_code:c("CollabriErrorCode").APPLY_LOCAL_CHANGE_TO_MODEL,exception_message:a.message}});this.$4=!0;return d("UERichTextStringUtils").createEmptyTextMutationResults()}}};b.runRemoteDiff=function(a){this.$2.runRemoteDiffs(a)};b.suspend=function(){this.$2.suspend()};b.willRunLocalDiff=function(a){return this.$2.willRunLocalDiff(a)};b.updateSelection=function(a){this.$2.updateSelection(a)};return a}();g["default"]=a}),98);
__d("UETextArrayBehaviors",["UEHeadlessUtils","UEPredefinedStyleIDs"],(function(a,b,c,d,e,f,g){"use strict";var h=new Map([["PARAGRAPH_STYLES",new Map([["ARRAY_APPLIES_TO_BLOCKS",!0],["ARRAY_CONTAINS_STYLES",!0],["ARRAY_SHOULD_RECORD_INVERSE_ATOMIC_CHANGE",!0],["ARRAY_SUPPORTS_MARKDOWN",!0]])],["LIST_STYLES",new Map([["ARRAY_IS_SPARSE_FOR_BLOCKS",!0],["ARRAY_SHOULD_COPY_TO_SINGLE_NEWLINE_INSERTIONS",!0],["ARRAY_CONTAINS_STYLES",!0],["ARRAY_VALUE_NULLABLE",!0],["ARRAY_SHOULD_RECORD_INVERSE_ATOMIC_CHANGE",!0],["ARRAY_SHOULD_CLEAR_ON_EMPTY_BLOCKS",!0],["ARRAY_SUPPORTS_MARKDOWN",!0],["ARRAY_SHOULD_UPDATE_USING_BACKSPACE",!0]])],["LIST_STARTS",new Map([["ARRAY_IS_SPARSE_FOR_BLOCKS",!0],["ARRAY_VALUE_NULLABLE",!0],["ARRAY_SHOULD_RECORD_INVERSE_ATOMIC_CHANGE",!0],["ARRAY_SHOULD_CLEAR_ON_EMPTY_BLOCKS",!0]])],["COMPLETED_STATE",new Map([["ARRAY_IS_SPARSE_FOR_BLOCKS",!0],["ARRAY_VALUE_NULLABLE",!0],["ARRAY_SHOULD_RECORD_INVERSE_ATOMIC_CHANGE",!0],["ARRAY_SHOULD_CLEAR_ON_EMPTY_BLOCKS",!0]])],["PARAGRAPH_LEVEL",new Map([["ARRAY_IS_SPARSE_FOR_BLOCKS",!0],["ARRAY_SHOULD_COPY_TO_SINGLE_NEWLINE_INSERTIONS",!0],["ARRAY_VALUE_NULLABLE",!0],["ARRAY_SHOULD_RECORD_INVERSE_ATOMIC_CHANGE",!0],["ARRAY_SHOULD_CLEAR_ON_EMPTY_BLOCKS",!0],["ARRAY_SHOULD_UPDATE_USING_BACKSPACE",!0],["ARRAY_CAN_INCREMENT_DECREMENT",!0]])],["CHARACTER_STYLES",new Map([["ARRAY_APPLIES_TO_CHARACTERS",!0],["ARRAY_VALUE_NULLABLE",!0],["ARRAY_CONTAINS_STYLES",!0],["ARRAY_SUPPORTS_INSERTION_STYLES",!0],["ARRAY_CONTAINS_STYLES_THAT_EXTEND_OVER_INSERTIONS",!0]])],["LINKS",new Map([["ARRAY_APPLIES_TO_CHARACTERS",!0],["ARRAY_CONTAINS_EXTERNAL_REFERENCE",!0],["ARRAY_CONTAINS_SEGMENTED_OR_IMMUTABLE_NODES",!0],["ARRAY_VALUE_NULLABLE",!0],["ARRAY_VALUE_NO_SPLIT",!0]])],["FOOTNOTES",new Map([["ARRAY_APPLIES_TO_CHARACTERS",!0],["ARRAY_CONTAINS_EXTERNAL_REFERENCE",!0],["ARRAY_CONTAINS_SEGMENTED_OR_IMMUTABLE_NODES",!0],["ARRAY_VALUE_NULLABLE",!0],["ARRAY_VALUE_NO_SPLIT",!0]])],["EXTERNAL_SMART_FIELDS",new Map([["ARRAY_APPLIES_TO_CHARACTERS",!0],["ARRAY_CONTAINS_EXTERNAL_REFERENCE",!0],["ARRAY_VALUE_NULLABLE",!0],["ARRAY_VALUE_NO_SPLIT",!0]])],["ANNOTATIONS",new Map([["ARRAY_APPLIES_TO_CHARACTERS",!0],["ARRAY_CONTAINS_EXTERNAL_REFERENCE",!0],["ARRAY_VALUE_NULLABLE",!0],["ARRAY_VALUE_NO_SPLIT",!0]])],["INLINES",new Map([["ARRAY_APPLIES_TO_CHARACTERS",!0],["ARRAY_VALUE_NULLABLE",!0],["ARRAY_VALUE_NO_SPLIT",!0],["ARRAY_REFERENCES_INLINE_CHARACTER",!0]])]]),i=new Map([[c("UEPredefinedStyleIDs").blockQuote,new Map([["ARRAY_SHOULD_CLEAR_ON_EMPTY_BLOCKS",!0]])]]);function a(a,b){b=d("UEHeadlessUtils").assertNonNull(h.get(b),"text behaviors of "+b+" should not be null");return b.has(a)?d("UEHeadlessUtils").assertNonNull(b.get(a),a+" should not be null in textBehavior"):!1}function b(a,b){b=i.get(b);return b==null?!1:b.has(a)?d("UEHeadlessUtils").assertNonNull(b.get(a),a+" should not be null in textBehavior"):!1}g.doesAttributeHaveBehavior=a;g.doesTextStyleHaveBehavior=b}),98);
__d("transformCollabriCharacterIndexScheme",["UEHeadlessUtils","UETextArrayBehaviors"],(function(a,b,c,d,e,f,g){"use strict";var h="UNSET";function a(a,b,c){a=a.getChanges();var e=c?1:-1;a.forEach(function(a){a=d("UEHeadlessUtils").assertNonNull(a.atomicChange,"expect atomic change");a;if(a.type==="UPDATE_TEXT_ATTRIBUTE"){var f=d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_IS_SPARSE_FOR_BLOCKS",a.attributeType),g=d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_APPLIES_TO_BLOCKS",a.attributeType),i=g||f,j=i?0:e,k=a.textRange;if(i&&c===!1){var l=k.length;for(var m=0;m0?this.$3[this.$3.length-1]:null};b.popChange=function(){this.$3.pop();return this};b.canCoalesce=function(){return this.$1};b.appendChanges=function(a){var b;(b=this.$3).push.apply(b,a.$3);return this};b.coalesceWith=function(a){var b;(b=this.$3).unshift.apply(b,a.$3);return this};b.getCurrentSelection=function(){return this.$4};b.isUndoable=function(){return this.$7};b.setCurrentSelection=function(a){this.$4=a;return this};b.getSelectionForUndo=function(){return this.$5};b.setSelectionForUndo=function(a){this.$5=a;return this};b.getSelectionForRedo=function(){return this.$6};b.setSelectionForRedo=function(a){this.$6=a;return this};b.validate=function(){};b.copy=function(){var b=a.create(this.$3,this.$4,this.$5,this.$5,this.$1,this.$2,this.$8,this.$7);b.metadata=this.metadata;return b};b.getChanges=function(){return this.$3};b.getChangesMutable=function(){return this.$3};b.createInverse=function(){return a.create(this.$3.reverse(),this.$4,this.$5,this.$6,this.$1,this.$2,this.$8,this.$7)};b.createCollabriDiff=function(){if(this.isCollabri())throw c("unrecoverableViolation")("Expected instance to be non-Collabri diff","unified_editor");var a=this.copy();a.$8.isCollabri=!0;a.$3=[];return c("transformDiffToCollabri")(this,a)};b.createDiffFromCollabri=function(){if(!this.isCollabri())throw c("unrecoverableViolation")("Expected instance to be Collabri diff","unified_editor");var a=this.copy();a.$8.isCollabri=!1;a.$3=[];return c("transformCollabriToDiff")(this,a)};b.getCollabriMetadata=function(){return this.$8};b.getCollabriOrigin=function(){return this.$8.origin};b.isCollabri=function(){return this.$8.isCollabri};b.setCanCoalesce=function(a){this.$1=a};b.setCoalescingNodeKey=function(a){this.$2=a};b.getCoalescingNodeKey=function(){return this.$2};b.isEnter=function(){var a=d("UEDiffUtils").getTypingEventAtomicChange(this);return a!=null&&a.textRange.length===0&&a.value==="\n"};a.createEmptyDiff=function(){return a.create([],[],[],[],!1,null)};a.create=function(b,c,d,e,f,g,h,i){h===void 0&&(h={isCollabri:!1,isFromCollabri:!1,origin:"local"});i===void 0&&(i=!0);return new a(b,c,d,e,(b=f)!=null?b:!1,g,h,i)};b.asString=function(a){var b="UEDiff isCollabri: "+String(this.isCollabri())+" canCoalesce: "+String(d("UEDiffUtils").canCoalesceChanges(this))+"\n";this.getChanges().forEach(function(c){c=c.atomicChange;c!=null&&(b+=d("UEAtomicChangeUtils").getAsStringFromAtomicChange(a,c)+"\n")});return b};b.getRelevantComponent=function(a){for(var b=this.getChanges(),c=Array.isArray(b),d=0,b=c?b:b[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var e;if(c){if(d>=b.length)break;e=b[d++]}else{d=b.next();if(d.done)break;e=d.value}e=e;e=e.atomicChange;if(e!=null)switch(e.type){case"INSERT_COMPONENT":return e.component.getType();case"REMOVE_COMPONENT":case"UPDATE_COMPONENT":return a.model.getComponentContainer().getComponent(e.componentID).getType()}}return null};return a}();g["default"]=a}),98);
__d("DefaultCollaborationAgentAPI",["emptyFunction"],(function(a,b,c,d,e,f,g){"use strict";b={didRunLocalDiff:a=c("emptyFunction"),isActive:a.thatReturnsFalse,isSuspended:a.thatReturnsFalse,resume:a,runDiff:a,runRemoteDiffs:a,suspend:a,updateSelection:a,willRunLocalDiff:a.thatReturnsArgument};g["default"]=b}),98);
__d("UELoggingUtils",["UEHeadlessUtils"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b){var c=b.model;b=b.modelNodeByKey;var e=[],f=[],g=[],h=[],i=[],j=[],k=[],l=[];for(var m=a.getChanges(),n=Array.isArray(m),o=0,m=n?m:m[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var p;if(n){if(o>=m.length)break;p=m[o++]}else{o=m.next();if(o.done)break;p=o.value}p=p;p=p.atomicChange;if(p==null)continue;switch(p.type){case"INSERT":p.value.type==="node"&&e.push({node_type:p.value.value.getNodeType(),parent_id:p.parentKey});break;case"REMOVE":f.push({node_id:p.nodeKey,node_type:p.nodeType});break;case"UPDATE":g.push({key:p.key,node_id:p.nodeKey,node_type:b[p.nodeKey].getNodeType(),value:p.value?d("UEHeadlessUtils").getAsStringFromUEValue(p.value):"null"});break;case"UPDATE_TEXT_ATTRIBUTE":var q=a.metadata.styleToggleIntent;q!=null?q=q.style+":"+String(q.value):p.attribute==null?q="null":typeof p.attribute==="string"?q=p.attribute:q=d("UEHeadlessUtils").getAsStringFromUEValue(p.attribute);h.push({attribute:q,attribute_type:String(p.attributeType),node_id:p.nodeKey,update_length:String(p.textRange.length),update_start_index:String(p.textRange.charIndex)});break;case"REPLACE_TEXT":i.push({is_typing_event:p.editorData.isTypingEvent,new_length:String(p.value.length),node_id:p.nodeKey,replacement_length:String(p.textRange.length),replacement_start_index:String(p.textRange.charIndex)});break;case"INSERT_COMPONENT":j.push({component_id:p.componentID,component_type:p.component.getType()});break;case"REMOVE_COMPONENT":k.push({component_id:p.componentID,component_type:c.getComponentContainer().getComponent(p.componentID).getType()});break;case"UPDATE_COMPONENT":l.push({component_id:p.componentID,component_type:c.getComponentContainer().getComponent(p.componentID).getType(),key:p.key});break}}return{can_coalesce:a.canCoalesce(),changes:{inserted_components:j,inserted_nodes:e,removed_components:k,removed_nodes:f,replaced_text:i,updated_components:l,updated_nodes:g,updated_rich_text_attributes:h},created_by_collabri:a.isFromCollabri(),should_run_on_collabri:a.isCollabri()}}g.getStructuredLoggingInfoForDiff=a}),98);
__d("UnifiedEditorScaleFalcoEvent",["FalcoLoggerInternal","getFalcoLogPolicy_DO_NOT_USE"],(function(a,b,c,d,e,f,g){"use strict";a=c("getFalcoLogPolicy_DO_NOT_USE")("628");b=d("FalcoLoggerInternal").create("unified_editor_scale",a);e=b;g["default"]=e}),98);
__d("UEDiffController",["DefaultCollaborationAgentAPI","UECollaborationAgent","UEDiffUtils","UEHeadlessUtils","UELayoutMutator","UELoggingUtils","UEModelStorage","UESelectionUtils","UEUndoRedoUtils","UnifiedEditorScaleFalcoEvent","createCollabroationAgentAPIForUECollabriClient","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";a=function(){function a(a){this.$4=new(c("UECollaborationAgent"))(this,c("DefaultCollaborationAgentAPI")),this.$5=[],this.$6=[],this.$8=a}var b=a.prototype;b.getLoggingInformation=function(){return this.$7};b.getLocalDiffFromCollabri=function(){return this.$1};b.setLocalDiffFromCollabri=function(a){this.$1=a};b.getRemoteDiffFromCollabri=function(){return this.$2};b.setRemoteDiffFromCollabri=function(a){this.$2=a};b.openDiffWithSelection=function(a){this.$3=a};b.hasUndos=function(){return this.$5.length>0};b.hasRedos=function(){return this.$6.length>0};b.popUndoStack=function(){this.$5.pop()};b.popRedoStack=function(){this.$6.pop()};b.runUndo=function(a){return this.runUndoOrRedo(a,"UNDO")};b.runRedo=function(a){return this.runUndoOrRedo(a,"REDO")};b.runUndoOrRedo=function(a,b){var e=b==="UNDO",f=null,g=a.model.getViewModel().hasBehavior("COLLABORATION_ENABLED")||a.collabriClient!=null;if(g){g=d("UEHeadlessUtils").assertNonNull(a.collabriClient,"Tried to run ${type} with null collabri client");e?g.runUndo():g.runRedo();g=this.getLocalDiffFromCollabri();if(g==null)return d("UEUndoRedoUtils").getUEEmptyUndoRedoMutationResults();this.setLocalDiffFromCollabri(null)}else{if(e&&!this.hasUndos()||!e&&!this.hasRedos()){var h=e?"undo":"redo";throw c("unrecoverableViolation")("Attempted to run "+h+" with an empty "+h+" stack","unified_editor")}g=d("UEHeadlessUtils").assertNonNull(this.getLatestDiffInStack(e?this.$5:this.$6),"Top diff of %{type} stack came back null, but stack was not empty");e?(this.popUndoStack(),f=g.getSelectionForUndo()):(this.popRedoStack(),f=g.getSelectionForRedo())}this.openDiffWithSelection(g);h=this.closeAndRunDiff(a,b);return this.adjustRichTextStringLayoutInstructionsForUndoRedo(h,f)};b.adjustRichTextStringLayoutInstructionsForUndoRedo=function(a,b){var c,e=b,f=b!=null&&d("UESelectionUtils").isSelectionInline(b)?(c=d("UESelectionUtils").getInlineSelection(b))==null?void 0:c.id:null;c=a.map(function(a){switch(a.type){case"UPDATE_RICH_TEXT_STRING":case"UPDATE_RICH_TEXT_SELECTION":case"CLEAR_RICH_TEXT_SELECTION":var c=a.suggestedNewTextRange;c!=null&&f!=null&&a.nodeKey===f&&b!=null&&(e=b.slice(0,b.length-1).concat([[{id:f,range:c,type:"text"}]]));case"REFRESH_HOST_FOR_INSERTION_STYLES":a.isUndoRedo=!0;default:return a}});return{layoutInstructions:c,newSelection:e}};b.processDiffForUndoRedoStack=function(a,b,c){var d=this.$5;c==null?this.clearStack("REDO"):c==="UNDO"&&(d=this.$6);b=b.createInverse();this.pushOrCoalesceToStack(a,b,d,c)};b.pushOrCoalesceToStack=function(a,b,c,e){if(e!=null){c.push(d("UEDiffUtils").createNonCoalesceable(b));return}e=this.getLatestDiffInStack(c);e!=null&&d("UEDiffUtils").canCoalesceWithDiff(e,a,b)?e.coalesceWith(b):(this.markLatestDiffOnStackAsNonCoalesceable(c),c.push.apply(c,d("UEDiffUtils").splitInverseDiff(b)))};b.getLatestDiffInStack=function(a){return a.length>0?a[a.length-1]:null};b.markLatestDiffOnStackAsNonCoalesceable=function(a){if(a.length>0){var b=a[a.length-1];a[a.length-1]=d("UEDiffUtils").createNonCoalesceable(b)}};b.clearStack=function(a){a==="UNDO"?this.$5=[]:this.$6=[]};b.closeAndRunDiff=function(a,b){var e=this;b===void 0&&(b=null);if(this.$3==null)return[];var f=this.$3,g=this.getCollaborationAgent().willRunLocalDiff(f);if(b==null){var h;(h=a.collabriClient)==null?void 0:h.willRunDiff(f)}var i=this.$7,j=g.getRelevantComponent(a),k=g.asString(a),l=d("UELoggingUtils").getStructuredLoggingInfoForDiff(f,a);h=this.runDiffs(a,[g]);var m=h[0];h=h[1];if(m.length===0)throw c("unrecoverableViolation")("Should have processed a diff in closeAndRunDiff","unified_editor");if(f.isUndoable()){m=m[0];this.processDiffForUndoRedoStack(f,m,b)}this.getCollaborationAgent().didRunLocalDiff(g);i!=null&&i.referrer!=="do-not-log"&&c("UnifiedEditorScaleFalcoEvent").log(function(){return{category:"editor-event",document_identifier:i.documentID,editor_identifier:i.editorIdentifier,event:{component_type:j!=null?j:void 0,diff:l,diff_information:k,event_id:i.eventID,referrer:i.referrer,type:"diff"}}});f.getChanges().forEach(function(b){var c;if(((c=b.atomicChange)==null?void 0:c.type)==="INSERT_COMPONENT")e.$8==null?void 0:e.$8([[b.atomicChange.componentID,b.atomicChange.component]]);else if(((c=b.atomicChange)==null?void 0:c.type)==="UPDATE_COMPONENT"){c=b.atomicChange.componentID;if(e.$8!=null&&b.atomicChange.shouldFetchComponent===!0){b=a.model.getComponentContainer().getComponentMap().get(c);b!=null&&(e.$8==null?void 0:e.$8([[c,b]]))}}});this.$3=null;return h};b.runDiffs=function(a,b){var e=this,f=[],g=[];b.forEach(function(b){b=e.getCollaborationAgent().runDiff(a,b);var c=b.inverseDiff;b=b.layoutInstructions;c.validate();f.push(c);g=d("UELayoutMutator").appendInstructions.apply(void 0,[g].concat(b))});if(!a.model.getDocument().isValid())throw c("unrecoverableViolation")("The model is no longer valid.","unified_editor");return[f,g]};b.shadowComponentDeletion=function(a){this.shadowComponentDeletionForStack(this.$5,a),this.shadowComponentDeletionForStack(this.$6,a)};b.shadowComponentDeletionForStack=function(a,b){var d=a.length;for(d=d-1;d>=0;d--){var e=a[d];e=e.getChangesMutable();var f=e.findIndex(function(a){a=a.atomicChange;return(a==null?void 0:a.type)==="REMOVE_COMPONENT"&&a.componentID===b});if(f!==-1){f=f-1;if(f>=0){var g=e[f].atomicChange;if((g==null?void 0:g.type)!=="REMOVE"||(g==null?void 0:g.nodeType)!=="COMPONENT")throw c("unrecoverableViolation")("Expected REMOVE_COMPONENT atomic change to be preceded by REMOVE of node","unified_editor");e.length===2?a.splice(d,1):e.splice(f,2);return}throw c("unrecoverableViolation")("Expected REMOVE_COMPONENT atomic change to be preceded by REMOVE of node","unified_editor")}}};b.handleDiff=function(a,b){this.openDiffWithSelection(b);return this.closeAndRunDiff(d("UEModelStorage").getDocumentModel(a),null)};b.isCollaborating=function(){this.getCollaborationAgent().isActive()};b.suspendCollaboration=function(){this.getCollaborationAgent().suspend()};b.resumeCollaboration=function(){this.getCollaborationAgent().resume()};b.runRemoteDiff=function(a){this.getCollaborationAgent().isSuspended()||this.getCollaborationAgent().runRemoteDiff(a)};b.getCollaborationAgent=function(){return this.$4};b.updateCollaborationAgent=function(a){this.$4=new(c("UECollaborationAgent"))(this,c("createCollabroationAgentAPIForUECollabriClient")(a))};b.setLoggingInformation=function(a){this.$7=babelHelpers["extends"]({},a)};b.clearLoggingInformation=function(){this.$7=null};return a}();g["default"]=a}),98);
__d("UEModelStorage",["UEModelStorageUtils","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";var h=new Map();function a(a,b){h.set(a,d("UEModelStorageUtils").createInstanceFromModel(b))}function b(a){h["delete"](a)}function i(a){var b=h.get(a);if(b==null)throw c("unrecoverableViolation")("Model not found for document id "+a,"unified_editor");return b}function e(a){return a==null?null:h.get(a)}function f(a,b){var d;d=(d=h.get(a))==null?void 0:d.modelNodeByKey[b];if(d==null)throw c("unrecoverableViolation")("Node "+b+" not found in cache for document id "+a,"unified_editor");return d}function j(a){return i(a).model.getViewModel().getSelection()}function k(a){return i(a).model.getViewModel().getSearchEnforce()}g.documentModelsByKey=h;g.addDocumentModel=a;g.removeDocumentModel=b;g.getDocumentModel=i;g.getDocumentModelNullable=e;g.getNodeInDocument=f;g.getSelectionNodeInDocument=j;g.getSearchNodeInDocument=k}),98);
__d("UECollabriControllerStorageUtils",["UECollabriClient","UEModelStorage","UEModelStorageUtils","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b,c){d("UEModelStorage").documentModelsByKey.set(a,d("UEModelStorageUtils").createInstanceFromModelWithCollabriClient(b,c))}function b(a){var b=d("UEModelStorage").documentModelsByKey.get(a);if(b==null)throw c("unrecoverableViolation")("Model not found for document id "+a,"unified_editor");b.collabriClient=new(c("UECollabriClient"))(null,"DEFAULT");b.collabriControllerByKey={};return b.collabriClient}function e(a,b){a=j(a);a=a[b];if(a==null)throw c("unrecoverableViolation")("collabri controller for "+b+" is not created in storage","unified_editor");return a}function h(a,b){a=j(a);return a[b]}function f(a,b){i(a,b.getID());a=j(a);a[b.getID()]=b}function i(a,b){var c=j(a);a=h(a,b);a!=null&&(a.dispose(),delete c[b])}function j(a){a=d("UEModelStorage").getDocumentModel(a).collabriControllerByKey;if(a==null)throw c("unrecoverableViolation")("collabriControllerByKey is not created in storage which should never happen in collab mode","unified_editor");return a}g.addDocumentWithCollabriClient=a;g.addUECollabriClient=b;g.getCollabriControllerInDocumentEnforce=e;g.getCollabriControllerInDocument=h;g.addCollabriControllerInDocument=f;g.removeCollabriControllerInDocument=i}),98);
__d("getAdjustedChangesOrderForTextAttributesForUEDiffFromCollabri",[],(function(a,b,c,d,e,f){"use strict";function a(a){a=a.getChanges().reduce(function(a,b){var c,d=a[0],e=a[1];a=a[2];if(((c=b.atomicChange)==null?void 0:c.type)!=null)switch((c=b.atomicChange)==null?void 0:c.type){case"INSERT_COMPONENT":d.push(b);break;case"UPDATE_TEXT_ATTRIBUTE":e.push(b);break;default:a.push(b)}else a.push(b);return[d,e,a]},[[],[],[]]);var b=a[0],c=a[1];a=a[2];return[].concat(b,a,c)}f["default"]=a}),66);
__d("adjustChangesOrderForInitialUEDiffFromCollabri",["UEDiff","getAdjustedChangesOrderForTextAttributesForUEDiffFromCollabri"],(function(a,b,c,d,e,f,g){"use strict";function a(a){a=c("getAdjustedChangesOrderForTextAttributesForUEDiffFromCollabri")(a);var b=c("UEDiff").createEmptyDiff().createCollabriDiff();b.setIsFromCollabri(!0);b.pushChanges.apply(b,a);return b}g["default"]=a}),98);
__d("adjustChangesOrderForUEDiffFromCollabri",["UEDiff"],(function(a,b,c,d,e,f,g){"use strict";function a(a){var b=a.getChanges().reduce(function(a,b){var c,d=a[0];a=a[1];((c=b.atomicChange)==null?void 0:c.type)==="INSERT"&&((c=b.atomicChange)==null?void 0:c.value.type)==="style"?d.push(b):a.push(b);return[d,a]},[[],[]]),d=b[0];b=b[1];var e=c("UEDiff").createEmptyDiff().createCollabriDiff();e.setIsFromCollabri(!0);e.setCurrentSelection(a.getCurrentSelection());e.setCollabriOrigin(a.getCollabriOrigin());e.pushChanges.apply(e,d.concat(b));return e}g["default"]=a}),98);
__d("adjustSuggestedNewTextRangeForRemoteLayoutInstruction",["UESelectionUtils","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b){if(a.type!=="UPDATE_RICH_TEXT_STRING")throw c("unrecoverableViolation")("instrution type must be UPDATE_RICH_TEXT_STRING for adjustSuggestedNewTextRangeForRemoteLayoutInstruction","unified_editor");a=a.remoteTextRangeAndTextInsertLengths;b=d("UESelectionUtils").getInlineSelection(b);if(b==null)throw c("unrecoverableViolation")("cannot adjust suggestedNewTextRange when rich text string not selected","unified_editor");var e=b.range,f=e;a.forEach(function(a){f=h(a.replacementRange,a.textToInsertLength,f)});b.range=f;return f}function h(a,b,c){var d=c.charIndex,e=c.length,f=b-a.length,g=a.charIndex;a=a.charIndex+a.length;var h=c.charIndex,i=c.charIndex+c.length;if(a<=h)d=h+f;else if(!(g>=i))if(g===a&&g>h&&g=h&&a<=i)e+=f;else if(g=h&&a>i){f=g-i;e+=f}else gi&&(e=0,d=g);return{charIndex:d,excludeTrailingBlock:c.excludeTrailingBlock,length:e}}g.adjustSuggestedNewTextRangeForRemoteLayoutInstruction=a;g.calculateNewSelectionRangeFromRemoteAndLocal=h}),98);
__d("UECollabriObjectNodeController",["UEHeadlessUtils"],(function(a,b,c,d,e,f,g){"use strict";a=function(){var a=b.prototype;a.getID=function(){return this.$1};a.getUENode=function(){return this.$2};a.getCollabriNode=function(){return this.$3};a.getCollabriChildrenArray=function(){return this.$4};a.getCollabriPropertyKeyValuesMap=function(){return this.$5};a.getDiffController=function(){return this.$6};a.getCollabriClient=function(){return this.$7};function b(a,b,c,e,f){this.$1=a,this.$2=b,this.$3=c,this.$6=e,this.$7=f,this.$4=d("UEHeadlessUtils").assertNonNull(c.get("children"),"cannot get collabri children array from collabriNode"),this.$5=c.get("propertyKeyValues"),this.$4.observe(function(a){})}a.dispose=function(){};return b}();g["default"]=a}),98);
__d("UECollabriComponentContainerNodeController",["UECollabriObjectNodeController","UECollabriYjsTypes","UEDiff","UEDiffUtils","UEHeadlessUtils","transformComponentContainerMapChangeToDiff"],(function(a,b,c,d,e,f,g){"use strict";a=function(a){babelHelpers.inheritsLoose(e,a);var b=e.prototype;b.getComponentsMap=function(){return this.$UECollabriComponentContainerNodeController$p_1};b.getComponentsObserver=function(){return this.$UECollabriComponentContainerNodeController$p_2};function e(b,e,f,g,h){var i;i=a.call(this,b,e,f,g,h)||this;i.$UECollabriComponentContainerNodeController$p_1=d("UEHeadlessUtils").assertNonNull(f.get(d("UECollabriYjsTypes").COMPONENT_CONTAINER),"cannot get style collabri map from style collabri node");i.$UECollabriComponentContainerNodeController$p_2=i.getComponentsMap().observe(function(a,b){a=a.changes.keys;if(b!=null&&b.origin===i.getCollabriClient().clientId){b=(b=g.getLocalDiffFromCollabri())!=null?b:c("UEDiff").createEmptyDiff().createCollabriDiff();var e=c("transformComponentContainerMapChangeToDiff")(i.getComponentsMap(),a);g.setLocalDiffFromCollabri(d("UEDiffUtils").appendDiffChanges(b,e))}else{e=(b=g.getRemoteDiffFromCollabri())!=null?b:c("UEDiff").createEmptyDiff().createCollabriDiff();b=c("transformComponentContainerMapChangeToDiff")(i.getComponentsMap(),a);g.setRemoteDiffFromCollabri(d("UEDiffUtils").appendDiffChanges(e,b))}});return i}b.dispose=function(){a.prototype.dispose.call(this)};return e}(c("UECollabriObjectNodeController"));g["default"]=a}),98);
__d("transformComponentContainerMapChangeToDiff",["UEDiff","UEHeadlessUtils","UEImage"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b){var e=c("UEDiff").createEmptyDiff().createCollabriDiff();b.forEach(function(b,f){switch(b.action){case"add":b=d("UEHeadlessUtils").assertNonNull(a.get(f),"component to be added from collabri cannot be null");b=new(c("UEImage"))(b);b={component:b,componentID:f,type:"INSERT_COMPONENT"};e.pushChanges({atomicChange:b});break;case"update":b=d("UEHeadlessUtils").assertNonNull(a.get(f),"component to be added from collabri cannot be null");for(var g in b){var h=!1;g==="mediaID"&&(h=!0);h={componentID:f,key:g,shouldFetchComponent:h,type:"UPDATE_COMPONENT",value:b[g]};e.pushChanges({atomicChange:h})}break;case"delete":h={componentID:f,type:"REMOVE_COMPONENT"};e.pushChanges({atomicChange:h})}});e.setIsFromCollabri(!0);return e}g["default"]=a}),98);
__d("UECollabUndoManager",["UEAtomicChangeUtils","UEDiffUtils","yjs"],(function(a,b,c,d,e,f,g){"use strict";a=function(){function a(a,b,c){this.$1=new(d("yjs").UndoManager)(a.getRaw(),{captureTimeout:c,trackedOrigins:b}),this.$2="UE_NO_TYPING"}var b=a.prototype;b.willRunDiff=function(a){if(a.getCollabriOrigin()==="remote")return;var b=!1;this.$2==="UE_NO_TYPING"&&(b=!0);var c=d("UEDiffUtils").isTypingDiff(a);if(c===!1){this.stopCoalescing();this.$2="UE_NO_TYPING";return}c=d("UEDiffUtils").getTypingEventAtomicChange(a);if(c!=null){var e=this.$2;c=d("UEAtomicChangeUtils").getTypingDirectionFromAtomicChange(c);e!==c&&(b=!0);this.$2=c}else this.$2="UE_NO_TYPING";a.isEnter()&&(b=!0);b&&this.stopCoalescing()};b.runUndo=function(){this.$1.undo()};b.runRedo=function(){this.$1.redo()};b.clear=function(){this.$1.clear()};b.stopCoalescing=function(){this.$1.stopCapturing()};return a}();g["default"]=a}),98);
__d("UEObjectNode",["fbt","UEDocumentNode","UEHeadlessUtils","UENodeUtils","UERootNode","unrecoverableViolation","uuidv4"],(function(a,b,c,d,e,f,g,h){"use strict";a=function(){var a=b.prototype;a.setID_DO_NOT_USE=function(a){this.$2=a;return this};a.getID=function(){return this.$2};a.getNodeType=function(){return this.$1};a.getStyleSheet=function(){return this.getDocumentEnforce().getStyleSheet()};a.getDocumentEnforce=function(){return d("UEHeadlessUtils").assertNonNull(this.getDocument(),"document node should not be null")};a.getRootEnforce=function(){return d("UEHeadlessUtils").assertNonNull(this.getRoot(),"root node should not be null")};a.getDocument=function(){var a=null,b=this;do{var d;if(b instanceof c("UEDocumentNode")){a=b;break}if(b instanceof c("UERootNode")){a=b.getDocument();break}}while(b=(d=b)==null?void 0:d.getParent());return a};a.getRoot=function(){var a=null,b=this;do{var d;if(b instanceof c("UERootNode")){a=b;break}}while(b=(d=b)==null?void 0:d.getParent());return a};a.getComponentContainer=function(){return this.getDocumentEnforce().getComponentContainer()};a.setParent=function(a){this.$5=a;return this};a.addChildAtIdx=function(a,b){return d("UENodeUtils").addChildAtIdxUtil(this.$4,a,b)};a.appendChild=function(a){return d("UENodeUtils").appendChildUtil(this.$4,a)};a.findChildIdx=function(a){return this.getChildren().findIndex(function(b){return b.getID()===a})};a.next=function(){var a=this.getParent();if(a==null)return null;var b=a.findChildIdx(this.getID());return a.getChildAtIdx(b+1)};a.prev=function(){var a=this.getParent();if(a==null)return null;var b=a.findChildIdx(this.getID());return a.getChildAtIdx(b-1)};a.findChildIdxEnforce=function(a){var b=this.findChildIdx(a);if(b===-1)throw c("unrecoverableViolation")(a+" is not a child of this node","unified_editor");return b};a.cloneNodeBase=function(a,b){a==="WITH_SAME_ID"&&(b.$2=this.getID());b.setProperties_DO_NOT_USE(d("UENodeUtils").clonePropertise(this.getProperties_DO_NOT_USE(),a));d("UENodeUtils").getNodesInProperties(b).forEach(function(a){a.setParent(b)});this.getChildren().forEach(function(c){c=c.clone(a);b.appendChild(c);c.setParent(b)});return b};a.clone=function(a){throw c("unrecoverableViolation")("clone function not implemented","unified_editor")};a.getBasePropsForClone=function(a){return{id:a==="WITH_SAME_ID"?this.getID():c("uuidv4")(),props:d("UENodeUtils").clonePropertise(this.getProperties_DO_NOT_USE(),a)}};a.beforeCloneBaseForSelection=function(a,b,c){return c};a.afterCloneBaseForSelection=function(a,b,c){return c};a.cloneForSelectionBase=function(a,b,e,f){var g=this;this.beforeCloneBaseForSelection(a,b,e);if(b.length===0)throw c("unrecoverableViolation")("unexpected empty selection in cloneForSelection","unified_editor");var h=b[0],i=b.slice(1);if(h.length!==1)throw c("unrecoverableViolation")("unexpected amount of selection layer to clone","unified_editor");h=h[0];if(a==="WITH_SAME_ID"&&this.getID()!==h.id)throw c("unrecoverableViolation")("selection id "+h.id+" does not match the node to clone "+this.getID(),"unified_editor");e.$2=a==="WITH_SAME_ID"?this.getID():c("uuidv4")();e.setParent(f);e.setProperties_DO_NOT_USE(d("UENodeUtils").clonePropertise(this.getProperties_DO_NOT_USE(),a));d("UENodeUtils").getNodesInProperties(e).forEach(function(a){a.setParent(e)});i.length>=1?i[0].forEach(function(b){var c=b.id;c=d("UENodeUtils").findNodeByIDInPropertiesAndChildren(g,c);b=i.length===1?[[b]]:i;c=c.cloneForSelection(a,b,e);e.appendChild(c)}):this.getChildren().forEach(function(b){b=b.clone(a);e.appendChild(b);b.setParent(e)});this.afterCloneBaseForSelection(a,b,e);return e};a.cloneForSelection=function(a,b,d){throw c("unrecoverableViolation")("cloneForSelection function not implemented","unified_editor")};a.getChildIndex_EXPENSIVE=function(a){var b=this.getChildren().findIndex(function(b){return b.getID()===a.getID()});return b>=0?b:null};a.getPropertyValueAsString=function(a){a=this.getPropertyValue(a);if(a==null)return null;if(a.type==="string")return a.value;throw c("unrecoverableViolation")("error type when getting property","unified_editor")};a.getPropertyValueAsBoolean=function(a){a=this.getPropertyValue(a);if(a==null)return null;if(a.type==="boolean")return a.value;throw c("unrecoverableViolation")("error type when getting property","unified_editor")};a.getPropertyValueAsNumber=function(a){a=this.getPropertyValue(a);if(a==null)return null;if(a.type==="number")return a.value;throw c("unrecoverableViolation")("error type when getting property","unified_editor")};a.getPropertyValueAsNode=function(a){a=this.getPropertyValue(a);if(a==null)return null;if(a.type==="node")return a.value;throw c("unrecoverableViolation")("error type when getting property","unified_editor")};a.getPropertyValueAsNodeOfType=function(a,b){a=this.getPropertyValueAsNode(a);return a===null?null:d("UEHeadlessUtils").assertToNodeOfType(a,b)};a.getPropertyValueAsArrayString=function(a){a=this.getPropertyValue(a);if(a==null)return null;if(a.type==="array_string")return a.value;throw c("unrecoverableViolation")("error type when getting property","unified_editor")};a.getPropertyValueAsArrayBoolean=function(a){a=this.getPropertyValue(a);if(a==null)return null;if(a.type==="array_boolean")return a.value;throw c("unrecoverableViolation")("error type when getting property","unified_editor")};a.getPropertyValueAsArrayNumber=function(a){a=this.getPropertyValue(a);if(a==null)return null;if(a.type==="array_number")return a.value;throw c("unrecoverableViolation")("error type when getting property","unified_editor")};a.getPropertyValueAsArrayNode=function(a){a=this.getPropertyValue(a);if(a==null)return null;if(a.type==="array_node")return a.value;throw c("unrecoverableViolation")("error type when getting property","unified_editor")};a.getPropertyValue=function(a){var b=this.$3.get(a);b==null&&(b=this.constructor.SUPPORTED_PROPERTIES_KEYS_DEFAULTS.get(a));return(a=b)!=null?a:null};a.getSupportedPropertiesKeys=function(){return Array.from(this.getSupportedPropertiesKeysAndDefaults().keys())};a.getSupportedPropertiesKeysAndDefaults=function(){return this.constructor.SUPPORTED_PROPERTIES_KEYS_DEFAULTS};a.getProperties_DO_NOT_USE=function(){return this.$3};a.setProperties_DO_NOT_USE=function(a){this.$3=a};a.setPropertyValueForKey=function(a,b){if(!this.getSupportedPropertiesKeysAndDefaults().has(b))throw c("unrecoverableViolation")("cannot set property due to unsupported key","unified_editor");this.$3.set(b,a)};a.isValid=function(){return this.getChildren().reduce(function(a,b){return a&&b.isValid()},!0)};a.onAddedToDocument=function(a){this.getChildren().forEach(function(b){return b.onAddedToDocument(a)})};a.onWillRemoveFromDocument=function(a){this.getChildren().forEach(function(b){return b.onWillRemoveFromDocument(a)})};a.toRDFBJsonBase=function(){return{children:this.getChildren().map(function(a){return a.toRDFBJson()}),id:this.getID(),properties:d("UENodeUtils").serializePropertiesToRDFBJson(this.getProperties_DO_NOT_USE()),type:this.getNodeType()}};a.toRDFBJson=function(){throw c("unrecoverableViolation")("you have to implement toRDFBJson method for UEObjectNode","unified_editor")};a.toRDFBJsonString=function(){return JSON.stringify(this.toRDFBJson())};b.constructFromJSON=function(a,b,d,e){throw c("unrecoverableViolation")("you have to implement constructFromJSON method for UEObjectNode","unified_editor")};b.createFromRDFBJson=function(a,b,e){var f=d("UENodeUtils").deserializeRDFBJsonToProperties(a.properties,b,e),g=this.constructFromJSON(a,b,e,{id:a.id,props:f});if(a.type!==g.getNodeType())throw c("unrecoverableViolation")(a.type+" can not be parsed as "+g.getNodeType(),"unified_editor");a.children.forEach(function(a){a=d("UENodeUtils").createNodeFromRDFB(a,b,e);g.appendChild(a);a.setParent(g)});d("UENodeUtils").getNodesInProperties(g).forEach(function(a){a.setParent(g)});return g};b.createFromRDFBJsonString=function(a,b,c){a=JSON.parse(a);return this.createFromRDFBJson(a,b,c)};a.getPathFromDocumentNode=function(){if(this instanceof c("UERootNode"))throw c("unrecoverableViolation")("Node above document node should not call this method","unified_editor");if(this instanceof c("UEDocumentNode"))return[this.getID()];var a=this.getParentEnforce().getPathFromDocumentNode();a.push(this.getID());return a};a.onWillModify=function(a){var b=a.getRootEnforce();if(b.isWritingLocked()===!1)throw c("unrecoverableViolation")("cannot modify cache without aquiring the write lock","unified_editor");if(b.isCacheNodeOrAncestorDirty(a)===!1&&this.isEqual(a,"SHOULD_CHECK_ID")===!1)throw c("unrecoverableViolation")("cache "+a.constructor.name+" and data model are not the same","unified_editor");a=this.getRootEnforce();if(a.isWritingLocked()===!1)throw c("unrecoverableViolation")("cannot modify model without aquiring the write lock","unified_editor");b.onWillModifyNode(this)};a.isEqualBase=function(a,b){if(this.constructor!==a.constructor)return!1;if(b==="SHOULD_CHECK_ID"&&a.getID()!==this.getID())return!1;if(d("UENodeUtils").arePropertiesEqual(this.getProperties_DO_NOT_USE(),a.getProperties_DO_NOT_USE(),b)===!1)return!1;var c=this.getChildren();a=a.getChildren();if(c.length!==a.length)return!1;for(var e=0;e1)throw c("unrecoverableViolation")("failed to change read lock to write since more than 1 places were reading","unified_editor");this.releaseReadingLock();this.$UERootNode$p_3=!0;return!0};b.convertWriteLockToRead=function(){if(this.$UERootNode$p_3===!1)throw c("unrecoverableViolation")("failed to change write lock to read since write lock was not taken","unified_editor");if(this.$UERootNode$p_4!==0)throw c("unrecoverableViolation")("failed to change write lock to read since reading lock was unexpected take while writing","unified_editor");this.$UERootNode$p_3=!1;this.aquireReadingLock()};b.isWritingLocked=function(){return this.$UERootNode$p_3};b.aquireReadingLock=function(){if(this.$UERootNode$p_3===!0)throw c("unrecoverableViolation")("failed to aquire read lock since writing lock was taken","unified_editor");this.$UERootNode$p_4++;return!0};b.releaseReadingLock=function(){if(this.$UERootNode$p_3===!0)throw c("unrecoverableViolation")("unexpected writing lock untaken when releasing the reading lock","unified_editor");if(this.$UERootNode$p_4===0)throw c("unrecoverableViolation")("no read lock was taken, unable to unlock","unified_editor");this.$UERootNode$p_4>0&&this.$UERootNode$p_4--};b.isReadingLocked=function(){return this.$UERootNode$p_4>0};b.onWillModifyNode=function(a){if(this.isCache===!1)throw c("unrecoverableViolation")("onWillModifyNode can be called only if it is cache","unified_editor");if(a instanceof c("UEStyleSheetNode")){this.$UERootNode$p_6=!0;return}if(a instanceof d("UEComponentContainerNode").UEComponentContainerNode){this.$UERootNode$p_7=!0;return}a=a.getPathFromDocumentNode();if(this.$UERootNode$p_5==null){this.$UERootNode$p_5=a;return}var b=0;while(ba.length?!1:c("shallowArrayEqual")(this.$UERootNode$p_5,a.splice(0,this.$UERootNode$p_5.length))};b.updateCacheDirtyFromModel=function(a,b,e){if(this.isCache===!1)throw c("unrecoverableViolation")("update cache can be called only if it is cache","unified_editor");if(this.$UERootNode$p_6){var f=a.getDocument().getStyleSheet();f=f.clone("WITH_SAME_ID");var g=this.getDocument();g.setStyleSheet_DO_NOT_USE(f);f.setParent(g);e[f.getID()]=f;this.$UERootNode$p_6=!1}if(this.$UERootNode$p_7){g=a.getDocument().getComponentContainer();f=g.clone("WITH_SAME_ID");a=this.getDocument();a.setComponentContainer_DO_NOT_USE(f);f.setParent(a);e[f.getID()]=f;this.$UERootNode$p_7=!1}if(this.$UERootNode$p_5==null||this.$UERootNode$p_5.length===0)return;var h=this.$UERootNode$p_5[this.$UERootNode$p_5.length-1];g=b[h];a=g.clone("WITH_SAME_ID");f=e[h];b=f.getParentEnforce();g=b.getChildren().findIndex(function(a){return a.getID()===h});b.removeChildAtIdx(g);b.addChildAtIdx(a,g);a.setParent(b);d("UEModelStorageUtils").deleteFromNodeByKey(e,h);d("UEModelStorageUtils").appendToNodeByKey(e,a);this.$UERootNode$p_5=null};b.isEqual=function(a,b){if(!(a instanceof e))throw c("unrecoverableViolation")("cannot compare UEStyleSheetNode with other node","unified_editor");return this.isEqualBase(a,b)&&this.getDocument().isEqual(a.getDocument(),b)};b.createLayout=function(){return{childKeys:[],document:this.getDocument().getID(),isVisual:!1,model:this,parentKey:this.getID(),type:"root",viewModel:this.getViewModel().getID()}};function e(b){var c=b.document,d=b.viewModel;b=babelHelpers.objectWithoutPropertiesLoose(b,["document","viewModel"]);b=a.call(this,"ROOT",b)||this;b.isCache=!1;b.$UERootNode$p_3=!1;b.$UERootNode$p_4=0;b.$UERootNode$p_6=!1;b.$UERootNode$p_7=!1;b.$UERootNode$p_1=c;b.$UERootNode$p_2=d;b.$UERootNode$p_1.setParent(babelHelpers.assertThisInitialized(b));(c=b.$UERootNode$p_2)==null?void 0:c.setParent(babelHelpers.assertThisInitialized(b));return b}return e}(c("UEObjectNode"));g["default"]=a}),98);
__d("UESelectionEventConverter",["unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";function a(a){var b,d=a.type;a=babelHelpers.objectWithoutPropertiesLoose(a,["type"]);switch(d){case"SINGLE_CLICK":b={payload:babelHelpers["extends"]({type:"node"},a),type:"SINGLE_SELECT"};break;case"CTRL_CMD_SINGLE_CLICK":b={payload:babelHelpers["extends"]({type:"node"},a),type:"MULTI_SELECT"};break;case"SHIFT_SINGLE_CLICK":b={payload:babelHelpers["extends"]({type:"node"},a),type:"EXPAND_SELECT"};break;case"CTRL_CMD_A":b={payload:babelHelpers["extends"]({type:"node"},a),type:"SELECT_ALL_CHILDREN"};break;case"DRAG_SELECT":b={payload:babelHelpers["extends"]({type:"node"},a),type:"MULTI_SELECT"};break;case"DRAG_DESELECT":b={payload:babelHelpers["extends"]({type:"node"},a),type:"SINGLE_DESELECT"};break;case"TAB":b={payload:babelHelpers["extends"]({type:"node"},a),type:"SELECT_NEXT_ON_LAYER"};break;case"SHIFT_TAB":b={payload:babelHelpers["extends"]({type:"node"},a),type:"SELECT_PREVIOUS_ON_LAYER"};break;case"HOST_EDITOR_SELECT":b={payload:babelHelpers["extends"]({type:"node"},a),type:"UPDATE_RICH_TEXT_SELECTION"};break;case"ESCAPE":b={payload:babelHelpers["extends"]({type:"node"},a),type:"SELECT_PARENT"};break;case"ENTER":b={payload:babelHelpers["extends"]({type:"node"},a),type:"SELECT_FIRST_CHILD"};break;default:throw c("unrecoverableViolation")("Unsupported react gesture "+d,"unified_editor")}return b}function h(a){return{payload:{selectionState:a,type:"state"},type:"SELECT_GIVEN_STATE"}}function b(a){if(a.length<2)throw c("unrecoverableViolation")("Expected selection to contain document and section, but z-length was less than 2","unified_editor");a=a.slice(0,a.length-1);return h(a)}g.convertToUESelectionEvent=a;g.createSelectionEventFromState=h;g.createSelectionEventToClearSelectionFromState=b}),98);
__d("UEDeletionMutator",["UELayoutMutator","UEModelStorage","UESelectionEventConverter","UESelectionMutator","UEUndoRedoUtils","createDeletionDiffForSelection"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b,e,f){var g=d("UEModelStorage").getSelectionNodeInDocument(a).getState();if(g.length<3)return null;var h=d("UEModelStorage").getDocumentModel(a).modelNodeByKey;h=c("createDeletionDiffForSelection")(h,g,d("UEUndoRedoUtils").UEUndoCapability.UNDOABLE);h=b.handleDiff(a,h);return d("UELayoutMutator").appendInstructionsToBatch([h,[]],d("UESelectionMutator").mutateSelectionStateForSelectionEvent(a,e,f,d("UESelectionEventConverter").createSelectionEventFromState(g.slice(0,g.length-1)),b.getCollaborationAgent()))}g.mutate=a}),98);
__d("UELayoutMutator",["UEDocumentLayoutUtils","UEHeadlessUtils","UELayoutCalculationUtils","UELayoutUtils","UEModelStorage","UENodeUtils","UESeletionLayoutUtils","unrecoverableViolation","useUERecoilSetup"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b,c,e){var f=d("UEModelStorage").getDocumentModel(a).model.getDocument().getID(),g=new Set();switch(b.type){case"editor-api":d("UELayoutUtils").updateLayout(b.id,e,function(a){return a!=null?babelHelpers["extends"]({},d("UELayoutUtils").assertToRichTextStringLayout(a),{editorAPI:b.editorAPI}):a});return[[],[]];case"search":d("UELayoutUtils").updateLayout(b.id,e,function(a){return a!=null?babelHelpers["extends"]({},d("UELayoutUtils").assertToSearchLayout(a),{isActive:b.isActive}):a});return[[],[]];case"search-criteria":d("UELayoutUtils").updateLayout(b.id,e,function(a){return a!=null?babelHelpers["extends"]({},d("UELayoutUtils").assertToSearchLayout(a),{criteria:babelHelpers["extends"]({},b.criteria)}):a});return[[],[]];case"search-results":d("UELayoutUtils").updateLayout(b.id,e,function(a){return a!=null?babelHelpers["extends"]({},d("UELayoutUtils").assertToSearchLayout(a),{criteria:babelHelpers["extends"]({},b.criteria),results:d("UELayoutUtils").assertToSearchLayout(a).query(babelHelpers["extends"]({},b.target),babelHelpers["extends"]({},b.criteria)),target:babelHelpers["extends"]({},b.target)}):a});return[[],[]];case"search-merge-results":d("UELayoutUtils").updateLayout(b.id,e,function(c){if(c!=null){var e=babelHelpers["extends"]({},d("UELayoutUtils").assertToSearchLayout(c));if(e.isActive)return babelHelpers["extends"]({},d("UELayoutUtils").assertToSearchLayout(c),{results:e.mergeResults(e.results,b.node,e.target,e.criteria,a)})}return c});return[[],[]];case"insertion-style":g=d("UEDocumentLayoutUtils").getInsertionStyles(c,f);c=b.property;g.has(c)?g["delete"](c):g.add(c);d("UEDocumentLayoutUtils").setInsertionStyles(e,f,g);return[[{nodeKey:b.nodeKey,type:"REFRESH_HOST_FOR_INSERTION_STYLES"}],[]]}}function b(a,b){d("UELayoutUtils").updateLayout(a.getID(),b,a.createLayout());var c=a.getDocument();k(b,c,c.getID());c=a.getViewModel();h(b,c)}function h(a,b){var c=b.getID(),e=b.createLayout();d("UELayoutUtils").updateLayout(c,a,e);c=b.getToolbar();e=c.createLayout();d("UELayoutUtils").updateLayout(c.getID(),a,e);c=b.getSearchEnforce();e=c.createLayout();d("UELayoutUtils").updateLayout(c.getID(),a,e)}function e(a,b,c,e,f){var g=d("UEModelStorage").getSelectionNodeInDocument(a).getState();b.forEach(function(a){return i(a,c,e,f,g)})}function i(a,b,e,f,g){var h=a.nodeKey;switch(a.type){case"UPDATE":case"UPDATE_RICH_TEXT_STRING":case"UPDATE_RICH_TEXT_SELECTION":case"CLEAR_RICH_TEXT_SELECTION":case"UPDATE_RICH_TEXT_COLLAB_SELECTION":case"REFRESH_HOST_FOR_INSERTION_STYLES":d("UELayoutUtils").updateLayout(h,e,function(b){b=d("UEHeadlessUtils").assertNonNull(b,"layout for "+h+" "+a.type+"should not be null");return d("UELayoutCalculationUtils").performCalculate(babelHelpers["extends"]({},b),a,g)});break;case"UPDATE_GEOMETRY":d("UELayoutUtils").updateLayout(h,e,function(b){var c=d("UEHeadlessUtils").assertNonNull(b,"layout for "+h+" "+a.type+"should not be null");if(c.isVisual){var e=a.payload.height;return d("UELayoutCalculationUtils").performCalculate(babelHelpers["extends"]({},c,{hint:{height:e,type:"render"}}),a,g)}return b});break;case"RESIZE":d("UELayoutUtils").updateLayout(h,e,function(b){var c=d("UEHeadlessUtils").assertNonNull(b,"layout for "+h+" "+a.type+"should not be null");return c.isVisual?d("UELayoutCalculationUtils").performCalculate(babelHelpers["extends"]({},c,{height:a.payload.height,width:a.payload.width}),a,g):b});break;case"INSERT":var i=a.object,j=i.getParent();if(j==null)throw c("unrecoverableViolation")("object should have a parent set before being added to layout tree - "+i.constructor.name+":"+i.getID(),"knowledge_platform");var m=b(d("useUERecoilSetup").layoutFamilyAtom(j.getID()));if(m==null)throw c("unrecoverableViolation")("layout not found for object - "+j.constructor.name+":"+j.getID(),"knowledge_platform");k(e,i,j.getID());d("UELayoutUtils").insertChildKeyAtIndex(e,j.getID(),i.getID(),a.index);break;case"REMOVE":l(b,e,f,h,!1);break;default:throw c("unrecoverableViolation")("Unhandled layout instruction: "+a.type,"unified_editor")}}function j(a){for(var b=arguments.length,c=new Array(b>1?b-1:0),d=1;d=0){var c=a.childKeys.slice();c.splice(b,1);b=a;return babelHelpers["extends"]({},b,{childKeys:c})}}return a});c(d("useUERecoilSetup").layoutFamilyAtom(e));c(d("useUERecoilSetup").selectionLayoutFamilyAtom(e))}g.handlePropertyUpdate=a;g.createLayoutAndSelectionLayoutTreeForDocument=b;g.mutate=e;g.appendInstructions=j;g.appendInstructionsToBatch=f;g.createAndAppendToLayoutAndSelectionLayoutTree=k}),98);
__d("assertNode",["unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b,d){if(a instanceof b)return a;throw c("unrecoverableViolation")("Expected node [id:"+a.getID()+"] to be of type: "+((b=d)!=null?b:"not specified"),"unified_editor")}g["default"]=a}),98);
__d("UEModelMutator",["UEDiffUtils","UEHeadlessUtils","UELayoutMutator","UEModelStorageUtils","UENodeUtils","UERichTextStringModelMutator","UERichTextStringNode","UESelectionUtils","UEUndoRedoUtils","assertNode","cr:107","gkx","prepareModelForChanges","pushMutatorErrorToast","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b,e){e===void 0&&(e=!1);c("gkx")("409")&&(a.collabriClient!=null&&a.collabriClient.isConnected()===!1&&c("pushMutatorErrorToast")("OFFLINE"));var f=a.cache,g=a.cacheNodeByKey,p=a.model,q=a.modelNodeByKey;e===!1&&(f.convertReadLockToWrite(),p.convertReadLockToWrite());var r=d("UEDiffUtils").createEmptyDiffWithSelections(b.getCurrentSelection(),b.getSelectionForUndo(),b.getSelectionForRedo());r.setCanCoalesce(b.canCoalesce());r.setCoalescingNodeKey(b.getCoalescingNodeKey());var s={inverseDiff:r,layoutInstructions:[]};e===!1&&c("prepareModelForChanges")(b.getChanges(),a);b.getChanges().forEach(function(c){c=c.atomicChange;if(c==null)return;var d=s.inverseDiff.getChanges().length;d=null;switch(c.type){case"UPDATE":s=h(s,a,c);break;case"INSERT":s=i(s,a,c);break;case"REMOVE":s=j(s,a,c);break;case"UPDATE_TEXT_ATTRIBUTE":s=k(s,a,c,b.getCurrentSelection());break;case"REPLACE_TEXT":s=l(s,a,c);break;case"INSERT_COMPONENT":s=m(s,a,c);break;case"REMOVE_COMPONENT":s=n(s,a,c);break;case"UPDATE_COMPONENT":s=o(s,a,c);break}});e===!1&&(f.updateCacheDirtyFromModel(p,q,g),f.convertWriteLockToRead(),p.convertWriteLockToRead());p.getViewModel().markShouldEmitDocumentChanged();return s}function h(a,b,c){var e=a.inverseDiff;a=a.layoutInstructions;var f=b.modelNodeByKey[c.nodeKey].getPropertyValue(c.key),g=c.value,h=(f==null?void 0:f.type)==="node"?f.value.getID():null,i=(g==null?void 0:g.type)==="node"?g.value.getID():null;g=(g==null?void 0:g.type)==="node"?g==null?void 0:g.value:null;var j=null,k=null;h!==i&&(h!=null&&(j=h),g!=null&&(k=g));d("UEModelStorageUtils").updateNode(b,c.nodeKey,c.key,c.value);i=[{nodeKey:c.nodeKey,type:"UPDATE"}];j!=null&&(d("UEModelStorageUtils").deleteFromNodeByKey(b.modelNodeByKey,j),i.push({nodeKey:j,type:"REMOVE"}));if(k!=null){h=d("UEModelStorageUtils").getNode(b,c.nodeKey);k.setParent(h);k.onAddedToDocument(h.getDocumentEnforce());d("UEModelStorageUtils").appendToNodeByKey(b.modelNodeByKey,k);i.push({nodeKey:k.getID(),object:k,type:"INSERT"})}g=d("UEUndoRedoUtils").invertUpdateAtomicChange(c,f);e.pushChanges({atomicChange:g});j=d("UELayoutMutator").appendInstructions.apply(void 0,[a].concat(i));return{inverseDiff:e,layoutInstructions:j}}function i(a,b,e){if(e.value.type==="style"){var f=e.value.value,g=b.model.getStyleSheet();d("UEModelStorageUtils").handleInsertStyle(g,f);return a}if(e.value.type!=="node")throw c("unrecoverableViolation")("Expected node in the atomic change of type INSERT","unified_editor");g=e.value.value;f=e.parentKey;var h=e.index;d("UEModelStorageUtils").addNode(b,g,f,h);b=d("UEUndoRedoUtils").invertInsertAtomicChange(e,g);f=a.inverseDiff;e=a.layoutInstructions;f.pushChanges({atomicChange:b});a=d("UELayoutMutator").appendInstructions(e,{index:h,nodeKey:g.getID(),object:g,type:"INSERT"});return{inverseDiff:f,layoutInstructions:a}}function j(a,b,e){var f=d("UEModelStorageUtils").getNode(b,e.nodeKey);if(f!=null){var g=f.getParent(),h=g==null?void 0:g.getChildIndex_EXPENSIVE(f);if(h==null||g==null){throw c("unrecoverableViolation")("Expected node to be present in parent's children parent: "+((h=g==null?void 0:g.getID())!=null?h:"null")+" id: "+f.getID(),"unified_editor")}h=d("UEUndoRedoUtils").invertRemoveAtomicChange(f,g);d("UEModelStorageUtils").deleteNode(b,e.nodeKey);f=a.inverseDiff;g=a.layoutInstructions;f.pushChanges({atomicChange:h});b=d("UELayoutMutator").appendInstructions(g,{nodeKey:e.nodeKey,type:"REMOVE"});return{inverseDiff:f,layoutInstructions:b}}else return a}function k(a,b,e,f){b=c("assertNode")(d("UEModelStorageUtils").getNode(b,e.nodeKey),c("UERichTextStringNode"),"UERichTextStringNode");var g=e.textRange;return q(d("UERichTextStringModelMutator").mutateRichTextStringForReplacingAttributesOverTextRange(a,b,e.attributeType,e.attribute,g,e.editorData,d("UESelectionUtils").getTextRangeFromSelection(f)),e)}function l(a,b,e){b=c("assertNode")(d("UEModelStorageUtils").getNode(b,e.nodeKey),c("UERichTextStringNode"),"UERichTextStringNode");var f=e.textRange;return q(d("UERichTextStringModelMutator").mutateRichTextStringForTextReplacement(a,b,e.value,f,e.editorData),e)}function m(a,b,c){var e=c.component,f=c.componentID;b=p(b);b.insertComponentWithID(f,e);b=d("UEUndoRedoUtils").invertInsertComponentAtomicChange(c);f=a.inverseDiff;e=a.layoutInstructions;f.pushChanges({atomicChange:b});return{inverseDiff:f,layoutInstructions:e}}function n(a,b,c){var e=c.componentID;b=p(b);b=b.removeComponent(e);e=d("UEUndoRedoUtils").invertRemoveComponentAtomicChange(c,b);c=a.inverseDiff;b=a.layoutInstructions;c.pushChanges({atomicChange:e});return{inverseDiff:c,layoutInstructions:b}}function o(a,b,c){var e=c.componentID,f=c.key,g=c.value,h=p(b);h=h.getComponent(e);var i=h.toRDFBJson();i=i.properties;var j=i[f];f=babelHelpers["extends"]({},i,(i={},i[f]=g,i));h.setProperties_DO_NOT_USE_OUTSIDE_OF_MODEL_MUTATOR(f);g=d("UENodeUtils").findComponentNodeWithID(b.model.getDocument(),e);i=d("UEUndoRedoUtils").invertUpdateComponentAtomicChange(c,j);h=a.inverseDiff;f=a.layoutInstructions;h.pushChanges({atomicChange:i});b=g!=null?d("UELayoutMutator").appendInstructions(f,{nodeKey:g.getID(),type:"UPDATE"}):f;return{inverseDiff:h,layoutInstructions:b}}function p(a){return a.model.getDocument().getComponentContainer()}function q(a,b){var c=a.inverseDiff.getChanges();if(b.shouldSplitInverseDiff===!0&&c.length>0){b=c[c.length-1].atomicChange;((b==null?void 0:b.type)==="REPLACE_TEXT"||(b==null?void 0:b.type)==="UPDATE_TEXT_ATTRIBUTE")&&(b.shouldSplitInverseDiff=!0)}return a}g.applyDiff=a;g.mutateNodeForUpdate=h;g.mutateNodeForInsertion=i;g.mutateNodeForRemoval=j;g.mutateInsertComponent=m;g.mutateRemoveComponent=n;g.mutateUpdateComponent=o}),98);
__d("UEPersistenceMutator",["UEClipboard","UELayoutMutator","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b,e,f,g,h){var i=[[],[]];switch(b.type){case"clipboard":i=d("UELayoutMutator").appendInstructionsToBatch(i,d("UEClipboard").handleClipboardEvent(a,b.event,e,f,g,h));break;default:throw c("unrecoverableViolation")("Unknown serialization event type "+b.type,"unified_editor")}return i}g.handlePersistenceEvent=a}),98);
__d("UESearchMutator",["UESelectionEventConverter","UESelectionMutator"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b,c,e,f){a=d("UESelectionMutator").mutateSelectionStateForSelectionEvent(a,b,c,d("UESelectionEventConverter").createSelectionEventFromState(e),f);return{instructionsBatch:a}}g.mutate=a}),98);
__d("UESelectionLayoutMutator",["UESelectionMutatorUtils","UESeletionLayoutUtils"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b){a.forEach(function(a){return h(a,b)})}function h(a,b){var c=a.nodeKey;switch(a.type){case"UPDATE_SELECTION":d("UESeletionLayoutUtils").updateSelectionLayout(c,b,function(b){return b==null||d("UESelectionMutatorUtils").areLayoutSelectionsSame(b,a.object)?b:babelHelpers["extends"]({},a.object)});break;case"UPDATE_COLLAB_SELECTION":d("UESeletionLayoutUtils").updateSelectionLayout(c,b,function(b){var c;if(b==null)return b;b=babelHelpers["extends"]({},b);b.collabSelections=(c=b.collabSelections)!=null?c:new Set();switch(a.action){case"SELECT":b.collabSelections.add(a.clientID);break;case"DESELECT":b.collabSelections["delete"](a.clientID);break}return b})}}g.mutateSelectionLayouts=a}),98);
__d("UESelectionMutator",["UELayoutMutator","UELayoutUtils","UEModelStorage","UESelectionEventConverter","UESelectionMutatorUtils","getParentModel","unrecoverableViolation","useUERecoilSetup"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b){var c=b.clientID,e=b.selection;b=d("UEModelStorage").getSelectionNodeInDocument(a);a=b.getCollaborativeState(c);b.setCollaborativeState(c,e);var f=b.getPresence(c),g=[],h=[];a!=null&&a.forEach(function(a){return a.forEach(function(a){a.type==="node"?h.push({action:"DESELECT",clientID:c,nodeKey:a.id,presence:f,type:"UPDATE_COLLAB_SELECTION"}):a.type==="text"&&g.push({clientID:c,nodeKey:a.id,presence:f,selection:null,type:"UPDATE_RICH_TEXT_COLLAB_SELECTION"})})});e.forEach(function(a){return a.forEach(function(a){a.type==="node"?h.push({action:"SELECT",clientID:c,nodeKey:a.id,presence:f,type:"UPDATE_COLLAB_SELECTION"}):a.type==="text"&&g.push({clientID:c,nodeKey:a.id,presence:f,selection:e,type:"UPDATE_RICH_TEXT_COLLAB_SELECTION"})})});return[g,h]}function b(a,b){var c=b.event,e=b.presence;b=d("UEModelStorage").getSelectionNodeInDocument(a);c==="LEFT"?b.clearPresence(e):b.setPresence(e);var f=b.getCollaborativeState(e.clientId),g=[],h=[];f==null?void 0:f.forEach(function(a){return a.forEach(function(a){a.type==="node"?h.push({action:"SELECT",clientID:e.clientId,nodeKey:a.id,presence:c!=="LEFT"?e:null,type:"UPDATE_COLLAB_SELECTION"}):a.type==="text"&&g.push({clientID:e.clientId,nodeKey:a.id,presence:c!=="LEFT"?e:null,selection:f,type:"UPDATE_RICH_TEXT_COLLAB_SELECTION"})})});return[g,h]}function e(a,b,c,e,f){b=d("UESelectionEventConverter").convertToUESelectionEvent(b);return h(a,c,e,b,f)}function h(a,b,e,f,g){a=d("UEModelStorage").getSelectionNodeInDocument(a);var h=a.getState(),k;switch(f.payload.type){case"node":k=j(h,b,f.type,f.payload);break;case"state":k=i(h,f.type,f.payload);break;default:throw c("unrecoverableViolation")(f.payload.type+" is not a supported selection mutator action","unified_editor")}a.setState(k.state);g.updateSelection(k.state);e(d("useUERecoilSetup").selectionReadOnlyAtom,function(a){return k.state});return[k.layoutInstructions||[],k.selectionLayoutInstructions]}function i(a,b,c){var e=[],f=[],g=[];switch(b){case"SELECT_GIVEN_STATE":b=d("UESelectionMutatorUtils").doSelectGivenState(a,c);c=b[0];var h=b[1];b=b[2];e=c;f=k.apply(void 0,[f].concat(h));g=d("UELayoutMutator").appendInstructions.apply(void 0,[g].concat(b));break}g=d("UELayoutMutator").appendInstructions.apply(void 0,[g].concat(d("UESelectionMutatorUtils").doClearRichTextHostSelectionByStateChange(a,e)));return{layoutInstructions:g,selectionLayoutInstructions:f,state:e}}function j(a,b,e,f){var g=d("UELayoutUtils").getLayout(b,f.nodeKey).model,h=g.getPathFromDocumentNode(),i=[],j=[],l=[];switch(e){case"SINGLE_SELECT":e=d("UESelectionMutatorUtils").doSingleSelect(h,a,f);var m=e[0],n=e[1];e=e[2];i=m;j=k.apply(void 0,[j].concat(n));l=d("UELayoutMutator").appendInstructions.apply(void 0,[l].concat(e));break;case"SINGLE_DESELECT":m=d("UESelectionMutatorUtils").doSingleDeselect(h,a,f);n=m[0];e=m[1];i=n;j=k.apply(void 0,[j].concat(e));break;case"MULTI_SELECT":m=d("UESelectionMutatorUtils").doMultiSelect(h,a,f);n=m[0];e=m[1];i=n;j=k.apply(void 0,[j].concat(e));break;case"EXPAND_SELECT":m=c("getParentModel")(b,f.nodeKey);n=d("UESelectionMutatorUtils").doExpandSelect(h,m,a,f);e=n[0];m=n[1];i=e;j=k.apply(void 0,[j].concat(m));break;case"SELECT_ALL_CHILDREN":n=d("UESelectionMutatorUtils").doSelectAllChildren(g,a);e=n[0];m=n[1];i=e;j=k.apply(void 0,[j].concat(m));break;case"DESELECT_ALL":n=d("UESelectionMutatorUtils").doDeselectAll(a);e=n[0];m=n[1];i=e;j=k.apply(void 0,[j].concat(m));break;case"SELECT_NEXT_ON_LAYER":n=c("getParentModel")(b,f.nodeKey);e=d("UESelectionMutatorUtils").doSelectNextOrPreviousOnLayer(h,n,a,f,"NEXT");m=e[0];n=e[1];i=m;j=k.apply(void 0,[j].concat(n));break;case"SELECT_PREVIOUS_ON_LAYER":e=c("getParentModel")(b,f.nodeKey);m=d("UESelectionMutatorUtils").doSelectNextOrPreviousOnLayer(h,e,a,f,"PREVIOUS");n=m[0];b=m[1];i=n;j=k.apply(void 0,[j].concat(b));break;case"UPDATE_RICH_TEXT_SELECTION":e=d("UESelectionMutatorUtils").doSelectRichTextString(h,a,f);m=e[0];n=e[1];i=m;j=k.apply(void 0,[j].concat(n));break;case"SELECT_PARENT":b=d("UESelectionMutatorUtils").doSelectParent(h,a,f);e=b[0];m=b[1];i=e;j=k.apply(void 0,[j].concat(m));break;case"SELECT_FIRST_CHILD":n=d("UESelectionMutatorUtils").doSelectFirstChild(h,g,a,f);b=n[0];e=n[1];m=n[2];i=b;j=k.apply(void 0,[j].concat(e));l=d("UELayoutMutator").appendInstructions.apply(void 0,[l].concat(m));break}h=d("UESelectionMutatorUtils").doClearRichTextHostSelectionByStateChange(a,i);l=d("UELayoutMutator").appendInstructions.apply(void 0,[l].concat(h));return{layoutInstructions:l.length>0?l:void 0,selectionLayoutInstructions:j,state:i}}function k(a){for(var b=arguments.length,c=new Array(b>1?b-1:0),d=1;d=(f&&!g?b-Math.max(l.viewportHeight,i):b)||v!==-1&&j>=v)&&(p||(n=m,p=!0));p&&!q&&o.push(e);m=k;m>=l.viewportHeight+b+Math.max(l.viewportHeight,i)&&j>=w&&(q||(q=!0))}});var x=o[o.length-1];u=a.childKeys.findIndex(function(a){return a===x});var y=0;for(u=u+1;ub?nf.viewportHeight?o=q:p+=s+h}q++}r=-1;s=0;q=m.childKeys.length-1;while(r===-1&&q>-1){p=m.childKeys[q];p=d("UEHeadlessUtils").assertNonNull(c(d("useUERecoilSetup").layoutFamilyAtom(p)),"Expected visual object "+p+" to exist");if(p.isVisual){var t=p.hint.height;p.hint.type==="default"&&(t=10*h);s+t+h>f.viewportHeight?r=q+1:s+=t+h}q--}if(n<=o&&n>=r)return;if(n>r){l(b,g-s,c,e,!0,!0);return}m.childKeys.forEach(function(b){var e=d("UEHeadlessUtils").assertNonNull(c(d("useUERecoilSetup").layoutFamilyAtom(b)),"Expected visual object "+b+" to exist");if(e.isVisual){var f=e.hint.height;e.hint.type==="default"&&(f=10*h);i=i+f+h;b===a&&(j=i)}});l(b,j,c,e,!0,!0)}function a(a,b,c){switch(c.type){case"SCROLL":l(c.docNodeKey,c.scrollTop,a,b);break;case"VIEWPORT_HEIGHT_UPDATE":b(d("useUERecoilSetup").documentHeightAtom,function(a){return babelHelpers["extends"]({},a,{viewportHeight:c.height})});break;case"UPDATE_VIRTUALIZATION_VIEW":var e=a(d("useUERecoilSetup").documentHeightAtom);e=e.scrollHeight;l(c.docNodeKey,e,a,b,!1);break;case"SCROLL_TO_SELECTION":e=c.docNodeKey;var f=c.selection;f=d("UESelectionUtils").getFirstVisualObjectID(f,a);if(f===null)break;m(f,e,a,b);break}}g.DEFAULT_MARGIN=h;g.DEFAULT_HEIGHT=i;g.mutateVirtualizationLayout=a}),98);
__d("getCommonAncestorNodeKeyForNodes",["unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";function a(a){if(a.length===0)throw c("unrecoverableViolation")("cannot get common ancestor given empty nodes array","unified_editor");var b=a[0].getPathFromDocumentNode();for(var d=1;d0&&j.length--;var k={leftText:"",matchText:a.getText().substr(j.charIndex,j.length),rightText:"",style:g[i].attribute};j=d("UESelectionUtils").createSelectionFromNode(a,j);e.push({displayText:k,selection:j})}return e}function i(a,b,c,e,f){var g=[],h=a.getText(),i=b;c||(i=i.toLowerCase(),h=h.toLowerCase());b=function(){i=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")};if(!e)b();else try{RegExp(i,"g")}catch(a){b()}f&&(i="\\b"+i+"\\b");c=new RegExp(i,"g");e=h.matchAll(c);for(b=e,f=Array.isArray(b),h=0,b=f?b:b[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){if(f){if(h>=b.length)break;c=b[h++]}else{h=b.next();if(h.done)break;c=h.value}e=c;c={charIndex:e.index,length:e[0].length};e=d("UESearchUtils").getDisplayText(a,e.index,e[0].length);c=d("UESelectionUtils").createSelectionFromNode(a,c);g.push({displayText:e,selection:c})}return g}function j(a){var b=[];if(!a.attributes.has("LINKS"))return[];var c=d("UEHeadlessUtils").assertNonNull(a.attributes.get("LINKS"),"Expected link attributes when looking for search results"),e=c.length;for(var f=0;f0)return"UE_FORWARD_REPLACE";if(a.textRange.length===1&&a.value.length===0)return a.editorData.isDeleteBackward===!0?"UE_BACK_DELETE":"UE_FORWARD_DELETE";return a.textRange.length===0&&a.value.length===1?"UE_FORWARD_INSERT":"UE_NO_TYPING"}function e(a,b,e,f){b=a==="UE_FORWARD_REPLACE"&&b==="UE_FORWARD_DELETE"||a===b;if(b===!1)return!1;switch(a){case"UE_FORWARD_REPLACE":return d("UETextAttributeAndTextRangeUtils").getCharIndexAfterEndOfRange(e.textRange)===f.textRange.charIndex;case"UE_BACK_DELETE":return d("UETextAttributeAndTextRangeUtils").getCharIndexAfterEndOfRange(e.textRange)===f.textRange.charIndex;case"UE_FORWARD_DELETE":return(h||(h=c("areEqual")))(e.textRange,f.textRange)||d("UETextAttributeAndTextRangeUtils").getCharIndexAfterEndOfRange(e.textRange)===f.textRange.charIndex;case"UE_FORWARD_INSERT":return e.value.length===f.value.length&&(h||(h=c("areEqual")))(e.textRange,f.textRange)||d("UETextAttributeAndTextRangeUtils").getCharIndexAfterEndOfRange(f.textRange)+f.value.length===d("UETextAttributeAndTextRangeUtils").getCharIndexAfterEndOfRange(e.textRange);case"UE_NO_TYPING":break}return!1}g.getAsStringFromAtomicChange=a;g.getTypingDirectionFromAtomicChange=b;g.areAtomicChangesDirectionallyLinear=e}),98);
__d("UELayoutCalculationUtils",["UEHeadlessUtils","UESelectionUtils","adjustSuggestedNewTextRangeForRemoteLayoutInstruction","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";a=function(a,b,c){switch(a.type){case"stepper":return h(a,b,c);case"rich-text-string":return i(a,b,c);default:return a}};var h=function(a,b,c){a.count=d("UEHeadlessUtils").assertNonNull(a.model.getPropertyValueAsNumber("COUNT"),"stepper count")*10;return a},i=function(a,b,e){var f=!1,g=a;switch(b.type){case"UPDATE_RICH_TEXT_STRING":b.editorData.isRemote===!0&&d("UESelectionUtils").isNodeSelected(e,b.nodeKey)?(b.suggestedNewTextRange=d("adjustSuggestedNewTextRangeForRemoteLayoutInstruction").adjustSuggestedNewTextRangeForRemoteLayoutInstruction(b,e),f=!0):f=b.editorData.isRemote!==!0&&d("UESelectionUtils").isNodeSelected(e,b.nodeKey);break;case"UPDATE_RICH_TEXT_SELECTION":case"CLEAR_RICH_TEXT_SELECTION":f=!0;break;case"REFRESH_HOST_FOR_INSERTION_STYLES":f=!1;break;case"UPDATE_RICH_TEXT_COLLAB_SELECTION":f=!1;b.selection!=null?g.collabSelections.set(b.clientID,b.selection):g.collabSelections["delete"](b.clientID);b.presence!=null?g.collabPresences.set(b.clientID,b.presence):g.collabPresences["delete"](b.clientID);g=babelHelpers["extends"]({},g);break;default:throw c("unrecoverableViolation")(b.type+" is not a supported rich-text-string instruction","unified_editor")}(e=g.editorAPI)==null?void 0:e.execute(a.model,b,f);return g};g.performCalculate=a}),98);
__d("searchUEDocumentNode",[],(function(a,b,c,d,e,f){"use strict";function a(a,b,c){return[]}f.searchUEDocumentNode=a}),66);
__d("searchUERichTextFrameNode",[],(function(a,b,c,d,e,f){"use strict";function a(a,b,c){return[]}f.searchUERichTextFrameNode=a}),66);
__d("searchUESectionNode",[],(function(a,b,c,d,e,f){"use strict";function a(a,b,c){return[]}f.searchUESectionNode=a}),66);
__d("UESearchUtils",["UEDocumentNode","UELayoutMutator","UEModelStorage","UERichTextFrameNode","UERichTextStringNode","UESectionNode","UESelectionUtils","UEVisualObjectNode","UnicodeUtils","searchUEDocumentNode","searchUERichTextFrameNode","searchUERichTextStringNode","searchUESectionNode","searchUEVisualObjectNode","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";var h;function i(a,b,e){var f=[],g=a.getChildren();g.forEach(function(a){f=f.concat(i(a,b,e))});if(a instanceof c("UEDocumentNode")){g=d("searchUEDocumentNode").searchUEDocumentNode(a,b,e);f=f.concat(g)}else if(a instanceof c("UESectionNode")){g=d("searchUESectionNode").searchUESectionNode(a,b,e);f=f.concat(g)}else if(a instanceof c("UERichTextFrameNode")){g=d("searchUERichTextFrameNode").searchUERichTextFrameNode(a,b,e);f=f.concat(g)}else if(a instanceof c("UERichTextStringNode")){g=d("searchUERichTextStringNode").searchUERichTextStringNode(a,b,e);f=f.concat(g)}else if(a instanceof c("UEVisualObjectNode")){g=d("searchUEVisualObjectNode").searchUEVisualObjectNode(a,b,e);f=f.concat(g)}else throw c("unrecoverableViolation")("search for "+a.getNodeType()+" has not been implemented","unified_editor");return f}function a(a,b,c){a=a.getText();if(a==null||a.length===0)return{leftText:"",matchText:"",rightText:"",style:null};var d=32,e=j(a,b-1,"back",d),f=a.substr(b,c);a=j(a,b+c,"forward",d);return{leftText:e,matchText:f,rightText:a,style:null}}function j(a,b,c,e){switch(c){case"back":c=Math.max(0,b-e+1);var f=a.substr(c,b-c+1),g=f.indexOf(" ");f=c!==0?f.substr(g+1):f;var i=c!==0;i&&((h||(h=d("UnicodeUtils"))).isSurrogatePair(a,c+g)&&(f=f.substr(1)));return f;case"forward":i=Math.min(e,a.length-b);c=a.substr(b,i);g=Math.max(c.lastIndexOf("."),c.lastIndexOf(" "));f=b+i!==a.length?c.substr(0,g+1):c;e=b+i!==a.length;e&&((h||(h=d("UnicodeUtils"))).isSurrogatePair(a,g+b)&&(f=f.substr(0,f.length-1)));return f}}function b(a,b,c,e,f){var g=[],h=i(b,c,e),j=!1,k=Object.keys(d("UEModelStorage").getDocumentModel(f).modelNodeByKey),l=b.getID();a.forEach(function(a){var b=d("UESelectionUtils").getSelectedNodes(a.selection);b=b.length!==0?b[0].id:"";b===l&&!j?(g=g.concat(h),j=!0):!j&&k.indexOf(b)>k.indexOf(l)?(j=!0,g=g.concat(h),g.push(a)):b!==l&&g.push(a)});j||(g=g.concat(h));return g}function e(a,b,e,f){b=d("UESelectionUtils").getSelectedNodes(b.getCurrentSelection());var g=d("UEModelStorage").getSearchNodeInDocument(a).getID(),h=[[],[]];b.forEach(function(b){b=b.id;b=d("UEModelStorage").getNodeInDocument(a,b);b instanceof c("UERichTextStringNode")&&(h=d("UELayoutMutator").appendInstructionsToBatch(h,d("UELayoutMutator").handlePropertyUpdate(a,{id:g,node:b,type:"search-merge-results"},e,f)))});return h}g.search=i;g.getDisplayText=a;g.getReadableSubstring=j;g.merge=b;g.updateSearchResults=e}),98);
__d("UESelectionMutatorUtils",["UERichTextStringNode","areEqual","mapMapToArray","shallowEqual","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";var h;function i(a,b,c){b=k(b);var d=b[0];b=b[1];var e=[];for(var f=0;f=c;e--)d.push(a.getChildAtIdx(e).getID());return d}function u(a){return a.map(function(a){return a.map(function(a){return a})})}function v(a,b){if(a.length===0)return!1;a=a[a.length-1].findIndex(function(a){return a.id===b});return a!==-1}function w(a,b){if(a.length===0)return a;var d=a[a.length-1],e=d.findIndex(function(a){return a.id===b});if(e===-1)throw c("unrecoverableViolation")("node was not selected as expect","unified_editor");d.splice(e,1);d.length>=1?a[a.length-1]=d:a.splice(a.length-1,1);return a}function x(a,b){return a.length===b.length?a.slice(0,a.length-1).reduce(function(a,c,d){return a&&c.length===1&&c[0].id===b[d]},!0):!1}function y(a,b){return a.length===b.length-1?a.reduce(function(a,c,d){return a&&c.length===1&&c[0].id===b[d]},!0):!1}function z(a){var b=[];a.forEach(function(a){a.forEach(function(a){b.push({nodeKey:a.id,object:{isSelected:!1,isSelectedAncestor:!1},type:"UPDATE_SELECTION"})})});return b}function A(a,b){return c("shallowEqual")(a,b)}g.doSingleSelect=i;g.doSelectGivenState=a;g.doSingleDeselect=b;g.doMultiSelect=d;g.doExpandSelect=e;g.doSelectAllChildren=f;g.doDeselectAll=k;g.doSelectNextOrPreviousOnLayer=l;g.doSelectRichTextString=m;g.doSelectParent=n;g.doSelectFirstChild=o;g.doClearRichTextHostSelectionByStateChange=p;g.areLayoutSelectionsSame=A}),98);
__d("UESelectionUtils",["UEHeadlessUtils","UEModelStorage","UENodeUtils","UERichTextFrameNode","UERichTextStringNode","UESelectionEventConverter","UESelectionMutator","unrecoverableViolation","useUERecoilSetup"],(function(a,b,c,d,e,f,g){"use strict";function h(a){if(a.length===0)return null;a=a[a.length-1];if(a.length!==1)return null;if(u(a)){a=a[0];if(a.type!=="text")throw c("unrecoverableViolation")("node type has to be text","unified_editor");return a}return null}function a(a,b){if(!k(b))throw c("unrecoverableViolation")("Provided selection that is not inline","unified_editor");a=i(a,b);if(a.length!==1)throw c("unrecoverableViolation")("Inline selection should return only one selected node","unified_editor");return d("UEHeadlessUtils").assertToNodeOfType(a[0],c("UERichTextStringNode"))}function i(a,b){if(b.length===0)throw c("unrecoverableViolation")("Provided empty selection","unified_editor");var d=b[0];if(d.length!==1)throw c("unrecoverableViolation")("Provided invalid selection, should start with document node","unified_editor");d=d[0];if(a.getID()!==d.id)throw c("unrecoverableViolation")("Selection does not match document ID","unified_editor");return j(a,b.slice(1))}function j(a,b){var e=b.length;if(e===0)throw c("unrecoverableViolation")("Provided empty selection","unified_editor");var f=b[0];if(e===1)return Array.from(a.getChildren()).filter(function(a){return f.some(function(b){return b.id===a.getID()})});if(f.length!==1)throw c("unrecoverableViolation")("Multiple nodes in selection layer, but not last selection layer","unified_editor");var g=f[0];e=a.getChildren();a=d("UENodeUtils").getNodesInProperties(a);e=Array.from(e).concat(a);a=d("UEHeadlessUtils").assertNonNull(e.find(function(a){return a.getID()===g.id}),"Selection node not found in children");return j(a,b.slice(1))}function k(a){return h(a)!=null}function b(a){return(a=h(a))==null?void 0:a.range}function l(a){return a.length>0?a[a.length-1]:[]}function e(a){return l(a).map(function(a){return a.id})}function f(a){return a.length>0?new Map(a[a.length-1].map(function(a){return[a.id,a]})):new Map()}function m(a,b){a=a.flat();var c=null,e=0;while(c===null&&e=3&&a[2].length>0}function x(a,b){var e=a.getChildAtIdx(0),f=d("UEHeadlessUtils").assertToNodeOfType(e.getChildAtIdx(0),c("UERichTextFrameNode")),g=f.getContent();return[[{id:a.getID(),type:"node"}],[{id:e.getID(),type:"node"}],[{id:f.getID(),type:"node"}],[{id:g.getID(),range:b,type:"text"}]]}function y(a,b){return a.some(function(a){return a.some(function(a){return a.id===b})})}g.getInlineSelection=h;g.getRichTextStringFromInlineSelection=a;g.getSelectedObjectNodes=i;g.isSelectionInline=k;g.getTextRangeFromSelection=b;g.getSelectedNodes=l;g.getSelectedIDs=e;g.getSelectedNodeByID=f;g.getFirstVisualObjectID=m;g.getMostSpecificSectionID=n;g.getSelectedRichTextFrameIDForInlineSelection=o;g.isNodeSelected=p;g.createSelectionFromNodes=q;g.createSelectionFromNode=r;g.assertToSelectedRichTextNode=s;g.createScrollEventWithSelection=t;g.isSelectionLayerText=u;g.createSelectionSetter=v;g.hasVisualObjectsInSelection=w;g.createInlineSelectionForSingleRTFDocument=x;g.isNodeOnSelectionPath=y}),98);
__d("UEDiffUtils",["UEAtomicChangeUtils","UEDiff"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b,d){return c("UEDiff").createEmptyDiff().setCurrentSelection(a).setSelectionForUndo(b).setSelectionForRedo(d)}function b(a){a=a.getChanges();return a.length>0?a[a.length-1]:null}function e(a,b,c,d,e){a=a.pushChanges.apply(a,b.map(function(a){return{atomicChange:a}}));c!=null&&a.setCurrentSelection(c);d!=null&&a.setSelectionForUndo(d);e!=null&&a.setSelectionForRedo(e);return a}function f(a,b){a.pushChanges.apply(a,b.getChanges());return a}function h(a){return a.getChanges().every(function(a){a=a.atomicChange;if(a==null)return!1;return a.type!=="REPLACE_TEXT"&&a.type!=="UPDATE_TEXT_ATTRIBUTE"?!1:a.editorData.isTypingEvent})}function i(a){var b=null,c=a.getChanges().length;for(var d=0;d0:a.canCoalesce()}function l(a){return c("UEDiff").create(a.getChanges(),a.getCurrentSelection(),a.getSelectionForUndo(),a.getSelectionForRedo(),!1,a.getCoalescingNodeKey(),a.getCollabriMetadata(),a.isUndoable())}function m(a){var b=a.getChanges().findIndex(function(a){a=a.atomicChange;if((a==null?void 0:a.type)!=="REPLACE_TEXT"&&(a==null?void 0:a.type)!=="UPDATE_TEXT_ATTRIBUTE")return!1;if(a.shouldSplitInverseDiff===!0){a.shouldSplitInverseDiff=!1;return!0}return!1});return b<0?[a]:[n(a,a.getChanges().slice(b)),n(a,a.getChanges().slice(0,b))]}function n(a,b){return c("UEDiff").create(b,a.getCurrentSelection(),a.getSelectionForUndo(),a.getSelectionForRedo(),!1,a.getCoalescingNodeKey(),a.getCollabriMetadata(),a.isUndoable())}function o(a,b,c){if(b.isEnter()===!1&&k(a)&&k(c)&&a.getCoalescingNodeKey()===c.getCoalescingNodeKey()){b=j(a);if(b==="UE_NO_TYPING")return!1;var e=j(c);if(e==="UE_NO_TYPING")return!1;a=i(a);c=i(c);return a===null||c===null?!1:d("UEAtomicChangeUtils").areAtomicChangesDirectionallyLinear(b,e,a,c)}return!1}g.createEmptyDiffWithSelections=a;g.getLastChange=b;g.appendChanges=e;g.appendDiffChanges=f;g.isTypingDiff=h;g.getTypingEventAtomicChange=i;g.getTypingDirection=j;g.canCoalesceChanges=k;g.createNonCoalesceable=l;g.splitInverseDiff=m;g.canCoalesceWithDiff=o}),98);
__d("createDeletionDiffForSelection",["UEDiff","UEHeadlessUtils","UENodeUtils","UERichTextFrameDiffBuilder","UERichTextFrameNode","UERichTextStringDiffBuilderUtils","UESelectionUtils","UEUndoRedoUtils","updateDiffToDeleteNodes"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b,e,f){e===void 0&&(e=d("UEUndoRedoUtils").UEUndoCapability.UNDOABLE);var g=d("UESelectionUtils").getSelectedNodes(b);if(d("UESelectionUtils").isSelectionInline(b)){f=d("UEHeadlessUtils").assertNonNull(f,"Expected rich text string node to be non-null");var h=d("UESelectionUtils").assertToSelectedRichTextNode(g[0]).range;return d("UERichTextStringDiffBuilderUtils").createDiffToReplaceText(f,h,{isTypingEvent:!1},"",!1)}f=c("UEDiff").create([],b,b,b.slice(0,b.length-1),!1,null,{isCollabri:!1,isFromCollabri:!1,origin:"local"},e===d("UEUndoRedoUtils").UEUndoCapability.UNDOABLE);h=d("UENodeUtils").getPrev(a[g[0].id]);b=d("UENodeUtils").getNext(a[g[g.length-1].id]);h instanceof c("UERichTextFrameNode")&&b instanceof c("UERichTextFrameNode")&&d("UERichTextFrameDiffBuilder").updateDiffForConcatRichTextStringFrames(f,b,h);e=g.reduce(function(b,c){if(c.type==="node"){c=a[c.id];b.push(c)}return b},[]);c("updateDiffToDeleteNodes").apply(void 0,[f].concat(e));return f}g["default"]=a}),98);
__d("updateDiffToDeleteNodes",["UEComponentNode","UERichTextFrameNode"],(function(a,b,c,d,e,f,g){"use strict";function a(a){for(var b=arguments.length,d=new Array(b>1?b-1:0),e=1;e=d.length)break;g=d[f++]}else{f=d.next();if(f.done)break;g=f.value}g=g;var h=b.getPropertyValue(g);if(h!==null&&h.type==="node"&&h.value===a)return g}return null}g["default"]=a}),98);
__d("updateDiffToInsertNodes",["UEComponentNode","UEDiffUtils","UEHeadlessUtils","UENodeUtils","UERichTextFrameNode","UERichTextStringDiffBuilder","UERichTextStringNode","UERichTextStringPersistenceUtils","UESelectionUtils","gkx","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b,e){for(var f=arguments.length,g=new Array(f>3?f-3:0),i=3;i3?n-3:0),p=3;p4?f-4:0),h=4;h3?p-3:0),r=3;r3?p-3:0),r=3;r
=d.length)break;i=d[h++]}else{h=d.next();if(h.done)break;i=h.value}i=i;var j=i[0];i=i[1];j=f.get(j);if(j==null)return!1;if(!i.isEqual(j))return!1}return this.isEqualBase(a,b)};b.toRDFBJson=function(){return babelHelpers["extends"]({},this.toRDFBJsonBase(),{componentMap:Array.from(this.$UEComponentContainerNode$p_1.entries()).map(function(a){var b=a[0];a=a[1];return[b,a.toRDFBJson()]})})};e.constructFromJSON=function(a,b,e,f){b=d("UEHeadlessUtils").assertNonNull(a==null?void 0:a.componentMap,"componentMap is missing in fromRDFBJson");a=new Map(b.map(function(a){var b=a[0];a=a[1];var d=e.get(a.type);return d!=null?[b,new d(a.properties)]:[b,c("UEUnknownComponent").create(a.properties,a.type)]}));return new this(babelHelpers["extends"]({},f,{componentConstructors:e,componentMap:a}))};function e(b){var c=b.componentConstructors,d=b.componentMap;b=babelHelpers.objectWithoutPropertiesLoose(b,["componentConstructors","componentMap"]);b=a.call(this,"COMPONENT-CONTAINER",b)||this;b.$UEComponentContainerNode$p_1=d;b.$UEComponentContainerNode$p_2=c;return b}return e}(c("UEObjectNode"));g.UEComponentContainerNode=a}),98);
__d("UEComponentAPIContext",["FBLogger","react"],(function(a,b,c,d,e,f,g){"use strict";var h;b=h||d("react");e=b.createContext({createDiffToUpdateComponent:a,deleteComponent:a,deleteNode:a,insertComponent:a,insertNode:a,updateComponent:a});function a(){throw c("FBLogger")("unified_editor").mustfixThrow("Must add a UEComponentAPIContextProvider to the tree")}g.UEComponentAPIContext=e}),98);
__d("UEUploadMediaMonitorReducer",[],(function(a,b,c,d,e,f){"use strict";function g(a){a=h(a,"string");return typeof a==="symbol"?a:String(a)}function h(a,b){if(typeof a!=="object"||a===null)return a;var c=a[typeof Symbol==="function"?Symbol.toPrimitive:"@@toPrimitive"];if(c!==void 0){c=c.call(a,b||"default");if(typeof c!=="object")return c;throw new TypeError("@@toPrimitive must return a primitive value.")}return(b==="string"?String:Number)(a)}b={};function a(a,b){switch(b.type){case"begin_video_upload":var c;return babelHelpers["extends"]({},a,(c={},c[b.nodeID]={progress:0,progressState:"uploading",type:"video",uploader:b.uploader},c));case"begin_image_upload":return babelHelpers["extends"]({},a,(c={},c[b.nodeID]={progressState:"uploading",type:"image"},c));case"remove_uploads":var d=a;b.nodeIDs.forEach(function(a){var b=d;b[a];b=babelHelpers.objectWithoutPropertiesLoose(b,[a].map(g));d=b});return d;case"upload_failed":var e;c=b.nodeID;var f=a[c];return babelHelpers["extends"]({},a,(e={},e[c]=babelHelpers["extends"]({},f,{progressState:"failed"}),e));case"video_update_progress":c=a[b.nodeID];f=babelHelpers.objectWithoutPropertiesLoose(a,[b.nodeID].map(g));e=babelHelpers["extends"]({},c,{progress:b.progress});return babelHelpers["extends"]({},f,(c={},c[b.nodeID]=e,c));case"video_cancel_upload":f=a[b.nodeID];e=babelHelpers.objectWithoutPropertiesLoose(a,[b.nodeID].map(g));if(f.type==="image")return babelHelpers["extends"]({},a);f.uploader.cancel(!0);return babelHelpers["extends"]({},e)}return babelHelpers["extends"]({},a)}f.INIT_STATE=b;f.reducerFunction=a}),66);
__d("UEUploadMediaMonitorContext",["UEUploadMediaMonitorReducer","react"],(function(a,b,c,d,e,f,g){"use strict";var h;a=h||d("react");b=a.createContext(d("UEUploadMediaMonitorReducer").INIT_STATE);g["default"]=b}),98);
__d("UEUploadMediaMonitorDispatcherContext",["react"],(function(a,b,c,d,e,f,g){"use strict";var h;a=h||d("react");b=a.createContext(function(a){return void 0});g["default"]=b}),98);
__d("UnifiedEditorVideoPlaceholder.react",["react"],(function(a,b,c,d,e,f,g){"use strict";var h,i=h||d("react");function a(a){a=a.children;return i.jsx("div",{className:"x6s0dn4 x1q0q8m5 x1qhh985 xu3j5b3 xcfux6l x26u7qi xm0m39n x13fuv20 x972fbf x9f619 x78zum5 xdt5ytf x1iyjqo2 xs83m0k x1qughib xat24cr x11i5rnm x1mh8g0r xdj266r x2lwn1j xeuugli x18d9i69 x4uap5 xkhd6sd xexx8yu x1n2onr6 xh8yej3 x1ja2u2z",children:i.jsx("div",{className:"xrg5d16 x1n2onr6 xrlsmeg xh8yej3",children:i.jsx("div",{className:"x6s0dn4 x1b9h4xk xkh9tda x1srrzph xrua2ca x9c3f3a xlya59e x157eodl xpvcztv x1q04ism x178xt8z xm81vs4 xso031l xy80clv x9f619 x78zum5 x16nrsnc xl56j7k xexx8yu x1sxyh0 x18d9i69 xurb0ha x10l6tqk x13vifvy xh8yej3",children:a})})})}a.displayName=a.name+" [from "+f.id+"]";g["default"]=a}),98);
__d("UnifiedEditorVideoError.react",["fbt","TetraText.react","UnifiedEditorVideoPlaceholder.react","react"],(function(a,b,c,d,e,f,g,h){"use strict";var i,j=i||d("react");function a(a){a=a.children;return j.jsx(c("UnifiedEditorVideoPlaceholder.react"),{children:j.jsxs("div",{className:"x6s0dn4 x1q0q8m5 x1qhh985 xu3j5b3 xcfux6l x26u7qi xm0m39n x13fuv20 x972fbf x9f619 x78zum5 xdt5ytf x1iyjqo2 xs83m0k x1qughib xat24cr x11i5rnm x1mh8g0r xdj266r x2lwn1j xeuugli x18d9i69 x4uap5 xkhd6sd xexx8yu x1n2onr6 x1ja2u2z",children:[j.jsx("div",{className:"xod5an3",children:j.jsx(c("TetraText.react"),{color:"secondary",type:"headlineEmphasized3",children:h._("__JHASH__rbsU0qaxfy5__JHASH__")})}),a]})})}a.displayName=a.name+" [from "+f.id+"]";g["default"]=a}),98);
__d("UEVideoUploadPlaceholder.react",["fbt","ix","CometCircleButton.react","CometProgressStepper.react","TetraButton.react","TetraText.react","UEComponentAPIContext","UEUploadMediaMonitorContext","UEUploadMediaMonitorDispatcherContext","UnifiedEditorVideoError.react","fbicon","react"],(function(a,b,c,d,e,f,g,h,i){"use strict";var j,k=j||(j=d("react")),l=j.useContext;function a(a){a=a.layout;var b=a.attachment,e=b.componentID;a=l(c("UEUploadMediaMonitorContext"));a=a[e];var f=l(c("UEUploadMediaMonitorDispatcherContext")),g=l(d("UEComponentAPIContext").UEComponentAPIContext),j=g.deleteComponent;return a==null||a.type!=="video"?k.jsx(c("UnifiedEditorVideoError.react"),{children:k.jsx("div",{children:k.jsx(c("TetraButton.react"),{icon:d("fbicon")._(i("483825"),16),label:"Remove",onPress:function(){return j(b,{referrer:"visual-object"})}})})}):k.jsxs("div",{className:"x6s0dn4 x1q0q8m5 x1qhh985 xu3j5b3 xcfux6l x26u7qi xm0m39n x13fuv20 x972fbf x9f619 x78zum5 xdt5ytf x1iyjqo2 xs83m0k x1m3v4wt xl56j7k xat24cr xkrivgy x1gryazu xdj266r x2lwn1j xeuugli x18d9i69 x4uap5 xkhd6sd xexx8yu x1n2onr6 x3hqpx7 x1ja2u2z",children:[k.jsx(c("TetraText.react"),{type:"body1",children:h._("__JHASH__3SSYeSHi2NG__JHASH__")}),k.jsx("div",{className:"x1qx5ct2 x1e56ztr x1xmf6yo xh8yej3",children:k.jsx(c("CometProgressStepper.react"),{label:"Video Upload Progress",step:a.progress,totalSteps:100})}),a.progress!==100&&k.jsx(c("CometCircleButton.react"),{icon:d("fbicon")._(i("478231"),12),label:h._("__JHASH__9GiGntE_vGo__JHASH__"),onPress:function(){f({nodeID:e,type:"video_cancel_upload"})},size:32})]})}a.displayName=a.name+" [from "+f.id+"]";g["default"]=a}),98);
__d("UEVideo",["fbt","UEComponentBehaviorBase","UEMediaComponentGlimmer.react","UEVideoComponentGlimmer.react","UEVideoUploadPlaceholder.react","refine"],(function(a,b,c,d,e,f,g,h){"use strict";a=function(a){babelHelpers.inheritsLoose(b,a);function b(){return a.apply(this,arguments)||this}var e=b.prototype;e.coerceProperties=function(a){return{isGif:d("refine").assertion(d("refine").nullable(d("refine").bool()),"Property isGif must be a boolean or null")(a.isGif)||!1,loadingState:d("refine").assertion(d("refine").union(d("refine").literal("placeholder"),d("refine").literal("uploading"),d("refine").literal("encoding"),d("refine").literal("ready")),"Property placeholder must be a valid state")(a.loadingState),mediaID:d("refine").assertion(d("refine").nullable(d("refine").string()),"Property mediaID must be a string or null")(a.mediaID)}};e.getLoadingType=function(){var a=this.getProperties();a=a.loadingState;switch(a){case"ready":return{placeholderFallback:c("UEMediaComponentGlimmer.react"),type:"relay"};case"placeholder":return{component:c("UEMediaComponentGlimmer.react"),isPlaceholder:!0,type:"offline"};case"encoding":return{component:c("UEVideoComponentGlimmer.react"),isPlaceholder:!0,type:"offline"};case"uploading":return{component:c("UEVideoUploadPlaceholder.react"),isPlaceholder:!0,type:"offline"}}};e.toHTML=function(){return null};e.toPlainText=function(){return null};e.getAriaLabel=function(){return h._("__JHASH__1LgbmY2E7ea__JHASH__")};return b}(d("UEComponentBehaviorBase").UEComponentBehaviorBase);a.type="VIDEO";g["default"]=a}),98);
__d("UEDocumentNode",["UEComponentContainerNode","UEHeadlessUtils","UENodeUtils","UEObjectNode","UERootNode","UESectionNode","UEStyleSheetNode","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";a=function(a){babelHelpers.inheritsLoose(e,a);e.create=function(a,b,c){c===void 0&&(c="RDFB");return new e(babelHelpers["extends"]({},this.getDefaultBaseConstructorProps(),{componentContainer:b,documentType:c,isLoaded:!1,styleSheet:a}))};var b=e.prototype;b.setParent=function(a){if(a!=null&&!(a instanceof c("UERootNode")))throw c("unrecoverableViolation")("parent of UEDocument has to be UERootNode","unified_editor");this.$UEDocumentNode$p_8=a;return this};b.didLoad=function(){if(this.$UEDocumentNode$p_4)throw c("unrecoverableViolation")("UEDocument is already loaded. Duplicated didLoad() call.","unified_editor");this.getParentEnforce().aquireReadingLock();this.$UEDocumentNode$p_4=!0};b.addChildAtIdx=function(a,b){if(!(a instanceof c("UESectionNode")))throw c("unrecoverableViolation")("Child of UEDocument has to be UESectionNode","unified_editor");return d("UENodeUtils").addChildAtIdxUtil(this.$UEDocumentNode$p_7,a,b)};b.appendChild=function(a){if(!(a instanceof c("UESectionNode")))throw c("unrecoverableViolation")("Child of UEDocument has to be UESectionNode","unified_editor");return d("UENodeUtils").appendChildUtil(this.$UEDocumentNode$p_7,a)};b.getStyleSheet=function(){return this.$UEDocumentNode$p_5};b.setStyleSheet_DO_NOT_USE=function(a){this.$UEDocumentNode$p_5=a;return this};b.getComponentContainer=function(){return this.$UEDocumentNode$p_6};b.setComponentContainer_DO_NOT_USE=function(a){this.$UEDocumentNode$p_6=a;return this};b.getDocumentVersion=function(){return this.$UEDocumentNode$p_1+"."+this.$UEDocumentNode$p_2};b.getDocumentMajorVersion=function(){return this.$UEDocumentNode$p_1};b.getDocumentMinorVersion=function(){return this.$UEDocumentNode$p_2};b.getDocumentType=function(){return this.$UEDocumentNode$p_3};b.isAtVersion=function(a,b,c){return this.getDocumentType()===a&&this.getDocumentMajorVersion()===b&&this.getDocumentMinorVersion()===c};b.clone=function(a){return this.cloneNodeBase(a,new this.constructor(babelHelpers["extends"]({},this.getBasePropsForClone(a),{componentContainer:this.getComponentContainer().clone(a),documentType:this.$UEDocumentNode$p_3,isLoaded:this.$UEDocumentNode$p_4,styleSheet:this.getStyleSheet().clone(a)})))};b.cloneForSelection=function(a,b,d){return this.cloneForSelectionBase(a,b,new this.constructor(babelHelpers["extends"]({},this.getBasePropsForClone(a),{componentContainer:this.getComponentContainer().cloneForSelection(a,b,null),documentType:this.$UEDocumentNode$p_3,isLoaded:this.$UEDocumentNode$p_4,styleSheet:c("UEStyleSheetNode").create(this.getStyleSheet().getAllStyles().filter(function(a){return a.isAnonymousStyle!==!0}))})),d)};b.isEqual=function(a,b){if(!(a instanceof e))throw c("unrecoverableViolation")("cannot compare UEStyleSheetNode with other node","unified_editor");return this.isEqualBase(a,b)&&this.getStyleSheet().isEqual(a.getStyleSheet(),b)&&this.getComponentContainer().isEqual(a.getComponentContainer(),b)&&this.getDocumentType()===a.getDocumentType()&&this.getDocumentMinorVersion()===a.getDocumentMinorVersion()&&this.getDocumentMajorVersion()===a.getDocumentMajorVersion()};b.toRDFBJson=function(){return babelHelpers["extends"]({},this.toRDFBJsonBase(),{componentContainer:this.getComponentContainer().toRDFBJson(),styleSheet:this.getStyleSheet().toRDFBJson()})};e.constructFromJSON=function(a,b,e,f){var g=d("UEHeadlessUtils").assertNonNull(a==null?void 0:a.styleSheet,"stylesheet is missing in fromRDFBJson");g=c("UEStyleSheetNode").createFromRDFBJson(g,b,e);a=d("UEHeadlessUtils").assertNonNull(a==null?void 0:a.componentContainer,"componentContainer is missing in fromRDFBJson");a=d("UEComponentContainerNode").UEComponentContainerNode.createFromRDFBJson(a,b,e);return new this(babelHelpers["extends"]({},f,{componentContainer:a,documentType:"RDFB",isLoaded:!1,styleSheet:g}))};b.updateWithRDFBJSON=function(a,b,c){var d=this;a=e.createFromRDFBJson(a,b,c);this.setID_DO_NOT_USE(a.getID());this.$UEDocumentNode$p_7=a.$UEDocumentNode$p_7;this.$UEDocumentNode$p_7.forEach(function(a){return a.setParent(d)});b=a.getStyleSheet();var f=this.$UEDocumentNode$p_5;f==null?(this.setStyleSheet_DO_NOT_USE(b),b.setParent(this)):(f.setID_DO_NOT_USE(b.getID()),b.getAllStyles().forEach(function(a){f.hasStyle(a.id)===!1&&f.getStylesMap_DO_NOT_USE().set(a.id,a)}));this.$UEDocumentNode$p_6=a.getComponentContainer();this.$UEDocumentNode$p_6.setParent(this)};b.createLayout=function(){return{childKeys:[],insertionStyles:new Set(),isVisual:!1,model:this,parentKey:this.getID(),type:"document"}};function e(b){var c,e=b.componentContainer,f=b.documentType,g=b.isLoaded,h=b.styleSheet;b=babelHelpers.objectWithoutPropertiesLoose(b,["componentContainer","documentType","isLoaded","styleSheet"]);c=a.call(this,"DOCUMENT",b)||this;c.$UEDocumentNode$p_1="1";c.$UEDocumentNode$p_2="0";c.$UEDocumentNode$p_7=[];c.getParent=function(){return c.$UEDocumentNode$p_8};c.getParentEnforce=function(){return d("UEHeadlessUtils").assertNonNull(c.getParent(),"parent node UERootNode should not be null")};c.getChildren=function(){return d("UENodeUtils").getChildrenUtil(c.$UEDocumentNode$p_7)};c.getChildAtIdx=function(a){return d("UENodeUtils").getChildAtIdxUtil(c.$UEDocumentNode$p_7,a)};c.removeChildAtIdx=function(a){return d("UENodeUtils").removeChildAtIdxUtil(c.$UEDocumentNode$p_7,a)};c.removeChildById=function(a){return d("UENodeUtils").removeChildByIdUtil(c.$UEDocumentNode$p_7,a,function(a,b){return a.getID()===b})};c.$UEDocumentNode$p_6=e;c.$UEDocumentNode$p_3=f;c.$UEDocumentNode$p_5=h;c.$UEDocumentNode$p_4=g;h.setParent(babelHelpers.assertThisInitialized(c));e.setParent(babelHelpers.assertThisInitialized(c));return c}return e}(c("UEObjectNode"));g["default"]=a}),98);
__d("UEEmbeddableDocumentNode",["UEObjectNode"],(function(a,b,c,d,e,f,g){"use strict";a=function(a){babelHelpers.inheritsLoose(c,a);c.create=function(){return new c(this.getDefaultBaseConstructorProps())};var b=c.prototype;b.clone=function(a){return this.cloneNodeBase(a,new this.constructor(this.getBasePropsForClone(a)))};function c(b){return a.call(this,"EMBEDDABLE-DOCUMENT",b)||this}return c}(c("UEObjectNode"));g["default"]=a}),98);
__d("UESectionNode",["UEComponentNode","UEDocumentNode","UEHeadlessUtils","UENodeUtils","UEObjectNode","UERichTextFrameNode","UESelectionUtils","UEVisualObjectNode","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";a=function(a){babelHelpers.inheritsLoose(e,a);e.create=function(){return new e(this.getDefaultBaseConstructorProps())};var b=e.prototype;b.setParent=function(a){if(a!=null&&!(a instanceof c("UEDocumentNode")))throw c("unrecoverableViolation")("parent of UESectionNode has to be UEDocumentNode","unified_editor");this.$UESectionNode$p_2=a;return this};b.addChildAtIdx=function(a,b){if(!(a instanceof c("UEVisualObjectNode")))throw c("unrecoverableViolation")("Child of UESectionNode has to be UEVisualObjectNode","unified_editor");return d("UENodeUtils").addChildAtIdxUtil(this.$UESectionNode$p_1,a,b)};b.appendChild=function(a){if(!(a instanceof c("UEVisualObjectNode")))throw c("unrecoverableViolation")("Child of UESectionNode has to be UEVisualObjectNode","unified_editor");return d("UENodeUtils").appendChildUtil(this.$UESectionNode$p_1,a)};b.clone=function(a){return this.cloneNodeBase(a,new this.constructor(this.getBasePropsForClone(a)))};b.cloneForSelection=function(a,b,c){return this.cloneForSelectionBase(a,b,new this.constructor(this.getBasePropsForClone(a)),c)};b.afterCloneBaseForSelection=function(a,b,e){a=e.getChildren();if(d("UESelectionUtils").isSelectionInline(b)&&a.length===1){b=e.getChildAtIdx(0);if(b instanceof c("UEComponentNode")){a=b.getChildren();if(a.length===1){a=b.getChildAtIdx(0);a instanceof c("UERichTextFrameNode")&&(e.removeChildById(b.getID()),e.getComponentContainer().removeComponent(b.getComponentID()),e.appendChild(a),a.setParent(e))}}}return e};b.isEqual=function(a,b){return this.isEqualBase(a,b)};b.toRDFBJson=function(){return this.toRDFBJsonBase()};e.constructFromJSON=function(a,b,c,d){return new this(d)};b.createLayout=function(){return{childKeys:[],childKeysToRender:[],isVisual:!1,model:this,parentKey:this.getParentEnforce().getID(),type:"section"}};function e(b){var c;c=a.call(this,"SECTION",b)||this;c.$UESectionNode$p_1=[];c.getParent=function(){return c.$UESectionNode$p_2};c.getParentEnforce=function(){return d("UEHeadlessUtils").assertNonNull(c.getParent(),"parent node UEDocumentNode should not be null")};c.getChildren=function(){return d("UENodeUtils").getChildrenUtil(c.$UESectionNode$p_1)};c.getChildAtIdx=function(a){return d("UENodeUtils").getChildAtIdxUtil(c.$UESectionNode$p_1,a)};c.removeChildAtIdx=function(a){return d("UENodeUtils").removeChildAtIdxUtil(c.$UESectionNode$p_1,a)};c.removeChildById=function(a){return d("UENodeUtils").removeChildByIdUtil(c.$UESectionNode$p_1,a,function(a,b){return a.getID()===b})};return c}return e}(c("UEObjectNode"));a.SUPPORTED_PROPERTIES_KEYS_DEFAULTS=new Map([["BACKGROUNDFILL",null]]);g["default"]=a}),98);
__d("getInitialDiffForComponentContainer",["UEDiff","UEHeadlessUtils","UEImage"],(function(a,b,c,d,e,f,g){"use strict";function a(a){var b=c("UEDiff").createEmptyDiff().createCollabriDiff();Array.from(a.keys()).forEach(function(e){var f=d("UEHeadlessUtils").assertNonNull(a.get(e),"component to be added from collabri for initial diff cannot be null");f=new(c("UEImage"))(f);f={component:f,componentID:e,type:"INSERT_COMPONENT"};b.pushChanges({atomicChange:f})});b.setIsFromCollabri(!0);return b}g["default"]=a}),98);
__d("UECollabHeadlessUtils",["unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b,d){if(a instanceof b)return a;throw c("unrecoverableViolation")((a=d)!=null?a:"Expected node to be an instance of "+b.prototype.constructor.name,"unified_editor")}function b(a){switch(a){case"ROOT":case"SECTION":case"VIDEO":case"RICH-TEXT-FRAME":case"RICH-TEXT-STRING":case"EMBEDDED-VIDEO":case"HIGHLIGHTED-TEXT":case"DOCUMENT":case"VIEW-MODEL":case"TABLE":case"TABLE-ROW":case"TABLE-COLUMN":case"TABLE-CELL":case"EMBEDDABLE-DOCUMENT":case"SEARCH":case"STYLE-SHEET":case"COMPONENT-CONTAINER":case"STEPPER":case"SELECTION":case"TOOLBAR":case"EVENT-EMITTER":case"COMPONENT":case"__PLACEHOLDER_FOR_TEST__":return a;default:throw c("unrecoverableViolation")(a+" is not a UENodeType","unified_editor")}}g.assertToControllerOfType=a;g.assertToUENodeType=b}),98);
__d("assertToUECollabriContainer",["UECollabHeadlessUtils","UEHeadlessUtils","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";function a(a){if(a==null)throw c("unrecoverableViolation")("failed to assert ue collabri container since container is null","unified_editor");var b=a.get("id");if(typeof b!=="string")throw c("unrecoverableViolation")("failed to assert ue collabri container since id does not exist","unified_editor");var e=a.get("type");if(e==null)throw c("unrecoverableViolation")("failed to assert ue collabri container since type does not exist","unified_editor");a=d("UEHeadlessUtils").assertNonNull(a.get("node"),"failed to assert ue collabri container since node does not exist");return{id:b,node:a,type:d("UECollabHeadlessUtils").assertToUENodeType(e)}}g["default"]=a}),98);
__d("UECollabriDocumentNodeController",["UECollabriObjectNodeController","UECollabriYjsTypes","UEHeadlessUtils","assertToUECollabriContainer","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";a=function(a){babelHelpers.inheritsLoose(e,a);var b=e.prototype;b.getCollabriStyleSheetNode=function(){return this.$UECollabriDocumentNodeController$p_1};b.getCollabriComponentContainerNode=function(){return this.$UECollabriDocumentNodeController$p_2};function e(b,e,f,g,h){b=a.call(this,b,e,f,g,h)||this;g=d("UEHeadlessUtils").assertNonNull(f.get("version"),"cannot get doc version from collabri doc");if(g!==e.getDocumentVersion())throw c("unrecoverableViolation")("cannot load collabri doc to UE since version does not match","unified_editor");h=c("assertToUECollabriContainer")(f.get("styleSheet"));b.$UECollabriDocumentNodeController$p_1=h.node;if(f.get(d("UECollabriYjsTypes").COMPONENT_CONTAINER_NODE)!=null){g=c("assertToUECollabriContainer")(f.get(d("UECollabriYjsTypes").COMPONENT_CONTAINER_NODE));b.$UECollabriDocumentNodeController$p_2=g.node}b.getCollabriNode().observe(function(a){});return b}b.dispose=function(){};return e}(c("UECollabriObjectNodeController"));g["default"]=a}),98);
__d("UECollabriRichTextFrameNodeController",["UECollabriObjectNodeController"],(function(a,b,c,d,e,f,g){"use strict";a=function(a){babelHelpers.inheritsLoose(b,a);function b(b,c,d,e,f){return a.call(this,b,c,d,e,f)||this}return b}(c("UECollabriObjectNodeController"));g["default"]=a}),98);
__d("UECollabriSectionNodeController",["UECollabriObjectNodeController"],(function(a,b,c,d,e,f,g){"use strict";a=function(a){babelHelpers.inheritsLoose(b,a);function b(b,c,d,e,f){return a.call(this,b,c,d,e,f)||this}return b}(c("UECollabriObjectNodeController"));g["default"]=a}),98);
__d("getInitialDiffForDocument",["UECollabriComponentContainerNodeController","UECollabriControllerStorageUtils","UECollabriDocumentNodeController","UECollabriRichTextFrameNodeController","UECollabriRichTextStringNodeController","UECollabriSectionNodeController","UECollabriStyleSheetNodeController","UECollabriYjsTypes","UEDiff","UEModelStorage","UERichTextFrameNode","UERichTextStringNode","UESectionNode","assertToUECollabriContainer"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b,e,f){var g=e.getChildAtIdx(0);g=c("UEDiff").create([{atomicChange:{nodeKey:g.getID(),nodeType:"SECTION",type:"REMOVE"}}],[],[],[],!1,null,{isCollabri:!0,isFromCollabri:!0,origin:"local"});var i=c("assertToUECollabriContainer")(b.getDocumentNodeContainer()),j=new(c("UECollabriDocumentNodeController"))(e.getID(),e,i.node,f,b);d("UECollabriControllerStorageUtils").addCollabriControllerInDocument(a,j);var k=e.getStyleSheet(),l=c("assertToUECollabriContainer")(i.node.get("styleSheet"));h(a,k.getID(),l.id);k=new(c("UECollabriStyleSheetNodeController"))(l.id,k,l.node,f,b);d("UECollabriControllerStorageUtils").addCollabriControllerInDocument(a,k);if(i.node.get(d("UECollabriYjsTypes").COMPONENT_CONTAINER_NODE)!=null){l=e.getComponentContainer();k=c("assertToUECollabriContainer")(i.node.get(d("UECollabriYjsTypes").COMPONENT_CONTAINER_NODE));h(a,l.getID(),k.id);i=new(c("UECollabriComponentContainerNodeController"))(k.id,l,k.node,f,b);d("UECollabriControllerStorageUtils").addCollabriControllerInDocument(a,i)}l=c("assertToUECollabriContainer")(j.getCollabriChildrenArray().get(0));k=c("UESectionNode").create();k.setID_DO_NOT_USE(l.id);i=new(c("UECollabriSectionNodeController"))(l.id,k,l.node,f,b);d("UECollabriControllerStorageUtils").addCollabriControllerInDocument(a,i);j=c("assertToUECollabriContainer")(i.getCollabriChildrenArray().get(0));l=c("UERichTextFrameNode").create();l.setID_DO_NOT_USE(j.id);i=new(c("UECollabriRichTextFrameNodeController"))(j.id,l,j.node,f,b);d("UECollabriControllerStorageUtils").addCollabriControllerInDocument(a,i);j=c("assertToUECollabriContainer")(i.getCollabriChildrenArray().get(0));i=c("UERichTextStringNode").create();i.setID_DO_NOT_USE(j.id);j=new(c("UECollabriRichTextStringNodeController"))(j.id,i,j.node,f,b);d("UECollabriControllerStorageUtils").addCollabriControllerInDocument(a,j);i.setParent(l);l.appendChild(i);l.setParent(k);k.appendChild(l);g.pushChanges({atomicChange:{parentKey:e.getID(),type:"INSERT",value:{type:"node",value:k}}});return g}function h(a,b,c){a=d("UEModelStorage").getDocumentModel(a);var e=a.modelNodeByKey;a=a.cacheNodeByKey;var f=e[b],g=a[b];f.setID_DO_NOT_USE(c);g.setID_DO_NOT_USE(c);e[c]=f;delete e[b];a[c]=g;delete a[b]}g["default"]=a}),98);
__d("getInitialDiffForRichTextString",["gkx","transformChildrenArrayDeltaToDiff","transformDeltaToDiff","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b,d){a=a.toDelta();if(a.length===0)throw c("unrecoverableViolation")("Yjs doc should at least have a paragraph style placeholder","unified_editor");var e=a[0];if(typeof e.insert==="string"&&e.insert.length>1){var f={attributes:babelHelpers["extends"]({},e.attributes),retain:1};e={attributes:babelHelpers["extends"]({},e.attributes),insert:e.insert.substring(1)};a.splice(0,1,f,e)}f=a[0];e={attributes:f.attributes!=null?babelHelpers["extends"]({},f.attributes):void 0,retain:1};a.splice(0,1,e);var g=[];b.forEach(function(a){g.push({insert:{0:a}})});if(c("gkx")("5304")){f=c("transformChildrenArrayDeltaToDiff")(d.getID(),g);e=c("transformDeltaToDiff")(d.getID(),a,!0);return f.appendChanges(e)}else return c("transformDeltaToDiff")(d.getID(),a,!0)}g["default"]=a}),98);
__d("getInitialDiffForStyleSheet",["UEDiff","UEHeadlessUtils"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b){var e=c("UEDiff").createEmptyDiff().createCollabriDiff();Array.from(a.keys()).forEach(function(c){c=d("UEHeadlessUtils").assertNonNull(a.get(c),"style loaded from collabri map cannot be null");c={parentKey:b.getParentEnforce().getID(),type:"INSERT",value:{type:"style",value:c}};e.pushChanges({atomicChange:c})});e.setIsFromCollabri(!0);return e}g["default"]=a}),98);
__d("onCollabriDocLoad",["UECollabHeadlessUtils","UECollabriComponentContainerNodeController","UECollabriControllerStorageUtils","UECollabriRichTextStringNodeController","UECollabriStyleSheetNodeController","UEDiffUtils","UEHeadlessUtils","UERichTextStringNode","adjustChangesOrderForInitialUEDiffFromCollabri","adjustChangesOrderForUEDiffFromCollabri","getInitialDiffForComponentContainer","getInitialDiffForDocument","getInitialDiffForRichTextString","getInitialDiffForStyleSheet","setupCollabCursors","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b,e,f,g,h){var i=c("getInitialDiffForDocument")(a,b,g,e),j=g.getStyleSheet(),k=d("UECollabHeadlessUtils").assertToControllerOfType(d("UECollabriControllerStorageUtils").getCollabriControllerInDocumentEnforce(a,j.getID()),c("UECollabriStyleSheetNodeController"));k=c("getInitialDiffForStyleSheet")(k.getStylesMap(),j);j=i.getChanges()[1].atomicChange;if(j==null||j.type!=="INSERT"||j.value.type!=="node")throw c("unrecoverableViolation")("a new section node should be added in the loading diff","unified_editor");j=d("UEHeadlessUtils").assertToNodeOfType(j.value.value.getChildAtIdx(0).getChildAtIdx(0),c("UERichTextStringNode"));var l=d("UECollabHeadlessUtils").assertToControllerOfType(d("UECollabriControllerStorageUtils").getCollabriControllerInDocumentEnforce(a,j.getID()),c("UECollabriRichTextStringNodeController"));l=c("getInitialDiffForRichTextString")(l.getCollabriText(),l.getCollabriChildren(),j);if(d("UECollabriControllerStorageUtils").getCollabriControllerInDocument(a,g.getComponentContainer().getID())!=null){j=g.getComponentContainer();g=d("UECollabHeadlessUtils").assertToControllerOfType(d("UECollabriControllerStorageUtils").getCollabriControllerInDocumentEnforce(a,j.getID()),c("UECollabriComponentContainerNodeController"));a=c("getInitialDiffForComponentContainer")(g.getComponentsMap());d("UEDiffUtils").appendDiffChanges(i,a)}d("UEDiffUtils").appendDiffChanges(i,k);d("UEDiffUtils").appendDiffChanges(i,l);h({diff:c("adjustChangesOrderForInitialUEDiffFromCollabri")(i),referrer:"collab",type:"diff"});f.onBeforeAllTransactions(function(a){e.setRemoteDiffFromCollabri(null)});f.onAfterAllTransactions(function(a){a=e.getLocalDiffFromCollabri();a!=null&&(a.setCollabriOrigin("local"),e.setLocalDiffFromCollabri(c("adjustChangesOrderForUEDiffFromCollabri")(a)));a=e.getRemoteDiffFromCollabri();a!=null&&(a.setCollabriOrigin("remote"),h({diff:c("adjustChangesOrderForUEDiffFromCollabri")(a),referrer:"collab",type:"diff"}),e.setRemoteDiffFromCollabri(null))});c("setupCollabCursors")(b,f,h)}g["default"]=a}),98);
__d("setupCollabCursors",["UECollabSelectionUtils"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b,c){var e=d("UECollabSelectionUtils").getCollabSelectionMap(b);e.forEach(function(e,f){if(f===a.clientId||e==null)return;e=d("UECollabSelectionUtils").createCollabSelectionFromCollabWireSelection(b,e);c({event:{clientID:f,selection:e},referrer:"collab",type:"collab-selection-update"})});e.observe(function(f){f.changes.keys.forEach(function(f,g){f=e.get(g);if(g===a.clientId||f==null)return;f=d("UECollabSelectionUtils").createCollabSelectionFromCollabWireSelection(b,f);c({event:{clientID:g,selection:f},referrer:"collab",type:"collab-selection-update"})})});var f=function(a){return function(b){return c({event:{event:a,presence:b},referrer:"collab",type:"collab-presence-update"})}};a.presences.forEach(f("JOINED"));a.subscribeToPresenceJoinLeft(f("JOINED"),f("LEFT"));a.subscribeToPresenceUpdate(function(a){return a.forEach(f("UPDATED"))})}g["default"]=a}),98);
__d("updateDiffForComponentNodeMerge",[],(function(a,b,c,d,e,f){"use strict";function a(a,b,c,d){b=b.getComponentID();c=c.getComponent(b);d.hasComponent(b)&&a.pushChanges({atomicChange:{componentID:b,type:"REMOVE_COMPONENT"}});a.pushChanges({atomicChange:{component:c,componentID:b,type:"INSERT_COMPONENT"}})}f["default"]=a}),66);
__d("UEDocumentMergeDiffBuilder",["UEComponentNode","UEDiffUtils","UEHeadlessUtils","UELeanDocumentUtils","UERichTextFrameNode","UERichTextStringDiffBuilder","UERichTextStringUtils","UESelectionUtils","unrecoverableViolation","updateDiffForComponentNodeMerge","updateDiffForNodeMerge","updateDiffForRichTextStringNodeMerge","updateDiffToDeleteNodes"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b,e,f,g,i){i===void 0&&(i=!1);var j=a,k=f,m=b,n=null,o=d("UESelectionUtils").isSelectionInline(f),p=d("UERichTextStringUtils").isSingleRTFDocument(b);if(o&&p)return l(a,b,e,f);i=i&&o&&!p;if(i){o=f.length;p=f.slice(0,o-1);o=d("UEHeadlessUtils").assertNonNull(d("UESelectionUtils").getInlineSelection(f),"Inline selection should not be null");f=o.range;o=p[p.length-1];if(o.length!==1)throw c("unrecoverableViolation")("Expected single inline selection node in selection layer","unified_editor");n=o[0].id;k=p;o=e.cloneForSelection("WITH_DIFFERENT_ID",p,null);m=d("UELeanDocumentUtils").updateLeanDocumentToSplitRTF(b,o,f)}j=h(j,m,e,k,b.getComponentContainer(),e.getComponentContainer(),g);i&&(j=d("UEDiffUtils").appendChanges(a,[{nodeKey:d("UEHeadlessUtils").assertNonNull(n,"Merge selection was inline "),nodeType:"RICH-TEXT-FRAME",type:"REMOVE"}]));return j}function h(a,b,e,f,g,h,l){k(b,e,f);c("updateDiffForNodeMerge")(a,b,e);f=f.slice(1);if(f.length>1)i(a,e,b,f,g,h,l);else if(f.length===1){f=f[0];if(f.length===0)throw c("unrecoverableViolation")("selected nodes in layer cannot be zero","unified_editor");d("UESelectionUtils").isSelectionLayerText(f)===!0?c("updateDiffForRichTextStringNodeMerge")(a,e,b,f):j(a,e,b,f,g,h,l)}return a}function i(a,b,d,e,f,g,i){var j=e[0];if(j.length!==1)throw c("unrecoverableViolation")("ancestor selection layer can only contain one node","unified_editor");j=j[0];b=b.getChildAtIdx(b.findChildIdxEnforce(j.id));j=d.getChildAtIdx(0);h(a,j,b,e,f,g,i)}function j(a,b,d,e,f,g,h){var i;e.forEach(function(d){d=b.findChildIdx(d.id);var e=b.getChildAtIdx(d);if(h==="REPLACE"){var f;i=Math.min(d,(f=i)!=null?f:d);c("updateDiffToDeleteNodes")(a,e)}else{i=Math.max(d+1,(f=i)!=null?f:d+1)}});d.getChildren().forEach(function(d){d instanceof c("UEComponentNode")&&c("updateDiffForComponentNodeMerge")(a,d,f,g),a.pushChanges({atomicChange:{index:i,parentKey:b.getID(),type:"INSERT",value:{type:"node",value:d}}}),i+=1})}function k(a,b,d){if(a.getNodeType()!==b.getNodeType())throw c("unrecoverableViolation")("cannot merge when nodes type are not the same","unified_editor");if(d.length===0)throw c("unrecoverableViolation")("unexpected empty selection in mergeNodesForSelection","unified_editor");a=d[0];if(a.length!==1)throw c("unrecoverableViolation")("unexpected amount of selection layer to merge","unified_editor");d=a[0];if(b.getID()!==d.id)throw c("unrecoverableViolation")("current node and selection does not match in mergeNodesForSelection","unified_editor")}function l(a,b,e,f){var g=d("UEHeadlessUtils").assertNonNull(d("UESelectionUtils").getInlineSelection(f),"Inline selection should not be null");g=g.range;b=b.getChildAtIdx(0);b=d("UEHeadlessUtils").assertToNodeOfType(b.getChildAtIdx(0),c("UERichTextFrameNode"));b=b.getContent();e=d("UESelectionUtils").getRichTextStringFromInlineSelection(e,f);return d("UERichTextStringDiffBuilder").updateDiffForRichTextStringForTextReplacementWithRichTextString(a,b,e,{charIndex:0,length:b.getText().length},g)}g.updateDiffForMergeNodesFromDocumentNodeForSelection=a}),98);
__d("updateDiffForDocumentNodeMerge",["updateDiffForNodeMerge"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b,d){c("updateDiffForNodeMerge")(a,b.getStyleSheet(),d.getStyleSheet()),c("updateDiffForNodeMerge")(a,b.getComponentContainer(),d.getComponentContainer())}g["default"]=a}),98);
__d("updateDiffForStyleSheetNodeMerge",[],(function(a,b,c,d,e,f){"use strict";function a(a,b,c){Array.from(b.getStylesMap_DO_NOT_USE().keys()).forEach(function(d){var e=b.getStyle(d).properties;e=c.findStyleByComparingProperties(e);e==null&&a.pushChanges({atomicChange:{parentKey:c.getDocumentEnforce().getID(),type:"INSERT",value:{type:"style",value:b.getStyle(d)}}})})}f["default"]=a}),66);
__d("updateDiffForNodeMerge",["UEDocumentNode","UEStyleSheetNode","unrecoverableViolation","updateDiffForDocumentNodeMerge","updateDiffForStyleSheetNodeMerge"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b,d){if(b.getNodeType()!==d.getNodeType())throw c("unrecoverableViolation")("cannot merge when property nodes type are not the same","unified_editor");b instanceof c("UEDocumentNode")&&d instanceof c("UEDocumentNode")?c("updateDiffForDocumentNodeMerge")(a,b,d):b instanceof c("UEStyleSheetNode")&&d instanceof c("UEStyleSheetNode")&&c("updateDiffForStyleSheetNodeMerge")(a,b,d)}g["default"]=a}),98);
__d("UEDocumentLayoutUtils",["UELayoutUtils","UEModelStorage"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b){return d("UELayoutUtils").assertToDocumentLayout(d("UELayoutUtils").getLayout(a,b)).insertionStyles}function b(a,b,c){d("UELayoutUtils").updateLayout(b,a,function(a){if(a==null)return;return babelHelpers["extends"]({},d("UELayoutUtils").assertToDocumentLayout(a),{insertionStyles:c})})}function c(a,b){b=d("UEModelStorage").getDocumentModel(b).model.getDocument().getID();d("UELayoutUtils").updateLayout(b,a,function(a){if(a==null)return a;a=d("UELayoutUtils").assertToDocumentLayout(a);return a.insertionStyles.size===0?a:babelHelpers["extends"]({},a,{insertionStyles:new Set()})})}function e(a,b){var c=[];a=a!=null?[a]:[];while(a.length>0){var d=a.shift();b(d)&&c.push(d);a=[].concat(a,d.getChildren())}return c}g.getInsertionStyles=a;g.setInsertionStyles=b;g.clearInsertionStyles=c;g.findAllNodesInTree=e}),98);
__d("UELeanDocumentUtils",["UEComponentNode","UEConverterUtils","UEDiffUtils","UEHeadlessUtils","UEModelStorageUtils","UENodeUtils","UERichTextStringDiffBuilder","UERichTextStringModelMutator","UERichTextStringNode","UERichTextStringUtils","UESelectionUtils","filterNulls","unrecoverableViolation","updateDiffForDocumentNodeMerge","updateDiffToInsertNodes"],(function(a,b,c,d,e,f,g){"use strict";function h(a,b){i(a,b,null)}function i(a,b,e){var f=d("UEConverterUtils").createNodeMapFromLeanDocument(b);a.getChanges().forEach(function(a){a=a.atomicChange;if(a==null)return;switch(a.type){case"INSERT":if(a.value.type==="style"){var g=a.value.value,h=b.getStyleSheet();d("UEModelStorageUtils").handleInsertStyle(h,g);break}if(a.value.type!=="node")throw c("unrecoverableViolation")("Expected node in the atomic change of type INSERT","unified_editor");h=a.value.value;g=a.parentKey;var i=a.index;k(f,h,g,i);break;case"REMOVE":l(f,a);break;case"UPDATE_TEXT_ATTRIBUTE":h=e!=null?e:d("UEHeadlessUtils").assertToNodeOfType(d("UEHeadlessUtils").assertNonNull(f.get(a.nodeKey),"RTS node not found in node map"),c("UERichTextStringNode"));d("UERichTextStringModelMutator").mutateRichTextStringForReplacingAttributesOverTextRange(d("UERichTextStringUtils").createEmptyTextMutationResults(),h,a.attributeType,a.attribute,a.textRange,a.editorData,a.textRange);break;case"REPLACE_TEXT":g=e!=null?e:d("UEHeadlessUtils").assertToNodeOfType(d("UEHeadlessUtils").assertNonNull(f.get(a.nodeKey),"RTS node not found in node map"),c("UERichTextStringNode"));i=a.textRange;d("UERichTextStringModelMutator").mutateRichTextStringForTextReplacement(d("UERichTextStringUtils").createEmptyTextMutationResults(),g,a.value,i,a.editorData);break;case"INSERT_COMPONENT":h=a.component;g=a.componentID;i=b.getComponentContainer();i.insertComponentWithID(g,h);break;default:throw c("unrecoverableViolation")("Atomic change type "+a.type+" not supported by lean document mutator","unified_editor")}})}function a(a,b,e){var f=d("UEDiffUtils").createEmptyDiffWithSelections([],[],[]);e=d("UESelectionUtils").createInlineSelectionForSingleRTFDocument(b,e);f=j(f,a);f=d("updateDiffToInsertNodes").updateDiffToInsertNodes.apply(void 0,[f,b,e].concat(a.getChildAtIdx(0).getChildren()));c("updateDiffForDocumentNodeMerge")(f,a,b);h(f,b);return b}function j(a,b){a=a;var e=b.getComponentContainer();a=d("UEDiffUtils").appendChanges(a,c("filterNulls")(b.getChildAtIdx(0).getChildren().map(function(a){if(a instanceof c("UEComponentNode")){a=a.getComponentID();return{component:e.getComponent(a),componentID:a,type:"INSERT_COMPONENT"}}return null})));return a}function k(a,b,c,e){a=d("UEHeadlessUtils").assertNonNull(a.get(c),"Lean document node not found in node map");e!=null?a.addChildAtIdx(b,e):a.appendChild(b);b.setParent(a);b.onAddedToDocument(a.getDocumentEnforce())}function l(a,b){a=a.get(b.nodeKey);if(a!=null){b=a.getParent();var d=b==null?void 0:b.getChildIndex_EXPENSIVE(a);if(d==null||b==null){throw c("unrecoverableViolation")("Expected node to be present in parent's children parent: "+((d=b==null?void 0:b.getID())!=null?d:"null")+" id: "+a.getID(),"unified_editor")}a.onWillRemoveFromDocument(b.getDocumentEnforce());a.setParent(null);b.removeChildById(a.getID())}}function b(a,b,c){if(d("UESelectionUtils").isSelectionInline(c)){b=d("UESelectionUtils").getRichTextStringFromInlineSelection(b,c);c=b.getParent();b=c==null?void 0:c.getParent();if(b!=null&&((b=b.getPropertyValue("CAPTION"))==null?void 0:b.value)===c){var e=d("UEDiffUtils").createEmptyDiffWithSelections([],[],[]);m(a).forEach(function(a){e=d("UERichTextStringDiffBuilder").updateDiffForRichTextStringForReplacingAttributesOverTextRange(e,a,"PARAGRAPH_STYLES","caption",{charIndex:0,length:a.getText().length},{isTypingEvent:!1})});h(e,a)}}return a}function m(a){var b=[],e=function a(e){e instanceof c("UERichTextStringNode")?b.push(e):e instanceof c("UEComponentNode")?d("UENodeUtils").getNodesInProperties(e).forEach(a):e.getChildren().forEach(a)};e(a);return b}g.runDiffOnLeanDocument=h;g.runDiffOnLeanDocumentWithRichTextString=i;g.updateLeanDocumentToSplitRTF=a;g.updateDiffToInsertComponents=j;g.mutateNodeForRemoval=l;g.updateLeanDocumentToAdjustAttributesForSelectionBeforePasting=b}),98);
__d("UEEventEmitterNode",["UEHeadlessUtils","UEObjectNode","UEViewModelNode","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";a=function(a){babelHelpers.inheritsLoose(e,a);e.create=function(){return new e(this.getDefaultBaseConstructorProps())};var b=e.prototype;b.setParent=function(a){if(!(a instanceof c("UEViewModelNode")))throw c("unrecoverableViolation")("parent of UEEventEmitterNode has to be UEViewModelNode","unified_editor");this.$UEEventEmitterNode$p_2=a;return this};b.registerObserver=function(a,b){var c=this.$UEEventEmitterNode$p_1.get(a);if(c==null){var d;c=new Set();(d=this.$UEEventEmitterNode$p_1)==null?void 0:d.set(a,c)}c.add(b);return b};b.unregisterObserver=function(a,b){return(a=(a=this.$UEEventEmitterNode$p_1.get(a))==null?void 0:a["delete"](b))!=null?a:!1};b.emit=function(a,b){(a=this.$UEEventEmitterNode$p_1.get(a))==null?void 0:a.forEach(function(a){return a(b)})};b.clone=function(a){return this.cloneNodeBase(a,new this.constructor(this.getBasePropsForClone(a)))};function e(b){var c;c=a.call(this,"EVENT-EMITTER",b)||this;c.getParent=function(){return c.$UEEventEmitterNode$p_2};c.getParentEnforce=function(){return d("UEHeadlessUtils").assertNonNull(c.getParent(),"parent node UERootNode should not be null")};c.$UEEventEmitterNode$p_1=new Map();return c}return e}(c("UEObjectNode"));g["default"]=a}),98);
__d("UESearchNode",["UEHeadlessUtils","UEObjectNode","UESearchUtils","UEViewModelNode","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";a=function(a){babelHelpers.inheritsLoose(e,a);e.create=function(){return new e(this.getDefaultBaseConstructorProps())};var b=e.prototype;b.setParent=function(a){if(!(a instanceof c("UEViewModelNode")))throw c("unrecoverableViolation")("parent of UESearchNode has to be UEViewModelNode","unified_editor");this.$UESearchNode$p_1=a;return this};b.clone=function(a){return this.cloneNodeBase(a,new this.constructor(this.getBasePropsForClone(a)))};b.isEqual=function(a,b){if(!(a instanceof e))throw c("unrecoverableViolation")("cannot compare UESearchNode with other node","unified_editor");return this.isEqualBase(a,b)};b.createLayout=function(){var a=this;return{childKeys:[],criteria:{caseSensitive:!1,regex:!1,type:"STRING",wholeWord:!1},isActive:!1,isVisual:!1,mergeResults:function(a,b,c,e,f){return d("UESearchUtils").merge(a,b,c,e,f)},model:this,parentKey:this.getID(),query:function(b,c){return d("UESearchUtils").search(a.getDocumentEnforce(),b,c)},results:[],target:{searchToken:""},type:"search"}};function e(b){var c;c=a.call(this,"SEARCH",b)||this;c.getParent=function(){return c.$UESearchNode$p_1};c.getParentEnforce=function(){return d("UEHeadlessUtils").assertNonNull(c.getParent(),"parent node UEViewModelNode should not be null")};return c}return e}(c("UEObjectNode"));g["default"]=a}),98);
__d("UESelectionNode",["UEHeadlessUtils","UEObjectNode","UEViewModelNode","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";a=function(a){babelHelpers.inheritsLoose(e,a);e.create=function(){return new e(this.getDefaultBaseConstructorProps())};var b=e.prototype;b.setParent=function(a){if(!(a instanceof c("UEViewModelNode")))throw c("unrecoverableViolation")("parent of UESelectionNode has to be UEViewModelNode","unified_editor");this.$UESelectionNode$p_1=a;return this};b.getState=function(){return this.$UESelectionNode$p_2};b.setState=function(a){this.$UESelectionNode$p_2=a;return this};b.getCollaborativeState=function(a){return this.$UESelectionNode$p_3.get(a)};b.setCollaborativeState=function(a,b){this.$UESelectionNode$p_3.set(a,b);return this};b.setPresence=function(a){this.$UESelectionNode$p_4.set(a.clientId,a);return this};b.getPresence=function(a){return this.$UESelectionNode$p_4.get(a)};b.clearPresence=function(a){this.$UESelectionNode$p_4["delete"](a.clientId);return this};b.clone=function(a){return this.cloneNodeBase(a,new this.constructor(this.getBasePropsForClone(a)))};function e(b){var c;c=a.call(this,"SELECTION",b)||this;c.$UESelectionNode$p_2=[];c.$UESelectionNode$p_3=new Map();c.$UESelectionNode$p_4=new Map();c.getParent=function(){return c.$UESelectionNode$p_1};c.getParentEnforce=function(){return d("UEHeadlessUtils").assertNonNull(c.getParent(),"parent node UEViewModelNode should not be null")};return c}return e}(c("UEObjectNode"));g["default"]=a}),98);
__d("UEToolbarNode",["UEHeadlessUtils","UEObjectNode","UEViewModelNode","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";a=function(a){babelHelpers.inheritsLoose(e,a);e.create=function(){return new e(this.getDefaultBaseConstructorProps())};var b=e.prototype;b.setParent=function(a){if(!(a instanceof c("UEViewModelNode")))throw c("unrecoverableViolation")("parent of UEToolbarNode has to be UEViewModelNode","unified_editor");this.$UEToolbarNode$p_1=a;return this};b.clone=function(a){return this.cloneNodeBase(a,new this.constructor(this.getBasePropsForClone(a)))};b.createLayout=function(){return{childKeys:[],isVisual:!1,model:this,parentKey:this.getID(),type:"toolbar"}};function e(b){var c;c=a.call(this,"TOOLBAR",b)||this;c.getParent=function(){return c.$UEToolbarNode$p_1};c.getParentEnforce=function(){return d("UEHeadlessUtils").assertNonNull(c.getParent(),"parent node UEViewModelNode should not be null")};return c}return e}(c("UEObjectNode"));g["default"]=a}),98);
__d("UEViewModelNode",["UEHeadlessUtils","UEObjectNode","UERootNode","saveAsRDFBJsonDoc","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";a=function(a){babelHelpers.inheritsLoose(e,a);e.create=function(a,b,c,d,f,g){return new e(babelHelpers["extends"]({},this.getDefaultBaseConstructorProps(),{behaviors:d,eventEmitter:c,search:g,selection:a,spacings:f,toolbar:b}))};var b=e.prototype;b.setParent=function(a){if(!(a instanceof c("UERootNode")))throw c("unrecoverableViolation")("parent of UEViewModelNode has to be UERootNode","unified_editor");this.$UEViewModelNode$p_2=a;return this};b.getSelection=function(){return this.$UEViewModelNode$p_3};b.getToolbar=function(){return this.$UEViewModelNode$p_4};b.getEventEmitter=function(){return this.$UEViewModelNode$p_5};b.getSpacings=function(){return this.$UEViewModelNode$p_7};b.getSearchEnforce=function(){return this.$UEViewModelNode$p_8};b.markShouldEmitDocumentChanged=function(){this.$UEViewModelNode$p_1=!0};b.emitDocumentChangedIfNecessary=function(){this.$UEViewModelNode$p_1===!0&&(this.getEventEmitter().emit("documentChanged",{rdfb:c("saveAsRDFBJsonDoc")(this.getParentEnforce().getDocumentEnforce())}),this.$UEViewModelNode$p_1=!1)};b.createLayout=function(){return{childKeys:[],isVisual:!1,model:this,parentKey:this.getID(),search:this.getSearchEnforce().getID(),toolbar:this.getToolbar().getID(),type:"view-model"}};b.hasBehavior=function(a){return this.$UEViewModelNode$p_6!=null&&this.$UEViewModelNode$p_6.has(a)};b.addBehavior=function(a){var b;(b=this.$UEViewModelNode$p_6)==null?void 0:b.add(a)};b.removeBehavior=function(a){var b;(b=this.$UEViewModelNode$p_6)==null?void 0:b["delete"](a)};b.getBehaviors=function(){return this.$UEViewModelNode$p_6==null?new Set():this.$UEViewModelNode$p_6};b.clone=function(a){return this.cloneNodeBase(a,new this.constructor(babelHelpers["extends"]({},this.getBasePropsForClone(a),{behaviors:new Set(this.$UEViewModelNode$p_6),eventEmitter:this.getEventEmitter().clone(a),search:this.getSearchEnforce().clone(a),selection:this.getSelection().clone(a),spacings:this.$UEViewModelNode$p_7,toolbar:this.getToolbar().clone(a)})))};function e(b){var c,e=b.behaviors,f=b.eventEmitter,g=b.search,h=b.selection,i=b.spacings,j=b.toolbar;b=babelHelpers.objectWithoutPropertiesLoose(b,["behaviors","eventEmitter","search","selection","spacings","toolbar"]);c=a.call(this,"VIEW-MODEL",b)||this;c.$UEViewModelNode$p_1=!1;c.getParent=function(){return c.$UEViewModelNode$p_2};c.getParentEnforce=function(){return d("UEHeadlessUtils").assertNonNull(c.getParent(),"parent node UERootNode should not be null")};c.$UEViewModelNode$p_3=h;c.$UEViewModelNode$p_4=j;c.$UEViewModelNode$p_5=f;c.$UEViewModelNode$p_6=new Set(e);c.$UEViewModelNode$p_7=i;c.$UEViewModelNode$p_8=g;h.setParent(babelHelpers.assertThisInitialized(c));j.setParent(babelHelpers.assertThisInitialized(c));f.setParent(babelHelpers.assertThisInitialized(c));g.setParent(babelHelpers.assertThisInitialized(c));return c}return e}(c("UEObjectNode"));g["default"]=a}),98);
__d("UEComponentNode",["UEVisualObjectNode","mapMapToArray","unrecoverableViolation","uuidv4"],(function(a,b,c,d,e,f,g){"use strict";a=function(a){babelHelpers.inheritsLoose(d,a);d.create=function(a){var b=this.getDefaultVisualObjectConstructorProps();b.props.set("COMPONENTID",{type:"string",value:a});b.props.set("CAPTION",null);return new d(b)};var b=d.prototype;b.getComponentID=function(){var a=this.getPropertyValueAsString("COMPONENTID");if(a==null)throw c("unrecoverableViolation")("UEComponentNode must have a component ID","unified_editor");return a};b.getComponent=function(){var a=this.getComponentContainer();return a.getComponent(this.getComponentID())};b.clone=function(a){return this.cloneNodeBase(a,new this.constructor(this.getVisualObjectPropsForClone(a)))};b.cloneForSelection=function(a,b,c){return this.cloneForSelectionBase(a,b,new this.constructor(this.getVisualObjectPropsForClone(a)),c)};b.afterCloneBaseForSelection=function(a,b,d){b=d.getParent();if(b!=null){var e=this.getComponent();a=a==="WITH_DIFFERENT_ID"?c("uuidv4")():this.getComponentID();b.getComponentContainer().insertComponentWithID(a,e);d.setPropertyValueForKey({type:"string",value:a},"COMPONENTID")}return d};b.isEqual=function(a,b){if(!(a instanceof d))throw c("unrecoverableViolation")("cannot compare UEComponentNode with other node","unified_editor");return this.isEqualBase(a,b)};b.toRDFBJson=function(){return this.toRDFBJsonBase()};d.constructVisualObjectFromJSON=function(a,b,c,d){return new this(d)};b.toPlainText=function(){var a;return(a=this.getComponent())==null?void 0:a.toPlainText()};b.toHTML=function(){var a;return(a=this.getComponent())==null?void 0:a.toHTML()};function d(b){return a.call(this,"COMPONENT",b)||this}b.createLayout=function(){return{childKeys:[],height:null,hint:{height:200,type:"default"},isVisual:!0,model:this,parentKey:this.getID(),type:"component",width:null}};return d}(c("UEVisualObjectNode"));a.SUPPORTED_PROPERTIES_KEYS_DEFAULTS=new Map([].concat(c("mapMapToArray")(c("UEVisualObjectNode").SUPPORTED_PROPERTIES_KEYS_DEFAULTS,function(a,b){return[b,a]}),[["COMPONENTID",null],["CAPTION",null]]));g["default"]=a}),98);
__d("UEHighlightedTextNode",["UEHeadlessUtils","UEVisualObjectNode","mapMapToArray"],(function(a,b,c,d,e,f,g){"use strict";a=function(a){babelHelpers.inheritsLoose(c,a);c.create=function(a){return new c(babelHelpers["extends"]({},this.getDefaultVisualObjectConstructorProps(),{content:a,title:""}))};var b=c.prototype;b.getTitle=function(){return this.$UEHighlightedTextNode$p_1};b.setTitle=function(a){this.$UEHighlightedTextNode$p_1=a};b.getContent=function(){return d("UEHeadlessUtils").assertNonNull(this.$UEHighlightedTextNode$p_2,"content node of highlightedTextNode should not be null")};b.clone=function(a){return this.cloneNodeBase(a,new this.constructor(babelHelpers["extends"]({},this.getVisualObjectPropsForClone(a),{content:this.getContent().clone(a),title:this.$UEHighlightedTextNode$p_1})))};function c(b){var c=b.content,d=b.title;b=babelHelpers.objectWithoutPropertiesLoose(b,["content","title"]);b=a.call(this,"HIGHLIGHTED-TEXT",b)||this;b.$UEHighlightedTextNode$p_2=c;b.$UEHighlightedTextNode$p_1=d;return b}b.isValid=function(){return a.prototype.isValid.call(this)&&this.getContent().isValid()};return c}(c("UEVisualObjectNode"));a.SUPPORTED_PROPERTIES_KEYS_DEFAULTS=new Map([].concat(c("mapMapToArray")(c("UEVisualObjectNode").SUPPORTED_PROPERTIES_KEYS_DEFAULTS,function(a,b){return[b,a]})));g["default"]=a}),98);
__d("UEStepperNode",["UEHeadlessUtils","UEVisualObjectNode","mapMapToArray","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";a=function(a){babelHelpers.inheritsLoose(e,a);e.create=function(a){var b=this.getDefaultVisualObjectConstructorProps();b.props.set("COUNT",{type:"number",value:(a=a)!=null?a:0});return new e(b)};var b=e.prototype;b.isValid=function(){var b=this.getPropertyValueAsNumber("COUNT");return a.prototype.isValid.call(this)&&b!=null&&b>=0};b.clone=function(a){return this.cloneNodeBase(a,new this.constructor(this.getVisualObjectPropsForClone(a)))};b.cloneForSelection=function(a,b,c){return this.cloneForSelectionBase(a,b,new this.constructor(this.getVisualObjectPropsForClone(a)),c)};b.isEqual=function(a,b){if(!(a instanceof e))throw c("unrecoverableViolation")("cannot compare UEStepperNode with other node","unified_editor");return this.isEqualBase(a,b)};b.toRDFBJson=function(){return this.toRDFBJsonBase()};e.constructVisualObjectFromJSON=function(a,b,c,d){return new this(d)};b.toPlainText=function(){return d("UEHeadlessUtils").assertNonNull(this.getPropertyValueAsNumber("COUNT"),"Stepper count should not be null").toString()};b.toHTML=function(){var a=new Document(),b=a.createElement("html");a.append(b);var c=d("UEHeadlessUtils").assertNonNull(this.toPlainText(),"Stepper plain text should not be null");b.append(a.createTextNode(c));return a};b.createLayout=function(){return{childKeys:[],count:d("UEHeadlessUtils").assertNonNull(this.getPropertyValueAsNumber("COUNT"),"UEStepper count should not be null"),height:null,hint:{height:44,type:"static"},isVisual:!0,model:this,parentKey:this.getID(),type:"stepper",width:null}};function e(b){b=babelHelpers["extends"]({},b);return a.call(this,"STEPPER",b)||this}return e}(c("UEVisualObjectNode"));a.SUPPORTED_PROPERTIES_KEYS_DEFAULTS=new Map([].concat(c("mapMapToArray")(c("UEVisualObjectNode").SUPPORTED_PROPERTIES_KEYS_DEFAULTS,function(a,b){return[b,a]}),[["COUNT",{type:"number",value:0}]]));g["default"]=a}),98);
__d("UEVisualObjectNode",["fbt","UEHeadlessUtils","UENodeUtils","UEObjectNode","UERichTextStringNode","UESectionNode","unrecoverableViolation"],(function(a,b,c,d,e,f,g,h){"use strict";a=function(a){babelHelpers.inheritsLoose(e,a);var b=e.prototype;b.setParent=function(a){if(a!=null&&!(a instanceof c("UESectionNode"))&&!(a instanceof c("UERichTextStringNode"))&&!(a instanceof e))throw c("unrecoverableViolation")("parent of UEVisualObjectNode has to be either UESectionNode or UEVisualObjectNode","unified_editor");this.$UEVisualObjectNode$p_1=a;return this};b.isEqualBase=function(b,f){if(!(b instanceof e))throw c("unrecoverableViolation")("cannot compare UEVisualObjectNode with other node","unified_editor");f=a.prototype.isEqualBase.call(this,b,f);var g=d("UENodeUtils").areNodesEqual(this.getPropertyValueAsNode("CAPTION"),b.getPropertyValueAsNode("CAPTION"));return f&&g&&this.annotation===b.annotation&&this.captionLocation===b.captionLocation};b.toRDFBJsonBase=function(){return babelHelpers["extends"]({},a.prototype.toRDFBJsonBase.call(this),{annotation:this.annotation,captionLocation:this.captionLocation})};b.createLayout=function(){throw c("unrecoverableViolation")("you have to implement createLayout method for UEVisualObjectNode","unified_editor")};e.constructFromJSON=function(a,b,c,d){return this.constructVisualObjectFromJSON(a,b,c,babelHelpers["extends"]({},d,{annotation:a.annotation,captionLocation:a.captionLocation}))};e.constructVisualObjectFromJSON=function(a,b,d,e){throw c("unrecoverableViolation")("you have to implement constructVisualObjectFromJSON method for UEVisualObjectNode","unified_editor")};b.getVisualObjectPropsForClone=function(a){return babelHelpers["extends"]({},this.getBasePropsForClone(a),{annotation:this.annotation,captionLocation:this.captionLocation})};e.getDefaultVisualObjectConstructorProps=function(){return babelHelpers["extends"]({},a.getDefaultBaseConstructorProps.call(this),{annotation:null,captionLocation:void 0})};function e(b,c){var e,f=c.annotation,g=c.captionLocation;c=babelHelpers.objectWithoutPropertiesLoose(c,["annotation","captionLocation"]);e=a.call(this,b,c)||this;e.getParent=function(){return e.$UEVisualObjectNode$p_1};e.getParentEnforce=function(){return d("UEHeadlessUtils").assertNonNull(e.getParent(),"parent of UEVisualObjectNode should not be null")};e.annotation=null;e.annotation=f;e.captionLocation=g;return e}b.getAriaLabel=function(){return h._("__JHASH__VIYSN7NtByn__JHASH__")};return e}(c("UEObjectNode"));a.SUPPORTED_PROPERTIES_KEYS_DEFAULTS=new Map([["PADDINGS",{type:"array_number",value:[4,4,4,4]}],["WIDTH",{type:"string",value:"UE_100_PERCENT"}],["HEIGHT",{type:"string",value:"UE_AUTO_SIZE_HEIGHT"}],["SELECTION_BEHAVIOR",{type:"string",value:"UE_FLAT"}],["CAPTION",null]]);g["default"]=a}),98);
__d("UEUserInterfacePropertyAndStateUtils",["UEDiff","UEHeadlessUtils","UELayoutUtils","UERichTextHeadlessEventHandlers","UERichTextStringCharacterAttributeUtils","UERichTextStringDiffBuilder","UERichTextStringDiffBuilderUtils","UERichTextStringUserInterfaceUtils","UESelectionUtils","UEStyleUtils","UETextArrayBehaviors","filterNulls","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";var h=new Map([["BOLD_CHARACTER_STYLE","bold"],["ITALIC_CHARACTER_STYLE","italic"],["UNDERLINE_CHARACTER_STYLE","underline"],["STRIKETHROUGH_CHARACTER_STYLE","strikethrough"],["DOUBLE_UNDERLINE_CHARACTER_STYLE","doubleunderline"],["PARAGRAPH_ALIGN","align"]]);function a(a){for(var b=h,c=Array.isArray(b),d=0,b=c?b:b[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var e;if(c){if(d>=b.length)break;e=b[d++]}else{d=b.next();if(d.done)break;e=d.value}e=e;var f=e[0];e=e[1];if(e===a)return y(f)}return null}function i(a){switch(a){case"LIST_STYLE":return"LIST_STYLES";case"PARAGRAPH_INDENT_LEVEL":return"PARAGRAPH_LEVEL";case"PARAGRAPH_STYLE":case"PARAGRAPH_ALIGN":return"PARAGRAPH_STYLES";default:throw c("unrecoverableViolation")("No UEUserInterfacePropertyKey:UETextAttributeType relationship found for "+a,"unified_editor")}}function j(a){return new Set(["PARAGRAPH_STYLE","LIST_STYLE"]).has(a)}function b(a,b,c,e,f){a=d("UESelectionUtils").getSelectedNodeByID(a);b=w(Array.from(a.keys()),b,e);D(a,b,c,e,f)}function e(a,b,c,e,f,g){a=d("UESelectionUtils").getSelectedNodeByID(a);b=w(Array.from(a.keys()),b,e);E(a,b,c,e,f,g)}function f(a,b,c,e,f){a=d("UESelectionUtils").getSelectedNodeByID(a);b=w(Array.from(a.keys()),b,e);F(a,b,c,e,f,i(e))}function k(a,b,c,d){o(a,b,c,d,{type:"increment_decrement",value:"INCREMENT"},!0)}function l(a,b,c,d){o(a,b,c,d,{type:"increment_decrement",value:"DECREMENT"},!0)}function m(a,b,c,d,e){o(a,b,c,d,{type:"paragraph_level",value:e},!0)}function n(a,b,c,d){o(a,b,c,d,null,!1)}function o(a,b,e,f,g,h){var j=i(f);if(!d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_IS_SPARSE_FOR_BLOCKS",j))throw c("unrecoverableViolation")("User interface active option not implemented for "+f,"unified_editor");a=d("UESelectionUtils").getSelectedNodeByID(a);b=w(Array.from(a.keys()),b,f);p(a,b,e,g,j,h)}function p(a,b,e,f,g,h){if(!d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_IS_SPARSE_FOR_BLOCKS",g))throw c("unrecoverableViolation")("User interface active option not implemented for "+g,"unified_editor");a=Array.from(d("UELayoutUtils").getRichTextStringNodeAndTextRangesForLayouts(a,b).values()).map(function(a){return[a.node,a.range]});if(a.length===0)throw c("unrecoverableViolation")("rich-text-string and range pair should not be empty","unified_editor");b=d("UERichTextStringDiffBuilderUtils").getSelectionForDiff(a[0][0]);var i=b[0];b=b[1];b=c("UEDiff").create([],i,b,i,!1,null);e({diff:a.reduce(function(a,b){var c=b[0];b=b[1];return h?d("UERichTextStringDiffBuilder").updateDiffForRichTextStringForSparseAttributeByParagraph(a,c,g,f,b,{isTypingEvent:!1}):d("UERichTextStringDiffBuilder").updateDiffForRichTextStringForReplacingAttributesOverTextRange(a,c,g,f,b,{isTypingEvent:!1})},b),referrer:"toolbar",type:"diff"})}function q(a,b){a=r(a,b);b=d("UERichTextStringCharacterAttributeUtils").getSmartFieldsByTextRange(a[0].node,a[0].range,"FOOTNOTES",!0,!0);return b[0]}function r(a,b){var e=d("UESelectionUtils").getSelectedIDs(a);e=w(e,b,"INLINE");b=Array.from(d("UELayoutUtils").getRichTextStringNodeAndTextRangesFromSelectionForLayouts(a,e).values());if(b.length!==1)throw c("unrecoverableViolation")("Expected exactly one text node in selection","unified_editor");return b}function s(a,b,c,e,f){var g=d("UESelectionUtils").getSelectedIDs(a);g=w(g,b,c);var h=d("UELayoutUtils").getRichTextStringNodeAndTextRangesFromSelectionForLayouts(a,g);return g.length===0?!1:g.every(function(a){return B(a,h.get(a.model.getID()),e,c,f)})}function t(a,b,c){var e=d("UESelectionUtils").getSelectedIDs(a);e=w(e,b,"PARAGRAPH_ALIGN");var f=d("UELayoutUtils").getRichTextStringNodeAndTextRangesFromSelectionForLayouts(a,e);b=Array.from(new Set(e.map(function(a){return C(a,f.get(a.model.getID()),"PARAGRAPH_ALIGN")})));return b.length===1?b[0]===c:!1}function u(a,b,d){switch(a){case"UNDO":return b;case"REDO":return d;default:throw c("unrecoverableViolation")("Invalid even type passed to getButtonActiveStatusForDiffController: "+a,"unified_editor")}}function v(a,b,e){if(e!=="PARAGRAPH_STYLE"&&e!=="LIST_STYLE")throw c("unrecoverableViolation")("User interface active option not implemented for "+e,"unified_editor");var f=d("UESelectionUtils").getSelectedIDs(a);f=w(f,b,e);var g=d("UELayoutUtils").getRichTextStringNodeAndTextRangesFromSelectionForLayouts(a,f);b=Array.from(new Set(f.map(function(a){return C(a,g.get(a.model.getID()),e)})));return b.length===1?b[0]:null}function w(a,b,d){a=c("filterNulls")(a.map(function(a){return b.get(a)}));return a.filter(function(a){return x(a,d)})}function x(a,b){return a.model.constructor.SUPPORTED_USER_INTERFACE_PROPERTIES.has(b)}function y(a){switch(a){case"BOLD_CHARACTER_STYLE":case"ITALIC_CHARACTER_STYLE":case"UNDERLINE_CHARACTER_STYLE":case"DOUBLE_UNDERLINE_CHARACTER_STYLE":case"STRIKETHROUGH_CHARACTER_STYLE":return a;default:return null}}function z(a){switch(a){case"H_LEFT":case"H_CENTER":case"H_RIGHT":case"H_JUSTIFIED":return a;default:return null}}function A(a){if(typeof a!=="string")throw c("unrecoverableViolation")("getAsAlignPropertyValueEnforce called with non-string value","unified_editor");var b=z(a);if(b==null)throw c("unrecoverableViolation")(a+" does not refer to an align property value","unified_editor");return b}function B(a,b,e,f,g){a=b==null?void 0:b.node;b=b==null?void 0:b.range;if(a==null||b==null)throw c("unrecoverableViolation")("Could not get richTextString or range.","unified_editor");if(f==="PARAGRAPH_STYLE"||f==="PARAGRAPH_ALIGN"||f==="LIST_STYLE"||f==="UNDO"||f==="REDO")throw c("unrecoverableViolation")("Cannot return boolean value for non-boolean user interface property key "+f,"unified_editor");var h=y(f),i=null;h!=null?i="CHARACTER_STYLES":f==="LINK_SMART_FIELD"?i="LINKS":f==="FOOTNOTE_SMART_FIELD"?i="FOOTNOTES":f==="EXTERNAL_SMART_FIELD"?i="EXTERNAL_SMART_FIELDS":f==="INLINE"&&(i="INLINES");h=d("UERichTextStringUserInterfaceUtils").getValueForPropertyKeyOverTextRange(a,d("UEHeadlessUtils").assertNonNull(i,"Expected attribute type to get value of property key over text range"),f,b,e,g);return h.type==="boolean"?h.value:!0}function C(a,b,e){a=b==null?void 0:b.node;b=b==null?void 0:b.range;if(a==null||b==null)throw c("unrecoverableViolation")("Could not get richTextString or range.","unified_editor");a=d("UERichTextStringUserInterfaceUtils").getValueForBlockPropertyKeyOverTextRange(a,e,b);if(a==null)return null;if(a.type!=="string")throw c("unrecoverableViolation")("Expected string value type.","unified_editor");return a.value}function D(a,b,e,f,g){var h=y(f);if(h==null)throw c("unrecoverableViolation")("User interface state not implemented for "+f,"unified_editor");f=Array.from(d("UELayoutUtils").getRichTextStringNodeAndTextRangesForLayouts(a,b).values()).map(function(a){return[a.node,a.range]});d("UERichTextHeadlessEventHandlers").handleTogglePropertyChange(f,h,g,e,{referrer:"toolbar"})}function E(a,b,e,f,g,h){if(!j(f))throw c("unrecoverableViolation")("User interface active option not implemented for "+f,"unified_editor");a=Array.from(d("UELayoutUtils").getRichTextStringNodeAndTextRangesForLayouts(a,b).values()).map(function(a){return[a.node,a.range]});b=d("UEStyleUtils").assertAsPredefinedParagraphStyleID(g);d("UERichTextHeadlessEventHandlers").handleStyleChange(a,f,b,e,{referrer:"toolbar"},h)}function F(a,b,c,e,f,g){a=Array.from(d("UELayoutUtils").getRichTextStringNodeAndTextRangesForLayouts(a,b).values()).map(function(a){return[a.node,a.range]});d("UERichTextHeadlessEventHandlers").handlePropertyChange(a,e,f,g,c,{referrer:"toolbar"})}function G(a,b){var c=d("UESelectionUtils").getInlineSelection(a);if(c==null)return!1;a=d("UELayoutUtils").assertToRichTextStringLayout(d("UEHeadlessUtils").assertNonNull(b.find(function(a){return a.model.getID()===c.id}),"layout not found in selection"));return d("UERichTextStringUserInterfaceUtils").isEnableOrActiveForUserInterfacePropertyKey(a.model,"LINKS","LINK_SMART_FIELD",c.range,"ENABLE")}function H(a,b,c){var e=d("UESelectionUtils").getInlineSelection(a);if(e==null)return!1;a=d("UELayoutUtils").assertToRichTextStringLayout(d("UEHeadlessUtils").assertNonNull(b.find(function(a){return a.model.getID()===e.id}),"layout not found in selection"));return d("UERichTextStringUserInterfaceUtils").isEnableOrActiveForUserInterfacePropertyKey(a.model,"EXTERNAL_SMART_FIELDS","EXTERNAL_SMART_FIELD",e.range,"ENABLE",c)}function I(a){switch(a){case"UNDO":case"REDO":return!0;default:return!1}}g.STYLE_IDS_BY_USER_INTERFACE_PROPERTIES=h;g.getUserInterfaceCharacterPropertyKeyFromUEStyleID=a;g.getAttributeTypeFromUserInterfacePropertyKey=i;g.isKeyForRichTextBlock=j;g.executeButtonActionForSelection=b;g.executeDropdownListActionForSelection=e;g.executeParagraphButtonActionForSelection=f;g.incrementParagraphLevelFromSelection=k;g.decrementParagraphLevelFromSelection=l;g.assignParagraphLevelFromSelection=m;g.clearSparseAttributeFromSelection=n;g.getFootnoteInsideSelection=q;g.getRichTextStringNodeAndTextRangesFromSelection=r;g.getButtonActiveStatusForSelection=s;g.getParagraphAlignmentButtonActiveStatusForSelection=t;g.getButtonEnabledStatusForUndoRedo=u;g.getDropdownListActiveOptionForSelection=v;g.getLayoutsSupportingProperty=w;g.doesLayoutSupportProperty=x;g.getAsCharacterPropertyKey=y;g.getAsAlignPropertyValue=z;g.getAsAlignPropertyValueEnforce=A;g.shouldEnableLinkButtonForSelection=G;g.shouldEnableSmartFieldButtonForSelection=H;g.isUndoRedoPropertyKey=I}),98);
__d("UEClipboard",["UEClipboardUtils","UEHeadlessUtils","UELayoutMutator","UELayoutUtils","UEPersistence","UESelectionUtils","unrecoverableViolation","useUERecoilSetup"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b,e,f,g,k){var l=[[],[]],m=f(d("useUERecoilSetup").documentNodeKeyAtom),n=f(d("useUERecoilSetup").selectionReadOnlyAtom),o=b.clipboardAPI,p=b.componentFetcher,q=b.imageUploader,r=b.mediaCloner,s=b.type,t=d("UELayoutUtils").createLayoutGetter(f);f=d("UESelectionUtils").createSelectionSetter(a,f,g,e.getCollaborationAgent());g=d("UEHeadlessUtils").createDiffRunner(a,e);switch(s){case"CUT":l=d("UELayoutMutator").appendInstructionsToBatch(l,i(a,m,t,n,f,o,g,k));break;case"COPY":h(m,t,n,b.clipboardAPI,k);break;case"PASTE":l=d("UELayoutMutator").appendInstructionsToBatch(l,j(m,t,n,f,o,g,k,p,q,r));break;default:throw c("unrecoverableViolation")("Unknown clipboard event type "+s,"unified_editor")}return l}function h(a,b,c,e,f){b=d("UELayoutUtils").assertToDocumentLayout(d("UEHeadlessUtils").assertNonNull(b(a),"Expected document layout to exist"));a=b.model;b=a.cloneForSelection("WITH_DIFFERENT_ID",c,null);a={document:b,selection:c};b={destination:e,source:a,type:"COPY"};d("UEPersistence").handlePersistence(b,f)}function i(a,b,c,e,f,g,i,j){var k=[[],[]];h(b,c,e,g,j);k=d("UELayoutMutator").appendInstructionsToBatch(k,[d("UEClipboardUtils").deleteSelection(a,e,c,i),[]]);if(!d("UESelectionUtils").isSelectionInline(e)){b=e.slice(0,e.length-1);k=d("UELayoutMutator").appendInstructionsToBatch(k,f(b))}return k}function j(a,b,c,e,f,g,h,i,j,k,l){j===void 0&&(j=null);k===void 0&&(k=null);l===void 0&&(l="APPEND");b=d("UELayoutUtils").assertToDocumentLayout(d("UEHeadlessUtils").assertNonNull(b(a),"Expected document layout to exist"));a={componentFetcher:i,documentLayout:b,imageUploader:j,mediaCloner:k,option:l,runDiff:g,selection:c,selectionSetter:e};i={destination:a,source:f,type:"PASTE"};return d("UEPersistence").handlePersistence(i,h)}g.handleClipboardEvent=a;g.handleCopy=h;g.handleCut=i;g.handlePaste=j}),98);
__d("UEPersistence",["UEClipboardUtils","UELayoutMutator","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b){var e=[[],[]];switch(a.type){case"COPY":d("UEClipboardUtils").copy(a.source,a.destination);break;case"PASTE":e=d("UELayoutMutator").appendInstructionsToBatch(e,d("UEClipboardUtils").paste(a.source,a.destination,b));break;default:throw c("unrecoverableViolation")("Unknown persistence type given: "+a.type,"unified_editor")}return e}g.handlePersistence=a}),98);
__d("adjustChangesOrderForTextAttributesForUEDiff",["getAdjustedChangesOrderForTextAttributesForUEDiffFromCollabri"],(function(a,b,c,d,e,f,g){"use strict";function a(a){var b=c("getAdjustedChangesOrderForTextAttributesForUEDiffFromCollabri")(a),d=a.getChangesMutable();d.splice(0,d.length);a.pushChanges.apply(a,b);return a}g["default"]=a}),98);
__d("rdfbJsonDocParse",[],(function(a,b,c,d,e,f){"use strict";function a(a){return JSON.parse(a)}f["default"]=a}),66);
__d("UEClipboardUtils",["UEComponentNode","UECoreNodes","UEDiffUtils","UEDocumentMergeDiffBuilder","UEHeadlessUtils","UEImage","UELayoutMutator","UELayoutUtils","UELeanDocumentUtils","UEModelStorage","UERichTextFrameNode","UERichTextStringUtils","UESelectionUtils","UEUndoRedoUtils","UEVideo","adjustChangesOrderForTextAttributesForUEDiff","convertHTMLToRDFBJsonDoc","convertImagePlaceholdersToRDFBJsonDoc","convertPlainTextToRDFBJsonDoc","convertRDFBToHTMLString","convertRDFBToPlainTextString","createDeletionDiffForSelection","createRootForRDFBJsonDocAndLoad","filterNulls","isStringNullOrEmpty","rdfbJsonDocParse","saveAsRDFBJsonDoc","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";var h=["application/x-UnifiedEditor-RDFB","text/plain","text/html"];function a(a,b){var d=a.document;h.forEach(function(a){switch(a){case"application/x-UnifiedEditor-RDFB":r(d,b);break;case"text/plain":s(d,b);break;case"text/html":t(d,b);break;default:throw c("unrecoverableViolation")("Unknown clipboard format provided: "+a,"unified_editor")}})}function b(a,b,e){var f=[[],[]],g=[],h=[],k=b.componentFetcher,l=b.documentLayout,n=b.imageUploader,o=b.mediaCloner,q=b.option,r=b.runDiff,s=b.selection;b=b.selectionSetter;var t=l.model.getParentEnforce().getViewModel().getSpacings(),u=l.model.getParentEnforce().getViewModel(),v=a.getRDFB(),w=a.getHTML(),x=a.getPlainText();a=a.getImages();var y=a.length,z=!c("isStringNullOrEmpty")(v),B=!c("isStringNullOrEmpty")(x),C=null;if(z&&v!=null)C=c("rdfbJsonDocParse")(v);else if(y>0&&!B)C=c("convertImagePlaceholdersToRDFBJsonDoc")(y,l.model.getStyleSheet().getAllStyles(),t),g.push.apply(g,a.map(function(a){return{file:a,type:"file"}}));else if(!c("isStringNullOrEmpty")(w)){v=new DOMParser();y=v.parseFromString(w.replace(/(\r\n|\n|\r)/gm," "),"text/html");C=c("convertHTMLToRDFBJsonDoc")(y,"CONFIGURATION_DEFAULT",l.model.getStyleSheet().getAllStyles(),t,u.getBehaviors(),!0);g.push.apply(g,j(y))}else B&&x!=null&&(C=c("convertPlainTextToRDFBJsonDoc")(x,l.model.getStyleSheet().getAllStyles(),t));if(C==null)return f;a=d("UERichTextStringUtils").isSingleRTFDocument(l.model)&&u.hasBehavior("CONFIGURATION_SINGLE_EDITOR_ONLY");if(a){if(!d("UESelectionUtils").isSelectionInline(s))return f;A(C.content);g.splice(0,g.length)}v=c("createRootForRDFBJsonDocAndLoad")(C,c("UECoreNodes"),e,new Set(),l.model.getStyleSheet().getAllStyles(),t).getDocumentEnforce().clone("WITH_DIFFERENT_ID");if(v.getChildAtIdx(0).getChildren().length===0)return f;z&&!a&&h.push.apply(h,i(v));w=m(s,v);f=d("UELayoutMutator").appendInstructionsToBatch(f,[p(v,l.model,s,w,r,g,h,q,n,o,k),[]]);f=d("UELayoutMutator").appendInstructionsToBatch(f,b(w));return f}function i(a){var b=[],e=a.getComponentContainer();a.getChildren().forEach(function(a){a.getChildren().forEach(function(a){if(a instanceof c("UEComponentNode")){var f=a.getComponentID(),g=e.getComponent(f);if(q(g)){var h=null;if(g instanceof c("UEImage")){var i=g.getProperties();h=i.mediaID;var j=g.clone();j.setProperties_DO_NOT_USE_OUTSIDE_OF_MODEL_MUTATOR(babelHelpers["extends"]({},i,{isPlaceholder:!0}));e.insertComponentWithID(f,j)}else if(g instanceof c("UEVideo")){i=g.getProperties();h=i.mediaID;j=g.clone();j.setProperties_DO_NOT_USE_OUTSIDE_OF_MODEL_MUTATOR(babelHelpers["extends"]({},i,{loadingState:"placeholder"}));e.insertComponentWithID(f,j)}else throw c("unrecoverableViolation")("Cloning not supported for media type","unified_editor");b.push({componentID:f,componentType:g.getType(),mediaID:d("UEHeadlessUtils").assertNonNull(h,"Cannot clone a null media id"),nodeKey:a.getID()})}}})});return b}function j(a){a=a.getElementsByTagName("img");return Array.from(a).map(function(a){var b=a.alt;a=a.src;if(l(a))return{file:k(a,b),type:"file"};else return{type:"url",url:a}})}function k(a,b){var c=atob(a.split(",")[1]);a=a.split(",")[0].split(":")[1].split(";")[0];var d=new ArrayBuffer(c.length),e=new Uint8Array(d);for(var f=0;f0){var n=d("UEHeadlessUtils").assertNonNull(l,"Media cloner should not be null");i.forEach(function(a){var b=a.componentID,c=a.componentType,d=a.mediaID;a=a.nodeKey;n(c,b,a,d)})}if(h.length>0){var o=d("UEHeadlessUtils").assertNonNull(k,"Image uploader should not be null");b=f.getChanges().map(function(a){a=a.atomicChange;return(a==null?void 0:a.type)==="INSERT"&&a.value.type==="node"&&a.value.value instanceof c("UEComponentNode")&&q(a.value.value.getComponent())?a.value.value:null}).filter(Boolean);if(b.length!==h.length)throw c("unrecoverableViolation")("Number of image components not same as uploadables","unified_editor");var p=0;b.forEach(function(a){var b=a.getComponentID();a=a.getID();var c=h[p++];o(b,a,c)})}e=[];for(j=f.getChanges(),g=Array.isArray(j),l=0,j=g?j:j[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){if(g){if(l>=j.length)break;i=j[l++]}else{l=j.next();if(l.done)break;i=l.value}k=i;((b=k.atomicChange)==null?void 0:b.type)==="INSERT_COMPONENT"&&!q(k.atomicChange.component)&&e.push([k.atomicChange.componentID,k.atomicChange.component])}m(e);return a}function q(a){a=a.getType();return a==="IMAGE"||a==="VIDEO"}function r(a,b){a=c("saveAsRDFBJsonDoc")(a);b.setRDFB(JSON.stringify(a))}function s(a,b){a=c("convertRDFBToPlainTextString")(a);b.setPlainText(a)}function t(a,b){a=c("convertRDFBToHTMLString")(a,"CONFIGURATION_DEFAULT",!1);b.setHTML(a)}function e(a,b,d,e,f,g){if(a==null)throw c("unrecoverableViolation")("Attempted to create clipboard event with null clipboard data","unified_editor");return babelHelpers["extends"]({event:{event:{clipboardAPI:u(a),componentFetcher:e,imageUploader:f,mediaCloner:g,type:b},type:"clipboard"},type:"persistence"},d)}function u(a){var b=function(b){a.setData("text/html",b)},d=function(b){a.setData("text/plain",b)},e=function(b){a.setData("application/x-UnifiedEditor-RDFB",b)},f=function(){return a.getData("text/html")},g=function(){return a.getData("text/plain")},h=function(){return a.getData("application/x-UnifiedEditor-RDFB")},i=function(){return c("filterNulls")(Array.from(a.items).map(function(a){return a.type.indexOf("image")!==-1?a.getAsFile():null}))};return{getHTML:f,getImages:i,getPlainText:g,getRDFB:h,setHTML:b,setPlainText:d,setRDFB:e}}function v(a,b){a=d("UESelectionUtils").getInlineSelection(a);return a!=null?d("UELayoutUtils").assertToRichTextStringLayout(d("UEHeadlessUtils").assertNonNull(b(a.id),"Expected rich text string layout to be non-null")).model:null}function w(a,b,e){a=d("UEModelStorage").getDocumentModel(a).modelNodeByKey;e=v(b,e);return d("UEHeadlessUtils").assertNonNull(c("createDeletionDiffForSelection")(a,b,d("UEUndoRedoUtils").UEUndoCapability.UNDOABLE,e),"Expected diff to be non-null")}function f(a,b,c,d){return d(w(a,b,c))}function x(a){if(a.type==="RICH-TEXT-FRAME")return[a];var b=[];a.children.forEach(function(a){a=x(a);b=[].concat(b,a)});return b}function y(a){if(a.type==="RICH-TEXT-FRAME")return;if(a.type==="SECTION"){a.children=[];return}a.children.forEach(function(a){y(a)})}function z(a,b){return(a=a.attributes)==null?void 0:a.find(function(a){return a[0]===b})}function A(a){var b=x(a);y(a);if(b.length===0)return;var c=b[0],d=c.children[0];b=b.reduce(function(a,b){return[].concat(a,b.children)},[]);b=b.slice(1);b.forEach(function(a){var b,c=(b=(b=d.text)==null?void 0:b.length)!=null?b:0;a.text!=null&&d.text!=null&&(d.text+="\n"+a.text,c+=1);(b=a.attributes)==null?void 0:b.forEach(function(a){var b=a[0];a=a[1];a[0].charIndex!==0&&a.unshift({attribute:null,charIndex:0});a.forEach(function(a){a=babelHelpers["extends"]({},a);a.charIndex+=c;var e=B(d,b);e[1].push(a)})})});C(d);b=a.children[0];b.children.push(c)}function B(a,b){var c=z(a,b);if(!c){var e;(e=a.attributes)==null?void 0:e.push([b,[]]);c=z(a,b)}return d("UEHeadlessUtils").assertNonNull(c,"Cannot create or get an attribute")}function C(a){(a=a.attributes)==null?void 0:a.forEach(function(a){a=a[1];a[0].charIndex!==0&&a.unshift({attribute:null,charIndex:0})})}g.UEClipboardFormats=h;g.copy=a;g.paste=b;g.createClipboardEventFromClipboardData=e;g.createDiffToDeleteSelection=w;g.deleteSelection=f;g.getRTFs=x;g.removeSectionChildren=y;g.findAttributeByType=z;g.combineRTFNodes=A;g.createOrGetAttributeByType=B;g.addInitialAttributeValues=C}),98);
__d("UECollabriStyleSheetNodeController",["UECollabriObjectNodeController","UEDiff","UEDiffUtils","UEHeadlessUtils","UEStyleSheetNode","transformStyleSheetMapChangeToDiff","yjs"],(function(a,b,c,d,e,f,g){"use strict";a=function(a){babelHelpers.inheritsLoose(e,a);var b=e.prototype;b.getStylesMap=function(){return this.$UECollabriStyleSheetNodeController$p_1};b.getStylesObserver=function(){return this.$UECollabriStyleSheetNodeController$p_2};function e(b,e,f,g,h){var i;i=a.call(this,b,e,f,g,h)||this;i.$UECollabriStyleSheetNodeController$p_1=d("UEHeadlessUtils").assertNonNull(f.get("styles"),"cannot get style collabri map from style collabri node");i.$UECollabriStyleSheetNodeController$p_2=i.getStylesMap().observe(function(a,b){a=a.changes.keys;if(b!=null&&(b.origin===i.getCollabriClient().clientId||b.origin instanceof d("yjs").UndoManager)){b=(b=g.getLocalDiffFromCollabri())!=null?b:c("UEDiff").createEmptyDiff().createCollabriDiff();var e=c("transformStyleSheetMapChangeToDiff")(d("UEHeadlessUtils").assertToNodeOfType(i.getUENode(),c("UEStyleSheetNode")),i.getStylesMap(),a);b.setCollabriOrigin("local");g.setLocalDiffFromCollabri(d("UEDiffUtils").appendDiffChanges(b,e))}else{e=(b=g.getRemoteDiffFromCollabri())!=null?b:c("UEDiff").createEmptyDiff().createCollabriDiff();b=c("transformStyleSheetMapChangeToDiff")(d("UEHeadlessUtils").assertToNodeOfType(i.getUENode(),c("UEStyleSheetNode")),i.getStylesMap(),a);e.setCollabriOrigin("remote");g.setRemoteDiffFromCollabri(d("UEDiffUtils").appendDiffChanges(e,b))}});return i}b.dispose=function(){a.prototype.dispose.call(this)};return e}(c("UECollabriObjectNodeController"));g["default"]=a}),98);
__d("transformStyleSheetMapChangeToDiff",["UEDiff","UEHeadlessUtils"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b,e){var f=c("UEDiff").createEmptyDiff().createCollabriDiff();e.forEach(function(c,e){switch(c.action){case"add":case"update":c=d("UEHeadlessUtils").assertNonNull(b.get(e),"style to be added from collabri cannot be null");e={parentKey:a.getParentEnforce().getID(),type:"INSERT",value:{type:"style",value:c}};f.pushChanges({atomicChange:e});break;case"delete":}});f.setIsFromCollabri(!0);return f}g["default"]=a}),98);
__d("UEStyleSheetNode",["UEHeadlessUtils","UENodeUtils","UEObjectNode","UEStyleUtils","areEqual","filterNulls","mapMap","mapMapToArray","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";var h;a=function(a){babelHelpers.inheritsLoose(e,a);e.create=function(a){return new e(babelHelpers["extends"]({},this.getDefaultBaseConstructorProps(),{stylesMap:new Map(a.map(function(a){return[a.id,a]}))}))};var b=e.prototype;b.getStylesMap_DO_NOT_USE=function(){return this.$UEStyleSheetNode$p_1};b.getAllStyles=function(){return Array.from(this.$UEStyleSheetNode$p_1.values())};b.$UEStyleSheetNode$p_2=function(a){this.$UEStyleSheetNode$p_1.set(a.id,a)};b.hasStyle=function(a){return this.$UEStyleSheetNode$p_1.get(a)!=null};b.getStyle=function(a){var b=this.$UEStyleSheetNode$p_1.get(a);if(b==null)throw c("unrecoverableViolation")("error when getting UEStyle with id - "+a,"unified_editor");return b};b.findStyleByComparingProperties=function(a){var b=c("mapMapToArray")(this.$UEStyleSheetNode$p_1,function(a,b){return a});b=b.find(function(b){return(h||(h=c("areEqual")))(b.properties,a)});return b==null?null:b};b.getStyleByUEValue=function(a){if(a.type==="string")return this.getStyle(a.value);throw c("unrecoverableViolation")("error UEValue type when getting UEStyle","unified_editor")};b.createNewStyle=function(a,b,c,e){a=d("UEStyleUtils").createStyleWithProperties(a,b,c,e);this.$UEStyleSheetNode$p_2(a);return a.id};b.modifyStyle=function(a,b,c,d){d===void 0&&(d=!1);b=this.getStyleByUEValue(b);a=babelHelpers["extends"]({},b.properties,a);if(b.title!=null&&d){b.properties=a;b.followingStyle=c;this.$UEStyleSheetNode$p_2(b);return b.id}else return this.createNewStyle(a,null,c)};b.clearUnusedStyle=function(){throw c("unrecoverableViolation")("clearUnusedStyle: to be implemented.","unified_editor")};b.nameStyle=function(a,b){a=this.getStyleByUEValue(a);a.title=b;a.id=b;this.$UEStyleSheetNode$p_2(a);return a.id};b.getAllNamedStyleIDs=function(){var a=c("mapMapToArray")(this.$UEStyleSheetNode$p_1,function(a){return a.title!=null?null:a.id});return new Set(c("filterNulls")(a))};b.clone=function(a){return this.cloneNodeBase(a,new this.constructor(babelHelpers["extends"]({},this.getBasePropsForClone(a),{stylesMap:c("mapMap")(this.$UEStyleSheetNode$p_1,function(a){var b=babelHelpers["extends"]({},a);b.properties=babelHelpers["extends"]({},a.properties);return b})})))};b.isEqual=function(a,b){if(!(a instanceof e))throw c("unrecoverableViolation")("cannot compare UEStyleSheetNode with other node","unified_editor");return this.isEqualBase(a,b)&&d("UENodeUtils").isStyleMapIntersectionSame(this.$UEStyleSheetNode$p_1,a.getStylesMap_DO_NOT_USE())};b.toRDFBJson=function(){return babelHelpers["extends"]({},this.toRDFBJsonBase(),{stylesMap:Array.from(this.getStylesMap_DO_NOT_USE().entries())})};e.constructFromJSON=function(a,b,c,e){b=d("UEHeadlessUtils").assertNonNull(a==null?void 0:a.stylesMap,"stylesMap is missing in fromRDFBJson");return new this(babelHelpers["extends"]({},e,{stylesMap:new Map(b)}))};function e(b){var c=b.stylesMap;b=babelHelpers.objectWithoutPropertiesLoose(b,["stylesMap"]);b=a.call(this,"STYLE-SHEET",b)||this;b.$UEStyleSheetNode$p_1=new Map();b.$UEStyleSheetNode$p_1=c;return b}return e}(c("UEObjectNode"));g["default"]=a}),98);
__d("everyObject",[],(function(a,b,c,d,e,f){"use strict";var g=Object.prototype.hasOwnProperty;function a(a,b,c){for(var d in a){var e=d;if(g.call(a,e)&&!b.call(c,a[e],e,a))return!1}return!0}f["default"]=a}),66);
__d("UECharacterStyleUtils",["UEStyleUtils","areEqual","everyObject","filterObject","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";var h;function a(a){switch(a){case"bold":case"underline":case"doubleunderline":case"strikethrough":case"italic":return a;default:throw c("unrecoverableViolation")(((a=a)!=null?a:"null")+" does not refer to a character style id","unified_editor")}}function i(a){a.type;a=babelHelpers.objectWithoutPropertiesLoose(a,["type"]);return c("everyObject")(a,m)}function j(a){a.type;a=babelHelpers.objectWithoutPropertiesLoose(a,["type"]);return Object.keys(c("filterObject")(a,function(a){return!m(a)})).length}function k(a,b){switch(b){case"BOLD_CHARACTER_STYLE":a.bold;a.type;b=babelHelpers.objectWithoutPropertiesLoose(a,["bold","type"]);return i(b);case"ITALIC_CHARACTER_STYLE":a.italic;a.type;b=babelHelpers.objectWithoutPropertiesLoose(a,["italic","type"]);return i(b);case"UNDERLINE_CHARACTER_STYLE":a.type;a.underline;b=babelHelpers.objectWithoutPropertiesLoose(a,["type","underline"]);return i(b);case"DOUBLE_UNDERLINE_CHARACTER_STYLE":a.doubleunderline;a.type;b=babelHelpers.objectWithoutPropertiesLoose(a,["doubleunderline","type"]);return i(b);case"STRIKETHROUGH_CHARACTER_STYLE":a.strikethrough;a.type;b=babelHelpers.objectWithoutPropertiesLoose(a,["strikethrough","type"]);return i(b);default:throw c("unrecoverableViolation")("UEUserInterfaceCharacterPropertyKey does not refer to a UEStyleID.","unified_editor")}}function l(a){var b;return(b=["bold","italic","underline","doubleunderline","strikethrough"].find(function(b){return a[b]===!0}))!=null?b:null}function b(a,b,e,f){if(e.type!=="boolean")throw c("unrecoverableViolation")("Only boolean types currently supported.","unified_editor");var g=e.value;if(a==null){if(g===!1)throw c("unrecoverableViolation")("Null and false are equivalent for style.properties, so caller should not call this method.","unified_editor");return f.getStyle(d("UEStyleUtils").getPredefinedStyleIDFromPropertyKeyEnforce(b))}if((h||(h=c("areEqual")))(e,d("UEStyleUtils").getStyleValueFromPropertyKey(b,a)))throw c("unrecoverableViolation")("Style and newStyleValue equate, so caller should not call this method.","unified_editor");a=d("UEStyleUtils").createPropertiesWithStyleValue(a.properties,b,e);if(g===!1){if(i(a)===!0)return null;if(j(a)===1){e=l(a);if(e!=null)return f.getStyle(e)}}else if(k(a,b)===!0)return f.getStyle(d("UEStyleUtils").getPredefinedStyleIDFromPropertyKeyEnforce(b));return d("UEStyleUtils").createStyleWithProperties(a,null,null)}function m(a){return a===!1||a===void 0}g.getAsCharacterStyleIdEnforce=a;g.getNewCharacterStyleFromStyleAndValue=b}),98);
__d("UEStyleUtils",["UECharacterStyleUtils","UEPredefinedStyleIDs","UERichTextStringUtils","UEUserInterfacePropertyAndStateUtils","areEqual","md5","stableStringify","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";var h,i=new Set(["PARAGRAPH","LIST"]);function j(a,b,c,d){var e;e=(e=b)!=null?e:o(a);return babelHelpers["extends"]({followingStyle:(c=c)!=null?c:e,id:e,isAnonymousStyle:b==null,properties:a,title:b},d!=null&&{parentParagraphStyle:d})}function a(a){a=d("UEUserInterfacePropertyAndStateUtils").STYLE_IDS_BY_USER_INTERFACE_PROPERTIES.get(a);if(a==null)throw c("unrecoverableViolation")("UEUserInterfacePropertyKey does not refer to a UEStyleID.","unified_editor");return a}function k(a){var b=d("UEUserInterfacePropertyAndStateUtils").STYLE_IDS_BY_USER_INTERFACE_PROPERTIES.get(a);switch(b){case"bold":case"italic":case"underline":case"doubleunderline":case"strikethrough":case"align":case"type":return b;default:throw c("unrecoverableViolation")("getStylePropertyForUserInterfacePropertyKeyEnforce not implemented for key "+a+".","unified_editor")}}function l(a,b,e){var f=k(b);if(e.type==="boolean"){var g=e.value;switch(f){case"bold":return babelHelpers["extends"]({},a,{bold:g});case"italic":return babelHelpers["extends"]({},a,{italic:g});case"underline":return babelHelpers["extends"]({},a,{underline:g});case"doubleunderline":return babelHelpers["extends"]({},a,{doubleunderline:g});case"strikethrough":return babelHelpers["extends"]({},a,{strikethrough:g});default:throw c("unrecoverableViolation")(b+" does not refer to a supported UEStyleID.","unified_editor")}}if(e.type==="string")switch(f){case"align":g=d("UEUserInterfacePropertyAndStateUtils").getAsAlignPropertyValueEnforce(e.value);return babelHelpers["extends"]({},a,{align:g});default:throw c("unrecoverableViolation")(b+" does not refer to a supported UEStyleID.","unified_editor")}throw c("unrecoverableViolation")("Only boolean and string types currently supported.","unified_editor")}function b(a,b){if(typeof a!=="string")throw c("unrecoverableViolation")("Only string attributes are supported.","unified_editor");b=b.getStyle(a);if(!i.has(b.properties.type))throw c("unrecoverableViolation")("getParagraphStyleIDForAttribute is invalid for non-paragraph style type: "+b.properties.type,"unified_editor");b=b.isAnonymousStyle===!0?b.parentParagraphStyle:b.id;if(b==null)throw c("unrecoverableViolation")("Could not get paragraph styleID for attribute "+a,"unified_editor");return b}function e(a,b,c){c=c.getStyle(a);return n(b,c)}function f(a,b,c,e){var f=d("UEUserInterfacePropertyAndStateUtils").getAsCharacterPropertyKey(b);return f!=null?d("UECharacterStyleUtils").getNewCharacterStyleFromStyleAndValue(a,f,c,e):m(a,b,c)}function m(a,b,d){if(d.type!=="string")throw c("unrecoverableViolation")("Only string types currently supported.","unified_editor");if(a==null)throw c("unrecoverableViolation")("style should not be null for paragraph styles.","unified_editor");if((h||(h=c("areEqual")))(d,n(b,a)))throw c("unrecoverableViolation")("Style and newStyleValue equate, so caller should not call this method.","unified_editor");b=l(a.properties,b,d);d=(a==null?void 0:a.isAnonymousStyle)===!0?a==null?void 0:a.parentParagraphStyle:a==null?void 0:a.id;return j(b,null,a==null?void 0:a.id,d)}function n(a,b){a=k(a);return a==="align"?{type:"string",value:b.properties[a]||"LEFT"}:{type:"boolean",value:b.properties[a]===!0}}function o(a){a=c("md5")(c("stableStringify")(a));if(a==null)throw c("unrecoverableViolation")("md5 of UEStyleProperty cannot be null","unified_editor");return a}function p(a,b){a=a.getStyle(b);var d=a.isAnonymousStyle===!0?a.parentParagraphStyle:a.id;if(d==null)throw c("unrecoverableViolation")("Could not deduce non-null block style id from "+b,"unified_editor");a=Object.keys(c("UEPredefinedStyleIDs")).find(function(a){return c("UEPredefinedStyleIDs")[a]===d});if(a==null)throw c("unrecoverableViolation")("Could not find block type for styleID: "+b+" in config","unified_editor");switch(a){case"bulletedList":case"numberedList":case"checklist":return"list";case"paragraph":case"caption":case"listItem":case"headingOne":case"headingTwo":case"blockQuote":return a;default:throw c("unrecoverableViolation")("Could not determine block type from style id - "+b,"unified_editor")}}function q(a,b,c){return a.blockNodesByType[p(b,c)]}function r(a){switch(a){case"blockquote":case"bullets":case"checklist":case"heading1":case"heading2":case"listItem":case"numbered":case"normal":case"caption":return a;default:throw c("unrecoverableViolation")("Invalid predefined paragraph styleID - "+a,"unified_editor")}}function s(a){switch(a){case"bullets":case"numbered":case"checklist":return"LIST_STYLES";case"normal":case"caption":case"heading1":case"heading2":case"blockquote":return"PARAGRAPH_STYLES";case"listItem":return null;default:throw c("unrecoverableViolation")("Could not determine AttributeType from style id - "+a,"unified_editor")}}function t(a,b){return b.reduce(function(b,c){c=d("UERichTextStringUtils").getUEValueFromAttribute(c);if(c==null)return b;switch(c.type){case"link_smart_field":case"footnote_smart_field":case"external_smart_field":if(c.value.styleID!=null&&a.hasStyle(c.value.styleID)){c=a.getStyle(c.value.styleID).properties;return babelHelpers["extends"]({},b,c)}else return b;default:return b}},{type:"CHARACTER"})}var u={center:"H_CENTER",justify:"H_JUSTIFIED",left:"H_LEFT",right:"H_RIGHT"},v={H_CENTER:"center",H_JUSTIFIED:"justify",H_LEFT:"left",H_RIGHT:"right"};g.createStyleWithProperties=j;g.getPredefinedStyleIDFromPropertyKeyEnforce=a;g.getStylePropertyForUserInterfacePropertyKeyEnforce=k;g.createPropertiesWithStyleValue=l;g.getParagraphStyleIDForAttribute=b;g.getStyleValueFromStyleID=e;g.getNewStyleFromStyleAndValue=f;g.getStyleValueFromPropertyKey=n;g.generateID=o;g.getBlockNodeTypeFromStyleID=p;g.getBlockClassFromStyleID=q;g.assertAsPredefinedParagraphStyleID=r;g.getAttributeTypeForPredefinedStyleID=s;g.getUEStyleForAttributes=t;g.HTMLAlignToUEAlignMap=u;g.UEAlignToHTMLAlignMap=v}),98);
__d("UETableCellNode",["UEEmbeddableDocumentNode","UEHeadlessUtils","UEObjectNode","UETableRowNode","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";a=function(a){babelHelpers.inheritsLoose(e,a);e.create=function(){return new e(this.getDefaultBaseConstructorProps())};var b=e.prototype;b.setParent=function(a){if(!(a instanceof c("UETableRowNode")))throw c("unrecoverableViolation")("parent of UETableCellNode has to be UETableRowNode","unified_editor");this.$UETableCellNode$p_2=a;return this};b.initContent=function(){this.$UETableCellNode$p_1=c("UEEmbeddableDocumentNode").create();return this};b.clone=function(a){var b,c=this.cloneNodeBase(a,new this.constructor(this.getBasePropsForClone(a)));c.$UETableCellNode$p_1=(b=this.$UETableCellNode$p_1)==null?void 0:b.clone(a);(b=this.$UETableCellNode$p_1)==null?void 0:b.setParent(this);return c};function e(b){var c;c=a.call(this,"TABLE-CELL",b)||this;c.getParent=function(){return c.$UETableCellNode$p_2};c.getParentEnforce=function(){return d("UEHeadlessUtils").assertNonNull(c.getParent(),"parent node UETableRowNode should not be null")};return c}return e}(c("UEObjectNode"));a.SUPPORTED_PROPERTIES_KEYS_DEFAULTS=new Map([["IS_HEADER",{type:"boolean",value:!1}],["BACKGROUNDFILL",null]]);g["default"]=a}),98);
__d("UETableColumnNode",["UEHeadlessUtils","UEObjectNode","UETableNode","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";a=function(a){babelHelpers.inheritsLoose(e,a);e.create=function(){return new e(this.getDefaultBaseConstructorProps())};var b=e.prototype;b.setParent=function(a){if(!(a instanceof c("UETableNode")))throw c("unrecoverableViolation")("parent of UETableColumn has to be UETableNode","unified_editor");this.$UETableColumnNode$p_1=a;return this};b.clone=function(a){return this.cloneNodeBase(a,new this.constructor(this.getBasePropsForClone(a)))};function e(b){var c;c=a.call(this,"TABLE-COLUMN",b)||this;c.getParent=function(){return c.$UETableColumnNode$p_1};c.getParentEnforce=function(){return d("UEHeadlessUtils").assertNonNull(c.getParent(),"parent node UETableNode should not be null")};return c}return e}(c("UEObjectNode"));a.SUPPORTED_PROPERTIES_KEYS_DEFAULTS=new Map([["WIDTH",{type:"string",value:"UE_AUTO_SIZE_WIDTH"}]]);g["default"]=a}),98);
__d("UETableNode",["UENodeUtils","UETableRowNode","UEVisualObjectNode","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";a=function(a){babelHelpers.inheritsLoose(e,a);e.create=function(){return new e(this.getDefaultVisualObjectConstructorProps())};var b=e.prototype;b.addChildAtIdx=function(a,b){if(!(a instanceof c("UETableRowNode")))throw c("unrecoverableViolation")("Child of UETableNode has to be UETableRowNode","unified_editor");return d("UENodeUtils").addChildAtIdxUtil(this.$UETableNode$p_1,a,b)};b.appendChild=function(a){if(!(a instanceof c("UETableRowNode")))throw c("unrecoverableViolation")("Child of UETableNode has to be UETableRowNode","unified_editor");return d("UENodeUtils").appendChildUtil(this.$UETableNode$p_1,a)};b.clone=function(a){var b=this.cloneNodeBase(a,new this.constructor(this.getVisualObjectPropsForClone(a)));b.$UETableNode$p_2=this.$UETableNode$p_2.map(function(c){var d=c.clone(a);d.setParent(b);return c.clone(a)});return b};function e(b){var c;c=a.call(this,"TABLE",b)||this;c.$UETableNode$p_1=[];c.$UETableNode$p_2=[];c.getChildren=function(){return d("UENodeUtils").getChildrenUtil(c.$UETableNode$p_1)};c.getChildAtIdx=function(a){return d("UENodeUtils").getChildAtIdxUtil(c.$UETableNode$p_1,a)};c.removeChildAtIdx=function(a){return d("UENodeUtils").removeChildAtIdxUtil(c.$UETableNode$p_1,a)};c.removeChildById=function(a){return d("UENodeUtils").removeChildByIdUtil(c.$UETableNode$p_1,a,function(a,b){return a.getID()===b})};c.getColumnAtIdx=function(a){return d("UENodeUtils").getChildAtIdxUtil(c.$UETableNode$p_2,a)};c.addColumnAtIdx=function(a,b){return d("UENodeUtils").addChildAtIdxUtil(c.$UETableNode$p_2,a,b)};c.appendColumn=function(a){return d("UENodeUtils").appendChildUtil(c.$UETableNode$p_2,a)};c.removeColumn=function(a){return d("UENodeUtils").removeChildAtIdxUtil(c.$UETableNode$p_2,a)};c.removeColumnById=function(a){return d("UENodeUtils").removeChildByIdUtil(c.$UETableNode$p_2,a,function(a,b){return a.getID()===b})};return c}return e}(c("UEVisualObjectNode"));a.SUPPORTED_PROPERTIES_KEYS_DEFAULTS=new Map([["WIDTH",{type:"string",value:"UE_AUTO_SIZE_WIDTH"}],["HAS_STROKE",{type:"boolean",value:!0}],["STROKEWIDTH",{type:"string",value:"UE_STROKE_THICKNESS_DEFAULT"}],["STROKEPATTERN",{type:"string",value:"UE_STROKE_PATTERN_DEFAULT"}]]);g["default"]=a}),98);
__d("UETableRowNode",["UEHeadlessUtils","UENodeUtils","UEObjectNode","UETableCellNode","UETableNode","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";a=function(a){babelHelpers.inheritsLoose(e,a);e.create=function(){return new e(this.getDefaultBaseConstructorProps())};var b=e.prototype;b.setParent=function(a){if(!(a instanceof c("UETableNode")))throw c("unrecoverableViolation")("parent of UETableRow has to be UETableNode","unified_editor");this.$UETableRowNode$p_2=a;return this};b.addChildAtIdx=function(a,b){if(!(a instanceof c("UETableCellNode")))throw c("unrecoverableViolation")("Child of UETableRowNode has to be UETableRowNode","unified_editor");return d("UENodeUtils").addChildAtIdxUtil(this.$UETableRowNode$p_1,a,b)};b.appendChild=function(a){if(!(a instanceof c("UETableCellNode")))throw c("unrecoverableViolation")("Child of UETableRowNode has to be UETableCellNode","unified_editor");return d("UENodeUtils").appendChildUtil(this.$UETableRowNode$p_1,a)};b.clone=function(a){return this.cloneNodeBase(a,new this.constructor(this.getBasePropsForClone(a)))};function e(b){var c;c=a.call(this,"TABLE-ROW",b)||this;c.$UETableRowNode$p_1=[];c.getParent=function(){return c.$UETableRowNode$p_2};c.getParentEnforce=function(){return d("UEHeadlessUtils").assertNonNull(c.getParent(),"parent node UETableNode should not be null")};c.getChildren=function(){return d("UENodeUtils").getChildrenUtil(c.$UETableRowNode$p_1)};c.getChildAtIdx=function(a){return d("UENodeUtils").getChildAtIdxUtil(c.$UETableRowNode$p_1,a)};c.removeChildAtIdx=function(a){return d("UENodeUtils").removeChildAtIdxUtil(c.$UETableRowNode$p_1,a)};c.removeChildById=function(a){return d("UENodeUtils").removeChildByIdUtil(c.$UETableRowNode$p_1,a,function(a,b){return a.getID()===b})};return c}return e}(c("UEObjectNode"));a.SUPPORTED_PROPERTIES_KEYS_DEFAULTS=new Map([["IS_HEADER",{type:"boolean",value:!1}],["HEIGHT",{type:"string",value:"UE_AUTO_SIZE_HEIGHT"}]]);g["default"]=a}),98);
__d("getOriginalTextRangeForLocalCharacterStyleDiff",["filterNulls","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b){a=c("filterNulls")(a.getChanges().map(function(a){return a.atomicChange}));if(a.length===0||a.every(function(a){return a.type==="UPDATE_TEXT_ATTRIBUTE"&&a.attributeType==="CHARACTER_STYLES"})===!1)return[];var d={charIndex:0,length:0};a=h(a).sort(function(a,b){return((a=a.textRange)==null?void 0:a.charIndex)-b.textRange.charIndex});for(var e=0;e<=a.length-1;e++){var f=a[e];e===0?(d.charIndex=f.textRange.charIndex,d.length=f.textRange.length):f.textRange.charIndex===d.charIndex+d.length&&(d.length+=f.textRange.length)}return[[{id:b,range:d,type:"text"}]]}function h(a){return a.map(function(a){if(a.type!=="UPDATE_TEXT_ATTRIBUTE"||a.attributeType!=="CHARACTER_STYLES")throw c("unrecoverableViolation")("atomic change must be character styles","unified_editor");return a})}g["default"]=a}),98);
__d("UECollabriRichTextStringNodeController",["UECollabriObjectNodeController","UEDiff","UEDiffUtils","UEHeadlessUtils","getOriginalTextRangeForLocalCharacterStyleDiff","gkx","transformChildrenArrayDeltaToDiff","transformDeltaToDiff","yjs"],(function(a,b,c,d,e,f,g){"use strict";a=function(a){babelHelpers.inheritsLoose(e,a);var b=e.prototype;b.getCollabriText=function(){return this.$UECollabriRichTextStringNodeController$p_1};b.getCollabriTextObserver=function(){return this.$UECollabriRichTextStringNodeController$p_4};b.getCollabriChildren=function(){return this.$UECollabriRichTextStringNodeController$p_2};b.getCollabriChildrenObserver=function(){return this.$UECollabriRichTextStringNodeController$p_3};function e(b,e,f,g,h){var i;i=a.call(this,b,e,f,g,h)||this;i.$UECollabriRichTextStringNodeController$p_1=d("UEHeadlessUtils").assertNonNull(f.get("text"),"cannot get text from Collabri rich tex node");i.$UECollabriRichTextStringNodeController$p_2=d("UEHeadlessUtils").assertNonNull(f.get("children"),"cannot get text from Collabri rich tex node");i.$UECollabriRichTextStringNodeController$p_3=i.getCollabriChildrenArray().observe(function(a,b){if(!c("gkx")("5304"))return;a=a==null?void 0:(a=a.changes)==null?void 0:a.delta;if(a==null||a.length===0)return;var f=i.getCollabriClient().clientId;if(b!=null&&(b.origin===f||b.origin instanceof d("yjs").UndoManager)){b=(f=g.getLocalDiffFromCollabri())!=null?f:c("UEDiff").createEmptyDiff().createCollabriDiff();f=c("transformChildrenArrayDeltaToDiff")(i.getUENode().getID(),a);b.setCurrentSelection(c("getOriginalTextRangeForLocalCharacterStyleDiff")(f,e.getID()));b.setCollabriOrigin("local");g.setLocalDiffFromCollabri(d("UEDiffUtils").appendDiffChanges(f,b))}else{b=(f=g.getRemoteDiffFromCollabri())!=null?f:c("UEDiff").createEmptyDiff().createCollabriDiff();f=c("transformChildrenArrayDeltaToDiff")(i.getUENode().getID(),a);b.setCollabriOrigin("remote");g.setRemoteDiffFromCollabri(d("UEDiffUtils").appendDiffChanges(b,f))}});i.$UECollabriRichTextStringNodeController$p_4=i.getCollabriText().observe(function(a,b){a=a.delta;if(a.length===0)return;var f=i.getCollabriClient().clientId;if(b!=null&&(b.origin===f||b.origin instanceof d("yjs").UndoManager)){b=(f=g.getLocalDiffFromCollabri())!=null?f:c("UEDiff").createEmptyDiff().createCollabriDiff();f=c("transformDeltaToDiff")(i.getUENode().getID(),a,!1);b.setCurrentSelection(c("getOriginalTextRangeForLocalCharacterStyleDiff")(f,e.getID()));b.setCollabriOrigin("local");g.setLocalDiffFromCollabri(d("UEDiffUtils").appendDiffChanges(b,f))}else{f=(b=g.getRemoteDiffFromCollabri())!=null?b:c("UEDiff").createEmptyDiff().createCollabriDiff();b=c("transformDeltaToDiff")(i.getUENode().getID(),a,!0);f.setCollabriOrigin("remote");g.setRemoteDiffFromCollabri(d("UEDiffUtils").appendDiffChanges(f,b))}});return i}b.dispose=function(){a.prototype.dispose.call(this)};return e}(c("UECollabriObjectNodeController"));g["default"]=a}),98);
__d("transformChildrenArrayDeltaToDiff",["UEComponentNode","UEDiff"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b){var d=c("UEDiff").createEmptyDiff().createCollabriDiff();b.forEach(function(b){b=b.insert;var e;b!=null&&typeof b==="object"&&Object.values(b).forEach(function(b,d){e=[];if(typeof b==="string"){b=JSON.parse(b);var f=new Map(),g=b.properties.find(function(a){return a[0]==="COMPONENTID"});g=(g=g[1])==null?void 0:g.value;f.set("COMPONENTID",{type:"string",value:g});e.push({index:d+1,parentKey:a,type:"INSERT",value:{type:"node",value:new(c("UEComponentNode"))({annotation:null,captionLocation:null,id:b.id,props:f})}})}});(b=e)==null?void 0:b.forEach(function(a){a={atomicChange:a};d.pushChanges(a)})});return d.createDiffFromCollabri()}g["default"]=a}),98);
__d("transformDeltaToDiff",["UEDiff","UEPredefinedStyleIDs","UERichTextCollabConstant","UETextArrayBehaviors"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b,d){var e=c("UEDiff").createEmptyDiff().createCollabriDiff(),f=0;b.forEach(function(b){var c=b.attributes,g=b["delete"],l=b.insert;b=b.retain;c=k(c);var m;if(l!=null&&typeof l==="string"){m=h(a,f,l,d);if(c!=null){var n,o=i(a,f,l.length,c,d);(n=m).push.apply(n,o)}f+=l.length}else b!=null?(c!=null&&(m=i(a,f,b,c,d)),f+=b):g!=null&&(m=j(a,f,g,d));(n=m)==null?void 0:n.forEach(function(a){a={atomicChange:a};e.pushChanges(a)})});return e.createDiffFromCollabri()}function h(a,b,c,d){b={charIndex:b,excludeTrailingBlock:!0,length:0};return[{editorData:l(d),nodeKey:a,textRange:b,type:"REPLACE_TEXT",value:c}]}function i(a,b,e,f,g){return Object.entries(f).map(function(f){var h=f[0];f=f[1];f=f;h=h;var i=d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_APPLIES_TO_BLOCKS",h);i&&f===null&&(f=c("UEPredefinedStyleIDs").paragraph);i={charIndex:b,excludeTrailingBlock:!0,length:e};return{attribute:f===d("UERichTextCollabConstant").NULL_ATTRIBUTE_VALUE?null:f,attributeType:h,editorData:l(g),nodeKey:a,textRange:i,type:"UPDATE_TEXT_ATTRIBUTE"}}).filter(Boolean)}function j(a,b,c,d){b={charIndex:b,length:c};return[{editorData:l(d),nodeKey:a,textRange:b,type:"REPLACE_TEXT",value:""}]}function k(a){if(a==null)return null;a=Object.entries(a).reduce(function(a,b){var c=b[0];b=b[1];if(c!==d("UERichTextCollabConstant").INVISIBLE_PARAGRAPH_ATTRIBUTE&&b!==d("UERichTextCollabConstant").UNSET_ATTRIBUTE_VALUE){var e;return babelHelpers["extends"]({},a,(e={},e[c]=b,e))}return a},{});return Object.keys(a).length>0?a:null}function l(a){return{isRemote:a,isTypingEvent:!0}}g["default"]=a}),98);
__d("UERichTextFrameNode",["fbt","UEHeadlessUtils","UERichTextShadowStructureUtils","UERichTextStringNode","UEVisualObjectNode","convertShadowHostToHTML","mapMapToArray","unrecoverableViolation"],(function(a,b,c,d,e,f,g,h){"use strict";a=function(a){babelHelpers.inheritsLoose(e,a);e.create=function(){return new e(this.getDefaultVisualObjectConstructorProps())};var b=e.prototype;b.getContent=function(){var a=d("UEHeadlessUtils").assertToNodeOfType(this.getChildAtIdx(0),c("UERichTextStringNode"));if(!(a instanceof c("UERichTextStringNode")))throw c("unrecoverableViolation")("String node not found inside frame with id: "+this.getID(),"unified_editor");return a};b.onAddedToDocument=function(a){this.getContent().onAddedToDocument(a)};b.isValid=function(){return a.prototype.isValid.call(this)&&this.getContent().isValid()};b.clone=function(a){return this.cloneNodeBase(a,new this.constructor(this.getVisualObjectPropsForClone(a)))};b.cloneForSelection=function(a,b,c){return this.cloneForSelectionBase(a,b,new this.constructor(this.getVisualObjectPropsForClone(a)),c)};b.isEqual=function(a,b){if(!(a instanceof e))throw c("unrecoverableViolation")("cannot compare UERichTextFrameNode with other node","unified_editor");return this.isEqualBase(a,b)};b.toRDFBJson=function(){return this.toRDFBJsonBase()};e.constructVisualObjectFromJSON=function(a,b,c,d){return new this(d)};b.toPlainText=function(){return this.getContent().getText()};b.toHTML=function(){var a=new Map([["heading1","h1"],["heading2","h2"],["normal","p"],["blockquote","blockquote"],["numbered","ol"],["bullets","ul"],["listItem","li"]]),b=this.getContent();b=d("UERichTextShadowStructureUtils").createShadowStructureForTextRange(b,{charIndex:0,length:b.getText().length});return c("convertShadowHostToHTML")(b,a,this.getStyleSheet())};b.getAriaLabel=function(){return h._("__JHASH__1TKWOjjHInG__JHASH__")};b.createLayout=function(){return{childKeys:[],height:null,hint:{height:0,type:"default"},isVisual:!0,model:this,parentKey:this.getID(),type:"rich-text-frame",width:null}};function e(b){b=babelHelpers["extends"]({},b);return a.call(this,"RICH-TEXT-FRAME",b)||this}return e}(c("UEVisualObjectNode"));a.SUPPORTED_PROPERTIES_KEYS_DEFAULTS=new Map([].concat(c("mapMapToArray")(c("UEVisualObjectNode").SUPPORTED_PROPERTIES_KEYS_DEFAULTS,function(a,b){return[b,a]}),[["PADDINGS",{type:"array_number",value:[0,0,0,0]}],["VALIGNMENT",{type:"string",value:"UE_VALIGN_TOP"}],["SELECTION_BEHAVIOR",{type:"string",value:"UE_HIERARCHICAL"}]]));a.SUPPORTED_USER_INTERFACE_PROPERTIES=new Set(["BOLD_CHARACTER_STYLE","ITALIC_CHARACTER_STYLE","UNDERLINE_CHARACTER_STYLE","DOUBLE_UNDERLINE_CHARACTER_STYLE","STRIKETHROUGH_CHARACTER_STYLE","PARAGRAPH_STYLE","PARAGRAPH_ALIGN","PARAGRAPH_INDENT_LEVEL","LIST_STYLE"]);g["default"]=a}),98);
__d("UERichTextStringNode",["UEComponentNode","UEDiff","UEHeadlessUtils","UENodeUtils","UEObjectNode","UERichTextFrameNode","UERichTextShadowStructureUtils","UERichTextStringDiffBuilder","UERichTextStringModelMutator","UERichTextStringMutatorUtils","UERichTextStringUtils","UERichTextStringValidityUtils","convertShadowHostToHTML","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";a=function(a){babelHelpers.inheritsLoose(e,a);e.create=function(a){a===void 0&&(a="");return new e(babelHelpers["extends"]({attributes:new Map(),text:a.length>0?d("UERichTextStringUtils").stringByRemovingUnwantedCharacters(a):""},this.getDefaultBaseConstructorProps()))};var b=e.prototype;b.getText=function(){return this.$UERichTextStringNode$p_1};b.internalSetText_DO_NOT_USE=function(a){this.$UERichTextStringNode$p_1=a};b.addChildAtIdx=function(a,b){if(!(a instanceof c("UEComponentNode")))throw c("unrecoverableViolation")("Child of UERichTextStringNode has to be UEComponentNode","unified_editor");return d("UENodeUtils").addChildAtIdxUtil(this.$UERichTextStringNode$p_3,a,b)};b.appendChild=function(a){if(!(a instanceof c("UEComponentNode")))throw c("unrecoverableViolation")("Child of UERichTextStringNode has to be UEComponentNode","unified_editor");return d("UENodeUtils").appendChildUtil(this.$UERichTextStringNode$p_3,a)};b.setParent=function(a){if(a!=null&&!(a instanceof c("UERichTextFrameNode")))throw c("unrecoverableViolation")("parent of UERichTextString has to be UERichTextFrame","unified_editor");this.$UERichTextStringNode$p_2=a;return this};b.isValid=function(){return d("UERichTextStringValidityUtils").isRichTextStringValid(this)};b.isRichTextStringValidEnforce=function(){if(this.isValid()===!1)throw c("unrecoverableViolation")("RichTextString is not valid.","unified_editor")};b.onAddedToDocument=function(b){a.prototype.onAddedToDocument.call(this,b),d("UERichTextStringModelMutator").initializeWithDocument(this,b)};b.clone=function(a){a=this.cloneNodeBase(a,new this.constructor(babelHelpers["extends"]({attributes:d("UERichTextStringModelMutator").cloneAttributes(this.attributes,a),text:this.$UERichTextStringNode$p_1},this.getBasePropsForClone(a))));if(!a.isValid())throw c("unrecoverableViolation")("Cloned mode is not valid.","unified_editor");return a};b.cloneForSelection=function(a,b,e){a=this.cloneForSelectionBase(a,b,new this.constructor(babelHelpers["extends"]({attributes:new Map(),text:""},this.getBasePropsForClone(a))),e);d("UERichTextStringModelMutator").initializeWithDocument(a,a.getDocumentEnforce());if(b.length!==1||b[0].length!==1||b[0][0].type!=="text")throw c("unrecoverableViolation")("Invalid selection passed in for rich-text-string cloneForSelection","unified_editor");e=b[0][0].range;if(e.length===0)return a;b=d("UERichTextStringDiffBuilder").updateDiffForRichTextStringForTextReplacementWithRichTextString(c("UEDiff").createEmptyDiff(),this,a,e,{charIndex:0,length:0});d("UERichTextStringMutatorUtils").runDiffWithRichTextString(a,b);if(!a.isValid())throw c("unrecoverableViolation")("Cloned mode is not valid.","unified_editor");return a};b.isEqual=function(a,b){if(!(a instanceof e))throw c("unrecoverableViolation")("cannot compare UERichTextStringNode with other node","unified_editor");return this.isEqualBase(a,b)&&d("UERichTextStringUtils").areRichTextStringsEqual(this,a,b)};b.toRDFBJson=function(){return babelHelpers["extends"]({},this.toRDFBJsonBase(),{attributes:d("UERichTextStringUtils").serializeTextAttributesToRDFBJson(this.attributes),text:this.getText()})};e.constructFromJSON=function(a,b,c,e){var f=d("UEHeadlessUtils").assertNonNull(a==null?void 0:a.attributes,"stylesMap is missing in fromRDFBJson");f=d("UERichTextStringUtils").deserializeRDFBJsonToTextAttributes(f,b,c);b=d("UEHeadlessUtils").assertNonNull(a==null?void 0:a.text,"text is missing in fromRDFBJson");return new this(babelHelpers["extends"]({attributes:f,text:b},e))};b.toPlainText=function(){return this.getText()};b.toHTML=function(){var a=new Map([["heading1","h1"],["heading2","h2"],["normal","p"],["blockquote","blockquote"],["numbered","ol"],["bullets","ul"],["listItem","li"]]),b=d("UERichTextShadowStructureUtils").createShadowStructureForTextRange(this,{charIndex:0,length:this.getText().length});return c("convertShadowHostToHTML")(b,a,this.getStyleSheet())};b.doesSupportMarkdown=function(){var a;return((a=this.getRoot())==null?void 0:a.getViewModel().hasBehavior("ENABLE_RICH_TEXT_STRING_MARKDOWN"))?!0:!1};b.createLayout=function(){return{childKeys:[],collabPresences:new Map(),collabSelections:new Map(),editorAPI:null,isVisual:!1,model:this,parentKey:this.getID(),type:"rich-text-string"}};function e(b){var c,e=b.attributes,f=b.text;b=babelHelpers.objectWithoutPropertiesLoose(b,["attributes","text"]);c=a.call(this,"RICH-TEXT-STRING",b)||this;c.$UERichTextStringNode$p_3=[];c.getChildren=function(){return d("UENodeUtils").getChildrenUtil(c.$UERichTextStringNode$p_3)};c.getChildAtIdx=function(a){return d("UENodeUtils").getChildAtIdxUtil(c.$UERichTextStringNode$p_3,a)};c.removeChildAtIdx=function(a){return d("UENodeUtils").removeChildAtIdxUtil(c.$UERichTextStringNode$p_3,a)};c.removeChildById=function(a){return d("UENodeUtils").removeChildByIdUtil(c.$UERichTextStringNode$p_3,a,function(a,b){return a.getID()===b})};c.getParent=function(){return c.$UERichTextStringNode$p_2};c.getParentEnforce=function(){return d("UEHeadlessUtils").assertNonNull(c.getParent(),"parent node UERichTextFrame should not be null")};c.$UERichTextStringNode$p_1=f;c.attributes=e;return c}return e}(c("UEObjectNode"));a.SUPPORTED_PROPERTIES_KEYS_DEFAULTS=new Map([["PADDINGS",{type:"array_number",value:[4,4,4,4]}]]);a.SUPPORTED_USER_INTERFACE_PROPERTIES=new Set(["BOLD_CHARACTER_STYLE","ITALIC_CHARACTER_STYLE","UNDERLINE_CHARACTER_STYLE","DOUBLE_UNDERLINE_CHARACTER_STYLE","STRIKETHROUGH_CHARACTER_STYLE","PARAGRAPH_STYLE","PARAGRAPH_ALIGN","PARAGRAPH_INDENT_LEVEL","LINK_SMART_FIELD","FOOTNOTE_SMART_FIELD","LIST_STYLE","INLINE","EXTERNAL_SMART_FIELD"]);g["default"]=a}),98);
__d("UERichTextFrameDiffBuilder",["UERichTextStringDiffBuilder"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b,c){var e=b.getContent();c=c.getContent();var f=e.getText(),g=c.getText(),h=g.length;g=f.charAt(0)!=="\n"&&g.charAt(g.length-1)!=="\n";g&&(a.pushChanges({atomicChange:{editorData:{isTypingEvent:!1},nodeKey:c.getID(),textRange:{charIndex:h,length:0},type:"REPLACE_TEXT",value:"\n"}}),h++);e.getText().length!==0&&d("UERichTextStringDiffBuilder").updateDiffForRichTextStringForTextReplacementWithRichTextString(a,e,c,{charIndex:0,length:f.length},{charIndex:h,length:0});a.pushChanges({atomicChange:{nodeKey:b.getID(),nodeType:b.getNodeType(),type:"REMOVE"}});return a}g.updateDiffForConcatRichTextStringFrames=a}),98);
__d("UERichTextStringBlockArraysDiffBuilder",["UEDiffUtils","UEHeadlessUtils","UERichTextStringLowLevelUtils","UERichTextStringUtils","UETextAttributeAndTextRangeUtils","areEqual","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";var h;function a(a,b,c){return a}var i=!0;function b(a,b,c){a=a;var e=d("UEHeadlessUtils").assertNonNull(c.richTextString.attributes.get(b),"attribute type "+b+"should not be null when update diff"),f=d("UERichTextStringLowLevelUtils").getEdgeBeforeCharIndex(c.richTextString,b,c.replacementRange.charIndex);f=e[f];var g=f.attribute;if(c.blockAttributeRange.length>0&&d("UETextAttributeAndTextRangeUtils").getAttributeIndexAfterEndOfRange(c.blockAttributeRange)g.index&&(h||(h=c("areEqual")))((m=j)==null?void 0:m.attribute,f[l].attribute)){m=d("UEHeadlessUtils").assertNonNull(d("UEHeadlessUtils").assertNonNull(d("UEDiffUtils").getLastChange(a),"last change of current diff should not be null").atomicChange,"atomicChange from last change should not be null");e=e.popChange();if(m.type!=="UPDATE_TEXT_ATTRIBUTE")throw c("unrecoverableViolation")("Expected the atomic change of type UPDATE_TEXT_ATTRIBUTE","unified_editor");m=d("UETextAttributeAndTextRangeUtils").getUnionOfTextRanges(m.textRange,n,!0);m={attribute:b.attributeToUpdateWith,attributeType:b.attributeTypeToUpdate,editorData:b.richTextEventData,nodeKey:b.richTextString.getID(),textRange:m,type:"UPDATE_TEXT_ATTRIBUTE"};e=e.pushChanges({atomicChange:m})}else{j=f[l];m=i&&n.length>1?{charIndex:n.charIndex,excludeTrailingBlock:!0,length:1}:n;n={attribute:b.attributeToUpdateWith,attributeType:b.attributeTypeToUpdate,editorData:b.richTextEventData,nodeKey:b.richTextString.getID(),textRange:m,type:"UPDATE_TEXT_ATTRIBUTE"};e=e.pushChanges({atomicChange:n})}}return e}function j(a,b,c,d){var e=a;d.specialCharacters.forEach(function(a){if(a.characterType==="BLOCK_CHARACTER"){a=d.replacementRange.charIndex+a.charIndex+1;a={charIndex:a,excludeTrailingBlock:!0,length:d.replacementRange.charIndex+d.textToInsertLength-a};a=i&&a.length>1?{charIndex:a.charIndex,excludeTrailingBlock:!0,length:1}:a;a={attribute:b,attributeType:c,editorData:d.richTextEventData,nodeKey:d.richTextString.getID(),textRange:a,type:"UPDATE_TEXT_ATTRIBUTE"};e=e.pushChanges({atomicChange:a})}});return e}function k(a,b,c,d){a=a;var e={charIndex:d.replacementRange.charIndex,excludeTrailingBlock:!0,length:0};b={attribute:b,attributeType:c,editorData:d.richTextEventData,nodeKey:d.richTextString.getID(),textRange:e,type:"UPDATE_TEXT_ATTRIBUTE"};a=a.pushChanges({atomicChange:b});return a}g.updateDiffForAttributesForTextReplacementForBlockArrays=a;g.requiresCollabriBlockCompatibility=i;g.updateDiffForAttributesForAfterTextReplacementForBlockArrays=b;g.updateDiffForMutatingBlockArrayAttributes=e;g.updateDiffForInsertingTextWithBlocksInSource=j;g.updateDiffForRemovingEntireInitialBlock=k}),98);
__d("UERichTextStringCharacterArraysDiffBuilder",["UEDiff","UEHeadlessUtils","UERichTextStringDiffBuilderLowLevelUtils","UERichTextStringLowLevelUtils","UERichTextStringRangeBasedUtils","UERichTextStringSegmentedAttributesDiffBuilder","UERichTextStringUtils","UETextArrayBehaviors","UETextAttributeAndTextRangeUtils","UEValueUtils","areEqual","unrecoverableViolation","updateDiffToDeleteNodes"],(function(a,b,c,d,e,f,g){"use strict";var h;function a(a,b,c){if(d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_CONTAINS_SEGMENTED_OR_IMMUTABLE_NODES",b))return d("UERichTextStringSegmentedAttributesDiffBuilder").updateDiffForSegmentedAttributesForTextReplacementForCharacterArrays(a,b,c);a=a;if(c.replacementRange.length>0&&d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_REFERENCES_INLINE_CHARACTER",b)===!0){var e=c.richTextString.attributes.get(b);if(e!=null){b=d("UERichTextStringUtils").getAttributesBuilderStateFromTextReplacementState(null,b,e,c,!1);a=k(a,b,!0)}}return a}function b(a,b){var c="CHARACTER_STYLES",e=a;if(b.insertionStyles.size>0&&b.textToInsertLength>0&&b.replacementRange.length===0&&b.richTextString.attributes.has(c)===!1&&b.specialCharacters.length===0&&d("UERichTextStringLowLevelUtils").getDestinationTextReplacementMode(b.replacementRange,b.textToInsertLength)==="INSERT_TEXT"){var f=[{attribute:null,charIndex:0}];e=j(a,null,c,f,b,!0,!0)}return e}function e(a,b,e){var f=a,g=d("UERichTextStringLowLevelUtils").getDestinationTextReplacementMode(e.replacementRange,e.textToInsertLength),h=d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_SUPPORTS_INSERTION_STYLES",b)===!0&&e.replacementRange.length===0&&e.specialCharacters.length===0&&e.insertionStyles.size>0&&g==="INSERT_TEXT",k=d("UEHeadlessUtils").assertNonNull(e.richTextString.attributes.get(b),"attribute type "+b+"should not be null when update diff"),l=d("UERichTextStringLowLevelUtils").calculateAttributeRangeAffectedByTextRange(e.replacementRange,k);if(l.index>=k.length)throw c("unrecoverableViolation")("Bad attribute range calculation.","unified_editor");switch(g){case"NO_TEXT_REPLACEMENT":case"DELETE_TEXT_NO_BLOCKS":case"DELETE_TEXT_WITH_BLOCKS":break;case"INSERT_TEXT":g=i(b,l.index,k,e,!1);f=j(a,g,b,k,e,!0,h);break;case"REPLACE_TEXT_NO_BLOCKS":case"REPLACE_TEXT_WITH_BLOCKS":g=i(b,l.index,k,e,!0);f=j(a,g,b,k,e,!0);break}return f}function i(a,b,e,f,g){if(d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_CONTAINS_STYLES_THAT_EXTEND_OVER_INSERTIONS",a)){if(g===!1){if(f.replacementRange.charIndex===0)return null;a=b;if(e[b].charIndex===f.replacementRange.charIndex){if(b===0)throw c("unrecoverableViolation")("Expected attributeIndex to be greater than 0.","unified_editor");a--}return e[a].attribute}return e[b].attribute}else if(g===!1){if(f.replacementRange.charIndex===0||f.replacementRange.charIndex===f.richTextString.getText().length)return null;if(e[b].charIndex===f.replacementRange.charIndex){if(b===0)throw c("unrecoverableViolation")("Expected attributeIndex to be greater than 0.","unified_editor");return null}return e[b].attribute}else{a=d("UETextAttributeAndTextRangeUtils").getTextRangeFromAttributeIndex(b,e,f.richTextString.getText().length);if((h||(h=c("areEqual")))(a,f.replacementRange))return null;g=d("UETextAttributeAndTextRangeUtils").isTextRangeContained(f.replacementRange,a);if(g&&f.replacementRange.charIndex>a.charIndex)return e[b].attribute;if(g&&f.replacementRange.charIndex===a.charIndex)return null}return null}function j(a,b,c,e,f,g,h){h===void 0&&(h=!1);if(d("UERichTextStringSegmentedAttributesDiffBuilder").isSegmentedAttribute(b)||d("UERichTextStringSegmentedAttributesDiffBuilder").isImmutableAttribute(b))return a;var i=a,j=b;if(h&&f.insertionStyles.size>0){var l=new Set(),m=f.richTextString.getStyleSheet();f.insertionStyles.forEach(function(a){var c=d("UERichTextStringRangeBasedUtils").getStyleValueFromAttribute(b,a,m,l);c.type==="style"&&l.add(c.value);c=b===null?!0:c.value!==!0;c={type:"boolean",value:c};a=d("UERichTextStringDiffBuilderLowLevelUtils").getDiffAndAttributeForStylePropertyKeyValue(i,f.richTextString,a,c,j,l);c=a[0];a=a[1];i=c;j=a})}a=d("UERichTextStringUtils").getAttributesBuilderStateFromTextReplacementState(j,c,e,f,g);return a.textRangeToUpdate.length===0?i:k(i,a,!0,!0)}function k(a,b,e,f,g){e===void 0&&(e=!1);f===void 0&&(f=!1);g===void 0&&(g=d("UEValueUtils").mapMutatingDifCharsModeToEnum("SELECTION"));a=a;if(b.textRangeToUpdate.length===0)throw c("unrecoverableViolation")("No character array attributes are affected with zero length text range.","unified_editor");var h=b.textRangeToUpdate;f===!1&&b.attributeValues!=null&&d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_REFERENCES_INLINE_CHARACTER",b.attributeTypeToUpdate)===!0&&(a=l(a,b));if(b.attributeValues==null||e){f={attribute:b.attributeToUpdateWith,attributeType:b.attributeTypeToUpdate,editorData:b.richTextEventData,nodeKey:b.richTextString.getID(),textRange:h,type:"UPDATE_TEXT_ATTRIBUTE"};return a.pushChanges({atomicChange:f})}e=b.attributeValues;f=d("UERichTextStringLowLevelUtils").calculateAttributeRangeAffectedByTextRange(h,e);if(e[f.index].charIndex>h.charIndex)throw c("unrecoverableViolation")("Expect attributeRange.index to appear at or prior to textRange.charIndex.","unified_editor");if(f.length===0){var i={attribute:b.attributeToUpdateWith,attributeType:b.attributeTypeToUpdate,editorData:b.richTextEventData,nodeKey:b.richTextString.getID(),textRange:h,type:"UPDATE_TEXT_ATTRIBUTE"};return a.pushChanges({atomicChange:i})}i=d("UETextAttributeAndTextRangeUtils").getCharIndexAfterEndOfRange(h);var j={charIndex:h.charIndex,length:0};if(g===d("UEValueUtils").mapMutatingDifCharsModeToEnum("SELECTION"))for(g=f.index;g=i||k<=0)throw c("unrecoverableViolation")("Bad attributeIndex calculation while updating char arrays.","unified_editor");j={charIndex:m,length:k};if(d("UETextAttributeAndTextRangeUtils").getCharIndexAfterEndOfRange(j)>i||k<=0)throw c("unrecoverableViolation")("Bad attributeIndex calculation while updating char arrays.","unified_editor");m={attribute:b.attributeToUpdateWith,attributeType:b.attributeTypeToUpdate,editorData:b.richTextEventData,nodeKey:b.richTextString.getID(),textRange:j,type:"UPDATE_TEXT_ATTRIBUTE"};a.pushChanges({atomicChange:m})}k=d("UETextAttributeAndTextRangeUtils").getCharIndexAfterEndOfRange(j);if(k=d("UETextAttributeAndTextRangeUtils").getCharIndexAfterEndOfRange(b.textRangeToUpdate))throw c("unrecoverableViolation")("Expect attributeRange.index to appear prior to the end of the textRange.","unified_editor");f.length>0&&e[f.index].charIndex0){(i=a.getChangesMutable()).splice.apply(i,[0,0].concat(g.getChanges()))}return a}g.updateDiffForAttributesForTextReplacementForCharacterArrays=a;g.updateDiffForInsertionStylesForEmptyCharacterArray=b;g.updateDiffForAttributesForAfterTextReplacementForCharacterArrays=e;g.getCharacterAttributeToApplyForTextReplacement=i;g.updateDiffByExtendAttributeOverNewText=j;g.updateDiffForMutatingCharacterArrayAttributes=k;g.updateDiffForRemovingInlineNodes=l}),98);
__d("UERichTextStringDiffBuilder",["UEHeadlessUtils","UERichTextStringCharacterArraysDiffBuilder","UERichTextStringDiffBuilderForReplacement","UERichTextStringDiffBuilderLowLevelUtils","UERichTextStringLowLevelUtils","UERichTextStringRangeBasedUtils","UERichTextStringSparseBlockArraysDiffBuilder","UERichTextStringTextArraysDiffBuilder","UERichTextStringUtils","UETextArrayBehaviors","UETextAttributeAndTextRangeUtils","UEValueUtils","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";function h(a,b,c,e,f,g){g===void 0&&(g=new Set());var h=d("UEHeadlessUtils").assertNonNull(b.attributes.get("PARAGRAPH_STYLES"),"PARAGRAPH_STYLES attribute of rich text string should not be null"),i=d("UERichTextStringLowLevelUtils").calcuateBlockAttributeRangeAffectedByTextRange(e,h,!0);h=d("UERichTextStringLowLevelUtils").getAttributeRangeForBlockRemovalUsingExpandedAttributeRange(d("UERichTextStringLowLevelUtils").calcuateBlockAttributeRangeAffectedByTextRange(e,h),h,c.length,e);i={affectedBlockAttributeRange:i,blockAttributeRange:h,insertionStyles:g,isMarkdownEnabled:b.doesSupportMarkdown(),replacementMode:d("UERichTextStringLowLevelUtils").getDestinationTextReplacementBlocksMode(e,c.length,h),replacementRange:e,richTextEventData:f,richTextString:b,specialCharacters:d("UERichTextStringUtils").findSpecialCharacters(c),textToInsert:c,textToInsertLength:c.length};return d("UERichTextStringDiffBuilderForReplacement").updateDiffForPlainTextReplacement(a,c,i)}function i(a,b,c){c=c;c.excludeTrailingBlock==null&&(d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_APPLIES_TO_BLOCKS",b)&&d("UETextAttributeAndTextRangeUtils").getCharIndexAfterEndOfRange(c)b.getText().length)throw c("unrecoverableViolation")("Source RichTextString and sourceRange do not match.","unified_editor");if(f.length===0)throw c("unrecoverableViolation")("Source range must have length > 0","unified_editor");var h=d("UEHeadlessUtils").assertNonNull(e.attributes.get("PARAGRAPH_STYLES"),"PARAGRAPH_STYLES attribute of rich text string should not be null"),i=b.getText().substr(f.charIndex,f.length),j={isTypingEvent:!1},k=new Set(),l=d("UERichTextStringLowLevelUtils").calcuateBlockAttributeRangeAffectedByTextRange(g,h,!0);h=d("UERichTextStringLowLevelUtils").getAttributeRangeForBlockRemovalUsingExpandedAttributeRange(d("UERichTextStringLowLevelUtils").calcuateBlockAttributeRangeAffectedByTextRange(g,h),h,i.length,g);l={affectedBlockAttributeRange:l,blockAttributeRange:h,insertionStyles:k,isMarkdownEnabled:!1,replacementMode:d("UERichTextStringLowLevelUtils").getDestinationTextReplacementBlocksMode(g,i.length,h),replacementRange:g,richTextEventData:j,richTextString:e,richTextStringSource:b,sourceTextRange:f,specialCharacters:d("UERichTextStringUtils").findSpecialCharacters(i),textToInsert:i,textToInsertLength:i.length};return d("UERichTextStringDiffBuilderForReplacement").updateDiffByMergingRichTextStrings(a,l)}function l(a,b,c,e){var f=a,g="INLINES";e=e;e.length>0&&(f=j(a,c,g,null,e,{isTypingEvent:!1}));f=h(a,c,d("UERichTextStringUtils").UE_INLINE_CHARACTER,e,{isTypingEvent:!1});e={charIndex:e.charIndex,length:1};var i={attributeToUpdateWith:b,attributeTypeToUpdate:g,attributeValues:c.attributes.get(g),richTextEventData:{isTypingEvent:!1},richTextString:c,textRangeToUpdate:e};f=["LIST_STARTS","COMPLETED_STATE"].reduce(function(a,b){return d("UERichTextStringSparseBlockArraysDiffBuilder").cleanUpSparseAttributes(a,i,b)},a);return d("UERichTextStringCharacterArraysDiffBuilder").updateDiffForMutatingCharacterArrayAttributes(f,i,!0)}g.updateDiffForRichTextStringForTextReplacement=h;g.updateDiffForRichTextStringForReplacingAttributesOverTextRange=j;g.updateDiffForRichTextStringForReplacingCharacterStylesOverTextRange=a;g.updateDiffForRichTextStringForReplacingCharacterStyleOverTextRange=b;g.updateDiffForRichTextStringForReplacingParagraphStyleOverTextRange=e;g.updateDiffForRichTextStringForSparseAttributeByParagraph=f;g.updateDiffForRichTextStringForTextReplacementWithRichTextString=k;g.updateDiffToInsertInline=l}),98);
__d("UERichTextStringDiffBuilderForReplacement",["UEHeadlessUtils","UERichTextStringCharacterArraysDiffBuilder","UERichTextStringLowLevelUtils","UERichTextStringMarkdownDiffBuilder","UERichTextStringPatternMatchingDiffBuilder","UERichTextStringPatternMatchingUtils","UERichTextStringSparseBlockArraysDiffBuilder","UERichTextStringTextArraysDiffBuilder","UERichTextStringUtils","UETextArrayBehaviors","UETextAttributeAndTextRangeUtils","mapMapToArray","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b){var c=a;a=d("UEHeadlessUtils").assertNonNull(b.richTextStringSource,"Merge requires RTS source");var e=d("UEHeadlessUtils").assertNonNull(b.sourceTextRange,"Expect sourceRange");e=a.getText().substr(e.charIndex,e.length);var f=new Set();for(var g=b.richTextString.attributes.keys(),h=Array.isArray(g),j=0,g=h?g:g[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var k;if(h){if(j>=g.length)break;k=g[j++]}else{j=g.next();if(j.done)break;k=j.value}k=k;f.has(k)===!1&&f.add(k)}for(k=a.attributes.keys(),j=Array.isArray(k),h=0,k=j?k:k[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){if(j){if(h>=k.length)break;g=k[h++]}else{h=k.next();if(h.done)break;g=h.value}a=g;f.has(a)===!1&&f.add(a)}f.forEach(function(a){c=d("UERichTextStringTextArraysDiffBuilder").updateDiffForAttributesRichTextReplacement(c,a,b)});g={affectedBlockAttributeRange:b.affectedBlockAttributeRange,blockAttributeRange:b.blockAttributeRange,insertionStyles:b.insertionStyles,isMarkdownEnabled:b.isMarkdownEnabled,replacementMode:d("UERichTextStringLowLevelUtils").getDestinationTextReplacementBlocksMode(b.replacementRange,e.length,b.blockAttributeRange),replacementRange:b.replacementRange,richTextEventData:b.richTextEventData,richTextString:b.richTextString,specialCharacters:b.specialCharacters,textToInsert:e,textToInsertLength:e.length};c=i(c,e,g);f.forEach(function(a){c=d("UERichTextStringTextArraysDiffBuilder").updateDiffForAttributesAfterRichTextReplacement(c,a,b)});return c}function b(a,b,c){a=a;if(c.richTextString.attributes.has(b)===!1)return a;var e=null,f=d("UEHeadlessUtils").assertNonNull(c.richTextString.attributes.get(b),"attribute type "+b+"Should not be null when update diff for merging RTS.");e=d("UERichTextStringUtils").getAttributesBuilderStateFromTextReplacementState(e,b,f,c,!1);if(d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_VALUE_NO_SPLIT",b)){b=c.replacementRange;var g=d("UERichTextStringLowLevelUtils").calculateAttributeRangeAffectedByTextRange(c.replacementRange,f);g=d("UETextAttributeAndTextRangeUtils").getAttributeIndexAfterEndOfRange(g);if(gb.charIndex&&g.charIndex0,l=j[e.affectedBlockAttributeRange.index].charIndex===e.replacementRange.charIndex;if(k===!1){if(l===!1)return a;if(d("UERichTextStringPatternMatchingUtils").isBlockWithAttributeIndexEmpty(e.affectedBlockAttributeRange.index,j,e.richTextString.getText().length,!0,d("UETextAttributeAndTextRangeUtils").getCharIndexAfterEndOfRange(e.replacementRange))===!1)return a}k=d("UEHeadlessUtils").assertNonNull(e.sourceTextRange,"Expect sourceRange");j=d("UEHeadlessUtils").assertNonNull(g.getStyleSheet(),"Expect stylesheet.");h=d("UEHeadlessUtils").assertNonNull(h.getStyleSheet(),"Expect stylesheet.");var m=d("UERichTextStringLowLevelUtils").calcuateBlockAttributeRangeAffectedByTextRange(k,i,!0);if(m.length===0)throw c("unrecoverableViolation")("Expected attributes in source text.","unified_editor");var n=-k.charIndex+e.replacementRange.charIndex,o=g.getText().length,p=d("UETextAttributeAndTextRangeUtils").getAttributeIndexAfterEndOfRange(m),q=d("UETextAttributeAndTextRangeUtils").getCharIndexAfterEndOfRange(k);f=(f=e.sourceTextRange)==null?void 0:f.charIndex;var r=!1;if(d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_IS_SPARSE_FOR_BLOCKS",b)&&f!=null){g=d("UEHeadlessUtils").assertNonNull(g.attributes.get("PARAGRAPH_STYLES"),"Expect paragraph styles.");r=!d("UERichTextStringSparseBlockArraysDiffBuilder").isSparseBlockOnNearestParagraphBlock(i,g,f)}for(g=m.index;g=k.length?j=!1:h.attributeToUpdateWith={type:"paragraph_level",value:k[e]}}j&&(a=d("UERichTextStringTextArraysDiffBuilder").updateDiffForMutatingAttributes(a,h));return a},a)}function l(a,b,c,e,f){a=typeof a==="string"?a:null;if(f!=null&&a!=null){f=d("UERichTextStringRangeBasedUtils").getStyleFromStyleIDAndSet(a,f);if(f)return d("UEStyleUtils").getNewStyleFromStyleAndValue(f,b,c,e)}f=a!=null?e.getStyle(a):null;return d("UEStyleUtils").getNewStyleFromStyleAndValue(f,b,c,e)}function e(a){return a.attributeToUpdateWith==null&&a.richTextString.attributes.has(a.attributeTypeToUpdate)===!1}function f(a,b){a=a;var c=b.richTextString.attributes.get(b.attributeTypeToUpdate);if(c==null)return a;b.attributeValues=c;var e=d("UEHeadlessUtils").assertNonNull(b.richTextString.attributes.get("PARAGRAPH_STYLES"),"Paragraph Styles should not be null when updating diff"),f=d("UERichTextStringLowLevelUtils").findBeforeEdgeForAttributeAtCharIndex(b.textRangeToUpdate.charIndex,e),g=d("UERichTextStringLowLevelUtils").calcuateBlockAttributeRangeAffectedByTextRange(b.textRangeToUpdate,c,!0);b.textRangeToUpdate.length===0&&(g={index:g.index,length:1});g.length>0&&c[g.index].charIndex1?{charIndex:g.charIndex,excludeTrailingBlock:!0,length:1}:g;g={attribute:null,attributeType:b.attributeTypeToUpdate,editorData:b.richTextEventData,nodeKey:b.richTextString.getID(),textRange:g,type:"UPDATE_TEXT_ATTRIBUTE"};a=a.pushChanges({atomicChange:g})}return a}g.updateDiffForPropertyKeyOverTextRange=a;g.getDiffAndAttributeForStylePropertyKeyValue=j;g.updateDiffForRichTextStringForSparseAttributeWithTextRuns=b;g.getNewStyleWithAttributeAndNewValue=l;g.hasNoRequiredDiffUpdates=e;g.updateDiffForDeletingSparseBlockArrayAttributes=f}),98);
__d("UERichTextStringMarkdownDiffBuilder",["UEHeadlessUtils","UEPredefinedStyleIDs","UERichTextStringDiffBuilder","UERichTextStringDiffBuilderForReplacement","UERichTextStringLowLevelUtils","UERichTextStringParserUtils","UERichTextStringSparseBlockArraysDiffBuilder","UETextArrayBehaviors","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";var h=" ",i="-",j="*",k=".",l=k.length,m="#",n="##",o=">";function p(a){if(a.length>l&&a.substr(a.length-l,l)===k){a=a.substr(0,a.length-l);if(d("UERichTextStringParserUtils").isNumeric(a)){a=parseInt(a,10);if(a===1)return a}}return null}function q(a,b){if(b==="LIST_STYLES"){if(a===i||a===j)return c("UEPredefinedStyleIDs").bulletedList;if(a.length>l&&a.substr(a.length-l,l)===k){var e=a.substr(0,a.length-l);if(d("UERichTextStringParserUtils").isNumeric(e)&&parseInt(e,10)===1)return c("UEPredefinedStyleIDs").numberedList}return null}if(b==="PARAGRAPH_STYLES"){if(a===m)return c("UEPredefinedStyleIDs").headingOne;if(a===n)return c("UEPredefinedStyleIDs").headingTwo;return a===o?c("UEPredefinedStyleIDs").blockQuote:null}return null}function a(a,b,e){if(e.isMarkdownEnabled===!1||d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_SUPPORTS_MARKDOWN",b)===!1)throw c("unrecoverableViolation")("Cannot apply markdown.","unified_editor");a=a;var f=d("UEHeadlessUtils").assertNonNull(e.richTextString.attributes.get("PARAGRAPH_STYLES"),"Expected paragraphs"),g=f[e.affectedBlockAttributeRange.index].charIndex,i=e.replacementRange.length===0&&g0]}function j(a,b,c,e){a=a;var f=e.richTextEventData.isDeleteBackward!=null&&e.richTextEventData.isDeleteBackward===!0;f={charIndex:f?d("UETextAttributeAndTextRangeUtils").getCharIndexAfterEndOfRange(e.replacementRange):e.replacementRange.charIndex,excludeTrailingBlock:!0,length:0};b={attribute:b,attributeType:c,editorData:e.richTextEventData,nodeKey:e.richTextString.getID(),textRange:f,type:"UPDATE_TEXT_ATTRIBUTE"};a=a.pushChanges({atomicChange:b});return a}function k(a,b){if(b.richTextEventData.isDeleteBackward==null||b.richTextEventData.isDeleteBackward===!1)return[a,!1];var e=a,f=0,g=c("mapMapToArray")(b.richTextString.attributes,function(a,b){return b}).filter(function(a){return d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_SHOULD_UPDATE_USING_BACKSPACE",a)});g.forEach(function(a){a=l(e,a,b);var c=a[0];a=a[1];a&&(e=c,f++)});return[a,f>0]}function l(a,b,c){var e=a,f=c.richTextString.attributes.get(b);if(f==null)return[e,!1];if(b==="LIST_STYLES")return m(a,c);a=d("UERichTextStringPatternMatchingUtils").shouldUpdateBlockAttributeForBackspaceNonListStyle(b,c);if(a){var g={charIndex:d("UETextAttributeAndTextRangeUtils").getCharIndexAfterEndOfRange(c.replacementRange),excludeTrailingBlock:!0,length:1};if(d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_CAN_INCREMENT_DECREMENT",b)){b={attributeToUpdateWith:{type:"increment_decrement",value:"DECREMENT"},attributeTypeToUpdate:b,attributeValues:f,richTextEventData:c.richTextEventData,richTextString:c.richTextString,textRangeToUpdate:g};f=d("UEHeadlessUtils").assertNonNull(c.richTextString.attributes.get("PARAGRAPH_STYLES"),"Expect paragraph styles to exist.");c=c.richTextString.getText().length;f=d("UERichTextStringRangeBasedUtils").getTextRunsOverRange(f,g,c);g=f[0];c=f[1];e=d("UERichTextStringDiffBuilderLowLevelUtils").updateDiffForRichTextStringForSparseAttributeWithTextRuns(e,g,c,b)}}return[e,a]}function m(a,b){a=a;var c=d("UERichTextStringPatternMatchingUtils").shouldUpdateBlockAttributeForBackspaceListStyle("LIST_STYLES",b);if(c){var e={charIndex:d("UETextAttributeAndTextRangeUtils").getCharIndexAfterEndOfRange(b.replacementRange),excludeTrailingBlock:!0,length:1};a=n(a,"LIST_STYLES",b,e)}return[a,c]}function n(a,b,c,e){return d("UERichTextStringDiffBuilder").updateDiffForRichTextStringForReplacingAttributesOverTextRange(a,c.richTextString,b,null,e,{isTypingEvent:!0})}g.updateDiffForPatternMatching=a}),98);
__d("UERichTextStringSegmentedAttributesDiffBuilder",["UEHeadlessUtils","UERichTextStringCharacterArraysDiffBuilder","UERichTextStringLowLevelUtils","UERichTextStringUtils"],(function(a,b,c,d,e,f,g){"use strict";function h(a){a=d("UERichTextStringUtils").getUEValueFromAttribute(a);return a!=null&&a.type==="link_smart_field"&&a.value.isImmutable===!0}function i(a){a=d("UERichTextStringUtils").getUEValueFromAttribute(a);return a!=null&&a.type==="link_smart_field"&&a.value.isSegmented===!0}function a(a,b,c){var e=d("UEHeadlessUtils").assertNonNull(c.richTextString.attributes.get(b),"attribute type "+b+"should not be null when update diff"),f=d("UERichTextStringLowLevelUtils").calculateAttributeRangeAffectedByTextRange(c.replacementRange,e),g=f.length>1;!g&&d("UERichTextStringLowLevelUtils").getDestinationTextReplacementMode(c.replacementRange,c.textToInsertLength)==="DELETE_TEXT_NO_BLOCKS"?j(f.index,e,c):(k(a,b,f.index,e,c),g&&k(a,b,f.index+f.length-1,e,c));return a}function j(a,b,c){var d=b[a],e=i(d.attribute),f=h(d.attribute);if(!e&&!f)return;d=d.charIndex;b=b[a+1];a=b!=null?b.charIndex:c.richTextString.getText().length;f&&(c.replacementRange={charIndex:d,length:a-d});if(e){b=c.richTextString.getText();f=c.replacementRange.charIndex;e=c.replacementRange.charIndex+c.replacementRange.length;while(f>d&&b[f]!==" ")f--;while(e0&&c.affectedBlockAttributeRange.length>0){var h;h=(h=c.richTextString.getRoot())==null?void 0:h.getViewModel().hasBehavior("LISTS_MATCH_PARAGRAPHS_MODE");if(c.affectedBlockAttributeRange.length>0&&(h===!1||k(e,f,c.replacementRange.charIndex))&&f[c.affectedBlockAttributeRange.index].charIndex===c.replacementRange.charIndex){h=d("UETextAttributeAndTextRangeUtils").getAttributeIndexAfterEndOfRange(c.affectedBlockAttributeRange)-1;e=j(e,f,h);g=e;a=d("UERichTextStringBlockArraysDiffBuilder").updateDiffForRemovingEntireInitialBlock(a,e,b,c)}}if(d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_SHOULD_COPY_TO_SINGLE_NEWLINE_INSERTIONS",b)===!0){f=c.textToInsertLength===1&&c.specialCharacters.length===1&&c.specialCharacters[0].characterType==="BLOCK_CHARACTER";f&&(a=d("UERichTextStringBlockArraysDiffBuilder").updateDiffForInsertingTextWithBlocksInSource(a,g,b,c))}return a}function e(a,b){a=a;if(d("UERichTextStringDiffBuilderLowLevelUtils").hasNoRequiredDiffUpdates(b)===!0)return a;a=d("UERichTextStringDiffBuilderLowLevelUtils").updateDiffForDeletingSparseBlockArrayAttributes(a,b);if(b.attributeToUpdateWith==null)return a;var c=d("UEHeadlessUtils").assertNonNull(b.richTextString.attributes.get("PARAGRAPH_STYLES"),"Paragraph Styles should not be null when updating diff"),e=d("UERichTextStringLowLevelUtils").calcuateBlockAttributeRangeAffectedByTextRange(b.textRangeToUpdate,c,!0);b.textRangeToUpdate.length===0&&(e={index:e.index,length:1});var f=d("UETextAttributeAndTextRangeUtils").getAttributeIndexAfterEndOfRange(e);for(e=e.index;e1?{charIndex:g.charIndex,excludeTrailingBlock:!0,length:1}:g;g={attribute:b.attributeToUpdateWith,attributeType:b.attributeTypeToUpdate,editorData:b.richTextEventData,nodeKey:b.richTextString.getID(),textRange:g,type:"UPDATE_TEXT_ATTRIBUTE"};a=a.pushChanges({atomicChange:g})}return a}function f(a,b,c){return d("UERichTextStringDiffBuilderForReplacement").updateDiffForAttributesForRichTextReplacementForBlockArrays(a,b,c)}function l(a,b,c){return d("UERichTextStringDiffBuilderForReplacement").updateDiffForAttributesForAfterRichTextReplacementForBlockArrays(a,b,c)}function m(a,b,e){if(b.attributeTypeToUpdate!=="LIST_STYLES")return a;var f=b.richTextString.attributes.get(e);if(f==null)return a;var g=b.attributeValues,i=d("UEHeadlessUtils").assertNonNull(b.richTextString.attributes.get("PARAGRAPH_STYLES"),"Paragraph Styles should not be null when updating diff"),k=d("UERichTextStringLowLevelUtils").findBeforeEdgeForAttributeAtCharIndex(b.textRangeToUpdate.charIndex,f),l=f[k].charIndex;f=f[k].attribute;k=kk.charIndex)throw c("unrecoverableViolation")("Bad lead start char index.","unified_editor");f&&i?k={charIndex:l,length:g-l}:f&&(k={charIndex:l,length:k.charIndex-l});if(k.length&&(f||i)){g={attributeToUpdateWith:null,attributeTypeToUpdate:e,attributeValues:b.richTextString.attributes.get(e),richTextEventData:b.richTextEventData,richTextString:b.richTextString,textRangeToUpdate:k};return d("UERichTextStringTextArraysDiffBuilder").updateDiffForMutatingAttributes(a,g)}return a}g.updateDiffForAttributesForTextReplacementForSparseBlockArrays=a;g.getSparseAttributeIndex=i;g.getSparseAttributeValue=j;g.isSparseBlockOnNearestParagraphBlock=k;g.updateDiffForAttributesForAfterTextReplacementForSparseBlockArrays=b;g.updateDiffForMutatingSparseBlockArrayAttributes=e;g.updateDiffForAttributesForRichTextReplacementForSparseBlockArrays=f;g.updateDiffForAttributesForRichAfterTextReplacementForSparseBlockArrays=l;g.cleanUpSparseAttributes=m}),98);
__d("UERichTextStringTextArraysDiffBuilder",["UERichTextStringBlockArraysDiffBuilder","UERichTextStringCharacterArraysDiffBuilder","UERichTextStringDiffBuilderForReplacement","UERichTextStringSparseBlockArraysDiffBuilder","UETextArrayBehaviors","UEValueUtils"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b,c){if(d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_APPLIES_TO_BLOCKS",b))return d("UERichTextStringBlockArraysDiffBuilder").updateDiffForAttributesForTextReplacementForBlockArrays(a,b,c);if(d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_APPLIES_TO_CHARACTERS",b))return d("UERichTextStringCharacterArraysDiffBuilder").updateDiffForAttributesForTextReplacementForCharacterArrays(a,b,c);return d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_IS_SPARSE_FOR_BLOCKS",b)?d("UERichTextStringSparseBlockArraysDiffBuilder").updateDiffForAttributesForTextReplacementForSparseBlockArrays(a,b,c):a}function b(a,b,c){if(d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_APPLIES_TO_BLOCKS",b))return d("UERichTextStringBlockArraysDiffBuilder").updateDiffForAttributesForAfterTextReplacementForBlockArrays(a,b,c);if(d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_APPLIES_TO_CHARACTERS",b))return d("UERichTextStringCharacterArraysDiffBuilder").updateDiffForAttributesForAfterTextReplacementForCharacterArrays(a,b,c);return d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_IS_SPARSE_FOR_BLOCKS",b)?d("UERichTextStringSparseBlockArraysDiffBuilder").updateDiffForAttributesForAfterTextReplacementForSparseBlockArrays(a,b,c):a}function c(a,b,c){if(d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_APPLIES_TO_BLOCKS",b))return d("UERichTextStringDiffBuilderForReplacement").updateDiffForAttributesForRichTextReplacementForBlockArrays(a,b,c);if(d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_APPLIES_TO_CHARACTERS",b))return d("UERichTextStringDiffBuilderForReplacement").updateDiffForAttributesForRichTextReplacementForCharacterArrays(a,b,c);return d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_IS_SPARSE_FOR_BLOCKS",b)?d("UERichTextStringSparseBlockArraysDiffBuilder").updateDiffForAttributesForRichTextReplacementForSparseBlockArrays(a,b,c):a}function e(a,b,c){if(d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_APPLIES_TO_BLOCKS",b))return d("UERichTextStringDiffBuilderForReplacement").updateDiffForAttributesForAfterRichTextReplacementForBlockArrays(a,b,c);if(d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_APPLIES_TO_CHARACTERS",b))return d("UERichTextStringDiffBuilderForReplacement").updateDiffForAttributesForAfterRichTextReplacementForCharacterArrays(a,b,c);return d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_IS_SPARSE_FOR_BLOCKS",b)?d("UERichTextStringSparseBlockArraysDiffBuilder").updateDiffForAttributesForRichAfterTextReplacementForSparseBlockArrays(a,b,c):a}function f(a,b,c){c===void 0&&(c=d("UEValueUtils").mapMutatingDifCharsModeToEnum("SELECTION"));if(d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_APPLIES_TO_BLOCKS",b.attributeTypeToUpdate))return d("UERichTextStringBlockArraysDiffBuilder").updateDiffForMutatingBlockArrayAttributes(a,b);if(d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_APPLIES_TO_CHARACTERS",b.attributeTypeToUpdate))return d("UERichTextStringCharacterArraysDiffBuilder").updateDiffForMutatingCharacterArrayAttributes(a,b,!1,!1,c);return d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_IS_SPARSE_FOR_BLOCKS",b.attributeTypeToUpdate)?d("UERichTextStringSparseBlockArraysDiffBuilder").updateDiffForMutatingSparseBlockArrayAttributes(a,b):a}g.updateDiffForAttributesForTextReplacement=a;g.updateDiffForAttributesAfterTextReplacement=b;g.updateDiffForAttributesRichTextReplacement=c;g.updateDiffForAttributesAfterRichTextReplacement=e;g.updateDiffForMutatingAttributes=f}),98);
__d("UETextLayoutInstructionCore",["UEHeadlessUtils","UERichTextStringSparseBlockArraysDiffBuilder","UERichTextStringUtils","UETextArrayBehaviors","UETextAttributeAndTextRangeUtils","UETextLayoutInstructionBlockArrayUtils","areEqual","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";var h;function a(a,b,d,e){var f=b!=null?b.richTextString.getID():d!=null?d.richTextString.getID():null;if(f==null)throw c("unrecoverableViolation")("Need a mutation state to create layout instruction.","unified_editor");var g=a.findIndex(function(a){return a.nodeKey===f});if(b!=null)return k(a,g,b,!1);return d!=null&&e!=null?l(a,g,d,e):a}function i(a,b){var e=b.getID(),f=a.findIndex(function(a){return a.nodeKey===e});if(f!==-1){var g=a[f];if(g.type!=="UPDATE_RICH_TEXT_STRING")throw c("unrecoverableViolation")("Expect instruction type should be UPDATE_RICH_TEXT_STRING","unified_editor");if(g.wasSingleBlockTypingEvent===!1){var h="PARAGRAPH_STYLES",i=d("UEHeadlessUtils").assertNonNull(b.attributes.get(h),"Expect to retrieve Paragraph Styles"),j={charIndex:0,length:0};h={affectedBlockAttributeRange:g.superRangeForHeadlessRelativeBlocks,attributeToUpdateWith:i[0].attribute,attributeTypeToUpdate:h,attributeValues:i,editorData:g.editorData,originalTextRange:j,richTextString:b,shouldGenerateLayoutInstruction:!0,textRangeToUpdate:j};return k(a,f,h,!0)}}return a}function j(a,b,e){var f=a.attributes.get("LIST_STYLES");if(f==null)return b;a=d("UEHeadlessUtils").assertNonNull(a.attributes.get("PARAGRAPH_STYLES"),"Expected paragraph styles.");var g=b.index0){var k=f[i].attribute;i=i-1;for(g=g-1;g>=0;g--){if(i<0||f[i].charIndex!==a[g].charIndex||(h||(h=c("areEqual")))(f[i].attribute,k)===!1)break;j=g;i--}}g=a.length;k=f.length;i=d("UETextAttributeAndTextRangeUtils").getAttributeIndexAfterEndOfRange(b);b=b.length>0?i-1:i;b===i-1&&e!=null&&d("UETextLayoutInstructionBlockArrayUtils").hasAtLeastOneDeletedBlock(e)===!0&&i=k||f[e].charIndex!==a[b].charIndex||(h||(h=c("areEqual")))(f[e].attribute,l)===!1)break;i=b;e++}}b=i-j+1;if(j+b>g)throw c("unrecoverableViolation")("Bad calcuation of expanded block length","unified_editor");return{index:j,length:b}}function k(a,b,e,f){var g=null;if(b!==-1&&f===!0){var h=a[b];if(h.type!=="UPDATE_RICH_TEXT_STRING")throw c("unrecoverableViolation")("Expect instruction type should be UPDATE_RICH_TEXT_STRING","unified_editor");g=h.blockArray}h=f===!0?j(e.richTextString,e.affectedBlockAttributeRange,g):e.affectedBlockAttributeRange;if(b===-1){g=e.textRangeToUpdate;e.originalTextRange!=null&&(d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_CONTAINS_STYLES",e.attributeTypeToUpdate)||d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_IS_SPARSE_FOR_BLOCKS",e.attributeTypeToUpdate))&&(g=e.originalTextRange);g={blockArray:d("UETextLayoutInstructionBlockArrayUtils").updateBlockArrayWithRange(d("UEHeadlessUtils").assertNonNull(e.richTextString.attributes.get("PARAGRAPH_STYLES"),"Expect to retrieve Paragraph Styles").length,h,[]),editorData:e.editorData==null?{isTypingEvent:!1}:e.editorData,nodeKey:e.richTextString.getID(),remoteTextRangeAndTextInsertLengths:[],suggestedNewTextRange:g,superRangeForHeadlessRelativeBlocks:{index:0,length:0},superRangeForHostRelativeBlocks:{index:0,length:0},textLength:0,textRange:e.textRangeToUpdate,type:"UPDATE_RICH_TEXT_STRING",wasSingleBlockTypingEvent:!1};a.push(m(g));return i(a,e.richTextString)}g=a[b];if(g.type!=="UPDATE_RICH_TEXT_STRING")throw c("unrecoverableViolation")("Expect instruction type should be UPDATE_RICH_TEXT_STRING","unified_editor");f=g.wasSingleBlockTypingEvent&&h.length<=1&&e.attributeTypeToUpdate!=null&&!f;e=babelHelpers["extends"]({},g,{blockArray:d("UETextLayoutInstructionBlockArrayUtils").updateBlockArrayWithRange(d("UEHeadlessUtils").assertNonNull(e.richTextString.attributes.get("PARAGRAPH_STYLES"),"Expect to retrieve Paragraph Styles").length,h,g.blockArray),wasSingleBlockTypingEvent:f});e.type==="UPDATE_RICH_TEXT_STRING"&&(a[b]=m(e));return a}function l(a,b,e,f){var g,h=0;e.countOfInsertedBlocks>0&&(h=e.countOfInsertedBlocks,e.leadingBlockIsPartiallyIncluded===!1&&d("UERichTextStringUtils").doesTextToInsertEndInBlockCharacter(f,e.specialCharacters)===!0&&h--);h={index:e.leadingBlockIndex,length:h+1};f=e.editorData!=null&&e.editorData.isTypingEvent?{charIndex:e.replacementRange.charIndex+f.length,length:0}:{charIndex:e.replacementRange.charIndex,length:f.length};g=h.length===1&&e.attributeRangeForRemovedBlocks.length===0&&e.countOfInsertedBlocks===0&&((g=e.editorData)==null?void 0:g.isMarkdownEvent)!==!0;if(b===-1){var i={blockArray:d("UETextLayoutInstructionBlockArrayUtils").updateTextBlockArrayWithRange(d("UEHeadlessUtils").assertNonNull(e.richTextString.attributes.get("PARAGRAPH_STYLES"),"Expect to retrieve Paragraph Styles").length,h,e.attributeRangeForRemovedBlocks,e.countOfInsertedBlocks,[]),editorData:e.editorData!=null?e.editorData:{isTypingEvent:!1},nodeKey:e.richTextString.getID(),remoteTextRangeAndTextInsertLengths:[{replacementRange:e.replacementRange,textToInsertLength:e.textToInsertLength}],suggestedNewTextRange:f,superRangeForHeadlessRelativeBlocks:{index:0,length:0},superRangeForHostRelativeBlocks:{index:0,length:0},textLength:e.textToInsertLength,textRange:e.replacementRange,type:"UPDATE_RICH_TEXT_STRING",wasSingleBlockTypingEvent:g};a.push(m(i));return a}i=a[b];if(i.type!=="UPDATE_RICH_TEXT_STRING")throw c("unrecoverableViolation")("Expect replace text instruction type should be UPDATE_RICH_TEXT_STRING","unified_editor");h=babelHelpers["extends"]({},i,{blockArray:d("UETextLayoutInstructionBlockArrayUtils").updateTextBlockArrayWithRange(d("UEHeadlessUtils").assertNonNull(e.richTextString.attributes.get("PARAGRAPH_STYLES"),"Expect to retrieve Paragraph Styles").length,h,e.attributeRangeForRemovedBlocks,e.countOfInsertedBlocks,i.blockArray),remoteTextRangeAndTextInsertLengths:[].concat(i.remoteTextRangeAndTextInsertLengths,[{replacementRange:e.replacementRange,textToInsertLength:e.textToInsertLength}]),suggestedNewTextRange:f,textLength:e.textToInsertLength,textRange:e.replacementRange,wasSingleBlockTypingEvent:g&&i.wasSingleBlockTypingEvent});h.type==="UPDATE_RICH_TEXT_STRING"&&(a[b]=m(h));return a}function m(a){if(a.type!=="UPDATE_RICH_TEXT_STRING")throw c("unrecoverableViolation")("Expect rich text string layout instruction.","unified_editor");a.superRangeForHeadlessRelativeBlocks=d("UETextLayoutInstructionBlockArrayUtils").getHeadlessSuperRange(a.blockArray);a.superRangeForHostRelativeBlocks=d("UETextLayoutInstructionBlockArrayUtils").getHostSuperRange(a.blockArray);return a}g.updateLayoutInstructions=a;g.updateLayoutInstructionsByExpandingForLists=i}),98);
__d("UETextLayoutInstructionBlockArrayUtils",["UETextAttributeAndTextRangeUtils","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";function h(a,b,c){var e=c;if(c.length===0){a={padding:a,type:"UE_PADDING"};c.push(a)}a=b.length===0?b.index+1:d("UETextAttributeAndTextRangeUtils").getAttributeIndexAfterEndOfRange(b);for(b=b.index;b=c.index;--j)g=i(j,"UE_REMOVED",f);for(j=0;j0&&d[0].type==="UE_PADDING";for(var h=0;h0)throw c("unrecoverableViolation")("Padding must be at 0","unified_editor");if(b<=e[a].padding){var f=j(e);if(b===0){e.splice(a,1,{padding:0,type:d});if(f>0){var g=f-b-1;for(var h=0;h0){h=f-b-1;for(g=0;g=c&&(b===0?a[b].attribute=null:a.splice(b,1))}g.mutateAttributeArrayByInsertingOrDeletingAttributes=a;g.buildMutationResultForInsertingOrDeletingAttributes=h;g.mutateAttributeArrayByReplacingAttribute=b;g.buildMutationResultsForReplacingAttribute=i;g.mutateRichTextStringByReplacingText=e;g.buildMutationResultsForReplacingText=j;g.mutateAttributeValuesCharIndexForTextReplacement=f;g.deleteOrClearUnusedTrailingAttribute=k}),98);
__d("UERichTextStringModelMutator",["UEHeadlessUtils","UENodeUtils","UERichTextStringCoreMutator","UERichTextStringLowLevelUtils","UERichTextStringUtils","UETextArrayBehaviors","UETextArraysModelMutator","UETextAttributeAndTextRangeUtils","UETextBlockArraysModelMutator","mapMapToArray","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b){d("UERichTextStringUtils").doesRichTextStringRequireInitialization(a)&&d("UETextBlockArraysModelMutator").createAttributeTypeForParagraphStyles(a,b)}function h(a,b){return a.map(function(a){return{attribute:i(a.attribute,b),charIndex:a.charIndex}})}function i(a,b){if(a===null)return null;else if(typeof a==="string")return a;else return d("UENodeUtils").cloneUEValue(a,b)}function b(a,b){var d=new Map();for(var e=a.keys(),f=Array.isArray(e),g=0,e=f?e:e[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var i;if(f){if(g>=e.length)break;i=e[g++]}else{g=e.next();if(g.done)break;i=g.value}i=i;var j=a.get(i);if(j!=null)d.set(i,h(j,b));else throw c("unrecoverableViolation")("Text attributes has null entry for key.","unified_editor")}return d}function j(a,b,e,f,g){g===void 0&&(g=null);if(d("UETextAttributeAndTextRangeUtils").getCharIndexAfterEndOfRange(f)>b.getText().length)throw c("unrecoverableViolation")("Range is beyond RTS model for text replacement.","unified_editor");a=a;var h=d("UEHeadlessUtils").assertNonNull(b.attributes.get("PARAGRAPH_STYLES"),"PARAGRAPH_STYLES attribute of rich text string should not be null"),i=d("UERichTextStringLowLevelUtils").getAttributeRangeForBlockRemovalUsingExpandedAttributeRange(d("UERichTextStringLowLevelUtils").calcuateBlockAttributeRangeAffectedByTextRange(f,h),h,e.length,f),j=d("UERichTextStringLowLevelUtils").calculateLeadingBlockIndex(b,f.charIndex,i.index);h=h[j].charIndexb.getText().length)throw c("unrecoverableViolation")("Range is beyond RTS model range for attribute update.","unified_editor");var j=a;if(d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_VALUE_NULLABLE",e)&&b.attributes.has(e)===!1&&f===null)return a;a=d("UEHeadlessUtils").assertNonNull(b.attributes.get("PARAGRAPH_STYLES"),"PARAGRAPH_STYLES attribute of rich text string should not be null");a=d("UERichTextStringLowLevelUtils").calcuateBlockAttributeRangeAffectedByTextRange(g,a,!0);var k=d("UETextArraysModelMutator").getOrCreateAttributeType(b,e);if(k==null)throw c("unrecoverableViolation")("Could not get or create attributeType "+e+".","unified_editor");a={affectedBlockAttributeRange:a,attributeToUpdateWith:f,attributeTypeToUpdate:e,attributeValues:k,editorData:h,originalTextRange:i,richTextString:b,shouldGenerateLayoutInstruction:!0,textRangeToUpdate:g};j=d("UETextArraysModelMutator").mutateAttributeValues(j,a);d("UETextArraysModelMutator").removeUnusedAttributes(b.attributes);return j}function e(a,b,e,f,g,h){h===void 0&&(h=null);if(f.type!=="inline")throw c("unrecoverableViolation")("Text attributes has null entry for key.","unified_editor");a=a;a=j(a,b,d("UERichTextStringUtils").UE_INLINE_CHARACTER,g,h);g={charIndex:g.charIndex,length:d("UERichTextStringUtils").UE_INLINE_CHARACTER.length};a=k(a,b,e,f,g,h,g);return a}g.initializeWithDocument=a;g.cloneAttributeValues=h;g.cloneAttributes=b;g.mutateRichTextStringForTextReplacement=j;g.mutateRichTextStringForReplacingAttributesOverTextRange=k;g.mutateRichTextStringForInlineInsertion=e}),98);
__d("UERichTextStringMutatorUtils",["UEDiff","UELeanDocumentUtils","UERichTextStringCoreMutator","UERichTextStringDiffBuilder","UERichTextStringLowLevelUtils","UETextAttributeAndTextRangeUtils","areEqual","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";var h;function a(a,b,e,f){var g=e;if(a>=f.attributeValues.length)return i(a,b,e,f);if(f.attributeValues[a].charIndex=e.attributeValues.length||e.attributeValues[a].charIndex>e.textRangeToUpdate.charIndex)throw c("unrecoverableViolation")("Expect leadAttributeIndex to be at or prior to the textRange.","unified_editor");if(m(e.attributeValues[a].attribute,e.attributeToUpdateWith,e.attributeTypeToUpdate)===!1)if(e.attributeValues[a].charIndex0&&m(e.attributeValues[a-1].attribute,e.attributeToUpdateWith,e.attributeTypeToUpdate)){f={attribute:null,charIndex:0};b=d("UERichTextStringCoreMutator").mutateAttributeArrayByInsertingOrDeletingAttributes(b,e.attributeTypeToUpdate,e.attributeValues,{index:a,length:1},f,!0,e)}else m(e.attributeValues[a].attribute,e.attributeToUpdateWith,e.attributeTypeToUpdate)===!1&&(b=d("UERichTextStringCoreMutator").mutateAttributeArrayByReplacingAttribute(b,a,e));return b}function i(a,b,c,e){c=c;if(d("UETextAttributeAndTextRangeUtils").getCharIndexAfterEndOfRange(e.textRangeToUpdate)=0&&m(b,e.attributeToUpdateWith,e.attributeTypeToUpdate)===!1){f={index:a,length:0};c=d("UERichTextStringCoreMutator").mutateAttributeArrayByInsertingOrDeletingAttributes(c,e.attributeTypeToUpdate,e.attributeValues,f,{attribute:b,charIndex:d("UETextAttributeAndTextRangeUtils").getCharIndexAfterEndOfRange(e.textRangeToUpdate)},!1,e)}}return c}function e(a,b){var e=c("UEDiff").createEmptyDiff();a=d("UERichTextStringLowLevelUtils").getExpandedAttributeRangeForAttributeRangeAndTextRange(a,b.attributeValues,b.textRangeToUpdate);var f=b.richTextString.getID(),g=b.richTextString.getText().length,h=d("UETextAttributeAndTextRangeUtils").getAttributeIndexAfterEndOfRange(a);for(a=a.index;a=b.length)break;f=b[e++]}else{e=b.next();if(e.done)break;f=e.value}f=f;switch(f){case"PARAGRAPH_STYLES":break;case"CHARACTER_STYLES":case"LINKS":case"FOOTNOTES":case"EXTERNAL_SMART_FIELDS":case"ANNOTATIONS":case"INLINES":case"LIST_STYLES":case"LIST_STARTS":case"COMPLETED_STATE":case"PARAGRAPH_LEVEL":if(a.has(f)){var g=a.get(f);g!=null&&g.length===1&&g[0].attribute===null&&a["delete"](f)}break;default:throw c("unrecoverableViolation")(f+" is not supported","unified_editor")}}}function h(a,b){if(d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_APPLIES_TO_BLOCKS",b.attributeTypeToUpdate))return d("UETextBlockArraysModelMutator").mutateBlockArrayAttributeValues(a,b);else if(d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_APPLIES_TO_CHARACTERS",b.attributeTypeToUpdate))return d("UETextCharacterArraysModelMutator").mutateCharacterArrayAttributeValues(a,b);else if(d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_IS_SPARSE_FOR_BLOCKS",b.attributeTypeToUpdate))return d("UETextSparseBlockArraysModelMutator").mutateSparseBlockArrayAttributeValues(a,b);return a}g.mutateAttributesForTextReplacement=a;g.mutateAttributesAfterTextReplacement=b;g.getOrCreateAttributeType=e;g.removeUnusedAttributes=f;g.mutateAttributeValues=h}),98);
__d("UETextBlockArraysModelMutator",["UEHeadlessUtils","UEPredefinedStyleIDs","UERichTextStringCoreMutator","UERichTextStringLowLevelUtils","UERichTextStringUtils","UETextArrayBehaviors","UETextAttributeAndTextRangeUtils","areEqual","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";var h;function i(a,b,e){if(a===null||b===null)throw c("unrecoverableViolation")("ParagraphStyleID required to initialize paragraph entries.","unified_editor");a=[{attribute:a,charIndex:0}];if(e.getText().length>0){var f=d("UERichTextStringUtils").findSpecialCharacters(e.getText());a=a.concat(f.filter(function(a){a=a.characterType;return a==="BLOCK_CHARACTER"}).map(function(a){return{attribute:b,charIndex:a.charIndex+1}}))}e.attributes.set("PARAGRAPH_STYLES",a);return a}function a(a,b,e){var f=a;if(e.replacementRange.length===0)return a;a=e.richTextString.attributes.get(b);if(a==null)throw c("unrecoverableViolation")("AttributeType "+b+" expected but not found.","unified_editor");var g=b==="PARAGRAPH_STYLES"?e.attributeRangeForRemovedBlocks:d("UERichTextStringLowLevelUtils").getAttributeRangeForBlockRemovalUsingExpandedAttributeRange(d("UERichTextStringLowLevelUtils").calcuateBlockAttributeRangeAffectedByTextRange(e.replacementRange,a),a,e.textToInsertLength,e.replacementRange);if(g.length>0){var h=e.attributeMutationStates;h==null&&(h=new Map(),e.attributeMutationStates=h);h.set(b,{affectedAttributeRange:g,calculatedEdgeBefore:g.index>0?g.index-1:0});h={attribute:null,charIndex:0};e=d("UERichTextStringUtils").getAttributesMutationStateFromTextReplacementState(h.attribute,a,b,e);f=d("UERichTextStringCoreMutator").mutateAttributeArrayByInsertingOrDeletingAttributes(f,b,a,g,h,!0,e)}return f}function b(a,b,e){var f=a,g=e.richTextString.attributes.get(b);if(g==null)throw c("unrecoverableViolation")("AttributeType "+b+" expected but not found.","unified_editor");a=e==null?void 0:(a=e.attributeMutationStates)==null?void 0:(a=a.get(b))==null?void 0:a.calculatedEdgeBefore;a==null&&(a=d("UERichTextStringLowLevelUtils").findBeforeEdgeForAttributeAtCharIndex(e.replacementRange.charIndex,g));if(a>=g.length||g[a].charIndex>e.replacementRange.charIndex)throw c("unrecoverableViolation")("AttributeType "+b+" expected valid calculatedEdgeBefore "+a+".","unified_editor");var h=a;if(d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_IS_SPARSE_FOR_BLOCKS",b)===!1){var i=d("UERichTextStringUtils").getAttributesMutationStateFromTextReplacementState(null,g,b,e);e.specialCharacters.forEach(function(a){if(a.characterType==="BLOCK_CHARACTER"){h++;var c={index:h,length:0};i.attributeToUpdateWith=g[h-1].attribute;f=d("UERichTextStringCoreMutator").mutateAttributeArrayByInsertingOrDeletingAttributes(f,b,g,c,{attribute:g[h-1].attribute,charIndex:e.replacementRange.charIndex+a.charIndex+1},!1,i)}})}d("UERichTextStringCoreMutator").mutateAttributeValuesCharIndexForTextReplacement(g,h,e.textToInsertLength,e.replacementRange);return f}function e(a,b){b===void 0&&(b=null);if(a.attributes.has("PARAGRAPH_STYLES"))throw c("unrecoverableViolation")("RichTextString already has attribute type PARAGRAPH_STYLES","unified_editor");b=d("UEHeadlessUtils").assertNonNull((b=b)!=null?b:a.getDocument(),"Expected nonnull document.");b=b.getStyleSheet();b=b.getStyle(c("UEPredefinedStyleIDs").paragraph);var e=b.id;b=b.followingStyle;if(b==null)throw c("unrecoverableViolation")("Expected nonnull followingParagraphStyleID.","unified_editor");return i(e,b,a)}function f(a,b){a=a;if(b.attributeTypeToUpdate==="PARAGRAPH_STYLES"){var e,f=b.attributeToUpdateWith;if(f===null&&b.attributeTypeToUpdate==="PARAGRAPH_STYLES")throw c("unrecoverableViolation")("PARAGRAPH_STYLES require a nonnull update value.","unified_editor");if(typeof f==="string"&&((e=b.richTextString.getDocument())==null?void 0:e.getStyleSheet().getStyle(f))==null)throw c("unrecoverableViolation")("Style ID not in stylesheet.","unified_editor");b.textRangeToUpdate.length===0?e={index:d("UERichTextStringLowLevelUtils").findBeforeEdgeForAttributeAtCharIndex(b.textRangeToUpdate.charIndex,b.attributeValues),length:1}:e=d("UERichTextStringLowLevelUtils").calcuateBlockAttributeRangeAffectedByTextRange(b.textRangeToUpdate,b.attributeValues);if(e.length!==0){f=d("UETextAttributeAndTextRangeUtils").getAttributeIndexAfterEndOfRange(e);for(e=e.index;e 0 if attributes are to be deleted.","unified_editor");var j=d("UERichTextStringLowLevelUtils").getTrailingAttributeIndex(h,e.replacementRange,g);j=g[j].attribute;j=d("UERichTextStringUtils").getAttributesMutationStateFromTextReplacementState(j,g,b,e);a=i(a,j);j=d("UEHeadlessUtils").assertNonNull(f.calculatedEdgeBefore,"Expect calculatedEdgeBefore.");if(je.replacementRange.charIndex){if(j===0)throw c("unrecoverableViolation")("bad calculatedEdgeBefore.","unified_editor");(f=e.attributeMutationStates)==null?void 0:f.set(b,{affectedAttributeRange:h,calculatedEdgeBefore:j-1})}else if(j+10&&c.replacementRange.length===0,h=null;g=g&&f[e].charIndex===c.replacementRange.charIndex;e>0&&g&&d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_CONTAINS_STYLES_THAT_EXTEND_OVER_INSERTIONS",b)&&(h=f[e-1].attribute);var j=c.textToInsertLength-c.replacementRange.length;if(e===0&&e+11&&(e=h(a,b.richTextString,f,b.textRangeToUpdate,b.attributeTypeToUpdate,b.attributeValues,b.richTextString.getText().length,b));e=d("UERichTextStringMutatorUtils").updateLeadCharacterArrayAttributeValues(f.index,a,b);i=d("UERichTextStringLowLevelUtils").findBeforeEdgeForAttributeAtCharIndexUsingHint(b.textRangeToUpdate.charIndex,f.index,b.attributeValues)+1;e=d("UERichTextStringMutatorUtils").updateTrailCharacterArrayAttributeValues(i,g,a,b);return e}function e(a,b){if(a.attributes.has(b)===!0)throw c("unrecoverableViolation")("RichTextString already has attribute type "+b,"unified_editor");var d=[{attribute:null,charIndex:0}];a.attributes.set(b,d);return d}g.mutateAttributesForTextReplacementForCharacterArrays=a;g.mutateAttributesAfterTextReplacementForCharacterArrays=b;g.mutateCharacterArrayAttributeValues=i;g.createAttributeType=e}),98);
__d("UETextSparseBlockArraysModelMutator",["UEHeadlessUtils","UERichTextStringCoreMutator","UERichTextStringLowLevelUtils","UETextAttributeAndTextRangeUtils","UETextBlockArraysModelMutator","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";function h(a,b,c,e,f,g){f=f;var h=d("UERichTextStringLowLevelUtils").findBeforeEdgeForAttributeAtCharIndex(e[b.index].charIndex,c),i=d("UETextAttributeAndTextRangeUtils").getAttributeIndexAfterEndOfRange(b),j=d("UETextAttributeAndTextRangeUtils").getCharIndexAfterEndOfRange(a),k={index:0,length:0};h===0&&b.index===0&&(c[h].attribute!=null&&(f=d("UERichTextStringCoreMutator").mutateAttributeArrayByReplacingAttribute(f,h,g,!0)));h>0&&b.length===0&&e[b.index].charIndex===c[h].charIndex&&(k.index=h,k.length=1);for(var l=b.index;l=c.length||c[h].charIndexj){++h;continue}if(c[h].charIndex===j){var m=l>b.index&&l===e.length-1&&e[l].charIndex===g.richTextString.getText().length,n=a.length>0&&a.excludeTrailingBlock===!0;m=m&&n;if(m===!0){++h;continue}}k.length===0&&(k.index=h);k.length++;++h}if(k.length){n={attribute:null,charIndex:0};f=d("UERichTextStringCoreMutator").mutateAttributeArrayByInsertingOrDeletingAttributes(f,g.attributeTypeToUpdate,c,k,n,!0,g)}return f}function a(a,b,c){return d("UETextBlockArraysModelMutator").mutateAttributesForTextReplacementForBlockArrays(a,b,c)}function b(a,b,c){return d("UETextBlockArraysModelMutator").mutateAttributesAfterTextReplacementForBlockArrays(a,b,c)}function c(a,b){a=a;var c=d("UEHeadlessUtils").assertNonNull(b.richTextString.attributes.get("PARAGRAPH_STYLES"),"PARAGRAPH_STYLES attribute of rich text string should not be null"),e=d("UEHeadlessUtils").assertNonNull(b.richTextString.attributes.get(b.attributeTypeToUpdate),"Expect attribute type."),f=b.affectedBlockAttributeRange;a=h(b.textRangeToUpdate,f,e,c,a,b);var g=d("UERichTextStringLowLevelUtils").findBeforeEdgeForAttributeAtCharIndex(c[f.index].charIndex,e);e[g].charIndexf.index)continue;var k={attribute:b.attributeToUpdateWith,charIndex:c[j].charIndex};g===0?a=d("UERichTextStringCoreMutator").mutateAttributeArrayByReplacingAttribute(a,g,b,!1):a=d("UERichTextStringCoreMutator").mutateAttributeArrayByInsertingOrDeletingAttributes(a,b.attributeTypeToUpdate,e,{index:g,length:0},k,!1,b);++g}return a}g.deleteSparseBlockArrayAttributeValues=h;g.mutateAttributesForTextReplacementForSparseBlockArrays=a;g.mutateAttributesAfterTextReplacementForSparseBlockArrays=b;g.mutateSparseBlockArrayAttributeValues=c}),98);
__d("UERichTextStringParserUtils",["UEHeadlessUtils","UERichTextStringLowLevelUtils","UERichTextStringModelMutator","UERichTextStringMutatorUtils","UERichTextStringRangeBasedUtils","UERichTextStringUtils","UERichTextStringValidityUtils","UETextAttributeAndTextRangeUtils","UEUserInterfacePropertyAndStateUtils","UEValueUtils","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";function a(a){return/^\d+$/.test(a)}function h(a,b){return b===0?!1:a[b-1]==="\\"}function i(a,b){if(b===0)return b;b=b;while(b>0){b--;if(a[b]==="\n")return b+1}return b}function j(a,b,c){if(c===0)return!0;for(var d=0;d=2&&a[1].charIndex===1){b=d("UERichTextStringDiffBuilder").updateDiffForRichTextStringForTextReplacement(c("UEDiff").createEmptyDiff(),g.getContent(),"",{charIndex:0,length:1},{isTypingEvent:!1});d("UERichTextStringMutatorUtils").runDiffWithRichTextString(g.getContent(),b)}}return g.clone("WITH_DIFFERENT_ID")}g.createDocumentBasedRichTextString_TEST_ONLY=a;g.createDocumentBasedComponentContainer_TEST_ONLY=b;g.cloneRichTextString=e;g.cloneRichTextFrame=h}),98);
__d("UERichTextShadowStructureUtils",["UEHeadlessUtils","UEPredefinedStyleIDs","UERichTextStringIterator","UERichTextStringRangeBasedUtils","UERichTextStringUtils","UEStyleUtils","UETextAttributeAndTextRangeUtils","UEValueUtils","areEqual","emptyFunction","shallowEqual","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";var h,i=["CHARACTER_STYLES","LINKS","FOOTNOTES","INLINES","EXTERNAL_SMART_FIELDS"],j=["LIST_STYLES"],k=new Set([c("UEPredefinedStyleIDs").bulletedList,c("UEPredefinedStyleIDs").numberedList]);function a(a,b,c,d){return l([].concat(a),[].concat(b),c,d)}function l(a,b,d,e){var f=Math.max(a.length,b.length),g=[];for(var h=0;h0&&g.push({node:i,nodeKey:n,propertiesToUpdate:new Set(o),type:"UPDATE"});g.push.apply(g,l(i.children,j.children,0,n))}}else{p=D(i);o=D(j);n=m(p,o);n!=null&&g.push(n)}}else i==null?g.push({nodeKey:G(j),type:"REMOVE"}):j==null&&g.push({index:h+d,node:i,parent:e,type:"INSERT"})}return g}function m(a,b){var d=new Set();(h||(h=c("areEqual")))(a.attributeStyles,b.attributeStyles)||d.add("ATTRIBUTE_STYLES");(a.type==="text"&&b.type==="text"||a.type==="link"&&b.type==="link"||a.type==="footnote"&&b.type==="footnote")&&(a.text!==b.text&&d.add("text"),(h||(h=c("areEqual")))(a.characterStyles,b.characterStyles)||d.add("CHARACTER_STYLES"));a.type==="link"&&b.type==="link"&&((h||(h=c("areEqual")))(a.href,b.href)||d.add("href"));a.type==="footnote"&&b.type==="footnote"&&((h||(h=c("areEqual")))(a.content,b.content)||d.add("content"));return d.size>0?{node:a,nodeKey:G(b),propertiesToUpdate:d,type:"UPDATE"}:null}function b(a,b){var c=d("UEHeadlessUtils").assertNonNull(a.attributes.get("PARAGRAPH_STYLES"),"PARAGRAPH_STYLES attribute of rich text string should not be null");c=d("UETextAttributeAndTextRangeUtils").getTextRangeFromAttributeRange(c,a.getText().length,b,!1);return n(a,c)}function n(a,b){var c;b=d("UERichTextStringIterator").createIterator(a,new Set(["PARAGRAPH_STYLES","CHARACTER_STYLES","EXTERNAL_SMART_FIELDS","LINKS","LIST_STYLES","INLINES","PARAGRAPH_LEVEL","LIST_STARTS","COMPLETED_STATE","FOOTNOTES"]),b);var e=b.next().value,f=[],g=[],h=[];c=d("UEHeadlessUtils").assertNonNull((c=a.getDocument())==null?void 0:c.getStyleSheet(),"Expected stylesheet to be available when updating host instance");while(e!=null){var i=o(a,f,g,h,e,c);f=i[0];g=i[1];h=i[2];i=p(a,f,g,h,e);f=i[0];g=i[1];h=i[2];e=b.next().value}return f}function o(a,b,c,e,f,g){var h=f.ended,k=f.exactRange,l=f.running,m=f.started,n=i.some(function(a){return m[a]!=null});if(m.PARAGRAPH_STYLES!=null){var o,p,t=j.some(function(b){return q(a,l,b)});!t&&e.length>0&&(e.splice(0,e.length),c.splice(0,c.length));o=d("UERichTextStringUtils").assertAttributeValueAsString((o=(o=d("UERichTextStringUtils").getAttributeValueAtIndexEnforce(a,"PARAGRAPH_STYLES",m.PARAGRAPH_STYLES))==null?void 0:o.attribute)!=null?o:null);p=(p=(p=d("UERichTextStringUtils").getAttributeValueAtIndex(a,"PARAGRAPH_LEVEL",l.PARAGRAPH_LEVEL))==null?void 0:p.attribute)!=null?p:null;o=o;o={children:[],nodeKey:null,styleID:o,type:"block"};if(p!=null&&!t){p=d("UERichTextStringUtils").getParagraphLevelAsNumber(d("UEHeadlessUtils").coerceToUEValueAsParagraphLevel(p));o.metadata={paragraphLevel:(p=p)!=null?p:1,type:"paragraph"}}n||o.children.push(u(a,{ended:h,exactRange:k,running:l,started:m},g));t?s(o,a,b,c,e,f):r(o,b,c)}if(n){p=A(b,c);p.children.push(u(a,{ended:h,exactRange:k,running:l,started:m},g))}return[b,c,e]}function p(a,b,c,d,e){a=e.ended;a.PARAGRAPH_STYLES!=null&&c.splice(0,c.length);return[b,c,d]}function q(a,b,c){return b[c]!=null&&((a=d("UERichTextStringUtils").getAttributeValueAtIndex(a,c,b[c]))==null?void 0:a.attribute)!=null}function r(a,b,c){if(c.length===0)b.push(a),c.push(b.length-1);else{b=A(b,c);b.children.push(a);c.push(b.children.length-1)}}function s(a,b,e,f,g,h){h=h.running;if(h.LIST_STYLES!=null){var i,j,k,l;i=d("UERichTextStringUtils").assertAttributeValueAsString((i=(i=d("UERichTextStringUtils").getAttributeValueAtIndexEnforce(b,"LIST_STYLES",h.LIST_STYLES))==null?void 0:i.attribute)!=null?i:null);if(i==null)return;j=(j=(j=d("UERichTextStringUtils").getAttributeValueAtIndex(b,"PARAGRAPH_LEVEL",h.PARAGRAPH_LEVEL))==null?void 0:j.attribute)!=null?j:null;var m=0;j!=null&&(m=d("UERichTextStringUtils").getParagraphLevelAsNumber(d("UEHeadlessUtils").coerceToUEValueAsParagraphLevel(j)));j=d("UERichTextStringUtils").getSparseNumberFromAttribute((j=(j=d("UERichTextStringUtils").getAttributeValueAtIndex(b,"LIST_STARTS",h.LIST_STARTS))==null?void 0:j.attribute)!=null?j:null);b=d("UERichTextStringUtils").getSparseStringFromAttribute((h=(b=d("UERichTextStringUtils").getAttributeValueAtIndex(b,"COMPLETED_STATE",h.COMPLETED_STATE))==null?void 0:b.attribute)!=null?h:null);h=g.length!==0?A(e,g):null;k=h!=null&&(((k=h)==null?void 0:k.styleID)!==i||j!=null);k&&(g.splice(0,g.length),h=null);l=((l=h)==null?void 0:(l=l.metadata)==null?void 0:l.type)==="list"?(l=(l=h)==null?void 0:(l=l.metadata)==null?void 0:l.paragraphLevel)!=null?l:0:0;var n={paragraphLevel:0,parentListAttribute:i,type:"list-item"};b!=null&&i===c("UEPredefinedStyleIDs").checklist&&(n.completedState=b);b={children:[a],metadata:n,nodeKey:null,styleID:"listItem",type:"block"};a=lm){g.splice(-1,1);h=A(e,g)}if(h==null||k||a){if(h==null){l={paragraphLevel:0,type:"list"};j!=null&&i==="numbered"&&(l.listStartNumber=j);h={children:[],metadata:l,nodeKey:null,styleID:i,type:"block"};e.push(h);g.splice(0,g.length,e.length-1)}if(a)while(((n=h)==null?void 0:(k=n.metadata)==null?void 0:k.paragraphLevel)!=null&&h.metadata.paragraphLevel0){var e=d.shift();if(e.type==="block"){var f=B(e).children.filter(function(a){return a.type==="block"});if(f.length>1)throw c("unrecoverableViolation")("Multiple blocks found affected for single block typing event.","unified_editor");if(f.length===0)return e;d=[].concat(f,d)}}}return null}function A(a,b){if(b.length===0)throw c("unrecoverableViolation")("path empty in getBlockNodeAtPath","unified_editor");var d=null;for(var e=0;e=a.length)break;n=a[m++]}else{m=a.next();if(m.done)break;n=m.value}n=n;n=n.sheet;if(n!=null){n=n.cssRules;for(var n=n,o=Array.isArray(n),p=0,n=o?n:n[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var q;if(o){if(p>=n.length)break;q=n[p++]}else{p=n.next();if(p.done)break;q=p.value}q=q;q instanceof CSSStyleRule&&j.set(q.selectorText,q.style)}}}q=i.cloneNode(!0);q.normalize();var r=[],s=!1;l(q,null,new Set(),b,f,j,h,null,[],d,e).forEach(function(a){if(a.type==="block")r.push(a),s=!1;else{if(!s){r.push({children:[],nodeKey:null,styleID:g,type:"block"});if(a.text==="\n")return}s=!0;r[r.length-1].children.push(a)}});return r}function l(a,b,c,e,f,g,h,i,j,k,m){h===void 0&&(h=!1);if(a instanceof HTMLStyleElement)return[];if(a instanceof HTMLElement){var s,u=a.tagName.toLowerCase();if(u==="br")return[{attributeStyles:{type:"CHARACTER"},characterStyles:c,nodeKey:null,text:"\n",type:"text"}];if(a instanceof HTMLImageElement&&h)return[{attributeStyles:{type:"CHARACTER"},characterStyles:c,nodeKey:null,text:d("UERichTextStringUtils").UE_INLINE_CHARACTER,type:"text"}];var v=t(u),w=c;v!=null&&!c.has(v)&&(w=new Set(c.values()),w.add(v));var x;g.forEach(function(b,c){a.matches(c)&&(w=p(w,b),x=o(b,f))});v=a.style;w=p(w,v);x=(v=o(v,f))!=null?v:x;if(k!=null){x=n((v=x)!=null?v:e.get(u),a,k,m)}var y=b;v=(v=a.getAttribute("href"))!=null?v:a.getAttribute("data-href");if(u==="a"&&v!=null){v=d("UEHeadlessUtils").normalizeUri(v);v!==""&&(y=v)}v=e.get(u);x=(s=x)!=null?s:v;var z=[];a.childNodes.forEach(function(b){l(b,y,w,e,f,g,h,(b=x)!=null?b:null,[].concat(j,[a]),k,m).forEach(function(a){return z.push(a)})});if(v!=null&&x!=null){s={children:z,nodeKey:null,styleID:x,type:"block"};u==="li"&&q(s);r(a,s,i,j);return[s]}return z}if(a instanceof Text){v=j.length>0&&j[j.length-1];if(c.size===0&&b==null&&a.data.trim().length===0&&v&&!(v.tagName.toLowerCase()==="span"||v.tagName.toLowerCase()==="a"))return[];u={attributeStyles:{type:"CHARACTER"},characterStyles:c,nodeKey:null,text:a.data};return[b!=null?babelHelpers["extends"]({},u,{href:b,subType:"link",type:"link"}):babelHelpers["extends"]({},u,{type:"text"})]}return[]}function m(a,b,e){a=a.getStyle(b);return a!=null&&(h||(h=c("areEqual")))(e,d("UEStyleUtils").getStyleValueFromPropertyKey("PARAGRAPH_ALIGN",a))}function n(a,b,e,f){b=b.style;b=b.getPropertyValue("text-align");var g=a,h=null;if(d("UEStyleUtils").HTMLAlignToUEAlignMap[b]!=null&&!f.has("DISALLOW_PASTE_PARAGRAPH_ALIGNMENT")&&e.hasStyle((f=a)!=null?f:c("UEPredefinedStyleIDs").paragraph)&&!m(e,(f=a)!=null?f:c("UEPredefinedStyleIDs").paragraph,{type:"string",value:d("UEStyleUtils").HTMLAlignToUEAlignMap[b]})){h=d("UERichTextStringDiffBuilderLowLevelUtils").getNewStyleWithAttributeAndNewValue((f=a)!=null?f:c("UEPredefinedStyleIDs").paragraph,"PARAGRAPH_ALIGN",{type:"string",value:d("UEStyleUtils").HTMLAlignToUEAlignMap[b]},e,null)}if(h!=null){e.createNewStyle(h.properties,null,null,(f=a)!=null?f:c("UEPredefinedStyleIDs").paragraph);g=h.id}return g}function o(a,b){var d,e=a.getPropertyValue("font-size");if(e===""){e=a.getPropertyValue("font");if(e==="")return null}a=e.indexOf("px");if(a===-1)return null;d=(d=(d=b.get(c("UEPredefinedStyleIDs").headingOne))==null?void 0:d.fontSize)!=null?d:i;b=(b=(b=b.get(c("UEPredefinedStyleIDs").headingTwo))==null?void 0:b.fontSize)!=null?b:j;e=parseInt(e.substring(0,a).trim(),10);if(e>=d)return c("UEPredefinedStyleIDs").headingOne;else if(e>=b)return c("UEPredefinedStyleIDs").headingTwo;else return c("UEPredefinedStyleIDs").paragraph}function p(a,b){a=new Set(a);var c=b.getPropertyValue("font-weight");c!=null&&(c==="normal"||c==="400"?a["delete"]("bold"):(c==="bold"||c==="700")&&a.add("bold"));c=b.getPropertyValue("font-style");c!=null&&(c==="italic"?a.add("italic"):c==="normal"&&a["delete"]("italic"));c=b.getPropertyValue("text-decoration");c!=null&&(c.indexOf("underline")!==-1&&a.add("underline"),c.indexOf("line-through")!==-1&&a.add("strikethrough"),c.indexOf("none")!==-1&&(a["delete"]("strikethrough"),a["delete"]("underline")));return a}function q(a){var b=a.children.find(function(a){return a.type==="block"});b==null&&(a.children=[{children:a.children,nodeKey:null,styleID:c("UEPredefinedStyleIDs").paragraph,type:"block"}])}function r(a,b,c,e){a=a.tagName.toLowerCase();switch(a){case"li":b.metadata={paragraphLevel:s(e)-1,parentListAttribute:d("UEHeadlessUtils").assertNonNull(c,"Expected parent list style id"),type:"list-item"};break;case"ul":case"ol":b.metadata={paragraphLevel:s(e),type:"list"}}}function s(a){return a.reduce(function(a,b){b=b.tagName.toLowerCase();return k.has(b)?a+1:a},0)}function t(a){switch(a){case"b":case"strong":return"bold";case"i":case"em":return"italic";case"u":return"underline";case"s":return"strikethrough"}return null}g["default"]=a}),98);
__d("convertShadowHostToHTML",["UEStyleUtils","areEqual"],(function(a,b,c,d,e,f,g){"use strict";var h;function a(a,b,c){var d=new Document(),e=d.createElement("html");d.append(e);a.forEach(function(a){return i(a,d,e,b,c)});return d}function i(a,b,c,d,e){c=c;var f=d==null?void 0:d.get(a.styleID),g=null;e.hasStyle(a.styleID)&&(g=e.getStyle(a.styleID));f==null&&g!=null&&g.parentParagraphStyle!=null&&(f=d==null?void 0:d.get(g.parentParagraphStyle));if(f!=null){f=b.createElement(f);g!=null&&g.parentParagraphStyle!=null&&n(f,g);c.appendChild(f);c=f}f=c;var h=[];for(var a=a.children,m=Array.isArray(a),o=0,a=m?a:a[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var p;if(m){if(o>=a.length)break;p=a[o++]}else{o=a.next();if(o.done)break;p=o.value}p=p;if(p.type==="block")i(p,b,f,d,e),c=f;else if(p.type==="link"||p.type==="text"){var q=p.type==="link"?p.href.toString():null,r=0;while(r0;s--){h.pop();c=(r=c.parentNode)!=null?r:c}q!=null&&!j(h,{href:q,type:"link"})&&(c=l(b,c,q),h.push({href:q,type:"link"}));for(r=p.characterStyles,s=Array.isArray(r),q=0,r=s?r:r[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){if(s){if(q>=r.length)break;g=r[q++]}else{q=r.next();if(q.done)break;g=q.value}var t={style:g,type:"style"};j(h,t)||(c=k(b,c,g),h.push({style:g,type:"style"}))}c.appendChild(b.createTextNode(p.text))}}}function j(a,b){return a.some(function(a){return(h||(h=c("areEqual")))(a,b)})}function k(a,b,c){a=a.createElement(m(c));b.appendChild(a);return a}function l(a,b,c){a=a.createElement("a");a.setAttribute("href",c);b.appendChild(a);return a}function m(a){switch(a){case"bold":return"b";case"underline":case"doubleunderline":return"u";case"italic":return"i";case"strikethrough":return"s"}}function n(a,b){var c="";if(b.properties.align!=null){c+="text-align: "+d("UEStyleUtils").UEAlignToHTMLAlignMap[(b=b.properties.align)!=null?b:"H_LEFT"]+";"}c!==""&&a.setAttribute("style",c)}g["default"]=a}),98);
__d("updateDiffForRichTextStringNodeMerge",["UEHeadlessUtils","UERichTextStringDiffBuilder","UERichTextStringNode","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b,e,f){f=f[0];b=d("UEHeadlessUtils").assertToNodeOfType(b.getChildAtIdx(0),c("UERichTextStringNode"));e=d("UEHeadlessUtils").assertToNodeOfType(e.getChildAtIdx(0),c("UERichTextStringNode"));if(f.type!=="text")throw c("unrecoverableViolation")("childSelectionNode should be text type","unified_editor");d("UERichTextStringDiffBuilder").updateDiffForRichTextStringForTextReplacementWithRichTextString(a,e,b,{charIndex:0,length:e.getText().length},f.range)}g["default"]=a}),98);
__d("updateRichTextStringWithShadowStructure",["UEDiff","UEHeadlessUtils","UERichTextShadowStructureUtils","UERichTextStringDiffBuilder","UERichTextStringLowLevelUtils","UERichTextStringMutatorUtils","UERichTextStringUtils","UETextAttributeAndTextRangeUtils","UEUserInterfacePropertyAndStateUtils","UEValueUtils","areEqual","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";var h;function a(a,b){b=[].concat(b);b.forEach(d("UERichTextShadowStructureUtils").assertAsBlockNode);a=m(a,b,!1,!1);a.isRichTextStringValidEnforce();return a}var i="PARAGRAPH_STYLES",j="LIST_STYLES",k="LIST_STARTS",l="PARAGRAPH_LEVEL";function m(a,b,c,e){a=a;for(var f=0;f0&&b[e.charIndex-1]==="\n"){var k=d("UERichTextStringLowLevelUtils").getEdgeBeforeCharIndex(a,f,e.charIndex);if(k>1&&j[k].charIndex===e.charIndex&&j[k].attribute!=null&&j[k-1].attribute===null&&(h||(h=c("areEqual")))(j[k].attribute,j[k-2].attribute)){var l=!0,m=j[k-1].charIndex;for(e=e.charIndex-1;e>=m;--e)if(b[e]!=="\n"){l=!1;break}if(l){e={charIndex:j[k-1].charIndex,length:j[k].charIndex-j[k-1].charIndex};g=d("UERichTextStringDiffBuilder").updateDiffForRichTextStringForReplacingAttributesOverTextRange(g,a,f,j[k].attribute,e,{isTypingEvent:!1});d("UERichTextStringMutatorUtils").runDiffWithRichTextString(a,g)}}}return a}function s(a,b,e){if(e.length===0)return a;e=e;b=d("UEHeadlessUtils").assertNonNull(d("UEValueUtils").createUEValueWithURLString(b,"link"),"Expect link.");var f="LINKS",g=a.attributes.get(f);if(g!=null&&e.charIndex>0){var i=d("UERichTextStringLowLevelUtils").getEdgeBeforeCharIndex(a,f,e.charIndex);if(i>0&&g[i].attribute==null&&g[i-1].attribute!=null&&(h||(h=c("areEqual")))(b,g[i-1].attribute)){var j=a.getText(),k=g[i].charIndex===e.charIndex;if(k===!1){k=!0;var l=g[i].charIndex;for(var m=e.charIndex-1;m>=l;--m)if(j[m]!=="\n"){k=!1;break}}if(k){m=d("UETextAttributeAndTextRangeUtils").getCharIndexAfterEndOfRange(e)-g[i-1].charIndex;e={charIndex:g[i-1].charIndex,length:m}}}}l=c("UEDiff").createEmptyDiff();l=d("UERichTextStringDiffBuilder").updateDiffForRichTextStringForReplacingAttributesOverTextRange(l,a,f,b,e,{isTypingEvent:!1});d("UERichTextStringMutatorUtils").runDiffWithRichTextString(a,l);return a}function t(a,b){return b===0?q(a,null,l):q(a,{type:"paragraph_level",value:d("UEHeadlessUtils").assertNonNull(d("UERichTextStringUtils").getParagraphLevels()[b-1],"Unexpected paragraphLevel "+b)},l)}g["default"]=a}),98);
__d("UERichTextHeadlessEventHandlers",["UEDiff","UEHeadlessUtils","UERichTextStringDiffBuilder","UERichTextStringDiffBuilderUtils","UEStyleUtils","UETextAttributeAndTextRangeUtils","UEUserInterfacePropertyAndStateUtils","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b,e,f,g){if(a.length===0)throw c("unrecoverableViolation")("rich-text-string and range pair should not be empty","unified_editor");var h=d("UEUserInterfacePropertyAndStateUtils").getAsCharacterPropertyKey(b);if(h==null)throw c("unrecoverableViolation")("User interface active option not implemented for "+b,"unified_editor");if(a.length===1&&d("UETextAttributeAndTextRangeUtils").isRangeCollapsed(a[0][1])){f(babelHelpers["extends"]({type:"layout-update",update:{nodeKey:a[0][0].getID(),property:h,type:"insertion-style"}},g));return}var i=d("UERichTextStringDiffBuilderUtils").getSelectionForDiff(a[0][0]),j=i[0];i=i[1];var k="CHARACTER_STYLES";i=c("UEDiff").create([],j,i,j,!1,null);i.metadata.styleToggleIntent={style:b,value:String(e)};var l=e==null?null:{type:"boolean",value:e};f(babelHelpers["extends"]({diff:a.reduce(function(a,b){var c=b[0];b=b[1];return d("UERichTextStringDiffBuilder").updateDiffForRichTextStringForReplacingCharacterStyleOverTextRange(a,c,k,h,l,b,{isTypingEvent:!1})},i),type:"diff"},g))}function b(a,b,e,f,g,h){if(a.length===0)throw c("unrecoverableViolation")("rich-text-string and range pair should not be empty","unified_editor");if(!d("UEUserInterfacePropertyAndStateUtils").isKeyForRichTextBlock(b))throw c("unrecoverableViolation")("User interface active option not implemented for "+b,"unified_editor");var i=d("UERichTextStringDiffBuilderUtils").getSelectionForDiff(a[0][0]),j=i[0];i=i[1];i=c("UEDiff").create([],j,i,j,!1,null);i.metadata.styleToggleIntent={style:b,value:e};var k=d("UEHeadlessUtils").assertNonNull(d("UEStyleUtils").getAttributeTypeForPredefinedStyleID(e),"Outline only styleID detected "+e);f(babelHelpers["extends"]({diff:a.reduce(function(a,b){var c=b[0];b=b[1];var f=d("UERichTextStringDiffBuilder").updateDiffForRichTextStringForReplacingAttributesOverTextRange(a,c,k,e,b,{isTypingEvent:!1});if(h.has("LISTS_MATCH_PARAGRAPHS_MODE"))switch(k){case"LIST_STYLES":f=d("UERichTextStringDiffBuilder").updateDiffForRichTextStringForReplacingAttributesOverTextRange(a,c,"PARAGRAPH_STYLES","normal",b,{isTypingEvent:!1});break;case"PARAGRAPH_STYLES":f=d("UERichTextStringDiffBuilder").updateDiffForRichTextStringForReplacingAttributesOverTextRange(a,c,"LIST_STYLES",null,b,{isTypingEvent:!1});break}return f},i),type:"diff"},g))}function e(a,b,e,f,g,h){if(a.length===0)throw c("unrecoverableViolation")("rich-text-string and range pair should not be empty","unified_editor");if(f!=="PARAGRAPH_STYLES")throw c("unrecoverableViolation")("handlePropertyChange not implemented for attributeType "+f,"unified_editor");var i=d("UERichTextStringDiffBuilderUtils").getSelectionForDiff(a[0][0]),j=i[0];i=i[1];i=c("UEDiff").create([],j,i,j,!1,null);j=e!=null&&typeof e==="object"?d("UEHeadlessUtils").getAsStringFromUEValue(e):String(e);i.metadata.styleToggleIntent={style:b,value:j};g(babelHelpers["extends"]({diff:a.reduce(function(a,c){var g=c[0];c=c[1];return d("UERichTextStringDiffBuilder").updateDiffForRichTextStringForReplacingParagraphStyleOverTextRange(a,g,f,b,e,c,{isTypingEvent:!1})},i),type:"diff"},h))}function f(a,b,e,f,g,h){var i=d("UERichTextStringDiffBuilderUtils").getSelectionForDiff(a),j=i[0];i=i[1];i=c("UEDiff").create([],j,i,j,!1,null);g(babelHelpers["extends"]({diff:d("UERichTextStringDiffBuilder").updateDiffForRichTextStringForReplacingAttributesOverTextRange(i,a,b,e,f,{isTypingEvent:!1})},h,{type:"diff"}))}g.handleTogglePropertyChange=a;g.handleStyleChange=b;g.handlePropertyChange=e;g.handlePropertyChangeToAttribute=f}),98);
__d("UERichTextStringCharacterAttributeUtils",["UERichTextStringLowLevelUtils","UERichTextStringUtils","UETextAttributeAndTextRangeUtils"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b,c,e,f,g){var i=[];c=a.attributes.get(c);if(c==null)return i;var j=d("UERichTextStringLowLevelUtils").calculateAttributeRangeAffectedByTextRange(b,c);j.length===0&&(j.length=1);a=a.getText().length;var k=d("UETextAttributeAndTextRangeUtils").getAttributeIndexAfterEndOfRange(j);for(j=j.index;j=e.charIndex)break}var i=k[c];e.charIndex===h.charIndex&&([g,l,r].forEach(function(a){a.PARAGRAPH_STYLES!=null&&(a[c]=i)}),i+10){c=o(d("UETextAttributeAndTextRangeUtils").getCharIndexAfterEndOfRange(a),b);f=a.excludeTrailingBlock===!0;b[c].charIndex>d("UETextAttributeAndTextRangeUtils").getCharIndexAfterEndOfRange(a)&&--c;f&&c>e&&c0&&a.length>0?{index:e,length:f}:{index:e,length:0}}function i(a,b){var e=o(a.charIndex,b);if(a.length===0)return{index:e,length:0};var f=e;f=o(d("UETextAttributeAndTextRangeUtils").getCharIndexAfterEndOfRange(a),b);var g=b[f];if(g.charIndex0&&a.length>0?{index:e,length:b}:{index:e,length:0}}function b(a,b,e){a=d("UEHeadlessUtils").assertNonNull(a.attributes.get("PARAGRAPH_STYLES"),"PARAGRAPH_STYLES attribute of rich text string should not be null");var f=e;e===a.length&&f--;if(a[f].charIndex>b){if(e===0)throw c("unrecoverableViolation")("Paragraph styles array initial entry starts after 0.","unified_editor");f--}if(a[f].charIndex>b)throw c("unrecoverableViolation")("Cannot calculate lead block with bad index "+f+" and hint "+e+".","unified_editor");return f}function e(a,b,c,e){a=a;if(a.length===0)return a;if(a.index===0&&a.length>0){a.index++;a.length--;if(a.length===0)return a}b=d("UETextAttributeAndTextRangeUtils").getTextRangeFromAttributeIndex(a.index,b,c);b.charIndex<=e.charIndex&&a.length>0&&(a.index++,a.length--);return a}function f(a,b,e){var f=a;if(f.length===0){f.length++;return f}b[f.index].charIndex>e.charIndex&&(f.index--,f.length++);a=q(a,e,b);if(a0&&c.length>0;if(b===0&&a.length>0)return a.length>0?c===!1?"DELETE_TEXT_NO_BLOCKS":"DELETE_TEXT_WITH_BLOCKS":"NO_TEXT_REPLACEMENT";if(b>0&&a.length>0)return c===!1?"REPLACE_TEXT_NO_BLOCKS":"REPLACE_TEXT_WITH_BLOCKS";return b>0&&a.length===0?"INSERT_TEXT":"NO_TEXT_REPLACEMENT"}function k(a,b){if(b===0&&a.length>0)return"DELETE_TEXT_NO_BLOCKS";if(b>0&&a.length>0)return"REPLACE_TEXT_NO_BLOCKS";return b>0&&a.length===0?"INSERT_TEXT":"NO_TEXT_REPLACEMENT"}function l(a,b){var c=0,d=a.length-1,e=0,f=0;while(c<=d){e=Math.floor((c+d)/2);f=a[e].charIndex;if(fb)d=e-1;else return e}if(f<=b)return e;else if(e>0)return e-1;else return null}function m(a,b,c){if(b<0||b>=c.length)return!1;if(c[b].charIndex===a)return!0;if(c[b].charIndex>a)return!1;b=b+1;if(b===c.length)return!0;return c[b].charIndex>a?!0:!1}function n(a,b,c){if(m(a,b,c))return b;if(b>0&&m(a,b-1,c))return b-1;return m(a,b+1,c)?b+1:o(a,c)}function o(a,b){a=l(b,a);if(b.length===0)throw c("unrecoverableViolation")("Attribute arrays require at least one initial value at 0.","unified_editor");if(a==null)throw c("unrecoverableViolation")("Unexpected return value getAttributeEdgeBeforeUsingBinaryLeft.","unified_editor");return a}function p(a,b,c){a=d("UEHeadlessUtils").assertNonNull(a.attributes.get(b),"attribute type"+b+"should not be null when get edge");return o(c,a)}function q(a,b,c){a=d("UETextAttributeAndTextRangeUtils").getAttributeIndexAfterEndOfRange(a);a>=c.length?a--:c[a].charIndex>d("UETextAttributeAndTextRangeUtils").getCharIndexAfterEndOfRange(b)&&a--;return a}function r(a,b,c){a=q(a,b,c);return c[a].attribute}function s(a,b,e,f){var g={index:a.index,length:a.length},i=!1,j=null;if(e[g.index].charIndex<=b.charIndex){g.index++;g.length--;if(g.length===0)return[g,i,j]}var k=d("UETextAttributeAndTextRangeUtils").getAttributeIndexAfterEndOfRange(g)-1;if(k>=e.length)throw c("unrecoverableViolation")("Incorrectly calculated attributeRange.","unified_editor");if(e[k].charIndex0&&d("UERichTextStringLowLevelUtils").findBeforeEdgeForAttributeAtCharIndex(d("UETextAttributeAndTextRangeUtils").getCharIndexAfterEndOfRange(b.replacementRange),e);b=b.blockAttributeRange.length>0?d("UETextAttributeAndTextRangeUtils").getAttributeIndexAfterEndOfRange(b.blockAttributeRange)-1:d("UETextAttributeAndTextRangeUtils").getAttributeIndexAfterEndOfRange(b.blockAttributeRange);if(b>=0&&b0?d("UETextAttributeAndTextRangeUtils").getAttributeIndexAfterEndOfRange(b.blockAttributeRange)-1:d("UETextAttributeAndTextRangeUtils").getAttributeIndexAfterEndOfRange(b.blockAttributeRange);if(b>=0&&b0&&a[b-1].charIndex===e[f-1].charIndex&&(h||(h=c("areEqual")))(e[f-1].attribute,g)?!1:!0}}return!1}g.isBlockWithAttributeIndexEmpty=i;g.shouldClearBlockAttributeForEmptyBlock=a;g.shouldUpdateBlockAttributeForBackspaceListStyle=b;g.shouldUpdateBlockAttributeForBackspaceNonListStyle=e}),98);
__d("UERichTextStringRangeBasedUtils",["UEHeadlessUtils","UERichTextStringLowLevelUtils","UEStyleUtils","UETextArrayBehaviors","UETextAttributeAndTextRangeUtils","areEqual","range","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";var h;function i(a,b,d){var e=a[b];b+1=b.length)break;e=b[d++]}else{d=b.next();if(d.done)break;e=d.value}e=e;if(e.id===a)return e}return null}function l(a,b,c,e){if(typeof a!=="string")return{type:"boolean",value:!1};a=a;if(e!=null){e=k(a,e);if(e!=null)return d("UEStyleUtils").getStyleValueFromPropertyKey(b,e)}return d("UEStyleUtils").getStyleValueFromStyleID(a,b,c)}g.getTextRange=i;g.getAttributeValueAndRangeUsingAttributeValues=j;g.getLastAttributeValueAndRangeOfType=a;g.getStringInTextRangeWithoutNewlines=b;g.getTextRunsOverRange=e;g.getStyleValueForAttributeIndexes=f;g.getStyleFromStyleIDAndSet=k;g.getStyleValueFromAttribute=l}),98);
__d("UERichTextStringUserInterfaceUtils",["UEHeadlessUtils","UERichTextStringCharacterAttributeUtils","UERichTextStringLowLevelUtils","UERichTextStringRangeBasedUtils","UERichTextStringSparseBlockArraysDiffBuilder","UEStyleUtils","UETextArrayBehaviors","UETextAttributeAndTextRangeUtils","UEUserInterfacePropertyAndStateUtils","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b,e,f,g,h){g===void 0&&(g=new Set());if(e==="LINK_SMART_FIELD"||e==="EXTERNAL_SMART_FIELD"){if(d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_CONTAINS_EXTERNAL_REFERENCE",b)){var k=j(a,b,e,f,"ACTIVE",h);return{type:"boolean",value:k}}throw c("unrecoverableViolation")("Value for LINK_SMART_FIELD requested for unsupported attribute type - "+b,"unified_editor")}if(e==="FOOTNOTE_SMART_FIELD"){k=j(a,b,e,f,"ACTIVE",h);return{type:"boolean",value:k}}h=d("UEUserInterfacePropertyAndStateUtils").getAsCharacterPropertyKey(e);if(d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_APPLIES_TO_CHARACTERS",b)&&h!=null){if(f.length===0&&g.has(h))return i(a,b,h,f.charIndex);if(a.attributes.has(b)===!1)return{type:"boolean",value:!1};k=d("UEHeadlessUtils").assertNonNull(a.attributes.get(b),"Expected attributeValues");g=a.getText().length;h=d("UERichTextStringRangeBasedUtils").getTextRunsOverRange(k,f,g);h[0];h=h[1];b=d("UERichTextStringRangeBasedUtils").getStyleValueForAttributeIndexes(b,k,e,h,a.getStyleSheet(),g,f);if(b.type!=="boolean")throw c("unrecoverableViolation")("Style value != handled.","unified_editor");return b}throw c("unrecoverableViolation")("Unsupported user interface attribute type.","unified_editor")}function b(a,b,e){var f=d("UEUserInterfacePropertyAndStateUtils").getAttributeTypeFromUserInterfacePropertyKey(b);if(a.attributes.has(f)===!1)return d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_IS_SPARSE_FOR_BLOCKS",f)?null:{type:"string",value:""};var g=d("UEHeadlessUtils").assertNonNull(a.attributes.get("PARAGRAPH_STYLES"),"PARAGRAPH_STYLES attribute of rich text string should not be null"),i=d("UEHeadlessUtils").assertNonNull(a.attributes.get(f),f+" attribute of rich text string should not be null");e=d("UERichTextStringLowLevelUtils").calcuateBlockAttributeRangeAffectedByTextRange(e,g,!0);if(g==null)throw c("unrecoverableViolation")("Could not get or create attributeType PARAGRAPH_STYLES.","unified_editor");var j=g[e.index].attribute;if(d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_IS_SPARSE_FOR_BLOCKS",f)){j=d("UERichTextStringSparseBlockArraysDiffBuilder").getSparseAttributeValue(i,g,e.index);if(j==null)return null}if(!h(g,e,b,f,a))return null;if(d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_APPLIES_TO_BLOCKS",f)||d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_IS_SPARSE_FOR_BLOCKS",f)){i=d("UEStyleUtils").getParagraphStyleIDForAttribute(j,a.getStyleSheet());if(i==null)throw c("unrecoverableViolation")("PARAGRAPH_STYLES properties should have a styleID","unified_editor");return{type:"string",value:i}}g=d("UERichTextStringRangeBasedUtils").getStyleValueFromAttribute(j,b,a.getStyleSheet());return g.type==="string"?g:null}function h(a,b,c,e,f){var g=d("UETextAttributeAndTextRangeUtils").getAttributeIndexAfterEndOfRange(b),h=[],i=f.getStyleSheet(),j=a;d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_IS_SPARSE_FOR_BLOCKS",e)&&(j=d("UEHeadlessUtils").assertNonNull(f.attributes.get(e),e+" attribute of rich text string should not be null"));for(f=b.index;f1)return!1}else{f=new Set(h.map(function(a){return d("UERichTextStringRangeBasedUtils").getStyleValueFromAttribute(a,c,i).value}));if(f.size>1)return!1}return!0}function i(a,b,e,f){if(a.attributes.has(b)===!1)return{type:"boolean",value:!0};if(f===0)return{type:"boolean",value:!0};b=d("UEHeadlessUtils").assertNonNull(a.attributes.get(b),"Expect attributes for attributeType.");var g=d("UERichTextStringLowLevelUtils").findBeforeEdgeForAttributeAtCharIndex(f,b);if(b[g].charIndex===f){if(g===0)throw c("unrecoverableViolation")("Text location 0 should have been handled.","unified_editor");g--}f=b[g].attribute;if(f==null)return{type:"boolean",value:!0};b=d("UERichTextStringRangeBasedUtils").getStyleValueFromAttribute(f,e,a.getStyleSheet());g=b.value!==!0;return{type:"boolean",value:g}}function e(a,b,c){b=a.attributes.get(b);if(b==null)return[!1,!1];a=d("UEHeadlessUtils").assertNonNull(a.attributes.get("PARAGRAPH_STYLES"),"Paragraph styles should not be null");var e=d("UERichTextStringLowLevelUtils").calculateAttributeRangeAffectedByTextRange(c,a),f=d("UERichTextStringLowLevelUtils").findBeforeEdgeForAttributeAtCharIndex(a[e.index].charIndex,b),g=d("UETextAttributeAndTextRangeUtils").getAttributeIndexAfterEndOfRange(e);c=d("UETextAttributeAndTextRangeUtils").getCharIndexAfterEndOfRange(c);c=!(f>=b.length||b[f].charIndexc);var h=c;for(e=e.index;e=a.length)break;f=a[e++]}else{e=a.next();if(e.done)break;f=e.value}f=f;var g=f[0];f=f[1];g=b.get(g);if(!k(f,g,c))return!1}return!0}function k(a,b,c){if(b==null)return!1;return a.length!==b.length?!1:a.every(function(a,e){a=a.attribute;e=b[e].attribute;if(a===null&&e===null)return!0;else if(typeof a==="string"&&typeof e==="string")return a===e;else if(a!==null&&typeof a!=="string"&&e!==null&&typeof e!=="string")return d("UENodeUtils").areUEValueSame(a,e,c)})}function a(a,b,c){var d=a===b;d||(d=a.getText()===b.getText(),d=d&&j(a.attributes,b.attributes,c));return d}function b(a){a=Array.from(a.entries());return a.map(function(a){var b=a[0];a=a[1];return[b,l(a)]})}function l(a){return a.map(function(a){return{attribute:m(a.attribute),charIndex:a.charIndex}})}function m(a){if(a==null)return a;else if(typeof a==="string")return a;else return d("UENodeUtils").serializeUEValueToRDFBJson(a)}function e(a,b,c){a=a.map(function(a){var d=a[0];a=a[1];return[d,n(a,b,c)]});return new Map(a)}function n(a,b,c){return a.map(function(a){return{attribute:o(a.attribute,b,c),charIndex:a.charIndex}})}function o(a,b,c){if(a==null)return a;else if(typeof a==="string")return a;else return d("UENodeUtils").deserializeRDFBJsonToUEValue(a,b,c)}function f(a){var b=[],c=h,d;while(d=c.exec(a)){var e=a[d.index],f=void 0,g="\n",j="\f";switch(e){default:case g:case j:f="BLOCK_CHARACTER";break;case i[0]:f="INLINE_CHARACTER";break}b.push({characterType:f,charIndex:d.index})}return b}function p(a){var b=/[\u000d]/g;return a.replace(b,"")}function q(a){return a.attributes.has("PARAGRAPH_STYLES")===!1}function r(){return{inverseDiff:c("UEDiff").createEmptyDiff(),layoutInstructions:[]}}function s(a,b){return b==="PARAGRAPH_STYLES"||a.attributes.has(b)}function t(a,b){a=a.attributes.get(b);return a==null||a.length===0?!1:!0}function u(a,b){return A(a,b).followingStyle}function v(a,b){return typeof a==="string"?b.hasStyle(a):!1}function w(a,b,c,d){if(d!=null&&v(d,c)===!1){d=A(d,b);b={parentKey:c.getID(),type:"INSERT",value:{type:"style",value:d}};a.pushChanges({atomicChange:b})}return a}function x(a){return a!=null&&typeof a==="string"?a:null}function y(a){return a!=null&&typeof a==="string"?a:null}function z(a){return a!=null&&typeof a!=="string"?a:null}function A(a,b){a=x(a);if(a!=null){b=b.getStyle(a);if(b!=null)return b}throw c("unrecoverableViolation")("Attribute does not contain valid style.","unified_editor")}function B(a){a=z(a);return a!=null?d("UEValueUtils").getLinkSmartFieldFromValue(a):null}function C(a){if(a!=null&&typeof a!=="string"){a=a;if(a.type==="boolean")return a.value}throw c("unrecoverableViolation")("Attribute does not contain valid boolean UEValue.","unified_editor")}function D(a){return typeof a==="string"&&a!=null?a:null}function E(a){return typeof a!=="string"&&a!=null&&a.type==="number"&&typeof a.value==="number"?a.value:null}function F(a){if(a!=null&&typeof a!=="string"){a=a;if(a.type==="string")return a.value}throw c("unrecoverableViolation")("Attribute does not contain valid string UEValue.","unified_editor")}function G(a){var b=d("UEHeadlessUtils").assertNonNull(d("UERichTextStringRangeBasedUtils").getLastAttributeValueAndRangeOfType(a,"PARAGRAPH_STYLES"),"last attribute value and range should not be null"),c=b.charIndex;b=b.length;return c===a.getText().length&&b===0?c:null}function H(a,b,c){a=a.attributes.get(b);return a!=null?(b=a[c])!=null?b:null:null}function I(a,b,d){a=H(a,b,d);if(a!=null)return a;throw c("unrecoverableViolation")("Text attribute "+b+" not found.","unified_editor")}function J(a){if(typeof a==="string")return a;throw c("unrecoverableViolation")("Expected attribute to be string","unified_editor")}function K(a,b){return b.length>0&&(b[b.length-1].characterType==="BLOCK_CHARACTER"&&b[b.length-1].charIndex===a.length-1)?!0:!1}function L(a,b,c,e,f,g,h){if(a.length>0){f=f;g=d("UEDiffUtils").createEmptyDiffWithSelections(g,g,g);f.length>0&&d("UERichTextStringDiffBuilder").updateDiffForRichTextStringForReplacingAttributesOverTextRange(g,e,c,null,f,h);d("UERichTextStringDiffBuilder").updateDiffForRichTextStringForTextReplacement(g,e,a,f,h);f={charIndex:f.charIndex,length:a.length};return d("UERichTextStringDiffBuilder").updateDiffForRichTextStringForReplacingAttributesOverTextRange(g,e,c,b,f,h)}return null}function M(a,b,c,e,f){if(a.length>0&&b!=null){e=e;f=d("UEDiffUtils").createEmptyDiffWithSelections(f,f,f);e.length>0&&d("UERichTextStringDiffBuilder").updateDiffForRichTextStringForReplacingAttributesOverTextRange(f,c,"EXTERNAL_SMART_FIELDS",null,e,{isTypingEvent:!1});d("UERichTextStringDiffBuilder").updateDiffForRichTextStringForTextReplacement(f,c,a,e,{isTypingEvent:!1});e={charIndex:e.charIndex,length:a.length};return d("UERichTextStringDiffBuilder").updateDiffForRichTextStringForReplacingAttributesOverTextRange(f,c,"EXTERNAL_SMART_FIELDS",b,e,{isTypingEvent:!1})}return null}function N(a,b,c,d){return{affectedBlockAttributeRange:{index:0,length:0},attributeToUpdateWith:a,attributeTypeToUpdate:c,attributeValues:b,editorData:d.editorData,originalTextRange:null,richTextString:d.richTextString,shouldGenerateLayoutInstruction:!1,textRangeToUpdate:d.replacementRange}}function O(a,b,c,d,e){return{attributeToUpdateWith:a,attributeTypeToUpdate:b,attributeValues:c,richTextEventData:d.richTextEventData,richTextString:d.richTextString,textRangeToUpdate:e===!1?d.replacementRange:{charIndex:d.replacementRange.charIndex,length:d.textToInsertLength}}}function P(a){return a.type==="layout-update"&&a.update.type==="insertion-style"?!1:!0}function Q(a,b){a=a.attributes;for(var e=a.keys(),f=Array.isArray(e),g=0,e=f?e:e[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var h;if(f){if(g>=e.length)break;h=e[g++]}else{g=e.next();if(g.done)break;h=g.value}h=h;switch(h){case"PARAGRAPH_STYLES":break;case"CHARACTER_STYLES":case"INLINES":case"LINKS":case"ANNOTATIONS":case"EXTERNAL_SMART_FIELDS":d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_APPLIES_TO_CHARACTERS",h)===b&&a["delete"](h);break;case"LIST_STYLES":case"LIST_STARTS":case"COMPLETED_STATE":case"PARAGRAPH_LEVEL":d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_APPLIES_TO_CHARACTERS",h)===!b&&a["delete"](h);a["delete"](h);break;default:throw c("unrecoverableViolation")("Did not find attribute type "+h+".","unified_editor")}}}function R(a){Q(a,!0),d("UERichTextStringModelMutator").mutateRichTextStringForTextReplacement(r(),a,"",{charIndex:0,length:a.getText().length},null),Q(a,!1)}var S=["PARAGRAPH_LEVEL_1","PARAGRAPH_LEVEL_2","PARAGRAPH_LEVEL_3","PARAGRAPH_LEVEL_4","PARAGRAPH_LEVEL_5","PARAGRAPH_LEVEL_6","PARAGRAPH_LEVEL_7","PARAGRAPH_LEVEL_8","PARAGRAPH_LEVEL_9","PARAGRAPH_LEVEL_10"];function T(){return S}function U(a){var b=S.findIndex(function(b){return b===a});if(b===-1)throw c("unrecoverableViolation")("Invalid paragraph level "+a,"unified_editor");return b+1}function V(a){var b=a.getChildren();if(b.length!==1)return!1;b=a.getChildAtIdx(0);a=b.getChildren();if(a.length!==1)return!1;a=b.getChildAtIdx(0);return a instanceof c("UERichTextFrameNode")}function W(a){return a==="IS_COMPLETED"}function X(a,b){b=b.sort(function(b,d){var e,f;e=(e=H(a,b.attributeType,b.index))==null?void 0:e.charIndex;f=(f=H(a,d.attributeType,d.index))==null?void 0:f.charIndex;if(e==null||f==null)throw c("unrecoverableViolation")("attribute index for getOutermostToInnsertMostOrderedAttributes is out of range","unified_editor");if(e===f){b=((b=H(a,b.attributeType,b.index+1))==null?void 0:b.charIndex)||a.getText().length;d=((d=H(a,d.attributeType,d.index+1))==null?void 0:d.charIndex)||a.getText().length;return d-b}return e-f});return b.map(function(a){return a.attributeType})}g.UE_INLINE_CHARACTER=i;g.areTextAttributesEqual=j;g.areRichTextStringsEqual=a;g.serializeTextAttributesToRDFBJson=b;g.deserializeRDFBJsonToTextAttributes=e;g.findSpecialCharacters=f;g.stringByRemovingUnwantedCharacters=p;g.doesRichTextStringRequireInitialization=q;g.createEmptyTextMutationResults=r;g.hasAttributeType=s;g.hasAttributesOfType=t;g.getFollowingStyleIDFromAttribute=u;g.isStyleFromAttributeInStylesheet=v;g.updateDiffToMigrateStyle=w;g.getAttributeAsString=x;g.getNodeIDFromAttribute=y;g.getUEValueFromAttribute=z;g.getStyleFromAttribute=A;g.getLinkSmartFieldFromAttribute=B;g.getBooleanFromAttribute=C;g.getSparseStringFromAttribute=D;g.getSparseNumberFromAttribute=E;g.getStringFromAttribute=F;g.getCharIndexOfTrailingNewlineIfAny=G;g.getAttributeValueAtIndex=H;g.getAttributeValueAtIndexEnforce=I;g.assertAttributeValueAsString=J;g.doesTextToInsertEndInBlockCharacter=K;g.createDiffToUpdateWithStringAndValue=L;g.createDiffToHandleRichTextSmartFieldUpdate=M;g.getAttributesMutationStateFromTextReplacementState=N;g.getAttributesBuilderStateFromTextReplacementState=O;g.shouldClearInsertionStylesOnEvent=P;g.forceFlushContentFromRichTextString=R;g.getParagraphLevels=T;g.getParagraphLevelAsNumber=U;g.isSingleRTFDocument=V;g.isListItemCompleted=W;g.getOutermostToInnerMostOrderedAttributes=X}),98);
__d("UERichTextStringValidityUtils",["UEHeadlessUtils","UERichTextStringUtils","UETextArrayBehaviors","areEqual","cr:107","mapMapToArray","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";var h;function a(a){return c("mapMapToArray")(a.attributes,function(a,b){return b}).reduce(function(b,c){return b?i(a,c):b},!0)}function i(a,b){var c=a.attributes.has(b);if(b==="PARAGRAPH_STYLES"&&c===!1)return!1;if(c){if(l(a,b)===!1)return!1;if(d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_APPLIES_TO_BLOCKS",b))return j(a);if(d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_IS_SPARSE_FOR_BLOCKS",b))return k(a,b)}return!0}function j(a){var b=!0,c=a.attributes.get("PARAGRAPH_STYLES"),e=d("UERichTextStringUtils").findSpecialCharacters(a.getText());b=b&&c!=null;b&&c&&(c.forEach(function(a){e.includes({characterType:"BLOCK_CHARACTER",charIndex:a.charIndex-1})}),b=b&&e.filter(function(a){a=a.characterType;return a==="BLOCK_CHARACTER"}).length+1===c.length);return b}function k(a,b){var c=!0;b=d("UEHeadlessUtils").assertNonNull(a.attributes.get(b),"Caller must check that array exists.");var e="\n",f="\f";a=a.getText();for(var g=0;g0){var h=a[b[g].charIndex-1];if(h!==e&&h!==f)return!1}return c}function l(a,b,e){e===void 0&&(e=!1);var f=a.getText(),g=!0,i=d("UEHeadlessUtils").assertNonNull(a.attributes.get(b),"Caller must check that array exists.");if(e===!1&&d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_REFERENCES_INLINE_CHARACTER",b)&&m(a,b)===!1)return!1;for(e=0;e=i[e+1].charIndex&&(h||(h=c("areEqual")))(i[e].attribute,i[e+1].attribute)===!1)return!1;if(d("UETextArrayBehaviors").doesAttributeHaveBehavior("ARRAY_APPLIES_TO_CHARACTERS",b)&&(e>0&&e===i.length-1&&i[e].charIndex===f.length))return!1}return g}function m(a,b){var c=a.getText();b=d("UEHeadlessUtils").assertNonNull(a.attributes.get(b),"Caller must check that array exists.");for(var e=0;e0)if(f==null&&b[e-1].charIndex+1!==b[e].charIndex)return!1;else if(b[e-1].attribute!=null&&b[e-1].charIndex+1!==b[e].charIndex)return!1}return!0}function b(a,b,d){if(b.length===0||a.length===0)throw c("unrecoverableViolation")("Cannot delete entries with a text/attribute range length of 0.","unified_editor");if(d[a.index].charIndex>b.charIndex)throw c("unrecoverableViolation")("The input attributeRange begins after the textRange.charIndex.","unified_editor");if(d[a.index].charIndex>b.charIndex)throw c("unrecoverableViolation")("The input attributeRange begins after the textRange.charIndex.","unified_editor");return!0}function e(a,b){return a==null&&b==null||(h||(h=c("areEqual")))(a,b)}g.isRichTextStringValid=a;g.isAttributeArrayValid=i;g.areAttributeArrayValuesValid=l;g.validateDeletionOfAffectedCharacterArrayAttributes=b;g.areAttributesSame=e}),98);
__d("UETextAttributeAndTextRangeUtils",["UERichTextStringLowLevelUtils","UERichTextStringUtils","areEqual"],(function(a,b,c,d,e,f,g){"use strict";var h;function i(a){a=a.length;return a===0}function j(a,b,c,d){d===void 0&&(d=!1);var e;a+10?m(e):e.charIndex;if(a0?m(b):b.charIndex;a=a=b.charIndex&&m(a)<=m(b)}function p(a,b){a=l(a,b);return a!=null&&a.length>0}function b(a,b,c){if(b.length===0)return n(b.charIndex,a)?!0:!1;if(o(a,b))return!0;if(c)return o(b,a)?!0:!1;return p(b,a)?!0:!1}function q(a){return a.index+a.length}function e(a,b){return m(b)===d("UERichTextStringUtils").getCharIndexOfTrailingNewlineIfAny(a)}function f(a,b){var c=Math.min(a.index,b.index);a=Math.max(q(a),q(b));return{index:c,length:a-c}}function r(a,b,c){return b[a].charIndex===c.getText().length?0:1}function s(a,b,c){b=a.attributes.get(b);if(b==null)return c;var e=c,f=m(e);c=d("UERichTextStringLowLevelUtils").findBeforeEdgeForAttributeAtCharIndex(c.charIndex,b);if(b[c].charIndex=a.length)break;f=a[e++]}else{e=a.next();if(e.done)break;f=e.value}f=f;f=x(f,b);if(f!=null)return f}return null}function y(a,b){return(a=a.find(function(a){return a.getID()===b}))!=null?a:null}function z(a){var b=a.getParent();if(b==null)return null;a=b.findChildIdx(a.getID());return b.getChildAtIdx(a+1)}function A(a){var b=a.getParent();if(b==null)return null;a=b.findChildIdx(a.getID());return b.getChildAtIdx(a-1)}g.getChildrenUtil=a;g.getChildAtIdxUtil=b;g.addChildAtIdxUtil=d;g.appendChildUtil=e;g.removeChildAtIdxUtil=f;g.removeChildByIdUtil=h;g.getNodesInProperties=i;g.findNodeByIDInPropertiesAndChildren=j;g.mapSubTree=k;g.areNodesEqual=l;g.arePropertiesEqual=m;g.isStyleMapIntersectionSame=n;g.areStyleMapsSame=o;g.areUEValueSame=p;g.clonePropertise=q;g.cloneUEValue=r;g.serializePropertiesToRDFBJson=s;g.serializeUEValueToRDFBJson=t;g.deserializeRDFBJsonToProperties=u;g.deserializeRDFBJsonToUEValue=v;g.createNodeFromRDFB=w;g.findComponentNodeWithID=x;g.findChildNodeByID=y;g.getNext=z;g.getPrev=A}),98);
__d("UESampleConfig",["UEBlockQuoteNode","UEHeadingOneNode","UEHeadingTwoNode","UEListItemNode","UEListNode","UEParagraphNode","UEPredefinedStyleIDs"],(function(a,b,c,d,e,f,g){"use strict";a={blockQuote:c("UEBlockQuoteNode"),caption:c("UEParagraphNode"),headingOne:c("UEHeadingOneNode"),headingTwo:c("UEHeadingTwoNode"),list:c("UEListNode"),listItem:c("UEListItemNode"),paragraph:c("UEParagraphNode")};b={align:"H_LEFT",bold:!0,fontColor:"rgb(5,5,5)",fontFamily:"inherit",fontSize:28,italic:!1,strikethrough:!1,type:"PARAGRAPH",underline:!1};d={align:"H_LEFT",bold:!0,fontColor:"rgb(5,5,5)",fontFamily:"inherit",fontSize:20,italic:!1,strikethrough:!1,type:"PARAGRAPH",underline:!1};e={align:"H_LEFT",bold:!1,fontColor:"rgb(5,5,5)",fontFamily:"inherit",fontSize:17,italic:!1,strikethrough:!1,type:"PARAGRAPH",underline:!1};f={align:"H_CENTER",bold:!1,fontColor:"var(--secondary-text)",fontSize:17,fontWeight:400,italic:!1,lineHeight:22,marginBottom:16,marginTop:16,strikethrough:!1,type:"PARAGRAPH",underline:!1};var h={borderStart:"4px solid var(--secondary-button-background)",isBlockQuote:!0,italic:!0,paddingEnd:16,paddingStart:12,type:"PARAGRAPH"},i={isList:!0,listStyleType:"disc",paddingStart:40,type:"LIST"},j={isList:!0,listStyleType:"auto",paddingStart:40,type:"LIST"},k={isList:!0,listStyleType:"none",paddingStart:40,type:"LIST"};b=[{followingStyle:(c=c("UEPredefinedStyleIDs")).paragraph,id:c.headingOne,properties:b,title:"Heading 1"},{followingStyle:c.paragraph,id:c.headingTwo,properties:d,title:"Heading 2"},{followingStyle:c.paragraph,id:c.paragraph,properties:e,title:"Normal"},{followingStyle:c.caption,id:c.caption,properties:f,title:"Caption"},{followingStyle:c.blockQuote,id:c.blockQuote,parentParagraphStyle:c.paragraph,properties:h,title:"Block Quote"},{followingStyle:c.bulletedList,id:c.bulletedList,properties:i,title:"Bullets"},{followingStyle:"numbered",id:"numbered",properties:j,title:"Numbered"},{followingStyle:c.checklist,id:c.checklist,properties:k,title:"Checklist"},{followingStyle:"listItem",id:"listItem",properties:{type:"LIST_ITEM"},title:"List item"},{followingStyle:"bold",id:"bold",properties:{bold:!0,type:"CHARACTER"},title:"Normal"},{followingStyle:"italic",id:"italic",properties:{italic:!0,type:"CHARACTER"},title:"Normal"},{followingStyle:"underline",id:"underline",properties:{type:"CHARACTER",underline:!0},title:"Normal"},{followingStyle:"doubleunderline",id:"doubleunderline",properties:{doubleunderline:!0,type:"CHARACTER"},title:"Normal"},{followingStyle:"strikethrough",id:"strikethrough",properties:{strikethrough:!0,type:"CHARACTER"},title:"Normal"},{followingStyle:"image",id:"image",properties:{hAlignment:"LEFT",type:"VISUAL_OBJECT_IMAGE",vAlignment:"top"},title:"Image Default"},{followingStyle:"video",id:"video",properties:{hAlignment:"CENTER",type:"VISUAL_OBJECT_VIDEO",vAlignment:"center"},title:"Video Default"},{followingStyle:"table",id:"table",properties:{hAlignment:"CENTER",type:"VISUAL_OBJECT_TABLE",vAlignment:"center"},title:"Table Default"},{followingStyle:"link",id:"link",properties:{fontColor:"var(--accent)",type:"CHARACTER"},title:"Link Default"},{followingStyle:"exampleSmartFieldStyleID",id:"exampleSmartFieldStyleID",properties:{background:"var(--base-grape)",type:"CHARACTER"},title:"exampleSmartFieldStyleID"},{followingStyle:"rich-text-frame",id:"rich-text-frame",properties:{hAlignment:"CENTER",type:"VISUAL_OBJECT_RICH_TEXT_FRAME",vAlignment:"center"},title:"Text Frame Default"}];d={sectionPaddingBottom:16,sectionPaddingLeft:64,sectionPaddingRight:64,sectionPaddingTop:16};e={bold:{fontWeight:"x117nqv4",$$css:!0},italic:{fontStyle:"x1k4tb9n",$$css:!0},link:{color:"x1qq9wsj",":hover_textDecoration":"xt0b8zv",$$css:!0},strikethrough:{textDecoration:"xmqliwb",$$css:!0},underline:{textDecoration:"x1bvjpef",$$css:!0},underlineStrikethrough:{textDecoration:"x1gjp1fm",$$css:!0}};f={baseClasses:{bold:e.bold,footnote:e.bold,italic:e.italic,link:e.link,strikethrough:e.strikethrough,underline:e.underline,underlineStrikethrough:e.underlineStrikethrough},behaviors:new Set(["ENABLE_RICH_TEXT_STRING_MARKDOWN"]),blockNodesByType:a,hasSearch:!0,spacings:d,styles:b};h=f;g["default"]=h}),98);
__d("UESeletionLayoutUtils",["useUERecoilSetup"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b,c){b(d("useUERecoilSetup").selectionLayoutFamilyAtom(a),c)}g.updateSelectionLayout=a}),98);
__d("UEUndoRedoUtils",["$InternalEnum","UEModelStorageUtils","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";b=b("$InternalEnum").Mirrored(["UNDOABLE","NOT_UNDOABLE"]);function a(a,b){return{key:a.key,nodeKey:a.nodeKey,type:"UPDATE",value:b}}function e(a,b){if(a.value.type!=="node")throw c("unrecoverableViolation")("Expected value in the atomic change of type 'node'","unified_editor");return{nodeKey:b.getID(),nodeType:b.getNodeType(),type:"REMOVE"}}function f(a,b){var d=b.getChildIndex_EXPENSIVE(a);if(d==null)throw c("unrecoverableViolation")("Expected node to be present in parent's children parent: "+b.getID()+" id: "+a.getID(),"unified_editor");return{index:d,parentKey:b.getID(),type:"INSERT",value:{type:"node",value:a}}}function h(a){return{componentID:a.componentID,type:"REMOVE_COMPONENT"}}function i(a,b){return{component:b,componentID:a.componentID,type:"INSERT_COMPONENT"}}function j(a,b){return{componentID:a.componentID,key:a.key,type:"UPDATE_COMPONENT",value:b}}function k(a,b){switch(a.type){case"UPDATE_TEXT_ATTRIBUTE":case"REPLACE_TEXT":case"UPDATE":return a.nodeKey;case"REMOVE":return d("UEModelStorageUtils").getNode(b,a.nodeKey).getParentEnforce().getID();case"INSERT":return a.parentKey;case"INSERT_COMPONENT":case"REMOVE_COMPONENT":case"UPDATE_COMPONENT":return b.model.getDocument().getComponentContainer().getID();default:throw c("unrecoverableViolation")("Unknown atomic change type "+a.type,"unified_editor")}}function l(){return{layoutInstructions:[],newSelection:null}}g.UEUndoCapability=b;g.invertUpdateAtomicChange=a;g.invertInsertAtomicChange=e;g.invertRemoveAtomicChange=f;g.invertInsertComponentAtomicChange=h;g.invertRemoveComponentAtomicChange=i;g.invertUpdateComponentAtomicChange=j;g.getNodeKeyOfInterestForUndoRedoValidationFromAtomicChange=k;g.getUEEmptyUndoRedoMutationResults=l}),98);
__d("createDocument",["UEComponentContainerNode","UEDocumentNode","UESectionNode","UEStyleSheetNode"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b){a=c("UEStyleSheetNode").create(a);b=d("UEComponentContainerNode").UEComponentContainerNode.create(new Map(),(b=b)!=null?b:new Map());a=c("UEDocumentNode").create(a,b);b=c("UESectionNode").create();a.appendChild(b);b.setParent(a);return a}g["default"]=a}),98);
__d("createRichTextFrame",["UERichTextFrameNode","UERichTextStringNode"],(function(a,b,c,d,e,f,g){"use strict";function a(a){a===void 0&&(a="");a=c("UERichTextStringNode").create(a);var b=c("UERichTextFrameNode").create();b.appendChild(a);a.setParent(b);return b}g["default"]=a}),98);
__d("createRoot",["UERootNode","createDocument","createViewModel"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b,d,e){d===void 0&&(d=new Set());a=c("createDocument")(a,e);e=c("createViewModel")(d,b);return c("UERootNode").create(a,e)}g["default"]=a}),98);
__d("createRootForCollabriDocAndLoad",["createRootForText"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b,d,e){return c("createRootForText")("",a,b,d,e)}g["default"]=a}),98);
__d("loadRDFBJsonDoc",[],(function(a,b,c,d,e,f){"use strict";function a(a,b,c,d){var e=b.version.split("."),f=e[0];e=e[1];a.isAtVersion(b.type,f,e)===!1&&g(b,f+"."+e,a.getDocumentVersion());a.updateWithRDFBJSON(b.content,c,d);return a}function g(a,b,c){}f["default"]=a}),66);
__d("createRootForRDFBJsonDocAndLoad",["UEComponentContainerNode","UEDocumentNode","UERootNode","UEStyleSheetNode","createViewModel","loadRDFBJsonDoc"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b,e,f,g,h){f===void 0&&(f=new Set());g=c("UEDocumentNode").create(c("UEStyleSheetNode").create(g),d("UEComponentContainerNode").UEComponentContainerNode.create(new Map(),new Map()));c("loadRDFBJsonDoc")(g,a,b,e);a=c("createViewModel")(f,h);b=c("UERootNode").create(g,a);g.didLoad();return b}g["default"]=a}),98);
__d("createRootForText",["createRichTextFrame","createRoot"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b,d,e,f){b=c("createRoot")(b,d,e,f);d=b.getDocumentEnforce();e=c("createRichTextFrame")(a);f=d.getChildAtIdx(0);f.appendChild(e);e.setParent(f);e.onAddedToDocument(d);d.didLoad();return b}g["default"]=a}),98);
__d("createViewModel",["UEEventEmitterNode","UESearchNode","UESelectionNode","UEToolbarNode","UEViewModelNode"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b){var d=c("UESelectionNode").create(),e=c("UEToolbarNode").create(),f=c("UEEventEmitterNode").create(),g=c("UESearchNode").create();return c("UEViewModelNode").create(d,e,f,a,b,g)}g["default"]=a}),98);
__d("getParentModel",["UELayoutUtils"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b){return d("UELayoutUtils").getLayout(a,b).model.getParentEnforce()}g["default"]=a}),98);
__d("useUEAccessibilityAnnouncer",["Recoil","useUERecoilSetup"],(function(a,b,c,d,e,f,g){"use strict";function a(){return d("Recoil").useRecoilState(d("useUERecoilSetup").accessibilityAnnouncerAtom)}g["default"]=a}),98);
__d("UEComponentDataContext",["react"],(function(a,b,c,d,e,f,g){"use strict";var h;a=h||d("react");b=a.createContext({loadedNodes:new Map(),mutationNodes:new Map(),rootQueryNodes:new Map()});g["default"]=b}),98);
__d("UESurfaceIdentifierContext",["react"],(function(a,b,c,d,e,f,g){"use strict";var h;a=h||d("react");b=a.createContext("DEFAULT");g["default"]=b}),98);
__d("UEDocumentIDContext",["react"],(function(a,b,c,d,e,f,g){"use strict";var h;a=h||d("react");b=a.createContext(null);g["default"]=b}),98);
__d("useUEDocumentID",["UEDocumentIDContext","UEHeadlessUtils","react"],(function(a,b,c,d,e,f,g){"use strict";var h,i=(h||d("react")).useContext;function a(){var a=i(c("UEDocumentIDContext"));return d("UEHeadlessUtils").assertNonNull(a,"No instance of UEDocumentIDContext found in render tree")}g["default"]=a}),98);
__d("useUELogger",["UESurfaceIdentifierContext","UnifiedEditorScaleFalcoEvent","react","useUEDocumentID"],(function(a,b,c,d,e,f,g){"use strict";var h,i=(h||d("react")).useContext;function a(){var a=c("useUEDocumentID")(),b=i(c("UESurfaceIdentifierContext"));return function(d,e){c("UnifiedEditorScaleFalcoEvent").log(function(){return{category:d,document_identifier:a,editor_identifier:b,event:e}})}}g["default"]=a}),98);
__d("UEComponentMatcher.react",["CometRelay","FBLogger","UEComponentMatcher_component.graphql","react","useStable","useUELogger"],(function(a,b,c,d,e,f,g){"use strict";var h,i,j=i||d("react");function a(a){var c=a.component;a=a.layout;c=d("CometRelay").useFragment(h!==void 0?h:h=b("UEComponentMatcher_component.graphql"),c);return j.jsx(d("CometRelay").MatchContainer,{fallback:j.jsx(k,{layout:a}),match:c,props:{layout:a}})}a.displayName=a.name+" [from "+f.id+"]";function k(a){a=a.layout;var b=a.attachment.componentID,d=a.component,e=c("useUELogger")();c("useStable")(function(){e("component-error",{component_type:d.getType(),referrer:"visual-object",type:"no-match-found"})});throw c("FBLogger")("unified_editor").mustfixThrow("Tried to render a component fragment not matched in UEComponentMatcher. "+("Component id = "+b+" type = "+d.getType()))}k.displayName=k.name+" [from "+f.id+"]";g["default"]=a}),98);
__d("UEComponentQueryContainer.react",["CometRelay","UEComponentMatcher.react","UEComponentQueryContainerQuery.graphql","react"],(function(a,b,c,d,e,f,g){"use strict";var h,i,j=i||d("react"),k=h!==void 0?h:h=b("UEComponentQueryContainerQuery.graphql");function a(a){var b=a.layout;a=a.queryRef;a=d("CometRelay").usePreloadedQuery(k,a);a=a.componentValues.components;a=a[0];return j.jsx(c("UEComponentMatcher.react"),{component:a,layout:b})}a.displayName=a.name+" [from "+f.id+"]";g.UEComponentQuery=k;g.UEComponentQueryContainer=a}),98);
__d("useUEDefaultComponentFetcher",["CometRelay","UEComponentDataContext","UEComponentQueryContainer.react","react"],(function(a,b,c,d,e,f,g){"use strict";var h;b=h||d("react");var i=b.useCallback,j=b.useContext;function a(){var a=d("CometRelay").useRelayEnvironment(),b=j(c("UEComponentDataContext")),e=b.loadedNodes,f=b.mutationNodes,g=b.rootQueryNodes;return i(function(b){b=b.filter(function(a){return!e.has(a[0])&&!f.has(a[0])&&!g.has(a[0])});for(var b=b,c=Array.isArray(b),h=0,b=c?b:b[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var i;if(c){if(h>=b.length)break;i=b[h++]}else{h=b.next();if(h.done)break;i=h.value}i=i;var j=i[0];i=i[1];if(i.getLoadingType().type==="relay"){i=i.toRDFBJson();var k=i.properties;i=i.type;k=d("CometRelay").loadQuery(a,d("UEComponentQueryContainer.react").UEComponentQuery,{components:[{id:j,properties:JSON.stringify(k),type:i}]},{fetchPolicy:"store-or-network"});e.set(j,k)}}},[a,e,f,g])}g["default"]=a}),98);
__d("useUERecoilSetup",["Recoil","UECollabriControllerStorageUtils","UEDiffController","UELayoutUtils","UEModelStorage","UESelectionUtils","UEStateMutator","UEVirtualizationMutator","UnifiedEditorScaleFalcoEvent","createRootForCollabriDocAndLoad","createRootForRDFBJsonDocAndLoad","react","unrecoverableViolation","useStable","useUEDefaultComponentFetcher","uuidv4"],(function(a,b,c,d,e,f,g){"use strict";var h;b=h||d("react");var i=b.useCallback,j=b.useEffect,k=b.useMemo,l=d("Recoil").atom({"default":"",key:"UE_documentID",retainedBy_UNSTABLE:"components"});function m(a,b){var c=0;a=b(u(a));if(a==null)return c;var e=a.model.getRootEnforce().getViewModel().getSpacings();a.isVisual&&a.hint.type!=="default"&&(c+=a.hint.height+d("UEVirtualizationMutator").DEFAULT_MARGIN);a.childKeys.forEach(function(a){c+=m(a,b)});a.type==="section"&&(c+=e.sectionPaddingTop+e.sectionPaddingBottom);return c}var n=d("Recoil").atom({"default":0,key:"UE_totalDocumentHeight",retainedBy_UNSTABLE:"components"});e=d("Recoil").atom({"default":"",key:"UE_accessibilityAnnouncerText",retainedBy_UNSTABLE:"components"});f=d("Recoil").atom({"default":{bottomScrollHeight:0,lastChildRendered:null,prevScrollTop:0,scrollHeight:0,scrollUpdateCounter:0,viewportHeight:d("UEVirtualizationMutator").DEFAULT_HEIGHT},key:"UE_documentHeight",retainedBy_UNSTABLE:"components"});var o=d("Recoil").atom({"default":"",key:"UE_documentNodeKey",retainedBy_UNSTABLE:"components"}),p=d("Recoil").atom({"default":[],key:"UE_selectionReadOnly",retainedBy_UNSTABLE:"components"});b=d("Recoil").atom({"default":!1,key:"UE_hasUndos",retainedBy_UNSTABLE:"components"});var q=d("Recoil").atom({"default":!1,key:"UE_hasRedos",retainedBy_UNSTABLE:"components"}),r=d("Recoil").selector({dangerouslyAllowMutability:!0,get:function(a){a=a.get;var b=a(p);b=d("UESelectionUtils").getSelectedIDs(b);var c=new Map();for(var b=b,e=Array.isArray(b),f=0,b=e?b:b[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var g;if(e){if(f>=b.length)break;g=b[f++]}else{f=b.next();if(f.done)break;g=f.value}g=g;g=a(u(g));g!=null&&c.set(g.model.getID(),g)}return c},key:"somethingSelector",retainedBy_UNSTABLE:"components"}),s=new Set(),t=d("Recoil").selectorFamily({dangerouslyAllowMutability:!0,get:function(a){return function(b){b=b.get;var c=d("UEModelStorage").getDocumentModel(a).model.getDocument().getID();b=b(u(c));return b==null?s:d("UELayoutUtils").assertToDocumentLayout(b).insertionStyles}},key:"UE_insertionStylesSelector",retainedBy_UNSTABLE:"components"}),u=d("Recoil").atomFamily({dangerouslyAllowMutability:!0,"default":null,key:"UE_layoutItem"}),v=d("Recoil").atomFamily({"default":{height:0},key:"UE_heightInfo",retainedBy_UNSTABLE:"components"}),w=d("Recoil").atomFamily({dangerouslyAllowMutability:!0,"default":null,key:"UE_selectionLayoutItem"}),x=d("Recoil").atomFamily({"default":null,key:"selectionDebugMenuToggle",retainedBy_UNSTABLE:"components"}),y=d("Recoil").atom({"default":null,key:"UE_dragSelectionBoxStylesAtom",retainedBy_UNSTABLE:"components"});function z(a,b,d,e){if(a.type==="diff"||a.type==="resize"||a.type==="scroll"||a.referrer==="do-not-log")return;var f=void 0;if(a.type==="gesture"){var g=a.event.textRange;f={node_key:a.event.nodeKey,text_range:g!=null?{char_index:String(g.charIndex),exclude_trailing_block:g.excludeTrailingBlock,length:String(g.length)}:void 0,type:a.event.type}}var h=void 0;a.type==="persistence"&&(h={clipboard_event_type:a.event.event.type});c("UnifiedEditorScaleFalcoEvent").log(function(){return{category:"editor-event",document_identifier:b,editor_identifier:d,event:{event_id:e,gesture_info:f,persistence_info:h,referrer:a.referrer,type:a.type}}})}function a(a,b,e,f,g,h,p,q){var r=p.behaviors,s=p.spacings,t=p.styles;k(function(){if(e==null){if(b==null)throw c("unrecoverableViolation")("rdfb cannot be null when it is non-collab doc","unified_editor");var h=c("createRootForRDFBJsonDocAndLoad")(b,f,g,r,t,s);d("UEModelStorage").addDocumentModel(a,h)}else{h=c("createRootForCollabriDocAndLoad")(t,s,r,g);d("UECollabriControllerStorageUtils").addDocumentWithCollabriClient(a,e,h)}},[e,b,f,g,r,a,t,s]);var u=c("useUEDefaultComponentFetcher")(),v=c("useStable")(function(){return new(c("UEDiffController"))(u)});j(function(){var b=d("UEModelStorage").getDocumentModel(a);h!=null&&b.model.getViewModel().getEventEmitter().registerObserver("documentChanged",h);return function(){h!=null&&b.model.getViewModel().getEventEmitter().unregisterObserver("documentChanged",h)}},[a,h]);var w=d("Recoil").useRecoilTransaction_UNSTABLE(function(b){var e=b.get,f=b.reset,h=b.set;return function(b){b=d("UEStateMutator").getInitialState(b,h);h(l,b.documentID);h(o,b.documentNodeKey);d("UEStateMutator").reduceState(a,v,{event:{docNodeKey:b.documentNodeKey,type:"UPDATE_VIRTUALIZATION_VIEW"},referrer:"do-not-log",type:"scroll"},e,h,f,g,{editorIdentifier:q,eventID:c("uuidv4")()})}},[g,v,a,q]),x=d("Recoil").useRecoilTransaction_UNSTABLE(function(b){var c=b.get,e=b.reset,f=b.set;return function(b,h){b=d("UEStateMutator").reduceState(a,v,b,c,f,e,g,h);if(b!==d("UEStateMutator").UEReconcilerFollowUp.None){var i=c(o),j=m(i,c);f(n,j);if(b!==d("UEStateMutator").UEReconcilerFollowUp.VirtualizationView)return;d("UEStateMutator").reduceState(a,v,{event:{docNodeKey:i,type:"UPDATE_VIRTUALIZATION_VIEW"},referrer:"do-not-log",type:"scroll"},c,f,e,g,h)}}},[g,v,a]),y=i(function(b){var e=c("uuidv4")();x(b,{editorIdentifier:q,eventID:e});var f=d("UEModelStorage").getDocumentModel(a);f.model.getViewModel().emitDocumentChangedIfNecessary();z(b,a,q,e)},[x,a,q]);j(function(){w(a);e!=null&&d("UEStateMutator").initCollaborationAgent(a,v,y,p.collabConfig);return function(){if(e!=null){var b=d("UEModelStorage").getDocumentModel(a).collabriClient;b==null?void 0:b.unsubscribeAll();b==null?void 0:b.disconnect()}}},[a,w,e,y,v,p]);return y}g.documentIDAtom=l;g.getTotalHeightForID=m;g.totalDocumentHeight=n;g.accessibilityAnnouncerAtom=e;g.documentHeightAtom=f;g.documentNodeKeyAtom=o;g.selectionReadOnlyAtom=p;g.hasUndosAtom=b;g.hasRedosAtom=q;g.selectedLayoutsByIDSelector=r;g.insertionStylesSelector=t;g.layoutFamilyAtom=u;g.heightInfoForNodeAtom=v;g.selectionLayoutFamilyAtom=w;g.debugConfigToggleFamilyAtom=x;g.dragSelectionBoxStylesAtom=y;g.useUERecoilSetup=a}),98);
__d("UEBlockNode",["Lexical","UEOutlineRenderingUtils"],(function(a,b,c,d,e,f,g){"use strict";var h=function(b){babelHelpers.inheritsLoose(a,b);function a(a,c,d,e){e=b.call(this,e)||this;e.__styleID=c;e.__styleSheetRef=a;e.__metadata=d;return e}var c=a.prototype;c.getStyleID=function(){return this.__styleID};c.setStyleID=function(a){var b=this.getWritable();b.__styleID=a};c.setMetadata=function(a){var b=this.getWritable();b.__metadata=a};c.getStyleSheetRef=function(){return this.__styleSheetRef};c.getMetadata=function(){return this.__metadata};c.updateDOM=function(a,b){d("UEOutlineRenderingUtils").updateNodeFromPrevious(b,a,this);return!1};return a}(d("Lexical").ElementNode);function a(a){return a instanceof h}g.UEBlockNode=h;g.$isUEBlockNode=a}),98);
__d("UEBlockQuoteNode",["UEBlockNode","UEOutlineRenderingUtils"],(function(a,b,c,d,e,f,g){"use strict";a=function(a){babelHelpers.inheritsLoose(b,a);b.getType=function(){return"blockquote"};b.clone=function(a){return new b(a.__styleSheetRef,a.__styleID,a.__metadata,a.__key)};b.deserialize=function(a){return new b(a.__styleSheetRef,a.__styleID,a.__metadata)};function b(b,c,d,e){return a.call(this,b,c,d,e)||this}var c=b.prototype;c.createDOM=function(a){return d("UEOutlineRenderingUtils").createUEBlockDOMElement("blockquote",a.theme.paragraph,this.getStyleSheetRef(),this.getStyleID(),this.getMetadata())};c.insertNewAfter=function(){var a=new b(this.getStyleSheetRef(),this.getStyleID()),c=this.getDirection();a.setDirection(c);this.insertAfter(a);return a};return b}(d("UEBlockNode").UEBlockNode);g["default"]=a}),98);
__d("UEHeadingNode",["Lexical","UEBlockNode","UEOutlineRenderingUtils"],(function(a,b,c,d,e,f,g){"use strict";a=function(a){babelHelpers.inheritsLoose(b,a);b.clone=function(a){return new b(a.__tag,a.__styleSheetRef,a.__styleID,a.__metadata,a.__key)};b.deserialize=function(a){return new b(a.__tag,a.__styleSheetRef,a.__styleID,a.__metadata)};function b(b,c,d,e,f){c=a.call(this,c,d,e,f)||this;c.__tag=b;c.__metadata=e;return c}var c=b.prototype;c.createDOM=function(a){var b=this.__tag;a=a.theme.heading;var c=null;a!==void 0&&(c=a[b]);return d("UEOutlineRenderingUtils").createUEBlockDOMElement(b,c,this.getStyleSheetRef(),this.getStyleID(),this.getMetadata())};c.getTag=function(){return this.__tag};c.insertNewAfter=function(){var a=d("Lexical").$createParagraphNode(),b=this.getDirection();a.setDirection(b);this.insertAfter(a);return a};return b}(d("UEBlockNode").UEBlockNode);g["default"]=a}),98);
__d("UEHeadingOneNode",["UEHeadingNode"],(function(a,b,c,d,e,f,g){"use strict";a=function(a){babelHelpers.inheritsLoose(b,a);b.getType=function(){return"heading1"};b.clone=function(a){return new b(a.__styleSheetRef,a.__styleID,a.__metadata,a.__key)};b.deserialize=function(a){return new b(a.__styleSheetRef,a.__styleID,a.__metadata)};function b(b,c,d,e){return a.call(this,"h1",b,c,d,e)||this}var c=b.prototype;c.clone=function(){return new b(this.getStyleSheetRef(),this.getStyleID(),this.getMetadata(),this.getKey())};return b}(c("UEHeadingNode"));g["default"]=a}),98);
__d("UEHeadingTwoNode",["UEHeadingNode"],(function(a,b,c,d,e,f,g){"use strict";a=function(a){babelHelpers.inheritsLoose(b,a);b.getType=function(){return"heading2"};b.clone=function(a){return new b(a.__styleSheetRef,a.__styleID,a.__metadata,a.__key)};b.deserialize=function(a){return new b(a.__styleSheetRef,a.__styleID,a.__metadata)};function b(b,c,d,e){return a.call(this,"h2",b,c,d,e)||this}return b}(c("UEHeadingNode"));g["default"]=a}),98);
__d("UEListItemNode",["UEBlockNode","UEOutlineRenderingUtils","UERichTextShadowStructureUtils"],(function(a,b,c,d,e,f,g){"use strict";a=function(a){babelHelpers.inheritsLoose(b,a);b.getType=function(){return"ue_list_item"};b.clone=function(a){return new b(a.__styleSheetRef,a.__styleID,a.__metadata,a.__key)};b.deserialize=function(a){return new b(a.__styleSheetRef,a.__styleID,a.__metadata)};function b(b,c,d,e){return a.call(this,b,c,d,e)||this}var c=b.prototype;c.createDOM=function(a){var b;b=d("UERichTextShadowStructureUtils").assertAsListItemBlockMetadata((b=this.getMetadata())!=null?b:null);a=d("UEOutlineRenderingUtils").createUEBlockDOMElement("li",(a=a.theme.list)==null?void 0:a.listitem,this.getStyleSheetRef(),this.getStyleID(),b);b.parentListAttribute==="checklist"&&d("UEOutlineRenderingUtils").attachCheckboxToListItem(a,b);return a};c.updateDOM=function(b,c){var e;c=a.prototype.updateDOM.call(this,b,c);b=(b=d("UERichTextShadowStructureUtils").assertAsListItemBlockMetadata((b=b.getMetadata())!=null?b:null))==null?void 0:b.completedState;e=(e=d("UERichTextShadowStructureUtils").assertAsListItemBlockMetadata((e=this.getMetadata())!=null?e:null))==null?void 0:e.completedState;b=b!==e;return b||c};c.insertNewAfter=function(){var a=new b(this.getStyleSheetRef(),this.getStyleID(),this.getMetadata(),this.__key),c=this.getDirection();a.setDirection(c);this.insertAfter(a);return a};return b}(d("UEBlockNode").UEBlockNode);g["default"]=a}),98);
__d("UEListNode",["UEBlockNode","UEOutlineRenderingUtils"],(function(a,b,c,d,e,f,g){"use strict";a=function(a){babelHelpers.inheritsLoose(b,a);b.getType=function(){return"ue_list"};b.clone=function(a){return new b(a.__styleSheetRef,a.__styleID,a.__metadata,a.__key)};b.deserialize=function(a){return new b(a.__styleSheetRef,a.__styleID,a.__metadata)};function b(b,c,d,e){return a.call(this,b,c,d,e)||this}var c=b.prototype;c.getTagName=function(){return this.getStyleID()==="numbered"?"ol":"ul"};c.createDOM=function(a){var b=this.getTagName();return d("UEOutlineRenderingUtils").createUEBlockDOMElement(b,(a=a.theme.list)==null?void 0:a[b],this.getStyleSheetRef(),this.getStyleID(),this.getMetadata())};c.updateDOM=function(b,c){b=a.prototype.updateDOM.call(this,b,c);var d=this.getTagName().toUpperCase();return c.tagName!==d||b};c.insertNewAfter=function(){var a=new b(this.getStyleSheetRef(),this.getStyleID(),this.getMetadata(),this.__key),c=this.getDirection();a.setDirection(c);this.insertAfter(a);return a};return b}(d("UEBlockNode").UEBlockNode);g["default"]=a}),98);
__d("UEParagraphNode",["UEBlockNode","UEOutlineRenderingUtils"],(function(a,b,c,d,e,f,g){"use strict";a=function(a){babelHelpers.inheritsLoose(b,a);b.getType=function(){return"ue_paragraph"};b.clone=function(a){return new b(a.__styleSheetRef,a.__styleID,a.__metadata,a.__key)};b.deserialize=function(a){return new b(a.__styleSheetRef,a.__styleID,a.__metadata)};function b(b,c,d,e){return a.call(this,b,c,d,e)||this}var c=b.prototype;c.createDOM=function(a){return d("UEOutlineRenderingUtils").createUEBlockDOMElement("p",a.theme.paragraph,this.getStyleSheetRef(),this.getStyleID(),this.getMetadata())};c.insertNewAfter=function(){var a=new b(this.getStyleSheetRef(),this.getStyleID(),this.getMetadata()),c=this.getDirection();a.setDirection(c);this.insertAfter(a);return a};return b}(d("UEBlockNode").UEBlockNode);g["default"]=a}),98);
__d("UEOutlineRenderingUtils",["UEHeadlessUtils","UERichTextShadowStructureUtils","UEUserInterfacePropertyAndStateUtils","isStringNullOrEmpty"],(function(a,b,c,d,e,f,g){"use strict";var h=40,i={H_CENTER:"center",H_JUSTIFIED:"justify",H_LEFT:"left",H_RIGHT:"right"},j={bullets:[null,"circle","square"],numbered:[null,"lower-latin","lower-roman"]};({nonEditableContainer:{marginStart:"x1r67fr0",marginLeft:null,marginRight:null,marginTop:"x1gslohp",position:"x10l6tqk",userSelect:"x87ps6o",$$css:!0}});function k(a,b,c,d,e){for(var f in c){var g=b[f],h=c[f];g!==h&&d(a,f,h)}for(g in b)c[g]==null&&e(a,g)}function a(a,b,c){b=p(b.getStyleSheetRef(),b.getStyleID(),b.getMetadata());c=p(c.getStyleSheetRef(),c.getStyleID(),c.getMetadata());k(a,b.styles,c.styles,l,m);k(a,b.attributes,c.attributes,n,o)}function b(a,b,c){k(a,t(b.getStyles()),t(c.getStyles()),l,m)}function l(a,b,c){a.style[b]=c}function m(a,b){a.style.removeProperty(b)}function n(a,b,c){a.setAttribute(b,String(c))}function o(a,b){a.removeAttribute(b)}function p(a,b,c){var d=t(a.getStyle(b).properties);a=q(a,b,c);b=a.attributes;c=a.styles;return{attributes:babelHelpers["extends"]({},b),styles:babelHelpers["extends"]({},d,c)}}function e(a,b,d,e,f){a=document.createElement(a);c("isStringNullOrEmpty")(b)||(a.className=b);b=p(d,e,f);k(a,{},b.attributes,n,m);k(a,{},b.styles,l,o);return a}function f(a,b,c){var d=document.createElement("span");b!=null&&(d.className=b);d.appendChild(a);k(d,{},t(c),l,m);return d}function q(a,b,c){var e={},f={};if(c==null)return{attributes:f,styles:e};var g=c.type;switch(g){case"list-item":g=d("UERichTextShadowStructureUtils").assertAsListItemBlockMetadata(c);s(e,a,g);break;case"list":g=d("UERichTextShadowStructureUtils").assertAsListBlockMetadata(c);e.listStyleType="none";e.paddingStart=r(a,b);g.paragraphLevel>0&&(e.marginTop=0,e.marginBottom=0);g.listStartNumber!=null&&(f.start=g.listStartNumber);break;case"paragraph":g=d("UERichTextShadowStructureUtils").assertAsParagraphBlockMetadata(c);g.paragraphLevel!=null&&(e.paddingStart=r(a,b,g.paragraphLevel));break}return{attributes:f,styles:t(e)}}function r(a,b,c){c===void 0&&(c=1);b=(a=a.getStyle(b).properties.paddingStart)!=null?a:h;return b*c}function s(a,b,c){var e=j[c.parentListAttribute];b=a.listStyleType=b.getStyle(c.parentListAttribute).properties.listStyleType||"auto";c=e==null?void 0:e[(c.paragraphLevel+e.length)%e.length];a.listStyleType=d("UEHeadlessUtils").assertNonNull(c!=null?c:b,"Expected list style type to be non null.")}function t(a){return Object.entries(a).reduce(function(a,b){var c=b[0];b=b[1];var e=u(c);if(e==null)return a;var f=Boolean(b);switch(c){case"align":var g=d("UEUserInterfacePropertyAndStateUtils").getAsAlignPropertyValueEnforce(b);a[e]=i[g];break;case"bold":case"italic":f===!0&&(a[e]=c);break;case"background":case"borderStart":case"fontColor":case"fontFamily":case"listStyleType":case"whiteSpace":a[e]=b;break;case"fontSize":case"fontWeight":case"lineHeight":case"marginEnd":case"marginStart":case"marginTop":case"marginBottom":case"paddingBottom":case"paddingTop":case"paddingStart":case"paddingEnd":a[e]=String(b)+"px";break;case"strikethrough":case"underline":if(f===!0){a[e]=((g=a[e])!=null?g:"")+" "+(c==="strikethrough"?"line-through":"underline")}break}return a},{})}function u(a){switch(a){case"align":return"text-align";case"background":return"background";case"bold":return"font-weight";case"borderStart":return"border-left";case"fontColor":return"color";case"fontFamily":return"font-family";case"fontSize":return"font-size";case"italic":return"font-style";case"lineHeight":return"line-height";case"strikethrough":return"text-decoration";case"underline":return"text-decoration";case"marginEnd":return"margin-right";case"marginStart":return"margin-left";case"marginTop":return"margin-top";case"marginBottom":return"margin-bottom";case"paddingStart":return"padding-left";case"paddingEnd":return"padding-right";case"paddingTop":return"padding-top";case"paddingBottom":return"padding-bottom";case"listStyleType":return"list-style-type";case"whiteSpace":return"white-space"}return null}function v(a){var b,c=document.createElement("div");c.setAttribute("contenteditable","false");(b=c.classList).add.apply(b,"x1r67fr0 x1gslohp x10l6tqk x87ps6o".split(" "));c.appendChild(a);return c}function w(a,b){var c=document.createElement("input");c.setAttribute("type","checkbox");c.checked=b.completedState==="IS_COMPLETED";c.style.margin="0px";a.appendChild(v(c));return c}g.updateNodeFromPrevious=a;g.updateTextNodeFromPrevious=b;g.getDomProperties=p;g.createUEBlockDOMElement=e;g.createUEInlineDOMElement=f;g.wrapElementInNonEditableDomContainer=v;g.attachCheckboxToListItem=w}),98);
__d("useUnifiedEditorSaveVideoMutation",["RelayHooks","useUnifiedEditorSaveVideoMutation_Mutation.graphql"],(function(a,b,c,d,e,f,g){"use strict";var h,i=h!==void 0?h:h=b("useUnifiedEditorSaveVideoMutation_Mutation.graphql");function a(){var a=d("RelayHooks").useMutation(i);a=a[0];return a}g["default"]=a}),98);
__d("UEVideoComponentGlimmer.react",["fbt","CometRelay","FBLogger","UEComponentAPIContext","UEComponentDataContext","UEComponentQueryContainer.react","UEMediaComponentGlimmer.react","UEUndoRedoUtils","UEUploadMediaMonitorDispatcherContext","UEVideo","UEVideoComponentGlimmerEncodingQuery.graphql","react","recoverableViolation","useUEAccessibilityAnnouncer","useUEDocumentID","useUnifiedEditorSaveVideoMutation"],(function(a,b,c,d,e,f,g,h){"use strict";var i,j,k=j||(j=d("react")),l=j.useContext;function a(a){a=a.layout;var b=d("CometRelay").useRelayEnvironment(),e=c("useUEAccessibilityAnnouncer")();e[0];var f=e[1],g=c("useUnifiedEditorSaveVideoMutation")(),i=l(c("UEUploadMediaMonitorDispatcherContext"));e=l(c("UEComponentDataContext"));var j=e.loadedNodes;e=l(d("UEComponentAPIContext").UEComponentAPIContext);var m=e.deleteComponent,o=e.updateComponent,p=c("useUEDocumentID")();e=(e=a)!=null?e:{};var q=e.attachment;e=e.component;if(!(e instanceof c("UEVideo"))||q==null)return k.jsx(c("UEMediaComponentGlimmer.react"),{layout:a});var r=e.getProperties().mediaID;if(r==null)return k.jsx(c("UEMediaComponentGlimmer.react"),{layout:a});var s=q.componentID;e=function(){i({nodeID:s,type:"upload_failed"}),m(q,{referrer:"do-not-log"},d("UEUndoRedoUtils").UEUndoCapability.NOT_UNDOABLE)};var t=function(){i({nodeIDs:new Set([s]),type:"remove_uploads"});var a=d("CometRelay").loadQuery(b,d("UEComponentQueryContainer.react").UEComponentQuery,{components:[{id:s,properties:JSON.stringify({mediaID:r}),type:"video"}]},{fetchPolicy:"store-or-network"});j.set(s,a);o(s,{loadingState:"ready",mediaID:r},{referrer:"toolbar"},d("UEUndoRedoUtils").UEUndoCapability.NOT_UNDOABLE);g({onCompleted:function(){c("FBLogger")("unified_editor").info("Save video to UE document"),f(h._("__JHASH__CcgWAuqXPeV__JHASH__"))},onError:function(a){},variables:{input:{article_id:p,video_id:r}}})};n(b,r,e,t);return k.jsx(c("UEMediaComponentGlimmer.react"),{layout:a})}a.displayName=a.name+" [from "+f.id+"]";var m=new Set(["TOO_LONG","ENCODE_FAILED","UPLOAD_FAILED"]);function n(a,e,f,g){var h=d("CometRelay").fetchQuery(a,i!==void 0?i:i=b("UEVideoComponentGlimmerEncodingQuery.graphql"),{videoID:e}).subscribe({error:function(){h.unsubscribe(),f()},next:function(a){var b;b=a==null?void 0:(b=a.node)==null?void 0:b.video_status_type;if(b==="OK"){h.unsubscribe();a=a==null?void 0:(a=a.node)==null?void 0:a.id;a==null?(c("recoverableViolation")("Video encoding response is null","unified_editor"),f()):g(a)}else b!=null&&m.has(b)&&(h.unsubscribe(),c("recoverableViolation")("Video uploading failure while waiting for encoding","unified_editor"),f())}});return h}g["default"]=a}),98);
__d("convertCollabriDocToRDFB",["CollabriYjs","UECollabriYjsTypes","UEHeadlessUtils","UERichTextStringMutatorUtils","UESampleConfig","adjustChangesOrderForInitialUEDiffFromCollabri","assertToUECollabriContainer","createRichTextFrame","createRoot","getInitialDiffForComponentContainer","getInitialDiffForRichTextString","getInitialDiffForStyleSheet","saveAsRDFBJsonDoc"],(function(a,b,c,d,e,f,g){"use strict";function a(a){var b,e=c("createRoot")(c("UESampleConfig").styles,c("UESampleConfig").spacings);e=e.getDocumentEnforce();var f=e.getChildAtIdx(0),g=e.getStyleSheet(),h=e.getComponentContainer(),i=c("createRichTextFrame")();i.setParent(f);f.appendChild(i);var j=i.getContent();i.onAddedToDocument(e);e.didLoad();var k=new(c("CollabriYjs"))();k=k.deserialize(a);k=(a=c("assertToUECollabriContainer"))(k.getMap("documentNodeContainer"));var l=k.id;k=k.node;var m=(b=d("UEHeadlessUtils")).assertNonNull(k.get("children"),"cannot get children map from collabri doc"),n=a(k.get("styleSheet")),o=n.id;n=n.node;n=b.assertNonNull(n.get("styles"),"cannot get styles map from collabri doc");m=a(m.get(0));var p=m.id;m=m.node;m=b.assertNonNull(m.get("children"),"cannot get children map from collabri doc");m=a(m.get(0));var q=m.id;m=m.node;m=b.assertNonNull(m.get("children"),"cannot get children map from collabri doc");a=a(m.get(0));m=a.id;a=a.node;var r=b.assertNonNull(a.get("text"),"cannot get collabri text from collabri doc");b=b.assertNonNull(a.get("children"),"cannot get collabri text from collabri doc");a=c("getInitialDiffForStyleSheet")(n,g).appendChanges(c("getInitialDiffForRichTextString")(r,b,j));if(k.get(d("UECollabriYjsTypes").COMPONENT_CONTAINER_NODE)!=null){n=c("assertToUECollabriContainer")(k.get(d("UECollabriYjsTypes").COMPONENT_CONTAINER_NODE));r=n.id;b=n.node;k=d("UEHeadlessUtils").assertNonNull(b.get(d("UECollabriYjsTypes").COMPONENT_CONTAINER),"cannot get styles map from collabri doc");a.appendChanges(c("getInitialDiffForComponentContainer")(k));h.setID_DO_NOT_USE(r)}else h.setID_DO_NOT_USE("COMPONENT-CONTAINER-HARDCODED-ID");d("UERichTextStringMutatorUtils").runDiffWithRichTextString(j,c("adjustChangesOrderForInitialUEDiffFromCollabri")(a));e.setID_DO_NOT_USE(l);g.setID_DO_NOT_USE(o);f.setID_DO_NOT_USE(p);i.setID_DO_NOT_USE(q);j.setID_DO_NOT_USE(m);return JSON.stringify(c("saveAsRDFBJsonDoc")(e))}g.convertCollabriDocToRDFB=a}),98);
__d("KnowledgeNotesReadPermalinkGeminiRoot.entrypoint",["JSResourceForInteraction","KnowledgeNotesReadPermalinkGeminiRootQuery$Parameters","convertCollabriDocToRDFB","unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";a={getPreloadProps:function(a){var e=a.routeParams;a=a.routeProps;var f=a.collabriDoc;a=a.shouldUseUEV2;var g=null;if(a){if(f==null)throw c("unrecoverableViolation")("UEv2 document should not have null collabri doc","unified_editor");g=d("convertCollabriDocToRDFB").convertCollabriDocToRDFB(f)}return{extraProps:{collabRDFB:g},queries:{knowledgeNotesReadPermalinkGeminiRootQueryReference:{parameters:b("KnowledgeNotesReadPermalinkGeminiRootQuery$Parameters"),variables:{noteID:e.note_id,collabRDFB:g},options:{fetchPolicy:"network-only"}}}}},root:c("JSResourceForInteraction")("KnowledgeNotesReadPermalinkGeminiRoot.react").__setRef("KnowledgeNotesReadPermalinkGeminiRoot.entrypoint")};g["default"]=a}),98);