@zipify/wysiwyg 4.11.0-4 → 4.11.0
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/cli.js +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -61,4 +61,4 @@ __p += '`),pe&&(B+=`' +
|
|
|
61
61
|
function print() { __p += __j.call(arguments, '') }
|
|
62
62
|
`:`;
|
|
63
63
|
`)+B+`return __p
|
|
64
|
-
}`;var se=tm(function(){return ye(x,j+"return "+B).apply(t,C)});if(se.source=B,Xu(se))throw se;return se}function Vx(o){return _e(o).toLowerCase()}function Ux(o){return _e(o).toUpperCase()}function qx(o,l,f){if(o=_e(o),o&&(f||l===t))return cd(o);if(!o||!(l=kt(l)))return o;var d=tn(o),b=tn(l),x=fd(d,b),C=hd(d,b)+1;return sr(d,x,C).join("")}function Kx(o,l,f){if(o=_e(o),o&&(f||l===t))return o.slice(0,pd(o)+1);if(!o||!(l=kt(l)))return o;var d=tn(o),b=hd(d,tn(l))+1;return sr(d,0,b).join("")}function Gx(o,l,f){if(o=_e(o),o&&(f||l===t))return o.replace(Xl,"");if(!o||!(l=kt(l)))return o;var d=tn(o),b=fd(d,tn(l));return sr(d,b).join("")}function Jx(o,l){var f=te,d=Se;if(Oe(l)){var b="separator"in l?l.separator:b;f="length"in l?ie(l.length):f,d="omission"in l?kt(l.omission):d}o=_e(o);var x=o.length;if(ri(o)){var C=tn(o);x=C.length}if(f>=x)return o;var O=f-ii(d);if(O<1)return d;var I=C?sr(C,0,O).join(""):o.slice(0,O);if(b===t)return I+d;if(C&&(O+=I.length-O),Zu(b)){if(o.slice(O).search(b)){var P,D=I;for(b.global||(b=pu(b.source,_e(Nh.exec(b))+"g")),b.lastIndex=0;P=b.exec(D);)var B=P.index;I=I.slice(0,B===t?O:B)}}else if(o.indexOf(kt(b),O)!=O){var q=I.lastIndexOf(b);q>-1&&(I=I.slice(0,q))}return I+d}function jx(o){return o=_e(o),o&&ob.test(o)?o.replace(Oh,C2):o}var Yx=fi(function(o,l,f){return o+(f?" ":"")+l.toUpperCase()}),tc=np("toUpperCase");function em(o,l,f){return o=_e(o),l=f?t:l,l===t?_2(o)?A2(o):c2(o):o.match(l)||[]}var tm=ae(function(o,l){try{return Ct(o,t,l)}catch(f){return Xu(f)?f:new ne(f)}}),Xx=Mn(function(o,l){return zt(l,function(f){f=dn(f),Tn(o,f,ju(o[f],o))}),o});function Zx(o){var l=o==null?0:o.length,f=Y();return o=l?Ae(o,function(d){if(typeof d[1]!="function")throw new $t(a);return[f(d[0]),d[1]]}):[],ae(function(d){for(var b=-1;++b<l;){var x=o[b];if(Ct(x[0],this,d))return Ct(x[1],this,d)}})}function Qx(o){return C_(Wt(o,m))}function nc(o){return function(){return o}}function eC(o,l){return o==null||o!==o?l:o}var tC=ip(),nC=ip(!0);function gt(o){return o}function rc(o){return Ld(typeof o=="function"?o:Wt(o,m))}function rC(o){return Dd(Wt(o,m))}function iC(o,l){return Fd(o,Wt(l,m))}var sC=ae(function(o,l){return function(f){return ts(f,o,l)}}),oC=ae(function(o,l){return function(f){return ts(o,f,l)}});function ic(o,l,f){var d=Ue(l),b=vo(l,d);f==null&&!(Oe(l)&&(b.length||!d.length))&&(f=l,l=o,o=this,b=vo(l,Ue(l)));var x=!(Oe(f)&&"chain"in f)||!!f.chain,C=Nn(o);return zt(b,function(O){var I=l[O];o[O]=I,C&&(o.prototype[O]=function(){var P=this.__chain__;if(x||P){var D=o(this.__wrapped__),B=D.__actions__=dt(this.__actions__);return B.push({func:I,args:arguments,thisArg:o}),D.__chain__=P,D}return I.apply(o,Qn([this.value()],arguments))})}),o}function aC(){return Ze._===this&&(Ze._=R2),this}function sc(){}function lC(o){return o=ie(o),ae(function(l){return Bd(l,o)})}var uC=Du(Ae),cC=Du(sd),fC=Du(au);function nm(o){return Vu(o)?lu(dn(o)):H_(o)}function hC(o){return function(l){return o==null?t:Nr(o,l)}}var dC=op(),pC=op(!0);function oc(){return[]}function ac(){return!1}function mC(){return{}}function gC(){return""}function yC(){return!0}function bC(o,l){if(o=ie(o),o<1||o>Xn)return[];var f=xt,d=rt(o,xt);l=Y(l),o-=xt;for(var b=fu(d,l);++f<o;)l(f);return b}function _C(o){return re(o)?Ae(o,dn):At(o)?[o]:dt(Sp(_e(o)))}function wC(o){var l=++I2;return _e(o)+l}var vC=Ao(function(o,l){return o+l},0),SC=Fu("ceil"),xC=Ao(function(o,l){return o/l},1),CC=Fu("floor");function EC(o){return o&&o.length?wo(o,gt,Su):t}function kC(o,l){return o&&o.length?wo(o,Y(l,2),Su):t}function AC(o){return ld(o,gt)}function TC(o,l){return ld(o,Y(l,2))}function OC(o){return o&&o.length?wo(o,gt,ku):t}function MC(o,l){return o&&o.length?wo(o,Y(l,2),ku):t}var IC=Ao(function(o,l){return o*l},1),NC=Fu("round"),RC=Ao(function(o,l){return o-l},0);function LC(o){return o&&o.length?cu(o,gt):0}function PC(o,l){return o&&o.length?cu(o,Y(l,2)):0}return w.after=rS,w.ary=Rp,w.assign=US,w.assignIn=Gp,w.assignInWith=$o,w.assignWith=qS,w.at=KS,w.before=Lp,w.bind=ju,w.bindAll=Xx,w.bindKey=Pp,w.castArray=mS,w.chain=Mp,w.chunk=Cw,w.compact=Ew,w.concat=kw,w.cond=Zx,w.conforms=Qx,w.constant=nc,w.countBy=Lv,w.create=GS,w.curry=Dp,w.curryRight=Fp,w.debounce=Bp,w.defaults=JS,w.defaultsDeep=jS,w.defer=iS,w.delay=sS,w.difference=Aw,w.differenceBy=Tw,w.differenceWith=Ow,w.drop=Mw,w.dropRight=Iw,w.dropRightWhile=Nw,w.dropWhile=Rw,w.fill=Lw,w.filter=Dv,w.flatMap=zv,w.flatMapDeep=$v,w.flatMapDepth=Hv,w.flatten=kp,w.flattenDeep=Pw,w.flattenDepth=Dw,w.flip=oS,w.flow=tC,w.flowRight=nC,w.fromPairs=Fw,w.functions=nx,w.functionsIn=rx,w.groupBy=Wv,w.initial=zw,w.intersection=$w,w.intersectionBy=Hw,w.intersectionWith=Ww,w.invert=sx,w.invertBy=ox,w.invokeMap=Uv,w.iteratee=rc,w.keyBy=qv,w.keys=Ue,w.keysIn=mt,w.map=Lo,w.mapKeys=lx,w.mapValues=ux,w.matches=rC,w.matchesProperty=iC,w.memoize=Do,w.merge=cx,w.mergeWith=Jp,w.method=sC,w.methodOf=oC,w.mixin=ic,w.negate=Fo,w.nthArg=lC,w.omit=fx,w.omitBy=hx,w.once=aS,w.orderBy=Kv,w.over=uC,w.overArgs=lS,w.overEvery=cC,w.overSome=fC,w.partial=Yu,w.partialRight=zp,w.partition=Gv,w.pick=dx,w.pickBy=jp,w.property=nm,w.propertyOf=hC,w.pull=Kw,w.pullAll=Tp,w.pullAllBy=Gw,w.pullAllWith=Jw,w.pullAt=jw,w.range=dC,w.rangeRight=pC,w.rearg=uS,w.reject=Yv,w.remove=Yw,w.rest=cS,w.reverse=Gu,w.sampleSize=Zv,w.set=mx,w.setWith=gx,w.shuffle=Qv,w.slice=Xw,w.sortBy=nS,w.sortedUniq=iv,w.sortedUniqBy=sv,w.split=zx,w.spread=fS,w.tail=ov,w.take=av,w.takeRight=lv,w.takeRightWhile=uv,w.takeWhile=cv,w.tap=Ev,w.throttle=hS,w.thru=Ro,w.toArray=Up,w.toPairs=Yp,w.toPairsIn=Xp,w.toPath=_C,w.toPlainObject=Kp,w.transform=yx,w.unary=dS,w.union=fv,w.unionBy=hv,w.unionWith=dv,w.uniq=pv,w.uniqBy=mv,w.uniqWith=gv,w.unset=bx,w.unzip=Ju,w.unzipWith=Op,w.update=_x,w.updateWith=wx,w.values=pi,w.valuesIn=vx,w.without=yv,w.words=em,w.wrap=pS,w.xor=bv,w.xorBy=_v,w.xorWith=wv,w.zip=vv,w.zipObject=Sv,w.zipObjectDeep=xv,w.zipWith=Cv,w.entries=Yp,w.entriesIn=Xp,w.extend=Gp,w.extendWith=$o,ic(w,w),w.add=vC,w.attempt=tm,w.camelCase=Ex,w.capitalize=Zp,w.ceil=SC,w.clamp=Sx,w.clone=gS,w.cloneDeep=bS,w.cloneDeepWith=_S,w.cloneWith=yS,w.conformsTo=wS,w.deburr=Qp,w.defaultTo=eC,w.divide=xC,w.endsWith=kx,w.eq=rn,w.escape=Ax,w.escapeRegExp=Tx,w.every=Pv,w.find=Fv,w.findIndex=Cp,w.findKey=YS,w.findLast=Bv,w.findLastIndex=Ep,w.findLastKey=XS,w.floor=CC,w.forEach=Ip,w.forEachRight=Np,w.forIn=ZS,w.forInRight=QS,w.forOwn=ex,w.forOwnRight=tx,w.get=Qu,w.gt=vS,w.gte=SS,w.has=ix,w.hasIn=ec,w.head=Ap,w.identity=gt,w.includes=Vv,w.indexOf=Bw,w.inRange=xx,w.invoke=ax,w.isArguments=Pr,w.isArray=re,w.isArrayBuffer=xS,w.isArrayLike=pt,w.isArrayLikeObject=Le,w.isBoolean=CS,w.isBuffer=or,w.isDate=ES,w.isElement=kS,w.isEmpty=AS,w.isEqual=TS,w.isEqualWith=OS,w.isError=Xu,w.isFinite=MS,w.isFunction=Nn,w.isInteger=$p,w.isLength=Bo,w.isMap=Hp,w.isMatch=IS,w.isMatchWith=NS,w.isNaN=RS,w.isNative=LS,w.isNil=DS,w.isNull=PS,w.isNumber=Wp,w.isObject=Oe,w.isObjectLike=Ie,w.isPlainObject=ls,w.isRegExp=Zu,w.isSafeInteger=FS,w.isSet=Vp,w.isString=zo,w.isSymbol=At,w.isTypedArray=di,w.isUndefined=BS,w.isWeakMap=zS,w.isWeakSet=$S,w.join=Vw,w.kebabCase=Ox,w.last=Ut,w.lastIndexOf=Uw,w.lowerCase=Mx,w.lowerFirst=Ix,w.lt=HS,w.lte=WS,w.max=EC,w.maxBy=kC,w.mean=AC,w.meanBy=TC,w.min=OC,w.minBy=MC,w.stubArray=oc,w.stubFalse=ac,w.stubObject=mC,w.stubString=gC,w.stubTrue=yC,w.multiply=IC,w.nth=qw,w.noConflict=aC,w.noop=sc,w.now=Po,w.pad=Nx,w.padEnd=Rx,w.padStart=Lx,w.parseInt=Px,w.random=Cx,w.reduce=Jv,w.reduceRight=jv,w.repeat=Dx,w.replace=Fx,w.result=px,w.round=NC,w.runInContext=M,w.sample=Xv,w.size=eS,w.snakeCase=Bx,w.some=tS,w.sortedIndex=Zw,w.sortedIndexBy=Qw,w.sortedIndexOf=ev,w.sortedLastIndex=tv,w.sortedLastIndexBy=nv,w.sortedLastIndexOf=rv,w.startCase=$x,w.startsWith=Hx,w.subtract=RC,w.sum=LC,w.sumBy=PC,w.template=Wx,w.times=bC,w.toFinite=Rn,w.toInteger=ie,w.toLength=qp,w.toLower=Vx,w.toNumber=qt,w.toSafeInteger=VS,w.toString=_e,w.toUpper=Ux,w.trim=qx,w.trimEnd=Kx,w.trimStart=Gx,w.truncate=Jx,w.unescape=jx,w.uniqueId=wC,w.upperCase=Yx,w.upperFirst=tc,w.each=Ip,w.eachRight=Np,w.first=Ap,ic(w,function(){var o={};return fn(w,function(l,f){ve.call(w.prototype,f)||(o[f]=l)}),o}(),{chain:!1}),w.VERSION=r,zt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(o){w[o].placeholder=w}),zt(["drop","take"],function(o,l){ce.prototype[o]=function(f){f=f===t?1:$e(ie(f),0);var d=this.__filtered__&&!l?new ce(this):this.clone();return d.__filtered__?d.__takeCount__=rt(f,d.__takeCount__):d.__views__.push({size:rt(f,xt),type:o+(d.__dir__<0?"Right":"")}),d},ce.prototype[o+"Right"]=function(f){return this.reverse()[o](f).reverse()}}),zt(["filter","map","takeWhile"],function(o,l){var f=l+1,d=f==Ft||f==Ve;ce.prototype[o]=function(b){var x=this.clone();return x.__iteratees__.push({iteratee:Y(b,3),type:f}),x.__filtered__=x.__filtered__||d,x}}),zt(["head","last"],function(o,l){var f="take"+(l?"Right":"");ce.prototype[o]=function(){return this[f](1).value()[0]}}),zt(["initial","tail"],function(o,l){var f="drop"+(l?"":"Right");ce.prototype[o]=function(){return this.__filtered__?new ce(this):this[f](1)}}),ce.prototype.compact=function(){return this.filter(gt)},ce.prototype.find=function(o){return this.filter(o).head()},ce.prototype.findLast=function(o){return this.reverse().find(o)},ce.prototype.invokeMap=ae(function(o,l){return typeof o=="function"?new ce(this):this.map(function(f){return ts(f,o,l)})}),ce.prototype.reject=function(o){return this.filter(Fo(Y(o)))},ce.prototype.slice=function(o,l){o=ie(o);var f=this;return f.__filtered__&&(o>0||l<0)?new ce(f):(o<0?f=f.takeRight(-o):o&&(f=f.drop(o)),l!==t&&(l=ie(l),f=l<0?f.dropRight(-l):f.take(l-o)),f)},ce.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},ce.prototype.toArray=function(){return this.take(xt)},fn(ce.prototype,function(o,l){var f=/^(?:filter|find|map|reject)|While$/.test(l),d=/^(?:head|last)$/.test(l),b=w[d?"take"+(l=="last"?"Right":""):l],x=d||/^find/.test(l);b&&(w.prototype[l]=function(){var C=this.__wrapped__,O=d?[1]:arguments,I=C instanceof ce,P=O[0],D=I||re(C),B=function(ue){var pe=b.apply(w,Qn([ue],O));return d&&q?pe[0]:pe};D&&f&&typeof P=="function"&&P.length!=1&&(I=D=!1);var q=this.__chain__,j=!!this.__actions__.length,X=x&&!q,se=I&&!j;if(!x&&D){C=se?C:new ce(this);var Z=o.apply(C,O);return Z.__actions__.push({func:Ro,args:[B],thisArg:t}),new Ht(Z,q)}return X&&se?o.apply(this,O):(Z=this.thru(B),X?d?Z.value()[0]:Z.value():Z)})}),zt(["pop","push","shift","sort","splice","unshift"],function(o){var l=io[o],f=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",d=/^(?:pop|shift)$/.test(o);w.prototype[o]=function(){var b=arguments;if(d&&!this.__chain__){var x=this.value();return l.apply(re(x)?x:[],b)}return this[f](function(C){return l.apply(re(C)?C:[],b)})}}),fn(ce.prototype,function(o,l){var f=w[l];if(f){var d=f.name+"";ve.call(li,d)||(li[d]=[]),li[d].push({name:l,func:f})}}),li[ko(t,g).name]=[{name:"wrapper",func:t}],ce.prototype.clone=j2,ce.prototype.reverse=Y2,ce.prototype.value=X2,w.prototype.at=kv,w.prototype.chain=Av,w.prototype.commit=Tv,w.prototype.next=Ov,w.prototype.plant=Iv,w.prototype.reverse=Nv,w.prototype.toJSON=w.prototype.valueOf=w.prototype.value=Rv,w.prototype.first=w.prototype.head,Ji&&(w.prototype[Ji]=Mv),w},si=T2();Ar?((Ar.exports=si)._=si,ru._=si):Ze._=si}).call(BI)}(Ws,Ws.exports)),Ws.exports}var Hy=zI();function bh(n){return n.type.create(Hy.cloneDeep(n.attrs))}function _h({tr:n,node:e,position:t,mark:r}){return e.isText?n.removeMark(t,t+e.nodeSize,r):n.removeNodeMark(t,r)}const $I=Re.create({name:"node_processor",addCommands(){return{setBlockAttributes:W(({commands:n,state:e},t,r,i={})=>{const s=V(n.getBlockAttributes(t))??{},{doc:a,tr:u}=e,{from:c,to:h}=u.selection;a.nodesBetween(c,h,(p,m)=>{Me.blocks.includes(p.type.name)&&u.setNodeAttribute(m,t,{...i,...s,...r})})}),getBlockAttributes:W(({editor:n},e,t)=>me(()=>{let r=Object.assign({},t||{});for(const i of Me.blocks)Object.assign(r,n.getAttributes(i)?.[e]||{});return Object.keys(r).length?r:null})),removeBlockAttributes:W(({commands:n},e)=>{for(const t of Me.blocks)n.resetAttributes(t,e)}),applyMark:W(({state:n,commands:e},t,r,i={})=>{const{tr:s,doc:a,schema:u}=n,{$from:c,$to:h}=s.selection,p=mn(be.LINK,u),m=mn(t,u);if(!(m.spec.group||"").includes(gn.SETTINGS))return e.setMark(t,r);if(c.pos===h.pos)return;const _=S=>{if(!i.onAppliedToParent||i.onAppliedToParent(S)===!1){const{tr:E,node:N,position:g,mark:v}=S;_h({tr:E,node:N,position:g,mark:v.type})}};a.nodesBetween(c.pos,h.pos,(S,E)=>{if(S.type.name===Me.LIST)return;const N=FI(S.marks,t),g=m.create({...N?.attrs||{},...r}),v=By(c,h,S,E);if(!p.isInSet(S.marks)&&DI(s.doc,E,g,i.isAppliedToParent))return _({tr:s,node:S,position:E,mark:g});if(S.isText){s.addMark(v.from,v.to,g);return}LI(s.doc,s.selection,S,E)&&s.addNodeMark(E,g)})}),getMarks:W(({editor:n},e)=>{const t=bi(n,"state");return me(()=>{const{selection:r,doc:i}=V(t),{from:s,to:a}=V(r),u=[];return i.nodesBetween(s,a,c=>{for(const h of c.marks)h.type.name===e&&u.unshift(h.attrs)}),u})}),getMark:W(({commands:n},e)=>{const t=n.getMarks(e);return me(()=>V(t)[0]??null)}),hasMark:W(({commands:n},e)=>{const t=n.getMark(e);return me(()=>!!V(t))}),getCommonSettingMark:W(({commands:n},e,t)=>{const r=n.getMark(e);return me(()=>V(r)?.value??V(t))}),getDeviceSettingMark:W(({commands:n},e,t)=>{const r=n.getMarks(e),i=n.getDevice();return me(()=>{for(const s of V(r)){const a=s[V(i)];if(a)return a}return V(t)})}),removeAllMarks:W(({state:n})=>{const{tr:e,doc:t}=n,{from:r,to:i}=e.selection;t.nodesBetween(r,i,(s,a)=>{for(const u of s.marks)_h({tr:e,node:s,position:a,mark:u})})}),removeMarks:W(({state:n},e)=>{const{tr:t,doc:r}=n,{from:i,to:s}=t.selection;r.nodesBetween(i,s,(a,u)=>{const c=a.marks.filter(h=>e.includes(h.type.name));for(const h of c)_h({tr:t,node:a,position:u,mark:h})})})}}}),HI=Re.create({name:"text_processor",addCommands(){return{getSelectedText:W(({state:n})=>{const{from:e,to:t}=n.selection;return n.doc.textBetween(e,t," ")}),transformText:W(({state:n},e)=>{const{$from:t,$to:r}=n.tr.selection;t.pos!==r.pos&&n.doc.nodesBetween(t.pos,r.pos,(i,s)=>{if(!i.isText)return;const a=By(t,r,i,s),u=Math.max(0,t.pos-s),c=Math.max(0,r.pos-s),h=e({text:i.textContent.substring(u,c)}),p=n.schema.text(h,i.marks);n.tr.replaceWith(a.from,a.to,p)})})}}}),WI=Re.create({name:"selection_processor",addStorage:()=>({selection:null}),addCommands(){return{storeSelection:W(({state:n})=>{this.storage.selection=n.selection}),restoreSelection:W(({commands:n})=>{this.storage.selection&&n.setTextSelection(this.storage.selection)}),expandSelection:W(({tr:n,commands:e},t)=>{let r=n.selection.from,i=n.selection.to;return n.doc.nodesBetween(r,i,(s,a,u)=>{if(t({node:s,parent:u})){const c=s.isText?0:zy(n.doc,a);r=Math.min(r,a+c),i=Math.max(i,a+s.nodeSize-c)}}),e.setTextSelection({from:r,to:i})}),expandSelectionToBlock:W(({commands:n})=>n.expandSelection(({parent:e})=>e.type.name===De.DOCUMENT))}}}),VI=Yn.create({name:"doc",topNode:!0,content:"block+"});class Ks extends qe{constructor(e,t,r,i="SetDocAttr"){super(),this.key=e,this.value=t,this.schema=r,this.stepType=i}apply(e){this.prevValue=e.attrs.meta[this.key];const t=hr.fromJSON(this.schema,e.toJSON());return t.attrs.meta[this.key]=this.value,Fe.ok(t)}invert(){return new Ks(this.key,this.prevValue,this.schema,"revertSetDocAttr")}map(){return null}toJSON(){return{stepType:this.stepType,key:this.key,value:this.value}}static fromJSON(e){return new Ks(e.key,e.value,e.stepType)}}qe.jsonID("setDocAttr",Ks);const UI=VI.extend({marks:gn.SETTINGS,addAttributes:()=>({meta:{default:{}}}),onCreate(){this.editor.view.dom.addEventListener("click",n=>{n.target.closest("a")&&n.preventDefault()})},addCommands(){return{setDocMetaAttributes:W(({state:n},e,t)=>{n.tr.step(new Ks(e,t,n.schema))})}}}),qI=Yn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",Mi(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),KI=qI.extend({marks:gn.ALL,addOptions:()=>({HTMLAttributes:{class:"zw-style"}})}),GI=Yn.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,Mi(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>bO({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),JI=GI.extend({marks:gn.ALL,addOptions:()=>({levels:[1,2,3,4],HTMLAttributes:{class:"zw-style"}})}),jI=Re.create({name:"prose_mirror_plugins",addProseMirrorPlugins(){return[$O.create(this.editor),HO.create(this.editor)]}}),YI=()=>[UI,KI,JI,vO,IO,$I,HI,WI,jI],XI=Rt.create({name:be.FONT_FAMILY,group:gn.SETTINGS,addOptions:()=>({fonts:[]}),addAttributes:()=>({value:{required:!0}}),addCommands(){return{applyFontFamily:W(({commands:n},e)=>{n.applyMark(this.name,{value:e});const t=n.findFontByName(e);let r=V(n.getFontWeight());t.isWeightSupported(r)||(r=t.findClosestWeight(r),n.applyFontWeight(r));const i=n.isSettingCustomized(be.FONT_STYLE).value;!t.isItalicSupported(r)&&i&&n.removeItalic()}),getFont:W(({commands:n})=>{const e=V(this.options.defaultPreset),t=n.findFontByName(e.common.font_family),r=n.getFontFamily();return me(()=>n.findFontByName(V(r))||t)}),findFontByName:W((n,e)=>V(this.options.fonts).find(t=>t.name===e)??this.options.defaultFont),getFontFamily:W(({commands:n})=>n.getCommonSettingMark(this.name,n.getDefaultFontFamily())),getDefaultFontFamily:W(({commands:n})=>{const e=n.getPreset();return me(()=>V(e).common.font_family)})}},parseHTML(){const n=e=>({value:e.replace(/["']/g,"")});return[{style:"--zw-font-family",getAttrs:n},{style:"font-family",getAttrs:n}]},renderHTML({HTMLAttributes:n}){const e=n.value?`"${n.value}"`:null;return Jr({font_family:e})}}),ZI=Re.create({name:be.STYLE_PRESET,addGlobalAttributes(){return[{types:[Me.PARAGRAPH,Me.HEADING],attributes:{preset:{isRequired:!1,default:{id:V(this.options.defaultId)},parseHTML:n=>{const e=V(this.options.presets);if(n.parentElement.tagName==="LI")return null;for(const{id:t,node:r,fallbackClass:i}of e){if(i&&n.classList.contains(i))return{id:t};const s=V(this.options.styleRenderer).makePresetCssClass({id:t});if(n.matches(s))return{id:t};if(n.tagName===`H${r?.level}`)return{id:t}}return n.tagName==="P"?{id:V(this.options.defaultId)}:null},renderHTML:n=>n.preset?{class:V(this.options.styleRenderer).makePresetHtmlClass(n.preset)}:null}}}]},addCommands(){function n(t,r){return t.find(i=>r===i.id)}function e(t,r){const i={};for(const s of Object.keys(t)){const a=t[s],u=r[s],c=!u||u.toLowerCase()==="inherit";i[s]=c?a:u}return i}return{getPresetList:W(()=>me(()=>V(this.options.presets).filter(t=>!t.hidden))),getPreset:W(({commands:t})=>{const r=t.getBlockAttributes("preset",{id:V(this.options.defaultId)}),i=t.getPresetList(),s=t.isLink(),a=t.getLinkPreset();return me(()=>{const u=n(V(i),V(r).id);if(!V(s))return u;const c=V(a);return{id:u.id,common:e(u.common,c.common),mobile:e(u.mobile,c.mobile),tablet:e(u.tablet,c.tablet),desktop:e(u.desktop,c.desktop)}})}),applyPreset:W(({commands:t,chain:r},i)=>{const s=V(t.getPresetList()),a=n(s,i),u=a.node?.type??Me.PARAGRAPH,c={preset:{id:i}};a.node&&(c.level=a.node.level);for(const h of be.attributes)c[h]=V(t.getBlockAttributes(h));r().removeList().setNode(u,c).run()}),applyDefaultPreset:W(({commands:t})=>{t.applyPreset(V(this.options.defaultId))}),removePreset:W(({commands:t})=>{t.setNode(Me.PARAGRAPH,{preset:null})}),getPresetCustomization:W(({editor:t,commands:r})=>{const i=bi(t,"state");return me(()=>{const{selection:s,doc:a}=V(i),{from:u,to:c}=s;return r._getSettingCustomization(a,u,c)})}),isSettingCustomized:W(({commands:t},r)=>{const i=t.getPresetCustomization(),s=be.presetAttributes.includes(r)?"attributes":"marks";return me(()=>V(i)[s]?.includes(r)??!1)}),getContentCustomization:W(({editor:t,commands:r})=>{const i=bi(t,"state");return me(()=>{const{doc:s}=V(i);return r._getSettingCustomization(s,0,s.content.size)})}),_getSettingCustomization:W((t,r,i,s)=>{const a=new Set,u=new Set;return r.nodesBetween(i,s,c=>{for(const[h,p]of Object.entries(c.attrs))be.presetAttributes.includes(h)&&p&&u.add(h);for(const{type:h}of c.marks)be.marks.includes(h.name)&&a.add(h.name)}),{attributes:Array.from(u),marks:Array.from(a)}}),removePresetCustomization:W(({chain:t})=>{t().storeSelection().expandSelectionToBlock().removeMarks(be.marks).resetAttributes(Me.PARAGRAPH,be.presetAttributes).resetAttributes(Me.HEADING,be.presetAttributes).restoreSelection().run()}),removeFormat:W(({chain:t})=>{t().storeSelection().expandSelectionToBlock().removeAllMarks().applyDefaultPreset().restoreSelection().run()})}},onCreate(){this.options.styleRenderer.inject(Pi.head,V(this.options.presets))}}),QI=Rt.create({name:be.FONT_WEIGHT,group:gn.SETTINGS,addAttributes:()=>({value:{required:!0}}),addCommands(){return{applyFontWeight:W(({commands:n},e)=>{n.applyMark(this.name,{value:e}),V(n.getFont()).isItalicSupported(e)||n.removeItalic()}),toggleBold:W(({commands:n})=>{const e=V(n.getFontWeight()),t=V(n.getFont()),i=Number(e)>=600?"400":"700",s=t.findClosestWeight(i);n.applyFontWeight(s)}),getFontWeight:W(({commands:n})=>{const e=n.getCommonSettingMark(this.name,n.getDefaultFontWeight()),t=n.getFont();return me(()=>{const r=V(e),i=V(t);return i.isWeightSupported(r)?r:i.findClosestWeight(r)})}),getDefaultFontWeight:W(({commands:n})=>{const e=n.getPreset();return me(()=>V(e).common.font_weight)})}},addKeyboardShortcuts:()=>({"Mod-b":Xt("toggleBold"),"Mod-B":Xt("toggleBold")}),parseHTML(){const n=e=>e==="bold"?{value:"700"}:Number(e)?{value:e}:!1;return[{style:"--zw-font-weight",getAttrs:n},{style:"font-weight",getAttrs:n},{tag:"b",attrs:{value:"700"}},{tag:"strong",attrs:{value:"700"}}]},renderHTML({HTMLAttributes:n}){return Jr({font_weight:n.value})}}),eN=Rt.create({name:be.FONT_SIZE,group:gn.SETTINGS,addOptions:()=>({minSize:1,maxSize:100}),addAttributes(){return{mobile:{default:null},tablet:{default:null},desktop:{default:null}}},addCommands(){return{getFontSize:W(({commands:n})=>n.getDeviceSettingMark(this.name,n.getDefaultFontSize())),getDefaultFontSize:W(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return me(()=>V(t)[V(e)].font_size.replace("px",""))}),applyFontSize:W(({commands:n},e)=>{const t=V(n.getDevice());n.applyMark(this.name,{[t]:e},{isAppliedToParent:(r,i)=>r.type.name!==i.type.name?!1:r.attrs[t]===i.attrs[t],onAppliedToParent:({tr:r,node:i,position:s,mark:a})=>{const u={...a.attrs,[t]:null};if(!Object.values(u).some(p=>!!p))return!1;const h=a.type.create(u);if(i.isText){r.addMark(s,s+i.nodeSize,h);return}r.addNodeMark(s,h)}})}),increaseFontSize:W(({commands:n})=>{const e=Number(V(n.getFontSize())),t=Math.min(e+1,V(this.options.maxSize));n.applyFontSize(String(t))}),decreaseFontSize:W(({commands:n})=>{const e=Number(V(n.getFontSize())),t=Math.max(e-1,V(this.options.minSize));n.applyFontSize(String(t))})}},addKeyboardShortcuts:()=>({"Mod-Shift-=":Xt("increaseFontSize"),"Mod-Shift--":Xt("decreaseFontSize")}),parseHTML(){const n=e=>{if(!e)return null;const t=V(this.options.wrapperRef),r=Fy(e,t);return String(r)};return[{tag:'[style*="--zw-font-size"]',getAttrs:({style:e})=>({mobile:n(e.getPropertyValue("--zw-font-size-mobile")),tablet:n(e.getPropertyValue("--zw-font-size-tablet")),desktop:n(e.getPropertyValue("--zw-font-size-desktop"))})},{style:"font-size",getAttrs:e=>{const t=n(e);return{desktop:t,tablet:t,mobile:null}}}]},renderHTML({HTMLAttributes:n}){const e=t=>t?`${t}px`:null;return Jr({font_size_mobile:e(n.mobile),font_size_tablet:e(n.tablet),font_size_desktop:e(n.desktop)})}}),tN=Rt.create({name:be.FONT_COLOR,group:gn.SETTINGS,addAttributes:()=>({value:{required:!0}}),addCommands(){return{getFontColor:W(({commands:n})=>n.getCommonSettingMark(this.name,n.getDefaultFontColor())),getDefaultFontColor:W(({commands:n})=>{const e=n.getPreset();return me(()=>V(e).common.color)}),applyFontColor:W(({commands:n},e)=>{n.applyMark(this.name,{value:e})})}},parseHTML(){const n=e=>({value:Dy(e)});return[{style:"--zw-font-color",getAttrs:n},{style:"color",getAttrs:n}]},renderHTML({HTMLAttributes:n}){return Jr({font_color:n.value})}}),nN=Rt.create({name:be.BACKGROUND_COLOR,addAttributes:()=>({value:{required:!0}}),addCommands(){return{getBackgroundColor:W(({commands:n})=>n.getCommonSettingMark(this.name,"rgba(255, 255, 255, 0%)")),applyBackgroundColor:W(({commands:n},e)=>{n.applyMark(this.name,{value:e})})}},parseHTML(){const n=e=>({value:Dy(e)});return[{style:"--zw-background-color",getAttrs:n},{style:"background-color",getAttrs:n}]},renderHTML({HTMLAttributes:n}){return Jr({background_color:n.value})}}),rN=Re.create({name:"device_manager",addCommands(){return{getDevice:W(()=>bi(this.options,"device"))}}}),iN=Rt.create({name:be.FONT_STYLE,group:gn.SETTINGS,addAttributes:()=>({italic:{required:!0}}),addCommands(){return{isItalic:W(({commands:n})=>{const e=n.getMark(this.name),t=n.getDefaultFontStyle();return me(()=>V(e)?.italic??V(t).italic)}),isItalicAvailable:W(({commands:n})=>{const e=n.getFont(),t=n.getFontWeight();return me(()=>{const r=V(e),i=V(t);return r.isItalicSupported(i)&&!r.isWeightItalicOnly(i)})}),getDefaultFontStyle:W(({commands:n})=>{const e=n.getPreset();return me(()=>({italic:V(e).common.font_style==="italic"}))}),toggleItalic:W(({commands:n})=>{V(n.isItalicAvailable())&&(V(n.isItalic())?n.removeItalic():n.applyItalic())}),applyItalic:W(({commands:n})=>{n.applyMark(this.name,{italic:!0})}),removeItalic:W(({commands:n})=>{n.applyMark(this.name,{italic:!1})})}},addKeyboardShortcuts:()=>({"Mod-i":Xt("toggleItalic"),"Mod-I":Xt("toggleItalic")}),parseHTML(){const n=e=>({italic:e.includes("italic")});return[{tag:"i",attrs:{italic:!0}},{style:"--zw-font-style",getAttrs:n},{style:"font-style",getAttrs:n}]},renderHTML({HTMLAttributes:n}){const e=n.italic?"italic":"normal";return Jr({font_style:e})}}),sN=Rt.create({name:be.TEXT_DECORATION,priority:1e3,addAttributes:()=>({underline:{default:!1},strike_through:{default:!1}}),addCommands(){return{isUnderline:W(({commands:n})=>{const e=n.getTextDecoration();return me(()=>V(e).underline)}),isStrikeThrough:W(({commands:n})=>{const e=n.getTextDecoration();return me(()=>V(e).strike_through)}),getTextDecoration:W(({commands:n})=>{const e=n.getMark(this.name),t=n.getDefaultTextDecoration();return me(()=>{const r=V(e)??{},i=V(t);return{underline:r.underline||i.underline,strike_through:r.strike_through||i.strike_through}})}),isUnderlineCustomized:W(({commands:n})=>{const e=n.isUnderline(),t=n.getDefaultTextDecoration();return me(()=>V(e)!==V(t).underline)}),getDefaultTextDecoration:W(({commands:n})=>{const e=n.getPreset();return me(()=>{const{text_decoration:t}=V(e).common;return{underline:t.includes("underline"),strike_through:t.includes("line-through")}})}),toggleUnderline:W(({commands:n})=>{n.toggleTextDecoration("underline")}),toggleStrikeThrough:W(({commands:n})=>{n.toggleTextDecoration("strike_through")}),toggleTextDecoration:W(({commands:n},e,t=null)=>{const r=V(n.getTextDecoration()),i=t??!r[e];n.applyMark(this.name,{[e]:i})}),applyTextDecoration:W(({commands:n},e)=>{n.toggleTextDecoration(e,!0)}),removeTextDecoration:W(({commands:n},e)=>{n.toggleTextDecoration(e,!1)})}},addKeyboardShortcuts:()=>({"Mod-u":Xt("toggleUnderline"),"Mod-U":Xt("toggleUnderline")}),parseHTML(){const n=e=>{const t=e.includes("underline"),r=e.includes("line-through");return!t&&!r?!1:{underline:t,strike_through:r}};return[{style:"--zw-text-decoration",getAttrs:n},{style:"text-decoration-line",getAttrs:n},{style:"text-decoration",getAttrs:n},{tag:"s",attrs:{underline:!1,strike_through:!0}},{tag:"u",attrs:{underline:!0,strike_through:!1}}]},renderHTML({HTMLAttributes:n}){const e=[];return n.underline&&e.push("underline"),n.strike_through&&e.push("line-through"),e.length||e.push("none"),Jr({text_decoration:e.join(" ")})}}),oN=Re.create({name:"case_style",addCommands(){return{applyCaseStyle:W(({commands:n},e)=>{switch(e){case If.CAPITALIZE:return n.applyCapitalize();case If.LOWERCASE:return n.applyLowerCase();case If.UPPERCASE:return n.applyUpperCase()}}),applyCapitalize:W(({commands:n})=>{n.transformText(({text:e})=>aM(e))}),applyLowerCase:W(({commands:n})=>{n.transformText(({text:e})=>e.toLowerCase())}),applyUpperCase:W(({commands:n})=>{n.transformText(({text:e})=>e.toUpperCase())})}}}),Wy={mobile:null,tablet:null,desktop:null},aN=Re.create({name:be.ALIGNMENT,addGlobalAttributes:()=>[{types:[Me.PARAGRAPH,Me.HEADING],attributes:{[be.ALIGNMENT]:{isRequired:!1,parseHTML({style:n}){const e=RI(n.textAlign);if(e)return{desktop:e,tablet:e,mobile:e};const t=n.getPropertyValue("--zw-alignment-mobile")||null,r=n.getPropertyValue("--zw-alignment-tablet")||null,i=n.getPropertyValue("--zw-alignment-desktop")||null;return!t&&!r&&!i?null:{desktop:i,tablet:r,mobile:t}},renderHTML(n){return n.alignment?Sl({alignment_mobile:n.alignment.mobile,alignment_tablet:n.alignment.tablet,alignment_desktop:n.alignment.desktop}):null}}}}],addCommands(){return{applyAlignment:W(({commands:n},e)=>{const t=V(n.getDevice());n.setBlockAttributes(this.name,{[t]:e},Wy)}),removeAlignment:W(({commands:n})=>n.removeBlockAttributes(this.name)),getAlignment:W(({commands:n})=>{const e=n.getBlockAttributes(this.name,Wy),t=n.getDevice(),r=n.getDefaultAlignment();return me(()=>V(e)?.[V(t)]??V(r))}),getDefaultAlignment:W(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return me(()=>V(t)[V(e)].alignment??wr.LEFT)})}},addKeyboardShortcuts:()=>({"Mod-Shift-l":Xt("applyAlignment",wr.LEFT),"Mod-Shift-e":Xt("applyAlignment",wr.CENTER),"Mod-Shift-r":Xt("applyAlignment",wr.RIGHT),"Mod-Shift-j":Xt("applyAlignment",wr.JUSTIFY)})}),Vy={mobile:null,tablet:null,desktop:null},lN=Re.create({name:be.LINE_HEIGHT,addGlobalAttributes(){return[{types:[Me.PARAGRAPH,Me.HEADING],attributes:{[be.LINE_HEIGHT]:{isRequired:!1,parseHTML:n=>{if(n.matches('[style*="--zw-line-height"]')){const s=n.style.getPropertyValue("--zw-line-height-tablet")||null,a=n.style.getPropertyValue("--zw-line-height-desktop")||null;return{mobile:null,tablet:s,desktop:a}}const e=n.style.lineHeight;if(!e)return null;const t=V(this.options.wrapperRef),r=II(e,n,t);return r?{desktop:r,tablet:r,mobile:null}:null},renderHTML(n){return n.line_height?Sl({line_height_mobile:n.line_height.mobile,line_height_tablet:n.line_height.tablet,line_height_desktop:n.line_height.desktop}):null}}}}]},addCommands(){return{getLineHeight:W(({commands:n})=>{const e=n.getBlockAttributes(this.name,Vy),t=n.getDevice(),r=n.getDefaultLineHeight();return me(()=>V(e)?.[V(t)]??V(r))}),getDefaultLineHeight:W(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return me(()=>V(t)[V(e)].line_height)}),applyLineHeight:W(({commands:n},e)=>{const t=V(n.getDevice());n.setBlockAttributes(this.name,{[t]:e},Vy)})}}}),uN=Yn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",Mi(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),cN=uN.extend({name:Me.LIST_ITEM,marks:gn.SETTINGS,addCommands(){const n=({selection:e})=>e.$cursor.before(e.$cursor.depth-1);return{listItemNewline:W(({commands:e,tr:t})=>{const r=t.doc.nodeAt(n(t));if(!t.selection.$cursor.node().textContent)return!1;e.splitListItem(this.name);const s=n(t);for(const a of r.marks)t.addNodeMark(s,bh(a));return!0})}},addOptions:()=>({HTMLAttributes:{class:"zw-style"}}),addKeyboardShortcuts:()=>({Enter:n=>{const{state:e,commands:t}=n.editor;if(e.selection.$cursor?.path.some(i=>i.type?.name===Me.LIST))return t.listItemNewline()}})});function fN(n,e){if(y1.includes(e.type)||e.type.isInSet(n.marks))return!1;for(const t of n.content.content)if(t.childCount&&(!t.marks||!e.isInSet(t.marks)))return!1;return!0}function hN(n){const e=n.selection.$from.start(),t=n.selection.$to.end();n.doc.nodesBetween(e,t,(r,i)=>{if(r.type.name===De.LIST)return;if(r.type.name!==De.LIST_ITEM)return!1;const s=[];return r.forEach(a=>{for(const u of a.marks){if(u.isInSet(s)){n.removeNodeMark(i+1,u);continue}fN(r,u)&&(n.removeNodeMark(i+1,u),n.addNodeMark(i,bh(u)),s.push(u))}}),!1})}const dN=Yn.create({name:De.LIST,content:`${De.LIST_ITEM}+`,group:"block list",marks:Rf.SETTINGS,addExtensions:()=>[cN],addOptions:()=>({baseClass:"",presetClass:""}),addAttributes:()=>({bullet:{default:{type:Jt.DISC}}}),parseHTML(){const n={a:Jt.ROMAN,i:Jt.LATIN,1:Jt.DECIMAL},e=t=>{for(const r of PO){const i=`.${V(this.options.baseClass)}${r}`;if(t.matches(i)||n[t.type.toLowerCase()]===r)return r}};return[{tag:"ol",getAttrs:t=>({bullet:{type:e(t)||Jt.DECIMAL}})},{tag:"ul",getAttrs:t=>({bullet:{type:e(t)||Jt.DISC}})}]},renderHTML({HTMLAttributes:n}){const e=[V(this.options.baseClass)+n.bullet.type,V(this.options.presetClass)];return[DO.includes(n.bullet.type)?"ol":"ul",{class:e.join(" ")},0]},addCommands(){return{getListType:W(({commands:n})=>{const e=n.getBlockAttributes("bullet",{type:null});return me(()=>V(e).type??null)}),applyList:W(({commands:n,chain:e},t)=>V(n.getListType())===t?n.removeList():e().applyDefaultPreset().toggleList(De.LIST,De.LIST_ITEM).setBlockAttributes("bullet",{type:t}).command(({tr:i})=>hN(i)).run()),removeList:W(({chain:n})=>n().expandSelection(({parent:e})=>e.type.name===De.LIST).command(({tr:e})=>{const t=e.selection.$from.start(),r=e.selection.$to.end();return e.doc.nodesBetween(t,r,(i,s,a)=>{if([De.LIST,De.LIST_ITEM].includes(i.type.name))return;if(a.type.name!==De.LIST_ITEM)return!1;const u=a.marks.filter(c=>!c.type.isInSet(i.marks));for(const c of u)e.addNodeMark(s,bh(c));return!1}),!0}).liftListItem(De.LIST_ITEM).run())}},addInputRules(){const n=(e,t)=>_O({find:t,type:this.type,getAttributes:{bullet:{type:e}},joinPredicate:(r,{attrs:i})=>i.bullet.type===e});return[n(Jt.DISC,/^\s*([-+*])\s$/),n(Jt.DECIMAL,/^(\d+)\.\s$/),n(Jt.LATIN,/^([ivx]{1,3})\.\s$/i),n(Jt.ROMAN,/^([a-z])\.\s$/i)]}});function pN(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function mN(n){return new ft({key:new It("autolink"),appendTransaction:(e,t,r)=>{const i=e.some(h=>h.docChanged)&&!t.doc.eq(r.doc),s=e.some(h=>h.getMeta("preventAutolink"));if(!i||s)return;const{tr:a}=r,u=HT(t.doc,[...e]);if(YT(u).forEach(({newRange:h})=>{const p=VT(r.doc,h,_=>_.isTextblock);let m,y;if(p.length>1?(m=p[0],y=r.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ")):p.length&&r.doc.textBetween(h.from,h.to," "," ").endsWith(" ")&&(m=p[0],y=r.doc.textBetween(m.pos,h.to,void 0," ")),m&&y){const _=y.split(" ").filter(g=>g!=="");if(_.length<=0)return!1;const S=_[_.length-1],E=m.pos+y.lastIndexOf(S);if(!S)return!1;const N=vl(S).map(g=>g.toObject(n.defaultProtocol));if(!pN(N))return!1;N.filter(g=>g.isLink).map(g=>({...g,from:E+g.start+1,to:E+g.end+1})).filter(g=>r.schema.marks.code?!r.doc.rangeHasMark(g.from,g.to,r.schema.marks.code):!0).filter(g=>n.validate(g.value)).filter(g=>n.shouldAutoLink(g.value)).forEach(g=>{i1(g.from,g.to,r.doc).some(v=>v.mark.type===n.type)||a.addMark(g.from,g.to,n.type.create({href:g.href}))})}}),!!a.steps.length)return a}})}function gN(n){return new ft({key:new It("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let a=r.target;const u=[];for(;a.nodeName!=="DIV";)u.push(a),a=a.parentNode;if(!u.find(y=>y.nodeName==="A"))return!1;const c=GT(e.state,n.type.name),h=r.target,p=(i=h?.href)!==null&&i!==void 0?i:c.href,m=(s=h?.target)!==null&&s!==void 0?s:c.target;return h&&p?(window.open(p,m),!0):!1}}})}function yN(n){return new ft({key:new It("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{state:i}=e,{selection:s}=i,{empty:a}=s;if(a)return!1;let u="";r.content.forEach(h=>{u+=h.textContent});const c=D1(u,{defaultProtocol:n.defaultProtocol}).find(h=>h.isLink&&h.value===u);return!u||!c?!1:n.editor.commands.setMark(n.type,{href:c.href})}}})}const bN=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function Xr(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&t.push(i)}),!n||n.replace(bN,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const _N=Rt.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){P1(n);return}P1(n.scheme,n.optionalSlashes)})},onDestroy(){rM()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!Xr(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>!!n}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!Xr(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!Xr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Mi(this.options.HTMLAttributes,n),0]:["a",Mi(this.options.HTMLAttributes,{...n,href:""}),0]},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!Xr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!Xr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[wO({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,i=D1(n).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:a=>!!Xr(a,t),protocols:t,defaultProtocol:r}));i.length&&i.forEach(s=>e.push({text:s.value,data:{href:s.href},index:s.start}))}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(mN({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Xr(i,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&n.push(gN({type:this.type})),this.options.linkOnPaste&&n.push(yN({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),n}}),wN=_N.extend({name:be.LINK,addOptions(){return{...this.parent?.(),openOnClick:!1,linkOnPaste:!1}},addAttributes(){return{href:{default:null,parseHTML:n=>{const e=n.getAttribute("href");return e.startsWith("#")?parseFloat(n.getAttribute("href").replace("#","")):e}},target:{default:_1.SELF,parseHTML:n=>n.getAttribute("target")||_1.SELF},destination:{default:Ts.URL,parseHTML:n=>{const e=n.getAttribute("href");if(!e.startsWith("#"))return Ts.URL;const t=e.replace("#","");return V(this.options.pageBlocks).find(s=>s.id===parseInt(t))?Ts.BLOCK:Ts.URL}}}},addCommands(){const{unsetLink:n}=this.parent();return{removeLink:n,applyLink:W(({commands:e,chain:t},r)=>(e.setMeta("preventAutolink",!0),e.getSelectedText()?t().applyMark(this.name,r).expandSelectionToLink().command(({tr:i})=>(r.text&&i.insertText(r.text,i.selection.from,i.selection.to),!0)).run():e.insertContent(qy.text(r.text,[qy.mark(be.LINK,r)])))),expandSelectionToLink:W(({commands:e})=>{e.expandSelection(({node:t})=>this.type.isInSet(t.marks))}),isLink:W(({commands:e})=>e.hasMark(this.name)),getLinkPreset:W(()=>me(()=>V(this.options.preset)))}},addProseMirrorPlugins(){return[...this.parent(),oM.create(this.editor)]},renderHTML({HTMLAttributes:n}){const e=n.destination===Ts.BLOCK?`#${n.href}`:n.href,t=V(this.options.basePresetClass)+V(this.options.preset).id;return["a",{href:e,target:n.target,class:`${t} zw-style`},0]}}),vN=Rt.create({name:be.SUPERSCRIPT,addCommands(){return{applySuperscript:W(({commands:n})=>{n.setMark(this.name)}),removeSuperscript:W(({commands:n})=>{n.unsetMark(this.name)}),toggleSuperscript:W(({commands:n})=>{V(n.isSuperscript())?n.removeSuperscript():n.applySuperscript()}),isSuperscript:W(({commands:n})=>{const e=n.getMark(this.name);return me(()=>!!V(e))})}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs:n=>n!=="super"?!1:null}]},renderHTML(){return["sup",{class:"zw-superscript"},0]}}),SN=Re.create({name:be.MARGIN,addGlobalAttributes:()=>[{types:[Me.PARAGRAPH,Me.HEADING],attributes:{[be.MARGIN]:{isRequired:!1,parseHTML(n){const{margin:e,marginTop:t,marginRight:r,marginBottom:i,marginLeft:s}=n.style;return[e,t,r,i,s].some(c=>!!c)?e?{value:e}:{value:[t||0,r||0,i||0,s||0].join(" ")}:null},renderHTML(n){return n.margin?Sl({margin:n.margin.value}):null}}}}]});function xN(n){const e=r=>n.presetsRef.value.find(i=>i.id===r),t=Ec({default:null,link:null});return o5(n.presetsRef,()=>{t.default=e(n.defaultPresetId),t.link=e(n.linkPresetId)},{immediate:!0,deep:!0}),YI().concat([ZI.configure({presets:n.presetsRef,defaultId:n.defaultPresetId,styleRenderer:new TN({baseClass:n.basePresetClass,makeVariable:n.makePresetVariable,linkPresetId:n.linkPresetId})}),dN.configure({baseClass:n.baseListClass,presetClass:n.basePresetClass+n.defaultPresetId}),rN.configure({device:n.deviceRef}),eN.configure({minSize:n.minFontSize,maxSize:n.maxFontSize,wrapperRef:n.wrapperRef}),XI.configure({fonts:n.fonts,defaultPreset:bi(t,"default"),defaultFont:n.defaultFont}),QI,tN,nN,iN,sN,oN,vN,aN,lN.configure({wrapperRef:n.wrapperRef}),wN.configure({preset:bi(t,"link"),basePresetClass:n.basePresetClass,pageBlocks:n.pageBlocksRef}),SN])}class CN{_domParser=new DOMParser;types=window;parse(e){return this._domParser.parseFromString(e,"text/html")}}class Uy{content;constructor({content:e}){this.content=e}normalize(){throw new Error("Implement abstract method")}}class wn extends Uy{static BLOCK_NODE_NAMES=["P","H1","H2","H3","H4"];static ROOT_NODE_NAMES=wn.BLOCK_NODE_NAMES.concat("UL","OL");static BLOCK_STYLES=["text-align","line-height","margin","margin-top","margin-bottom","margin-left","margin-right"];_parser;constructor({content:e,parser:t}){super({content:e}),this._parser=t,this.dom=null}normalize(){return this.normalizeHTML(),this.normalizedHTML}normalizeHTML(){this.dom=this._parser.parse(this.content.replace(/(\r)?\n/g,"")),this._removeComments(),this._normalizeRootTags(),this._iterateNodes(this._normalizeBreakLines,e=>e.tagName==="BR"),this._iterateNodes(this._removeEmptyNodes,this._isBlockNode),this._iterateNodes(this._normalizeListItems,e=>e.tagName==="LI"),this._normalizeBlockTextDecoration(),this._normalizeBlockBackgroundColor()}get normalizedHTML(){return this.dom.body.innerHTML}get _NodeFilter(){return this._parser.types.NodeFilter}get _Node(){return this._parser.types.Node}_removeComments(){const e=this._createNodeIterator(this._NodeFilter.SHOW_COMMENT);this._runIterator(e,t=>t.remove())}_normalizeRootTags(){const e=Array.from(this.dom.body.childNodes),t=this.dom.createDocumentFragment();let r;for(const i of e){if(this._isRootNode(i)){t.append(i),r=null;continue}r||(r=this.dom.createElement("p"),t.append(r)),r.append(i)}this.dom.body.innerHTML="",this.dom.body.append(t)}_createNodeIterator(e,t){return this.dom.createNodeIterator(this.dom.body,e,t)}_iterateNodes(e,t=()=>!0){const r=s=>s.tagName!=="BODY"&&t.call(this,s),i=this._createNodeIterator(this._NodeFilter.SHOW_ELEMENT,{acceptNode:s=>r(s)?this._NodeFilter.FILTER_ACCEPT:this._NodeFilter.FILTER_REJECT});this._runIterator(i,e)}_runIterator(e,t){let r=e.nextNode();for(;r;)t.call(this,r),r=e.nextNode()}_removeEmptyNodes(e){e.innerHTML.trim()||e.remove()}_normalizeListItems(e){const t=this.dom.createDocumentFragment(),r=Array.from(e.childNodes);let i,s;const a=u=>{this._assignElementProperties(u,e,wn.BLOCK_STYLES),t.append(u)};this._assignElementProperties(e,e.parentElement,wn.BLOCK_STYLES);for(const u of r){if(this._isBlockNode(u)){a(u),i=null,s=u;continue}if(u.tagName==="BR"&&s&&s?.tagName!=="BR"){u.remove(),s=u;continue}if(u.tagName==="BR"){const c=this.dom.createElement("p");c.append(u),a(c),i=null,s=u;continue}i||(i=this.dom.createElement("p"),a(i)),i.append(u),s=u}e.append(t),this._removeStyleProperties(e,wn.BLOCK_STYLES),this._removeStyleProperties(e.parentElement,wn.BLOCK_STYLES),this._assignElementProperties(e,e.parentElement),e.parentElement.lastElementChild===e&&this._removeStyleProperties(e.parentElement)}_isBlockNode(e){return wn.BLOCK_NODE_NAMES.includes(e.tagName)}_isRootNode(e){return wn.ROOT_NODE_NAMES.includes(e.tagName)}_assignElementProperties(e,t,r=Array.from(t.style)){for(const i of r){const s=t.style.getPropertyValue(i);s&&!e.style.getPropertyValue(i)&&e.style.setProperty(i,s)}}_removeStyleProperties(e,t=Array.from(e.style)){for(const r of t)e.style.removeProperty(r);e.style.length===0&&e.removeAttribute("style")}_normalizeBreakLines({parentElement:e}){if(!this._isBlockNode(e)||!e.textContent)return;const t=this.dom.createDocumentFragment(),r=Array.from(e.childNodes),i=e.cloneNode(!0);i.innerHTML="";let s=i.cloneNode();const a=u=>{this._assignElementProperties(u,e,wn.BLOCK_STYLES),t.append(u)};for(const u of r){if(u.tagName==="BR"){a(s),s=i.cloneNode();continue}s.append(u)}t.append(s),e.replaceWith(t)}_normalizeBlockTextDecoration(){const e=this.dom.querySelectorAll('[style*="text-decoration"]:where(p, h1, h2, h3, h4, li)');for(const t of e)this._moveTextDecorationToChildren(t)}_moveTextDecorationToChildren(e){const t=this._parseTextDecoration(e);if(e.style.removeProperty("text-decoration-line"),e.style.removeProperty("text-decoration"),e.style.cssText||e.removeAttribute("style"),!t.none)for(const r of e.childNodes){const i=this._wrapTextNode(e,r),s=this._parseTextDecoration(i),a={underline:s.underline||t.underline,line_through:s.line_through||t.line_through};i.style.removeProperty("text-decoration-line"),i.style.removeProperty("text-decoration"),i.style.textDecoration=Object.entries(a).filter(([,u])=>u).map(([u])=>u.replace("_","-")).join(" ")}}_parseTextDecoration(e){const{textDecoration:t,textDecorationLine:r}=e.style,i=t||r||"";return{none:i.includes("none"),underline:i.includes("underline"),line_through:i.includes("line-through")}}_normalizeBlockBackgroundColor(){const e=this.dom.querySelectorAll('[style*="background-color"]:where(p, h1, h2, h3, h4, li)');for(const t of e)this._moveBackgroundColorToChildren(t)}_moveBackgroundColorToChildren(e){const t=e.style.backgroundColor;e.style.removeProperty("background-color"),e.style.cssText||e.removeAttribute("style");for(const r of e.childNodes){const i=this._wrapTextNode(e,r),s=i.style.backgroundColor||t;i.style.backgroundColor=s}}_wrapTextNode(e,t){if(t.nodeType!==this._Node.TEXT_NODE)return t;const r=this.dom.createElement("span");return r.append(t.cloneNode()),e.replaceChild(r,t),r}}class EN extends Uy{normalize(){return this._iterateNodes(this._bubbleMarks),this.content}_iterateNodes(e){this._iterateChildNodes(this.content,e)}_iterateChildNodes(e,t){for(const r of e.content)r.content&&this._iterateChildNodes(r,t),t.call(this,r)}_bubbleMarks(e){if(e.content&&e.type!==Me.LIST){for(const t of e.content)if(!this._isLink(t)&&t.marks)for(const r of t.marks.slice()){if(this._includesMark(e,r)){this._removeMark(t,r);continue}this._canBubbleMark(e,r)&&(this._removeMark(t,r),this._addMark(e,r))}}}_canBubbleMark(e,t){if(be.inlineMarks.includes(t.type)||this._includesMarkType(e,t.type))return!1;for(const r of e.content)if(!(!r.content&&e.type===Me.LIST_ITEM)&&(!r.marks||!this._includesMark(r,t)))return!1;return!0}_includesMark(e,t){return e.marks?.some(r=>Hy.isEqual(r,t))??!1}_includesMarkType(e,t){return e.marks?.some(r=>r.type===t)??!1}_isLink(e){return e.type===Me.TEXT&&this._includesMarkType(e,be.LINK)}_removeMark(e,t){if(!e.marks)return;const r=this._findMarkIndexByType(e,t.type);r>=0&&e.marks.splice(r,1),e.marks.length||delete e.marks}_addMark(e,t){this._removeMark(e,t),e.marks??=[],e.marks.push(t)}_findMarkIndexByType(e,t){return e.marks?.findIndex(r=>r.type===t)??null}}class Fl{static build(e,t={}){return typeof e=="string"?this._buildHtml(e,t):this._buildJson(e)}static _buildHtml(e,t){return new wn({content:e,parser:t.parser||new CN})}static _buildJson(e){return new EN({content:e})}static normalize(e,t={}){return Fl.build(e,t).normalize()}}class Pi{static window=globalThis.window;static use(e){this.window=e}static get document(){return this.window.document}static get body(){return this.document.body}static get head(){return this.document.head}static getComputedStyle(e){return this.window.getComputedStyle(e)}}class Eh{static build({config:e,nodeDomParser:t}){const r=xN({fonts:e.fonts,minFontSize:0,maxFontSize:0,presetsRef:na(e.presets),defaultPresetId:e.defaultPresetId,linkPresetId:e.linkPresetId,makePresetVariable:()=>"",basePresetClass:e.basePresetClass,baseListClass:e.baseListClass,deviceRef:na(Mf.DESKTOP),pageBlocksRef:na([]),wrapperRef:Pi.document.createElement("p")}),i=qT(r);return new Eh({schema:i,domParser:_s.fromSchema(i),nodeDomParser:t})}_schema;_domParser;_nodeDomParser;constructor({schema:e,domParser:t,nodeDomParser:r}){this._schema=e,this._domParser=t,this._nodeDomParser=r}toJSON(e){const t=Fl.build(e,{parser:this._nodeDomParser});return t.normalizeHTML(),this._domParser.parse(t.dom.body).toJSON()}}function kN(n,e){return n.type===e}function AN(n){return typeof n=="string"}class qy{static doc(e){return{type:De.DOCUMENT,content:e}}static list(e,t){return{type:De.LIST,attrs:{bullet:{type:e}},content:t.map(r=>kN(r,De.LIST_ITEM)?r:this.listItem([r].flat()))}}static listItem(...e){const{attrs:t,content:r,marks:i}=this.normalizeTextBlockArgs(e);return{type:De.LIST_ITEM,...t?{attrs:t}:{},...i?{marks:i}:{},content:[r].flat().map(s=>AN(s)?this.paragraph(s):s)}}static heading(e,...t){const r=this.textBlock(t);return r.attrs??={},r.attrs.level=e,{type:De.HEADING,...r}}static paragraph(...e){return{type:De.PARAGRAPH,...this.textBlock(e)}}static textBlock(e){const{attrs:t,content:r,marks:i}=this.normalizeTextBlockArgs(e);return{content:typeof r=="string"?[this.text(r)]:[r].flat(),...t?{attrs:t}:{},...i?{marks:i}:{}}}static normalizeTextBlockArgs(e){return e.length===1?{attrs:null,marks:null,content:e[0]}:e.length===2?{attrs:e[0],marks:null,content:e[1]}:{attrs:e[0],marks:e[1],content:e[2]}}static text(e,t){return{type:De.TEXT,...t?{marks:t}:{},text:e}}static link(e,t,r=[]){return this.text(e,[this.mark(Nf.LINK,t),...r])}static mark(e,t){return{type:e,attrs:t}}static populateAllDevices(e){return{mobile:e,tablet:e,desktop:e}}}class TN{_baseClass;_makeVariable;_linkPresetId;constructor({baseClass:e,makeVariable:t,linkPresetId:r}){this._baseClass=e,this._makeVariable=t,this._linkPresetId=r}inject(e,t){let r=e.querySelector("[data-zw-styles]");r||(r=Pi.document.createElement("style"),r.dataset.zwStyles="",r.innerHTML=this.render(t),e.append(r))}render(e){let t="";for(const r of e){const i=r.id===this._linkPresetId,s=this.makePresetCssClass(r);t+=` ${s} {`;for(const a of Mf.values)for(const u of Object.keys(r[a])){const c=this._makeVariable({device:a,preset:r,property:u}),h=this._makeInternalVariableName(u,a);if(t+=`${h}: var(${c}, inherit);`,i&&!be.attributes.includes(u)){const p=h.replace("preset-","");t+=`${p}: var(${h});`}}t+="}"}return t}_makeInternalVariableName(e,t){const r=e==="color"?"font-color":e.replace(/_/i,"-"),i=t===Mf.COMMON?"":`-${t}`;return`--zw-preset-${r}${i}`}makePresetHtmlClass(e){return this._baseClass+e.id}makePresetCssClass(e){return this.makePresetHtmlClass(e).split(" ").map(t=>`.${t}`).join("")}}class kh{static _instance;static get instance(){return this._instance??=new kh,this._instance}static query(e,t){return this.instance.query(e,t)}query(e,t){let r=null;return e.descendants(i=>{if(r)return!1;if(this.matchNode(i,t))return r=i,!1}),r?t.getMark?this.getMark(r,t.getMark):r:null}matchNode(e,t){return!(t.typeName&&t.typeName!==e.type.name||t.mark&&!this.getMark(e,t.mark))}getMark(e,t){return e.marks.find(r=>this.matchMark(r,t))||null}matchMark(e,t){return e.type.name===t.typeName}}class Ky{static createWindow(){return new sm.JSDOM().window}types;parse(e){const{window:t}=new sm.JSDOM(e);return this.types=t,t.document}}class Gy{name;description;argument;options=[];doCommand(){throw new Error('Command "doCommand" is required')}install(e){if(!this.name)throw new Error('Command "name" is required');let t=e.command(this.name);if(this.description&&(t=t.description(this.description)),this.argument&&(t=t.argument(this.argument)),this.options.length)for(const r of this.options)t=t.option(r.flags,r.description,r.default);t.action(this.doCommand.bind(this))}output(e){}}class ON extends Gy{name="to-json";description="migrate html to json";argument="<html...>";options=[{flags:"-c, --config <path>",description:"Generator config",default:im.resolve(__dirname,"../bin/zp.config.json")},{flags:"-f, --format <type>",description:"Set output format",default:"rb"}];doCommand(e,{config:t,format:r}){Pi.use(Ky.createWindow());const i=im.resolve(process.cwd(),t),s=Eh.build({config:require(i).editor,nodeDomParser:new Ky}),a=e.map(h=>s.toJSON(this._formatInputHtml(h))),u=a.length===1?a[0]:a,c=this._stringifyContent(u);this.output(r==="rb"?this._formatOutputRb(c):c)}_formatInputHtml(e){return e.replace(/\\(["'])/g,"$1").replace(/rgba\(\d{1,3}, ?\d{1,3}, ?\d{1,3}, (\d{1,2}%)\)/g,(t,r)=>t.replace(r,parseFloat(r)/100))}_stringifyContent(e){return JSON.stringify(e,(r,i)=>i===null?void 0:i,2)}_formatOutputRb(e){return e.replace(/\\"/g,'"').replace(/font-family: ?'(.+)'/g,'font-family: "$1"').replace(/'/g,"\\'").replace(/^[\t ]*"[^:\n\r]+(?<!\\)":/gm,t=>t.replace(/"/g,"")).replace(/: "(.+)"([,\n])/g,": '$1'$2")}}var MN="4.11.0-4";class IN extends Gy{name="version";description="display cli version";doCommand(){this.output(MN)}}const Jy=new GC,NN=[ON,IN];for(const n of NN)new n().install(Jy);Jy.parse();
|
|
64
|
+
}`;var se=tm(function(){return ye(x,j+"return "+B).apply(t,C)});if(se.source=B,Xu(se))throw se;return se}function Vx(o){return _e(o).toLowerCase()}function Ux(o){return _e(o).toUpperCase()}function qx(o,l,f){if(o=_e(o),o&&(f||l===t))return cd(o);if(!o||!(l=kt(l)))return o;var d=tn(o),b=tn(l),x=fd(d,b),C=hd(d,b)+1;return sr(d,x,C).join("")}function Kx(o,l,f){if(o=_e(o),o&&(f||l===t))return o.slice(0,pd(o)+1);if(!o||!(l=kt(l)))return o;var d=tn(o),b=hd(d,tn(l))+1;return sr(d,0,b).join("")}function Gx(o,l,f){if(o=_e(o),o&&(f||l===t))return o.replace(Xl,"");if(!o||!(l=kt(l)))return o;var d=tn(o),b=fd(d,tn(l));return sr(d,b).join("")}function Jx(o,l){var f=te,d=Se;if(Oe(l)){var b="separator"in l?l.separator:b;f="length"in l?ie(l.length):f,d="omission"in l?kt(l.omission):d}o=_e(o);var x=o.length;if(ri(o)){var C=tn(o);x=C.length}if(f>=x)return o;var O=f-ii(d);if(O<1)return d;var I=C?sr(C,0,O).join(""):o.slice(0,O);if(b===t)return I+d;if(C&&(O+=I.length-O),Zu(b)){if(o.slice(O).search(b)){var P,D=I;for(b.global||(b=pu(b.source,_e(Nh.exec(b))+"g")),b.lastIndex=0;P=b.exec(D);)var B=P.index;I=I.slice(0,B===t?O:B)}}else if(o.indexOf(kt(b),O)!=O){var q=I.lastIndexOf(b);q>-1&&(I=I.slice(0,q))}return I+d}function jx(o){return o=_e(o),o&&ob.test(o)?o.replace(Oh,C2):o}var Yx=fi(function(o,l,f){return o+(f?" ":"")+l.toUpperCase()}),tc=np("toUpperCase");function em(o,l,f){return o=_e(o),l=f?t:l,l===t?_2(o)?A2(o):c2(o):o.match(l)||[]}var tm=ae(function(o,l){try{return Ct(o,t,l)}catch(f){return Xu(f)?f:new ne(f)}}),Xx=Mn(function(o,l){return zt(l,function(f){f=dn(f),Tn(o,f,ju(o[f],o))}),o});function Zx(o){var l=o==null?0:o.length,f=Y();return o=l?Ae(o,function(d){if(typeof d[1]!="function")throw new $t(a);return[f(d[0]),d[1]]}):[],ae(function(d){for(var b=-1;++b<l;){var x=o[b];if(Ct(x[0],this,d))return Ct(x[1],this,d)}})}function Qx(o){return C_(Wt(o,m))}function nc(o){return function(){return o}}function eC(o,l){return o==null||o!==o?l:o}var tC=ip(),nC=ip(!0);function gt(o){return o}function rc(o){return Ld(typeof o=="function"?o:Wt(o,m))}function rC(o){return Dd(Wt(o,m))}function iC(o,l){return Fd(o,Wt(l,m))}var sC=ae(function(o,l){return function(f){return ts(f,o,l)}}),oC=ae(function(o,l){return function(f){return ts(o,f,l)}});function ic(o,l,f){var d=Ue(l),b=vo(l,d);f==null&&!(Oe(l)&&(b.length||!d.length))&&(f=l,l=o,o=this,b=vo(l,Ue(l)));var x=!(Oe(f)&&"chain"in f)||!!f.chain,C=Nn(o);return zt(b,function(O){var I=l[O];o[O]=I,C&&(o.prototype[O]=function(){var P=this.__chain__;if(x||P){var D=o(this.__wrapped__),B=D.__actions__=dt(this.__actions__);return B.push({func:I,args:arguments,thisArg:o}),D.__chain__=P,D}return I.apply(o,Qn([this.value()],arguments))})}),o}function aC(){return Ze._===this&&(Ze._=R2),this}function sc(){}function lC(o){return o=ie(o),ae(function(l){return Bd(l,o)})}var uC=Du(Ae),cC=Du(sd),fC=Du(au);function nm(o){return Vu(o)?lu(dn(o)):H_(o)}function hC(o){return function(l){return o==null?t:Nr(o,l)}}var dC=op(),pC=op(!0);function oc(){return[]}function ac(){return!1}function mC(){return{}}function gC(){return""}function yC(){return!0}function bC(o,l){if(o=ie(o),o<1||o>Xn)return[];var f=xt,d=rt(o,xt);l=Y(l),o-=xt;for(var b=fu(d,l);++f<o;)l(f);return b}function _C(o){return re(o)?Ae(o,dn):At(o)?[o]:dt(Sp(_e(o)))}function wC(o){var l=++I2;return _e(o)+l}var vC=Ao(function(o,l){return o+l},0),SC=Fu("ceil"),xC=Ao(function(o,l){return o/l},1),CC=Fu("floor");function EC(o){return o&&o.length?wo(o,gt,Su):t}function kC(o,l){return o&&o.length?wo(o,Y(l,2),Su):t}function AC(o){return ld(o,gt)}function TC(o,l){return ld(o,Y(l,2))}function OC(o){return o&&o.length?wo(o,gt,ku):t}function MC(o,l){return o&&o.length?wo(o,Y(l,2),ku):t}var IC=Ao(function(o,l){return o*l},1),NC=Fu("round"),RC=Ao(function(o,l){return o-l},0);function LC(o){return o&&o.length?cu(o,gt):0}function PC(o,l){return o&&o.length?cu(o,Y(l,2)):0}return w.after=rS,w.ary=Rp,w.assign=US,w.assignIn=Gp,w.assignInWith=$o,w.assignWith=qS,w.at=KS,w.before=Lp,w.bind=ju,w.bindAll=Xx,w.bindKey=Pp,w.castArray=mS,w.chain=Mp,w.chunk=Cw,w.compact=Ew,w.concat=kw,w.cond=Zx,w.conforms=Qx,w.constant=nc,w.countBy=Lv,w.create=GS,w.curry=Dp,w.curryRight=Fp,w.debounce=Bp,w.defaults=JS,w.defaultsDeep=jS,w.defer=iS,w.delay=sS,w.difference=Aw,w.differenceBy=Tw,w.differenceWith=Ow,w.drop=Mw,w.dropRight=Iw,w.dropRightWhile=Nw,w.dropWhile=Rw,w.fill=Lw,w.filter=Dv,w.flatMap=zv,w.flatMapDeep=$v,w.flatMapDepth=Hv,w.flatten=kp,w.flattenDeep=Pw,w.flattenDepth=Dw,w.flip=oS,w.flow=tC,w.flowRight=nC,w.fromPairs=Fw,w.functions=nx,w.functionsIn=rx,w.groupBy=Wv,w.initial=zw,w.intersection=$w,w.intersectionBy=Hw,w.intersectionWith=Ww,w.invert=sx,w.invertBy=ox,w.invokeMap=Uv,w.iteratee=rc,w.keyBy=qv,w.keys=Ue,w.keysIn=mt,w.map=Lo,w.mapKeys=lx,w.mapValues=ux,w.matches=rC,w.matchesProperty=iC,w.memoize=Do,w.merge=cx,w.mergeWith=Jp,w.method=sC,w.methodOf=oC,w.mixin=ic,w.negate=Fo,w.nthArg=lC,w.omit=fx,w.omitBy=hx,w.once=aS,w.orderBy=Kv,w.over=uC,w.overArgs=lS,w.overEvery=cC,w.overSome=fC,w.partial=Yu,w.partialRight=zp,w.partition=Gv,w.pick=dx,w.pickBy=jp,w.property=nm,w.propertyOf=hC,w.pull=Kw,w.pullAll=Tp,w.pullAllBy=Gw,w.pullAllWith=Jw,w.pullAt=jw,w.range=dC,w.rangeRight=pC,w.rearg=uS,w.reject=Yv,w.remove=Yw,w.rest=cS,w.reverse=Gu,w.sampleSize=Zv,w.set=mx,w.setWith=gx,w.shuffle=Qv,w.slice=Xw,w.sortBy=nS,w.sortedUniq=iv,w.sortedUniqBy=sv,w.split=zx,w.spread=fS,w.tail=ov,w.take=av,w.takeRight=lv,w.takeRightWhile=uv,w.takeWhile=cv,w.tap=Ev,w.throttle=hS,w.thru=Ro,w.toArray=Up,w.toPairs=Yp,w.toPairsIn=Xp,w.toPath=_C,w.toPlainObject=Kp,w.transform=yx,w.unary=dS,w.union=fv,w.unionBy=hv,w.unionWith=dv,w.uniq=pv,w.uniqBy=mv,w.uniqWith=gv,w.unset=bx,w.unzip=Ju,w.unzipWith=Op,w.update=_x,w.updateWith=wx,w.values=pi,w.valuesIn=vx,w.without=yv,w.words=em,w.wrap=pS,w.xor=bv,w.xorBy=_v,w.xorWith=wv,w.zip=vv,w.zipObject=Sv,w.zipObjectDeep=xv,w.zipWith=Cv,w.entries=Yp,w.entriesIn=Xp,w.extend=Gp,w.extendWith=$o,ic(w,w),w.add=vC,w.attempt=tm,w.camelCase=Ex,w.capitalize=Zp,w.ceil=SC,w.clamp=Sx,w.clone=gS,w.cloneDeep=bS,w.cloneDeepWith=_S,w.cloneWith=yS,w.conformsTo=wS,w.deburr=Qp,w.defaultTo=eC,w.divide=xC,w.endsWith=kx,w.eq=rn,w.escape=Ax,w.escapeRegExp=Tx,w.every=Pv,w.find=Fv,w.findIndex=Cp,w.findKey=YS,w.findLast=Bv,w.findLastIndex=Ep,w.findLastKey=XS,w.floor=CC,w.forEach=Ip,w.forEachRight=Np,w.forIn=ZS,w.forInRight=QS,w.forOwn=ex,w.forOwnRight=tx,w.get=Qu,w.gt=vS,w.gte=SS,w.has=ix,w.hasIn=ec,w.head=Ap,w.identity=gt,w.includes=Vv,w.indexOf=Bw,w.inRange=xx,w.invoke=ax,w.isArguments=Pr,w.isArray=re,w.isArrayBuffer=xS,w.isArrayLike=pt,w.isArrayLikeObject=Le,w.isBoolean=CS,w.isBuffer=or,w.isDate=ES,w.isElement=kS,w.isEmpty=AS,w.isEqual=TS,w.isEqualWith=OS,w.isError=Xu,w.isFinite=MS,w.isFunction=Nn,w.isInteger=$p,w.isLength=Bo,w.isMap=Hp,w.isMatch=IS,w.isMatchWith=NS,w.isNaN=RS,w.isNative=LS,w.isNil=DS,w.isNull=PS,w.isNumber=Wp,w.isObject=Oe,w.isObjectLike=Ie,w.isPlainObject=ls,w.isRegExp=Zu,w.isSafeInteger=FS,w.isSet=Vp,w.isString=zo,w.isSymbol=At,w.isTypedArray=di,w.isUndefined=BS,w.isWeakMap=zS,w.isWeakSet=$S,w.join=Vw,w.kebabCase=Ox,w.last=Ut,w.lastIndexOf=Uw,w.lowerCase=Mx,w.lowerFirst=Ix,w.lt=HS,w.lte=WS,w.max=EC,w.maxBy=kC,w.mean=AC,w.meanBy=TC,w.min=OC,w.minBy=MC,w.stubArray=oc,w.stubFalse=ac,w.stubObject=mC,w.stubString=gC,w.stubTrue=yC,w.multiply=IC,w.nth=qw,w.noConflict=aC,w.noop=sc,w.now=Po,w.pad=Nx,w.padEnd=Rx,w.padStart=Lx,w.parseInt=Px,w.random=Cx,w.reduce=Jv,w.reduceRight=jv,w.repeat=Dx,w.replace=Fx,w.result=px,w.round=NC,w.runInContext=M,w.sample=Xv,w.size=eS,w.snakeCase=Bx,w.some=tS,w.sortedIndex=Zw,w.sortedIndexBy=Qw,w.sortedIndexOf=ev,w.sortedLastIndex=tv,w.sortedLastIndexBy=nv,w.sortedLastIndexOf=rv,w.startCase=$x,w.startsWith=Hx,w.subtract=RC,w.sum=LC,w.sumBy=PC,w.template=Wx,w.times=bC,w.toFinite=Rn,w.toInteger=ie,w.toLength=qp,w.toLower=Vx,w.toNumber=qt,w.toSafeInteger=VS,w.toString=_e,w.toUpper=Ux,w.trim=qx,w.trimEnd=Kx,w.trimStart=Gx,w.truncate=Jx,w.unescape=jx,w.uniqueId=wC,w.upperCase=Yx,w.upperFirst=tc,w.each=Ip,w.eachRight=Np,w.first=Ap,ic(w,function(){var o={};return fn(w,function(l,f){ve.call(w.prototype,f)||(o[f]=l)}),o}(),{chain:!1}),w.VERSION=r,zt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(o){w[o].placeholder=w}),zt(["drop","take"],function(o,l){ce.prototype[o]=function(f){f=f===t?1:$e(ie(f),0);var d=this.__filtered__&&!l?new ce(this):this.clone();return d.__filtered__?d.__takeCount__=rt(f,d.__takeCount__):d.__views__.push({size:rt(f,xt),type:o+(d.__dir__<0?"Right":"")}),d},ce.prototype[o+"Right"]=function(f){return this.reverse()[o](f).reverse()}}),zt(["filter","map","takeWhile"],function(o,l){var f=l+1,d=f==Ft||f==Ve;ce.prototype[o]=function(b){var x=this.clone();return x.__iteratees__.push({iteratee:Y(b,3),type:f}),x.__filtered__=x.__filtered__||d,x}}),zt(["head","last"],function(o,l){var f="take"+(l?"Right":"");ce.prototype[o]=function(){return this[f](1).value()[0]}}),zt(["initial","tail"],function(o,l){var f="drop"+(l?"":"Right");ce.prototype[o]=function(){return this.__filtered__?new ce(this):this[f](1)}}),ce.prototype.compact=function(){return this.filter(gt)},ce.prototype.find=function(o){return this.filter(o).head()},ce.prototype.findLast=function(o){return this.reverse().find(o)},ce.prototype.invokeMap=ae(function(o,l){return typeof o=="function"?new ce(this):this.map(function(f){return ts(f,o,l)})}),ce.prototype.reject=function(o){return this.filter(Fo(Y(o)))},ce.prototype.slice=function(o,l){o=ie(o);var f=this;return f.__filtered__&&(o>0||l<0)?new ce(f):(o<0?f=f.takeRight(-o):o&&(f=f.drop(o)),l!==t&&(l=ie(l),f=l<0?f.dropRight(-l):f.take(l-o)),f)},ce.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},ce.prototype.toArray=function(){return this.take(xt)},fn(ce.prototype,function(o,l){var f=/^(?:filter|find|map|reject)|While$/.test(l),d=/^(?:head|last)$/.test(l),b=w[d?"take"+(l=="last"?"Right":""):l],x=d||/^find/.test(l);b&&(w.prototype[l]=function(){var C=this.__wrapped__,O=d?[1]:arguments,I=C instanceof ce,P=O[0],D=I||re(C),B=function(ue){var pe=b.apply(w,Qn([ue],O));return d&&q?pe[0]:pe};D&&f&&typeof P=="function"&&P.length!=1&&(I=D=!1);var q=this.__chain__,j=!!this.__actions__.length,X=x&&!q,se=I&&!j;if(!x&&D){C=se?C:new ce(this);var Z=o.apply(C,O);return Z.__actions__.push({func:Ro,args:[B],thisArg:t}),new Ht(Z,q)}return X&&se?o.apply(this,O):(Z=this.thru(B),X?d?Z.value()[0]:Z.value():Z)})}),zt(["pop","push","shift","sort","splice","unshift"],function(o){var l=io[o],f=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",d=/^(?:pop|shift)$/.test(o);w.prototype[o]=function(){var b=arguments;if(d&&!this.__chain__){var x=this.value();return l.apply(re(x)?x:[],b)}return this[f](function(C){return l.apply(re(C)?C:[],b)})}}),fn(ce.prototype,function(o,l){var f=w[l];if(f){var d=f.name+"";ve.call(li,d)||(li[d]=[]),li[d].push({name:l,func:f})}}),li[ko(t,g).name]=[{name:"wrapper",func:t}],ce.prototype.clone=j2,ce.prototype.reverse=Y2,ce.prototype.value=X2,w.prototype.at=kv,w.prototype.chain=Av,w.prototype.commit=Tv,w.prototype.next=Ov,w.prototype.plant=Iv,w.prototype.reverse=Nv,w.prototype.toJSON=w.prototype.valueOf=w.prototype.value=Rv,w.prototype.first=w.prototype.head,Ji&&(w.prototype[Ji]=Mv),w},si=T2();Ar?((Ar.exports=si)._=si,ru._=si):Ze._=si}).call(BI)}(Ws,Ws.exports)),Ws.exports}var Hy=zI();function bh(n){return n.type.create(Hy.cloneDeep(n.attrs))}function _h({tr:n,node:e,position:t,mark:r}){return e.isText?n.removeMark(t,t+e.nodeSize,r):n.removeNodeMark(t,r)}const $I=Re.create({name:"node_processor",addCommands(){return{setBlockAttributes:W(({commands:n,state:e},t,r,i={})=>{const s=V(n.getBlockAttributes(t))??{},{doc:a,tr:u}=e,{from:c,to:h}=u.selection;a.nodesBetween(c,h,(p,m)=>{Me.blocks.includes(p.type.name)&&u.setNodeAttribute(m,t,{...i,...s,...r})})}),getBlockAttributes:W(({editor:n},e,t)=>me(()=>{let r=Object.assign({},t||{});for(const i of Me.blocks)Object.assign(r,n.getAttributes(i)?.[e]||{});return Object.keys(r).length?r:null})),removeBlockAttributes:W(({commands:n},e)=>{for(const t of Me.blocks)n.resetAttributes(t,e)}),applyMark:W(({state:n,commands:e},t,r,i={})=>{const{tr:s,doc:a,schema:u}=n,{$from:c,$to:h}=s.selection,p=mn(be.LINK,u),m=mn(t,u);if(!(m.spec.group||"").includes(gn.SETTINGS))return e.setMark(t,r);if(c.pos===h.pos)return;const _=S=>{if(!i.onAppliedToParent||i.onAppliedToParent(S)===!1){const{tr:E,node:N,position:g,mark:v}=S;_h({tr:E,node:N,position:g,mark:v.type})}};a.nodesBetween(c.pos,h.pos,(S,E)=>{if(S.type.name===Me.LIST)return;const N=FI(S.marks,t),g=m.create({...N?.attrs||{},...r}),v=By(c,h,S,E);if(!p.isInSet(S.marks)&&DI(s.doc,E,g,i.isAppliedToParent))return _({tr:s,node:S,position:E,mark:g});if(S.isText){s.addMark(v.from,v.to,g);return}LI(s.doc,s.selection,S,E)&&s.addNodeMark(E,g)})}),getMarks:W(({editor:n},e)=>{const t=bi(n,"state");return me(()=>{const{selection:r,doc:i}=V(t),{from:s,to:a}=V(r),u=[];return i.nodesBetween(s,a,c=>{for(const h of c.marks)h.type.name===e&&u.unshift(h.attrs)}),u})}),getMark:W(({commands:n},e)=>{const t=n.getMarks(e);return me(()=>V(t)[0]??null)}),hasMark:W(({commands:n},e)=>{const t=n.getMark(e);return me(()=>!!V(t))}),getCommonSettingMark:W(({commands:n},e,t)=>{const r=n.getMark(e);return me(()=>V(r)?.value??V(t))}),getDeviceSettingMark:W(({commands:n},e,t)=>{const r=n.getMarks(e),i=n.getDevice();return me(()=>{for(const s of V(r)){const a=s[V(i)];if(a)return a}return V(t)})}),removeAllMarks:W(({state:n})=>{const{tr:e,doc:t}=n,{from:r,to:i}=e.selection;t.nodesBetween(r,i,(s,a)=>{for(const u of s.marks)_h({tr:e,node:s,position:a,mark:u})})}),removeMarks:W(({state:n},e)=>{const{tr:t,doc:r}=n,{from:i,to:s}=t.selection;r.nodesBetween(i,s,(a,u)=>{const c=a.marks.filter(h=>e.includes(h.type.name));for(const h of c)_h({tr:t,node:a,position:u,mark:h})})})}}}),HI=Re.create({name:"text_processor",addCommands(){return{getSelectedText:W(({state:n})=>{const{from:e,to:t}=n.selection;return n.doc.textBetween(e,t," ")}),transformText:W(({state:n},e)=>{const{$from:t,$to:r}=n.tr.selection;t.pos!==r.pos&&n.doc.nodesBetween(t.pos,r.pos,(i,s)=>{if(!i.isText)return;const a=By(t,r,i,s),u=Math.max(0,t.pos-s),c=Math.max(0,r.pos-s),h=e({text:i.textContent.substring(u,c)}),p=n.schema.text(h,i.marks);n.tr.replaceWith(a.from,a.to,p)})})}}}),WI=Re.create({name:"selection_processor",addStorage:()=>({selection:null}),addCommands(){return{storeSelection:W(({state:n})=>{this.storage.selection=n.selection}),restoreSelection:W(({commands:n})=>{this.storage.selection&&n.setTextSelection(this.storage.selection)}),expandSelection:W(({tr:n,commands:e},t)=>{let r=n.selection.from,i=n.selection.to;return n.doc.nodesBetween(r,i,(s,a,u)=>{if(t({node:s,parent:u})){const c=s.isText?0:zy(n.doc,a);r=Math.min(r,a+c),i=Math.max(i,a+s.nodeSize-c)}}),e.setTextSelection({from:r,to:i})}),expandSelectionToBlock:W(({commands:n})=>n.expandSelection(({parent:e})=>e.type.name===De.DOCUMENT))}}}),VI=Yn.create({name:"doc",topNode:!0,content:"block+"});class Ks extends qe{constructor(e,t,r,i="SetDocAttr"){super(),this.key=e,this.value=t,this.schema=r,this.stepType=i}apply(e){this.prevValue=e.attrs.meta[this.key];const t=hr.fromJSON(this.schema,e.toJSON());return t.attrs.meta[this.key]=this.value,Fe.ok(t)}invert(){return new Ks(this.key,this.prevValue,this.schema,"revertSetDocAttr")}map(){return null}toJSON(){return{stepType:this.stepType,key:this.key,value:this.value}}static fromJSON(e){return new Ks(e.key,e.value,e.stepType)}}qe.jsonID("setDocAttr",Ks);const UI=VI.extend({marks:gn.SETTINGS,addAttributes:()=>({meta:{default:{}}}),onCreate(){this.editor.view.dom.addEventListener("click",n=>{n.target.closest("a")&&n.preventDefault()})},addCommands(){return{setDocMetaAttributes:W(({state:n},e,t)=>{n.tr.step(new Ks(e,t,n.schema))})}}}),qI=Yn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",Mi(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),KI=qI.extend({marks:gn.ALL,addOptions:()=>({HTMLAttributes:{class:"zw-style"}})}),GI=Yn.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,Mi(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>bO({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),JI=GI.extend({marks:gn.ALL,addOptions:()=>({levels:[1,2,3,4],HTMLAttributes:{class:"zw-style"}})}),jI=Re.create({name:"prose_mirror_plugins",addProseMirrorPlugins(){return[$O.create(this.editor),HO.create(this.editor)]}}),YI=()=>[UI,KI,JI,vO,IO,$I,HI,WI,jI],XI=Rt.create({name:be.FONT_FAMILY,group:gn.SETTINGS,addOptions:()=>({fonts:[]}),addAttributes:()=>({value:{required:!0}}),addCommands(){return{applyFontFamily:W(({commands:n},e)=>{n.applyMark(this.name,{value:e});const t=n.findFontByName(e);let r=V(n.getFontWeight());t.isWeightSupported(r)||(r=t.findClosestWeight(r),n.applyFontWeight(r));const i=n.isSettingCustomized(be.FONT_STYLE).value;!t.isItalicSupported(r)&&i&&n.removeItalic()}),getFont:W(({commands:n})=>{const e=V(this.options.defaultPreset),t=n.findFontByName(e.common.font_family),r=n.getFontFamily();return me(()=>n.findFontByName(V(r))||t)}),findFontByName:W((n,e)=>V(this.options.fonts).find(t=>t.name===e)??this.options.defaultFont),getFontFamily:W(({commands:n})=>n.getCommonSettingMark(this.name,n.getDefaultFontFamily())),getDefaultFontFamily:W(({commands:n})=>{const e=n.getPreset();return me(()=>V(e).common.font_family)})}},parseHTML(){const n=e=>({value:e.replace(/["']/g,"")});return[{style:"--zw-font-family",getAttrs:n},{style:"font-family",getAttrs:n}]},renderHTML({HTMLAttributes:n}){const e=n.value?`"${n.value}"`:null;return Jr({font_family:e})}}),ZI=Re.create({name:be.STYLE_PRESET,addGlobalAttributes(){return[{types:[Me.PARAGRAPH,Me.HEADING],attributes:{preset:{isRequired:!1,default:{id:V(this.options.defaultId)},parseHTML:n=>{const e=V(this.options.presets);if(n.parentElement.tagName==="LI")return null;for(const{id:t,node:r,fallbackClass:i}of e){if(i&&n.classList.contains(i))return{id:t};const s=V(this.options.styleRenderer).makePresetCssClass({id:t});if(n.matches(s))return{id:t};if(n.tagName===`H${r?.level}`)return{id:t}}return n.tagName==="P"?{id:V(this.options.defaultId)}:null},renderHTML:n=>n.preset?{class:V(this.options.styleRenderer).makePresetHtmlClass(n.preset)}:null}}}]},addCommands(){function n(t,r){return t.find(i=>r===i.id)}function e(t,r){const i={};for(const s of Object.keys(t)){const a=t[s],u=r[s],c=!u||u.toLowerCase()==="inherit";i[s]=c?a:u}return i}return{getPresetList:W(()=>me(()=>V(this.options.presets).filter(t=>!t.hidden))),getPreset:W(({commands:t})=>{const r=t.getBlockAttributes("preset",{id:V(this.options.defaultId)}),i=t.getPresetList(),s=t.isLink(),a=t.getLinkPreset();return me(()=>{const u=n(V(i),V(r).id);if(!V(s))return u;const c=V(a);return{id:u.id,common:e(u.common,c.common),mobile:e(u.mobile,c.mobile),tablet:e(u.tablet,c.tablet),desktop:e(u.desktop,c.desktop)}})}),applyPreset:W(({commands:t,chain:r},i)=>{const s=V(t.getPresetList()),a=n(s,i),u=a.node?.type??Me.PARAGRAPH,c={preset:{id:i}};a.node&&(c.level=a.node.level);for(const h of be.attributes)c[h]=V(t.getBlockAttributes(h));r().removeList().setNode(u,c).run()}),applyDefaultPreset:W(({commands:t})=>{t.applyPreset(V(this.options.defaultId))}),removePreset:W(({commands:t})=>{t.setNode(Me.PARAGRAPH,{preset:null})}),getPresetCustomization:W(({editor:t,commands:r})=>{const i=bi(t,"state");return me(()=>{const{selection:s,doc:a}=V(i),{from:u,to:c}=s;return r._getSettingCustomization(a,u,c)})}),isSettingCustomized:W(({commands:t},r)=>{const i=t.getPresetCustomization(),s=be.presetAttributes.includes(r)?"attributes":"marks";return me(()=>V(i)[s]?.includes(r)??!1)}),getContentCustomization:W(({editor:t,commands:r})=>{const i=bi(t,"state");return me(()=>{const{doc:s}=V(i);return r._getSettingCustomization(s,0,s.content.size)})}),_getSettingCustomization:W((t,r,i,s)=>{const a=new Set,u=new Set;return r.nodesBetween(i,s,c=>{for(const[h,p]of Object.entries(c.attrs))be.presetAttributes.includes(h)&&p&&u.add(h);for(const{type:h}of c.marks)be.marks.includes(h.name)&&a.add(h.name)}),{attributes:Array.from(u),marks:Array.from(a)}}),removePresetCustomization:W(({chain:t})=>{t().storeSelection().expandSelectionToBlock().removeMarks(be.marks).resetAttributes(Me.PARAGRAPH,be.presetAttributes).resetAttributes(Me.HEADING,be.presetAttributes).restoreSelection().run()}),removeFormat:W(({chain:t})=>{t().storeSelection().expandSelectionToBlock().removeAllMarks().applyDefaultPreset().restoreSelection().run()})}},onCreate(){this.options.styleRenderer.inject(Pi.head,V(this.options.presets))}}),QI=Rt.create({name:be.FONT_WEIGHT,group:gn.SETTINGS,addAttributes:()=>({value:{required:!0}}),addCommands(){return{applyFontWeight:W(({commands:n},e)=>{n.applyMark(this.name,{value:e}),V(n.getFont()).isItalicSupported(e)||n.removeItalic()}),toggleBold:W(({commands:n})=>{const e=V(n.getFontWeight()),t=V(n.getFont()),i=Number(e)>=600?"400":"700",s=t.findClosestWeight(i);n.applyFontWeight(s)}),getFontWeight:W(({commands:n})=>{const e=n.getCommonSettingMark(this.name,n.getDefaultFontWeight()),t=n.getFont();return me(()=>{const r=V(e),i=V(t);return i.isWeightSupported(r)?r:i.findClosestWeight(r)})}),getDefaultFontWeight:W(({commands:n})=>{const e=n.getPreset();return me(()=>V(e).common.font_weight)})}},addKeyboardShortcuts:()=>({"Mod-b":Xt("toggleBold"),"Mod-B":Xt("toggleBold")}),parseHTML(){const n=e=>e==="bold"?{value:"700"}:Number(e)?{value:e}:!1;return[{style:"--zw-font-weight",getAttrs:n},{style:"font-weight",getAttrs:n},{tag:"b",attrs:{value:"700"}},{tag:"strong",attrs:{value:"700"}}]},renderHTML({HTMLAttributes:n}){return Jr({font_weight:n.value})}}),eN=Rt.create({name:be.FONT_SIZE,group:gn.SETTINGS,addOptions:()=>({minSize:1,maxSize:100}),addAttributes(){return{mobile:{default:null},tablet:{default:null},desktop:{default:null}}},addCommands(){return{getFontSize:W(({commands:n})=>n.getDeviceSettingMark(this.name,n.getDefaultFontSize())),getDefaultFontSize:W(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return me(()=>V(t)[V(e)].font_size.replace("px",""))}),applyFontSize:W(({commands:n},e)=>{const t=V(n.getDevice());n.applyMark(this.name,{[t]:e},{isAppliedToParent:(r,i)=>r.type.name!==i.type.name?!1:r.attrs[t]===i.attrs[t],onAppliedToParent:({tr:r,node:i,position:s,mark:a})=>{const u={...a.attrs,[t]:null};if(!Object.values(u).some(p=>!!p))return!1;const h=a.type.create(u);if(i.isText){r.addMark(s,s+i.nodeSize,h);return}r.addNodeMark(s,h)}})}),increaseFontSize:W(({commands:n})=>{const e=Number(V(n.getFontSize())),t=Math.min(e+1,V(this.options.maxSize));n.applyFontSize(String(t))}),decreaseFontSize:W(({commands:n})=>{const e=Number(V(n.getFontSize())),t=Math.max(e-1,V(this.options.minSize));n.applyFontSize(String(t))})}},addKeyboardShortcuts:()=>({"Mod-Shift-=":Xt("increaseFontSize"),"Mod-Shift--":Xt("decreaseFontSize")}),parseHTML(){const n=e=>{if(!e)return null;const t=V(this.options.wrapperRef),r=Fy(e,t);return String(r)};return[{tag:'[style*="--zw-font-size"]',getAttrs:({style:e})=>({mobile:n(e.getPropertyValue("--zw-font-size-mobile")),tablet:n(e.getPropertyValue("--zw-font-size-tablet")),desktop:n(e.getPropertyValue("--zw-font-size-desktop"))})},{style:"font-size",getAttrs:e=>{const t=n(e);return{desktop:t,tablet:t,mobile:null}}}]},renderHTML({HTMLAttributes:n}){const e=t=>t?`${t}px`:null;return Jr({font_size_mobile:e(n.mobile),font_size_tablet:e(n.tablet),font_size_desktop:e(n.desktop)})}}),tN=Rt.create({name:be.FONT_COLOR,group:gn.SETTINGS,addAttributes:()=>({value:{required:!0}}),addCommands(){return{getFontColor:W(({commands:n})=>n.getCommonSettingMark(this.name,n.getDefaultFontColor())),getDefaultFontColor:W(({commands:n})=>{const e=n.getPreset();return me(()=>V(e).common.color)}),applyFontColor:W(({commands:n},e)=>{n.applyMark(this.name,{value:e})})}},parseHTML(){const n=e=>({value:Dy(e)});return[{style:"--zw-font-color",getAttrs:n},{style:"color",getAttrs:n}]},renderHTML({HTMLAttributes:n}){return Jr({font_color:n.value})}}),nN=Rt.create({name:be.BACKGROUND_COLOR,addAttributes:()=>({value:{required:!0}}),addCommands(){return{getBackgroundColor:W(({commands:n})=>n.getCommonSettingMark(this.name,"rgba(255, 255, 255, 0%)")),applyBackgroundColor:W(({commands:n},e)=>{n.applyMark(this.name,{value:e})})}},parseHTML(){const n=e=>({value:Dy(e)});return[{style:"--zw-background-color",getAttrs:n},{style:"background-color",getAttrs:n}]},renderHTML({HTMLAttributes:n}){return Jr({background_color:n.value})}}),rN=Re.create({name:"device_manager",addCommands(){return{getDevice:W(()=>bi(this.options,"device"))}}}),iN=Rt.create({name:be.FONT_STYLE,group:gn.SETTINGS,addAttributes:()=>({italic:{required:!0}}),addCommands(){return{isItalic:W(({commands:n})=>{const e=n.getMark(this.name),t=n.getDefaultFontStyle();return me(()=>V(e)?.italic??V(t).italic)}),isItalicAvailable:W(({commands:n})=>{const e=n.getFont(),t=n.getFontWeight();return me(()=>{const r=V(e),i=V(t);return r.isItalicSupported(i)&&!r.isWeightItalicOnly(i)})}),getDefaultFontStyle:W(({commands:n})=>{const e=n.getPreset();return me(()=>({italic:V(e).common.font_style==="italic"}))}),toggleItalic:W(({commands:n})=>{V(n.isItalicAvailable())&&(V(n.isItalic())?n.removeItalic():n.applyItalic())}),applyItalic:W(({commands:n})=>{n.applyMark(this.name,{italic:!0})}),removeItalic:W(({commands:n})=>{n.applyMark(this.name,{italic:!1})})}},addKeyboardShortcuts:()=>({"Mod-i":Xt("toggleItalic"),"Mod-I":Xt("toggleItalic")}),parseHTML(){const n=e=>({italic:e.includes("italic")});return[{tag:"i",attrs:{italic:!0}},{style:"--zw-font-style",getAttrs:n},{style:"font-style",getAttrs:n}]},renderHTML({HTMLAttributes:n}){const e=n.italic?"italic":"normal";return Jr({font_style:e})}}),sN=Rt.create({name:be.TEXT_DECORATION,priority:1e3,addAttributes:()=>({underline:{default:!1},strike_through:{default:!1}}),addCommands(){return{isUnderline:W(({commands:n})=>{const e=n.getTextDecoration();return me(()=>V(e).underline)}),isStrikeThrough:W(({commands:n})=>{const e=n.getTextDecoration();return me(()=>V(e).strike_through)}),getTextDecoration:W(({commands:n})=>{const e=n.getMark(this.name),t=n.getDefaultTextDecoration();return me(()=>{const r=V(e)??{},i=V(t);return{underline:r.underline||i.underline,strike_through:r.strike_through||i.strike_through}})}),isUnderlineCustomized:W(({commands:n})=>{const e=n.isUnderline(),t=n.getDefaultTextDecoration();return me(()=>V(e)!==V(t).underline)}),getDefaultTextDecoration:W(({commands:n})=>{const e=n.getPreset();return me(()=>{const{text_decoration:t}=V(e).common;return{underline:t.includes("underline"),strike_through:t.includes("line-through")}})}),toggleUnderline:W(({commands:n})=>{n.toggleTextDecoration("underline")}),toggleStrikeThrough:W(({commands:n})=>{n.toggleTextDecoration("strike_through")}),toggleTextDecoration:W(({commands:n},e,t=null)=>{const r=V(n.getTextDecoration()),i=t??!r[e];n.applyMark(this.name,{[e]:i})}),applyTextDecoration:W(({commands:n},e)=>{n.toggleTextDecoration(e,!0)}),removeTextDecoration:W(({commands:n},e)=>{n.toggleTextDecoration(e,!1)})}},addKeyboardShortcuts:()=>({"Mod-u":Xt("toggleUnderline"),"Mod-U":Xt("toggleUnderline")}),parseHTML(){const n=e=>{const t=e.includes("underline"),r=e.includes("line-through");return!t&&!r?!1:{underline:t,strike_through:r}};return[{style:"--zw-text-decoration",getAttrs:n},{style:"text-decoration-line",getAttrs:n},{style:"text-decoration",getAttrs:n},{tag:"s",attrs:{underline:!1,strike_through:!0}},{tag:"u",attrs:{underline:!0,strike_through:!1}}]},renderHTML({HTMLAttributes:n}){const e=[];return n.underline&&e.push("underline"),n.strike_through&&e.push("line-through"),e.length||e.push("none"),Jr({text_decoration:e.join(" ")})}}),oN=Re.create({name:"case_style",addCommands(){return{applyCaseStyle:W(({commands:n},e)=>{switch(e){case If.CAPITALIZE:return n.applyCapitalize();case If.LOWERCASE:return n.applyLowerCase();case If.UPPERCASE:return n.applyUpperCase()}}),applyCapitalize:W(({commands:n})=>{n.transformText(({text:e})=>aM(e))}),applyLowerCase:W(({commands:n})=>{n.transformText(({text:e})=>e.toLowerCase())}),applyUpperCase:W(({commands:n})=>{n.transformText(({text:e})=>e.toUpperCase())})}}}),Wy={mobile:null,tablet:null,desktop:null},aN=Re.create({name:be.ALIGNMENT,addGlobalAttributes:()=>[{types:[Me.PARAGRAPH,Me.HEADING],attributes:{[be.ALIGNMENT]:{isRequired:!1,parseHTML({style:n}){const e=RI(n.textAlign);if(e)return{desktop:e,tablet:e,mobile:e};const t=n.getPropertyValue("--zw-alignment-mobile")||null,r=n.getPropertyValue("--zw-alignment-tablet")||null,i=n.getPropertyValue("--zw-alignment-desktop")||null;return!t&&!r&&!i?null:{desktop:i,tablet:r,mobile:t}},renderHTML(n){return n.alignment?Sl({alignment_mobile:n.alignment.mobile,alignment_tablet:n.alignment.tablet,alignment_desktop:n.alignment.desktop}):null}}}}],addCommands(){return{applyAlignment:W(({commands:n},e)=>{const t=V(n.getDevice());n.setBlockAttributes(this.name,{[t]:e},Wy)}),removeAlignment:W(({commands:n})=>n.removeBlockAttributes(this.name)),getAlignment:W(({commands:n})=>{const e=n.getBlockAttributes(this.name,Wy),t=n.getDevice(),r=n.getDefaultAlignment();return me(()=>V(e)?.[V(t)]??V(r))}),getDefaultAlignment:W(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return me(()=>V(t)[V(e)].alignment??wr.LEFT)})}},addKeyboardShortcuts:()=>({"Mod-Shift-l":Xt("applyAlignment",wr.LEFT),"Mod-Shift-e":Xt("applyAlignment",wr.CENTER),"Mod-Shift-r":Xt("applyAlignment",wr.RIGHT),"Mod-Shift-j":Xt("applyAlignment",wr.JUSTIFY)})}),Vy={mobile:null,tablet:null,desktop:null},lN=Re.create({name:be.LINE_HEIGHT,addGlobalAttributes(){return[{types:[Me.PARAGRAPH,Me.HEADING],attributes:{[be.LINE_HEIGHT]:{isRequired:!1,parseHTML:n=>{if(n.matches('[style*="--zw-line-height"]')){const s=n.style.getPropertyValue("--zw-line-height-tablet")||null,a=n.style.getPropertyValue("--zw-line-height-desktop")||null;return{mobile:null,tablet:s,desktop:a}}const e=n.style.lineHeight;if(!e)return null;const t=V(this.options.wrapperRef),r=II(e,n,t);return r?{desktop:r,tablet:r,mobile:null}:null},renderHTML(n){return n.line_height?Sl({line_height_mobile:n.line_height.mobile,line_height_tablet:n.line_height.tablet,line_height_desktop:n.line_height.desktop}):null}}}}]},addCommands(){return{getLineHeight:W(({commands:n})=>{const e=n.getBlockAttributes(this.name,Vy),t=n.getDevice(),r=n.getDefaultLineHeight();return me(()=>V(e)?.[V(t)]??V(r))}),getDefaultLineHeight:W(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return me(()=>V(t)[V(e)].line_height)}),applyLineHeight:W(({commands:n},e)=>{const t=V(n.getDevice());n.setBlockAttributes(this.name,{[t]:e},Vy)})}}}),uN=Yn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",Mi(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),cN=uN.extend({name:Me.LIST_ITEM,marks:gn.SETTINGS,addCommands(){const n=({selection:e})=>e.$cursor.before(e.$cursor.depth-1);return{listItemNewline:W(({commands:e,tr:t})=>{const r=t.doc.nodeAt(n(t));if(!t.selection.$cursor.node().textContent)return!1;e.splitListItem(this.name);const s=n(t);for(const a of r.marks)t.addNodeMark(s,bh(a));return!0})}},addOptions:()=>({HTMLAttributes:{class:"zw-style"}}),addKeyboardShortcuts:()=>({Enter:n=>{const{state:e,commands:t}=n.editor;if(e.selection.$cursor?.path.some(i=>i.type?.name===Me.LIST))return t.listItemNewline()}})});function fN(n,e){if(y1.includes(e.type)||e.type.isInSet(n.marks))return!1;for(const t of n.content.content)if(t.childCount&&(!t.marks||!e.isInSet(t.marks)))return!1;return!0}function hN(n){const e=n.selection.$from.start(),t=n.selection.$to.end();n.doc.nodesBetween(e,t,(r,i)=>{if(r.type.name===De.LIST)return;if(r.type.name!==De.LIST_ITEM)return!1;const s=[];return r.forEach(a=>{for(const u of a.marks){if(u.isInSet(s)){n.removeNodeMark(i+1,u);continue}fN(r,u)&&(n.removeNodeMark(i+1,u),n.addNodeMark(i,bh(u)),s.push(u))}}),!1})}const dN=Yn.create({name:De.LIST,content:`${De.LIST_ITEM}+`,group:"block list",marks:Rf.SETTINGS,addExtensions:()=>[cN],addOptions:()=>({baseClass:"",presetClass:""}),addAttributes:()=>({bullet:{default:{type:Jt.DISC}}}),parseHTML(){const n={a:Jt.ROMAN,i:Jt.LATIN,1:Jt.DECIMAL},e=t=>{for(const r of PO){const i=`.${V(this.options.baseClass)}${r}`;if(t.matches(i)||n[t.type.toLowerCase()]===r)return r}};return[{tag:"ol",getAttrs:t=>({bullet:{type:e(t)||Jt.DECIMAL}})},{tag:"ul",getAttrs:t=>({bullet:{type:e(t)||Jt.DISC}})}]},renderHTML({HTMLAttributes:n}){const e=[V(this.options.baseClass)+n.bullet.type,V(this.options.presetClass)];return[DO.includes(n.bullet.type)?"ol":"ul",{class:e.join(" ")},0]},addCommands(){return{getListType:W(({commands:n})=>{const e=n.getBlockAttributes("bullet",{type:null});return me(()=>V(e).type??null)}),applyList:W(({commands:n,chain:e},t)=>V(n.getListType())===t?n.removeList():e().applyDefaultPreset().toggleList(De.LIST,De.LIST_ITEM).setBlockAttributes("bullet",{type:t}).command(({tr:i})=>hN(i)).run()),removeList:W(({chain:n})=>n().expandSelection(({parent:e})=>e.type.name===De.LIST).command(({tr:e})=>{const t=e.selection.$from.start(),r=e.selection.$to.end();return e.doc.nodesBetween(t,r,(i,s,a)=>{if([De.LIST,De.LIST_ITEM].includes(i.type.name))return;if(a.type.name!==De.LIST_ITEM)return!1;const u=a.marks.filter(c=>!c.type.isInSet(i.marks));for(const c of u)e.addNodeMark(s,bh(c));return!1}),!0}).liftListItem(De.LIST_ITEM).run())}},addInputRules(){const n=(e,t)=>_O({find:t,type:this.type,getAttributes:{bullet:{type:e}},joinPredicate:(r,{attrs:i})=>i.bullet.type===e});return[n(Jt.DISC,/^\s*([-+*])\s$/),n(Jt.DECIMAL,/^(\d+)\.\s$/),n(Jt.LATIN,/^([ivx]{1,3})\.\s$/i),n(Jt.ROMAN,/^([a-z])\.\s$/i)]}});function pN(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function mN(n){return new ft({key:new It("autolink"),appendTransaction:(e,t,r)=>{const i=e.some(h=>h.docChanged)&&!t.doc.eq(r.doc),s=e.some(h=>h.getMeta("preventAutolink"));if(!i||s)return;const{tr:a}=r,u=HT(t.doc,[...e]);if(YT(u).forEach(({newRange:h})=>{const p=VT(r.doc,h,_=>_.isTextblock);let m,y;if(p.length>1?(m=p[0],y=r.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ")):p.length&&r.doc.textBetween(h.from,h.to," "," ").endsWith(" ")&&(m=p[0],y=r.doc.textBetween(m.pos,h.to,void 0," ")),m&&y){const _=y.split(" ").filter(g=>g!=="");if(_.length<=0)return!1;const S=_[_.length-1],E=m.pos+y.lastIndexOf(S);if(!S)return!1;const N=vl(S).map(g=>g.toObject(n.defaultProtocol));if(!pN(N))return!1;N.filter(g=>g.isLink).map(g=>({...g,from:E+g.start+1,to:E+g.end+1})).filter(g=>r.schema.marks.code?!r.doc.rangeHasMark(g.from,g.to,r.schema.marks.code):!0).filter(g=>n.validate(g.value)).filter(g=>n.shouldAutoLink(g.value)).forEach(g=>{i1(g.from,g.to,r.doc).some(v=>v.mark.type===n.type)||a.addMark(g.from,g.to,n.type.create({href:g.href}))})}}),!!a.steps.length)return a}})}function gN(n){return new ft({key:new It("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let a=r.target;const u=[];for(;a.nodeName!=="DIV";)u.push(a),a=a.parentNode;if(!u.find(y=>y.nodeName==="A"))return!1;const c=GT(e.state,n.type.name),h=r.target,p=(i=h?.href)!==null&&i!==void 0?i:c.href,m=(s=h?.target)!==null&&s!==void 0?s:c.target;return h&&p?(window.open(p,m),!0):!1}}})}function yN(n){return new ft({key:new It("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{state:i}=e,{selection:s}=i,{empty:a}=s;if(a)return!1;let u="";r.content.forEach(h=>{u+=h.textContent});const c=D1(u,{defaultProtocol:n.defaultProtocol}).find(h=>h.isLink&&h.value===u);return!u||!c?!1:n.editor.commands.setMark(n.type,{href:c.href})}}})}const bN=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function Xr(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&t.push(i)}),!n||n.replace(bN,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const _N=Rt.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){P1(n);return}P1(n.scheme,n.optionalSlashes)})},onDestroy(){rM()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!Xr(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>!!n}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!Xr(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!Xr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Mi(this.options.HTMLAttributes,n),0]:["a",Mi(this.options.HTMLAttributes,{...n,href:""}),0]},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!Xr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!Xr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[wO({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,i=D1(n).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:a=>!!Xr(a,t),protocols:t,defaultProtocol:r}));i.length&&i.forEach(s=>e.push({text:s.value,data:{href:s.href},index:s.start}))}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(mN({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Xr(i,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&n.push(gN({type:this.type})),this.options.linkOnPaste&&n.push(yN({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),n}}),wN=_N.extend({name:be.LINK,addOptions(){return{...this.parent?.(),openOnClick:!1,linkOnPaste:!1}},addAttributes(){return{href:{default:null,parseHTML:n=>{const e=n.getAttribute("href");return e.startsWith("#")?parseFloat(n.getAttribute("href").replace("#","")):e}},target:{default:_1.SELF,parseHTML:n=>n.getAttribute("target")||_1.SELF},destination:{default:Ts.URL,parseHTML:n=>{const e=n.getAttribute("href");if(!e.startsWith("#"))return Ts.URL;const t=e.replace("#","");return V(this.options.pageBlocks).find(s=>s.id===parseInt(t))?Ts.BLOCK:Ts.URL}}}},addCommands(){const{unsetLink:n}=this.parent();return{removeLink:n,applyLink:W(({commands:e,chain:t},r)=>(e.setMeta("preventAutolink",!0),e.getSelectedText()?t().applyMark(this.name,r).expandSelectionToLink().command(({tr:i})=>(r.text&&i.insertText(r.text,i.selection.from,i.selection.to),!0)).run():e.insertContent(qy.text(r.text,[qy.mark(be.LINK,r)])))),expandSelectionToLink:W(({commands:e})=>{e.expandSelection(({node:t})=>this.type.isInSet(t.marks))}),isLink:W(({commands:e})=>e.hasMark(this.name)),getLinkPreset:W(()=>me(()=>V(this.options.preset)))}},addProseMirrorPlugins(){return[...this.parent(),oM.create(this.editor)]},renderHTML({HTMLAttributes:n}){const e=n.destination===Ts.BLOCK?`#${n.href}`:n.href,t=V(this.options.basePresetClass)+V(this.options.preset).id;return["a",{href:e,target:n.target,class:`${t} zw-style`},0]}}),vN=Rt.create({name:be.SUPERSCRIPT,addCommands(){return{applySuperscript:W(({commands:n})=>{n.setMark(this.name)}),removeSuperscript:W(({commands:n})=>{n.unsetMark(this.name)}),toggleSuperscript:W(({commands:n})=>{V(n.isSuperscript())?n.removeSuperscript():n.applySuperscript()}),isSuperscript:W(({commands:n})=>{const e=n.getMark(this.name);return me(()=>!!V(e))})}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs:n=>n!=="super"?!1:null}]},renderHTML(){return["sup",{class:"zw-superscript"},0]}}),SN=Re.create({name:be.MARGIN,addGlobalAttributes:()=>[{types:[Me.PARAGRAPH,Me.HEADING],attributes:{[be.MARGIN]:{isRequired:!1,parseHTML(n){const{margin:e,marginTop:t,marginRight:r,marginBottom:i,marginLeft:s}=n.style;return[e,t,r,i,s].some(c=>!!c)?e?{value:e}:{value:[t||0,r||0,i||0,s||0].join(" ")}:null},renderHTML(n){return n.margin?Sl({margin:n.margin.value}):null}}}}]});function xN(n){const e=r=>n.presetsRef.value.find(i=>i.id===r),t=Ec({default:null,link:null});return o5(n.presetsRef,()=>{t.default=e(n.defaultPresetId),t.link=e(n.linkPresetId)},{immediate:!0,deep:!0}),YI().concat([ZI.configure({presets:n.presetsRef,defaultId:n.defaultPresetId,styleRenderer:new TN({baseClass:n.basePresetClass,makeVariable:n.makePresetVariable,linkPresetId:n.linkPresetId})}),dN.configure({baseClass:n.baseListClass,presetClass:n.basePresetClass+n.defaultPresetId}),rN.configure({device:n.deviceRef}),eN.configure({minSize:n.minFontSize,maxSize:n.maxFontSize,wrapperRef:n.wrapperRef}),XI.configure({fonts:n.fonts,defaultPreset:bi(t,"default"),defaultFont:n.defaultFont}),QI,tN,nN,iN,sN,oN,vN,aN,lN.configure({wrapperRef:n.wrapperRef}),wN.configure({preset:bi(t,"link"),basePresetClass:n.basePresetClass,pageBlocks:n.pageBlocksRef}),SN])}class CN{_domParser=new DOMParser;types=window;parse(e){return this._domParser.parseFromString(e,"text/html")}}class Uy{content;constructor({content:e}){this.content=e}normalize(){throw new Error("Implement abstract method")}}class wn extends Uy{static BLOCK_NODE_NAMES=["P","H1","H2","H3","H4"];static ROOT_NODE_NAMES=wn.BLOCK_NODE_NAMES.concat("UL","OL");static BLOCK_STYLES=["text-align","line-height","margin","margin-top","margin-bottom","margin-left","margin-right"];_parser;constructor({content:e,parser:t}){super({content:e}),this._parser=t,this.dom=null}normalize(){return this.normalizeHTML(),this.normalizedHTML}normalizeHTML(){this.dom=this._parser.parse(this.content.replace(/(\r)?\n/g,"")),this._removeComments(),this._normalizeRootTags(),this._iterateNodes(this._normalizeBreakLines,e=>e.tagName==="BR"),this._iterateNodes(this._removeEmptyNodes,this._isBlockNode),this._iterateNodes(this._normalizeListItems,e=>e.tagName==="LI"),this._normalizeBlockTextDecoration(),this._normalizeBlockBackgroundColor()}get normalizedHTML(){return this.dom.body.innerHTML}get _NodeFilter(){return this._parser.types.NodeFilter}get _Node(){return this._parser.types.Node}_removeComments(){const e=this._createNodeIterator(this._NodeFilter.SHOW_COMMENT);this._runIterator(e,t=>t.remove())}_normalizeRootTags(){const e=Array.from(this.dom.body.childNodes),t=this.dom.createDocumentFragment();let r;for(const i of e){if(this._isRootNode(i)){t.append(i),r=null;continue}r||(r=this.dom.createElement("p"),t.append(r)),r.append(i)}this.dom.body.innerHTML="",this.dom.body.append(t)}_createNodeIterator(e,t){return this.dom.createNodeIterator(this.dom.body,e,t)}_iterateNodes(e,t=()=>!0){const r=s=>s.tagName!=="BODY"&&t.call(this,s),i=this._createNodeIterator(this._NodeFilter.SHOW_ELEMENT,{acceptNode:s=>r(s)?this._NodeFilter.FILTER_ACCEPT:this._NodeFilter.FILTER_REJECT});this._runIterator(i,e)}_runIterator(e,t){let r=e.nextNode();for(;r;)t.call(this,r),r=e.nextNode()}_removeEmptyNodes(e){e.innerHTML.trim()||e.remove()}_normalizeListItems(e){const t=this.dom.createDocumentFragment(),r=Array.from(e.childNodes);let i,s;const a=u=>{this._assignElementProperties(u,e,wn.BLOCK_STYLES),t.append(u)};this._assignElementProperties(e,e.parentElement,wn.BLOCK_STYLES);for(const u of r){if(this._isBlockNode(u)){a(u),i=null,s=u;continue}if(u.tagName==="BR"&&s&&s?.tagName!=="BR"){u.remove(),s=u;continue}if(u.tagName==="BR"){const c=this.dom.createElement("p");c.append(u),a(c),i=null,s=u;continue}i||(i=this.dom.createElement("p"),a(i)),i.append(u),s=u}e.append(t),this._removeStyleProperties(e,wn.BLOCK_STYLES),this._removeStyleProperties(e.parentElement,wn.BLOCK_STYLES),this._assignElementProperties(e,e.parentElement),e.parentElement.lastElementChild===e&&this._removeStyleProperties(e.parentElement)}_isBlockNode(e){return wn.BLOCK_NODE_NAMES.includes(e.tagName)}_isRootNode(e){return wn.ROOT_NODE_NAMES.includes(e.tagName)}_assignElementProperties(e,t,r=Array.from(t.style)){for(const i of r){const s=t.style.getPropertyValue(i);s&&!e.style.getPropertyValue(i)&&e.style.setProperty(i,s)}}_removeStyleProperties(e,t=Array.from(e.style)){for(const r of t)e.style.removeProperty(r);e.style.length===0&&e.removeAttribute("style")}_normalizeBreakLines({parentElement:e}){if(!this._isBlockNode(e)||!e.textContent)return;const t=this.dom.createDocumentFragment(),r=Array.from(e.childNodes),i=e.cloneNode(!0);i.innerHTML="";let s=i.cloneNode();const a=u=>{this._assignElementProperties(u,e,wn.BLOCK_STYLES),t.append(u)};for(const u of r){if(u.tagName==="BR"){a(s),s=i.cloneNode();continue}s.append(u)}t.append(s),e.replaceWith(t)}_normalizeBlockTextDecoration(){const e=this.dom.querySelectorAll('[style*="text-decoration"]:where(p, h1, h2, h3, h4, li)');for(const t of e)this._moveTextDecorationToChildren(t)}_moveTextDecorationToChildren(e){const t=this._parseTextDecoration(e);if(e.style.removeProperty("text-decoration-line"),e.style.removeProperty("text-decoration"),e.style.cssText||e.removeAttribute("style"),!t.none)for(const r of e.childNodes){const i=this._wrapTextNode(e,r),s=this._parseTextDecoration(i),a={underline:s.underline||t.underline,line_through:s.line_through||t.line_through};i.style.removeProperty("text-decoration-line"),i.style.removeProperty("text-decoration"),i.style.textDecoration=Object.entries(a).filter(([,u])=>u).map(([u])=>u.replace("_","-")).join(" ")}}_parseTextDecoration(e){const{textDecoration:t,textDecorationLine:r}=e.style,i=t||r||"";return{none:i.includes("none"),underline:i.includes("underline"),line_through:i.includes("line-through")}}_normalizeBlockBackgroundColor(){const e=this.dom.querySelectorAll('[style*="background-color"]:where(p, h1, h2, h3, h4, li)');for(const t of e)this._moveBackgroundColorToChildren(t)}_moveBackgroundColorToChildren(e){const t=e.style.backgroundColor;e.style.removeProperty("background-color"),e.style.cssText||e.removeAttribute("style");for(const r of e.childNodes){const i=this._wrapTextNode(e,r),s=i.style.backgroundColor||t;i.style.backgroundColor=s}}_wrapTextNode(e,t){if(t.nodeType!==this._Node.TEXT_NODE)return t;const r=this.dom.createElement("span");return r.append(t.cloneNode()),e.replaceChild(r,t),r}}class EN extends Uy{normalize(){return this._iterateNodes(this._bubbleMarks),this.content}_iterateNodes(e){this._iterateChildNodes(this.content,e)}_iterateChildNodes(e,t){for(const r of e.content)r.content&&this._iterateChildNodes(r,t),t.call(this,r)}_bubbleMarks(e){if(e.content&&e.type!==Me.LIST){for(const t of e.content)if(!this._isLink(t)&&t.marks)for(const r of t.marks.slice()){if(this._includesMark(e,r)){this._removeMark(t,r);continue}this._canBubbleMark(e,r)&&(this._removeMark(t,r),this._addMark(e,r))}}}_canBubbleMark(e,t){if(be.inlineMarks.includes(t.type)||this._includesMarkType(e,t.type))return!1;for(const r of e.content)if(!(!r.content&&e.type===Me.LIST_ITEM)&&(!r.marks||!this._includesMark(r,t)))return!1;return!0}_includesMark(e,t){return e.marks?.some(r=>Hy.isEqual(r,t))??!1}_includesMarkType(e,t){return e.marks?.some(r=>r.type===t)??!1}_isLink(e){return e.type===Me.TEXT&&this._includesMarkType(e,be.LINK)}_removeMark(e,t){if(!e.marks)return;const r=this._findMarkIndexByType(e,t.type);r>=0&&e.marks.splice(r,1),e.marks.length||delete e.marks}_addMark(e,t){this._removeMark(e,t),e.marks??=[],e.marks.push(t)}_findMarkIndexByType(e,t){return e.marks?.findIndex(r=>r.type===t)??null}}class Fl{static build(e,t={}){return typeof e=="string"?this._buildHtml(e,t):this._buildJson(e)}static _buildHtml(e,t){return new wn({content:e,parser:t.parser||new CN})}static _buildJson(e){return new EN({content:e})}static normalize(e,t={}){return Fl.build(e,t).normalize()}}class Pi{static window=globalThis.window;static use(e){this.window=e}static get document(){return this.window.document}static get body(){return this.document.body}static get head(){return this.document.head}static getComputedStyle(e){return this.window.getComputedStyle(e)}}class Eh{static build({config:e,nodeDomParser:t}){const r=xN({fonts:e.fonts,minFontSize:0,maxFontSize:0,presetsRef:na(e.presets),defaultPresetId:e.defaultPresetId,linkPresetId:e.linkPresetId,makePresetVariable:()=>"",basePresetClass:e.basePresetClass,baseListClass:e.baseListClass,deviceRef:na(Mf.DESKTOP),pageBlocksRef:na([]),wrapperRef:Pi.document.createElement("p")}),i=qT(r);return new Eh({schema:i,domParser:_s.fromSchema(i),nodeDomParser:t})}_schema;_domParser;_nodeDomParser;constructor({schema:e,domParser:t,nodeDomParser:r}){this._schema=e,this._domParser=t,this._nodeDomParser=r}toJSON(e){const t=Fl.build(e,{parser:this._nodeDomParser});return t.normalizeHTML(),this._domParser.parse(t.dom.body).toJSON()}}function kN(n,e){return n.type===e}function AN(n){return typeof n=="string"}class qy{static doc(e){return{type:De.DOCUMENT,content:e}}static list(e,t){return{type:De.LIST,attrs:{bullet:{type:e}},content:t.map(r=>kN(r,De.LIST_ITEM)?r:this.listItem([r].flat()))}}static listItem(...e){const{attrs:t,content:r,marks:i}=this.normalizeTextBlockArgs(e);return{type:De.LIST_ITEM,...t?{attrs:t}:{},...i?{marks:i}:{},content:[r].flat().map(s=>AN(s)?this.paragraph(s):s)}}static heading(e,...t){const r=this.textBlock(t);return r.attrs??={},r.attrs.level=e,{type:De.HEADING,...r}}static paragraph(...e){return{type:De.PARAGRAPH,...this.textBlock(e)}}static textBlock(e){const{attrs:t,content:r,marks:i}=this.normalizeTextBlockArgs(e);return{content:typeof r=="string"?[this.text(r)]:[r].flat(),...t?{attrs:t}:{},...i?{marks:i}:{}}}static normalizeTextBlockArgs(e){return e.length===1?{attrs:null,marks:null,content:e[0]}:e.length===2?{attrs:e[0],marks:null,content:e[1]}:{attrs:e[0],marks:e[1],content:e[2]}}static text(e,t){return{type:De.TEXT,...t?{marks:t}:{},text:e}}static link(e,t,r=[]){return this.text(e,[this.mark(Nf.LINK,t),...r])}static mark(e,t){return{type:e,attrs:t}}static populateAllDevices(e){return{mobile:e,tablet:e,desktop:e}}}class TN{_baseClass;_makeVariable;_linkPresetId;constructor({baseClass:e,makeVariable:t,linkPresetId:r}){this._baseClass=e,this._makeVariable=t,this._linkPresetId=r}inject(e,t){let r=e.querySelector("[data-zw-styles]");r||(r=Pi.document.createElement("style"),r.dataset.zwStyles="",r.innerHTML=this.render(t),e.append(r))}render(e){let t="";for(const r of e){const i=r.id===this._linkPresetId,s=this.makePresetCssClass(r);t+=` ${s} {`;for(const a of Mf.values)for(const u of Object.keys(r[a])){const c=this._makeVariable({device:a,preset:r,property:u}),h=this._makeInternalVariableName(u,a);if(t+=`${h}: var(${c}, inherit);`,i&&!be.attributes.includes(u)){const p=h.replace("preset-","");t+=`${p}: var(${h});`}}t+="}"}return t}_makeInternalVariableName(e,t){const r=e==="color"?"font-color":e.replace(/_/i,"-"),i=t===Mf.COMMON?"":`-${t}`;return`--zw-preset-${r}${i}`}makePresetHtmlClass(e){return this._baseClass+e.id}makePresetCssClass(e){return this.makePresetHtmlClass(e).split(" ").map(t=>`.${t}`).join("")}}class kh{static _instance;static get instance(){return this._instance??=new kh,this._instance}static query(e,t){return this.instance.query(e,t)}query(e,t){let r=null;return e.descendants(i=>{if(r)return!1;if(this.matchNode(i,t))return r=i,!1}),r?t.getMark?this.getMark(r,t.getMark):r:null}matchNode(e,t){return!(t.typeName&&t.typeName!==e.type.name||t.mark&&!this.getMark(e,t.mark))}getMark(e,t){return e.marks.find(r=>this.matchMark(r,t))||null}matchMark(e,t){return e.type.name===t.typeName}}class Ky{static createWindow(){return new sm.JSDOM().window}types;parse(e){const{window:t}=new sm.JSDOM(e);return this.types=t,t.document}}class Gy{name;description;argument;options=[];doCommand(){throw new Error('Command "doCommand" is required')}install(e){if(!this.name)throw new Error('Command "name" is required');let t=e.command(this.name);if(this.description&&(t=t.description(this.description)),this.argument&&(t=t.argument(this.argument)),this.options.length)for(const r of this.options)t=t.option(r.flags,r.description,r.default);t.action(this.doCommand.bind(this))}output(e){}}class ON extends Gy{name="to-json";description="migrate html to json";argument="<html...>";options=[{flags:"-c, --config <path>",description:"Generator config",default:im.resolve(__dirname,"../bin/zp.config.json")},{flags:"-f, --format <type>",description:"Set output format",default:"rb"}];doCommand(e,{config:t,format:r}){Pi.use(Ky.createWindow());const i=im.resolve(process.cwd(),t),s=Eh.build({config:require(i).editor,nodeDomParser:new Ky}),a=e.map(h=>s.toJSON(this._formatInputHtml(h))),u=a.length===1?a[0]:a,c=this._stringifyContent(u);this.output(r==="rb"?this._formatOutputRb(c):c)}_formatInputHtml(e){return e.replace(/\\(["'])/g,"$1").replace(/rgba\(\d{1,3}, ?\d{1,3}, ?\d{1,3}, (\d{1,2}%)\)/g,(t,r)=>t.replace(r,parseFloat(r)/100))}_stringifyContent(e){return JSON.stringify(e,(r,i)=>i===null?void 0:i,2)}_formatOutputRb(e){return e.replace(/\\"/g,'"').replace(/font-family: ?'(.+)'/g,'font-family: "$1"').replace(/'/g,"\\'").replace(/^[\t ]*"[^:\n\r]+(?<!\\)":/gm,t=>t.replace(/"/g,"")).replace(/: "(.+)"([,\n])/g,": '$1'$2")}}var MN="4.11.0";class IN extends Gy{name="version";description="display cli version";doCommand(){this.output(MN)}}const Jy=new GC,NN=[ON,IN];for(const n of NN)new n().install(Jy);Jy.parse();
|