@kvass/widgets 1.9.29 → 1.9.31
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/finn.js +6 -6
- package/dist/font-selector.js +1 -1
- package/dist/index.es2.js +1 -1
- package/dist/index.js +8 -8
- package/package.json +1 -1
package/dist/index.es2.js
CHANGED
|
@@ -101,4 +101,4 @@ img.ProseMirror-separator {
|
|
|
101
101
|
|
|
102
102
|
`);return!o||!s?!1:t.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:o}=n;if(!o||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;const s=i.after();return s===void 0?!1:r.nodeAt(s)?t.commands.command(({tr:a})=>(a.setSelection(ue.near(r.resolve(s))),!0)):t.commands.exitCode()}}},addInputRules(){return[Gd({find:vF,type:this.type,getAttributes:t=>({language:t[1]})}),Gd({find:yF,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new $e({key:new ut("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,o=i?.mode;if(!n||!o)return!1;const{tr:s,schema:a}=t.state,l=a.text(n.replace(/\r\n?/g,`
|
|
103
103
|
`));return s.replaceSelectionWith(this.type.create({language:o},l)),s.selection.$from.parent.type!==this.type&&s.setSelection(ae.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),t.dispatch(s),!0}}})]}}),kF=on.create({name:"doc",topNode:!0,content:"block+"});function wF(t={}){return new $e({view(e){return new xF(e,t)}})}class xF{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let o=s=>{this[i](s)};return e.dom.addEventListener(i,o),{name:i,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,i=this.editorView.dom,o=i.getBoundingClientRect(),s=o.width/i.offsetWidth,a=o.height/i.offsetHeight;if(n){let d=e.nodeBefore,h=e.nodeAfter;if(d||h){let p=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(p){let f=p.getBoundingClientRect(),m=d?f.bottom:f.top;d&&h&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*a;r={left:f.left,right:f.right,top:m-g,bottom:m+g}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*s;r={left:d.left-h,right:d.left+h,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let u,c;if(!l||l==document.body&&getComputedStyle(l).position=="static")u=-pageXOffset,c=-pageYOffset;else{let d=l.getBoundingClientRect(),h=d.width/l.offsetWidth,p=d.height/l.offsetHeight;u=d.left-l.scrollLeft*h,c=d.top-l.scrollTop*p}this.element.style.left=(r.left-u)/s+"px",this.element.style.top=(r.top-c)/a+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!o){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=Fb(this.editorView.state.doc,s,this.editorView.dragging.slice);a!=null&&(s=a)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const EF=Ge.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[wF(this.options)]}});class De extends ue{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return De.valid(r)?new De(r):ue.near(r)}content(){return V.empty}eq(e){return e instanceof De&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new De(e.resolve(n.pos))}getBookmark(){return new Hh(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!CF(e)||!SF(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&De.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let a=e.node(s);if(n>0?e.indexAfter(s)<a.childCount:e.index(s)>0){o=a.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=n;let l=e.doc.resolve(i);if(De.valid(l))return l}for(;;){let s=n>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!Z.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*n),r=!1;continue e}break}o=s,i+=n;let a=e.doc.resolve(i);if(De.valid(a))return a}return null}}}De.prototype.visible=!1;De.findFrom=De.findGapCursorFrom;ue.jsonID("gapcursor",De);class Hh{constructor(e){this.pos=e}map(e){return new Hh(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return De.valid(n)?new De(n):ue.near(n)}}function CF(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function SF(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function TF(){return new $e({props:{decorations:_F,createSelectionBetween(t,e,n){return e.pos==n.pos&&De.valid(n)?new De(n):null},handleClick:AF,handleKeyDown:OF,handleDOMEvents:{beforeinput:MF}}})}const OF=E0({ArrowLeft:Aa("horiz",-1),ArrowRight:Aa("horiz",1),ArrowUp:Aa("vert",-1),ArrowDown:Aa("vert",1)});function Aa(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,o){let s=r.selection,a=e>0?s.$to:s.$from,l=s.empty;if(s instanceof ae){if(!o.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let u=De.findGapCursorFrom(a,e,l);return u?(i&&i(r.tr.setSelection(new De(u))),!0):!1}}function AF(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!De.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&Z.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new De(r))),!0)}function MF(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof De))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=D.empty;for(let s=r.length-1;s>=0;s--)i=D.from(r[s].createAndFill(null,i));let o=t.state.tr.replace(n.pos,n.pos,new V(i,0,0));return o.setSelection(ae.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function _F(t){if(!(t.selection instanceof De))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Fe.create(t.doc,[Mt.widget(t.selection.head,e,{key:"gapcursor"})])}const DF=Ge.create({name:"gapCursor",addProseMirrorPlugins(){return[TF()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=pe(W(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),IF=on.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",tt(this.options.HTMLAttributes,t)]},renderText(){return`
|
|
104
|
-
`},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:o}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:a}=r.extensionManager,l=o||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:u,dispatch:c})=>{if(c&&l&&s){const d=l.filter(h=>a.includes(h.type.name));u.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),NF=on.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(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,tt(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>Gd({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var nu=200,Ue=function(){};Ue.prototype.append=function(t){return t.length?(t=Ue.from(t),!this.length&&t||t.length<nu&&this.leafAppend(t)||this.length<nu&&t.leafPrepend(this)||this.appendInner(t)):this};Ue.prototype.prepend=function(t){return t.length?Ue.from(t).append(this):this};Ue.prototype.appendInner=function(t){return new RF(this,t)};Ue.prototype.slice=function(t,e){return t===void 0&&(t=0),e===void 0&&(e=this.length),t>=e?Ue.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))};Ue.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};Ue.prototype.forEach=function(t,e,n){e===void 0&&(e=0),n===void 0&&(n=this.length),e<=n?this.forEachInner(t,e,n,0):this.forEachInvertedInner(t,e,n,0)};Ue.prototype.map=function(t,e,n){e===void 0&&(e=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(i,o){return r.push(t(i,o))},e,n),r};Ue.from=function(t){return t instanceof Ue?t:t&&t.length?new mk(t):Ue.empty};var mk=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(r,i){return r==0&&i==this.length?this:new e(this.values.slice(r,i))},e.prototype.getInner=function(r){return this.values[r]},e.prototype.forEachInner=function(r,i,o,s){for(var a=i;a<o;a++)if(r(this.values[a],s+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,s){for(var a=i-1;a>=o;a--)if(r(this.values[a],s+a)===!1)return!1},e.prototype.leafAppend=function(r){if(this.length+r.length<=nu)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=nu)return new e(r.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Ue);Ue.empty=new mk([]);var RF=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,r,i,o){var s=this.left.length;if(r<s&&this.left.forEachInner(n,r,Math.min(i,s),o)===!1||i>s&&this.right.forEachInner(n,Math.max(r-s,0),Math.min(this.length,i)-s,o+s)===!1)return!1},e.prototype.forEachInvertedInner=function(n,r,i,o){var s=this.left.length;if(r>s&&this.right.forEachInvertedInner(n,r-s,Math.max(i,s)-s,o+s)===!1||i<s&&this.left.forEachInvertedInner(n,Math.min(r,s),i,o)===!1)return!1},e.prototype.sliceInner=function(n,r){if(n==0&&r==this.length)return this;var i=this.left.length;return r<=i?this.left.slice(n,r):n>=i?this.right.slice(n-i,r-i):this.left.slice(n,i).append(this.right.slice(0,r-i))},e.prototype.leafAppend=function(n){var r=this.right.leafAppend(n);if(r)return new e(this.left,r)},e.prototype.leafPrepend=function(n){var r=this.left.leafPrepend(n);if(r)return new e(r,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e}(Ue);const PF=500;class Yt{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;n&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=e.tr,a,l,u=[],c=[];return this.items.forEach((d,h)=>{if(!d.step){i||(i=this.remapping(r,h+1),o=i.maps.length),o--,c.push(d);return}if(i){c.push(new pn(d.map));let p=d.step.map(i.slice(o)),f;p&&s.maybeStep(p).doc&&(f=s.mapping.maps[s.mapping.maps.length-1],u.push(new pn(f,void 0,void 0,u.length+c.length))),o--,f&&i.appendMap(f,o)}else s.maybeStep(d.step);if(d.selection)return a=i?d.selection.map(i.slice(o)):d.selection,l=new Yt(this.items.slice(0,r).append(c.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:a}}addTransform(e,n,r,i){let o=[],s=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let c=0;c<e.steps.length;c++){let d=e.steps[c].invert(e.docs[c]),h=new pn(e.mapping.maps[c],d,n),p;(p=l&&l.merge(h))&&(h=p,c?o.pop():a=a.slice(0,a.length-1)),o.push(h),n&&(s++,n=void 0),i||(l=h)}let u=s-r.depth;return u>LF&&(a=FF(a,u),s-=u),new Yt(a.append(o),s)}remapping(e,n){let r=new bs;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new Yt(this.items.append(e.map(n=>new pn(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),o=e.mapping,s=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},i);let l=n;this.items.forEach(h=>{let p=o.getMirror(--l);if(p==null)return;s=Math.min(s,p);let f=o.maps[p];if(h.step){let m=e.steps[p].invert(e.docs[p]),g=h.selection&&h.selection.map(o.slice(l+1,p));g&&a++,r.push(new pn(f,m,g))}else r.push(new pn(f))},i);let u=[];for(let h=n;h<s;h++)u.push(new pn(o.maps[h]));let c=this.items.slice(0,i).append(u).append(r),d=new Yt(c,a);return d.emptyItemCount()>PF&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],o=0;return this.items.forEach((s,a)=>{if(a>=e)i.push(s),s.selection&&o++;else if(s.step){let l=s.step.map(n.slice(r)),u=l&&l.getMap();if(r--,u&&n.appendMap(u,r),l){let c=s.selection&&s.selection.map(n.slice(r));c&&o++;let d=new pn(u.invert(),l,c),h,p=i.length-1;(h=i.length&&i[p].merge(d))?i[p]=h:i.push(d)}}else s.map&&r--},this.items.length,0),new Yt(Ue.from(i.reverse()),o)}}Yt.empty=new Yt(Ue.empty,0);function FF(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class pn{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new pn(n.getMap().invert(),n,this.selection)}}}class ir{constructor(e,n,r,i,o){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const LF=20;function BF(t,e,n,r){let i=n.getMeta(ti),o;if(i)return i.historyState;n.getMeta(jF)&&(t=new ir(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(ti))return s.getMeta(ti).redo?new ir(t.done.addTransform(n,void 0,r,Wa(e)),t.undone,Wg(n.mapping.maps),t.prevTime,t.prevComposition):new ir(t.done,t.undone.addTransform(n,void 0,r,Wa(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!s&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!VF(n,t.prevRanges)),u=s?Uc(t.prevRanges,n.mapping):Wg(n.mapping.maps);return new ir(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,Wa(e)),Yt.empty,u,n.time,a??t.prevComposition)}else return(o=n.getMeta("rebased"))?new ir(t.done.rebased(n,o),t.undone.rebased(n,o),Uc(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new ir(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Uc(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function VF(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&i>=e[o]&&(n=!0)}),n}function Wg(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,o,s)=>e.push(o,s));return e}function Uc(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),o=e.map(t[r+1],-1);i<=o&&n.push(i,o)}return n}function $F(t,e,n){let r=Wa(e),i=ti.get(e).spec.config,o=(n?t.undone:t.done).popEvent(e,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),a=(n?t.done:t.undone).addTransform(o.transform,e.selection.getBookmark(),i,r),l=new ir(n?a:o.remaining,n?o.remaining:a,null,0,-1);return o.transform.setSelection(s).setMeta(ti,{redo:n,historyState:l})}let Kc=!1,Ug=null;function Wa(t){let e=t.plugins;if(Ug!=e){Kc=!1,Ug=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Kc=!0;break}}return Kc}const ti=new ut("history"),jF=new ut("closeHistory");function zF(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new $e({key:ti,state:{init(){return new ir(Yt.empty,Yt.empty,null,0,-1)},apply(e,n,r){return BF(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?vk:r=="historyRedo"?yk:null;return i?(n.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function gk(t,e){return(n,r)=>{let i=ti.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let o=$F(i,n,t);o&&r(o.scrollIntoView())}return!0}}const vk=gk(!1),yk=gk(!0),HF=Ge.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>vk(t,e),redo:()=>({state:t,dispatch:e})=>yk(t,e)}},addProseMirrorPlugins(){return[zF(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),qF=on.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",tt(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{const{selection:n}=e,{$from:r,$to:i}=n,o=t();return r.parentOffset===0?o.insertContentAt({from:Math.max(r.pos-1,0),to:i.pos},{type:this.name}):$0(n)?o.insertContentAt(i.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({tr:s,dispatch:a})=>{var l;if(a){const{$to:u}=s.selection,c=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?s.setSelection(ae.create(s.doc,u.pos+1)):u.nodeAfter.isBlock?s.setSelection(Z.create(s.doc,u.pos)):s.setSelection(ae.create(s.doc,u.pos));else{const d=(l=u.parent.type.contentMatch.defaultType)===null||l===void 0?void 0:l.create();d&&(s.insert(c,d),s.setSelection(ae.create(s.doc,c+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[ZN({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),WF=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,UF=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,KF=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,GF=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,JF=Wn.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",tt(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[uo({find:WF,type:this.type}),uo({find:KF,type:this.type})]},addPasteRules(){return[di({find:UF,type:this.type}),di({find:GF,type:this.type})]}}),YF=on.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",tt(this.options.HTMLAttributes,t),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)}}}),XF="listItem",Kg="textStyle",Gg=/^(\d+)\.\s$/,ZF=on.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",tt(this.options.HTMLAttributes,n),0]:["ol",tt(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(XF,this.editor.getAttributes(Kg)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Ss({find:Gg,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Ss({find:Gg,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Kg)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),QF=on.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",tt(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),eL=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,tL=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,nL=Wn.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",tt(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[uo({find:eL,type:this.type})]},addPasteRules(){return[di({find:tL,type:this.type})]}}),rL=on.create({name:"text",group:"inline"}),iL=Ge.create({name:"starterKit",addExtensions(){var t,e,n,r,i,o,s,a,l,u,c,d,h,p,f,m,g,b;const y=[];return this.options.bold!==!1&&y.push(dF.configure((t=this.options)===null||t===void 0?void 0:t.bold)),this.options.blockquote!==!1&&y.push(sF.configure((e=this.options)===null||e===void 0?void 0:e.blockquote)),this.options.bulletList!==!1&&y.push(hF.configure((n=this.options)===null||n===void 0?void 0:n.bulletList)),this.options.code!==!1&&y.push(gF.configure((r=this.options)===null||r===void 0?void 0:r.code)),this.options.codeBlock!==!1&&y.push(bF.configure((i=this.options)===null||i===void 0?void 0:i.codeBlock)),this.options.document!==!1&&y.push(kF.configure((o=this.options)===null||o===void 0?void 0:o.document)),this.options.dropcursor!==!1&&y.push(EF.configure((s=this.options)===null||s===void 0?void 0:s.dropcursor)),this.options.gapcursor!==!1&&y.push(DF.configure((a=this.options)===null||a===void 0?void 0:a.gapcursor)),this.options.hardBreak!==!1&&y.push(IF.configure((l=this.options)===null||l===void 0?void 0:l.hardBreak)),this.options.heading!==!1&&y.push(NF.configure((u=this.options)===null||u===void 0?void 0:u.heading)),this.options.history!==!1&&y.push(HF.configure((c=this.options)===null||c===void 0?void 0:c.history)),this.options.horizontalRule!==!1&&y.push(qF.configure((d=this.options)===null||d===void 0?void 0:d.horizontalRule)),this.options.italic!==!1&&y.push(JF.configure((h=this.options)===null||h===void 0?void 0:h.italic)),this.options.listItem!==!1&&y.push(YF.configure((p=this.options)===null||p===void 0?void 0:p.listItem)),this.options.orderedList!==!1&&y.push(ZF.configure((f=this.options)===null||f===void 0?void 0:f.orderedList)),this.options.paragraph!==!1&&y.push(QF.configure((m=this.options)===null||m===void 0?void 0:m.paragraph)),this.options.strike!==!1&&y.push(nL.configure((g=this.options)===null||g===void 0?void 0:g.strike)),this.options.text!==!1&&y.push(rL.configure((b=this.options)===null||b===void 0?void 0:b.text)),y}}),oL={class:"k-richtext__menu"},KL=Q({__name:"RichText",props:{modelValue:{default:""},disabled:{type:Boolean},actions:{default:()=>["heading2","bold","italic","orderedList","bulletList"]},placeholder:{default:"Write something..."}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=RP({extensions:[iL,iF.configure({placeholder:n.placeholder}),rF.configure({defaultProtocol:"https",protocols:["mailto"],HTMLAttributes:{class:"",rel:"noopener noreferrer nofollow",target:"_blank"}})],editable:!n.disabled,content:n.modelValue,onUpdate:({editor:a})=>{r("update:modelValue",a.getHTML())}}),o=I(()=>!i||!i.value?[]:[{id:"heading2",icon:"fa-pro-regular:heading",action:()=>{var a;return(a=i.value)==null?void 0:a.chain().focus().toggleHeading({level:2}).run()},isActive:()=>{var a;return(a=i.value)==null?void 0:a.isActive("heading",{level:2})}},{id:"bold",icon:"fa-pro-regular:bold",action:()=>{var a;return(a=i.value)==null?void 0:a.chain().focus().toggleBold().run()},isActive:()=>{var a;return(a=i.value)==null?void 0:a.isActive("bold")}},{id:"italic",icon:"fa-pro-regular:italic",action:()=>{var a;return(a=i.value)==null?void 0:a.chain().focus().toggleItalic().run()},isActive:()=>{var a;return(a=i.value)==null?void 0:a.isActive("italic")}},{id:"orderedList",icon:"fa-pro-regular:list-ol",action:()=>{var a;return(a=i.value)==null?void 0:a.chain().focus().toggleOrderedList().run()},isActive:()=>{var a;return(a=i.value)==null?void 0:a.isActive("orderedList")}},{id:"bulletList",icon:"fa-pro-regular:list-ul",action:()=>{var a;return(a=i.value)==null?void 0:a.chain().focus().toggleBulletList().run()},isActive:()=>{var a;return(a=i.value)==null?void 0:a.isActive("bulletList")}}].filter(a=>n.actions.includes(a.id))),s=rn("k-richtext",{variants:{disabled:{true:"k-richtext--disabled"}}});return we(()=>n.modelValue,()=>{if(i.value&&i.value.getHTML()!==n.modelValue)return i.value.commands.setContent(n.modelValue)}),(a,l)=>(E(),O("div",{class:Se(B(s)({disabled:a.disabled}))},[U("div",oL,[he(ib,{class:"k-richtext__menu-group",modelValue:[],multiple:!0},{default:ee(({getItemProps:u})=>[(E(!0),O(Oe,null,_t(o.value,c=>(E(),H(He,{disabled:a.disabled,variant:"tertiary",class:"k-richtext__item","data-part":"item","data-state":`${c.isActive()?"on":"off"}`,onClick:()=>c.action(),icon:c.icon},null,8,["disabled","data-state","onClick","icon"]))),256))]),_:1})]),he(B(NP),{editor:B(i),class:"k-richtext__editor"},null,8,["editor"])],2))}});function sL(t){return t%4===0&&t%100!==0||t%400===0}function aL(t=""){if(t.length===10){let e=t.replace(".","-").replace("/","-").split("-");if(e.length===3&&e[0].length===4){let n=parseInt(e[0]),r=parseInt(e[1]),i=parseInt(e[2]);if(r===2){if(sL(n)){if(i>29)return!1}else if(i>28)return!1}if((r===4||r===6||r===9||r===11)&&i>30)return!1}return!0}return!0}function Nn(t){let e;if(typeof t=="number"&&(e=new Date(t),typeof e=="object"))return!0;if(e=new Date(t),typeof e=="object")return!(e.toString()==="Invalid Date"||!aL(t));var n=/^\d{4}\-\d{1,2}\-\d{1,2}$/;if(!n.test(t))return!1;var r=t.split("-"),i=parseInt(r[2],10),o=parseInt(r[1],10),s=parseInt(r[0],10);if(s<1e3||s>3e3||o==0||o>12)return!1;var a=[31,28,31,30,31,30,31,31,30,31,30,31];return(s%400==0||s%100!=0&&s%4==0)&&(a[1]=29),i>0&&i<=a[o-1]}var ru={required:function(t){var e;return t==null?!1:(e=String(t).replace(/\s/g,""),e.length>0)},required_if:function(t,e,n){return e=this.getParameters(),this.validator._objectPath(this.validator.input,e[0])===e[1]?this.validator.getRule("required").validate(t):!0},required_unless:function(t,e,n){return e=this.getParameters(),this.validator._objectPath(this.validator.input,e[0])!==e[1]?this.validator.getRule("required").validate(t):!0},required_with:function(t,e,n){return this.validator._objectPath(this.validator.input,e)?this.validator.getRule("required").validate(t):!0},required_with_all:function(t,e,n){e=this.getParameters();for(var r=0;r<e.length;r++)if(!this.validator._objectPath(this.validator.input,e[r]))return!0;return this.validator.getRule("required").validate(t)},required_without:function(t,e,n){return this.validator._objectPath(this.validator.input,e)?!0:this.validator.getRule("required").validate(t)},required_without_all:function(t,e,n){e=this.getParameters();for(var r=0;r<e.length;r++)if(this.validator._objectPath(this.validator.input,e[r]))return!0;return this.validator.getRule("required").validate(t)},boolean:function(t){return t===!0||t===!1||t===0||t===1||t==="0"||t==="1"||t==="true"||t==="false"},size:function(t,e,n){if(t){e=parseFloat(e);var r=this.getSize();return r===e}return!0},string:function(t,e,n){return typeof t=="string"},sometimes:function(t){return!0},min:function(t,e,n){var r=this.getSize();return r>=e},max:function(t,e,n){var r=this.getSize();return r<=e},between:function(t,e,n){e=this.getParameters();var r=this.getSize(),i=parseFloat(e[0],10),o=parseFloat(e[1],10);return r>=i&&r<=o},email:function(t){var e=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return e.test(t)||(e=/^((?:[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]|[^\u0000-\u007F])+@(?:[a-zA-Z0-9]|[^\u0000-\u007F])(?:(?:[a-zA-Z0-9-]|[^\u0000-\u007F]){0,61}(?:[a-zA-Z0-9]|[^\u0000-\u007F]))?(?:\.(?:[a-zA-Z0-9]|[^\u0000-\u007F])(?:(?:[a-zA-Z0-9-]|[^\u0000-\u007F]){0,61}(?:[a-zA-Z0-9]|[^\u0000-\u007F]))?)+)*$/),e.test(t)},numeric:function(t){var e;return e=Number(t),typeof e=="number"&&!isNaN(e)&&typeof t!="boolean"},array:function(t){return t instanceof Array},url:function(t){return/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_\+.~#?&/=]*)/i.test(t)},alpha:function(t){return/^[a-zA-Z]+$/.test(t)},alpha_dash:function(t){return/^[a-zA-Z0-9_\-]+$/.test(t)},alpha_num:function(t){return/^[a-zA-Z0-9]+$/.test(t)},same:function(t,e){var n=this.validator._flattenObject(this.validator.input)[e],r=t;return n===r},different:function(t,e){var n=this.validator._flattenObject(this.validator.input)[e],r=t;return n!==r},in:function(t,e){var n,r;if(t&&(n=this.getParameters()),t&&!(t instanceof Array)){var i=t;for(r=0;r<n.length;r++)if(typeof n[r]=="string"&&(i=String(t)),i===n[r])return!0;return!1}if(t&&t instanceof Array){for(r=0;r<t.length;r++)if(n.indexOf(t[r])<0)return!1}return!0},not_in:function(t,e){for(var n=this.getParameters(),r=n.length,i=!0,o=0;o<r;o++){var s=t;if(typeof n[o]=="string"&&(s=String(t)),s===n[o]){i=!1;break}}return i},accepted:function(t){return t==="on"||t==="yes"||t===1||t==="1"||t===!0},confirmed:function(t,e,n){var r=n+"_confirmation";return this.validator.input[r]===t},integer:function(t){return String(parseInt(t,10))===String(t)},digits:function(t,e){var n=this.validator.getRule("numeric");return!!(n.validate(t)&&String(t.trim()).length===parseInt(e))},digits_between:function(t){var e=this.validator.getRule("numeric"),n=this.getParameters(),r=String(t).length,i=parseFloat(n[0],10),o=parseFloat(n[1],10);return!!(e.validate(t)&&r>=i&&r<=o)},regex:function(t,e){var n=/[g|i|m]{1,3}$/,r=e.match(n);return r=r?r[0]:"",e=e.replace(n,"").slice(1,-1),e=new RegExp(e,r),!!e.test(t)},date:function(t,e){return Nn(t)},present:function(t){return typeof t<"u"},after:function(t,e){var n=this.validator.input[e],r=t;return!Nn(n)||!Nn(r)?!1:new Date(n).getTime()<new Date(r).getTime()},after_or_equal:function(t,e){var n=this.validator.input[e],r=t;return!Nn(n)||!Nn(r)?!1:new Date(n).getTime()<=new Date(r).getTime()},before:function(t,e){var n=this.validator.input[e],r=t;return!Nn(n)||!Nn(r)?!1:new Date(n).getTime()>new Date(r).getTime()},before_or_equal:function(t,e){var n=this.validator.input[e],r=t;return!Nn(n)||!Nn(r)?!1:new Date(n).getTime()>=new Date(r).getTime()},hex:function(t){return/^[0-9a-f]+$/i.test(t)},ipv4:function(t,e,n){if(typeof t!="string")return!1;var r=/^[0-9]+$/;if(octets=t.split("."),octets.length!=4)return!1;for(let o=0;o<octets.length;o++){const s=octets[o];if(!r.test(s))return!1;var i=parseInt(s);if(i>=256)return!1}return!0},ipv6:function(t,e,n){if(typeof t!="string")return!1;var r=/^[0-9a-f]+$/;if(hextets=t.split(":"),colons=t.match(/::/),colons!=null&&t.match(/::/g).length>1||t[0]==":"&&(colons==null||colons!=null&&colons.index!=0)||t[t.length-1]==":"&&(colons==null||colons!=null&&colons.index!=t.length-2)||3>hextets.length)return!1;var i=hextets.length==9&&colons!=null&&(colons.index==0||colons.index==t.length-2);if(hextets.length>8&&!i||hextets.length!=8&&colons==null)return!1;for(let o=0;o<hextets.length;o++){const s=hextets[o];if(s.length!=0&&(!r.test(s)||s.length>4))return!1}return!0},ip:function(t,e,n){return ru.ipv4(t,e,n)||ru.ipv6(t,e,n)}},bk=function(){throw new Error("Validator `"+this.name+"` is not defined!")},kk;function wk(t,e,n){this.name=t,this.fn=e,this.passes=null,this._customMessage=void 0,this.async=n}wk.prototype={validate:function(t,e,n,r){var i=this;if(this._setValidatingData(n,t,e),typeof r=="function"){this.callback=r;var o=function(s,a){i.response(s,a)};return this.async?this._apply(t,e,n,o):o(this._apply(t,e,n))}return this._apply(t,e,n)},_apply:function(t,e,n,r){var i=this.isMissed()?bk:this.fn;return i.apply(this,[t,e,n,r])},_setValidatingData:function(t,e,n){this.attribute=t,this.inputValue=e,this.ruleValue=n},getParameters:function(){var t=[];return typeof this.ruleValue=="string"&&(t=this.ruleValue.split(",")),typeof this.ruleValue=="number"&&t.push(this.ruleValue),this.ruleValue instanceof Array&&(t=this.ruleValue),t},getSize:function(){var t=this.inputValue;return t instanceof Array?t.length:typeof t=="number"?t:this.validator._hasNumericRule(this.attribute)?parseFloat(t,10):t.length},_getValueType:function(){return typeof this.inputValue=="number"||this.validator._hasNumericRule(this.attribute)?"numeric":"string"},response:function(t,e){this.passes=t===void 0||t===!0,this._customMessage=e,this.callback(this.passes,e)},setValidator:function(t){this.validator=t},isMissed:function(){return typeof this.fn!="function"},get customMessage(){return this.isMissed()?kk:this._customMessage}};var lL={asyncRules:[],implicitRules:["required","required_if","required_unless","required_with","required_with_all","required_without","required_without_all","accepted","present"],make:function(t,e){var n=this.isAsync(t),r=new wk(t,ru[t],n);return r.setValidator(e),r},isAsync:function(t){for(var e=0,n=this.asyncRules.length;e<n;e++)if(this.asyncRules[e]===t)return!0;return!1},isImplicit:function(t){return this.implicitRules.indexOf(t)>-1},register:function(t,e){ru[t]=e},registerImplicit:function(t,e){this.register(t,e),this.implicitRules.push(t)},registerAsync:function(t,e){this.register(t,e),this.asyncRules.push(t)},registerAsyncImplicit:function(t,e){this.registerImplicit(t,e),this.asyncRules.push(t)},registerMissedRuleValidator:function(t,e){bk=t,kk=e}},uL=lL;function cL(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var dL={between:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{min:n[0],max:n[1]})},digits_between:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{min:n[0],max:n[1]})},required_if:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{other:this._getAttributeName(n[0]),value:n[1]})},required_unless:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{other:this._getAttributeName(n[0]),value:n[1]})},required_with:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{field:this._getAttributeName(n[0])})},required_with_all:function(t,e){var n=e.getParameters(),r=this._getAttributeName.bind(this);return this._replacePlaceholders(e,t,{fields:n.map(r).join(", ")})},required_without:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{field:this._getAttributeName(n[0])})},required_without_all:function(t,e){var n=e.getParameters(),r=this._getAttributeName.bind(this);return this._replacePlaceholders(e,t,{fields:n.map(r).join(", ")})},after:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{after:this._getAttributeName(n[0])})},before:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{before:this._getAttributeName(n[0])})},after_or_equal:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{after_or_equal:this._getAttributeName(n[0])})},before_or_equal:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{before_or_equal:this._getAttributeName(n[0])})},same:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{same:this._getAttributeName(n[0])})}};function pL(t){return t.replace(/[_\[]/g," ").replace(/]/g,"")}var xk={replacements:dL,formatter:pL},Jg=xk,lp=function(t,e){this.lang=t,this.messages=e,this.customMessages={},this.attributeNames={}};lp.prototype={constructor:lp,_setCustom:function(t){this.customMessages=t||{}},_setAttributeNames:function(t){this.attributeNames=t},_setAttributeFormatter:function(t){this.attributeFormatter=t},_getAttributeName:function(t){var e=t;return this.attributeNames.hasOwnProperty(t)?this.attributeNames[t]:(this.messages.attributes.hasOwnProperty(t)&&(e=this.messages.attributes[t]),this.attributeFormatter&&(e=this.attributeFormatter(e)),e)},all:function(){return this.messages},render:function(t){if(t.customMessage)return t.customMessage;var e=this._getTemplate(t),n;return Jg.replacements[t.name]?n=Jg.replacements[t.name].apply(this,[e,t]):n=this._replacePlaceholders(t,e,{}),n},_getTemplate:function(t){for(var e=this.messages,n=e.def,r=this.customMessages,i=[t.name+"."+t.attribute,t.name],o=0,s;o<i.length;o++)if(s=i[o],r.hasOwnProperty(s)){n=r[s];break}else if(e.hasOwnProperty(s)){n=e[s];break}return typeof n=="object"&&(n=n[t._getValueType()]),n},_replacePlaceholders:function(t,e,n){var r,i;if(n.attribute=this._getAttributeName(t.attribute),n[t.name]=n[t.name]||t.getParameters().join(","),typeof e=="string"&&typeof n=="object"){r=e;for(i in n)r=r.replace(new RegExp(":"+i,"g"),n[i])}return r}};var hL=lp,fL={accepted:"The :attribute must be accepted.",after:"The :attribute must be after :after.",after_or_equal:"The :attribute must be equal or after :after_or_equal.",alpha:"The :attribute field must contain only alphabetic characters.",alpha_dash:"The :attribute field may only contain alpha-numeric characters, as well as dashes and underscores.",alpha_num:"The :attribute field must be alphanumeric.",before:"The :attribute must be before :before.",before_or_equal:"The :attribute must be equal or before :before_or_equal.",between:{numeric:"The :attribute field must be between :min and :max.",string:"The :attribute field must be between :min and :max characters."},confirmed:"The :attribute confirmation does not match.",email:"The :attribute format is invalid.",date:"The :attribute is not a valid date format.",def:"The :attribute attribute has errors.",digits:"The :attribute must be :digits digits.",digits_between:"The :attribute field must be between :min and :max digits.",different:"The :attribute and :different must be different.",in:"The selected :attribute is invalid.",integer:"The :attribute must be an integer.",hex:"The :attribute field should have hexadecimal format",min:{numeric:"The :attribute must be at least :min.",string:"The :attribute must be at least :min characters."},max:{numeric:"The :attribute may not be greater than :max.",string:"The :attribute may not be greater than :max characters."},not_in:"The selected :attribute is invalid.",numeric:"The :attribute must be a number.",present:"The :attribute field must be present (but can be empty).",required:"The :attribute field is required.",required_if:"The :attribute field is required when :other is :value.",required_unless:"The :attribute field is required when :other is not :value.",required_with:"The :attribute field is required when :field is not empty.",required_with_all:"The :attribute field is required when :fields are not empty.",required_without:"The :attribute field is required when :field is empty.",required_without_all:"The :attribute field is required when :fields are empty.",same:"The :attribute and :same fields must match.",size:{numeric:"The :attribute must be :size.",string:"The :attribute must be :size characters."},string:"The :attribute must be a string.",url:"The :attribute format is invalid.",regex:"The :attribute format is invalid.",attributes:{}};const mL=Su(fL);var gL=hL,vL=cL,yL={messages:{},_set:function(t,e){this.messages[t]=e},_setRuleMessage:function(t,e,n){this._load(t),n===void 0&&(n=this.messages[t].def),this.messages[t][e]=n},_load:function(t){if(!this.messages[t])try{var e=vL("./lang/"+t);this._set(t,e)}catch{}},_get:function(t){return this._load(t),this.messages[t]},_make:function(t){return this._load(t),new gL(t,this.messages[t])}},Ek=yL;const Ck=Su(Ek);var up=function(){this.errors={}};up.prototype={constructor:up,add:function(t,e){this.has(t)||(this.errors[t]=[]),this.errors[t].indexOf(e)===-1&&this.errors[t].push(e)},get:function(t){return this.has(t)?this.errors[t]:[]},first:function(t){return this.has(t)?this.errors[t][0]:!1},all:function(){return this.errors},has:function(t){return!!this.errors.hasOwnProperty(t)}};var bL=up;function Sk(t,e){this.onResolvedAll=e,this.onFailedOne=t,this.resolvers={},this.resolversCount=0,this.passed=[],this.failed=[],this.firing=!1}Sk.prototype={add:function(t){var e=this.resolversCount;return this.resolvers[e]=t,this.resolversCount++,e},resolve:function(t){var e=this.resolvers[t];e.passes===!0?this.passed.push(e):e.passes===!1&&(this.failed.push(e),this.onFailedOne(e)),this.fire()},isAllResolved:function(){return this.passed.length+this.failed.length===this.resolversCount},fire:function(){this.firing&&this.isAllResolved()&&this.onResolvedAll(this.failed.length===0)},enableFiring:function(){this.firing=!0}};var kL=Sk,wr=uL,ki=Ek,wL=bL,xL=xk,EL=kL,Ve=function(t,e,n){var r=Ve.getDefaultLang();this.input=t||{},this.messages=ki._make(r),this.messages._setCustom(n),this.setAttributeFormatter(Ve.prototype.attributeFormatter),this.errors=new wL,this.errorCount=0,this.hasAsync=!1,this.rules=this._parseRules(e)};Ve.prototype={constructor:Ve,lang:"en",numericRules:["integer","numeric"],attributeFormatter:xL.formatter,check:function(){for(var t in this.rules){var e=this.rules[t],n=this._objectPath(this.input,t);if(!(this._hasRule(t,["sometimes"])&&!this._suppliedWithData(t)))for(var r=0,i=e.length,o,s,a;r<i&&(s=e[r],o=this.getRule(s.name),!(this._isValidatable(o,n)&&(a=o.validate(n,s.value,t),a||this._addFailure(o),this._shouldStopValidating(t,a))));r++);}return this.errorCount===0},checkAsync:function(t,e){var n=this;t=t||function(){},e=e||function(){};var r=function(f,m){n._addFailure(f,m)},i=function(f){f?t():e()},o=new EL(r,i),s=function(f,m,g,b){return function(){var y=o.add(b);b.validate(f,m.value,g,function(){o.resolve(y)})}};for(var a in this.rules){var l=this.rules[a],u=this._objectPath(this.input,a);if(!(this._hasRule(a,["sometimes"])&&!this._suppliedWithData(a)))for(var c=0,d=l.length,h,p;c<d;c++)p=l[c],h=this.getRule(p.name),this._isValidatable(h,u)&&s(u,p,a,h)()}o.enableFiring(),o.fire()},_addFailure:function(t){var e=this.messages.render(t);this.errors.add(t.attribute,e),this.errorCount++},_flattenObject:function(t){var e={};function n(r,i){if(!(!i&&Object.getOwnPropertyNames(r).length===0))if(Object(r)!==r||Array.isArray(r))e[i]=r;else{var o=!0;for(var s in r)o=!1,n(r[s],i?i+"."+s:s);o&&(e[i]={})}}return t&&n(t),e},_objectPath:function(t,e){if(Object.prototype.hasOwnProperty.call(t,e))return t[e];var n=e.replace(/\[(\w+)\]/g,".$1").replace(/^\./,"").split("."),r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i]);for(var o=0,s=n.length;o<s;o++)if(typeof r=="object"&&r!==null&&Object.hasOwnProperty.call(r,n[o]))r=r[n[o]];else return;return r},_parseRules:function(t){var e={};t=this._flattenObject(t);for(var n in t){var r=t[n];this._parseRulesCheck(n,r,e)}return e},_parseRulesCheck:function(t,e,n,r){t.indexOf("*")>-1?this._parsedRulesRecurse(t,e,n,r):this._parseRulesDefault(t,e,n,r)},_parsedRulesRecurse:function(t,e,n,r){var i=t.substr(0,t.indexOf("*")-1),o=this._objectPath(this.input,i);if(o)for(var s=0;s<o.length;s++){var a=r?r.slice():[];a.push(s),this._parseRulesCheck(t.replace("*",s),e,n,a)}},_parseRulesDefault:function(t,e,n,r){var i=[];e instanceof Array&&(e=this._prepareRulesArray(e)),typeof e=="string"&&(e=e.split("|"));for(var o=0,s=e.length,a;o<s;o++)a=typeof e[o]=="string"?this._extractRuleAndRuleValue(e[o]):e[o],a.value&&(a.value=this._replaceWildCards(a.value,r),this._replaceWildCardsMessages(r)),wr.isAsync(a.name)&&(this.hasAsync=!0),i.push(a);n[t]=i},_replaceWildCards:function(t,e){if(!e)return t;var n=t;return e.forEach(function(r){Array.isArray(n)&&(n=n[0]);const i=n.indexOf("*");if(i===-1)return n;n=n.substr(0,i)+r+n.substr(i+1)}),Array.isArray(t)&&(t[0]=n,n=t),n},_replaceWildCardsMessages:function(t){var e=this.messages.customMessages,n=this;Object.keys(e).forEach(function(r){if(t){var i=n._replaceWildCards(r,t);e[i]=e[r]}}),this.messages._setCustom(e)},_prepareRulesArray:function(t){for(var e=[],n=0,r=t.length;n<r;n++)if(typeof t[n]=="object")for(var i in t[n])e.push({name:i,value:t[n][i]});else e.push(t[n]);return e},_suppliedWithData:function(t){return this.input.hasOwnProperty(t)},_extractRuleAndRuleValue:function(t){var e={},n;return e.name=t,t.indexOf(":")>=0&&(n=t.split(":"),e.name=n[0],e.value=n.slice(1).join(":")),e},_hasRule:function(t,e){for(var n=this.rules[t]||[],r=0,i=n.length;r<i;r++)if(e.indexOf(n[r].name)>-1)return!0;return!1},_hasNumericRule:function(t){return this._hasRule(t,this.numericRules)},_isValidatable:function(t,e){return Array.isArray(e)||wr.isImplicit(t.name)?!0:this.getRule("required").validate(e)},_shouldStopValidating:function(t,e){var n=this.stopOnAttributes;return typeof n>"u"||n===!1||e===!0?!1:n instanceof Array?n.indexOf(t)>-1:!0},setAttributeNames:function(t){this.messages._setAttributeNames(t)},setAttributeFormatter:function(t){this.messages._setAttributeFormatter(t)},getRule:function(t){return wr.make(t,this)},stopOnError:function(t){this.stopOnAttributes=t},passes:function(t){var e=this._checkAsync("passes",t);return e?this.checkAsync(t):this.check()},fails:function(t){var e=this._checkAsync("fails",t);return e?this.checkAsync(function(){},t):!this.check()},_checkAsync:function(t,e){var n=typeof e=="function";if(this.hasAsync&&!n)throw t+" expects a callback when async rules are being tested.";return this.hasAsync||n}};Ve.setMessages=function(t,e){return ki._set(t,e),this};Ve.getMessages=function(t){return ki._get(t)};Ve.useLang=function(t){this.prototype.lang=t};Ve.getDefaultLang=function(){return this.prototype.lang};Ve.setAttributeFormatter=function(t){this.prototype.attributeFormatter=t};Ve.stopOnError=function(t){this.prototype.stopOnAttributes=t};Ve.register=function(t,e,n,r){var i=Ve.getDefaultLang();wr.register(t,e),ki._setRuleMessage(i,t,n)};Ve.registerImplicit=function(t,e,n,r){var i=Ve.getDefaultLang();wr.registerImplicit(t,e),ki._setRuleMessage(i,t,n)};Ve.registerAsync=function(t,e,n,r){var i=Ve.getDefaultLang();wr.registerAsync(t,e),ki._setRuleMessage(i,t,n)};Ve.registerAsyncImplicit=function(t,e,n){var r=Ve.getDefaultLang();wr.registerAsyncImplicit(t,e),ki._setRuleMessage(r,t,n)};Ve.registerMissedRuleValidator=function(t,e){wr.registerMissedRuleValidator(t,e)};var CL=Ve;const pr=Su(CL);Ck._set("en",mL);pr.useLang("en");const cp=z(!1),SL=t=>{cp.value=!cp.value,Ck._set("default",t),pr.useLang("default")},TL=(t,e)=>Object.fromEntries(Object.entries(t).map(([n,r])=>{const i=n.split(".").pop();return[n,e(i)]})),dp=(t,e={})=>{const{rule:n="required",prefix:r=""}=e;let i={};return Object.entries(t).forEach(([o,s])=>{const a=r+o;if(Uw(s)){s.map((l,u)=>{i=Object.assign(i,dp(l,{rule:n,prefix:`${a}.${u}.`}))});return}if(Ww(s)){i=Object.assign(i,dp(s,{rule:n,prefix:`${a}.`}));return}i[a]=n}),i},OL=pr.register,AL=pr.registerAsync;function ML(t={}){const{rules:e,labels:n,data:r,customMessages:i,visitImmediate:o=!1}=t;if(i){let m=pr.getMessages("default");Object.entries(i.value).forEach(([g,b])=>m[g]=b),pr.setMessages("default",m)}let s=new pr({},{}),a=()=>Object.fromEntries(Object.keys(e.value).map(m=>[m,{rule:e.value[m],valid:!c.value.get(m).length,error:c.value.first(m)||void 0,visited:l.value[m]}])),l=z(o?Object.fromEntries(Object.keys(e.value).map(m=>[m,!0])):{}),u=z(!0),c=z(s.errors),d=I(()=>a());function h(m){var g;let b=(g=d.value)==null?void 0:g[m];const y={valid:!0,error:void 0};return!b||!b.visited?y:b}let p=()=>{let m=new pr(r.value,e.value);n&&m.setAttributeNames(n.value);const g=()=>{c.value=s.errors,u.value=!0},b=()=>{u.value=!1,c.value=m.errors};m.checkAsync(g,b)};we([r,cp],p,{deep:!0,immediate:!0});const f=m=>{if(!m)return!1;const g=typeof m=="string"?m.split("|"):Array.isArray(m)?m:[],b={required:()=>!0,required_if:(y,k)=>r.value[y]===k,required_unless:(y,k)=>r.value[y]!==k,required_with:y=>y.some(k=>k in r.value),required_with_all:y=>y.every(k=>k in r.value),required_without:y=>y.some(k=>!(k in r.value)),required_without_all:y=>y.every(k=>!(k in r.value))};for(const y of g){if(typeof y=="string"){if(y==="required")return b.required;const[k,...v]=y.split(":");if(b[k]){const w=v.map(x=>["true",!0,"false",!1].includes(x)?JSON.parse(x):x);return b[k](...w)}}if(typeof y=="object"){for(const[k,v]of Object.entries(y))if(b[k])return Array.isArray(v)?b[k](...v):b[k](v)}}return!1};return{onChange:p,errors:c,passes:u,fields:d,bind:m=>({onBlur:()=>l.value[m]=!0,error:h(m).error,required:f(e.value[m])})}}const GL=Object.freeze(Object.defineProperty({__proto__:null,default:ML,generateLabels:TL,generateRules:dp,register:OL,registerAsync:AL,setLabels:SL},Symbol.toStringTag,{value:"Module"}));export{KL as $,VL as A,vv as B,RL as E,qL as F,Eu as G,jL as I,WL as L,$L as M,zL as N,BL as O,HL as P,QE as S,LL as T,Qe as U,bu as W,ri as _,He as a,gf as b,FL as c,NL as d,UL as e,ML as f,X1 as g,RE as h,DL as m,wT as u,IL as v,PL as x,GL as z};
|
|
104
|
+
`},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:o}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:a}=r.extensionManager,l=o||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:u,dispatch:c})=>{if(c&&l&&s){const d=l.filter(h=>a.includes(h.type.name));u.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),NF=on.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(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,tt(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>Gd({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var nu=200,Ue=function(){};Ue.prototype.append=function(t){return t.length?(t=Ue.from(t),!this.length&&t||t.length<nu&&this.leafAppend(t)||this.length<nu&&t.leafPrepend(this)||this.appendInner(t)):this};Ue.prototype.prepend=function(t){return t.length?Ue.from(t).append(this):this};Ue.prototype.appendInner=function(t){return new RF(this,t)};Ue.prototype.slice=function(t,e){return t===void 0&&(t=0),e===void 0&&(e=this.length),t>=e?Ue.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))};Ue.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};Ue.prototype.forEach=function(t,e,n){e===void 0&&(e=0),n===void 0&&(n=this.length),e<=n?this.forEachInner(t,e,n,0):this.forEachInvertedInner(t,e,n,0)};Ue.prototype.map=function(t,e,n){e===void 0&&(e=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(i,o){return r.push(t(i,o))},e,n),r};Ue.from=function(t){return t instanceof Ue?t:t&&t.length?new mk(t):Ue.empty};var mk=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(r,i){return r==0&&i==this.length?this:new e(this.values.slice(r,i))},e.prototype.getInner=function(r){return this.values[r]},e.prototype.forEachInner=function(r,i,o,s){for(var a=i;a<o;a++)if(r(this.values[a],s+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,s){for(var a=i-1;a>=o;a--)if(r(this.values[a],s+a)===!1)return!1},e.prototype.leafAppend=function(r){if(this.length+r.length<=nu)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=nu)return new e(r.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Ue);Ue.empty=new mk([]);var RF=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,r,i,o){var s=this.left.length;if(r<s&&this.left.forEachInner(n,r,Math.min(i,s),o)===!1||i>s&&this.right.forEachInner(n,Math.max(r-s,0),Math.min(this.length,i)-s,o+s)===!1)return!1},e.prototype.forEachInvertedInner=function(n,r,i,o){var s=this.left.length;if(r>s&&this.right.forEachInvertedInner(n,r-s,Math.max(i,s)-s,o+s)===!1||i<s&&this.left.forEachInvertedInner(n,Math.min(r,s),i,o)===!1)return!1},e.prototype.sliceInner=function(n,r){if(n==0&&r==this.length)return this;var i=this.left.length;return r<=i?this.left.slice(n,r):n>=i?this.right.slice(n-i,r-i):this.left.slice(n,i).append(this.right.slice(0,r-i))},e.prototype.leafAppend=function(n){var r=this.right.leafAppend(n);if(r)return new e(this.left,r)},e.prototype.leafPrepend=function(n){var r=this.left.leafPrepend(n);if(r)return new e(r,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e}(Ue);const PF=500;class Yt{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;n&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=e.tr,a,l,u=[],c=[];return this.items.forEach((d,h)=>{if(!d.step){i||(i=this.remapping(r,h+1),o=i.maps.length),o--,c.push(d);return}if(i){c.push(new pn(d.map));let p=d.step.map(i.slice(o)),f;p&&s.maybeStep(p).doc&&(f=s.mapping.maps[s.mapping.maps.length-1],u.push(new pn(f,void 0,void 0,u.length+c.length))),o--,f&&i.appendMap(f,o)}else s.maybeStep(d.step);if(d.selection)return a=i?d.selection.map(i.slice(o)):d.selection,l=new Yt(this.items.slice(0,r).append(c.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:a}}addTransform(e,n,r,i){let o=[],s=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let c=0;c<e.steps.length;c++){let d=e.steps[c].invert(e.docs[c]),h=new pn(e.mapping.maps[c],d,n),p;(p=l&&l.merge(h))&&(h=p,c?o.pop():a=a.slice(0,a.length-1)),o.push(h),n&&(s++,n=void 0),i||(l=h)}let u=s-r.depth;return u>LF&&(a=FF(a,u),s-=u),new Yt(a.append(o),s)}remapping(e,n){let r=new bs;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new Yt(this.items.append(e.map(n=>new pn(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),o=e.mapping,s=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},i);let l=n;this.items.forEach(h=>{let p=o.getMirror(--l);if(p==null)return;s=Math.min(s,p);let f=o.maps[p];if(h.step){let m=e.steps[p].invert(e.docs[p]),g=h.selection&&h.selection.map(o.slice(l+1,p));g&&a++,r.push(new pn(f,m,g))}else r.push(new pn(f))},i);let u=[];for(let h=n;h<s;h++)u.push(new pn(o.maps[h]));let c=this.items.slice(0,i).append(u).append(r),d=new Yt(c,a);return d.emptyItemCount()>PF&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],o=0;return this.items.forEach((s,a)=>{if(a>=e)i.push(s),s.selection&&o++;else if(s.step){let l=s.step.map(n.slice(r)),u=l&&l.getMap();if(r--,u&&n.appendMap(u,r),l){let c=s.selection&&s.selection.map(n.slice(r));c&&o++;let d=new pn(u.invert(),l,c),h,p=i.length-1;(h=i.length&&i[p].merge(d))?i[p]=h:i.push(d)}}else s.map&&r--},this.items.length,0),new Yt(Ue.from(i.reverse()),o)}}Yt.empty=new Yt(Ue.empty,0);function FF(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class pn{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new pn(n.getMap().invert(),n,this.selection)}}}class ir{constructor(e,n,r,i,o){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const LF=20;function BF(t,e,n,r){let i=n.getMeta(ti),o;if(i)return i.historyState;n.getMeta(jF)&&(t=new ir(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(ti))return s.getMeta(ti).redo?new ir(t.done.addTransform(n,void 0,r,Wa(e)),t.undone,Wg(n.mapping.maps),t.prevTime,t.prevComposition):new ir(t.done,t.undone.addTransform(n,void 0,r,Wa(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!s&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!VF(n,t.prevRanges)),u=s?Uc(t.prevRanges,n.mapping):Wg(n.mapping.maps);return new ir(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,Wa(e)),Yt.empty,u,n.time,a??t.prevComposition)}else return(o=n.getMeta("rebased"))?new ir(t.done.rebased(n,o),t.undone.rebased(n,o),Uc(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new ir(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Uc(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function VF(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&i>=e[o]&&(n=!0)}),n}function Wg(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,o,s)=>e.push(o,s));return e}function Uc(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),o=e.map(t[r+1],-1);i<=o&&n.push(i,o)}return n}function $F(t,e,n){let r=Wa(e),i=ti.get(e).spec.config,o=(n?t.undone:t.done).popEvent(e,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),a=(n?t.done:t.undone).addTransform(o.transform,e.selection.getBookmark(),i,r),l=new ir(n?a:o.remaining,n?o.remaining:a,null,0,-1);return o.transform.setSelection(s).setMeta(ti,{redo:n,historyState:l})}let Kc=!1,Ug=null;function Wa(t){let e=t.plugins;if(Ug!=e){Kc=!1,Ug=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Kc=!0;break}}return Kc}const ti=new ut("history"),jF=new ut("closeHistory");function zF(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new $e({key:ti,state:{init(){return new ir(Yt.empty,Yt.empty,null,0,-1)},apply(e,n,r){return BF(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?vk:r=="historyRedo"?yk:null;return i?(n.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function gk(t,e){return(n,r)=>{let i=ti.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let o=$F(i,n,t);o&&r(o.scrollIntoView())}return!0}}const vk=gk(!1),yk=gk(!0),HF=Ge.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>vk(t,e),redo:()=>({state:t,dispatch:e})=>yk(t,e)}},addProseMirrorPlugins(){return[zF(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),qF=on.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",tt(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{const{selection:n}=e,{$from:r,$to:i}=n,o=t();return r.parentOffset===0?o.insertContentAt({from:Math.max(r.pos-1,0),to:i.pos},{type:this.name}):$0(n)?o.insertContentAt(i.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({tr:s,dispatch:a})=>{var l;if(a){const{$to:u}=s.selection,c=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?s.setSelection(ae.create(s.doc,u.pos+1)):u.nodeAfter.isBlock?s.setSelection(Z.create(s.doc,u.pos)):s.setSelection(ae.create(s.doc,u.pos));else{const d=(l=u.parent.type.contentMatch.defaultType)===null||l===void 0?void 0:l.create();d&&(s.insert(c,d),s.setSelection(ae.create(s.doc,c+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[ZN({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),WF=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,UF=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,KF=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,GF=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,JF=Wn.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",tt(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[uo({find:WF,type:this.type}),uo({find:KF,type:this.type})]},addPasteRules(){return[di({find:UF,type:this.type}),di({find:GF,type:this.type})]}}),YF=on.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",tt(this.options.HTMLAttributes,t),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)}}}),XF="listItem",Kg="textStyle",Gg=/^(\d+)\.\s$/,ZF=on.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",tt(this.options.HTMLAttributes,n),0]:["ol",tt(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(XF,this.editor.getAttributes(Kg)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Ss({find:Gg,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Ss({find:Gg,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Kg)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),QF=on.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",tt(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),eL=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,tL=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,nL=Wn.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",tt(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[uo({find:eL,type:this.type})]},addPasteRules(){return[di({find:tL,type:this.type})]}}),rL=on.create({name:"text",group:"inline"}),iL=Ge.create({name:"starterKit",addExtensions(){var t,e,n,r,i,o,s,a,l,u,c,d,h,p,f,m,g,b;const y=[];return this.options.bold!==!1&&y.push(dF.configure((t=this.options)===null||t===void 0?void 0:t.bold)),this.options.blockquote!==!1&&y.push(sF.configure((e=this.options)===null||e===void 0?void 0:e.blockquote)),this.options.bulletList!==!1&&y.push(hF.configure((n=this.options)===null||n===void 0?void 0:n.bulletList)),this.options.code!==!1&&y.push(gF.configure((r=this.options)===null||r===void 0?void 0:r.code)),this.options.codeBlock!==!1&&y.push(bF.configure((i=this.options)===null||i===void 0?void 0:i.codeBlock)),this.options.document!==!1&&y.push(kF.configure((o=this.options)===null||o===void 0?void 0:o.document)),this.options.dropcursor!==!1&&y.push(EF.configure((s=this.options)===null||s===void 0?void 0:s.dropcursor)),this.options.gapcursor!==!1&&y.push(DF.configure((a=this.options)===null||a===void 0?void 0:a.gapcursor)),this.options.hardBreak!==!1&&y.push(IF.configure((l=this.options)===null||l===void 0?void 0:l.hardBreak)),this.options.heading!==!1&&y.push(NF.configure((u=this.options)===null||u===void 0?void 0:u.heading)),this.options.history!==!1&&y.push(HF.configure((c=this.options)===null||c===void 0?void 0:c.history)),this.options.horizontalRule!==!1&&y.push(qF.configure((d=this.options)===null||d===void 0?void 0:d.horizontalRule)),this.options.italic!==!1&&y.push(JF.configure((h=this.options)===null||h===void 0?void 0:h.italic)),this.options.listItem!==!1&&y.push(YF.configure((p=this.options)===null||p===void 0?void 0:p.listItem)),this.options.orderedList!==!1&&y.push(ZF.configure((f=this.options)===null||f===void 0?void 0:f.orderedList)),this.options.paragraph!==!1&&y.push(QF.configure((m=this.options)===null||m===void 0?void 0:m.paragraph)),this.options.strike!==!1&&y.push(nL.configure((g=this.options)===null||g===void 0?void 0:g.strike)),this.options.text!==!1&&y.push(rL.configure((b=this.options)===null||b===void 0?void 0:b.text)),y}}),oL={class:"k-richtext__menu"},KL=Q({__name:"RichText",props:{modelValue:{default:""},disabled:{type:Boolean},actions:{default:()=>["heading2","bold","italic","orderedList","bulletList"]},placeholder:{default:"Write something..."}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=RP({extensions:[iL,iF.configure({placeholder:n.placeholder}),rF.configure({defaultProtocol:"https",protocols:["mailto"],HTMLAttributes:{class:"",rel:"noopener noreferrer nofollow",target:"_blank"}})],editable:!n.disabled,content:n.modelValue,onUpdate:({editor:a})=>{r("update:modelValue",a.getHTML())}}),o=I(()=>!i||!i.value?[]:[{id:"heading2",icon:"fa-pro-regular:heading",action:()=>{var a;return(a=i.value)==null?void 0:a.chain().focus().toggleHeading({level:2}).run()},isActive:()=>{var a;return(a=i.value)==null?void 0:a.isActive("heading",{level:2})}},{id:"bold",icon:"fa-pro-regular:bold",action:()=>{var a;return(a=i.value)==null?void 0:a.chain().focus().toggleBold().run()},isActive:()=>{var a;return(a=i.value)==null?void 0:a.isActive("bold")}},{id:"italic",icon:"fa-pro-regular:italic",action:()=>{var a;return(a=i.value)==null?void 0:a.chain().focus().toggleItalic().run()},isActive:()=>{var a;return(a=i.value)==null?void 0:a.isActive("italic")}},{id:"orderedList",icon:"fa-pro-regular:list-ol",action:()=>{var a;return(a=i.value)==null?void 0:a.chain().focus().toggleOrderedList().run()},isActive:()=>{var a;return(a=i.value)==null?void 0:a.isActive("orderedList")}},{id:"bulletList",icon:"fa-pro-regular:list-ul",action:()=>{var a;return(a=i.value)==null?void 0:a.chain().focus().toggleBulletList().run()},isActive:()=>{var a;return(a=i.value)==null?void 0:a.isActive("bulletList")}}].filter(a=>n.actions.includes(a.id))),s=rn("k-richtext",{variants:{disabled:{true:"k-richtext--disabled"}}});return we(()=>n.modelValue,()=>{if(i.value&&i.value.getHTML()!==n.modelValue)return i.value.commands.setContent(n.modelValue)}),(a,l)=>(E(),O("div",{class:Se(B(s)({disabled:a.disabled}))},[U("div",oL,[he(ib,{class:"k-richtext__menu-group",modelValue:[],multiple:!0},{default:ee(({getItemProps:u})=>[(E(!0),O(Oe,null,_t(o.value,c=>(E(),H(He,{disabled:a.disabled,variant:"tertiary",class:"k-richtext__item","data-part":"item","data-state":`${c.isActive()?"on":"off"}`,onClick:()=>c.action(),icon:c.icon},null,8,["disabled","data-state","onClick","icon"]))),256))]),_:1})]),he(B(NP),{editor:B(i),class:"k-richtext__editor"},null,8,["editor"])],2))}});function sL(t){return t%4===0&&t%100!==0||t%400===0}function aL(t=""){if(t.length===10){let e=t.replace(".","-").replace("/","-").split("-");if(e.length===3&&e[0].length===4){let n=parseInt(e[0]),r=parseInt(e[1]),i=parseInt(e[2]);if(r===2){if(sL(n)){if(i>29)return!1}else if(i>28)return!1}if((r===4||r===6||r===9||r===11)&&i>30)return!1}return!0}return!0}function Nn(t){let e;if(typeof t=="number"&&(e=new Date(t),typeof e=="object"))return!0;if(e=new Date(t),typeof e=="object")return!(e.toString()==="Invalid Date"||!aL(t));var n=/^\d{4}\-\d{1,2}\-\d{1,2}$/;if(!n.test(t))return!1;var r=t.split("-"),i=parseInt(r[2],10),o=parseInt(r[1],10),s=parseInt(r[0],10);if(s<1e3||s>3e3||o==0||o>12)return!1;var a=[31,28,31,30,31,30,31,31,30,31,30,31];return(s%400==0||s%100!=0&&s%4==0)&&(a[1]=29),i>0&&i<=a[o-1]}var ru={required:function(t){var e;return t==null?!1:(e=String(t).replace(/\s/g,""),e.length>0)},required_if:function(t,e,n){return e=this.getParameters(),this.validator._objectPath(this.validator.input,e[0])===e[1]?this.validator.getRule("required").validate(t):!0},required_unless:function(t,e,n){return e=this.getParameters(),this.validator._objectPath(this.validator.input,e[0])!==e[1]?this.validator.getRule("required").validate(t):!0},required_with:function(t,e,n){return this.validator._objectPath(this.validator.input,e)?this.validator.getRule("required").validate(t):!0},required_with_all:function(t,e,n){e=this.getParameters();for(var r=0;r<e.length;r++)if(!this.validator._objectPath(this.validator.input,e[r]))return!0;return this.validator.getRule("required").validate(t)},required_without:function(t,e,n){return this.validator._objectPath(this.validator.input,e)?!0:this.validator.getRule("required").validate(t)},required_without_all:function(t,e,n){e=this.getParameters();for(var r=0;r<e.length;r++)if(this.validator._objectPath(this.validator.input,e[r]))return!0;return this.validator.getRule("required").validate(t)},boolean:function(t){return t===!0||t===!1||t===0||t===1||t==="0"||t==="1"||t==="true"||t==="false"},size:function(t,e,n){if(t){e=parseFloat(e);var r=this.getSize();return r===e}return!0},string:function(t,e,n){return typeof t=="string"},sometimes:function(t){return!0},min:function(t,e,n){var r=this.getSize();return r>=e},max:function(t,e,n){var r=this.getSize();return r<=e},between:function(t,e,n){e=this.getParameters();var r=this.getSize(),i=parseFloat(e[0],10),o=parseFloat(e[1],10);return r>=i&&r<=o},email:function(t){var e=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return e.test(t)||(e=/^((?:[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]|[^\u0000-\u007F])+@(?:[a-zA-Z0-9]|[^\u0000-\u007F])(?:(?:[a-zA-Z0-9-]|[^\u0000-\u007F]){0,61}(?:[a-zA-Z0-9]|[^\u0000-\u007F]))?(?:\.(?:[a-zA-Z0-9]|[^\u0000-\u007F])(?:(?:[a-zA-Z0-9-]|[^\u0000-\u007F]){0,61}(?:[a-zA-Z0-9]|[^\u0000-\u007F]))?)+)*$/),e.test(t)},numeric:function(t){var e;return e=Number(t),typeof e=="number"&&!isNaN(e)&&typeof t!="boolean"},array:function(t){return t instanceof Array},url:function(t){return/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_\+.~#?&/=]*)/i.test(t)},alpha:function(t){return/^[a-zA-Z]+$/.test(t)},alpha_dash:function(t){return/^[a-zA-Z0-9_\-]+$/.test(t)},alpha_num:function(t){return/^[a-zA-Z0-9]+$/.test(t)},same:function(t,e){var n=this.validator._flattenObject(this.validator.input)[e],r=t;return n===r},different:function(t,e){var n=this.validator._flattenObject(this.validator.input)[e],r=t;return n!==r},in:function(t,e){var n,r;if(t&&(n=this.getParameters()),t&&!(t instanceof Array)){var i=t;for(r=0;r<n.length;r++)if(typeof n[r]=="string"&&(i=String(t)),i===n[r])return!0;return!1}if(t&&t instanceof Array){for(r=0;r<t.length;r++)if(n.indexOf(t[r])<0)return!1}return!0},not_in:function(t,e){for(var n=this.getParameters(),r=n.length,i=!0,o=0;o<r;o++){var s=t;if(typeof n[o]=="string"&&(s=String(t)),s===n[o]){i=!1;break}}return i},accepted:function(t){return t==="on"||t==="yes"||t===1||t==="1"||t===!0},confirmed:function(t,e,n){var r=n+"_confirmation";return this.validator.input[r]===t},integer:function(t){return String(parseInt(t,10))===String(t)},digits:function(t,e){var n=this.validator.getRule("numeric");return!!(n.validate(t)&&String(t.trim()).length===parseInt(e))},digits_between:function(t){var e=this.validator.getRule("numeric"),n=this.getParameters(),r=String(t).length,i=parseFloat(n[0],10),o=parseFloat(n[1],10);return!!(e.validate(t)&&r>=i&&r<=o)},regex:function(t,e){var n=/[g|i|m]{1,3}$/,r=e.match(n);return r=r?r[0]:"",e=e.replace(n,"").slice(1,-1),e=new RegExp(e,r),!!e.test(t)},date:function(t,e){return Nn(t)},present:function(t){return typeof t<"u"},after:function(t,e){var n=this.validator.input[e],r=t;return!Nn(n)||!Nn(r)?!1:new Date(n).getTime()<new Date(r).getTime()},after_or_equal:function(t,e){var n=this.validator.input[e],r=t;return!Nn(n)||!Nn(r)?!1:new Date(n).getTime()<=new Date(r).getTime()},before:function(t,e){var n=this.validator.input[e],r=t;return!Nn(n)||!Nn(r)?!1:new Date(n).getTime()>new Date(r).getTime()},before_or_equal:function(t,e){var n=this.validator.input[e],r=t;return!Nn(n)||!Nn(r)?!1:new Date(n).getTime()>=new Date(r).getTime()},hex:function(t){return/^[0-9a-f]+$/i.test(t)},ipv4:function(t,e,n){if(typeof t!="string")return!1;var r=/^[0-9]+$/;if(octets=t.split("."),octets.length!=4)return!1;for(let o=0;o<octets.length;o++){const s=octets[o];if(!r.test(s))return!1;var i=parseInt(s);if(i>=256)return!1}return!0},ipv6:function(t,e,n){if(typeof t!="string")return!1;var r=/^[0-9a-f]+$/;if(hextets=t.split(":"),colons=t.match(/::/),colons!=null&&t.match(/::/g).length>1||t[0]==":"&&(colons==null||colons!=null&&colons.index!=0)||t[t.length-1]==":"&&(colons==null||colons!=null&&colons.index!=t.length-2)||3>hextets.length)return!1;var i=hextets.length==9&&colons!=null&&(colons.index==0||colons.index==t.length-2);if(hextets.length>8&&!i||hextets.length!=8&&colons==null)return!1;for(let o=0;o<hextets.length;o++){const s=hextets[o];if(s.length!=0&&(!r.test(s)||s.length>4))return!1}return!0},ip:function(t,e,n){return ru.ipv4(t,e,n)||ru.ipv6(t,e,n)}},bk=function(){throw new Error("Validator `"+this.name+"` is not defined!")},kk;function wk(t,e,n){this.name=t,this.fn=e,this.passes=null,this._customMessage=void 0,this.async=n}wk.prototype={validate:function(t,e,n,r){var i=this;if(this._setValidatingData(n,t,e),typeof r=="function"){this.callback=r;var o=function(s,a){i.response(s,a)};return this.async?this._apply(t,e,n,o):o(this._apply(t,e,n))}return this._apply(t,e,n)},_apply:function(t,e,n,r){var i=this.isMissed()?bk:this.fn;return i.apply(this,[t,e,n,r])},_setValidatingData:function(t,e,n){this.attribute=t,this.inputValue=e,this.ruleValue=n},getParameters:function(){var t=[];return typeof this.ruleValue=="string"&&(t=this.ruleValue.split(",")),typeof this.ruleValue=="number"&&t.push(this.ruleValue),this.ruleValue instanceof Array&&(t=this.ruleValue),t},getSize:function(){var t=this.inputValue;return t instanceof Array?t.length:typeof t=="number"?t:this.validator._hasNumericRule(this.attribute)?parseFloat(t,10):t.length},_getValueType:function(){return typeof this.inputValue=="number"||this.validator._hasNumericRule(this.attribute)?"numeric":"string"},response:function(t,e){this.passes=t===void 0||t===!0,this._customMessage=e,this.callback(this.passes,e)},setValidator:function(t){this.validator=t},isMissed:function(){return typeof this.fn!="function"},get customMessage(){return this.isMissed()?kk:this._customMessage}};var lL={asyncRules:[],implicitRules:["required","required_if","required_unless","required_with","required_with_all","required_without","required_without_all","accepted","present"],make:function(t,e){var n=this.isAsync(t),r=new wk(t,ru[t],n);return r.setValidator(e),r},isAsync:function(t){for(var e=0,n=this.asyncRules.length;e<n;e++)if(this.asyncRules[e]===t)return!0;return!1},isImplicit:function(t){return this.implicitRules.indexOf(t)>-1},register:function(t,e){ru[t]=e},registerImplicit:function(t,e){this.register(t,e),this.implicitRules.push(t)},registerAsync:function(t,e){this.register(t,e),this.asyncRules.push(t)},registerAsyncImplicit:function(t,e){this.registerImplicit(t,e),this.asyncRules.push(t)},registerMissedRuleValidator:function(t,e){bk=t,kk=e}},uL=lL;function cL(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var dL={between:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{min:n[0],max:n[1]})},digits_between:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{min:n[0],max:n[1]})},required_if:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{other:this._getAttributeName(n[0]),value:n[1]})},required_unless:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{other:this._getAttributeName(n[0]),value:n[1]})},required_with:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{field:this._getAttributeName(n[0])})},required_with_all:function(t,e){var n=e.getParameters(),r=this._getAttributeName.bind(this);return this._replacePlaceholders(e,t,{fields:n.map(r).join(", ")})},required_without:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{field:this._getAttributeName(n[0])})},required_without_all:function(t,e){var n=e.getParameters(),r=this._getAttributeName.bind(this);return this._replacePlaceholders(e,t,{fields:n.map(r).join(", ")})},after:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{after:this._getAttributeName(n[0])})},before:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{before:this._getAttributeName(n[0])})},after_or_equal:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{after_or_equal:this._getAttributeName(n[0])})},before_or_equal:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{before_or_equal:this._getAttributeName(n[0])})},same:function(t,e){var n=e.getParameters();return this._replacePlaceholders(e,t,{same:this._getAttributeName(n[0])})}};function pL(t){return t.replace(/[_\[]/g," ").replace(/]/g,"")}var xk={replacements:dL,formatter:pL},Jg=xk,lp=function(t,e){this.lang=t,this.messages=e,this.customMessages={},this.attributeNames={}};lp.prototype={constructor:lp,_setCustom:function(t){this.customMessages=t||{}},_setAttributeNames:function(t){this.attributeNames=t},_setAttributeFormatter:function(t){this.attributeFormatter=t},_getAttributeName:function(t){var e=t;return this.attributeNames.hasOwnProperty(t)?this.attributeNames[t]:(this.messages.attributes.hasOwnProperty(t)&&(e=this.messages.attributes[t]),this.attributeFormatter&&(e=this.attributeFormatter(e)),e)},all:function(){return this.messages},render:function(t){if(t.customMessage)return t.customMessage;var e=this._getTemplate(t),n;return Jg.replacements[t.name]?n=Jg.replacements[t.name].apply(this,[e,t]):n=this._replacePlaceholders(t,e,{}),n},_getTemplate:function(t){for(var e=this.messages,n=e.def,r=this.customMessages,i=[t.name+"."+t.attribute,t.name],o=0,s;o<i.length;o++)if(s=i[o],r.hasOwnProperty(s)){n=r[s];break}else if(e.hasOwnProperty(s)){n=e[s];break}return typeof n=="object"&&(n=n[t._getValueType()]),n},_replacePlaceholders:function(t,e,n){var r,i;if(n.attribute=this._getAttributeName(t.attribute),n[t.name]=n[t.name]||t.getParameters().join(","),typeof e=="string"&&typeof n=="object"){r=e;for(i in n)r=r.replace(new RegExp(":"+i,"g"),n[i])}return r}};var hL=lp,fL={accepted:"The :attribute must be accepted.",after:"The :attribute must be after :after.",after_or_equal:"The :attribute must be equal or after :after_or_equal.",alpha:"The :attribute field must contain only alphabetic characters.",alpha_dash:"The :attribute field may only contain alpha-numeric characters, as well as dashes and underscores.",alpha_num:"The :attribute field must be alphanumeric.",before:"The :attribute must be before :before.",before_or_equal:"The :attribute must be equal or before :before_or_equal.",between:{numeric:"The :attribute field must be between :min and :max.",string:"The :attribute field must be between :min and :max characters."},confirmed:"The :attribute confirmation does not match.",email:"The :attribute format is invalid.",date:"The :attribute is not a valid date format.",def:"The :attribute attribute has errors.",digits:"The :attribute must be :digits digits.",digits_between:"The :attribute field must be between :min and :max digits.",different:"The :attribute and :different must be different.",in:"The selected :attribute is invalid.",integer:"The :attribute must be an integer.",hex:"The :attribute field should have hexadecimal format",min:{numeric:"The :attribute must be at least :min.",string:"The :attribute must be at least :min characters."},max:{numeric:"The :attribute may not be greater than :max.",string:"The :attribute may not be greater than :max characters."},not_in:"The selected :attribute is invalid.",numeric:"The :attribute must be a number.",present:"The :attribute field must be present (but can be empty).",required:"The :attribute field is required.",required_if:"The :attribute field is required when :other is :value.",required_unless:"The :attribute field is required when :other is not :value.",required_with:"The :attribute field is required when :field is not empty.",required_with_all:"The :attribute field is required when :fields are not empty.",required_without:"The :attribute field is required when :field is empty.",required_without_all:"The :attribute field is required when :fields are empty.",same:"The :attribute and :same fields must match.",size:{numeric:"The :attribute must be :size.",string:"The :attribute must be :size characters."},string:"The :attribute must be a string.",url:"The :attribute format is invalid.",regex:"The :attribute format is invalid.",attributes:{}};const mL=Su(fL);var gL=hL,vL=cL,yL={messages:{},_set:function(t,e){this.messages[t]=e},_setRuleMessage:function(t,e,n){this._load(t),n===void 0&&(n=this.messages[t].def),this.messages[t][e]=n},_load:function(t){if(!this.messages[t])try{var e=vL("./lang/"+t);this._set(t,e)}catch{}},_get:function(t){return this._load(t),this.messages[t]},_make:function(t){return this._load(t),new gL(t,this.messages[t])}},Ek=yL;const Ck=Su(Ek);var up=function(){this.errors={}};up.prototype={constructor:up,add:function(t,e){this.has(t)||(this.errors[t]=[]),this.errors[t].indexOf(e)===-1&&this.errors[t].push(e)},get:function(t){return this.has(t)?this.errors[t]:[]},first:function(t){return this.has(t)?this.errors[t][0]:!1},all:function(){return this.errors},has:function(t){return!!this.errors.hasOwnProperty(t)}};var bL=up;function Sk(t,e){this.onResolvedAll=e,this.onFailedOne=t,this.resolvers={},this.resolversCount=0,this.passed=[],this.failed=[],this.firing=!1}Sk.prototype={add:function(t){var e=this.resolversCount;return this.resolvers[e]=t,this.resolversCount++,e},resolve:function(t){var e=this.resolvers[t];e.passes===!0?this.passed.push(e):e.passes===!1&&(this.failed.push(e),this.onFailedOne(e)),this.fire()},isAllResolved:function(){return this.passed.length+this.failed.length===this.resolversCount},fire:function(){this.firing&&this.isAllResolved()&&this.onResolvedAll(this.failed.length===0)},enableFiring:function(){this.firing=!0}};var kL=Sk,wr=uL,ki=Ek,wL=bL,xL=xk,EL=kL,Ve=function(t,e,n){var r=Ve.getDefaultLang();this.input=t||{},this.messages=ki._make(r),this.messages._setCustom(n),this.setAttributeFormatter(Ve.prototype.attributeFormatter),this.errors=new wL,this.errorCount=0,this.hasAsync=!1,this.rules=this._parseRules(e)};Ve.prototype={constructor:Ve,lang:"en",numericRules:["integer","numeric"],attributeFormatter:xL.formatter,check:function(){for(var t in this.rules){var e=this.rules[t],n=this._objectPath(this.input,t);if(!(this._hasRule(t,["sometimes"])&&!this._suppliedWithData(t)))for(var r=0,i=e.length,o,s,a;r<i&&(s=e[r],o=this.getRule(s.name),!(this._isValidatable(o,n)&&(a=o.validate(n,s.value,t),a||this._addFailure(o),this._shouldStopValidating(t,a))));r++);}return this.errorCount===0},checkAsync:function(t,e){var n=this;t=t||function(){},e=e||function(){};var r=function(f,m){n._addFailure(f,m)},i=function(f){f?t():e()},o=new EL(r,i),s=function(f,m,g,b){return function(){var y=o.add(b);b.validate(f,m.value,g,function(){o.resolve(y)})}};for(var a in this.rules){var l=this.rules[a],u=this._objectPath(this.input,a);if(!(this._hasRule(a,["sometimes"])&&!this._suppliedWithData(a)))for(var c=0,d=l.length,h,p;c<d;c++)p=l[c],h=this.getRule(p.name),this._isValidatable(h,u)&&s(u,p,a,h)()}o.enableFiring(),o.fire()},_addFailure:function(t){var e=this.messages.render(t);this.errors.add(t.attribute,e),this.errorCount++},_flattenObject:function(t){var e={};function n(r,i){if(!(!i&&Object.getOwnPropertyNames(r).length===0))if(Object(r)!==r||Array.isArray(r))e[i]=r;else{var o=!0;for(var s in r)o=!1,n(r[s],i?i+"."+s:s);o&&(e[i]={})}}return t&&n(t),e},_objectPath:function(t,e){if(Object.prototype.hasOwnProperty.call(t,e))return t[e];var n=e.replace(/\[(\w+)\]/g,".$1").replace(/^\./,"").split("."),r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i]);for(var o=0,s=n.length;o<s;o++)if(typeof r=="object"&&r!==null&&Object.hasOwnProperty.call(r,n[o]))r=r[n[o]];else return;return r},_parseRules:function(t){var e={};t=this._flattenObject(t);for(var n in t){var r=t[n];this._parseRulesCheck(n,r,e)}return e},_parseRulesCheck:function(t,e,n,r){t.indexOf("*")>-1?this._parsedRulesRecurse(t,e,n,r):this._parseRulesDefault(t,e,n,r)},_parsedRulesRecurse:function(t,e,n,r){var i=t.substr(0,t.indexOf("*")-1),o=this._objectPath(this.input,i);if(o)for(var s=0;s<o.length;s++){var a=r?r.slice():[];a.push(s),this._parseRulesCheck(t.replace("*",s),e,n,a)}},_parseRulesDefault:function(t,e,n,r){var i=[];e instanceof Array&&(e=this._prepareRulesArray(e)),typeof e=="string"&&(e=e.split("|"));for(var o=0,s=e.length,a;o<s;o++)a=typeof e[o]=="string"?this._extractRuleAndRuleValue(e[o]):e[o],a.value&&(a.value=this._replaceWildCards(a.value,r),this._replaceWildCardsMessages(r)),wr.isAsync(a.name)&&(this.hasAsync=!0),i.push(a);n[t]=i},_replaceWildCards:function(t,e){if(!e)return t;var n=t;return e.forEach(function(r){Array.isArray(n)&&(n=n[0]);const i=n.indexOf("*");if(i===-1)return n;n=n.substr(0,i)+r+n.substr(i+1)}),Array.isArray(t)&&(t[0]=n,n=t),n},_replaceWildCardsMessages:function(t){var e=this.messages.customMessages,n=this;Object.keys(e).forEach(function(r){if(t){var i=n._replaceWildCards(r,t);e[i]=e[r]}}),this.messages._setCustom(e)},_prepareRulesArray:function(t){for(var e=[],n=0,r=t.length;n<r;n++)if(typeof t[n]=="object")for(var i in t[n])e.push({name:i,value:t[n][i]});else e.push(t[n]);return e},_suppliedWithData:function(t){return this.input.hasOwnProperty(t)},_extractRuleAndRuleValue:function(t){var e={},n;return e.name=t,t.indexOf(":")>=0&&(n=t.split(":"),e.name=n[0],e.value=n.slice(1).join(":")),e},_hasRule:function(t,e){for(var n=this.rules[t]||[],r=0,i=n.length;r<i;r++)if(e.indexOf(n[r].name)>-1)return!0;return!1},_hasNumericRule:function(t){return this._hasRule(t,this.numericRules)},_isValidatable:function(t,e){return Array.isArray(e)||wr.isImplicit(t.name)?!0:this.getRule("required").validate(e)},_shouldStopValidating:function(t,e){var n=this.stopOnAttributes;return typeof n>"u"||n===!1||e===!0?!1:n instanceof Array?n.indexOf(t)>-1:!0},setAttributeNames:function(t){this.messages._setAttributeNames(t)},setAttributeFormatter:function(t){this.messages._setAttributeFormatter(t)},getRule:function(t){return wr.make(t,this)},stopOnError:function(t){this.stopOnAttributes=t},passes:function(t){var e=this._checkAsync("passes",t);return e?this.checkAsync(t):this.check()},fails:function(t){var e=this._checkAsync("fails",t);return e?this.checkAsync(function(){},t):!this.check()},_checkAsync:function(t,e){var n=typeof e=="function";if(this.hasAsync&&!n)throw t+" expects a callback when async rules are being tested.";return this.hasAsync||n}};Ve.setMessages=function(t,e){return ki._set(t,e),this};Ve.getMessages=function(t){return ki._get(t)};Ve.useLang=function(t){this.prototype.lang=t};Ve.getDefaultLang=function(){return this.prototype.lang};Ve.setAttributeFormatter=function(t){this.prototype.attributeFormatter=t};Ve.stopOnError=function(t){this.prototype.stopOnAttributes=t};Ve.register=function(t,e,n,r){var i=Ve.getDefaultLang();wr.register(t,e),ki._setRuleMessage(i,t,n)};Ve.registerImplicit=function(t,e,n,r){var i=Ve.getDefaultLang();wr.registerImplicit(t,e),ki._setRuleMessage(i,t,n)};Ve.registerAsync=function(t,e,n,r){var i=Ve.getDefaultLang();wr.registerAsync(t,e),ki._setRuleMessage(i,t,n)};Ve.registerAsyncImplicit=function(t,e,n){var r=Ve.getDefaultLang();wr.registerAsyncImplicit(t,e),ki._setRuleMessage(r,t,n)};Ve.registerMissedRuleValidator=function(t,e){wr.registerMissedRuleValidator(t,e)};var CL=Ve;const pr=Su(CL);Ck._set("en",mL);pr.useLang("en");const cp=z(!1),SL=t=>{cp.value=!cp.value,Ck._set("default",t),pr.useLang("default")},TL=(t,e)=>Object.fromEntries(Object.entries(t).map(([n,r])=>{const i=n.split(".").pop();return[n,e(i)]})),dp=(t,e={})=>{const{rule:n="required",prefix:r=""}=e;let i={};return Object.entries(t).forEach(([o,s])=>{const a=r+o;if(Uw(s)){s.map((l,u)=>{i=Object.assign(i,dp(l,{rule:n,prefix:`${a}.${u}.`}))});return}if(Ww(s)){i=Object.assign(i,dp(s,{rule:n,prefix:`${a}.`}));return}i[a]=n}),i},OL=pr.register,AL=pr.registerAsync;function ML(t={}){const{rules:e,labels:n,data:r,customMessages:i,visitImmediate:o=!1}=t;if(i){let m=pr.getMessages("default");Object.entries(i.value).forEach(([g,b])=>m[g]=b),pr.setMessages("default",m)}let s=new pr({},{}),a=()=>Object.fromEntries(Object.keys(e.value).map(m=>[m,{rule:e.value[m],valid:!c.value.get(m).length,error:c.value.first(m)||void 0,visited:l.value[m]}])),l=z(o?Object.fromEntries(Object.keys(e.value).map(m=>[m,!0])):{}),u=z(!0),c=z(s.errors),d=I(()=>a());function h(m){var g;let b=(g=d.value)==null?void 0:g[m];const y={valid:!0,error:void 0};return!b||!b.visited?y:b}let p=()=>{let m=new pr(r.value,e.value);n&&m.setAttributeNames(n.value);const g=()=>{c.value=s.errors,u.value=!0},b=()=>{u.value=!1,c.value=m.errors};m.checkAsync(g,b)};we([r,cp],p,{deep:!0,immediate:!0});const f=m=>{if(!m)return!1;const g=typeof m=="string"?m.split("|"):Array.isArray(m)?m:[],b={required:()=>!0,required_if:(y,k)=>r.value[y]===k,required_unless:(y,k)=>r.value[y]!==k,required_with:y=>y.some(k=>k in r.value),required_with_all:y=>y.every(k=>k in r.value),required_without:y=>y.some(k=>!(k in r.value)),required_without_all:y=>y.every(k=>!(k in r.value))};for(const y of g){if(typeof y=="string"){if(y==="required")return b.required;const[k,...v]=y.split(":");if(b[k]){const w=v.map(x=>["true",!0,"false",!1].includes(x)?JSON.parse(x):x);return b[k](...w)}}if(typeof y=="object"){for(const[k,v]of Object.entries(y))if(b[k])return Array.isArray(v)?b[k](...v):b[k](v)}}return!1};return{onChange:p,errors:c,passes:u,fields:d,bind:m=>({onBlur:()=>l.value[m]=!0,error:h(m).error,required:f(e.value[m])})}}const GL=Object.freeze(Object.defineProperty({__proto__:null,default:ML,generateLabels:TL,generateRules:dp,register:OL,registerAsync:AL,setLabels:SL},Symbol.toStringTag,{value:"Module"}));export{KL as $,VL as A,vv as B,RL as E,qL as F,Eu as G,jL as I,WL as L,$L as M,zL as N,BL as O,HL as P,QE as S,LL as T,Qe as U,bu as W,ri as _,He as a,gf as b,FL as c,NL as d,UL as e,ML as f,X1 as g,RE as h,DL as m,wT as u,IL as v,ib as w,PL as x,GL as z};
|