autoforma 1.1.0 → 1.1.1
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/components/AutoForm/AutoForm.types.d.ts +3 -8
- package/dist/fields/renderer-resolver/FieldFieldTypeHandler.d.ts +10 -0
- package/dist/fields/renderer-resolver/RendererHandler.d.ts +1 -1
- package/dist/fields/renderer-resolver/RendererResolverChain.d.ts +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +19 -7
- package/package.json +1 -1
|
@@ -28,14 +28,9 @@ export interface AutoFormProps<FormValues extends Record<string, any> = Record<s
|
|
|
28
28
|
onSubmit: (values: FormValues) => void | Promise<void>;
|
|
29
29
|
postSubmit?: (values: FormValues) => void | Promise<void>;
|
|
30
30
|
uiConfig?: {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
align?: "start" | "center" | "end";
|
|
35
|
-
};
|
|
36
|
-
customTypeRenderer?: Record<string, React.ComponentType<FieldRendererProps<FormValues>>>;
|
|
37
|
-
customFieldNameRenderer?: Record<string, React.ComponentType<FieldRendererProps<FormValues>>>;
|
|
38
|
-
customFieldTypeRenderer?: Record<string, React.ComponentType<FieldRendererProps<FormValues>>>;
|
|
31
|
+
customTypeRenderers?: Record<string, React.ComponentType<FieldRendererProps<FormValues>>>;
|
|
32
|
+
customFieldNameRenderers?: Record<string, React.ComponentType<FieldRendererProps<FormValues>>>;
|
|
33
|
+
customFieldTypeRenderers?: Record<string, React.ComponentType<FieldRendererProps<FormValues>>>;
|
|
39
34
|
};
|
|
40
35
|
}
|
|
41
36
|
export interface AutoFormRef {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FieldSchema } from '../types';
|
|
2
|
+
import { RendererHandler } from './RendererHandler';
|
|
3
|
+
import { FieldRendererProps } from '../../components/AutoForm/AutoForm.types';
|
|
4
|
+
import { default as React } from 'react';
|
|
5
|
+
export declare class FieldFieldTypeHandler implements RendererHandler {
|
|
6
|
+
private renderers;
|
|
7
|
+
constructor(renderers: Record<string, React.ComponentType<FieldRendererProps>>);
|
|
8
|
+
canHandle(field: FieldSchema): boolean;
|
|
9
|
+
resolve(field: FieldSchema): React.ComponentType<FieldRendererProps<any>>;
|
|
10
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FieldRendererProps } from '../../components/AutoForm/AutoForm';
|
|
1
|
+
import { FieldRendererProps } from '../../components/AutoForm/AutoForm.types';
|
|
2
2
|
import { FieldSchema } from '../types';
|
|
3
3
|
export interface RendererHandler {
|
|
4
4
|
canHandle(field: FieldSchema): boolean;
|
|
@@ -3,5 +3,5 @@ import { RendererHandler } from './RendererHandler';
|
|
|
3
3
|
export declare class RendererResolverChain {
|
|
4
4
|
private handlers;
|
|
5
5
|
constructor(handlers: RendererHandler[]);
|
|
6
|
-
resolve(field: FieldSchema): import('react').ComponentType<FieldRendererProps
|
|
6
|
+
resolve(field: FieldSchema): import('react').ComponentType<import('../..').FieldRendererProps<any>> | null;
|
|
7
7
|
}
|
package/dist/index.cjs.js
CHANGED
|
@@ -191,4 +191,4 @@ ${h.slice(c+2)}`,d+=1;else break}e.push({indent:c,number:parseInt(l,10),content:
|
|
|
191
191
|
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Gx,this.editor.getAttributes(nu)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=qn({find:ru,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=qn({find:ru,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(nu)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),Xx=/^\s*(\[([( |x])?\])\s$/,Qx=st.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",Ce(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(n,e)=>{const t=[];if(n.tokens&&n.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(n.tokens))):n.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:n.text})])):t.push(e.createNode("paragraph",{},[])),n.nestedTokens&&n.nestedTokens.length>0){const r=e.parseChildren(n.nestedTokens);t.push(...r)}return e.createNode("taskItem",{checked:n.checked||!1},t)},renderMarkdown:(n,e)=>{var t;const s=`- [${(t=n.attrs)!=null&&t.checked?"x":" "}] `;return Yl(n,e,s)},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const s=document.createElement("li"),o=document.createElement("label"),i=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),c=u=>{var d,f;l.ariaLabel=((f=(d=this.options.a11y)==null?void 0:d.checkboxLabel)==null?void 0:f.call(d,u,l.checked))||`Task item checkbox for ${u.textContent||"empty task item"}`};return c(n),o.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",u=>u.preventDefault()),l.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:d}=u.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{const h=t();if(typeof h!="number")return!1;const p=f.doc.nodeAt(h);return f.setNodeMarkup(h,void 0,{...p==null?void 0:p.attrs,checked:d}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,d)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,d])=>{s.setAttribute(u,d)}),s.dataset.checked=n.attrs.checked,l.checked=n.attrs.checked,o.append(l,i),s.append(o,a),Object.entries(e).forEach(([u,d])=>{s.setAttribute(u,d)}),{dom:s,contentDOM:a,update:u=>u.type!==this.type?!1:(s.dataset.checked=u.attrs.checked,l.checked=u.attrs.checked,c(u),!0)}}},addInputRules(){return[qn({find:Xx,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),Zx=st.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",Ce(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},parseMarkdown:(n,e)=>e.createNode("taskList",{},e.parseChildren(n.items||[])),renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
|
|
192
192
|
`):"",markdownTokenizer:{name:"taskList",level:"block",start(n){var e;const t=(e=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(n,e,t){const r=o=>{const i=Wi(o,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:t.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:r},t);return i?[{type:"taskList",raw:i.raw,items:i.items}]:t.blockTokens(o)},s=Wi(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:o=>({indentLevel:o[1].length,mainContent:o[4],checked:o[3].toLowerCase()==="x"}),createToken:(o,i)=>({type:"taskItem",raw:"",mainContent:o.mainContent,indentLevel:o.indentLevel,checked:o.checked,text:o.mainContent,tokens:t.inlineTokens(o.mainContent),nestedTokens:i}),customNestedParser:r},t);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Ae.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(eh.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(th.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(lh.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(ch.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(Qx.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(Zx.configure(this.options.taskList)),n}});var e1=st.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",Ce(this.options.HTMLAttributes,n),0]},parseMarkdown:(n,e)=>{const t=n.tokens||[];return t.length===1&&t[0].type==="image"?e.parseChildren([t[0]]):e.createNode("paragraph",void 0,e.parseInline(t))},renderMarkdown:(n,e)=>!n||!Array.isArray(n.content)?"":e.renderChildren(n.content),addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),t1=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,n1=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,r1=vt.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",Ce(this.options.HTMLAttributes,n),0]},markdownTokenName:"del",parseMarkdown:(n,e)=>e.applyMark("strike",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`~~${e.renderChildren(n)}~~`,addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[wn({find:t1,type:this.type})]},addPasteRules(){return[Qt({find:n1,type:this.type})]}}),s1=st.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),uh=vt.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",Ce(this.options.HTMLAttributes,n),0]},parseMarkdown(n,e){return e.applyMark(this.name||"underline",e.parseInline(n.tokens||[]))},renderMarkdown(n,e){return`++${e.renderChildren(n)}++`},markdownTokenizer:{name:"underline",level:"inline",start(n){return n.indexOf("++")},tokenize(n,e,t){const s=/^(\+\+)([\s\S]+?)(\+\+)/.exec(n);if(!s)return;const o=s[2].trim();return{type:"underline",raw:s[0],text:o,tokens:t.inlineTokens(o)}}},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),o1=uh;function i1(n={}){return new Te({view(e){return new l1(e,n)}})}class l1{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let o=i=>{this[s](i)};return e.dom.addEventListener(s,o),{name:s,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.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),t=!e.parent.inlineContent,r,s=this.editorView.dom,o=s.getBoundingClientRect(),i=o.width/s.offsetWidth,l=o.height/s.offsetHeight;if(t){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let p=h.getBoundingClientRect(),g=d?p.bottom:p.top;d&&f&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*l;r={left:p.left,right:p.right,top:g-y,bottom:g+y}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*i;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.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",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let c,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=a.getBoundingClientRect(),f=d.width/a.offsetWidth,h=d.height/a.offsetHeight;c=d.left-a.scrollLeft*f,u=d.top-a.scrollTop*h}this.element.style.left=(r.left-c)/i+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/i+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),s=r&&r.type.spec.disableDropCursor,o=typeof s=="function"?s(this.editorView,t,e):s;if(t&&!o){let i=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=dd(this.editorView.state.doc,i,this.editorView.dragging.slice);l!=null&&(i=l)}this.setCursor(i),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class we extends le{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return we.valid(r)?new we(r):le.near(r)}content(){return H.empty}eq(e){return e instanceof we&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new we(e.resolve(t.pos))}getBookmark(){return new na(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!a1(e)||!c1(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let s=t.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&we.valid(e))return e;let s=e.pos,o=null;for(let i=e.depth;;i--){let l=e.node(i);if(t>0?e.indexAfter(i)<l.childCount:e.index(i)>0){o=l.child(t>0?e.indexAfter(i):e.index(i)-1);break}else if(i==0)return null;s+=t;let a=e.doc.resolve(s);if(we.valid(a))return a}for(;;){let i=t>0?o.firstChild:o.lastChild;if(!i){if(o.isAtom&&!o.isText&&!ee.isSelectable(o)){e=e.doc.resolve(s+o.nodeSize*t),r=!1;continue e}break}o=i,s+=t;let l=e.doc.resolve(s);if(we.valid(l))return l}return null}}}we.prototype.visible=!1;we.findFrom=we.findGapCursorFrom;le.jsonID("gapcursor",we);class na{constructor(e){this.pos=e}map(e){return new na(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return we.valid(t)?new we(t):le.near(t)}}function dh(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function a1(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(t-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||dh(s.type))return!0;if(s.inlineContent)return!1}}return!0}function c1(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(t);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||dh(s.type))return!0;if(s.inlineContent)return!1}}return!0}function u1(){return new Te({props:{decorations:p1,createSelectionBetween(n,e,t){return e.pos==t.pos&&we.valid(t)?new we(t):null},handleClick:f1,handleKeyDown:d1,handleDOMEvents:{beforeinput:h1}}})}const d1=ff({ArrowLeft:es("horiz",-1),ArrowRight:es("horiz",1),ArrowUp:es("vert",-1),ArrowDown:es("vert",1)});function es(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,o){let i=r.selection,l=e>0?i.$to:i.$from,a=i.empty;if(i instanceof re){if(!o.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=we.findGapCursorFrom(l,e,a);return c?(s&&s(r.tr.setSelection(new we(c))),!0):!1}}function f1(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!we.valid(r))return!1;let s=n.posAtCoords({left:t.clientX,top:t.clientY});return s&&s.inside>-1&&ee.isSelectable(n.state.doc.nodeAt(s.inside))?!1:(n.dispatch(n.state.tr.setSelection(new we(r))),!0)}function h1(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof we))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let s=L.empty;for(let i=r.length-1;i>=0;i--)s=L.from(r[i].createAndFill(null,s));let o=n.state.tr.replace(t.pos,t.pos,new H(s,0,0));return o.setSelection(re.near(o.doc.resolve(t.pos+1))),n.dispatch(o),!1}function p1(n){if(!(n.selection instanceof we))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Se.create(n.doc,[qe.widget(n.selection.head,e,{key:"gapcursor"})])}var no=200,je=function(){};je.prototype.append=function(e){return e.length?(e=je.from(e),!this.length&&e||e.length<no&&this.leafAppend(e)||this.length<no&&e.leafPrepend(this)||this.appendInner(e)):this};je.prototype.prepend=function(e){return e.length?je.from(e).append(this):this};je.prototype.appendInner=function(e){return new m1(this,e)};je.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?je.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};je.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};je.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};je.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(o,i){return s.push(e(o,i))},t,r),s};je.from=function(e){return e instanceof je?e:e&&e.length?new fh(e):je.empty};var fh=(function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,o){return s==0&&o==this.length?this:new e(this.values.slice(s,o))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,o,i,l){for(var a=o;a<i;a++)if(s(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(s,o,i,l){for(var a=o-1;a>=i;a--)if(s(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=no)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=no)return new e(s.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(je);je.empty=new fh([]);var m1=(function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,s,o,i){var l=this.left.length;if(s<l&&this.left.forEachInner(r,s,Math.min(o,l),i)===!1||o>l&&this.right.forEachInner(r,Math.max(s-l,0),Math.min(this.length,o)-l,i+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,o,i){var l=this.left.length;if(s>l&&this.right.forEachInvertedInner(r,s-l,Math.max(o,l)-l,i+l)===!1||o<l&&this.left.forEachInvertedInner(r,Math.min(s,l),o,i)===!1)return!1},e.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var o=this.left.length;return s<=o?this.left.slice(r,s):r>=o?this.right.slice(r-o,s-o):this.left.slice(r,o).append(this.right.slice(0,s-o))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(je);const g1=500;class ht{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,o;t&&(s=this.remapping(r,this.items.length),o=s.maps.length);let i=e.tr,l,a,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){s||(s=this.remapping(r,f+1),o=s.maps.length),o--,u.push(d);return}if(s){u.push(new bt(d.map));let h=d.step.map(s.slice(o)),p;h&&i.maybeStep(h).doc&&(p=i.mapping.maps[i.mapping.maps.length-1],c.push(new bt(p,void 0,void 0,c.length+u.length))),o--,p&&s.appendMap(p,o)}else i.maybeStep(d.step);if(d.selection)return l=s?d.selection.map(s.slice(o)):d.selection,a=new ht(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:i,selection:l}}addTransform(e,t,r,s){let o=[],i=this.eventCount,l=this.items,a=!s&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new bt(e.mapping.maps[u],d,t),h;(h=a&&a.merge(f))&&(f=h,u?o.pop():l=l.slice(0,l.length-1)),o.push(f),t&&(i++,t=void 0),s||(a=f)}let c=i-r.depth;return c>b1&&(l=y1(l,c),i-=c),new ht(l.append(o),i)}remapping(e,t){let r=new Sr;return this.items.forEach((s,o)=>{let i=s.mirrorOffset!=null&&o-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,i)},e,t),r}addMaps(e){return this.eventCount==0?this:new ht(this.items.append(e.map(t=>new bt(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-t),o=e.mapping,i=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},s);let a=t;this.items.forEach(f=>{let h=o.getMirror(--a);if(h==null)return;i=Math.min(i,h);let p=o.maps[h];if(f.step){let g=e.steps[h].invert(e.docs[h]),y=f.selection&&f.selection.map(o.slice(a+1,h));y&&l++,r.push(new bt(p,g,y))}else r.push(new bt(p))},s);let c=[];for(let f=t;f<i;f++)c.push(new bt(o.maps[f]));let u=this.items.slice(0,s).append(c).append(r),d=new ht(u,l);return d.emptyItemCount()>g1&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,s=[],o=0;return this.items.forEach((i,l)=>{if(l>=e)s.push(i),i.selection&&o++;else if(i.step){let a=i.step.map(t.slice(r)),c=a&&a.getMap();if(r--,c&&t.appendMap(c,r),a){let u=i.selection&&i.selection.map(t.slice(r));u&&o++;let d=new bt(c.invert(),a,u),f,h=s.length-1;(f=s.length&&s[h].merge(d))?s[h]=f:s.push(d)}}else i.map&&r--},this.items.length,0),new ht(je.from(s.reverse()),o)}}ht.empty=new ht(je.empty,0);function y1(n,e){let t;return n.forEach((r,s)=>{if(r.selection&&e--==0)return t=s,!1}),n.slice(t)}class bt{constructor(e,t,r,s){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new bt(t.getMap().invert(),t,this.selection)}}}class zt{constructor(e,t,r,s,o){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=s,this.prevComposition=o}}const b1=20;function k1(n,e,t,r){let s=t.getMeta(xn),o;if(s)return s.historyState;t.getMeta(S1)&&(n=new zt(n.done,n.undone,null,0,-1));let i=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(i&&i.getMeta(xn))return i.getMeta(xn).redo?new zt(n.done.addTransform(t,void 0,r,ds(e)),n.undone,su(t.mapping.maps),n.prevTime,n.prevComposition):new zt(n.done,n.undone.addTransform(t,void 0,r,ds(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(i&&i.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!i&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!x1(t,n.prevRanges)),c=i?xi(n.prevRanges,t.mapping):su(t.mapping.maps);return new zt(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,ds(e)),ht.empty,c,t.time,l??n.prevComposition)}else return(o=t.getMeta("rebased"))?new zt(n.done.rebased(t,o),n.undone.rebased(t,o),xi(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new zt(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),xi(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function x1(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,s)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&s>=e[o]&&(t=!0)}),t}function su(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,s,o,i)=>e.push(o,i));return e}function xi(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let s=e.map(n[r],1),o=e.map(n[r+1],-1);s<=o&&t.push(s,o)}return t}function v1(n,e,t){let r=ds(e),s=xn.get(e).spec.config,o=(t?n.undone:n.done).popEvent(e,r);if(!o)return null;let i=o.selection.resolve(o.transform.doc),l=(t?n.done:n.undone).addTransform(o.transform,e.selection.getBookmark(),s,r),a=new zt(t?l:o.remaining,t?o.remaining:l,null,0,-1);return o.transform.setSelection(i).setMeta(xn,{redo:t,historyState:a})}let vi=!1,ou=null;function ds(n){let e=n.plugins;if(ou!=e){vi=!1,ou=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){vi=!0;break}}return vi}const xn=new Pe("history"),S1=new Pe("closeHistory");function C1(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Te({key:xn,state:{init(){return new zt(ht.empty,ht.empty,null,0,-1)},apply(e,t,r){return k1(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,s=r=="historyUndo"?ph:r=="historyRedo"?mh:null;return!s||!e.editable?!1:(t.preventDefault(),s(e.state,e.dispatch))}}}})}function hh(n,e){return(t,r)=>{let s=xn.getState(t);if(!s||(n?s.undone:s.done).eventCount==0)return!1;if(r){let o=v1(s,t,n);o&&r(e?o.scrollIntoView():o)}return!0}}const ph=hh(!1,!0),mh=hh(!0,!0);Ae.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=(n==null?void 0:n.node)||this.editor.state.doc;if(((n==null?void 0:n.mode)||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=n=>{const e=(n==null?void 0:n.node)||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new Te({key:new Pe("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const s=this.options.limit;if(s==null||s===0){n=!0;return}const o=this.storage.characters({node:r.doc});if(o>s){const i=o-s,l=0,a=i;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const c=r.tr.deleteRange(l,a);return n=!0,c}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:t.doc}),o=this.storage.characters({node:e.doc});if(o<=r||s>r&&o>r&&o<=s)return!0;if(s>r&&o>r&&o>s||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=o-r,c=l-a,u=l;return e.deleteRange(c,u),!(this.storage.characters({node:e.doc})>r)}})]}});var M1=Ae.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[i1(this.options)]}});Ae.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Te({key:new Pe("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:s}=e,o=[];if(!t||!r)return Se.create(n,[]);let i=0;this.options.mode==="deepest"&&n.descendants((a,c)=>{if(a.isText)return;if(!(s>=c&&s<=c+a.nodeSize-1))return!1;i+=1});let l=0;return n.descendants((a,c)=>{if(a.isText||!(s>=c&&s<=c+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&i-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";o.push(qe.node(c,c+a.nodeSize,{class:this.options.className}))}),Se.create(n,o)}}})]}});var w1=Ae.create({name:"gapCursor",addProseMirrorPlugins(){return[u1()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=ye(Z(n,"allowGapCursor",t)))!=null?e:null}}});Ae.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Te({key:new Pe("placeholder"),props:{decorations:({doc:n,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,s=[];if(!t)return null;const o=this.editor.isEmpty;return n.descendants((i,l)=>{const a=r>=l&&r<=l+i.nodeSize,c=!i.isLeaf&&Do(i);if((a||!this.options.showOnlyCurrent)&&c){const u=[this.options.emptyNodeClass];o&&u.push(this.options.emptyEditorClass);const d=qe.node(l,l+i.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:i,pos:l,hasAnchor:a}):this.options.placeholder});s.push(d)}return this.options.includeChildren}),Se.create(n,s)}}})]}});Ae.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new Te({key:new Pe("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||Af(t.selection)||n.view.dragging?null:Se.create(t.doc,[qe.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function iu({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||(e==null?void 0:e.type)===n}var T1=Ae.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new Pe(this.name),t=((n=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:n.name)||this.options.node||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(t).includes(s.name));return[new Te({key:e,appendTransaction:(s,o,i)=>{const{doc:l,tr:a,schema:c}=i,u=e.getState(i),d=l.content.size,f=c.nodes[t];if(u)return a.insert(d,f.create())},state:{init:(s,o)=>{const i=o.tr.doc.lastChild;return!iu({node:i,types:r})},apply:(s,o)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return o;const i=s.doc.lastChild;return!iu({node:i,types:r})}}})]}}),E1=Ae.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>ph(n,e),redo:()=>({state:n,dispatch:e})=>mh(n,e)}},addProseMirrorPlugins(){return[C1(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()}}}),A1=Ae.create({name:"starterKit",addExtensions(){var n,e,t,r;const s=[];return this.options.bold!==!1&&s.push(tx.configure(this.options.bold)),this.options.blockquote!==!1&&s.push(Gk.configure(this.options.blockquote)),this.options.bulletList!==!1&&s.push(eh.configure(this.options.bulletList)),this.options.code!==!1&&s.push(sx.configure(this.options.code)),this.options.codeBlock!==!1&&s.push(lx.configure(this.options.codeBlock)),this.options.document!==!1&&s.push(ax.configure(this.options.document)),this.options.dropcursor!==!1&&s.push(M1.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&s.push(w1.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&s.push(cx.configure(this.options.hardBreak)),this.options.heading!==!1&&s.push(ux.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(E1.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(dx.configure(this.options.horizontalRule)),this.options.italic!==!1&&s.push(gx.configure(this.options.italic)),this.options.listItem!==!1&&s.push(th.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(lh.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&s.push(Zf.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&s.push(ch.configure(this.options.orderedList)),this.options.paragraph!==!1&&s.push(e1.configure(this.options.paragraph)),this.options.strike!==!1&&s.push(r1.configure(this.options.strike)),this.options.text!==!1&&s.push(s1.configure(this.options.text)),this.options.underline!==!1&&s.push(uh.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&s.push(T1.configure((r=this.options)==null?void 0:r.trailingNode)),s}}),O1=A1,D1=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,N1=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,R1=vt.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:n=>n.getAttribute("data-color")||n.style.backgroundColor,renderHTML:n=>n.color?{"data-color":n.color,style:`background-color: ${n.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:n}){return["mark",Ce(this.options.HTMLAttributes,n),0]},renderMarkdown:(n,e)=>`==${e.renderChildren(n)}==`,parseMarkdown:(n,e)=>e.applyMark("highlight",e.parseInline(n.tokens||[])),markdownTokenizer:{name:"highlight",level:"inline",start:n=>n.indexOf("=="),tokenize(n,e,t){const s=/^(==)([^=]+)(==)/.exec(n);if(s){const o=s[2].trim(),i=t.inlineTokens(o);return{type:"highlight",raw:s[0],text:o,tokens:i}}}},addCommands(){return{setHighlight:n=>({commands:e})=>e.setMark(this.name,n),toggleHighlight:n=>({commands:e})=>e.toggleMark(this.name,n),unsetHighlight:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[wn({find:D1,type:this.type})]},addPasteRules(){return[Qt({find:N1,type:this.type})]}}),L1=R1,I1=Ae.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:n=>{const e=n.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:n=>n.textAlign?{style:`text-align: ${n.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:n=>({commands:e})=>this.options.alignments.includes(n)?this.options.types.map(t=>e.updateAttributes(t,{textAlign:n})).every(t=>t):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.map(e=>n.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:n=>({editor:e,commands:t})=>this.options.alignments.includes(n)?e.isActive({textAlign:n})?t.unsetTextAlign():t.setTextAlign(n):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),j1=I1,P1=vt.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(n){return n!=="super"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sup",Ce(this.options.HTMLAttributes,n),0]},addCommands(){return{setSuperscript:()=>({commands:n})=>n.setMark(this.name),toggleSuperscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSuperscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),_1=P1,B1=vt.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(n){return n!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sub",Ce(this.options.HTMLAttributes,n),0]},addCommands(){return{setSubscript:()=>({commands:n})=>n.setMark(this.name),toggleSubscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSubscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),F1=B1,An={root:"m_dd3f7539",Typography:"m_f2016866",content:"m_c2204cc2",linkEditorDropdown:"m_8a991b4f",control:"m_c2207da6",controlIcon:"m_9cdfeb3f",controlsGroup:"m_2ab47ef2",linkEditor:"m_b67b711e",linkEditorInput:"m_296cf94c",linkEditorExternalControl:"m_cfef614",linkEditorSave:"m_3b28e7bb",toolbar:"m_4574a3c4",taskList:"m_8b44009a"};const z1={linkControlLabel:"Link",colorPickerControlLabel:"Text color",highlightControlLabel:"Highlight text",colorControlLabel:n=>`Set text color ${n}`,boldControlLabel:"Bold",italicControlLabel:"Italic",underlineControlLabel:"Underline",strikeControlLabel:"Strikethrough",clearFormattingControlLabel:"Clear formatting",unlinkControlLabel:"Remove link",bulletListControlLabel:"Bullet list",orderedListControlLabel:"Ordered list",sourceCodeControlLabel:"Switch between text/source code",h1ControlLabel:"Heading 1",h2ControlLabel:"Heading 2",h3ControlLabel:"Heading 3",h4ControlLabel:"Heading 4",h5ControlLabel:"Heading 5",h6ControlLabel:"Heading 6",blockquoteControlLabel:"Blockquote",alignLeftControlLabel:"Align text: left",alignCenterControlLabel:"Align text: center",alignRightControlLabel:"Align text: right",alignJustifyControlLabel:"Align text: justify",codeControlLabel:"Code",codeBlockControlLabel:"Code block",subscriptControlLabel:"Subscript",superscriptControlLabel:"Superscript",unsetColorControlLabel:"Unset color",hrControlLabel:"Horizontal line",undoControlLabel:"Undo",redoControlLabel:"Redo",tasksControlLabel:"Task list",tasksSinkLabel:"Decrease task level",tasksLiftLabel:"Increase task level",linkEditorInputLabel:"Enter URL",linkEditorInputPlaceholder:"https://example.com/",linkEditorExternalLink:"Open link in a new tab",linkEditorInternalLink:"Open link in the same tab",linkEditorSave:"Save",colorPickerCancel:"Cancel",colorPickerClear:"Clear color",colorPickerColorPicker:"Color picker",colorPickerPalette:"Color palette",colorPickerSave:"Save",colorPickerColorLabel:n=>`Set text color ${n}`},[$1,St]=v.createSafeContext("RichTextEditor component was not found in tree"),ra=v.factory((n,e)=>{const t=v.useProps("RichTextEditorContent",null,n),{classNames:r,className:s,style:o,styles:i,vars:l,...a}=t,c=St();return c.withTypographyStyles?m.jsx(v.Typography,{...c.getStyles("Typography",{className:s,style:o,styles:i,classNames:r}),unstyled:c.unstyled,ref:e,children:m.jsx(v.Box,{component:Wc,editor:c.editor,...c.getStyles("content",{classNames:r,styles:i}),...a})}):m.jsx(v.Box,{component:Wc,editor:c.editor,...c.getStyles("content",{classNames:r,styles:i,className:s,style:o}),...a})});ra.classes=An;ra.displayName="@mantine/tiptap/RichTextEditorContent";function fe(n){return m.jsx("svg",{...n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}function V1(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M7 5h6a3.5 3.5 0 0 1 0 7h-6z"}),m.jsx("path",{d:"M13 12h1a3.5 3.5 0 0 1 0 7h-7v-7"})]})}function H1(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M11 5l6 0"}),m.jsx("path",{d:"M7 19l6 0"}),m.jsx("path",{d:"M14 5l-4 14"})]})}function W1(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M7 5v5a5 5 0 0 0 10 0v-5"}),m.jsx("path",{d:"M5 19h14"})]})}function Y1(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M5 12l14 0"}),m.jsx("path",{d:"M16 6.5a4 2 0 0 0 -4 -1.5h-1a3.5 3.5 0 0 0 0 7h2a3.5 3.5 0 0 1 0 7h-1.5a4 2 0 0 1 -4 -1.5"})]})}function U1(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M17 15l4 4m0 -4l-4 4"}),m.jsx("path",{d:"M7 6v-1h11v1"}),m.jsx("path",{d:"M7 19l4 0"}),m.jsx("path",{d:"M13 5l-4 14"})]})}function q1(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M19 18v-8l-2 2"}),m.jsx("path",{d:"M4 6v12"}),m.jsx("path",{d:"M12 6v12"}),m.jsx("path",{d:"M11 18h2"}),m.jsx("path",{d:"M3 18h2"}),m.jsx("path",{d:"M4 12h8"}),m.jsx("path",{d:"M3 6h2"}),m.jsx("path",{d:"M11 6h2"})]})}function K1(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M17 12a2 2 0 1 1 4 0c0 .591 -.417 1.318 -.816 1.858l-3.184 4.143l4 0"}),m.jsx("path",{d:"M4 6v12"}),m.jsx("path",{d:"M12 6v12"}),m.jsx("path",{d:"M11 18h2"}),m.jsx("path",{d:"M3 18h2"}),m.jsx("path",{d:"M4 12h8"}),m.jsx("path",{d:"M3 6h2"}),m.jsx("path",{d:"M11 6h2"})]})}function J1(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M19 14a2 2 0 1 0 -2 -2"}),m.jsx("path",{d:"M17 16a2 2 0 1 0 2 -2"}),m.jsx("path",{d:"M4 6v12"}),m.jsx("path",{d:"M12 6v12"}),m.jsx("path",{d:"M11 18h2"}),m.jsx("path",{d:"M3 18h2"}),m.jsx("path",{d:"M4 12h8"}),m.jsx("path",{d:"M3 6h2"}),m.jsx("path",{d:"M11 6h2"})]})}function G1(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M20 18v-8l-4 6h5"}),m.jsx("path",{d:"M4 6v12"}),m.jsx("path",{d:"M12 6v12"}),m.jsx("path",{d:"M11 18h2"}),m.jsx("path",{d:"M3 18h2"}),m.jsx("path",{d:"M4 12h8"}),m.jsx("path",{d:"M3 6h2"}),m.jsx("path",{d:"M11 6h2"})]})}function X1(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M17 18h2a2 2 0 1 0 0 -4h-2v-4h4"}),m.jsx("path",{d:"M4 6v12"}),m.jsx("path",{d:"M12 6v12"}),m.jsx("path",{d:"M11 18h2"}),m.jsx("path",{d:"M3 18h2"}),m.jsx("path",{d:"M4 12h8"}),m.jsx("path",{d:"M3 6h2"}),m.jsx("path",{d:"M11 6h2"})]})}function Q1(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M19 14a2 2 0 1 0 0 4a2 2 0 0 0 0 -4z"}),m.jsx("path",{d:"M21 12a2 2 0 1 0 -4 0v4"}),m.jsx("path",{d:"M4 6v12"}),m.jsx("path",{d:"M12 6v12"}),m.jsx("path",{d:"M11 18h2"}),m.jsx("path",{d:"M3 18h2"}),m.jsx("path",{d:"M4 12h8"}),m.jsx("path",{d:"M3 6h2"}),m.jsx("path",{d:"M11 6h2"})]})}function Z1(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M9 6l11 0"}),m.jsx("path",{d:"M9 12l11 0"}),m.jsx("path",{d:"M9 18l11 0"}),m.jsx("path",{d:"M5 6l0 .01"}),m.jsx("path",{d:"M5 12l0 .01"}),m.jsx("path",{d:"M5 18l0 .01"})]})}function ev(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M11 6h9"}),m.jsx("path",{d:"M11 12h9"}),m.jsx("path",{d:"M12 18h8"}),m.jsx("path",{d:"M4 16a2 2 0 1 1 4 0c0 .591 -.5 1 -1 1.5l-3 2.5h4"}),m.jsx("path",{d:"M6 10v-6l-2 2"})]})}function tv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M17 22v-2"}),m.jsx("path",{d:"M9 15l6 -6"}),m.jsx("path",{d:"M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464"}),m.jsx("path",{d:"M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463"}),m.jsx("path",{d:"M20 17h2"}),m.jsx("path",{d:"M2 7h2"}),m.jsx("path",{d:"M7 2v2"})]})}function nv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M6 15h15"}),m.jsx("path",{d:"M21 19h-15"}),m.jsx("path",{d:"M15 11h6"}),m.jsx("path",{d:"M21 7h-6"}),m.jsx("path",{d:"M9 9h1a1 1 0 1 1 -1 1v-2.5a2 2 0 0 1 2 -2"}),m.jsx("path",{d:"M3 9h1a1 1 0 1 1 -1 1v-2.5a2 2 0 0 1 2 -2"})]})}function rv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M4 6l16 0"}),m.jsx("path",{d:"M4 12l10 0"}),m.jsx("path",{d:"M4 18l14 0"})]})}function sv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M4 6l16 0"}),m.jsx("path",{d:"M10 12l10 0"}),m.jsx("path",{d:"M6 18l14 0"})]})}function ov(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M4 6l16 0"}),m.jsx("path",{d:"M8 12l8 0"}),m.jsx("path",{d:"M6 18l12 0"})]})}function iv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M4 6l16 0"}),m.jsx("path",{d:"M4 12l16 0"}),m.jsx("path",{d:"M4 18l12 0"})]})}function lv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M5 7l8 10m-8 0l8 -10"}),m.jsx("path",{d:"M21 20h-4l3.5 -4a1.73 1.73 0 0 0 -3.5 -2"})]})}function av(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M5 7l8 10m-8 0l8 -10"}),m.jsx("path",{d:"M21 11h-4l3.5 -4a1.73 1.73 0 0 0 -3.5 -2"})]})}function gh(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M7 8l-4 4l4 4"}),m.jsx("path",{d:"M17 8l4 4l-4 4"}),m.jsx("path",{d:"M14 4l-4 16"})]})}function cv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M3 19h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4"}),m.jsx("path",{d:"M12.5 5.5l4 4"}),m.jsx("path",{d:"M4.5 13.5l4 4"}),m.jsx("path",{d:"M21 15v4h-8l4 -4z"})]})}function uv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M5 12h2"}),m.jsx("path",{d:"M17 12h2"}),m.jsx("path",{d:"M11 12h2"})]})}function yh(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M20.042 16.045a9 9 0 0 0 -12.087 -12.087m-2.318 1.677a9 9 0 1 0 12.725 12.73"}),m.jsx("path",{d:"M3 3l18 18"})]})}function dv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M11 7l6 6"}),m.jsx("path",{d:"M4 16l11.7 -11.7a1 1 0 0 1 1.4 0l2.6 2.6a1 1 0 0 1 0 1.4l-11.7 11.7h-4v-4z"})]})}function fv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M18 6l-12 12"}),m.jsx("path",{d:"M6 6l12 12"})]})}function hv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M12 21a9 9 0 0 1 0 -18c4.97 0 9 3.582 9 8c0 1.06 -.474 2.078 -1.318 2.828c-.844 .75 -1.989 1.172 -3.182 1.172h-2.5a2 2 0 0 0 -1 3.75a1.3 1.3 0 0 1 -1 2.25"}),m.jsx("path",{d:"M8.5 10.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),m.jsx("path",{d:"M12.5 7.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),m.jsx("path",{d:"M16.5 10.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"})]})}function pv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M5 12l5 5l10 -10"})]})}function mv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M9 15l6 -6"}),m.jsx("path",{d:"M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464"}),m.jsx("path",{d:"M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463"})]})}function gv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6"}),m.jsx("path",{d:"M11 13l9 -9"}),m.jsx("path",{d:"M15 4h5v5"})]})}function yv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M9 14l-4 -4l4 -4"}),m.jsx("path",{d:"M5 10h11a4 4 0 1 1 0 8h-1"})]})}function bv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M15 14l4 -4l-4 -4"}),m.jsx("path",{d:"M19 10h-11a4 4 0 1 0 0 8h1"})]})}function kv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M3.5 5.5l1.5 1.5l2.5 -2.5"}),m.jsx("path",{d:"M3.5 11.5l1.5 1.5l2.5 -2.5"}),m.jsx("path",{d:"M3.5 17.5l1.5 1.5l2.5 -2.5"}),m.jsx("path",{d:"M11 6l9 0"}),m.jsx("path",{d:"M11 12l9 0"}),m.jsx("path",{d:"M11 18l9 0"})]})}function xv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M20 6l-11 0"}),m.jsx("path",{d:"M20 12l-7 0"}),m.jsx("path",{d:"M20 18l-11 0"}),m.jsx("path",{d:"M4 8l4 4l-4 4"})]})}function vv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:"M20 6l-7 0"}),m.jsx("path",{d:"M20 12l-9 0"}),m.jsx("path",{d:"M20 18l-7 0"}),m.jsx("path",{d:"M8 8l-4 4l4 4"})]})}function Sv(n){return m.jsxs(fe,{...n,children:[m.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m.jsx("path",{d:`M19 3v16a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V7.914
|
|
193
193
|
a1 1 0 0 1 .293-.707l3.914-3.914A1 1 0 0 1 9.914 3H18
|
|
194
|
-
a1 1 0 0 1 1 1Z`}),m.jsx("path",{d:"M10 11l-2 2 2 2"}),m.jsx("path",{d:"M14 11l2 2-2 2"})]})}const Cv={interactive:!0},On=v.factory((n,e)=>{const t=v.useProps("RichTextEditorControl",Cv,n),{classNames:r,className:s,style:o,styles:i,vars:l,interactive:a,active:c,onMouseDown:u,disabled:d,...f}=t,h=St();return m.jsx(v.UnstyledButton,{...f,...h.getStyles("control",{className:s,style:o,classNames:r,styles:i}),disabled:d,"data-rich-text-editor-control":!0,tabIndex:a?0:-1,"data-interactive":a||void 0,"data-disabled":d||void 0,"data-active":c||void 0,"aria-pressed":c&&a||void 0,"aria-hidden":!a||void 0,ref:e,unstyled:h.unstyled,variant:h.variant||"default",onMouseDown:p=>{p.preventDefault(),u==null||u(p)}})});On.classes=An;On.displayName="@mantine/tiptap/RichTextEditorControl";const sa=T.forwardRef(({className:n,icon:e,...t},r)=>{const s=St();return m.jsx(On,{ref:r,...t,children:m.jsx(e,{...s.getStyles("controlIcon")})})});sa.displayName="@mantine/tiptap/RichTextEditorControlBase";function me({label:n,isActive:e,operation:t,icon:r,isDisabled:s}){const o=T.forwardRef((i,l)=>{const{editor:a,labels:c}=St(),u=c[n];return m.jsx(sa,{"aria-label":u,title:u,active:e!=null&&e.name?a==null?void 0:a.isActive(e.name,e.attributes):!1,ref:l,icon:i.icon||r,disabled:(s==null?void 0:s(a))||!1,...i,onClick:()=>a==null?void 0:a.chain().focus()[t.name](t.attributes).run()})});return o.displayName=`@mantine/tiptap/${n}`,o}const Mv=me({label:"boldControlLabel",icon:n=>m.jsx(V1,{...n}),isActive:{name:"bold"},operation:{name:"toggleBold"}}),wv=me({label:"italicControlLabel",icon:n=>m.jsx(H1,{...n}),isActive:{name:"italic"},operation:{name:"toggleItalic"}}),Tv=me({label:"underlineControlLabel",icon:n=>m.jsx(W1,{...n}),isActive:{name:"underline"},operation:{name:"toggleUnderline"}}),Ev=me({label:"strikeControlLabel",icon:n=>m.jsx(Y1,{...n}),isActive:{name:"strike"},operation:{name:"toggleStrike"}}),Av=me({label:"clearFormattingControlLabel",icon:n=>m.jsx(U1,{...n}),operation:{name:"unsetAllMarks"}}),Ov=me({label:"unlinkControlLabel",icon:n=>m.jsx(tv,{...n}),operation:{name:"unsetLink"}}),Dv=me({label:"bulletListControlLabel",icon:n=>m.jsx(Z1,{...n}),isActive:{name:"bulletList"},operation:{name:"toggleBulletList"}}),Nv=me({label:"orderedListControlLabel",icon:n=>m.jsx(ev,{...n}),isActive:{name:"orderedList"},operation:{name:"toggleOrderedList"}}),Rv=me({label:"h1ControlLabel",icon:n=>m.jsx(q1,{...n}),isActive:{name:"heading",attributes:{level:1}},operation:{name:"toggleHeading",attributes:{level:1}}}),Lv=me({label:"h2ControlLabel",icon:n=>m.jsx(K1,{...n}),isActive:{name:"heading",attributes:{level:2}},operation:{name:"toggleHeading",attributes:{level:2}}}),Iv=me({label:"h3ControlLabel",icon:n=>m.jsx(J1,{...n}),isActive:{name:"heading",attributes:{level:3}},operation:{name:"toggleHeading",attributes:{level:3}}}),jv=me({label:"h4ControlLabel",icon:n=>m.jsx(G1,{...n}),isActive:{name:"heading",attributes:{level:4}},operation:{name:"toggleHeading",attributes:{level:4}}}),Pv=me({label:"h5ControlLabel",icon:n=>m.jsx(X1,{...n}),isActive:{name:"heading",attributes:{level:5}},operation:{name:"toggleHeading",attributes:{level:5}}}),_v=me({label:"h6ControlLabel",icon:n=>m.jsx(Q1,{...n}),isActive:{name:"heading",attributes:{level:6}},operation:{name:"toggleHeading",attributes:{level:6}}}),Bv=me({label:"blockquoteControlLabel",icon:n=>m.jsx(nv,{...n}),isActive:{name:"blockquote"},operation:{name:"toggleBlockquote"}}),Fv=me({label:"alignLeftControlLabel",icon:n=>m.jsx(rv,{...n}),operation:{name:"setTextAlign",attributes:"left"}}),zv=me({label:"alignRightControlLabel",icon:n=>m.jsx(sv,{...n}),operation:{name:"setTextAlign",attributes:"right"}}),$v=me({label:"alignCenterControlLabel",icon:n=>m.jsx(ov,{...n}),operation:{name:"setTextAlign",attributes:"center"}}),Vv=me({label:"alignJustifyControlLabel",icon:n=>m.jsx(iv,{...n}),operation:{name:"setTextAlign",attributes:"justify"}}),Hv=me({label:"subscriptControlLabel",icon:n=>m.jsx(lv,{...n}),isActive:{name:"subscript"},operation:{name:"toggleSubscript"}}),Wv=me({label:"superscriptControlLabel",icon:n=>m.jsx(av,{...n}),isActive:{name:"superscript"},operation:{name:"toggleSuperscript"}}),Yv=me({label:"codeControlLabel",icon:n=>m.jsx(gh,{...n}),isActive:{name:"code"},operation:{name:"toggleCode"}}),Uv=me({label:"codeBlockControlLabel",icon:n=>m.jsx(gh,{...n}),isActive:{name:"codeBlock"},operation:{name:"toggleCodeBlock"}}),qv=me({label:"highlightControlLabel",icon:n=>m.jsx(cv,{...n}),isActive:{name:"highlight"},operation:{name:"toggleHighlight"}}),Kv=me({label:"hrControlLabel",icon:n=>m.jsx(uv,{...n}),operation:{name:"setHorizontalRule"}}),Jv=me({label:"unsetColorControlLabel",icon:n=>m.jsx(yh,{...n}),operation:{name:"unsetColor"}}),Gv=me({label:"undoControlLabel",icon:n=>m.jsx(yv,{...n}),isDisabled:n=>!(n!=null&&n.can().undo()),operation:{name:"undo"}}),Xv=me({label:"redoControlLabel",icon:n=>m.jsx(bv,{...n}),isDisabled:n=>!(n!=null&&n.can().redo()),operation:{name:"redo"}}),Qv=me({label:"tasksControlLabel",icon:n=>m.jsx(kv,{...n}),isActive:{name:"taskList"},operation:{name:"toggleTaskList"}}),Zv=me({label:"tasksSinkLabel",icon:n=>m.jsx(xv,{...n}),operation:{name:"sinkListItem",attributes:"taskItem"},isDisabled:n=>!(n!=null&&n.can().sinkListItem("taskItem"))}),eS=me({label:"tasksLiftLabel",icon:n=>m.jsx(vv,{...n}),operation:{name:"liftListItem",attributes:"taskItem"},isDisabled:n=>!(n!=null&&n.can().liftListItem("taskItem"))}),tS=n=>m.jsx(mv,{...n}),oa=v.factory((n,e)=>{var V;const t=v.useProps("RichTextEditorLinkControl",null,n),{classNames:r,className:s,style:o,styles:i,vars:l,icon:a,popoverProps:c,disableTooltips:u,initialExternal:d,...f}=t,h=St(),p={classNames:r,styles:i},[g,y]=Cp(""),[b,k]=T.useState(d),[w,{open:E,close:C}]=il(!1),x=()=>{var q;E();const F=(q=h.editor)==null?void 0:q.getAttributes("link");y((F==null?void 0:F.href)||""),k(F!=null&&F.href?(F==null?void 0:F.target)==="_blank":d)},M=()=>{C(),y(""),k(d)},O=()=>{var F,q;M(),g===""?(F=h.editor)==null||F.chain().focus().extendMarkRange("link").unsetLink().run():(q=h.editor)==null||q.chain().focus().extendMarkRange("link").setLink({href:g,target:b?"_blank":null}).run()},j=F=>{F.key==="Enter"&&(F.preventDefault(),O())};xp("edit-link",x,!1);const{resolvedClassNames:B,resolvedStyles:Y}=v.useResolvedStylesApi({classNames:r,styles:i,props:t});return m.jsxs(v.Popover,{trapFocus:!0,shadow:"md",withinPortal:!0,opened:w,onChange:F=>!F&&M(),offset:-44,zIndex:1e4,...c,children:[m.jsx(v.Popover.Target,{children:m.jsx(sa,{icon:a||tS,...f,"aria-label":h.labels.linkControlLabel,title:h.labels.linkControlLabel,onClick:x,active:(V=h.editor)==null?void 0:V.isActive("link"),ref:e,classNames:B,styles:Y,className:s,style:o,variant:h.variant})}),m.jsx(v.Popover.Dropdown,{...h.getStyles("linkEditorDropdown",p),children:m.jsxs("div",{...h.getStyles("linkEditor",p),children:[m.jsx(v.TextInput,{placeholder:h.labels.linkEditorInputPlaceholder,"aria-label":h.labels.linkEditorInputLabel,type:"url",value:g,onChange:y,classNames:{input:h.getStyles("linkEditorInput",p).className},onKeyDown:j,rightSection:m.jsx(v.Tooltip,{label:b?h.labels.linkEditorExternalLink:h.labels.linkEditorInternalLink,events:{hover:!0,focus:!0,touch:!0},withinPortal:!0,withArrow:!0,disabled:u,zIndex:1e4,children:m.jsx(v.UnstyledButton,{onClick:()=>k(F=>!F),"data-active":b||void 0,...h.getStyles("linkEditorExternalControl",p),children:m.jsx(gv,{style:{width:v.rem(14),height:v.rem(14)}})})})}),m.jsx(v.Button,{variant:"default",onClick:O,...h.getStyles("linkEditorSave",p),children:h.labels.linkEditorSave})]})})]})});oa.classes=An;oa.displayName="@mantine/tiptap/RichTextEditorLinkControl";const bh=T.forwardRef((n,e)=>{const{popoverProps:t,colors:r,colorPickerProps:s,...o}=v.useProps("RichTextEditorColorPickerControl",null,n),{editor:i,labels:l,getStyles:a,variant:c}=St(),[u,{toggle:d,close:f}]=il(!1),[h,p]=T.useState("palette"),g=(i==null?void 0:i.getAttributes("textStyle").color)||"var(--mantine-color-text)",y=(w,E=!0)=>{(i==null?void 0:i.chain()).focus().setColor(w).run(),E&&f()},b=()=>{(i==null?void 0:i.chain()).focus().unsetColor().run(),f()},k=r.map((w,E)=>m.jsx(v.ColorSwatch,{component:"button",color:w,onClick:()=>y(w),size:26,radius:"xs",style:{cursor:"pointer"},title:l.colorPickerColorLabel(w),"aria-label":l.colorPickerColorLabel(w)},E));return m.jsxs(v.Popover,{opened:u,withinPortal:!0,trapFocus:!0,onChange:w=>!w&&f(),...t,children:[m.jsx(v.Popover.Target,{children:m.jsx(On,{...o,variant:c,"aria-label":l.colorPickerControlLabel,title:l.colorPickerControlLabel,ref:e,onClick:d,children:m.jsx(v.ColorSwatch,{color:g,size:14})})}),m.jsxs(v.Popover.Dropdown,{...a("linkEditorDropdown"),children:[h==="palette"&&m.jsx(v.SimpleGrid,{cols:7,spacing:2,children:k}),h==="colorPicker"&&m.jsx(v.ColorPicker,{defaultValue:g,onChange:w=>y(w,!1),...s}),m.jsx(v.Tooltip.Group,{closeDelay:200,children:m.jsxs(v.Group,{justify:"flex-end",gap:"xs",mt:"sm",children:[h==="palette"&&m.jsx(v.ActionIcon,{variant:"default",onClick:f,title:l.colorPickerCancel,"aria-label":l.colorPickerCancel,children:m.jsx(fv,{style:{width:v.rem(16),height:v.rem(16)}})}),m.jsx(v.ActionIcon,{variant:"default",onClick:b,title:l.colorPickerClear,"aria-label":l.colorPickerClear,children:m.jsx(yh,{style:{width:v.rem(16),height:v.rem(16)}})}),h==="palette"?m.jsx(v.ActionIcon,{variant:"default",onClick:()=>p("colorPicker"),title:l.colorPickerColorPicker,"aria-label":l.colorPickerColorPicker,children:m.jsx(dv,{style:{width:v.rem(16),height:v.rem(16)}})}):m.jsx(v.ActionIcon,{variant:"default",onClick:()=>p("palette"),"aria-label":l.colorPickerPalette,title:l.colorPickerPalette,children:m.jsx(hv,{style:{width:v.rem(16),height:v.rem(16)}})}),h==="colorPicker"&&m.jsx(v.ActionIcon,{variant:"default",onClick:f,title:l.colorPickerSave,"aria-label":l.colorPickerSave,children:m.jsx(pv,{style:{width:v.rem(16),height:v.rem(16)}})})]})})]})]})});bh.displayName="@mantine/tiptap/ColorPickerControl";const kh=T.forwardRef((n,e)=>{const{color:t,...r}=v.useProps("RichTextEditorColorControl",null,n),{editor:s,labels:o,variant:i}=St(),l=(s==null?void 0:s.getAttributes("textStyle").color)||null,a=o.colorControlLabel(t);return m.jsx(On,{...r,variant:i,active:l===t,"aria-label":a,title:a,onClick:()=>(s==null?void 0:s.chain()).focus().setColor(t).run(),ref:e,children:m.jsx(v.ColorSwatch,{color:t,size:14})})});kh.displayName="@mantine/tiptap/RichTextEditorColorControl";const nS={},xh=T.forwardRef((n,e)=>{const{...t}=v.useProps("RichTextEditorSourceCodeControl",nS,n),{editor:r,labels:s,variant:o,onSourceCodeTextSwitch:i}=St(),[l,a]=T.useState(!1),c=()=>{l?r==null||r.commands.setContent(r.getText(),{emitUpdate:!0}):r==null||r.commands.setContent(`<textarea>${r.getHTML()}</textarea>`);const u=!l;a(u),i==null||i(u)};return m.jsx(On,{...t,variant:o,active:l,"aria-label":s.sourceCodeControlLabel,title:s.sourceCodeControlLabel,onClick:()=>c(),ref:e,children:m.jsx(Sv,{style:{width:v.rem(16),height:v.rem(16)}})})});xh.displayName="@mantine/tiptap/RichTextEditorSourceCodeControl";const ia=v.factory((n,e)=>{const t=v.useProps("RichTextEditorControlsGroup",null,n),{classNames:r,className:s,style:o,styles:i,vars:l,variant:a,...c}=t,u=St();return m.jsx(v.Box,{ref:e,variant:a||u.variant,...u.getStyles("controlsGroup",{className:s,style:o,styles:i,classNames:r}),...c})});ia.classes=An;ia.displayName="@mantine/tiptap/RichTextEditorControlsGroup";const la=v.factory((n,e)=>{const t=v.useProps("RichTextEditorToolbar",null,n),{classNames:r,className:s,style:o,styles:i,vars:l,sticky:a,stickyOffset:c,mod:u,variant:d,...f}=t,h=St();return m.jsx(v.Box,{ref:e,mod:[{sticky:a},u],variant:d||h.variant,...h.getStyles("toolbar",{className:s,style:o,styles:i,classNames:r}),...f,__vars:{"--rte-sticky-offset":v.rem(c)}})});la.classes=An;la.displayName="@mantine/tiptap/RichTextEditorToolbar";const rS={withCodeHighlightStyles:!0,withTypographyStyles:!0,variant:"default"},$=v.factory((n,e)=>{const t=v.useProps("RichTextEditor",rS,n),{classNames:r,className:s,style:o,styles:i,unstyled:l,vars:a,editor:c,withCodeHighlightStyles:u,withTypographyStyles:d,onSourceCodeTextSwitch:f,labels:h,children:p,variant:g,attributes:y,...b}=t,k=v.useStyles({name:"RichTextEditor",classes:An,props:t,className:s,style:o,classNames:r,styles:i,unstyled:l,attributes:y,vars:a}),w=T.useMemo(()=>({...z1,...h}),[h]);return m.jsx($1,{value:{editor:c,getStyles:k,labels:w,withCodeHighlightStyles:u,withTypographyStyles:d,onSourceCodeTextSwitch:f,unstyled:l,variant:g},children:m.jsx(v.Box,{...k("root"),...b,ref:e,children:p})})});$.classes=An;$.displayName="@mantine/tiptap/RichTextEditor";$.Content=ra;$.Control=On;$.Toolbar=la;$.ControlsGroup=ia;$.Bold=Mv;$.Italic=wv;$.Strikethrough=Ev;$.Underline=Tv;$.ClearFormatting=Av;$.H1=Rv;$.H2=Lv;$.H3=Iv;$.H4=jv;$.H5=Pv;$.H6=_v;$.BulletList=Dv;$.OrderedList=Nv;$.Link=oa;$.Unlink=Ov;$.Blockquote=Bv;$.AlignLeft=Fv;$.AlignRight=zv;$.AlignCenter=$v;$.AlignJustify=Vv;$.Superscript=Wv;$.Subscript=Hv;$.Code=Yv;$.CodeBlock=Uv;$.ColorPicker=bh;$.Color=kh;$.Highlight=qv;$.Hr=Kv;$.UnsetColor=Jv;$.Undo=Gv;$.Redo=Xv;$.TaskList=Qv;$.TaskListSink=Zv;$.TaskListLift=eS;$.SourceCode=xh;function sS({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0,o=Yk({editable:!r&&!s,extensions:[O1,o1,$x,_1,F1,L1,j1.configure({types:["heading","paragraph"]})],content:t.value||"",onUpdate:({editor:i})=>{t.onChange(i.getHTML())}});return m.jsxs($,{editor:o,h:400,children:[m.jsxs($.Toolbar,{sticky:!0,stickyOffset:60,children:[m.jsxs($.ControlsGroup,{children:[m.jsx($.Bold,{}),m.jsx($.Italic,{}),m.jsx($.Underline,{}),m.jsx($.Strikethrough,{}),m.jsx($.ClearFormatting,{}),m.jsx($.Highlight,{}),m.jsx($.Code,{})]}),m.jsxs($.ControlsGroup,{children:[m.jsx($.H1,{}),m.jsx($.H2,{}),m.jsx($.H3,{}),m.jsx($.H4,{})]}),m.jsxs($.ControlsGroup,{children:[m.jsx($.Blockquote,{}),m.jsx($.Hr,{}),m.jsx($.BulletList,{}),m.jsx($.OrderedList,{}),m.jsx($.Subscript,{}),m.jsx($.Superscript,{})]}),m.jsxs($.ControlsGroup,{children:[m.jsx($.Link,{}),m.jsx($.Unlink,{})]}),m.jsxs($.ControlsGroup,{children:[m.jsx($.AlignLeft,{}),m.jsx($.AlignCenter,{}),m.jsx($.AlignJustify,{}),m.jsx($.AlignRight,{})]}),m.jsxs($.ControlsGroup,{children:[m.jsx($.Undo,{}),m.jsx($.Redo,{})]})]}),m.jsx($.Content,{})]})}function oS({field:n,form:e}){const t=n,r=e.getInputProps(t.name),s=t.readOnly===!0,o=t.disabled===!0;return s||o?m.jsx(v.Select,{data:t.data,value:r.value,disabled:o||s,readOnly:s,placeholder:t.placeholder,required:t.required,variant:s?"filled":"default",error:void 0}):m.jsx(v.Select,{data:t.data,...r,placeholder:t.placeholder,error:void 0,onChange:i=>r.onFieldChange(i)})}function iS({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0;return r||s?m.jsx(v.Switch,{value:t.value,readOnly:r,disabled:s,required:n.required,placeholder:n.placeholder,variant:r?"filled":"default",error:void 0,checked:t.value}):m.jsx(v.Switch,{...t,checked:t.value,onChange:o=>t.onFieldChange(o.target.checked),required:n.required,placeholder:n.placeholder,error:void 0})}function lS({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0;return r||s?m.jsx(v.TagsInput,{value:t.value||[],readOnly:r,disabled:s,required:n.required,placeholder:n.placeholder,variant:r?"filled":"default",error:void 0}):m.jsx(v.TagsInput,{value:t.value||[],onChange:o=>t.onChange(o),required:n.required,placeholder:n.placeholder,error:void 0})}function aS({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0;return r||s?m.jsx(v.TextInput,{value:t.value,readOnly:r,disabled:s,required:n.required,placeholder:n.placeholder,variant:r?"filled":"default",error:void 0}):m.jsx(v.TextInput,{...t,onChange:o=>t.onFieldChange(o.target.value),required:n.required,placeholder:n.placeholder,error:void 0})}function cS({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0,o=typeof t.value=="string"?t.value:"",i=T.useRef(null),l=m.jsx(v.ActionIcon,{variant:"subtle",color:"gray",onClick:()=>{var a;return(a=i.current)==null?void 0:a.showPicker()},children:"⏰"});return r||s?m.jsx(fs,{value:o,readOnly:r,disabled:s,required:n.required,placeholder:n.placeholder,variant:r?"filled":"default",error:void 0}):m.jsx(fs,{value:o,onChange:a=>t.onChange(a.currentTarget.value),required:n.required,placeholder:n.placeholder,error:void 0,ref:i,rightSection:l})}const aa={vertical:n=>m.jsx(v.Stack,{gap:"md",children:n}),horizontal:n=>m.jsx(v.Group,{wrap:"wrap",gap:"md",children:n}),grid:n=>m.jsx(v.Grid,{gutter:"md",children:n})},uS=({field:n,layout:e="vertical"})=>{const t=n;return aa[e](t.fields.map(r=>{const s={...r,name:`${t.name}.${r.name}`,disabled:t.disabled,visible:t.visible};return m.jsx(so,{fieldSchema:s})}))},nl=n=>{switch(n){case"number":return 0;case"array":return[];case"checkbox":return!1;case"object":return{};case"select":case"date":case"datetime":return null;default:return""}};function ca(n,e={}){const t={};for(const r of n)r.type==="object"&&r.fields?t[r.name]=ca(r.fields,e==null?void 0:e[r.name]):t[r.name]=(e==null?void 0:e[r.name])??r.initialValue??nl(r.type);return t}function ro(n,e){const t={};for(const r of n){const s=(e==null?void 0:e[r.name])??nl(r.type);if(r.required)if(r.type==="object"){Object.values(s).length||(t[r.name]=`${r.label||r.name} is required`);const o=ro(r.fields,s);for(const[i,l]of Object.entries(o))t[`${r.name}.${i}`]=l}else r.type==="array"?(s.length||(t[r.name]=`${r.label||r.name} is required`),s.forEach((o,i)=>{const l=ro(r.fields,o);for(const[a,c]of Object.entries(l))t[`${r.name}.${i}.${a}`]=c})):s===nl(r.type)&&(t[r.name]=`${r.label||r.name} is required`)}return t}const dS=n=>{const{field:e,form:t,layout:r="vertical"}=n,s=e,o=t.getInputProps(s.name),i=(o==null?void 0:o.value)??[];e.visible,e.disabled,e.readOnly;function l(){o.onFieldChange([...i,ca(s.fields)])}function a(c){o.onFieldChange(i.filter((u,d)=>d!==c))}return m.jsxs(m.Fragment,{children:[aa[r](i.map((c,u)=>m.jsxs(T.Fragment,{children:[s.fields.map(d=>{const f={...d,name:`${s.name}.${u}.${d.name}`};return m.jsx(so,{fieldSchema:f},f.name)}),m.jsx(v.Button,{size:"compact-md",color:"red",w:120,onClick:()=>a(u),children:"Delete row"})]},u))),m.jsxs(m.Fragment,{children:[i.length>0&&m.jsx(v.Divider,{mb:"md"}),m.jsx(v.Button,{onClick:l,variant:"light",size:"compact-md",children:"Add"})]})]})},fS=({field:n,children:e})=>{const t=au(),{error:r}=t.getInputProps(n.name);return m.jsxs(v.Stack,{gap:4,children:[n.label&&m.jsxs(v.Text,{fw:500,size:"sm",mb:2,component:"label",htmlFor:n.name,style:{display:"block"},children:[n.label," ",n.required&&m.jsx(v.Text,{component:"span",c:"red",fz:"sm",children:"*"})]}),m.jsx(v.Box,{children:e}),n.description&&m.jsx(v.Text,{size:"xs",c:"dimmed",mt:2,style:{lineHeight:1.4},children:n.description}),r&&m.jsx(v.Text,{size:"xs",c:"red",mt:2,style:{fontWeight:500},children:r})]})};function hS(n){const{layout:e,field:t,form:r}=n;let s=null;switch(t.type){case"text":s=m.jsx(aS,{field:t,form:r});break;case"select":s=m.jsx(oS,{field:t,form:r});break;case"object":s=m.jsx(uS,{field:t,form:r,layout:e});break;case"array":s=m.jsx(dS,{field:t,form:r,layout:e});break;case"checkbox":s=m.jsx(sp,{field:t,form:r});break;case"number":s=m.jsx(Tm,{field:t,form:r});break;case"date":s=m.jsx(Cm,{field:t,form:r});break;case"datetime":s=m.jsx(wm,{field:t,form:r});break;case"switch":s=m.jsx(iS,{field:t,form:r});break;case"texteditor":s=m.jsx(sS,{field:t,form:r});break;case"time":s=m.jsx(cS,{field:t,form:r});break;case"tags":s=m.jsx(lS,{field:t,form:r});break;default:s=m.jsxs("div",{children:["Unsupported field type: ",t.type]});break}return m.jsx(fS,{field:t,children:s})}class pS{constructor(e){ha(this,"layout");this.layout=e}canHandle(){return!0}resolve(e){return hS}}class mS{constructor(e){this.renderers=e}canHandle(e){return!!this.renderers[e.name]}resolve(e){return this.renderers[e.name]??null}}class gS{constructor(e){this.renderers=e}canHandle(e){return!!this.renderers[e.type]}resolve(e){return this.renderers[e.type]??null}}class yS{constructor(e){this.handlers=e}resolve(e){for(const t of this.handlers)if(t.canHandle(e)){const r=t.resolve(e);if(r)return r}return null}}function vh(n){return n.map(e=>{const t={...e,readOnly:!0};return e.type==="object"||e.type==="array"?{...t,fields:vh(e.fields)}:t})}const Sh=T.forwardRef((n,e)=>{const{schema:t,readOnly:r,primaryAction:s=!0,layout:o="vertical",loading:i=!0,values:l,initialValues:a,preSubmit:c=x=>x,onSubmit:u,postSubmit:d=()=>{},updateFieldSchema:f={},uiConfig:h,onFieldChange:p}=n,g=T.useMemo(()=>r?vh(t):t,[t,r]),[y,b]=T.useState(i),k=Zh({enhanceGetInputProps(x){return{onFieldChange:async M=>{var O;x.inputProps.onChange(M),await((O=p==null?void 0:p[x.field.replace(/\.\d+\./g,".")])==null?void 0:O.call(p,x.field,M,k))}}}}),w=T.useMemo(()=>new yS([new mS((h==null?void 0:h.customFieldNameRenderer)??{}),new gS((h==null?void 0:h.customTypeRenderer)??{}),new pS(o)]),[o,h]),E=k.onSubmit(async x=>{const M=ro(t,x);if(Object.keys(M).length){k.setErrors(M);return}const O=await c(x);await u(O),d(O)}),C=x=>{const M=ca(g,x);k.setValues(M),k.resetDirty(M)};return T.useEffect(()=>{let x=!1;return(async()=>{try{if(x)return;if(l)return C(await l());if(a)return C(await a());C()}finally{b(!1)}})(),()=>{x=!0}},[g,l,a]),T.useImperativeHandle(e,()=>({submit:()=>E(),reset:x=>{if(x){C(x);return}k.reset()},validate:()=>{const x=ro(t,k.values);return k.setErrors(x),Object.keys(x).length===0},getValues:()=>k.values,setValues:x=>{k.setValues(x)},getFieldValue:x=>k.getInputProps(x).value,setFieldValue:(x,M)=>{k.setFieldValue(x,M)},isValid:()=>Object.keys(k.errors).length===0,isDirty:()=>k.isDirty(),isLoading:()=>y,watch:(x,M)=>k.watch(x,M)})),m.jsx(Qh,{form:k,children:m.jsx(np,{value:f,children:m.jsx(ep,{value:w,children:m.jsxs(v.Box,{children:[aa[o](g.map(x=>m.jsx(so,{fieldSchema:x},x.name))),s&&m.jsx(v.Group,{justify:"flex-end",children:m.jsx(v.Button,{loading:y,onClick:()=>E(),children:"Submit"})})]})})})})});Sh.displayName="AutoForm";exports.AutoForm=Sh;exports.FieldRenderer=so;
|
|
194
|
+
a1 1 0 0 1 1 1Z`}),m.jsx("path",{d:"M10 11l-2 2 2 2"}),m.jsx("path",{d:"M14 11l2 2-2 2"})]})}const Cv={interactive:!0},On=v.factory((n,e)=>{const t=v.useProps("RichTextEditorControl",Cv,n),{classNames:r,className:s,style:o,styles:i,vars:l,interactive:a,active:c,onMouseDown:u,disabled:d,...f}=t,h=St();return m.jsx(v.UnstyledButton,{...f,...h.getStyles("control",{className:s,style:o,classNames:r,styles:i}),disabled:d,"data-rich-text-editor-control":!0,tabIndex:a?0:-1,"data-interactive":a||void 0,"data-disabled":d||void 0,"data-active":c||void 0,"aria-pressed":c&&a||void 0,"aria-hidden":!a||void 0,ref:e,unstyled:h.unstyled,variant:h.variant||"default",onMouseDown:p=>{p.preventDefault(),u==null||u(p)}})});On.classes=An;On.displayName="@mantine/tiptap/RichTextEditorControl";const sa=T.forwardRef(({className:n,icon:e,...t},r)=>{const s=St();return m.jsx(On,{ref:r,...t,children:m.jsx(e,{...s.getStyles("controlIcon")})})});sa.displayName="@mantine/tiptap/RichTextEditorControlBase";function me({label:n,isActive:e,operation:t,icon:r,isDisabled:s}){const o=T.forwardRef((i,l)=>{const{editor:a,labels:c}=St(),u=c[n];return m.jsx(sa,{"aria-label":u,title:u,active:e!=null&&e.name?a==null?void 0:a.isActive(e.name,e.attributes):!1,ref:l,icon:i.icon||r,disabled:(s==null?void 0:s(a))||!1,...i,onClick:()=>a==null?void 0:a.chain().focus()[t.name](t.attributes).run()})});return o.displayName=`@mantine/tiptap/${n}`,o}const Mv=me({label:"boldControlLabel",icon:n=>m.jsx(V1,{...n}),isActive:{name:"bold"},operation:{name:"toggleBold"}}),wv=me({label:"italicControlLabel",icon:n=>m.jsx(H1,{...n}),isActive:{name:"italic"},operation:{name:"toggleItalic"}}),Tv=me({label:"underlineControlLabel",icon:n=>m.jsx(W1,{...n}),isActive:{name:"underline"},operation:{name:"toggleUnderline"}}),Ev=me({label:"strikeControlLabel",icon:n=>m.jsx(Y1,{...n}),isActive:{name:"strike"},operation:{name:"toggleStrike"}}),Av=me({label:"clearFormattingControlLabel",icon:n=>m.jsx(U1,{...n}),operation:{name:"unsetAllMarks"}}),Ov=me({label:"unlinkControlLabel",icon:n=>m.jsx(tv,{...n}),operation:{name:"unsetLink"}}),Dv=me({label:"bulletListControlLabel",icon:n=>m.jsx(Z1,{...n}),isActive:{name:"bulletList"},operation:{name:"toggleBulletList"}}),Nv=me({label:"orderedListControlLabel",icon:n=>m.jsx(ev,{...n}),isActive:{name:"orderedList"},operation:{name:"toggleOrderedList"}}),Rv=me({label:"h1ControlLabel",icon:n=>m.jsx(q1,{...n}),isActive:{name:"heading",attributes:{level:1}},operation:{name:"toggleHeading",attributes:{level:1}}}),Lv=me({label:"h2ControlLabel",icon:n=>m.jsx(K1,{...n}),isActive:{name:"heading",attributes:{level:2}},operation:{name:"toggleHeading",attributes:{level:2}}}),Iv=me({label:"h3ControlLabel",icon:n=>m.jsx(J1,{...n}),isActive:{name:"heading",attributes:{level:3}},operation:{name:"toggleHeading",attributes:{level:3}}}),jv=me({label:"h4ControlLabel",icon:n=>m.jsx(G1,{...n}),isActive:{name:"heading",attributes:{level:4}},operation:{name:"toggleHeading",attributes:{level:4}}}),Pv=me({label:"h5ControlLabel",icon:n=>m.jsx(X1,{...n}),isActive:{name:"heading",attributes:{level:5}},operation:{name:"toggleHeading",attributes:{level:5}}}),_v=me({label:"h6ControlLabel",icon:n=>m.jsx(Q1,{...n}),isActive:{name:"heading",attributes:{level:6}},operation:{name:"toggleHeading",attributes:{level:6}}}),Bv=me({label:"blockquoteControlLabel",icon:n=>m.jsx(nv,{...n}),isActive:{name:"blockquote"},operation:{name:"toggleBlockquote"}}),Fv=me({label:"alignLeftControlLabel",icon:n=>m.jsx(rv,{...n}),operation:{name:"setTextAlign",attributes:"left"}}),zv=me({label:"alignRightControlLabel",icon:n=>m.jsx(sv,{...n}),operation:{name:"setTextAlign",attributes:"right"}}),$v=me({label:"alignCenterControlLabel",icon:n=>m.jsx(ov,{...n}),operation:{name:"setTextAlign",attributes:"center"}}),Vv=me({label:"alignJustifyControlLabel",icon:n=>m.jsx(iv,{...n}),operation:{name:"setTextAlign",attributes:"justify"}}),Hv=me({label:"subscriptControlLabel",icon:n=>m.jsx(lv,{...n}),isActive:{name:"subscript"},operation:{name:"toggleSubscript"}}),Wv=me({label:"superscriptControlLabel",icon:n=>m.jsx(av,{...n}),isActive:{name:"superscript"},operation:{name:"toggleSuperscript"}}),Yv=me({label:"codeControlLabel",icon:n=>m.jsx(gh,{...n}),isActive:{name:"code"},operation:{name:"toggleCode"}}),Uv=me({label:"codeBlockControlLabel",icon:n=>m.jsx(gh,{...n}),isActive:{name:"codeBlock"},operation:{name:"toggleCodeBlock"}}),qv=me({label:"highlightControlLabel",icon:n=>m.jsx(cv,{...n}),isActive:{name:"highlight"},operation:{name:"toggleHighlight"}}),Kv=me({label:"hrControlLabel",icon:n=>m.jsx(uv,{...n}),operation:{name:"setHorizontalRule"}}),Jv=me({label:"unsetColorControlLabel",icon:n=>m.jsx(yh,{...n}),operation:{name:"unsetColor"}}),Gv=me({label:"undoControlLabel",icon:n=>m.jsx(yv,{...n}),isDisabled:n=>!(n!=null&&n.can().undo()),operation:{name:"undo"}}),Xv=me({label:"redoControlLabel",icon:n=>m.jsx(bv,{...n}),isDisabled:n=>!(n!=null&&n.can().redo()),operation:{name:"redo"}}),Qv=me({label:"tasksControlLabel",icon:n=>m.jsx(kv,{...n}),isActive:{name:"taskList"},operation:{name:"toggleTaskList"}}),Zv=me({label:"tasksSinkLabel",icon:n=>m.jsx(xv,{...n}),operation:{name:"sinkListItem",attributes:"taskItem"},isDisabled:n=>!(n!=null&&n.can().sinkListItem("taskItem"))}),eS=me({label:"tasksLiftLabel",icon:n=>m.jsx(vv,{...n}),operation:{name:"liftListItem",attributes:"taskItem"},isDisabled:n=>!(n!=null&&n.can().liftListItem("taskItem"))}),tS=n=>m.jsx(mv,{...n}),oa=v.factory((n,e)=>{var V;const t=v.useProps("RichTextEditorLinkControl",null,n),{classNames:r,className:s,style:o,styles:i,vars:l,icon:a,popoverProps:c,disableTooltips:u,initialExternal:d,...f}=t,h=St(),p={classNames:r,styles:i},[g,y]=Cp(""),[b,k]=T.useState(d),[w,{open:E,close:C}]=il(!1),x=()=>{var q;E();const F=(q=h.editor)==null?void 0:q.getAttributes("link");y((F==null?void 0:F.href)||""),k(F!=null&&F.href?(F==null?void 0:F.target)==="_blank":d)},M=()=>{C(),y(""),k(d)},O=()=>{var F,q;M(),g===""?(F=h.editor)==null||F.chain().focus().extendMarkRange("link").unsetLink().run():(q=h.editor)==null||q.chain().focus().extendMarkRange("link").setLink({href:g,target:b?"_blank":null}).run()},j=F=>{F.key==="Enter"&&(F.preventDefault(),O())};xp("edit-link",x,!1);const{resolvedClassNames:B,resolvedStyles:Y}=v.useResolvedStylesApi({classNames:r,styles:i,props:t});return m.jsxs(v.Popover,{trapFocus:!0,shadow:"md",withinPortal:!0,opened:w,onChange:F=>!F&&M(),offset:-44,zIndex:1e4,...c,children:[m.jsx(v.Popover.Target,{children:m.jsx(sa,{icon:a||tS,...f,"aria-label":h.labels.linkControlLabel,title:h.labels.linkControlLabel,onClick:x,active:(V=h.editor)==null?void 0:V.isActive("link"),ref:e,classNames:B,styles:Y,className:s,style:o,variant:h.variant})}),m.jsx(v.Popover.Dropdown,{...h.getStyles("linkEditorDropdown",p),children:m.jsxs("div",{...h.getStyles("linkEditor",p),children:[m.jsx(v.TextInput,{placeholder:h.labels.linkEditorInputPlaceholder,"aria-label":h.labels.linkEditorInputLabel,type:"url",value:g,onChange:y,classNames:{input:h.getStyles("linkEditorInput",p).className},onKeyDown:j,rightSection:m.jsx(v.Tooltip,{label:b?h.labels.linkEditorExternalLink:h.labels.linkEditorInternalLink,events:{hover:!0,focus:!0,touch:!0},withinPortal:!0,withArrow:!0,disabled:u,zIndex:1e4,children:m.jsx(v.UnstyledButton,{onClick:()=>k(F=>!F),"data-active":b||void 0,...h.getStyles("linkEditorExternalControl",p),children:m.jsx(gv,{style:{width:v.rem(14),height:v.rem(14)}})})})}),m.jsx(v.Button,{variant:"default",onClick:O,...h.getStyles("linkEditorSave",p),children:h.labels.linkEditorSave})]})})]})});oa.classes=An;oa.displayName="@mantine/tiptap/RichTextEditorLinkControl";const bh=T.forwardRef((n,e)=>{const{popoverProps:t,colors:r,colorPickerProps:s,...o}=v.useProps("RichTextEditorColorPickerControl",null,n),{editor:i,labels:l,getStyles:a,variant:c}=St(),[u,{toggle:d,close:f}]=il(!1),[h,p]=T.useState("palette"),g=(i==null?void 0:i.getAttributes("textStyle").color)||"var(--mantine-color-text)",y=(w,E=!0)=>{(i==null?void 0:i.chain()).focus().setColor(w).run(),E&&f()},b=()=>{(i==null?void 0:i.chain()).focus().unsetColor().run(),f()},k=r.map((w,E)=>m.jsx(v.ColorSwatch,{component:"button",color:w,onClick:()=>y(w),size:26,radius:"xs",style:{cursor:"pointer"},title:l.colorPickerColorLabel(w),"aria-label":l.colorPickerColorLabel(w)},E));return m.jsxs(v.Popover,{opened:u,withinPortal:!0,trapFocus:!0,onChange:w=>!w&&f(),...t,children:[m.jsx(v.Popover.Target,{children:m.jsx(On,{...o,variant:c,"aria-label":l.colorPickerControlLabel,title:l.colorPickerControlLabel,ref:e,onClick:d,children:m.jsx(v.ColorSwatch,{color:g,size:14})})}),m.jsxs(v.Popover.Dropdown,{...a("linkEditorDropdown"),children:[h==="palette"&&m.jsx(v.SimpleGrid,{cols:7,spacing:2,children:k}),h==="colorPicker"&&m.jsx(v.ColorPicker,{defaultValue:g,onChange:w=>y(w,!1),...s}),m.jsx(v.Tooltip.Group,{closeDelay:200,children:m.jsxs(v.Group,{justify:"flex-end",gap:"xs",mt:"sm",children:[h==="palette"&&m.jsx(v.ActionIcon,{variant:"default",onClick:f,title:l.colorPickerCancel,"aria-label":l.colorPickerCancel,children:m.jsx(fv,{style:{width:v.rem(16),height:v.rem(16)}})}),m.jsx(v.ActionIcon,{variant:"default",onClick:b,title:l.colorPickerClear,"aria-label":l.colorPickerClear,children:m.jsx(yh,{style:{width:v.rem(16),height:v.rem(16)}})}),h==="palette"?m.jsx(v.ActionIcon,{variant:"default",onClick:()=>p("colorPicker"),title:l.colorPickerColorPicker,"aria-label":l.colorPickerColorPicker,children:m.jsx(dv,{style:{width:v.rem(16),height:v.rem(16)}})}):m.jsx(v.ActionIcon,{variant:"default",onClick:()=>p("palette"),"aria-label":l.colorPickerPalette,title:l.colorPickerPalette,children:m.jsx(hv,{style:{width:v.rem(16),height:v.rem(16)}})}),h==="colorPicker"&&m.jsx(v.ActionIcon,{variant:"default",onClick:f,title:l.colorPickerSave,"aria-label":l.colorPickerSave,children:m.jsx(pv,{style:{width:v.rem(16),height:v.rem(16)}})})]})})]})]})});bh.displayName="@mantine/tiptap/ColorPickerControl";const kh=T.forwardRef((n,e)=>{const{color:t,...r}=v.useProps("RichTextEditorColorControl",null,n),{editor:s,labels:o,variant:i}=St(),l=(s==null?void 0:s.getAttributes("textStyle").color)||null,a=o.colorControlLabel(t);return m.jsx(On,{...r,variant:i,active:l===t,"aria-label":a,title:a,onClick:()=>(s==null?void 0:s.chain()).focus().setColor(t).run(),ref:e,children:m.jsx(v.ColorSwatch,{color:t,size:14})})});kh.displayName="@mantine/tiptap/RichTextEditorColorControl";const nS={},xh=T.forwardRef((n,e)=>{const{...t}=v.useProps("RichTextEditorSourceCodeControl",nS,n),{editor:r,labels:s,variant:o,onSourceCodeTextSwitch:i}=St(),[l,a]=T.useState(!1),c=()=>{l?r==null||r.commands.setContent(r.getText(),{emitUpdate:!0}):r==null||r.commands.setContent(`<textarea>${r.getHTML()}</textarea>`);const u=!l;a(u),i==null||i(u)};return m.jsx(On,{...t,variant:o,active:l,"aria-label":s.sourceCodeControlLabel,title:s.sourceCodeControlLabel,onClick:()=>c(),ref:e,children:m.jsx(Sv,{style:{width:v.rem(16),height:v.rem(16)}})})});xh.displayName="@mantine/tiptap/RichTextEditorSourceCodeControl";const ia=v.factory((n,e)=>{const t=v.useProps("RichTextEditorControlsGroup",null,n),{classNames:r,className:s,style:o,styles:i,vars:l,variant:a,...c}=t,u=St();return m.jsx(v.Box,{ref:e,variant:a||u.variant,...u.getStyles("controlsGroup",{className:s,style:o,styles:i,classNames:r}),...c})});ia.classes=An;ia.displayName="@mantine/tiptap/RichTextEditorControlsGroup";const la=v.factory((n,e)=>{const t=v.useProps("RichTextEditorToolbar",null,n),{classNames:r,className:s,style:o,styles:i,vars:l,sticky:a,stickyOffset:c,mod:u,variant:d,...f}=t,h=St();return m.jsx(v.Box,{ref:e,mod:[{sticky:a},u],variant:d||h.variant,...h.getStyles("toolbar",{className:s,style:o,styles:i,classNames:r}),...f,__vars:{"--rte-sticky-offset":v.rem(c)}})});la.classes=An;la.displayName="@mantine/tiptap/RichTextEditorToolbar";const rS={withCodeHighlightStyles:!0,withTypographyStyles:!0,variant:"default"},$=v.factory((n,e)=>{const t=v.useProps("RichTextEditor",rS,n),{classNames:r,className:s,style:o,styles:i,unstyled:l,vars:a,editor:c,withCodeHighlightStyles:u,withTypographyStyles:d,onSourceCodeTextSwitch:f,labels:h,children:p,variant:g,attributes:y,...b}=t,k=v.useStyles({name:"RichTextEditor",classes:An,props:t,className:s,style:o,classNames:r,styles:i,unstyled:l,attributes:y,vars:a}),w=T.useMemo(()=>({...z1,...h}),[h]);return m.jsx($1,{value:{editor:c,getStyles:k,labels:w,withCodeHighlightStyles:u,withTypographyStyles:d,onSourceCodeTextSwitch:f,unstyled:l,variant:g},children:m.jsx(v.Box,{...k("root"),...b,ref:e,children:p})})});$.classes=An;$.displayName="@mantine/tiptap/RichTextEditor";$.Content=ra;$.Control=On;$.Toolbar=la;$.ControlsGroup=ia;$.Bold=Mv;$.Italic=wv;$.Strikethrough=Ev;$.Underline=Tv;$.ClearFormatting=Av;$.H1=Rv;$.H2=Lv;$.H3=Iv;$.H4=jv;$.H5=Pv;$.H6=_v;$.BulletList=Dv;$.OrderedList=Nv;$.Link=oa;$.Unlink=Ov;$.Blockquote=Bv;$.AlignLeft=Fv;$.AlignRight=zv;$.AlignCenter=$v;$.AlignJustify=Vv;$.Superscript=Wv;$.Subscript=Hv;$.Code=Yv;$.CodeBlock=Uv;$.ColorPicker=bh;$.Color=kh;$.Highlight=qv;$.Hr=Kv;$.UnsetColor=Jv;$.Undo=Gv;$.Redo=Xv;$.TaskList=Qv;$.TaskListSink=Zv;$.TaskListLift=eS;$.SourceCode=xh;function sS({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0,o=Yk({editable:!r&&!s,extensions:[O1,o1,$x,_1,F1,L1,j1.configure({types:["heading","paragraph"]})],content:t.value||"",onUpdate:({editor:i})=>{t.onChange(i.getHTML())}});return m.jsxs($,{editor:o,h:400,children:[m.jsxs($.Toolbar,{sticky:!0,stickyOffset:60,children:[m.jsxs($.ControlsGroup,{children:[m.jsx($.Bold,{}),m.jsx($.Italic,{}),m.jsx($.Underline,{}),m.jsx($.Strikethrough,{}),m.jsx($.ClearFormatting,{}),m.jsx($.Highlight,{}),m.jsx($.Code,{})]}),m.jsxs($.ControlsGroup,{children:[m.jsx($.H1,{}),m.jsx($.H2,{}),m.jsx($.H3,{}),m.jsx($.H4,{})]}),m.jsxs($.ControlsGroup,{children:[m.jsx($.Blockquote,{}),m.jsx($.Hr,{}),m.jsx($.BulletList,{}),m.jsx($.OrderedList,{}),m.jsx($.Subscript,{}),m.jsx($.Superscript,{})]}),m.jsxs($.ControlsGroup,{children:[m.jsx($.Link,{}),m.jsx($.Unlink,{})]}),m.jsxs($.ControlsGroup,{children:[m.jsx($.AlignLeft,{}),m.jsx($.AlignCenter,{}),m.jsx($.AlignJustify,{}),m.jsx($.AlignRight,{})]}),m.jsxs($.ControlsGroup,{children:[m.jsx($.Undo,{}),m.jsx($.Redo,{})]})]}),m.jsx($.Content,{})]})}function oS({field:n,form:e}){const t=n,r=e.getInputProps(t.name),s=t.readOnly===!0,o=t.disabled===!0;return s||o?m.jsx(v.Select,{data:t.data,value:r.value,disabled:o||s,readOnly:s,placeholder:t.placeholder,required:t.required,variant:s?"filled":"default",error:void 0}):m.jsx(v.Select,{data:t.data,...r,placeholder:t.placeholder,error:void 0,onChange:i=>r.onFieldChange(i)})}function iS({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0;return r||s?m.jsx(v.Switch,{value:t.value,readOnly:r,disabled:s,required:n.required,placeholder:n.placeholder,variant:r?"filled":"default",error:void 0,checked:t.value}):m.jsx(v.Switch,{...t,checked:t.value,onChange:o=>t.onFieldChange(o.target.checked),required:n.required,placeholder:n.placeholder,error:void 0})}function lS({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0;return r||s?m.jsx(v.TagsInput,{value:t.value||[],readOnly:r,disabled:s,required:n.required,placeholder:n.placeholder,variant:r?"filled":"default",error:void 0}):m.jsx(v.TagsInput,{value:t.value||[],onChange:o=>t.onChange(o),required:n.required,placeholder:n.placeholder,error:void 0})}function aS({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0;return r||s?m.jsx(v.TextInput,{value:t.value,readOnly:r,disabled:s,required:n.required,placeholder:n.placeholder,variant:r?"filled":"default",error:void 0}):m.jsx(v.TextInput,{...t,onChange:o=>t.onFieldChange(o.target.value),required:n.required,placeholder:n.placeholder,error:void 0})}function cS({field:n,form:e}){const t=e.getInputProps(n.name),r=n.readOnly===!0,s=n.disabled===!0,o=typeof t.value=="string"?t.value:"",i=T.useRef(null),l=m.jsx(v.ActionIcon,{variant:"subtle",color:"gray",onClick:()=>{var a;return(a=i.current)==null?void 0:a.showPicker()},children:"⏰"});return r||s?m.jsx(fs,{value:o,readOnly:r,disabled:s,required:n.required,placeholder:n.placeholder,variant:r?"filled":"default",error:void 0}):m.jsx(fs,{value:o,onChange:a=>t.onChange(a.currentTarget.value),required:n.required,placeholder:n.placeholder,error:void 0,ref:i,rightSection:l})}const aa={vertical:n=>m.jsx(v.Stack,{gap:"md",children:n}),horizontal:n=>m.jsx(v.Group,{wrap:"wrap",gap:"md",children:n}),grid:n=>m.jsx(v.Grid,{gutter:"md",children:n})},uS=({field:n,layout:e="vertical"})=>{const t=n;return aa[e](t.fields.map(r=>{const s={...r,name:`${t.name}.${r.name}`,disabled:t.disabled,visible:t.visible};return m.jsx(so,{fieldSchema:s})}))},nl=n=>{switch(n){case"number":return 0;case"array":return[];case"checkbox":return!1;case"object":return{};case"select":case"date":case"datetime":return null;default:return""}};function ca(n,e={}){const t={};for(const r of n)r.type==="object"&&r.fields?t[r.name]=ca(r.fields,e==null?void 0:e[r.name]):t[r.name]=(e==null?void 0:e[r.name])??r.initialValue??nl(r.type);return t}function ro(n,e){const t={};for(const r of n){const s=(e==null?void 0:e[r.name])??nl(r.type);if(r.required)if(r.type==="object"){Object.values(s).length||(t[r.name]=`${r.label||r.name} is required`);const o=ro(r.fields,s);for(const[i,l]of Object.entries(o))t[`${r.name}.${i}`]=l}else r.type==="array"?(s.length||(t[r.name]=`${r.label||r.name} is required`),s.forEach((o,i)=>{const l=ro(r.fields,o);for(const[a,c]of Object.entries(l))t[`${r.name}.${i}.${a}`]=c})):s===nl(r.type)&&(t[r.name]=`${r.label||r.name} is required`)}return t}const dS=n=>{const{field:e,form:t,layout:r="vertical"}=n,s=e,o=t.getInputProps(s.name),i=(o==null?void 0:o.value)??[];e.visible,e.disabled,e.readOnly;function l(){o.onFieldChange([...i,ca(s.fields)])}function a(c){o.onFieldChange(i.filter((u,d)=>d!==c))}return m.jsxs(m.Fragment,{children:[aa[r](i.map((c,u)=>m.jsxs(T.Fragment,{children:[s.fields.map(d=>{const f={...d,name:`${s.name}.${u}.${d.name}`};return m.jsx(so,{fieldSchema:f},f.name)}),m.jsx(v.Button,{size:"compact-md",color:"red",w:120,onClick:()=>a(u),children:"Delete row"})]},u))),m.jsxs(m.Fragment,{children:[i.length>0&&m.jsx(v.Divider,{mb:"md"}),m.jsx(v.Button,{onClick:l,variant:"light",size:"compact-md",children:"Add"})]})]})},fS=({field:n,children:e})=>{const t=au(),{error:r}=t.getInputProps(n.name);return m.jsxs(v.Stack,{gap:4,children:[n.label&&m.jsxs(v.Text,{fw:500,size:"sm",mb:2,component:"label",htmlFor:n.name,style:{display:"block"},children:[n.label," ",n.required&&m.jsx(v.Text,{component:"span",c:"red",fz:"sm",children:"*"})]}),m.jsx(v.Box,{children:e}),n.description&&m.jsx(v.Text,{size:"xs",c:"dimmed",mt:2,style:{lineHeight:1.4},children:n.description}),r&&m.jsx(v.Text,{size:"xs",c:"red",mt:2,style:{fontWeight:500},children:r})]})};function hS(n){const{layout:e,field:t,form:r}=n;let s=null;switch(t.type){case"text":s=m.jsx(aS,{field:t,form:r});break;case"select":s=m.jsx(oS,{field:t,form:r});break;case"object":s=m.jsx(uS,{field:t,form:r,layout:e});break;case"array":s=m.jsx(dS,{field:t,form:r,layout:e});break;case"checkbox":s=m.jsx(sp,{field:t,form:r});break;case"number":s=m.jsx(Tm,{field:t,form:r});break;case"date":s=m.jsx(Cm,{field:t,form:r});break;case"datetime":s=m.jsx(wm,{field:t,form:r});break;case"switch":s=m.jsx(iS,{field:t,form:r});break;case"texteditor":s=m.jsx(sS,{field:t,form:r});break;case"time":s=m.jsx(cS,{field:t,form:r});break;case"tags":s=m.jsx(lS,{field:t,form:r});break;default:s=m.jsxs("div",{children:["Unsupported field type: ",t.type]});break}return m.jsx(fS,{field:t,children:s})}class pS{constructor(e){ha(this,"layout");this.layout=e}canHandle(){return!0}resolve(e){return hS}}class mS{constructor(e){this.renderers=e}canHandle(e){return!!this.renderers[e.name.replace(/\.\d+\./g,".")]}resolve(e){return this.renderers[e.name.replace(/\.\d+\./g,".")]??null}}class gS{constructor(e){this.renderers=e}canHandle(e){return!!this.renderers[e.type]}resolve(e){return this.renderers[e.type]??null}}class yS{constructor(e){this.handlers=e}resolve(e){for(const t of this.handlers)if(t.canHandle(e)){const r=t.resolve(e);if(r)return r}return null}}function vh(n){return n.map(e=>{const t={...e,readOnly:!0};return e.type==="object"||e.type==="array"?{...t,fields:vh(e.fields)}:t})}class bS{constructor(e){this.renderers=e}canHandle(e){return!!this.renderers[`${e.type}`]}resolve(e){return this.renderers[`${e.type}`]??null}}const Sh=T.forwardRef((n,e)=>{const{schema:t,readOnly:r,primaryAction:s=!0,layout:o="vertical",loading:i=!0,values:l,initialValues:a,preSubmit:c=x=>x,onSubmit:u,postSubmit:d=()=>{},updateFieldSchema:f={},uiConfig:h,onFieldChange:p}=n,g=T.useMemo(()=>r?vh(t):t,[t,r]),[y,b]=T.useState(i),k=Zh({enhanceGetInputProps(x){return{onFieldChange:async M=>{var O;x.inputProps.onChange(M),await((O=p==null?void 0:p[x.field.replace(/\.\d+\./g,".")])==null?void 0:O.call(p,x.field,M,k))}}}}),w=T.useMemo(()=>new yS([new mS((h==null?void 0:h.customFieldNameRenderers)??{}),new bS((h==null?void 0:h.customFieldTypeRenderers)??{}),new gS((h==null?void 0:h.customTypeRenderers)??{}),new pS(o)]),[o,h]),E=k.onSubmit(async x=>{const M=ro(t,x);if(Object.keys(M).length){k.setErrors(M);return}const O=await c(x);await u(O),d(O)}),C=x=>{const M=ca(g,x);k.setValues(M),k.resetDirty(M)};return T.useEffect(()=>{let x=!1;return(async()=>{try{if(x)return;if(l)return C(await l());if(a)return C(await a());C()}finally{b(!1)}})(),()=>{x=!0}},[g,l,a]),T.useImperativeHandle(e,()=>({submit:()=>E(),reset:x=>{if(x){C(x);return}k.reset()},validate:()=>{const x=ro(t,k.values);return k.setErrors(x),Object.keys(x).length===0},getValues:()=>k.values,setValues:x=>{k.setValues(x)},getFieldValue:x=>k.getInputProps(x).value,setFieldValue:(x,M)=>{k.setFieldValue(x,M)},isValid:()=>Object.keys(k.errors).length===0,isDirty:()=>k.isDirty(),isLoading:()=>y,watch:(x,M)=>k.watch(x,M)})),m.jsx(Qh,{form:k,children:m.jsx(np,{value:f,children:m.jsx(ep,{value:w,children:m.jsxs(v.Box,{children:[aa[o](g.map(x=>m.jsx(so,{fieldSchema:x},x.name))),s&&m.jsx(v.Group,{justify:"flex-end",children:m.jsx(v.Button,{loading:y,onClick:()=>E(),children:"Submit"})})]})})})})});Sh.displayName="AutoForm";exports.AutoForm=Sh;exports.FieldRenderer=so;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,3 +2,4 @@ export { default as AutoForm } from './components/AutoForm/AutoForm';
|
|
|
2
2
|
export type { AutoFormProps, AutoFormRef, } from './components/AutoForm/AutoForm.types';
|
|
3
3
|
export { default as FieldRenderer } from './fields/FieldRenderer/FieldRenderer';
|
|
4
4
|
export type { FieldRendererProps } from './components/AutoForm/AutoForm.types';
|
|
5
|
+
export type { FieldSchema } from './fields/types';
|
package/dist/index.es.js
CHANGED
|
@@ -23446,10 +23446,10 @@ class uC {
|
|
|
23446
23446
|
this.renderers = e;
|
|
23447
23447
|
}
|
|
23448
23448
|
canHandle(e) {
|
|
23449
|
-
return !!this.renderers[e.name];
|
|
23449
|
+
return !!this.renderers[e.name.replace(/\.\d+\./g, ".")];
|
|
23450
23450
|
}
|
|
23451
23451
|
resolve(e) {
|
|
23452
|
-
return this.renderers[e.name] ?? null;
|
|
23452
|
+
return this.renderers[e.name.replace(/\.\d+\./g, ".")] ?? null;
|
|
23453
23453
|
}
|
|
23454
23454
|
}
|
|
23455
23455
|
class dC {
|
|
@@ -23490,7 +23490,18 @@ function cp(n) {
|
|
|
23490
23490
|
} : t;
|
|
23491
23491
|
});
|
|
23492
23492
|
}
|
|
23493
|
-
|
|
23493
|
+
class hC {
|
|
23494
|
+
constructor(e) {
|
|
23495
|
+
this.renderers = e;
|
|
23496
|
+
}
|
|
23497
|
+
canHandle(e) {
|
|
23498
|
+
return !!this.renderers[`${e.type}`];
|
|
23499
|
+
}
|
|
23500
|
+
resolve(e) {
|
|
23501
|
+
return this.renderers[`${e.type}`] ?? null;
|
|
23502
|
+
}
|
|
23503
|
+
}
|
|
23504
|
+
const pC = Vt((n, e) => {
|
|
23494
23505
|
const {
|
|
23495
23506
|
schema: t,
|
|
23496
23507
|
readOnly: r,
|
|
@@ -23525,8 +23536,9 @@ const hC = Vt((n, e) => {
|
|
|
23525
23536
|
}
|
|
23526
23537
|
}), M = Wi(
|
|
23527
23538
|
() => new fC([
|
|
23528
|
-
new uC((h == null ? void 0 : h.
|
|
23529
|
-
new
|
|
23539
|
+
new uC((h == null ? void 0 : h.customFieldNameRenderers) ?? {}),
|
|
23540
|
+
new hC((h == null ? void 0 : h.customFieldTypeRenderers) ?? {}),
|
|
23541
|
+
new dC((h == null ? void 0 : h.customTypeRenderers) ?? {}),
|
|
23530
23542
|
new cC(o)
|
|
23531
23543
|
]),
|
|
23532
23544
|
[o, h]
|
|
@@ -23591,8 +23603,8 @@ const hC = Vt((n, e) => {
|
|
|
23591
23603
|
s && /* @__PURE__ */ m.jsx(Ll, { justify: "flex-end", children: /* @__PURE__ */ m.jsx(Ns, { loading: y, onClick: () => w(), children: "Submit" }) })
|
|
23592
23604
|
] }) }) }) });
|
|
23593
23605
|
});
|
|
23594
|
-
|
|
23606
|
+
pC.displayName = "AutoForm";
|
|
23595
23607
|
export {
|
|
23596
|
-
|
|
23608
|
+
pC as AutoForm,
|
|
23597
23609
|
Il as FieldRenderer
|
|
23598
23610
|
};
|