@ones-editor/editor 1.1.27-beta.2 → 1.1.27-beta.4

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.js CHANGED
@@ -639,7 +639,7 @@ __p += '`),ne&&(st+=`' +
639
639
  function print() { __p += __j.call(arguments, '') }
640
640
  `:`;
641
641
  `)+st+`return __p
642
- }`;var Wt=D6(function(){return se(L,kt+"return "+st).apply(e,P)});if(Wt.source=st,mb(Wt))throw Wt;return Wt}function Lst(a){return pe(a).toLowerCase()}function Ist(a){return pe(a).toUpperCase()}function Dst(a,u,g){if(a=pe(a),a&&(g||u===e))return wo(a);if(!a||!(u=Pr(u)))return a;var x=Nr(a),y=Nr(u),L=oc(x,y),P=Nh(x,y)+1;return Xl(x,L,P).join("")}function _st(a,u,g){if(a=pe(a),a&&(g||u===e))return a.slice(0,sf(a)+1);if(!a||!(u=Pr(u)))return a;var x=Nr(a),y=Nh(x,Nr(u))+1;return Xl(x,0,y).join("")}function Mst(a,u,g){if(a=pe(a),a&&(g||u===e))return a.replace(ja,"");if(!a||!(u=Pr(u)))return a;var x=Nr(a),y=oc(x,Nr(u));return Xl(x,y).join("")}function Ust(a,u){var g=wt,x=Tt;if(ze(u)){var y="separator"in u?u.separator:y;g="length"in u?jt(u.length):g,x="omission"in u?Pr(u.omission):x}a=pe(a);var L=a.length;if(So(a)){var P=Nr(a);L=P.length}if(g>=L)return a;var K=g-jl(x);if(K<1)return x;var H=P?Xl(P,0,K).join(""):a.slice(0,K);if(y===e)return H+x;if(P&&(K+=H.length-K),gb(y)){if(a.slice(K).search(y)){var Z,tt=H;for(y.global||(y=cf(y.source,pe(Ul.exec(y))+"g")),y.lastIndex=0;Z=y.exec(tt);)var st=Z.index;H=H.slice(0,st===e?K:st)}}else if(a.indexOf(Pr(y),K)!=K){var At=H.lastIndexOf(y);At>-1&&(H=H.slice(0,At))}return H+x}function Ost(a){return a=pe(a),a&&$u.test(a)?a.replace(Vu,of):a}var Nst=ff(function(a,u,g){return a+(g?" ":"")+u.toUpperCase()}),Eb=_L("toUpperCase");function I6(a,u,g){return a=pe(a),u=g?e:u,u===e?ef(a)?qg(a):ee(a):a.match(u)||[]}var D6=qt(function(a,u){try{return Nn(a,e,u)}catch(g){return mb(g)?g:new Nt(g)}}),Pst=$o(function(a,u){return Gn(u,function(g){g=Us(g),Ko(a,g,db(a[g],a))}),a});function Fst(a){var u=a==null?0:a.length,g=It();return a=u?dt(a,function(x){if(typeof x[1]!="function")throw new er(o);return[g(x[0]),x[1]]}):[],qt(function(x){for(var y=-1;++y<u;){var L=a[y];if(Nn(L[0],this,x))return Nn(L[1],this,x)}})}function Kst(a){return uet(ci(a,C))}function Ab(a){return function(){return a}}function Vst(a,u){return a==null||a!==a?u:a}var $st=UL(),Hst=UL(!0);function br(a){return a}function xb(a){return fL(typeof a=="function"?a:ci(a,C))}function jst(a){return hL(ci(a,C))}function zst(a,u){return mL(a,ci(u,C))}var Gst=qt(function(a,u){return function(g){return Wh(g,a,u)}}),Wst=qt(function(a,u){return function(g){return Wh(a,g,u)}});function bb(a,u,g){var x=Sn(u),y=sp(u,x);g==null&&!(ze(u)&&(y.length||!x.length))&&(g=u,u=a,a=this,y=sp(u,Sn(u)));var L=!(ze(g)&&"chain"in g)||!!g.chain,P=jo(a);return Gn(y,function(K){var H=u[K];a[K]=H,P&&(a.prototype[K]=function(){var Z=this.__chain__;if(L||Z){var tt=a(this.__wrapped__),st=tt.__actions__=Er(this.__actions__);return st.push({func:H,args:arguments,thisArg:a}),tt.__chain__=Z,tt}return H.apply(a,$t([this.value()],arguments))})}),a}function qst(){return Ye._===this&&(Ye._=Yg),this}function vb(){}function Xst(a){return a=jt(a),qt(function(u){return gL(u,a)})}var Yst=Zx(dt),Qst=Zx(N),Jst=Zx(we);function _6(a){return ob(a)?Ki(Us(a)):Ret(a)}function Zst(a){return function(u){return a==null?e:yc(a,u)}}var tot=NL(),eot=NL(!0);function Bb(){return[]}function yb(){return!1}function not(){return{}}function rot(){return""}function iot(){return!0}function sot(a,u){if(a=jt(a),a<1||a>yn)return[];var g=hr,x=O(a,hr);u=It(u),a-=hr;for(var y=tf(x,u);++g<a;)u(g);return y}function oot(a){return Vt(a)?dt(a,Us):Fr(a)?[a]:Er(ZL(pe(a)))}function lot(a){var u=++Xg;return pe(a)+u}var aot=fp(function(a,u){return a+u},0),cot=tb("ceil"),uot=fp(function(a,u){return a/u},1),fot=tb("floor");function dot(a){return a&&a.length?ip(a,br,Fx):e}function hot(a,u){return a&&a.length?ip(a,It(u,2),Fx):e}function mot(a){return Ro(a,br)}function got(a,u){return Ro(a,It(u,2))}function pot(a){return a&&a.length?ip(a,br,Hx):e}function Cot(a,u){return a&&a.length?ip(a,It(u,2),Hx):e}var Eot=fp(function(a,u){return a*u},1),Aot=tb("round"),xot=fp(function(a,u){return a-u},0);function bot(a){return a&&a.length?Zu(a,br):0}function vot(a,u){return a&&a.length?Zu(a,It(u,2)):0}return R.after=jrt,R.ary=u6,R.assign=Iit,R.assignIn=y6,R.assignInWith=yp,R.assignWith=Dit,R.at=_it,R.before=f6,R.bind=db,R.bindAll=Pst,R.bindKey=d6,R.castArray=nit,R.chain=l6,R.chunk=fnt,R.compact=dnt,R.concat=hnt,R.cond=Fst,R.conforms=Kst,R.constant=Ab,R.countBy=brt,R.create=Mit,R.curry=h6,R.curryRight=m6,R.debounce=g6,R.defaults=Uit,R.defaultsDeep=Oit,R.defer=zrt,R.delay=Grt,R.difference=mnt,R.differenceBy=gnt,R.differenceWith=pnt,R.drop=Cnt,R.dropRight=Ent,R.dropRightWhile=Ant,R.dropWhile=xnt,R.fill=bnt,R.filter=Brt,R.flatMap=krt,R.flatMapDeep=Rrt,R.flatMapDepth=wrt,R.flatten=r6,R.flattenDeep=vnt,R.flattenDepth=Bnt,R.flip=Wrt,R.flow=$st,R.flowRight=Hst,R.fromPairs=ynt,R.functions=Hit,R.functionsIn=jit,R.groupBy=Srt,R.initial=knt,R.intersection=Rnt,R.intersectionBy=wnt,R.intersectionWith=Snt,R.invert=Git,R.invertBy=Wit,R.invokeMap=Irt,R.iteratee=xb,R.keyBy=Drt,R.keys=Sn,R.keysIn=xr,R.map=Ep,R.mapKeys=Xit,R.mapValues=Yit,R.matches=jst,R.matchesProperty=zst,R.memoize=xp,R.merge=Qit,R.mergeWith=T6,R.method=Gst,R.methodOf=Wst,R.mixin=bb,R.negate=bp,R.nthArg=Xst,R.omit=Jit,R.omitBy=Zit,R.once=qrt,R.orderBy=_rt,R.over=Yst,R.overArgs=Xrt,R.overEvery=Qst,R.overSome=Jst,R.partial=hb,R.partialRight=p6,R.partition=Mrt,R.pick=tst,R.pickBy=k6,R.property=_6,R.propertyOf=Zst,R.pull=_nt,R.pullAll=s6,R.pullAllBy=Mnt,R.pullAllWith=Unt,R.pullAt=Ont,R.range=tot,R.rangeRight=eot,R.rearg=Yrt,R.reject=Nrt,R.remove=Nnt,R.rest=Qrt,R.reverse=ub,R.sampleSize=Frt,R.set=nst,R.setWith=rst,R.shuffle=Krt,R.slice=Pnt,R.sortBy=Hrt,R.sortedUniq=znt,R.sortedUniqBy=Gnt,R.split=kst,R.spread=Jrt,R.tail=Wnt,R.take=qnt,R.takeRight=Xnt,R.takeRightWhile=Ynt,R.takeWhile=Qnt,R.tap=drt,R.throttle=Zrt,R.thru=Cp,R.toArray=b6,R.toPairs=R6,R.toPairsIn=w6,R.toPath=oot,R.toPlainObject=B6,R.transform=ist,R.unary=tit,R.union=Jnt,R.unionBy=Znt,R.unionWith=trt,R.uniq=ert,R.uniqBy=nrt,R.uniqWith=rrt,R.unset=sst,R.unzip=fb,R.unzipWith=o6,R.update=ost,R.updateWith=lst,R.values=mf,R.valuesIn=ast,R.without=irt,R.words=I6,R.wrap=eit,R.xor=srt,R.xorBy=ort,R.xorWith=lrt,R.zip=art,R.zipObject=crt,R.zipObjectDeep=urt,R.zipWith=frt,R.entries=R6,R.entriesIn=w6,R.extend=y6,R.extendWith=yp,bb(R,R),R.add=aot,R.attempt=D6,R.camelCase=dst,R.capitalize=S6,R.ceil=cot,R.clamp=cst,R.clone=rit,R.cloneDeep=sit,R.cloneDeepWith=oit,R.cloneWith=iit,R.conformsTo=lit,R.deburr=L6,R.defaultTo=Vst,R.divide=uot,R.endsWith=hst,R.eq=ji,R.escape=mst,R.escapeRegExp=gst,R.every=vrt,R.find=yrt,R.findIndex=e6,R.findKey=Nit,R.findLast=Trt,R.findLastIndex=n6,R.findLastKey=Pit,R.floor=fot,R.forEach=a6,R.forEachRight=c6,R.forIn=Fit,R.forInRight=Kit,R.forOwn=Vit,R.forOwnRight=$it,R.get=pb,R.gt=ait,R.gte=cit,R.has=zit,R.hasIn=Cb,R.head=i6,R.identity=br,R.includes=Lrt,R.indexOf=Tnt,R.inRange=ust,R.invoke=qit,R.isArguments=Rc,R.isArray=Vt,R.isArrayBuffer=uit,R.isArrayLike=Ar,R.isArrayLikeObject=rn,R.isBoolean=fit,R.isBuffer=Yl,R.isDate=dit,R.isElement=hit,R.isEmpty=mit,R.isEqual=git,R.isEqualWith=pit,R.isError=mb,R.isFinite=Cit,R.isFunction=jo,R.isInteger=C6,R.isLength=vp,R.isMap=E6,R.isMatch=Eit,R.isMatchWith=Ait,R.isNaN=xit,R.isNative=bit,R.isNil=Bit,R.isNull=vit,R.isNumber=A6,R.isObject=ze,R.isObjectLike=Je,R.isPlainObject=Zh,R.isRegExp=gb,R.isSafeInteger=yit,R.isSet=x6,R.isString=Bp,R.isSymbol=Fr,R.isTypedArray=hf,R.isUndefined=Tit,R.isWeakMap=kit,R.isWeakSet=Rit,R.join=Lnt,R.kebabCase=pst,R.last=fi,R.lastIndexOf=Int,R.lowerCase=Cst,R.lowerFirst=Est,R.lt=wit,R.lte=Sit,R.max=dot,R.maxBy=hot,R.mean=mot,R.meanBy=got,R.min=pot,R.minBy=Cot,R.stubArray=Bb,R.stubFalse=yb,R.stubObject=not,R.stubString=rot,R.stubTrue=iot,R.multiply=Eot,R.nth=Dnt,R.noConflict=qst,R.noop=vb,R.now=Ap,R.pad=Ast,R.padEnd=xst,R.padStart=bst,R.parseInt=vst,R.random=fst,R.reduce=Urt,R.reduceRight=Ort,R.repeat=Bst,R.replace=yst,R.result=est,R.round=Aot,R.runInContext=$,R.sample=Prt,R.size=Vrt,R.snakeCase=Tst,R.some=$rt,R.sortedIndex=Fnt,R.sortedIndexBy=Knt,R.sortedIndexOf=Vnt,R.sortedLastIndex=$nt,R.sortedLastIndexBy=Hnt,R.sortedLastIndexOf=jnt,R.startCase=Rst,R.startsWith=wst,R.subtract=xot,R.sum=bot,R.sumBy=vot,R.template=Sst,R.times=sot,R.toFinite=zo,R.toInteger=jt,R.toLength=v6,R.toLower=Lst,R.toNumber=di,R.toSafeInteger=Lit,R.toString=pe,R.toUpper=Ist,R.trim=Dst,R.trimEnd=_st,R.trimStart=Mst,R.truncate=Ust,R.unescape=Ost,R.uniqueId=lot,R.upperCase=Nst,R.upperFirst=Eb,R.each=a6,R.eachRight=c6,R.first=i6,bb(R,function(){var a={};return _s(R,function(u,g){oe.call(R.prototype,g)||(a[g]=u)}),a}(),{chain:!1}),R.VERSION=r,Gn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(a){R[a].placeholder=R}),Gn(["drop","take"],function(a,u){Yt.prototype[a]=function(g){g=g===e?1:I(jt(g),0);var x=this.__filtered__&&!u?new Yt(this):this.clone();return x.__filtered__?x.__takeCount__=O(g,x.__takeCount__):x.__views__.push({size:O(g,hr),type:a+(x.__dir__<0?"Right":"")}),x},Yt.prototype[a+"Right"]=function(g){return this.reverse()[a](g).reverse()}}),Gn(["filter","map","takeWhile"],function(a,u){var g=u+1,x=g==fe||g==fr;Yt.prototype[a]=function(y){var L=this.clone();return L.__iteratees__.push({iteratee:It(y,3),type:g}),L.__filtered__=L.__filtered__||x,L}}),Gn(["head","last"],function(a,u){var g="take"+(u?"Right":"");Yt.prototype[a]=function(){return this[g](1).value()[0]}}),Gn(["initial","tail"],function(a,u){var g="drop"+(u?"":"Right");Yt.prototype[a]=function(){return this.__filtered__?new Yt(this):this[g](1)}}),Yt.prototype.compact=function(){return this.filter(br)},Yt.prototype.find=function(a){return this.filter(a).head()},Yt.prototype.findLast=function(a){return this.reverse().find(a)},Yt.prototype.invokeMap=qt(function(a,u){return typeof a=="function"?new Yt(this):this.map(function(g){return Wh(g,a,u)})}),Yt.prototype.reject=function(a){return this.filter(bp(It(a)))},Yt.prototype.slice=function(a,u){a=jt(a);var g=this;return g.__filtered__&&(a>0||u<0)?new Yt(g):(a<0?g=g.takeRight(-a):a&&(g=g.drop(a)),u!==e&&(u=jt(u),g=u<0?g.dropRight(-u):g.take(u-a)),g)},Yt.prototype.takeRightWhile=function(a){return this.reverse().takeWhile(a).reverse()},Yt.prototype.toArray=function(){return this.take(hr)},_s(Yt.prototype,function(a,u){var g=/^(?:filter|find|map|reject)|While$/.test(u),x=/^(?:head|last)$/.test(u),y=R[x?"take"+(u=="last"?"Right":""):u],L=x||/^find/.test(u);!y||(R.prototype[u]=function(){var P=this.__wrapped__,K=x?[1]:arguments,H=P instanceof Yt,Z=K[0],tt=H||Vt(P),st=function(Jt){var ne=y.apply(R,$t([Jt],K));return x&&At?ne[0]:ne};tt&&g&&typeof Z=="function"&&Z.length!=1&&(H=tt=!1);var At=this.__chain__,kt=!!this.__actions__.length,Dt=L&&!At,Wt=H&&!kt;if(!L&&tt){P=Wt?P:new Yt(this);var _t=a.apply(P,K);return _t.__actions__.push({func:Cp,args:[st],thisArg:e}),new Cr(_t,At)}return Dt&&Wt?a.apply(this,K):(_t=this.thru(st),Dt?x?_t.value()[0]:_t.value():_t)})}),Gn(["pop","push","shift","sort","splice","unshift"],function(a){var u=uc[a],g=/^(?:push|sort|unshift)$/.test(a)?"tap":"thru",x=/^(?:pop|shift)$/.test(a);R.prototype[a]=function(){var y=arguments;if(x&&!this.__chain__){var L=this.value();return u.apply(Vt(L)?L:[],y)}return this[g](function(P){return u.apply(Vt(P)?P:[],y)})}}),_s(Yt.prototype,function(a,u){var g=R[u];if(g){var x=g.name+"";oe.call(Pn,x)||(Pn[x]=[]),Pn[x].push({name:u,func:g})}}),Pn[up(e,U).name]=[{name:"wrapper",func:e}],Yt.prototype.clone=Mtt,Yt.prototype.reverse=Utt,Yt.prototype.value=Ott,R.prototype.at=hrt,R.prototype.chain=mrt,R.prototype.commit=grt,R.prototype.next=prt,R.prototype.plant=Ert,R.prototype.reverse=Art,R.prototype.toJSON=R.prototype.valueOf=R.prototype.value=xrt,R.prototype.first=R.prototype.head,Cc&&(R.prototype[Cc]=Crt),R},Do=af();si?((si.exports=Do)._=Do,tc._=Do):Ye._=Do}).call(Bn)})(Ii,Ii.exports);function HK(n,t,e,r){_0(n,{className:"status-input",defaultValue:t,onChange:e,onKeyDown:r,maxLength:32})}const zk=["Blue","Grey","Yellow","Red","Green","Purple"];function jK(){const n=B("div",["status-color-palette"],null);for(const t of zk){const e=B("button",["status-box-button"],null);e.setAttribute("data-color",Ii.exports.lowerCase(t)),e.setAttribute("title",_.t(`status.color.${Ii.exports.lowerCase(t)}`)),n.appendChild(e)}return n}class zK{constructor(){m(this,"root",jK());m(this,"changeColor",t=>{for(const r of Array.from(this.root.querySelectorAll(":scope > button")))r.classList.remove("selected");const e=this.root.querySelector(`button[data-color="${Ii.exports.lowerCase(t)}"]`);e==null||e.classList.add("selected")})}}function Gk(n){localStorage.setItem(`statusBox.lastColor.${Ii.exports.lowerCase(n.color)}`,n.title)}function Wk(n){var t;return(t=localStorage.getItem(`statusBox.lastColor.${Ii.exports.lowerCase(n)}`))!=null?t:_.t(`status.colorDefaultTitle.${Ii.exports.lowerCase(n)}`)}function qk(){var i;const n=zk[0],t=(i=Wk(n))!=null?i:_.t(`status.colorDefaultTitle.${Ii.exports.lowerCase(n)}`);return{insert:" ",attributes:{id:it(),type:"status",box:!0,title:t,subtle:!0,created:Date.now(),color:n}}}const ig=D("StatusBoxEditor");class Xk{constructor(t){m(this,"linkPopup",null);m(this,"boxElement");m(this,"statusPalette",new zK);m(this,"isEditing",!1);m(this,"editorStatus",t=>{if(!this.editor.isWritable())return;const e=this.editor.getBoxData(t);this.linkPopup=new su(this.createPopupContent(e.title,e.color,e.subtle),{id:"status-box-popup"}),this.linkPopup.on("show",this.handleShow),this.linkPopup.on("close",this.handClose),this.linkPopup.manualShow(t,{theme:"light",placement:"bottom-start",offset:[5,5]}),this.boxElement=t});m(this,"handleShow",()=>{this.focus()});m(this,"handClose",()=>{var r;p(ig,this.boxElement,"boxElement not found");const t=this.editor.getBoxData(this.boxElement),e=et(this.boxElement);if(p(ig,e,"block not found"),t.title)if(t.title.length>32){const i=t.title.slice(0,32),s={...t,title:i};this.editor.updateBoxData(s,{noFocus:!0}),Gk(s)}else Gk(t);else{const i=nl(e,this.boxElement);this.editor.deleteTextFromBlock(e,i.start,1)}this.editor.focus(),(r=this.linkPopup)==null||r.destroy(),this.linkPopup=null,this.boxElement=void 0,this.isEditing=!1});m(this,"handleKeyDown",(t,e)=>{var r;e||t.key==="Enter"&&((r=this.linkPopup)==null||r.close(null))});m(this,"onColorChange",t=>{var s,o;if(!(t.target instanceof HTMLElement)||t.target.closest("[data-color]")===null)return;const e=Ii.exports.capitalize(t.target.getAttribute("data-color"));p(ig,this.boxElement,"boxElement not found");const r=this.editor.getBoxData(this.boxElement);this.statusPalette.changeColor(e);const i={...r,color:e};if(!this.isEditing){const l=(o=(s=this.linkPopup)==null?void 0:s.popper)==null?void 0:o.querySelector("input"),c=Wk(e);l&&(l.value=c),i.title=c}this.editor.updateBoxData(i,{noFocus:!0}),this.focus()});m(this,"onTitleChange",t=>{const e=t.target.value;p(ig,this.boxElement,"boxElement not found");const i={...this.editor.getBoxData(this.boxElement),title:e.trim()};this.editor.updateBoxData(i,{noFocus:!0}),this.isEditing=!0});this.editor=t,this.statusPalette.root.addEventListener("click",this.onColorChange)}focus(){setTimeout(()=>{var t,e,r,i,s,o;(r=(e=(t=this.linkPopup)==null?void 0:t.popper)==null?void 0:e.querySelector("input"))==null||r.focus(),(o=(s=(i=this.linkPopup)==null?void 0:i.popper)==null?void 0:s.querySelector("input"))==null||o.select()},100)}createPopupContent(t,e,r){const i=B("div",["status-box-editor-popup"],null);return HK(i,t,this.onTitleChange,this.handleKeyDown),this.isEditing=!1,i.appendChild(this.statusPalette.root),this.statusPalette.changeColor(e),i}destroy(){var t;(t=this.linkPopup)==null||t.destroy()}}const lat="",GK=D("status-box-command");class Sd{static get commands(){return[{id:this.id,name:_.t("status.command.name"),icon:g2,order:650,group:"common",subText:"/status"}]}static insertStatus(t,e,r){var c;const i=t.getBlockByIndex(e,r),s=qk(),{start:o}=t.selection.range;p(GK,xi(o),"invalid block position"),t.insertBoxToBlock(i,o.offset,s.attributes);const l=t.getBoxById((c=s.attributes)==null?void 0:c.id);t.addCustom("status-box",d=>new Xk(d)).editorStatus(l)}static insertEmptyBlockStatus(t,e,r){var l;let i=t.getBlockByIndex(e,r);(!i||!ve(t,i))&&(i=t.insertTextBlock([],e,r));const s=qk();t.setBlockText(i,[s]);const o=t.getBoxById((l=s.attributes)==null?void 0:l.id);return t.addCustom("status-box",c=>new Xk(c)).editorStatus(o),i}}m(Sd,"id","insert-status");const WK={"en-US":{status:{empty:"Set status",command:{name:"Status"},color:{red:"Red",yellow:"Yellow",green:"Green",blue:"Blue",purple:"Purple",grey:"Gray"},colorDefaultTitle:{red:"Delayed",yellow:"In progress",green:"Done",blue:"Not started",purple:"To be confirmed",grey:"Paused"}}},"zh-CN":{status:{empty:"\u8BBE\u7F6E\u72B6\u6001",command:{name:"\u72B6\u6001"},color:{red:"\u7EA2\u8272",yellow:"\u9EC4\u8272",green:"\u7EFF\u8272",blue:"\u84DD\u8272",purple:"\u7D2B\u8272",grey:"\u7070\u8272"},colorDefaultTitle:{red:"\u5DF2\u5EF6\u671F",yellow:"\u8FDB\u884C\u4E2D",green:"\u5DF2\u5B8C\u6210",blue:"\u672A\u5F00\u59CB",purple:"\u5F85\u786E\u8BA4",grey:"\u5DF2\u6682\u505C"}}},"ja-JP":{status:{empty:"\u30B9\u30C6\u30FC\u30BF\u30B9\u3092\u8A2D\u5B9A",command:{name:"\u30B9\u30C6\u30FC\u30BF\u30B9"},color:{red:"\u8D64",yellow:"\u9EC4",green:"\u7EFF",blue:"\u9752",purple:"\u7D2B",grey:"\u7070"},colorDefaultTitle:{red:"\u9045\u5EF6",yellow:"\u9032\u884C\u4E2D",green:"\u5B8C\u4E86",blue:"\u672A\u7740\u624B",purple:"\u672A\u78BA\u8A8D",grey:"\u4E00\u6642\u505C\u6B62"}}}};_.mergeLang(WK);const wa=D("inline-box-items");function qK(n,t,e){return n.undoManager.runInGroup(()=>{var o;let r=n.findBlockByIndex(t,e);(!r||!ve(n,r))&&(r=n.insertTextBlock([],t,e));const i=$k();n.setBlockText(r,[i]);const s=(o=i.attributes)==null?void 0:o.id;return p(wa,s,"mathjax box id is empty"),setTimeout(()=>{const l=n.getBoxById(s);rg(n,l)},100),r})}function XK(n,t,e){let r=n.findBlockByIndex(t,e),i="bottom-start";return(!r||!ve(n,r))&&(i="top-start",r=n.insertTextBlock([],t,e)),kd(n,{target:r,linkText:"",linkUrl:"",onFinished:(l,c)=>{n.undoManager.runInGroup(()=>{try{p(wa,r,"block not found"),ve(n,r)||(r=n.insertTextBlock([],t,e));const d=qr(l,{link:c}),h=qr(" ",null),C=[d,h];n.insertTextToBlock(r,0,C),n.selection.selectBlock(r,Vn(C)),n.focus()}catch(d){wa.error(d)}})},onClose:()=>{n.focus()},placement:i}),r}function YK(n,t,e){return n.undoManager.runInGroup(()=>{var l;const r=n.getBlockByIndex(t,e),i=n.selection.range;p(wa,xi(i.start),"invalid block position");const s=$k();n.insertBoxToBlock(r,i.start.offset,s.attributes);const o=(l=s.attributes)==null?void 0:l.id;return p(wa,o,"mathjax box id is empty"),setTimeout(()=>{const c=n.getBoxById(o);rg(n,c)},100),r})}function QK(n,t,e){const r=n.getBlockByIndex(t,e),i=n.selection.range;p(wa,xi(i.start),"invalid block position");const s=Fs(n,r,i);if(s.length===0)return;const o=s[0],l=$s(n,r,"quick-menu-inline-link",o);kd(n,{target:l,linkText:"",linkUrl:"",onFinished:(h,C)=>{n.undoManager.runInGroup(()=>{try{const E=n.getBlockText(r),A=Gs(E,i.start.offset,h,{link:C});n.setBlockText(r,A),n.selection.selectBlock(r,i.start.offset+h.length),n.focus()}catch(E){wa.error(E)}})},onClose:()=>{n.focus()},placement:"bottom-start"})}class Yk{getCommands(){return[{id:"insert-math",name:_.t("quickMenu.inlineBox.math"),icon:DT,order:900,group:"common",subText:Qn("insert-math")},{id:"insert-link",name:_.t("quickMenu.inlineBox.link"),icon:rE,order:400,group:"common",subText:Qn("insert-link")}]}async handleUpdateBlockCore(t,e){switch(e.item.id){case"insert-math":return YK(t,e.containerId,e.blockIndex);case"insert-link":return QK(t,e.containerId,e.blockIndex);case Sd.id:return Sd.insertStatus(t,e.containerId,e.blockIndex);default:return null}}async handleInsertEmptyBlockCore(t,e){switch(e.item.id){case"insert-math":return qK(t,e.containerId,e.blockIndex);case"insert-link":return XK(t,e.containerId,e.blockIndex);case Sd.id:return Sd.insertEmptyBlockStatus(t,e.containerId,e.blockIndex);default:return null}}async executeCommand(t,e,r){if(r.from==="quick-menu"||r.from==="add-block-menu"){const i=t.getBlockById(r.blockId),s=t.getParentContainer(i),o=pt(s),l=t.getBlockIndex(i);t.undoManager.runInGroup(()=>this.handleUpdateBlockCore(t,{item:e,containerId:o,blockIndex:l}))}else r.from==="block-menu"&&t.undoManager.runInGroup(()=>this.handleInsertEmptyBlockCore(t,{item:e,containerId:r.containerId,blockIndex:r.blockIndex}));return null}}const Qk=(n,t)=>{var e;return(e=n.children)==null?void 0:e.map(r=>({...r,itemType:"insert-block",commandProvider:t,children:Qk(r,t)}))};function JK(n,t){var s,o;const{withPlainText:e}=t,r=(o=(s=n.options.componentsOptions)==null?void 0:s.quickMenu)==null?void 0:o.commandProviders;if(!r)return[];const i=[];return[...r,new Uk(e),new Yk].forEach(l=>{const c=l.getCommands(n,t);i.push(...c.map(d=>({...d,itemType:"insert-block",commandProvider:l,children:Qk(d,l)})))}),i}function ZK(n,t){const e=[];return n.editorBlocks.forEach(r=>{if(!r.getOptions)return;const i=r.getOptions(n);!i.insertBlockCommandItems||(i.insertBlockCommandItems.forEach(s=>{Mk(s,i)}),e.push(...i.insertBlockCommandItems))}),e.push(...JK(n,t)),e}function iA(n,t={withPlainText:!1,from:"block-menu"}){const e=ZK(n,t),r=new Map;e.forEach(o=>{var d,h;const l=(d=o.group)!=null?d:"";let c=r.get(l);c?c.items.push(o):(c={group:l,order:o.groupOrder||Ok[l]||1e3,items:[o],hide:(h=o.hideGroupItem)!=null?h:!1},r.set(l,c))});const i=Array.from(r.values());i.sort((o,l)=>o.order-l.order),i.forEach(o=>{o.items.sort((l,c)=>{var d,h;return((d=l.order)!=null?d:0)-((h=c.order)!=null?h:0)})});const s=[];return i.forEach((o,l)=>{const c=`blockMenu.section.${o.group||"common"}`,d=_.t(c),h=d===c?o.group:d;o.hide||s.push({id:`section-${l}`,name:h,type:"section",group:o.group,itemType:"insert-block"}),s.push(...o.items.map(C=>({...C})))}),s}function tV(n,t,e){const r=n.getFocusedBlock();if(!r)return;const i=n.getParentContainer(r),s=pt(i);let l=n.getBlockIndex(r);ve(n,r)||(l+=1);const c=e.trigger?"quick-menu":"add-block-menu";if(t.commandProvider){n.emit("beforeExecCommand",n,t,{source:c}),t.commandProvider.executeCommand(n,t,{from:c,...e});return}!t.blockOptions||!t.blockOptions.handleInsertEmptyBlock||(n.emit("beforeExecCommand",n,t,{source:c}),t.blockOptions.handleInsertEmptyBlock(n,{containerId:s,blockIndex:l,item:t,from:c}))}const Jk=D("quick-menu"),eV={id:"quick-menu",trigger:["/"]},nV=5;class sg{constructor(t,e=eV){m(this,"suggest");m(this,"items");m(this,"maxHeading");m(this,"firstEmptyOffset",-1);m(this,"queryItems",async(t,e)=>{if(this.initMenuItems(),this.refreshMenuItems(),e){const r=new Set,i=e.toLocaleLowerCase().replace(/^\s+|\s+$/g,""),s=this.items.filter(o=>{if(o.type==="section")return!0;if(o.name.toLocaleLowerCase().indexOf(i)!==-1||fN(o).toLocaleLowerCase().indexOf(i)!==-1)return r.add(o.group),!0;const l=`blockMenu.section.${o.group||"common"}`,c=_.t(l),d=c===l?o.group:c;return(d==null?void 0:d.toLocaleLowerCase().indexOf(i))!==-1?(r.add(o.group),!0):!1}).filter(o=>o.type==="section"?r.has(o.group):!0);return s.length?this.firstEmptyOffset=-1:this.handleEmptySearch(),s}return this.items});m(this,"onClose",()=>{this.firstEmptyOffset=-1,this.editor.focus()});m(this,"onShow",(t,e,r,i)=>{const s=this.editor.getBlockByIndex(e,r);if(!Gr(s)){const o=et(at(s));if(o&&Ot(o)==="code")return!1}return!0});m(this,"onClickItem",(t,e)=>{const r=e;r.itemType==="insert-block"&&(p(Jk,r.blockOptions||r.commandProvider,"invalid quick item, no block options or command provider"),p(Jk,this.suggest.anchor,"invalid suggest, no anchor"),this.options.id==="empty-block-menu"&&this.editor.focus(),tV(this.editor,r,this.suggest.anchor))});this.editor=t,this.options=e,this.items=[],this.maxHeading=G0(),this.suggest=new mE(t,{id:e.id||"quick-menu",trigger:e.trigger,needSpaceBeforeTrigger:!0,autoDeleteTrigger:!0,highlight:!0,onClose:this.onClose,onShow:this.onShow,onClickItem:this.onClickItem,queryItems:this.queryItems})}get menu(){return this.suggest.menu.menu}destroy(){this.suggest.destroy()}initMenuItems(){var r;const t=((r=this.suggest.anchor)==null?void 0:r.trigger)==="/"?"quick-menu":"block-menu",e=iA(this.editor,{withPlainText:!1,from:t});this.items=e}refreshMenuItems(){let t=null,e=0;const r=G0();if(r!==this.maxHeading){const i=new Uk,o=i.getCommands().map(l=>({...l,itemType:"insert-block",commandProvider:i}));for(let l=0;l<this.items.length;l++)this.items[l].group==="basics"&&(t||(t=l),t&&e++);t&&e&&this.items.splice(t,e,...o),this.maxHeading=r}}handleEmptySearch(){const t=this.editor.selection.getFocusedPos();if(this.firstEmptyOffset===-1){if(t.isSimple()){const{offset:e}=t;this.firstEmptyOffset=e-1}}else if(t.isSimple()){const{offset:e}=t;e-this.firstEmptyOffset>nV&&(this.suggest.close(),this.firstEmptyOffset=-1)}}}class Ld{constructor(t){m(this,"instance");m(this,"mousedown",!1);m(this,"currentInstance",null);m(this,"attributeName",[]);m(this,"attributeDesc","");m(this,"_lastClickButtonId","");m(this,"observer",null);m(this,"observerCallback",null);m(this,"createContent",t=>{let e="",r=0;for(;r<this.attributeName.length&&!e;)t.hasAttribute(this.attributeName[r])&&(e=t.getAttribute(this.attributeName[r])||""),r++;const i=t.getAttribute(this.attributeDesc);if(!i)return e;const s=B("div",[],null);return B("span",[],s,e),i&&B("span",["editor-tooltip-desc"],s,i),s});m(this,"handleDocumentMouseDown",()=>{this.mousedown=!0,this.editor.domEvents.addEventListener(document,"mouseup",this.handleDocumentMouseUp)});m(this,"handleDocumentMouseUp",()=>{this.mousedown=!1,this.editor.domEvents.removeEventListener(document,"mouseup",this.handleDocumentMouseUp)});m(this,"handleShown",t=>{this.currentInstance&&this.hide(),this.currentInstance=t,this.createObserver()});m(this,"handleHidden",()=>{this.destroyObserver(),this.currentInstance=null});m(this,"handleShow",t=>{var i;const e=t.reference;if(!e||!Ce(document.body,e)||window.isDragging||this.mousedown)return!1;const r=Number.parseInt((i=e.getAttribute("data-tooltip-hide-at"))!=null?i:"",10);if(r&&Date.now()-r<1e3)return!1;if(this._lastClickButtonId===e.getAttribute("data-button-id"))return this._lastClickButtonId="",!1;if(this.attributeName.every(s=>!e.hasAttribute(s)))return!1;if(t.reference){const s={};if(t.reference.hasAttribute("data-editor-tooltip-placement")&&(s.placement=t.reference.getAttribute("data-editor-tooltip-placement")||"top"),t.reference.hasAttribute("data-editor-tooltip-offset-x")||t.reference.hasAttribute("data-editor-tooltip-offset-y")){const l=t.reference.getAttribute("data-editor-tooltip-offset-x"),c=t.reference.getAttribute("data-editor-tooltip-offset-y");s.offset=[l?Number.parseInt(l,10):0,c?Number.parseInt(c,10):0]}t.reference.hasAttribute("data-editor-tooltip-maxwidth")&&(s.maxWidth=Number.parseInt(t.reference.getAttribute("data-editor-tooltip-maxwidth")||"350",10)),t.reference.hasAttribute("data-editor-tooltip-allow-markdown")&&(s.allowHTML=!0);const o=document.body;if(s.appendTo=this.fixContainerForFullscreen(o),Object.keys(s).length&&t.setProps(s),t.reference.hasAttribute(`data-editor-tooltip-${this.editor.clientId}-dynamic`)){const l=t.reference.getAttribute(`data-editor-tooltip-${this.editor.clientId}-dynamic`);t.setContent(l||"")}}return!0});this.editor=t;const e=t.clientId;this.attributeName=[`data-editor-tooltip-${e}`,`data-editor-tooltip-${e}-dynamic`,"data-editor-tooltip-common"],this.attributeDesc=`data-editor-tooltip-desc-${e}`,this.instance=Tp.delegate(document.body,{theme:"editor-tooltip",maxWidth:400,delay:200,target:this.attributeName.map(r=>`[${r}]`).join(","),content:this.createContent,onShow:this.handleShow,onShown:this.handleShown,onHide:this.handleHidden,hideOnClick:!1}),t.domEvents.addEventListener(document,"mousedown",this.handleDocumentMouseDown)}set lastClickButtonId(t){this._lastClickButtonId=t,t&&setTimeout(()=>{this._lastClickButtonId===t&&(this._lastClickButtonId="")},500)}visible(){var t;return(t=this.currentInstance)==null?void 0:t.state.isVisible}hide(){var t;(t=this.currentInstance)!=null&&t.state.isVisible&&this.currentInstance.hide()}destroy(){this.destroyObserver(),this.instance.destroy(),this.editor.domEvents.removeEventListener(document,"mousedown",this.handleDocumentMouseDown),this.editor.domEvents.removeEventListener(document,"mouseup",this.handleDocumentMouseUp)}createObserver(){this.destroyObserver();const t=this.currentInstance;if(!t||!t.reference)return;this.observerCallback=Ne.default(()=>{t.reference.closest("body")||(t.hide(),this.destroyObserver())},200),this.observer=new MutationObserver(this.observerCallback);const e=document.body,r={childList:!0,attributes:!1,subtree:!0};this.observer.observe(e,r)}destroyObserver(){this.observer&&(this.observer.disconnect(),this.observer=null),this.observerCallback&&(this.observerCallback.cancel(),this.observerCallback=null)}fixContainerForFullscreen(t){return t.closest("body")&&document.fullscreenElement&&!document.fullscreenElement.contains(t)?document.fullscreenElement:t}}const rV={"text/style-bold":"bold","text/style-italic":"italic","text/style-underline":"underline","text/style-strikethrough":"line-through","text/style-code":"code","text/style-sub":"subscript","text/style-super":"superscript",link:"link"};function iV(n,t){const e=new Set(Object.keys(rV)),r=t.filter(s=>e.has(s.id));return j0(r)}function Id(n,t){if(!n.isWritable()||ti(n))return!1;const e=n.selection.range,r=n.editorCommandProviders.getCommands(e,"shortcut"),s=iV(n,r).find(o=>o.id===`text/${t}`||o.id==="link");return s?(n.editorCommandProviders.executeCommand(e,s,{}),Au.get(n).update("selectionChange"),!0):!1}function sV(n,t){const e=n.selection.focusedBlock;if(!n.isWritable()||!ot(n,e))return!1;const r=n.getBlockData(e).heading,i={id:t===0?"text":`heading-${t}`,source:"shortcut",value:t===0?null:String(t),group:"BlockTurnIntoCommandProvider"};return Number(r)===t&&(i.id="text",i.value=null),n.editorCommandProviders.executeCommand(n.selection.range,i,{}),!0}const sA={"CtrlOrCmd+B":n=>Id(n,"style-bold"),"CtrlOrCmd+I":n=>Id(n,"style-italic"),"CtrlOrCmd+U":n=>Id(n,"style-underline"),"CtrlOrCmd+D":n=>Id(n,"style-strikethrough"),"CtrlOrCmd+K":n=>Id(n,"link"),...(()=>{const n={};for(let t=0;t<=8;t++)n[`CtrlOrCmd+Alt+Digit${t}`]=e=>sV(e,t);return n})()},oV={quickMenu:{basic:{heading:{title:"\u6807\u9898 {heading}",space:"{markdown}\u7A7A\u683C"},unordered:"\u65E0\u5E8F\u5217\u8868",ordered:"\u6709\u5E8F\u5217\u8868",checkbox:"\u5F85\u529E\u5217\u8868",quote:"\u5F15\u7528"},inlineBox:{math:"\u516C\u5F0F",link:"\u94FE\u63A5"}},link:{textLabel:"\u6587\u672C",urlLabel:"\u94FE\u63A5\u5730\u5740",textPlaceholder:"\u8BF7\u8F93\u5165\u6587\u672C",urlPlaceholder:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740",submitText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",edit:"\u7F16\u8F91",remove:"\u53D6\u6D88\u94FE\u63A5"},commands:{unordered:"\u65E0\u5E8F\u5217\u8868",ordered:"\u6709\u5E8F\u5217\u8868",check:"\u5F85\u529E\u5217\u8868",link:"\u94FE\u63A5",quote:"\u5F15\u7528",alignLeft:"\u5DE6\u5BF9\u9F50",alignRight:"\u53F3\u5BF9\u9F50",alignCenter:"\u5C45\u4E2D\u5BF9\u9F50",alignGroup:"\u5BF9\u9F50\u65B9\u5F0F",heading:"\u6807\u9898 {name}",headingGroup:"\u6807\u9898\u6837\u5F0F",text:"\u6B63\u6587"}},lV={quickMenu:{basic:{heading:{title:"Heading {heading}",space:"{markdown}space"},unordered:"Bulleted list",ordered:"Numbered list",checkbox:"To-do list",quote:"Quote"},inlineBox:{math:"Formula",link:"Link"}},link:{textLabel:"Text",urlLabel:"Link address",textPlaceholder:"Please enter text",urlPlaceholder:"Please enter link",submitText:"Confirm",cancelText:"Cancel",edit:"Edit",remove:"Remove link"},commands:{unordered:"Bulleted list",ordered:"Numberer list",check:"To-do list",link:"Link",quote:"Quote",alignLeft:"Align left",alignRight:"Align right",alignCenter:"Center text",alignGroup:"Alignment",heading:"Heading {name}",headingGroup:"Text style",text:"Text"}},aV={quickMenu:{basic:{heading:{title:"\u898B\u51FA\u3057{heading}",space:"{markdown}\u30B9\u30DA\u30FC\u30B9"},unordered:"\u7B87\u6761\u66F8\u304D\u30EA\u30B9\u30C8",ordered:"\u756A\u53F7\u4ED8\u304D\u30EA\u30B9\u30C8",checkbox:"\u30D0\u30C3\u30AF\u30ED\u30B0",quote:"\u5F15\u7528"},inlineBox:{math:"\u6570\u5F0F",link:"URL"}},link:{textLabel:"\u30C6\u30AD\u30B9\u30C8",urlLabel:"URL",textPlaceholder:"\u30C6\u30AD\u30B9\u30C8\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",urlPlaceholder:"URL \u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",submitText:"OK",cancelText:"\u30AD\u30E3\u30F3\u30BB\u30EB",edit:"\u7DE8\u96C6",remove:"\u30EA\u30F3\u30AF\u3092\u89E3\u9664"},commands:{unordered:"\u7B87\u6761\u66F8\u304D\u30EA\u30B9\u30C8",ordered:"\u756A\u53F7\u4ED8\u304D\u30EA\u30B9\u30C8",check:"\u30D0\u30C3\u30AF\u30ED\u30B0",link:"URL",quote:"\u5F15\u7528",alignLeft:"\u5DE6\u63C3\u3048",alignRight:"\u53F3\u63C3\u3048",alignCenter:"\u4E2D\u592E\u63C3\u3048",alignGroup:"\u5BF9\u9F50\u65B9\u5F0F",heading:"\u898B\u51FA\u3057{name}",headingGroup:"\u30BF\u30A4\u30C8\u30EB\u30B9\u30BF\u30A4\u30EB",text:"\u672C\u6587"}};_.mergeLang({"zh-CN":oV,"en-US":lV,"ja-JP":aV});const dat="";function Sa(n,...t){const e=Qr(...t);return e.classList.remove("editor-button"),e.classList.add("editor-text-button"),n.append(e),e}function Zk(n){const t=z0(n);t==null||t.hide();const e=n.findCustom("table-border-bar");e==null||e.closeToolbar()}function cV(n){return B("div",["insert-column-button","drop-marker"],n)}const uV=D("row-height");function tR(n){const t=Kt.fromTable(n),e=n.rows;p(uV,e.length===t.rowCount,"row count mismatch");const r=Array(t.rowCount).fill(0);for(let i=0;i<e.length;){let s=1,l=e[i].getBoundingClientRect().height,c=i+1;for(;c<e.length;){const d=e[c];if(d.cells.length!==0)break;s++,c++,l+=d.getBoundingClientRect().height}for(let d=0;d<s;d++)r[i+d]=l/s;i=c}return r}const fV=D("table-border-bar-dom");function eR(n){var c;const t=et(n.contentElement);p(fV,t,"no block");const r=be(t).querySelector(".table-border-bar-container.left"),s=zt(t).offsetLeft-cu,o=((c=n.scrollOptions.paddingLeft)!=null?c:0)+s,l=Math.min(n.contentElement.offsetLeft-s,n.rootElement.scrollLeft-o);r&&(r.style.left=`${-l}px`)}const Al=D("table-border-bar-dom");function xu(n,t){p(Al,fn(t),"invalid table block");const e=un(t),r=as(n,t),i=be(t),s=(C,E,A)=>{const v=B("div",["button-root",E],C),w=B("div",["button-container",E],v);v.setAttribute(`data-${E}-index`,`${A}`),w.setAttribute(`data-editor-tooltip-${n.clientId}`,E==="left"?_.t("table.insertRow"):_.t("table.insertCol")),B("span",["insert-indicator"],w),cV(w)},{selectedRows:o,selectedColumns:l}=CE(n,t),c=()=>{const C=r.querySelector(".table-border-bar-container.top");p(Al,C,"no top border bar container");const E=B("div",["table-border-bar-container","top"],null),A=B("div",["table-border-bar","top"],E),v=uP(e),S=Kt.fromTable(e).colCount;n.selection.range.isSimple()&&s(A,"top",0);for(let U=0;U<S;U++){const M=U===S-1?v[U]+2:v[U],V=B("span",["table-border-bar-cell","top"],A);l.has(U)&&V.classList.add("selected"),V.setAttribute("data-top-index",`${U}`),V.style.width=`${M}px`,n.selection.range.isSimple()&&s(A,"top",U+1)}Bf(C,E)},d=()=>{const C=i.querySelector(".table-border-bar-container.left");p(Al,C,"no left border bar container");const E=B("div",["table-border-bar-container","left"],null),A=B("div",["table-border-bar","left"],E);B("span",["table-border-bar-cell","corner"],A);const v=tR(e);n.selection.range.isSimple()&&s(A,"left",0),Array.from(e.rows).forEach((w,S,U)=>{const M=B("span",["table-border-bar-cell","left"],A);o.has(S)&&M.classList.add("selected"),M.setAttribute("data-left-index",`${S}`);const V=S===U.length-1?v[S]+2:v[S];M.style.height=`${V}px`,n.selection.range.isSimple()&&s(A,"left",S+1)}),Bf(C,E)};c(),d();const h=n.findCustom(ls(t));h&&eR(h)}function nR(n,t){const e=t.target;if(!(e instanceof Element))return;const r=et(e);p(Al,r&&fn(r),"invalid table block"),xu(n,r),n.selection.caret.update()}function og(n,t){const e=t.target;if(!(e instanceof Element))return;const r=et(e);p(Al,r&&fn(r),"invalid table block");const i=e.closest(".button-root");if(i){if(i.classList.contains("top")){const s=parseInt(i.getAttribute("data-top-index")||"0",10);ik(n,r,s),xu(n,r)}else if(i.classList.contains("left")){const s=parseInt(i.getAttribute("data-left-index")||"0",10);ME(n,r,s),xu(n,r)}}}function lg(n,t){var o;Zk(n),t.preventDefault(),t.stopPropagation();let e=null,r,i;const s=l=>{var c;if(l.target instanceof HTMLElement&&r&&e&&i!==void 0){const d=et(l.target),h=l.target.closest(".table-border-bar");if(d===e&&h){const C=parseInt((c=l.target.getAttribute(`data-${r}-index`))!=null?c:"0",10),E=Math.min(i,C),A=Math.abs(i-C)+1;Mt(l.target,"top")&&r==="top"?yP(n,d,E,A,{reverse:!0}):Mt(l.target,"left")&&r==="left"&&TP(n,d,E,A,{reverse:!0})}}l.type==="mouseup"&&(e=null,i=void 0,r=void 0,document.body.removeEventListener("mousemove",s),document.body.removeEventListener("mouseup",s))};t.target instanceof HTMLElement&&Mt(t.target,"table-border-bar-cell")&&(e=et(t.target),Mt(t.target,"top")?r="top":Mt(t.target,"left")&&(r="left"),r&&e&&(i=parseInt((o=t.target.getAttribute(`data-${r}-index`))!=null?o:"0",10),document.body.addEventListener("mousemove",s),document.body.addEventListener("mouseup",s)))}function rR(n){const t=n.selection.range,e=Cd(n,t);e&&xu(n,e)}function dV(n,t){p(Al,fn(t),"invalid table block");const e=as(n,t),r=be(t),i=B("div",["table-border-bar-container","top"],e),s=B("div",["table-border-bar-container","left"],r);xu(n,t),n.domEvents.addEventListener(zt(t),"scroll",nR),n.domEvents.addEventListener(i,"click",og),n.domEvents.addEventListener(s,"click",og),n.domEvents.addEventListener(i,"mousedown",lg),n.domEvents.addEventListener(s,"mousedown",lg),n.addListener("afterClearSelection",rR)}function iR(n,t){if(!n.isWritable())return;if(as(n,t).querySelector(".table-border-bar-container")){xu(n,t);return}dV(n,t)}function sR(n,t){p(Al,fn(t),"invalid table block");const e=as(n,t),r=be(t),i=e.querySelectorAll(".table-border-bar-container"),s=r.querySelectorAll(".table-border-bar-container");i.forEach(o=>{n.domEvents.removeEventListener(o,"click",og),n.domEvents.removeEventListener(o,"mousedown",lg),o.remove()}),s.forEach(o=>{n.domEvents.removeEventListener(o,"click",og),n.domEvents.removeEventListener(o,"mousedown",lg),o.remove()}),n.domEvents.removeEventListener(zt(t),"scroll",nR),n.addListener("afterClearSelection",rR)}function hV(n,t){p(Al,fn(t),"invalid table block");const r=as(n,t).querySelector(".table-border-bar-container.top");return r?r.getBoundingClientRect().height:0}class mV{constructor(t,e){m(this,"toolbar");m(this,"handleSelectionChange",(t,e)=>{!t.isVisible||(e==="delete-columns"?(ml(this.editor,this.tableBlock,!0,!0),gl(this.editor,this.tableBlock,!0,!0)):e==="delete-rows"?(ml(this.editor,this.tableBlock,!0,!1),gl(this.editor,this.tableBlock,!0,!1)):(ml(this.editor,this.tableBlock,!1),gl(this.editor,this.tableBlock,!1)))});m(this,"handleClick",(t,e,r)=>{e.id==="delete-columns"?EE(this.editor.selection.range):e.id==="delete-rows"&&AE(this.editor.selection.range)});m(this,"handleToolbarClose",()=>{this.tableBlock&&Cd(this.editor,this.editor.selection.range)===this.tableBlock&&(ml(this.editor,this.tableBlock,!1),gl(this.editor,this.tableBlock,!1))});this.editor=t,this.tableBlock=e;const r=t.options.componentsOptions.popover;this.toolbar=new md([],void 0,{id:"table-row-column-toolbar",overflowBoundary:r==null?void 0:r.overflowBoundary,refuseOverflow:!0,tooltipId:this.editor.clientId}),this.toolbar.addListener("selectionChange",this.handleSelectionChange),this.toolbar.addListener("click",this.handleClick),this.toolbar.addListener("close",this.handleToolbarClose)}close(){this.toolbar.close("cancelBar")}update(){var i,s,o;const{selectedColumns:t,selectedRows:e}=CE(this.editor,this.tableBlock);if(!this.editor.isWritable())return;if(t.size>0&&e.size>0){this.toolbar.close("cancelBar");return}if(t.size===0&&e.size===0){this.toolbar.close("cancelBar");return}const r=Fs(this.editor,this.tableBlock,this.editor.selection.range)[0];if(!r){this.toolbar.close("cancelBar");return}if(t.size>0){const l={id:"delete-columns",name:_.t("table.deleteSelectCol"),icon:AT};this.toolbar.updateItems([l]);const c=$s(this.editor,this.tableBlock,"table-row-column-delete",r);this.toolbar.manualShow(c,{placement:"top",offset:[0,5]})}else{const l={id:"delete-rows",name:_.t("table.deleteSelectRow"),icon:ET};this.toolbar.updateItems([l]);const h=be(this.tableBlock).querySelector(".table-border-bar-container.left").getBoundingClientRect(),C=new DOMRect(Math.max(h.left,r.left-cu),r.top,cu,r.height),E=$s(this.editor,this.tableBlock,"table-row-column-delete",C);this.toolbar.manualShow(E,{placement:"left",offset:[0,5]});const A=this.editor.options.componentsOptions.popover;(i=this.toolbar.tippyInstance)==null||i.setProps({popperOptions:{modifiers:[{name:"flip",options:{boundary:A==null?void 0:A.overflowBoundary,fallbackPlacements:["left","right"]}}]}})}(o=(s=this.toolbar.tippyInstance)==null?void 0:s.popperInstance)==null||o.update()}destroy(){this.toolbar.destroy(),this.toolbar.removeAllListeners()}}const oA=D("table-border-bar");class gV{constructor(t,e){m(this,"toolbar");m(this,"resizeObserver",null);m(this,"handleReadonlyChanged",t=>{t.isWritable()?this.update():sR(this.editor,this.tableBlock)});m(this,"handleBlockUpdated",()=>{var t;(t=this.resizeObserver)==null||t.disconnect(),setTimeout(()=>{var r;const e=this.editor.getBlockById(ut(this.tableBlock));(r=this.resizeObserver)==null||r.observe(un(e))})});m(this,"handleScroll",()=>{var t;(t=this.toolbar)==null||t.update()});m(this,"handleTableResize",()=>{!this.editor.isWritable()||this.update()});this.editor=t,this.tableBlock=e,p(oA,this.tableBlock,"no table block"),oA.debug("create table border bar"),iR(this.editor,this.tableBlock),this.resizeObserver=new Jl(this.handleTableResize),this.resizeObserver.observe(un(this.tableBlock));const r=t.getComponentOptions("table");r!=null&&r.hideToolbar||(this.toolbar=new mV(this.editor,this.tableBlock)),this.editor.addListener("readonlyChanged",this.handleReadonlyChanged)}close(){var t;(t=this.toolbar)==null||t.close()}destroy(){var t,e;oA.debug("destroy table border bar"),(t=this.resizeObserver)==null||t.disconnect(),this.resizeObserver=null,sR(this.editor,this.tableBlock),(e=this.toolbar)==null||e.destroy(),this.editor.removeListener("readonlyChanged",this.handleReadonlyChanged)}update(){var t;iR(this.editor,this.tableBlock),(t=this.toolbar)==null||t.update()}}const pV=D("table-border-bar");class CV{constructor(t){m(this,"activeTableBar",null);m(this,"handleBlockDeleted",(t,e)=>{!this.activeTableBar||(e===this.activeTableBar.tableBlock||Ce(e,this.activeTableBar.tableBlock))&&(this.activeTableBar.destroy(),this.activeTableBar=null)});m(this,"handleSelectionChanged",t=>{setTimeout(()=>{var i;const e=t.selection.range,r=Cd(t,e);((i=this.activeTableBar)==null?void 0:i.tableBlock)!==r&&this.activeTableBar&&this.hide(),r&&this.show(r)})});m(this,"handleScroll",()=>{var t;(t=this.activeTableBar)==null||t.handleScroll()});m(this,"isInBlock",(t,e)=>!!(e.target instanceof Element&&e.target.closest('[data-command-bar-id="table-row-column-toolbar"]')));this.editor=t,this.editor.addListener("blockDeleted",this.handleBlockDeleted),this.editor.addListener("selectionChanged",this.handleSelectionChanged),$e.get(t).addFilter(this)}destroy(){var t;this.editor.removeListener("blockDeleted",this.handleBlockDeleted),this.editor.removeListener("selectionChanged",this.handleSelectionChanged),(t=this.activeTableBar)==null||t.destroy()}show(t){this.activeTableBar?(this.activeTableBar.tableBlock!==t&&this.hide(),this.activeTableBar.update()):this.activeTableBar=new gV(this.editor,t)}update(){var t;(t=this.activeTableBar)==null||t.handleBlockUpdated()}closeToolbar(){var t;(t=this.activeTableBar)==null||t.close()}hide(){!this.activeTableBar||(p(pV,this.activeTableBar,"no active table bar"),this.activeTableBar.destroy(),this.activeTableBar=null)}}function oR(n,t){const e=n.addCustom("table-border-bar",r=>new CV(r));t==="update"&&e.update()}const ur=D("table-cell-menu"),EV="style-bg-color-";class AV{constructor(t){m(this,"activeTableBlock",null);m(this,"targetButton",null);m(this,"manualMenu",null);m(this,"colorPaletteItem",null);m(this,"markedRowAsDanger",!1);m(this,"markedColAsDanger",!1);m(this,"resetAsDangerMarked",()=>{this.markedColAsDanger=!1,this.markedRowAsDanger=!1});m(this,"handlePrevent",(t,e)=>{e.stopPropagation()});m(this,"handleReadonlyChanged",t=>{t.isWritable()||this.hide()});m(this,"handleSelectionChanged",t=>{const e=t.selection.range,r=Cd(t,e);if(this.hide(),this.activeTableBlock!==r&&(this.activeTableBlock=r),this.activeTableBlock){const i=Kt.fromBlock(this.activeTableBlock),s=e.isReverse()?e.start:e.end;let o=null;s instanceof Ai?t.getBlockById(s.blockId)===this.activeTableBlock?o=i.getCellByContainerId(s.childContainerId):o=this.getCellByChildBlockId(i,s.blockId):s.blockId!==this.activeTableBlock.id&&(o=this.getCellByChildBlockId(i,s.blockId)),o&&this.editor.isWritable()&&this.showCellMenuButton(o)}});m(this,"handleBeforePopupPalette",()=>{var e;const t=this.getSelectedBkgColorIndex();(e=this.colorPaletteItem)==null||e.palette.setColor("backgroundColor",t)});m(this,"createBkgColorItem",()=>{const t=B("div",["cell-background-color-item"],null);B("span",[],t,_.t("table.cellBackground"));const e=this.getSelectedBkgColorIndex();B("button",["item-button"],t).setAttribute("data-color-index",`${e}`);const i=B("span",["item-sub-indicator"],t);return i.innerHTML=QC,t});m(this,"handleCommand",t=>{var i;p(ur,this.activeTableBlock,"no target table block");const e=((i=t.states)==null?void 0:i.includes("checked"))||!1,r=t.value;switch(t.id){case"delete-select-row":AE(F2(this.editor,this.activeTableBlock,!1));break;case"delete-select-col":EE(F2(this.editor,this.activeTableBlock,!0));break;case"merge-cell":O2(this.editor.selection.range);break;case"split-cell":this.handleSplitCell();break;case"row-title":this.handleRowTitle(e);break;case"col-title":this.handleColTitle(e);break;case"stripe-style":this.handleStripeStyle(e);break;case"hide-border":MN(this.editor,this.activeTableBlock,r==="show-border");break;case"show-chart":NN(this.editor,this.activeTableBlock,r==="show-chart"),kE(this.editor,this.activeTableBlock,{updateNow:!0});break}});m(this,"handleToolbarClose",()=>{this.targetButton&&ct(this.targetButton,"active"),(this.markedRowAsDanger||this.markedColAsDanger)&&this.activeTableBlock&&Cd(this.editor,this.editor.selection.range)===this.activeTableBlock&&(ml(this.editor,this.activeTableBlock,!1),gl(this.editor,this.activeTableBlock,!1),this.resetAsDangerMarked()),this.editor.focus()});m(this,"handleSelectionChange",(t,e)=>{if(!!t.isVisible)if(p(ur,this.activeTableBlock,"no target table block"),e==="cell-background-color"&&this.handleBeforePopupPalette(),e==="delete-select-row"){if(this.markedRowAsDanger)return;ml(this.editor,this.activeTableBlock,!0,!1),gl(this.editor,this.activeTableBlock,!0,!1),this.resetAsDangerMarked(),this.markedRowAsDanger=!0}else if(e==="delete-select-col"){if(this.markedColAsDanger)return;ml(this.editor,this.activeTableBlock,!0,!0),gl(this.editor,this.activeTableBlock,!0,!0),this.resetAsDangerMarked(),this.markedColAsDanger=!0}else ml(this.editor,this.activeTableBlock,!1),gl(this.editor,this.activeTableBlock,!1),this.resetAsDangerMarked()});m(this,"handleClick",(t,e)=>{var r;p(ur,this.activeTableBlock,"no target table block"),p(ur,this.targetButton,"no target button"),Zk(this.editor),Mt(this.targetButton,"active")?(ct(this.targetButton,"active"),(r=this.manualMenu)==null||r.close("clickItem")):(q(this.targetButton,"active"),this.manualMenu?this.manualMenu.updateItems(this.createCommandMenu()):(this.manualMenu=new dl(this.createCommandMenu(),void 0,{id:"table-cell-menu"}),this.manualMenu.on("click",(i,s)=>{var o;this.handleCommand(s),(o=this.manualMenu)==null||o.close("clickItem")}),this.manualMenu.on("selectionChange",this.handleSelectionChange),this.manualMenu.on("close",this.handleToolbarClose)),this.manualMenu.manualShow(this.targetButton,{placement:"right-start"})),e.stopPropagation()});this.editor=t,this.editor.addListener("selectionChanged",this.handleSelectionChanged),this.editor.addListener("readonlyChanged",this.handleReadonlyChanged)}destroy(){var t,e;this.activeTableBlock=null,this.targetButton=null,this.editor.removeListener("selectionChanged",this.handleSelectionChanged),this.editor.removeListener("readonlyChanged",this.handleReadonlyChanged),(t=this.manualMenu)==null||t.destroy(),(e=this.colorPaletteItem)==null||e.destroy()}hide(){var t;(t=this.manualMenu)==null||t.close("cancelBar"),this.targetButton&&(ct(this.targetButton,"active"),this.targetButton.style.display="none")}getCellByChildBlockId(t,e){let r=this.editor.getBlockById(e);for(;r;){const i=r.closest("td");p(ur,i,"no parent cell");const s=et(i);if(p(ur,s,"no parent block"),un(s)===t.table)return t.getCellByCellElement(i);r=s}return p(ur,!1,"filed to get cell by child block id"),null}createTargetButton(t){this.targetButton?t.querySelector(`:scope > .${yE}`)||t.appendChild(this.targetButton):(this.targetButton=B("button",[yE],t),this.targetButton.innerHTML=A0,this.editor.domEvents.addEventListener(this.targetButton,"click",this.handleClick),this.editor.domEvents.addEventListener(this.targetButton,"mousedown",this.handlePrevent),this.editor.domEvents.addEventListener(this.targetButton,"dblclick",this.handlePrevent))}showCellMenuButton(t){this.createTargetButton(t.cell),p(ur,this.targetButton,"no target button"),this.targetButton.style.display="inline-block"}handleSplitCell(){if(this.activeTableBlock){const t=Kt.fromBlock(this.activeTableBlock),e=this.editor.selection.range;if(e.isSimple()){const{col:r,row:i}=this.getCellByChildBlockId(t,e.start.blockId);bE(this.editor,this.activeTableBlock,{col:r,row:i})}else vE(this.editor.selection.range)}}getSelectedBkgColorIndex(){var o;p(ur,this.activeTableBlock,"no target table block");const t=this.editor.selection.range,e=hl(this.editor,this.activeTableBlock,t.focus),r=this.editor.getBlockData(this.activeTableBlock),i=e.childContainerId,s=r[`${i}_background`];return s?Number.parseInt((o=s.substring(EV.length))!=null?o:"0",10):-1}createCommandMenu(){p(ur,this.activeTableBlock,"no target table block");const t=this.editor.getBlockData(this.activeTableBlock),e=U2(this.editor,this.activeTableBlock,this.editor.selection.range);let r=this.editor.selection.range;if(r.isSimple()){const h=hl(this.editor,this.activeTableBlock,r.start);r=pn(this.editor,{anchor:h,focus:h})}const i=M2(this.editor,this.activeTableBlock,r),s=t.hasRowTitle,o=t.hasColTitle,l=t.isStripeStyle,c=t.noBorder,d=t.chart;return this.colorPaletteItem=new R2("cell-background-color",{color:!1}),this.colorPaletteItem.palette.on("onClick",(h,C)=>{var E;switch(p(ur,this.activeTableBlock,"no target table block"),h){case"clearColor":$2(this.editor,this.activeTableBlock,-1);break;case"backgroundColor":$2(this.editor,this.activeTableBlock,C);break}(E=this.manualMenu)==null||E.close("clickItem")}),[{id:"cell-background-color",name:_.t("table.cellBackground"),element:this.createBkgColorItem(),children:[this.colorPaletteItem]},{id:"separator",name:"",type:"separator"},{id:"merge-cell",name:_.t("table.mergeCell"),states:e?[]:["disabled"]},{id:"split-cell",name:_.t("table.splitCell"),states:i?[]:["disabled"]},{id:"separator",name:"",type:"separator"},{id:"delete-select-row",name:_.t("table.deleteSelectRow")},{id:"delete-select-col",name:_.t("table.deleteSelectCol")},{id:"separator",name:"",type:"separator"},{id:"table-config",name:_.t("table.tableConfigKey"),children:[{id:"row-title",name:_.t("table.tableConfig.rowTitle"),states:s?["checked"]:[]},{id:"col-title",name:_.t("table.tableConfig.colTitle"),states:o?["checked"]:[]},{id:"stripe-style",name:_.t("table.tableConfig.stripeStyle"),states:l?["checked"]:[]},{id:"hide-border",name:c?_.t("table.tableConfig.showBorder"):_.t("table.tableConfig.hideBorder"),value:c?"show-border":"hide-border"},{id:"show-chart",name:d?_.t("table.tableConfig.hideChart"):_.t("table.tableConfig.showChart"),value:d?"hide-chart":"show-chart"}]}]}handleRowTitle(t){p(ur,this.activeTableBlock,"no target table block"),t?IN(this.editor,this.activeTableBlock):LN(this.editor,this.activeTableBlock)}handleColTitle(t){p(ur,this.activeTableBlock,"no target table block"),t?SN(this.editor,this.activeTableBlock):wN(this.editor,this.activeTableBlock)}handleStripeStyle(t){p(ur,this.activeTableBlock,"no target table block"),t?_N(this.editor,this.activeTableBlock):DN(this.editor,this.activeTableBlock)}}function lR(n){n.addCustom("table-cell-menu",t=>new AV(t))}const aR=D("table-container");function lA(n){const t=n.closest("td");return p(aR,t,"no parent cell for a table cell container"),t}function cR(n){const t=un(n);return Array.from(t.querySelectorAll(':scope > tbody > tr > td > [data-type="editor-container"].child'))}function aA(n,t,e,r){const i=Kt.fromBlock(n),s=i.getCellByContainerId(pt(t));if(e==="ArrowDown"){const o=i.getBottomCell(s);return o?o.container:null}if(e==="ArrowUp"){const o=i.getTopCell(s);return o?o.container:null}if(e==="ArrowLeft"){const o=i.getLeftCell(s);if(!o)return null;const l=o.container;return r!=null&&r.noWrap&&o.row!==s.row?null:l}if(e==="ArrowRight"){const o=i.getRightCell(s);if(!o)return null;const l=o.container;return r!=null&&r.noWrap&&o.row!==s.row?null:l}p(aR,!1,`invalid navigation type: ${e}`)}const xV=12,bV=90,ag=23,uR=2;class vV{constructor(t){m(this,"scrollTableBlock",null);m(this,"autoScrollDir",null);m(this,"autoScrollTimer",null);m(this,"handleMouseDown",t=>{const e=Pe(t.clientX,t.clientY,{noFilter:!0});if(e&&e instanceof HTMLElement){const r=et(e);if(r&&Ce(this.editor.rootContainer,r)){const i=no(r);i&&(this.scrollTableBlock=i,document.addEventListener("mousemove",this.handleAutoScroll))}}});m(this,"handleAutoScroll",f9.default(t=>{if(this.scrollTableBlock){const e=this.editor.getCustom(ls(this.scrollTableBlock)),r=e.rootElement,i=e.scrollOptions.parentContainer,s=r.getBoundingClientRect(),o=window.innerHeight-this.getBarFloatWindowBottom(e),l=i.getBoundingClientRect(),c=Math.min(l.bottom,o),d=Math.max(l.top,0);s.bottom>c&&t.clientY>=c?this.setAutoScroll("bottom"):s.top<d&&t.clientY<=d?this.setAutoScroll("top"):r.scrollLeft>0&&t.clientX<s.left?this.setAutoScroll("left"):r.scrollLeft<r.scrollWidth-r.offsetWidth&&t.clientX>s.right?this.setAutoScroll("right"):this.clearAutoScroll()}},15));m(this,"handleMouseUp",()=>{document.removeEventListener("mousemove",this.handleAutoScroll),setTimeout(()=>{this.scrollTableBlock=null})});m(this,"handleSelectionChanged",t=>{const e=t.selection.range;if(e.isCollapsed()&&e.isSimple()){const r=t.getBlockById(e.start.blockId),i=no(r);if(i){const s=t.getCustom(ls(i)),o=s.rootElement.getBoundingClientRect(),l=Zo(t,r,e.start);if(o.left>l.left){const c=e.start.offset===0?xV:uR;s.rootElement.scrollLeft-=o.left-l.left+c}else if(l.right>o.right){const c=e.start.offset===0?bV:uR;s.rootElement.scrollLeft+=l.right-o.right+c}}}else{const r=t.getBlockById(e.start.blockId),i=no(r),s=t.getBlockById(e.end.blockId),o=no(s);if(i&&i===o){const l=t.getCustom(ls(i)),c=l.rootElement.getBoundingClientRect();let d=null;if(e.isSimple())d=e.isReverse()?Zo(t,r,e.start):Zo(t,s,e.end);else{const h=lA(pi(t,e.start.childContainerId)),C=lA(pi(t,e.end.childContainerId));d=e.isReverse()?h.getBoundingClientRect():C.getBoundingClientRect()}c.left>d.left&&e.isReverse()?l.rootElement.scrollLeft-=c.left-d.left:c.right<d.right&&!e.isReverse()&&(l.rootElement.scrollLeft+=d.right-c.right)}}});m(this,"handleScroll",t=>{I2(t),this.editor.selection.caret.update()});m(this,"handleReset",t=>{I2(t),this.editor.selection.caret.update();const e=this.editor.findCustom("table-border-bar");e&&e.handleScroll(),eR(t)});this.editor=t,this.editor.addListener("selectionChanged",this.handleSelectionChanged),document.addEventListener("mousedown",this.handleMouseDown),document.addEventListener("mouseup",this.handleMouseUp)}getBarFloatWindowBottom(t){return t.scrollOptions.barFloatWindowBottom?typeof t.scrollOptions.barFloatWindowBottom=="number"?t.scrollOptions.barFloatWindowBottom:t.scrollOptions.barFloatWindowBottom():0}clearAutoScroll(){this.autoScrollTimer&&(clearInterval(this.autoScrollTimer),this.autoScrollTimer=null,this.autoScrollDir=null)}setAutoScroll(t){this.autoScrollDir&&this.autoScrollDir!==t&&this.clearAutoScroll(),this.autoScrollTimer||(this.autoScrollDir=t,this.autoScrollTimer=window.setInterval(()=>{if(this.scrollTableBlock){const e=this.editor.getCustom(ls(this.scrollTableBlock)),r=e.rootElement,i=e.scrollOptions.parentContainer,s=r.getBoundingClientRect(),o=i===document.documentElement?window.innerHeight:i.offsetHeight,l=window.innerHeight-this.getBarFloatWindowBottom(e),c=i.getBoundingClientRect(),d=Math.min(c.bottom,l),h=Math.max(c.top,0);this.autoScrollDir==="left"&&(r.scrollLeft-=ag,r.scrollLeft<=0&&this.clearAutoScroll()),this.autoScrollDir==="right"&&(r.scrollLeft+=ag,r.scrollLeft>=r.scrollWidth-r.offsetWidth&&this.clearAutoScroll()),this.autoScrollDir==="bottom"&&(i.scrollTop+=ag,(i.scrollTop>=i.scrollHeight-o||s.bottom<=d)&&this.clearAutoScroll()),this.autoScrollDir==="top"&&(i.scrollTop-=ag,(i.scrollTop<=0||s.top>=h)&&this.clearAutoScroll())}},100))}destroy(){document.removeEventListener("mousedown",this.handleMouseDown),document.removeEventListener("mouseup",this.handleMouseUp),this.editor.removeListener("selectionChanged",this.handleSelectionChanged)}}function fR(n){return n.addCustom("table-scroll-events",t=>new vV(t))}const BV=D("table-doc-change-handler");class yV{constructor(t){this.editor=t,this.editor.addListener("docChanged",this.handleDocChanged)}handleDocChanged(t,e){if(!e){const{start:r,end:i}=t.selection.range;if(!t.findBlockById(r.blockId)||!t.findBlockById(i.blockId)){t.selection.selectBlock(t.getBlockByIndex("root",0),0);return}if(da(r)){const s=t.getBlockById(r.blockId);if(!fn(s))return;if(p(BV,da(i),"invalid range"),!Rf(t,r.childContainerId)||!Rf(t,i.childContainerId)){t.selection.selectBlock(s,0);return}let o=null,l=null;const c=(d,h)=>{const C=h.getCellById(d.childContainerId),{colIndex:E=0,rowIndex:A=0}=d.custom;let v=-1,w=-1;return(C.col>E||C.col+C.colSpan-1<E)&&(v=C.col),(C.row>A||C.row+C.rowSpan-1<A)&&(w=C.row),v!==-1||w!==-1?Me(s,d.childContainerId,{colIndex:v===-1?E:v,rowIndex:w===-1?A:w}):null};if(r.custom){const d=Kt.fromBlock(s);o=c(r,d),l=c(i,d)}(o!==null||l!==null)&&(t.selection.range.isReverse()?t.selection.setSelection(l!=null?l:i,o!=null?o:r):t.selection.setSelection(o!=null?o:r,l!=null?l:i))}}}destroy(){this.editor.removeListener("docChanged",this.handleDocChanged)}}function dR(n){n.addCustom("table-doc-change-handler",t=>new yV(t))}const us=D("create-content");function hR(n,t,e){var C;const r=new M0(e),i=e.rows,s=e.cols;p(us,i>=1,`invalid rows: ${i}`),p(us,s>=1,`invalid cols: ${s}`),p(us,e.children,"no table children");const o=B("table",[],null),l=(C=e.colsWidth)!=null?C:new Array(e.cols).fill(0),c=B("colgroup",[],o);for(let E=0;E<r.colCount;E++){const A=B("col",[],c);l[E]&&(A.style.width=`${l[E]}px`,A.style.minWidth=`${l[E]}px`)}const d=B("tbody",[],o);let h=0;for(let E=0;E<i;E++){const A=B("tr",[],d);for(let v=0;v<s;v++){const w=r.getCell({col:v,row:E});if(w.virtual)p(us,w.colSpan>1||w.rowSpan>1,"virtual cell should have colSpan or rowSpan");else{const S=e.children[h],U=B("td",[],A);w.colSpan>1&&(U.colSpan=w.colSpan),w.rowSpan>1&&(U.rowSpan=w.rowSpan);const M=e[xd(S)];M&&q(U,M),v===0&&e.hasColTitle&&q(U,N2.COL_TITLE_ITEM),n.createChildContainer(t,U,S),h+=1}}}return p(us,h===e.children.length,"container count mismatch"),o.style.minWidth=`${l.reduce((E,A)=>A+E,0)}px`,e.noBorder&&q(o,"no-border"),e.chart&&q(o,"editor-table-chart"),e.isStripeStyle&&q(o,"stripe"),e.hasRowTitle&&q(o,"row-title"),e.hasColTitle&&q(o,"col-title"),o}function TV(n,t,e,r,i){p(us,i.type==="table","not table data"),p(us,pt(e)===t[t.length-1].containerId,"invalid path");const s=i,o=ua(r,"div");try{const l=B("div",[],null);l.setAttribute("data-type","table-content");const c=hR(n,t,s);c.classList.add("drag-preview-element"),l.appendChild(c);const d=n.getComponentOptions("table");nk(n),sk(n),oR(n,"create"),dR(n),d!=null&&d.hideCellMenu||lR(n),mT(n,RE);const h=n.addCustom(ls(r),()=>aP());h.init({parentElement:o,childElement:l,safeRightSpace:50,safeLeftSpace:40,parentContainer:re(e)?n.scrollContainer:e,locatingContainer:re(e)?(d==null?void 0:d.locatingContainer)||n.parent:e,paddingLeft:cu+Ad,paddingTop:cu+Ad,paddingBottom:Ad/2,paddingRight:Ad/2,barFloatWindowBottom:d==null?void 0:d.barFloatWindowBottom,allowScrollBarFixed:d==null?void 0:d.allowScrollBarFixed,isSetScale:d==null?void 0:d.isSetScale});const C=fR(n);h.on("scroll",C.handleReset),h.on("resize",C.handleReset),setTimeout(()=>{KN(n,r)})}catch{const c=`invalid table data: ${JSON.stringify(s)}`;us.error(c);const d=B("div",["error"],o);d.innerText=c}return o}function kV(n,t,e){p(us,e.type==="table","not table data");const r=e,i=zt(t);try{const s=un(t),o=tl(t),l=hR(n,o,r);l.classList.add("drag-preview-element"),s.insertAdjacentElement("afterend",l),s.remove();const c=n.getComponentOptions("table");nk(n),sk(n),oR(n,"update"),dR(n),c!=null&&c.hideCellMenu||lR(n),RE(n,void 0,t)}catch{const o=`invalid table data: ${JSON.stringify(r)}`;us.error(o);const l=B("div",["error"],i);l.innerText=o}}function RV(n,t){let e,r,i=!1;if([...t].every(E=>E==="|")?(r=t.length,e=Array(r).fill(""),i=!0):(e=Fp(t,"|").split("|"),r=e.length),r<2)return null;const s=3,o=r,l=[];for(let E=0;E<3;E++)e.forEach(A=>{l.push(qs(n.doc,E===0?A:""))});const c=Array(o).fill(LE),d=l[i?0:o],h=n.doc.getContainerBlocks(d)[0].id;return{blockData:{id:it(),type:"table",rows:s,cols:o,children:l,colsWidth:c},focusBlockId:h}}function wV(n,t){const e=t.rows,r=t.cols;if(e<1||r<1)return null;const i=[];for(let d=0;d<e;d++)for(let h=0;h<r;h++)i.push(qs(n.doc));const s=Array(r).fill(LE),o=i[0],l=n.doc.getContainerBlocks(o)[0].id;return{blockData:{id:it(),type:"table",rows:e,cols:r,children:i,colsWidth:s},focusBlockId:l}}const cA=D("get-selected-containers");function mR(n,t,e,r){p(cA,e.blockId===r.blockId,"only allow select in single table block"),p(cA,ut(t)===e.blockId,"only allow select in single table block");const i=Kt.fromBlock(t),s=i.getCellByContainerId(e.childContainerId),o=i.getCellByContainerId(r.childContainerId);if(e.custom===void 0||r.custom===void 0)return i.getCells(s,o).map(S=>i.getCellContainer(S));const{fromCol:l,toCol:c,fromRow:d,toRow:h}=Si(t,e,r),C=new Set,E=[];return i.sub({row:d,col:l},{row:h,col:c}).forEach(v=>{v.forEach(w=>{const S=i.getCellByContainerId(w.containerId);S.col<l||S.row<d||S.col+S.colSpan-1>c||S.row+S.rowSpan-1>h||C.has(w.containerId)||(C.add(w.containerId),E.push(S.container))})}),E}function SV(n,t,e){p(cA,t.blockId===e.blockId,"only allow select in single table block");const r=n.getBlockById(t.blockId);return mR(n,r,t,e)}const gR=D("table-selection-to-doc");function LV(n,t){const{start:e,end:r,block:i}=t,s=Ot(i);p(gR,s==="table",`invalid block type: ${s}`);const o=n.getBlockData(i);if(e.isSimple()&&r.isSimple())return sl(n.editorBlocks,n.doc.toJSON(),o);p(gR,!e.isSimple()&&!r.isSimple(),"invalid block pos type");const l=Kt.fromBlock(i),{fromCol:c,toCol:d,fromRow:h,toRow:C}=Si(i,e,r),E={},A=[],v=n.doc.toJSON();let w={};l.sub({row:h,col:c},{row:C,col:d}).forEach((X,ft)=>{X.forEach((xt,bt)=>{const wt=xt.containerId;if(A.indexOf(wt)!==-1)return;A.push(wt);let Tt;if(xt.virtual){const fe=l.getCellByContainerId(xt.containerId),Lr=c+bt;let fr=fe.col+fe.colSpan-1;fr>d&&(fr=d);const je=fr-Lr+1;je>1&&(E[`${wt}_colSpan`]=je);const yn=h+ft;let Zn=fe.row+fe.rowSpan-1;Zn>C&&(Zn=C);const dr=Zn-yn+1;dr>1&&(E[`${wt}_rowSpan`]=dr),Tt=Ws()}else{if(Tt=sC(n.editorBlocks,v,wt),xt.col+xt.colSpan>d+1){const fe=d-xt.col+1;fe>1&&(E[`${wt}_colSpan`]=fe)}else xt.colSpan>1&&(E[`${wt}_colSpan`]=xt.colSpan);if(xt.row+xt.rowSpan>C+1){const fe=C-xt.row+1;fe>1&&(E[`${wt}_rowSpan`]=fe)}else xt.rowSpan>1&&(E[`${wt}_rowSpan`]=xt.rowSpan)}const{root:ie,...Ee}=Tt.blocks;w={...w,...Ee,[wt]:ie}})});const U=Td(un(i)).slice(c,d+1);return{blocks:{root:[{id:it(),type:s,children:A,colsWidth:U,rows:C-h+1,cols:d-c+1,...E}],...w},meta:{},comments:{}}}const IV=D("ajust-selection-pos");function DV(n,t){if(t.top===0)return!0;for(let e=t.left;e<=t.right;e++)if(n[t.top-1][e]===n[t.top][e])return!1;return!0}function _V(n,t){if(t.left===0)return!0;for(let e=t.top;e<=t.bottom;e++)if(n[e][t.left-1]===n[e][t.left])return!1;return!0}function MV(n,t){if(t.bottom===n.length-1)return!0;for(let e=t.left;e<=t.right;e++)if(n[t.bottom][e]===n[t.bottom+1][e])return!1;return!0}function UV(n,t){if(t.right===n[0].length-1)return!0;for(let e=t.top;e<=t.bottom;e++)if(n[e][t.right]===n[e][t.right+1])return!1;return!0}function OV(n,t,e){const r=t.col,i=t.row,s=e.col,o=e.row,l={left:r,top:i,right:s,bottom:o};let c=!1;do{if(c=!1,!DV(n,l)){l.top--,c=!0;continue}if(!_V(n,l)){l.left--,c=!0;continue}if(!MV(n,l)){l.bottom++,c=!0;continue}if(!UV(n,l)){l.right++,c=!0;continue}}while(c);return l}function NV(n,t,e,r){if(e.custom!==void 0||r.custom!==void 0)return{anchor:e,focus:r};const i=Kt.fromBlock(t),s=i.map(V=>V.containerId),o=i.getCellByContainerId(e.childContainerId),l=i.getCellByContainerId(r.childContainerId),c=Math.min(o.row,l.row),d=Math.max(o.row,l.row),h=Math.min(o.col,l.col),C=Math.max(o.col,l.col),E=OV(s,{row:c,col:h},{row:d,col:C}),A=i.getCell({row:E.top,col:E.left}),v=i.getCell({row:E.bottom,col:E.right}),w=i.getCell({row:E.top,col:E.right}),S=i.getCell({row:E.bottom,col:E.left});let U,M;return o.row<=l.row?o.col<=l.col?(U=A,M=v):(U=w,M=S):o.col<l.col?(U=S,M=w):(U=v,M=A),IV.debug(`move ${U.col}, ${U.row}, -> ${M.col}, ${M.row}`),{anchor:Me(t,U.containerId),focus:Me(t,M.containerId)}}function pR(n,t,e){if(e.isSimple())return[un(t).getBoundingClientRect()];const r=un(t),i=r.getBoundingClientRect(),{fromCol:s,fromRow:o,toCol:l,toRow:c}=Si(t,e.start,e.end),d=Td(r),h=d.slice(0,s).reduce((w,S)=>w+S,0),C=h+d.slice(s,l+1).reduce((w,S)=>w+S,0),E=tR(r);let A=E.slice(0,o).reduce((w,S)=>w+S,0);const v=A+E.slice(o,c+1).reduce((w,S)=>w+S,0);if(o===0){const w=hV(n,t);A-=w}return[new DOMRect(i.left+h,i.top+A,C-h,v-A)]}D("table-size");const PV=40;function cg(n){const t=n.querySelector("td");if(!t)return 0;const e=window.getComputedStyle(t),r=Number.parseInt(e.borderLeft,10),i=Number.parseInt(e.borderRight,10);return(r+i)/2}function FV(n,t,e){const r=m1(n,e.container);return r!==void 0?r+cg(t):PV*e.colSpan-cg(t)}function KV(n,t,e,r){let i=0;const s=e.colCount;for(let o=0;o<s;o++){const l=e.getCell({col:o,row:r});if(l.virtual)continue;let c=FV(n,t,l);const d=oB(l.container,{withPadding:!0});d&&d>c&&(c=d),i+=c+cg(t)}return i}function VV(n,t){const e=un(t),r=Kt.fromTable(e);let i=0;for(let o=0;o<r.rowCount;o++)i=Math.max(i,KV(n,e,r,o));const s=cg(e);return i+=s,i}const ro=D("table-creator");async function $V(n,t){return n.undoManager.runInGroup(()=>{var d,h;const e=t.item,r=(d=e.colCount)!=null?d:5,i=(h=e.rowCount)!=null?h:3,s=wV(n,{cols:r,rows:i});if(!s)return null;const{blockData:o,focusBlockId:l}=s,c=n.insertBlock(t.containerId,t.blockIndex,o,Ue(n,l,0));return n.focus(),c})}class HV{constructor(){m(this,"id","insert-table");m(this,"name","Create table");m(this,"element");m(this,"closeable",null);m(this,"colCount");m(this,"rowCount");m(this,"setCloseable",t=>{this.closeable=t});m(this,"destroy",()=>{this.closeable=null});m(this,"getTableCreatorCellId",(t,e)=>`table-creator-cell-${t}-${e}`);m(this,"handleTableCreatorClick",t=>{var E,A;t.preventDefault(),t.stopPropagation();const e=t.target;p(ro,e instanceof HTMLElement,"invalid event target");const r=e.closest(".table-creator");p(ro,r,"no table creator");const i=r.querySelectorAll(".active");if(i.length===0)return;const o=i[i.length-1].id;p(ro,o,"no cell id");const l="table-creator-cell-";if(!o.startsWith(l))return;const d=o.substring(l.length).split("-");p(ro,d.length===2,"invalid cell id");const h=Number.parseInt(d[0],10)+1,C=Number.parseInt(d[1],10)+1;ro.debug(`${h}, ${C}`),this.colCount=C,this.rowCount=h,(E=this.closeable)==null||E.click(this,this.element),(A=this.closeable)==null||A.close("clickItem"),this.handleTableCreatorLeave()});m(this,"handleTableCreatorLeave",()=>{for(let t=0;t<9;t++)for(let e=0;e<9;e++){const r=this.getTableCreatorCellId(t,e),i=document.getElementById(r);i&&ct(i,"active")}});m(this,"handleTableCreatorCellEnter",t=>{const e=t.target;p(ro,e instanceof HTMLElement,"invalid event target");const r=e.id,i="table-creator-cell-";p(ro,r.startsWith(i),"invalid cell id");const o=r.substring(i.length).split("-");p(ro,o.length===2,"invalid cell id");let l=Number.parseInt(o[0],10),c=Number.parseInt(o[1],10);l===0&&c===0&&(l=-1,c=-1);for(let d=0;d<9;d++)for(let h=0;h<9;h++){const C=this.getTableCreatorCellId(d,h),E=document.getElementById(C);p(ro,E,"no cell"),d<=l&&h<=c?q(E,"active"):ct(E,"active")}});this.element=this.createTableCreatorElement()}createTableCreatorElement(){const t=B("div",["table-creator"],null),e=(r,i,s)=>{const o=B("div",["table-creator-cell"],r);return o.id=this.getTableCreatorCellId(i,s),o};t.addEventListener("click",this.handleTableCreatorClick),t.addEventListener("mouseleave",this.handleTableCreatorLeave);for(let r=0;r<9;r++){const i=B("div",["table-creator-row"],t);for(let s=0;s<9;s++)e(i,r,s).addEventListener("mouseenter",this.handleTableCreatorCellEnter)}return t}}function jV(){return new HV}function zV(n){const t=/[\u4e00-\u9fff\u3040-\u309f\u30a0-\u30ff\uac00-\ud7af]/g,e=n.match(t);return e?e.length:0}function CR(n){const t=zV(n);return n.length+t}function GV(n,t,e=[]){let r=0;if(!e||e.length===0)return r;for(let i=n;i<n+t;i+=1)r+=e[i]||0;return r}function WV(n,t){const e=CR(n),r=t-e;return r>0?n+" ".repeat(r):n}function qV(n,t,e,r,i){var l;const s=t,o=new M0(s);if(r==="markdown"||r==="text"){const c=U=>e.blocks[U].map((nt,Y)=>r==="markdown"?Gm(n,nt,e,[...i,{containerId:U,blockIndex:Y}]):zm(n,nt,e,[...i,{containerId:U,blockIndex:Y}])),d=U=>c(U).join(" ").replace(/\n/g," ").trim(),h=new Map,C=new Map;for(let U=0;U<o.colCount;U++){let M=0;for(let V=0;V<o.rowCount;V++){const nt=o.getCell({row:V,col:U});let Y="";nt.virtual||(Y=d(nt.containerId)),h.set(`${V},${U}`,Y),M=Math.max(M,CR(Y))}C.set(U,M)}const E=U=>{const M=h.get(`${U.row},${U.col}`)||"",V=C.get(U.col)||0;return WV(M,V)};if(r==="text"){const U=[];for(let M=0;M<o.colCount;M++){const V=E({row:0,col:M});U.push(V)}for(let M=1;M<o.rowCount;M++)for(let V=0;V<o.colCount;V++){const nt=E({row:M,col:V});U.push(nt)}return U.join(`
642
+ }`;var Wt=D6(function(){return se(L,kt+"return "+st).apply(e,P)});if(Wt.source=st,mb(Wt))throw Wt;return Wt}function Lst(a){return pe(a).toLowerCase()}function Ist(a){return pe(a).toUpperCase()}function Dst(a,u,g){if(a=pe(a),a&&(g||u===e))return wo(a);if(!a||!(u=Pr(u)))return a;var x=Nr(a),y=Nr(u),L=oc(x,y),P=Nh(x,y)+1;return Xl(x,L,P).join("")}function _st(a,u,g){if(a=pe(a),a&&(g||u===e))return a.slice(0,sf(a)+1);if(!a||!(u=Pr(u)))return a;var x=Nr(a),y=Nh(x,Nr(u))+1;return Xl(x,0,y).join("")}function Mst(a,u,g){if(a=pe(a),a&&(g||u===e))return a.replace(ja,"");if(!a||!(u=Pr(u)))return a;var x=Nr(a),y=oc(x,Nr(u));return Xl(x,y).join("")}function Ust(a,u){var g=wt,x=Tt;if(ze(u)){var y="separator"in u?u.separator:y;g="length"in u?jt(u.length):g,x="omission"in u?Pr(u.omission):x}a=pe(a);var L=a.length;if(So(a)){var P=Nr(a);L=P.length}if(g>=L)return a;var K=g-jl(x);if(K<1)return x;var H=P?Xl(P,0,K).join(""):a.slice(0,K);if(y===e)return H+x;if(P&&(K+=H.length-K),gb(y)){if(a.slice(K).search(y)){var Z,tt=H;for(y.global||(y=cf(y.source,pe(Ul.exec(y))+"g")),y.lastIndex=0;Z=y.exec(tt);)var st=Z.index;H=H.slice(0,st===e?K:st)}}else if(a.indexOf(Pr(y),K)!=K){var At=H.lastIndexOf(y);At>-1&&(H=H.slice(0,At))}return H+x}function Ost(a){return a=pe(a),a&&$u.test(a)?a.replace(Vu,of):a}var Nst=ff(function(a,u,g){return a+(g?" ":"")+u.toUpperCase()}),Eb=_L("toUpperCase");function I6(a,u,g){return a=pe(a),u=g?e:u,u===e?ef(a)?qg(a):ee(a):a.match(u)||[]}var D6=qt(function(a,u){try{return Nn(a,e,u)}catch(g){return mb(g)?g:new Nt(g)}}),Pst=$o(function(a,u){return Gn(u,function(g){g=Us(g),Ko(a,g,db(a[g],a))}),a});function Fst(a){var u=a==null?0:a.length,g=It();return a=u?dt(a,function(x){if(typeof x[1]!="function")throw new er(o);return[g(x[0]),x[1]]}):[],qt(function(x){for(var y=-1;++y<u;){var L=a[y];if(Nn(L[0],this,x))return Nn(L[1],this,x)}})}function Kst(a){return uet(ci(a,C))}function Ab(a){return function(){return a}}function Vst(a,u){return a==null||a!==a?u:a}var $st=UL(),Hst=UL(!0);function br(a){return a}function xb(a){return fL(typeof a=="function"?a:ci(a,C))}function jst(a){return hL(ci(a,C))}function zst(a,u){return mL(a,ci(u,C))}var Gst=qt(function(a,u){return function(g){return Wh(g,a,u)}}),Wst=qt(function(a,u){return function(g){return Wh(a,g,u)}});function bb(a,u,g){var x=Sn(u),y=sp(u,x);g==null&&!(ze(u)&&(y.length||!x.length))&&(g=u,u=a,a=this,y=sp(u,Sn(u)));var L=!(ze(g)&&"chain"in g)||!!g.chain,P=jo(a);return Gn(y,function(K){var H=u[K];a[K]=H,P&&(a.prototype[K]=function(){var Z=this.__chain__;if(L||Z){var tt=a(this.__wrapped__),st=tt.__actions__=Er(this.__actions__);return st.push({func:H,args:arguments,thisArg:a}),tt.__chain__=Z,tt}return H.apply(a,$t([this.value()],arguments))})}),a}function qst(){return Ye._===this&&(Ye._=Yg),this}function vb(){}function Xst(a){return a=jt(a),qt(function(u){return gL(u,a)})}var Yst=Zx(dt),Qst=Zx(N),Jst=Zx(we);function _6(a){return ob(a)?Ki(Us(a)):Ret(a)}function Zst(a){return function(u){return a==null?e:yc(a,u)}}var tot=NL(),eot=NL(!0);function Bb(){return[]}function yb(){return!1}function not(){return{}}function rot(){return""}function iot(){return!0}function sot(a,u){if(a=jt(a),a<1||a>yn)return[];var g=hr,x=O(a,hr);u=It(u),a-=hr;for(var y=tf(x,u);++g<a;)u(g);return y}function oot(a){return Vt(a)?dt(a,Us):Fr(a)?[a]:Er(ZL(pe(a)))}function lot(a){var u=++Xg;return pe(a)+u}var aot=fp(function(a,u){return a+u},0),cot=tb("ceil"),uot=fp(function(a,u){return a/u},1),fot=tb("floor");function dot(a){return a&&a.length?ip(a,br,Fx):e}function hot(a,u){return a&&a.length?ip(a,It(u,2),Fx):e}function mot(a){return Ro(a,br)}function got(a,u){return Ro(a,It(u,2))}function pot(a){return a&&a.length?ip(a,br,Hx):e}function Cot(a,u){return a&&a.length?ip(a,It(u,2),Hx):e}var Eot=fp(function(a,u){return a*u},1),Aot=tb("round"),xot=fp(function(a,u){return a-u},0);function bot(a){return a&&a.length?Zu(a,br):0}function vot(a,u){return a&&a.length?Zu(a,It(u,2)):0}return R.after=jrt,R.ary=u6,R.assign=Iit,R.assignIn=y6,R.assignInWith=yp,R.assignWith=Dit,R.at=_it,R.before=f6,R.bind=db,R.bindAll=Pst,R.bindKey=d6,R.castArray=nit,R.chain=l6,R.chunk=fnt,R.compact=dnt,R.concat=hnt,R.cond=Fst,R.conforms=Kst,R.constant=Ab,R.countBy=brt,R.create=Mit,R.curry=h6,R.curryRight=m6,R.debounce=g6,R.defaults=Uit,R.defaultsDeep=Oit,R.defer=zrt,R.delay=Grt,R.difference=mnt,R.differenceBy=gnt,R.differenceWith=pnt,R.drop=Cnt,R.dropRight=Ent,R.dropRightWhile=Ant,R.dropWhile=xnt,R.fill=bnt,R.filter=Brt,R.flatMap=krt,R.flatMapDeep=Rrt,R.flatMapDepth=wrt,R.flatten=r6,R.flattenDeep=vnt,R.flattenDepth=Bnt,R.flip=Wrt,R.flow=$st,R.flowRight=Hst,R.fromPairs=ynt,R.functions=Hit,R.functionsIn=jit,R.groupBy=Srt,R.initial=knt,R.intersection=Rnt,R.intersectionBy=wnt,R.intersectionWith=Snt,R.invert=Git,R.invertBy=Wit,R.invokeMap=Irt,R.iteratee=xb,R.keyBy=Drt,R.keys=Sn,R.keysIn=xr,R.map=Ep,R.mapKeys=Xit,R.mapValues=Yit,R.matches=jst,R.matchesProperty=zst,R.memoize=xp,R.merge=Qit,R.mergeWith=T6,R.method=Gst,R.methodOf=Wst,R.mixin=bb,R.negate=bp,R.nthArg=Xst,R.omit=Jit,R.omitBy=Zit,R.once=qrt,R.orderBy=_rt,R.over=Yst,R.overArgs=Xrt,R.overEvery=Qst,R.overSome=Jst,R.partial=hb,R.partialRight=p6,R.partition=Mrt,R.pick=tst,R.pickBy=k6,R.property=_6,R.propertyOf=Zst,R.pull=_nt,R.pullAll=s6,R.pullAllBy=Mnt,R.pullAllWith=Unt,R.pullAt=Ont,R.range=tot,R.rangeRight=eot,R.rearg=Yrt,R.reject=Nrt,R.remove=Nnt,R.rest=Qrt,R.reverse=ub,R.sampleSize=Frt,R.set=nst,R.setWith=rst,R.shuffle=Krt,R.slice=Pnt,R.sortBy=Hrt,R.sortedUniq=znt,R.sortedUniqBy=Gnt,R.split=kst,R.spread=Jrt,R.tail=Wnt,R.take=qnt,R.takeRight=Xnt,R.takeRightWhile=Ynt,R.takeWhile=Qnt,R.tap=drt,R.throttle=Zrt,R.thru=Cp,R.toArray=b6,R.toPairs=R6,R.toPairsIn=w6,R.toPath=oot,R.toPlainObject=B6,R.transform=ist,R.unary=tit,R.union=Jnt,R.unionBy=Znt,R.unionWith=trt,R.uniq=ert,R.uniqBy=nrt,R.uniqWith=rrt,R.unset=sst,R.unzip=fb,R.unzipWith=o6,R.update=ost,R.updateWith=lst,R.values=mf,R.valuesIn=ast,R.without=irt,R.words=I6,R.wrap=eit,R.xor=srt,R.xorBy=ort,R.xorWith=lrt,R.zip=art,R.zipObject=crt,R.zipObjectDeep=urt,R.zipWith=frt,R.entries=R6,R.entriesIn=w6,R.extend=y6,R.extendWith=yp,bb(R,R),R.add=aot,R.attempt=D6,R.camelCase=dst,R.capitalize=S6,R.ceil=cot,R.clamp=cst,R.clone=rit,R.cloneDeep=sit,R.cloneDeepWith=oit,R.cloneWith=iit,R.conformsTo=lit,R.deburr=L6,R.defaultTo=Vst,R.divide=uot,R.endsWith=hst,R.eq=ji,R.escape=mst,R.escapeRegExp=gst,R.every=vrt,R.find=yrt,R.findIndex=e6,R.findKey=Nit,R.findLast=Trt,R.findLastIndex=n6,R.findLastKey=Pit,R.floor=fot,R.forEach=a6,R.forEachRight=c6,R.forIn=Fit,R.forInRight=Kit,R.forOwn=Vit,R.forOwnRight=$it,R.get=pb,R.gt=ait,R.gte=cit,R.has=zit,R.hasIn=Cb,R.head=i6,R.identity=br,R.includes=Lrt,R.indexOf=Tnt,R.inRange=ust,R.invoke=qit,R.isArguments=Rc,R.isArray=Vt,R.isArrayBuffer=uit,R.isArrayLike=Ar,R.isArrayLikeObject=rn,R.isBoolean=fit,R.isBuffer=Yl,R.isDate=dit,R.isElement=hit,R.isEmpty=mit,R.isEqual=git,R.isEqualWith=pit,R.isError=mb,R.isFinite=Cit,R.isFunction=jo,R.isInteger=C6,R.isLength=vp,R.isMap=E6,R.isMatch=Eit,R.isMatchWith=Ait,R.isNaN=xit,R.isNative=bit,R.isNil=Bit,R.isNull=vit,R.isNumber=A6,R.isObject=ze,R.isObjectLike=Je,R.isPlainObject=Zh,R.isRegExp=gb,R.isSafeInteger=yit,R.isSet=x6,R.isString=Bp,R.isSymbol=Fr,R.isTypedArray=hf,R.isUndefined=Tit,R.isWeakMap=kit,R.isWeakSet=Rit,R.join=Lnt,R.kebabCase=pst,R.last=fi,R.lastIndexOf=Int,R.lowerCase=Cst,R.lowerFirst=Est,R.lt=wit,R.lte=Sit,R.max=dot,R.maxBy=hot,R.mean=mot,R.meanBy=got,R.min=pot,R.minBy=Cot,R.stubArray=Bb,R.stubFalse=yb,R.stubObject=not,R.stubString=rot,R.stubTrue=iot,R.multiply=Eot,R.nth=Dnt,R.noConflict=qst,R.noop=vb,R.now=Ap,R.pad=Ast,R.padEnd=xst,R.padStart=bst,R.parseInt=vst,R.random=fst,R.reduce=Urt,R.reduceRight=Ort,R.repeat=Bst,R.replace=yst,R.result=est,R.round=Aot,R.runInContext=$,R.sample=Prt,R.size=Vrt,R.snakeCase=Tst,R.some=$rt,R.sortedIndex=Fnt,R.sortedIndexBy=Knt,R.sortedIndexOf=Vnt,R.sortedLastIndex=$nt,R.sortedLastIndexBy=Hnt,R.sortedLastIndexOf=jnt,R.startCase=Rst,R.startsWith=wst,R.subtract=xot,R.sum=bot,R.sumBy=vot,R.template=Sst,R.times=sot,R.toFinite=zo,R.toInteger=jt,R.toLength=v6,R.toLower=Lst,R.toNumber=di,R.toSafeInteger=Lit,R.toString=pe,R.toUpper=Ist,R.trim=Dst,R.trimEnd=_st,R.trimStart=Mst,R.truncate=Ust,R.unescape=Ost,R.uniqueId=lot,R.upperCase=Nst,R.upperFirst=Eb,R.each=a6,R.eachRight=c6,R.first=i6,bb(R,function(){var a={};return _s(R,function(u,g){oe.call(R.prototype,g)||(a[g]=u)}),a}(),{chain:!1}),R.VERSION=r,Gn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(a){R[a].placeholder=R}),Gn(["drop","take"],function(a,u){Yt.prototype[a]=function(g){g=g===e?1:I(jt(g),0);var x=this.__filtered__&&!u?new Yt(this):this.clone();return x.__filtered__?x.__takeCount__=O(g,x.__takeCount__):x.__views__.push({size:O(g,hr),type:a+(x.__dir__<0?"Right":"")}),x},Yt.prototype[a+"Right"]=function(g){return this.reverse()[a](g).reverse()}}),Gn(["filter","map","takeWhile"],function(a,u){var g=u+1,x=g==fe||g==fr;Yt.prototype[a]=function(y){var L=this.clone();return L.__iteratees__.push({iteratee:It(y,3),type:g}),L.__filtered__=L.__filtered__||x,L}}),Gn(["head","last"],function(a,u){var g="take"+(u?"Right":"");Yt.prototype[a]=function(){return this[g](1).value()[0]}}),Gn(["initial","tail"],function(a,u){var g="drop"+(u?"":"Right");Yt.prototype[a]=function(){return this.__filtered__?new Yt(this):this[g](1)}}),Yt.prototype.compact=function(){return this.filter(br)},Yt.prototype.find=function(a){return this.filter(a).head()},Yt.prototype.findLast=function(a){return this.reverse().find(a)},Yt.prototype.invokeMap=qt(function(a,u){return typeof a=="function"?new Yt(this):this.map(function(g){return Wh(g,a,u)})}),Yt.prototype.reject=function(a){return this.filter(bp(It(a)))},Yt.prototype.slice=function(a,u){a=jt(a);var g=this;return g.__filtered__&&(a>0||u<0)?new Yt(g):(a<0?g=g.takeRight(-a):a&&(g=g.drop(a)),u!==e&&(u=jt(u),g=u<0?g.dropRight(-u):g.take(u-a)),g)},Yt.prototype.takeRightWhile=function(a){return this.reverse().takeWhile(a).reverse()},Yt.prototype.toArray=function(){return this.take(hr)},_s(Yt.prototype,function(a,u){var g=/^(?:filter|find|map|reject)|While$/.test(u),x=/^(?:head|last)$/.test(u),y=R[x?"take"+(u=="last"?"Right":""):u],L=x||/^find/.test(u);!y||(R.prototype[u]=function(){var P=this.__wrapped__,K=x?[1]:arguments,H=P instanceof Yt,Z=K[0],tt=H||Vt(P),st=function(Jt){var ne=y.apply(R,$t([Jt],K));return x&&At?ne[0]:ne};tt&&g&&typeof Z=="function"&&Z.length!=1&&(H=tt=!1);var At=this.__chain__,kt=!!this.__actions__.length,Dt=L&&!At,Wt=H&&!kt;if(!L&&tt){P=Wt?P:new Yt(this);var _t=a.apply(P,K);return _t.__actions__.push({func:Cp,args:[st],thisArg:e}),new Cr(_t,At)}return Dt&&Wt?a.apply(this,K):(_t=this.thru(st),Dt?x?_t.value()[0]:_t.value():_t)})}),Gn(["pop","push","shift","sort","splice","unshift"],function(a){var u=uc[a],g=/^(?:push|sort|unshift)$/.test(a)?"tap":"thru",x=/^(?:pop|shift)$/.test(a);R.prototype[a]=function(){var y=arguments;if(x&&!this.__chain__){var L=this.value();return u.apply(Vt(L)?L:[],y)}return this[g](function(P){return u.apply(Vt(P)?P:[],y)})}}),_s(Yt.prototype,function(a,u){var g=R[u];if(g){var x=g.name+"";oe.call(Pn,x)||(Pn[x]=[]),Pn[x].push({name:u,func:g})}}),Pn[up(e,U).name]=[{name:"wrapper",func:e}],Yt.prototype.clone=Mtt,Yt.prototype.reverse=Utt,Yt.prototype.value=Ott,R.prototype.at=hrt,R.prototype.chain=mrt,R.prototype.commit=grt,R.prototype.next=prt,R.prototype.plant=Ert,R.prototype.reverse=Art,R.prototype.toJSON=R.prototype.valueOf=R.prototype.value=xrt,R.prototype.first=R.prototype.head,Cc&&(R.prototype[Cc]=Crt),R},Do=af();si?((si.exports=Do)._=Do,tc._=Do):Ye._=Do}).call(Bn)})(Ii,Ii.exports);function HK(n,t,e,r){_0(n,{className:"status-input",defaultValue:t,onChange:e,onKeyDown:r,maxLength:32})}const zk=["Blue","Grey","Yellow","Red","Green","Purple"];function jK(){const n=B("div",["status-color-palette"],null);for(const t of zk){const e=B("button",["status-box-button"],null);e.setAttribute("data-color",Ii.exports.lowerCase(t)),e.setAttribute("title",_.t(`status.color.${Ii.exports.lowerCase(t)}`)),n.appendChild(e)}return n}class zK{constructor(){m(this,"root",jK());m(this,"changeColor",t=>{for(const r of Array.from(this.root.querySelectorAll(":scope > button")))r.classList.remove("selected");const e=this.root.querySelector(`button[data-color="${Ii.exports.lowerCase(t)}"]`);e==null||e.classList.add("selected")})}}function Gk(n){localStorage.setItem(`statusBox.lastColor.${Ii.exports.lowerCase(n.color)}`,n.title)}function Wk(n){var t;return(t=localStorage.getItem(`statusBox.lastColor.${Ii.exports.lowerCase(n)}`))!=null?t:_.t(`status.colorDefaultTitle.${Ii.exports.lowerCase(n)}`)}function qk(){var i;const n=zk[0],t=(i=Wk(n))!=null?i:_.t(`status.colorDefaultTitle.${Ii.exports.lowerCase(n)}`);return{insert:" ",attributes:{id:it(),type:"status",box:!0,title:t,subtle:!0,created:Date.now(),color:n}}}const ig=D("StatusBoxEditor");class Xk{constructor(t){m(this,"linkPopup",null);m(this,"boxElement");m(this,"statusPalette",new zK);m(this,"isEditing",!1);m(this,"editorStatus",t=>{if(!this.editor.isWritable())return;const e=this.editor.getBoxData(t);this.linkPopup=new su(this.createPopupContent(e.title,e.color,e.subtle),{id:"status-box-popup"}),this.linkPopup.on("show",this.handleShow),this.linkPopup.on("close",this.handClose),this.linkPopup.manualShow(t,{theme:"light",placement:"bottom-start",offset:[5,5]}),this.boxElement=t});m(this,"handleShow",()=>{this.focus()});m(this,"handClose",()=>{var r;p(ig,this.boxElement,"boxElement not found");const t=this.editor.getBoxData(this.boxElement),e=et(this.boxElement);if(p(ig,e,"block not found"),t.title)if(t.title.length>32){const i=t.title.slice(0,32),s={...t,title:i};this.editor.updateBoxData(s,{noFocus:!0}),Gk(s)}else Gk(t);else{const i=nl(e,this.boxElement);this.editor.deleteTextFromBlock(e,i.start,1)}this.editor.focus(),(r=this.linkPopup)==null||r.destroy(),this.linkPopup=null,this.boxElement=void 0,this.isEditing=!1});m(this,"handleKeyDown",(t,e)=>{var r;e||t.key==="Enter"&&((r=this.linkPopup)==null||r.close(null))});m(this,"onColorChange",t=>{var s,o;if(!(t.target instanceof HTMLElement)||t.target.closest("[data-color]")===null)return;const e=Ii.exports.capitalize(t.target.getAttribute("data-color"));p(ig,this.boxElement,"boxElement not found");const r=this.editor.getBoxData(this.boxElement);this.statusPalette.changeColor(e);const i={...r,color:e};if(!this.isEditing){const l=(o=(s=this.linkPopup)==null?void 0:s.popper)==null?void 0:o.querySelector("input"),c=Wk(e);l&&(l.value=c),i.title=c}this.editor.updateBoxData(i,{noFocus:!0}),this.focus()});m(this,"onTitleChange",t=>{const e=t.target.value;p(ig,this.boxElement,"boxElement not found");const i={...this.editor.getBoxData(this.boxElement),title:e.trim()};this.editor.updateBoxData(i,{noFocus:!0}),this.isEditing=!0});this.editor=t,this.statusPalette.root.addEventListener("click",this.onColorChange)}focus(){setTimeout(()=>{var t,e,r,i,s,o;(r=(e=(t=this.linkPopup)==null?void 0:t.popper)==null?void 0:e.querySelector("input"))==null||r.focus(),(o=(s=(i=this.linkPopup)==null?void 0:i.popper)==null?void 0:s.querySelector("input"))==null||o.select()},100)}createPopupContent(t,e,r){const i=B("div",["status-box-editor-popup"],null);return HK(i,t,this.onTitleChange,this.handleKeyDown),this.isEditing=!1,i.appendChild(this.statusPalette.root),this.statusPalette.changeColor(e),i}destroy(){var t;(t=this.linkPopup)==null||t.destroy()}}const lat="",GK=D("status-box-command");class Sd{static get commands(){return[{id:this.id,name:_.t("status.command.name"),icon:g2,order:650,group:"common",subText:"/status"}]}static insertStatus(t,e,r){var c;const i=t.getBlockByIndex(e,r),s=qk(),{start:o}=t.selection.range;p(GK,xi(o),"invalid block position"),t.insertBoxToBlock(i,o.offset,s.attributes);const l=t.getBoxById((c=s.attributes)==null?void 0:c.id);t.addCustom("status-box",d=>new Xk(d)).editorStatus(l)}static insertEmptyBlockStatus(t,e,r){var l;let i=t.getBlockByIndex(e,r);(!i||!ve(t,i))&&(i=t.insertTextBlock([],e,r));const s=qk();t.setBlockText(i,[s]);const o=t.getBoxById((l=s.attributes)==null?void 0:l.id);return t.addCustom("status-box",c=>new Xk(c)).editorStatus(o),i}}m(Sd,"id","insert-status");const WK={"en-US":{status:{empty:"Set status",command:{name:"Status"},color:{red:"Red",yellow:"Yellow",green:"Green",blue:"Blue",purple:"Purple",grey:"Gray"},colorDefaultTitle:{red:"Delayed",yellow:"In progress",green:"Done",blue:"Not started",purple:"To be confirmed",grey:"Paused"}}},"zh-CN":{status:{empty:"\u8BBE\u7F6E\u72B6\u6001",command:{name:"\u72B6\u6001"},color:{red:"\u7EA2\u8272",yellow:"\u9EC4\u8272",green:"\u7EFF\u8272",blue:"\u84DD\u8272",purple:"\u7D2B\u8272",grey:"\u7070\u8272"},colorDefaultTitle:{red:"\u5DF2\u5EF6\u671F",yellow:"\u8FDB\u884C\u4E2D",green:"\u5DF2\u5B8C\u6210",blue:"\u672A\u5F00\u59CB",purple:"\u5F85\u786E\u8BA4",grey:"\u5DF2\u6682\u505C"}}},"ja-JP":{status:{empty:"\u30B9\u30C6\u30FC\u30BF\u30B9\u3092\u8A2D\u5B9A",command:{name:"\u30B9\u30C6\u30FC\u30BF\u30B9"},color:{red:"\u8D64",yellow:"\u9EC4",green:"\u7EFF",blue:"\u9752",purple:"\u7D2B",grey:"\u7070"},colorDefaultTitle:{red:"\u9045\u5EF6",yellow:"\u9032\u884C\u4E2D",green:"\u5B8C\u4E86",blue:"\u672A\u7740\u624B",purple:"\u672A\u78BA\u8A8D",grey:"\u4E00\u6642\u505C\u6B62"}}}};_.mergeLang(WK);const wa=D("inline-box-items");function qK(n,t,e){return n.undoManager.runInGroup(()=>{var o;let r=n.findBlockByIndex(t,e);(!r||!ve(n,r))&&(r=n.insertTextBlock([],t,e));const i=$k();n.setBlockText(r,[i]);const s=(o=i.attributes)==null?void 0:o.id;return p(wa,s,"mathjax box id is empty"),setTimeout(()=>{const l=n.getBoxById(s);rg(n,l)},100),r})}function XK(n,t,e){let r=n.findBlockByIndex(t,e),i="bottom-start";return(!r||!ve(n,r))&&(i="top-start",r=n.insertTextBlock([],t,e)),kd(n,{target:r,linkText:"",linkUrl:"",onFinished:(l,c)=>{n.undoManager.runInGroup(()=>{try{p(wa,r,"block not found"),ve(n,r)||(r=n.insertTextBlock([],t,e));const d=qr(l,{link:c}),h=qr(" ",null),C=[d,h];n.insertTextToBlock(r,0,C),n.selection.selectBlock(r,Vn(C)),n.focus()}catch(d){wa.error(d)}})},onClose:()=>{n.focus()},placement:i}),r}function YK(n,t,e){return n.undoManager.runInGroup(()=>{var l;const r=n.getBlockByIndex(t,e),i=n.selection.range;p(wa,xi(i.start),"invalid block position");const s=$k();n.insertBoxToBlock(r,i.start.offset,s.attributes);const o=(l=s.attributes)==null?void 0:l.id;return p(wa,o,"mathjax box id is empty"),setTimeout(()=>{const c=n.getBoxById(o);rg(n,c)},100),r})}function QK(n,t,e){const r=n.getBlockByIndex(t,e),i=n.selection.range;p(wa,xi(i.start),"invalid block position");const s=Fs(n,r,i);if(s.length===0)return;const o=s[0],l=$s(n,r,"quick-menu-inline-link",o);kd(n,{target:l,linkText:"",linkUrl:"",onFinished:(h,C)=>{n.undoManager.runInGroup(()=>{try{const E=n.getBlockText(r),A=Gs(E,i.start.offset,h,{link:C});n.setBlockText(r,A),n.selection.selectBlock(r,i.start.offset+h.length),n.focus()}catch(E){wa.error(E)}})},onClose:()=>{n.focus()},placement:"bottom-start"})}class Yk{getCommands(){return[{id:"insert-math",name:_.t("quickMenu.inlineBox.math"),icon:DT,order:900,group:"common",subText:Qn("insert-math")},{id:"insert-link",name:_.t("quickMenu.inlineBox.link"),icon:rE,order:400,group:"common",subText:Qn("insert-link")}]}async handleUpdateBlockCore(t,e){switch(e.item.id){case"insert-math":return YK(t,e.containerId,e.blockIndex);case"insert-link":return QK(t,e.containerId,e.blockIndex);case Sd.id:return Sd.insertStatus(t,e.containerId,e.blockIndex);default:return null}}async handleInsertEmptyBlockCore(t,e){switch(e.item.id){case"insert-math":return qK(t,e.containerId,e.blockIndex);case"insert-link":return XK(t,e.containerId,e.blockIndex);case Sd.id:return Sd.insertEmptyBlockStatus(t,e.containerId,e.blockIndex);default:return null}}async executeCommand(t,e,r){if(r.from==="quick-menu"||r.from==="add-block-menu"){const i=t.getBlockById(r.blockId),s=t.getParentContainer(i),o=pt(s),l=t.getBlockIndex(i);t.undoManager.runInGroup(()=>this.handleUpdateBlockCore(t,{item:e,containerId:o,blockIndex:l}))}else r.from==="block-menu"&&t.undoManager.runInGroup(()=>this.handleInsertEmptyBlockCore(t,{item:e,containerId:r.containerId,blockIndex:r.blockIndex}));return null}}const Qk=(n,t)=>{var e;return(e=n.children)==null?void 0:e.map(r=>({...r,itemType:"insert-block",commandProvider:t,children:Qk(r,t)}))};function JK(n,t){var s,o;const{withPlainText:e}=t,r=(o=(s=n.options.componentsOptions)==null?void 0:s.quickMenu)==null?void 0:o.commandProviders;if(!r)return[];const i=[];return[...r,new Uk(e),new Yk].forEach(l=>{const c=l.getCommands(n,t);i.push(...c.map(d=>({...d,itemType:"insert-block",commandProvider:l,children:Qk(d,l)})))}),i}function ZK(n,t){const e=[];return n.editorBlocks.forEach(r=>{if(!r.getOptions)return;const i=r.getOptions(n);!i.insertBlockCommandItems||(i.insertBlockCommandItems.forEach(s=>{Mk(s,i)}),e.push(...i.insertBlockCommandItems))}),e.push(...JK(n,t)),e}function iA(n,t={withPlainText:!1,from:"block-menu"}){const e=ZK(n,t),r=new Map;e.forEach(o=>{var d,h;const l=(d=o.group)!=null?d:"";let c=r.get(l);c?c.items.push(o):(c={group:l,order:o.groupOrder||Ok[l]||1e3,items:[o],hide:(h=o.hideGroupItem)!=null?h:!1},r.set(l,c))});const i=Array.from(r.values());i.sort((o,l)=>o.order-l.order),i.forEach(o=>{o.items.sort((l,c)=>{var d,h;return((d=l.order)!=null?d:0)-((h=c.order)!=null?h:0)})});const s=[];return i.forEach((o,l)=>{const c=`blockMenu.section.${o.group||"common"}`,d=_.t(c),h=d===c?o.group:d;o.hide||s.push({id:`section-${l}`,name:h,type:"section",group:o.group,itemType:"insert-block"}),s.push(...o.items.map(C=>({...C})))}),s}function tV(n,t,e){const r=n.getFocusedBlock();if(!r)return;const i=n.getParentContainer(r),s=pt(i);let l=n.getBlockIndex(r);ve(n,r)||(l+=1);const c=e.trigger?"quick-menu":"add-block-menu";if(t.commandProvider){n.emit("beforeExecCommand",n,t,{source:c}),t.commandProvider.executeCommand(n,t,{from:c,...e});return}!t.blockOptions||!t.blockOptions.handleInsertEmptyBlock||(n.emit("beforeExecCommand",n,t,{source:c}),t.blockOptions.handleInsertEmptyBlock(n,{containerId:s,blockIndex:l,item:t,from:c}))}const Jk=D("quick-menu"),eV={id:"quick-menu",trigger:["/"]},nV=5;class sg{constructor(t,e=eV){m(this,"suggest");m(this,"items");m(this,"maxHeading");m(this,"firstEmptyOffset",-1);m(this,"queryItems",async(t,e)=>{if(this.initMenuItems(),this.refreshMenuItems(),e){const r=new Set,i=e.toLocaleLowerCase().replace(/^\s+|\s+$/g,""),s=this.items.filter(o=>{if(o.type==="section")return!0;if(o.name.toLocaleLowerCase().indexOf(i)!==-1||fN(o).toLocaleLowerCase().indexOf(i)!==-1)return r.add(o.group),!0;const l=`blockMenu.section.${o.group||"common"}`,c=_.t(l),d=c===l?o.group:c;return(d==null?void 0:d.toLocaleLowerCase().indexOf(i))!==-1?(r.add(o.group),!0):!1}).filter(o=>o.type==="section"?r.has(o.group):!0);return s.length?this.firstEmptyOffset=-1:this.handleEmptySearch(),s}return this.items});m(this,"onClose",()=>{this.firstEmptyOffset=-1,this.menu.closeReason==="clickBackground"&&this.editor.focus()});m(this,"onShow",(t,e,r,i)=>{const s=this.editor.getBlockByIndex(e,r);if(!Gr(s)){const o=et(at(s));if(o&&Ot(o)==="code")return!1}return!0});m(this,"onClickItem",(t,e)=>{const r=e;r.itemType==="insert-block"&&(p(Jk,r.blockOptions||r.commandProvider,"invalid quick item, no block options or command provider"),p(Jk,this.suggest.anchor,"invalid suggest, no anchor"),this.options.id==="empty-block-menu"&&this.editor.focus(),tV(this.editor,r,this.suggest.anchor))});this.editor=t,this.options=e,this.items=[],this.maxHeading=G0(),this.suggest=new mE(t,{id:e.id||"quick-menu",trigger:e.trigger,needSpaceBeforeTrigger:!0,autoDeleteTrigger:!0,highlight:!0,onClose:this.onClose,onShow:this.onShow,onClickItem:this.onClickItem,queryItems:this.queryItems})}get menu(){return this.suggest.menu.menu}destroy(){this.suggest.destroy()}initMenuItems(){var r;const t=((r=this.suggest.anchor)==null?void 0:r.trigger)==="/"?"quick-menu":"block-menu",e=iA(this.editor,{withPlainText:!1,from:t});this.items=e}refreshMenuItems(){let t=null,e=0;const r=G0();if(r!==this.maxHeading){const i=new Uk,o=i.getCommands().map(l=>({...l,itemType:"insert-block",commandProvider:i}));for(let l=0;l<this.items.length;l++)this.items[l].group==="basics"&&(t||(t=l),t&&e++);t&&e&&this.items.splice(t,e,...o),this.maxHeading=r}}handleEmptySearch(){const t=this.editor.selection.getFocusedPos();if(this.firstEmptyOffset===-1){if(t.isSimple()){const{offset:e}=t;this.firstEmptyOffset=e-1}}else if(t.isSimple()){const{offset:e}=t;e-this.firstEmptyOffset>nV&&(this.suggest.close(),this.firstEmptyOffset=-1)}}}class Ld{constructor(t){m(this,"instance");m(this,"mousedown",!1);m(this,"currentInstance",null);m(this,"attributeName",[]);m(this,"attributeDesc","");m(this,"_lastClickButtonId","");m(this,"observer",null);m(this,"observerCallback",null);m(this,"createContent",t=>{let e="",r=0;for(;r<this.attributeName.length&&!e;)t.hasAttribute(this.attributeName[r])&&(e=t.getAttribute(this.attributeName[r])||""),r++;const i=t.getAttribute(this.attributeDesc);if(!i)return e;const s=B("div",[],null);return B("span",[],s,e),i&&B("span",["editor-tooltip-desc"],s,i),s});m(this,"handleDocumentMouseDown",()=>{this.mousedown=!0,this.editor.domEvents.addEventListener(document,"mouseup",this.handleDocumentMouseUp)});m(this,"handleDocumentMouseUp",()=>{this.mousedown=!1,this.editor.domEvents.removeEventListener(document,"mouseup",this.handleDocumentMouseUp)});m(this,"handleShown",t=>{this.currentInstance&&this.hide(),this.currentInstance=t,this.createObserver()});m(this,"handleHidden",()=>{this.destroyObserver(),this.currentInstance=null});m(this,"handleShow",t=>{var i;const e=t.reference;if(!e||!Ce(document.body,e)||window.isDragging||this.mousedown)return!1;const r=Number.parseInt((i=e.getAttribute("data-tooltip-hide-at"))!=null?i:"",10);if(r&&Date.now()-r<1e3)return!1;if(this._lastClickButtonId===e.getAttribute("data-button-id"))return this._lastClickButtonId="",!1;if(this.attributeName.every(s=>!e.hasAttribute(s)))return!1;if(t.reference){const s={};if(t.reference.hasAttribute("data-editor-tooltip-placement")&&(s.placement=t.reference.getAttribute("data-editor-tooltip-placement")||"top"),t.reference.hasAttribute("data-editor-tooltip-offset-x")||t.reference.hasAttribute("data-editor-tooltip-offset-y")){const l=t.reference.getAttribute("data-editor-tooltip-offset-x"),c=t.reference.getAttribute("data-editor-tooltip-offset-y");s.offset=[l?Number.parseInt(l,10):0,c?Number.parseInt(c,10):0]}t.reference.hasAttribute("data-editor-tooltip-maxwidth")&&(s.maxWidth=Number.parseInt(t.reference.getAttribute("data-editor-tooltip-maxwidth")||"350",10)),t.reference.hasAttribute("data-editor-tooltip-allow-markdown")&&(s.allowHTML=!0);const o=document.body;if(s.appendTo=this.fixContainerForFullscreen(o),Object.keys(s).length&&t.setProps(s),t.reference.hasAttribute(`data-editor-tooltip-${this.editor.clientId}-dynamic`)){const l=t.reference.getAttribute(`data-editor-tooltip-${this.editor.clientId}-dynamic`);t.setContent(l||"")}}return!0});this.editor=t;const e=t.clientId;this.attributeName=[`data-editor-tooltip-${e}`,`data-editor-tooltip-${e}-dynamic`,"data-editor-tooltip-common"],this.attributeDesc=`data-editor-tooltip-desc-${e}`,this.instance=Tp.delegate(document.body,{theme:"editor-tooltip",maxWidth:400,delay:200,target:this.attributeName.map(r=>`[${r}]`).join(","),content:this.createContent,onShow:this.handleShow,onShown:this.handleShown,onHide:this.handleHidden,hideOnClick:!1}),t.domEvents.addEventListener(document,"mousedown",this.handleDocumentMouseDown)}set lastClickButtonId(t){this._lastClickButtonId=t,t&&setTimeout(()=>{this._lastClickButtonId===t&&(this._lastClickButtonId="")},500)}visible(){var t;return(t=this.currentInstance)==null?void 0:t.state.isVisible}hide(){var t;(t=this.currentInstance)!=null&&t.state.isVisible&&this.currentInstance.hide()}destroy(){this.destroyObserver(),this.instance.destroy(),this.editor.domEvents.removeEventListener(document,"mousedown",this.handleDocumentMouseDown),this.editor.domEvents.removeEventListener(document,"mouseup",this.handleDocumentMouseUp)}createObserver(){this.destroyObserver();const t=this.currentInstance;if(!t||!t.reference)return;this.observerCallback=Ne.default(()=>{t.reference.closest("body")||(t.hide(),this.destroyObserver())},200),this.observer=new MutationObserver(this.observerCallback);const e=document.body,r={childList:!0,attributes:!1,subtree:!0};this.observer.observe(e,r)}destroyObserver(){this.observer&&(this.observer.disconnect(),this.observer=null),this.observerCallback&&(this.observerCallback.cancel(),this.observerCallback=null)}fixContainerForFullscreen(t){return t.closest("body")&&document.fullscreenElement&&!document.fullscreenElement.contains(t)?document.fullscreenElement:t}}const rV={"text/style-bold":"bold","text/style-italic":"italic","text/style-underline":"underline","text/style-strikethrough":"line-through","text/style-code":"code","text/style-sub":"subscript","text/style-super":"superscript",link:"link"};function iV(n,t){const e=new Set(Object.keys(rV)),r=t.filter(s=>e.has(s.id));return j0(r)}function Id(n,t){if(!n.isWritable()||ti(n))return!1;const e=n.selection.range,r=n.editorCommandProviders.getCommands(e,"shortcut"),s=iV(n,r).find(o=>o.id===`text/${t}`||o.id==="link");return s?(n.editorCommandProviders.executeCommand(e,s,{}),Au.get(n).update("selectionChange"),!0):!1}function sV(n,t){const e=n.selection.focusedBlock;if(!n.isWritable()||!ot(n,e))return!1;const r=n.getBlockData(e).heading,i={id:t===0?"text":`heading-${t}`,source:"shortcut",value:t===0?null:String(t),group:"BlockTurnIntoCommandProvider"};return Number(r)===t&&(i.id="text",i.value=null),n.editorCommandProviders.executeCommand(n.selection.range,i,{}),!0}const sA={"CtrlOrCmd+B":n=>Id(n,"style-bold"),"CtrlOrCmd+I":n=>Id(n,"style-italic"),"CtrlOrCmd+U":n=>Id(n,"style-underline"),"CtrlOrCmd+D":n=>Id(n,"style-strikethrough"),"CtrlOrCmd+K":n=>Id(n,"link"),...(()=>{const n={};for(let t=0;t<=8;t++)n[`CtrlOrCmd+Alt+Digit${t}`]=e=>sV(e,t);return n})()},oV={quickMenu:{basic:{heading:{title:"\u6807\u9898 {heading}",space:"{markdown}\u7A7A\u683C"},unordered:"\u65E0\u5E8F\u5217\u8868",ordered:"\u6709\u5E8F\u5217\u8868",checkbox:"\u5F85\u529E\u5217\u8868",quote:"\u5F15\u7528"},inlineBox:{math:"\u516C\u5F0F",link:"\u94FE\u63A5"}},link:{textLabel:"\u6587\u672C",urlLabel:"\u94FE\u63A5\u5730\u5740",textPlaceholder:"\u8BF7\u8F93\u5165\u6587\u672C",urlPlaceholder:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740",submitText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",edit:"\u7F16\u8F91",remove:"\u53D6\u6D88\u94FE\u63A5"},commands:{unordered:"\u65E0\u5E8F\u5217\u8868",ordered:"\u6709\u5E8F\u5217\u8868",check:"\u5F85\u529E\u5217\u8868",link:"\u94FE\u63A5",quote:"\u5F15\u7528",alignLeft:"\u5DE6\u5BF9\u9F50",alignRight:"\u53F3\u5BF9\u9F50",alignCenter:"\u5C45\u4E2D\u5BF9\u9F50",alignGroup:"\u5BF9\u9F50\u65B9\u5F0F",heading:"\u6807\u9898 {name}",headingGroup:"\u6807\u9898\u6837\u5F0F",text:"\u6B63\u6587"}},lV={quickMenu:{basic:{heading:{title:"Heading {heading}",space:"{markdown}space"},unordered:"Bulleted list",ordered:"Numbered list",checkbox:"To-do list",quote:"Quote"},inlineBox:{math:"Formula",link:"Link"}},link:{textLabel:"Text",urlLabel:"Link address",textPlaceholder:"Please enter text",urlPlaceholder:"Please enter link",submitText:"Confirm",cancelText:"Cancel",edit:"Edit",remove:"Remove link"},commands:{unordered:"Bulleted list",ordered:"Numberer list",check:"To-do list",link:"Link",quote:"Quote",alignLeft:"Align left",alignRight:"Align right",alignCenter:"Center text",alignGroup:"Alignment",heading:"Heading {name}",headingGroup:"Text style",text:"Text"}},aV={quickMenu:{basic:{heading:{title:"\u898B\u51FA\u3057{heading}",space:"{markdown}\u30B9\u30DA\u30FC\u30B9"},unordered:"\u7B87\u6761\u66F8\u304D\u30EA\u30B9\u30C8",ordered:"\u756A\u53F7\u4ED8\u304D\u30EA\u30B9\u30C8",checkbox:"\u30D0\u30C3\u30AF\u30ED\u30B0",quote:"\u5F15\u7528"},inlineBox:{math:"\u6570\u5F0F",link:"URL"}},link:{textLabel:"\u30C6\u30AD\u30B9\u30C8",urlLabel:"URL",textPlaceholder:"\u30C6\u30AD\u30B9\u30C8\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",urlPlaceholder:"URL \u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",submitText:"OK",cancelText:"\u30AD\u30E3\u30F3\u30BB\u30EB",edit:"\u7DE8\u96C6",remove:"\u30EA\u30F3\u30AF\u3092\u89E3\u9664"},commands:{unordered:"\u7B87\u6761\u66F8\u304D\u30EA\u30B9\u30C8",ordered:"\u756A\u53F7\u4ED8\u304D\u30EA\u30B9\u30C8",check:"\u30D0\u30C3\u30AF\u30ED\u30B0",link:"URL",quote:"\u5F15\u7528",alignLeft:"\u5DE6\u63C3\u3048",alignRight:"\u53F3\u63C3\u3048",alignCenter:"\u4E2D\u592E\u63C3\u3048",alignGroup:"\u5BF9\u9F50\u65B9\u5F0F",heading:"\u898B\u51FA\u3057{name}",headingGroup:"\u30BF\u30A4\u30C8\u30EB\u30B9\u30BF\u30A4\u30EB",text:"\u672C\u6587"}};_.mergeLang({"zh-CN":oV,"en-US":lV,"ja-JP":aV});const dat="";function Sa(n,...t){const e=Qr(...t);return e.classList.remove("editor-button"),e.classList.add("editor-text-button"),n.append(e),e}function Zk(n){const t=z0(n);t==null||t.hide();const e=n.findCustom("table-border-bar");e==null||e.closeToolbar()}function cV(n){return B("div",["insert-column-button","drop-marker"],n)}const uV=D("row-height");function tR(n){const t=Kt.fromTable(n),e=n.rows;p(uV,e.length===t.rowCount,"row count mismatch");const r=Array(t.rowCount).fill(0);for(let i=0;i<e.length;){let s=1,l=e[i].getBoundingClientRect().height,c=i+1;for(;c<e.length;){const d=e[c];if(d.cells.length!==0)break;s++,c++,l+=d.getBoundingClientRect().height}for(let d=0;d<s;d++)r[i+d]=l/s;i=c}return r}const fV=D("table-border-bar-dom");function eR(n){var c;const t=et(n.contentElement);p(fV,t,"no block");const r=be(t).querySelector(".table-border-bar-container.left"),s=zt(t).offsetLeft-cu,o=((c=n.scrollOptions.paddingLeft)!=null?c:0)+s,l=Math.min(n.contentElement.offsetLeft-s,n.rootElement.scrollLeft-o);r&&(r.style.left=`${-l}px`)}const Al=D("table-border-bar-dom");function xu(n,t){p(Al,fn(t),"invalid table block");const e=un(t),r=as(n,t),i=be(t),s=(C,E,A)=>{const v=B("div",["button-root",E],C),w=B("div",["button-container",E],v);v.setAttribute(`data-${E}-index`,`${A}`),w.setAttribute(`data-editor-tooltip-${n.clientId}`,E==="left"?_.t("table.insertRow"):_.t("table.insertCol")),B("span",["insert-indicator"],w),cV(w)},{selectedRows:o,selectedColumns:l}=CE(n,t),c=()=>{const C=r.querySelector(".table-border-bar-container.top");p(Al,C,"no top border bar container");const E=B("div",["table-border-bar-container","top"],null),A=B("div",["table-border-bar","top"],E),v=uP(e),S=Kt.fromTable(e).colCount;n.selection.range.isSimple()&&s(A,"top",0);for(let U=0;U<S;U++){const M=U===S-1?v[U]+2:v[U],V=B("span",["table-border-bar-cell","top"],A);l.has(U)&&V.classList.add("selected"),V.setAttribute("data-top-index",`${U}`),V.style.width=`${M}px`,n.selection.range.isSimple()&&s(A,"top",U+1)}Bf(C,E)},d=()=>{const C=i.querySelector(".table-border-bar-container.left");p(Al,C,"no left border bar container");const E=B("div",["table-border-bar-container","left"],null),A=B("div",["table-border-bar","left"],E);B("span",["table-border-bar-cell","corner"],A);const v=tR(e);n.selection.range.isSimple()&&s(A,"left",0),Array.from(e.rows).forEach((w,S,U)=>{const M=B("span",["table-border-bar-cell","left"],A);o.has(S)&&M.classList.add("selected"),M.setAttribute("data-left-index",`${S}`);const V=S===U.length-1?v[S]+2:v[S];M.style.height=`${V}px`,n.selection.range.isSimple()&&s(A,"left",S+1)}),Bf(C,E)};c(),d();const h=n.findCustom(ls(t));h&&eR(h)}function nR(n,t){const e=t.target;if(!(e instanceof Element))return;const r=et(e);p(Al,r&&fn(r),"invalid table block"),xu(n,r),n.selection.caret.update()}function og(n,t){const e=t.target;if(!(e instanceof Element))return;const r=et(e);p(Al,r&&fn(r),"invalid table block");const i=e.closest(".button-root");if(i){if(i.classList.contains("top")){const s=parseInt(i.getAttribute("data-top-index")||"0",10);ik(n,r,s),xu(n,r)}else if(i.classList.contains("left")){const s=parseInt(i.getAttribute("data-left-index")||"0",10);ME(n,r,s),xu(n,r)}}}function lg(n,t){var o;Zk(n),t.preventDefault(),t.stopPropagation();let e=null,r,i;const s=l=>{var c;if(l.target instanceof HTMLElement&&r&&e&&i!==void 0){const d=et(l.target),h=l.target.closest(".table-border-bar");if(d===e&&h){const C=parseInt((c=l.target.getAttribute(`data-${r}-index`))!=null?c:"0",10),E=Math.min(i,C),A=Math.abs(i-C)+1;Mt(l.target,"top")&&r==="top"?yP(n,d,E,A,{reverse:!0}):Mt(l.target,"left")&&r==="left"&&TP(n,d,E,A,{reverse:!0})}}l.type==="mouseup"&&(e=null,i=void 0,r=void 0,document.body.removeEventListener("mousemove",s),document.body.removeEventListener("mouseup",s))};t.target instanceof HTMLElement&&Mt(t.target,"table-border-bar-cell")&&(e=et(t.target),Mt(t.target,"top")?r="top":Mt(t.target,"left")&&(r="left"),r&&e&&(i=parseInt((o=t.target.getAttribute(`data-${r}-index`))!=null?o:"0",10),document.body.addEventListener("mousemove",s),document.body.addEventListener("mouseup",s)))}function rR(n){const t=n.selection.range,e=Cd(n,t);e&&xu(n,e)}function dV(n,t){p(Al,fn(t),"invalid table block");const e=as(n,t),r=be(t),i=B("div",["table-border-bar-container","top"],e),s=B("div",["table-border-bar-container","left"],r);xu(n,t),n.domEvents.addEventListener(zt(t),"scroll",nR),n.domEvents.addEventListener(i,"click",og),n.domEvents.addEventListener(s,"click",og),n.domEvents.addEventListener(i,"mousedown",lg),n.domEvents.addEventListener(s,"mousedown",lg),n.addListener("afterClearSelection",rR)}function iR(n,t){if(!n.isWritable())return;if(as(n,t).querySelector(".table-border-bar-container")){xu(n,t);return}dV(n,t)}function sR(n,t){p(Al,fn(t),"invalid table block");const e=as(n,t),r=be(t),i=e.querySelectorAll(".table-border-bar-container"),s=r.querySelectorAll(".table-border-bar-container");i.forEach(o=>{n.domEvents.removeEventListener(o,"click",og),n.domEvents.removeEventListener(o,"mousedown",lg),o.remove()}),s.forEach(o=>{n.domEvents.removeEventListener(o,"click",og),n.domEvents.removeEventListener(o,"mousedown",lg),o.remove()}),n.domEvents.removeEventListener(zt(t),"scroll",nR),n.addListener("afterClearSelection",rR)}function hV(n,t){p(Al,fn(t),"invalid table block");const r=as(n,t).querySelector(".table-border-bar-container.top");return r?r.getBoundingClientRect().height:0}class mV{constructor(t,e){m(this,"toolbar");m(this,"handleSelectionChange",(t,e)=>{!t.isVisible||(e==="delete-columns"?(ml(this.editor,this.tableBlock,!0,!0),gl(this.editor,this.tableBlock,!0,!0)):e==="delete-rows"?(ml(this.editor,this.tableBlock,!0,!1),gl(this.editor,this.tableBlock,!0,!1)):(ml(this.editor,this.tableBlock,!1),gl(this.editor,this.tableBlock,!1)))});m(this,"handleClick",(t,e,r)=>{e.id==="delete-columns"?EE(this.editor.selection.range):e.id==="delete-rows"&&AE(this.editor.selection.range)});m(this,"handleToolbarClose",()=>{this.tableBlock&&Cd(this.editor,this.editor.selection.range)===this.tableBlock&&(ml(this.editor,this.tableBlock,!1),gl(this.editor,this.tableBlock,!1))});this.editor=t,this.tableBlock=e;const r=t.options.componentsOptions.popover;this.toolbar=new md([],void 0,{id:"table-row-column-toolbar",overflowBoundary:r==null?void 0:r.overflowBoundary,refuseOverflow:!0,tooltipId:this.editor.clientId}),this.toolbar.addListener("selectionChange",this.handleSelectionChange),this.toolbar.addListener("click",this.handleClick),this.toolbar.addListener("close",this.handleToolbarClose)}close(){this.toolbar.close("cancelBar")}update(){var i,s,o;const{selectedColumns:t,selectedRows:e}=CE(this.editor,this.tableBlock);if(!this.editor.isWritable())return;if(t.size>0&&e.size>0){this.toolbar.close("cancelBar");return}if(t.size===0&&e.size===0){this.toolbar.close("cancelBar");return}const r=Fs(this.editor,this.tableBlock,this.editor.selection.range)[0];if(!r){this.toolbar.close("cancelBar");return}if(t.size>0){const l={id:"delete-columns",name:_.t("table.deleteSelectCol"),icon:AT};this.toolbar.updateItems([l]);const c=$s(this.editor,this.tableBlock,"table-row-column-delete",r);this.toolbar.manualShow(c,{placement:"top",offset:[0,5]})}else{const l={id:"delete-rows",name:_.t("table.deleteSelectRow"),icon:ET};this.toolbar.updateItems([l]);const h=be(this.tableBlock).querySelector(".table-border-bar-container.left").getBoundingClientRect(),C=new DOMRect(Math.max(h.left,r.left-cu),r.top,cu,r.height),E=$s(this.editor,this.tableBlock,"table-row-column-delete",C);this.toolbar.manualShow(E,{placement:"left",offset:[0,5]});const A=this.editor.options.componentsOptions.popover;(i=this.toolbar.tippyInstance)==null||i.setProps({popperOptions:{modifiers:[{name:"flip",options:{boundary:A==null?void 0:A.overflowBoundary,fallbackPlacements:["left","right"]}}]}})}(o=(s=this.toolbar.tippyInstance)==null?void 0:s.popperInstance)==null||o.update()}destroy(){this.toolbar.destroy(),this.toolbar.removeAllListeners()}}const oA=D("table-border-bar");class gV{constructor(t,e){m(this,"toolbar");m(this,"resizeObserver",null);m(this,"handleReadonlyChanged",t=>{t.isWritable()?this.update():sR(this.editor,this.tableBlock)});m(this,"handleBlockUpdated",()=>{var t;(t=this.resizeObserver)==null||t.disconnect(),setTimeout(()=>{var r;const e=this.editor.getBlockById(ut(this.tableBlock));(r=this.resizeObserver)==null||r.observe(un(e))})});m(this,"handleScroll",()=>{var t;(t=this.toolbar)==null||t.update()});m(this,"handleTableResize",()=>{!this.editor.isWritable()||this.update()});this.editor=t,this.tableBlock=e,p(oA,this.tableBlock,"no table block"),oA.debug("create table border bar"),iR(this.editor,this.tableBlock),this.resizeObserver=new Jl(this.handleTableResize),this.resizeObserver.observe(un(this.tableBlock));const r=t.getComponentOptions("table");r!=null&&r.hideToolbar||(this.toolbar=new mV(this.editor,this.tableBlock)),this.editor.addListener("readonlyChanged",this.handleReadonlyChanged)}close(){var t;(t=this.toolbar)==null||t.close()}destroy(){var t,e;oA.debug("destroy table border bar"),(t=this.resizeObserver)==null||t.disconnect(),this.resizeObserver=null,sR(this.editor,this.tableBlock),(e=this.toolbar)==null||e.destroy(),this.editor.removeListener("readonlyChanged",this.handleReadonlyChanged)}update(){var t;iR(this.editor,this.tableBlock),(t=this.toolbar)==null||t.update()}}const pV=D("table-border-bar");class CV{constructor(t){m(this,"activeTableBar",null);m(this,"handleBlockDeleted",(t,e)=>{!this.activeTableBar||(e===this.activeTableBar.tableBlock||Ce(e,this.activeTableBar.tableBlock))&&(this.activeTableBar.destroy(),this.activeTableBar=null)});m(this,"handleSelectionChanged",t=>{setTimeout(()=>{var i;const e=t.selection.range,r=Cd(t,e);((i=this.activeTableBar)==null?void 0:i.tableBlock)!==r&&this.activeTableBar&&this.hide(),r&&this.show(r)})});m(this,"handleScroll",()=>{var t;(t=this.activeTableBar)==null||t.handleScroll()});m(this,"isInBlock",(t,e)=>!!(e.target instanceof Element&&e.target.closest('[data-command-bar-id="table-row-column-toolbar"]')));this.editor=t,this.editor.addListener("blockDeleted",this.handleBlockDeleted),this.editor.addListener("selectionChanged",this.handleSelectionChanged),$e.get(t).addFilter(this)}destroy(){var t;this.editor.removeListener("blockDeleted",this.handleBlockDeleted),this.editor.removeListener("selectionChanged",this.handleSelectionChanged),(t=this.activeTableBar)==null||t.destroy()}show(t){this.activeTableBar?(this.activeTableBar.tableBlock!==t&&this.hide(),this.activeTableBar.update()):this.activeTableBar=new gV(this.editor,t)}update(){var t;(t=this.activeTableBar)==null||t.handleBlockUpdated()}closeToolbar(){var t;(t=this.activeTableBar)==null||t.close()}hide(){!this.activeTableBar||(p(pV,this.activeTableBar,"no active table bar"),this.activeTableBar.destroy(),this.activeTableBar=null)}}function oR(n,t){const e=n.addCustom("table-border-bar",r=>new CV(r));t==="update"&&e.update()}const ur=D("table-cell-menu"),EV="style-bg-color-";class AV{constructor(t){m(this,"activeTableBlock",null);m(this,"targetButton",null);m(this,"manualMenu",null);m(this,"colorPaletteItem",null);m(this,"markedRowAsDanger",!1);m(this,"markedColAsDanger",!1);m(this,"resetAsDangerMarked",()=>{this.markedColAsDanger=!1,this.markedRowAsDanger=!1});m(this,"handlePrevent",(t,e)=>{e.stopPropagation()});m(this,"handleReadonlyChanged",t=>{t.isWritable()||this.hide()});m(this,"handleSelectionChanged",t=>{const e=t.selection.range,r=Cd(t,e);if(this.hide(),this.activeTableBlock!==r&&(this.activeTableBlock=r),this.activeTableBlock){const i=Kt.fromBlock(this.activeTableBlock),s=e.isReverse()?e.start:e.end;let o=null;s instanceof Ai?t.getBlockById(s.blockId)===this.activeTableBlock?o=i.getCellByContainerId(s.childContainerId):o=this.getCellByChildBlockId(i,s.blockId):s.blockId!==this.activeTableBlock.id&&(o=this.getCellByChildBlockId(i,s.blockId)),o&&this.editor.isWritable()&&this.showCellMenuButton(o)}});m(this,"handleBeforePopupPalette",()=>{var e;const t=this.getSelectedBkgColorIndex();(e=this.colorPaletteItem)==null||e.palette.setColor("backgroundColor",t)});m(this,"createBkgColorItem",()=>{const t=B("div",["cell-background-color-item"],null);B("span",[],t,_.t("table.cellBackground"));const e=this.getSelectedBkgColorIndex();B("button",["item-button"],t).setAttribute("data-color-index",`${e}`);const i=B("span",["item-sub-indicator"],t);return i.innerHTML=QC,t});m(this,"handleCommand",t=>{var i;p(ur,this.activeTableBlock,"no target table block");const e=((i=t.states)==null?void 0:i.includes("checked"))||!1,r=t.value;switch(t.id){case"delete-select-row":AE(F2(this.editor,this.activeTableBlock,!1));break;case"delete-select-col":EE(F2(this.editor,this.activeTableBlock,!0));break;case"merge-cell":O2(this.editor.selection.range);break;case"split-cell":this.handleSplitCell();break;case"row-title":this.handleRowTitle(e);break;case"col-title":this.handleColTitle(e);break;case"stripe-style":this.handleStripeStyle(e);break;case"hide-border":MN(this.editor,this.activeTableBlock,r==="show-border");break;case"show-chart":NN(this.editor,this.activeTableBlock,r==="show-chart"),kE(this.editor,this.activeTableBlock,{updateNow:!0});break}});m(this,"handleToolbarClose",()=>{this.targetButton&&ct(this.targetButton,"active"),(this.markedRowAsDanger||this.markedColAsDanger)&&this.activeTableBlock&&Cd(this.editor,this.editor.selection.range)===this.activeTableBlock&&(ml(this.editor,this.activeTableBlock,!1),gl(this.editor,this.activeTableBlock,!1),this.resetAsDangerMarked()),this.editor.focus()});m(this,"handleSelectionChange",(t,e)=>{if(!!t.isVisible)if(p(ur,this.activeTableBlock,"no target table block"),e==="cell-background-color"&&this.handleBeforePopupPalette(),e==="delete-select-row"){if(this.markedRowAsDanger)return;ml(this.editor,this.activeTableBlock,!0,!1),gl(this.editor,this.activeTableBlock,!0,!1),this.resetAsDangerMarked(),this.markedRowAsDanger=!0}else if(e==="delete-select-col"){if(this.markedColAsDanger)return;ml(this.editor,this.activeTableBlock,!0,!0),gl(this.editor,this.activeTableBlock,!0,!0),this.resetAsDangerMarked(),this.markedColAsDanger=!0}else ml(this.editor,this.activeTableBlock,!1),gl(this.editor,this.activeTableBlock,!1),this.resetAsDangerMarked()});m(this,"handleClick",(t,e)=>{var r;p(ur,this.activeTableBlock,"no target table block"),p(ur,this.targetButton,"no target button"),Zk(this.editor),Mt(this.targetButton,"active")?(ct(this.targetButton,"active"),(r=this.manualMenu)==null||r.close("clickItem")):(q(this.targetButton,"active"),this.manualMenu?this.manualMenu.updateItems(this.createCommandMenu()):(this.manualMenu=new dl(this.createCommandMenu(),void 0,{id:"table-cell-menu"}),this.manualMenu.on("click",(i,s)=>{var o;this.handleCommand(s),(o=this.manualMenu)==null||o.close("clickItem")}),this.manualMenu.on("selectionChange",this.handleSelectionChange),this.manualMenu.on("close",this.handleToolbarClose)),this.manualMenu.manualShow(this.targetButton,{placement:"right-start"})),e.stopPropagation()});this.editor=t,this.editor.addListener("selectionChanged",this.handleSelectionChanged),this.editor.addListener("readonlyChanged",this.handleReadonlyChanged)}destroy(){var t,e;this.activeTableBlock=null,this.targetButton=null,this.editor.removeListener("selectionChanged",this.handleSelectionChanged),this.editor.removeListener("readonlyChanged",this.handleReadonlyChanged),(t=this.manualMenu)==null||t.destroy(),(e=this.colorPaletteItem)==null||e.destroy()}hide(){var t;(t=this.manualMenu)==null||t.close("cancelBar"),this.targetButton&&(ct(this.targetButton,"active"),this.targetButton.style.display="none")}getCellByChildBlockId(t,e){let r=this.editor.getBlockById(e);for(;r;){const i=r.closest("td");p(ur,i,"no parent cell");const s=et(i);if(p(ur,s,"no parent block"),un(s)===t.table)return t.getCellByCellElement(i);r=s}return p(ur,!1,"filed to get cell by child block id"),null}createTargetButton(t){this.targetButton?t.querySelector(`:scope > .${yE}`)||t.appendChild(this.targetButton):(this.targetButton=B("button",[yE],t),this.targetButton.innerHTML=A0,this.editor.domEvents.addEventListener(this.targetButton,"click",this.handleClick),this.editor.domEvents.addEventListener(this.targetButton,"mousedown",this.handlePrevent),this.editor.domEvents.addEventListener(this.targetButton,"dblclick",this.handlePrevent))}showCellMenuButton(t){this.createTargetButton(t.cell),p(ur,this.targetButton,"no target button"),this.targetButton.style.display="inline-block"}handleSplitCell(){if(this.activeTableBlock){const t=Kt.fromBlock(this.activeTableBlock),e=this.editor.selection.range;if(e.isSimple()){const{col:r,row:i}=this.getCellByChildBlockId(t,e.start.blockId);bE(this.editor,this.activeTableBlock,{col:r,row:i})}else vE(this.editor.selection.range)}}getSelectedBkgColorIndex(){var o;p(ur,this.activeTableBlock,"no target table block");const t=this.editor.selection.range,e=hl(this.editor,this.activeTableBlock,t.focus),r=this.editor.getBlockData(this.activeTableBlock),i=e.childContainerId,s=r[`${i}_background`];return s?Number.parseInt((o=s.substring(EV.length))!=null?o:"0",10):-1}createCommandMenu(){p(ur,this.activeTableBlock,"no target table block");const t=this.editor.getBlockData(this.activeTableBlock),e=U2(this.editor,this.activeTableBlock,this.editor.selection.range);let r=this.editor.selection.range;if(r.isSimple()){const h=hl(this.editor,this.activeTableBlock,r.start);r=pn(this.editor,{anchor:h,focus:h})}const i=M2(this.editor,this.activeTableBlock,r),s=t.hasRowTitle,o=t.hasColTitle,l=t.isStripeStyle,c=t.noBorder,d=t.chart;return this.colorPaletteItem=new R2("cell-background-color",{color:!1}),this.colorPaletteItem.palette.on("onClick",(h,C)=>{var E;switch(p(ur,this.activeTableBlock,"no target table block"),h){case"clearColor":$2(this.editor,this.activeTableBlock,-1);break;case"backgroundColor":$2(this.editor,this.activeTableBlock,C);break}(E=this.manualMenu)==null||E.close("clickItem")}),[{id:"cell-background-color",name:_.t("table.cellBackground"),element:this.createBkgColorItem(),children:[this.colorPaletteItem]},{id:"separator",name:"",type:"separator"},{id:"merge-cell",name:_.t("table.mergeCell"),states:e?[]:["disabled"]},{id:"split-cell",name:_.t("table.splitCell"),states:i?[]:["disabled"]},{id:"separator",name:"",type:"separator"},{id:"delete-select-row",name:_.t("table.deleteSelectRow")},{id:"delete-select-col",name:_.t("table.deleteSelectCol")},{id:"separator",name:"",type:"separator"},{id:"table-config",name:_.t("table.tableConfigKey"),children:[{id:"row-title",name:_.t("table.tableConfig.rowTitle"),states:s?["checked"]:[]},{id:"col-title",name:_.t("table.tableConfig.colTitle"),states:o?["checked"]:[]},{id:"stripe-style",name:_.t("table.tableConfig.stripeStyle"),states:l?["checked"]:[]},{id:"hide-border",name:c?_.t("table.tableConfig.showBorder"):_.t("table.tableConfig.hideBorder"),value:c?"show-border":"hide-border"},{id:"show-chart",name:d?_.t("table.tableConfig.hideChart"):_.t("table.tableConfig.showChart"),value:d?"hide-chart":"show-chart"}]}]}handleRowTitle(t){p(ur,this.activeTableBlock,"no target table block"),t?IN(this.editor,this.activeTableBlock):LN(this.editor,this.activeTableBlock)}handleColTitle(t){p(ur,this.activeTableBlock,"no target table block"),t?SN(this.editor,this.activeTableBlock):wN(this.editor,this.activeTableBlock)}handleStripeStyle(t){p(ur,this.activeTableBlock,"no target table block"),t?_N(this.editor,this.activeTableBlock):DN(this.editor,this.activeTableBlock)}}function lR(n){n.addCustom("table-cell-menu",t=>new AV(t))}const aR=D("table-container");function lA(n){const t=n.closest("td");return p(aR,t,"no parent cell for a table cell container"),t}function cR(n){const t=un(n);return Array.from(t.querySelectorAll(':scope > tbody > tr > td > [data-type="editor-container"].child'))}function aA(n,t,e,r){const i=Kt.fromBlock(n),s=i.getCellByContainerId(pt(t));if(e==="ArrowDown"){const o=i.getBottomCell(s);return o?o.container:null}if(e==="ArrowUp"){const o=i.getTopCell(s);return o?o.container:null}if(e==="ArrowLeft"){const o=i.getLeftCell(s);if(!o)return null;const l=o.container;return r!=null&&r.noWrap&&o.row!==s.row?null:l}if(e==="ArrowRight"){const o=i.getRightCell(s);if(!o)return null;const l=o.container;return r!=null&&r.noWrap&&o.row!==s.row?null:l}p(aR,!1,`invalid navigation type: ${e}`)}const xV=12,bV=90,ag=23,uR=2;class vV{constructor(t){m(this,"scrollTableBlock",null);m(this,"autoScrollDir",null);m(this,"autoScrollTimer",null);m(this,"handleMouseDown",t=>{const e=Pe(t.clientX,t.clientY,{noFilter:!0});if(e&&e instanceof HTMLElement){const r=et(e);if(r&&Ce(this.editor.rootContainer,r)){const i=no(r);i&&(this.scrollTableBlock=i,document.addEventListener("mousemove",this.handleAutoScroll))}}});m(this,"handleAutoScroll",f9.default(t=>{if(this.scrollTableBlock){const e=this.editor.getCustom(ls(this.scrollTableBlock)),r=e.rootElement,i=e.scrollOptions.parentContainer,s=r.getBoundingClientRect(),o=window.innerHeight-this.getBarFloatWindowBottom(e),l=i.getBoundingClientRect(),c=Math.min(l.bottom,o),d=Math.max(l.top,0);s.bottom>c&&t.clientY>=c?this.setAutoScroll("bottom"):s.top<d&&t.clientY<=d?this.setAutoScroll("top"):r.scrollLeft>0&&t.clientX<s.left?this.setAutoScroll("left"):r.scrollLeft<r.scrollWidth-r.offsetWidth&&t.clientX>s.right?this.setAutoScroll("right"):this.clearAutoScroll()}},15));m(this,"handleMouseUp",()=>{document.removeEventListener("mousemove",this.handleAutoScroll),setTimeout(()=>{this.scrollTableBlock=null})});m(this,"handleSelectionChanged",t=>{const e=t.selection.range;if(e.isCollapsed()&&e.isSimple()){const r=t.getBlockById(e.start.blockId),i=no(r);if(i){const s=t.getCustom(ls(i)),o=s.rootElement.getBoundingClientRect(),l=Zo(t,r,e.start);if(o.left>l.left){const c=e.start.offset===0?xV:uR;s.rootElement.scrollLeft-=o.left-l.left+c}else if(l.right>o.right){const c=e.start.offset===0?bV:uR;s.rootElement.scrollLeft+=l.right-o.right+c}}}else{const r=t.getBlockById(e.start.blockId),i=no(r),s=t.getBlockById(e.end.blockId),o=no(s);if(i&&i===o){const l=t.getCustom(ls(i)),c=l.rootElement.getBoundingClientRect();let d=null;if(e.isSimple())d=e.isReverse()?Zo(t,r,e.start):Zo(t,s,e.end);else{const h=lA(pi(t,e.start.childContainerId)),C=lA(pi(t,e.end.childContainerId));d=e.isReverse()?h.getBoundingClientRect():C.getBoundingClientRect()}c.left>d.left&&e.isReverse()?l.rootElement.scrollLeft-=c.left-d.left:c.right<d.right&&!e.isReverse()&&(l.rootElement.scrollLeft+=d.right-c.right)}}});m(this,"handleScroll",t=>{I2(t),this.editor.selection.caret.update()});m(this,"handleReset",t=>{I2(t),this.editor.selection.caret.update();const e=this.editor.findCustom("table-border-bar");e&&e.handleScroll(),eR(t)});this.editor=t,this.editor.addListener("selectionChanged",this.handleSelectionChanged),document.addEventListener("mousedown",this.handleMouseDown),document.addEventListener("mouseup",this.handleMouseUp)}getBarFloatWindowBottom(t){return t.scrollOptions.barFloatWindowBottom?typeof t.scrollOptions.barFloatWindowBottom=="number"?t.scrollOptions.barFloatWindowBottom:t.scrollOptions.barFloatWindowBottom():0}clearAutoScroll(){this.autoScrollTimer&&(clearInterval(this.autoScrollTimer),this.autoScrollTimer=null,this.autoScrollDir=null)}setAutoScroll(t){this.autoScrollDir&&this.autoScrollDir!==t&&this.clearAutoScroll(),this.autoScrollTimer||(this.autoScrollDir=t,this.autoScrollTimer=window.setInterval(()=>{if(this.scrollTableBlock){const e=this.editor.getCustom(ls(this.scrollTableBlock)),r=e.rootElement,i=e.scrollOptions.parentContainer,s=r.getBoundingClientRect(),o=i===document.documentElement?window.innerHeight:i.offsetHeight,l=window.innerHeight-this.getBarFloatWindowBottom(e),c=i.getBoundingClientRect(),d=Math.min(c.bottom,l),h=Math.max(c.top,0);this.autoScrollDir==="left"&&(r.scrollLeft-=ag,r.scrollLeft<=0&&this.clearAutoScroll()),this.autoScrollDir==="right"&&(r.scrollLeft+=ag,r.scrollLeft>=r.scrollWidth-r.offsetWidth&&this.clearAutoScroll()),this.autoScrollDir==="bottom"&&(i.scrollTop+=ag,(i.scrollTop>=i.scrollHeight-o||s.bottom<=d)&&this.clearAutoScroll()),this.autoScrollDir==="top"&&(i.scrollTop-=ag,(i.scrollTop<=0||s.top>=h)&&this.clearAutoScroll())}},100))}destroy(){document.removeEventListener("mousedown",this.handleMouseDown),document.removeEventListener("mouseup",this.handleMouseUp),this.editor.removeListener("selectionChanged",this.handleSelectionChanged)}}function fR(n){return n.addCustom("table-scroll-events",t=>new vV(t))}const BV=D("table-doc-change-handler");class yV{constructor(t){this.editor=t,this.editor.addListener("docChanged",this.handleDocChanged)}handleDocChanged(t,e){if(!e){const{start:r,end:i}=t.selection.range;if(!t.findBlockById(r.blockId)||!t.findBlockById(i.blockId)){t.selection.selectBlock(t.getBlockByIndex("root",0),0);return}if(da(r)){const s=t.getBlockById(r.blockId);if(!fn(s))return;if(p(BV,da(i),"invalid range"),!Rf(t,r.childContainerId)||!Rf(t,i.childContainerId)){t.selection.selectBlock(s,0);return}let o=null,l=null;const c=(d,h)=>{const C=h.getCellById(d.childContainerId),{colIndex:E=0,rowIndex:A=0}=d.custom;let v=-1,w=-1;return(C.col>E||C.col+C.colSpan-1<E)&&(v=C.col),(C.row>A||C.row+C.rowSpan-1<A)&&(w=C.row),v!==-1||w!==-1?Me(s,d.childContainerId,{colIndex:v===-1?E:v,rowIndex:w===-1?A:w}):null};if(r.custom){const d=Kt.fromBlock(s);o=c(r,d),l=c(i,d)}(o!==null||l!==null)&&(t.selection.range.isReverse()?t.selection.setSelection(l!=null?l:i,o!=null?o:r):t.selection.setSelection(o!=null?o:r,l!=null?l:i))}}}destroy(){this.editor.removeListener("docChanged",this.handleDocChanged)}}function dR(n){n.addCustom("table-doc-change-handler",t=>new yV(t))}const us=D("create-content");function hR(n,t,e){var C;const r=new M0(e),i=e.rows,s=e.cols;p(us,i>=1,`invalid rows: ${i}`),p(us,s>=1,`invalid cols: ${s}`),p(us,e.children,"no table children");const o=B("table",[],null),l=(C=e.colsWidth)!=null?C:new Array(e.cols).fill(0),c=B("colgroup",[],o);for(let E=0;E<r.colCount;E++){const A=B("col",[],c);l[E]&&(A.style.width=`${l[E]}px`,A.style.minWidth=`${l[E]}px`)}const d=B("tbody",[],o);let h=0;for(let E=0;E<i;E++){const A=B("tr",[],d);for(let v=0;v<s;v++){const w=r.getCell({col:v,row:E});if(w.virtual)p(us,w.colSpan>1||w.rowSpan>1,"virtual cell should have colSpan or rowSpan");else{const S=e.children[h],U=B("td",[],A);w.colSpan>1&&(U.colSpan=w.colSpan),w.rowSpan>1&&(U.rowSpan=w.rowSpan);const M=e[xd(S)];M&&q(U,M),v===0&&e.hasColTitle&&q(U,N2.COL_TITLE_ITEM),n.createChildContainer(t,U,S),h+=1}}}return p(us,h===e.children.length,"container count mismatch"),o.style.minWidth=`${l.reduce((E,A)=>A+E,0)}px`,e.noBorder&&q(o,"no-border"),e.chart&&q(o,"editor-table-chart"),e.isStripeStyle&&q(o,"stripe"),e.hasRowTitle&&q(o,"row-title"),e.hasColTitle&&q(o,"col-title"),o}function TV(n,t,e,r,i){p(us,i.type==="table","not table data"),p(us,pt(e)===t[t.length-1].containerId,"invalid path");const s=i,o=ua(r,"div");try{const l=B("div",[],null);l.setAttribute("data-type","table-content");const c=hR(n,t,s);c.classList.add("drag-preview-element"),l.appendChild(c);const d=n.getComponentOptions("table");nk(n),sk(n),oR(n,"create"),dR(n),d!=null&&d.hideCellMenu||lR(n),mT(n,RE);const h=n.addCustom(ls(r),()=>aP());h.init({parentElement:o,childElement:l,safeRightSpace:50,safeLeftSpace:40,parentContainer:re(e)?n.scrollContainer:e,locatingContainer:re(e)?(d==null?void 0:d.locatingContainer)||n.parent:e,paddingLeft:cu+Ad,paddingTop:cu+Ad,paddingBottom:Ad/2,paddingRight:Ad/2,barFloatWindowBottom:d==null?void 0:d.barFloatWindowBottom,allowScrollBarFixed:d==null?void 0:d.allowScrollBarFixed,isSetScale:d==null?void 0:d.isSetScale});const C=fR(n);h.on("scroll",C.handleReset),h.on("resize",C.handleReset),setTimeout(()=>{KN(n,r)})}catch{const c=`invalid table data: ${JSON.stringify(s)}`;us.error(c);const d=B("div",["error"],o);d.innerText=c}return o}function kV(n,t,e){p(us,e.type==="table","not table data");const r=e,i=zt(t);try{const s=un(t),o=tl(t),l=hR(n,o,r);l.classList.add("drag-preview-element"),s.insertAdjacentElement("afterend",l),s.remove();const c=n.getComponentOptions("table");nk(n),sk(n),oR(n,"update"),dR(n),c!=null&&c.hideCellMenu||lR(n),RE(n,void 0,t)}catch{const o=`invalid table data: ${JSON.stringify(r)}`;us.error(o);const l=B("div",["error"],i);l.innerText=o}}function RV(n,t){let e,r,i=!1;if([...t].every(E=>E==="|")?(r=t.length,e=Array(r).fill(""),i=!0):(e=Fp(t,"|").split("|"),r=e.length),r<2)return null;const s=3,o=r,l=[];for(let E=0;E<3;E++)e.forEach(A=>{l.push(qs(n.doc,E===0?A:""))});const c=Array(o).fill(LE),d=l[i?0:o],h=n.doc.getContainerBlocks(d)[0].id;return{blockData:{id:it(),type:"table",rows:s,cols:o,children:l,colsWidth:c},focusBlockId:h}}function wV(n,t){const e=t.rows,r=t.cols;if(e<1||r<1)return null;const i=[];for(let d=0;d<e;d++)for(let h=0;h<r;h++)i.push(qs(n.doc));const s=Array(r).fill(LE),o=i[0],l=n.doc.getContainerBlocks(o)[0].id;return{blockData:{id:it(),type:"table",rows:e,cols:r,children:i,colsWidth:s},focusBlockId:l}}const cA=D("get-selected-containers");function mR(n,t,e,r){p(cA,e.blockId===r.blockId,"only allow select in single table block"),p(cA,ut(t)===e.blockId,"only allow select in single table block");const i=Kt.fromBlock(t),s=i.getCellByContainerId(e.childContainerId),o=i.getCellByContainerId(r.childContainerId);if(e.custom===void 0||r.custom===void 0)return i.getCells(s,o).map(S=>i.getCellContainer(S));const{fromCol:l,toCol:c,fromRow:d,toRow:h}=Si(t,e,r),C=new Set,E=[];return i.sub({row:d,col:l},{row:h,col:c}).forEach(v=>{v.forEach(w=>{const S=i.getCellByContainerId(w.containerId);S.col<l||S.row<d||S.col+S.colSpan-1>c||S.row+S.rowSpan-1>h||C.has(w.containerId)||(C.add(w.containerId),E.push(S.container))})}),E}function SV(n,t,e){p(cA,t.blockId===e.blockId,"only allow select in single table block");const r=n.getBlockById(t.blockId);return mR(n,r,t,e)}const gR=D("table-selection-to-doc");function LV(n,t){const{start:e,end:r,block:i}=t,s=Ot(i);p(gR,s==="table",`invalid block type: ${s}`);const o=n.getBlockData(i);if(e.isSimple()&&r.isSimple())return sl(n.editorBlocks,n.doc.toJSON(),o);p(gR,!e.isSimple()&&!r.isSimple(),"invalid block pos type");const l=Kt.fromBlock(i),{fromCol:c,toCol:d,fromRow:h,toRow:C}=Si(i,e,r),E={},A=[],v=n.doc.toJSON();let w={};l.sub({row:h,col:c},{row:C,col:d}).forEach((X,ft)=>{X.forEach((xt,bt)=>{const wt=xt.containerId;if(A.indexOf(wt)!==-1)return;A.push(wt);let Tt;if(xt.virtual){const fe=l.getCellByContainerId(xt.containerId),Lr=c+bt;let fr=fe.col+fe.colSpan-1;fr>d&&(fr=d);const je=fr-Lr+1;je>1&&(E[`${wt}_colSpan`]=je);const yn=h+ft;let Zn=fe.row+fe.rowSpan-1;Zn>C&&(Zn=C);const dr=Zn-yn+1;dr>1&&(E[`${wt}_rowSpan`]=dr),Tt=Ws()}else{if(Tt=sC(n.editorBlocks,v,wt),xt.col+xt.colSpan>d+1){const fe=d-xt.col+1;fe>1&&(E[`${wt}_colSpan`]=fe)}else xt.colSpan>1&&(E[`${wt}_colSpan`]=xt.colSpan);if(xt.row+xt.rowSpan>C+1){const fe=C-xt.row+1;fe>1&&(E[`${wt}_rowSpan`]=fe)}else xt.rowSpan>1&&(E[`${wt}_rowSpan`]=xt.rowSpan)}const{root:ie,...Ee}=Tt.blocks;w={...w,...Ee,[wt]:ie}})});const U=Td(un(i)).slice(c,d+1);return{blocks:{root:[{id:it(),type:s,children:A,colsWidth:U,rows:C-h+1,cols:d-c+1,...E}],...w},meta:{},comments:{}}}const IV=D("ajust-selection-pos");function DV(n,t){if(t.top===0)return!0;for(let e=t.left;e<=t.right;e++)if(n[t.top-1][e]===n[t.top][e])return!1;return!0}function _V(n,t){if(t.left===0)return!0;for(let e=t.top;e<=t.bottom;e++)if(n[e][t.left-1]===n[e][t.left])return!1;return!0}function MV(n,t){if(t.bottom===n.length-1)return!0;for(let e=t.left;e<=t.right;e++)if(n[t.bottom][e]===n[t.bottom+1][e])return!1;return!0}function UV(n,t){if(t.right===n[0].length-1)return!0;for(let e=t.top;e<=t.bottom;e++)if(n[e][t.right]===n[e][t.right+1])return!1;return!0}function OV(n,t,e){const r=t.col,i=t.row,s=e.col,o=e.row,l={left:r,top:i,right:s,bottom:o};let c=!1;do{if(c=!1,!DV(n,l)){l.top--,c=!0;continue}if(!_V(n,l)){l.left--,c=!0;continue}if(!MV(n,l)){l.bottom++,c=!0;continue}if(!UV(n,l)){l.right++,c=!0;continue}}while(c);return l}function NV(n,t,e,r){if(e.custom!==void 0||r.custom!==void 0)return{anchor:e,focus:r};const i=Kt.fromBlock(t),s=i.map(V=>V.containerId),o=i.getCellByContainerId(e.childContainerId),l=i.getCellByContainerId(r.childContainerId),c=Math.min(o.row,l.row),d=Math.max(o.row,l.row),h=Math.min(o.col,l.col),C=Math.max(o.col,l.col),E=OV(s,{row:c,col:h},{row:d,col:C}),A=i.getCell({row:E.top,col:E.left}),v=i.getCell({row:E.bottom,col:E.right}),w=i.getCell({row:E.top,col:E.right}),S=i.getCell({row:E.bottom,col:E.left});let U,M;return o.row<=l.row?o.col<=l.col?(U=A,M=v):(U=w,M=S):o.col<l.col?(U=S,M=w):(U=v,M=A),IV.debug(`move ${U.col}, ${U.row}, -> ${M.col}, ${M.row}`),{anchor:Me(t,U.containerId),focus:Me(t,M.containerId)}}function pR(n,t,e){if(e.isSimple())return[un(t).getBoundingClientRect()];const r=un(t),i=r.getBoundingClientRect(),{fromCol:s,fromRow:o,toCol:l,toRow:c}=Si(t,e.start,e.end),d=Td(r),h=d.slice(0,s).reduce((w,S)=>w+S,0),C=h+d.slice(s,l+1).reduce((w,S)=>w+S,0),E=tR(r);let A=E.slice(0,o).reduce((w,S)=>w+S,0);const v=A+E.slice(o,c+1).reduce((w,S)=>w+S,0);if(o===0){const w=hV(n,t);A-=w}return[new DOMRect(i.left+h,i.top+A,C-h,v-A)]}D("table-size");const PV=40;function cg(n){const t=n.querySelector("td");if(!t)return 0;const e=window.getComputedStyle(t),r=Number.parseInt(e.borderLeft,10),i=Number.parseInt(e.borderRight,10);return(r+i)/2}function FV(n,t,e){const r=m1(n,e.container);return r!==void 0?r+cg(t):PV*e.colSpan-cg(t)}function KV(n,t,e,r){let i=0;const s=e.colCount;for(let o=0;o<s;o++){const l=e.getCell({col:o,row:r});if(l.virtual)continue;let c=FV(n,t,l);const d=oB(l.container,{withPadding:!0});d&&d>c&&(c=d),i+=c+cg(t)}return i}function VV(n,t){const e=un(t),r=Kt.fromTable(e);let i=0;for(let o=0;o<r.rowCount;o++)i=Math.max(i,KV(n,e,r,o));const s=cg(e);return i+=s,i}const ro=D("table-creator");async function $V(n,t){return n.undoManager.runInGroup(()=>{var d,h;const e=t.item,r=(d=e.colCount)!=null?d:5,i=(h=e.rowCount)!=null?h:3,s=wV(n,{cols:r,rows:i});if(!s)return null;const{blockData:o,focusBlockId:l}=s,c=n.insertBlock(t.containerId,t.blockIndex,o,Ue(n,l,0));return n.focus(),c})}class HV{constructor(){m(this,"id","insert-table");m(this,"name","Create table");m(this,"element");m(this,"closeable",null);m(this,"colCount");m(this,"rowCount");m(this,"setCloseable",t=>{this.closeable=t});m(this,"destroy",()=>{this.closeable=null});m(this,"getTableCreatorCellId",(t,e)=>`table-creator-cell-${t}-${e}`);m(this,"handleTableCreatorClick",t=>{var E,A;t.preventDefault(),t.stopPropagation();const e=t.target;p(ro,e instanceof HTMLElement,"invalid event target");const r=e.closest(".table-creator");p(ro,r,"no table creator");const i=r.querySelectorAll(".active");if(i.length===0)return;const o=i[i.length-1].id;p(ro,o,"no cell id");const l="table-creator-cell-";if(!o.startsWith(l))return;const d=o.substring(l.length).split("-");p(ro,d.length===2,"invalid cell id");const h=Number.parseInt(d[0],10)+1,C=Number.parseInt(d[1],10)+1;ro.debug(`${h}, ${C}`),this.colCount=C,this.rowCount=h,(E=this.closeable)==null||E.click(this,this.element),(A=this.closeable)==null||A.close("clickItem"),this.handleTableCreatorLeave()});m(this,"handleTableCreatorLeave",()=>{for(let t=0;t<9;t++)for(let e=0;e<9;e++){const r=this.getTableCreatorCellId(t,e),i=document.getElementById(r);i&&ct(i,"active")}});m(this,"handleTableCreatorCellEnter",t=>{const e=t.target;p(ro,e instanceof HTMLElement,"invalid event target");const r=e.id,i="table-creator-cell-";p(ro,r.startsWith(i),"invalid cell id");const o=r.substring(i.length).split("-");p(ro,o.length===2,"invalid cell id");let l=Number.parseInt(o[0],10),c=Number.parseInt(o[1],10);l===0&&c===0&&(l=-1,c=-1);for(let d=0;d<9;d++)for(let h=0;h<9;h++){const C=this.getTableCreatorCellId(d,h),E=document.getElementById(C);p(ro,E,"no cell"),d<=l&&h<=c?q(E,"active"):ct(E,"active")}});this.element=this.createTableCreatorElement()}createTableCreatorElement(){const t=B("div",["table-creator"],null),e=(r,i,s)=>{const o=B("div",["table-creator-cell"],r);return o.id=this.getTableCreatorCellId(i,s),o};t.addEventListener("click",this.handleTableCreatorClick),t.addEventListener("mouseleave",this.handleTableCreatorLeave);for(let r=0;r<9;r++){const i=B("div",["table-creator-row"],t);for(let s=0;s<9;s++)e(i,r,s).addEventListener("mouseenter",this.handleTableCreatorCellEnter)}return t}}function jV(){return new HV}function zV(n){const t=/[\u4e00-\u9fff\u3040-\u309f\u30a0-\u30ff\uac00-\ud7af]/g,e=n.match(t);return e?e.length:0}function CR(n){const t=zV(n);return n.length+t}function GV(n,t,e=[]){let r=0;if(!e||e.length===0)return r;for(let i=n;i<n+t;i+=1)r+=e[i]||0;return r}function WV(n,t){const e=CR(n),r=t-e;return r>0?n+" ".repeat(r):n}function qV(n,t,e,r,i){var l;const s=t,o=new M0(s);if(r==="markdown"||r==="text"){const c=U=>e.blocks[U].map((nt,Y)=>r==="markdown"?Gm(n,nt,e,[...i,{containerId:U,blockIndex:Y}]):zm(n,nt,e,[...i,{containerId:U,blockIndex:Y}])),d=U=>c(U).join(" ").replace(/\n/g," ").trim(),h=new Map,C=new Map;for(let U=0;U<o.colCount;U++){let M=0;for(let V=0;V<o.rowCount;V++){const nt=o.getCell({row:V,col:U});let Y="";nt.virtual||(Y=d(nt.containerId)),h.set(`${V},${U}`,Y),M=Math.max(M,CR(Y))}C.set(U,M)}const E=U=>{const M=h.get(`${U.row},${U.col}`)||"",V=C.get(U.col)||0;return WV(M,V)};if(r==="text"){const U=[];for(let M=0;M<o.colCount;M++){const V=E({row:0,col:M});U.push(V)}for(let M=1;M<o.rowCount;M++)for(let V=0;V<o.colCount;V++){const nt=E({row:M,col:V});U.push(nt)}return U.join(`
643
643
  `)}const A=[];let v="|",w="|";for(let U=0;U<o.colCount;U++){const M=E({row:0,col:U});v+=` ${M} |`;const V="-".repeat((C.get(U)||0)+2);w+=`${V}|`}A.push(v),A.push(w);for(let U=1;U<o.rowCount;U++){let M="|";for(let V=0;V<o.colCount;V++){const nt=E({row:U,col:V});M+=` ${nt} |`}A.push(M)}return`${A.join(`
644
644
  `)}
645
645
  `}if(r==="html"){const c=C=>e.blocks[C].map((v,w)=>X1(n,v,e,[...i,{containerId:C,blockIndex:w}])).join(`
@@ -954,10 +954,10 @@ ${o}
954
954
  <add as="fillColor" value="#ffffff"/>
955
955
  </add>
956
956
  </mxStylesheet>
957
- `,vS=0,NQ=30*1e3,BS="editor-empty-drawio",yS="show-full-screen-iframe",Cn=D("embed-block-drawio");function Du(n){return n.options.componentsOptions.drawIO||{}}function PQ(n){const e=Du(n).lang;return e?IQ[e]:""}function FQ(n){var i;const e=((i=(Du(n)||{}).cdn)==null?void 0:i.drawioIframe)||DQ,r=PQ(n);return Vp(e,{spin:1,proto:"json",configure:1,lang:r})}function KQ(n){const t=()=>{p(Cn,n,"el does not exist");const r=document.body.clientWidth||document.documentElement.clientWidth,i=document.body.clientHeight||document.documentElement.clientHeight;n.setAttribute("width",`${r-2*vS}`),n.setAttribute("height",`${i-2*vS}`)},e=()=>{window.removeEventListener("resize",t)};return t(),window.addEventListener("resize",t),{disconnect:e}}async function VQ(n,t){const r=(Du(n)||{}).callbacks||{},i=n.getCustom(Pg),s=new ES(n),{onCreateDrawIoFrame:o,onCloseDrawIoFrame:l}=r;let c=null,d;if(o)c=await o(n),p(Cn,c,"iframe create failed"),d=()=>{p(Cn,c,"iframe does not exist"),p(Cn,l,"missing parameters: onCloseDrawIoFrame"),i.removeListeners(),l(n,c)};else{const h=B("div",["editor-drawio-iframe-container","loading"],document.body);h.setAttribute("data-placeholder",_.t("drawio.loading")),c=B("iframe",["drawio-iframe-element"],h),c.setAttribute("frameborder","0"),q(h,yS);const{disconnect:C}=KQ(c);d=()=>{p(Cn,c,"iframe does not exist"),i.removeListeners(),C(),document.body.removeChild(h),ct(h,yS)}}return i.addAuthListen("authError",()=>{s.render(t,d)}),i.addAuthListen("authRecover",()=>{s.destroy()}),{drawioIframe:c,exit:d}}async function $Q(n,t,e,r){var i,s;try{r&&Cn.debug("auto saving drawio data");const o=new Blob([e]),l=new File([o],"drawio.svg",{type:"image/svg+xml"}),c=n.findBlockById(ut(t));if(c){const d=await n.doc.uploadResource(l),{resourceId:h}=d,E=n.getBlockData(c).embedData,A={src:h,height:E==null?void 0:E.height};n.updateEmbedData(c,A)}else Cn.error("block has been deleted")}catch(o){const l=`failed to save drawio data: ${o.message}`,c=Du(n);if((i=c.callbacks)!=null&&i.onError){const d=new Error(l);d.code="SaveDrawIo",(s=c.callbacks)==null||s.onError(n,d)}throw o}}class HQ{constructor(){m(this,"loadingContainer");m(this,"canRender",!1);m(this,"setLoading",t=>{const e=t.parentElement;e&&q(e,"loading")});m(this,"removeLoading",()=>{document.querySelectorAll(".editor-drawio-iframe-container").forEach(e=>{ct(e,"loading")}),this.canRender=!1})}}function jQ(n,t,e,r,i,s,o){const l=()=>{window.removeEventListener("message",d),s()},c=new HQ;c.setLoading(r);const d=async h=>{var C,E;if(p(Cn,r.contentWindow,"iframe.contentWindow does not exist"),h.data.length>0){const A=JSON.parse(h.data),v=e.xmlSvg||e.xml;switch(A.event){case"configure":r.contentWindow.postMessage(JSON.stringify({action:"configure",config:{defaultFonts:["Humor Sans","Helvetica","Times New Roman"]}}),"*");break;case"init":v!=null&&r.contentWindow.postMessage(JSON.stringify({action:"load",saveAndExit:1,noSaveBtn:1,noExitBtn:0,xml:v}),"*"),i(),c.removeLoading();break;case"save":c.canRender=!0,r.contentWindow.postMessage(JSON.stringify({action:"export",format:"xmlsvg",spin:"Saving graph"}),"*");break;case"export":c.canRender&&c.setLoading(r);const w=vf(A.data.substring(A.data.indexOf(",")+1));try{await $Q(n,t,w,!!((C=A.message)!=null&&C.autoSave)),(E=A.message)!=null&&E.autoSave||l()}catch{}c.removeLoading();break;case"exit":c.canRender=!0,l();break}}};window.addEventListener("message",d)}async function TS(n,t,e,r){if(r)return;r=!0;const i=Du(n)||{},{callbacks:s}=i;let o;s&&(s==null?void 0:s.onBeginInitDrawIo)&&s.onBeginInitDrawIo(n,t);const{drawioIframe:l,exit:c}=await VQ(n,t);if(SA(n,t),e.src){const E=await bS(n,n.doc.buildResourceUrl(e.src));E&&(e.xmlSvg=E)}jQ(n,t,e,l,()=>{o=setInterval(()=>{!l||!l.contentWindow||l.contentWindow.postMessage(JSON.stringify({action:"export",format:"xmlsvg",spin:"Saving graph",autoSave:!0}),"*")},NQ)},()=>{c(),o&&clearInterval(o);const E=n.findBlockById(ut(t));E&&LA(n,E)});const C=FQ(n);l.setAttribute("src",C)}async function zQ(n){var i,s;const t=Du(n),e=((i=t.cdn)==null?void 0:i.drawio)||_Q,r=((s=t.cdn)==null?void 0:s.pako)||MQ;await na(r,"editor-pako"),await na(e,"editor-drawio"),await new Promise(o=>{setTimeout(o,100)})}function GQ(n){ct(n,BS)}function vx(n){q(n,BS);const t=B("div",["drawio-empty-content"],n);t.innerHTML=UQ,B("span",["drawio-empty-title"],t,_.t("drawio.empty"))}function WQ(n,t,e){const r=et(t);if(!r)return;const i=zt(r);t.innerHTML="",t.style.height="100%",q(r,"drawio-load-error");const s=B("div",["drawio-error-content"],t),o=B("div",["drawio-error-brand-icon"],s);o.innerHTML=I0,B("div",["drawio-error-title"],s,_.t("drawio.errorTips"));const l=B("div",["drawio-error-sub-title"],s);B("span",[],l,_.t("drawio.errorSubTips"));const c=B("span",["drawio-error-retry-button"],l,_.t("drawio.retry"));c.onclick=()=>{t.innerHTML="",ct(r,"drawio-load-error"),e.src?kS(e.src,t,n):e.xml?RS(e.xml,t,n):e.xmlSvg&&wS(e.xmlSvg,t),e.height&&(i.style.height=`${e.height}px`,t.style.height=`${e.height-20}px`)}}function Bx(n,t){if(p(Cn,t,"Required data is missing in setGraph"),"src"in t){n.setAttribute("data-src",t.src);return}if("xmlSvg"in t){n.setAttribute("data-xmlsvg",t.xmlSvg);return}if("graph"in t){const{xml:e,graph:r}=t;n.graph=r,n.setAttribute("data-mxfile",e)}}function qQ(n){return{src:n.getAttribute("data-src")||"",xmlSvg:n.getAttribute("data-xmlsvg")||"",xml:n.getAttribute("data-mxfile")||""}}function kS(n,t,e){p(Cn,n,"params error: src"),p(Cn,e,"params error: editor");const r=t,i=e.doc.buildResourceUrl(n,{syncNewResources:async(o,l)=>{var d,h;await e.doc.addResources([o]);const c=(h=(d=e.doc).getServerMeta)==null?void 0:h.call(d).appId;if(l!==n&&c&&n.includes(c)){const C=et(t);if(C&&!e.readonly&&e.isBlockWritable(C)){const E=Et.default(e.getBlockData(C));E.embedData.src=o,e.updateBlockData(C,E)}}}}),s=document.createElement("img");r.innerHTML="",r.appendChild(s),s.src=i,s.draggable=!1,Bx(r,{src:n}),s.onload=o=>{const l=r.querySelector("img");o.target!==l||!l||(wQ(l)?vx(t):GQ(t))},s.onerror=o=>{const l=r.querySelector("img");o.target===l&&WQ(e,t,{src:n})}}function RS(n,t,e){p(Cn,e,"parameter missing"),zQ(e).then(()=>{const{mxUtils:r,mxGraph:i,mxCodec:s}=window;p(Cn,r,"External resource loading exception: mxUtils"),p(Cn,i,"External resource loading exception: MxGraph"),p(Cn,s,"External resource loading exception: MxCodec");const o=r.parseXml(n);t.innerHTML="";const l=o.documentElement;p(Cn,l,"Resource parsing exception"),p(Cn,l.nodeName==="mxfile","Resource parsing exception");const c=l.getElementsByTagName("diagram");p(Cn,c.length>0,"Resource parsing exception");let d;const h=c[0];if(h.text||h.textContent){const w=LQ(h),S=atob(w),U=window.pako;p(Cn,U,"External resource loading exception: pako");const M=U.inflateRaw(Uint8Array.from(S,nt=>nt.charCodeAt(0)),{to:"string"}),V=decodeURIComponent(M);d=r.parseXml(V)}else{const w=new XMLSerializer().serializeToString(h.firstChild);d=r.parseXml(w)}const C=new i(t);C.resetViewOnRootChange=!1,C.foldingEnabled=!1,C.setTooltips(!1),C.setEnabled(!1),C.setHtmlLabels(!0);const E=r.parseXml(OQ);new s(E).decode(E.documentElement,C.getStylesheet());const v=new s(d);v.decode(v.document.documentElement,C.getModel()),C.maxFitScale=1,C.fit(),C.center(!0,!1),Bx(t,{graph:C,xml:n})})}function wS(n,t){t.innerHTML=n,Bx(t,{xmlSvg:n});const e=t.querySelectorAll("svg");for(let r=0;r<e.length;r++){const i=e[r];if(!SQ(i))return}vx(t)}function XQ(n,t){return{...ix(n,t,{handleExecuteCommand:(r,i,s)=>{if(s.id==="edit"){const o=r.getBlockData(i).embedData;return TS(r,i,o,!1),!0}return!1}}),abstract:_.t("drawio.abstract")}}const YQ={"en-US":{drawio:{title:"Flowchart/UML",empty:"Empty graph",loading:"Loading",abstract:"Flowchart/UML",errorTips:"Flowchart/UML loading failed",errorSubTips:"The network service is abnormal, you can",retry:"Try again"}},"zh-CN":{drawio:{title:"\u6D41\u7A0B\u56FE/UML",empty:"\u7A7A\u56FE\u8868",loading:"\u52A0\u8F7D\u4E2D",abstract:"\u6D41\u7A0B\u56FE/UML",errorTips:"\u6D41\u7A0B\u56FE/UML\u52A0\u8F7D\u5931\u8D25",errorSubTips:"\u7F51\u7EDC\u670D\u52A1\u5F02\u5E38\uFF0C\u4F60\u53EF\u4EE5",retry:"\u91CD\u8BD5"}},"ja-JP":{drawio:{title:"\u30D5\u30ED\u30FC\u30C1\u30E3\u30FC\u30C8/UML",empty:"\u30B0\u30E9\u30D5\u30C7\u30FC\u30BF\u306A\u3057",loading:"\u8AAD\u8FBC\u4E2D",abstract:"\u30D5\u30ED\u30FC\u30C1\u30E3\u30FC\u30C8/UML",errorTips:"\u30D5\u30ED\u30FC\u30C1\u30E3\u30FC\u30C8/UML \u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F",errorSubTips:"\u304A\u4F7F\u3044\u306E\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u63A5\u7D9A\u306B\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u6B21\u306E\u64CD\u4F5C\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002 ",retry:"\u518D\u8A66\u884C"}}};_.mergeLang(YQ);const Fg=D("embed-block-drawio"),QQ=!1;function JQ(n,t,e,r){p(Fg,e,`parameter missing: ${e}`),p(Fg,n,`parameter missing: ${n}`),TS(n,t,r,QQ)}function SS(n,t,e){const{src:r,xml:i,xmlSvg:s}=e;r?kS(r,t,n):i?RS(i,t,n):s?wS(s,t):vx(t)}function ZQ(n,t,e){const r=B("div",["editor-drawio-content","editor-embed"],null);t.appendChild(r),SS(n,r,e),e.height&&(t.style.height=`${e.height}px`,r.style.height=`${e.height-20}px`)}function tJ(n,t,e){const{src:r,xml:i,xmlSvg:s}=e,o=qQ(t);if(r!==o.src||(i||"")!==o.xml||(s||"")!==o.xmlSvg){SS(n,t,e);return}const l=t.parentElement,c=et(l);e.height&&e.height!==Number.parseInt(l.style.height,10)&&(l.style.height=`${e.height}px`,c&&!c.classList.contains("drawio-load-error")?t.style.height=`${e.height-20}px`:t.style.height="100%")}function eJ(n,t,e,r,i,s){const o=e.embedData;ZQ(n,t,o),nh.register(n,s)}function nJ(n,t,e){const r=e.embedData,s=zt(t).querySelector(":scope > .editor-drawio-content");return p(Fg,s,"embed should not be null"),tJ(n,s,r),!0}function rJ(){return{name:"UML",insertEmbedCommandItems:[{id:"insert-drawio",name:_.t("drawio.title"),icon:HT,group:"common",order:600,subText:Qn("insert-drawio")}],handleInsertEmptyEmbed:async(n,t)=>{const e={src:"",xml:"",xmlSvg:""},r=n.insertEmbed(t.containerId,t.blockIndex,"drawio",e);return setTimeout(()=>{const s=zt(r).querySelector(":scope > .editor-drawio-content");p(Fg,s,"embed should not be null");const o=n.getBlockData(r);JQ(n,r,s,o.embedData)},100),r}}}function iJ(n,t,e,r){const{embedData:i}=t,s=i;return r==="html"?s.src?`<img src="${n.doc.buildResourceUrl(s.src,{withToken:!0})}" />`:s.xmlSvg?s.xmlSvg:"<p>[drawio]</p>":r==="markdown"?s.src?`![drawio](${n.doc.buildResourceUrl(s.src,{withToken:!0})})`:s.xmlSvg?s.xmlSvg:"[drawio]":""}const LS={embedType:"drawio",getOptions:rJ,createEmbedContent:eJ,handleUpdateBlock:nJ,getBlockProperties:XQ,convertTo:iJ},Jat="",Zat="",sJ=500,oJ=300,yx=D("code-editor");function lJ(n){const t=n.closest(".embed-code-editor-container");return p(yx,t,"code-editor-container non-existent"),t}function aJ(n,t,e){const r=n.target;p(yx,r,"Parameter error: textarea must be an element");const i=r.value;lJ(r).remove(),ct(t,"editing"),e(i),zt(t).style.removeProperty("margin-top")}function cJ(n,t){p(yx,n,"Parameter Error: handleCodeUpdate[event]");const e=n.target.value;t(e)}const uJ=Ne.default(cJ,sJ);function fJ(n,t,e,r,i){n.domEvents.addEventListener(t,"blur",(s,o)=>{aJ(o,e,i)}),n.domEvents.addEventListener(t,"keyup",(s,o)=>{const l=o.target;o.key==="Escape"&&l.blur()}),n.domEvents.addEventListener(t,"input",(s,o)=>{uJ(o,r)})}function dJ(n,t,e){const{height:r,codeValue:i,onChange:s,onEnd:o}=e,l=r||oJ,c=zt(t),d=be(t),h=B("div",["embed-code-editor-container"],d),C=B("textarea",["embed-code-editor-textarea"],h);C.value=i||"",C.setAttribute("spellcheck","false"),h.style.height=`${l}px`,fJ(n,C,t,s,o),c.style.marginTop=`${l}px`,q(t,"editing"),setTimeout(()=>{C.setSelectionRange(0,0),C.focus(),C.scrollTop=0})}const hJ={mermaid:"https://mermaid.js.org/",flowchart:"https://flowchart.js.org/",plantuml:"https://plantuml.com/"};class mJ extends rx{constructor(e,r,i,s){super(e,r,s);m(this,"group","hovering-toolbar");m(this,"_commands",[{id:"edit",name:_.t("graph.edit"),icon:L0},{id:"add-comment",name:_.t("graph.comment"),icon:ba},{id:"separator",type:"separator",name:""},{id:"help",name:_.t("graph.help"),icon:eE}]);this.editor=e,this.block=r,this.graphType=i,this.properties=s}executeCommand(e,r,i){var s,o;(o=(s=this.properties)==null?void 0:s.handleExecuteCommand)!=null&&o.call(s,e,r,i)||i.id==="edit"||i.id==="help"&&window.open(hJ[this.graphType])}}function gJ(n,t,e,r){return{blockCommands:{"hovering-toolbar":new mJ(n,t,e,r)},abstract:Ii.exports.capitalize(e)}}class Tx{constructor(t,e,r){m(this,"editor");m(this,"logger");m(this,"editing",!1);m(this,"graphEmbedContent",null);m(this,"status","normal");this.graphType=e,this.codeEmbedDataKey=r,this.editor=t,this.logger=D(`embed-block-${this.graphType}`)}i18nt(t,e){return _.t(`graph.${t}`,e||{})}getContent(t){p(this.logger,t,"embed-element does not exist");const e=t.parentElement;return p(this.logger,e,"content-element does not exist"),e}getEmbed(t){const e=t.childNodes[0];return p(this.logger,e,"embed-element does not exist"),e}async uploadResource(t){const e=new Blob([t]),r=new File([e],`${this.graphType}.svg`,{type:"image/svg+xml"});try{const i=await this.editor.doc.uploadResource(r);p(this.logger,i,"uploadResource failed");const{resourceId:s}=i;return this.editor.doc.buildResourceUrl(s)}catch(i){return this.logger.error(i),null}}createEmbedContent(t,e){const r=B("div",["graph-embed"],t),{embedData:i}=e,s=i[`${this.codeEmbedDataKey}`],o=i.src;this.graphEmbedContent=B("div",["embed-graph-img-content"],r);const l=B("img",["graph-embed-image"],this.graphEmbedContent);l.draggable=!1,this.updateImage(r,s,o,null)}updateEmbedContent(t,e){const{embedData:r}=e,i=r[this.codeEmbedDataKey],s=r.src,o=t.querySelector(".graph-embed");this.updateImage(o,i,s,null)}async updateImage(t,e,r,i){var l;this.status="normal";const s=(l=this.graphEmbedContent)==null?void 0:l.querySelector("img.graph-embed-image");let o=this.editor.doc.buildResourceUrl(r||"",{syncNewResources:async(c,d)=>{var C,E;this.editor.doc.addResources([c]);const h=(E=(C=this.editor.doc).getServerMeta)==null?void 0:E.call(C).appId;if(r&&d!==r&&h&&r.includes(h)){const A=et(t);if(A&&!this.editor.readonly&&this.editor.isBlockWritable(A)){const v=Et.default(this.editor.getBlockData(A));v.embedData.src=c,this.editor.updateEmbedData(A,v.embedData)}}}});if(!o&&!i&&e)try{o=await this.code2ObjectUrl(e)}catch(c){this.updateImage(t,e,r,c);return}this.updateSpecialClasses(t,e,i),s.onerror=()=>{this.updateImage(t,e,r,new Error("image load failed"))},o&&(s.src=o,s.onerror=()=>{this.errorBoundary(t,e,r,"imageLoadError")},s.onload=()=>{this.status="normal",this.removeStatusContent(),s.style.display="initial"})}errorBoundary(t,e,r,i,s){var C;if(this.status==="error")return;this.status="error";const o=(C=this.graphEmbedContent)==null?void 0:C.querySelector("img.graph-embed-image");o.style.display="none",this.removeStatusContent();const l=B("div",["graph-error-content","graph-status-content"],this.graphEmbedContent),c=B("div",["graph-error-brand-icon"],l);if(c.innerHTML=I0,B("div",["graph-error-title"],l,_.t("graph.errorTips",{EmbedName:this.graphType})),s){const E=B("div",["graph-error-sub-title"],l);B("span",[],E,_.t("graph.invalid",{EmbedName:this.graphType,message:s.message}))}if(i==="grammarError")return;const d=B("div",["graph-error-sub-title"],l);B("span",[],d,_.t("graph.errorSubTips"));const h=B("span",["graph-error-retry-button"],d,_.t("graph.retry"));h.onclick=()=>{t.innerHTML="";const E=B("div",["embed-graph-img-content"],t),A=B("img",["graph-embed-image"],E);A.draggable=!1,this.updateImage(t,e,r,null)}}emptyContent(){var s;if(this.status==="empty")return;this.status="empty",this.removeStatusContent();const t=(s=this.graphEmbedContent)==null?void 0:s.querySelector("img.graph-embed-image");t.style.display="none";const e=B("div",["graph-empty-content","graph-status-content"],this.graphEmbedContent),r=B("div",["graph-brand-icon"],e);r.innerHTML=I0;const i=this.i18nt("empty",{EmbedName:this.graphType});B("div",["graph-empty-title"],e,i)}updateSpecialClasses(t,e,r){const i=t.querySelector("img.graph-embed-image"),s=et(t);if(r&&s&&e){const o=i.src;this.errorBoundary(t,e,o,"grammarError",r);return}e||this.emptyContent()}editGraph(t){this.editing=!0;const e=et(t);p(this.logger,e,`${this.graphType} block does not exist`),SA(this.editor,e);const r=t.querySelector(".graph-embed"),i=l=>{this.updateImage(r,l,null,null)},s=async l=>{try{if(this.editing=!1,LA(this.editor,e),i(l),!this.hasChanged(e,l))return;const d={src:await this.code2ResourceId(l),[`${this.codeEmbedDataKey}`]:l};this.editor.updateEmbedData(e,d)}catch(c){this.updateSpecialClasses(r,l,c);const d={src:"",[`${this.codeEmbedDataKey}`]:l};this.editor.updateEmbedData(e,d)}},o=this.editor.getBlockData(e);setTimeout(()=>{dJ(this.editor,e,{onChange:i,onEnd:s,codeValue:o.embedData[`${this.codeEmbedDataKey}`]})})}getBlockProperties(t,e){return this.editing?{}:gJ(this.editor,t,this.graphType,{handleExecuteCommand:(r,i,s)=>{if(s.id==="edit"){if(!r.isBlockWritable(i))return!0;const o=zt(i);return this.editGraph(o),!0}return s.id==="add-comment"?(r.readonly||eh(r,i),!0):!1}})}hasChanged(t,e){return this.editor.getBlockData(t).embedData[`${this.codeEmbedDataKey}`]!==e}removeStatusContent(){var e;const t=(e=this.graphEmbedContent)==null?void 0:e.querySelector(".graph-status-content");t&&t.remove()}}const pJ="https://cdn.jsdelivr.net/npm/mermaid@9.0.1/dist/mermaid.min.js",CJ=["//cdnjs.cloudflare.com/ajax/libs/raphael/2.3.0/raphael.min.js","//cdnjs.cloudflare.com/ajax/libs/flowchart/1.15.0/flowchart.min.js"],EJ="https://www.plantuml.com/plantuml/svg",AJ=D("mermaid-helper"),xJ="wiz-editor-mermaid";async function IS(n,t){var v;const r=((v=(n.getComponentOptions("mermaid")||{}).cdn)==null?void 0:v.mermaid)||pJ;await na(r,xJ);const i=window.mermaid;p(AJ,i,"Resource load failed: Mermaid javaScript resource injection failed");const s=it(),l=await new Promise((w,S)=>{try{i.mermaidAPI.render(s,t,U=>{setTimeout(()=>{w(U)})})}catch(U){U.message=U.str,S(U)}}),h=new DOMParser().parseFromString(l,"image/svg+xml").firstChild,C=h.style.maxWidth;return C&&h.setAttribute("width",C),new XMLSerializer().serializeToString(h)}async function bJ(n,t){const e=await IS(n,t);return Gp(e,"image/svg+xml",`${it()}.svg`)}async function vJ(n,t){const e=await IS(n,t),r=new Blob([e]),i=new File([r],`${it()}.svg`,{type:"image/svg+xml"});return(await n.doc.uploadResource(i)).resourceId}class _u extends Tx{constructor(t){super(t,"mermaid","mermaidText")}static get(t,e){return t.addCustom(`mermaid-${e.id}`,()=>new _u(t))}code2ObjectUrl(t){return bJ(this.editor,t)}code2ResourceId(t){return vJ(this.editor,t)}destroy(){}}const BJ={graph:{invalid:"\u65E0\u6548\u7684 {EmbedName} \u5185\u5BB9\uFF1A{message}",empty:"\u7A7A\u7684 {EmbedName}",edit:"\u7F16\u8F91",comment:"\u6279\u6CE8",help:"\u5E2E\u52A9",errorTips:"{EmbedName}\u52A0\u8F7D\u5931\u8D25",errorSubTips:"\u7F51\u7EDC\u670D\u52A1\u5F02\u5E38\uFF0C\u4F60\u53EF\u4EE5",retry:"\u91CD\u8BD5"}},yJ={graph:{invalid:"Invalid {EmbedName} content: {message}",empty:"Empty {EmbedName}",edit:"Edit",comment:"Annotation",help:"Help",errorTips:"{EmbedName} loading failed",errorSubTips:"The network service is abnormal, you can",retry:"Try again"}},TJ={graph:{invalid:"\u7121\u52B9\u306A{EmbedName}\uFF1A{message}",empty:"\u7A7A\u306E {EmbedName}",edit:"\u7DE8\u96C6",comment:"\u6CE8\u91C8",help:"\u30D8\u30EB\u30D7",errorTips:"{EmbedName} \u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F",errorSubTips:"\u304A\u4F7F\u3044\u306E\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u63A5\u7D9A\u306B\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u6B21\u306E\u64CD\u4F5C\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002 ",retry:"\u518D\u8A66\u884C"}};_.mergeLang({"zh-CN":BJ,"en-US":yJ,"ja-JP":TJ});function kJ(n,t,e){_u.get(n,e).createEmbedContent(t,e)}function RJ(n,t,e){const r=_u.get(n,n.getBlockData(t)),i=zt(t);return r.updateEmbedContent(i,e),!0}function wJ(n,t,e){const{data:r}=e,i=n.getBlockString(t).trim();if(!r||r.embedType!=="mermaid"||i!=="```mermaid"||!ot(n,t))return null;const s={src:"",mermaidText:""};return{blockData:{id:it(),type:"embed",embedType:"mermaid",embedData:s},onConverted:(c,d)=>{_u.get(c,c.getBlockData(d)).editGraph(zt(d))}}}function SJ(n,t){return _u.get(n,n.getBlockData(t)).getBlockProperties(t)}function LJ(n,t,e,r){const{embedData:i}=t,s=i;if(r==="html")return s.src?`<img src="${n.doc.buildResourceUrl(s.src,{withToken:!0})}" />`:s.mermaidText?`<div class="mermaid">${s.mermaidText}</div>`:"<p>[mermaid]</p>";if(r==="markdown"){if(s.src)return`![mermaid](${n.doc.buildResourceUrl(s.src,{withToken:!0})})`;if(s.mermaidText)return`\`\`\`mermaid\`\`\`
957
+ `,vS=0,NQ=30*1e3,BS="editor-empty-drawio",yS="show-full-screen-iframe",Cn=D("embed-block-drawio");function Du(n){return n.options.componentsOptions.drawIO||{}}function PQ(n){const e=Du(n).lang;return e?IQ[e]:""}function FQ(n){var i;const e=((i=(Du(n)||{}).cdn)==null?void 0:i.drawioIframe)||DQ,r=PQ(n);return Vp(e,{spin:1,proto:"json",configure:1,lang:r})}function KQ(n){const t=()=>{p(Cn,n,"el does not exist");const r=document.body.clientWidth||document.documentElement.clientWidth,i=document.body.clientHeight||document.documentElement.clientHeight;n.setAttribute("width",`${r-2*vS}`),n.setAttribute("height",`${i-2*vS}`)},e=()=>{window.removeEventListener("resize",t)};return t(),window.addEventListener("resize",t),{disconnect:e}}async function VQ(n,t){const r=(Du(n)||{}).callbacks||{},i=n.getCustom(Pg),s=new ES(n),{onCreateDrawIoFrame:o,onCloseDrawIoFrame:l}=r;let c=null,d;if(o)c=await o(n),p(Cn,c,"iframe create failed"),d=()=>{p(Cn,c,"iframe does not exist"),p(Cn,l,"missing parameters: onCloseDrawIoFrame"),i.removeListeners(),l(n,c)};else{const h=B("div",["editor-drawio-iframe-container","loading"],document.body);h.setAttribute("data-placeholder",_.t("drawio.loading")),c=B("iframe",["drawio-iframe-element"],h),c.setAttribute("frameborder","0"),q(h,yS);const{disconnect:C}=KQ(c);d=()=>{p(Cn,c,"iframe does not exist"),i.removeListeners(),C(),document.body.removeChild(h),ct(h,yS)}}return i.addAuthListen("authError",()=>{s.render(t,d)}),i.addAuthListen("authRecover",()=>{s.destroy()}),{drawioIframe:c,exit:d}}async function $Q(n,t,e,r){var i,s;try{r&&Cn.debug("auto saving drawio data");const o=new Blob([e]),l=new File([o],"drawio.svg",{type:"image/svg+xml"}),c=n.findBlockById(ut(t));if(c){const d=await n.doc.uploadResource(l),{resourceId:h}=d,E=n.getBlockData(c).embedData,A={src:h,height:E==null?void 0:E.height};n.updateEmbedData(c,A)}else Cn.error("block has been deleted")}catch(o){const l=`failed to save drawio data: ${o.message}`,c=Du(n);if((i=c.callbacks)!=null&&i.onError){const d=new Error(l);d.code="SaveDrawIo",(s=c.callbacks)==null||s.onError(n,d)}throw o}}class HQ{constructor(){m(this,"loadingContainer");m(this,"canRender",!1);m(this,"setLoading",(t,e=_.t("drawio.save"))=>{const r=t.parentElement;r&&(q(r,"loading"),r.setAttribute("data-placeholder",e))});m(this,"removeLoading",()=>{document.querySelectorAll(".editor-drawio-iframe-container").forEach(e=>{ct(e,"loading")}),this.canRender=!1})}}function jQ(n,t,e,r,i,s,o){const l=()=>{window.removeEventListener("message",d),s()},c=new HQ;c.setLoading(r,_.t("drawio.loading"));const d=async h=>{var C,E;if(p(Cn,r.contentWindow,"iframe.contentWindow does not exist"),h.data.length>0){const A=JSON.parse(h.data),v=e.xmlSvg||e.xml;switch(A.event){case"configure":r.contentWindow.postMessage(JSON.stringify({action:"configure",config:{defaultFonts:["Humor Sans","Helvetica","Times New Roman"]}}),"*");break;case"init":v!=null&&r.contentWindow.postMessage(JSON.stringify({action:"load",saveAndExit:1,noSaveBtn:1,noExitBtn:0,xml:v}),"*"),i(),c.removeLoading();break;case"save":c.canRender=!0,r.contentWindow.postMessage(JSON.stringify({action:"export",format:"xmlsvg",spin:"Saving graph"}),"*");break;case"export":c.canRender&&c.setLoading(r);const w=vf(A.data.substring(A.data.indexOf(",")+1));try{await $Q(n,t,w,!!((C=A.message)!=null&&C.autoSave)),(E=A.message)!=null&&E.autoSave||l()}catch{}c.removeLoading();break;case"exit":c.canRender=!0,l();break}}};window.addEventListener("message",d)}async function TS(n,t,e,r){if(r)return;r=!0;const i=Du(n)||{},{callbacks:s}=i;let o;s&&(s==null?void 0:s.onBeginInitDrawIo)&&s.onBeginInitDrawIo(n,t);const{drawioIframe:l,exit:c}=await VQ(n,t);if(SA(n,t),e.src){const E=await bS(n,n.doc.buildResourceUrl(e.src));E&&(e.xmlSvg=E)}jQ(n,t,e,l,()=>{o=setInterval(()=>{!l||!l.contentWindow||l.contentWindow.postMessage(JSON.stringify({action:"export",format:"xmlsvg",spin:"Saving graph",autoSave:!0}),"*")},NQ)},()=>{c(),o&&clearInterval(o);const E=n.findBlockById(ut(t));E&&LA(n,E)});const C=FQ(n);l.setAttribute("src",C)}async function zQ(n){var i,s;const t=Du(n),e=((i=t.cdn)==null?void 0:i.drawio)||_Q,r=((s=t.cdn)==null?void 0:s.pako)||MQ;await na(r,"editor-pako"),await na(e,"editor-drawio"),await new Promise(o=>{setTimeout(o,100)})}function GQ(n){ct(n,BS)}function vx(n){q(n,BS);const t=B("div",["drawio-empty-content"],n);t.innerHTML=UQ,B("span",["drawio-empty-title"],t,_.t("drawio.empty"))}function WQ(n,t,e){const r=et(t);if(!r)return;const i=zt(r);t.innerHTML="",t.style.height="100%",q(r,"drawio-load-error");const s=B("div",["drawio-error-content"],t),o=B("div",["drawio-error-brand-icon"],s);o.innerHTML=I0,B("div",["drawio-error-title"],s,_.t("drawio.errorTips"));const l=B("div",["drawio-error-sub-title"],s);B("span",[],l,_.t("drawio.errorSubTips"));const c=B("span",["drawio-error-retry-button"],l,_.t("drawio.retry"));c.onclick=()=>{t.innerHTML="",ct(r,"drawio-load-error"),e.src?kS(e.src,t,n):e.xml?RS(e.xml,t,n):e.xmlSvg&&wS(e.xmlSvg,t),e.height&&(i.style.height=`${e.height}px`,t.style.height=`${e.height-20}px`)}}function Bx(n,t){if(p(Cn,t,"Required data is missing in setGraph"),"src"in t){n.setAttribute("data-src",t.src);return}if("xmlSvg"in t){n.setAttribute("data-xmlsvg",t.xmlSvg);return}if("graph"in t){const{xml:e,graph:r}=t;n.graph=r,n.setAttribute("data-mxfile",e)}}function qQ(n){return{src:n.getAttribute("data-src")||"",xmlSvg:n.getAttribute("data-xmlsvg")||"",xml:n.getAttribute("data-mxfile")||""}}function kS(n,t,e){p(Cn,n,"params error: src"),p(Cn,e,"params error: editor");const r=t,i=e.doc.buildResourceUrl(n,{syncNewResources:async(o,l)=>{var d,h;await e.doc.addResources([o]);const c=(h=(d=e.doc).getServerMeta)==null?void 0:h.call(d).appId;if(l!==n&&c&&n.includes(c)){const C=et(t);if(C&&!e.readonly&&e.isBlockWritable(C)){const E=Et.default(e.getBlockData(C));E.embedData.src=o,e.updateBlockData(C,E)}}}}),s=document.createElement("img");r.innerHTML="",r.appendChild(s),s.src=i,s.draggable=!1,Bx(r,{src:n}),s.onload=o=>{const l=r.querySelector("img");o.target!==l||!l||(wQ(l)?vx(t):GQ(t))},s.onerror=o=>{const l=r.querySelector("img");o.target===l&&WQ(e,t,{src:n})}}function RS(n,t,e){p(Cn,e,"parameter missing"),zQ(e).then(()=>{const{mxUtils:r,mxGraph:i,mxCodec:s}=window;p(Cn,r,"External resource loading exception: mxUtils"),p(Cn,i,"External resource loading exception: MxGraph"),p(Cn,s,"External resource loading exception: MxCodec");const o=r.parseXml(n);t.innerHTML="";const l=o.documentElement;p(Cn,l,"Resource parsing exception"),p(Cn,l.nodeName==="mxfile","Resource parsing exception");const c=l.getElementsByTagName("diagram");p(Cn,c.length>0,"Resource parsing exception");let d;const h=c[0];if(h.text||h.textContent){const w=LQ(h),S=atob(w),U=window.pako;p(Cn,U,"External resource loading exception: pako");const M=U.inflateRaw(Uint8Array.from(S,nt=>nt.charCodeAt(0)),{to:"string"}),V=decodeURIComponent(M);d=r.parseXml(V)}else{const w=new XMLSerializer().serializeToString(h.firstChild);d=r.parseXml(w)}const C=new i(t);C.resetViewOnRootChange=!1,C.foldingEnabled=!1,C.setTooltips(!1),C.setEnabled(!1),C.setHtmlLabels(!0);const E=r.parseXml(OQ);new s(E).decode(E.documentElement,C.getStylesheet());const v=new s(d);v.decode(v.document.documentElement,C.getModel()),C.maxFitScale=1,C.fit(),C.center(!0,!1),Bx(t,{graph:C,xml:n})})}function wS(n,t){t.innerHTML=n,Bx(t,{xmlSvg:n});const e=t.querySelectorAll("svg");for(let r=0;r<e.length;r++){const i=e[r];if(!SQ(i))return}vx(t)}function XQ(n,t){return{...ix(n,t,{handleExecuteCommand:(r,i,s)=>{if(s.id==="edit"){const o=r.getBlockData(i).embedData;return TS(r,i,o,!1),!0}return!1}}),abstract:_.t("drawio.abstract")}}const YQ={"en-US":{drawio:{title:"Flowchart/UML",empty:"Empty graph",loading:"Loading",abstract:"Flowchart/UML",errorTips:"Flowchart/UML loading failed",errorSubTips:"The network service is abnormal, you can",retry:"Try again",save:"Saving"}},"zh-CN":{drawio:{title:"\u6D41\u7A0B\u56FE/UML",empty:"\u7A7A\u56FE\u8868",loading:"\u52A0\u8F7D\u4E2D",abstract:"\u6D41\u7A0B\u56FE/UML",errorTips:"\u6D41\u7A0B\u56FE/UML\u52A0\u8F7D\u5931\u8D25",errorSubTips:"\u7F51\u7EDC\u670D\u52A1\u5F02\u5E38\uFF0C\u4F60\u53EF\u4EE5",retry:"\u91CD\u8BD5",save:"\u4FDD\u5B58\u4E2D"}},"ja-JP":{drawio:{title:"\u30D5\u30ED\u30FC\u30C1\u30E3\u30FC\u30C8/UML",empty:"\u30B0\u30E9\u30D5\u30C7\u30FC\u30BF\u306A\u3057",loading:"\u8AAD\u8FBC\u4E2D",abstract:"\u30D5\u30ED\u30FC\u30C1\u30E3\u30FC\u30C8/UML",errorTips:"\u30D5\u30ED\u30FC\u30C1\u30E3\u30FC\u30C8/UML \u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F",errorSubTips:"\u304A\u4F7F\u3044\u306E\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u63A5\u7D9A\u306B\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u6B21\u306E\u64CD\u4F5C\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002 ",retry:"\u518D\u8A66\u884C",save:"\u4FDD\u5B58\u4E2D"}}};_.mergeLang(YQ);const Fg=D("embed-block-drawio"),QQ=!1;function JQ(n,t,e,r){p(Fg,e,`parameter missing: ${e}`),p(Fg,n,`parameter missing: ${n}`),TS(n,t,r,QQ)}function SS(n,t,e){const{src:r,xml:i,xmlSvg:s}=e;r?kS(r,t,n):i?RS(i,t,n):s?wS(s,t):vx(t)}function ZQ(n,t,e){const r=B("div",["editor-drawio-content","editor-embed"],null);t.appendChild(r),SS(n,r,e),e.height&&(t.style.height=`${e.height}px`,r.style.height=`${e.height-20}px`)}function tJ(n,t,e){const{src:r,xml:i,xmlSvg:s}=e,o=qQ(t);if(r!==o.src||(i||"")!==o.xml||(s||"")!==o.xmlSvg){SS(n,t,e);return}const l=t.parentElement,c=et(l);e.height&&e.height!==Number.parseInt(l.style.height,10)&&(l.style.height=`${e.height}px`,c&&!c.classList.contains("drawio-load-error")?t.style.height=`${e.height-20}px`:t.style.height="100%")}function eJ(n,t,e,r,i,s){const o=e.embedData;ZQ(n,t,o),nh.register(n,s)}function nJ(n,t,e){const r=e.embedData,s=zt(t).querySelector(":scope > .editor-drawio-content");return p(Fg,s,"embed should not be null"),tJ(n,s,r),!0}function rJ(){return{name:"UML",insertEmbedCommandItems:[{id:"insert-drawio",name:_.t("drawio.title"),icon:HT,group:"common",order:600,subText:Qn("insert-drawio")}],handleInsertEmptyEmbed:async(n,t)=>{const e={src:"",xml:"",xmlSvg:""},r=n.insertEmbed(t.containerId,t.blockIndex,"drawio",e);return setTimeout(()=>{const s=zt(r).querySelector(":scope > .editor-drawio-content");p(Fg,s,"embed should not be null");const o=n.getBlockData(r);JQ(n,r,s,o.embedData)},100),r}}}function iJ(n,t,e,r){const{embedData:i}=t,s=i;return r==="html"?s.src?`<img src="${n.doc.buildResourceUrl(s.src,{withToken:!0})}" />`:s.xmlSvg?s.xmlSvg:"<p>[drawio]</p>":r==="markdown"?s.src?`![drawio](${n.doc.buildResourceUrl(s.src,{withToken:!0})})`:s.xmlSvg?s.xmlSvg:"[drawio]":""}const LS={embedType:"drawio",getOptions:rJ,createEmbedContent:eJ,handleUpdateBlock:nJ,getBlockProperties:XQ,convertTo:iJ},Jat="",Zat="",sJ=500,oJ=300,yx=D("code-editor");function lJ(n){const t=n.closest(".embed-code-editor-container");return p(yx,t,"code-editor-container non-existent"),t}function aJ(n,t,e){const r=n.target;p(yx,r,"Parameter error: textarea must be an element");const i=r.value;lJ(r).remove(),ct(t,"editing"),e(i),zt(t).style.removeProperty("margin-top")}function cJ(n,t){p(yx,n,"Parameter Error: handleCodeUpdate[event]");const e=n.target.value;t(e)}const uJ=Ne.default(cJ,sJ);function fJ(n,t,e,r,i){n.domEvents.addEventListener(t,"blur",(s,o)=>{aJ(o,e,i)}),n.domEvents.addEventListener(t,"keyup",(s,o)=>{const l=o.target;o.key==="Escape"&&l.blur()}),n.domEvents.addEventListener(t,"input",(s,o)=>{uJ(o,r)})}function dJ(n,t,e){const{height:r,codeValue:i,onChange:s,onEnd:o}=e,l=r||oJ,c=zt(t),d=be(t),h=B("div",["embed-code-editor-container"],d),C=B("textarea",["embed-code-editor-textarea"],h);C.value=i||"",C.setAttribute("spellcheck","false"),h.style.height=`${l}px`,fJ(n,C,t,s,o),c.style.marginTop=`${l}px`,q(t,"editing"),setTimeout(()=>{C.setSelectionRange(0,0),C.focus(),C.scrollTop=0})}const hJ={mermaid:"https://mermaid.js.org/",flowchart:"https://flowchart.js.org/",plantuml:"https://plantuml.com/"};class mJ extends rx{constructor(e,r,i,s){super(e,r,s);m(this,"group","hovering-toolbar");m(this,"_commands",[{id:"edit",name:_.t("graph.edit"),icon:L0},{id:"add-comment",name:_.t("graph.comment"),icon:ba},{id:"separator",type:"separator",name:""},{id:"help",name:_.t("graph.help"),icon:eE}]);this.editor=e,this.block=r,this.graphType=i,this.properties=s}executeCommand(e,r,i){var s,o;(o=(s=this.properties)==null?void 0:s.handleExecuteCommand)!=null&&o.call(s,e,r,i)||i.id==="edit"||i.id==="help"&&window.open(hJ[this.graphType])}}function gJ(n,t,e,r){return{blockCommands:{"hovering-toolbar":new mJ(n,t,e,r)},abstract:Ii.exports.capitalize(e)}}class Tx{constructor(t,e,r){m(this,"editor");m(this,"logger");m(this,"editing",!1);m(this,"graphEmbedContent",null);m(this,"status","normal");this.graphType=e,this.codeEmbedDataKey=r,this.editor=t,this.logger=D(`embed-block-${this.graphType}`)}i18nt(t,e){return _.t(`graph.${t}`,e||{})}getContent(t){p(this.logger,t,"embed-element does not exist");const e=t.parentElement;return p(this.logger,e,"content-element does not exist"),e}getEmbed(t){const e=t.childNodes[0];return p(this.logger,e,"embed-element does not exist"),e}async uploadResource(t){const e=new Blob([t]),r=new File([e],`${this.graphType}.svg`,{type:"image/svg+xml"});try{const i=await this.editor.doc.uploadResource(r);p(this.logger,i,"uploadResource failed");const{resourceId:s}=i;return this.editor.doc.buildResourceUrl(s)}catch(i){return this.logger.error(i),null}}createEmbedContent(t,e){const r=B("div",["graph-embed"],t),{embedData:i}=e,s=i[`${this.codeEmbedDataKey}`],o=i.src;this.graphEmbedContent=B("div",["embed-graph-img-content"],r);const l=B("img",["graph-embed-image"],this.graphEmbedContent);l.draggable=!1,this.updateImage(r,s,o,null)}updateEmbedContent(t,e){const{embedData:r}=e,i=r[this.codeEmbedDataKey],s=r.src,o=t.querySelector(".graph-embed");this.updateImage(o,i,s,null)}async updateImage(t,e,r,i){var l;this.status="normal";const s=(l=this.graphEmbedContent)==null?void 0:l.querySelector("img.graph-embed-image");let o=this.editor.doc.buildResourceUrl(r||"",{syncNewResources:async(c,d)=>{var C,E;this.editor.doc.addResources([c]);const h=(E=(C=this.editor.doc).getServerMeta)==null?void 0:E.call(C).appId;if(r&&d!==r&&h&&r.includes(h)){const A=et(t);if(A&&!this.editor.readonly&&this.editor.isBlockWritable(A)){const v=Et.default(this.editor.getBlockData(A));v.embedData.src=c,this.editor.updateEmbedData(A,v.embedData)}}}});if(!o&&!i&&e)try{o=await this.code2ObjectUrl(e)}catch(c){this.updateImage(t,e,r,c);return}this.updateSpecialClasses(t,e,i),s.onerror=()=>{this.updateImage(t,e,r,new Error("image load failed"))},o&&(s.src=o,s.onerror=()=>{this.errorBoundary(t,e,r,"imageLoadError")},s.onload=()=>{this.status="normal",this.removeStatusContent(),s.style.display="initial"})}errorBoundary(t,e,r,i,s){var C;if(this.status==="error")return;this.status="error";const o=(C=this.graphEmbedContent)==null?void 0:C.querySelector("img.graph-embed-image");o.style.display="none",this.removeStatusContent();const l=B("div",["graph-error-content","graph-status-content"],this.graphEmbedContent),c=B("div",["graph-error-brand-icon"],l);if(c.innerHTML=I0,B("div",["graph-error-title"],l,_.t("graph.errorTips",{EmbedName:this.graphType})),s){const E=B("div",["graph-error-sub-title"],l);B("span",[],E,_.t("graph.invalid",{EmbedName:this.graphType,message:s.message}))}if(i==="grammarError")return;const d=B("div",["graph-error-sub-title"],l);B("span",[],d,_.t("graph.errorSubTips"));const h=B("span",["graph-error-retry-button"],d,_.t("graph.retry"));h.onclick=()=>{t.innerHTML="";const E=B("div",["embed-graph-img-content"],t),A=B("img",["graph-embed-image"],E);A.draggable=!1,this.updateImage(t,e,r,null)}}emptyContent(){var s;if(this.status==="empty")return;this.status="empty",this.removeStatusContent();const t=(s=this.graphEmbedContent)==null?void 0:s.querySelector("img.graph-embed-image");t.style.display="none";const e=B("div",["graph-empty-content","graph-status-content"],this.graphEmbedContent),r=B("div",["graph-brand-icon"],e);r.innerHTML=I0;const i=this.i18nt("empty",{EmbedName:this.graphType});B("div",["graph-empty-title"],e,i)}updateSpecialClasses(t,e,r){const i=t.querySelector("img.graph-embed-image"),s=et(t);if(r&&s&&e){const o=i.src;this.errorBoundary(t,e,o,"grammarError",r);return}e||this.emptyContent()}editGraph(t){this.editing=!0;const e=et(t);p(this.logger,e,`${this.graphType} block does not exist`),SA(this.editor,e);const r=t.querySelector(".graph-embed"),i=l=>{this.updateImage(r,l,null,null)},s=async l=>{try{if(this.editing=!1,LA(this.editor,e),i(l),!this.hasChanged(e,l))return;const d={src:await this.code2ResourceId(l),[`${this.codeEmbedDataKey}`]:l};this.editor.updateEmbedData(e,d)}catch(c){this.updateSpecialClasses(r,l,c);const d={src:"",[`${this.codeEmbedDataKey}`]:l};this.editor.updateEmbedData(e,d)}},o=this.editor.getBlockData(e);setTimeout(()=>{dJ(this.editor,e,{onChange:i,onEnd:s,codeValue:o.embedData[`${this.codeEmbedDataKey}`]})})}getBlockProperties(t,e){return this.editing?{}:gJ(this.editor,t,this.graphType,{handleExecuteCommand:(r,i,s)=>{if(s.id==="edit"){if(!r.isBlockWritable(i))return!0;const o=zt(i);return this.editGraph(o),!0}return s.id==="add-comment"?(r.readonly||eh(r,i),!0):!1}})}hasChanged(t,e){return this.editor.getBlockData(t).embedData[`${this.codeEmbedDataKey}`]!==e}removeStatusContent(){var e;const t=(e=this.graphEmbedContent)==null?void 0:e.querySelector(".graph-status-content");t&&t.remove()}}const pJ="https://cdn.jsdelivr.net/npm/mermaid@9.0.1/dist/mermaid.min.js",CJ=["//cdnjs.cloudflare.com/ajax/libs/raphael/2.3.0/raphael.min.js","//cdnjs.cloudflare.com/ajax/libs/flowchart/1.15.0/flowchart.min.js"],EJ="https://www.plantuml.com/plantuml/svg",AJ=D("mermaid-helper"),xJ="wiz-editor-mermaid";async function IS(n,t){var v;const r=((v=(n.getComponentOptions("mermaid")||{}).cdn)==null?void 0:v.mermaid)||pJ;await na(r,xJ);const i=window.mermaid;p(AJ,i,"Resource load failed: Mermaid javaScript resource injection failed");const s=it(),l=await new Promise((w,S)=>{try{i.mermaidAPI.render(s,t,U=>{setTimeout(()=>{w(U)})})}catch(U){U.message=U.str,S(U)}}),h=new DOMParser().parseFromString(l,"image/svg+xml").firstChild,C=h.style.maxWidth;return C&&h.setAttribute("width",C),new XMLSerializer().serializeToString(h)}async function bJ(n,t){const e=await IS(n,t);return Gp(e,"image/svg+xml",`${it()}.svg`)}async function vJ(n,t){const e=await IS(n,t),r=new Blob([e]),i=new File([r],`${it()}.svg`,{type:"image/svg+xml"});return(await n.doc.uploadResource(i)).resourceId}class _u extends Tx{constructor(t){super(t,"mermaid","mermaidText")}static get(t,e){return t.addCustom(`mermaid-${e.id}`,()=>new _u(t))}code2ObjectUrl(t){return bJ(this.editor,t)}code2ResourceId(t){return vJ(this.editor,t)}destroy(){}}const BJ={graph:{invalid:"\u65E0\u6548\u7684 {EmbedName} \u5185\u5BB9\uFF1A{message}",empty:"\u7A7A\u7684 {EmbedName}",edit:"\u7F16\u8F91",comment:"\u6279\u6CE8",help:"\u5E2E\u52A9",errorTips:"{EmbedName}\u52A0\u8F7D\u5931\u8D25",errorSubTips:"\u7F51\u7EDC\u670D\u52A1\u5F02\u5E38\uFF0C\u4F60\u53EF\u4EE5",retry:"\u91CD\u8BD5"}},yJ={graph:{invalid:"Invalid {EmbedName} content: {message}",empty:"Empty {EmbedName}",edit:"Edit",comment:"Annotation",help:"Help",errorTips:"{EmbedName} loading failed",errorSubTips:"The network service is abnormal, you can",retry:"Try again"}},TJ={graph:{invalid:"\u7121\u52B9\u306A{EmbedName}\uFF1A{message}",empty:"\u7A7A\u306E {EmbedName}",edit:"\u7DE8\u96C6",comment:"\u6CE8\u91C8",help:"\u30D8\u30EB\u30D7",errorTips:"{EmbedName} \u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F",errorSubTips:"\u304A\u4F7F\u3044\u306E\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u63A5\u7D9A\u306B\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u6B21\u306E\u64CD\u4F5C\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002 ",retry:"\u518D\u8A66\u884C"}};_.mergeLang({"zh-CN":BJ,"en-US":yJ,"ja-JP":TJ});function kJ(n,t,e){_u.get(n,e).createEmbedContent(t,e)}function RJ(n,t,e){const r=_u.get(n,n.getBlockData(t)),i=zt(t);return r.updateEmbedContent(i,e),!0}function wJ(n,t,e){const{data:r}=e,i=n.getBlockString(t).trim();if(!r||r.embedType!=="mermaid"||i!=="```mermaid"||!ot(n,t))return null;const s={src:"",mermaidText:""};return{blockData:{id:it(),type:"embed",embedType:"mermaid",embedData:s},onConverted:(c,d)=>{_u.get(c,c.getBlockData(d)).editGraph(zt(d))}}}function SJ(n,t){return _u.get(n,n.getBlockData(t)).getBlockProperties(t)}function LJ(n,t,e,r){const{embedData:i}=t,s=i;if(r==="html")return s.src?`<img src="${n.doc.buildResourceUrl(s.src,{withToken:!0})}" />`:s.mermaidText?`<div class="mermaid">${s.mermaidText}</div>`:"<p>[mermaid]</p>";if(r==="markdown"){if(s.src)return`![mermaid](${n.doc.buildResourceUrl(s.src,{withToken:!0})})`;if(s.mermaidText)return`\`\`\`mermaid\`\`\`
958
958
  ${s.mermaidText}
959
959
  \`\`\`\`\`\``}return""}const IJ={embedType:"mermaid",convertFrom:wJ,handleUpdateBlock:RJ,createEmbedContent:kJ,getBlockProperties:SJ,convertTo:LJ},DS=D("flowchart-helper");async function DJ(n){var r;const t=n.getComponentOptions("flowchart")||{},e=((r=t==null?void 0:t.cdn)==null?void 0:r.flowchart)||CJ;for(let i=0;i<e.length;i+=1){const s=e[i];await na(s,`flowchart-scripts-${i}`)}}async function _S(n,t){const e=B("div",["flowchart-chart-container"],document.body);e.id=`flowchart-${it()}`,await DJ(n);const r=window.flowchart;p(DS,r,"flowchart resource does not exist"),r.parse(t).drawSVG(e.id);const s=e.firstElementChild;p(DS,s,"svg element non-existent");const l=new XMLSerializer().serializeToString(s);return e.remove(),l}async function _J(n,t){const e=await _S(n,t);return Gp(e,"image/svg+xml",`${Date.now()}.svg`)}async function MJ(n,t){const e=await _S(n,t),r=new Blob([e]),i=new File([r],`${it()}.svg`,{type:"image/svg+xml"});return(await n.doc.uploadResource(i)).resourceId}class Mu extends Tx{constructor(t){super(t,"flowchart","flowchartText")}static get(t,e){return t.addCustom(`flowchart-${e.id}`,()=>new Mu(t))}code2ObjectUrl(t){return _J(this.editor,t)}code2ResourceId(t){return MJ(this.editor,t)}destroy(){}}function UJ(n,t,e){Mu.get(n,e).createEmbedContent(t,e)}function OJ(n,t,e){const r=Mu.get(n,e),i=zt(t);return r.updateEmbedContent(i,e),!0}function NJ(n,t,e){const{data:r}=e,i=n.getBlockString(t).trim();if(!r||r.embedType!=="flowchart"||i!=="```flowchart"||!ot(n,t))return null;const s={src:"",flowchartText:""};return{blockData:{id:it(),type:"embed",embedType:"flowchart",embedData:s},onConverted:(c,d)=>{Mu.get(c,c.getBlockData(d)).editGraph(zt(d))}}}function PJ(n,t){return Mu.get(n,n.getBlockData(t)).getBlockProperties(t)}function FJ(n,t,e,r){const{embedData:i}=t,s=i;if(r==="html")return s.src?`<img src="${n.doc.buildResourceUrl(s.src,{withToken:!0})}" />`:s.flowchartText?`<div>${s.flowchartText}</div>`:"<p>[flowchart]</p>";if(r==="markdown"){if(s.src)return`![flowchart](${n.doc.buildResourceUrl(s.src,{withToken:!0})})`;if(s.flowchartText)return`\`\`\`flowchart\`\`\`
960
960
  ${s.flowchartText}
961
961
  \`\`\`\`\`\``}return""}const KJ={embedType:"flowchart",convertFrom:NJ,handleUpdateBlock:OJ,createEmbedContent:UJ,getBlockProperties:PJ,convertTo:FJ},VJ=D("plantuml-helper");function MS(n,t){var l;let r=((l=(n.getComponentOptions("plantuml")||{}).cdn)==null?void 0:l.plantuml)||EJ;r.endsWith("/")||(r+="/");const i=h9.default.encode(t);p(VJ,i,i),r+=i;const o=new URLSearchParams(document.location.search).get("doc");return Vp(r,{id:`${o}-${it()}`})}async function $J(n,t){try{const e=await bx(n,t);return(await n.doc.uploadResource(e)).resourceId}catch{return Promise.resolve(t)}}class Uu extends Tx{constructor(t){super(t,"plantuml","plantumlText")}static get(t,e){return t.addCustom(`plantuml-${e.id}`,()=>new Uu(t))}code2ObjectUrl(t){return Promise.resolve(MS(this.editor,t))}code2ResourceId(t){const e=MS(this.editor,t);return $J(this.editor,e)}destroy(){}}function HJ(n,t,e){Uu.get(n,e).createEmbedContent(t,e)}function jJ(n,t,e){const r=Uu.get(n,e),i=zt(t);return r.updateEmbedContent(i,e),!0}function zJ(n,t,e){const{data:r}=e,i=n.getBlockString(t).trim();if(!r||r.embedType!=="plantuml"||i!=="```plantuml"||!ot(n,t))return null;const s={src:"",plantumlText:""};return{blockData:{id:it(),type:"embed",embedType:"plantuml",embedData:s},onConverted:(c,d)=>{Uu.get(c,c.getBlockData(d)).editGraph(zt(d))}}}function GJ(n,t){return Uu.get(n,n.getBlockData(t)).getBlockProperties(t)}function WJ(n,t,e,r){const{embedData:i}=t,s=i;if(r==="html")return s.src?`<img src="${n.doc.buildResourceUrl(s.src,{withToken:!0})}" />`:s.flowchartText?`<div>${s.flowchartText}</div>`:"<p>[plantuml]</p>";if(r==="markdown"){if(s.src)return`![plantuml](${n.doc.buildResourceUrl(s.src,{withToken:!0})})`;if(s.flowchartText)return`\`\`\`plantuml\`\`\`
962
962
  ${s.flowchartText}
963
- \`\`\`\`\`\``}return""}const qJ={embedType:"plantuml",convertFrom:zJ,handleUpdateBlock:jJ,createEmbedContent:HJ,getBlockProperties:GJ,convertTo:WJ},tct="",XJ="hr",YJ={dividingLine:{type:"\u5206\u5272\u7EBF",abstract:"\u5206\u5272\u7EBF"}},QJ={dividingLine:{type:"Dividing-Line",abstract:"Dividing-Line"}},JJ={dividingLine:{type:"\u533A\u5207\u308A\u7DDA",abstract:"\u533A\u5207\u308A\u7DDA"}};_.mergeLang({"zh-CN":YJ,"en-US":QJ,"ja-JP":JJ});function ZJ(n,t){const e=B("div",["editor-embed-container"],t);B("hr",["editor-embed-hr"],e)}function tZ(n,t,e,r){return r==="html"?"<hr />":r==="markdown"?"---":"------------"}function eZ(){return{name:"hr",insertEmbedCommandItems:[{id:"insert-hr",name:_.t("dividingLine.type"),icon:jT,order:500,group:"common",subText:Qn("insert-hr")}],handleInsertEmptyEmbed:async(n,t)=>{const{containerId:e,blockIndex:r}=t;return n.insertEmbed(e,r,XJ,{})}}}function nZ(n,t,e){const{data:r}=e;if(!r||r.embedType!=="dividing-line"||!ot(n,t))return null;const i={};return{blockData:{id:it(),type:"embed",embedType:"hr",embedData:i}}}function rZ(){return{abstract:_.t("dividingLine.abstract")}}const iZ={embedType:"hr",createEmbedContent:ZJ,convertTo:tZ,getOptions:eZ,convertFrom:nZ,getBlockProperties:rZ},ect="",nct="",sZ={media:{upload:{failed:'<div class="line-1">{name}\u4E0A\u4F20\u5931\u8D25</div><div class="line-2">\u7F51\u7EDC\u670D\u52A1\u5F02\u5E38\uFF0C\u4F60\u53EF\u4EE5 <span class="retry-upload">\u91CD\u8BD5</span></div>',maxSizeFailed:'<div class="line-1">{name}\u4E0A\u4F20\u5931\u8D25</div><div class="line-2">\u6587\u4EF6\u5927\u5C0F\u8D85\u8FC7\u9650\u5236\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\u6587\u4EF6</div>'},load:{failed:'<div class="line-1">{name}\u52A0\u8F7D\u5931\u8D25</div><div class="line-2">\u7F51\u7EDC\u670D\u52A1\u5F02\u5E38\uFF0C\u4F60\u53EF\u4EE5 <span class="retry-upload">\u91CD\u8BD5</span></div>'},audio:{menuItem:"\u97F3\u9891",abstract:"\u97F3\u9891"},video:{menuItem:"\u89C6\u9891",abstract:"\u89C6\u9891"}}},oZ={media:{upload:{failed:'<div class="line-1">{name} upload failed</div><div class="line-2">Network error, you can <span class="retry-upload">Retry</span></div>',maxSizeFailed:'<div class="line-1">{name} upload failed</div><div class="line-2">The file size exceeds limit. Please choose another file.</div>'},load:{failed:'<div class="line-1">{name} loading failed</div><div class="line-2">Network error, you can <span class="retry-upload">Retry</span></div>'},audio:{menuItem:"Audio",abstract:"Audio"},video:{menuItem:"Video",abstract:"Video"}}},lZ={media:{upload:{failed:'<div class="line-1">{name}\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F</div><div class="line-2">\u304A\u4F7F\u3044\u306E\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u63A5\u7D9A\u306B\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u6B21\u306E\u64CD\u4F5C\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002 <span class="retry-upload">\u518D\u8A66\u884C</span></div>',maxSizeFailed:'<div class="line-1">{name}\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F</div><div class="line-2">\u30D5\u30A1\u30A4\u30EB\u306E\u30B5\u30A4\u30BA\u304C\u4E0A\u9650\u3092\u8D85\u3048\u3066\u3044\u308B\u305F\u3081\u3001\u4ED6\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044</div>'},load:{failed:'<div class="line-1">{name}\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F</div><div class="line-2">\u304A\u4F7F\u3044\u306E\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u63A5\u7D9A\u306B\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u6B21\u306E\u64CD\u4F5C\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002 <span class="retry-upload">\u518D\u8A66\u884C</span></div>'},audio:{menuItem:"\u97F3\u58F0",abstract:"\u97F3\u58F0"},video:{menuItem:"\u52D5\u753B",abstract:"\u52D5\u753B"}}};_.mergeLang({"zh-CN":sZ,"en-US":oZ,"ja-JP":lZ});var Ui=(n=>(n.AUDIO="audio",n.VIDEO="video",n))(Ui||{}),lh=(n=>(n.Empty="empty",n.Progress="progress",n.Error="error",n))(lh||{});const US=10*1024*1024,aZ=["wav","mp3","aac","ogg","webm","flac"],cZ=["ogg","mp4","webm"],uZ=()=>{};function OS(n){var h,C,E,A,v,w;const t=(h=n.getComponentOptions("media"))!=null?h:{},{allowedMedias:e,maxSize:r,callbacks:i}=t,s=(C=e==null?void 0:e.audio)!=null?C:aZ,o=(E=e==null?void 0:e.video)!=null?E:cZ,l=(A=r==null?void 0:r.audio)!=null?A:US,c=(v=r==null?void 0:r.video)!=null?v:US,d=(w=i==null?void 0:i.onError)!=null?w:uZ;return{allowedMedias:{audio:s,video:o},maxSize:{audio:l,video:c},callbacks:{onError:d}}}function fZ(n,t){const e=s=>s.map(o=>`.${o}`).join(","),{allowedMedias:r}=OS(n),i=r[t];return i?e(i):"*"}function dZ(n,t,e){const{maxSize:r,callbacks:i,allowedMedias:s}=OS(t),{[e]:o}=r,{[e]:l}=s;if(o&&n.size>o){const d=new Error("media is too large");throw d.code=`MaxMediaSize-${e}`,i!=null&&i.onError&&(i==null||i.onError(t,d)),d}const c=Tf(n.name);if(l&&!l.includes(c.toLowerCase())){const d=new Error(`media file is not allowed: ${c}`);throw d.code="NotAllowedFile",i!=null&&i.onError&&(i==null||i.onError(t,d)),d}}function hZ(n){return n===lh.Empty||n===lh.Error}const En=D("media");class mZ extends Ve.TypedEmitter{constructor(e){super();m(this,"mediaContainer",null);m(this,"media",null);m(this,"abstract",null);m(this,"handleMediaLoadError",(e,r)=>{if(!r.target||!(r.target instanceof Node)||!(r.target instanceof Element?r.target:r.target.parentElement))return;const s=et(r.target);if(!s||!s.contains(this.mediaContainer))return;const o=this.renderError();this.updateMediaContent(o),this.emit("mediaError",e,"load_error",ut(s))});m(this,"handleUploadFile",async e=>{p(En,this.abstract,"no abstract"),p(En,this.mediaContainer,"The media element not exist");const{editor:r}=this.options,i=et(this.mediaContainer);p(En,i,"The block element not exist");const s=r.getBlockData(i);try{const{resourceId:o}=await r.doc.uploadResource(e,{onProgress:C=>{this.renderProgress(C,e)}}),{name:l,type:c,size:d}=e,h={...s,embedData:{...s.embedData,src:o,fileName:l,fileSize:d,fileType:c}};r.updateBlockData(i,h)}catch(o){En.error(o),this.emit("mediaError",r,"upload_error",s.id),this.renderRetry(e,o)}ct(i,"media-block-uploading")});m(this,"destroy",()=>{this.mediaContainer=null});this.options=e}bindMediaEvent(){const{editor:e}=this.options;this.media&&e.domEvents.addEventListener(this.media,"error",this.handleMediaLoadError)}unbindMediaEvent(){const{editor:e}=this.options;this.media&&e.domEvents.removeEventListener(this.media,"error",this.handleMediaLoadError)}updateMediaContent(e){p(En,this.mediaContainer,"The media element not exist"),this.mediaContainer.innerHTML="",this.mediaContainer.append(e)}renderError(){p(En,this.abstract,"no abstract");const{editor:e,createMediaElement:r}=this.options,{mediaIcon:i,mediaName:s}=this.abstract;p(En,this.mediaContainer,"The media element not exist");const o=et(this.mediaContainer);p(En,o,"The block element not exist");const l=e.getBlockData(o),c=B("div",["media-error","embed-selected-content","embed-hover-content"],null),d=B("span",["media-error-icon"],c);d.innerHTML=i;const h=B("div",[],c);h.innerHTML=_.t("media.load.failed",{name:s}),c.appendChild(h);const C=h.querySelector(".retry-upload");return p(En,C,"The element not exist"),e.domEvents.addEventListener(C,"click",(E,A)=>{const v=B("div",["media-element"],null),w=this.getResourceUrl(l),S=r(E,v,l,w);this.unbindMediaEvent(),this.media=S,this.bindMediaEvent(),this.updateMediaContent(v)}),this.setFullScreen(),c}renderRetry(e,r){var E,A;p(En,this.abstract,"no abstract");const{editor:i}=this.options,{mediaIcon:s,mediaName:o}=this.abstract,l=B("div",["media-error","embed-selected-content","embed-hover-content"],null),c=B("span",["media-error-icon"],l);c.innerHTML=s;const d=B("div",[],l);let h=_.t("media.upload.failed",{name:o});(((E=r.response)==null?void 0:E.status)===420||((A=r.response)==null?void 0:A.status)===413)&&(h=_.t("media.upload.maxSizeFailed",{name:o})),d.innerHTML=h,l.appendChild(d);const C=d.querySelector(".retry-upload");C&&i.domEvents.addEventListener(C,"click",()=>{i.readonly||(p(En,this.abstract,"no abstract"),this.handleUploadFile(e))}),this.updateMediaContent(l),this.setFullScreen()}renderProgress(e,r){p(En,this.mediaContainer,"The media element not exist");const i=this.mediaContainer.querySelector(":scope .media-progress"),s=e===-1||e===100?100:e;if(i){const{updateProgressElement:o}=this.options;o(i,s)}else{const{createProgressElement:o}=this.options,l=et(this.mediaContainer);p(En,l,"The element not exist"),q(l,"media-block-uploading");const c=B("div",["media-progress"],null);o(c,s,r),this.updateMediaContent(c)}this.setFullScreen()}renderMediaElement(e,r){p(En,this.mediaContainer,"The media element not exist");const i=this.mediaContainer.querySelector(":scope > .media-element"),{createMediaElement:s,updateMediaElement:o,editor:l}=this.options,c=this.getResourceUrl(e,r);if(i){const d=o(l,i,e,c);this.unbindMediaEvent(),this.media=d,this.bindMediaEvent()}else{const d=B("div",["media-element"],null),h=s(l,d,e,c);this.unbindMediaEvent(),this.media=h,this.bindMediaEvent(),this.updateMediaContent(d)}}renderEmpty(e){p(En,this.abstract,"no abstract"),p(En,this.mediaContainer,"The media element not exist");const r=B("div",["media-empty","embed-selected-content","embed-hover-content"],this.mediaContainer);r.innerHTML=this.abstract.mediaIcon,this.updateMediaContent(r);const{editor:i}=this.options;i.findBlockById(e.id)&&this.emit("mediaError",i,"empty",e.id),this.setFullScreen()}getResourceUrl(e,r){const{src:i}=e.embedData,{editor:s}=this.options;return s.doc.buildResourceUrl(i,{syncNewResources:async(o,l)=>{var d,h;if(!r)return;await s.doc.addResources([o]);const c=(h=(d=s.doc).getServerMeta)==null?void 0:h.call(d).appId;if(l!==e.embedData.src&&c&&e.embedData.src.includes(c)){const C=et(r);if(C&&!s.readonly&&s.isBlockWritable(C)){const E=Et.default(e);E.embedData.src=o,s.updateBlockData(C,E)}}}})}setFullScreen(){p(En,this.mediaContainer,"The media element not exist"),q(this.mediaContainer,"full-screen")}removeFullScreen(){p(En,this.mediaContainer,"The media element not exist"),ct(this.mediaContainer,"full-screen")}updateBlockAlign(e,r){const i=et(r);p(En,i,"The block element not exist");const{align:s}=e;e.embedType==="video"&&(i.hasAttribute("data-style-align")&&i.removeAttribute("data-style-align"),i.setAttribute("data-style-align",s))}render(e,r){const{src:i}=e.embedData;(!this.mediaContainer||!r.contains(this.mediaContainer))&&(this.mediaContainer=B("div",["media"],r)),this.updateBlockAlign(e,r),hZ(i)?i===lh.Empty&&this.renderEmpty(e):this.renderMediaElement(e,r)}setAbstract(e){this.abstract=e}}D("media-embed");const gZ="left";class NS{constructor(){m(this,"handleInsertEmptyEmbed",async(t,e)=>{var C;const{containerId:r,blockIndex:i}=e;let s;(C=e.data)!=null&&C.file&&(s=e.data.file);const o=fZ(t,this.embedType);if(s=s!=null?s:await Mc(o,{}),!s)return null;const{mediaType:l}=this.getAbstract();try{dZ(s,t,l)}catch{return null}const c={id:it(),type:"embed",embedType:this.embedType,embedData:{src:lh.Empty}};l==="video"&&(c.align=gZ);const d=t.insertBlock(r,i,c);return await this.getMedia(t,c.id).handleUploadFile(s),d})}getMedia(t,e){const r=t.addCustom(`media-${e}`,()=>new mZ({editor:t,createMediaElement:this.createMediaElement,updateMediaElement:this.updateMediaElement,createProgressElement:this.createProgressElement,updateProgressElement:this.updateProgressElement}));return r.setAbstract({...this.getAbstract()}),r}getOptions(){const{menuItem:t,mediaIcon:e,mediaName:r,order:i,group:s}=this.getAbstract();return{name:r,insertEmbedCommandItems:[{id:`insert-${this.embedType}`,name:t,icon:e,order:i,group:s,subText:Qn(`insert-${this.embedType}`)}],handleInsertEmptyEmbed:this.handleInsertEmptyEmbed}}createEmbedContent(t,e,r){const{id:i}=r;this.getMedia(t,i).render(r,e)}handleUpdateBlock(t,e,r){const{id:i}=r,s=this.getMedia(t,i),o=zt(e);return s.render(r,o),!0}handleDeleteBlock(t,e){const r=e.id,i=this.getMedia(t,r);i.removeAllListeners(),i.destroy()}convertTo(t,e,r,i){const s=e.embedData,o=t.doc.buildResourceUrl(s.src,{withToken:!0});return i==="html"?`<${s.type} src="${o}" />`:i==="markdown"?`![${s.src}](${o})`:o}}function PS(n,t){const e=B("div",["uploading-progress-mask"],n),r=B("div",["uploading-progress-bar"],e),i=B("div",["uploading-progress-bar-value"],r);i.style.width=`${t}%`}function FS(n,t){const e=n.querySelector(".uploading-progress-bar-value");e&&(e.style.width=`${t}%`)}const pZ=D("media-audio");class CZ extends NS{constructor(){super(...arguments);m(this,"embedType",Ui.AUDIO);m(this,"updateProgressElement",FS);m(this,"createMediaElement",(e,r,i,s)=>{const o=B("div",["audio-container","embed-hover-content","embed-selected-content"],r),l=B("audio",[],o);return l.innerHTML="Your browser does not support the <code>audio</code> element.",l.controls=!0,l.src=s,setTimeout(()=>{this.getMedia(e,i.id).setFullScreen()}),l})}getAbstract(){return{mediaIcon:VT,mediaName:_.t(`media.${Ui.AUDIO}.menuItem`),menuItem:_.t(`media.${Ui.AUDIO}.menuItem`),order:800,mediaType:Ui.AUDIO,group:"common"}}getBlockProperties(){return{abstract:`${_.t(`media.${Ui.AUDIO}.abstract`)}`}}updateMediaElement(e,r,i,s){const o=r.querySelector(":scope .audio-container > audio");return p(pZ,o,"The media element not exist"),o.src!==s&&(o.src=s),o}createProgressElement(e,r){const i=B("audio",[],e);i.innerHTML="Your browser does not support the <code>audio</code> element.",i.controls=!0,i.src="about:blank",PS(e,r)}}const EZ=new CZ;D("video-resizer");function KS(n){return n&&Le(n)&&on(n)==="video"}const AZ=50;class kx{constructor(t){m(this,"currentResizableElement",null);m(this,"resizing",!1);m(this,"handleHoveringBlockChange",(t,e)=>{if(!this.resizing&&!window.isDragging&&(e&&KS(e)&&this.disableBlockResize(e),t&&KS(t)&&this.editor.isBlockWritable(t))){const r=this.getVideoElement(t);if(!r)return;this.enableBlockResize(t,r)}});m(this,"handleResizing",(t,e)=>{if(this.resizing=!0,!this.currentResizableElement)return;const r=t.getBlock();if(!r)return;const i=r.getBoundingClientRect().width,s=Math.min(Math.max(e.width,AZ),i);this.currentResizableElement.style.width=`${s}px`,this.currentResizableElement.style.pointerEvents="none"});m(this,"handleResized",t=>{this.resizing=!1;const e=t.getBlock();if(!this.currentResizableElement||!e)return;const r=this.editor.getBlockData(e),{width:i}=this.currentResizableElement.getBoundingClientRect();this.currentResizableElement.style.pointerEvents="auto",this.editor.updateBlockData(e,{...r,width:i})});this.editor=t,$e.get(t).addListener("change",this.handleHoveringBlockChange)}destroy(){this.currentResizableElement=null,$e.get(this.editor).removeListener("change",this.handleHoveringBlockChange)}getVideoElement(t){return zt(t).querySelector(":scope .video-container > video")}updateResizer(t){const e=this.editor.findCustom(`${ut(t)}-resizer`);e&&e.updateResizer()}disableBlockResize(t){const e=this.editor.findCustom(`${ut(t)}-resizer`);e&&e.disableResize()}enableBlockResize(t,e){const r=this.editor.addCustom(`${ut(t)}-resizer`,()=>new Pd(this.editor,{resize:["top-left","top-right","bottom-left","bottom-right"]}));r.enableResize(t,e),r.removeListener("resizing",this.handleResizing),r.removeListener("resized",this.handleResized),r.addListener("resizing",this.handleResizing),r.addListener("resized",this.handleResized),this.currentResizableElement=e}}const xZ=D("video");class bZ extends NS{constructor(){super(...arguments);m(this,"embedType",Ui.VIDEO);m(this,"updateProgressElement",FS);m(this,"createMediaElement",(e,r,i,s)=>{const o=B("div",["video-container","embed-selected-content","drag-preview-element"],r),l=B("video",[],o);return l.innerHTML="Your browser does not support the <code>video</code> element.",l.controls=!0,l.src=s,l.addEventListener("canplay",()=>{e.addCustom("video-resizer",()=>new kx(e)),this.getMedia(e,i.id).removeListener("mediaError",this.handleMediaError),this.getMedia(e,i.id).addListener("mediaError",this.handleMediaError),this.getMedia(e,i.id).removeFullScreen()}),i.width&&(l.style.width=`${i.width}px`),l});m(this,"createProgressElement",(e,r,i)=>{const s=B("video",["progress-video"],e);s.innerHTML="Your browser does not support the <code>audio</code> element.",s.controls=!0,PS(e,r),_c(i).then(o=>{const l=e.querySelector(".progress-video");l&&l1(e)&&(l.src=o)})})}getAbstract(){return{mediaName:_.t(`media.${Ui.VIDEO}.menuItem`),mediaIcon:$T,menuItem:_.t(`media.${Ui.VIDEO}.menuItem`),order:700,mediaType:Ui.VIDEO,group:"common"}}getBlockProperties(){return{abstract:`${_.t(`media.${Ui.VIDEO}.abstract`)}`}}handleMediaError(e,r,i){const s=e.addCustom("video-resizer",()=>new kx(e)),o=e.getBlockById(i);s.disableBlockResize(o)}updateMediaElement(e,r,i,s){const o=r.querySelector(":scope .video-container > video");p(xZ,o,"The media element not exist"),o.src!==s&&(o.src=s),i.width?o.style.width=`${i.width}px`:o.style.width="";const l=e.getBlockById(i.id);return setTimeout(()=>{e.addCustom("video-resizer",()=>new kx(e)).updateResizer(l)}),o}}const vZ=new bZ,VS=[uA,EA,AA,Dk],Rx=[LS,vQ,IJ,KJ,qJ,NK,iZ,vZ,EZ,_z,lS,gX],$S=[jk,uS,_4];function BZ(n,t,e){var i,s,o,l;hi.level=(i=e.logLevel)!=null?i:qo.DEBUG;const r=Zf(n,t,{components:{blocks:[...VS,...((s=e==null?void 0:e.components)==null?void 0:s.blocks)||[]],embeds:[...Rx,...((o=e.components)==null?void 0:o.embeds)||[]],boxes:[...$S,...((l=e.components)==null?void 0:l.boxes)||[]],textRenders:[new WE],options:{...e.componentsOptions}}});return r.readonly=!0,r.addCustom("heading-collapse",()=>new fx(r)),r.addCustom("editor-tooltip",()=>new Ld(r)),r.addListener("clickLink",(c,d,h)=>{var E;if((E=e==null?void 0:e.events)!=null&&E.onClickLink){e.events.onClickLink(c,d,h);return}const C=h.getAttribute("link");C&&(c.readonly||d.ctrlKey||d.metaKey)&&window.open(C,"_blank")}),r}class HS{constructor(t){this.createOptions=t,t.lang&&_.setLang(t.lang)}createHistoryEditor(t,e){return BZ(t,e,this.createOptions)}}function jS(n,{root:t,childDoc:e,doc:r}){var h,C;e.uploadResource=r.uploadResource.bind(r),e.buildResourceUrl=r.buildResourceUrl.bind(r);const i=n.getComponentOptions("comment"),s={image:{defaultAlign:"left"},table:{locatingContainer:t,hideCellMenu:!0,hideToolbar:!0},...i==null?void 0:i.componentsOptions},o=[];n.editorBlocks.forEach(E=>{E.blockType==="text"||E.blockType==="embed"||o.push(E)});const l=[];n.editorEmbeds.forEach(E=>{l.push(E)});const c=[];n.editorBoxes.forEach(E=>{E.boxType==="text"||E.boxType==="br"||E.boxType==="image"||E.boxType==="anchor"||c.push(E)});const d=Zf(t,e,{shortcuts:[s0],components:{blocks:o,commandProviders:[new P0],decorators:[new fg],embeds:l,boxes:c,options:s}});if(d.input.addHandler(new hg),d.input.addHandler(new PA(d)),d.input.addHandler(new jA(d)),d.input.addHandler(new Tq(d)),d.input.addHandler(new Cg),d.addCustom("image-paste-handler",()=>new NA(d)),xe.isMobile||d.addCustom("editor-tooltip",()=>new Ld(d)),n.options.enableContextMenu!==!1&&d.addCustom("editor-context-menu",E=>new WA(E)),(h=n.options.componentsOptions)!=null&&h.mention){const E=n.options.componentsOptions.mention;d.addCustom("mention",()=>new cS(d,{...E}))}if((C=n.options.componentsOptions)!=null&&C.comment){const E=n.options.componentsOptions.comment;E.onCommentEditorClick&&d.addListener("click",E.onCommentEditorClick)}return d}function yZ(n,t){const e=Array.from(n.rootContainer.querySelectorAll(`[comment-${t.toLocaleLowerCase()}="${t}"]`)),r=new Set;e.forEach(i=>{const s=et(i);s&&r.add(s)}),r.forEach(i=>{kq(n,i,t)})}class TZ{constructor(t){m(this,"listeners",new Set);m(this,"doc");this.editor=t,this.doc=this.editor.doc.externalDoc,this.doc.registerCallback(this)}getComments(){return this.doc.getComments()}getComment(t){return this.doc.getComment(t)}getCommentDoc(t){return this.doc.getCommentDoc(t)}localCreateComment(t,e){this.doc.localCreateComment(t,e)}localDeleteComment(t){const e=this.getComment(t);this.doc.localDeleteComment(t);const r=e.groupId;this.getComments().filter(s=>s.groupId===r).length===0&&yZ(this.editor,r)}localUpdateComment(t,e){this.doc.localUpdateComment(t,e)}onCreateComment(t,e){Array.from(this.listeners.values()).forEach(r=>r.onCreateComment(t,e))}onDeleteComment(t,e){Array.from(this.listeners.values()).forEach(r=>r.onDeleteComment(t,e))}onUpdateComment(t,e){Array.from(this.listeners.values()).forEach(r=>r.onUpdateComment(t,e))}addListener(t){this.listeners.add(t)}removeListener(t){this.listeners.delete(t)}createCommentEditor(t,e){return jS(this.editor,{root:t,childDoc:e,doc:this.doc})}allowEdit(t){return t.userId===this.doc.getUser().userId}}class kZ{constructor(t,e){m(this,"listeners",new Set);this.editor=t,this.localDoc=e}get doc(){return this.localDoc.toJSON()}getComments(){return Object.values(this.doc.comments)}getComment(t){return this.doc.comments[t]}getCommentDoc(t){const e=this.doc.comments[t];return zC(e)}addListener(t){this.listeners.add(t)}removeListener(t){this.listeners.delete(t)}localCreateComment(t,e){}localDeleteComment(t){}localUpdateComment(t,e){}createCommentEditor(t,e){return jS(this.editor,{root:t,childDoc:e,doc:this.localDoc})}allowEdit(t){return t.userId===this.localDoc.getUser().userId}}const RZ={placeholder:{common:{title:"\u8BF7\u8F93\u5165\u6807\u9898",readonlyTitle:"\u8BF7\u8F93\u5165\u6807\u9898",content:"\u70B9\u51FB + \uFF0C\u6216\u8F93\u5165 / \u5FEB\u6377\u63D2\u5165\u7EC4\u4EF6",contentInTable:"\u8F93\u5165 / \u5FEB\u6377\u63D2\u5165\u7EC4\u4EF6"},local:{readonlyTitle:"\u672A\u547D\u540D"}},copyCutProperty:{copy:"\u590D\u5236",cut:"\u526A\u5207",unsafeEnvTips:"\u7531\u4E8E\u5F53\u524D http \u8BBF\u95EE\u73AF\u5883\u4E0B\u7684\u9650\u5236\uFF0C\u8BF7\u4F7F\u7528\u5FEB\u6377\u952E({shortCut}) {operation}",limitedEnvTips:"\u7531\u4E8E\u6D4F\u89C8\u5668\u9650\u5236\uFF0C\u8BF7\u4F7F\u7528 {shortCut} \u7C98\u8D34"}},wZ={placeholder:{common:{title:"Enter a title",readonlyTitle:"Enter a title",content:'Click "+", or enter "/" to insert components quickly',contentInTable:'Enter "/" to insert components quickly'},local:{readonlyTitle:"Untitled"}},copyCutProperty:{copy:"Copy",cut:"Cut",unsafeEnvTips:"Due to the limitations of the current http access environment, please use the shortcut ({shortCut}) {operation}",limitedEnvTips:"Press {shortCut} to paste due to browser restrictions"}},SZ={placeholder:{common:{title:"\u30BF\u30A4\u30C8\u30EB\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",readonlyTitle:"\u30BF\u30A4\u30C8\u30EB\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",content:"\u300C+\u300D\u3092\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u304B\u3001\u300C/\u300D\u3092\u5165\u529B\u3059\u308B\u3068\u3001\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u304C\u7D20\u65E9\u304F\u633F\u5165\u3067\u304D\u307E\u3059",contentInTable:"\u300C/\u300D\u3092\u5165\u529B\u3059\u308B\u3068\u3001\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u304C\u7D20\u65E9\u304F\u633F\u5165\u3067\u304D\u307E\u3059"},local:{readonlyTitle:"\u7121\u984C"}},copyCutProperty:{copy:"\u8907\u88FD",cut:"\u5207\u308B",unsafeEnvTips:"HTTP\u74B0\u5883\u306E\u5236\u7D04\u306B\u3088\u308A\u3001{operation}\u3059\u308B\u306B\u306F\u3001\u30B7\u30E7\u30FC\u30C8\u30AB\u30C3\u30C8({shortCut}) \u3092\u3054\u4F7F\u7528\u304F\u3060\u3055\u3044",limitedEnvTips:"\u30D6\u30E9\u30A6\u30B6\u30FC\u306E\u5236\u9650\u306B\u3088\u308A\u3001\u300C{shortCut}\u300D\u3092\u4F7F\u7528\u3057\u3066\u8CBC\u308A\u4ED8\u3051\u3066\u304F\u3060\u3055\u3044"}};_.mergeLang({"zh-CN":RZ,"en-US":wZ,"ja-JP":SZ});const LZ="UEsDBBQABgAIAAAAIQBk9WPugQEAACkGAAATAAgCW0NvbnRlbnRfVHlwZXNdLnhtbCCiBAIooAACAAAAAAAAAAAAAAAAA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AABIAAAAAAAAAAAAAAAAAWzsAAHdvcmQvZm9udFRhYmxlLnhtbFBLBQYAAAAADwAPANQDAADePgAAAAA=",IZ=()=>$p(LZ),DZ=D("image-to-docx");async function _Z(n){return new Promise((t,e)=>{const r=new Image;r.onload=()=>{t({width:r.naturalWidth,height:r.naturalHeight})},r.onerror=e,r.src=n})}async function zS(n,t){if(n.width&&n.height)return{width:n.width,height:n.height,buffer:t};try{const e=await _c(new File([t],"",{})),r=await _Z(e);return r.width===void 0||r.height===void 0?{width:345,height:230,buffer:t}:n.width||n.height?{width:n.width||r.width*n.height/r.height,height:n.height||r.height*n.width/r.width,buffer:t}:{width:r.width,height:r.height,buffer:t}}catch(e){DZ.error(e);return}}function MZ(n,t){let e=n.filter(o=>o!=null);const r=t-(e.length-1)*20,i=.87,s=e.reduce((o,l)=>o+l.width,0);return s>r&&(e=e.map(o=>({width:o.width*r/s,height:o.height*r/s,buffer:o.buffer}))),e.map(o=>({width:o.width*i,height:o.height*i,buffer:o.buffer}))}function UZ(n,t,e){if(!e||typeof e!="object")return;const r=e,i=n.filter(o=>o!=null),s=t-(i.length-1)*20;i.forEach((o,l)=>{if(i.length===1&&r.widthPercent){const d=r.widthPercent,h=o.width;o.width=s*(d/100),o.height*=o.width/h;return}const c=`${l}_flex`;if(r[c]){const d=r[c],h=o.width;o.width=s*d,o.height*=o.width/h}})}function GS(n=[0,1,2,3,4,5,6,7],t=1){return n.map(e=>{let r;switch(e%3){case 0:r=Bt.LevelFormat.DECIMAL;break;case 1:r=Bt.LevelFormat.LOWER_LETTER;break;default:r=Bt.LevelFormat.LOWER_ROMAN;break}return{level:e,format:r,text:`%${e+1}. `,alignment:Bt.AlignmentType.START,start:t,style:{paragraph:{indent:{left:Bt.convertInchesToTwip(.3*(e+1)),hanging:Bt.convertInchesToTwip(.2)}}}}})}function OZ(){return[0,1,2,3,4,5,6,7].map(n=>{let t;switch(n%3){case 0:t="\u2022";break;case 1:t="\u25E6";break;default:t="\u25AA";break}return{level:n,format:Bt.LevelFormat.BULLET,text:t,alignment:Bt.AlignmentType.START,style:{paragraph:{indent:{left:Bt.convertInchesToTwip(.3*(n+1)),hanging:Bt.convertInchesToTwip(.2)}}}}})}function NZ(){return[0,1,2,3,4,5,6,7].map(n=>({level:n,format:Bt.LevelFormat.BULLET,text:"\u2611",alignment:Bt.AlignmentType.START,style:{paragraph:{indent:{left:Bt.convertInchesToTwip(.3*(n+1)),hanging:Bt.convertInchesToTwip(.2)}}}}))}function PZ(){return[0,1,2,3,4,5,6,7].map(n=>({level:n,format:Bt.LevelFormat.BULLET,text:"\u2610",alignment:Bt.AlignmentType.START,style:{paragraph:{indent:{left:Bt.convertInchesToTwip(.3*(n+1)),hanging:Bt.convertInchesToTwip(.2)}}}}))}var ah=(n=>(n.NUMBERING="number-numbering-reference",n.BULLET="number-bullet-reference",n.CHECKED="checked-bullet-reference",n.UNCHECKED="unchecked-bullet-reference",n))(ah||{});const FZ=[{levels:GS(),reference:"number-numbering-reference"},{levels:OZ(),reference:"number-bullet-reference"},{levels:NZ(),reference:"checked-bullet-reference"},{levels:PZ(),reference:"unchecked-bullet-reference"}];function KZ(n){switch(n){case"style-color-0":return"d83931";case"style-color-1":return"de7802";case"style-color-2":return"dc9b04";case"style-color-3":return"2ea121";case"style-color-4":return"245bdb";case"style-color-5":return"6425d0";case"style-color-6":return"8f959e";default:return}}function VZ(n){switch(n){case"style-bg-color-1":case"style-bg-color-2":case"style-bg-color-8":case"style-bg-color-9":return"yellow";case"style-bg-color-0":case"style-bg-color-5":return"magenta";case"style-bg-color-3":return"green";case"style-bg-color-4":case"style-bg-color-11":return"blue";case"style-bg-color-6":return"lightGray";case"style-bg-color-7":return"red";case"style-bg-color-10":return"darkGreen";case"style-bg-color-12":return"darkMagenta";case"style-bg-color-13":return"darkGray";default:return}}function $Z(n){switch(n){case"style-bg-color-0":return"fbbab6";case"style-bg-color-1":return"ffdcb0";case"style-bg-color-2":return"fff7a0";case"style-bg-color-3":return"ceefc5";case"style-bg-color-4":return"d1ddfb";case"style-bg-color-5":return"d9cbf8";case"style-bg-color-6":return"eaeaea";case"style-bg-color-7":return"fe837c";case"style-bg-color-8":return"ffbd6a";case"style-bg-color-9":return"ffe662";case"style-bg-color-10":return"a8f393";case"style-bg-color-11":return"98b5ff";case"style-bg-color-12":return"b394f8";case"style-bg-color-13":return"b1b1b1";default:return}}const HZ=/rgb\((\d+),\s*(\d+),\s*(\d+)\)/;function WS(n){if(typeof n=="string"&&n.length>0){if(n[0]==="#")return n.substring(1);const t=n.match(HZ);if(t){const e=o=>{let l=Number(o).toString(16);return l.length<2&&(l=`0${l}`),l},r=e(t[1]),i=e(t[2]),s=e(t[3]);return`${r}${i}${s}`}if(n==="red")return"FF0000";if(n==="green")return"00FF00";if(n==="blue")return"0000FF"}}function Mn(n,t){if(n&&n.attributes&&n.attributes[t])return n.attributes[t];if(n&&n.attributes&&n.attributes.box&&n.attributes.inputType&&t==="style-underline")return!0}function qS(n,t,e){for(let r=0;r<=e;++r){const i=`${t}${r}`;if(Mn(n,i))return i}}function Kg(n,t,e){n.attributes=n.attributes||{},n.attributes[t]=e}function wx(n){return n==="image"||n==="drawio"||n==="plantuml"||n==="mermaid"||n==="flowchart"}function XS(n){return n&&n.startsWith("//")?`https:${n}`:n&&!n.startsWith("http://")&&!n.startsWith("https://")?`https://${n}`:n}function jZ(n){const t=Mn(n,"inlineStyle");if(t==null)return;const e=t.split(";");for(const r of e){const i=r.split(":");if(i.length!==2)continue;const s=i[0].trim().toLowerCase(),o=i[1].trim().toLowerCase();s==="font-size"&&Kg(n,"inline-style-font-size",o),s==="color"&&Kg(n,"inline-style-color",o),s==="background-color"&&Kg(n,"inline-style-background-color",o),s==="font-family"&&Kg(n,"inline-style-font-family",o)}}function zZ(n,t){if(t==null)return n==null?void 0:n.normal;if(n)return n[`heading${t}`]}function GZ(n){const t=`${Mn(n,"inline-style-font-size")}`;if(t&&t.indexOf("px")>0)return+t.replace(/px/g,"")}function WZ(n){if(n.attributes&&n.attributes.box&&n.attributes.text)return` ${n.attributes.text} `;if(n.attributes&&n.attributes.box&&n.attributes.inputType)return n.attributes.value?`${n.attributes.value}`:" "}function qZ(n){if(n.attributes&&n.attributes.box&&n.attributes.text)return` @${n.attributes.text} `}function XZ(n){return Mn(n,"inline-style-font-family")}function YZ(n){const t=Mn(n,"inline-style-background-color");return WS(t)}function QZ(n){const t=Mn(n,"inline-style-color");return WS(t)}function JZ(n){jZ(n);const t=Mn(n,"type")==="mention";return{box:n.attributes&&n.attributes.box?n.attributes:void 0,inlineCode:!!Mn(n,"style-code"),link:XS(Mn(n,"link")),size:GZ(n),text:t?qZ(n):WZ(n)||n.insert,bold:!!Mn(n,"style-bold"),underline:!!Mn(n,"style-underline"),italics:!!Mn(n,"style-italic"),strike:!!Mn(n,"style-strikethrough"),superScript:!!Mn(n,"style-super"),subScript:!!Mn(n,"style-sub"),math:Mn(n,"type")==="math"?Mn(n,"src"):void 0,mention:t,fontFamily:XZ(n),background:YZ(n),color:t?"338fe5":KZ(qS(n,"style-color-",6))||QZ(n),highlight:qS(n,"style-bg-color-",13)}}function ZZ(){return[new Bt.Paragraph({border:{top:{color:"auto",style:Bt.BorderStyle.DASHED,size:4,space:1}},spacing:{before:300}}),new Bt.Paragraph({spacing:{line:0}})]}function ttt(){return new Bt.Paragraph({children:[new Bt.TextRun({text:"[\u89C6\u9891\u6682\u4E0D\u652F\u6301\u5BFC\u51FA]",shading:{type:Bt.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}})]})}function ett(){return new Bt.Paragraph({children:[new Bt.TextRun({text:"[\u97F3\u9891\u6682\u4E0D\u652F\u6301\u5BFC\u51FA]",shading:{type:Bt.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}})]})}function ntt(n,t){return new Bt.Paragraph({children:[new Bt.ExternalHyperlink({children:[new Bt.TextRun({style:"Hyperlink",text:t||n})],link:n})]})}function YS(n){if(n.heading!=null)return`Heading${n.heading}`}function QS(n){if(n.alignment!=null){if(n.alignment==="center")return Bt.AlignmentType.CENTER;if(n.alignment==="right")return Bt.AlignmentType.RIGHT;if(n.alignment==="left")return Bt.AlignmentType.LEFT}}function rtt(n){if(n.indent)return{left:Bt.convertInchesToTwip(.3*n.indent-.2)};if(n.padding)return{left:Bt.convertInchesToTwip(.3*n.padding)}}function itt(n){return{type:Bt.ShadingType.CLEAR,color:"FFFFFF",fill:n}}function stt(n){const t=n.split(",");if(t.length!==0)return t[0].trim()}function JS(n,t){var s;let e;e=n.inlineCode?"InlineCode":void 0,e=n.link?"Hyperlink":e;const r=n.size||t,i=r!=null?Math.floor(r*1.5+.5):void 0;return n.text=(s=n.text)==null?void 0:s.replace(/\x00/g," "),new Bt.TextRun({text:n.text,bold:n.bold||void 0,underline:n.underline?{type:Bt.UnderlineType.SINGLE}:void 0,italics:n.italics||void 0,strike:n.strike||void 0,superScript:n.superScript||void 0,subScript:n.subScript||void 0,size:i,style:e,font:n.fontFamily?stt(n.fontFamily):void 0,shading:n.background?itt(n.background):void 0,color:n.color,highlight:VZ(n.highlight)})}function ott(n,t){if(n.link)return n.link=n.link.replace(/\x00/g," "),new Bt.ExternalHyperlink({children:[JS(n,t)],link:n.link})}async function ZS(n,t,e,r,i){const[s]=await i(n,t,e);if(s==null)return;const o=await zS({width:r||0,height:0,src:e},s);return new Bt.ImageRun({data:s,transformation:{width:(o==null?void 0:o.width)||100,height:(o==null?void 0:o.height)||20}})}function ltt(n){if(n.heading||n.heading)return n.heading}function att(n){if(n.align&&(n.align==="center"||n.align==="right"||n.align==="left"))return n.align}function ctt(n){if(n.textOnly===!0&&n.level!=null)return n.level}async function utt(n,t){var r;const e=[];if(n.text&&Array.isArray(n.text)){for(let i=0;i<n.text.length;i++){const s=n.text[i];if(((r=s.attributes)==null?void 0:r.box)===!0&&t){const o=await t(s);if(o){n.text.splice(i+1,0,...o);continue}}e.push(JZ(s))}return e}}function ftt(n){if(n.type==="list"&&n.textOnly!==!0)return{checkbox:n.checkbox,groupId:n.groupId,ordered:!!n.ordered,level:n.level||1,start:n.start||0}}function dtt(n,t){if(n.type==="embed"&&n.embedType&&wx(n.embedType)&&n.embedData&&n.embedData.src)return n.embedData.src.split("|").map(r=>{const i=t(r),s=n.embedData[`${i}_width`],o=n.embedData[`${i}_height`];return{src:r,width:s,height:o}})}function htt(n){if(n.padding)return n.padding}function mtt(n){return!!(n.type==="embed"&&n.embedType&&wx(n.embedType)&&n.embedData&&n.embedData.src)}async function Vg(n,t,e){return{quoted:!!n.quoted,heading:ltt(n),alignment:att(n),indent:ctt(n),padding:htt(n),texts:await utt(n,e),list:ftt(n),images:dtt(n,t),border:mtt(n)}}async function gtt(n,t,e,r){const i=[];if(!n.children)return[];for(const s of n.children){const o=[];for(const l of t.blocks[s])o.push(await Vg(l,e,r));i.push(o)}return i}const ptt=D("to-docx");function Ctt(n,t){return Array(n).fill(0).map(()=>Array(t).fill(0).map(()=>({cellId:void 0,color:void 0,from:void 0,rowSpan:1,colSpan:1,width:0,originalWidth:void 0,align:void 0})))}function Ett(n,t,e,r){const i=!!n.hasColTitle,s=!!n.hasRowTitle,o=!!n.isStripeStyle,l="F5F8FB";for(let c=0;c<t;c++)for(let d=0;d<e;d++)(i&&d===0||s&&c===0||o&&c%2===1)&&(r[c][d].color=l)}function Att(n){p(ptt,n.children,"no table children");const t=n.rows,e=n.cols,r=n.colsWidth;if(r)for(let o=0;o<r.length;o++)r[o]===0&&(r[o]=100);const i=Ctt(t,e);let s=0;for(let o=0;o<t;++o)for(let l=0;l<e;++l){if(i[o][l].originalWidth=r?r[l]:void 0,i[o][l].from!==void 0)continue;const c=n.children[s];s+=1,i[o][l].cellId=c,i[o][l].color=$Z(n[`${c}_background`]),i[o][l].width=r?r[l]:100,i[o][l].align=n[`${c}_align`];const d=n[`${c}_rowSpan`]||1,h=n[`${c}_colSpan`]||1;if(i[o][l].rowSpan=d,i[o][l].colSpan=h,d>1||h>1){let C=0;for(let E=0;E<d;E++)for(let A=0;A<h;A++)E===0&&(C+=r?r[l+A]:80),!(E===0&&A===0)&&(i[o+E][l+A].from=[o,l]);i[o][l].width=C}}return Ett(n,t,e,i),i}async function xtt(n,t,e,r,i,s,o,l,c,d){async function h(E){if(l&&E.type!=="_exportVirtualBlock"){const A=await l(i,s,E);if(A){await r.addDoc(n,A,d);return}}if(E.type==="text"||E.textOnly===!0){const A=await Vg(E,o,c);await r.addTextBlock(A);return}if(E.type==="code"){const A=await gtt(E,e,o,c);await r.addCodeBlockObject(A);return}if(E.type==="list"&&E.textOnly!==!0){const A=await Vg(E,o,c);await r.addListBlockObject(n,A);return}if(E.type==="embed"&&E.embedType){const A=E,v=A.embedData,w=A.embedType;if(wx(w)){const S=await Vg(E,o,c);await r.addImagesBlockObject(E,S,d)}else E.embedType==="hr"?r.addSeparatorBlock():E.embedType==="video"?r.addVideoPlaceholder():E.embedType==="audio"?r.addAudioPlaceholder():E.embedType==="webpage"?r.addHyperlinkParagraph(XS(v.src),v.title):r.addOtherEmbedBlock(w,E.embedData);return}if(E.type==="table"){let A=[];if(E.colsWidth)A=E.colsWidth;else{const w=E.cols;A=new Array(w);for(let S=0;S<A.length;S++)A[S]=100;E.colsWidth=A}const v=Att(E);await r.addTableMatrix(A,v,e),r.addEmptyParagraph()}E.type==="_exportVirtualBlock"&&await r.addVirtualBlock(E.id,e,d)}function C(E){var w;const A=((w=E==null?void 0:E.embedData)==null?void 0:w.exportSpec)||(E==null?void 0:E.exportSpec);if(!A)return[E];const v=[];for(const{type:S,data:U}of A){if(S==="text"){const M={id:it(),text:[{insert:U}],type:"text"};v.push(M);continue}if(S==="image"){const M={id:it(),type:"embed",embedType:"image",align:"left",embedData:{src:U}};v.push(M);continue}if(S==="link"){const M={id:it(),type:"embed",embedType:"webpage",embedData:{src:U.url,title:U.title}};v.push(M);continue}if(S==="block")for(const M of U){if(!e.blocks[M])continue;const nt={id:M,type:"_exportVirtualBlock"};v.push(nt)}}return v}for(const E of t)for(const A of C(E))!A||await h(A)}function btt(){return{listMaxInst:1,listInstMap:{},listRefMap:{},levelConfigs:[]}}const vtt=D("to-docx");class Btt{constructor(t,e,r,i,s,o){m(this,"paragraphs");this.appId=t,this.docId=e,this.state=r,this.readImageFunc=i,this.convertBlocksFunc=s,this.defaultFontSize=o,this.paragraphs=[]}async addTextBlock(t){this.paragraphs.push(new Bt.Paragraph({heading:YS(t),alignment:QS(t),children:await this.paragraphsFromBlockTexts(t),indent:rtt(t)}))}async addEmptyImagePlaceHolder(){this.paragraphs.push(new Bt.Paragraph({text:`[${_.t("docx.imageExportFailed")}]`,shading:{type:Bt.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}}))}async paragraphsFromBlockTexts(t){if(t.texts==null)return;const e=zZ(this.defaultFontSize,t.heading),r=[];for(const i of t.texts){if(i.link){const s=ott(i,e);s&&r.push(s);continue}if(i.box&&i.box.type&&i.box.type==="br"){r.push(new Bt.TextRun({text:"",break:1}));continue}if(i.box&&i.box.type&&i.box.type==="image"){const s=await ZS(this.appId,this.docId,i.box.src,i.box.width,this.readImageFunc);s&&r.push(s);continue}if(i.math){const s=await ZS(this.appId,this.docId,i.math,0,this.readImageFunc);s&&r.push(s);continue}r.push(JS(i,e))}return r}async addCodeBlockObject(t){for(const e of t)for(const r of e){const i={style:Bt.BorderStyle.SINGLE,color:"#DEDEDE"};this.paragraphs.push(new Bt.Paragraph({style:"Code",border:{left:{...i},right:{...i},top:{...i},bottom:{...i}},children:await this.paragraphsFromBlockTexts(r)}))}}async addListBlockObject(t,e){if(e.list==null)return;let r;const i=e.list.checkbox?`${t}-${e.list.groupId}-${e.list.checkbox}`:`${t}-${e.list.groupId}`;if(this.state.listInstMap[i])r=this.state.listInstMap[i];else if(r=this.state.listMaxInst,this.state.listMaxInst+=1,this.state.listInstMap[i]=r,e.list.start>0&&e.list.ordered){const o=`number-numbering-reference-${r}`,l=GS([e.list.level-1],e.list.start);this.state.levelConfigs.push({levels:l,reference:o,inst:r}),this.state.listRefMap[i]=o}else e.list.ordered?this.state.listRefMap[i]=ah.NUMBERING:e.list.checkbox&&e.list.checkbox==="checked"?this.state.listRefMap[i]=ah.CHECKED:e.list.checkbox&&e.list.checkbox==="unchecked"?this.state.listRefMap[i]=ah.UNCHECKED:this.state.listRefMap[i]=ah.BULLET;const s=YS(e);e.texts&&this.paragraphs.push(new Bt.Paragraph({heading:s,children:await this.paragraphsFromBlockTexts(e),numbering:{reference:this.state.listRefMap[i],level:e.list.level-1,instance:r}}))}imageDimWithBufferToImageRun(t){return new Bt.ImageRun({data:t.buffer,transformation:{width:t.width,height:t.height}})}async addImagesBlockObject(t,e,r){if(e.images==null){if(t.type==="embed"&&t.embedType==="image"){const{src:c}=t.embedData;c||this.addEmptyImagePlaceHolder()}return}const i=[],s=await Promise.all(e.images.map(async c=>{const[d,h]=await this.readImageFunc(this.appId,this.docId,c.src);if(d){const C=await zS(c,d);if(C)return C}i.push(h)}));UZ(s,r,t.embedData);const o=MZ(s,r),l={style:Bt.BorderStyle.SINGLE,color:"#DEDEDE"};o.length&&this.paragraphs.push(new Bt.Paragraph({border:e.border?{left:{...l},right:{...l},top:{...l},bottom:{...l}}:void 0,alignment:QS(e)||Bt.AlignmentType.CENTER,children:o.map(c=>this.imageDimWithBufferToImageRun(c)).flatMap((c,d,h)=>c==null?[]:h.length-1!==d?[c,new Bt.TextRun({text:" "})]:c)})),i.forEach(c=>{this.addHyperlinkParagraph(c)})}addSeparatorBlock(){ZZ().forEach(t=>this.paragraphs.push(t))}addEmptyParagraph(){this.paragraphs.push(new Bt.Paragraph(""))}addVideoPlaceholder(){this.paragraphs.push(ttt())}addAudioPlaceholder(){this.paragraphs.push(ett())}addHyperlinkParagraph(t,e){t!=null&&this.paragraphs.push(ntt(t,e))}async addTableMatrix(t,e,r){const i=t.map(s=>s!==0?s*15:1500);this.paragraphs.push(new Bt.Table({rows:await this.generateTableRows(e,r),columnWidths:i}))}async generateRowCells(t,e){const r=[];for(const i of t){const s=i.cellId;if(s===void 0)continue;const o=i.width*.9;r.push(new Bt.TableCell({children:await this.convertBlocksFunc(s,e.blocks[s],e,this.appId,this.docId,this.state,o),columnSpan:i.colSpan,rowSpan:i.rowSpan,width:{type:Bt.WidthType.DXA,size:i.width*15},shading:i.color?{fill:i.color,type:Bt.ShadingType.CLEAR,color:"auto"}:void 0}))}return r}async generateTableRows(t,e){const r=[];for(const i of t)r.push(new Bt.TableRow({children:await this.generateRowCells(i,e)}));return r}async addDoc(t,e,r){const i=await this.convertBlocksFunc(t,e.blocks.root,e,this.appId,this.docId,this.state,r);i&&(this.paragraphs=this.paragraphs.concat(i))}async addVirtualBlock(t,e,r){const i=await this.convertBlocksFunc(t,e.blocks[t],e,this.appId,this.docId,this.state,r);this.paragraphs.push(...i)}async addOtherEmbedBlock(){}}class ytt{constructor(t,e,r,i,s,o,l,c){m(this,"convertBlocks",async(t,e,r,i,s,o,l=720)=>{const c=new Btt(i,s,o,this.readImage,this.convertBlocks,this.defaultFontSize);return await xtt(t,e,r,c,i,s,this.md5HexFunc,this.getDocByBlock,this.getTextsByBox,l||720),c.paragraphs});this.templateData=t,this.docData=e,this.md5HexFunc=r,this.readImage=i,this.defaultFontSize=s,this.getDocByBlock=o,this.getTextsByBox=l,this.backgroundImageOptions=c}async convert(t,e){return this.snapshot2docx(this.docData,t,e)}async snapshot2docx(t,e,r){const i=new Bt.ImportDotx,s=this.templateData?await i.extract(this.templateData):void 0,o=t.blocks.root;p(vtt,o,"data must have blocks");const l=btt(),c=await this.convertBlocks("blocks",o,t,e,r,l),d=this.backgroundImageOptions?{default:new Bt.Header({children:[new Bt.Paragraph({children:[new Bt.ImageRun(this.backgroundImageOptions)]})]})}:{},h=new Bt.Document({numbering:{config:[...FZ,...l.levelConfigs]},sections:[{headers:d,children:c,properties:{page:{size:{width:12240,height:15840},margin:{top:1440,bottom:1440,left:1440,right:1440}}}}]},{template:s});return Bt.Packer.toBlob(h)}}const Ttt=D("editor-to-docx");async function ktt(n,t,e,r){const i=n.doc.buildResourceUrl(r,{withToken:!0});let s=await CS(i);if(!s)return[void 0,i];if(s.type.indexOf("/svg")!==-1){const l=await mS(s);l&&(s=new File([l],s.name))}return[await s.arrayBuffer(),i]}async function Rtt(n,t,e){const r=n.editorBlocks.getBlockClass(e.type);if(r.toStandardDoc)try{return await r.toStandardDoc(n,e,t)}catch(i){Ttt.error(`toStandardDoc error: ${JSON.stringify(i)}`);return}}async function wtt(n,t){const e=t.attributes,r=n.editorBoxes.getBoxClass(e.type);if(r.toStandardText)return r.toStandardText(n,e)}async function Stt(n,t){let{template:e,download:r,backgroundImageOptions:i}=t!=null?t:{};e||(e=IZ());const s=n.doc.toJSON(),o=(C,E,A)=>ktt(n,C,E,A),l=async(C,E,A)=>Rtt(n,s,A),c=async C=>wtt(n,C),h=await new ytt(e,s,nm.default,o,void 0,l,c,i).convert("_appId","_docId");if(r){const C=URL.createObjectURL(h),E=document.createElement("a");E.setAttribute("download",`${pS(n)}.docx`),E.setAttribute("href",`${C}`),E.click(),E.remove()}return h}const Sx=D("create-editor");async function Ltt(n,t){var o,l,c,d,h,C,E,A,v,w,S,U,M,V,nt,Y;p(Sx,n,"app does not exists"),t.lang&&_.setLang(t.lang),hi.level=(o=t.logLevel)!=null?o:qo.DEBUG;const e=t.onReauth?async()=>{var bt;const X=t.user.userId,ft=t.docId,xt=await((bt=t.onReauth)==null?void 0:bt.call(t,X,ft,t.permission));return{userId:X,docId:ft,permission:t.permission,appId:t.appId,token:xt,displayName:t.user.displayName,avatarUrl:t.user.avatarUrl}}:void 0,r={auth:{appId:t.appId,docId:t.docId,userId:t.user.userId,permission:t.permission,token:t.token,displayName:t.user.displayName,avatarUrl:t.user.avatarUrl},serverUrl:t.serverUrl,reauthFunc:e,disableLogout:t.disableLogout,onMaxUsersError:t.onMaxUsersError},i=await hd.load(r),s=Zf(n,i,{id:t.id,scrollContainer:t==null?void 0:t.scrollContainer,enableComments:t==null?void 0:t.enableComments,enableContextMenu:t==null?void 0:t.enableContextMenu,components:{blocks:[...VS,...((l=t==null?void 0:t.components)==null?void 0:l.blocks)||[]],embeds:[...Rx,...((c=t.components)==null?void 0:c.embeds)||[]],boxes:[...$S,...((d=t.components)==null?void 0:d.boxes)||[]],commandProviders:[new P0,...((h=t.components)==null?void 0:h.commandProviders)||[]],decorators:[new fg,new WC],insertions:[G1],blockHooks:[new DA,new lw,...((C=t.components)==null?void 0:C.blockHooks)||[]],textRenders:[new T4,new WE,...((E=t.components)==null?void 0:E.textRenders)||[]],options:{...t.componentsOptions}},shortcuts:[Nq,fH,Bz,fA,Qw,AF,sA,bX,s0,dF,...t.shortcuts||[]],colors:["#0064FF","#EB3723","#F59300","#00A865","#F25A0A","#70A310","#009CAD","#0990D9","#8851ED","#D62069"]});if(s.editorCommandProviders.registerCommandProvider(new ms(s)),s.input.addHandler(new uY),s.input.addHandler(new hg),s.input.addHandler(new $K),s.input.addHandler(new gz),s.input.addHandler(new xA(s,{hideTitle:t.hideTitle,headingLevel:1,titlePlaceholder:_.t("placeholder.common.title"),contentPlaceholder:_.t("placeholder.common.content"),readonlyTitlePlaceholder:_.t("placeholder.common.readonlyTitle"),addPlaceholderToAllCurrentEmptyBlock:!0,applyContentPlaceholder:(A=t.placeholder)==null?void 0:A.applyContentPlaceholder})),s.input.addHandler(new sg(s,(v=t.componentsOptions)==null?void 0:v.quickMenu)),s.input.addHandler(new PA(s)),s.input.addHandler(new jA(s)),s.input.addHandler(new Cg),s.input.addHandler(new Ik),s.doc.registerCallback(new fY(s)),s.addCustom("remote-cursor",()=>new uT(s)),s.addCustom("block-menu",X=>new uw(X)),xe.isMobile||s.addCustom("editor-tooltip",()=>new Ld(s)),t!=null&&t.enableComments&&s.addCustom("editor-comments",X=>new y4(X,new TZ(X))),t.enableContextMenu!==!1&&s.addCustom("editor-context-menu",X=>new WA(X)),s.addCustom("create-options",()=>new Db(s,t)),s.addCustom("drop-target",()=>new qd(s)),s.addCustom("list-to-mindmap",()=>new Z0(s)),s.addCustom("list-to-mention",()=>new DY(s)),s.addCustom("mobile-helper",()=>new tQ(s)),s.addCustom("code-caret",()=>new lH(s)),s.addCustom("image-paste-handler",()=>new NA(s)),(w=t.componentsOptions)!=null&&w.mention){const X=t.componentsOptions.mention;s.addCustom("mention",()=>new cS(s,X))}if(s.addCustom("heading-collapse",()=>new fx(s)),s.addCustom(Pg,X=>new Ex(X)),Au.register(s),qd.register(s),Ll.register(s),yl.register(s),s.addListener("clickLink",(X,ft,xt)=>{var wt;if((wt=t==null?void 0:t.events)!=null&&wt.onClickLink){t.events.onClickLink(X,ft,xt);return}const bt=xt.getAttribute("link");bt&&(X.readonly||ft.ctrlKey||ft.metaKey)&&window.open(bt,"_blank")}),(U=(S=t.componentsOptions)==null?void 0:S.remoteCarets)!=null&&U.onUserChanged){const X=(V=(M=t.componentsOptions)==null?void 0:M.remoteCarets)==null?void 0:V.onUserChanged;s.doc.getRemoteUsers().on("change",ft=>{X(s,ft)})}return(Y=(nt=t.componentsOptions)==null?void 0:nt.templates)!=null&&Y.templates.length&&(s.addListener("docChanged",()=>{Ng(s)}),s.addListener("resize",()=>{Ng(s,{reset:!0})}),setTimeout(()=>{Ng(s)},100)),s.doc.registerCallback({onError:async X=>{if(X.code==="ResetDoc"){Sx.error(`reset doc: ${X.message}`);const ft=await hd.load(r);s.doc.reset(ft)}}}),s.version="1.1.27-beta.2",hi.level===qo.DEBUG&&(window.setReauthFail=X=>{window.isReauthError=X},window.reConnect=X=>s.doc.externalDoc.client.connection.reConnect(X)),s}function Itt(n){return n.toJSON!==void 0}async function Dtt(n,t,e){var s,o,l,c,d,h,C,E;p(Sx,n,"app does not exists");const r=Itt(t)?t:new TC(t,{serverUrl:e.serverUrl||""});e.lang&&_.setLang(e.lang),hi.level=(s=e.logLevel)!=null?s:qo.DEBUG;const i=Zf(n,r,{id:e.id,scrollContainer:e==null?void 0:e.scrollContainer,components:{blocks:[uA,EA,AA,Dk,...(l=(o=e.components)==null?void 0:o.blocks)!=null?l:[]],commandProviders:[new P0],decorators:[new fg,new WC],embeds:[...Rx,...((c=e.components)==null?void 0:c.embeds)||[]],boxes:[jk,uS,_4,...((d=e.components)==null?void 0:d.boxes)||[]],insertions:[G1],blockHooks:[new DA,...((h=e.components)==null?void 0:h.blockHooks)||[]],textRenders:[new T4,new WE,...((C=e.components)==null?void 0:C.textRenders)||[]],options:{...e.componentsOptions}},shortcuts:[fA,Qw,sA,s0]});return i.editorCommandProviders.registerCommandProvider(new ms(i)),i.input.addHandler(new hg),i.input.addHandler(new xA(i,{hideTitle:e.hideTitle,headingLevel:1,titlePlaceholder:_.t("placeholder.common.title"),contentPlaceholder:_.t("placeholder.common.content"),readonlyTitlePlaceholder:_.t("placeholder.local.readonlyTitle"),addPlaceholderToAllCurrentEmptyBlock:!0})),i.input.addHandler(new sg(i,(E=e.componentsOptions)==null?void 0:E.quickMenu)),i.input.addHandler(new PA(i)),i.input.addHandler(new jA(i)),i.input.addHandler(new Cg),i.input.addHandler(new Ik),i.addCustom("block-menu",A=>new uw(A)),xe.isMobile||i.addCustom("editor-tooltip",()=>new Ld(i)),i.addCustom("image-paste-handler",()=>new NA(i)),e!=null&&e.enableComments&&i.addCustom("editor-comments",A=>new y4(A,new kZ(A,r))),e.enableContextMenu!==!1&&i.addCustom("editor-context-menu",A=>new WA(A)),i.addCustom("heading-collapse",()=>new fx(i)),i.addListener("clickLink",(A,v,w)=>{var U;if((U=e==null?void 0:e.events)!=null&&U.onClickLink){e.events.onClickLink(A,v,w);return}const S=w.getAttribute("link");S&&(A.readonly||v.ctrlKey||v.metaKey)&&window.open(S,"_blank")}),i.addCustom(Pg,A=>new Ex(A)),Au.register(i),i.version="1.1.27-beta.2",i}async function _tt(n,t,e){var h;const r=n.doc.externalDoc.client.auth,i=await C0.load({auth:r,serverUrl:e});if(!((h=i.getVersionHelper)==null?void 0:h.call(i)))throw new Error("the editor does not support to show versions");const o=n.getCustom("create-options");if(!o)throw new Error("the editor does not support to show versions");const l=o.getData(),c=new HS(l),d=n.addCustom("version-dialog",()=>new X4(i,c));return d.show(t),d}b.tippy=c9,b.AnchorBox=w3,b.AuthError=fd,b.AuthHeader=xa,b.AutoScroll=xm,b.BaseURLHeader=eu,b.BasicCommands=uK,b.BlockExclusiveHook=lw,b.BlockLockerHook=DA,b.BlockLockerPasteHandler=Cg,b.BlockResizer=Pd,b.BrBox=y3,b.CodeBlock=EA,b.CodeLineBlock=AA,b.CodeTextDecorator=fg,b.DOC_RE_AUTH_KEYS=Pg,b.DefaultShortcuts=s0,b.DocIdError=tO,b.DocReAuthCallbacks=Ex,b.DragDrop=Yb,b.DrawioEmbed=LS,b.EditorBlocks=lB,b.EditorBoxes=k3,b.EditorCommandProviders=yy,b.EditorComplexBlockPosition=Ai,b.EditorComplexSelectionRange=Qi,b.EditorDecorators=D3,b.EditorEmbeds=cB,b.EditorInsertions=I3,b.EditorSimpleBlockPosition=gn,b.EditorSimpleSelectionRange=bn,b.EmbedBlock=fB,b.EmbedBlockResizer=nh,b.EnforceWithDocumentTitleHandler=xA,b.EventCallbacks=Lc,b.FILL_CHAR=T8,b.FileExtError=eO,b.GroupOrder=Ok,b.HeadingBlockScrollListener=TY,b.ImageBox=R3,b.InlineBoxCommandProvider=Yk,b.InputtingInsertion=S3,b.LocalDoc=TC,b.LogLevel=qo,b.Logger=hi,b.MIN_DISTANCE_THRESHOLD=qb,b.ManualCloseDialog=gd,b.ManualMenu=dl,b.ManualToolbar=md,b.MarkdownInputHandler=hg,b.MaxUserError=PC,b.Mindmap=J0,b.OnesEditorAutoSuggest=mE,b.OnesEditorCustomDataWrapper=Db,b.OnesEditorExclusiveBlock=yl,b.OnesEditorHoveringBlock=$e,b.OnesEditorIcons=KO,b.OnesEditorQuickMenu=sg,b.OnesEditorToc=oh,b.OnesEditorTocProvider=Ll,b.OnesEditorToolbar=Au,b.OnesEditorTooltip=Ld,b.OnesEditorVersionsDialog=X4,b.PermissionError=p0,b.Popup=su,b.ReAuthToolbar=ES,b.RemoteCarets=uT,b.RemoteCaretsDecorator=WC,b.RemoteCaretsInsertion=G1,b.RemoteUsers=td,b.RequestReloadError=dd,b.RichText=$n,b.ShareDBDoc=hd,b.ShareDBDocVersionsProvider=HS,b.ShareDBServer=C0,b.SimpleCache=Kb,b.StandardEmbedBlockCommands=rx,b.TEXT_STYLE_BACKGROUND_COLOR_PREFIX=T1,b.TEXT_STYLE_COLOR_PREFIX=y1,b.TableBlock=uA,b.TableBlockCommandProvider=P0,b.TableShortcuts=fA,b.TextBlock=lr,b.TextBox=B3,b.TextColorItem=w2,b.TextStyleShortcuts=sA,b.TocEmbed=lS,b.ZERO_WIDTH_SPACE_CHAR=xf,b.abbreviation=bm,b.addAttribute=Lm,b.addClass=q,b.addCommentToBlock=eh,b.addDays=AI,b.addMetaToDoc=Qf,b.addMonths=EI,b.animateScrollTo=ra,b.applyPlaceholderToBlock=Od,b.assert=p,b.autoShowHideTemplates=Ng,b.bindKeyDownEvent=dm,b.blockToDoc=AC,b.blockToHtml=X1,b.blockToMarkdown=Gm,b.blockToText=zm,b.blocksToDoc=W5,b.clearAllSelection=Vv,b.clientType=xe,b.cloneBlock=sl,b.cloneChildContainer=sC,b.cloneDoc=oC,b.cloneText=m3,b.commentToShareDbComment=GC,b.compareElement=cm,b.comparePosition=p1,b.complexBlockAdjustSelectionPos=Rm,b.complexBlockFindNearestChildBlock=C7,b.complexBlockGetAllChildContainers=In,b.complexBlockGetBottomChildContainers=gB,b.complexBlockGetDeepFirstChild=dB,b.complexBlockGetFirstSimpleChild=E1,b.complexBlockGetLastSimpleChild=Pc,b.complexBlockGetSelectedContainers=Nc,b.complexBlockGetTopChildContainers=mB,b.containerToDoc=q5,b.continuousScroll=hv,b.convertBlockFrom=Tm,b.convertImageFileToPng=mS,b.convertImageSrcToPng=qY,b.converterIntercept=dg,b.copyBlockAttributes=z3,b.copyResourcesFromDoc=yC,b.createBlockAnchor=$s,b.createBlockCaretAnchor=CB,b.createBlockContentElement=ua,b.createBlockElement=Mv,b.createBlockSimpleDocRange=Km,b.createBlockSimpleRange=Ue,b.createBoxContentElement=Nv,b.createBoxElement=Uv,b.createBoxOp=h3,b.createChildContainer=sB,b.createComplexBlockPosition=Me,b.createComplexDocPos=A3,b.createComplexDocRange=w8,b.createContainer=p3,b.createContainerElement=t1,b.createDeleteOps=c3,b.createEditor=Zf,b.createEditorSelectionRange=pn,b.createElement=B,b.createEmptyContainer=qs,b.createEmptyDoc=Ws,b.createEmptyTextBlockData=Pm,b.createExpandedRange=lm,b.createIconButton=ta,b.createImage=_p,b.createInsertOps=Om,b.createInsertionContentElement=Kv,b.createInsertionElement=Pv,b.createLocalEditor=Dtt,b.createOnesEditor=Ltt,b.createRange=Vb,b.createRichText=pa,b.createRootContainer=iB,b.createSimpleBlockPosition=ht,b.createSimpleDocPos=E3,b.createTextBlockData=es,b.createTextButton=Sa,b.createTextOp=qr,b.createTextWithReplaceSoftReturn=N1,b.daysAfter=qp,b.deleteText=F1,b.diffDays=xI,b.disablePageScroll=jp,b.docToHtml=K3,b.docToHtmlFragment=jf,b.docToMarkdown=V3,b.docToText=il,b.downloadImageToFile=CS,b.downloadObjectToFile=bx,b.downloadSvgToString=bS,b.editLink=kd,b.editorAddComment=wq,b.editorAddTextAttribute=n5,b.editorAutoInsertBlock=G3,b.editorBreakTextBlock=qc,b.editorClearCompositionText=Z1,b.editorClearSelectedContents=Qm,b.editorCopyBlock=vC,b.editorCopyDoc=i0,b.editorDeleteBlock=nC,b.editorDeleteBlockText=tC,b.editorDeleteBlockWithoutChildren=Xm,b.editorDeleteChildContainer=T_,b.editorDeleteChildContainers=W3,b.editorFocusToBlock=iC,b.editorFocusToEnd=j_,b.editorGetBlockData=Xs,b.editorGetBlockText=Yn,b.editorGetBlockTextEx=$m,b.editorGetBoxData=b3,b.editorHandleKeyboardEvent=oy,b.editorInsertBlock=Wc,b.editorInsertBoxToBlock=H3,b.editorInsertDoc=t5,b.editorInsertDocAt=lC,b.editorInsertText=J1,b.editorInsertTextToBlock=$3,b.editorInsertTextToBlockEx=Q1,b.editorMergeTextBlock=q3,b.editorMoveDown=g5,b.editorMoveEnd=mC,b.editorMoveHome=T5,b.editorMoveLeft=d5,b.editorMoveLineEnd=_5,b.editorMoveLineHome=D5,b.editorMovePageDown=F5,b.editorMovePageUp=P5,b.editorMoveRight=h5,b.editorMoveUp=m5,b.editorMoveWordEnd=v5,b.editorMoveWordLeft=b5,b.editorRangeClearColor=i5,b.editorRangeGetColor=s5,b.editorRangeSetColor=r5,b.editorRemoveTextAttribute=S_,b.editorReplaceBlockText=Jm,b.editorReplaceContainer=e5,b.editorRunOnce=kC,b.editorSelectAll=pC,b.editorSelectContainer=e0,b.editorSelectDown=p5,b.editorSelectEnd=gC,b.editorSelectHome=k5,b.editorSelectLeft=C5,b.editorSelectLineEnd=I5,b.editorSelectLineHome=L5,b.editorSelectPageDown=$5,b.editorSelectPageUp=V5,b.editorSelectRight=E5,b.editorSelectUp=A5,b.editorSelectWordEnd=y5,b.editorSelectWordLeft=B5,b.editorSetTextColor=Xc,b.editorShowFindDialog=AW,b.editorToDocx=Stt,b.editorUpdateBlockData=Zm,b.editorUpdateCompositionText=j3,b.editorUpdateEmbedData=J3,b.enablePageScroll=zp,b.escapeHtmlText=hm,b.escapeRegExp=Jp,b.escapeSpace=tI,b.exclusiveBlock=SA,b.executeBlockCommand=Yv,b.executeEmbedBlockCommand=Xv,b.executeRangeCommand=By,b.fileToDataUrl=_c,b.findAfterOffsetNotType=H1,b.findAllText=CC,b.findBlockByIndex=kv,b.findEventTargetBlock=jb,b.findInsertionById=Fv,b.findNextOffset=q8,b.findNextVisibleSimpleBlock=wy,b.findPrevOffset=W8,b.findPrevOffsetNotType=$1,b.findPrevSimpleBlockBeforeChildContainer=hB,b.findPrevVisibleSimpleBlock=Ry,b.findTarget=Dc,b.findWordEnd=z1,b.findWordLeft=j1,b.format=kf,b.formatBytes=mv,b.formatDate=Yp,b.fragmentToHtml=lv,b.fromBase64=vf,b.fromBase64ToBlob=$p,b.fromBase64ToUint8Array=fI,b.fromDocRange=el,b.fromNowString=Qp,b.genId=it,b.generateEditorContainerId=Zp,b.getAllChildBlocks=v1,b.getAllQuickMenuItems=iA,b.getAllSelectedBlocks=Ji,b.getAttributesAt=$c,b.getBlockBackground=r1,b.getBlockByIndex=Qo,b.getBlockCaretRect=Zo,b.getBlockClass=le,b.getBlockClassByType=la,b.getBlockClientRects=Fs,b.getBlockCommandsWithHook=u1,b.getBlockContent=zt,b.getBlockHeading=If,b.getBlockId=ut,b.getBlockIndex=Rt,b.getBlockInfo=Hd,b.getBlockKind=Ci,b.getBlockMinWidth=Hv,b.getBlockNearestRangeFromPoint=x1,b.getBlockOptions=_I,b.getBlockPath=tl,b.getBlockProperties=Gv,b.getBlockRangeFromPoint=wm,b.getBlockStyles=DI,b.getBlockTextLength=Ct,b.getBlockTools=be,b.getBlockType=Ot,b.getBoxContent=s1,b.getBoxId=Ov,b.getBoxTypeFromElement=Lf,b.getChildBlockCount=qi,b.getChildBlocks=ke,b.getChildOffset=nl,b.getColorFromAttributes=R1,b.getColorFromContent=vm,b.getComplexBlockClass=Hr,b.getContainerBlockPath=eB,b.getContainerBlocks=yv,b.getContainerBlocksElement=wf,b.getContainerById=pi,b.getContainerId=pt,b.getContainerMinWidth=m1,b.getContainerToolsElement=SI,b.getContainerWidth=oB,b.getDistanceSquare=Xo,b.getElementFromPoint=Pe,b.getElementOffset=Af,b.getElementScale=$r,b.getEmbedType=on,b.getExistsBlockTools=Bm,b.getExistsContainerById=Rf,b.getFileExt=Tf,b.getFirstChildBlock=_e,b.getFirstClientRect=am,b.getHeadingBlockChildren=Oc,b.getHeadingMenuOptions=tA,b.getHorizontalPadding=Up,b.getInsertionContent=o1,b.getLastChildBlock=Ge,b.getLastClientRect=ea,b.getListAllNextBrothers=mu,b.getLogger=D,b.getNextBlock=ae,b.getNextHiddenBlocks=Zv,b.getNextValidOffset=ma,b.getNextVisibleBlock=zr,b.getOffsetFromPoint=Mp,b.getOffsetInfoAfter=Vf,b.getOffsetInfoBefore=Hm,b.getOpAt=HB,b.getOpLength=Sm,b.getParentBlock=et,b.getParentBlockExcludeSelf=ca,b.getParentBox=i1,b.getParentContainer=at,b.getPrevBlock=He,b.getPrevValidOffset=rl,b.getPrevVisibleBlock=jr,b.getRangeCommands=by,b.getReferenceClientRect=lk,b.getRootBlock=c1,b.getScrollContainer=mn,b.getSpecialBlockCommands=Wv,b.getStandardEmbedBlockProperties=ix,b.getTextAfterOffset=z8,b.getTextAttributes=Y1,b.getTextBeforeOffset=G8,b.getTextBlockChild=Mf,b.getTextBlockClass=wv,b.getTextBlockContentChildTextLength=Wr,b.getTextBlockContentChildType=tB,b.getTextBlockContentChildren=Yi,b.getTextLength=Vn,b.getTextOpLength=B1,b.getTextWidth=Cm,b.getToolbar=z0,b.handleBlockElementUpdated=jv,b.hasAltOnly=oI,b.hasClass=Mt,b.hasCtrlOrCmd=nv,b.hasCtrlOrCmdOnly=sI,b.hashCode=bv,b.hideBlock=_v,b.hideTemplates=hS,b.htmlToFragment=pm,b.i18n=_,b.includeBigTable=pN,b.injectDocToHtmlFragment=Yf,b.injectStyle=Wb,b.inputActions=uM,b.insertEmptyBlock=OI,b.insertEmptyEmbedBlock=f1,b.insertText=Gs,b.intersectionCommands=HM,b.isBackspace=iv,b.isBlock=aa,b.isBlockLocked=pg,b.isBlockLockedByOthers=IA,b.isBlockLockedBySelf=jd,b.isBlockTools=Dv,b.isBox=ym,b.isBoxOp=Hs,b.isCJK=tv,b.isChildContainer=gi,b.isChildNode=Ce,b.isCodeBlock=Di,b.isCollapsedHeadingBlock=Xi,b.isCollapsedRange=R8,b.isComplexBlockPosition=da,b.isComplexKindBlock=Pt,b.isContainer=Yo,b.isContainerSelectedAllChildBlocks=H5,b.isControlEvent=sa,b.isDelete=aI,b.isDraggingFiles=Em,b.isElementVisible=fm,b.isEmbedBlock=Le,b.isEmptyContainer=Uf,b.isEmptyDoc=K1,b.isEmptyTextBlock=ve,b.isEmptyTextBlockWithoutCompositionText=Ud,b.isEnterOnly=rv,b.isEscape=gm,b.isExclusiveBlock=$d,b.isExpandedHeadingBlock=Jv,b.isFirefox=Cf,b.isFirstChildBlockInComplexBlock=p7,b.isHeadingBlock=Ln,b.isHighSurrogate=Y9,b.isInBlock=l1,b.isInBlockTools=Uc,b.isLetter=Zb,b.isLowSurrogate=Q9,b.isMatchShortcut=Gi,b.isMoveForward=rI,b.isNavigationEvent=nI,b.isNavigationKey=ev,b.isNodeRemoved=Ef,b.isNumber=Jb,b.isPrintableKey=Kp,b.isRootBlock=Gr,b.isRootContainer=re,b.isSafari=Zl,b.isSameDay=Xp,b.isSelectBoxOnly=ti,b.isShiftEnter=lI,b.isShiftTab=uI,b.isShortcutEvent=iI,b.isSimpleBlock=II,b.isSimpleBlockPosition=xi,b.isSimplePos=C3,b.isSimpleRange=Fm,b.isSpace=mm,b.isTab=cI,b.isTextBlockContentBoxChild=Br,b.isTextBlockContentChild=Df,b.isTextBlockContentInsertionChild=Vs,b.isTextBlockContentTextChild=_f,b.isTextKindBlock=ot,b.isTextKindBlockType=Sf,b.isTitleBlock=Ps,b.isToday=gv,b.isValidOffset=or,b.isVisibleBlock=Jo,b.isYesterday=pv,b.loadJs=Hb,b.loadJsPromise=na,b.lockers=mi,b.mergeCommands=j0,b.mergeDocs=Ca,b.mergeOps=P1,b.mergeText=B8,b.multiSplitText=zB,b.overflowText=Cv,b.parseShortcut=sv,b.patchNode=Bf,b.pointInRect=ia,b.rangeAddAttribute=Pf,b.rangeGetTextColor=JB,b.rangeRemoveAttribute=Vc,b.rangeSetTextColor=XB,b.rangeTransformText=WB,b.registerDragDrop=Pp,b.removeAttribute=k1,b.removeClass=ct,b.removeLastBr=A8,b.removePlaceholderFromBlock=DR,b.removeStyle=Gb,b.replaceAll=bI,b.replaceAllCaseInsensitive=vI,b.replaceAllText=z5,b.replaceText=Nm,b.requestDownload=Am,b.resetListStart=pu,b.scrollIntoView=Hf,b.scrollable=dv,b.selectFile=Mc,b.selectedBlockToDoc=n0,b.selectionToDoc=Yc,b.setAttributes=um,b.setClipboardData=yf,b.setClipboardDataByEvent=mI,b.setColorToAttributes=YB,b.setDataset=Op,b.setDefaultCursor=bf,b.setStyles=Np,b.shareDBCommentToDocObject=zC,b.shareDBDocCommentToComment=aT,b.shortcutToDisplayText=hn,b.showBlock=n1,b.showDocVersions=_tt,b.showTemplates=px,b.splitText=sr,b.splitToThree=ln,b.stringToDataUrl=Hp,b.stringToObjectUrl=Gp,b.subText=GB,b.textNodeOffsetFromPoint=$b,b.titleFromEditor=pS,b.toBase64URL=Wi,b.toMindmap=Q0,b.toPlainText=Re,b.toPlainTextKeepLength=V1,b.trimChar=Fp,b.unexclusiveBlock=LA,b.unicodeLength=J9,b.unicodeSubstr=Z9,b.updateBlockSelection=$v,b.updateOpAttributes=g3,b.updateTextBlockContent=j8,b.updateUrl=Vp;for(const n in Ve)n!=="default"&&!b.hasOwnProperty(n)&&Object.defineProperty(b,n,{enumerable:!0,get:()=>Ve[n]});Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
963
+ \`\`\`\`\`\``}return""}const qJ={embedType:"plantuml",convertFrom:zJ,handleUpdateBlock:jJ,createEmbedContent:HJ,getBlockProperties:GJ,convertTo:WJ},tct="",XJ="hr",YJ={dividingLine:{type:"\u5206\u5272\u7EBF",abstract:"\u5206\u5272\u7EBF"}},QJ={dividingLine:{type:"Dividing-Line",abstract:"Dividing-Line"}},JJ={dividingLine:{type:"\u533A\u5207\u308A\u7DDA",abstract:"\u533A\u5207\u308A\u7DDA"}};_.mergeLang({"zh-CN":YJ,"en-US":QJ,"ja-JP":JJ});function ZJ(n,t){const e=B("div",["editor-embed-container"],t);B("hr",["editor-embed-hr"],e)}function tZ(n,t,e,r){return r==="html"?"<hr />":r==="markdown"?"---":"------------"}function eZ(){return{name:"hr",insertEmbedCommandItems:[{id:"insert-hr",name:_.t("dividingLine.type"),icon:jT,order:500,group:"common",subText:Qn("insert-hr")}],handleInsertEmptyEmbed:async(n,t)=>{const{containerId:e,blockIndex:r}=t;return n.insertEmbed(e,r,XJ,{})}}}function nZ(n,t,e){const{data:r}=e;if(!r||r.embedType!=="dividing-line"||!ot(n,t))return null;const i={};return{blockData:{id:it(),type:"embed",embedType:"hr",embedData:i}}}function rZ(){return{abstract:_.t("dividingLine.abstract")}}const iZ={embedType:"hr",createEmbedContent:ZJ,convertTo:tZ,getOptions:eZ,convertFrom:nZ,getBlockProperties:rZ},ect="",nct="",sZ={media:{upload:{failed:'<div class="line-1">{name}\u4E0A\u4F20\u5931\u8D25</div><div class="line-2">\u7F51\u7EDC\u670D\u52A1\u5F02\u5E38\uFF0C\u4F60\u53EF\u4EE5 <span class="retry-upload">\u91CD\u8BD5</span></div>',maxSizeFailed:'<div class="line-1">{name}\u4E0A\u4F20\u5931\u8D25</div><div class="line-2">\u6587\u4EF6\u5927\u5C0F\u8D85\u8FC7\u9650\u5236\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\u6587\u4EF6</div>'},load:{failed:'<div class="line-1">{name}\u52A0\u8F7D\u5931\u8D25</div><div class="line-2">\u7F51\u7EDC\u670D\u52A1\u5F02\u5E38\uFF0C\u4F60\u53EF\u4EE5 <span class="retry-upload">\u91CD\u8BD5</span></div>'},audio:{menuItem:"\u97F3\u9891",abstract:"\u97F3\u9891"},video:{menuItem:"\u89C6\u9891",abstract:"\u89C6\u9891"}}},oZ={media:{upload:{failed:'<div class="line-1">{name} upload failed</div><div class="line-2">Network error, you can <span class="retry-upload">Retry</span></div>',maxSizeFailed:'<div class="line-1">{name} upload failed</div><div class="line-2">The file size exceeds limit. Please choose another file.</div>'},load:{failed:'<div class="line-1">{name} loading failed</div><div class="line-2">Network error, you can <span class="retry-upload">Retry</span></div>'},audio:{menuItem:"Audio",abstract:"Audio"},video:{menuItem:"Video",abstract:"Video"}}},lZ={media:{upload:{failed:'<div class="line-1">{name}\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F</div><div class="line-2">\u304A\u4F7F\u3044\u306E\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u63A5\u7D9A\u306B\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u6B21\u306E\u64CD\u4F5C\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002 <span class="retry-upload">\u518D\u8A66\u884C</span></div>',maxSizeFailed:'<div class="line-1">{name}\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F</div><div class="line-2">\u30D5\u30A1\u30A4\u30EB\u306E\u30B5\u30A4\u30BA\u304C\u4E0A\u9650\u3092\u8D85\u3048\u3066\u3044\u308B\u305F\u3081\u3001\u4ED6\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044</div>'},load:{failed:'<div class="line-1">{name}\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F</div><div class="line-2">\u304A\u4F7F\u3044\u306E\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u63A5\u7D9A\u306B\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u6B21\u306E\u64CD\u4F5C\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002 <span class="retry-upload">\u518D\u8A66\u884C</span></div>'},audio:{menuItem:"\u97F3\u58F0",abstract:"\u97F3\u58F0"},video:{menuItem:"\u52D5\u753B",abstract:"\u52D5\u753B"}}};_.mergeLang({"zh-CN":sZ,"en-US":oZ,"ja-JP":lZ});var Ui=(n=>(n.AUDIO="audio",n.VIDEO="video",n))(Ui||{}),lh=(n=>(n.Empty="empty",n.Progress="progress",n.Error="error",n))(lh||{});const US=10*1024*1024,aZ=["wav","mp3","aac","ogg","webm","flac"],cZ=["ogg","mp4","webm"],uZ=()=>{};function OS(n){var h,C,E,A,v,w;const t=(h=n.getComponentOptions("media"))!=null?h:{},{allowedMedias:e,maxSize:r,callbacks:i}=t,s=(C=e==null?void 0:e.audio)!=null?C:aZ,o=(E=e==null?void 0:e.video)!=null?E:cZ,l=(A=r==null?void 0:r.audio)!=null?A:US,c=(v=r==null?void 0:r.video)!=null?v:US,d=(w=i==null?void 0:i.onError)!=null?w:uZ;return{allowedMedias:{audio:s,video:o},maxSize:{audio:l,video:c},callbacks:{onError:d}}}function fZ(n,t){const e=s=>s.map(o=>`.${o}`).join(","),{allowedMedias:r}=OS(n),i=r[t];return i?e(i):"*"}function dZ(n,t,e){const{maxSize:r,callbacks:i,allowedMedias:s}=OS(t),{[e]:o}=r,{[e]:l}=s;if(o&&n.size>o){const d=new Error("media is too large");throw d.code=`MaxMediaSize-${e}`,i!=null&&i.onError&&(i==null||i.onError(t,d)),d}const c=Tf(n.name);if(l&&!l.includes(c.toLowerCase())){const d=new Error(`media file is not allowed: ${c}`);throw d.code="NotAllowedFile",i!=null&&i.onError&&(i==null||i.onError(t,d)),d}}function hZ(n){return n===lh.Empty||n===lh.Error}const En=D("media");class mZ extends Ve.TypedEmitter{constructor(e){super();m(this,"mediaContainer",null);m(this,"media",null);m(this,"abstract",null);m(this,"handleMediaLoadError",(e,r)=>{if(!r.target||!(r.target instanceof Node)||!(r.target instanceof Element?r.target:r.target.parentElement))return;const s=et(r.target);if(!s||!s.contains(this.mediaContainer))return;const o=this.renderError();this.updateMediaContent(o),this.emit("mediaError",e,"load_error",ut(s))});m(this,"handleUploadFile",async e=>{p(En,this.abstract,"no abstract"),p(En,this.mediaContainer,"The media element not exist");const{editor:r}=this.options,i=et(this.mediaContainer);p(En,i,"The block element not exist");const s=r.getBlockData(i);try{const{resourceId:o}=await r.doc.uploadResource(e,{onProgress:C=>{this.renderProgress(C,e)}}),{name:l,type:c,size:d}=e,h={...s,embedData:{...s.embedData,src:o,fileName:l,fileSize:d,fileType:c}};r.updateBlockData(i,h)}catch(o){En.error(o),this.emit("mediaError",r,"upload_error",s.id),this.renderRetry(e,o)}ct(i,"media-block-uploading")});m(this,"destroy",()=>{this.mediaContainer=null});this.options=e}bindMediaEvent(){const{editor:e}=this.options;this.media&&e.domEvents.addEventListener(this.media,"error",this.handleMediaLoadError)}unbindMediaEvent(){const{editor:e}=this.options;this.media&&e.domEvents.removeEventListener(this.media,"error",this.handleMediaLoadError)}updateMediaContent(e){p(En,this.mediaContainer,"The media element not exist"),this.mediaContainer.innerHTML="",this.mediaContainer.append(e)}renderError(){p(En,this.abstract,"no abstract");const{editor:e,createMediaElement:r}=this.options,{mediaIcon:i,mediaName:s}=this.abstract;p(En,this.mediaContainer,"The media element not exist");const o=et(this.mediaContainer);p(En,o,"The block element not exist");const l=e.getBlockData(o),c=B("div",["media-error","embed-selected-content","embed-hover-content"],null),d=B("span",["media-error-icon"],c);d.innerHTML=i;const h=B("div",[],c);h.innerHTML=_.t("media.load.failed",{name:s}),c.appendChild(h);const C=h.querySelector(".retry-upload");return p(En,C,"The element not exist"),e.domEvents.addEventListener(C,"click",(E,A)=>{const v=B("div",["media-element"],null),w=this.getResourceUrl(l),S=r(E,v,l,w);this.unbindMediaEvent(),this.media=S,this.bindMediaEvent(),this.updateMediaContent(v)}),this.setFullScreen(),c}renderRetry(e,r){var E,A;p(En,this.abstract,"no abstract");const{editor:i}=this.options,{mediaIcon:s,mediaName:o}=this.abstract,l=B("div",["media-error","embed-selected-content","embed-hover-content"],null),c=B("span",["media-error-icon"],l);c.innerHTML=s;const d=B("div",[],l);let h=_.t("media.upload.failed",{name:o});(((E=r.response)==null?void 0:E.status)===420||((A=r.response)==null?void 0:A.status)===413)&&(h=_.t("media.upload.maxSizeFailed",{name:o})),d.innerHTML=h,l.appendChild(d);const C=d.querySelector(".retry-upload");C&&i.domEvents.addEventListener(C,"click",()=>{i.readonly||(p(En,this.abstract,"no abstract"),this.handleUploadFile(e))}),this.updateMediaContent(l),this.setFullScreen()}renderProgress(e,r){p(En,this.mediaContainer,"The media element not exist");const i=this.mediaContainer.querySelector(":scope .media-progress"),s=e===-1||e===100?100:e;if(i){const{updateProgressElement:o}=this.options;o(i,s)}else{const{createProgressElement:o}=this.options,l=et(this.mediaContainer);p(En,l,"The element not exist"),q(l,"media-block-uploading");const c=B("div",["media-progress"],null);o(c,s,r),this.updateMediaContent(c)}this.setFullScreen()}renderMediaElement(e,r){p(En,this.mediaContainer,"The media element not exist");const i=this.mediaContainer.querySelector(":scope > .media-element"),{createMediaElement:s,updateMediaElement:o,editor:l}=this.options,c=this.getResourceUrl(e,r);if(i){const d=o(l,i,e,c);this.unbindMediaEvent(),this.media=d,this.bindMediaEvent()}else{const d=B("div",["media-element"],null),h=s(l,d,e,c);this.unbindMediaEvent(),this.media=h,this.bindMediaEvent(),this.updateMediaContent(d)}}renderEmpty(e){p(En,this.abstract,"no abstract"),p(En,this.mediaContainer,"The media element not exist");const r=B("div",["media-empty","embed-selected-content","embed-hover-content"],this.mediaContainer);r.innerHTML=this.abstract.mediaIcon,this.updateMediaContent(r);const{editor:i}=this.options;i.findBlockById(e.id)&&this.emit("mediaError",i,"empty",e.id),this.setFullScreen()}getResourceUrl(e,r){const{src:i}=e.embedData,{editor:s}=this.options;return s.doc.buildResourceUrl(i,{syncNewResources:async(o,l)=>{var d,h;if(!r)return;await s.doc.addResources([o]);const c=(h=(d=s.doc).getServerMeta)==null?void 0:h.call(d).appId;if(l!==e.embedData.src&&c&&e.embedData.src.includes(c)){const C=et(r);if(C&&!s.readonly&&s.isBlockWritable(C)){const E=Et.default(e);E.embedData.src=o,s.updateBlockData(C,E)}}}})}setFullScreen(){p(En,this.mediaContainer,"The media element not exist"),q(this.mediaContainer,"full-screen")}removeFullScreen(){p(En,this.mediaContainer,"The media element not exist"),ct(this.mediaContainer,"full-screen")}updateBlockAlign(e,r){const i=et(r);p(En,i,"The block element not exist");const{align:s}=e;e.embedType==="video"&&(i.hasAttribute("data-style-align")&&i.removeAttribute("data-style-align"),i.setAttribute("data-style-align",s))}render(e,r){const{src:i}=e.embedData;(!this.mediaContainer||!r.contains(this.mediaContainer))&&(this.mediaContainer=B("div",["media"],r)),this.updateBlockAlign(e,r),hZ(i)?i===lh.Empty&&this.renderEmpty(e):this.renderMediaElement(e,r)}setAbstract(e){this.abstract=e}}D("media-embed");const gZ="left";class NS{constructor(){m(this,"handleInsertEmptyEmbed",async(t,e)=>{var C;const{containerId:r,blockIndex:i}=e;let s;(C=e.data)!=null&&C.file&&(s=e.data.file);const o=fZ(t,this.embedType);if(s=s!=null?s:await Mc(o,{}),!s)return null;const{mediaType:l}=this.getAbstract();try{dZ(s,t,l)}catch{return null}const c={id:it(),type:"embed",embedType:this.embedType,embedData:{src:lh.Empty}};l==="video"&&(c.align=gZ);const d=t.insertBlock(r,i,c);return await this.getMedia(t,c.id).handleUploadFile(s),d})}getMedia(t,e){const r=t.addCustom(`media-${e}`,()=>new mZ({editor:t,createMediaElement:this.createMediaElement,updateMediaElement:this.updateMediaElement,createProgressElement:this.createProgressElement,updateProgressElement:this.updateProgressElement}));return r.setAbstract({...this.getAbstract()}),r}getOptions(){const{menuItem:t,mediaIcon:e,mediaName:r,order:i,group:s}=this.getAbstract();return{name:r,insertEmbedCommandItems:[{id:`insert-${this.embedType}`,name:t,icon:e,order:i,group:s,subText:Qn(`insert-${this.embedType}`)}],handleInsertEmptyEmbed:this.handleInsertEmptyEmbed}}createEmbedContent(t,e,r){const{id:i}=r;this.getMedia(t,i).render(r,e)}handleUpdateBlock(t,e,r){const{id:i}=r,s=this.getMedia(t,i),o=zt(e);return s.render(r,o),!0}handleDeleteBlock(t,e){const r=e.id,i=this.getMedia(t,r);i.removeAllListeners(),i.destroy()}convertTo(t,e,r,i){const s=e.embedData,o=t.doc.buildResourceUrl(s.src,{withToken:!0});return i==="html"?`<${s.type} src="${o}" />`:i==="markdown"?`![${s.src}](${o})`:o}}function PS(n,t){const e=B("div",["uploading-progress-mask"],n),r=B("div",["uploading-progress-bar"],e),i=B("div",["uploading-progress-bar-value"],r);i.style.width=`${t}%`}function FS(n,t){const e=n.querySelector(".uploading-progress-bar-value");e&&(e.style.width=`${t}%`)}const pZ=D("media-audio");class CZ extends NS{constructor(){super(...arguments);m(this,"embedType",Ui.AUDIO);m(this,"updateProgressElement",FS);m(this,"createMediaElement",(e,r,i,s)=>{const o=B("div",["audio-container","embed-hover-content","embed-selected-content"],r),l=B("audio",[],o);return l.innerHTML="Your browser does not support the <code>audio</code> element.",l.controls=!0,l.src=s,setTimeout(()=>{this.getMedia(e,i.id).setFullScreen()}),l})}getAbstract(){return{mediaIcon:VT,mediaName:_.t(`media.${Ui.AUDIO}.menuItem`),menuItem:_.t(`media.${Ui.AUDIO}.menuItem`),order:800,mediaType:Ui.AUDIO,group:"common"}}getBlockProperties(){return{abstract:`${_.t(`media.${Ui.AUDIO}.abstract`)}`}}updateMediaElement(e,r,i,s){const o=r.querySelector(":scope .audio-container > audio");return p(pZ,o,"The media element not exist"),o.src!==s&&(o.src=s),o}createProgressElement(e,r){const i=B("audio",[],e);i.innerHTML="Your browser does not support the <code>audio</code> element.",i.controls=!0,i.src="about:blank",PS(e,r)}}const EZ=new CZ;D("video-resizer");function KS(n){return n&&Le(n)&&on(n)==="video"}const AZ=50;class kx{constructor(t){m(this,"currentResizableElement",null);m(this,"resizing",!1);m(this,"handleHoveringBlockChange",(t,e)=>{if(!this.resizing&&!window.isDragging&&(e&&KS(e)&&this.disableBlockResize(e),t&&KS(t)&&this.editor.isBlockWritable(t))){const r=this.getVideoElement(t);if(!r)return;this.enableBlockResize(t,r)}});m(this,"handleResizing",(t,e)=>{if(this.resizing=!0,!this.currentResizableElement)return;const r=t.getBlock();if(!r)return;const i=r.getBoundingClientRect().width,s=Math.min(Math.max(e.width,AZ),i);this.currentResizableElement.style.width=`${s}px`,this.currentResizableElement.style.pointerEvents="none"});m(this,"handleResized",t=>{this.resizing=!1;const e=t.getBlock();if(!this.currentResizableElement||!e)return;const r=this.editor.getBlockData(e),{width:i}=this.currentResizableElement.getBoundingClientRect();this.currentResizableElement.style.pointerEvents="auto",this.editor.updateBlockData(e,{...r,width:i})});this.editor=t,$e.get(t).addListener("change",this.handleHoveringBlockChange)}destroy(){this.currentResizableElement=null,$e.get(this.editor).removeListener("change",this.handleHoveringBlockChange)}getVideoElement(t){return zt(t).querySelector(":scope .video-container > video")}updateResizer(t){const e=this.editor.findCustom(`${ut(t)}-resizer`);e&&e.updateResizer()}disableBlockResize(t){const e=this.editor.findCustom(`${ut(t)}-resizer`);e&&e.disableResize()}enableBlockResize(t,e){const r=this.editor.addCustom(`${ut(t)}-resizer`,()=>new Pd(this.editor,{resize:["top-left","top-right","bottom-left","bottom-right"]}));r.enableResize(t,e),r.removeListener("resizing",this.handleResizing),r.removeListener("resized",this.handleResized),r.addListener("resizing",this.handleResizing),r.addListener("resized",this.handleResized),this.currentResizableElement=e}}const xZ=D("video");class bZ extends NS{constructor(){super(...arguments);m(this,"embedType",Ui.VIDEO);m(this,"updateProgressElement",FS);m(this,"createMediaElement",(e,r,i,s)=>{const o=B("div",["video-container","embed-selected-content","drag-preview-element"],r),l=B("video",[],o);return l.innerHTML="Your browser does not support the <code>video</code> element.",l.controls=!0,l.src=s,l.addEventListener("canplay",()=>{e.addCustom("video-resizer",()=>new kx(e)),this.getMedia(e,i.id).removeListener("mediaError",this.handleMediaError),this.getMedia(e,i.id).addListener("mediaError",this.handleMediaError),this.getMedia(e,i.id).removeFullScreen()}),i.width&&(l.style.width=`${i.width}px`),l});m(this,"createProgressElement",(e,r,i)=>{const s=B("video",["progress-video"],e);s.innerHTML="Your browser does not support the <code>audio</code> element.",s.controls=!0,PS(e,r),_c(i).then(o=>{const l=e.querySelector(".progress-video");l&&l1(e)&&(l.src=o)})})}getAbstract(){return{mediaName:_.t(`media.${Ui.VIDEO}.menuItem`),mediaIcon:$T,menuItem:_.t(`media.${Ui.VIDEO}.menuItem`),order:700,mediaType:Ui.VIDEO,group:"common"}}getBlockProperties(){return{abstract:`${_.t(`media.${Ui.VIDEO}.abstract`)}`}}handleMediaError(e,r,i){const s=e.addCustom("video-resizer",()=>new kx(e)),o=e.getBlockById(i);s.disableBlockResize(o)}updateMediaElement(e,r,i,s){const o=r.querySelector(":scope .video-container > video");p(xZ,o,"The media element not exist"),o.src!==s&&(o.src=s),i.width?o.style.width=`${i.width}px`:o.style.width="";const l=e.getBlockById(i.id);return setTimeout(()=>{e.addCustom("video-resizer",()=>new kx(e)).updateResizer(l)}),o}}const vZ=new bZ,VS=[uA,EA,AA,Dk],Rx=[LS,vQ,IJ,KJ,qJ,NK,iZ,vZ,EZ,_z,lS,gX],$S=[jk,uS,_4];function BZ(n,t,e){var i,s,o,l;hi.level=(i=e.logLevel)!=null?i:qo.DEBUG;const r=Zf(n,t,{components:{blocks:[...VS,...((s=e==null?void 0:e.components)==null?void 0:s.blocks)||[]],embeds:[...Rx,...((o=e.components)==null?void 0:o.embeds)||[]],boxes:[...$S,...((l=e.components)==null?void 0:l.boxes)||[]],textRenders:[new WE],options:{...e.componentsOptions}}});return r.readonly=!0,r.addCustom("heading-collapse",()=>new fx(r)),r.addCustom("editor-tooltip",()=>new Ld(r)),r.addListener("clickLink",(c,d,h)=>{var E;if((E=e==null?void 0:e.events)!=null&&E.onClickLink){e.events.onClickLink(c,d,h);return}const C=h.getAttribute("link");C&&(c.readonly||d.ctrlKey||d.metaKey)&&window.open(C,"_blank")}),r}class HS{constructor(t){this.createOptions=t,t.lang&&_.setLang(t.lang)}createHistoryEditor(t,e){return BZ(t,e,this.createOptions)}}function jS(n,{root:t,childDoc:e,doc:r}){var h,C;e.uploadResource=r.uploadResource.bind(r),e.buildResourceUrl=r.buildResourceUrl.bind(r);const i=n.getComponentOptions("comment"),s={image:{defaultAlign:"left"},table:{locatingContainer:t,hideCellMenu:!0,hideToolbar:!0},...i==null?void 0:i.componentsOptions},o=[];n.editorBlocks.forEach(E=>{E.blockType==="text"||E.blockType==="embed"||o.push(E)});const l=[];n.editorEmbeds.forEach(E=>{l.push(E)});const c=[];n.editorBoxes.forEach(E=>{E.boxType==="text"||E.boxType==="br"||E.boxType==="image"||E.boxType==="anchor"||c.push(E)});const d=Zf(t,e,{shortcuts:[s0],components:{blocks:o,commandProviders:[new P0],decorators:[new fg],embeds:l,boxes:c,options:s}});if(d.input.addHandler(new hg),d.input.addHandler(new PA(d)),d.input.addHandler(new jA(d)),d.input.addHandler(new Tq(d)),d.input.addHandler(new Cg),d.addCustom("image-paste-handler",()=>new NA(d)),xe.isMobile||d.addCustom("editor-tooltip",()=>new Ld(d)),n.options.enableContextMenu!==!1&&d.addCustom("editor-context-menu",E=>new WA(E)),(h=n.options.componentsOptions)!=null&&h.mention){const E=n.options.componentsOptions.mention;d.addCustom("mention",()=>new cS(d,{...E}))}if((C=n.options.componentsOptions)!=null&&C.comment){const E=n.options.componentsOptions.comment;E.onCommentEditorClick&&d.addListener("click",E.onCommentEditorClick)}return d}function yZ(n,t){const e=Array.from(n.rootContainer.querySelectorAll(`[comment-${t.toLocaleLowerCase()}="${t}"]`)),r=new Set;e.forEach(i=>{const s=et(i);s&&r.add(s)}),r.forEach(i=>{kq(n,i,t)})}class TZ{constructor(t){m(this,"listeners",new Set);m(this,"doc");this.editor=t,this.doc=this.editor.doc.externalDoc,this.doc.registerCallback(this)}getComments(){return this.doc.getComments()}getComment(t){return this.doc.getComment(t)}getCommentDoc(t){return this.doc.getCommentDoc(t)}localCreateComment(t,e){this.doc.localCreateComment(t,e)}localDeleteComment(t){const e=this.getComment(t);this.doc.localDeleteComment(t);const r=e.groupId;this.getComments().filter(s=>s.groupId===r).length===0&&yZ(this.editor,r)}localUpdateComment(t,e){this.doc.localUpdateComment(t,e)}onCreateComment(t,e){Array.from(this.listeners.values()).forEach(r=>r.onCreateComment(t,e))}onDeleteComment(t,e){Array.from(this.listeners.values()).forEach(r=>r.onDeleteComment(t,e))}onUpdateComment(t,e){Array.from(this.listeners.values()).forEach(r=>r.onUpdateComment(t,e))}addListener(t){this.listeners.add(t)}removeListener(t){this.listeners.delete(t)}createCommentEditor(t,e){return jS(this.editor,{root:t,childDoc:e,doc:this.doc})}allowEdit(t){return t.userId===this.doc.getUser().userId}}class kZ{constructor(t,e){m(this,"listeners",new Set);this.editor=t,this.localDoc=e}get doc(){return this.localDoc.toJSON()}getComments(){return Object.values(this.doc.comments)}getComment(t){return this.doc.comments[t]}getCommentDoc(t){const e=this.doc.comments[t];return zC(e)}addListener(t){this.listeners.add(t)}removeListener(t){this.listeners.delete(t)}localCreateComment(t,e){}localDeleteComment(t){}localUpdateComment(t,e){}createCommentEditor(t,e){return jS(this.editor,{root:t,childDoc:e,doc:this.localDoc})}allowEdit(t){return t.userId===this.localDoc.getUser().userId}}const RZ={placeholder:{common:{title:"\u8BF7\u8F93\u5165\u6807\u9898",readonlyTitle:"\u8BF7\u8F93\u5165\u6807\u9898",content:"\u70B9\u51FB + \uFF0C\u6216\u8F93\u5165 / \u5FEB\u6377\u63D2\u5165\u7EC4\u4EF6",contentInTable:"\u8F93\u5165 / \u5FEB\u6377\u63D2\u5165\u7EC4\u4EF6"},local:{readonlyTitle:"\u672A\u547D\u540D"}},copyCutProperty:{copy:"\u590D\u5236",cut:"\u526A\u5207",unsafeEnvTips:"\u7531\u4E8E\u5F53\u524D http \u8BBF\u95EE\u73AF\u5883\u4E0B\u7684\u9650\u5236\uFF0C\u8BF7\u4F7F\u7528\u5FEB\u6377\u952E({shortCut}) {operation}",limitedEnvTips:"\u7531\u4E8E\u6D4F\u89C8\u5668\u9650\u5236\uFF0C\u8BF7\u4F7F\u7528 {shortCut} \u7C98\u8D34"}},wZ={placeholder:{common:{title:"Enter a title",readonlyTitle:"Enter a title",content:'Click "+", or enter "/" to insert components quickly',contentInTable:'Enter "/" to insert components quickly'},local:{readonlyTitle:"Untitled"}},copyCutProperty:{copy:"Copy",cut:"Cut",unsafeEnvTips:"Due to the limitations of the current http access environment, please use the shortcut ({shortCut}) {operation}",limitedEnvTips:"Press {shortCut} to paste due to browser restrictions"}},SZ={placeholder:{common:{title:"\u30BF\u30A4\u30C8\u30EB\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",readonlyTitle:"\u30BF\u30A4\u30C8\u30EB\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",content:"\u300C+\u300D\u3092\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u304B\u3001\u300C/\u300D\u3092\u5165\u529B\u3059\u308B\u3068\u3001\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u304C\u7D20\u65E9\u304F\u633F\u5165\u3067\u304D\u307E\u3059",contentInTable:"\u300C/\u300D\u3092\u5165\u529B\u3059\u308B\u3068\u3001\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u304C\u7D20\u65E9\u304F\u633F\u5165\u3067\u304D\u307E\u3059"},local:{readonlyTitle:"\u7121\u984C"}},copyCutProperty:{copy:"\u8907\u88FD",cut:"\u5207\u308B",unsafeEnvTips:"HTTP\u74B0\u5883\u306E\u5236\u7D04\u306B\u3088\u308A\u3001{operation}\u3059\u308B\u306B\u306F\u3001\u30B7\u30E7\u30FC\u30C8\u30AB\u30C3\u30C8({shortCut}) \u3092\u3054\u4F7F\u7528\u304F\u3060\u3055\u3044",limitedEnvTips:"\u30D6\u30E9\u30A6\u30B6\u30FC\u306E\u5236\u9650\u306B\u3088\u308A\u3001\u300C{shortCut}\u300D\u3092\u4F7F\u7528\u3057\u3066\u8CBC\u308A\u4ED8\u3051\u3066\u304F\u3060\u3055\u3044"}};_.mergeLang({"zh-CN":RZ,"en-US":wZ,"ja-JP":SZ});const LZ="UEsDBBQABgAIAAAAIQBk9WPugQEAACkGAAATAAgCW0NvbnRlbnRfVHlwZXNdLnhtbCCiBAIooAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAog8AAHdvcmQvdGhlbWUvdGhlbWUxLnhtbFBLAQItABQABgAIAAAAIQDlI7CA9QMAAKALAAARAAAAAAAAAAAAAAAAAKcWAAB3b3JkL3NldHRpbmdzLnhtbFBLAQItABQABgAIAAAAIQBAwf/xOQEAACMDAAAUAAAAAAAAAAAAAAAAAMsaAAB3b3JkL3dlYlNldHRpbmdzLnhtbFBLAQItABQABgAIAAAAIQA520VMuQUAACdaAAASAAAAAAAAAAAAAAAAADYcAAB3b3JkL251bWJlcmluZy54bWxQSwECLQAUAAYACAAAACEA+JXI7/wOAADzmQAADwAAAAAAAAAAAAAAAAAfIgAAd29yZC9zdHlsZXMueG1sUEsBAi0AFAAGAAgAAAAhAMySUFR9AQAA8QIAABEAAAAAAAAAAAAAAAAASDEAAGRvY1Byb3BzL2NvcmUueG1sUEsBAi0AFAAGAAgAAAAhACJREfHVAQAA3gMAABAAAAAAAAAAAAAAAAAA/DMAAGRvY1Byb3BzL2FwcC54bWxQSwECLQAUAAYACAAAACEAiD+lv+EAAABVAQAAGAAAAAAAAAAAAAAAAAAHNwAAY3VzdG9tWG1sL2l0ZW1Qcm9wczEueG1sUEsBAi0AFAAGAAgAAAAhAMEnywi2AAAAIQEAABMAAAAAAAAAAAAAAAAARjgAAGN1c3RvbVhtbC9pdGVtMS54bWxQSwECLQAUAAYACAAAACEAdD85esIAAAAoAQAAHgAAAAAAAAAAAAAAAABVOQAAY3VzdG9tWG1sL19yZWxzL2l0ZW0xLnhtbC5yZWxzUEsBAi0AFAAGAAgAAAAhAOuAYExTAwAAjw4AABIAAAAAAAAAAAAAAAAAWzsAAHdvcmQvZm9udFRhYmxlLnhtbFBLBQYAAAAADwAPANQDAADePgAAAAA=",IZ=()=>$p(LZ),DZ=D("image-to-docx");async function _Z(n){return new Promise((t,e)=>{const r=new Image;r.onload=()=>{t({width:r.naturalWidth,height:r.naturalHeight})},r.onerror=e,r.src=n})}async function zS(n,t){if(n.width&&n.height)return{width:n.width,height:n.height,buffer:t};try{const e=await _c(new File([t],"",{})),r=await _Z(e);return r.width===void 0||r.height===void 0?{width:345,height:230,buffer:t}:n.width||n.height?{width:n.width||r.width*n.height/r.height,height:n.height||r.height*n.width/r.width,buffer:t}:{width:r.width,height:r.height,buffer:t}}catch(e){DZ.error(e);return}}function MZ(n,t){let e=n.filter(o=>o!=null);const r=t-(e.length-1)*20,i=.87,s=e.reduce((o,l)=>o+l.width,0);return s>r&&(e=e.map(o=>({width:o.width*r/s,height:o.height*r/s,buffer:o.buffer}))),e.map(o=>({width:o.width*i,height:o.height*i,buffer:o.buffer}))}function UZ(n,t,e){if(!e||typeof e!="object")return;const r=e,i=n.filter(o=>o!=null),s=t-(i.length-1)*20;i.forEach((o,l)=>{if(i.length===1&&r.widthPercent){const d=r.widthPercent,h=o.width;o.width=s*(d/100),o.height*=o.width/h;return}const c=`${l}_flex`;if(r[c]){const d=r[c],h=o.width;o.width=s*d,o.height*=o.width/h}})}function GS(n=[0,1,2,3,4,5,6,7],t=1){return n.map(e=>{let r;switch(e%3){case 0:r=Bt.LevelFormat.DECIMAL;break;case 1:r=Bt.LevelFormat.LOWER_LETTER;break;default:r=Bt.LevelFormat.LOWER_ROMAN;break}return{level:e,format:r,text:`%${e+1}. `,alignment:Bt.AlignmentType.START,start:t,style:{paragraph:{indent:{left:Bt.convertInchesToTwip(.3*(e+1)),hanging:Bt.convertInchesToTwip(.2)}}}}})}function OZ(){return[0,1,2,3,4,5,6,7].map(n=>{let t;switch(n%3){case 0:t="\u2022";break;case 1:t="\u25E6";break;default:t="\u25AA";break}return{level:n,format:Bt.LevelFormat.BULLET,text:t,alignment:Bt.AlignmentType.START,style:{paragraph:{indent:{left:Bt.convertInchesToTwip(.3*(n+1)),hanging:Bt.convertInchesToTwip(.2)}}}}})}function NZ(){return[0,1,2,3,4,5,6,7].map(n=>({level:n,format:Bt.LevelFormat.BULLET,text:"\u2611",alignment:Bt.AlignmentType.START,style:{paragraph:{indent:{left:Bt.convertInchesToTwip(.3*(n+1)),hanging:Bt.convertInchesToTwip(.2)}}}}))}function PZ(){return[0,1,2,3,4,5,6,7].map(n=>({level:n,format:Bt.LevelFormat.BULLET,text:"\u2610",alignment:Bt.AlignmentType.START,style:{paragraph:{indent:{left:Bt.convertInchesToTwip(.3*(n+1)),hanging:Bt.convertInchesToTwip(.2)}}}}))}var ah=(n=>(n.NUMBERING="number-numbering-reference",n.BULLET="number-bullet-reference",n.CHECKED="checked-bullet-reference",n.UNCHECKED="unchecked-bullet-reference",n))(ah||{});const FZ=[{levels:GS(),reference:"number-numbering-reference"},{levels:OZ(),reference:"number-bullet-reference"},{levels:NZ(),reference:"checked-bullet-reference"},{levels:PZ(),reference:"unchecked-bullet-reference"}];function KZ(n){switch(n){case"style-color-0":return"d83931";case"style-color-1":return"de7802";case"style-color-2":return"dc9b04";case"style-color-3":return"2ea121";case"style-color-4":return"245bdb";case"style-color-5":return"6425d0";case"style-color-6":return"8f959e";default:return}}function VZ(n){switch(n){case"style-bg-color-1":case"style-bg-color-2":case"style-bg-color-8":case"style-bg-color-9":return"yellow";case"style-bg-color-0":case"style-bg-color-5":return"magenta";case"style-bg-color-3":return"green";case"style-bg-color-4":case"style-bg-color-11":return"blue";case"style-bg-color-6":return"lightGray";case"style-bg-color-7":return"red";case"style-bg-color-10":return"darkGreen";case"style-bg-color-12":return"darkMagenta";case"style-bg-color-13":return"darkGray";default:return}}function $Z(n){switch(n){case"style-bg-color-0":return"fbbab6";case"style-bg-color-1":return"ffdcb0";case"style-bg-color-2":return"fff7a0";case"style-bg-color-3":return"ceefc5";case"style-bg-color-4":return"d1ddfb";case"style-bg-color-5":return"d9cbf8";case"style-bg-color-6":return"eaeaea";case"style-bg-color-7":return"fe837c";case"style-bg-color-8":return"ffbd6a";case"style-bg-color-9":return"ffe662";case"style-bg-color-10":return"a8f393";case"style-bg-color-11":return"98b5ff";case"style-bg-color-12":return"b394f8";case"style-bg-color-13":return"b1b1b1";default:return}}const HZ=/rgb\((\d+),\s*(\d+),\s*(\d+)\)/;function WS(n){if(typeof n=="string"&&n.length>0){if(n[0]==="#")return n.substring(1);const t=n.match(HZ);if(t){const e=o=>{let l=Number(o).toString(16);return l.length<2&&(l=`0${l}`),l},r=e(t[1]),i=e(t[2]),s=e(t[3]);return`${r}${i}${s}`}if(n==="red")return"FF0000";if(n==="green")return"00FF00";if(n==="blue")return"0000FF"}}function Mn(n,t){if(n&&n.attributes&&n.attributes[t])return n.attributes[t];if(n&&n.attributes&&n.attributes.box&&n.attributes.inputType&&t==="style-underline")return!0}function qS(n,t,e){for(let r=0;r<=e;++r){const i=`${t}${r}`;if(Mn(n,i))return i}}function Kg(n,t,e){n.attributes=n.attributes||{},n.attributes[t]=e}function wx(n){return n==="image"||n==="drawio"||n==="plantuml"||n==="mermaid"||n==="flowchart"}function XS(n){return n&&n.startsWith("//")?`https:${n}`:n&&!n.startsWith("http://")&&!n.startsWith("https://")?`https://${n}`:n}function jZ(n){const t=Mn(n,"inlineStyle");if(t==null)return;const e=t.split(";");for(const r of e){const i=r.split(":");if(i.length!==2)continue;const s=i[0].trim().toLowerCase(),o=i[1].trim().toLowerCase();s==="font-size"&&Kg(n,"inline-style-font-size",o),s==="color"&&Kg(n,"inline-style-color",o),s==="background-color"&&Kg(n,"inline-style-background-color",o),s==="font-family"&&Kg(n,"inline-style-font-family",o)}}function zZ(n,t){if(t==null)return n==null?void 0:n.normal;if(n)return n[`heading${t}`]}function GZ(n){const t=`${Mn(n,"inline-style-font-size")}`;if(t&&t.indexOf("px")>0)return+t.replace(/px/g,"")}function WZ(n){if(n.attributes&&n.attributes.box&&n.attributes.text)return` ${n.attributes.text} `;if(n.attributes&&n.attributes.box&&n.attributes.inputType)return n.attributes.value?`${n.attributes.value}`:" "}function qZ(n){if(n.attributes&&n.attributes.box&&n.attributes.text)return` @${n.attributes.text} `}function XZ(n){return Mn(n,"inline-style-font-family")}function YZ(n){const t=Mn(n,"inline-style-background-color");return WS(t)}function QZ(n){const t=Mn(n,"inline-style-color");return WS(t)}function JZ(n){jZ(n);const t=Mn(n,"type")==="mention";return{box:n.attributes&&n.attributes.box?n.attributes:void 0,inlineCode:!!Mn(n,"style-code"),link:XS(Mn(n,"link")),size:GZ(n),text:t?qZ(n):WZ(n)||n.insert,bold:!!Mn(n,"style-bold"),underline:!!Mn(n,"style-underline"),italics:!!Mn(n,"style-italic"),strike:!!Mn(n,"style-strikethrough"),superScript:!!Mn(n,"style-super"),subScript:!!Mn(n,"style-sub"),math:Mn(n,"type")==="math"?Mn(n,"src"):void 0,mention:t,fontFamily:XZ(n),background:YZ(n),color:t?"338fe5":KZ(qS(n,"style-color-",6))||QZ(n),highlight:qS(n,"style-bg-color-",13)}}function ZZ(){return[new Bt.Paragraph({border:{top:{color:"auto",style:Bt.BorderStyle.DASHED,size:4,space:1}},spacing:{before:300}}),new Bt.Paragraph({spacing:{line:0}})]}function ttt(){return new Bt.Paragraph({children:[new Bt.TextRun({text:"[\u89C6\u9891\u6682\u4E0D\u652F\u6301\u5BFC\u51FA]",shading:{type:Bt.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}})]})}function ett(){return new Bt.Paragraph({children:[new Bt.TextRun({text:"[\u97F3\u9891\u6682\u4E0D\u652F\u6301\u5BFC\u51FA]",shading:{type:Bt.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}})]})}function ntt(n,t){return new Bt.Paragraph({children:[new Bt.ExternalHyperlink({children:[new Bt.TextRun({style:"Hyperlink",text:t||n})],link:n})]})}function YS(n){if(n.heading!=null)return`Heading${n.heading}`}function QS(n){if(n.alignment!=null){if(n.alignment==="center")return Bt.AlignmentType.CENTER;if(n.alignment==="right")return Bt.AlignmentType.RIGHT;if(n.alignment==="left")return Bt.AlignmentType.LEFT}}function rtt(n){if(n.indent)return{left:Bt.convertInchesToTwip(.3*n.indent-.2)};if(n.padding)return{left:Bt.convertInchesToTwip(.3*n.padding)}}function itt(n){return{type:Bt.ShadingType.CLEAR,color:"FFFFFF",fill:n}}function stt(n){const t=n.split(",");if(t.length!==0)return t[0].trim()}function JS(n,t){var s;let e;e=n.inlineCode?"InlineCode":void 0,e=n.link?"Hyperlink":e;const r=n.size||t,i=r!=null?Math.floor(r*1.5+.5):void 0;return n.text=(s=n.text)==null?void 0:s.replace(/\x00/g," "),new Bt.TextRun({text:n.text,bold:n.bold||void 0,underline:n.underline?{type:Bt.UnderlineType.SINGLE}:void 0,italics:n.italics||void 0,strike:n.strike||void 0,superScript:n.superScript||void 0,subScript:n.subScript||void 0,size:i,style:e,font:n.fontFamily?stt(n.fontFamily):void 0,shading:n.background?itt(n.background):void 0,color:n.color,highlight:VZ(n.highlight)})}function ott(n,t){if(n.link)return n.link=n.link.replace(/\x00/g," "),new Bt.ExternalHyperlink({children:[JS(n,t)],link:n.link})}async function ZS(n,t,e,r,i){const[s]=await i(n,t,e);if(s==null)return;const o=await zS({width:r||0,height:0,src:e},s);return new Bt.ImageRun({data:s,transformation:{width:(o==null?void 0:o.width)||100,height:(o==null?void 0:o.height)||20}})}function ltt(n){if(n.heading||n.heading)return n.heading}function att(n){if(n.align&&(n.align==="center"||n.align==="right"||n.align==="left"))return n.align}function ctt(n){if(n.textOnly===!0&&n.level!=null)return n.level}async function utt(n,t){var r;const e=[];if(n.text&&Array.isArray(n.text)){for(let i=0;i<n.text.length;i++){const s=n.text[i];if(((r=s.attributes)==null?void 0:r.box)===!0&&t){const o=await t(s);if(o){n.text.splice(i+1,0,...o);continue}}e.push(JZ(s))}return e}}function ftt(n){if(n.type==="list"&&n.textOnly!==!0)return{checkbox:n.checkbox,groupId:n.groupId,ordered:!!n.ordered,level:n.level||1,start:n.start||0}}function dtt(n,t){if(n.type==="embed"&&n.embedType&&wx(n.embedType)&&n.embedData&&n.embedData.src)return n.embedData.src.split("|").map(r=>{const i=t(r),s=n.embedData[`${i}_width`],o=n.embedData[`${i}_height`];return{src:r,width:s,height:o}})}function htt(n){if(n.padding)return n.padding}function mtt(n){return!!(n.type==="embed"&&n.embedType&&wx(n.embedType)&&n.embedData&&n.embedData.src)}async function Vg(n,t,e){return{quoted:!!n.quoted,heading:ltt(n),alignment:att(n),indent:ctt(n),padding:htt(n),texts:await utt(n,e),list:ftt(n),images:dtt(n,t),border:mtt(n)}}async function gtt(n,t,e,r){const i=[];if(!n.children)return[];for(const s of n.children){const o=[];for(const l of t.blocks[s])o.push(await Vg(l,e,r));i.push(o)}return i}const ptt=D("to-docx");function Ctt(n,t){return Array(n).fill(0).map(()=>Array(t).fill(0).map(()=>({cellId:void 0,color:void 0,from:void 0,rowSpan:1,colSpan:1,width:0,originalWidth:void 0,align:void 0})))}function Ett(n,t,e,r){const i=!!n.hasColTitle,s=!!n.hasRowTitle,o=!!n.isStripeStyle,l="F5F8FB";for(let c=0;c<t;c++)for(let d=0;d<e;d++)(i&&d===0||s&&c===0||o&&c%2===1)&&(r[c][d].color=l)}function Att(n){p(ptt,n.children,"no table children");const t=n.rows,e=n.cols,r=n.colsWidth;if(r)for(let o=0;o<r.length;o++)r[o]===0&&(r[o]=100);const i=Ctt(t,e);let s=0;for(let o=0;o<t;++o)for(let l=0;l<e;++l){if(i[o][l].originalWidth=r?r[l]:void 0,i[o][l].from!==void 0)continue;const c=n.children[s];s+=1,i[o][l].cellId=c,i[o][l].color=$Z(n[`${c}_background`]),i[o][l].width=r?r[l]:100,i[o][l].align=n[`${c}_align`];const d=n[`${c}_rowSpan`]||1,h=n[`${c}_colSpan`]||1;if(i[o][l].rowSpan=d,i[o][l].colSpan=h,d>1||h>1){let C=0;for(let E=0;E<d;E++)for(let A=0;A<h;A++)E===0&&(C+=r?r[l+A]:80),!(E===0&&A===0)&&(i[o+E][l+A].from=[o,l]);i[o][l].width=C}}return Ett(n,t,e,i),i}async function xtt(n,t,e,r,i,s,o,l,c,d){async function h(E){if(l&&E.type!=="_exportVirtualBlock"){const A=await l(i,s,E);if(A){await r.addDoc(n,A,d);return}}if(E.type==="text"||E.textOnly===!0){const A=await Vg(E,o,c);await r.addTextBlock(A);return}if(E.type==="code"){const A=await gtt(E,e,o,c);await r.addCodeBlockObject(A);return}if(E.type==="list"&&E.textOnly!==!0){const A=await Vg(E,o,c);await r.addListBlockObject(n,A);return}if(E.type==="embed"&&E.embedType){const A=E,v=A.embedData,w=A.embedType;if(wx(w)){const S=await Vg(E,o,c);await r.addImagesBlockObject(E,S,d)}else E.embedType==="hr"?r.addSeparatorBlock():E.embedType==="video"?r.addVideoPlaceholder():E.embedType==="audio"?r.addAudioPlaceholder():E.embedType==="webpage"?r.addHyperlinkParagraph(XS(v.src),v.title):r.addOtherEmbedBlock(w,E.embedData);return}if(E.type==="table"){let A=[];if(E.colsWidth)A=E.colsWidth;else{const w=E.cols;A=new Array(w);for(let S=0;S<A.length;S++)A[S]=100;E.colsWidth=A}const v=Att(E);await r.addTableMatrix(A,v,e),r.addEmptyParagraph()}E.type==="_exportVirtualBlock"&&await r.addVirtualBlock(E.id,e,d)}function C(E){var w;const A=((w=E==null?void 0:E.embedData)==null?void 0:w.exportSpec)||(E==null?void 0:E.exportSpec);if(!A)return[E];const v=[];for(const{type:S,data:U}of A){if(S==="text"){const M={id:it(),text:[{insert:U}],type:"text"};v.push(M);continue}if(S==="image"){const M={id:it(),type:"embed",embedType:"image",align:"left",embedData:{src:U}};v.push(M);continue}if(S==="link"){const M={id:it(),type:"embed",embedType:"webpage",embedData:{src:U.url,title:U.title}};v.push(M);continue}if(S==="block")for(const M of U){if(!e.blocks[M])continue;const nt={id:M,type:"_exportVirtualBlock"};v.push(nt)}}return v}for(const E of t)for(const A of C(E))!A||await h(A)}function btt(){return{listMaxInst:1,listInstMap:{},listRefMap:{},levelConfigs:[]}}const vtt=D("to-docx");class Btt{constructor(t,e,r,i,s,o){m(this,"paragraphs");this.appId=t,this.docId=e,this.state=r,this.readImageFunc=i,this.convertBlocksFunc=s,this.defaultFontSize=o,this.paragraphs=[]}async addTextBlock(t){this.paragraphs.push(new Bt.Paragraph({heading:YS(t),alignment:QS(t),children:await this.paragraphsFromBlockTexts(t),indent:rtt(t)}))}async addEmptyImagePlaceHolder(){this.paragraphs.push(new Bt.Paragraph({text:`[${_.t("docx.imageExportFailed")}]`,shading:{type:Bt.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}}))}async paragraphsFromBlockTexts(t){if(t.texts==null)return;const e=zZ(this.defaultFontSize,t.heading),r=[];for(const i of t.texts){if(i.link){const s=ott(i,e);s&&r.push(s);continue}if(i.box&&i.box.type&&i.box.type==="br"){r.push(new Bt.TextRun({text:"",break:1}));continue}if(i.box&&i.box.type&&i.box.type==="image"){const s=await ZS(this.appId,this.docId,i.box.src,i.box.width,this.readImageFunc);s&&r.push(s);continue}if(i.math){const s=await ZS(this.appId,this.docId,i.math,0,this.readImageFunc);s&&r.push(s);continue}r.push(JS(i,e))}return r}async addCodeBlockObject(t){for(const e of t)for(const r of e){const i={style:Bt.BorderStyle.SINGLE,color:"#DEDEDE"};this.paragraphs.push(new Bt.Paragraph({style:"Code",border:{left:{...i},right:{...i},top:{...i},bottom:{...i}},children:await this.paragraphsFromBlockTexts(r)}))}}async addListBlockObject(t,e){if(e.list==null)return;let r;const i=e.list.checkbox?`${t}-${e.list.groupId}-${e.list.checkbox}`:`${t}-${e.list.groupId}`;if(this.state.listInstMap[i])r=this.state.listInstMap[i];else if(r=this.state.listMaxInst,this.state.listMaxInst+=1,this.state.listInstMap[i]=r,e.list.start>0&&e.list.ordered){const o=`number-numbering-reference-${r}`,l=GS([e.list.level-1],e.list.start);this.state.levelConfigs.push({levels:l,reference:o,inst:r}),this.state.listRefMap[i]=o}else e.list.ordered?this.state.listRefMap[i]=ah.NUMBERING:e.list.checkbox&&e.list.checkbox==="checked"?this.state.listRefMap[i]=ah.CHECKED:e.list.checkbox&&e.list.checkbox==="unchecked"?this.state.listRefMap[i]=ah.UNCHECKED:this.state.listRefMap[i]=ah.BULLET;const s=YS(e);e.texts&&this.paragraphs.push(new Bt.Paragraph({heading:s,children:await this.paragraphsFromBlockTexts(e),numbering:{reference:this.state.listRefMap[i],level:e.list.level-1,instance:r}}))}imageDimWithBufferToImageRun(t){return new Bt.ImageRun({data:t.buffer,transformation:{width:t.width,height:t.height}})}async addImagesBlockObject(t,e,r){if(e.images==null){if(t.type==="embed"&&t.embedType==="image"){const{src:c}=t.embedData;c||this.addEmptyImagePlaceHolder()}return}const i=[],s=await Promise.all(e.images.map(async c=>{const[d,h]=await this.readImageFunc(this.appId,this.docId,c.src);if(d){const C=await zS(c,d);if(C)return C}i.push(h)}));UZ(s,r,t.embedData);const o=MZ(s,r),l={style:Bt.BorderStyle.SINGLE,color:"#DEDEDE"};o.length&&this.paragraphs.push(new Bt.Paragraph({border:e.border?{left:{...l},right:{...l},top:{...l},bottom:{...l}}:void 0,alignment:QS(e)||Bt.AlignmentType.CENTER,children:o.map(c=>this.imageDimWithBufferToImageRun(c)).flatMap((c,d,h)=>c==null?[]:h.length-1!==d?[c,new Bt.TextRun({text:" "})]:c)})),i.forEach(c=>{this.addHyperlinkParagraph(c)})}addSeparatorBlock(){ZZ().forEach(t=>this.paragraphs.push(t))}addEmptyParagraph(){this.paragraphs.push(new Bt.Paragraph(""))}addVideoPlaceholder(){this.paragraphs.push(ttt())}addAudioPlaceholder(){this.paragraphs.push(ett())}addHyperlinkParagraph(t,e){t!=null&&this.paragraphs.push(ntt(t,e))}async addTableMatrix(t,e,r){const i=t.map(s=>s!==0?s*15:1500);this.paragraphs.push(new Bt.Table({rows:await this.generateTableRows(e,r),columnWidths:i}))}async generateRowCells(t,e){const r=[];for(const i of t){const s=i.cellId;if(s===void 0)continue;const o=i.width*.9;r.push(new Bt.TableCell({children:await this.convertBlocksFunc(s,e.blocks[s],e,this.appId,this.docId,this.state,o),columnSpan:i.colSpan,rowSpan:i.rowSpan,width:{type:Bt.WidthType.DXA,size:i.width*15},shading:i.color?{fill:i.color,type:Bt.ShadingType.CLEAR,color:"auto"}:void 0}))}return r}async generateTableRows(t,e){const r=[];for(const i of t)r.push(new Bt.TableRow({children:await this.generateRowCells(i,e)}));return r}async addDoc(t,e,r){const i=await this.convertBlocksFunc(t,e.blocks.root,e,this.appId,this.docId,this.state,r);i&&(this.paragraphs=this.paragraphs.concat(i))}async addVirtualBlock(t,e,r){const i=await this.convertBlocksFunc(t,e.blocks[t],e,this.appId,this.docId,this.state,r);this.paragraphs.push(...i)}async addOtherEmbedBlock(){}}class ytt{constructor(t,e,r,i,s,o,l,c){m(this,"convertBlocks",async(t,e,r,i,s,o,l=720)=>{const c=new Btt(i,s,o,this.readImage,this.convertBlocks,this.defaultFontSize);return await xtt(t,e,r,c,i,s,this.md5HexFunc,this.getDocByBlock,this.getTextsByBox,l||720),c.paragraphs});this.templateData=t,this.docData=e,this.md5HexFunc=r,this.readImage=i,this.defaultFontSize=s,this.getDocByBlock=o,this.getTextsByBox=l,this.backgroundImageOptions=c}async convert(t,e){return this.snapshot2docx(this.docData,t,e)}async snapshot2docx(t,e,r){const i=new Bt.ImportDotx,s=this.templateData?await i.extract(this.templateData):void 0,o=t.blocks.root;p(vtt,o,"data must have blocks");const l=btt(),c=await this.convertBlocks("blocks",o,t,e,r,l),d=this.backgroundImageOptions?{default:new Bt.Header({children:[new Bt.Paragraph({children:[new Bt.ImageRun(this.backgroundImageOptions)]})]})}:{},h=new Bt.Document({numbering:{config:[...FZ,...l.levelConfigs]},sections:[{headers:d,children:c,properties:{page:{size:{width:12240,height:15840},margin:{top:1440,bottom:1440,left:1440,right:1440}}}}]},{template:s});return Bt.Packer.toBlob(h)}}const Ttt=D("editor-to-docx");async function ktt(n,t,e,r){const i=n.doc.buildResourceUrl(r,{withToken:!0});let s=await CS(i);if(!s)return[void 0,i];if(s.type.indexOf("/svg")!==-1){const l=await mS(s);l&&(s=new File([l],s.name))}return[await s.arrayBuffer(),i]}async function Rtt(n,t,e){const r=n.editorBlocks.getBlockClass(e.type);if(r.toStandardDoc)try{return await r.toStandardDoc(n,e,t)}catch(i){Ttt.error(`toStandardDoc error: ${JSON.stringify(i)}`);return}}async function wtt(n,t){const e=t.attributes,r=n.editorBoxes.getBoxClass(e.type);if(r.toStandardText)return r.toStandardText(n,e)}async function Stt(n,t){let{template:e,download:r,backgroundImageOptions:i}=t!=null?t:{};e||(e=IZ());const s=n.doc.toJSON(),o=(C,E,A)=>ktt(n,C,E,A),l=async(C,E,A)=>Rtt(n,s,A),c=async C=>wtt(n,C),h=await new ytt(e,s,nm.default,o,void 0,l,c,i).convert("_appId","_docId");if(r){const C=URL.createObjectURL(h),E=document.createElement("a");E.setAttribute("download",`${pS(n)}.docx`),E.setAttribute("href",`${C}`),E.click(),E.remove()}return h}const Sx=D("create-editor");async function Ltt(n,t){var o,l,c,d,h,C,E,A,v,w,S,U,M,V,nt,Y;p(Sx,n,"app does not exists"),t.lang&&_.setLang(t.lang),hi.level=(o=t.logLevel)!=null?o:qo.DEBUG;const e=t.onReauth?async()=>{var bt;const X=t.user.userId,ft=t.docId,xt=await((bt=t.onReauth)==null?void 0:bt.call(t,X,ft,t.permission));return{userId:X,docId:ft,permission:t.permission,appId:t.appId,token:xt,displayName:t.user.displayName,avatarUrl:t.user.avatarUrl}}:void 0,r={auth:{appId:t.appId,docId:t.docId,userId:t.user.userId,permission:t.permission,token:t.token,displayName:t.user.displayName,avatarUrl:t.user.avatarUrl},serverUrl:t.serverUrl,reauthFunc:e,disableLogout:t.disableLogout,onMaxUsersError:t.onMaxUsersError},i=await hd.load(r),s=Zf(n,i,{id:t.id,scrollContainer:t==null?void 0:t.scrollContainer,enableComments:t==null?void 0:t.enableComments,enableContextMenu:t==null?void 0:t.enableContextMenu,components:{blocks:[...VS,...((l=t==null?void 0:t.components)==null?void 0:l.blocks)||[]],embeds:[...Rx,...((c=t.components)==null?void 0:c.embeds)||[]],boxes:[...$S,...((d=t.components)==null?void 0:d.boxes)||[]],commandProviders:[new P0,...((h=t.components)==null?void 0:h.commandProviders)||[]],decorators:[new fg,new WC],insertions:[G1],blockHooks:[new DA,new lw,...((C=t.components)==null?void 0:C.blockHooks)||[]],textRenders:[new T4,new WE,...((E=t.components)==null?void 0:E.textRenders)||[]],options:{...t.componentsOptions}},shortcuts:[Nq,fH,Bz,fA,Qw,AF,sA,bX,s0,dF,...t.shortcuts||[]],colors:["#0064FF","#EB3723","#F59300","#00A865","#F25A0A","#70A310","#009CAD","#0990D9","#8851ED","#D62069"]});if(s.editorCommandProviders.registerCommandProvider(new ms(s)),s.input.addHandler(new uY),s.input.addHandler(new hg),s.input.addHandler(new $K),s.input.addHandler(new gz),s.input.addHandler(new xA(s,{hideTitle:t.hideTitle,headingLevel:1,titlePlaceholder:_.t("placeholder.common.title"),contentPlaceholder:_.t("placeholder.common.content"),readonlyTitlePlaceholder:_.t("placeholder.common.readonlyTitle"),addPlaceholderToAllCurrentEmptyBlock:!0,applyContentPlaceholder:(A=t.placeholder)==null?void 0:A.applyContentPlaceholder})),s.input.addHandler(new sg(s,(v=t.componentsOptions)==null?void 0:v.quickMenu)),s.input.addHandler(new PA(s)),s.input.addHandler(new jA(s)),s.input.addHandler(new Cg),s.input.addHandler(new Ik),s.doc.registerCallback(new fY(s)),s.addCustom("remote-cursor",()=>new uT(s)),s.addCustom("block-menu",X=>new uw(X)),xe.isMobile||s.addCustom("editor-tooltip",()=>new Ld(s)),t!=null&&t.enableComments&&s.addCustom("editor-comments",X=>new y4(X,new TZ(X))),t.enableContextMenu!==!1&&s.addCustom("editor-context-menu",X=>new WA(X)),s.addCustom("create-options",()=>new Db(s,t)),s.addCustom("drop-target",()=>new qd(s)),s.addCustom("list-to-mindmap",()=>new Z0(s)),s.addCustom("list-to-mention",()=>new DY(s)),s.addCustom("mobile-helper",()=>new tQ(s)),s.addCustom("code-caret",()=>new lH(s)),s.addCustom("image-paste-handler",()=>new NA(s)),(w=t.componentsOptions)!=null&&w.mention){const X=t.componentsOptions.mention;s.addCustom("mention",()=>new cS(s,X))}if(s.addCustom("heading-collapse",()=>new fx(s)),s.addCustom(Pg,X=>new Ex(X)),Au.register(s),qd.register(s),Ll.register(s),yl.register(s),s.addListener("clickLink",(X,ft,xt)=>{var wt;if((wt=t==null?void 0:t.events)!=null&&wt.onClickLink){t.events.onClickLink(X,ft,xt);return}const bt=xt.getAttribute("link");bt&&(X.readonly||ft.ctrlKey||ft.metaKey)&&window.open(bt,"_blank")}),(U=(S=t.componentsOptions)==null?void 0:S.remoteCarets)!=null&&U.onUserChanged){const X=(V=(M=t.componentsOptions)==null?void 0:M.remoteCarets)==null?void 0:V.onUserChanged;s.doc.getRemoteUsers().on("change",ft=>{X(s,ft)})}return(Y=(nt=t.componentsOptions)==null?void 0:nt.templates)!=null&&Y.templates.length&&(s.addListener("docChanged",()=>{Ng(s)}),s.addListener("resize",()=>{Ng(s,{reset:!0})}),setTimeout(()=>{Ng(s)},100)),s.doc.registerCallback({onError:async X=>{if(X.code==="ResetDoc"){Sx.error(`reset doc: ${X.message}`);const ft=await hd.load(r);s.doc.reset(ft)}}}),s.version="1.1.27-beta.4",hi.level===qo.DEBUG&&(window.setReauthFail=X=>{window.isReauthError=X},window.reConnect=X=>s.doc.externalDoc.client.connection.reConnect(X)),s}function Itt(n){return n.toJSON!==void 0}async function Dtt(n,t,e){var s,o,l,c,d,h,C,E;p(Sx,n,"app does not exists");const r=Itt(t)?t:new TC(t,{serverUrl:e.serverUrl||""});e.lang&&_.setLang(e.lang),hi.level=(s=e.logLevel)!=null?s:qo.DEBUG;const i=Zf(n,r,{id:e.id,scrollContainer:e==null?void 0:e.scrollContainer,components:{blocks:[uA,EA,AA,Dk,...(l=(o=e.components)==null?void 0:o.blocks)!=null?l:[]],commandProviders:[new P0],decorators:[new fg,new WC],embeds:[...Rx,...((c=e.components)==null?void 0:c.embeds)||[]],boxes:[jk,uS,_4,...((d=e.components)==null?void 0:d.boxes)||[]],insertions:[G1],blockHooks:[new DA,...((h=e.components)==null?void 0:h.blockHooks)||[]],textRenders:[new T4,new WE,...((C=e.components)==null?void 0:C.textRenders)||[]],options:{...e.componentsOptions}},shortcuts:[fA,Qw,sA,s0]});return i.editorCommandProviders.registerCommandProvider(new ms(i)),i.input.addHandler(new hg),i.input.addHandler(new xA(i,{hideTitle:e.hideTitle,headingLevel:1,titlePlaceholder:_.t("placeholder.common.title"),contentPlaceholder:_.t("placeholder.common.content"),readonlyTitlePlaceholder:_.t("placeholder.local.readonlyTitle"),addPlaceholderToAllCurrentEmptyBlock:!0})),i.input.addHandler(new sg(i,(E=e.componentsOptions)==null?void 0:E.quickMenu)),i.input.addHandler(new PA(i)),i.input.addHandler(new jA(i)),i.input.addHandler(new Cg),i.input.addHandler(new Ik),i.addCustom("block-menu",A=>new uw(A)),xe.isMobile||i.addCustom("editor-tooltip",()=>new Ld(i)),i.addCustom("image-paste-handler",()=>new NA(i)),e!=null&&e.enableComments&&i.addCustom("editor-comments",A=>new y4(A,new kZ(A,r))),e.enableContextMenu!==!1&&i.addCustom("editor-context-menu",A=>new WA(A)),i.addCustom("heading-collapse",()=>new fx(i)),i.addListener("clickLink",(A,v,w)=>{var U;if((U=e==null?void 0:e.events)!=null&&U.onClickLink){e.events.onClickLink(A,v,w);return}const S=w.getAttribute("link");S&&(A.readonly||v.ctrlKey||v.metaKey)&&window.open(S,"_blank")}),i.addCustom(Pg,A=>new Ex(A)),Au.register(i),i.version="1.1.27-beta.4",i}async function _tt(n,t,e){var h;const r=n.doc.externalDoc.client.auth,i=await C0.load({auth:r,serverUrl:e});if(!((h=i.getVersionHelper)==null?void 0:h.call(i)))throw new Error("the editor does not support to show versions");const o=n.getCustom("create-options");if(!o)throw new Error("the editor does not support to show versions");const l=o.getData(),c=new HS(l),d=n.addCustom("version-dialog",()=>new X4(i,c));return d.show(t),d}b.tippy=c9,b.AnchorBox=w3,b.AuthError=fd,b.AuthHeader=xa,b.AutoScroll=xm,b.BaseURLHeader=eu,b.BasicCommands=uK,b.BlockExclusiveHook=lw,b.BlockLockerHook=DA,b.BlockLockerPasteHandler=Cg,b.BlockResizer=Pd,b.BrBox=y3,b.CodeBlock=EA,b.CodeLineBlock=AA,b.CodeTextDecorator=fg,b.DOC_RE_AUTH_KEYS=Pg,b.DefaultShortcuts=s0,b.DocIdError=tO,b.DocReAuthCallbacks=Ex,b.DragDrop=Yb,b.DrawioEmbed=LS,b.EditorBlocks=lB,b.EditorBoxes=k3,b.EditorCommandProviders=yy,b.EditorComplexBlockPosition=Ai,b.EditorComplexSelectionRange=Qi,b.EditorDecorators=D3,b.EditorEmbeds=cB,b.EditorInsertions=I3,b.EditorSimpleBlockPosition=gn,b.EditorSimpleSelectionRange=bn,b.EmbedBlock=fB,b.EmbedBlockResizer=nh,b.EnforceWithDocumentTitleHandler=xA,b.EventCallbacks=Lc,b.FILL_CHAR=T8,b.FileExtError=eO,b.GroupOrder=Ok,b.HeadingBlockScrollListener=TY,b.ImageBox=R3,b.InlineBoxCommandProvider=Yk,b.InputtingInsertion=S3,b.LocalDoc=TC,b.LogLevel=qo,b.Logger=hi,b.MIN_DISTANCE_THRESHOLD=qb,b.ManualCloseDialog=gd,b.ManualMenu=dl,b.ManualToolbar=md,b.MarkdownInputHandler=hg,b.MaxUserError=PC,b.Mindmap=J0,b.OnesEditorAutoSuggest=mE,b.OnesEditorCustomDataWrapper=Db,b.OnesEditorExclusiveBlock=yl,b.OnesEditorHoveringBlock=$e,b.OnesEditorIcons=KO,b.OnesEditorQuickMenu=sg,b.OnesEditorToc=oh,b.OnesEditorTocProvider=Ll,b.OnesEditorToolbar=Au,b.OnesEditorTooltip=Ld,b.OnesEditorVersionsDialog=X4,b.PermissionError=p0,b.Popup=su,b.ReAuthToolbar=ES,b.RemoteCarets=uT,b.RemoteCaretsDecorator=WC,b.RemoteCaretsInsertion=G1,b.RemoteUsers=td,b.RequestReloadError=dd,b.RichText=$n,b.ShareDBDoc=hd,b.ShareDBDocVersionsProvider=HS,b.ShareDBServer=C0,b.SimpleCache=Kb,b.StandardEmbedBlockCommands=rx,b.TEXT_STYLE_BACKGROUND_COLOR_PREFIX=T1,b.TEXT_STYLE_COLOR_PREFIX=y1,b.TableBlock=uA,b.TableBlockCommandProvider=P0,b.TableShortcuts=fA,b.TextBlock=lr,b.TextBox=B3,b.TextColorItem=w2,b.TextStyleShortcuts=sA,b.TocEmbed=lS,b.ZERO_WIDTH_SPACE_CHAR=xf,b.abbreviation=bm,b.addAttribute=Lm,b.addClass=q,b.addCommentToBlock=eh,b.addDays=AI,b.addMetaToDoc=Qf,b.addMonths=EI,b.animateScrollTo=ra,b.applyPlaceholderToBlock=Od,b.assert=p,b.autoShowHideTemplates=Ng,b.bindKeyDownEvent=dm,b.blockToDoc=AC,b.blockToHtml=X1,b.blockToMarkdown=Gm,b.blockToText=zm,b.blocksToDoc=W5,b.clearAllSelection=Vv,b.clientType=xe,b.cloneBlock=sl,b.cloneChildContainer=sC,b.cloneDoc=oC,b.cloneText=m3,b.commentToShareDbComment=GC,b.compareElement=cm,b.comparePosition=p1,b.complexBlockAdjustSelectionPos=Rm,b.complexBlockFindNearestChildBlock=C7,b.complexBlockGetAllChildContainers=In,b.complexBlockGetBottomChildContainers=gB,b.complexBlockGetDeepFirstChild=dB,b.complexBlockGetFirstSimpleChild=E1,b.complexBlockGetLastSimpleChild=Pc,b.complexBlockGetSelectedContainers=Nc,b.complexBlockGetTopChildContainers=mB,b.containerToDoc=q5,b.continuousScroll=hv,b.convertBlockFrom=Tm,b.convertImageFileToPng=mS,b.convertImageSrcToPng=qY,b.converterIntercept=dg,b.copyBlockAttributes=z3,b.copyResourcesFromDoc=yC,b.createBlockAnchor=$s,b.createBlockCaretAnchor=CB,b.createBlockContentElement=ua,b.createBlockElement=Mv,b.createBlockSimpleDocRange=Km,b.createBlockSimpleRange=Ue,b.createBoxContentElement=Nv,b.createBoxElement=Uv,b.createBoxOp=h3,b.createChildContainer=sB,b.createComplexBlockPosition=Me,b.createComplexDocPos=A3,b.createComplexDocRange=w8,b.createContainer=p3,b.createContainerElement=t1,b.createDeleteOps=c3,b.createEditor=Zf,b.createEditorSelectionRange=pn,b.createElement=B,b.createEmptyContainer=qs,b.createEmptyDoc=Ws,b.createEmptyTextBlockData=Pm,b.createExpandedRange=lm,b.createIconButton=ta,b.createImage=_p,b.createInsertOps=Om,b.createInsertionContentElement=Kv,b.createInsertionElement=Pv,b.createLocalEditor=Dtt,b.createOnesEditor=Ltt,b.createRange=Vb,b.createRichText=pa,b.createRootContainer=iB,b.createSimpleBlockPosition=ht,b.createSimpleDocPos=E3,b.createTextBlockData=es,b.createTextButton=Sa,b.createTextOp=qr,b.createTextWithReplaceSoftReturn=N1,b.daysAfter=qp,b.deleteText=F1,b.diffDays=xI,b.disablePageScroll=jp,b.docToHtml=K3,b.docToHtmlFragment=jf,b.docToMarkdown=V3,b.docToText=il,b.downloadImageToFile=CS,b.downloadObjectToFile=bx,b.downloadSvgToString=bS,b.editLink=kd,b.editorAddComment=wq,b.editorAddTextAttribute=n5,b.editorAutoInsertBlock=G3,b.editorBreakTextBlock=qc,b.editorClearCompositionText=Z1,b.editorClearSelectedContents=Qm,b.editorCopyBlock=vC,b.editorCopyDoc=i0,b.editorDeleteBlock=nC,b.editorDeleteBlockText=tC,b.editorDeleteBlockWithoutChildren=Xm,b.editorDeleteChildContainer=T_,b.editorDeleteChildContainers=W3,b.editorFocusToBlock=iC,b.editorFocusToEnd=j_,b.editorGetBlockData=Xs,b.editorGetBlockText=Yn,b.editorGetBlockTextEx=$m,b.editorGetBoxData=b3,b.editorHandleKeyboardEvent=oy,b.editorInsertBlock=Wc,b.editorInsertBoxToBlock=H3,b.editorInsertDoc=t5,b.editorInsertDocAt=lC,b.editorInsertText=J1,b.editorInsertTextToBlock=$3,b.editorInsertTextToBlockEx=Q1,b.editorMergeTextBlock=q3,b.editorMoveDown=g5,b.editorMoveEnd=mC,b.editorMoveHome=T5,b.editorMoveLeft=d5,b.editorMoveLineEnd=_5,b.editorMoveLineHome=D5,b.editorMovePageDown=F5,b.editorMovePageUp=P5,b.editorMoveRight=h5,b.editorMoveUp=m5,b.editorMoveWordEnd=v5,b.editorMoveWordLeft=b5,b.editorRangeClearColor=i5,b.editorRangeGetColor=s5,b.editorRangeSetColor=r5,b.editorRemoveTextAttribute=S_,b.editorReplaceBlockText=Jm,b.editorReplaceContainer=e5,b.editorRunOnce=kC,b.editorSelectAll=pC,b.editorSelectContainer=e0,b.editorSelectDown=p5,b.editorSelectEnd=gC,b.editorSelectHome=k5,b.editorSelectLeft=C5,b.editorSelectLineEnd=I5,b.editorSelectLineHome=L5,b.editorSelectPageDown=$5,b.editorSelectPageUp=V5,b.editorSelectRight=E5,b.editorSelectUp=A5,b.editorSelectWordEnd=y5,b.editorSelectWordLeft=B5,b.editorSetTextColor=Xc,b.editorShowFindDialog=AW,b.editorToDocx=Stt,b.editorUpdateBlockData=Zm,b.editorUpdateCompositionText=j3,b.editorUpdateEmbedData=J3,b.enablePageScroll=zp,b.escapeHtmlText=hm,b.escapeRegExp=Jp,b.escapeSpace=tI,b.exclusiveBlock=SA,b.executeBlockCommand=Yv,b.executeEmbedBlockCommand=Xv,b.executeRangeCommand=By,b.fileToDataUrl=_c,b.findAfterOffsetNotType=H1,b.findAllText=CC,b.findBlockByIndex=kv,b.findEventTargetBlock=jb,b.findInsertionById=Fv,b.findNextOffset=q8,b.findNextVisibleSimpleBlock=wy,b.findPrevOffset=W8,b.findPrevOffsetNotType=$1,b.findPrevSimpleBlockBeforeChildContainer=hB,b.findPrevVisibleSimpleBlock=Ry,b.findTarget=Dc,b.findWordEnd=z1,b.findWordLeft=j1,b.format=kf,b.formatBytes=mv,b.formatDate=Yp,b.fragmentToHtml=lv,b.fromBase64=vf,b.fromBase64ToBlob=$p,b.fromBase64ToUint8Array=fI,b.fromDocRange=el,b.fromNowString=Qp,b.genId=it,b.generateEditorContainerId=Zp,b.getAllChildBlocks=v1,b.getAllQuickMenuItems=iA,b.getAllSelectedBlocks=Ji,b.getAttributesAt=$c,b.getBlockBackground=r1,b.getBlockByIndex=Qo,b.getBlockCaretRect=Zo,b.getBlockClass=le,b.getBlockClassByType=la,b.getBlockClientRects=Fs,b.getBlockCommandsWithHook=u1,b.getBlockContent=zt,b.getBlockHeading=If,b.getBlockId=ut,b.getBlockIndex=Rt,b.getBlockInfo=Hd,b.getBlockKind=Ci,b.getBlockMinWidth=Hv,b.getBlockNearestRangeFromPoint=x1,b.getBlockOptions=_I,b.getBlockPath=tl,b.getBlockProperties=Gv,b.getBlockRangeFromPoint=wm,b.getBlockStyles=DI,b.getBlockTextLength=Ct,b.getBlockTools=be,b.getBlockType=Ot,b.getBoxContent=s1,b.getBoxId=Ov,b.getBoxTypeFromElement=Lf,b.getChildBlockCount=qi,b.getChildBlocks=ke,b.getChildOffset=nl,b.getColorFromAttributes=R1,b.getColorFromContent=vm,b.getComplexBlockClass=Hr,b.getContainerBlockPath=eB,b.getContainerBlocks=yv,b.getContainerBlocksElement=wf,b.getContainerById=pi,b.getContainerId=pt,b.getContainerMinWidth=m1,b.getContainerToolsElement=SI,b.getContainerWidth=oB,b.getDistanceSquare=Xo,b.getElementFromPoint=Pe,b.getElementOffset=Af,b.getElementScale=$r,b.getEmbedType=on,b.getExistsBlockTools=Bm,b.getExistsContainerById=Rf,b.getFileExt=Tf,b.getFirstChildBlock=_e,b.getFirstClientRect=am,b.getHeadingBlockChildren=Oc,b.getHeadingMenuOptions=tA,b.getHorizontalPadding=Up,b.getInsertionContent=o1,b.getLastChildBlock=Ge,b.getLastClientRect=ea,b.getListAllNextBrothers=mu,b.getLogger=D,b.getNextBlock=ae,b.getNextHiddenBlocks=Zv,b.getNextValidOffset=ma,b.getNextVisibleBlock=zr,b.getOffsetFromPoint=Mp,b.getOffsetInfoAfter=Vf,b.getOffsetInfoBefore=Hm,b.getOpAt=HB,b.getOpLength=Sm,b.getParentBlock=et,b.getParentBlockExcludeSelf=ca,b.getParentBox=i1,b.getParentContainer=at,b.getPrevBlock=He,b.getPrevValidOffset=rl,b.getPrevVisibleBlock=jr,b.getRangeCommands=by,b.getReferenceClientRect=lk,b.getRootBlock=c1,b.getScrollContainer=mn,b.getSpecialBlockCommands=Wv,b.getStandardEmbedBlockProperties=ix,b.getTextAfterOffset=z8,b.getTextAttributes=Y1,b.getTextBeforeOffset=G8,b.getTextBlockChild=Mf,b.getTextBlockClass=wv,b.getTextBlockContentChildTextLength=Wr,b.getTextBlockContentChildType=tB,b.getTextBlockContentChildren=Yi,b.getTextLength=Vn,b.getTextOpLength=B1,b.getTextWidth=Cm,b.getToolbar=z0,b.handleBlockElementUpdated=jv,b.hasAltOnly=oI,b.hasClass=Mt,b.hasCtrlOrCmd=nv,b.hasCtrlOrCmdOnly=sI,b.hashCode=bv,b.hideBlock=_v,b.hideTemplates=hS,b.htmlToFragment=pm,b.i18n=_,b.includeBigTable=pN,b.injectDocToHtmlFragment=Yf,b.injectStyle=Wb,b.inputActions=uM,b.insertEmptyBlock=OI,b.insertEmptyEmbedBlock=f1,b.insertText=Gs,b.intersectionCommands=HM,b.isBackspace=iv,b.isBlock=aa,b.isBlockLocked=pg,b.isBlockLockedByOthers=IA,b.isBlockLockedBySelf=jd,b.isBlockTools=Dv,b.isBox=ym,b.isBoxOp=Hs,b.isCJK=tv,b.isChildContainer=gi,b.isChildNode=Ce,b.isCodeBlock=Di,b.isCollapsedHeadingBlock=Xi,b.isCollapsedRange=R8,b.isComplexBlockPosition=da,b.isComplexKindBlock=Pt,b.isContainer=Yo,b.isContainerSelectedAllChildBlocks=H5,b.isControlEvent=sa,b.isDelete=aI,b.isDraggingFiles=Em,b.isElementVisible=fm,b.isEmbedBlock=Le,b.isEmptyContainer=Uf,b.isEmptyDoc=K1,b.isEmptyTextBlock=ve,b.isEmptyTextBlockWithoutCompositionText=Ud,b.isEnterOnly=rv,b.isEscape=gm,b.isExclusiveBlock=$d,b.isExpandedHeadingBlock=Jv,b.isFirefox=Cf,b.isFirstChildBlockInComplexBlock=p7,b.isHeadingBlock=Ln,b.isHighSurrogate=Y9,b.isInBlock=l1,b.isInBlockTools=Uc,b.isLetter=Zb,b.isLowSurrogate=Q9,b.isMatchShortcut=Gi,b.isMoveForward=rI,b.isNavigationEvent=nI,b.isNavigationKey=ev,b.isNodeRemoved=Ef,b.isNumber=Jb,b.isPrintableKey=Kp,b.isRootBlock=Gr,b.isRootContainer=re,b.isSafari=Zl,b.isSameDay=Xp,b.isSelectBoxOnly=ti,b.isShiftEnter=lI,b.isShiftTab=uI,b.isShortcutEvent=iI,b.isSimpleBlock=II,b.isSimpleBlockPosition=xi,b.isSimplePos=C3,b.isSimpleRange=Fm,b.isSpace=mm,b.isTab=cI,b.isTextBlockContentBoxChild=Br,b.isTextBlockContentChild=Df,b.isTextBlockContentInsertionChild=Vs,b.isTextBlockContentTextChild=_f,b.isTextKindBlock=ot,b.isTextKindBlockType=Sf,b.isTitleBlock=Ps,b.isToday=gv,b.isValidOffset=or,b.isVisibleBlock=Jo,b.isYesterday=pv,b.loadJs=Hb,b.loadJsPromise=na,b.lockers=mi,b.mergeCommands=j0,b.mergeDocs=Ca,b.mergeOps=P1,b.mergeText=B8,b.multiSplitText=zB,b.overflowText=Cv,b.parseShortcut=sv,b.patchNode=Bf,b.pointInRect=ia,b.rangeAddAttribute=Pf,b.rangeGetTextColor=JB,b.rangeRemoveAttribute=Vc,b.rangeSetTextColor=XB,b.rangeTransformText=WB,b.registerDragDrop=Pp,b.removeAttribute=k1,b.removeClass=ct,b.removeLastBr=A8,b.removePlaceholderFromBlock=DR,b.removeStyle=Gb,b.replaceAll=bI,b.replaceAllCaseInsensitive=vI,b.replaceAllText=z5,b.replaceText=Nm,b.requestDownload=Am,b.resetListStart=pu,b.scrollIntoView=Hf,b.scrollable=dv,b.selectFile=Mc,b.selectedBlockToDoc=n0,b.selectionToDoc=Yc,b.setAttributes=um,b.setClipboardData=yf,b.setClipboardDataByEvent=mI,b.setColorToAttributes=YB,b.setDataset=Op,b.setDefaultCursor=bf,b.setStyles=Np,b.shareDBCommentToDocObject=zC,b.shareDBDocCommentToComment=aT,b.shortcutToDisplayText=hn,b.showBlock=n1,b.showDocVersions=_tt,b.showTemplates=px,b.splitText=sr,b.splitToThree=ln,b.stringToDataUrl=Hp,b.stringToObjectUrl=Gp,b.subText=GB,b.textNodeOffsetFromPoint=$b,b.titleFromEditor=pS,b.toBase64URL=Wi,b.toMindmap=Q0,b.toPlainText=Re,b.toPlainTextKeepLength=V1,b.trimChar=Fp,b.unexclusiveBlock=LA,b.unicodeLength=J9,b.unicodeSubstr=Z9,b.updateBlockSelection=$v,b.updateOpAttributes=g3,b.updateTextBlockContent=j8,b.updateUrl=Vp;for(const n in Ve)n!=="default"&&!b.hasOwnProperty(n)&&Object.defineProperty(b,n,{enumerable:!0,get:()=>Ve[n]});Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});