@zipify/wysiwyg 4.11.0-1 → 4.11.0-2
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/dist/types/components/base/NumberField.vue.d.ts +2 -2
- package/dist/types/components/base/colorPicker/ColorPicker.vue.d.ts +2 -2
- package/dist/types/components/base/index.d.ts +13 -3
- package/dist/types/components/toolbar/controls/AlignmentControl.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/ItalicControl.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/RemoveFormatControl.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/StrikeThroughControl.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/SuperscriptControl.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/UnderlineControl.vue.d.ts +1 -1
- package/lib/components/base/index.ts +13 -0
- package/package.json +1 -1
- package/lib/components/base/index.js +0 -13
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 _e(C,j+"return "+B).apply(t,E)});if(se.source=B,Zu(se))throw se;return se}function UC(o){return we(o).toLowerCase()}function qC(o){return we(o).toUpperCase()}function KC(o,l,f){if(o=we(o),o&&(f||l===t))return cd(o);if(!o||!(l=vt(l)))return o;var d=en(o),b=en(l),C=fd(d,b),E=hd(d,b)+1;return or(d,C,E).join("")}function GC(o,l,f){if(o=we(o),o&&(f||l===t))return o.slice(0,pd(o)+1);if(!o||!(l=vt(l)))return o;var d=en(o),b=hd(d,en(l))+1;return or(d,0,b).join("")}function JC(o,l,f){if(o=we(o),o&&(f||l===t))return o.replace(Zl,"");if(!o||!(l=vt(l)))return o;var d=en(o),b=fd(d,en(l));return or(d,b).join("")}function jC(o,l){var f=te,d=Ce;if(Me(l)){var b="separator"in l?l.separator:b;f="length"in l?ie(l.length):f,d="omission"in l?vt(l.omission):d}o=we(o);var C=o.length;if(ii(o)){var E=en(o);C=E.length}if(f>=C)return o;var O=f-si(d);if(O<1)return d;var I=E?or(E,0,O).join(""):o.slice(0,O);if(b===t)return I+d;if(E&&(O+=I.length-O),Qu(b)){if(o.slice(O).search(b)){var P,D=I;for(b.global||(b=mu(b.source,we(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(vt(b),O)!=O){var q=I.lastIndexOf(b);q>-1&&(I=I.slice(0,q))}return I+d}function YC(o){return o=we(o),o&&ab.test(o)?o.replace(Oh,v2):o}var XC=hi(function(o,l,f){return o+(f?" ":"")+l.toUpperCase()}),nc=np("toUpperCase");function em(o,l,f){return o=we(o),l=f?t:l,l===t?w2(o)?T2(o):f2(o):o.match(l)||[]}var tm=ae(function(o,l){try{return Ct(o,t,l)}catch(f){return Zu(f)?f:new ne(f)}}),ZC=On(function(o,l){return Bt(l,function(f){f=dn(f),An(o,f,Yu(o[f],o))}),o});function QC(o){var l=o==null?0:o.length,f=Y();return o=l?Te(o,function(d){if(typeof d[1]!="function")throw new zt(a);return[f(d[0]),d[1]]}):[],ae(function(d){for(var b=-1;++b<l;){var C=o[b];if(Ct(C[0],this,d))return Ct(C[1],this,d)}})}function eE(o){return v_(Ht(o,m))}function rc(o){return function(){return o}}function tE(o,l){return o==null||o!==o?l:o}var nE=ip(),rE=ip(!0);function mt(o){return o}function ic(o){return Ld(typeof o=="function"?o:Ht(o,m))}function iE(o){return Dd(Ht(o,m))}function sE(o,l){return Fd(o,Ht(l,m))}var oE=ae(function(o,l){return function(f){return ns(f,o,l)}}),aE=ae(function(o,l){return function(f){return ns(o,f,l)}});function sc(o,l,f){var d=Ve(l),b=xo(l,d);f==null&&!(Me(l)&&(b.length||!d.length))&&(f=l,l=o,o=this,b=xo(l,Ve(l)));var C=!(Me(f)&&"chain"in f)||!!f.chain,E=In(o);return Bt(b,function(O){var I=l[O];o[O]=I,E&&(o.prototype[O]=function(){var P=this.__chain__;if(C||P){var D=o(this.__wrapped__),B=D.__actions__=ht(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 lE(){return Xe._===this&&(Xe._=L2),this}function oc(){}function uE(o){return o=ie(o),ae(function(l){return Bd(l,o)})}var cE=Fu(Te),fE=Fu(sd),hE=Fu(lu);function nm(o){return Uu(o)?uu(dn(o)):W_(o)}function dE(o){return function(l){return o==null?t:Rr(o,l)}}var pE=op(),mE=op(!0);function ac(){return[]}function lc(){return!1}function gE(){return{}}function yE(){return""}function bE(){return!0}function _E(o,l){if(o=ie(o),o<1||o>Xn)return[];var f=xt,d=nt(o,xt);l=Y(l),o-=xt;for(var b=hu(d,l);++f<o;)l(f);return b}function wE(o){return re(o)?Te(o,dn):kt(o)?[o]:ht(xp(we(o)))}function SE(o){var l=++N2;return we(o)+l}var xE=To(function(o,l){return o+l},0),CE=Bu("ceil"),EE=To(function(o,l){return o/l},1),vE=Bu("floor");function kE(o){return o&&o.length?So(o,mt,Cu):t}function AE(o,l){return o&&o.length?So(o,Y(l,2),Cu):t}function TE(o){return ld(o,mt)}function OE(o,l){return ld(o,Y(l,2))}function ME(o){return o&&o.length?So(o,mt,Au):t}function IE(o,l){return o&&o.length?So(o,Y(l,2),Au):t}var NE=To(function(o,l){return o*l},1),RE=Bu("round"),LE=To(function(o,l){return o-l},0);function PE(o){return o&&o.length?fu(o,mt):0}function DE(o,l){return o&&o.length?fu(o,Y(l,2)):0}return w.after=ix,w.ary=Rp,w.assign=qx,w.assignIn=Gp,w.assignInWith=Ho,w.assignWith=Kx,w.at=Gx,w.before=Lp,w.bind=Yu,w.bindAll=ZC,w.bindKey=Pp,w.castArray=gx,w.chain=Mp,w.chunk=vw,w.compact=kw,w.concat=Aw,w.cond=QC,w.conforms=eE,w.constant=rc,w.countBy=PS,w.create=Jx,w.curry=Dp,w.curryRight=Fp,w.debounce=Bp,w.defaults=jx,w.defaultsDeep=Yx,w.defer=sx,w.delay=ox,w.difference=Tw,w.differenceBy=Ow,w.differenceWith=Mw,w.drop=Iw,w.dropRight=Nw,w.dropRightWhile=Rw,w.dropWhile=Lw,w.fill=Pw,w.filter=FS,w.flatMap=$S,w.flatMapDeep=HS,w.flatMapDepth=WS,w.flatten=kp,w.flattenDeep=Dw,w.flattenDepth=Fw,w.flip=ax,w.flow=nE,w.flowRight=rE,w.fromPairs=Bw,w.functions=rC,w.functionsIn=iC,w.groupBy=VS,w.initial=$w,w.intersection=Hw,w.intersectionBy=Ww,w.intersectionWith=Vw,w.invert=oC,w.invertBy=aC,w.invokeMap=qS,w.iteratee=ic,w.keyBy=KS,w.keys=Ve,w.keysIn=pt,w.map=Po,w.mapKeys=uC,w.mapValues=cC,w.matches=iE,w.matchesProperty=sE,w.memoize=Fo,w.merge=fC,w.mergeWith=Jp,w.method=oE,w.methodOf=aE,w.mixin=sc,w.negate=Bo,w.nthArg=uE,w.omit=hC,w.omitBy=dC,w.once=lx,w.orderBy=GS,w.over=cE,w.overArgs=ux,w.overEvery=fE,w.overSome=hE,w.partial=Xu,w.partialRight=zp,w.partition=JS,w.pick=pC,w.pickBy=jp,w.property=nm,w.propertyOf=dE,w.pull=Gw,w.pullAll=Tp,w.pullAllBy=Jw,w.pullAllWith=jw,w.pullAt=Yw,w.range=pE,w.rangeRight=mE,w.rearg=cx,w.reject=XS,w.remove=Xw,w.rest=fx,w.reverse=Ju,w.sampleSize=QS,w.set=gC,w.setWith=yC,w.shuffle=ex,w.slice=Zw,w.sortBy=rx,w.sortedUniq=sS,w.sortedUniqBy=oS,w.split=$C,w.spread=hx,w.tail=aS,w.take=lS,w.takeRight=uS,w.takeRightWhile=cS,w.takeWhile=fS,w.tap=kS,w.throttle=dx,w.thru=Lo,w.toArray=Up,w.toPairs=Yp,w.toPairsIn=Xp,w.toPath=wE,w.toPlainObject=Kp,w.transform=bC,w.unary=px,w.union=hS,w.unionBy=dS,w.unionWith=pS,w.uniq=mS,w.uniqBy=gS,w.uniqWith=yS,w.unset=_C,w.unzip=ju,w.unzipWith=Op,w.update=wC,w.updateWith=SC,w.values=mi,w.valuesIn=xC,w.without=bS,w.words=em,w.wrap=mx,w.xor=_S,w.xorBy=wS,w.xorWith=SS,w.zip=xS,w.zipObject=CS,w.zipObjectDeep=ES,w.zipWith=vS,w.entries=Yp,w.entriesIn=Xp,w.extend=Gp,w.extendWith=Ho,sc(w,w),w.add=xE,w.attempt=tm,w.camelCase=kC,w.capitalize=Zp,w.ceil=CE,w.clamp=CC,w.clone=yx,w.cloneDeep=_x,w.cloneDeepWith=wx,w.cloneWith=bx,w.conformsTo=Sx,w.deburr=Qp,w.defaultTo=tE,w.divide=EE,w.endsWith=AC,w.eq=nn,w.escape=TC,w.escapeRegExp=OC,w.every=DS,w.find=BS,w.findIndex=Ep,w.findKey=Xx,w.findLast=zS,w.findLastIndex=vp,w.findLastKey=Zx,w.floor=vE,w.forEach=Ip,w.forEachRight=Np,w.forIn=Qx,w.forInRight=eC,w.forOwn=tC,w.forOwnRight=nC,w.get=ec,w.gt=xx,w.gte=Cx,w.has=sC,w.hasIn=tc,w.head=Ap,w.identity=mt,w.includes=US,w.indexOf=zw,w.inRange=EC,w.invoke=lC,w.isArguments=Dr,w.isArray=re,w.isArrayBuffer=Ex,w.isArrayLike=dt,w.isArrayLikeObject=Le,w.isBoolean=vx,w.isBuffer=ar,w.isDate=kx,w.isElement=Ax,w.isEmpty=Tx,w.isEqual=Ox,w.isEqualWith=Mx,w.isError=Zu,w.isFinite=Ix,w.isFunction=In,w.isInteger=$p,w.isLength=zo,w.isMap=Hp,w.isMatch=Nx,w.isMatchWith=Rx,w.isNaN=Lx,w.isNative=Px,w.isNil=Fx,w.isNull=Dx,w.isNumber=Wp,w.isObject=Me,w.isObjectLike=Ie,w.isPlainObject=us,w.isRegExp=Qu,w.isSafeInteger=Bx,w.isSet=Vp,w.isString=$o,w.isSymbol=kt,w.isTypedArray=pi,w.isUndefined=zx,w.isWeakMap=$x,w.isWeakSet=Hx,w.join=Uw,w.kebabCase=MC,w.last=Vt,w.lastIndexOf=qw,w.lowerCase=IC,w.lowerFirst=NC,w.lt=Wx,w.lte=Vx,w.max=kE,w.maxBy=AE,w.mean=TE,w.meanBy=OE,w.min=ME,w.minBy=IE,w.stubArray=ac,w.stubFalse=lc,w.stubObject=gE,w.stubString=yE,w.stubTrue=bE,w.multiply=NE,w.nth=Kw,w.noConflict=lE,w.noop=oc,w.now=Do,w.pad=RC,w.padEnd=LC,w.padStart=PC,w.parseInt=DC,w.random=vC,w.reduce=jS,w.reduceRight=YS,w.repeat=FC,w.replace=BC,w.result=mC,w.round=RE,w.runInContext=M,w.sample=ZS,w.size=tx,w.snakeCase=zC,w.some=nx,w.sortedIndex=Qw,w.sortedIndexBy=eS,w.sortedIndexOf=tS,w.sortedLastIndex=nS,w.sortedLastIndexBy=rS,w.sortedLastIndexOf=iS,w.startCase=HC,w.startsWith=WC,w.subtract=LE,w.sum=PE,w.sumBy=DE,w.template=VC,w.times=_E,w.toFinite=Nn,w.toInteger=ie,w.toLength=qp,w.toLower=UC,w.toNumber=Ut,w.toSafeInteger=Ux,w.toString=we,w.toUpper=qC,w.trim=KC,w.trimEnd=GC,w.trimStart=JC,w.truncate=jC,w.unescape=YC,w.uniqueId=SE,w.upperCase=XC,w.upperFirst=nc,w.each=Ip,w.eachRight=Np,w.first=Ap,sc(w,function(){var o={};return fn(w,function(l,f){xe.call(w.prototype,f)||(o[f]=l)}),o}(),{chain:!1}),w.VERSION=r,Bt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(o){w[o].placeholder=w}),Bt(["drop","take"],function(o,l){ce.prototype[o]=function(f){f=f===t?1:ze(ie(f),0);var d=this.__filtered__&&!l?new ce(this):this.clone();return d.__filtered__?d.__takeCount__=nt(f,d.__takeCount__):d.__views__.push({size:nt(f,xt),type:o+(d.__dir__<0?"Right":"")}),d},ce.prototype[o+"Right"]=function(f){return this.reverse()[o](f).reverse()}}),Bt(["filter","map","takeWhile"],function(o,l){var f=l+1,d=f==Dt||f==We;ce.prototype[o]=function(b){var C=this.clone();return C.__iteratees__.push({iteratee:Y(b,3),type:f}),C.__filtered__=C.__filtered__||d,C}}),Bt(["head","last"],function(o,l){var f="take"+(l?"Right":"");ce.prototype[o]=function(){return this[f](1).value()[0]}}),Bt(["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(mt)},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 ns(f,o,l)})}),ce.prototype.reject=function(o){return this.filter(Bo(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],C=d||/^find/.test(l);b&&(w.prototype[l]=function(){var E=this.__wrapped__,O=d?[1]:arguments,I=E instanceof ce,P=O[0],D=I||re(E),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=C&&!q,se=I&&!j;if(!C&&D){E=se?E:new ce(this);var Z=o.apply(E,O);return Z.__actions__.push({func:Lo,args:[B],thisArg:t}),new $t(Z,q)}return X&&se?o.apply(this,O):(Z=this.thru(B),X?d?Z.value()[0]:Z.value():Z)})}),Bt(["pop","push","shift","sort","splice","unshift"],function(o){var l=so[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 C=this.value();return l.apply(re(C)?C:[],b)}return this[f](function(E){return l.apply(re(E)?E:[],b)})}}),fn(ce.prototype,function(o,l){var f=w[l];if(f){var d=f.name+"";xe.call(ui,d)||(ui[d]=[]),ui[d].push({name:l,func:f})}}),ui[Ao(t,g).name]=[{name:"wrapper",func:t}],ce.prototype.clone=Y2,ce.prototype.reverse=X2,ce.prototype.value=Z2,w.prototype.at=AS,w.prototype.chain=TS,w.prototype.commit=OS,w.prototype.next=MS,w.prototype.plant=NS,w.prototype.reverse=RS,w.prototype.toJSON=w.prototype.valueOf=w.prototype.value=LS,w.prototype.first=w.prototype.head,ji&&(w.prototype[ji]=IS),w},oi=O2();Tr?((Tr.exports=oi)._=oi,iu._=oi):Xe._=oi}).call($I)}(Vs,Vs.exports)),Vs.exports}var Wy=HI();function bh(n){return n.type.create(Wy.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 WI=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)=>ge(()=>{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(an.SETTINGS))return e.setMark(t,r);if(c.pos===h.pos)return;const _=x=>{if(!i.onAppliedToParent||i.onAppliedToParent(x)===!1){const{tr:v,node:N,position:g,mark:S}=x;_h({tr:v,node:N,position:g,mark:S.type})}};a.nodesBetween(c.pos,h.pos,(x,v)=>{if(x.type.name===me.LIST)return;const N=zI(x.marks,t),g=m.create({...N?.attrs||{},...r}),S=zy(c,h,x,v);if(!p.isInSet(x.marks)&&BI(s.doc,v,g,i.isAppliedToParent))return _({tr:s,node:x,position:v,mark:g});if(x.isText){s.addMark(S.from,S.to,g);return}DI(s.doc,s.selection,x,v)&&s.addNodeMark(v,g)})}),getMarks:W(({editor:n},e)=>{const t=_i(n,"state");return ge(()=>{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 ge(()=>V(t)[0]??null)}),hasMark:W(({commands:n},e)=>{const t=n.getMark(e);return ge(()=>!!V(t))}),getCommonSettingMark:W(({commands:n},e,t)=>{const r=n.getMark(e);return ge(()=>V(r)?.value??V(t))}),getDeviceSettingMark:W(({commands:n},e,t)=>{const r=n.getMarks(e),i=n.getDevice();return ge(()=>{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})})})}}}),VI=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=zy(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)})})}}}),UI=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;n.doc.nodesBetween(r,i,(s,a,u)=>{if(t({node:s,parent:u})){const c=s.isText?0:$y(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===me.DOCUMENT)})}}}),qI=Yn.create({name:"doc",topNode:!0,content:"block+"});class Gs extends Ue{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=dr.fromJSON(this.schema,e.toJSON());return t.attrs.meta[this.key]=this.value,De.ok(t)}invert(){return new Gs(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 Gs(e.key,e.value,e.stepType)}}Ue.jsonID("setDocAttr",Gs);const KI=qI.extend({marks:an.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 Gs(e,t,n.schema))})}}}),GI=Yn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",Ii(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),JI=GI.extend({marks:an.ALL,addOptions:()=>({HTMLAttributes:{class:"zw-style"}})}),jI=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]}`,Ii(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=>_O({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),YI=jI.extend({marks:an.ALL,addOptions:()=>({levels:[1,2,3,4],HTMLAttributes:{class:"zw-style"}})}),XI=Re.create({name:"prose_mirror_plugins",addProseMirrorPlugins(){return[WO.create(this.editor),VO.create(this.editor)]}}),ZI=()=>[KI,JI,YI,xO,NO,WI,VI,UI,XI],QI=Nt.create({name:be.FONT_FAMILY,group:an.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 ge(()=>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 ge(()=>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})}}),eN=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(()=>ge(()=>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 ge(()=>{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=_i(t,"state");return ge(()=>{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 ge(()=>V(i)[s]?.includes(r)??!1)}),getContentCustomization:W(({editor:t,commands:r})=>{const i=_i(t,"state");return ge(()=>{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(Di.head,V(this.options.presets))}}),tN=Nt.create({name:be.FONT_WEIGHT,group:an.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 ge(()=>{const r=V(e),i=V(t);return i.isWeightSupported(r)?r:i.findClosestWeight(r)})}),getDefaultFontWeight:W(({commands:n})=>{const e=n.getPreset();return ge(()=>V(e).common.font_weight)})}},addKeyboardShortcuts:()=>({"Mod-b":Yt("toggleBold"),"Mod-B":Yt("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})}}),nN=Nt.create({name:be.FONT_SIZE,group:an.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 ge(()=>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-=":Yt("increaseFontSize"),"Mod-Shift--":Yt("decreaseFontSize")}),parseHTML(){const n=e=>{if(!e)return null;const t=V(this.options.wrapperRef),r=By(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)})}}),rN=Nt.create({name:be.FONT_COLOR,group:an.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 ge(()=>V(e).common.color)}),applyFontColor:W(({commands:n},e)=>{n.applyMark(this.name,{value:e})})}},parseHTML(){const n=e=>({value:Fy(e)});return[{style:"--zw-font-color",getAttrs:n},{style:"color",getAttrs:n}]},renderHTML({HTMLAttributes:n}){return jr({font_color:n.value})}}),iN=Nt.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:Fy(e)});return[{style:"--zw-background-color",getAttrs:n},{style:"background-color",getAttrs:n}]},renderHTML({HTMLAttributes:n}){return jr({background_color:n.value})}}),sN=Re.create({name:"device_manager",addCommands(){return{getDevice:W(()=>_i(this.options,"device"))}}}),oN=Nt.create({name:be.FONT_STYLE,group:an.SETTINGS,addAttributes:()=>({italic:{required:!0}}),addCommands(){return{isItalic:W(({commands:n})=>{const e=n.getMark(this.name),t=n.getDefaultFontStyle();return ge(()=>V(e)?.italic??V(t).italic)}),isItalicAvailable:W(({commands:n})=>{const e=n.getFont(),t=n.getFontWeight();return ge(()=>{const r=V(e),i=V(t);return r.isItalicSupported(i)&&!r.isWeightItalicOnly(i)})}),getDefaultFontStyle:W(({commands:n})=>{const e=n.getPreset();return ge(()=>({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":Yt("toggleItalic"),"Mod-I":Yt("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})}}),aN=Nt.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 ge(()=>V(e).underline)}),isStrikeThrough:W(({commands:n})=>{const e=n.getTextDecoration();return ge(()=>V(e).strike_through)}),getTextDecoration:W(({commands:n})=>{const e=n.getMark(this.name),t=n.getDefaultTextDecoration();return ge(()=>{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 ge(()=>V(e)!==V(t).underline)}),getDefaultTextDecoration:W(({commands:n})=>{const e=n.getPreset();return ge(()=>{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":Yt("toggleUnderline"),"Mod-U":Yt("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(" ")})}}),lN=Re.create({name:"case_style",addCommands(){return{applyCaseStyle:W(({commands:n},e)=>{switch(e){case Nf.CAPITALIZE:return n.applyCapitalize();case Nf.LOWERCASE:return n.applyLowerCase();case Nf.UPPERCASE:return n.applyUpperCase()}}),applyCapitalize:W(({commands:n})=>{n.transformText(({text:e})=>uM(e))}),applyLowerCase:W(({commands:n})=>{n.transformText(({text:e})=>e.toLowerCase())}),applyUpperCase:W(({commands:n})=>{n.transformText(({text:e})=>e.toUpperCase())})}}}),Vy={mobile:null,tablet:null,desktop:null},uN=Re.create({name:be.ALIGNMENT,addGlobalAttributes:()=>[{types:[me.PARAGRAPH,me.HEADING],attributes:{[be.ALIGNMENT]:{isRequired:!1,parseHTML({style:n}){const e=PI(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?Cl({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},Vy)}),removeAlignment:W(({commands:n})=>n.removeBlockAttributes(this.name)),getAlignment:W(({commands:n})=>{const e=n.getBlockAttributes(this.name,Vy),t=n.getDevice(),r=n.getDefaultAlignment();return ge(()=>V(e)?.[V(t)]??V(r))}),getDefaultAlignment:W(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return ge(()=>V(t)[V(e)].alignment??Sr.LEFT)})}},addKeyboardShortcuts:()=>({"Mod-Shift-l":Yt("applyAlignment",Sr.LEFT),"Mod-Shift-e":Yt("applyAlignment",Sr.CENTER),"Mod-Shift-r":Yt("applyAlignment",Sr.RIGHT),"Mod-Shift-j":Yt("applyAlignment",Sr.JUSTIFY)})}),Uy={mobile:null,tablet:null,desktop:null},cN=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=RI(e,n,t);return r?{desktop:r,tablet:r,mobile:null}:null},renderHTML(n){return n.line_height?Cl({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,Uy),t=n.getDevice(),r=n.getDefaultLineHeight();return ge(()=>V(e)?.[V(t)]??V(r))}),getDefaultLineHeight:W(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return ge(()=>V(t)[V(e)].line_height)}),applyLineHeight:W(({commands:n},e)=>{const t=V(n.getDevice());n.setBlockAttributes(this.name,{[t]:e},Uy)})}}}),fN=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",Ii(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)}}}),hN=fN.extend({name:me.LIST_ITEM,marks:an.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 dN(n,e){if(be.inlineMarks.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 pN({doc:n,selection:e}){const t=e.$from.start(),r=e.$to.end();n.nodesBetween(t,r,(i,s)=>{if(i.type.name===me.LIST)return;if(i.type.name!==me.LIST_ITEM)return!1;const a=[];return i.forEach(u=>{for(const c of u.marks){if(c.isInSet(a)){tr.removeNodeMark(s+1,c);continue}dN(i,c)&&(tr.removeNodeMark(s+1,c),tr.addNodeMark(s,bh(c)),a.push(c))}}),!1})}const mN=Yn.create({name:me.LIST,content:`${me.LIST_ITEM}+`,group:"block list",marks:an.SETTINGS,addExtensions:()=>[hN],addOptions:()=>({baseClass:"",presetClass:""}),addAttributes:()=>({bullet:{default:{type:Gt.DISC}}}),parseHTML(){const n={a:Gt.ROMAN,i:Gt.LATIN,1:Gt.DECIMAL},e=t=>{for(const r of Gt.values){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)||Gt.DECIMAL}})},{tag:"ul",getAttrs:t=>({bullet:{type:e(t)||Gt.DISC}})}]},renderHTML({HTMLAttributes:n}){const e=[V(this.options.baseClass)+n.bullet.type,V(this.options.presetClass)];return[Gt.ordered.includes(n.bullet.type)?"ol":"ul",{class:e.join(" ")},0]},addCommands(){return{getListType:W(({commands:n})=>{const e=n.getBlockAttributes("bullet",{type:null});return ge(()=>V(e).type??null)}),applyList:W(({commands:n,chain:e},t)=>V(n.getListType())===t?n.removeList():e().applyDefaultPreset().toggleList(me.LIST,me.LIST_ITEM).setBlockAttributes("bullet",{type:t}).command(({tr:i})=>pN(i)).run()),removeList:W(({chain:n})=>n().command(({tr:e,commands:t})=>{const r=e.selection.$from.start(),i=e.selection.$to.end();let s;return e.doc.nodesBetween(r,i,(a,u,c)=>{if(a.isText&&!s&&(s=u),[me.LIST,me.LIST_ITEM].includes(a.type.name))return;if(c.type.name!==me.LIST_ITEM)return!1;const h=c.marks.filter(p=>!p.type.isInSet(a.marks));for(const p of h)e.addNodeMark(u,bh(p));return!1}),t.setTextSelection({from:s,to:i})}).liftListItem(me.LIST_ITEM).run())}},addInputRules(){const n=(e,t)=>wO({find:t,type:this.type,getAttributes:{bullet:{type:e}},joinPredicate:(r,{attrs:i})=>i.bullet.type===e});return[n(Gt.DISC,/^\s*([-+*])\s$/),n(Gt.DECIMAL,/^(\d+)\.\s$/),n(Gt.LATIN,/^([ivx]{1,3})\.\s$/i),n(Gt.ROMAN,/^([a-z])\.\s$/i)]}});function gN(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function yN(n){return new ct({key:new Mt("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=WT(t.doc,[...e]);if(XT(u).forEach(({newRange:h})=>{const p=UT(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 x=_[_.length-1],v=m.pos+y.lastIndexOf(x);if(!x)return!1;const N=xl(x).map(g=>g.toObject(n.defaultProtocol));if(!gN(N))return!1;N.filter(g=>g.isLink).map(g=>({...g,from:v+g.start+1,to:v+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(S=>S.mark.type===n.type)||a.addMark(g.from,g.to,n.type.create({href:g.href}))})}}),!!a.steps.length)return a}})}function bN(n){return new ct({key:new Mt("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=JT(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 _N(n){return new ct({key:new Mt("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=F1(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 wN=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function Zr(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(wN,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const SN=Nt.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"){D1(n);return}D1(n.scheme,n.optionalSlashes)})},onDestroy(){sM()},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)=>!!Zr(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=>!!Zr(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=>!!Zr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Ii(this.options.HTMLAttributes,n),0]:["a",Ii(this.options.HTMLAttributes,{...n,href:""}),0]},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!Zr(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=>!!Zr(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[SO({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,i=F1(n).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:a=>!!Zr(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(yN({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Zr(i,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&n.push(bN({type:this.type})),this.options.linkOnPaste&&n.push(_N({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),n}}),xN=SN.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:w1.SELF,parseHTML:n=>n.getAttribute("target")||w1.SELF},destination:{default:Os.URL,parseHTML:n=>{const e=n.getAttribute("href");if(!e.startsWith("#"))return Os.URL;const t=e.replace("#","");return V(this.options.pageBlocks).find(s=>s.id===parseInt(t))?Os.BLOCK:Os.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(Ky.text(r.text,[Ky.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(()=>ge(()=>V(this.options.preset)))}},addProseMirrorPlugins(){return[...this.parent(),lM.create(this.editor)]},renderHTML({HTMLAttributes:n}){const e=n.destination===Os.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]}}),CN=Nt.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 ge(()=>!!V(e))})}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs:n=>n!=="super"?!1:null}]},renderHTML(){return["sup",{class:"zw-superscript"},0]}}),EN=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?Cl({margin:n.margin.value}):null}}}}]});function vN(n){const e=r=>n.presetsRef.value.find(i=>i.id===r),t=kc({default:null,link:null});return a5(n.presetsRef,()=>{t.default=e(n.defaultPresetId),t.link=e(n.linkPresetId)},{immediate:!0,deep:!0}),ZI().concat([eN.configure({presets:n.presetsRef,defaultId:n.defaultPresetId,styleRenderer:new MN({baseClass:n.basePresetClass,makeVariable:n.makePresetVariable,linkPresetId:n.linkPresetId})}),mN.configure({baseClass:n.baseListClass,presetClass:n.basePresetClass+n.defaultPresetId}),sN.configure({device:n.deviceRef}),nN.configure({minSize:n.minFontSize,maxSize:n.maxFontSize,wrapperRef:n.wrapperRef}),QI.configure({fonts:n.fonts,defaultPreset:_i(t,"default"),defaultFont:n.defaultFont}),tN,rN,iN,oN,aN,lN,CN,uN,cN.configure({wrapperRef:n.wrapperRef}),xN.configure({preset:_i(t,"link"),basePresetClass:n.basePresetClass,pageBlocks:n.pageBlocksRef}),EN])}class kN{_domParser=new DOMParser;types=window;parse(e){return this._domParser.parseFromString(e,"text/html")}}class qy{content;constructor({content:e}){this.content=e}normalize(){throw new Error("Implement abstract method")}}class _n extends qy{static BLOCK_NODE_NAMES=["P","H1","H2","H3","H4"];static ROOT_NODE_NAMES=_n.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,_n.BLOCK_STYLES),t.append(u)};this._assignElementProperties(e,e.parentElement,_n.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,_n.BLOCK_STYLES),this._removeStyleProperties(e.parentElement,_n.BLOCK_STYLES),this._assignElementProperties(e,e.parentElement),e.parentElement.lastElementChild===e&&this._removeStyleProperties(e.parentElement)}_isBlockNode(e){return _n.BLOCK_NODE_NAMES.includes(e.tagName)}_isRootNode(e){return _n.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,_n.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 AN extends qy{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=>Wy.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 Bl{static build(e,t={}){return typeof e=="string"?this._buildHtml(e,t):this._buildJson(e)}static _buildHtml(e,t){return new _n({content:e,parser:t.parser||new kN})}static _buildJson(e){return new AN({content:e})}static normalize(e,t={}){return Bl.build(e,t).normalize()}}class Di{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 vh{static build({config:e,nodeDomParser:t}){const r=vN({fonts:e.fonts,minFontSize:0,maxFontSize:0,presetsRef:ra(e.presets),defaultPresetId:e.defaultPresetId,linkPresetId:e.linkPresetId,makePresetVariable:()=>"",basePresetClass:e.basePresetClass,baseListClass:e.baseListClass,deviceRef:ra(If.DESKTOP),pageBlocksRef:ra([]),wrapperRef:Di.document.createElement("p")}),i=KT(r);return new vh({schema:i,domParser:ws.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=Bl.build(e,{parser:this._nodeDomParser});return t.normalizeHTML(),this._domParser.parse(t.dom.body).toJSON()}}function TN(n,e){return n.type===e}function ON(n){return typeof n=="string"}class Ky{static doc(e){return{type:$n.DOCUMENT,content:e}}static list(e,t){return{type:$n.LIST,attrs:{bullet:{type:e}},content:t.map(r=>TN(r,$n.LIST_ITEM)?r:this.listItem([r].flat()))}}static listItem(...e){const{attrs:t,content:r,marks:i}=this.normalizeTextBlockArgs(e);return{type:$n.LIST_ITEM,...t?{attrs:t}:{},...i?{marks:i}:{},content:[r].flat().map(s=>ON(s)?this.paragraph(s):s)}}static heading(e,...t){const r=this.textBlock(t);return r.attrs??={},r.attrs.level=e,{type:$n.HEADING,...r}}static paragraph(...e){return{type:$n.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:$n.TEXT,...t?{marks:t}:{},text:e}}static link(e,t,r=[]){return this.text(e,[this.mark(Rf.LINK,t),...r])}static mark(e,t){return{type:e,attrs:t}}static populateAllDevices(e){return{mobile:e,tablet:e,desktop:e}}}class MN{_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=Di.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 If.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===If.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 Gy{static createWindow(){return new sm.JSDOM().window}types;parse(e){const{window:t}=new sm.JSDOM(e);return this.types=t,t.document}}class Jy{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 IN extends Jy{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}){Di.use(Gy.createWindow());const i=im.resolve(process.cwd(),t),s=vh.build({config:require(i).editor,nodeDomParser:new Gy}),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 NN="4.11.0-1";class RN extends Jy{name="version";description="display cli version";doCommand(){this.output(NN)}}const jy=new JE,LN=[IN,RN];for(const n of LN)new n().install(jy);jy.parse();
|
|
64
|
+
}`;var se=tm(function(){return _e(C,j+"return "+B).apply(t,E)});if(se.source=B,Zu(se))throw se;return se}function UC(o){return we(o).toLowerCase()}function qC(o){return we(o).toUpperCase()}function KC(o,l,f){if(o=we(o),o&&(f||l===t))return cd(o);if(!o||!(l=vt(l)))return o;var d=en(o),b=en(l),C=fd(d,b),E=hd(d,b)+1;return or(d,C,E).join("")}function GC(o,l,f){if(o=we(o),o&&(f||l===t))return o.slice(0,pd(o)+1);if(!o||!(l=vt(l)))return o;var d=en(o),b=hd(d,en(l))+1;return or(d,0,b).join("")}function JC(o,l,f){if(o=we(o),o&&(f||l===t))return o.replace(Zl,"");if(!o||!(l=vt(l)))return o;var d=en(o),b=fd(d,en(l));return or(d,b).join("")}function jC(o,l){var f=te,d=Ce;if(Me(l)){var b="separator"in l?l.separator:b;f="length"in l?ie(l.length):f,d="omission"in l?vt(l.omission):d}o=we(o);var C=o.length;if(ii(o)){var E=en(o);C=E.length}if(f>=C)return o;var O=f-si(d);if(O<1)return d;var I=E?or(E,0,O).join(""):o.slice(0,O);if(b===t)return I+d;if(E&&(O+=I.length-O),Qu(b)){if(o.slice(O).search(b)){var P,D=I;for(b.global||(b=mu(b.source,we(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(vt(b),O)!=O){var q=I.lastIndexOf(b);q>-1&&(I=I.slice(0,q))}return I+d}function YC(o){return o=we(o),o&&ab.test(o)?o.replace(Oh,v2):o}var XC=hi(function(o,l,f){return o+(f?" ":"")+l.toUpperCase()}),nc=np("toUpperCase");function em(o,l,f){return o=we(o),l=f?t:l,l===t?w2(o)?T2(o):f2(o):o.match(l)||[]}var tm=ae(function(o,l){try{return Ct(o,t,l)}catch(f){return Zu(f)?f:new ne(f)}}),ZC=On(function(o,l){return Bt(l,function(f){f=dn(f),An(o,f,Yu(o[f],o))}),o});function QC(o){var l=o==null?0:o.length,f=Y();return o=l?Te(o,function(d){if(typeof d[1]!="function")throw new zt(a);return[f(d[0]),d[1]]}):[],ae(function(d){for(var b=-1;++b<l;){var C=o[b];if(Ct(C[0],this,d))return Ct(C[1],this,d)}})}function eE(o){return v_(Ht(o,m))}function rc(o){return function(){return o}}function tE(o,l){return o==null||o!==o?l:o}var nE=ip(),rE=ip(!0);function mt(o){return o}function ic(o){return Ld(typeof o=="function"?o:Ht(o,m))}function iE(o){return Dd(Ht(o,m))}function sE(o,l){return Fd(o,Ht(l,m))}var oE=ae(function(o,l){return function(f){return ns(f,o,l)}}),aE=ae(function(o,l){return function(f){return ns(o,f,l)}});function sc(o,l,f){var d=Ve(l),b=xo(l,d);f==null&&!(Me(l)&&(b.length||!d.length))&&(f=l,l=o,o=this,b=xo(l,Ve(l)));var C=!(Me(f)&&"chain"in f)||!!f.chain,E=In(o);return Bt(b,function(O){var I=l[O];o[O]=I,E&&(o.prototype[O]=function(){var P=this.__chain__;if(C||P){var D=o(this.__wrapped__),B=D.__actions__=ht(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 lE(){return Xe._===this&&(Xe._=L2),this}function oc(){}function uE(o){return o=ie(o),ae(function(l){return Bd(l,o)})}var cE=Fu(Te),fE=Fu(sd),hE=Fu(lu);function nm(o){return Uu(o)?uu(dn(o)):W_(o)}function dE(o){return function(l){return o==null?t:Rr(o,l)}}var pE=op(),mE=op(!0);function ac(){return[]}function lc(){return!1}function gE(){return{}}function yE(){return""}function bE(){return!0}function _E(o,l){if(o=ie(o),o<1||o>Xn)return[];var f=xt,d=nt(o,xt);l=Y(l),o-=xt;for(var b=hu(d,l);++f<o;)l(f);return b}function wE(o){return re(o)?Te(o,dn):kt(o)?[o]:ht(xp(we(o)))}function SE(o){var l=++N2;return we(o)+l}var xE=To(function(o,l){return o+l},0),CE=Bu("ceil"),EE=To(function(o,l){return o/l},1),vE=Bu("floor");function kE(o){return o&&o.length?So(o,mt,Cu):t}function AE(o,l){return o&&o.length?So(o,Y(l,2),Cu):t}function TE(o){return ld(o,mt)}function OE(o,l){return ld(o,Y(l,2))}function ME(o){return o&&o.length?So(o,mt,Au):t}function IE(o,l){return o&&o.length?So(o,Y(l,2),Au):t}var NE=To(function(o,l){return o*l},1),RE=Bu("round"),LE=To(function(o,l){return o-l},0);function PE(o){return o&&o.length?fu(o,mt):0}function DE(o,l){return o&&o.length?fu(o,Y(l,2)):0}return w.after=ix,w.ary=Rp,w.assign=qx,w.assignIn=Gp,w.assignInWith=Ho,w.assignWith=Kx,w.at=Gx,w.before=Lp,w.bind=Yu,w.bindAll=ZC,w.bindKey=Pp,w.castArray=gx,w.chain=Mp,w.chunk=vw,w.compact=kw,w.concat=Aw,w.cond=QC,w.conforms=eE,w.constant=rc,w.countBy=PS,w.create=Jx,w.curry=Dp,w.curryRight=Fp,w.debounce=Bp,w.defaults=jx,w.defaultsDeep=Yx,w.defer=sx,w.delay=ox,w.difference=Tw,w.differenceBy=Ow,w.differenceWith=Mw,w.drop=Iw,w.dropRight=Nw,w.dropRightWhile=Rw,w.dropWhile=Lw,w.fill=Pw,w.filter=FS,w.flatMap=$S,w.flatMapDeep=HS,w.flatMapDepth=WS,w.flatten=kp,w.flattenDeep=Dw,w.flattenDepth=Fw,w.flip=ax,w.flow=nE,w.flowRight=rE,w.fromPairs=Bw,w.functions=rC,w.functionsIn=iC,w.groupBy=VS,w.initial=$w,w.intersection=Hw,w.intersectionBy=Ww,w.intersectionWith=Vw,w.invert=oC,w.invertBy=aC,w.invokeMap=qS,w.iteratee=ic,w.keyBy=KS,w.keys=Ve,w.keysIn=pt,w.map=Po,w.mapKeys=uC,w.mapValues=cC,w.matches=iE,w.matchesProperty=sE,w.memoize=Fo,w.merge=fC,w.mergeWith=Jp,w.method=oE,w.methodOf=aE,w.mixin=sc,w.negate=Bo,w.nthArg=uE,w.omit=hC,w.omitBy=dC,w.once=lx,w.orderBy=GS,w.over=cE,w.overArgs=ux,w.overEvery=fE,w.overSome=hE,w.partial=Xu,w.partialRight=zp,w.partition=JS,w.pick=pC,w.pickBy=jp,w.property=nm,w.propertyOf=dE,w.pull=Gw,w.pullAll=Tp,w.pullAllBy=Jw,w.pullAllWith=jw,w.pullAt=Yw,w.range=pE,w.rangeRight=mE,w.rearg=cx,w.reject=XS,w.remove=Xw,w.rest=fx,w.reverse=Ju,w.sampleSize=QS,w.set=gC,w.setWith=yC,w.shuffle=ex,w.slice=Zw,w.sortBy=rx,w.sortedUniq=sS,w.sortedUniqBy=oS,w.split=$C,w.spread=hx,w.tail=aS,w.take=lS,w.takeRight=uS,w.takeRightWhile=cS,w.takeWhile=fS,w.tap=kS,w.throttle=dx,w.thru=Lo,w.toArray=Up,w.toPairs=Yp,w.toPairsIn=Xp,w.toPath=wE,w.toPlainObject=Kp,w.transform=bC,w.unary=px,w.union=hS,w.unionBy=dS,w.unionWith=pS,w.uniq=mS,w.uniqBy=gS,w.uniqWith=yS,w.unset=_C,w.unzip=ju,w.unzipWith=Op,w.update=wC,w.updateWith=SC,w.values=mi,w.valuesIn=xC,w.without=bS,w.words=em,w.wrap=mx,w.xor=_S,w.xorBy=wS,w.xorWith=SS,w.zip=xS,w.zipObject=CS,w.zipObjectDeep=ES,w.zipWith=vS,w.entries=Yp,w.entriesIn=Xp,w.extend=Gp,w.extendWith=Ho,sc(w,w),w.add=xE,w.attempt=tm,w.camelCase=kC,w.capitalize=Zp,w.ceil=CE,w.clamp=CC,w.clone=yx,w.cloneDeep=_x,w.cloneDeepWith=wx,w.cloneWith=bx,w.conformsTo=Sx,w.deburr=Qp,w.defaultTo=tE,w.divide=EE,w.endsWith=AC,w.eq=nn,w.escape=TC,w.escapeRegExp=OC,w.every=DS,w.find=BS,w.findIndex=Ep,w.findKey=Xx,w.findLast=zS,w.findLastIndex=vp,w.findLastKey=Zx,w.floor=vE,w.forEach=Ip,w.forEachRight=Np,w.forIn=Qx,w.forInRight=eC,w.forOwn=tC,w.forOwnRight=nC,w.get=ec,w.gt=xx,w.gte=Cx,w.has=sC,w.hasIn=tc,w.head=Ap,w.identity=mt,w.includes=US,w.indexOf=zw,w.inRange=EC,w.invoke=lC,w.isArguments=Dr,w.isArray=re,w.isArrayBuffer=Ex,w.isArrayLike=dt,w.isArrayLikeObject=Le,w.isBoolean=vx,w.isBuffer=ar,w.isDate=kx,w.isElement=Ax,w.isEmpty=Tx,w.isEqual=Ox,w.isEqualWith=Mx,w.isError=Zu,w.isFinite=Ix,w.isFunction=In,w.isInteger=$p,w.isLength=zo,w.isMap=Hp,w.isMatch=Nx,w.isMatchWith=Rx,w.isNaN=Lx,w.isNative=Px,w.isNil=Fx,w.isNull=Dx,w.isNumber=Wp,w.isObject=Me,w.isObjectLike=Ie,w.isPlainObject=us,w.isRegExp=Qu,w.isSafeInteger=Bx,w.isSet=Vp,w.isString=$o,w.isSymbol=kt,w.isTypedArray=pi,w.isUndefined=zx,w.isWeakMap=$x,w.isWeakSet=Hx,w.join=Uw,w.kebabCase=MC,w.last=Vt,w.lastIndexOf=qw,w.lowerCase=IC,w.lowerFirst=NC,w.lt=Wx,w.lte=Vx,w.max=kE,w.maxBy=AE,w.mean=TE,w.meanBy=OE,w.min=ME,w.minBy=IE,w.stubArray=ac,w.stubFalse=lc,w.stubObject=gE,w.stubString=yE,w.stubTrue=bE,w.multiply=NE,w.nth=Kw,w.noConflict=lE,w.noop=oc,w.now=Do,w.pad=RC,w.padEnd=LC,w.padStart=PC,w.parseInt=DC,w.random=vC,w.reduce=jS,w.reduceRight=YS,w.repeat=FC,w.replace=BC,w.result=mC,w.round=RE,w.runInContext=M,w.sample=ZS,w.size=tx,w.snakeCase=zC,w.some=nx,w.sortedIndex=Qw,w.sortedIndexBy=eS,w.sortedIndexOf=tS,w.sortedLastIndex=nS,w.sortedLastIndexBy=rS,w.sortedLastIndexOf=iS,w.startCase=HC,w.startsWith=WC,w.subtract=LE,w.sum=PE,w.sumBy=DE,w.template=VC,w.times=_E,w.toFinite=Nn,w.toInteger=ie,w.toLength=qp,w.toLower=UC,w.toNumber=Ut,w.toSafeInteger=Ux,w.toString=we,w.toUpper=qC,w.trim=KC,w.trimEnd=GC,w.trimStart=JC,w.truncate=jC,w.unescape=YC,w.uniqueId=SE,w.upperCase=XC,w.upperFirst=nc,w.each=Ip,w.eachRight=Np,w.first=Ap,sc(w,function(){var o={};return fn(w,function(l,f){xe.call(w.prototype,f)||(o[f]=l)}),o}(),{chain:!1}),w.VERSION=r,Bt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(o){w[o].placeholder=w}),Bt(["drop","take"],function(o,l){ce.prototype[o]=function(f){f=f===t?1:ze(ie(f),0);var d=this.__filtered__&&!l?new ce(this):this.clone();return d.__filtered__?d.__takeCount__=nt(f,d.__takeCount__):d.__views__.push({size:nt(f,xt),type:o+(d.__dir__<0?"Right":"")}),d},ce.prototype[o+"Right"]=function(f){return this.reverse()[o](f).reverse()}}),Bt(["filter","map","takeWhile"],function(o,l){var f=l+1,d=f==Dt||f==We;ce.prototype[o]=function(b){var C=this.clone();return C.__iteratees__.push({iteratee:Y(b,3),type:f}),C.__filtered__=C.__filtered__||d,C}}),Bt(["head","last"],function(o,l){var f="take"+(l?"Right":"");ce.prototype[o]=function(){return this[f](1).value()[0]}}),Bt(["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(mt)},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 ns(f,o,l)})}),ce.prototype.reject=function(o){return this.filter(Bo(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],C=d||/^find/.test(l);b&&(w.prototype[l]=function(){var E=this.__wrapped__,O=d?[1]:arguments,I=E instanceof ce,P=O[0],D=I||re(E),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=C&&!q,se=I&&!j;if(!C&&D){E=se?E:new ce(this);var Z=o.apply(E,O);return Z.__actions__.push({func:Lo,args:[B],thisArg:t}),new $t(Z,q)}return X&&se?o.apply(this,O):(Z=this.thru(B),X?d?Z.value()[0]:Z.value():Z)})}),Bt(["pop","push","shift","sort","splice","unshift"],function(o){var l=so[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 C=this.value();return l.apply(re(C)?C:[],b)}return this[f](function(E){return l.apply(re(E)?E:[],b)})}}),fn(ce.prototype,function(o,l){var f=w[l];if(f){var d=f.name+"";xe.call(ui,d)||(ui[d]=[]),ui[d].push({name:l,func:f})}}),ui[Ao(t,g).name]=[{name:"wrapper",func:t}],ce.prototype.clone=Y2,ce.prototype.reverse=X2,ce.prototype.value=Z2,w.prototype.at=AS,w.prototype.chain=TS,w.prototype.commit=OS,w.prototype.next=MS,w.prototype.plant=NS,w.prototype.reverse=RS,w.prototype.toJSON=w.prototype.valueOf=w.prototype.value=LS,w.prototype.first=w.prototype.head,ji&&(w.prototype[ji]=IS),w},oi=O2();Tr?((Tr.exports=oi)._=oi,iu._=oi):Xe._=oi}).call($I)}(Vs,Vs.exports)),Vs.exports}var Wy=HI();function bh(n){return n.type.create(Wy.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 WI=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)=>ge(()=>{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(an.SETTINGS))return e.setMark(t,r);if(c.pos===h.pos)return;const _=x=>{if(!i.onAppliedToParent||i.onAppliedToParent(x)===!1){const{tr:v,node:N,position:g,mark:S}=x;_h({tr:v,node:N,position:g,mark:S.type})}};a.nodesBetween(c.pos,h.pos,(x,v)=>{if(x.type.name===me.LIST)return;const N=zI(x.marks,t),g=m.create({...N?.attrs||{},...r}),S=zy(c,h,x,v);if(!p.isInSet(x.marks)&&BI(s.doc,v,g,i.isAppliedToParent))return _({tr:s,node:x,position:v,mark:g});if(x.isText){s.addMark(S.from,S.to,g);return}DI(s.doc,s.selection,x,v)&&s.addNodeMark(v,g)})}),getMarks:W(({editor:n},e)=>{const t=_i(n,"state");return ge(()=>{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 ge(()=>V(t)[0]??null)}),hasMark:W(({commands:n},e)=>{const t=n.getMark(e);return ge(()=>!!V(t))}),getCommonSettingMark:W(({commands:n},e,t)=>{const r=n.getMark(e);return ge(()=>V(r)?.value??V(t))}),getDeviceSettingMark:W(({commands:n},e,t)=>{const r=n.getMarks(e),i=n.getDevice();return ge(()=>{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})})})}}}),VI=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=zy(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)})})}}}),UI=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;n.doc.nodesBetween(r,i,(s,a,u)=>{if(t({node:s,parent:u})){const c=s.isText?0:$y(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===me.DOCUMENT)})}}}),qI=Yn.create({name:"doc",topNode:!0,content:"block+"});class Gs extends Ue{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=dr.fromJSON(this.schema,e.toJSON());return t.attrs.meta[this.key]=this.value,De.ok(t)}invert(){return new Gs(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 Gs(e.key,e.value,e.stepType)}}Ue.jsonID("setDocAttr",Gs);const KI=qI.extend({marks:an.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 Gs(e,t,n.schema))})}}}),GI=Yn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",Ii(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),JI=GI.extend({marks:an.ALL,addOptions:()=>({HTMLAttributes:{class:"zw-style"}})}),jI=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]}`,Ii(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=>_O({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),YI=jI.extend({marks:an.ALL,addOptions:()=>({levels:[1,2,3,4],HTMLAttributes:{class:"zw-style"}})}),XI=Re.create({name:"prose_mirror_plugins",addProseMirrorPlugins(){return[WO.create(this.editor),VO.create(this.editor)]}}),ZI=()=>[KI,JI,YI,xO,NO,WI,VI,UI,XI],QI=Nt.create({name:be.FONT_FAMILY,group:an.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 ge(()=>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 ge(()=>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})}}),eN=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(()=>ge(()=>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 ge(()=>{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=_i(t,"state");return ge(()=>{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 ge(()=>V(i)[s]?.includes(r)??!1)}),getContentCustomization:W(({editor:t,commands:r})=>{const i=_i(t,"state");return ge(()=>{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(Di.head,V(this.options.presets))}}),tN=Nt.create({name:be.FONT_WEIGHT,group:an.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 ge(()=>{const r=V(e),i=V(t);return i.isWeightSupported(r)?r:i.findClosestWeight(r)})}),getDefaultFontWeight:W(({commands:n})=>{const e=n.getPreset();return ge(()=>V(e).common.font_weight)})}},addKeyboardShortcuts:()=>({"Mod-b":Yt("toggleBold"),"Mod-B":Yt("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})}}),nN=Nt.create({name:be.FONT_SIZE,group:an.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 ge(()=>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-=":Yt("increaseFontSize"),"Mod-Shift--":Yt("decreaseFontSize")}),parseHTML(){const n=e=>{if(!e)return null;const t=V(this.options.wrapperRef),r=By(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)})}}),rN=Nt.create({name:be.FONT_COLOR,group:an.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 ge(()=>V(e).common.color)}),applyFontColor:W(({commands:n},e)=>{n.applyMark(this.name,{value:e})})}},parseHTML(){const n=e=>({value:Fy(e)});return[{style:"--zw-font-color",getAttrs:n},{style:"color",getAttrs:n}]},renderHTML({HTMLAttributes:n}){return jr({font_color:n.value})}}),iN=Nt.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:Fy(e)});return[{style:"--zw-background-color",getAttrs:n},{style:"background-color",getAttrs:n}]},renderHTML({HTMLAttributes:n}){return jr({background_color:n.value})}}),sN=Re.create({name:"device_manager",addCommands(){return{getDevice:W(()=>_i(this.options,"device"))}}}),oN=Nt.create({name:be.FONT_STYLE,group:an.SETTINGS,addAttributes:()=>({italic:{required:!0}}),addCommands(){return{isItalic:W(({commands:n})=>{const e=n.getMark(this.name),t=n.getDefaultFontStyle();return ge(()=>V(e)?.italic??V(t).italic)}),isItalicAvailable:W(({commands:n})=>{const e=n.getFont(),t=n.getFontWeight();return ge(()=>{const r=V(e),i=V(t);return r.isItalicSupported(i)&&!r.isWeightItalicOnly(i)})}),getDefaultFontStyle:W(({commands:n})=>{const e=n.getPreset();return ge(()=>({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":Yt("toggleItalic"),"Mod-I":Yt("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})}}),aN=Nt.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 ge(()=>V(e).underline)}),isStrikeThrough:W(({commands:n})=>{const e=n.getTextDecoration();return ge(()=>V(e).strike_through)}),getTextDecoration:W(({commands:n})=>{const e=n.getMark(this.name),t=n.getDefaultTextDecoration();return ge(()=>{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 ge(()=>V(e)!==V(t).underline)}),getDefaultTextDecoration:W(({commands:n})=>{const e=n.getPreset();return ge(()=>{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":Yt("toggleUnderline"),"Mod-U":Yt("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(" ")})}}),lN=Re.create({name:"case_style",addCommands(){return{applyCaseStyle:W(({commands:n},e)=>{switch(e){case Nf.CAPITALIZE:return n.applyCapitalize();case Nf.LOWERCASE:return n.applyLowerCase();case Nf.UPPERCASE:return n.applyUpperCase()}}),applyCapitalize:W(({commands:n})=>{n.transformText(({text:e})=>uM(e))}),applyLowerCase:W(({commands:n})=>{n.transformText(({text:e})=>e.toLowerCase())}),applyUpperCase:W(({commands:n})=>{n.transformText(({text:e})=>e.toUpperCase())})}}}),Vy={mobile:null,tablet:null,desktop:null},uN=Re.create({name:be.ALIGNMENT,addGlobalAttributes:()=>[{types:[me.PARAGRAPH,me.HEADING],attributes:{[be.ALIGNMENT]:{isRequired:!1,parseHTML({style:n}){const e=PI(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?Cl({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},Vy)}),removeAlignment:W(({commands:n})=>n.removeBlockAttributes(this.name)),getAlignment:W(({commands:n})=>{const e=n.getBlockAttributes(this.name,Vy),t=n.getDevice(),r=n.getDefaultAlignment();return ge(()=>V(e)?.[V(t)]??V(r))}),getDefaultAlignment:W(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return ge(()=>V(t)[V(e)].alignment??Sr.LEFT)})}},addKeyboardShortcuts:()=>({"Mod-Shift-l":Yt("applyAlignment",Sr.LEFT),"Mod-Shift-e":Yt("applyAlignment",Sr.CENTER),"Mod-Shift-r":Yt("applyAlignment",Sr.RIGHT),"Mod-Shift-j":Yt("applyAlignment",Sr.JUSTIFY)})}),Uy={mobile:null,tablet:null,desktop:null},cN=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=RI(e,n,t);return r?{desktop:r,tablet:r,mobile:null}:null},renderHTML(n){return n.line_height?Cl({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,Uy),t=n.getDevice(),r=n.getDefaultLineHeight();return ge(()=>V(e)?.[V(t)]??V(r))}),getDefaultLineHeight:W(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return ge(()=>V(t)[V(e)].line_height)}),applyLineHeight:W(({commands:n},e)=>{const t=V(n.getDevice());n.setBlockAttributes(this.name,{[t]:e},Uy)})}}}),fN=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",Ii(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)}}}),hN=fN.extend({name:me.LIST_ITEM,marks:an.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 dN(n,e){if(be.inlineMarks.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 pN({doc:n,selection:e}){const t=e.$from.start(),r=e.$to.end();n.nodesBetween(t,r,(i,s)=>{if(i.type.name===me.LIST)return;if(i.type.name!==me.LIST_ITEM)return!1;const a=[];return i.forEach(u=>{for(const c of u.marks){if(c.isInSet(a)){tr.removeNodeMark(s+1,c);continue}dN(i,c)&&(tr.removeNodeMark(s+1,c),tr.addNodeMark(s,bh(c)),a.push(c))}}),!1})}const mN=Yn.create({name:me.LIST,content:`${me.LIST_ITEM}+`,group:"block list",marks:an.SETTINGS,addExtensions:()=>[hN],addOptions:()=>({baseClass:"",presetClass:""}),addAttributes:()=>({bullet:{default:{type:Gt.DISC}}}),parseHTML(){const n={a:Gt.ROMAN,i:Gt.LATIN,1:Gt.DECIMAL},e=t=>{for(const r of Gt.values){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)||Gt.DECIMAL}})},{tag:"ul",getAttrs:t=>({bullet:{type:e(t)||Gt.DISC}})}]},renderHTML({HTMLAttributes:n}){const e=[V(this.options.baseClass)+n.bullet.type,V(this.options.presetClass)];return[Gt.ordered.includes(n.bullet.type)?"ol":"ul",{class:e.join(" ")},0]},addCommands(){return{getListType:W(({commands:n})=>{const e=n.getBlockAttributes("bullet",{type:null});return ge(()=>V(e).type??null)}),applyList:W(({commands:n,chain:e},t)=>V(n.getListType())===t?n.removeList():e().applyDefaultPreset().toggleList(me.LIST,me.LIST_ITEM).setBlockAttributes("bullet",{type:t}).command(({tr:i})=>pN(i)).run()),removeList:W(({chain:n})=>n().command(({tr:e,commands:t})=>{const r=e.selection.$from.start(),i=e.selection.$to.end();let s;return e.doc.nodesBetween(r,i,(a,u,c)=>{if(a.isText&&!s&&(s=u),[me.LIST,me.LIST_ITEM].includes(a.type.name))return;if(c.type.name!==me.LIST_ITEM)return!1;const h=c.marks.filter(p=>!p.type.isInSet(a.marks));for(const p of h)e.addNodeMark(u,bh(p));return!1}),t.setTextSelection({from:s,to:i})}).liftListItem(me.LIST_ITEM).run())}},addInputRules(){const n=(e,t)=>wO({find:t,type:this.type,getAttributes:{bullet:{type:e}},joinPredicate:(r,{attrs:i})=>i.bullet.type===e});return[n(Gt.DISC,/^\s*([-+*])\s$/),n(Gt.DECIMAL,/^(\d+)\.\s$/),n(Gt.LATIN,/^([ivx]{1,3})\.\s$/i),n(Gt.ROMAN,/^([a-z])\.\s$/i)]}});function gN(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function yN(n){return new ct({key:new Mt("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=WT(t.doc,[...e]);if(XT(u).forEach(({newRange:h})=>{const p=UT(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 x=_[_.length-1],v=m.pos+y.lastIndexOf(x);if(!x)return!1;const N=xl(x).map(g=>g.toObject(n.defaultProtocol));if(!gN(N))return!1;N.filter(g=>g.isLink).map(g=>({...g,from:v+g.start+1,to:v+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(S=>S.mark.type===n.type)||a.addMark(g.from,g.to,n.type.create({href:g.href}))})}}),!!a.steps.length)return a}})}function bN(n){return new ct({key:new Mt("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=JT(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 _N(n){return new ct({key:new Mt("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=F1(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 wN=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function Zr(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(wN,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const SN=Nt.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"){D1(n);return}D1(n.scheme,n.optionalSlashes)})},onDestroy(){sM()},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)=>!!Zr(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=>!!Zr(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=>!!Zr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Ii(this.options.HTMLAttributes,n),0]:["a",Ii(this.options.HTMLAttributes,{...n,href:""}),0]},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!Zr(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=>!!Zr(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[SO({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,i=F1(n).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:a=>!!Zr(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(yN({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Zr(i,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&n.push(bN({type:this.type})),this.options.linkOnPaste&&n.push(_N({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),n}}),xN=SN.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:w1.SELF,parseHTML:n=>n.getAttribute("target")||w1.SELF},destination:{default:Os.URL,parseHTML:n=>{const e=n.getAttribute("href");if(!e.startsWith("#"))return Os.URL;const t=e.replace("#","");return V(this.options.pageBlocks).find(s=>s.id===parseInt(t))?Os.BLOCK:Os.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(Ky.text(r.text,[Ky.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(()=>ge(()=>V(this.options.preset)))}},addProseMirrorPlugins(){return[...this.parent(),lM.create(this.editor)]},renderHTML({HTMLAttributes:n}){const e=n.destination===Os.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]}}),CN=Nt.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 ge(()=>!!V(e))})}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs:n=>n!=="super"?!1:null}]},renderHTML(){return["sup",{class:"zw-superscript"},0]}}),EN=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?Cl({margin:n.margin.value}):null}}}}]});function vN(n){const e=r=>n.presetsRef.value.find(i=>i.id===r),t=kc({default:null,link:null});return a5(n.presetsRef,()=>{t.default=e(n.defaultPresetId),t.link=e(n.linkPresetId)},{immediate:!0,deep:!0}),ZI().concat([eN.configure({presets:n.presetsRef,defaultId:n.defaultPresetId,styleRenderer:new MN({baseClass:n.basePresetClass,makeVariable:n.makePresetVariable,linkPresetId:n.linkPresetId})}),mN.configure({baseClass:n.baseListClass,presetClass:n.basePresetClass+n.defaultPresetId}),sN.configure({device:n.deviceRef}),nN.configure({minSize:n.minFontSize,maxSize:n.maxFontSize,wrapperRef:n.wrapperRef}),QI.configure({fonts:n.fonts,defaultPreset:_i(t,"default"),defaultFont:n.defaultFont}),tN,rN,iN,oN,aN,lN,CN,uN,cN.configure({wrapperRef:n.wrapperRef}),xN.configure({preset:_i(t,"link"),basePresetClass:n.basePresetClass,pageBlocks:n.pageBlocksRef}),EN])}class kN{_domParser=new DOMParser;types=window;parse(e){return this._domParser.parseFromString(e,"text/html")}}class qy{content;constructor({content:e}){this.content=e}normalize(){throw new Error("Implement abstract method")}}class _n extends qy{static BLOCK_NODE_NAMES=["P","H1","H2","H3","H4"];static ROOT_NODE_NAMES=_n.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,_n.BLOCK_STYLES),t.append(u)};this._assignElementProperties(e,e.parentElement,_n.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,_n.BLOCK_STYLES),this._removeStyleProperties(e.parentElement,_n.BLOCK_STYLES),this._assignElementProperties(e,e.parentElement),e.parentElement.lastElementChild===e&&this._removeStyleProperties(e.parentElement)}_isBlockNode(e){return _n.BLOCK_NODE_NAMES.includes(e.tagName)}_isRootNode(e){return _n.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,_n.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 AN extends qy{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=>Wy.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 Bl{static build(e,t={}){return typeof e=="string"?this._buildHtml(e,t):this._buildJson(e)}static _buildHtml(e,t){return new _n({content:e,parser:t.parser||new kN})}static _buildJson(e){return new AN({content:e})}static normalize(e,t={}){return Bl.build(e,t).normalize()}}class Di{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 vh{static build({config:e,nodeDomParser:t}){const r=vN({fonts:e.fonts,minFontSize:0,maxFontSize:0,presetsRef:ra(e.presets),defaultPresetId:e.defaultPresetId,linkPresetId:e.linkPresetId,makePresetVariable:()=>"",basePresetClass:e.basePresetClass,baseListClass:e.baseListClass,deviceRef:ra(If.DESKTOP),pageBlocksRef:ra([]),wrapperRef:Di.document.createElement("p")}),i=KT(r);return new vh({schema:i,domParser:ws.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=Bl.build(e,{parser:this._nodeDomParser});return t.normalizeHTML(),this._domParser.parse(t.dom.body).toJSON()}}function TN(n,e){return n.type===e}function ON(n){return typeof n=="string"}class Ky{static doc(e){return{type:$n.DOCUMENT,content:e}}static list(e,t){return{type:$n.LIST,attrs:{bullet:{type:e}},content:t.map(r=>TN(r,$n.LIST_ITEM)?r:this.listItem([r].flat()))}}static listItem(...e){const{attrs:t,content:r,marks:i}=this.normalizeTextBlockArgs(e);return{type:$n.LIST_ITEM,...t?{attrs:t}:{},...i?{marks:i}:{},content:[r].flat().map(s=>ON(s)?this.paragraph(s):s)}}static heading(e,...t){const r=this.textBlock(t);return r.attrs??={},r.attrs.level=e,{type:$n.HEADING,...r}}static paragraph(...e){return{type:$n.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:$n.TEXT,...t?{marks:t}:{},text:e}}static link(e,t,r=[]){return this.text(e,[this.mark(Rf.LINK,t),...r])}static mark(e,t){return{type:e,attrs:t}}static populateAllDevices(e){return{mobile:e,tablet:e,desktop:e}}}class MN{_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=Di.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 If.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===If.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 Gy{static createWindow(){return new sm.JSDOM().window}types;parse(e){const{window:t}=new sm.JSDOM(e);return this.types=t,t.document}}class Jy{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 IN extends Jy{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}){Di.use(Gy.createWindow());const i=im.resolve(process.cwd(),t),s=vh.build({config:require(i).editor,nodeDomParser:new Gy}),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 NN="4.11.0-2";class RN extends Jy{name="version";description="display cli version";doCommand(){this.output(NN)}}const jy=new JE,LN=[IN,RN];for(const n of LN)new n().install(jy);jy.parse();
|
|
@@ -4,8 +4,8 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
4
4
|
max: string | number;
|
|
5
5
|
min: string | number;
|
|
6
6
|
step: string | number;
|
|
7
|
-
digits: string | number;
|
|
8
7
|
disabled: boolean;
|
|
8
|
+
digits: string | number;
|
|
9
9
|
fieldId: string;
|
|
10
10
|
units: string;
|
|
11
11
|
$props: {
|
|
@@ -13,8 +13,8 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
13
13
|
readonly max?: string | number | undefined;
|
|
14
14
|
readonly min?: string | number | undefined;
|
|
15
15
|
readonly step?: string | number | undefined;
|
|
16
|
-
readonly digits?: string | number | undefined;
|
|
17
16
|
readonly disabled?: boolean | undefined;
|
|
17
|
+
readonly digits?: string | number | undefined;
|
|
18
18
|
readonly fieldId?: string | undefined;
|
|
19
19
|
readonly units?: string | undefined;
|
|
20
20
|
};
|
|
@@ -61,7 +61,7 @@ declare const __VLS_component: import("vue").DefineComponent<{}, {
|
|
|
61
61
|
$forceUpdate: () => void;
|
|
62
62
|
$nextTick: typeof import("vue").nextTick;
|
|
63
63
|
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
|
|
64
|
-
} & Readonly<{}> & Omit<Readonly<{}> & Readonly<{}>, "value" | "favoriteColors" | "$props" | "$emit" | "
|
|
64
|
+
} & Readonly<{}> & Omit<Readonly<{}> & Readonly<{}>, "value" | "favoriteColors" | "$props" | "$emit" | "vOutClick" | "pickerRef" | "ColorPicker" | "ContextWindow" | "api" | "updateFavoriteColors"> & import("vue").ShallowUnwrapRef<{
|
|
65
65
|
$emit: (event: "change", ...args: any[]) => void;
|
|
66
66
|
ColorPicker: typeof ColorPicker;
|
|
67
67
|
vOutClick: typeof vOutClick;
|
|
@@ -332,7 +332,7 @@ type __VLS_TemplateResult = {
|
|
|
332
332
|
$forceUpdate: () => void;
|
|
333
333
|
$nextTick: typeof nextTick;
|
|
334
334
|
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (args_0: R, args_1: R, args_2: OnCleanup) => any : (args_0: any, args_1: any, args_2: OnCleanup) => any, options?: WatchOptions<boolean> | undefined): WatchStopHandle;
|
|
335
|
-
} & Readonly<{}> & Omit<Readonly<{}> & Readonly<{}>, "value" | "favoriteColors" | "$props" | "$emit" | "
|
|
335
|
+
} & Readonly<{}> & Omit<Readonly<{}> & Readonly<{}>, "value" | "favoriteColors" | "$props" | "$emit" | "vOutClick" | "pickerRef" | "ColorPicker" | "ContextWindow" | "api" | "updateFavoriteColors"> & ShallowUnwrapRef<{
|
|
336
336
|
$emit: (event: "change", ...args: any[]) => void;
|
|
337
337
|
ColorPicker: __VLS_WithTemplateSlots<DefineComponent<__VLS_PublicProps, {
|
|
338
338
|
isVisible: ComputedRef<boolean>;
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export {
|
|
1
|
+
export { default as Button } from './Button.vue';
|
|
2
|
+
export { default as ButtonToggle } from './ButtonToggle.vue';
|
|
3
|
+
export { default as Icon } from './Icon.vue';
|
|
4
|
+
export { default as ScrollView } from './ScrollView.vue';
|
|
5
|
+
export { default as FieldLabel } from './FieldLabel.vue';
|
|
6
|
+
export { default as Range } from './Range.vue';
|
|
7
|
+
export { default as NumberField } from './NumberField.vue';
|
|
8
|
+
export { default as Modal } from './Modal.vue';
|
|
9
|
+
export { default as TextField } from './TextField.vue';
|
|
10
|
+
export { default as Checkbox } from './Checkbox.vue';
|
|
11
|
+
export { useModalToggler, useElementRef } from './composables';
|
|
12
|
+
export * from './dropdown';
|
|
13
|
+
export * from './colorPicker';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<{}, {
|
|
2
2
|
$emit: (event: "applied", ...args: any[]) => void;
|
|
3
|
-
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {},
|
|
3
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
4
4
|
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {},
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, HTMLButtonElement>;
|
|
2
2
|
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {},
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, HTMLButtonElement>;
|
|
2
2
|
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {},
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, HTMLButtonElement>;
|
|
2
2
|
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {},
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, HTMLButtonElement>;
|
|
2
2
|
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {},
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, HTMLButtonElement>;
|
|
2
2
|
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { default as Button } from './Button.vue';
|
|
2
|
+
export { default as ButtonToggle } from './ButtonToggle.vue';
|
|
3
|
+
export { default as Icon } from './Icon.vue';
|
|
4
|
+
export { default as ScrollView } from './ScrollView.vue';
|
|
5
|
+
export { default as FieldLabel } from './FieldLabel.vue';
|
|
6
|
+
export { default as Range } from './Range.vue';
|
|
7
|
+
export { default as NumberField } from './NumberField.vue';
|
|
8
|
+
export { default as Modal } from './Modal.vue';
|
|
9
|
+
export { default as TextField } from './TextField.vue';
|
|
10
|
+
export { default as Checkbox } from './Checkbox.vue';
|
|
11
|
+
export { useModalToggler, useElementRef } from './composables';
|
|
12
|
+
export * from './dropdown';
|
|
13
|
+
export * from './colorPicker';
|
package/package.json
CHANGED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export { default as Button } from './Button';
|
|
2
|
-
export { default as ButtonToggle } from './ButtonToggle';
|
|
3
|
-
export { default as Icon } from './Icon';
|
|
4
|
-
export { default as ScrollView } from './ScrollView';
|
|
5
|
-
export { default as FieldLabel } from './FieldLabel';
|
|
6
|
-
export { default as Range } from './Range';
|
|
7
|
-
export { default as NumberField } from './NumberField';
|
|
8
|
-
export { default as Modal } from './Modal';
|
|
9
|
-
export { default as TextField } from './TextField';
|
|
10
|
-
export { default as Checkbox } from './Checkbox';
|
|
11
|
-
export { useModalToggler, useElementRef } from './composables';
|
|
12
|
-
export * from './dropdown';
|
|
13
|
-
export * from './colorPicker';
|