sykpcomposer 1.20.53 → 1.20.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -61,9 +61,16 @@ Check the top-level render call using <`+Pe+">.")}return He}}function xt(Oe,He){
61
61
  `):$)),X};var zn=/^(?:focusinfocus|focusoutblur)$/,Un=function($){$.stopPropagation()};y.extend(y.event,{trigger:function($,X,te,ae){var ye,_e,Ne,nt,Xe,ut,Mt,$t,St=[te||_],Qt=f.call($,"type")?$.type:$,In=f.call($,"namespace")?$.namespace.split("."):[];if(_e=$t=Ne=te=te||_,!(te.nodeType===3||te.nodeType===8)&&!zn.test(Qt+y.event.triggered)&&(Qt.indexOf(".")>-1&&(In=Qt.split("."),Qt=In.shift(),In.sort()),Xe=Qt.indexOf(":")<0&&"on"+Qt,$=$[y.expando]?$:new y.Event(Qt,typeof $=="object"&&$),$.isTrigger=ae?2:3,$.namespace=In.join("."),$.rnamespace=$.namespace?new RegExp("(^|\\.)"+In.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,$.result=void 0,$.target||($.target=te),X=X==null?[$]:y.makeArray(X,[$]),Mt=y.event.special[Qt]||{},!(!ae&&Mt.trigger&&Mt.trigger.apply(te,X)===!1))){if(!ae&&!Mt.noBubble&&!g(te)){for(nt=Mt.delegateType||Qt,zn.test(nt+Qt)||(_e=_e.parentNode);_e;_e=_e.parentNode)St.push(_e),Ne=_e;Ne===(te.ownerDocument||_)&&St.push(Ne.defaultView||Ne.parentWindow||t)}for(ye=0;(_e=St[ye++])&&!$.isPropagationStopped();)$t=_e,$.type=ye>1?nt:Mt.bindType||Qt,ut=(le.get(_e,"events")||Object.create(null))[$.type]&&le.get(_e,"handle"),ut&&ut.apply(_e,X),ut=Xe&&_e[Xe],ut&&ut.apply&&se(_e)&&($.result=ut.apply(_e,X),$.result===!1&&$.preventDefault());return $.type=Qt,!ae&&!$.isDefaultPrevented()&&(!Mt._default||Mt._default.apply(St.pop(),X)===!1)&&se(te)&&Xe&&m(te[Qt])&&!g(te)&&(Ne=te[Xe],Ne&&(te[Xe]=null),y.event.triggered=Qt,$.isPropagationStopped()&&$t.addEventListener(Qt,Un),te[Qt](),$.isPropagationStopped()&&$t.removeEventListener(Qt,Un),y.event.triggered=void 0,Ne&&(te[Xe]=Ne)),$.result}},simulate:function($,X,te){var ae=y.extend(new y.Event,te,{type:$,isSimulated:!0});y.event.trigger(ae,null,X)}}),y.fn.extend({trigger:function($,X){return this.each(function(){y.event.trigger($,X,this)})},triggerHandler:function($,X){var te=this[0];if(te)return y.event.trigger($,X,te,!0)}});var ri=/\[\]$/,Jo=/\r?\n/g,ki=/^(?:submit|button|image|reset|file)$/i,cs=/^(?:input|select|textarea|keygen)/i;function us($,X,te,ae){var ye;if(Array.isArray(X))y.each(X,function(_e,Ne){te||ri.test($)?ae($,Ne):us($+"["+(typeof Ne=="object"&&Ne!=null?_e:"")+"]",Ne,te,ae)});else if(!te&&E(X)==="object")for(ye in X)us($+"["+ye+"]",X[ye],te,ae);else ae($,X)}y.param=function($,X){var te,ae=[],ye=function(_e,Ne){var nt=m(Ne)?Ne():Ne;ae[ae.length]=encodeURIComponent(_e)+"="+encodeURIComponent(nt??"")};if($==null)return"";if(Array.isArray($)||$.jquery&&!y.isPlainObject($))y.each($,function(){ye(this.name,this.value)});else for(te in $)us(te,$[te],X,ye);return ae.join("&")},y.fn.extend({serialize:function(){return y.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var $=y.prop(this,"elements");return $?y.makeArray($):this}).filter(function(){var $=this.type;return this.name&&!y(this).is(":disabled")&&cs.test(this.nodeName)&&!ki.test($)&&(this.checked||!xt.test($))}).map(function($,X){var te=y(this).val();return te==null?null:Array.isArray(te)?y.map(te,function(ae){return{name:X.name,value:ae.replace(Jo,`\r
62
62
  `)}}):{name:X.name,value:te.replace(Jo,`\r
63
63
  `)}}).get()}});var js=/%20/g,Mo=/#.*$/,ks=/([?&])_=[^&]*/,$l=/^(.*?):[ \t]*([^\r\n]*)$/mg,yu=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Yd=/^(?:GET|HEAD)$/,aa=/^\/\//,la={},ca={},Ts="*/".concat("*"),Ui=_.createElement("a");Ui.href=Co.href;function fi($){return function(X,te){typeof X!="string"&&(te=X,X="*");var ae,ye=0,_e=X.toLowerCase().match(Z)||[];if(m(te))for(;ae=_e[ye++];)ae[0]==="+"?(ae=ae.slice(1)||"*",($[ae]=$[ae]||[]).unshift(te)):($[ae]=$[ae]||[]).push(te)}}function Hi($,X,te,ae){var ye={},_e=$===ca;function Ne(nt){var Xe;return ye[nt]=!0,y.each($[nt]||[],function(ut,Mt){var $t=Mt(X,te,ae);if(typeof $t=="string"&&!_e&&!ye[$t])return X.dataTypes.unshift($t),Ne($t),!1;if(_e)return!(Xe=$t)}),Xe}return Ne(X.dataTypes[0])||!ye["*"]&&Ne("*")}function Ti($,X){var te,ae,ye=y.ajaxSettings.flatOptions||{};for(te in X)X[te]!==void 0&&((ye[te]?$:ae||(ae={}))[te]=X[te]);return ae&&y.extend(!0,$,ae),$}function $i($,X,te){for(var ae,ye,_e,Ne,nt=$.contents,Xe=$.dataTypes;Xe[0]==="*";)Xe.shift(),ae===void 0&&(ae=$.mimeType||X.getResponseHeader("Content-Type"));if(ae){for(ye in nt)if(nt[ye]&&nt[ye].test(ae)){Xe.unshift(ye);break}}if(Xe[0]in te)_e=Xe[0];else{for(ye in te){if(!Xe[0]||$.converters[ye+" "+Xe[0]]){_e=ye;break}Ne||(Ne=ye)}_e=_e||Ne}if(_e)return _e!==Xe[0]&&Xe.unshift(_e),te[_e]}function Oi($,X,te,ae){var ye,_e,Ne,nt,Xe,ut={},Mt=$.dataTypes.slice();if(Mt[1])for(Ne in $.converters)ut[Ne.toLowerCase()]=$.converters[Ne];for(_e=Mt.shift();_e;)if($.responseFields[_e]&&(te[$.responseFields[_e]]=X),!Xe&&ae&&$.dataFilter&&(X=$.dataFilter(X,$.dataType)),Xe=_e,_e=Mt.shift(),_e){if(_e==="*")_e=Xe;else if(Xe!=="*"&&Xe!==_e){if(Ne=ut[Xe+" "+_e]||ut["* "+_e],!Ne){for(ye in ut)if(nt=ye.split(" "),nt[1]===_e&&(Ne=ut[Xe+" "+nt[0]]||ut["* "+nt[0]],Ne)){Ne===!0?Ne=ut[ye]:ut[ye]!==!0&&(_e=nt[0],Mt.unshift(nt[1]));break}}if(Ne!==!0)if(Ne&&$.throws)X=Ne(X);else try{X=Ne(X)}catch($t){return{state:"parsererror",error:Ne?$t:"No conversion from "+Xe+" to "+_e}}}}return{state:"success",data:X}}y.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Co.href,type:"GET",isLocal:yu.test(Co.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Ts,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":y.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function($,X){return X?Ti(Ti($,y.ajaxSettings),X):Ti(y.ajaxSettings,$)},ajaxPrefilter:fi(la),ajaxTransport:fi(ca),ajax:function($,X){typeof $=="object"&&(X=$,$=void 0),X=X||{};var te,ae,ye,_e,Ne,nt,Xe,ut,Mt,$t,St=y.ajaxSetup({},X),Qt=St.context||St,In=St.context&&(Qt.nodeType||Qt.jquery)?y(Qt):y.event,tr=y.Deferred(),Ln=y.Callbacks("once memory"),Xr=St.statusCode||{},Tr={},jo={},_r="canceled",Ve={readyState:0,getResponseHeader:function(bt){var Yt;if(Xe){if(!_e)for(_e={};Yt=$l.exec(ye);)_e[Yt[1].toLowerCase()+" "]=(_e[Yt[1].toLowerCase()+" "]||[]).concat(Yt[2]);Yt=_e[bt.toLowerCase()+" "]}return Yt==null?null:Yt.join(", ")},getAllResponseHeaders:function(){return Xe?ye:null},setRequestHeader:function(bt,Yt){return Xe==null&&(bt=jo[bt.toLowerCase()]=jo[bt.toLowerCase()]||bt,Tr[bt]=Yt),this},overrideMimeType:function(bt){return Xe==null&&(St.mimeType=bt),this},statusCode:function(bt){var Yt;if(bt)if(Xe)Ve.always(bt[Ve.status]);else for(Yt in bt)Xr[Yt]=[Xr[Yt],bt[Yt]];return this},abort:function(bt){var Yt=bt||_r;return te&&te.abort(Yt),wt(0,Yt),this}};if(tr.promise(Ve),St.url=(($||St.url||Co.href)+"").replace(aa,Co.protocol+"//"),St.type=X.method||X.type||St.method||St.type,St.dataTypes=(St.dataType||"*").toLowerCase().match(Z)||[""],St.crossDomain==null){nt=_.createElement("a");try{nt.href=St.url,nt.href=nt.href,St.crossDomain=Ui.protocol+"//"+Ui.host!=nt.protocol+"//"+nt.host}catch{St.crossDomain=!0}}if(St.data&&St.processData&&typeof St.data!="string"&&(St.data=y.param(St.data,St.traditional)),Hi(la,St,X,Ve),Xe)return Ve;ut=y.event&&St.global,ut&&y.active++===0&&y.event.trigger("ajaxStart"),St.type=St.type.toUpperCase(),St.hasContent=!Yd.test(St.type),ae=St.url.replace(Mo,""),St.hasContent?St.data&&St.processData&&(St.contentType||"").indexOf("application/x-www-form-urlencoded")===0&&(St.data=St.data.replace(js,"+")):($t=St.url.slice(ae.length),St.data&&(St.processData||typeof St.data=="string")&&(ae+=(zi.test(ae)?"&":"?")+St.data,delete St.data),St.cache===!1&&(ae=ae.replace(ks,"$1"),$t=(zi.test(ae)?"&":"?")+"_="+cr.guid+++$t),St.url=ae+$t),St.ifModified&&(y.lastModified[ae]&&Ve.setRequestHeader("If-Modified-Since",y.lastModified[ae]),y.etag[ae]&&Ve.setRequestHeader("If-None-Match",y.etag[ae])),(St.data&&St.hasContent&&St.contentType!==!1||X.contentType)&&Ve.setRequestHeader("Content-Type",St.contentType),Ve.setRequestHeader("Accept",St.dataTypes[0]&&St.accepts[St.dataTypes[0]]?St.accepts[St.dataTypes[0]]+(St.dataTypes[0]!=="*"?", "+Ts+"; q=0.01":""):St.accepts["*"]);for(Mt in St.headers)Ve.setRequestHeader(Mt,St.headers[Mt]);if(St.beforeSend&&(St.beforeSend.call(Qt,Ve,St)===!1||Xe))return Ve.abort();if(_r="abort",Ln.add(St.complete),Ve.done(St.success),Ve.fail(St.error),te=Hi(ca,St,X,Ve),!te)wt(-1,"No Transport");else{if(Ve.readyState=1,ut&&In.trigger("ajaxSend",[Ve,St]),Xe)return Ve;St.async&&St.timeout>0&&(Ne=t.setTimeout(function(){Ve.abort("timeout")},St.timeout));try{Xe=!1,te.send(Tr,wt)}catch(bt){if(Xe)throw bt;wt(-1,bt)}}function wt(bt,Yt,jn,Nn){var yn,pn,ar,xr,Lo,ro=Yt;Xe||(Xe=!0,Ne&&t.clearTimeout(Ne),te=void 0,ye=Nn||"",Ve.readyState=bt>0?4:0,yn=bt>=200&&bt<300||bt===304,jn&&(xr=$i(St,Ve,jn)),!yn&&y.inArray("script",St.dataTypes)>-1&&y.inArray("json",St.dataTypes)<0&&(St.converters["text script"]=function(){}),xr=Oi(St,xr,Ve,yn),yn?(St.ifModified&&(Lo=Ve.getResponseHeader("Last-Modified"),Lo&&(y.lastModified[ae]=Lo),Lo=Ve.getResponseHeader("etag"),Lo&&(y.etag[ae]=Lo)),bt===204||St.type==="HEAD"?ro="nocontent":bt===304?ro="notmodified":(ro=xr.state,pn=xr.data,ar=xr.error,yn=!ar)):(ar=ro,(bt||!ro)&&(ro="error",bt<0&&(bt=0))),Ve.status=bt,Ve.statusText=(Yt||ro)+"",yn?tr.resolveWith(Qt,[pn,ro,Ve]):tr.rejectWith(Qt,[Ve,ro,ar]),Ve.statusCode(Xr),Xr=void 0,ut&&In.trigger(yn?"ajaxSuccess":"ajaxError",[Ve,St,yn?pn:ar]),Ln.fireWith(Qt,[Ve,ro]),ut&&(In.trigger("ajaxComplete",[Ve,St]),--y.active||y.event.trigger("ajaxStop")))}return Ve},getJSON:function($,X,te){return y.get($,X,te,"json")},getScript:function($,X){return y.get($,void 0,X,"script")}}),y.each(["get","post"],function($,X){y[X]=function(te,ae,ye,_e){return m(ae)&&(_e=_e||ye,ye=ae,ae=void 0),y.ajax(y.extend({url:te,type:X,dataType:_e,data:ae,success:ye},y.isPlainObject(te)&&te))}}),y.ajaxPrefilter(function($){var X;for(X in $.headers)X.toLowerCase()==="content-type"&&($.contentType=$.headers[X]||"")}),y._evalUrl=function($,X,te){return y.ajax({url:$,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(ae){y.globalEval(ae,X,te)}})},y.fn.extend({wrapAll:function($){var X;return this[0]&&(m($)&&($=$.call(this[0])),X=y($,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&X.insertBefore(this[0]),X.map(function(){for(var te=this;te.firstElementChild;)te=te.firstElementChild;return te}).append(this)),this},wrapInner:function($){return m($)?this.each(function(X){y(this).wrapInner($.call(this,X))}):this.each(function(){var X=y(this),te=X.contents();te.length?te.wrapAll($):X.append($)})},wrap:function($){var X=m($);return this.each(function(te){y(this).wrapAll(X?$.call(this,te):$)})},unwrap:function($){return this.parent($).not("body").each(function(){y(this).replaceWith(this.childNodes)}),this}}),y.expr.pseudos.hidden=function($){return!y.expr.pseudos.visible($)},y.expr.pseudos.visible=function($){return!!($.offsetWidth||$.offsetHeight||$.getClientRects().length)},y.ajaxSettings.xhr=function(){try{return new t.XMLHttpRequest}catch{}};var qi={0:200,1223:204},uo=y.ajaxSettings.xhr();h.cors=!!uo&&"withCredentials"in uo,h.ajax=uo=!!uo,y.ajaxTransport(function($){var X,te;if(h.cors||uo&&!$.crossDomain)return{send:function(ae,ye){var _e,Ne=$.xhr();if(Ne.open($.type,$.url,$.async,$.username,$.password),$.xhrFields)for(_e in $.xhrFields)Ne[_e]=$.xhrFields[_e];$.mimeType&&Ne.overrideMimeType&&Ne.overrideMimeType($.mimeType),!$.crossDomain&&!ae["X-Requested-With"]&&(ae["X-Requested-With"]="XMLHttpRequest");for(_e in ae)Ne.setRequestHeader(_e,ae[_e]);X=function(nt){return function(){X&&(X=te=Ne.onload=Ne.onerror=Ne.onabort=Ne.ontimeout=Ne.onreadystatechange=null,nt==="abort"?Ne.abort():nt==="error"?typeof Ne.status!="number"?ye(0,"error"):ye(Ne.status,Ne.statusText):ye(qi[Ne.status]||Ne.status,Ne.statusText,(Ne.responseType||"text")!=="text"||typeof Ne.responseText!="string"?{binary:Ne.response}:{text:Ne.responseText},Ne.getAllResponseHeaders()))}},Ne.onload=X(),te=Ne.onerror=Ne.ontimeout=X("error"),Ne.onabort!==void 0?Ne.onabort=te:Ne.onreadystatechange=function(){Ne.readyState===4&&t.setTimeout(function(){X&&te()})},X=X("abort");try{Ne.send($.hasContent&&$.data||null)}catch(nt){if(X)throw nt}},abort:function(){X&&X()}}}),y.ajaxPrefilter(function($){$.crossDomain&&($.contents.script=!1)}),y.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function($){return y.globalEval($),$}}}),y.ajaxPrefilter("script",function($){$.cache===void 0&&($.cache=!1),$.crossDomain&&($.type="GET")}),y.ajaxTransport("script",function($){if($.crossDomain||$.scriptAttrs){var X,te;return{send:function(ae,ye){X=y("<script>").attr($.scriptAttrs||{}).prop({charset:$.scriptCharset,src:$.url}).on("load error",te=function(_e){X.remove(),te=null,_e&&ye(_e.type==="error"?404:200,_e.type)}),_.head.appendChild(X[0])},abort:function(){te&&te()}}}});var Zr=[],Do=/(=)\?(?=&|$)|\?\?/;y.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var $=Zr.pop()||y.expando+"_"+cr.guid++;return this[$]=!0,$}}),y.ajaxPrefilter("json jsonp",function($,X,te){var ae,ye,_e,Ne=$.jsonp!==!1&&(Do.test($.url)?"url":typeof $.data=="string"&&($.contentType||"").indexOf("application/x-www-form-urlencoded")===0&&Do.test($.data)&&"data");if(Ne||$.dataTypes[0]==="jsonp")return ae=$.jsonpCallback=m($.jsonpCallback)?$.jsonpCallback():$.jsonpCallback,Ne?$[Ne]=$[Ne].replace(Do,"$1"+ae):$.jsonp!==!1&&($.url+=(zi.test($.url)?"&":"?")+$.jsonp+"="+ae),$.converters["script json"]=function(){return _e||y.error(ae+" was not called"),_e[0]},$.dataTypes[0]="json",ye=t[ae],t[ae]=function(){_e=arguments},te.always(function(){ye===void 0?y(t).removeProp(ae):t[ae]=ye,$[ae]&&($.jsonpCallback=X.jsonpCallback,Zr.push(ae)),_e&&m(ye)&&ye(_e[0]),_e=ye=void 0}),"script"}),h.createHTMLDocument=function(){var $=_.implementation.createHTMLDocument("").body;return $.innerHTML="<form></form><form></form>",$.childNodes.length===2}(),y.parseHTML=function($,X,te){if(typeof $!="string")return[];typeof X=="boolean"&&(te=X,X=!1);var ae,ye,_e;return X||(h.createHTMLDocument?(X=_.implementation.createHTMLDocument(""),ae=X.createElement("base"),ae.href=_.location.href,X.head.appendChild(ae)):X=_),ye=z.exec($),_e=!te&&[],ye?[X.createElement(ye[1])]:(ye=At([$],X,_e),_e&&_e.length&&y(_e).remove(),y.merge([],ye.childNodes))},y.fn.load=function($,X,te){var ae,ye,_e,Ne=this,nt=$.indexOf(" ");return nt>-1&&(ae=ni($.slice(nt)),$=$.slice(0,nt)),m(X)?(te=X,X=void 0):X&&typeof X=="object"&&(ye="POST"),Ne.length>0&&y.ajax({url:$,type:ye||"GET",dataType:"html",data:X}).done(function(Xe){_e=arguments,Ne.html(ae?y("<div>").append(y.parseHTML(Xe)).find(ae):Xe)}).always(te&&function(Xe,ut){Ne.each(function(){te.apply(this,_e||[Xe.responseText,ut,Xe])})}),this},y.expr.pseudos.animated=function($){return y.grep(y.timers,function(X){return $===X.elem}).length},y.offset={setOffset:function($,X,te){var ae,ye,_e,Ne,nt,Xe,ut,Mt=y.css($,"position"),$t=y($),St={};Mt==="static"&&($.style.position="relative"),nt=$t.offset(),_e=y.css($,"top"),Xe=y.css($,"left"),ut=(Mt==="absolute"||Mt==="fixed")&&(_e+Xe).indexOf("auto")>-1,ut?(ae=$t.position(),Ne=ae.top,ye=ae.left):(Ne=parseFloat(_e)||0,ye=parseFloat(Xe)||0),m(X)&&(X=X.call($,te,y.extend({},nt))),X.top!=null&&(St.top=X.top-nt.top+Ne),X.left!=null&&(St.left=X.left-nt.left+ye),"using"in X?X.using.call($,St):$t.css(St)}},y.fn.extend({offset:function($){if(arguments.length)return $===void 0?this:this.each(function(ye){y.offset.setOffset(this,$,ye)});var X,te,ae=this[0];if(ae)return ae.getClientRects().length?(X=ae.getBoundingClientRect(),te=ae.ownerDocument.defaultView,{top:X.top+te.pageYOffset,left:X.left+te.pageXOffset}):{top:0,left:0}},position:function(){if(this[0]){var $,X,te,ae=this[0],ye={top:0,left:0};if(y.css(ae,"position")==="fixed")X=ae.getBoundingClientRect();else{for(X=this.offset(),te=ae.ownerDocument,$=ae.offsetParent||te.documentElement;$&&($===te.body||$===te.documentElement)&&y.css($,"position")==="static";)$=$.parentNode;$&&$!==ae&&$.nodeType===1&&(ye=y($).offset(),ye.top+=y.css($,"borderTopWidth",!0),ye.left+=y.css($,"borderLeftWidth",!0))}return{top:X.top-ye.top-y.css(ae,"marginTop",!0),left:X.left-ye.left-y.css(ae,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var $=this.offsetParent;$&&y.css($,"position")==="static";)$=$.offsetParent;return $||et})}}),y.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function($,X){var te=X==="pageYOffset";y.fn[$]=function(ae){return Se(this,function(ye,_e,Ne){var nt;if(g(ye)?nt=ye:ye.nodeType===9&&(nt=ye.defaultView),Ne===void 0)return nt?nt[X]:ye[_e];nt?nt.scrollTo(te?nt.pageXOffset:Ne,te?Ne:nt.pageYOffset):ye[_e]=Ne},$,ae,arguments.length)}}),y.each(["top","left"],function($,X){y.cssHooks[X]=ot(h.pixelPosition,function(te,ae){if(ae)return ae=$e(te,X),Rt.test(ae)?y(te).position()[X]+"px":ae})}),y.each({Height:"height",Width:"width"},function($,X){y.each({padding:"inner"+$,content:X,"":"outer"+$},function(te,ae){y.fn[ae]=function(ye,_e){var Ne=arguments.length&&(te||typeof ye!="boolean"),nt=te||(ye===!0||_e===!0?"margin":"border");return Se(this,function(Xe,ut,Mt){var $t;return g(Xe)?ae.indexOf("outer")===0?Xe["inner"+$]:Xe.document.documentElement["client"+$]:Xe.nodeType===9?($t=Xe.documentElement,Math.max(Xe.body["scroll"+$],$t["scroll"+$],Xe.body["offset"+$],$t["offset"+$],$t["client"+$])):Mt===void 0?y.css(Xe,ut,nt):y.style(Xe,ut,Mt,nt)},X,Ne?ye:void 0,Ne)}})}),y.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function($,X){y.fn[X]=function(te){return this.on(X,te)}}),y.fn.extend({bind:function($,X,te){return this.on($,null,X,te)},unbind:function($,X){return this.off($,null,X)},delegate:function($,X,te,ae){return this.on(X,$,te,ae)},undelegate:function($,X,te){return arguments.length===1?this.off($,"**"):this.off(X,$||"**",te)},hover:function($,X){return this.on("mouseenter",$).on("mouseleave",X||$)}}),y.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function($,X){y.fn[X]=function(te,ae){return arguments.length>0?this.on(X,null,te,ae):this.trigger(X)}});var pi=/^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g;y.proxy=function($,X){var te,ae,ye;if(typeof X=="string"&&(te=$[X],X=$,$=te),!!m($))return ae=r.call(arguments,2),ye=function(){return $.apply(X||this,ae.concat(r.call(arguments)))},ye.guid=$.guid=$.guid||y.guid++,ye},y.holdReady=function($){$?y.readyWait++:y.ready(!0)},y.isArray=Array.isArray,y.parseJSON=JSON.parse,y.nodeName=C,y.isFunction=m,y.isWindow=g,y.camelCase=ue,y.type=E,y.now=Date.now,y.isNumeric=function($){var X=y.type($);return(X==="number"||X==="string")&&!isNaN($-parseFloat($))},y.trim=function($){return $==null?"":($+"").replace(pi,"$1")};var Ro=t.jQuery,ds=t.$;return y.noConflict=function($){return t.$===y&&(t.$=ds),$&&t.jQuery===y&&(t.jQuery=Ro),y},typeof n>"u"&&(t.jQuery=t.$=y),y})})(b1);var ST=b1.exports;const Tl=Bu(ST);function ET({nodeKey:l}){const[t]=xn(),[n,e,s]=Ec(l),r=he.useCallback(o=>{if(o.preventDefault(),n&&fr(Ot())){const a=Rn(l);if(Km(a)){const c=a.getPageNo();a.remove(),console.log("Deleted Page Break:",c);const u=Mn().getChildren();for(const f of u)if(Km(f)){const d=f.getPageNo();d>c&&f.setPageNo(d-1)}return!0}}return!1},[n,l]);return he.useEffect(()=>br(t.registerCommand(va,o=>{const a=t.getElementByKey(l);return o.target===a?(o.shiftKey||s(),e(!n),!0):!1},Gn),t.registerCommand(Xi,r,Gn),t.registerCommand(Zi,r,Gn)),[s,t,n,l,r,e]),he.useEffect(()=>{const o=t.getElementByKey(l);o!==null&&(o.className=n?"selected":"")},[t,n,l]),null}class Ol extends Hs{constructor(n=1,e){super(e);Hn(this,"__pageNumber");this.__pageNumber=n}static getType(){return"page-break"}getPageNo(){return this.__pageNumber}setPageNo(n){const e=this.getWritable();e.__pageNumber=n}static clone(n){return new Ol(n.__pageNumber,n.__key)}static importJSON(n){return new Ol(n.pageNumber)}static importDOM(){return{figure:n=>n.getAttribute("type")!==this.getType()?null:{conversion:CT,priority:xi}}}exportJSON(){return{type:this.getType(),version:1,pageNumber:this.__pageNumber}}createDOM(){const n=document.createElement("figure"),e=document.createElement("span");return n.style.pageBreakAfter="always",n.setAttribute("type","page-break"),e.innerHTML=`${this.__pageNumber}.`,e.style.position="absolute",e.style.left="97%",e.style.bottom="0",n.append(e),n.setAttribute("data-page-number",this.__pageNumber.toString()),n}getTextContent(){return`
64
- `}isInline(){return!1}updateDOM(){return!1}decorate(){return ce.jsx(ET,{nodeKey:this.__key})}static fromCodoxNode(n){const e=n.pageNumber,s={type:n.codox_metadata.type,text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,pageNumber:e,style:"",id:n.codox_metadata.id};return console.log("[DEMO DEBUG][PageBreakNode][fromCodoxNode]: ",{codoxNode:n,originalJsonNode:s}),new Ol(s.pageNumber)}toCodoxNode(){const n=this.exportJSON(),e={type:"page-break",text:"",pageNumber:n.pageNumber,style:"",version:n.version,codox_metadata:{type:n.type,id:n.pageNumber}};return console.log("[DEMO DEBUG][PageBreakNode][toCodoxNode]: ",{convertedNode:e,originalJsonNode:n}),e}}function CT(l){const t=l.getAttribute("data-page-number"),n=t?parseInt(t,10):1;return{node:w1(n)}}function w1(l){if(l===void 0){const t=Tl("p").length-1;l=Math.ceil(t/20)||1}return new Ol(l)}function Km(l){return l instanceof Ol}const jT=or.lazy(()=>Promise.resolve().then(()=>WD));function kT(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function TT(l=""){return{text:l,uid:kT(),votes:[]}}function x1(l,t,n){return{text:t,uid:l.uid,votes:n||Array.from(l.votes)}}function OT(l){const t=l.getAttribute("data-lexical-poll-question"),n=l.getAttribute("data-lexical-poll-options");return t!==null&&n!==null?{node:S1(t,JSON.parse(n))}:null}let Gm=class Yj extends Hs{constructor(n,e,s){super(s);Hn(this,"__question");Hn(this,"__options");this.__question=n,this.__options=e}static getType(){return"poll"}static clone(n){return new Yj(n.__question,n.__options,n.__key)}static importJSON(n){const e=S1(n.question,n.options);return n.options.forEach(e.addOption),e}exportJSON(){return{options:this.__options,question:this.__question,type:"poll",version:1}}addOption(n){const e=this.getWritable(),s=Array.from(e.__options);s.push(n),e.__options=s}deleteOption(n){const e=this.getWritable(),s=Array.from(e.__options),r=s.indexOf(n);s.splice(r,1),e.__options=s}setOptionText(n,e){const s=this.getWritable(),r=x1(n,e),o=Array.from(s.__options),a=o.indexOf(n);o[a]=r,s.__options=o}toggleVote(n,e){const s=this.getWritable(),r=n.votes,o=Array.from(r),a=r.indexOf(e);a===-1?o.push(e):o.splice(a,1);const c=x1(n,n.text,o),i=Array.from(s.__options),u=i.indexOf(n);i[u]=c,s.__options=i}static importDOM(){return{span:n=>n.hasAttribute("data-lexical-poll-question")?{conversion:OT,priority:2}:null}}exportDOM(){const n=document.createElement("span");return n.setAttribute("data-lexical-poll-question",this.__question),n.setAttribute("data-lexical-poll-options",JSON.stringify(this.__options)),{element:n}}createDOM(){const n=document.createElement("span");return n.style.display="inline-block",n}updateDOM(){return!1}decorate(){return ce.jsx(he.Suspense,{fallback:null,children:ce.jsx(jT,{question:this.__question,options:this.__options,nodeKey:this.__key})})}};function S1(l,t){return new Gm(l,t)}function E1(l){return l instanceof Gm}const NT="https://platform.twitter.com/widgets.js";function AT(l){const t=l.getAttribute("data-lexical-tweet-id");return t?{node:j1(t)}:null}let C1=!0;function PT({className:l,format:t,loadingComponent:n,nodeKey:e,onError:s,onLoad:r,tweetID:o}){const a=he.useRef(null),c=he.useRef(""),[i,u]=he.useState(!1),f=he.useCallback(async()=>{try{await window.twttr.widgets.createTweet(o,a.current),u(!1),C1=!1,r&&r()}catch(d){s&&s(String(d))}},[s,r,o]);return he.useEffect(()=>{var d;if(o!==c.current){if(u(!0),C1){const p=document.createElement("script");p.src=NT,p.async=!0,(d=document.body)==null||d.appendChild(p),p.onload=f,s&&(p.onerror=s)}else f();c&&(c.current=o)}},[f,s,o]),ce.jsxs(m1,{className:l,format:t,nodeKey:e,children:[i?n:null,ce.jsx("div",{style:{display:"inline-block",width:"550px"},ref:a})]})}class Op extends qm{constructor(n,e,s){super(e,s);Hn(this,"__id");this.__id=n}static getType(){return"tweet"}static clone(n){return new Op(n.__id,n.__format,n.__key)}static importJSON(n){const e=j1(n.id);return e.setFormat(n.format),e}exportJSON(){return{...super.exportJSON(),id:this.getId(),type:"tweet",version:1}}static importDOM(){return{div:n=>n.hasAttribute("data-lexical-tweet-id")?{conversion:AT,priority:2}:null}}exportDOM(){const n=document.createElement("div");n.setAttribute("data-lexical-tweet-id",this.__id);const e=document.createTextNode(this.getTextContent());return n.append(e),{element:n}}getId(){return this.__id}getTextContent(n,e){return`https://x.com/i/web/status/${this.__id}`}decorate(n,e){const s=e.theme.embedBlock||{},r={base:s.base||"",focus:s.focus||""};return ce.jsx(PT,{className:r,format:this.__format,loadingComponent:"Loading...",nodeKey:this.getKey(),tweetID:this.__id})}}function j1(l){return new Op(l)}class bd extends Hs{constructor(n,e,s){console.log("referencedText",e);super(s);Hn(this,"__referencedElementId");Hn(this,"__text");this.__referencedElementId=n,this.__text=e}static getType(){return"reference"}static clone(n){return new bd(n.__referencedElementId,n.__text,n.__key)}createDOM(n){const e=document.createElement("span");e.style.cursor="pointer",e.style.background="#f8f6e2",e.style.fontSize="17px",e.setAttribute("data-node-type","reference"),e.setAttribute("data-ref-id",this.__referencedElementId),e.setAttribute("data-lexical-node-key",this.__key),e.setAttribute("id",this.__referencedElementId),e.setAttribute("data-cross-ref","true"),e.textContent=this.__text,e.addEventListener("click",r=>{r.preventDefault(),r.stopPropagation();const o=e.closest('[class^="editor-autosave-"]');if(!o)return;const a=Array.from(o.classList).find(i=>i.startsWith("editor-autosave-"));if(!a)return;a.replace("editor-autosave-","");const c=o.querySelector(`[data-ref-id="ref-${this.__referencedElementId}"]`);c?(c.scrollIntoView({behavior:"smooth",block:"center"}),c.classList.add("reference-highlight"),setTimeout(()=>{c.classList.remove("reference-highlight")},1e3),setTimeout(()=>{if(c instanceof HTMLInputElement||c instanceof HTMLTextAreaElement)c.focus(),c.setSelectionRange(c.value.length,c.value.length);else if(c.isContentEditable){c.focus();const i=document.createRange(),u=window.getSelection();i.selectNodeContents(c),i.collapse(!1),u==null||u.removeAllRanges(),u==null||u.addRange(i)}else c.setAttribute("tabindex","-1"),c.focus()},500)):console.warn(`Referenced element with data-ref-id="ref-${this.__referencedElementId}" not found.`)});const s=document.querySelector(`[data-ref-id="ref-${this.__referencedElementId}"]`);return s&&new MutationObserver(()=>{const o=s.textContent;document.querySelectorAll(`[data-cross-ref][id="${this.__referencedElementId}"]`).forEach(c=>{c.textContent!==o&&(c.textContent=o||"")})}).observe(s,{childList:!0,characterData:!0,subtree:!0}),e}updateDOM(n,e,s){const r=document.querySelector(`[data-ref-id="ref-${this.__referencedElementId}"]`);if(console.log("first",this.__text,r),r){const o=r.textContent;console.log("newText",o),e.textContent!==this.__text&&(e.textContent=this.__text||"")}return!1}decorate(n,e){return ce.jsx(ce.Fragment,{})}static importJSON(n){return k1(n.id,n.text)}exportJSON(){return{type:"reference",id:this.__referencedElementId,text:this.__text,version:1}}static importDOM(){return{span:n=>n.hasAttribute("data-cross-ref")?{conversion:e=>{const s=e.getAttribute("id")||"",r=e.textContent||"";return{node:new bd(s,r)}},priority:2}:null}}toCodoxNode(){const n=this.exportJSON(),e={type:"text",text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,style:"cursor: pointer; background: #f8f6e2; font-size: 17px;",codox_metadata:{type:n.type,referencedElementId:n.id}};return console.log("[DEMO DEBUG][ReferenceNode][toCodoxNode]:",{convertedNode:e,originalJsonNode:n}),e}static fromCodoxNode(n){return{type:n.codox_metadata.type,version:n.version,text:n.text,id:n.codox_metadata.referencedElementId}}}function k1(l,t){return new bd(l,t)}class Nl extends no{static getType(){return"dividerText"}static clone(t){return new Nl(t.__text,t.__key)}constructor(t="_______________________________",n){super(t,n)}createDOM(t){const n=super.createDOM(t);return n.dataset.divider="true",n.contentEditable="false",n}updateDOM(t,n,e){return n.dataset.divider="true",super.updateDOM(t,n,e)}exportJSON(){return{...super.exportJSON(),type:"dividerText",id:void 0,version:0,detail:0,format:0,mode:"normal",style:"",text:""}}static importJSON(t){return new Nl(t.text)}exportDOM(){const t=document.createElement("span");return t.textContent=this.__text,t.dataset.divider="true",{element:t}}static importDOM(){return{span:t=>t.dataset.divider==="true"||t.textContent==="_______________________________"?{conversion:()=>({node:new Nl}),priority:2}:null}}toCodoxNode(){const t=this.exportJSON(),n={type:"quote",text:"_______________________________",format:t.format,style:`color:${t.color||""};background-color:${t.backgroundColor||""};`,detail:t.detail,version:t.version,codox_metadata:{type:t.type,id:t.id}};return console.log("[DEMO DEBUG][WarningNode][toCodoxNode]: ",{convertedNode:n,originalJsonNode:t}),n}static fromCodoxNode(t){let n="",e="";const s={type:t.codox_metadata.type,text:t.text,format:t.format,mode:t.mode,detail:t.detail,version:t.version,style:"",id:t.codox_metadata.id,color:n,backgroundColor:e};return console.log("[DEMO DEBUG][WarningNode][fromCodoxNode]: ",{codoxNode:t,originalJsonNode:s}),s}}function T1(){return new Nl}function Ym(l){return l instanceof Nl}const O1=fo();function Zm(l){const t={m:1e3,cm:900,d:500,cd:400,c:100,xc:90,l:50,xl:40,x:10,ix:9,v:5,iv:4,i:1};let n="";for(let e in t)for(;l>=t[e];)n+=e,l-=t[e];return n}function N1(){const[l]=xn(),t=(s,r)=>{r(s),Tt(s)&&s.getChildren().forEach(o=>t(o,r))},n=()=>{l.update(()=>{const s=Mn(),r=[];t(s,a=>{Xm(a)&&r.push(a)});let o=!1;for(let a=0;a<r.length;a++)if(r[a].getNumber()!==a+1){o=!0;break}o&&r.forEach((a,c)=>{const i=c+1;a.setNumber(i);const u=a.getContentKey(),f=Rn(u);if(Or(f)){const d=f.getFirstChild();if(Jt(d)){const p=d.getTextContent(),h=p.replace(/^\[[^\]]*\]/,`[${Zm(i)}]`);h!==p&&d.setTextContent(h)}}})})},e=()=>{l.update(()=>{var _;const s=Mn(),r=Ot(),o=MT(0);r&&r.insertNodes([o]);const a=En(),c=ir("[?] ");a.append(c),s.append(a),o.setContentKey(a.getKey());const i=[];t(s,v=>{Xm(v)&&i.push(v)});const f=i.map(v=>v.getContentKey()).map(v=>Rn(v)).filter(v=>v!==null);f==null||f.forEach(v=>{v&&s.append(v)});let d=!1;if(s.getChildren().forEach(v=>{if(Or(v)){const b=v.getFirstChild();if((b&&Ym(b)||b&&Jt(b)&&b.getTextContent().includes("_______________________________"))&&(d=!0,!Ym(b)&&b.getTextContent().includes("_______________________________"))){const E=T1();b.replace(E)}}}),!d&&(f==null?void 0:f.length)>0){const v=En();v.append(T1()),(_=f[0])==null||_.insertBefore(v)}const p=[];if(s.getChildren().forEach(v=>{if(Or(v)){const b=v.getFirstChild();(b&&Ym(b)||b&&Jt(b)&&b.getTextContent().includes("_______________________________"))&&p.push(v)}}),p.length>1)for(let v=1;v<p.length;v++)p[v].remove();const h=[];t(s,v=>{Xm(v)&&h.push(v)}),h.forEach((v,b)=>{const E=b+1;v.setNumber(E);const S=v.getContentKey(),w=Rn(S);if(Or(w)){const y=w.getFirstChild();if(Jt(y)){const x=y.getTextContent(),C=x.replace(/^\[[^\]]*\]/,`[${Zm(E)}]`);C!==x&&y.setTextContent(C)}}});const m=c.getTextContentSize(),g=yc();g.anchor.set(c.getKey(),m,"text"),g.focus.set(c.getKey(),m,"text"),Cr(g),setTimeout(()=>{const v=l.getElementByKey(a.getKey());v&&v.scrollIntoView({behavior:"smooth",block:"end"})},100)})};return he.useEffect(()=>{const s=l.registerCommand(O1,()=>(e(),!0),0);return l.update(()=>{setTimeout(n,100)}),s},[l]),null}class Al extends no{constructor(n,e,s,r){super(s||`[${n}]`,r);Hn(this,"__number");Hn(this,"__contentKey");this.__number=n,this.__contentKey=e}static getType(){return"endnote"}static clone(n){return new Al(n.__number,n.__contentKey,n.__text,n.__key)}static importJSON(n){return new Al(n.number,n.contentKey,n.text,n.key)}exportJSON(){return{...super.exportJSON(),number:this.__number,contentKey:this.__contentKey,type:"endnote",version:1,id:""}}setNumber(n){const e=this.getWritable();e.__number=n,this.setTextContent(`[${Zm(n)}]`)}setContentKey(n){const e=this.getWritable();e.__contentKey=n}getContentKey(){return this.__contentKey}createDOM(n){const e=super.createDOM(n);return e.style.cssText="cursor: pointer; vertical-align: super; font-size: 0.8em;",e.dataset.endnote="true",e}exportDOM(){const n=document.createElement("span");return n.dataset.lexicalEndnote="true",n.textContent=this.__text,{element:n}}static importDOM(){return{span:n=>n.dataset.lexicalEndnote==="true"?{conversion:IT,priority:1}:null}}getNumber(){return this.__number}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}toCodoxNode(){const n=this.exportJSON(),e={type:"quote",text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,codox_metadata:{type:n.type,id:n.id}};return console.log("[DEMO DEBUG][WarningNode][toCodoxNode]: ",{convertedNode:e,originalJsonNode:n}),e}static fromCodoxNode(n){let e="",s="";const r={type:n.codox_metadata.type,text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,style:"",id:n.codox_metadata.id,color:e,backgroundColor:s};return console.log("[DEMO DEBUG][WarningNode][fromCodoxNode]: ",{codoxNode:n,originalJsonNode:r}),r}}function IT(l){var e;const t=(e=l.textContent)==null?void 0:e.match(/\[(\d+)\]/),n=t?parseInt(t[1],10):1;return{node:new Al(n)}}function MT(l,t){return new Al(l,t||"")}function Xm(l){return l instanceof Al}class $o extends no{constructor(n,e,s,r){super(n,r);Hn(this,"__color");Hn(this,"__id");this.__color=e,this.__id=s}static getType(){return"colored"}getId(){return this.__id}static clone(n){return new $o(n.__text,n.__color,n.__id,n.__key)}createDOM(n){const e=super.createDOM(n);return e.style.color=this.__color,e.setAttribute("id",this.__id),e.setAttribute("data-ref-id",`ref-${this.__id}`),e}updateDOM(n,e,s){const r=super.updateDOM(n,e,s);return n.__color!==this.__color&&(e.style.color=this.__color),n.__id!==this.__id&&(e.setAttribute("id",this.__id),e.setAttribute("data-ref-id",`ref-${this.__id}`)),r}exportJSON(){return{...super.exportJSON(),type:"colored",color:this.__color,id:this.__id}}static importJSON(n){return new $o(n.text,n.color,n.id)}toCodoxNode(){const n=this.exportJSON(),e={type:"text",text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,style:`color:${n.color};`,codox_metadata:{type:n.type,id:n.id}};return console.log("[DEMO DEBUG][ColoredNode][toCodoxNode]:",{convertedNode:e,originalJsonNode:n}),e}static fromCodoxNode(n){let e="";n.style.split(";").forEach(r=>{r.startsWith("color:")&&(e=r.split(":")[1])});const s={type:n.codox_metadata.type,text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,style:"",id:n.codox_metadata.id,color:e};return console.log("[DEMO DEBUG][ColoredNode][fromCodoxNode]:",{codoxNode:n,originalJsonNode:s}),s}}const A1=[];class Js extends Br{constructor(n=A1,e){super(e);Hn(this,"__ids");this.__ids=n}static getType(){return"mark"}static clone(n){return new Js(n.__ids,n.__key)}static importDOM(){return{mark:n=>({conversion:e=>{var r;const s=((r=e.getAttribute("data-ids"))==null?void 0:r.split(","))||[];return{node:new Js(s)}},priority:1})}}static importJSON(n){return new Js(n.ids)}exportJSON(){return{...super.exportJSON(),ids:Array.from(this.__ids),type:this.__type}}createDOM(n){const e=document.createElement("mark");return zr(e,n.theme.mark),this.__ids.length>0&&e.setAttribute("data-ids",this.__ids.join(",")),e}updateDOM(n,e,s){const r=n.__ids,o=this.__ids;return r.join(",")!==o.join(",")&&e.setAttribute("data-ids",o.join(",")),!1}exportDOM(){const n=document.createElement("mark");return this.__ids.length>0&&n.setAttribute("data-ids",this.__ids.join(",")),{element:n}}hasID(n){return this.__ids.includes(n)}getIDs(){return Array.from(this.__ids)}setIDs(n){return this.__ids=n,this}addID(n){return this.__ids.includes(n)||(this.__ids=[...this.__ids,n]),this}deleteID(n){const e=this.__ids.indexOf(n);e>-1&&this.__ids.splice(e,1)}insertNewAfter(n,e=!0){const s=Qm(this.__ids);return this.insertAfter(s,e),s}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}}function Qm(l=A1){return Pr(new Js(l))}function Pl(l){return l instanceof Js}function P1(l){const t=l.getChildren();let n=null;for(let e=0;e<t.length;e++){const s=t[e];n===null?l.insertBefore(s):n.insertAfter(s),n=s}l.remove()}function DT(l,t,n,e){const s=yc(),[r,o]=l.isBackward()?[l.focus,l.anchor]:[l.anchor,l.focus];s.anchor.set(r.key,r.offset,r.type),s.focus.set(o.key,o.offset,o.type);let a,c;const i=s.extract();for(const u of i){if(Tt(c)&&c.isParentOf(u))continue;let f=null;if(Jt(u))f=u;else{if(Pl(u))continue;(Tt(u)||hr(u))&&u.isInline()&&(f=u)}if(f!==null){if(f&&f.is(a))continue;const d=f.getParent();(d==null||!d.is(a))&&(c=void 0),a=d,c===void 0&&(c=(e||Qm)([n]),f.insertBefore(c)),c.append(f)}else a=void 0,c=void 0}Tt(c)&&(t?c.selectStart():c.selectEnd())}function RT(l,t){let n=l;for(;n!==null;){if(Pl(n))return n.getIDs();if(Jt(n)&&t===n.getTextContentSize()){const e=n.getNextSibling();if(Pl(e))return e.getIDs()}n=n.getParent()}return null}const I1=[Js,vp,fd,dd,yp,Em,xs,is,Cl,gp,km,ud,xc,Wb,Gm,jp,Jm,_d,vd,Tc,Dm,Op,Cp,md,yd,Ep,Ol,kp,Tp,bd,Al,$o,Aa,Nl],mR="";function ey(...l){return l.filter(Boolean).join(" ")}function Fi({"data-test-id":l,children:t,className:n,onClick:e,disabled:s,small:r,title:o}){return ce.jsx("button",{disabled:s,className:ey("Button__root",s&&"Button__disabled",r&&"Button__small",n),onClick:e,title:o,"aria-label":o,...l&&{"data-test-id":l},children:t})}const yR="";function Np({"data-test-id":l,children:t}){return ce.jsx("div",{className:"DialogActions","data-test-id":l,children:t})}const vR="";function Oc({label:l,value:t,onChange:n,placeholder:e="","data-test-id":s,type:r="text"}){return ce.jsxs("div",{className:"Input__wrapper",children:[ce.jsx("label",{className:"Input__label",children:l}),ce.jsx("input",{type:r,className:"Input__input",placeholder:e,value:t,onChange:o=>{n(o.target.value)},"data-test-id":s})]})}const LT=he.createContext({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function M1({children:l}){const[t,n]=he.useState({cellEditorConfig:null,cellEditorPlugins:null});return ce.jsx(LT.Provider,{value:he.useMemo(()=>({cellEditorConfig:t.cellEditorConfig,cellEditorPlugins:t.cellEditorPlugins,set:(e,s)=>{n({cellEditorConfig:e,cellEditorPlugins:s})}}),[t.cellEditorConfig,t.cellEditorPlugins]),children:l})}const Ap=(l,t)=>{let n=5381;const e=String(t);for(let s=0;s<e.length;s++)n=(n<<5)+n+e.charCodeAt(s);return`table-${t}-${Math.abs(n%1e6)}`};function FT({activeEditor:l,onClose:t,enableCaptions:n=!0}){const[e,s]=he.useState("5"),[r,o]=he.useState("5"),[a,c]=he.useState(""),[i,u]=he.useState(!0);he.useState(!0);let f=Number(localStorage.getItem("tableCount"))||1;he.useEffect(()=>{const h=Number(e),m=Number(r);h&&h>0&&h<=500&&m&&m>0&&m<=50?u(!1):u(!0)},[e,r]);const d=()=>{l.update(()=>{const m=Mn().getChildren().filter(dr);if(m.length===0){console.warn("No tables found in the document!");return}const g=m.map(_=>{let v=a;const b=_.getPreviousSibling();if(b&&Or(b)){const E=b.getChildren().filter(S=>S.getType()==="text");E.length>1&&(v=E[1].getTextContent())}return{caption:v,content:_.getChildren().map(E=>E.getChildren().map(S=>S.getTextContent()))}});localStorage.setItem("savedTableData",JSON.stringify(g))})},p=()=>{if(!e||!r)return;const h=f;l.update(()=>{if(n){const m=En();m.setFormat("left");const v=Mn().getChildren().filter(dr).length,b=Ap(a||`Table ${h}`,v),E=new $o(`Table ${h}:`,"black",b);E.setStyle("font-weight: bold; margin-right: 8px;");const S=a.trim()===""?".":a,w=ir(S);w.setStyle(a?"color: black; font-style: italic; font-weight: bold;":"color: gray; font-style: italic; font-weight: normal;"),m.getChildren().forEach(T=>T.remove());const y=rs();m.append(E),m.append(w),m.append(y),si([m]);const x={rows:!0,columns:!1},C=Rm(Number(e),Number(r),x);if(!C){console.error("Failed to create TableNode");return}C.__captionId=b,si([C])}else{const m={rows:!0,columns:!1},g=Rm(Number(e),Number(r),m);if(!g){console.error("Failed to create TableNode");return}si([g,rs()])}}),l.update(()=>{if(n){const g=Mn().getChildren().filter(dr);let _=1;g.forEach(v=>{var C;const b=v.getPreviousSibling(),w=Mn().getChildren().filter(dr).length,y=v.__captionId||Ap(`Table ${_}`,w),x=v.getNextSibling();if(x&&Or(x)&&x.getChildren().forEach(T=>{T.getTextContent().startsWith("Table")&&T.remove()}),b&&Or(b)){let T=null;if(b.getChildren().forEach(F=>{F.getTextContent().startsWith("Table")&&(T=F)}),T){const F=((C=T.getId)==null?void 0:C.call(T))||y;T.remove();const B=new $o(`Table ${_}:`,"black",F),D=b.getFirstChild();D!==null?D.insertBefore(B):b.append(B)}else if(n){const F=new $o(`Table ${_}:`,"black",y),B=b.getFirstChild();B!==null?B.insertBefore(F):b.append(F)}}else{const T=`Table ${_}:`,F=En();F.setFormat("left");const B=new $o(T,"black",y);B.setStyle("font-weight: bold; margin-right: 5px;");const D=a.trim()===""?"Caption text here":a,L=ir(D);L.setStyle("color: black; font-style: italic; font-weight: normal;"),F.append(B),F.append(ir(" ")),F.append(L),v.insertBefore(F)}_++})}}),f++,localStorage.setItem("tableCount",f.toString()),setTimeout(()=>{d()},50),t==null||t()};return ce.jsxs(ce.Fragment,{children:[ce.jsx(Oc,{placeholder:"# of rows (1-500)",label:"Rows",onChange:s,value:e,type:"number"}),ce.jsx(Oc,{placeholder:"# of columns (1-50)",label:"Columns",onChange:o,value:r,type:"number"}),n&&ce.jsx(Oc,{placeholder:"Enter table caption",label:"Caption",value:a,onChange:c}),ce.jsx(Np,{children:ce.jsx(Fi,{disabled:i,onClick:p,children:"Confirm"})})]})}const _R="",ty={blockCursor:"PlaygroundEditorTheme__blockCursor",characterLimit:"PlaygroundEditorTheme__characterLimit",code:"PlaygroundEditorTheme__code",codeHighlight:{atrule:"PlaygroundEditorTheme__tokenAttr",attr:"PlaygroundEditorTheme__tokenAttr",boolean:"PlaygroundEditorTheme__tokenProperty",builtin:"PlaygroundEditorTheme__tokenSelector",cdata:"PlaygroundEditorTheme__tokenComment",char:"PlaygroundEditorTheme__tokenSelector",class:"PlaygroundEditorTheme__tokenFunction","class-name":"PlaygroundEditorTheme__tokenFunction",comment:"PlaygroundEditorTheme__tokenComment",constant:"PlaygroundEditorTheme__tokenProperty",deleted:"PlaygroundEditorTheme__tokenProperty",doctype:"PlaygroundEditorTheme__tokenComment",entity:"PlaygroundEditorTheme__tokenOperator",function:"PlaygroundEditorTheme__tokenFunction",important:"PlaygroundEditorTheme__tokenVariable",inserted:"PlaygroundEditorTheme__tokenSelector",keyword:"PlaygroundEditorTheme__tokenAttr",namespace:"PlaygroundEditorTheme__tokenVariable",number:"PlaygroundEditorTheme__tokenProperty",operator:"PlaygroundEditorTheme__tokenOperator",prolog:"PlaygroundEditorTheme__tokenComment",property:"PlaygroundEditorTheme__tokenProperty",punctuation:"PlaygroundEditorTheme__tokenPunctuation",regex:"PlaygroundEditorTheme__tokenVariable",selector:"PlaygroundEditorTheme__tokenSelector",string:"PlaygroundEditorTheme__tokenSelector",symbol:"PlaygroundEditorTheme__tokenProperty",tag:"PlaygroundEditorTheme__tokenProperty",url:"PlaygroundEditorTheme__tokenOperator",variable:"PlaygroundEditorTheme__tokenVariable"},embedBlock:{base:"PlaygroundEditorTheme__embedBlock",focus:"PlaygroundEditorTheme__embedBlockFocus"},hashtag:"PlaygroundEditorTheme__hashtag",heading:{h1:"PlaygroundEditorTheme__h1",h2:"PlaygroundEditorTheme__h2",h3:"PlaygroundEditorTheme__h3",h4:"PlaygroundEditorTheme__h4",h5:"PlaygroundEditorTheme__h5",h6:"PlaygroundEditorTheme__h6"},image:"editor-image",indent:"PlaygroundEditorTheme__indent",inlineImage:"inline-editor-image",layoutContainer:"PlaygroundEditorTheme__layoutContainer",layoutItem:"PlaygroundEditorTheme__layoutItem",link:"PlaygroundEditorTheme__link",list:{checklist:"PlaygroundEditorTheme__checklist",listitem:"PlaygroundEditorTheme__listItem",listitemChecked:"PlaygroundEditorTheme__listItemChecked",listitemUnchecked:"PlaygroundEditorTheme__listItemUnchecked",nested:{listitem:"PlaygroundEditorTheme__nestedListItem"},olDepth:["PlaygroundEditorTheme__ol1","PlaygroundEditorTheme__ol2","PlaygroundEditorTheme__ol3","PlaygroundEditorTheme__ol4","PlaygroundEditorTheme__ol5"],ul:"PlaygroundEditorTheme__ul"},ltr:"PlaygroundEditorTheme__ltr",mark:"PlaygroundEditorTheme__mark",markOverlap:"PlaygroundEditorTheme__markOverlap",paragraph:"PlaygroundEditorTheme__paragraph",quote:"PlaygroundEditorTheme__quote",rtl:"PlaygroundEditorTheme__rtl",table:"PlaygroundEditorTheme__table",tableAddColumns:"PlaygroundEditorTheme__tableAddColumns",tableAddRows:"PlaygroundEditorTheme__tableAddRows",tableCell:"PlaygroundEditorTheme__tableCell",tableCellActionButton:"PlaygroundEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"PlaygroundEditorTheme__tableCellActionButtonContainer",tableCellEditing:"PlaygroundEditorTheme__tableCellEditing",tableCellHeader:"PlaygroundEditorTheme__tableCellHeader",tableCellPrimarySelected:"PlaygroundEditorTheme__tableCellPrimarySelected",tableCellResizer:"PlaygroundEditorTheme__tableCellResizer",tableCellSelected:"PlaygroundEditorTheme__tableCellSelected",tableCellSortedIndicator:"PlaygroundEditorTheme__tableCellSortedIndicator",tableResizeRuler:"PlaygroundEditorTheme__tableCellResizeRuler",tableSelected:"PlaygroundEditorTheme__tableSelected",tableSelection:"PlaygroundEditorTheme__tableSelection",text:{bold:"PlaygroundEditorTheme__textBold",code:"PlaygroundEditorTheme__textCode",italic:"PlaygroundEditorTheme__textItalic",strikethrough:"PlaygroundEditorTheme__textStrikethrough",subscript:"PlaygroundEditorTheme__textSubscript",superscript:"PlaygroundEditorTheme__textSuperscript",underline:"PlaygroundEditorTheme__textUnderline",underlineStrikethrough:"PlaygroundEditorTheme__textUnderlineStrikethrough"}};function Pp({defaultSelection:l}){const[t]=xn();return he.useEffect(()=>{t.focus(()=>{const n=document.activeElement,e=t.getRootElement();e===null||n!==null&&e.contains(n)||e.focus({preventScroll:!0})},{defaultSelection:l})},[l,t]),null}function ny(){return Mn().getTextContent()}function ry(l,t=!0){if(l)return!1;let n=ny();return t&&(n=n.trim()),n===""}function BT(l){if(!ry(l,!1))return!1;const t=Mn().getChildren(),n=t.length;if(n>1)return!1;for(let e=0;e<n;e++){const s=t[e];if(hr(s))return!1;if(Tt(s)){if(!Or(s)||s.__indent!==0)return!1;const r=s.getChildren(),o=r.length;for(let a=0;a<o;a++){const c=r[e];if(!Jt(c))return!1}}}return!0}function D1(l){return()=>BT(l)}function zT(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var UT=zT(function(l){const t=new URLSearchParams;t.append("code",l);for(let n=1;n<arguments.length;n++)t.append("v",arguments[n]);throw Error(`Minified Lexical error #${l}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function HT(l,t,n,e){const s=o=>o instanceof n,r=o=>{const a=ir(o.getTextContent());a.setFormat(o.getFormat()),o.replace(a)};return[l.registerNodeTransform(no,o=>{if(!o.isSimpleText())return;let a,c=o.getPreviousSibling(),i=o.getTextContent(),u=o;if(Jt(c)){const d=c.getTextContent(),p=t(d+i);if(s(c)){if(p===null||(h=>h.getLatest().__mode)(c)!==0)return void r(c);{const h=p.end-d.length;if(h>0){const m=d+i.slice(0,h);if(c.select(),c.setTextContent(m),h===i.length)o.remove();else{const g=i.slice(h);o.setTextContent(g)}return}}}else if(p===null||p.start<d.length)return}let f=0;for(;;){a=t(i);let d,p=a===null?"":i.slice(a.end);if(i=p,p===""){const m=u.getNextSibling();if(Jt(m)){p=u.getTextContent()+m.getTextContent();const g=t(p);if(g===null)return void(s(m)?r(m):m.markDirty());if(g.start!==0)return}}if(a===null)return;if(a.start===0&&Jt(c)&&c.isTextEntity()){f+=a.end;continue}a.start===0?[d,u]=u.splitText(a.end):[,d,u]=u.splitText(a.start+f,a.end+f),d===void 0&&UT(165,"nodeToReplace");const h=e(d);if(h.setFormat(d.getFormat()),d.replace(h),u==null)return;f=0,c=h}}),l.registerNodeTransform(n,o=>{const a=o.getTextContent(),c=t(a);if(c===null||c.start!==0)return void r(o);if(a.length>c.end)return void o.splitText(c.end);const i=o.getPreviousSibling();Jt(i)&&i.isTextEntity()&&(r(i),r(o));const u=o.getNextSibling();Jt(u)&&u.isTextEntity()&&(r(u),s(o)&&r(o))})]}function R1(l,t,n){const[e]=xn();he.useEffect(()=>br(...HT(e,l,t,n)),[n,e,l,t])}const $T=new RegExp(function(){const{alpha:l,alphanumeric:t,hashChars:n}=function(){const s=String.fromCharCode,r="A-Za-zªµºÀ-ÖØ-öø-Ɂɐ-ˁˆ-ˑˠ-ˤˮͺΆΈ-ΊΌΎ-ΡΣ-ώϐ-ϵϷ-ҁҊ-ӎӐ-ӹԀ-ԏԱ-Ֆՙա-ևא-תװ-ײء-غـ-يٮ-ٯٱ-ۓەۥ-ۦۮ-ۯۺ-ۼۿܐܒ-ܯݍ-ݭހ-ޥޱऄ-हऽॐक़-ॡॽঅ-ঌএ-ঐও-নপ-রলশ-হঽৎড়-ঢ়য়-ৡৰ-ৱਅ-ਊਏ-ਐਓ-ਨਪ-ਰਲ-ਲ਼ਵ-ਸ਼ਸ-ਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલ-ળવ-હઽૐૠ-ૡଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହଽଡ଼-ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கங-சஜஞ-டண-தந-பம-ஹఅ-ఌఎ-ఐఒ-నప-ళవ-హౠ-ౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠ-ೡഅ-ഌഎ-ഐഒ-നപ-ഹൠ-ൡඅ-ඖක-නඳ-රලව-ෆก-ะา-ำเ-ๆກ-ຂຄງ-ຈຊຍດ-ທນ-ຟມ-ຣລວສ-ຫອ-ະາ-ຳຽເ-ໄໆໜ-ໝༀཀ-ཇཉ-ཪྈ-ྋက-အဣ-ဧဩ-ဪၐ-ၕႠ-Ⴥა-ჺჼᄀ-ᅙᅟ-ᆢᆨ-ᇹሀ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙶᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦩᧁ-ᧇᨀ-ᨖᴀ-ᶿḀ-ẛẠ-ỹἀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₔℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℱℳ-ℹℼ-ℿⅅ-ⅉⰀ-Ⱞⰰ-ⱞⲀ-ⳤⴀ-ⴥⴰ-ⵥⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〆〱-〵〻-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄬㄱ-ㆎㆠ-ㆷㇰ-ㇿ㐀-䶵一-龻ꀀ-ꒌꠀ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢ가-힣豈-鶴侮-頻並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ̀-ͯ҃-֑҆-ֹֻ-ֽֿׁ-ׂׄ-ׇׅؐ-ًؕ-ٰٞۖ-ۜ۟-ۤۧ-۪ۨ-ܑۭܰ-݊ަ-ްँ-ः़ा-्॑-॔ॢ-ॣঁ-ঃ়া-ৄে-ৈো-্ৗৢ-ৣਁ-ਃ਼ਾ-ੂੇ-ੈੋ-੍ੰ-ੱઁ-ઃ઼ા-ૅે-ૉો-્ૢ-ૣଁ-ଃ଼ା-ୃେ-ୈୋ-୍ୖ-ୗஂா-ூெ-ைொ-்ௗఁ-ఃా-ౄె-ైొ-్ౕ-ౖಂ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕ-ೖം-ഃാ-ൃെ-ൈൊ-്ൗං-ඃ්ා-ුූෘ-ෟෲ-ෳัิ-ฺ็-๎ັິ-ູົ-ຼ່-ໍ༘-༹༙༵༷༾-༿ཱ-྄྆-྇ྐ-ྗྙ-ྼ࿆ာ-ဲံ-္ၖ-ၙ፟ᜒ-᜔ᜲ-᜴ᝒ-ᝓᝲ-ᝳា-៓៝᠋-᠍ᢩᤠ-ᤫᤰ-᤻ᦰ-ᧀᧈ-ᧉᨗ-ᨛ᷀-᷃⃐-⃥⃜⃡-⃫〪-゙〯-゚ꠂ꠆ꠋꠣ-ꠧﬞ︀-️︠-︣À-ÖØ-öø-ÿĀ-ɏɓ-ɔɖ-ɗəɛɣɨɯɲʉʋʻ̀-ͯḀ-ỿЀ-ӿԀ-ԧⷠ-ⷿꙀ-֑ꚟ-ֿׁ-ׂׄ-ׇׅא-תװ-״﬒-ﬨשׁ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﭏؐ-ؚؠ-ٟٮ-ۓە-ۜ۞-۪ۨ-ۯۺ-ۼۿݐ-ݿࢠࢢ-ࢬࣤ-ࣾﭐ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼ‌-‌ก-ฺเ-๎ᄀ-ᇿ㄰-ㆅꥠ-꥿가-힯ힰ-퟿ᄀ-ᅵァ-ヺー-ヾヲ-゚0-9A-Za-zぁ-ゖ゙-ゞ㐀-䶿一-鿿"+s(173824)+"-"+s(177983)+s(177984)+"-"+s(178207)+s(194560)+"-"+s(195103)+"〃々〻";return{alpha:r,alphanumeric:r+"0-9٠-٩۰-۹०-९০-৯੦-੯૦-૯୦-୯௦-௯౦-౯೦-೯൦-൯๐-๙໐-໙༠-༩၀-၉០-៩᠐-᠙᥆-᥏᧐-᧙0-9_",hashChars:"#\\uFF03"}}(),e="["+t+"]";return"("+("^|$|[^&/"+t+"]")+")("+("["+n+"]")+")("+e+"*"+("["+l+"]")+e+"*)"}(),"i");function L1(){const[l]=xn();he.useEffect(()=>{if(!l.hasNodes([gp]))throw new Error("HashtagPlugin: HashtagNode not registered on editor")},[l]);const t=he.useCallback(e=>Ab(e.getTextContent()),[]),n=he.useCallback(e=>{const s=$T.exec(e);if(s===null)return null;const r=s[3].length+1,o=s.index+s[1].length;return{end:o+r,start:o}},[]);return R1(n,gp,t),null}function F1(){const[l]=xn();return he.useEffect(()=>{if(!l.hasNodes([fd,dd]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[l]),function(t){he.useEffect(()=>br(t.registerCommand($b,()=>(Db(t,"number"),!0),Gn),t.registerCommand(Hb,()=>(Db(t,"bullet"),!0),Gn),t.registerCommand(qb,()=>(I2(t),!0),Gn),t.registerCommand(hl,()=>!!R2(),Gn)),[t])}(l),null}const qT=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?he.useLayoutEffect:he.useEffect;function WT(l){return{initialValueFn:()=>l.isEditable(),subscribe:t=>l.registerEditableListener(t)}}function oy(){return function(l){const[t]=xn(),n=he.useMemo(()=>l(t),[t,l]),e=he.useRef(n.initialValueFn()),[s,r]=he.useState(e.current);return qT(()=>{const{initialValueFn:o,subscribe:a}=n,c=o();return e.current!==c&&(e.current=c,r(c)),a(i=>{e.current=i,r(i)})},[n,l]),s}(WT)}function B1(l){const t=window.location.origin,n=e=>{if(e.origin!==t)return;const s=l.getRootElement();if(document.activeElement!==s)return;const r=e.data;if(typeof r=="string"){let o;try{o=JSON.parse(r)}catch{return}if(o&&o.protocol==="nuanria_messaging"&&o.type==="request"){const a=o.payload;if(a&&a.functionId==="makeChanges"){const c=a.args;if(c){const[i,u,f,d,p,h]=c;l.update(()=>{const m=Ot();if(Ct(m)){const g=m.anchor;let _=g.getNode(),v=0,b=0;if(Jt(_)&&i>=0&&u>=0&&(v=i,b=i+u,m.setTextNodeRange(_,v,_,b)),v===b&&f===""||(m.insertRawText(f),_=g.getNode()),Jt(_)){v=d,b=d+p;const E=_.getTextContentSize();v=v>E?E:v,b=b>E?E:b,m.setTextNodeRange(_,v,_,b)}e.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}}function Ip(l,t){const n=t.body?t.body.childNodes:[];let e=[];const s=[];for(let r=0;r<n.length;r++){const o=n[r];if(!H1.has(o.nodeName)){const a=$1(o,l,s,!1);a!==null&&(e=e.concat(a))}}return function(r){for(const o of r)o.getNextSibling()instanceof mm&&o.insertAfter(rs());for(const o of r){const a=o.getChildren();for(const c of a)o.insertBefore(c);o.remove()}}(s),e}function z1(l,t){if(typeof document>"u"||typeof window>"u"&&global.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const n=document.createElement("div"),e=Mn().getChildren();for(let s=0;s<e.length;s++)U1(l,e[s],n,t);return n.innerHTML}function U1(l,t,n,e=null){let s=e===null||t.isSelected(e);const r=Tt(t)&&t.excludeFromCopy("html");let o=t;if(e!==null){let p=sb(t);p=Jt(p)&&e!==null?ab(e,p):p,o=p}const a=Tt(o)?o.getChildren():[],c=l._nodes.get(o.getType());let i;i=c&&c.exportDOM!==void 0?c.exportDOM(l,o):o.exportDOM(l);const{element:u,after:f}=i;if(!u)return!1;const d=document.createDocumentFragment();for(let p=0;p<a.length;p++){const h=a[p],m=U1(l,h,d,e);!s&&Tt(t)&&m&&t.extractWithChild(h,e,"html")&&(s=!0)}if(s&&!r){if(Ri(u)&&u.append(d),n.append(u),f){const p=f.call(o,u);p&&u.replaceWith(p)}}else n.append(d);return s}const H1=new Set(["STYLE","SCRIPT"]);function $1(l,t,n,e,s=new Map,r){let o=[];if(H1.has(l.nodeName))return o;let a=null;const c=function(h,m){const{nodeName:g}=h,_=m._htmlConversions.get(g.toLowerCase());let v=null;if(_!==void 0)for(const b of _){const E=b(h);E!==null&&(v===null||(v.priority||0)<(E.priority||0))&&(v=E)}return v!==null?v.conversion:null}(l,t),i=c?c(l):null;let u=null;if(i!==null){u=i.after;const h=i.node;if(a=Array.isArray(h)?h[h.length-1]:h,a!==null){for(const[,m]of s)if(a=m(a,r),!a)break;a&&o.push(...Array.isArray(h)?h:[a])}i.forChild!=null&&s.set(l.nodeName,i.forChild)}const f=l.childNodes;let d=[];const p=(a==null||!to(a))&&(a!=null&&dm(a)||e);for(let h=0;h<f.length;h++)d.push(...$1(f[h],t,n,p,new Map(s),a));return u!=null&&(d=u(d)),Bk(l)&&(d=JT(l,d,p?()=>{const h=new mm;return n.push(h),h}:En)),a==null?o=o.concat(d):Tt(a)&&a.append(...d),o}function JT(l,t,n){const e=l.style.textAlign,s=[];let r=[];for(let o=0;o<t.length;o++){const a=t[o];if(dm(a))e&&!a.getFormat()&&a.setFormat(e),s.push(a);else if(r.push(a),o===t.length-1||o<t.length-1&&dm(t[o+1])){const c=n();c.setFormat(e),c.append(...r),s.push(c),r=[]}}return s}function VT(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var Mp=VT(function(l){const t=new URLSearchParams;t.append("code",l);for(let n=1;n<arguments.length;n++)t.append("v",arguments[n]);throw Error(`Minified Lexical error #${l}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const KT=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,q1=l=>KT?(l||window).getSelection():null;function W1(l){const t=Ot();return t==null&&Mp(166),Ct(t)&&t.isCollapsed()||t.getNodes().length===0?"":z1(l,t)}function GT(l){const t=Ot();return t==null&&Mp(166),Ct(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(YT(l,t))}function J1(l,t){const n=l.getData("text/plain")||l.getData("text/uri-list");n!=null&&t.insertRawText(n)}function V1(l,t,n){const e=l.getData("application/x-lexical-editor");if(e)try{const o=JSON.parse(e);if(o.namespace===n._config.namespace&&Array.isArray(o.nodes))return K1(n,ZT(o.nodes),t)}catch{}const s=l.getData("text/html");if(s)try{const o=new DOMParser().parseFromString(s,"text/html");return K1(n,Ip(n,o),t)}catch{}const r=l.getData("text/plain")||l.getData("text/uri-list");if(r!=null)if(Ct(t)){const o=r.split(/(\r?\n|\t)/);o[o.length-1]===""&&o.pop();for(let a=0;a<o.length;a++){const c=Ot();if(Ct(c)){const i=o[a];i===`
64
+ `}isInline(){return!1}updateDOM(){return!1}decorate(){return ce.jsx(ET,{nodeKey:this.__key})}static fromCodoxNode(n){const e=n.pageNumber,s={type:n.codox_metadata.type,text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,pageNumber:e,style:"",id:n.codox_metadata.id};return console.log("[DEMO DEBUG][PageBreakNode][fromCodoxNode]: ",{codoxNode:n,originalJsonNode:s}),new Ol(s.pageNumber)}toCodoxNode(){const n=this.exportJSON(),e={type:"page-break",text:"",pageNumber:n.pageNumber,style:"",version:n.version,codox_metadata:{type:n.type,id:n.pageNumber}};return console.log("[DEMO DEBUG][PageBreakNode][toCodoxNode]: ",{convertedNode:e,originalJsonNode:n}),e}}function CT(l){const t=l.getAttribute("data-page-number"),n=t?parseInt(t,10):1;return{node:w1(n)}}function w1(l){if(l===void 0){const t=Tl("p").length-1;l=Math.ceil(t/20)||1}return new Ol(l)}function Km(l){return l instanceof Ol}const jT=or.lazy(()=>Promise.resolve().then(()=>WD));function kT(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function TT(l=""){return{text:l,uid:kT(),votes:[]}}function x1(l,t,n){return{text:t,uid:l.uid,votes:n||Array.from(l.votes)}}function OT(l){const t=l.getAttribute("data-lexical-poll-question"),n=l.getAttribute("data-lexical-poll-options");return t!==null&&n!==null?{node:S1(t,JSON.parse(n))}:null}let Gm=class Yj extends Hs{constructor(n,e,s){super(s);Hn(this,"__question");Hn(this,"__options");this.__question=n,this.__options=e}static getType(){return"poll"}static clone(n){return new Yj(n.__question,n.__options,n.__key)}static importJSON(n){const e=S1(n.question,n.options);return n.options.forEach(e.addOption),e}exportJSON(){return{options:this.__options,question:this.__question,type:"poll",version:1}}addOption(n){const e=this.getWritable(),s=Array.from(e.__options);s.push(n),e.__options=s}deleteOption(n){const e=this.getWritable(),s=Array.from(e.__options),r=s.indexOf(n);s.splice(r,1),e.__options=s}setOptionText(n,e){const s=this.getWritable(),r=x1(n,e),o=Array.from(s.__options),a=o.indexOf(n);o[a]=r,s.__options=o}toggleVote(n,e){const s=this.getWritable(),r=n.votes,o=Array.from(r),a=r.indexOf(e);a===-1?o.push(e):o.splice(a,1);const c=x1(n,n.text,o),i=Array.from(s.__options),u=i.indexOf(n);i[u]=c,s.__options=i}static importDOM(){return{span:n=>n.hasAttribute("data-lexical-poll-question")?{conversion:OT,priority:2}:null}}exportDOM(){const n=document.createElement("span");return n.setAttribute("data-lexical-poll-question",this.__question),n.setAttribute("data-lexical-poll-options",JSON.stringify(this.__options)),{element:n}}createDOM(){const n=document.createElement("span");return n.style.display="inline-block",n}updateDOM(){return!1}decorate(){return ce.jsx(he.Suspense,{fallback:null,children:ce.jsx(jT,{question:this.__question,options:this.__options,nodeKey:this.__key})})}};function S1(l,t){return new Gm(l,t)}function E1(l){return l instanceof Gm}const NT="https://platform.twitter.com/widgets.js";function AT(l){const t=l.getAttribute("data-lexical-tweet-id");return t?{node:j1(t)}:null}let C1=!0;function PT({className:l,format:t,loadingComponent:n,nodeKey:e,onError:s,onLoad:r,tweetID:o}){const a=he.useRef(null),c=he.useRef(""),[i,u]=he.useState(!1),f=he.useCallback(async()=>{try{await window.twttr.widgets.createTweet(o,a.current),u(!1),C1=!1,r&&r()}catch(d){s&&s(String(d))}},[s,r,o]);return he.useEffect(()=>{var d;if(o!==c.current){if(u(!0),C1){const p=document.createElement("script");p.src=NT,p.async=!0,(d=document.body)==null||d.appendChild(p),p.onload=f,s&&(p.onerror=s)}else f();c&&(c.current=o)}},[f,s,o]),ce.jsxs(m1,{className:l,format:t,nodeKey:e,children:[i?n:null,ce.jsx("div",{style:{display:"inline-block",width:"550px"},ref:a})]})}class Op extends qm{constructor(n,e,s){super(e,s);Hn(this,"__id");this.__id=n}static getType(){return"tweet"}static clone(n){return new Op(n.__id,n.__format,n.__key)}static importJSON(n){const e=j1(n.id);return e.setFormat(n.format),e}exportJSON(){return{...super.exportJSON(),id:this.getId(),type:"tweet",version:1}}static importDOM(){return{div:n=>n.hasAttribute("data-lexical-tweet-id")?{conversion:AT,priority:2}:null}}exportDOM(){const n=document.createElement("div");n.setAttribute("data-lexical-tweet-id",this.__id);const e=document.createTextNode(this.getTextContent());return n.append(e),{element:n}}getId(){return this.__id}getTextContent(n,e){return`https://x.com/i/web/status/${this.__id}`}decorate(n,e){const s=e.theme.embedBlock||{},r={base:s.base||"",focus:s.focus||""};return ce.jsx(PT,{className:r,format:this.__format,loadingComponent:"Loading...",nodeKey:this.getKey(),tweetID:this.__id})}}function j1(l){return new Op(l)}class bd extends Hs{constructor(n,e,s){console.log("referencedText",e);super(s);Hn(this,"__referencedElementId");Hn(this,"__text");this.__referencedElementId=n,this.__text=e}static getType(){return"reference"}static clone(n){return new bd(n.__referencedElementId,n.__text,n.__key)}createDOM(n){const e=document.createElement("span");e.style.cursor="pointer",e.style.background="#f8f6e2",e.style.fontSize="17px",e.setAttribute("data-node-type","reference"),e.setAttribute("data-ref-id",this.__referencedElementId),e.setAttribute("data-lexical-node-key",this.__key),e.setAttribute("id",this.__referencedElementId),e.setAttribute("data-cross-ref","true"),e.textContent=this.__text,e.addEventListener("click",r=>{r.preventDefault(),r.stopPropagation();const o=e.closest('[class^="editor-autosave-"]');if(!o)return;const a=Array.from(o.classList).find(i=>i.startsWith("editor-autosave-"));if(!a)return;a.replace("editor-autosave-","");const c=o.querySelector(`[data-ref-id="ref-${this.__referencedElementId}"]`);c?(c.scrollIntoView({behavior:"smooth",block:"center"}),c.classList.add("reference-highlight"),setTimeout(()=>{c.classList.remove("reference-highlight")},1e3),setTimeout(()=>{if(c instanceof HTMLInputElement||c instanceof HTMLTextAreaElement)c.focus(),c.setSelectionRange(c.value.length,c.value.length);else if(c.isContentEditable){c.focus();const i=document.createRange(),u=window.getSelection();i.selectNodeContents(c),i.collapse(!1),u==null||u.removeAllRanges(),u==null||u.addRange(i)}else c.setAttribute("tabindex","-1"),c.focus()},500)):console.warn(`Referenced element with data-ref-id="ref-${this.__referencedElementId}" not found.`)});const s=document.querySelector(`[data-ref-id="ref-${this.__referencedElementId}"]`);return s&&new MutationObserver(()=>{const o=s.textContent;document.querySelectorAll(`[data-cross-ref][id="${this.__referencedElementId}"]`).forEach(c=>{c.textContent!==o&&(c.textContent=o||"")})}).observe(s,{childList:!0,characterData:!0,subtree:!0}),e}updateDOM(n,e,s){const r=document.querySelector(`[data-ref-id="ref-${this.__referencedElementId}"]`);if(console.log("first",this.__text,r),r){const o=r.textContent;console.log("newText",o),e.textContent!==this.__text&&(e.textContent=this.__text||"")}return!1}decorate(n,e){return ce.jsx(ce.Fragment,{})}static importJSON(n){return k1(n.id,n.text)}exportJSON(){return{type:"reference",id:this.__referencedElementId,text:this.__text,version:1}}static importDOM(){return{span:n=>n.hasAttribute("data-cross-ref")?{conversion:e=>{const s=e.getAttribute("id")||"",r=e.textContent||"";return{node:new bd(s,r)}},priority:2}:null}}toCodoxNode(){const n=this.exportJSON(),e={type:"text",text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,style:"cursor: pointer; background: #f8f6e2; font-size: 17px;",codox_metadata:{type:n.type,referencedElementId:n.id}};return console.log("[DEMO DEBUG][ReferenceNode][toCodoxNode]:",{convertedNode:e,originalJsonNode:n}),e}static fromCodoxNode(n){return{type:n.codox_metadata.type,version:n.version,text:n.text,id:n.codox_metadata.referencedElementId}}}function k1(l,t){return new bd(l,t)}class Nl extends no{static getType(){return"dividerText"}static clone(t){return new Nl(t.__text,t.__key)}constructor(t="_______________________________",n){super(t,n)}createDOM(t){const n=super.createDOM(t);return n.dataset.divider="true",n.contentEditable="false",n}updateDOM(t,n,e){return n.dataset.divider="true",super.updateDOM(t,n,e)}exportJSON(){return{...super.exportJSON(),type:"dividerText",id:void 0,version:0,detail:0,format:0,mode:"normal",style:"",text:""}}static importJSON(t){return new Nl(t.text)}exportDOM(){const t=document.createElement("span");return t.textContent=this.__text,t.dataset.divider="true",{element:t}}static importDOM(){return{span:t=>t.dataset.divider==="true"||t.textContent==="_______________________________"?{conversion:()=>({node:new Nl}),priority:2}:null}}toCodoxNode(){const t=this.exportJSON(),n={type:"quote",text:"_______________________________",format:t.format,style:`color:${t.color||""};background-color:${t.backgroundColor||""};`,detail:t.detail,version:t.version,codox_metadata:{type:t.type,id:t.id}};return console.log("[DEMO DEBUG][WarningNode][toCodoxNode]: ",{convertedNode:n,originalJsonNode:t}),n}static fromCodoxNode(t){let n="",e="";const s={type:t.codox_metadata.type,text:t.text,format:t.format,mode:t.mode,detail:t.detail,version:t.version,style:"",id:t.codox_metadata.id,color:n,backgroundColor:e};return console.log("[DEMO DEBUG][WarningNode][fromCodoxNode]: ",{codoxNode:t,originalJsonNode:s}),s}}function T1(){return new Nl}function Ym(l){return l instanceof Nl}const O1=fo();function Zm(l){const t={m:1e3,cm:900,d:500,cd:400,c:100,xc:90,l:50,xl:40,x:10,ix:9,v:5,iv:4,i:1};let n="";for(let e in t)for(;l>=t[e];)n+=e,l-=t[e];return n}function N1(){const[l]=xn(),t=(s,r)=>{r(s),Tt(s)&&s.getChildren().forEach(o=>t(o,r))},n=()=>{l.update(()=>{const s=Mn(),r=[];t(s,a=>{Xm(a)&&r.push(a)});let o=!1;for(let a=0;a<r.length;a++)if(r[a].getNumber()!==a+1){o=!0;break}o&&r.forEach((a,c)=>{const i=c+1;a.setNumber(i);const u=a.getContentKey(),f=Rn(u);if(Or(f)){const d=f.getFirstChild();if(Jt(d)){const p=d.getTextContent(),h=p.replace(/^\[[^\]]*\]/,`[${Zm(i)}]`);h!==p&&d.setTextContent(h)}}})})},e=()=>{let s=null;l.update(()=>{var v;const r=Mn(),o=Ot(),a=MT(0);o&&o.insertNodes([a]);const c=En(),i=ir("[?] ");c.append(i),r.append(c),s=c.getKey(),a.setContentKey(s);const u=[];t(r,b=>{Xm(b)&&u.push(b)});const d=u.map(b=>b.getContentKey()).map(b=>Rn(b)).filter(b=>b!==null);d==null||d.forEach(b=>{b&&r.append(b)});let p=!1;if(r.getChildren().forEach(b=>{if(Or(b)){const E=b.getFirstChild();if((E&&Ym(E)||E&&Jt(E)&&E.getTextContent().includes("_______________________________"))&&(p=!0,!Ym(E)&&E.getTextContent().includes("_______________________________"))){const S=T1();E.replace(S)}}}),!p&&(d==null?void 0:d.length)>0){const b=En();b.append(T1()),(v=d[0])==null||v.insertBefore(b)}const h=[];if(r.getChildren().forEach(b=>{if(Or(b)){const E=b.getFirstChild();(E&&Ym(E)||E&&Jt(E)&&E.getTextContent().includes("_______________________________"))&&h.push(b)}}),h.length>1)for(let b=1;b<h.length;b++)h[b].remove();const m=[];t(r,b=>{Xm(b)&&m.push(b)}),m.forEach((b,E)=>{const S=E+1;b.setNumber(S);const w=b.getContentKey(),y=Rn(w);if(Or(y)){const x=y.getFirstChild();if(Jt(x)){const C=x.getTextContent(),T=C.replace(/^\[[^\]]*\]/,`[${Zm(S)}]`);T!==C&&x.setTextContent(T)}}});const g=i.getTextContentSize(),_=yc();_.anchor.set(i.getKey(),g,"text"),_.focus.set(i.getKey(),g,"text"),Cr(_)}),s&&setTimeout(()=>{l.getEditorState().read(()=>{const r=l.getElementByKey(s);r&&r.scrollIntoView({behavior:"smooth",block:"end"})})},100)};return he.useEffect(()=>{const s=l.registerCommand(O1,()=>(e(),!0),0);return l.update(()=>{setTimeout(n,100)}),s},[l]),null}class Al extends no{constructor(n,e,s,r){super(s||`[${n}]`,r);Hn(this,"__number");Hn(this,"__contentKey");this.__number=n,this.__contentKey=e}static getType(){return"endnote"}static clone(n){return new Al(n.__number,n.__contentKey,n.__text,n.__key)}static importJSON(n){return new Al(n.number,n.contentKey,n.text,n.key)}exportJSON(){return{...super.exportJSON(),number:this.__number,contentKey:this.__contentKey,type:"endnote",version:1,id:""}}setNumber(n){const e=this.getWritable();e.__number=n,this.setTextContent(`[${Zm(n)}]`)}setContentKey(n){const e=this.getWritable();e.__contentKey=n}getContentKey(){return this.__contentKey}createDOM(n){const e=super.createDOM(n);return e.style.cssText="cursor: pointer; vertical-align: super; font-size: 0.8em;",e.dataset.endnote="true",e}exportDOM(){const n=document.createElement("span");return n.dataset.lexicalEndnote="true",n.textContent=this.__text,{element:n}}static importDOM(){return{span:n=>n.dataset.lexicalEndnote==="true"?{conversion:IT,priority:1}:null}}getNumber(){return this.__number}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}toCodoxNode(){const n=this.exportJSON(),e={type:"quote",text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,codox_metadata:{type:n.type,id:n.id}};return console.log("[DEMO DEBUG][WarningNode][toCodoxNode]: ",{convertedNode:e,originalJsonNode:n}),e}static fromCodoxNode(n){let e="",s="";const r={type:n.codox_metadata.type,text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,style:"",id:n.codox_metadata.id,color:e,backgroundColor:s};return console.log("[DEMO DEBUG][WarningNode][fromCodoxNode]: ",{codoxNode:n,originalJsonNode:r}),r}}function IT(l){var e;const t=(e=l.textContent)==null?void 0:e.match(/\[(\d+)\]/),n=t?parseInt(t[1],10):1;return{node:new Al(n)}}function MT(l,t){return new Al(l,t||"")}function Xm(l){return l instanceof Al}class $o extends no{constructor(n,e,s,r){super(n,r);Hn(this,"__color");Hn(this,"__id");this.__color=e,this.__id=s}static getType(){return"colored"}getId(){return this.__id}static clone(n){return new $o(n.__text,n.__color,n.__id,n.__key)}createDOM(n){const e=super.createDOM(n);return e.style.color=this.__color,e.setAttribute("id",this.__id),e.setAttribute("data-ref-id",`ref-${this.__id}`),e}updateDOM(n,e,s){const r=super.updateDOM(n,e,s);return n.__color!==this.__color&&(e.style.color=this.__color),n.__id!==this.__id&&(e.setAttribute("id",this.__id),e.setAttribute("data-ref-id",`ref-${this.__id}`)),r}exportJSON(){return{...super.exportJSON(),type:"colored",color:this.__color,id:this.__id}}static importJSON(n){return new $o(n.text,n.color,n.id)}toCodoxNode(){const n=this.exportJSON(),e={type:"text",text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,style:`color:${n.color};`,codox_metadata:{type:n.type,id:n.id}};return console.log("[DEMO DEBUG][ColoredNode][toCodoxNode]:",{convertedNode:e,originalJsonNode:n}),e}static fromCodoxNode(n){let e="";n.style.split(";").forEach(r=>{r.startsWith("color:")&&(e=r.split(":")[1])});const s={type:n.codox_metadata.type,text:n.text,format:n.format,mode:n.mode,detail:n.detail,version:n.version,style:"",id:n.codox_metadata.id,color:e};return console.log("[DEMO DEBUG][ColoredNode][fromCodoxNode]:",{codoxNode:n,originalJsonNode:s}),s}}const A1=[];class Js extends Br{constructor(n=A1,e){super(e);Hn(this,"__ids");this.__ids=n}static getType(){return"mark"}static clone(n){return new Js(n.__ids,n.__key)}static importDOM(){return{mark:n=>({conversion:e=>{var r;const s=((r=e.getAttribute("data-ids"))==null?void 0:r.split(","))||[];return{node:new Js(s)}},priority:1})}}static importJSON(n){return new Js(n.ids)}exportJSON(){return{...super.exportJSON(),ids:Array.from(this.__ids),type:this.__type}}createDOM(n){const e=document.createElement("mark");return zr(e,n.theme.mark),this.__ids.length>0&&e.setAttribute("data-ids",this.__ids.join(",")),e}updateDOM(n,e,s){const r=n.__ids,o=this.__ids;return r.join(",")!==o.join(",")&&e.setAttribute("data-ids",o.join(",")),!1}exportDOM(){const n=document.createElement("mark");return this.__ids.length>0&&n.setAttribute("data-ids",this.__ids.join(",")),{element:n}}hasID(n){return this.__ids.includes(n)}getIDs(){return Array.from(this.__ids)}setIDs(n){return this.__ids=n,this}addID(n){return this.__ids.includes(n)||(this.__ids=[...this.__ids,n]),this}deleteID(n){const e=this.__ids.indexOf(n);e>-1&&this.__ids.splice(e,1)}insertNewAfter(n,e=!0){const s=Qm(this.__ids);return this.insertAfter(s,e),s}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}}function Qm(l=A1){return Pr(new Js(l))}function Pl(l){return l instanceof Js}function P1(l){const t=l.getChildren();let n=null;for(let e=0;e<t.length;e++){const s=t[e];n===null?l.insertBefore(s):n.insertAfter(s),n=s}l.remove()}function DT(l,t,n,e){const s=yc(),[r,o]=l.isBackward()?[l.focus,l.anchor]:[l.anchor,l.focus];s.anchor.set(r.key,r.offset,r.type),s.focus.set(o.key,o.offset,o.type);let a,c;const i=s.extract();for(const u of i){if(Tt(c)&&c.isParentOf(u))continue;let f=null;if(Jt(u))f=u;else{if(Pl(u))continue;(Tt(u)||hr(u))&&u.isInline()&&(f=u)}if(f!==null){if(f&&f.is(a))continue;const d=f.getParent();(d==null||!d.is(a))&&(c=void 0),a=d,c===void 0&&(c=(e||Qm)([n]),f.insertBefore(c)),c.append(f)}else a=void 0,c=void 0}Tt(c)&&(t?c.selectStart():c.selectEnd())}function RT(l,t){let n=l;for(;n!==null;){if(Pl(n))return n.getIDs();if(Jt(n)&&t===n.getTextContentSize()){const e=n.getNextSibling();if(Pl(e))return e.getIDs()}n=n.getParent()}return null}const I1=[Js,vp,fd,dd,yp,Em,xs,is,Cl,gp,km,ud,xc,Wb,Gm,jp,Jm,_d,vd,Tc,Dm,Op,Cp,md,yd,Ep,Ol,kp,Tp,bd,Al,$o,Aa,Nl],mR="";function ey(...l){return l.filter(Boolean).join(" ")}function Fi({"data-test-id":l,children:t,className:n,onClick:e,disabled:s,small:r,title:o}){return ce.jsx("button",{disabled:s,className:ey("Button__root",s&&"Button__disabled",r&&"Button__small",n),onClick:e,title:o,"aria-label":o,...l&&{"data-test-id":l},children:t})}const yR="";function Np({"data-test-id":l,children:t}){return ce.jsx("div",{className:"DialogActions","data-test-id":l,children:t})}const vR="";function Oc({label:l,value:t,onChange:n,placeholder:e="","data-test-id":s,type:r="text"}){return ce.jsxs("div",{className:"Input__wrapper",children:[ce.jsx("label",{className:"Input__label",children:l}),ce.jsx("input",{type:r,className:"Input__input",placeholder:e,value:t,onChange:o=>{n(o.target.value)},"data-test-id":s})]})}const LT=he.createContext({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function M1({children:l}){const[t,n]=he.useState({cellEditorConfig:null,cellEditorPlugins:null});return ce.jsx(LT.Provider,{value:he.useMemo(()=>({cellEditorConfig:t.cellEditorConfig,cellEditorPlugins:t.cellEditorPlugins,set:(e,s)=>{n({cellEditorConfig:e,cellEditorPlugins:s})}}),[t.cellEditorConfig,t.cellEditorPlugins]),children:l})}const Ap=(l,t)=>{let n=5381;const e=String(t);for(let s=0;s<e.length;s++)n=(n<<5)+n+e.charCodeAt(s);return`table-${t}-${Math.abs(n%1e6)}`};function FT({activeEditor:l,onClose:t,enableCaptions:n=!0}){const[e,s]=he.useState("5"),[r,o]=he.useState("5"),[a,c]=he.useState(""),[i,u]=he.useState(!0);he.useState(!0);let f=Number(localStorage.getItem("tableCount"))||1;he.useEffect(()=>{const h=Number(e),m=Number(r);h&&h>0&&h<=500&&m&&m>0&&m<=50?u(!1):u(!0)},[e,r]);const d=()=>{l.update(()=>{const m=Mn().getChildren().filter(dr);if(m.length===0){console.warn("No tables found in the document!");return}const g=m.map(_=>{let v=a;const b=_.getPreviousSibling();if(b&&Or(b)){const E=b.getChildren().filter(S=>S.getType()==="text");E.length>1&&(v=E[1].getTextContent())}return{caption:v,content:_.getChildren().map(E=>E.getChildren().map(S=>S.getTextContent()))}});localStorage.setItem("savedTableData",JSON.stringify(g))})},p=()=>{if(!e||!r)return;const h=f;l.update(()=>{if(n){const m=En();m.setFormat("left");const v=Mn().getChildren().filter(dr).length,b=Ap(a||`Table ${h}`,v),E=new $o(`Table ${h}:`,"black",b);E.setStyle("font-weight: bold; margin-right: 8px;");const S=a.trim()===""?".":a,w=ir(S);w.setStyle(a?"color: black; font-style: italic; font-weight: bold;":"color: gray; font-style: italic; font-weight: normal;"),m.getChildren().forEach(T=>T.remove());const y=rs();m.append(E),m.append(w),m.append(y),si([m]);const x={rows:!0,columns:!1},C=Rm(Number(e),Number(r),x);if(!C){console.error("Failed to create TableNode");return}C.__captionId=b,si([C])}else{const m={rows:!0,columns:!1},g=Rm(Number(e),Number(r),m);if(!g){console.error("Failed to create TableNode");return}si([g,rs()])}}),l.update(()=>{if(n){const g=Mn().getChildren().filter(dr);let _=1;g.forEach(v=>{var C;const b=v.getPreviousSibling(),w=Mn().getChildren().filter(dr).length,y=v.__captionId||Ap(`Table ${_}`,w),x=v.getNextSibling();if(x&&Or(x)&&x.getChildren().forEach(T=>{T.getTextContent().startsWith("Table")&&T.remove()}),b&&Or(b)){let T=null;if(b.getChildren().forEach(F=>{F.getTextContent().startsWith("Table")&&(T=F)}),T){const F=((C=T.getId)==null?void 0:C.call(T))||y;T.remove();const B=new $o(`Table ${_}:`,"black",F),D=b.getFirstChild();D!==null?D.insertBefore(B):b.append(B)}else if(n){const F=new $o(`Table ${_}:`,"black",y),B=b.getFirstChild();B!==null?B.insertBefore(F):b.append(F)}}else{const T=`Table ${_}:`,F=En();F.setFormat("left");const B=new $o(T,"black",y);B.setStyle("font-weight: bold; margin-right: 5px;");const D=a.trim()===""?"Caption text here":a,L=ir(D);L.setStyle("color: black; font-style: italic; font-weight: normal;"),F.append(B),F.append(ir(" ")),F.append(L),v.insertBefore(F)}_++})}}),f++,localStorage.setItem("tableCount",f.toString()),setTimeout(()=>{d()},50),t==null||t()};return ce.jsxs(ce.Fragment,{children:[ce.jsx(Oc,{placeholder:"# of rows (1-500)",label:"Rows",onChange:s,value:e,type:"number"}),ce.jsx(Oc,{placeholder:"# of columns (1-50)",label:"Columns",onChange:o,value:r,type:"number"}),n&&ce.jsx(Oc,{placeholder:"Enter table caption",label:"Caption",value:a,onChange:c}),ce.jsx(Np,{children:ce.jsx(Fi,{disabled:i,onClick:p,children:"Confirm"})})]})}const _R="",ty={blockCursor:"PlaygroundEditorTheme__blockCursor",characterLimit:"PlaygroundEditorTheme__characterLimit",code:"PlaygroundEditorTheme__code",codeHighlight:{atrule:"PlaygroundEditorTheme__tokenAttr",attr:"PlaygroundEditorTheme__tokenAttr",boolean:"PlaygroundEditorTheme__tokenProperty",builtin:"PlaygroundEditorTheme__tokenSelector",cdata:"PlaygroundEditorTheme__tokenComment",char:"PlaygroundEditorTheme__tokenSelector",class:"PlaygroundEditorTheme__tokenFunction","class-name":"PlaygroundEditorTheme__tokenFunction",comment:"PlaygroundEditorTheme__tokenComment",constant:"PlaygroundEditorTheme__tokenProperty",deleted:"PlaygroundEditorTheme__tokenProperty",doctype:"PlaygroundEditorTheme__tokenComment",entity:"PlaygroundEditorTheme__tokenOperator",function:"PlaygroundEditorTheme__tokenFunction",important:"PlaygroundEditorTheme__tokenVariable",inserted:"PlaygroundEditorTheme__tokenSelector",keyword:"PlaygroundEditorTheme__tokenAttr",namespace:"PlaygroundEditorTheme__tokenVariable",number:"PlaygroundEditorTheme__tokenProperty",operator:"PlaygroundEditorTheme__tokenOperator",prolog:"PlaygroundEditorTheme__tokenComment",property:"PlaygroundEditorTheme__tokenProperty",punctuation:"PlaygroundEditorTheme__tokenPunctuation",regex:"PlaygroundEditorTheme__tokenVariable",selector:"PlaygroundEditorTheme__tokenSelector",string:"PlaygroundEditorTheme__tokenSelector",symbol:"PlaygroundEditorTheme__tokenProperty",tag:"PlaygroundEditorTheme__tokenProperty",url:"PlaygroundEditorTheme__tokenOperator",variable:"PlaygroundEditorTheme__tokenVariable"},embedBlock:{base:"PlaygroundEditorTheme__embedBlock",focus:"PlaygroundEditorTheme__embedBlockFocus"},hashtag:"PlaygroundEditorTheme__hashtag",heading:{h1:"PlaygroundEditorTheme__h1",h2:"PlaygroundEditorTheme__h2",h3:"PlaygroundEditorTheme__h3",h4:"PlaygroundEditorTheme__h4",h5:"PlaygroundEditorTheme__h5",h6:"PlaygroundEditorTheme__h6"},image:"editor-image",indent:"PlaygroundEditorTheme__indent",inlineImage:"inline-editor-image",layoutContainer:"PlaygroundEditorTheme__layoutContainer",layoutItem:"PlaygroundEditorTheme__layoutItem",link:"PlaygroundEditorTheme__link",list:{checklist:"PlaygroundEditorTheme__checklist",listitem:"PlaygroundEditorTheme__listItem",listitemChecked:"PlaygroundEditorTheme__listItemChecked",listitemUnchecked:"PlaygroundEditorTheme__listItemUnchecked",nested:{listitem:"PlaygroundEditorTheme__nestedListItem"},olDepth:["PlaygroundEditorTheme__ol1","PlaygroundEditorTheme__ol2","PlaygroundEditorTheme__ol3","PlaygroundEditorTheme__ol4","PlaygroundEditorTheme__ol5"],ul:"PlaygroundEditorTheme__ul"},ltr:"PlaygroundEditorTheme__ltr",mark:"PlaygroundEditorTheme__mark",markOverlap:"PlaygroundEditorTheme__markOverlap",paragraph:"PlaygroundEditorTheme__paragraph",quote:"PlaygroundEditorTheme__quote",rtl:"PlaygroundEditorTheme__rtl",table:"PlaygroundEditorTheme__table",tableAddColumns:"PlaygroundEditorTheme__tableAddColumns",tableAddRows:"PlaygroundEditorTheme__tableAddRows",tableCell:"PlaygroundEditorTheme__tableCell",tableCellActionButton:"PlaygroundEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"PlaygroundEditorTheme__tableCellActionButtonContainer",tableCellEditing:"PlaygroundEditorTheme__tableCellEditing",tableCellHeader:"PlaygroundEditorTheme__tableCellHeader",tableCellPrimarySelected:"PlaygroundEditorTheme__tableCellPrimarySelected",tableCellResizer:"PlaygroundEditorTheme__tableCellResizer",tableCellSelected:"PlaygroundEditorTheme__tableCellSelected",tableCellSortedIndicator:"PlaygroundEditorTheme__tableCellSortedIndicator",tableResizeRuler:"PlaygroundEditorTheme__tableCellResizeRuler",tableSelected:"PlaygroundEditorTheme__tableSelected",tableSelection:"PlaygroundEditorTheme__tableSelection",text:{bold:"PlaygroundEditorTheme__textBold",code:"PlaygroundEditorTheme__textCode",italic:"PlaygroundEditorTheme__textItalic",strikethrough:"PlaygroundEditorTheme__textStrikethrough",subscript:"PlaygroundEditorTheme__textSubscript",superscript:"PlaygroundEditorTheme__textSuperscript",underline:"PlaygroundEditorTheme__textUnderline",underlineStrikethrough:"PlaygroundEditorTheme__textUnderlineStrikethrough"}};function Pp({defaultSelection:l}){const[t]=xn();return he.useEffect(()=>{t.focus(()=>{const n=document.activeElement,e=t.getRootElement();e===null||n!==null&&e.contains(n)||e.focus({preventScroll:!0})},{defaultSelection:l})},[l,t]),null}function ny(){return Mn().getTextContent()}function ry(l,t=!0){if(l)return!1;let n=ny();return t&&(n=n.trim()),n===""}function BT(l){if(!ry(l,!1))return!1;const t=Mn().getChildren(),n=t.length;if(n>1)return!1;for(let e=0;e<n;e++){const s=t[e];if(hr(s))return!1;if(Tt(s)){if(!Or(s)||s.__indent!==0)return!1;const r=s.getChildren(),o=r.length;for(let a=0;a<o;a++){const c=r[e];if(!Jt(c))return!1}}}return!0}function D1(l){return()=>BT(l)}function zT(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var UT=zT(function(l){const t=new URLSearchParams;t.append("code",l);for(let n=1;n<arguments.length;n++)t.append("v",arguments[n]);throw Error(`Minified Lexical error #${l}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function HT(l,t,n,e){const s=o=>o instanceof n,r=o=>{const a=ir(o.getTextContent());a.setFormat(o.getFormat()),o.replace(a)};return[l.registerNodeTransform(no,o=>{if(!o.isSimpleText())return;let a,c=o.getPreviousSibling(),i=o.getTextContent(),u=o;if(Jt(c)){const d=c.getTextContent(),p=t(d+i);if(s(c)){if(p===null||(h=>h.getLatest().__mode)(c)!==0)return void r(c);{const h=p.end-d.length;if(h>0){const m=d+i.slice(0,h);if(c.select(),c.setTextContent(m),h===i.length)o.remove();else{const g=i.slice(h);o.setTextContent(g)}return}}}else if(p===null||p.start<d.length)return}let f=0;for(;;){a=t(i);let d,p=a===null?"":i.slice(a.end);if(i=p,p===""){const m=u.getNextSibling();if(Jt(m)){p=u.getTextContent()+m.getTextContent();const g=t(p);if(g===null)return void(s(m)?r(m):m.markDirty());if(g.start!==0)return}}if(a===null)return;if(a.start===0&&Jt(c)&&c.isTextEntity()){f+=a.end;continue}a.start===0?[d,u]=u.splitText(a.end):[,d,u]=u.splitText(a.start+f,a.end+f),d===void 0&&UT(165,"nodeToReplace");const h=e(d);if(h.setFormat(d.getFormat()),d.replace(h),u==null)return;f=0,c=h}}),l.registerNodeTransform(n,o=>{const a=o.getTextContent(),c=t(a);if(c===null||c.start!==0)return void r(o);if(a.length>c.end)return void o.splitText(c.end);const i=o.getPreviousSibling();Jt(i)&&i.isTextEntity()&&(r(i),r(o));const u=o.getNextSibling();Jt(u)&&u.isTextEntity()&&(r(u),s(o)&&r(o))})]}function R1(l,t,n){const[e]=xn();he.useEffect(()=>br(...HT(e,l,t,n)),[n,e,l,t])}const $T=new RegExp(function(){const{alpha:l,alphanumeric:t,hashChars:n}=function(){const s=String.fromCharCode,r="A-Za-zªµºÀ-ÖØ-öø-Ɂɐ-ˁˆ-ˑˠ-ˤˮͺΆΈ-ΊΌΎ-ΡΣ-ώϐ-ϵϷ-ҁҊ-ӎӐ-ӹԀ-ԏԱ-Ֆՙա-ևא-תװ-ײء-غـ-يٮ-ٯٱ-ۓەۥ-ۦۮ-ۯۺ-ۼۿܐܒ-ܯݍ-ݭހ-ޥޱऄ-हऽॐक़-ॡॽঅ-ঌএ-ঐও-নপ-রলশ-হঽৎড়-ঢ়য়-ৡৰ-ৱਅ-ਊਏ-ਐਓ-ਨਪ-ਰਲ-ਲ਼ਵ-ਸ਼ਸ-ਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલ-ળવ-હઽૐૠ-ૡଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହଽଡ଼-ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கங-சஜஞ-டண-தந-பம-ஹఅ-ఌఎ-ఐఒ-నప-ళవ-హౠ-ౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠ-ೡഅ-ഌഎ-ഐഒ-നപ-ഹൠ-ൡඅ-ඖක-නඳ-රලව-ෆก-ะา-ำเ-ๆກ-ຂຄງ-ຈຊຍດ-ທນ-ຟມ-ຣລວສ-ຫອ-ະາ-ຳຽເ-ໄໆໜ-ໝༀཀ-ཇཉ-ཪྈ-ྋက-အဣ-ဧဩ-ဪၐ-ၕႠ-Ⴥა-ჺჼᄀ-ᅙᅟ-ᆢᆨ-ᇹሀ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙶᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦩᧁ-ᧇᨀ-ᨖᴀ-ᶿḀ-ẛẠ-ỹἀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₔℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℱℳ-ℹℼ-ℿⅅ-ⅉⰀ-Ⱞⰰ-ⱞⲀ-ⳤⴀ-ⴥⴰ-ⵥⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〆〱-〵〻-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄬㄱ-ㆎㆠ-ㆷㇰ-ㇿ㐀-䶵一-龻ꀀ-ꒌꠀ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢ가-힣豈-鶴侮-頻並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ̀-ͯ҃-֑҆-ֹֻ-ֽֿׁ-ׂׄ-ׇׅؐ-ًؕ-ٰٞۖ-ۜ۟-ۤۧ-۪ۨ-ܑۭܰ-݊ަ-ްँ-ः़ा-्॑-॔ॢ-ॣঁ-ঃ়া-ৄে-ৈো-্ৗৢ-ৣਁ-ਃ਼ਾ-ੂੇ-ੈੋ-੍ੰ-ੱઁ-ઃ઼ા-ૅે-ૉો-્ૢ-ૣଁ-ଃ଼ା-ୃେ-ୈୋ-୍ୖ-ୗஂா-ூெ-ைொ-்ௗఁ-ఃా-ౄె-ైొ-్ౕ-ౖಂ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕ-ೖം-ഃാ-ൃെ-ൈൊ-്ൗං-ඃ්ා-ුූෘ-ෟෲ-ෳัิ-ฺ็-๎ັິ-ູົ-ຼ່-ໍ༘-༹༙༵༷༾-༿ཱ-྄྆-྇ྐ-ྗྙ-ྼ࿆ာ-ဲံ-္ၖ-ၙ፟ᜒ-᜔ᜲ-᜴ᝒ-ᝓᝲ-ᝳា-៓៝᠋-᠍ᢩᤠ-ᤫᤰ-᤻ᦰ-ᧀᧈ-ᧉᨗ-ᨛ᷀-᷃⃐-⃥⃜⃡-⃫〪-゙〯-゚ꠂ꠆ꠋꠣ-ꠧﬞ︀-️︠-︣À-ÖØ-öø-ÿĀ-ɏɓ-ɔɖ-ɗəɛɣɨɯɲʉʋʻ̀-ͯḀ-ỿЀ-ӿԀ-ԧⷠ-ⷿꙀ-֑ꚟ-ֿׁ-ׂׄ-ׇׅא-תװ-״﬒-ﬨשׁ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﭏؐ-ؚؠ-ٟٮ-ۓە-ۜ۞-۪ۨ-ۯۺ-ۼۿݐ-ݿࢠࢢ-ࢬࣤ-ࣾﭐ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼ‌-‌ก-ฺเ-๎ᄀ-ᇿ㄰-ㆅꥠ-꥿가-힯ힰ-퟿ᄀ-ᅵァ-ヺー-ヾヲ-゚0-9A-Za-zぁ-ゖ゙-ゞ㐀-䶿一-鿿"+s(173824)+"-"+s(177983)+s(177984)+"-"+s(178207)+s(194560)+"-"+s(195103)+"〃々〻";return{alpha:r,alphanumeric:r+"0-9٠-٩۰-۹०-९০-৯੦-੯૦-૯୦-୯௦-௯౦-౯೦-೯൦-൯๐-๙໐-໙༠-༩၀-၉០-៩᠐-᠙᥆-᥏᧐-᧙0-9_",hashChars:"#\\uFF03"}}(),e="["+t+"]";return"("+("^|$|[^&/"+t+"]")+")("+("["+n+"]")+")("+e+"*"+("["+l+"]")+e+"*)"}(),"i");function L1(){const[l]=xn();he.useEffect(()=>{if(!l.hasNodes([gp]))throw new Error("HashtagPlugin: HashtagNode not registered on editor")},[l]);const t=he.useCallback(e=>Ab(e.getTextContent()),[]),n=he.useCallback(e=>{const s=$T.exec(e);if(s===null)return null;const r=s[3].length+1,o=s.index+s[1].length;return{end:o+r,start:o}},[]);return R1(n,gp,t),null}function F1(){const[l]=xn();return he.useEffect(()=>{if(!l.hasNodes([fd,dd]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[l]),function(t){he.useEffect(()=>br(t.registerCommand($b,()=>(Db(t,"number"),!0),Gn),t.registerCommand(Hb,()=>(Db(t,"bullet"),!0),Gn),t.registerCommand(qb,()=>(I2(t),!0),Gn),t.registerCommand(hl,()=>!!R2(),Gn)),[t])}(l),null}const qT=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?he.useLayoutEffect:he.useEffect;function WT(l){return{initialValueFn:()=>l.isEditable(),subscribe:t=>l.registerEditableListener(t)}}function oy(){return function(l){const[t]=xn(),n=he.useMemo(()=>l(t),[t,l]),e=he.useRef(n.initialValueFn()),[s,r]=he.useState(e.current);return qT(()=>{const{initialValueFn:o,subscribe:a}=n,c=o();return e.current!==c&&(e.current=c,r(c)),a(i=>{e.current=i,r(i)})},[n,l]),s}(WT)}function B1(l){const t=window.location.origin,n=e=>{if(e.origin!==t)return;const s=l.getRootElement();if(document.activeElement!==s)return;const r=e.data;if(typeof r=="string"){let o;try{o=JSON.parse(r)}catch{return}if(o&&o.protocol==="nuanria_messaging"&&o.type==="request"){const a=o.payload;if(a&&a.functionId==="makeChanges"){const c=a.args;if(c){const[i,u,f,d,p,h]=c;l.update(()=>{const m=Ot();if(Ct(m)){const g=m.anchor;let _=g.getNode(),v=0,b=0;if(Jt(_)&&i>=0&&u>=0&&(v=i,b=i+u,m.setTextNodeRange(_,v,_,b)),v===b&&f===""||(m.insertRawText(f),_=g.getNode()),Jt(_)){v=d,b=d+p;const E=_.getTextContentSize();v=v>E?E:v,b=b>E?E:b,m.setTextNodeRange(_,v,_,b)}e.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}}function Ip(l,t){const n=t.body?t.body.childNodes:[];let e=[];const s=[];for(let r=0;r<n.length;r++){const o=n[r];if(!H1.has(o.nodeName)){const a=$1(o,l,s,!1);a!==null&&(e=e.concat(a))}}return function(r){for(const o of r)o.getNextSibling()instanceof mm&&o.insertAfter(rs());for(const o of r){const a=o.getChildren();for(const c of a)o.insertBefore(c);o.remove()}}(s),e}function z1(l,t){if(typeof document>"u"||typeof window>"u"&&global.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const n=document.createElement("div"),e=Mn().getChildren();for(let s=0;s<e.length;s++)U1(l,e[s],n,t);return n.innerHTML}function U1(l,t,n,e=null){let s=e===null||t.isSelected(e);const r=Tt(t)&&t.excludeFromCopy("html");let o=t;if(e!==null){let p=sb(t);p=Jt(p)&&e!==null?ab(e,p):p,o=p}const a=Tt(o)?o.getChildren():[],c=l._nodes.get(o.getType());let i;i=c&&c.exportDOM!==void 0?c.exportDOM(l,o):o.exportDOM(l);const{element:u,after:f}=i;if(!u)return!1;const d=document.createDocumentFragment();for(let p=0;p<a.length;p++){const h=a[p],m=U1(l,h,d,e);!s&&Tt(t)&&m&&t.extractWithChild(h,e,"html")&&(s=!0)}if(s&&!r){if(Ri(u)&&u.append(d),n.append(u),f){const p=f.call(o,u);p&&u.replaceWith(p)}}else n.append(d);return s}const H1=new Set(["STYLE","SCRIPT"]);function $1(l,t,n,e,s=new Map,r){let o=[];if(H1.has(l.nodeName))return o;let a=null;const c=function(h,m){const{nodeName:g}=h,_=m._htmlConversions.get(g.toLowerCase());let v=null;if(_!==void 0)for(const b of _){const E=b(h);E!==null&&(v===null||(v.priority||0)<(E.priority||0))&&(v=E)}return v!==null?v.conversion:null}(l,t),i=c?c(l):null;let u=null;if(i!==null){u=i.after;const h=i.node;if(a=Array.isArray(h)?h[h.length-1]:h,a!==null){for(const[,m]of s)if(a=m(a,r),!a)break;a&&o.push(...Array.isArray(h)?h:[a])}i.forChild!=null&&s.set(l.nodeName,i.forChild)}const f=l.childNodes;let d=[];const p=(a==null||!to(a))&&(a!=null&&dm(a)||e);for(let h=0;h<f.length;h++)d.push(...$1(f[h],t,n,p,new Map(s),a));return u!=null&&(d=u(d)),Bk(l)&&(d=JT(l,d,p?()=>{const h=new mm;return n.push(h),h}:En)),a==null?o=o.concat(d):Tt(a)&&a.append(...d),o}function JT(l,t,n){const e=l.style.textAlign,s=[];let r=[];for(let o=0;o<t.length;o++){const a=t[o];if(dm(a))e&&!a.getFormat()&&a.setFormat(e),s.push(a);else if(r.push(a),o===t.length-1||o<t.length-1&&dm(t[o+1])){const c=n();c.setFormat(e),c.append(...r),s.push(c),r=[]}}return s}function VT(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var Mp=VT(function(l){const t=new URLSearchParams;t.append("code",l);for(let n=1;n<arguments.length;n++)t.append("v",arguments[n]);throw Error(`Minified Lexical error #${l}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const KT=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,q1=l=>KT?(l||window).getSelection():null;function W1(l){const t=Ot();return t==null&&Mp(166),Ct(t)&&t.isCollapsed()||t.getNodes().length===0?"":z1(l,t)}function GT(l){const t=Ot();return t==null&&Mp(166),Ct(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(YT(l,t))}function J1(l,t){const n=l.getData("text/plain")||l.getData("text/uri-list");n!=null&&t.insertRawText(n)}function V1(l,t,n){const e=l.getData("application/x-lexical-editor");if(e)try{const o=JSON.parse(e);if(o.namespace===n._config.namespace&&Array.isArray(o.nodes))return K1(n,ZT(o.nodes),t)}catch{}const s=l.getData("text/html");if(s)try{const o=new DOMParser().parseFromString(s,"text/html");return K1(n,Ip(n,o),t)}catch{}const r=l.getData("text/plain")||l.getData("text/uri-list");if(r!=null)if(Ct(t)){const o=r.split(/(\r?\n|\t)/);o[o.length-1]===""&&o.pop();for(let a=0;a<o.length;a++){const c=Ot();if(Ct(c)){const i=o[a];i===`
65
65
  `||i===`\r
66
- `?c.insertParagraph():i===" "?c.insertNodes([mc()]):c.insertText(i)}}}else t.insertRawText(r)}function K1(l,t,n){l.dispatchCommand(jv,{nodes:t,selection:n})||n.insertNodes(t)}function G1(l,t,n,e=[]){let s=t===null||n.isSelected(t);const r=Tt(n)&&n.excludeFromCopy("html");let o=n;if(t!==null){let i=sb(n);i=Jt(i)&&t!==null?ab(t,i):i,o=i}const a=Tt(o)?o.getChildren():[],c=function(i){const u=i.exportJSON(),f=i.constructor;if(u.type!==f.getType()&&Mp(58,f.name),Tt(i)){const d=u.children;Array.isArray(d)||Mp(59,f.name)}return u}(o);if(Jt(o)){const i=o.__text;i.length>0?c.text=i:s=!1}for(let i=0;i<a.length;i++){const u=a[i],f=G1(l,t,u,c.children);!s&&Tt(n)&&f&&n.extractWithChild(u,t,"clone")&&(s=!0)}if(s&&!r)e.push(c);else if(Array.isArray(c.children))for(let i=0;i<c.children.length;i++){const u=c.children[i];e.push(u)}return s}function YT(l,t){const n=[],e=Mn().getChildren();for(let s=0;s<e.length;s++)G1(l,t,e[s],n);return{namespace:l._config.namespace,nodes:n}}function ZT(l){const t=[];for(let n=0;n<l.length;n++){const e=l[n],s=n2(e);Jt(s)&&l2(s),t.push(s)}return t}let Nc=null;async function Y1(l,t){if(Nc!==null)return!1;if(t!==null)return new Promise((a,c)=>{l.update(()=>{a(Z1(l,t))})});const n=l.getRootElement(),e=l._window==null?window.document:l._window.document,s=q1(l._window);if(n===null||s===null)return!1;const r=e.createElement("span");r.style.cssText="position: fixed; top: -1000px;",r.append(e.createTextNode("#")),n.append(r);const o=new Range;return o.setStart(r,0),o.setEnd(r,1),s.removeAllRanges(),s.addRange(o),new Promise((a,c)=>{const i=l.registerCommand($u,u=>($s(u,ClipboardEvent)&&(i(),Nc!==null&&(window.clearTimeout(Nc),Nc=null),a(Z1(l,u))),!0),Uo);Nc=window.setTimeout(()=>{i(),Nc=null,a(!1)},50),e.execCommand("copy"),r.remove()})}function Z1(l,t){const n=q1(l._window);if(!n)return!1;const e=n.anchorNode,s=n.focusNode;if(e!==null&&s!==null&&!Ju(l,e,s))return!1;t.preventDefault();const r=t.clipboardData,o=Ot();if(r===null||o===null)return!1;const a=W1(l),c=GT(l);let i="";return o!==null&&(i=o.getTextContent()),a!==null&&r.setData("text/html",a),c!==null&&r.setData("application/x-lexical-editor",c),r.setData("text/plain",i),!0}function X1(l,t){if(document.caretRangeFromPoint!==void 0){const n=document.caretRangeFromPoint(l,t);return n===null?null:{node:n.startContainer,offset:n.startOffset}}if(document.caretPositionFromPoint!=="undefined"){const n=document.caretPositionFromPoint(l,t);return n===null?null:{node:n.offsetNode,offset:n.offset}}return null}const Ac=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,XT=Ac&&"documentMode"in document?document.documentMode:null,QT=!(!Ac||!("InputEvent"in window)||XT)&&"getTargetRanges"in new window.InputEvent("input"),eO=Ac&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),tO=Ac&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,nO=Ac&&/^(?=.*Chrome).*/i.test(navigator.userAgent),rO=Ac&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!nO,iy=fo();class Dp extends Br{static getType(){return"quote"}static clone(t){return new Dp(t.__key)}constructor(t){super(t)}createDOM(t){const n=document.createElement("blockquote");return zr(n,t.theme.quote),n}updateDOM(t,n){return!1}static importDOM(){return{blockquote:t=>({conversion:iO,priority:0})}}exportDOM(t){const{element:n}=super.exportDOM(t);if(n&&Ri(n)){this.isEmpty()&&n.append(document.createElement("br"));const e=this.getFormatType();n.style.textAlign=e;const s=this.getDirection();s&&(n.dir=s)}return{element:n}}static importJSON(t){const n=Q1();return n.setFormat(t.format),n.setIndent(t.indent),n.setDirection(t.direction),n}exportJSON(){return{...super.exportJSON(),type:"quote"}}insertNewAfter(t,n){const e=En(),s=this.getDirection();return e.setDirection(s),this.insertAfter(e,n),e}collapseAtStart(){const t=En();return this.getChildren().forEach(n=>t.append(n)),this.replace(t),!0}}function Q1(){return Pr(new Dp)}function oO(l){return l instanceof Dp}class Rp extends Br{static getType(){return"heading"}static clone(t){return new Rp(t.__tag,t.__key)}constructor(t,n){super(n),this.__tag=t}getTag(){return this.__tag}createDOM(t){const n=this.__tag,e=document.createElement(n),s=t.theme.heading;if(s!==void 0){const r=s[n];zr(e,r)}return e}updateDOM(t,n){return!1}static importDOM(){return{h1:t=>({conversion:Pc,priority:0}),h2:t=>({conversion:Pc,priority:0}),h3:t=>({conversion:Pc,priority:0}),h4:t=>({conversion:Pc,priority:0}),h5:t=>({conversion:Pc,priority:0}),h6:t=>({conversion:Pc,priority:0}),p:t=>{const n=t.firstChild;return n!==null&&ew(n)?{conversion:()=>({node:null}),priority:3}:null},span:t=>ew(t)?{conversion:n=>({node:wd("h1")}),priority:3}:null}}exportDOM(t){const{element:n}=super.exportDOM(t);if(n&&Ri(n)){this.isEmpty()&&n.append(document.createElement("br"));const e=this.getFormatType();n.style.textAlign=e;const s=this.getDirection();s&&(n.dir=s)}return{element:n}}static importJSON(t){const n=wd(t.tag);return n.setFormat(t.format),n.setIndent(t.indent),n.setDirection(t.direction),n}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),type:"heading",version:1}}insertNewAfter(t,n=!0){const e=t?t.anchor.offset:0,s=e!==this.getTextContentSize()&&t?wd(this.getTag()):En(),r=this.getDirection();if(s.setDirection(r),this.insertAfter(s,n),e===0&&!this.isEmpty()&&t){const o=En();o.select(),this.replace(o,!0)}return s}collapseAtStart(){const t=this.isEmpty()?En():wd(this.getTag());return this.getChildren().forEach(n=>t.append(n)),this.replace(t),!0}extractWithChild(){return!0}}function ew(l){return l.nodeName.toLowerCase()==="span"&&l.style.fontSize==="26pt"}function Pc(l){const t=l.nodeName.toLowerCase();let n=null;return t!=="h1"&&t!=="h2"&&t!=="h3"&&t!=="h4"&&t!=="h5"&&t!=="h6"||(n=wd(t),l.style!==null&&n.setFormat(l.style.textAlign)),{node:n}}function iO(l){const t=Q1();return l.style!==null&&t.setFormat(l.style.textAlign),{node:t}}function wd(l){return Pr(new Rp(l))}function Lp(l){return l instanceof Rp}function Fp(l){let t=null;if($s(l,DragEvent)?t=l.dataTransfer:$s(l,ClipboardEvent)&&(t=l.clipboardData),t===null)return[!1,[],!1];const n=t.types,e=n.includes("Files"),s=n.includes("text/html")||n.includes("text/plain");return[e,Array.from(t.files),s]}function tw(l){const t=Ot();if(!Ct(t))return!1;const n=new Set,e=t.getNodes();for(let s=0;s<e.length;s++){const r=e[s],o=r.getKey();if(n.has(o))continue;const a=er(r,i=>Tt(i)&&!i.isInline());if(a===null)continue;const c=a.getKey();a.canIndent()&&!n.has(c)&&(n.add(c),l(a))}return n.size>0}function Bp(l){const t=po(l);return hr(t)}function sO(l){return br(l.registerCommand(va,t=>{const n=Ot();return!!fr(n)&&(n.clear(),!0)},0),l.registerCommand(Yi,t=>{const n=Ot();return!!Ct(n)&&(n.deleteCharacter(t),!0)},Tn),l.registerCommand(gl,t=>{const n=Ot();return!!Ct(n)&&(n.deleteWord(t),!0)},Tn),l.registerCommand(xa,t=>{const n=Ot();return!!Ct(n)&&(n.deleteLine(t),!0)},Tn),l.registerCommand(ba,t=>{const n=Ot();if(typeof t=="string")n!==null&&n.insertText(t);else{if(n===null)return!1;const e=t.dataTransfer;if(e!=null)V1(e,n,l);else if(Ct(n)){const s=t.data;return s&&n.insertText(s),!0}}return!0},Tn),l.registerCommand(Ef,()=>{const t=Ot();return!!Ct(t)&&(t.removeText(),!0)},Tn),l.registerCommand(Gr,t=>{const n=Ot();return!!Ct(n)&&(n.formatText(t),!0)},Tn),l.registerCommand(ml,t=>{const n=Ot();if(!Ct(n)&&!fr(n))return!1;const e=n.getNodes();for(const s of e){const r=er(s,o=>Tt(o)&&!o.isInline());r!==null&&r.setFormat(t)}return!0},Tn),l.registerCommand(_a,t=>{const n=Ot();return!!Ct(n)&&(n.insertLineBreak(t),!0)},Tn),l.registerCommand(hl,()=>{const t=Ot();return!!Ct(t)&&(t.insertParagraph(),!0)},Tn),l.registerCommand(ik,()=>(si([mc()]),!0),Tn),l.registerCommand(Tv,()=>tw(t=>{const n=t.getIndent();t.setIndent(n+1)}),Tn),l.registerCommand(Ov,()=>tw(t=>{const n=t.getIndent();n>0&&t.setIndent(n-1)}),Tn),l.registerCommand(Uu,t=>{const n=Ot();if(fr(n)&&!Bp(t.target)){const e=n.getNodes();if(e.length>0)return e[0].selectPrevious(),!0}else if(Ct(n)){const e=Zu(n.focus,!0);if(!t.shiftKey&&hr(e)&&!e.isIsolated()&&!e.isInline())return e.selectPrevious(),t.preventDefault(),!0}return!1},Tn),l.registerCommand(Hu,t=>{const n=Ot();if(fr(n)){const e=n.getNodes();if(e.length>0)return e[0].selectNext(0,0),!0}else if(Ct(n)){if(function(s){const r=s.focus;return r.key==="root"&&r.offset===Mn().getChildrenSize()}(n))return t.preventDefault(),!0;const e=Zu(n.focus,!1);if(!t.shiftKey&&hr(e)&&!e.isIsolated()&&!e.isInline())return e.selectNext(),t.preventDefault(),!0}return!1},Tn),l.registerCommand(jf,t=>{const n=Ot();if(fr(n)){const e=n.getNodes();if(e.length>0)return t.preventDefault(),e[0].selectPrevious(),!0}if(!Ct(n))return!1;if(up(n,!0)){const e=t.shiftKey;return t.preventDefault(),dp(n,e,!0),!0}return!1},Tn),l.registerCommand(Cf,t=>{const n=Ot();if(fr(n)&&!Bp(t.target)){const s=n.getNodes();if(s.length>0)return t.preventDefault(),s[0].selectNext(0,0),!0}if(!Ct(n))return!1;const e=t.shiftKey;return!!up(n,!1)&&(t.preventDefault(),dp(n,e,!1),!0)},Tn),l.registerCommand(Zi,t=>{if(Bp(t.target))return!1;const n=Ot();if(!Ct(n))return!1;t.preventDefault();const{anchor:e}=n,s=e.getNode();return n.isCollapsed()&&e.offset===0&&!zo(s)&&bm(s).getIndent()>0?l.dispatchCommand(Ov,void 0):l.dispatchCommand(Yi,!0)},Tn),l.registerCommand(Xi,t=>{if(Bp(t.target))return!1;const n=Ot();return!!Ct(n)&&(t.preventDefault(),l.dispatchCommand(Yi,!1))},Tn),l.registerCommand(Rs,t=>{const n=Ot();if(!Ct(n))return!1;if(t!==null){if((tO||eO||rO)&&QT)return!1;if(t.preventDefault(),t.shiftKey)return l.dispatchCommand(_a,!1)}return l.dispatchCommand(hl,void 0)},Tn),l.registerCommand(Ls,()=>{const t=Ot();return!!Ct(t)&&(l.blur(),!0)},Tn),l.registerCommand(Tf,t=>{const[,n]=Fp(t);if(n.length>0){const s=X1(t.clientX,t.clientY);if(s!==null){const{offset:r,node:o}=s,a=po(o);if(a!==null){const c=yc();if(Jt(a))c.anchor.set(a.getKey(),r,"text"),c.focus.set(a.getKey(),r,"text");else{const u=a.getParentOrThrow().getKey(),f=a.getIndexWithinParent()+1;c.anchor.set(u,f,"element"),c.focus.set(u,f,"element")}const i=Mg(c);Cr(i)}l.dispatchCommand(iy,n)}return t.preventDefault(),!0}const e=Ot();return!!Ct(e)},Tn),l.registerCommand(sc,t=>{const[n]=Fp(t),e=Ot();return!(n&&!Ct(e))},Tn),l.registerCommand(bg,t=>{const[n]=Fp(t),e=Ot();if(n&&!Ct(e))return!1;const s=X1(t.clientX,t.clientY);if(s!==null){const r=po(s.node);hr(r)&&t.preventDefault()}return!0},Tn),l.registerCommand(Of,()=>(r_(),!0),Tn),l.registerCommand($u,t=>(Y1(l,$s(t,ClipboardEvent)?t:null),!0),Tn),l.registerCommand(qu,t=>(async function(n,e){await Y1(e,$s(n,ClipboardEvent)?n:null),e.update(()=>{const s=Ot();Ct(s)?s.removeText():fr(s)&&s.getNodes().forEach(r=>r.remove())})}(t,l),!0),Tn),l.registerCommand(wa,t=>{const[,n,e]=Fp(t);return n.length>0&&!e?(l.dispatchCommand(iy,n),!0):Dg(t.target)?!1:Ot()!==null&&(function(s,r){s.preventDefault(),r.update(()=>{const o=Ot(),a=$s(s,InputEvent)||$s(s,KeyboardEvent)?null:s.clipboardData;a!=null&&o!==null&&V1(a,o,r)},{tag:"paste"})}(t,l),!0)},Tn))}const sy=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?he.useLayoutEffect:he.useEffect;function nw(l){return l.getEditorState().read(D1(l.isComposing()))}function zp({contentEditable:l,placeholder:t,ErrorBoundary:n}){const[e]=xn(),s=function(r,o){const[a,c]=he.useState(()=>r.getDecorators());return sy(()=>r.registerDecoratorListener(i=>{so.flushSync(()=>{c(i)})}),[r]),he.useEffect(()=>{c(r.getDecorators())},[r]),he.useMemo(()=>{const i=[],u=Object.keys(a);for(let f=0;f<u.length;f++){const d=u[f],p=ce.jsx(o,{onError:m=>r._onError(m),children:ce.jsx(he.Suspense,{fallback:null,children:a[d]})}),h=r.getElementByKey(d);h!==null&&i.push(so.createPortal(p,h,d))}return i},[o,a,r])}(e,n);return function(r){sy(()=>br(sO(r),B1(r)),[r])}(e),ce.jsxs(ce.Fragment,{children:[l,ce.jsx(aO,{content:t}),s]})}function aO({content:l}){const[t]=xn(),n=function(s){const[r,o]=he.useState(()=>nw(s));return sy(()=>{function a(){const c=nw(s);o(c)}return a(),br(s.registerUpdateListener(()=>{a()}),s.registerEditableListener(()=>{a()}))},[s]),r}(t),e=oy();return n?typeof l=="function"?l(e):l:null}function lO(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var Up=lO(function(l){const t=new URLSearchParams;t.append("code",l);for(let n=1;n<arguments.length;n++)t.append("v",arguments[n]);throw Error(`Minified Lexical error #${l}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function rw({hasCellMerge:l=!0,hasCellBackgroundColor:t=!0,hasTabHandler:n=!0}){const[e]=xn();return he.useEffect(()=>(e.hasNodes([xs,is,Cl])||Up(10),br(e.registerCommand(W2,({columns:s,rows:r,includeHeaders:o})=>{const a=Rm(Number(r),Number(s),o);xl(a);const c=a.getFirstDescendant();return Jt(c)&&c.select(),!0},Tn),e.registerNodeTransform(xs,s=>{const[r]=n1(s,null,null),o=r.reduce((a,c)=>Math.max(a,c.length),0);for(let a=0;a<r.length;++a){const c=r[a].length;if(c===o)continue;const i=r[a][c-1].cell;for(let u=c;u<o;++u){const f=Si(0);f.append(En()),i!==null?i.insertAfter(f):mb(i,f)}}}))),[e]),he.useEffect(()=>{const s=new Map,r=a=>{const c=a.getKey(),i=e.getElementByKey(c);if(i&&!s.has(c)){const u=rT(a,i,e,n);s.set(c,u)}};e.getEditorState().read(()=>{const a=o_(xs);for(const c of a)dr(c)&&r(c)});const o=e.registerMutationListener(xs,a=>{for(const[c,i]of a)if(i==="created")e.getEditorState().read(()=>{const u=Rn(c);dr(u)&&r(u)});else if(i==="destroyed"){const u=s.get(c);u!==void 0&&(u.removeListeners(),s.delete(c))}});return()=>{o();for(const[,a]of s)a.removeListeners()}},[e,n]),he.useEffect(()=>{if(!l)return e.registerNodeTransform(is,s=>{if(s.getColSpan()>1||s.getRowSpan()>1){const[,,r]=Ao(s),[o]=ss(r,s,s),a=o.length,c=o[0].length;let i=r.getFirstChild();Rr(i)||Up(175);const u=[];for(let f=0;f<a;f++){f!==0&&(i=i.getNextSibling(),Rr(i)||Up(175));let d=null;for(let p=0;p<c;p++){const h=o[f][p],m=h.cell;if(h.startRow===f&&h.startColumn===p)d=m,u.push(m);else if(m.getColSpan()>1||m.getRowSpan()>1){vn(m)||Up(176);const g=Si(m.__headerState);d!==null?d.insertAfter(g):mb(i,g)}}}for(const f of u)f.setColSpan(1),f.setRowSpan(1)}})},[e,l]),he.useEffect(()=>{if(!t)return e.registerNodeTransform(is,s=>{s.getBackgroundColor()!==null&&s.setBackgroundColor(null)})},[e,t,l]),null}function cO(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var uO=cO(function(l){const t=new URLSearchParams;t.append("code",l);for(let n=1;n<arguments.length;n++)t.append("v",arguments[n]);throw Error(`Minified Lexical error #${l}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function ow(l,t=n=>n){return n=>{const e=l.exec(n);return e===null?null:{index:e.index,length:e[0].length,text:e[0],url:t(e[0])}}}function iw(l,t){for(let n=0;n<t.length;n++){const e=t[n](l);if(e)return e}return null}const dO=/[.,;\s]/;function Hp(l){return dO.test(l)}function sw(l){return Hp(l[l.length-1])}function ay(l){return Hp(l[0])}function aw(l){let t=l.getPreviousSibling();return Tt(t)&&(t=t.getLastDescendant()),t===null||_s(t)||Jt(t)&&sw(t.getTextContent())}function lw(l){let t=l.getNextSibling();return Tt(t)&&(t=t.getFirstDescendant()),t===null||_s(t)||Jt(t)&&ay(t.getTextContent())}function fO(l,t,n,e){return(l>0?Hp(n[l-1]):aw(e[0]))?t<n.length?Hp(n[t]):lw(e[e.length-1]):!1}function pO(l,t,n){const e=[],s=[],r=[];let o=0,a=0;const c=[...l];for(;c.length>0;){const i=c[0],u=i.getTextContent().length,f=a;a+u<=t?(e.push(i),o+=u):f>=n?r.push(i):s.push(i),a+=u,c.shift()}return[o,e,s,r]}function hO(l,t,n,e){const s=Nm(e.url,e.attributes);if(l.length===1){let r,o=l[0];t===0?[r,o]=o.splitText(n):[,r,o]=o.splitText(t,n);const a=ir(e.text);return a.setFormat(r.getFormat()),a.setDetail(r.getDetail()),a.setStyle(r.getStyle()),s.append(a),r.replace(s),o}if(l.length>1){const r=l[0];let o,a=r.getTextContent().length;t===0?o=r:[,o]=r.splitText(t);const c=[];let i;for(let p=1;p<l.length;p++){const h=l[p],m=h.getTextContent().length,g=a;if(g<n)if(a+m<=n)c.push(h);else{const[_,v]=h.splitText(n-g);c.push(_),i=v}a+=m}const u=Ot(),f=u?u.getNodes().find(Jt):void 0,d=ir(o.getTextContent());return d.setFormat(o.getFormat()),d.setDetail(o.getDetail()),d.setStyle(o.getStyle()),s.append(d,...c),f&&f===o&&(Ct(u)?d.select(u.anchor.offset,u.focus.offset):fr(u)&&d.select(0,d.getTextContent().length)),o.replace(s),i}}function ly(l,t,n){const e=l.getChildren(),s=e.length;for(let c=0;c<s;c++){const i=e[c];if(!Jt(i)||!i.isSimpleText())return $p(l),void n(null,l.getURL())}const r=l.getTextContent(),o=iw(r,t);if(o===null||o.text!==r||!aw(l)||!lw(l))return $p(l),void n(null,l.getURL());const a=l.getURL();if(a!==o.url&&(l.setURL(o.url),n(o.url,a)),o.attributes){const c=l.getRel();c!==o.attributes.rel&&(l.setRel(o.attributes.rel||null),n(o.attributes.rel||null,c));const i=l.getTarget();i!==o.attributes.target&&(l.setTarget(o.attributes.target||null),n(o.attributes.target||null,i))}}function $p(l){const t=l.getChildren();for(let n=t.length-1;n>=0;n--)l.insertAfter(t[n]);return l.remove(),t.map(n=>n.getLatest())}function gO(l,t,n){he.useEffect(()=>{l.hasNodes([ud])||uO(77);const e=(s,r)=>{n&&n(s,r)};return br(l.registerNodeTransform(no,s=>{const r=s.getParentOrThrow(),o=s.getPreviousSibling();if(Sc(r)&&!r.getIsUnlinked())ly(r,t,e);else if(!ei(r)){if(s.isSimpleText()&&(ay(s.getTextContent())||!Sc(o))){const a=function(c){const i=[c];let u=c.getNextSibling();for(;u!==null&&Jt(u)&&u.isSimpleText()&&(i.push(u),!/[\s]/.test(u.getTextContent()));)u=u.getNextSibling();return i}(s);(function(c,i,u){let f=[...c];const d=f.map(g=>g.getTextContent()).join("");let p,h=d,m=0;for(;(p=iw(h,i))&&p!==null;){const g=p.index,_=g+p.length;if(fO(m+g,m+_,d,f)){const[v,,b,E]=pO(f,m+g,m+_),S=hO(b,m+g-v,m+_-v,p);f=S?[S,...E]:E,u(p.url,null),m=0}else m+=_;h=h.substring(_)}})(a,t,e)}(function(a,c,i){const u=a.getPreviousSibling(),f=a.getNextSibling(),d=a.getTextContent();!Sc(u)||u.getIsUnlinked()||ay(d)&&!/^\.[a-zA-Z0-9]{1,}/.test(d)||(u.append(a),ly(u,c,i),i(null,u.getURL())),!Sc(f)||f.getIsUnlinked()||sw(d)||($p(f),ly(f,c,i),i(null,f.getURL()))})(s,t,e)}}),l.registerCommand(Pa,s=>{const r=Ot();return s!==null||!Ct(r)||r.extract().forEach(o=>{const a=o.getParent();if(Sc(a))return a.setIsUnlinked(!a.getIsUnlinked()),a.markDirty(),!0}),!1},Gn))},[l,t,n])}function mO({matchers:l,onChange:t}){const[n]=xn();return gO(n,l,t),null}const yO=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/,vO=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/,_O=[ow(yO,l=>l.startsWith("http")?l:`https://${l}`),ow(vO,l=>`mailto:${l}`)];function cw(){return ce.jsx(mO,{matchers:_O})}function bO({accept:l,label:t,onChange:n,"data-test-id":e}){return ce.jsxs("div",{className:"Input__wrapper",children:[ce.jsx("label",{className:"Input__label",children:t}),ce.jsx("input",{type:"file",accept:l,className:"Input__input",onChange:s=>n(s.target.files),"data-test-id":e})]})}const Ic=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",wO=l=>Ic?(l||window).getSelection():null,qp=fo();function xO({onClick:l}){const[t,n]=he.useState(""),[e,s]=he.useState(""),r=t==="",o=a=>{const c=new FileReader;c.onload=function(){return typeof c.result=="string"&&n(c.result),""},a!==null&&c.readAsDataURL(a[0])};return ce.jsxs(ce.Fragment,{children:[ce.jsx(bO,{label:"Image Upload",onChange:o,accept:"image/*","data-test-id":"image-modal-file-upload"}),ce.jsx(Oc,{label:"Alt Text",placeholder:"Descriptive alternative text",onChange:s,value:e,"data-test-id":"image-modal-alt-text-input"}),ce.jsx(Np,{children:ce.jsx(Fi,{"data-test-id":"image-modal-file-upload-btn",disabled:r,onClick:()=>l({altText:e,src:t}),children:"Confirm"})})]})}function SO({activeEditor:l,onClose:t,enableCaptions:n}){const[e,s]=he.useState("file"),r=he.useRef(!1);he.useEffect(()=>{r.current=!1;const a=c=>{r.current=c.altKey};return document.addEventListener("keydown",a),()=>{document.removeEventListener("keydown",a)}},[l]);const o=a=>{l.dispatchCommand(qp,a),console.log("line 202 imageplugin insert image"),t()};return ce.jsx(ce.Fragment,{children:e==="file"&&ce.jsx(xO,{onClick:o})})}function uw(l,t,n,e,s){l.preventDefault();const r=l.clipboardData;if(!r)return!1;const o=r.items;if(!o||o.length===0)return!1;let a=!1,c=!1;const i=o.length>1?o[1]:o[0];let u=1;if(u===1){if(u=2,i.type==="text/html"&&!a){const f=r.getData("text/html"),p=new DOMParser().parseFromString(f,"text/html").querySelector("img");p&&p.src&&(fetch(p.src).then(h=>h.blob()).then(h=>{const m=new File([h],"pasted-image.png",{type:"image/png"});dw(m,t,e)}).catch(h=>console.error("Error fetching pasted image:",h)),a=!0)}else if(i.type.startsWith("image/")&&!a){const f=i.getAsFile();f&&(dw(f,t,e,s),a=!0)}}return!(!a&&!c)}function dw(l,t,n,e){const s=new FileReader;s.onload=()=>{const r=s.result,a={altText:l.name,src:r};t.update(()=>{const u=Mn().getChildren().filter(_=>Or(_)&&_.getChildren().some(v=>v.getTextContent().startsWith("Figure"))).length+1,f=`Figure ${u}:`,d=Mc("Figure",u,e),p=new $o(f,"black",d);p.__captionId=d;const h=kc({...a,figureLabel:f});h.__captionId=d;const m=En();m.setFormat("left");const g=rs();if(m.append(h,g),n){const v=ir("");v.setStyle("color: black; font-style: italic; font-weight: bold;"),m.append(p,v)}if(si([m]),to(h.getParentOrThrow())&&wm(h,En).selectEnd(),n){const _=Mn().getChildren();let v=1;_.forEach(b=>{if(Or(b)){const E=b.getChildren().find(S=>S.getTextContent().startsWith("Figure"));if(E){const S=E.getTextContent(),w=S.indexOf(":"),y=w!==-1?S.slice(w):"",x=`Figure ${v++}${y}`;(Jt(E)||E instanceof $o)&&E.setTextContent(x)}}})}})},s.readAsDataURL(l)}function fw({enableCaptions:l=!0,wpAndTaskId:t}){const[n]=xn(),[e,s]=he.useState("");return he.useEffect(()=>{if(!n.hasNodes([jp]))throw new Error("ImagesPlugin: ImageNode not registered on editor");let r=0;return br(n.registerCommand(qp,o=>{r+=1;const a=Mc("Figure",r,t);if(l){const c=`Figure ${r}:`,i=Mc("Figure",r,t),u=new $o(c,"black",i);u.__captionId=i,u.__captionId=a;const f=kc({...o});f.__captionId=a;const d=En();d.setFormat("left");const p=e.trim()===""?"":e,h=ir(p);h.setStyle(p?"color: black; font-style: italic; font-weight: bold;":"color: gray; font-style: italic; font-weight: normal;"),d.append(f,u,h),si([d]),to(f.getParentOrThrow())&&wm(f,En).selectEnd()}else{const c=kc(o),i=En();i.setFormat("left"),i.append(c),si([i]),to(c.getParentOrThrow())&&wm(c,En).selectEnd()}return n.update(()=>{const i=Mn().getChildren().filter(Or);let u=1;i.forEach(f=>{const d=f.getChildren().find(v=>v.getTextContent().startsWith("Figure"));if(!d)return;const p=d.__captionId,h=f.getChildren().find(Ws),m=h?h.__captionId:void 0,g=p??m??Mc(d.getTextContent(),u,t),_=new $o(`Figure ${u}:`,"black",g);_.__captionId=g,u++})}),!0},Tn),n.registerCommand(sc,o=>CO(o),xi),n.registerCommand(bg,o=>jO(o),Gn),n.registerCommand(Tf,o=>kO(o,n),xi),n.registerCommand(wa,o=>{var c;const a=(c=o.clipboardData)==null?void 0:c.items;return a.length<=2&&a.length?uw(o,n,e,l,t):!1},xi))},[l,n]),null}function Mc(l,t,n){let e=5381;const s=String(t);for(let r=0;r<s.length;r++)e=(e<<5)+e+s.charCodeAt(r);return`${n}-Image-${t}-${Math.abs(e%1e6)}`}const EO="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",pw=document.createElement("img");pw.src=EO;function CO(l){const t=cy();if(!t)return!1;const n=l.dataTransfer;return n?(n.setData("text/plain","_"),n.setDragImage(pw,0,0),n.setData("application/x-lexical-drag",JSON.stringify({data:{altText:t.__altText,caption:t.__caption,height:t.__height,key:t.getKey(),maxWidth:t.__maxWidth,showCaption:t.__showCaption,src:t.__src,width:t.__width},type:"image"})),!0):!1}function jO(l){return cy()?(hw(l)||l.preventDefault(),!0):!1}function kO(l,t){const n=cy();if(!n)return!1;const e=TO(l);if(!e)return!1;if(l.preventDefault(),hw(l)){const s=OO(l);n.remove();const r=yc();s!=null&&r.applyDOMRange(s),Cr(r),t.dispatchCommand(qp,e)}return!0}function cy(){const l=Ot();if(!fr(l))return null;const n=l.getNodes()[0];return Ws(n)?n:null}function TO(l){var s;const t=(s=l.dataTransfer)==null?void 0:s.getData("application/x-lexical-drag");if(!t)return null;const{type:n,data:e}=JSON.parse(t);return n!=="image"?null:e}function hw(l){const t=l.target;return!!(t&&t instanceof HTMLElement&&!t.closest("code, span.editor-image")&&t.parentElement&&t.parentElement.closest("div.ContentEditable__root"))}function OO(l){let t;const n=l.target,e=n==null?null:n.nodeType===9?n.defaultView:n.ownerDocument.defaultView,s=wO(e);if(document.caretRangeFromPoint)t=document.caretRangeFromPoint(l.clientX,l.clientY);else if(l.rangeParent&&s!==null)s.collapse(l.rangeParent,l.rangeOffset||0),t=s.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return t}const gw=["image/","image/heic","image/heif","image/gif","image/webp"];function mw(){const[l]=xn();return he.useEffect(()=>l.registerCommand(iy,t=>((async()=>{const n=await m2(t,[gw].flatMap(e=>e));for(const{file:e,result:s}of n)pb(e,gw)&&l.dispatchCommand(qp,{altText:e.name,src:s})})(),!0),Gn),[l]),null}const NO=/(^|$|[^A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〆〱-〵〻〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ])(congrats|congratulations|gratuluju|gratuluji|gratulujeme|blahopřeju|blahopřeji|blahopřejeme|Til lykke|Tillykke|Glückwunsch|Gratuliere|felicitaciones|enhorabuena|paljon onnea|onnittelut|Félicitations|gratula|gratulálok|gratulálunk|congratulazioni|complimenti|おめでとう|おめでとうございます|축하해|축하해요|gratulerer|Gefeliciteerd|gratulacje|Parabéns|parabéns|felicitações|felicitări|мои поздравления|поздравляем|поздравляю|gratulujem|blahoželám|ยินดีด้วย|ขอแสดงความยินดี|tebrikler|tebrik ederim|恭喜|祝贺你|恭喜你|恭喜|恭喜|baie geluk|veels geluk|অভিনন্দন|Čestitam|Čestitke|Čestitamo|Συγχαρητήρια|Μπράβο|અભિનંદન|badhai|बधाई|अभिनंदन|Честитам|Свака част|hongera|வாழ்த்துகள்|வாழ்த்துக்கள்|అభినందనలు|അഭിനന്ദനങ്ങൾ|Chúc mừng|מזל טוב|mazel tov|mazal tov)(^|$|[^A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〆〱-〵〻〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ])/i;function yw(){const[l]=xn();he.useEffect(()=>{if(!l.hasNodes([Tc]))throw new Error("KeywordsPlugin: KeywordNode not registered on editor")},[l]);const t=he.useCallback(e=>v1(e.getTextContent()),[]),n=he.useCallback(e=>{const s=NO.exec(e);if(s===null)return null;const r=s[2].length,o=s.index+s[1].length;return{end:o+r,start:o}},[]);return R1(n,Tc,t),null}function AO({validateUrl:l}){const[t]=xn();return he.useEffect(()=>{if(!t.hasNodes([xc]))throw new Error("LinkPlugin: LinkNode not registered on editor");return br(t.registerCommand(Pa,n=>{if(n===null)return Am(n),!0;if(typeof n=="string")return!(l!==void 0&&!l(n))&&(Am(n),!0);{const{url:e,target:s,rel:r,title:o}=n;return Am(e,{rel:r,target:s,title:o}),!0}},Gn),l!==void 0?t.registerCommand(wa,n=>{const e=Ot();if(!Ct(e)||e.isCollapsed()||!$s(n,ClipboardEvent))return!1;const s=n;if(s.clipboardData===null)return!1;const r=s.clipboardData.getData("text");return!!l(r)&&!e.getNodes().some(o=>Tt(o))&&(t.dispatchCommand(Pa,r),n.preventDefault(),!0)},Gn):()=>{})},[t,l]),null}const PO=new Set(["http:","https:","mailto:","sms:","tel:"]);function vw(l){try{const t=new URL(l);if(!PO.has(t.protocol))return"about:blank"}catch{return l}return l}const IO=new RegExp(/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%/.\w-_]*)?\??(?:[-+=&;%@.\w_]*)#?(?:[\w]*))?)/);function MO(l){return l==="https://"||IO.test(l)}function uy(){return ce.jsx(AO,{validateUrl:MO})}function DO(l){const t=l.getNodes();return t.length===0?new Set([l.anchor.getNode().getParentOrThrow(),l.focus.getNode().getParentOrThrow()]):new Set(t.map(n=>Tt(n)?n:n.getParentOrThrow()))}function RO(l){const t=Ot();if(!Ct(t))return!1;const n=DO(t);let e=0;for(const s of n)if(sr(s))e=Math.max(Pm(s)+1,e);else if(Vr(s)){const r=s.getParent();if(!sr(r))throw new Error("ListMaxIndentLevelPlugin: A ListItemNode must have a ListNode for a parent.");e=Math.max(Pm(r)+1,e)}return e<=l}function _w({maxDepth:l}){const[t]=xn();return he.useEffect(()=>t.registerCommand(Tv,()=>!RO(l??7),Uo),[t,l]),null}const LO=1,FO=100;let bw=0,ww=!1;function BO(){window.addEventListener("keydown",l=>{l.key==="Tab"&&(bw=l.timeStamp)},!0)}function xw(){const[l]=xn();return he.useEffect(()=>(ww||(BO(),ww=!0),l.registerCommand(wg,t=>{const n=Ot();return Ct(n)&&bw+FO>t.timeStamp&&Cr(n.clone()),!1},LO)),[l]),null}const bR="";function zO({onClose:l,children:t,title:n,closeOnClickOutside:e}){const s=he.useRef(null);return he.useEffect(()=>{s.current!==null&&s.current.focus()},[]),he.useEffect(()=>{let r=null;const o=i=>{i.key==="Escape"&&l()},a=i=>{const u=i.target;s.current!==null&&!s.current.contains(u)&&e&&l()},c=s.current;return c!==null&&(r=c.parentElement,r!==null&&r.addEventListener("click",a)),window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o),r!==null&&(r==null||r.removeEventListener("click",a))}},[e,l]),ce.jsx("div",{className:"Modal__overlay",role:"dialog",children:ce.jsxs("div",{className:"Modal__modal",tabIndex:-1,ref:s,children:[ce.jsx("h2",{className:"Modal__title",children:n}),ce.jsx("button",{className:"Modal__closeButton","aria-label":"Close modal",type:"button",onClick:l,children:"X"}),ce.jsx("div",{className:"Modal__content",children:t})]})})}function UO({onClose:l,children:t,title:n,closeOnClickOutside:e=!1}){return so.createPortal(ce.jsx(zO,{onClose:l,title:n,closeOnClickOutside:e,children:t}),document.body)}function Da(){const[l,t]=he.useState(null),n=he.useCallback(()=>{t(null)},[]),e=he.useMemo(()=>{if(l===null)return null;const{title:r,content:o,closeOnClickOutside:a}=l;return ce.jsx(UO,{onClose:n,title:r,closeOnClickOutside:a,children:o})},[l,n]),s=he.useCallback((r,o,a=!1)=>{t({closeOnClickOutside:a,content:o(n),title:r})},[n]);return[e,s]}const wR="";let dy=!1;const HO=["#d0021b","#f5a623","#f8e71c","#8b572a","#7ed321","#417505","#bd10e0","#9013fe","#4a90e2","#50e3c2","#b8e986","#000000","#4a4a4a","#9b9b9b","#ffffff"],xd=214,Sw=150;function $O({color:l,onChange:t}){const[n,e]=he.useState(Dc("hex",l)),[s,r]=he.useState(l),o=he.useRef(null),a=he.useMemo(()=>({x:n.hsv.s/100*xd,y:(100-n.hsv.v)/100*Sw}),[n.hsv.s,n.hsv.v]),c=he.useMemo(()=>({x:n.hsv.h/360*xd}),[n.hsv]),i=d=>{if(r(d),/^#[0-9A-Fa-f]{6}$/i.test(d)){const p=Dc("hex",d);e(p)}},u=({x:d,y:p})=>{const h={...n.hsv,s:d/xd*100,v:100-p/Sw*100},m=Dc("hsv",h);e(m),r(m.hex)},f=({x:d})=>{const p={...n.hsv,h:d/xd*360},h=Dc("hsv",p);e(h),r(h.hex)};return he.useEffect(()=>{o.current!==null&&t&&(t(n.hex,dy),r(n.hex))},[n,t]),he.useEffect(()=>{if(l===void 0)return;const d=Dc("hex",l);e(d),r(d.hex)},[l]),ce.jsxs("div",{className:"color-picker-wrapper",style:{width:xd},ref:o,children:[ce.jsx(Oc,{label:"Hex",onChange:i,value:s}),ce.jsx("div",{className:"color-picker-basic-color",children:HO.map(d=>ce.jsx("button",{className:d===n.hex?" active":"",style:{backgroundColor:d},onClick:()=>{r(d),e(Dc("hex",d))}},d))}),ce.jsx(Ew,{className:"color-picker-saturation",style:{backgroundColor:`hsl(${n.hsv.h}, 100%, 50%)`},onChange:u,children:ce.jsx("div",{className:"color-picker-saturation_cursor",style:{backgroundColor:n.hex,left:a.x,top:a.y}})}),ce.jsx(Ew,{className:"color-picker-hue",onChange:f,children:ce.jsx("div",{className:"color-picker-hue_cursor",style:{backgroundColor:`hsl(${n.hsv.h}, 100%, 50%)`,left:c.x}})}),ce.jsx("div",{className:"color-picker-color",style:{backgroundColor:n.hex}})]})}function Ew({className:l,style:t,onChange:n,children:e}){const s=he.useRef(null),r=he.useRef(!1),o=c=>{if(s.current){const{current:i}=s,{width:u,height:f,left:d,top:p}=i.getBoundingClientRect(),h=Cw(c.clientX-d,u,0),m=Cw(c.clientY-p,f,0);n({x:h,y:m})}},a=c=>{if(c.button!==0)return;o(c);const i=f=>{r.current=!0,dy=!0,o(f)},u=f=>{r.current&&(dy=!1),document.removeEventListener("mousemove",i,!1),document.removeEventListener("mouseup",u,!1),o(f),r.current=!1};document.addEventListener("mousemove",i,!1),document.addEventListener("mouseup",u,!1)};return ce.jsx("div",{ref:s,className:l,style:t,onMouseDown:a,children:e})}function Cw(l,t,n){return l>t?t:l<n?n:l}function jw(l){if(l.startsWith("#")){if(l.length===4||l.length===5)return l=l.split("").map((t,n)=>n?t+t:"#").join(""),l;if(l.length===7||l.length===9)return l}else{const t=document.createElement("canvas").getContext("2d");if(!t)throw new Error("2d context not supported or canvas already initialized");return t.fillStyle=l,t.fillStyle}return"#000000"}function kw(l){const t=(l.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(n,e,s,r)=>"#"+e+e+s+s+r+r).substring(1).match(/.{2}/g)||[]).map(n=>parseInt(n,16));return{b:t[2],g:t[1],r:t[0]}}function fy({r:l,g:t,b:n}){l/=255,t/=255,n/=255;const e=Math.max(l,t,n),s=e-Math.min(l,t,n),r=s?(e===l?(t-n)/s+(t<n?6:0):e===t?2+(n-l)/s:4+(l-t)/s)*60:0,o=e?s/e*100:0,a=e*100;return{h:r,s:o,v:a}}function qO({h:l,s:t,v:n}){t/=100,n/=100;const e=~~(l/60),s=l/60-e,r=n*(1-t),o=n*(1-t*s),a=n*(1-t*(1-s)),c=e%6,i=Math.round([n,o,r,r,a,n][c]*255),u=Math.round([a,n,n,o,r,r][c]*255);return{b:Math.round([r,r,a,n,n,o][c]*255),g:u,r:i}}function Tw({b:l,g:t,r:n}){return"#"+[n,t,l].map(e=>e.toString(16).padStart(2,"0")).join("")}function Dc(l,t){let n=jw("#121212"),e=kw(n),s=fy(e);return l==="hex"?(n=jw(t),e=kw(n),s=fy(e)):l==="rgb"?(e=t,n=Tw(e),s=fy(e)):l==="hsv"&&(s=t,e=qO(s),n=Tw(e)),{hex:n,hsv:s,rgb:e}}function WO(l,t,...n){if(!l)throw new Error("Internal Lexical error: invariant() is meant to be replaced at compile time. There is no runtime version. Error: "+t)}function py(l){const t=l.getShape();return{columns:t.toX-t.fromX+1,rows:t.toY-t.fromY+1}}function JO(l){const t=l.getNodes(),n=[];let e=null,s=null,r=0;for(let o=0;o<t.length;o++){const a=t[o];if(vn(a)){const c=a.getParentOrThrow();if(WO(Rr(c),"Expected CellNode to have a RowNode parent"),e!==c){if(s!==null&&r!==s)return!1;e!==null&&(s=r),e=c,r=0}const i=a.__colSpan;for(let u=0;u<i;u++)n[r+u]===void 0&&(n[r+u]=0),n[r+u]+=a.__rowSpan;r+=i}}return(s===null||r===s)&&n.every(o=>o===n[0])}function VO(){const l=Ot();if(Ct(l)&&!l.isCollapsed()||ur(l)&&!l.anchor.is(l.focus)||!Ct(l)&&!ur(l))return!1;const[t]=Ao(l.anchor);return t.__colSpan>1||t.__rowSpan>1}function Ow(l){if(l.getChildrenSize()!==1)return!1;const t=l.getFirstChildOrThrow();return!(!Or(t)||!t.isEmpty())}function KO(l){const t=l.getLastDescendant();Jt(t)?t.select():Tt(t)?t.selectEnd():t!==null&&t.selectNext()}function Nw(l){return l.getEditorState().read(()=>{const t=Ot();if(Ct(t)||ur(t)){const[n]=Ao(t.anchor);if(vn(n))return n.getBackgroundColor()}return null})}function GO({onClose:l,tableCellNode:t,setIsMenuOpen:n,contextRef:e,cellMerge:s,showColorPickerModal:r}){const[o]=xn(),a=he.useRef(null),[c,i]=he.useState(t),[u,f]=he.useState({columns:1,rows:1}),[d,p]=he.useState(!1),[h,m]=he.useState(!1),[g,_]=he.useState(()=>Nw(o)||"");he.useEffect(()=>o.registerMutationListener(is,L=>{L.get(c.getKey())==="updated"&&(o.getEditorState().read(()=>{i(c.getLatest())}),_(Nw(o)||""))}),[o,c]),he.useEffect(()=>{o.getEditorState().read(()=>{const L=Ot();if(ur(L)){const O=py(L);f(py(L)),p(JO(L)&&(O.columns>1||O.rows>1))}m(VO())})},[o]),he.useEffect(()=>{const L=e.current,O=a.current,j=o.getRootElement();if(L!=null&&O!=null&&j!=null){const N=j.getBoundingClientRect(),R=L.getBoundingClientRect();O.style.opacity="1";const A=O.getBoundingClientRect(),U=5;let M=R.right+U;if(M+A.width>window.innerWidth||M+A.width>N.right){const V=R.left-A.width-U;M=(V<0?U:V)+window.pageXOffset}O.style.left=`${M+window.pageXOffset}px`;let z=R.top;if(z+A.height>window.innerHeight){const V=R.bottom-A.height;z=(V<0?U:V)+window.pageYOffset}O.style.top=`${z+ +window.pageYOffset}px`}},[e,a,o]),he.useEffect(()=>{function L(O){a.current!=null&&e.current!=null&&!a.current.contains(O.target)&&!e.current.contains(O.target)&&n(!1)}return window.addEventListener("click",L),()=>window.removeEventListener("click",L)},[n,e]);const v=he.useCallback(()=>{o.update(()=>{if(c.isAttached()){const O=Ia(c),j=o.getElementByKey(O.getKey());if(!j)throw new Error("Expected to find tableElement in DOM");const N=oT(j);N!==null&&N.clearHighlight(),O.markDirty(),i(c.getLatest())}Mn().selectStart()})},[o,c]),b=()=>{o.update(()=>{const L=Ot();if(ur(L)){const{columns:O,rows:j}=py(L),N=L.getNodes();let R=null;for(let A=0;A<N.length;A++){const U=N[A];if(vn(U))if(R===null){U.setColSpan(O).setRowSpan(j),R=U;const M=Ow(U);let z;M&&Or(z=U.getFirstChild())&&z.remove()}else vn(R)&&(Ow(U)||R.append(...U.getChildren()),U.remove())}R!==null&&(R.getChildrenSize()===0&&R.append(En()),KO(R)),l()}})},E=()=>{o.update(()=>{eT()})},S=he.useCallback(L=>{o.update(()=>{Y2(L),l()})},[o,l]),w=he.useCallback(L=>{o.update(()=>{for(let O=0;O<u.columns;O++)Z2(L);l()})},[o,l,u.columns]),y=he.useCallback(()=>{o.update(()=>{X2(),l()})},[o,l]),x=he.useCallback(()=>{o.update(()=>{Ia(c).remove(),v(),l()})},[o,c,v,l]),C=he.useCallback(()=>{o.update(()=>{Q2(),l()})},[o,l]),T=he.useCallback(()=>{o.update(()=>{const L=Ia(c),O=t1(c),j=L.getChildren();if(O>=j.length||O<0)throw new Error("Expected table cell to be inside of table row.");const N=j[O];if(!Rr(N))throw new Error("Expected table row");N.getChildren().forEach(R=>{if(!vn(R))throw new Error("Expected table cell");R.toggleHeaderStyle(Ur.ROW)}),v(),l()})},[o,c,v,l]),F=he.useCallback(()=>{o.update(()=>{const L=Ia(c),O=Lm(c),j=L.getChildren(),N=Math.max(...j.map(R=>R.getChildren().length));if(O>=N||O<0)throw new Error("Expected table cell to be inside of table row.");for(let R=0;R<j.length;R++){const A=j[R];if(!Rr(A))throw new Error("Expected table row");const U=A.getChildren();if(O>=U.length)continue;const M=U[O];if(!vn(M))throw new Error("Expected table cell");M.toggleHeaderStyle(Ur.COLUMN)}v(),l()})},[o,c,v,l]),B=he.useCallback(L=>{o.update(()=>{const O=Ot();if(Ct(O)||ur(O)){const[j]=Ao(O.anchor);if(vn(j)&&j.setBackgroundColor(L),ur(O)){const N=O.getNodes();for(let R=0;R<N.length;R++){const A=N[R];vn(A)&&A.setBackgroundColor(L)}}}})},[o]);let D=null;return s&&(d?D=ce.jsx("button",{type:"button",className:"item",onClick:()=>b(),"data-test-id":"table-merge-cells",children:"Merge cells"}):h&&(D=ce.jsx("button",{type:"button",className:"item",onClick:()=>E(),"data-test-id":"table-unmerge-cells",children:"Unmerge cells"}))),so.createPortal(ce.jsxs("div",{className:"dropdown",ref:a,onClick:L=>{L.stopPropagation()},children:[D,ce.jsx("button",{type:"button",className:"item",onClick:()=>r("Cell background color",()=>ce.jsx($O,{color:g,onChange:B})),"data-test-id":"table-background-color",children:ce.jsx("span",{className:"text",children:"Background color"})}),ce.jsx("hr",{}),ce.jsx("button",{type:"button",className:"item",onClick:()=>S(!1),"data-test-id":"table-insert-row-above",children:ce.jsxs("span",{className:"text",children:["Insert"," ",u.rows===1?"row":`${u.rows} rows`," ","above"]})}),ce.jsx("button",{type:"button",className:"item",onClick:()=>S(!0),"data-test-id":"table-insert-row-below",children:ce.jsxs("span",{className:"text",children:["Insert"," ",u.rows===1?"row":`${u.rows} rows`," ","below"]})}),ce.jsx("hr",{}),ce.jsx("button",{type:"button",className:"item",onClick:()=>w(!1),"data-test-id":"table-insert-column-before",children:ce.jsxs("span",{className:"text",children:["Insert"," ",u.columns===1?"column":`${u.columns} columns`," ","left"]})}),ce.jsx("button",{type:"button",className:"item",onClick:()=>w(!0),"data-test-id":"table-insert-column-after",children:ce.jsxs("span",{className:"text",children:["Insert"," ",u.columns===1?"column":`${u.columns} columns`," ","right"]})}),ce.jsx("hr",{}),ce.jsx("button",{type:"button",className:"item",onClick:()=>C(),"data-test-id":"table-delete-columns",children:ce.jsx("span",{className:"text",children:"Delete column"})}),ce.jsx("button",{type:"button",className:"item",onClick:()=>y(),"data-test-id":"table-delete-rows",children:ce.jsx("span",{className:"text",children:"Delete row"})}),ce.jsx("button",{type:"button",className:"item",onClick:()=>x(),"data-test-id":"table-delete",children:ce.jsx("span",{className:"text",children:"Delete table"})}),ce.jsx("hr",{}),ce.jsx("button",{type:"button",className:"item",onClick:()=>T(),children:ce.jsxs("span",{className:"text",children:[(c.__headerState&Ur.ROW)===Ur.ROW?"Remove":"Add"," ","row header"]})}),ce.jsx("button",{type:"button",className:"item",onClick:()=>F(),"data-test-id":"table-column-header",children:ce.jsxs("span",{className:"text",children:[(c.__headerState&Ur.COLUMN)===Ur.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function YO({anchorElem:l,cellMerge:t}){const[n]=xn(),e=he.useRef(null),s=he.useRef(null),[r,o]=he.useState(!1),[a,c]=he.useState(null),[i,u]=Da(),f=he.useCallback(()=>{const p=e.current,h=Ot(),m=window.getSelection(),g=document.activeElement;if(h==null||p==null){c(null);return}const _=n.getRootElement();if(Ct(h)&&_!==null&&m!==null&&_.contains(m.anchorNode)){const v=G2(h.anchor.getNode());if(v==null){c(null);return}if(n.getElementByKey(v.getKey())==null){c(null);return}c(v)}else g||c(null)},[n]);he.useEffect(()=>n.registerUpdateListener(()=>{n.getEditorState().read(()=>{f()})})),he.useEffect(()=>{const p=e.current;if(p!=null&&a!=null){const h=n.getElementByKey(a.getKey());if(h!=null){const m=h.getBoundingClientRect(),g=p.getBoundingClientRect(),_=l.getBoundingClientRect(),v=m.top-_.top+4,b=m.right-g.width-10-_.left;p.style.opacity="1",p.style.transform=`translate(${b}px, ${v}px)`}else p.style.opacity="0",p.style.transform="translate(-10000px, -10000px)"}},[e,a,n,l]);const d=he.useRef(a);return he.useEffect(()=>{d.current!==a&&o(!1),d.current=a},[d,a]),ce.jsx("div",{className:"table-cell-action-button-container",ref:e,children:a!=null&&ce.jsxs(ce.Fragment,{children:[ce.jsx("button",{type:"button",className:"table-cell-action-button chevron-down",onClick:p=>{p.stopPropagation(),o(!r)},ref:s,children:ce.jsx("i",{className:"chevron-down"})}),i,r&&ce.jsx(GO,{contextRef:s,setIsMenuOpen:o,onClose:()=>o(!1),tableCellNode:a,cellMerge:t,showColorPickerModal:u})]})})}function Aw({anchorElem:l=document.body,cellMerge:t=!1}){const n=oy();return so.createPortal(n?ce.jsx(YO,{anchorElem:l,cellMerge:t}):null,l)}const xR="",ZO=33,XO=50;function QO({editor:l}){const t=he.useRef(null),n=he.useRef(null),e=he.useRef(null),s=he.useRef(null),[r,o]=he.useState(null),[a,c]=he.useState(null),[i,u]=he.useState(!1),[f,d]=he.useState(null);he.useEffect(()=>l.registerCommand(bi,S=>{const w=Ot(),y=ur(w);return i!==y&&u(y),!1},xi));const p=he.useCallback(()=>{c(null),t.current=null,d(null),s.current=null,e.current=null},[]);he.useEffect(()=>{const S=w=>{setTimeout(()=>{const y=w.target;if(f){o({x:w.clientX,y:w.clientY});return}if(!(n.current&&n.current.contains(y))&&t.current!==y){t.current=y;const x=zm(y);x&&a!==x?l.update(()=>{const C=po(x.elem);if(!C)return;const T=Ia(C),F=l.getElementByKey(T.getKey());if(!F){console.error("TableCellResizer: Table element not found.");return}t.current=y,e.current=F.getBoundingClientRect(),c(x)}):x==null&&p()}},0)};return document.addEventListener("mousemove",S),()=>{document.removeEventListener("mousemove",S)}},[a,f,l,p]);const h=S=>S==="bottom",m=he.useCallback(S=>{if(!a){console.error("TableCellResizer: Expected active cell.");return}l.update(()=>{const w=po(a.elem);if(!vn(w)){console.error("TableCellResizer: Table cell node not found.");return}const y=Ia(w),x=t1(w),C=y.getChildren();if(x>=C.length||x<0){console.error("Expected table cell to be inside of table row.");return}const T=C[x];if(!Rr(T)){console.error("Expected table row");return}T.setHeight(S)})},[a,l]),g=he.useCallback(S=>{if(!a){console.error("TableCellResizer: Expected active cell.");return}l.update(()=>{const w=po(a.elem);if(!vn(w)){console.error("TableCellResizer: Table cell node not found.");return}const y=Ia(w),x=Lm(w),C=y.getChildren();for(let T=0;T<C.length;T++){const F=C[T];if(!Rr(F)){console.error("Expected table row");return}const B=F.getChildren(),O=B.map(N=>N.getColSpan()).reduce((N,R)=>{const A=N[N.length-1]??0;return N.push(A+R),N},[]).findIndex(N=>N>x);if(O>=B.length||O<0){console.error("Expected table cell to be inside of table row.");return}const j=B[O];if(!vn(j)){console.error("Expected table cell");return}j.setWidth(S)}})},[a,l]),_=he.useCallback(S=>{const w=y=>{if(y.preventDefault(),y.stopPropagation(),!a){console.error("TableCellResizer: Expected active cell.");return}if(s.current){const{x,y:C}=s.current;if(a===null)return;if(h(S)){const T=a.elem.getBoundingClientRect().height,F=Math.abs(y.clientY-C),B=S==="bottom"&&C>y.clientY;m(Math.max(B?T-F:F+T,ZO))}else{const T=getComputedStyle(a.elem);let F=a.elem.clientWidth;F-=parseFloat(T.paddingLeft)+parseFloat(T.paddingRight);const B=Math.abs(y.clientX-x),D=S==="right"&&x>y.clientX;g(Math.max(D?F-B:B+F,XO))}p(),document.removeEventListener("mouseup",w)}};return w},[a,p,g,m]),v=he.useCallback(S=>w=>{if(w.preventDefault(),w.stopPropagation(),!a){console.error("TableCellResizer: Expected active cell.");return}s.current={x:w.clientX,y:w.clientY},o(s.current),d(S),document.addEventListener("mouseup",_(S))},[a,_]),E=he.useCallback(()=>{if(a){const{height:S,width:w,top:y,left:x}=a.elem.getBoundingClientRect(),C={bottom:{backgroundColor:"none",cursor:"row-resize",height:"10px",left:`${window.pageXOffset+x}px`,top:`${window.pageYOffset+y+S}px`,width:`${w}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${S}px`,left:`${window.pageXOffset+x+w}px`,top:`${window.pageYOffset+y}px`,width:"10px"}},T=e.current;return f&&r&&T&&(h(f)?(C[f].left=`${window.pageXOffset+T.left}px`,C[f].top=`${window.pageYOffset+r.y}px`,C[f].height="3px",C[f].width=`${T.width}px`):(C[f].top=`${window.pageYOffset+T.top}px`,C[f].left=`${window.pageXOffset+r.x}px`,C[f].width="3px",C[f].height=`${T.height}px`),C[f].backgroundColor="#adf"),C}return{bottom:null,left:null,right:null,top:null}},[a,f,r])();return ce.jsx("div",{ref:n,children:a!=null&&!i&&ce.jsxs(ce.Fragment,{children:[ce.jsx("div",{className:"TableCellResizer__resizer TableCellResizer__ui",style:E.right||void 0,onMouseDown:v("right")}),ce.jsx("div",{className:"TableCellResizer__resizer TableCellResizer__ui",style:E.bottom||void 0,onMouseDown:v("bottom")})]})})}function Pw({isEditable:l=!0}){const[t]=xn();return he.useMemo(()=>l?so.createPortal(ce.jsx(QO,{editor:t}),document.body):null,[t,l])}const Iw=or.createContext(null),Mw=4;function bo({children:l,className:t,onClick:n,title:e}){const s=he.useRef(null),r=or.useContext(Iw);if(r===null)throw new Error("DropDownItem must be used within a DropDown");const{registerItem:o}=r;return he.useEffect(()=>{s&&s.current&&o(s)},[s,o]),ce.jsx("button",{className:t,onClick:n,ref:s,title:e,type:"button",children:l})}function eN({children:l,dropDownRef:t,onClose:n}){const[e,s]=he.useState(),[r,o]=he.useState(),a=he.useCallback(u=>{s(f=>f?[...f,u]:[u])},[s]),c=u=>{if(!e)return;const f=u.key;["Escape","ArrowUp","ArrowDown","Tab"].includes(f)&&u.preventDefault(),f==="Escape"||f==="Tab"?n():f==="ArrowUp"?o(d=>{if(!d)return e[0];const p=e.indexOf(d)-1;return e[p===-1?e.length-1:p]}):f==="ArrowDown"&&o(d=>d?e[e.indexOf(d)+1]:e[0])},i=he.useMemo(()=>({registerItem:a}),[a]);return he.useEffect(()=>{e&&!r&&o(e[0]),r&&r.current&&r.current.focus()},[e,r]),ce.jsx(Iw.Provider,{value:i,children:ce.jsx("div",{className:"dropdown",ref:t,onKeyDown:c,children:l})})}function Sd({disabled:l=!1,buttonLabel:t,buttonAriaLabel:n,buttonClassName:e,buttonIconClassName:s,children:r,stopCloseOnClickSelf:o}){const a=he.useRef(null),c=he.useRef(null),[i,u]=he.useState(!1),f=()=>{u(!1),c&&c.current&&c.current.focus()};return he.useEffect(()=>{const d=c.current,p=a.current;if(i&&d!==null&&p!==null){const{top:h,left:m}=d.getBoundingClientRect();p.style.top=`${h+d.offsetHeight+Mw}px`,p.style.left=`${Math.min(m,window.innerWidth-p.offsetWidth-20)}px`}},[a,c,i]),he.useEffect(()=>{const d=c.current;if(d!==null&&i){const p=h=>{const m=h.target;o&&a.current&&a.current.contains(m)||d.contains(m)||u(!1)};return document.addEventListener("click",p),()=>{document.removeEventListener("click",p)}}},[a,c,i,o]),he.useEffect(()=>{const d=()=>{if(i){const p=c.current,h=a.current;if(p!==null&&h!==null){const{top:m}=p.getBoundingClientRect(),g=m+p.offsetHeight+Mw;g!==h.getBoundingClientRect().top&&(h.style.top=`${g}px`)}}};return document.addEventListener("scroll",d),()=>{document.removeEventListener("scroll",d)}},[c,a,i]),ce.jsxs(ce.Fragment,{children:[ce.jsxs("button",{type:"button",disabled:l,"aria-label":n||t,className:e,onClick:()=>u(!i),ref:c,children:[s&&ce.jsx("span",{className:s}),t&&ce.jsx("span",{className:"text dropdown-button-text",children:t}),ce.jsx("i",{className:"chevron-down"})]}),i&&so.createPortal(ce.jsx(eN,{dropDownRef:a,onClose:f,children:r}),document.body)]})}function Dw(l){const t=l.anchor,n=l.focus,e=l.anchor.getNode(),s=l.focus.getNode();return e===s?e:l.isBackward()?lb(n)?e:s:lb(t)?e:s}function tN(l){let t=1;(()=>{l.update(()=>{Mn().getChildren().forEach(()=>{Mn().getChildren().filter(a=>{Km(a)&&(t=a.__pageNumber)})}),console.log("page0",t+1);const s=w1(),r=Ot();r!==null&&Ct(r)&&(r.anchor.getNode().getTopLevelElementOrThrow().insertAfter(s),s.selectEnd())})})()}const Rw=8,Lw=72,Ra={h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",paragraph:"Normal"},nN=({selectionFontSize:l,disabled:t,editor:n,blockType:e,styleConfig:s,isenterPressed:r,currentElementClick:o,currentElementSelect:a,wpAndTaskId:c})=>{const[i,u]=or.useState(l),[f,d]=or.useState(e),[p,h]=or.useState("");or.useState([]),or.useState("");const{heading:m}=s||{},g=S=>{S&&S.title&&n.update(()=>{if(n.isEditable()){const w=Ot();w&&vm(w,S)}})},_=S=>{u(S.target.value)},v=()=>{const S=Number(i);if(!isNaN(S)){const w=Math.min(Math.max(S,Rw),Lw);u(String(w)),g({"font-size":`${w}px`})}},b=S=>{var y,x,C,T,F;h(S),n.update(()=>{const B=Ot();Ct(B)&&u2(B,()=>El(S,c))});let w=null;if(m)switch(S){case"h1":w=((y=m.find(B=>B.title==="Heading1"))==null?void 0:y.fontSize)??56;break;case"h2":w=((x=m.find(B=>B.title==="Heading2"))==null?void 0:x.fontSize)??14;break;case"h3":w=((C=m.find(B=>B.title==="Heading3"))==null?void 0:C.fontSize)??12;break;case"h4":w=((T=m.find(B=>B.title==="Heading4"))==null?void 0:T.fontSize)??12;break;case"h5":w=((F=m.find(B=>B.title==="Heading5"))==null?void 0:F.fontSize)??12;break;case"paragraph":w=15;break;default:w=15}u(w),h(S),d(S)},E=()=>{u("15")};return or.useEffect(()=>{E()},[r]),or.useEffect(()=>{const S=()=>{n.update(()=>{const w=Ot();if(w!==null){const x=w.getNodes()[0];if(!Jt(x)){const C=x.getType();C in Ra&&d(C)}}})};return n.registerUpdateListener(S),()=>{n.registerUpdateListener(S)}},[n]),or.useEffect(()=>{var S,w,y,x,C;switch(o.tagName){case"P":d("paragraph"),u("15");break;case"H1":d("h1");const T=((S=s.heading.find(O=>O.title==="Heading1"))==null?void 0:S.fontSize)??"16";u(T);break;case"H2":d("h2");const F=((w=s.heading.find(O=>O.title==="Heading2"))==null?void 0:w.fontSize)??"14";u(F);break;case"H3":d("h3");const B=((y=s.heading.find(O=>O.title==="Heading3"))==null?void 0:y.fontSize)??"12";u(B);break;case"H4":d("h4");const D=((x=s.heading.find(O=>O.title==="Heading4"))==null?void 0:x.fontSize)??"12";u(D);break;case"H5":d("h5");const L=((C=s.heading.find(O=>O.title==="Heading5"))==null?void 0:C.fontSize)??"12";u(L);break;default:d("paragraph"),u("15");break}},[o]),or.useEffect(()=>{var w,y,x,C,T;if(!a){u("15"),d("paragraph");return}switch(a.trim()){case"P":u("15"),d("paragraph");break;case"h1":d("h1");const F=((w=s.heading.find(j=>j.title==="Heading1"))==null?void 0:w.fontSize)??"16";u(F);break;case"h2":d("h2");const B=((y=s.heading.find(j=>j.title==="Heading2"))==null?void 0:y.fontSize)??"14";u(B);break;case"h3":d("h3");const D=((x=s.heading.find(j=>j.title==="Heading3"))==null?void 0:x.fontSize)??"12";u(D);break;case"h4":d("h4");const L=((C=s.heading.find(j=>j.title==="Heading4"))==null?void 0:C.fontSize)??"12";u(L);break;case"h5":d("h5");const O=((T=s.heading.find(j=>j.title==="Heading5"))==null?void 0:T.fontSize)??"12";u(O);break;default:d("paragraph"),u("15");break}},[a]),ce.jsxs(ce.Fragment,{children:[s&&s.heading?ce.jsxs(Sd,{disabled:t,buttonClassName:"toolbar-item block-controls",buttonAriaLabel:"Formatting options for text style",buttonIconClassName:"icon block-type "+f,buttonLabel:Ra[f],children:[ce.jsxs(bo,{className:`item ${f==="paragraph"?"active":""}`,onClick:()=>b("paragraph"),children:[ce.jsx("i",{className:"icon paragraph"}),ce.jsx("span",{className:"text",children:Ra.paragraph})]}),s.heading&&s.heading.find(S=>S.title==="Heading1")&&ce.jsxs(bo,{className:`item ${f==="h1"?"active":""}`,onClick:()=>b("h1"),children:[ce.jsx("i",{className:"icon h1"}),ce.jsx("span",{className:"text",children:Ra.h1})]}),s.heading&&s.heading.find(S=>S.title==="Heading2")&&ce.jsxs(bo,{className:`item ${f==="h2"?"active":""}`,onClick:()=>b("h2"),children:[ce.jsx("i",{className:"icon h2"}),ce.jsx("span",{className:"text",children:Ra.h2})]}),s.heading&&s.heading.find(S=>S.title==="Heading3")&&ce.jsxs(bo,{className:`item ${f==="h3"?"active":""}`,onClick:()=>b("h3"),children:[ce.jsx("i",{className:"icon h3"}),ce.jsx("span",{className:"text",children:Ra.h3})]}),s.heading&&s.heading.find(S=>S.title==="Heading4")&&ce.jsxs(bo,{className:`item ${f==="h4"?"active":""}`,onClick:()=>b("h4"),children:[ce.jsx("i",{className:"icon h4"}),ce.jsx("span",{className:"text",children:Ra.h4})]}),s.heading&&s.heading.find(S=>S.title==="Heading5")&&ce.jsxs(bo,{className:`item ${f==="h5"?"active":""}`,onClick:()=>b("h5"),children:[ce.jsx("i",{className:"icon h5"}),ce.jsx("span",{className:"text",children:Ra.h5})]})]}):"",ce.jsx("input",{style:{width:"60px"},title:"Font Size",type:"text",value:i,disabled:t,readOnly:!0,className:"toolbar-item font-size-input input-font-size-value",min:Rw,max:Lw,onChange:_,onBlur:v})]})},rN=Ic&&"documentMode"in document?document.documentMode:null,La=Ic&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);Ic&&"InputEvent"in window&&!rN&&"getTargetRanges"in new window.InputEvent("input");const oN="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPg0KPHN2ZyB3aWR0aD0iODAwcHgiIGhlaWdodD0iODAwcHgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCjxwYXRoIGQ9Ik0xMi41NTM1IDE2LjUwNjFDMTIuNDExNCAxNi42NjE1IDEyLjIxMDYgMTYuNzUgMTIgMTYuNzVDMTEuNzg5NCAxNi43NSAxMS41ODg2IDE2LjY2MTUgMTEuNDQ2NSAxNi41MDYxTDcuNDQ2NDggMTIuMTMxMUM3LjE2Njk4IDExLjgyNTQgNy4xODgyMiAxMS4zNTEgNy40OTM5MiAxMS4wNzE1QzcuNzk5NjMgMTAuNzkyIDguMjc0MDIgMTAuODEzMiA4LjU1MzUyIDExLjExODlMMTEuMjUgMTQuMDY4MlYzQzExLjI1IDIuNTg1NzkgMTEuNTg1OCAyLjI1IDEyIDIuMjVDMTIuNDE0MiAyLjI1IDEyLjc1IDIuNTg1NzkgMTIuNzUgM1YxNC4wNjgyTDE1LjQ0NjUgMTEuMTE4OUMxNS43MjYgMTAuODEzMiAxNi4yMDA0IDEwLjc5MiAxNi41MDYxIDExLjA3MTVDMTYuODExOCAxMS4zNTEgMTYuODMzIDExLjgyNTQgMTYuNTUzNSAxMi4xMzExTDEyLjU1MzUgMTYuNTA2MVoiIGZpbGw9IiMxQzI3NEMiLz4NCjxwYXRoIGQ9Ik0zLjc1IDE1QzMuNzUgMTQuNTg1OCAzLjQxNDIyIDE0LjI1IDMgMTQuMjVDMi41ODU3OSAxNC4yNSAyLjI1IDE0LjU4NTggMi4yNSAxNVYxNS4wNTQ5QzIuMjQ5OTggMTYuNDIyNSAyLjI0OTk2IDE3LjUyNDggMi4zNjY1MiAxOC4zOTE4QzIuNDg3NTQgMTkuMjkxOSAyLjc0NjQzIDIwLjA0OTcgMy4zNDgzNSAyMC42NTE2QzMuOTUwMjcgMjEuMjUzNiA0LjcwODE0IDIxLjUxMjUgNS42MDgyNSAyMS42MzM1QzYuNDc1MjIgMjEuNzUgNy41Nzc1NCAyMS43NSA4Ljk0NTEzIDIxLjc1SDE1LjA1NDlDMTYuNDIyNSAyMS43NSAxNy41MjQ4IDIxLjc1IDE4LjM5MTggMjEuNjMzNUMxOS4yOTE5IDIxLjUxMjUgMjAuMDQ5NyAyMS4yNTM2IDIwLjY1MTcgMjAuNjUxNkMyMS4yNTM2IDIwLjA0OTcgMjEuNTEyNSAxOS4yOTE5IDIxLjYzMzUgMTguMzkxOEMyMS43NSAxNy41MjQ4IDIxLjc1IDE2LjQyMjUgMjEuNzUgMTUuMDU0OVYxNUMyMS43NSAxNC41ODU4IDIxLjQxNDIgMTQuMjUgMjEgMTQuMjVDMjAuNTg1OCAxNC4yNSAyMC4yNSAxNC41ODU4IDIwLjI1IDE1QzIwLjI1IDE2LjQzNTQgMjAuMjQ4NCAxNy40MzY1IDIwLjE0NjkgMTguMTkxOUMyMC4wNDgyIDE4LjkyNTcgMTkuODY3OCAxOS4zMTQyIDE5LjU5MSAxOS41OTFDMTkuMzE0MiAxOS44Njc4IDE4LjkyNTcgMjAuMDQ4MiAxOC4xOTE5IDIwLjE0NjlDMTcuNDM2NSAyMC4yNDg0IDE2LjQzNTQgMjAuMjUgMTUgMjAuMjVIOUM3LjU2NDU5IDIwLjI1IDYuNTYzNDcgMjAuMjQ4NCA1LjgwODEyIDIwLjE0NjlDNS4wNzQzNSAyMC4wNDgyIDQuNjg1NzcgMTkuODY3OCA0LjQwOTAxIDE5LjU5MUM0LjEzMjI1IDE5LjMxNDIgMy45NTE4IDE4LjkyNTcgMy44NTMxNSAxOC4xOTE5QzMuNzUxNTkgMTcuNDM2NSAzLjc1IDE2LjQzNTQgMy43NSAxNVoiIGZpbGw9IiMxQzI3NEMiLz4NCjwvc3ZnPg==";var Fw={exports:{}};(function(l,t){(function(n,e){e()})(ya,function(){function n(i,u){return typeof u>"u"?u={autoBom:!1}:typeof u!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),u={autoBom:!u}),u.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(i.type)?new Blob(["\uFEFF",i],{type:i.type}):i}function e(i,u,f){var d=new XMLHttpRequest;d.open("GET",i),d.responseType="blob",d.onload=function(){c(d.response,u,f)},d.onerror=function(){console.error("could not download file")},d.send()}function s(i){var u=new XMLHttpRequest;u.open("HEAD",i,!1);try{u.send()}catch{}return 200<=u.status&&299>=u.status}function r(i){try{i.dispatchEvent(new MouseEvent("click"))}catch{var u=document.createEvent("MouseEvents");u.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),i.dispatchEvent(u)}}var o=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof ya=="object"&&ya.global===ya?ya:void 0,a=o.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),c=o.saveAs||(typeof window!="object"||window!==o?function(){}:"download"in HTMLAnchorElement.prototype&&!a?function(i,u,f){var d=o.URL||o.webkitURL,p=document.createElement("a");u=u||i.name||"download",p.download=u,p.rel="noopener",typeof i=="string"?(p.href=i,p.origin===location.origin?r(p):s(p.href)?e(i,u,f):r(p,p.target="_blank")):(p.href=d.createObjectURL(i),setTimeout(function(){d.revokeObjectURL(p.href)},4e4),setTimeout(function(){r(p)},0))}:"msSaveOrOpenBlob"in navigator?function(i,u,f){if(u=u||i.name||"download",typeof i!="string")navigator.msSaveOrOpenBlob(n(i,f),u);else if(s(i))e(i,u,f);else{var d=document.createElement("a");d.href=i,d.target="_blank",setTimeout(function(){r(d)})}}:function(i,u,f,d){if(d=d||open("","_blank"),d&&(d.document.title=d.document.body.innerText="downloading..."),typeof i=="string")return e(i,u,f);var p=i.type==="application/octet-stream",h=/constructor/i.test(o.HTMLElement)||o.safari,m=/CriOS\/[\d]+/.test(navigator.userAgent);if((m||p&&h||a)&&typeof FileReader<"u"){var g=new FileReader;g.onloadend=function(){var b=g.result;b=m?b:b.replace(/^data:[^;]*;/,"data:attachment/file;"),d?d.location.href=b:location=b,d=null},g.readAsDataURL(i)}else{var _=o.URL||o.webkitURL,v=_.createObjectURL(i);d?d.location=v:location.href=v,d=null,setTimeout(function(){_.revokeObjectURL(v)},4e4)}});o.saveAs=c.saveAs=c,l.exports=c})})(Fw);var iN=Fw.exports;function sN(l){const t=document.createElement("div");return t.innerHTML=l,t.querySelectorAll("*").forEach(e=>{let s="";if(e.classList.contains("PlaygroundEditorTheme__textItalic")&&e.classList.contains("PlaygroundEditorTheme__textStrikethrough")){s+="text-decoration: line-through; ";const r=document.createElement("span");r.style.cssText=s.trim();const o=document.createElement("i");o.innerHTML=e.innerHTML,r.appendChild(o),e.innerHTML="",e.appendChild(r)}else if(e.classList.contains("PlaygroundEditorTheme__textBold")&&e.classList.contains("PlaygroundEditorTheme__textItalic")&&e.classList.contains("PlaygroundEditorTheme__textStrikethrough")){s+="text-decoration: line-through; ";const r=document.createElement("span");r.style.cssText=s.trim();const o=document.createElement("i"),a=document.createElement("strong");a.innerHTML=e.innerHTML,o.appendChild(a),r.appendChild(o),e.innerHTML="",e.appendChild(r)}else{if(e.classList.contains("PlaygroundEditorTheme__textStrikethrough")&&(s+="text-decoration: line-through; "),e.classList.contains("PlaygroundEditorTheme__textUnderlineStrikethrough")&&(s+="text-decoration: line-through underline; "),e.classList.contains("PlaygroundEditorTheme__textBold")){const r=document.createElement("strong");r.innerHTML=e.innerHTML,e.innerHTML="",e.appendChild(r)}if(e.classList.contains("PlaygroundEditorTheme__textItalic")){const r=document.createElement("i");r.innerHTML=e.innerHTML,e.innerHTML="",e.appendChild(r)}if(e.classList.contains("PlaygroundEditorTheme__textUnderline")){const r=document.createElement("u");r.innerHTML=e.innerHTML,e.innerHTML="",e.appendChild(r)}if(s){const r=document.createElement("span");r.style.cssText=s.trim(),r.innerHTML=e.innerHTML,e.innerHTML="",e.appendChild(r)}}}),t.innerHTML}function aN(l){const t=document.createElement("div");t.innerHTML=l;const n=t.querySelectorAll(".PlaygroundEditorTheme__table");return n.length===0?l:(n.forEach(e=>{e.style.width="100%",e.style.borderCollapse="collapse",e.style.border="1px solid black",e.style.fontFamily="Calibri, sans-serif",e.style.fontSize="11pt",e.querySelectorAll("tr").forEach((r,o)=>{r.style.border="1px solid black";const a=r.querySelectorAll("td, th"),i=100/a.length+"%";a.forEach(u=>{u.style.width=i,u.style.height="20px",u.style.border="1px solid black",u.style.padding="5px 8px",u.style.textAlign="left",u.style.verticalAlign="middle",u.innerHTML.trim()||(u.innerHTML="&nbsp;"),u.querySelectorAll(".PlaygroundEditorTheme__textUnderline").forEach(p=>{p.style.textDecoration="underline"}),u.querySelectorAll(".PlaygroundEditorTheme__textStrikethrough").forEach(p=>{p.style.textDecoration="line-through"}),u.classList.contains("PlaygroundEditorTheme__tableCellHeader")&&(u.style.fontWeight="bold",u.style.backgroundColor="#d9d9d9",u.style.textAlign="center")})})}),t.innerHTML)}function Bw(l){return l=l.replace(/<br\s*\/?>/g,""),l.includes("Crop")&&(l=l.replace(/Crop/g,"")),l}function zw(l){const n=new DOMParser().parseFromString(l,"text/html"),e=s=>{if(!s.length)return;const[r,...o]=s,a=r.children.length===1&&r.children[0].tagName==="P";if(r.querySelector("table")!==null){const i=r.querySelectorAll("table"),u=document.createDocumentFragment();i.forEach(f=>u.appendChild(f.cloneNode(!0))),r.replaceWith(u)}else if(a){const i=r.children[0],u=i.innerHTML.trim();u===""||/^<br\s*\/?>$/i.test(u)?r.replaceWith(i):i.replaceWith(...i.childNodes)}e(o)};return e(Array.from(n.querySelectorAll("h1, h2, h3, h4, h5, h6"))),n.body.innerHTML}const lN=async(l,t,n,e)=>{await cN({title:t,parsedHtmlString:e,styleConfig:n})},cN=async({title:l,parsedHtmlString:t,styleConfig:n})=>{const e='<!DOCTYPE html><html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head><meta charset="UTF-8"><title>Document</title></head><body>',s="</body></html>",r=t||Tl(".ContentEditable__root").html(),o=aN(r),a=sN(o),c=await uN(a,n),i=e+c+s,u=new Blob([i],{type:"application/msword"});iN.saveAs(u,`${l||"Exported"}.doc`)};async function uN(l,t){const e=new DOMParser().parseFromString(l,"text/html"),{heading:s}=t,r={h1:s.find(a=>a.title==="Heading1")||{},h2:s.find(a=>a.title==="Heading2")||{},h3:s.find(a=>a.title==="Heading3")||{},h4:s.find(a=>a.title==="Heading4")||{},h5:s.find(a=>a.title==="Heading5")||{}};return Object.entries(r).forEach(([a,c])=>{e.querySelectorAll(a).forEach(u=>{let f="";c.fontColor&&(f+=`color: ${c.fontColor};`),c.fontFamily&&(f+=`font-family: ${c.fontFamily};`),c.fontSize&&(f+=`font-size: ${c.fontSize}px;`),c.bold==="Yes"&&(f+="font-weight: bold;"),c.italic==="Yes"&&(f+="font-style: italic;"),c.lineSpacing&&(f+=`line-height: ${c.lineSpacing};`),c.alignment&&(f+=`text-align: ${c.alignment.toLowerCase()};`),(a==="h2"||a==="h3")&&(f+="text-transform: uppercase;"),u.style.cssText+=f})}),await fN(e.body.innerHTML)}function dN(){const l=document.createElement("div");return l.style.position="absolute",l.style.visibility="hidden",l.style.pointerEvents="none",l.style.width="1000px",l.style.zIndex=-1,document.body.appendChild(l),l}async function fN(l){const t=dN();t.innerHTML=l;const n=t.querySelectorAll("img"),e=Array.from(n).map(r=>new Promise(o=>{r.complete?o():(r.onload=o,r.onerror=o)}));await Promise.all(e),n.forEach(r=>{const o=r.offsetWidth,a=r.offsetHeight,c=600;o>c?(r.setAttribute("width",c),r.removeAttribute("height"),r.style.width=`${c}px`,r.style.height="auto"):(r.setAttribute("width",o),r.setAttribute("height",a),r.style.width=`${o}px`,r.style.height=`${a}px`)});const s=t.innerHTML;return document.body.removeChild(t),s}const pN="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iY3VycmVudENvbG9yIiBjbGFzcz0iYmkgYmktbGlzdC11bCI+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNSAxMS41YS41LjUgMCAwIDEgLjUtLjVoOWEuNS41IDAgMCAxIDAgMWgtOWEuNS41IDAgMCAxLS41LS41em0wLTRhLjUuNSAwIDAgMSAuNS0uNWg5YS41LjUgMCAwIDEgMCAxaC05YS41LjUgMCAwIDEtLjUtLjV6bTAtNGEuNS41IDAgMCAxIC41LS41aDlhLjUuNSAwIDAgMSAwIDFoLTlhLjUuNSAwIDAgMS0uNS0uNXptLTMgMWExIDEgMCAxIDAgMC0yIDEgMSAwIDAgMCAwIDJ6bTAgNGExIDEgMCAxIDAgMC0yIDEgMSAwIDAgMCAwIDJ6bTAgNGExIDEgMCAxIDAgMC0yIDEgMSAwIDAgMCAwIDJ6Ii8+PC9zdmc+",hN="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iY3VycmVudENvbG9yIiBjbGFzcz0iYmkgYmktbGlzdC1vbCI+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNSAxMS41YS41LjUgMCAwIDEgLjUtLjVoOWEuNS41IDAgMCAxIDAgMWgtOWEuNS41IDAgMCAxLS41LS41em0wLTRhLjUuNSAwIDAgMSAuNS0uNWg5YS41LjUgMCAwIDEgMCAxaC05YS41LjUgMCAwIDEtLjUtLjV6bTAtNGEuNS41IDAgMCAxIC41LS41aDlhLjUuNSAwIDAgMSAwIDFoLTlhLjUuNSAwIDAgMS0uNS0uNXoiLz48cGF0aCBkPSJNMS43MTMgMTEuODY1di0uNDc0SDJjLjIxNyAwIC4zNjMtLjEzNy4zNjMtLjMxNyAwLS4xODUtLjE1OC0uMzEtLjM2MS0uMzEtLjIyMyAwLS4zNjcuMTUyLS4zNzMuMzFoLS41OWMuMDE2LS40NjcuMzczLS43ODcuOTg2LS43ODcuNTg4LS4wMDIuOTU0LjI5MS45NTcuNzAzYS41OTUuNTk1IDAgMCAxLS40OTIuNTk0di4wMzNhLjYxNS42MTUgMCAwIDEgLjU2OS42MzFjLjAwMy41MzMtLjUwMi44LTEuMDUxLjgtLjY1NiAwLTEtLjM3LTEuMDA4LS43OTRoLjU4MmMuMDA4LjE3OC4xODYuMzA2LjQyMi4zMDkuMjU0IDAgLjQyNC0uMTQ1LjQyMi0uMzUtLjAwMi0uMTk1LS4xNTUtLjM0OC0uNDE0LS4zNDhoLS4zem0tLjAwNC00LjY5OWgtLjYwNHYtLjAzNWMwLS40MDguMjk1LS44NDQuOTU4LS44NDQuNTgzIDAgLjk2LjMyNi45Ni43NTYgMCAuMzg5LS4yNTcuNjE3LS40NzYuODQ4bC0uNTM3LjU3MnYuMDNoMS4wNTRWOUgxLjE0M3YtLjM5NWwuOTU3LS45OWMuMTM4LS4xNDIuMjkzLS4zMDQuMjkzLS41MDggMC0uMTgtLjE0Ny0uMzItLjM0Mi0uMzJhLjMzLjMzIDAgMCAwLS4zNDIuMzM4di4wNDF6TTIuNTY0IDVoLS42MzVWMi45MjRoLS4wMzFsLS41OTguNDJ2LS41NjdsLjYyOS0uNDQzaC42MzVWNXoiLz48L3N2Zz4=",gN=({onlUser:l,collabApiKey:t,htmlPasteModalOpen:n,sethtmlPasteModalOpen:e,passedContent:s,onPaste:r,source:o})=>{he.useRef(null);const[a,c]=he.useState(""),[i,u]=he.useState(""),[f]=xn(),d=he.useRef();he.useRef(null);const p=()=>{u({root:{type:"root",version:1,children:[{children:[],direction:"ltr",format:"",indent:0,type:"text",version:1}],direction:"ltr",format:"",indent:0}}),c("")};he.useEffect(()=>{p()},[]);const h=()=>{e(!1),c(" "),p()},m=C=>{const T=/display:\s*([^;]+);/,F=C.match(T);if(F)return F[1]};function g(){const[C]=xn(),T=(B,D)=>{C.update(()=>{const L=En(),O=ir(`${B}`);O.setStyle(D.style),O.setFormat(D.format),L.append(O),C.getRootElement()&&B&&B.length>0&&(C.getEditorState().read(()=>Mn()),xl(L))})},F=()=>{let B=y(a);b(a),B.root.children.map((D,L)=>{if(D&&D.text&&D.text.trim("")&&D.text.trim("").length>1&&D.style&&D.style.length>10&&m(D.style)==="block"){let O=D.order.split("_")[1];setTimeout(()=>{T(D.text.trim(""),D)},O*2)}}),h()};return ce.jsx("button",{onClick:F,ref:d,style:{display:"none"}})}function _(C,T){const F=/font-weight:\s*([a-zA-Z0-9\-]+);/,B=/text-decoration:\s*([^;]+?)(?=\s*;|\s*$)/,D=/font-style:\s*([a-zA-Z0-9\-]+);/,L=/font-size:\s*([\d.]+(?:px|pt|em|rem|%)?)/,O=/color:\s*([^;]+)/,j=C.match(F),N=C.match(B),R=C.match(D),A=C.match(L),U=C.match(O),M=j?j[1]:null,z=N?N[1]:null,V=R?R[1]:null,K=A?A[1]:null,P=U?U[1]:null;let W={"font-weight":M&&M!==null?M:"none","text-decoration":z&&z!==null?z:"none","font-style":V&&V!==null?V:"none","font-size":"none",display:["span","table","tbody","tr","td"].includes(T)?"block":"none",color:P&&P!=="transparent"?P:"black"};function H(Z){return Object.entries(Z).map(([Q,G])=>`${Q}: ${G};`).join(" ")}return{cssString:H(W),fontSize:K&&K!==null?K:"none",fontWeight:M&&M!==null?M:"none",fontStyle:V&&V!==null?V:"none",textDecoration:z&&z!==null?z:"none"}}const v=(C,T)=>{const F=new RegExp(`${T}:\\s*([^;]+)`),B=C.match(F);return B?B[1].trim():null},b=C=>{const T=new DOMParser,F=w(C),D=T.parseFromString(F,"text/html").querySelectorAll("img");Array.from(D).map(L=>{const N=L.getAttribute("id").split("_")[1]*2;setTimeout(()=>{f.update(()=>{const R=L.src,A=L.textContent,M=kc({src:R,altText:A});Mn(),xl(M)})},N)})};function E(C,T){const F=Array.from(C.querySelectorAll("tr")),L=C.getAttribute("id").split("_")[1]*2;setTimeout(()=>{T.update(()=>{const O=Sp();F.forEach(N=>{const R=jl();Array.from(N.querySelectorAll("td")).forEach(U=>{const M=Si();let K=Array.from(U.querySelectorAll("span")).map(Q=>{const G=Q.getAttribute("style")||"";return{text:Q.innerText.trim(),style:G}}).map(Q=>Q.style).filter(Q=>Q).map(Q=>Q.split(";").map(G=>G.trim()).filter(G=>!G.startsWith("font-family")).filter(G=>!G.startsWith("font-size")).filter(G=>!G.startsWith("border")).filter(G=>!G.startsWith("width")).join("; ")).join("; ");const P=v(K,"font-weight"),q=v(K,"font-style"),W=v(K,"text-decoration");K=`${K}; font-weight: ${P}`,K=`${K}; font-style: ${q}`,K=`${K}; color: black`,K=`${K}; text-decoration: ${W}`;const H=ir(U.innerText.trim()),Y=S(P,q,W);H.setFormat(Y),K&&H.setStyle(K);const Z=En();Z.append(H),M.append(Z),R.append(M)}),O.append(R)}),Mn()&&xl(O)})},L)}function S(C,T,F){return C==="bold"&&T==="italic"&&F==="underline line-through"?15:F==="underline line-through"?12:T==="italic"&&F==="line-through"?6:T==="italic"&&F==="underline"?11:C==="bold"&&F==="line-through"?5:C==="bold"&&F==="underline"?9:C==="bold"&&T==="italic"?3:C==="bold"?1:T==="italic"?2:F==="underline"?8:F==="line-through"?4:0}function w(C){const F=new DOMParser().parseFromString(C,"text/html");let B=1;function D(L){if(L.nodeType===1){const O=`order_${B++}`;L.setAttribute("data-title",O),L.setAttribute("id",O)}L.childNodes.forEach(O=>D(O))}return D(F.body),F.body.innerHTML}function y(C){const T=new DOMParser,F=w(C),B=T.parseFromString(F,"text/html");B.querySelectorAll("[aria-level]").forEach(U=>{const V=U.getAttribute("id").split("_")[1]*2;setTimeout(()=>{f.update(()=>{const K=El(`${U.getAttribute("aria-level")==="1"?"h1":U.getAttribute("aria-level")==="2"?"h2":U.getAttribute("aria-level")==="3"?"h3":U.getAttribute("aria-level")==="4"?"h4":"h5"}`),P=ir(U.innerText);K.append(P),xl(K)})},V)}),B.querySelectorAll("ul").forEach(U=>{const V=U.getAttribute("id").split("_")[1]*2;setTimeout(()=>{f.update(()=>{const K=Ho("ul"),P=ti(),q=ir(`${U.textContent}`);let Y=Array.from(U.querySelectorAll("span")).map(ee=>{const oe=ee.getAttribute("style")||"";return{text:ee.innerText.trim(),style:oe}}).map(ee=>ee.style).filter(ee=>ee).map(ee=>ee.split(";").map(oe=>oe.trim()).filter(oe=>!oe.startsWith("font-family")).filter(oe=>!oe.startsWith("font-size")).filter(oe=>!oe.startsWith("border")).filter(oe=>!oe.startsWith("width")).join("; ")).join("; ");const Z=v(Y,"font-weight"),Q=v(Y,"font-style"),G=v(Y,"text-decoration");Y=`${Y}; font-weight: ${Z}`,Y=`${Y}; font-style: ${Q}`,Y=`${Y}; color: black`,Y=`${Y}; text-decoration: ${G}`,Y&&q.setStyle(Y),P.append(q),K.append(P),Mn(),xl(K)})},V)}),B.querySelectorAll("ol").forEach(U=>{const V=U.getAttribute("id").split("_")[1]*2;setTimeout(()=>{f.update(()=>{const K=Ho("ol"),P=ti(),q=ir(`${U.textContent}`);let Y=Array.from(U.querySelectorAll("span")).map(oe=>{const de=oe.getAttribute("style")||"";return{text:oe.innerText.trim(),style:de}}).map(oe=>oe.style).filter(oe=>oe).map(oe=>oe.split(";").map(de=>de.trim()).filter(de=>!de.startsWith("font-family")).filter(de=>!de.startsWith("font-size")).filter(de=>!de.startsWith("border")).filter(de=>!de.startsWith("width")).join("; ")).join("; ");const Z=v(Y,"font-weight"),Q=v(Y,"font-style"),G=v(Y,"text-decoration");Y=`${Y}; font-weight: ${Z}`,Y=`${Y}; font-style: ${Q}`,Y=`${Y}; color: black`,Y=`${Y}; text-decoration: ${G}`;let ee=S(Q,Z,G);q.setFormat(ee),Y&&q.setStyle(Y),P.append(q),K.append(P),Mn(),xl(K)})},V)}),B.querySelectorAll("table").forEach(U=>{E(U,f)});const N=B.querySelectorAll("*"),R=Array.from(N).filter(U=>!U.closest("table")).filter(U=>!U.closest("ol")).filter(U=>!U.closest("ul")).map(U=>({elemText:U.innerText,tagName:U.tagName.toLowerCase(),style:U.getAttribute("style")||"",order:U.getAttribute("id")||""}));let A=i;return R.map(U=>{let M=_(U.style,U.tagName);const{cssString:z,fontSize:V,fontWeight:K,textDecoration:P,fontStyle:q,border:W}=M||{};if(U.style&&U.style.length>0&&U.elemText.trim(" ").length&&V!=="none"&&K!==null&&P!==null&&q!==null){let H=K==="bold"&&q==="italic"&&P==="underline line-through"?15:P==="underline line-through"?12:q==="italic"&&P=="line-through"?6:q==="italic"&&P==="underline"?11:K==="bold"&&P==="line-through"?5:K==="bold"&&P==="underline"?9:K==="bold"&&q==="italic"?3:K==="bold"?1:q==="italic"?2:U.style.includes("text-decoration: underline")?8:U.style.includes("text-decoration: line-through")?4:0;A.root.children.push({detail:0,format:H,mode:"normal",style:`${z}`,text:`${U.elemText}`,type:"text",version:1,order:U.order})}}),A}he.useEffect(()=>()=>{c(" ")},[]);const x=()=>{e(!0),setTimeout(()=>{var C;(C=d.current)==null||C.click()},200)};return he.useEffect(C=>{n&&(c(s),x())},[n]),ce.jsx(ce.Fragment,{children:ce.jsx(g,{})})},mN="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPg0KPHN2ZyB3aWR0aD0iODAwcHgiIGhlaWdodD0iODAwcHgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBtaXJyb3ItaW4tcnRsPSJ0cnVlIj4NCiAgPGNpcmNsZSBmaWxsPSIjNDk0YzRlIiBjeD0iMiIgY3k9IjIiIHI9IjIiLz4NCiAgPGNpcmNsZSBmaWxsPSIjNDk0YzRlIiBjeD0iMiIgY3k9IjgiIHI9IjIiLz4NCiAgPGNpcmNsZSBmaWxsPSIjNDk0YzRlIiBjeD0iMiIgY3k9IjIwIiByPSIyIi8+DQogIDxjaXJjbGUgZmlsbD0iIzQ5NGM0ZSIgY3g9IjIiIGN5PSIxNCIgcj0iMiIvPg0KICA8cGF0aCBmaWxsPSIjNDk0YzRlIiBkPSJNMjMuMDAyIDNINy45OThDNy40NDggMyA3IDIuNTUgNyAyLjAwMnYtLjAwNGMwLS41NS40NS0uOTk4Ljk5OC0uOTk4SDIzYy41NSAwIDEgLjQ1IDEgLjk5OFYyYzAgLjU1LS40NSAxLS45OTggMXpNMjMuMDAyIDlINy45OThDNy40NDggOSA3IDguNTUgNyA4LjAwMnYtLjAwNGMwLS41NS40NS0uOTk4Ljk5OC0uOTk4SDIzYy41NSAwIDEgLjQ1IDEgLjk5OFY4YzAgLjU1LS40NSAxLS45OTggMXpNMjMuMDAyIDE1SDcuOTk4Yy0uNTUgMC0uOTk4LS40NS0uOTk4LS45OThWMTRjMC0uNTUuNDUtMSAuOTk4LTFIMjNjLjU1IDAgMSAuNDUgMSAuOTk4VjE0YzAgLjU1LS40NSAxLS45OTggMXpNMjMuMDAyIDIxSDcuOTk4Yy0uNTUgMC0uOTk4LS40NS0uOTk4LS45OThWMjBjMC0uNTUuNDUtMSAuOTk4LTFIMjNjLjU1IDAgMSAuNDUgMSAuOTk4VjIwYzAgLjU1LS40NSAxLS45OTggMXoiLz4NCjwvc3ZnPg==",yN={bullet:"Bulleted List",check:"Check List",code:"Code Block",h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6",number:"Numbered List",paragraph:"Normal",quote:"Quote"};function vN(){const l=[];for(const[t,n]of Object.entries(Tb))l.push([t,n]);return l}const _N=vN(),bN={center:{icon:"center-align",iconRTL:"center-align",name:"Center Align"},end:{icon:"right-align",iconRTL:"left-align",name:"End Align"},justify:{icon:"justify-align",iconRTL:"justify-align",name:"Justify Align"},left:{icon:"left-align",iconRTL:"left-align",name:"Left Align"},right:{icon:"right-align",iconRTL:"right-align",name:"Right Align"},start:{icon:"left-align",iconRTL:"right-align",name:"Start Align"}};function Wp(l){return l?"active dropdown-item-active":""}function Ed(){return ce.jsx("div",{className:"divider"})}function wN({editor:l,value:t,isRTL:n,disabled:e=!1}){const s=bN[t||"left"];return ce.jsxs(Sd,{disabled:e,buttonLabel:s.name,buttonIconClassName:`icon ${n?s.iconRTL:s.icon}`,buttonClassName:"toolbar-item spaced alignment",buttonAriaLabel:"Formatting options for text alignment",children:[ce.jsxs(bo,{onClick:()=>{l.dispatchCommand(ml,"left")},className:"item",children:[ce.jsx("i",{className:"icon left-align"}),ce.jsx("span",{className:"text",children:"Left Align"})]}),ce.jsxs(bo,{onClick:()=>{l.dispatchCommand(ml,"center")},className:"item",children:[ce.jsx("i",{className:"icon center-align"}),ce.jsx("span",{className:"text",children:"Center Align"})]}),ce.jsxs(bo,{onClick:()=>{l.dispatchCommand(ml,"right")},className:"item",children:[ce.jsx("i",{className:"icon right-align"}),ce.jsx("span",{className:"text",children:"Right Align"})]}),ce.jsxs(bo,{onClick:()=>{l.dispatchCommand(ml,"justify")},className:"item",children:[ce.jsx("i",{className:"icon justify-align"}),ce.jsx("span",{className:"text",children:"Justify Align"})]})]})}function Uw({setIsLinkEditMode:l,onlUser:t,styleConfig:n,showComments:e,setShowComments:s,showTabContentBtn:r,setshowTabContentBtn:o,showTabContent:a,parsedHtmlString:c,enableCaptions:i,userOnline:u,wpAndTaskId:f}){const[d]=xn(),[p,h]=he.useState(d),[m,g]=he.useState("paragraph"),[_,v]=he.useState("root"),[b,E]=he.useState(null),[S,w]=he.useState("15px"),[y,x]=he.useState("#000"),[C,T]=he.useState("#fff"),[F,B]=he.useState("Arial"),[D,L]=he.useState("left"),[O,j]=he.useState(!1),[N,R]=he.useState(!1),[A,U]=he.useState(!1),[M,z]=he.useState(!1),[V,K]=he.useState(!1),[P,q]=he.useState(!1),[W,H]=he.useState(!1),[Y,Z]=he.useState(!1),[Q,G]=he.useState(!1),[ee,oe]=he.useState(!1),[de,fe]=Da(),[ne,Se]=he.useState(!1),[we,me]=he.useState(""),[Ee,ue]=he.useState(()=>d.isEditable()),[se,pe]=he.useState(""),[le,ke]=he.useState(""),[Te,je]=he.useState(""),[Me,qe]=he.useState(""),[Re,Le]=he.useState(!0),[Ce,et]=he.useState(!1),Ie=1,Qe=jt=>{jt.key==="Enter"&&je(Bt=>Bt+1)};he.useEffect(()=>(window.addEventListener("keydown",Qe),()=>window.removeEventListener("keydown",Qe)),[]);const st=jt=>{d.update(()=>{const Bt=zw(jt),ft=new DOMParser().parseFromString(Bt,"text/html"),Dt=Ip(d,ft),en=En();si(Dt),si([en])})};he.useEffect(()=>{const jt=d.registerCommand(wa,Bt=>{const Kt=Bt.clipboardData||window.clipboardData,ft=Kt==null?void 0:Kt.getData("text/html"),Dt=Kt==null?void 0:Kt.getData("text/plain");return ft!=null&&ft.includes('<meta http-equiv=Content-Type content="text/html; charset=utf-8">')&&(ft!=null&&ft.includes("microsoft-com"))?(uw(Bt,d,"",i),!1):/^https?:\/\/\S+$/.test(Dt)?(Bt.preventDefault(),d.update(()=>{const en=En(),At=ir(Dt),nn=cd(Dt);nn.append(At),en.append(nn),si([en])}),!0):ft&&!(ft!=null&&ft.includes("Outline"))&&!(ft!=null&&ft.includes('<meta http-equiv=Content-Type content="text/html; charset=utf-8">'))&&!(ft!=null&&ft.includes("microsoft-com"))?(st(ft),!0):ft!=null&&ft.includes("Outline")?(qe(ft),et(!0),!0):!1},Ie);return()=>{jt()}},[Re]),he.useEffect(()=>{const jt=()=>!!(u&&u.length>1),Bt=()=>!!(u&&u.length>1),Kt=d.registerCommand(oc,jt,xi),ft=d.registerCommand(ic,Bt,xi);return()=>{Kt(),ft()}},[d,u]);const rt=he.useCallback(()=>{const jt=Ot();if(Ct(jt)){const Bt=jt.anchor.getNode();let Kt=Bt.getKey()==="root"?Bt:er(Bt,He=>{const Pe=He.getParent();return Pe!==null&&to(Pe)});Kt===null&&(Kt=Bt.getTopLevelElementOrThrow());const ft=Kt.getKey(),Dt=p.getElementByKey(ft);R(jt.hasFormat("bold")),U(jt.hasFormat("italic")),z(jt.hasFormat("underline")),K(jt.hasFormat("strikethrough")),q(jt.hasFormat("subscript")),H(jt.hasFormat("superscript")),Z(jt.hasFormat("code")),Se(ub(jt));const en=Dw(jt),At=en.getParent();ei(At)||ei(en)?j(!0):j(!1);const nn=er(en,dr);if(dr(nn)?v("table"):v("root"),Dt!==null)if(E(ft),sr(Kt)){const He=hb(Bt,fd),Pe=He?He.getListType():Kt.getListType();g(Pe)}else{const He=Lp(Kt)?Kt.getTag():Kt.getType();if(He in yN&&g(He),Cm(Kt)){const Pe=Kt.getLanguage();me(Pe?Ob[Pe]||Pe:"");return}}w(sd(jt,"font-size","15px")),x(sd(jt,"color","#000")),T(sd(jt,"background-color","#fff")),B(sd(jt,"font-family","Arial"));let Oe;ei(At)&&(Oe=er(en,He=>Tt(He)&&!He.isInline())),L(Tt(Oe)?Oe.getFormatType():Tt(en)?en.getFormatType():(At==null?void 0:At.getFormatType())||"left")}},[p]);he.useEffect(()=>d.registerCommand(bi,(jt,Bt)=>(rt(),h(Bt),!1),Uo),[d,rt]),he.useEffect(()=>br(p.registerUpdateListener(({editorState:jt})=>{jt.read(()=>{rt()})}),p.registerCommand(lc,jt=>(u&&u.length>1?G(!0):G(jt),!1),Uo),p.registerCommand(ac,jt=>(oe(jt),!1),Uo)),[rt,p,d]),he.useEffect(()=>p.registerCommand(Nv,jt=>{const Bt=jt,{code:Kt,ctrlKey:ft,metaKey:Dt}=Bt;if(Kt==="KeyK"&&(ft||Dt)){Bt.preventDefault();let en;return O?(l(!1),en=null):(l(!0),en=vw("https://")),p.dispatchCommand(Pa,en)}return!1},o2),[p,O,l]);const Je=he.useCallback((jt,Bt)=>{p.update(()=>{const Kt=Ot();Kt!==null&&vm(Kt,jt)},Bt?{tag:"historic"}:{})},[p]);he.useCallback(()=>{p.update(()=>{const jt=Ot();if(Ct(jt)){const Bt=jt.anchor,Kt=jt.focus,ft=jt.getNodes();if(Bt.key===Kt.key&&Bt.offset===Kt.offset)return;ft.forEach((Dt,en)=>{if(Jt(Dt)){let At=Dt;en===0&&Bt.offset!==0&&(At=At.splitText(Bt.offset)[1]||At),en===ft.length-1&&(At=At.splitText(Kt.offset)[0]||At),At.__style!==""&&At.setStyle(""),At.__format!==0&&(At.setFormat(0),bm(At).setFormat("")),Dt=At}else Lp(Dt)||oO(Dt)?Dt.replace(En(),!0):Wm(Dt)&&Dt.setFormat("")})}})},[p]),he.useCallback((jt,Bt)=>{Je({color:jt},Bt)},[Je]),he.useCallback((jt,Bt)=>{Je({"background-color":jt},Bt)},[Je]),he.useCallback(()=>{O?(l(!1),d.dispatchCommand(Pa,null)):(l(!0),d.dispatchCommand(Pa,vw("https://")))},[d,O,l]);const Ft=he.useCallback(jt=>{p.update(()=>{if(b!==null){const Bt=Rn(b);Cm(Bt)&&Bt.setLanguage(jt)}})},[p,b]),Ze=()=>{m!=="number"?d.dispatchCommand($b,void 0):d.dispatchCommand(qb,void 0)},xt=()=>{d.focus(),d.dispatchCommand(Hb,void 0)};return ce.jsxs("div",{className:"toolbar",children:[a&&ce.jsx("button",{disabled:!1,onClick:()=>{o(!r)},title:"Table of Conetent",type:"button",className:"toolbar-item spaced","aria-label":"table-of-content",children:ce.jsx("img",{src:mN,width:16,height:16})}),ce.jsx("button",{disabled:!Q||!Ee,onClick:()=>{u&&u.length>1?G(!1):p.dispatchCommand(oc,void 0)},title:La?"Undo (⌘Z)":"Undo (Ctrl+Z)",type:"button",className:"toolbar-item spaced","aria-label":"Undo",children:ce.jsx("i",{className:"format undo"})}),ce.jsx("button",{disabled:!ee||!Ee,onClick:()=>{u&&u.length>1?oe(!1):p.dispatchCommand(ic,void 0)},title:La?"Redo (⌘Y)":"Redo (Ctrl+Y)",type:"button",className:"toolbar-item","aria-label":"Redo",children:ce.jsx("i",{className:"format redo"})}),m==="code"?ce.jsx(Sd,{disabled:!Ee,buttonClassName:"toolbar-item code-language",buttonLabel:T2(we),buttonAriaLabel:"Select language",children:_N.map(([jt,Bt])=>ce.jsx(bo,{className:`item ${Wp(jt===we)}`,onClick:()=>Ft(jt),children:ce.jsx("span",{className:"text",children:Bt})},jt))}):ce.jsxs(ce.Fragment,{children:[ce.jsx(Ed,{}),ce.jsx(nN,{selectionFontSize:S.slice(0,-2),editor:d,disabled:!Ee,styleConfig:n,blockType:"h1",isenterPressed:Te,currentElementClick:se,currentElementSelect:le,wpAndTaskId:f}),ce.jsx(Ed,{}),ce.jsx("button",{disabled:!Ee,onClick:()=>{p.dispatchCommand(Gr,"bold")},className:"toolbar-item spaced "+(N?"active":""),title:La?"Bold (⌘B)":"Bold (Ctrl+B)",type:"button","aria-label":`Format text as bold. Shortcut: ${La?"⌘B":"Ctrl+B"}`,children:ce.jsx("i",{className:"format bold"})}),ce.jsx("button",{disabled:!Ee,onClick:()=>{p.dispatchCommand(Gr,"italic")},className:"toolbar-item spaced "+(A?"active":""),title:La?"Italic (⌘I)":"Italic (Ctrl+I)",type:"button","aria-label":`Format text as italics. Shortcut: ${La?"⌘I":"Ctrl+I"}`,children:ce.jsx("i",{className:"format italic"})}),ce.jsx("button",{disabled:!Ee,onClick:()=>{p.dispatchCommand(Gr,"underline")},className:"toolbar-item spaced "+(M?"active":""),title:La?"Underline (⌘U)":"Underline (Ctrl+U)",type:"button","aria-label":`Format text to underlined. Shortcut: ${La?"⌘U":"Ctrl+U"}`,children:ce.jsx("i",{className:"format underline"})}),ce.jsx("button",{className:"toolbar-item",onClick:()=>d.dispatchCommand(O1,void 0),title:"Insert Endnote",children:ce.jsx("i",{className:"format endnotes"})}),ce.jsxs(Sd,{disabled:!Ee,buttonClassName:"toolbar-item spaced",buttonLabel:"",buttonAriaLabel:"Formatting options for additional text styles",buttonIconClassName:"icon dropdown-more",children:[ce.jsxs(bo,{onClick:()=>{p.dispatchCommand(Gr,"strikethrough")},className:"item "+Wp(V),title:"Strikethrough","aria-label":"Format text with a strikethrough",children:[ce.jsx("i",{className:"icon strikethrough"}),ce.jsx("span",{className:"text",children:"Strikethrough"})]}),ce.jsxs(bo,{onClick:()=>{p.dispatchCommand(Gr,"subscript")},className:"item "+Wp(P),title:"Subscript","aria-label":"Format text with a subscript",children:[ce.jsx("i",{className:"icon subscript"}),ce.jsx("span",{className:"text",children:"Subscript"})]}),ce.jsxs(bo,{onClick:()=>{p.dispatchCommand(Gr,"superscript")},className:"item "+Wp(W),title:"Superscript","aria-label":"Format text with a superscript",children:[ce.jsx("i",{className:"icon superscript"}),ce.jsx("span",{className:"text",children:"Superscript"})]})]}),ce.jsx(Ed,{}),ce.jsxs(Sd,{disabled:!Ee,buttonClassName:"toolbar-item spaced",buttonLabel:"Insert",buttonAriaLabel:"Insert specialized editor node",buttonIconClassName:"icon plus",children:[ce.jsxs(bo,{onClick:()=>{fe("Insert Image",jt=>ce.jsx(SO,{activeEditor:p,onClose:jt,enableCaptions:!1}))},className:"item",children:[ce.jsx("i",{className:"icon image"}),ce.jsx("span",{className:"text",children:"Image"})]}),ce.jsxs(bo,{onClick:()=>{fe("Insert Table",jt=>ce.jsx(FT,{activeEditor:p,onClose:jt,enableCaptions:i}))},className:"item",children:[ce.jsx("i",{className:"icon table"}),ce.jsx("span",{className:"text",children:"Table"})]}),ce.jsxs(bo,{className:"item",onClick:()=>{xt()},children:[ce.jsx("img",{src:pN,height:21,width:21}),ce.jsx("span",{style:{marginLeft:"10px",marginTop:"2px"},children:"Bullet List"})]}),ce.jsxs(bo,{className:"item",onClick:()=>{Ze()},children:[ce.jsx("img",{src:hN,height:21,width:21}),ce.jsx("span",{style:{marginLeft:"10px",marginTop:"2px"},children:"Numbered List"})]})]})]}),ce.jsx(Ed,{}),ce.jsx("button",{className:`toolbar-item ${e?"active":""}`,onClick:()=>{s(!e),console.log("line 616 ToolbarPlugin show comments button clicked")},title:e?"Hide Comments":"Show Comments",children:ce.jsx("i",{className:"comments"})}),ce.jsx(Ed,{}),ce.jsx(gN,{passedContent:Me,source:"remote",onPaste:null,htmlPasteModalOpen:Ce,sethtmlPasteModalOpen:et,onlUser:t,collabApiKey:""}),ce.jsx("button",{className:"toolbar-item",onClick:()=>{lN(d,"title-doc",n,c)},children:ce.jsx("img",{title:"Download as .doc",src:oN,height:18,width:18,className:"download-icon"})}),ce.jsx(wN,{disabled:!Ee,value:D,editor:d,isRTL:ne}),ce.jsx("button",{style:{display:"none"},id:"pagination",onClick:()=>{tN(d)}}),ce.jsx("div",{className:"flex-container-onluser",children:t}),de]})}const SR="",xN=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?he.useLayoutEffect:he.useEffect;function Hw({ariaActiveDescendant:l,ariaAutoComplete:t,ariaControls:n,ariaDescribedBy:e,ariaExpanded:s,ariaLabel:r,ariaLabelledBy:o,ariaMultiline:a,ariaOwns:c,ariaRequired:i,autoCapitalize:u,className:f,id:d,role:p="textbox",spellCheck:h=!0,style:m,tabIndex:g,"data-testid":_,...v}){const[b]=xn(),[E,S]=he.useState(!1),w=he.useCallback(y=>{y&&y.ownerDocument&&y.ownerDocument.defaultView&&b.setRootElement(y)},[b]);return xN(()=>(S(b.isEditable()),b.registerEditableListener(y=>{S(y)})),[b]),ce.jsx("div",{...v,"aria-activedescendant":E?l:void 0,"aria-autocomplete":E?t:"none","aria-controls":E?n:void 0,"aria-describedby":e,"aria-expanded":E&&p==="combobox"?!!s:void 0,"aria-label":r,"aria-labelledby":o,"aria-multiline":a,"aria-owns":E?c:void 0,"aria-readonly":!E||void 0,"aria-required":i,autoCapitalize:u,className:f,contentEditable:E,"data-testid":_,id:d,ref:w,role:p,spellCheck:h,style:m,tabIndex:g})}function Cd({className:l}){return ce.jsx(Hw,{className:l||"ContentEditable__root"})}const ER="";function jd({children:l,className:t}){return ce.jsx("div",{className:t||"Placeholder__root",children:l})}let hy=class Zj extends Br{static getType(){return"mark"}static clone(t){return new Zj(Array.from(t.__ids),t.__key)}static importDOM(){return null}static importJSON(t){const n=Jp(t.ids);return n.setFormat(t.format),n.setIndent(t.indent),n.setDirection(t.direction),n}exportJSON(){return{...super.exportJSON(),ids:this.getIDs(),type:"mark",version:1}}constructor(t,n){super(n),this.__ids=t||[]}createDOM(t){const n=document.createElement("mark");return zr(n,t.theme.mark),this.__ids.length>1&&zr(n,t.theme.markOverlap),n}updateDOM(t,n,e){const s=t.__ids,r=this.__ids,o=s.length,a=r.length,c=e.theme.markOverlap;return o!==a&&(o===1?a===2&&zr(n,c):a===1&&wc(n,c)),!1}hasID(t){const n=this.getIDs();for(let e=0;e<n.length;e++)if(t===n[e])return!0;return!1}getIDs(){const t=this.getLatest();return Il(t)?t.__ids:[]}addID(t){const n=this.getWritable();if(Il(n)){const e=n.__ids;n.__ids=e;for(let s=0;s<e.length;s++)if(t===e[s])return;e.push(t)}}deleteID(t){const n=this.getWritable();if(Il(n)){const e=n.__ids;n.__ids=e;for(let s=0;s<e.length;s++)if(t===e[s])return void e.splice(s,1)}}insertNewAfter(t,n=!0){const e=Jp(this.__ids);return this.insertAfter(e,n),e}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(t,n,e){if(!Ct(n)||e==="html")return!1;const s=n.anchor,r=n.focus,o=s.getNode(),a=r.getNode(),c=n.isBackward()?s.offset-r.offset:r.offset-s.offset;return this.isParentOf(o)&&this.isParentOf(a)&&this.getTextContent().length===c}excludeFromCopy(t){return t!=="clone"}};function Jp(l){return Pr(new hy(l))}function Il(l){return l instanceof hy}function SN(l){const t=l.getChildren();let n=null;for(let e=0;e<t.length;e++){const s=t[e];n===null?l.insertBefore(s):n.insertAfter(s),n=s}l.remove()}function EN(l,t,n,e){const s=l.getNodes(),r=l.anchor.offset,o=l.focus.offset,a=s.length,c=t?o:r,i=t?r:o;let u,f;for(let d=0;d<a;d++){const p=s[d];if(Tt(f)&&f.isParentOf(p))continue;const h=d===0,m=d===a-1;let g=null;if(Jt(p)){const _=p.getTextContentSize(),v=h?c:0,b=m?i:_;if(v===0&&b===0)continue;const E=p.splitText(v,b);g=E.length>1&&(E.length===3||h&&!m||b===_)?E[1]:E[0]}else{if(Il(p))continue;Tt(p)&&p.isInline()&&(g=p)}if(g!==null){if(g&&g.is(u))continue;const _=g.getParent();_!=null&&_.is(u)||(f=void 0),u=_,f===void 0&&(f=(e||Jp)([n]),g.insertBefore(f)),f.append(g)}else u=void 0,f=void 0}Tt(f)&&(t?f.selectStart():f.selectEnd())}function CN(l,t){let n=l;for(;n!==null;){if(Il(n))return n.getIDs();if(Jt(n)&&t===n.getTextContentSize()){const e=n.getNextSibling();if(Il(e))return e.getIDs()}n=n.getParent()}return null}const $w=[["Cat","rgb(125, 50, 0)"],["Dog","rgb(100, 0, 0)"],["Rabbit","rgb(150, 0, 0)"],["Frog","rgb(200, 0, 0)"],["Fox","rgb(200, 75, 0)"],["Hedgehog","rgb(0, 75, 0)"],["Pigeon","rgb(0, 125, 0)"],["Squirrel","rgb(75, 100, 0)"],["Bear","rgb(125, 100, 0)"],["Tiger","rgb(0, 0, 150)"],["Leopard","rgb(0, 0, 200)"],["Zebra","rgb(0, 0, 250)"],["Wolf","rgb(0, 100, 150)"],["Owl","rgb(0, 100, 100)"],["Gull","rgb(100, 0, 100)"],["Squid","rgb(150, 0, 150)"]],qw=$w[Math.floor(Math.random()*$w.length)],jN=he.createContext({clientID:0,color:qw[1],isCollabActive:!1,name:qw[0],yjsDocMap:new Map});function kd(l,t){const n=he.useContext(jN);return l!=null&&(n.name=l),t!=null&&(n.color=t),n}const kN=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?he.useLayoutEffect:he.useEffect;function Ww({onClear:l}){const[t]=xn();return kN(()=>t.registerCommand(Nf,n=>(t.update(()=>{if(l==null){const e=Mn(),s=Ot(),r=En();e.clear(),e.append(r),s!==null&&r.select(),Ct(s)&&(s.format=0)}else l()}),!0),Tn),[t,l]),null}function gy(l,t){return gy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,e){return n.__proto__=e,n},gy(l,t)}var Jw={error:null},TN=function(l){var t,n;function e(){for(var r,o=arguments.length,a=new Array(o),c=0;c<o;c++)a[c]=arguments[c];return(r=l.call.apply(l,[this].concat(a))||this).state=Jw,r.resetErrorBoundary=function(){for(var i,u=arguments.length,f=new Array(u),d=0;d<u;d++)f[d]=arguments[d];r.props.onReset==null||(i=r.props).onReset.apply(i,f),r.reset()},r}n=l,(t=e).prototype=Object.create(n.prototype),t.prototype.constructor=t,gy(t,n),e.getDerivedStateFromError=function(r){return{error:r}};var s=e.prototype;return s.reset=function(){this.setState(Jw)},s.componentDidCatch=function(r,o){var a,c;(a=(c=this.props).onError)==null||a.call(c,r,o)},s.componentDidUpdate=function(r,o){var a,c,i,u,f=this.state.error,d=this.props.resetKeys;f!==null&&o.error!==null&&((i=r.resetKeys)===void 0&&(i=[]),(u=d)===void 0&&(u=[]),i.length!==u.length||i.some(function(p,h){return!Object.is(p,u[h])}))&&((a=(c=this.props).onResetKeysChange)==null||a.call(c,r.resetKeys,d),this.reset())},s.render=function(){var r=this.state.error,o=this.props,a=o.fallbackRender,c=o.FallbackComponent,i=o.fallback;if(r!==null){var u={error:r,resetErrorBoundary:this.resetErrorBoundary};if(or.isValidElement(i))return i;if(typeof a=="function")return a(u);if(c)return or.createElement(c,u);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},e}(or.Component);function Ml({children:l,onError:t}){return ce.jsx(TN,{fallback:ce.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:t,children:l})}const ON=Object.freeze(Object.defineProperty({__proto__:null,LexicalErrorBoundary:Ml,default:Ml},Symbol.toStringTag,{value:"Module"})),NN=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?he.useLayoutEffect:he.useEffect;function Vw({ignoreHistoryMergeTagChange:l=!0,ignoreSelectionChange:t=!1,onChange:n}){const[e]=xn();return NN(()=>{if(n)return e.registerUpdateListener(({editorState:s,dirtyElements:r,dirtyLeaves:o,prevEditorState:a,tags:c})=>{t&&r.size===0&&o.size===0||l&&c.has("history-merge")||a.isEmpty()||n(s,e,c)})},[e,l,t,n]),null}const Rc=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,AN=Rc&&"documentMode"in document?document.documentMode:null,PN=!(!Rc||!("InputEvent"in window)||AN)&&"getTargetRanges"in new window.InputEvent("input"),IN=Rc&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),MN=Rc&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,DN=Rc&&/^(?=.*Chrome).*/i.test(navigator.userAgent),RN=Rc&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!DN;function Kw(l,t){t.update(()=>{if(l!==null){const n=$s(l,KeyboardEvent)?null:l.clipboardData,e=Ot();if(e!==null&&n!=null){l.preventDefault();const s=W1(t);s!==null&&n.setData("text/html",s),n.setData("text/plain",e.getTextContent())}}})}function LN(l){return br(l.registerCommand(Yi,t=>{const n=Ot();return!!Ct(n)&&(n.deleteCharacter(t),!0)},Tn),l.registerCommand(gl,t=>{const n=Ot();return!!Ct(n)&&(n.deleteWord(t),!0)},Tn),l.registerCommand(xa,t=>{const n=Ot();return!!Ct(n)&&(n.deleteLine(t),!0)},Tn),l.registerCommand(ba,t=>{const n=Ot();if(!Ct(n))return!1;if(typeof t=="string")n.insertText(t);else{const e=t.dataTransfer;if(e!=null)J1(e,n);else{const s=t.data;s&&n.insertText(s)}}return!0},Tn),l.registerCommand(Ef,()=>{const t=Ot();return!!Ct(t)&&(t.removeText(),!0)},Tn),l.registerCommand(_a,t=>{const n=Ot();return!!Ct(n)&&(n.insertLineBreak(t),!0)},Tn),l.registerCommand(hl,()=>{const t=Ot();return!!Ct(t)&&(t.insertLineBreak(),!0)},Tn),l.registerCommand(jf,t=>{const n=Ot();if(!Ct(n))return!1;const e=t,s=e.shiftKey;return!!up(n,!0)&&(e.preventDefault(),dp(n,s,!0),!0)},Tn),l.registerCommand(Cf,t=>{const n=Ot();if(!Ct(n))return!1;const e=t,s=e.shiftKey;return!!up(n,!1)&&(e.preventDefault(),dp(n,s,!1),!0)},Tn),l.registerCommand(Zi,t=>{const n=Ot();return!!Ct(n)&&(t.preventDefault(),l.dispatchCommand(Yi,!0))},Tn),l.registerCommand(Xi,t=>{const n=Ot();return!!Ct(n)&&(t.preventDefault(),l.dispatchCommand(Yi,!1))},Tn),l.registerCommand(Rs,t=>{const n=Ot();if(!Ct(n))return!1;if(t!==null){if((MN||IN||RN)&&PN)return!1;t.preventDefault()}return l.dispatchCommand(_a,!1)},Tn),l.registerCommand(Of,()=>(r_(),!0),Tn),l.registerCommand($u,t=>{const n=Ot();return!!Ct(n)&&(Kw(t,l),!0)},Tn),l.registerCommand(qu,t=>{const n=Ot();return!!Ct(n)&&(function(e,s){Kw(e,s),s.update(()=>{const r=Ot();Ct(r)&&r.removeText()})}(t,l),!0)},Tn),l.registerCommand(wa,t=>{const n=Ot();return!!Ct(n)&&(function(e,s){e.preventDefault(),s.update(()=>{const r=Ot(),{clipboardData:o}=e;o!=null&&Ct(r)&&J1(o,r)},{tag:"paste"})}(t,l),!0)},Tn),l.registerCommand(Tf,t=>{const n=Ot();return!!Ct(n)&&(t.preventDefault(),!0)},Tn),l.registerCommand(sc,t=>{const n=Ot();return!!Ct(n)&&(t.preventDefault(),!0)},Tn))}const my=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?he.useLayoutEffect:he.useEffect;function Gw(l){return l.getEditorState().read(D1(l.isComposing()))}function Yw({contentEditable:l,placeholder:t,ErrorBoundary:n}){const[e]=xn(),s=function(r,o){const[a,c]=he.useState(()=>r.getDecorators());return my(()=>r.registerDecoratorListener(i=>{so.flushSync(()=>{c(i)})}),[r]),he.useEffect(()=>{c(r.getDecorators())},[r]),he.useMemo(()=>{const i=[],u=Object.keys(a);for(let f=0;f<u.length;f++){const d=u[f],p=ce.jsx(o,{onError:m=>r._onError(m),children:ce.jsx(he.Suspense,{fallback:null,children:a[d]})}),h=r.getElementByKey(d);h!==null&&i.push(so.createPortal(p,h,d))}return i},[o,a,r])}(e,n);return function(r){my(()=>br(LN(r),B1(r)),[r])}(e),ce.jsxs(ce.Fragment,{children:[l,ce.jsx(FN,{content:t}),s]})}function FN({content:l}){const[t]=xn(),n=function(s){const[r,o]=he.useState(()=>Gw(s));return my(()=>{function a(){const c=Gw(s);o(c)}return a(),br(s.registerUpdateListener(()=>{a()}),s.registerEditableListener(()=>{a()}))},[s]),r}(t),e=oy();return n?typeof l=="function"?l(e):l:null}var BN={155:(l,t,n)=>{n.r(t),n.d(t,{default:()=>i});const e=JSON.parse('{"UU":"@codoxhq/lexical-provider","rE":"1.1.0-rc.6"}');let s=()=>{},r=function(){return s};const o=r(),a=r(),c=r(),i={log:o,info:a,warn:r(),debug:c,error:r(),logProviderVersion:()=>{console.log(`${e.UU} version ${e.rE}`)}}},668:(l,t,n)=>{l.exports=function e(s,r,o){function a(u,f){if(!r[u]){if(!s[u]){var d=void 0;if(!f&&d)return require(u,!0);if(c)return c(u,!0);throw(f=new Error("Cannot find module '"+u+"'")).code="MODULE_NOT_FOUND",f}d=r[u]={exports:{}},s[u][0].call(d.exports,function(p){return a(s[u][1][p]||p)},d,d.exports,e,s,r,o)}return r[u].exports}for(var c=void 0,i=0;i<o.length;i++)a(o[i]);return a}({1:[function(e,s,r){s.exports=function(o,a){(a==null||a>o.length)&&(a=o.length);for(var c=0,i=new Array(a);c<a;c++)i[c]=o[c];return i},s.exports.__esModule=!0,s.exports.default=s.exports},{}],2:[function(e,s,r){s.exports=function(o){if(Array.isArray(o))return o},s.exports.__esModule=!0,s.exports.default=s.exports},{}],3:[function(e,s,r){var o=e("./arrayLikeToArray.js");s.exports=function(a){if(Array.isArray(a))return o(a)},s.exports.__esModule=!0,s.exports.default=s.exports},{"./arrayLikeToArray.js":1}],4:[function(e,s,r){s.exports=function(o){if(o===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return o},s.exports.__esModule=!0,s.exports.default=s.exports},{}],5:[function(e,s,r){s.exports=function(o,a){if(!(o instanceof a))throw new TypeError("Cannot call a class as a function")},s.exports.__esModule=!0,s.exports.default=s.exports},{}],6:[function(e,s,r){var o=e("./setPrototypeOf.js"),a=e("./isNativeReflectConstruct.js");function c(i,u,f){return a()?s.exports=c=Reflect.construct.bind():s.exports=c=function(d,p,h){var m=[null];return m.push.apply(m,p),p=new(Function.bind.apply(d,m)),h&&o(p,h.prototype),p},s.exports.__esModule=!0,s.exports.default=s.exports,c.apply(null,arguments)}s.exports=c,s.exports.__esModule=!0,s.exports.default=s.exports},{"./isNativeReflectConstruct.js":13,"./setPrototypeOf.js":19}],7:[function(e,s,r){function o(a,c){for(var i=0;i<c.length;i++){var u=c[i];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(a,u.key,u)}}s.exports=function(a,c,i){return c&&o(a.prototype,c),i&&o(a,i),Object.defineProperty(a,"prototype",{writable:!1}),a},s.exports.__esModule=!0,s.exports.default=s.exports},{}],8:[function(e,s,r){s.exports=function(o,a,c){return a in o?Object.defineProperty(o,a,{value:c,enumerable:!0,configurable:!0,writable:!0}):o[a]=c,o},s.exports.__esModule=!0,s.exports.default=s.exports},{}],9:[function(e,s,r){function o(a){return s.exports=o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(c){return c.__proto__||Object.getPrototypeOf(c)},s.exports.__esModule=!0,s.exports.default=s.exports,o(a)}s.exports=o,s.exports.__esModule=!0,s.exports.default=s.exports},{}],10:[function(e,s,r){var o=e("./setPrototypeOf.js");s.exports=function(a,c){if(typeof c!="function"&&c!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),Object.defineProperty(a,"prototype",{writable:!1}),c&&o(a,c)},s.exports.__esModule=!0,s.exports.default=s.exports},{"./setPrototypeOf.js":19}],11:[function(e,s,r){s.exports=function(o){return o&&o.__esModule?o:{default:o}},s.exports.__esModule=!0,s.exports.default=s.exports},{}],12:[function(e,s,r){s.exports=function(o){return Function.toString.call(o).indexOf("[native code]")!==-1},s.exports.__esModule=!0,s.exports.default=s.exports},{}],13:[function(e,s,r){s.exports=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}},s.exports.__esModule=!0,s.exports.default=s.exports},{}],14:[function(e,s,r){s.exports=function(o){if(typeof Symbol<"u"&&o[Symbol.iterator]!=null||o["@@iterator"]!=null)return Array.from(o)},s.exports.__esModule=!0,s.exports.default=s.exports},{}],15:[function(e,s,r){s.exports=function(o,a){var c=o==null?null:typeof Symbol<"u"&&o[Symbol.iterator]||o["@@iterator"];if(c!=null){var i,u,f=[],d=!0,p=!1;try{for(c=c.call(o);!(d=(i=c.next()).done)&&(f.push(i.value),!a||f.length!==a);d=!0);}catch(h){p=!0,u=h}finally{try{d||c.return==null||c.return()}finally{if(p)throw u}}return f}},s.exports.__esModule=!0,s.exports.default=s.exports},{}],16:[function(e,s,r){s.exports=function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
66
+ `?c.insertParagraph():i===" "?c.insertNodes([mc()]):c.insertText(i)}}}else t.insertRawText(r)}function K1(l,t,n){l.dispatchCommand(jv,{nodes:t,selection:n})||n.insertNodes(t)}function G1(l,t,n,e=[]){let s=t===null||n.isSelected(t);const r=Tt(n)&&n.excludeFromCopy("html");let o=n;if(t!==null){let i=sb(n);i=Jt(i)&&t!==null?ab(t,i):i,o=i}const a=Tt(o)?o.getChildren():[],c=function(i){const u=i.exportJSON(),f=i.constructor;if(u.type!==f.getType()&&Mp(58,f.name),Tt(i)){const d=u.children;Array.isArray(d)||Mp(59,f.name)}return u}(o);if(Jt(o)){const i=o.__text;i.length>0?c.text=i:s=!1}for(let i=0;i<a.length;i++){const u=a[i],f=G1(l,t,u,c.children);!s&&Tt(n)&&f&&n.extractWithChild(u,t,"clone")&&(s=!0)}if(s&&!r)e.push(c);else if(Array.isArray(c.children))for(let i=0;i<c.children.length;i++){const u=c.children[i];e.push(u)}return s}function YT(l,t){const n=[],e=Mn().getChildren();for(let s=0;s<e.length;s++)G1(l,t,e[s],n);return{namespace:l._config.namespace,nodes:n}}function ZT(l){const t=[];for(let n=0;n<l.length;n++){const e=l[n],s=n2(e);Jt(s)&&l2(s),t.push(s)}return t}let Nc=null;async function Y1(l,t){if(Nc!==null)return!1;if(t!==null)return new Promise((a,c)=>{l.update(()=>{a(Z1(l,t))})});const n=l.getRootElement(),e=l._window==null?window.document:l._window.document,s=q1(l._window);if(n===null||s===null)return!1;const r=e.createElement("span");r.style.cssText="position: fixed; top: -1000px;",r.append(e.createTextNode("#")),n.append(r);const o=new Range;return o.setStart(r,0),o.setEnd(r,1),s.removeAllRanges(),s.addRange(o),new Promise((a,c)=>{const i=l.registerCommand($u,u=>($s(u,ClipboardEvent)&&(i(),Nc!==null&&(window.clearTimeout(Nc),Nc=null),a(Z1(l,u))),!0),Uo);Nc=window.setTimeout(()=>{i(),Nc=null,a(!1)},50),e.execCommand("copy"),r.remove()})}function Z1(l,t){const n=q1(l._window);if(!n)return!1;const e=n.anchorNode,s=n.focusNode;if(e!==null&&s!==null&&!Ju(l,e,s))return!1;t.preventDefault();const r=t.clipboardData,o=Ot();if(r===null||o===null)return!1;const a=W1(l),c=GT(l);let i="";return o!==null&&(i=o.getTextContent()),a!==null&&r.setData("text/html",a),c!==null&&r.setData("application/x-lexical-editor",c),r.setData("text/plain",i),!0}function X1(l,t){if(document.caretRangeFromPoint!==void 0){const n=document.caretRangeFromPoint(l,t);return n===null?null:{node:n.startContainer,offset:n.startOffset}}if(document.caretPositionFromPoint!=="undefined"){const n=document.caretPositionFromPoint(l,t);return n===null?null:{node:n.offsetNode,offset:n.offset}}return null}const Ac=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,XT=Ac&&"documentMode"in document?document.documentMode:null,QT=!(!Ac||!("InputEvent"in window)||XT)&&"getTargetRanges"in new window.InputEvent("input"),eO=Ac&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),tO=Ac&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,nO=Ac&&/^(?=.*Chrome).*/i.test(navigator.userAgent),rO=Ac&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!nO,iy=fo();class Dp extends Br{static getType(){return"quote"}static clone(t){return new Dp(t.__key)}constructor(t){super(t)}createDOM(t){const n=document.createElement("blockquote");return zr(n,t.theme.quote),n}updateDOM(t,n){return!1}static importDOM(){return{blockquote:t=>({conversion:iO,priority:0})}}exportDOM(t){const{element:n}=super.exportDOM(t);if(n&&Ri(n)){this.isEmpty()&&n.append(document.createElement("br"));const e=this.getFormatType();n.style.textAlign=e;const s=this.getDirection();s&&(n.dir=s)}return{element:n}}static importJSON(t){const n=Q1();return n.setFormat(t.format),n.setIndent(t.indent),n.setDirection(t.direction),n}exportJSON(){return{...super.exportJSON(),type:"quote"}}insertNewAfter(t,n){const e=En(),s=this.getDirection();return e.setDirection(s),this.insertAfter(e,n),e}collapseAtStart(){const t=En();return this.getChildren().forEach(n=>t.append(n)),this.replace(t),!0}}function Q1(){return Pr(new Dp)}function oO(l){return l instanceof Dp}class Rp extends Br{static getType(){return"heading"}static clone(t){return new Rp(t.__tag,t.__key)}constructor(t,n){super(n),this.__tag=t}getTag(){return this.__tag}createDOM(t){const n=this.__tag,e=document.createElement(n),s=t.theme.heading;if(s!==void 0){const r=s[n];zr(e,r)}return e}updateDOM(t,n){return!1}static importDOM(){return{h1:t=>({conversion:Pc,priority:0}),h2:t=>({conversion:Pc,priority:0}),h3:t=>({conversion:Pc,priority:0}),h4:t=>({conversion:Pc,priority:0}),h5:t=>({conversion:Pc,priority:0}),h6:t=>({conversion:Pc,priority:0}),p:t=>{const n=t.firstChild;return n!==null&&ew(n)?{conversion:()=>({node:null}),priority:3}:null},span:t=>ew(t)?{conversion:n=>({node:wd("h1")}),priority:3}:null}}exportDOM(t){const{element:n}=super.exportDOM(t);if(n&&Ri(n)){this.isEmpty()&&n.append(document.createElement("br"));const e=this.getFormatType();n.style.textAlign=e;const s=this.getDirection();s&&(n.dir=s)}return{element:n}}static importJSON(t){const n=wd(t.tag);return n.setFormat(t.format),n.setIndent(t.indent),n.setDirection(t.direction),n}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),type:"heading",version:1}}insertNewAfter(t,n=!0){const e=t?t.anchor.offset:0,s=e!==this.getTextContentSize()&&t?wd(this.getTag()):En(),r=this.getDirection();if(s.setDirection(r),this.insertAfter(s,n),e===0&&!this.isEmpty()&&t){const o=En();o.select(),this.replace(o,!0)}return s}collapseAtStart(){const t=this.isEmpty()?En():wd(this.getTag());return this.getChildren().forEach(n=>t.append(n)),this.replace(t),!0}extractWithChild(){return!0}}function ew(l){return l.nodeName.toLowerCase()==="span"&&l.style.fontSize==="26pt"}function Pc(l){const t=l.nodeName.toLowerCase();let n=null;return t!=="h1"&&t!=="h2"&&t!=="h3"&&t!=="h4"&&t!=="h5"&&t!=="h6"||(n=wd(t),l.style!==null&&n.setFormat(l.style.textAlign)),{node:n}}function iO(l){const t=Q1();return l.style!==null&&t.setFormat(l.style.textAlign),{node:t}}function wd(l){return Pr(new Rp(l))}function Lp(l){return l instanceof Rp}function Fp(l){let t=null;if($s(l,DragEvent)?t=l.dataTransfer:$s(l,ClipboardEvent)&&(t=l.clipboardData),t===null)return[!1,[],!1];const n=t.types,e=n.includes("Files"),s=n.includes("text/html")||n.includes("text/plain");return[e,Array.from(t.files),s]}function tw(l){const t=Ot();if(!Ct(t))return!1;const n=new Set,e=t.getNodes();for(let s=0;s<e.length;s++){const r=e[s],o=r.getKey();if(n.has(o))continue;const a=er(r,i=>Tt(i)&&!i.isInline());if(a===null)continue;const c=a.getKey();a.canIndent()&&!n.has(c)&&(n.add(c),l(a))}return n.size>0}function Bp(l){const t=po(l);return hr(t)}function sO(l){return br(l.registerCommand(va,t=>{const n=Ot();return!!fr(n)&&(n.clear(),!0)},0),l.registerCommand(Yi,t=>{const n=Ot();return!!Ct(n)&&(n.deleteCharacter(t),!0)},Tn),l.registerCommand(gl,t=>{const n=Ot();return!!Ct(n)&&(n.deleteWord(t),!0)},Tn),l.registerCommand(xa,t=>{const n=Ot();return!!Ct(n)&&(n.deleteLine(t),!0)},Tn),l.registerCommand(ba,t=>{const n=Ot();if(typeof t=="string")n!==null&&n.insertText(t);else{if(n===null)return!1;const e=t.dataTransfer;if(e!=null)V1(e,n,l);else if(Ct(n)){const s=t.data;return s&&n.insertText(s),!0}}return!0},Tn),l.registerCommand(Ef,()=>{const t=Ot();return!!Ct(t)&&(t.removeText(),!0)},Tn),l.registerCommand(Gr,t=>{const n=Ot();return!!Ct(n)&&(n.formatText(t),!0)},Tn),l.registerCommand(ml,t=>{const n=Ot();if(!Ct(n)&&!fr(n))return!1;const e=n.getNodes();for(const s of e){const r=er(s,o=>Tt(o)&&!o.isInline());r!==null&&r.setFormat(t)}return!0},Tn),l.registerCommand(_a,t=>{const n=Ot();return!!Ct(n)&&(n.insertLineBreak(t),!0)},Tn),l.registerCommand(hl,()=>{const t=Ot();return!!Ct(t)&&(t.insertParagraph(),!0)},Tn),l.registerCommand(ik,()=>(si([mc()]),!0),Tn),l.registerCommand(Tv,()=>tw(t=>{const n=t.getIndent();t.setIndent(n+1)}),Tn),l.registerCommand(Ov,()=>tw(t=>{const n=t.getIndent();n>0&&t.setIndent(n-1)}),Tn),l.registerCommand(Uu,t=>{const n=Ot();if(fr(n)&&!Bp(t.target)){const e=n.getNodes();if(e.length>0)return e[0].selectPrevious(),!0}else if(Ct(n)){const e=Zu(n.focus,!0);if(!t.shiftKey&&hr(e)&&!e.isIsolated()&&!e.isInline())return e.selectPrevious(),t.preventDefault(),!0}return!1},Tn),l.registerCommand(Hu,t=>{const n=Ot();if(fr(n)){const e=n.getNodes();if(e.length>0)return e[0].selectNext(0,0),!0}else if(Ct(n)){if(function(s){const r=s.focus;return r.key==="root"&&r.offset===Mn().getChildrenSize()}(n))return t.preventDefault(),!0;const e=Zu(n.focus,!1);if(!t.shiftKey&&hr(e)&&!e.isIsolated()&&!e.isInline())return e.selectNext(),t.preventDefault(),!0}return!1},Tn),l.registerCommand(jf,t=>{const n=Ot();if(fr(n)){const e=n.getNodes();if(e.length>0)return t.preventDefault(),e[0].selectPrevious(),!0}if(!Ct(n))return!1;if(up(n,!0)){const e=t.shiftKey;return t.preventDefault(),dp(n,e,!0),!0}return!1},Tn),l.registerCommand(Cf,t=>{const n=Ot();if(fr(n)&&!Bp(t.target)){const s=n.getNodes();if(s.length>0)return t.preventDefault(),s[0].selectNext(0,0),!0}if(!Ct(n))return!1;const e=t.shiftKey;return!!up(n,!1)&&(t.preventDefault(),dp(n,e,!1),!0)},Tn),l.registerCommand(Zi,t=>{if(Bp(t.target))return!1;const n=Ot();if(!Ct(n))return!1;t.preventDefault();const{anchor:e}=n,s=e.getNode();return n.isCollapsed()&&e.offset===0&&!zo(s)&&bm(s).getIndent()>0?l.dispatchCommand(Ov,void 0):l.dispatchCommand(Yi,!0)},Tn),l.registerCommand(Xi,t=>{if(Bp(t.target))return!1;const n=Ot();return!!Ct(n)&&(t.preventDefault(),l.dispatchCommand(Yi,!1))},Tn),l.registerCommand(Rs,t=>{const n=Ot();if(!Ct(n))return!1;if(t!==null){if((tO||eO||rO)&&QT)return!1;if(t.preventDefault(),t.shiftKey)return l.dispatchCommand(_a,!1)}return l.dispatchCommand(hl,void 0)},Tn),l.registerCommand(Ls,()=>{const t=Ot();return!!Ct(t)&&(l.blur(),!0)},Tn),l.registerCommand(Tf,t=>{const[,n]=Fp(t);if(n.length>0){const s=X1(t.clientX,t.clientY);if(s!==null){const{offset:r,node:o}=s,a=po(o);if(a!==null){const c=yc();if(Jt(a))c.anchor.set(a.getKey(),r,"text"),c.focus.set(a.getKey(),r,"text");else{const u=a.getParentOrThrow().getKey(),f=a.getIndexWithinParent()+1;c.anchor.set(u,f,"element"),c.focus.set(u,f,"element")}const i=Mg(c);Cr(i)}l.dispatchCommand(iy,n)}return t.preventDefault(),!0}const e=Ot();return!!Ct(e)},Tn),l.registerCommand(sc,t=>{const[n]=Fp(t),e=Ot();return!(n&&!Ct(e))},Tn),l.registerCommand(bg,t=>{const[n]=Fp(t),e=Ot();if(n&&!Ct(e))return!1;const s=X1(t.clientX,t.clientY);if(s!==null){const r=po(s.node);hr(r)&&t.preventDefault()}return!0},Tn),l.registerCommand(Of,()=>(r_(),!0),Tn),l.registerCommand($u,t=>(Y1(l,$s(t,ClipboardEvent)?t:null),!0),Tn),l.registerCommand(qu,t=>(async function(n,e){await Y1(e,$s(n,ClipboardEvent)?n:null),e.update(()=>{const s=Ot();Ct(s)?s.removeText():fr(s)&&s.getNodes().forEach(r=>r.remove())})}(t,l),!0),Tn),l.registerCommand(wa,t=>{const[,n,e]=Fp(t);return n.length>0&&!e?(l.dispatchCommand(iy,n),!0):Dg(t.target)?!1:Ot()!==null&&(function(s,r){s.preventDefault(),r.update(()=>{const o=Ot(),a=$s(s,InputEvent)||$s(s,KeyboardEvent)?null:s.clipboardData;a!=null&&o!==null&&V1(a,o,r)},{tag:"paste"})}(t,l),!0)},Tn))}const sy=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?he.useLayoutEffect:he.useEffect;function nw(l){return l.getEditorState().read(D1(l.isComposing()))}function zp({contentEditable:l,placeholder:t,ErrorBoundary:n}){const[e]=xn(),s=function(r,o){const[a,c]=he.useState(()=>r.getDecorators());return sy(()=>r.registerDecoratorListener(i=>{so.flushSync(()=>{c(i)})}),[r]),he.useEffect(()=>{c(r.getDecorators())},[r]),he.useMemo(()=>{const i=[],u=Object.keys(a);for(let f=0;f<u.length;f++){const d=u[f],p=ce.jsx(o,{onError:m=>r._onError(m),children:ce.jsx(he.Suspense,{fallback:null,children:a[d]})}),h=r.getElementByKey(d);h!==null&&i.push(so.createPortal(p,h,d))}return i},[o,a,r])}(e,n);return function(r){sy(()=>br(sO(r),B1(r)),[r])}(e),ce.jsxs(ce.Fragment,{children:[l,ce.jsx(aO,{content:t}),s]})}function aO({content:l}){const[t]=xn(),n=function(s){const[r,o]=he.useState(()=>nw(s));return sy(()=>{function a(){const c=nw(s);o(c)}return a(),br(s.registerUpdateListener(()=>{a()}),s.registerEditableListener(()=>{a()}))},[s]),r}(t),e=oy();return n?typeof l=="function"?l(e):l:null}function lO(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var Up=lO(function(l){const t=new URLSearchParams;t.append("code",l);for(let n=1;n<arguments.length;n++)t.append("v",arguments[n]);throw Error(`Minified Lexical error #${l}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function rw({hasCellMerge:l=!0,hasCellBackgroundColor:t=!0,hasTabHandler:n=!0}){const[e]=xn();return he.useEffect(()=>(e.hasNodes([xs,is,Cl])||Up(10),br(e.registerCommand(W2,({columns:s,rows:r,includeHeaders:o})=>{const a=Rm(Number(r),Number(s),o);xl(a);const c=a.getFirstDescendant();return Jt(c)&&c.select(),!0},Tn),e.registerNodeTransform(xs,s=>{const[r]=n1(s,null,null),o=r.reduce((a,c)=>Math.max(a,c.length),0);for(let a=0;a<r.length;++a){const c=r[a].length;if(c===o)continue;const i=r[a][c-1].cell;for(let u=c;u<o;++u){const f=Si(0);f.append(En()),i!==null?i.insertAfter(f):mb(i,f)}}}))),[e]),he.useEffect(()=>{const s=new Map,r=a=>{const c=a.getKey(),i=e.getElementByKey(c);if(i&&!s.has(c)){const u=rT(a,i,e,n);s.set(c,u)}};e.getEditorState().read(()=>{const a=o_(xs);for(const c of a)dr(c)&&r(c)});const o=e.registerMutationListener(xs,a=>{for(const[c,i]of a)if(i==="created")e.getEditorState().read(()=>{const u=Rn(c);dr(u)&&r(u)});else if(i==="destroyed"){const u=s.get(c);u!==void 0&&(u.removeListeners(),s.delete(c))}});return()=>{o();for(const[,a]of s)a.removeListeners()}},[e,n]),he.useEffect(()=>{if(!l)return e.registerNodeTransform(is,s=>{if(s.getColSpan()>1||s.getRowSpan()>1){const[,,r]=Ao(s),[o]=ss(r,s,s),a=o.length,c=o[0].length;let i=r.getFirstChild();Rr(i)||Up(175);const u=[];for(let f=0;f<a;f++){f!==0&&(i=i.getNextSibling(),Rr(i)||Up(175));let d=null;for(let p=0;p<c;p++){const h=o[f][p],m=h.cell;if(h.startRow===f&&h.startColumn===p)d=m,u.push(m);else if(m.getColSpan()>1||m.getRowSpan()>1){vn(m)||Up(176);const g=Si(m.__headerState);d!==null?d.insertAfter(g):mb(i,g)}}}for(const f of u)f.setColSpan(1),f.setRowSpan(1)}})},[e,l]),he.useEffect(()=>{if(!t)return e.registerNodeTransform(is,s=>{s.getBackgroundColor()!==null&&s.setBackgroundColor(null)})},[e,t,l]),null}function cO(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var uO=cO(function(l){const t=new URLSearchParams;t.append("code",l);for(let n=1;n<arguments.length;n++)t.append("v",arguments[n]);throw Error(`Minified Lexical error #${l}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function ow(l,t=n=>n){return n=>{const e=l.exec(n);return e===null?null:{index:e.index,length:e[0].length,text:e[0],url:t(e[0])}}}function iw(l,t){for(let n=0;n<t.length;n++){const e=t[n](l);if(e)return e}return null}const dO=/[.,;\s]/;function Hp(l){return dO.test(l)}function sw(l){return Hp(l[l.length-1])}function ay(l){return Hp(l[0])}function aw(l){let t=l.getPreviousSibling();return Tt(t)&&(t=t.getLastDescendant()),t===null||_s(t)||Jt(t)&&sw(t.getTextContent())}function lw(l){let t=l.getNextSibling();return Tt(t)&&(t=t.getFirstDescendant()),t===null||_s(t)||Jt(t)&&ay(t.getTextContent())}function fO(l,t,n,e){return(l>0?Hp(n[l-1]):aw(e[0]))?t<n.length?Hp(n[t]):lw(e[e.length-1]):!1}function pO(l,t,n){const e=[],s=[],r=[];let o=0,a=0;const c=[...l];for(;c.length>0;){const i=c[0],u=i.getTextContent().length,f=a;a+u<=t?(e.push(i),o+=u):f>=n?r.push(i):s.push(i),a+=u,c.shift()}return[o,e,s,r]}function hO(l,t,n,e){const s=Nm(e.url,e.attributes);if(l.length===1){let r,o=l[0];t===0?[r,o]=o.splitText(n):[,r,o]=o.splitText(t,n);const a=ir(e.text);return a.setFormat(r.getFormat()),a.setDetail(r.getDetail()),a.setStyle(r.getStyle()),s.append(a),r.replace(s),o}if(l.length>1){const r=l[0];let o,a=r.getTextContent().length;t===0?o=r:[,o]=r.splitText(t);const c=[];let i;for(let p=1;p<l.length;p++){const h=l[p],m=h.getTextContent().length,g=a;if(g<n)if(a+m<=n)c.push(h);else{const[_,v]=h.splitText(n-g);c.push(_),i=v}a+=m}const u=Ot(),f=u?u.getNodes().find(Jt):void 0,d=ir(o.getTextContent());return d.setFormat(o.getFormat()),d.setDetail(o.getDetail()),d.setStyle(o.getStyle()),s.append(d,...c),f&&f===o&&(Ct(u)?d.select(u.anchor.offset,u.focus.offset):fr(u)&&d.select(0,d.getTextContent().length)),o.replace(s),i}}function ly(l,t,n){const e=l.getChildren(),s=e.length;for(let c=0;c<s;c++){const i=e[c];if(!Jt(i)||!i.isSimpleText())return $p(l),void n(null,l.getURL())}const r=l.getTextContent(),o=iw(r,t);if(o===null||o.text!==r||!aw(l)||!lw(l))return $p(l),void n(null,l.getURL());const a=l.getURL();if(a!==o.url&&(l.setURL(o.url),n(o.url,a)),o.attributes){const c=l.getRel();c!==o.attributes.rel&&(l.setRel(o.attributes.rel||null),n(o.attributes.rel||null,c));const i=l.getTarget();i!==o.attributes.target&&(l.setTarget(o.attributes.target||null),n(o.attributes.target||null,i))}}function $p(l){const t=l.getChildren();for(let n=t.length-1;n>=0;n--)l.insertAfter(t[n]);return l.remove(),t.map(n=>n.getLatest())}function gO(l,t,n){he.useEffect(()=>{l.hasNodes([ud])||uO(77);const e=(s,r)=>{n&&n(s,r)};return br(l.registerNodeTransform(no,s=>{const r=s.getParentOrThrow(),o=s.getPreviousSibling();if(Sc(r)&&!r.getIsUnlinked())ly(r,t,e);else if(!ei(r)){if(s.isSimpleText()&&(ay(s.getTextContent())||!Sc(o))){const a=function(c){const i=[c];let u=c.getNextSibling();for(;u!==null&&Jt(u)&&u.isSimpleText()&&(i.push(u),!/[\s]/.test(u.getTextContent()));)u=u.getNextSibling();return i}(s);(function(c,i,u){let f=[...c];const d=f.map(g=>g.getTextContent()).join("");let p,h=d,m=0;for(;(p=iw(h,i))&&p!==null;){const g=p.index,_=g+p.length;if(fO(m+g,m+_,d,f)){const[v,,b,E]=pO(f,m+g,m+_),S=hO(b,m+g-v,m+_-v,p);f=S?[S,...E]:E,u(p.url,null),m=0}else m+=_;h=h.substring(_)}})(a,t,e)}(function(a,c,i){const u=a.getPreviousSibling(),f=a.getNextSibling(),d=a.getTextContent();!Sc(u)||u.getIsUnlinked()||ay(d)&&!/^\.[a-zA-Z0-9]{1,}/.test(d)||(u.append(a),ly(u,c,i),i(null,u.getURL())),!Sc(f)||f.getIsUnlinked()||sw(d)||($p(f),ly(f,c,i),i(null,f.getURL()))})(s,t,e)}}),l.registerCommand(Pa,s=>{const r=Ot();return s!==null||!Ct(r)||r.extract().forEach(o=>{const a=o.getParent();if(Sc(a))return a.setIsUnlinked(!a.getIsUnlinked()),a.markDirty(),!0}),!1},Gn))},[l,t,n])}function mO({matchers:l,onChange:t}){const[n]=xn();return gO(n,l,t),null}const yO=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/,vO=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/,_O=[ow(yO,l=>l.startsWith("http")?l:`https://${l}`),ow(vO,l=>`mailto:${l}`)];function cw(){return ce.jsx(mO,{matchers:_O})}function bO({accept:l,label:t,onChange:n,"data-test-id":e}){return ce.jsxs("div",{className:"Input__wrapper",children:[ce.jsx("label",{className:"Input__label",children:t}),ce.jsx("input",{type:"file",accept:l,className:"Input__input",onChange:s=>n(s.target.files),"data-test-id":e})]})}const Ic=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",wO=l=>Ic?(l||window).getSelection():null,qp=fo();function xO({onClick:l}){const[t,n]=he.useState(""),[e,s]=he.useState(""),r=t==="",o=a=>{const c=new FileReader;c.onload=function(){return typeof c.result=="string"&&n(c.result),""},a!==null&&c.readAsDataURL(a[0])};return ce.jsxs(ce.Fragment,{children:[ce.jsx(bO,{label:"Image Upload",onChange:o,accept:"image/*","data-test-id":"image-modal-file-upload"}),ce.jsx(Oc,{label:"Alt Text",placeholder:"Descriptive alternative text",onChange:s,value:e,"data-test-id":"image-modal-alt-text-input"}),ce.jsx(Np,{children:ce.jsx(Fi,{"data-test-id":"image-modal-file-upload-btn",disabled:r,onClick:()=>l({altText:e,src:t}),children:"Confirm"})})]})}function SO({activeEditor:l,onClose:t,enableCaptions:n}){const[e,s]=he.useState("file"),r=he.useRef(!1);he.useEffect(()=>{r.current=!1;const a=c=>{r.current=c.altKey};return document.addEventListener("keydown",a),()=>{document.removeEventListener("keydown",a)}},[l]);const o=a=>{l.dispatchCommand(qp,a),console.log("line 202 imageplugin insert image"),t()};return ce.jsx(ce.Fragment,{children:e==="file"&&ce.jsx(xO,{onClick:o})})}function uw(l,t,n,e,s){l.preventDefault();const r=l.clipboardData;if(!r)return!1;const o=r.items;if(!o||o.length===0)return!1;let a=!1,c=!1;const i=o.length>1?o[1]:o[0];let u=1;if(u===1){if(u=2,i.type==="text/html"&&!a){const f=r.getData("text/html"),p=new DOMParser().parseFromString(f,"text/html").querySelector("img");p&&p.src&&(fetch(p.src).then(h=>h.blob()).then(h=>{const m=new File([h],"pasted-image.png",{type:"image/png"});dw(m,t,e)}).catch(h=>console.error("Error fetching pasted image:",h)),a=!0)}else if(i.type.startsWith("image/")&&!a){const f=i.getAsFile();f&&(dw(f,t,e,s),a=!0)}}return!(!a&&!c)}function dw(l,t,n,e){const s=new FileReader;s.onload=()=>{const r=s.result,a={altText:l.name,src:r};t.update(()=>{const u=Mn().getChildren().filter(_=>Or(_)&&_.getChildren().some(v=>v.getTextContent().startsWith("Figure"))).length+1,f=`Figure ${u}:`,d=Mc("Figure",u,e),p=new $o(f,"black",d);p.__captionId=d;const h=kc({...a,figureLabel:f});h.__captionId=d;const m=En();m.setFormat("left");const g=rs();if(m.append(h,g),n){const v=ir("");v.setStyle("color: black; font-style: italic; font-weight: bold;"),m.append(p,v)}if(si([m]),to(h.getParentOrThrow())&&wm(h,En).selectEnd(),n){const _=Mn().getChildren();let v=1;_.forEach(b=>{if(Or(b)){const E=b.getChildren().find(S=>S.getTextContent().startsWith("Figure"));if(E){const S=E.getTextContent(),w=S.indexOf(":"),y=w!==-1?S.slice(w):"",x=`Figure ${v++}${y}`;(Jt(E)||E instanceof $o)&&E.setTextContent(x)}}})}})},s.readAsDataURL(l)}function fw({enableCaptions:l=!0,wpAndTaskId:t}){const[n]=xn(),[e,s]=he.useState("");return he.useEffect(()=>{if(!n.hasNodes([jp]))throw new Error("ImagesPlugin: ImageNode not registered on editor");let r=0;return br(n.registerCommand(qp,o=>{r+=1;const a=Mc("Figure",r,t);if(l){const c=`Figure ${r}:`,i=Mc("Figure",r,t),u=new $o(c,"black",i);u.__captionId=i,u.__captionId=a;const f=kc({...o});f.__captionId=a;const d=En();d.setFormat("left");const p=e.trim()===""?"":e,h=ir(p);h.setStyle(p?"color: black; font-style: italic; font-weight: bold;":"color: gray; font-style: italic; font-weight: normal;"),d.append(f,u,h),si([d]),to(f.getParentOrThrow())&&wm(f,En).selectEnd()}else{const c=kc(o),i=En();i.setFormat("left"),i.append(c),si([i]),to(c.getParentOrThrow())&&wm(c,En).selectEnd()}return n.update(()=>{const i=Mn().getChildren().filter(Or);let u=1;i.forEach(f=>{const d=f.getChildren().find(v=>v.getTextContent().startsWith("Figure"));if(!d)return;const p=d.__captionId,h=f.getChildren().find(Ws),m=h?h.__captionId:void 0,g=p??m??Mc(d.getTextContent(),u,t),_=new $o(`Figure ${u}:`,"black",g);_.__captionId=g,u++})}),!0},Tn),n.registerCommand(sc,o=>CO(o),xi),n.registerCommand(bg,o=>jO(o),Gn),n.registerCommand(Tf,o=>kO(o,n),xi),n.registerCommand(wa,o=>{var c;const a=(c=o.clipboardData)==null?void 0:c.items;return a&&a.length<=2&&a.length?uw(o,n,e,l,t):!1},xi))},[l,n]),null}function Mc(l,t,n){let e=5381;const s=String(t);for(let r=0;r<s.length;r++)e=(e<<5)+e+s.charCodeAt(r);return`${n}-Image-${t}-${Math.abs(e%1e6)}`}const EO="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",pw=document.createElement("img");pw.src=EO;function CO(l){const t=cy();if(!t)return!1;const n=l.dataTransfer;return n?(n.setData("text/plain","_"),n.setDragImage(pw,0,0),n.setData("application/x-lexical-drag",JSON.stringify({data:{altText:t.__altText,caption:t.__caption,height:t.__height,key:t.getKey(),maxWidth:t.__maxWidth,showCaption:t.__showCaption,src:t.__src,width:t.__width},type:"image"})),!0):!1}function jO(l){return cy()?(hw(l)||l.preventDefault(),!0):!1}function kO(l,t){const n=cy();if(!n)return!1;const e=TO(l);if(!e)return!1;if(l.preventDefault(),hw(l)){const s=OO(l);n.remove();const r=yc();s!=null&&r.applyDOMRange(s),Cr(r),t.dispatchCommand(qp,e)}return!0}function cy(){const l=Ot();if(!fr(l))return null;const n=l.getNodes()[0];return Ws(n)?n:null}function TO(l){var s;const t=(s=l.dataTransfer)==null?void 0:s.getData("application/x-lexical-drag");if(!t)return null;const{type:n,data:e}=JSON.parse(t);return n!=="image"?null:e}function hw(l){const t=l.target;return!!(t&&t instanceof HTMLElement&&!t.closest("code, span.editor-image")&&t.parentElement&&t.parentElement.closest("div.ContentEditable__root"))}function OO(l){let t;const n=l.target,e=n==null?null:n.nodeType===9?n.defaultView:n.ownerDocument.defaultView,s=wO(e);if(document.caretRangeFromPoint)t=document.caretRangeFromPoint(l.clientX,l.clientY);else if(l.rangeParent&&s!==null)s.collapse(l.rangeParent,l.rangeOffset||0),t=s.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return t}const gw=["image/","image/heic","image/heif","image/gif","image/webp"];function mw(){const[l]=xn();return he.useEffect(()=>l.registerCommand(iy,t=>((async()=>{const n=await m2(t,[gw].flatMap(e=>e));for(const{file:e,result:s}of n)pb(e,gw)&&l.dispatchCommand(qp,{altText:e.name,src:s})})(),!0),Gn),[l]),null}const NO=/(^|$|[^A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〆〱-〵〻〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ])(congrats|congratulations|gratuluju|gratuluji|gratulujeme|blahopřeju|blahopřeji|blahopřejeme|Til lykke|Tillykke|Glückwunsch|Gratuliere|felicitaciones|enhorabuena|paljon onnea|onnittelut|Félicitations|gratula|gratulálok|gratulálunk|congratulazioni|complimenti|おめでとう|おめでとうございます|축하해|축하해요|gratulerer|Gefeliciteerd|gratulacje|Parabéns|parabéns|felicitações|felicitări|мои поздравления|поздравляем|поздравляю|gratulujem|blahoželám|ยินดีด้วย|ขอแสดงความยินดี|tebrikler|tebrik ederim|恭喜|祝贺你|恭喜你|恭喜|恭喜|baie geluk|veels geluk|অভিনন্দন|Čestitam|Čestitke|Čestitamo|Συγχαρητήρια|Μπράβο|અભિનંદન|badhai|बधाई|अभिनंदन|Честитам|Свака част|hongera|வாழ்த்துகள்|வாழ்த்துக்கள்|అభినందనలు|അഭിനന്ദനങ്ങൾ|Chúc mừng|מזל טוב|mazel tov|mazal tov)(^|$|[^A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〆〱-〵〻〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ])/i;function yw(){const[l]=xn();he.useEffect(()=>{if(!l.hasNodes([Tc]))throw new Error("KeywordsPlugin: KeywordNode not registered on editor")},[l]);const t=he.useCallback(e=>v1(e.getTextContent()),[]),n=he.useCallback(e=>{const s=NO.exec(e);if(s===null)return null;const r=s[2].length,o=s.index+s[1].length;return{end:o+r,start:o}},[]);return R1(n,Tc,t),null}function AO({validateUrl:l}){const[t]=xn();return he.useEffect(()=>{if(!t.hasNodes([xc]))throw new Error("LinkPlugin: LinkNode not registered on editor");return br(t.registerCommand(Pa,n=>{if(n===null)return Am(n),!0;if(typeof n=="string")return!(l!==void 0&&!l(n))&&(Am(n),!0);{const{url:e,target:s,rel:r,title:o}=n;return Am(e,{rel:r,target:s,title:o}),!0}},Gn),l!==void 0?t.registerCommand(wa,n=>{const e=Ot();if(!Ct(e)||e.isCollapsed()||!$s(n,ClipboardEvent))return!1;const s=n;if(s.clipboardData===null)return!1;const r=s.clipboardData.getData("text");return!!l(r)&&!e.getNodes().some(o=>Tt(o))&&(t.dispatchCommand(Pa,r),n.preventDefault(),!0)},Gn):()=>{})},[t,l]),null}const PO=new Set(["http:","https:","mailto:","sms:","tel:"]);function vw(l){try{const t=new URL(l);if(!PO.has(t.protocol))return"about:blank"}catch{return l}return l}const IO=new RegExp(/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%/.\w-_]*)?\??(?:[-+=&;%@.\w_]*)#?(?:[\w]*))?)/);function MO(l){return l==="https://"||IO.test(l)}function uy(){return ce.jsx(AO,{validateUrl:MO})}function DO(l){const t=l.getNodes();return t.length===0?new Set([l.anchor.getNode().getParentOrThrow(),l.focus.getNode().getParentOrThrow()]):new Set(t.map(n=>Tt(n)?n:n.getParentOrThrow()))}function RO(l){const t=Ot();if(!Ct(t))return!1;const n=DO(t);let e=0;for(const s of n)if(sr(s))e=Math.max(Pm(s)+1,e);else if(Vr(s)){const r=s.getParent();if(!sr(r))throw new Error("ListMaxIndentLevelPlugin: A ListItemNode must have a ListNode for a parent.");e=Math.max(Pm(r)+1,e)}return e<=l}function _w({maxDepth:l}){const[t]=xn();return he.useEffect(()=>t.registerCommand(Tv,()=>!RO(l??7),Uo),[t,l]),null}const LO=1,FO=100;let bw=0,ww=!1;function BO(){window.addEventListener("keydown",l=>{l.key==="Tab"&&(bw=l.timeStamp)},!0)}function xw(){const[l]=xn();return he.useEffect(()=>(ww||(BO(),ww=!0),l.registerCommand(wg,t=>{const n=Ot();return Ct(n)&&bw+FO>t.timeStamp&&Cr(n.clone()),!1},LO)),[l]),null}const bR="";function zO({onClose:l,children:t,title:n,closeOnClickOutside:e}){const s=he.useRef(null);return he.useEffect(()=>{s.current!==null&&s.current.focus()},[]),he.useEffect(()=>{let r=null;const o=i=>{i.key==="Escape"&&l()},a=i=>{const u=i.target;s.current!==null&&!s.current.contains(u)&&e&&l()},c=s.current;return c!==null&&(r=c.parentElement,r!==null&&r.addEventListener("click",a)),window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o),r!==null&&(r==null||r.removeEventListener("click",a))}},[e,l]),ce.jsx("div",{className:"Modal__overlay",role:"dialog",children:ce.jsxs("div",{className:"Modal__modal",tabIndex:-1,ref:s,children:[ce.jsx("h2",{className:"Modal__title",children:n}),ce.jsx("button",{className:"Modal__closeButton","aria-label":"Close modal",type:"button",onClick:l,children:"X"}),ce.jsx("div",{className:"Modal__content",children:t})]})})}function UO({onClose:l,children:t,title:n,closeOnClickOutside:e=!1}){return so.createPortal(ce.jsx(zO,{onClose:l,title:n,closeOnClickOutside:e,children:t}),document.body)}function Da(){const[l,t]=he.useState(null),n=he.useCallback(()=>{t(null)},[]),e=he.useMemo(()=>{if(l===null)return null;const{title:r,content:o,closeOnClickOutside:a}=l;return ce.jsx(UO,{onClose:n,title:r,closeOnClickOutside:a,children:o})},[l,n]),s=he.useCallback((r,o,a=!1)=>{t({closeOnClickOutside:a,content:o(n),title:r})},[n]);return[e,s]}const wR="";let dy=!1;const HO=["#d0021b","#f5a623","#f8e71c","#8b572a","#7ed321","#417505","#bd10e0","#9013fe","#4a90e2","#50e3c2","#b8e986","#000000","#4a4a4a","#9b9b9b","#ffffff"],xd=214,Sw=150;function $O({color:l,onChange:t}){const[n,e]=he.useState(Dc("hex",l)),[s,r]=he.useState(l),o=he.useRef(null),a=he.useMemo(()=>({x:n.hsv.s/100*xd,y:(100-n.hsv.v)/100*Sw}),[n.hsv.s,n.hsv.v]),c=he.useMemo(()=>({x:n.hsv.h/360*xd}),[n.hsv]),i=d=>{if(r(d),/^#[0-9A-Fa-f]{6}$/i.test(d)){const p=Dc("hex",d);e(p)}},u=({x:d,y:p})=>{const h={...n.hsv,s:d/xd*100,v:100-p/Sw*100},m=Dc("hsv",h);e(m),r(m.hex)},f=({x:d})=>{const p={...n.hsv,h:d/xd*360},h=Dc("hsv",p);e(h),r(h.hex)};return he.useEffect(()=>{o.current!==null&&t&&(t(n.hex,dy),r(n.hex))},[n,t]),he.useEffect(()=>{if(l===void 0)return;const d=Dc("hex",l);e(d),r(d.hex)},[l]),ce.jsxs("div",{className:"color-picker-wrapper",style:{width:xd},ref:o,children:[ce.jsx(Oc,{label:"Hex",onChange:i,value:s}),ce.jsx("div",{className:"color-picker-basic-color",children:HO.map(d=>ce.jsx("button",{className:d===n.hex?" active":"",style:{backgroundColor:d},onClick:()=>{r(d),e(Dc("hex",d))}},d))}),ce.jsx(Ew,{className:"color-picker-saturation",style:{backgroundColor:`hsl(${n.hsv.h}, 100%, 50%)`},onChange:u,children:ce.jsx("div",{className:"color-picker-saturation_cursor",style:{backgroundColor:n.hex,left:a.x,top:a.y}})}),ce.jsx(Ew,{className:"color-picker-hue",onChange:f,children:ce.jsx("div",{className:"color-picker-hue_cursor",style:{backgroundColor:`hsl(${n.hsv.h}, 100%, 50%)`,left:c.x}})}),ce.jsx("div",{className:"color-picker-color",style:{backgroundColor:n.hex}})]})}function Ew({className:l,style:t,onChange:n,children:e}){const s=he.useRef(null),r=he.useRef(!1),o=c=>{if(s.current){const{current:i}=s,{width:u,height:f,left:d,top:p}=i.getBoundingClientRect(),h=Cw(c.clientX-d,u,0),m=Cw(c.clientY-p,f,0);n({x:h,y:m})}},a=c=>{if(c.button!==0)return;o(c);const i=f=>{r.current=!0,dy=!0,o(f)},u=f=>{r.current&&(dy=!1),document.removeEventListener("mousemove",i,!1),document.removeEventListener("mouseup",u,!1),o(f),r.current=!1};document.addEventListener("mousemove",i,!1),document.addEventListener("mouseup",u,!1)};return ce.jsx("div",{ref:s,className:l,style:t,onMouseDown:a,children:e})}function Cw(l,t,n){return l>t?t:l<n?n:l}function jw(l){if(l.startsWith("#")){if(l.length===4||l.length===5)return l=l.split("").map((t,n)=>n?t+t:"#").join(""),l;if(l.length===7||l.length===9)return l}else{const t=document.createElement("canvas").getContext("2d");if(!t)throw new Error("2d context not supported or canvas already initialized");return t.fillStyle=l,t.fillStyle}return"#000000"}function kw(l){const t=(l.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(n,e,s,r)=>"#"+e+e+s+s+r+r).substring(1).match(/.{2}/g)||[]).map(n=>parseInt(n,16));return{b:t[2],g:t[1],r:t[0]}}function fy({r:l,g:t,b:n}){l/=255,t/=255,n/=255;const e=Math.max(l,t,n),s=e-Math.min(l,t,n),r=s?(e===l?(t-n)/s+(t<n?6:0):e===t?2+(n-l)/s:4+(l-t)/s)*60:0,o=e?s/e*100:0,a=e*100;return{h:r,s:o,v:a}}function qO({h:l,s:t,v:n}){t/=100,n/=100;const e=~~(l/60),s=l/60-e,r=n*(1-t),o=n*(1-t*s),a=n*(1-t*(1-s)),c=e%6,i=Math.round([n,o,r,r,a,n][c]*255),u=Math.round([a,n,n,o,r,r][c]*255);return{b:Math.round([r,r,a,n,n,o][c]*255),g:u,r:i}}function Tw({b:l,g:t,r:n}){return"#"+[n,t,l].map(e=>e.toString(16).padStart(2,"0")).join("")}function Dc(l,t){let n=jw("#121212"),e=kw(n),s=fy(e);return l==="hex"?(n=jw(t),e=kw(n),s=fy(e)):l==="rgb"?(e=t,n=Tw(e),s=fy(e)):l==="hsv"&&(s=t,e=qO(s),n=Tw(e)),{hex:n,hsv:s,rgb:e}}function WO(l,t,...n){if(!l)throw new Error("Internal Lexical error: invariant() is meant to be replaced at compile time. There is no runtime version. Error: "+t)}function py(l){const t=l.getShape();return{columns:t.toX-t.fromX+1,rows:t.toY-t.fromY+1}}function JO(l){const t=l.getNodes(),n=[];let e=null,s=null,r=0;for(let o=0;o<t.length;o++){const a=t[o];if(vn(a)){const c=a.getParentOrThrow();if(WO(Rr(c),"Expected CellNode to have a RowNode parent"),e!==c){if(s!==null&&r!==s)return!1;e!==null&&(s=r),e=c,r=0}const i=a.__colSpan;for(let u=0;u<i;u++)n[r+u]===void 0&&(n[r+u]=0),n[r+u]+=a.__rowSpan;r+=i}}return(s===null||r===s)&&n.every(o=>o===n[0])}function VO(){const l=Ot();if(Ct(l)&&!l.isCollapsed()||ur(l)&&!l.anchor.is(l.focus)||!Ct(l)&&!ur(l))return!1;const[t]=Ao(l.anchor);return t.__colSpan>1||t.__rowSpan>1}function Ow(l){if(l.getChildrenSize()!==1)return!1;const t=l.getFirstChildOrThrow();return!(!Or(t)||!t.isEmpty())}function KO(l){const t=l.getLastDescendant();Jt(t)?t.select():Tt(t)?t.selectEnd():t!==null&&t.selectNext()}function Nw(l){return l.getEditorState().read(()=>{const t=Ot();if(Ct(t)||ur(t)){const[n]=Ao(t.anchor);if(vn(n))return n.getBackgroundColor()}return null})}function GO({onClose:l,tableCellNode:t,setIsMenuOpen:n,contextRef:e,cellMerge:s,showColorPickerModal:r}){const[o]=xn(),a=he.useRef(null),[c,i]=he.useState(t),[u,f]=he.useState({columns:1,rows:1}),[d,p]=he.useState(!1),[h,m]=he.useState(!1),[g,_]=he.useState(()=>Nw(o)||"");he.useEffect(()=>o.registerMutationListener(is,L=>{L.get(c.getKey())==="updated"&&(o.getEditorState().read(()=>{i(c.getLatest())}),_(Nw(o)||""))}),[o,c]),he.useEffect(()=>{o.getEditorState().read(()=>{const L=Ot();if(ur(L)){const O=py(L);f(py(L)),p(JO(L)&&(O.columns>1||O.rows>1))}m(VO())})},[o]),he.useEffect(()=>{const L=e.current,O=a.current,j=o.getRootElement();if(L!=null&&O!=null&&j!=null){const N=j.getBoundingClientRect(),R=L.getBoundingClientRect();O.style.opacity="1";const A=O.getBoundingClientRect(),U=5;let M=R.right+U;if(M+A.width>window.innerWidth||M+A.width>N.right){const V=R.left-A.width-U;M=(V<0?U:V)+window.pageXOffset}O.style.left=`${M+window.pageXOffset}px`;let z=R.top;if(z+A.height>window.innerHeight){const V=R.bottom-A.height;z=(V<0?U:V)+window.pageYOffset}O.style.top=`${z+ +window.pageYOffset}px`}},[e,a,o]),he.useEffect(()=>{function L(O){a.current!=null&&e.current!=null&&!a.current.contains(O.target)&&!e.current.contains(O.target)&&n(!1)}return window.addEventListener("click",L),()=>window.removeEventListener("click",L)},[n,e]);const v=he.useCallback(()=>{o.update(()=>{if(c.isAttached()){const O=Ia(c),j=o.getElementByKey(O.getKey());if(!j)throw new Error("Expected to find tableElement in DOM");const N=oT(j);N!==null&&N.clearHighlight(),O.markDirty(),i(c.getLatest())}Mn().selectStart()})},[o,c]),b=()=>{o.update(()=>{const L=Ot();if(ur(L)){const{columns:O,rows:j}=py(L),N=L.getNodes();let R=null;for(let A=0;A<N.length;A++){const U=N[A];if(vn(U))if(R===null){U.setColSpan(O).setRowSpan(j),R=U;const M=Ow(U);let z;M&&Or(z=U.getFirstChild())&&z.remove()}else vn(R)&&(Ow(U)||R.append(...U.getChildren()),U.remove())}R!==null&&(R.getChildrenSize()===0&&R.append(En()),KO(R)),l()}})},E=()=>{o.update(()=>{eT()})},S=he.useCallback(L=>{o.update(()=>{Y2(L),l()})},[o,l]),w=he.useCallback(L=>{o.update(()=>{for(let O=0;O<u.columns;O++)Z2(L);l()})},[o,l,u.columns]),y=he.useCallback(()=>{o.update(()=>{X2(),l()})},[o,l]),x=he.useCallback(()=>{o.update(()=>{Ia(c).remove(),v(),l()})},[o,c,v,l]),C=he.useCallback(()=>{o.update(()=>{Q2(),l()})},[o,l]),T=he.useCallback(()=>{o.update(()=>{const L=Ia(c),O=t1(c),j=L.getChildren();if(O>=j.length||O<0)throw new Error("Expected table cell to be inside of table row.");const N=j[O];if(!Rr(N))throw new Error("Expected table row");N.getChildren().forEach(R=>{if(!vn(R))throw new Error("Expected table cell");R.toggleHeaderStyle(Ur.ROW)}),v(),l()})},[o,c,v,l]),F=he.useCallback(()=>{o.update(()=>{const L=Ia(c),O=Lm(c),j=L.getChildren(),N=Math.max(...j.map(R=>R.getChildren().length));if(O>=N||O<0)throw new Error("Expected table cell to be inside of table row.");for(let R=0;R<j.length;R++){const A=j[R];if(!Rr(A))throw new Error("Expected table row");const U=A.getChildren();if(O>=U.length)continue;const M=U[O];if(!vn(M))throw new Error("Expected table cell");M.toggleHeaderStyle(Ur.COLUMN)}v(),l()})},[o,c,v,l]),B=he.useCallback(L=>{o.update(()=>{const O=Ot();if(Ct(O)||ur(O)){const[j]=Ao(O.anchor);if(vn(j)&&j.setBackgroundColor(L),ur(O)){const N=O.getNodes();for(let R=0;R<N.length;R++){const A=N[R];vn(A)&&A.setBackgroundColor(L)}}}})},[o]);let D=null;return s&&(d?D=ce.jsx("button",{type:"button",className:"item",onClick:()=>b(),"data-test-id":"table-merge-cells",children:"Merge cells"}):h&&(D=ce.jsx("button",{type:"button",className:"item",onClick:()=>E(),"data-test-id":"table-unmerge-cells",children:"Unmerge cells"}))),so.createPortal(ce.jsxs("div",{className:"dropdown",ref:a,onClick:L=>{L.stopPropagation()},children:[D,ce.jsx("button",{type:"button",className:"item",onClick:()=>r("Cell background color",()=>ce.jsx($O,{color:g,onChange:B})),"data-test-id":"table-background-color",children:ce.jsx("span",{className:"text",children:"Background color"})}),ce.jsx("hr",{}),ce.jsx("button",{type:"button",className:"item",onClick:()=>S(!1),"data-test-id":"table-insert-row-above",children:ce.jsxs("span",{className:"text",children:["Insert"," ",u.rows===1?"row":`${u.rows} rows`," ","above"]})}),ce.jsx("button",{type:"button",className:"item",onClick:()=>S(!0),"data-test-id":"table-insert-row-below",children:ce.jsxs("span",{className:"text",children:["Insert"," ",u.rows===1?"row":`${u.rows} rows`," ","below"]})}),ce.jsx("hr",{}),ce.jsx("button",{type:"button",className:"item",onClick:()=>w(!1),"data-test-id":"table-insert-column-before",children:ce.jsxs("span",{className:"text",children:["Insert"," ",u.columns===1?"column":`${u.columns} columns`," ","left"]})}),ce.jsx("button",{type:"button",className:"item",onClick:()=>w(!0),"data-test-id":"table-insert-column-after",children:ce.jsxs("span",{className:"text",children:["Insert"," ",u.columns===1?"column":`${u.columns} columns`," ","right"]})}),ce.jsx("hr",{}),ce.jsx("button",{type:"button",className:"item",onClick:()=>C(),"data-test-id":"table-delete-columns",children:ce.jsx("span",{className:"text",children:"Delete column"})}),ce.jsx("button",{type:"button",className:"item",onClick:()=>y(),"data-test-id":"table-delete-rows",children:ce.jsx("span",{className:"text",children:"Delete row"})}),ce.jsx("button",{type:"button",className:"item",onClick:()=>x(),"data-test-id":"table-delete",children:ce.jsx("span",{className:"text",children:"Delete table"})}),ce.jsx("hr",{}),ce.jsx("button",{type:"button",className:"item",onClick:()=>T(),children:ce.jsxs("span",{className:"text",children:[(c.__headerState&Ur.ROW)===Ur.ROW?"Remove":"Add"," ","row header"]})}),ce.jsx("button",{type:"button",className:"item",onClick:()=>F(),"data-test-id":"table-column-header",children:ce.jsxs("span",{className:"text",children:[(c.__headerState&Ur.COLUMN)===Ur.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function YO({anchorElem:l,cellMerge:t}){const[n]=xn(),e=he.useRef(null),s=he.useRef(null),[r,o]=he.useState(!1),[a,c]=he.useState(null),[i,u]=Da(),f=he.useCallback(()=>{const p=e.current,h=Ot(),m=window.getSelection(),g=document.activeElement;if(h==null||p==null){c(null);return}const _=n.getRootElement();if(Ct(h)&&_!==null&&m!==null&&_.contains(m.anchorNode)){const v=G2(h.anchor.getNode());if(v==null){c(null);return}if(n.getElementByKey(v.getKey())==null){c(null);return}c(v)}else g||c(null)},[n]);he.useEffect(()=>n.registerUpdateListener(()=>{n.getEditorState().read(()=>{f()})})),he.useEffect(()=>{const p=e.current;if(p!=null&&a!=null){const h=n.getElementByKey(a.getKey());if(h!=null){const m=h.getBoundingClientRect(),g=p.getBoundingClientRect(),_=l.getBoundingClientRect(),v=m.top-_.top+4,b=m.right-g.width-10-_.left;p.style.opacity="1",p.style.transform=`translate(${b}px, ${v}px)`}else p.style.opacity="0",p.style.transform="translate(-10000px, -10000px)"}},[e,a,n,l]);const d=he.useRef(a);return he.useEffect(()=>{d.current!==a&&o(!1),d.current=a},[d,a]),ce.jsx("div",{className:"table-cell-action-button-container",ref:e,children:a!=null&&ce.jsxs(ce.Fragment,{children:[ce.jsx("button",{type:"button",className:"table-cell-action-button chevron-down",onClick:p=>{p.stopPropagation(),o(!r)},ref:s,children:ce.jsx("i",{className:"chevron-down"})}),i,r&&ce.jsx(GO,{contextRef:s,setIsMenuOpen:o,onClose:()=>o(!1),tableCellNode:a,cellMerge:t,showColorPickerModal:u})]})})}function Aw({anchorElem:l=document.body,cellMerge:t=!1}){const n=oy();return so.createPortal(n?ce.jsx(YO,{anchorElem:l,cellMerge:t}):null,l)}const xR="",ZO=33,XO=50;function QO({editor:l}){const t=he.useRef(null),n=he.useRef(null),e=he.useRef(null),s=he.useRef(null),[r,o]=he.useState(null),[a,c]=he.useState(null),[i,u]=he.useState(!1),[f,d]=he.useState(null);he.useEffect(()=>l.registerCommand(bi,S=>{const w=Ot(),y=ur(w);return i!==y&&u(y),!1},xi));const p=he.useCallback(()=>{c(null),t.current=null,d(null),s.current=null,e.current=null},[]);he.useEffect(()=>{const S=w=>{setTimeout(()=>{const y=w.target;if(f){o({x:w.clientX,y:w.clientY});return}if(!(n.current&&n.current.contains(y))&&t.current!==y){t.current=y;const x=zm(y);x&&a!==x?l.update(()=>{const C=po(x.elem);if(!C)return;const T=Ia(C),F=l.getElementByKey(T.getKey());if(!F){console.error("TableCellResizer: Table element not found.");return}t.current=y,e.current=F.getBoundingClientRect(),c(x)}):x==null&&p()}},0)};return document.addEventListener("mousemove",S),()=>{document.removeEventListener("mousemove",S)}},[a,f,l,p]);const h=S=>S==="bottom",m=he.useCallback(S=>{if(!a){console.error("TableCellResizer: Expected active cell.");return}l.update(()=>{const w=po(a.elem);if(!vn(w)){console.error("TableCellResizer: Table cell node not found.");return}const y=Ia(w),x=t1(w),C=y.getChildren();if(x>=C.length||x<0){console.error("Expected table cell to be inside of table row.");return}const T=C[x];if(!Rr(T)){console.error("Expected table row");return}T.setHeight(S)})},[a,l]),g=he.useCallback(S=>{if(!a){console.error("TableCellResizer: Expected active cell.");return}l.update(()=>{const w=po(a.elem);if(!vn(w)){console.error("TableCellResizer: Table cell node not found.");return}const y=Ia(w),x=Lm(w),C=y.getChildren();for(let T=0;T<C.length;T++){const F=C[T];if(!Rr(F)){console.error("Expected table row");return}const B=F.getChildren(),O=B.map(N=>N.getColSpan()).reduce((N,R)=>{const A=N[N.length-1]??0;return N.push(A+R),N},[]).findIndex(N=>N>x);if(O>=B.length||O<0){console.error("Expected table cell to be inside of table row.");return}const j=B[O];if(!vn(j)){console.error("Expected table cell");return}j.setWidth(S)}})},[a,l]),_=he.useCallback(S=>{const w=y=>{if(y.preventDefault(),y.stopPropagation(),!a){console.error("TableCellResizer: Expected active cell.");return}if(s.current){const{x,y:C}=s.current;if(a===null)return;if(h(S)){const T=a.elem.getBoundingClientRect().height,F=Math.abs(y.clientY-C),B=S==="bottom"&&C>y.clientY;m(Math.max(B?T-F:F+T,ZO))}else{const T=getComputedStyle(a.elem);let F=a.elem.clientWidth;F-=parseFloat(T.paddingLeft)+parseFloat(T.paddingRight);const B=Math.abs(y.clientX-x),D=S==="right"&&x>y.clientX;g(Math.max(D?F-B:B+F,XO))}p(),document.removeEventListener("mouseup",w)}};return w},[a,p,g,m]),v=he.useCallback(S=>w=>{if(w.preventDefault(),w.stopPropagation(),!a){console.error("TableCellResizer: Expected active cell.");return}s.current={x:w.clientX,y:w.clientY},o(s.current),d(S),document.addEventListener("mouseup",_(S))},[a,_]),E=he.useCallback(()=>{if(a){const{height:S,width:w,top:y,left:x}=a.elem.getBoundingClientRect(),C={bottom:{backgroundColor:"none",cursor:"row-resize",height:"10px",left:`${window.pageXOffset+x}px`,top:`${window.pageYOffset+y+S}px`,width:`${w}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${S}px`,left:`${window.pageXOffset+x+w}px`,top:`${window.pageYOffset+y}px`,width:"10px"}},T=e.current;return f&&r&&T&&(h(f)?(C[f].left=`${window.pageXOffset+T.left}px`,C[f].top=`${window.pageYOffset+r.y}px`,C[f].height="3px",C[f].width=`${T.width}px`):(C[f].top=`${window.pageYOffset+T.top}px`,C[f].left=`${window.pageXOffset+r.x}px`,C[f].width="3px",C[f].height=`${T.height}px`),C[f].backgroundColor="#adf"),C}return{bottom:null,left:null,right:null,top:null}},[a,f,r])();return ce.jsx("div",{ref:n,children:a!=null&&!i&&ce.jsxs(ce.Fragment,{children:[ce.jsx("div",{className:"TableCellResizer__resizer TableCellResizer__ui",style:E.right||void 0,onMouseDown:v("right")}),ce.jsx("div",{className:"TableCellResizer__resizer TableCellResizer__ui",style:E.bottom||void 0,onMouseDown:v("bottom")})]})})}function Pw({isEditable:l=!0}){const[t]=xn();return he.useMemo(()=>l?so.createPortal(ce.jsx(QO,{editor:t}),document.body):null,[t,l])}const Iw=or.createContext(null),Mw=4;function bo({children:l,className:t,onClick:n,title:e}){const s=he.useRef(null),r=or.useContext(Iw);if(r===null)throw new Error("DropDownItem must be used within a DropDown");const{registerItem:o}=r;return he.useEffect(()=>{s&&s.current&&o(s)},[s,o]),ce.jsx("button",{className:t,onClick:n,ref:s,title:e,type:"button",children:l})}function eN({children:l,dropDownRef:t,onClose:n}){const[e,s]=he.useState(),[r,o]=he.useState(),a=he.useCallback(u=>{s(f=>f?[...f,u]:[u])},[s]),c=u=>{if(!e)return;const f=u.key;["Escape","ArrowUp","ArrowDown","Tab"].includes(f)&&u.preventDefault(),f==="Escape"||f==="Tab"?n():f==="ArrowUp"?o(d=>{if(!d)return e[0];const p=e.indexOf(d)-1;return e[p===-1?e.length-1:p]}):f==="ArrowDown"&&o(d=>d?e[e.indexOf(d)+1]:e[0])},i=he.useMemo(()=>({registerItem:a}),[a]);return he.useEffect(()=>{e&&!r&&o(e[0]),r&&r.current&&r.current.focus()},[e,r]),ce.jsx(Iw.Provider,{value:i,children:ce.jsx("div",{className:"dropdown",ref:t,onKeyDown:c,children:l})})}function Sd({disabled:l=!1,buttonLabel:t,buttonAriaLabel:n,buttonClassName:e,buttonIconClassName:s,children:r,stopCloseOnClickSelf:o}){const a=he.useRef(null),c=he.useRef(null),[i,u]=he.useState(!1),f=()=>{u(!1),c&&c.current&&c.current.focus()};return he.useEffect(()=>{const d=c.current,p=a.current;if(i&&d!==null&&p!==null){const{top:h,left:m}=d.getBoundingClientRect();p.style.top=`${h+d.offsetHeight+Mw}px`,p.style.left=`${Math.min(m,window.innerWidth-p.offsetWidth-20)}px`}},[a,c,i]),he.useEffect(()=>{const d=c.current;if(d!==null&&i){const p=h=>{const m=h.target;o&&a.current&&a.current.contains(m)||d.contains(m)||u(!1)};return document.addEventListener("click",p),()=>{document.removeEventListener("click",p)}}},[a,c,i,o]),he.useEffect(()=>{const d=()=>{if(i){const p=c.current,h=a.current;if(p!==null&&h!==null){const{top:m}=p.getBoundingClientRect(),g=m+p.offsetHeight+Mw;g!==h.getBoundingClientRect().top&&(h.style.top=`${g}px`)}}};return document.addEventListener("scroll",d),()=>{document.removeEventListener("scroll",d)}},[c,a,i]),ce.jsxs(ce.Fragment,{children:[ce.jsxs("button",{type:"button",disabled:l,"aria-label":n||t,className:e,onClick:()=>u(!i),ref:c,children:[s&&ce.jsx("span",{className:s}),t&&ce.jsx("span",{className:"text dropdown-button-text",children:t}),ce.jsx("i",{className:"chevron-down"})]}),i&&so.createPortal(ce.jsx(eN,{dropDownRef:a,onClose:f,children:r}),document.body)]})}function Dw(l){const t=l.anchor,n=l.focus,e=l.anchor.getNode(),s=l.focus.getNode();return e===s?e:l.isBackward()?lb(n)?e:s:lb(t)?e:s}function tN(l){let t=1;(()=>{l.update(()=>{Mn().getChildren().forEach(()=>{Mn().getChildren().filter(a=>{Km(a)&&(t=a.__pageNumber)})}),console.log("page0",t+1);const s=w1(),r=Ot();r!==null&&Ct(r)&&(r.anchor.getNode().getTopLevelElementOrThrow().insertAfter(s),s.selectEnd())})})()}const Rw=8,Lw=72,Ra={h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",paragraph:"Normal"},nN=({selectionFontSize:l,disabled:t,editor:n,blockType:e,styleConfig:s,isenterPressed:r,currentElementClick:o,currentElementSelect:a,wpAndTaskId:c})=>{const[i,u]=or.useState(l),[f,d]=or.useState(e),[p,h]=or.useState("");or.useState([]),or.useState("");const{heading:m}=s||{},g=S=>{S&&S.title&&n.update(()=>{if(n.isEditable()){const w=Ot();w&&vm(w,S)}})},_=S=>{u(S.target.value)},v=()=>{const S=Number(i);if(!isNaN(S)){const w=Math.min(Math.max(S,Rw),Lw);u(String(w)),g({"font-size":`${w}px`})}},b=S=>{var y,x,C,T,F;h(S),n.update(()=>{const B=Ot();Ct(B)&&u2(B,()=>El(S,c))});let w=null;if(m)switch(S){case"h1":w=((y=m.find(B=>B.title==="Heading1"))==null?void 0:y.fontSize)??56;break;case"h2":w=((x=m.find(B=>B.title==="Heading2"))==null?void 0:x.fontSize)??14;break;case"h3":w=((C=m.find(B=>B.title==="Heading3"))==null?void 0:C.fontSize)??12;break;case"h4":w=((T=m.find(B=>B.title==="Heading4"))==null?void 0:T.fontSize)??12;break;case"h5":w=((F=m.find(B=>B.title==="Heading5"))==null?void 0:F.fontSize)??12;break;case"paragraph":w=15;break;default:w=15}u(w),h(S),d(S)},E=()=>{u("15")};return or.useEffect(()=>{E()},[r]),or.useEffect(()=>{const S=()=>{n.update(()=>{const w=Ot();if(w!==null){const x=w.getNodes()[0];if(!Jt(x)){const C=x.getType();C in Ra&&d(C)}}})};return n.registerUpdateListener(S),()=>{n.registerUpdateListener(S)}},[n]),or.useEffect(()=>{var S,w,y,x,C;switch(o.tagName){case"P":d("paragraph"),u("15");break;case"H1":d("h1");const T=((S=s.heading.find(O=>O.title==="Heading1"))==null?void 0:S.fontSize)??"16";u(T);break;case"H2":d("h2");const F=((w=s.heading.find(O=>O.title==="Heading2"))==null?void 0:w.fontSize)??"14";u(F);break;case"H3":d("h3");const B=((y=s.heading.find(O=>O.title==="Heading3"))==null?void 0:y.fontSize)??"12";u(B);break;case"H4":d("h4");const D=((x=s.heading.find(O=>O.title==="Heading4"))==null?void 0:x.fontSize)??"12";u(D);break;case"H5":d("h5");const L=((C=s.heading.find(O=>O.title==="Heading5"))==null?void 0:C.fontSize)??"12";u(L);break;default:d("paragraph"),u("15");break}},[o]),or.useEffect(()=>{var w,y,x,C,T;if(!a){u("15"),d("paragraph");return}switch(a.trim()){case"P":u("15"),d("paragraph");break;case"h1":d("h1");const F=((w=s.heading.find(j=>j.title==="Heading1"))==null?void 0:w.fontSize)??"16";u(F);break;case"h2":d("h2");const B=((y=s.heading.find(j=>j.title==="Heading2"))==null?void 0:y.fontSize)??"14";u(B);break;case"h3":d("h3");const D=((x=s.heading.find(j=>j.title==="Heading3"))==null?void 0:x.fontSize)??"12";u(D);break;case"h4":d("h4");const L=((C=s.heading.find(j=>j.title==="Heading4"))==null?void 0:C.fontSize)??"12";u(L);break;case"h5":d("h5");const O=((T=s.heading.find(j=>j.title==="Heading5"))==null?void 0:T.fontSize)??"12";u(O);break;default:d("paragraph"),u("15");break}},[a]),ce.jsxs(ce.Fragment,{children:[s&&s.heading?ce.jsxs(Sd,{disabled:t,buttonClassName:"toolbar-item block-controls",buttonAriaLabel:"Formatting options for text style",buttonIconClassName:"icon block-type "+f,buttonLabel:Ra[f],children:[ce.jsxs(bo,{className:`item ${f==="paragraph"?"active":""}`,onClick:()=>b("paragraph"),children:[ce.jsx("i",{className:"icon paragraph"}),ce.jsx("span",{className:"text",children:Ra.paragraph})]}),s.heading&&s.heading.find(S=>S.title==="Heading1")&&ce.jsxs(bo,{className:`item ${f==="h1"?"active":""}`,onClick:()=>b("h1"),children:[ce.jsx("i",{className:"icon h1"}),ce.jsx("span",{className:"text",children:Ra.h1})]}),s.heading&&s.heading.find(S=>S.title==="Heading2")&&ce.jsxs(bo,{className:`item ${f==="h2"?"active":""}`,onClick:()=>b("h2"),children:[ce.jsx("i",{className:"icon h2"}),ce.jsx("span",{className:"text",children:Ra.h2})]}),s.heading&&s.heading.find(S=>S.title==="Heading3")&&ce.jsxs(bo,{className:`item ${f==="h3"?"active":""}`,onClick:()=>b("h3"),children:[ce.jsx("i",{className:"icon h3"}),ce.jsx("span",{className:"text",children:Ra.h3})]}),s.heading&&s.heading.find(S=>S.title==="Heading4")&&ce.jsxs(bo,{className:`item ${f==="h4"?"active":""}`,onClick:()=>b("h4"),children:[ce.jsx("i",{className:"icon h4"}),ce.jsx("span",{className:"text",children:Ra.h4})]}),s.heading&&s.heading.find(S=>S.title==="Heading5")&&ce.jsxs(bo,{className:`item ${f==="h5"?"active":""}`,onClick:()=>b("h5"),children:[ce.jsx("i",{className:"icon h5"}),ce.jsx("span",{className:"text",children:Ra.h5})]})]}):"",ce.jsx("input",{style:{width:"60px"},title:"Font Size",type:"text",value:i,disabled:t,readOnly:!0,className:"toolbar-item font-size-input input-font-size-value",min:Rw,max:Lw,onChange:_,onBlur:v})]})},rN=Ic&&"documentMode"in document?document.documentMode:null,La=Ic&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);Ic&&"InputEvent"in window&&!rN&&"getTargetRanges"in new window.InputEvent("input");const oN="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPg0KPHN2ZyB3aWR0aD0iODAwcHgiIGhlaWdodD0iODAwcHgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCjxwYXRoIGQ9Ik0xMi41NTM1IDE2LjUwNjFDMTIuNDExNCAxNi42NjE1IDEyLjIxMDYgMTYuNzUgMTIgMTYuNzVDMTEuNzg5NCAxNi43NSAxMS41ODg2IDE2LjY2MTUgMTEuNDQ2NSAxNi41MDYxTDcuNDQ2NDggMTIuMTMxMUM3LjE2Njk4IDExLjgyNTQgNy4xODgyMiAxMS4zNTEgNy40OTM5MiAxMS4wNzE1QzcuNzk5NjMgMTAuNzkyIDguMjc0MDIgMTAuODEzMiA4LjU1MzUyIDExLjExODlMMTEuMjUgMTQuMDY4MlYzQzExLjI1IDIuNTg1NzkgMTEuNTg1OCAyLjI1IDEyIDIuMjVDMTIuNDE0MiAyLjI1IDEyLjc1IDIuNTg1NzkgMTIuNzUgM1YxNC4wNjgyTDE1LjQ0NjUgMTEuMTE4OUMxNS43MjYgMTAuODEzMiAxNi4yMDA0IDEwLjc5MiAxNi41MDYxIDExLjA3MTVDMTYuODExOCAxMS4zNTEgMTYuODMzIDExLjgyNTQgMTYuNTUzNSAxMi4xMzExTDEyLjU1MzUgMTYuNTA2MVoiIGZpbGw9IiMxQzI3NEMiLz4NCjxwYXRoIGQ9Ik0zLjc1IDE1QzMuNzUgMTQuNTg1OCAzLjQxNDIyIDE0LjI1IDMgMTQuMjVDMi41ODU3OSAxNC4yNSAyLjI1IDE0LjU4NTggMi4yNSAxNVYxNS4wNTQ5QzIuMjQ5OTggMTYuNDIyNSAyLjI0OTk2IDE3LjUyNDggMi4zNjY1MiAxOC4zOTE4QzIuNDg3NTQgMTkuMjkxOSAyLjc0NjQzIDIwLjA0OTcgMy4zNDgzNSAyMC42NTE2QzMuOTUwMjcgMjEuMjUzNiA0LjcwODE0IDIxLjUxMjUgNS42MDgyNSAyMS42MzM1QzYuNDc1MjIgMjEuNzUgNy41Nzc1NCAyMS43NSA4Ljk0NTEzIDIxLjc1SDE1LjA1NDlDMTYuNDIyNSAyMS43NSAxNy41MjQ4IDIxLjc1IDE4LjM5MTggMjEuNjMzNUMxOS4yOTE5IDIxLjUxMjUgMjAuMDQ5NyAyMS4yNTM2IDIwLjY1MTcgMjAuNjUxNkMyMS4yNTM2IDIwLjA0OTcgMjEuNTEyNSAxOS4yOTE5IDIxLjYzMzUgMTguMzkxOEMyMS43NSAxNy41MjQ4IDIxLjc1IDE2LjQyMjUgMjEuNzUgMTUuMDU0OVYxNUMyMS43NSAxNC41ODU4IDIxLjQxNDIgMTQuMjUgMjEgMTQuMjVDMjAuNTg1OCAxNC4yNSAyMC4yNSAxNC41ODU4IDIwLjI1IDE1QzIwLjI1IDE2LjQzNTQgMjAuMjQ4NCAxNy40MzY1IDIwLjE0NjkgMTguMTkxOUMyMC4wNDgyIDE4LjkyNTcgMTkuODY3OCAxOS4zMTQyIDE5LjU5MSAxOS41OTFDMTkuMzE0MiAxOS44Njc4IDE4LjkyNTcgMjAuMDQ4MiAxOC4xOTE5IDIwLjE0NjlDMTcuNDM2NSAyMC4yNDg0IDE2LjQzNTQgMjAuMjUgMTUgMjAuMjVIOUM3LjU2NDU5IDIwLjI1IDYuNTYzNDcgMjAuMjQ4NCA1LjgwODEyIDIwLjE0NjlDNS4wNzQzNSAyMC4wNDgyIDQuNjg1NzcgMTkuODY3OCA0LjQwOTAxIDE5LjU5MUM0LjEzMjI1IDE5LjMxNDIgMy45NTE4IDE4LjkyNTcgMy44NTMxNSAxOC4xOTE5QzMuNzUxNTkgMTcuNDM2NSAzLjc1IDE2LjQzNTQgMy43NSAxNVoiIGZpbGw9IiMxQzI3NEMiLz4NCjwvc3ZnPg==";var Fw={exports:{}};(function(l,t){(function(n,e){e()})(ya,function(){function n(i,u){return typeof u>"u"?u={autoBom:!1}:typeof u!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),u={autoBom:!u}),u.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(i.type)?new Blob(["\uFEFF",i],{type:i.type}):i}function e(i,u,f){var d=new XMLHttpRequest;d.open("GET",i),d.responseType="blob",d.onload=function(){c(d.response,u,f)},d.onerror=function(){console.error("could not download file")},d.send()}function s(i){var u=new XMLHttpRequest;u.open("HEAD",i,!1);try{u.send()}catch{}return 200<=u.status&&299>=u.status}function r(i){try{i.dispatchEvent(new MouseEvent("click"))}catch{var u=document.createEvent("MouseEvents");u.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),i.dispatchEvent(u)}}var o=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof ya=="object"&&ya.global===ya?ya:void 0,a=o.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),c=o.saveAs||(typeof window!="object"||window!==o?function(){}:"download"in HTMLAnchorElement.prototype&&!a?function(i,u,f){var d=o.URL||o.webkitURL,p=document.createElement("a");u=u||i.name||"download",p.download=u,p.rel="noopener",typeof i=="string"?(p.href=i,p.origin===location.origin?r(p):s(p.href)?e(i,u,f):r(p,p.target="_blank")):(p.href=d.createObjectURL(i),setTimeout(function(){d.revokeObjectURL(p.href)},4e4),setTimeout(function(){r(p)},0))}:"msSaveOrOpenBlob"in navigator?function(i,u,f){if(u=u||i.name||"download",typeof i!="string")navigator.msSaveOrOpenBlob(n(i,f),u);else if(s(i))e(i,u,f);else{var d=document.createElement("a");d.href=i,d.target="_blank",setTimeout(function(){r(d)})}}:function(i,u,f,d){if(d=d||open("","_blank"),d&&(d.document.title=d.document.body.innerText="downloading..."),typeof i=="string")return e(i,u,f);var p=i.type==="application/octet-stream",h=/constructor/i.test(o.HTMLElement)||o.safari,m=/CriOS\/[\d]+/.test(navigator.userAgent);if((m||p&&h||a)&&typeof FileReader<"u"){var g=new FileReader;g.onloadend=function(){var b=g.result;b=m?b:b.replace(/^data:[^;]*;/,"data:attachment/file;"),d?d.location.href=b:location=b,d=null},g.readAsDataURL(i)}else{var _=o.URL||o.webkitURL,v=_.createObjectURL(i);d?d.location=v:location.href=v,d=null,setTimeout(function(){_.revokeObjectURL(v)},4e4)}});o.saveAs=c.saveAs=c,l.exports=c})})(Fw);var iN=Fw.exports;function sN(l){const t=document.createElement("div");return t.innerHTML=l,t.querySelectorAll("*").forEach(e=>{let s="";if(e.classList.contains("PlaygroundEditorTheme__textItalic")&&e.classList.contains("PlaygroundEditorTheme__textStrikethrough")){s+="text-decoration: line-through; ";const r=document.createElement("span");r.style.cssText=s.trim();const o=document.createElement("i");o.innerHTML=e.innerHTML,r.appendChild(o),e.innerHTML="",e.appendChild(r)}else if(e.classList.contains("PlaygroundEditorTheme__textBold")&&e.classList.contains("PlaygroundEditorTheme__textItalic")&&e.classList.contains("PlaygroundEditorTheme__textStrikethrough")){s+="text-decoration: line-through; ";const r=document.createElement("span");r.style.cssText=s.trim();const o=document.createElement("i"),a=document.createElement("strong");a.innerHTML=e.innerHTML,o.appendChild(a),r.appendChild(o),e.innerHTML="",e.appendChild(r)}else{if(e.classList.contains("PlaygroundEditorTheme__textStrikethrough")&&(s+="text-decoration: line-through; "),e.classList.contains("PlaygroundEditorTheme__textUnderlineStrikethrough")&&(s+="text-decoration: line-through underline; "),e.classList.contains("PlaygroundEditorTheme__textBold")){const r=document.createElement("strong");r.innerHTML=e.innerHTML,e.innerHTML="",e.appendChild(r)}if(e.classList.contains("PlaygroundEditorTheme__textItalic")){const r=document.createElement("i");r.innerHTML=e.innerHTML,e.innerHTML="",e.appendChild(r)}if(e.classList.contains("PlaygroundEditorTheme__textUnderline")){const r=document.createElement("u");r.innerHTML=e.innerHTML,e.innerHTML="",e.appendChild(r)}if(s){const r=document.createElement("span");r.style.cssText=s.trim(),r.innerHTML=e.innerHTML,e.innerHTML="",e.appendChild(r)}}}),t.innerHTML}function aN(l){const t=document.createElement("div");t.innerHTML=l;const n=t.querySelectorAll(".PlaygroundEditorTheme__table");return n.length===0?l:(n.forEach(e=>{e.style.width="100%",e.style.borderCollapse="collapse",e.style.border="1px solid black",e.style.fontFamily="Calibri, sans-serif",e.style.fontSize="11pt",e.querySelectorAll("tr").forEach((r,o)=>{r.style.border="1px solid black";const a=r.querySelectorAll("td, th"),i=100/a.length+"%";a.forEach(u=>{u.style.width=i,u.style.height="20px",u.style.border="1px solid black",u.style.padding="5px 8px",u.style.textAlign="left",u.style.verticalAlign="middle",u.innerHTML.trim()||(u.innerHTML="&nbsp;"),u.querySelectorAll(".PlaygroundEditorTheme__textUnderline").forEach(p=>{p.style.textDecoration="underline"}),u.querySelectorAll(".PlaygroundEditorTheme__textStrikethrough").forEach(p=>{p.style.textDecoration="line-through"}),u.classList.contains("PlaygroundEditorTheme__tableCellHeader")&&(u.style.fontWeight="bold",u.style.backgroundColor="#d9d9d9",u.style.textAlign="center")})})}),t.innerHTML)}function Bw(l){return l=l.replace(/<br\s*\/?>/g,""),l.includes("Crop")&&(l=l.replace(/Crop/g,"")),l}function zw(l){const n=new DOMParser().parseFromString(l,"text/html"),e=s=>{if(!s.length)return;const[r,...o]=s,a=r.children.length===1&&r.children[0].tagName==="P";if(r.querySelector("table")!==null){const i=r.querySelectorAll("table"),u=document.createDocumentFragment();i.forEach(f=>u.appendChild(f.cloneNode(!0))),r.replaceWith(u)}else if(a){const i=r.children[0],u=i.innerHTML.trim();u===""||/^<br\s*\/?>$/i.test(u)?r.replaceWith(i):i.replaceWith(...i.childNodes)}e(o)};return e(Array.from(n.querySelectorAll("h1, h2, h3, h4, h5, h6"))),n.body.innerHTML}const lN=async(l,t,n,e)=>{await cN({title:t,parsedHtmlString:e,styleConfig:n})},cN=async({title:l,parsedHtmlString:t,styleConfig:n})=>{const e=`<!DOCTYPE html><html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head><meta charset="UTF-8"><title>Document</title>
67
+ <style>
68
+ body {
69
+ font-family: "Times New Roman", Times, serif;
70
+ font-size: 14.5px;
71
+ }
72
+ </style>
73
+ </head><body>`,s="</body></html>",r=t||Tl(".ContentEditable__root").html(),o=aN(r),a=sN(o),c=await uN(a,n),i=e+c+s,u=new Blob([i],{type:"application/msword"});iN.saveAs(u,`${l||"Exported"}.doc`)};async function uN(l,t){const e=new DOMParser().parseFromString(l,"text/html"),{heading:s}=t,r={h1:s.find(a=>a.title==="Heading1")||{},h2:s.find(a=>a.title==="Heading2")||{},h3:s.find(a=>a.title==="Heading3")||{},h4:s.find(a=>a.title==="Heading4")||{},h5:s.find(a=>a.title==="Heading5")||{}};return Object.entries(r).forEach(([a,c])=>{e.querySelectorAll(a).forEach(u=>{let f="";c.fontColor&&(f+=`color: ${c.fontColor};`),c.fontFamily&&(f+=`font-family: ${c.fontFamily};`),c.fontSize&&(f+=`font-size: ${c.fontSize}px;`),c.bold==="Yes"&&(f+="font-weight: bold;"),c.italic==="Yes"&&(f+="font-style: italic;"),c.lineSpacing&&(f+=`line-height: ${c.lineSpacing};`),c.alignment&&(f+=`text-align: ${c.alignment.toLowerCase()};`),(a==="h2"||a==="h3")&&(f+="text-transform: uppercase;"),u.style.cssText+=f})}),await fN(e.body.innerHTML)}function dN(){const l=document.createElement("div");return l.style.position="absolute",l.style.visibility="hidden",l.style.pointerEvents="none",l.style.width="1000px",l.style.zIndex=-1,document.body.appendChild(l),l}async function fN(l){const t=dN();t.innerHTML=l;const n=t.querySelectorAll("img"),e=Array.from(n).map(r=>new Promise(o=>{r.complete?o():(r.onload=o,r.onerror=o)}));await Promise.all(e),n.forEach(r=>{const o=r.offsetWidth,a=r.offsetHeight,c=600;o>c?(r.setAttribute("width",c),r.removeAttribute("height"),r.style.width=`${c}px`,r.style.height="auto"):(r.setAttribute("width",o),r.setAttribute("height",a),r.style.width=`${o}px`,r.style.height=`${a}px`)});const s=t.innerHTML;return document.body.removeChild(t),s}const pN="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iY3VycmVudENvbG9yIiBjbGFzcz0iYmkgYmktbGlzdC11bCI+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNSAxMS41YS41LjUgMCAwIDEgLjUtLjVoOWEuNS41IDAgMCAxIDAgMWgtOWEuNS41IDAgMCAxLS41LS41em0wLTRhLjUuNSAwIDAgMSAuNS0uNWg5YS41LjUgMCAwIDEgMCAxaC05YS41LjUgMCAwIDEtLjUtLjV6bTAtNGEuNS41IDAgMCAxIC41LS41aDlhLjUuNSAwIDAgMSAwIDFoLTlhLjUuNSAwIDAgMS0uNS0uNXptLTMgMWExIDEgMCAxIDAgMC0yIDEgMSAwIDAgMCAwIDJ6bTAgNGExIDEgMCAxIDAgMC0yIDEgMSAwIDAgMCAwIDJ6bTAgNGExIDEgMCAxIDAgMC0yIDEgMSAwIDAgMCAwIDJ6Ii8+PC9zdmc+",hN="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iY3VycmVudENvbG9yIiBjbGFzcz0iYmkgYmktbGlzdC1vbCI+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNSAxMS41YS41LjUgMCAwIDEgLjUtLjVoOWEuNS41IDAgMCAxIDAgMWgtOWEuNS41IDAgMCAxLS41LS41em0wLTRhLjUuNSAwIDAgMSAuNS0uNWg5YS41LjUgMCAwIDEgMCAxaC05YS41LjUgMCAwIDEtLjUtLjV6bTAtNGEuNS41IDAgMCAxIC41LS41aDlhLjUuNSAwIDAgMSAwIDFoLTlhLjUuNSAwIDAgMS0uNS0uNXoiLz48cGF0aCBkPSJNMS43MTMgMTEuODY1di0uNDc0SDJjLjIxNyAwIC4zNjMtLjEzNy4zNjMtLjMxNyAwLS4xODUtLjE1OC0uMzEtLjM2MS0uMzEtLjIyMyAwLS4zNjcuMTUyLS4zNzMuMzFoLS41OWMuMDE2LS40NjcuMzczLS43ODcuOTg2LS43ODcuNTg4LS4wMDIuOTU0LjI5MS45NTcuNzAzYS41OTUuNTk1IDAgMCAxLS40OTIuNTk0di4wMzNhLjYxNS42MTUgMCAwIDEgLjU2OS42MzFjLjAwMy41MzMtLjUwMi44LTEuMDUxLjgtLjY1NiAwLTEtLjM3LTEuMDA4LS43OTRoLjU4MmMuMDA4LjE3OC4xODYuMzA2LjQyMi4zMDkuMjU0IDAgLjQyNC0uMTQ1LjQyMi0uMzUtLjAwMi0uMTk1LS4xNTUtLjM0OC0uNDE0LS4zNDhoLS4zem0tLjAwNC00LjY5OWgtLjYwNHYtLjAzNWMwLS40MDguMjk1LS44NDQuOTU4LS44NDQuNTgzIDAgLjk2LjMyNi45Ni43NTYgMCAuMzg5LS4yNTcuNjE3LS40NzYuODQ4bC0uNTM3LjU3MnYuMDNoMS4wNTRWOUgxLjE0M3YtLjM5NWwuOTU3LS45OWMuMTM4LS4xNDIuMjkzLS4zMDQuMjkzLS41MDggMC0uMTgtLjE0Ny0uMzItLjM0Mi0uMzJhLjMzLjMzIDAgMCAwLS4zNDIuMzM4di4wNDF6TTIuNTY0IDVoLS42MzVWMi45MjRoLS4wMzFsLS41OTguNDJ2LS41NjdsLjYyOS0uNDQzaC42MzVWNXoiLz48L3N2Zz4=",gN=({onlUser:l,collabApiKey:t,htmlPasteModalOpen:n,sethtmlPasteModalOpen:e,passedContent:s,onPaste:r,source:o})=>{he.useRef(null);const[a,c]=he.useState(""),[i,u]=he.useState(""),[f]=xn(),d=he.useRef();he.useRef(null);const p=()=>{u({root:{type:"root",version:1,children:[{children:[],direction:"ltr",format:"",indent:0,type:"text",version:1}],direction:"ltr",format:"",indent:0}}),c("")};he.useEffect(()=>{p()},[]);const h=()=>{e(!1),c(" "),p()},m=C=>{const T=/display:\s*([^;]+);/,F=C.match(T);if(F)return F[1]};function g(){const[C]=xn(),T=(B,D)=>{C.update(()=>{const L=En(),O=ir(`${B}`);O.setStyle(D.style),O.setFormat(D.format),L.append(O),C.getRootElement()&&B&&B.length>0&&(C.getEditorState().read(()=>Mn()),xl(L))})},F=()=>{let B=y(a);b(a),B.root.children.map((D,L)=>{if(D&&D.text&&D.text.trim("")&&D.text.trim("").length>1&&D.style&&D.style.length>10&&m(D.style)==="block"){let O=D.order.split("_")[1];setTimeout(()=>{T(D.text.trim(""),D)},O*2)}}),h()};return ce.jsx("button",{onClick:F,ref:d,style:{display:"none"}})}function _(C,T){const F=/font-weight:\s*([a-zA-Z0-9\-]+);/,B=/text-decoration:\s*([^;]+?)(?=\s*;|\s*$)/,D=/font-style:\s*([a-zA-Z0-9\-]+);/,L=/font-size:\s*([\d.]+(?:px|pt|em|rem|%)?)/,O=/color:\s*([^;]+)/,j=C.match(F),N=C.match(B),R=C.match(D),A=C.match(L),U=C.match(O),M=j?j[1]:null,z=N?N[1]:null,V=R?R[1]:null,K=A?A[1]:null,P=U?U[1]:null;let W={"font-weight":M&&M!==null?M:"none","text-decoration":z&&z!==null?z:"none","font-style":V&&V!==null?V:"none","font-size":"none",display:["span","table","tbody","tr","td"].includes(T)?"block":"none",color:P&&P!=="transparent"?P:"black"};function H(Z){return Object.entries(Z).map(([Q,G])=>`${Q}: ${G};`).join(" ")}return{cssString:H(W),fontSize:K&&K!==null?K:"none",fontWeight:M&&M!==null?M:"none",fontStyle:V&&V!==null?V:"none",textDecoration:z&&z!==null?z:"none"}}const v=(C,T)=>{const F=new RegExp(`${T}:\\s*([^;]+)`),B=C.match(F);return B?B[1].trim():null},b=C=>{const T=new DOMParser,F=w(C),D=T.parseFromString(F,"text/html").querySelectorAll("img");Array.from(D).map(L=>{const N=L.getAttribute("id").split("_")[1]*2;setTimeout(()=>{f.update(()=>{const R=L.src,A=L.textContent,M=kc({src:R,altText:A});Mn(),xl(M)})},N)})};function E(C,T){const F=Array.from(C.querySelectorAll("tr")),L=C.getAttribute("id").split("_")[1]*2;setTimeout(()=>{T.update(()=>{const O=Sp();F.forEach(N=>{const R=jl();Array.from(N.querySelectorAll("td")).forEach(U=>{const M=Si();let K=Array.from(U.querySelectorAll("span")).map(Q=>{const G=Q.getAttribute("style")||"";return{text:Q.innerText.trim(),style:G}}).map(Q=>Q.style).filter(Q=>Q).map(Q=>Q.split(";").map(G=>G.trim()).filter(G=>!G.startsWith("font-family")).filter(G=>!G.startsWith("font-size")).filter(G=>!G.startsWith("border")).filter(G=>!G.startsWith("width")).join("; ")).join("; ");const P=v(K,"font-weight"),q=v(K,"font-style"),W=v(K,"text-decoration");K=`${K}; font-weight: ${P}`,K=`${K}; font-style: ${q}`,K=`${K}; color: black`,K=`${K}; text-decoration: ${W}`;const H=ir(U.innerText.trim()),Y=S(P,q,W);H.setFormat(Y),K&&H.setStyle(K);const Z=En();Z.append(H),M.append(Z),R.append(M)}),O.append(R)}),Mn()&&xl(O)})},L)}function S(C,T,F){return C==="bold"&&T==="italic"&&F==="underline line-through"?15:F==="underline line-through"?12:T==="italic"&&F==="line-through"?6:T==="italic"&&F==="underline"?11:C==="bold"&&F==="line-through"?5:C==="bold"&&F==="underline"?9:C==="bold"&&T==="italic"?3:C==="bold"?1:T==="italic"?2:F==="underline"?8:F==="line-through"?4:0}function w(C){const F=new DOMParser().parseFromString(C,"text/html");let B=1;function D(L){if(L.nodeType===1){const O=`order_${B++}`;L.setAttribute("data-title",O),L.setAttribute("id",O)}L.childNodes.forEach(O=>D(O))}return D(F.body),F.body.innerHTML}function y(C){const T=new DOMParser,F=w(C),B=T.parseFromString(F,"text/html");B.querySelectorAll("[aria-level]").forEach(U=>{const V=U.getAttribute("id").split("_")[1]*2;setTimeout(()=>{f.update(()=>{const K=El(`${U.getAttribute("aria-level")==="1"?"h1":U.getAttribute("aria-level")==="2"?"h2":U.getAttribute("aria-level")==="3"?"h3":U.getAttribute("aria-level")==="4"?"h4":"h5"}`),P=ir(U.innerText);K.append(P),xl(K)})},V)}),B.querySelectorAll("ul").forEach(U=>{const V=U.getAttribute("id").split("_")[1]*2;setTimeout(()=>{f.update(()=>{const K=Ho("ul"),P=ti(),q=ir(`${U.textContent}`);let Y=Array.from(U.querySelectorAll("span")).map(ee=>{const oe=ee.getAttribute("style")||"";return{text:ee.innerText.trim(),style:oe}}).map(ee=>ee.style).filter(ee=>ee).map(ee=>ee.split(";").map(oe=>oe.trim()).filter(oe=>!oe.startsWith("font-family")).filter(oe=>!oe.startsWith("font-size")).filter(oe=>!oe.startsWith("border")).filter(oe=>!oe.startsWith("width")).join("; ")).join("; ");const Z=v(Y,"font-weight"),Q=v(Y,"font-style"),G=v(Y,"text-decoration");Y=`${Y}; font-weight: ${Z}`,Y=`${Y}; font-style: ${Q}`,Y=`${Y}; color: black`,Y=`${Y}; text-decoration: ${G}`,Y&&q.setStyle(Y),P.append(q),K.append(P),Mn(),xl(K)})},V)}),B.querySelectorAll("ol").forEach(U=>{const V=U.getAttribute("id").split("_")[1]*2;setTimeout(()=>{f.update(()=>{const K=Ho("ol"),P=ti(),q=ir(`${U.textContent}`);let Y=Array.from(U.querySelectorAll("span")).map(oe=>{const de=oe.getAttribute("style")||"";return{text:oe.innerText.trim(),style:de}}).map(oe=>oe.style).filter(oe=>oe).map(oe=>oe.split(";").map(de=>de.trim()).filter(de=>!de.startsWith("font-family")).filter(de=>!de.startsWith("font-size")).filter(de=>!de.startsWith("border")).filter(de=>!de.startsWith("width")).join("; ")).join("; ");const Z=v(Y,"font-weight"),Q=v(Y,"font-style"),G=v(Y,"text-decoration");Y=`${Y}; font-weight: ${Z}`,Y=`${Y}; font-style: ${Q}`,Y=`${Y}; color: black`,Y=`${Y}; text-decoration: ${G}`;let ee=S(Q,Z,G);q.setFormat(ee),Y&&q.setStyle(Y),P.append(q),K.append(P),Mn(),xl(K)})},V)}),B.querySelectorAll("table").forEach(U=>{E(U,f)});const N=B.querySelectorAll("*"),R=Array.from(N).filter(U=>!U.closest("table")).filter(U=>!U.closest("ol")).filter(U=>!U.closest("ul")).map(U=>({elemText:U.innerText,tagName:U.tagName.toLowerCase(),style:U.getAttribute("style")||"",order:U.getAttribute("id")||""}));let A=i;return R.map(U=>{let M=_(U.style,U.tagName);const{cssString:z,fontSize:V,fontWeight:K,textDecoration:P,fontStyle:q,border:W}=M||{};if(U.style&&U.style.length>0&&U.elemText.trim(" ").length&&V!=="none"&&K!==null&&P!==null&&q!==null){let H=K==="bold"&&q==="italic"&&P==="underline line-through"?15:P==="underline line-through"?12:q==="italic"&&P=="line-through"?6:q==="italic"&&P==="underline"?11:K==="bold"&&P==="line-through"?5:K==="bold"&&P==="underline"?9:K==="bold"&&q==="italic"?3:K==="bold"?1:q==="italic"?2:U.style.includes("text-decoration: underline")?8:U.style.includes("text-decoration: line-through")?4:0;A.root.children.push({detail:0,format:H,mode:"normal",style:`${z}`,text:`${U.elemText}`,type:"text",version:1,order:U.order})}}),A}he.useEffect(()=>()=>{c(" ")},[]);const x=()=>{e(!0),setTimeout(()=>{var C;(C=d.current)==null||C.click()},200)};return he.useEffect(C=>{n&&(c(s),x())},[n]),ce.jsx(ce.Fragment,{children:ce.jsx(g,{})})},mN="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPg0KPHN2ZyB3aWR0aD0iODAwcHgiIGhlaWdodD0iODAwcHgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBtaXJyb3ItaW4tcnRsPSJ0cnVlIj4NCiAgPGNpcmNsZSBmaWxsPSIjNDk0YzRlIiBjeD0iMiIgY3k9IjIiIHI9IjIiLz4NCiAgPGNpcmNsZSBmaWxsPSIjNDk0YzRlIiBjeD0iMiIgY3k9IjgiIHI9IjIiLz4NCiAgPGNpcmNsZSBmaWxsPSIjNDk0YzRlIiBjeD0iMiIgY3k9IjIwIiByPSIyIi8+DQogIDxjaXJjbGUgZmlsbD0iIzQ5NGM0ZSIgY3g9IjIiIGN5PSIxNCIgcj0iMiIvPg0KICA8cGF0aCBmaWxsPSIjNDk0YzRlIiBkPSJNMjMuMDAyIDNINy45OThDNy40NDggMyA3IDIuNTUgNyAyLjAwMnYtLjAwNGMwLS41NS40NS0uOTk4Ljk5OC0uOTk4SDIzYy41NSAwIDEgLjQ1IDEgLjk5OFYyYzAgLjU1LS40NSAxLS45OTggMXpNMjMuMDAyIDlINy45OThDNy40NDggOSA3IDguNTUgNyA4LjAwMnYtLjAwNGMwLS41NS40NS0uOTk4Ljk5OC0uOTk4SDIzYy41NSAwIDEgLjQ1IDEgLjk5OFY4YzAgLjU1LS40NSAxLS45OTggMXpNMjMuMDAyIDE1SDcuOTk4Yy0uNTUgMC0uOTk4LS40NS0uOTk4LS45OThWMTRjMC0uNTUuNDUtMSAuOTk4LTFIMjNjLjU1IDAgMSAuNDUgMSAuOTk4VjE0YzAgLjU1LS40NSAxLS45OTggMXpNMjMuMDAyIDIxSDcuOTk4Yy0uNTUgMC0uOTk4LS40NS0uOTk4LS45OThWMjBjMC0uNTUuNDUtMSAuOTk4LTFIMjNjLjU1IDAgMSAuNDUgMSAuOTk4VjIwYzAgLjU1LS40NSAxLS45OTggMXoiLz4NCjwvc3ZnPg==",yN={bullet:"Bulleted List",check:"Check List",code:"Code Block",h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6",number:"Numbered List",paragraph:"Normal",quote:"Quote"};function vN(){const l=[];for(const[t,n]of Object.entries(Tb))l.push([t,n]);return l}const _N=vN(),bN={center:{icon:"center-align",iconRTL:"center-align",name:"Center Align"},end:{icon:"right-align",iconRTL:"left-align",name:"End Align"},justify:{icon:"justify-align",iconRTL:"justify-align",name:"Justify Align"},left:{icon:"left-align",iconRTL:"left-align",name:"Left Align"},right:{icon:"right-align",iconRTL:"right-align",name:"Right Align"},start:{icon:"left-align",iconRTL:"right-align",name:"Start Align"}};function Wp(l){return l?"active dropdown-item-active":""}function Ed(){return ce.jsx("div",{className:"divider"})}function wN({editor:l,value:t,isRTL:n,disabled:e=!1}){const s=bN[t||"left"];return ce.jsxs(Sd,{disabled:e,buttonLabel:s.name,buttonIconClassName:`icon ${n?s.iconRTL:s.icon}`,buttonClassName:"toolbar-item spaced alignment",buttonAriaLabel:"Formatting options for text alignment",children:[ce.jsxs(bo,{onClick:()=>{l.dispatchCommand(ml,"left")},className:"item",children:[ce.jsx("i",{className:"icon left-align"}),ce.jsx("span",{className:"text",children:"Left Align"})]}),ce.jsxs(bo,{onClick:()=>{l.dispatchCommand(ml,"center")},className:"item",children:[ce.jsx("i",{className:"icon center-align"}),ce.jsx("span",{className:"text",children:"Center Align"})]}),ce.jsxs(bo,{onClick:()=>{l.dispatchCommand(ml,"right")},className:"item",children:[ce.jsx("i",{className:"icon right-align"}),ce.jsx("span",{className:"text",children:"Right Align"})]}),ce.jsxs(bo,{onClick:()=>{l.dispatchCommand(ml,"justify")},className:"item",children:[ce.jsx("i",{className:"icon justify-align"}),ce.jsx("span",{className:"text",children:"Justify Align"})]})]})}function Uw({setIsLinkEditMode:l,onlUser:t,styleConfig:n,showComments:e,setShowComments:s,showTabContentBtn:r,setshowTabContentBtn:o,showTabContent:a,parsedHtmlString:c,enableCaptions:i,userOnline:u,wpAndTaskId:f}){const[d]=xn(),[p,h]=he.useState(d),[m,g]=he.useState("paragraph"),[_,v]=he.useState("root"),[b,E]=he.useState(null),[S,w]=he.useState("15px"),[y,x]=he.useState("#000"),[C,T]=he.useState("#fff"),[F,B]=he.useState("Arial"),[D,L]=he.useState("left"),[O,j]=he.useState(!1),[N,R]=he.useState(!1),[A,U]=he.useState(!1),[M,z]=he.useState(!1),[V,K]=he.useState(!1),[P,q]=he.useState(!1),[W,H]=he.useState(!1),[Y,Z]=he.useState(!1),[Q,G]=he.useState(!1),[ee,oe]=he.useState(!1),[de,fe]=Da(),[ne,Se]=he.useState(!1),[we,me]=he.useState(""),[Ee,ue]=he.useState(()=>d.isEditable()),[se,pe]=he.useState(""),[le,ke]=he.useState(""),[Te,je]=he.useState(""),[Me,qe]=he.useState(""),[Re,Le]=he.useState(!0),[Ce,et]=he.useState(!1),Ie=1,Qe=jt=>{jt.key==="Enter"&&je(Bt=>Bt+1)};he.useEffect(()=>(window.addEventListener("keydown",Qe),()=>window.removeEventListener("keydown",Qe)),[]);const st=jt=>{d.update(()=>{const Bt=zw(jt),ft=new DOMParser().parseFromString(Bt,"text/html"),Dt=Ip(d,ft),en=En();si(Dt),si([en])})};he.useEffect(()=>{const jt=d.registerCommand(wa,Bt=>{const Kt=Bt.clipboardData||window.clipboardData,ft=Kt==null?void 0:Kt.getData("text/html"),Dt=Kt==null?void 0:Kt.getData("text/plain");return ft!=null&&ft.includes('<meta http-equiv=Content-Type content="text/html; charset=utf-8">')&&(ft!=null&&ft.includes("microsoft-com"))?(uw(Bt,d,"",i),!1):/^https?:\/\/\S+$/.test(Dt)?(Bt.preventDefault(),d.update(()=>{const en=En(),At=ir(Dt),nn=cd(Dt);nn.append(At),en.append(nn),si([en])}),!0):ft&&!(ft!=null&&ft.includes("Outline"))&&!(ft!=null&&ft.includes('<meta http-equiv=Content-Type content="text/html; charset=utf-8">'))&&!(ft!=null&&ft.includes("microsoft-com"))?(st(ft),!0):ft!=null&&ft.includes("Outline")?(qe(ft),et(!0),!0):!1},Ie);return()=>{jt()}},[Re]),he.useEffect(()=>{const jt=()=>!!(u&&u.length>1),Bt=()=>!!(u&&u.length>1),Kt=d.registerCommand(oc,jt,xi),ft=d.registerCommand(ic,Bt,xi);return()=>{Kt(),ft()}},[d,u]);const rt=he.useCallback(()=>{const jt=Ot();if(Ct(jt)){const Bt=jt.anchor.getNode();let Kt=Bt.getKey()==="root"?Bt:er(Bt,He=>{const Pe=He.getParent();return Pe!==null&&to(Pe)});Kt===null&&(Kt=Bt.getTopLevelElementOrThrow());const ft=Kt.getKey(),Dt=p.getElementByKey(ft);R(jt.hasFormat("bold")),U(jt.hasFormat("italic")),z(jt.hasFormat("underline")),K(jt.hasFormat("strikethrough")),q(jt.hasFormat("subscript")),H(jt.hasFormat("superscript")),Z(jt.hasFormat("code")),Se(ub(jt));const en=Dw(jt),At=en.getParent();ei(At)||ei(en)?j(!0):j(!1);const nn=er(en,dr);if(dr(nn)?v("table"):v("root"),Dt!==null)if(E(ft),sr(Kt)){const He=hb(Bt,fd),Pe=He?He.getListType():Kt.getListType();g(Pe)}else{const He=Lp(Kt)?Kt.getTag():Kt.getType();if(He in yN&&g(He),Cm(Kt)){const Pe=Kt.getLanguage();me(Pe?Ob[Pe]||Pe:"");return}}w(sd(jt,"font-size","15px")),x(sd(jt,"color","#000")),T(sd(jt,"background-color","#fff")),B(sd(jt,"font-family","Arial"));let Oe;ei(At)&&(Oe=er(en,He=>Tt(He)&&!He.isInline())),L(Tt(Oe)?Oe.getFormatType():Tt(en)?en.getFormatType():(At==null?void 0:At.getFormatType())||"left")}},[p]);he.useEffect(()=>d.registerCommand(bi,(jt,Bt)=>(rt(),h(Bt),!1),Uo),[d,rt]),he.useEffect(()=>br(p.registerUpdateListener(({editorState:jt})=>{jt.read(()=>{rt()})}),p.registerCommand(lc,jt=>(u&&u.length>1?G(!0):G(jt),!1),Uo),p.registerCommand(ac,jt=>(oe(jt),!1),Uo)),[rt,p,d]),he.useEffect(()=>p.registerCommand(Nv,jt=>{const Bt=jt,{code:Kt,ctrlKey:ft,metaKey:Dt}=Bt;if(Kt==="KeyK"&&(ft||Dt)){Bt.preventDefault();let en;return O?(l(!1),en=null):(l(!0),en=vw("https://")),p.dispatchCommand(Pa,en)}return!1},o2),[p,O,l]);const Je=he.useCallback((jt,Bt)=>{p.update(()=>{const Kt=Ot();Kt!==null&&vm(Kt,jt)},Bt?{tag:"historic"}:{})},[p]);he.useCallback(()=>{p.update(()=>{const jt=Ot();if(Ct(jt)){const Bt=jt.anchor,Kt=jt.focus,ft=jt.getNodes();if(Bt.key===Kt.key&&Bt.offset===Kt.offset)return;ft.forEach((Dt,en)=>{if(Jt(Dt)){let At=Dt;en===0&&Bt.offset!==0&&(At=At.splitText(Bt.offset)[1]||At),en===ft.length-1&&(At=At.splitText(Kt.offset)[0]||At),At.__style!==""&&At.setStyle(""),At.__format!==0&&(At.setFormat(0),bm(At).setFormat("")),Dt=At}else Lp(Dt)||oO(Dt)?Dt.replace(En(),!0):Wm(Dt)&&Dt.setFormat("")})}})},[p]),he.useCallback((jt,Bt)=>{Je({color:jt},Bt)},[Je]),he.useCallback((jt,Bt)=>{Je({"background-color":jt},Bt)},[Je]),he.useCallback(()=>{O?(l(!1),d.dispatchCommand(Pa,null)):(l(!0),d.dispatchCommand(Pa,vw("https://")))},[d,O,l]);const Ft=he.useCallback(jt=>{p.update(()=>{if(b!==null){const Bt=Rn(b);Cm(Bt)&&Bt.setLanguage(jt)}})},[p,b]),Ze=()=>{m!=="number"?d.dispatchCommand($b,void 0):d.dispatchCommand(qb,void 0)},xt=()=>{d.focus(),d.dispatchCommand(Hb,void 0)};return ce.jsxs("div",{className:"toolbar",children:[a&&ce.jsx("button",{disabled:!1,onClick:()=>{o(!r)},title:"Table of Conetent",type:"button",className:"toolbar-item spaced","aria-label":"table-of-content",children:ce.jsx("img",{src:mN,width:16,height:16})}),ce.jsx("button",{disabled:!Q||!Ee,onClick:()=>{u&&u.length>1?G(!1):p.dispatchCommand(oc,void 0)},title:La?"Undo (⌘Z)":"Undo (Ctrl+Z)",type:"button",className:"toolbar-item spaced","aria-label":"Undo",children:ce.jsx("i",{className:"format undo"})}),ce.jsx("button",{disabled:!ee||!Ee,onClick:()=>{u&&u.length>1?oe(!1):p.dispatchCommand(ic,void 0)},title:La?"Redo (⌘Y)":"Redo (Ctrl+Y)",type:"button",className:"toolbar-item","aria-label":"Redo",children:ce.jsx("i",{className:"format redo"})}),m==="code"?ce.jsx(Sd,{disabled:!Ee,buttonClassName:"toolbar-item code-language",buttonLabel:T2(we),buttonAriaLabel:"Select language",children:_N.map(([jt,Bt])=>ce.jsx(bo,{className:`item ${Wp(jt===we)}`,onClick:()=>Ft(jt),children:ce.jsx("span",{className:"text",children:Bt})},jt))}):ce.jsxs(ce.Fragment,{children:[ce.jsx(Ed,{}),ce.jsx(nN,{selectionFontSize:S.slice(0,-2),editor:d,disabled:!Ee,styleConfig:n,blockType:"h1",isenterPressed:Te,currentElementClick:se,currentElementSelect:le,wpAndTaskId:f}),ce.jsx(Ed,{}),ce.jsx("button",{disabled:!Ee,onClick:()=>{p.dispatchCommand(Gr,"bold")},className:"toolbar-item spaced "+(N?"active":""),title:La?"Bold (⌘B)":"Bold (Ctrl+B)",type:"button","aria-label":`Format text as bold. Shortcut: ${La?"⌘B":"Ctrl+B"}`,children:ce.jsx("i",{className:"format bold"})}),ce.jsx("button",{disabled:!Ee,onClick:()=>{p.dispatchCommand(Gr,"italic")},className:"toolbar-item spaced "+(A?"active":""),title:La?"Italic (⌘I)":"Italic (Ctrl+I)",type:"button","aria-label":`Format text as italics. Shortcut: ${La?"⌘I":"Ctrl+I"}`,children:ce.jsx("i",{className:"format italic"})}),ce.jsx("button",{disabled:!Ee,onClick:()=>{p.dispatchCommand(Gr,"underline")},className:"toolbar-item spaced "+(M?"active":""),title:La?"Underline (⌘U)":"Underline (Ctrl+U)",type:"button","aria-label":`Format text to underlined. Shortcut: ${La?"⌘U":"Ctrl+U"}`,children:ce.jsx("i",{className:"format underline"})}),ce.jsx("button",{className:"toolbar-item",onClick:()=>d.dispatchCommand(O1,void 0),title:"Insert Endnote",children:ce.jsx("i",{className:"format endnotes"})}),ce.jsxs(Sd,{disabled:!Ee,buttonClassName:"toolbar-item spaced",buttonLabel:"",buttonAriaLabel:"Formatting options for additional text styles",buttonIconClassName:"icon dropdown-more",children:[ce.jsxs(bo,{onClick:()=>{p.dispatchCommand(Gr,"strikethrough")},className:"item "+Wp(V),title:"Strikethrough","aria-label":"Format text with a strikethrough",children:[ce.jsx("i",{className:"icon strikethrough"}),ce.jsx("span",{className:"text",children:"Strikethrough"})]}),ce.jsxs(bo,{onClick:()=>{p.dispatchCommand(Gr,"subscript")},className:"item "+Wp(P),title:"Subscript","aria-label":"Format text with a subscript",children:[ce.jsx("i",{className:"icon subscript"}),ce.jsx("span",{className:"text",children:"Subscript"})]}),ce.jsxs(bo,{onClick:()=>{p.dispatchCommand(Gr,"superscript")},className:"item "+Wp(W),title:"Superscript","aria-label":"Format text with a superscript",children:[ce.jsx("i",{className:"icon superscript"}),ce.jsx("span",{className:"text",children:"Superscript"})]})]}),ce.jsx(Ed,{}),ce.jsxs(Sd,{disabled:!Ee,buttonClassName:"toolbar-item spaced",buttonLabel:"Insert",buttonAriaLabel:"Insert specialized editor node",buttonIconClassName:"icon plus",children:[ce.jsxs(bo,{onClick:()=>{fe("Insert Image",jt=>ce.jsx(SO,{activeEditor:p,onClose:jt,enableCaptions:!1}))},className:"item",children:[ce.jsx("i",{className:"icon image"}),ce.jsx("span",{className:"text",children:"Image"})]}),ce.jsxs(bo,{onClick:()=>{fe("Insert Table",jt=>ce.jsx(FT,{activeEditor:p,onClose:jt,enableCaptions:i}))},className:"item",children:[ce.jsx("i",{className:"icon table"}),ce.jsx("span",{className:"text",children:"Table"})]}),ce.jsxs(bo,{className:"item",onClick:()=>{xt()},children:[ce.jsx("img",{src:pN,height:21,width:21}),ce.jsx("span",{style:{marginLeft:"10px",marginTop:"2px"},children:"Bullet List"})]}),ce.jsxs(bo,{className:"item",onClick:()=>{Ze()},children:[ce.jsx("img",{src:hN,height:21,width:21}),ce.jsx("span",{style:{marginLeft:"10px",marginTop:"2px"},children:"Numbered List"})]})]})]}),ce.jsx(Ed,{}),ce.jsx("button",{className:`toolbar-item ${e?"active":""}`,onClick:()=>{s(!e),console.log("line 616 ToolbarPlugin show comments button clicked")},title:e?"Hide Comments":"Show Comments",children:ce.jsx("i",{className:"comments"})}),ce.jsx(Ed,{}),ce.jsx(gN,{passedContent:Me,source:"remote",onPaste:null,htmlPasteModalOpen:Ce,sethtmlPasteModalOpen:et,onlUser:t,collabApiKey:""}),ce.jsx("button",{className:"toolbar-item",onClick:()=>{lN(d,"title-doc",n,c)},children:ce.jsx("img",{title:"Download as .doc",src:oN,height:18,width:18,className:"download-icon"})}),ce.jsx(wN,{disabled:!Ee,value:D,editor:d,isRTL:ne}),ce.jsx("button",{style:{display:"none"},id:"pagination",onClick:()=>{tN(d)}}),ce.jsx("div",{className:"flex-container-onluser",children:t}),de]})}const SR="",xN=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?he.useLayoutEffect:he.useEffect;function Hw({ariaActiveDescendant:l,ariaAutoComplete:t,ariaControls:n,ariaDescribedBy:e,ariaExpanded:s,ariaLabel:r,ariaLabelledBy:o,ariaMultiline:a,ariaOwns:c,ariaRequired:i,autoCapitalize:u,className:f,id:d,role:p="textbox",spellCheck:h=!0,style:m,tabIndex:g,"data-testid":_,...v}){const[b]=xn(),[E,S]=he.useState(!1),w=he.useCallback(y=>{y&&y.ownerDocument&&y.ownerDocument.defaultView&&b.setRootElement(y)},[b]);return xN(()=>(S(b.isEditable()),b.registerEditableListener(y=>{S(y)})),[b]),ce.jsx("div",{...v,"aria-activedescendant":E?l:void 0,"aria-autocomplete":E?t:"none","aria-controls":E?n:void 0,"aria-describedby":e,"aria-expanded":E&&p==="combobox"?!!s:void 0,"aria-label":r,"aria-labelledby":o,"aria-multiline":a,"aria-owns":E?c:void 0,"aria-readonly":!E||void 0,"aria-required":i,autoCapitalize:u,className:f,contentEditable:E,"data-testid":_,id:d,ref:w,role:p,spellCheck:h,style:m,tabIndex:g})}function Cd({className:l}){return ce.jsx(Hw,{className:l||"ContentEditable__root"})}const ER="";function jd({children:l,className:t}){return ce.jsx("div",{className:t||"Placeholder__root",children:l})}let hy=class Zj extends Br{static getType(){return"mark"}static clone(t){return new Zj(Array.from(t.__ids),t.__key)}static importDOM(){return null}static importJSON(t){const n=Jp(t.ids);return n.setFormat(t.format),n.setIndent(t.indent),n.setDirection(t.direction),n}exportJSON(){return{...super.exportJSON(),ids:this.getIDs(),type:"mark",version:1}}constructor(t,n){super(n),this.__ids=t||[]}createDOM(t){const n=document.createElement("mark");return zr(n,t.theme.mark),this.__ids.length>1&&zr(n,t.theme.markOverlap),n}updateDOM(t,n,e){const s=t.__ids,r=this.__ids,o=s.length,a=r.length,c=e.theme.markOverlap;return o!==a&&(o===1?a===2&&zr(n,c):a===1&&wc(n,c)),!1}hasID(t){const n=this.getIDs();for(let e=0;e<n.length;e++)if(t===n[e])return!0;return!1}getIDs(){const t=this.getLatest();return Il(t)?t.__ids:[]}addID(t){const n=this.getWritable();if(Il(n)){const e=n.__ids;n.__ids=e;for(let s=0;s<e.length;s++)if(t===e[s])return;e.push(t)}}deleteID(t){const n=this.getWritable();if(Il(n)){const e=n.__ids;n.__ids=e;for(let s=0;s<e.length;s++)if(t===e[s])return void e.splice(s,1)}}insertNewAfter(t,n=!0){const e=Jp(this.__ids);return this.insertAfter(e,n),e}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(t,n,e){if(!Ct(n)||e==="html")return!1;const s=n.anchor,r=n.focus,o=s.getNode(),a=r.getNode(),c=n.isBackward()?s.offset-r.offset:r.offset-s.offset;return this.isParentOf(o)&&this.isParentOf(a)&&this.getTextContent().length===c}excludeFromCopy(t){return t!=="clone"}};function Jp(l){return Pr(new hy(l))}function Il(l){return l instanceof hy}function SN(l){const t=l.getChildren();let n=null;for(let e=0;e<t.length;e++){const s=t[e];n===null?l.insertBefore(s):n.insertAfter(s),n=s}l.remove()}function EN(l,t,n,e){const s=l.getNodes(),r=l.anchor.offset,o=l.focus.offset,a=s.length,c=t?o:r,i=t?r:o;let u,f;for(let d=0;d<a;d++){const p=s[d];if(Tt(f)&&f.isParentOf(p))continue;const h=d===0,m=d===a-1;let g=null;if(Jt(p)){const _=p.getTextContentSize(),v=h?c:0,b=m?i:_;if(v===0&&b===0)continue;const E=p.splitText(v,b);g=E.length>1&&(E.length===3||h&&!m||b===_)?E[1]:E[0]}else{if(Il(p))continue;Tt(p)&&p.isInline()&&(g=p)}if(g!==null){if(g&&g.is(u))continue;const _=g.getParent();_!=null&&_.is(u)||(f=void 0),u=_,f===void 0&&(f=(e||Jp)([n]),g.insertBefore(f)),f.append(g)}else u=void 0,f=void 0}Tt(f)&&(t?f.selectStart():f.selectEnd())}function CN(l,t){let n=l;for(;n!==null;){if(Il(n))return n.getIDs();if(Jt(n)&&t===n.getTextContentSize()){const e=n.getNextSibling();if(Il(e))return e.getIDs()}n=n.getParent()}return null}const $w=[["Cat","rgb(125, 50, 0)"],["Dog","rgb(100, 0, 0)"],["Rabbit","rgb(150, 0, 0)"],["Frog","rgb(200, 0, 0)"],["Fox","rgb(200, 75, 0)"],["Hedgehog","rgb(0, 75, 0)"],["Pigeon","rgb(0, 125, 0)"],["Squirrel","rgb(75, 100, 0)"],["Bear","rgb(125, 100, 0)"],["Tiger","rgb(0, 0, 150)"],["Leopard","rgb(0, 0, 200)"],["Zebra","rgb(0, 0, 250)"],["Wolf","rgb(0, 100, 150)"],["Owl","rgb(0, 100, 100)"],["Gull","rgb(100, 0, 100)"],["Squid","rgb(150, 0, 150)"]],qw=$w[Math.floor(Math.random()*$w.length)],jN=he.createContext({clientID:0,color:qw[1],isCollabActive:!1,name:qw[0],yjsDocMap:new Map});function kd(l,t){const n=he.useContext(jN);return l!=null&&(n.name=l),t!=null&&(n.color=t),n}const kN=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?he.useLayoutEffect:he.useEffect;function Ww({onClear:l}){const[t]=xn();return kN(()=>t.registerCommand(Nf,n=>(t.update(()=>{if(l==null){const e=Mn(),s=Ot(),r=En();e.clear(),e.append(r),s!==null&&r.select(),Ct(s)&&(s.format=0)}else l()}),!0),Tn),[t,l]),null}function gy(l,t){return gy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,e){return n.__proto__=e,n},gy(l,t)}var Jw={error:null},TN=function(l){var t,n;function e(){for(var r,o=arguments.length,a=new Array(o),c=0;c<o;c++)a[c]=arguments[c];return(r=l.call.apply(l,[this].concat(a))||this).state=Jw,r.resetErrorBoundary=function(){for(var i,u=arguments.length,f=new Array(u),d=0;d<u;d++)f[d]=arguments[d];r.props.onReset==null||(i=r.props).onReset.apply(i,f),r.reset()},r}n=l,(t=e).prototype=Object.create(n.prototype),t.prototype.constructor=t,gy(t,n),e.getDerivedStateFromError=function(r){return{error:r}};var s=e.prototype;return s.reset=function(){this.setState(Jw)},s.componentDidCatch=function(r,o){var a,c;(a=(c=this.props).onError)==null||a.call(c,r,o)},s.componentDidUpdate=function(r,o){var a,c,i,u,f=this.state.error,d=this.props.resetKeys;f!==null&&o.error!==null&&((i=r.resetKeys)===void 0&&(i=[]),(u=d)===void 0&&(u=[]),i.length!==u.length||i.some(function(p,h){return!Object.is(p,u[h])}))&&((a=(c=this.props).onResetKeysChange)==null||a.call(c,r.resetKeys,d),this.reset())},s.render=function(){var r=this.state.error,o=this.props,a=o.fallbackRender,c=o.FallbackComponent,i=o.fallback;if(r!==null){var u={error:r,resetErrorBoundary:this.resetErrorBoundary};if(or.isValidElement(i))return i;if(typeof a=="function")return a(u);if(c)return or.createElement(c,u);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},e}(or.Component);function Ml({children:l,onError:t}){return ce.jsx(TN,{fallback:ce.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:t,children:l})}const ON=Object.freeze(Object.defineProperty({__proto__:null,LexicalErrorBoundary:Ml,default:Ml},Symbol.toStringTag,{value:"Module"})),NN=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?he.useLayoutEffect:he.useEffect;function Vw({ignoreHistoryMergeTagChange:l=!0,ignoreSelectionChange:t=!1,onChange:n}){const[e]=xn();return NN(()=>{if(n)return e.registerUpdateListener(({editorState:s,dirtyElements:r,dirtyLeaves:o,prevEditorState:a,tags:c})=>{t&&r.size===0&&o.size===0||l&&c.has("history-merge")||a.isEmpty()||n(s,e,c)})},[e,l,t,n]),null}const Rc=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,AN=Rc&&"documentMode"in document?document.documentMode:null,PN=!(!Rc||!("InputEvent"in window)||AN)&&"getTargetRanges"in new window.InputEvent("input"),IN=Rc&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),MN=Rc&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,DN=Rc&&/^(?=.*Chrome).*/i.test(navigator.userAgent),RN=Rc&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!DN;function Kw(l,t){t.update(()=>{if(l!==null){const n=$s(l,KeyboardEvent)?null:l.clipboardData,e=Ot();if(e!==null&&n!=null){l.preventDefault();const s=W1(t);s!==null&&n.setData("text/html",s),n.setData("text/plain",e.getTextContent())}}})}function LN(l){return br(l.registerCommand(Yi,t=>{const n=Ot();return!!Ct(n)&&(n.deleteCharacter(t),!0)},Tn),l.registerCommand(gl,t=>{const n=Ot();return!!Ct(n)&&(n.deleteWord(t),!0)},Tn),l.registerCommand(xa,t=>{const n=Ot();return!!Ct(n)&&(n.deleteLine(t),!0)},Tn),l.registerCommand(ba,t=>{const n=Ot();if(!Ct(n))return!1;if(typeof t=="string")n.insertText(t);else{const e=t.dataTransfer;if(e!=null)J1(e,n);else{const s=t.data;s&&n.insertText(s)}}return!0},Tn),l.registerCommand(Ef,()=>{const t=Ot();return!!Ct(t)&&(t.removeText(),!0)},Tn),l.registerCommand(_a,t=>{const n=Ot();return!!Ct(n)&&(n.insertLineBreak(t),!0)},Tn),l.registerCommand(hl,()=>{const t=Ot();return!!Ct(t)&&(t.insertLineBreak(),!0)},Tn),l.registerCommand(jf,t=>{const n=Ot();if(!Ct(n))return!1;const e=t,s=e.shiftKey;return!!up(n,!0)&&(e.preventDefault(),dp(n,s,!0),!0)},Tn),l.registerCommand(Cf,t=>{const n=Ot();if(!Ct(n))return!1;const e=t,s=e.shiftKey;return!!up(n,!1)&&(e.preventDefault(),dp(n,s,!1),!0)},Tn),l.registerCommand(Zi,t=>{const n=Ot();return!!Ct(n)&&(t.preventDefault(),l.dispatchCommand(Yi,!0))},Tn),l.registerCommand(Xi,t=>{const n=Ot();return!!Ct(n)&&(t.preventDefault(),l.dispatchCommand(Yi,!1))},Tn),l.registerCommand(Rs,t=>{const n=Ot();if(!Ct(n))return!1;if(t!==null){if((MN||IN||RN)&&PN)return!1;t.preventDefault()}return l.dispatchCommand(_a,!1)},Tn),l.registerCommand(Of,()=>(r_(),!0),Tn),l.registerCommand($u,t=>{const n=Ot();return!!Ct(n)&&(Kw(t,l),!0)},Tn),l.registerCommand(qu,t=>{const n=Ot();return!!Ct(n)&&(function(e,s){Kw(e,s),s.update(()=>{const r=Ot();Ct(r)&&r.removeText()})}(t,l),!0)},Tn),l.registerCommand(wa,t=>{const n=Ot();return!!Ct(n)&&(function(e,s){e.preventDefault(),s.update(()=>{const r=Ot(),{clipboardData:o}=e;o!=null&&Ct(r)&&J1(o,r)},{tag:"paste"})}(t,l),!0)},Tn),l.registerCommand(Tf,t=>{const n=Ot();return!!Ct(n)&&(t.preventDefault(),!0)},Tn),l.registerCommand(sc,t=>{const n=Ot();return!!Ct(n)&&(t.preventDefault(),!0)},Tn))}const my=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?he.useLayoutEffect:he.useEffect;function Gw(l){return l.getEditorState().read(D1(l.isComposing()))}function Yw({contentEditable:l,placeholder:t,ErrorBoundary:n}){const[e]=xn(),s=function(r,o){const[a,c]=he.useState(()=>r.getDecorators());return my(()=>r.registerDecoratorListener(i=>{so.flushSync(()=>{c(i)})}),[r]),he.useEffect(()=>{c(r.getDecorators())},[r]),he.useMemo(()=>{const i=[],u=Object.keys(a);for(let f=0;f<u.length;f++){const d=u[f],p=ce.jsx(o,{onError:m=>r._onError(m),children:ce.jsx(he.Suspense,{fallback:null,children:a[d]})}),h=r.getElementByKey(d);h!==null&&i.push(so.createPortal(p,h,d))}return i},[o,a,r])}(e,n);return function(r){my(()=>br(LN(r),B1(r)),[r])}(e),ce.jsxs(ce.Fragment,{children:[l,ce.jsx(FN,{content:t}),s]})}function FN({content:l}){const[t]=xn(),n=function(s){const[r,o]=he.useState(()=>Gw(s));return my(()=>{function a(){const c=Gw(s);o(c)}return a(),br(s.registerUpdateListener(()=>{a()}),s.registerEditableListener(()=>{a()}))},[s]),r}(t),e=oy();return n?typeof l=="function"?l(e):l:null}var BN={155:(l,t,n)=>{n.r(t),n.d(t,{default:()=>i});const e=JSON.parse('{"UU":"@codoxhq/lexical-provider","rE":"1.1.0-rc.6"}');let s=()=>{},r=function(){return s};const o=r(),a=r(),c=r(),i={log:o,info:a,warn:r(),debug:c,error:r(),logProviderVersion:()=>{console.log(`${e.UU} version ${e.rE}`)}}},668:(l,t,n)=>{l.exports=function e(s,r,o){function a(u,f){if(!r[u]){if(!s[u]){var d=void 0;if(!f&&d)return require(u,!0);if(c)return c(u,!0);throw(f=new Error("Cannot find module '"+u+"'")).code="MODULE_NOT_FOUND",f}d=r[u]={exports:{}},s[u][0].call(d.exports,function(p){return a(s[u][1][p]||p)},d,d.exports,e,s,r,o)}return r[u].exports}for(var c=void 0,i=0;i<o.length;i++)a(o[i]);return a}({1:[function(e,s,r){s.exports=function(o,a){(a==null||a>o.length)&&(a=o.length);for(var c=0,i=new Array(a);c<a;c++)i[c]=o[c];return i},s.exports.__esModule=!0,s.exports.default=s.exports},{}],2:[function(e,s,r){s.exports=function(o){if(Array.isArray(o))return o},s.exports.__esModule=!0,s.exports.default=s.exports},{}],3:[function(e,s,r){var o=e("./arrayLikeToArray.js");s.exports=function(a){if(Array.isArray(a))return o(a)},s.exports.__esModule=!0,s.exports.default=s.exports},{"./arrayLikeToArray.js":1}],4:[function(e,s,r){s.exports=function(o){if(o===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return o},s.exports.__esModule=!0,s.exports.default=s.exports},{}],5:[function(e,s,r){s.exports=function(o,a){if(!(o instanceof a))throw new TypeError("Cannot call a class as a function")},s.exports.__esModule=!0,s.exports.default=s.exports},{}],6:[function(e,s,r){var o=e("./setPrototypeOf.js"),a=e("./isNativeReflectConstruct.js");function c(i,u,f){return a()?s.exports=c=Reflect.construct.bind():s.exports=c=function(d,p,h){var m=[null];return m.push.apply(m,p),p=new(Function.bind.apply(d,m)),h&&o(p,h.prototype),p},s.exports.__esModule=!0,s.exports.default=s.exports,c.apply(null,arguments)}s.exports=c,s.exports.__esModule=!0,s.exports.default=s.exports},{"./isNativeReflectConstruct.js":13,"./setPrototypeOf.js":19}],7:[function(e,s,r){function o(a,c){for(var i=0;i<c.length;i++){var u=c[i];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(a,u.key,u)}}s.exports=function(a,c,i){return c&&o(a.prototype,c),i&&o(a,i),Object.defineProperty(a,"prototype",{writable:!1}),a},s.exports.__esModule=!0,s.exports.default=s.exports},{}],8:[function(e,s,r){s.exports=function(o,a,c){return a in o?Object.defineProperty(o,a,{value:c,enumerable:!0,configurable:!0,writable:!0}):o[a]=c,o},s.exports.__esModule=!0,s.exports.default=s.exports},{}],9:[function(e,s,r){function o(a){return s.exports=o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(c){return c.__proto__||Object.getPrototypeOf(c)},s.exports.__esModule=!0,s.exports.default=s.exports,o(a)}s.exports=o,s.exports.__esModule=!0,s.exports.default=s.exports},{}],10:[function(e,s,r){var o=e("./setPrototypeOf.js");s.exports=function(a,c){if(typeof c!="function"&&c!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),Object.defineProperty(a,"prototype",{writable:!1}),c&&o(a,c)},s.exports.__esModule=!0,s.exports.default=s.exports},{"./setPrototypeOf.js":19}],11:[function(e,s,r){s.exports=function(o){return o&&o.__esModule?o:{default:o}},s.exports.__esModule=!0,s.exports.default=s.exports},{}],12:[function(e,s,r){s.exports=function(o){return Function.toString.call(o).indexOf("[native code]")!==-1},s.exports.__esModule=!0,s.exports.default=s.exports},{}],13:[function(e,s,r){s.exports=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}},s.exports.__esModule=!0,s.exports.default=s.exports},{}],14:[function(e,s,r){s.exports=function(o){if(typeof Symbol<"u"&&o[Symbol.iterator]!=null||o["@@iterator"]!=null)return Array.from(o)},s.exports.__esModule=!0,s.exports.default=s.exports},{}],15:[function(e,s,r){s.exports=function(o,a){var c=o==null?null:typeof Symbol<"u"&&o[Symbol.iterator]||o["@@iterator"];if(c!=null){var i,u,f=[],d=!0,p=!1;try{for(c=c.call(o);!(d=(i=c.next()).done)&&(f.push(i.value),!a||f.length!==a);d=!0);}catch(h){p=!0,u=h}finally{try{d||c.return==null||c.return()}finally{if(p)throw u}}return f}},s.exports.__esModule=!0,s.exports.default=s.exports},{}],16:[function(e,s,r){s.exports=function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
67
74
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)},s.exports.__esModule=!0,s.exports.default=s.exports},{}],17:[function(e,s,r){s.exports=function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
68
75
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)},s.exports.__esModule=!0,s.exports.default=s.exports},{}],18:[function(e,s,r){var o=e("./typeof.js").default,a=e("./assertThisInitialized.js");s.exports=function(c,i){if(i&&(o(i)==="object"||typeof i=="function"))return i;if(i!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return a(c)},s.exports.__esModule=!0,s.exports.default=s.exports},{"./assertThisInitialized.js":4,"./typeof.js":22}],19:[function(e,s,r){function o(a,c){return s.exports=o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,u){return i.__proto__=u,i},s.exports.__esModule=!0,s.exports.default=s.exports,o(a,c)}s.exports=o,s.exports.__esModule=!0,s.exports.default=s.exports},{}],20:[function(e,s,r){var o=e("./arrayWithHoles.js"),a=e("./iterableToArrayLimit.js"),c=e("./unsupportedIterableToArray.js"),i=e("./nonIterableRest.js");s.exports=function(u,f){return o(u)||a(u,f)||c(u,f)||i()},s.exports.__esModule=!0,s.exports.default=s.exports},{"./arrayWithHoles.js":2,"./iterableToArrayLimit.js":15,"./nonIterableRest.js":16,"./unsupportedIterableToArray.js":23}],21:[function(e,s,r){var o=e("./arrayWithoutHoles.js"),a=e("./iterableToArray.js"),c=e("./unsupportedIterableToArray.js"),i=e("./nonIterableSpread.js");s.exports=function(u){return o(u)||a(u)||c(u)||i()},s.exports.__esModule=!0,s.exports.default=s.exports},{"./arrayWithoutHoles.js":3,"./iterableToArray.js":14,"./nonIterableSpread.js":17,"./unsupportedIterableToArray.js":23}],22:[function(e,s,r){function o(a){return s.exports=o=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(c){return typeof c}:function(c){return c&&typeof Symbol=="function"&&c.constructor===Symbol&&c!==Symbol.prototype?"symbol":typeof c},s.exports.__esModule=!0,s.exports.default=s.exports,o(a)}s.exports=o,s.exports.__esModule=!0,s.exports.default=s.exports},{}],23:[function(e,s,r){var o=e("./arrayLikeToArray.js");s.exports=function(a,c){var i;if(a)return typeof a=="string"?o(a,c):(i=(i=Object.prototype.toString.call(a).slice(8,-1))==="Object"&&a.constructor?a.constructor.name:i)==="Map"||i==="Set"?Array.from(a):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?o(a,c):void 0},s.exports.__esModule=!0,s.exports.default=s.exports},{"./arrayLikeToArray.js":1}],24:[function(e,s,r){var o=e("./getPrototypeOf.js"),a=e("./setPrototypeOf.js"),c=e("./isNativeFunction.js"),i=e("./construct.js");function u(f){var d=typeof Map=="function"?new Map:void 0;return s.exports=u=function(p){if(p===null||!c(p))return p;if(typeof p!="function")throw new TypeError("Super expression must either be null or a function");if(d!==void 0){if(d.has(p))return d.get(p);d.set(p,h)}function h(){return i(p,arguments,o(this).constructor)}return h.prototype=Object.create(p.prototype,{constructor:{value:h,enumerable:!1,writable:!0,configurable:!0}}),a(h,p)},s.exports.__esModule=!0,s.exports.default=s.exports,u(f)}s.exports=u,s.exports.__esModule=!0,s.exports.default=s.exports},{"./construct.js":6,"./getPrototypeOf.js":9,"./isNativeFunction.js":12,"./setPrototypeOf.js":19}],25:[function(e,s,r){s.exports=function o(a,c){if(a===c)return!0;if(a&&c&&typeof a=="object"&&typeof c=="object"){if(a.constructor!==c.constructor)return!1;var i,u,f;if(Array.isArray(a)){if((i=a.length)!=c.length)return!1;for(u=i;u--!=0;)if(!o(a[u],c[u]))return!1}else{if(a.constructor===RegExp)return a.source===c.source&&a.flags===c.flags;if(a.valueOf!==Object.prototype.valueOf)return a.valueOf()===c.valueOf();if(a.toString!==Object.prototype.toString)return a.toString()===c.toString();if((i=(f=Object.keys(a)).length)!==Object.keys(c).length)return!1;for(u=i;u--!=0;)if(!Object.prototype.hasOwnProperty.call(c,f[u]))return!1;for(u=i;u--!=0;){var d=f[u];if(!o(a[d],c[d]))return!1}}return!0}return a!=a&&c!=c}},{}],26:[function(e,s,r){Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"v1",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(r,"v3",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(r,"v4",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(r,"v5",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(r,"NIL",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(r,"version",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(r,"validate",{enumerable:!0,get:function(){return d.default}}),Object.defineProperty(r,"stringify",{enumerable:!0,get:function(){return p.default}}),Object.defineProperty(r,"parse",{enumerable:!0,get:function(){return h.default}});var o=m(e("./v1.js")),a=m(e("./v3.js")),c=m(e("./v4.js")),i=m(e("./v5.js")),u=m(e("./nil.js")),f=m(e("./version.js")),d=m(e("./validate.js")),p=m(e("./stringify.js")),h=m(e("./parse.js"));function m(g){return g&&g.__esModule?g:{default:g}}},{"./nil.js":28,"./parse.js":29,"./stringify.js":33,"./v1.js":34,"./v3.js":35,"./v4.js":37,"./v5.js":38,"./validate.js":39,"./version.js":40}],27:[function(e,s,r){function o(p){return 14+(p+64>>>9<<4)+1}function a(p,h){var m=(65535&p)+(65535&h);return(p>>16)+(h>>16)+(m>>16)<<16|65535&m}function c(p,h,m,g,_,v){return a((h=a(a(h,p),a(g,v)))<<_|h>>>32-_,m)}function i(p,h,m,g,_,v,b){return c(h&m|~h&g,p,h,_,v,b)}function u(p,h,m,g,_,v,b){return c(h&g|m&~g,p,h,_,v,b)}function f(p,h,m,g,_,v,b){return c(h^m^g,p,h,_,v,b)}function d(p,h,m,g,_,v,b){return c(m^(h|~g),p,h,_,v,b)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0,r.default=function(p){if(typeof p=="string"){var h=unescape(encodeURIComponent(p));p=new Uint8Array(h.length);for(let E=0;E<h.length;++E)p[E]=h.charCodeAt(E)}var m=((E,S)=>{E[S>>5]|=128<<S%32,E[o(S)-1]=S;let w=1732584193,y=-271733879,x=-1732584194,C=271733878;for(let L=0;L<E.length;L+=16){var T=w,F=y,B=x,D=C;w=i(w,y,x,C,E[L],7,-680876936),C=i(C,w,y,x,E[L+1],12,-389564586),x=i(x,C,w,y,E[L+2],17,606105819),y=i(y,x,C,w,E[L+3],22,-1044525330),w=i(w,y,x,C,E[L+4],7,-176418897),C=i(C,w,y,x,E[L+5],12,1200080426),x=i(x,C,w,y,E[L+6],17,-1473231341),y=i(y,x,C,w,E[L+7],22,-45705983),w=i(w,y,x,C,E[L+8],7,1770035416),C=i(C,w,y,x,E[L+9],12,-1958414417),x=i(x,C,w,y,E[L+10],17,-42063),y=i(y,x,C,w,E[L+11],22,-1990404162),w=i(w,y,x,C,E[L+12],7,1804603682),C=i(C,w,y,x,E[L+13],12,-40341101),x=i(x,C,w,y,E[L+14],17,-1502002290),y=i(y,x,C,w,E[L+15],22,1236535329),w=u(w,y,x,C,E[L+1],5,-165796510),C=u(C,w,y,x,E[L+6],9,-1069501632),x=u(x,C,w,y,E[L+11],14,643717713),y=u(y,x,C,w,E[L],20,-373897302),w=u(w,y,x,C,E[L+5],5,-701558691),C=u(C,w,y,x,E[L+10],9,38016083),x=u(x,C,w,y,E[L+15],14,-660478335),y=u(y,x,C,w,E[L+4],20,-405537848),w=u(w,y,x,C,E[L+9],5,568446438),C=u(C,w,y,x,E[L+14],9,-1019803690),x=u(x,C,w,y,E[L+3],14,-187363961),y=u(y,x,C,w,E[L+8],20,1163531501),w=u(w,y,x,C,E[L+13],5,-1444681467),C=u(C,w,y,x,E[L+2],9,-51403784),x=u(x,C,w,y,E[L+7],14,1735328473),y=u(y,x,C,w,E[L+12],20,-1926607734),w=f(w,y,x,C,E[L+5],4,-378558),C=f(C,w,y,x,E[L+8],11,-2022574463),x=f(x,C,w,y,E[L+11],16,1839030562),y=f(y,x,C,w,E[L+14],23,-35309556),w=f(w,y,x,C,E[L+1],4,-1530992060),C=f(C,w,y,x,E[L+4],11,1272893353),x=f(x,C,w,y,E[L+7],16,-155497632),y=f(y,x,C,w,E[L+10],23,-1094730640),w=f(w,y,x,C,E[L+13],4,681279174),C=f(C,w,y,x,E[L],11,-358537222),x=f(x,C,w,y,E[L+3],16,-722521979),y=f(y,x,C,w,E[L+6],23,76029189),w=f(w,y,x,C,E[L+9],4,-640364487),C=f(C,w,y,x,E[L+12],11,-421815835),x=f(x,C,w,y,E[L+15],16,530742520),y=f(y,x,C,w,E[L+2],23,-995338651),w=d(w,y,x,C,E[L],6,-198630844),C=d(C,w,y,x,E[L+7],10,1126891415),x=d(x,C,w,y,E[L+14],15,-1416354905),y=d(y,x,C,w,E[L+5],21,-57434055),w=d(w,y,x,C,E[L+12],6,1700485571),C=d(C,w,y,x,E[L+3],10,-1894986606),x=d(x,C,w,y,E[L+10],15,-1051523),y=d(y,x,C,w,E[L+1],21,-2054922799),w=d(w,y,x,C,E[L+8],6,1873313359),C=d(C,w,y,x,E[L+15],10,-30611744),x=d(x,C,w,y,E[L+6],15,-1560198380),y=d(y,x,C,w,E[L+13],21,1309151649),w=d(w,y,x,C,E[L+4],6,-145523070),C=d(C,w,y,x,E[L+11],10,-1120210379),x=d(x,C,w,y,E[L+2],15,718787259),y=d(y,x,C,w,E[L+9],21,-343485551),w=a(w,T),y=a(y,F),x=a(x,B),C=a(C,D)}return[w,y,x,C]})((E=>{if(E.length===0)return[];var S=8*E.length,w=new Uint32Array(o(S));for(let y=0;y<S;y+=8)w[y>>5]|=(255&E[y/8])<<y%32;return w})(p),8*p.length),g=[],_=32*m.length,v="0123456789abcdef";for(let E=0;E<_;E+=8){var b=m[E>>5]>>>E%32&255;b=parseInt(v.charAt(b>>>4&15)+v.charAt(15&b),16),g.push(b)}return g}},{}],28:[function(e,s,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0,r.default="00000000-0000-0000-0000-000000000000"},{}],29:[function(e,s,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var o=(e=e("./validate.js"))&&e.__esModule?e:{default:e};r.default=function(a){var c,i;if((0,o.default)(a))return(i=new Uint8Array(16))[0]=(c=parseInt(a.slice(0,8),16))>>>24,i[1]=c>>>16&255,i[2]=c>>>8&255,i[3]=255&c,i[4]=(c=parseInt(a.slice(9,13),16))>>>8,i[5]=255&c,i[6]=(c=parseInt(a.slice(14,18),16))>>>8,i[7]=255&c,i[8]=(c=parseInt(a.slice(19,23),16))>>>8,i[9]=255&c,i[10]=(c=parseInt(a.slice(24,36),16))/1099511627776&255,i[11]=c/4294967296&255,i[12]=c>>>24&255,i[13]=c>>>16&255,i[14]=c>>>8&255,i[15]=255&c,i;throw TypeError("Invalid UUID")}},{"./validate.js":39}],30:[function(e,s,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0,r.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i},{}],31:[function(e,s,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(){if(!o&&!(o=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return o(a)};let o,a=new Uint8Array(16)},{}],32:[function(e,s,r){function o(a,c){return a<<c|a>>>32-c}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0,r.default=function(a){var c=[1518500249,1859775393,2400959708,3395469782],i=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof a=="string"){var u=unescape(encodeURIComponent(a));a=[];for(let _=0;_<u.length;++_)a.push(u.charCodeAt(_))}else Array.isArray(a)||(a=Array.prototype.slice.call(a));a.push(128);var f=a.length/4+2,d=Math.ceil(f/16),p=new Array(d);for(let _=0;_<d;++_){var h=new Uint32Array(16);for(let v=0;v<16;++v)h[v]=a[64*_+4*v]<<24|a[64*_+4*v+1]<<16|a[64*_+4*v+2]<<8|a[64*_+4*v+3];p[_]=h}p[d-1][14]=8*(a.length-1)/Math.pow(2,32),p[d-1][14]=Math.floor(p[d-1][14]),p[d-1][15]=8*(a.length-1)&4294967295;for(let _=0;_<d;++_){var m=new Uint32Array(80);for(let y=0;y<16;++y)m[y]=p[_][y];for(let y=16;y<80;++y)m[y]=o(m[y-3]^m[y-8]^m[y-14]^m[y-16],1);let v=i[0],b=i[1],E=i[2],S=i[3],w=i[4];for(let y=0;y<80;++y){var g=Math.floor(y/20);g=o(v,5)+((x,C,T,F)=>{switch(x){case 0:return C&T^~C&F;case 1:case 3:return C^T^F;case 2:return C&T^C&F^T&F}})(g,b,E,S)+w+c[g]+m[y]>>>0,w=S,S=E,E=o(b,30)>>>0,b=v,v=g}i[0]=i[0]+v>>>0,i[1]=i[1]+b>>>0,i[2]=i[2]+E>>>0,i[3]=i[3]+S>>>0,i[4]=i[4]+w>>>0}return[i[0]>>24&255,i[0]>>16&255,i[0]>>8&255,255&i[0],i[1]>>24&255,i[1]>>16&255,i[1]>>8&255,255&i[1],i[2]>>24&255,i[2]>>16&255,i[2]>>8&255,255&i[2],i[3]>>24&255,i[3]>>16&255,i[3]>>8&255,255&i[3],i[4]>>24&255,i[4]>>16&255,i[4]>>8&255,255&i[4]]}},{}],33:[function(e,s,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var o=(e=e("./validate.js"))&&e.__esModule?e:{default:e};let a=[];for(let c=0;c<256;++c)a.push((c+256).toString(16).substr(1));r.default=function(c){let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(c=(a[c[i+0]]+a[c[i+1]]+a[c[i+2]]+a[c[i+3]]+"-"+a[c[i+4]]+a[c[i+5]]+"-"+a[c[i+6]]+a[c[i+7]]+"-"+a[c[i+8]]+a[c[i+9]]+"-"+a[c[i+10]]+a[c[i+11]]+a[c[i+12]]+a[c[i+13]]+a[c[i+14]]+a[c[i+15]]).toLowerCase(),(0,o.default)(c))return c;throw TypeError("Stringified UUID is invalid")}},{"./validate.js":39}],34:[function(e,s,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var o=c(e("./rng.js")),a=c(e("./stringify.js"));function c(p){return p&&p.__esModule?p:{default:p}}let i,u,f=0,d=0;r.default=function(p,h,m){var g=h&&m||0,_=h||new Array(16);let v=(p=p||{}).node||i,b=p.clockseq!==void 0?p.clockseq:u,E=(v!=null&&b!=null||(m=p.random||(p.rng||o.default)(),v==null&&(v=i=[1|m[0],m[1],m[2],m[3],m[4],m[5]]),b==null&&(b=u=16383&(m[6]<<8|m[7]))),m=p.msecs!==void 0?p.msecs:Date.now(),p.nsecs!==void 0?p.nsecs:d+1);var S=m-f+(E-d)/1e4;if(S<0&&p.clockseq===void 0&&(b=b+1&16383),1e4<=(E=(S<0||m>f)&&p.nsecs===void 0?0:E))throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");f=m,d=E,u=b,S=(1e4*(268435455&(m+=122192928e5))+E)%4294967296,_[g++]=S>>>24&255,_[g++]=S>>>16&255,_[g++]=S>>>8&255,_[g++]=255&S,_[g++]=(p=m/4294967296*1e4&268435455)>>>8&255,_[g++]=255&p,_[g++]=p>>>24&15|16,_[g++]=p>>>16&255,_[g++]=b>>>8|128,_[g++]=255&b;for(let w=0;w<6;++w)_[g+w]=v[w];return h||(0,a.default)(_)}},{"./rng.js":31,"./stringify.js":33}],35:[function(e,s,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var o=a(e("./v35.js"));function a(c){return c&&c.__esModule?c:{default:c}}e=a(e("./md5.js")),o=(0,o.default)("v3",48,e.default),r.default=o},{"./md5.js":27,"./v35.js":36}],36:[function(e,s,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(f,d,p){function h(m,g,_,v){if(typeof m=="string"&&(m=(E=>{E=unescape(encodeURIComponent(E));var S=[];for(let w=0;w<E.length;++w)S.push(E.charCodeAt(w));return S})(m)),(g=typeof g=="string"?(0,a.default)(g):g).length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let b=new Uint8Array(16+m.length);if(b.set(g),b.set(m,g.length),(b=p(b))[6]=15&b[6]|d,b[8]=63&b[8]|128,_){v=v||0;for(let E=0;E<16;++E)_[v+E]=b[E];return _}return(0,o.default)(b)}try{h.name=f}catch{}return h.DNS=i,h.URL=u,h},r.URL=r.DNS=void 0;var o=c(e("./stringify.js")),a=c(e("./parse.js"));function c(f){return f&&f.__esModule?f:{default:f}}let i="6ba7b810-9dad-11d1-80b4-00c04fd430c8",u=(r.DNS=i,"6ba7b811-9dad-11d1-80b4-00c04fd430c8");r.URL=u},{"./parse.js":29,"./stringify.js":33}],37:[function(e,s,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var o=c(e("./rng.js")),a=c(e("./stringify.js"));function c(i){return i&&i.__esModule?i:{default:i}}r.default=function(i,u,f){var d=(i=i||{}).random||(i.rng||o.default)();if(d[6]=15&d[6]|64,d[8]=63&d[8]|128,u){f=f||0;for(let p=0;p<16;++p)u[f+p]=d[p];return u}return(0,a.default)(d)}},{"./rng.js":31,"./stringify.js":33}],38:[function(e,s,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var o=a(e("./v35.js"));function a(c){return c&&c.__esModule?c:{default:c}}e=a(e("./sha1.js")),o=(0,o.default)("v5",80,e.default),r.default=o},{"./sha1.js":32,"./v35.js":36}],39:[function(e,s,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var o=(e=e("./regex.js"))&&e.__esModule?e:{default:e};r.default=function(a){return typeof a=="string"&&o.default.test(a)}},{"./regex.js":30}],40:[function(e,s,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var o=(e=e("./validate.js"))&&e.__esModule?e:{default:e};r.default=function(a){if((0,o.default)(a))return parseInt(a.substr(14,1),16);throw TypeError("Invalid UUID")}},{"./validate.js":39}],41:[function(e,s,r){var o=(c=e("@babel/runtime/helpers/interopRequireDefault"))(e("@babel/runtime/helpers/toConsumableArray")),a=c(e("@babel/runtime/helpers/classCallCheck")),c=c(e("@babel/runtime/helpers/createClass")),i=(E=e("./logger")).log4,u=(E=e("./type")).isRealObject,f=E.isObjectId,d=E.isDefined,p=E.isPrimitiveArray,h=E.getType,m=e("./configDepUtils"),g=(E=e("./utils")).deLabel,_=E.equal,v=e("./path").samePath,b=e("./errors").OperationError,E=(0,c.default)(function S(w){(0,a.default)(this,S),this._config=w,this._utils=new m(w)},[{key:"isMatchingObjects",value:function(S,w,y){return w=(S=this._utils.getObjectIdentifiers({input:S,output:w,path:y})).inputId,y=S.outputId,S=S.sameId,f(w)&&f(y)&&S}},{key:"haveObjectIds",value:function(S,w,y){return!!(S.li&&w.ld||S.ld&&w.li)&&(!!(Array.isArray(S.ld)&&Array.isArray(w.li)||Array.isArray(w.ld)&&Array.isArray(S.li))||(S=this._utils.getOpTargetObject(S),w=this._utils.getOpTargetObject(w),w=(S=this._utils.getObjectIdentifiers({input:S,output:w,path:y})).inputId,y=S.outputId,f(w)&&f(y)))}},{key:"isMatchingOpPair",value:function(S,w,y){return!!((S.li&&w.ld||S.ld&&w.li)&&(Array.isArray(S.ld)&&Array.isArray(w.li)&&this.sameTargetArray(S.ld,w.li)||Array.isArray(w.ld)&&Array.isArray(S.li)&&this.sameTargetArray(w.ld,S.li)||this.isMatchingObjects(this._utils.getOpTargetObject(S),this._utils.getOpTargetObject(w),y)))}},{key:"isObjReplace",value:function(S,w){return!(!S||!w||S.oi!=null||S.od===void 0||w.od!=null||w.oi===void 0||!v(S.p,w.p))}},{key:"isReplace",value:function(S,w){return!(!S||!w||!((S.li&&w.ld||S.ld&&w.li)&&v(S.p,w.p)&&this.haveObjectIds(S,w,S.p)))}},{key:"isMove",value:function(S,w){return!(!S||!w||v(S.p,w.p)||!this.isMatchingOpPair(S,w,S.p))}},{key:"isIdentity",value:function(S,w){return i("isIdentity",S,w,!0),!(!S||!w)&&v(S.p,w.p)&&this.isMatchingOpPair(S,w,S.p)}},{key:"arrayDiff",value:function(S,w){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:[],x=3<arguments.length?arguments[3]:void 0;if(i("Start performing arrayDiff: beforeState = ",S,!0),i("Start performing arrayDiff: afterState",w,!0),!Array.isArray(S))throw new b("beforeState snapshot is not an array");if(!Array.isArray(w))throw new b("afterState snapshot is not an array");var C=[],T=0,F=0,B=0,D=0;for(T=0,F=0;F<w.length&&T<S.length;T++){i("arrayDiff: loop at",{i:T,j:F},!0);var L,O=S[T],j=T-B;j=[].concat((0,o.default)(y),[j]),this.isMatchingObjects(S[T],w[F],y)?(L=x(O,w[F],j),i("arrayDiff: same target object (id) -> recursively diff result = ",{r:L},!0),C=C.concat(L),F++):(L={p:j,ld:g(O)},C.push(L),i("arrayDiff: different target object (id) -> create a ld op = ",{op:L,i:T,dCount:++B},!0))}for(var N=T;N<S.length;N++){var R=S[N],A=N-B;A={p:[].concat((0,o.default)(y),[A]),ld:g(R)},C.push(A),i("arrayDiff: handle beforeState tail, create a ld op",{op:A,pos:N},!0),B++}for(var U=F;U<w.length;U++){var M=w[U],z=U;z={p:[].concat((0,o.default)(y),[z]),li:g(M)},C.push(z),i("arrayDiff: handle afterState tail, create a li op",{op:z,pos:U},!0),D++}return{ops:C,dCount:B,iCount:D}}},{key:"arrayOfArrayDiff",value:function(){var S,w,y=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{},x=y.before,C=y.after,T=y.path,F=y.commonHeaderLen,B=y.diff,D=y.isObjectArray,L=y.isInternal,O=[],j=0,N=0,R=0;for(j=0,N=0;N<C.length&&j<x.length;j++)!D&&(this.sameTargetArray(x[j],C[N])||p(x[j])&&p(C[N])||h(x[j])=="array"&&h(C[N]=="array"))||D&&this.isMatchingObjects(x[j],C[N],T)?(i(`
69
76
  arrayOfArrayDiff: the same array -> recursive invocation of diff: i = `+j+"; j = "+N),i("before[i] = ",x[j]),i("after[j] = ",C[N]),S=B(x[j],C[N],[].concat((0,o.default)(T),[j+F-R]),L),O=O.concat(S),i("arrayOfArrayDiff: the same array -> recursively generate r = ",S),i("arrayOfArrayDiff: the same array -> ops = ",O),N++):(S=j-R+F,w={p:[].concat((0,o.default)(T),[S]),ld:x[j]},O.push(w),i(`