@pie-element/charting 12.1.2-next.12 → 12.1.2-next.13
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/author.js +2 -0
- package/dist/browser/author/index.js +1 -1
- package/dist/browser/{chart-CP9JFi6F.js → chart-BYVLiHHK.js} +109 -5
- package/dist/browser/chart-BYVLiHHK.js.map +1 -0
- package/dist/browser/delivery/index.js +1 -1
- package/dist/index.iife.js +25 -25
- package/package.json +4 -3
- package/dist/browser/chart-CP9JFi6F.js.map +0 -1
package/dist/index.iife.js
CHANGED
|
@@ -273,36 +273,36 @@ img.ProseMirror-separator {
|
|
|
273
273
|
`):``,markdownTokenizer:{name:`orderedList`,level:`block`,start:()=>-1,tokenize:(e,t,n)=>{let r=e.split(`
|
|
274
274
|
`),[i,a]=eP(r);if(i.length===0)return;let o=rP(i,i[0].indent,n);if(o.length!==0)return{type:`list`,ordered:!0,start:i[0]?.number||1,typeMarker:i[0]?.type,items:o,raw:r.slice(0,a).join(`
|
|
275
275
|
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(aP,this.editor.getAttributes(oP)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new ey({props:{handlePaste:(e,t)=>{if((t.clipboardData?.getData(`text/html`))?.trim())return!1;let n=t.clipboardData?.getData(`text/plain`);if(!n)return!1;let r=nP(n);if(!r)return!1;try{let t=e.state.schema.nodeFromJSON(r),n=e.state.tr.replaceSelectionWith(t);return e.dispatch(n),!0}catch{return!1}}}})]},addInputRules(){let e=(e,t)=>(!t.attrs.type||t.attrs.type===`1`)&&t.childCount+t.attrs.start===+e[1],t=xO({find:sP,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:e});return(this.options.keepMarks||this.options.keepAttributes)&&(t=xO({find:sP,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(oP)}),joinPredicate:e,editor:this.editor})),[t]}}),uP=/^\s*(\[([( |x])?\])\s$/,dP=`position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0`,fP=(e,t,n)=>{var r;return(n==null||(r=n.checkboxLabel)==null?void 0:r.call(n,e,t))||`Task item checkbox for ${e.textContent||`empty task item`}`},pP=wO.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:e=>{let t=e.getAttribute(`data-checked`);return t===``||t===`true`},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51,contentElement:e=>e.querySelector(`div`)??e}]},renderHTML({node:e,HTMLAttributes:t}){return[`li`,nE(this.options.HTMLAttributes,t,{"data-type":this.name}),[`label`,[`input`,{type:`checkbox`,checked:e.attrs.checked?`checked`:null}],[`span`]],[`div`,0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode(`paragraph`,{},t.parseInline(e.tokens))):e.text?n.push(t.createNode(`paragraph`,{},[t.createNode(`text`,{text:e.text})])):n.push(t.createNode(`paragraph`,{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode(`taskItem`,{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>zD(e,t,`- [${e.attrs?.checked?`x`:` `}] `),addExtensions(){return this.options.nested?[vN(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement(`li`),a=document.createElement(`label`),o=document.createElement(`span`),s=document.createElement(`input`),c=document.createElement(`div`);o.style.cssText=dP;let l=e=>{let t=fP(e,e.attrs.checked,this.options.a11y);s.setAttribute(`aria-label`,t),o.textContent=t};l(e),a.contentEditable=`false`,s.type=`checkbox`,s.addEventListener(`mousedown`,e=>e.preventDefault()),s.addEventListener(`change`,t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}let{checked:i}=t.target;r.isEditable&&typeof n==`function`&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if(typeof t!=`number`)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...r?.attrs,checked:i}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,i)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,a.append(s,o),i.append(a,c),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let u=new Set(Object.keys(t));return{dom:i,contentDOM:c,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,l(e);let t=r.extensionManager.attributes,n=rE(e,t),a=new Set(Object.keys(n)),o=this.options.HTMLAttributes;return u.forEach(e=>{a.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{t==null?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),u=a,!0}}}},addInputRules(){return[xO({find:uP,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),mP=wO.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:e}){return[`ul`,nE(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode(`taskList`,{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
276
|
-
`):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=ID(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(t){let r={type:`taskList`,raw:t.raw,items:t.items},i=e.slice(t.raw.length);return i.trim()?[r,...n.blockTokens(i)]:[r]}return n.blockTokens(e)},i=ID(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});tO.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(mN.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(LN.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(KN.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(lP.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(pP.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(mP.configure(this.options.taskList)),e}});var hP=` `,gP=`\xA0`,_P=wO.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,nE(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===hP||n[0].text===hP||n[0].raw===gP||n[0].text===gP)&&r.length===1&&r[0].type===`text`&&(r[0].text===hP||r[0].text===gP)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){var i,a;let e=Array.isArray(n==null||(i=n.previousNode)==null?void 0:i.content)?n.previousNode.content:[];return(n==null||(a=n.previousNode)==null?void 0:a.type)===`paragraph`&&e.length===0?hP:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),vP=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,yP=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,bP=qD.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,nE(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[vO({find:vP,type:this.type})]},addPasteRules(){return[EO({find:yP,type:this.type})]}}),xP=wO.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),SP=qD.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,nE(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:`underline`,raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function CP(e={}){return new ey({view(t){return new wP(t,e)}})}var wP=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}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,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.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,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`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}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(t&&!i){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=dv(this.editorView.state.doc,e,this.editorView.dragging.slice);t!=null&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},TP=class e extends Mv{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):Mv.near(r)}content(){return U.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new EP(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!OP(e)||!kP(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)<o.childCount:t.index(r)>0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}else if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!Rv.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}};TP.prototype.visible=!1,TP.findFrom=TP.findGapCursorFrom,Mv.jsonID(`gapcursor`,TP);var EP=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return TP.valid(t)?new TP(t):Mv.near(t)}};function DP(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function OP(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||DP(e.type))return!0;if(e.inlineContent)return!1}}return!0}function kP(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||DP(e.type))return!0;if(e.inlineContent)return!1}}return!0}function AP(){return new ey({props:{decorations:FP,createSelectionBetween(e,t,n){return t.pos==n.pos&&TP.valid(n)?new TP(n):null},handleClick:NP,handleKeyDown:jP,handleDOMEvents:{beforeinput:PP}}})}var jP=ww({ArrowLeft:MP(`horiz`,-1),ArrowRight:MP(`horiz`,1),ArrowUp:MP(`vert`,-1),ArrowDown:MP(`vert`,1)});function MP(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof Iv){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=TP.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new TP(c))),!0):!1}}function NP(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!TP.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&Rv.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new TP(r))),!0)}function PP(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof TP))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=H.empty;for(let e=r.length-1;e>=0;e--)i=H.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new U(i,0,0));return a.setSelection(Iv.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function FP(e){if(!(e.selection instanceof TP))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,AC.create(e.doc,[DC.widget(e.selection.head,t,{key:`gapcursor`})])}var IP=200,LP=function(){};LP.prototype.append=function(e){return e.length?(e=LP.from(e),!this.length&&e||e.length<IP&&this.leafAppend(e)||this.length<IP&&e.leafPrepend(this)||this.appendInner(e)):this},LP.prototype.prepend=function(e){return e.length?LP.from(e).append(this):this},LP.prototype.appendInner=function(e){return new zP(this,e)},LP.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?LP.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},LP.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},LP.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},LP.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},LP.from=function(e){return e instanceof LP?e:e&&e.length?new RP(e):LP.empty};var RP=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return e==0&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(e(this.values[i],r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(e(this.values[i],r+i)===!1)return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=IP)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=IP)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(LP);LP.empty=new RP([]);var zP=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&this.left.forEachInner(e,t,Math.min(n,i),r)===!1||n>i&&this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)===!1||n<i&&this.left.forEachInvertedInner(e,Math.min(t,i),n,r)===!1)return!1},t.prototype.sliceInner=function(e,t){if(e==0&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(LP),BP=500,VP=class e{constructor(e,t){this.items=e,this.eventCount=t}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=t.tr,s,c,l=[],u=[];return this.items.forEach((t,n)=>{if(!t.step){i||(i=this.remapping(r,n+1),a=i.maps.length),a--,u.push(t);return}if(i){u.push(new UP(t.map));let e=t.step.map(i.slice(a)),n;e&&o.maybeStep(e).doc&&(n=o.mapping.maps[o.mapping.maps.length-1],l.push(new UP(n,void 0,void 0,l.length+u.length))),a--,n&&i.appendMap(n,a)}else o.maybeStep(t.step);if(t.selection)return s=i?t.selection.map(i.slice(a)):t.selection,c=new e(this.items.slice(0,r).append(u.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:s}}addTransform(t,n,r,i){let a=[],o=this.eventCount,s=this.items,c=!i&&s.length?s.get(s.length-1):null;for(let e=0;e<t.steps.length;e++){let r=t.steps[e].invert(t.docs[e]),l=new UP(t.mapping.maps[e],r,n),u;(u=c&&c.merge(l))&&(l=u,e?a.pop():s=s.slice(0,s.length-1)),a.push(l),n&&=(o++,void 0),i||(c=l)}let l=o-r.depth;return l>GP&&(s=HP(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new k_;return this.items.forEach((t,r)=>{let i=t.mirrorOffset!=null&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(e=>new UP(e))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),a=t.mapping,o=t.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},i);let c=n;this.items.forEach(e=>{let n=a.getMirror(--c);if(n==null)return;o=Math.min(o,n);let i=a.maps[n];if(e.step){let o=t.steps[n].invert(t.docs[n]),l=e.selection&&e.selection.map(a.slice(c+1,n));l&&s++,r.push(new UP(i,o,l))}else r.push(new UP(i))},i);let l=[];for(let e=n;e<o;e++)l.push(new UP(a.maps[e]));let u=this.items.slice(0,i).append(l).append(r),d=new e(u,s);return d.emptyItemCount()>BP&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],a=0;return this.items.forEach((e,o)=>{if(o>=t)i.push(e),e.selection&&a++;else if(e.step){let t=e.step.map(n.slice(r)),o=t&&t.getMap();if(r--,o&&n.appendMap(o,r),t){let s=e.selection&&e.selection.map(n.slice(r));s&&a++;let c=new UP(o.invert(),t,s),l,u=i.length-1;(l=i.length&&i[u].merge(c))?i[u]=l:i.push(c)}}else e.map&&r--},this.items.length,0),new e(LP.from(i.reverse()),a)}};VP.empty=new VP(LP.empty,0);function HP(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}var UP=class e{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}},WP=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}},GP=20;function KP(e,t,n,r){let i=n.getMeta(eF),a;if(i)return i.historyState;n.getMeta(tF)&&(e=new WP(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(eF))return o.getMeta(eF).redo?new WP(e.done.addTransform(n,void 0,r,$P(t)),e.undone,JP(n.mapping.maps),e.prevTime,e.prevComposition):new WP(e.done,e.undone.addTransform(n,void 0,r,$P(t)),null,e.prevTime,e.prevComposition);if(n.getMeta(`addToHistory`)!==!1&&!(o&&o.getMeta(`addToHistory`)===!1)){let i=n.getMeta(`composition`),a=e.prevTime==0||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!qP(n,e.prevRanges)),s=o?YP(e.prevRanges,n.mapping):JP(n.mapping.maps);return new WP(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,$P(t)),VP.empty,s,n.time,i??e.prevComposition)}else if(a=n.getMeta(`rebased`))return new WP(e.done.rebased(n,a),e.undone.rebased(n,a),YP(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new WP(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),YP(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function qP(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}function JP(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function YP(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),a=t.map(e[r+1],-1);i<=a&&n.push(i,a)}return n}function XP(e,t,n){let r=$P(t),i=eF.get(t).spec.config,a=(n?e.undone:e.done).popEvent(t,r);if(!a)return null;let o=a.selection.resolve(a.transform.doc),s=(n?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),i,r),c=new WP(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(eF,{redo:n,historyState:c})}var ZP=!1,QP=null;function $P(e){let t=e.plugins;if(QP!=t){ZP=!1,QP=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){ZP=!0;break}}return ZP}var eF=new ry(`history`),tF=new ry(`closeHistory`);function nF(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new ey({key:eF,state:{init(){return new WP(VP.empty,VP.empty,null,0,-1)},apply(t,n,r){return KP(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n==`historyUndo`?iF:n==`historyRedo`?aF:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function rF(e,t){return(n,r)=>{let i=eF.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=XP(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var iF=rF(!1,!0),aF=rF(!0,!0),oF=tO.create({name:`characterCount`,addOptions(){return{limit:null,autoTrim:!0,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new ey({key:new ry(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,a=this.options.autoTrim;if(i==null||i===0||a===!1){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){let t=o-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}}),sF=tO.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[CP(this.options)]}});tO.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new ey({key:new ry(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return AC.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(DC.node(t,t+e.nodeSize,{class:this.options.className}))}),AC.create(e,a)}}})]}});var cF=tO.create({name:`gapCursor`,addProseMirrorPlugins(){return[AP()]},extendNodeSchema(e){return{allowGapCursor:XT(W(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),lF=`placeholder`,uF=new ry(`tiptap__placeholder`);function dF(e){let{editor:t,placeholder:n,dataAttribute:r,pos:i,node:a,isEmptyDoc:o,hasAnchor:s,classes:{emptyNode:c,emptyEditor:l}}=e,u=[c];return o&&u.push(l),DC.node(i,i+a.nodeSize,{class:u.join(` `),[r]:typeof n==`function`?n({editor:t,node:a,pos:i,hasAnchor:s}):n})}function fF(e,t){return typeof e==`function`?e(t):e}function pF({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:a,to:o}){let{anchor:s}=i,c=[],l=e.isEmpty;return r.nodesBetween(a,o,(r,i)=>{let a=s>=i&&s<=i+r.nodeSize,o=!r.isLeaf&&ME(r);return r.type.isTextblock&&(a||!t.showOnlyCurrent)&&o&&c.push(dF({editor:e,isEmptyDoc:l,dataAttribute:n,hasAnchor:a,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:fF(t.emptyNodeClass,{editor:e,node:r,pos:i,hasAnchor:a})},node:r,pos:i})),t.includeChildren}),c}function mF({editor:e,options:t,dataAttribute:n,doc:r,selection:i}){if(!(e.isEditable||!t.showOnlyWhenEditable))return null;let{anchor:a}=i,o=[],s=e.isEmpty;if(t.showOnlyCurrent&&!t.includeChildren){let i=r.resolve(a),c=i.depth>0?i.node(1):i.nodeAfter,l=i.depth>0?i.before(1):a;if(c&&c.type.isTextblock&&ME(c)){let r=a>=l&&a<=l+c.nodeSize;o.push(dF({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:r,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:fF(t.emptyNodeClass,{editor:e,node:c,pos:l,hasAnchor:r})},node:c,pos:l}))}}else o.push(...pF({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:0,to:r.content.size}));return AC.create(r,o)}function hF(e,t){let n=e.resolve(t);if(n.depth===0){let e=n.nodeAfter??n.nodeBefore;if(!e)return{from:t,to:t};let r=n.nodeAfter?t:t-e.nodeSize;return{from:r,to:r+e.nodeSize}}let r=n.before(1);return{from:r,to:r+n.node(1).nodeSize}}function gF(e,t){return{from:Math.max(0,t.from-1),to:Math.min(e.content.size,t.to-1)}}function _F(e,t,n){let r=[];return e.forEach((e,i)=>{let a=i,o=a+e.nodeSize,s=a+1,c=o+1;s<n&&c>t&&r.push({from:a,to:o})}),r}function vF(e){if(e.length===0)return[];let t=[...e].sort((e,t)=>e.from-t.from),n=[{...t[0]}];for(let e=1;e<t.length;e+=1){let r=n[n.length-1],i=t[e];i.from<=r.to?r.to=Math.max(r.to,i.to):n.push({...i})}return n}function yF(e,t){let n=_F(e,t.from,t.to);return n.push(gF(e,hF(e,t.from))),t.to>t.from?n.push(gF(e,hF(e,Math.min(t.to,e.content.size+1)-1))):t.from<e.content.size+1&&n.push(gF(e,hF(e,Math.min(t.from+1,e.content.size)))),n}function bF(e,t,n){let r=[];if(e.docChanged){let t=yE(e);for(let e of t)r.push(...yF(n.doc,e.newRange))}return e.selectionSet&&(r.push(gF(n.doc,hF(n.doc,e.mapping.map(t.selection.anchor)))),r.push(gF(n.doc,hF(n.doc,n.selection.anchor)))),vF(r)}function xF(e,t,n){let r=Math.max(0,Math.min(e,n.content.size));return{from:r,to:Math.max(r,Math.min(t,n.content.size))}}function SF({decorations:e,ranges:t,editor:n,options:r,dataAttribute:i,doc:a,selection:o}){let s=e;for(let e of t){let{from:t,to:c}=xF(e.from,e.to,a),l=s.find(t,c).filter(e=>e.from>=t&&e.to<=c);l.length&&(s=s.remove(l));let u=pF({editor:n,options:r,dataAttribute:i,doc:a,selection:o,from:t,to:c});u.length&&(s=s.add(a,u))}return s}function CF({editor:e,options:t,dataAttribute:n}){return{init(r,i){return mF({editor:e,options:t,dataAttribute:n,doc:i.doc,selection:i.selection})??AC.empty},apply(r,i,a,o){return!r.docChanged&&!r.selectionSet?i:SF({decorations:i.map(r.mapping,r.doc),ranges:bF(r,a,o),editor:e,options:t,dataAttribute:n,doc:o.doc,selection:o.selection})}}}function wF(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}function TF({editor:e,options:t}){let n=t.dataAttribute?`data-${wF(t.dataAttribute)}`:`data-${lF}`,r=t.showOnlyCurrent&&!t.includeChildren;return new ey({key:uF,...r?{}:{state:CF({editor:e,options:t,dataAttribute:n})},props:{decorations:r?({doc:r,selection:i})=>mF({editor:e,options:t,dataAttribute:n,doc:r,selection:i}):n=>t.showOnlyWhenEditable&&!e.isEditable?AC.empty:uF.getState(n)??AC.empty}})}var EF=tO.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:lF,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[TF({editor:this.editor,options:this.options})]}});function DF(e,t){return!e.selection.empty&&!NE(e.selection)&&t.isEditable}function OF(e,t){return DF(e,t)&&!t.isFocused&&!t.view.dragging}function kF(){var e;(e=window.getSelection())==null||e.removeAllRanges()}function AF(e){e.focus()}tO.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new ey({key:new ry(`selection`),props:{decorations(n){return OF(n,e)?AC.create(n.doc,[DC.inline(n.selection.from,n.selection.to,{class:t.className})]):null},handleDOMEvents:{blur(t){return DF(t.state,e)&&kF(),!1},focus(t){return DF(t.state,e)&&requestAnimationFrame(()=>{!e.isDestroyed&&t.hasFocus()&&AF(t)}),!1}}}})]}});function jF({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var MF=tO.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new ry(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new ey({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!jF({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!jF({node:r,types:n})}}})]}}),NF=tO.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>iF(e,t),redo:()=>({state:e,dispatch:t})=>aF(e,t)}},addProseMirrorPlugins(){return[nF(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()}}}),PF=tO.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(CA.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(vA.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(mN.configure(this.options.bulletList)),this.options.code!==!1&&e.push(EA.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(AA.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(jA.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(sF.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(cF.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(MA.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(NA.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(NF.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(PA.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(zA.configure(this.options.italic)),this.options.listItem!==!1&&e.push(LN.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(KN.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(uN.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(lP.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(_P.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(bP.configure(this.options.strike)),this.options.text!==!1&&e.push(xP.configure(this.options.text)),this.options.underline!==!1&&e.push(SP.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(MF.configure(this.options?.trailingNode)),e}}),FF=20,IF=(e,t=0)=>{let n=[];return!e.children.length||t>FF||Array.from(e.children).forEach(e=>{e.tagName===`SPAN`?n.push(e):e.children.length&&n.push(...IF(e,t+1))}),n},LF=e=>{if(!e.children.length)return;let t=IF(e);t&&t.forEach(e=>{var t;let n=e.getAttribute(`style`),r=(t=e.parentElement)==null||(t=t.closest(`span`))==null?void 0:t.getAttribute(`style`);e.setAttribute(`style`,`${r};${n}`)})},RF=qD.create({name:`textStyle`,priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:`span`,consuming:!1,getAttrs:e=>e.hasAttribute(`style`)?(this.options.mergeNestedSpanStyles&&LF(e),{}):!1}]},renderHTML({HTMLAttributes:e}){return[`span`,nE(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleTextStyle:e=>({commands:t})=>t.toggleMark(this.name,e),removeEmptyTextStyle:()=>({tr:e})=>{let{selection:t}=e;return e.doc.nodesBetween(t.from,t.to,(t,n)=>{if(!t.isInline)return!0;t.marks.filter(e=>e.type===this.type).some(e=>Object.values(e.attrs).some(e=>!!e))||e.removeMark(n,n+t.nodeSize,this.type)}),!0}}}}),zF=tO.create({name:`backgroundColor`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:e=>(ND(e,`background-color`)??e.style.backgroundColor)?.replace(/['"]+/g,``),renderHTML:e=>e.backgroundColor?{style:`background-color: ${e.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:e=>({chain:t})=>t().setMark(`textStyle`,{backgroundColor:e}).run(),unsetBackgroundColor:()=>({chain:e})=>e().setMark(`textStyle`,{backgroundColor:null}).removeEmptyTextStyle().run()}}}),BF=tO.create({name:`color`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:e=>(ND(e,`color`)??e.style.color)?.replace(/['"]+/g,``),renderHTML:e=>e.color?{style:`color: ${e.color}`}:{}}}}]},addCommands(){return{setColor:e=>({chain:t})=>t().setMark(`textStyle`,{color:e}).run(),unsetColor:()=>({chain:e})=>e().setMark(`textStyle`,{color:null}).removeEmptyTextStyle().run()}}}),VF=tO.create({name:`fontFamily`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:e=>ND(e,`font-family`)??e.style.fontFamily,renderHTML:e=>e.fontFamily?{style:`font-family: ${e.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:e=>({chain:t})=>t().setMark(`textStyle`,{fontFamily:e}).run(),unsetFontFamily:()=>({chain:e})=>e().setMark(`textStyle`,{fontFamily:null}).removeEmptyTextStyle().run()}}}),HF=tO.create({name:`fontSize`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:e=>ND(e,`font-size`)??e.style.fontSize,renderHTML:e=>e.fontSize?{style:`font-size: ${e.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:e=>({chain:t})=>t().setMark(`textStyle`,{fontSize:e}).run(),unsetFontSize:()=>({chain:e})=>e().setMark(`textStyle`,{fontSize:null}).removeEmptyTextStyle().run()}}}),UF=tO.create({name:`lineHeight`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:e=>ND(e,`line-height`)??e.style.lineHeight,renderHTML:e=>e.lineHeight?{style:`line-height: ${e.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:e=>({chain:t})=>t().setMark(`textStyle`,{lineHeight:e}).run(),unsetLineHeight:()=>({chain:e})=>e().setMark(`textStyle`,{lineHeight:null}).removeEmptyTextStyle().run()}}}),WF=tO.create({name:`textStyleKit`,addExtensions(){let e=[];return this.options.backgroundColor!==!1&&e.push(zF.configure(this.options.backgroundColor)),this.options.color!==!1&&e.push(BF.configure(this.options.color)),this.options.fontFamily!==!1&&e.push(VF.configure(this.options.fontFamily)),this.options.fontSize!==!1&&e.push(HF.configure(this.options.fontSize)),this.options.lineHeight!==!1&&e.push(UF.configure(this.options.lineHeight)),this.options.textStyle!==!1&&e.push(RF.configure(this.options.textStyle)),e}}),GF=qD.create({name:`superscript`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`sup`},{style:`vertical-align`,getAttrs(e){return e===`super`&&null}}]},renderHTML({HTMLAttributes:e}){return[`sup`,nE(this.options.HTMLAttributes,e),0]},addCommands(){return{setSuperscript:()=>({commands:e})=>e.setMark(this.name),toggleSuperscript:()=>({commands:e})=>e.toggleMark(this.name),unsetSuperscript:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),KF=qD.create({name:`subscript`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`sub`},{style:`vertical-align`,getAttrs(e){return e===`sub`&&null}}]},renderHTML({HTMLAttributes:e}){return[`sub`,nE(this.options.HTMLAttributes,e),0]},addCommands(){return{setSubscript:()=>({commands:e})=>e.setMark(this.name),toggleSubscript:()=>({commands:e})=>e.toggleMark(this.name),unsetSubscript:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),qF=tO.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:e=>{let t=e.style.textAlign;return this.options.alignments.includes(t)?t:this.options.defaultAlignment},renderHTML:e=>e.textAlign?{style:`text-align: ${e.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>this.options.alignments.includes(e)?this.options.types.map(n=>t.updateAttributes(n,{textAlign:e})).some(e=>e):!1,unsetTextAlign:()=>({commands:e})=>this.options.types.map(t=>e.resetAttributes(t,`textAlign`)).some(e=>e),toggleTextAlign:e=>({editor:t,commands:n})=>this.options.alignments.includes(e)?t.isActive({textAlign:e})?n.unsetTextAlign():n.setTextAlign(e):!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`)}}}),JF=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,YF=wO.create({name:`image`,addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?`inline`:`block`},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?`img[src]`:`img[src]:not([src^="data:"])`}]},renderHTML({HTMLAttributes:e}){return[`img`,nE(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode(`image`,{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{let t=e.attrs?.src??``,n=e.attrs?.alt??``,r=e.attrs?.title??``;return r?``:``},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>`u`)return null;let{directions:e,minWidth:t,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize,i=new Set([`src`,`width`,`height`]);return({node:a,getPos:o,HTMLAttributes:s,editor:c})=>{let l=document.createElement(`img`);l.draggable=!1;let u=nE(this.options.HTMLAttributes,s);Object.entries(u).forEach(([e,t])=>{if(t!=null)switch(e){case`src`:case`width`:case`height`:break;default:l.setAttribute(e,t)}}),u.src!==null&&(l.src=u.src);let d={...s},f=e=>{if(typeof e==`string`&&e!==``){l.getAttribute(`src`)!==e&&(l.src=e);return}l.hasAttribute(`src`)&&l.removeAttribute(`src`),l.src!==``&&(l.src=``)};f(s.src);let p=new CO({element:l,editor:c,node:a,getPos:o,onResize:(e,t)=>{l.style.width=`${e}px`,l.style.height=`${t}px`},onCommit:(e,t)=>{let n=o();n!==void 0&&this.editor.chain().setNodeSelection(n).updateAttributes(this.name,{width:e,height:t}).run()},onUpdate:e=>{if(e.type!==a.type)return!1;let t=rE(e,c.extensionManager.attributes.filter(t=>t.type===e.type.name));return Object.keys(d).forEach(e=>{!i.has(e)&&!(e in t)&&l.removeAttribute(e)}),Object.entries(t).forEach(([e,t])=>{i.has(e)||(t==null?l.removeAttribute(e):l.setAttribute(e,t))}),f(t.src),d=t,!0},options:{directions:e,min:{width:t,height:n},preserveAspectRatio:r===!0}}),m=p.dom,h=()=>{m.style.visibility=``,m.style.pointerEvents=``};return m.style.visibility=`hidden`,m.style.pointerEvents=`none`,l.complete&&l.naturalWidth>0?h():(l.onload=h,l.onerror=h),p}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[yO({find:JF,type:this.type,getAttributes:e=>{let[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}}),XF=EF,ZF=e=>String(e).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`),QF=e=>{let t=document.createElement(`div`);t.innerHTML=e;let n=Array.from(t.children);return n.length<2||!n.every(e=>e.tagName===`DIV`)||!n.every(e=>e.attributes.length===0)||!n.every(e=>Array.from(e.children).every(e=>{let t=e.tagName;return[`SPAN`,`B`,`I`,`EM`,`STRONG`,`U`,`SUB`,`SUP`,`A`,`CODE`,`BR`].includes(t)}))?e:`<p>${n.map(e=>e.innerHTML).join(`<br>`)}</p>`},$F=e=>{let t=String(e??``).trim();return t?/<[^>]+>/.test(t)?QF(t):`<div>${ZF(t)}</div>`:`<div></div>`},eI,tI;if(typeof WeakMap<`u`){let e=new WeakMap;eI=t=>e.get(t),tI=(t,n)=>(e.set(t,n),n)}else{let e=[],t=0;eI=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},tI=(n,r)=>(t==10&&(t=0),e[t++]=n,e[t++]=r)}var nI=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let r=t%this.width,i=t/this.width|0,a=r+1,o=i+1;for(let e=1;a<this.width&&this.map[t+e]==n;e++)a++;for(let e=1;o<this.height&&this.map[t+this.width*e]==n;e++)o++;return{left:r,top:i,right:a,bottom:o}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:r,right:i,top:a,bottom:o}=this.findCell(e);return t==`horiz`?(n<0?r==0:i==this.width)?null:this.map[a*this.width+(n<0?r-1:i)]:(n<0?a==0:o==this.height)?null:this.map[r+this.width*(n<0?a-1:o)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:a}=this.findCell(e),{left:o,right:s,top:c,bottom:l}=this.findCell(t);return{left:Math.min(n,o),top:Math.min(i,c),right:Math.max(r,s),bottom:Math.max(a,l)}}cellsInRect(e){let t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){let a=r*this.width+i,o=this.map[a];n[o]||(n[o]=!0,!(i==e.left&&i&&this.map[a-1]==o||r==e.top&&r&&this.map[a-this.width]==o)&&t.push(o))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){let a=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width,r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?a-1:this.map[n]}i=a}}static get(e){return eI(e)||tI(e,rI(e))}};function rI(e){if(e.type.spec.tableRole!=`table`)throw RangeError(`Not a table node: `+e.type.name);let t=iI(e),n=e.childCount,r=[],i=0,a=null,o=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let s=0,c=0;s<n;s++){let l=e.child(s);c++;for(let e=0;;e++){for(;i<r.length&&r[i]!=0;)i++;if(e==l.childCount)break;let u=l.child(e),{colspan:d,rowspan:f,colwidth:p}=u.attrs;for(let e=0;e<f;e++){if(e+s>=n){(a||=[]).push({type:`overlong_rowspan`,pos:c,n:f-e});break}let l=i+e*t;for(let e=0;e<d;e++){r[l+e]==0?r[l+e]=c:(a||=[]).push({type:`collision`,row:s,pos:c,n:d-e});let n=p&&p[e];if(n){let r=(l+e)%t*2,i=o[r];i==null||i!=n&&o[r+1]==1?(o[r]=n,o[r+1]=1):i==n&&o[r+1]++}}}i+=d,c+=u.nodeSize}let u=(s+1)*t,d=0;for(;i<u;)r[i++]==0&&d++;d&&(a||=[]).push({type:`missing`,row:s,n:d}),c++}(t===0||n===0)&&(a||=[]).push({type:`zero_sized`});let s=new nI(t,n,r,a),c=!1;for(let e=0;!c&&e<o.length;e+=2)o[e]!=null&&o[e+1]<n&&(c=!0);return c&&aI(s,o,e),s}function iI(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){let i=e.child(r),a=0;if(n)for(let t=0;t<r;t++){let n=e.child(t);for(let e=0;e<n.childCount;e++){let i=n.child(e);t+i.attrs.rowspan>r&&(a+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){let t=i.child(e);a+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}t==-1?t=a:t!=a&&(t=Math.max(t,a))}return t}function aI(e,t,n){e.problems||=[];let r={};for(let i=0;i<e.map.length;i++){let a=e.map[i];if(r[a])continue;r[a]=!0;let o=n.nodeAt(a);if(!o)throw RangeError(`No cell with offset ${a} found`);let s=null,c=o.attrs;for(let n=0;n<c.colspan;n++){let r=t[(i+n)%e.width*2];r!=null&&(!c.colwidth||c.colwidth[n]!=r)&&((s||=oI(c))[n]=r)}s&&e.problems.unshift({type:`colwidth mismatch`,pos:a,colwidth:s})}}function oI(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function sI(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let n in e.nodes){let r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}}return t}var cI=new ry(`selectingCells`);function lI(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole==`row`)return e.node(0).resolve(e.before(t+1));return null}function uI(e){for(let t=e.depth;t>0;t--){let n=e.node(t).type.spec.tableRole;if(n===`cell`||n===`header_cell`)return e.node(t)}return null}function dI(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if(t.node(e).type.spec.tableRole==`row`)return!0;return!1}function fI(e){let t=e.selection;if(`$anchorCell`in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if(`node`in t&&t.node&&t.node.type.spec.tableRole==`cell`)return t.$anchor;let n=lI(t.$head)||pI(t.$head);if(n)return n;throw RangeError(`No cell found around position ${t.head}`)}function pI(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n-t.nodeSize)}}function mI(e){return e.parent.type.spec.tableRole==`row`&&!!e.nodeAfter}function hI(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function gI(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function _I(e,t,n){let r=e.node(-1),i=nI.get(r),a=e.start(-1),o=i.nextCell(e.pos-a,t,n);return o==null?null:e.node(0).resolve(a+o)}function vI(e,t,n=1){let r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}function yI(e,t,n=1){let r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}function bI(e,t,n){let r=sI(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=r)return!1;return!0}var xI=class e extends Mv{constructor(e,t=e){let n=e.node(-1),r=nI.get(n),i=e.start(-1),a=r.rectBetween(e.pos-i,t.pos-i),o=e.node(0),s=r.cellsInRect(a).filter(e=>e!=t.pos-i);s.unshift(t.pos-i);let c=s.map(e=>{let t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let r=i+e+1;return new Nv(o.resolve(r),o.resolve(r+t.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(t,n){let r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(mI(r)&&mI(i)&&gI(r,i)){let t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return Iv.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=nI.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},a=[];for(let n=r.top;n<r.bottom;n++){let o=[];for(let a=n*t.width+r.left,s=r.left;s<r.right;s++,a++){let n=t.map[a];if(i[n])continue;i[n]=!0;let s=t.findCell(n),c=e.nodeAt(n);if(!c)throw RangeError(`No cell with offset ${n} found`);let l=r.left-s.left,u=s.right-r.right;if(l>0||u>0){let e=c.attrs;if(l>0&&(e=vI(e,0,l)),u>0&&(e=vI(e,e.colspan-u,u)),s.left<r.left){if(c=c.type.createAndFill(e),!c)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else c=c.type.create(e,c.content)}if(s.top<r.top||s.bottom>r.bottom){let e={...c.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};c=s.top<r.top?c.type.createAndFill(e):c.type.create(e,c.content)}o.push(c)}a.push(e.child(n).copy(H.from(o)))}let o=this.isColSelection()&&this.isRowSelection()?e:a;return new U(H.from(o),1,1)}replace(e,t=U.empty){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n);e.replace(s.map(a.pos),s.map(o.pos),i?U.empty:t)}let i=Mv.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new U(H.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=nI.get(t),r=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let r=t.node(-1),i=nI.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.top<=s.top?(o.top>0&&(t=c.resolve(a+i.map[o.left])),s.bottom<i.height&&(n=c.resolve(a+i.map[i.width*(i.height-1)+s.right-1]))):(s.top>0&&(n=c.resolve(a+i.map[s.left])),o.bottom<i.height&&(t=c.resolve(a+i.map[i.width*(i.height-1)+o.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=nI.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);if(Math.min(r,i)>0)return!1;let a=r+this.$anchorCell.nodeAfter.attrs.colspan,o=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,o)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let r=t.node(-1),i=nI.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.left<=s.left?(o.left>0&&(t=c.resolve(a+i.map[o.top*i.width])),s.right<i.width&&(n=c.resolve(a+i.map[i.width*(s.top+1)-1]))):(s.left>0&&(n=c.resolve(a+i.map[s.top*i.width])),o.right<i.width&&(t=c.resolve(a+i.map[i.width*(o.top+1)-1]))),new e(t,n)}toJSON(){return{type:`cell`,anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new SI(this.$anchorCell.pos,this.$headCell.pos)}};xI.prototype.visible=!1,Mv.jsonID(`cell`,xI);var SI=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){let t=e.resolve(this.anchor),n=e.resolve(this.head);return t.parent.type.spec.tableRole==`row`&&n.parent.type.spec.tableRole==`row`&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&gI(t,n)?new xI(t,n):Mv.near(n,1)}};function CI(e){if(!(e.selection instanceof xI))return null;let t=[];return e.selection.forEachCell((e,n)=>{t.push(DC.node(n,n+e.nodeSize,{class:`selectedCell`}))}),AC.create(e.doc,t)}function wI({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(i).type.spec.tableRole)}function TI({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){let r=e.node(t);if(r.type.spec.tableRole===`cell`||r.type.spec.tableRole===`header_cell`){n=r;break}}for(let e=t.depth;e>0;e--){let n=t.node(e);if(n.type.spec.tableRole===`cell`||n.type.spec.tableRole===`header_cell`){r=n;break}}return n!==r&&t.parentOffset===0}function EI(e,t,n){let r=(t||e).selection,i=(t||e).doc,a,o;if(r instanceof Rv&&(o=r.node.type.spec.tableRole)){if(o==`cell`||o==`header_cell`)a=xI.create(i,r.from);else if(o==`row`){let e=i.resolve(r.from+1);a=xI.rowSelection(e,e)}else if(!n){let e=nI.get(r.node),t=r.from+1,n=t+e.map[e.width*e.height-1];a=xI.create(i,t+1,n)}}else r instanceof Iv&&wI(r)?a=Iv.create(i,r.from):r instanceof Iv&&TI(r)&&(a=Iv.create(i,r.$from.start(),r.$from.end()));return a&&(t||=e.tr).setSelection(a),t}var DI=new ry(`fix-tables`);function OI(e,t,n,r){let i=e.childCount,a=t.childCount;outer:for(let o=0,s=0;o<a;o++){let a=t.child(o);for(let t=s,r=Math.min(i,o+3);t<r;t++)if(e.child(t)==a){s=t+1,n+=a.nodeSize;continue outer}r(a,n),s<i&&e.child(s).sameMarkup(a)?OI(e.child(s),a,n+1,r):a.nodesBetween(0,a.content.size,r,n+1),n+=a.nodeSize}}function kI(e,t){let n,r=(t,r)=>{t.type.spec.tableRole==`table`&&(n=vee(e,t,r,n))};return t?t.doc!=e.doc&&OI(t.doc,e.doc,0,r):e.doc.descendants(r),n}function vee(e,t,n,r){let i=nI.get(t);if(!i.problems)return r;r||=e.tr;let a=[];for(let e=0;e<i.height;e++)a.push(0);for(let e=0;e<i.problems.length;e++){let o=i.problems[e];if(o.type==`collision`){let e=t.nodeAt(o.pos);if(!e)continue;let i=e.attrs;for(let e=0;e<i.rowspan;e++)a[o.row+e]+=o.n;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,vI(i,i.colspan-o.n,o.n))}else if(o.type==`missing`)a[o.row]+=o.n;else if(o.type==`overlong_rowspan`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-o.n})}else if(o.type==`colwidth mismatch`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,colwidth:o.colwidth})}else if(o.type==`zero_sized`){let e=r.mapping.map(n);r.delete(e,e+t.nodeSize)}}let o,s;for(let e=0;e<a.length;e++)a[e]&&(o??=e,s=e);for(let c=0,l=n+1;c<i.height;c++){let n=t.child(c),i=l+n.nodeSize,u=a[c];if(u>0){let t=`cell`;n.firstChild&&(t=n.firstChild.type.spec.tableRole);let a=[];for(let n=0;n<u;n++){let n=sI(e.schema)[t].createAndFill();n&&a.push(n)}let d=(c==0||o==c-1)&&s==c?l+1:i-1;r.insert(r.mapping.map(d),a)}l=i}return r.setMeta(DI,{fixTables:!0})}function AI(e){let t=e.selection,n=fI(e),r=n.node(-1),i=n.start(-1),a=nI.get(r);return{...t instanceof xI?a.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):a.findCell(n.pos-i),tableStart:i,map:a,table:r}}function jI(e,{map:t,tableStart:n,table:r},i){let a=i>0?-1:0;bI(t,r,i+a)&&(a=i==0||i==t.width?null:0);for(let o=0;o<t.height;o++){let s=o*t.width+i;if(i>0&&i<t.width&&t.map[s-1]==t.map[s]){let a=t.map[s],c=r.nodeAt(a);e.setNodeMarkup(e.mapping.map(n+a),null,yI(c.attrs,i-t.colCount(a))),o+=c.attrs.rowspan-1}else{let c=a==null?sI(r.type.schema).cell:r.nodeAt(t.map[s+a]).type,l=t.positionAt(o,i,r);e.insert(e.mapping.map(n+l),c.createAndFill())}}return e}function yee(e,t){if(!dI(e))return!1;if(t){let n=AI(e);t(jI(e.tr,n,n.left))}return!0}function bee(e,t){if(!dI(e))return!1;if(t){let n=AI(e);t(jI(e.tr,n,n.right))}return!0}function xee(e,{map:t,table:n,tableStart:r},i){let a=e.mapping.maps.length;for(let o=0;o<t.height;){let s=o*t.width+i,c=t.map[s],l=n.nodeAt(c),u=l.attrs;if(i>0&&t.map[s-1]==c||i<t.width-1&&t.map[s+1]==c)e.setNodeMarkup(e.mapping.slice(a).map(r+c),null,vI(u,i-t.colCount(c)));else{let t=e.mapping.slice(a).map(r+c);e.delete(t,t+l.nodeSize)}o+=u.rowspan}}function See(e,t){if(!dI(e))return!1;if(t){let n=AI(e),r=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let e=n.right-1;xee(r,n,e),e!=n.left;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=nI.get(e)}t(r)}return!0}function Cee(e,t,n){let r=sI(t.type.schema).header_cell;for(let i=0;i<e.width;i++)if(t.nodeAt(e.map[i+n*e.width])?.type!=r)return!1;return!0}function MI(e,{map:t,tableStart:n,table:r},i){let a=n;for(let e=0;e<i;e++)a+=r.child(e).nodeSize;let o=[],s=i>0?-1:0;Cee(t,r,i+s)&&(s=i==0||i==t.height?null:0);for(let a=0,c=t.width*i;a<t.width;a++,c++)if(i>0&&i<t.height&&t.map[c]==t.map[c-t.width]){let i=t.map[c],o=r.nodeAt(i).attrs;e.setNodeMarkup(n+i,null,{...o,rowspan:o.rowspan+1}),a+=o.colspan-1}else{let e=(s==null?sI(r.type.schema).cell:r.nodeAt(t.map[c+s*t.width])?.type)?.createAndFill();e&&o.push(e)}return e.insert(a,sI(r.type.schema).row.create(null,o)),e}function wee(e,t){if(!dI(e))return!1;if(t){let n=AI(e);t(MI(e.tr,n,n.top))}return!0}function Tee(e,t){if(!dI(e))return!1;if(t){let n=AI(e);t(MI(e.tr,n,n.bottom))}return!0}function Eee(e,{map:t,table:n,tableStart:r},i){let a=0;for(let e=0;e<i;e++)a+=n.child(e).nodeSize;let o=a+n.child(i).nodeSize,s=e.mapping.maps.length;e.delete(a+r,o+r);let c=new Set;for(let a=0,o=i*t.width;a<t.width;a++,o++){let l=t.map[o];if(!c.has(l)){if(c.add(l),i>0&&l==t.map[o-t.width]){let t=n.nodeAt(l).attrs;e.setNodeMarkup(e.mapping.slice(s).map(l+r),null,{...t,rowspan:t.rowspan-1}),a+=t.colspan-1}else if(i<t.height&&l==t.map[o+t.width]){let o=n.nodeAt(l),c=o.attrs,u=o.type.create({...c,rowspan:o.attrs.rowspan-1},o.content),d=t.positionAt(i+1,a,n);e.insert(e.mapping.slice(s).map(r+d),u),a+=c.colspan-1}}}}function Dee(e,t){if(!dI(e))return!1;if(t){let n=AI(e),r=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;Eee(r,n,e),e!=n.top;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=nI.get(n.table)}t(r)}return!0}function NI(e){let t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function Oee({width:e,height:t,map:n},r){let i=r.top*e+r.left,a=i,o=(r.bottom-1)*e+r.left,s=i+(r.right-r.left-1);for(let t=r.top;t<r.bottom;t++){if(r.left>0&&n[a]==n[a-1]||r.right<e&&n[s]==n[s+1])return!0;a+=e,s+=e}for(let a=r.left;a<r.right;a++){if(r.top>0&&n[i]==n[i-e]||r.bottom<t&&n[o]==n[o+e])return!0;i++,o++}return!1}function PI(e,t){let n=e.selection;if(!(n instanceof xI)||n.$anchorCell.pos==n.$headCell.pos)return!1;let r=AI(e),{map:i}=r;if(Oee(i,r))return!1;if(t){let n=e.tr,a={},o=H.empty,s,c;for(let e=r.top;e<r.bottom;e++)for(let t=r.left;t<r.right;t++){let l=i.map[e*i.width+t],u=r.table.nodeAt(l);if(!(a[l]||!u))if(a[l]=!0,s==null)s=l,c=u;else{NI(u)||(o=o.append(u.content));let e=n.mapping.map(l+r.tableStart);n.delete(e,e+u.nodeSize)}}if(s==null||c==null)return!0;if(n.setNodeMarkup(s+r.tableStart,null,{...yI(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),o.size>0){let e=s+1+c.content.size,t=NI(c)?s+1:e;n.replaceWith(t+r.tableStart,e+r.tableStart,o)}n.setSelection(new xI(n.doc.resolve(s+r.tableStart))),t(n)}return!0}function FI(e,t){let n=sI(e.schema);return kee(({node:e})=>n[e.type.spec.tableRole])(e,t)}function kee(e){return(t,n)=>{let r=t.selection,i,a;if(r instanceof xI){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,a=r.$anchorCell.pos}else{if(i=uI(r.$from),!i)return!1;a=lI(r.$from)?.pos}if(i==null||a==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let o=i.attrs,s=[],c=o.colwidth;o.rowspan>1&&(o={...o,rowspan:1}),o.colspan>1&&(o={...o,colspan:1});let l=AI(t),u=t.tr;for(let e=0;e<l.right-l.left;e++)s.push(c?{...o,colwidth:c&&c[e]?[c[e]]:null}:o);let d;for(let t=l.top;t<l.bottom;t++){let n=l.map.positionAt(t,l.left,l.table);t==l.top&&(n+=i.nodeSize);for(let r=l.left,a=0;r<l.right;r++,a++)r==l.left&&t==l.top||u.insert(d=u.mapping.map(n+l.tableStart,1),e({node:i,row:t,col:r}).createAndFill(s[a]))}u.setNodeMarkup(a,e({node:i,row:l.top,col:l.left}),s[0]),r instanceof xI&&u.setSelection(new xI(u.doc.resolve(r.$anchorCell.pos),d?u.doc.resolve(d):void 0)),n(u)}return!0}}function Aee(e,t){return function(n,r){if(!dI(n))return!1;let i=fI(n);if(i.nodeAfter.attrs[e]===t)return!1;if(r){let a=n.tr;n.selection instanceof xI?n.selection.forEachCell((n,r)=>{n.attrs[e]!==t&&a.setNodeMarkup(r,null,{...n.attrs,[e]:t})}):a.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),r(a)}return!0}}function jee(e){return function(t,n){if(!dI(t))return!1;if(n){let r=sI(t.schema),i=AI(t),a=t.tr,o=i.map.cellsInRect(e==`column`?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e==`row`?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),s=o.map(e=>i.table.nodeAt(e));for(let e=0;e<o.length;e++)s[e].type==r.header_cell&&a.setNodeMarkup(i.tableStart+o[e],r.cell,s[e].attrs);if(a.steps.length===0)for(let e=0;e<o.length;e++)a.setNodeMarkup(i.tableStart+o[e],r.header_cell,s[e].attrs);n(a)}return!0}}function II(e,t,n){let r=t.map.cellsInRect({left:0,top:0,right:e==`row`?t.map.width:1,bottom:e==`column`?t.map.height:1});for(let e=0;e<r.length;e++){let i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function LI(e,t){return t||={useDeprecatedLogic:!1},t.useDeprecatedLogic?jee(e):function(t,n){if(!dI(t))return!1;if(n){let r=sI(t.schema),i=AI(t),a=t.tr,o=II(`row`,i,r),s=II(`column`,i,r),c=(e===`column`?o:e===`row`&&s)?1:0,l=e==`column`?{left:0,top:c,right:1,bottom:i.map.height}:e==`row`?{left:c,top:0,right:i.map.width,bottom:1}:i,u=e==`column`?s?r.cell:r.header_cell:e==`row`?o?r.cell:r.header_cell:r.cell;i.map.cellsInRect(l).forEach(e=>{let t=e+i.tableStart,n=a.doc.nodeAt(t);n&&a.setNodeMarkup(t,u,n.attrs)}),n(a)}return!0}}LI(`row`,{useDeprecatedLogic:!0}),LI(`column`,{useDeprecatedLogic:!0});var RI=LI(`cell`,{useDeprecatedLogic:!0});function zI(e,t){if(t<0){let t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){let r=e.node(-1).child(t),i=r.lastChild;if(i)return n-1-i.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){let e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}function BI(e){return function(t,n){if(!dI(t))return!1;let r=zI(fI(t),e);if(r==null)return!1;if(n){let e=t.doc.resolve(r);n(t.tr.setSelection(Iv.between(e,hI(e))).scrollIntoView())}return!0}}function VI(e,t){let n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole==`table`)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function HI(e,t){let n=e.selection;if(!(n instanceof xI))return!1;if(t){let r=e.tr,i=sI(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new U(i,0,0))}),r.docChanged&&t(r)}return!0}function UI(e){if(e.size===0)return null;let{content:t,openStart:n,openEnd:r}=e;for(;t.childCount==1&&(n>0&&r>0||t.child(0).type.spec.tableRole==`table`);)n--,r--,t=t.child(0).content;let i=t.child(0),a=i.type.spec.tableRole,o=i.type.schema,s=[];if(a==`row`)for(let e=0;e<t.childCount;e++){let i=t.child(e).content,a=e?0:Math.max(0,n-1),c=e<t.childCount-1?0:Math.max(0,r-1);(a||c)&&(i=GI(sI(o).row,new U(i,a,c)).content),s.push(i)}else if(a==`cell`||a==`header_cell`)s.push(n||r?GI(sI(o).row,new U(t,n,r)).content:t);else return null;return WI(o,s)}function WI(e,t){let n=[];for(let e=0;e<t.length;e++){let r=t[e];for(let t=r.childCount-1;t>=0;t--){let{rowspan:i,colspan:a}=r.child(t).attrs;for(let t=e;t<e+i;t++)n[t]=(n[t]||0)+a}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(H.empty),n[i]<r){let a=sI(e).cell.createAndFill(),o=[];for(let e=n[i];e<r;e++)o.push(a);t[i]=t[i].append(H.from(o))}return{height:t.length,width:r,rows:t}}function GI(e,t){let n=e.createAndFill();return new Av(n).replace(0,n.content.size,t).doc}function KI({width:e,height:t,rows:n},r,i){if(e!=r){let t=[],i=[];for(let e=0;e<n.length;e++){let a=n[e],o=[];for(let n=t[e]||0,i=0;n<r;i++){let s=a.child(i%a.childCount);n+s.attrs.colspan>r&&(s=s.type.createChecked(vI(s.attrs,s.attrs.colspan,n+s.attrs.colspan-r),s.content)),o.push(s),n+=s.attrs.colspan;for(let n=1;n<s.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+s.attrs.colspan}i.push(H.from(o))}n=i,e=r}if(t!=i){let e=[];for(let r=0,a=0;r<i;r++,a++){let o=[],s=n[a%t];for(let e=0;e<s.childCount;e++){let t=s.child(e);r+t.attrs.rowspan>i&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,i-t.attrs.rowspan)},t.content)),o.push(t)}e.push(H.from(o))}n=e,t=i}return{width:e,height:t,rows:n}}function qI(e,t,n,r,i,a,o){let s=e.doc.type.schema,c=sI(s),l,u;if(i>t.width)for(let a=0,s=0;a<t.height;a++){let d=n.child(a);s+=d.nodeSize;let f=[],p;p=d.lastChild==null||d.lastChild.type==c.cell?l||=c.cell.createAndFill():u||=c.header_cell.createAndFill();for(let e=t.width;e<i;e++)f.push(p);e.insert(e.mapping.slice(o).map(s-1+r),f)}if(a>t.height){let s=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,i);e++){let i=e>=t.width?!1:n.nodeAt(t.map[r+e]).type==c.header_cell;s.push(i?u||=c.header_cell.createAndFill():l||=c.cell.createAndFill())}let d=c.row.create(null,H.from(s)),f=[];for(let e=t.height;e<a;e++)f.push(d);e.insert(e.mapping.slice(o).map(r+n.nodeSize-2),f)}return!!(l||u)}function JI(e,t,n,r,i,a,o,s){if(o==0||o==t.height)return!1;let c=!1;for(let l=i;l<a;l++){let i=o*t.width+l,a=t.map[i];if(t.map[i-t.width]==a){c=!0;let i=n.nodeAt(a),{top:u,left:d}=t.findCell(a);e.setNodeMarkup(e.mapping.slice(s).map(a+r),null,{...i.attrs,rowspan:o-u}),e.insert(e.mapping.slice(s).map(t.positionAt(o,d,n)),i.type.createAndFill({...i.attrs,rowspan:u+i.attrs.rowspan-o})),l+=i.attrs.colspan-1}}return c}function YI(e,t,n,r,i,a,o,s){if(o==0||o==t.width)return!1;let c=!1;for(let l=i;l<a;l++){let i=l*t.width+o,a=t.map[i];if(t.map[i-1]==a){c=!0;let i=n.nodeAt(a),u=t.colCount(a),d=e.mapping.slice(s).map(a+r);e.setNodeMarkup(d,null,vI(i.attrs,o-u,i.attrs.colspan-(o-u))),e.insert(d+i.nodeSize,i.type.createAndFill(vI(i.attrs,0,o-u))),l+=i.attrs.rowspan-1}}return c}function XI(e,t,n,r,i){let a=n?e.doc.nodeAt(n-1):e.doc;if(!a)throw Error(`No table found`);let o=nI.get(a),{top:s,left:c}=r,l=c+i.width,u=s+i.height,d=e.tr,f=0;function p(){if(a=n?d.doc.nodeAt(n-1):d.doc,!a)throw Error(`No table found`);o=nI.get(a),f=d.mapping.maps.length}qI(d,o,a,n,l,u,f)&&p(),JI(d,o,a,n,c,l,s,f)&&p(),JI(d,o,a,n,c,l,u,f)&&p(),YI(d,o,a,n,s,u,c,f)&&p(),YI(d,o,a,n,s,u,l,f)&&p();for(let e=s;e<u;e++){let t=o.positionAt(e,c,a),r=o.positionAt(e,l,a);d.replace(d.mapping.slice(f).map(t+n),d.mapping.slice(f).map(r+n),new U(i.rows[e-s],0,0))}p(),d.setSelection(new xI(d.doc.resolve(n+o.positionAt(s,c,a)),d.doc.resolve(n+o.positionAt(u-1,l-1,a)))),t(d)}var ZI=ww({ArrowLeft:$I(`horiz`,-1),ArrowRight:$I(`horiz`,1),ArrowUp:$I(`vert`,-1),ArrowDown:$I(`vert`,1),"Shift-ArrowLeft":eL(`horiz`,-1),"Shift-ArrowRight":eL(`horiz`,1),"Shift-ArrowUp":eL(`vert`,-1),"Shift-ArrowDown":eL(`vert`,1),Backspace:HI,"Mod-Backspace":HI,Delete:HI,"Mod-Delete":HI});function QI(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function $I(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection;if(a instanceof xI)return QI(n,r,Mv.near(a.$headCell,t));if(e!=`horiz`&&!a.empty)return!1;let o=iL(i,e,t);if(o==null)return!1;if(e==`horiz`)return QI(n,r,Mv.near(n.doc.resolve(a.head+t),t));{let i=n.doc.resolve(o),a=_I(i,e,t),s;return s=a?Mv.near(a,1):t<0?Mv.near(n.doc.resolve(i.before(-1)),-1):Mv.near(n.doc.resolve(i.after(-1)),1),QI(n,r,s)}}}function eL(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection,o;if(a instanceof xI)o=a;else{let r=iL(i,e,t);if(r==null)return!1;o=new xI(n.doc.resolve(r))}let s=_I(o.$headCell,e,t);return s?QI(n,r,new xI(o.$anchorCell,s)):!1}}function tL(e,t){let n=e.state.doc,r=lI(n.resolve(t));return r?(e.dispatch(e.state.tr.setSelection(new xI(r))),!0):!1}function nL(e,t,n){if(!dI(e.state))return!1;let r=UI(n),i=e.state.selection;if(i instanceof xI){r||={width:1,height:1,rows:[H.from(GI(sI(e.state.schema).cell,n))]};let t=i.$anchorCell.node(-1),a=i.$anchorCell.start(-1),o=nI.get(t).rectBetween(i.$anchorCell.pos-a,i.$headCell.pos-a);return r=KI(r,o.right-o.left,o.bottom-o.top),XI(e.state,e.dispatch,a,o,r),!0}else if(r){let t=fI(e.state),n=t.start(-1);return XI(e.state,e.dispatch,n,nI.get(t.node(-1)).findCell(t.pos-n),r),!0}else return!1}function rL(e,t){if(t.button!=0||t.ctrlKey||t.metaKey)return;let n=aL(e,t.target),r;if(t.shiftKey&&e.state.selection instanceof xI)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&n&&(r=lI(e.state.selection.$anchor))!=null&&oL(e,t)?.pos!=r.pos)i(r,t),t.preventDefault();else if(!n)return;function i(t,n){let r=oL(e,n),i=cI.getState(e.state)==null;if(!r||!gI(t,r))if(i)r=t;else return;let a=new xI(t,r);if(i||!e.state.selection.eq(a)){let n=e.state.tr.setSelection(a);i&&n.setMeta(cI,t.pos),e.dispatch(n)}}function a(){e.root.removeEventListener(`mouseup`,a),e.root.removeEventListener(`dragstart`,a),e.root.removeEventListener(`mousemove`,o),cI.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(cI,-1))}function o(r){let o=r,s=cI.getState(e.state),c;if(s!=null)c=e.state.doc.resolve(s);else if(aL(e,o.target)!=n&&(c=oL(e,t),!c))return a();c&&i(c,o)}e.root.addEventListener(`mouseup`,a),e.root.addEventListener(`dragstart`,a),e.root.addEventListener(`mousemove`,o)}function iL(e,t,n){if(!(e.state.selection instanceof Iv))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let a=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:a.childCount))return null;if(a.type.spec.tableRole==`cell`||a.type.spec.tableRole==`header_cell`){let a=r.before(i),o=t==`vert`?n>0?`down`:`up`:n>0?`right`:`left`;return e.endOfTextblock(o)?a:null}}return null}function aL(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName==`TD`||t.nodeName==`TH`)return t;return null}function oL(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&lI(e.state.doc.resolve(r))||lI(e.state.doc.resolve(i))}var sL=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`)),this.table.style.setProperty(`--default-cell-min-width`,`${t}px`),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),cL(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type==this.node.type?(this.node=e,cL(e,this.colgroup,this.table,this.defaultCellMinWidth),!0):!1}ignoreMutation(e){return e.type==`attributes`&&(e.target==this.table||this.colgroup.contains(e.target))}};function cL(e,t,n,r,i,a){let o=0,s=!0,c=t.firstChild,l=e.firstChild;if(l){for(let e=0,n=0;e<l.childCount;e++){let{colspan:u,colwidth:d}=l.child(e).attrs;for(let e=0;e<u;e++,n++){let l=i==n?a:d&&d[e],u=l?l+`px`:``;if(o+=l||r,l||(s=!1),c)c.style.width!=u&&(c.style.width=u),c=c.nextSibling;else{let e=document.createElement(`col`);e.style.width=u,t.appendChild(e)}}}for(;c;){var u;let e=c.nextSibling;(u=c.parentNode)==null||u.removeChild(c),c=e}s?(n.style.width=o+`px`,n.style.minWidth=``):(n.style.width=``,n.style.minWidth=o+`px`)}}var lL=new ry(`tableColumnResizing`);function uL({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=sL,lastColumnResizable:i=!0}={}){let a=new ey({key:lL,state:{init(e,t){var i;let o=(i=a.spec)==null||(i=i.props)==null?void 0:i.nodeViews,s=sI(t.schema).table.name;return r&&o&&(o[s]=(e,t)=>new r(e,n,t)),new dL(-1,!1)},apply(e,t){return t.apply(e)}},props:{attributes:e=>{let t=lL.getState(e);return t&&t.activeHandle>-1?{class:`resize-cursor`}:{}},handleDOMEvents:{mousemove:(t,n)=>{fL(t,n,e,i)},mouseleave:e=>{pL(e)},mousedown:(e,r)=>{mL(e,r,t,n)}},decorations:e=>{let t=lL.getState(e);if(t&&t.activeHandle>-1)return CL(e,t.activeHandle)},nodeViews:{}}});return a}var dL=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){let n=this,r=t.getMeta(lL);if(r&&r.setHandle!=null)return new e(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new e(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&t.docChanged){let r=t.mapping.map(n.activeHandle,-1);return mI(t.doc.resolve(r))||(r=-1),new e(r,n.dragging)}return n}};function fL(e,t,n,r){if(!e.editable)return;let i=lL.getState(e.state);if(i&&!i.dragging){let a=gL(t.target),o=-1;if(a){let{left:r,right:i}=a.getBoundingClientRect();t.clientX-r<=n?o=_L(e,t,`left`,n):i-t.clientX<=n&&(o=_L(e,t,`right`,n))}if(o!=i.activeHandle){if(!r&&o!==-1){let t=e.state.doc.resolve(o),n=t.node(-1),r=nI.get(n),i=t.start(-1);if(r.colCount(t.pos-i)+t.nodeAfter.attrs.colspan-1==r.width-1)return}yL(e,o)}}}function pL(e){if(!e.editable)return;let t=lL.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&yL(e,-1)}function mL(e,t,n,r){if(!e.editable)return!1;let i=e.dom.ownerDocument.defaultView??window,a=lL.getState(e.state);if(!a||a.activeHandle==-1||a.dragging)return!1;let o=e.state.doc.nodeAt(a.activeHandle),s=hL(e,a.activeHandle,o.attrs);e.dispatch(e.state.tr.setMeta(lL,{setDragging:{startX:t.clientX,startWidth:s}}));function c(t){i.removeEventListener(`mouseup`,c),i.removeEventListener(`mousemove`,l);let r=lL.getState(e.state);r?.dragging&&(bL(e,r.activeHandle,vL(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(lL,{setDragging:null})))}function l(t){if(!t.which)return c(t);let i=lL.getState(e.state);if(i&&i.dragging){let a=vL(i.dragging,t,n);xL(e,i.activeHandle,a,r)}}return xL(e,a.activeHandle,s,r),i.addEventListener(`mouseup`,c),i.addEventListener(`mousemove`,l),t.preventDefault(),!0}function hL(e,t,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let a=e.domAtPos(t),o=a.node.childNodes[a.offset].offsetWidth,s=n;if(r)for(let e=0;e<n;e++)r[e]&&(o-=r[e],s--);return o/s}function gL(e){for(;e&&e.nodeName!=`TD`&&e.nodeName!=`TH`;)e=e.classList&&e.classList.contains(`ProseMirror`)?null:e.parentNode;return e}function _L(e,t,n,r){let i=n==`right`?-r:r,a=e.posAtCoords({left:t.clientX+i,top:t.clientY});if(!a)return-1;let{pos:o}=a,s=lI(e.state.doc.resolve(o));if(!s)return-1;if(n==`right`)return s.pos;let c=nI.get(s.node(-1)),l=s.start(-1),u=c.map.indexOf(s.pos-l);return u%c.width==0?-1:l+c.map[u-1]}function vL(e,t,n){let r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function yL(e,t){e.dispatch(e.state.tr.setMeta(lL,{setHandle:t}))}function bL(e,t,n){let r=e.state.doc.resolve(t),i=r.node(-1),a=nI.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,c=e.state.tr;for(let e=0;e<a.height;e++){let t=e*a.width+s;if(e&&a.map[t]==a.map[t-a.width])continue;let r=a.map[t],l=i.nodeAt(r).attrs,u=l.colspan==1?0:s-a.colCount(r);if(l.colwidth&&l.colwidth[u]==n)continue;let d=l.colwidth?l.colwidth.slice():SL(l.colspan);d[u]=n,c.setNodeMarkup(o+r,null,{...l,colwidth:d})}c.docChanged&&e.dispatch(c)}function xL(e,t,n,r){let i=e.state.doc.resolve(t),a=i.node(-1),o=i.start(-1),s=nI.get(a).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1,c=e.domAtPos(i.start(-1)).node;for(;c&&c.nodeName!=`TABLE`;)c=c.parentNode;c&&cL(a,c.firstChild,c,r,s,n)}function SL(e){return Array(e).fill(0)}function CL(e,t){let n=[],r=e.doc.resolve(t),i=r.node(-1);if(!i)return AC.empty;let a=nI.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let t=0;t<a.height;t++){let r=s+t*a.width;if((s==a.width-1||a.map[r]!=a.map[r+1])&&(t==0||a.map[r]!=a.map[r-a.width])){let t=a.map[r],s=o+t+i.nodeAt(t).nodeSize-1,c=document.createElement(`div`);c.className=`column-resize-handle`,lL.getState(e)?.dragging&&n.push(DC.node(o+t,o+t+i.nodeAt(t).nodeSize,{class:`column-resize-dragging`})),n.push(DC.widget(s,c))}}return AC.create(e.doc,n)}function wL({allowTableNodeSelection:e=!1}={}){return new ey({key:cI,state:{init(){return null},apply(e,t){let n=e.getMeta(cI);if(n!=null)return n==-1?null:n;if(t==null||!e.docChanged)return t;let{deleted:r,pos:i}=e.mapping.mapResult(t);return r?null:i}},props:{decorations:CI,handleDOMEvents:{mousedown:rL},createSelectionBetween(e){return cI.getState(e.state)==null?null:e.state.selection},handleTripleClick:tL,handleKeyDown:ZI,handlePaste:nL},appendTransaction(t,n,r){return EI(r,kI(r,n),e)}})}function TL(e){return e===`left`||e===`right`||e===`center`?e:null}function EL(e){let t=(e.style.textAlign||``).trim().toLowerCase(),n=(e.getAttribute(`align`)||``).trim().toLowerCase();return TL(t||n)}function DL(e){return TL(e?.align)}function OL(){return{default:null,parseHTML:e=>EL(e),renderHTML:e=>e.align?{style:`text-align: ${e.align}`}:{}}}function kL(e){let t=e.parentElement,n=e.closest(`table`);if(!t||!n)return null;let r=Array.from(t.children).indexOf(e),i=n.querySelectorAll(`colgroup > col`)[r]?.getAttribute(`width`);return i?[parseInt(i,10)]:null}function AL(e){let t=e.getAttribute(`colwidth`);return t?t.split(`,`).map(e=>parseInt(e,10)):kL(e)}var jL=/[ \t\r\n\f]+/g;function ML(e){return e.children.length>0?!1:(e.textContent??``).replace(jL,``)===``}function NL(e){let t=e.createAndFill();if(!t)throw Error(`[tiptap error]: "${e.name}" has no default content to backfill.`);return t.content}var PL=wO.create({name:`tableCell`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:AL},align:OL()}},tableRole:`cell`,isolating:!0,parseHTML(){return[{tag:`td`,getAttrs:e=>ML(e)?{}:!1,getContent:(e,t)=>NL(t.nodes[this.name])},{tag:`td`}]},renderHTML({HTMLAttributes:e}){return[`td`,nE(this.options.HTMLAttributes,e),0]}}),FL=wO.create({name:`tableHeader`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:AL},align:OL()}},tableRole:`header_cell`,isolating:!0,parseHTML(){return[{tag:`th`,getAttrs:e=>ML(e)?{}:!1,getContent:(e,t)=>NL(t.nodes[this.name])},{tag:`th`}]},renderHTML({HTMLAttributes:e}){return[`th`,nE(this.options.HTMLAttributes,e),0]}}),IL=wO.create({name:`tableRow`,addOptions(){return{HTMLAttributes:{}}},content:`(tableCell | tableHeader)*`,tableRole:`row`,parseHTML(){return[{tag:`tr`}]},renderHTML({HTMLAttributes:e}){return[`tr`,nE(this.options.HTMLAttributes,e),0]}});function LL(e,t){return t?[`width`,`${Math.max(t,e)}px`]:[`min-width`,`${e}px`]}function RL(e,t,n,r,i,a){let o=0,s=!0,c=t.firstChild,l=e.firstChild;if(l!==null)for(let e=0,n=0;e<l.childCount;e+=1){let{colspan:u,colwidth:d}=l.child(e).attrs;for(let e=0;e<u;e+=1,n+=1){let l=i===n?a:d&&d[e],u=l?`${l}px`:``;if(o+=l||r,l||(s=!1),c){if(c.style.width!==u){let[e,t]=LL(r,l);c.style.setProperty(e,t)}c=c.nextSibling}else{let e=document.createElement(`col`),[n,i]=LL(r,l);e.style.setProperty(n,i),t.appendChild(e)}}}for(;c;){var u;let e=c.nextSibling;(u=c.parentNode)==null||u.removeChild(c),c=e}let d=e.attrs.style&&typeof e.attrs.style==`string`&&/\bwidth\s*:/i.test(e.attrs.style);s&&!d?(n.style.width=`${o}px`,n.style.minWidth=``):(n.style.width=``,n.style.minWidth=`${o}px`)}var zL=class{constructor(e,t,n,r={}){this.node=e,this.cellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`));for(let[e,t]of Object.entries(r))t!=null&&(e===`style`?this.table.style.cssText=String(t):this.table.setAttribute(e,String(t)));e.attrs.style&&(this.table.style.cssText=e.attrs.style),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),RL(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type===this.node.type?(this.node=e,RL(e,this.colgroup,this.table,this.cellMinWidth),!0):!1}ignoreMutation(e){let t=e.target,n=this.dom.contains(t),r=this.contentDOM.contains(t);return!!(n&&!r&&(e.type===`attributes`||e.type===`childList`||e.type===`characterData`))}};function BL(e,t,n,r){let i=0,a=!0,o=[],s=e.firstChild;if(!s)return{};for(let e=0,c=0;e<s.childCount;e+=1){let{colspan:l,colwidth:u}=s.child(e).attrs;for(let e=0;e<l;e+=1,c+=1){let s=n===c?r:u&&u[e];i+=s||t,s||(a=!1);let[l,d]=LL(t,s);o.push([`col`,{style:`${l}: ${d}`}])}}let c=a?`${i}px`:``,l=a?``:`${i}px`;return{colgroup:[`colgroup`,{},...o],tableWidth:c,tableMinWidth:l}}function VL(e,t){return t?e.createChecked(null,t):e.createAndFill()}function HL(e){if(e.cached.tableNodeTypes)return e.cached.tableNodeTypes;let t={};return Object.keys(e.nodes).forEach(n=>{let r=e.nodes[n];r.spec.tableRole&&(t[r.spec.tableRole]=r)}),e.cached.tableNodeTypes=t,t}function UL(e,t,n,r,i){let a=HL(e),o=[],s=[];for(let e=0;e<n;e+=1){let e=VL(a.cell,i);if(e&&s.push(e),r){let e=VL(a.header_cell,i);e&&o.push(e)}}let c=[];for(let e=0;e<t;e+=1)c.push(a.row.createChecked(null,r&&e===0?o:s));return a.table.createChecked(null,c)}function WL(e){return e instanceof xI}var GL=({editor:e})=>{let{selection:t}=e.state;if(!WL(t))return!1;let n=0;return GT(t.ranges[0].$from,e=>e.type.name===`table`)?.node.descendants(e=>{if(e.type.name===`table`)return!1;[`tableCell`,`tableHeader`].includes(e.type.name)&&(n+=1)}),n===t.ranges.length?(e.commands.deleteTable(),!0):!1};function KL(e,t){let n=e.mapping.map(t);if(GT(e.selection.$from,e=>e.type.name===`table`)?.pos===n)return;let r=e.doc.nodeAt(n);if(!r)return;let i=n+r.nodeSize-1;e.setSelection(Iv.near(e.doc.resolve(i),-1))}function qL(e){let t=``,n=0;for(;n<e.length;){if(e[n]===`\\`&&n+1<e.length){t+=e[n]+e[n+1],n+=2;continue}if(e[n]!=="`"){t+=e[n++];continue}let r=0;for(;n+r<e.length&&e[n+r]==="`";)r+=1;let i=n+r,a=!1;for(;i<e.length;){if(e[i]!=="`"){i+=1;continue}let o=0;for(;i+o<e.length&&e[i+o]==="`";)o+=1;if(o===r){let o=e.slice(n+r,i);t+=e.slice(n,n+r)+o.replace(/\\\||\|/g,e=>e===`|`?`\\|`:e)+e.slice(i,i+r),n=i+r,a=!0;break}i+=o}a||(t+=e.slice(n,n+r),n+=r)}return t}function JL(e){return e.split(`
|
|
277
|
-
`).map(e=>!e.includes(`|`)||!e.includes("`")?e:
|
|
278
|
-
`)}function
|
|
279
|
-
`).replace(/[ \t]*\r?\n[ \t]*/g,`<br>`)),o=e.type===`tableHeader`,s=
|
|
280
|
-
`,f=Array.from({length:a}).map((e,t)=>l&&c[t]&&c[t].text||``);return d+=`| ${f.map((e,t)=>s(e,o[t])).join(` | `)} |\n`,d+=`| ${o.map((e,t)=>{let n=Math.max(3,e),r=u[t];return r===`left`?`:${`-`.repeat(n)}`:r===`right`?`${`-`.repeat(n)}:`:r===`center`?`:${`-`.repeat(n)}:`:`-`.repeat(n)}).join(` | `)} |\n`,(l?i.slice(1):i).forEach(e=>{d+=`| ${Array.from({length:a}).fill(0).map((t,n)=>s(e[n]&&e[n].text||``,o[n])).join(` | `)} |\n`}),d}var
|
|
276
|
+
`):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=ID(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(t){let r={type:`taskList`,raw:t.raw,items:t.items},i=e.slice(t.raw.length);return i.trim()?[r,...n.blockTokens(i)]:[r]}return n.blockTokens(e)},i=ID(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});tO.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(mN.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(LN.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(KN.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(lP.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(pP.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(mP.configure(this.options.taskList)),e}});var hP=` `,gP=`\xA0`,_P=wO.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,nE(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===hP||n[0].text===hP||n[0].raw===gP||n[0].text===gP)&&r.length===1&&r[0].type===`text`&&(r[0].text===hP||r[0].text===gP)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){var i,a;let e=Array.isArray(n==null||(i=n.previousNode)==null?void 0:i.content)?n.previousNode.content:[];return(n==null||(a=n.previousNode)==null?void 0:a.type)===`paragraph`&&e.length===0?hP:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),vP=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,yP=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,bP=qD.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,nE(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[vO({find:vP,type:this.type})]},addPasteRules(){return[EO({find:yP,type:this.type})]}}),xP=wO.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),SP=qD.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,nE(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:`underline`,raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function CP(e={}){return new ey({view(t){return new wP(t,e)}})}var wP=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}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,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.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,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`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}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(t&&!i){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=dv(this.editorView.state.doc,e,this.editorView.dragging.slice);t!=null&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},TP=class e extends Mv{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):Mv.near(r)}content(){return U.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new EP(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!OP(e)||!kP(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)<o.childCount:t.index(r)>0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}else if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!Rv.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}};TP.prototype.visible=!1,TP.findFrom=TP.findGapCursorFrom,Mv.jsonID(`gapcursor`,TP);var EP=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return TP.valid(t)?new TP(t):Mv.near(t)}};function DP(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function OP(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||DP(e.type))return!0;if(e.inlineContent)return!1}}return!0}function kP(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||DP(e.type))return!0;if(e.inlineContent)return!1}}return!0}function AP(){return new ey({props:{decorations:FP,createSelectionBetween(e,t,n){return t.pos==n.pos&&TP.valid(n)?new TP(n):null},handleClick:NP,handleKeyDown:jP,handleDOMEvents:{beforeinput:PP}}})}var jP=ww({ArrowLeft:MP(`horiz`,-1),ArrowRight:MP(`horiz`,1),ArrowUp:MP(`vert`,-1),ArrowDown:MP(`vert`,1)});function MP(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof Iv){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=TP.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new TP(c))),!0):!1}}function NP(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!TP.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&Rv.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new TP(r))),!0)}function PP(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof TP))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=H.empty;for(let e=r.length-1;e>=0;e--)i=H.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new U(i,0,0));return a.setSelection(Iv.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function FP(e){if(!(e.selection instanceof TP))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,AC.create(e.doc,[DC.widget(e.selection.head,t,{key:`gapcursor`})])}var IP=200,LP=function(){};LP.prototype.append=function(e){return e.length?(e=LP.from(e),!this.length&&e||e.length<IP&&this.leafAppend(e)||this.length<IP&&e.leafPrepend(this)||this.appendInner(e)):this},LP.prototype.prepend=function(e){return e.length?LP.from(e).append(this):this},LP.prototype.appendInner=function(e){return new zP(this,e)},LP.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?LP.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},LP.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},LP.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},LP.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},LP.from=function(e){return e instanceof LP?e:e&&e.length?new RP(e):LP.empty};var RP=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return e==0&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(e(this.values[i],r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(e(this.values[i],r+i)===!1)return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=IP)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=IP)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(LP);LP.empty=new RP([]);var zP=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&this.left.forEachInner(e,t,Math.min(n,i),r)===!1||n>i&&this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)===!1||n<i&&this.left.forEachInvertedInner(e,Math.min(t,i),n,r)===!1)return!1},t.prototype.sliceInner=function(e,t){if(e==0&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(LP),BP=500,VP=class e{constructor(e,t){this.items=e,this.eventCount=t}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=t.tr,s,c,l=[],u=[];return this.items.forEach((t,n)=>{if(!t.step){i||(i=this.remapping(r,n+1),a=i.maps.length),a--,u.push(t);return}if(i){u.push(new UP(t.map));let e=t.step.map(i.slice(a)),n;e&&o.maybeStep(e).doc&&(n=o.mapping.maps[o.mapping.maps.length-1],l.push(new UP(n,void 0,void 0,l.length+u.length))),a--,n&&i.appendMap(n,a)}else o.maybeStep(t.step);if(t.selection)return s=i?t.selection.map(i.slice(a)):t.selection,c=new e(this.items.slice(0,r).append(u.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:s}}addTransform(t,n,r,i){let a=[],o=this.eventCount,s=this.items,c=!i&&s.length?s.get(s.length-1):null;for(let e=0;e<t.steps.length;e++){let r=t.steps[e].invert(t.docs[e]),l=new UP(t.mapping.maps[e],r,n),u;(u=c&&c.merge(l))&&(l=u,e?a.pop():s=s.slice(0,s.length-1)),a.push(l),n&&=(o++,void 0),i||(c=l)}let l=o-r.depth;return l>GP&&(s=HP(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new k_;return this.items.forEach((t,r)=>{let i=t.mirrorOffset!=null&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(e=>new UP(e))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),a=t.mapping,o=t.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},i);let c=n;this.items.forEach(e=>{let n=a.getMirror(--c);if(n==null)return;o=Math.min(o,n);let i=a.maps[n];if(e.step){let o=t.steps[n].invert(t.docs[n]),l=e.selection&&e.selection.map(a.slice(c+1,n));l&&s++,r.push(new UP(i,o,l))}else r.push(new UP(i))},i);let l=[];for(let e=n;e<o;e++)l.push(new UP(a.maps[e]));let u=this.items.slice(0,i).append(l).append(r),d=new e(u,s);return d.emptyItemCount()>BP&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],a=0;return this.items.forEach((e,o)=>{if(o>=t)i.push(e),e.selection&&a++;else if(e.step){let t=e.step.map(n.slice(r)),o=t&&t.getMap();if(r--,o&&n.appendMap(o,r),t){let s=e.selection&&e.selection.map(n.slice(r));s&&a++;let c=new UP(o.invert(),t,s),l,u=i.length-1;(l=i.length&&i[u].merge(c))?i[u]=l:i.push(c)}}else e.map&&r--},this.items.length,0),new e(LP.from(i.reverse()),a)}};VP.empty=new VP(LP.empty,0);function HP(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}var UP=class e{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}},WP=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}},GP=20;function KP(e,t,n,r){let i=n.getMeta(eF),a;if(i)return i.historyState;n.getMeta(tF)&&(e=new WP(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(eF))return o.getMeta(eF).redo?new WP(e.done.addTransform(n,void 0,r,$P(t)),e.undone,JP(n.mapping.maps),e.prevTime,e.prevComposition):new WP(e.done,e.undone.addTransform(n,void 0,r,$P(t)),null,e.prevTime,e.prevComposition);if(n.getMeta(`addToHistory`)!==!1&&!(o&&o.getMeta(`addToHistory`)===!1)){let i=n.getMeta(`composition`),a=e.prevTime==0||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!qP(n,e.prevRanges)),s=o?YP(e.prevRanges,n.mapping):JP(n.mapping.maps);return new WP(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,$P(t)),VP.empty,s,n.time,i??e.prevComposition)}else if(a=n.getMeta(`rebased`))return new WP(e.done.rebased(n,a),e.undone.rebased(n,a),YP(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new WP(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),YP(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function qP(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}function JP(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function YP(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),a=t.map(e[r+1],-1);i<=a&&n.push(i,a)}return n}function XP(e,t,n){let r=$P(t),i=eF.get(t).spec.config,a=(n?e.undone:e.done).popEvent(t,r);if(!a)return null;let o=a.selection.resolve(a.transform.doc),s=(n?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),i,r),c=new WP(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(eF,{redo:n,historyState:c})}var ZP=!1,QP=null;function $P(e){let t=e.plugins;if(QP!=t){ZP=!1,QP=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){ZP=!0;break}}return ZP}var eF=new ry(`history`),tF=new ry(`closeHistory`);function nF(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new ey({key:eF,state:{init(){return new WP(VP.empty,VP.empty,null,0,-1)},apply(t,n,r){return KP(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n==`historyUndo`?iF:n==`historyRedo`?aF:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function rF(e,t){return(n,r)=>{let i=eF.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=XP(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var iF=rF(!1,!0),aF=rF(!0,!0),oF=tO.create({name:`characterCount`,addOptions(){return{limit:null,autoTrim:!0,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new ey({key:new ry(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,a=this.options.autoTrim;if(i==null||i===0||a===!1){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){let t=o-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}}),sF=tO.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[CP(this.options)]}});tO.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new ey({key:new ry(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return AC.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(DC.node(t,t+e.nodeSize,{class:this.options.className}))}),AC.create(e,a)}}})]}});var cF=tO.create({name:`gapCursor`,addProseMirrorPlugins(){return[AP()]},extendNodeSchema(e){return{allowGapCursor:XT(W(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),lF=`placeholder`,uF=new ry(`tiptap__placeholder`);function dF(e){let{editor:t,placeholder:n,dataAttribute:r,pos:i,node:a,isEmptyDoc:o,hasAnchor:s,classes:{emptyNode:c,emptyEditor:l}}=e,u=[c];return o&&u.push(l),DC.node(i,i+a.nodeSize,{class:u.join(` `),[r]:typeof n==`function`?n({editor:t,node:a,pos:i,hasAnchor:s}):n})}function fF(e,t){return typeof e==`function`?e(t):e}function pF({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:a,to:o}){let{anchor:s}=i,c=[],l=e.isEmpty;return r.nodesBetween(a,o,(r,i)=>{let a=s>=i&&s<=i+r.nodeSize,o=!r.isLeaf&&ME(r);return r.type.isTextblock&&(a||!t.showOnlyCurrent)&&o&&c.push(dF({editor:e,isEmptyDoc:l,dataAttribute:n,hasAnchor:a,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:fF(t.emptyNodeClass,{editor:e,node:r,pos:i,hasAnchor:a})},node:r,pos:i})),t.includeChildren}),c}function mF({editor:e,options:t,dataAttribute:n,doc:r,selection:i}){if(!(e.isEditable||!t.showOnlyWhenEditable))return null;let{anchor:a}=i,o=[],s=e.isEmpty;if(t.showOnlyCurrent&&!t.includeChildren){let i=r.resolve(a),c=i.depth>0?i.node(1):i.nodeAfter,l=i.depth>0?i.before(1):a;if(c&&c.type.isTextblock&&ME(c)){let r=a>=l&&a<=l+c.nodeSize;o.push(dF({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:r,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:fF(t.emptyNodeClass,{editor:e,node:c,pos:l,hasAnchor:r})},node:c,pos:l}))}}else o.push(...pF({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:0,to:r.content.size}));return AC.create(r,o)}function hF(e,t){let n=e.resolve(t);if(n.depth===0){let e=n.nodeAfter??n.nodeBefore;if(!e)return{from:t,to:t};let r=n.nodeAfter?t:t-e.nodeSize;return{from:r,to:r+e.nodeSize}}let r=n.before(1);return{from:r,to:r+n.node(1).nodeSize}}function gF(e,t){return{from:Math.max(0,t.from-1),to:Math.min(e.content.size,t.to-1)}}function _F(e,t,n){let r=[];return e.forEach((e,i)=>{let a=i,o=a+e.nodeSize,s=a+1,c=o+1;s<n&&c>t&&r.push({from:a,to:o})}),r}function vF(e){if(e.length===0)return[];let t=[...e].sort((e,t)=>e.from-t.from),n=[{...t[0]}];for(let e=1;e<t.length;e+=1){let r=n[n.length-1],i=t[e];i.from<=r.to?r.to=Math.max(r.to,i.to):n.push({...i})}return n}function yF(e,t){let n=_F(e,t.from,t.to);return n.push(gF(e,hF(e,t.from))),t.to>t.from?n.push(gF(e,hF(e,Math.min(t.to,e.content.size+1)-1))):t.from<e.content.size+1&&n.push(gF(e,hF(e,Math.min(t.from+1,e.content.size)))),n}function bF(e,t,n){let r=[];if(e.docChanged){let t=yE(e);for(let e of t)r.push(...yF(n.doc,e.newRange))}return e.selectionSet&&(r.push(gF(n.doc,hF(n.doc,e.mapping.map(t.selection.anchor)))),r.push(gF(n.doc,hF(n.doc,n.selection.anchor)))),vF(r)}function xF(e,t,n){let r=Math.max(0,Math.min(e,n.content.size));return{from:r,to:Math.max(r,Math.min(t,n.content.size))}}function SF({decorations:e,ranges:t,editor:n,options:r,dataAttribute:i,doc:a,selection:o}){let s=e;for(let e of t){let{from:t,to:c}=xF(e.from,e.to,a),l=s.find(t,c).filter(e=>e.from>=t&&e.to<=c);l.length&&(s=s.remove(l));let u=pF({editor:n,options:r,dataAttribute:i,doc:a,selection:o,from:t,to:c});u.length&&(s=s.add(a,u))}return s}function CF({editor:e,options:t,dataAttribute:n}){return{init(r,i){return mF({editor:e,options:t,dataAttribute:n,doc:i.doc,selection:i.selection})??AC.empty},apply(r,i,a,o){return!r.docChanged&&!r.selectionSet?i:SF({decorations:i.map(r.mapping,r.doc),ranges:bF(r,a,o),editor:e,options:t,dataAttribute:n,doc:o.doc,selection:o.selection})}}}function wF(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}function TF({editor:e,options:t}){let n=t.dataAttribute?`data-${wF(t.dataAttribute)}`:`data-${lF}`,r=t.showOnlyCurrent&&!t.includeChildren;return new ey({key:uF,...r?{}:{state:CF({editor:e,options:t,dataAttribute:n})},props:{decorations:r?({doc:r,selection:i})=>mF({editor:e,options:t,dataAttribute:n,doc:r,selection:i}):n=>t.showOnlyWhenEditable&&!e.isEditable?AC.empty:uF.getState(n)??AC.empty}})}var EF=tO.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:lF,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[TF({editor:this.editor,options:this.options})]}});function DF(e,t){return!e.selection.empty&&!NE(e.selection)&&t.isEditable}function OF(e,t){return DF(e,t)&&!t.isFocused&&!t.view.dragging}function kF(){var e;(e=window.getSelection())==null||e.removeAllRanges()}function AF(e){e.focus()}tO.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new ey({key:new ry(`selection`),props:{decorations(n){return OF(n,e)?AC.create(n.doc,[DC.inline(n.selection.from,n.selection.to,{class:t.className})]):null},handleDOMEvents:{blur(t){return DF(t.state,e)&&kF(),!1},focus(t){return DF(t.state,e)&&requestAnimationFrame(()=>{!e.isDestroyed&&t.hasFocus()&&AF(t)}),!1}}}})]}});function jF({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var MF=tO.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new ry(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new ey({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!jF({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!jF({node:r,types:n})}}})]}}),NF=tO.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>iF(e,t),redo:()=>({state:e,dispatch:t})=>aF(e,t)}},addProseMirrorPlugins(){return[nF(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()}}}),PF=tO.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(CA.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(vA.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(mN.configure(this.options.bulletList)),this.options.code!==!1&&e.push(EA.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(AA.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(jA.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(sF.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(cF.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(MA.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(NA.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(NF.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(PA.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(zA.configure(this.options.italic)),this.options.listItem!==!1&&e.push(LN.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(KN.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(uN.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(lP.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(_P.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(bP.configure(this.options.strike)),this.options.text!==!1&&e.push(xP.configure(this.options.text)),this.options.underline!==!1&&e.push(SP.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(MF.configure(this.options?.trailingNode)),e}}),FF=20,IF=(e,t=0)=>{let n=[];return!e.children.length||t>FF||Array.from(e.children).forEach(e=>{e.tagName===`SPAN`?n.push(e):e.children.length&&n.push(...IF(e,t+1))}),n},LF=e=>{if(!e.children.length)return;let t=IF(e);t&&t.forEach(e=>{var t;let n=e.getAttribute(`style`),r=(t=e.parentElement)==null||(t=t.closest(`span`))==null?void 0:t.getAttribute(`style`);e.setAttribute(`style`,`${r};${n}`)})},RF=qD.create({name:`textStyle`,priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:`span`,consuming:!1,getAttrs:e=>e.hasAttribute(`style`)?(this.options.mergeNestedSpanStyles&&LF(e),{}):!1}]},renderHTML({HTMLAttributes:e}){return[`span`,nE(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleTextStyle:e=>({commands:t})=>t.toggleMark(this.name,e),removeEmptyTextStyle:()=>({tr:e})=>{let{selection:t}=e;return e.doc.nodesBetween(t.from,t.to,(t,n)=>{if(!t.isInline)return!0;t.marks.filter(e=>e.type===this.type).some(e=>Object.values(e.attrs).some(e=>!!e))||e.removeMark(n,n+t.nodeSize,this.type)}),!0}}}}),zF=tO.create({name:`backgroundColor`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:e=>(ND(e,`background-color`)??e.style.backgroundColor)?.replace(/['"]+/g,``),renderHTML:e=>e.backgroundColor?{style:`background-color: ${e.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:e=>({chain:t})=>t().setMark(`textStyle`,{backgroundColor:e}).run(),unsetBackgroundColor:()=>({chain:e})=>e().setMark(`textStyle`,{backgroundColor:null}).removeEmptyTextStyle().run()}}}),BF=tO.create({name:`color`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:e=>(ND(e,`color`)??e.style.color)?.replace(/['"]+/g,``),renderHTML:e=>e.color?{style:`color: ${e.color}`}:{}}}}]},addCommands(){return{setColor:e=>({chain:t})=>t().setMark(`textStyle`,{color:e}).run(),unsetColor:()=>({chain:e})=>e().setMark(`textStyle`,{color:null}).removeEmptyTextStyle().run()}}}),VF=tO.create({name:`fontFamily`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:e=>ND(e,`font-family`)??e.style.fontFamily,renderHTML:e=>e.fontFamily?{style:`font-family: ${e.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:e=>({chain:t})=>t().setMark(`textStyle`,{fontFamily:e}).run(),unsetFontFamily:()=>({chain:e})=>e().setMark(`textStyle`,{fontFamily:null}).removeEmptyTextStyle().run()}}}),HF=tO.create({name:`fontSize`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:e=>ND(e,`font-size`)??e.style.fontSize,renderHTML:e=>e.fontSize?{style:`font-size: ${e.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:e=>({chain:t})=>t().setMark(`textStyle`,{fontSize:e}).run(),unsetFontSize:()=>({chain:e})=>e().setMark(`textStyle`,{fontSize:null}).removeEmptyTextStyle().run()}}}),UF=tO.create({name:`lineHeight`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:e=>ND(e,`line-height`)??e.style.lineHeight,renderHTML:e=>e.lineHeight?{style:`line-height: ${e.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:e=>({chain:t})=>t().setMark(`textStyle`,{lineHeight:e}).run(),unsetLineHeight:()=>({chain:e})=>e().setMark(`textStyle`,{lineHeight:null}).removeEmptyTextStyle().run()}}}),WF=tO.create({name:`textStyleKit`,addExtensions(){let e=[];return this.options.backgroundColor!==!1&&e.push(zF.configure(this.options.backgroundColor)),this.options.color!==!1&&e.push(BF.configure(this.options.color)),this.options.fontFamily!==!1&&e.push(VF.configure(this.options.fontFamily)),this.options.fontSize!==!1&&e.push(HF.configure(this.options.fontSize)),this.options.lineHeight!==!1&&e.push(UF.configure(this.options.lineHeight)),this.options.textStyle!==!1&&e.push(RF.configure(this.options.textStyle)),e}}),GF=qD.create({name:`superscript`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`sup`},{style:`vertical-align`,getAttrs(e){return e===`super`&&null}}]},renderHTML({HTMLAttributes:e}){return[`sup`,nE(this.options.HTMLAttributes,e),0]},addCommands(){return{setSuperscript:()=>({commands:e})=>e.setMark(this.name),toggleSuperscript:()=>({commands:e})=>e.toggleMark(this.name),unsetSuperscript:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),KF=qD.create({name:`subscript`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`sub`},{style:`vertical-align`,getAttrs(e){return e===`sub`&&null}}]},renderHTML({HTMLAttributes:e}){return[`sub`,nE(this.options.HTMLAttributes,e),0]},addCommands(){return{setSubscript:()=>({commands:e})=>e.setMark(this.name),toggleSubscript:()=>({commands:e})=>e.toggleMark(this.name),unsetSubscript:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),qF=tO.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:e=>{let t=e.style.textAlign;return this.options.alignments.includes(t)?t:this.options.defaultAlignment},renderHTML:e=>e.textAlign?{style:`text-align: ${e.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>this.options.alignments.includes(e)?this.options.types.map(n=>t.updateAttributes(n,{textAlign:e})).some(e=>e):!1,unsetTextAlign:()=>({commands:e})=>this.options.types.map(t=>e.resetAttributes(t,`textAlign`)).some(e=>e),toggleTextAlign:e=>({editor:t,commands:n})=>this.options.alignments.includes(e)?t.isActive({textAlign:e})?n.unsetTextAlign():n.setTextAlign(e):!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`)}}}),JF=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,YF=wO.create({name:`image`,addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?`inline`:`block`},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?`img[src]`:`img[src]:not([src^="data:"])`}]},renderHTML({HTMLAttributes:e}){return[`img`,nE(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode(`image`,{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{let t=e.attrs?.src??``,n=e.attrs?.alt??``,r=e.attrs?.title??``;return r?``:``},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>`u`)return null;let{directions:e,minWidth:t,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize,i=new Set([`src`,`width`,`height`]);return({node:a,getPos:o,HTMLAttributes:s,editor:c})=>{let l=document.createElement(`img`);l.draggable=!1;let u=nE(this.options.HTMLAttributes,s);Object.entries(u).forEach(([e,t])=>{if(t!=null)switch(e){case`src`:case`width`:case`height`:break;default:l.setAttribute(e,t)}}),u.src!==null&&(l.src=u.src);let d={...s},f=e=>{if(typeof e==`string`&&e!==``){l.getAttribute(`src`)!==e&&(l.src=e);return}l.hasAttribute(`src`)&&l.removeAttribute(`src`),l.src!==``&&(l.src=``)};f(s.src);let p=new CO({element:l,editor:c,node:a,getPos:o,onResize:(e,t)=>{l.style.width=`${e}px`,l.style.height=`${t}px`},onCommit:(e,t)=>{let n=o();n!==void 0&&this.editor.chain().setNodeSelection(n).updateAttributes(this.name,{width:e,height:t}).run()},onUpdate:e=>{if(e.type!==a.type)return!1;let t=rE(e,c.extensionManager.attributes.filter(t=>t.type===e.type.name));return Object.keys(d).forEach(e=>{!i.has(e)&&!(e in t)&&l.removeAttribute(e)}),Object.entries(t).forEach(([e,t])=>{i.has(e)||(t==null?l.removeAttribute(e):l.setAttribute(e,t))}),f(t.src),d=t,!0},options:{directions:e,min:{width:t,height:n},preserveAspectRatio:r===!0}}),m=p.dom,h=()=>{m.style.visibility=``,m.style.pointerEvents=``};return m.style.visibility=`hidden`,m.style.pointerEvents=`none`,l.complete&&l.naturalWidth>0?h():(l.onload=h,l.onerror=h),p}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[yO({find:JF,type:this.type,getAttributes:e=>{let[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}}),XF=EF,ZF=e=>String(e).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`),QF=e=>{let t=document.createElement(`div`);t.innerHTML=e;let n=Array.from(t.children);return n.length<2||!n.every(e=>e.tagName===`DIV`)||!n.every(e=>e.attributes.length===0)||!n.every(e=>Array.from(e.children).every(e=>{let t=e.tagName;return[`SPAN`,`B`,`I`,`EM`,`STRONG`,`U`,`SUB`,`SUP`,`A`,`CODE`,`BR`].includes(t)}))?e:`<p>${n.map(e=>e.innerHTML).join(`<br>`)}</p>`},$F=e=>{let t=String(e??``).trim();return t?/<[^>]+>/.test(t)?QF(t):`<div>${ZF(t)}</div>`:`<div></div>`},eI,tI;if(typeof WeakMap<`u`){let e=new WeakMap;eI=t=>e.get(t),tI=(t,n)=>(e.set(t,n),n)}else{let e=[],t=0;eI=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},tI=(n,r)=>(t==10&&(t=0),e[t++]=n,e[t++]=r)}var nI=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let r=t%this.width,i=t/this.width|0,a=r+1,o=i+1;for(let e=1;a<this.width&&this.map[t+e]==n;e++)a++;for(let e=1;o<this.height&&this.map[t+this.width*e]==n;e++)o++;return{left:r,top:i,right:a,bottom:o}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:r,right:i,top:a,bottom:o}=this.findCell(e);return t==`horiz`?(n<0?r==0:i==this.width)?null:this.map[a*this.width+(n<0?r-1:i)]:(n<0?a==0:o==this.height)?null:this.map[r+this.width*(n<0?a-1:o)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:a}=this.findCell(e),{left:o,right:s,top:c,bottom:l}=this.findCell(t);return{left:Math.min(n,o),top:Math.min(i,c),right:Math.max(r,s),bottom:Math.max(a,l)}}cellsInRect(e){let t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){let a=r*this.width+i,o=this.map[a];n[o]||(n[o]=!0,!(i==e.left&&i&&this.map[a-1]==o||r==e.top&&r&&this.map[a-this.width]==o)&&t.push(o))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){let a=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width,r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?a-1:this.map[n]}i=a}}static get(e){return eI(e)||tI(e,rI(e))}};function rI(e){if(e.type.spec.tableRole!=`table`)throw RangeError(`Not a table node: `+e.type.name);let t=iI(e),n=e.childCount,r=[],i=0,a=null,o=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let s=0,c=0;s<n;s++){let l=e.child(s);c++;for(let e=0;;e++){for(;i<r.length&&r[i]!=0;)i++;if(e==l.childCount)break;let u=l.child(e),{colspan:d,rowspan:f,colwidth:p}=u.attrs;for(let e=0;e<f;e++){if(e+s>=n){(a||=[]).push({type:`overlong_rowspan`,pos:c,n:f-e});break}let l=i+e*t;for(let e=0;e<d;e++){r[l+e]==0?r[l+e]=c:(a||=[]).push({type:`collision`,row:s,pos:c,n:d-e});let n=p&&p[e];if(n){let r=(l+e)%t*2,i=o[r];i==null||i!=n&&o[r+1]==1?(o[r]=n,o[r+1]=1):i==n&&o[r+1]++}}}i+=d,c+=u.nodeSize}let u=(s+1)*t,d=0;for(;i<u;)r[i++]==0&&d++;d&&(a||=[]).push({type:`missing`,row:s,n:d}),c++}(t===0||n===0)&&(a||=[]).push({type:`zero_sized`});let s=new nI(t,n,r,a),c=!1;for(let e=0;!c&&e<o.length;e+=2)o[e]!=null&&o[e+1]<n&&(c=!0);return c&&aI(s,o,e),s}function iI(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){let i=e.child(r),a=0;if(n)for(let t=0;t<r;t++){let n=e.child(t);for(let e=0;e<n.childCount;e++){let i=n.child(e);t+i.attrs.rowspan>r&&(a+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){let t=i.child(e);a+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}t==-1?t=a:t!=a&&(t=Math.max(t,a))}return t}function aI(e,t,n){e.problems||=[];let r={};for(let i=0;i<e.map.length;i++){let a=e.map[i];if(r[a])continue;r[a]=!0;let o=n.nodeAt(a);if(!o)throw RangeError(`No cell with offset ${a} found`);let s=null,c=o.attrs;for(let n=0;n<c.colspan;n++){let r=t[(i+n)%e.width*2];r!=null&&(!c.colwidth||c.colwidth[n]!=r)&&((s||=oI(c))[n]=r)}s&&e.problems.unshift({type:`colwidth mismatch`,pos:a,colwidth:s})}}function oI(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function sI(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let n in e.nodes){let r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}}return t}var cI=new ry(`selectingCells`);function lI(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole==`row`)return e.node(0).resolve(e.before(t+1));return null}function uI(e){for(let t=e.depth;t>0;t--){let n=e.node(t).type.spec.tableRole;if(n===`cell`||n===`header_cell`)return e.node(t)}return null}function dI(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if(t.node(e).type.spec.tableRole==`row`)return!0;return!1}function fI(e){let t=e.selection;if(`$anchorCell`in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if(`node`in t&&t.node&&t.node.type.spec.tableRole==`cell`)return t.$anchor;let n=lI(t.$head)||pI(t.$head);if(n)return n;throw RangeError(`No cell found around position ${t.head}`)}function pI(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n-t.nodeSize)}}function mI(e){return e.parent.type.spec.tableRole==`row`&&!!e.nodeAfter}function hI(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function gI(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function _I(e,t,n){let r=e.node(-1),i=nI.get(r),a=e.start(-1),o=i.nextCell(e.pos-a,t,n);return o==null?null:e.node(0).resolve(a+o)}function vI(e,t,n=1){let r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}function yI(e,t,n=1){let r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}function bI(e,t,n){let r=sI(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=r)return!1;return!0}var xI=class e extends Mv{constructor(e,t=e){let n=e.node(-1),r=nI.get(n),i=e.start(-1),a=r.rectBetween(e.pos-i,t.pos-i),o=e.node(0),s=r.cellsInRect(a).filter(e=>e!=t.pos-i);s.unshift(t.pos-i);let c=s.map(e=>{let t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let r=i+e+1;return new Nv(o.resolve(r),o.resolve(r+t.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(t,n){let r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(mI(r)&&mI(i)&&gI(r,i)){let t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return Iv.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=nI.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},a=[];for(let n=r.top;n<r.bottom;n++){let o=[];for(let a=n*t.width+r.left,s=r.left;s<r.right;s++,a++){let n=t.map[a];if(i[n])continue;i[n]=!0;let s=t.findCell(n),c=e.nodeAt(n);if(!c)throw RangeError(`No cell with offset ${n} found`);let l=r.left-s.left,u=s.right-r.right;if(l>0||u>0){let e=c.attrs;if(l>0&&(e=vI(e,0,l)),u>0&&(e=vI(e,e.colspan-u,u)),s.left<r.left){if(c=c.type.createAndFill(e),!c)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else c=c.type.create(e,c.content)}if(s.top<r.top||s.bottom>r.bottom){let e={...c.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};c=s.top<r.top?c.type.createAndFill(e):c.type.create(e,c.content)}o.push(c)}a.push(e.child(n).copy(H.from(o)))}let o=this.isColSelection()&&this.isRowSelection()?e:a;return new U(H.from(o),1,1)}replace(e,t=U.empty){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n);e.replace(s.map(a.pos),s.map(o.pos),i?U.empty:t)}let i=Mv.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new U(H.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=nI.get(t),r=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let r=t.node(-1),i=nI.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.top<=s.top?(o.top>0&&(t=c.resolve(a+i.map[o.left])),s.bottom<i.height&&(n=c.resolve(a+i.map[i.width*(i.height-1)+s.right-1]))):(s.top>0&&(n=c.resolve(a+i.map[s.left])),o.bottom<i.height&&(t=c.resolve(a+i.map[i.width*(i.height-1)+o.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=nI.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);if(Math.min(r,i)>0)return!1;let a=r+this.$anchorCell.nodeAfter.attrs.colspan,o=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,o)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let r=t.node(-1),i=nI.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.left<=s.left?(o.left>0&&(t=c.resolve(a+i.map[o.top*i.width])),s.right<i.width&&(n=c.resolve(a+i.map[i.width*(s.top+1)-1]))):(s.left>0&&(n=c.resolve(a+i.map[s.top*i.width])),o.right<i.width&&(t=c.resolve(a+i.map[i.width*(o.top+1)-1]))),new e(t,n)}toJSON(){return{type:`cell`,anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new SI(this.$anchorCell.pos,this.$headCell.pos)}};xI.prototype.visible=!1,Mv.jsonID(`cell`,xI);var SI=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){let t=e.resolve(this.anchor),n=e.resolve(this.head);return t.parent.type.spec.tableRole==`row`&&n.parent.type.spec.tableRole==`row`&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&gI(t,n)?new xI(t,n):Mv.near(n,1)}};function CI(e){if(!(e.selection instanceof xI))return null;let t=[];return e.selection.forEachCell((e,n)=>{t.push(DC.node(n,n+e.nodeSize,{class:`selectedCell`}))}),AC.create(e.doc,t)}function wI({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(i).type.spec.tableRole)}function TI({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){let r=e.node(t);if(r.type.spec.tableRole===`cell`||r.type.spec.tableRole===`header_cell`){n=r;break}}for(let e=t.depth;e>0;e--){let n=t.node(e);if(n.type.spec.tableRole===`cell`||n.type.spec.tableRole===`header_cell`){r=n;break}}return n!==r&&t.parentOffset===0}function vee(e,t,n){let r=(t||e).selection,i=(t||e).doc,a,o;if(r instanceof Rv&&(o=r.node.type.spec.tableRole)){if(o==`cell`||o==`header_cell`)a=xI.create(i,r.from);else if(o==`row`){let e=i.resolve(r.from+1);a=xI.rowSelection(e,e)}else if(!n){let e=nI.get(r.node),t=r.from+1,n=t+e.map[e.width*e.height-1];a=xI.create(i,t+1,n)}}else r instanceof Iv&&wI(r)?a=Iv.create(i,r.from):r instanceof Iv&&TI(r)&&(a=Iv.create(i,r.$from.start(),r.$from.end()));return a&&(t||=e.tr).setSelection(a),t}var yee=new ry(`fix-tables`);function EI(e,t,n,r){let i=e.childCount,a=t.childCount;outer:for(let o=0,s=0;o<a;o++){let a=t.child(o);for(let t=s,r=Math.min(i,o+3);t<r;t++)if(e.child(t)==a){s=t+1,n+=a.nodeSize;continue outer}r(a,n),s<i&&e.child(s).sameMarkup(a)?EI(e.child(s),a,n+1,r):a.nodesBetween(0,a.content.size,r,n+1),n+=a.nodeSize}}function DI(e,t){let n,r=(t,r)=>{t.type.spec.tableRole==`table`&&(n=bee(e,t,r,n))};return t?t.doc!=e.doc&&EI(t.doc,e.doc,0,r):e.doc.descendants(r),n}function bee(e,t,n,r){let i=nI.get(t);if(!i.problems)return r;r||=e.tr;let a=[];for(let e=0;e<i.height;e++)a.push(0);for(let e=0;e<i.problems.length;e++){let o=i.problems[e];if(o.type==`collision`){let e=t.nodeAt(o.pos);if(!e)continue;let i=e.attrs;for(let e=0;e<i.rowspan;e++)a[o.row+e]+=o.n;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,vI(i,i.colspan-o.n,o.n))}else if(o.type==`missing`)a[o.row]+=o.n;else if(o.type==`overlong_rowspan`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-o.n})}else if(o.type==`colwidth mismatch`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,colwidth:o.colwidth})}else if(o.type==`zero_sized`){let e=r.mapping.map(n);r.delete(e,e+t.nodeSize)}}let o,s;for(let e=0;e<a.length;e++)a[e]&&(o??=e,s=e);for(let c=0,l=n+1;c<i.height;c++){let n=t.child(c),i=l+n.nodeSize,u=a[c];if(u>0){let t=`cell`;n.firstChild&&(t=n.firstChild.type.spec.tableRole);let a=[];for(let n=0;n<u;n++){let n=sI(e.schema)[t].createAndFill();n&&a.push(n)}let d=(c==0||o==c-1)&&s==c?l+1:i-1;r.insert(r.mapping.map(d),a)}l=i}return r.setMeta(yee,{fixTables:!0})}function OI(e){let t=e.selection,n=fI(e),r=n.node(-1),i=n.start(-1),a=nI.get(r);return{...t instanceof xI?a.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):a.findCell(n.pos-i),tableStart:i,map:a,table:r}}function kI(e,{map:t,tableStart:n,table:r},i){let a=i>0?-1:0;bI(t,r,i+a)&&(a=i==0||i==t.width?null:0);for(let o=0;o<t.height;o++){let s=o*t.width+i;if(i>0&&i<t.width&&t.map[s-1]==t.map[s]){let a=t.map[s],c=r.nodeAt(a);e.setNodeMarkup(e.mapping.map(n+a),null,yI(c.attrs,i-t.colCount(a))),o+=c.attrs.rowspan-1}else{let c=a==null?sI(r.type.schema).cell:r.nodeAt(t.map[s+a]).type,l=t.positionAt(o,i,r);e.insert(e.mapping.map(n+l),c.createAndFill())}}return e}function xee(e,t){if(!dI(e))return!1;if(t){let n=OI(e);t(kI(e.tr,n,n.left))}return!0}function See(e,t){if(!dI(e))return!1;if(t){let n=OI(e);t(kI(e.tr,n,n.right))}return!0}function Cee(e,{map:t,table:n,tableStart:r},i){let a=e.mapping.maps.length;for(let o=0;o<t.height;){let s=o*t.width+i,c=t.map[s],l=n.nodeAt(c),u=l.attrs;if(i>0&&t.map[s-1]==c||i<t.width-1&&t.map[s+1]==c)e.setNodeMarkup(e.mapping.slice(a).map(r+c),null,vI(u,i-t.colCount(c)));else{let t=e.mapping.slice(a).map(r+c);e.delete(t,t+l.nodeSize)}o+=u.rowspan}}function wee(e,t){if(!dI(e))return!1;if(t){let n=OI(e),r=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let e=n.right-1;Cee(r,n,e),e!=n.left;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=nI.get(e)}t(r)}return!0}function Tee(e,t,n){let r=sI(t.type.schema).header_cell;for(let i=0;i<e.width;i++)if(t.nodeAt(e.map[i+n*e.width])?.type!=r)return!1;return!0}function AI(e,{map:t,tableStart:n,table:r},i){let a=n;for(let e=0;e<i;e++)a+=r.child(e).nodeSize;let o=[],s=i>0?-1:0;Tee(t,r,i+s)&&(s=i==0||i==t.height?null:0);for(let a=0,c=t.width*i;a<t.width;a++,c++)if(i>0&&i<t.height&&t.map[c]==t.map[c-t.width]){let i=t.map[c],o=r.nodeAt(i).attrs;e.setNodeMarkup(n+i,null,{...o,rowspan:o.rowspan+1}),a+=o.colspan-1}else{let e=(s==null?sI(r.type.schema).cell:r.nodeAt(t.map[c+s*t.width])?.type)?.createAndFill();e&&o.push(e)}return e.insert(a,sI(r.type.schema).row.create(null,o)),e}function Eee(e,t){if(!dI(e))return!1;if(t){let n=OI(e);t(AI(e.tr,n,n.top))}return!0}function Dee(e,t){if(!dI(e))return!1;if(t){let n=OI(e);t(AI(e.tr,n,n.bottom))}return!0}function Oee(e,{map:t,table:n,tableStart:r},i){let a=0;for(let e=0;e<i;e++)a+=n.child(e).nodeSize;let o=a+n.child(i).nodeSize,s=e.mapping.maps.length;e.delete(a+r,o+r);let c=new Set;for(let a=0,o=i*t.width;a<t.width;a++,o++){let l=t.map[o];if(!c.has(l)){if(c.add(l),i>0&&l==t.map[o-t.width]){let t=n.nodeAt(l).attrs;e.setNodeMarkup(e.mapping.slice(s).map(l+r),null,{...t,rowspan:t.rowspan-1}),a+=t.colspan-1}else if(i<t.height&&l==t.map[o+t.width]){let o=n.nodeAt(l),c=o.attrs,u=o.type.create({...c,rowspan:o.attrs.rowspan-1},o.content),d=t.positionAt(i+1,a,n);e.insert(e.mapping.slice(s).map(r+d),u),a+=c.colspan-1}}}}function kee(e,t){if(!dI(e))return!1;if(t){let n=OI(e),r=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;Oee(r,n,e),e!=n.top;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=nI.get(n.table)}t(r)}return!0}function jI(e){let t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function Aee({width:e,height:t,map:n},r){let i=r.top*e+r.left,a=i,o=(r.bottom-1)*e+r.left,s=i+(r.right-r.left-1);for(let t=r.top;t<r.bottom;t++){if(r.left>0&&n[a]==n[a-1]||r.right<e&&n[s]==n[s+1])return!0;a+=e,s+=e}for(let a=r.left;a<r.right;a++){if(r.top>0&&n[i]==n[i-e]||r.bottom<t&&n[o]==n[o+e])return!0;i++,o++}return!1}function MI(e,t){let n=e.selection;if(!(n instanceof xI)||n.$anchorCell.pos==n.$headCell.pos)return!1;let r=OI(e),{map:i}=r;if(Aee(i,r))return!1;if(t){let n=e.tr,a={},o=H.empty,s,c;for(let e=r.top;e<r.bottom;e++)for(let t=r.left;t<r.right;t++){let l=i.map[e*i.width+t],u=r.table.nodeAt(l);if(!(a[l]||!u))if(a[l]=!0,s==null)s=l,c=u;else{jI(u)||(o=o.append(u.content));let e=n.mapping.map(l+r.tableStart);n.delete(e,e+u.nodeSize)}}if(s==null||c==null)return!0;if(n.setNodeMarkup(s+r.tableStart,null,{...yI(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),o.size>0){let e=s+1+c.content.size,t=jI(c)?s+1:e;n.replaceWith(t+r.tableStart,e+r.tableStart,o)}n.setSelection(new xI(n.doc.resolve(s+r.tableStart))),t(n)}return!0}function NI(e,t){let n=sI(e.schema);return jee(({node:e})=>n[e.type.spec.tableRole])(e,t)}function jee(e){return(t,n)=>{let r=t.selection,i,a;if(r instanceof xI){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,a=r.$anchorCell.pos}else{if(i=uI(r.$from),!i)return!1;a=lI(r.$from)?.pos}if(i==null||a==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let o=i.attrs,s=[],c=o.colwidth;o.rowspan>1&&(o={...o,rowspan:1}),o.colspan>1&&(o={...o,colspan:1});let l=OI(t),u=t.tr;for(let e=0;e<l.right-l.left;e++)s.push(c?{...o,colwidth:c&&c[e]?[c[e]]:null}:o);let d;for(let t=l.top;t<l.bottom;t++){let n=l.map.positionAt(t,l.left,l.table);t==l.top&&(n+=i.nodeSize);for(let r=l.left,a=0;r<l.right;r++,a++)r==l.left&&t==l.top||u.insert(d=u.mapping.map(n+l.tableStart,1),e({node:i,row:t,col:r}).createAndFill(s[a]))}u.setNodeMarkup(a,e({node:i,row:l.top,col:l.left}),s[0]),r instanceof xI&&u.setSelection(new xI(u.doc.resolve(r.$anchorCell.pos),d?u.doc.resolve(d):void 0)),n(u)}return!0}}function Mee(e,t){return function(n,r){if(!dI(n))return!1;let i=fI(n);if(i.nodeAfter.attrs[e]===t)return!1;if(r){let a=n.tr;n.selection instanceof xI?n.selection.forEachCell((n,r)=>{n.attrs[e]!==t&&a.setNodeMarkup(r,null,{...n.attrs,[e]:t})}):a.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),r(a)}return!0}}function Nee(e){return function(t,n){if(!dI(t))return!1;if(n){let r=sI(t.schema),i=OI(t),a=t.tr,o=i.map.cellsInRect(e==`column`?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e==`row`?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),s=o.map(e=>i.table.nodeAt(e));for(let e=0;e<o.length;e++)s[e].type==r.header_cell&&a.setNodeMarkup(i.tableStart+o[e],r.cell,s[e].attrs);if(a.steps.length===0)for(let e=0;e<o.length;e++)a.setNodeMarkup(i.tableStart+o[e],r.header_cell,s[e].attrs);n(a)}return!0}}function PI(e,t,n){let r=t.map.cellsInRect({left:0,top:0,right:e==`row`?t.map.width:1,bottom:e==`column`?t.map.height:1});for(let e=0;e<r.length;e++){let i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function FI(e,t){return t||={useDeprecatedLogic:!1},t.useDeprecatedLogic?Nee(e):function(t,n){if(!dI(t))return!1;if(n){let r=sI(t.schema),i=OI(t),a=t.tr,o=PI(`row`,i,r),s=PI(`column`,i,r),c=(e===`column`?o:e===`row`&&s)?1:0,l=e==`column`?{left:0,top:c,right:1,bottom:i.map.height}:e==`row`?{left:c,top:0,right:i.map.width,bottom:1}:i,u=e==`column`?s?r.cell:r.header_cell:e==`row`?o?r.cell:r.header_cell:r.cell;i.map.cellsInRect(l).forEach(e=>{let t=e+i.tableStart,n=a.doc.nodeAt(t);n&&a.setNodeMarkup(t,u,n.attrs)}),n(a)}return!0}}FI(`row`,{useDeprecatedLogic:!0}),FI(`column`,{useDeprecatedLogic:!0});var II=FI(`cell`,{useDeprecatedLogic:!0});function LI(e,t){if(t<0){let t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){let r=e.node(-1).child(t),i=r.lastChild;if(i)return n-1-i.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){let e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}function RI(e){return function(t,n){if(!dI(t))return!1;let r=LI(fI(t),e);if(r==null)return!1;if(n){let e=t.doc.resolve(r);n(t.tr.setSelection(Iv.between(e,hI(e))).scrollIntoView())}return!0}}function zI(e,t){let n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole==`table`)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function BI(e,t){let n=e.selection;if(!(n instanceof xI))return!1;if(t){let r=e.tr,i=sI(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new U(i,0,0))}),r.docChanged&&t(r)}return!0}function VI(e){if(e.size===0)return null;let{content:t,openStart:n,openEnd:r}=e;for(;t.childCount==1&&(n>0&&r>0||t.child(0).type.spec.tableRole==`table`);)n--,r--,t=t.child(0).content;let i=t.child(0),a=i.type.spec.tableRole,o=i.type.schema,s=[];if(a==`row`)for(let e=0;e<t.childCount;e++){let i=t.child(e).content,a=e?0:Math.max(0,n-1),c=e<t.childCount-1?0:Math.max(0,r-1);(a||c)&&(i=UI(sI(o).row,new U(i,a,c)).content),s.push(i)}else if(a==`cell`||a==`header_cell`)s.push(n||r?UI(sI(o).row,new U(t,n,r)).content:t);else return null;return HI(o,s)}function HI(e,t){let n=[];for(let e=0;e<t.length;e++){let r=t[e];for(let t=r.childCount-1;t>=0;t--){let{rowspan:i,colspan:a}=r.child(t).attrs;for(let t=e;t<e+i;t++)n[t]=(n[t]||0)+a}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(H.empty),n[i]<r){let a=sI(e).cell.createAndFill(),o=[];for(let e=n[i];e<r;e++)o.push(a);t[i]=t[i].append(H.from(o))}return{height:t.length,width:r,rows:t}}function UI(e,t){let n=e.createAndFill();return new Av(n).replace(0,n.content.size,t).doc}function WI({width:e,height:t,rows:n},r,i){if(e!=r){let t=[],i=[];for(let e=0;e<n.length;e++){let a=n[e],o=[];for(let n=t[e]||0,i=0;n<r;i++){let s=a.child(i%a.childCount);n+s.attrs.colspan>r&&(s=s.type.createChecked(vI(s.attrs,s.attrs.colspan,n+s.attrs.colspan-r),s.content)),o.push(s),n+=s.attrs.colspan;for(let n=1;n<s.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+s.attrs.colspan}i.push(H.from(o))}n=i,e=r}if(t!=i){let e=[];for(let r=0,a=0;r<i;r++,a++){let o=[],s=n[a%t];for(let e=0;e<s.childCount;e++){let t=s.child(e);r+t.attrs.rowspan>i&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,i-t.attrs.rowspan)},t.content)),o.push(t)}e.push(H.from(o))}n=e,t=i}return{width:e,height:t,rows:n}}function GI(e,t,n,r,i,a,o){let s=e.doc.type.schema,c=sI(s),l,u;if(i>t.width)for(let a=0,s=0;a<t.height;a++){let d=n.child(a);s+=d.nodeSize;let f=[],p;p=d.lastChild==null||d.lastChild.type==c.cell?l||=c.cell.createAndFill():u||=c.header_cell.createAndFill();for(let e=t.width;e<i;e++)f.push(p);e.insert(e.mapping.slice(o).map(s-1+r),f)}if(a>t.height){let s=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,i);e++){let i=e>=t.width?!1:n.nodeAt(t.map[r+e]).type==c.header_cell;s.push(i?u||=c.header_cell.createAndFill():l||=c.cell.createAndFill())}let d=c.row.create(null,H.from(s)),f=[];for(let e=t.height;e<a;e++)f.push(d);e.insert(e.mapping.slice(o).map(r+n.nodeSize-2),f)}return!!(l||u)}function KI(e,t,n,r,i,a,o,s){if(o==0||o==t.height)return!1;let c=!1;for(let l=i;l<a;l++){let i=o*t.width+l,a=t.map[i];if(t.map[i-t.width]==a){c=!0;let i=n.nodeAt(a),{top:u,left:d}=t.findCell(a);e.setNodeMarkup(e.mapping.slice(s).map(a+r),null,{...i.attrs,rowspan:o-u}),e.insert(e.mapping.slice(s).map(t.positionAt(o,d,n)),i.type.createAndFill({...i.attrs,rowspan:u+i.attrs.rowspan-o})),l+=i.attrs.colspan-1}}return c}function qI(e,t,n,r,i,a,o,s){if(o==0||o==t.width)return!1;let c=!1;for(let l=i;l<a;l++){let i=l*t.width+o,a=t.map[i];if(t.map[i-1]==a){c=!0;let i=n.nodeAt(a),u=t.colCount(a),d=e.mapping.slice(s).map(a+r);e.setNodeMarkup(d,null,vI(i.attrs,o-u,i.attrs.colspan-(o-u))),e.insert(d+i.nodeSize,i.type.createAndFill(vI(i.attrs,0,o-u))),l+=i.attrs.rowspan-1}}return c}function JI(e,t,n,r,i){let a=n?e.doc.nodeAt(n-1):e.doc;if(!a)throw Error(`No table found`);let o=nI.get(a),{top:s,left:c}=r,l=c+i.width,u=s+i.height,d=e.tr,f=0;function p(){if(a=n?d.doc.nodeAt(n-1):d.doc,!a)throw Error(`No table found`);o=nI.get(a),f=d.mapping.maps.length}GI(d,o,a,n,l,u,f)&&p(),KI(d,o,a,n,c,l,s,f)&&p(),KI(d,o,a,n,c,l,u,f)&&p(),qI(d,o,a,n,s,u,c,f)&&p(),qI(d,o,a,n,s,u,l,f)&&p();for(let e=s;e<u;e++){let t=o.positionAt(e,c,a),r=o.positionAt(e,l,a);d.replace(d.mapping.slice(f).map(t+n),d.mapping.slice(f).map(r+n),new U(i.rows[e-s],0,0))}p(),d.setSelection(new xI(d.doc.resolve(n+o.positionAt(s,c,a)),d.doc.resolve(n+o.positionAt(u-1,l-1,a)))),t(d)}var YI=ww({ArrowLeft:ZI(`horiz`,-1),ArrowRight:ZI(`horiz`,1),ArrowUp:ZI(`vert`,-1),ArrowDown:ZI(`vert`,1),"Shift-ArrowLeft":QI(`horiz`,-1),"Shift-ArrowRight":QI(`horiz`,1),"Shift-ArrowUp":QI(`vert`,-1),"Shift-ArrowDown":QI(`vert`,1),Backspace:BI,"Mod-Backspace":BI,Delete:BI,"Mod-Delete":BI});function XI(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function ZI(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection;if(a instanceof xI)return XI(n,r,Mv.near(a.$headCell,t));if(e!=`horiz`&&!a.empty)return!1;let o=nL(i,e,t);if(o==null)return!1;if(e==`horiz`)return XI(n,r,Mv.near(n.doc.resolve(a.head+t),t));{let i=n.doc.resolve(o),a=_I(i,e,t),s;return s=a?Mv.near(a,1):t<0?Mv.near(n.doc.resolve(i.before(-1)),-1):Mv.near(n.doc.resolve(i.after(-1)),1),XI(n,r,s)}}}function QI(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection,o;if(a instanceof xI)o=a;else{let r=nL(i,e,t);if(r==null)return!1;o=new xI(n.doc.resolve(r))}let s=_I(o.$headCell,e,t);return s?XI(n,r,new xI(o.$anchorCell,s)):!1}}function $I(e,t){let n=e.state.doc,r=lI(n.resolve(t));return r?(e.dispatch(e.state.tr.setSelection(new xI(r))),!0):!1}function eL(e,t,n){if(!dI(e.state))return!1;let r=VI(n),i=e.state.selection;if(i instanceof xI){r||={width:1,height:1,rows:[H.from(UI(sI(e.state.schema).cell,n))]};let t=i.$anchorCell.node(-1),a=i.$anchorCell.start(-1),o=nI.get(t).rectBetween(i.$anchorCell.pos-a,i.$headCell.pos-a);return r=WI(r,o.right-o.left,o.bottom-o.top),JI(e.state,e.dispatch,a,o,r),!0}else if(r){let t=fI(e.state),n=t.start(-1);return JI(e.state,e.dispatch,n,nI.get(t.node(-1)).findCell(t.pos-n),r),!0}else return!1}function tL(e,t){if(t.button!=0||t.ctrlKey||t.metaKey)return;let n=rL(e,t.target),r;if(t.shiftKey&&e.state.selection instanceof xI)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&n&&(r=lI(e.state.selection.$anchor))!=null&&iL(e,t)?.pos!=r.pos)i(r,t),t.preventDefault();else if(!n)return;function i(t,n){let r=iL(e,n),i=cI.getState(e.state)==null;if(!r||!gI(t,r))if(i)r=t;else return;let a=new xI(t,r);if(i||!e.state.selection.eq(a)){let n=e.state.tr.setSelection(a);i&&n.setMeta(cI,t.pos),e.dispatch(n)}}function a(){e.root.removeEventListener(`mouseup`,a),e.root.removeEventListener(`dragstart`,a),e.root.removeEventListener(`mousemove`,o),cI.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(cI,-1))}function o(r){let o=r,s=cI.getState(e.state),c;if(s!=null)c=e.state.doc.resolve(s);else if(rL(e,o.target)!=n&&(c=iL(e,t),!c))return a();c&&i(c,o)}e.root.addEventListener(`mouseup`,a),e.root.addEventListener(`dragstart`,a),e.root.addEventListener(`mousemove`,o)}function nL(e,t,n){if(!(e.state.selection instanceof Iv))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let a=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:a.childCount))return null;if(a.type.spec.tableRole==`cell`||a.type.spec.tableRole==`header_cell`){let a=r.before(i),o=t==`vert`?n>0?`down`:`up`:n>0?`right`:`left`;return e.endOfTextblock(o)?a:null}}return null}function rL(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName==`TD`||t.nodeName==`TH`)return t;return null}function iL(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&lI(e.state.doc.resolve(r))||lI(e.state.doc.resolve(i))}var aL=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`)),this.table.style.setProperty(`--default-cell-min-width`,`${t}px`),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),oL(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type==this.node.type?(this.node=e,oL(e,this.colgroup,this.table,this.defaultCellMinWidth),!0):!1}ignoreMutation(e){return e.type==`attributes`&&(e.target==this.table||this.colgroup.contains(e.target))}};function oL(e,t,n,r,i,a){let o=0,s=!0,c=t.firstChild,l=e.firstChild;if(l){for(let e=0,n=0;e<l.childCount;e++){let{colspan:u,colwidth:d}=l.child(e).attrs;for(let e=0;e<u;e++,n++){let l=i==n?a:d&&d[e],u=l?l+`px`:``;if(o+=l||r,l||(s=!1),c)c.style.width!=u&&(c.style.width=u),c=c.nextSibling;else{let e=document.createElement(`col`);e.style.width=u,t.appendChild(e)}}}for(;c;){var u;let e=c.nextSibling;(u=c.parentNode)==null||u.removeChild(c),c=e}s?(n.style.width=o+`px`,n.style.minWidth=``):(n.style.width=``,n.style.minWidth=o+`px`)}}var sL=new ry(`tableColumnResizing`);function cL({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=aL,lastColumnResizable:i=!0}={}){let a=new ey({key:sL,state:{init(e,t){var i;let o=(i=a.spec)==null||(i=i.props)==null?void 0:i.nodeViews,s=sI(t.schema).table.name;return r&&o&&(o[s]=(e,t)=>new r(e,n,t)),new lL(-1,!1)},apply(e,t){return t.apply(e)}},props:{attributes:e=>{let t=sL.getState(e);return t&&t.activeHandle>-1?{class:`resize-cursor`}:{}},handleDOMEvents:{mousemove:(t,n)=>{uL(t,n,e,i)},mouseleave:e=>{dL(e)},mousedown:(e,r)=>{fL(e,r,t,n)}},decorations:e=>{let t=sL.getState(e);if(t&&t.activeHandle>-1)return xL(e,t.activeHandle)},nodeViews:{}}});return a}var lL=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){let n=this,r=t.getMeta(sL);if(r&&r.setHandle!=null)return new e(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new e(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&t.docChanged){let r=t.mapping.map(n.activeHandle,-1);return mI(t.doc.resolve(r))||(r=-1),new e(r,n.dragging)}return n}};function uL(e,t,n,r){if(!e.editable)return;let i=sL.getState(e.state);if(i&&!i.dragging){let a=mL(t.target),o=-1;if(a){let{left:r,right:i}=a.getBoundingClientRect();t.clientX-r<=n?o=hL(e,t,`left`,n):i-t.clientX<=n&&(o=hL(e,t,`right`,n))}if(o!=i.activeHandle){if(!r&&o!==-1){let t=e.state.doc.resolve(o),n=t.node(-1),r=nI.get(n),i=t.start(-1);if(r.colCount(t.pos-i)+t.nodeAfter.attrs.colspan-1==r.width-1)return}_L(e,o)}}}function dL(e){if(!e.editable)return;let t=sL.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&_L(e,-1)}function fL(e,t,n,r){if(!e.editable)return!1;let i=e.dom.ownerDocument.defaultView??window,a=sL.getState(e.state);if(!a||a.activeHandle==-1||a.dragging)return!1;let o=e.state.doc.nodeAt(a.activeHandle),s=pL(e,a.activeHandle,o.attrs);e.dispatch(e.state.tr.setMeta(sL,{setDragging:{startX:t.clientX,startWidth:s}}));function c(t){i.removeEventListener(`mouseup`,c),i.removeEventListener(`mousemove`,l);let r=sL.getState(e.state);r?.dragging&&(vL(e,r.activeHandle,gL(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(sL,{setDragging:null})))}function l(t){if(!t.which)return c(t);let i=sL.getState(e.state);if(i&&i.dragging){let a=gL(i.dragging,t,n);yL(e,i.activeHandle,a,r)}}return yL(e,a.activeHandle,s,r),i.addEventListener(`mouseup`,c),i.addEventListener(`mousemove`,l),t.preventDefault(),!0}function pL(e,t,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let a=e.domAtPos(t),o=a.node.childNodes[a.offset].offsetWidth,s=n;if(r)for(let e=0;e<n;e++)r[e]&&(o-=r[e],s--);return o/s}function mL(e){for(;e&&e.nodeName!=`TD`&&e.nodeName!=`TH`;)e=e.classList&&e.classList.contains(`ProseMirror`)?null:e.parentNode;return e}function hL(e,t,n,r){let i=n==`right`?-r:r,a=e.posAtCoords({left:t.clientX+i,top:t.clientY});if(!a)return-1;let{pos:o}=a,s=lI(e.state.doc.resolve(o));if(!s)return-1;if(n==`right`)return s.pos;let c=nI.get(s.node(-1)),l=s.start(-1),u=c.map.indexOf(s.pos-l);return u%c.width==0?-1:l+c.map[u-1]}function gL(e,t,n){let r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function _L(e,t){e.dispatch(e.state.tr.setMeta(sL,{setHandle:t}))}function vL(e,t,n){let r=e.state.doc.resolve(t),i=r.node(-1),a=nI.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,c=e.state.tr;for(let e=0;e<a.height;e++){let t=e*a.width+s;if(e&&a.map[t]==a.map[t-a.width])continue;let r=a.map[t],l=i.nodeAt(r).attrs,u=l.colspan==1?0:s-a.colCount(r);if(l.colwidth&&l.colwidth[u]==n)continue;let d=l.colwidth?l.colwidth.slice():bL(l.colspan);d[u]=n,c.setNodeMarkup(o+r,null,{...l,colwidth:d})}c.docChanged&&e.dispatch(c)}function yL(e,t,n,r){let i=e.state.doc.resolve(t),a=i.node(-1),o=i.start(-1),s=nI.get(a).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1,c=e.domAtPos(i.start(-1)).node;for(;c&&c.nodeName!=`TABLE`;)c=c.parentNode;c&&oL(a,c.firstChild,c,r,s,n)}function bL(e){return Array(e).fill(0)}function xL(e,t){let n=[],r=e.doc.resolve(t),i=r.node(-1);if(!i)return AC.empty;let a=nI.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let t=0;t<a.height;t++){let r=s+t*a.width;if((s==a.width-1||a.map[r]!=a.map[r+1])&&(t==0||a.map[r]!=a.map[r-a.width])){let t=a.map[r],s=o+t+i.nodeAt(t).nodeSize-1,c=document.createElement(`div`);c.className=`column-resize-handle`,sL.getState(e)?.dragging&&n.push(DC.node(o+t,o+t+i.nodeAt(t).nodeSize,{class:`column-resize-dragging`})),n.push(DC.widget(s,c))}}return AC.create(e.doc,n)}function SL({allowTableNodeSelection:e=!1}={}){return new ey({key:cI,state:{init(){return null},apply(e,t){let n=e.getMeta(cI);if(n!=null)return n==-1?null:n;if(t==null||!e.docChanged)return t;let{deleted:r,pos:i}=e.mapping.mapResult(t);return r?null:i}},props:{decorations:CI,handleDOMEvents:{mousedown:tL},createSelectionBetween(e){return cI.getState(e.state)==null?null:e.state.selection},handleTripleClick:$I,handleKeyDown:YI,handlePaste:eL},appendTransaction(t,n,r){return vee(r,DI(r,n),e)}})}function CL(e){return e===`left`||e===`right`||e===`center`?e:null}function wL(e){let t=(e.style.textAlign||``).trim().toLowerCase(),n=(e.getAttribute(`align`)||``).trim().toLowerCase();return CL(t||n)}function TL(e){return CL(e?.align)}function EL(){return{default:null,parseHTML:e=>wL(e),renderHTML:e=>e.align?{style:`text-align: ${e.align}`}:{}}}function DL(e){let t=e.parentElement,n=e.closest(`table`);if(!t||!n)return null;let r=Array.from(t.children).indexOf(e),i=n.querySelectorAll(`colgroup > col`)[r]?.getAttribute(`width`);return i?[parseInt(i,10)]:null}function OL(e){let t=e.getAttribute(`colwidth`);return t?t.split(`,`).map(e=>parseInt(e,10)):DL(e)}var kL=/[ \t\r\n\f]+/g;function AL(e){return e.children.length>0?!1:(e.textContent??``).replace(kL,``)===``}function jL(e){let t=e.createAndFill();if(!t)throw Error(`[tiptap error]: "${e.name}" has no default content to backfill.`);return t.content}var ML=wO.create({name:`tableCell`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:OL},align:EL()}},tableRole:`cell`,isolating:!0,parseHTML(){return[{tag:`td`,getAttrs:e=>AL(e)?{}:!1,getContent:(e,t)=>jL(t.nodes[this.name])},{tag:`td`}]},renderHTML({HTMLAttributes:e}){return[`td`,nE(this.options.HTMLAttributes,e),0]}}),NL=wO.create({name:`tableHeader`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:OL},align:EL()}},tableRole:`header_cell`,isolating:!0,parseHTML(){return[{tag:`th`,getAttrs:e=>AL(e)?{}:!1,getContent:(e,t)=>jL(t.nodes[this.name])},{tag:`th`}]},renderHTML({HTMLAttributes:e}){return[`th`,nE(this.options.HTMLAttributes,e),0]}}),PL=wO.create({name:`tableRow`,addOptions(){return{HTMLAttributes:{}}},content:`(tableCell | tableHeader)*`,tableRole:`row`,parseHTML(){return[{tag:`tr`}]},renderHTML({HTMLAttributes:e}){return[`tr`,nE(this.options.HTMLAttributes,e),0]}});function FL(e,t){return t?[`width`,`${Math.max(t,e)}px`]:[`min-width`,`${e}px`]}function IL(e,t,n,r,i,a){let o=0,s=!0,c=t.firstChild,l=e.firstChild;if(l!==null)for(let e=0,n=0;e<l.childCount;e+=1){let{colspan:u,colwidth:d}=l.child(e).attrs;for(let e=0;e<u;e+=1,n+=1){let l=i===n?a:d&&d[e],u=l?`${l}px`:``;if(o+=l||r,l||(s=!1),c){if(c.style.width!==u){let[e,t]=FL(r,l);c.style.setProperty(e,t)}c=c.nextSibling}else{let e=document.createElement(`col`),[n,i]=FL(r,l);e.style.setProperty(n,i),t.appendChild(e)}}}for(;c;){var u;let e=c.nextSibling;(u=c.parentNode)==null||u.removeChild(c),c=e}let d=e.attrs.style&&typeof e.attrs.style==`string`&&/\bwidth\s*:/i.test(e.attrs.style);s&&!d?(n.style.width=`${o}px`,n.style.minWidth=``):(n.style.width=``,n.style.minWidth=`${o}px`)}var LL=class{constructor(e,t,n,r={}){this.node=e,this.cellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`));for(let[e,t]of Object.entries(r))t!=null&&(e===`style`?this.table.style.cssText=String(t):this.table.setAttribute(e,String(t)));e.attrs.style&&(this.table.style.cssText=e.attrs.style),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),IL(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type===this.node.type?(this.node=e,IL(e,this.colgroup,this.table,this.cellMinWidth),!0):!1}ignoreMutation(e){let t=e.target,n=this.dom.contains(t),r=this.contentDOM.contains(t);return!!(n&&!r&&(e.type===`attributes`||e.type===`childList`||e.type===`characterData`))}};function RL(e,t,n,r){let i=0,a=!0,o=[],s=e.firstChild;if(!s)return{};for(let e=0,c=0;e<s.childCount;e+=1){let{colspan:l,colwidth:u}=s.child(e).attrs;for(let e=0;e<l;e+=1,c+=1){let s=n===c?r:u&&u[e];i+=s||t,s||(a=!1);let[l,d]=FL(t,s);o.push([`col`,{style:`${l}: ${d}`}])}}let c=a?`${i}px`:``,l=a?``:`${i}px`;return{colgroup:[`colgroup`,{},...o],tableWidth:c,tableMinWidth:l}}function zL(e,t){return t?e.createChecked(null,t):e.createAndFill()}function BL(e){if(e.cached.tableNodeTypes)return e.cached.tableNodeTypes;let t={};return Object.keys(e.nodes).forEach(n=>{let r=e.nodes[n];r.spec.tableRole&&(t[r.spec.tableRole]=r)}),e.cached.tableNodeTypes=t,t}function VL(e,t,n,r,i){let a=BL(e),o=[],s=[];for(let e=0;e<n;e+=1){let e=zL(a.cell,i);if(e&&s.push(e),r){let e=zL(a.header_cell,i);e&&o.push(e)}}let c=[];for(let e=0;e<t;e+=1)c.push(a.row.createChecked(null,r&&e===0?o:s));return a.table.createChecked(null,c)}function HL(e){return e instanceof xI}var UL=({editor:e})=>{let{selection:t}=e.state;if(!HL(t))return!1;let n=0;return GT(t.ranges[0].$from,e=>e.type.name===`table`)?.node.descendants(e=>{if(e.type.name===`table`)return!1;[`tableCell`,`tableHeader`].includes(e.type.name)&&(n+=1)}),n===t.ranges.length?(e.commands.deleteTable(),!0):!1};function WL(e,t){let n=e.mapping.map(t);if(GT(e.selection.$from,e=>e.type.name===`table`)?.pos===n)return;let r=e.doc.nodeAt(n);if(!r)return;let i=n+r.nodeSize-1;e.setSelection(Iv.near(e.doc.resolve(i),-1))}function GL(e){let t=``,n=0;for(;n<e.length;){if(e[n]===`\\`&&n+1<e.length){t+=e[n]+e[n+1],n+=2;continue}if(e[n]!=="`"){t+=e[n++];continue}let r=0;for(;n+r<e.length&&e[n+r]==="`";)r+=1;let i=n+r,a=!1;for(;i<e.length;){if(e[i]!=="`"){i+=1;continue}let o=0;for(;i+o<e.length&&e[i+o]==="`";)o+=1;if(o===r){let o=e.slice(n+r,i);t+=e.slice(n,n+r)+o.replace(/\\\||\|/g,e=>e===`|`?`\\|`:e)+e.slice(i,i+r),n=i+r,a=!0;break}i+=o}a||(t+=e.slice(n,n+r),n+=r)}return t}function KL(e){return e.split(`
|
|
277
|
+
`).map(e=>!e.includes(`|`)||!e.includes("`")?e:GL(e)).join(`
|
|
278
|
+
`)}function qL(e){return(e||``).replace(/\s+/g,` `).trim()}function JL(e,t,n={}){let r=n.cellLineSeparator??``;if(!e||!e.content||e.content.length===0)return``;let i=[];e.content.forEach(e=>{let n=[];e.content&&e.content.forEach(e=>{let i=``;i=e.content&&Array.isArray(e.content)&&e.content.length>1?e.content.map(e=>t.renderChildren(e)).join(r):e.content?t.renderChildren(e.content):``;let a=qL(i.split(r).join(`
|
|
279
|
+
`).replace(/[ \t]*\r?\n[ \t]*/g,`<br>`)),o=e.type===`tableHeader`,s=TL(e.attrs);n.push({text:a,isHeader:o,align:s})}),i.push(n)});let a=i.reduce((e,t)=>Math.max(e,t.length),0);if(a===0)return``;let o=Array.from({length:a}).fill(0);i.forEach(e=>{for(let t=0;t<a;t+=1){let n=(e[t]?.text||``).length;n>o[t]&&(o[t]=n),o[t]<3&&(o[t]=3)}});let s=(e,t)=>e+` `.repeat(Math.max(0,t-e.length)),c=i[0],l=c.some(e=>e.isHeader),u=Array.from({length:a}).fill(null);i.forEach(e=>{for(let t=0;t<a;t+=1)!u[t]&&e[t]?.align&&(u[t]=e[t].align)});let d=`
|
|
280
|
+
`,f=Array.from({length:a}).map((e,t)=>l&&c[t]&&c[t].text||``);return d+=`| ${f.map((e,t)=>s(e,o[t])).join(` | `)} |\n`,d+=`| ${o.map((e,t)=>{let n=Math.max(3,e),r=u[t];return r===`left`?`:${`-`.repeat(n)}`:r===`right`?`${`-`.repeat(n)}:`:r===`center`?`:${`-`.repeat(n)}:`:`-`.repeat(n)}).join(` | `)} |\n`,(l?i.slice(1):i).forEach(e=>{d+=`| ${Array.from({length:a}).fill(0).map((t,n)=>s(e[n]&&e[n].text||``,o[n])).join(` | `)} |\n`}),d}var YL=wO.create({name:`table`,addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:LL,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:`tableRow+`,tableRole:`table`,isolating:!0,group:`block`,parseHTML(){return[{tag:`table`}]},renderHTML({node:e,HTMLAttributes:t}){let{colgroup:n,tableWidth:r,tableMinWidth:i}=RL(e,this.options.cellMinWidth),a=t.style;function o(){return a||(r?`width: ${r}`:`min-width: ${i}`)}let s=[`table`,nE(this.options.HTMLAttributes,t,{style:o()}),n,[`tbody`,0]];return this.options.renderWrapper?[`div`,{class:`tableWrapper`},s]:s},parseMarkdown:(e,t)=>{let n=[],r=Array.isArray(e.align)?e.align:[];if(e.header){let i=[];e.header.forEach((e,n)=>{let a=CL(r[n]??e.align),o=a?{align:a}:{};i.push(t.createNode(`tableHeader`,o,[{type:`paragraph`,content:t.parseInline(e.tokens)}]))}),n.push(t.createNode(`tableRow`,{},i))}return e.rows&&e.rows.forEach(e=>{let i=[];e.forEach((e,n)=>{let a=CL(r[n]??e.align),o=a?{align:a}:{};i.push(t.createNode(`tableCell`,o,[{type:`paragraph`,content:t.parseInline(e.tokens)}]))}),n.push(t.createNode(`tableRow`,{},i))}),t.createNode(`table`,void 0,n)},renderMarkdown:(e,t)=>JL(e,t),markdownTokenizer:{name:`table`,level:`block`,start:e=>{let t=e.split(`
|
|
281
281
|
`);if(t.length<2)return-1;let n=t[1];return!/^[ \t|:]*-[ \t|:-]*$/.test(n)||!n.includes(`|`)?-1:t[0].includes(`|`)?0:-1},tokenize(e,t,n){let r=e.indexOf(`
|
|
282
282
|
|
|
283
283
|
`),i=r>=0?e.slice(0,r):e,a=i.split(`
|
|
284
|
-
`);if(a.length<2)return;let o=a[1];if(!/^[ \t|:]*-[ \t|:-]*$/.test(o)||!o.includes(`|`))return;let s=
|
|
284
|
+
`);if(a.length<2)return;let o=a[1];if(!/^[ \t|:]*-[ \t|:-]*$/.test(o)||!o.includes(`|`))return;let s=KL(i);if(s===i)return;let c=n.blockTokens(s)[0];if(c?.type!==`table`||!c.raw)return;let l=c.raw.split(`
|
|
285
285
|
`).length,u=e.split(`
|
|
286
286
|
`).slice(0,l).join(`
|
|
287
|
-
`);return{...c,raw:u}}},addCommands(){return{insertTable:({rows:e=3,cols:t=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:a})=>{let o=
|
|
287
|
+
`);return{...c,raw:u}}},addCommands(){return{insertTable:({rows:e=3,cols:t=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:a})=>{let o=VL(a.schema,e,t,n);if(i){let e=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(Iv.near(r.doc.resolve(e)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>xee(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>See(e,t),deleteColumn:()=>({state:e,dispatch:t})=>{let n=GT(e.selection.$from,e=>e.type.name===`table`);return wee(e,t&&(e=>{n&&WL(e,n.pos),t(e)}))},addRowBefore:()=>({state:e,dispatch:t})=>Eee(e,t),addRowAfter:()=>({state:e,dispatch:t})=>Dee(e,t),deleteRow:()=>({state:e,dispatch:t})=>{let n=GT(e.selection.$from,e=>e.type.name===`table`);return kee(e,t&&(e=>{n&&WL(e,n.pos),t(e)}))},deleteTable:()=>({state:e,dispatch:t})=>zI(e,t),mergeCells:()=>({state:e,dispatch:t})=>MI(e,t),splitCell:()=>({state:e,dispatch:t})=>NI(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>FI(`column`)(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>FI(`row`)(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>II(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>MI(e,t)?!0:NI(e,t),setCellAttribute:(e,t)=>({state:n,dispatch:r})=>Mee(e,t)(n,r),goToNextCell:()=>({state:e,dispatch:t})=>RI(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>RI(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t&&DI(e),!0),setCellSelection:e=>({tr:t,dispatch:n})=>{if(n){let n=xI.create(t.doc,e.anchorCell,e.headCell);t.setSelection(n)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:UL,"Mod-Backspace":UL,Delete:UL,"Mod-Delete":UL}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[cL({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],SL({allowTableNodeSelection:this.options.allowTableNodeSelection})]},addNodeView(){let e=this.options.resizable&&this.editor.isEditable,t=this.options.View;return e||!t?null:({node:e,view:n,HTMLAttributes:r})=>{let i=nE(this.options.HTMLAttributes,r);return new t(e,this.options.cellMinWidth,n,i)}},extendNodeSchema(e){return{tableRole:XT(W(e,`tableRole`,{name:e.name,options:e.options,storage:e.storage}))}}});tO.create({name:`tableKit`,addExtensions(){let e=[];return this.options.table!==!1&&e.push(YL.configure(this.options.table)),this.options.tableCell!==!1&&e.push(ML.configure(this.options.tableCell)),this.options.tableHeader!==!1&&e.push(NL.configure(this.options.tableHeader)),this.options.tableRow!==!1&&e.push(PL.configure(this.options.tableRow)),e}});var XL=(e,t)=>{let n=t?.border!=null&&t.border!==``?t.border:`1`;e.setAttribute(`border`,n),e.style.setProperty(`color`,`var(--pie-text, black)`),e.style.setProperty(`background-color`,`var(--pie-background, rgba(255, 255, 255))`)},ZL=class extends LL{constructor(e,t,n){super(e,t,n),XL(this.table,e.attrs)}update(e){let t=super.update(e);return t&&XL(this.table,e.attrs),t}},QL=YL.extend({addOptions(){return{...this.parent?.(),resizable:!0,handleWidth:0,View:ZL}},addAttributes(){return{border:{default:`1`}}},renderHTML(e){let t=this.parent(e),{border:n}=e.HTMLAttributes,r=`${t[1].style}${t[1].style.match(/.*; */)?``:`;`}`;return t[1].style=`${r}
|
|
288
288
|
color: var(--pie-text, black);
|
|
289
|
-
background-color: var(--pie-background, rgba(255, 255, 255))`,t[1].border=n||`1`,t}}),tR=`(div | paragraph | heading | bulletList | orderedList | blockquote | codeBlock | horizontalRule | image | imageUploadNode)+`,nR=PL.extend({content:tR}),rR=FL.extend({content:tR}),iR=wO.create({name:`div`,group:`block`,content:`inline*`,parseHTML(){return[{tag:`div`}]},renderHTML({HTMLAttributes:e}){return[`div`,e,0]},addKeyboardShortcuts(){let e=e=>{for(let t=e.depth;t>=0;--t)if(e.node(t).type.name===`listItem`)return!0;return!1};return{Enter:()=>{let{state:t}=this.editor,{$from:n}=t.selection;return n.parent.type.name!==`div`||e(n)?!1:this.editor.chain().focus().setNode(`paragraph`).splitBlock().run()},Backspace:()=>{let{state:e}=this.editor,{$from:t,empty:n}=e.selection;if(t.parent.type.name!==`div`||!n)return!1;let r=t.parent.textContent;if(r.length===0)return e.doc.childCount===1;if(r.length===1&&t.parentOffset===1){let{tr:n}=e;return n.delete(t.pos-1,t.pos),this.editor.view.dispatch(n),!0}return!1}}}}),aR=tO.create({name:`ensureEmptyRootIsDiv`,addProseMirrorPlugins(){return[new ey({key:new ry(this.name),appendTransaction(e,t,n){if(!e.some(e=>e.docChanged))return null;let{doc:r}=n;if(r.childCount!==1)return null;let i=r.firstChild;if(i.type.name!==`paragraph`||i.content.size>0)return null;let a=n.schema.nodes.div;if(!a)return null;let o=i.nodeSize;return n.tr.replaceWith(0,o,a.create())}})]}}),oR=tO.create({name:`ensureListItemContentIsDiv`,addProseMirrorPlugins(){return[new ey({key:new ry(this.name),appendTransaction(e,t,n){if(!e.some(e=>e.docChanged))return null;let{doc:r,schema:i}=n,a=i.nodes.div;if(!a)return null;let o=[];if(r.descendants((e,t)=>{if(e.type.name!==`listItem`)return;let n=1;e.forEach(e=>{e.type.name===`paragraph`&&o.push({pos:t+n,attrs:e.attrs}),n+=e.nodeSize})}),o.length===0)return null;let s=n.tr;return o.sort((e,t)=>t.pos-e.pos).forEach(({pos:e,attrs:t})=>s.setNodeMarkup(e,a,t)),s}})]}});function sR(e){return Br(`MuiIconButton`,e)}var cR=Vr(`MuiIconButton`,[`root`,`disabled`,`colorInherit`,`colorPrimary`,`colorSecondary`,`colorError`,`colorInfo`,`colorSuccess`,`colorWarning`,`edgeStart`,`edgeEnd`,`sizeSmall`,`sizeMedium`,`sizeLarge`,`loading`,`loadingIndicator`,`loadingWrapper`]),lR=e=>{let{classes:t,disabled:n,color:r,edge:i,size:a,loading:o}=e;return ca({root:[`root`,o&&`loading`,n&&`disabled`,r!=="default"&&`color${B(r)}`,i&&`edge${B(i)}`,`size${B(a)}`],loadingIndicator:[`loadingIndicator`],loadingWrapper:[`loadingWrapper`]},sR,t)},uR=R(Ld,{name:`MuiIconButton`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.loading&&t.loading,n.color!=="default"&&t[`color${B(n.color)}`],n.edge&&t[`edge${B(n.edge)}`],t[`size${B(n.size)}`]]}})(Nc(({theme:e})=>({textAlign:`center`,flex:`0 0 auto`,fontSize:e.typography.pxToRem(24),padding:8,borderRadius:`50%`,color:(e.vars||e).palette.action.active,transition:e.transitions.create(`background-color`,{duration:e.transitions.duration.shortest}),variants:[{props:e=>!e.disableRipple,style:{"--IconButton-hoverBg":e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity),"&:hover":{backgroundColor:`var(--IconButton-hoverBg)`,"@media (hover: none)":{backgroundColor:`transparent`}}}},{props:{edge:`start`},style:{marginLeft:-12}},{props:{edge:`start`,size:`small`},style:{marginLeft:-3}},{props:{edge:`end`},style:{marginRight:-12}},{props:{edge:`end`,size:`small`},style:{marginRight:-3}}]})),Nc(({theme:e})=>({variants:[{props:{color:`inherit`},style:{color:`inherit`}},...Object.entries(e.palette).filter(Vd()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main}})),...Object.entries(e.palette).filter(Vd()).map(([t])=>({props:{color:t},style:{"--IconButton-hoverBg":e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)}})),{props:{size:`small`},style:{padding:5,fontSize:e.typography.pxToRem(18)}},{props:{size:`large`},style:{padding:12,fontSize:e.typography.pxToRem(28)}}],[`&.${cR.disabled}`]:{backgroundColor:`transparent`,color:(e.vars||e).palette.action.disabled},[`&.${cR.loading}`]:{color:`transparent`}}))),dR=R(`span`,{name:`MuiIconButton`,slot:`LoadingIndicator`})(({theme:e})=>({display:`none`,position:`absolute`,visibility:`visible`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,color:(e.vars||e).palette.action.disabled,variants:[{props:{loading:!0},style:{display:`flex`}}]})),fR=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiIconButton`}),{edge:r=!1,children:i,className:a,color:o=`default`,disabled:s=!1,disableFocusRipple:c=!1,size:l=`medium`,id:u,loading:d=null,loadingIndicator:f,...p}=n,m=_l(u),h=f??(0,F.jsx)($d,{"aria-labelledby":m,color:`inherit`,size:16}),g={...n,edge:r,color:o,disabled:s,disableFocusRipple:c,loading:d,loadingIndicator:h,size:l},_=lR(g);return(0,F.jsxs)(uR,{id:d?m:u,className:I(_.root,a),centerRipple:!0,focusRipple:!c,disabled:s||d,ref:t,...p,ownerState:g,children:[typeof d==`boolean`&&(0,F.jsx)(`span`,{className:_.loadingWrapper,style:{display:`contents`},children:(0,F.jsx)(dR,{className:_.loadingIndicator,ownerState:g,children:d&&h})}),i]})}),pR=ml((0,F.jsx)(`path`,{d:`M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z`}),`Delete`),mR=`pie-toolbar`,hR=ml((0,F.jsx)(`path`,{d:`M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z`}),`Check`),gR=R(fR)({verticalAlign:`top`,width:`28px`,height:`28px`,color:`var(--editable-html-toolbar-check, #00bb00)`,padding:`4px`}),_R=({onClick:e,doneButtonRef:t})=>(0,F.jsx)(gR,{"aria-label":`Done`,buttonRef:t,onClick:e,children:(0,F.jsx)(hR,{})});_R.propTypes={onClick:v.func,doneButtonRef:v.func};var vR=_R,yR=R(`div`,{shouldForwardProp:e=>![`showDone`,`toolbarAlignment`,`isFocused`,`autoWidth`,`isHidden`].includes(e)})(({showDone:e,toolbarAlignment:t,isFocused:n,autoWidth:r,isHidden:i})=>({position:`absolute`,zIndex:10,cursor:`pointer`,justifyContent:`space-between`,background:`var(--editable-html-toolbar-bg, #efefef)`,minWidth:e?`280px`:`265px`,margin:`5px 0 0 0`,padding:`2px`,boxShadow:`0px 1px 5px 0px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 3px 1px -2px rgba(0, 0, 0, 0.12)`,boxSizing:`border-box`,display:`flex`,opacity:1,...t===`right`&&{right:0},...r?{width:`auto`}:{width:`100%`},...i&&{visibility:`hidden`}})),bR=R(fR)({width:`28px`,height:`28px`,padding:`4px`,verticalAlign:`top`}),xR=R(`div`)({display:`flex`});function SR(e){let{children:t,deletable:n,toolbarOpts:r,autoWidth:i,isFocused:a,doneButtonRef:o,onDelete:s,showDone:c,onDone:l,style:u}=e,d=r.minWidth===void 0?{}:{minWidth:r.minWidth};return(0,F.jsxs)(yR,{className:mR,showDone:c,toolbarAlignment:r.alignment,isFocused:r.alwaysVisible||a,autoWidth:i,isHidden:r.isHidden===!0,style:{...d,...u},children:[t,(0,F.jsxs)(xR,{children:[n&&(0,F.jsx)(bR,{"aria-label":`Delete`,onMouseDown:e=>s?.(e),children:(0,F.jsx)(pR,{})}),c&&(0,F.jsx)(vR,{doneButtonRef:o,onClick:l})]})]})}var CR=`toolbarOpenedChanged`,wR=(e,t)=>{let n=!!t;e._toolbarOpened!==n&&(e._toolbarOpened=n,e?.view&&e?.state?.tr&&e.view.dispatch(e.state.tr.setMeta(CR,!0)))},TR=e=>{let{editor:t,node:n,getPos:r,options:i,selected:a}=e,{attrs:o}=n,{value:s}=o,{respAreaToolbar:c,error:l}=i,u=r(),[d,f]=(0,P.useState)(!1),p=c([n,u],t,()=>{}),m=(0,P.useRef)(null),h;if(l){let e=l(),t=parseInt(o.index,10);h=!!e?.[t]?.[0]}return(0,P.useEffect)(()=>{let{selection:e}=t.state,r=e.from+n.nodeSize===e.to;a?r&&f(a):f(a)},[t,n,a]),(0,P.useEffect)(()=>{let e=e=>{!(e.target.closest(`.insert-character-dialog`)||e.target.closest(`[data-toolbar-for]`))&&m.current&&!m.current.contains(e.target)&&!e.target.closest(`[data-inline-node]`)&&f(!1)};return d?document.addEventListener(`mousedown`,e):document.removeEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[d]),(0,F.jsxs)(Wk,{className:`drag-in-the-blank`,"data-selected":a,style:{display:`inline-flex`,minHeight:`55px`,position:`relative`,cursor:`pointer`},children:[(0,F.jsx)(`div`,{...o,style:{display:`inline-flex`,width:`100%`,minHeight:`46px`,height:`46px`,backgroundColor:`#FFF`,border:`1px solid ${h?`red`:`#C0C3CF`}`,boxSizing:`border-box`,borderRadius:`4px`,overflow:`hidden`,padding:`12px 21px`,margin:`0 4px`,minWidth:`178px`,visibility:d?`hidden`:`visible`},onClick:()=>f(!0),dangerouslySetInnerHTML:{__html:s||`<div> </div>`}}),d&&(0,F.jsxs)(P.Fragment,{children:[(0,F.jsx)(`div`,{ref:m,className:`absolute z-50 bg-white shadow-lg rounded p-2`,style:{zIndex:1},children:(0,F.jsx)(p,{})}),t._tiptapContainerEl&&Ms.createPortal((0,F.jsx)(SR,{deletable:!0,toolbarOpts:{minWidth:`auto`},autoWidth:!0,style:{top:-40,left:0,right:0},onDelete:()=>{let{tr:e}=t.state;e.delete(u,u+n.nodeSize),wR(t,!1),t.view.dispatch(e),f(!1),t.commands.focus()},showDone:!1}),t._tiptapContainerEl)]})]})};TR.propTypes={attributes:v.object,error:v.any,value:v.string,isFocused:v.bool};var ER=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function DR(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function OR(e){return`nodeType`in e}function kR(e){return e?DR(e)?e:OR(e)?e.ownerDocument?.defaultView??window:window:window}function AR(e){let{Document:t}=kR(e);return e instanceof t}function jR(e){return!DR(e)&&e instanceof kR(e).HTMLElement}function MR(e){return e instanceof kR(e).SVGElement}function NR(e){return e?DR(e)?e.document:OR(e)?AR(e)?e:jR(e)||MR(e)?e.ownerDocument:document:document:document}var PR=ER?P.useLayoutEffect:P.useEffect;function FR(e){let t=(0,P.useRef)(e);return PR(()=>{t.current=e}),(0,P.useCallback)(function(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return t.current==null?void 0:t.current(...n)},[])}function IR(e,t){t===void 0&&(t=[e]);let n=(0,P.useRef)(e);return PR(()=>{n.current!==e&&(n.current=e)},t),n}function LR(e){let t=FR(e),n=(0,P.useRef)(null);return[n,(0,P.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}var RR={};function zR(e,t){return(0,P.useMemo)(()=>{if(t)return t;let n=RR[e]==null?0:RR[e]+1;return RR[e]=n,e+`-`+n},[e,t])}function BR(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var VR=BR(1),HR=BR(-1);function UR(e){return`clientX`in e&&`clientY`in e}function WR(e){if(!e)return!1;let{KeyboardEvent:t}=kR(e.target);return t&&e instanceof t}function GR(e){if(!e)return!1;let{TouchEvent:t}=kR(e.target);return t&&e instanceof t}function KR(e){if(GR(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return UR(e)?{x:e.clientX,y:e.clientY}:null}var qR;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(qR||={});function JR(){}var YR=Object.freeze({x:0,y:0});function XR(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function ZR(e,t,n){let r=XR(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var QR={ignoreTransform:!1};function $R(e,t){t===void 0&&(t=QR);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=kR(e).getComputedStyle(e);t&&(n=ZR(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function ez(e,t){return t===void 0&&(t=kR(e).getComputedStyle(e)),t.position===`fixed`}function tz(e,t){t===void 0&&(t=kR(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`&&n.test(r)})}function nz(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(AR(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!jR(i)||MR(i)||n.includes(i))return n;let a=kR(e).getComputedStyle(i);return i!==e&&tz(i,a)&&n.push(i),ez(i,a)?n:r(i.parentNode)}return e?r(e):n}function rz(e){let[t]=nz(e,1);return t??null}var iz;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(iz||={});function az(e){return!ER||!e?!1:e===document.scrollingElement}function oz(e){let t={x:0,y:0},n=az(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}function sz(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function cz(e,t){if(t===void 0&&(t=$R),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);rz(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var lz=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function uz(e){let{EventTarget:t}=kR(e);return e instanceof t?e:NR(e)}function dz(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t&&r>t.y}var fz;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(fz||={});function pz(e){e.preventDefault()}function mz(e){e.stopPropagation()}var hz;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(hz||={});var gz={start:[hz.Space,hz.Enter],cancel:[hz.Esc],end:[hz.Space,hz.Enter,hz.Tab]},_z=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case hz.Right:return{...n,x:n.x+25};case hz.Left:return{...n,x:n.x-25};case hz.Down:return{...n,y:n.y+25};case hz.Up:return{...n,y:n.y-25}}},vz=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new lz(NR(t)),this.windowListeners=new lz(kR(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(fz.Resize,this.handleCancel),this.windowListeners.add(fz.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(fz.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&cz(n),t(YR)}handleKeyDown(e){if(WR(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=gz,coordinateGetter:a=_z,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:YR;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=HR(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=oz(n),p=sz(n),m={x:Math.min(i===hz.Right?p.right-p.width/2:p.right,Math.max(i===hz.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===hz.Down?p.bottom-p.height/2:p.bottom,Math.max(i===hz.Down?p.top:p.top+p.height/2,u.y))},h=i===hz.Right&&!s||i===hz.Left&&!c,g=i===hz.Down&&!l||i===hz.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===hz.Right&&e<=d.x||i===hz.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===hz.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===hz.Down&&e<=d.y||i===hz.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===hz.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,VR(HR(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};vz.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=gz,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function yz(e){return!!(e&&`distance`in e)}function bz(e){return!!(e&&`delay`in e)}var xz=class{constructor(e,t,n){n===void 0&&(n=uz(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=NR(i),this.documentListeners=new lz(this.document),this.listeners=new lz(n),this.windowListeners=new lz(kR(i)),this.initialCoordinates=KR(r)??YR,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(fz.Resize,this.handleCancel),this.windowListeners.add(fz.DragStart,pz),this.windowListeners.add(fz.VisibilityChange,this.handleCancel),this.windowListeners.add(fz.ContextMenu,pz),this.documentListeners.add(fz.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(bz(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(yz(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(fz.Click,mz,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(fz.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=KR(e)??YR,s=HR(n,o);if(!t&&a){if(yz(a)){if(a.tolerance!=null&&dz(s,a.tolerance))return this.handleCancel();if(dz(s,a.distance))return this.handleStart()}if(bz(a)&&dz(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===hz.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},Sz={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},Cz=class extends xz{constructor(e){let{event:t}=e,n=NR(t.target);super(e,Sz,n)}};Cz.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var wz={move:{name:`mousemove`},end:{name:`mouseup`}},Tz;(function(e){e[e.RightClick=2]=`RightClick`})(Tz||={});var Ez=class extends xz{constructor(e){super(e,wz,NR(e.event.target))}};Ez.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Tz.RightClick?!1:(r?.({event:n}),!0)}}];var Dz={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},Oz=class extends xz{constructor(e){super(e,Dz)}static setup(){return window.addEventListener(Dz.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Dz.move.name,e)};function e(){}}};Oz.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var kz;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(kz||={});var Az;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(Az||={}),iz.Backward,iz.Forward,iz.Backward,iz.Forward;var jz;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(jz||={});var Mz;(function(e){e.Optimized=`optimized`})(Mz||={});function Nz(e){let{callback:t,disabled:n}=e,r=FR(t),i=(0,P.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,P.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Pz(e,t){return(0,P.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}jz.WhileDragging,Mz.Optimized;var Fz={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:JR,draggableNodes:new Map,over:null,measureDroppableContainers:JR},Iz=(0,P.createContext)(Fz),Lz=(0,P.createContext)({...YR,scaleX:1,scaleY:1}),Rz;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(Rz||={});var zz=(0,P.createContext)(null),Bz=`button`,Vz=`Draggable`;function Hz(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=zR(Vz),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,P.useContext)(Iz),{role:p=Bz,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,P.useContext)(g?Lz:zz),[v,y]=LR(),[b,x]=LR(),S=Pz(o,t),C=IR(n);return PR(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:C}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,P.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===Bz?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}var Uz=`Droppable`,Wz={timeout:25};function Gz(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=zR(Uz),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,P.useContext)(Iz),u=(0,P.useRef)({disabled:n}),d=(0,P.useRef)(!1),f=(0,P.useRef)(null),p=(0,P.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...Wz,...i},_=IR(h??r),v=Nz({callback:(0,P.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=LR((0,P.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=IR(t);return(0,P.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,P.useEffect)(()=>(s({type:qR.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:qR.UnregisterDroppable,key:a,id:r})),[r]),(0,P.useEffect)(()=>{n!==u.current.disabled&&(s({type:qR.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}var Kz=ml((0,F.jsx)(`path`,{d:`M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z`}),`ChevronRight`),qz=ml((0,F.jsx)(`path`,{d:`M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2`}),`MoreVert`),Jz=e=>{switch(e){case`down`:return 90;case`up`:return-90;case`left`:return 180;default:return 0}},Yz=e=>{let{direction:t,style:n}=e;return(0,F.jsx)(Kz,{style:{transform:`rotate(${Jz(t)}deg)`,...n}})};Yz.propTypes={direction:v.string,style:v.object};var Xz=({style:e})=>(0,F.jsxs)(`span`,{style:e,children:[(0,F.jsx)(qz,{style:{margin:`0 -16px`}}),(0,F.jsx)(qz,{})]});Xz.propTypes={style:v.object},R(`div`)(({theme:e})=>({fontFamily:`Cerebri Sans !important`,fontSize:e.typography.fontSize,fontWeight:`bold`,lineHeight:`14px`,position:`relative`,top:`7px`,width:`110px`,height:`28px`,whiteSpace:`nowrap`}));var Zz=R(`span`)(({theme:e})=>({border:`solid 0px ${e.palette.primary.main}`,"& mjx-mn:has(~ mjx-mfrac), mjx-mfrac ~ mjx-mn":{fontSize:`120% !important`},"& mjx-frac":{fontSize:`120% !important`}}));function Qz({n:e,children:t,isDragging:n,isOver:r,dragItem:i,value:a,selected:o}){let[s,c]=(0,P.useState)(null),l=(0,P.useRef)(null),u=e=>{l.current&&(l.current.contains(e.target)?l.current.classList.add(`selected`):l.current.classList.remove(`selected`))};(0,P.useEffect)(()=>(document.addEventListener(`click`,u),()=>{document.removeEventListener(`click`,u)}),[]),(0,P.useEffect)(()=>{l.current&&typeof hd==`function`&&hd(l.current)},[a?.value,r,i?.value?.value]),(0,P.useEffect)(()=>{if(r&&l.current&&!s){let e=l.current;c({width:e.offsetWidth,height:e.offsetHeight})}else!r&&s&&c(null)},[r,s]);let d=i&&r?i.value.value:a.value||`\xA0`,f=n?`\xA0`:d,p=f!==`\xA0`,m=i&&r,h=o?`2px solid ${Zl()}`:m?`1px solid ${V.BORDER_DARK}`:`1px solid ${V.BORDER_LIGHT}`;return(0,F.jsxs)(`div`,{ref:l,className:o?`selected`:void 0,style:{display:`inline-flex`,minWidth:`178px`,minHeight:`36px`,background:m?`${V.BORDER_LIGHT}`:`${V.WHITE}`,border:h,boxSizing:`border-box`,borderRadius:`3px`,overflow:`hidden`,position:`relative`,padding:`8px 8px 8px 35px`,width:s?s.width:void 0,height:s?s.height:void 0,touchAction:`none`},"data-key":e.index,contentEditable:!1,children:[p&&(0,F.jsx)(Xz,{style:{position:`absolute`,top:`6px`,left:`15px`,color:`#9B9B9B`},contentEditable:!1}),(0,F.jsx)(`span`,{dangerouslySetInnerHTML:{__html:f}}),t]})}Qz.propTypes={n:v.object,children:v.node,isDragging:v.bool,isOver:v.bool,dragItem:v.object,value:v.object,selected:v.bool};function $z({value:e,disabled:t,instanceId:n,children:r,n:i,onChange:a,removeResponse:o,duplicates:s,pos:c,selected:l}){let{attributes:u,listeners:d,setNodeRef:f,isDragging:p}=Hz({id:`drag-${i.index}`,disabled:t||!e?.value,data:{id:`drag-${i.index}`,value:e,instanceId:n,n:i,pos:c,opts:{duplicates:s},type:`drag-in-the-blank-placed-choice`,fromChoice:!e,onRemove:e=>o(e),onDrop:(e,t)=>{t?.type===`drag-in-the-blank-drop-choice`&&(a(e),!s&&e.fromChoice&&o(e))}}}),{setNodeRef:m,isOver:h,active:g}=Gz({id:`drop-${i.index}`,data:{type:`drag-in-the-blank-drop-choice`,accepts:[`drag-in-the-blank-choice`,`drag-in-the-blank-placed-choice`],instanceId:n,value:e,id:`drop-${i.index}`,pos:c,n:i,opts:{duplicates:s},onDrop:(e,t)=>{if(t?.type===`drag-in-the-blank-drop-choice`&&e.value.id!==t.value.id){if(e.type===`drag-in-the-blank-choice`){a(e),!s&&e.fromChoice&&o(e);return}e.type===`drag-in-the-blank-placed-choice`&&(o(t),a(e),setTimeout(()=>o(e),10))}}}}),_=e=>{f(e),m(e)},v=(0,F.jsx)(Qz,{n:i,isDragging:p,isOver:h,dragItem:g?.data?.current,value:e,selected:l,children:r}),y=e?(0,F.jsx)(`span`,{ref:_,...u,...d,children:v}):(0,F.jsx)(`span`,{ref:m,children:v});return(0,F.jsx)(Zz,{className:I(h&&`over`),children:y})}$z.propTypes={value:v.object,disabled:v.bool,instanceId:v.string,children:v.node,n:v.object.isRequired,onChange:v.func.isRequired,removeResponse:v.func.isRequired,duplicates:v.bool,selected:v.bool};var eB=(e,t,n,r)=>{let{tr:i}=e.state;i.setNodeMarkup(n,void 0,{...t.attrs,...r.value}),i.isDone=!0,e.view.dispatch(i)},tB=(e,t,n)=>{let{tr:r}=e.state;r.setNodeMarkup(n.pos,void 0,Vp(t.attrs,[`value`,`id`])),r.isDone=!0,e.view.dispatch(r)},nB=e=>{let{editor:t,node:n,getPos:r,options:i,selected:a}=e,{attrs:o}=n,{inTable:s}=o,c=r();return(0,F.jsx)(Wk,{className:`drag-in-the-blank`,"data-selected":a,style:{display:`inline`,whiteSpace:`normal`},children:(0,F.jsx)(`span`,{...o,style:{display:`inline-flex`,minHeight:`50px`,minWidth:`178px`,position:`relative`,margin:s?`10px`:`0 10px`,cursor:`pointer`},children:(0,F.jsx)($z,{n:o,dragKey:o.id,targetId:`0`,pos:c,value:o,duplicates:i.duplicates,selected:a,onChange:e=>eB(t,n,c,e),removeResponse:e=>tB(t,n,e)})})})};nB.propTypes={attributes:v.object,data:v.object,n:v.object,nodeProps:v.object,opts:v.object};var rB=e=>{let{editor:t,node:n,getPos:r,options:i,selected:a}=e,{attrs:o}=n,{value:s,error:c}=o,l=s||`<div> </div>`,u=r(),d=(0,P.useRef)(null),f=(0,P.useRef)(null),p=(0,P.useRef)(!1),m=(0,P.useRef)(null),h=()=>t._holdInlineDropdownToolbarIndex!=null&&String(t._holdInlineDropdownToolbarIndex)===String(n.attrs.index),[g,_]=(0,P.useState)(!1),[v,y]=(0,P.useState)({top:0,left:0}),b=()=>{h()||(_(!1),i.onInlineDropdownToolbarClose?.(t))},x=i.respAreaToolbar([n,u],t,b),S=()=>{let{tr:e}=t.state,n=e.doc.nodeAt(u);if(!n)return;let{selection:r}=e;r.from===u&&r.to===u+n.nodeSize||(e.setSelection(Rv.create(e.doc,u)),t.view.dispatch(e))},C=()=>{p.current||(i.onToolbarCloseRequest?(p.current=!0,i.onToolbarCloseRequest([n,u],t,()=>{p.current=!1,delete t._holdInlineDropdownToolbarIndex,b()},()=>{p.current=!1,delete t._holdInlineDropdownToolbarIndex,_(!0),setTimeout(S,0)})):b())};(0,P.useEffect)(()=>{let{selection:e}=t.state,r=e.from+n.nodeSize===e.to;a?r&&_(!0):g&&C()},[t,n,a]);let w=e=>e.clientX>document.documentElement.clientWidth||e.clientY>document.documentElement.clientHeight||e.target===document.documentElement;return(0,P.useEffect)(()=>{m.current&&typeof hd==`function`&&hd(m.current)},[s]),(0,P.useEffect)(()=>{let e=document.body.getBoundingClientRect(),{from:n}=t.state.selection,r=t.view.coordsAtPos(n);y({top:r.top+Math.abs(e.top)+40,left:r.left});let i=e=>{if(w(e))return;let n=e.target.closest(`[data-toolbar-for]`);!e.target.closest(`[data-inline-dropdown-toolbar]`)&&(!n||n.dataset.toolbarFor!==f.current?.instanceId)&&!t._toolbarOpened&&d.current&&!d.current.contains(e.target)&&!e.target.closest(`[data-inline-node]`)&&C()};return g?document.addEventListener(`mousedown`,i):document.removeEventListener(`mousedown`,i),()=>document.removeEventListener(`mousedown`,i)},[g,n]),(0,F.jsxs)(Wk,{className:`inline-dropdown`,"data-selected":a,style:{display:`inline-flex`,height:`50px`,cursor:`pointer`},children:[(0,F.jsxs)(`div`,{ref:m,style:{display:`inline-flex`,minWidth:`178px`,height:`36px`,background:`#FFF`,border:`1px solid #C0C3CF`,boxSizing:`border-box`,borderRadius:`3px`,margin:`0 2px`,position:`relative`,alignItems:`center`},onClick:()=>_(!0),children:[(0,F.jsx)(`div`,{style:{flex:1,overflow:`hidden`,padding:`0 25px 0 8px`,whiteSpace:`nowrap`,textOverflow:`ellipsis`},children:(0,F.jsx)(`span`,{style:{display:`inline-block`,verticalAlign:`middle`},dangerouslySetInnerHTML:{__html:l}})}),(0,F.jsx)(Yz,{direction:`down`,style:{position:`absolute`,top:`5px`,right:`5px`}})]}),g&&(0,F.jsxs)(P.Fragment,{children:[Ms.createPortal((0,F.jsx)(`div`,{ref:d,children:(0,F.jsx)(x,{editorCallback:e=>{f.current=e}})}),t?._tiptapContainerEl||document.body),t._tiptapContainerEl&&Ms.createPortal((0,F.jsx)(SR,{deletable:!0,toolbarOpts:{minWidth:`auto`},autoWidth:!0,style:{top:-40,left:0,right:0},onDelete:()=>{let{tr:e}=t.state;e.delete(u,u+n.nodeSize),wR(t,!1),delete t._holdInlineDropdownToolbarIndex,t.view.dispatch(e),_(!1),t.commands.focus()},showDone:!1}),t._tiptapContainerEl)]})]})};rB.propTypes={attributes:v.object,selectedItem:v.oneOfType([v.string,v.object])};var iB=s({greaterThan:()=>sB,greaterThanEqual:()=>lB,lessThan:()=>oB,lessThanEqual:()=>cB}),aB=e=>({...e,category:`comparison`}),oB=aB({name:`Less than`,latex:`<`,command:`\\lt`}),sB=aB({name:`Greater than`,latex:`>`,command:`\\gt`}),cB=aB({name:`Less than or equal`,latex:`\\le`,symbol:`<=`,command:`\\le`,ariaLabel:`less than or equal to`}),lB=aB({name:`Greater than or equal`,symbol:`>=`,command:`\\ge`,latex:`\\ge`}),uB=e=>t=>({...t,category:e}),dB=(e=[])=>{let t=[];Up(5,()=>t.push([]));let n=e.length,r=0,i=0;for(;i<n;)t[r++].push(e[i++]),r===5&&(r=0);return t},fB=e=>t=>{let n=Fp(e),r=n.some(e=>e.latex===t.latex),i=n.some(e=>e.name===t.name);return!r&&!i},pB=(e=[],t=[])=>{t=t.filter(fB(e));let n=[];Up(5-e.length,()=>e.push([])),Up(5,()=>n.push([]));let r=dB(t);for(let t=0;t<5;t++)n[t]=[...e[t],...r[t]];return n},mB=s({theta:()=>vB,x:()=>gB,y:()=>_B}),hB=uB(`vars`),gB=hB({name:`X`,latex:`x`,write:`x`}),_B=hB({name:`Y`,latex:`y`,write:`y`}),vB=hB({name:`Theta`,latex:`\\theta`,write:`\\theta`}),yB=s({blankOverBlank:()=>xB,xBlankBlank:()=>CB,xOverBlank:()=>SB}),bB=uB(`fractions`),xB=bB({name:`blank/blank`,latex:`\\frac{}{}`,command:`\\frac`,ariaLabel:`fraction`}),SB=bB({latex:`\\frac{x}{ }`,name:`X/blank`,label:`x/[]`,command:`/`,ariaLabel:`x over blank fraction`}),CB=bB({name:`X (blank/blank)`,latex:`x\\frac{}{}`,label:`x([]/[])`,command:`\\frac`,ariaLabel:`mixed number`}),wB=s({nthRoot:()=>kB,squareRoot:()=>OB,squared:()=>EB,xToPowerOfN:()=>DB}),TB=uB(`exponent`),EB=TB({name:`Squared`,latex:`x^2`,write:`^2`}),DB=TB({name:`X to the power of n`,latex:`x^{}`,command:`^`,ariaLabel:`exponent`}),OB=TB({name:`Square root`,latex:`\\sqrt{}`,command:`\\sqrt`}),kB=TB({name:`Nth root`,latex:`\\sqrt[{}]{}`,command:`\\nthroot`}),AB=s({absValue:()=>NB,approx:()=>LB,brackets:()=>FB,nApprox:()=>RB,notEqual:()=>zB,notSimilar:()=>VB,parenthesis:()=>PB,percentage:()=>IB,plusMinus:()=>MB,similar:()=>BB}),jB=uB(`misc`),MB=jB({name:`Plus or Minus`,latex:`\\pm`,write:`\\pm`}),NB=jB({name:`Absolute Value`,latex:`\\abs{}`,symbol:`| |`,command:`|`}),PB=jB({name:`Parenthesis`,latex:`\\left(\\right)`,symbol:`( )`,command:`(`}),FB=jB({name:`Brackets`,latex:`\\left[\\right]`,symbol:`[ ]`,command:`[`}),IB=jB({name:`Percent`,latex:`%`,command:`%`}),LB=jB({latex:`\\approx`,command:`\\approx`,ariaLabel:`Approximately equal to`}),RB=jB({latex:`\\napprox`,command:`\\napprox`,ariaLabel:`Not pproximately equal to`}),zB=jB({latex:`\\neq`,command:`\\neq`,ariaLabel:`Not equals`}),BB=jB({latex:`\\sim`,command:`\\sim`,ariaLabel:`Similar`}),VB=jB({latex:`\\nsim`,command:`\\nsim`,ariaLabel:`Not similar`}),HB=s({eulers:()=>GB,halfInfinity:()=>qB,infinity:()=>KB,pi:()=>WB}),UB=uB(`constants`),WB=UB({name:`Pi`,label:`π`,latex:`\\pi`,command:`\\pi`,category:`constants`}),GB=UB({name:`Eulers`,label:`e`,latex:`e`,command:`e`,category:`constants`}),KB=UB({name:`Infinity`,label:`\\infty`,latex:`\\infty`,command:`\\infty`,category:`constants`}),qB=UB({name:`Half Infinity`,label:`\\propto`,latex:`\\propto`,command:`\\propto`,category:`constants`}),JB=s({cos:()=>ZB,cot:()=>tV,csc:()=>eV,sec:()=>$B,sin:()=>XB,tan:()=>QB}),YB=uB(`trigonometry`),XB=YB({name:`sine`,label:`sin`,command:`\\sin`,latex:`\\sin`}),ZB=YB({name:`cosine`,label:`cos`,command:`\\cos`,latex:`\\cos`}),QB=YB({name:`tanget`,label:`tan`,command:`\\tan`,latex:`\\tan`}),$B=YB({name:`secant`,label:`sec`,command:`\\sec`,latex:`\\sec`}),eV=YB({name:`cosecant`,label:`csc`,command:`\\csc`,latex:`\\csc`}),tV=YB({name:`cotangent`,label:`cot`,command:`\\cot`,latex:`\\cot`}),nV=s({angle:()=>dV,circledDot:()=>_V,congruentTo:()=>bV,degree:()=>vV,doublePrimeArcSecond:()=>CV,leftArrow:()=>wV,leftrightArrow:()=>EV,measureOfAngle:()=>pV,notCongruentTo:()=>xV,notParallel:()=>lV,overArc:()=>fV,overLeftRightArrow:()=>oV,overRightArrow:()=>aV,overline:()=>iV,parallel:()=>cV,parallelogram:()=>gV,perpindicular:()=>uV,primeArcminute:()=>SV,rightArrow:()=>TV,segment:()=>sV,similarTo:()=>yV,square:()=>hV,triangle:()=>mV}),rV=e=>({...e,category:`geometry`}),iV=rV({name:`Line`,latex:`\\overline{}`,command:`\\overline`}),aV=rV({name:`Ray`,latex:`\\overrightarrow{}`,command:`\\overrightarrow`}),oV=rV({name:`Segment`,latex:`\\overleftrightarrow{\\overline{}}`,symbol:`AB`,command:`\\overleftrightarrow`}),sV=rV({name:`Segment`,latex:`\\overleftrightarrow{AB}`,write:`\\overleftrightarrow{AB}`,label:`AB`}),cV=rV({name:`Parallel`,latex:`\\parallel`,command:`\\parallel`}),lV=rV({name:`Not Parallel`,latex:`\\nparallel`,command:`\\nparallel`}),uV=rV({name:`Perpendicular`,latex:`\\perp`,command:`\\perpendicular`}),dV=rV({name:`Angle`,latex:`\\angle`,command:`\\angle`}),fV=rV({name:`Over arc`,latex:`\\overarc{\\overline{}}`,command:`\\overarc`}),pV=rV({name:`Measured Angle`,latex:`\\measuredangle`,command:[`m`,`\\angle`]}),mV=rV({name:`Triangle`,latex:`\\triangle`,command:`\\triangle`}),hV=rV({name:`Square`,latex:`\\square`,command:`\\square`}),gV=rV({name:`Parallelogram`,latex:`\\parallelogram`,command:`\\parallelogram`}),_V=rV({name:`Circled Dot`,latex:`\\odot`,command:`\\odot`}),vV=rV({name:`Degree`,latex:`\\degree`,command:`\\degree`}),yV=rV({name:`Similar`,command:`\\sim`,latex:`\\sim`}),bV=rV({name:`Congruent To`,command:`\\cong`,latex:`\\cong`}),xV=rV({name:`Not Congruent To`,command:`\\ncong`,latex:`\\ncong`}),SV=rV({name:`Prime`,label:`pam`,latex:`'`,write:`'`}),CV=rV({name:`Double Prime`,latex:`''`,write:`''`}),wV=rV({name:`Left Arrow`,latex:`\\leftarrow`,command:`\\leftarrow`}),TV=rV({name:`Right Arrow`,latex:`\\rightarrow`,command:`\\rightarrow`}),EV=rV({name:`Left and Right Arrow`,latex:`\\leftrightarrow`,command:`\\leftrightarrow`}),DV=s({circleDot:()=>OV}),OV=uB(`operators`)({name:`CircleDot`,label:`⋅`,write:`\\cdot`,ariaLabel:`Dot multiplier`}),kV=s({ln:()=>NV,log:()=>jV,logSubscript:()=>MV}),AV=uB(`log`),jV=AV({name:`Log`,label:`log`,command:`\\log`,latex:`\\log`}),MV=AV({name:`log base n`,label:`log s`,latex:`\\log_{}`,command:[`\\log`,`_`]}),NV=AV({name:`natural log`,label:`ln`,command:`\\ln`,latex:`\\ln`}),PV=s({subscript:()=>LV,superscript:()=>IV}),FV=uB(`sub-sup`),IV=FV({name:`Superscript`,latex:`x^{}`,command:`^`}),LV=FV({name:`Subscript`,latex:`x_{}`,command:`_`}),RV=s({mu:()=>HV,sigma:()=>UV,smallSigma:()=>WV,xBar:()=>BV,yBar:()=>VV}),zV=uB(`statistics`),BV=zV({name:`X Bar`,label:`x̄`,latex:`\\overline{x}`,write:`\\overline{x}`}),VV=zV({name:`Y Bar`,latex:`\\overline{y}`,write:`\\overline{y}`}),HV=zV({name:`mu`,label:`mu`,latex:`\\mu`,write:`\\mu`}),UV=zV({name:`Sigma`,ariaLabel:`Uppercase Sigma`,label:`\\Sigma`,latex:`\\Sigma`,write:`\\Sigma`}),WV=zV({name:`sigma`,ariaLabel:`Lowercase Sigma`,label:`\\sigma`,latex:`\\sigma`,write:`\\sigma`}),GV=s({divide:()=>XV,equals:()=>qV,minus:()=>YV,multiply:()=>ZV,plus:()=>JV}),KV=uB(`operators`),qV=KV({write:`=`,label:`=`}),JV=KV({write:`+`,label:`+`}),YV=KV({write:`−`,label:`−`}),XV=KV({name:`divide`,label:`÷`,command:`\\divide`,otherNotation:`\\div`}),ZV=KV({name:`multiply`,label:`×`,command:`\\times`}),QV=s({doubleCellMatrix:()=>tH,singleCellMatrix:()=>eH}),$V=uB(`matrices`),eH=$V({name:`Single Cell Matrix`,label:`[ ]`,write:`\\begin{pmatrix}\\end{pmatrix}`}),tH=$V({name:`Double Cell Matrix`,label:`[ ] [ ] \\\\newline [ ] [ ]`,write:`\\begin{bmatrix}&\\\\&\\end{bmatrix}`}),nH={0:`zero`,1:`one`,2:`two`,3:`three`,4:`four`,5:`five`,6:`six`,7:`seven`,8:`eight`,9:`nine`},rH=Up(10,String).map(e=>({name:nH[e],write:e,label:e,category:`digit`})).reduce((e,t)=>(e[t.name]=t,e),{comma:{name:`comma`,label:`,`,write:`,`,category:`digit`},decimalPoint:{name:`decimal-point`,label:`.`,write:`.`,category:`digit`}}),iH=uB(`logic`),aH=iH({name:`Therefore`,label:`∴`,write:`∴`}),oH=iH({name:`Long division`,latex:`\\longdiv{}`,command:`\\longdiv`}),sH=uB(`navigation`),cH=sH({label:`◀`,keystroke:`Left`,ariaLabel:`Move cursor left`}),lH=sH({label:`▶`,keystroke:`Right`,ariaLabel:`Move cursor right`}),uH={label:`⌫`,category:`edit`,keystroke:`Backspace`,ariaLabel:`Delete`},dH=[[xB,IB,gB,EB,OB],[OV,_B,LV,DB,kB],[MB,oB,sB,cB,lB],[WB,vB,PB,FB,NB],[zB,XB,ZB,QB,vV]],fH=(()=>{let e=[...dH.map(e=>[...e])];return e[0].push({name:`i`,latex:`i`,write:`i`}),e[1].push(jV),e[2].push(MV),e[3].push(NV),e[4].push(GB),e})(),pH=(()=>{let e=[...dH.map(e=>[...e])];return e[0].push(HV),e[1].push(BV),e[2].push(VV),e[3].push(UV),e[4].push(WV),e})(),mH=[{predicate:e=>e>=3&&e<=5,set:[[oB,sB],[SB,CB],[gB,oH],[EB,DB]]},{predicate:e=>e>=6&&e<=7,set:[[vV,oB,sB],[OV,cB,lB],[gB,_B,EB,DB],[MB,SB,CB,OB],[WB,PB,NB,kB]]},{predicate:e=>e>=8||e===`HS`,set:dH},{predicate:`non-negative-integers`,set:[[rH.seven,rH.eight,rH.nine],[rH.four,rH.five,rH.six],[rH.one,rH.two,rH.three],[rH.zero,{name:``,latex:``,write:``},{name:``,latex:``,write:``}],[cH,lH,uH]]},{predicate:`integers`,set:[[rH.seven,rH.eight,rH.nine],[rH.four,rH.five,rH.six],[rH.one,rH.two,rH.three],[rH.zero,{name:``,latex:``,write:``},YV],[cH,lH,uH]]},{predicate:`decimals`,set:[[rH.seven,rH.eight,rH.nine],[rH.four,rH.five,rH.six],[rH.one,rH.two,rH.three],[rH.zero,rH.decimalPoint,YV],[cH,lH,uH]]},{predicate:`fractions`,set:[[rH.seven,rH.eight,rH.nine],[rH.four,rH.five,rH.six],[rH.one,rH.two,rH.three],[rH.zero,xB,YV],[cH,lH,uH]]},{predicate:`geometry`,set:[[xB,vV,SV,CV,bV,yV],[OV,dV,pV,mV,xV,VB],[XB,ZB,QB,WB,OB,kB],[eV,$B,tV,vB,LV,DB],[iV,aV,oV,fV,uV,cV]]},{predicate:`advanced-algebra`,set:fH},{predicate:`statistics`,set:pH},{predicate:`item-authoring`,set:[[XV,xB,oH,qB,EB,OB,iV,aV,oV,jV],[ZV,OV,{name:``,latex:``,write:``},LV,DB,kB,uV,cV,fV,MV],[MB,WB,vB,vV,dV,wV,TV,mV,hV,NV],[zB,NB,WV,HV,aH,UV,EV,XB,ZB,QB],[cB,lB,{name:``,latex:``,write:``},{name:``,latex:``,write:``},KB,{name:``,latex:``,write:``},{name:``,latex:``,write:``},eV,$B,tV]]},{predicate:e=>e>=1&&e<=2,set:[]}],hH=e=>{let t=parseInt(e,10);if(e=isNaN(t)?e:t,!e)return[];let n=mH.find(t=>typeof t.predicate==`string`?t.predicate===e:t.predicate(e));if(n)return n.set||[];if(e!==`language`)return mH[2].set},gH=[...Object.values(GV),...Object.values(iB),...Object.values(HB),...Object.values(rH),...Object.values(wB),...Object.values(yB),...Object.values(nV),...Object.values(kV),...Object.values(QV),...Object.values(AB),...Object.values(DV),...Object.values(RV),...Object.values(PV),...Object.values(JB),...Object.values(mB)],_H=e=>(e||[]).map(e=>{let{latex:t}=e,n=(gH||[]).find(e=>t===e.latex||t===e.write||t===e.command||t===e.otherNotation);return t&&n||e}),vH=()=>{(Array.from(document.querySelectorAll(`span[mathquill-command-id]`))||[]).forEach(e=>{e&&e.innerText===`∥`&&e.className!==`mq-editable-field`&&(e.style.fontSize=`32px`),(e.innerText===`′`||e.innerText===`′′`)&&!e.hasAttribute(`data-prime`)&&e.setAttribute(`data-prime`,`true`)})},{one:yH,two:bH,three:xH,four:SH,five:CH,six:wH,seven:TH,eight:EH,nine:DH,zero:OH,comma:kH,decimalPoint:AH}=rH,jH=[[TH,EH,DH,XV],[SH,CH,wH,ZV],[yH,bH,xH,YV],[OH,AH,kH,JV],[cH,lH,uH,qV]];function K(e){this.elements=Array.isArray(e)?e:[e].filter(Boolean),this.length=this.elements.length;for(var t=0;t<this.elements.length;t++)this[t]=this.elements[t]}K.prototype.addClass=function(e){var t=(e||``).split(/\s+/).filter(Boolean);return this.elements.forEach(function(e){t.forEach(function(t){e.classList.add(t)})}),this},K.prototype.removeClass=function(e){return this.elements.forEach(function(t){e?(e||``).split(/\s+/).filter(Boolean).forEach(function(e){t.classList.remove(e)}):t.className=``}),this},K.prototype.toggleClass=function(e,t){var n=(e||``).split(/\s+/).filter(Boolean),r=arguments.length>1?!!t:null;return this.elements.forEach(function(e){n.forEach(function(t){r===null?e.classList.toggle(t):e.classList.toggle(t,r)})}),this},K.prototype.attr=function(e,t){return t===IH?this.elements[0]?this.elements[0].getAttribute(e):IH:(this.elements.forEach(function(n){n.setAttribute(e,t)}),this)},K.prototype.html=function(e){return e===IH?this.elements[0]?this.elements[0].innerHTML:``:(this.elements.forEach(function(t){t.innerHTML=e}),this)},K.prototype.append=function(e){var t=e instanceof K?e.elements[0]:e;return this.elements.forEach(function(e){e.appendChild(t)}),this},K.prototype.prepend=function(e){var t=e instanceof K?e.elements[0]:e;return this.elements.forEach(function(e,n){var r=n===0?t:t.cloneNode(!0);e.insertBefore(r,e.firstChild)}),this},K.prototype.wrapAll=function(e){if(!this.elements.length)return this;var t;if(typeof e==`string`&&e.trim().indexOf(`<`)===0){var n=document.createElement(`div`);n.innerHTML=e.trim(),t=n.firstChild}else if(e instanceof K)t=e.elements[0];else if(e&&e.nodeType)t=e;else return this;var r=this.elements[0],i=r.parentNode;return i&&(i.insertBefore(t,r),this.elements.forEach(function(e){t.appendChild(e)})),this},K.prototype.appendTo=function(e){var t=e instanceof K?e.elements[0]:e;return t&&this.elements.forEach(function(e){t.appendChild(e)}),this},K.prototype.prependTo=function(e){var t=e instanceof K?e.elements[0]:e;if(!t)return this;var n=t.firstChild;return this.elements.forEach(function(e){t.insertBefore(e,n),n=e}),this},K.prototype.insertBefore=function(e){var t=e instanceof K?e.elements[0]:e;if(!t)return this;var n=t.parentNode;return n&&this.elements.forEach(function(e){n.insertBefore(e,t)}),this},K.prototype.insertAfter=function(e){var t=e instanceof K?e.elements[0]:e;if(!t)return this;var n=t.parentNode,r=t.nextSibling;return n&&this.elements.forEach(function(e){n.insertBefore(e,r),r=e}),this},K.prototype.replaceWith=function(e){var t=[];return e instanceof K?t=e.elements.slice():e&&typeof e.length==`number`&&!e.tagName?t=Array.from(e):e&&e.nodeType&&(t=[e]),this.elements.forEach(function(e){var n=e.parentNode;n&&(t.forEach(function(t){n.insertBefore(t,e)}),n.removeChild(e))}),this},K.prototype.insDirOf=function(e,t){return e===-1?this.insertBefore(t.first()):this.insertAfter(t.last())},K.prototype.insAtDirEnd=function(e,t){return e===-1?this.prependTo(t):this.appendTo(t)},K.prototype.children=function(e){var t=[];return this.elements.forEach(function(n){var r;if(!e)r=Array.from(n.children);else if(e===`:first`)r=n.firstElementChild?[n.firstElementChild]:[];else if(e===`:last`)r=n.lastElementChild?[n.lastElementChild]:[];else{var i=/^:eq\((\d+)\)$/.exec(e);if(i){var a=parseInt(i[1],10),o=Array.from(n.children);r=o[a]?[o[a]]:[]}else r=Array.from(n.querySelectorAll(`:scope > `+e))}t.push.apply(t,r)}),new K(t)},K.prototype.find=function(e){var t=[];return this.elements.forEach(function(n){var r=Array.from(n.querySelectorAll(e));t.push.apply(t,r)}),new K(t)},K.prototype.closest=function(e){return new K(this.elements.map(function(t){return t.closest(e)}).filter(Boolean))},K.prototype.contents=function(){var e=[];return this.elements.forEach(function(t){var n=Array.from(t.childNodes);e.push.apply(e,n)}),new K(e)},K.prototype.filter=function(e){return new K(this.elements.filter(function(t,n){return e(n,t)}))},K.prototype.detach=function(){return this.elements.forEach(function(e){e.parentNode&&e.parentNode.removeChild(e)}),this},K.prototype.remove=function(){return this.elements.forEach(function(e){e.remove()}),this},K.prototype.empty=function(){return this.elements.forEach(function(e){e.innerHTML=``}),this};function MH(e){return(e||``).split(`.`)[0]}K.prototype.on=function(e,t){var n=MH(e);return this.elements.forEach(function(e){e.addEventListener(n,t)}),this},K.prototype.bind=function(e,t,n){var r=this;if(typeof e==`object`){for(var i in e)e.hasOwnProperty(i)&&r.bind(i,e[i]);return this}var a=typeof t==`function`?t:n;return a===!1&&(a=function(e){e.preventDefault()}),(e||``).split(/\s+/).filter(Boolean).forEach(function(e){var t=MH(e);r.elements.forEach(function(e){e.addEventListener(t,a)})}),this},K.prototype.off=function(e,t){var n=MH(e);return this.elements.forEach(function(e){e.removeEventListener(n,t)}),this},K.prototype.unbind=function(e,t){if(e&&e.includes(`.`))this.elements.forEach(function(e){var t=e.cloneNode(!0);e.parentNode&&e.parentNode.replaceChild(t,e)});else if(e&&t){var n=MH(e);this.elements.forEach(function(e){e.removeEventListener(n,t)})}return this},K.prototype.trigger=function(e){var t=new Event(MH(e),{bubbles:!0,cancelable:!0});return this.elements.forEach(function(e){e.dispatchEvent(t)}),this},K.prototype.focus=function(e){return typeof e==`function`?this.on(`focus`,e):(this.elements.forEach(function(e){e.focus&&e.focus()}),this)},K.prototype.blur=function(e){return typeof e==`function`?this.on(`blur`,e):(this.elements.forEach(function(e){e.blur&&e.blur()}),this)},[`mousemove`,`mouseup`,`mousedown`,`mouseover`,`mouseout`,`click`,`keydown`,`keypress`,`keyup`,`focusout`,`paste`,`cut`,`copy`,`input`,`load`].forEach(function(e){K.prototype[e]=function(t){return this.on(e,t)}}),K.prototype.next=function(e){return new K(this.elements.map(function(e){return e.nextElementSibling}).filter(function(t){return!e||t&&t.matches(e)}))},K.prototype.prev=function(e){return new K(this.elements.map(function(e){return e.previousElementSibling}).filter(function(t){return!e||t&&t.matches(e)}))},K.prototype.parent=function(){return new K(this.elements.map(function(e){return e.parentElement}).filter(Boolean))},K.prototype.offset=function(){if(!this.elements[0])return{top:0,left:0};var e=this.elements[0].getBoundingClientRect();return{top:e.top+(window.pageYOffset||document.documentElement.scrollTop),left:e.left+(window.pageXOffset||document.documentElement.scrollLeft)}},K.prototype.width=function(){var e=this.elements[0];if(!e)return 0;var t=window.getComputedStyle(e);return parseFloat(t.width)||e.getBoundingClientRect().width},K.prototype.height=function(){var e=this.elements[0];if(!e)return 0;var t=window.getComputedStyle(e);return parseFloat(t.height)||e.getBoundingClientRect().height},K.prototype.outerWidth=function(){return this.elements[0]?this.elements[0].offsetWidth:0},K.prototype.outerHeight=function(){return this.elements[0]?this.elements[0].offsetHeight:0},K.prototype.innerWidth=function(){return this.elements[0]?this.elements[0].clientWidth:0},K.prototype.innerHeight=function(){return this.elements[0]?this.elements[0].clientHeight:0},K.prototype.css=function(e,t){if(t===IH){if(typeof e==`string`){var n=this.elements[0];return n?window.getComputedStyle(n).getPropertyValue(e.replace(/([A-Z])/g,`-$1`).toLowerCase()):IH}}else this.elements.forEach(function(n){n.style[e]=t});return this},K.prototype.scrollTop=function(e){var t=this.elements[0];return e===IH?t?t===window?window.pageYOffset||document.documentElement.scrollTop:t.scrollTop:0:(t===window?window.scrollTo(window.pageXOffset||0,e):this.elements.forEach(function(t){t.scrollTop=e}),this)},K.prototype.scrollLeft=function(e){var t=this.elements[0];return e===IH?t?t===window?window.pageXOffset||document.documentElement.scrollLeft:t.scrollLeft:0:(t===window?window.scrollTo(e,window.pageYOffset||0):this.elements.forEach(function(t){t.scrollLeft=e}),this)},K.prototype.each=function(e){return this.elements.forEach(function(t,n){e.call(t,n,t)}),this},K.prototype.eq=function(e){return new K([this.elements[e]])},K.prototype.get=function(e){return e===IH?this.elements:e<0?this.elements[this.elements.length+e]:this.elements[e]},K.prototype.add=function(e){var t=this.elements.slice();return e instanceof K?t.push.apply(t,e.elements):Array.isArray(e)?t.push.apply(t,e):e&&e.nodeType&&t.push(e),new K(t)},K.prototype.first=function(){return new K([this.elements[0]])},K.prototype.last=function(){return new K([this.elements[this.elements.length-1]])},K.prototype.index=function(e){if(!e){var t=this.elements[0]&&this.elements[0].parentElement;return t?Array.from(t.children).indexOf(this.elements[0]):-1}var n=e instanceof K?e.elements[0]:e;return this.elements.indexOf(n)},K.prototype.is=function(e){return this.elements.some(function(t){return t.matches(e)})},K.prototype.text=function(e){return e===IH?this.elements.map(function(e){return e.textContent}).join(``):(this.elements.forEach(function(t){t.textContent=e}),this)},K.prototype.val=function(e){var t=this.elements[0];return t?e===IH?t.value===IH?t.textContent:t.value:(this.elements.forEach(function(t){t.value===IH?t.textContent=e:t.value=e}),this):IH};function NH(e){var t=Array.isArray(e)?e:[e].filter(Boolean),n=Object.create(K.prototype);n.elements=t,n.length=t.length;for(var r=0;r<t.length;r++)n[r]=t[r];return n}var PH=function(e,t){var n;if(!e)n=[];else if(e===window||e===document)n=[e];else if(e.nodeType)n=[e];else if(e&&e.current&&e.current.nodeType)n=[e.current];else if(typeof e==`string`&&e[0]===`<`){var r=document.createElement(`div`);r.innerHTML=e.trim(),n=Array.from(r.children)}else if(typeof e==`string`){var i=t instanceof K?t.elements[0]:t||document;n=Array.from(i.querySelectorAll(e))}else n=e instanceof K?e.elements:e.length===IH?[]:Array.from(e);return NH(n)};PH.contains=function(e,t){return e!==t&&e.contains(t)};var FH=PH,IH,LH=`mathquill-command-id`,RH=`mathquill-block-id`,zH=Math.min,BH=Math.max;function VH(){}var HH=[].slice;function UH(e){var t=e.length-1;return function(){var n=HH.call(arguments,0,t),r=HH.call(arguments,t);return e.apply(this,n.concat([r]))}}var WH=UH(function(e,t){return UH(function(n,r){if(e in n)return n[e].apply(n,t.concat(r))})});function GH(e){return UH(function(t,n){return typeof t!=`function`&&(t=WH(t)),e.call(this,function(e){return t.apply(e,[e].concat(n))})})}function q(e){var t=HH.call(arguments,1);return function(){return e.apply(this,t)}}function KH(e,t){if(!t)throw Error(`prayer failed: `+e)}var J=(function(e,t,n){function r(e){return typeof e==`object`}function i(e){return typeof e==`function`}function a(){}return function o(s,c){c===n&&(c=s,s=Object);function l(){var e=new u;return i(e.init)&&e.init.apply(e,arguments),e}function u(){}l.Bare=u;var d=a[e]=s[e],f=u[e]=l[e]=l.p=new a,p;return f.constructor=l,l.extend=function(e){return o(l,e)},(l.open=function(e){if(p={},i(e)?p=e.call(l,f,d,l,s):r(e)&&(p=e),r(p))for(var n in p)t.call(p,n)&&(f[n]=p[n]);return i(f.init)||(f.init=s),l})(c)}})(`prototype`,{}.hasOwnProperty),Y=-1,X=1;function qH(e){KH(`a direction was passed`,e===Y||e===X)}var JH=J(function(e){e.parent=0,e[Y]=0,e[X]=0,e.init=function(e,t,n){this.parent=e,this[Y]=t,this[X]=n},this.copy=function(e){return JH(e.parent,e[Y],e[X])}}),YH=J(function(e){e[Y]=0,e[X]=0,e.parent=0;var t=0;function n(){return t+=1}this.byId={},e.init=function(){this.id=n(),YH.byId[this.id]=this,this.ends={},this.ends[Y]=0,this.ends[X]=0},e.dispose=function(){delete YH.byId[this.id]},e.toString=function(){return`{{ MathQuill Node #`+this.id+` }}`},e.jQ=PH(),e.jQadd=function(e){return this.jQ=this.jQ.add(e)},e.jQize=function(e){var e=PH(e||this.html());function t(e){if(e.getAttribute){var n=e.getAttribute(`mathquill-command-id`),r=e.getAttribute(`mathquill-block-id`);n&&YH.byId[n].jQadd(e),r&&YH.byId[r].jQadd(e)}for(e=e.firstChild;e;e=e.nextSibling)t(e)}for(var n=0;n<e.length;n+=1)t(e[n]);return e},e.createDir=function(e,t){qH(e);var n=this;return n.jQize(),n.jQ.insDirOf(e,t.jQ),t[e]=n.adopt(t.parent,t[Y],t[X]),n},e.createLeftOf=function(e){return this.createDir(Y,e)},e.selectChildren=function(e,t){return tU(e,t)},e.bubble=GH(function(e){for(var t=this;t&&e(t)!==!1;t=t.parent);return this}),e.postOrder=GH(function(e){return(function t(n){n.eachChild(t),e(n)})(this),this}),e.isEmpty=function(){return this.ends[Y]===0&&this.ends[X]===0},e.isStyleBlock=function(){return!1},e.children=function(){return ZH(this.ends[Y],this.ends[X])},e.eachChild=function(){var e=this.children();return e.each.apply(e,arguments),this},e.foldChildren=function(e,t){return this.children().fold(e,t)},e.withDirAdopt=function(e,t,n,r){return ZH(this,this).withDirAdopt(e,t,n,r),this},e.adopt=function(e,t,n){return ZH(this,this).adopt(e,t,n),this},e.disown=function(){return ZH(this,this).disown(),this},e.remove=function(){return this.jQ.remove(),this.postOrder(`dispose`),this.disown()}});function XH(e,t,n){KH(`a parent is always present`,e),t&&(t[X]!==n&&(t[X]=n),t.parent!==e&&(t.parent=e)),n&&(n[Y]!==t&&(n[Y]=t),n.parent!==e&&(n.parent=e)),KH(`leftward is properly set up`,(function(){return t?t[X]===n&&t.parent===e:e.ends[Y]===n})()),KH(`rightward is properly set up`,(function(){return n?n[Y]===t&&n.parent===e:e.ends[X]===t})())}var ZH=J(function(e){e.init=function(e,t,n){if(n===IH&&(n=Y),qH(n),KH(`no half-empty fragments`,!e==!t),this.ends={},e){KH(`withDir is passed to Fragment`,e instanceof YH),KH(`oppDir is passed to Fragment`,t instanceof YH),KH(`withDir and oppDir have the same parent`,e.parent===t.parent),this.ends[n]=e,this.ends[-n]=t;var r=this.fold([],function(e,t){return e.push.apply(e,t.jQ.get()),e});this.jQ=this.jQ.add(r)}},e.jQ=PH(),e.withDirAdopt=function(e,t,n,r){return e===Y?this.adopt(t,n,r):this.adopt(t,r,n)},e.adopt=function(e,t,n){XH(e,t,n);var r=this;r.disowned=!1;var i=r.ends[Y];if(!i)return this;var a=r.ends[X];return t||(e.ends[Y]=i),n?n[Y]=a:e.ends[X]=a,r.ends[X][X]=n,r.each(function(n){n[Y]=t,n.parent=e,t&&(t[X]=n),t=n}),r},e.disown=function(){var e=this,t=e.ends[Y];if(!t||e.disowned)return e;e.disowned=!0;var n=e.ends[X],r=t.parent;return XH(r,t[Y],t),XH(r,n,n[X]),t[Y]?t[Y][X]=n[X]:r.ends[Y]=n[X],n[X]?n[X][Y]=t[Y]:r.ends[X]=t[Y],e},e.remove=function(){return this.jQ.remove(),this.each(`postOrder`,`dispose`),this.disown()},e.each=GH(function(e){var t=this,n=t.ends[Y];if(!n)return t;for(;n!==t.ends[X][X]&&e(n)!==!1;n=n[X]);return t}),e.fold=function(e,t){return this.each(function(n){e=t.call(this,e,n)}),e}}),Z={},QH={},$H={},eU=J(JH,function(e){e.init=function(e,t){this.parent=e,this.options=t;var n=this.jQ=this._jQ=PH(`<span class="mq-cursor">​</span>`);this.blink=function(){n.toggleClass(`mq-blink`)},this.upDownCache={}},e.show=function(){return this.jQ=this._jQ.removeClass(`mq-blink`),`intervalId`in this?clearInterval(this.intervalId):(this[X]?this.selection&&this.selection.ends[Y][Y]===this[Y]?this.jQ.insertBefore(this.selection.jQ):this.jQ.insertBefore(this[X].jQ.first()):this.jQ.appendTo(this.parent.jQ),this.parent.focus()),this.intervalId=setInterval(this.blink,500),this},e.hide=function(){return`intervalId`in this&&clearInterval(this.intervalId),delete this.intervalId,this.jQ.detach(),this.jQ=PH(),this},e.withDirInsertAt=function(e,t,n,r){var i=this.parent;this.parent=t,this[e]=n,this[-e]=r,i!==t&&i.blur&&i.blur(this)},e.insDirOf=function(e,t){return qH(e),!t||!t.jQ?this:(this.jQ.insDirOf(e,t.jQ),this.withDirInsertAt(e,t.parent,t[e],t),this.parent.jQ.addClass(`mq-hasCursor`),this)},e.insLeftOf=function(e){return this.insDirOf(Y,e)},e.insRightOf=function(e){return this.insDirOf(X,e)},e.insAtDirEnd=function(e,t){return qH(e),this.jQ.insAtDirEnd(e,t.jQ),this.withDirInsertAt(e,t,0,t.ends[e]),t.focus(),this},e.insAtLeftEnd=function(e){return this.insAtDirEnd(Y,e)},e.insAtRightEnd=function(e){return this.insAtDirEnd(X,e)},e.jumpUpDown=function(e,t){var n=this;n.upDownCache[e.id]=JH.copy(n);var r=n.upDownCache[t.id];if(r)r[X]?n.insLeftOf(r[X]):n.insAtRightEnd(r.parent);else{var i=n.offset().left;t.seek(i,n)}},e.offset=function(){var e=this,t=e.jQ.removeClass(`mq-cursor`).offset();return e.jQ.addClass(`mq-cursor`),t},e.unwrapGramp=function(){var e=this.parent.parent,t=e.parent,n=e[X],r=this,i=e[Y];if(e.disown().eachChild(function(r){r.isEmpty()||(r.children().adopt(t,i,n).each(function(t){t.jQ.insertBefore(e.jQ.first())}),i=r.ends[X])}),!this[X])if(this[Y])this[X]=this[Y][X];else for(;!this[X];)if(this.parent=this.parent[X],this.parent)this[X]=this.parent.ends[Y];else{this[X]=e[X],this.parent=t;break}this[X]?this.insLeftOf(this[X]):this.insAtRightEnd(t),e.jQ.remove(),e[Y].siblingDeleted&&e[Y].siblingDeleted(r.options,X),e[X].siblingDeleted&&e[X].siblingDeleted(r.options,Y)},e.startSelection=function(){for(var e=this.anticursor=JH.copy(this),t=e.ancestors={},n=e;n.parent;n=n.parent)t[n.parent.id]=n},e.endSelection=function(){delete this.anticursor},e.select=function(){var e=this.anticursor;if(!e||!e.ancestors||this[Y]===e[Y]&&this.parent===e.parent)return!1;for(var t,n=this;n.parent;n=n.parent)if(n.parent.id in e.ancestors){t=n.parent;break}if(!t)return!1;var r=e.ancestors[t.id],i,a,o=X;if(n[Y]!==r){for(var s=n;s;s=s[X])if(s[X]===r[X]){o=Y,i=n,a=r;break}}return o===X&&(i=r,a=n),i instanceof JH&&(i=i[X]),a instanceof JH&&(a=a[Y]),!i||!a?!1:(this.hide().selection=t.selectChildren(i,a),this.insDirOf(o,this.selection.ends[o]),this.selectionChanged(),!0)},e.clearSelection=function(){return this.selection&&(this.selection.clear(),delete this.selection,this.selectionChanged()),this},e.deleteSelection=function(){this.selection&&(this[Y]=this.selection.ends[Y][Y],this[X]=this.selection.ends[X][X],this.selection.remove(),this.selectionChanged(),delete this.selection)},e.replaceSelection=function(){var e=this.selection;return e&&(this[Y]=e.ends[Y][Y],this[X]=e.ends[X][X],delete this.selection),e},e.depth=function(){for(var e=this,t=0;e=e.parent;)t+=+(e instanceof SU);return t},e.isTooDeep=function(e){if(this.options.maxDepth!==IH)return this.depth()+(e||0)>this.options.maxDepth},e.howDeep=function(){for(var e=0,t=this;t=t.parent;)e++;return 1+Math.floor(e/2)},e.tooDeep=function(){var e=this.options.maxDepth;return e&&this.howDeep()>e}}),tU=J(ZH,function(e,t){e.init=function(){t.init.apply(this,arguments),this.jQ=this.jQ.wrapAll(`<span class="mq-selection"></span>`).parent()},e.adopt=function(){return this.jQ.replaceWith(this.jQ=this.jQ.children()),t.adopt.apply(this,arguments)},e.clear=function(){var e=this.jQ[0];return e&&this.jQ.replaceWith(e.childNodes),this},e.join=function(e){return this.fold(``,function(t,n){return t+n[e]()})}}),nU=J(function(e){e.init=function(e,t,n){this.id=e.id,this.data={},this.root=e,this.container=t,this.options=n,e.controller=this,this.cursor=e.cursor=eU(e,n)},e.handle=function(e,t){var n=this.options.handlers;if(n&&n.fns[e]){var r=n.APIClasses[this.KIND_OF_MQ](this);t===Y||t===X?n.fns[e](t,r):n.fns[e](r)}};var t=[];this.onNotify=function(e){t.push(e)},e.notify=function(){for(var e=0;e<t.length;e+=1)t[e].apply(this.cursor,arguments);return this}}),rU={},iU=J(),aU={},oU=J(),sU={};function cU(){window.console&&console.warn(`You are using the MathQuill API without specifying an interface version, which will fail in v1.0.0. Easiest fix is to do the following before doing anything else:
|
|
289
|
+
background-color: var(--pie-background, rgba(255, 255, 255))`,t[1].border=n||`1`,t}}),$L=`(div | paragraph | heading | bulletList | orderedList | blockquote | codeBlock | horizontalRule | image | imageUploadNode)+`,eR=ML.extend({content:$L}),tR=NL.extend({content:$L}),nR=wO.create({name:`div`,group:`block`,content:`inline*`,parseHTML(){return[{tag:`div`}]},renderHTML({HTMLAttributes:e}){return[`div`,e,0]},addKeyboardShortcuts(){let e=e=>{for(let t=e.depth;t>=0;--t)if(e.node(t).type.name===`listItem`)return!0;return!1};return{Enter:()=>{let{state:t}=this.editor,{$from:n}=t.selection;return n.parent.type.name!==`div`||e(n)?!1:this.editor.chain().focus().setNode(`paragraph`).splitBlock().run()},Backspace:()=>{let{state:e}=this.editor,{$from:t,empty:n}=e.selection;if(t.parent.type.name!==`div`||!n)return!1;let r=t.parent.textContent;if(r.length===0)return e.doc.childCount===1;if(r.length===1&&t.parentOffset===1){let{tr:n}=e;return n.delete(t.pos-1,t.pos),this.editor.view.dispatch(n),!0}return!1}}}}),rR=tO.create({name:`ensureEmptyRootIsDiv`,addProseMirrorPlugins(){return[new ey({key:new ry(this.name),appendTransaction(e,t,n){if(!e.some(e=>e.docChanged))return null;let{doc:r}=n;if(r.childCount!==1)return null;let i=r.firstChild;if(i.type.name!==`paragraph`||i.content.size>0)return null;let a=n.schema.nodes.div;if(!a)return null;let o=i.nodeSize;return n.tr.replaceWith(0,o,a.create())}})]}}),iR=tO.create({name:`ensureListItemContentIsDiv`,addProseMirrorPlugins(){return[new ey({key:new ry(this.name),appendTransaction(e,t,n){if(!e.some(e=>e.docChanged))return null;let{doc:r,schema:i}=n,a=i.nodes.div;if(!a)return null;let o=[];if(r.descendants((e,t)=>{if(e.type.name!==`listItem`)return;let n=1;e.forEach(e=>{e.type.name===`paragraph`&&o.push({pos:t+n,attrs:e.attrs}),n+=e.nodeSize})}),o.length===0)return null;let s=n.tr;return o.sort((e,t)=>t.pos-e.pos).forEach(({pos:e,attrs:t})=>s.setNodeMarkup(e,a,t)),s}})]}});function aR(e){return Br(`MuiIconButton`,e)}var oR=Vr(`MuiIconButton`,[`root`,`disabled`,`colorInherit`,`colorPrimary`,`colorSecondary`,`colorError`,`colorInfo`,`colorSuccess`,`colorWarning`,`edgeStart`,`edgeEnd`,`sizeSmall`,`sizeMedium`,`sizeLarge`,`loading`,`loadingIndicator`,`loadingWrapper`]),sR=e=>{let{classes:t,disabled:n,color:r,edge:i,size:a,loading:o}=e;return ca({root:[`root`,o&&`loading`,n&&`disabled`,r!=="default"&&`color${B(r)}`,i&&`edge${B(i)}`,`size${B(a)}`],loadingIndicator:[`loadingIndicator`],loadingWrapper:[`loadingWrapper`]},aR,t)},cR=R(Ld,{name:`MuiIconButton`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.loading&&t.loading,n.color!=="default"&&t[`color${B(n.color)}`],n.edge&&t[`edge${B(n.edge)}`],t[`size${B(n.size)}`]]}})(Nc(({theme:e})=>({textAlign:`center`,flex:`0 0 auto`,fontSize:e.typography.pxToRem(24),padding:8,borderRadius:`50%`,color:(e.vars||e).palette.action.active,transition:e.transitions.create(`background-color`,{duration:e.transitions.duration.shortest}),variants:[{props:e=>!e.disableRipple,style:{"--IconButton-hoverBg":e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity),"&:hover":{backgroundColor:`var(--IconButton-hoverBg)`,"@media (hover: none)":{backgroundColor:`transparent`}}}},{props:{edge:`start`},style:{marginLeft:-12}},{props:{edge:`start`,size:`small`},style:{marginLeft:-3}},{props:{edge:`end`},style:{marginRight:-12}},{props:{edge:`end`,size:`small`},style:{marginRight:-3}}]})),Nc(({theme:e})=>({variants:[{props:{color:`inherit`},style:{color:`inherit`}},...Object.entries(e.palette).filter(Vd()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main}})),...Object.entries(e.palette).filter(Vd()).map(([t])=>({props:{color:t},style:{"--IconButton-hoverBg":e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)}})),{props:{size:`small`},style:{padding:5,fontSize:e.typography.pxToRem(18)}},{props:{size:`large`},style:{padding:12,fontSize:e.typography.pxToRem(28)}}],[`&.${oR.disabled}`]:{backgroundColor:`transparent`,color:(e.vars||e).palette.action.disabled},[`&.${oR.loading}`]:{color:`transparent`}}))),lR=R(`span`,{name:`MuiIconButton`,slot:`LoadingIndicator`})(({theme:e})=>({display:`none`,position:`absolute`,visibility:`visible`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,color:(e.vars||e).palette.action.disabled,variants:[{props:{loading:!0},style:{display:`flex`}}]})),uR=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiIconButton`}),{edge:r=!1,children:i,className:a,color:o=`default`,disabled:s=!1,disableFocusRipple:c=!1,size:l=`medium`,id:u,loading:d=null,loadingIndicator:f,...p}=n,m=_l(u),h=f??(0,F.jsx)($d,{"aria-labelledby":m,color:`inherit`,size:16}),g={...n,edge:r,color:o,disabled:s,disableFocusRipple:c,loading:d,loadingIndicator:h,size:l},_=sR(g);return(0,F.jsxs)(cR,{id:d?m:u,className:I(_.root,a),centerRipple:!0,focusRipple:!c,disabled:s||d,ref:t,...p,ownerState:g,children:[typeof d==`boolean`&&(0,F.jsx)(`span`,{className:_.loadingWrapper,style:{display:`contents`},children:(0,F.jsx)(lR,{className:_.loadingIndicator,ownerState:g,children:d&&h})}),i]})}),dR=ml((0,F.jsx)(`path`,{d:`M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z`}),`Delete`),fR=`pie-toolbar`,pR=ml((0,F.jsx)(`path`,{d:`M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z`}),`Check`),mR=R(uR)({verticalAlign:`top`,width:`28px`,height:`28px`,color:`var(--editable-html-toolbar-check, #00bb00)`,padding:`4px`}),hR=({onClick:e,doneButtonRef:t})=>(0,F.jsx)(mR,{"aria-label":`Done`,buttonRef:t,onClick:e,children:(0,F.jsx)(pR,{})});hR.propTypes={onClick:v.func,doneButtonRef:v.func};var gR=hR,_R=R(`div`,{shouldForwardProp:e=>![`showDone`,`toolbarAlignment`,`isFocused`,`autoWidth`,`isHidden`].includes(e)})(({showDone:e,toolbarAlignment:t,isFocused:n,autoWidth:r,isHidden:i})=>({position:`absolute`,zIndex:10,cursor:`pointer`,justifyContent:`space-between`,background:`var(--editable-html-toolbar-bg, #efefef)`,minWidth:e?`280px`:`265px`,margin:`5px 0 0 0`,padding:`2px`,boxShadow:`0px 1px 5px 0px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 3px 1px -2px rgba(0, 0, 0, 0.12)`,boxSizing:`border-box`,display:`flex`,opacity:1,...t===`right`&&{right:0},...r?{width:`auto`}:{width:`100%`},...i&&{visibility:`hidden`}})),vR=R(uR)({width:`28px`,height:`28px`,padding:`4px`,verticalAlign:`top`}),yR=R(`div`)({display:`flex`});function bR(e){let{children:t,deletable:n,toolbarOpts:r,autoWidth:i,isFocused:a,doneButtonRef:o,onDelete:s,showDone:c,onDone:l,style:u}=e,d=r.minWidth===void 0?{}:{minWidth:r.minWidth};return(0,F.jsxs)(_R,{className:fR,showDone:c,toolbarAlignment:r.alignment,isFocused:r.alwaysVisible||a,autoWidth:i,isHidden:r.isHidden===!0,style:{...d,...u},children:[t,(0,F.jsxs)(yR,{children:[n&&(0,F.jsx)(vR,{"aria-label":`Delete`,onMouseDown:e=>s?.(e),children:(0,F.jsx)(dR,{})}),c&&(0,F.jsx)(gR,{doneButtonRef:o,onClick:l})]})]})}var xR=`toolbarOpenedChanged`,SR=(e,t)=>{let n=!!t;e._toolbarOpened!==n&&(e._toolbarOpened=n,e?.view&&e?.state?.tr&&e.view.dispatch(e.state.tr.setMeta(xR,!0)))},CR=e=>{let{editor:t,node:n,getPos:r,options:i,selected:a}=e,{attrs:o}=n,{value:s}=o,{respAreaToolbar:c,error:l}=i,u=r(),[d,f]=(0,P.useState)(!1),p=c([n,u],t,()=>{}),m=(0,P.useRef)(null),h;if(l){let e=l(),t=parseInt(o.index,10);h=!!e?.[t]?.[0]}return(0,P.useEffect)(()=>{let{selection:e}=t.state,r=e.from+n.nodeSize===e.to;a?r&&f(a):f(a)},[t,n,a]),(0,P.useEffect)(()=>{let e=e=>{!(e.target.closest(`.insert-character-dialog`)||e.target.closest(`[data-toolbar-for]`))&&m.current&&!m.current.contains(e.target)&&!e.target.closest(`[data-inline-node]`)&&f(!1)};return d?document.addEventListener(`mousedown`,e):document.removeEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[d]),(0,F.jsxs)(Wk,{className:`drag-in-the-blank`,"data-selected":a,style:{display:`inline-flex`,minHeight:`55px`,position:`relative`,cursor:`pointer`},children:[(0,F.jsx)(`div`,{...o,style:{display:`inline-flex`,width:`100%`,minHeight:`46px`,height:`46px`,backgroundColor:`#FFF`,border:`1px solid ${h?`red`:`#C0C3CF`}`,boxSizing:`border-box`,borderRadius:`4px`,overflow:`hidden`,padding:`12px 21px`,margin:`0 4px`,minWidth:`178px`,visibility:d?`hidden`:`visible`},onClick:()=>f(!0),dangerouslySetInnerHTML:{__html:s||`<div> </div>`}}),d&&(0,F.jsxs)(P.Fragment,{children:[(0,F.jsx)(`div`,{ref:m,className:`absolute z-50 bg-white shadow-lg rounded p-2`,style:{zIndex:1},children:(0,F.jsx)(p,{})}),t._tiptapContainerEl&&Ms.createPortal((0,F.jsx)(bR,{deletable:!0,toolbarOpts:{minWidth:`auto`},autoWidth:!0,style:{top:-40,left:0,right:0},onDelete:()=>{let{tr:e}=t.state;e.delete(u,u+n.nodeSize),SR(t,!1),t.view.dispatch(e),f(!1),t.commands.focus()},showDone:!1}),t._tiptapContainerEl)]})]})};CR.propTypes={attributes:v.object,error:v.any,value:v.string,isFocused:v.bool};var wR=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function TR(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function ER(e){return`nodeType`in e}function DR(e){return e?TR(e)?e:ER(e)?e.ownerDocument?.defaultView??window:window:window}function OR(e){let{Document:t}=DR(e);return e instanceof t}function kR(e){return!TR(e)&&e instanceof DR(e).HTMLElement}function AR(e){return e instanceof DR(e).SVGElement}function jR(e){return e?TR(e)?e.document:ER(e)?OR(e)?e:kR(e)||AR(e)?e.ownerDocument:document:document:document}var MR=wR?P.useLayoutEffect:P.useEffect;function NR(e){let t=(0,P.useRef)(e);return MR(()=>{t.current=e}),(0,P.useCallback)(function(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return t.current==null?void 0:t.current(...n)},[])}function PR(e,t){t===void 0&&(t=[e]);let n=(0,P.useRef)(e);return MR(()=>{n.current!==e&&(n.current=e)},t),n}function FR(e){let t=NR(e),n=(0,P.useRef)(null);return[n,(0,P.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}var IR={};function LR(e,t){return(0,P.useMemo)(()=>{if(t)return t;let n=IR[e]==null?0:IR[e]+1;return IR[e]=n,e+`-`+n},[e,t])}function RR(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var zR=RR(1),BR=RR(-1);function VR(e){return`clientX`in e&&`clientY`in e}function HR(e){if(!e)return!1;let{KeyboardEvent:t}=DR(e.target);return t&&e instanceof t}function UR(e){if(!e)return!1;let{TouchEvent:t}=DR(e.target);return t&&e instanceof t}function WR(e){if(UR(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return VR(e)?{x:e.clientX,y:e.clientY}:null}var GR;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(GR||={});function KR(){}var qR=Object.freeze({x:0,y:0});function JR(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function YR(e,t,n){let r=JR(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var XR={ignoreTransform:!1};function ZR(e,t){t===void 0&&(t=XR);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=DR(e).getComputedStyle(e);t&&(n=YR(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function QR(e,t){return t===void 0&&(t=DR(e).getComputedStyle(e)),t.position===`fixed`}function $R(e,t){t===void 0&&(t=DR(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`&&n.test(r)})}function ez(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(OR(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!kR(i)||AR(i)||n.includes(i))return n;let a=DR(e).getComputedStyle(i);return i!==e&&$R(i,a)&&n.push(i),QR(i,a)?n:r(i.parentNode)}return e?r(e):n}function tz(e){let[t]=ez(e,1);return t??null}var nz;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(nz||={});function rz(e){return!wR||!e?!1:e===document.scrollingElement}function iz(e){let t={x:0,y:0},n=rz(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}function az(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function oz(e,t){if(t===void 0&&(t=ZR),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);tz(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var sz=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function cz(e){let{EventTarget:t}=DR(e);return e instanceof t?e:jR(e)}function lz(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t&&r>t.y}var uz;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(uz||={});function dz(e){e.preventDefault()}function fz(e){e.stopPropagation()}var pz;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(pz||={});var mz={start:[pz.Space,pz.Enter],cancel:[pz.Esc],end:[pz.Space,pz.Enter,pz.Tab]},hz=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case pz.Right:return{...n,x:n.x+25};case pz.Left:return{...n,x:n.x-25};case pz.Down:return{...n,y:n.y+25};case pz.Up:return{...n,y:n.y-25}}},gz=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new sz(jR(t)),this.windowListeners=new sz(DR(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(uz.Resize,this.handleCancel),this.windowListeners.add(uz.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(uz.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&oz(n),t(qR)}handleKeyDown(e){if(HR(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=mz,coordinateGetter:a=hz,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:qR;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=BR(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=iz(n),p=az(n),m={x:Math.min(i===pz.Right?p.right-p.width/2:p.right,Math.max(i===pz.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===pz.Down?p.bottom-p.height/2:p.bottom,Math.max(i===pz.Down?p.top:p.top+p.height/2,u.y))},h=i===pz.Right&&!s||i===pz.Left&&!c,g=i===pz.Down&&!l||i===pz.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===pz.Right&&e<=d.x||i===pz.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===pz.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===pz.Down&&e<=d.y||i===pz.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===pz.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,zR(BR(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};gz.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=mz,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function _z(e){return!!(e&&`distance`in e)}function vz(e){return!!(e&&`delay`in e)}var yz=class{constructor(e,t,n){n===void 0&&(n=cz(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=jR(i),this.documentListeners=new sz(this.document),this.listeners=new sz(n),this.windowListeners=new sz(DR(i)),this.initialCoordinates=WR(r)??qR,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(uz.Resize,this.handleCancel),this.windowListeners.add(uz.DragStart,dz),this.windowListeners.add(uz.VisibilityChange,this.handleCancel),this.windowListeners.add(uz.ContextMenu,dz),this.documentListeners.add(uz.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(vz(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(_z(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(uz.Click,fz,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(uz.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=WR(e)??qR,s=BR(n,o);if(!t&&a){if(_z(a)){if(a.tolerance!=null&&lz(s,a.tolerance))return this.handleCancel();if(lz(s,a.distance))return this.handleStart()}if(vz(a)&&lz(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===pz.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},bz={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},xz=class extends yz{constructor(e){let{event:t}=e,n=jR(t.target);super(e,bz,n)}};xz.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var Sz={move:{name:`mousemove`},end:{name:`mouseup`}},Cz;(function(e){e[e.RightClick=2]=`RightClick`})(Cz||={});var wz=class extends yz{constructor(e){super(e,Sz,jR(e.event.target))}};wz.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Cz.RightClick?!1:(r?.({event:n}),!0)}}];var Tz={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},Ez=class extends yz{constructor(e){super(e,Tz)}static setup(){return window.addEventListener(Tz.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Tz.move.name,e)};function e(){}}};Ez.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var Dz;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(Dz||={});var Oz;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(Oz||={}),nz.Backward,nz.Forward,nz.Backward,nz.Forward;var kz;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(kz||={});var Az;(function(e){e.Optimized=`optimized`})(Az||={});function jz(e){let{callback:t,disabled:n}=e,r=NR(t),i=(0,P.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,P.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Mz(e,t){return(0,P.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}kz.WhileDragging,Az.Optimized;var Nz={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:KR,draggableNodes:new Map,over:null,measureDroppableContainers:KR},Pz=(0,P.createContext)(Nz),Fz=(0,P.createContext)({...qR,scaleX:1,scaleY:1}),Iz;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(Iz||={});var Lz=(0,P.createContext)(null),Rz=`button`,zz=`Draggable`;function Bz(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=LR(zz),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,P.useContext)(Pz),{role:p=Rz,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,P.useContext)(g?Fz:Lz),[v,y]=FR(),[b,x]=FR(),S=Mz(o,t),C=PR(n);return MR(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:C}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,P.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===Rz?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}var Vz=`Droppable`,Hz={timeout:25};function Uz(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=LR(Vz),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,P.useContext)(Pz),u=(0,P.useRef)({disabled:n}),d=(0,P.useRef)(!1),f=(0,P.useRef)(null),p=(0,P.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...Hz,...i},_=PR(h??r),v=jz({callback:(0,P.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=FR((0,P.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=PR(t);return(0,P.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,P.useEffect)(()=>(s({type:GR.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:GR.UnregisterDroppable,key:a,id:r})),[r]),(0,P.useEffect)(()=>{n!==u.current.disabled&&(s({type:GR.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}var Wz=ml((0,F.jsx)(`path`,{d:`M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z`}),`ChevronRight`),Gz=ml((0,F.jsx)(`path`,{d:`M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2`}),`MoreVert`),Kz=e=>{switch(e){case`down`:return 90;case`up`:return-90;case`left`:return 180;default:return 0}},qz=e=>{let{direction:t,style:n}=e;return(0,F.jsx)(Wz,{style:{transform:`rotate(${Kz(t)}deg)`,...n}})};qz.propTypes={direction:v.string,style:v.object};var Jz=({style:e})=>(0,F.jsxs)(`span`,{style:e,children:[(0,F.jsx)(Gz,{style:{margin:`0 -16px`}}),(0,F.jsx)(Gz,{})]});Jz.propTypes={style:v.object},R(`div`)(({theme:e})=>({fontFamily:`Cerebri Sans !important`,fontSize:e.typography.fontSize,fontWeight:`bold`,lineHeight:`14px`,position:`relative`,top:`7px`,width:`110px`,height:`28px`,whiteSpace:`nowrap`}));var Yz=R(`span`)(({theme:e})=>({border:`solid 0px ${e.palette.primary.main}`,"& mjx-mn:has(~ mjx-mfrac), mjx-mfrac ~ mjx-mn":{fontSize:`120% !important`},"& mjx-frac":{fontSize:`120% !important`}}));function Xz({n:e,children:t,isDragging:n,isOver:r,dragItem:i,value:a,selected:o}){let[s,c]=(0,P.useState)(null),l=(0,P.useRef)(null),u=e=>{l.current&&(l.current.contains(e.target)?l.current.classList.add(`selected`):l.current.classList.remove(`selected`))};(0,P.useEffect)(()=>(document.addEventListener(`click`,u),()=>{document.removeEventListener(`click`,u)}),[]),(0,P.useEffect)(()=>{l.current&&typeof hd==`function`&&hd(l.current)},[a?.value,r,i?.value?.value]),(0,P.useEffect)(()=>{if(r&&l.current&&!s){let e=l.current;c({width:e.offsetWidth,height:e.offsetHeight})}else!r&&s&&c(null)},[r,s]);let d=i&&r?i.value.value:a.value||`\xA0`,f=n?`\xA0`:d,p=f!==`\xA0`,m=i&&r,h=o?`2px solid ${Zl()}`:m?`1px solid ${V.BORDER_DARK}`:`1px solid ${V.BORDER_LIGHT}`;return(0,F.jsxs)(`div`,{ref:l,className:o?`selected`:void 0,style:{display:`inline-flex`,minWidth:`178px`,minHeight:`36px`,background:m?`${V.BORDER_LIGHT}`:`${V.WHITE}`,border:h,boxSizing:`border-box`,borderRadius:`3px`,overflow:`hidden`,position:`relative`,padding:`8px 8px 8px 35px`,width:s?s.width:void 0,height:s?s.height:void 0,touchAction:`none`},"data-key":e.index,contentEditable:!1,children:[p&&(0,F.jsx)(Jz,{style:{position:`absolute`,top:`6px`,left:`15px`,color:`#9B9B9B`},contentEditable:!1}),(0,F.jsx)(`span`,{dangerouslySetInnerHTML:{__html:f}}),t]})}Xz.propTypes={n:v.object,children:v.node,isDragging:v.bool,isOver:v.bool,dragItem:v.object,value:v.object,selected:v.bool};function Zz({value:e,disabled:t,instanceId:n,children:r,n:i,onChange:a,removeResponse:o,duplicates:s,pos:c,selected:l}){let{attributes:u,listeners:d,setNodeRef:f,isDragging:p}=Bz({id:`drag-${i.index}`,disabled:t||!e?.value,data:{id:`drag-${i.index}`,value:e,instanceId:n,n:i,pos:c,opts:{duplicates:s},type:`drag-in-the-blank-placed-choice`,fromChoice:!e,onRemove:e=>o(e),onDrop:(e,t)=>{t?.type===`drag-in-the-blank-drop-choice`&&(a(e),!s&&e.fromChoice&&o(e))}}}),{setNodeRef:m,isOver:h,active:g}=Uz({id:`drop-${i.index}`,data:{type:`drag-in-the-blank-drop-choice`,accepts:[`drag-in-the-blank-choice`,`drag-in-the-blank-placed-choice`],instanceId:n,value:e,id:`drop-${i.index}`,pos:c,n:i,opts:{duplicates:s},onDrop:(e,t)=>{if(t?.type===`drag-in-the-blank-drop-choice`&&e.value.id!==t.value.id){if(e.type===`drag-in-the-blank-choice`){a(e),!s&&e.fromChoice&&o(e);return}e.type===`drag-in-the-blank-placed-choice`&&(o(t),a(e),setTimeout(()=>o(e),10))}}}}),_=e=>{f(e),m(e)},v=(0,F.jsx)(Xz,{n:i,isDragging:p,isOver:h,dragItem:g?.data?.current,value:e,selected:l,children:r}),y=e?(0,F.jsx)(`span`,{ref:_,...u,...d,children:v}):(0,F.jsx)(`span`,{ref:m,children:v});return(0,F.jsx)(Yz,{className:I(h&&`over`),children:y})}Zz.propTypes={value:v.object,disabled:v.bool,instanceId:v.string,children:v.node,n:v.object.isRequired,onChange:v.func.isRequired,removeResponse:v.func.isRequired,duplicates:v.bool,selected:v.bool};var Qz=(e,t,n,r)=>{let{tr:i}=e.state;i.setNodeMarkup(n,void 0,{...t.attrs,...r.value}),i.isDone=!0,e.view.dispatch(i)},$z=(e,t,n)=>{let{tr:r}=e.state;r.setNodeMarkup(n.pos,void 0,Vp(t.attrs,[`value`,`id`])),r.isDone=!0,e.view.dispatch(r)},eB=e=>{let{editor:t,node:n,getPos:r,options:i,selected:a}=e,{attrs:o}=n,{inTable:s}=o,c=r();return(0,F.jsx)(Wk,{className:`drag-in-the-blank`,"data-selected":a,style:{display:`inline`,whiteSpace:`normal`},children:(0,F.jsx)(`span`,{...o,style:{display:`inline-flex`,minHeight:`50px`,minWidth:`178px`,position:`relative`,margin:s?`10px`:`0 10px`,cursor:`pointer`},children:(0,F.jsx)(Zz,{n:o,dragKey:o.id,targetId:`0`,pos:c,value:o,duplicates:i.duplicates,selected:a,onChange:e=>Qz(t,n,c,e),removeResponse:e=>$z(t,n,e)})})})};eB.propTypes={attributes:v.object,data:v.object,n:v.object,nodeProps:v.object,opts:v.object};var tB=e=>{let{editor:t,node:n,getPos:r,options:i,selected:a}=e,{attrs:o}=n,{value:s,error:c}=o,l=s||`<div> </div>`,u=r(),d=(0,P.useRef)(null),f=(0,P.useRef)(null),p=(0,P.useRef)(!1),m=(0,P.useRef)(null),h=()=>t._holdInlineDropdownToolbarIndex!=null&&String(t._holdInlineDropdownToolbarIndex)===String(n.attrs.index),[g,_]=(0,P.useState)(!1),[v,y]=(0,P.useState)({top:0,left:0}),b=()=>{h()||(_(!1),i.onInlineDropdownToolbarClose?.(t))},x=i.respAreaToolbar([n,u],t,b),S=()=>{let{tr:e}=t.state,n=e.doc.nodeAt(u);if(!n)return;let{selection:r}=e;r.from===u&&r.to===u+n.nodeSize||(e.setSelection(Rv.create(e.doc,u)),t.view.dispatch(e))},C=()=>{p.current||(i.onToolbarCloseRequest?(p.current=!0,i.onToolbarCloseRequest([n,u],t,()=>{p.current=!1,delete t._holdInlineDropdownToolbarIndex,b()},()=>{p.current=!1,delete t._holdInlineDropdownToolbarIndex,_(!0),setTimeout(S,0)})):b())};(0,P.useEffect)(()=>{let{selection:e}=t.state,r=e.from+n.nodeSize===e.to;a?r&&_(!0):g&&C()},[t,n,a]);let w=e=>e.clientX>document.documentElement.clientWidth||e.clientY>document.documentElement.clientHeight||e.target===document.documentElement;return(0,P.useEffect)(()=>{m.current&&typeof hd==`function`&&hd(m.current)},[s]),(0,P.useEffect)(()=>{let e=document.body.getBoundingClientRect(),{from:n}=t.state.selection,r=t.view.coordsAtPos(n);y({top:r.top+Math.abs(e.top)+40,left:r.left});let i=e=>{if(w(e))return;let n=e.target.closest(`[data-toolbar-for]`);!e.target.closest(`[data-inline-dropdown-toolbar]`)&&(!n||n.dataset.toolbarFor!==f.current?.instanceId)&&!t._toolbarOpened&&d.current&&!d.current.contains(e.target)&&!e.target.closest(`[data-inline-node]`)&&C()};return g?document.addEventListener(`mousedown`,i):document.removeEventListener(`mousedown`,i),()=>document.removeEventListener(`mousedown`,i)},[g,n]),(0,F.jsxs)(Wk,{className:`inline-dropdown`,"data-selected":a,style:{display:`inline-flex`,height:`50px`,cursor:`pointer`},children:[(0,F.jsxs)(`div`,{ref:m,style:{display:`inline-flex`,minWidth:`178px`,height:`36px`,background:`#FFF`,border:`1px solid #C0C3CF`,boxSizing:`border-box`,borderRadius:`3px`,margin:`0 2px`,position:`relative`,alignItems:`center`},onClick:()=>_(!0),children:[(0,F.jsx)(`div`,{style:{flex:1,overflow:`hidden`,padding:`0 25px 0 8px`,whiteSpace:`nowrap`,textOverflow:`ellipsis`},children:(0,F.jsx)(`span`,{style:{display:`inline-block`,verticalAlign:`middle`},dangerouslySetInnerHTML:{__html:l}})}),(0,F.jsx)(qz,{direction:`down`,style:{position:`absolute`,top:`5px`,right:`5px`}})]}),g&&(0,F.jsxs)(P.Fragment,{children:[Ms.createPortal((0,F.jsx)(`div`,{ref:d,children:(0,F.jsx)(x,{editorCallback:e=>{f.current=e}})}),t?._tiptapContainerEl||document.body),t._tiptapContainerEl&&Ms.createPortal((0,F.jsx)(bR,{deletable:!0,toolbarOpts:{minWidth:`auto`},autoWidth:!0,style:{top:-40,left:0,right:0},onDelete:()=>{let{tr:e}=t.state;e.delete(u,u+n.nodeSize),SR(t,!1),delete t._holdInlineDropdownToolbarIndex,t.view.dispatch(e),_(!1),t.commands.focus()},showDone:!1}),t._tiptapContainerEl)]})]})};tB.propTypes={attributes:v.object,selectedItem:v.oneOfType([v.string,v.object])};var nB=s({greaterThan:()=>aB,greaterThanEqual:()=>sB,lessThan:()=>iB,lessThanEqual:()=>oB}),rB=e=>({...e,category:`comparison`}),iB=rB({name:`Less than`,latex:`<`,command:`\\lt`}),aB=rB({name:`Greater than`,latex:`>`,command:`\\gt`}),oB=rB({name:`Less than or equal`,latex:`\\le`,symbol:`<=`,command:`\\le`,ariaLabel:`less than or equal to`}),sB=rB({name:`Greater than or equal`,symbol:`>=`,command:`\\ge`,latex:`\\ge`}),cB=e=>t=>({...t,category:e}),lB=(e=[])=>{let t=[];Up(5,()=>t.push([]));let n=e.length,r=0,i=0;for(;i<n;)t[r++].push(e[i++]),r===5&&(r=0);return t},uB=e=>t=>{let n=Fp(e),r=n.some(e=>e.latex===t.latex),i=n.some(e=>e.name===t.name);return!r&&!i},dB=(e=[],t=[])=>{t=t.filter(uB(e));let n=[];Up(5-e.length,()=>e.push([])),Up(5,()=>n.push([]));let r=lB(t);for(let t=0;t<5;t++)n[t]=[...e[t],...r[t]];return n},fB=s({theta:()=>gB,x:()=>mB,y:()=>hB}),pB=cB(`vars`),mB=pB({name:`X`,latex:`x`,write:`x`}),hB=pB({name:`Y`,latex:`y`,write:`y`}),gB=pB({name:`Theta`,latex:`\\theta`,write:`\\theta`}),_B=s({blankOverBlank:()=>yB,xBlankBlank:()=>xB,xOverBlank:()=>bB}),vB=cB(`fractions`),yB=vB({name:`blank/blank`,latex:`\\frac{}{}`,command:`\\frac`,ariaLabel:`fraction`}),bB=vB({latex:`\\frac{x}{ }`,name:`X/blank`,label:`x/[]`,command:`/`,ariaLabel:`x over blank fraction`}),xB=vB({name:`X (blank/blank)`,latex:`x\\frac{}{}`,label:`x([]/[])`,command:`\\frac`,ariaLabel:`mixed number`}),SB=s({nthRoot:()=>DB,squareRoot:()=>EB,squared:()=>wB,xToPowerOfN:()=>TB}),CB=cB(`exponent`),wB=CB({name:`Squared`,latex:`x^2`,write:`^2`}),TB=CB({name:`X to the power of n`,latex:`x^{}`,command:`^`,ariaLabel:`exponent`}),EB=CB({name:`Square root`,latex:`\\sqrt{}`,command:`\\sqrt`}),DB=CB({name:`Nth root`,latex:`\\sqrt[{}]{}`,command:`\\nthroot`}),OB=s({absValue:()=>jB,approx:()=>FB,brackets:()=>NB,nApprox:()=>IB,notEqual:()=>LB,notSimilar:()=>zB,parenthesis:()=>MB,percentage:()=>PB,plusMinus:()=>AB,similar:()=>RB}),kB=cB(`misc`),AB=kB({name:`Plus or Minus`,latex:`\\pm`,write:`\\pm`}),jB=kB({name:`Absolute Value`,latex:`\\abs{}`,symbol:`| |`,command:`|`}),MB=kB({name:`Parenthesis`,latex:`\\left(\\right)`,symbol:`( )`,command:`(`}),NB=kB({name:`Brackets`,latex:`\\left[\\right]`,symbol:`[ ]`,command:`[`}),PB=kB({name:`Percent`,latex:`%`,command:`%`}),FB=kB({latex:`\\approx`,command:`\\approx`,ariaLabel:`Approximately equal to`}),IB=kB({latex:`\\napprox`,command:`\\napprox`,ariaLabel:`Not pproximately equal to`}),LB=kB({latex:`\\neq`,command:`\\neq`,ariaLabel:`Not equals`}),RB=kB({latex:`\\sim`,command:`\\sim`,ariaLabel:`Similar`}),zB=kB({latex:`\\nsim`,command:`\\nsim`,ariaLabel:`Not similar`}),BB=s({eulers:()=>UB,halfInfinity:()=>GB,infinity:()=>WB,pi:()=>HB}),VB=cB(`constants`),HB=VB({name:`Pi`,label:`π`,latex:`\\pi`,command:`\\pi`,category:`constants`}),UB=VB({name:`Eulers`,label:`e`,latex:`e`,command:`e`,category:`constants`}),WB=VB({name:`Infinity`,label:`\\infty`,latex:`\\infty`,command:`\\infty`,category:`constants`}),GB=VB({name:`Half Infinity`,label:`\\propto`,latex:`\\propto`,command:`\\propto`,category:`constants`}),KB=s({cos:()=>YB,cot:()=>$B,csc:()=>QB,sec:()=>ZB,sin:()=>JB,tan:()=>XB}),qB=cB(`trigonometry`),JB=qB({name:`sine`,label:`sin`,command:`\\sin`,latex:`\\sin`}),YB=qB({name:`cosine`,label:`cos`,command:`\\cos`,latex:`\\cos`}),XB=qB({name:`tanget`,label:`tan`,command:`\\tan`,latex:`\\tan`}),ZB=qB({name:`secant`,label:`sec`,command:`\\sec`,latex:`\\sec`}),QB=qB({name:`cosecant`,label:`csc`,command:`\\csc`,latex:`\\csc`}),$B=qB({name:`cotangent`,label:`cot`,command:`\\cot`,latex:`\\cot`}),eV=s({angle:()=>lV,circledDot:()=>hV,congruentTo:()=>vV,degree:()=>gV,doublePrimeArcSecond:()=>xV,leftArrow:()=>SV,leftrightArrow:()=>wV,measureOfAngle:()=>dV,notCongruentTo:()=>yV,notParallel:()=>sV,overArc:()=>uV,overLeftRightArrow:()=>iV,overRightArrow:()=>rV,overline:()=>nV,parallel:()=>oV,parallelogram:()=>mV,perpindicular:()=>cV,primeArcminute:()=>bV,rightArrow:()=>CV,segment:()=>aV,similarTo:()=>_V,square:()=>pV,triangle:()=>fV}),tV=e=>({...e,category:`geometry`}),nV=tV({name:`Line`,latex:`\\overline{}`,command:`\\overline`}),rV=tV({name:`Ray`,latex:`\\overrightarrow{}`,command:`\\overrightarrow`}),iV=tV({name:`Segment`,latex:`\\overleftrightarrow{\\overline{}}`,symbol:`AB`,command:`\\overleftrightarrow`}),aV=tV({name:`Segment`,latex:`\\overleftrightarrow{AB}`,write:`\\overleftrightarrow{AB}`,label:`AB`}),oV=tV({name:`Parallel`,latex:`\\parallel`,command:`\\parallel`}),sV=tV({name:`Not Parallel`,latex:`\\nparallel`,command:`\\nparallel`}),cV=tV({name:`Perpendicular`,latex:`\\perp`,command:`\\perpendicular`}),lV=tV({name:`Angle`,latex:`\\angle`,command:`\\angle`}),uV=tV({name:`Over arc`,latex:`\\overarc{\\overline{}}`,command:`\\overarc`}),dV=tV({name:`Measured Angle`,latex:`\\measuredangle`,command:[`m`,`\\angle`]}),fV=tV({name:`Triangle`,latex:`\\triangle`,command:`\\triangle`}),pV=tV({name:`Square`,latex:`\\square`,command:`\\square`}),mV=tV({name:`Parallelogram`,latex:`\\parallelogram`,command:`\\parallelogram`}),hV=tV({name:`Circled Dot`,latex:`\\odot`,command:`\\odot`}),gV=tV({name:`Degree`,latex:`\\degree`,command:`\\degree`}),_V=tV({name:`Similar`,command:`\\sim`,latex:`\\sim`}),vV=tV({name:`Congruent To`,command:`\\cong`,latex:`\\cong`}),yV=tV({name:`Not Congruent To`,command:`\\ncong`,latex:`\\ncong`}),bV=tV({name:`Prime`,label:`pam`,latex:`'`,write:`'`}),xV=tV({name:`Double Prime`,latex:`''`,write:`''`}),SV=tV({name:`Left Arrow`,latex:`\\leftarrow`,command:`\\leftarrow`}),CV=tV({name:`Right Arrow`,latex:`\\rightarrow`,command:`\\rightarrow`}),wV=tV({name:`Left and Right Arrow`,latex:`\\leftrightarrow`,command:`\\leftrightarrow`}),TV=s({circleDot:()=>EV}),EV=cB(`operators`)({name:`CircleDot`,label:`⋅`,write:`\\cdot`,ariaLabel:`Dot multiplier`}),DV=s({ln:()=>jV,log:()=>kV,logSubscript:()=>AV}),OV=cB(`log`),kV=OV({name:`Log`,label:`log`,command:`\\log`,latex:`\\log`}),AV=OV({name:`log base n`,label:`log s`,latex:`\\log_{}`,command:[`\\log`,`_`]}),jV=OV({name:`natural log`,label:`ln`,command:`\\ln`,latex:`\\ln`}),MV=s({subscript:()=>FV,superscript:()=>PV}),NV=cB(`sub-sup`),PV=NV({name:`Superscript`,latex:`x^{}`,command:`^`}),FV=NV({name:`Subscript`,latex:`x_{}`,command:`_`}),IV=s({mu:()=>BV,sigma:()=>VV,smallSigma:()=>HV,xBar:()=>RV,yBar:()=>zV}),LV=cB(`statistics`),RV=LV({name:`X Bar`,label:`x̄`,latex:`\\overline{x}`,write:`\\overline{x}`}),zV=LV({name:`Y Bar`,latex:`\\overline{y}`,write:`\\overline{y}`}),BV=LV({name:`mu`,label:`mu`,latex:`\\mu`,write:`\\mu`}),VV=LV({name:`Sigma`,ariaLabel:`Uppercase Sigma`,label:`\\Sigma`,latex:`\\Sigma`,write:`\\Sigma`}),HV=LV({name:`sigma`,ariaLabel:`Lowercase Sigma`,label:`\\sigma`,latex:`\\sigma`,write:`\\sigma`}),UV=s({divide:()=>JV,equals:()=>GV,minus:()=>qV,multiply:()=>YV,plus:()=>KV}),WV=cB(`operators`),GV=WV({write:`=`,label:`=`}),KV=WV({write:`+`,label:`+`}),qV=WV({write:`−`,label:`−`}),JV=WV({name:`divide`,label:`÷`,command:`\\divide`,otherNotation:`\\div`}),YV=WV({name:`multiply`,label:`×`,command:`\\times`}),XV=s({doubleCellMatrix:()=>$V,singleCellMatrix:()=>QV}),ZV=cB(`matrices`),QV=ZV({name:`Single Cell Matrix`,label:`[ ]`,write:`\\begin{pmatrix}\\end{pmatrix}`}),$V=ZV({name:`Double Cell Matrix`,label:`[ ] [ ] \\\\newline [ ] [ ]`,write:`\\begin{bmatrix}&\\\\&\\end{bmatrix}`}),eH={0:`zero`,1:`one`,2:`two`,3:`three`,4:`four`,5:`five`,6:`six`,7:`seven`,8:`eight`,9:`nine`},tH=Up(10,String).map(e=>({name:eH[e],write:e,label:e,category:`digit`})).reduce((e,t)=>(e[t.name]=t,e),{comma:{name:`comma`,label:`,`,write:`,`,category:`digit`},decimalPoint:{name:`decimal-point`,label:`.`,write:`.`,category:`digit`}}),nH=cB(`logic`),rH=nH({name:`Therefore`,label:`∴`,write:`∴`}),iH=nH({name:`Long division`,latex:`\\longdiv{}`,command:`\\longdiv`}),aH=cB(`navigation`),oH=aH({label:`◀`,keystroke:`Left`,ariaLabel:`Move cursor left`}),sH=aH({label:`▶`,keystroke:`Right`,ariaLabel:`Move cursor right`}),cH={label:`⌫`,category:`edit`,keystroke:`Backspace`,ariaLabel:`Delete`},lH=[[yB,PB,mB,wB,EB],[EV,hB,FV,TB,DB],[AB,iB,aB,oB,sB],[HB,gB,MB,NB,jB],[LB,JB,YB,XB,gV]],uH=(()=>{let e=[...lH.map(e=>[...e])];return e[0].push({name:`i`,latex:`i`,write:`i`}),e[1].push(kV),e[2].push(AV),e[3].push(jV),e[4].push(UB),e})(),dH=(()=>{let e=[...lH.map(e=>[...e])];return e[0].push(BV),e[1].push(RV),e[2].push(zV),e[3].push(VV),e[4].push(HV),e})(),fH=[{predicate:e=>e>=3&&e<=5,set:[[iB,aB],[bB,xB],[mB,iH],[wB,TB]]},{predicate:e=>e>=6&&e<=7,set:[[gV,iB,aB],[EV,oB,sB],[mB,hB,wB,TB],[AB,bB,xB,EB],[HB,MB,jB,DB]]},{predicate:e=>e>=8||e===`HS`,set:lH},{predicate:`non-negative-integers`,set:[[tH.seven,tH.eight,tH.nine],[tH.four,tH.five,tH.six],[tH.one,tH.two,tH.three],[tH.zero,{name:``,latex:``,write:``},{name:``,latex:``,write:``}],[oH,sH,cH]]},{predicate:`integers`,set:[[tH.seven,tH.eight,tH.nine],[tH.four,tH.five,tH.six],[tH.one,tH.two,tH.three],[tH.zero,{name:``,latex:``,write:``},qV],[oH,sH,cH]]},{predicate:`decimals`,set:[[tH.seven,tH.eight,tH.nine],[tH.four,tH.five,tH.six],[tH.one,tH.two,tH.three],[tH.zero,tH.decimalPoint,qV],[oH,sH,cH]]},{predicate:`fractions`,set:[[tH.seven,tH.eight,tH.nine],[tH.four,tH.five,tH.six],[tH.one,tH.two,tH.three],[tH.zero,yB,qV],[oH,sH,cH]]},{predicate:`geometry`,set:[[yB,gV,bV,xV,vV,_V],[EV,lV,dV,fV,yV,zB],[JB,YB,XB,HB,EB,DB],[QB,ZB,$B,gB,FV,TB],[nV,rV,iV,uV,cV,oV]]},{predicate:`advanced-algebra`,set:uH},{predicate:`statistics`,set:dH},{predicate:`item-authoring`,set:[[JV,yB,iH,GB,wB,EB,nV,rV,iV,kV],[YV,EV,{name:``,latex:``,write:``},FV,TB,DB,cV,oV,uV,AV],[AB,HB,gB,gV,lV,SV,CV,fV,pV,jV],[LB,jB,HV,BV,rH,VV,wV,JB,YB,XB],[oB,sB,{name:``,latex:``,write:``},{name:``,latex:``,write:``},WB,{name:``,latex:``,write:``},{name:``,latex:``,write:``},QB,ZB,$B]]},{predicate:e=>e>=1&&e<=2,set:[]}],pH=e=>{let t=parseInt(e,10);if(e=isNaN(t)?e:t,!e)return[];let n=fH.find(t=>typeof t.predicate==`string`?t.predicate===e:t.predicate(e));if(n)return n.set||[];if(e!==`language`)return fH[2].set},mH=[...Object.values(UV),...Object.values(nB),...Object.values(BB),...Object.values(tH),...Object.values(SB),...Object.values(_B),...Object.values(eV),...Object.values(DV),...Object.values(XV),...Object.values(OB),...Object.values(TV),...Object.values(IV),...Object.values(MV),...Object.values(KB),...Object.values(fB)],hH=e=>(e||[]).map(e=>{let{latex:t}=e,n=(mH||[]).find(e=>t===e.latex||t===e.write||t===e.command||t===e.otherNotation);return t&&n||e}),gH=()=>{(Array.from(document.querySelectorAll(`span[mathquill-command-id]`))||[]).forEach(e=>{e&&e.innerText===`∥`&&e.className!==`mq-editable-field`&&(e.style.fontSize=`32px`),(e.innerText===`′`||e.innerText===`′′`)&&!e.hasAttribute(`data-prime`)&&e.setAttribute(`data-prime`,`true`)})},{one:_H,two:vH,three:yH,four:bH,five:xH,six:SH,seven:CH,eight:wH,nine:TH,zero:EH,comma:DH,decimalPoint:OH}=tH,kH=[[CH,wH,TH,JV],[bH,xH,SH,YV],[_H,vH,yH,qV],[EH,OH,DH,KV],[oH,sH,cH,GV]];function K(e){this.elements=Array.isArray(e)?e:[e].filter(Boolean),this.length=this.elements.length;for(var t=0;t<this.elements.length;t++)this[t]=this.elements[t]}K.prototype.addClass=function(e){var t=(e||``).split(/\s+/).filter(Boolean);return this.elements.forEach(function(e){t.forEach(function(t){e.classList.add(t)})}),this},K.prototype.removeClass=function(e){return this.elements.forEach(function(t){e?(e||``).split(/\s+/).filter(Boolean).forEach(function(e){t.classList.remove(e)}):t.className=``}),this},K.prototype.toggleClass=function(e,t){var n=(e||``).split(/\s+/).filter(Boolean),r=arguments.length>1?!!t:null;return this.elements.forEach(function(e){n.forEach(function(t){r===null?e.classList.toggle(t):e.classList.toggle(t,r)})}),this},K.prototype.attr=function(e,t){return t===PH?this.elements[0]?this.elements[0].getAttribute(e):PH:(this.elements.forEach(function(n){n.setAttribute(e,t)}),this)},K.prototype.html=function(e){return e===PH?this.elements[0]?this.elements[0].innerHTML:``:(this.elements.forEach(function(t){t.innerHTML=e}),this)},K.prototype.append=function(e){var t=e instanceof K?e.elements[0]:e;return this.elements.forEach(function(e){e.appendChild(t)}),this},K.prototype.prepend=function(e){var t=e instanceof K?e.elements[0]:e;return this.elements.forEach(function(e,n){var r=n===0?t:t.cloneNode(!0);e.insertBefore(r,e.firstChild)}),this},K.prototype.wrapAll=function(e){if(!this.elements.length)return this;var t;if(typeof e==`string`&&e.trim().indexOf(`<`)===0){var n=document.createElement(`div`);n.innerHTML=e.trim(),t=n.firstChild}else if(e instanceof K)t=e.elements[0];else if(e&&e.nodeType)t=e;else return this;var r=this.elements[0],i=r.parentNode;return i&&(i.insertBefore(t,r),this.elements.forEach(function(e){t.appendChild(e)})),this},K.prototype.appendTo=function(e){var t=e instanceof K?e.elements[0]:e;return t&&this.elements.forEach(function(e){t.appendChild(e)}),this},K.prototype.prependTo=function(e){var t=e instanceof K?e.elements[0]:e;if(!t)return this;var n=t.firstChild;return this.elements.forEach(function(e){t.insertBefore(e,n),n=e}),this},K.prototype.insertBefore=function(e){var t=e instanceof K?e.elements[0]:e;if(!t)return this;var n=t.parentNode;return n&&this.elements.forEach(function(e){n.insertBefore(e,t)}),this},K.prototype.insertAfter=function(e){var t=e instanceof K?e.elements[0]:e;if(!t)return this;var n=t.parentNode,r=t.nextSibling;return n&&this.elements.forEach(function(e){n.insertBefore(e,r),r=e}),this},K.prototype.replaceWith=function(e){var t=[];return e instanceof K?t=e.elements.slice():e&&typeof e.length==`number`&&!e.tagName?t=Array.from(e):e&&e.nodeType&&(t=[e]),this.elements.forEach(function(e){var n=e.parentNode;n&&(t.forEach(function(t){n.insertBefore(t,e)}),n.removeChild(e))}),this},K.prototype.insDirOf=function(e,t){return e===-1?this.insertBefore(t.first()):this.insertAfter(t.last())},K.prototype.insAtDirEnd=function(e,t){return e===-1?this.prependTo(t):this.appendTo(t)},K.prototype.children=function(e){var t=[];return this.elements.forEach(function(n){var r;if(!e)r=Array.from(n.children);else if(e===`:first`)r=n.firstElementChild?[n.firstElementChild]:[];else if(e===`:last`)r=n.lastElementChild?[n.lastElementChild]:[];else{var i=/^:eq\((\d+)\)$/.exec(e);if(i){var a=parseInt(i[1],10),o=Array.from(n.children);r=o[a]?[o[a]]:[]}else r=Array.from(n.querySelectorAll(`:scope > `+e))}t.push.apply(t,r)}),new K(t)},K.prototype.find=function(e){var t=[];return this.elements.forEach(function(n){var r=Array.from(n.querySelectorAll(e));t.push.apply(t,r)}),new K(t)},K.prototype.closest=function(e){return new K(this.elements.map(function(t){return t.closest(e)}).filter(Boolean))},K.prototype.contents=function(){var e=[];return this.elements.forEach(function(t){var n=Array.from(t.childNodes);e.push.apply(e,n)}),new K(e)},K.prototype.filter=function(e){return new K(this.elements.filter(function(t,n){return e(n,t)}))},K.prototype.detach=function(){return this.elements.forEach(function(e){e.parentNode&&e.parentNode.removeChild(e)}),this},K.prototype.remove=function(){return this.elements.forEach(function(e){e.remove()}),this},K.prototype.empty=function(){return this.elements.forEach(function(e){e.innerHTML=``}),this};function AH(e){return(e||``).split(`.`)[0]}K.prototype.on=function(e,t){var n=AH(e);return this.elements.forEach(function(e){e.addEventListener(n,t)}),this},K.prototype.bind=function(e,t,n){var r=this;if(typeof e==`object`){for(var i in e)e.hasOwnProperty(i)&&r.bind(i,e[i]);return this}var a=typeof t==`function`?t:n;return a===!1&&(a=function(e){e.preventDefault()}),(e||``).split(/\s+/).filter(Boolean).forEach(function(e){var t=AH(e);r.elements.forEach(function(e){e.addEventListener(t,a)})}),this},K.prototype.off=function(e,t){var n=AH(e);return this.elements.forEach(function(e){e.removeEventListener(n,t)}),this},K.prototype.unbind=function(e,t){if(e&&e.includes(`.`))this.elements.forEach(function(e){var t=e.cloneNode(!0);e.parentNode&&e.parentNode.replaceChild(t,e)});else if(e&&t){var n=AH(e);this.elements.forEach(function(e){e.removeEventListener(n,t)})}return this},K.prototype.trigger=function(e){var t=new Event(AH(e),{bubbles:!0,cancelable:!0});return this.elements.forEach(function(e){e.dispatchEvent(t)}),this},K.prototype.focus=function(e){return typeof e==`function`?this.on(`focus`,e):(this.elements.forEach(function(e){e.focus&&e.focus()}),this)},K.prototype.blur=function(e){return typeof e==`function`?this.on(`blur`,e):(this.elements.forEach(function(e){e.blur&&e.blur()}),this)},[`mousemove`,`mouseup`,`mousedown`,`mouseover`,`mouseout`,`click`,`keydown`,`keypress`,`keyup`,`focusout`,`paste`,`cut`,`copy`,`input`,`load`].forEach(function(e){K.prototype[e]=function(t){return this.on(e,t)}}),K.prototype.next=function(e){return new K(this.elements.map(function(e){return e.nextElementSibling}).filter(function(t){return!e||t&&t.matches(e)}))},K.prototype.prev=function(e){return new K(this.elements.map(function(e){return e.previousElementSibling}).filter(function(t){return!e||t&&t.matches(e)}))},K.prototype.parent=function(){return new K(this.elements.map(function(e){return e.parentElement}).filter(Boolean))},K.prototype.offset=function(){if(!this.elements[0])return{top:0,left:0};var e=this.elements[0].getBoundingClientRect();return{top:e.top+(window.pageYOffset||document.documentElement.scrollTop),left:e.left+(window.pageXOffset||document.documentElement.scrollLeft)}},K.prototype.width=function(){var e=this.elements[0];if(!e)return 0;var t=window.getComputedStyle(e);return parseFloat(t.width)||e.getBoundingClientRect().width},K.prototype.height=function(){var e=this.elements[0];if(!e)return 0;var t=window.getComputedStyle(e);return parseFloat(t.height)||e.getBoundingClientRect().height},K.prototype.outerWidth=function(){return this.elements[0]?this.elements[0].offsetWidth:0},K.prototype.outerHeight=function(){return this.elements[0]?this.elements[0].offsetHeight:0},K.prototype.innerWidth=function(){return this.elements[0]?this.elements[0].clientWidth:0},K.prototype.innerHeight=function(){return this.elements[0]?this.elements[0].clientHeight:0},K.prototype.css=function(e,t){if(t===PH){if(typeof e==`string`){var n=this.elements[0];return n?window.getComputedStyle(n).getPropertyValue(e.replace(/([A-Z])/g,`-$1`).toLowerCase()):PH}}else this.elements.forEach(function(n){n.style[e]=t});return this},K.prototype.scrollTop=function(e){var t=this.elements[0];return e===PH?t?t===window?window.pageYOffset||document.documentElement.scrollTop:t.scrollTop:0:(t===window?window.scrollTo(window.pageXOffset||0,e):this.elements.forEach(function(t){t.scrollTop=e}),this)},K.prototype.scrollLeft=function(e){var t=this.elements[0];return e===PH?t?t===window?window.pageXOffset||document.documentElement.scrollLeft:t.scrollLeft:0:(t===window?window.scrollTo(e,window.pageYOffset||0):this.elements.forEach(function(t){t.scrollLeft=e}),this)},K.prototype.each=function(e){return this.elements.forEach(function(t,n){e.call(t,n,t)}),this},K.prototype.eq=function(e){return new K([this.elements[e]])},K.prototype.get=function(e){return e===PH?this.elements:e<0?this.elements[this.elements.length+e]:this.elements[e]},K.prototype.add=function(e){var t=this.elements.slice();return e instanceof K?t.push.apply(t,e.elements):Array.isArray(e)?t.push.apply(t,e):e&&e.nodeType&&t.push(e),new K(t)},K.prototype.first=function(){return new K([this.elements[0]])},K.prototype.last=function(){return new K([this.elements[this.elements.length-1]])},K.prototype.index=function(e){if(!e){var t=this.elements[0]&&this.elements[0].parentElement;return t?Array.from(t.children).indexOf(this.elements[0]):-1}var n=e instanceof K?e.elements[0]:e;return this.elements.indexOf(n)},K.prototype.is=function(e){return this.elements.some(function(t){return t.matches(e)})},K.prototype.text=function(e){return e===PH?this.elements.map(function(e){return e.textContent}).join(``):(this.elements.forEach(function(t){t.textContent=e}),this)},K.prototype.val=function(e){var t=this.elements[0];return t?e===PH?t.value===PH?t.textContent:t.value:(this.elements.forEach(function(t){t.value===PH?t.textContent=e:t.value=e}),this):PH};function jH(e){var t=Array.isArray(e)?e:[e].filter(Boolean),n=Object.create(K.prototype);n.elements=t,n.length=t.length;for(var r=0;r<t.length;r++)n[r]=t[r];return n}var MH=function(e,t){var n;if(!e)n=[];else if(e===window||e===document)n=[e];else if(e.nodeType)n=[e];else if(e&&e.current&&e.current.nodeType)n=[e.current];else if(typeof e==`string`&&e[0]===`<`){var r=document.createElement(`div`);r.innerHTML=e.trim(),n=Array.from(r.children)}else if(typeof e==`string`){var i=t instanceof K?t.elements[0]:t||document;n=Array.from(i.querySelectorAll(e))}else n=e instanceof K?e.elements:e.length===PH?[]:Array.from(e);return jH(n)};MH.contains=function(e,t){return e!==t&&e.contains(t)};var NH=MH,PH,FH=`mathquill-command-id`,IH=`mathquill-block-id`,LH=Math.min,RH=Math.max;function zH(){}var BH=[].slice;function VH(e){var t=e.length-1;return function(){var n=BH.call(arguments,0,t),r=BH.call(arguments,t);return e.apply(this,n.concat([r]))}}var HH=VH(function(e,t){return VH(function(n,r){if(e in n)return n[e].apply(n,t.concat(r))})});function UH(e){return VH(function(t,n){return typeof t!=`function`&&(t=HH(t)),e.call(this,function(e){return t.apply(e,[e].concat(n))})})}function q(e){var t=BH.call(arguments,1);return function(){return e.apply(this,t)}}function WH(e,t){if(!t)throw Error(`prayer failed: `+e)}var J=(function(e,t,n){function r(e){return typeof e==`object`}function i(e){return typeof e==`function`}function a(){}return function o(s,c){c===n&&(c=s,s=Object);function l(){var e=new u;return i(e.init)&&e.init.apply(e,arguments),e}function u(){}l.Bare=u;var d=a[e]=s[e],f=u[e]=l[e]=l.p=new a,p;return f.constructor=l,l.extend=function(e){return o(l,e)},(l.open=function(e){if(p={},i(e)?p=e.call(l,f,d,l,s):r(e)&&(p=e),r(p))for(var n in p)t.call(p,n)&&(f[n]=p[n]);return i(f.init)||(f.init=s),l})(c)}})(`prototype`,{}.hasOwnProperty),Y=-1,X=1;function GH(e){WH(`a direction was passed`,e===Y||e===X)}var KH=J(function(e){e.parent=0,e[Y]=0,e[X]=0,e.init=function(e,t,n){this.parent=e,this[Y]=t,this[X]=n},this.copy=function(e){return KH(e.parent,e[Y],e[X])}}),qH=J(function(e){e[Y]=0,e[X]=0,e.parent=0;var t=0;function n(){return t+=1}this.byId={},e.init=function(){this.id=n(),qH.byId[this.id]=this,this.ends={},this.ends[Y]=0,this.ends[X]=0},e.dispose=function(){delete qH.byId[this.id]},e.toString=function(){return`{{ MathQuill Node #`+this.id+` }}`},e.jQ=MH(),e.jQadd=function(e){return this.jQ=this.jQ.add(e)},e.jQize=function(e){var e=MH(e||this.html());function t(e){if(e.getAttribute){var n=e.getAttribute(`mathquill-command-id`),r=e.getAttribute(`mathquill-block-id`);n&&qH.byId[n].jQadd(e),r&&qH.byId[r].jQadd(e)}for(e=e.firstChild;e;e=e.nextSibling)t(e)}for(var n=0;n<e.length;n+=1)t(e[n]);return e},e.createDir=function(e,t){GH(e);var n=this;return n.jQize(),n.jQ.insDirOf(e,t.jQ),t[e]=n.adopt(t.parent,t[Y],t[X]),n},e.createLeftOf=function(e){return this.createDir(Y,e)},e.selectChildren=function(e,t){return $H(e,t)},e.bubble=UH(function(e){for(var t=this;t&&e(t)!==!1;t=t.parent);return this}),e.postOrder=UH(function(e){return(function t(n){n.eachChild(t),e(n)})(this),this}),e.isEmpty=function(){return this.ends[Y]===0&&this.ends[X]===0},e.isStyleBlock=function(){return!1},e.children=function(){return YH(this.ends[Y],this.ends[X])},e.eachChild=function(){var e=this.children();return e.each.apply(e,arguments),this},e.foldChildren=function(e,t){return this.children().fold(e,t)},e.withDirAdopt=function(e,t,n,r){return YH(this,this).withDirAdopt(e,t,n,r),this},e.adopt=function(e,t,n){return YH(this,this).adopt(e,t,n),this},e.disown=function(){return YH(this,this).disown(),this},e.remove=function(){return this.jQ.remove(),this.postOrder(`dispose`),this.disown()}});function JH(e,t,n){WH(`a parent is always present`,e),t&&(t[X]!==n&&(t[X]=n),t.parent!==e&&(t.parent=e)),n&&(n[Y]!==t&&(n[Y]=t),n.parent!==e&&(n.parent=e)),WH(`leftward is properly set up`,(function(){return t?t[X]===n&&t.parent===e:e.ends[Y]===n})()),WH(`rightward is properly set up`,(function(){return n?n[Y]===t&&n.parent===e:e.ends[X]===t})())}var YH=J(function(e){e.init=function(e,t,n){if(n===PH&&(n=Y),GH(n),WH(`no half-empty fragments`,!e==!t),this.ends={},e){WH(`withDir is passed to Fragment`,e instanceof qH),WH(`oppDir is passed to Fragment`,t instanceof qH),WH(`withDir and oppDir have the same parent`,e.parent===t.parent),this.ends[n]=e,this.ends[-n]=t;var r=this.fold([],function(e,t){return e.push.apply(e,t.jQ.get()),e});this.jQ=this.jQ.add(r)}},e.jQ=MH(),e.withDirAdopt=function(e,t,n,r){return e===Y?this.adopt(t,n,r):this.adopt(t,r,n)},e.adopt=function(e,t,n){JH(e,t,n);var r=this;r.disowned=!1;var i=r.ends[Y];if(!i)return this;var a=r.ends[X];return t||(e.ends[Y]=i),n?n[Y]=a:e.ends[X]=a,r.ends[X][X]=n,r.each(function(n){n[Y]=t,n.parent=e,t&&(t[X]=n),t=n}),r},e.disown=function(){var e=this,t=e.ends[Y];if(!t||e.disowned)return e;e.disowned=!0;var n=e.ends[X],r=t.parent;return JH(r,t[Y],t),JH(r,n,n[X]),t[Y]?t[Y][X]=n[X]:r.ends[Y]=n[X],n[X]?n[X][Y]=t[Y]:r.ends[X]=t[Y],e},e.remove=function(){return this.jQ.remove(),this.each(`postOrder`,`dispose`),this.disown()},e.each=UH(function(e){var t=this,n=t.ends[Y];if(!n)return t;for(;n!==t.ends[X][X]&&e(n)!==!1;n=n[X]);return t}),e.fold=function(e,t){return this.each(function(n){e=t.call(this,e,n)}),e}}),Z={},XH={},ZH={},QH=J(KH,function(e){e.init=function(e,t){this.parent=e,this.options=t;var n=this.jQ=this._jQ=MH(`<span class="mq-cursor">​</span>`);this.blink=function(){n.toggleClass(`mq-blink`)},this.upDownCache={}},e.show=function(){return this.jQ=this._jQ.removeClass(`mq-blink`),`intervalId`in this?clearInterval(this.intervalId):(this[X]?this.selection&&this.selection.ends[Y][Y]===this[Y]?this.jQ.insertBefore(this.selection.jQ):this.jQ.insertBefore(this[X].jQ.first()):this.jQ.appendTo(this.parent.jQ),this.parent.focus()),this.intervalId=setInterval(this.blink,500),this},e.hide=function(){return`intervalId`in this&&clearInterval(this.intervalId),delete this.intervalId,this.jQ.detach(),this.jQ=MH(),this},e.withDirInsertAt=function(e,t,n,r){var i=this.parent;this.parent=t,this[e]=n,this[-e]=r,i!==t&&i.blur&&i.blur(this)},e.insDirOf=function(e,t){return GH(e),!t||!t.jQ?this:(this.jQ.insDirOf(e,t.jQ),this.withDirInsertAt(e,t.parent,t[e],t),this.parent.jQ.addClass(`mq-hasCursor`),this)},e.insLeftOf=function(e){return this.insDirOf(Y,e)},e.insRightOf=function(e){return this.insDirOf(X,e)},e.insAtDirEnd=function(e,t){return GH(e),this.jQ.insAtDirEnd(e,t.jQ),this.withDirInsertAt(e,t,0,t.ends[e]),t.focus(),this},e.insAtLeftEnd=function(e){return this.insAtDirEnd(Y,e)},e.insAtRightEnd=function(e){return this.insAtDirEnd(X,e)},e.jumpUpDown=function(e,t){var n=this;n.upDownCache[e.id]=KH.copy(n);var r=n.upDownCache[t.id];if(r)r[X]?n.insLeftOf(r[X]):n.insAtRightEnd(r.parent);else{var i=n.offset().left;t.seek(i,n)}},e.offset=function(){var e=this,t=e.jQ.removeClass(`mq-cursor`).offset();return e.jQ.addClass(`mq-cursor`),t},e.unwrapGramp=function(){var e=this.parent.parent,t=e.parent,n=e[X],r=this,i=e[Y];if(e.disown().eachChild(function(r){r.isEmpty()||(r.children().adopt(t,i,n).each(function(t){t.jQ.insertBefore(e.jQ.first())}),i=r.ends[X])}),!this[X])if(this[Y])this[X]=this[Y][X];else for(;!this[X];)if(this.parent=this.parent[X],this.parent)this[X]=this.parent.ends[Y];else{this[X]=e[X],this.parent=t;break}this[X]?this.insLeftOf(this[X]):this.insAtRightEnd(t),e.jQ.remove(),e[Y].siblingDeleted&&e[Y].siblingDeleted(r.options,X),e[X].siblingDeleted&&e[X].siblingDeleted(r.options,Y)},e.startSelection=function(){for(var e=this.anticursor=KH.copy(this),t=e.ancestors={},n=e;n.parent;n=n.parent)t[n.parent.id]=n},e.endSelection=function(){delete this.anticursor},e.select=function(){var e=this.anticursor;if(!e||!e.ancestors||this[Y]===e[Y]&&this.parent===e.parent)return!1;for(var t,n=this;n.parent;n=n.parent)if(n.parent.id in e.ancestors){t=n.parent;break}if(!t)return!1;var r=e.ancestors[t.id],i,a,o=X;if(n[Y]!==r){for(var s=n;s;s=s[X])if(s[X]===r[X]){o=Y,i=n,a=r;break}}return o===X&&(i=r,a=n),i instanceof KH&&(i=i[X]),a instanceof KH&&(a=a[Y]),!i||!a?!1:(this.hide().selection=t.selectChildren(i,a),this.insDirOf(o,this.selection.ends[o]),this.selectionChanged(),!0)},e.clearSelection=function(){return this.selection&&(this.selection.clear(),delete this.selection,this.selectionChanged()),this},e.deleteSelection=function(){this.selection&&(this[Y]=this.selection.ends[Y][Y],this[X]=this.selection.ends[X][X],this.selection.remove(),this.selectionChanged(),delete this.selection)},e.replaceSelection=function(){var e=this.selection;return e&&(this[Y]=e.ends[Y][Y],this[X]=e.ends[X][X],delete this.selection),e},e.depth=function(){for(var e=this,t=0;e=e.parent;)t+=+(e instanceof bU);return t},e.isTooDeep=function(e){if(this.options.maxDepth!==PH)return this.depth()+(e||0)>this.options.maxDepth},e.howDeep=function(){for(var e=0,t=this;t=t.parent;)e++;return 1+Math.floor(e/2)},e.tooDeep=function(){var e=this.options.maxDepth;return e&&this.howDeep()>e}}),$H=J(YH,function(e,t){e.init=function(){t.init.apply(this,arguments),this.jQ=this.jQ.wrapAll(`<span class="mq-selection"></span>`).parent()},e.adopt=function(){return this.jQ.replaceWith(this.jQ=this.jQ.children()),t.adopt.apply(this,arguments)},e.clear=function(){var e=this.jQ[0];return e&&this.jQ.replaceWith(e.childNodes),this},e.join=function(e){return this.fold(``,function(t,n){return t+n[e]()})}}),eU=J(function(e){e.init=function(e,t,n){this.id=e.id,this.data={},this.root=e,this.container=t,this.options=n,e.controller=this,this.cursor=e.cursor=QH(e,n)},e.handle=function(e,t){var n=this.options.handlers;if(n&&n.fns[e]){var r=n.APIClasses[this.KIND_OF_MQ](this);t===Y||t===X?n.fns[e](t,r):n.fns[e](r)}};var t=[];this.onNotify=function(e){t.push(e)},e.notify=function(){for(var e=0;e<t.length;e+=1)t[e].apply(this.cursor,arguments);return this}}),tU={},nU=J(),rU={},iU=J(),aU={};function oU(){window.console&&console.warn(`You are using the MathQuill API without specifying an interface version, which will fail in v1.0.0. Easiest fix is to do the following before doing anything else:
|
|
290
290
|
|
|
291
291
|
MathQuill = MathQuill.getInterface(1);
|
|
292
292
|
// now MathQuill.MathField() works like it used to
|
|
293
293
|
|
|
294
294
|
See also the "\`dev\` branch (2014–2015) → v0.10.0 Migration Guide" at
|
|
295
|
-
https://github.com/mathquill/mathquill/wiki/%60dev%60-branch-(2014%E2%80%932015)-%E2%86%92-v0.10.0-Migration-Guide`)}function
|
|
295
|
+
https://github.com/mathquill/mathquill/wiki/%60dev%60-branch-(2014%E2%80%932015)-%E2%86%92-v0.10.0-Migration-Guide`)}function sU(e){return oU(),_W(e)}sU.prototype=iU.p,sU.VERSION=`v1.2.1-beta.1`,sU.interfaceVersion=function(e){if(e!==1)throw`Only interface version 1 supported. You specified: `+e;return oU=function(){window.console&&console.warn(`You called MathQuill.interfaceVersion(1); to specify the interface version, which will fail in v1.0.0. You can fix this easily by doing this before doing anything else:
|
|
296
296
|
|
|
297
297
|
MathQuill = MathQuill.getInterface(1);
|
|
298
298
|
// now MathQuill.MathField() works like it used to
|
|
299
299
|
|
|
300
300
|
See also the "\`dev\` branch (2014–2015) → v0.10.0 Migration Guide" at
|
|
301
|
-
https://github.com/mathquill/mathquill/wiki/%60dev%60-branch-(2014%E2%80%932015)-%E2%86%92-v0.10.0-Migration-Guide`)},cU(),lU},lU.getInterface=fU;var uU=fU.MIN=1,dU=fU.MAX=3;function fU(e){if(!(uU<=e&&e<=dU))throw`Only interface versions between `+uU+` and `+dU+` supported. You specified: `+e;if(e<3&&typeof window<`u`&&!window.jQuery)throw`MathQuill interface version `+e+` requires jQuery 1.5.2+ to be loaded first`;function t(e){if(!e||!e.nodeType)return null;var t=PH(e).children(`.mq-root-block`).attr(RH),r=t&&YH.byId[t].controller;return r?n[r.KIND_OF_MQ](r):null}var n={};t.L=Y,t.R=X,t.saneKeyboardEvents=gU;function r(e,t){for(var r in t&&t.handlers&&(t.handlers={fns:t.handlers,APIClasses:n}),t)if(t.hasOwnProperty(r)){var i=t[r],a=aU[r];e[r]=a?a(i):i}}t.config=function(e){return r(iU.p,e),this},t.registerEmbed=function(e,t){if(!/^[a-z][a-z0-9]*$/i.test(e))throw`Embed name must start with letter and be only letters and digits`;sU[e]=t};var i=n.AbstractMathQuill=J(oU,function(t){t.init=function(e){this.__controller=e,this.__options=e.options,this.id=e.id,this.data=e.data},t.parseLatex=function(e){return this.__controller.parseLatex(e)},t.__mathquillify=function(t){var n=this.__controller,r=n.root,i=n.container;n.createTextarea();var a=i.addClass(t).contents().detach();r.jQ=PH(`<span class="mq-root-block"/>`).attr(RH,r.id).appendTo(i),this.latex(a.text()),this.revert=function(){var t=i.empty().unbind(`.mathquill`).removeClass(`mq-editable-field mq-math-mode mq-text-mode`).append(a);return e>=3?t[0]:t}},t.config=function(e){return r(this.__options,e),this},t.el=function(){return this.__controller.container[0]},t.text=function(){return this.__controller.exportText()},t.latex=function(e){return arguments.length>0?(this.__controller.renderLatexMath(e),this.__controller.blurred&&this.__controller.cursor.hide().parent.blur(),this):this.__controller.exportLatex()},t.html=function(){return this.__controller.root.jQ.html().replace(/ mathquill-(?:command|block)-id="?\d+"?/g,``).replace(/<span class="?mq-cursor( mq-blink)?"?>.?<\/span>/i,``).replace(/ mq-hasCursor|mq-hasCursor ?/,``).replace(/ class=(""|(?= |>))/g,``)},t.reflow=function(){return this.__controller.root.postOrder(`reflow`),this}});for(var a in t.prototype=i.prototype,n.EditableField=J(i,function(e,t){e.__mathquillify=function(){return t.__mathquillify.apply(this,arguments),this.__controller.editable=!0,this.__controller.delegateMouseEvents(),this.__controller.editablesTextareaEvents(),this},e.focus=function(){return this.__controller.textarea.focus(),this},e.blur=function(){return this.__controller.textarea.blur(),this},e.write=function(e){return this.__controller.writeLatex(e),this.__controller.scrollHoriz(),this.__controller.blurred&&this.__controller.cursor.hide().parent.blur(),this},e.empty=function(){var e=this.__controller.root,t=this.__controller.cursor;return e.eachChild(`postOrder`,`dispose`),e.ends[Y]=e.ends[X]=0,e.jQ.empty(),delete t.selection,t.insAtRightEnd(e),this},e.cmd=function(e){var t=this.__controller.notify(),n=t.cursor;if(/^\\[a-z]+$/i.test(e)&&!n.isTooDeep()){e=e.slice(1);var r=Z[e];r&&(e=r(e),n.selection&&e.replaces(n.replaceSelection()),e.createLeftOf(n.show()),this.__controller.scrollHoriz())}else n.parent.write(n,e);return t.blurred&&n.hide().parent.blur(),this},e.select=function(){var e=this.__controller;for(e.notify(`move`).cursor.insAtRightEnd(e.root);e.cursor[Y];)e.selectLeft();return this},e.clearSelection=function(){return this.__controller.cursor.clearSelection(),this},e.moveToDirEnd=function(e){return this.__controller.notify(`move`).cursor.insAtDirEnd(e,this.__controller.root),this},e.moveToLeftEnd=function(){return this.moveToDirEnd(Y)},e.moveToRightEnd=function(){return this.moveToDirEnd(X)},e.keystroke=function(e){for(var e=e.replace(/^\s+|\s+$/g,``).split(/\s+/),t=0;t<e.length;t+=1)this.__controller.keystroke(e[t],{preventDefault:VH});return this},e.typedText=function(e){for(var t=0;t<e.length;t+=1)this.__controller.typedText(e.charAt(t));return this},e.dropEmbedded=function(e,t,n){var r=e-PH(window).scrollLeft(),i=t-PH(window).scrollTop(),a=document.elementFromPoint(r,i);this.__controller.seek(PH(a),e,t),_W().setOptions(n).createLeftOf(this.__controller.cursor)},e.clickAt=function(e,t,n){n||=document.elementFromPoint(e,t);var r=this.__controller,i=r.root;return FH.contains(i.jQ[0],n)||(n=i.jQ[0]),r.seek(PH(n),e+pageXOffset,t+pageYOffset),r.blurred&&this.focus(),this},e.ignoreNextMousedown=function(e){return this.__controller.cursor.options.ignoreNextMousedown=e,this}}),t.EditableField=function(){throw`wtf don't call me, I'm 'abstract'`},t.EditableField.prototype=n.EditableField.prototype,rU)(function(r,i){var a=n[r]=i(n);t[r]=function(n,i){var o=t(n);if(o instanceof a||!n||!n.nodeType)return o;var s=nU(a.RootBlock(),PH(n),iU());return s.KIND_OF_MQ=r,a(s).__mathquillify(i,e)},t[r].prototype=a.prototype})(a,rU[a]);return t}lU.noConflict=function(){return window.MathQuill=pU,lU};var pU=window.MathQuill;window.MathQuill=lU;function mU(e){for(var t=`moveOutOf deleteOutOf selectOutOf upOutOf downOutOf`.split(` `),n=0;n<t.length;n+=1)(function(t){e[t]=function(e){this.controller.handle(t,e)}})(t[n]);e.reflow=function(){this.controller.handle(`reflow`),this.controller.handle(`edited`),this.controller.handle(`edit`)}}var hU=J(function(e,t,n){function r(e,t){throw e=e?`'`+e+`'`:`EOF`,`Parse Error: `+t+` at `+e}e.init=function(e){this._=e},e.parse=function(e){return this.skip(o)._(``+e,t,r);function t(e,t){return t}},e.or=function(e){KH(`or is passed a parser`,e instanceof n);var t=this;return n(function(n,r,i){return t._(n,r,a);function a(t){return e._(n,r,i)}})},e.then=function(e){var t=this;return n(function(r,i,a){return t._(r,o,a);function o(t,r){var o=e instanceof n?e:e(r);return KH(`a parser is returned`,o instanceof n),o._(t,i,a)}})},e.many=function(){var e=this;return n(function(t,n,r){for(var i=[];e._(t,a,o););return n(t,i);function a(e,n){return t=e,i.push(n),!0}function o(){return!1}})},e.times=function(e,t){arguments.length<2&&(t=e);var r=this;return n(function(n,i,a){for(var o=[],s=!0,c,l=0;l<e;l+=1)if(s=r._(n,u,d),!s)return a(n,c);for(;l<t&&s;l+=1)s=r._(n,u,f);return i(n,o);function u(e,t){return o.push(t),n=e,!0}function d(e,t){return c=t,n=e,!1}function f(e,t){return!1}})},e.result=function(e){return this.then(a(e))},e.atMost=function(e){return this.times(0,e)},e.atLeast=function(e){var t=this;return t.times(e).then(function(e){return t.many().map(function(t){return e.concat(t)})})},e.map=function(e){return this.then(function(t){return a(e(t))})},e.skip=function(e){return this.then(function(t){return e.result(t)})},this.string=function(e){var t=e.length,r=`expected '`+e+`'`;return n(function(n,i,a){var o=n.slice(0,t);return o===e?i(n.slice(t),o):a(n,r)})};var i=this.regex=function(e){KH(`regexp parser is anchored`,e.toString().charAt(1)===`^`);var t=`expected `+e;return n(function(n,r,i){var a=e.exec(n);if(a){var o=a[0];return r(n.slice(o.length),o)}else return i(n,t)})},a=n.succeed=function(e){return n(function(t,n){return n(t,e)})};n.fail=function(e){return n(function(t,n,r){return r(t,e)})},n.letter=i(/^[a-z]/i),n.letters=i(/^[a-z]*/i),n.digit=i(/^[0-9]/),n.digits=i(/^[0-9]*/),n.whitespace=i(/^\s+/),n.optWhitespace=i(/^\s*/),n.any=n(function(e,t,n){return e?t(e.slice(1),e.charAt(0)):n(e,`expected any character`)}),n.all=n(function(e,t,n){return t(``,e)});var o=n.eof=n(function(e,t,n){return e?n(e,`expected EOF`):t(e,e)})}),gU=function(){var e={8:`Backspace`,9:`Tab`,10:`Enter`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,20:`CapsLock`,27:`Esc`,32:`Spacebar`,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`Left`,38:`Up`,39:`Right`,40:`Down`,45:`Insert`,46:`Del`,144:`NumLock`};function t(t){var n=t.which||t.keyCode,r=e[n],i,a=[];return t.ctrlKey&&a.push(`Ctrl`),t.originalEvent&&t.originalEvent.metaKey&&a.push(`Meta`),t.altKey&&a.push(`Alt`),t.shiftKey&&a.push(`Shift`),i=r||String.fromCharCode(n),!a.length&&!r?i:(a.push(i),a.join(`-`))}return function(e,n){var r=null,i=null,a=FH(e),o=FH(n.container||a),s=VH,c;function l(e){s=e,clearTimeout(c),c=setTimeout(e)}function u(e){l(function(t){s=VH,clearTimeout(c),e(t)})}o.bind(`keydown keypress input keyup focusout paste`,function(e){s(e)});function d(e){s(),s=VH,clearTimeout(c),a.val(e),e&&a[0]&&a[0].select&&a[0].select(),f=!!e}var f=!1;function p(){var e=a[0];return`selectionStart`in e&&e.selectionStart!==e.selectionEnd}function m(){n.keystroke(t(r),r)}function h(e){r=e,i=null,f&&u(function(e){!(e&&e.type===`focusout`)&&a[0]&&a[0].select&&a[0].select()}),m()}function g(e){r&&i&&m(),i=e,l(v)}function _(e){r&&!i&&l(v)}function v(){if(!p()){var e=a.val();e.length===1?(a.val(``),n.typedText(e)):e&&a[0]&&a[0].select&&a[0].select()}}function y(){r=i=null}function b(e){a.focus(),l(x)}function x(){var e=a.val();a.val(``),e&&n.paste(e)}return o.bind({keydown:h,keypress:g,keyup:_,focusout:y,cut:function(){u(function(){n.cut()})},copy:function(){u(function(){n.copy()})},paste:b}),{select:d}}}();nU.open(function(e,t){e.exportText=function(){return this.root.foldChildren(``,function(e,t){return e+t.text()})}}),nU.open(function(e){e.focusBlurEvents=function(){var e=this,t=e.root,n=e.cursor,r;e.textarea.focus(function(){e.blurred=!1,clearTimeout(r),e.container.addClass(`mq-focused`),n.parent||n.insAtRightEnd(t),n.selection?(n.selection.jQ.removeClass(`mq-blur`),e.selectionChanged()):n.show()}).blur(function(){e.blurred=!0,r=setTimeout(function(){t.postOrder(`intentionalBlur`),n.clearSelection().endSelection(),a()}),PH(window).bind(`blur`,i)});function i(){clearTimeout(r),n.selection&&n.selection.jQ.addClass(`mq-blur`),a()}function a(){n.hide().parent.blur(),e.container.removeClass(`mq-focused`),PH(window).unbind(`blur`,i)}e.blurred=!0,n.hide().parent.blur()}}),nU.open(function(e){e.keystroke=function(e,t){this.cursor.parent.keystroke(e,t,this)}}),YH.open(function(e){e.keystroke=function(e,t,n){var r=n.cursor;switch(e){case`Ctrl-Shift-Backspace`:case`Ctrl-Backspace`:n.ctrlDeleteDir(Y);break;case`Shift-Backspace`:case`Backspace`:n.backspace();break;case`Esc`:case`Tab`:n.escapeDir(X,e,t);return;case`Shift-Tab`:case`Shift-Esc`:n.escapeDir(Y,e,t);return;case`End`:n.notify(`move`).cursor.insAtRightEnd(r.parent);break;case`Ctrl-End`:n.notify(`move`).cursor.insAtRightEnd(n.root);break;case`Shift-End`:for(;r[X];)n.selectRight();break;case`Ctrl-Shift-End`:for(;r[X]||r.parent!==n.root;)n.selectRight();break;case`Home`:n.notify(`move`).cursor.insAtLeftEnd(r.parent);break;case`Ctrl-Home`:n.notify(`move`).cursor.insAtLeftEnd(n.root);break;case`Shift-Home`:for(;r[Y];)n.selectLeft();break;case`Ctrl-Shift-Home`:for(;r[Y]||r.parent!==n.root;)n.selectLeft();break;case`Left`:n.moveLeft();break;case`Shift-Left`:n.selectLeft();break;case`Ctrl-Left`:break;case`Right`:n.moveRight();break;case`Shift-Right`:n.selectRight();break;case`Ctrl-Right`:break;case`Up`:n.moveUp();break;case`Down`:n.moveDown();break;case`Shift-Up`:if(r[Y])for(;r[Y];)n.selectLeft();else n.selectLeft();case`Shift-Down`:if(r[X])for(;r[X];)n.selectRight();else n.selectRight();case`Ctrl-Up`:break;case`Ctrl-Down`:break;case`Ctrl-Shift-Del`:case`Ctrl-Del`:n.ctrlDeleteDir(X);break;case`Shift-Del`:case`Del`:n.deleteForward();break;case`Meta-A`:case`Ctrl-A`:for(n.notify(`move`).cursor.insAtRightEnd(n.root);r[Y];)n.selectLeft();break;default:return}t.preventDefault(),n.scrollHoriz()},e.moveOutOf=e.moveTowards=e.deleteOutOf=e.deleteTowards=e.unselectInto=e.selectOutOf=e.selectTowards=function(){KH(`overridden or never called on this node`)}}),nU.open(function(e){this.onNotify(function(e){(e===`move`||e===`upDown`)&&this.show().clearSelection()}),e.escapeDir=function(e,t,n){qH(e);var r=this.cursor;if(r.parent!==this.root&&n.preventDefault(),r.parent!==this.root)return r.parent.moveOutOf(e,r),this.notify(`move`)},aU.leftRightIntoCmdGoes=function(e){if(e&&e!==`up`&&e!==`down`)throw`"up" or "down" required for leftRightIntoCmdGoes option, got "`+e+`"`;return e},e.moveDir=function(e){qH(e);var t=this.cursor,n=t.options.leftRightIntoCmdGoes;return t.selection?t.insDirOf(e,t.selection.ends[e]):t[e]?t[e].moveTowards(e,t,n):t.parent.moveOutOf(e,t,n),this.notify(`move`)},e.moveLeft=function(){return this.moveDir(Y)},e.moveRight=function(){return this.moveDir(X)},e.moveUp=function(){return t(this,`up`)},e.moveDown=function(){return t(this,`down`)};function t(e,t){var n=e.notify(`upDown`).cursor,r=t+`Into`,i=t+`OutOf`;return n[X][r]?n.insAtLeftEnd(n[X][r]):n[Y][r]?n.insAtRightEnd(n[Y][r]):n.parent.bubble(function(e){var t=e[i];if(t&&(typeof t==`function`&&(t=e[i](n)),t instanceof YH&&n.jumpUpDown(e,t),t!==!0))return!1}),e}this.onNotify(function(e){e!==`upDown`&&(this.upDownCache={})}),this.onNotify(function(e){e===`edit`&&this.show().deleteSelection()}),e.deleteDir=function(e){qH(e);var t=this.cursor,n=t.selection;return this.notify(`edit`),n||(t[e]?t[e].deleteTowards(e,t):t.parent.deleteOutOf(e,t)),t[Y].siblingDeleted&&t[Y].siblingDeleted(t.options,X),t[X].siblingDeleted&&t[X].siblingDeleted(t.options,Y),t.parent.bubble(`reflow`),this},e.ctrlDeleteDir=function(e){qH(e);var t=this.cursor;return!t[e]||t.selection?this.deleteDir(e):(this.notify(`edit`),e===Y?ZH(t.parent.ends[Y],t[Y]).remove():ZH(t[X],t.parent.ends[X]).remove(),t.insAtDirEnd(e,t.parent),t[Y].siblingDeleted&&t[Y].siblingDeleted(t.options,X),t[X].siblingDeleted&&t[X].siblingDeleted(t.options,Y),t.parent.bubble(`reflow`),this)},e.backspace=function(){return this.deleteDir(Y)},e.deleteForward=function(){return this.deleteDir(X)},this.onNotify(function(e){e!==`select`&&this.endSelection()}),e.selectDir=function(e){var t=this.notify(`select`).cursor,n=t.selection;qH(e),t.anticursor||t.startSelection();var r=t[e];r?n&&n.ends[e]===r&&t.anticursor[-e]!==r?r.unselectInto(e,t):r.selectTowards(e,t):t.parent.selectOutOf(e,t),t.clearSelection(),t.select()||t.show()},e.selectLeft=function(){return this.selectDir(Y)},e.selectRight=function(){return this.selectDir(X)}});var _U=/[\\]{2,}/gm,vU=(function(){function e(e){var t=SU();return e.adopt(t,0,0),t}function t(e){for(var t=e[0]||SU(),n=1;n<e.length;n+=1)e[n].children().adopt(t,t.ends[X],0);return t}var n=hU.string,r=hU.regex,i=hU.letter,a=hU.any,o=hU.optWhitespace,s=hU.succeed,c=hU.fail,l=i.map(function(e){return jU(e)}),u=r(/^[^${}\\_^]/).map(function(e){return Q(e)}),d=r(/^\\not\\[a-z]+/).then(function(e){return $H[e]&&$H[e]().parser()||c(`unknown compound command: `+e)}),f=r(/^[^\\a-eg-zA-Z]/).or(n(`\\`).then(r(/^begin\{.?matrix\}/).or(r(/^[a-z]+/i)).or(r(/^\s+/).result(` `)).or(a))).then(function(e){e=e.replace(/^begin\{(.?matrix)\}$/,`$1`);var t=Z[e];return t?t(e).parser():c(`unknown command: \\`+e)}),p=d.or(f).or(l).or(u),m=n(`{`).then(function(){return g}).skip(n(`}`)),h=o.then(m.or(p.map(e))),g=h.many().map(t).skip(o),_=n(`[`).then(h.then(function(e){return e.join(`latex`)===`]`?c():s(e)}).many().map(t).skip(o)).skip(n(`]`)),v=g;return v.block=h,v.optBlock=_,v})();nU.open(function(e,t){e.exportLatex=function(){return this.root.latex().replace(/(\\[a-z]+) (?![a-z])/gi,`$1`)},e.parseLatex=function(e){return vU.parse(e).postOrder(`finalizeTree`,iU.p).join(`latex`).trim()},aU.maxDepth=function(e){return typeof e==`number`?e:IH},e.writeLatex=function(e){var t=this.notify(`edit`).cursor,n=hU.all,r=hU.eof,i=vU.skip(r).or(n.result(!1)).parse(e);return i&&!i.isEmpty()&&i.prepareInsertionAt(t)&&(i.children().adopt(t.parent,t[Y],t[X]),i.jQize().insertBefore(t.jQ),t[Y]=i.ends[X],i.finalizeInsert(t.options,t),i.ends[X][X].siblingCreated&&i.ends[X][X].siblingCreated(t.options,Y),i.ends[Y][Y].siblingCreated&&i.ends[Y][Y].siblingCreated(t.options,X),t.parent.bubble(`reflow`)),this},e.renderLatexMath=function(e){e&&e.replace&&(e=e.replace(_U,`\\`));var t=this.root,n=this.cursor;n.options;var r=t.jQ,i=hU.all,a=hU.eof,o=vU.skip(a).or(i.result(!1)).parse(e);if(t.eachChild(`postOrder`,`dispose`),t.ends[Y]=t.ends[X]=0,o&&o.prepareInsertionAt(n)){o.children().adopt(t,0,0);var s=o.join(`html`);r.html(s),t.jQize(r.children()),t.finalizeInsert(n.options)}else r.empty();delete n.selection,n.insAtRightEnd(t)},e.renderLatexText=function(e){var t=this.root,n=this.cursor;t.jQ.children().slice(1).remove(),t.eachChild(`postOrder`,`dispose`),t.ends[Y]=t.ends[X]=0,delete n.selection,n.show().insAtRightEnd(t);var r=hU.regex,i=hU.string,a=hU.eof,o=hU.all,s=i(`$`).then(vU).skip(i(`$`).or(a)).map(function(e){var t=DU(n);t.createBlocks();var r=t.ends[Y];return e.children().adopt(r,0,0),t}),c=i(`\\$`).result(`$`).or(r(/^[^$]/)).map(Q),l=s.or(c).many().skip(a).or(o.result(!1)).parse(e);if(l){for(var u=0;u<l.length;u+=1)l[u].adopt(t,t.ends[X],0);t.jQize().appendTo(t.jQ),t.finalizeInsert(n.options)}}}),nU.open(function(e){iU.p.ignoreNextMousedown=VH,e.delegateMouseEvents=function(){var e=this.root.jQ;this.container.bind(`mousedown.mathquill`,function(t){var n=PH(t.target).closest(`.mq-root-block`),r=YH.byId[n.attr(RH)||e.attr(RH)].controller,i=r.cursor;i.blink;var a=r.textareaSpan,o=r.textarea;if(t.preventDefault(),t.target.unselectable=!0,i.options.ignoreNextMousedown(t))return;i.options.ignoreNextMousedown=VH;function s(e){i.anticursor||i.startSelection(),r.seek(PH(e.target),e.pageX,e.pageY).cursor.select(),e.target&&PH(e.target.ownerDocument).unbind(`mousemove`,c)}function c(e){return delete e.target,s(e)}function l(e){!i.selection&&!r.editable&&a.detach(),n.unbind(`mousemove`,s),PH(e.target.ownerDocument).unbind(`mousemove`,c).unbind(`mouseup`,l)}if(a.parent().length===0)return!1;r.blurred&&(r.editable||n.prepend(a),document.body.focus(),o.focus()),t.preventDefault(),t.target.unselectable=!0,i.show(),r.seek(PH(t.target),t.pageX,t.pageY).cursor.startSelection(),n.mousemove(s),PH(t.target.ownerDocument).mousemove(c).mouseup(l)})}}),nU.open(function(e){e.seek=function(e,t,n){var r=this.notify(`select`).cursor;if(e){var i=e.attr(RH)||e.attr(LH);if(!i){var a=e.parent();i=a.attr(RH)||a.attr(LH)}}var o=i&&YH.byId[i]?YH.byId[i]:this.root;return r.clearSelection().show(),o.seek(t,r),this.scrollHoriz(),this}}),nU.open(function(e){e.scrollHoriz=function(){var e=this.cursor,t=e.selection,n=this.root.jQ[0].getBoundingClientRect();if(t){var r=t.jQ[0].getBoundingClientRect(),i=r.left-(n.left+20),a=r.right-(n.right-20);if(t.ends[Y]===e[X])if(i<0)var o=i;else if(a>0)if(r.left-a<n.left+20)var o=i;else var o=a;else return;else if(a>0)var o=a;else if(i<0)if(r.right-i>n.right-20)var o=a;else var o=i;else return}else{var s=e.jQ[0].getBoundingClientRect().left;if(s>n.right-20)var o=s-(n.right-20);else if(s<n.left+20)var o=s-(n.left+20);else return}this.root.jQ.stop&&typeof this.root.jQ.stop==`function`&&this.root.jQ.stop().animate({scrollLeft:`+=`+o},100)}}),nU.open(function(e){iU.p.substituteTextarea=function(){return PH(`<textarea autocapitalize=off autocomplete=off autocorrect=off spellcheck=false x-palm-disable-ste-all=true />`)[0]},e.createTextarea=function(){var e=this.textareaSpan=PH(`<span class="mq-textarea"></span>`),t=this.options.substituteTextarea();if(!t.nodeType)throw`substituteTextarea() must return a DOM element, got `+t;t=this.textarea=PH(t).appendTo(e);var n=this;n.cursor.selectionChanged=function(){n.selectionChanged()}},e.selectionChanged=function(){var e=this;GU(e.container[0]),e.textareaSelectionTimeout===IH&&(e.textareaSelectionTimeout=setTimeout(function(){e.setTextareaSelection()}))},e.setTextareaSelection=function(){this.textareaSelectionTimeout=IH;var e=``;this.cursor.selection&&(e=this.cursor.selection.join(`latex`),this.options.statelessClipboard&&(e=`$`+e+`$`)),this.selectFn(e)},e.staticMathTextareaEvents=function(){var e=this;e.root;var t=e.cursor,n=e.textarea,r=e.textareaSpan;this.container.prepend(FH(`<span class="mq-selectable">`).text(`$`+e.exportLatex()+`$`)),e.blurred=!0,n.bind(`cut paste`,!1).bind(`copy`,function(){e.setTextareaSelection()}).focus(function(){e.blurred=!1}).blur(function(){t.selection&&t.selection.clear(),setTimeout(i)});function i(){r.detach(),e.blurred=!0}e.selectFn=function(e){n.val(e),e&&n.select()}},iU.p.substituteKeyboardEvents=gU,e.editablesTextareaEvents=function(){var e=this,t=e.textarea,n=e.textareaSpan,r=this.options.substituteKeyboardEvents(t,this);this.selectFn=function(e){r.select(e)},this.container.prepend(n),this.focusBlurEvents()},e.typedText=function(e){if(e===`
|
|
302
|
-
`)return this.handle(`enter`);var t=this.notify().cursor;t.parent.write(t,e),this.scrollHoriz()},e.cut=function(){var e=this,t=e.cursor;t.selection&&setTimeout(function(){e.notify(`edit`),t.parent.bubble(`reflow`)})},e.copy=function(){this.setTextareaSelection()},e.paste=function(e){this.options.statelessClipboard&&(e=e.slice(0,1)===`$`&&e.slice(-1)===`$`?e.slice(1,-1):`\\text{`+e+`}`),this.writeLatex(e).cursor.show()}});var yU=J(YH,function(e,t){e.finalizeInsert=function(e,t){var n=this;n.postOrder(`finalizeTree`,e),n.postOrder(`contactWeld`,t),n.postOrder(`blur`),n.postOrder(`reflow`),n[X].siblingCreated&&n[X].siblingCreated(e,Y),n[Y].siblingCreated&&n[Y].siblingCreated(e,X),n.bubble(`reflow`)},e.prepareInsertionAt=function(e){var t=e.options.maxDepth;if(t!==IH){var n=e.depth();if(n>t)return!1;this.removeNodesDeeperThan(t-n)}return!0},e.removeNodesDeeperThan=function(e){for(var t=0,n=[[this,t]],r;n.length;)r=n.shift(),r[0].children().each(function(i){var a=+(i instanceof SU);t=r[1]+a,t<=e?n.push([i,t]):(a?i.children():i).remove()})}}),bU=J(yU,function(e,t){e.init=function(e,n,r){var i=this;t.init.call(i),i.ctrlSeq||=e,n&&(i.htmlTemplate=n),r&&(i.textTemplate=r)},e.replaces=function(e){e.disown(),this.replacedFragment=e},e.isEmpty=function(){return this.foldChildren(!0,function(e,t){return e&&t.isEmpty()})},e.parser=function(){var e=vU.block,t=this;return e.times(t.numBlocks()).map(function(e){t.blocks=e;for(var n=0;n<e.length;n+=1)e[n].adopt(t,t.ends[X],0);return t})},e.createLeftOf=function(e){var n=this,r=n.replacedFragment;n.createBlocks(),t.createLeftOf.call(n,e),r&&(r.adopt(n.ends[Y],0,0),r.jQ.appendTo(n.ends[Y].jQ),n.placeCursor(e),n.prepareInsertionAt(e)),n.finalizeInsert(e.options),n.placeCursor(e)},e.createBlocks=function(){for(var e=this,t=e.numBlocks(),n=e.blocks=Array(t),r=0;r<t;r+=1)(n[r]=SU()).adopt(e,e.ends[X],0)},e.placeCursor=function(e){e.insAtRightEnd(this.foldChildren(this.ends[Y],function(e,t){return e.isEmpty()?e:t}))},e.moveTowards=function(e,t,n){var r=n&&this[n+`Into`];t.insAtDirEnd(-e,r||this.ends[-e])},e.deleteTowards=function(e,t){this.isEmpty()?t[e]=this.remove()[e]:this.moveTowards(e,t,null)},e.selectTowards=function(e,t){t[-e]=this,t[e]=this[e]},e.selectChildren=function(){return tU(this,this)},e.unselectInto=function(e,t){t.insAtDirEnd(-e,t.anticursor.ancestors[this.id])},e.seek=function(e,t){function n(e){var t={};return t[Y]=e.jQ.offset().left,t[X]=t[Y]+e.jQ.outerWidth(),t}var r=this,i=n(r);if(e<i[Y])return t.insLeftOf(r);if(e>i[X])return t.insRightOf(r);var a=i[Y];r.eachChild(function(o){var s=n(o);if(e<s[Y])return e-a<s[Y]-e?o[Y]?t.insAtRightEnd(o[Y]):t.insLeftOf(r):t.insAtLeftEnd(o),!1;if(e>s[X])o[X]?a=s[X]:i[X]-e<e-s[X]?t.insRightOf(r):t.insAtRightEnd(o);else return o.seek(e,t),!1})},e.numBlocks=function(){var e=this.htmlTemplate.match(/&\d+/g);return e?e.length:0},e.html=function(){var e=this,t=e.blocks,n=` mathquill-command-id=`+e.id,r=e.htmlTemplate.match(/<[^<>]+>|[^<>]+/g);KH(`no unmatched angle brackets`,r.join(``)===this.htmlTemplate);for(var i=0,a=r[0];a;i+=1,a=r[i])if(a.slice(-2)===`/>`)r[i]=a.slice(0,-2)+n+`/>`;else if(a.charAt(0)===`<`){KH(`not an unmatched top-level close tag`,a.charAt(1)!==`/`),r[i]=a.slice(0,-1)+n+`>`;var o=1;do i+=1,a=r[i],KH(`no missing close tags`,a),a.slice(0,2)===`</`?--o:a.charAt(0)===`<`&&a.slice(-2)!==`/>`&&(o+=1);while(o>0)}return r.join(``).replace(/>&(\d+)/g,function(e,n){return` mathquill-block-id=`+t[n].id+`>`+t[n].join(`html`)})},e.latex=function(){return this.foldChildren(this.ctrlSeq,function(e,t){return e+`{`+(t.latex()||` `)+`}`})},e.textTemplate=[``],e.text=function(){var e=this,t=0;return e.foldChildren(e.textTemplate[t],function(n,r){t+=1;var i=r.text();return n&&e.textTemplate[t]===`(`&&i[0]===`(`&&i.slice(-1)===`)`?n+i.slice(1,-1)+e.textTemplate[t]:n+i+(e.textTemplate[t]||``)})}}),xU=J(bU,function(e,t){e.init=function(e,n,r){r||=e&&e.length>1?e.slice(1):e,t.init.call(this,e,n,[r])},e.parser=function(){return hU.succeed(this)},e.numBlocks=function(){return 0},e.replaces=function(e){e.remove()},e.createBlocks=VH,e.moveTowards=function(e,t){t.jQ.insDirOf(e,this.jQ),t[-e]=this,t[e]=this[e]},e.deleteTowards=function(e,t){t[e]=this.remove()[e]},e.seek=function(e,t){e-this.jQ.offset().left<this.jQ.outerWidth()/2?t.insLeftOf(this):t.insRightOf(this)},e.latex=function(){return this.ctrlSeq},e.text=function(){return this.textTemplate},e.placeCursor=VH,e.isEmpty=function(){return!0}}),Q=J(xU,function(e,t){e.init=function(e,n){t.init.call(this,e,`<span>`+(n||e)+`</span>`)}}),$=J(xU,function(e,t){e.init=function(e,n,r){t.init.call(this,e,`<span class="mq-binary-operator">`+n+`</span>`,r)}}),SU=J(yU,function(e,t){e.join=function(e){return this.foldChildren(``,function(t,n){return t+n[e]()})},e.html=function(){return this.join(`html`)},e.latex=function(){return this.join(`latex`)},e.text=function(){return this.ends[Y]===this.ends[X]&&this.ends[Y]!==0?this.ends[Y].text():this.join(`text`)},e.keystroke=function(e,n,r){if(r.options.spaceBehavesLikeTab&&(e===`Spacebar`||e===`Shift-Spacebar`)){n.preventDefault(),r.escapeDir(e===`Shift-Spacebar`?Y:X,e,n);return}return t.keystroke.apply(this,arguments)},e.moveOutOf=function(e,t,n){!(n&&this.parent[n+`Into`])&&this[e]?t.insAtDirEnd(-e,this[e]):t.insDirOf(e,this.parent)},e.selectOutOf=function(e,t){t.insDirOf(e,this.parent)},e.deleteOutOf=function(e,t){t.unwrapGramp()},e.seek=function(e,t){var n=this.ends[X];if(!n||n.jQ.offset().left+n.jQ.outerWidth()<e)return t.insAtRightEnd(this);if(e<this.ends[Y].jQ.offset().left)return t.insAtLeftEnd(this);for(;e<n.jQ.offset().left;)n=n[Y];return n.seek(e,t)},e.chToCmd=function(e,t){var n;return e.match(/^[a-eg-zA-Z]$/)?jU(e):/^\d$/.test(e)?kU(e):t&&t.typingSlashWritesDivisionSymbol&&e===`/`?Z[`÷`](e):t&&t.typingAsteriskWritesTimesSymbol&&e===`*`?Z[`×`](e):(n=QH[e]||Z[e])?n(e):Q(e)},e.write=function(e,t){var n;if(e.tooDeep())return!1;n=this.chToCmd(t,e.options),e.selection&&n.replaces(e.replaceSelection()),e.isTooDeep()||n.createLeftOf(e.show())},e.focus=function(){return this.jQ.addClass(`mq-hasCursor`),this.jQ.removeClass(`mq-empty`),this},e.blur=function(){return this.jQ.removeClass(`mq-hasCursor`),this.isEmpty()&&this.jQ.addClass(`mq-empty`),this}});iU.p.mouseEvents=!0,rU.StaticMath=function(e){return J(e.AbstractMathQuill,function(t,n){this.RootBlock=SU,t.__mathquillify=function(e,t){return this.config(e),n.__mathquillify.call(this,`mq-math-mode`),this.__options.mouseEvents&&(this.__controller.delegateMouseEvents(),this.__controller.staticMathTextareaEvents()),this},t.init=function(){n.init.apply(this,arguments),this.__controller.root.postOrder(`registerInnerField`,this.innerFields=[],e.MathField)},t.latex=function(){var t=n.latex.apply(this,arguments);return arguments.length>0&&this.__controller.root.postOrder(`registerInnerField`,this.innerFields=[],e.MathField),t}})};var CU=J(SU,mU);rU.MathField=function(e){return J(e.EditableField,function(e,t){this.RootBlock=CU,e.__mathquillify=function(e,n){return this.config(e),n>1&&(this.__controller.root.reflow=VH),t.__mathquillify.call(this,`mq-editable-field mq-math-mode`),delete this.__controller.root.reflow,this}})};var wU=J(YH,function(e,t){e.ctrlSeq=`\\text`,e.replaces=function(e){e instanceof ZH?this.replacedText=e.remove().jQ.text():typeof e==`string`&&(this.replacedText=e)},e.jQadd=function(e){t.jQadd.call(this,e),this.ends[Y]&&this.ends[Y].jQadd(this.jQ[0].firstChild)},e.createLeftOf=function(e){var n=this;if(t.createLeftOf.call(this,e),n[X].siblingCreated&&n[X].siblingCreated(e.options,Y),n[Y].siblingCreated&&n[Y].siblingCreated(e.options,X),n.bubble(`reflow`),e.insAtRightEnd(n),n.replacedText)for(var r=0;r<n.replacedText.length;r+=1)n.write(e,n.replacedText.charAt(r))},e.parser=function(){var e=this,t=hU.string,n=hU.regex;return hU.optWhitespace.then(t(`{`)).then(n(/^[^}]*/)).skip(t(`}`)).map(function(t){return t.length===0?ZH():(TU(t).adopt(e,0,0),e)})},e.textContents=function(){return this.foldChildren(``,function(e,t){return e+t.text})},e.text=function(){return`"`+this.textContents()+`"`},e.latex=function(){var e=this.textContents();return e.length===0?``:`\\text{`+e.replace(/\\/g,`\\backslash `).replace(/[{}]/g,`\\$&`)+`}`},e.html=function(){return`<span class="mq-text-mode" mathquill-command-id=`+this.id+`>`+this.textContents()+`</span>`},e.moveTowards=function(e,t){t.insAtDirEnd(-e,this)},e.moveOutOf=function(e,t){t.insDirOf(e,this)},e.unselectInto=e.moveTowards,e.selectTowards=bU.prototype.selectTowards,e.deleteTowards=bU.prototype.deleteTowards,e.selectOutOf=function(e,t){t.insDirOf(e,this)},e.deleteOutOf=function(e,t){this.isEmpty()&&t.insRightOf(this)},e.write=function(e,n){if(e.show().deleteSelection(),n!==`$`)e[Y]?(e[Y].appendText(n),this.bubble(`reflow`)):TU(n).createLeftOf(e);else if(this.isEmpty())e.insRightOf(this),Q(`\\$`,`$`).createLeftOf(e);else if(!e[X])e.insRightOf(this);else if(!e[Y])e.insLeftOf(this);else{var r=wU(),i=this.ends[Y];i.disown().jQ.detach(),i.adopt(r,0,0),e.insLeftOf(this),t.createLeftOf.call(r,e)}},e.seek=function(e,t){t.hide();var r=n(this),i=this.jQ.width()/this.text.length,a=Math.round((e-this.jQ.offset().left)/i);a<=0?t.insAtLeftEnd(this):a>=r.text.length?t.insAtRightEnd(this):t.insLeftOf(r.splitRight(a));for(var o=e-t.show().offset().left,s=o&&o<0?Y:X,c=s;t[s]&&o*c>0;)t[s].moveTowards(s,t),c=o,o=e-t.offset().left;if(s*o<-s*c&&t[-s].moveTowards(-s,t),!t.anticursor)this.anticursorPosition=t[Y]&&t[Y].text.length;else if(t.anticursor.parent===this){var l=t[Y]&&t[Y].text.length;if(this.anticursorPosition===l)t.anticursor=JH.copy(t);else{if(this.anticursorPosition<l){var u=t[Y].splitRight(this.anticursorPosition);t[Y]=u}else var u=t[X].splitRight(this.anticursorPosition-l);t.anticursor=JH(this,u[Y],u)}}},e.blur=function(e){SU.prototype.blur.call(this),e&&(this.textContents()===``?(this.remove(),e[Y]===this?e[Y]=this[Y]:e[X]===this&&(e[X]=this[X])):n(this))};function n(e){e.jQ[0].normalize();var t=e.jQ.contents().filter(function(e,t){return t.nodeType===3})[0];t||={data:``},KH(`only node in TextBlock span is Text node`,t.nodeType===3);var n=TU(t.data);return n.jQadd(t),e.children().disown(),n.adopt(e,0,0)}e.focus=SU.prototype.focus}),TU=J(YH,function(e,t){e.init=function(e){t.init.call(this),this.text=e},e.jQadd=function(e){this.dom=e,this.jQ=PH(e)},e.jQize=function(){return this.jQadd(document.createTextNode(this.text))},e.appendText=function(e){this.text+=e,this.dom.appendData(e)},e.prependText=function(e){this.text=e+this.text,this.dom.insertData(0,e)},e.insTextAtDirEnd=function(e,t){qH(t),t===X?this.appendText(e):this.prependText(e)},e.splitRight=function(e){var t=TU(this.text.slice(e)).adopt(this.parent,this,this[X]);return t.jQadd(this.dom.splitText(e)),this.text=this.text.slice(0,e),t};function n(e,t){return t.charAt(e===Y?0:-1+t.length)}e.moveTowards=function(e,t){qH(e);var r=n(-e,this.text),i=this[-e];return i?i.insTextAtDirEnd(r,e):TU(r).createDir(-e,t),this.deleteTowards(e,t)},e.latex=function(){return this.text},e.deleteTowards=function(e,t){this.text.length>1?e===X?(this.dom.deleteData(0,1),this.text=this.text.slice(1)):(this.dom.deleteData(-1+this.text.length,1),this.text=this.text.slice(0,-1)):(this.remove(),this.jQ.remove(),t[e]=this[e])},e.selectTowards=function(e,t){qH(e);var r=t.anticursor,i=n(-e,this.text);if(r[e]===this){var a=TU(i).createDir(e,t);r[e]=a,t.insDirOf(e,a)}else{var o=this[-e];if(o)o.insTextAtDirEnd(i,e);else{var a=TU(i).createDir(-e,t);a.jQ.insDirOf(-e,t.selection.jQ)}this.text.length===1&&r[-e]===this&&(r[-e]=this[-e])}return this.deleteTowards(e,t)}});Z.text=Z.textnormal=Z.textrm=Z.textup=Z.textmd=wU;function EU(e,t,n){return J(wU,{ctrlSeq:e,htmlTemplate:`<`+t+` `+n+`>&0</`+t+`>`})}Z.em=Z.italic=Z.italics=Z.emph=Z.textit=Z.textsl=EU(`\\textit`,`i`,`class="mq-text-mode"`),Z.strong=Z.bold=Z.textbf=EU(`\\textbf`,`b`,`class="mq-text-mode"`),Z.sf=Z.textsf=EU(`\\textsf`,`span`,`class="mq-sans-serif mq-text-mode"`),Z.tt=Z.texttt=EU(`\\texttt`,`span`,`class="mq-monospace mq-text-mode"`),Z.textsc=EU(`\\textsc`,`span`,`style="font-variant:small-caps" class="mq-text-mode"`),Z.uppercase=EU(`\\uppercase`,`span`,`style="text-transform:uppercase" class="mq-text-mode"`),Z.lowercase=EU(`\\lowercase`,`span`,`style="text-transform:lowercase" class="mq-text-mode"`);var DU=J(bU,function(e,t){e.init=function(e){t.init.call(this,`$`),this.cursor=e},e.htmlTemplate=`<span class="mq-math-mode">&0</span>`,e.createBlocks=function(){t.createBlocks.call(this),this.ends[Y].cursor=this.cursor,this.ends[Y].write=function(e,t){t===`$`?this.isEmpty()?(e.insRightOf(this.parent),this.parent.deleteTowards(dir,e),Q(`\\$`,`$`).createLeftOf(e.show())):e[X]?e[Y]?SU.prototype.write.call(this,e,t):e.insLeftOf(this.parent):e.insRightOf(this.parent):SU.prototype.write.call(this,e,t)}},e.latex=function(){return`$`+this.ends[Y].latex()+`$`}}),OU=J(CU,function(e,t){e.keystroke=function(e){if(!(e===`Spacebar`||e===`Shift-Spacebar`))return t.keystroke.apply(this,arguments)},e.write=function(e,t){if(e.show().deleteSelection(),t===`$`)DU(e).createLeftOf(e);else{var n;t===`<`?n=`<`:t===`>`&&(n=`>`),Q(t,n).createLeftOf(e)}}});rU.TextField=function(e){return J(e.EditableField,function(e,t){this.RootBlock=OU,e.__mathquillify=function(){return t.__mathquillify.call(this,`mq-editable-field mq-text-mode`)},e.latex=function(e){return arguments.length>0?(this.__controller.renderLatexText(e),this.__controller.blurred&&this.__controller.cursor.hide().parent.blur(),this):this.__controller.exportLatex()}})},QH[`\\`]=J(bU,function(e,t){e.ctrlSeq=`\\`,e.replaces=function(e){this._replacedFragment=e.disown(),this.isEmpty=function(){return!1}},e.htmlTemplate=`<span class="mq-latex-command-input mq-non-leaf">\\<span>&0</span></span>`,e.textTemplate=[`\\`],e.createBlocks=function(){t.createBlocks.call(this),this.ends[Y].focus=function(){return this.parent.jQ.addClass(`mq-hasCursor`),this.isEmpty()&&this.parent.jQ.removeClass(`mq-empty`),this},this.ends[Y].blur=function(){return this.parent.jQ.removeClass(`mq-hasCursor`),this.isEmpty()&&this.parent.jQ.addClass(`mq-empty`),this},this.ends[Y].write=function(e,t){e.show().deleteSelection(),t.match(/[a-z]/i)?Q(t).createLeftOf(e):(this.parent.renderCommand(e),(t!==`\\`||!this.isEmpty())&&e.parent.write(e,t))},this.ends[Y].keystroke=function(e,n,r){if(e===`Tab`||e===`Enter`||e===`Spacebar`){this.parent.renderCommand(r.cursor),n.preventDefault();return}return t.keystroke.apply(this,arguments)}},e.createLeftOf=function(e){if(t.createLeftOf.call(this,e),this._replacedFragment){var n=this.jQ[0];this.jQ=this._replacedFragment.jQ.addClass(`mq-blur`).bind(`mousedown mousemove`,function(e){return PH(e.target=n).trigger(e),!1}).insertBefore(this.jQ).add(this.jQ)}},e.latex=function(){return`\\`+this.ends[Y].latex()+` `},e.renderCommand=function(e){this.jQ=this.jQ.last(),this.remove(),this[X]?e.insLeftOf(this[X]):e.insAtRightEnd(this.parent);var t=this.ends[Y].latex();t||=` `;var n=Z[t];n?(n=n(t),this._replacedFragment&&n.replaces(this._replacedFragment),n.createLeftOf(e)):(n=wU(),n.replaces(t),n.createLeftOf(e),e.insRightOf(n),this._replacedFragment&&this._replacedFragment.remove())}}),Z[`∉`]=Z.notin=q($,`\\notin `,`∉`),Z[`≅`]=Z.cong=q($,`\\cong `,`≅`),Z[`≡`]=Z.equiv=q($,`\\equiv `,`≡`),Z[`⊕`]=Z.oplus=q($,`\\oplus `,`⊕`),Z[`⊗`]=Z.otimes=q($,`\\otimes `,`⊗`),Z[`≠`]=Z.ne=Z.neq=q($,`\\ne `,`≠`),Z[`≇`]=Z.ncong=q($,`\\ncong `,`≇`),Z[`∗`]=Z.ast=Z.star=Z.loast=Z.lowast=q($,`\\ast `,`∗`),Z.therefor=Z.therefore=q($,`\\therefore `,`∴`),Z.cuz=Z.because=q($,`\\because `,`∵`),Z.prop=Z.propto=q($,`\\propto `,`∝`),Z[`≈`]=Z.asymp=Z.approx=q($,`\\approx `,`≈`),Z[`≉`]=Z.nasymp=Z.napprox=q($,`\\napprox `,`≉`),Z.isin=Z.in=q($,`\\in `,`∈`),Z.ni=Z.contains=q($,`\\ni `,`∋`),Z.notni=Z.niton=Z.notcontains=Z.doesnotcontain=$H[`\\not\\ni`]=q($,`\\not\\ni `,`∌`),Z.sub=Z.subset=q($,`\\subset `,`⊂`),Z.sup=Z.supset=Z.superset=q($,`\\supset `,`⊃`),Z.nsub=Z.notsub=Z.nsubset=Z.notsubset=$H[`\\not\\subset`]=q($,`\\not\\subset `,`⊄`),Z.nsup=Z.notsup=Z.nsupset=Z.notsupset=Z.nsuperset=Z.notsuperset=$H[`\\not\\supset`]=q($,`\\not\\supset `,`⊅`),Z.sube=Z.subeq=Z.subsete=Z.subseteq=q($,`\\subseteq `,`⊆`),Z.supe=Z.supeq=Z.supsete=Z.supseteq=Z.supersete=Z.superseteq=q($,`\\supseteq `,`⊇`),Z.nsube=Z.nsubeq=Z.notsube=Z.notsubeq=Z.nsubsete=Z.nsubseteq=Z.notsubsete=Z.notsubseteq=$H[`\\not\\subseteq`]=q($,`\\not\\subseteq `,`⊈`),Z.nsupe=Z.nsupeq=Z.notsupe=Z.notsupeq=Z.nsupsete=Z.nsupseteq=Z.notsupsete=Z.notsupseteq=Z.nsupersete=Z.nsuperseteq=Z.notsupersete=Z.notsuperseteq=$H[`\\not\\supseteq`]=q($,`\\not\\supseteq `,`⊉`),Z.N=Z.naturals=Z.Naturals=q(Q,`\\mathbb{N}`,`ℕ`),Z.P=Z.primes=Z.Primes=Z.projective=Z.Projective=Z.probability=Z.Probability=q(Q,`\\mathbb{P}`,`ℙ`),Z.Z=Z.integers=Z.Integers=q(Q,`\\mathbb{Z}`,`ℤ`),Z.Q=Z.rationals=Z.Rationals=q(Q,`\\mathbb{Q}`,`ℚ`),Z.R=Z.reals=Z.Reals=q(Q,`\\mathbb{R}`,`ℝ`),Z.C=Z.complex=Z.Complex=Z.complexes=Z.Complexes=Z.complexplane=Z.Complexplane=Z.ComplexPlane=q(Q,`\\mathbb{C}`,`ℂ`),Z.H=Z.Hamiltonian=Z.quaternions=Z.Quaternions=q(Q,`\\mathbb{H}`,`ℍ`),Z.quad=Z.emsp=q(Q,`\\quad `,` `),Z.qquad=q(Q,`\\qquad `,` `),Z.diamond=q(Q,`\\diamond `,`◇`),Z.bigtriangleup=q(Q,`\\bigtriangleup `,`△`),Z.ominus=q(Q,`\\ominus `,`⊖`),Z.uplus=q(Q,`\\uplus `,`⊎`),Z.bigtriangledown=q(Q,`\\bigtriangledown `,`▽`),Z.sqcap=q(Q,`\\sqcap `,`⊓`),Z.triangleleft=q(Q,`\\triangleleft `,`⊲`),Z.sqcup=q(Q,`\\sqcup `,`⊔`),Z.triangleright=q(Q,`\\triangleright `,`⊳`),Z.odot=Z.circledot=q(Q,`\\odot `,`⊙`),Z.bigcirc=q(Q,`\\bigcirc `,`◯`),Z.dagger=q(Q,`\\dagger `,`†`),Z.ddagger=q(Q,`\\ddagger `,`‡`),Z.wr=q(Q,`\\wr `,`≀`),Z.amalg=q(Q,`\\amalg `,`∐`),Z.models=q(Q,`\\models `,`⊨`),Z.prec=q(Q,`\\prec `,`≺`),Z.succ=q(Q,`\\succ `,`≻`),Z.preceq=q(Q,`\\preceq `,`≼`),Z.succeq=q(Q,`\\succeq `,`≽`),Z.simeq=q(Q,`\\simeq `,`≃`),Z.mid=q(Q,`\\mid `,`∣`),Z.ll=q(Q,`\\ll `,`≪`),Z.gg=q(Q,`\\gg `,`≫`),Z.parallel=q(Q,`\\parallel `,`∥`),Z.nparallel=q(Q,`\\nparallel `,`∦`),Z.bowtie=q(Q,`\\bowtie `,`⋈`),Z.sqsubset=q(Q,`\\sqsubset `,`⊏`),Z.sqsupset=q(Q,`\\sqsupset `,`⊐`),Z.smile=q(Q,`\\smile `,`⌣`),Z.sqsubseteq=q(Q,`\\sqsubseteq `,`⊑`),Z.sqsupseteq=q(Q,`\\sqsupseteq `,`⊒`),Z.doteq=q(Q,`\\doteq `,`≐`),Z.frown=q(Q,`\\frown `,`⌢`),Z.vdash=q(Q,`\\vdash `,`⊦`),Z.dashv=q(Q,`\\dashv `,`⊣`),Z.nless=q(Q,`\\nless `,`≮`),Z.ngtr=q(Q,`\\ngtr `,`≯`),Z.longleftarrow=q(Q,`\\longleftarrow `,`←`),Z.longrightarrow=q(Q,`\\longrightarrow `,`→`),Z.Longleftarrow=q(Q,`\\Longleftarrow `,`⇐`),Z.Longrightarrow=q(Q,`\\Longrightarrow `,`⇒`),Z.longleftrightarrow=q(Q,`\\longleftrightarrow `,`↔`),Z.updownarrow=q(Q,`\\updownarrow `,`↕`),Z.Longleftrightarrow=q(Q,`\\Longleftrightarrow `,`⇔`),Z.Updownarrow=q(Q,`\\Updownarrow `,`⇕`),Z.mapsto=q(Q,`\\mapsto `,`↦`),Z.nearrow=q(Q,`\\nearrow `,`↗`),Z.hookleftarrow=q(Q,`\\hookleftarrow `,`↩`),Z.hookrightarrow=q(Q,`\\hookrightarrow `,`↪`),Z.searrow=q(Q,`\\searrow `,`↘`),Z.leftharpoonup=q(Q,`\\leftharpoonup `,`↼`),Z.rightharpoonup=q(Q,`\\rightharpoonup `,`⇀`),Z.swarrow=q(Q,`\\swarrow `,`↙`),Z.leftharpoondown=q(Q,`\\leftharpoondown `,`↽`),Z.rightharpoondown=q(Q,`\\rightharpoondown `,`⇁`),Z.nwarrow=q(Q,`\\nwarrow `,`↖`),Z.ldots=q(Q,`\\ldots `,`…`),Z.cdots=q(Q,`\\cdots `,`⋯`),Z.vdots=q(Q,`\\vdots `,`⋮`),Z.ddots=q(Q,`\\ddots `,`⋱`),Z.surd=q(Q,`\\surd `,`√`),Z.triangle=q(Q,`\\triangle `,`△`),Z.ell=q(Q,`\\ell `,`ℓ`),Z.top=q(Q,`\\top `,`⊤`),Z.flat=q(Q,`\\flat `,`♭`),Z.natural=q(Q,`\\natural `,`♮`),Z.sharp=q(Q,`\\sharp `,`♯`),Z.wp=q(Q,`\\wp `,`℘`),Z.bot=q(Q,`\\bot `,`⊥`),Z.clubsuit=q(Q,`\\clubsuit `,`♣`),Z.diamondsuit=q(Q,`\\diamondsuit `,`♢`),Z.heartsuit=q(Q,`\\heartsuit `,`♡`),Z.spadesuit=q(Q,`\\spadesuit `,`♠`),Z.circledot=q(Q,`\\circledot `,`⊙`),Z.middot=q(Q,`\\middot `,`·`),Z.dottedsquare=q(Q,`\\dottedsquare `,`⬚`),Z.square=q(Q,`\\square `,`⬜`),Z.rectangle=q(Q,`\\rectangle `,`▯`),Z.oint=q(Q,`\\oint `,`∮`),Z.bigcap=q(Q,`\\bigcap `,`∩`),Z.bigcup=q(Q,`\\bigcup `,`∪`),Z.bigsqcup=q(Q,`\\bigsqcup `,`⊔`),Z.bigvee=q(Q,`\\bigvee `,`∨`),Z.bigwedge=q(Q,`\\bigwedge `,`∧`),Z.bigodot=q(Q,`\\bigodot `,`⊙`),Z.bigotimes=q(Q,`\\bigotimes `,`⊗`),Z.bigoplus=q(Q,`\\bigoplus `,`⊕`),Z.biguplus=q(Q,`\\biguplus `,`⊎`),Z.lfloor=q(Q,`\\lfloor `,`⌊`),Z.rfloor=q(Q,`\\rfloor `,`⌋`),Z.lceil=q(Q,`\\lceil `,`⌈`),Z.rceil=q(Q,`\\rceil `,`⌉`),Z.opencurlybrace=Z.lbrace=q(Q,`\\lbrace `,`{`),Z.closecurlybrace=Z.rbrace=q(Q,`\\rbrace `,`}`),Z.lbrack=q(Q,`[`),Z.rbrack=q(Q,`]`),Z.mug=q(Q,`\\mug `,`µg`),Z.mus=q(Q,`\\mus `,`µs`),Z.mum=q(Q,`\\mum `,`µm`),Z.muL=q(Q,`\\muL `,`µL`),Z.slash=q(Q,`/`),Z.vert=q(Q,`|`),Z.perp=Z.perpendicular=q(Q,`\\perp `,`⊥`),Z.nabla=Z.del=q(Q,`\\nabla `,`∇`),Z.hbar=q(Q,`\\hbar `,`ℏ`),Z.AA=Z.Angstrom=Z.angstrom=q(Q,`\\text\\AA `,`Å`),Z.ring=Z.circ=Z.circle=q(Q,`\\circ `,`∘`),Z.bull=Z.bullet=q(Q,`\\bullet `,`•`),Z.setminus=Z.smallsetminus=q(Q,`\\setminus `,`∖`),Z.not=Z[`¬`]=Z.neg=q(Q,`\\neg `,`¬`),Z[`…`]=Z.dots=Z.ellip=Z.hellip=Z.ellipsis=Z.hellipsis=q(Q,`\\dots `,`…`),Z.converges=Z.darr=Z.dnarr=Z.dnarrow=Z.downarrow=q(Q,`\\downarrow `,`↓`),Z.dArr=Z.dnArr=Z.dnArrow=Z.Downarrow=q(Q,`\\Downarrow `,`⇓`),Z.diverges=Z.uarr=Z.uparrow=q(Q,`\\uparrow `,`↑`),Z.uArr=Z.Uparrow=q(Q,`\\Uparrow `,`⇑`),Z.to=q($,`\\to `,`→`),Z.rarr=Z.rightarrow=q(Q,`\\rightarrow `,`→`),Z.implies=q($,`\\Rightarrow `,`⇒`),Z.rArr=Z.Rightarrow=q(Q,`\\Rightarrow `,`⇒`),Z.gets=q($,`\\gets `,`←`),Z.larr=Z.leftarrow=q(Q,`\\leftarrow `,`←`),Z.impliedby=q($,`\\Leftarrow `,`⇐`),Z.lArr=Z.Leftarrow=q(Q,`\\Leftarrow `,`⇐`),Z.harr=Z.lrarr=Z.leftrightarrow=q(Q,`\\leftrightarrow `,`↔`),Z.iff=q($,`\\Leftrightarrow `,`⇔`),Z.hArr=Z.lrArr=Z.Leftrightarrow=q(Q,`\\Leftrightarrow `,`⇔`),Z.Re=Z.Real=Z.real=q(Q,`\\Re `,`ℜ`),Z.Im=Z.imag=Z.image=Z.imagin=Z.imaginary=Z.Imaginary=q(Q,`\\Im `,`ℑ`),Z.part=Z.partial=q(Q,`\\partial `,`∂`),Z.infty=Z.infin=Z.infinity=q(Q,`\\infty `,`∞`),Z.pounds=q(Q,`\\pounds `,`£`),Z.alef=Z.alefsym=Z.aleph=Z.alephsym=q(Q,`\\aleph `,`ℵ`),Z.xist=Z.xists=Z.exist=Z.exists=q(Q,`\\exists `,`∃`),Z.nexists=Z.nexist=q(Q,`\\nexists `,`∄`),Z.and=Z.land=Z.wedge=q($,`\\wedge `,`∧`),Z.or=Z.lor=Z.vee=q($,`\\vee `,`∨`),Z.o=Z.O=Z.empty=Z.emptyset=Z.oslash=Z.Oslash=Z.nothing=Z.varnothing=q($,`\\varnothing `,`∅`),Z.cup=Z.union=q($,`\\cup `,`∪`),Z.cap=Z.intersect=Z.intersection=q($,`\\cap `,`∩`),Z.deg=Z.degree=q(Q,`\\degree `,`°`),Z.ang=Z.angle=q(Q,`\\angle `,`∠`),Z.measuredangle=q(Q,`\\measuredangle `,`m∠`);var kU=J(Q,function(e,t){e.createLeftOf=function(e){e.options.autoSubscriptNumerals&&e.parent!==e.parent.parent.sub&&(e[Y]instanceof AU&&e[Y].isItalic!==!1||e[Y]instanceof aW&&e[Y][Y]instanceof AU&&e[Y][Y].isItalic!==!1)?(Z._().createLeftOf(e),t.createLeftOf.call(this,e),e.insRightOf(e.parent.parent)):t.createLeftOf.call(this,e)}}),AU=J(xU,function(e,t){e.init=function(e,n){t.init.call(this,e,`<var>`+(n||e)+`</var>`)},e.text=function(){var e=this.ctrlSeq;return this.isPartOfOperator?e[0]==`\\`?e=e.slice(1,e.length):e[e.length-1]==` `&&(e=e.slice(0,-1)):(this[Y]&&!(this[Y]instanceof AU)&&!(this[Y]instanceof $)&&this[Y].ctrlSeq!==`\\ `&&(e=`*`+e),this[X]&&!(this[X]instanceof $)&&!(this[X]instanceof aW)&&(e+=`*`)),e}});iU.p.autoCommands={_maxLength:0},aU.autoCommands=function(e){if(!/^[a-z]+(?: [a-z]+)*$/i.test(e))throw`"`+e+`" not a space-delimited list of only letters`;for(var t=e.split(` `),n={},r=0,i=0;i<t.length;i+=1){var a=t[i];if(a.length<2)throw`autocommand "`+a+`" not minimum length of 2`;if(Z[a]===FU)throw`"`+a+`" is a built-in operator name`;n[a]=1,r=BH(r,a.length)}return n._maxLength=r,n};var jU=J(AU,function(e,t){e.init=function(e){return t.init.call(this,this.letter=e)},e.createLeftOf=function(e){t.createLeftOf.apply(this,arguments);var n=e.options.autoCommands,r=n._maxLength;if(r>0){for(var i=``,a=this,o=0;a instanceof jU&&a.ctrlSeq===a.letter&&o<r;)i=a.letter+i,a=a[Y],o+=1;for(;i.length;){if(n.hasOwnProperty(i)){for(var o=1,a=this;o<i.length;o+=1,a=a[Y]);return ZH(a,this).remove(),e[Y]=a[Y],Z[i](i).createLeftOf(e)}i=i.slice(1)}}},e.italicize=function(e){return this.isItalic=e,this.isPartOfOperator=!e,this.jQ.toggleClass(`mq-operator-name`,!e),this},e.finalizeTree=e.siblingDeleted=e.siblingCreated=function(e,t){t!==Y&&this[X]instanceof jU||this.autoUnItalicize(e)},e.autoUnItalicize=function(e){var t=e.autoOperatorNames;if(t._maxLength!==0){for(var r=this.letter,i=this[Y];i instanceof jU;i=i[Y])r=i.letter+r;for(var a=this[X];a instanceof jU;a=a[X])r+=a.letter;ZH(i[X]||this.parent.ends[Y],a[Y]||this.parent.ends[X]).each(function(e){e.italicize(!0).jQ.removeClass(`mq-first mq-last mq-followed-by-supsub`),e.ctrlSeq=e.letter});outer:for(var o=0,s=i[X]||this.parent.ends[Y];o<r.length;o+=1,s=s[X])for(var c=zH(t._maxLength,r.length-o);c>0;--c){var l=r.slice(o,o+c);if(t.hasOwnProperty(l)){for(var u=0,d=s;u<c;u+=1,d=d[X]){d.italicize(!1);var f=d}var p=MU.hasOwnProperty(l);if(s.ctrlSeq=(p?`\\`:`\\operatorname{`)+s.ctrlSeq,f.ctrlSeq+=p?` `:`}`,PU.hasOwnProperty(l)&&f[Y][Y][Y].jQ.addClass(`mq-last`),n(s[Y])||s.jQ.addClass(`mq-first`),!n(f[X]))if(f[X]instanceof aW){var m=f[X];(m.siblingCreated=m.siblingDeleted=function(){m.jQ.toggleClass(`mq-after-operator-name`,!(m[X]instanceof mW))})()}else f.jQ.toggleClass(`mq-last`,!(f[X]instanceof mW));o+=c-1,s=f;continue outer}}}};function n(e){return!e||e instanceof $||e instanceof cW}}),MU={},NU=iU.p.autoOperatorNames={_maxLength:9},PU={limsup:1,liminf:1,projlim:1,injlim:1};(function(){for(var e=`arg deg det dim exp gcd hom inf ker lg ln log max min sup limsup liminf injlim projlim Pr`.split(` `),t=0;t<e.length;t+=1)MU[e[t]]=NU[e[t]]=1;for(var n=`sin cos tan arcsin arccos arctan sinh cosh tanh sec csc cot coth`.split(` `),t=0;t<n.length;t+=1)MU[n[t]]=1;for(var r=`sin cos tan sec cosec csc cotan cot ctg`.split(` `),t=0;t<r.length;t+=1)NU[r[t]]=NU[`arc`+r[t]]=NU[r[t]+`h`]=NU[`ar`+r[t]+`h`]=NU[`arc`+r[t]+`h`]=1;for(var i=`gcf hcf lcm proj span`.split(` `),t=0;t<i.length;t+=1)NU[i[t]]=1})(),aU.autoOperatorNames=function(e){if(!/^[a-z]+(?: [a-z]+)*$/i.test(e))throw`"`+e+`" not a space-delimited list of only letters`;for(var t=e.split(` `),n={},r=0,i=0;i<t.length;i+=1){var a=t[i];if(a.length<2)throw`"`+a+`" not minimum length of 2`;n[a]=1,r=BH(r,a.length)}return n._maxLength=r,n};var FU=J(xU,function(e,t){e.init=function(e){this.ctrlSeq=e},e.createLeftOf=function(e){for(var t=this.ctrlSeq,n=0;n<t.length;n+=1)jU(t.charAt(n)).createLeftOf(e)},e.parser=function(){for(var e=this.ctrlSeq,t=SU(),n=0;n<e.length;n+=1)jU(e.charAt(n)).adopt(t,t.ends[X],0);return hU.succeed(t.children())}});for(var IU in NU)NU.hasOwnProperty(IU)&&(Z[IU]=FU);Z.operatorname=J(bU,function(e){e.createLeftOf=VH,e.numBlocks=function(){return 1},e.parser=function(){return vU.block.map(function(e){return e.children()})}}),Z.f=J(jU,function(e,t){e.init=function(){xU.p.init.call(this,this.letter=`f`,`<var class="mq-f">f</var>`)},e.italicize=function(e){return this.jQ.html(`f`).toggleClass(`mq-f`,e),t.italicize.apply(this,arguments)}}),Z[` `]=Z.space=q(Q,`\\ `,` `),Z[`'`]=Z.prime=q(Q,`'`,`′`),Z[`″`]=Z.dprime=q(Q,`″`,`″`),Z[`"`]=Z.doublePrime=q(Q,`"`,`″`),Z.backslash=q(Q,`\\backslash `,`\\`),QH[`\\`]||=Z.backslash,Z.$=q(Q,`\\$`,`$`);var LU=J(xU,function(e,t){e.init=function(e,n){t.init.call(this,e,`<span class="mq-nonSymbola">`+(n||e)+`</span>`)}});Z[`@`]=LU,Z[`&`]=q(LU,`\\&`,`&`),Z[`%`]=q(LU,`\\%`,`%`),Z.alpha=Z.beta=Z.gamma=Z.delta=Z.zeta=Z.eta=Z.theta=Z.iota=Z.kappa=Z.mu=Z.nu=Z.xi=Z.rho=Z.sigma=Z.tau=Z.chi=Z.psi=Z.omega=J(AU,function(e,t){e.init=function(e){t.init.call(this,`\\`+e+` `,`&`+e+`;`)}}),Z.phi=q(AU,`\\phi `,`ϕ`),Z.phiv=Z.varphi=q(AU,`\\varphi `,`φ`),Z.epsilon=q(AU,`\\epsilon `,`ϵ`),Z.epsiv=Z.varepsilon=q(AU,`\\varepsilon `,`ε`),Z.piv=Z.varpi=q(AU,`\\varpi `,`ϖ`),Z.sigmaf=Z.sigmav=Z.varsigma=q(AU,`\\varsigma `,`ς`),Z.thetav=Z.vartheta=Z.thetasym=q(AU,`\\vartheta `,`ϑ`),Z.upsilon=Z.upsi=q(AU,`\\upsilon `,`υ`),Z.gammad=Z.Gammad=Z.digamma=q(AU,`\\digamma `,`ϝ`),Z.kappav=Z.varkappa=q(AU,`\\varkappa `,`ϰ`),Z.rhov=Z.varrho=q(AU,`\\varrho `,`ϱ`),Z.pi=Z.π=q(LU,`\\pi `,`π`),Z.lambda=q(LU,`\\lambda `,`λ`),Z.Upsilon=Z.Upsi=Z.upsih=Z.Upsih=q(xU,`\\Upsilon `,`<var style="font-family: serif">ϒ</var>`),Z.Gamma=Z.Delta=Z.Theta=Z.Lambda=Z.Xi=Z.Pi=Z.Sigma=Z.Phi=Z.Psi=Z.Omega=J(Q,function(e,t){e.init=function(e){t.init.call(this,`\\`+e+` `,`&`+e+`;`)}}),Z.forall=Z[`∀`]=q(Q,`\\forall `,`∀`);var RU=J(bU,function(e){e.init=function(e){this.latex=e},e.createLeftOf=function(e){var t=vU.parse(this.latex);t.children().adopt(e.parent,e[Y],e[X]),e[Y]=t.ends[X],t.jQize().insertBefore(e.jQ),t.finalizeInsert(e.options,e),t.ends[X][X].siblingCreated&&t.ends[X][X].siblingCreated(e.options,Y),t.ends[Y][Y].siblingCreated&&t.ends[Y][Y].siblingCreated(e.options,X),e.parent.bubble(`reflow`)},e.parser=function(){var e=vU.parse(this.latex).children();return hU.succeed(e)}});Z[`¹`]=q(RU,`^1`),Z[`²`]=q(RU,`^2`),Z[`³`]=q(RU,`^3`),Z[`¼`]=q(RU,`\\frac14`),Z[`½`]=q(RU,`\\frac12`),Z[`¾`]=q(RU,`\\frac34`);var zU=J($,function(e){e.init=Q.prototype.init,e.contactWeld=e.siblingCreated=e.siblingDeleted=function(e,t){function n(e){if(e[Y]){if(e[Y]instanceof $||/^[,;:\(\[]$/.test(e[Y].ctrlSeq))return``}else if(e.parent&&e.parent.parent&&e.parent.parent.isStyleBlock())return n(e.parent.parent);else return``;return`mq-binary-operator`}if(t!==X)return this.jQ[0].className=n(this),this}});Z[`+`]=q(zU,`+`,`+`),Z[`–`]=Z[`-`]=q(zU,`-`,`−`),Z[`±`]=Z.pm=Z.plusmn=Z.plusminus=q(zU,`\\pm `,`±`),Z.mp=Z.mnplus=Z.minusplus=q(zU,`\\mp `,`∓`),QH[`*`]=Z.sdot=Z.cdot=q($,`\\cdot `,`·`,`*`);var BU=J($,function(e,t){e.init=function(e,n){this.data=e,this.strict=n;var r=n?`Strict`:``;t.init.call(this,e[`ctrlSeq`+r],e[`html`+r],e[`text`+r])},e.swap=function(e){this.strict=e;var t=e?`Strict`:``;this.ctrlSeq=this.data[`ctrlSeq`+t],this.jQ.html(this.data[`html`+t]),this.textTemplate=[this.data[`text`+t]]},e.deleteTowards=function(e,n){if(e===Y&&!this.strict){this.swap(!0),this.bubble(`reflow`);return}t.deleteTowards.apply(this,arguments)}}),VU={ctrlSeq:`\\le `,html:`≤`,text:`≤`,ctrlSeqStrict:`<`,htmlStrict:`<`,textStrict:`<`},HU={ctrlSeq:`\\ge `,html:`≥`,text:`≥`,ctrlSeqStrict:`>`,htmlStrict:`>`,textStrict:`>`};Z[`<`]=Z.lt=q(BU,VU,!0),Z[`>`]=Z.gt=q(BU,HU,!0),Z[`≤`]=Z.le=Z.leq=q(BU,VU,!1),Z[`≥`]=Z.ge=Z.geq=q(BU,HU,!1);var UU=J($,function(e,t){e.init=function(){t.init.call(this,`=`,`=`)},e.createLeftOf=function(e){if(e[Y]instanceof BU&&e[Y].strict){e[Y].swap(!1),e[Y].bubble(`reflow`);return}t.createLeftOf.apply(this,arguments)}});Z[`=`]=UU,Z[`×`]=Z.times=q($,`\\times `,`×`,`[x]`),Z[`÷`]=Z.div=Z.divide=Z.divides=q($,`\\div `,`÷`,`[/]`),QH[`~`]=Z.sim=q($,`\\sim `,`~`,`~`),QH[`≁`]=Z.nsim=q($,`\\nsim `,`≁`,`≁`),Z.complement=Z[`∁`]=q(Q,`\\complement `,`∁`),Z.nexists=Z[`∄`]=q(Q,`\\nexists `,`∄`),Z.sphericalangle=Z[`∢`]=q(Q,`\\sphericalangle `,`∢`),Z.iint=Z[`∬`]=q(Q,`\\iint `,`∬`),Z.iiint=Z[`∭`]=q(Q,`\\iiint `,`∭`),Z.oiint=Z[`∯`]=q(Q,`\\oiint `,`∯`),Z.oiiint=Z[`∰`]=q(Q,`\\oiiint `,`∰`),Z.backsim=Z[`∽`]=q(Q,`\\backsim `,`∽`),Z.backsimeq=Z[`⋍`]=q(Q,`\\backsimeq `,`⋍`),Z.eqsim=Z[`≂`]=q(Q,`\\eqsim `,`≂`),Z.ncong=Z[`≇`]=q(Q,`\\ncong `,`≇`),Z.approxeq=Z[`≊`]=q(Q,`\\approxeq `,`≊`),Z.bumpeq=Z[`≏`]=q(Q,`\\bumpeq `,`≏`),Z.Bumpeq=Z[`≎`]=q(Q,`\\Bumpeq `,`≎`),Z.doteqdot=Z[`≑`]=q(Q,`\\doteqdot `,`≑`),Z.fallingdotseq=Z[`≒`]=q(Q,`\\fallingdotseq `,`≒`),Z.risingdotseq=Z[`≓`]=q(Q,`\\risingdotseq `,`≓`),Z.eqcirc=Z[`≖`]=q(Q,`\\eqcirc `,`≖`),Z.circeq=Z[`≗`]=q(Q,`\\circeq `,`≗`),Z.triangleq=Z[`≜`]=q(Q,`\\triangleq `,`≜`),Z.leqq=Z[`≦`]=q(Q,`\\leqq `,`≦`),Z.geqq=Z[`≧`]=q(Q,`\\geqq `,`≧`),Z.lneqq=Z[`≨`]=q(Q,`\\lneqq `,`≨`),Z.gneqq=Z[`≩`]=q(Q,`\\gneqq `,`≩`),Z.between=Z[`≬`]=q(Q,`\\between `,`≬`),Z.nleq=Z[`≰`]=q(Q,`\\nleq `,`≰`),Z.ngeq=Z[`≱`]=q(Q,`\\ngeq `,`≱`),Z.lesssim=Z[`≲`]=q(Q,`\\lesssim `,`≲`),Z.gtrsim=Z[`≳`]=q(Q,`\\gtrsim `,`≳`),Z.lessgtr=Z[`≶`]=q(Q,`\\lessgtr `,`≶`),Z.gtrless=Z[`≷`]=q(Q,`\\gtrless `,`≷`),Z.preccurlyeq=Z[`≼`]=q(Q,`\\preccurlyeq `,`≼`),Z.succcurlyeq=Z[`≽`]=q(Q,`\\succcurlyeq `,`≽`),Z.precsim=Z[`≾`]=q(Q,`\\precsim `,`≾`),Z.succsim=Z[`≿`]=q(Q,`\\succsim `,`≿`),Z.nprec=Z[`⊀`]=q(Q,`\\nprec `,`⊀`),Z.nsucc=Z[`⊁`]=q(Q,`\\nsucc `,`⊁`),Z.subsetneq=Z[`⊊`]=q(Q,`\\subsetneq `,`⊊`),Z.supsetneq=Z[`⊋`]=q(Q,`\\supsetneq `,`⊋`),Z.vDash=Z[`⊨`]=q(Q,`\\vDash `,`⊨`),Z.Vdash=Z[`⊩`]=q(Q,`\\Vdash `,`⊩`),Z.Vvdash=Z[`⊪`]=q(Q,`\\Vvdash `,`⊪`),Z.VDash=Z[`⊫`]=q(Q,`\\VDash `,`⊫`),Z.nvdash=Z[`⊬`]=q(Q,`\\nvdash `,`⊬`),Z.nvDash=Z[`⊭`]=q(Q,`\\nvDash `,`⊭`),Z.nVdash=Z[`⊮`]=q(Q,`\\nVdash `,`⊮`),Z.nVDash=Z[`⊯`]=q(Q,`\\nVDash `,`⊯`),Z.vartriangleleft=Z[`⊲`]=q(Q,`\\vartriangleleft `,`⊲`),Z.vartriangleright=Z[`⊳`]=q(Q,`\\vartriangleright `,`⊳`),Z.trianglelefteq=Z[`⊴`]=q(Q,`\\trianglelefteq `,`⊴`),Z.trianglerighteq=Z[`⊵`]=q(Q,`\\trianglerighteq `,`⊵`),Z.multimap=Z[`⊸`]=q(Q,`\\multimap `,`⊸`),Z.Subset=Z[`⋐`]=q(Q,`\\Subset `,`⋐`),Z.Supset=Z[`⋑`]=q(Q,`\\Supset `,`⋑`),Z.Cap=Z[`⋒`]=q(Q,`\\Cap `,`⋒`),Z.Cup=Z[`⋓`]=q(Q,`\\Cup `,`⋓`),Z.pitchfork=Z[`⋔`]=q(Q,`\\pitchfork `,`⋔`),Z.lessdot=Z[`⋖`]=q(Q,`\\lessdot `,`⋖`),Z.gtrdot=Z[`⋗`]=q(Q,`\\gtrdot `,`⋗`),Z.lll=Z[`⋘`]=q(Q,`\\lll `,`⋘`),Z.ggg=Z[`⋙`]=q(Q,`\\ggg `,`⋙`),Z.lesseqgtr=Z[`⋚`]=q(Q,`\\lesseqgtr `,`⋚`),Z.gtreqless=Z[`⋛`]=q(Q,`\\gtreqless `,`⋛`),Z.curlyeqprec=Z[`⋞`]=q(Q,`\\curlyeqprec `,`⋞`),Z.curlyeqsucc=Z[`⋟`]=q(Q,`\\curlyeqsucc `,`⋟`),Z.nsim=Z[`≁`]=q(Q,`\\nsim `,`≁`),Z.lnsim=Z[`⋦`]=q(Q,`\\lnsim `,`⋦`),Z.gnsim=Z[`⋧`]=q(Q,`\\gnsim `,`⋧`),Z.precnsim=Z[`⋨`]=q(Q,`\\precnsim `,`⋨`),Z.succnsim=Z[`⋩`]=q(Q,`\\succnsim `,`⋩`),Z.ntriangleleft=Z[`⋪`]=q(Q,`\\ntriangleleft `,`⋪`),Z.ntriangleright=Z[`⋫`]=q(Q,`\\ntriangleright `,`⋫`),Z.ntrianglelefteq=Z[`⋬`]=q(Q,`\\ntrianglelefteq `,`⋬`),Z.ntrianglerighteq=Z[`⋭`]=q(Q,`\\ntrianglerighteq `,`⋭`),Z.blacksquare=Z[`∎`]=q(Q,`\\blacksquare `,`∎`),Z.colon=Z[`∶`]=q(Q,`\\colon `,`∶`),Z.llcorner=Z[`∟`]=q(Q,`\\llcorner `,`∟`),Z.dotplus=Z[`∔`]=q($,`\\dotplus `,`∔`),Z.nmid=Z[`∤`]=q($,`
|
|
303
|
-
mid `,`∤`),Z.intercal=Z[`⊺`]=q($,`\\intercal `,`⊺`),Z.veebar=Z[`⊻`]=q($,`\\veebar `,`⊻`),Z.barwedge=Z[`⊼`]=q($,`\\barwedge `,`⊼`),Z.ltimes=Z[`⋉`]=q($,`\\ltimes `,`⋉`),Z.rtimes=Z[`⋊`]=q($,`\\rtimes `,`⋊`),Z.leftthreetimes=Z[`⋋`]=q($,`\\leftthreetimes `,`⋋`),Z.rightthreetimes=Z[`⋌`]=q($,`\\rightthreetimes `,`⋌`),Z.curlyvee=Z[`⋎`]=q($,`\\curlyvee `,`⋎`),Z.curlywedge=Z[`⋏`]=q($,`\\curlywedge `,`⋏`),Z.circledcirc=Z[`⊚`]=q($,`\\circledcirc `,`⊚`),Z.circledast=Z[`⊛`]=q($,`\\circledast `,`⊛`),Z.circleddash=Z[`⊝`]=q($,`\\circleddash `,`⊝`),Z.boxplus=Z[`⊞`]=q($,`\\boxplus `,`⊞`),Z.boxminus=Z[`⊟`]=q($,`\\boxminus `,`⊟`),Z.boxtimes=Z[`⊠`]=q($,`\\boxtimes `,`⊠`),Z.boxdot=Z[`⊡`]=q($,`\\boxdot `,`⊡`),Z[`∂`]=Z.partial,Z[`∃`]=Z.exists,Z[`∅`]=Z.varnothing,Z[`∆`]=Z.triangle,Z[`∇`]=Z.nabla,Z[`∈`]=Z.in,Z[`∊`]=Z.in,Z[`∋`]=Z.ni,Z[`∌`]=Z.notni,Z[`∍`]=Z.ni,Z[`∐`]=Z.amalg,Z[`−`]=Z[`-`],Z[`∓`]=Z.mp,Z[`∖`]=Z.setminus,Z[`∘`]=Z.circ,Z[`∙`]=Z.bullet,Z[`∝`]=Z.propto,Z[`∞`]=Z.infty,Z[`∠`]=Z.angle,Z[`∡`]=Z.measuredangle,Z[`∣`]=Z.divides,Z[`∥`]=Z.parallel,Z[`∦`]=Z.nparallel,Z[`∧`]=Z.wedge,Z[`∨`]=Z.vee,Z[`∩`]=Z.cap,Z[`∪`]=Z.cup,Z[`∮`]=Z.oint,Z[`∴`]=Z.therefore,Z[`∵`]=Z.because,Z[`∼`]=Z.sim,Z[`≀`]=Z.wr,Z[`≃`]=Z.simeq,Z[`≍`]=Z.asymp,Z[`≐`]=Z.doteq,Z[`≪`]=Z.ll,Z[`≫`]=Z.gg,Z[`≺`]=Z.prec,Z[`≻`]=Z.succ,Z[`⊂`]=Z.subset,Z[`⊃`]=Z.supset,Z[`⊆`]=Z.subseteq,Z[`⊇`]=Z.supseteq,Z[`⊈`]=Z.nsubseteq,Z[`⊉`]=Z.nsupseteq,Z[`⊏`]=Z.sqsubset,Z[`⊐`]=Z.sqsupset,Z[`⊓`]=Z.sqcap,Z[`⊔`]=Z.sqcup,Z[`⊖`]=Z.ominus,Z[`⊘`]=Z.oslash,Z[`⊙`]=Z.odot,Z[`⊢`]=Z.vdash,Z[`⊣`]=Z.dashv,Z[`⊤`]=Z.top,Z[`⊥`]=Z.bot,Z[`⊧`]=Z.models,Z[`⋀`]=Z.wedge,Z[`⋁`]=Z.vee,Z[`⋂`]=Z.cap,Z[`⋃`]=Z.cup,Z[`⋄`]=Z.diamond,Z[`⋅`]=Z.cdot,Z[`⋆`]=Z.star,Z[`⋈`]=Z.bowtie,Z[`⋮`]=Z.vdots,Z[`⋯`]=Z.cdots,Z[`⋱`]=Z.ddots;var WU,GU=VH,KU=document.createElement(`div`).style,qU={transform:1,WebkitTransform:1,MozTransform:1,OTransform:1,msTransform:1},JU;for(var YU in qU)if(YU in KU){JU=YU;break}JU?WU=function(e,t,n){e.css(JU,`scale(`+t+`,`+n+`)`)}:`filter`in KU?(GU=function(e){e.className=e.className},WU=function(e,t,n){t/=1+(n-1)/2,e.css(`fontSize`,n+`em`),e.hasClass(`mq-matrixed-container`)||e.addClass(`mq-matrixed-container`).wrapInner(`<span class="mq-matrixed"></span>`);var r=e.children().css(`filter`,`progid:DXImageTransform.Microsoft.Matrix(M11=`+t+`,SizingMethod='auto expand')`);function i(){e.css(`marginRight`,(r.width()-1)*(t-1)/t+`px`)}i();var a=setInterval(i);PH(window).load(function(){clearTimeout(a),i()})}):WU=function(e,t,n){e.css(`fontSize`,n+`em`)};var XU=J(bU,function(e,t){e.init=function(e,n,r){t.init.call(this,e,`<`+n+` `+r+`>&0</`+n+`>`)}}),ZU=J(bU,function(e,t){e.init=function(e,n,r){this.args=arguments,this.htmlTemplate=`<`+n+` `+r+`><`+n+` class="mq-xarrow-over">&0</`+n+`><`+n+` class="mq-xarrow-under"></`+n+`></`+n+`>`,t.init.call(this,e),this.textTemplate=[e.replace(`\\`,``)+`(`,`)`]},e.parser=function(){var e=this;return vU.optBlock.then(function(t){return vU.block.map(function(n){var r=QU.apply(null,e.args);return r.blocks=[t,n],t.adopt(r,0,0),n.adopt(r,t,0),r})}).or(t.parser.call(this))}}),QU=J(ZU,function(e,t){e.init=function(e,t,n){this.htmlTemplate=`<`+t+` `+n+`><`+t+` class="mq-xarrow-over">&1</`+t+`><`+t+` class="mq-xarrow-under">&0</`+t+`></`+t+`>`,bU.prototype.init.call(this,e),this.textTemplate=[e.replace(`\\`,``)+`[`,`](`,`)`]},e.latex=function(){return this.ctrlSeq+`[`+this.ends[Y].latex()+`]{`+this.ends[X].latex()+`}`},e.finalizeTree=function(){this.downInto=this.ends[Y].upOutOf=this.ends[X],this.upInto=this.ends[X].downOutOf=this.ends[Y]}}),$U=function(e){var t=`<span class="`+e+`-inner-right">g</span><span class="`+e+`-inner-left">h</span>`;return J(bU,function(n,r){n.init=function(n,i,a){r.init.call(this,n,`<`+i+` `+a+`><`+i+` class="`+e+`-inner">`+t+`<span class="mq-empty-box">&0</span></`+i+`></`+i+`>`)}})},eW=J(bU,function(e,t){e.init=function(e,n,r){t.init.call(this,e,`<`+n+` `+r+`><span class="mq-longdiv-curve-border">)</span><span class="mq-longdiv-inner"><span class="mq-empty">&0</span></`+n+`></span>`)}}),tW=J(bU,function(e,t){e.init=function(e,n,r){t.init.call(this,e,`<span class="mq-matrix"><span class="mq-paren mq-scaled">[</span><span class="matrix-edit-content-row"><p>`+r+`</p><table class="mq-non-leaf mq-rows-3"><tbody><tr><td class="mq-empty"></td><td class="mq-empty"></td><td class="mq-empty"></td></tr></tbody></table></span><span class="mq-paren mq-scaled">]</span></span>`)}}),nW=J(bU,function(e,t){e.init=function(e){t.init.call(this,e,`<span class="mq-non-leaf"><span class="mq-dot-recurring-inner"><span class="mq-dot-recurring">˙</span><span class="mq-empty-box">&0</span></span></span>`)}}),rW=J(bU,function(e,t){e.init=function(e,n,r){t.init.call(this,e,`<span class="mq-matrix"><span class="mq-paren mq-scaled">[</span><span class="matrix-edit-content-col"><p>`+r+`</p></span><span class="matrix-edit-content-col"><table class="mq-non-leaf mq-rows-3"><tbody><tr><td class="mq-empty"></td></tr><tr><td class="mq-empty"></td></tr><tr><td class="mq-empty"></td></tr></tbody></table></span><span class="mq-paren mq-scaled">]</span></span>`)}}),iW=function(e,t){return J(xU,function(n,r){n.init=function(n,i,a){r.init.call(this,n,`<`+i+` `+a+`><`+i+` class="`+e+`-inner">`+t+`</`+i+`></`+i+`>`)}})};Z.mathrm=q(XU,`\\mathrm`,`span`,`class="mq-roman mq-font"`),Z.mathit=q(XU,`\\mathit`,`i`,`class="mq-font"`),Z.mathbf=q(XU,`\\mathbf`,`b`,`class="mq-font"`),Z.mathsf=q(XU,`\\mathsf`,`span`,`class="mq-sans-serif mq-font"`),Z.mathtt=q(XU,`\\mathtt`,`span`,`class="mq-monospace mq-font"`),Z.underline=q(XU,`\\underline`,`span`,`class="mq-non-leaf mq-underline"`),Z.overline=Z.bar=q($U(`mq-overline`),`\\overline`,`span`,`class="mq-non-leaf mq-overline"`),Z.longdiv=q(eW,`\\longdiv`,`span`,`class="mq-non-leaf mq-longdiv"`),Z.overrightarrow=q($U(`mq-overarrow`),`\\overrightarrow`,`span`,`class="mq-non-leaf mq-overarrow mq-arrow-right"`),Z.overleftarrow=q($U(`mq-overarrow`),`\\overleftarrow`,`span`,`class="mq-non-leaf mq-overarrow mq-arrow-left"`),Z.xleftarrow=q(ZU,`\\xleftarrow`,`span`,`class="mq-non-leaf mq-xarrow mq-arrow-left"`),Z.xrightarrow=q(ZU,`\\xrightarrow`,`span`,`class="mq-non-leaf mq-xarrow mq-arrow-right"`),Z.overleftrightarrow=q(XU,`\\overleftrightarrow`,`span`,`class="mq-non-leaf mq-overarrow mq-arrow-both"`),Z.overarc=q(XU,`\\overarc`,`span`,`class="mq-non-leaf mq-overarc"`),Z.dot=J(bU,function(e,t){e.init=function(){t.init.call(this,`\\dot`,`<span class="mq-non-leaf"><span class="mq-dot-recurring-inner"><span class="mq-dot-recurring">˙</span><span class="mq-empty-box">&0</span></span></span>`)}}),Z.addmatrixrow=q(tW,`\\addmatrixrow`,`span`,`+`),Z.addmatrixcol=q(rW,`\\addmatrixcol`,`span`,`+`),Z.ngtr=Z[`≯`]=q(iW(`mq-ngtr`,`≯`),`\\ngtr `,`span`,`class="mq-non-leaf mq-ngtr"`),Z.nless=Z[`≮`]=q(iW(`mq-nless`,`≮`),`\\nless `,`span`,`class="mq-non-leaf mq-nless"`),Z.dot=q(nW,`\\dot`),Z.parallelogram=q(iW(`mq-parallelogram`,`▱`),`\\parallelogram `,`span`,`class="mq-non-leaf mq-parallelogram"`),Z.textcolor=J(bU,function(e,t){e.setColor=function(e){this.color=e,this.htmlTemplate=`<span class="mq-textcolor" style="color:`+e+`">&0</span>`},e.latex=function(){return`\\textcolor{`+this.color+`}{`+this.blocks[0].latex()+`}`},e.parser=function(){var e=this,n=hU.optWhitespace,r=hU.string,i=hU.regex;return n.then(r(`{`)).then(i(/^[#\w\s.,()%-]*/)).skip(r(`}`)).then(function(n){return e.setColor(n),t.parser.call(e)})},e.isStyleBlock=function(){return!0}}),Z.class=J(bU,function(e,t){e.parser=function(){var e=this,n=hU.string,r=hU.regex;return hU.optWhitespace.then(n(`{`)).then(r(/^[-\w\s\\\xA0-\xFF]*/)).skip(n(`}`)).then(function(n){return e.cls=n||``,e.htmlTemplate=`<span class="mq-class `+n+`">&0</span>`,t.parser.call(e)})},e.latex=function(){return`\\class{`+this.cls+`}{`+this.blocks[0].latex()+`}`},e.isStyleBlock=function(){return!0}});var aW=J(bU,function(e,t){e.ctrlSeq=`_{...}^{...}`,e.createLeftOf=function(e){if(!(!this.replacedFragment&&!e[Y]&&e.options.supSubsRequireOperand))return t.createLeftOf.apply(this,arguments)},e.contactWeld=function(e){for(var t=Y;t;t=t===Y&&X)if(this[t]instanceof aW){for(var n=`sub`;n;n=n===`sub`&&`sup`){var r=this[n],i=this[t][n];if(r){if(!i)this[t].addBlock(r.disown());else if(r.isEmpty())var a=JH(i,0,i.ends[Y]);else{r.jQ.children().insAtDirEnd(-t,i.jQ);var o=r.children().disown(),a=JH(i,o.ends[X],i.ends[Y]);t===Y?o.adopt(i,i.ends[X],0):o.adopt(i,0,i.ends[Y])}this.placeCursor=function(e,n){return function(r){r.insAtDirEnd(-t,e||n)}}(i,r)}}this.remove(),e&&e[Y]===this&&(t===X&&a?a[Y]?e.insRightOf(a[Y]):e.insAtLeftEnd(a.parent):e.insRightOf(this[t]));break}},iU.p.charsThatBreakOutOfSupSub=``,e.finalizeTree=function(){this.ends[Y].write=function(e,t){if(e.options.autoSubscriptNumerals&&this===this.parent.sub){if(t===`_`)return;var n=this.chToCmd(t,e.options);return n instanceof xU?e.deleteSelection():e.clearSelection().insRightOf(this.parent),n.createLeftOf(e.show())}e[Y]&&!e[X]&&!e.selection&&e.options.charsThatBreakOutOfSupSub.indexOf(t)>-1&&e.insRightOf(this.parent),SU.p.write.apply(this,arguments)}},e.moveTowards=function(e,n,r){n.options.autoSubscriptNumerals&&!this.sup?n.insDirOf(e,this):t.moveTowards.apply(this,arguments)},e.deleteTowards=function(e,n){if(n.options.autoSubscriptNumerals&&this.sub){var r=this.sub.ends[-e];r instanceof xU?r.remove():r&&r.deleteTowards(e,n.insAtDirEnd(-e,this.sub)),this.sub.isEmpty()&&(this.sub.deleteOutOf(Y,n.insAtLeftEnd(this.sub)),this.sup&&n.insDirOf(-e,this))}else t.deleteTowards.apply(this,arguments)},e.latex=function(){function e(e,t){var n=t&&t.latex();return t?e+(n.length===1?n:`{`+(n||` `)+`}`):``}return e(`_`,this.sub)+e(`^`,this.sup)},e.addBlock=function(e){this.supsub===`sub`?(this.sup=this.upInto=this.sub.upOutOf=e,e.adopt(this,this.sub,0).downOutOf=this.sub,e.jQ=PH(`<span class="mq-sup"/>`).append(e.jQ.children()).attr(RH,e.id).prependTo(this.jQ)):(this.sub=this.downInto=this.sup.downOutOf=e,e.adopt(this,0,this.sup).upOutOf=this.sup,e.jQ=PH(`<span class="mq-sub"></span>`).append(e.jQ.children()).attr(RH,e.id).appendTo(this.jQ.removeClass(`mq-sup-only`)),this.jQ.append(`<span style="display:inline-block;width:0">​</span>`));for(var t=0;t<2;t+=1)(function(e,t,n,r){e[t].deleteOutOf=function(i,a){if(a.insDirOf(this[i]?-i:i,this.parent),!this.isEmpty()){var o=this.ends[i];this.children().disown().withDirAdopt(i,a.parent,a[i],a[-i]).jQ.insDirOf(-i,a.jQ),a[-i]=o}e.supsub=n,delete e[t],delete e[r+`Into`],e[n][r+`OutOf`]=oW,delete e[n].deleteOutOf,t===`sub`&&PH(e.jQ.addClass(`mq-sup-only`)[0].lastChild).remove(),this.remove()}})(this,`sub sup`.split(` `)[t],`sup sub`.split(` `)[t],`down up`.split(` `)[t])},e.reflow=function(){var e=this.jQ,t=e.prev();if(t.length){var n=e.children(`.mq-sup`);if(n.length){var r=parseInt(n.css(`font-size`)),i=n.offset().top+n.height()-t.offset().top-.7*r,a=parseInt(n.css(`margin-bottom`));n.css(`margin-bottom`,a+i)}}}});function oW(e){var t=this.parent,n=e;do{if(n[X])return e.insLeftOf(t);n=n.parent.parent}while(n!==t);e.insRightOf(t)}Z.subscript=Z._=J(aW,function(e,t){e.supsub=`sub`,e.htmlTemplate=`<span class="mq-supsub mq-non-leaf"><span class="mq-sub"><span class="mq-empty-box">&0</span></span><span style="display:inline-block;width:0">​</span></span>`,e.textTemplate=[`_`],e.finalizeTree=function(){this.downInto=this.sub=this.ends[Y],this.sub.upOutOf=oW,t.finalizeTree.call(this)}}),Z.superscript=Z.supscript=Z[`^`]=J(aW,function(e,t){e.supsub=`sup`,e.htmlTemplate=`<span class="mq-supsub mq-non-leaf mq-sup-only"><span class="mq-sup"><span class="mq-empty-box">&0</span></span></span>`,e.textTemplate=[`^`],e.finalizeTree=function(){this.upInto=this.sup=this.ends[X],this.sup.downOutOf=oW,t.finalizeTree.call(this)}});var sW=J(bU,function(e,t){e.parser=function(){for(var e=hU.string,t=hU.optWhitespace,n=hU.succeed,r=vU.block,i=this,a=i.blocks=[SU(),SU()],o=0;o<a.length;o+=1)a[o].adopt(i,i.ends[X],0);return t.then(e(`_`).or(e(`^`))).then(function(e){var t=a[e===`_`?0:1];return r.then(function(e){return e.children().adopt(t,t.ends[X],0),n(i)})}).many().result(i)},e.finalizeTree=function(){this.downInto=this.ends[Y],this.upInto=this.ends[X],this.ends[Y].upOutOf=this.ends[X],this.ends[X].downOutOf=this.ends[Y]}}),cW=J(sW,function(e,t){e.init=function(e,t){var n=`<span class="mq-large-operator mq-non-leaf"><span class="mq-to"><span>&1</span></span><big>`+t+`</big><span class="mq-from"><span>&0</span></span></span>`;xU.prototype.init.call(this,e,n)},e.latex=function(){function e(e){return e.length===1?e:`{`+(e||` `)+`}`}return this.ctrlSeq+`_`+e(this.ends[Y].latex())+`^`+e(this.ends[X].latex())},e.createLeftOf=function(e){t.createLeftOf.apply(this,arguments),e.options.sumStartsWithNEquals&&(jU(`n`).createLeftOf(e),UU().createLeftOf(e))}});Z[`∑`]=Z.sum=Z.summation=q(cW,`\\sum `,`∑`),Z[`∏`]=Z.prod=Z.product=q(cW,`\\prod `,`∏`),Z.coprod=Z.coproduct=q(cW,`\\coprod `,`∐`),Z[`∫`]=Z.int=Z.integral=J(cW,function(e,t){e.init=function(){xU.prototype.init.call(this,`\\int `,`<span class="mq-int mq-non-leaf"><big>∫</big><span class="mq-supsub mq-non-leaf"><span class="mq-sup"><span class="mq-sup-inner">&1</span></span><span class="mq-sub">&0</span><span style="display:inline-block;width:0">​</span></span></span>`)},e.createLeftOf=bU.p.createLeftOf}),Z.lim=Z.limit=J(sW,function(e,t){e.init=function(){xU.prototype.init.call(this,`\\lim `,`<span class="mq-lim mq-non-leaf"><span class="mq-un-italicized">lim</span><span class="mq-approaches"><span>&0</span></span></span>`)},e.latex=function(){function e(e){return e.length===1?e:`{`+(e||` `)+`}`}return this.ctrlSeq+`_`+e(this.ends[Y].latex())}});var lW=Z.over=QH[`/`]=J(Z.frac=Z.dfrac=Z.cfrac=Z.fraction=J(bU,function(e,t){e.ctrlSeq=`\\frac`,e.htmlTemplate=`<span class="mq-fraction mq-non-leaf"><span class="mq-numerator"><span class="mq-empty-box">&0</span></span><span class="mq-denominator"><span class="mq-empty-box">&1</span></span><span style="display:inline-block;width:0">​</span></span>`,e.textTemplate=[`(`,`)/(`,`)`],e.finalizeTree=function(){this.upInto=this.ends[X].upOutOf=this.ends[Y],this.downInto=this.ends[Y].downOutOf=this.ends[X]}}),function(e,t){e.createLeftOf=function(e){if(!this.replacedFragment){for(var n=e[Y];n&&!(n instanceof $||n instanceof(Z.text||VH)||n instanceof cW||n.ctrlSeq===`\\ `||/^[,;:]$/.test(n.ctrlSeq));)n=n[Y];n instanceof cW&&n[X]instanceof aW&&(n=n[X],n[X]instanceof aW&&n[X].ctrlSeq!=n.ctrlSeq&&(n=n[X])),n!==e[Y]&&!e.isTooDeep(1)&&(this.replaces(ZH(n[X]||e.parent.ends[Y],e[Y])),e[Y]=n)}t.createLeftOf.call(this,e)}});Z.underset=J(bU,function(e,t){e.ctrlSeq=`\\underset`,e.htmlTemplate=`<span class="mq-underset mq-overunder mq-non-leaf"><span class="mq-over">&1</span><span class="mq-under">&0</span></span>`,e.textTemplate=[`[`,`|`,`]`],e.finalizeTree=function(){this.downInto=this.ends[Y].upOutOf=this.ends[X],this.upInto=this.ends[X].downOutOf=this.ends[Y]}}),Z.overset=J(bU,function(e,t){e.ctrlSeq=`\\overset`,e.htmlTemplate=`<span class="mq-overset mq-overunder mq-non-leaf"><span class="mq-over">&0</span><span class="mq-under">&1</span></span>`,e.textTemplate=[`[`,`|`,`]`],e.finalizeTree=function(){this.downInto=this.ends[X].upOutOf=this.ends[Y],this.upInto=this.ends[Y].downOutOf=this.ends[X]}});var uW=Z.sqrt=Z[`√`]=J(bU,function(e,t){e.ctrlSeq=`\\sqrt`,e.htmlTemplate=`<span class="mq-non-leaf"><span class="mq-scaled mq-sqrt-prefix">√</span><span class="mq-non-leaf mq-sqrt-stem"><span class="mq-empty-box">&0</span></span></span>`,e.textTemplate=[`sqrt(`,`)`],e.parser=function(){return vU.optBlock.then(function(e){return vU.block.map(function(t){var n=dW();return n.blocks=[e,t],e.adopt(n,0,0),t.adopt(n,e,0),n})}).or(t.parser.call(this))},e.reflow=function(){var e=this.ends[X].jQ.parent();WU(e.prev(),1,e.innerHeight()/+e.css(`fontSize`).slice(0,-2)-.1)}});Z.hat=J(bU,function(e,t){e.ctrlSeq=`\\hat`,e.htmlTemplate=`<span class="mq-non-leaf"><span class="mq-hat-prefix">^</span><span class="mq-hat-stem">&0</span></span>`,e.textTemplate=[`hat(`,`)`]});var dW=Z.nthroot=J(uW,function(e,t){e.htmlTemplate=`<sup class="mq-nthroot mq-non-leaf"><span class="mq-empty-box">&0</span></sup><span class="mq-scaled"><span class="mq-sqrt-prefix mq-scaled">√</span><span class="mq-sqrt-stem mq-non-leaf"><span class="mq-empty-box">&1</span></span></span>`,e.textTemplate=[`sqrt[`,`](`,`)`],e.latex=function(){return`\\sqrt[`+this.ends[Y].latex()+`]{`+this.ends[X].latex()+`}`}}),fW=J(bU,function(e,t){e.init=function(e,n,r){var i=`<span class="mq-non-leaf"><span class="mq-diacritic-above">`+n+`</span><span class="mq-diacritic-stem">&0</span></span>`;t.init.call(this,e,i,r)}});Z.vec=q(fW,`\\vec`,`→`,[`vec(`,`)`]),Z.tilde=q(fW,`\\tilde`,`~`,[`tilde(`,`)`]),Z.lrncuberoot=J(uW,function(e,t){e.ctrlSeq=`\\lrncuberoot`,e.htmlTemplate=`<sup class="mq-nthroot mq-non-leaf"><span class="mq-empty-box">3</span></sup><span class="mq-scaled"><span class="mq-sqrt-prefix mq-scaled">√</span><span class="mq-sqrt-stem mq-non-leaf"><span class="mq-empty-box">&0</span></span></span>`,e.textTemplate=[`sqrt[3](`,`)`],e.latex=function(){return`\\sqrt[3]{`+this.ends[Y].latex()+`}`}}),Z.abs=J(bU,function(e){e.ctrlSeq=`\\abs`,e.htmlTemplate=`<span class="mq-abs mq-non-leaf"><span class="mq-empty-box">&0</span></span>`,e.textTemplate=[`|`,`|`]}),Z.lrnplaceholder=J(bU,function(e,t){e.ctrlSeq=`\\lrnplaceholder`,e.htmlTemplate=`<span class="mq-lrnplaceholder mq-non-leaf"><span class="mq-empty-box">&0</span></span>`,e.textTemplate=[``],e.latex=function(){return this.ends[Y].latex()}}),Z.lrnexponent=J(bU,function(e,t){e.ctrSeq=`\\lrnexponent`,e.htmlTemplate=`<span class="mq-lrnexponent mq-non-leaf"><span class="mq-lrnplaceholder mq-non-leaf"><span class="mq-empty-box">&0</span></span><span class="mq-supsub mq-non-leaf mq-sup-only"><span class="mq-sup"><span class="mq-empty-box">&1</span></span></span></span>`,e.textTemplate=[``,`**`],e.latex=function(){var e=this.ends[X].latex();return e.length>1?e=`{`+e+`}`:e.length===0&&(e=`{ }`),this.ends[Y].latex()+`^`+e}}),Z.lrnsquaredexponent=J(bU,function(e,t){e.ctrSeq=`\\lrnsquaredexponent`,e.htmlTemplate=`<span class="mq-lrnexponent mq-non-leaf"><span class="mq-lrnplaceholder mq-non-leaf"><span class="mq-empty-box">&0</span></span><span class="mq-supsub mq-non-leaf mq-sup-only"><span class="mq-sup"><span class="mq-empty-box">2</span></span></span></span>`,e.textTemplate=[``,`**2`],e.latex=function(){return this.ends[Y].latex()+`^2`}}),Z.lrnsubscript=J(bU,function(e,t){e.ctrSeq=`\\lrnsubscript`,e.htmlTemplate=`<span class="mq-lrnexponent mq-non-leaf"><span class="mq-lrnplaceholder mq-non-leaf"><span class="mq-empty-box">&0</span></span><span class="mq-supsub mq-non-leaf"><span class="mq-sub"><span class="mq-empty-box">&1</span></span><span style="display:inline-block;width:0"> </span></span></span>`,e.textTemplate=[``,`_`],e.latex=function(){return this.ends[Y].latex()+`_`+this.ends[X].latex()}});function pW(e,t){e.jQadd=function(){t.jQadd.apply(this,arguments),this.delimjQs=this.jQ.children(`:first`).add(this.jQ.children(`:last`)),this.contentjQ=this.jQ.children(`:eq(1)`)},e.reflow=function(){var e=this.contentjQ.outerHeight()/parseFloat(this.contentjQ.css(`fontSize`));WU(this.delimjQs,zH(1+.2*(e-1),1.2),1.2*e)}}var mW=J(J(bU,pW),function(e,t){e.init=function(e,n,r,i,a){t.init.call(this,`\\left`+i,IH,[n,r]),this.side=e,this.sides={},this.sides[Y]={ch:n,ctrlSeq:i},this.sides[X]={ch:r,ctrlSeq:a}},e.numBlocks=function(){return 1},e.html=function(){return this.htmlTemplate=`<span class="mq-non-leaf"><span class="mq-scaled mq-paren`+(this.side===X?` mq-ghost`:``)+`">`+this.sides[Y].ch+`</span><span class="mq-non-leaf">&0</span><span class="mq-scaled mq-paren`+(this.side===Y?` mq-ghost`:``)+`">`+this.sides[X].ch+`</span></span>`,t.html.call(this)},e.latex=function(){return`\\left`+this.sides[Y].ctrlSeq+this.ends[Y].latex()+`\\right`+this.sides[X].ctrlSeq},e.matchBrack=function(e,t,n){return n instanceof mW&&n.side&&n.side!==-t&&(!e.restrictMismatchedBrackets||hW[this.sides[this.side].ch]===n.sides[n.side].ch||{"(":`]`,"[":`)`}[this.sides[Y].ch]===n.sides[X].ch)&&n},e.closeOpposing=function(e){e.side=0,e.sides[this.side]=this.sides[this.side],e.delimjQs.eq(this.side===Y?0:1).removeClass(`mq-ghost`).html(this.sides[this.side].ch)},e.createLeftOf=function(e){if(!this.replacedFragment){var n=e.options;if(this.sides[Y].ch===`|`)var r=this.matchBrack(n,X,e[X])||this.matchBrack(n,Y,e[Y])||this.matchBrack(n,0,e.parent.parent);else var r=this.matchBrack(n,-this.side,e[-this.side])||this.matchBrack(n,-this.side,e.parent.parent)}if(r){var i=this.side=-r.side;this.closeOpposing(r),r===e.parent.parent&&e[i]&&ZH(e[i],e.parent.ends[i],-i).disown().withDirAdopt(-i,r.parent,r,r[i]).jQ.insDirOf(i,r.jQ),r.bubble(`reflow`)}else r=this,i=r.side,r.replacedFragment?r.side=0:e[-i]&&(r.replaces(ZH(e[-i],e.parent.ends[-i],i)),e[-i]=0),t.createLeftOf.call(r,e);i===Y?e.insAtLeftEnd(r.ends[Y]):e.insRightOf(r)},e.placeCursor=VH,e.unwrap=function(){this.ends[Y].children().disown().adopt(this.parent,this,this[X]).jQ.insertAfter(this.jQ),this.remove()},e.deleteSide=function(e,t,n){var r=this.parent,i=this[e],a=r.ends[e];if(e===this.side){this.unwrap(),i?n.insDirOf(-e,i):n.insAtDirEnd(e,r);return}var o=n.options,s=!this.side;if(this.side=-e,this.matchBrack(o,e,this.ends[Y].ends[this.side])){this.closeOpposing(this.ends[Y].ends[this.side]);var c=this.ends[Y].ends[e];this.unwrap(),c.siblingCreated&&c.siblingCreated(n.options,e),i?n.insDirOf(-e,i):n.insAtDirEnd(e,r)}else{if(this.matchBrack(o,e,this.parent.parent))this.parent.parent.closeOpposing(this),this.parent.parent.unwrap();else if(t&&s){this.unwrap(),i?n.insDirOf(-e,i):n.insAtDirEnd(e,r);return}else this.sides[e]={ch:hW[this.sides[this.side].ch],ctrlSeq:hW[this.sides[this.side].ctrlSeq]},this.delimjQs.removeClass(`mq-ghost`).eq(e===Y?0:1).addClass(`mq-ghost`).html(this.sides[e].ch);if(i){var c=this.ends[Y].ends[e];ZH(i,a,-e).disown().withDirAdopt(-e,this.ends[Y],c,0).jQ.insAtDirEnd(e,this.ends[Y].jQ.removeClass(`mq-empty`)),c.siblingCreated&&c.siblingCreated(n.options,e),n.insDirOf(-e,i)}else t?n.insDirOf(e,this):n.insAtDirEnd(e,this.ends[Y])}},e.deleteTowards=function(e,t){this.deleteSide(-e,!1,t)},e.finalizeTree=function(){this.ends[Y].deleteOutOf=function(e,t){this.parent.deleteSide(e,!0,t)},this.finalizeTree=this.intentionalBlur=function(){this.delimjQs.eq(+(this.side===Y)).removeClass(`mq-ghost`),this.side=0}},e.siblingCreated=function(e,t){t===-this.side&&this.finalizeTree()}}),hW={"(":`)`,")":`(`,"[":`]`,"]":`[`,"{":`}`,"}":`{`,"\\{":`\\}`,"\\}":`\\{`,"⟨":`⟩`,"⟩":`⟨`,"\\langle ":`\\rangle `,"\\rangle ":`\\langle `,"|":`|`,"\\lVert ":`\\rVert `,"\\rVert ":`\\lVert `};function gW(e,t){var t=t||e,n=hW[e],r=hW[t];QH[e]=q(mW,Y,e,n,t,r),QH[n]=q(mW,X,e,n,t,r)}gW(`(`),gW(`[`),gW(`{`,`\\{`),Z.langle=q(mW,Y,`⟨`,`⟩`,`\\langle `,`\\rangle `),Z.rangle=q(mW,X,`⟨`,`⟩`,`\\langle `,`\\rangle `),QH[`|`]=q(mW,Y,`|`,`|`,`|`,`|`),Z.lVert=q(mW,Y,`∥`,`∥`,`\\lVert `,`\\rVert `),Z.rVert=q(mW,X,`∥`,`∥`,`\\lVert `,`\\rVert `),Z.left=J(bU,function(e){e.parser=function(){var e=hU.regex,t=hU.string;hU.succeed;var n=hU.optWhitespace;return n.then(e(/^(?:[([|]|\\\{|\\langle(?![a-zA-Z])|\\lVert(?![a-zA-Z]))/)).then(function(r){var i=r.charAt(0)===`\\`?r.slice(1):r;return r==`\\langle`&&(i=`⟨`,r+=` `),r==`\\lVert`&&(i=`∥`,r+=` `),vU.then(function(a){return t(`\\right`).skip(n).then(e(/^(?:[\])|]|\\\}|\\rangle(?![a-zA-Z])|\\rVert(?![a-zA-Z]))/)).map(function(e){var t=e.charAt(0)===`\\`?e.slice(1):e;e==`\\rangle`&&(t=`⟩`,e+=` `),e==`\\rVert`&&(t=`∥`,e+=` `);var n=mW(0,i,t,r,e);return n.blocks=[a],a.adopt(n,0,0),n})})})}}),Z.right=J(bU,function(e){e.parser=function(){return hU.fail(`unmatched \\right`)}}),Z.choose=J(Z.binom=Z.binomial=J(J(bU,pW),function(e,t){e.ctrlSeq=`\\binom`,e.htmlTemplate=`<span class="mq-non-leaf"><span class="mq-paren mq-scaled">(</span><span class="mq-non-leaf"><span class="mq-array mq-non-leaf"><span>&0</span><span>&1</span></span></span><span class="mq-paren mq-scaled">)</span></span>`,e.textTemplate=[`choose(`,`,`,`)`]}),function(e){e.createLeftOf=lW.prototype.createLeftOf}),Z.editable=Z.MathQuillMathField=J(bU,function(e,t){e.ctrlSeq=`\\MathQuillMathField`,e.htmlTemplate=`<span class="mq-editable-field"><span class="mq-root-block">&0</span></span>`,e.parser=function(){var e=this,n=hU.string,r=hU.regex,i=hU.succeed;return n(`[`).then(r(/^[a-z][a-z0-9]*/i)).skip(n(`]`)).map(function(t){e.name=t}).or(i()).then(t.parser.call(e))},e.finalizeTree=function(e){var t=nU(this.ends[Y],this.jQ,e);t.KIND_OF_MQ=`MathField`,t.editable=!0,t.createTextarea(),t.editablesTextareaEvents(),t.cursor.insAtRightEnd(t.root),mU(t.root)},e.registerInnerField=function(e,t){e.push(e[this.name]=t(this.ends[Y].controller))},e.latex=function(){return this.ends[Y].latex()},e.text=function(){return this.ends[Y].text()}});var _W=Z.embed=J(xU,function(e,t){e.setOptions=function(e){function t(){return``}return this.text=e.text||t,this.htmlTemplate=e.htmlString||``,this.latex=e.latex||t,this},e.parser=function(){var e=this,t=hU.string,n=hU.regex,r=hU.succeed;return t(`{`).then(n(/^[a-z][a-z0-9]*/i)).skip(t(`}`)).then(function(i){return t(`[`).then(n(/^[-\w\s]*/)).skip(t(`]`)).or(r()).map(function(t){return e.setOptions(sU[i](t))})})}});Z.MathQuillResponseContainer=J(bU,function(e,t){e.ctrlSeq=`\\MathQuillResponseContainer`,e.htmlTemplate=`<span class="lrn-mq-response-container"><marker class="lrn-qe-keyboard-i-response"></marker><content>Response</content></span>`,e.latex=function(){return`\\MathQuillResponseContainer`},e.text=function(){return this.ends[Y].text()}}),Z.MathQuillResponseContainerIcon=J(bU,function(e,t){e.ctrlSeq=`\\MathQuillResponseContainerIcon`,e.htmlTemplate=`<span class="lrn-mq-response-container-icon"><span class="lrn-qe-keyboard-i-response"></span></span>`,e.latex=function(){return`\\MathQuillResponseContainerIcon`},e.text=function(){return this.ends[Y].text()}});var vW=Z.matrix=J(bU,function(e,t){var n=J(SU,function(e,t){e.init=function(e,n){return this.column=e,this.row=n,t.init.call(this)},e.keystroke=function(e,n,r){switch(e){case`Shift-Spacebar`:return n.preventDefault(),this.parent.insertColumn(this);case`Shift-Enter`:return this.parent.insertRow(this)}return t.keystroke.apply(this,arguments)},e.deleteOutOf=function(e,n){var r=this,i=arguments;this.parent.backspace(this,e,n,function(){return t.deleteOutOf.apply(r,i)})}}),r={column:`&`,row:`\\\\`};e.parentheses={left:null,right:null},e.maximum={rows:5,columns:5},e.defaults={rows:2,columns:2},e.ctrlSeq=`\\matrix`,e.createBlocks=function(){var e=this,t=e.blocks=[],r,i,a=0;this.htmlTemplate.replace(/&\d+/g,function(o,s){var c=e.htmlTemplate.substring(0,s).match(/<tr[^>]*>/gi).length-1;i=r===c?i+1:0,t[a]=n(i,c),t[a].adopt(e,e.ends[X],0),r=c,a++})},e.reflow=function(){var e=this.jQ.children(`table`),t=e.outerHeight()/+e.css(`fontSize`).slice(0,-2),n=this.jQ.children(`.mq-paren`);n.length&&WU(n,zH(1+.2*(t-1),1.2),1.05*t)},e.latex=function(){var e=this.getMatrixName(),t=`\\begin{`+e+`}`,n,i,a;for(a=0;a<this.blocks.length;a++)n=this.blocks[a].row,i!==void 0&&(i===n?t+=r.column:t+=r.row),i=n,t+=this.blocks[a].latex();return t+=`\\end{`+e+`}`,t},e.createLeftOf=function(n){this.cursor=n;var r=Math.min(this.defaults.rows,this.maximum.rows),i=Math.min(this.defaults.columns,this.maximum.columns);this.defaultHtmlTemplate=this.defaultHtmlTemplate||this.generateHtmlTemplate(r,i),e.htmlTemplate=this.defaultHtmlTemplate,t.createLeftOf.call(this,n)},e.getMatrixName=function(){return this.ctrlSeq.replace(`\\`,``)},e.generateHtmlTemplate=function(e,t){var n=`<span class="mq-matrix mq-non-leaf">`+o(this.parentheses.left);n+=`<table class="mq-non-leaf">`,e=Math.min(e,this.maximum.rows),t=Math.min(t,this.maximum.columns);for(var r=0,i=0;i<e;i++){n+=`<tr>`;for(var a=0;a<t;a++)n+=`<td>&`+r+`</td>`,r++;n+=`</tr>`}return n+=`</table>`,n+=o(this.parentheses.right)+`</span>`,n;function o(e){return e?`<span class="mq-paren mq-scaled">`+e+`</span>`:``}},e.htmlTemplate=e.generateHtmlTemplate(1,1),e.parser=function(){var e=hU.regex,t=this,i=this.getMatrixName(),a=RegExp(`^(.*?)\\\\end{`+i+`}`),o=RegExp(`\\\\end{`+i+`}`);return e(a).then(function(e){var i=e.replace(o,``),a=[],s=i.split(r.row),c=Math.min(s.length,t.maximum.rows),l=0,u,d;for(d=0;d<c;d++)u=s[d].split(r.column),l=Math.max(l,u.length);for(l=Math.min(l,t.maximum.columns),d=0;d<c;d++){u=s[d].split(r.column);for(var e=0;e<l;e++){var f=n(e,d);vU.parse(u[e]||` `).children().adopt(f,f.ends[X],0),a.push(f)}}t.htmlTemplate=t.generateHtmlTemplate(c,l),t.blocks=a;for(var d=0;d<a.length;d+=1)a[d].adopt(t,t.ends[X],0);return hU.succeed(t)})},e.finalizeTree=function(){var e=this.jQ.find(`table`);e.length&&(this.relink(),e.removeClass(function(e,t){var n=t.match(/mq-rows-\d+/g);return n&&n.join(` `)||``}),e.addClass(`mq-rows-`+e.find(`tr`).length))},e.relink=function(){var e=this.jQ.find(`td`),t=YH.byId[e.first().attr(RH)],n=YH.byId[e.last().attr(RH)],r=e.eq(0).closest(`tr`),i=[];e.each(function(t){var n=YH.byId[PH(this).attr(RH)],a=e.eq(t+1),o=PH(this).closest(`tr`).next(`tr`),s=PH(this).closest(`tr`).index(),c=PH(this).index(),l;if(a.length){var u=YH.byId[a.attr(RH)];n[X]=u,u[Y]=n}if(l=o.length?o.find(`td`).eq(c):r.find(`td`).eq(c+1),l.length){var d=YH.byId[l.attr(RH)];n.downOutOf=d,d.upOutOf=n}n.column=c,n.row=s,i.push(n)}),this.ends[Y]=t,this.ends[X]=n,t&&t[Y]&&delete t[Y],n&&n[X]&&delete n[X],this.blocks=i},e.deleteCell=function(e){var t=e.jQ.closest(`tr`),n=e.jQ.index(),r=t.index(),i=t.find(`td`).not(e.jQ),a=this.jQ.find(`tr`).not(t).map(function(){return PH(this).find(`td`)[n]}),o=this.jQ.find(`td`).length===1,s;function c(){return YH.byId[PH(this).attr(RH)].isEmpty()}return i.filter(c).length===i.length&&a.length&&(i.remove(),e.jQ.remove(),t.remove(),this.finalizeTree()),a.filter(c).length===a.length&&i.length&&(a.remove(),e.jQ.remove(),this.finalizeTree()),o||(r=Math.min(r,this.jQ.find(`tr`).length-1),n=Math.min(n,this.jQ.find(`tr`).eq(r).find(`td`).length-1),s=YH.byId[this.jQ.find(`tr`).eq(r).find(`td`).eq(n).attr(RH)]),s},e.addRow=function(e){if(!(this.jQ.find(`tr`).length>=this.maximum.rows)){for(var t=e.find(`td`).length,r=PH(`<tr></tr>`),i,a,o=0;o<t;o++)i=n(),i.parent=this,i.jQ=PH(`<td class="mq-empty">`).attr(RH,i.id),r.append(i.jQ),a||=i;return r.insertAfter(e),a}},e.addColumn=function(e){if(!(e.closest(`tr`).find(`td`).length>=this.maximum.columns)){var t=e.index(),r=e.closest(`tr`).index(),i=this,a,o=[];return this.jQ.find(`tr`).each(function(){a=n(),a.parent=i,a.jQ=PH(`<td class="mq-empty">`).attr(RH,a.id),a.jQ.insertAfter(PH(this).find(`td`).eq(t)),o.push(a)}),o[r]}},e.insertColumn=function(e){newBlock=this.addColumn(e.jQ),newBlock&&(this.cursor=this.cursor||this.parent.cursor,this.finalizeTree(),this.bubble(`reflow`).cursor.insAtRightEnd(newBlock))},e.insertRow=function(e){newBlock=this.addRow(e.jQ.closest(`tr`)),newBlock&&(this.cursor=this.cursor||this.parent.cursor,this.finalizeTree(),this.bubble(`reflow`).cursor.insAtRightEnd(newBlock))},e.backspace=function(e,t,n,r){if(e.isEmpty()){var i=this.deleteCell(e);i?n.insAtRightEnd(i):(r(),this.finalizeTree()),this.bubble(`edited`)}}});Z.pmatrix=J(vW,function(e,t){e.ctrlSeq=`\\pmatrix`,e.parentheses={left:`(`,right:`)`}}),Z.bmatrix=J(vW,function(e,t){e.ctrlSeq=`\\bmatrix`,e.parentheses={left:`[`,right:`]`}}),Z.Bmatrix=J(vW,function(e,t){e.ctrlSeq=`\\Bmatrix`,e.parentheses={left:`{`,right:`}`}}),Z.vmatrix=J(vW,function(e,t){e.ctrlSeq=`\\vmatrix`,e.parentheses={left:`|`,right:`|`}}),Z.Vmatrix=J(vW,function(e,t){e.ctrlSeq=`\\Vmatrix`,e.parentheses={left:`‖`,right:`‖`}});var yW=fU(3);for(var bW in yW)(function(e,t){typeof t==`function`?(lU[e]=function(){return cU(),t.apply(this,arguments)},lU[e].prototype=t.prototype):lU[e]=t})(bW,yW[bW]);var xW=function(e){e.registerEmbed(`newLine`,()=>({htmlString:`<div class="newLine"></div>`,text:()=>`testText`,latex:()=>`\\embed{newLine}[]`}))},SW;typeof window<`u`&&(SW=lU.getInterface(3),SW&&SW.registerEmbed&&xW(SW));var CW=Uu(`math-input:mq:input`),wW=R(`span`)({}),TW=class extends P.Component{static propTypes={className:v.string,onClick:v.func,onChange:v.func,latex:v.string,onFocus:v.func,onBlur:v.func};componentDidMount(){if(!SW)throw Error(`MQ is not defined - but component has mounted?`);this.mathField=SW.MathField(this.input,{handlers:{edit:this.onInputEdit.bind(this)}}),this.updateLatex()}componentDidUpdate(){this.updateLatex()}updateLatex(){if(!this.mathField)return;let{latex:e}=this.props;e!=null&&this.mathField.latex(e)}clear(){return this.mathField.latex(``),``}blur(){CW(`blur mathfield`),this.mathField.blur()}focus(){CW(`focus mathfield...`),this.mathField.focus()}command(e){return CW(`command: `,e),Array.isArray(e)?e.forEach(e=>{this.mathField.cmd(e)}):this.mathField.cmd(e),this.mathField.focus(),this.mathField.latex()}keystroke(e){return this.mathField.keystroke(e),this.mathField.focus(),this.mathField.latex()}write(e){return CW(`write: `,e),this.mathField.write(e),this.mathField.focus(),this.mathField.latex()}onInputEdit=()=>{CW(`[onInputEdit] ...`);let{onChange:e}=this.props;this.mathField&&e&&e(this.mathField.latex())};refresh=()=>{this.blur(),this.focus()};onKeyPress=e=>{if(Object.keys(this.mathField.__controller.options).indexOf(`ignoreNextMousedown`)<0&&this.refresh(),e.charCode===13){e.preventDefault();return}};onClick=e=>{let{onClick:t}=this.props;this.refresh(),t&&t(e)};shouldComponentUpdate(e){return CW(`next: `,e.latex),CW(`current: `,this.mathField.latex()),e.latex!==this.mathField.latex()}render(){let{onFocus:e,onBlur:t,className:n}=this.props;return(0,F.jsx)(wW,{className:n,onKeyDown:this.onKeyPress,onClick:this.onClick,onFocus:e,onBlur:t,ref:e=>this.input=e})}},EW=Uu(`pie-lib:math-input:mq:static`),DW=/\\MathQuillMathField\[r\d*\]\{(.*?)\}/g,OW=/ /g;function kW(e=``){return e.replace(OW,``)}function AW(e){let t=0;for(let n=0;n<(e||``).length;n++)e[n]===`{`&&t++;return t}var jW=class extends P.Component{static propTypes={latex:v.string.isRequired,onFocus:v.func,onBlur:v.func,className:v.string,getFieldName:v.func,onSubFieldChange:v.func,onSubFieldFocus:v.func,setInput:v.func};static defaultProps={getFieldName:()=>{}};constructor(e){super(e),this.state={announcement:``,previousLatex:``,inputSource:null,isDeleteKeyPressed:!1},this.inputRef=P.createRef()}componentDidMount(){this.update(),vH(),this.createLiveRegion(),this.addEventListeners()}componentDidUpdate(){this.update(),vH()}componentWillUnmount(){this.removeLiveRegion(),this.removeEventListeners()}createLiveRegion=()=>{this.liveRegion=document.createElement(`div`),this.liveRegion.style.position=`absolute`,this.liveRegion.style.width=`1px`,this.liveRegion.style.height=`1px`,this.liveRegion.style.marginTop=`-1px`,this.liveRegion.style.clip=`rect(1px, 1px, 1px, 1px)`,this.liveRegion.style.overflow=`hidden`,this.liveRegion.setAttribute(`aria-live`,`polite`),this.liveRegion.setAttribute(`aria-atomic`,`true`),document.body.appendChild(this.liveRegion)};addEventListeners=()=>{let e=this.inputRef.current;e&&(e.addEventListener(`keydown`,this.handleKeyDown),e.addEventListener(`click`,this.handleMathKeyboardClick))};removeEventListeners=()=>{let e=this.inputRef.current;e&&(e.removeEventListener(`keydown`,this.handleKeyDown),e.removeEventListener(`click`,this.handleMathKeyboardClick))};removeLiveRegion=()=>{this.liveRegion&&=(document.body.removeChild(this.liveRegion),null)};handleKeyDown=e=>{(e?.key===`Backspace`||e?.key===`Delete`)&&this.setState({isDeleteKeyPressed:!0}),this.setState({inputSource:`keyboard`})};handleMathKeyboardClick=()=>{this.setState({inputSource:`mathKeyboard`})};onInputEdit=e=>{if(!this.mathField||this._isProgrammaticUpdate)return;let t=this.props.getFieldName(e,this.mathField.innerFields);if(this.props.onSubFieldChange){let n=e.latex().match(/[0-9]\\ \\frac\{[^\{]*\}\{ \}/);if(this.inputRef?.current&&n&&n?.length)try{e.__controller.cursor.insLeftOf(e.__controller.cursor.parent[-1].parent),e.el().dispatchEvent(new KeyboardEvent(`keydown`,{keyCode:8}))}catch(e){console.error(e.toString())}else this.props.onSubFieldChange(t,e.latex())}this.announceLatexConversion(e.latex())};announceLatexConversion=e=>{if(!this.state){console.error(`State is not initialized`);return}let{previousLatex:t,inputSource:n,isDeleteKeyPressed:r}=this.state,i=`Converted to math symbol`;if(n===`keyboard`&&!r)if(AW(e)>AW(t))this.announceMessage(i);else try{this.mathField.parseLatex(t),this.mathField.parseLatex(e),e==t&&this.announceMessage(i)}catch(e){console.warn(`Error parsing latex:`,e.message),console.warn(e)}(this.state.previousLatex!==e||this.state.isDeleteKeyPressed)&&this.setState({previousLatex:e,isDeleteKeyPressed:!1})};announceMessage=e=>{this.setState({previousLatex:``}),this.liveRegion&&(this.liveRegion.textContent=e,setTimeout(()=>{this.liveRegion.textContent=``},500))};update=()=>{if(!SW)throw Error(`MQ is not defined - but component has mounted?`);this.mathField||=SW.StaticMath(this.inputRef?.current,{handlers:{edit:this.onInputEdit.bind(this)}});try{this._isProgrammaticUpdate=!0,this.mathField.parseLatex(this.props.latex),this.mathField.latex(this.props.latex)}catch{this.mathField.latex(`\\MathQuillMathField[r1]{}`)}finally{this._isProgrammaticUpdate=!1}};blur=()=>{EW(`blur mathfield`),this.mathField.blur()};focus=()=>{EW(`focus mathfield...`),this.mathField.focus()};shouldComponentUpdate(e){try{let t=kW(this.mathField.parseLatex(e.latex)),n=(e.latex.match(DW)||[]).length,r=t!==kW(this.mathField.latex().trim())||n!==Object.keys(this.mathField.innerFields).length/2;return EW(`[shouldComponentUpdate] `,r),r}catch(e){return console.warn(`Error parsing latex:`,e.message,`skip update`),console.warn(e),!1}}onFocus=e=>{try{let t=e.target.parentElement.nextSibling,n=parseInt(t.getAttribute(`mathquill-block-id`),10);n||=(t=t.parentElement,parseInt(t.getAttribute(`mathquill-block-id`),10));let r=this.mathField.innerFields.find(e=>e.id===n);if(r){let e=this.props.getFieldName(r,this.mathField.innerFields);this.props.setInput&&this.props.setInput(r),this.props.onSubFieldFocus(e,r)}}catch(e){console.error(`error finding root block`,e.message)}};render(){let{onBlur:e,className:t}=this.props;return(0,F.jsx)(`span`,{className:t,onFocus:this.onFocus,onBlur:e,ref:this.inputRef})}},MW={fontFamily:`MJXZERO, MJXTEX !important`,"-webkit-font-smoothing":`antialiased !important`,"& .mq-math-mode > span > var":{fontFamily:`MJXZERO, MJXTEX-I !important`},"& .mq-math-mode span var":{fontFamily:`MJXZERO, MJXTEX-I !important`},"& .mq-math-mode .mq-nonSymbola":{fontFamily:`MJXZERO, MJXTEX-I !important`},"& .mq-math-mode > span > var.mq-operator-name":{fontFamily:`MJXZERO, MJXTEX !important`}},NW={"& .mq-longdiv-inner":{marginTop:`-1px`,marginLeft:`5px !important;`,"& > .mq-empty":{padding:`0 !important`,marginLeft:`0px !important`,marginTop:`2px`}},"& .mq-math-mode .mq-longdiv":{display:`inline-flex !important`}},PW={"& .mq-math-mode sup.mq-nthroot":{fontSize:`70% !important`,verticalAlign:`0.5em !important`,paddingRight:`0.15em`},"& .mq-math-mode .mq-supsub":{fontSize:`70.7% !important`},"& .mq-supsub ":{fontSize:`70.7%`},"& .mq-math-mode .mq-supsub.mq-sup-only":{verticalAlign:`-0.1em !important`,"& .mq-sup":{marginBottom:`0px !important`}},"& .mq-math-mode .mq-fraction + .mq-supsub.mq-sup-only":{verticalAlign:`0.4em !important`},"& .mq-math-mode .mq-supsub.mq-sup-only.mq-after-fraction-group":{verticalAlign:`0.4em !important`}},FW={"& *":{...MW,...NW,"& .mq-math-mode .mq-sqrt-prefix":{top:`0 !important`},"& .mq-math-mode .mq-empty":{padding:`9px 1px !important`},"& .mq-math-mode .mq-longdiv-inner .mq-empty":{padding:`0 !important`},"& .mq-math-mode .mq-supsub":{fontSize:`70.7% !important`},"& .mq-math-mode .mq-sqrt-stem":{marginTop:`-5px`,paddingTop:`4px`},"& .mq-math-mode .mq-paren":{verticalAlign:`middle !important`},"& .mq-math-mode .mq-overarrow .mq-overarrow-inner .mq-empty":{padding:`0 !important`},"& .mq-math-mode .mq-overline .mq-overline-inner .mq-empty ":{padding:`0 !important`}}},IW={commonMqFontStyles:MW,longdivStyles:NW,supsubStyles:PW,commonMqKeyboardStyles:FW},LW=e=>(Up(5-e.length,()=>e.push([])),Wp.apply(null,e)),RW=Uu(`pie-lib:math-inline:keypad`),zW=R(jW)(({latex:e})=>{let t={pointerEvents:`none`,textTransform:`none !important`,color:Il(),"& .mq-scaled.mq-sqrt-prefix":{transform:`scale(1, 0.9) !important`},"& .mq-sup-only .mq-sup":{marginBottom:`0.9px !important`},"& .mq-empty":{backgroundColor:`${Mu()} !important`},"& .mq-overline .mq-overline-inner":{borderTop:`2px solid black`},"& .mq-non-leaf.mq-overline":{borderTop:`none !important`},"& .mq-overarrow":{width:`30px`,marginTop:`0 !important`,borderTop:`2px solid black`,fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`,"&.mq-arrow-both":{top:`0px !important`,"& *":{lineHeight:`1 !important`,borderTop:`none !important`},"&:before":{fontSize:`80%`,left:`calc(-13%) !important`,top:`-0.31em !important`},"&:after":{fontSize:`80% !important`,right:`calc(-13%) !important`,top:`-1.5em`},"&.mq-empty:before":{fontSize:`80%`,left:`calc(-13%)`,top:`-0.26em`},"&.mq-empty:after":{fontSize:`80%`,right:`calc(-13%)`,top:`-0.26em`},"&.mq-empty":{minHeight:`1.4em`}},"&.mq-arrow-right:before":{fontSize:`80%`,right:`calc(-13%) !important`,top:`-0.26em !important`},"& .mq-overarrow-inner":{border:`none !important`},"& .mq-overarrow-inner .mq-overarrow-inner-right":{display:`none !important`}},"& .mq-root-block":{padding:`5px !important`},"& .mq-overarrow.mq-arrow-both.mq-empty:after":{right:`-6px`,fontSize:`80% !important`,top:`-3px`},"& .mq-overarrow.mq-arrow-right.mq-empty:before":{right:`-5px`,fontSize:`80% !important`,top:`-3px`},"& .mq-overarrow.mq-arrow-both.mq-empty:before":{left:`-6px`,fontSize:`80% !important`,top:`-3px`},"& .mq-longdiv-inner":{borderTop:`1px solid !important`,paddingTop:`1.5px !important`},"& .mq-parallelogram":{lineHeight:.85},"& .mq-overarc":{borderTop:`2px solid black !important`,"& .mq-overline":{borderTop:`none !important`},"& .mq-overline-inner":{borderTop:`none !important`,paddingTop:`0 !important`}}};return e===`\\parallel`?{...t,fontStyle:`italic !important`}:e===`\\overleftrightarrow{\\overline{}}`?{...t,"& .mq-overarrow.mq-arrow-both":{"& .mq-overline-inner":{borderTop:`none !important`,paddingTop:`0 !important`},"&:after":{position:`absolute !important`,top:`0px !important`}}}:t});zW.propTypes={latex:v.string.isRequired};var BW=e=>e?{gridTemplateColumns:`repeat(${e.columns}, minmax(min-content, 150px))`,gridTemplateRows:`repeat(${e.rows}, minmax(40px, 60px))`,gridAutoFlow:`initial`}:{},VW=R(`div`)(()=>({...FW,width:`100%`,display:`grid`,gridTemplateRows:`repeat(5, minmax(40px, 60px))`,gridRowGap:`0px`,gridColumnGap:`0px`,gridAutoFlow:`column`,"&.character":{textTransform:`initial !important`,gridTemplateRows:`repeat(5, minmax(40px, 50px)) !important`},"&.language":{gridTemplateRows:`repeat(4, minmax(40px, 50px)) !important`,"& *":{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`}}})),HW=R(ff)(({category:e,isDelete:t,isComma:n,isDot:r})=>({minWidth:`auto`,textTransform:`none`,fontSize:n||r?`200% !important`:`140% !important`,lineHeight:n||r?`100%`:`normal`,color:Il(),backgroundColor:e===`operators`?ju():Au(),"&:hover":{backgroundColor:e===`operators`?Pu():Nu()},borderRadius:0,...t&&{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`}})),UW=R(ff)(({category:e})=>({textTransform:`none`,padding:0,margin:0,fontSize:`110% !important`,minWidth:`auto`,borderRadius:0,backgroundColor:e===`operators`?ju():Au(),"&:hover":{backgroundColor:e===`operators`?Pu():Nu()}})),WW=R(fR)(({category:e})=>({minWidth:`auto`,backgroundColor:e===`operators`?ju():Au(),"&:hover":{backgroundColor:e===`operators`?Pu():Nu()},borderRadius:0,"& .icon":{height:`30px`}})),GW=class extends P.Component{static propTypes={className:v.string,controlledKeypadMode:v.bool,baseSet:v.array,additionalKeys:v.array,layoutForKeyPad:v.object,onPress:v.func.isRequired,onFocus:v.func,noDecimal:v.bool,setKeypadInteraction:v.func,mode:v.oneOfType([v.string,v.number])};static defaultProps={baseSet:jH,noDecimal:!1};constructor(e){super(e),this.keypadRef=P.createRef()}componentDidMount(){let e=this.keypadRef?.current,t=e?.closest(`.main-container`),n=e?.closest(`.pie-toolbar`);if(this.props.controlledKeypadMode&&t&&n){let e=t.getBoundingClientRect(),r=n.getBoundingClientRect(),i=e.top+e.height-(r.top+r.height);if(i<0){let n=e.height+e.top-i;t&&(t.style.height=`${n}px`)}}e&&(e.addEventListener(`touchstart`,this.handleKeypadInteraction,!0),e.addEventListener(`mousedown`,this.handleKeypadInteraction,!0))}componentWillUnmount(){let e=this.keypadRef?.current;if(this.props.controlledKeypadMode&&e){let t=e.closest(`.main-container`);t&&(t.style.height=`unset`)}e&&(e.removeEventListener(`touchstart`,this.handleKeypadInteraction,!0),e.removeEventListener(`mousedown`,this.handleKeypadInteraction,!0))}handleKeypadInteraction=()=>{this.props.setKeypadInteraction&&this.props.setKeypadInteraction(!0)};buttonClick=e=>{RW(`[buttonClick]`,e);let{onPress:t}=this.props;t(e)};flowKeys=(e,t)=>Fp([...LW(e),...LW(t)]);keyIsNotAllowed=e=>{let{noDecimal:t}=this.props;return!!((e.write===`.`&&e.label===`.`||e.write===`,`&&e.label===`,`)&&t)};render(){let{className:e,baseSet:t,additionalKeys:n,layoutForKeyPad:r,onFocus:i,mode:a}=this.props,o=[`non-negative-integers`,`integers`,`decimals`,`fractions`,`item-authoring`,`language`].includes(a),s=o?this.flowKeys([],n||[]):this.flowKeys(t,n||[]),c=s.length%5?1:0,l={gridTemplateColumns:`repeat(${Math.floor(s.length/5)+c}, minmax(min-content, 150px))`,...BW(r)};return(0,F.jsx)(VW,{ref:this.keypadRef,className:[e,a].filter(Boolean).join(` `),style:l,onFocus:i,children:s.map((e,t)=>{let n=this.buttonClick.bind(this,e);if(!e)return(0,F.jsx)(`span`,{},`empty-${t}`);let r={onClick:n,disabled:this.keyIsNotAllowed(e),key:`${e.label||e.latex||e.command}-${t}`,...e.actions||{},...e.extraProps||{}};if(e.latex)return(0,F.jsx)(UW,{onClick:r.onClick,disabled:r.disabled,category:o?void 0:e.category,"aria-label":e.ariaLabel?e.ariaLabel:e.name||e.label,...e.actions||{},...e.extraProps||{},children:(0,F.jsx)(zW,{latex:e.latex})},r.key);if(e.label)return(0,F.jsx)(HW,{onClick:r.onClick,disabled:r.disabled,category:o?void 0:e.category,isDelete:e.label===`⌫`,isComma:e.label===`,`,isDot:e.label===`.`,"aria-label":e.ariaLabel?e.ariaLabel:e.name||e.label,...e.actions||{},...e.extraProps||{},children:e.label},r.key);{let t=e.icon?e.icon:`div`;return(0,F.jsx)(WW,{tabIndex:`-1`,onClick:r.onClick,disabled:r.disabled,category:o?void 0:e.category,size:`large`,...e.actions||{},...e.extraProps||{},children:(0,F.jsx)(t,{className:`icon`})},r.key)}})})}},KW=e=>{if(e.command)return{value:e.command,type:`command`};if(e.write)return{value:e.write};if(e.keystroke)return{type:`cursor`,value:e.keystroke}},qW=class extends P.Component{static propTypes={className:v.string,controlledKeypadMode:v.bool,mode:v.oneOfType([v.string,v.number]),layoutForKeyPad:v.object,onClick:v.func.isRequired,onFocus:v.func,noDecimal:v.bool,additionalKeys:v.array,setKeypadInteraction:v.func};static defaultProps={mode:`scientific`,noDecimal:!1,additionalKeys:[]};keypadPress=e=>{let{onClick:t}=this.props;t(KW(e))};render(){let{mode:e,onFocus:t,controlledKeypadMode:n,noDecimal:r,className:i,additionalKeys:a,layoutForKeyPad:o,setKeypadInteraction:s}=this.props,c=_H(a);return(0,F.jsx)(GW,{className:i,controlledKeypadMode:n,onFocus:t,noDecimal:r,layoutForKeyPad:o,additionalKeys:pB(hH(e),c),onPress:this.keypadPress,mode:e,setKeypadInteraction:s})}},JW=R(`span`)(()=>({display:`inline-flex`,border:`1px solid ${du()}`,margin:`1px 5px`,cursor:`pointer`,alignItems:`center`,justifyContent:`center`,minWidth:`50px`,minHeight:`36px`,height:`fit-content`})),YW=R(`div`)(()=>({background:au(),color:Il(),display:`inline-flex`,borderRight:`2px solid ${du()}`,boxSizing:`border-box`,overflow:`hidden`,fontSize:`12px`,minHeight:`36px`,height:`100%`,alignItems:`center`,fontFamily:`Symbola, Times New Roman, serif`,padding:`0 2px`})),XW=R(`div`)(()=>({flex:8,color:`var(--pie-text, black)`,padding:`4px !important`,display:`flex`,alignItems:`center`,justifyContent:`center`,backgroundColor:`var(--pie-background, rgba(255, 255, 255, 0))`,"& > .mq-math-mode sup.mq-nthroot":{fontSize:`70% !important`,verticalAlign:`1em !important`},"& > .mq-math-mode .mq-sqrt-stem":{borderTop:`0.07em solid`,marginLeft:`-1.5px`,marginTop:`-2px !important`,paddingTop:`5px !important`},"& .mq-overarrow-inner":{paddingTop:`0 !important`,border:`none !important`},"& .mq-overarrow.mq-arrow-both":{marginTop:`0px`,minWidth:`1.23em`,"& *":{lineHeight:`1 !important`},"&:before":{top:`-0.4em`,left:`-1px`},"&:after":{top:`0px !important`,position:`absolute !important`,right:`-2px`},"&.mq-empty:after":{top:`-0.45em`}},"& .mq-overarrow.mq-arrow-right":{"&:before":{top:`-0.4em`,right:`-1px`}},"& .mq-overarrow-inner-right":{display:`none !important`},"& .mq-overarrow-inner-left":{display:`none !important`}})),ZW=e=>{let{node:t,options:n,selected:r}=e,{attrs:i}=t,{value:a,index:o}=i,s=`R ${parseInt(o)+1}`;return(0,F.jsx)(Wk,{className:`math-templated`,"data-selected":r,style:{display:`inline-flex`,minHeight:`36px`,minWidth:`50px`,cursor:`pointer`},children:(0,F.jsxs)(JW,{...i,children:[(0,F.jsx)(YW,{children:s}),(0,F.jsx)(XW,{children:(0,F.jsx)(jW,{latex:a})})]})})};ZW.propTypes={attributes:v.object,value:v.string,keyToDisplay:v.string};var QW={},$W=e=>String(e||``).replace(/-/g,`_`),eG=e=>e&&e.attrs&&e.attrs.index!=null?String(e.attrs.index):null,tG=(e,t)=>{let n=[];return e.descendants((e,r)=>{if(e.type&&e.type.name===t){let t=eG(e);t!=null&&n.push({index:t,pos:r,node:e})}return!0}),n},nG=(e,t)=>{let n=0;return e.descendants(e=>(e.type&&e.type.name===t&&(n+=1),!0)),n},rG=({schema:e,typeName:t,index:n})=>{let r=e.nodes[t];return r?r.create({index:String(n),id:String(n),value:``}):null},iG=(e,t)=>{let n=e.resolve(Math.min(t,e.content.size));return Iv.near(n,1)},aG=tO.create({name:`responseArea`,addOptions(){return{maxResponseAreas:null,error:null,options:null,respAreaToolbar:null,onHandleAreaChange:null}},addProseMirrorPlugins(){if(!this.options.type)return[];let e=$W(this.options.type);return[new ey({key:new ry(`response-area-watcher:${e}`),view:t=>(QW[e]===void 0&&(QW[e]=0,t.state.doc.descendants(t=>{if(t.type&&t.type.name===e){let n=eG(t);if(n!=null){let t=parseInt(n,10);!Number.isNaN(t)&&t>QW[e]&&(QW[e]=t)}}return!0})),{update:(t,n)=>{let r=t.state;if(n.doc.eq(r.doc))return;let i=tG(r.doc,e),a=tG(n.doc,e);if(this.options.toolbar&&(this.options.toolbar.disabled=i.length>=this.options.maxResponseAreas),a.length>i.length){let e=new Set(i.map(e=>e.index)),t=a.filter(t=>!e.has(t.index));t.length&&typeof this.options.onHandleAreaChange==`function`&&this.options.onHandleAreaChange(t)}}})})]},addCommands(){return{insertResponseArea:e=>({tr:t,state:n,dispatch:r,commands:i})=>{let a=$W(e);if(nG(n.doc,a)>=this.options.maxResponseAreas)return!1;QW[a]===void 0&&(QW[a]=0);let o=QW[a]+1;QW[a]+=1;let s=rG({schema:n.schema,typeName:a,index:o});if(!s)return!1;let{selection:c}=n,l=c.from,u=e=>{try{return t.insert(e,s),e}catch{return null}},d=u(l);if(d??=u(t.doc.content.size),d==null)return!1;if([`inline_dropdown`,`explicit_constructed_response`].includes(a))t.setSelection(Rv.create(t.doc,d));else{let e=d+s.nodeSize;t.setSelection(iG(t.doc,e))}return r&&(i.focus(),r(t)),!0},refreshResponseArea:()=>({tr:e,state:t,commands:n,dispatch:r})=>{let{selection:i}=t,a=i.$from.nodeAfter,o=i.from;return e.setNodeMarkup(o,void 0,{...a?.attrs,updated:`${Date.now()}`}),e.setSelection(Rv.create(e.doc,o)),r&&(n.focus(),r(e)),!0}}}}),oG=wO.create({name:`explicit_constructed_response`,group:`inline`,inline:!0,atom:!0,addAttributes(){return{index:{default:null},value:{default:``},updated:{default:``}}},parseHTML(){return[{tag:`span[data-type="explicit_constructed_response"]`,getAttrs:e=>({index:e.dataset.index,value:e.dataset.value})}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-type":`explicit_constructed_response`,"data-index":e.index,"data-value":e.value}]},addNodeView(){return iA(e=>(0,F.jsx)(TR,{...e,options:this.options}))}}),sG=wO.create({name:`math_templated`,group:`inline`,inline:!0,atom:!0,addAttributes(){return{index:{default:null},value:{default:``},updated:{default:``}}},parseHTML(){return[{tag:`span[data-type="math_templated"]`,getAttrs:e=>({index:e.dataset.index,value:e.dataset.value})}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-type":`math_templated`,"data-index":e.index,"data-value":e.value}]},addNodeView(){return iA(e=>(0,F.jsx)(ZW,{...e,options:this.options}))}}),cG=wO.create({name:`drag_in_the_blank`,group:`inline`,inline:!0,atom:!0,addAttributes(){return{index:{default:null},id:{default:null},value:{default:``},inTable:{default:null},updated:{default:``}}},parseHTML(){return[{tag:`span[data-type="drag_in_the_blank"]`,getAttrs:e=>({index:e.dataset.index,id:e.dataset.id,value:e.dataset.value,inTable:e.dataset.inTable})}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-type":`drag_in_the_blank`,"data-index":e.index,"data-id":e.id,"data-value":e.value,"data-in-table":e.inTable}]},addNodeView(){return iA(e=>(0,F.jsx)(nB,{...e,options:this.options}))}}),lG=wO.create({name:`inline_dropdown`,group:`inline`,inline:!0,atom:!0,addAttributes(){return{index:{default:null},value:{default:``},updated:{default:``}}},parseHTML(){return[{tag:`span[data-type="inline_dropdown"]`,getAttrs:e=>({index:e.dataset.index,value:e.dataset.value})}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-type":`inline_dropdown`,"data-index":e.index,"data-value":e.value}]},addNodeView(){return iA(e=>(0,F.jsx)(rB,{...e,options:this.options}))}}),uG=Vr(`MuiDivider`,[`root`,`absolute`,`fullWidth`,`inset`,`middle`,`flexItem`,`light`,`vertical`,`withChildren`,`withChildrenVertical`,`textAlignRight`,`textAlignLeft`,`wrapper`,`wrapperVertical`]),dG=Vr(`MuiListItemIcon`,[`root`,`alignItemsFlexStart`]);function fG(e){return Br(`MuiTypography`,e)}Vr(`MuiTypography`,[`root`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`subtitle1`,`subtitle2`,`body1`,`body2`,`inherit`,`button`,`caption`,`overline`,`alignLeft`,`alignRight`,`alignCenter`,`alignJustify`,`noWrap`,`gutterBottom`,`paragraph`]);var pG={primary:!0,secondary:!0,error:!0,info:!0,success:!0,warning:!0,textPrimary:!0,textSecondary:!0,textDisabled:!0},mG=ss(),hG=e=>{let{align:t,gutterBottom:n,noWrap:r,paragraph:i,variant:a,classes:o}=e;return ca({root:[`root`,a,e.align!==`inherit`&&`align${B(t)}`,n&&`gutterBottom`,r&&`noWrap`,i&&`paragraph`]},fG,o)},gG=R(`span`,{name:`MuiTypography`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.variant&&t[n.variant],n.align!==`inherit`&&t[`align${B(n.align)}`],n.noWrap&&t.noWrap,n.gutterBottom&&t.gutterBottom,n.paragraph&&t.paragraph]}})(Nc(({theme:e})=>({margin:0,variants:[{props:{variant:`inherit`},style:{font:`inherit`,lineHeight:`inherit`,letterSpacing:`inherit`}},...Object.entries(e.typography).filter(([e,t])=>e!==`inherit`&&t&&typeof t==`object`).map(([e,t])=>({props:{variant:e},style:t})),...Object.entries(e.palette).filter(Vd()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main}})),...Object.entries(e.palette?.text||{}).filter(([,e])=>typeof e==`string`).map(([t])=>({props:{color:`text${B(t)}`},style:{color:(e.vars||e).palette.text[t]}})),{props:({ownerState:e})=>e.align!==`inherit`,style:{textAlign:`var(--Typography-textAlign)`}},{props:({ownerState:e})=>e.noWrap,style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`}},{props:({ownerState:e})=>e.gutterBottom,style:{marginBottom:`0.35em`}},{props:({ownerState:e})=>e.paragraph,style:{marginBottom:16}}]}))),_G={h1:`h1`,h2:`h2`,h3:`h3`,h4:`h4`,h5:`h5`,h6:`h6`,subtitle1:`h6`,subtitle2:`h6`,body1:`p`,body2:`p`,inherit:`p`},vG=P.forwardRef(function(e,t){let{color:n,...r}=cs({props:e,name:`MuiTypography`}),i=!pG[n],a=mG({...r,...i&&{color:n}}),{align:o=`inherit`,className:s,component:c,gutterBottom:l=!1,noWrap:u=!1,paragraph:d=!1,variant:f=`body1`,variantMapping:p=_G,...m}=a,h={...a,align:o,color:n,className:s,component:c,gutterBottom:l,noWrap:u,paragraph:d,variant:f,variantMapping:p},g=c||(d?`p`:p[f]||_G[f])||`span`,_=hG(h);return(0,F.jsx)(gG,{as:g,ref:t,className:I(_.root,s),...m,ownerState:h,style:{...o!==`inherit`&&{"--Typography-textAlign":o},...m.style}})}),yG=Vr(`MuiListItemText`,[`root`,`multiline`,`dense`,`inset`,`primary`,`secondary`]);function bG(e){return Br(`MuiMenuItem`,e)}var xG=Vr(`MuiMenuItem`,[`root`,`focusVisible`,`dense`,`disabled`,`divider`,`gutters`,`selected`]);function SG(e){return Br(`MuiNativeSelect`,e)}var CG=Vr(`MuiNativeSelect`,[`root`,`select`,`multiple`,`filled`,`outlined`,`standard`,`disabled`,`icon`,`iconOpen`,`iconFilled`,`iconOutlined`,`iconStandard`,`nativeInput`,`error`]),wG=e=>{let{classes:t,variant:n,disabled:r,multiple:i,open:a,error:o}=e;return ca({select:[`select`,n,r&&`disabled`,i&&`multiple`,o&&`error`],icon:[`icon`,`icon${B(n)}`,a&&`iconOpen`,r&&`disabled`]},SG,t)},TG=R(`select`,{name:`MuiNativeSelect`})(({theme:e})=>({MozAppearance:`none`,WebkitAppearance:`none`,userSelect:`none`,borderRadius:0,cursor:`pointer`,"&:focus":{borderRadius:0},[`&.${CG.disabled}`]:{cursor:`default`},"&[multiple]":{height:`auto`},"&:not([multiple]) option, &:not([multiple]) optgroup":{backgroundColor:(e.vars||e).palette.background.paper},variants:[{props:({ownerState:e})=>e.variant!==`filled`&&e.variant!==`outlined`,style:{"&&&":{paddingRight:24,minWidth:16}}},{props:{variant:`filled`},style:{"&&&":{paddingRight:32}}},{props:{variant:`outlined`},style:{borderRadius:(e.vars||e).shape.borderRadius,"&:focus":{borderRadius:(e.vars||e).shape.borderRadius},"&&&":{paddingRight:32}}}]})),EG=R(TG,{name:`MuiNativeSelect`,slot:`Select`,shouldForwardProp:Co,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.select,t[n.variant],n.error&&t.error,{[`&.${CG.multiple}`]:t.multiple}]}})({}),DG=R(`svg`,{name:`MuiNativeSelect`})(({theme:e})=>({position:`absolute`,right:0,top:`calc(50% - .5em)`,pointerEvents:`none`,color:(e.vars||e).palette.action.active,[`&.${CG.disabled}`]:{color:(e.vars||e).palette.action.disabled},variants:[{props:({ownerState:e})=>e.open,style:{transform:`rotate(180deg)`}},{props:{variant:`filled`},style:{right:7}},{props:{variant:`outlined`},style:{right:7}}]})),OG=R(DG,{name:`MuiNativeSelect`,slot:`Icon`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.icon,n.variant&&t[`icon${B(n.variant)}`],n.open&&t.iconOpen]}})({}),kG=P.forwardRef(function(e,t){let{className:n,disabled:r,error:i,IconComponent:a,inputRef:o,variant:s=`standard`,...c}=e,l={...e,disabled:r,variant:s,error:i},u=wG(l);return(0,F.jsxs)(P.Fragment,{children:[(0,F.jsx)(EG,{ownerState:l,className:I(u.select,n),disabled:r,ref:o||t,...c}),e.multiple?null:(0,F.jsx)(OG,{as:a,ownerState:l,className:u.icon})]})});function AG(e){return Br(`MuiSelect`,e)}var jG=Vr(`MuiSelect`,[`root`,`select`,`multiple`,`filled`,`outlined`,`standard`,`disabled`,`focused`,`icon`,`iconOpen`,`iconFilled`,`iconOutlined`,`iconStandard`,`nativeInput`,`error`]);function MG(e){return e?e.type===`mousedown`||e.type===`pointerdown`||e.type===`touchstart`?`pointer`:e.type===`keydown`||e.type===`click`&&e.detail===0?`keyboard`:null:null}function NG(e){return e==null||typeof e==`string`&&!e.trim()}function PG(e,t){return typeof t==`object`&&t?e===t:String(e)===String(t)}var FG=P.createContext(null);function IG(){return P.useContext(FG)}var LG=FG.Provider,RG,zG=R(TG,{name:`MuiSelect`,slot:`Select`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[{[`&.${jG.select}`]:t.select},{[`&.${jG.select}`]:t[n.variant]},{[`&.${jG.error}`]:t.error},{[`&.${jG.multiple}`]:t.multiple}]}})({[`&.${jG.select}`]:{height:`auto`,minHeight:`1.4375em`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,overflow:`hidden`}}),BG=R(DG,{name:`MuiSelect`,slot:`Icon`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.icon,n.variant&&t[`icon${B(n.variant)}`],n.open&&t.iconOpen]}})({}),VG=R(`input`,{shouldForwardProp:e=>So(e)&&e!==`classes`,name:`MuiSelect`,slot:`NativeInput`})({bottom:0,left:0,position:`absolute`,opacity:0,pointerEvents:`none`,width:`100%`,boxSizing:`border-box`}),HG=e=>{let{classes:t,variant:n,disabled:r,multiple:i,open:a,error:o}=e;return ca({select:[`select`,n,r&&`disabled`,i&&`multiple`,o&&`error`],icon:[`icon`,`icon${B(n)}`,a&&`iconOpen`,r&&`disabled`],nativeInput:[`nativeInput`]},AG,t)},UG=P.forwardRef(function(e,t){let{"aria-describedby":n,"aria-label":r,autoFocus:i,autoWidth:a,children:o,className:s,defaultOpen:c,defaultValue:l,disabled:u,displayEmpty:d,error:f=!1,IconComponent:p,inputRef:m,labelId:h,MenuProps:g={},multiple:_,name:v,onBlur:b,onChange:x,onClose:S,onFocus:C,onKeyDown:w,onMouseDown:T,onOpen:E,open:D,readOnly:O,renderValue:k,required:A,SelectDisplayProps:j={},tabIndex:M,type:ee,value:N,variant:te=`standard`,...ne}=e,[re,ie]=yl({controlled:N,default:l,name:`Select`}),[ae,oe]=yl({controlled:D,default:c,name:`Select`}),se=P.useRef(null),ce=P.useRef(null),[le,ue]=P.useState(null),{current:de}=P.useRef(D!=null),[fe,pe]=P.useState(),[me,he]=P.useState(null),ge=rc(t,m),_e=P.useCallback(e=>{ce.current=e,e&&ue(e)},[]),ve=le?.parentNode;P.useImperativeHandle(ge,()=>({focus:()=>{ce.current.focus()},node:se.current,value:re}),[re]);let ye=le!==null&&ae;P.useEffect(()=>{if(!ye||!ve||a||typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>{pe(ve.clientWidth)});return e.observe(ve),()=>{e.disconnect()}},[ye,ve,a]),P.useEffect(()=>{c&&ae&&le&&!de&&(pe(a?null:ve.clientWidth),ce.current.focus())},[le,a]),P.useEffect(()=>{i&&ce.current.focus()},[i]),P.useEffect(()=>{if(!h)return;let e=fs(ce.current).getElementById(h);if(e){let t=()=>{getSelection().isCollapsed&&ce.current.focus()};return e.addEventListener(`click`,t),()=>{e.removeEventListener(`click`,t)}}},[h]);let be=(e,t)=>{e?(he(MG(t)),E&&E(t)):(he(null),S&&S(t)),de||(pe(a?null:ve.clientWidth),oe(e))},xe=e=>{T?.(e),e.button===0&&(e.preventDefault(),ce.current.focus(),be(!0,e))},Se=e=>{be(!1,e)},Ce=P.Children.toArray(o),we=e=>{let t=Ce.find(t=>t.props.value===e.target.value);t!==void 0&&(ie(t.props.value),x&&x(e,t))},Te=e=>t=>{let n;if(t.currentTarget.hasAttribute(`tabindex`)){if(_){n=Array.isArray(re)?re.slice():[];let t=re.indexOf(e.props.value);t===-1?n.push(e.props.value):n.splice(t,1)}else n=e.props.value;if(e.props.onClick&&e.props.onClick(t),re!==n&&(ie(n),x)){let r=t.nativeEvent||t,i=new r.constructor(r.type,r);Object.defineProperty(i,"target",{writable:!0,value:{value:n,name:v}}),x(i,e)}_||be(!1,t)}},Ee=e=>{O||([` `,`ArrowUp`,`ArrowDown`,`Enter`].includes(e.key)&&(e.preventDefault(),be(!0,e)),w?.(e))},De=e=>{!ye&&b&&(Object.defineProperty(e,"target",{writable:!0,value:{value:re,name:v}}),b(e))};delete ne[`aria-invalid`];let Oe,ke,Ae=[],je=!1;(Bf({value:re})||d)&&(k?Oe=k(re):je=!0);let Me=Ce.map(e=>{if(!P.isValidElement(e))return null;let t;if(_){if(!Array.isArray(re))throw Error(y(2));t=re.some(t=>PG(t,e.props.value)),t&&je&&Ae.push(e.props.children)}else t=PG(re,e.props.value),t&&je&&(ke=e.props.children);return P.cloneElement(e,{"aria-selected":t?`true`:`false`,onClick:Te(e),onKeyUp:t=>{t.key===` `&&t.preventDefault(),e.props.onKeyUp&&e.props.onKeyUp(t)},role:`option`,selected:t,value:void 0,"data-value":e.props.value})});je&&(Oe=_?Ae.length===0?null:Ae.reduce((e,t,n)=>(e.push(t),n<Ae.length-1&&e.push(`, `),e),[]):ke);let Ne=fe;!a&&de&&le&&(Ne=ve.clientWidth);let Pe;Pe=M===void 0?u?null:0:M;let Fe=j.id||(v?`mui-component-select-${v}`:void 0),Ie={...e,variant:te,value:re,open:ye,error:f},Le=HG(Ie),Re={...g.PaperProps,...typeof g.slotProps?.paper==`function`?g.slotProps.paper(Ie):g.slotProps?.paper},ze={...g.MenuListProps,...typeof g.slotProps?.list==`function`?g.slotProps.list(Ie):g.slotProps?.list},Be=Fi();return(0,F.jsxs)(P.Fragment,{children:[(0,F.jsx)(zG,{as:`div`,ref:_e,tabIndex:Pe,role:`combobox`,"aria-controls":ye?Be:void 0,"aria-disabled":u?`true`:void 0,"aria-expanded":ye?`true`:`false`,"aria-haspopup":`listbox`,"aria-label":r,"aria-labelledby":[h,Fe].filter(Boolean).join(` `)||void 0,"aria-describedby":n,"aria-required":A?`true`:void 0,"aria-invalid":f?`true`:void 0,onKeyDown:Ee,onMouseDown:u||O?null:xe,onBlur:De,onFocus:C,...j,ownerState:Ie,className:I(j.className,Le.select,s),id:Fe,children:NG(Oe)?RG||=(0,F.jsx)(`span`,{className:`notranslate`,"aria-hidden":!0,children:``}):Oe}),(0,F.jsx)(VG,{"aria-invalid":f,value:Array.isArray(re)?re.join(`,`):re,name:v,ref:se,"aria-hidden":!0,onChange:we,tabIndex:-1,disabled:u,className:Le.nativeInput,autoFocus:i,required:A,...ne,ownerState:Ie}),(0,F.jsx)(BG,{as:p,className:Le.icon,ownerState:Ie}),(0,F.jsx)(LG,{value:me,children:(0,F.jsx)(Ep,{id:`menu-${v||``}`,anchorEl:ve,open:ye,onClose:Se,anchorOrigin:{vertical:`bottom`,horizontal:`center`},transformOrigin:{vertical:`top`,horizontal:`center`},...g,slotProps:{...g.slotProps,list:{"aria-labelledby":h,role:`listbox`,"aria-multiselectable":_?`true`:void 0,disableListWrap:!0,id:Be,...ze},paper:{...Re,style:{minWidth:Ne,...Re==null?null:Re.style}}},children:Me})})]})}),WG=ml((0,F.jsx)(`path`,{d:`M7 10l5 5 5-5z`}),`ArrowDropDown`);function GG(e){return parseInt(e,10)||0}var KG={shadow:{visibility:`hidden`,position:`absolute`,overflow:`hidden`,height:0,top:0,left:0,transform:`translateZ(0)`}};function qG(e){for(let t in e)return!1;return!0}function JG(e){return qG(e)||e.outerHeightStyle===0&&!e.overflowing}var YG=P.forwardRef(function(e,t){let{onChange:n,maxRows:r,minRows:i=1,style:a,value:o,...s}=e,{current:c}=P.useRef(o!=null),l=P.useRef(null),u=nc(t,l),d=P.useRef(null),f=P.useRef(null),p=P.useCallback(()=>{let t=l.current,n=f.current;if(!t||!n)return;let a=ps(t).getComputedStyle(t);if(a.width===`0px`)return{outerHeightStyle:0,overflowing:!1};n.style.width=a.width,n.value=t.value||e.placeholder||`x`,n.value.slice(-1)===`
|
|
304
|
-
`&&(n.value+=` `);let o=a.boxSizing,s=
|
|
305
|
-
`),a=t.selectionStart===r;i&&a&&t.setSelectionRange(r,r),n&&n(e)},ref:u,rows:i,style:a,...s}),(0,F.jsx)(`textarea`,{"aria-hidden":!0,className:e.className,readOnly:!0,ref:f,tabIndex:-1,style:{...KG.shadow,...a,paddingTop:0,paddingBottom:0}})]})});function XG(e){return Br(`MuiInputBase`,e)}var ZG=Vr(`MuiInputBase`,[`root`,`formControl`,`focused`,`disabled`,`adornedStart`,`adornedEnd`,`error`,`sizeSmall`,`multiline`,`colorSecondary`,`fullWidth`,`hiddenLabel`,`readOnly`,`input`,`inputSizeSmall`,`inputMultiline`,`inputTypeSearch`,`inputAdornedStart`,`inputAdornedEnd`,`inputHiddenLabel`]),QG,$G=`mui-auto-fill`,eK=`mui-auto-fill-cancel`,tK=(e,t)=>{let{ownerState:n}=e;return[t.root,n.formControl&&t.formControl,n.startAdornment&&t.adornedStart,n.endAdornment&&t.adornedEnd,n.error&&t.error,n.size===`small`&&t.sizeSmall,n.multiline&&t.multiline,n.color&&t[`color${B(n.color)}`],n.fullWidth&&t.fullWidth,n.hiddenLabel&&t.hiddenLabel]},nK=(e,t)=>{let{ownerState:n}=e;return[t.input,n.size===`small`&&t.inputSizeSmall,n.multiline&&t.inputMultiline,n.type===`search`&&t.inputTypeSearch,n.startAdornment&&t.inputAdornedStart,n.endAdornment&&t.inputAdornedEnd,n.hiddenLabel&&t.inputHiddenLabel]},rK=e=>{let{classes:t,color:n,disabled:r,error:i,endAdornment:a,focused:o,formControl:s,fullWidth:c,hiddenLabel:l,multiline:u,readOnly:d,size:f,startAdornment:p,type:m}=e;return ca({root:[`root`,`color${B(n)}`,r&&`disabled`,i&&`error`,c&&`fullWidth`,o&&`focused`,s&&`formControl`,f&&f!==`medium`&&`size${B(f)}`,u&&`multiline`,p&&`adornedStart`,a&&`adornedEnd`,l&&`hiddenLabel`,d&&`readOnly`],input:[`input`,r&&`disabled`,m===`search`&&`inputTypeSearch`,u&&`inputMultiline`,f===`small`&&`inputSizeSmall`,l&&`inputHiddenLabel`,p&&`inputAdornedStart`,a&&`inputAdornedEnd`,d&&`readOnly`]},XG,t)},iK=R(`div`,{name:`MuiInputBase`,slot:`Root`,overridesResolver:tK})(Nc(({theme:e})=>({...e.typography.body1,color:(e.vars||e).palette.text.primary,lineHeight:`1.4375em`,boxSizing:`border-box`,position:`relative`,cursor:`text`,display:`inline-flex`,alignItems:`center`,[`&.${ZG.disabled}`]:{color:(e.vars||e).palette.text.disabled,cursor:`default`},variants:[{props:({ownerState:e})=>e.multiline,style:{padding:`4px 0 5px`}},{props:({ownerState:e,size:t})=>e.multiline&&t===`small`,style:{paddingTop:1}},{props:({ownerState:e})=>e.fullWidth,style:{width:`100%`}}]}))),aK=R(`input`,{name:`MuiInputBase`,slot:`Input`,overridesResolver:nK})(Nc(({theme:e})=>{let t=e.palette.mode===`light`,n={color:`currentColor`,...e.vars?{opacity:e.vars.opacity.inputPlaceholder}:{opacity:t?.42:.5},transition:e.transitions.create(`opacity`,{duration:e.transitions.duration.shorter})},r={opacity:`0 !important`},i=e.vars?{opacity:e.vars.opacity.inputPlaceholder}:{opacity:t?.42:.5};return{font:`inherit`,letterSpacing:`inherit`,color:`currentColor`,padding:`4px 0 5px`,border:0,boxSizing:`content-box`,background:`none`,height:`1.4375em`,margin:0,WebkitTapHighlightColor:`transparent`,display:`block`,minWidth:0,width:`100%`,"&::-webkit-input-placeholder":n,"&::-moz-placeholder":n,"&::-ms-input-placeholder":n,"&:focus":{outline:0},"&:invalid":{boxShadow:`none`},"&::-webkit-search-decoration":{WebkitAppearance:`none`},[`label[data-shrink=false] + .${ZG.formControl} &`]:{"&::-webkit-input-placeholder":r,"&::-moz-placeholder":r,"&::-ms-input-placeholder":r,"&:focus::-webkit-input-placeholder":i,"&:focus::-moz-placeholder":i,"&:focus::-ms-input-placeholder":i},[`&.${ZG.disabled}`]:{opacity:1,WebkitTextFillColor:(e.vars||e).palette.text.disabled},variants:[{props:({ownerState:e})=>!e.disableInjectingGlobalStyles,style:{animationName:eK,animationDuration:`10ms`,"&:-webkit-autofill":{animationDuration:`5000s`,animationName:$G}}},{props:{size:`small`},style:{paddingTop:1}},{props:({ownerState:e})=>e.multiline,style:{height:`auto`,resize:`none`,padding:0,paddingTop:0}},{props:{type:`search`},style:{MozAppearance:`textfield`}}]}})),oK=as({[`@keyframes ${$G}`]:{from:{animationName:$G}},[`@keyframes ${eK}`]:{from:{animationName:eK}}}),sK=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiInputBase`}),{"aria-describedby":r,autoComplete:i,autoFocus:a,className:o,color:s,components:c={},componentsProps:l={},defaultValue:u,disabled:d,disableInjectingGlobalStyles:f,endAdornment:p,error:m,fullWidth:h=!1,id:g,inputComponent:_=`input`,inputProps:v={},inputRef:b,margin:x,maxRows:S,minRows:C,multiline:w=!1,name:T,onBlur:E,onChange:D,onClick:O,onFocus:k,onKeyDown:A,onKeyUp:j,placeholder:M,readOnly:ee,renderSuffix:N,rows:te,size:ne,slotProps:re={},slots:ie={},startAdornment:ae,type:oe=`text`,value:se,...ce}=n,le=v.value==null?se:v.value,{current:ue}=P.useRef(le!=null),de=P.useRef(),fe=P.useCallback(e=>{},[]),pe=rc(de,b,v.ref,fe),[me,he]=P.useState(!1),ge=Of(),_e=Ef({props:n,muiFormControl:ge,states:[`color`,`disabled`,`error`,`hiddenLabel`,`size`,`required`,`filled`]});_e.focused=ge?ge.focused:me,P.useEffect(()=>{!ge&&d&&me&&(he(!1),E&&E())},[ge,d,me,E]);let ve=ge&&ge.onFilled,ye=ge&&ge.onEmpty,be=P.useCallback(e=>{Bf(e)?ve&&ve():ye&&ye()},[ve,ye]);gl(()=>{ue&&be({value:le})},[le,be,ue]),gl(()=>{if(!a)return;let e=de.current;if(!e)return;let t=fs(e),n=xc(t),r=n==null||n===t.body||n===t.documentElement;e===n?ge&&ge.onFocus?ge.onFocus():he(!0):r&&e.focus()},[a]);let xe=e=>{k&&k(e),v.onFocus&&v.onFocus(e),ge&&ge.onFocus?ge.onFocus(e):he(!0)},Se=e=>{E&&E(e),v.onBlur&&v.onBlur(e),ge&&ge.onBlur?ge.onBlur(e):he(!1)},Ce=(e,...t)=>{if(!ue){let t=e.target||de.current;if(t==null)throw Error(y(1));be({value:t.value})}v.onChange&&v.onChange(e,...t),D&&D(e,...t)};P.useEffect(()=>{be(de.current)},[]);let we=e=>{de.current&&e.currentTarget===e.target&&de.current.focus(),O&&O(e)},Te=_,Ee=v;w&&Te===`input`&&(Ee=te?{type:void 0,minRows:te,maxRows:te,...Ee}:{type:void 0,maxRows:S,minRows:C,...Ee},Te=YG);let De=e=>{be(e.animationName===eK?de.current:{value:`x`})};P.useEffect(()=>{ge&&ge.setAdornedStart(!!ae)},[ge,ae]);let Oe={...n,color:_e.color||`primary`,disabled:_e.disabled,endAdornment:p,error:_e.error,focused:_e.focused,formControl:ge,fullWidth:h,hiddenLabel:_e.hiddenLabel,multiline:w,size:_e.size,startAdornment:ae,type:oe},ke=rK(Oe),Ae=ie.root||c.Root||iK,je=re.root||l.root||{},Me=ie.input||c.Input||aK;return Ee={...Ee,...re.input??l.input},(0,F.jsxs)(P.Fragment,{children:[!f&&typeof oK==`function`&&(QG||=(0,F.jsx)(oK,{})),(0,F.jsxs)(Ae,{...je,ref:t,onClick:we,...ce,...!rs(Ae)&&{ownerState:{...Oe,...je.ownerState}},className:I(ke.root,je.className,o,ee&&`MuiInputBase-readOnly`),children:[ae,(0,F.jsx)(Df.Provider,{value:null,children:(0,F.jsx)(Me,{"aria-invalid":_e.error,"aria-describedby":r,autoComplete:i,autoFocus:a,defaultValue:u,disabled:_e.disabled,id:g,onAnimationStart:De,name:T,placeholder:M,readOnly:ee,required:_e.required,rows:te,value:le,onKeyDown:A,onKeyUp:j,type:oe,...Ee,...!rs(Me)&&{as:Te,ownerState:{...Oe,...Ee.ownerState}},ref:pe,className:I(ke.input,Ee.className,ee&&`MuiInputBase-readOnly`),onBlur:Se,onChange:Ce,onFocus:xe})}),p,N?N({..._e,startAdornment:ae}):null]})]})});function cK(e){return Br(`MuiInput`,e)}var lK={...ZG,...Vr(`MuiInput`,[`root`,`underline`,`input`])},uK=e=>{let{classes:t,disableUnderline:n}=e,r=ca({root:[`root`,!n&&`underline`],input:[`input`]},cK,t);return{...t,...r}},dK=R(iK,{shouldForwardProp:e=>Co(e)||e===`classes`,name:`MuiInput`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[...tK(e,t),!n.disableUnderline&&t.underline]}})(Nc(({theme:e})=>{let t=e.palette.mode===`light`?`rgba(0, 0, 0, 0.42)`:`rgba(255, 255, 255, 0.7)`;return e.vars&&(t=e.alpha(e.vars.palette.common.onBackground,e.vars.opacity.inputUnderline)),{position:`relative`,variants:[{props:({ownerState:e})=>e.formControl,style:{"label + &":{marginTop:16}}},{props:({ownerState:e})=>!e.disableUnderline,style:{"&::after":{left:0,bottom:0,content:`""`,position:`absolute`,right:0,transform:`scaleX(0)`,transition:e.transitions.create(`transform`,{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),pointerEvents:`none`},[`&.${lK.focused}:after`]:{transform:`scaleX(1) translateX(0)`},[`&.${lK.error}`]:{"&::before, &::after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:`1px solid ${t}`,left:0,bottom:0,content:`""`,position:`absolute`,right:0,transition:e.transitions.create(`border-bottom-color`,{duration:e.transitions.duration.shorter}),pointerEvents:`none`},[`&:hover:not(.${lK.disabled}, .${lK.error}):before`]:{borderBottom:`2px solid ${(e.vars||e).palette.text.primary}`,"@media (hover: none)":{borderBottom:`1px solid ${t}`}},[`&.${lK.disabled}:before`]:{borderBottomStyle:`dotted`}}},...Object.entries(e.palette).filter(Vd()).map(([t])=>({props:{color:t,disableUnderline:!1},style:{"&::after":{borderBottom:`2px solid ${(e.vars||e).palette[t].main}`}}}))]}})),fK=R(aK,{name:`MuiInput`,slot:`Input`,overridesResolver:nK})({}),pK=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiInput`}),{disableUnderline:r=!1,components:i={},componentsProps:a,fullWidth:o=!1,inputComponent:s=`input`,multiline:c=!1,slotProps:l,slots:u={},type:d=`text`,...f}=n,p=uK(n),m={root:{ownerState:{disableUnderline:r}}},h=l??a?dn(l??a,m):m;return(0,F.jsx)(sK,{slots:{root:u.root??i.Root??dK,input:u.input??i.Input??fK},slotProps:h,fullWidth:o,inputComponent:s,multiline:c,ref:t,type:d,...f,classes:p})});pK.muiName=`Input`;function mK(e){return Br(`MuiFilledInput`,e)}var hK={...ZG,...Vr(`MuiFilledInput`,[`root`,`underline`,`input`,`adornedStart`,`adornedEnd`,`sizeSmall`,`multiline`,`hiddenLabel`])},gK=e=>{let{classes:t,disableUnderline:n,startAdornment:r,endAdornment:i,size:a,hiddenLabel:o,multiline:s}=e,c=ca({root:[`root`,!n&&`underline`,r&&`adornedStart`,i&&`adornedEnd`,a===`small`&&`size${B(a)}`,o&&`hiddenLabel`,s&&`multiline`],input:[`input`]},mK,t);return{...t,...c}},_K=R(iK,{shouldForwardProp:e=>Co(e)||e===`classes`,name:`MuiFilledInput`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[...tK(e,t),!n.disableUnderline&&t.underline]}})(Nc(({theme:e})=>{let t=e.palette.mode===`light`,n=t?`rgba(0, 0, 0, 0.42)`:`rgba(255, 255, 255, 0.7)`,r=t?`rgba(0, 0, 0, 0.06)`:`rgba(255, 255, 255, 0.09)`,i=t?`rgba(0, 0, 0, 0.09)`:`rgba(255, 255, 255, 0.13)`,a=t?`rgba(0, 0, 0, 0.12)`:`rgba(255, 255, 255, 0.12)`;return{position:`relative`,backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r,borderTopLeftRadius:(e.vars||e).shape.borderRadius,borderTopRightRadius:(e.vars||e).shape.borderRadius,transition:e.transitions.create(`background-color`,{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),"&:hover":{backgroundColor:e.vars?e.vars.palette.FilledInput.hoverBg:i,"@media (hover: none)":{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r}},[`&.${hK.focused}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r},[`&.${hK.disabled}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.disabledBg:a},variants:[{props:({ownerState:e})=>!e.disableUnderline,style:{"&::after":{left:0,bottom:0,content:`""`,position:`absolute`,right:0,transform:`scaleX(0)`,transition:e.transitions.create(`transform`,{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),pointerEvents:`none`},[`&.${hK.focused}:after`]:{transform:`scaleX(1) translateX(0)`},[`&.${hK.error}`]:{"&::before, &::after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:`1px solid ${e.vars?e.alpha(e.vars.palette.common.onBackground,e.vars.opacity.inputUnderline):n}`,left:0,bottom:0,content:`""`,position:`absolute`,right:0,transition:e.transitions.create(`border-bottom-color`,{duration:e.transitions.duration.shorter}),pointerEvents:`none`},[`&:hover:not(.${hK.disabled}, .${hK.error}):before`]:{borderBottom:`1px solid ${(e.vars||e).palette.text.primary}`},[`&.${hK.disabled}:before`]:{borderBottomStyle:`dotted`}}},...Object.entries(e.palette).filter(Vd()).map(([t])=>({props:{disableUnderline:!1,color:t},style:{"&::after":{borderBottom:`2px solid ${(e.vars||e).palette[t]?.main}`}}})),{props:({ownerState:e})=>e.startAdornment,style:{paddingLeft:12}},{props:({ownerState:e})=>e.endAdornment,style:{paddingRight:12}},{props:({ownerState:e})=>e.multiline,style:{padding:`25px 12px 8px`}},{props:({ownerState:e,size:t})=>e.multiline&&t===`small`,style:{paddingTop:21,paddingBottom:4}},{props:({ownerState:e})=>e.multiline&&e.hiddenLabel,style:{paddingTop:16,paddingBottom:17}},{props:({ownerState:e})=>e.multiline&&e.hiddenLabel&&e.size===`small`,style:{paddingTop:8,paddingBottom:9}}]}})),vK=R(aK,{name:`MuiFilledInput`,slot:`Input`,overridesResolver:nK})(Nc(({theme:e})=>({paddingTop:25,paddingRight:12,paddingBottom:8,paddingLeft:12,...!e.vars&&{"&:-webkit-autofill":{WebkitBoxShadow:e.palette.mode===`light`?null:`0 0 0 100px #266798 inset`,WebkitTextFillColor:e.palette.mode===`light`?null:`#fff`,caretColor:e.palette.mode===`light`?null:`#fff`,borderTopLeftRadius:`inherit`,borderTopRightRadius:`inherit`}},...e.vars&&{"&:-webkit-autofill":{borderTopLeftRadius:`inherit`,borderTopRightRadius:`inherit`},[e.getColorSchemeSelector(`dark`)]:{"&:-webkit-autofill":{WebkitBoxShadow:`0 0 0 100px #266798 inset`,WebkitTextFillColor:`#fff`,caretColor:`#fff`}}},variants:[{props:{size:`small`},style:{paddingTop:21,paddingBottom:4}},{props:({ownerState:e})=>e.hiddenLabel,style:{paddingTop:16,paddingBottom:17}},{props:({ownerState:e})=>e.startAdornment,style:{paddingLeft:0}},{props:({ownerState:e})=>e.endAdornment,style:{paddingRight:0}},{props:({ownerState:e})=>e.hiddenLabel&&e.size===`small`,style:{paddingTop:8,paddingBottom:9}},{props:({ownerState:e})=>e.multiline,style:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0}}]}))),yK=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiFilledInput`}),{disableUnderline:r=!1,components:i={},componentsProps:a,fullWidth:o=!1,hiddenLabel:s,inputComponent:c=`input`,multiline:l=!1,slotProps:u,slots:d={},type:f=`text`,...p}=n,m={...n,disableUnderline:r,fullWidth:o,inputComponent:c,multiline:l,type:f},h=gK(n),g={root:{ownerState:m},input:{ownerState:m}},_=u??a?dn(g,u??a):g;return(0,F.jsx)(sK,{slots:{root:d.root??i.Root??_K,input:d.input??i.Input??vK},slotProps:_,fullWidth:o,inputComponent:c,multiline:l,ref:t,type:f,...p,classes:h})});yK.muiName=`Input`;var bK,xK=R(`fieldset`,{name:`MuiNotchedOutlined`,shouldForwardProp:Co})({textAlign:`left`,position:`absolute`,bottom:0,right:0,top:-5,left:0,margin:0,padding:`0 8px`,pointerEvents:`none`,borderRadius:`inherit`,borderStyle:`solid`,borderWidth:1,overflow:`hidden`,minWidth:`0%`}),SK=R(`legend`,{name:`MuiNotchedOutlined`,shouldForwardProp:Co})(Nc(({theme:e})=>({float:`unset`,width:`auto`,overflow:`hidden`,variants:[{props:({ownerState:e})=>!e.withLabel,style:{padding:0,lineHeight:`11px`,transition:e.transitions.create(`width`,{duration:150,easing:e.transitions.easing.easeOut})}},{props:({ownerState:e})=>e.withLabel,style:{display:`block`,padding:0,height:11,fontSize:`0.75em`,visibility:`hidden`,maxWidth:.01,transition:e.transitions.create(`max-width`,{duration:50,easing:e.transitions.easing.easeOut}),whiteSpace:`nowrap`,"& > span":{paddingLeft:5,paddingRight:5,display:`inline-block`,opacity:0,visibility:`visible`}}},{props:({ownerState:e})=>e.withLabel&&e.notched,style:{maxWidth:`100%`,transition:e.transitions.create(`max-width`,{duration:100,easing:e.transitions.easing.easeOut,delay:50})}}]})));function CK(e){let{children:t,classes:n,className:r,label:i,notched:a,...o}=e,s=i!=null&&i!==``,c={...e,notched:a,withLabel:s};return(0,F.jsx)(xK,{"aria-hidden":!0,className:r,ownerState:c,...o,children:(0,F.jsx)(SK,{ownerState:c,children:s?(0,F.jsx)(`span`,{children:i}):bK||=(0,F.jsx)(`span`,{className:`notranslate`,"aria-hidden":!0,children:``})})})}function wK(e){return Br(`MuiOutlinedInput`,e)}var TK={...ZG,...Vr(`MuiOutlinedInput`,[`root`,`notchedOutline`,`input`])},EK=e=>{let{classes:t}=e,n=ca({root:[`root`],notchedOutline:[`notchedOutline`],input:[`input`]},wK,t);return{...t,...n}},DK=R(iK,{shouldForwardProp:e=>Co(e)||e===`classes`,name:`MuiOutlinedInput`,slot:`Root`,overridesResolver:tK})(Nc(({theme:e})=>{let t=e.palette.mode===`light`?`rgba(0, 0, 0, 0.23)`:`rgba(255, 255, 255, 0.23)`;return{position:`relative`,borderRadius:(e.vars||e).shape.borderRadius,[`&:hover .${TK.notchedOutline}`]:{borderColor:(e.vars||e).palette.text.primary},"@media (hover: none)":{[`&:hover .${TK.notchedOutline}`]:{borderColor:e.vars?e.alpha(e.vars.palette.common.onBackground,.23):t}},[`&.${TK.focused} .${TK.notchedOutline}`]:{borderWidth:2},variants:[...Object.entries(e.palette).filter(Vd()).map(([t])=>({props:{color:t},style:{[`&.${TK.focused} .${TK.notchedOutline}`]:{borderColor:(e.vars||e).palette[t].main}}})),{props:{},style:{[`&.${TK.error} .${TK.notchedOutline}`]:{borderColor:(e.vars||e).palette.error.main},[`&.${TK.disabled} .${TK.notchedOutline}`]:{borderColor:(e.vars||e).palette.action.disabled}}},{props:({ownerState:e})=>e.startAdornment,style:{paddingLeft:14}},{props:({ownerState:e})=>e.endAdornment,style:{paddingRight:14}},{props:({ownerState:e})=>e.multiline,style:{padding:`16.5px 14px`}},{props:({ownerState:e,size:t})=>e.multiline&&t===`small`,style:{padding:`8.5px 14px`}}]}})),OK=R(CK,{name:`MuiOutlinedInput`,slot:`NotchedOutline`})(Nc(({theme:e})=>{let t=e.palette.mode===`light`?`rgba(0, 0, 0, 0.23)`:`rgba(255, 255, 255, 0.23)`;return{borderColor:e.vars?e.alpha(e.vars.palette.common.onBackground,.23):t}})),kK=R(aK,{name:`MuiOutlinedInput`,slot:`Input`,overridesResolver:nK})(Nc(({theme:e})=>({padding:`16.5px 14px`,...!e.vars&&{"&:-webkit-autofill":{WebkitBoxShadow:e.palette.mode===`light`?null:`0 0 0 100px #266798 inset`,WebkitTextFillColor:e.palette.mode===`light`?null:`#fff`,caretColor:e.palette.mode===`light`?null:`#fff`,borderRadius:`inherit`}},...e.vars&&{"&:-webkit-autofill":{borderRadius:`inherit`},[e.getColorSchemeSelector(`dark`)]:{"&:-webkit-autofill":{WebkitBoxShadow:`0 0 0 100px #266798 inset`,WebkitTextFillColor:`#fff`,caretColor:`#fff`}}},variants:[{props:{size:`small`},style:{padding:`8.5px 14px`}},{props:({ownerState:e})=>e.multiline,style:{padding:0}},{props:({ownerState:e})=>e.startAdornment,style:{paddingLeft:0}},{props:({ownerState:e})=>e.endAdornment,style:{paddingRight:0}}]}))),AK=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiOutlinedInput`}),{components:r={},fullWidth:i=!1,inputComponent:a=`input`,label:o,multiline:s=!1,notched:c,slots:l={},slotProps:u={},type:d=`text`,...f}=n,p=EK(n),m=Of(),h=Ef({props:n,muiFormControl:m,states:[`color`,`disabled`,`error`,`focused`,`hiddenLabel`,`size`,`required`]}),g={...n,color:h.color||`primary`,disabled:h.disabled,error:h.error,focused:h.focused,formControl:m,fullWidth:i,hiddenLabel:h.hiddenLabel,multiline:s,size:h.size,type:d},_=l.root??r.Root??DK,v=l.input??r.Input??kK,[y,b]=zc(`notchedOutline`,{elementType:OK,className:p.notchedOutline,shouldForwardComponentProp:!0,ownerState:g,externalForwardedProps:{slots:l,slotProps:u},additionalProps:{label:o!=null&&o!==``&&h.required?(0,F.jsxs)(P.Fragment,{children:[o,` `,`*`]}):o}});return(0,F.jsx)(sK,{slots:{root:_,input:v},slotProps:u,renderSuffix:e=>(0,F.jsx)(y,{...b,notched:c===void 0?!!(e.startAdornment||e.filled||e.focused):c}),fullWidth:i,inputComponent:a,multiline:s,ref:t,type:d,...f,classes:{...p,notchedOutline:null}})});AK.muiName=`Input`;var jK=e=>{let{classes:t}=e,n=ca({root:[`root`]},AG,t);return{...t,...n}},MK={name:`MuiSelect`,slot:`Root`,shouldForwardProp:e=>Co(e)&&e!==`variant`},NK=R(pK,MK)(``),PK=R(AK,MK)(``),FK=R(yK,MK)(``),IK=P.forwardRef(function(e,t){let n=cs({name:`MuiSelect`,props:e}),{autoWidth:r=!1,children:i,classes:a={},className:o,defaultOpen:s=!1,displayEmpty:c=!1,IconComponent:l=WG,id:u,input:d,inputProps:f,label:p,labelId:m,MenuProps:h,multiple:g=!1,native:_=!1,onClose:v,onOpen:y,open:b,renderValue:x,SelectDisplayProps:S,variant:C=`outlined`,...w}=n,T=_?kG:UG,E=Ef({props:n,muiFormControl:Of(),states:[`variant`,`error`]}),D=E.variant||C,O={...n,variant:D,classes:a},k=jK(O),{root:A,...j}=k,M=d||{standard:(0,F.jsx)(NK,{ownerState:O}),outlined:(0,F.jsx)(PK,{label:p,ownerState:O}),filled:(0,F.jsx)(FK,{ownerState:O})}[D],ee=rc(t,xs(M));return(0,F.jsx)(P.Fragment,{children:P.cloneElement(M,{inputComponent:T,inputProps:{children:i,error:E.error,IconComponent:l,variant:D,type:void 0,multiple:g,..._?{id:u}:{autoWidth:r,defaultOpen:s,displayEmpty:c,labelId:m,MenuProps:h,onClose:v,onOpen:y,open:b,renderValue:x,SelectDisplayProps:{id:u,...S}},...f,classes:f?dn(j,f.classes):j,...d?d.props.inputProps:{}},...(g&&_||c)&&D===`outlined`?{notched:!0}:{},ref:ee,className:I(M.props.className,o,k.root),...!d&&{variant:D},...w})})});IK.muiName=`Select`;function LK(e,t){if(t==null){e.focus();return}try{e.focus({focusVisible:t===`keyboard`})}catch{e.focus()}}var RK=(e,t)=>{let{ownerState:n}=e;return[t.root,n.dense&&t.dense,n.divider&&t.divider,!n.disableGutters&&t.gutters]},zK=e=>{let{disabled:t,dense:n,divider:r,disableGutters:i,selected:a,classes:o}=e,s=ca({root:[`root`,n&&`dense`,t&&`disabled`,!i&&`gutters`,r&&`divider`,a&&`selected`]},bG,o);return{...o,...s}},BK=R(Ld,{shouldForwardProp:e=>Co(e)||e===`classes`,name:`MuiMenuItem`,slot:`Root`,overridesResolver:RK})(Nc(({theme:e})=>({...e.typography.body1,display:`flex`,justifyContent:`flex-start`,alignItems:`center`,position:`relative`,textDecoration:`none`,minHeight:48,paddingTop:6,paddingBottom:6,boxSizing:`border-box`,whiteSpace:`nowrap`,"&:hover":{textDecoration:`none`,backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:`transparent`}},[`&.${xG.selected}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity),[`&.${xG.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}},[`&.${xG.selected}:hover`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity)}},[`&.${xG.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${xG.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},[`& + .${uG.root}`]:{marginTop:e.spacing(1),marginBottom:e.spacing(1)},[`& + .${uG.inset}`]:{marginLeft:52},[`& .${yG.root}`]:{marginTop:0,marginBottom:0},[`& .${yG.inset}`]:{paddingLeft:36},[`& .${dG.root}`]:{minWidth:36},variants:[{props:({ownerState:e})=>!e.disableGutters,style:{paddingLeft:16,paddingRight:16}},{props:({ownerState:e})=>e.divider,style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`,backgroundClip:`padding-box`}},{props:({ownerState:e})=>!e.dense,style:{[e.breakpoints.up(`sm`)]:{minHeight:`auto`}}},{props:({ownerState:e})=>e.dense,style:{minHeight:32,paddingTop:4,paddingBottom:4,...e.typography.body2,[`& .${dG.root} svg`]:{fontSize:`1.25rem`}}}]}))),VK=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiMenuItem`}),{autoFocus:r=!1,component:i=`li`,dense:a=!1,divider:o=!1,disableGutters:s=!1,focusVisibleClassName:c,role:l=`menuitem`,tabIndex:u,className:d,...f}=n,p=IG(),m=P.useContext(up),h=P.useMemo(()=>({dense:a||m.dense||!1,disableGutters:s}),[m.dense,a,s]),g=P.useRef(null);gl(()=>{r&&g.current&&LK(g.current,p)},[r]);let _={...n,dense:h.dense,divider:o,disableGutters:s},v=zK(n),y=rc(g,t),{root:b,...x}=v,S;return n.disabled||(S=u===void 0?-1:u),(0,F.jsx)(up.Provider,{value:h,children:(0,F.jsx)(BK,{ref:y,role:l,tabIndex:S,component:i,focusVisibleClassName:I(v.focusVisible,c),className:I(v.root,d),...f,ownerState:_,classes:x})})}),HK=()=>{document.querySelectorAll(`.mq-supsub.mq-sup-only`).forEach(e=>{let t=e.previousElementSibling;t&&t.classList.contains(`mq-non-leaf`)&&t.querySelector(`.mq-fraction`)?e.classList.add(`mq-after-fraction-group`):e.classList.remove(`mq-after-fraction-group`)})},{commonMqFontStyles:UK,commonMqKeyboardStyles:WK,longdivStyles:GK,supsubStyles:KK}=IW,qK=Uu(`@pie-lib:math-toolbar:editor-and-pad`),JK=/\.|,/g,YK=R(`div`)(({theme:e})=>({zIndex:9,position:`relative`,textAlign:`center`,width:`auto`,"& > .mq-math-mode":{border:`solid 1px lightgrey`},"& > .mq-focused":{outline:`none`,boxShadow:`none`,border:`dotted 1px ${e.palette.primary.main}`,borderRadius:`0px`},"& .mq-overarrow-inner":{border:`none !important`,paddingTop:`0 !important`},"& .mq-overarrow-inner-right":{display:`none !important`},"& .mq-overarrow-inner-left":{display:`none !important`},"& .mq-longdiv-inner":{borderTop:`1px solid !important`,paddingTop:`1.5px !important`},"& .mq-overarrow.mq-arrow-both":{top:`7.8px`,marginTop:`0px`,minWidth:`1.23em`},"& .mq-parallelogram":{lineHeight:.85}})),XK=R(`div`)(({theme:e,hide:t})=>({display:t?`none`:`flex`,alignItems:`center`,"& .mq-editable-field .mq-cursor":{top:`-4px`},"& .mq-math-mode .mq-selection, .mq-editable-field .mq-selection":{paddingTop:`18px`},"& .mq-math-mode .mq-overarrow":{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`},"& .mq-math-mode .mq-overline .mq-overline-inner":{paddingTop:`0.4em !important`},"& .mq-overarrow.mq-arrow-both":{minWidth:`1.23em`,"& *":{lineHeight:`1 !important`},"&:before":{top:`-0.45em`,left:`-1px`},"&:after":{position:`absolute !important`,top:`0px !important`,right:`-2px`},"&.mq-empty:after":{top:`-0.45em`}},"& .mq-overarrow.mq-arrow-right":{"&:before":{top:`-0.4em`,right:`-1px`}},"& *":{...UK,...KK,...GK,"& .mq-math-mode .mq-sqrt-prefix":{verticalAlign:`baseline !important`,top:`1px !important`,left:`-0.1em !important`},"& .mq-math-mode .mq-overarc ":{paddingTop:`0.45em !important`},"& .mq-math-mode .mq-empty":{padding:`9px 1px !important`},"& .mq-math-mode .mq-root-block":{paddingTop:`10px`},"& .mq-scaled .mq-sqrt-prefix":{top:`0 !important`},"& .mq-math-mode .mq-longdiv .mq-longdiv-inner":{marginLeft:`4px !important`,paddingTop:`6px !important`,paddingLeft:`6px !important`},"& .mq-math-mode .mq-paren":{verticalAlign:`top !important`,padding:`1px 0.1em !important`},"& .mq-math-mode .mq-sqrt-stem":{borderTop:`0.07em solid`,marginLeft:`-1.5px`,marginTop:`-2px !important`,paddingTop:`5px !important`},"& .mq-math-mode .mq-denominator":{marginTop:`-5px !important`,padding:`0.5em 0.1em 0.1em !important`},"& .mq-math-mode .mq-numerator, .mq-math-mode .mq-over":{padding:`0 0.1em !important`,paddingBottom:`0 !important`,marginBottom:`-2px`}},'& span[data-prime="true"]':{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`}})),ZK=R(Gf)({flex:`initial`,width:`25%`,minWidth:`100px`,marginLeft:`15px`,marginTop:`5px`,marginBottom:`5px`,marginRight:`5px`,"& label":{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`},"& div":{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`}}),QK=R(Rf)(()=>({backgroundColor:`transparent`})),$K=R(`div`)(({theme:e,error:t})=>({minWidth:`500px`,maxWidth:`900px`,minHeight:`30px`,width:`100%`,display:`flex`,marginTop:e.spacing(1),marginBottom:e.spacing(1),...t&&{border:`2px solid red`},"& .mq-sqrt-prefix .mq-scaled":{verticalAlign:`middle !important`}})),eq=R(TW)(({controlledKeypadMode:e})=>({maxWidth:e?`400px`:`500px`,color:Il(),backgroundColor:iu(),padding:`2px`})),tq=R(ff)({position:`absolute`,right:`12px`,border:`1px solid lightgrey`,color:Il()}),nq=R(`hr`)(({theme:e})=>({padding:0,margin:0,height:`1px`,border:`none`,borderBottom:`solid 1px ${e.palette.primary.main}`})),rq=R(qW)(({mode:e})=>({...WK,...e===`language`&&{"& *":{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`}}})),iq=e=>{if(!e)return;let{type:t,value:n}=e;return t===`command`||t===`cursor`?e:t===`answer`?{type:`answer`,...e}:n===`clear`?{type:`clear`}:{type:`write`,value:n}},aq=class extends P.Component{static propTypes={classNames:v.object,keypadMode:v.oneOfType([v.string,v.number]),autoFocus:v.bool,allowAnswerBlock:v.bool,showKeypad:v.bool,controlledKeypad:v.bool,controlledKeypadMode:v.bool,error:v.string,noDecimal:v.bool,hideInput:v.bool,noLatexHandling:v.bool,layoutForKeyPad:v.object,maxResponseAreas:v.number,additionalKeys:v.array,latex:v.string.isRequired,onAnswerBlockAdd:v.func,onFocus:v.func,onBlur:v.func,onChange:v.func.isRequired,setKeypadInteraction:v.func};constructor(e){super(e),this.state={equationEditor:`item-authoring`,addDisabled:!1}}componentDidMount(){this.input&&this.props.autoFocus&&setTimeout(()=>this.input.focus(),0)}onClick=e=>{let{noDecimal:t,noLatexHandling:n,onChange:r}=this.props,i=iq(e);if(qK(`mathChange: `,i),n){r(i.value);return}t&&(i.value===`.`||i.value===`,`)||i&&(i.type===`clear`?(qK(`call clear...`),this.input.clear()):i.type===`command`?this.input.command(i.value):i.type===`cursor`?this.input.keystroke(i.value):i.type===`answer`?this.input.write(`%response%`):this.input.write(i.value))};updateDisable=e=>{let{maxResponseAreas:t}=this.props;if(t){let n=this.checkResponseAreasNumber(t,e);this.setState({addDisabled:n})}};onAnswerBlockClick=()=>{this.props.onAnswerBlockAdd(),this.onClick({type:`answer`}),this.updateDisable(!0)};onEditorChange=e=>{let{onChange:t,noDecimal:n}=this.props;if(vH(),HK(),this.updateDisable(!0),n&&(e.indexOf(`.`)!==-1||e.indexOf(`,`)!==-1)&&this.input){this.input.clear(),this.input.write(e.replace(JK,``));return}let r=e.match(/[0-9]\\ \\frac\{[^\{]*\}\{ \}/);if(this.input&&r&&r?.length){try{this.input.mathField.__controller.cursor.insLeftOf(this.input.mathField.__controller.cursor.parent[-1].parent),this.input.mathField.el().dispatchEvent(new KeyboardEvent(`keydown`,{keyCode:8}))}catch(e){console.error(e.toString())}return}t(e)};shouldComponentUpdate(e,t){let n=this.input.mathField.latex()!==e.latex;return qK(`[shouldComponentUpdate] `,`inputIsDifferent: `,n),!zp(this.props.error,e.error)||!n&&this.props.keypadMode!==e.keypadMode||!n&&this.props.noDecimal!==e.noDecimal||!n&&this.state.equationEditor!==t.equationEditor?!0:!n&&this.props.controlledKeypad?this.props.showKeypad!==e.showKeypad:n}onEditorTypeChange=e=>{this.setState({equationEditor:e.target.value})};checkResponseAreasNumber=(e,t)=>{let{latex:n}=this.input&&this.input.props||{};if(n){let r=(n.match(/answerBlock/g)||[]).length;return t?r===e-1:r===e}return!1};render(){let{classNames:e,keypadMode:t,allowAnswerBlock:n,additionalKeys:r,controlledKeypad:i,controlledKeypadMode:a,showKeypad:o,setKeypadInteraction:s,noDecimal:c,hideInput:l,layoutForKeyPad:u,latex:d,onFocus:f,onBlur:p,error:m}=this.props,h=!i||i&&o,{addDisabled:g}=this.state;return qK(`[render]`,d),(0,F.jsxs)(YK,{className:e.mathToolbar,children:[(0,F.jsxs)(XK,{hide:l,children:[a&&(0,F.jsxs)(ZK,{variant:`standard`,children:[(0,F.jsx)(QK,{id:`equation-editor-label`,children:`Equation Editor`}),(0,F.jsxs)(IK,{labelId:`equation-editor-label`,id:`equation-editor-select`,name:`equationEditor`,label:`Equation Editor`,onChange:this.onEditorTypeChange,value:this.state.equationEditor,MenuProps:{transitionDuration:{enter:225,exit:195}},children:[(0,F.jsx)(VK,{value:`non-negative-integers`,children:`Numeric - Non-Negative Integers`}),(0,F.jsx)(VK,{value:`integers`,children:`Numeric - Integers`}),(0,F.jsx)(VK,{value:`decimals`,children:`Numeric - Decimals`}),(0,F.jsx)(VK,{value:`fractions`,children:`Numeric - Fractions`}),(0,F.jsx)(VK,{value:1,children:`Grade 1 - 2`}),(0,F.jsx)(VK,{value:3,children:`Grade 3 - 5`}),(0,F.jsx)(VK,{value:6,children:`Grade 6 - 7`}),(0,F.jsx)(VK,{value:8,children:`Grade 8 - HS`}),(0,F.jsx)(VK,{value:`geometry`,children:`Geometry`}),(0,F.jsx)(VK,{value:`advanced-algebra`,children:`Advanced Algebra`}),(0,F.jsx)(VK,{value:`statistics`,children:`Statistics`}),(0,F.jsx)(VK,{value:`item-authoring`,children:`Item Authoring`})]})]}),(0,F.jsx)($K,{error:m,children:(0,F.jsx)(eq,{onFocus:()=>{f&&f(),this.updateDisable(!1)},onBlur:e=>{this.updateDisable(!1),p&&p(e)},className:e&&e.editor||``,controlledKeypadMode:a,ref:e=>this.input=e,latex:d,onChange:this.onEditorChange})})]}),n&&(0,F.jsx)(tq,{type:`primary`,style:{bottom:h?`320px`:`20px`},onClick:this.onAnswerBlockClick,disabled:g,children:`+ Response Area`}),(0,F.jsx)(nq,{}),h&&(0,F.jsx)(rq,{mode:a?this.state.equationEditor:t,controlledKeypadMode:a,layoutForKeyPad:u,additionalKeys:r,onClick:this.onClick,noDecimal:c,setKeypadInteraction:s})]})}},oq=R(fR)(({hideBackground:e})=>({verticalAlign:`top`,width:`28px`,height:`28px`,color:`#00bb00`,...e&&{backgroundColor:yu(),"&:hover":{backgroundColor:au()}},"& .MuiIconButton-label":{position:`absolute`,top:`2px`}})),sq=({onClick:e,hideBackground:t})=>(0,F.jsx)(oq,{"aria-label":`Done`,onClick:e,hideBackground:t,size:`large`,children:(0,F.jsx)(hR,{})});sq.propTypes={onClick:v.func,hideBackground:v.bool};var cq=sq,{commonMqFontStyles:lq,longdivStyles:uq,supsubStyles:dq}=IW,fq=Uu(`@pie-lib:math-toolbar:math-preview`),pq=R(`div`)(({theme:e,isSelected:t})=>({display:`inline-flex`,alignItems:`center`,position:`relative`,"& *":lq,...dq,...uq,"& > .mq-math-mode":{border:t?`solid 0px lightgrey`:`solid 1px lightgrey`},"& > .mq-focused":{outline:`none`,boxShadow:`none`,border:`solid 1px black`,borderRadius:`0px`},"& > .mq-math-mode .mq-root-block":{paddingTop:`7px !important`},"& > .mq-math-mode .mq-overarc ":{paddingTop:`0.45em !important`},"& > .mq-math-mode .mq-sqrt-prefix":{verticalAlign:`baseline !important`,top:`1px !important`,left:`-0.1em !important`},"& > .mq-math-mode .mq-denominator":{marginTop:`-5px !important`,padding:`0.5em 0.1em 0.1em !important`},"& > .mq-math-mode .mq-numerator, .mq-math-mode .mq-over":{padding:`0 0.1em !important`,paddingBottom:`0 !important`,marginBottom:`-2px`},"& > .mq-math-mode .mq-longdiv .mq-longdiv-inner .mq-empty":{paddingTop:`6px !important`,paddingLeft:`4px !important`},"& > .mq-math-mode .mq-longdiv .mq-longdiv-inner":{marginLeft:`0 !important`},"& > .mq-math-mode .mq-overarrow":{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`},"& > .mq-math-mode .mq-paren":{verticalAlign:`top !important`,padding:`1px 0.1em !important`},"& > .mq-math-mode .mq-sqrt-stem":{borderTop:`0.07em solid`,marginLeft:`-1.5px`,marginTop:`-2px !important`,paddingTop:`5px !important`},"& .mq-overarrow-inner":{paddingTop:`0 !important`,border:`none !important`},"& .mq-editable-field .mq-cursor":{marginTop:`-15px !important`},"& .mq-overarrow.mq-arrow-both":{top:`7.5px`,marginTop:`0px`,minWidth:`1.23em`,"& *":{lineHeight:`1 !important`},"&:before":{top:`-0.4em`,left:`-1px`},"&:after":{top:`0px !important`,position:`absolute !important`,right:`-2px`},"&.mq-empty:after":{top:`-0.45em`}},"& .mq-overarrow.mq-arrow-right":{"&:before":{top:`-0.4em`,right:`-1px`}},"& .mq-overarrow-inner-right":{display:`none !important`},"& .mq-overarrow-inner-left":{display:`none !important`},"& .mq-longdiv-inner":{borderTop:`1px solid !important`,paddingTop:`1.5px !important`},"& .mq-parallelogram":{lineHeight:.85},'& span[data-prime="true"]':{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`},...t&&{border:`solid 1px ${e.palette.primary.main}`}})),mq=R(`span`)({position:`absolute`,bottom:0,left:0,right:0,top:0}),hq=class extends P.Component{static propTypes={latex:v.string,isSelected:v.bool,onFocus:v.func,onBlur:v.func};componentDidMount(){HK()}componentDidUpdate(e){this.props.latex!==e.latex&&HK()}render(){let{isSelected:e,onFocus:t,onBlur:n,latex:r}=this.props;return fq(`[render] latex: `,r),(0,F.jsxs)(pq,{isSelected:e,children:[` `,(0,F.jsx)(mq,{}),(0,F.jsx)(jW,{latex:r,onFocus:t,onBlur:n})]})}},gq=R(`div`)({display:`flex`,width:`100%`,zIndex:8,alignItems:`center`}),_q=class extends P.Component{static propTypes={autoFocus:v.bool,allowAnswerBlock:v.bool,controlledKeypad:v.bool,controlledKeypadMode:v.bool,keypadMode:v.oneOfType([v.string,v.number]),classNames:v.object,error:v.string,maxResponseAreas:v.number,showKeypad:v.bool,noDecimal:v.bool,additionalKeys:v.array,latex:v.string.isRequired,onAnswerBlockAdd:v.func,onChange:v.func,onDone:v.func.isRequired,onFocus:v.func,onBlur:v.func,hideDoneButton:v.bool,keyPadCharacterRef:v.func,setKeypadInteraction:v.func};static defaultProps={classNames:{},keypadMode:`item-authoring`,autoFocus:!1,allowAnswerBlock:!1,controlledKeypad:!1,controlledKeypadMode:!1,noDecimal:!1,showKeypad:!0,additionalKeys:[],onChange:()=>{},onAnswerBlockAdd:()=>{},onFocus:()=>{},hideDoneButton:!1};constructor(e){super(e),this.state={latex:e.latex}}done=()=>{this.props.onDone(this.state.latex)};UNSAFE_componentWillReceiveProps(e){this.setState({latex:e.latex})}onChange=e=>{this.setState({latex:e}),this.props.onChange(e)};render(){let{latex:e}=this.state,{classNames:t,autoFocus:n,allowAnswerBlock:r,onAnswerBlockAdd:i,controlledKeypad:a,controlledKeypadMode:o,keypadMode:s,noDecimal:c,additionalKeys:l,showKeypad:u,onFocus:d,onBlur:f,hideDoneButton:p,error:m,keyPadCharacterRef:h,setKeypadInteraction:g,maxResponseAreas:_}=this.props;return(0,F.jsx)(vq,{autoFocus:n,classNames:t,onAnswerBlockAdd:i,allowAnswerBlock:r,latex:e,additionalKeys:l,noDecimal:c,keypadMode:s,keyPadCharacterRef:h,setKeypadInteraction:g,onChange:this.onChange,onDone:this.done,onFocus:d,onBlur:f,showKeypad:u,controlledKeypad:a,controlledKeypadMode:o,hideDoneButton:p,error:m,maxResponseAreas:_})}},vq=class extends P.Component{static propTypes={classNames:v.object,latex:v.string.isRequired,keypadMode:v.oneOfType([v.string,v.number]),hideInput:v.bool,noLatexHandling:v.bool,layoutForKeyPad:v.object,onChange:v.func.isRequired,onDone:v.func.isRequired,onBlur:v.func,onAnswerBlockAdd:v.func,additionalKeys:v.array,onFocus:v.func,autoFocus:v.bool,noDecimal:v.bool,allowAnswerBlock:v.bool,controlledKeypad:v.bool,controlledKeypadMode:v.bool,showKeypad:v.bool,hideDoneButton:v.bool,hideDoneButtonBackground:v.bool,error:v.any,maxResponseAreas:v.number,keyPadCharacterRef:v.object,setKeypadInteraction:v.func};static defaultProps={classNames:{},hideDoneButtonBackground:!1};render(){let{classNames:e,autoFocus:t,allowAnswerBlock:n,onAnswerBlockAdd:r,controlledKeypad:i,controlledKeypadMode:a,additionalKeys:o,showKeypad:s,keypadMode:c,noDecimal:l,hideInput:u,noLatexHandling:d,layoutForKeyPad:f,keyPadCharacterRef:p,setKeypadInteraction:m,latex:h,onChange:g,onDone:_,onFocus:v,onBlur:y,hideDoneButton:b,hideDoneButtonBackground:x,error:S,maxResponseAreas:C}=this.props;return(0,F.jsxs)(gq,{className:e&&e.toolbar||``,ref:p,children:[(0,F.jsx)(`div`,{}),(0,F.jsx)(aq,{autoFocus:t,keypadMode:c,classNames:e||{},controlledKeypad:i,controlledKeypadMode:a,noDecimal:l,hideInput:u,noLatexHandling:d,layoutForKeyPad:f,showKeypad:s,additionalKeys:o,allowAnswerBlock:n,onAnswerBlockAdd:r,latex:h,onChange:g,onFocus:v,onBlur:y,error:S,maxResponseAreas:C,setKeypadInteraction:m}),(!i||i&&s)&&!b&&(0,F.jsx)(cq,{hideBackground:x,onClick:_})]})}},yq=new ry(`ensureTextAfterMath`),bq=(e=[])=>e.map(e=>({name:e,latex:e,write:e,label:e})),xq=e=>new ey({key:yq,appendTransaction:(t,n,r)=>{if(!t.some(e=>e.docChanged))return null;let i=r.tr,a=!1;return r.doc.descendants((t,n)=>{if(t.type.name===e){let e=n+t.nodeSize,o=r.doc.nodeAt(e);(!o||o.type.name!==`text`)&&(i.insert(e,r.schema.text(``)),a=!0)}}),a?i:null}}),Sq=(e,t)=>{let n;for(n=t;n>0;n--){let t=e.nodeAt(n);if(t?.type?.name===`text`&&t.textContent!==``)return-1;if(t&&t?.type?.name!==`text`)break}return n},Cq=new ey({key:new ry(`zeroWidthSpaceHandling`),props:{handleKeyDown(e,t){let{state:n,dispatch:r}=e,{selection:i,doc:a}=n,{from:o,empty:s}=i;if(s&&t.key===`Backspace`&&o>0){let e=Sq(a,o);return e===-1?!1:(r(n.tr.delete(e,o)),!0)}if(s&&t.key===`ArrowLeft`&&o>0){let e=Sq(a,o);if(e===-1)return!1;let t=n.doc.resolve(e);if(t.nodeAfter||t.nodeBefore){let t=n.doc.resolve(e);return r(n.tr.setSelection(Rv.create(n.doc,t.pos))),!0}else return r(n.tr.setSelection(Iv.create(n.doc,o-2))),!0}return!1}}}),wq=wO.create({name:`math`,group:`inline`,inline:!0,atom:!0,addAttributes(){return{latex:{default:``},wrapper:{default:null},html:{default:null}}},addProseMirrorPlugins(){return[xq(this.name),Cq]},parseHTML(){return[{tag:`span[data-latex]`,getAttrs:e=>({latex:e.getAttribute(`data-raw`)||e.textContent})},{tag:`span[data-type="mathml"]`,getAttrs:e=>({html:e.innerHTML})}]},addCommands(){return{insertMath:(e=``)=>({tr:t,editor:n,dispatch:r})=>{let{state:i}=n.view,a=i.schema.nodes.math.create({latex:e}),{selection:o}=i,s=o.$from.pos;if(t.insert(s,a),a?.type?.name===this.name){let e=Rv.create(t.doc,o.$from.pos);t.setSelection(e)}return r(t),wR(n,!0),!0}}},renderHTML({HTMLAttributes:e}){return e.html?[`span`,{"data-type":`mathml`,dangerouslySetInnerHTML:{__html:e.html}}]:[`span`,{"data-latex":``,"data-raw":e.latex},gd(e.latex,e.wrapper)]},addNodeView(){return iA(e=>(0,F.jsx)(Tq,{...e,options:this.options}))}}),Tq=e=>{let{node:t,updateAttributes:n,editor:r,selected:i,options:a,getPos:o}=e,[s,c]=(0,P.useState)(i),l=(0,P.useRef)(null),u=(0,P.useRef)(null),d=(0,P.useRef)(Date.now()),[f,p]=(0,P.useState)({top:0,left:0}),{math:m={}}=a||{},{keypadMode:h,controlledKeypadMode:g=!0,customKeys:_=[],keyPadCharacterRef:v,setKeypadInteraction:y}=m,b=t.attrs.latex||``,x=e=>{n({latex:e})},S=(e,{moveCursorAfterNode:i=!0}={})=>{if(n({latex:e}),c(!1),i&&typeof o==`function`){let e=o(),{doc:n}=r.state,i=Iv.create(n,e+t.nodeSize),a=r.state.tr.setSelection(i);r.view.dispatch(a)}r.commands.focus()};return(0,P.useEffect)(()=>{if(!i)return;let{selection:e}=r.state;e.node?.type?.name===`math`&&c(!0)},[i,r]),(0,P.useEffect)(()=>{wR(r,i||s)},[r,s,i]),(0,P.useEffect)(()=>{if(!r||!s){p({top:0,left:0});return}let e=()=>{if(!l.current)return;let{from:e}=r.state.selection,t=r.view.coordsAtPos(e),n=u.current?.getBoundingClientRect?.(),i=n?.height?n.top:t.top,a=n?.width?n.left:t.left,o=n?.height?n.bottom:t.bottom??t.top,s=l.current.offsetHeight,c=l.current.offsetWidth,d=window.innerHeight-(o+0)>=s?o+0:i-s-0,f=a;d=Math.max(8,Math.min(d,window.innerHeight-s-8)),f=Math.max(8,Math.min(f,window.innerWidth-c-8));let m=(r._tiptapContainerEl||document.body).getBoundingClientRect();p({top:d-m.top,left:f-m.left})};e();let t=null,n=()=>{t===null&&(t=requestAnimationFrame(()=>{t=null,e()}))};return t=requestAnimationFrame(()=>{t=null,e()}),window.addEventListener(`scroll`,n,!0),window.addEventListener(`resize`,n),()=>{t!==null&&cancelAnimationFrame(t),window.removeEventListener(`scroll`,n,!0),window.removeEventListener(`resize`,n)}},[r,s]),(0,P.useEffect)(()=>{let e=e=>{let n=e?.target,i=(document.querySelectorAll?.(`[id^="equation-editor-select"][id*="listbox"], [aria-labelledby="equation-editor-label"][role="listbox"]`)||[]).length>0,a=!!(n?.id&&n.id.includes(`equation-editor-select`))||!!n?.closest?.(`[id*="equation-editor-select"]`),o=!!n?.closest?.(`.math-node-${d.current}`);if(l.current&&!l.current.contains(n)&&!n?.closest?.(`[data-inline-node]`)&&!i&&!a&&!o){c(!1);let e=!!r?.view?.dom?.contains(n);S(t.attrs.latex,{moveCursorAfterNode:!e})}};return s?document.addEventListener(`click`,e):document.removeEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[r,s,t]),(0,F.jsxs)(Wk,{className:`math-node-${d.current}`,style:{display:`inline-flex`,cursor:`pointer`,margin:`0 4px`},"data-selected":i,children:[(0,F.jsx)(`div`,{ref:u,onClick:()=>c(!0),contentEditable:!1,children:(0,F.jsx)(hq,{latex:b})}),s&&Ms.createPortal((0,F.jsx)(`div`,{ref:l,"data-toolbar-for":r.instanceId,style:{position:`absolute`,top:`${f.top}px`,left:`${f.left}px`,zIndex:1e3,background:`var(--editable-html-toolbar-bg, #efefef)`,boxShadow:`0px 1px 5px 0px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 3px 1px -2px rgba(0, 0, 0, 0.12)`},children:(0,F.jsx)(_q,{latex:b,autoFocus:!0,onChange:x,onDone:S,keypadMode:h,controlledKeypadMode:g,additionalKeys:bq(_),keyPadCharacterRef:v,setKeypadInteraction:y})}),r?._tiptapContainerEl||document.body)]})};function Eq(e){return Br(`MuiLinearProgress`,e)}Vr(`MuiLinearProgress`,[`root`,`colorPrimary`,`colorSecondary`,`determinate`,`indeterminate`,`buffer`,`query`,`dashed`,`dashedColorPrimary`,`dashedColorSecondary`,`bar`,`bar1`,`bar2`,`barColorPrimary`,`barColorSecondary`,`bar1Indeterminate`,`bar1Determinate`,`bar1Buffer`,`bar2Indeterminate`,`bar2Buffer`]);var Dq=4,Oq=Lt`
|
|
301
|
+
https://github.com/mathquill/mathquill/wiki/%60dev%60-branch-(2014%E2%80%932015)-%E2%86%92-v0.10.0-Migration-Guide`)},oU(),sU},sU.getInterface=uU;var cU=uU.MIN=1,lU=uU.MAX=3;function uU(e){if(!(cU<=e&&e<=lU))throw`Only interface versions between `+cU+` and `+lU+` supported. You specified: `+e;if(e<3&&typeof window<`u`&&!window.jQuery)throw`MathQuill interface version `+e+` requires jQuery 1.5.2+ to be loaded first`;function t(e){if(!e||!e.nodeType)return null;var t=MH(e).children(`.mq-root-block`).attr(IH),r=t&&qH.byId[t].controller;return r?n[r.KIND_OF_MQ](r):null}var n={};t.L=Y,t.R=X,t.saneKeyboardEvents=mU;function r(e,t){for(var r in t&&t.handlers&&(t.handlers={fns:t.handlers,APIClasses:n}),t)if(t.hasOwnProperty(r)){var i=t[r],a=rU[r];e[r]=a?a(i):i}}t.config=function(e){return r(nU.p,e),this},t.registerEmbed=function(e,t){if(!/^[a-z][a-z0-9]*$/i.test(e))throw`Embed name must start with letter and be only letters and digits`;aU[e]=t};var i=n.AbstractMathQuill=J(iU,function(t){t.init=function(e){this.__controller=e,this.__options=e.options,this.id=e.id,this.data=e.data},t.parseLatex=function(e){return this.__controller.parseLatex(e)},t.__mathquillify=function(t){var n=this.__controller,r=n.root,i=n.container;n.createTextarea();var a=i.addClass(t).contents().detach();r.jQ=MH(`<span class="mq-root-block"/>`).attr(IH,r.id).appendTo(i),this.latex(a.text()),this.revert=function(){var t=i.empty().unbind(`.mathquill`).removeClass(`mq-editable-field mq-math-mode mq-text-mode`).append(a);return e>=3?t[0]:t}},t.config=function(e){return r(this.__options,e),this},t.el=function(){return this.__controller.container[0]},t.text=function(){return this.__controller.exportText()},t.latex=function(e){return arguments.length>0?(this.__controller.renderLatexMath(e),this.__controller.blurred&&this.__controller.cursor.hide().parent.blur(),this):this.__controller.exportLatex()},t.html=function(){return this.__controller.root.jQ.html().replace(/ mathquill-(?:command|block)-id="?\d+"?/g,``).replace(/<span class="?mq-cursor( mq-blink)?"?>.?<\/span>/i,``).replace(/ mq-hasCursor|mq-hasCursor ?/,``).replace(/ class=(""|(?= |>))/g,``)},t.reflow=function(){return this.__controller.root.postOrder(`reflow`),this}});for(var a in t.prototype=i.prototype,n.EditableField=J(i,function(e,t){e.__mathquillify=function(){return t.__mathquillify.apply(this,arguments),this.__controller.editable=!0,this.__controller.delegateMouseEvents(),this.__controller.editablesTextareaEvents(),this},e.focus=function(){return this.__controller.textarea.focus(),this},e.blur=function(){return this.__controller.textarea.blur(),this},e.write=function(e){return this.__controller.writeLatex(e),this.__controller.scrollHoriz(),this.__controller.blurred&&this.__controller.cursor.hide().parent.blur(),this},e.empty=function(){var e=this.__controller.root,t=this.__controller.cursor;return e.eachChild(`postOrder`,`dispose`),e.ends[Y]=e.ends[X]=0,e.jQ.empty(),delete t.selection,t.insAtRightEnd(e),this},e.cmd=function(e){var t=this.__controller.notify(),n=t.cursor;if(/^\\[a-z]+$/i.test(e)&&!n.isTooDeep()){e=e.slice(1);var r=Z[e];r&&(e=r(e),n.selection&&e.replaces(n.replaceSelection()),e.createLeftOf(n.show()),this.__controller.scrollHoriz())}else n.parent.write(n,e);return t.blurred&&n.hide().parent.blur(),this},e.select=function(){var e=this.__controller;for(e.notify(`move`).cursor.insAtRightEnd(e.root);e.cursor[Y];)e.selectLeft();return this},e.clearSelection=function(){return this.__controller.cursor.clearSelection(),this},e.moveToDirEnd=function(e){return this.__controller.notify(`move`).cursor.insAtDirEnd(e,this.__controller.root),this},e.moveToLeftEnd=function(){return this.moveToDirEnd(Y)},e.moveToRightEnd=function(){return this.moveToDirEnd(X)},e.keystroke=function(e){for(var e=e.replace(/^\s+|\s+$/g,``).split(/\s+/),t=0;t<e.length;t+=1)this.__controller.keystroke(e[t],{preventDefault:zH});return this},e.typedText=function(e){for(var t=0;t<e.length;t+=1)this.__controller.typedText(e.charAt(t));return this},e.dropEmbedded=function(e,t,n){var r=e-MH(window).scrollLeft(),i=t-MH(window).scrollTop(),a=document.elementFromPoint(r,i);this.__controller.seek(MH(a),e,t),hW().setOptions(n).createLeftOf(this.__controller.cursor)},e.clickAt=function(e,t,n){n||=document.elementFromPoint(e,t);var r=this.__controller,i=r.root;return NH.contains(i.jQ[0],n)||(n=i.jQ[0]),r.seek(MH(n),e+pageXOffset,t+pageYOffset),r.blurred&&this.focus(),this},e.ignoreNextMousedown=function(e){return this.__controller.cursor.options.ignoreNextMousedown=e,this}}),t.EditableField=function(){throw`wtf don't call me, I'm 'abstract'`},t.EditableField.prototype=n.EditableField.prototype,tU)(function(r,i){var a=n[r]=i(n);t[r]=function(n,i){var o=t(n);if(o instanceof a||!n||!n.nodeType)return o;var s=eU(a.RootBlock(),MH(n),nU());return s.KIND_OF_MQ=r,a(s).__mathquillify(i,e)},t[r].prototype=a.prototype})(a,tU[a]);return t}sU.noConflict=function(){return window.MathQuill=dU,sU};var dU=window.MathQuill;window.MathQuill=sU;function fU(e){for(var t=`moveOutOf deleteOutOf selectOutOf upOutOf downOutOf`.split(` `),n=0;n<t.length;n+=1)(function(t){e[t]=function(e){this.controller.handle(t,e)}})(t[n]);e.reflow=function(){this.controller.handle(`reflow`),this.controller.handle(`edited`),this.controller.handle(`edit`)}}var pU=J(function(e,t,n){function r(e,t){throw e=e?`'`+e+`'`:`EOF`,`Parse Error: `+t+` at `+e}e.init=function(e){this._=e},e.parse=function(e){return this.skip(o)._(``+e,t,r);function t(e,t){return t}},e.or=function(e){WH(`or is passed a parser`,e instanceof n);var t=this;return n(function(n,r,i){return t._(n,r,a);function a(t){return e._(n,r,i)}})},e.then=function(e){var t=this;return n(function(r,i,a){return t._(r,o,a);function o(t,r){var o=e instanceof n?e:e(r);return WH(`a parser is returned`,o instanceof n),o._(t,i,a)}})},e.many=function(){var e=this;return n(function(t,n,r){for(var i=[];e._(t,a,o););return n(t,i);function a(e,n){return t=e,i.push(n),!0}function o(){return!1}})},e.times=function(e,t){arguments.length<2&&(t=e);var r=this;return n(function(n,i,a){for(var o=[],s=!0,c,l=0;l<e;l+=1)if(s=r._(n,u,d),!s)return a(n,c);for(;l<t&&s;l+=1)s=r._(n,u,f);return i(n,o);function u(e,t){return o.push(t),n=e,!0}function d(e,t){return c=t,n=e,!1}function f(e,t){return!1}})},e.result=function(e){return this.then(a(e))},e.atMost=function(e){return this.times(0,e)},e.atLeast=function(e){var t=this;return t.times(e).then(function(e){return t.many().map(function(t){return e.concat(t)})})},e.map=function(e){return this.then(function(t){return a(e(t))})},e.skip=function(e){return this.then(function(t){return e.result(t)})},this.string=function(e){var t=e.length,r=`expected '`+e+`'`;return n(function(n,i,a){var o=n.slice(0,t);return o===e?i(n.slice(t),o):a(n,r)})};var i=this.regex=function(e){WH(`regexp parser is anchored`,e.toString().charAt(1)===`^`);var t=`expected `+e;return n(function(n,r,i){var a=e.exec(n);if(a){var o=a[0];return r(n.slice(o.length),o)}else return i(n,t)})},a=n.succeed=function(e){return n(function(t,n){return n(t,e)})};n.fail=function(e){return n(function(t,n,r){return r(t,e)})},n.letter=i(/^[a-z]/i),n.letters=i(/^[a-z]*/i),n.digit=i(/^[0-9]/),n.digits=i(/^[0-9]*/),n.whitespace=i(/^\s+/),n.optWhitespace=i(/^\s*/),n.any=n(function(e,t,n){return e?t(e.slice(1),e.charAt(0)):n(e,`expected any character`)}),n.all=n(function(e,t,n){return t(``,e)});var o=n.eof=n(function(e,t,n){return e?n(e,`expected EOF`):t(e,e)})}),mU=function(){var e={8:`Backspace`,9:`Tab`,10:`Enter`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,20:`CapsLock`,27:`Esc`,32:`Spacebar`,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`Left`,38:`Up`,39:`Right`,40:`Down`,45:`Insert`,46:`Del`,144:`NumLock`};function t(t){var n=t.which||t.keyCode,r=e[n],i,a=[];return t.ctrlKey&&a.push(`Ctrl`),t.originalEvent&&t.originalEvent.metaKey&&a.push(`Meta`),t.altKey&&a.push(`Alt`),t.shiftKey&&a.push(`Shift`),i=r||String.fromCharCode(n),!a.length&&!r?i:(a.push(i),a.join(`-`))}return function(e,n){var r=null,i=null,a=NH(e),o=NH(n.container||a),s=zH,c;function l(e){s=e,clearTimeout(c),c=setTimeout(e)}function u(e){l(function(t){s=zH,clearTimeout(c),e(t)})}o.bind(`keydown keypress input keyup focusout paste`,function(e){s(e)});function d(e){s(),s=zH,clearTimeout(c),a.val(e),e&&a[0]&&a[0].select&&a[0].select(),f=!!e}var f=!1;function p(){var e=a[0];return`selectionStart`in e&&e.selectionStart!==e.selectionEnd}function m(){n.keystroke(t(r),r)}function h(e){r=e,i=null,f&&u(function(e){!(e&&e.type===`focusout`)&&a[0]&&a[0].select&&a[0].select()}),m()}function g(e){r&&i&&m(),i=e,l(v)}function _(e){r&&!i&&l(v)}function v(){if(!p()){var e=a.val();e.length===1?(a.val(``),n.typedText(e)):e&&a[0]&&a[0].select&&a[0].select()}}function y(){r=i=null}function b(e){a.focus(),l(x)}function x(){var e=a.val();a.val(``),e&&n.paste(e)}return o.bind({keydown:h,keypress:g,keyup:_,focusout:y,cut:function(){u(function(){n.cut()})},copy:function(){u(function(){n.copy()})},paste:b}),{select:d}}}();eU.open(function(e,t){e.exportText=function(){return this.root.foldChildren(``,function(e,t){return e+t.text()})}}),eU.open(function(e){e.focusBlurEvents=function(){var e=this,t=e.root,n=e.cursor,r;e.textarea.focus(function(){e.blurred=!1,clearTimeout(r),e.container.addClass(`mq-focused`),n.parent||n.insAtRightEnd(t),n.selection?(n.selection.jQ.removeClass(`mq-blur`),e.selectionChanged()):n.show()}).blur(function(){e.blurred=!0,r=setTimeout(function(){t.postOrder(`intentionalBlur`),n.clearSelection().endSelection(),a()}),MH(window).bind(`blur`,i)});function i(){clearTimeout(r),n.selection&&n.selection.jQ.addClass(`mq-blur`),a()}function a(){n.hide().parent.blur(),e.container.removeClass(`mq-focused`),MH(window).unbind(`blur`,i)}e.blurred=!0,n.hide().parent.blur()}}),eU.open(function(e){e.keystroke=function(e,t){this.cursor.parent.keystroke(e,t,this)}}),qH.open(function(e){e.keystroke=function(e,t,n){var r=n.cursor;switch(e){case`Ctrl-Shift-Backspace`:case`Ctrl-Backspace`:n.ctrlDeleteDir(Y);break;case`Shift-Backspace`:case`Backspace`:n.backspace();break;case`Esc`:case`Tab`:n.escapeDir(X,e,t);return;case`Shift-Tab`:case`Shift-Esc`:n.escapeDir(Y,e,t);return;case`End`:n.notify(`move`).cursor.insAtRightEnd(r.parent);break;case`Ctrl-End`:n.notify(`move`).cursor.insAtRightEnd(n.root);break;case`Shift-End`:for(;r[X];)n.selectRight();break;case`Ctrl-Shift-End`:for(;r[X]||r.parent!==n.root;)n.selectRight();break;case`Home`:n.notify(`move`).cursor.insAtLeftEnd(r.parent);break;case`Ctrl-Home`:n.notify(`move`).cursor.insAtLeftEnd(n.root);break;case`Shift-Home`:for(;r[Y];)n.selectLeft();break;case`Ctrl-Shift-Home`:for(;r[Y]||r.parent!==n.root;)n.selectLeft();break;case`Left`:n.moveLeft();break;case`Shift-Left`:n.selectLeft();break;case`Ctrl-Left`:break;case`Right`:n.moveRight();break;case`Shift-Right`:n.selectRight();break;case`Ctrl-Right`:break;case`Up`:n.moveUp();break;case`Down`:n.moveDown();break;case`Shift-Up`:if(r[Y])for(;r[Y];)n.selectLeft();else n.selectLeft();case`Shift-Down`:if(r[X])for(;r[X];)n.selectRight();else n.selectRight();case`Ctrl-Up`:break;case`Ctrl-Down`:break;case`Ctrl-Shift-Del`:case`Ctrl-Del`:n.ctrlDeleteDir(X);break;case`Shift-Del`:case`Del`:n.deleteForward();break;case`Meta-A`:case`Ctrl-A`:for(n.notify(`move`).cursor.insAtRightEnd(n.root);r[Y];)n.selectLeft();break;default:return}t.preventDefault(),n.scrollHoriz()},e.moveOutOf=e.moveTowards=e.deleteOutOf=e.deleteTowards=e.unselectInto=e.selectOutOf=e.selectTowards=function(){WH(`overridden or never called on this node`)}}),eU.open(function(e){this.onNotify(function(e){(e===`move`||e===`upDown`)&&this.show().clearSelection()}),e.escapeDir=function(e,t,n){GH(e);var r=this.cursor;if(r.parent!==this.root&&n.preventDefault(),r.parent!==this.root)return r.parent.moveOutOf(e,r),this.notify(`move`)},rU.leftRightIntoCmdGoes=function(e){if(e&&e!==`up`&&e!==`down`)throw`"up" or "down" required for leftRightIntoCmdGoes option, got "`+e+`"`;return e},e.moveDir=function(e){GH(e);var t=this.cursor,n=t.options.leftRightIntoCmdGoes;return t.selection?t.insDirOf(e,t.selection.ends[e]):t[e]?t[e].moveTowards(e,t,n):t.parent.moveOutOf(e,t,n),this.notify(`move`)},e.moveLeft=function(){return this.moveDir(Y)},e.moveRight=function(){return this.moveDir(X)},e.moveUp=function(){return t(this,`up`)},e.moveDown=function(){return t(this,`down`)};function t(e,t){var n=e.notify(`upDown`).cursor,r=t+`Into`,i=t+`OutOf`;return n[X][r]?n.insAtLeftEnd(n[X][r]):n[Y][r]?n.insAtRightEnd(n[Y][r]):n.parent.bubble(function(e){var t=e[i];if(t&&(typeof t==`function`&&(t=e[i](n)),t instanceof qH&&n.jumpUpDown(e,t),t!==!0))return!1}),e}this.onNotify(function(e){e!==`upDown`&&(this.upDownCache={})}),this.onNotify(function(e){e===`edit`&&this.show().deleteSelection()}),e.deleteDir=function(e){GH(e);var t=this.cursor,n=t.selection;return this.notify(`edit`),n||(t[e]?t[e].deleteTowards(e,t):t.parent.deleteOutOf(e,t)),t[Y].siblingDeleted&&t[Y].siblingDeleted(t.options,X),t[X].siblingDeleted&&t[X].siblingDeleted(t.options,Y),t.parent.bubble(`reflow`),this},e.ctrlDeleteDir=function(e){GH(e);var t=this.cursor;return!t[e]||t.selection?this.deleteDir(e):(this.notify(`edit`),e===Y?YH(t.parent.ends[Y],t[Y]).remove():YH(t[X],t.parent.ends[X]).remove(),t.insAtDirEnd(e,t.parent),t[Y].siblingDeleted&&t[Y].siblingDeleted(t.options,X),t[X].siblingDeleted&&t[X].siblingDeleted(t.options,Y),t.parent.bubble(`reflow`),this)},e.backspace=function(){return this.deleteDir(Y)},e.deleteForward=function(){return this.deleteDir(X)},this.onNotify(function(e){e!==`select`&&this.endSelection()}),e.selectDir=function(e){var t=this.notify(`select`).cursor,n=t.selection;GH(e),t.anticursor||t.startSelection();var r=t[e];r?n&&n.ends[e]===r&&t.anticursor[-e]!==r?r.unselectInto(e,t):r.selectTowards(e,t):t.parent.selectOutOf(e,t),t.clearSelection(),t.select()||t.show()},e.selectLeft=function(){return this.selectDir(Y)},e.selectRight=function(){return this.selectDir(X)}});var hU=/[\\]{2,}/gm,gU=(function(){function e(e){var t=bU();return e.adopt(t,0,0),t}function t(e){for(var t=e[0]||bU(),n=1;n<e.length;n+=1)e[n].children().adopt(t,t.ends[X],0);return t}var n=pU.string,r=pU.regex,i=pU.letter,a=pU.any,o=pU.optWhitespace,s=pU.succeed,c=pU.fail,l=i.map(function(e){return kU(e)}),u=r(/^[^${}\\_^]/).map(function(e){return Q(e)}),d=r(/^\\not\\[a-z]+/).then(function(e){return ZH[e]&&ZH[e]().parser()||c(`unknown compound command: `+e)}),f=r(/^[^\\a-eg-zA-Z]/).or(n(`\\`).then(r(/^begin\{.?matrix\}/).or(r(/^[a-z]+/i)).or(r(/^\s+/).result(` `)).or(a))).then(function(e){e=e.replace(/^begin\{(.?matrix)\}$/,`$1`);var t=Z[e];return t?t(e).parser():c(`unknown command: \\`+e)}),p=d.or(f).or(l).or(u),m=n(`{`).then(function(){return g}).skip(n(`}`)),h=o.then(m.or(p.map(e))),g=h.many().map(t).skip(o),_=n(`[`).then(h.then(function(e){return e.join(`latex`)===`]`?c():s(e)}).many().map(t).skip(o)).skip(n(`]`)),v=g;return v.block=h,v.optBlock=_,v})();eU.open(function(e,t){e.exportLatex=function(){return this.root.latex().replace(/(\\[a-z]+) (?![a-z])/gi,`$1`)},e.parseLatex=function(e){return gU.parse(e).postOrder(`finalizeTree`,nU.p).join(`latex`).trim()},rU.maxDepth=function(e){return typeof e==`number`?e:PH},e.writeLatex=function(e){var t=this.notify(`edit`).cursor,n=pU.all,r=pU.eof,i=gU.skip(r).or(n.result(!1)).parse(e);return i&&!i.isEmpty()&&i.prepareInsertionAt(t)&&(i.children().adopt(t.parent,t[Y],t[X]),i.jQize().insertBefore(t.jQ),t[Y]=i.ends[X],i.finalizeInsert(t.options,t),i.ends[X][X].siblingCreated&&i.ends[X][X].siblingCreated(t.options,Y),i.ends[Y][Y].siblingCreated&&i.ends[Y][Y].siblingCreated(t.options,X),t.parent.bubble(`reflow`)),this},e.renderLatexMath=function(e){e&&e.replace&&(e=e.replace(hU,`\\`));var t=this.root,n=this.cursor;n.options;var r=t.jQ,i=pU.all,a=pU.eof,o=gU.skip(a).or(i.result(!1)).parse(e);if(t.eachChild(`postOrder`,`dispose`),t.ends[Y]=t.ends[X]=0,o&&o.prepareInsertionAt(n)){o.children().adopt(t,0,0);var s=o.join(`html`);r.html(s),t.jQize(r.children()),t.finalizeInsert(n.options)}else r.empty();delete n.selection,n.insAtRightEnd(t)},e.renderLatexText=function(e){var t=this.root,n=this.cursor;t.jQ.children().slice(1).remove(),t.eachChild(`postOrder`,`dispose`),t.ends[Y]=t.ends[X]=0,delete n.selection,n.show().insAtRightEnd(t);var r=pU.regex,i=pU.string,a=pU.eof,o=pU.all,s=i(`$`).then(gU).skip(i(`$`).or(a)).map(function(e){var t=TU(n);t.createBlocks();var r=t.ends[Y];return e.children().adopt(r,0,0),t}),c=i(`\\$`).result(`$`).or(r(/^[^$]/)).map(Q),l=s.or(c).many().skip(a).or(o.result(!1)).parse(e);if(l){for(var u=0;u<l.length;u+=1)l[u].adopt(t,t.ends[X],0);t.jQize().appendTo(t.jQ),t.finalizeInsert(n.options)}}}),eU.open(function(e){nU.p.ignoreNextMousedown=zH,e.delegateMouseEvents=function(){var e=this.root.jQ;this.container.bind(`mousedown.mathquill`,function(t){var n=MH(t.target).closest(`.mq-root-block`),r=qH.byId[n.attr(IH)||e.attr(IH)].controller,i=r.cursor;i.blink;var a=r.textareaSpan,o=r.textarea;if(t.preventDefault(),t.target.unselectable=!0,i.options.ignoreNextMousedown(t))return;i.options.ignoreNextMousedown=zH;function s(e){i.anticursor||i.startSelection(),r.seek(MH(e.target),e.pageX,e.pageY).cursor.select(),e.target&&MH(e.target.ownerDocument).unbind(`mousemove`,c)}function c(e){return delete e.target,s(e)}function l(e){!i.selection&&!r.editable&&a.detach(),n.unbind(`mousemove`,s),MH(e.target.ownerDocument).unbind(`mousemove`,c).unbind(`mouseup`,l)}if(a.parent().length===0)return!1;r.blurred&&(r.editable||n.prepend(a),document.body.focus(),o.focus()),t.preventDefault(),t.target.unselectable=!0,i.show(),r.seek(MH(t.target),t.pageX,t.pageY).cursor.startSelection(),n.mousemove(s),MH(t.target.ownerDocument).mousemove(c).mouseup(l)})}}),eU.open(function(e){e.seek=function(e,t,n){var r=this.notify(`select`).cursor;if(e){var i=e.attr(IH)||e.attr(FH);if(!i){var a=e.parent();i=a.attr(IH)||a.attr(FH)}}var o=i&&qH.byId[i]?qH.byId[i]:this.root;return r.clearSelection().show(),o.seek(t,r),this.scrollHoriz(),this}}),eU.open(function(e){e.scrollHoriz=function(){var e=this.cursor,t=e.selection,n=this.root.jQ[0].getBoundingClientRect();if(t){var r=t.jQ[0].getBoundingClientRect(),i=r.left-(n.left+20),a=r.right-(n.right-20);if(t.ends[Y]===e[X])if(i<0)var o=i;else if(a>0)if(r.left-a<n.left+20)var o=i;else var o=a;else return;else if(a>0)var o=a;else if(i<0)if(r.right-i>n.right-20)var o=a;else var o=i;else return}else{var s=e.jQ[0].getBoundingClientRect().left;if(s>n.right-20)var o=s-(n.right-20);else if(s<n.left+20)var o=s-(n.left+20);else return}this.root.jQ.stop&&typeof this.root.jQ.stop==`function`&&this.root.jQ.stop().animate({scrollLeft:`+=`+o},100)}}),eU.open(function(e){nU.p.substituteTextarea=function(){return MH(`<textarea autocapitalize=off autocomplete=off autocorrect=off spellcheck=false x-palm-disable-ste-all=true />`)[0]},e.createTextarea=function(){var e=this.textareaSpan=MH(`<span class="mq-textarea"></span>`),t=this.options.substituteTextarea();if(!t.nodeType)throw`substituteTextarea() must return a DOM element, got `+t;t=this.textarea=MH(t).appendTo(e);var n=this;n.cursor.selectionChanged=function(){n.selectionChanged()}},e.selectionChanged=function(){var e=this;UU(e.container[0]),e.textareaSelectionTimeout===PH&&(e.textareaSelectionTimeout=setTimeout(function(){e.setTextareaSelection()}))},e.setTextareaSelection=function(){this.textareaSelectionTimeout=PH;var e=``;this.cursor.selection&&(e=this.cursor.selection.join(`latex`),this.options.statelessClipboard&&(e=`$`+e+`$`)),this.selectFn(e)},e.staticMathTextareaEvents=function(){var e=this;e.root;var t=e.cursor,n=e.textarea,r=e.textareaSpan;this.container.prepend(NH(`<span class="mq-selectable">`).text(`$`+e.exportLatex()+`$`)),e.blurred=!0,n.bind(`cut paste`,!1).bind(`copy`,function(){e.setTextareaSelection()}).focus(function(){e.blurred=!1}).blur(function(){t.selection&&t.selection.clear(),setTimeout(i)});function i(){r.detach(),e.blurred=!0}e.selectFn=function(e){n.val(e),e&&n.select()}},nU.p.substituteKeyboardEvents=mU,e.editablesTextareaEvents=function(){var e=this,t=e.textarea,n=e.textareaSpan,r=this.options.substituteKeyboardEvents(t,this);this.selectFn=function(e){r.select(e)},this.container.prepend(n),this.focusBlurEvents()},e.typedText=function(e){if(e===`
|
|
302
|
+
`)return this.handle(`enter`);var t=this.notify().cursor;t.parent.write(t,e),this.scrollHoriz()},e.cut=function(){var e=this,t=e.cursor;t.selection&&setTimeout(function(){e.notify(`edit`),t.parent.bubble(`reflow`)})},e.copy=function(){this.setTextareaSelection()},e.paste=function(e){this.options.statelessClipboard&&(e=e.slice(0,1)===`$`&&e.slice(-1)===`$`?e.slice(1,-1):`\\text{`+e+`}`),this.writeLatex(e).cursor.show()}});var _U=J(qH,function(e,t){e.finalizeInsert=function(e,t){var n=this;n.postOrder(`finalizeTree`,e),n.postOrder(`contactWeld`,t),n.postOrder(`blur`),n.postOrder(`reflow`),n[X].siblingCreated&&n[X].siblingCreated(e,Y),n[Y].siblingCreated&&n[Y].siblingCreated(e,X),n.bubble(`reflow`)},e.prepareInsertionAt=function(e){var t=e.options.maxDepth;if(t!==PH){var n=e.depth();if(n>t)return!1;this.removeNodesDeeperThan(t-n)}return!0},e.removeNodesDeeperThan=function(e){for(var t=0,n=[[this,t]],r;n.length;)r=n.shift(),r[0].children().each(function(i){var a=+(i instanceof bU);t=r[1]+a,t<=e?n.push([i,t]):(a?i.children():i).remove()})}}),vU=J(_U,function(e,t){e.init=function(e,n,r){var i=this;t.init.call(i),i.ctrlSeq||=e,n&&(i.htmlTemplate=n),r&&(i.textTemplate=r)},e.replaces=function(e){e.disown(),this.replacedFragment=e},e.isEmpty=function(){return this.foldChildren(!0,function(e,t){return e&&t.isEmpty()})},e.parser=function(){var e=gU.block,t=this;return e.times(t.numBlocks()).map(function(e){t.blocks=e;for(var n=0;n<e.length;n+=1)e[n].adopt(t,t.ends[X],0);return t})},e.createLeftOf=function(e){var n=this,r=n.replacedFragment;n.createBlocks(),t.createLeftOf.call(n,e),r&&(r.adopt(n.ends[Y],0,0),r.jQ.appendTo(n.ends[Y].jQ),n.placeCursor(e),n.prepareInsertionAt(e)),n.finalizeInsert(e.options),n.placeCursor(e)},e.createBlocks=function(){for(var e=this,t=e.numBlocks(),n=e.blocks=Array(t),r=0;r<t;r+=1)(n[r]=bU()).adopt(e,e.ends[X],0)},e.placeCursor=function(e){e.insAtRightEnd(this.foldChildren(this.ends[Y],function(e,t){return e.isEmpty()?e:t}))},e.moveTowards=function(e,t,n){var r=n&&this[n+`Into`];t.insAtDirEnd(-e,r||this.ends[-e])},e.deleteTowards=function(e,t){this.isEmpty()?t[e]=this.remove()[e]:this.moveTowards(e,t,null)},e.selectTowards=function(e,t){t[-e]=this,t[e]=this[e]},e.selectChildren=function(){return $H(this,this)},e.unselectInto=function(e,t){t.insAtDirEnd(-e,t.anticursor.ancestors[this.id])},e.seek=function(e,t){function n(e){var t={};return t[Y]=e.jQ.offset().left,t[X]=t[Y]+e.jQ.outerWidth(),t}var r=this,i=n(r);if(e<i[Y])return t.insLeftOf(r);if(e>i[X])return t.insRightOf(r);var a=i[Y];r.eachChild(function(o){var s=n(o);if(e<s[Y])return e-a<s[Y]-e?o[Y]?t.insAtRightEnd(o[Y]):t.insLeftOf(r):t.insAtLeftEnd(o),!1;if(e>s[X])o[X]?a=s[X]:i[X]-e<e-s[X]?t.insRightOf(r):t.insAtRightEnd(o);else return o.seek(e,t),!1})},e.numBlocks=function(){var e=this.htmlTemplate.match(/&\d+/g);return e?e.length:0},e.html=function(){var e=this,t=e.blocks,n=` mathquill-command-id=`+e.id,r=e.htmlTemplate.match(/<[^<>]+>|[^<>]+/g);WH(`no unmatched angle brackets`,r.join(``)===this.htmlTemplate);for(var i=0,a=r[0];a;i+=1,a=r[i])if(a.slice(-2)===`/>`)r[i]=a.slice(0,-2)+n+`/>`;else if(a.charAt(0)===`<`){WH(`not an unmatched top-level close tag`,a.charAt(1)!==`/`),r[i]=a.slice(0,-1)+n+`>`;var o=1;do i+=1,a=r[i],WH(`no missing close tags`,a),a.slice(0,2)===`</`?--o:a.charAt(0)===`<`&&a.slice(-2)!==`/>`&&(o+=1);while(o>0)}return r.join(``).replace(/>&(\d+)/g,function(e,n){return` mathquill-block-id=`+t[n].id+`>`+t[n].join(`html`)})},e.latex=function(){return this.foldChildren(this.ctrlSeq,function(e,t){return e+`{`+(t.latex()||` `)+`}`})},e.textTemplate=[``],e.text=function(){var e=this,t=0;return e.foldChildren(e.textTemplate[t],function(n,r){t+=1;var i=r.text();return n&&e.textTemplate[t]===`(`&&i[0]===`(`&&i.slice(-1)===`)`?n+i.slice(1,-1)+e.textTemplate[t]:n+i+(e.textTemplate[t]||``)})}}),yU=J(vU,function(e,t){e.init=function(e,n,r){r||=e&&e.length>1?e.slice(1):e,t.init.call(this,e,n,[r])},e.parser=function(){return pU.succeed(this)},e.numBlocks=function(){return 0},e.replaces=function(e){e.remove()},e.createBlocks=zH,e.moveTowards=function(e,t){t.jQ.insDirOf(e,this.jQ),t[-e]=this,t[e]=this[e]},e.deleteTowards=function(e,t){t[e]=this.remove()[e]},e.seek=function(e,t){e-this.jQ.offset().left<this.jQ.outerWidth()/2?t.insLeftOf(this):t.insRightOf(this)},e.latex=function(){return this.ctrlSeq},e.text=function(){return this.textTemplate},e.placeCursor=zH,e.isEmpty=function(){return!0}}),Q=J(yU,function(e,t){e.init=function(e,n){t.init.call(this,e,`<span>`+(n||e)+`</span>`)}}),$=J(yU,function(e,t){e.init=function(e,n,r){t.init.call(this,e,`<span class="mq-binary-operator">`+n+`</span>`,r)}}),bU=J(_U,function(e,t){e.join=function(e){return this.foldChildren(``,function(t,n){return t+n[e]()})},e.html=function(){return this.join(`html`)},e.latex=function(){return this.join(`latex`)},e.text=function(){return this.ends[Y]===this.ends[X]&&this.ends[Y]!==0?this.ends[Y].text():this.join(`text`)},e.keystroke=function(e,n,r){if(r.options.spaceBehavesLikeTab&&(e===`Spacebar`||e===`Shift-Spacebar`)){n.preventDefault(),r.escapeDir(e===`Shift-Spacebar`?Y:X,e,n);return}return t.keystroke.apply(this,arguments)},e.moveOutOf=function(e,t,n){!(n&&this.parent[n+`Into`])&&this[e]?t.insAtDirEnd(-e,this[e]):t.insDirOf(e,this.parent)},e.selectOutOf=function(e,t){t.insDirOf(e,this.parent)},e.deleteOutOf=function(e,t){t.unwrapGramp()},e.seek=function(e,t){var n=this.ends[X];if(!n||n.jQ.offset().left+n.jQ.outerWidth()<e)return t.insAtRightEnd(this);if(e<this.ends[Y].jQ.offset().left)return t.insAtLeftEnd(this);for(;e<n.jQ.offset().left;)n=n[Y];return n.seek(e,t)},e.chToCmd=function(e,t){var n;return e.match(/^[a-eg-zA-Z]$/)?kU(e):/^\d$/.test(e)?DU(e):t&&t.typingSlashWritesDivisionSymbol&&e===`/`?Z[`÷`](e):t&&t.typingAsteriskWritesTimesSymbol&&e===`*`?Z[`×`](e):(n=XH[e]||Z[e])?n(e):Q(e)},e.write=function(e,t){var n;if(e.tooDeep())return!1;n=this.chToCmd(t,e.options),e.selection&&n.replaces(e.replaceSelection()),e.isTooDeep()||n.createLeftOf(e.show())},e.focus=function(){return this.jQ.addClass(`mq-hasCursor`),this.jQ.removeClass(`mq-empty`),this},e.blur=function(){return this.jQ.removeClass(`mq-hasCursor`),this.isEmpty()&&this.jQ.addClass(`mq-empty`),this}});nU.p.mouseEvents=!0,tU.StaticMath=function(e){return J(e.AbstractMathQuill,function(t,n){this.RootBlock=bU,t.__mathquillify=function(e,t){return this.config(e),n.__mathquillify.call(this,`mq-math-mode`),this.__options.mouseEvents&&(this.__controller.delegateMouseEvents(),this.__controller.staticMathTextareaEvents()),this},t.init=function(){n.init.apply(this,arguments),this.__controller.root.postOrder(`registerInnerField`,this.innerFields=[],e.MathField)},t.latex=function(){var t=n.latex.apply(this,arguments);return arguments.length>0&&this.__controller.root.postOrder(`registerInnerField`,this.innerFields=[],e.MathField),t}})};var xU=J(bU,fU);tU.MathField=function(e){return J(e.EditableField,function(e,t){this.RootBlock=xU,e.__mathquillify=function(e,n){return this.config(e),n>1&&(this.__controller.root.reflow=zH),t.__mathquillify.call(this,`mq-editable-field mq-math-mode`),delete this.__controller.root.reflow,this}})};var SU=J(qH,function(e,t){e.ctrlSeq=`\\text`,e.replaces=function(e){e instanceof YH?this.replacedText=e.remove().jQ.text():typeof e==`string`&&(this.replacedText=e)},e.jQadd=function(e){t.jQadd.call(this,e),this.ends[Y]&&this.ends[Y].jQadd(this.jQ[0].firstChild)},e.createLeftOf=function(e){var n=this;if(t.createLeftOf.call(this,e),n[X].siblingCreated&&n[X].siblingCreated(e.options,Y),n[Y].siblingCreated&&n[Y].siblingCreated(e.options,X),n.bubble(`reflow`),e.insAtRightEnd(n),n.replacedText)for(var r=0;r<n.replacedText.length;r+=1)n.write(e,n.replacedText.charAt(r))},e.parser=function(){var e=this,t=pU.string,n=pU.regex;return pU.optWhitespace.then(t(`{`)).then(n(/^[^}]*/)).skip(t(`}`)).map(function(t){return t.length===0?YH():(CU(t).adopt(e,0,0),e)})},e.textContents=function(){return this.foldChildren(``,function(e,t){return e+t.text})},e.text=function(){return`"`+this.textContents()+`"`},e.latex=function(){var e=this.textContents();return e.length===0?``:`\\text{`+e.replace(/\\/g,`\\backslash `).replace(/[{}]/g,`\\$&`)+`}`},e.html=function(){return`<span class="mq-text-mode" mathquill-command-id=`+this.id+`>`+this.textContents()+`</span>`},e.moveTowards=function(e,t){t.insAtDirEnd(-e,this)},e.moveOutOf=function(e,t){t.insDirOf(e,this)},e.unselectInto=e.moveTowards,e.selectTowards=vU.prototype.selectTowards,e.deleteTowards=vU.prototype.deleteTowards,e.selectOutOf=function(e,t){t.insDirOf(e,this)},e.deleteOutOf=function(e,t){this.isEmpty()&&t.insRightOf(this)},e.write=function(e,n){if(e.show().deleteSelection(),n!==`$`)e[Y]?(e[Y].appendText(n),this.bubble(`reflow`)):CU(n).createLeftOf(e);else if(this.isEmpty())e.insRightOf(this),Q(`\\$`,`$`).createLeftOf(e);else if(!e[X])e.insRightOf(this);else if(!e[Y])e.insLeftOf(this);else{var r=SU(),i=this.ends[Y];i.disown().jQ.detach(),i.adopt(r,0,0),e.insLeftOf(this),t.createLeftOf.call(r,e)}},e.seek=function(e,t){t.hide();var r=n(this),i=this.jQ.width()/this.text.length,a=Math.round((e-this.jQ.offset().left)/i);a<=0?t.insAtLeftEnd(this):a>=r.text.length?t.insAtRightEnd(this):t.insLeftOf(r.splitRight(a));for(var o=e-t.show().offset().left,s=o&&o<0?Y:X,c=s;t[s]&&o*c>0;)t[s].moveTowards(s,t),c=o,o=e-t.offset().left;if(s*o<-s*c&&t[-s].moveTowards(-s,t),!t.anticursor)this.anticursorPosition=t[Y]&&t[Y].text.length;else if(t.anticursor.parent===this){var l=t[Y]&&t[Y].text.length;if(this.anticursorPosition===l)t.anticursor=KH.copy(t);else{if(this.anticursorPosition<l){var u=t[Y].splitRight(this.anticursorPosition);t[Y]=u}else var u=t[X].splitRight(this.anticursorPosition-l);t.anticursor=KH(this,u[Y],u)}}},e.blur=function(e){bU.prototype.blur.call(this),e&&(this.textContents()===``?(this.remove(),e[Y]===this?e[Y]=this[Y]:e[X]===this&&(e[X]=this[X])):n(this))};function n(e){e.jQ[0].normalize();var t=e.jQ.contents().filter(function(e,t){return t.nodeType===3})[0];t||={data:``},WH(`only node in TextBlock span is Text node`,t.nodeType===3);var n=CU(t.data);return n.jQadd(t),e.children().disown(),n.adopt(e,0,0)}e.focus=bU.prototype.focus}),CU=J(qH,function(e,t){e.init=function(e){t.init.call(this),this.text=e},e.jQadd=function(e){this.dom=e,this.jQ=MH(e)},e.jQize=function(){return this.jQadd(document.createTextNode(this.text))},e.appendText=function(e){this.text+=e,this.dom.appendData(e)},e.prependText=function(e){this.text=e+this.text,this.dom.insertData(0,e)},e.insTextAtDirEnd=function(e,t){GH(t),t===X?this.appendText(e):this.prependText(e)},e.splitRight=function(e){var t=CU(this.text.slice(e)).adopt(this.parent,this,this[X]);return t.jQadd(this.dom.splitText(e)),this.text=this.text.slice(0,e),t};function n(e,t){return t.charAt(e===Y?0:-1+t.length)}e.moveTowards=function(e,t){GH(e);var r=n(-e,this.text),i=this[-e];return i?i.insTextAtDirEnd(r,e):CU(r).createDir(-e,t),this.deleteTowards(e,t)},e.latex=function(){return this.text},e.deleteTowards=function(e,t){this.text.length>1?e===X?(this.dom.deleteData(0,1),this.text=this.text.slice(1)):(this.dom.deleteData(-1+this.text.length,1),this.text=this.text.slice(0,-1)):(this.remove(),this.jQ.remove(),t[e]=this[e])},e.selectTowards=function(e,t){GH(e);var r=t.anticursor,i=n(-e,this.text);if(r[e]===this){var a=CU(i).createDir(e,t);r[e]=a,t.insDirOf(e,a)}else{var o=this[-e];if(o)o.insTextAtDirEnd(i,e);else{var a=CU(i).createDir(-e,t);a.jQ.insDirOf(-e,t.selection.jQ)}this.text.length===1&&r[-e]===this&&(r[-e]=this[-e])}return this.deleteTowards(e,t)}});Z.text=Z.textnormal=Z.textrm=Z.textup=Z.textmd=SU;function wU(e,t,n){return J(SU,{ctrlSeq:e,htmlTemplate:`<`+t+` `+n+`>&0</`+t+`>`})}Z.em=Z.italic=Z.italics=Z.emph=Z.textit=Z.textsl=wU(`\\textit`,`i`,`class="mq-text-mode"`),Z.strong=Z.bold=Z.textbf=wU(`\\textbf`,`b`,`class="mq-text-mode"`),Z.sf=Z.textsf=wU(`\\textsf`,`span`,`class="mq-sans-serif mq-text-mode"`),Z.tt=Z.texttt=wU(`\\texttt`,`span`,`class="mq-monospace mq-text-mode"`),Z.textsc=wU(`\\textsc`,`span`,`style="font-variant:small-caps" class="mq-text-mode"`),Z.uppercase=wU(`\\uppercase`,`span`,`style="text-transform:uppercase" class="mq-text-mode"`),Z.lowercase=wU(`\\lowercase`,`span`,`style="text-transform:lowercase" class="mq-text-mode"`);var TU=J(vU,function(e,t){e.init=function(e){t.init.call(this,`$`),this.cursor=e},e.htmlTemplate=`<span class="mq-math-mode">&0</span>`,e.createBlocks=function(){t.createBlocks.call(this),this.ends[Y].cursor=this.cursor,this.ends[Y].write=function(e,t){t===`$`?this.isEmpty()?(e.insRightOf(this.parent),this.parent.deleteTowards(dir,e),Q(`\\$`,`$`).createLeftOf(e.show())):e[X]?e[Y]?bU.prototype.write.call(this,e,t):e.insLeftOf(this.parent):e.insRightOf(this.parent):bU.prototype.write.call(this,e,t)}},e.latex=function(){return`$`+this.ends[Y].latex()+`$`}}),EU=J(xU,function(e,t){e.keystroke=function(e){if(!(e===`Spacebar`||e===`Shift-Spacebar`))return t.keystroke.apply(this,arguments)},e.write=function(e,t){if(e.show().deleteSelection(),t===`$`)TU(e).createLeftOf(e);else{var n;t===`<`?n=`<`:t===`>`&&(n=`>`),Q(t,n).createLeftOf(e)}}});tU.TextField=function(e){return J(e.EditableField,function(e,t){this.RootBlock=EU,e.__mathquillify=function(){return t.__mathquillify.call(this,`mq-editable-field mq-text-mode`)},e.latex=function(e){return arguments.length>0?(this.__controller.renderLatexText(e),this.__controller.blurred&&this.__controller.cursor.hide().parent.blur(),this):this.__controller.exportLatex()}})},XH[`\\`]=J(vU,function(e,t){e.ctrlSeq=`\\`,e.replaces=function(e){this._replacedFragment=e.disown(),this.isEmpty=function(){return!1}},e.htmlTemplate=`<span class="mq-latex-command-input mq-non-leaf">\\<span>&0</span></span>`,e.textTemplate=[`\\`],e.createBlocks=function(){t.createBlocks.call(this),this.ends[Y].focus=function(){return this.parent.jQ.addClass(`mq-hasCursor`),this.isEmpty()&&this.parent.jQ.removeClass(`mq-empty`),this},this.ends[Y].blur=function(){return this.parent.jQ.removeClass(`mq-hasCursor`),this.isEmpty()&&this.parent.jQ.addClass(`mq-empty`),this},this.ends[Y].write=function(e,t){e.show().deleteSelection(),t.match(/[a-z]/i)?Q(t).createLeftOf(e):(this.parent.renderCommand(e),(t!==`\\`||!this.isEmpty())&&e.parent.write(e,t))},this.ends[Y].keystroke=function(e,n,r){if(e===`Tab`||e===`Enter`||e===`Spacebar`){this.parent.renderCommand(r.cursor),n.preventDefault();return}return t.keystroke.apply(this,arguments)}},e.createLeftOf=function(e){if(t.createLeftOf.call(this,e),this._replacedFragment){var n=this.jQ[0];this.jQ=this._replacedFragment.jQ.addClass(`mq-blur`).bind(`mousedown mousemove`,function(e){return MH(e.target=n).trigger(e),!1}).insertBefore(this.jQ).add(this.jQ)}},e.latex=function(){return`\\`+this.ends[Y].latex()+` `},e.renderCommand=function(e){this.jQ=this.jQ.last(),this.remove(),this[X]?e.insLeftOf(this[X]):e.insAtRightEnd(this.parent);var t=this.ends[Y].latex();t||=` `;var n=Z[t];n?(n=n(t),this._replacedFragment&&n.replaces(this._replacedFragment),n.createLeftOf(e)):(n=SU(),n.replaces(t),n.createLeftOf(e),e.insRightOf(n),this._replacedFragment&&this._replacedFragment.remove())}}),Z[`∉`]=Z.notin=q($,`\\notin `,`∉`),Z[`≅`]=Z.cong=q($,`\\cong `,`≅`),Z[`≡`]=Z.equiv=q($,`\\equiv `,`≡`),Z[`⊕`]=Z.oplus=q($,`\\oplus `,`⊕`),Z[`⊗`]=Z.otimes=q($,`\\otimes `,`⊗`),Z[`≠`]=Z.ne=Z.neq=q($,`\\ne `,`≠`),Z[`≇`]=Z.ncong=q($,`\\ncong `,`≇`),Z[`∗`]=Z.ast=Z.star=Z.loast=Z.lowast=q($,`\\ast `,`∗`),Z.therefor=Z.therefore=q($,`\\therefore `,`∴`),Z.cuz=Z.because=q($,`\\because `,`∵`),Z.prop=Z.propto=q($,`\\propto `,`∝`),Z[`≈`]=Z.asymp=Z.approx=q($,`\\approx `,`≈`),Z[`≉`]=Z.nasymp=Z.napprox=q($,`\\napprox `,`≉`),Z.isin=Z.in=q($,`\\in `,`∈`),Z.ni=Z.contains=q($,`\\ni `,`∋`),Z.notni=Z.niton=Z.notcontains=Z.doesnotcontain=ZH[`\\not\\ni`]=q($,`\\not\\ni `,`∌`),Z.sub=Z.subset=q($,`\\subset `,`⊂`),Z.sup=Z.supset=Z.superset=q($,`\\supset `,`⊃`),Z.nsub=Z.notsub=Z.nsubset=Z.notsubset=ZH[`\\not\\subset`]=q($,`\\not\\subset `,`⊄`),Z.nsup=Z.notsup=Z.nsupset=Z.notsupset=Z.nsuperset=Z.notsuperset=ZH[`\\not\\supset`]=q($,`\\not\\supset `,`⊅`),Z.sube=Z.subeq=Z.subsete=Z.subseteq=q($,`\\subseteq `,`⊆`),Z.supe=Z.supeq=Z.supsete=Z.supseteq=Z.supersete=Z.superseteq=q($,`\\supseteq `,`⊇`),Z.nsube=Z.nsubeq=Z.notsube=Z.notsubeq=Z.nsubsete=Z.nsubseteq=Z.notsubsete=Z.notsubseteq=ZH[`\\not\\subseteq`]=q($,`\\not\\subseteq `,`⊈`),Z.nsupe=Z.nsupeq=Z.notsupe=Z.notsupeq=Z.nsupsete=Z.nsupseteq=Z.notsupsete=Z.notsupseteq=Z.nsupersete=Z.nsuperseteq=Z.notsupersete=Z.notsuperseteq=ZH[`\\not\\supseteq`]=q($,`\\not\\supseteq `,`⊉`),Z.N=Z.naturals=Z.Naturals=q(Q,`\\mathbb{N}`,`ℕ`),Z.P=Z.primes=Z.Primes=Z.projective=Z.Projective=Z.probability=Z.Probability=q(Q,`\\mathbb{P}`,`ℙ`),Z.Z=Z.integers=Z.Integers=q(Q,`\\mathbb{Z}`,`ℤ`),Z.Q=Z.rationals=Z.Rationals=q(Q,`\\mathbb{Q}`,`ℚ`),Z.R=Z.reals=Z.Reals=q(Q,`\\mathbb{R}`,`ℝ`),Z.C=Z.complex=Z.Complex=Z.complexes=Z.Complexes=Z.complexplane=Z.Complexplane=Z.ComplexPlane=q(Q,`\\mathbb{C}`,`ℂ`),Z.H=Z.Hamiltonian=Z.quaternions=Z.Quaternions=q(Q,`\\mathbb{H}`,`ℍ`),Z.quad=Z.emsp=q(Q,`\\quad `,` `),Z.qquad=q(Q,`\\qquad `,` `),Z.diamond=q(Q,`\\diamond `,`◇`),Z.bigtriangleup=q(Q,`\\bigtriangleup `,`△`),Z.ominus=q(Q,`\\ominus `,`⊖`),Z.uplus=q(Q,`\\uplus `,`⊎`),Z.bigtriangledown=q(Q,`\\bigtriangledown `,`▽`),Z.sqcap=q(Q,`\\sqcap `,`⊓`),Z.triangleleft=q(Q,`\\triangleleft `,`⊲`),Z.sqcup=q(Q,`\\sqcup `,`⊔`),Z.triangleright=q(Q,`\\triangleright `,`⊳`),Z.odot=Z.circledot=q(Q,`\\odot `,`⊙`),Z.bigcirc=q(Q,`\\bigcirc `,`◯`),Z.dagger=q(Q,`\\dagger `,`†`),Z.ddagger=q(Q,`\\ddagger `,`‡`),Z.wr=q(Q,`\\wr `,`≀`),Z.amalg=q(Q,`\\amalg `,`∐`),Z.models=q(Q,`\\models `,`⊨`),Z.prec=q(Q,`\\prec `,`≺`),Z.succ=q(Q,`\\succ `,`≻`),Z.preceq=q(Q,`\\preceq `,`≼`),Z.succeq=q(Q,`\\succeq `,`≽`),Z.simeq=q(Q,`\\simeq `,`≃`),Z.mid=q(Q,`\\mid `,`∣`),Z.ll=q(Q,`\\ll `,`≪`),Z.gg=q(Q,`\\gg `,`≫`),Z.parallel=q(Q,`\\parallel `,`∥`),Z.nparallel=q(Q,`\\nparallel `,`∦`),Z.bowtie=q(Q,`\\bowtie `,`⋈`),Z.sqsubset=q(Q,`\\sqsubset `,`⊏`),Z.sqsupset=q(Q,`\\sqsupset `,`⊐`),Z.smile=q(Q,`\\smile `,`⌣`),Z.sqsubseteq=q(Q,`\\sqsubseteq `,`⊑`),Z.sqsupseteq=q(Q,`\\sqsupseteq `,`⊒`),Z.doteq=q(Q,`\\doteq `,`≐`),Z.frown=q(Q,`\\frown `,`⌢`),Z.vdash=q(Q,`\\vdash `,`⊦`),Z.dashv=q(Q,`\\dashv `,`⊣`),Z.nless=q(Q,`\\nless `,`≮`),Z.ngtr=q(Q,`\\ngtr `,`≯`),Z.longleftarrow=q(Q,`\\longleftarrow `,`←`),Z.longrightarrow=q(Q,`\\longrightarrow `,`→`),Z.Longleftarrow=q(Q,`\\Longleftarrow `,`⇐`),Z.Longrightarrow=q(Q,`\\Longrightarrow `,`⇒`),Z.longleftrightarrow=q(Q,`\\longleftrightarrow `,`↔`),Z.updownarrow=q(Q,`\\updownarrow `,`↕`),Z.Longleftrightarrow=q(Q,`\\Longleftrightarrow `,`⇔`),Z.Updownarrow=q(Q,`\\Updownarrow `,`⇕`),Z.mapsto=q(Q,`\\mapsto `,`↦`),Z.nearrow=q(Q,`\\nearrow `,`↗`),Z.hookleftarrow=q(Q,`\\hookleftarrow `,`↩`),Z.hookrightarrow=q(Q,`\\hookrightarrow `,`↪`),Z.searrow=q(Q,`\\searrow `,`↘`),Z.leftharpoonup=q(Q,`\\leftharpoonup `,`↼`),Z.rightharpoonup=q(Q,`\\rightharpoonup `,`⇀`),Z.swarrow=q(Q,`\\swarrow `,`↙`),Z.leftharpoondown=q(Q,`\\leftharpoondown `,`↽`),Z.rightharpoondown=q(Q,`\\rightharpoondown `,`⇁`),Z.nwarrow=q(Q,`\\nwarrow `,`↖`),Z.ldots=q(Q,`\\ldots `,`…`),Z.cdots=q(Q,`\\cdots `,`⋯`),Z.vdots=q(Q,`\\vdots `,`⋮`),Z.ddots=q(Q,`\\ddots `,`⋱`),Z.surd=q(Q,`\\surd `,`√`),Z.triangle=q(Q,`\\triangle `,`△`),Z.ell=q(Q,`\\ell `,`ℓ`),Z.top=q(Q,`\\top `,`⊤`),Z.flat=q(Q,`\\flat `,`♭`),Z.natural=q(Q,`\\natural `,`♮`),Z.sharp=q(Q,`\\sharp `,`♯`),Z.wp=q(Q,`\\wp `,`℘`),Z.bot=q(Q,`\\bot `,`⊥`),Z.clubsuit=q(Q,`\\clubsuit `,`♣`),Z.diamondsuit=q(Q,`\\diamondsuit `,`♢`),Z.heartsuit=q(Q,`\\heartsuit `,`♡`),Z.spadesuit=q(Q,`\\spadesuit `,`♠`),Z.circledot=q(Q,`\\circledot `,`⊙`),Z.middot=q(Q,`\\middot `,`·`),Z.dottedsquare=q(Q,`\\dottedsquare `,`⬚`),Z.square=q(Q,`\\square `,`⬜`),Z.rectangle=q(Q,`\\rectangle `,`▯`),Z.oint=q(Q,`\\oint `,`∮`),Z.bigcap=q(Q,`\\bigcap `,`∩`),Z.bigcup=q(Q,`\\bigcup `,`∪`),Z.bigsqcup=q(Q,`\\bigsqcup `,`⊔`),Z.bigvee=q(Q,`\\bigvee `,`∨`),Z.bigwedge=q(Q,`\\bigwedge `,`∧`),Z.bigodot=q(Q,`\\bigodot `,`⊙`),Z.bigotimes=q(Q,`\\bigotimes `,`⊗`),Z.bigoplus=q(Q,`\\bigoplus `,`⊕`),Z.biguplus=q(Q,`\\biguplus `,`⊎`),Z.lfloor=q(Q,`\\lfloor `,`⌊`),Z.rfloor=q(Q,`\\rfloor `,`⌋`),Z.lceil=q(Q,`\\lceil `,`⌈`),Z.rceil=q(Q,`\\rceil `,`⌉`),Z.opencurlybrace=Z.lbrace=q(Q,`\\lbrace `,`{`),Z.closecurlybrace=Z.rbrace=q(Q,`\\rbrace `,`}`),Z.lbrack=q(Q,`[`),Z.rbrack=q(Q,`]`),Z.mug=q(Q,`\\mug `,`µg`),Z.mus=q(Q,`\\mus `,`µs`),Z.mum=q(Q,`\\mum `,`µm`),Z.muL=q(Q,`\\muL `,`µL`),Z.slash=q(Q,`/`),Z.vert=q(Q,`|`),Z.perp=Z.perpendicular=q(Q,`\\perp `,`⊥`),Z.nabla=Z.del=q(Q,`\\nabla `,`∇`),Z.hbar=q(Q,`\\hbar `,`ℏ`),Z.AA=Z.Angstrom=Z.angstrom=q(Q,`\\text\\AA `,`Å`),Z.ring=Z.circ=Z.circle=q(Q,`\\circ `,`∘`),Z.bull=Z.bullet=q(Q,`\\bullet `,`•`),Z.setminus=Z.smallsetminus=q(Q,`\\setminus `,`∖`),Z.not=Z[`¬`]=Z.neg=q(Q,`\\neg `,`¬`),Z[`…`]=Z.dots=Z.ellip=Z.hellip=Z.ellipsis=Z.hellipsis=q(Q,`\\dots `,`…`),Z.converges=Z.darr=Z.dnarr=Z.dnarrow=Z.downarrow=q(Q,`\\downarrow `,`↓`),Z.dArr=Z.dnArr=Z.dnArrow=Z.Downarrow=q(Q,`\\Downarrow `,`⇓`),Z.diverges=Z.uarr=Z.uparrow=q(Q,`\\uparrow `,`↑`),Z.uArr=Z.Uparrow=q(Q,`\\Uparrow `,`⇑`),Z.to=q($,`\\to `,`→`),Z.rarr=Z.rightarrow=q(Q,`\\rightarrow `,`→`),Z.implies=q($,`\\Rightarrow `,`⇒`),Z.rArr=Z.Rightarrow=q(Q,`\\Rightarrow `,`⇒`),Z.gets=q($,`\\gets `,`←`),Z.larr=Z.leftarrow=q(Q,`\\leftarrow `,`←`),Z.impliedby=q($,`\\Leftarrow `,`⇐`),Z.lArr=Z.Leftarrow=q(Q,`\\Leftarrow `,`⇐`),Z.harr=Z.lrarr=Z.leftrightarrow=q(Q,`\\leftrightarrow `,`↔`),Z.iff=q($,`\\Leftrightarrow `,`⇔`),Z.hArr=Z.lrArr=Z.Leftrightarrow=q(Q,`\\Leftrightarrow `,`⇔`),Z.Re=Z.Real=Z.real=q(Q,`\\Re `,`ℜ`),Z.Im=Z.imag=Z.image=Z.imagin=Z.imaginary=Z.Imaginary=q(Q,`\\Im `,`ℑ`),Z.part=Z.partial=q(Q,`\\partial `,`∂`),Z.infty=Z.infin=Z.infinity=q(Q,`\\infty `,`∞`),Z.pounds=q(Q,`\\pounds `,`£`),Z.alef=Z.alefsym=Z.aleph=Z.alephsym=q(Q,`\\aleph `,`ℵ`),Z.xist=Z.xists=Z.exist=Z.exists=q(Q,`\\exists `,`∃`),Z.nexists=Z.nexist=q(Q,`\\nexists `,`∄`),Z.and=Z.land=Z.wedge=q($,`\\wedge `,`∧`),Z.or=Z.lor=Z.vee=q($,`\\vee `,`∨`),Z.o=Z.O=Z.empty=Z.emptyset=Z.oslash=Z.Oslash=Z.nothing=Z.varnothing=q($,`\\varnothing `,`∅`),Z.cup=Z.union=q($,`\\cup `,`∪`),Z.cap=Z.intersect=Z.intersection=q($,`\\cap `,`∩`),Z.deg=Z.degree=q(Q,`\\degree `,`°`),Z.ang=Z.angle=q(Q,`\\angle `,`∠`),Z.measuredangle=q(Q,`\\measuredangle `,`m∠`);var DU=J(Q,function(e,t){e.createLeftOf=function(e){e.options.autoSubscriptNumerals&&e.parent!==e.parent.parent.sub&&(e[Y]instanceof OU&&e[Y].isItalic!==!1||e[Y]instanceof rW&&e[Y][Y]instanceof OU&&e[Y][Y].isItalic!==!1)?(Z._().createLeftOf(e),t.createLeftOf.call(this,e),e.insRightOf(e.parent.parent)):t.createLeftOf.call(this,e)}}),OU=J(yU,function(e,t){e.init=function(e,n){t.init.call(this,e,`<var>`+(n||e)+`</var>`)},e.text=function(){var e=this.ctrlSeq;return this.isPartOfOperator?e[0]==`\\`?e=e.slice(1,e.length):e[e.length-1]==` `&&(e=e.slice(0,-1)):(this[Y]&&!(this[Y]instanceof OU)&&!(this[Y]instanceof $)&&this[Y].ctrlSeq!==`\\ `&&(e=`*`+e),this[X]&&!(this[X]instanceof $)&&!(this[X]instanceof rW)&&(e+=`*`)),e}});nU.p.autoCommands={_maxLength:0},rU.autoCommands=function(e){if(!/^[a-z]+(?: [a-z]+)*$/i.test(e))throw`"`+e+`" not a space-delimited list of only letters`;for(var t=e.split(` `),n={},r=0,i=0;i<t.length;i+=1){var a=t[i];if(a.length<2)throw`autocommand "`+a+`" not minimum length of 2`;if(Z[a]===NU)throw`"`+a+`" is a built-in operator name`;n[a]=1,r=RH(r,a.length)}return n._maxLength=r,n};var kU=J(OU,function(e,t){e.init=function(e){return t.init.call(this,this.letter=e)},e.createLeftOf=function(e){t.createLeftOf.apply(this,arguments);var n=e.options.autoCommands,r=n._maxLength;if(r>0){for(var i=``,a=this,o=0;a instanceof kU&&a.ctrlSeq===a.letter&&o<r;)i=a.letter+i,a=a[Y],o+=1;for(;i.length;){if(n.hasOwnProperty(i)){for(var o=1,a=this;o<i.length;o+=1,a=a[Y]);return YH(a,this).remove(),e[Y]=a[Y],Z[i](i).createLeftOf(e)}i=i.slice(1)}}},e.italicize=function(e){return this.isItalic=e,this.isPartOfOperator=!e,this.jQ.toggleClass(`mq-operator-name`,!e),this},e.finalizeTree=e.siblingDeleted=e.siblingCreated=function(e,t){t!==Y&&this[X]instanceof kU||this.autoUnItalicize(e)},e.autoUnItalicize=function(e){var t=e.autoOperatorNames;if(t._maxLength!==0){for(var r=this.letter,i=this[Y];i instanceof kU;i=i[Y])r=i.letter+r;for(var a=this[X];a instanceof kU;a=a[X])r+=a.letter;YH(i[X]||this.parent.ends[Y],a[Y]||this.parent.ends[X]).each(function(e){e.italicize(!0).jQ.removeClass(`mq-first mq-last mq-followed-by-supsub`),e.ctrlSeq=e.letter});outer:for(var o=0,s=i[X]||this.parent.ends[Y];o<r.length;o+=1,s=s[X])for(var c=LH(t._maxLength,r.length-o);c>0;--c){var l=r.slice(o,o+c);if(t.hasOwnProperty(l)){for(var u=0,d=s;u<c;u+=1,d=d[X]){d.italicize(!1);var f=d}var p=AU.hasOwnProperty(l);if(s.ctrlSeq=(p?`\\`:`\\operatorname{`)+s.ctrlSeq,f.ctrlSeq+=p?` `:`}`,MU.hasOwnProperty(l)&&f[Y][Y][Y].jQ.addClass(`mq-last`),n(s[Y])||s.jQ.addClass(`mq-first`),!n(f[X]))if(f[X]instanceof rW){var m=f[X];(m.siblingCreated=m.siblingDeleted=function(){m.jQ.toggleClass(`mq-after-operator-name`,!(m[X]instanceof fW))})()}else f.jQ.toggleClass(`mq-last`,!(f[X]instanceof fW));o+=c-1,s=f;continue outer}}}};function n(e){return!e||e instanceof $||e instanceof oW}}),AU={},jU=nU.p.autoOperatorNames={_maxLength:9},MU={limsup:1,liminf:1,projlim:1,injlim:1};(function(){for(var e=`arg deg det dim exp gcd hom inf ker lg ln log max min sup limsup liminf injlim projlim Pr`.split(` `),t=0;t<e.length;t+=1)AU[e[t]]=jU[e[t]]=1;for(var n=`sin cos tan arcsin arccos arctan sinh cosh tanh sec csc cot coth`.split(` `),t=0;t<n.length;t+=1)AU[n[t]]=1;for(var r=`sin cos tan sec cosec csc cotan cot ctg`.split(` `),t=0;t<r.length;t+=1)jU[r[t]]=jU[`arc`+r[t]]=jU[r[t]+`h`]=jU[`ar`+r[t]+`h`]=jU[`arc`+r[t]+`h`]=1;for(var i=`gcf hcf lcm proj span`.split(` `),t=0;t<i.length;t+=1)jU[i[t]]=1})(),rU.autoOperatorNames=function(e){if(!/^[a-z]+(?: [a-z]+)*$/i.test(e))throw`"`+e+`" not a space-delimited list of only letters`;for(var t=e.split(` `),n={},r=0,i=0;i<t.length;i+=1){var a=t[i];if(a.length<2)throw`"`+a+`" not minimum length of 2`;n[a]=1,r=RH(r,a.length)}return n._maxLength=r,n};var NU=J(yU,function(e,t){e.init=function(e){this.ctrlSeq=e},e.createLeftOf=function(e){for(var t=this.ctrlSeq,n=0;n<t.length;n+=1)kU(t.charAt(n)).createLeftOf(e)},e.parser=function(){for(var e=this.ctrlSeq,t=bU(),n=0;n<e.length;n+=1)kU(e.charAt(n)).adopt(t,t.ends[X],0);return pU.succeed(t.children())}});for(var PU in jU)jU.hasOwnProperty(PU)&&(Z[PU]=NU);Z.operatorname=J(vU,function(e){e.createLeftOf=zH,e.numBlocks=function(){return 1},e.parser=function(){return gU.block.map(function(e){return e.children()})}}),Z.f=J(kU,function(e,t){e.init=function(){yU.p.init.call(this,this.letter=`f`,`<var class="mq-f">f</var>`)},e.italicize=function(e){return this.jQ.html(`f`).toggleClass(`mq-f`,e),t.italicize.apply(this,arguments)}}),Z[` `]=Z.space=q(Q,`\\ `,` `),Z[`'`]=Z.prime=q(Q,`'`,`′`),Z[`″`]=Z.dprime=q(Q,`″`,`″`),Z[`"`]=Z.doublePrime=q(Q,`"`,`″`),Z.backslash=q(Q,`\\backslash `,`\\`),XH[`\\`]||=Z.backslash,Z.$=q(Q,`\\$`,`$`);var FU=J(yU,function(e,t){e.init=function(e,n){t.init.call(this,e,`<span class="mq-nonSymbola">`+(n||e)+`</span>`)}});Z[`@`]=FU,Z[`&`]=q(FU,`\\&`,`&`),Z[`%`]=q(FU,`\\%`,`%`),Z.alpha=Z.beta=Z.gamma=Z.delta=Z.zeta=Z.eta=Z.theta=Z.iota=Z.kappa=Z.mu=Z.nu=Z.xi=Z.rho=Z.sigma=Z.tau=Z.chi=Z.psi=Z.omega=J(OU,function(e,t){e.init=function(e){t.init.call(this,`\\`+e+` `,`&`+e+`;`)}}),Z.phi=q(OU,`\\phi `,`ϕ`),Z.phiv=Z.varphi=q(OU,`\\varphi `,`φ`),Z.epsilon=q(OU,`\\epsilon `,`ϵ`),Z.epsiv=Z.varepsilon=q(OU,`\\varepsilon `,`ε`),Z.piv=Z.varpi=q(OU,`\\varpi `,`ϖ`),Z.sigmaf=Z.sigmav=Z.varsigma=q(OU,`\\varsigma `,`ς`),Z.thetav=Z.vartheta=Z.thetasym=q(OU,`\\vartheta `,`ϑ`),Z.upsilon=Z.upsi=q(OU,`\\upsilon `,`υ`),Z.gammad=Z.Gammad=Z.digamma=q(OU,`\\digamma `,`ϝ`),Z.kappav=Z.varkappa=q(OU,`\\varkappa `,`ϰ`),Z.rhov=Z.varrho=q(OU,`\\varrho `,`ϱ`),Z.pi=Z.π=q(FU,`\\pi `,`π`),Z.lambda=q(FU,`\\lambda `,`λ`),Z.Upsilon=Z.Upsi=Z.upsih=Z.Upsih=q(yU,`\\Upsilon `,`<var style="font-family: serif">ϒ</var>`),Z.Gamma=Z.Delta=Z.Theta=Z.Lambda=Z.Xi=Z.Pi=Z.Sigma=Z.Phi=Z.Psi=Z.Omega=J(Q,function(e,t){e.init=function(e){t.init.call(this,`\\`+e+` `,`&`+e+`;`)}}),Z.forall=Z[`∀`]=q(Q,`\\forall `,`∀`);var IU=J(vU,function(e){e.init=function(e){this.latex=e},e.createLeftOf=function(e){var t=gU.parse(this.latex);t.children().adopt(e.parent,e[Y],e[X]),e[Y]=t.ends[X],t.jQize().insertBefore(e.jQ),t.finalizeInsert(e.options,e),t.ends[X][X].siblingCreated&&t.ends[X][X].siblingCreated(e.options,Y),t.ends[Y][Y].siblingCreated&&t.ends[Y][Y].siblingCreated(e.options,X),e.parent.bubble(`reflow`)},e.parser=function(){var e=gU.parse(this.latex).children();return pU.succeed(e)}});Z[`¹`]=q(IU,`^1`),Z[`²`]=q(IU,`^2`),Z[`³`]=q(IU,`^3`),Z[`¼`]=q(IU,`\\frac14`),Z[`½`]=q(IU,`\\frac12`),Z[`¾`]=q(IU,`\\frac34`);var LU=J($,function(e){e.init=Q.prototype.init,e.contactWeld=e.siblingCreated=e.siblingDeleted=function(e,t){function n(e){if(e[Y]){if(e[Y]instanceof $||/^[,;:\(\[]$/.test(e[Y].ctrlSeq))return``}else if(e.parent&&e.parent.parent&&e.parent.parent.isStyleBlock())return n(e.parent.parent);else return``;return`mq-binary-operator`}if(t!==X)return this.jQ[0].className=n(this),this}});Z[`+`]=q(LU,`+`,`+`),Z[`–`]=Z[`-`]=q(LU,`-`,`−`),Z[`±`]=Z.pm=Z.plusmn=Z.plusminus=q(LU,`\\pm `,`±`),Z.mp=Z.mnplus=Z.minusplus=q(LU,`\\mp `,`∓`),XH[`*`]=Z.sdot=Z.cdot=q($,`\\cdot `,`·`,`*`);var RU=J($,function(e,t){e.init=function(e,n){this.data=e,this.strict=n;var r=n?`Strict`:``;t.init.call(this,e[`ctrlSeq`+r],e[`html`+r],e[`text`+r])},e.swap=function(e){this.strict=e;var t=e?`Strict`:``;this.ctrlSeq=this.data[`ctrlSeq`+t],this.jQ.html(this.data[`html`+t]),this.textTemplate=[this.data[`text`+t]]},e.deleteTowards=function(e,n){if(e===Y&&!this.strict){this.swap(!0),this.bubble(`reflow`);return}t.deleteTowards.apply(this,arguments)}}),zU={ctrlSeq:`\\le `,html:`≤`,text:`≤`,ctrlSeqStrict:`<`,htmlStrict:`<`,textStrict:`<`},BU={ctrlSeq:`\\ge `,html:`≥`,text:`≥`,ctrlSeqStrict:`>`,htmlStrict:`>`,textStrict:`>`};Z[`<`]=Z.lt=q(RU,zU,!0),Z[`>`]=Z.gt=q(RU,BU,!0),Z[`≤`]=Z.le=Z.leq=q(RU,zU,!1),Z[`≥`]=Z.ge=Z.geq=q(RU,BU,!1);var VU=J($,function(e,t){e.init=function(){t.init.call(this,`=`,`=`)},e.createLeftOf=function(e){if(e[Y]instanceof RU&&e[Y].strict){e[Y].swap(!1),e[Y].bubble(`reflow`);return}t.createLeftOf.apply(this,arguments)}});Z[`=`]=VU,Z[`×`]=Z.times=q($,`\\times `,`×`,`[x]`),Z[`÷`]=Z.div=Z.divide=Z.divides=q($,`\\div `,`÷`,`[/]`),XH[`~`]=Z.sim=q($,`\\sim `,`~`,`~`),XH[`≁`]=Z.nsim=q($,`\\nsim `,`≁`,`≁`),Z.complement=Z[`∁`]=q(Q,`\\complement `,`∁`),Z.nexists=Z[`∄`]=q(Q,`\\nexists `,`∄`),Z.sphericalangle=Z[`∢`]=q(Q,`\\sphericalangle `,`∢`),Z.iint=Z[`∬`]=q(Q,`\\iint `,`∬`),Z.iiint=Z[`∭`]=q(Q,`\\iiint `,`∭`),Z.oiint=Z[`∯`]=q(Q,`\\oiint `,`∯`),Z.oiiint=Z[`∰`]=q(Q,`\\oiiint `,`∰`),Z.backsim=Z[`∽`]=q(Q,`\\backsim `,`∽`),Z.backsimeq=Z[`⋍`]=q(Q,`\\backsimeq `,`⋍`),Z.eqsim=Z[`≂`]=q(Q,`\\eqsim `,`≂`),Z.ncong=Z[`≇`]=q(Q,`\\ncong `,`≇`),Z.approxeq=Z[`≊`]=q(Q,`\\approxeq `,`≊`),Z.bumpeq=Z[`≏`]=q(Q,`\\bumpeq `,`≏`),Z.Bumpeq=Z[`≎`]=q(Q,`\\Bumpeq `,`≎`),Z.doteqdot=Z[`≑`]=q(Q,`\\doteqdot `,`≑`),Z.fallingdotseq=Z[`≒`]=q(Q,`\\fallingdotseq `,`≒`),Z.risingdotseq=Z[`≓`]=q(Q,`\\risingdotseq `,`≓`),Z.eqcirc=Z[`≖`]=q(Q,`\\eqcirc `,`≖`),Z.circeq=Z[`≗`]=q(Q,`\\circeq `,`≗`),Z.triangleq=Z[`≜`]=q(Q,`\\triangleq `,`≜`),Z.leqq=Z[`≦`]=q(Q,`\\leqq `,`≦`),Z.geqq=Z[`≧`]=q(Q,`\\geqq `,`≧`),Z.lneqq=Z[`≨`]=q(Q,`\\lneqq `,`≨`),Z.gneqq=Z[`≩`]=q(Q,`\\gneqq `,`≩`),Z.between=Z[`≬`]=q(Q,`\\between `,`≬`),Z.nleq=Z[`≰`]=q(Q,`\\nleq `,`≰`),Z.ngeq=Z[`≱`]=q(Q,`\\ngeq `,`≱`),Z.lesssim=Z[`≲`]=q(Q,`\\lesssim `,`≲`),Z.gtrsim=Z[`≳`]=q(Q,`\\gtrsim `,`≳`),Z.lessgtr=Z[`≶`]=q(Q,`\\lessgtr `,`≶`),Z.gtrless=Z[`≷`]=q(Q,`\\gtrless `,`≷`),Z.preccurlyeq=Z[`≼`]=q(Q,`\\preccurlyeq `,`≼`),Z.succcurlyeq=Z[`≽`]=q(Q,`\\succcurlyeq `,`≽`),Z.precsim=Z[`≾`]=q(Q,`\\precsim `,`≾`),Z.succsim=Z[`≿`]=q(Q,`\\succsim `,`≿`),Z.nprec=Z[`⊀`]=q(Q,`\\nprec `,`⊀`),Z.nsucc=Z[`⊁`]=q(Q,`\\nsucc `,`⊁`),Z.subsetneq=Z[`⊊`]=q(Q,`\\subsetneq `,`⊊`),Z.supsetneq=Z[`⊋`]=q(Q,`\\supsetneq `,`⊋`),Z.vDash=Z[`⊨`]=q(Q,`\\vDash `,`⊨`),Z.Vdash=Z[`⊩`]=q(Q,`\\Vdash `,`⊩`),Z.Vvdash=Z[`⊪`]=q(Q,`\\Vvdash `,`⊪`),Z.VDash=Z[`⊫`]=q(Q,`\\VDash `,`⊫`),Z.nvdash=Z[`⊬`]=q(Q,`\\nvdash `,`⊬`),Z.nvDash=Z[`⊭`]=q(Q,`\\nvDash `,`⊭`),Z.nVdash=Z[`⊮`]=q(Q,`\\nVdash `,`⊮`),Z.nVDash=Z[`⊯`]=q(Q,`\\nVDash `,`⊯`),Z.vartriangleleft=Z[`⊲`]=q(Q,`\\vartriangleleft `,`⊲`),Z.vartriangleright=Z[`⊳`]=q(Q,`\\vartriangleright `,`⊳`),Z.trianglelefteq=Z[`⊴`]=q(Q,`\\trianglelefteq `,`⊴`),Z.trianglerighteq=Z[`⊵`]=q(Q,`\\trianglerighteq `,`⊵`),Z.multimap=Z[`⊸`]=q(Q,`\\multimap `,`⊸`),Z.Subset=Z[`⋐`]=q(Q,`\\Subset `,`⋐`),Z.Supset=Z[`⋑`]=q(Q,`\\Supset `,`⋑`),Z.Cap=Z[`⋒`]=q(Q,`\\Cap `,`⋒`),Z.Cup=Z[`⋓`]=q(Q,`\\Cup `,`⋓`),Z.pitchfork=Z[`⋔`]=q(Q,`\\pitchfork `,`⋔`),Z.lessdot=Z[`⋖`]=q(Q,`\\lessdot `,`⋖`),Z.gtrdot=Z[`⋗`]=q(Q,`\\gtrdot `,`⋗`),Z.lll=Z[`⋘`]=q(Q,`\\lll `,`⋘`),Z.ggg=Z[`⋙`]=q(Q,`\\ggg `,`⋙`),Z.lesseqgtr=Z[`⋚`]=q(Q,`\\lesseqgtr `,`⋚`),Z.gtreqless=Z[`⋛`]=q(Q,`\\gtreqless `,`⋛`),Z.curlyeqprec=Z[`⋞`]=q(Q,`\\curlyeqprec `,`⋞`),Z.curlyeqsucc=Z[`⋟`]=q(Q,`\\curlyeqsucc `,`⋟`),Z.nsim=Z[`≁`]=q(Q,`\\nsim `,`≁`),Z.lnsim=Z[`⋦`]=q(Q,`\\lnsim `,`⋦`),Z.gnsim=Z[`⋧`]=q(Q,`\\gnsim `,`⋧`),Z.precnsim=Z[`⋨`]=q(Q,`\\precnsim `,`⋨`),Z.succnsim=Z[`⋩`]=q(Q,`\\succnsim `,`⋩`),Z.ntriangleleft=Z[`⋪`]=q(Q,`\\ntriangleleft `,`⋪`),Z.ntriangleright=Z[`⋫`]=q(Q,`\\ntriangleright `,`⋫`),Z.ntrianglelefteq=Z[`⋬`]=q(Q,`\\ntrianglelefteq `,`⋬`),Z.ntrianglerighteq=Z[`⋭`]=q(Q,`\\ntrianglerighteq `,`⋭`),Z.blacksquare=Z[`∎`]=q(Q,`\\blacksquare `,`∎`),Z.colon=Z[`∶`]=q(Q,`\\colon `,`∶`),Z.llcorner=Z[`∟`]=q(Q,`\\llcorner `,`∟`),Z.dotplus=Z[`∔`]=q($,`\\dotplus `,`∔`),Z.nmid=Z[`∤`]=q($,`
|
|
303
|
+
mid `,`∤`),Z.intercal=Z[`⊺`]=q($,`\\intercal `,`⊺`),Z.veebar=Z[`⊻`]=q($,`\\veebar `,`⊻`),Z.barwedge=Z[`⊼`]=q($,`\\barwedge `,`⊼`),Z.ltimes=Z[`⋉`]=q($,`\\ltimes `,`⋉`),Z.rtimes=Z[`⋊`]=q($,`\\rtimes `,`⋊`),Z.leftthreetimes=Z[`⋋`]=q($,`\\leftthreetimes `,`⋋`),Z.rightthreetimes=Z[`⋌`]=q($,`\\rightthreetimes `,`⋌`),Z.curlyvee=Z[`⋎`]=q($,`\\curlyvee `,`⋎`),Z.curlywedge=Z[`⋏`]=q($,`\\curlywedge `,`⋏`),Z.circledcirc=Z[`⊚`]=q($,`\\circledcirc `,`⊚`),Z.circledast=Z[`⊛`]=q($,`\\circledast `,`⊛`),Z.circleddash=Z[`⊝`]=q($,`\\circleddash `,`⊝`),Z.boxplus=Z[`⊞`]=q($,`\\boxplus `,`⊞`),Z.boxminus=Z[`⊟`]=q($,`\\boxminus `,`⊟`),Z.boxtimes=Z[`⊠`]=q($,`\\boxtimes `,`⊠`),Z.boxdot=Z[`⊡`]=q($,`\\boxdot `,`⊡`),Z[`∂`]=Z.partial,Z[`∃`]=Z.exists,Z[`∅`]=Z.varnothing,Z[`∆`]=Z.triangle,Z[`∇`]=Z.nabla,Z[`∈`]=Z.in,Z[`∊`]=Z.in,Z[`∋`]=Z.ni,Z[`∌`]=Z.notni,Z[`∍`]=Z.ni,Z[`∐`]=Z.amalg,Z[`−`]=Z[`-`],Z[`∓`]=Z.mp,Z[`∖`]=Z.setminus,Z[`∘`]=Z.circ,Z[`∙`]=Z.bullet,Z[`∝`]=Z.propto,Z[`∞`]=Z.infty,Z[`∠`]=Z.angle,Z[`∡`]=Z.measuredangle,Z[`∣`]=Z.divides,Z[`∥`]=Z.parallel,Z[`∦`]=Z.nparallel,Z[`∧`]=Z.wedge,Z[`∨`]=Z.vee,Z[`∩`]=Z.cap,Z[`∪`]=Z.cup,Z[`∮`]=Z.oint,Z[`∴`]=Z.therefore,Z[`∵`]=Z.because,Z[`∼`]=Z.sim,Z[`≀`]=Z.wr,Z[`≃`]=Z.simeq,Z[`≍`]=Z.asymp,Z[`≐`]=Z.doteq,Z[`≪`]=Z.ll,Z[`≫`]=Z.gg,Z[`≺`]=Z.prec,Z[`≻`]=Z.succ,Z[`⊂`]=Z.subset,Z[`⊃`]=Z.supset,Z[`⊆`]=Z.subseteq,Z[`⊇`]=Z.supseteq,Z[`⊈`]=Z.nsubseteq,Z[`⊉`]=Z.nsupseteq,Z[`⊏`]=Z.sqsubset,Z[`⊐`]=Z.sqsupset,Z[`⊓`]=Z.sqcap,Z[`⊔`]=Z.sqcup,Z[`⊖`]=Z.ominus,Z[`⊘`]=Z.oslash,Z[`⊙`]=Z.odot,Z[`⊢`]=Z.vdash,Z[`⊣`]=Z.dashv,Z[`⊤`]=Z.top,Z[`⊥`]=Z.bot,Z[`⊧`]=Z.models,Z[`⋀`]=Z.wedge,Z[`⋁`]=Z.vee,Z[`⋂`]=Z.cap,Z[`⋃`]=Z.cup,Z[`⋄`]=Z.diamond,Z[`⋅`]=Z.cdot,Z[`⋆`]=Z.star,Z[`⋈`]=Z.bowtie,Z[`⋮`]=Z.vdots,Z[`⋯`]=Z.cdots,Z[`⋱`]=Z.ddots;var HU,UU=zH,WU=document.createElement(`div`).style,GU={transform:1,WebkitTransform:1,MozTransform:1,OTransform:1,msTransform:1},KU;for(var qU in GU)if(qU in WU){KU=qU;break}KU?HU=function(e,t,n){e.css(KU,`scale(`+t+`,`+n+`)`)}:`filter`in WU?(UU=function(e){e.className=e.className},HU=function(e,t,n){t/=1+(n-1)/2,e.css(`fontSize`,n+`em`),e.hasClass(`mq-matrixed-container`)||e.addClass(`mq-matrixed-container`).wrapInner(`<span class="mq-matrixed"></span>`);var r=e.children().css(`filter`,`progid:DXImageTransform.Microsoft.Matrix(M11=`+t+`,SizingMethod='auto expand')`);function i(){e.css(`marginRight`,(r.width()-1)*(t-1)/t+`px`)}i();var a=setInterval(i);MH(window).load(function(){clearTimeout(a),i()})}):HU=function(e,t,n){e.css(`fontSize`,n+`em`)};var JU=J(vU,function(e,t){e.init=function(e,n,r){t.init.call(this,e,`<`+n+` `+r+`>&0</`+n+`>`)}}),YU=J(vU,function(e,t){e.init=function(e,n,r){this.args=arguments,this.htmlTemplate=`<`+n+` `+r+`><`+n+` class="mq-xarrow-over">&0</`+n+`><`+n+` class="mq-xarrow-under"></`+n+`></`+n+`>`,t.init.call(this,e),this.textTemplate=[e.replace(`\\`,``)+`(`,`)`]},e.parser=function(){var e=this;return gU.optBlock.then(function(t){return gU.block.map(function(n){var r=XU.apply(null,e.args);return r.blocks=[t,n],t.adopt(r,0,0),n.adopt(r,t,0),r})}).or(t.parser.call(this))}}),XU=J(YU,function(e,t){e.init=function(e,t,n){this.htmlTemplate=`<`+t+` `+n+`><`+t+` class="mq-xarrow-over">&1</`+t+`><`+t+` class="mq-xarrow-under">&0</`+t+`></`+t+`>`,vU.prototype.init.call(this,e),this.textTemplate=[e.replace(`\\`,``)+`[`,`](`,`)`]},e.latex=function(){return this.ctrlSeq+`[`+this.ends[Y].latex()+`]{`+this.ends[X].latex()+`}`},e.finalizeTree=function(){this.downInto=this.ends[Y].upOutOf=this.ends[X],this.upInto=this.ends[X].downOutOf=this.ends[Y]}}),ZU=function(e){var t=`<span class="`+e+`-inner-right">g</span><span class="`+e+`-inner-left">h</span>`;return J(vU,function(n,r){n.init=function(n,i,a){r.init.call(this,n,`<`+i+` `+a+`><`+i+` class="`+e+`-inner">`+t+`<span class="mq-empty-box">&0</span></`+i+`></`+i+`>`)}})},QU=J(vU,function(e,t){e.init=function(e,n,r){t.init.call(this,e,`<`+n+` `+r+`><span class="mq-longdiv-curve-border">)</span><span class="mq-longdiv-inner"><span class="mq-empty">&0</span></`+n+`></span>`)}}),$U=J(vU,function(e,t){e.init=function(e,n,r){t.init.call(this,e,`<span class="mq-matrix"><span class="mq-paren mq-scaled">[</span><span class="matrix-edit-content-row"><p>`+r+`</p><table class="mq-non-leaf mq-rows-3"><tbody><tr><td class="mq-empty"></td><td class="mq-empty"></td><td class="mq-empty"></td></tr></tbody></table></span><span class="mq-paren mq-scaled">]</span></span>`)}}),eW=J(vU,function(e,t){e.init=function(e){t.init.call(this,e,`<span class="mq-non-leaf"><span class="mq-dot-recurring-inner"><span class="mq-dot-recurring">˙</span><span class="mq-empty-box">&0</span></span></span>`)}}),tW=J(vU,function(e,t){e.init=function(e,n,r){t.init.call(this,e,`<span class="mq-matrix"><span class="mq-paren mq-scaled">[</span><span class="matrix-edit-content-col"><p>`+r+`</p></span><span class="matrix-edit-content-col"><table class="mq-non-leaf mq-rows-3"><tbody><tr><td class="mq-empty"></td></tr><tr><td class="mq-empty"></td></tr><tr><td class="mq-empty"></td></tr></tbody></table></span><span class="mq-paren mq-scaled">]</span></span>`)}}),nW=function(e,t){return J(yU,function(n,r){n.init=function(n,i,a){r.init.call(this,n,`<`+i+` `+a+`><`+i+` class="`+e+`-inner">`+t+`</`+i+`></`+i+`>`)}})};Z.mathrm=q(JU,`\\mathrm`,`span`,`class="mq-roman mq-font"`),Z.mathit=q(JU,`\\mathit`,`i`,`class="mq-font"`),Z.mathbf=q(JU,`\\mathbf`,`b`,`class="mq-font"`),Z.mathsf=q(JU,`\\mathsf`,`span`,`class="mq-sans-serif mq-font"`),Z.mathtt=q(JU,`\\mathtt`,`span`,`class="mq-monospace mq-font"`),Z.underline=q(JU,`\\underline`,`span`,`class="mq-non-leaf mq-underline"`),Z.overline=Z.bar=q(ZU(`mq-overline`),`\\overline`,`span`,`class="mq-non-leaf mq-overline"`),Z.longdiv=q(QU,`\\longdiv`,`span`,`class="mq-non-leaf mq-longdiv"`),Z.overrightarrow=q(ZU(`mq-overarrow`),`\\overrightarrow`,`span`,`class="mq-non-leaf mq-overarrow mq-arrow-right"`),Z.overleftarrow=q(ZU(`mq-overarrow`),`\\overleftarrow`,`span`,`class="mq-non-leaf mq-overarrow mq-arrow-left"`),Z.xleftarrow=q(YU,`\\xleftarrow`,`span`,`class="mq-non-leaf mq-xarrow mq-arrow-left"`),Z.xrightarrow=q(YU,`\\xrightarrow`,`span`,`class="mq-non-leaf mq-xarrow mq-arrow-right"`),Z.overleftrightarrow=q(JU,`\\overleftrightarrow`,`span`,`class="mq-non-leaf mq-overarrow mq-arrow-both"`),Z.overarc=q(JU,`\\overarc`,`span`,`class="mq-non-leaf mq-overarc"`),Z.dot=J(vU,function(e,t){e.init=function(){t.init.call(this,`\\dot`,`<span class="mq-non-leaf"><span class="mq-dot-recurring-inner"><span class="mq-dot-recurring">˙</span><span class="mq-empty-box">&0</span></span></span>`)}}),Z.addmatrixrow=q($U,`\\addmatrixrow`,`span`,`+`),Z.addmatrixcol=q(tW,`\\addmatrixcol`,`span`,`+`),Z.ngtr=Z[`≯`]=q(nW(`mq-ngtr`,`≯`),`\\ngtr `,`span`,`class="mq-non-leaf mq-ngtr"`),Z.nless=Z[`≮`]=q(nW(`mq-nless`,`≮`),`\\nless `,`span`,`class="mq-non-leaf mq-nless"`),Z.dot=q(eW,`\\dot`),Z.parallelogram=q(nW(`mq-parallelogram`,`▱`),`\\parallelogram `,`span`,`class="mq-non-leaf mq-parallelogram"`),Z.textcolor=J(vU,function(e,t){e.setColor=function(e){this.color=e,this.htmlTemplate=`<span class="mq-textcolor" style="color:`+e+`">&0</span>`},e.latex=function(){return`\\textcolor{`+this.color+`}{`+this.blocks[0].latex()+`}`},e.parser=function(){var e=this,n=pU.optWhitespace,r=pU.string,i=pU.regex;return n.then(r(`{`)).then(i(/^[#\w\s.,()%-]*/)).skip(r(`}`)).then(function(n){return e.setColor(n),t.parser.call(e)})},e.isStyleBlock=function(){return!0}}),Z.class=J(vU,function(e,t){e.parser=function(){var e=this,n=pU.string,r=pU.regex;return pU.optWhitespace.then(n(`{`)).then(r(/^[-\w\s\\\xA0-\xFF]*/)).skip(n(`}`)).then(function(n){return e.cls=n||``,e.htmlTemplate=`<span class="mq-class `+n+`">&0</span>`,t.parser.call(e)})},e.latex=function(){return`\\class{`+this.cls+`}{`+this.blocks[0].latex()+`}`},e.isStyleBlock=function(){return!0}});var rW=J(vU,function(e,t){e.ctrlSeq=`_{...}^{...}`,e.createLeftOf=function(e){if(!(!this.replacedFragment&&!e[Y]&&e.options.supSubsRequireOperand))return t.createLeftOf.apply(this,arguments)},e.contactWeld=function(e){for(var t=Y;t;t=t===Y&&X)if(this[t]instanceof rW){for(var n=`sub`;n;n=n===`sub`&&`sup`){var r=this[n],i=this[t][n];if(r){if(!i)this[t].addBlock(r.disown());else if(r.isEmpty())var a=KH(i,0,i.ends[Y]);else{r.jQ.children().insAtDirEnd(-t,i.jQ);var o=r.children().disown(),a=KH(i,o.ends[X],i.ends[Y]);t===Y?o.adopt(i,i.ends[X],0):o.adopt(i,0,i.ends[Y])}this.placeCursor=function(e,n){return function(r){r.insAtDirEnd(-t,e||n)}}(i,r)}}this.remove(),e&&e[Y]===this&&(t===X&&a?a[Y]?e.insRightOf(a[Y]):e.insAtLeftEnd(a.parent):e.insRightOf(this[t]));break}},nU.p.charsThatBreakOutOfSupSub=``,e.finalizeTree=function(){this.ends[Y].write=function(e,t){if(e.options.autoSubscriptNumerals&&this===this.parent.sub){if(t===`_`)return;var n=this.chToCmd(t,e.options);return n instanceof yU?e.deleteSelection():e.clearSelection().insRightOf(this.parent),n.createLeftOf(e.show())}e[Y]&&!e[X]&&!e.selection&&e.options.charsThatBreakOutOfSupSub.indexOf(t)>-1&&e.insRightOf(this.parent),bU.p.write.apply(this,arguments)}},e.moveTowards=function(e,n,r){n.options.autoSubscriptNumerals&&!this.sup?n.insDirOf(e,this):t.moveTowards.apply(this,arguments)},e.deleteTowards=function(e,n){if(n.options.autoSubscriptNumerals&&this.sub){var r=this.sub.ends[-e];r instanceof yU?r.remove():r&&r.deleteTowards(e,n.insAtDirEnd(-e,this.sub)),this.sub.isEmpty()&&(this.sub.deleteOutOf(Y,n.insAtLeftEnd(this.sub)),this.sup&&n.insDirOf(-e,this))}else t.deleteTowards.apply(this,arguments)},e.latex=function(){function e(e,t){var n=t&&t.latex();return t?e+(n.length===1?n:`{`+(n||` `)+`}`):``}return e(`_`,this.sub)+e(`^`,this.sup)},e.addBlock=function(e){this.supsub===`sub`?(this.sup=this.upInto=this.sub.upOutOf=e,e.adopt(this,this.sub,0).downOutOf=this.sub,e.jQ=MH(`<span class="mq-sup"/>`).append(e.jQ.children()).attr(IH,e.id).prependTo(this.jQ)):(this.sub=this.downInto=this.sup.downOutOf=e,e.adopt(this,0,this.sup).upOutOf=this.sup,e.jQ=MH(`<span class="mq-sub"></span>`).append(e.jQ.children()).attr(IH,e.id).appendTo(this.jQ.removeClass(`mq-sup-only`)),this.jQ.append(`<span style="display:inline-block;width:0">​</span>`));for(var t=0;t<2;t+=1)(function(e,t,n,r){e[t].deleteOutOf=function(i,a){if(a.insDirOf(this[i]?-i:i,this.parent),!this.isEmpty()){var o=this.ends[i];this.children().disown().withDirAdopt(i,a.parent,a[i],a[-i]).jQ.insDirOf(-i,a.jQ),a[-i]=o}e.supsub=n,delete e[t],delete e[r+`Into`],e[n][r+`OutOf`]=iW,delete e[n].deleteOutOf,t===`sub`&&MH(e.jQ.addClass(`mq-sup-only`)[0].lastChild).remove(),this.remove()}})(this,`sub sup`.split(` `)[t],`sup sub`.split(` `)[t],`down up`.split(` `)[t])},e.reflow=function(){var e=this.jQ,t=e.prev();if(t.length){var n=e.children(`.mq-sup`);if(n.length){var r=parseInt(n.css(`font-size`)),i=n.offset().top+n.height()-t.offset().top-.7*r,a=parseInt(n.css(`margin-bottom`));n.css(`margin-bottom`,a+i)}}}});function iW(e){var t=this.parent,n=e;do{if(n[X])return e.insLeftOf(t);n=n.parent.parent}while(n!==t);e.insRightOf(t)}Z.subscript=Z._=J(rW,function(e,t){e.supsub=`sub`,e.htmlTemplate=`<span class="mq-supsub mq-non-leaf"><span class="mq-sub"><span class="mq-empty-box">&0</span></span><span style="display:inline-block;width:0">​</span></span>`,e.textTemplate=[`_`],e.finalizeTree=function(){this.downInto=this.sub=this.ends[Y],this.sub.upOutOf=iW,t.finalizeTree.call(this)}}),Z.superscript=Z.supscript=Z[`^`]=J(rW,function(e,t){e.supsub=`sup`,e.htmlTemplate=`<span class="mq-supsub mq-non-leaf mq-sup-only"><span class="mq-sup"><span class="mq-empty-box">&0</span></span></span>`,e.textTemplate=[`^`],e.finalizeTree=function(){this.upInto=this.sup=this.ends[X],this.sup.downOutOf=iW,t.finalizeTree.call(this)}});var aW=J(vU,function(e,t){e.parser=function(){for(var e=pU.string,t=pU.optWhitespace,n=pU.succeed,r=gU.block,i=this,a=i.blocks=[bU(),bU()],o=0;o<a.length;o+=1)a[o].adopt(i,i.ends[X],0);return t.then(e(`_`).or(e(`^`))).then(function(e){var t=a[e===`_`?0:1];return r.then(function(e){return e.children().adopt(t,t.ends[X],0),n(i)})}).many().result(i)},e.finalizeTree=function(){this.downInto=this.ends[Y],this.upInto=this.ends[X],this.ends[Y].upOutOf=this.ends[X],this.ends[X].downOutOf=this.ends[Y]}}),oW=J(aW,function(e,t){e.init=function(e,t){var n=`<span class="mq-large-operator mq-non-leaf"><span class="mq-to"><span>&1</span></span><big>`+t+`</big><span class="mq-from"><span>&0</span></span></span>`;yU.prototype.init.call(this,e,n)},e.latex=function(){function e(e){return e.length===1?e:`{`+(e||` `)+`}`}return this.ctrlSeq+`_`+e(this.ends[Y].latex())+`^`+e(this.ends[X].latex())},e.createLeftOf=function(e){t.createLeftOf.apply(this,arguments),e.options.sumStartsWithNEquals&&(kU(`n`).createLeftOf(e),VU().createLeftOf(e))}});Z[`∑`]=Z.sum=Z.summation=q(oW,`\\sum `,`∑`),Z[`∏`]=Z.prod=Z.product=q(oW,`\\prod `,`∏`),Z.coprod=Z.coproduct=q(oW,`\\coprod `,`∐`),Z[`∫`]=Z.int=Z.integral=J(oW,function(e,t){e.init=function(){yU.prototype.init.call(this,`\\int `,`<span class="mq-int mq-non-leaf"><big>∫</big><span class="mq-supsub mq-non-leaf"><span class="mq-sup"><span class="mq-sup-inner">&1</span></span><span class="mq-sub">&0</span><span style="display:inline-block;width:0">​</span></span></span>`)},e.createLeftOf=vU.p.createLeftOf}),Z.lim=Z.limit=J(aW,function(e,t){e.init=function(){yU.prototype.init.call(this,`\\lim `,`<span class="mq-lim mq-non-leaf"><span class="mq-un-italicized">lim</span><span class="mq-approaches"><span>&0</span></span></span>`)},e.latex=function(){function e(e){return e.length===1?e:`{`+(e||` `)+`}`}return this.ctrlSeq+`_`+e(this.ends[Y].latex())}});var sW=Z.over=XH[`/`]=J(Z.frac=Z.dfrac=Z.cfrac=Z.fraction=J(vU,function(e,t){e.ctrlSeq=`\\frac`,e.htmlTemplate=`<span class="mq-fraction mq-non-leaf"><span class="mq-numerator"><span class="mq-empty-box">&0</span></span><span class="mq-denominator"><span class="mq-empty-box">&1</span></span><span style="display:inline-block;width:0">​</span></span>`,e.textTemplate=[`(`,`)/(`,`)`],e.finalizeTree=function(){this.upInto=this.ends[X].upOutOf=this.ends[Y],this.downInto=this.ends[Y].downOutOf=this.ends[X]}}),function(e,t){e.createLeftOf=function(e){if(!this.replacedFragment){for(var n=e[Y];n&&!(n instanceof $||n instanceof(Z.text||zH)||n instanceof oW||n.ctrlSeq===`\\ `||/^[,;:]$/.test(n.ctrlSeq));)n=n[Y];n instanceof oW&&n[X]instanceof rW&&(n=n[X],n[X]instanceof rW&&n[X].ctrlSeq!=n.ctrlSeq&&(n=n[X])),n!==e[Y]&&!e.isTooDeep(1)&&(this.replaces(YH(n[X]||e.parent.ends[Y],e[Y])),e[Y]=n)}t.createLeftOf.call(this,e)}});Z.underset=J(vU,function(e,t){e.ctrlSeq=`\\underset`,e.htmlTemplate=`<span class="mq-underset mq-overunder mq-non-leaf"><span class="mq-over">&1</span><span class="mq-under">&0</span></span>`,e.textTemplate=[`[`,`|`,`]`],e.finalizeTree=function(){this.downInto=this.ends[Y].upOutOf=this.ends[X],this.upInto=this.ends[X].downOutOf=this.ends[Y]}}),Z.overset=J(vU,function(e,t){e.ctrlSeq=`\\overset`,e.htmlTemplate=`<span class="mq-overset mq-overunder mq-non-leaf"><span class="mq-over">&0</span><span class="mq-under">&1</span></span>`,e.textTemplate=[`[`,`|`,`]`],e.finalizeTree=function(){this.downInto=this.ends[X].upOutOf=this.ends[Y],this.upInto=this.ends[Y].downOutOf=this.ends[X]}});var cW=Z.sqrt=Z[`√`]=J(vU,function(e,t){e.ctrlSeq=`\\sqrt`,e.htmlTemplate=`<span class="mq-non-leaf"><span class="mq-scaled mq-sqrt-prefix">√</span><span class="mq-non-leaf mq-sqrt-stem"><span class="mq-empty-box">&0</span></span></span>`,e.textTemplate=[`sqrt(`,`)`],e.parser=function(){return gU.optBlock.then(function(e){return gU.block.map(function(t){var n=lW();return n.blocks=[e,t],e.adopt(n,0,0),t.adopt(n,e,0),n})}).or(t.parser.call(this))},e.reflow=function(){var e=this.ends[X].jQ.parent();HU(e.prev(),1,e.innerHeight()/+e.css(`fontSize`).slice(0,-2)-.1)}});Z.hat=J(vU,function(e,t){e.ctrlSeq=`\\hat`,e.htmlTemplate=`<span class="mq-non-leaf"><span class="mq-hat-prefix">^</span><span class="mq-hat-stem">&0</span></span>`,e.textTemplate=[`hat(`,`)`]});var lW=Z.nthroot=J(cW,function(e,t){e.htmlTemplate=`<sup class="mq-nthroot mq-non-leaf"><span class="mq-empty-box">&0</span></sup><span class="mq-scaled"><span class="mq-sqrt-prefix mq-scaled">√</span><span class="mq-sqrt-stem mq-non-leaf"><span class="mq-empty-box">&1</span></span></span>`,e.textTemplate=[`sqrt[`,`](`,`)`],e.latex=function(){return`\\sqrt[`+this.ends[Y].latex()+`]{`+this.ends[X].latex()+`}`}}),uW=J(vU,function(e,t){e.init=function(e,n,r){var i=`<span class="mq-non-leaf"><span class="mq-diacritic-above">`+n+`</span><span class="mq-diacritic-stem">&0</span></span>`;t.init.call(this,e,i,r)}});Z.vec=q(uW,`\\vec`,`→`,[`vec(`,`)`]),Z.tilde=q(uW,`\\tilde`,`~`,[`tilde(`,`)`]),Z.lrncuberoot=J(cW,function(e,t){e.ctrlSeq=`\\lrncuberoot`,e.htmlTemplate=`<sup class="mq-nthroot mq-non-leaf"><span class="mq-empty-box">3</span></sup><span class="mq-scaled"><span class="mq-sqrt-prefix mq-scaled">√</span><span class="mq-sqrt-stem mq-non-leaf"><span class="mq-empty-box">&0</span></span></span>`,e.textTemplate=[`sqrt[3](`,`)`],e.latex=function(){return`\\sqrt[3]{`+this.ends[Y].latex()+`}`}}),Z.abs=J(vU,function(e){e.ctrlSeq=`\\abs`,e.htmlTemplate=`<span class="mq-abs mq-non-leaf"><span class="mq-empty-box">&0</span></span>`,e.textTemplate=[`|`,`|`]}),Z.lrnplaceholder=J(vU,function(e,t){e.ctrlSeq=`\\lrnplaceholder`,e.htmlTemplate=`<span class="mq-lrnplaceholder mq-non-leaf"><span class="mq-empty-box">&0</span></span>`,e.textTemplate=[``],e.latex=function(){return this.ends[Y].latex()}}),Z.lrnexponent=J(vU,function(e,t){e.ctrSeq=`\\lrnexponent`,e.htmlTemplate=`<span class="mq-lrnexponent mq-non-leaf"><span class="mq-lrnplaceholder mq-non-leaf"><span class="mq-empty-box">&0</span></span><span class="mq-supsub mq-non-leaf mq-sup-only"><span class="mq-sup"><span class="mq-empty-box">&1</span></span></span></span>`,e.textTemplate=[``,`**`],e.latex=function(){var e=this.ends[X].latex();return e.length>1?e=`{`+e+`}`:e.length===0&&(e=`{ }`),this.ends[Y].latex()+`^`+e}}),Z.lrnsquaredexponent=J(vU,function(e,t){e.ctrSeq=`\\lrnsquaredexponent`,e.htmlTemplate=`<span class="mq-lrnexponent mq-non-leaf"><span class="mq-lrnplaceholder mq-non-leaf"><span class="mq-empty-box">&0</span></span><span class="mq-supsub mq-non-leaf mq-sup-only"><span class="mq-sup"><span class="mq-empty-box">2</span></span></span></span>`,e.textTemplate=[``,`**2`],e.latex=function(){return this.ends[Y].latex()+`^2`}}),Z.lrnsubscript=J(vU,function(e,t){e.ctrSeq=`\\lrnsubscript`,e.htmlTemplate=`<span class="mq-lrnexponent mq-non-leaf"><span class="mq-lrnplaceholder mq-non-leaf"><span class="mq-empty-box">&0</span></span><span class="mq-supsub mq-non-leaf"><span class="mq-sub"><span class="mq-empty-box">&1</span></span><span style="display:inline-block;width:0"> </span></span></span>`,e.textTemplate=[``,`_`],e.latex=function(){return this.ends[Y].latex()+`_`+this.ends[X].latex()}});function dW(e,t){e.jQadd=function(){t.jQadd.apply(this,arguments),this.delimjQs=this.jQ.children(`:first`).add(this.jQ.children(`:last`)),this.contentjQ=this.jQ.children(`:eq(1)`)},e.reflow=function(){var e=this.contentjQ.outerHeight()/parseFloat(this.contentjQ.css(`fontSize`));HU(this.delimjQs,LH(1+.2*(e-1),1.2),1.2*e)}}var fW=J(J(vU,dW),function(e,t){e.init=function(e,n,r,i,a){t.init.call(this,`\\left`+i,PH,[n,r]),this.side=e,this.sides={},this.sides[Y]={ch:n,ctrlSeq:i},this.sides[X]={ch:r,ctrlSeq:a}},e.numBlocks=function(){return 1},e.html=function(){return this.htmlTemplate=`<span class="mq-non-leaf"><span class="mq-scaled mq-paren`+(this.side===X?` mq-ghost`:``)+`">`+this.sides[Y].ch+`</span><span class="mq-non-leaf">&0</span><span class="mq-scaled mq-paren`+(this.side===Y?` mq-ghost`:``)+`">`+this.sides[X].ch+`</span></span>`,t.html.call(this)},e.latex=function(){return`\\left`+this.sides[Y].ctrlSeq+this.ends[Y].latex()+`\\right`+this.sides[X].ctrlSeq},e.matchBrack=function(e,t,n){return n instanceof fW&&n.side&&n.side!==-t&&(!e.restrictMismatchedBrackets||pW[this.sides[this.side].ch]===n.sides[n.side].ch||{"(":`]`,"[":`)`}[this.sides[Y].ch]===n.sides[X].ch)&&n},e.closeOpposing=function(e){e.side=0,e.sides[this.side]=this.sides[this.side],e.delimjQs.eq(this.side===Y?0:1).removeClass(`mq-ghost`).html(this.sides[this.side].ch)},e.createLeftOf=function(e){if(!this.replacedFragment){var n=e.options;if(this.sides[Y].ch===`|`)var r=this.matchBrack(n,X,e[X])||this.matchBrack(n,Y,e[Y])||this.matchBrack(n,0,e.parent.parent);else var r=this.matchBrack(n,-this.side,e[-this.side])||this.matchBrack(n,-this.side,e.parent.parent)}if(r){var i=this.side=-r.side;this.closeOpposing(r),r===e.parent.parent&&e[i]&&YH(e[i],e.parent.ends[i],-i).disown().withDirAdopt(-i,r.parent,r,r[i]).jQ.insDirOf(i,r.jQ),r.bubble(`reflow`)}else r=this,i=r.side,r.replacedFragment?r.side=0:e[-i]&&(r.replaces(YH(e[-i],e.parent.ends[-i],i)),e[-i]=0),t.createLeftOf.call(r,e);i===Y?e.insAtLeftEnd(r.ends[Y]):e.insRightOf(r)},e.placeCursor=zH,e.unwrap=function(){this.ends[Y].children().disown().adopt(this.parent,this,this[X]).jQ.insertAfter(this.jQ),this.remove()},e.deleteSide=function(e,t,n){var r=this.parent,i=this[e],a=r.ends[e];if(e===this.side){this.unwrap(),i?n.insDirOf(-e,i):n.insAtDirEnd(e,r);return}var o=n.options,s=!this.side;if(this.side=-e,this.matchBrack(o,e,this.ends[Y].ends[this.side])){this.closeOpposing(this.ends[Y].ends[this.side]);var c=this.ends[Y].ends[e];this.unwrap(),c.siblingCreated&&c.siblingCreated(n.options,e),i?n.insDirOf(-e,i):n.insAtDirEnd(e,r)}else{if(this.matchBrack(o,e,this.parent.parent))this.parent.parent.closeOpposing(this),this.parent.parent.unwrap();else if(t&&s){this.unwrap(),i?n.insDirOf(-e,i):n.insAtDirEnd(e,r);return}else this.sides[e]={ch:pW[this.sides[this.side].ch],ctrlSeq:pW[this.sides[this.side].ctrlSeq]},this.delimjQs.removeClass(`mq-ghost`).eq(e===Y?0:1).addClass(`mq-ghost`).html(this.sides[e].ch);if(i){var c=this.ends[Y].ends[e];YH(i,a,-e).disown().withDirAdopt(-e,this.ends[Y],c,0).jQ.insAtDirEnd(e,this.ends[Y].jQ.removeClass(`mq-empty`)),c.siblingCreated&&c.siblingCreated(n.options,e),n.insDirOf(-e,i)}else t?n.insDirOf(e,this):n.insAtDirEnd(e,this.ends[Y])}},e.deleteTowards=function(e,t){this.deleteSide(-e,!1,t)},e.finalizeTree=function(){this.ends[Y].deleteOutOf=function(e,t){this.parent.deleteSide(e,!0,t)},this.finalizeTree=this.intentionalBlur=function(){this.delimjQs.eq(+(this.side===Y)).removeClass(`mq-ghost`),this.side=0}},e.siblingCreated=function(e,t){t===-this.side&&this.finalizeTree()}}),pW={"(":`)`,")":`(`,"[":`]`,"]":`[`,"{":`}`,"}":`{`,"\\{":`\\}`,"\\}":`\\{`,"⟨":`⟩`,"⟩":`⟨`,"\\langle ":`\\rangle `,"\\rangle ":`\\langle `,"|":`|`,"\\lVert ":`\\rVert `,"\\rVert ":`\\lVert `};function mW(e,t){var t=t||e,n=pW[e],r=pW[t];XH[e]=q(fW,Y,e,n,t,r),XH[n]=q(fW,X,e,n,t,r)}mW(`(`),mW(`[`),mW(`{`,`\\{`),Z.langle=q(fW,Y,`⟨`,`⟩`,`\\langle `,`\\rangle `),Z.rangle=q(fW,X,`⟨`,`⟩`,`\\langle `,`\\rangle `),XH[`|`]=q(fW,Y,`|`,`|`,`|`,`|`),Z.lVert=q(fW,Y,`∥`,`∥`,`\\lVert `,`\\rVert `),Z.rVert=q(fW,X,`∥`,`∥`,`\\lVert `,`\\rVert `),Z.left=J(vU,function(e){e.parser=function(){var e=pU.regex,t=pU.string;pU.succeed;var n=pU.optWhitespace;return n.then(e(/^(?:[([|]|\\\{|\\langle(?![a-zA-Z])|\\lVert(?![a-zA-Z]))/)).then(function(r){var i=r.charAt(0)===`\\`?r.slice(1):r;return r==`\\langle`&&(i=`⟨`,r+=` `),r==`\\lVert`&&(i=`∥`,r+=` `),gU.then(function(a){return t(`\\right`).skip(n).then(e(/^(?:[\])|]|\\\}|\\rangle(?![a-zA-Z])|\\rVert(?![a-zA-Z]))/)).map(function(e){var t=e.charAt(0)===`\\`?e.slice(1):e;e==`\\rangle`&&(t=`⟩`,e+=` `),e==`\\rVert`&&(t=`∥`,e+=` `);var n=fW(0,i,t,r,e);return n.blocks=[a],a.adopt(n,0,0),n})})})}}),Z.right=J(vU,function(e){e.parser=function(){return pU.fail(`unmatched \\right`)}}),Z.choose=J(Z.binom=Z.binomial=J(J(vU,dW),function(e,t){e.ctrlSeq=`\\binom`,e.htmlTemplate=`<span class="mq-non-leaf"><span class="mq-paren mq-scaled">(</span><span class="mq-non-leaf"><span class="mq-array mq-non-leaf"><span>&0</span><span>&1</span></span></span><span class="mq-paren mq-scaled">)</span></span>`,e.textTemplate=[`choose(`,`,`,`)`]}),function(e){e.createLeftOf=sW.prototype.createLeftOf}),Z.editable=Z.MathQuillMathField=J(vU,function(e,t){e.ctrlSeq=`\\MathQuillMathField`,e.htmlTemplate=`<span class="mq-editable-field"><span class="mq-root-block">&0</span></span>`,e.parser=function(){var e=this,n=pU.string,r=pU.regex,i=pU.succeed;return n(`[`).then(r(/^[a-z][a-z0-9]*/i)).skip(n(`]`)).map(function(t){e.name=t}).or(i()).then(t.parser.call(e))},e.finalizeTree=function(e){var t=eU(this.ends[Y],this.jQ,e);t.KIND_OF_MQ=`MathField`,t.editable=!0,t.createTextarea(),t.editablesTextareaEvents(),t.cursor.insAtRightEnd(t.root),fU(t.root)},e.registerInnerField=function(e,t){e.push(e[this.name]=t(this.ends[Y].controller))},e.latex=function(){return this.ends[Y].latex()},e.text=function(){return this.ends[Y].text()}});var hW=Z.embed=J(yU,function(e,t){e.setOptions=function(e){function t(){return``}return this.text=e.text||t,this.htmlTemplate=e.htmlString||``,this.latex=e.latex||t,this},e.parser=function(){var e=this,t=pU.string,n=pU.regex,r=pU.succeed;return t(`{`).then(n(/^[a-z][a-z0-9]*/i)).skip(t(`}`)).then(function(i){return t(`[`).then(n(/^[-\w\s]*/)).skip(t(`]`)).or(r()).map(function(t){return e.setOptions(aU[i](t))})})}});Z.MathQuillResponseContainer=J(vU,function(e,t){e.ctrlSeq=`\\MathQuillResponseContainer`,e.htmlTemplate=`<span class="lrn-mq-response-container"><marker class="lrn-qe-keyboard-i-response"></marker><content>Response</content></span>`,e.latex=function(){return`\\MathQuillResponseContainer`},e.text=function(){return this.ends[Y].text()}}),Z.MathQuillResponseContainerIcon=J(vU,function(e,t){e.ctrlSeq=`\\MathQuillResponseContainerIcon`,e.htmlTemplate=`<span class="lrn-mq-response-container-icon"><span class="lrn-qe-keyboard-i-response"></span></span>`,e.latex=function(){return`\\MathQuillResponseContainerIcon`},e.text=function(){return this.ends[Y].text()}});var gW=Z.matrix=J(vU,function(e,t){var n=J(bU,function(e,t){e.init=function(e,n){return this.column=e,this.row=n,t.init.call(this)},e.keystroke=function(e,n,r){switch(e){case`Shift-Spacebar`:return n.preventDefault(),this.parent.insertColumn(this);case`Shift-Enter`:return this.parent.insertRow(this)}return t.keystroke.apply(this,arguments)},e.deleteOutOf=function(e,n){var r=this,i=arguments;this.parent.backspace(this,e,n,function(){return t.deleteOutOf.apply(r,i)})}}),r={column:`&`,row:`\\\\`};e.parentheses={left:null,right:null},e.maximum={rows:5,columns:5},e.defaults={rows:2,columns:2},e.ctrlSeq=`\\matrix`,e.createBlocks=function(){var e=this,t=e.blocks=[],r,i,a=0;this.htmlTemplate.replace(/&\d+/g,function(o,s){var c=e.htmlTemplate.substring(0,s).match(/<tr[^>]*>/gi).length-1;i=r===c?i+1:0,t[a]=n(i,c),t[a].adopt(e,e.ends[X],0),r=c,a++})},e.reflow=function(){var e=this.jQ.children(`table`),t=e.outerHeight()/+e.css(`fontSize`).slice(0,-2),n=this.jQ.children(`.mq-paren`);n.length&&HU(n,LH(1+.2*(t-1),1.2),1.05*t)},e.latex=function(){var e=this.getMatrixName(),t=`\\begin{`+e+`}`,n,i,a;for(a=0;a<this.blocks.length;a++)n=this.blocks[a].row,i!==void 0&&(i===n?t+=r.column:t+=r.row),i=n,t+=this.blocks[a].latex();return t+=`\\end{`+e+`}`,t},e.createLeftOf=function(n){this.cursor=n;var r=Math.min(this.defaults.rows,this.maximum.rows),i=Math.min(this.defaults.columns,this.maximum.columns);this.defaultHtmlTemplate=this.defaultHtmlTemplate||this.generateHtmlTemplate(r,i),e.htmlTemplate=this.defaultHtmlTemplate,t.createLeftOf.call(this,n)},e.getMatrixName=function(){return this.ctrlSeq.replace(`\\`,``)},e.generateHtmlTemplate=function(e,t){var n=`<span class="mq-matrix mq-non-leaf">`+o(this.parentheses.left);n+=`<table class="mq-non-leaf">`,e=Math.min(e,this.maximum.rows),t=Math.min(t,this.maximum.columns);for(var r=0,i=0;i<e;i++){n+=`<tr>`;for(var a=0;a<t;a++)n+=`<td>&`+r+`</td>`,r++;n+=`</tr>`}return n+=`</table>`,n+=o(this.parentheses.right)+`</span>`,n;function o(e){return e?`<span class="mq-paren mq-scaled">`+e+`</span>`:``}},e.htmlTemplate=e.generateHtmlTemplate(1,1),e.parser=function(){var e=pU.regex,t=this,i=this.getMatrixName(),a=RegExp(`^(.*?)\\\\end{`+i+`}`),o=RegExp(`\\\\end{`+i+`}`);return e(a).then(function(e){var i=e.replace(o,``),a=[],s=i.split(r.row),c=Math.min(s.length,t.maximum.rows),l=0,u,d;for(d=0;d<c;d++)u=s[d].split(r.column),l=Math.max(l,u.length);for(l=Math.min(l,t.maximum.columns),d=0;d<c;d++){u=s[d].split(r.column);for(var e=0;e<l;e++){var f=n(e,d);gU.parse(u[e]||` `).children().adopt(f,f.ends[X],0),a.push(f)}}t.htmlTemplate=t.generateHtmlTemplate(c,l),t.blocks=a;for(var d=0;d<a.length;d+=1)a[d].adopt(t,t.ends[X],0);return pU.succeed(t)})},e.finalizeTree=function(){var e=this.jQ.find(`table`);e.length&&(this.relink(),e.removeClass(function(e,t){var n=t.match(/mq-rows-\d+/g);return n&&n.join(` `)||``}),e.addClass(`mq-rows-`+e.find(`tr`).length))},e.relink=function(){var e=this.jQ.find(`td`),t=qH.byId[e.first().attr(IH)],n=qH.byId[e.last().attr(IH)],r=e.eq(0).closest(`tr`),i=[];e.each(function(t){var n=qH.byId[MH(this).attr(IH)],a=e.eq(t+1),o=MH(this).closest(`tr`).next(`tr`),s=MH(this).closest(`tr`).index(),c=MH(this).index(),l;if(a.length){var u=qH.byId[a.attr(IH)];n[X]=u,u[Y]=n}if(l=o.length?o.find(`td`).eq(c):r.find(`td`).eq(c+1),l.length){var d=qH.byId[l.attr(IH)];n.downOutOf=d,d.upOutOf=n}n.column=c,n.row=s,i.push(n)}),this.ends[Y]=t,this.ends[X]=n,t&&t[Y]&&delete t[Y],n&&n[X]&&delete n[X],this.blocks=i},e.deleteCell=function(e){var t=e.jQ.closest(`tr`),n=e.jQ.index(),r=t.index(),i=t.find(`td`).not(e.jQ),a=this.jQ.find(`tr`).not(t).map(function(){return MH(this).find(`td`)[n]}),o=this.jQ.find(`td`).length===1,s;function c(){return qH.byId[MH(this).attr(IH)].isEmpty()}return i.filter(c).length===i.length&&a.length&&(i.remove(),e.jQ.remove(),t.remove(),this.finalizeTree()),a.filter(c).length===a.length&&i.length&&(a.remove(),e.jQ.remove(),this.finalizeTree()),o||(r=Math.min(r,this.jQ.find(`tr`).length-1),n=Math.min(n,this.jQ.find(`tr`).eq(r).find(`td`).length-1),s=qH.byId[this.jQ.find(`tr`).eq(r).find(`td`).eq(n).attr(IH)]),s},e.addRow=function(e){if(!(this.jQ.find(`tr`).length>=this.maximum.rows)){for(var t=e.find(`td`).length,r=MH(`<tr></tr>`),i,a,o=0;o<t;o++)i=n(),i.parent=this,i.jQ=MH(`<td class="mq-empty">`).attr(IH,i.id),r.append(i.jQ),a||=i;return r.insertAfter(e),a}},e.addColumn=function(e){if(!(e.closest(`tr`).find(`td`).length>=this.maximum.columns)){var t=e.index(),r=e.closest(`tr`).index(),i=this,a,o=[];return this.jQ.find(`tr`).each(function(){a=n(),a.parent=i,a.jQ=MH(`<td class="mq-empty">`).attr(IH,a.id),a.jQ.insertAfter(MH(this).find(`td`).eq(t)),o.push(a)}),o[r]}},e.insertColumn=function(e){newBlock=this.addColumn(e.jQ),newBlock&&(this.cursor=this.cursor||this.parent.cursor,this.finalizeTree(),this.bubble(`reflow`).cursor.insAtRightEnd(newBlock))},e.insertRow=function(e){newBlock=this.addRow(e.jQ.closest(`tr`)),newBlock&&(this.cursor=this.cursor||this.parent.cursor,this.finalizeTree(),this.bubble(`reflow`).cursor.insAtRightEnd(newBlock))},e.backspace=function(e,t,n,r){if(e.isEmpty()){var i=this.deleteCell(e);i?n.insAtRightEnd(i):(r(),this.finalizeTree()),this.bubble(`edited`)}}});Z.pmatrix=J(gW,function(e,t){e.ctrlSeq=`\\pmatrix`,e.parentheses={left:`(`,right:`)`}}),Z.bmatrix=J(gW,function(e,t){e.ctrlSeq=`\\bmatrix`,e.parentheses={left:`[`,right:`]`}}),Z.Bmatrix=J(gW,function(e,t){e.ctrlSeq=`\\Bmatrix`,e.parentheses={left:`{`,right:`}`}}),Z.vmatrix=J(gW,function(e,t){e.ctrlSeq=`\\vmatrix`,e.parentheses={left:`|`,right:`|`}}),Z.Vmatrix=J(gW,function(e,t){e.ctrlSeq=`\\Vmatrix`,e.parentheses={left:`‖`,right:`‖`}});var _W=uU(3);for(var vW in _W)(function(e,t){typeof t==`function`?(sU[e]=function(){return oU(),t.apply(this,arguments)},sU[e].prototype=t.prototype):sU[e]=t})(vW,_W[vW]);var yW=function(e){e.registerEmbed(`newLine`,()=>({htmlString:`<div class="newLine"></div>`,text:()=>`testText`,latex:()=>`\\embed{newLine}[]`}))},bW;typeof window<`u`&&(bW=sU.getInterface(3),bW&&bW.registerEmbed&&yW(bW));var xW=Uu(`math-input:mq:input`),SW=R(`span`)({}),CW=class extends P.Component{static propTypes={className:v.string,onClick:v.func,onChange:v.func,latex:v.string,onFocus:v.func,onBlur:v.func};componentDidMount(){if(!bW)throw Error(`MQ is not defined - but component has mounted?`);this.mathField=bW.MathField(this.input,{handlers:{edit:this.onInputEdit.bind(this)}}),this.updateLatex()}componentDidUpdate(){this.updateLatex()}updateLatex(){if(!this.mathField)return;let{latex:e}=this.props;e!=null&&this.mathField.latex(e)}clear(){return this.mathField.latex(``),``}blur(){xW(`blur mathfield`),this.mathField.blur()}focus(){xW(`focus mathfield...`),this.mathField.focus()}command(e){return xW(`command: `,e),Array.isArray(e)?e.forEach(e=>{this.mathField.cmd(e)}):this.mathField.cmd(e),this.mathField.focus(),this.mathField.latex()}keystroke(e){return this.mathField.keystroke(e),this.mathField.focus(),this.mathField.latex()}write(e){return xW(`write: `,e),this.mathField.write(e),this.mathField.focus(),this.mathField.latex()}onInputEdit=()=>{xW(`[onInputEdit] ...`);let{onChange:e}=this.props;this.mathField&&e&&e(this.mathField.latex())};refresh=()=>{this.blur(),this.focus()};onKeyPress=e=>{if(Object.keys(this.mathField.__controller.options).indexOf(`ignoreNextMousedown`)<0&&this.refresh(),e.charCode===13){e.preventDefault();return}};onClick=e=>{let{onClick:t}=this.props;this.refresh(),t&&t(e)};shouldComponentUpdate(e){return xW(`next: `,e.latex),xW(`current: `,this.mathField.latex()),e.latex!==this.mathField.latex()}render(){let{onFocus:e,onBlur:t,className:n}=this.props;return(0,F.jsx)(SW,{className:n,onKeyDown:this.onKeyPress,onClick:this.onClick,onFocus:e,onBlur:t,ref:e=>this.input=e})}},wW=Uu(`pie-lib:math-input:mq:static`),TW=/\\MathQuillMathField\[r\d*\]\{(.*?)\}/g,EW=/ /g;function DW(e=``){return e.replace(EW,``)}function OW(e){let t=0;for(let n=0;n<(e||``).length;n++)e[n]===`{`&&t++;return t}var kW=class extends P.Component{static propTypes={latex:v.string.isRequired,onFocus:v.func,onBlur:v.func,className:v.string,getFieldName:v.func,onSubFieldChange:v.func,onSubFieldFocus:v.func,setInput:v.func};static defaultProps={getFieldName:()=>{}};constructor(e){super(e),this.state={announcement:``,previousLatex:``,inputSource:null,isDeleteKeyPressed:!1},this.inputRef=P.createRef()}componentDidMount(){this.update(),gH(),this.createLiveRegion(),this.addEventListeners()}componentDidUpdate(){this.update(),gH()}componentWillUnmount(){this.removeLiveRegion(),this.removeEventListeners()}createLiveRegion=()=>{this.liveRegion=document.createElement(`div`),this.liveRegion.style.position=`absolute`,this.liveRegion.style.width=`1px`,this.liveRegion.style.height=`1px`,this.liveRegion.style.marginTop=`-1px`,this.liveRegion.style.clip=`rect(1px, 1px, 1px, 1px)`,this.liveRegion.style.overflow=`hidden`,this.liveRegion.setAttribute(`aria-live`,`polite`),this.liveRegion.setAttribute(`aria-atomic`,`true`),document.body.appendChild(this.liveRegion)};addEventListeners=()=>{let e=this.inputRef.current;e&&(e.addEventListener(`keydown`,this.handleKeyDown),e.addEventListener(`click`,this.handleMathKeyboardClick))};removeEventListeners=()=>{let e=this.inputRef.current;e&&(e.removeEventListener(`keydown`,this.handleKeyDown),e.removeEventListener(`click`,this.handleMathKeyboardClick))};removeLiveRegion=()=>{this.liveRegion&&=(document.body.removeChild(this.liveRegion),null)};handleKeyDown=e=>{(e?.key===`Backspace`||e?.key===`Delete`)&&this.setState({isDeleteKeyPressed:!0}),this.setState({inputSource:`keyboard`})};handleMathKeyboardClick=()=>{this.setState({inputSource:`mathKeyboard`})};onInputEdit=e=>{if(!this.mathField||this._isProgrammaticUpdate)return;let t=this.props.getFieldName(e,this.mathField.innerFields);if(this.props.onSubFieldChange){let n=e.latex().match(/[0-9]\\ \\frac\{[^\{]*\}\{ \}/);if(this.inputRef?.current&&n&&n?.length)try{e.__controller.cursor.insLeftOf(e.__controller.cursor.parent[-1].parent),e.el().dispatchEvent(new KeyboardEvent(`keydown`,{keyCode:8}))}catch(e){console.error(e.toString())}else this.props.onSubFieldChange(t,e.latex())}this.announceLatexConversion(e.latex())};announceLatexConversion=e=>{if(!this.state){console.error(`State is not initialized`);return}let{previousLatex:t,inputSource:n,isDeleteKeyPressed:r}=this.state,i=`Converted to math symbol`;if(n===`keyboard`&&!r)if(OW(e)>OW(t))this.announceMessage(i);else try{this.mathField.parseLatex(t),this.mathField.parseLatex(e),e==t&&this.announceMessage(i)}catch(e){console.warn(`Error parsing latex:`,e.message),console.warn(e)}(this.state.previousLatex!==e||this.state.isDeleteKeyPressed)&&this.setState({previousLatex:e,isDeleteKeyPressed:!1})};announceMessage=e=>{this.setState({previousLatex:``}),this.liveRegion&&(this.liveRegion.textContent=e,setTimeout(()=>{this.liveRegion.textContent=``},500))};update=()=>{if(!bW)throw Error(`MQ is not defined - but component has mounted?`);this.mathField||=bW.StaticMath(this.inputRef?.current,{handlers:{edit:this.onInputEdit.bind(this)}});try{this._isProgrammaticUpdate=!0,this.mathField.parseLatex(this.props.latex),this.mathField.latex(this.props.latex)}catch{this.mathField.latex(`\\MathQuillMathField[r1]{}`)}finally{this._isProgrammaticUpdate=!1}};blur=()=>{wW(`blur mathfield`),this.mathField.blur()};focus=()=>{wW(`focus mathfield...`),this.mathField.focus()};shouldComponentUpdate(e){try{let t=DW(this.mathField.parseLatex(e.latex)),n=(e.latex.match(TW)||[]).length,r=t!==DW(this.mathField.latex().trim())||n!==Object.keys(this.mathField.innerFields).length/2;return wW(`[shouldComponentUpdate] `,r),r}catch(e){return console.warn(`Error parsing latex:`,e.message,`skip update`),console.warn(e),!1}}onFocus=e=>{try{let t=e.target.parentElement.nextSibling,n=parseInt(t.getAttribute(`mathquill-block-id`),10);n||=(t=t.parentElement,parseInt(t.getAttribute(`mathquill-block-id`),10));let r=this.mathField.innerFields.find(e=>e.id===n);if(r){let e=this.props.getFieldName(r,this.mathField.innerFields);this.props.setInput&&this.props.setInput(r),this.props.onSubFieldFocus(e,r)}}catch(e){console.error(`error finding root block`,e.message)}};render(){let{onBlur:e,className:t}=this.props;return(0,F.jsx)(`span`,{className:t,onFocus:this.onFocus,onBlur:e,ref:this.inputRef})}},AW={fontFamily:`MJXZERO, MJXTEX !important`,"-webkit-font-smoothing":`antialiased !important`,"& .mq-math-mode > span > var":{fontFamily:`MJXZERO, MJXTEX-I !important`},"& .mq-math-mode span var":{fontFamily:`MJXZERO, MJXTEX-I !important`},"& .mq-math-mode .mq-nonSymbola":{fontFamily:`MJXZERO, MJXTEX-I !important`},"& .mq-math-mode > span > var.mq-operator-name":{fontFamily:`MJXZERO, MJXTEX !important`}},jW={"& .mq-longdiv-inner":{marginTop:`-1px`,marginLeft:`5px !important;`,"& > .mq-empty":{padding:`0 !important`,marginLeft:`0px !important`,marginTop:`2px`}},"& .mq-math-mode .mq-longdiv":{display:`inline-flex !important`}},MW={"& .mq-math-mode sup.mq-nthroot":{fontSize:`70% !important`,verticalAlign:`0.5em !important`,paddingRight:`0.15em`},"& .mq-math-mode .mq-supsub":{fontSize:`70.7% !important`},"& .mq-supsub ":{fontSize:`70.7%`},"& .mq-math-mode .mq-supsub.mq-sup-only":{verticalAlign:`-0.1em !important`,"& .mq-sup":{marginBottom:`0px !important`}},"& .mq-math-mode .mq-fraction + .mq-supsub.mq-sup-only":{verticalAlign:`0.4em !important`},"& .mq-math-mode .mq-supsub.mq-sup-only.mq-after-fraction-group":{verticalAlign:`0.4em !important`}},NW={"& *":{...AW,...jW,"& .mq-math-mode .mq-sqrt-prefix":{top:`0 !important`},"& .mq-math-mode .mq-empty":{padding:`9px 1px !important`},"& .mq-math-mode .mq-longdiv-inner .mq-empty":{padding:`0 !important`},"& .mq-math-mode .mq-supsub":{fontSize:`70.7% !important`},"& .mq-math-mode .mq-sqrt-stem":{marginTop:`-5px`,paddingTop:`4px`},"& .mq-math-mode .mq-paren":{verticalAlign:`middle !important`},"& .mq-math-mode .mq-overarrow .mq-overarrow-inner .mq-empty":{padding:`0 !important`},"& .mq-math-mode .mq-overline .mq-overline-inner .mq-empty ":{padding:`0 !important`}}},PW={commonMqFontStyles:AW,longdivStyles:jW,supsubStyles:MW,commonMqKeyboardStyles:NW},FW=e=>(Up(5-e.length,()=>e.push([])),Wp.apply(null,e)),IW=Uu(`pie-lib:math-inline:keypad`),LW=R(kW)(({latex:e})=>{let t={pointerEvents:`none`,textTransform:`none !important`,color:Il(),"& .mq-scaled.mq-sqrt-prefix":{transform:`scale(1, 0.9) !important`},"& .mq-sup-only .mq-sup":{marginBottom:`0.9px !important`},"& .mq-empty":{backgroundColor:`${Mu()} !important`},"& .mq-overline .mq-overline-inner":{borderTop:`2px solid black`},"& .mq-non-leaf.mq-overline":{borderTop:`none !important`},"& .mq-overarrow":{width:`30px`,marginTop:`0 !important`,borderTop:`2px solid black`,fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`,"&.mq-arrow-both":{top:`0px !important`,"& *":{lineHeight:`1 !important`,borderTop:`none !important`},"&:before":{fontSize:`80%`,left:`calc(-13%) !important`,top:`-0.31em !important`},"&:after":{fontSize:`80% !important`,right:`calc(-13%) !important`,top:`-1.5em`},"&.mq-empty:before":{fontSize:`80%`,left:`calc(-13%)`,top:`-0.26em`},"&.mq-empty:after":{fontSize:`80%`,right:`calc(-13%)`,top:`-0.26em`},"&.mq-empty":{minHeight:`1.4em`}},"&.mq-arrow-right:before":{fontSize:`80%`,right:`calc(-13%) !important`,top:`-0.26em !important`},"& .mq-overarrow-inner":{border:`none !important`},"& .mq-overarrow-inner .mq-overarrow-inner-right":{display:`none !important`}},"& .mq-root-block":{padding:`5px !important`},"& .mq-overarrow.mq-arrow-both.mq-empty:after":{right:`-6px`,fontSize:`80% !important`,top:`-3px`},"& .mq-overarrow.mq-arrow-right.mq-empty:before":{right:`-5px`,fontSize:`80% !important`,top:`-3px`},"& .mq-overarrow.mq-arrow-both.mq-empty:before":{left:`-6px`,fontSize:`80% !important`,top:`-3px`},"& .mq-longdiv-inner":{borderTop:`1px solid !important`,paddingTop:`1.5px !important`},"& .mq-parallelogram":{lineHeight:.85},"& .mq-overarc":{borderTop:`2px solid black !important`,"& .mq-overline":{borderTop:`none !important`},"& .mq-overline-inner":{borderTop:`none !important`,paddingTop:`0 !important`}}};return e===`\\parallel`?{...t,fontStyle:`italic !important`}:e===`\\overleftrightarrow{\\overline{}}`?{...t,"& .mq-overarrow.mq-arrow-both":{"& .mq-overline-inner":{borderTop:`none !important`,paddingTop:`0 !important`},"&:after":{position:`absolute !important`,top:`0px !important`}}}:t});LW.propTypes={latex:v.string.isRequired};var RW=e=>e?{gridTemplateColumns:`repeat(${e.columns}, minmax(min-content, 150px))`,gridTemplateRows:`repeat(${e.rows}, minmax(40px, 60px))`,gridAutoFlow:`initial`}:{},zW=R(`div`)(()=>({...NW,width:`100%`,display:`grid`,gridTemplateRows:`repeat(5, minmax(40px, 60px))`,gridRowGap:`0px`,gridColumnGap:`0px`,gridAutoFlow:`column`,"&.character":{textTransform:`initial !important`,gridTemplateRows:`repeat(5, minmax(40px, 50px)) !important`},"&.language":{gridTemplateRows:`repeat(4, minmax(40px, 50px)) !important`,"& *":{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`}}})),BW=R(ff)(({category:e,isDelete:t,isComma:n,isDot:r})=>({minWidth:`auto`,textTransform:`none`,fontSize:n||r?`200% !important`:`140% !important`,lineHeight:n||r?`100%`:`normal`,color:Il(),backgroundColor:e===`operators`?ju():Au(),"&:hover":{backgroundColor:e===`operators`?Pu():Nu()},borderRadius:0,...t&&{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`}})),VW=R(ff)(({category:e})=>({textTransform:`none`,padding:0,margin:0,fontSize:`110% !important`,minWidth:`auto`,borderRadius:0,backgroundColor:e===`operators`?ju():Au(),"&:hover":{backgroundColor:e===`operators`?Pu():Nu()}})),HW=R(uR)(({category:e})=>({minWidth:`auto`,backgroundColor:e===`operators`?ju():Au(),"&:hover":{backgroundColor:e===`operators`?Pu():Nu()},borderRadius:0,"& .icon":{height:`30px`}})),UW=class extends P.Component{static propTypes={className:v.string,controlledKeypadMode:v.bool,baseSet:v.array,additionalKeys:v.array,layoutForKeyPad:v.object,onPress:v.func.isRequired,onFocus:v.func,noDecimal:v.bool,setKeypadInteraction:v.func,mode:v.oneOfType([v.string,v.number])};static defaultProps={baseSet:kH,noDecimal:!1};constructor(e){super(e),this.keypadRef=P.createRef()}componentDidMount(){let e=this.keypadRef?.current,t=e?.closest(`.main-container`),n=e?.closest(`.pie-toolbar`);if(this.props.controlledKeypadMode&&t&&n){let e=t.getBoundingClientRect(),r=n.getBoundingClientRect(),i=e.top+e.height-(r.top+r.height);if(i<0){let n=e.height+e.top-i;t&&(t.style.height=`${n}px`)}}e&&(e.addEventListener(`touchstart`,this.handleKeypadInteraction,!0),e.addEventListener(`mousedown`,this.handleKeypadInteraction,!0))}componentWillUnmount(){let e=this.keypadRef?.current;if(this.props.controlledKeypadMode&&e){let t=e.closest(`.main-container`);t&&(t.style.height=`unset`)}e&&(e.removeEventListener(`touchstart`,this.handleKeypadInteraction,!0),e.removeEventListener(`mousedown`,this.handleKeypadInteraction,!0))}handleKeypadInteraction=()=>{this.props.setKeypadInteraction&&this.props.setKeypadInteraction(!0)};buttonClick=e=>{IW(`[buttonClick]`,e);let{onPress:t}=this.props;t(e)};flowKeys=(e,t)=>Fp([...FW(e),...FW(t)]);keyIsNotAllowed=e=>{let{noDecimal:t}=this.props;return!!((e.write===`.`&&e.label===`.`||e.write===`,`&&e.label===`,`)&&t)};render(){let{className:e,baseSet:t,additionalKeys:n,layoutForKeyPad:r,onFocus:i,mode:a}=this.props,o=[`non-negative-integers`,`integers`,`decimals`,`fractions`,`item-authoring`,`language`].includes(a),s=o?this.flowKeys([],n||[]):this.flowKeys(t,n||[]),c=s.length%5?1:0,l={gridTemplateColumns:`repeat(${Math.floor(s.length/5)+c}, minmax(min-content, 150px))`,...RW(r)};return(0,F.jsx)(zW,{ref:this.keypadRef,className:[e,a].filter(Boolean).join(` `),style:l,onFocus:i,children:s.map((e,t)=>{let n=this.buttonClick.bind(this,e);if(!e)return(0,F.jsx)(`span`,{},`empty-${t}`);let r={onClick:n,disabled:this.keyIsNotAllowed(e),key:`${e.label||e.latex||e.command}-${t}`,...e.actions||{},...e.extraProps||{}};if(e.latex)return(0,F.jsx)(VW,{onClick:r.onClick,disabled:r.disabled,category:o?void 0:e.category,"aria-label":e.ariaLabel?e.ariaLabel:e.name||e.label,...e.actions||{},...e.extraProps||{},children:(0,F.jsx)(LW,{latex:e.latex})},r.key);if(e.label)return(0,F.jsx)(BW,{onClick:r.onClick,disabled:r.disabled,category:o?void 0:e.category,isDelete:e.label===`⌫`,isComma:e.label===`,`,isDot:e.label===`.`,"aria-label":e.ariaLabel?e.ariaLabel:e.name||e.label,...e.actions||{},...e.extraProps||{},children:e.label},r.key);{let t=e.icon?e.icon:`div`;return(0,F.jsx)(HW,{tabIndex:`-1`,onClick:r.onClick,disabled:r.disabled,category:o?void 0:e.category,size:`large`,...e.actions||{},...e.extraProps||{},children:(0,F.jsx)(t,{className:`icon`})},r.key)}})})}},WW=e=>{if(e.command)return{value:e.command,type:`command`};if(e.write)return{value:e.write};if(e.keystroke)return{type:`cursor`,value:e.keystroke}},GW=class extends P.Component{static propTypes={className:v.string,controlledKeypadMode:v.bool,mode:v.oneOfType([v.string,v.number]),layoutForKeyPad:v.object,onClick:v.func.isRequired,onFocus:v.func,noDecimal:v.bool,additionalKeys:v.array,setKeypadInteraction:v.func};static defaultProps={mode:`scientific`,noDecimal:!1,additionalKeys:[]};keypadPress=e=>{let{onClick:t}=this.props;t(WW(e))};render(){let{mode:e,onFocus:t,controlledKeypadMode:n,noDecimal:r,className:i,additionalKeys:a,layoutForKeyPad:o,setKeypadInteraction:s}=this.props,c=hH(a);return(0,F.jsx)(UW,{className:i,controlledKeypadMode:n,onFocus:t,noDecimal:r,layoutForKeyPad:o,additionalKeys:dB(pH(e),c),onPress:this.keypadPress,mode:e,setKeypadInteraction:s})}},KW=R(`span`)(()=>({display:`inline-flex`,border:`1px solid ${du()}`,margin:`1px 5px`,cursor:`pointer`,alignItems:`center`,justifyContent:`center`,minWidth:`50px`,minHeight:`36px`,height:`fit-content`})),qW=R(`div`)(()=>({background:au(),color:Il(),display:`inline-flex`,borderRight:`2px solid ${du()}`,boxSizing:`border-box`,overflow:`hidden`,fontSize:`12px`,minHeight:`36px`,height:`100%`,alignItems:`center`,fontFamily:`Symbola, Times New Roman, serif`,padding:`0 2px`})),JW=R(`div`)(()=>({flex:8,color:`var(--pie-text, black)`,padding:`4px !important`,display:`flex`,alignItems:`center`,justifyContent:`center`,backgroundColor:`var(--pie-background, rgba(255, 255, 255, 0))`,"& > .mq-math-mode sup.mq-nthroot":{fontSize:`70% !important`,verticalAlign:`1em !important`},"& > .mq-math-mode .mq-sqrt-stem":{borderTop:`0.07em solid`,marginLeft:`-1.5px`,marginTop:`-2px !important`,paddingTop:`5px !important`},"& .mq-overarrow-inner":{paddingTop:`0 !important`,border:`none !important`},"& .mq-overarrow.mq-arrow-both":{marginTop:`0px`,minWidth:`1.23em`,"& *":{lineHeight:`1 !important`},"&:before":{top:`-0.4em`,left:`-1px`},"&:after":{top:`0px !important`,position:`absolute !important`,right:`-2px`},"&.mq-empty:after":{top:`-0.45em`}},"& .mq-overarrow.mq-arrow-right":{"&:before":{top:`-0.4em`,right:`-1px`}},"& .mq-overarrow-inner-right":{display:`none !important`},"& .mq-overarrow-inner-left":{display:`none !important`}})),YW=e=>{let{node:t,options:n,selected:r}=e,{attrs:i}=t,{value:a,index:o}=i,s=`R ${parseInt(o)+1}`;return(0,F.jsx)(Wk,{className:`math-templated`,"data-selected":r,style:{display:`inline-flex`,minHeight:`36px`,minWidth:`50px`,cursor:`pointer`},children:(0,F.jsxs)(KW,{...i,children:[(0,F.jsx)(qW,{children:s}),(0,F.jsx)(JW,{children:(0,F.jsx)(kW,{latex:a})})]})})};YW.propTypes={attributes:v.object,value:v.string,keyToDisplay:v.string};var XW={},ZW=e=>String(e||``).replace(/-/g,`_`),QW=e=>e&&e.attrs&&e.attrs.index!=null?String(e.attrs.index):null,$W=(e,t)=>{let n=[];return e.descendants((e,r)=>{if(e.type&&e.type.name===t){let t=QW(e);t!=null&&n.push({index:t,pos:r,node:e})}return!0}),n},eG=(e,t)=>{let n=0;return e.descendants(e=>(e.type&&e.type.name===t&&(n+=1),!0)),n},tG=({schema:e,typeName:t,index:n})=>{let r=e.nodes[t];return r?r.create({index:String(n),id:String(n),value:``}):null},nG=(e,t)=>{let n=e.resolve(Math.min(t,e.content.size));return Iv.near(n,1)},rG=tO.create({name:`responseArea`,addOptions(){return{maxResponseAreas:null,error:null,options:null,respAreaToolbar:null,onHandleAreaChange:null}},addProseMirrorPlugins(){if(!this.options.type)return[];let e=ZW(this.options.type);return[new ey({key:new ry(`response-area-watcher:${e}`),view:t=>(XW[e]===void 0&&(XW[e]=0,t.state.doc.descendants(t=>{if(t.type&&t.type.name===e){let n=QW(t);if(n!=null){let t=parseInt(n,10);!Number.isNaN(t)&&t>XW[e]&&(XW[e]=t)}}return!0})),{update:(t,n)=>{let r=t.state;if(n.doc.eq(r.doc))return;let i=$W(r.doc,e),a=$W(n.doc,e);if(this.options.toolbar&&(this.options.toolbar.disabled=i.length>=this.options.maxResponseAreas),a.length>i.length){let e=new Set(i.map(e=>e.index)),t=a.filter(t=>!e.has(t.index));t.length&&typeof this.options.onHandleAreaChange==`function`&&this.options.onHandleAreaChange(t)}}})})]},addCommands(){return{insertResponseArea:e=>({tr:t,state:n,dispatch:r,commands:i})=>{let a=ZW(e);if(eG(n.doc,a)>=this.options.maxResponseAreas)return!1;XW[a]===void 0&&(XW[a]=0);let o=XW[a]+1;XW[a]+=1;let s=tG({schema:n.schema,typeName:a,index:o});if(!s)return!1;let{selection:c}=n,l=c.from,u=e=>{try{return t.insert(e,s),e}catch{return null}},d=u(l);if(d??=u(t.doc.content.size),d==null)return!1;if([`inline_dropdown`,`explicit_constructed_response`].includes(a))t.setSelection(Rv.create(t.doc,d));else{let e=d+s.nodeSize;t.setSelection(nG(t.doc,e))}return r&&(i.focus(),r(t)),!0},refreshResponseArea:()=>({tr:e,state:t,commands:n,dispatch:r})=>{let{selection:i}=t,a=i.$from.nodeAfter,o=i.from;return e.setNodeMarkup(o,void 0,{...a?.attrs,updated:`${Date.now()}`}),e.setSelection(Rv.create(e.doc,o)),r&&(n.focus(),r(e)),!0}}}}),iG=wO.create({name:`explicit_constructed_response`,group:`inline`,inline:!0,atom:!0,addAttributes(){return{index:{default:null},value:{default:``},updated:{default:``}}},parseHTML(){return[{tag:`span[data-type="explicit_constructed_response"]`,getAttrs:e=>({index:e.dataset.index,value:e.dataset.value})}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-type":`explicit_constructed_response`,"data-index":e.index,"data-value":e.value}]},addNodeView(){return iA(e=>(0,F.jsx)(CR,{...e,options:this.options}))}}),aG=wO.create({name:`math_templated`,group:`inline`,inline:!0,atom:!0,addAttributes(){return{index:{default:null},value:{default:``},updated:{default:``}}},parseHTML(){return[{tag:`span[data-type="math_templated"]`,getAttrs:e=>({index:e.dataset.index,value:e.dataset.value})}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-type":`math_templated`,"data-index":e.index,"data-value":e.value}]},addNodeView(){return iA(e=>(0,F.jsx)(YW,{...e,options:this.options}))}}),oG=wO.create({name:`drag_in_the_blank`,group:`inline`,inline:!0,atom:!0,addAttributes(){return{index:{default:null},id:{default:null},value:{default:``},inTable:{default:null},updated:{default:``}}},parseHTML(){return[{tag:`span[data-type="drag_in_the_blank"]`,getAttrs:e=>({index:e.dataset.index,id:e.dataset.id,value:e.dataset.value,inTable:e.dataset.inTable})}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-type":`drag_in_the_blank`,"data-index":e.index,"data-id":e.id,"data-value":e.value,"data-in-table":e.inTable}]},addNodeView(){return iA(e=>(0,F.jsx)(eB,{...e,options:this.options}))}}),sG=wO.create({name:`inline_dropdown`,group:`inline`,inline:!0,atom:!0,addAttributes(){return{index:{default:null},value:{default:``},updated:{default:``}}},parseHTML(){return[{tag:`span[data-type="inline_dropdown"]`,getAttrs:e=>({index:e.dataset.index,value:e.dataset.value})}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-type":`inline_dropdown`,"data-index":e.index,"data-value":e.value}]},addNodeView(){return iA(e=>(0,F.jsx)(tB,{...e,options:this.options}))}}),cG=Vr(`MuiDivider`,[`root`,`absolute`,`fullWidth`,`inset`,`middle`,`flexItem`,`light`,`vertical`,`withChildren`,`withChildrenVertical`,`textAlignRight`,`textAlignLeft`,`wrapper`,`wrapperVertical`]),lG=Vr(`MuiListItemIcon`,[`root`,`alignItemsFlexStart`]);function uG(e){return Br(`MuiTypography`,e)}Vr(`MuiTypography`,[`root`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`subtitle1`,`subtitle2`,`body1`,`body2`,`inherit`,`button`,`caption`,`overline`,`alignLeft`,`alignRight`,`alignCenter`,`alignJustify`,`noWrap`,`gutterBottom`,`paragraph`]);var dG={primary:!0,secondary:!0,error:!0,info:!0,success:!0,warning:!0,textPrimary:!0,textSecondary:!0,textDisabled:!0},fG=ss(),pG=e=>{let{align:t,gutterBottom:n,noWrap:r,paragraph:i,variant:a,classes:o}=e;return ca({root:[`root`,a,e.align!==`inherit`&&`align${B(t)}`,n&&`gutterBottom`,r&&`noWrap`,i&&`paragraph`]},uG,o)},mG=R(`span`,{name:`MuiTypography`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.variant&&t[n.variant],n.align!==`inherit`&&t[`align${B(n.align)}`],n.noWrap&&t.noWrap,n.gutterBottom&&t.gutterBottom,n.paragraph&&t.paragraph]}})(Nc(({theme:e})=>({margin:0,variants:[{props:{variant:`inherit`},style:{font:`inherit`,lineHeight:`inherit`,letterSpacing:`inherit`}},...Object.entries(e.typography).filter(([e,t])=>e!==`inherit`&&t&&typeof t==`object`).map(([e,t])=>({props:{variant:e},style:t})),...Object.entries(e.palette).filter(Vd()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main}})),...Object.entries(e.palette?.text||{}).filter(([,e])=>typeof e==`string`).map(([t])=>({props:{color:`text${B(t)}`},style:{color:(e.vars||e).palette.text[t]}})),{props:({ownerState:e})=>e.align!==`inherit`,style:{textAlign:`var(--Typography-textAlign)`}},{props:({ownerState:e})=>e.noWrap,style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`}},{props:({ownerState:e})=>e.gutterBottom,style:{marginBottom:`0.35em`}},{props:({ownerState:e})=>e.paragraph,style:{marginBottom:16}}]}))),hG={h1:`h1`,h2:`h2`,h3:`h3`,h4:`h4`,h5:`h5`,h6:`h6`,subtitle1:`h6`,subtitle2:`h6`,body1:`p`,body2:`p`,inherit:`p`},gG=P.forwardRef(function(e,t){let{color:n,...r}=cs({props:e,name:`MuiTypography`}),i=!dG[n],a=fG({...r,...i&&{color:n}}),{align:o=`inherit`,className:s,component:c,gutterBottom:l=!1,noWrap:u=!1,paragraph:d=!1,variant:f=`body1`,variantMapping:p=hG,...m}=a,h={...a,align:o,color:n,className:s,component:c,gutterBottom:l,noWrap:u,paragraph:d,variant:f,variantMapping:p},g=c||(d?`p`:p[f]||hG[f])||`span`,_=pG(h);return(0,F.jsx)(mG,{as:g,ref:t,className:I(_.root,s),...m,ownerState:h,style:{...o!==`inherit`&&{"--Typography-textAlign":o},...m.style}})}),_G=Vr(`MuiListItemText`,[`root`,`multiline`,`dense`,`inset`,`primary`,`secondary`]);function vG(e){return Br(`MuiMenuItem`,e)}var yG=Vr(`MuiMenuItem`,[`root`,`focusVisible`,`dense`,`disabled`,`divider`,`gutters`,`selected`]);function bG(e){return Br(`MuiNativeSelect`,e)}var xG=Vr(`MuiNativeSelect`,[`root`,`select`,`multiple`,`filled`,`outlined`,`standard`,`disabled`,`icon`,`iconOpen`,`iconFilled`,`iconOutlined`,`iconStandard`,`nativeInput`,`error`]),SG=e=>{let{classes:t,variant:n,disabled:r,multiple:i,open:a,error:o}=e;return ca({select:[`select`,n,r&&`disabled`,i&&`multiple`,o&&`error`],icon:[`icon`,`icon${B(n)}`,a&&`iconOpen`,r&&`disabled`]},bG,t)},CG=R(`select`,{name:`MuiNativeSelect`})(({theme:e})=>({MozAppearance:`none`,WebkitAppearance:`none`,userSelect:`none`,borderRadius:0,cursor:`pointer`,"&:focus":{borderRadius:0},[`&.${xG.disabled}`]:{cursor:`default`},"&[multiple]":{height:`auto`},"&:not([multiple]) option, &:not([multiple]) optgroup":{backgroundColor:(e.vars||e).palette.background.paper},variants:[{props:({ownerState:e})=>e.variant!==`filled`&&e.variant!==`outlined`,style:{"&&&":{paddingRight:24,minWidth:16}}},{props:{variant:`filled`},style:{"&&&":{paddingRight:32}}},{props:{variant:`outlined`},style:{borderRadius:(e.vars||e).shape.borderRadius,"&:focus":{borderRadius:(e.vars||e).shape.borderRadius},"&&&":{paddingRight:32}}}]})),wG=R(CG,{name:`MuiNativeSelect`,slot:`Select`,shouldForwardProp:Co,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.select,t[n.variant],n.error&&t.error,{[`&.${xG.multiple}`]:t.multiple}]}})({}),TG=R(`svg`,{name:`MuiNativeSelect`})(({theme:e})=>({position:`absolute`,right:0,top:`calc(50% - .5em)`,pointerEvents:`none`,color:(e.vars||e).palette.action.active,[`&.${xG.disabled}`]:{color:(e.vars||e).palette.action.disabled},variants:[{props:({ownerState:e})=>e.open,style:{transform:`rotate(180deg)`}},{props:{variant:`filled`},style:{right:7}},{props:{variant:`outlined`},style:{right:7}}]})),EG=R(TG,{name:`MuiNativeSelect`,slot:`Icon`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.icon,n.variant&&t[`icon${B(n.variant)}`],n.open&&t.iconOpen]}})({}),DG=P.forwardRef(function(e,t){let{className:n,disabled:r,error:i,IconComponent:a,inputRef:o,variant:s=`standard`,...c}=e,l={...e,disabled:r,variant:s,error:i},u=SG(l);return(0,F.jsxs)(P.Fragment,{children:[(0,F.jsx)(wG,{ownerState:l,className:I(u.select,n),disabled:r,ref:o||t,...c}),e.multiple?null:(0,F.jsx)(EG,{as:a,ownerState:l,className:u.icon})]})});function OG(e){return Br(`MuiSelect`,e)}var kG=Vr(`MuiSelect`,[`root`,`select`,`multiple`,`filled`,`outlined`,`standard`,`disabled`,`focused`,`icon`,`iconOpen`,`iconFilled`,`iconOutlined`,`iconStandard`,`nativeInput`,`error`]);function AG(e){return e?e.type===`mousedown`||e.type===`pointerdown`||e.type===`touchstart`?`pointer`:e.type===`keydown`||e.type===`click`&&e.detail===0?`keyboard`:null:null}function jG(e){return e==null||typeof e==`string`&&!e.trim()}function MG(e,t){return typeof t==`object`&&t?e===t:String(e)===String(t)}var NG=P.createContext(null);function PG(){return P.useContext(NG)}var FG=NG.Provider,IG,LG=R(CG,{name:`MuiSelect`,slot:`Select`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[{[`&.${kG.select}`]:t.select},{[`&.${kG.select}`]:t[n.variant]},{[`&.${kG.error}`]:t.error},{[`&.${kG.multiple}`]:t.multiple}]}})({[`&.${kG.select}`]:{height:`auto`,minHeight:`1.4375em`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,overflow:`hidden`}}),RG=R(TG,{name:`MuiSelect`,slot:`Icon`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.icon,n.variant&&t[`icon${B(n.variant)}`],n.open&&t.iconOpen]}})({}),zG=R(`input`,{shouldForwardProp:e=>So(e)&&e!==`classes`,name:`MuiSelect`,slot:`NativeInput`})({bottom:0,left:0,position:`absolute`,opacity:0,pointerEvents:`none`,width:`100%`,boxSizing:`border-box`}),BG=e=>{let{classes:t,variant:n,disabled:r,multiple:i,open:a,error:o}=e;return ca({select:[`select`,n,r&&`disabled`,i&&`multiple`,o&&`error`],icon:[`icon`,`icon${B(n)}`,a&&`iconOpen`,r&&`disabled`],nativeInput:[`nativeInput`]},OG,t)},VG=P.forwardRef(function(e,t){let{"aria-describedby":n,"aria-label":r,autoFocus:i,autoWidth:a,children:o,className:s,defaultOpen:c,defaultValue:l,disabled:u,displayEmpty:d,error:f=!1,IconComponent:p,inputRef:m,labelId:h,MenuProps:g={},multiple:_,name:v,onBlur:b,onChange:x,onClose:S,onFocus:C,onKeyDown:w,onMouseDown:T,onOpen:E,open:D,readOnly:O,renderValue:k,required:A,SelectDisplayProps:j={},tabIndex:M,type:ee,value:N,variant:te=`standard`,...ne}=e,[re,ie]=yl({controlled:N,default:l,name:`Select`}),[ae,oe]=yl({controlled:D,default:c,name:`Select`}),se=P.useRef(null),ce=P.useRef(null),[le,ue]=P.useState(null),{current:de}=P.useRef(D!=null),[fe,pe]=P.useState(),[me,he]=P.useState(null),ge=rc(t,m),_e=P.useCallback(e=>{ce.current=e,e&&ue(e)},[]),ve=le?.parentNode;P.useImperativeHandle(ge,()=>({focus:()=>{ce.current.focus()},node:se.current,value:re}),[re]);let ye=le!==null&&ae;P.useEffect(()=>{if(!ye||!ve||a||typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>{pe(ve.clientWidth)});return e.observe(ve),()=>{e.disconnect()}},[ye,ve,a]),P.useEffect(()=>{c&&ae&&le&&!de&&(pe(a?null:ve.clientWidth),ce.current.focus())},[le,a]),P.useEffect(()=>{i&&ce.current.focus()},[i]),P.useEffect(()=>{if(!h)return;let e=fs(ce.current).getElementById(h);if(e){let t=()=>{getSelection().isCollapsed&&ce.current.focus()};return e.addEventListener(`click`,t),()=>{e.removeEventListener(`click`,t)}}},[h]);let be=(e,t)=>{e?(he(AG(t)),E&&E(t)):(he(null),S&&S(t)),de||(pe(a?null:ve.clientWidth),oe(e))},xe=e=>{T?.(e),e.button===0&&(e.preventDefault(),ce.current.focus(),be(!0,e))},Se=e=>{be(!1,e)},Ce=P.Children.toArray(o),we=e=>{let t=Ce.find(t=>t.props.value===e.target.value);t!==void 0&&(ie(t.props.value),x&&x(e,t))},Te=e=>t=>{let n;if(t.currentTarget.hasAttribute(`tabindex`)){if(_){n=Array.isArray(re)?re.slice():[];let t=re.indexOf(e.props.value);t===-1?n.push(e.props.value):n.splice(t,1)}else n=e.props.value;if(e.props.onClick&&e.props.onClick(t),re!==n&&(ie(n),x)){let r=t.nativeEvent||t,i=new r.constructor(r.type,r);Object.defineProperty(i,"target",{writable:!0,value:{value:n,name:v}}),x(i,e)}_||be(!1,t)}},Ee=e=>{O||([` `,`ArrowUp`,`ArrowDown`,`Enter`].includes(e.key)&&(e.preventDefault(),be(!0,e)),w?.(e))},De=e=>{!ye&&b&&(Object.defineProperty(e,"target",{writable:!0,value:{value:re,name:v}}),b(e))};delete ne[`aria-invalid`];let Oe,ke,Ae=[],je=!1;(Bf({value:re})||d)&&(k?Oe=k(re):je=!0);let Me=Ce.map(e=>{if(!P.isValidElement(e))return null;let t;if(_){if(!Array.isArray(re))throw Error(y(2));t=re.some(t=>MG(t,e.props.value)),t&&je&&Ae.push(e.props.children)}else t=MG(re,e.props.value),t&&je&&(ke=e.props.children);return P.cloneElement(e,{"aria-selected":t?`true`:`false`,onClick:Te(e),onKeyUp:t=>{t.key===` `&&t.preventDefault(),e.props.onKeyUp&&e.props.onKeyUp(t)},role:`option`,selected:t,value:void 0,"data-value":e.props.value})});je&&(Oe=_?Ae.length===0?null:Ae.reduce((e,t,n)=>(e.push(t),n<Ae.length-1&&e.push(`, `),e),[]):ke);let Ne=fe;!a&&de&&le&&(Ne=ve.clientWidth);let Pe;Pe=M===void 0?u?null:0:M;let Fe=j.id||(v?`mui-component-select-${v}`:void 0),Ie={...e,variant:te,value:re,open:ye,error:f},Le=BG(Ie),Re={...g.PaperProps,...typeof g.slotProps?.paper==`function`?g.slotProps.paper(Ie):g.slotProps?.paper},ze={...g.MenuListProps,...typeof g.slotProps?.list==`function`?g.slotProps.list(Ie):g.slotProps?.list},Be=Fi();return(0,F.jsxs)(P.Fragment,{children:[(0,F.jsx)(LG,{as:`div`,ref:_e,tabIndex:Pe,role:`combobox`,"aria-controls":ye?Be:void 0,"aria-disabled":u?`true`:void 0,"aria-expanded":ye?`true`:`false`,"aria-haspopup":`listbox`,"aria-label":r,"aria-labelledby":[h,Fe].filter(Boolean).join(` `)||void 0,"aria-describedby":n,"aria-required":A?`true`:void 0,"aria-invalid":f?`true`:void 0,onKeyDown:Ee,onMouseDown:u||O?null:xe,onBlur:De,onFocus:C,...j,ownerState:Ie,className:I(j.className,Le.select,s),id:Fe,children:jG(Oe)?IG||=(0,F.jsx)(`span`,{className:`notranslate`,"aria-hidden":!0,children:``}):Oe}),(0,F.jsx)(zG,{"aria-invalid":f,value:Array.isArray(re)?re.join(`,`):re,name:v,ref:se,"aria-hidden":!0,onChange:we,tabIndex:-1,disabled:u,className:Le.nativeInput,autoFocus:i,required:A,...ne,ownerState:Ie}),(0,F.jsx)(RG,{as:p,className:Le.icon,ownerState:Ie}),(0,F.jsx)(FG,{value:me,children:(0,F.jsx)(Ep,{id:`menu-${v||``}`,anchorEl:ve,open:ye,onClose:Se,anchorOrigin:{vertical:`bottom`,horizontal:`center`},transformOrigin:{vertical:`top`,horizontal:`center`},...g,slotProps:{...g.slotProps,list:{"aria-labelledby":h,role:`listbox`,"aria-multiselectable":_?`true`:void 0,disableListWrap:!0,id:Be,...ze},paper:{...Re,style:{minWidth:Ne,...Re==null?null:Re.style}}},children:Me})})]})}),HG=ml((0,F.jsx)(`path`,{d:`M7 10l5 5 5-5z`}),`ArrowDropDown`);function UG(e){return parseInt(e,10)||0}var WG={shadow:{visibility:`hidden`,position:`absolute`,overflow:`hidden`,height:0,top:0,left:0,transform:`translateZ(0)`}};function GG(e){for(let t in e)return!1;return!0}function KG(e){return GG(e)||e.outerHeightStyle===0&&!e.overflowing}var qG=P.forwardRef(function(e,t){let{onChange:n,maxRows:r,minRows:i=1,style:a,value:o,...s}=e,{current:c}=P.useRef(o!=null),l=P.useRef(null),u=nc(t,l),d=P.useRef(null),f=P.useRef(null),p=P.useCallback(()=>{let t=l.current,n=f.current;if(!t||!n)return;let a=ps(t).getComputedStyle(t);if(a.width===`0px`)return{outerHeightStyle:0,overflowing:!1};n.style.width=a.width,n.value=t.value||e.placeholder||`x`,n.value.slice(-1)===`
|
|
304
|
+
`&&(n.value+=` `);let o=a.boxSizing,s=UG(a.paddingBottom)+UG(a.paddingTop),c=UG(a.borderBottomWidth)+UG(a.borderTopWidth),u=n.scrollHeight;n.value=`x`;let d=n.scrollHeight,p=u;return i&&(p=Math.max(Number(i)*d,p)),r&&(p=Math.min(Number(r)*d,p)),p=Math.max(p,d),{outerHeightStyle:p+(o===`border-box`?s+c:0),overflowing:Math.abs(p-u)<=1}},[r,i,e.placeholder]),m=qc(()=>{let e=l.current,t=p();if(!e||!t||KG(t))return!1;let n=t.outerHeightStyle;return d.current!=null&&d.current!==n}),h=P.useCallback(()=>{let e=l.current,t=p();if(!e||!t||KG(t))return;let n=t.outerHeightStyle;d.current!==n&&(d.current=n,e.style.height=`${n}px`),e.style.overflow=t.overflowing?`hidden`:``},[p]),g=P.useRef(-1);return ti(()=>{let e=ls(h),t=l?.current;if(!t)return;let n=ps(t);n.addEventListener(`resize`,e);let r;return typeof ResizeObserver<`u`&&(r=new ResizeObserver(()=>{m()&&(r.unobserve(t),cancelAnimationFrame(g.current),h(),g.current=requestAnimationFrame(()=>{r.observe(t)}))}),r.observe(t)),()=>{e.clear(),cancelAnimationFrame(g.current),n.removeEventListener(`resize`,e),r&&r.disconnect()}},[p,h,m]),ti(()=>{h()}),(0,F.jsxs)(P.Fragment,{children:[(0,F.jsx)(`textarea`,{value:o,onChange:e=>{c||h();let t=e.target,r=t.value.length,i=t.value.endsWith(`
|
|
305
|
+
`),a=t.selectionStart===r;i&&a&&t.setSelectionRange(r,r),n&&n(e)},ref:u,rows:i,style:a,...s}),(0,F.jsx)(`textarea`,{"aria-hidden":!0,className:e.className,readOnly:!0,ref:f,tabIndex:-1,style:{...WG.shadow,...a,paddingTop:0,paddingBottom:0}})]})});function JG(e){return Br(`MuiInputBase`,e)}var YG=Vr(`MuiInputBase`,[`root`,`formControl`,`focused`,`disabled`,`adornedStart`,`adornedEnd`,`error`,`sizeSmall`,`multiline`,`colorSecondary`,`fullWidth`,`hiddenLabel`,`readOnly`,`input`,`inputSizeSmall`,`inputMultiline`,`inputTypeSearch`,`inputAdornedStart`,`inputAdornedEnd`,`inputHiddenLabel`]),XG,ZG=`mui-auto-fill`,QG=`mui-auto-fill-cancel`,$G=(e,t)=>{let{ownerState:n}=e;return[t.root,n.formControl&&t.formControl,n.startAdornment&&t.adornedStart,n.endAdornment&&t.adornedEnd,n.error&&t.error,n.size===`small`&&t.sizeSmall,n.multiline&&t.multiline,n.color&&t[`color${B(n.color)}`],n.fullWidth&&t.fullWidth,n.hiddenLabel&&t.hiddenLabel]},eK=(e,t)=>{let{ownerState:n}=e;return[t.input,n.size===`small`&&t.inputSizeSmall,n.multiline&&t.inputMultiline,n.type===`search`&&t.inputTypeSearch,n.startAdornment&&t.inputAdornedStart,n.endAdornment&&t.inputAdornedEnd,n.hiddenLabel&&t.inputHiddenLabel]},tK=e=>{let{classes:t,color:n,disabled:r,error:i,endAdornment:a,focused:o,formControl:s,fullWidth:c,hiddenLabel:l,multiline:u,readOnly:d,size:f,startAdornment:p,type:m}=e;return ca({root:[`root`,`color${B(n)}`,r&&`disabled`,i&&`error`,c&&`fullWidth`,o&&`focused`,s&&`formControl`,f&&f!==`medium`&&`size${B(f)}`,u&&`multiline`,p&&`adornedStart`,a&&`adornedEnd`,l&&`hiddenLabel`,d&&`readOnly`],input:[`input`,r&&`disabled`,m===`search`&&`inputTypeSearch`,u&&`inputMultiline`,f===`small`&&`inputSizeSmall`,l&&`inputHiddenLabel`,p&&`inputAdornedStart`,a&&`inputAdornedEnd`,d&&`readOnly`]},JG,t)},nK=R(`div`,{name:`MuiInputBase`,slot:`Root`,overridesResolver:$G})(Nc(({theme:e})=>({...e.typography.body1,color:(e.vars||e).palette.text.primary,lineHeight:`1.4375em`,boxSizing:`border-box`,position:`relative`,cursor:`text`,display:`inline-flex`,alignItems:`center`,[`&.${YG.disabled}`]:{color:(e.vars||e).palette.text.disabled,cursor:`default`},variants:[{props:({ownerState:e})=>e.multiline,style:{padding:`4px 0 5px`}},{props:({ownerState:e,size:t})=>e.multiline&&t===`small`,style:{paddingTop:1}},{props:({ownerState:e})=>e.fullWidth,style:{width:`100%`}}]}))),rK=R(`input`,{name:`MuiInputBase`,slot:`Input`,overridesResolver:eK})(Nc(({theme:e})=>{let t=e.palette.mode===`light`,n={color:`currentColor`,...e.vars?{opacity:e.vars.opacity.inputPlaceholder}:{opacity:t?.42:.5},transition:e.transitions.create(`opacity`,{duration:e.transitions.duration.shorter})},r={opacity:`0 !important`},i=e.vars?{opacity:e.vars.opacity.inputPlaceholder}:{opacity:t?.42:.5};return{font:`inherit`,letterSpacing:`inherit`,color:`currentColor`,padding:`4px 0 5px`,border:0,boxSizing:`content-box`,background:`none`,height:`1.4375em`,margin:0,WebkitTapHighlightColor:`transparent`,display:`block`,minWidth:0,width:`100%`,"&::-webkit-input-placeholder":n,"&::-moz-placeholder":n,"&::-ms-input-placeholder":n,"&:focus":{outline:0},"&:invalid":{boxShadow:`none`},"&::-webkit-search-decoration":{WebkitAppearance:`none`},[`label[data-shrink=false] + .${YG.formControl} &`]:{"&::-webkit-input-placeholder":r,"&::-moz-placeholder":r,"&::-ms-input-placeholder":r,"&:focus::-webkit-input-placeholder":i,"&:focus::-moz-placeholder":i,"&:focus::-ms-input-placeholder":i},[`&.${YG.disabled}`]:{opacity:1,WebkitTextFillColor:(e.vars||e).palette.text.disabled},variants:[{props:({ownerState:e})=>!e.disableInjectingGlobalStyles,style:{animationName:QG,animationDuration:`10ms`,"&:-webkit-autofill":{animationDuration:`5000s`,animationName:ZG}}},{props:{size:`small`},style:{paddingTop:1}},{props:({ownerState:e})=>e.multiline,style:{height:`auto`,resize:`none`,padding:0,paddingTop:0}},{props:{type:`search`},style:{MozAppearance:`textfield`}}]}})),iK=as({[`@keyframes ${ZG}`]:{from:{animationName:ZG}},[`@keyframes ${QG}`]:{from:{animationName:QG}}}),aK=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiInputBase`}),{"aria-describedby":r,autoComplete:i,autoFocus:a,className:o,color:s,components:c={},componentsProps:l={},defaultValue:u,disabled:d,disableInjectingGlobalStyles:f,endAdornment:p,error:m,fullWidth:h=!1,id:g,inputComponent:_=`input`,inputProps:v={},inputRef:b,margin:x,maxRows:S,minRows:C,multiline:w=!1,name:T,onBlur:E,onChange:D,onClick:O,onFocus:k,onKeyDown:A,onKeyUp:j,placeholder:M,readOnly:ee,renderSuffix:N,rows:te,size:ne,slotProps:re={},slots:ie={},startAdornment:ae,type:oe=`text`,value:se,...ce}=n,le=v.value==null?se:v.value,{current:ue}=P.useRef(le!=null),de=P.useRef(),fe=P.useCallback(e=>{},[]),pe=rc(de,b,v.ref,fe),[me,he]=P.useState(!1),ge=Of(),_e=Ef({props:n,muiFormControl:ge,states:[`color`,`disabled`,`error`,`hiddenLabel`,`size`,`required`,`filled`]});_e.focused=ge?ge.focused:me,P.useEffect(()=>{!ge&&d&&me&&(he(!1),E&&E())},[ge,d,me,E]);let ve=ge&&ge.onFilled,ye=ge&&ge.onEmpty,be=P.useCallback(e=>{Bf(e)?ve&&ve():ye&&ye()},[ve,ye]);gl(()=>{ue&&be({value:le})},[le,be,ue]),gl(()=>{if(!a)return;let e=de.current;if(!e)return;let t=fs(e),n=xc(t),r=n==null||n===t.body||n===t.documentElement;e===n?ge&&ge.onFocus?ge.onFocus():he(!0):r&&e.focus()},[a]);let xe=e=>{k&&k(e),v.onFocus&&v.onFocus(e),ge&&ge.onFocus?ge.onFocus(e):he(!0)},Se=e=>{E&&E(e),v.onBlur&&v.onBlur(e),ge&&ge.onBlur?ge.onBlur(e):he(!1)},Ce=(e,...t)=>{if(!ue){let t=e.target||de.current;if(t==null)throw Error(y(1));be({value:t.value})}v.onChange&&v.onChange(e,...t),D&&D(e,...t)};P.useEffect(()=>{be(de.current)},[]);let we=e=>{de.current&&e.currentTarget===e.target&&de.current.focus(),O&&O(e)},Te=_,Ee=v;w&&Te===`input`&&(Ee=te?{type:void 0,minRows:te,maxRows:te,...Ee}:{type:void 0,maxRows:S,minRows:C,...Ee},Te=qG);let De=e=>{be(e.animationName===QG?de.current:{value:`x`})};P.useEffect(()=>{ge&&ge.setAdornedStart(!!ae)},[ge,ae]);let Oe={...n,color:_e.color||`primary`,disabled:_e.disabled,endAdornment:p,error:_e.error,focused:_e.focused,formControl:ge,fullWidth:h,hiddenLabel:_e.hiddenLabel,multiline:w,size:_e.size,startAdornment:ae,type:oe},ke=tK(Oe),Ae=ie.root||c.Root||nK,je=re.root||l.root||{},Me=ie.input||c.Input||rK;return Ee={...Ee,...re.input??l.input},(0,F.jsxs)(P.Fragment,{children:[!f&&typeof iK==`function`&&(XG||=(0,F.jsx)(iK,{})),(0,F.jsxs)(Ae,{...je,ref:t,onClick:we,...ce,...!rs(Ae)&&{ownerState:{...Oe,...je.ownerState}},className:I(ke.root,je.className,o,ee&&`MuiInputBase-readOnly`),children:[ae,(0,F.jsx)(Df.Provider,{value:null,children:(0,F.jsx)(Me,{"aria-invalid":_e.error,"aria-describedby":r,autoComplete:i,autoFocus:a,defaultValue:u,disabled:_e.disabled,id:g,onAnimationStart:De,name:T,placeholder:M,readOnly:ee,required:_e.required,rows:te,value:le,onKeyDown:A,onKeyUp:j,type:oe,...Ee,...!rs(Me)&&{as:Te,ownerState:{...Oe,...Ee.ownerState}},ref:pe,className:I(ke.input,Ee.className,ee&&`MuiInputBase-readOnly`),onBlur:Se,onChange:Ce,onFocus:xe})}),p,N?N({..._e,startAdornment:ae}):null]})]})});function oK(e){return Br(`MuiInput`,e)}var sK={...YG,...Vr(`MuiInput`,[`root`,`underline`,`input`])},cK=e=>{let{classes:t,disableUnderline:n}=e,r=ca({root:[`root`,!n&&`underline`],input:[`input`]},oK,t);return{...t,...r}},lK=R(nK,{shouldForwardProp:e=>Co(e)||e===`classes`,name:`MuiInput`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[...$G(e,t),!n.disableUnderline&&t.underline]}})(Nc(({theme:e})=>{let t=e.palette.mode===`light`?`rgba(0, 0, 0, 0.42)`:`rgba(255, 255, 255, 0.7)`;return e.vars&&(t=e.alpha(e.vars.palette.common.onBackground,e.vars.opacity.inputUnderline)),{position:`relative`,variants:[{props:({ownerState:e})=>e.formControl,style:{"label + &":{marginTop:16}}},{props:({ownerState:e})=>!e.disableUnderline,style:{"&::after":{left:0,bottom:0,content:`""`,position:`absolute`,right:0,transform:`scaleX(0)`,transition:e.transitions.create(`transform`,{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),pointerEvents:`none`},[`&.${sK.focused}:after`]:{transform:`scaleX(1) translateX(0)`},[`&.${sK.error}`]:{"&::before, &::after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:`1px solid ${t}`,left:0,bottom:0,content:`""`,position:`absolute`,right:0,transition:e.transitions.create(`border-bottom-color`,{duration:e.transitions.duration.shorter}),pointerEvents:`none`},[`&:hover:not(.${sK.disabled}, .${sK.error}):before`]:{borderBottom:`2px solid ${(e.vars||e).palette.text.primary}`,"@media (hover: none)":{borderBottom:`1px solid ${t}`}},[`&.${sK.disabled}:before`]:{borderBottomStyle:`dotted`}}},...Object.entries(e.palette).filter(Vd()).map(([t])=>({props:{color:t,disableUnderline:!1},style:{"&::after":{borderBottom:`2px solid ${(e.vars||e).palette[t].main}`}}}))]}})),uK=R(rK,{name:`MuiInput`,slot:`Input`,overridesResolver:eK})({}),dK=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiInput`}),{disableUnderline:r=!1,components:i={},componentsProps:a,fullWidth:o=!1,inputComponent:s=`input`,multiline:c=!1,slotProps:l,slots:u={},type:d=`text`,...f}=n,p=cK(n),m={root:{ownerState:{disableUnderline:r}}},h=l??a?dn(l??a,m):m;return(0,F.jsx)(aK,{slots:{root:u.root??i.Root??lK,input:u.input??i.Input??uK},slotProps:h,fullWidth:o,inputComponent:s,multiline:c,ref:t,type:d,...f,classes:p})});dK.muiName=`Input`;function fK(e){return Br(`MuiFilledInput`,e)}var pK={...YG,...Vr(`MuiFilledInput`,[`root`,`underline`,`input`,`adornedStart`,`adornedEnd`,`sizeSmall`,`multiline`,`hiddenLabel`])},mK=e=>{let{classes:t,disableUnderline:n,startAdornment:r,endAdornment:i,size:a,hiddenLabel:o,multiline:s}=e,c=ca({root:[`root`,!n&&`underline`,r&&`adornedStart`,i&&`adornedEnd`,a===`small`&&`size${B(a)}`,o&&`hiddenLabel`,s&&`multiline`],input:[`input`]},fK,t);return{...t,...c}},hK=R(nK,{shouldForwardProp:e=>Co(e)||e===`classes`,name:`MuiFilledInput`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[...$G(e,t),!n.disableUnderline&&t.underline]}})(Nc(({theme:e})=>{let t=e.palette.mode===`light`,n=t?`rgba(0, 0, 0, 0.42)`:`rgba(255, 255, 255, 0.7)`,r=t?`rgba(0, 0, 0, 0.06)`:`rgba(255, 255, 255, 0.09)`,i=t?`rgba(0, 0, 0, 0.09)`:`rgba(255, 255, 255, 0.13)`,a=t?`rgba(0, 0, 0, 0.12)`:`rgba(255, 255, 255, 0.12)`;return{position:`relative`,backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r,borderTopLeftRadius:(e.vars||e).shape.borderRadius,borderTopRightRadius:(e.vars||e).shape.borderRadius,transition:e.transitions.create(`background-color`,{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),"&:hover":{backgroundColor:e.vars?e.vars.palette.FilledInput.hoverBg:i,"@media (hover: none)":{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r}},[`&.${pK.focused}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r},[`&.${pK.disabled}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.disabledBg:a},variants:[{props:({ownerState:e})=>!e.disableUnderline,style:{"&::after":{left:0,bottom:0,content:`""`,position:`absolute`,right:0,transform:`scaleX(0)`,transition:e.transitions.create(`transform`,{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),pointerEvents:`none`},[`&.${pK.focused}:after`]:{transform:`scaleX(1) translateX(0)`},[`&.${pK.error}`]:{"&::before, &::after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:`1px solid ${e.vars?e.alpha(e.vars.palette.common.onBackground,e.vars.opacity.inputUnderline):n}`,left:0,bottom:0,content:`""`,position:`absolute`,right:0,transition:e.transitions.create(`border-bottom-color`,{duration:e.transitions.duration.shorter}),pointerEvents:`none`},[`&:hover:not(.${pK.disabled}, .${pK.error}):before`]:{borderBottom:`1px solid ${(e.vars||e).palette.text.primary}`},[`&.${pK.disabled}:before`]:{borderBottomStyle:`dotted`}}},...Object.entries(e.palette).filter(Vd()).map(([t])=>({props:{disableUnderline:!1,color:t},style:{"&::after":{borderBottom:`2px solid ${(e.vars||e).palette[t]?.main}`}}})),{props:({ownerState:e})=>e.startAdornment,style:{paddingLeft:12}},{props:({ownerState:e})=>e.endAdornment,style:{paddingRight:12}},{props:({ownerState:e})=>e.multiline,style:{padding:`25px 12px 8px`}},{props:({ownerState:e,size:t})=>e.multiline&&t===`small`,style:{paddingTop:21,paddingBottom:4}},{props:({ownerState:e})=>e.multiline&&e.hiddenLabel,style:{paddingTop:16,paddingBottom:17}},{props:({ownerState:e})=>e.multiline&&e.hiddenLabel&&e.size===`small`,style:{paddingTop:8,paddingBottom:9}}]}})),gK=R(rK,{name:`MuiFilledInput`,slot:`Input`,overridesResolver:eK})(Nc(({theme:e})=>({paddingTop:25,paddingRight:12,paddingBottom:8,paddingLeft:12,...!e.vars&&{"&:-webkit-autofill":{WebkitBoxShadow:e.palette.mode===`light`?null:`0 0 0 100px #266798 inset`,WebkitTextFillColor:e.palette.mode===`light`?null:`#fff`,caretColor:e.palette.mode===`light`?null:`#fff`,borderTopLeftRadius:`inherit`,borderTopRightRadius:`inherit`}},...e.vars&&{"&:-webkit-autofill":{borderTopLeftRadius:`inherit`,borderTopRightRadius:`inherit`},[e.getColorSchemeSelector(`dark`)]:{"&:-webkit-autofill":{WebkitBoxShadow:`0 0 0 100px #266798 inset`,WebkitTextFillColor:`#fff`,caretColor:`#fff`}}},variants:[{props:{size:`small`},style:{paddingTop:21,paddingBottom:4}},{props:({ownerState:e})=>e.hiddenLabel,style:{paddingTop:16,paddingBottom:17}},{props:({ownerState:e})=>e.startAdornment,style:{paddingLeft:0}},{props:({ownerState:e})=>e.endAdornment,style:{paddingRight:0}},{props:({ownerState:e})=>e.hiddenLabel&&e.size===`small`,style:{paddingTop:8,paddingBottom:9}},{props:({ownerState:e})=>e.multiline,style:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0}}]}))),_K=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiFilledInput`}),{disableUnderline:r=!1,components:i={},componentsProps:a,fullWidth:o=!1,hiddenLabel:s,inputComponent:c=`input`,multiline:l=!1,slotProps:u,slots:d={},type:f=`text`,...p}=n,m={...n,disableUnderline:r,fullWidth:o,inputComponent:c,multiline:l,type:f},h=mK(n),g={root:{ownerState:m},input:{ownerState:m}},_=u??a?dn(g,u??a):g;return(0,F.jsx)(aK,{slots:{root:d.root??i.Root??hK,input:d.input??i.Input??gK},slotProps:_,fullWidth:o,inputComponent:c,multiline:l,ref:t,type:f,...p,classes:h})});_K.muiName=`Input`;var vK,yK=R(`fieldset`,{name:`MuiNotchedOutlined`,shouldForwardProp:Co})({textAlign:`left`,position:`absolute`,bottom:0,right:0,top:-5,left:0,margin:0,padding:`0 8px`,pointerEvents:`none`,borderRadius:`inherit`,borderStyle:`solid`,borderWidth:1,overflow:`hidden`,minWidth:`0%`}),bK=R(`legend`,{name:`MuiNotchedOutlined`,shouldForwardProp:Co})(Nc(({theme:e})=>({float:`unset`,width:`auto`,overflow:`hidden`,variants:[{props:({ownerState:e})=>!e.withLabel,style:{padding:0,lineHeight:`11px`,transition:e.transitions.create(`width`,{duration:150,easing:e.transitions.easing.easeOut})}},{props:({ownerState:e})=>e.withLabel,style:{display:`block`,padding:0,height:11,fontSize:`0.75em`,visibility:`hidden`,maxWidth:.01,transition:e.transitions.create(`max-width`,{duration:50,easing:e.transitions.easing.easeOut}),whiteSpace:`nowrap`,"& > span":{paddingLeft:5,paddingRight:5,display:`inline-block`,opacity:0,visibility:`visible`}}},{props:({ownerState:e})=>e.withLabel&&e.notched,style:{maxWidth:`100%`,transition:e.transitions.create(`max-width`,{duration:100,easing:e.transitions.easing.easeOut,delay:50})}}]})));function xK(e){let{children:t,classes:n,className:r,label:i,notched:a,...o}=e,s=i!=null&&i!==``,c={...e,notched:a,withLabel:s};return(0,F.jsx)(yK,{"aria-hidden":!0,className:r,ownerState:c,...o,children:(0,F.jsx)(bK,{ownerState:c,children:s?(0,F.jsx)(`span`,{children:i}):vK||=(0,F.jsx)(`span`,{className:`notranslate`,"aria-hidden":!0,children:``})})})}function SK(e){return Br(`MuiOutlinedInput`,e)}var CK={...YG,...Vr(`MuiOutlinedInput`,[`root`,`notchedOutline`,`input`])},wK=e=>{let{classes:t}=e,n=ca({root:[`root`],notchedOutline:[`notchedOutline`],input:[`input`]},SK,t);return{...t,...n}},TK=R(nK,{shouldForwardProp:e=>Co(e)||e===`classes`,name:`MuiOutlinedInput`,slot:`Root`,overridesResolver:$G})(Nc(({theme:e})=>{let t=e.palette.mode===`light`?`rgba(0, 0, 0, 0.23)`:`rgba(255, 255, 255, 0.23)`;return{position:`relative`,borderRadius:(e.vars||e).shape.borderRadius,[`&:hover .${CK.notchedOutline}`]:{borderColor:(e.vars||e).palette.text.primary},"@media (hover: none)":{[`&:hover .${CK.notchedOutline}`]:{borderColor:e.vars?e.alpha(e.vars.palette.common.onBackground,.23):t}},[`&.${CK.focused} .${CK.notchedOutline}`]:{borderWidth:2},variants:[...Object.entries(e.palette).filter(Vd()).map(([t])=>({props:{color:t},style:{[`&.${CK.focused} .${CK.notchedOutline}`]:{borderColor:(e.vars||e).palette[t].main}}})),{props:{},style:{[`&.${CK.error} .${CK.notchedOutline}`]:{borderColor:(e.vars||e).palette.error.main},[`&.${CK.disabled} .${CK.notchedOutline}`]:{borderColor:(e.vars||e).palette.action.disabled}}},{props:({ownerState:e})=>e.startAdornment,style:{paddingLeft:14}},{props:({ownerState:e})=>e.endAdornment,style:{paddingRight:14}},{props:({ownerState:e})=>e.multiline,style:{padding:`16.5px 14px`}},{props:({ownerState:e,size:t})=>e.multiline&&t===`small`,style:{padding:`8.5px 14px`}}]}})),EK=R(xK,{name:`MuiOutlinedInput`,slot:`NotchedOutline`})(Nc(({theme:e})=>{let t=e.palette.mode===`light`?`rgba(0, 0, 0, 0.23)`:`rgba(255, 255, 255, 0.23)`;return{borderColor:e.vars?e.alpha(e.vars.palette.common.onBackground,.23):t}})),DK=R(rK,{name:`MuiOutlinedInput`,slot:`Input`,overridesResolver:eK})(Nc(({theme:e})=>({padding:`16.5px 14px`,...!e.vars&&{"&:-webkit-autofill":{WebkitBoxShadow:e.palette.mode===`light`?null:`0 0 0 100px #266798 inset`,WebkitTextFillColor:e.palette.mode===`light`?null:`#fff`,caretColor:e.palette.mode===`light`?null:`#fff`,borderRadius:`inherit`}},...e.vars&&{"&:-webkit-autofill":{borderRadius:`inherit`},[e.getColorSchemeSelector(`dark`)]:{"&:-webkit-autofill":{WebkitBoxShadow:`0 0 0 100px #266798 inset`,WebkitTextFillColor:`#fff`,caretColor:`#fff`}}},variants:[{props:{size:`small`},style:{padding:`8.5px 14px`}},{props:({ownerState:e})=>e.multiline,style:{padding:0}},{props:({ownerState:e})=>e.startAdornment,style:{paddingLeft:0}},{props:({ownerState:e})=>e.endAdornment,style:{paddingRight:0}}]}))),OK=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiOutlinedInput`}),{components:r={},fullWidth:i=!1,inputComponent:a=`input`,label:o,multiline:s=!1,notched:c,slots:l={},slotProps:u={},type:d=`text`,...f}=n,p=wK(n),m=Of(),h=Ef({props:n,muiFormControl:m,states:[`color`,`disabled`,`error`,`focused`,`hiddenLabel`,`size`,`required`]}),g={...n,color:h.color||`primary`,disabled:h.disabled,error:h.error,focused:h.focused,formControl:m,fullWidth:i,hiddenLabel:h.hiddenLabel,multiline:s,size:h.size,type:d},_=l.root??r.Root??TK,v=l.input??r.Input??DK,[y,b]=zc(`notchedOutline`,{elementType:EK,className:p.notchedOutline,shouldForwardComponentProp:!0,ownerState:g,externalForwardedProps:{slots:l,slotProps:u},additionalProps:{label:o!=null&&o!==``&&h.required?(0,F.jsxs)(P.Fragment,{children:[o,` `,`*`]}):o}});return(0,F.jsx)(aK,{slots:{root:_,input:v},slotProps:u,renderSuffix:e=>(0,F.jsx)(y,{...b,notched:c===void 0?!!(e.startAdornment||e.filled||e.focused):c}),fullWidth:i,inputComponent:a,multiline:s,ref:t,type:d,...f,classes:{...p,notchedOutline:null}})});OK.muiName=`Input`;var kK=e=>{let{classes:t}=e,n=ca({root:[`root`]},OG,t);return{...t,...n}},AK={name:`MuiSelect`,slot:`Root`,shouldForwardProp:e=>Co(e)&&e!==`variant`},jK=R(dK,AK)(``),MK=R(OK,AK)(``),NK=R(_K,AK)(``),PK=P.forwardRef(function(e,t){let n=cs({name:`MuiSelect`,props:e}),{autoWidth:r=!1,children:i,classes:a={},className:o,defaultOpen:s=!1,displayEmpty:c=!1,IconComponent:l=HG,id:u,input:d,inputProps:f,label:p,labelId:m,MenuProps:h,multiple:g=!1,native:_=!1,onClose:v,onOpen:y,open:b,renderValue:x,SelectDisplayProps:S,variant:C=`outlined`,...w}=n,T=_?DG:VG,E=Ef({props:n,muiFormControl:Of(),states:[`variant`,`error`]}),D=E.variant||C,O={...n,variant:D,classes:a},k=kK(O),{root:A,...j}=k,M=d||{standard:(0,F.jsx)(jK,{ownerState:O}),outlined:(0,F.jsx)(MK,{label:p,ownerState:O}),filled:(0,F.jsx)(NK,{ownerState:O})}[D],ee=rc(t,xs(M));return(0,F.jsx)(P.Fragment,{children:P.cloneElement(M,{inputComponent:T,inputProps:{children:i,error:E.error,IconComponent:l,variant:D,type:void 0,multiple:g,..._?{id:u}:{autoWidth:r,defaultOpen:s,displayEmpty:c,labelId:m,MenuProps:h,onClose:v,onOpen:y,open:b,renderValue:x,SelectDisplayProps:{id:u,...S}},...f,classes:f?dn(j,f.classes):j,...d?d.props.inputProps:{}},...(g&&_||c)&&D===`outlined`?{notched:!0}:{},ref:ee,className:I(M.props.className,o,k.root),...!d&&{variant:D},...w})})});PK.muiName=`Select`;function FK(e,t){if(t==null){e.focus();return}try{e.focus({focusVisible:t===`keyboard`})}catch{e.focus()}}var IK=(e,t)=>{let{ownerState:n}=e;return[t.root,n.dense&&t.dense,n.divider&&t.divider,!n.disableGutters&&t.gutters]},LK=e=>{let{disabled:t,dense:n,divider:r,disableGutters:i,selected:a,classes:o}=e,s=ca({root:[`root`,n&&`dense`,t&&`disabled`,!i&&`gutters`,r&&`divider`,a&&`selected`]},vG,o);return{...o,...s}},RK=R(Ld,{shouldForwardProp:e=>Co(e)||e===`classes`,name:`MuiMenuItem`,slot:`Root`,overridesResolver:IK})(Nc(({theme:e})=>({...e.typography.body1,display:`flex`,justifyContent:`flex-start`,alignItems:`center`,position:`relative`,textDecoration:`none`,minHeight:48,paddingTop:6,paddingBottom:6,boxSizing:`border-box`,whiteSpace:`nowrap`,"&:hover":{textDecoration:`none`,backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:`transparent`}},[`&.${yG.selected}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity),[`&.${yG.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}},[`&.${yG.selected}:hover`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity)}},[`&.${yG.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${yG.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},[`& + .${cG.root}`]:{marginTop:e.spacing(1),marginBottom:e.spacing(1)},[`& + .${cG.inset}`]:{marginLeft:52},[`& .${_G.root}`]:{marginTop:0,marginBottom:0},[`& .${_G.inset}`]:{paddingLeft:36},[`& .${lG.root}`]:{minWidth:36},variants:[{props:({ownerState:e})=>!e.disableGutters,style:{paddingLeft:16,paddingRight:16}},{props:({ownerState:e})=>e.divider,style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`,backgroundClip:`padding-box`}},{props:({ownerState:e})=>!e.dense,style:{[e.breakpoints.up(`sm`)]:{minHeight:`auto`}}},{props:({ownerState:e})=>e.dense,style:{minHeight:32,paddingTop:4,paddingBottom:4,...e.typography.body2,[`& .${lG.root} svg`]:{fontSize:`1.25rem`}}}]}))),zK=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiMenuItem`}),{autoFocus:r=!1,component:i=`li`,dense:a=!1,divider:o=!1,disableGutters:s=!1,focusVisibleClassName:c,role:l=`menuitem`,tabIndex:u,className:d,...f}=n,p=PG(),m=P.useContext(up),h=P.useMemo(()=>({dense:a||m.dense||!1,disableGutters:s}),[m.dense,a,s]),g=P.useRef(null);gl(()=>{r&&g.current&&FK(g.current,p)},[r]);let _={...n,dense:h.dense,divider:o,disableGutters:s},v=LK(n),y=rc(g,t),{root:b,...x}=v,S;return n.disabled||(S=u===void 0?-1:u),(0,F.jsx)(up.Provider,{value:h,children:(0,F.jsx)(RK,{ref:y,role:l,tabIndex:S,component:i,focusVisibleClassName:I(v.focusVisible,c),className:I(v.root,d),...f,ownerState:_,classes:x})})}),BK=()=>{document.querySelectorAll(`.mq-supsub.mq-sup-only`).forEach(e=>{let t=e.previousElementSibling;t&&t.classList.contains(`mq-non-leaf`)&&t.querySelector(`.mq-fraction`)?e.classList.add(`mq-after-fraction-group`):e.classList.remove(`mq-after-fraction-group`)})},{commonMqFontStyles:VK,commonMqKeyboardStyles:HK,longdivStyles:UK,supsubStyles:WK}=PW,GK=Uu(`@pie-lib:math-toolbar:editor-and-pad`),KK=/\.|,/g,qK=R(`div`)(({theme:e})=>({zIndex:9,position:`relative`,textAlign:`center`,width:`auto`,"& > .mq-math-mode":{border:`solid 1px lightgrey`},"& > .mq-focused":{outline:`none`,boxShadow:`none`,border:`dotted 1px ${e.palette.primary.main}`,borderRadius:`0px`},"& .mq-overarrow-inner":{border:`none !important`,paddingTop:`0 !important`},"& .mq-overarrow-inner-right":{display:`none !important`},"& .mq-overarrow-inner-left":{display:`none !important`},"& .mq-longdiv-inner":{borderTop:`1px solid !important`,paddingTop:`1.5px !important`},"& .mq-overarrow.mq-arrow-both":{top:`7.8px`,marginTop:`0px`,minWidth:`1.23em`},"& .mq-parallelogram":{lineHeight:.85}})),JK=R(`div`)(({theme:e,hide:t})=>({display:t?`none`:`flex`,alignItems:`center`,"& .mq-editable-field .mq-cursor":{top:`-4px`},"& .mq-math-mode .mq-selection, .mq-editable-field .mq-selection":{paddingTop:`18px`},"& .mq-math-mode .mq-overarrow":{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`},"& .mq-math-mode .mq-overline .mq-overline-inner":{paddingTop:`0.4em !important`},"& .mq-overarrow.mq-arrow-both":{minWidth:`1.23em`,"& *":{lineHeight:`1 !important`},"&:before":{top:`-0.45em`,left:`-1px`},"&:after":{position:`absolute !important`,top:`0px !important`,right:`-2px`},"&.mq-empty:after":{top:`-0.45em`}},"& .mq-overarrow.mq-arrow-right":{"&:before":{top:`-0.4em`,right:`-1px`}},"& *":{...VK,...WK,...UK,"& .mq-math-mode .mq-sqrt-prefix":{verticalAlign:`baseline !important`,top:`1px !important`,left:`-0.1em !important`},"& .mq-math-mode .mq-overarc ":{paddingTop:`0.45em !important`},"& .mq-math-mode .mq-empty":{padding:`9px 1px !important`},"& .mq-math-mode .mq-root-block":{paddingTop:`10px`},"& .mq-scaled .mq-sqrt-prefix":{top:`0 !important`},"& .mq-math-mode .mq-longdiv .mq-longdiv-inner":{marginLeft:`4px !important`,paddingTop:`6px !important`,paddingLeft:`6px !important`},"& .mq-math-mode .mq-paren":{verticalAlign:`top !important`,padding:`1px 0.1em !important`},"& .mq-math-mode .mq-sqrt-stem":{borderTop:`0.07em solid`,marginLeft:`-1.5px`,marginTop:`-2px !important`,paddingTop:`5px !important`},"& .mq-math-mode .mq-denominator":{marginTop:`-5px !important`,padding:`0.5em 0.1em 0.1em !important`},"& .mq-math-mode .mq-numerator, .mq-math-mode .mq-over":{padding:`0 0.1em !important`,paddingBottom:`0 !important`,marginBottom:`-2px`}},'& span[data-prime="true"]':{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`}})),YK=R(Gf)({flex:`initial`,width:`25%`,minWidth:`100px`,marginLeft:`15px`,marginTop:`5px`,marginBottom:`5px`,marginRight:`5px`,"& label":{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`},"& div":{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`}}),XK=R(Rf)(()=>({backgroundColor:`transparent`})),ZK=R(`div`)(({theme:e,error:t})=>({minWidth:`500px`,maxWidth:`900px`,minHeight:`30px`,width:`100%`,display:`flex`,marginTop:e.spacing(1),marginBottom:e.spacing(1),...t&&{border:`2px solid red`},"& .mq-sqrt-prefix .mq-scaled":{verticalAlign:`middle !important`}})),QK=R(CW)(({controlledKeypadMode:e})=>({maxWidth:e?`400px`:`500px`,color:Il(),backgroundColor:iu(),padding:`2px`})),$K=R(ff)({position:`absolute`,right:`12px`,border:`1px solid lightgrey`,color:Il()}),eq=R(`hr`)(({theme:e})=>({padding:0,margin:0,height:`1px`,border:`none`,borderBottom:`solid 1px ${e.palette.primary.main}`})),tq=R(GW)(({mode:e})=>({...HK,...e===`language`&&{"& *":{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`}}})),nq=e=>{if(!e)return;let{type:t,value:n}=e;return t===`command`||t===`cursor`?e:t===`answer`?{type:`answer`,...e}:n===`clear`?{type:`clear`}:{type:`write`,value:n}},rq=class extends P.Component{static propTypes={classNames:v.object,keypadMode:v.oneOfType([v.string,v.number]),autoFocus:v.bool,allowAnswerBlock:v.bool,showKeypad:v.bool,controlledKeypad:v.bool,controlledKeypadMode:v.bool,error:v.string,noDecimal:v.bool,hideInput:v.bool,noLatexHandling:v.bool,layoutForKeyPad:v.object,maxResponseAreas:v.number,additionalKeys:v.array,latex:v.string.isRequired,onAnswerBlockAdd:v.func,onFocus:v.func,onBlur:v.func,onChange:v.func.isRequired,setKeypadInteraction:v.func};constructor(e){super(e),this.state={equationEditor:`item-authoring`,addDisabled:!1}}componentDidMount(){this.input&&this.props.autoFocus&&setTimeout(()=>this.input.focus(),0)}onClick=e=>{let{noDecimal:t,noLatexHandling:n,onChange:r}=this.props,i=nq(e);if(GK(`mathChange: `,i),n){r(i.value);return}t&&(i.value===`.`||i.value===`,`)||i&&(i.type===`clear`?(GK(`call clear...`),this.input.clear()):i.type===`command`?this.input.command(i.value):i.type===`cursor`?this.input.keystroke(i.value):i.type===`answer`?this.input.write(`%response%`):this.input.write(i.value))};updateDisable=e=>{let{maxResponseAreas:t}=this.props;if(t){let n=this.checkResponseAreasNumber(t,e);this.setState({addDisabled:n})}};onAnswerBlockClick=()=>{this.props.onAnswerBlockAdd(),this.onClick({type:`answer`}),this.updateDisable(!0)};onEditorChange=e=>{let{onChange:t,noDecimal:n}=this.props;if(gH(),BK(),this.updateDisable(!0),n&&(e.indexOf(`.`)!==-1||e.indexOf(`,`)!==-1)&&this.input){this.input.clear(),this.input.write(e.replace(KK,``));return}let r=e.match(/[0-9]\\ \\frac\{[^\{]*\}\{ \}/);if(this.input&&r&&r?.length){try{this.input.mathField.__controller.cursor.insLeftOf(this.input.mathField.__controller.cursor.parent[-1].parent),this.input.mathField.el().dispatchEvent(new KeyboardEvent(`keydown`,{keyCode:8}))}catch(e){console.error(e.toString())}return}t(e)};shouldComponentUpdate(e,t){let n=this.input.mathField.latex()!==e.latex;return GK(`[shouldComponentUpdate] `,`inputIsDifferent: `,n),!zp(this.props.error,e.error)||!n&&this.props.keypadMode!==e.keypadMode||!n&&this.props.noDecimal!==e.noDecimal||!n&&this.state.equationEditor!==t.equationEditor?!0:!n&&this.props.controlledKeypad?this.props.showKeypad!==e.showKeypad:n}onEditorTypeChange=e=>{this.setState({equationEditor:e.target.value})};checkResponseAreasNumber=(e,t)=>{let{latex:n}=this.input&&this.input.props||{};if(n){let r=(n.match(/answerBlock/g)||[]).length;return t?r===e-1:r===e}return!1};render(){let{classNames:e,keypadMode:t,allowAnswerBlock:n,additionalKeys:r,controlledKeypad:i,controlledKeypadMode:a,showKeypad:o,setKeypadInteraction:s,noDecimal:c,hideInput:l,layoutForKeyPad:u,latex:d,onFocus:f,onBlur:p,error:m}=this.props,h=!i||i&&o,{addDisabled:g}=this.state;return GK(`[render]`,d),(0,F.jsxs)(qK,{className:e.mathToolbar,children:[(0,F.jsxs)(JK,{hide:l,children:[a&&(0,F.jsxs)(YK,{variant:`standard`,children:[(0,F.jsx)(XK,{id:`equation-editor-label`,children:`Equation Editor`}),(0,F.jsxs)(PK,{labelId:`equation-editor-label`,id:`equation-editor-select`,name:`equationEditor`,label:`Equation Editor`,onChange:this.onEditorTypeChange,value:this.state.equationEditor,MenuProps:{transitionDuration:{enter:225,exit:195}},children:[(0,F.jsx)(zK,{value:`non-negative-integers`,children:`Numeric - Non-Negative Integers`}),(0,F.jsx)(zK,{value:`integers`,children:`Numeric - Integers`}),(0,F.jsx)(zK,{value:`decimals`,children:`Numeric - Decimals`}),(0,F.jsx)(zK,{value:`fractions`,children:`Numeric - Fractions`}),(0,F.jsx)(zK,{value:1,children:`Grade 1 - 2`}),(0,F.jsx)(zK,{value:3,children:`Grade 3 - 5`}),(0,F.jsx)(zK,{value:6,children:`Grade 6 - 7`}),(0,F.jsx)(zK,{value:8,children:`Grade 8 - HS`}),(0,F.jsx)(zK,{value:`geometry`,children:`Geometry`}),(0,F.jsx)(zK,{value:`advanced-algebra`,children:`Advanced Algebra`}),(0,F.jsx)(zK,{value:`statistics`,children:`Statistics`}),(0,F.jsx)(zK,{value:`item-authoring`,children:`Item Authoring`})]})]}),(0,F.jsx)(ZK,{error:m,children:(0,F.jsx)(QK,{onFocus:()=>{f&&f(),this.updateDisable(!1)},onBlur:e=>{this.updateDisable(!1),p&&p(e)},className:e&&e.editor||``,controlledKeypadMode:a,ref:e=>this.input=e,latex:d,onChange:this.onEditorChange})})]}),n&&(0,F.jsx)($K,{type:`primary`,style:{bottom:h?`320px`:`20px`},onClick:this.onAnswerBlockClick,disabled:g,children:`+ Response Area`}),(0,F.jsx)(eq,{}),h&&(0,F.jsx)(tq,{mode:a?this.state.equationEditor:t,controlledKeypadMode:a,layoutForKeyPad:u,additionalKeys:r,onClick:this.onClick,noDecimal:c,setKeypadInteraction:s})]})}},iq=R(uR)(({hideBackground:e})=>({verticalAlign:`top`,width:`28px`,height:`28px`,color:`#00bb00`,...e&&{backgroundColor:yu(),"&:hover":{backgroundColor:au()}},"& .MuiIconButton-label":{position:`absolute`,top:`2px`}})),aq=({onClick:e,hideBackground:t})=>(0,F.jsx)(iq,{"aria-label":`Done`,onClick:e,hideBackground:t,size:`large`,children:(0,F.jsx)(pR,{})});aq.propTypes={onClick:v.func,hideBackground:v.bool};var oq=aq,{commonMqFontStyles:sq,longdivStyles:cq,supsubStyles:lq}=PW,uq=Uu(`@pie-lib:math-toolbar:math-preview`),dq=R(`div`)(({theme:e,isSelected:t})=>({display:`inline-flex`,alignItems:`center`,position:`relative`,"& *":sq,...lq,...cq,"& > .mq-math-mode":{border:t?`solid 0px lightgrey`:`solid 1px lightgrey`},"& > .mq-focused":{outline:`none`,boxShadow:`none`,border:`solid 1px black`,borderRadius:`0px`},"& > .mq-math-mode .mq-root-block":{paddingTop:`7px !important`},"& > .mq-math-mode .mq-overarc ":{paddingTop:`0.45em !important`},"& > .mq-math-mode .mq-sqrt-prefix":{verticalAlign:`baseline !important`,top:`1px !important`,left:`-0.1em !important`},"& > .mq-math-mode .mq-denominator":{marginTop:`-5px !important`,padding:`0.5em 0.1em 0.1em !important`},"& > .mq-math-mode .mq-numerator, .mq-math-mode .mq-over":{padding:`0 0.1em !important`,paddingBottom:`0 !important`,marginBottom:`-2px`},"& > .mq-math-mode .mq-longdiv .mq-longdiv-inner .mq-empty":{paddingTop:`6px !important`,paddingLeft:`4px !important`},"& > .mq-math-mode .mq-longdiv .mq-longdiv-inner":{marginLeft:`0 !important`},"& > .mq-math-mode .mq-overarrow":{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`},"& > .mq-math-mode .mq-paren":{verticalAlign:`top !important`,padding:`1px 0.1em !important`},"& > .mq-math-mode .mq-sqrt-stem":{borderTop:`0.07em solid`,marginLeft:`-1.5px`,marginTop:`-2px !important`,paddingTop:`5px !important`},"& .mq-overarrow-inner":{paddingTop:`0 !important`,border:`none !important`},"& .mq-editable-field .mq-cursor":{marginTop:`-15px !important`},"& .mq-overarrow.mq-arrow-both":{top:`7.5px`,marginTop:`0px`,minWidth:`1.23em`,"& *":{lineHeight:`1 !important`},"&:before":{top:`-0.4em`,left:`-1px`},"&:after":{top:`0px !important`,position:`absolute !important`,right:`-2px`},"&.mq-empty:after":{top:`-0.45em`}},"& .mq-overarrow.mq-arrow-right":{"&:before":{top:`-0.4em`,right:`-1px`}},"& .mq-overarrow-inner-right":{display:`none !important`},"& .mq-overarrow-inner-left":{display:`none !important`},"& .mq-longdiv-inner":{borderTop:`1px solid !important`,paddingTop:`1.5px !important`},"& .mq-parallelogram":{lineHeight:.85},'& span[data-prime="true"]':{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`},...t&&{border:`solid 1px ${e.palette.primary.main}`}})),fq=R(`span`)({position:`absolute`,bottom:0,left:0,right:0,top:0}),pq=class extends P.Component{static propTypes={latex:v.string,isSelected:v.bool,onFocus:v.func,onBlur:v.func};componentDidMount(){BK()}componentDidUpdate(e){this.props.latex!==e.latex&&BK()}render(){let{isSelected:e,onFocus:t,onBlur:n,latex:r}=this.props;return uq(`[render] latex: `,r),(0,F.jsxs)(dq,{isSelected:e,children:[` `,(0,F.jsx)(fq,{}),(0,F.jsx)(kW,{latex:r,onFocus:t,onBlur:n})]})}},mq=R(`div`)({display:`flex`,width:`100%`,zIndex:8,alignItems:`center`}),hq=class extends P.Component{static propTypes={autoFocus:v.bool,allowAnswerBlock:v.bool,controlledKeypad:v.bool,controlledKeypadMode:v.bool,keypadMode:v.oneOfType([v.string,v.number]),classNames:v.object,error:v.string,maxResponseAreas:v.number,showKeypad:v.bool,noDecimal:v.bool,additionalKeys:v.array,latex:v.string.isRequired,onAnswerBlockAdd:v.func,onChange:v.func,onDone:v.func.isRequired,onFocus:v.func,onBlur:v.func,hideDoneButton:v.bool,keyPadCharacterRef:v.func,setKeypadInteraction:v.func};static defaultProps={classNames:{},keypadMode:`item-authoring`,autoFocus:!1,allowAnswerBlock:!1,controlledKeypad:!1,controlledKeypadMode:!1,noDecimal:!1,showKeypad:!0,additionalKeys:[],onChange:()=>{},onAnswerBlockAdd:()=>{},onFocus:()=>{},hideDoneButton:!1};constructor(e){super(e),this.state={latex:e.latex}}done=()=>{this.props.onDone(this.state.latex)};UNSAFE_componentWillReceiveProps(e){this.setState({latex:e.latex})}onChange=e=>{this.setState({latex:e}),this.props.onChange(e)};render(){let{latex:e}=this.state,{classNames:t,autoFocus:n,allowAnswerBlock:r,onAnswerBlockAdd:i,controlledKeypad:a,controlledKeypadMode:o,keypadMode:s,noDecimal:c,additionalKeys:l,showKeypad:u,onFocus:d,onBlur:f,hideDoneButton:p,error:m,keyPadCharacterRef:h,setKeypadInteraction:g,maxResponseAreas:_}=this.props;return(0,F.jsx)(gq,{autoFocus:n,classNames:t,onAnswerBlockAdd:i,allowAnswerBlock:r,latex:e,additionalKeys:l,noDecimal:c,keypadMode:s,keyPadCharacterRef:h,setKeypadInteraction:g,onChange:this.onChange,onDone:this.done,onFocus:d,onBlur:f,showKeypad:u,controlledKeypad:a,controlledKeypadMode:o,hideDoneButton:p,error:m,maxResponseAreas:_})}},gq=class extends P.Component{static propTypes={classNames:v.object,latex:v.string.isRequired,keypadMode:v.oneOfType([v.string,v.number]),hideInput:v.bool,noLatexHandling:v.bool,layoutForKeyPad:v.object,onChange:v.func.isRequired,onDone:v.func.isRequired,onBlur:v.func,onAnswerBlockAdd:v.func,additionalKeys:v.array,onFocus:v.func,autoFocus:v.bool,noDecimal:v.bool,allowAnswerBlock:v.bool,controlledKeypad:v.bool,controlledKeypadMode:v.bool,showKeypad:v.bool,hideDoneButton:v.bool,hideDoneButtonBackground:v.bool,error:v.any,maxResponseAreas:v.number,keyPadCharacterRef:v.object,setKeypadInteraction:v.func};static defaultProps={classNames:{},hideDoneButtonBackground:!1};render(){let{classNames:e,autoFocus:t,allowAnswerBlock:n,onAnswerBlockAdd:r,controlledKeypad:i,controlledKeypadMode:a,additionalKeys:o,showKeypad:s,keypadMode:c,noDecimal:l,hideInput:u,noLatexHandling:d,layoutForKeyPad:f,keyPadCharacterRef:p,setKeypadInteraction:m,latex:h,onChange:g,onDone:_,onFocus:v,onBlur:y,hideDoneButton:b,hideDoneButtonBackground:x,error:S,maxResponseAreas:C}=this.props;return(0,F.jsxs)(mq,{className:e&&e.toolbar||``,ref:p,children:[(0,F.jsx)(`div`,{}),(0,F.jsx)(rq,{autoFocus:t,keypadMode:c,classNames:e||{},controlledKeypad:i,controlledKeypadMode:a,noDecimal:l,hideInput:u,noLatexHandling:d,layoutForKeyPad:f,showKeypad:s,additionalKeys:o,allowAnswerBlock:n,onAnswerBlockAdd:r,latex:h,onChange:g,onFocus:v,onBlur:y,error:S,maxResponseAreas:C,setKeypadInteraction:m}),(!i||i&&s)&&!b&&(0,F.jsx)(oq,{hideBackground:x,onClick:_})]})}},_q=new ry(`ensureTextAfterMath`),vq=(e=[])=>e.map(e=>({name:e,latex:e,write:e,label:e})),yq=e=>new ey({key:_q,appendTransaction:(t,n,r)=>{if(!t.some(e=>e.docChanged))return null;let i=r.tr,a=!1;return r.doc.descendants((t,n)=>{if(t.type.name===e){let e=n+t.nodeSize,o=r.doc.nodeAt(e);(!o||o.type.name!==`text`)&&(i.insert(e,r.schema.text(``)),a=!0)}}),a?i:null}}),bq=(e,t)=>{let n;for(n=t;n>0;n--){let t=e.nodeAt(n);if(t?.type?.name===`text`&&t.textContent!==``)return-1;if(t&&t?.type?.name!==`text`)break}return n},xq=new ey({key:new ry(`zeroWidthSpaceHandling`),props:{handleKeyDown(e,t){let{state:n,dispatch:r}=e,{selection:i,doc:a}=n,{from:o,empty:s}=i;if(s&&t.key===`Backspace`&&o>0){let e=bq(a,o);return e===-1?!1:(r(n.tr.delete(e,o)),!0)}if(s&&t.key===`ArrowLeft`&&o>0){let e=bq(a,o);if(e===-1)return!1;let t=n.doc.resolve(e);if(t.nodeAfter||t.nodeBefore){let t=n.doc.resolve(e);return r(n.tr.setSelection(Rv.create(n.doc,t.pos))),!0}else return r(n.tr.setSelection(Iv.create(n.doc,o-2))),!0}return!1}}}),Sq=wO.create({name:`math`,group:`inline`,inline:!0,atom:!0,addAttributes(){return{latex:{default:``},wrapper:{default:null},html:{default:null}}},addProseMirrorPlugins(){return[yq(this.name),xq]},parseHTML(){return[{tag:`span[data-latex]`,getAttrs:e=>({latex:e.getAttribute(`data-raw`)||e.textContent})},{tag:`span[data-type="mathml"]`,getAttrs:e=>({html:e.innerHTML})}]},addCommands(){return{insertMath:(e=``)=>({tr:t,editor:n,dispatch:r})=>{let{state:i}=n.view,a=i.schema.nodes.math.create({latex:e}),{selection:o}=i,s=o.$from.pos;if(t.insert(s,a),a?.type?.name===this.name){let e=Rv.create(t.doc,o.$from.pos);t.setSelection(e)}return r(t),SR(n,!0),!0}}},renderHTML({HTMLAttributes:e}){return e.html?[`span`,{"data-type":`mathml`,dangerouslySetInnerHTML:{__html:e.html}}]:[`span`,{"data-latex":``,"data-raw":e.latex},gd(e.latex,e.wrapper)]},addNodeView(){return iA(e=>(0,F.jsx)(Cq,{...e,options:this.options}))}}),Cq=e=>{let{node:t,updateAttributes:n,editor:r,selected:i,options:a,getPos:o}=e,[s,c]=(0,P.useState)(i),l=(0,P.useRef)(null),u=(0,P.useRef)(null),d=(0,P.useRef)(Date.now()),[f,p]=(0,P.useState)({top:0,left:0}),{math:m={}}=a||{},{keypadMode:h,controlledKeypadMode:g=!0,customKeys:_=[],keyPadCharacterRef:v,setKeypadInteraction:y}=m,b=t.attrs.latex||``,x=e=>{n({latex:e})},S=(e,{moveCursorAfterNode:i=!0}={})=>{if(n({latex:e}),c(!1),i&&typeof o==`function`){let e=o(),{doc:n}=r.state,i=Iv.create(n,e+t.nodeSize),a=r.state.tr.setSelection(i);r.view.dispatch(a)}r.commands.focus()};return(0,P.useEffect)(()=>{if(!i)return;let{selection:e}=r.state;e.node?.type?.name===`math`&&c(!0)},[i,r]),(0,P.useEffect)(()=>{SR(r,i||s)},[r,s,i]),(0,P.useEffect)(()=>{if(!r||!s){p({top:0,left:0});return}let e=()=>{if(!l.current)return;let{from:e}=r.state.selection,t=r.view.coordsAtPos(e),n=u.current?.getBoundingClientRect?.(),i=n?.height?n.top:t.top,a=n?.width?n.left:t.left,o=n?.height?n.bottom:t.bottom??t.top,s=l.current.offsetHeight,c=l.current.offsetWidth,d=window.innerHeight-(o+0)>=s?o+0:i-s-0,f=a;d=Math.max(8,Math.min(d,window.innerHeight-s-8)),f=Math.max(8,Math.min(f,window.innerWidth-c-8));let m=(r._tiptapContainerEl||document.body).getBoundingClientRect();p({top:d-m.top,left:f-m.left})};e();let t=null,n=()=>{t===null&&(t=requestAnimationFrame(()=>{t=null,e()}))};return t=requestAnimationFrame(()=>{t=null,e()}),window.addEventListener(`scroll`,n,!0),window.addEventListener(`resize`,n),()=>{t!==null&&cancelAnimationFrame(t),window.removeEventListener(`scroll`,n,!0),window.removeEventListener(`resize`,n)}},[r,s]),(0,P.useEffect)(()=>{let e=e=>{let n=e?.target,i=(document.querySelectorAll?.(`[id^="equation-editor-select"][id*="listbox"], [aria-labelledby="equation-editor-label"][role="listbox"]`)||[]).length>0,a=!!(n?.id&&n.id.includes(`equation-editor-select`))||!!n?.closest?.(`[id*="equation-editor-select"]`),o=!!n?.closest?.(`.math-node-${d.current}`);if(l.current&&!l.current.contains(n)&&!n?.closest?.(`[data-inline-node]`)&&!i&&!a&&!o){c(!1);let e=!!r?.view?.dom?.contains(n);S(t.attrs.latex,{moveCursorAfterNode:!e})}};return s?document.addEventListener(`click`,e):document.removeEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[r,s,t]),(0,F.jsxs)(Wk,{className:`math-node-${d.current}`,style:{display:`inline-flex`,cursor:`pointer`,margin:`0 4px`},"data-selected":i,children:[(0,F.jsx)(`div`,{ref:u,onClick:()=>c(!0),contentEditable:!1,children:(0,F.jsx)(pq,{latex:b})}),s&&Ms.createPortal((0,F.jsx)(`div`,{ref:l,"data-toolbar-for":r.instanceId,style:{position:`absolute`,top:`${f.top}px`,left:`${f.left}px`,zIndex:1e3,background:`var(--editable-html-toolbar-bg, #efefef)`,boxShadow:`0px 1px 5px 0px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 3px 1px -2px rgba(0, 0, 0, 0.12)`},children:(0,F.jsx)(hq,{latex:b,autoFocus:!0,onChange:x,onDone:S,keypadMode:h,controlledKeypadMode:g,additionalKeys:vq(_),keyPadCharacterRef:v,setKeypadInteraction:y})}),r?._tiptapContainerEl||document.body)]})};function wq(e){return Br(`MuiLinearProgress`,e)}Vr(`MuiLinearProgress`,[`root`,`colorPrimary`,`colorSecondary`,`determinate`,`indeterminate`,`buffer`,`query`,`dashed`,`dashedColorPrimary`,`dashedColorSecondary`,`bar`,`bar1`,`bar2`,`barColorPrimary`,`barColorSecondary`,`bar1Indeterminate`,`bar1Determinate`,`bar1Buffer`,`bar2Indeterminate`,`bar2Buffer`]);var Tq=4,Eq=Lt`
|
|
306
306
|
0% {
|
|
307
307
|
left: -35%;
|
|
308
308
|
right: 100%;
|
|
@@ -317,9 +317,9 @@ mid `,`∤`),Z.intercal=Z[`⊺`]=q($,`\\intercal `,`⊺`),Z.veebar=Z[`
|
|
|
317
317
|
left: 100%;
|
|
318
318
|
right: -90%;
|
|
319
319
|
}
|
|
320
|
-
`,
|
|
321
|
-
animation: ${
|
|
322
|
-
`,
|
|
320
|
+
`,Dq=typeof Eq==`string`?null:It`
|
|
321
|
+
animation: ${Eq} 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;
|
|
322
|
+
`,Oq=Lt`
|
|
323
323
|
0% {
|
|
324
324
|
left: -200%;
|
|
325
325
|
right: 100%;
|
|
@@ -334,9 +334,9 @@ mid `,`∤`),Z.intercal=Z[`⊺`]=q($,`\\intercal `,`⊺`),Z.veebar=Z[`
|
|
|
334
334
|
left: 107%;
|
|
335
335
|
right: -8%;
|
|
336
336
|
}
|
|
337
|
-
`,
|
|
338
|
-
animation: ${
|
|
339
|
-
`,
|
|
337
|
+
`,kq=typeof Oq==`string`?null:It`
|
|
338
|
+
animation: ${Oq} 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) 1.15s infinite;
|
|
339
|
+
`,Aq=Lt`
|
|
340
340
|
0% {
|
|
341
341
|
opacity: 1;
|
|
342
342
|
background-position: 0 -23px;
|
|
@@ -351,9 +351,9 @@ mid `,`∤`),Z.intercal=Z[`⊺`]=q($,`\\intercal `,`⊺`),Z.veebar=Z[`
|
|
|
351
351
|
opacity: 1;
|
|
352
352
|
background-position: -200px -23px;
|
|
353
353
|
}
|
|
354
|
-
`,
|
|
355
|
-
animation: ${
|
|
356
|
-
`,Pq=e=>{let{classes:t,variant:n,color:r}=e;return ca({root:[`root`,`color${B(r)}`,n],dashed:[`dashed`,`dashedColor${B(r)}`],bar1:[`bar`,`bar1`,`barColor${B(r)}`,(n===`indeterminate`||n===`query`)&&`bar1Indeterminate`,n===`determinate`&&`bar1Determinate`,n===`buffer`&&`bar1Buffer`],bar2:[`bar`,`bar2`,n!==`buffer`&&`barColor${B(r)}`,n===`buffer`&&`color${B(r)}`,(n===`indeterminate`||n===`query`)&&`bar2Indeterminate`,n===`buffer`&&`bar2Buffer`]},Eq,t)},Fq=(e,t)=>e.vars?e.vars.palette.LinearProgress[`${t}Bg`]:e.palette.mode===`light`?e.lighten(e.palette[t].main,.62):e.darken(e.palette[t].main,.5),Iq=R(`span`,{name:`MuiLinearProgress`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`color${B(n.color)}`],t[n.variant]]}})(Nc(({theme:e})=>({position:`relative`,overflow:`hidden`,display:`block`,height:4,zIndex:0,"@media print":{colorAdjust:`exact`},variants:[...Object.entries(e.palette).filter(Vd()).map(([t])=>({props:{color:t},style:{backgroundColor:Fq(e,t)}})),{props:({ownerState:e})=>e.color===`inherit`&&e.variant!==`buffer`,style:{"&::before":{content:`""`,position:`absolute`,left:0,top:0,right:0,bottom:0,backgroundColor:`currentColor`,opacity:.3}}},{props:{variant:`buffer`},style:{backgroundColor:`transparent`}},{props:{variant:`query`},style:{transform:`rotate(180deg)`}}]}))),Lq=R(`span`,{name:`MuiLinearProgress`,slot:`Dashed`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.dashed,t[`dashedColor${B(n.color)}`]]}})(Nc(({theme:e})=>({position:`absolute`,marginTop:0,height:`100%`,width:`100%`,backgroundSize:`10px 10px`,backgroundPosition:`0 -23px`,variants:[{props:{color:`inherit`},style:{opacity:.3,backgroundImage:`radial-gradient(currentColor 0%, currentColor 16%, transparent 42%)`}},...Object.entries(e.palette).filter(Vd()).map(([t])=>{let n=Fq(e,t);return{props:{color:t},style:{backgroundImage:`radial-gradient(${n} 0%, ${n} 16%, transparent 42%)`}}})]})),Nq||{animation:`${Mq} 3s infinite linear`}),Rq=R(`span`,{name:`MuiLinearProgress`,slot:`Bar1`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.bar,t.bar1,t[`barColor${B(n.color)}`],(n.variant===`indeterminate`||n.variant===`query`)&&t.bar1Indeterminate,n.variant===`determinate`&&t.bar1Determinate,n.variant===`buffer`&&t.bar1Buffer]}})(Nc(({theme:e})=>({width:`100%`,position:`absolute`,left:0,bottom:0,top:0,transition:`transform 0.2s linear`,transformOrigin:`left`,variants:[{props:{color:`inherit`},style:{backgroundColor:`currentColor`}},...Object.entries(e.palette).filter(Vd()).map(([t])=>({props:{color:t},style:{backgroundColor:(e.vars||e).palette[t].main}})),{props:{variant:`determinate`},style:{transition:`transform .${Dq}s linear`}},{props:{variant:`buffer`},style:{zIndex:1,transition:`transform .${Dq}s linear`}},{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:{width:`auto`}},{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:kq||{animation:`${Oq} 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite`}}]}))),zq=R(`span`,{name:`MuiLinearProgress`,slot:`Bar2`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.bar,t.bar2,t[`barColor${B(n.color)}`],(n.variant===`indeterminate`||n.variant===`query`)&&t.bar2Indeterminate,n.variant===`buffer`&&t.bar2Buffer]}})(Nc(({theme:e})=>({width:`100%`,position:`absolute`,left:0,bottom:0,top:0,transition:`transform 0.2s linear`,transformOrigin:`left`,variants:[...Object.entries(e.palette).filter(Vd()).map(([t])=>({props:{color:t},style:{"--LinearProgressBar2-barColor":(e.vars||e).palette[t].main}})),{props:({ownerState:e})=>e.variant!==`buffer`&&e.color!==`inherit`,style:{backgroundColor:`var(--LinearProgressBar2-barColor, currentColor)`}},{props:({ownerState:e})=>e.variant!==`buffer`&&e.color===`inherit`,style:{backgroundColor:`currentColor`}},{props:{color:`inherit`},style:{opacity:.3}},...Object.entries(e.palette).filter(Vd()).map(([t])=>({props:{color:t,variant:`buffer`},style:{backgroundColor:Fq(e,t),transition:`transform .${Dq}s linear`}})),{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:{width:`auto`}},{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:jq||{animation:`${Aq} 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) 1.15s infinite`}}]}))),Bq=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiLinearProgress`}),{className:r,color:i=`primary`,value:a,valueBuffer:o,variant:s=`indeterminate`,...c}=n,l={...n,color:i,variant:s},u=Pq(l),d=Di(),f={},p={bar1:{},bar2:{}};if((s===`determinate`||s===`buffer`)&&a!==void 0){f[`aria-valuenow`]=Math.round(a),f[`aria-valuemin`]=0,f[`aria-valuemax`]=100;let e=a-100;d&&(e=-e),p.bar1.transform=`translateX(${e}%)`}if(s===`buffer`&&o!==void 0){let e=(o||0)-100;d&&(e=-e),p.bar2.transform=`translateX(${e}%)`}return(0,F.jsxs)(Iq,{className:I(u.root,r),ownerState:l,role:`progressbar`,...f,ref:t,...c,children:[s===`buffer`?(0,F.jsx)(Lq,{className:u.dashed,ownerState:l}):null,(0,F.jsx)(Rq,{className:u.bar1,ownerState:l,style:p.bar1}),s===`determinate`?null:(0,F.jsx)(zq,{className:u.bar2,ownerState:l,style:p.bar2})]})}),Vq=(e,t)=>{if(!e||!t)return null;let n=null;return e.state.doc.descendants((e,r)=>{if(n!==null)return!1;if(e.type.name===`imageUploadNode`&&e.attrs.nodeKey===t)return n=[e,r],!1}),n},Hq=()=>`img-${Date.now()}-${Math.random().toString(36).slice(2)}`,Uq=Uu(`@pie-lib:editable-html:image:insert-image-handler`),Wq=class{constructor(e,t,n,r=!1){this.editor=e,this.nodeInfo=t,this.node=t[0],this.nodePos=t[1],this.onFinish=n,this.isPasted=r,this.chosenFile=null,this.nodeKey=this.node?.attrs?.nodeKey||null}resolveNodePos(){let e=Vq(this.editor,this.nodeKey);return e?e[1]:this.nodeKey?null:this.nodePos}cancel(){Uq(`insert cancelled`);try{this.deleteNode(),this.onFinish(!1)}catch{}finally{this.editor._insertingImage=!1}}updateNode(e){let t=this.resolveNodePos();if(t===null){Uq(`[updateNode] node is gone, dropping update: `,e);return}let{state:n,view:r}=this.editor,{tr:i}=n,a=n.doc.nodeAt(t);if(a){let n=i.setNodeMarkup(t,void 0,{...a.attrs,...e});r.dispatch(n)}}deleteNode(){let e=this.resolveNodePos();if(e===null)return;let{state:t,view:n}=this.editor,{tr:r}=t,i=t.doc.nodeAt(e)||this.node,a=r.delete(e,e+i.nodeSize);n.dispatch(a)}done(e,t){Uq(`done: err:`,e),e?(console.log(e),this.onFinish(!1)):(this.updateNode({loaded:!0,src:t,percent:100}),this.onFinish(!0)),this.editor._insertingImage=!1}fileChosen(e){if(!e)return;this.chosenFile=e,this.editor._insertingImage=!1,Uq(`[fileChosen] file: `,e);let t=new FileReader;t.onload=()=>{let e=t.result;this.updateNode({src:e})},t.readAsDataURL(e)}progress(e,t,n){Uq(`progress: `,e,t,n),this.updateNode({percent:e})}getChosenFile(){return this.chosenFile}};function Gq(e){return Br(`MuiDialogContent`,e)}Vr(`MuiDialogContent`,[`root`,`dividers`]);function Kq(e){return Br(`MuiDialogTitle`,e)}var qq=Vr(`MuiDialogTitle`,[`root`]),Jq=e=>{let{classes:t,dividers:n}=e;return ca({root:[`root`,n&&`dividers`]},Gq,t)},Yq=R(`div`,{name:`MuiDialogContent`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.dividers&&t.dividers]}})(Nc(({theme:e})=>({flex:`1 1 auto`,WebkitOverflowScrolling:`touch`,overflowY:`auto`,padding:`20px 24px`,variants:[{props:({ownerState:e})=>e.dividers,style:{padding:`16px 24px`,borderTop:`1px solid ${(e.vars||e).palette.divider}`,borderBottom:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:e})=>!e.dividers,style:{[`.${qq.root} + &`]:{paddingTop:0}}}]}))),Xq=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiDialogContent`}),{className:r,dividers:i=!1,...a}=n,o={...n,dividers:i},s=Jq(o);return(0,F.jsx)(Yq,{className:I(s.root,r),ownerState:o,ref:t,...a})}),Zq=ml((0,F.jsx)(`path`,{d:`M11.67 3.87 9.9 2.1 0 12l9.9 9.9 1.77-1.77L3.54 12z`}),`ArrowBackIos`);function Qq(e){return Br(`MuiFormHelperText`,e)}var $q=Vr(`MuiFormHelperText`,[`root`,`error`,`disabled`,`sizeSmall`,`sizeMedium`,`contained`,`focused`,`filled`,`required`]),eJ,tJ=e=>{let{classes:t,contained:n,size:r,disabled:i,error:a,filled:o,focused:s,required:c}=e;return ca({root:[`root`,i&&`disabled`,a&&`error`,r&&`size${B(r)}`,n&&`contained`,s&&`focused`,o&&`filled`,c&&`required`]},Qq,t)},nJ=R(`p`,{name:`MuiFormHelperText`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.size&&t[`size${B(n.size)}`],n.contained&&t.contained,n.filled&&t.filled]}})(Nc(({theme:e})=>({color:(e.vars||e).palette.text.secondary,...e.typography.caption,textAlign:`left`,marginTop:3,marginRight:0,marginBottom:0,marginLeft:0,[`&.${$q.disabled}`]:{color:(e.vars||e).palette.text.disabled},[`&.${$q.error}`]:{color:(e.vars||e).palette.error.main},variants:[{props:{size:`small`},style:{marginTop:4}},{props:({ownerState:e})=>e.contained,style:{marginLeft:14,marginRight:14}}]}))),rJ=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiFormHelperText`}),{children:r,className:i,component:a=`p`,disabled:o,error:s,filled:c,focused:l,margin:u,required:d,variant:f,...p}=n,m=Ef({props:n,muiFormControl:Of(),states:[`variant`,`size`,`disabled`,`error`,`filled`,`focused`,`required`]}),h={...n,component:a,contained:m.variant===`filled`||m.variant===`outlined`,variant:m.variant,size:m.size,disabled:m.disabled,error:m.error,filled:m.filled,focused:m.focused,required:m.required};delete h.ownerState;let g=tJ(h);return(0,F.jsx)(nJ,{as:a,className:I(g.root,i),ref:t,...p,ownerState:h,children:r===` `?eJ||=(0,F.jsx)(`span`,{className:`notranslate`,"aria-hidden":!0,children:``}):r})});function iJ(e){return Br(`MuiTextField`,e)}Vr(`MuiTextField`,[`root`]);var aJ={standard:pK,filled:yK,outlined:AK},oJ=e=>{let{classes:t}=e;return ca({root:[`root`]},iJ,t)},sJ=R(Gf,{name:`MuiTextField`,slot:`Root`})({}),cJ=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiTextField`}),{autoComplete:r,autoFocus:i=!1,children:a,className:o,color:s=`primary`,defaultValue:c,disabled:l=!1,error:u=!1,FormHelperTextProps:d,fullWidth:f=!1,helperText:p,id:m,InputLabelProps:h,inputProps:g,InputProps:_,inputRef:v,label:y,maxRows:b,minRows:x,multiline:S=!1,name:C,onBlur:w,onChange:T,onFocus:E,placeholder:D,required:O=!1,rows:k,select:A=!1,SelectProps:j,slots:M={},slotProps:ee={},type:N,value:te,variant:ne=`outlined`,...re}=n,ie={...n,autoFocus:i,color:s,disabled:l,error:u,fullWidth:f,multiline:S,required:O,select:A,variant:ne},ae=oJ(ie),oe=Fi(m),se=p&&oe?`${oe}-helper-text`:void 0,ce=y&&oe?`${oe}-label`:void 0,le=aJ[ne],ue={slots:M,slotProps:{input:_,inputLabel:h,htmlInput:g,formHelperText:d,select:j,...ee}},de={},fe=ue.slotProps.inputLabel;ne===`outlined`&&(fe&&fe.shrink!==void 0&&(de.notched=fe.shrink),de.label=y),A&&((!j||!j.native)&&(de.id=void 0),de[`aria-describedby`]=void 0);let[pe,me]=zc(`root`,{elementType:sJ,shouldForwardComponentProp:!0,externalForwardedProps:{...ue,...re},ownerState:ie,className:I(ae.root,o),ref:t,additionalProps:{disabled:l,error:u,fullWidth:f,required:O,color:s,variant:ne}}),[he,ge]=zc(`input`,{elementType:le,externalForwardedProps:ue,additionalProps:de,ownerState:ie}),[_e,ve]=zc(`inputLabel`,{elementType:Rf,externalForwardedProps:ue,ownerState:ie}),[ye,be]=zc(`htmlInput`,{elementType:`input`,externalForwardedProps:ue,ownerState:ie}),[xe,Se]=zc(`formHelperText`,{elementType:rJ,externalForwardedProps:ue,ownerState:ie}),[Ce,we]=zc(`select`,{elementType:IK,externalForwardedProps:ue,ownerState:ie}),Te=(0,F.jsx)(he,{"aria-describedby":se,autoComplete:r,autoFocus:i,defaultValue:c,fullWidth:f,multiline:S,name:C,rows:k,maxRows:b,minRows:x,type:N,value:te,id:oe,inputRef:v,onBlur:w,onChange:T,onFocus:E,placeholder:D,inputProps:be,slots:{input:M.htmlInput?ye:void 0},...ge});return(0,F.jsxs)(pe,{...me,children:[y!=null&&y!==``&&(0,F.jsx)(_e,{htmlFor:oe,id:ce,...ve,children:y}),A?(0,F.jsx)(Ce,{"aria-describedby":se,id:oe,labelId:ce,value:te,input:Te,...we,children:a}):Te,p&&(0,F.jsx)(xe,{id:se,...Se,children:p})]})});function lJ(e){return Br(`MuiDialogActions`,e)}Vr(`MuiDialogActions`,[`root`,`spacing`]);var uJ=e=>{let{classes:t,disableSpacing:n}=e;return ca({root:[`root`,!n&&`spacing`]},lJ,t)},dJ=R(`div`,{name:`MuiDialogActions`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,!n.disableSpacing&&t.spacing]}})({display:`flex`,alignItems:`center`,padding:8,justifyContent:`flex-end`,flex:`0 0 auto`,variants:[{props:({ownerState:e})=>!e.disableSpacing,style:{"& > :not(style) ~ :not(style)":{marginLeft:8}}}]}),fJ=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiDialogActions`}),{className:r,disableSpacing:i=!1,...a}=n,o={...n,disableSpacing:i},s=uJ(o);return(0,F.jsx)(dJ,{className:I(s.root,r),ownerState:o,ref:t,...a})});function pJ(e){return Br(`MuiDialog`,e)}var mJ=Vr(`MuiDialog`,[`root`,`backdrop`,`scrollPaper`,`scrollBody`,`container`,`paper`,`paperScrollPaper`,`paperScrollBody`,`paperWidthFalse`,`paperWidthXs`,`paperWidthSm`,`paperWidthMd`,`paperWidthLg`,`paperWidthXl`,`paperFullWidth`,`paperFullScreen`]),hJ=P.createContext({}),gJ=R(Kc,{name:`MuiDialog`,slot:`Backdrop`})({zIndex:-1}),_J=e=>{let{classes:t,scroll:n,maxWidth:r,fullWidth:i,fullScreen:a}=e;return ca({root:[`root`],backdrop:[`backdrop`],container:[`container`,`scroll${B(n)}`],paper:[`paper`,`paperScroll${B(n)}`,`paperWidth${B(String(r))}`,i&&`paperFullWidth`,a&&`paperFullScreen`]},pJ,t)},vJ=R(il,{name:`MuiDialog`,slot:`Root`})({"@media print":{position:`absolute !important`}}),yJ=R(`div`,{name:`MuiDialog`,slot:`Container`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.container,t[`scroll${B(n.scroll)}`]]}})({height:`100%`,"@media print":{height:`auto`},outline:0,variants:[{props:{scroll:`paper`},style:{display:`flex`,justifyContent:`center`,alignItems:`center`}},{props:{scroll:`body`},style:{overflowY:`auto`,overflowX:`hidden`,textAlign:`center`,"&::after":{content:`""`,display:`inline-block`,verticalAlign:`middle`,height:`100%`,width:`0`}}}]}),bJ=R(cl,{name:`MuiDialog`,slot:`Paper`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.paper,t[`scrollPaper${B(n.scroll)}`],t[`paperWidth${B(String(n.maxWidth))}`],n.fullWidth&&t.paperFullWidth,n.fullScreen&&t.paperFullScreen]}})(Nc(({theme:e})=>({margin:32,position:`relative`,overflowY:`auto`,"@media print":{overflowY:`visible`,boxShadow:`none`},variants:[{props:{scroll:`paper`},style:{display:`flex`,flexDirection:`column`,maxHeight:`calc(100% - 64px)`}},{props:{scroll:`body`},style:{display:`inline-block`,verticalAlign:`middle`,textAlign:`initial`}},{props:({ownerState:e})=>!e.maxWidth,style:{maxWidth:`calc(100% - 64px)`}},{props:{maxWidth:`xs`},style:{maxWidth:e.breakpoints.unit===`px`?Math.max(e.breakpoints.values.xs,444):`max(${e.breakpoints.values.xs}${e.breakpoints.unit}, 444px)`,[`&.${mJ.paperScrollBody}`]:{[e.breakpoints.down(Math.max(e.breakpoints.values.xs,444)+64)]:{maxWidth:`calc(100% - 64px)`}}}},...Object.keys(e.breakpoints.values).filter(e=>e!==`xs`).map(t=>({props:{maxWidth:t},style:{maxWidth:`${e.breakpoints.values[t]}${e.breakpoints.unit}`,[`&.${mJ.paperScrollBody}`]:{[e.breakpoints.down(e.breakpoints.values[t]+64)]:{maxWidth:`calc(100% - 64px)`}}}})),{props:({ownerState:e})=>e.fullWidth,style:{width:`calc(100% - 64px)`}},{props:({ownerState:e})=>e.fullScreen,style:{margin:0,width:`100%`,maxWidth:`100%`,height:`100%`,maxHeight:`none`,borderRadius:0,[`&.${mJ.paperScrollBody}`]:{margin:0,maxWidth:`100%`}}}]}))),xJ=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiDialog`}),r=xo(),i={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{"aria-describedby":a,"aria-labelledby":o,"aria-modal":s=!0,BackdropComponent:c,BackdropProps:l,children:u,className:d,disableEscapeKeyDown:f=!1,fullScreen:p=!1,fullWidth:m=!1,maxWidth:h=`sm`,onClick:g,onClose:_,open:v,PaperComponent:y=cl,PaperProps:b={},role:x=`dialog`,scroll:S=`paper`,slots:C={},slotProps:w={},TransitionComponent:T=Hc,transitionDuration:E=i,TransitionProps:D,...O}=n,k={...n,disableEscapeKeyDown:f,fullScreen:p,fullWidth:m,maxWidth:h,scroll:S},A=_J(k),j=P.useRef(),M=e=>{j.current=e.target===e.currentTarget},ee=e=>{g&&g(e),j.current&&(j.current=null,_&&_(e,`backdropClick`))},N=Fi(o),te=P.useMemo(()=>({titleId:N}),[N]),ne={slots:{transition:T,...C},slotProps:{transition:D,paper:b,backdrop:l,...w}},[re,ie]=zc(`root`,{elementType:vJ,shouldForwardComponentProp:!0,externalForwardedProps:ne,ownerState:k,className:I(A.root,d),ref:t}),[ae,oe]=zc(`backdrop`,{elementType:gJ,shouldForwardComponentProp:!0,externalForwardedProps:ne,ownerState:k,className:A.backdrop}),[se,ce]=zc(`paper`,{elementType:bJ,shouldForwardComponentProp:!0,externalForwardedProps:ne,ownerState:k,className:A.paper,additionalProps:{elevation:24,role:x,"aria-describedby":a,"aria-labelledby":N,"aria-modal":s,tabIndex:-1,[Sc]:``}}),[le,ue]=zc(`container`,{elementType:yJ,externalForwardedProps:ne,ownerState:k,className:A.container}),[de,fe]=zc(`transition`,{elementType:Hc,externalForwardedProps:ne,ownerState:k,additionalProps:{appear:!0,in:v,timeout:E,role:`presentation`}});return(0,F.jsx)(re,{closeAfterTransition:!0,slots:{backdrop:ae},slotProps:{backdrop:{transitionDuration:E,as:c,...oe}},disableEscapeKeyDown:f,onClose:_,open:v,onClick:ee,...ie,...O,children:(0,F.jsx)(de,{...fe,children:(0,F.jsx)(le,{onMouseDown:M,...ue,children:(0,F.jsx)(se,{as:y,...ce,children:(0,F.jsx)(hJ.Provider,{value:te,children:u})})})})})}),SJ=class extends P.Component{static propTypes={onDone:v.func.isRequired,alt:v.string};constructor(e){super(e);let{alt:t}=e;this.state={value:t}}closeDialog=()=>{document.querySelectorAll(`#text-dialog`).forEach(function(e){return e.remove()})};onDone=()=>{let{onDone:e}=this.props,{value:t}=this.state;e(t),this.closeDialog()};handleOverflow=()=>{document.body.style.removeProperty(`overflow`)};render(){let{value:e}=this.state;return(0,F.jsxs)(xJ,{open:!0,disablePortal:!0,onClose:this.closeDialog,id:`text-dialog`,hideBackdrop:!0,disableScrollLock:!0,onEntered:this.handleOverflow,children:[(0,F.jsx)(Xq,{children:(0,F.jsxs)(`div`,{style:{display:`flex`},children:[(0,F.jsx)(Zq,{style:{paddingTop:`6px`}}),(0,F.jsx)(cJ,{multiline:!0,placeholder:`Enter an Alt Text description of this image`,helperText:`Users with visual limitations rely on Alt Text, since screen readers cannot otherwise describe the contents of an image.`,value:e,onChange:e=>this.setState({value:e.target.value}),FormHelperTextProps:{style:{fontSize:14}}})]})}),(0,F.jsx)(fJ,{children:(0,F.jsx)(ff,{onClick:this.onDone,children:`Done`})})]})}},CJ=R(`button`,{shouldForwardProp:e=>![`active`,`disabled`,`extraStyles`].includes(e)})(({active:e,disabled:t})=>({color:e?Il():Ll(),display:`inline-flex`,padding:`2px`,background:`none`,border:`none`,cursor:t?`not-allowed`:`pointer`,"& svg":{width:`24px`,height:`24px`},"&:hover":{color:t?Ll():Il()},"&:focus":{outline:`2px solid ${Tu()}`},...t&&{opacity:.7}})),wJ=Uu(`pie-elements:editable-html:raw-button`);(class extends P.Component{static propTypes={onClick:v.func.isRequired,children:v.oneOfType([v.arrayOf(v.node),v.node]).isRequired,active:v.bool,disabled:v.bool,extraStyles:v.object};constructor(e){super(e)}onClick=e=>{wJ(`[onClick]`),e.preventDefault();let{onClick:t}=this.props;t(e)};onKeyDown=e=>{if(e.key===`Enter`||e.key===` `){wJ(`[onKeyDown]`),e.preventDefault();let{onClick:t}=this.props;t(e)}};render(){let{active:e,children:t,disabled:n,extraStyles:r,ariaLabel:i}=this.props;return(0,F.jsx)(CJ,{style:r,active:e,disabled:n,onMouseDown:this.onClick,onKeyDown:this.onKeyDown,"aria-label":i,"aria-pressed":e,tabIndex:0,children:t})}});var TJ=class extends P.Component{static propTypes={onToggle:v.func.isRequired,mark:v.string,label:v.string.isRequired,children:v.oneOfType([v.arrayOf(v.node),v.node]).isRequired,active:v.bool};constructor(e){super(e)}onToggle=e=>{e.preventDefault(),this.props.onToggle(this.props.mark)};onKeyDown=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),this.props.onToggle(this.props.mark))};render(){let{children:e,active:t,label:n}=this.props;return(0,F.jsx)(CJ,{active:t,onMouseDown:this.onToggle,"aria-pressed":t,onKeyDown:this.onKeyDown,"aria-label":n,tabIndex:0,children:e})}},EJ=Uu(`@pie-lib:editable-html:plugins:image:image-toolbar`),DJ=R(`div`)(({theme:e})=>({paddingLeft:e.spacing.unit,display:`flex`,alignItems:`center`})),OJ=R(`span`,{shouldForwardProp:e=>![`disabled`,`hasAlignmentButtons`].includes(e)})(({disabled:e,hasAlignmentButtons:t})=>({...e&&{opacity:.5},...t&&{borderLeft:`1px solid grey`,paddingLeft:8,marginLeft:4}})),kJ=({alignment:e,active:t,onClick:n})=>(0,F.jsx)(TJ,{active:t,onToggle:()=>n(e),label:e,children:e});kJ.propTypes={alignment:v.string.isRequired,active:v.bool.isRequired,onClick:v.func.isRequired};var AJ=class extends P.Component{static propTypes={onChange:v.func.isRequired,alignment:v.string,alt:v.string,imageLoaded:v.bool,disableImageAlignmentButtons:v.bool};onAltTextDone=e=>{EJ(`[onAltTextDone]: alt:`,e),this.props.onChange({alt:e},!0)};onAlignmentClick=e=>{EJ(`[onAlignmentClick]: alignment:`,e),this.props.onChange({alignment:e})};renderDialog=()=>{let{alt:e}=this.props,t=document.createElement(`div`),n=(0,F.jsx)(SJ,{alt:e,onDone:this.onAltTextDone});Ms.render(n,t),document.body.appendChild(t)};render(){let{alignment:e,imageLoaded:t,disableImageAlignmentButtons:n}=this.props;return(0,F.jsxs)(DJ,{children:[!n&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(kJ,{alignment:`left`,active:e===`left`,onClick:this.onAlignmentClick}),(0,F.jsx)(kJ,{alignment:`center`,active:e===`center`,onClick:this.onAlignmentClick}),(0,F.jsx)(kJ,{alignment:`right`,active:e===`right`,onClick:this.onAlignmentClick})]}),(0,F.jsx)(OJ,{disabled:!t,hasAlignmentButtons:!n,onMouseDown:e=>t&&this.renderDialog(e),children:`Alt text`})]})}},jJ=R(Bq,{shouldForwardProp:e=>e!==`hideProgress`})(({hideProgress:e})=>({position:`absolute`,left:`0`,width:`fit-content`,top:`0%`,transition:`opacity 200ms linear`,...e&&{opacity:0}})),MJ=R(`div`,{shouldForwardProp:e=>![`active`,`loading`,`pendingDelete`].includes(e)})(({loading:e,pendingDelete:t})=>({position:`relative`,display:`flex`,transition:`opacity 200ms linear`,...e&&{opacity:.3},...t&&{opacity:.3}})),NJ=R(`div`)(({theme:e})=>({position:`relative`,width:`fit-content`,display:`flex`,alignItems:`center`,"&&:hover > .resize":{display:`block`}})),PJ=R(`img`,{shouldForwardProp:e=>e!==`active`})(({theme:e,active:t})=>({border:t?`solid 1px ${e.palette.primary.main}`:`solid 1px transparent`})),FJ=R(`div`)(({theme:e})=>({backgroundColor:e.palette.primary.main,cursor:`col-resize`,height:`35px`,width:`5px`,borderRadius:8,marginLeft:`5px`,marginRight:`10px`,display:`none`})),IJ=e=>e?`${e}px`:`calc(20px)`;function LJ(e){let{node:t,editor:n,attributes:r,onFocus:i,getPos:a,selected:o,options:s,maxImageWidth:c=700,maxImageHeight:l=900}=e,{alt:u}=t.attrs,d=a(),f=n.state.selection.from,p=n.state.selection.to,m=(0,P.useMemo)(()=>f+t.nodeSize===p,[f,p,t.nodeSize]),[h,g]=(0,P.useState)(!1),_=(0,P.useRef)(t),v=(0,P.useRef)(null),y=(0,P.useRef)(null),b=(0,P.useRef)(null),x=(0,P.useCallback)(e=>{let t=e/v.current.naturalWidth*4;return parseInt(t.toFixed(0)*25,10)},[]),S=(0,P.useCallback)(()=>{let e=Vq(n,_.current.attrs.nodeKey);return e?e[1]:null},[n]),C=(0,P.useCallback)(e=>{let t=S();if(t===null)return;let r=n.state.doc.nodeAt(t);r&&n.view.dispatch(n.state.tr.setNodeMarkup(t,void 0,{...r.attrs,...e}))},[n,S]),w=(0,P.useCallback)(()=>{if(!t.attrs.width||!v.current||!v.current.naturalWidth)return;let e=x(t.attrs.width);t.attrs.resizePercent!==e&&C({resizePercent:e})},[t.attrs.width,t.attrs.resizePercent,x,C]);(0,P.useEffect)(()=>{_.current={...t,pos:d}},[t,d]),(0,P.useEffect)(()=>{o?m&&n.isEditable&&(!String(t.attrs?.src??``).trim()&&s.imageHandling?.insertImageRequested&&s.imageHandling.insertImageRequested(n,[t,d],e=>new Wq(n,[t,d],e)),g(o)):g(o)},[m,o,n.isEditable]),(0,P.useEffect)(()=>{w();let e=y?.current;return e&&n.isEditable&&e.addEventListener(`mousedown`,A,!1),()=>{e&&e.removeEventListener(`mousedown`,A,!1)}},[]),(0,P.useEffect)(()=>{w()});let T=(0,P.useCallback)(()=>{let e=v.current;if(e&&(!e.style.width||e.style.width===`calc(20px)`)){let n=Math.min(e.naturalWidth,c),r=Math.min(e.naturalHeight,l);e.style.width=`${n}px`,e.style.height=`${r}px`;let i={width:n,height:r};zp(i,{width:t.attrs.width,height:t.attrs.height})||C(i)}},[t.attrs.width,t.attrs.height,c,l,C]),E=(e,t,n=!0,r)=>{if(n){let n=e.width/e.height;return r===`height`?{width:t.height*n,height:t.height}:{width:t.width,height:t.width/n}}return t},D=(0,P.useCallback)(e=>{let t=v.current;if(!t)return;let n=e.target.getBoundingClientRect(),r={width:t.naturalWidth,height:t.naturalHeight},i=E(r,{width:e.clientX-n.left,height:e.clientY-n.top});i.width>50&&i.height>50&&i.width<=700&&i.height<=900&&(t.style.width=`${i.width}px`,t.style.height=`${i.height}px`,C({width:i.width,height:i.height}))},[n,C]),O=(0,P.useCallback)(e=>{C(e)},[n,C]),k=(0,P.useCallback)(()=>{window.removeEventListener(`mousemove`,D),window.removeEventListener(`mouseup`,k)},[D]),A=(0,P.useCallback)(()=>{window.addEventListener(`mousemove`,D),window.addEventListener(`mouseup`,k)},[D,k]),j={width:IJ(t.attrs.width),height:IJ(t.attrs.height),objectFit:`contain`},M={left:`flex-start`,center:`center`,right:`flex-end`}[t.attrs.alignment]||`flex-start`;return(0,F.jsxs)(Wk,{children:[(0,F.jsxs)(MJ,{onFocus:i,loading:!t.attrs.loaded,pendingDelete:t.attrs.deleteStatus===`pending`,style:{justifyContent:M},children:[(0,F.jsx)(jJ,{mode:`determinate`,value:t.attrs.percent||0,hideProgress:t.attrs.loaded}),(0,F.jsxs)(NJ,{onDragStart:e=>e.preventDefault(),children:[(0,F.jsx)(PJ,{...r,active:o&&t.attrs.loaded,draggable:!1,ref:v,src:t.attrs.src,style:j,onLoad:T,alt:t.attrs.alt}),(0,F.jsx)(FJ,{ref:y,className:`resize`,style:{display:n.isEditable?void 0:`none`}})]})]}),h&&n._tiptapContainerEl&&Ms.createPortal((0,F.jsx)(`div`,{ref:b,style:{zIndex:20,background:`var(--editable-html-toolbar-bg, #efefef)`,boxShadow:`0px 1px 5px 0px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 3px 1px -2px rgba(0, 0, 0, 0.12)`,width:`100%`},children:(0,F.jsx)(SR,{showDone:!0,deletable:!0,toolbarOpts:s.toolbarOpts||{},onDelete:()=>{let e=S();e!==null&&(s.imageHandling?.onDelete?.(_.current),n.view.dispatch(n.state.tr.delete(e,e+n.state.doc.nodeAt(e).nodeSize)),g(!1),n.commands.focus())},onDone:()=>{g(!1),s.imageHandling?.onDone?.(n),n.commands.focus(`end`)},children:(0,F.jsx)(AJ,{disableImageAlignmentButtons:s.imageHandling?.disableImageAlignmentButtons,alt:t.attrs.alt,imageLoaded:t.attrs.loaded,alignment:t.attrs.alignment||`left`,onChange:O})})}),n._tiptapContainerEl)]})}LJ.propTypes={node:v.object.isRequired,editor:v.object.isRequired,attributes:v.object,onFocus:v.func,maxImageWidth:v.number,maxImageHeight:v.number};var RJ=wO.create({name:`imageUploadNode`,group:`block`,atom:!0,selectable:!0,draggable:!0,addAttributes(){return{nodeKey:{default:null},loaded:{default:!1},deleteStatus:{default:null},alignment:{default:null},percent:{default:null},width:{default:null},height:{default:null},src:{default:null},alt:{default:null}}},parseHTML(){return[{tag:`img[data-type="image-upload-node"]`}]},renderHTML({HTMLAttributes:e}){return[`img`,nE(e,{"data-type":`image-upload-node`})]},addNodeView(){return iA(e=>(0,F.jsx)(LJ,{...e,options:this.options}))},addCommands(){return{setImageUploadNode:()=>({commands:e})=>e.insertContent({type:this.name,attrs:{nodeKey:Hq()}})}},addProseMirrorPlugins(){let e=this.editor,t=this.options;return[new ey({props:{handlePaste(n,r){let i=Array.from(r.clipboardData?.items||[]).find(e=>e.kind===`file`&&e.type.startsWith(`image/`));if(!i)return!1;let a=i.getAsFile();if(!a)return!1;let o=t?.imageHandling?.insertImageRequested,s=Hq(),c=new FileReader;return c.onload=()=>{let t=c.result;if(typeof t!=`string`||(e.commands.insertContent({type:`imageUploadNode`,attrs:{src:t,loaded:!o,nodeKey:s}}),!o))return;let n=Vq(e,s);n&&o(e,n,t=>{let r;return r=new Wq(e,n,e=>{e||r?.updateNode({loaded:!0}),t(e)},!0),r.fileChosen(a),r})},c.readAsDataURL(a),!0}}})]}});function zJ(e){return(1+Math.sin(Math.PI*e-Math.PI/2))/2}function BJ(e,t,n,r={},i=()=>{}){let{ease:a=zJ,duration:o=300}=r,s=null,c=t[e],l=!1,u=()=>{l=!0},d=r=>{if(l){i(Error(`Animation cancelled`));return}s===null&&(s=r);let u=Math.min(1,(r-s)/o);if(t[e]=a(u)*(n-c)+c,u>=1){requestAnimationFrame(()=>{i(null)});return}requestAnimationFrame(d)};return c===n?(i(Error(`Element already at target position`)),u):(requestAnimationFrame(d),u)}var VJ={width:99,height:99,position:`absolute`,top:-9999,overflow:`scroll`};function HJ(e){let{onChange:t,...n}=e,r=P.useRef(),i=P.useRef(null),a=()=>{r.current=i.current.offsetHeight-i.current.clientHeight};return gl(()=>{let e=us(()=>{let e=r.current;a(),e!==r.current&&t(r.current)}),n=ms(i.current);return n.addEventListener(`resize`,e),()=>{e.clear(),n.removeEventListener(`resize`,e)}},[t]),P.useEffect(()=>{a(),t(r.current)},[t]),(0,F.jsx)(`div`,{style:VJ,...n,ref:i})}var UJ=ml((0,F.jsx)(`path`,{d:`M15.41 16.09l-4.58-4.59 4.58-4.59L14 5.5l-6 6 6 6z`}),`KeyboardArrowLeft`),WJ=ml((0,F.jsx)(`path`,{d:`M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z`}),`KeyboardArrowRight`);function GJ(e){return Br(`MuiTabScrollButton`,e)}var KJ=Vr(`MuiTabScrollButton`,[`root`,`vertical`,`horizontal`,`disabled`]),qJ=e=>{let{classes:t,orientation:n,disabled:r}=e;return ca({root:[`root`,n,r&&`disabled`]},GJ,t)},JJ=R(Ld,{name:`MuiTabScrollButton`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.orientation&&t[n.orientation]]}})({width:40,flexShrink:0,opacity:.8,[`&.${KJ.disabled}`]:{opacity:0},variants:[{props:{orientation:`vertical`},style:{width:`100%`,height:40,"& svg":{transform:`var(--TabScrollButton-svgRotate)`}}}]}),YJ=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiTabScrollButton`}),{className:r,slots:i={},slotProps:a={},direction:o,orientation:s,disabled:c,...l}=n,u=Di(),d={isRtl:u,...n},f=qJ(d),p=i.StartScrollButtonIcon??UJ,m=i.EndScrollButtonIcon??WJ,h=lp({elementType:p,externalSlotProps:a.startScrollButtonIcon,additionalProps:{fontSize:`small`},ownerState:d}),g=lp({elementType:m,externalSlotProps:a.endScrollButtonIcon,additionalProps:{fontSize:`small`},ownerState:d});return(0,F.jsx)(JJ,{component:`div`,className:I(f.root,r),ref:t,role:null,ownerState:d,tabIndex:null,...l,style:{...l.style,...s===`vertical`&&{"--TabScrollButton-svgRotate":`rotate(${u?-90:90}deg)`}},children:o===`left`?(0,F.jsx)(p,{...h}):(0,F.jsx)(m,{...g})})});function XJ(e){return Br(`MuiTabs`,e)}var ZJ=Vr(`MuiTabs`,[`root`,`vertical`,`list`,`flexContainer`,`flexContainerVertical`,`centered`,`scroller`,`fixed`,`scrollableX`,`scrollableY`,`hideScrollbar`,`scrollButtons`,`scrollButtonsHideMobile`,`indicator`]),QJ=(e,t)=>e===t?e.firstChild:t&&t.nextElementSibling?t.nextElementSibling:e.firstChild,$J=(e,t)=>e===t?e.lastChild:t&&t.previousElementSibling?t.previousElementSibling:e.lastChild,eY=(e,t,n)=>{let r=!1,i=n(e,t);for(;i;){if(i===e.firstChild){if(r)return;r=!0}let t=i.disabled||i.getAttribute(`aria-disabled`)===`true`;if(!i.hasAttribute(`tabindex`)||t)i=n(e,i);else{i.focus();return}}},tY=e=>{let{vertical:t,fixed:n,hideScrollbar:r,scrollableX:i,scrollableY:a,centered:o,scrollButtonsHideMobile:s,classes:c}=e;return ca({root:[`root`,t&&`vertical`],scroller:[`scroller`,n&&`fixed`,r&&`hideScrollbar`,i&&`scrollableX`,a&&`scrollableY`],list:[`list`,`flexContainer`,t&&`flexContainerVertical`,t&&`vertical`,o&&`centered`],indicator:[`indicator`],scrollButtons:[`scrollButtons`,s&&`scrollButtonsHideMobile`],scrollableX:[i&&`scrollableX`],hideScrollbar:[r&&`hideScrollbar`]},XJ,c)},nY=R(`div`,{name:`MuiTabs`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[{[`& .${ZJ.scrollButtons}`]:t.scrollButtons},{[`& .${ZJ.scrollButtons}`]:n.scrollButtonsHideMobile&&t.scrollButtonsHideMobile},t.root,n.vertical&&t.vertical]}})(Nc(({theme:e})=>({overflow:`hidden`,minHeight:48,WebkitOverflowScrolling:`touch`,display:`flex`,variants:[{props:({ownerState:e})=>e.vertical,style:{flexDirection:`column`}},{props:({ownerState:e})=>e.scrollButtonsHideMobile,style:{[`& .${ZJ.scrollButtons}`]:{[e.breakpoints.down(`sm`)]:{display:`none`}}}}]}))),rY=R(`div`,{name:`MuiTabs`,slot:`Scroller`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.scroller,n.fixed&&t.fixed,n.hideScrollbar&&t.hideScrollbar,n.scrollableX&&t.scrollableX,n.scrollableY&&t.scrollableY]}})({position:`relative`,display:`inline-block`,flex:`1 1 auto`,whiteSpace:`nowrap`,variants:[{props:({ownerState:e})=>e.fixed,style:{overflowX:`hidden`,width:`100%`}},{props:({ownerState:e})=>e.hideScrollbar,style:{scrollbarWidth:`none`,"&::-webkit-scrollbar":{display:`none`}}},{props:({ownerState:e})=>e.scrollableX,style:{overflowX:`auto`,overflowY:`hidden`}},{props:({ownerState:e})=>e.scrollableY,style:{overflowY:`auto`,overflowX:`hidden`}}]}),iY=R(`div`,{name:`MuiTabs`,slot:`List`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.list,t.flexContainer,n.vertical&&t.flexContainerVertical,n.centered&&t.centered]}})({display:`flex`,variants:[{props:({ownerState:e})=>e.vertical,style:{flexDirection:`column`}},{props:({ownerState:e})=>e.centered,style:{justifyContent:`center`}}]}),aY=R(`span`,{name:`MuiTabs`,slot:`Indicator`})(Nc(({theme:e})=>({position:`absolute`,height:2,bottom:0,width:`100%`,transition:e.transitions.create(),variants:[{props:{indicatorColor:`primary`},style:{backgroundColor:(e.vars||e).palette.primary.main}},{props:{indicatorColor:`secondary`},style:{backgroundColor:(e.vars||e).palette.secondary.main}},{props:({ownerState:e})=>e.vertical,style:{height:`100%`,width:2,right:0}}]}))),oY=R(HJ)({overflowX:`auto`,overflowY:`hidden`,scrollbarWidth:`none`,"&::-webkit-scrollbar":{display:`none`}}),sY={},cY=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiTabs`}),r=xo(),i=Di(),{"aria-label":a,"aria-labelledby":o,action:s,centered:c=!1,children:l,className:u,component:d=`div`,allowScrollButtonsMobile:f=!1,indicatorColor:p=`primary`,onChange:m,orientation:h=`horizontal`,ScrollButtonComponent:g,scrollButtons:_=`auto`,selectionFollowsFocus:v,slots:y={},slotProps:b={},TabIndicatorProps:x={},TabScrollButtonProps:S={},textColor:C=`primary`,value:w,variant:T=`standard`,visibleScrollbar:E=!1,...D}=n,O=T===`scrollable`,k=h===`vertical`,A=k?`scrollTop`:`scrollLeft`,j=k?`top`:`left`,M=k?`bottom`:`right`,ee=k?`clientHeight`:`clientWidth`,N=k?`height`:`width`,te={...n,component:d,allowScrollButtonsMobile:f,indicatorColor:p,orientation:h,vertical:k,scrollButtons:_,textColor:C,variant:T,visibleScrollbar:E,fixed:!O,hideScrollbar:O&&!E,scrollableX:O&&!k,scrollableY:O&&k,centered:c&&!O,scrollButtonsHideMobile:!f},ne=tY(te),re=lp({elementType:y.StartScrollButtonIcon,externalSlotProps:b.startScrollButtonIcon,ownerState:te}),ie=lp({elementType:y.EndScrollButtonIcon,externalSlotProps:b.endScrollButtonIcon,ownerState:te}),[ae,oe]=P.useState(!1),[se,ce]=P.useState(sY),[le,ue]=P.useState(!1),[de,fe]=P.useState(!1),[pe,me]=P.useState(!1),[he,ge]=P.useState({overflow:`hidden`,scrollbarWidth:0}),_e=new Map,ve=P.useRef(null),ye=P.useRef(null),be={slots:y,slotProps:{indicator:x,scrollButtons:S,...b}},xe=()=>{let e=ve.current,t;if(e){let n=e.getBoundingClientRect();t={clientWidth:e.clientWidth,scrollLeft:e.scrollLeft,scrollTop:e.scrollTop,scrollWidth:e.scrollWidth,top:n.top,bottom:n.bottom,left:n.left,right:n.right}}let n;if(e&&w!==!1){let e=ye.current.children;if(e.length>0){let t=e[_e.get(w)];n=t?t.getBoundingClientRect():null}}return{tabsMeta:t,tabMeta:n}},Se=bl(()=>{let{tabsMeta:e,tabMeta:t}=xe(),n=0,r;k?(r=`top`,t&&e&&(n=t.top-e.top+e.scrollTop)):(r=i?`right`:`left`,t&&e&&(n=(i?-1:1)*(t[r]-e[r]+e.scrollLeft)));let a={[r]:n,[N]:t?t[N]:0};if(typeof se[r]!=`number`||typeof se[N]!=`number`)ce(a);else{let e=Math.abs(se[r]-a[r]),t=Math.abs(se[N]-a[N]);(e>=1||t>=1)&&ce(a)}}),Ce=(e,{animation:t=!0}={})=>{t?BJ(A,ve.current,e,{duration:r.transitions.duration.standard}):ve.current[A]=e},we=e=>{let t=ve.current[A];k?t+=e:t+=e*(i?-1:1),Ce(t)},Te=()=>{let e=ve.current[ee],t=0,n=Array.from(ye.current.children);for(let r=0;r<n.length;r+=1){let i=n[r];if(t+i[ee]>e){r===0&&(t=e);break}t+=i[ee]}return t},Ee=()=>{we(-1*Te())},De=()=>{we(Te())},[Oe,{onChange:ke,...Ae}]=zc(`scrollbar`,{className:I(ne.scrollableX,ne.hideScrollbar),elementType:oY,shouldForwardComponentProp:!0,externalForwardedProps:be,ownerState:te}),je=P.useCallback(e=>{ke?.(e),ge({overflow:null,scrollbarWidth:e})},[ke]),[Me,Ne]=zc(`scrollButtons`,{className:I(ne.scrollButtons,S.className),elementType:YJ,externalForwardedProps:be,ownerState:te,additionalProps:{orientation:h,slots:{StartScrollButtonIcon:y.startScrollButtonIcon||y.StartScrollButtonIcon,EndScrollButtonIcon:y.endScrollButtonIcon||y.EndScrollButtonIcon},slotProps:{startScrollButtonIcon:re,endScrollButtonIcon:ie}}}),Pe=()=>{let e={};e.scrollbarSizeListener=O?(0,F.jsx)(Oe,{...Ae,onChange:je}):null;let t=O&&(_===`auto`&&(le||de)||_===!0);return e.scrollButtonStart=t?(0,F.jsx)(Me,{direction:i?`right`:`left`,onClick:Ee,disabled:!le,...Ne}):null,e.scrollButtonEnd=t?(0,F.jsx)(Me,{direction:i?`left`:`right`,onClick:De,disabled:!de,...Ne}):null,e},Fe=bl(e=>{let{tabsMeta:t,tabMeta:n}=xe();if(!(!n||!t)){if(n[j]<t[j]){let r=t[A]+(n[j]-t[j]);Ce(r,{animation:e})}else if(n[M]>t[M]){let r=t[A]+(n[M]-t[M]);Ce(r,{animation:e})}}}),Ie=bl(()=>{O&&_!==!1&&me(!pe)});P.useEffect(()=>{let e=us(()=>{ve.current&&Se()}),t,n=n=>{n.forEach(e=>{e.removedNodes.forEach(e=>{t?.unobserve(e)}),e.addedNodes.forEach(e=>{t?.observe(e)})}),e(),Ie()},r=ms(ve.current);r.addEventListener(`resize`,e);let i;return typeof ResizeObserver<`u`&&(t=new ResizeObserver(e),Array.from(ye.current.children).forEach(e=>{t.observe(e)})),typeof MutationObserver<`u`&&(i=new MutationObserver(n),i.observe(ye.current,{childList:!0})),()=>{e.clear(),r.removeEventListener(`resize`,e),i?.disconnect(),t?.disconnect()}},[Se,Ie]),P.useEffect(()=>{let e=Array.from(ye.current.children),t=e.length;if(typeof IntersectionObserver<`u`&&t>0&&O&&_!==!1){let n=e[0],r=e[t-1],i={root:ve.current,threshold:.99},a=new IntersectionObserver(e=>{ue(!e[0].isIntersecting)},i);a.observe(n);let o=new IntersectionObserver(e=>{fe(!e[0].isIntersecting)},i);return o.observe(r),()=>{a.disconnect(),o.disconnect()}}},[O,_,pe,l?.length]),P.useEffect(()=>{oe(!0)},[]),P.useEffect(()=>{Se()}),P.useEffect(()=>{Fe(sY!==se)},[Fe,se]),P.useImperativeHandle(s,()=>({updateIndicator:Se,updateScrollButtons:Ie}),[Se,Ie]);let[Le,Re]=zc(`indicator`,{className:I(ne.indicator,x.className),elementType:aY,externalForwardedProps:be,ownerState:te,additionalProps:{style:se}}),ze=(0,F.jsx)(Le,{...Re}),Be=0,Ve=P.Children.map(l,e=>{if(!P.isValidElement(e))return null;let t=e.props.value===void 0?Be:e.props.value;_e.set(t,Be);let n=t===w;return Be+=1,P.cloneElement(e,{fullWidth:T===`fullWidth`,indicator:n&&!ae&&ze,selected:n,selectionFollowsFocus:v,onChange:m,textColor:C,value:t,...Be===1&&w===!1&&!e.props.tabIndex?{tabIndex:0}:{}})}),He=e=>{if(e.altKey||e.shiftKey||e.ctrlKey||e.metaKey)return;let t=ye.current,n=xc(fs(t));if(n?.getAttribute(`role`)!==`tab`)return;let r=h===`horizontal`?`ArrowLeft`:`ArrowUp`,a=h===`horizontal`?`ArrowRight`:`ArrowDown`;switch(h===`horizontal`&&i&&(r=`ArrowRight`,a=`ArrowLeft`),e.key){case r:e.preventDefault(),eY(t,n,$J);break;case a:e.preventDefault(),eY(t,n,QJ);break;case`Home`:e.preventDefault(),eY(t,null,QJ);break;case`End`:e.preventDefault(),eY(t,null,$J);break;default:break}},Ue=Pe(),[We,Ge]=zc(`root`,{ref:t,className:I(ne.root,u),elementType:nY,externalForwardedProps:{...be,...D,component:d},ownerState:te}),[Ke,qe]=zc(`scroller`,{ref:ve,className:ne.scroller,elementType:rY,externalForwardedProps:be,ownerState:te,additionalProps:{style:{overflow:he.overflow,[k?`margin${i?`Left`:`Right`}`:`marginBottom`]:E?void 0:-he.scrollbarWidth}}}),[Je,Ye]=zc(`list`,{ref:ye,className:I(ne.list,ne.flexContainer),elementType:iY,externalForwardedProps:be,ownerState:te,getSlotProps:e=>({...e,onKeyDown:t=>{He(t),e.onKeyDown?.(t)}})});return(0,F.jsxs)(We,{...Ge,children:[Ue.scrollButtonStart,Ue.scrollbarSizeListener,(0,F.jsxs)(Ke,{...qe,children:[(0,F.jsx)(Je,{"aria-label":a,"aria-labelledby":o,"aria-orientation":h===`vertical`?`vertical`:null,role:`tablist`,...Ye,children:Ve}),ae&&ze]}),Ue.scrollButtonEnd]})});function lY(e){return Br(`MuiTab`,e)}var uY=Vr(`MuiTab`,[`root`,`labelIcon`,`textColorInherit`,`textColorPrimary`,`textColorSecondary`,`selected`,`disabled`,`fullWidth`,`wrapped`,`iconWrapper`,`icon`]),dY=e=>{let{classes:t,textColor:n,fullWidth:r,wrapped:i,icon:a,label:o,selected:s,disabled:c}=e;return ca({root:[`root`,a&&o&&`labelIcon`,`textColor${B(n)}`,r&&`fullWidth`,i&&`wrapped`,s&&`selected`,c&&`disabled`],icon:[`iconWrapper`,`icon`]},lY,t)},fY=R(Ld,{name:`MuiTab`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.label&&n.icon&&t.labelIcon,t[`textColor${B(n.textColor)}`],n.fullWidth&&t.fullWidth,n.wrapped&&t.wrapped,{[`& .${uY.iconWrapper}`]:t.iconWrapper},{[`& .${uY.icon}`]:t.icon}]}})(Nc(({theme:e})=>({...e.typography.button,maxWidth:360,minWidth:90,position:`relative`,minHeight:48,flexShrink:0,padding:`12px 16px`,overflow:`hidden`,whiteSpace:`normal`,textAlign:`center`,lineHeight:1.25,variants:[{props:({ownerState:e})=>e.label&&(e.iconPosition===`top`||e.iconPosition===`bottom`),style:{flexDirection:`column`}},{props:({ownerState:e})=>e.label&&e.iconPosition!==`top`&&e.iconPosition!==`bottom`,style:{flexDirection:`row`}},{props:({ownerState:e})=>e.icon&&e.label,style:{minHeight:72,paddingTop:9,paddingBottom:9}},{props:({ownerState:e,iconPosition:t})=>e.icon&&e.label&&t===`top`,style:{[`& > .${uY.icon}`]:{marginBottom:6}}},{props:({ownerState:e,iconPosition:t})=>e.icon&&e.label&&t===`bottom`,style:{[`& > .${uY.icon}`]:{marginTop:6}}},{props:({ownerState:e,iconPosition:t})=>e.icon&&e.label&&t===`start`,style:{[`& > .${uY.icon}`]:{marginRight:e.spacing(1)}}},{props:({ownerState:e,iconPosition:t})=>e.icon&&e.label&&t===`end`,style:{[`& > .${uY.icon}`]:{marginLeft:e.spacing(1)}}},{props:{textColor:`inherit`},style:{color:`inherit`,opacity:.6,[`&.${uY.selected}`]:{opacity:1},[`&.${uY.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity}}},{props:{textColor:`primary`},style:{color:(e.vars||e).palette.text.secondary,[`&.${uY.selected}`]:{color:(e.vars||e).palette.primary.main},[`&.${uY.disabled}`]:{color:(e.vars||e).palette.text.disabled}}},{props:{textColor:`secondary`},style:{color:(e.vars||e).palette.text.secondary,[`&.${uY.selected}`]:{color:(e.vars||e).palette.secondary.main},[`&.${uY.disabled}`]:{color:(e.vars||e).palette.text.disabled}}},{props:({ownerState:e})=>e.fullWidth,style:{flexShrink:1,flexGrow:1,flexBasis:0,maxWidth:`none`}},{props:({ownerState:e})=>e.wrapped,style:{fontSize:e.typography.pxToRem(12)}}]}))),pY=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiTab`}),{className:r,disabled:i=!1,disableFocusRipple:a=!1,fullWidth:o,icon:s,iconPosition:c=`top`,indicator:l,label:u,onChange:d,onClick:f,onFocus:p,selected:m,selectionFollowsFocus:h,textColor:g=`inherit`,value:_,wrapped:v=!1,...y}=n,b={...n,disabled:i,disableFocusRipple:a,selected:m,icon:!!s,iconPosition:c,label:!!u,fullWidth:o,textColor:g,wrapped:v},x=dY(b),S=s&&u&&P.isValidElement(s)?P.cloneElement(s,{className:I(x.icon,s.props.className)}):s;return(0,F.jsxs)(fY,{focusRipple:!a,className:I(x.root,r),ref:t,role:`tab`,"aria-selected":m,disabled:i,onClick:e=>{!m&&d&&d(e,_),f&&f(e)},onFocus:e=>{h&&!m&&d&&d(e,_),p&&p(e)},ownerState:b,tabIndex:m?0:-1,...y,children:[c===`top`||c===`start`?(0,F.jsxs)(P.Fragment,{children:[S,u]}):(0,F.jsxs)(P.Fragment,{children:[u,S]}),l]})}),mY=e=>{let{classes:t}=e;return ca({root:[`root`]},Kq,t)},hY=R(vG,{name:`MuiDialogTitle`,slot:`Root`})({padding:`16px 24px`,flex:`0 0 auto`}),gY=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiDialogTitle`}),{className:r,id:i,...a}=n,o=n,s=mY(o),{titleId:c=i}=P.useContext(hJ);return(0,F.jsx)(hY,{component:`h2`,className:I(s.root,r),ownerState:o,ref:t,variant:`h6`,id:i??c,...a})});function _Y(e){return Br(`MuiDialogContentText`,e)}Vr(`MuiDialogContentText`,[`root`]);var vY=e=>{let{classes:t}=e,n=ca({root:[`root`]},_Y,t);return{...t,...n}},yY=R(vG,{shouldForwardProp:e=>Co(e)||e===`classes`,name:`MuiDialogContentText`,slot:`Root`})({}),bY=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiDialogContentText`}),{children:r,className:i,...a}=n,o=vY(a);return(0,F.jsx)(yY,{component:`p`,variant:`body1`,color:`textSecondary`,ref:t,ownerState:a,className:I(o.root,i),...n,classes:o})}),xY=Uu(`@pie-lib:editable-html:plugins:media:dialog`),SY=e=>{if(!e)return!1;let t=/^(?:https?:\/\/)?(?:m\.|www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/;return e.match(t)?e.match(t)[1]:!1},CY=e=>e&&/(http|https)?:\/\/(www\.)?(player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|)(video\/)?(\d+)(?:|\/\?)/.test(e),wY=e=>e&&/^https:\/\/drive\.google\.com\/(?:file\/d\/|drive\/(?:u\/\d+\/)?folders\/|uc\?id=)([a-zA-Z0-9_-]+)/.test(e),TY=e=>{if(!e)return!1;let t=/^https?:\/\/(soundcloud\.com|snd\.sc)\/(.*)$/;return e.match(t)&&e.match(t)[2]},EY=e=>new Promise(t=>{try{fetch(`https://soundcloud.com/oembed?format=json&url=${e}`).then(e=>e.json()).then(e=>{let n=document.createElement(`div`);n.innerHTML=e.html,t(n.querySelector(`iframe`).src)}).catch(e=>{t(``),xY(e)})}catch{t(``)}}),DY={video:`Video`,audio:`Audio`},OY={uploadFile:`upload-file`,insertUrl:`insert-url`},kY=R(xJ)(({theme:e})=>({"& .MuiDialog-paper":{minWidth:`500px`}})),AY=R(Xq)(({theme:e})=>({padding:0})),jY=R(`div`)(({theme:e})=>({display:`flex`,flexDirection:`space-between`})),MY=R(`div`)(({theme:e})=>({marginTop:e.spacing(1.5)})),NY=R(`input`)(({theme:e})=>({})),PY=R(vG)(({theme:e})=>({marginTop:e.spacing(1.5),color:e.palette.error.main})),FY=R(fR)(({theme:e})=>({marginLeft:e.spacing(1.5)})),IY=class extends P.Component{static propTypes={open:v.bool,edit:v.bool,disablePortal:v.bool,handleClose:v.func,uploadSoundSupport:v.shape({add:v.func,delete:v.func}),type:v.string,src:v.string,url:v.string,urlToUse:v.string,starts:v.number,ends:v.number,height:v.number,width:v.number};constructor(e){super(e);let{ends:t,height:n,src:r,starts:i,type:a,uploadSoundSupport:o,url:s,urlToUse:c,width:l}=e,u=o?.add&&o?.delete&&a!==`video`&&!r;this.state={ends:t||0,url:s,urlToUse:c,formattedUrl:r,height:n||315,invalid:!1,starts:i||0,width:l||560,tabValue:u?OY.uploadFile:OY.insertUrl,fileUpload:{error:null,loading:!1,scheduled:!1,url:``,mimeType:``}}}componentDidMount(){this.props.url&&this.urlChange({target:{value:this.props.url}})}formatUrl=()=>{let{url:e,urlToUse:t,starts:n,ends:r}=this.state,i=SY(e),a=CY(e),o=t;if((i||a)&&t){let e=[],s,c;switch(!0){case a:s=`t`,c=`#`;break;case i:s=`start`,c=`?`;break;default:s=`start`,c=`?`}n&&e.push(`${s}=${n}`),r&&e.push(`end=${r}`),o=`${t}${e.length?c:``}${e.join(`&`)}`}this.setState({formattedUrl:null,updating:!0},()=>this.setState({formattedUrl:o,updating:!1}))};handleStateChange=e=>this.setState(e,this.formatUrl);checkAudio=e=>{TY(e)&&EY(e).then(t=>{this.handleStateChange({urlToUse:t,invalid:!t,url:e})}).catch(xY)};checkVideo=e=>{if(SY(e)){let t=`https://youtube.com/embed/${e.match(/^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/)[2]}`;xY(`is youtube`),this.handleStateChange({urlToUse:t,url:e,invalid:!1})}if(CY(e)){let t=`https://player.vimeo.com/video/${e.replace(/.*vimeo.com\/(.*)/g,`$1`)}`;xY(`is vimeo`),this.handleStateChange({urlToUse:t,url:e,ends:null,invalid:!1})}if(wY(e)){let t=`https://drive.google.com/file/d/${e.replace(/^https:\/\/drive\.google\.com\/(?:file\/d\/|drive\/(?:u\/\d+\/)?folders\/|uc\?id=)([a-zA-Z0-9_-]+)\/.*/,`$1`)}/preview`;xY(`is google drive`),this.handleStateChange({urlToUse:t,url:e,ends:null,invalid:!1})}};urlChange=e=>{let{value:t}=e.target||{},{type:n}=this.props;if(n&&n===`audio`){this.checkAudio(t);return}else if(n&&n===`video`){this.checkVideo(t);return}this.handleStateChange({urlToUse:null,url:null,invalid:!0})};changeHandler=e=>t=>this.handleStateChange({[e]:t.target.value});handleDone=e=>{let{handleClose:t}=this.props,{tabValue:n,fileUpload:r}=this.state,i=n===OY.insertUrl;if(!e){r.url&&this.handleRemoveFile(),t(e);return}if(i){let{ends:n,height:r,url:i,urlToUse:a,formattedUrl:o,starts:s,width:c}=this.state;t(e,{tag:`iframe`,ends:n,height:r,starts:s,width:c,url:i,urlToUse:a,src:o});return}if(!r.loading){t(e,{tag:`audio`,src:r.url});return}this.setState({fileUpload:{...r,scheduled:!0}})};handleUploadFile=async e=>{e.preventDefault(),this.setState({fileUpload:{...this.state.fileUpload,error:null,loading:!0}});let t=e.target.files[0],n=new FileReader;n.onload=()=>{let e=n.result;this.setState({fileUpload:{...this.state.fileUpload,url:e,mimeType:t.type}})},n.readAsDataURL(t),this.props.uploadSoundSupport.add({fileChosen:t,done:(e,t)=>{if(xY(`done: err:`,e),e){console.log(e),this.setState({fileUpload:{...this.state.fileUpload,scheduled:!1,loading:!1,error:e}});return}let{fileUpload:n}=this.state,r=n&&n.scheduled?this.handleDone.bind(this,!0):void 0;this.setState({fileUpload:{...n,scheduled:!1,loading:!1,url:t}},r)}})};handleRemoveFile=async()=>{this.props.uploadSoundSupport.delete(this.state.fileUpload.url,e=>{e&&(console.log(e),this.setState({fileUpload:{...this.state.fileUpload,error:e}}))}),this.setState({fileUpload:{...this.state.fileUpload,loading:!1,url:``,mimeType:``}})};render(){let{open:e,disablePortal:t,type:n,edit:r,uploadSoundSupport:i}=this.props,{ends:a,height:o,invalid:s,starts:c,width:l,url:u,mimeType:d,formattedUrl:f,updating:p,tabValue:m,fileUpload:h}=this.state,g=SY(u),_=m===OY.insertUrl,v=m===OY.uploadFile,y=_?s||u==null:!h.url||h.scheduled,b=i?.add&&i?.delete&&n!==`video`;return(0,F.jsxs)(kY,{disablePortal:t,open:e,onClose:()=>this.handleDone(!1),"aria-labelledby":`form-dialog-title`,children:[(0,F.jsxs)(gY,{id:`form-dialog-title`,children:[`Insert `,DY[n]]}),(0,F.jsx)(Xq,{children:(0,F.jsxs)(`div`,{children:[(0,F.jsx)(jY,{children:(0,F.jsxs)(cY,{indicatorColor:`primary`,value:m,onChange:(e,t)=>{this.setState({tabValue:t})},children:[b?(0,F.jsx)(pY,{value:OY.uploadFile,label:`Upload file`}):null,(0,F.jsx)(pY,{value:OY.insertUrl,label:n===`video`?`Insert YouTube, Vimeo, or Google Drive URL`:`Insert SoundCloud URL`})]})}),_&&(0,F.jsxs)(`div`,{children:[(0,F.jsx)(cJ,{autoFocus:!0,error:s,helperText:s?`Invalid URL`:``,margin:`dense`,id:`name`,label:`URL`,placeholder:`Paste URL of ${n}...`,type:`text`,onChange:this.urlChange,value:u,fullWidth:!0}),n===`video`&&(0,F.jsxs)(AY,{children:[(0,F.jsx)(bY,{children:`Video Properties`}),(0,F.jsx)(cJ,{autoFocus:!0,margin:`dense`,id:`width`,label:`Width`,type:`number`,placeholder:`Width`,value:l,onChange:this.changeHandler(`width`)}),(0,F.jsx)(cJ,{autoFocus:!0,margin:`dense`,id:`height`,label:`Height`,type:`number`,placeholder:`Height`,value:o,onChange:this.changeHandler(`height`)})]}),f&&(0,F.jsx)(`iframe`,{width:l,height:o,src:f,frameBorder:`0`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture`,allowFullScreen:!0}),n===`video`&&(f||p)&&!s&&(0,F.jsx)(P.Fragment,{children:(0,F.jsxs)(AY,{children:[(0,F.jsx)(cJ,{autoFocus:!0,margin:`dense`,id:`starts`,label:`Starts`,type:`number`,placeholder:`Starts`,value:c,onChange:this.changeHandler(`starts`)}),g&&(0,F.jsx)(cJ,{autoFocus:!0,margin:`dense`,id:`ends`,label:`Ends`,type:`number`,placeholder:`Ends`,value:a,onChange:this.changeHandler(`ends`)})]})})]}),v&&(0,F.jsx)(MY,{children:(0,F.jsxs)(`div`,{children:[h.url?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(jY,{children:[(0,F.jsx)(`audio`,{controls:`controls`,controlsList:`nodownload`,children:(0,F.jsx)(`source`,{type:d,src:h.url})}),(0,F.jsx)(FY,{"aria-label":`delete`,onClick:this.handleRemoveFile,children:(0,F.jsx)(pR,{})})]}),!h.scheduled&&h.loading?(0,F.jsx)(vG,{variant:`subheading`,children:`Loading...`}):null,h.scheduled?(0,F.jsx)(vG,{variant:`subheading`,children:`Waiting for Upload to finish, then inserting item...`}):null]}):h.loading?null:(0,F.jsx)(NY,{accept:`audio/*`,onChange:this.handleUploadFile,type:`file`}),!!h.error&&(0,F.jsx)(PY,{variant:`caption`,children:h.error})]})})]})}),(0,F.jsxs)(fJ,{children:[(0,F.jsx)(ff,{onClick:()=>this.handleDone(!1),color:`primary`,children:`Cancel`}),(0,F.jsx)(ff,{disabled:y,onClick:()=>this.handleDone(!0),color:`primary`,children:r?`Update`:`Insert`})]})]})}},LY=R(`span`)(({theme:e})=>({position:`relative`,bottom:`5px`,left:0,width:`100%`,background:e.palette.common.white,display:`inline-flex`,padding:`5px`,boxShadow:`0px 4px 4px rgba(0, 0, 0, 0.25)`})),RY=R(`span`)(({theme:e})=>({cursor:`pointer`,flex:3,border:`solid ${e.palette.common.black}`,textAlign:`right`,borderWidth:`0 2px 0 0`,marginRight:`5px`,paddingRight:`5px`})),zY=R(`span`)({cursor:`pointer`}),BY=class extends P.Component{static propTypes={onEdit:v.func,hideEdit:v.bool,onRemove:v.func};render(){let{hideEdit:e,onEdit:t,onRemove:n}=this.props;return(0,F.jsxs)(LY,{children:[e?null:(0,F.jsx)(RY,{onClick:t,children:`Edit Settings`}),(0,F.jsx)(zY,{onClick:n,children:`Remove`})]})}},VY=wO.create({name:`media`,group:`inline`,inline:!0,atom:!0,addAttributes(){return{type:{default:`video`},src:{default:null},width:{default:null},height:{default:null},title:{default:null},starts:{default:null},ends:{default:null},editing:{default:!1},tag:{default:`iframe`},url:{default:null}}},parseHTML(){return[{tag:`iframe[data-type="video"]`,getAttrs:e=>({type:`video`,tag:`iframe`,src:e.getAttribute(`src`),width:e.getAttribute(`width`),height:e.getAttribute(`height`),title:e.dataset.title,starts:e.dataset.starts,ends:e.dataset.ends,url:e.dataset.url})},{tag:`audio`,getAttrs:e=>({type:`audio`,tag:`audio`,src:e.querySelector(`source`)?.getAttribute(`src`)})}]},renderHTML({HTMLAttributes:e}){let{tag:t,src:n,width:r,height:i}=e;return t===`audio`?[`audio`,{controls:`controls`,controlsList:`nodownload`},[`source`,{src:n,type:`audio/mp3`}]]:[`iframe`,nE({"data-type":`video`,frameborder:`0`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture`,allowfullscreen:``,src:n},r?{width:r}:{},i?{height:i}:{})]},addCommands(){return{insertMedia:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e}),updateMedia:e=>({commands:t})=>t.updateAttributes(this.name,e)}},addNodeView(){return iA(e=>(0,F.jsx)(WY,{...e,options:this.options}))}}),HY=()=>{document.querySelectorAll(`.insert-media-dialog`).forEach(e=>e.remove())},UY=e=>{let t=document.createElement(`div`),{type:n,callback:r,options:i,...a}=e,o=document.body.style.overflow;HY(),t.className=`insert-media-dialog`,document.body.style.overflow=`hidden`;let s=(e,n)=>{r(e,n),t.remove(),document.body.style.overflow=o},c=(0,F.jsx)(IY,{...a,uploadSoundSupport:i.uploadSoundSupport,type:n,disablePortal:!0,open:!0,handleClose:s});Ms.render(c,t),document.body.appendChild(t)};function WY({editor:e,node:t,updateAttributes:n,deleteNode:r,options:i}){let{type:a,src:o,width:s,height:c,tag:l}=t.attrs;return(0,P.useEffect)(()=>{o||UY({...t.attrs,options:i,edit:!0,callback:(t,i)=>{t?n(i):r(),e.chain().focus().run()}})},[]),(0,F.jsxs)(Wk,{"data-type":a,style:{width:s,height:c},children:[l===`audio`?(0,F.jsx)(`audio`,{controls:!0,controlsList:`nodownload`,children:(0,F.jsx)(`source`,{type:`audio/mp3`,src:o})}):(0,F.jsx)(`iframe`,{src:o,allowFullScreen:!0,frameBorder:`0`,width:s,height:c}),(0,F.jsx)(BY,{onEdit:()=>{UY({...t.attrs,options:i,edit:!0,callback:(t,r)=>{t&&n(r),e.chain().focus().run()}})},onRemove:r})]})}function GY(e){return Br(`MuiListItem`,e)}Vr(`MuiListItem`,[`root`,`container`,`dense`,`alignItemsFlexStart`,`divider`,`gutters`,`padding`,`secondaryAction`]);var KY=Vr(`MuiListItemButton`,[`root`,`focusVisible`,`dense`,`alignItemsFlexStart`,`disabled`,`divider`,`gutters`,`selected`]);function qY(e){return Br(`MuiListItemSecondaryAction`,e)}Vr(`MuiListItemSecondaryAction`,[`root`,`disableGutters`]);var JY=e=>{let{disableGutters:t,classes:n}=e;return ca({root:[`root`,t&&`disableGutters`]},qY,n)},YY=R(`div`,{name:`MuiListItemSecondaryAction`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.disableGutters&&t.disableGutters]}})({position:`absolute`,right:16,top:`50%`,transform:`translateY(-50%)`,variants:[{props:({ownerState:e})=>e.disableGutters,style:{right:0}}]}),XY=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiListItemSecondaryAction`}),{className:r,...i}=n,a=P.useContext(up),o={...n,disableGutters:a.disableGutters},s=JY(o);return(0,F.jsx)(YY,{className:I(s.root,r),ownerState:o,ref:t,...i})});XY.muiName=`ListItemSecondaryAction`;var ZY=(e,t)=>{let{ownerState:n}=e;return[t.root,n.dense&&t.dense,n.alignItems===`flex-start`&&t.alignItemsFlexStart,n.divider&&t.divider,!n.disableGutters&&t.gutters,!n.disablePadding&&t.padding,n.hasSecondaryAction&&t.secondaryAction]},QY=e=>{let{alignItems:t,classes:n,dense:r,disableGutters:i,disablePadding:a,divider:o,hasSecondaryAction:s}=e;return ca({root:[`root`,r&&`dense`,!i&&`gutters`,!a&&`padding`,o&&`divider`,t===`flex-start`&&`alignItemsFlexStart`,s&&`secondaryAction`],container:[`container`],secondaryAction:[`secondaryAction`]},GY,n)},$Y=R(`div`,{name:`MuiListItem`,slot:`Root`,overridesResolver:ZY})(Nc(({theme:e})=>({display:`flex`,justifyContent:`flex-start`,alignItems:`center`,position:`relative`,textDecoration:`none`,width:`100%`,boxSizing:`border-box`,textAlign:`left`,variants:[{props:({ownerState:e})=>!e.disablePadding,style:{paddingTop:8,paddingBottom:8}},{props:({ownerState:e})=>!e.disablePadding&&e.dense,style:{paddingTop:4,paddingBottom:4}},{props:({ownerState:e})=>!e.disablePadding&&!e.disableGutters,style:{paddingLeft:16,paddingRight:16}},{props:({ownerState:e})=>!e.disablePadding&&!!e.secondaryAction,style:{paddingRight:48}},{props:({ownerState:e})=>!!e.secondaryAction,style:{[`& > .${KY.root}`]:{paddingRight:48}}},{props:{alignItems:`flex-start`},style:{alignItems:`flex-start`}},{props:({ownerState:e})=>e.divider,style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`,backgroundClip:`padding-box`}},{props:({ownerState:e})=>e.button,style:{transition:e.transitions.create(`background-color`,{duration:e.transitions.duration.shortest}),"&:hover":{textDecoration:`none`,backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:`transparent`}}}},{props:({ownerState:e})=>e.hasSecondaryAction,style:{paddingRight:48}}]}))),eX=R(`li`,{name:`MuiListItem`,slot:`Container`})({position:`relative`}),tX=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiListItem`}),{alignItems:r=`center`,children:i,className:a,component:o,components:s={},componentsProps:c={},ContainerComponent:l=`li`,ContainerProps:{className:u,...d}={},dense:f=!1,disableGutters:p=!1,disablePadding:m=!1,divider:h=!1,secondaryAction:g,slotProps:_={},slots:v={},...y}=n,b=P.useContext(up),x=P.useMemo(()=>({dense:f||b.dense||!1,alignItems:r,disableGutters:p}),[r,b.dense,f,p]),S=P.useRef(null),C=P.Children.toArray(i),w=C.length&&hl(C[C.length-1],[`ListItemSecondaryAction`]),T={...n,alignItems:r,dense:x.dense,disableGutters:p,disablePadding:m,divider:h,hasSecondaryAction:w},E=QY(T),D=rc(S,t),[O,k]=zc(`secondaryAction`,{elementType:XY,externalForwardedProps:{slots:v,slotProps:_},ownerState:T,className:E.secondaryAction}),A=v.root||s.Root||$Y,j=_.root||c.root||{},M={className:I(E.root,j.className,a),...y},ee=o||`li`;return w?(ee=!M.component&&!o?`div`:ee,l===`li`&&(ee===`li`?ee=`div`:M.component===`li`&&(M.component=`div`)),(0,F.jsx)(up.Provider,{value:x,children:(0,F.jsxs)(eX,{as:l,className:I(E.container,u),ref:D,ownerState:T,...d,children:[(0,F.jsx)(A,{...j,...!rs(A)&&{as:ee,ownerState:{...T,...j.ownerState}},...M,children:C}),C.pop()]})})):(0,F.jsx)(up.Provider,{value:x,children:(0,F.jsxs)(A,{...j,as:ee,ref:D,...!rs(A)&&{ownerState:{...T,...j.ownerState}},...M,children:[C,g&&(0,F.jsx)(O,{...k,children:g})]})})}),nX=()=>{document.querySelectorAll(`.insert-css-dialog`).forEach(e=>e.remove())},rX=({editor:e,callback:t,opts:n,selectedText:r,parentNode:i})=>{let a=e.options.element,o=document.createElement(`div`),{selection:s}=e.state;nX(),o.className=`insert-css-dialog`;let c=!1,l=e=>{if(c){let t=o.contains(e.target)||void 0,n=a.contains(e.target);t||n||u()}else c=!0},u=()=>{t(void 0,!0),o.remove(),document.body.removeEventListener(`click`,l)},d=e=>{t(e,!0),o.remove(),document.body.removeEventListener(`click`,l)},f=i?.attrs.class,p=e=>{let t=`<span class="${e}">${r}</span>`;if(i){let e=`span`;i?.object===`inline`&&(e=`span`),i?.object===`block`&&(e=`div`),t=`<${e} class="${f}">${i.text.slice(0,s.$anchor.textOffset)}${t}${i.text.slice(s.$head.textOffset)}</${e}>`}return t},m=(0,F.jsxs)(`div`,{style:{background:`white`,height:500,padding:20,overflow:`hidden`,display:`flex`,flexFlow:`column`},children:[(0,F.jsx)(`h2`,{children:`Please choose a css class`}),f&&(0,F.jsxs)(`div`,{children:[`The current parent has this class `,f]}),(0,F.jsx)(pp,{component:`nav`,style:{overflow:`scroll`},children:n.names.map((e,t)=>(0,F.jsxs)(tX,{button:!0,onClick:()=>d(e),children:[(0,F.jsx)(`div`,{style:{marginRight:20},children:e}),(0,F.jsx)(`div`,{dangerouslySetInnerHTML:{__html:p(e)}})]},`rule-${t}`))})]});Ms.render(m,o,()=>{let t=e.view.nodeDOM(e.state.selection.from)?.parentNode;if(t){let e=a.parentElement.parentElement.parentElement.getBoundingClientRect(),n=t.getBoundingClientRect();a.parentElement.parentElement.parentElement.appendChild(o),o.style.maxWidth=`500px`,o.style.position=`absolute`,o.style.top=0,o.style.zIndex=99999;let r=`${n.left+Math.abs(e.left)+t.offsetWidth+10}px`,i=`${n.x}px`;o.style.left=r;let s=o.offsetWidth;o.style.left=`unset`,o.style.right=i;let c=o.offsetWidth;o.style.left=`unset`,o.style.right=`unset`,s>=c?o.style.left=r:o.style.right=i,document.body.addEventListener(`click`,l)}})},iX=qD.create({name:`cssmark`,addOptions(){return{classes:[]}},addAttributes(){return{class:{default:null,parseHTML:e=>e.getAttribute(`class`),renderHTML:e=>e.class?{class:e.class}:{}}}},parseHTML(){return[{tag:`span[class]`,getAttrs:e=>{let t=e.getAttribute(`class`)||``;if(!t)return!1;if((this.options&&this.options.classes||[]).length>0){let e=this.options.classes.find(e=>t.includes(e));return e?{class:e}:!1}return{class:t}}}]},renderHTML({HTMLAttributes:e}){return[`span`,nE(e),0]},addCommands(){return{setCSSClass:e=>({commands:t})=>t.setMark(this.name,{class:e}),unsetCSSClass:()=>({commands:e})=>e.unsetMark(this.name),openCSSClassDialog:()=>({editor:e})=>{rX({editor:e,selectedText:e.state.doc.textBetween(e.state.selection.from,e.state.selection.to),parentNode:e.state.selection.$from.nodeAfter,opts:this.options.extraCSSRules,callback:t=>{t&&e.chain().focus().setCSSClass(t).run()}})}}}}),aX=LN.extend({content:`(div | paragraph | heading | bulletList | orderedList | blockquote | codeBlock | horizontalRule | image | imageUploadNode)+`}),oX=wO.create({name:`headingParagraph`,group:`block`,content:`inline*`,defining:!0,addAttributes(){return{"data-heading":{default:`heading1`,parseHTML:e=>e.getAttribute(`data-heading`),renderHTML:e=>({"data-heading":e[`data-heading`]})}}},parseHTML(){return[{tag:`p[data-heading]`}]},renderHTML({HTMLAttributes:e}){return[`p`,nE(e),0]},addCommands(){return{toggleHeadingParagraph:()=>({commands:e,editor:t})=>t.isActive(`headingParagraph`)?e.setNode(`paragraph`):e.setNode(`headingParagraph`,{"data-heading":`heading1`})}}}),sX=e=>{if(!e)return;let t=/^calc\((.*)\)$/;if(typeof e==`string`){if(e.endsWith(`%`))return;if(e.endsWith(`px`)||e.endsWith(`vh`)||e.endsWith(`vw`)||e.endsWith(`ch`)||e.endsWith(`em`)||e.match(t))return e;let n=parseInt(e,10);return Number.isNaN(n)?n:`${n}px`}if(typeof e==`number`)return`${e}px`},cX=ml((0,F.jsx)(`path`,{d:`M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H7v14h7.04c2.09 0 3.71-1.7 3.71-3.79 0-1.52-.86-2.82-2.15-3.42M10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5`}),`FormatBold`),lX=ml((0,F.jsx)(`path`,{d:`M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4z`}),`FormatItalic`),uX=ml((0,F.jsx)(`path`,{d:`M10 19h4v-3h-4zM5 4v3h5v3h4V7h5V4zM3 14h18v-2H3z`}),`FormatStrikethrough`),dX=ml((0,F.jsx)(`path`,{d:`M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6z`}),`Code`),fX=ml((0,F.jsx)(`path`,{d:`M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2M8 20H4v-4h4zm0-6H4v-4h4zm0-6H4V4h4zm6 12h-4v-4h4zm0-6h-4v-4h4zm0-6h-4V4h4zm6 12h-4v-4h4zm0-6h-4v-4h4zm0-6h-4V4h4z`}),`GridOn`),pX=ml((0,F.jsx)(`path`,{d:`M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5m0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5m0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5M7 19h14v-2H7zm0-6h14v-2H7zm0-8v2h14V5z`}),`FormatListBulleted`),mX=ml((0,F.jsx)(`path`,{d:`M2 17h2v.5H3v1h1v.5H2v1h3v-4H2zm1-9h1V4H2v1h1zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2zm5-6v2h14V5zm0 14h14v-2H7zm0-6h14v-2H7z`}),`FormatListNumbered`),hX=ml((0,F.jsx)(`path`,{d:`M12 17c3.31 0 6-2.69 6-6V3h-2.5v8c0 1.93-1.57 3.5-3.5 3.5S8.5 12.93 8.5 11V3H6v8c0 3.31 2.69 6 6 6m-7 2v2h14v-2z`}),`FormatUnderlined`),gX=ml((0,F.jsx)(`path`,{d:`M18 4H6v2l6.5 6L6 18v2h12v-3h-7l5-5-5-5h7z`}),`Functions`),_X=ml((0,F.jsx)(`path`,{d:`M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2M8.5 13.5l2.5 3.01L14.5 12l4.5 6H5z`}),`Image`),vX=ml((0,F.jsx)(`path`,{d:`M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7z`}),`Redo`),yX=ml((0,F.jsx)(`path`,{d:`M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z`}),`FormatQuote`),bX=ml((0,F.jsx)(`path`,{d:`M18 3v2h-2V3H8v2H6V3H4v18h2v-2h2v2h8v-2h2v2h2V3zM8 17H6v-2h2zm0-4H6v-2h2zm0-4H6V7h2zm10 8h-2v-2h2zm0-4h-2v-2h2zm0-4h-2V7h2z`}),`Theaters`),xX=ml((0,F.jsx)(`path`,{d:`M3 9v6h4l5 5V4L7 9zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02M14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77`}),`VolumeUp`),SX=ml((0,F.jsx)(`path`,{d:`M3 3v18h18V3zm8 16H5v-6h6zm0-8H5V5h6zm8 8h-6v-6h6zm0-8h-6V5h6z`}),`BorderAll`),CX=R(`div`)(({theme:e})=>({fontFamily:`Cerebri Sans !important`,fontSize:e.typography.fontSize,fontWeight:`bold`,lineHeight:`14px`,position:`relative`,top:`7px`,width:`110px`,height:`28px`,whiteSpace:`nowrap`})),wX=()=>(0,F.jsx)(CX,{children:`+ Response Area`}),TX={characters:[[`á`,`é`,`í`,`ó`,`ú`],[`Á`,`É`,`Í`,`Ó`,`Ú`],[`—`,`«`,`»`,`ñ`,`ü`],[`-`,`¿`,`¡`,`Ñ`,`Ü`]]},EX={hasPreview:!0,characters:[[{unicode:`U+00A2`,description:`CENT SIGN`,write:`¢`,label:`¢`},{unicode:`U+00BF`,description:`INVERTED QUESTION MARK`,write:`¿`,label:`¿`},{unicode:`U+00B4`,description:`ACUTE ACCENT`,write:`´`,label:`´`,extraProps:{style:{gridRow:`span 2`}}},{unicode:`U+00E1`,description:`LATIN SMALL LETTER A WITH ACUTE`,write:`á`,label:`á`},{unicode:`U+00E9`,description:`LATIN SMALL LETTER E WITH ACUTE`,write:`é`,label:`é`},{unicode:`U+00ED`,description:`LATIN SMALL LETTER I WITH ACUTE`,write:`í`,label:`í`},{unicode:`U+00F3`,description:`LATIN SMALL LETTER O WITH ACUTE`,write:`ó`,label:`ó`},{unicode:`U+00FA`,description:`LATIN SMALL LETTER U WITH ACUTE`,write:`ú`,label:`ú`},{unicode:`U+00F1`,description:`LATIN SMALL LETTER N WITH TILDE`,write:`ñ`,label:`ñ`}],[{unicode:`U+20AC`,description:`EURO SIGN`,write:`€`,label:`€`},{unicode:`U+00A1`,description:`INVERTED EXCLAMATION MARK`,write:`¡`,label:`¡`},{unicode:`U+00C1`,description:`LATIN CAPITAL LETTER A WITH ACUTE`,write:`Á`,label:`Á`},{unicode:`U+00C9`,description:`LATIN CAPITAL LETTER E WITH ACUTE`,write:`É`,label:`É`},{unicode:`U+00CD`,description:`LATIN CAPITAL LETTER I WITH ACUTE`,write:`Í`,label:`Í`},{unicode:`U+00D3`,description:`LATIN CAPITAL LETTER O WITH ACUTE`,write:`Ó`,label:`Ó`},{unicode:`U+00DA`,description:`LATIN CAPITAL LETTER U WITH ACUTE`,write:`Ú`,label:`Ú`},{unicode:`U+00D1`,description:`LATIN CAPITAL LETTER N WITH TILDE`,write:`Ñ`,label:`Ñ`}],[{unicode:`U+00A3`,description:`POUND SIGN`,write:`£`,label:`£`},{unicode:`U+00AB`,description:`LEFT-POINTING DOUBLE ANGLE QUOTATION MARK`,write:`«`,label:`«`},{unicode:`U+005E`,description:`CIRCUMFLEX ACCENT`,write:`^`,label:`^`,extraProps:{style:{gridRow:`span 2`}}},{unicode:`U+00E2`,description:`LATIN SMALL LETTER A WITH CIRCUMFLEX`,write:`â`,label:`â`},{unicode:`U+00EA`,description:`LATIN SMALL LETTER E WITH CIRCUMFLEX`,write:`ê`,label:`ê`},{unicode:`U+00EE`,description:`LATIN SMALL LETTER I WITH CIRCUMFLEX`,write:`î`,label:`î`},{unicode:`U+00F4`,description:`LATIN SMALL LETTER O WITH CIRCUMFLEX`,write:`ô`,label:`ô`},{unicode:`U+00FB`,description:`LATIN SMALL LETTER U WITH CIRCUMFLEX`,write:`û`,label:`û`},{unicode:`U+00E7`,description:`LATIN SMALL LETTER C WITH CEDILLA`,write:`ç`,label:`ç`}],[{unicode:`U+00A5`,description:`YEN SIGN`,write:`¥`,label:`¥`},{unicode:`U+00BB`,description:`RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK`,write:`»`,label:`»`},{unicode:`U+00C2`,description:`LATIN CAPITAL LETTER A WITH CIRCUMFLEX`,write:`Â`,label:`Â`},{unicode:`U+00CA`,description:`LATIN CAPITAL LETTER E WITH CIRCUMFLEX`,write:`Ê`,label:`Ê`},{unicode:`U+00CE`,description:`LATIN CAPITAL LETTER I WITH CIRCUMFLEX`,write:`Î`,label:`Î`},{unicode:`U+00D4`,description:`LATIN CAPITAL LETTER O WITH CIRCUMFLEX`,write:`Ô`,label:`Ô`},{unicode:`U+00DB`,description:`LATIN CAPITAL LETTER U WITH CIRCUMFLEX`,write:`Û`,label:`Û`},{unicode:`U+00C7`,description:`LATIN CAPITAL LETTER C WITH CEDILLA`,write:`Ç`,label:`Ç`}],[{unicode:`U+200A`,description:`HAIR SPACE`,write:String.fromCodePoint(`0x200A`),label:` `},{unicode:`U+00A7`,description:`SECTION SIGN`,write:`§`,label:`§`},{unicode:`U+00A8`,description:`DIAERESIS`,write:`¨`,label:`¨`,extraProps:{style:{gridRow:`span 2`}}},{unicode:`U+00E4`,description:`LATIN SMALL LETTER A WITH DIAERESIS`,write:`ä`,label:`ä`},{unicode:`U+00EB`,description:`LATIN SMALL LETTER E WITH DIAERESIS`,write:`ë`,label:`ë`},{unicode:`U+00EF`,description:`LATIN SMALL LETTER I WITH DIAERESIS`,write:`ï`,label:`ï`},{unicode:`U+00F6`,description:`LATIN SMALL LETTER O WITH DIAERESIS`,write:`ö`,label:`ö`},{unicode:`U+00FC`,description:`LATIN SMALL LETTER U WITH DIAERESIS`,write:`ü`,label:`ü`},{unicode:`U+00DF`,description:`LATIN SMALL LETTER SHARP S`,write:`ß`,label:`ß`}],[{unicode:`U+2009`,description:`THIN SPACE`,write:String.fromCodePoint(`0x2009`),label:` `},{unicode:`U+2026`,description:`HORIZONTAL ELLIPSIS`,write:`…`,label:`…`},{unicode:`U+00C4`,description:`LATIN CAPITAL LETTER A WITH DIAERESIS`,write:`Ä`,label:`Ä`},{unicode:`U+00CB`,description:`LATIN CAPITAL LETTER E WITH DIAERESIS`,write:`Ë`,label:`Ë`},{unicode:`U+00CF`,description:`LATIN CAPITAL LETTER I WITH DIAERESIS`,write:`Ï`,label:`Ï`},{unicode:`U+00D6`,description:`LATIN CAPITAL LETTER O WITH DIAERESIS`,write:`Ö`,label:`Ö`},{unicode:`U+00DC`,description:`LATIN CAPITAL LETTER U WITH DIAERESIS`,write:`Ü`,label:`Ü`},{unicode:`U+2212`,description:`MINUS SIGN`,write:`−`,label:`−`}],[{unicode:`U+00A0`,description:`NO-BREAK SPACE`,write:String.fromCodePoint(`0x00A0`),label:` `},{unicode:`U+2022`,description:`BULLET`,write:`•`,label:`•`},{unicode:`U+0060`,description:`GRAVE ACCENT`,write:"`",label:"`",extraProps:{style:{gridRow:`span 2`}}},{unicode:`U+00E0`,description:`LATIN SMALL LETTER A WITH GRAVE`,write:`à`,label:`à`},{unicode:`U+00E8`,description:`LATIN SMALL LETTER E WITH GRAVE`,write:`è`,label:`è`},{unicode:`U+00EC`,description:`LATIN SMALL LETTER I WITH GRAVE`,write:`ì`,label:`ì`},{unicode:`U+00F2`,description:`LATIN SMALL LETTER O WITH GRAVE`,write:`ò`,label:`ò`},{unicode:`U+00F9`,description:`LATIN SMALL LETTER U WITH GRAVE`,write:`ù`,label:`ù`},{unicode:`U+2013`,description:`EN DASH`,write:`–`,label:`–`}],[{unicode:`U+2003`,description:`EM SPACE`,write:String.fromCodePoint(`0x2003`),label:` `},{unicode:`U+25E6`,description:`WHITE BULLET`,write:`◦`,label:`◦`},{unicode:`U+00C0`,description:`LATIN CAPITAL LETTER A WITH GRAVE`,write:`À`,label:`À`},{unicode:`U+00C8`,description:`LATIN CAPITAL LETTER E WITH GRAVE`,write:`È`,label:`È`},{unicode:`U+00CC`,description:`LATIN CAPITAL LETTER I WITH GRAVE`,write:`Ì`,label:`Ì`},{unicode:`U+00D2`,description:`LATIN CAPITAL LETTER O WITH GRAVE`,write:`Ò`,label:`Ò`},{unicode:`U+00D9`,description:`LATIN CAPITAL LETTER U WITH GRAVE`,write:`Ù`,label:`Ù`},{unicode:`U+2014`,description:`EM DASH`,write:`—`,label:`—`}]]},DX=()=>(0,F.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 66 66`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,focusable:`false`,children:(0,F.jsx)(`path`,{d:`M42.1875 4.75C42.1875 7.38672 39.9902 9.4375 37.5 9.4375H4.6875C2.05078 9.4375 0 7.38672 0 4.75C0 2.25977 2.05078 0.0625 4.6875 0.0625H37.5C39.9902 0.0625 42.1875 2.25977 42.1875 4.75ZM42.1875 42.25C42.1875 44.8867 39.9902 46.9375 37.5 46.9375H4.6875C2.05078 46.9375 0 44.8867 0 42.25C0 39.7598 2.05078 37.5625 4.6875 37.5625H37.5C39.9902 37.5625 42.1875 39.7598 42.1875 42.25ZM0 23.5C0 21.0098 2.05078 18.8125 4.6875 18.8125H60.9375C63.4277 18.8125 65.625 21.0098 65.625 23.5C65.625 26.1367 63.4277 28.1875 60.9375 28.1875H4.6875C2.05078 28.1875 0 26.1367 0 23.5ZM65.625 61C65.625 63.6367 63.4277 65.6875 60.9375 65.6875H4.6875C2.05078 65.6875 0 63.6367 0 61C0 58.5098 2.05078 56.3125 4.6875 56.3125H60.9375C63.4277 56.3125 65.625 58.5098 65.625 61Z`,fill:`currentColor`})}),OX=()=>(0,F.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 66 66`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,focusable:`false`,children:(0,F.jsx)(`path`,{d:`M65.625 4.75C65.625 7.38672 63.4277 9.4375 60.9375 9.4375H28.125C25.4883 9.4375 23.4375 7.38672 23.4375 4.75C23.4375 2.25977 25.4883 0.0625 28.125 0.0625H60.9375C63.4277 0.0625 65.625 2.25977 65.625 4.75ZM65.625 42.25C65.625 44.8867 63.4277 46.9375 60.9375 46.9375H28.125C25.4883 46.9375 23.4375 44.8867 23.4375 42.25C23.4375 39.7598 25.4883 37.5625 28.125 37.5625H60.9375C63.4277 37.5625 65.625 39.7598 65.625 42.25ZM0 23.5C0 21.0098 2.05078 18.8125 4.6875 18.8125H60.9375C63.4277 18.8125 65.625 21.0098 65.625 23.5C65.625 26.1367 63.4277 28.1875 60.9375 28.1875H4.6875C2.05078 28.1875 0 26.1367 0 23.5ZM65.625 61C65.625 63.6367 63.4277 65.6875 60.9375 65.6875H4.6875C2.05078 65.6875 0 63.6367 0 61C0 58.5098 2.05078 56.3125 4.6875 56.3125H60.9375C63.4277 56.3125 65.625 58.5098 65.625 61Z`,fill:`currentColor`})}),kX=()=>(0,F.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 66 66`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,focusable:`false`,children:(0,F.jsx)(`path`,{d:`M51.5625 4.75C51.5625 7.38672 49.3652 9.4375 46.875 9.4375H18.75C16.1133 9.4375 14.0625 7.38672 14.0625 4.75C14.0625 2.25977 16.1133 0.0625 18.75 0.0625H46.875C49.3652 0.0625 51.5625 2.25977 51.5625 4.75ZM65.625 23.5C65.625 26.1367 63.4277 28.1875 60.9375 28.1875H4.6875C2.05078 28.1875 0 26.1367 0 23.5C0 21.0098 2.05078 18.8125 4.6875 18.8125H60.9375C63.4277 18.8125 65.625 21.0098 65.625 23.5ZM0 61C0 58.5098 2.05078 56.3125 4.6875 56.3125H60.9375C63.4277 56.3125 65.625 58.5098 65.625 61C65.625 63.6367 63.4277 65.6875 60.9375 65.6875H4.6875C2.05078 65.6875 0 63.6367 0 61ZM51.5625 42.25C51.5625 44.8867 49.3652 46.9375 46.875 46.9375H18.75C16.1133 46.9375 14.0625 44.8867 14.0625 42.25C14.0625 39.7598 16.1133 37.5625 18.75 37.5625H46.875C49.3652 37.5625 51.5625 39.7598 51.5625 42.25Z`,fill:`currentColor`})}),AX=()=>(0,F.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 66 66`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,focusable:`false`,children:(0,F.jsx)(`path`,{d:`M65.625 4.75C65.625 7.38672 63.4277 9.4375 60.9375 9.4375H4.6875C2.05078 9.4375 0 7.38672 0 4.75C0 2.25977 2.05078 0.0625 4.6875 0.0625H60.9375C63.4277 0.0625 65.625 2.25977 65.625 4.75ZM65.625 42.25C65.625 44.8867 63.4277 46.9375 60.9375 46.9375H4.6875C2.05078 46.9375 0 44.8867 0 42.25C0 39.7598 2.05078 37.5625 4.6875 37.5625H60.9375C63.4277 37.5625 65.625 39.7598 65.625 42.25ZM0 23.5C0 21.0098 2.05078 18.8125 4.6875 18.8125H60.9375C63.4277 18.8125 65.625 21.0098 65.625 23.5C65.625 26.1367 63.4277 28.1875 60.9375 28.1875H4.6875C2.05078 28.1875 0 26.1367 0 23.5ZM65.625 61C65.625 63.6367 63.4277 65.6875 60.9375 65.6875H4.6875C2.05078 65.6875 0 63.6367 0 61C0 58.5098 2.05078 56.3125 4.6875 56.3125H60.9375C63.4277 56.3125 65.625 58.5098 65.625 61Z`,fill:`currentColor`})}),jX=({editor:e,onChange:t})=>{let[n,r]=(0,P.useState)(!1),i;switch(!0){case e.isActive({textAlign:`right`}):i=(0,F.jsx)(OX,{});break;case e.isActive({textAlign:`center`}):i=(0,F.jsx)(kX,{});break;case e.isActive({textAlign:`justify`}):i=(0,F.jsx)(AX,{});break;default:i=(0,F.jsx)(DX,{});break}let a=t=>{let n=t.currentTarget?.getAttribute(`value`);n&&e.commands.setTextAlign(n),r(!1)};return(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},onClick:e=>{e.preventDefault(),e.stopPropagation(),r(!n)},children:[i,(0,F.jsx)(`span`,{style:{marginLeft:`5px`,fontSize:`8px`},"aria-hidden":`true`,children:`▼`})]}),(0,F.jsx)(ad,{in:n,timeout:`auto`,unmountOnExit:!0,style:{position:`absolute`},children:(0,F.jsxs)(pp,{component:`div`,disablePadding:!0,style:{background:`#fff`,display:`flex`,flexDirection:`row`,padding:0},children:[(0,F.jsx)(tX,{button:!0,type:`submit`,value:`left`,"aria-label":`Align text left`,onClick:a,children:(0,F.jsx)(DX,{})}),(0,F.jsx)(tX,{button:!0,type:`submit`,value:`center`,"aria-label":`Align text center`,onClick:a,children:(0,F.jsx)(kX,{})}),(0,F.jsx)(tX,{button:!0,type:`submit`,value:`right`,"aria-label":`Align text right`,onClick:a,children:(0,F.jsx)(OX,{})}),(0,F.jsx)(tX,{button:!0,type:`submit`,value:`justify`,"aria-label":`Justify text`,onClick:a,children:(0,F.jsx)(AX,{})})]})})]})},MX=R(`div`)(({theme:e})=>({fontFamily:`Cerebri Sans, Arial, sans-serif`,fontSize:e.typography.fontSize,fontWeight:`bold`,lineHeight:`14px`,position:`relative`,whiteSpace:`nowrap`})),NX=()=>(0,F.jsx)(MX,{children:`CSS`}),PX=R(`path`)({fill:`grey`,"&:hover":{fill:`black`}}),FX=e=>t=>(0,F.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,version:`1.1`,width:`24`,height:`24`,viewBox:`0 0 24 24`,"aria-hidden":`true`,focusable:`false`,children:(0,F.jsx)(e,{...t})}),IX=FX(e=>(0,F.jsx)(PX,{...e,d:`M22,10A2,2 0 0,1 20,12H4A2,2 0 0,1 2,10V3H4V5H8V3H10V5H14V3H16V5H20V3H22V10M4,10H8V7H4V10M10,10H14V7H10V10M20,10V7H16V10H20M11,14H13V17H16V19H13V22H11V19H8V17H11V14Z`})),LX=FX(e=>(0,F.jsx)(PX,{...e,d:`M9.41,13L12,15.59L14.59,13L16,14.41L13.41,17L16,19.59L14.59,21L12,18.41L9.41,21L8,19.59L10.59,17L8,14.41L9.41,13M22,9A2,2 0 0,1 20,11H4A2,2 0 0,1 2,9V6A2,2 0 0,1 4,4H20A2,2 0 0,1 22,6V9M4,9H8V6H4V9M10,9H14V6H10V9M16,9H20V6H16V9Z`})),RX=FX(e=>(0,F.jsx)(PX,{...e,d:`M11,2A2,2 0 0,1 13,4V20A2,2 0 0,1 11,22H2V2H11M4,10V14H11V10H4M4,16V20H11V16H4M4,4V8H11V4H4M15,11H18V8H20V11H23V13H20V16H18V13H15V11Z`})),zX=FX(e=>(0,F.jsx)(PX,{...e,d:`M4,2H11A2,2 0 0,1 13,4V20A2,2 0 0,1 11,22H4A2,2 0 0,1 2,20V4A2,2 0 0,1 4,2M4,10V14H11V10H4M4,16V20H11V16H4M4,4V8H11V4H4M17.59,12L15,9.41L16.41,8L19,10.59L21.59,8L23,9.41L20.41,12L23,14.59L21.59,16L19,13.41L16.41,16L15,14.59L17.59,12Z`})),BX=FX(e=>(0,F.jsx)(PX,{...e,d:`M15.46,15.88L16.88,14.46L19,16.59L21.12,14.46L22.54,15.88L20.41,18L22.54,20.12L21.12,21.54L19,19.41L16.88,21.54L15.46,20.12L17.59,18L15.46,15.88M4,3H18A2,2 0 0,1 20,5V12.08C18.45,11.82 16.92,12.18 15.68,13H12V17H13.08C12.97,17.68 12.97,18.35 13.08,19H4A2,2 0 0,1 2,17V5A2,2 0 0,1 4,3M4,7V11H10V7H4M12,7V11H18V7H12M4,13V17H10V13H4Z`})),VX=`bottom`,HX=`right`,UX=`left`,WX=`auto`,GX=[`top`,VX,HX,UX],KX=`start`,qX=`clippingParents`,JX=`viewport`,YX=`popper`,XX=`reference`,ZX=GX.reduce(function(e,t){return e.concat([t+`-`+KX,t+`-end`])},[]),QX=[].concat(GX,[WX]).reduce(function(e,t){return e.concat([t,t+`-`+KX,t+`-end`])},[]),$X=[`beforeRead`,`read`,`afterRead`,`beforeMain`,`main`,`afterMain`,`beforeWrite`,`write`,`afterWrite`];function eZ(e){return e?(e.nodeName||``).toLowerCase():null}function tZ(e){if(e==null)return window;if(e.toString()!==`[object Window]`){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function nZ(e){return e instanceof tZ(e).Element||e instanceof Element}function rZ(e){return e instanceof tZ(e).HTMLElement||e instanceof HTMLElement}function iZ(e){return typeof ShadowRoot>`u`?!1:e instanceof tZ(e).ShadowRoot||e instanceof ShadowRoot}function aZ(e){var t=e.state;Object.keys(t.elements).forEach(function(e){var n=t.styles[e]||{},r=t.attributes[e]||{},i=t.elements[e];!rZ(i)||!eZ(i)||(Object.assign(i.style,n),Object.keys(r).forEach(function(e){var t=r[e];t===!1?i.removeAttribute(e):i.setAttribute(e,t===!0?``:t)}))})}function oZ(e){var t=e.state,n={popper:{position:t.options.strategy,left:`0`,top:`0`,margin:`0`},arrow:{position:`absolute`},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(e){var r=t.elements[e],i=t.attributes[e]||{},a=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce(function(e,t){return e[t]=``,e},{});!rZ(r)||!eZ(r)||(Object.assign(r.style,a),Object.keys(i).forEach(function(e){r.removeAttribute(e)}))})}}var sZ={name:`applyStyles`,enabled:!0,phase:`write`,fn:aZ,effect:oZ,requires:[`computeStyles`]};function cZ(e){return e.split(`-`)[0]}var lZ=Math.max,uZ=Math.min,dZ=Math.round;function fZ(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(e){return e.brand+`/`+e.version}).join(` `):navigator.userAgent}function pZ(){return!/^((?!chrome|android).)*safari/i.test(fZ())}function mZ(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),i=1,a=1;t&&rZ(e)&&(i=e.offsetWidth>0&&dZ(r.width)/e.offsetWidth||1,a=e.offsetHeight>0&&dZ(r.height)/e.offsetHeight||1);var o=(nZ(e)?tZ(e):window).visualViewport,s=!pZ()&&n,c=(r.left+(s&&o?o.offsetLeft:0))/i,l=(r.top+(s&&o?o.offsetTop:0))/a,u=r.width/i,d=r.height/a;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c,x:c,y:l}}function hZ(e){var t=mZ(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function gZ(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&iZ(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function _Z(e){return tZ(e).getComputedStyle(e)}function vZ(e){return[`table`,`td`,`th`].indexOf(eZ(e))>=0}function yZ(e){return((nZ(e)?e.ownerDocument:e.document)||window.document).documentElement}function bZ(e){return eZ(e)===`html`?e:e.assignedSlot||e.parentNode||(iZ(e)?e.host:null)||yZ(e)}function xZ(e){return!rZ(e)||_Z(e).position===`fixed`?null:e.offsetParent}function SZ(e){var t=/firefox/i.test(fZ());if(/Trident/i.test(fZ())&&rZ(e)&&_Z(e).position===`fixed`)return null;var n=bZ(e);for(iZ(n)&&(n=n.host);rZ(n)&&[`html`,`body`].indexOf(eZ(n))<0;){var r=_Z(n);if(r.transform!==`none`||r.perspective!==`none`||r.contain===`paint`||[`transform`,`perspective`].indexOf(r.willChange)!==-1||t&&r.willChange===`filter`||t&&r.filter&&r.filter!==`none`)return n;n=n.parentNode}return null}function CZ(e){for(var t=tZ(e),n=xZ(e);n&&vZ(n)&&_Z(n).position===`static`;)n=xZ(n);return n&&(eZ(n)===`html`||eZ(n)===`body`&&_Z(n).position===`static`)?t:n||SZ(e)||t}function wZ(e){return[`top`,`bottom`].indexOf(e)>=0?`x`:`y`}function TZ(e,t,n){return lZ(e,uZ(t,n))}function EZ(e,t,n){var r=TZ(e,t,n);return r>n?n:r}function DZ(){return{top:0,right:0,bottom:0,left:0}}function OZ(e){return Object.assign({},DZ(),e)}function kZ(e,t){return t.reduce(function(t,n){return t[n]=e,t},{})}var AZ=function(e,t){return e=typeof e==`function`?e(Object.assign({},t.rects,{placement:t.placement})):e,OZ(typeof e==`number`?kZ(e,GX):e)};function jZ(e){var t,n=e.state,r=e.name,i=e.options,a=n.elements.arrow,o=n.modifiersData.popperOffsets,s=cZ(n.placement),c=wZ(s),l=[`left`,`right`].indexOf(s)>=0?`height`:`width`;if(!(!a||!o)){var u=AZ(i.padding,n),d=hZ(a),f=c===`y`?`top`:UX,p=c===`y`?VX:HX,m=n.rects.reference[l]+n.rects.reference[c]-o[c]-n.rects.popper[l],h=o[c]-n.rects.reference[c],g=CZ(a),_=g?c===`y`?g.clientHeight||0:g.clientWidth||0:0,v=m/2-h/2,y=u[f],b=_-d[l]-u[p],x=_/2-d[l]/2+v,S=TZ(y,x,b),C=c;n.modifiersData[r]=(t={},t[C]=S,t.centerOffset=S-x,t)}}function MZ(e){var t=e.state,n=e.options.element,r=n===void 0?`[data-popper-arrow]`:n;r!=null&&(typeof r==`string`&&(r=t.elements.popper.querySelector(r),!r)||gZ(t.elements.popper,r)&&(t.elements.arrow=r))}var NZ={name:`arrow`,enabled:!0,phase:`main`,fn:jZ,effect:MZ,requires:[`popperOffsets`],requiresIfExists:[`preventOverflow`]};function PZ(e){return e.split(`-`)[1]}var FZ={top:`auto`,right:`auto`,bottom:`auto`,left:`auto`};function IZ(e,t){var n=e.x,r=e.y,i=t.devicePixelRatio||1;return{x:dZ(n*i)/i||0,y:dZ(r*i)/i||0}}function LZ(e){var t,n=e.popper,r=e.popperRect,i=e.placement,a=e.variation,o=e.offsets,s=e.position,c=e.gpuAcceleration,l=e.adaptive,u=e.roundOffsets,d=e.isFixed,f=o.x,p=f===void 0?0:f,m=o.y,h=m===void 0?0:m,g=typeof u==`function`?u({x:p,y:h}):{x:p,y:h};p=g.x,h=g.y;var _=o.hasOwnProperty(`x`),v=o.hasOwnProperty(`y`),y=UX,b=`top`,x=window;if(l){var S=CZ(n),C=`clientHeight`,w=`clientWidth`;if(S===tZ(n)&&(S=yZ(n),_Z(S).position!==`static`&&s===`absolute`&&(C=`scrollHeight`,w=`scrollWidth`)),S=S,i===`top`||(i===`left`||i===`right`)&&a===`end`){b=VX;var T=d&&S===x&&x.visualViewport?x.visualViewport.height:S[C];h-=T-r.height,h*=c?1:-1}if(i===`left`||(i===`top`||i===`bottom`)&&a===`end`){y=HX;var E=d&&S===x&&x.visualViewport?x.visualViewport.width:S[w];p-=E-r.width,p*=c?1:-1}}var D=Object.assign({position:s},l&&FZ),O=u===!0?IZ({x:p,y:h},tZ(n)):{x:p,y:h};if(p=O.x,h=O.y,c){var k;return Object.assign({},D,(k={},k[b]=v?`0`:``,k[y]=_?`0`:``,k.transform=(x.devicePixelRatio||1)<=1?`translate(`+p+`px, `+h+`px)`:`translate3d(`+p+`px, `+h+`px, 0)`,k))}return Object.assign({},D,(t={},t[b]=v?h+`px`:``,t[y]=_?p+`px`:``,t.transform=``,t))}function RZ(e){var t=e.state,n=e.options,r=n.gpuAcceleration,i=r===void 0||r,a=n.adaptive,o=a===void 0||a,s=n.roundOffsets,c=s===void 0||s,l={placement:cZ(t.placement),variation:PZ(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:i,isFixed:t.options.strategy===`fixed`};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,LZ(Object.assign({},l,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:o,roundOffsets:c})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,LZ(Object.assign({},l,{offsets:t.modifiersData.arrow,position:`absolute`,adaptive:!1,roundOffsets:c})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}var zZ={name:`computeStyles`,enabled:!0,phase:`beforeWrite`,fn:RZ,data:{}},BZ={passive:!0};function VZ(e){var t=e.state,n=e.instance,r=e.options,i=r.scroll,a=i===void 0||i,o=r.resize,s=o===void 0||o,c=tZ(t.elements.popper),l=[].concat(t.scrollParents.reference,t.scrollParents.popper);return a&&l.forEach(function(e){e.addEventListener(`scroll`,n.update,BZ)}),s&&c.addEventListener(`resize`,n.update,BZ),function(){a&&l.forEach(function(e){e.removeEventListener(`scroll`,n.update,BZ)}),s&&c.removeEventListener(`resize`,n.update,BZ)}}var HZ={name:`eventListeners`,enabled:!0,phase:`write`,fn:function(){},effect:VZ,data:{}},UZ={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function WZ(e){return e.replace(/left|right|bottom|top/g,function(e){return UZ[e]})}var GZ={start:`end`,end:`start`};function KZ(e){return e.replace(/start|end/g,function(e){return GZ[e]})}function qZ(e){var t=tZ(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function JZ(e){return mZ(yZ(e)).left+qZ(e).scrollLeft}function YZ(e,t){var n=tZ(e),r=yZ(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;var l=pZ();(l||!l&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}return{width:a,height:o,x:s+JZ(e),y:c}}function XZ(e){var t=yZ(e),n=qZ(e),r=e.ownerDocument?.body,i=lZ(t.scrollWidth,t.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),a=lZ(t.scrollHeight,t.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),o=-n.scrollLeft+JZ(e),s=-n.scrollTop;return _Z(r||t).direction===`rtl`&&(o+=lZ(t.clientWidth,r?r.clientWidth:0)-i),{width:i,height:a,x:o,y:s}}function ZZ(e){var t=_Z(e),n=t.overflow,r=t.overflowX,i=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function QZ(e){return[`html`,`body`,`#document`].indexOf(eZ(e))>=0?e.ownerDocument.body:rZ(e)&&ZZ(e)?e:QZ(bZ(e))}function $Z(e,t){t===void 0&&(t=[]);var n=QZ(e),r=n===e.ownerDocument?.body,i=tZ(n),a=r?[i].concat(i.visualViewport||[],ZZ(n)?n:[]):n,o=t.concat(a);return r?o:o.concat($Z(bZ(a)))}function eQ(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function tQ(e,t){var n=mZ(e,!1,t===`fixed`);return n.top+=e.clientTop,n.left+=e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function nQ(e,t,n){return t===`viewport`?eQ(YZ(e,n)):nZ(t)?tQ(t,n):eQ(XZ(yZ(e)))}function rQ(e){var t=$Z(bZ(e)),n=[`absolute`,`fixed`].indexOf(_Z(e).position)>=0&&rZ(e)?CZ(e):e;return nZ(n)?t.filter(function(e){return nZ(e)&&gZ(e,n)&&eZ(e)!==`body`}):[]}function iQ(e,t,n,r){var i=t===`clippingParents`?rQ(e):[].concat(t),a=[].concat(i,[n]),o=a[0],s=a.reduce(function(t,n){var i=nQ(e,n,r);return t.top=lZ(i.top,t.top),t.right=uZ(i.right,t.right),t.bottom=uZ(i.bottom,t.bottom),t.left=lZ(i.left,t.left),t},nQ(e,o,r));return s.width=s.right-s.left,s.height=s.bottom-s.top,s.x=s.left,s.y=s.top,s}function aQ(e){var t=e.reference,n=e.element,r=e.placement,i=r?cZ(r):null,a=r?PZ(r):null,o=t.x+t.width/2-n.width/2,s=t.y+t.height/2-n.height/2,c;switch(i){case`top`:c={x:o,y:t.y-n.height};break;case VX:c={x:o,y:t.y+t.height};break;case HX:c={x:t.x+t.width,y:s};break;case UX:c={x:t.x-n.width,y:s};break;default:c={x:t.x,y:t.y}}var l=i?wZ(i):null;if(l!=null){var u=l===`y`?`height`:`width`;switch(a){case KX:c[l]=c[l]-(t[u]/2-n[u]/2);break;case`end`:c[l]=c[l]+(t[u]/2-n[u]/2);break;default:}}return c}function oQ(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=r===void 0?e.placement:r,a=n.strategy,o=a===void 0?e.strategy:a,s=n.boundary,c=s===void 0?qX:s,l=n.rootBoundary,u=l===void 0?JX:l,d=n.elementContext,f=d===void 0?YX:d,p=n.altBoundary,m=p!==void 0&&p,h=n.padding,g=h===void 0?0:h,_=OZ(typeof g==`number`?kZ(g,GX):g),v=f===`popper`?XX:YX,y=e.rects.popper,b=e.elements[m?v:f],x=iQ(nZ(b)?b:b.contextElement||yZ(e.elements.popper),c,u,o),S=mZ(e.elements.reference),C=aQ({reference:S,element:y,strategy:`absolute`,placement:i}),w=eQ(Object.assign({},y,C)),T=f===`popper`?w:S,E={top:x.top-T.top+_.top,bottom:T.bottom-x.bottom+_.bottom,left:x.left-T.left+_.left,right:T.right-x.right+_.right},D=e.modifiersData.offset;if(f===`popper`&&D){var O=D[i];Object.keys(E).forEach(function(e){var t=[`right`,`bottom`].indexOf(e)>=0?1:-1,n=[`top`,`bottom`].indexOf(e)>=0?`y`:`x`;E[e]+=O[n]*t})}return E}function sQ(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=n.boundary,a=n.rootBoundary,o=n.padding,s=n.flipVariations,c=n.allowedAutoPlacements,l=c===void 0?QX:c,u=PZ(r),d=u?s?ZX:ZX.filter(function(e){return PZ(e)===u}):GX,f=d.filter(function(e){return l.indexOf(e)>=0});f.length===0&&(f=d);var p=f.reduce(function(t,n){return t[n]=oQ(e,{placement:n,boundary:i,rootBoundary:a,padding:o})[cZ(n)],t},{});return Object.keys(p).sort(function(e,t){return p[e]-p[t]})}function cQ(e){if(cZ(e)===`auto`)return[];var t=WZ(e);return[KZ(e),t,KZ(t)]}function lQ(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var i=n.mainAxis,a=i===void 0||i,o=n.altAxis,s=o===void 0||o,c=n.fallbackPlacements,l=n.padding,u=n.boundary,d=n.rootBoundary,f=n.altBoundary,p=n.flipVariations,m=p===void 0||p,h=n.allowedAutoPlacements,g=t.options.placement,_=cZ(g)===g,v=c||(_||!m?[WZ(g)]:cQ(g)),y=[g].concat(v).reduce(function(e,n){return e.concat(cZ(n)===`auto`?sQ(t,{placement:n,boundary:u,rootBoundary:d,padding:l,flipVariations:m,allowedAutoPlacements:h}):n)},[]),b=t.rects.reference,x=t.rects.popper,S=new Map,C=!0,w=y[0],T=0;T<y.length;T++){var E=y[T],D=cZ(E),O=PZ(E)===KX,k=[`top`,VX].indexOf(D)>=0,A=k?`width`:`height`,j=oQ(t,{placement:E,boundary:u,rootBoundary:d,altBoundary:f,padding:l}),M=k?O?HX:UX:O?VX:`top`;b[A]>x[A]&&(M=WZ(M));var ee=WZ(M),N=[];if(a&&N.push(j[D]<=0),s&&N.push(j[M]<=0,j[ee]<=0),N.every(function(e){return e})){w=E,C=!1;break}S.set(E,N)}if(C)for(var te=m?3:1,ne=function(e){var t=y.find(function(t){var n=S.get(t);if(n)return n.slice(0,e).every(function(e){return e})});if(t)return w=t,`break`},re=te;re>0&&ne(re)!==`break`;re--);t.placement!==w&&(t.modifiersData[r]._skip=!0,t.placement=w,t.reset=!0)}}var uQ={name:`flip`,enabled:!0,phase:`main`,fn:lQ,requiresIfExists:[`offset`],data:{_skip:!1}};function dQ(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function fQ(e){return[`top`,HX,VX,UX].some(function(t){return e[t]>=0})}function pQ(e){var t=e.state,n=e.name,r=t.rects.reference,i=t.rects.popper,a=t.modifiersData.preventOverflow,o=oQ(t,{elementContext:`reference`}),s=oQ(t,{altBoundary:!0}),c=dQ(o,r),l=dQ(s,i,a),u=fQ(c),d=fQ(l);t.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:l,isReferenceHidden:u,hasPopperEscaped:d},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}var mQ={name:`hide`,enabled:!0,phase:`main`,requiresIfExists:[`preventOverflow`],fn:pQ};function hQ(e,t,n){var r=cZ(e),i=[`left`,`top`].indexOf(r)>=0?-1:1,a=typeof n==`function`?n(Object.assign({},t,{placement:e})):n,o=a[0],s=a[1];return o||=0,s=(s||0)*i,[`left`,`right`].indexOf(r)>=0?{x:s,y:o}:{x:o,y:s}}function gQ(e){var t=e.state,n=e.options,r=e.name,i=n.offset,a=i===void 0?[0,0]:i,o=QX.reduce(function(e,n){return e[n]=hQ(n,t.rects,a),e},{}),s=o[t.placement],c=s.x,l=s.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=c,t.modifiersData.popperOffsets.y+=l),t.modifiersData[r]=o}var _Q={name:`offset`,enabled:!0,phase:`main`,requires:[`popperOffsets`],fn:gQ};function vQ(e){var t=e.state,n=e.name;t.modifiersData[n]=aQ({reference:t.rects.reference,element:t.rects.popper,strategy:`absolute`,placement:t.placement})}var yQ={name:`popperOffsets`,enabled:!0,phase:`read`,fn:vQ,data:{}};function bQ(e){return e===`x`?`y`:`x`}function xQ(e){var t=e.state,n=e.options,r=e.name,i=n.mainAxis,a=i===void 0||i,o=n.altAxis,s=o!==void 0&&o,c=n.boundary,l=n.rootBoundary,u=n.altBoundary,d=n.padding,f=n.tether,p=f===void 0||f,m=n.tetherOffset,h=m===void 0?0:m,g=oQ(t,{boundary:c,rootBoundary:l,padding:d,altBoundary:u}),_=cZ(t.placement),v=PZ(t.placement),y=!v,b=wZ(_),x=bQ(b),S=t.modifiersData.popperOffsets,C=t.rects.reference,w=t.rects.popper,T=typeof h==`function`?h(Object.assign({},t.rects,{placement:t.placement})):h,E=typeof T==`number`?{mainAxis:T,altAxis:T}:Object.assign({mainAxis:0,altAxis:0},T),D=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,O={x:0,y:0};if(S){if(a){var k=b===`y`?`top`:UX,A=b===`y`?VX:HX,j=b===`y`?`height`:`width`,M=S[b],ee=M+g[k],N=M-g[A],te=p?-w[j]/2:0,ne=v===`start`?C[j]:w[j],re=v===`start`?-w[j]:-C[j],ie=t.elements.arrow,ae=p&&ie?hZ(ie):{width:0,height:0},oe=t.modifiersData[`arrow#persistent`]?t.modifiersData[`arrow#persistent`].padding:DZ(),se=oe[k],ce=oe[A],le=TZ(0,C[j],ae[j]),ue=y?C[j]/2-te-le-se-E.mainAxis:ne-le-se-E.mainAxis,de=y?-C[j]/2+te+le+ce+E.mainAxis:re+le+ce+E.mainAxis,fe=t.elements.arrow&&CZ(t.elements.arrow),pe=fe?b===`y`?fe.clientTop||0:fe.clientLeft||0:0,me=D?.[b]??0,he=M+ue-me-pe,ge=M+de-me,_e=TZ(p?uZ(ee,he):ee,M,p?lZ(N,ge):N);S[b]=_e,O[b]=_e-M}if(s){var ve=b===`x`?`top`:UX,ye=b===`x`?VX:HX,be=S[x],xe=x===`y`?`height`:`width`,Se=be+g[ve],Ce=be-g[ye],we=[`top`,UX].indexOf(_)!==-1,Te=D?.[x]??0,Ee=we?Se:be-C[xe]-w[xe]-Te+E.altAxis,De=we?be+C[xe]+w[xe]-Te-E.altAxis:Ce,Oe=p&&we?EZ(Ee,be,De):TZ(p?Ee:Se,be,p?De:Ce);S[x]=Oe,O[x]=Oe-be}t.modifiersData[r]=O}}var SQ={name:`preventOverflow`,enabled:!0,phase:`main`,fn:xQ,requiresIfExists:[`offset`]};function CQ(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function wQ(e){return e===tZ(e)||!rZ(e)?qZ(e):CQ(e)}function Mee(e){var t=e.getBoundingClientRect(),n=dZ(t.width)/e.offsetWidth||1,r=dZ(t.height)/e.offsetHeight||1;return n!==1||r!==1}function TQ(e,t,n){n===void 0&&(n=!1);var r=rZ(t),i=rZ(t)&&Mee(t),a=yZ(t),o=mZ(e,i,n),s={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(r||!r&&!n)&&((eZ(t)!==`body`||ZZ(a))&&(s=wQ(t)),rZ(t)?(c=mZ(t,!0),c.x+=t.clientLeft,c.y+=t.clientTop):a&&(c.x=JZ(a))),{x:o.left+s.scrollLeft-c.x,y:o.top+s.scrollTop-c.y,width:o.width,height:o.height}}function EQ(e){var t=new Map,n=new Set,r=[];e.forEach(function(e){t.set(e.name,e)});function i(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach(function(e){if(!n.has(e)){var r=t.get(e);r&&i(r)}}),r.push(e)}return e.forEach(function(e){n.has(e.name)||i(e)}),r}function DQ(e){var t=EQ(e);return $X.reduce(function(e,n){return e.concat(t.filter(function(e){return e.phase===n}))},[])}function OQ(e){var t;return function(){return t||=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})}),t}}function kQ(e){var t=e.reduce(function(e,t){var n=e[t.name];return e[t.name]=n?Object.assign({},n,t,{options:Object.assign({},n.options,t.options),data:Object.assign({},n.data,t.data)}):t,e},{});return Object.keys(t).map(function(e){return t[e]})}var AQ={placement:`bottom`,modifiers:[],strategy:`absolute`};function jQ(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(e){return!(e&&typeof e.getBoundingClientRect==`function`)})}function MQ(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,r=n===void 0?[]:n,i=t.defaultOptions,a=i===void 0?AQ:i;return function(e,t,n){n===void 0&&(n=a);var i={placement:`bottom`,orderedModifiers:[],options:Object.assign({},AQ,a),modifiersData:{},elements:{reference:e,popper:t},attributes:{},styles:{}},o=[],s=!1,c={state:i,setOptions:function(n){var o=typeof n==`function`?n(i.options):n;u(),i.options=Object.assign({},a,i.options,o),i.scrollParents={reference:nZ(e)?$Z(e):e.contextElement?$Z(e.contextElement):[],popper:$Z(t)};var s=DQ(kQ([].concat(r,i.options.modifiers)));return i.orderedModifiers=s.filter(function(e){return e.enabled}),l(),c.update()},forceUpdate:function(){if(!s){var e=i.elements,t=e.reference,n=e.popper;if(jQ(t,n)){i.rects={reference:TQ(t,CZ(n),i.options.strategy===`fixed`),popper:hZ(n)},i.reset=!1,i.placement=i.options.placement,i.orderedModifiers.forEach(function(e){return i.modifiersData[e.name]=Object.assign({},e.data)});for(var r=0;r<i.orderedModifiers.length;r++){if(i.reset===!0){i.reset=!1,r=-1;continue}var a=i.orderedModifiers[r],o=a.fn,l=a.options,u=l===void 0?{}:l,d=a.name;typeof o==`function`&&(i=o({state:i,options:u,name:d,instance:c})||i)}}}},update:OQ(function(){return new Promise(function(e){c.forceUpdate(),e(i)})}),destroy:function(){u(),s=!0}};if(!jQ(e,t))return c;c.setOptions(n).then(function(e){!s&&n.onFirstUpdate&&n.onFirstUpdate(e)});function l(){i.orderedModifiers.forEach(function(e){var t=e.name,n=e.options,r=n===void 0?{}:n,a=e.effect;if(typeof a==`function`){var s=a({state:i,name:t,instance:c,options:r});o.push(s||function(){})}})}function u(){o.forEach(function(e){return e()}),o=[]}return c}}var NQ=MQ({defaultModifiers:[HZ,yQ,zZ,sZ,_Q,uQ,SQ,NZ,mQ]});function PQ(e){return Br(`MuiPopper`,e)}Vr(`MuiPopper`,[`root`]);function FQ(e,t){if(t===`ltr`)return e;switch(e){case`bottom-end`:return`bottom-start`;case`bottom-start`:return`bottom-end`;case`top-end`:return`top-start`;case`top-start`:return`top-end`;default:return e}}function IQ(e){return typeof e==`function`?e():e}function LQ(e){return e.nodeType!==void 0}var RQ=e=>{let{classes:t}=e;return ca({root:[`root`]},PQ,t)},zQ={},BQ=P.forwardRef(function(e,t){let{anchorEl:n,children:r,direction:i,disablePortal:a,modifiers:o,open:s,placement:c,popperOptions:l,popperRef:u,slotProps:d={},slots:f={},TransitionProps:p,ownerState:m,...h}=e,g=P.useRef(null),_=nc(g,t),v=P.useRef(null),y=nc(v,u),b=P.useRef(y);ti(()=>{b.current=y},[y]),P.useImperativeHandle(u,()=>v.current,[]);let x=FQ(c,i),[S,C]=P.useState(x),[w,T]=P.useState(IQ(n));P.useEffect(()=>{v.current&&v.current.forceUpdate()}),P.useEffect(()=>{n&&T(IQ(n))},[n]),ti(()=>{if(!w||!s)return;let e=e=>{C(e.placement)},t=[{name:`preventOverflow`,options:{altBoundary:a}},{name:`flip`,options:{altBoundary:a}},{name:`onUpdate`,enabled:!0,phase:`afterWrite`,fn:({state:t})=>{e(t)}}];o!=null&&(t=t.concat(o)),l&&l.modifiers!=null&&(t=t.concat(l.modifiers));let n=NQ(w,g.current,{placement:x,...l,modifiers:t});b.current(n);let r=g.current;return()=>{if(r){let{style:e}=r,t=e.position,i=e.top,a=e.left,o=e.transform;n.destroy(),e.position=t,e.top=i,e.left=a,e.transform=o}else n.destroy();b.current(null)}},[w,a,o,s,l,x]);let E={placement:S};p!==null&&(E.TransitionProps=p);let D=RQ(e),O=f.root??`div`;return(0,F.jsx)(O,{...lp({elementType:O,externalSlotProps:d.root,externalForwardedProps:h,additionalProps:{role:`tooltip`,ref:_},ownerState:e,className:D.root}),children:typeof r==`function`?r(E):r})}),VQ=R(P.forwardRef(function(e,t){let{anchorEl:n,children:r,container:i,direction:a=`ltr`,disablePortal:o=!1,keepMounted:s=!1,modifiers:c,open:l,placement:u=`bottom`,popperOptions:d=zQ,popperRef:f,style:p,transition:m=!1,slotProps:h={},slots:g={},..._}=e,[v,y]=P.useState(!0),b=()=>{y(!1)},x=()=>{y(!0)};if(!s&&!l&&(!m||v))return null;let S;if(i)S=i;else if(n){let e=IQ(n);S=e&&LQ(e)?ds(e).body:ds(null).body}let C=!l&&s&&(!m||v)?`none`:void 0,w=m?{in:l,onEnter:b,onExited:x}:void 0;return(0,F.jsx)(Mc,{disablePortal:o,container:S,children:(0,F.jsx)(BQ,{anchorEl:n,direction:a,disablePortal:o,modifiers:c,ref:t,open:m?!v:l,placement:u,popperOptions:d,popperRef:f,slotProps:h,slots:g,..._,style:{position:`fixed`,top:0,left:0,display:C,...p},TransitionProps:w,children:r})})}),{name:`MuiPopper`,slot:`Root`})({}),HQ=R(P.forwardRef(function(e,t){let n=Di(),{anchorEl:r,component:i,components:a,componentsProps:o,container:s,disablePortal:c,keepMounted:l,modifiers:u,open:d,placement:f,popperOptions:p,popperRef:m,transition:h,slots:g,slotProps:_,...v}=cs({props:e,name:`MuiPopper`}),y=g?.root??a?.Root,b={anchorEl:r,container:s,disablePortal:c,keepMounted:l,modifiers:u,open:d,placement:f,popperOptions:p,popperRef:m,transition:h,...v};return(0,F.jsx)(VQ,{as:i,direction:n?`rtl`:`ltr`,slots:{root:y},slotProps:_??o,...b,ref:t})}))({background:`#fff`,padding:`10px`,pointerEvents:`none`,zIndex:99999}),UQ=R(vG)({fontSize:50,textAlign:`center`}),WQ=({children:e,...t})=>(0,F.jsx)(HQ,{id:`mouse-over-popover`,open:!0,anchorOrigin:{vertical:`bottom`,horizontal:`left`},transformOrigin:{vertical:`top`,horizontal:`left`},disableRestoreFocus:!0,disableAutoFocus:!0,...t,children:(0,F.jsx)(UQ,{children:e})}),GQ=({letter:e})=>(0,F.jsx)(`div`,{style:{fontSize:`24px`,lineHeight:`24px`},children:e});GQ.propTypes={letter:v.string};function KQ({editor:e,opts:t,onClose:n}){if(!t?.characters?.length)return null;let r=(0,P.useRef)(null),i=(0,P.useRef)(n),[a,o]=(0,P.useState)({top:0,left:0}),[s,c]=(0,P.useState)(null);i.current=n;let l=(0,P.useMemo)(()=>{if(!t)return TX;switch(!0){case t.language===`spanish`:return TX;case t.language===`special`:return EX;default:return t}},[t]),u=(0,P.useMemo)(()=>l.characters.reduce((e,t)=>(t.length>=e.columns&&(e.columns=t.length),e),{rows:l.characters.length,columns:0}),[l]),d=()=>c(null);(0,P.useEffect)(()=>()=>{d()},[]),(0,P.useEffect)(()=>{if(!e)return;let t=e.options.element,n=e.view.dom,a=()=>{if(!r.current)return;let n=t.getBoundingClientRect(),{from:i}=e.state.selection,a=e.view.coordsAtPos(i),s=r.current.offsetHeight,c=r.current.offsetWidth,l=window.innerHeight-(n.bottom+60)>=s||n.top<s+80?n.bottom+60:n.top-s-20,u=a.left;l=Math.max(8,Math.min(l,window.innerHeight-s-8)),u=Math.max(8,Math.min(u,window.innerWidth-c-8)),o({top:l,left:u})};a();let s=null,c=()=>{s===null&&(s=requestAnimationFrame(()=>{s=null,a()}))};window.addEventListener(`scroll`,c,!0),window.addEventListener(`resize`,c);let l=e=>{r.current&&!r.current.contains(e.target)&&!n.contains(e.target)&&i.current()},u=setTimeout(()=>{document.addEventListener(`click`,l)});return()=>{clearTimeout(u),s!==null&&cancelAnimationFrame(s),window.removeEventListener(`scroll`,c,!0),window.removeEventListener(`resize`,c),document.removeEventListener(`click`,l)}},[e]);let f=(e,t)=>c({anchorEl:e.currentTarget,el:t});return(0,F.jsxs)(F.Fragment,{children:[Ms.createPortal((0,F.jsx)(`div`,{ref:r,className:`insert-character-dialog`,"data-toolbar-for":e.instanceId,style:{visibility:a.top===0&&a.left===0?`hidden`:`initial`,position:`fixed`,top:`${a.top}px`,left:`${a.left}px`,maxWidth:`500px`,zIndex:1e3},children:(0,F.jsx)(`div`,{children:(0,F.jsx)(vq,{keyPadCharacterRef:t.keyPadCharacterRef,setKeypadInteraction:t.setKeypadInteraction,autoFocus:!0,noDecimal:!0,hideInput:!0,noLatexHandling:!0,hideDoneButtonBackground:!0,layoutForKeyPad:u,additionalKeys:l.characters.reduce((e,t)=>(e=[...e,...t.map(e=>({name:Ip(e,`name`)||e,write:Ip(e,`write`)||e,label:Ip(e,`label`)||e,category:`character`,extraClass:`character`,extraProps:{...e.extraProps||{},style:{...(e.extraProps||{}).style,border:`1px solid #000`}},...l.hasPreview?{actions:{onMouseEnter:t=>f(t,e),onMouseLeave:d}}:{}}))],e),[]),keypadMode:`language`,onChange:t=>{typeof t==`string`&&e.chain().focus().insertContent(t).run()},onDone:n})})}),document.body),s&&Ms.createPortal((0,F.jsxs)(WQ,{onClose:d,anchorEl:s.anchorEl,children:[(0,F.jsx)(`div`,{children:s.el.label}),(0,F.jsx)(`div`,{style:{fontSize:20,lineHeight:`20px`},children:s.el.description}),(0,F.jsx)(`div`,{style:{fontSize:20,lineHeight:`20px`},children:s.el.unicode})]}),document.body)]})}KQ.propTypes={editor:v.object,opts:v.object,onClose:v.func.isRequired};var qQ=()=>(0,F.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,height:`24px`,viewBox:`0 0 24 24`,width:`24px`,fill:`none`,"aria-hidden":`true`,focusable:`false`,children:(0,F.jsx)(`path`,{d:`M22,7h-2v1h3v1h-4V7c0-0.55,0.45-1,1-1h2V5h-3V4h3c0.55,0,1,0.45,1,1v1C23,6.55,22.55,7,22,7z M5.88,20h2.66l3.4-5.42h0.12 l3.4,5.42h2.66l-4.65-7.27L17.81,6h-2.68l-3.07,4.99h-0.12L8.85,6H6.19l4.32,6.73L5.88,20z`,fill:`currentColor`})}),JQ=()=>(0,F.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,height:`24px`,viewBox:`0 0 24 24`,width:`24px`,fill:`none`,"aria-hidden":`true`,focusable:`false`,children:(0,F.jsx)(`path`,{d:`M22,18h-2v1h3v1h-4v-2c0-0.55,0.45-1,1-1h2v-1h-3v-1h3c0.55,0,1,0.45,1,1v1C23,17.55,22.55,18,22,18z M5.88,18h2.66 l3.4-5.42h0.12l3.4,5.42h2.66l-4.65-7.27L17.81,4h-2.68l-3.07,4.99h-0.12L8.85,4H6.19l4.32,6.73L5.88,18z`,fill:`currentColor`})}),YQ=()=>(0,F.jsx)(`svg`,{width:`30`,height:`28`,viewBox:`0 0 30 28`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,style:{width:`20px`,height:`18px`},"aria-hidden":`true`,focusable:`false`,children:(0,F.jsx)(`path`,{d:`M27 4V24H29C29.5 24 30 24.5 30 25V27C30 27.5625 29.5 28 29 28H19C18.4375 28 18 27.5625 18 27V25C18 24.5 18.4375 24 19 24H21V16H9V24H11C11.5 24 12 24.5 12 25V27C12 27.5625 11.5 28 11 28H1C0.4375 28 0 27.5625 0 27V25C0 24.5 0.4375 24 1 24H3V4H1C0.4375 4 0 3.5625 0 3V1C0 0.5 0.4375 0 1 0H11C11.5 0 12 0.5 12 1V3C12 3.5625 11.5 4 11 4H9V12H21V4H19C18.4375 4 18 3.5625 18 3V1C18 0.5 18.4375 0 19 0H29C29.5 0 30 0.5 30 1V3C30 3.5625 29.5 4 29 4H27Z`,fill:`currentColor`})});function XQ({editor:e,classes:t,activePlugins:n,toolbarOpts:r,responseAreaProps:i,onChange:a,autoWidthToolbar:o}){let[s,c]=(0,P.useState)(!1),l=r??{},u=Ik({editor:e,selector:e=>{let{selection:t}=e.editor?.state||{},n;if(!e.editor?.commandManager)return{};t instanceof Rv&&(n=t.node);let r=e.editor?.isActive(`math`)||e.editor?.isActive(`explicit_constructed_response`)||e.editor?.isActive(`imageUploadNode`)||e.editor?.isActive(`drag_in_the_blank`),i=t&&t.empty===!1&&e.editor.isActive(`table`);return{currentNode:n,hideDefaultToolbar:r,hasTextSelectionInTable:i,isFocused:e.editor?.isFocused,toolbarOpened:e.editor?._toolbarOpened??!1,isBold:e.editor.isActive(`bold`)??!1,canBold:e.editor.can().chain().toggleBold().run()??!1,isTable:e.editor.isActive(`table`)??!1,tableHasBorder:e.editor.getAttributes(`table`)?.border===`1`,canTable:e.editor.can().chain().insertTable().run()??!1,isItalic:e.editor.isActive(`italic`)??!1,canItalic:e.editor.can().chain().toggleItalic().run()??!1,isStrike:e.editor.isActive(`strike`)??!1,canStrike:e.editor.can().chain().toggleStrike().run()??!1,isCode:e.editor.isActive(`code`)??!1,canCode:e.editor.can().chain().toggleCode().run()??!1,canClearMarks:e.editor.can().chain().unsetAllMarks().run()??!1,isUnderline:e.editor.isActive(`underline`)??!1,isSubScript:e.editor.isActive(`subscript`)??!1,isSuperScript:e.editor.isActive(`superscript`)??!1,isParagraph:e.editor.isActive(`paragraph`)??!1,isHeading1:e.editor.isActive(`heading`,{level:1})??!1,isHeading2:e.editor.isActive(`heading`,{level:2})??!1,isHeading3:e.editor.isActive(`heading`,{level:3})??!1,isHeadingParagraph:e.editor.isActive(`headingParagraph`)??!1,isHeading4:e.editor.isActive(`heading`,{level:4})??!1,isHeading5:e.editor.isActive(`heading`,{level:5})??!1,isHeading6:e.editor.isActive(`heading`,{level:6})??!1,isBulletList:e.editor.isActive(`bulletList`)??!1,isOrderedList:e.editor.isActive(`orderedList`)??!1,isCodeBlock:e.editor.isActive(`codeBlock`)??!1,isBlockquote:e.editor.isActive(`blockquote`)??!1,canUndo:e.editor.can().chain().undo().run()??!1,canRedo:e.editor.can().chain().redo().run()??!1}}}),d=!!o,f=I(t.toolbar,mR,{[t.toolbarWithNoDone]:!0,[t.toolbarTop]:l.position===`top`,[t.toolbarRight]:l.alignment===`right`,[t.focused]:l.alwaysVisible||u.isFocused&&!u.toolbarOpened&&!u.hideDefaultToolbar,[t.autoWidth]:d,[t.fullWidth]:!d,[t.hidden]:l.isHidden===!0}),p=l.minWidth===void 0?{}:{minWidth:l.minWidth},m=e=>{e.preventDefault()},h=(0,P.useMemo)(()=>[{icon:(0,F.jsx)(fX,{}),label:`Insert table`,onClick:e=>e.chain().focus().insertTable({rows:2,cols:2,withHeaderRow:!1}).run(),hidden:e=>!n?.includes(`table`)||e.isTable,isActive:e=>e.isTable,isDisabled:e=>!e.canTable},{icon:(0,F.jsx)(IX,{}),label:`Add table row`,onClick:e=>e.chain().focus().addRowAfter().run(),hidden:e=>!(e.isTable&&!e.hasTextSelectionInTable),isActive:e=>e.isTable,isDisabled:e=>!e.canTable},{icon:(0,F.jsx)(LX,{}),label:`Remove table row`,onClick:e=>e.chain().focus().deleteRow().run(),hidden:e=>!(e.isTable&&!e.hasTextSelectionInTable),isActive:e=>e.isTable,isDisabled:e=>!e.canTable},{icon:(0,F.jsx)(RX,{}),label:`Add table column`,onClick:e=>e.chain().focus().addColumnAfter().run(),hidden:e=>!(e.isTable&&!e.hasTextSelectionInTable),isActive:e=>e.isTable,isDisabled:e=>!e.canTable},{icon:(0,F.jsx)(zX,{}),label:`Remove table column`,onClick:e=>e.chain().focus().deleteColumn().run(),hidden:e=>!(e.isTable&&!e.hasTextSelectionInTable),isActive:e=>e.isTable,isDisabled:e=>!e.canTable},{icon:(0,F.jsx)(BX,{}),label:`Remove table`,onClick:e=>e.chain().focus().deleteTable().run(),hidden:e=>!(e.isTable&&!e.hasTextSelectionInTable),isActive:e=>e.isTable,isDisabled:e=>!e.canTable},{icon:(0,F.jsx)(SX,{}),label:`Table borders`,toggle:!0,onClick:e=>{let t=e.getAttributes(`table`),n={...t,border:t.border===`0`?`1`:`0`};e.commands.updateAttributes(`table`,n)},hidden:e=>!(e.isTable&&!e.hasTextSelectionInTable),isActive:e=>e.tableHasBorder,isDisabled:e=>!e.canTable},{icon:(0,F.jsx)(cX,{}),label:`Bold`,toggle:!0,onClick:e=>e.chain().focus().toggleBold().run(),hidden:()=>!n?.includes(`bold`),isActive:e=>e.isBold,isDisabled:e=>!e.canBold},{icon:(0,F.jsx)(lX,{}),label:`Italic`,toggle:!0,onClick:e=>e.chain().focus().toggleItalic().run(),hidden:()=>!n?.includes(`italic`),isActive:e=>e.isItalic,isDisabled:e=>!e.canItalic},{icon:(0,F.jsx)(uX,{}),label:`Strikethrough`,toggle:!0,onClick:e=>e.chain().focus().toggleStrike().run(),hidden:()=>!n?.includes(`strikethrough`),isActive:e=>e.isStrike,isDisabled:e=>!e.canStrike},{icon:(0,F.jsx)(dX,{}),label:`Code`,toggle:!0,onClick:e=>e.chain().focus().toggleCode().run(),hidden:()=>!n?.includes(`code`),isActive:e=>e.isCode,isDisabled:e=>!e.canCode},{icon:(0,F.jsx)(hX,{}),label:`Underline`,toggle:!0,onClick:e=>e.chain().focus().toggleUnderline().run(),hidden:()=>!n?.includes(`underline`),isActive:e=>e.isUnderline},{icon:(0,F.jsx)(JQ,{}),label:`Subscript`,toggle:!0,onClick:e=>e.chain().focus().toggleSubscript().run(),hidden:()=>!n?.includes(`subscript`),isActive:e=>e.isSubScript},{icon:(0,F.jsx)(qQ,{}),label:`Superscript`,toggle:!0,onClick:e=>e.chain().focus().toggleSuperscript().run(),hidden:()=>!n?.includes(`superscript`),isActive:e=>e.isSuperScript},{icon:(0,F.jsx)(_X,{}),label:`Insert image`,hidden:()=>!n?.includes(`image`),onClick:e=>e.chain().focus().setImageUploadNode().run()},{icon:(0,F.jsx)(bX,{}),label:`Insert video`,hidden:()=>!n?.includes(`video`),onClick:e=>e.chain().focus().insertMedia({type:`video`}).run()},{icon:(0,F.jsx)(xX,{}),label:`Insert audio`,hidden:()=>!n?.includes(`audio`),onClick:e=>e.chain().focus().insertMedia({type:`audio`,tag:`audio`}).run()},{icon:(0,F.jsx)(NX,{}),label:`CSS classes`,hidden:()=>!n?.includes(`css`),onClick:e=>e.commands.openCSSClassDialog()},{icon:(0,F.jsx)(yX,{}),label:`Blockquote`,toggle:!0,hidden:()=>!n?.includes(`blockquote`),onClick:e=>e.chain().focus().toggleBlockquote().run(),isActive:e=>e.isBlockquote},{icon:(0,F.jsx)(YQ,{}),label:`Heading`,toggle:!0,hidden:()=>!n?.includes(`h3`),onClick:e=>e.chain().focus().toggleHeadingParagraph().run(),isActive:e=>e.isHeadingParagraph},{icon:(0,F.jsx)(gX,{}),label:`Insert math`,hidden:()=>!n?.includes(`math`),onClick:e=>e.chain().focus().insertMath(``).run()},{icon:(0,F.jsx)(GQ,{letter:`ñ`}),label:`Spanish characters (ñ)`,hidden:()=>!n?.includes(`languageCharacters`),onClick:()=>c(TX)},{icon:(0,F.jsx)(GQ,{letter:`€`}),label:`Special characters (€)`,hidden:()=>n?.filter(e=>e===`languageCharacters`).length!==2,onClick:()=>c(EX)},{icon:(0,F.jsx)(jX,{editor:e}),label:`Text alignment`,hidden:()=>!n?.includes(`text-align`),onClick:()=>{}},{icon:(0,F.jsx)(pX,{}),label:`Bulleted list`,toggle:!0,hidden:()=>!n?.includes(`bulleted-list`),onClick:e=>e.chain().focus().toggleBulletList().run(),isActive:e=>e.isBulletList},{icon:(0,F.jsx)(mX,{}),label:`Numbered list`,toggle:!0,hidden:()=>!n?.includes(`numbered-list`),onClick:e=>e.chain().focus().toggleOrderedList().run(),isActive:e=>e.isOrderedList},{icon:(0,F.jsx)(mf,{}),label:`Undo`,hidden:()=>!n?.includes(`undo`),onClick:e=>e.chain().focus().undo().run(),isDisabled:e=>!e.canUndo},{icon:(0,F.jsx)(vX,{}),label:`Redo`,hidden:()=>!n?.includes(`redo`),onClick:e=>e.chain().focus().redo().run(),isDisabled:e=>!e.canRedo}],[n,e]),g=u.hideDefaultToolbar&&u.currentNode?.type?.name===`drag_in_the_blank`;return(0,F.jsxs)(`div`,{className:f,style:{...p},onMouseDown:m,children:[g&&(0,F.jsx)(`div`,{className:t.defaultToolbar,tabIndex:`1`,children:(0,F.jsx)(`div`,{className:t.buttonsContainer,children:(0,F.jsx)(`button`,{type:`button`,className:t.button,onClick:t=>{t.preventDefault(),e.chain().focus().deleteSelection().run(),a?.(e.getHTML())},"aria-label":`Delete response area`,title:`Delete response area`,children:(0,F.jsx)(pR,{})})})}),!u.hideDefaultToolbar&&(0,F.jsxs)(`div`,{className:t.defaultToolbar,tabIndex:`1`,children:[(0,F.jsx)(`div`,{className:t.buttonsContainer,children:h.filter(e=>!e.hidden?.(u)).map((n,r)=>{let i=n.isDisabled?.(u),a=n.isActive?.(u);return(0,F.jsx)(`button`,{type:`button`,disabled:i,"aria-label":n.label,title:n.label,"aria-pressed":n.toggle?!!a:void 0,onClick:t=>{t.preventDefault(),n.onClick(e)},className:I(t.button,{[t.active]:a}),children:n.icon},r)})}),n?.includes(`responseArea`)&&(0,F.jsx)(`button`,{type:`button`,"aria-label":`Insert response area`,title:`Insert response area`,onClick:()=>{e.chain().focus().insertResponseArea(i.type).run()},className:t.button,children:(0,F.jsx)(wX,{})}),l.showDone&&(0,F.jsx)(vR,{onClick:()=>{a?.(e.getHTML()),e.commands.blur()}})]}),s&&(0,F.jsx)(KQ,{editor:e,opts:{...s,renderPopOver:(e,t)=>console.log(`Show popover`,t),closePopOver:()=>console.log(`Close popover`)},onClose:()=>c(!1)})]})}var ZQ=e=>{xo();let t={defaultToolbar:`defaultToolbar`,buttonsContainer:`buttonsContainer`,button:`toolbarButton`,active:`active`,disabled:`disabled`,isActive:`isActive`,toolbar:`toolbar`,toolbarWithNoDone:`toolbarWithNoDone`,toolbarTop:`toolbarTop`,toolbarRight:`toolbarRight`,fullWidth:`fullWidth`,hidden:`hidden`,autoWidth:`autoWidth`,focused:`focused`,iconRoot:`iconRoot`,label:`label`,shared:`shared`};return(0,F.jsx)(QQ,{children:(0,F.jsx)(XQ,{...e,classes:t})})},QQ=R(`div`)(()=>({height:0,overflow:`visible`,"& .defaultToolbar":{display:`flex`,width:`100%`,justifyContent:`space-between`},"& .buttonsContainer":{alignItems:`center`,display:`flex`,width:`100%`},"& .toolbarButton":{color:`grey`,display:`inline-flex`,padding:`2px`,background:`none`,border:`none`,cursor:`pointer`,"& svg":{width:`24px`,height:`24px`},"&:hover":{color:Il()},"&:focus":{outline:`2px solid ${Tu()}`}},"& .active":{color:Il()},"& .disabled":{opacity:.7,cursor:`not-allowed`,"& :hover":{color:Ll()}},"& .isActive":{background:`var(--purple)`,color:`var(--white)`},"& .toolbar":{position:`relative`,top:`5px`,zIndex:20,cursor:`pointer`,justifyContent:`space-between`,background:`var(--editable-html-toolbar-bg, #efefef)`,minWidth:`280px`,margin:0,padding:`2px`,boxShadow:`0px 1px 5px 0px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 3px 1px -2px rgba(0, 0, 0, 0.12)`,boxSizing:`border-box`,display:`flex`,opacity:0,pointerEvents:`none`},"& .toolbarWithNoDone":{minWidth:`265px`},"& .toolbarTop":{position:`absolute`,top:`-45px`},"& .toolbarRight":{right:0},"& .fullWidth":{width:`fit-content`,minWidth:`100%`},"& .hidden":{visibility:`hidden`},"& .autoWidth":{width:`fit-content`},"& .focused":{opacity:1,pointerEvents:`auto`},"& .iconRoot":{width:`28px`,height:`28px`,padding:`4px`,verticalAlign:`top`},"& .label":{color:`var(--editable-html-toolbar-check, #00bb00)`},"& .shared":{display:`flex`}})),$Q=R(`div`,{shouldForwardProp:e=>![`noBorder`,`error`].includes(e)})(({theme:e,noBorder:t,error:n})=>({position:`relative`,padding:`0px`,border:t?`none`:`1px solid #ccc`,borderRadius:`4px`,cursor:`text`,'& [data-slate-editor="true"]':{wordBreak:`break-word`,overflow:`visible`,maxHeight:`500px`,padding:`5px`},"&:first-child":{marginTop:0},"& ul, & ol":{padding:`0 1rem`,margin:`1.25rem 1rem 1.25rem 0.4rem`},"& ul li p, & ol li p":{marginTop:`0.25em`,marginBottom:`0.25em`},"& h1, & h2, & h3, & h4, & h5, & h6":{lineHeight:1.1,marginTop:`2.5rem`,textWrap:`pretty`},"& h1, & h2":{marginTop:`3.5rem`,marginBottom:`1.5rem`},"& h1":{fontSize:`1.4rem`},"& h2":{fontSize:`1.2rem`},"& h3":{fontSize:`1.1rem`},"& h4, & h5, & h6":{fontSize:`1rem`},"& code":{backgroundColor:`var(--purple-light)`,borderRadius:`0.4rem`,color:`var(--black)`,fontSize:`0.85rem`,padding:`0.25em 0.3em`},"& pre":{background:`var(--black)`,borderRadius:`0.5rem`,color:`var(--white)`,fontFamily:`'JetBrainsMono', monospace`,margin:`1.5rem 0`,padding:`0.75rem 1rem`,"& code":{background:`none`,color:`inherit`,fontSize:`0.8rem`,padding:0}},"& blockquote":{background:`#f9f9f9`,borderLeft:`5px solid #ccc`,margin:`1.5em 10px`,padding:`.5em 10px`},"& p":{margin:`0`},"& table":{tableLayout:`fixed`,width:`100%`,borderCollapse:`collapse`,color:Il(),backgroundColor:iu()},'& table:not([border="1"]) tr':{borderTop:`1px solid ${gu()}`},"& td, th":{padding:`.6em 1em`,textAlign:`center`},'& table:not([border="1"]) td, th':{border:`1px solid ${gu()}`},...n&&{border:`2px solid ${e.palette.error.main} !important`}})),e$=R(`div`,{shouldForwardProp:e=>![`disableScrollbar`,`highlightShape`].includes(e)})(({theme:e,disableScrollbar:t,highlightShape:n})=>({position:`relative`,padding:`0px`,overflowY:`auto`,color:Il(),backgroundColor:n?e.palette.action.selected:iu(),...t&&{"&::-webkit-scrollbar":{display:`none`},scrollbarWidth:`none`,"-ms-overflow-style":`none`}})),t$=R(`div`,{shouldForwardProp:e=>e!==`noPadding`})(({noPadding:e})=>({padding:e?0:`10px 8px`}));function n$(e){let[t,n]=(0,P.useState)(null),r=(0,P.useRef)(null),{editor:i,disabled:a,children:o,disableScrollbar:s,activePlugins:c,toolbarOpts:l,responseAreaProps:u,autoFocus:d,minWidth:f,width:p,maxWidth:m,minHeight:h,height:g,maxHeight:_,highlightShape:v,ref:y}=e;(0,P.useEffect)(()=>{i&&r.current&&(i._tiptapContainerEl=r.current)},[i,r.current]),(0,P.useEffect)(()=>{i&&d&&Promise.resolve().then(()=>{i.commands.focus(`end`)})},[i,d]),(0,P.useEffect)(()=>{if(e.adjustWidthForLimit){let t=document.createElement(`p`);t.style.visibility=`hidden`,t.style.position=`absolute`,t.style.whiteSpace=`nowrap`,t.textContent=`W`.repeat(e.charactersLimit);let i=window.getComputedStyle(r.current);[`fontFamily`,`fontSize`,`fontWeight`,`fontStyle`,`letterSpacing`,`wordSpacing`,`textTransform`,`lineHeight`].forEach(e=>{t.style[e]=i[e]}),document.body.appendChild(t),n(`${t.offsetWidth+27}px`),t.remove()}},[e.adjustWidthForLimit,e.charactersLimit]);let b=(0,P.useMemo)(()=>({width:sX(t||p),minWidth:sX(f),maxWidth:sX(m),height:sX(g),minHeight:sX(h),maxHeight:sX(_)}),[t,f,p,m,h,g,_]);return(0,F.jsxs)($Q,{noBorder:l&&l.noBorder,error:l&&l.error,className:e.className,style:{width:b.width,minWidth:b.minWidth,maxWidth:b.maxWidth},ref:r,children:[(0,F.jsx)(e$,{disableScrollbar:s,highlightShape:v,children:(0,F.jsx)(t$,{noPadding:l&&l.noPadding,children:o})}),i&&(0,F.jsx)(ZQ,{editor:i,responseAreaProps:u,toolbarOpts:l,activePlugins:c,onChange:e.onChange,autoWidthToolbar:e.autoWidthToolbar})]})}var r$=Uu(`@pie-lib:editable-html:plugins`),i$=[`bold`,`html`,`extraCSSRules`,`italic`,`underline`,`strikethrough`,`bulleted-list`,`numbered-list`,`image`,`math`,`languageCharacters`,`text-align`,`blockquote`,`h3`,`table`,`video`,`audio`,`responseArea`,`redo`,`undo`,`superscript`,`subscript`],a$={"text-align":`textAlign`,"bulleted-list":`ul_list`,"numbered-list":`ol_list`},o$=i$.filter(e=>![`responseArea`,`h3`,`blockquote`].includes(e)),s$=(e,t,n)=>{r$(`[buildPlugins] opts: `,n),e||=o$;let r=(t,n=!0)=>e.includes(t)&&n&&t,i=n.image&&n.image.delete,a=n.math,o=n.responseArea&&n.responseArea.type,s=!Lp(n.extraCSSRules),c=n?.languageCharacters||[];return Np([r(`table`),r(`bold`),r(`italic`),r(`strikethrough`),r(`underline`),r(`superscript`),r(`subscript`),r(`image`,!!i),r(`video`),r(`audio`),r(`math`,!!a),...c.map(e=>r(`languageCharacters`,e)),r(`text-align`),r(`blockquote`),r(`h3`),r(`bulleted-list`),r(`numbered-list`),r(`undo`),r(`redo`),r(`responseArea`,!!o),r(`css`,!!s),r(`html`,!!n.html)])},c$={position:`bottom`,alignment:`left`,alwaysVisible:!1,showDone:!0,doneOn:`blur`},l$={options:{},respAreaToolbar:()=>{},onHandleAreaChange:()=>{}},u$=[`bold`,`italic`,`underline`,`strikethrough`,`code`,`bulleted-list`,`numbered-list`,`image`,`math`,`languageCharacters`,`text-align`,`table`,`video`,`audio`,`responseArea`,`superscript`,`subscript`,`css`,`h3`,`undo`,`redo`],d$={"--white":`#fff`,"--black":`#2e2b29`,"--black-contrast":`#110f0e`,"--gray-1":`rgba(61, 37, 20, .05)`,"--gray-2":`rgba(61, 37, 20, .08)`,"--gray-3":`rgba(61, 37, 20, .12)`,"--gray-4":`rgba(53, 38, 28, .3)`,"--gray-5":`rgba(28, 25, 23, .6)`,"--green":`#22c55e`,"--purple":`#6a00f5`,"--purple-contrast":`#5800cc`,"--purple-light":`rgba(88, 5, 255, .05)`,"--yellow-contrast":`#facc15`,"--yellow":`rgba(250, 204, 21, .4)`,"--yellow-light":`#fffae5`,"--red":`#ff5c33`,"--red-light":`#ffebe5`,"--shadow":`0px 12px 33px 0px rgba(0, 0, 0, .06),
|
|
357
|
-
0px 3.618px 9.949px 0px rgba(0, 0, 0, .04)`},f$=e=>({role:`textbox`,"data-pie-editor":`true`,spellcheck:e?`true`:`false`,autocorrect:e?`on`:`off`,autocapitalize:e?`on`:`off`}),p$=e=>{let{showParagraphs:t,separateParagraphs:n}=e.pluginProps||{},[r,i]=(0,P.useState)([]),[a,o]=(0,P.useState)(!1),{toolbarOpts:s}=e,c=(0,P.useCallback)(e=>{i(t=>{let n=t.filter(t=>t.pos!==e);return n.length===0&&o(!1),n})},[i]),l={...c$,...s},u=(0,P.useCallback)(t=>{let n=t.getHTML();e.markup!==n&&e.onChange?.(n),l.doneOn===`blur`&&e.onDone?.(n)},[e.markup,e.onChange,e.onDone,l.doneOn]),d=(0,P.useMemo)(()=>({...l$,...e.responseAreaProps,onInlineDropdownToolbarClose:u}),[e.responseAreaProps,u]),f=(0,P.useMemo)(()=>{let{customPlugins:t,...n}=e.pluginProps||{};t||=[];let r=(e.activePlugins||u$)?.filter(e=>{let t=a$[e]||e,r=n[t]||{};return!r||!r.disabled});return s$(r,t,{math:{},textAlign:e.textAlign,html:{},extraCSSRules:e.extraCSSRules||{},image:{...e.imageSupport},toolbar:{},table:{},responseArea:{type:d.type},languageCharacters:e.languageCharactersProps,keyPadCharacterRef:{},setKeypadInteraction:{},media:{}})},[e,d.type]),p=[qF.configure({types:[`heading`,`paragraph`,`div`,`headingParagraph`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`td`,`th`],alignments:[`left`,`right`,`center`,`justify`]}),WF,oF.configure({limit:e.charactersLimit||1e6}),PF.configure({trailingNode:{node:`paragraph`,notAfter:[`paragraph`,`div`]},link:{autolink:!1,linkOnPaste:!1}}),aX,iR,oX,aR,oR,XF.configure({placeholder:e.placeholder,showOnlyWhenEditable:!0,showOnlyCurrent:!1,includeChildren:!0}),eR,IL,rR,nR,aG.configure(d),oG.configure(d),cG.configure(d),lG.configure(d),sG.configure(d),wq.configure({toolbarOpts:l,math:e.pluginProps?.math||{}}),KF,GF,YF,RJ.configure({toolbarOpts:l,imageHandling:{disableImageAlignmentButtons:e.disableImageAlignmentButtons,onDone:t=>e.onDone?.(t.getHTML()),onDelete:e.imageSupport&&e.imageSupport.delete&&(t=>{let{src:n}=t.attrs;e.imageSupport.delete(n,e=>{c(t.pos)})}),insertImageRequested:e.imageSupport&&((t,n,r)=>{let[o,s]=n,l=n=>{let r;a&&n&&(r=e.onChange),c(s),r?.(t.getHTML())};t._insertingImage=!0,i(e=>[...e,o]),(()=>{let n=r(l),i=Pp(()=>{let e=()=>window.removeEventListener(`focus`,i);if(!t._insertingImage){e();return}c(s),t._insertingImage=!1,e()},500);window.addEventListener(`focus`,i),e.imageSupport.add(n)})()}),maxImageWidth:e.maxImageWidth,maxImageHeight:e.maxImageHeight},limit:3}),VY.configure({uploadSoundSupport:e.uploadSoundSupport}),iX.configure({extraCSSRules:e.extraCSSRules})],m=e.spellCheck!==!1,h=Bk({extensions:p,immediatelyRender:!1,editorProps:{attributes:f$(m),handleKeyDown(t,n){return e.onKeyDown?e.onKeyDown(n):!1}},editable:!e.disabled,content:$F(e.markup),onUpdate:({editor:t,transaction:n})=>{n.isDone&&e.onChange?.(t.getHTML())},onBlur:({editor:e})=>{e._insertingImage||e._toolbarOpened||e.isActive(`inline_dropdown`)||e.isActive(`explicit_constructed_response`)||!e.schema||u(e)}},[e.charactersLimit]);(0,P.useEffect)(()=>{e.editorRef&&e.editorRef(h)},[e.editorRef,h]),(0,P.useEffect)(()=>{h?.setEditable(!e.disabled)},[e.disabled,h]),(0,P.useEffect)(()=>{if(!h)return;let e=h.options?.editorProps,t={...e?.attributes,...f$(m)};e?.attributes?.spellcheck!==t.spellcheck&&h.setOptions({editorProps:{...e,attributes:t}})},[m,h]),(0,P.useEffect)(()=>{if(!h)return;let t=$F(e.markup);t!==h.getHTML()&&h.commands.setContent(t,{emitUpdate:!1})},[e.markup,h]),(0,P.useEffect)(()=>{Object.entries(d$).forEach(([e,t])=>{document.documentElement.style.setProperty(e,t)})},[]);let g=Ik({editor:h,selector:e=>({isFocused:e.editor?.isFocused})}),_=(0,P.useMemo)(()=>{let{minWidth:t,width:n,maxWidth:r,minHeight:i,height:a,maxHeight:o}=e;return{width:sX(n),minWidth:sX(t),maxWidth:sX(r),height:sX(a),minHeight:sX(i),maxHeight:sX(o)}},[e]);return(0,F.jsx)(n$,{...e,activePlugins:f,toolbarOpts:l,editorState:g,editor:h,children:h&&(0,F.jsx)(m$,{style:{minHeight:_.minHeight,height:_.height,maxHeight:_.maxHeight},showParagraph:t&&!t.disabled,separateParagraph:n&&!n.disabled,editor:h})})},m$=R(Nk,{shouldForwardProp:e=>![`showParagraph`,`separateParagraph`].includes(e)})(({showParagraph:e,separateParagraph:t})=>({display:`flex`,outline:`none !important`,"& .ProseMirror":{flex:1,padding:`5px`,maxHeight:`500px`,outline:`none !important`,position:`initial`,"& > p, & > div":{margin:`0`},"& p[data-placeholder].is-empty:only-child, & div[data-placeholder].is-empty:only-child":{position:`relative`},"& p[data-placeholder].is-empty:only-child::before, & div[data-placeholder].is-empty:only-child::before":{content:`attr(data-placeholder)`,position:`absolute`,left:0,top:0,color:`#9CA3AF`,pointerEvents:`none`,whiteSpace:`pre-wrap`},...e&&{"& > p:has(+ p)::after, & > div:has(+ div)::after":{display:`block`,content:`"¶"`,fontSize:`1em`,color:`#146EB3`}},...t&&{"& > p:has(+ p)":{marginBottom:`1em`}}}})),h$=p$,g$={min:v.number.isRequired,max:v.number.isRequired,step:v.number},_$=v.shape(g$),v$=v.shape(g$),y$=v.shape({width:v.number.isRequired,height:v.number.isRequired});v.shape({x:v.number.isRequired,y:v.number.isRequired});var b$=v.oneOfType([v.arrayOf(v.node),v.node]).isRequired,x$=v.shape({x:v.func.isRequired,y:v.func.isRequired}),S$=v.shape({x:v.func.isRequired,y:v.func.isRequired}),C$=v.shape({scale:x$.isRequired,snap:S$.isRequired,domain:_$.isRequired,range:v$.isRequired,size:y$.isRequired}),w$={graphProps:C$.isRequired,mark:v.object,onChange:v.func,onDelete:v.func,onClick:v.func};v.shape(w$);var T$=o(((e,t)=>{t.exports=function(e,t,n,r,i,a,o,s){if(!e){var c;if(t===void 0)c=Error(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var l=[n,r,i,a,o,s],u=0;c=Error(t.replace(/%s/g,function(){return l[u++]})),c.name=`Invariant Violation`}throw c.framesToPop=1,c}}}));function E$(e,t){this.x=e,this.y=t}E$.prototype={clone(){return new E$(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){let t=e.x-this.x,n=e.y-this.y;return t*t+n*n},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){let t=e[0]*this.x+e[1]*this.y,n=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=n,this},_add(e){return this.x+=e.x,this.y+=e.y,this},_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){let e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){let t=Math.cos(e),n=Math.sin(e),r=t*this.x-n*this.y,i=n*this.x+t*this.y;return this.x=r,this.y=i,this},_rotateAround(e,t){let n=Math.cos(e),r=Math.sin(e),i=t.x+n*(this.x-t.x)-r*(this.y-t.y),a=t.y+r*(this.x-t.x)+n*(this.y-t.y);return this.x=i,this.y=a,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:E$},E$.convert=function(e){if(e instanceof E$)return e;if(Array.isArray(e))return new E$(+e[0],+e[1]);if(e.x!==void 0&&e.y!==void 0)return new E$(+e.x,+e.y);throw Error(`Expected [x, y] or {x, y} point format`)};var D$=l(T$(),1),O$=(e,t,n)=>{let r=Hp(e,t,n);return r.splice(r.length,1,t),r};function k$(e,t,n,r){if(r>=t)return t;if(r<=e)return e;let i=O$(e,t,n);return i=i.filter(e=>Math.abs(r-e)<=n),i.length&&i.reduce((e,t)=>Math.abs(t-r)<=Math.abs(e-r)?t:e)}var A$=(e,t,n)=>({left:t.min-e.left,right:Math.abs(e.right-t.max),top:Math.abs(e.top-n.max),bottom:n.min-e.bottom}),j$=e=>new E$(e.x,e.y),M$=(e,t)=>j$(t).sub(j$(e)),N$=e=>(new DOMParser()?.parseFromString(e,`text/html`))?.body?.textContent||``,P$=e=>e&&Object.keys(e).length===0&&e.constructor===Object,F$=e=>typeof e==`string`&&e.trim()===``;function I$(e){return typeof e==`function`||typeof e==`object`&&!!e&&typeof e.$$typeof==`symbol`}function L$(e,t){return!e||I$(e)?e:I$(e.default)?e.default:t&&I$(e[t])?e[t]:t&&I$(e[t]?.default)?e[t].default:e}var R$=L$(ep,`Readable`)||L$(V$.Readable,`Readable`),z$=Op,B$=z$.default,V$=B$&&typeof B$==`object`?B$:z$,H$={axisLabel:{fontSize:12,textAlign:`center`,margin:4,padding:`4px 0`},chartLabel:{fontSize:16,textAlign:`center`,margin:4,padding:`4px 0`},disabledLabel:{pointerEvents:`none`,width:`100%`},editLabel:{position:`absolute`,backgroundColor:`white`,borderRadius:4,boxShadow:`0px 5px 8px rgba(0,0,0,0.15)`,zIndex:10},rotateLeftLabel:{transform:`rotate(-90deg)`,transformOrigin:`0 0`,position:`absolute`},rotateRightLabel:{transform:`rotate(90deg)`,transformOrigin:`0 0`,position:`absolute`},customBottom:{position:`absolute`},displayNone:{display:`none`},centerPlaceholder:{"& .ProseMirror p.is-editor-empty::before, & .ProseMirror div.is-editor-empty::before":{left:0,right:0,width:`100%`,textAlign:`center`}}},U$=R(`div`)({...H$.centerPlaceholder}),W$=R(`div`)({...H$.disabledLabel,"& p":{margin:0}}),G$=e=>{let{disabledLabel:t,graphHeight:n,graphWidth:r,isChartBottomLabel:i,isDefineChartBottomLabel:a,isChartLeftLabel:o,isDefineChartLeftLabel:s,placeholder:c,text:l,side:u,onChange:d,mathMlOptions:f={},charactersLimit:p,titleHeight:m,preventNewLines:h}=e,[g,_]=(0,P.useState)(!1),v=[`bold`,`italic`,`underline`,`strikethrough`,`math`],y=i||o||a||s,b=u===`left`&&s&&n-220,x={width:b||(u===`left`||u===`right`?n-8:r-8),top:b||o&&`${n-70}px`||u===`left`&&`${n-8}px`||i&&`${n-60+m}px`||u===`bottom`&&`${n-120+m}px`||0,left:u===`right`&&`${r-8}px`||(s||a)&&`40px`||i&&`-10px`||0},S={width:r-8,top:u===`right`?`${n-22}px`:0,left:0},C=()=>{!t&&(u===`left`||u===`right`)&&_(!0)},w=()=>{_(!1),requestAnimationFrame(()=>{document.activeElement?.blur?.()})},T=e=>!!(h&&e.key===`Enter`);return(0,F.jsx)(R$,{false:!0,children:(0,F.jsx)(U$,{onClick:C,style:{...g?S:x,...y?H$.chartLabel:H$.axisLabel,...u===`left`&&!g?H$.rotateLeftLabel:{},...u===`right`&&!g?H$.rotateRightLabel:{},...g?H$.editLabel:{},...i||a?H$.customBottom:{},...t&&!y&&F$(N$(l))&&H$.displayNone},children:t?(0,F.jsx)(W$,{dangerouslySetInnerHTML:{__html:l||``}}):(0,F.jsx)(h$,{markup:l||``,onChange:d,placeholder:!t&&c,toolbarOpts:{position:u===`bottom`?`top`:`bottom`,noPadding:!0,noBorder:!0},disableScrollbar:!0,activePlugins:v,onDone:w,onKeyDown:T,mathMlOptions:f,charactersLimit:p})})})};G$.propTypes={disabledLabel:v.bool,graphHeight:v.number,graphWidth:v.number,isChartBottomLabel:v.bool,isDefineChartBottomLabel:v.bool,isChartLeftLabel:v.bool,isDefineChartLeftLabel:v.bool,placeholder:v.string,text:v.string,side:v.string,onChange:v.func,mathMlOptions:v.object,charactersLimit:v.number,titleHeight:v.number};function K$(e){return typeof e==`function`||typeof e==`object`&&!!e&&typeof e.$$typeof==`symbol`}function q$(e,t){return!e||K$(e)?e:K$(e.default)?e.default:t&&K$(e[t])?e[t]:t&&K$(e[t]?.default)?e[t].default:e}var J$=q$(ep,`Readable`)||q$(Z$.Readable,`Readable`),Y$=Op,X$=Y$.default,Z$=X$&&typeof X$==`object`?X$:Y$,Q$={"& .ProseMirror p.is-editor-empty::before, & .ProseMirror div.is-editor-empty::before":{left:0,right:0,width:`100%`,textAlign:`center`}},$$=R(`div`)(({theme:e})=>({border:`solid 1px ${Xl()}`,color:V.TEXT,backgroundColor:e.palette.common.white,touchAction:`none`,position:`relative`,boxSizing:`unset`})),e1=R(`div`)({display:`flex`,position:`relative`}),t1=R(`svg`)({paddingLeft:`50px`,overflow:`visible`,boxSizing:`content-box`}),n1=R(`svg`)({overflow:`visible`,boxSizing:`content-box`}),r1=R(`g`)({cursor:`pointer`,userSelect:`none`}),i1=R(`div`)(({theme:e})=>({color:V.TEXT,fontSize:e.typography.fontSize+2,padding:`${e.spacing(1.5)} ${e.spacing(.5)} 0`,textAlign:`center`,"&.disabledTitle":{pointerEvents:`none`},"&.rightMargin":{marginRight:`74px`},"& p":{margin:0},...Q$})),a1=R(`div`)(({theme:e})=>({color:V.TEXT,fontSize:e.typography.fontSize+4,padding:`${e.spacing(1.5)} ${e.spacing(.5)} 0`,textAlign:`center`,"&.disabledTitle":{pointerEvents:`none`},"&.rightMargin":{marginRight:`74px`},"& p":{margin:0},...Q$})),o1=R(`div`)({display:`flex`,paddingTop:`6px`}),s1=R(`div`)({display:`flex`,flexDirection:`column`,alignItems:`center`,width:`100px`,pointerEvents:`none`,userSelect:`none`}),c1=R(`div`)({width:`70px`,display:`flex`,flexDirection:`column`,marginRight:`6px`}),l1=R(`div`)({textAlign:`right`,height:`20px`,pointerEvents:`none`,userSelect:`none`,"&:not(:last-child)":{marginBottom:`80px`}}),u1=class extends P.Component{constructor(e){super(e),this.state={titleHeight:0},this.resizeObserver=null}static propTypes={title:v.string,children:b$,defineChart:v.bool,disabledLabels:v.bool,disabledTitle:v.bool,graphProps:C$.isRequired,isChart:v.bool,labels:v.object,labelsPlaceholders:v.object,onChangeTitle:v.func,onMouseMove:v.func,showLabels:v.bool,showTitle:v.bool,showPixelGuides:v.bool,rootRef:v.func,onChangeLabels:v.func,titlePlaceholder:v.string,mathMlOptions:v.object,labelsCharactersLimit:v.number};mouseMove=(e,t)=>{let{graphProps:n,onMouseMove:r}=this.props;if(!r)return;let{scale:i,snap:a}=n,o=Wh(t,e.node()),s=i.x.invert(o[0]),c=i.y.invert(o[1]);r({x:a.x(s),y:a.y(c)})};componentDidMount(){let e=Hh(this.g);e.on(`mousemove`,this.mouseMove.bind(this,e)),this.measureTitleHeight(),this.setupVisibilityObserver()}componentWillUnmount(){Hh(this.g).on(`mousemove`,null),this.cleanupVisibilityObserver()}componentDidUpdate(e){e.title!==this.props.title&&this.measureTitleHeight()}onChangeLabel=(e,t)=>{let{labels:n,onChangeLabels:r,isChart:i}=this.props;if(r){if(i){r(t===`left`?`range`:`domain`,e);return}r({...n,[t]:e})}};measureTitleHeight=()=>{let e=this.titleRef;if(e){let t=e.clientHeight;this.setState({titleHeight:t,prevTitle:this.props.title}),!this.resizeObserver&&typeof ResizeObserver<`u`&&this.setupVisibilityObserver()}};handleKeyDown=()=>{setTimeout(()=>{this.measureTitleHeight()},0)};setupVisibilityObserver=()=>{typeof ResizeObserver<`u`&&this.titleRef&&(this.resizeObserver=new ResizeObserver(e=>{for(let t of e){let{width:e,height:n}=t.contentRect;if(e>0&&n>0){setTimeout(()=>{this.measureTitleHeight()},10);break}}}),this.resizeObserver.observe(this.titleRef))};cleanupVisibilityObserver=()=>{this.resizeObserver&&=(this.resizeObserver.disconnect(),null)};render(){let{disabledTitle:e,disabledLabels:t,labels:n,labelsPlaceholders:r,titlePlaceholder:i,graphProps:a,children:o,defineChart:s,onChangeTitle:c,isChart:l,showLabels:u,showPixelGuides:d,showTitle:f,title:p,rootRef:m,mathMlOptions:h={},labelsCharactersLimit:g}=this.props,{size:{width:_=500,height:v=500},domain:y,range:b}=a,x=F$(N$(n?.left))&&P$(r)?48:70,S=F$(N$(n?.right))&&P$(r)?48:70,C=_+x+S+(y.padding||0)*2,w=v+80+(b.padding||0)*2,T=[`bold`,`italic`,`underline`,`superscript`,`subscript`,`strikethrough`,`math`],E=s&&d?v-160:v,D=parseInt(_/100),O=parseInt(E/100),k=parseInt(E%100),{titleHeight:A}=this.state;return(0,F.jsxs)($$,{children:[d&&(0,F.jsx)(o1,{style:{marginLeft:l?80:u?30:10},children:[...Array(D+1).keys()].map(e=>(0,F.jsx)(J$,{false:!0,children:(0,F.jsxs)(s1,{children:[(0,F.jsxs)(`div`,{children:[e*100,`px`]}),(0,F.jsx)(`div`,{children:`|`})]})},`top-guide-${e}`))}),f&&(e?(0,F.jsx)(`div`,{ref:e=>this.titleRef=e,style:{...l&&{width:C},...F$(N$(p))&&{display:`none`}},children:l?(0,F.jsx)(a1,{className:`disabledTitle`,dangerouslySetInnerHTML:{__html:p||``}}):(0,F.jsx)(i1,{className:`disabledTitle`,dangerouslySetInnerHTML:{__html:p||``}})}):(0,F.jsx)(`div`,{ref:e=>this.titleRef=e,children:l?(0,F.jsx)(a1,{className:d?`rightMargin`:``,children:(0,F.jsx)(h$,{...l&&{width:C},markup:p||``,onChange:c,placeholder:s&&i||!e&&`Click here to add a title for this graph`,toolbarOpts:{noPadding:!0,noBorder:!0},activePlugins:T,disableScrollbar:!0,onKeyDown:this.handleKeyDown})}):(0,F.jsx)(i1,{className:d?`rightMargin`:``,children:(0,F.jsx)(h$,{...l&&{width:C},markup:p||``,onChange:c,placeholder:s&&i||!e&&`Click here to add a title for this graph`,toolbarOpts:{noPadding:!0,noBorder:!0},activePlugins:T,disableScrollbar:!0,onKeyDown:this.handleKeyDown})})})),u&&!l&&(0,F.jsx)(G$,{side:`top`,text:n.top,disabledLabel:t,placeholder:r?.top,graphHeight:w,graphWidth:C,onChange:e=>this.onChangeLabel(e,`top`),mathMlOptions:h,preventNewLines:!0,charactersLimit:g}),(0,F.jsxs)(e1,{children:[u&&(0,F.jsx)(G$,{side:`left`,text:n.left,disabledLabel:t,placeholder:r?.left,graphHeight:w,graphWidth:C,isChartLeftLabel:l&&!s,isDefineChartLeftLabel:l&&s,onChange:e=>this.onChangeLabel(e,`left`),mathMlOptions:h,preventNewLines:!0,charactersLimit:g}),s?(0,F.jsx)(t1,{width:C,height:w,children:(0,F.jsx)(r1,{ref:e=>{this.g=e,m&&m(e)},transform:`translate(${x+(y.padding||0)}, ${40+(b.padding||0)})`,children:o})}):(0,F.jsx)(n1,{width:C,height:w,children:(0,F.jsx)(r1,{ref:e=>{this.g=e,m&&m(e)},transform:`translate(${x+(y.padding||0)}, ${40+(b.padding||0)})`,children:o})}),u&&!l&&(0,F.jsx)(G$,{side:`right`,text:n.right,disabledLabel:t,placeholder:r?.right,graphHeight:w,graphWidth:C,onChange:e=>this.onChangeLabel(e,`right`),mathMlOptions:h,preventNewLines:!0,charactersLimit:g}),d&&(0,F.jsx)(c1,{style:{paddingTop:k,marginTop:31},children:[...Array(O+1).keys()].reverse().map(e=>(0,F.jsx)(J$,{false:!0,children:(0,F.jsxs)(l1,{children:[`━ `,e*100,`px`]})},`top-guide-${e}`))})]}),u&&(0,F.jsx)(G$,{side:`bottom`,text:n.bottom,disabledLabel:t,placeholder:r?.bottom,graphHeight:w,graphWidth:C,titleHeight:A,isChartBottomLabel:l&&!s,isDefineChartBottomLabel:l&&s,onChange:e=>this.onChangeLabel(e,`bottom`),mathMlOptions:h,preventNewLines:!0,charactersLimit:g})]})}};function d1(e,t){for(let n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]}function f1(e){return typeof e==`function`||Object.prototype.toString.call(e)===`[object Function]`}function p1(e){return typeof e==`number`&&!isNaN(e)}function m1(e){return parseInt(e,10)}function h1(e,t,n){if(e[t])return Error(`Invalid prop ${t} passed to ${n} - do not set this, set it on the child.`)}var g1=[`Moz`,`Webkit`,`O`,`ms`];function _1(e=`transform`){if(typeof window>`u`)return``;let t=window.document?.documentElement?.style;if(!t||e in t)return``;for(let n=0;n<g1.length;n++)if(v1(e,g1[n])in t)return g1[n];return``}function v1(e,t){return t?`${t}${y1(e)}`:e}function y1(e){let t=``,n=!0;for(let r=0;r<e.length;r++)n?(t+=e[r].toUpperCase(),n=!1):e[r]===`-`?n=!0:t+=e[r];return t}var b1=_1(),x1=``;function S1(e,t){x1||=d1([`matches`,`webkitMatchesSelector`,`mozMatchesSelector`,`msMatchesSelector`,`oMatchesSelector`],function(t){return f1(e[t])})??``;let n=e[x1];return f1(n)?!!n.call(e,t):!1}function C1(e,t,n){let r=e;do{if(S1(r,t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1}function w1(e,t,n,r){if(!e)return;let i={capture:!0,...r},a=n;e.addEventListener?e.addEventListener(t,a,i):e.attachEvent?e.attachEvent(`on`+t,a):e[`on`+t]=a}function T1(e,t,n,r){if(!e)return;let i={capture:!0,...r},a=n;e.removeEventListener?e.removeEventListener(t,a,i):e.detachEvent?e.detachEvent(`on`+t,a):e[`on`+t]=null}function E1(e){let t=e.clientHeight,n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=m1(n.borderTopWidth),t+=m1(n.borderBottomWidth),t}function D1(e){let t=e.clientWidth,n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=m1(n.borderLeftWidth),t+=m1(n.borderRightWidth),t}function O1(e){let t=e.clientHeight,n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=m1(n.paddingTop),t-=m1(n.paddingBottom),t}function k1(e){let t=e.clientWidth,n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=m1(n.paddingLeft),t-=m1(n.paddingRight),t}function A1(e,t,n){let r=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect();return{x:(e.clientX+t.scrollLeft-r.left)/n,y:(e.clientY+t.scrollTop-r.top)/n}}function j1(e,t){let n=N1(e,t,`px`);return{[v1(`transform`,b1)]:n}}function M1(e,t){return N1(e,t,``)}function N1({x:e,y:t},n,r){let i=`translate(${e}${r},${t}${r})`;return n&&(i=`translate(${`${typeof n.x==`string`?n.x:n.x+r}`}, ${`${typeof n.y==`string`?n.y:n.y+r}`})`+i),i}function P1(e,t){return e.targetTouches&&d1(e.targetTouches,e=>t===e.identifier)||e.changedTouches&&d1(e.changedTouches,e=>t===e.identifier)}function F1(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function I1(){return typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0}function L1(e,t){if(!e)return;let n=e.getElementById(`react-draggable-style-el`);if(!n){n=e.createElement(`style`),n.type=`text/css`,n.id=`react-draggable-style-el`;let r=t??I1();r&&n.setAttribute(`nonce`,r),n.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
|
|
354
|
+
`,jq=typeof Aq==`string`?null:It`
|
|
355
|
+
animation: ${Aq} 3s infinite linear;
|
|
356
|
+
`,Mq=e=>{let{classes:t,variant:n,color:r}=e;return ca({root:[`root`,`color${B(r)}`,n],dashed:[`dashed`,`dashedColor${B(r)}`],bar1:[`bar`,`bar1`,`barColor${B(r)}`,(n===`indeterminate`||n===`query`)&&`bar1Indeterminate`,n===`determinate`&&`bar1Determinate`,n===`buffer`&&`bar1Buffer`],bar2:[`bar`,`bar2`,n!==`buffer`&&`barColor${B(r)}`,n===`buffer`&&`color${B(r)}`,(n===`indeterminate`||n===`query`)&&`bar2Indeterminate`,n===`buffer`&&`bar2Buffer`]},wq,t)},Nq=(e,t)=>e.vars?e.vars.palette.LinearProgress[`${t}Bg`]:e.palette.mode===`light`?e.lighten(e.palette[t].main,.62):e.darken(e.palette[t].main,.5),Pq=R(`span`,{name:`MuiLinearProgress`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`color${B(n.color)}`],t[n.variant]]}})(Nc(({theme:e})=>({position:`relative`,overflow:`hidden`,display:`block`,height:4,zIndex:0,"@media print":{colorAdjust:`exact`},variants:[...Object.entries(e.palette).filter(Vd()).map(([t])=>({props:{color:t},style:{backgroundColor:Nq(e,t)}})),{props:({ownerState:e})=>e.color===`inherit`&&e.variant!==`buffer`,style:{"&::before":{content:`""`,position:`absolute`,left:0,top:0,right:0,bottom:0,backgroundColor:`currentColor`,opacity:.3}}},{props:{variant:`buffer`},style:{backgroundColor:`transparent`}},{props:{variant:`query`},style:{transform:`rotate(180deg)`}}]}))),Fq=R(`span`,{name:`MuiLinearProgress`,slot:`Dashed`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.dashed,t[`dashedColor${B(n.color)}`]]}})(Nc(({theme:e})=>({position:`absolute`,marginTop:0,height:`100%`,width:`100%`,backgroundSize:`10px 10px`,backgroundPosition:`0 -23px`,variants:[{props:{color:`inherit`},style:{opacity:.3,backgroundImage:`radial-gradient(currentColor 0%, currentColor 16%, transparent 42%)`}},...Object.entries(e.palette).filter(Vd()).map(([t])=>{let n=Nq(e,t);return{props:{color:t},style:{backgroundImage:`radial-gradient(${n} 0%, ${n} 16%, transparent 42%)`}}})]})),jq||{animation:`${Aq} 3s infinite linear`}),Iq=R(`span`,{name:`MuiLinearProgress`,slot:`Bar1`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.bar,t.bar1,t[`barColor${B(n.color)}`],(n.variant===`indeterminate`||n.variant===`query`)&&t.bar1Indeterminate,n.variant===`determinate`&&t.bar1Determinate,n.variant===`buffer`&&t.bar1Buffer]}})(Nc(({theme:e})=>({width:`100%`,position:`absolute`,left:0,bottom:0,top:0,transition:`transform 0.2s linear`,transformOrigin:`left`,variants:[{props:{color:`inherit`},style:{backgroundColor:`currentColor`}},...Object.entries(e.palette).filter(Vd()).map(([t])=>({props:{color:t},style:{backgroundColor:(e.vars||e).palette[t].main}})),{props:{variant:`determinate`},style:{transition:`transform .${Tq}s linear`}},{props:{variant:`buffer`},style:{zIndex:1,transition:`transform .${Tq}s linear`}},{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:{width:`auto`}},{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:Dq||{animation:`${Eq} 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite`}}]}))),Lq=R(`span`,{name:`MuiLinearProgress`,slot:`Bar2`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.bar,t.bar2,t[`barColor${B(n.color)}`],(n.variant===`indeterminate`||n.variant===`query`)&&t.bar2Indeterminate,n.variant===`buffer`&&t.bar2Buffer]}})(Nc(({theme:e})=>({width:`100%`,position:`absolute`,left:0,bottom:0,top:0,transition:`transform 0.2s linear`,transformOrigin:`left`,variants:[...Object.entries(e.palette).filter(Vd()).map(([t])=>({props:{color:t},style:{"--LinearProgressBar2-barColor":(e.vars||e).palette[t].main}})),{props:({ownerState:e})=>e.variant!==`buffer`&&e.color!==`inherit`,style:{backgroundColor:`var(--LinearProgressBar2-barColor, currentColor)`}},{props:({ownerState:e})=>e.variant!==`buffer`&&e.color===`inherit`,style:{backgroundColor:`currentColor`}},{props:{color:`inherit`},style:{opacity:.3}},...Object.entries(e.palette).filter(Vd()).map(([t])=>({props:{color:t,variant:`buffer`},style:{backgroundColor:Nq(e,t),transition:`transform .${Tq}s linear`}})),{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:{width:`auto`}},{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:kq||{animation:`${Oq} 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) 1.15s infinite`}}]}))),Rq=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiLinearProgress`}),{className:r,color:i=`primary`,value:a,valueBuffer:o,variant:s=`indeterminate`,...c}=n,l={...n,color:i,variant:s},u=Mq(l),d=Di(),f={},p={bar1:{},bar2:{}};if((s===`determinate`||s===`buffer`)&&a!==void 0){f[`aria-valuenow`]=Math.round(a),f[`aria-valuemin`]=0,f[`aria-valuemax`]=100;let e=a-100;d&&(e=-e),p.bar1.transform=`translateX(${e}%)`}if(s===`buffer`&&o!==void 0){let e=(o||0)-100;d&&(e=-e),p.bar2.transform=`translateX(${e}%)`}return(0,F.jsxs)(Pq,{className:I(u.root,r),ownerState:l,role:`progressbar`,...f,ref:t,...c,children:[s===`buffer`?(0,F.jsx)(Fq,{className:u.dashed,ownerState:l}):null,(0,F.jsx)(Iq,{className:u.bar1,ownerState:l,style:p.bar1}),s===`determinate`?null:(0,F.jsx)(Lq,{className:u.bar2,ownerState:l,style:p.bar2})]})}),zq=(e,t)=>{if(!e||!t)return null;let n=null;return e.state.doc.descendants((e,r)=>{if(n!==null)return!1;if(e.type.name===`imageUploadNode`&&e.attrs.nodeKey===t)return n=[e,r],!1}),n},Bq=()=>`img-${Date.now()}-${Math.random().toString(36).slice(2)}`,Vq=Uu(`@pie-lib:editable-html:image:insert-image-handler`),Hq=class{constructor(e,t,n,r=!1){this.editor=e,this.nodeInfo=t,this.node=t[0],this.nodePos=t[1],this.onFinish=n,this.isPasted=r,this.chosenFile=null,this.nodeKey=this.node?.attrs?.nodeKey||null}resolveNodePos(){let e=zq(this.editor,this.nodeKey);return e?e[1]:this.nodeKey?null:this.nodePos}cancel(){Vq(`insert cancelled`);try{this.deleteNode(),this.onFinish(!1)}catch{}finally{this.editor._insertingImage=!1}}updateNode(e){let t=this.resolveNodePos();if(t===null){Vq(`[updateNode] node is gone, dropping update: `,e);return}let{state:n,view:r}=this.editor,{tr:i}=n,a=n.doc.nodeAt(t);if(a){let n=i.setNodeMarkup(t,void 0,{...a.attrs,...e});r.dispatch(n)}}deleteNode(){let e=this.resolveNodePos();if(e===null)return;let{state:t,view:n}=this.editor,{tr:r}=t,i=t.doc.nodeAt(e)||this.node,a=r.delete(e,e+i.nodeSize);n.dispatch(a)}done(e,t){Vq(`done: err:`,e),e?(console.log(e),this.onFinish(!1)):(this.updateNode({loaded:!0,src:t,percent:100}),this.onFinish(!0)),this.editor._insertingImage=!1}fileChosen(e){if(!e)return;this.chosenFile=e,this.editor._insertingImage=!1,Vq(`[fileChosen] file: `,e);let t=new FileReader;t.onload=()=>{let e=t.result;this.updateNode({src:e})},t.readAsDataURL(e)}progress(e,t,n){Vq(`progress: `,e,t,n),this.updateNode({percent:e})}getChosenFile(){return this.chosenFile}};function Uq(e){return Br(`MuiDialogContent`,e)}Vr(`MuiDialogContent`,[`root`,`dividers`]);function Wq(e){return Br(`MuiDialogTitle`,e)}var Gq=Vr(`MuiDialogTitle`,[`root`]),Kq=e=>{let{classes:t,dividers:n}=e;return ca({root:[`root`,n&&`dividers`]},Uq,t)},qq=R(`div`,{name:`MuiDialogContent`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.dividers&&t.dividers]}})(Nc(({theme:e})=>({flex:`1 1 auto`,WebkitOverflowScrolling:`touch`,overflowY:`auto`,padding:`20px 24px`,variants:[{props:({ownerState:e})=>e.dividers,style:{padding:`16px 24px`,borderTop:`1px solid ${(e.vars||e).palette.divider}`,borderBottom:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:e})=>!e.dividers,style:{[`.${Gq.root} + &`]:{paddingTop:0}}}]}))),Jq=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiDialogContent`}),{className:r,dividers:i=!1,...a}=n,o={...n,dividers:i},s=Kq(o);return(0,F.jsx)(qq,{className:I(s.root,r),ownerState:o,ref:t,...a})}),Yq=ml((0,F.jsx)(`path`,{d:`M11.67 3.87 9.9 2.1 0 12l9.9 9.9 1.77-1.77L3.54 12z`}),`ArrowBackIos`);function Xq(e){return Br(`MuiFormHelperText`,e)}var Zq=Vr(`MuiFormHelperText`,[`root`,`error`,`disabled`,`sizeSmall`,`sizeMedium`,`contained`,`focused`,`filled`,`required`]),Qq,$q=e=>{let{classes:t,contained:n,size:r,disabled:i,error:a,filled:o,focused:s,required:c}=e;return ca({root:[`root`,i&&`disabled`,a&&`error`,r&&`size${B(r)}`,n&&`contained`,s&&`focused`,o&&`filled`,c&&`required`]},Xq,t)},eJ=R(`p`,{name:`MuiFormHelperText`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.size&&t[`size${B(n.size)}`],n.contained&&t.contained,n.filled&&t.filled]}})(Nc(({theme:e})=>({color:(e.vars||e).palette.text.secondary,...e.typography.caption,textAlign:`left`,marginTop:3,marginRight:0,marginBottom:0,marginLeft:0,[`&.${Zq.disabled}`]:{color:(e.vars||e).palette.text.disabled},[`&.${Zq.error}`]:{color:(e.vars||e).palette.error.main},variants:[{props:{size:`small`},style:{marginTop:4}},{props:({ownerState:e})=>e.contained,style:{marginLeft:14,marginRight:14}}]}))),tJ=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiFormHelperText`}),{children:r,className:i,component:a=`p`,disabled:o,error:s,filled:c,focused:l,margin:u,required:d,variant:f,...p}=n,m=Ef({props:n,muiFormControl:Of(),states:[`variant`,`size`,`disabled`,`error`,`filled`,`focused`,`required`]}),h={...n,component:a,contained:m.variant===`filled`||m.variant===`outlined`,variant:m.variant,size:m.size,disabled:m.disabled,error:m.error,filled:m.filled,focused:m.focused,required:m.required};delete h.ownerState;let g=$q(h);return(0,F.jsx)(eJ,{as:a,className:I(g.root,i),ref:t,...p,ownerState:h,children:r===` `?Qq||=(0,F.jsx)(`span`,{className:`notranslate`,"aria-hidden":!0,children:``}):r})});function nJ(e){return Br(`MuiTextField`,e)}Vr(`MuiTextField`,[`root`]);var rJ={standard:dK,filled:_K,outlined:OK},iJ=e=>{let{classes:t}=e;return ca({root:[`root`]},nJ,t)},aJ=R(Gf,{name:`MuiTextField`,slot:`Root`})({}),oJ=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiTextField`}),{autoComplete:r,autoFocus:i=!1,children:a,className:o,color:s=`primary`,defaultValue:c,disabled:l=!1,error:u=!1,FormHelperTextProps:d,fullWidth:f=!1,helperText:p,id:m,InputLabelProps:h,inputProps:g,InputProps:_,inputRef:v,label:y,maxRows:b,minRows:x,multiline:S=!1,name:C,onBlur:w,onChange:T,onFocus:E,placeholder:D,required:O=!1,rows:k,select:A=!1,SelectProps:j,slots:M={},slotProps:ee={},type:N,value:te,variant:ne=`outlined`,...re}=n,ie={...n,autoFocus:i,color:s,disabled:l,error:u,fullWidth:f,multiline:S,required:O,select:A,variant:ne},ae=iJ(ie),oe=Fi(m),se=p&&oe?`${oe}-helper-text`:void 0,ce=y&&oe?`${oe}-label`:void 0,le=rJ[ne],ue={slots:M,slotProps:{input:_,inputLabel:h,htmlInput:g,formHelperText:d,select:j,...ee}},de={},fe=ue.slotProps.inputLabel;ne===`outlined`&&(fe&&fe.shrink!==void 0&&(de.notched=fe.shrink),de.label=y),A&&((!j||!j.native)&&(de.id=void 0),de[`aria-describedby`]=void 0);let[pe,me]=zc(`root`,{elementType:aJ,shouldForwardComponentProp:!0,externalForwardedProps:{...ue,...re},ownerState:ie,className:I(ae.root,o),ref:t,additionalProps:{disabled:l,error:u,fullWidth:f,required:O,color:s,variant:ne}}),[he,ge]=zc(`input`,{elementType:le,externalForwardedProps:ue,additionalProps:de,ownerState:ie}),[_e,ve]=zc(`inputLabel`,{elementType:Rf,externalForwardedProps:ue,ownerState:ie}),[ye,be]=zc(`htmlInput`,{elementType:`input`,externalForwardedProps:ue,ownerState:ie}),[xe,Se]=zc(`formHelperText`,{elementType:tJ,externalForwardedProps:ue,ownerState:ie}),[Ce,we]=zc(`select`,{elementType:PK,externalForwardedProps:ue,ownerState:ie}),Te=(0,F.jsx)(he,{"aria-describedby":se,autoComplete:r,autoFocus:i,defaultValue:c,fullWidth:f,multiline:S,name:C,rows:k,maxRows:b,minRows:x,type:N,value:te,id:oe,inputRef:v,onBlur:w,onChange:T,onFocus:E,placeholder:D,inputProps:be,slots:{input:M.htmlInput?ye:void 0},...ge});return(0,F.jsxs)(pe,{...me,children:[y!=null&&y!==``&&(0,F.jsx)(_e,{htmlFor:oe,id:ce,...ve,children:y}),A?(0,F.jsx)(Ce,{"aria-describedby":se,id:oe,labelId:ce,value:te,input:Te,...we,children:a}):Te,p&&(0,F.jsx)(xe,{id:se,...Se,children:p})]})});function sJ(e){return Br(`MuiDialogActions`,e)}Vr(`MuiDialogActions`,[`root`,`spacing`]);var cJ=e=>{let{classes:t,disableSpacing:n}=e;return ca({root:[`root`,!n&&`spacing`]},sJ,t)},lJ=R(`div`,{name:`MuiDialogActions`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,!n.disableSpacing&&t.spacing]}})({display:`flex`,alignItems:`center`,padding:8,justifyContent:`flex-end`,flex:`0 0 auto`,variants:[{props:({ownerState:e})=>!e.disableSpacing,style:{"& > :not(style) ~ :not(style)":{marginLeft:8}}}]}),uJ=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiDialogActions`}),{className:r,disableSpacing:i=!1,...a}=n,o={...n,disableSpacing:i},s=cJ(o);return(0,F.jsx)(lJ,{className:I(s.root,r),ownerState:o,ref:t,...a})});function dJ(e){return Br(`MuiDialog`,e)}var fJ=Vr(`MuiDialog`,[`root`,`backdrop`,`scrollPaper`,`scrollBody`,`container`,`paper`,`paperScrollPaper`,`paperScrollBody`,`paperWidthFalse`,`paperWidthXs`,`paperWidthSm`,`paperWidthMd`,`paperWidthLg`,`paperWidthXl`,`paperFullWidth`,`paperFullScreen`]),pJ=P.createContext({}),mJ=R(Kc,{name:`MuiDialog`,slot:`Backdrop`})({zIndex:-1}),hJ=e=>{let{classes:t,scroll:n,maxWidth:r,fullWidth:i,fullScreen:a}=e;return ca({root:[`root`],backdrop:[`backdrop`],container:[`container`,`scroll${B(n)}`],paper:[`paper`,`paperScroll${B(n)}`,`paperWidth${B(String(r))}`,i&&`paperFullWidth`,a&&`paperFullScreen`]},dJ,t)},gJ=R(il,{name:`MuiDialog`,slot:`Root`})({"@media print":{position:`absolute !important`}}),_J=R(`div`,{name:`MuiDialog`,slot:`Container`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.container,t[`scroll${B(n.scroll)}`]]}})({height:`100%`,"@media print":{height:`auto`},outline:0,variants:[{props:{scroll:`paper`},style:{display:`flex`,justifyContent:`center`,alignItems:`center`}},{props:{scroll:`body`},style:{overflowY:`auto`,overflowX:`hidden`,textAlign:`center`,"&::after":{content:`""`,display:`inline-block`,verticalAlign:`middle`,height:`100%`,width:`0`}}}]}),vJ=R(cl,{name:`MuiDialog`,slot:`Paper`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.paper,t[`scrollPaper${B(n.scroll)}`],t[`paperWidth${B(String(n.maxWidth))}`],n.fullWidth&&t.paperFullWidth,n.fullScreen&&t.paperFullScreen]}})(Nc(({theme:e})=>({margin:32,position:`relative`,overflowY:`auto`,"@media print":{overflowY:`visible`,boxShadow:`none`},variants:[{props:{scroll:`paper`},style:{display:`flex`,flexDirection:`column`,maxHeight:`calc(100% - 64px)`}},{props:{scroll:`body`},style:{display:`inline-block`,verticalAlign:`middle`,textAlign:`initial`}},{props:({ownerState:e})=>!e.maxWidth,style:{maxWidth:`calc(100% - 64px)`}},{props:{maxWidth:`xs`},style:{maxWidth:e.breakpoints.unit===`px`?Math.max(e.breakpoints.values.xs,444):`max(${e.breakpoints.values.xs}${e.breakpoints.unit}, 444px)`,[`&.${fJ.paperScrollBody}`]:{[e.breakpoints.down(Math.max(e.breakpoints.values.xs,444)+64)]:{maxWidth:`calc(100% - 64px)`}}}},...Object.keys(e.breakpoints.values).filter(e=>e!==`xs`).map(t=>({props:{maxWidth:t},style:{maxWidth:`${e.breakpoints.values[t]}${e.breakpoints.unit}`,[`&.${fJ.paperScrollBody}`]:{[e.breakpoints.down(e.breakpoints.values[t]+64)]:{maxWidth:`calc(100% - 64px)`}}}})),{props:({ownerState:e})=>e.fullWidth,style:{width:`calc(100% - 64px)`}},{props:({ownerState:e})=>e.fullScreen,style:{margin:0,width:`100%`,maxWidth:`100%`,height:`100%`,maxHeight:`none`,borderRadius:0,[`&.${fJ.paperScrollBody}`]:{margin:0,maxWidth:`100%`}}}]}))),yJ=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiDialog`}),r=xo(),i={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{"aria-describedby":a,"aria-labelledby":o,"aria-modal":s=!0,BackdropComponent:c,BackdropProps:l,children:u,className:d,disableEscapeKeyDown:f=!1,fullScreen:p=!1,fullWidth:m=!1,maxWidth:h=`sm`,onClick:g,onClose:_,open:v,PaperComponent:y=cl,PaperProps:b={},role:x=`dialog`,scroll:S=`paper`,slots:C={},slotProps:w={},TransitionComponent:T=Hc,transitionDuration:E=i,TransitionProps:D,...O}=n,k={...n,disableEscapeKeyDown:f,fullScreen:p,fullWidth:m,maxWidth:h,scroll:S},A=hJ(k),j=P.useRef(),M=e=>{j.current=e.target===e.currentTarget},ee=e=>{g&&g(e),j.current&&(j.current=null,_&&_(e,`backdropClick`))},N=Fi(o),te=P.useMemo(()=>({titleId:N}),[N]),ne={slots:{transition:T,...C},slotProps:{transition:D,paper:b,backdrop:l,...w}},[re,ie]=zc(`root`,{elementType:gJ,shouldForwardComponentProp:!0,externalForwardedProps:ne,ownerState:k,className:I(A.root,d),ref:t}),[ae,oe]=zc(`backdrop`,{elementType:mJ,shouldForwardComponentProp:!0,externalForwardedProps:ne,ownerState:k,className:A.backdrop}),[se,ce]=zc(`paper`,{elementType:vJ,shouldForwardComponentProp:!0,externalForwardedProps:ne,ownerState:k,className:A.paper,additionalProps:{elevation:24,role:x,"aria-describedby":a,"aria-labelledby":N,"aria-modal":s,tabIndex:-1,[Sc]:``}}),[le,ue]=zc(`container`,{elementType:_J,externalForwardedProps:ne,ownerState:k,className:A.container}),[de,fe]=zc(`transition`,{elementType:Hc,externalForwardedProps:ne,ownerState:k,additionalProps:{appear:!0,in:v,timeout:E,role:`presentation`}});return(0,F.jsx)(re,{closeAfterTransition:!0,slots:{backdrop:ae},slotProps:{backdrop:{transitionDuration:E,as:c,...oe}},disableEscapeKeyDown:f,onClose:_,open:v,onClick:ee,...ie,...O,children:(0,F.jsx)(de,{...fe,children:(0,F.jsx)(le,{onMouseDown:M,...ue,children:(0,F.jsx)(se,{as:y,...ce,children:(0,F.jsx)(pJ.Provider,{value:te,children:u})})})})})}),bJ=class extends P.Component{static propTypes={onDone:v.func.isRequired,alt:v.string};constructor(e){super(e);let{alt:t}=e;this.state={value:t}}closeDialog=()=>{document.querySelectorAll(`#text-dialog`).forEach(function(e){return e.remove()})};onDone=()=>{let{onDone:e}=this.props,{value:t}=this.state;e(t),this.closeDialog()};handleOverflow=()=>{document.body.style.removeProperty(`overflow`)};render(){let{value:e}=this.state;return(0,F.jsxs)(yJ,{open:!0,disablePortal:!0,onClose:this.closeDialog,id:`text-dialog`,hideBackdrop:!0,disableScrollLock:!0,onEntered:this.handleOverflow,children:[(0,F.jsx)(Jq,{children:(0,F.jsxs)(`div`,{style:{display:`flex`},children:[(0,F.jsx)(Yq,{style:{paddingTop:`6px`}}),(0,F.jsx)(oJ,{multiline:!0,placeholder:`Enter an Alt Text description of this image`,helperText:`Users with visual limitations rely on Alt Text, since screen readers cannot otherwise describe the contents of an image.`,value:e,onChange:e=>this.setState({value:e.target.value}),FormHelperTextProps:{style:{fontSize:14}}})]})}),(0,F.jsx)(uJ,{children:(0,F.jsx)(ff,{onClick:this.onDone,children:`Done`})})]})}},xJ=R(`button`,{shouldForwardProp:e=>![`active`,`disabled`,`extraStyles`].includes(e)})(({active:e,disabled:t})=>({color:e?Il():Ll(),display:`inline-flex`,padding:`2px`,background:`none`,border:`none`,cursor:t?`not-allowed`:`pointer`,"& svg":{width:`24px`,height:`24px`},"&:hover":{color:t?Ll():Il()},"&:focus":{outline:`2px solid ${Tu()}`},...t&&{opacity:.7}})),SJ=Uu(`pie-elements:editable-html:raw-button`);(class extends P.Component{static propTypes={onClick:v.func.isRequired,children:v.oneOfType([v.arrayOf(v.node),v.node]).isRequired,active:v.bool,disabled:v.bool,extraStyles:v.object};constructor(e){super(e)}onClick=e=>{SJ(`[onClick]`),e.preventDefault();let{onClick:t}=this.props;t(e)};onKeyDown=e=>{if(e.key===`Enter`||e.key===` `){SJ(`[onKeyDown]`),e.preventDefault();let{onClick:t}=this.props;t(e)}};render(){let{active:e,children:t,disabled:n,extraStyles:r,ariaLabel:i}=this.props;return(0,F.jsx)(xJ,{style:r,active:e,disabled:n,onMouseDown:this.onClick,onKeyDown:this.onKeyDown,"aria-label":i,"aria-pressed":e,tabIndex:0,children:t})}});var CJ=class extends P.Component{static propTypes={onToggle:v.func.isRequired,mark:v.string,label:v.string.isRequired,children:v.oneOfType([v.arrayOf(v.node),v.node]).isRequired,active:v.bool};constructor(e){super(e)}onToggle=e=>{e.preventDefault(),this.props.onToggle(this.props.mark)};onKeyDown=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),this.props.onToggle(this.props.mark))};render(){let{children:e,active:t,label:n}=this.props;return(0,F.jsx)(xJ,{active:t,onMouseDown:this.onToggle,"aria-pressed":t,onKeyDown:this.onKeyDown,"aria-label":n,tabIndex:0,children:e})}},wJ=Uu(`@pie-lib:editable-html:plugins:image:image-toolbar`),TJ=R(`div`)(({theme:e})=>({paddingLeft:e.spacing.unit,display:`flex`,alignItems:`center`})),EJ=R(`span`,{shouldForwardProp:e=>![`disabled`,`hasAlignmentButtons`].includes(e)})(({disabled:e,hasAlignmentButtons:t})=>({...e&&{opacity:.5},...t&&{borderLeft:`1px solid grey`,paddingLeft:8,marginLeft:4}})),DJ=({alignment:e,active:t,onClick:n})=>(0,F.jsx)(CJ,{active:t,onToggle:()=>n(e),label:e,children:e});DJ.propTypes={alignment:v.string.isRequired,active:v.bool.isRequired,onClick:v.func.isRequired};var OJ=class extends P.Component{static propTypes={onChange:v.func.isRequired,alignment:v.string,alt:v.string,imageLoaded:v.bool,disableImageAlignmentButtons:v.bool};onAltTextDone=e=>{wJ(`[onAltTextDone]: alt:`,e),this.props.onChange({alt:e},!0)};onAlignmentClick=e=>{wJ(`[onAlignmentClick]: alignment:`,e),this.props.onChange({alignment:e})};renderDialog=()=>{let{alt:e}=this.props,t=document.createElement(`div`),n=(0,F.jsx)(bJ,{alt:e,onDone:this.onAltTextDone});Ms.render(n,t),document.body.appendChild(t)};render(){let{alignment:e,imageLoaded:t,disableImageAlignmentButtons:n}=this.props;return(0,F.jsxs)(TJ,{children:[!n&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(DJ,{alignment:`left`,active:e===`left`,onClick:this.onAlignmentClick}),(0,F.jsx)(DJ,{alignment:`center`,active:e===`center`,onClick:this.onAlignmentClick}),(0,F.jsx)(DJ,{alignment:`right`,active:e===`right`,onClick:this.onAlignmentClick})]}),(0,F.jsx)(EJ,{disabled:!t,hasAlignmentButtons:!n,onMouseDown:e=>t&&this.renderDialog(e),children:`Alt text`})]})}},kJ=R(Rq,{shouldForwardProp:e=>e!==`hideProgress`})(({hideProgress:e})=>({position:`absolute`,left:`0`,width:`fit-content`,top:`0%`,transition:`opacity 200ms linear`,...e&&{opacity:0}})),AJ=R(`div`,{shouldForwardProp:e=>![`active`,`loading`,`pendingDelete`].includes(e)})(({loading:e,pendingDelete:t})=>({position:`relative`,display:`flex`,transition:`opacity 200ms linear`,...e&&{opacity:.3},...t&&{opacity:.3}})),jJ=R(`div`)(({theme:e})=>({position:`relative`,width:`fit-content`,display:`flex`,alignItems:`center`,"&&:hover > .resize":{display:`block`}})),MJ=R(`img`,{shouldForwardProp:e=>e!==`active`})(({theme:e,active:t})=>({border:t?`solid 1px ${e.palette.primary.main}`:`solid 1px transparent`})),NJ=R(`div`)(({theme:e})=>({backgroundColor:e.palette.primary.main,cursor:`col-resize`,height:`35px`,width:`5px`,borderRadius:8,marginLeft:`5px`,marginRight:`10px`,display:`none`})),PJ=e=>e?`${e}px`:`calc(20px)`;function FJ(e){let{node:t,editor:n,attributes:r,onFocus:i,getPos:a,selected:o,options:s,maxImageWidth:c=700,maxImageHeight:l=900}=e,{alt:u}=t.attrs,d=a(),f=n.state.selection.from,p=n.state.selection.to,m=(0,P.useMemo)(()=>f+t.nodeSize===p,[f,p,t.nodeSize]),[h,g]=(0,P.useState)(!1),_=(0,P.useRef)(t),v=(0,P.useRef)(null),y=(0,P.useRef)(null),b=(0,P.useRef)(null),x=(0,P.useCallback)(e=>{let t=e/v.current.naturalWidth*4;return parseInt(t.toFixed(0)*25,10)},[]),S=(0,P.useCallback)(()=>{let e=zq(n,_.current.attrs.nodeKey);return e?e[1]:null},[n]),C=(0,P.useCallback)(e=>{let t=S();if(t===null)return;let r=n.state.doc.nodeAt(t);r&&n.view.dispatch(n.state.tr.setNodeMarkup(t,void 0,{...r.attrs,...e}))},[n,S]),w=(0,P.useCallback)(()=>{if(!t.attrs.width||!v.current||!v.current.naturalWidth)return;let e=x(t.attrs.width);t.attrs.resizePercent!==e&&C({resizePercent:e})},[t.attrs.width,t.attrs.resizePercent,x,C]);(0,P.useEffect)(()=>{_.current={...t,pos:d}},[t,d]),(0,P.useEffect)(()=>{o?m&&n.isEditable&&(!String(t.attrs?.src??``).trim()&&s.imageHandling?.insertImageRequested&&s.imageHandling.insertImageRequested(n,[t,d],e=>new Hq(n,[t,d],e)),g(o)):g(o)},[m,o,n.isEditable]),(0,P.useEffect)(()=>{w();let e=y?.current;return e&&n.isEditable&&e.addEventListener(`mousedown`,A,!1),()=>{e&&e.removeEventListener(`mousedown`,A,!1)}},[]),(0,P.useEffect)(()=>{w()});let T=(0,P.useCallback)(()=>{let e=v.current;if(e&&(!e.style.width||e.style.width===`calc(20px)`)){let n=Math.min(e.naturalWidth,c),r=Math.min(e.naturalHeight,l);e.style.width=`${n}px`,e.style.height=`${r}px`;let i={width:n,height:r};zp(i,{width:t.attrs.width,height:t.attrs.height})||C(i)}},[t.attrs.width,t.attrs.height,c,l,C]),E=(e,t,n=!0,r)=>{if(n){let n=e.width/e.height;return r===`height`?{width:t.height*n,height:t.height}:{width:t.width,height:t.width/n}}return t},D=(0,P.useCallback)(e=>{let t=v.current;if(!t)return;let n=e.target.getBoundingClientRect(),r={width:t.naturalWidth,height:t.naturalHeight},i=E(r,{width:e.clientX-n.left,height:e.clientY-n.top});i.width>50&&i.height>50&&i.width<=700&&i.height<=900&&(t.style.width=`${i.width}px`,t.style.height=`${i.height}px`,C({width:i.width,height:i.height}))},[n,C]),O=(0,P.useCallback)(e=>{C(e)},[n,C]),k=(0,P.useCallback)(()=>{window.removeEventListener(`mousemove`,D),window.removeEventListener(`mouseup`,k)},[D]),A=(0,P.useCallback)(()=>{window.addEventListener(`mousemove`,D),window.addEventListener(`mouseup`,k)},[D,k]),j={width:PJ(t.attrs.width),height:PJ(t.attrs.height),objectFit:`contain`},M={left:`flex-start`,center:`center`,right:`flex-end`}[t.attrs.alignment]||`flex-start`;return(0,F.jsxs)(Wk,{children:[(0,F.jsxs)(AJ,{onFocus:i,loading:!t.attrs.loaded,pendingDelete:t.attrs.deleteStatus===`pending`,style:{justifyContent:M},children:[(0,F.jsx)(kJ,{mode:`determinate`,value:t.attrs.percent||0,hideProgress:t.attrs.loaded}),(0,F.jsxs)(jJ,{onDragStart:e=>e.preventDefault(),children:[(0,F.jsx)(MJ,{...r,active:o&&t.attrs.loaded,draggable:!1,ref:v,src:t.attrs.src,style:j,onLoad:T,alt:t.attrs.alt}),(0,F.jsx)(NJ,{ref:y,className:`resize`,style:{display:n.isEditable?void 0:`none`}})]})]}),h&&n._tiptapContainerEl&&Ms.createPortal((0,F.jsx)(`div`,{ref:b,style:{zIndex:20,background:`var(--editable-html-toolbar-bg, #efefef)`,boxShadow:`0px 1px 5px 0px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 3px 1px -2px rgba(0, 0, 0, 0.12)`,width:`100%`},children:(0,F.jsx)(bR,{showDone:!0,deletable:!0,toolbarOpts:s.toolbarOpts||{},onDelete:()=>{let e=S();e!==null&&(s.imageHandling?.onDelete?.(_.current),n.view.dispatch(n.state.tr.delete(e,e+n.state.doc.nodeAt(e).nodeSize)),g(!1),n.commands.focus())},onDone:()=>{g(!1),s.imageHandling?.onDone?.(n),n.commands.focus(`end`)},children:(0,F.jsx)(OJ,{disableImageAlignmentButtons:s.imageHandling?.disableImageAlignmentButtons,alt:t.attrs.alt,imageLoaded:t.attrs.loaded,alignment:t.attrs.alignment||`left`,onChange:O})})}),n._tiptapContainerEl)]})}FJ.propTypes={node:v.object.isRequired,editor:v.object.isRequired,attributes:v.object,onFocus:v.func,maxImageWidth:v.number,maxImageHeight:v.number};var IJ=wO.create({name:`imageUploadNode`,group:`block`,atom:!0,selectable:!0,draggable:!0,addAttributes(){return{nodeKey:{default:null},loaded:{default:!1},deleteStatus:{default:null},alignment:{default:null},percent:{default:null},width:{default:null},height:{default:null},src:{default:null},alt:{default:null}}},parseHTML(){return[{tag:`img[data-type="image-upload-node"]`}]},renderHTML({HTMLAttributes:e}){return[`img`,nE(e,{"data-type":`image-upload-node`})]},addNodeView(){return iA(e=>(0,F.jsx)(FJ,{...e,options:this.options}))},addCommands(){return{setImageUploadNode:()=>({commands:e})=>e.insertContent({type:this.name,attrs:{nodeKey:Bq()}})}},addProseMirrorPlugins(){let e=this.editor,t=this.options;return[new ey({props:{handlePaste(n,r){let i=Array.from(r.clipboardData?.items||[]).find(e=>e.kind===`file`&&e.type.startsWith(`image/`));if(!i)return!1;let a=i.getAsFile();if(!a)return!1;let o=t?.imageHandling?.insertImageRequested,s=Bq(),c=new FileReader;return c.onload=()=>{let t=c.result;if(typeof t!=`string`||(e.commands.insertContent({type:`imageUploadNode`,attrs:{src:t,loaded:!o,nodeKey:s}}),!o))return;let n=zq(e,s);n&&o(e,n,t=>{let r;return r=new Hq(e,n,e=>{e||r?.updateNode({loaded:!0}),t(e)},!0),r.fileChosen(a),r})},c.readAsDataURL(a),!0}}})]}});function LJ(e){return(1+Math.sin(Math.PI*e-Math.PI/2))/2}function RJ(e,t,n,r={},i=()=>{}){let{ease:a=LJ,duration:o=300}=r,s=null,c=t[e],l=!1,u=()=>{l=!0},d=r=>{if(l){i(Error(`Animation cancelled`));return}s===null&&(s=r);let u=Math.min(1,(r-s)/o);if(t[e]=a(u)*(n-c)+c,u>=1){requestAnimationFrame(()=>{i(null)});return}requestAnimationFrame(d)};return c===n?(i(Error(`Element already at target position`)),u):(requestAnimationFrame(d),u)}var zJ={width:99,height:99,position:`absolute`,top:-9999,overflow:`scroll`};function BJ(e){let{onChange:t,...n}=e,r=P.useRef(),i=P.useRef(null),a=()=>{r.current=i.current.offsetHeight-i.current.clientHeight};return gl(()=>{let e=us(()=>{let e=r.current;a(),e!==r.current&&t(r.current)}),n=ms(i.current);return n.addEventListener(`resize`,e),()=>{e.clear(),n.removeEventListener(`resize`,e)}},[t]),P.useEffect(()=>{a(),t(r.current)},[t]),(0,F.jsx)(`div`,{style:zJ,...n,ref:i})}var VJ=ml((0,F.jsx)(`path`,{d:`M15.41 16.09l-4.58-4.59 4.58-4.59L14 5.5l-6 6 6 6z`}),`KeyboardArrowLeft`),HJ=ml((0,F.jsx)(`path`,{d:`M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z`}),`KeyboardArrowRight`);function UJ(e){return Br(`MuiTabScrollButton`,e)}var WJ=Vr(`MuiTabScrollButton`,[`root`,`vertical`,`horizontal`,`disabled`]),GJ=e=>{let{classes:t,orientation:n,disabled:r}=e;return ca({root:[`root`,n,r&&`disabled`]},UJ,t)},KJ=R(Ld,{name:`MuiTabScrollButton`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.orientation&&t[n.orientation]]}})({width:40,flexShrink:0,opacity:.8,[`&.${WJ.disabled}`]:{opacity:0},variants:[{props:{orientation:`vertical`},style:{width:`100%`,height:40,"& svg":{transform:`var(--TabScrollButton-svgRotate)`}}}]}),qJ=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiTabScrollButton`}),{className:r,slots:i={},slotProps:a={},direction:o,orientation:s,disabled:c,...l}=n,u=Di(),d={isRtl:u,...n},f=GJ(d),p=i.StartScrollButtonIcon??VJ,m=i.EndScrollButtonIcon??HJ,h=lp({elementType:p,externalSlotProps:a.startScrollButtonIcon,additionalProps:{fontSize:`small`},ownerState:d}),g=lp({elementType:m,externalSlotProps:a.endScrollButtonIcon,additionalProps:{fontSize:`small`},ownerState:d});return(0,F.jsx)(KJ,{component:`div`,className:I(f.root,r),ref:t,role:null,ownerState:d,tabIndex:null,...l,style:{...l.style,...s===`vertical`&&{"--TabScrollButton-svgRotate":`rotate(${u?-90:90}deg)`}},children:o===`left`?(0,F.jsx)(p,{...h}):(0,F.jsx)(m,{...g})})});function JJ(e){return Br(`MuiTabs`,e)}var YJ=Vr(`MuiTabs`,[`root`,`vertical`,`list`,`flexContainer`,`flexContainerVertical`,`centered`,`scroller`,`fixed`,`scrollableX`,`scrollableY`,`hideScrollbar`,`scrollButtons`,`scrollButtonsHideMobile`,`indicator`]),XJ=(e,t)=>e===t?e.firstChild:t&&t.nextElementSibling?t.nextElementSibling:e.firstChild,ZJ=(e,t)=>e===t?e.lastChild:t&&t.previousElementSibling?t.previousElementSibling:e.lastChild,QJ=(e,t,n)=>{let r=!1,i=n(e,t);for(;i;){if(i===e.firstChild){if(r)return;r=!0}let t=i.disabled||i.getAttribute(`aria-disabled`)===`true`;if(!i.hasAttribute(`tabindex`)||t)i=n(e,i);else{i.focus();return}}},$J=e=>{let{vertical:t,fixed:n,hideScrollbar:r,scrollableX:i,scrollableY:a,centered:o,scrollButtonsHideMobile:s,classes:c}=e;return ca({root:[`root`,t&&`vertical`],scroller:[`scroller`,n&&`fixed`,r&&`hideScrollbar`,i&&`scrollableX`,a&&`scrollableY`],list:[`list`,`flexContainer`,t&&`flexContainerVertical`,t&&`vertical`,o&&`centered`],indicator:[`indicator`],scrollButtons:[`scrollButtons`,s&&`scrollButtonsHideMobile`],scrollableX:[i&&`scrollableX`],hideScrollbar:[r&&`hideScrollbar`]},JJ,c)},eY=R(`div`,{name:`MuiTabs`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[{[`& .${YJ.scrollButtons}`]:t.scrollButtons},{[`& .${YJ.scrollButtons}`]:n.scrollButtonsHideMobile&&t.scrollButtonsHideMobile},t.root,n.vertical&&t.vertical]}})(Nc(({theme:e})=>({overflow:`hidden`,minHeight:48,WebkitOverflowScrolling:`touch`,display:`flex`,variants:[{props:({ownerState:e})=>e.vertical,style:{flexDirection:`column`}},{props:({ownerState:e})=>e.scrollButtonsHideMobile,style:{[`& .${YJ.scrollButtons}`]:{[e.breakpoints.down(`sm`)]:{display:`none`}}}}]}))),tY=R(`div`,{name:`MuiTabs`,slot:`Scroller`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.scroller,n.fixed&&t.fixed,n.hideScrollbar&&t.hideScrollbar,n.scrollableX&&t.scrollableX,n.scrollableY&&t.scrollableY]}})({position:`relative`,display:`inline-block`,flex:`1 1 auto`,whiteSpace:`nowrap`,variants:[{props:({ownerState:e})=>e.fixed,style:{overflowX:`hidden`,width:`100%`}},{props:({ownerState:e})=>e.hideScrollbar,style:{scrollbarWidth:`none`,"&::-webkit-scrollbar":{display:`none`}}},{props:({ownerState:e})=>e.scrollableX,style:{overflowX:`auto`,overflowY:`hidden`}},{props:({ownerState:e})=>e.scrollableY,style:{overflowY:`auto`,overflowX:`hidden`}}]}),nY=R(`div`,{name:`MuiTabs`,slot:`List`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.list,t.flexContainer,n.vertical&&t.flexContainerVertical,n.centered&&t.centered]}})({display:`flex`,variants:[{props:({ownerState:e})=>e.vertical,style:{flexDirection:`column`}},{props:({ownerState:e})=>e.centered,style:{justifyContent:`center`}}]}),rY=R(`span`,{name:`MuiTabs`,slot:`Indicator`})(Nc(({theme:e})=>({position:`absolute`,height:2,bottom:0,width:`100%`,transition:e.transitions.create(),variants:[{props:{indicatorColor:`primary`},style:{backgroundColor:(e.vars||e).palette.primary.main}},{props:{indicatorColor:`secondary`},style:{backgroundColor:(e.vars||e).palette.secondary.main}},{props:({ownerState:e})=>e.vertical,style:{height:`100%`,width:2,right:0}}]}))),iY=R(BJ)({overflowX:`auto`,overflowY:`hidden`,scrollbarWidth:`none`,"&::-webkit-scrollbar":{display:`none`}}),aY={},oY=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiTabs`}),r=xo(),i=Di(),{"aria-label":a,"aria-labelledby":o,action:s,centered:c=!1,children:l,className:u,component:d=`div`,allowScrollButtonsMobile:f=!1,indicatorColor:p=`primary`,onChange:m,orientation:h=`horizontal`,ScrollButtonComponent:g,scrollButtons:_=`auto`,selectionFollowsFocus:v,slots:y={},slotProps:b={},TabIndicatorProps:x={},TabScrollButtonProps:S={},textColor:C=`primary`,value:w,variant:T=`standard`,visibleScrollbar:E=!1,...D}=n,O=T===`scrollable`,k=h===`vertical`,A=k?`scrollTop`:`scrollLeft`,j=k?`top`:`left`,M=k?`bottom`:`right`,ee=k?`clientHeight`:`clientWidth`,N=k?`height`:`width`,te={...n,component:d,allowScrollButtonsMobile:f,indicatorColor:p,orientation:h,vertical:k,scrollButtons:_,textColor:C,variant:T,visibleScrollbar:E,fixed:!O,hideScrollbar:O&&!E,scrollableX:O&&!k,scrollableY:O&&k,centered:c&&!O,scrollButtonsHideMobile:!f},ne=$J(te),re=lp({elementType:y.StartScrollButtonIcon,externalSlotProps:b.startScrollButtonIcon,ownerState:te}),ie=lp({elementType:y.EndScrollButtonIcon,externalSlotProps:b.endScrollButtonIcon,ownerState:te}),[ae,oe]=P.useState(!1),[se,ce]=P.useState(aY),[le,ue]=P.useState(!1),[de,fe]=P.useState(!1),[pe,me]=P.useState(!1),[he,ge]=P.useState({overflow:`hidden`,scrollbarWidth:0}),_e=new Map,ve=P.useRef(null),ye=P.useRef(null),be={slots:y,slotProps:{indicator:x,scrollButtons:S,...b}},xe=()=>{let e=ve.current,t;if(e){let n=e.getBoundingClientRect();t={clientWidth:e.clientWidth,scrollLeft:e.scrollLeft,scrollTop:e.scrollTop,scrollWidth:e.scrollWidth,top:n.top,bottom:n.bottom,left:n.left,right:n.right}}let n;if(e&&w!==!1){let e=ye.current.children;if(e.length>0){let t=e[_e.get(w)];n=t?t.getBoundingClientRect():null}}return{tabsMeta:t,tabMeta:n}},Se=bl(()=>{let{tabsMeta:e,tabMeta:t}=xe(),n=0,r;k?(r=`top`,t&&e&&(n=t.top-e.top+e.scrollTop)):(r=i?`right`:`left`,t&&e&&(n=(i?-1:1)*(t[r]-e[r]+e.scrollLeft)));let a={[r]:n,[N]:t?t[N]:0};if(typeof se[r]!=`number`||typeof se[N]!=`number`)ce(a);else{let e=Math.abs(se[r]-a[r]),t=Math.abs(se[N]-a[N]);(e>=1||t>=1)&&ce(a)}}),Ce=(e,{animation:t=!0}={})=>{t?RJ(A,ve.current,e,{duration:r.transitions.duration.standard}):ve.current[A]=e},we=e=>{let t=ve.current[A];k?t+=e:t+=e*(i?-1:1),Ce(t)},Te=()=>{let e=ve.current[ee],t=0,n=Array.from(ye.current.children);for(let r=0;r<n.length;r+=1){let i=n[r];if(t+i[ee]>e){r===0&&(t=e);break}t+=i[ee]}return t},Ee=()=>{we(-1*Te())},De=()=>{we(Te())},[Oe,{onChange:ke,...Ae}]=zc(`scrollbar`,{className:I(ne.scrollableX,ne.hideScrollbar),elementType:iY,shouldForwardComponentProp:!0,externalForwardedProps:be,ownerState:te}),je=P.useCallback(e=>{ke?.(e),ge({overflow:null,scrollbarWidth:e})},[ke]),[Me,Ne]=zc(`scrollButtons`,{className:I(ne.scrollButtons,S.className),elementType:qJ,externalForwardedProps:be,ownerState:te,additionalProps:{orientation:h,slots:{StartScrollButtonIcon:y.startScrollButtonIcon||y.StartScrollButtonIcon,EndScrollButtonIcon:y.endScrollButtonIcon||y.EndScrollButtonIcon},slotProps:{startScrollButtonIcon:re,endScrollButtonIcon:ie}}}),Pe=()=>{let e={};e.scrollbarSizeListener=O?(0,F.jsx)(Oe,{...Ae,onChange:je}):null;let t=O&&(_===`auto`&&(le||de)||_===!0);return e.scrollButtonStart=t?(0,F.jsx)(Me,{direction:i?`right`:`left`,onClick:Ee,disabled:!le,...Ne}):null,e.scrollButtonEnd=t?(0,F.jsx)(Me,{direction:i?`left`:`right`,onClick:De,disabled:!de,...Ne}):null,e},Fe=bl(e=>{let{tabsMeta:t,tabMeta:n}=xe();if(!(!n||!t)){if(n[j]<t[j]){let r=t[A]+(n[j]-t[j]);Ce(r,{animation:e})}else if(n[M]>t[M]){let r=t[A]+(n[M]-t[M]);Ce(r,{animation:e})}}}),Ie=bl(()=>{O&&_!==!1&&me(!pe)});P.useEffect(()=>{let e=us(()=>{ve.current&&Se()}),t,n=n=>{n.forEach(e=>{e.removedNodes.forEach(e=>{t?.unobserve(e)}),e.addedNodes.forEach(e=>{t?.observe(e)})}),e(),Ie()},r=ms(ve.current);r.addEventListener(`resize`,e);let i;return typeof ResizeObserver<`u`&&(t=new ResizeObserver(e),Array.from(ye.current.children).forEach(e=>{t.observe(e)})),typeof MutationObserver<`u`&&(i=new MutationObserver(n),i.observe(ye.current,{childList:!0})),()=>{e.clear(),r.removeEventListener(`resize`,e),i?.disconnect(),t?.disconnect()}},[Se,Ie]),P.useEffect(()=>{let e=Array.from(ye.current.children),t=e.length;if(typeof IntersectionObserver<`u`&&t>0&&O&&_!==!1){let n=e[0],r=e[t-1],i={root:ve.current,threshold:.99},a=new IntersectionObserver(e=>{ue(!e[0].isIntersecting)},i);a.observe(n);let o=new IntersectionObserver(e=>{fe(!e[0].isIntersecting)},i);return o.observe(r),()=>{a.disconnect(),o.disconnect()}}},[O,_,pe,l?.length]),P.useEffect(()=>{oe(!0)},[]),P.useEffect(()=>{Se()}),P.useEffect(()=>{Fe(aY!==se)},[Fe,se]),P.useImperativeHandle(s,()=>({updateIndicator:Se,updateScrollButtons:Ie}),[Se,Ie]);let[Le,Re]=zc(`indicator`,{className:I(ne.indicator,x.className),elementType:rY,externalForwardedProps:be,ownerState:te,additionalProps:{style:se}}),ze=(0,F.jsx)(Le,{...Re}),Be=0,Ve=P.Children.map(l,e=>{if(!P.isValidElement(e))return null;let t=e.props.value===void 0?Be:e.props.value;_e.set(t,Be);let n=t===w;return Be+=1,P.cloneElement(e,{fullWidth:T===`fullWidth`,indicator:n&&!ae&&ze,selected:n,selectionFollowsFocus:v,onChange:m,textColor:C,value:t,...Be===1&&w===!1&&!e.props.tabIndex?{tabIndex:0}:{}})}),He=e=>{if(e.altKey||e.shiftKey||e.ctrlKey||e.metaKey)return;let t=ye.current,n=xc(fs(t));if(n?.getAttribute(`role`)!==`tab`)return;let r=h===`horizontal`?`ArrowLeft`:`ArrowUp`,a=h===`horizontal`?`ArrowRight`:`ArrowDown`;switch(h===`horizontal`&&i&&(r=`ArrowRight`,a=`ArrowLeft`),e.key){case r:e.preventDefault(),QJ(t,n,ZJ);break;case a:e.preventDefault(),QJ(t,n,XJ);break;case`Home`:e.preventDefault(),QJ(t,null,XJ);break;case`End`:e.preventDefault(),QJ(t,null,ZJ);break;default:break}},Ue=Pe(),[We,Ge]=zc(`root`,{ref:t,className:I(ne.root,u),elementType:eY,externalForwardedProps:{...be,...D,component:d},ownerState:te}),[Ke,qe]=zc(`scroller`,{ref:ve,className:ne.scroller,elementType:tY,externalForwardedProps:be,ownerState:te,additionalProps:{style:{overflow:he.overflow,[k?`margin${i?`Left`:`Right`}`:`marginBottom`]:E?void 0:-he.scrollbarWidth}}}),[Je,Ye]=zc(`list`,{ref:ye,className:I(ne.list,ne.flexContainer),elementType:nY,externalForwardedProps:be,ownerState:te,getSlotProps:e=>({...e,onKeyDown:t=>{He(t),e.onKeyDown?.(t)}})});return(0,F.jsxs)(We,{...Ge,children:[Ue.scrollButtonStart,Ue.scrollbarSizeListener,(0,F.jsxs)(Ke,{...qe,children:[(0,F.jsx)(Je,{"aria-label":a,"aria-labelledby":o,"aria-orientation":h===`vertical`?`vertical`:null,role:`tablist`,...Ye,children:Ve}),ae&&ze]}),Ue.scrollButtonEnd]})});function sY(e){return Br(`MuiTab`,e)}var cY=Vr(`MuiTab`,[`root`,`labelIcon`,`textColorInherit`,`textColorPrimary`,`textColorSecondary`,`selected`,`disabled`,`fullWidth`,`wrapped`,`iconWrapper`,`icon`]),lY=e=>{let{classes:t,textColor:n,fullWidth:r,wrapped:i,icon:a,label:o,selected:s,disabled:c}=e;return ca({root:[`root`,a&&o&&`labelIcon`,`textColor${B(n)}`,r&&`fullWidth`,i&&`wrapped`,s&&`selected`,c&&`disabled`],icon:[`iconWrapper`,`icon`]},sY,t)},uY=R(Ld,{name:`MuiTab`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.label&&n.icon&&t.labelIcon,t[`textColor${B(n.textColor)}`],n.fullWidth&&t.fullWidth,n.wrapped&&t.wrapped,{[`& .${cY.iconWrapper}`]:t.iconWrapper},{[`& .${cY.icon}`]:t.icon}]}})(Nc(({theme:e})=>({...e.typography.button,maxWidth:360,minWidth:90,position:`relative`,minHeight:48,flexShrink:0,padding:`12px 16px`,overflow:`hidden`,whiteSpace:`normal`,textAlign:`center`,lineHeight:1.25,variants:[{props:({ownerState:e})=>e.label&&(e.iconPosition===`top`||e.iconPosition===`bottom`),style:{flexDirection:`column`}},{props:({ownerState:e})=>e.label&&e.iconPosition!==`top`&&e.iconPosition!==`bottom`,style:{flexDirection:`row`}},{props:({ownerState:e})=>e.icon&&e.label,style:{minHeight:72,paddingTop:9,paddingBottom:9}},{props:({ownerState:e,iconPosition:t})=>e.icon&&e.label&&t===`top`,style:{[`& > .${cY.icon}`]:{marginBottom:6}}},{props:({ownerState:e,iconPosition:t})=>e.icon&&e.label&&t===`bottom`,style:{[`& > .${cY.icon}`]:{marginTop:6}}},{props:({ownerState:e,iconPosition:t})=>e.icon&&e.label&&t===`start`,style:{[`& > .${cY.icon}`]:{marginRight:e.spacing(1)}}},{props:({ownerState:e,iconPosition:t})=>e.icon&&e.label&&t===`end`,style:{[`& > .${cY.icon}`]:{marginLeft:e.spacing(1)}}},{props:{textColor:`inherit`},style:{color:`inherit`,opacity:.6,[`&.${cY.selected}`]:{opacity:1},[`&.${cY.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity}}},{props:{textColor:`primary`},style:{color:(e.vars||e).palette.text.secondary,[`&.${cY.selected}`]:{color:(e.vars||e).palette.primary.main},[`&.${cY.disabled}`]:{color:(e.vars||e).palette.text.disabled}}},{props:{textColor:`secondary`},style:{color:(e.vars||e).palette.text.secondary,[`&.${cY.selected}`]:{color:(e.vars||e).palette.secondary.main},[`&.${cY.disabled}`]:{color:(e.vars||e).palette.text.disabled}}},{props:({ownerState:e})=>e.fullWidth,style:{flexShrink:1,flexGrow:1,flexBasis:0,maxWidth:`none`}},{props:({ownerState:e})=>e.wrapped,style:{fontSize:e.typography.pxToRem(12)}}]}))),dY=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiTab`}),{className:r,disabled:i=!1,disableFocusRipple:a=!1,fullWidth:o,icon:s,iconPosition:c=`top`,indicator:l,label:u,onChange:d,onClick:f,onFocus:p,selected:m,selectionFollowsFocus:h,textColor:g=`inherit`,value:_,wrapped:v=!1,...y}=n,b={...n,disabled:i,disableFocusRipple:a,selected:m,icon:!!s,iconPosition:c,label:!!u,fullWidth:o,textColor:g,wrapped:v},x=lY(b),S=s&&u&&P.isValidElement(s)?P.cloneElement(s,{className:I(x.icon,s.props.className)}):s;return(0,F.jsxs)(uY,{focusRipple:!a,className:I(x.root,r),ref:t,role:`tab`,"aria-selected":m,disabled:i,onClick:e=>{!m&&d&&d(e,_),f&&f(e)},onFocus:e=>{h&&!m&&d&&d(e,_),p&&p(e)},ownerState:b,tabIndex:m?0:-1,...y,children:[c===`top`||c===`start`?(0,F.jsxs)(P.Fragment,{children:[S,u]}):(0,F.jsxs)(P.Fragment,{children:[u,S]}),l]})}),fY=e=>{let{classes:t}=e;return ca({root:[`root`]},Wq,t)},pY=R(gG,{name:`MuiDialogTitle`,slot:`Root`})({padding:`16px 24px`,flex:`0 0 auto`}),mY=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiDialogTitle`}),{className:r,id:i,...a}=n,o=n,s=fY(o),{titleId:c=i}=P.useContext(pJ);return(0,F.jsx)(pY,{component:`h2`,className:I(s.root,r),ownerState:o,ref:t,variant:`h6`,id:i??c,...a})});function hY(e){return Br(`MuiDialogContentText`,e)}Vr(`MuiDialogContentText`,[`root`]);var gY=e=>{let{classes:t}=e,n=ca({root:[`root`]},hY,t);return{...t,...n}},_Y=R(gG,{shouldForwardProp:e=>Co(e)||e===`classes`,name:`MuiDialogContentText`,slot:`Root`})({}),vY=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiDialogContentText`}),{children:r,className:i,...a}=n,o=gY(a);return(0,F.jsx)(_Y,{component:`p`,variant:`body1`,color:`textSecondary`,ref:t,ownerState:a,className:I(o.root,i),...n,classes:o})}),yY=Uu(`@pie-lib:editable-html:plugins:media:dialog`),bY=e=>{if(!e)return!1;let t=/^(?:https?:\/\/)?(?:m\.|www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/;return e.match(t)?e.match(t)[1]:!1},xY=e=>e&&/(http|https)?:\/\/(www\.)?(player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|)(video\/)?(\d+)(?:|\/\?)/.test(e),SY=e=>e&&/^https:\/\/drive\.google\.com\/(?:file\/d\/|drive\/(?:u\/\d+\/)?folders\/|uc\?id=)([a-zA-Z0-9_-]+)/.test(e),CY=e=>{if(!e)return!1;let t=/^https?:\/\/(soundcloud\.com|snd\.sc)\/(.*)$/;return e.match(t)&&e.match(t)[2]},wY=e=>new Promise(t=>{try{fetch(`https://soundcloud.com/oembed?format=json&url=${e}`).then(e=>e.json()).then(e=>{let n=document.createElement(`div`);n.innerHTML=e.html,t(n.querySelector(`iframe`).src)}).catch(e=>{t(``),yY(e)})}catch{t(``)}}),TY={video:`Video`,audio:`Audio`},EY={uploadFile:`upload-file`,insertUrl:`insert-url`},DY=R(yJ)(({theme:e})=>({"& .MuiDialog-paper":{minWidth:`500px`}})),OY=R(Jq)(({theme:e})=>({padding:0})),kY=R(`div`)(({theme:e})=>({display:`flex`,flexDirection:`space-between`})),AY=R(`div`)(({theme:e})=>({marginTop:e.spacing(1.5)})),jY=R(`input`)(({theme:e})=>({})),MY=R(gG)(({theme:e})=>({marginTop:e.spacing(1.5),color:e.palette.error.main})),NY=R(uR)(({theme:e})=>({marginLeft:e.spacing(1.5)})),PY=class extends P.Component{static propTypes={open:v.bool,edit:v.bool,disablePortal:v.bool,handleClose:v.func,uploadSoundSupport:v.shape({add:v.func,delete:v.func}),type:v.string,src:v.string,url:v.string,urlToUse:v.string,starts:v.number,ends:v.number,height:v.number,width:v.number};constructor(e){super(e);let{ends:t,height:n,src:r,starts:i,type:a,uploadSoundSupport:o,url:s,urlToUse:c,width:l}=e,u=o?.add&&o?.delete&&a!==`video`&&!r;this.state={ends:t||0,url:s,urlToUse:c,formattedUrl:r,height:n||315,invalid:!1,starts:i||0,width:l||560,tabValue:u?EY.uploadFile:EY.insertUrl,fileUpload:{error:null,loading:!1,scheduled:!1,url:``,mimeType:``}}}componentDidMount(){this.props.url&&this.urlChange({target:{value:this.props.url}})}formatUrl=()=>{let{url:e,urlToUse:t,starts:n,ends:r}=this.state,i=bY(e),a=xY(e),o=t;if((i||a)&&t){let e=[],s,c;switch(!0){case a:s=`t`,c=`#`;break;case i:s=`start`,c=`?`;break;default:s=`start`,c=`?`}n&&e.push(`${s}=${n}`),r&&e.push(`end=${r}`),o=`${t}${e.length?c:``}${e.join(`&`)}`}this.setState({formattedUrl:null,updating:!0},()=>this.setState({formattedUrl:o,updating:!1}))};handleStateChange=e=>this.setState(e,this.formatUrl);checkAudio=e=>{CY(e)&&wY(e).then(t=>{this.handleStateChange({urlToUse:t,invalid:!t,url:e})}).catch(yY)};checkVideo=e=>{if(bY(e)){let t=`https://youtube.com/embed/${e.match(/^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/)[2]}`;yY(`is youtube`),this.handleStateChange({urlToUse:t,url:e,invalid:!1})}if(xY(e)){let t=`https://player.vimeo.com/video/${e.replace(/.*vimeo.com\/(.*)/g,`$1`)}`;yY(`is vimeo`),this.handleStateChange({urlToUse:t,url:e,ends:null,invalid:!1})}if(SY(e)){let t=`https://drive.google.com/file/d/${e.replace(/^https:\/\/drive\.google\.com\/(?:file\/d\/|drive\/(?:u\/\d+\/)?folders\/|uc\?id=)([a-zA-Z0-9_-]+)\/.*/,`$1`)}/preview`;yY(`is google drive`),this.handleStateChange({urlToUse:t,url:e,ends:null,invalid:!1})}};urlChange=e=>{let{value:t}=e.target||{},{type:n}=this.props;if(n&&n===`audio`){this.checkAudio(t);return}else if(n&&n===`video`){this.checkVideo(t);return}this.handleStateChange({urlToUse:null,url:null,invalid:!0})};changeHandler=e=>t=>this.handleStateChange({[e]:t.target.value});handleDone=e=>{let{handleClose:t}=this.props,{tabValue:n,fileUpload:r}=this.state,i=n===EY.insertUrl;if(!e){r.url&&this.handleRemoveFile(),t(e);return}if(i){let{ends:n,height:r,url:i,urlToUse:a,formattedUrl:o,starts:s,width:c}=this.state;t(e,{tag:`iframe`,ends:n,height:r,starts:s,width:c,url:i,urlToUse:a,src:o});return}if(!r.loading){t(e,{tag:`audio`,src:r.url});return}this.setState({fileUpload:{...r,scheduled:!0}})};handleUploadFile=async e=>{e.preventDefault(),this.setState({fileUpload:{...this.state.fileUpload,error:null,loading:!0}});let t=e.target.files[0],n=new FileReader;n.onload=()=>{let e=n.result;this.setState({fileUpload:{...this.state.fileUpload,url:e,mimeType:t.type}})},n.readAsDataURL(t),this.props.uploadSoundSupport.add({fileChosen:t,done:(e,t)=>{if(yY(`done: err:`,e),e){console.log(e),this.setState({fileUpload:{...this.state.fileUpload,scheduled:!1,loading:!1,error:e}});return}let{fileUpload:n}=this.state,r=n&&n.scheduled?this.handleDone.bind(this,!0):void 0;this.setState({fileUpload:{...n,scheduled:!1,loading:!1,url:t}},r)}})};handleRemoveFile=async()=>{this.props.uploadSoundSupport.delete(this.state.fileUpload.url,e=>{e&&(console.log(e),this.setState({fileUpload:{...this.state.fileUpload,error:e}}))}),this.setState({fileUpload:{...this.state.fileUpload,loading:!1,url:``,mimeType:``}})};render(){let{open:e,disablePortal:t,type:n,edit:r,uploadSoundSupport:i}=this.props,{ends:a,height:o,invalid:s,starts:c,width:l,url:u,mimeType:d,formattedUrl:f,updating:p,tabValue:m,fileUpload:h}=this.state,g=bY(u),_=m===EY.insertUrl,v=m===EY.uploadFile,y=_?s||u==null:!h.url||h.scheduled,b=i?.add&&i?.delete&&n!==`video`;return(0,F.jsxs)(DY,{disablePortal:t,open:e,onClose:()=>this.handleDone(!1),"aria-labelledby":`form-dialog-title`,children:[(0,F.jsxs)(mY,{id:`form-dialog-title`,children:[`Insert `,TY[n]]}),(0,F.jsx)(Jq,{children:(0,F.jsxs)(`div`,{children:[(0,F.jsx)(kY,{children:(0,F.jsxs)(oY,{indicatorColor:`primary`,value:m,onChange:(e,t)=>{this.setState({tabValue:t})},children:[b?(0,F.jsx)(dY,{value:EY.uploadFile,label:`Upload file`}):null,(0,F.jsx)(dY,{value:EY.insertUrl,label:n===`video`?`Insert YouTube, Vimeo, or Google Drive URL`:`Insert SoundCloud URL`})]})}),_&&(0,F.jsxs)(`div`,{children:[(0,F.jsx)(oJ,{autoFocus:!0,error:s,helperText:s?`Invalid URL`:``,margin:`dense`,id:`name`,label:`URL`,placeholder:`Paste URL of ${n}...`,type:`text`,onChange:this.urlChange,value:u,fullWidth:!0}),n===`video`&&(0,F.jsxs)(OY,{children:[(0,F.jsx)(vY,{children:`Video Properties`}),(0,F.jsx)(oJ,{autoFocus:!0,margin:`dense`,id:`width`,label:`Width`,type:`number`,placeholder:`Width`,value:l,onChange:this.changeHandler(`width`)}),(0,F.jsx)(oJ,{autoFocus:!0,margin:`dense`,id:`height`,label:`Height`,type:`number`,placeholder:`Height`,value:o,onChange:this.changeHandler(`height`)})]}),f&&(0,F.jsx)(`iframe`,{width:l,height:o,src:f,frameBorder:`0`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture`,allowFullScreen:!0}),n===`video`&&(f||p)&&!s&&(0,F.jsx)(P.Fragment,{children:(0,F.jsxs)(OY,{children:[(0,F.jsx)(oJ,{autoFocus:!0,margin:`dense`,id:`starts`,label:`Starts`,type:`number`,placeholder:`Starts`,value:c,onChange:this.changeHandler(`starts`)}),g&&(0,F.jsx)(oJ,{autoFocus:!0,margin:`dense`,id:`ends`,label:`Ends`,type:`number`,placeholder:`Ends`,value:a,onChange:this.changeHandler(`ends`)})]})})]}),v&&(0,F.jsx)(AY,{children:(0,F.jsxs)(`div`,{children:[h.url?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(kY,{children:[(0,F.jsx)(`audio`,{controls:`controls`,controlsList:`nodownload`,children:(0,F.jsx)(`source`,{type:d,src:h.url})}),(0,F.jsx)(NY,{"aria-label":`delete`,onClick:this.handleRemoveFile,children:(0,F.jsx)(dR,{})})]}),!h.scheduled&&h.loading?(0,F.jsx)(gG,{variant:`subheading`,children:`Loading...`}):null,h.scheduled?(0,F.jsx)(gG,{variant:`subheading`,children:`Waiting for Upload to finish, then inserting item...`}):null]}):h.loading?null:(0,F.jsx)(jY,{accept:`audio/*`,onChange:this.handleUploadFile,type:`file`}),!!h.error&&(0,F.jsx)(MY,{variant:`caption`,children:h.error})]})})]})}),(0,F.jsxs)(uJ,{children:[(0,F.jsx)(ff,{onClick:()=>this.handleDone(!1),color:`primary`,children:`Cancel`}),(0,F.jsx)(ff,{disabled:y,onClick:()=>this.handleDone(!0),color:`primary`,children:r?`Update`:`Insert`})]})]})}},FY=R(`span`)(({theme:e})=>({position:`relative`,bottom:`5px`,left:0,width:`100%`,background:e.palette.common.white,display:`inline-flex`,padding:`5px`,boxShadow:`0px 4px 4px rgba(0, 0, 0, 0.25)`})),IY=R(`span`)(({theme:e})=>({cursor:`pointer`,flex:3,border:`solid ${e.palette.common.black}`,textAlign:`right`,borderWidth:`0 2px 0 0`,marginRight:`5px`,paddingRight:`5px`})),LY=R(`span`)({cursor:`pointer`}),RY=class extends P.Component{static propTypes={onEdit:v.func,hideEdit:v.bool,onRemove:v.func};render(){let{hideEdit:e,onEdit:t,onRemove:n}=this.props;return(0,F.jsxs)(FY,{children:[e?null:(0,F.jsx)(IY,{onClick:t,children:`Edit Settings`}),(0,F.jsx)(LY,{onClick:n,children:`Remove`})]})}},zY=wO.create({name:`media`,group:`inline`,inline:!0,atom:!0,addAttributes(){return{type:{default:`video`},src:{default:null},width:{default:null},height:{default:null},title:{default:null},starts:{default:null},ends:{default:null},editing:{default:!1},tag:{default:`iframe`},url:{default:null}}},parseHTML(){return[{tag:`iframe[data-type="video"]`,getAttrs:e=>({type:`video`,tag:`iframe`,src:e.getAttribute(`src`),width:e.getAttribute(`width`),height:e.getAttribute(`height`),title:e.dataset.title,starts:e.dataset.starts,ends:e.dataset.ends,url:e.dataset.url})},{tag:`audio`,getAttrs:e=>({type:`audio`,tag:`audio`,src:e.querySelector(`source`)?.getAttribute(`src`)})}]},renderHTML({HTMLAttributes:e}){let{tag:t,src:n,width:r,height:i}=e;return t===`audio`?[`audio`,{controls:`controls`,controlsList:`nodownload`},[`source`,{src:n,type:`audio/mp3`}]]:[`iframe`,nE({"data-type":`video`,frameborder:`0`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture`,allowfullscreen:``,src:n},r?{width:r}:{},i?{height:i}:{})]},addCommands(){return{insertMedia:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e}),updateMedia:e=>({commands:t})=>t.updateAttributes(this.name,e)}},addNodeView(){return iA(e=>(0,F.jsx)(HY,{...e,options:this.options}))}}),BY=()=>{document.querySelectorAll(`.insert-media-dialog`).forEach(e=>e.remove())},VY=e=>{let t=document.createElement(`div`),{type:n,callback:r,options:i,...a}=e,o=document.body.style.overflow;BY(),t.className=`insert-media-dialog`,document.body.style.overflow=`hidden`;let s=(e,n)=>{r(e,n),t.remove(),document.body.style.overflow=o},c=(0,F.jsx)(PY,{...a,uploadSoundSupport:i.uploadSoundSupport,type:n,disablePortal:!0,open:!0,handleClose:s});Ms.render(c,t),document.body.appendChild(t)};function HY({editor:e,node:t,updateAttributes:n,deleteNode:r,options:i}){let{type:a,src:o,width:s,height:c,tag:l}=t.attrs;return(0,P.useEffect)(()=>{o||VY({...t.attrs,options:i,edit:!0,callback:(t,i)=>{t?n(i):r(),e.chain().focus().run()}})},[]),(0,F.jsxs)(Wk,{"data-type":a,style:{width:s,height:c},children:[l===`audio`?(0,F.jsx)(`audio`,{controls:!0,controlsList:`nodownload`,children:(0,F.jsx)(`source`,{type:`audio/mp3`,src:o})}):(0,F.jsx)(`iframe`,{src:o,allowFullScreen:!0,frameBorder:`0`,width:s,height:c}),(0,F.jsx)(RY,{onEdit:()=>{VY({...t.attrs,options:i,edit:!0,callback:(t,r)=>{t&&n(r),e.chain().focus().run()}})},onRemove:r})]})}function UY(e){return Br(`MuiListItem`,e)}Vr(`MuiListItem`,[`root`,`container`,`dense`,`alignItemsFlexStart`,`divider`,`gutters`,`padding`,`secondaryAction`]);var WY=Vr(`MuiListItemButton`,[`root`,`focusVisible`,`dense`,`alignItemsFlexStart`,`disabled`,`divider`,`gutters`,`selected`]);function GY(e){return Br(`MuiListItemSecondaryAction`,e)}Vr(`MuiListItemSecondaryAction`,[`root`,`disableGutters`]);var KY=e=>{let{disableGutters:t,classes:n}=e;return ca({root:[`root`,t&&`disableGutters`]},GY,n)},qY=R(`div`,{name:`MuiListItemSecondaryAction`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.disableGutters&&t.disableGutters]}})({position:`absolute`,right:16,top:`50%`,transform:`translateY(-50%)`,variants:[{props:({ownerState:e})=>e.disableGutters,style:{right:0}}]}),JY=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiListItemSecondaryAction`}),{className:r,...i}=n,a=P.useContext(up),o={...n,disableGutters:a.disableGutters},s=KY(o);return(0,F.jsx)(qY,{className:I(s.root,r),ownerState:o,ref:t,...i})});JY.muiName=`ListItemSecondaryAction`;var YY=(e,t)=>{let{ownerState:n}=e;return[t.root,n.dense&&t.dense,n.alignItems===`flex-start`&&t.alignItemsFlexStart,n.divider&&t.divider,!n.disableGutters&&t.gutters,!n.disablePadding&&t.padding,n.hasSecondaryAction&&t.secondaryAction]},XY=e=>{let{alignItems:t,classes:n,dense:r,disableGutters:i,disablePadding:a,divider:o,hasSecondaryAction:s}=e;return ca({root:[`root`,r&&`dense`,!i&&`gutters`,!a&&`padding`,o&&`divider`,t===`flex-start`&&`alignItemsFlexStart`,s&&`secondaryAction`],container:[`container`],secondaryAction:[`secondaryAction`]},UY,n)},ZY=R(`div`,{name:`MuiListItem`,slot:`Root`,overridesResolver:YY})(Nc(({theme:e})=>({display:`flex`,justifyContent:`flex-start`,alignItems:`center`,position:`relative`,textDecoration:`none`,width:`100%`,boxSizing:`border-box`,textAlign:`left`,variants:[{props:({ownerState:e})=>!e.disablePadding,style:{paddingTop:8,paddingBottom:8}},{props:({ownerState:e})=>!e.disablePadding&&e.dense,style:{paddingTop:4,paddingBottom:4}},{props:({ownerState:e})=>!e.disablePadding&&!e.disableGutters,style:{paddingLeft:16,paddingRight:16}},{props:({ownerState:e})=>!e.disablePadding&&!!e.secondaryAction,style:{paddingRight:48}},{props:({ownerState:e})=>!!e.secondaryAction,style:{[`& > .${WY.root}`]:{paddingRight:48}}},{props:{alignItems:`flex-start`},style:{alignItems:`flex-start`}},{props:({ownerState:e})=>e.divider,style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`,backgroundClip:`padding-box`}},{props:({ownerState:e})=>e.button,style:{transition:e.transitions.create(`background-color`,{duration:e.transitions.duration.shortest}),"&:hover":{textDecoration:`none`,backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:`transparent`}}}},{props:({ownerState:e})=>e.hasSecondaryAction,style:{paddingRight:48}}]}))),QY=R(`li`,{name:`MuiListItem`,slot:`Container`})({position:`relative`}),$Y=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiListItem`}),{alignItems:r=`center`,children:i,className:a,component:o,components:s={},componentsProps:c={},ContainerComponent:l=`li`,ContainerProps:{className:u,...d}={},dense:f=!1,disableGutters:p=!1,disablePadding:m=!1,divider:h=!1,secondaryAction:g,slotProps:_={},slots:v={},...y}=n,b=P.useContext(up),x=P.useMemo(()=>({dense:f||b.dense||!1,alignItems:r,disableGutters:p}),[r,b.dense,f,p]),S=P.useRef(null),C=P.Children.toArray(i),w=C.length&&hl(C[C.length-1],[`ListItemSecondaryAction`]),T={...n,alignItems:r,dense:x.dense,disableGutters:p,disablePadding:m,divider:h,hasSecondaryAction:w},E=XY(T),D=rc(S,t),[O,k]=zc(`secondaryAction`,{elementType:JY,externalForwardedProps:{slots:v,slotProps:_},ownerState:T,className:E.secondaryAction}),A=v.root||s.Root||ZY,j=_.root||c.root||{},M={className:I(E.root,j.className,a),...y},ee=o||`li`;return w?(ee=!M.component&&!o?`div`:ee,l===`li`&&(ee===`li`?ee=`div`:M.component===`li`&&(M.component=`div`)),(0,F.jsx)(up.Provider,{value:x,children:(0,F.jsxs)(QY,{as:l,className:I(E.container,u),ref:D,ownerState:T,...d,children:[(0,F.jsx)(A,{...j,...!rs(A)&&{as:ee,ownerState:{...T,...j.ownerState}},...M,children:C}),C.pop()]})})):(0,F.jsx)(up.Provider,{value:x,children:(0,F.jsxs)(A,{...j,as:ee,ref:D,...!rs(A)&&{ownerState:{...T,...j.ownerState}},...M,children:[C,g&&(0,F.jsx)(O,{...k,children:g})]})})}),eX=()=>{document.querySelectorAll(`.insert-css-dialog`).forEach(e=>e.remove())},tX=({editor:e,callback:t,opts:n,selectedText:r,parentNode:i})=>{let a=e.options.element,o=document.createElement(`div`),{selection:s}=e.state;eX(),o.className=`insert-css-dialog`;let c=!1,l=e=>{if(c){let t=o.contains(e.target)||void 0,n=a.contains(e.target);t||n||u()}else c=!0},u=()=>{t(void 0,!0),o.remove(),document.body.removeEventListener(`click`,l)},d=e=>{t(e,!0),o.remove(),document.body.removeEventListener(`click`,l)},f=i?.attrs.class,p=e=>{let t=`<span class="${e}">${r}</span>`;if(i){let e=`span`;i?.object===`inline`&&(e=`span`),i?.object===`block`&&(e=`div`),t=`<${e} class="${f}">${i.text.slice(0,s.$anchor.textOffset)}${t}${i.text.slice(s.$head.textOffset)}</${e}>`}return t},m=(0,F.jsxs)(`div`,{style:{background:`white`,height:500,padding:20,overflow:`hidden`,display:`flex`,flexFlow:`column`},children:[(0,F.jsx)(`h2`,{children:`Please choose a css class`}),f&&(0,F.jsxs)(`div`,{children:[`The current parent has this class `,f]}),(0,F.jsx)(pp,{component:`nav`,style:{overflow:`scroll`},children:n.names.map((e,t)=>(0,F.jsxs)($Y,{button:!0,onClick:()=>d(e),children:[(0,F.jsx)(`div`,{style:{marginRight:20},children:e}),(0,F.jsx)(`div`,{dangerouslySetInnerHTML:{__html:p(e)}})]},`rule-${t}`))})]});Ms.render(m,o,()=>{let t=e.view.nodeDOM(e.state.selection.from)?.parentNode;if(t){let e=a.parentElement.parentElement.parentElement.getBoundingClientRect(),n=t.getBoundingClientRect();a.parentElement.parentElement.parentElement.appendChild(o),o.style.maxWidth=`500px`,o.style.position=`absolute`,o.style.top=0,o.style.zIndex=99999;let r=`${n.left+Math.abs(e.left)+t.offsetWidth+10}px`,i=`${n.x}px`;o.style.left=r;let s=o.offsetWidth;o.style.left=`unset`,o.style.right=i;let c=o.offsetWidth;o.style.left=`unset`,o.style.right=`unset`,s>=c?o.style.left=r:o.style.right=i,document.body.addEventListener(`click`,l)}})},nX=qD.create({name:`cssmark`,addOptions(){return{classes:[]}},addAttributes(){return{class:{default:null,parseHTML:e=>e.getAttribute(`class`),renderHTML:e=>e.class?{class:e.class}:{}}}},parseHTML(){return[{tag:`span[class]`,getAttrs:e=>{let t=e.getAttribute(`class`)||``;if(!t)return!1;if((this.options&&this.options.classes||[]).length>0){let e=this.options.classes.find(e=>t.includes(e));return e?{class:e}:!1}return{class:t}}}]},renderHTML({HTMLAttributes:e}){return[`span`,nE(e),0]},addCommands(){return{setCSSClass:e=>({commands:t})=>t.setMark(this.name,{class:e}),unsetCSSClass:()=>({commands:e})=>e.unsetMark(this.name),openCSSClassDialog:()=>({editor:e})=>{tX({editor:e,selectedText:e.state.doc.textBetween(e.state.selection.from,e.state.selection.to),parentNode:e.state.selection.$from.nodeAfter,opts:this.options.extraCSSRules,callback:t=>{t&&e.chain().focus().setCSSClass(t).run()}})}}}}),rX=LN.extend({content:`(div | paragraph | heading | bulletList | orderedList | blockquote | codeBlock | horizontalRule | image | imageUploadNode)+`}),iX=wO.create({name:`headingParagraph`,group:`block`,content:`inline*`,defining:!0,addAttributes(){return{"data-heading":{default:`heading1`,parseHTML:e=>e.getAttribute(`data-heading`),renderHTML:e=>({"data-heading":e[`data-heading`]})}}},parseHTML(){return[{tag:`p[data-heading]`}]},renderHTML({HTMLAttributes:e}){return[`p`,nE(e),0]},addCommands(){return{toggleHeadingParagraph:()=>({commands:e,editor:t})=>t.isActive(`headingParagraph`)?e.setNode(`paragraph`):e.setNode(`headingParagraph`,{"data-heading":`heading1`})}}}),aX=e=>{if(!e)return;let t=/^calc\((.*)\)$/;if(typeof e==`string`){if(e.endsWith(`%`))return;if(e.endsWith(`px`)||e.endsWith(`vh`)||e.endsWith(`vw`)||e.endsWith(`ch`)||e.endsWith(`em`)||e.match(t))return e;let n=parseInt(e,10);return Number.isNaN(n)?n:`${n}px`}if(typeof e==`number`)return`${e}px`},oX=ml((0,F.jsx)(`path`,{d:`M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H7v14h7.04c2.09 0 3.71-1.7 3.71-3.79 0-1.52-.86-2.82-2.15-3.42M10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5`}),`FormatBold`),sX=ml((0,F.jsx)(`path`,{d:`M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4z`}),`FormatItalic`),cX=ml((0,F.jsx)(`path`,{d:`M10 19h4v-3h-4zM5 4v3h5v3h4V7h5V4zM3 14h18v-2H3z`}),`FormatStrikethrough`),lX=ml((0,F.jsx)(`path`,{d:`M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6z`}),`Code`),uX=ml((0,F.jsx)(`path`,{d:`M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2M8 20H4v-4h4zm0-6H4v-4h4zm0-6H4V4h4zm6 12h-4v-4h4zm0-6h-4v-4h4zm0-6h-4V4h4zm6 12h-4v-4h4zm0-6h-4v-4h4zm0-6h-4V4h4z`}),`GridOn`),dX=ml((0,F.jsx)(`path`,{d:`M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5m0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5m0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5M7 19h14v-2H7zm0-6h14v-2H7zm0-8v2h14V5z`}),`FormatListBulleted`),fX=ml((0,F.jsx)(`path`,{d:`M2 17h2v.5H3v1h1v.5H2v1h3v-4H2zm1-9h1V4H2v1h1zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2zm5-6v2h14V5zm0 14h14v-2H7zm0-6h14v-2H7z`}),`FormatListNumbered`),pX=ml((0,F.jsx)(`path`,{d:`M12 17c3.31 0 6-2.69 6-6V3h-2.5v8c0 1.93-1.57 3.5-3.5 3.5S8.5 12.93 8.5 11V3H6v8c0 3.31 2.69 6 6 6m-7 2v2h14v-2z`}),`FormatUnderlined`),mX=ml((0,F.jsx)(`path`,{d:`M18 4H6v2l6.5 6L6 18v2h12v-3h-7l5-5-5-5h7z`}),`Functions`),hX=ml((0,F.jsx)(`path`,{d:`M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2M8.5 13.5l2.5 3.01L14.5 12l4.5 6H5z`}),`Image`),gX=ml((0,F.jsx)(`path`,{d:`M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7z`}),`Redo`),_X=ml((0,F.jsx)(`path`,{d:`M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z`}),`FormatQuote`),vX=ml((0,F.jsx)(`path`,{d:`M18 3v2h-2V3H8v2H6V3H4v18h2v-2h2v2h8v-2h2v2h2V3zM8 17H6v-2h2zm0-4H6v-2h2zm0-4H6V7h2zm10 8h-2v-2h2zm0-4h-2v-2h2zm0-4h-2V7h2z`}),`Theaters`),yX=ml((0,F.jsx)(`path`,{d:`M3 9v6h4l5 5V4L7 9zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02M14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77`}),`VolumeUp`),bX=ml((0,F.jsx)(`path`,{d:`M3 3v18h18V3zm8 16H5v-6h6zm0-8H5V5h6zm8 8h-6v-6h6zm0-8h-6V5h6z`}),`BorderAll`),xX=R(`div`)(({theme:e})=>({fontFamily:`Cerebri Sans !important`,fontSize:e.typography.fontSize,fontWeight:`bold`,lineHeight:`14px`,position:`relative`,top:`7px`,width:`110px`,height:`28px`,whiteSpace:`nowrap`})),SX=()=>(0,F.jsx)(xX,{children:`+ Response Area`}),CX={characters:[[`á`,`é`,`í`,`ó`,`ú`],[`Á`,`É`,`Í`,`Ó`,`Ú`],[`—`,`«`,`»`,`ñ`,`ü`],[`-`,`¿`,`¡`,`Ñ`,`Ü`]]},wX={hasPreview:!0,characters:[[{unicode:`U+00A2`,description:`CENT SIGN`,write:`¢`,label:`¢`},{unicode:`U+00BF`,description:`INVERTED QUESTION MARK`,write:`¿`,label:`¿`},{unicode:`U+00B4`,description:`ACUTE ACCENT`,write:`´`,label:`´`,extraProps:{style:{gridRow:`span 2`}}},{unicode:`U+00E1`,description:`LATIN SMALL LETTER A WITH ACUTE`,write:`á`,label:`á`},{unicode:`U+00E9`,description:`LATIN SMALL LETTER E WITH ACUTE`,write:`é`,label:`é`},{unicode:`U+00ED`,description:`LATIN SMALL LETTER I WITH ACUTE`,write:`í`,label:`í`},{unicode:`U+00F3`,description:`LATIN SMALL LETTER O WITH ACUTE`,write:`ó`,label:`ó`},{unicode:`U+00FA`,description:`LATIN SMALL LETTER U WITH ACUTE`,write:`ú`,label:`ú`},{unicode:`U+00F1`,description:`LATIN SMALL LETTER N WITH TILDE`,write:`ñ`,label:`ñ`}],[{unicode:`U+20AC`,description:`EURO SIGN`,write:`€`,label:`€`},{unicode:`U+00A1`,description:`INVERTED EXCLAMATION MARK`,write:`¡`,label:`¡`},{unicode:`U+00C1`,description:`LATIN CAPITAL LETTER A WITH ACUTE`,write:`Á`,label:`Á`},{unicode:`U+00C9`,description:`LATIN CAPITAL LETTER E WITH ACUTE`,write:`É`,label:`É`},{unicode:`U+00CD`,description:`LATIN CAPITAL LETTER I WITH ACUTE`,write:`Í`,label:`Í`},{unicode:`U+00D3`,description:`LATIN CAPITAL LETTER O WITH ACUTE`,write:`Ó`,label:`Ó`},{unicode:`U+00DA`,description:`LATIN CAPITAL LETTER U WITH ACUTE`,write:`Ú`,label:`Ú`},{unicode:`U+00D1`,description:`LATIN CAPITAL LETTER N WITH TILDE`,write:`Ñ`,label:`Ñ`}],[{unicode:`U+00A3`,description:`POUND SIGN`,write:`£`,label:`£`},{unicode:`U+00AB`,description:`LEFT-POINTING DOUBLE ANGLE QUOTATION MARK`,write:`«`,label:`«`},{unicode:`U+005E`,description:`CIRCUMFLEX ACCENT`,write:`^`,label:`^`,extraProps:{style:{gridRow:`span 2`}}},{unicode:`U+00E2`,description:`LATIN SMALL LETTER A WITH CIRCUMFLEX`,write:`â`,label:`â`},{unicode:`U+00EA`,description:`LATIN SMALL LETTER E WITH CIRCUMFLEX`,write:`ê`,label:`ê`},{unicode:`U+00EE`,description:`LATIN SMALL LETTER I WITH CIRCUMFLEX`,write:`î`,label:`î`},{unicode:`U+00F4`,description:`LATIN SMALL LETTER O WITH CIRCUMFLEX`,write:`ô`,label:`ô`},{unicode:`U+00FB`,description:`LATIN SMALL LETTER U WITH CIRCUMFLEX`,write:`û`,label:`û`},{unicode:`U+00E7`,description:`LATIN SMALL LETTER C WITH CEDILLA`,write:`ç`,label:`ç`}],[{unicode:`U+00A5`,description:`YEN SIGN`,write:`¥`,label:`¥`},{unicode:`U+00BB`,description:`RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK`,write:`»`,label:`»`},{unicode:`U+00C2`,description:`LATIN CAPITAL LETTER A WITH CIRCUMFLEX`,write:`Â`,label:`Â`},{unicode:`U+00CA`,description:`LATIN CAPITAL LETTER E WITH CIRCUMFLEX`,write:`Ê`,label:`Ê`},{unicode:`U+00CE`,description:`LATIN CAPITAL LETTER I WITH CIRCUMFLEX`,write:`Î`,label:`Î`},{unicode:`U+00D4`,description:`LATIN CAPITAL LETTER O WITH CIRCUMFLEX`,write:`Ô`,label:`Ô`},{unicode:`U+00DB`,description:`LATIN CAPITAL LETTER U WITH CIRCUMFLEX`,write:`Û`,label:`Û`},{unicode:`U+00C7`,description:`LATIN CAPITAL LETTER C WITH CEDILLA`,write:`Ç`,label:`Ç`}],[{unicode:`U+200A`,description:`HAIR SPACE`,write:String.fromCodePoint(`0x200A`),label:` `},{unicode:`U+00A7`,description:`SECTION SIGN`,write:`§`,label:`§`},{unicode:`U+00A8`,description:`DIAERESIS`,write:`¨`,label:`¨`,extraProps:{style:{gridRow:`span 2`}}},{unicode:`U+00E4`,description:`LATIN SMALL LETTER A WITH DIAERESIS`,write:`ä`,label:`ä`},{unicode:`U+00EB`,description:`LATIN SMALL LETTER E WITH DIAERESIS`,write:`ë`,label:`ë`},{unicode:`U+00EF`,description:`LATIN SMALL LETTER I WITH DIAERESIS`,write:`ï`,label:`ï`},{unicode:`U+00F6`,description:`LATIN SMALL LETTER O WITH DIAERESIS`,write:`ö`,label:`ö`},{unicode:`U+00FC`,description:`LATIN SMALL LETTER U WITH DIAERESIS`,write:`ü`,label:`ü`},{unicode:`U+00DF`,description:`LATIN SMALL LETTER SHARP S`,write:`ß`,label:`ß`}],[{unicode:`U+2009`,description:`THIN SPACE`,write:String.fromCodePoint(`0x2009`),label:` `},{unicode:`U+2026`,description:`HORIZONTAL ELLIPSIS`,write:`…`,label:`…`},{unicode:`U+00C4`,description:`LATIN CAPITAL LETTER A WITH DIAERESIS`,write:`Ä`,label:`Ä`},{unicode:`U+00CB`,description:`LATIN CAPITAL LETTER E WITH DIAERESIS`,write:`Ë`,label:`Ë`},{unicode:`U+00CF`,description:`LATIN CAPITAL LETTER I WITH DIAERESIS`,write:`Ï`,label:`Ï`},{unicode:`U+00D6`,description:`LATIN CAPITAL LETTER O WITH DIAERESIS`,write:`Ö`,label:`Ö`},{unicode:`U+00DC`,description:`LATIN CAPITAL LETTER U WITH DIAERESIS`,write:`Ü`,label:`Ü`},{unicode:`U+2212`,description:`MINUS SIGN`,write:`−`,label:`−`}],[{unicode:`U+00A0`,description:`NO-BREAK SPACE`,write:String.fromCodePoint(`0x00A0`),label:` `},{unicode:`U+2022`,description:`BULLET`,write:`•`,label:`•`},{unicode:`U+0060`,description:`GRAVE ACCENT`,write:"`",label:"`",extraProps:{style:{gridRow:`span 2`}}},{unicode:`U+00E0`,description:`LATIN SMALL LETTER A WITH GRAVE`,write:`à`,label:`à`},{unicode:`U+00E8`,description:`LATIN SMALL LETTER E WITH GRAVE`,write:`è`,label:`è`},{unicode:`U+00EC`,description:`LATIN SMALL LETTER I WITH GRAVE`,write:`ì`,label:`ì`},{unicode:`U+00F2`,description:`LATIN SMALL LETTER O WITH GRAVE`,write:`ò`,label:`ò`},{unicode:`U+00F9`,description:`LATIN SMALL LETTER U WITH GRAVE`,write:`ù`,label:`ù`},{unicode:`U+2013`,description:`EN DASH`,write:`–`,label:`–`}],[{unicode:`U+2003`,description:`EM SPACE`,write:String.fromCodePoint(`0x2003`),label:` `},{unicode:`U+25E6`,description:`WHITE BULLET`,write:`◦`,label:`◦`},{unicode:`U+00C0`,description:`LATIN CAPITAL LETTER A WITH GRAVE`,write:`À`,label:`À`},{unicode:`U+00C8`,description:`LATIN CAPITAL LETTER E WITH GRAVE`,write:`È`,label:`È`},{unicode:`U+00CC`,description:`LATIN CAPITAL LETTER I WITH GRAVE`,write:`Ì`,label:`Ì`},{unicode:`U+00D2`,description:`LATIN CAPITAL LETTER O WITH GRAVE`,write:`Ò`,label:`Ò`},{unicode:`U+00D9`,description:`LATIN CAPITAL LETTER U WITH GRAVE`,write:`Ù`,label:`Ù`},{unicode:`U+2014`,description:`EM DASH`,write:`—`,label:`—`}]]},TX=()=>(0,F.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 66 66`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,focusable:`false`,children:(0,F.jsx)(`path`,{d:`M42.1875 4.75C42.1875 7.38672 39.9902 9.4375 37.5 9.4375H4.6875C2.05078 9.4375 0 7.38672 0 4.75C0 2.25977 2.05078 0.0625 4.6875 0.0625H37.5C39.9902 0.0625 42.1875 2.25977 42.1875 4.75ZM42.1875 42.25C42.1875 44.8867 39.9902 46.9375 37.5 46.9375H4.6875C2.05078 46.9375 0 44.8867 0 42.25C0 39.7598 2.05078 37.5625 4.6875 37.5625H37.5C39.9902 37.5625 42.1875 39.7598 42.1875 42.25ZM0 23.5C0 21.0098 2.05078 18.8125 4.6875 18.8125H60.9375C63.4277 18.8125 65.625 21.0098 65.625 23.5C65.625 26.1367 63.4277 28.1875 60.9375 28.1875H4.6875C2.05078 28.1875 0 26.1367 0 23.5ZM65.625 61C65.625 63.6367 63.4277 65.6875 60.9375 65.6875H4.6875C2.05078 65.6875 0 63.6367 0 61C0 58.5098 2.05078 56.3125 4.6875 56.3125H60.9375C63.4277 56.3125 65.625 58.5098 65.625 61Z`,fill:`currentColor`})}),EX=()=>(0,F.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 66 66`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,focusable:`false`,children:(0,F.jsx)(`path`,{d:`M65.625 4.75C65.625 7.38672 63.4277 9.4375 60.9375 9.4375H28.125C25.4883 9.4375 23.4375 7.38672 23.4375 4.75C23.4375 2.25977 25.4883 0.0625 28.125 0.0625H60.9375C63.4277 0.0625 65.625 2.25977 65.625 4.75ZM65.625 42.25C65.625 44.8867 63.4277 46.9375 60.9375 46.9375H28.125C25.4883 46.9375 23.4375 44.8867 23.4375 42.25C23.4375 39.7598 25.4883 37.5625 28.125 37.5625H60.9375C63.4277 37.5625 65.625 39.7598 65.625 42.25ZM0 23.5C0 21.0098 2.05078 18.8125 4.6875 18.8125H60.9375C63.4277 18.8125 65.625 21.0098 65.625 23.5C65.625 26.1367 63.4277 28.1875 60.9375 28.1875H4.6875C2.05078 28.1875 0 26.1367 0 23.5ZM65.625 61C65.625 63.6367 63.4277 65.6875 60.9375 65.6875H4.6875C2.05078 65.6875 0 63.6367 0 61C0 58.5098 2.05078 56.3125 4.6875 56.3125H60.9375C63.4277 56.3125 65.625 58.5098 65.625 61Z`,fill:`currentColor`})}),DX=()=>(0,F.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 66 66`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,focusable:`false`,children:(0,F.jsx)(`path`,{d:`M51.5625 4.75C51.5625 7.38672 49.3652 9.4375 46.875 9.4375H18.75C16.1133 9.4375 14.0625 7.38672 14.0625 4.75C14.0625 2.25977 16.1133 0.0625 18.75 0.0625H46.875C49.3652 0.0625 51.5625 2.25977 51.5625 4.75ZM65.625 23.5C65.625 26.1367 63.4277 28.1875 60.9375 28.1875H4.6875C2.05078 28.1875 0 26.1367 0 23.5C0 21.0098 2.05078 18.8125 4.6875 18.8125H60.9375C63.4277 18.8125 65.625 21.0098 65.625 23.5ZM0 61C0 58.5098 2.05078 56.3125 4.6875 56.3125H60.9375C63.4277 56.3125 65.625 58.5098 65.625 61C65.625 63.6367 63.4277 65.6875 60.9375 65.6875H4.6875C2.05078 65.6875 0 63.6367 0 61ZM51.5625 42.25C51.5625 44.8867 49.3652 46.9375 46.875 46.9375H18.75C16.1133 46.9375 14.0625 44.8867 14.0625 42.25C14.0625 39.7598 16.1133 37.5625 18.75 37.5625H46.875C49.3652 37.5625 51.5625 39.7598 51.5625 42.25Z`,fill:`currentColor`})}),OX=()=>(0,F.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 66 66`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,focusable:`false`,children:(0,F.jsx)(`path`,{d:`M65.625 4.75C65.625 7.38672 63.4277 9.4375 60.9375 9.4375H4.6875C2.05078 9.4375 0 7.38672 0 4.75C0 2.25977 2.05078 0.0625 4.6875 0.0625H60.9375C63.4277 0.0625 65.625 2.25977 65.625 4.75ZM65.625 42.25C65.625 44.8867 63.4277 46.9375 60.9375 46.9375H4.6875C2.05078 46.9375 0 44.8867 0 42.25C0 39.7598 2.05078 37.5625 4.6875 37.5625H60.9375C63.4277 37.5625 65.625 39.7598 65.625 42.25ZM0 23.5C0 21.0098 2.05078 18.8125 4.6875 18.8125H60.9375C63.4277 18.8125 65.625 21.0098 65.625 23.5C65.625 26.1367 63.4277 28.1875 60.9375 28.1875H4.6875C2.05078 28.1875 0 26.1367 0 23.5ZM65.625 61C65.625 63.6367 63.4277 65.6875 60.9375 65.6875H4.6875C2.05078 65.6875 0 63.6367 0 61C0 58.5098 2.05078 56.3125 4.6875 56.3125H60.9375C63.4277 56.3125 65.625 58.5098 65.625 61Z`,fill:`currentColor`})}),kX=({editor:e,onChange:t})=>{let[n,r]=(0,P.useState)(!1),i;switch(!0){case e.isActive({textAlign:`right`}):i=(0,F.jsx)(EX,{});break;case e.isActive({textAlign:`center`}):i=(0,F.jsx)(DX,{});break;case e.isActive({textAlign:`justify`}):i=(0,F.jsx)(OX,{});break;default:i=(0,F.jsx)(TX,{});break}let a=t=>{let n=t.currentTarget?.getAttribute(`value`);n&&e.commands.setTextAlign(n),r(!1)};return(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},onClick:e=>{e.preventDefault(),e.stopPropagation(),r(!n)},children:[i,(0,F.jsx)(`span`,{style:{marginLeft:`5px`,fontSize:`8px`},"aria-hidden":`true`,children:`▼`})]}),(0,F.jsx)(ad,{in:n,timeout:`auto`,unmountOnExit:!0,style:{position:`absolute`},children:(0,F.jsxs)(pp,{component:`div`,disablePadding:!0,style:{background:`#fff`,display:`flex`,flexDirection:`row`,padding:0},children:[(0,F.jsx)($Y,{button:!0,type:`submit`,value:`left`,"aria-label":`Align text left`,onClick:a,children:(0,F.jsx)(TX,{})}),(0,F.jsx)($Y,{button:!0,type:`submit`,value:`center`,"aria-label":`Align text center`,onClick:a,children:(0,F.jsx)(DX,{})}),(0,F.jsx)($Y,{button:!0,type:`submit`,value:`right`,"aria-label":`Align text right`,onClick:a,children:(0,F.jsx)(EX,{})}),(0,F.jsx)($Y,{button:!0,type:`submit`,value:`justify`,"aria-label":`Justify text`,onClick:a,children:(0,F.jsx)(OX,{})})]})})]})},AX=R(`div`)(({theme:e})=>({fontFamily:`Cerebri Sans, Arial, sans-serif`,fontSize:e.typography.fontSize,fontWeight:`bold`,lineHeight:`14px`,position:`relative`,whiteSpace:`nowrap`})),jX=()=>(0,F.jsx)(AX,{children:`CSS`}),MX=R(`path`)({fill:`grey`,"&:hover":{fill:`black`}}),NX=e=>t=>(0,F.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,version:`1.1`,width:`24`,height:`24`,viewBox:`0 0 24 24`,"aria-hidden":`true`,focusable:`false`,children:(0,F.jsx)(e,{...t})}),PX=NX(e=>(0,F.jsx)(MX,{...e,d:`M22,10A2,2 0 0,1 20,12H4A2,2 0 0,1 2,10V3H4V5H8V3H10V5H14V3H16V5H20V3H22V10M4,10H8V7H4V10M10,10H14V7H10V10M20,10V7H16V10H20M11,14H13V17H16V19H13V22H11V19H8V17H11V14Z`})),FX=NX(e=>(0,F.jsx)(MX,{...e,d:`M9.41,13L12,15.59L14.59,13L16,14.41L13.41,17L16,19.59L14.59,21L12,18.41L9.41,21L8,19.59L10.59,17L8,14.41L9.41,13M22,9A2,2 0 0,1 20,11H4A2,2 0 0,1 2,9V6A2,2 0 0,1 4,4H20A2,2 0 0,1 22,6V9M4,9H8V6H4V9M10,9H14V6H10V9M16,9H20V6H16V9Z`})),IX=NX(e=>(0,F.jsx)(MX,{...e,d:`M11,2A2,2 0 0,1 13,4V20A2,2 0 0,1 11,22H2V2H11M4,10V14H11V10H4M4,16V20H11V16H4M4,4V8H11V4H4M15,11H18V8H20V11H23V13H20V16H18V13H15V11Z`})),LX=NX(e=>(0,F.jsx)(MX,{...e,d:`M4,2H11A2,2 0 0,1 13,4V20A2,2 0 0,1 11,22H4A2,2 0 0,1 2,20V4A2,2 0 0,1 4,2M4,10V14H11V10H4M4,16V20H11V16H4M4,4V8H11V4H4M17.59,12L15,9.41L16.41,8L19,10.59L21.59,8L23,9.41L20.41,12L23,14.59L21.59,16L19,13.41L16.41,16L15,14.59L17.59,12Z`})),RX=NX(e=>(0,F.jsx)(MX,{...e,d:`M15.46,15.88L16.88,14.46L19,16.59L21.12,14.46L22.54,15.88L20.41,18L22.54,20.12L21.12,21.54L19,19.41L16.88,21.54L15.46,20.12L17.59,18L15.46,15.88M4,3H18A2,2 0 0,1 20,5V12.08C18.45,11.82 16.92,12.18 15.68,13H12V17H13.08C12.97,17.68 12.97,18.35 13.08,19H4A2,2 0 0,1 2,17V5A2,2 0 0,1 4,3M4,7V11H10V7H4M12,7V11H18V7H12M4,13V17H10V13H4Z`})),zX=`bottom`,BX=`right`,VX=`left`,HX=`auto`,UX=[`top`,zX,BX,VX],WX=`start`,GX=`clippingParents`,KX=`viewport`,qX=`popper`,JX=`reference`,YX=UX.reduce(function(e,t){return e.concat([t+`-`+WX,t+`-end`])},[]),XX=[].concat(UX,[HX]).reduce(function(e,t){return e.concat([t,t+`-`+WX,t+`-end`])},[]),ZX=[`beforeRead`,`read`,`afterRead`,`beforeMain`,`main`,`afterMain`,`beforeWrite`,`write`,`afterWrite`];function QX(e){return e?(e.nodeName||``).toLowerCase():null}function $X(e){if(e==null)return window;if(e.toString()!==`[object Window]`){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function eZ(e){return e instanceof $X(e).Element||e instanceof Element}function tZ(e){return e instanceof $X(e).HTMLElement||e instanceof HTMLElement}function nZ(e){return typeof ShadowRoot>`u`?!1:e instanceof $X(e).ShadowRoot||e instanceof ShadowRoot}function rZ(e){var t=e.state;Object.keys(t.elements).forEach(function(e){var n=t.styles[e]||{},r=t.attributes[e]||{},i=t.elements[e];!tZ(i)||!QX(i)||(Object.assign(i.style,n),Object.keys(r).forEach(function(e){var t=r[e];t===!1?i.removeAttribute(e):i.setAttribute(e,t===!0?``:t)}))})}function iZ(e){var t=e.state,n={popper:{position:t.options.strategy,left:`0`,top:`0`,margin:`0`},arrow:{position:`absolute`},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(e){var r=t.elements[e],i=t.attributes[e]||{},a=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce(function(e,t){return e[t]=``,e},{});!tZ(r)||!QX(r)||(Object.assign(r.style,a),Object.keys(i).forEach(function(e){r.removeAttribute(e)}))})}}var aZ={name:`applyStyles`,enabled:!0,phase:`write`,fn:rZ,effect:iZ,requires:[`computeStyles`]};function oZ(e){return e.split(`-`)[0]}var sZ=Math.max,cZ=Math.min,lZ=Math.round;function uZ(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(e){return e.brand+`/`+e.version}).join(` `):navigator.userAgent}function dZ(){return!/^((?!chrome|android).)*safari/i.test(uZ())}function fZ(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),i=1,a=1;t&&tZ(e)&&(i=e.offsetWidth>0&&lZ(r.width)/e.offsetWidth||1,a=e.offsetHeight>0&&lZ(r.height)/e.offsetHeight||1);var o=(eZ(e)?$X(e):window).visualViewport,s=!dZ()&&n,c=(r.left+(s&&o?o.offsetLeft:0))/i,l=(r.top+(s&&o?o.offsetTop:0))/a,u=r.width/i,d=r.height/a;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c,x:c,y:l}}function pZ(e){var t=fZ(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function mZ(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&nZ(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function hZ(e){return $X(e).getComputedStyle(e)}function gZ(e){return[`table`,`td`,`th`].indexOf(QX(e))>=0}function _Z(e){return((eZ(e)?e.ownerDocument:e.document)||window.document).documentElement}function vZ(e){return QX(e)===`html`?e:e.assignedSlot||e.parentNode||(nZ(e)?e.host:null)||_Z(e)}function yZ(e){return!tZ(e)||hZ(e).position===`fixed`?null:e.offsetParent}function bZ(e){var t=/firefox/i.test(uZ());if(/Trident/i.test(uZ())&&tZ(e)&&hZ(e).position===`fixed`)return null;var n=vZ(e);for(nZ(n)&&(n=n.host);tZ(n)&&[`html`,`body`].indexOf(QX(n))<0;){var r=hZ(n);if(r.transform!==`none`||r.perspective!==`none`||r.contain===`paint`||[`transform`,`perspective`].indexOf(r.willChange)!==-1||t&&r.willChange===`filter`||t&&r.filter&&r.filter!==`none`)return n;n=n.parentNode}return null}function xZ(e){for(var t=$X(e),n=yZ(e);n&&gZ(n)&&hZ(n).position===`static`;)n=yZ(n);return n&&(QX(n)===`html`||QX(n)===`body`&&hZ(n).position===`static`)?t:n||bZ(e)||t}function SZ(e){return[`top`,`bottom`].indexOf(e)>=0?`x`:`y`}function CZ(e,t,n){return sZ(e,cZ(t,n))}function wZ(e,t,n){var r=CZ(e,t,n);return r>n?n:r}function TZ(){return{top:0,right:0,bottom:0,left:0}}function EZ(e){return Object.assign({},TZ(),e)}function DZ(e,t){return t.reduce(function(t,n){return t[n]=e,t},{})}var OZ=function(e,t){return e=typeof e==`function`?e(Object.assign({},t.rects,{placement:t.placement})):e,EZ(typeof e==`number`?DZ(e,UX):e)};function kZ(e){var t,n=e.state,r=e.name,i=e.options,a=n.elements.arrow,o=n.modifiersData.popperOffsets,s=oZ(n.placement),c=SZ(s),l=[`left`,`right`].indexOf(s)>=0?`height`:`width`;if(!(!a||!o)){var u=OZ(i.padding,n),d=pZ(a),f=c===`y`?`top`:VX,p=c===`y`?zX:BX,m=n.rects.reference[l]+n.rects.reference[c]-o[c]-n.rects.popper[l],h=o[c]-n.rects.reference[c],g=xZ(a),_=g?c===`y`?g.clientHeight||0:g.clientWidth||0:0,v=m/2-h/2,y=u[f],b=_-d[l]-u[p],x=_/2-d[l]/2+v,S=CZ(y,x,b),C=c;n.modifiersData[r]=(t={},t[C]=S,t.centerOffset=S-x,t)}}function AZ(e){var t=e.state,n=e.options.element,r=n===void 0?`[data-popper-arrow]`:n;r!=null&&(typeof r==`string`&&(r=t.elements.popper.querySelector(r),!r)||mZ(t.elements.popper,r)&&(t.elements.arrow=r))}var jZ={name:`arrow`,enabled:!0,phase:`main`,fn:kZ,effect:AZ,requires:[`popperOffsets`],requiresIfExists:[`preventOverflow`]};function MZ(e){return e.split(`-`)[1]}var NZ={top:`auto`,right:`auto`,bottom:`auto`,left:`auto`};function PZ(e,t){var n=e.x,r=e.y,i=t.devicePixelRatio||1;return{x:lZ(n*i)/i||0,y:lZ(r*i)/i||0}}function FZ(e){var t,n=e.popper,r=e.popperRect,i=e.placement,a=e.variation,o=e.offsets,s=e.position,c=e.gpuAcceleration,l=e.adaptive,u=e.roundOffsets,d=e.isFixed,f=o.x,p=f===void 0?0:f,m=o.y,h=m===void 0?0:m,g=typeof u==`function`?u({x:p,y:h}):{x:p,y:h};p=g.x,h=g.y;var _=o.hasOwnProperty(`x`),v=o.hasOwnProperty(`y`),y=VX,b=`top`,x=window;if(l){var S=xZ(n),C=`clientHeight`,w=`clientWidth`;if(S===$X(n)&&(S=_Z(n),hZ(S).position!==`static`&&s===`absolute`&&(C=`scrollHeight`,w=`scrollWidth`)),S=S,i===`top`||(i===`left`||i===`right`)&&a===`end`){b=zX;var T=d&&S===x&&x.visualViewport?x.visualViewport.height:S[C];h-=T-r.height,h*=c?1:-1}if(i===`left`||(i===`top`||i===`bottom`)&&a===`end`){y=BX;var E=d&&S===x&&x.visualViewport?x.visualViewport.width:S[w];p-=E-r.width,p*=c?1:-1}}var D=Object.assign({position:s},l&&NZ),O=u===!0?PZ({x:p,y:h},$X(n)):{x:p,y:h};if(p=O.x,h=O.y,c){var k;return Object.assign({},D,(k={},k[b]=v?`0`:``,k[y]=_?`0`:``,k.transform=(x.devicePixelRatio||1)<=1?`translate(`+p+`px, `+h+`px)`:`translate3d(`+p+`px, `+h+`px, 0)`,k))}return Object.assign({},D,(t={},t[b]=v?h+`px`:``,t[y]=_?p+`px`:``,t.transform=``,t))}function IZ(e){var t=e.state,n=e.options,r=n.gpuAcceleration,i=r===void 0||r,a=n.adaptive,o=a===void 0||a,s=n.roundOffsets,c=s===void 0||s,l={placement:oZ(t.placement),variation:MZ(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:i,isFixed:t.options.strategy===`fixed`};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,FZ(Object.assign({},l,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:o,roundOffsets:c})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,FZ(Object.assign({},l,{offsets:t.modifiersData.arrow,position:`absolute`,adaptive:!1,roundOffsets:c})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}var LZ={name:`computeStyles`,enabled:!0,phase:`beforeWrite`,fn:IZ,data:{}},RZ={passive:!0};function zZ(e){var t=e.state,n=e.instance,r=e.options,i=r.scroll,a=i===void 0||i,o=r.resize,s=o===void 0||o,c=$X(t.elements.popper),l=[].concat(t.scrollParents.reference,t.scrollParents.popper);return a&&l.forEach(function(e){e.addEventListener(`scroll`,n.update,RZ)}),s&&c.addEventListener(`resize`,n.update,RZ),function(){a&&l.forEach(function(e){e.removeEventListener(`scroll`,n.update,RZ)}),s&&c.removeEventListener(`resize`,n.update,RZ)}}var BZ={name:`eventListeners`,enabled:!0,phase:`write`,fn:function(){},effect:zZ,data:{}},VZ={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function HZ(e){return e.replace(/left|right|bottom|top/g,function(e){return VZ[e]})}var UZ={start:`end`,end:`start`};function WZ(e){return e.replace(/start|end/g,function(e){return UZ[e]})}function GZ(e){var t=$X(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function KZ(e){return fZ(_Z(e)).left+GZ(e).scrollLeft}function qZ(e,t){var n=$X(e),r=_Z(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;var l=dZ();(l||!l&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}return{width:a,height:o,x:s+KZ(e),y:c}}function JZ(e){var t=_Z(e),n=GZ(e),r=e.ownerDocument?.body,i=sZ(t.scrollWidth,t.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),a=sZ(t.scrollHeight,t.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),o=-n.scrollLeft+KZ(e),s=-n.scrollTop;return hZ(r||t).direction===`rtl`&&(o+=sZ(t.clientWidth,r?r.clientWidth:0)-i),{width:i,height:a,x:o,y:s}}function YZ(e){var t=hZ(e),n=t.overflow,r=t.overflowX,i=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function XZ(e){return[`html`,`body`,`#document`].indexOf(QX(e))>=0?e.ownerDocument.body:tZ(e)&&YZ(e)?e:XZ(vZ(e))}function ZZ(e,t){t===void 0&&(t=[]);var n=XZ(e),r=n===e.ownerDocument?.body,i=$X(n),a=r?[i].concat(i.visualViewport||[],YZ(n)?n:[]):n,o=t.concat(a);return r?o:o.concat(ZZ(vZ(a)))}function QZ(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function $Z(e,t){var n=fZ(e,!1,t===`fixed`);return n.top+=e.clientTop,n.left+=e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function eQ(e,t,n){return t===`viewport`?QZ(qZ(e,n)):eZ(t)?$Z(t,n):QZ(JZ(_Z(e)))}function tQ(e){var t=ZZ(vZ(e)),n=[`absolute`,`fixed`].indexOf(hZ(e).position)>=0&&tZ(e)?xZ(e):e;return eZ(n)?t.filter(function(e){return eZ(e)&&mZ(e,n)&&QX(e)!==`body`}):[]}function nQ(e,t,n,r){var i=t===`clippingParents`?tQ(e):[].concat(t),a=[].concat(i,[n]),o=a[0],s=a.reduce(function(t,n){var i=eQ(e,n,r);return t.top=sZ(i.top,t.top),t.right=cZ(i.right,t.right),t.bottom=cZ(i.bottom,t.bottom),t.left=sZ(i.left,t.left),t},eQ(e,o,r));return s.width=s.right-s.left,s.height=s.bottom-s.top,s.x=s.left,s.y=s.top,s}function rQ(e){var t=e.reference,n=e.element,r=e.placement,i=r?oZ(r):null,a=r?MZ(r):null,o=t.x+t.width/2-n.width/2,s=t.y+t.height/2-n.height/2,c;switch(i){case`top`:c={x:o,y:t.y-n.height};break;case zX:c={x:o,y:t.y+t.height};break;case BX:c={x:t.x+t.width,y:s};break;case VX:c={x:t.x-n.width,y:s};break;default:c={x:t.x,y:t.y}}var l=i?SZ(i):null;if(l!=null){var u=l===`y`?`height`:`width`;switch(a){case WX:c[l]=c[l]-(t[u]/2-n[u]/2);break;case`end`:c[l]=c[l]+(t[u]/2-n[u]/2);break;default:}}return c}function iQ(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=r===void 0?e.placement:r,a=n.strategy,o=a===void 0?e.strategy:a,s=n.boundary,c=s===void 0?GX:s,l=n.rootBoundary,u=l===void 0?KX:l,d=n.elementContext,f=d===void 0?qX:d,p=n.altBoundary,m=p!==void 0&&p,h=n.padding,g=h===void 0?0:h,_=EZ(typeof g==`number`?DZ(g,UX):g),v=f===`popper`?JX:qX,y=e.rects.popper,b=e.elements[m?v:f],x=nQ(eZ(b)?b:b.contextElement||_Z(e.elements.popper),c,u,o),S=fZ(e.elements.reference),C=rQ({reference:S,element:y,strategy:`absolute`,placement:i}),w=QZ(Object.assign({},y,C)),T=f===`popper`?w:S,E={top:x.top-T.top+_.top,bottom:T.bottom-x.bottom+_.bottom,left:x.left-T.left+_.left,right:T.right-x.right+_.right},D=e.modifiersData.offset;if(f===`popper`&&D){var O=D[i];Object.keys(E).forEach(function(e){var t=[`right`,`bottom`].indexOf(e)>=0?1:-1,n=[`top`,`bottom`].indexOf(e)>=0?`y`:`x`;E[e]+=O[n]*t})}return E}function aQ(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=n.boundary,a=n.rootBoundary,o=n.padding,s=n.flipVariations,c=n.allowedAutoPlacements,l=c===void 0?XX:c,u=MZ(r),d=u?s?YX:YX.filter(function(e){return MZ(e)===u}):UX,f=d.filter(function(e){return l.indexOf(e)>=0});f.length===0&&(f=d);var p=f.reduce(function(t,n){return t[n]=iQ(e,{placement:n,boundary:i,rootBoundary:a,padding:o})[oZ(n)],t},{});return Object.keys(p).sort(function(e,t){return p[e]-p[t]})}function oQ(e){if(oZ(e)===`auto`)return[];var t=HZ(e);return[WZ(e),t,WZ(t)]}function sQ(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var i=n.mainAxis,a=i===void 0||i,o=n.altAxis,s=o===void 0||o,c=n.fallbackPlacements,l=n.padding,u=n.boundary,d=n.rootBoundary,f=n.altBoundary,p=n.flipVariations,m=p===void 0||p,h=n.allowedAutoPlacements,g=t.options.placement,_=oZ(g)===g,v=c||(_||!m?[HZ(g)]:oQ(g)),y=[g].concat(v).reduce(function(e,n){return e.concat(oZ(n)===`auto`?aQ(t,{placement:n,boundary:u,rootBoundary:d,padding:l,flipVariations:m,allowedAutoPlacements:h}):n)},[]),b=t.rects.reference,x=t.rects.popper,S=new Map,C=!0,w=y[0],T=0;T<y.length;T++){var E=y[T],D=oZ(E),O=MZ(E)===WX,k=[`top`,zX].indexOf(D)>=0,A=k?`width`:`height`,j=iQ(t,{placement:E,boundary:u,rootBoundary:d,altBoundary:f,padding:l}),M=k?O?BX:VX:O?zX:`top`;b[A]>x[A]&&(M=HZ(M));var ee=HZ(M),N=[];if(a&&N.push(j[D]<=0),s&&N.push(j[M]<=0,j[ee]<=0),N.every(function(e){return e})){w=E,C=!1;break}S.set(E,N)}if(C)for(var te=m?3:1,ne=function(e){var t=y.find(function(t){var n=S.get(t);if(n)return n.slice(0,e).every(function(e){return e})});if(t)return w=t,`break`},re=te;re>0&&ne(re)!==`break`;re--);t.placement!==w&&(t.modifiersData[r]._skip=!0,t.placement=w,t.reset=!0)}}var cQ={name:`flip`,enabled:!0,phase:`main`,fn:sQ,requiresIfExists:[`offset`],data:{_skip:!1}};function lQ(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function uQ(e){return[`top`,BX,zX,VX].some(function(t){return e[t]>=0})}function dQ(e){var t=e.state,n=e.name,r=t.rects.reference,i=t.rects.popper,a=t.modifiersData.preventOverflow,o=iQ(t,{elementContext:`reference`}),s=iQ(t,{altBoundary:!0}),c=lQ(o,r),l=lQ(s,i,a),u=uQ(c),d=uQ(l);t.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:l,isReferenceHidden:u,hasPopperEscaped:d},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}var fQ={name:`hide`,enabled:!0,phase:`main`,requiresIfExists:[`preventOverflow`],fn:dQ};function pQ(e,t,n){var r=oZ(e),i=[`left`,`top`].indexOf(r)>=0?-1:1,a=typeof n==`function`?n(Object.assign({},t,{placement:e})):n,o=a[0],s=a[1];return o||=0,s=(s||0)*i,[`left`,`right`].indexOf(r)>=0?{x:s,y:o}:{x:o,y:s}}function mQ(e){var t=e.state,n=e.options,r=e.name,i=n.offset,a=i===void 0?[0,0]:i,o=XX.reduce(function(e,n){return e[n]=pQ(n,t.rects,a),e},{}),s=o[t.placement],c=s.x,l=s.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=c,t.modifiersData.popperOffsets.y+=l),t.modifiersData[r]=o}var hQ={name:`offset`,enabled:!0,phase:`main`,requires:[`popperOffsets`],fn:mQ};function gQ(e){var t=e.state,n=e.name;t.modifiersData[n]=rQ({reference:t.rects.reference,element:t.rects.popper,strategy:`absolute`,placement:t.placement})}var _Q={name:`popperOffsets`,enabled:!0,phase:`read`,fn:gQ,data:{}};function vQ(e){return e===`x`?`y`:`x`}function yQ(e){var t=e.state,n=e.options,r=e.name,i=n.mainAxis,a=i===void 0||i,o=n.altAxis,s=o!==void 0&&o,c=n.boundary,l=n.rootBoundary,u=n.altBoundary,d=n.padding,f=n.tether,p=f===void 0||f,m=n.tetherOffset,h=m===void 0?0:m,g=iQ(t,{boundary:c,rootBoundary:l,padding:d,altBoundary:u}),_=oZ(t.placement),v=MZ(t.placement),y=!v,b=SZ(_),x=vQ(b),S=t.modifiersData.popperOffsets,C=t.rects.reference,w=t.rects.popper,T=typeof h==`function`?h(Object.assign({},t.rects,{placement:t.placement})):h,E=typeof T==`number`?{mainAxis:T,altAxis:T}:Object.assign({mainAxis:0,altAxis:0},T),D=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,O={x:0,y:0};if(S){if(a){var k=b===`y`?`top`:VX,A=b===`y`?zX:BX,j=b===`y`?`height`:`width`,M=S[b],ee=M+g[k],N=M-g[A],te=p?-w[j]/2:0,ne=v===`start`?C[j]:w[j],re=v===`start`?-w[j]:-C[j],ie=t.elements.arrow,ae=p&&ie?pZ(ie):{width:0,height:0},oe=t.modifiersData[`arrow#persistent`]?t.modifiersData[`arrow#persistent`].padding:TZ(),se=oe[k],ce=oe[A],le=CZ(0,C[j],ae[j]),ue=y?C[j]/2-te-le-se-E.mainAxis:ne-le-se-E.mainAxis,de=y?-C[j]/2+te+le+ce+E.mainAxis:re+le+ce+E.mainAxis,fe=t.elements.arrow&&xZ(t.elements.arrow),pe=fe?b===`y`?fe.clientTop||0:fe.clientLeft||0:0,me=D?.[b]??0,he=M+ue-me-pe,ge=M+de-me,_e=CZ(p?cZ(ee,he):ee,M,p?sZ(N,ge):N);S[b]=_e,O[b]=_e-M}if(s){var ve=b===`x`?`top`:VX,ye=b===`x`?zX:BX,be=S[x],xe=x===`y`?`height`:`width`,Se=be+g[ve],Ce=be-g[ye],we=[`top`,VX].indexOf(_)!==-1,Te=D?.[x]??0,Ee=we?Se:be-C[xe]-w[xe]-Te+E.altAxis,De=we?be+C[xe]+w[xe]-Te-E.altAxis:Ce,Oe=p&&we?wZ(Ee,be,De):CZ(p?Ee:Se,be,p?De:Ce);S[x]=Oe,O[x]=Oe-be}t.modifiersData[r]=O}}var bQ={name:`preventOverflow`,enabled:!0,phase:`main`,fn:yQ,requiresIfExists:[`offset`]};function xQ(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function SQ(e){return e===$X(e)||!tZ(e)?GZ(e):xQ(e)}function Pee(e){var t=e.getBoundingClientRect(),n=lZ(t.width)/e.offsetWidth||1,r=lZ(t.height)/e.offsetHeight||1;return n!==1||r!==1}function CQ(e,t,n){n===void 0&&(n=!1);var r=tZ(t),i=tZ(t)&&Pee(t),a=_Z(t),o=fZ(e,i,n),s={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(r||!r&&!n)&&((QX(t)!==`body`||YZ(a))&&(s=SQ(t)),tZ(t)?(c=fZ(t,!0),c.x+=t.clientLeft,c.y+=t.clientTop):a&&(c.x=KZ(a))),{x:o.left+s.scrollLeft-c.x,y:o.top+s.scrollTop-c.y,width:o.width,height:o.height}}function wQ(e){var t=new Map,n=new Set,r=[];e.forEach(function(e){t.set(e.name,e)});function i(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach(function(e){if(!n.has(e)){var r=t.get(e);r&&i(r)}}),r.push(e)}return e.forEach(function(e){n.has(e.name)||i(e)}),r}function TQ(e){var t=wQ(e);return ZX.reduce(function(e,n){return e.concat(t.filter(function(e){return e.phase===n}))},[])}function EQ(e){var t;return function(){return t||=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})}),t}}function DQ(e){var t=e.reduce(function(e,t){var n=e[t.name];return e[t.name]=n?Object.assign({},n,t,{options:Object.assign({},n.options,t.options),data:Object.assign({},n.data,t.data)}):t,e},{});return Object.keys(t).map(function(e){return t[e]})}var OQ={placement:`bottom`,modifiers:[],strategy:`absolute`};function kQ(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(e){return!(e&&typeof e.getBoundingClientRect==`function`)})}function AQ(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,r=n===void 0?[]:n,i=t.defaultOptions,a=i===void 0?OQ:i;return function(e,t,n){n===void 0&&(n=a);var i={placement:`bottom`,orderedModifiers:[],options:Object.assign({},OQ,a),modifiersData:{},elements:{reference:e,popper:t},attributes:{},styles:{}},o=[],s=!1,c={state:i,setOptions:function(n){var o=typeof n==`function`?n(i.options):n;u(),i.options=Object.assign({},a,i.options,o),i.scrollParents={reference:eZ(e)?ZZ(e):e.contextElement?ZZ(e.contextElement):[],popper:ZZ(t)};var s=TQ(DQ([].concat(r,i.options.modifiers)));return i.orderedModifiers=s.filter(function(e){return e.enabled}),l(),c.update()},forceUpdate:function(){if(!s){var e=i.elements,t=e.reference,n=e.popper;if(kQ(t,n)){i.rects={reference:CQ(t,xZ(n),i.options.strategy===`fixed`),popper:pZ(n)},i.reset=!1,i.placement=i.options.placement,i.orderedModifiers.forEach(function(e){return i.modifiersData[e.name]=Object.assign({},e.data)});for(var r=0;r<i.orderedModifiers.length;r++){if(i.reset===!0){i.reset=!1,r=-1;continue}var a=i.orderedModifiers[r],o=a.fn,l=a.options,u=l===void 0?{}:l,d=a.name;typeof o==`function`&&(i=o({state:i,options:u,name:d,instance:c})||i)}}}},update:EQ(function(){return new Promise(function(e){c.forceUpdate(),e(i)})}),destroy:function(){u(),s=!0}};if(!kQ(e,t))return c;c.setOptions(n).then(function(e){!s&&n.onFirstUpdate&&n.onFirstUpdate(e)});function l(){i.orderedModifiers.forEach(function(e){var t=e.name,n=e.options,r=n===void 0?{}:n,a=e.effect;if(typeof a==`function`){var s=a({state:i,name:t,instance:c,options:r});o.push(s||function(){})}})}function u(){o.forEach(function(e){return e()}),o=[]}return c}}var jQ=AQ({defaultModifiers:[BZ,_Q,LZ,aZ,hQ,cQ,bQ,jZ,fQ]});function MQ(e){return Br(`MuiPopper`,e)}Vr(`MuiPopper`,[`root`]);function NQ(e,t){if(t===`ltr`)return e;switch(e){case`bottom-end`:return`bottom-start`;case`bottom-start`:return`bottom-end`;case`top-end`:return`top-start`;case`top-start`:return`top-end`;default:return e}}function PQ(e){return typeof e==`function`?e():e}function FQ(e){return e.nodeType!==void 0}var IQ=e=>{let{classes:t}=e;return ca({root:[`root`]},MQ,t)},LQ={},RQ=P.forwardRef(function(e,t){let{anchorEl:n,children:r,direction:i,disablePortal:a,modifiers:o,open:s,placement:c,popperOptions:l,popperRef:u,slotProps:d={},slots:f={},TransitionProps:p,ownerState:m,...h}=e,g=P.useRef(null),_=nc(g,t),v=P.useRef(null),y=nc(v,u),b=P.useRef(y);ti(()=>{b.current=y},[y]),P.useImperativeHandle(u,()=>v.current,[]);let x=NQ(c,i),[S,C]=P.useState(x),[w,T]=P.useState(PQ(n));P.useEffect(()=>{v.current&&v.current.forceUpdate()}),P.useEffect(()=>{n&&T(PQ(n))},[n]),ti(()=>{if(!w||!s)return;let e=e=>{C(e.placement)},t=[{name:`preventOverflow`,options:{altBoundary:a}},{name:`flip`,options:{altBoundary:a}},{name:`onUpdate`,enabled:!0,phase:`afterWrite`,fn:({state:t})=>{e(t)}}];o!=null&&(t=t.concat(o)),l&&l.modifiers!=null&&(t=t.concat(l.modifiers));let n=jQ(w,g.current,{placement:x,...l,modifiers:t});b.current(n);let r=g.current;return()=>{if(r){let{style:e}=r,t=e.position,i=e.top,a=e.left,o=e.transform;n.destroy(),e.position=t,e.top=i,e.left=a,e.transform=o}else n.destroy();b.current(null)}},[w,a,o,s,l,x]);let E={placement:S};p!==null&&(E.TransitionProps=p);let D=IQ(e),O=f.root??`div`;return(0,F.jsx)(O,{...lp({elementType:O,externalSlotProps:d.root,externalForwardedProps:h,additionalProps:{role:`tooltip`,ref:_},ownerState:e,className:D.root}),children:typeof r==`function`?r(E):r})}),zQ=R(P.forwardRef(function(e,t){let{anchorEl:n,children:r,container:i,direction:a=`ltr`,disablePortal:o=!1,keepMounted:s=!1,modifiers:c,open:l,placement:u=`bottom`,popperOptions:d=LQ,popperRef:f,style:p,transition:m=!1,slotProps:h={},slots:g={},..._}=e,[v,y]=P.useState(!0),b=()=>{y(!1)},x=()=>{y(!0)};if(!s&&!l&&(!m||v))return null;let S;if(i)S=i;else if(n){let e=PQ(n);S=e&&FQ(e)?ds(e).body:ds(null).body}let C=!l&&s&&(!m||v)?`none`:void 0,w=m?{in:l,onEnter:b,onExited:x}:void 0;return(0,F.jsx)(Mc,{disablePortal:o,container:S,children:(0,F.jsx)(RQ,{anchorEl:n,direction:a,disablePortal:o,modifiers:c,ref:t,open:m?!v:l,placement:u,popperOptions:d,popperRef:f,slotProps:h,slots:g,..._,style:{position:`fixed`,top:0,left:0,display:C,...p},TransitionProps:w,children:r})})}),{name:`MuiPopper`,slot:`Root`})({}),BQ=R(P.forwardRef(function(e,t){let n=Di(),{anchorEl:r,component:i,components:a,componentsProps:o,container:s,disablePortal:c,keepMounted:l,modifiers:u,open:d,placement:f,popperOptions:p,popperRef:m,transition:h,slots:g,slotProps:_,...v}=cs({props:e,name:`MuiPopper`}),y=g?.root??a?.Root,b={anchorEl:r,container:s,disablePortal:c,keepMounted:l,modifiers:u,open:d,placement:f,popperOptions:p,popperRef:m,transition:h,...v};return(0,F.jsx)(zQ,{as:i,direction:n?`rtl`:`ltr`,slots:{root:y},slotProps:_??o,...b,ref:t})}))({background:`#fff`,padding:`10px`,pointerEvents:`none`,zIndex:99999}),VQ=R(gG)({fontSize:50,textAlign:`center`}),HQ=({children:e,...t})=>(0,F.jsx)(BQ,{id:`mouse-over-popover`,open:!0,anchorOrigin:{vertical:`bottom`,horizontal:`left`},transformOrigin:{vertical:`top`,horizontal:`left`},disableRestoreFocus:!0,disableAutoFocus:!0,...t,children:(0,F.jsx)(VQ,{children:e})}),UQ=({letter:e})=>(0,F.jsx)(`div`,{style:{fontSize:`24px`,lineHeight:`24px`},children:e});UQ.propTypes={letter:v.string};function WQ({editor:e,opts:t,onClose:n}){if(!t?.characters?.length)return null;let r=(0,P.useRef)(null),i=(0,P.useRef)(n),[a,o]=(0,P.useState)({top:0,left:0}),[s,c]=(0,P.useState)(null);i.current=n;let l=(0,P.useMemo)(()=>{if(!t)return CX;switch(!0){case t.language===`spanish`:return CX;case t.language===`special`:return wX;default:return t}},[t]),u=(0,P.useMemo)(()=>l.characters.reduce((e,t)=>(t.length>=e.columns&&(e.columns=t.length),e),{rows:l.characters.length,columns:0}),[l]),d=()=>c(null);(0,P.useEffect)(()=>()=>{d()},[]),(0,P.useEffect)(()=>{if(!e)return;let t=e.options.element,n=e.view.dom,a=()=>{if(!r.current)return;let n=t.getBoundingClientRect(),{from:i}=e.state.selection,a=e.view.coordsAtPos(i),s=r.current.offsetHeight,c=r.current.offsetWidth,l=window.innerHeight-(n.bottom+60)>=s||n.top<s+80?n.bottom+60:n.top-s-20,u=a.left;l=Math.max(8,Math.min(l,window.innerHeight-s-8)),u=Math.max(8,Math.min(u,window.innerWidth-c-8)),o({top:l,left:u})};a();let s=null,c=()=>{s===null&&(s=requestAnimationFrame(()=>{s=null,a()}))};window.addEventListener(`scroll`,c,!0),window.addEventListener(`resize`,c);let l=e=>{r.current&&!r.current.contains(e.target)&&!n.contains(e.target)&&i.current()},u=setTimeout(()=>{document.addEventListener(`click`,l)});return()=>{clearTimeout(u),s!==null&&cancelAnimationFrame(s),window.removeEventListener(`scroll`,c,!0),window.removeEventListener(`resize`,c),document.removeEventListener(`click`,l)}},[e]);let f=(e,t)=>c({anchorEl:e.currentTarget,el:t});return(0,F.jsxs)(F.Fragment,{children:[Ms.createPortal((0,F.jsx)(`div`,{ref:r,className:`insert-character-dialog`,"data-toolbar-for":e.instanceId,style:{visibility:a.top===0&&a.left===0?`hidden`:`initial`,position:`fixed`,top:`${a.top}px`,left:`${a.left}px`,maxWidth:`500px`,zIndex:1e3},children:(0,F.jsx)(`div`,{children:(0,F.jsx)(gq,{keyPadCharacterRef:t.keyPadCharacterRef,setKeypadInteraction:t.setKeypadInteraction,autoFocus:!0,noDecimal:!0,hideInput:!0,noLatexHandling:!0,hideDoneButtonBackground:!0,layoutForKeyPad:u,additionalKeys:l.characters.reduce((e,t)=>(e=[...e,...t.map(e=>({name:Ip(e,`name`)||e,write:Ip(e,`write`)||e,label:Ip(e,`label`)||e,category:`character`,extraClass:`character`,extraProps:{...e.extraProps||{},style:{...(e.extraProps||{}).style,border:`1px solid #000`}},...l.hasPreview?{actions:{onMouseEnter:t=>f(t,e),onMouseLeave:d}}:{}}))],e),[]),keypadMode:`language`,onChange:t=>{typeof t==`string`&&e.chain().focus().insertContent(t).run()},onDone:n})})}),document.body),s&&Ms.createPortal((0,F.jsxs)(HQ,{onClose:d,anchorEl:s.anchorEl,children:[(0,F.jsx)(`div`,{children:s.el.label}),(0,F.jsx)(`div`,{style:{fontSize:20,lineHeight:`20px`},children:s.el.description}),(0,F.jsx)(`div`,{style:{fontSize:20,lineHeight:`20px`},children:s.el.unicode})]}),document.body)]})}WQ.propTypes={editor:v.object,opts:v.object,onClose:v.func.isRequired};var GQ=()=>(0,F.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,height:`24px`,viewBox:`0 0 24 24`,width:`24px`,fill:`none`,"aria-hidden":`true`,focusable:`false`,children:(0,F.jsx)(`path`,{d:`M22,7h-2v1h3v1h-4V7c0-0.55,0.45-1,1-1h2V5h-3V4h3c0.55,0,1,0.45,1,1v1C23,6.55,22.55,7,22,7z M5.88,20h2.66l3.4-5.42h0.12 l3.4,5.42h2.66l-4.65-7.27L17.81,6h-2.68l-3.07,4.99h-0.12L8.85,6H6.19l4.32,6.73L5.88,20z`,fill:`currentColor`})}),KQ=()=>(0,F.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,height:`24px`,viewBox:`0 0 24 24`,width:`24px`,fill:`none`,"aria-hidden":`true`,focusable:`false`,children:(0,F.jsx)(`path`,{d:`M22,18h-2v1h3v1h-4v-2c0-0.55,0.45-1,1-1h2v-1h-3v-1h3c0.55,0,1,0.45,1,1v1C23,17.55,22.55,18,22,18z M5.88,18h2.66 l3.4-5.42h0.12l3.4,5.42h2.66l-4.65-7.27L17.81,4h-2.68l-3.07,4.99h-0.12L8.85,4H6.19l4.32,6.73L5.88,18z`,fill:`currentColor`})}),qQ=()=>(0,F.jsx)(`svg`,{width:`30`,height:`28`,viewBox:`0 0 30 28`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,style:{width:`20px`,height:`18px`},"aria-hidden":`true`,focusable:`false`,children:(0,F.jsx)(`path`,{d:`M27 4V24H29C29.5 24 30 24.5 30 25V27C30 27.5625 29.5 28 29 28H19C18.4375 28 18 27.5625 18 27V25C18 24.5 18.4375 24 19 24H21V16H9V24H11C11.5 24 12 24.5 12 25V27C12 27.5625 11.5 28 11 28H1C0.4375 28 0 27.5625 0 27V25C0 24.5 0.4375 24 1 24H3V4H1C0.4375 4 0 3.5625 0 3V1C0 0.5 0.4375 0 1 0H11C11.5 0 12 0.5 12 1V3C12 3.5625 11.5 4 11 4H9V12H21V4H19C18.4375 4 18 3.5625 18 3V1C18 0.5 18.4375 0 19 0H29C29.5 0 30 0.5 30 1V3C30 3.5625 29.5 4 29 4H27Z`,fill:`currentColor`})});function JQ({editor:e,classes:t,activePlugins:n,toolbarOpts:r,responseAreaProps:i,onChange:a,autoWidthToolbar:o}){let[s,c]=(0,P.useState)(!1),l=r??{},u=Ik({editor:e,selector:e=>{let{selection:t}=e.editor?.state||{},n;if(!e.editor?.commandManager)return{};t instanceof Rv&&(n=t.node);let r=e.editor?.isActive(`math`)||e.editor?.isActive(`explicit_constructed_response`)||e.editor?.isActive(`imageUploadNode`)||e.editor?.isActive(`drag_in_the_blank`),i=t&&t.empty===!1&&e.editor.isActive(`table`);return{currentNode:n,hideDefaultToolbar:r,hasTextSelectionInTable:i,isFocused:e.editor?.isFocused,toolbarOpened:e.editor?._toolbarOpened??!1,isBold:e.editor.isActive(`bold`)??!1,canBold:e.editor.can().chain().toggleBold().run()??!1,isTable:e.editor.isActive(`table`)??!1,tableHasBorder:e.editor.getAttributes(`table`)?.border===`1`,canTable:e.editor.can().chain().insertTable().run()??!1,isItalic:e.editor.isActive(`italic`)??!1,canItalic:e.editor.can().chain().toggleItalic().run()??!1,isStrike:e.editor.isActive(`strike`)??!1,canStrike:e.editor.can().chain().toggleStrike().run()??!1,isCode:e.editor.isActive(`code`)??!1,canCode:e.editor.can().chain().toggleCode().run()??!1,canClearMarks:e.editor.can().chain().unsetAllMarks().run()??!1,isUnderline:e.editor.isActive(`underline`)??!1,isSubScript:e.editor.isActive(`subscript`)??!1,isSuperScript:e.editor.isActive(`superscript`)??!1,isParagraph:e.editor.isActive(`paragraph`)??!1,isHeading1:e.editor.isActive(`heading`,{level:1})??!1,isHeading2:e.editor.isActive(`heading`,{level:2})??!1,isHeading3:e.editor.isActive(`heading`,{level:3})??!1,isHeadingParagraph:e.editor.isActive(`headingParagraph`)??!1,isHeading4:e.editor.isActive(`heading`,{level:4})??!1,isHeading5:e.editor.isActive(`heading`,{level:5})??!1,isHeading6:e.editor.isActive(`heading`,{level:6})??!1,isBulletList:e.editor.isActive(`bulletList`)??!1,isOrderedList:e.editor.isActive(`orderedList`)??!1,isCodeBlock:e.editor.isActive(`codeBlock`)??!1,isBlockquote:e.editor.isActive(`blockquote`)??!1,canUndo:e.editor.can().chain().undo().run()??!1,canRedo:e.editor.can().chain().redo().run()??!1}}}),d=!!o,f=I(t.toolbar,fR,{[t.toolbarWithNoDone]:!0,[t.toolbarTop]:l.position===`top`,[t.toolbarRight]:l.alignment===`right`,[t.focused]:l.alwaysVisible||u.isFocused&&!u.toolbarOpened&&!u.hideDefaultToolbar,[t.autoWidth]:d,[t.fullWidth]:!d,[t.hidden]:l.isHidden===!0}),p=l.minWidth===void 0?{}:{minWidth:l.minWidth},m=e=>{e.preventDefault()},h=(0,P.useMemo)(()=>[{icon:(0,F.jsx)(uX,{}),label:`Insert table`,onClick:e=>e.chain().focus().insertTable({rows:2,cols:2,withHeaderRow:!1}).run(),hidden:e=>!n?.includes(`table`)||e.isTable,isActive:e=>e.isTable,isDisabled:e=>!e.canTable},{icon:(0,F.jsx)(PX,{}),label:`Add table row`,onClick:e=>e.chain().focus().addRowAfter().run(),hidden:e=>!(e.isTable&&!e.hasTextSelectionInTable),isActive:e=>e.isTable,isDisabled:e=>!e.canTable},{icon:(0,F.jsx)(FX,{}),label:`Remove table row`,onClick:e=>e.chain().focus().deleteRow().run(),hidden:e=>!(e.isTable&&!e.hasTextSelectionInTable),isActive:e=>e.isTable,isDisabled:e=>!e.canTable},{icon:(0,F.jsx)(IX,{}),label:`Add table column`,onClick:e=>e.chain().focus().addColumnAfter().run(),hidden:e=>!(e.isTable&&!e.hasTextSelectionInTable),isActive:e=>e.isTable,isDisabled:e=>!e.canTable},{icon:(0,F.jsx)(LX,{}),label:`Remove table column`,onClick:e=>e.chain().focus().deleteColumn().run(),hidden:e=>!(e.isTable&&!e.hasTextSelectionInTable),isActive:e=>e.isTable,isDisabled:e=>!e.canTable},{icon:(0,F.jsx)(RX,{}),label:`Remove table`,onClick:e=>e.chain().focus().deleteTable().run(),hidden:e=>!(e.isTable&&!e.hasTextSelectionInTable),isActive:e=>e.isTable,isDisabled:e=>!e.canTable},{icon:(0,F.jsx)(bX,{}),label:`Table borders`,toggle:!0,onClick:e=>{let t=e.getAttributes(`table`),n={...t,border:t.border===`0`?`1`:`0`};e.commands.updateAttributes(`table`,n)},hidden:e=>!(e.isTable&&!e.hasTextSelectionInTable),isActive:e=>e.tableHasBorder,isDisabled:e=>!e.canTable},{icon:(0,F.jsx)(oX,{}),label:`Bold`,toggle:!0,onClick:e=>e.chain().focus().toggleBold().run(),hidden:()=>!n?.includes(`bold`),isActive:e=>e.isBold,isDisabled:e=>!e.canBold},{icon:(0,F.jsx)(sX,{}),label:`Italic`,toggle:!0,onClick:e=>e.chain().focus().toggleItalic().run(),hidden:()=>!n?.includes(`italic`),isActive:e=>e.isItalic,isDisabled:e=>!e.canItalic},{icon:(0,F.jsx)(cX,{}),label:`Strikethrough`,toggle:!0,onClick:e=>e.chain().focus().toggleStrike().run(),hidden:()=>!n?.includes(`strikethrough`),isActive:e=>e.isStrike,isDisabled:e=>!e.canStrike},{icon:(0,F.jsx)(lX,{}),label:`Code`,toggle:!0,onClick:e=>e.chain().focus().toggleCode().run(),hidden:()=>!n?.includes(`code`),isActive:e=>e.isCode,isDisabled:e=>!e.canCode},{icon:(0,F.jsx)(pX,{}),label:`Underline`,toggle:!0,onClick:e=>e.chain().focus().toggleUnderline().run(),hidden:()=>!n?.includes(`underline`),isActive:e=>e.isUnderline},{icon:(0,F.jsx)(KQ,{}),label:`Subscript`,toggle:!0,onClick:e=>e.chain().focus().toggleSubscript().run(),hidden:()=>!n?.includes(`subscript`),isActive:e=>e.isSubScript},{icon:(0,F.jsx)(GQ,{}),label:`Superscript`,toggle:!0,onClick:e=>e.chain().focus().toggleSuperscript().run(),hidden:()=>!n?.includes(`superscript`),isActive:e=>e.isSuperScript},{icon:(0,F.jsx)(hX,{}),label:`Insert image`,hidden:()=>!n?.includes(`image`),onClick:e=>e.chain().focus().setImageUploadNode().run()},{icon:(0,F.jsx)(vX,{}),label:`Insert video`,hidden:()=>!n?.includes(`video`),onClick:e=>e.chain().focus().insertMedia({type:`video`}).run()},{icon:(0,F.jsx)(yX,{}),label:`Insert audio`,hidden:()=>!n?.includes(`audio`),onClick:e=>e.chain().focus().insertMedia({type:`audio`,tag:`audio`}).run()},{icon:(0,F.jsx)(jX,{}),label:`CSS classes`,hidden:()=>!n?.includes(`css`),onClick:e=>e.commands.openCSSClassDialog()},{icon:(0,F.jsx)(_X,{}),label:`Blockquote`,toggle:!0,hidden:()=>!n?.includes(`blockquote`),onClick:e=>e.chain().focus().toggleBlockquote().run(),isActive:e=>e.isBlockquote},{icon:(0,F.jsx)(qQ,{}),label:`Heading`,toggle:!0,hidden:()=>!n?.includes(`h3`),onClick:e=>e.chain().focus().toggleHeadingParagraph().run(),isActive:e=>e.isHeadingParagraph},{icon:(0,F.jsx)(mX,{}),label:`Insert math`,hidden:()=>!n?.includes(`math`),onClick:e=>e.chain().focus().insertMath(``).run()},{icon:(0,F.jsx)(UQ,{letter:`ñ`}),label:`Spanish characters (ñ)`,hidden:()=>!n?.includes(`languageCharacters`),onClick:()=>c(CX)},{icon:(0,F.jsx)(UQ,{letter:`€`}),label:`Special characters (€)`,hidden:()=>n?.filter(e=>e===`languageCharacters`).length!==2,onClick:()=>c(wX)},{icon:(0,F.jsx)(kX,{editor:e}),label:`Text alignment`,hidden:()=>!n?.includes(`text-align`),onClick:()=>{}},{icon:(0,F.jsx)(dX,{}),label:`Bulleted list`,toggle:!0,hidden:()=>!n?.includes(`bulleted-list`),onClick:e=>e.chain().focus().toggleBulletList().run(),isActive:e=>e.isBulletList},{icon:(0,F.jsx)(fX,{}),label:`Numbered list`,toggle:!0,hidden:()=>!n?.includes(`numbered-list`),onClick:e=>e.chain().focus().toggleOrderedList().run(),isActive:e=>e.isOrderedList},{icon:(0,F.jsx)(mf,{}),label:`Undo`,hidden:()=>!n?.includes(`undo`),onClick:e=>e.chain().focus().undo().run(),isDisabled:e=>!e.canUndo},{icon:(0,F.jsx)(gX,{}),label:`Redo`,hidden:()=>!n?.includes(`redo`),onClick:e=>e.chain().focus().redo().run(),isDisabled:e=>!e.canRedo}],[n,e]),g=u.hideDefaultToolbar&&u.currentNode?.type?.name===`drag_in_the_blank`;return(0,F.jsxs)(`div`,{className:f,style:{...p},onMouseDown:m,children:[g&&(0,F.jsx)(`div`,{className:t.defaultToolbar,tabIndex:`1`,children:(0,F.jsx)(`div`,{className:t.buttonsContainer,children:(0,F.jsx)(`button`,{type:`button`,className:t.button,onClick:t=>{t.preventDefault(),e.chain().focus().deleteSelection().run(),a?.(e.getHTML())},"aria-label":`Delete response area`,title:`Delete response area`,children:(0,F.jsx)(dR,{})})})}),!u.hideDefaultToolbar&&(0,F.jsxs)(`div`,{className:t.defaultToolbar,tabIndex:`1`,children:[(0,F.jsx)(`div`,{className:t.buttonsContainer,children:h.filter(e=>!e.hidden?.(u)).map((n,r)=>{let i=n.isDisabled?.(u),a=n.isActive?.(u);return(0,F.jsx)(`button`,{type:`button`,disabled:i,"aria-label":n.label,title:n.label,"aria-pressed":n.toggle?!!a:void 0,onClick:t=>{t.preventDefault(),n.onClick(e)},className:I(t.button,{[t.active]:a}),children:n.icon},r)})}),n?.includes(`responseArea`)&&(0,F.jsx)(`button`,{type:`button`,"aria-label":`Insert response area`,title:`Insert response area`,onClick:()=>{e.chain().focus().insertResponseArea(i.type).run()},className:t.button,children:(0,F.jsx)(SX,{})}),l.showDone&&(0,F.jsx)(gR,{onClick:()=>{a?.(e.getHTML()),e.commands.blur()}})]}),s&&(0,F.jsx)(WQ,{editor:e,opts:{...s,renderPopOver:(e,t)=>console.log(`Show popover`,t),closePopOver:()=>console.log(`Close popover`)},onClose:()=>c(!1)})]})}var YQ=e=>{xo();let t={defaultToolbar:`defaultToolbar`,buttonsContainer:`buttonsContainer`,button:`toolbarButton`,active:`active`,disabled:`disabled`,isActive:`isActive`,toolbar:`toolbar`,toolbarWithNoDone:`toolbarWithNoDone`,toolbarTop:`toolbarTop`,toolbarRight:`toolbarRight`,fullWidth:`fullWidth`,hidden:`hidden`,autoWidth:`autoWidth`,focused:`focused`,iconRoot:`iconRoot`,label:`label`,shared:`shared`};return(0,F.jsx)(XQ,{children:(0,F.jsx)(JQ,{...e,classes:t})})},XQ=R(`div`)(()=>({height:0,overflow:`visible`,"& .defaultToolbar":{display:`flex`,width:`100%`,justifyContent:`space-between`},"& .buttonsContainer":{alignItems:`center`,display:`flex`,width:`100%`},"& .toolbarButton":{color:`grey`,display:`inline-flex`,padding:`2px`,background:`none`,border:`none`,cursor:`pointer`,"& svg":{width:`24px`,height:`24px`},"&:hover":{color:Il()},"&:focus":{outline:`2px solid ${Tu()}`}},"& .active":{color:Il()},"& .disabled":{opacity:.7,cursor:`not-allowed`,"& :hover":{color:Ll()}},"& .isActive":{background:`var(--purple)`,color:`var(--white)`},"& .toolbar":{position:`relative`,top:`5px`,zIndex:20,cursor:`pointer`,justifyContent:`space-between`,background:`var(--editable-html-toolbar-bg, #efefef)`,minWidth:`280px`,margin:0,padding:`2px`,boxShadow:`0px 1px 5px 0px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 3px 1px -2px rgba(0, 0, 0, 0.12)`,boxSizing:`border-box`,display:`flex`,opacity:0,pointerEvents:`none`},"& .toolbarWithNoDone":{minWidth:`265px`},"& .toolbarTop":{position:`absolute`,top:`-45px`},"& .toolbarRight":{right:0},"& .fullWidth":{width:`fit-content`,minWidth:`100%`},"& .hidden":{visibility:`hidden`},"& .autoWidth":{width:`fit-content`},"& .focused":{opacity:1,pointerEvents:`auto`},"& .iconRoot":{width:`28px`,height:`28px`,padding:`4px`,verticalAlign:`top`},"& .label":{color:`var(--editable-html-toolbar-check, #00bb00)`},"& .shared":{display:`flex`}})),ZQ=R(`div`,{shouldForwardProp:e=>![`noBorder`,`error`].includes(e)})(({theme:e,noBorder:t,error:n})=>({position:`relative`,padding:`0px`,border:t?`none`:`1px solid #ccc`,borderRadius:`4px`,cursor:`text`,'& [data-slate-editor="true"]':{wordBreak:`break-word`,overflow:`visible`,maxHeight:`500px`,padding:`5px`},"&:first-child":{marginTop:0},"& ul, & ol":{padding:`0 1rem`,margin:`1.25rem 1rem 1.25rem 0.4rem`},"& ul li p, & ol li p":{marginTop:`0.25em`,marginBottom:`0.25em`},"& h1, & h2, & h3, & h4, & h5, & h6":{lineHeight:1.1,marginTop:`2.5rem`,textWrap:`pretty`},"& h1, & h2":{marginTop:`3.5rem`,marginBottom:`1.5rem`},"& h1":{fontSize:`1.4rem`},"& h2":{fontSize:`1.2rem`},"& h3":{fontSize:`1.1rem`},"& h4, & h5, & h6":{fontSize:`1rem`},"& code":{backgroundColor:`var(--purple-light)`,borderRadius:`0.4rem`,color:`var(--black)`,fontSize:`0.85rem`,padding:`0.25em 0.3em`},"& pre":{background:`var(--black)`,borderRadius:`0.5rem`,color:`var(--white)`,fontFamily:`'JetBrainsMono', monospace`,margin:`1.5rem 0`,padding:`0.75rem 1rem`,"& code":{background:`none`,color:`inherit`,fontSize:`0.8rem`,padding:0}},"& blockquote":{background:`#f9f9f9`,borderLeft:`5px solid #ccc`,margin:`1.5em 10px`,padding:`.5em 10px`},"& p":{margin:`0`},"& table":{tableLayout:`fixed`,width:`100%`,borderCollapse:`collapse`,color:Il(),backgroundColor:iu()},'& table:not([border="1"]) tr':{borderTop:`1px solid ${gu()}`},"& td, th":{padding:`.6em 1em`,textAlign:`center`},'& table:not([border="1"]) td, th':{border:`1px solid ${gu()}`},...n&&{border:`2px solid ${e.palette.error.main} !important`}})),QQ=R(`div`,{shouldForwardProp:e=>![`disableScrollbar`,`highlightShape`].includes(e)})(({theme:e,disableScrollbar:t,highlightShape:n})=>({position:`relative`,padding:`0px`,overflowY:`auto`,color:Il(),backgroundColor:n?e.palette.action.selected:iu(),...t&&{"&::-webkit-scrollbar":{display:`none`},scrollbarWidth:`none`,"-ms-overflow-style":`none`}})),$Q=R(`div`,{shouldForwardProp:e=>e!==`noPadding`})(({noPadding:e})=>({padding:e?0:`10px 8px`}));function e$(e){let[t,n]=(0,P.useState)(null),r=(0,P.useRef)(null),{editor:i,disabled:a,children:o,disableScrollbar:s,activePlugins:c,toolbarOpts:l,responseAreaProps:u,autoFocus:d,minWidth:f,width:p,maxWidth:m,minHeight:h,height:g,maxHeight:_,highlightShape:v,ref:y}=e;(0,P.useEffect)(()=>{i&&r.current&&(i._tiptapContainerEl=r.current)},[i,r.current]),(0,P.useEffect)(()=>{i&&d&&Promise.resolve().then(()=>{i.commands.focus(`end`)})},[i,d]),(0,P.useEffect)(()=>{if(e.adjustWidthForLimit){let t=document.createElement(`p`);t.style.visibility=`hidden`,t.style.position=`absolute`,t.style.whiteSpace=`nowrap`,t.textContent=`W`.repeat(e.charactersLimit);let i=window.getComputedStyle(r.current);[`fontFamily`,`fontSize`,`fontWeight`,`fontStyle`,`letterSpacing`,`wordSpacing`,`textTransform`,`lineHeight`].forEach(e=>{t.style[e]=i[e]}),document.body.appendChild(t),n(`${t.offsetWidth+27}px`),t.remove()}},[e.adjustWidthForLimit,e.charactersLimit]);let b=(0,P.useMemo)(()=>({width:aX(t||p),minWidth:aX(f),maxWidth:aX(m),height:aX(g),minHeight:aX(h),maxHeight:aX(_)}),[t,f,p,m,h,g,_]);return(0,F.jsxs)(ZQ,{noBorder:l&&l.noBorder,error:l&&l.error,className:e.className,style:{width:b.width,minWidth:b.minWidth,maxWidth:b.maxWidth},ref:r,children:[(0,F.jsx)(QQ,{disableScrollbar:s,highlightShape:v,children:(0,F.jsx)($Q,{noPadding:l&&l.noPadding,children:o})}),i&&(0,F.jsx)(YQ,{editor:i,responseAreaProps:u,toolbarOpts:l,activePlugins:c,onChange:e.onChange,autoWidthToolbar:e.autoWidthToolbar})]})}var t$=Uu(`@pie-lib:editable-html:plugins`),n$=[`bold`,`html`,`extraCSSRules`,`italic`,`underline`,`strikethrough`,`bulleted-list`,`numbered-list`,`image`,`math`,`languageCharacters`,`text-align`,`blockquote`,`h3`,`table`,`video`,`audio`,`responseArea`,`redo`,`undo`,`superscript`,`subscript`],r$={"text-align":`textAlign`,"bulleted-list":`ul_list`,"numbered-list":`ol_list`},i$=n$.filter(e=>![`responseArea`,`h3`,`blockquote`].includes(e)),a$=(e,t,n)=>{t$(`[buildPlugins] opts: `,n),e||=i$;let r=(t,n=!0)=>e.includes(t)&&n&&t,i=n.image&&n.image.delete,a=n.math,o=n.responseArea&&n.responseArea.type,s=!Lp(n.extraCSSRules),c=n?.languageCharacters||[];return Np([r(`table`),r(`bold`),r(`italic`),r(`strikethrough`),r(`underline`),r(`superscript`),r(`subscript`),r(`image`,!!i),r(`video`),r(`audio`),r(`math`,!!a),...c.map(e=>r(`languageCharacters`,e)),r(`text-align`),r(`blockquote`),r(`h3`),r(`bulleted-list`),r(`numbered-list`),r(`undo`),r(`redo`),r(`responseArea`,!!o),r(`css`,!!s),r(`html`,!!n.html)])},o$={position:`bottom`,alignment:`left`,alwaysVisible:!1,showDone:!0,doneOn:`blur`},s$={options:{},respAreaToolbar:()=>{},onHandleAreaChange:()=>{}},c$=[`bold`,`italic`,`underline`,`strikethrough`,`code`,`bulleted-list`,`numbered-list`,`image`,`math`,`languageCharacters`,`text-align`,`table`,`video`,`audio`,`responseArea`,`superscript`,`subscript`,`css`,`h3`,`undo`,`redo`],l$={"--white":`#fff`,"--black":`#2e2b29`,"--black-contrast":`#110f0e`,"--gray-1":`rgba(61, 37, 20, .05)`,"--gray-2":`rgba(61, 37, 20, .08)`,"--gray-3":`rgba(61, 37, 20, .12)`,"--gray-4":`rgba(53, 38, 28, .3)`,"--gray-5":`rgba(28, 25, 23, .6)`,"--green":`#22c55e`,"--purple":`#6a00f5`,"--purple-contrast":`#5800cc`,"--purple-light":`rgba(88, 5, 255, .05)`,"--yellow-contrast":`#facc15`,"--yellow":`rgba(250, 204, 21, .4)`,"--yellow-light":`#fffae5`,"--red":`#ff5c33`,"--red-light":`#ffebe5`,"--shadow":`0px 12px 33px 0px rgba(0, 0, 0, .06),
|
|
357
|
+
0px 3.618px 9.949px 0px rgba(0, 0, 0, .04)`},u$=e=>({role:`textbox`,"data-pie-editor":`true`,spellcheck:e?`true`:`false`,autocorrect:e?`on`:`off`,autocapitalize:e?`on`:`off`}),d$=e=>{let{showParagraphs:t,separateParagraphs:n}=e.pluginProps||{},[r,i]=(0,P.useState)([]),[a,o]=(0,P.useState)(!1),{toolbarOpts:s}=e,c=(0,P.useCallback)(e=>{i(t=>{let n=t.filter(t=>t.pos!==e);return n.length===0&&o(!1),n})},[i]),l={...o$,...s},u=(0,P.useCallback)(t=>{let n=t.getHTML();e.markup!==n&&e.onChange?.(n),l.doneOn===`blur`&&e.onDone?.(n)},[e.markup,e.onChange,e.onDone,l.doneOn]),d=(0,P.useMemo)(()=>({...s$,...e.responseAreaProps,onInlineDropdownToolbarClose:u}),[e.responseAreaProps,u]),f=(0,P.useMemo)(()=>{let{customPlugins:t,...n}=e.pluginProps||{};t||=[];let r=(e.activePlugins||c$)?.filter(e=>{let t=r$[e]||e,r=n[t]||{};return!r||!r.disabled});return a$(r,t,{math:{},textAlign:e.textAlign,html:{},extraCSSRules:e.extraCSSRules||{},image:{...e.imageSupport},toolbar:{},table:{},responseArea:{type:d.type},languageCharacters:e.languageCharactersProps,keyPadCharacterRef:{},setKeypadInteraction:{},media:{}})},[e,d.type]),p=[qF.configure({types:[`heading`,`paragraph`,`div`,`headingParagraph`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`td`,`th`],alignments:[`left`,`right`,`center`,`justify`]}),WF,oF.configure({limit:e.charactersLimit||1e6}),PF.configure({trailingNode:{node:`paragraph`,notAfter:[`paragraph`,`div`]},link:{autolink:!1,linkOnPaste:!1}}),rX,nR,iX,rR,iR,XF.configure({placeholder:e.placeholder,showOnlyWhenEditable:!0,showOnlyCurrent:!1,includeChildren:!0}),QL,PL,tR,eR,rG.configure(d),iG.configure(d),oG.configure(d),sG.configure(d),aG.configure(d),Sq.configure({toolbarOpts:l,math:e.pluginProps?.math||{}}),KF,GF,YF,IJ.configure({toolbarOpts:l,imageHandling:{disableImageAlignmentButtons:e.disableImageAlignmentButtons,onDone:t=>e.onDone?.(t.getHTML()),onDelete:e.imageSupport&&e.imageSupport.delete&&(t=>{let{src:n}=t.attrs;e.imageSupport.delete(n,e=>{c(t.pos)})}),insertImageRequested:e.imageSupport&&((t,n,r)=>{let[o,s]=n,l=n=>{let r;a&&n&&(r=e.onChange),c(s),r?.(t.getHTML())};t._insertingImage=!0,i(e=>[...e,o]),(()=>{let n=r(l),i=Pp(()=>{let e=()=>window.removeEventListener(`focus`,i);if(!t._insertingImage){e();return}c(s),t._insertingImage=!1,e()},500);window.addEventListener(`focus`,i),e.imageSupport.add(n)})()}),maxImageWidth:e.maxImageWidth,maxImageHeight:e.maxImageHeight},limit:3}),zY.configure({uploadSoundSupport:e.uploadSoundSupport}),nX.configure({extraCSSRules:e.extraCSSRules})],m=e.spellCheck!==!1,h=Bk({extensions:p,immediatelyRender:!1,editorProps:{attributes:u$(m),handleKeyDown(t,n){return e.onKeyDown?e.onKeyDown(n):!1}},editable:!e.disabled,content:$F(e.markup),onUpdate:({editor:t,transaction:n})=>{n.isDone&&e.onChange?.(t.getHTML())},onBlur:({editor:e})=>{e._insertingImage||e._toolbarOpened||e.isActive(`inline_dropdown`)||e.isActive(`explicit_constructed_response`)||!e.schema||u(e)}},[e.charactersLimit]);(0,P.useEffect)(()=>{e.editorRef&&e.editorRef(h)},[e.editorRef,h]),(0,P.useEffect)(()=>{h?.setEditable(!e.disabled)},[e.disabled,h]),(0,P.useEffect)(()=>{if(!h)return;let e=h.options?.editorProps,t={...e?.attributes,...u$(m)};e?.attributes?.spellcheck!==t.spellcheck&&h.setOptions({editorProps:{...e,attributes:t}})},[m,h]),(0,P.useEffect)(()=>{if(!h)return;let t=$F(e.markup);t!==h.getHTML()&&h.commands.setContent(t,{emitUpdate:!1})},[e.markup,h]),(0,P.useEffect)(()=>{Object.entries(l$).forEach(([e,t])=>{document.documentElement.style.setProperty(e,t)})},[]);let g=Ik({editor:h,selector:e=>({isFocused:e.editor?.isFocused})}),_=(0,P.useMemo)(()=>{let{minWidth:t,width:n,maxWidth:r,minHeight:i,height:a,maxHeight:o}=e;return{width:aX(n),minWidth:aX(t),maxWidth:aX(r),height:aX(a),minHeight:aX(i),maxHeight:aX(o)}},[e]);return(0,F.jsx)(e$,{...e,activePlugins:f,toolbarOpts:l,editorState:g,editor:h,children:h&&(0,F.jsx)(f$,{style:{minHeight:_.minHeight,height:_.height,maxHeight:_.maxHeight},showParagraph:t&&!t.disabled,separateParagraph:n&&!n.disabled,editor:h})})},f$=R(Nk,{shouldForwardProp:e=>![`showParagraph`,`separateParagraph`].includes(e)})(({showParagraph:e,separateParagraph:t})=>({display:`flex`,outline:`none !important`,"& .ProseMirror":{flex:1,padding:`5px`,maxHeight:`500px`,outline:`none !important`,position:`initial`,"& > p, & > div":{margin:`0`},"& p[data-placeholder].is-empty:only-child, & div[data-placeholder].is-empty:only-child":{position:`relative`},"& p[data-placeholder].is-empty:only-child::before, & div[data-placeholder].is-empty:only-child::before":{content:`attr(data-placeholder)`,position:`absolute`,left:0,top:0,color:`#9CA3AF`,pointerEvents:`none`,whiteSpace:`pre-wrap`},...e&&{"& > p:has(+ p)::after, & > div:has(+ div)::after":{display:`block`,content:`"¶"`,fontSize:`1em`,color:`#146EB3`}},...t&&{"& > p:has(+ p)":{marginBottom:`1em`}}}})),p$=d$,m$={min:v.number.isRequired,max:v.number.isRequired,step:v.number},h$=v.shape(m$),g$=v.shape(m$),_$=v.shape({width:v.number.isRequired,height:v.number.isRequired});v.shape({x:v.number.isRequired,y:v.number.isRequired});var v$=v.oneOfType([v.arrayOf(v.node),v.node]).isRequired,y$=v.shape({x:v.func.isRequired,y:v.func.isRequired}),b$=v.shape({x:v.func.isRequired,y:v.func.isRequired}),x$=v.shape({scale:y$.isRequired,snap:b$.isRequired,domain:h$.isRequired,range:g$.isRequired,size:_$.isRequired}),S$={graphProps:x$.isRequired,mark:v.object,onChange:v.func,onDelete:v.func,onClick:v.func};v.shape(S$);var C$=o(((e,t)=>{t.exports=function(e,t,n,r,i,a,o,s){if(!e){var c;if(t===void 0)c=Error(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var l=[n,r,i,a,o,s],u=0;c=Error(t.replace(/%s/g,function(){return l[u++]})),c.name=`Invariant Violation`}throw c.framesToPop=1,c}}}));function w$(e,t){this.x=e,this.y=t}w$.prototype={clone(){return new w$(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){let t=e.x-this.x,n=e.y-this.y;return t*t+n*n},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){let t=e[0]*this.x+e[1]*this.y,n=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=n,this},_add(e){return this.x+=e.x,this.y+=e.y,this},_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){let e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){let t=Math.cos(e),n=Math.sin(e),r=t*this.x-n*this.y,i=n*this.x+t*this.y;return this.x=r,this.y=i,this},_rotateAround(e,t){let n=Math.cos(e),r=Math.sin(e),i=t.x+n*(this.x-t.x)-r*(this.y-t.y),a=t.y+r*(this.x-t.x)+n*(this.y-t.y);return this.x=i,this.y=a,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:w$},w$.convert=function(e){if(e instanceof w$)return e;if(Array.isArray(e))return new w$(+e[0],+e[1]);if(e.x!==void 0&&e.y!==void 0)return new w$(+e.x,+e.y);throw Error(`Expected [x, y] or {x, y} point format`)};var T$=l(C$(),1),E$=(e,t,n)=>{let r=Hp(e,t,n);return r.splice(r.length,1,t),r};function D$(e,t,n,r){if(r>=t)return t;if(r<=e)return e;let i=E$(e,t,n);return i=i.filter(e=>Math.abs(r-e)<=n),i.length&&i.reduce((e,t)=>Math.abs(t-r)<=Math.abs(e-r)?t:e)}var O$=(e,t,n)=>({left:t.min-e.left,right:Math.abs(e.right-t.max),top:Math.abs(e.top-n.max),bottom:n.min-e.bottom}),k$=e=>new w$(e.x,e.y),A$=(e,t)=>k$(t).sub(k$(e)),j$=e=>(new DOMParser()?.parseFromString(e,`text/html`))?.body?.textContent||``,M$=e=>e&&Object.keys(e).length===0&&e.constructor===Object,N$=e=>typeof e==`string`&&e.trim()===``;function P$(e){return typeof e==`function`||typeof e==`object`&&!!e&&typeof e.$$typeof==`symbol`}function F$(e,t){return!e||P$(e)?e:P$(e.default)?e.default:t&&P$(e[t])?e[t]:t&&P$(e[t]?.default)?e[t].default:e}var I$=F$(ep,`Readable`)||F$(z$.Readable,`Readable`),L$=Op,R$=L$.default,z$=R$&&typeof R$==`object`?R$:L$,B$={axisLabel:{fontSize:12,textAlign:`center`,margin:4,padding:`4px 0`},chartLabel:{fontSize:16,textAlign:`center`,margin:4,padding:`4px 0`},disabledLabel:{pointerEvents:`none`,width:`100%`},editLabel:{position:`absolute`,backgroundColor:`white`,borderRadius:4,boxShadow:`0px 5px 8px rgba(0,0,0,0.15)`,zIndex:10},rotateLeftLabel:{transform:`rotate(-90deg)`,transformOrigin:`0 0`,position:`absolute`},rotateRightLabel:{transform:`rotate(90deg)`,transformOrigin:`0 0`,position:`absolute`},customBottom:{position:`absolute`},displayNone:{display:`none`},centerPlaceholder:{"& .ProseMirror p.is-editor-empty::before, & .ProseMirror div.is-editor-empty::before":{left:0,right:0,width:`100%`,textAlign:`center`}}},V$=R(`div`)({...B$.centerPlaceholder}),H$=R(`div`)({...B$.disabledLabel,"& p":{margin:0}}),U$=e=>{let{disabledLabel:t,graphHeight:n,graphWidth:r,isChartBottomLabel:i,isDefineChartBottomLabel:a,isChartLeftLabel:o,isDefineChartLeftLabel:s,placeholder:c,text:l,side:u,onChange:d,mathMlOptions:f={},charactersLimit:p,titleHeight:m,preventNewLines:h}=e,[g,_]=(0,P.useState)(!1),v=[`bold`,`italic`,`underline`,`strikethrough`,`math`],y=i||o||a||s,b=u===`left`&&s&&n-220,x={width:b||(u===`left`||u===`right`?n-8:r-8),top:b||o&&`${n-70}px`||u===`left`&&`${n-8}px`||i&&`${n-60+m}px`||u===`bottom`&&`${n-120+m}px`||0,left:u===`right`&&`${r-8}px`||(s||a)&&`40px`||i&&`-10px`||0},S={width:r-8,top:u===`right`?`${n-22}px`:0,left:0},C=()=>{!t&&(u===`left`||u===`right`)&&_(!0)},w=()=>{_(!1),requestAnimationFrame(()=>{document.activeElement?.blur?.()})},T=e=>!!(h&&e.key===`Enter`);return(0,F.jsx)(I$,{false:!0,children:(0,F.jsx)(V$,{onClick:C,style:{...g?S:x,...y?B$.chartLabel:B$.axisLabel,...u===`left`&&!g?B$.rotateLeftLabel:{},...u===`right`&&!g?B$.rotateRightLabel:{},...g?B$.editLabel:{},...i||a?B$.customBottom:{},...t&&!y&&N$(j$(l))&&B$.displayNone},children:t?(0,F.jsx)(H$,{dangerouslySetInnerHTML:{__html:l||``}}):(0,F.jsx)(p$,{markup:l||``,onChange:d,placeholder:!t&&c,toolbarOpts:{position:u===`bottom`?`top`:`bottom`,noPadding:!0,noBorder:!0},disableScrollbar:!0,activePlugins:v,onDone:w,onKeyDown:T,mathMlOptions:f,charactersLimit:p})})})};U$.propTypes={disabledLabel:v.bool,graphHeight:v.number,graphWidth:v.number,isChartBottomLabel:v.bool,isDefineChartBottomLabel:v.bool,isChartLeftLabel:v.bool,isDefineChartLeftLabel:v.bool,placeholder:v.string,text:v.string,side:v.string,onChange:v.func,mathMlOptions:v.object,charactersLimit:v.number,titleHeight:v.number};function W$(e){return typeof e==`function`||typeof e==`object`&&!!e&&typeof e.$$typeof==`symbol`}function G$(e,t){return!e||W$(e)?e:W$(e.default)?e.default:t&&W$(e[t])?e[t]:t&&W$(e[t]?.default)?e[t].default:e}var K$=G$(ep,`Readable`)||G$(Y$.Readable,`Readable`),q$=Op,J$=q$.default,Y$=J$&&typeof J$==`object`?J$:q$,X$={"& .ProseMirror p.is-editor-empty::before, & .ProseMirror div.is-editor-empty::before":{left:0,right:0,width:`100%`,textAlign:`center`}},Z$=R(`div`)(({theme:e})=>({border:`solid 1px ${Xl()}`,color:V.TEXT,backgroundColor:e.palette.common.white,touchAction:`none`,position:`relative`,boxSizing:`unset`})),Q$=R(`div`)({display:`flex`,position:`relative`}),$$=R(`svg`)({paddingLeft:`50px`,overflow:`visible`,boxSizing:`content-box`}),e1=R(`svg`)({overflow:`visible`,boxSizing:`content-box`}),t1=R(`g`)({cursor:`pointer`,userSelect:`none`}),n1=R(`div`)(({theme:e})=>({color:V.TEXT,fontSize:e.typography.fontSize+2,padding:`${e.spacing(1.5)} ${e.spacing(.5)} 0`,textAlign:`center`,"&.disabledTitle":{pointerEvents:`none`},"&.rightMargin":{marginRight:`74px`},"& p":{margin:0},...X$})),r1=R(`div`)(({theme:e})=>({color:V.TEXT,fontSize:e.typography.fontSize+4,padding:`${e.spacing(1.5)} ${e.spacing(.5)} 0`,textAlign:`center`,"&.disabledTitle":{pointerEvents:`none`},"&.rightMargin":{marginRight:`74px`},"& p":{margin:0},...X$})),i1=R(`div`)({display:`flex`,paddingTop:`6px`}),a1=R(`div`)({display:`flex`,flexDirection:`column`,alignItems:`center`,width:`100px`,pointerEvents:`none`,userSelect:`none`}),o1=R(`div`)({width:`70px`,display:`flex`,flexDirection:`column`,marginRight:`6px`}),s1=R(`div`)({textAlign:`right`,height:`20px`,pointerEvents:`none`,userSelect:`none`,"&:not(:last-child)":{marginBottom:`80px`}}),c1=class extends P.Component{constructor(e){super(e),this.state={titleHeight:0},this.resizeObserver=null}static propTypes={title:v.string,children:v$,defineChart:v.bool,disabledLabels:v.bool,disabledTitle:v.bool,graphProps:x$.isRequired,isChart:v.bool,labels:v.object,labelsPlaceholders:v.object,onChangeTitle:v.func,onMouseMove:v.func,showLabels:v.bool,showTitle:v.bool,showPixelGuides:v.bool,rootRef:v.func,onChangeLabels:v.func,titlePlaceholder:v.string,mathMlOptions:v.object,labelsCharactersLimit:v.number};mouseMove=(e,t)=>{let{graphProps:n,onMouseMove:r}=this.props;if(!r)return;let{scale:i,snap:a}=n,o=Wh(t,e.node()),s=i.x.invert(o[0]),c=i.y.invert(o[1]);r({x:a.x(s),y:a.y(c)})};componentDidMount(){let e=Hh(this.g);e.on(`mousemove`,this.mouseMove.bind(this,e)),this.measureTitleHeight(),this.setupVisibilityObserver()}componentWillUnmount(){Hh(this.g).on(`mousemove`,null),this.cleanupVisibilityObserver()}componentDidUpdate(e){e.title!==this.props.title&&this.measureTitleHeight()}onChangeLabel=(e,t)=>{let{labels:n,onChangeLabels:r,isChart:i}=this.props;if(r){if(i){r(t===`left`?`range`:`domain`,e);return}r({...n,[t]:e})}};measureTitleHeight=()=>{let e=this.titleRef;if(e){let t=e.clientHeight;this.setState({titleHeight:t,prevTitle:this.props.title}),!this.resizeObserver&&typeof ResizeObserver<`u`&&this.setupVisibilityObserver()}};handleKeyDown=()=>{setTimeout(()=>{this.measureTitleHeight()},0)};setupVisibilityObserver=()=>{typeof ResizeObserver<`u`&&this.titleRef&&(this.resizeObserver=new ResizeObserver(e=>{for(let t of e){let{width:e,height:n}=t.contentRect;if(e>0&&n>0){setTimeout(()=>{this.measureTitleHeight()},10);break}}}),this.resizeObserver.observe(this.titleRef))};cleanupVisibilityObserver=()=>{this.resizeObserver&&=(this.resizeObserver.disconnect(),null)};render(){let{disabledTitle:e,disabledLabels:t,labels:n,labelsPlaceholders:r,titlePlaceholder:i,graphProps:a,children:o,defineChart:s,onChangeTitle:c,isChart:l,showLabels:u,showPixelGuides:d,showTitle:f,title:p,rootRef:m,mathMlOptions:h={},labelsCharactersLimit:g}=this.props,{size:{width:_=500,height:v=500},domain:y,range:b}=a,x=N$(j$(n?.left))&&M$(r)?48:70,S=N$(j$(n?.right))&&M$(r)?48:70,C=_+x+S+(y.padding||0)*2,w=v+80+(b.padding||0)*2,T=[`bold`,`italic`,`underline`,`superscript`,`subscript`,`strikethrough`,`math`],E=s&&d?v-160:v,D=parseInt(_/100),O=parseInt(E/100),k=parseInt(E%100),{titleHeight:A}=this.state;return(0,F.jsxs)(Z$,{children:[d&&(0,F.jsx)(i1,{style:{marginLeft:l?80:u?30:10},children:[...Array(D+1).keys()].map(e=>(0,F.jsx)(K$,{false:!0,children:(0,F.jsxs)(a1,{children:[(0,F.jsxs)(`div`,{children:[e*100,`px`]}),(0,F.jsx)(`div`,{children:`|`})]})},`top-guide-${e}`))}),f&&(e?(0,F.jsx)(`div`,{ref:e=>this.titleRef=e,style:{...l&&{width:C},...N$(j$(p))&&{display:`none`}},children:l?(0,F.jsx)(r1,{className:`disabledTitle`,dangerouslySetInnerHTML:{__html:p||``}}):(0,F.jsx)(n1,{className:`disabledTitle`,dangerouslySetInnerHTML:{__html:p||``}})}):(0,F.jsx)(`div`,{ref:e=>this.titleRef=e,children:l?(0,F.jsx)(r1,{className:d?`rightMargin`:``,children:(0,F.jsx)(p$,{...l&&{width:C},markup:p||``,onChange:c,placeholder:s&&i||!e&&`Click here to add a title for this graph`,toolbarOpts:{noPadding:!0,noBorder:!0},activePlugins:T,disableScrollbar:!0,onKeyDown:this.handleKeyDown})}):(0,F.jsx)(n1,{className:d?`rightMargin`:``,children:(0,F.jsx)(p$,{...l&&{width:C},markup:p||``,onChange:c,placeholder:s&&i||!e&&`Click here to add a title for this graph`,toolbarOpts:{noPadding:!0,noBorder:!0},activePlugins:T,disableScrollbar:!0,onKeyDown:this.handleKeyDown})})})),u&&!l&&(0,F.jsx)(U$,{side:`top`,text:n.top,disabledLabel:t,placeholder:r?.top,graphHeight:w,graphWidth:C,onChange:e=>this.onChangeLabel(e,`top`),mathMlOptions:h,preventNewLines:!0,charactersLimit:g}),(0,F.jsxs)(Q$,{children:[u&&(0,F.jsx)(U$,{side:`left`,text:n.left,disabledLabel:t,placeholder:r?.left,graphHeight:w,graphWidth:C,isChartLeftLabel:l&&!s,isDefineChartLeftLabel:l&&s,onChange:e=>this.onChangeLabel(e,`left`),mathMlOptions:h,preventNewLines:!0,charactersLimit:g}),s?(0,F.jsx)($$,{width:C,height:w,children:(0,F.jsx)(t1,{ref:e=>{this.g=e,m&&m(e)},transform:`translate(${x+(y.padding||0)}, ${40+(b.padding||0)})`,children:o})}):(0,F.jsx)(e1,{width:C,height:w,children:(0,F.jsx)(t1,{ref:e=>{this.g=e,m&&m(e)},transform:`translate(${x+(y.padding||0)}, ${40+(b.padding||0)})`,children:o})}),u&&!l&&(0,F.jsx)(U$,{side:`right`,text:n.right,disabledLabel:t,placeholder:r?.right,graphHeight:w,graphWidth:C,onChange:e=>this.onChangeLabel(e,`right`),mathMlOptions:h,preventNewLines:!0,charactersLimit:g}),d&&(0,F.jsx)(o1,{style:{paddingTop:k,marginTop:31},children:[...Array(O+1).keys()].reverse().map(e=>(0,F.jsx)(K$,{false:!0,children:(0,F.jsxs)(s1,{children:[`━ `,e*100,`px`]})},`top-guide-${e}`))})]}),u&&(0,F.jsx)(U$,{side:`bottom`,text:n.bottom,disabledLabel:t,placeholder:r?.bottom,graphHeight:w,graphWidth:C,titleHeight:A,isChartBottomLabel:l&&!s,isDefineChartBottomLabel:l&&s,onChange:e=>this.onChangeLabel(e,`bottom`),mathMlOptions:h,preventNewLines:!0,charactersLimit:g})]})}};function l1(e,t){for(let n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]}function u1(e){return typeof e==`function`||Object.prototype.toString.call(e)===`[object Function]`}function d1(e){return typeof e==`number`&&!isNaN(e)}function f1(e){return parseInt(e,10)}function p1(e,t,n){if(e[t])return Error(`Invalid prop ${t} passed to ${n} - do not set this, set it on the child.`)}var m1=[`Moz`,`Webkit`,`O`,`ms`];function h1(e=`transform`){if(typeof window>`u`)return``;let t=window.document?.documentElement?.style;if(!t||e in t)return``;for(let n=0;n<m1.length;n++)if(g1(e,m1[n])in t)return m1[n];return``}function g1(e,t){return t?`${t}${_1(e)}`:e}function _1(e){let t=``,n=!0;for(let r=0;r<e.length;r++)n?(t+=e[r].toUpperCase(),n=!1):e[r]===`-`?n=!0:t+=e[r];return t}var v1=h1(),y1=``;function b1(e,t){y1||=l1([`matches`,`webkitMatchesSelector`,`mozMatchesSelector`,`msMatchesSelector`,`oMatchesSelector`],function(t){return u1(e[t])})??``;let n=e[y1];return u1(n)?!!n.call(e,t):!1}function x1(e,t,n){let r=e;do{if(b1(r,t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1}function S1(e,t,n,r){if(!e)return;let i={capture:!0,...r},a=n;e.addEventListener?e.addEventListener(t,a,i):e.attachEvent?e.attachEvent(`on`+t,a):e[`on`+t]=a}function C1(e,t,n,r){if(!e)return;let i={capture:!0,...r},a=n;e.removeEventListener?e.removeEventListener(t,a,i):e.detachEvent?e.detachEvent(`on`+t,a):e[`on`+t]=null}function w1(e){let t=e.clientHeight,n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=f1(n.borderTopWidth),t+=f1(n.borderBottomWidth),t}function T1(e){let t=e.clientWidth,n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=f1(n.borderLeftWidth),t+=f1(n.borderRightWidth),t}function E1(e){let t=e.clientHeight,n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=f1(n.paddingTop),t-=f1(n.paddingBottom),t}function D1(e){let t=e.clientWidth,n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=f1(n.paddingLeft),t-=f1(n.paddingRight),t}function O1(e,t,n){let r=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect();return{x:(e.clientX+t.scrollLeft-r.left)/n,y:(e.clientY+t.scrollTop-r.top)/n}}function k1(e,t){let n=j1(e,t,`px`);return{[g1(`transform`,v1)]:n}}function A1(e,t){return j1(e,t,``)}function j1({x:e,y:t},n,r){let i=`translate(${e}${r},${t}${r})`;return n&&(i=`translate(${`${typeof n.x==`string`?n.x:n.x+r}`}, ${`${typeof n.y==`string`?n.y:n.y+r}`})`+i),i}function M1(e,t){return e.targetTouches&&l1(e.targetTouches,e=>t===e.identifier)||e.changedTouches&&l1(e.changedTouches,e=>t===e.identifier)}function N1(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function P1(){return typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0}function F1(e,t){if(!e)return;let n=e.getElementById(`react-draggable-style-el`);if(!n){n=e.createElement(`style`),n.type=`text/css`,n.id=`react-draggable-style-el`;let r=t??P1();r&&n.setAttribute(`nonce`,r),n.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
|
|
358
358
|
`,n.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
|
|
359
|
-
`,e.getElementsByTagName(`head`)[0].appendChild(n)}e.body&&B1(e.body,`react-draggable-transparent-selection`)}function R1(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{z1(e)}):z1(e)}function z1(e){if(e)try{e.body&&V1(e.body,`react-draggable-transparent-selection`);let t=e.selection;if(t)t.empty();else{let t=(e.defaultView||window).getSelection();t&&t.type!==`Caret`&&t.removeAllRanges()}}catch{}}function B1(e,t){e.classList?e.classList.add(t):e.className.match(RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function V1(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(RegExp(`(?:^|\\s)${t}(?!\\S)`,`g`),``)}function H1(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r==`string`?r:Y1(r);let i=X1(e);if(typeof r==`string`){let{ownerDocument:e}=i,t=e.defaultView;if(!t)throw Error(`Cannot resolve the owner window of the draggable node.`);let n;if(n=r===`parent`?i.parentNode:i.getRootNode().querySelector(r),!(n instanceof t.HTMLElement))throw Error(`Bounds selector "`+r+`" could not find an element.`);let a=n,o=t.getComputedStyle(i),s=t.getComputedStyle(a);r={left:-i.offsetLeft+m1(s.paddingLeft)+m1(o.marginLeft),top:-i.offsetTop+m1(s.paddingTop)+m1(o.marginTop),right:k1(a)-D1(i)-i.offsetLeft+m1(s.paddingRight)-m1(o.marginRight),bottom:O1(a)-E1(i)-i.offsetTop+m1(s.paddingBottom)-m1(o.marginBottom)}}return p1(r.right)&&(t=Math.min(t,r.right)),p1(r.bottom)&&(n=Math.min(n,r.bottom)),p1(r.left)&&(t=Math.max(t,r.left)),p1(r.top)&&(n=Math.max(n,r.top)),[t,n]}function U1(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function W1(e){return e.props.axis===`both`||e.props.axis===`x`}function G1(e){return e.props.axis===`both`||e.props.axis===`y`}function K1(e,t,n){let r=typeof t==`number`?P1(e,t):null;if(typeof t==`number`&&!r)return null;let i=X1(n),a=n.props.offsetParent||i.offsetParent||i.ownerDocument.body;return A1(r||e,a,n.props.scale)}function q1(e,t,n){let r=!p1(e.lastX),i=X1(e);return r?{node:i,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:i,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function J1(e,t){let n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function Y1(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function X1(e){let t=e.findDOMNode();if(!t)throw Error(`<DraggableCore>: Unmounted during event!`);return t}var Z1=typeof process<`u`&&process.env.DRAGGABLE_DEBUG?console.log.bind(console):function(){},Q1={touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`},mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`}},$1=Q1.mouse,e0=class extends P.Component{constructor(){super(...arguments),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,this.touchIdentifier=null,this.mounted=!1,this.handleDragStart=e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&(typeof e.button==`number`&&e.button!==0||e.ctrlKey))return!1;let t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw Error(`<DraggableCore> not mounted on DragStart!`);let{ownerDocument:n}=t;if(this.props.disabled||!(e.target instanceof n.defaultView.Node)||this.props.handle&&!C1(e.target,this.props.handle,t)||this.props.cancel&&C1(e.target,this.props.cancel,t))return;e.type===`touchstart`&&!this.props.allowMobileScroll&&e.preventDefault();let r=F1(e);this.touchIdentifier=r;let i=K1(e,r,this);if(i==null)return;let{x:a,y:o}=i,s=q1(this,a,o);Z1(`DraggableCore: handleDragStart: %j`,s),Z1(`calling`,this.props.onStart),!(this.props.onStart(e,s)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&L1(n,this.props.nonce),this.dragging=!0,this.lastX=a,this.lastY=o,w1(n,$1.move,this.handleDrag),w1(n,$1.stop,this.handleDragStop))},this.handleDrag=e=>{let t=K1(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX,t=r-this.lastY;if([e,t]=U1(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=q1(this,n,r);if(Z1(`DraggableCore: handleDrag: %j`,i),this.props.onDrag(e,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent(`mouseup`))}catch{let e=document.createEvent(`MouseEvents`);e.initMouseEvent(`mouseup`,!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(e)}return}this.lastX=n,this.lastY=r},this.handleDragStop=e=>{if(!this.dragging)return;let t=K1(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX||0,t=r-this.lastY||0;[e,t]=U1(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let i=q1(this,n,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;let a=this.findDOMNode();a&&this.props.enableUserSelectHack&&R1(a.ownerDocument),Z1(`DraggableCore: handleDragStop: %j`,i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&(Z1(`DraggableCore: Removing handlers`),T1(a.ownerDocument,$1.move,this.handleDrag),T1(a.ownerDocument,$1.stop,this.handleDragStop))},this.onMouseDown=e=>($1=Q1.mouse,this.handleDragStart(e)),this.onMouseUp=e=>($1=Q1.mouse,this.handleDragStop(e)),this.onTouchStart=e=>($1=Q1.touch,this.handleDragStart(e)),this.onTouchEnd=e=>($1=Q1.touch,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&w1(e,Q1.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;T1(t,Q1.mouse.move,this.handleDrag),T1(t,Q1.touch.move,this.handleDrag),T1(t,Q1.mouse.stop,this.handleDragStop),T1(t,Q1.touch.stop,this.handleDragStop),T1(e,Q1.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&R1(t)}}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=Ms.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):(Z1(`react-draggable: ReactDOM.findDOMNode is not available in React 19+. You must provide a nodeRef prop. See: https://github.com/react-grid-layout/react-draggable#noderef`),null)}render(){return P.cloneElement(P.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};e0.displayName=`DraggableCore`,e0.propTypes={allowAnyClick:v.bool,allowMobileScroll:v.bool,children:v.node.isRequired,disabled:v.bool,enableUserSelectHack:v.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:v.arrayOf(v.number),handle:v.string,cancel:v.string,nodeRef:v.object,nonce:v.string,onStart:v.func,onDrag:v.func,onStop:v.func,onMouseDown:v.func,scale:v.number,className:h1,style:h1,transform:h1},e0.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var t0=class extends P.Component{constructor(e){super(e),this.onDragStart=(e,t)=>{if(Z1(`Draggable: onDragStart: %j`,t),this.props.onStart(e,J1(this,t))===!1)return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(e,t)=>{if(!this.state.dragging)return!1;Z1(`Draggable: onDrag: %j`,t);let n=J1(this,t),r={x:n.x,y:n.y,slackX:0,slackY:0};if(this.props.bounds){let{x:e,y:t}=r;r.x+=this.state.slackX,r.y+=this.state.slackY;let[i,a]=H1(this,r.x,r.y);r.x=i,r.y=a,r.slackX=this.state.slackX+(e-r.x),r.slackY=this.state.slackY+(t-r.y),n.x=r.x,n.y=r.y,n.deltaX=r.x-this.state.x,n.deltaY=r.y-this.state.y}if(this.props.onDrag(e,n)===!1)return!1;this.setState(r)},this.onDragStop=(e,t)=>{if(!this.state.dragging||this.props.onStop(e,J1(this,t))===!1)return!1;Z1(`Draggable: onDragStop: %j`,t);let n={dragging:!1,slackX:0,slackY:0};if(this.props.position){let{x:e,y:t}=this.props.position;n.x=e,n.y=t}this.setState(n)},this.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:{...e.position},slackX:0,slackY:0,isElementSVG:!1},e.position&&!(e.onDrag||e.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}static getDerivedStateFromProps({position:e},{prevPropsPosition:t}){return e&&(!t||e.x!==t.x||e.y!==t.y)?(Z1(`Draggable: getDerivedStateFromProps %j`,{position:e,prevPropsPosition:t}),{x:e.x,y:e.y,prevPropsPosition:{...e}}):null}componentDidMount(){window.SVGElement!==void 0&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=Ms.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):null}render(){let{axis:e,bounds:t,children:n,defaultPosition:r,defaultClassName:i,defaultClassNameDragging:a,defaultClassNameDragged:o,position:s,positionOffset:c,scale:l,...u}=this.props,d={},f=null,p=!s||this.state.dragging,m=s||r,h={x:W1(this)&&p?this.state.x:m.x,y:G1(this)&&p?this.state.y:m.y};this.state.isElementSVG?f=M1(h,c):d=j1(h,c);let g=P.Children.only(n),_=I(g.props.className||``,i,{[a]:this.state.dragging,[o]:this.state.dragged});return P.createElement(e0,{...u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},P.cloneElement(g,{className:_,style:{...g.props.style,...d},transform:f}))}};t0.displayName=`Draggable`,t0.propTypes={...e0.propTypes,axis:v.oneOf([`both`,`x`,`y`,`none`]),bounds:v.oneOfType([v.shape({left:v.number,right:v.number,top:v.number,bottom:v.number}),v.string,v.oneOf([!1])]),defaultClassName:v.string,defaultClassNameDragging:v.string,defaultClassNameDragged:v.string,defaultPosition:v.shape({x:v.number,y:v.number}),positionOffset:v.shape({x:v.oneOfType([v.number,v.string]),y:v.oneOfType([v.number,v.string])}),position:v.shape({x:v.number,y:v.number}),className:h1,style:h1,transform:h1},t0.defaultProps={...e0.defaultProps,axis:`both`,bounds:!1,defaultClassName:`react-draggable`,defaultClassNameDragging:`react-draggable-dragging`,defaultClassNameDragged:`react-draggable-dragged`,defaultPosition:{x:0,y:0},scale:1};var n0=Uu(`pie-lib:plot:grid-draggable`),r0=(e,t,n)=>r=>{let i=r+e(0);return t(n+e.invert(i)).toFixed(4)*1e3/1e3},i0=e=>t=>((0,D$.default)(!!e&&Bp(e.fromDelta)&&Bp(e.bounds)&&Bp(e.anchorPoint),`You must supply an object with: { anchorPoint: Function, fromDelta: Function, bounds: Function }`),class extends P.Component{static propTypes={disabled:v.bool,onDragStart:v.func,onDrag:v.func,onDragStop:v.func,onClick:v.func,onMove:v.func,graphProps:C$.isRequired};constructor(e){super(e),this.state={startX:null,startY:null}}grid=()=>{let{graphProps:e}=this.props,{scale:t,domain:n,range:r}=e;return{x:t.x(n.step)-t.x(0),y:t.y(r.step)-t.y(0)}};onStart=e=>{let{onDragStart:t}=this.props;document.activeElement&&document.activeElement.blur(),this._didDrag=!1,this.setState({startX:e.clientX,startY:e.clientY});let n=e.target,r=e=>{n.removeEventListener(`click`,r,!0),this._didDrag&&(e.stopPropagation(),e.preventDefault())};n.addEventListener(`click`,r,!0),t&&t()};position=()=>{let{x:t,y:n}=e.anchorPoint(this.props),{graphProps:r}=this.props,{scale:i,snap:a}=r;return{anchorPoint:{x:t,y:n},x:r0(i.x,a.x,t),y:r0(i.y,a.y,n)}};tiny=(e,t)=>{let n=e.toUpperCase(),r=Math.abs(t[`client${n}`]-this.state[`start${n}`]),i=r<Math.abs(this.grid()[e])/10;return n0(`[tiny] key: `,e,`delta: `,r,`out: `,i),i};getScaledBounds=()=>{let t=e.bounds(this.props,this.props.graphProps);n0(`bounds: `,t);let n=this.grid(),r={left:t.left*n.x,right:t.right*n.x,top:t.top*n.y,bottom:t.bottom*n.y},i=Math.abs(n.y);return r={...r,top:Math.min(0,r.top)-i,bottom:Math.abs(r.bottom)+i},n0(`[getScaledBounds]: `,r),r};getClientPoint=(e,t)=>{if(!e||!t)return null;let n=e.ownerSVGElement||e;if(n&&n.createSVGPoint){let r=n.createSVGPoint();if(t.touches&&t.touches.length>0){let e=t.touches[0];r.x=e.clientX,r.y=e.clientY}else r.x=t.clientX,r.y=t.clientY;return e.getScreenCTM?(r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]):null}let r=e.getBoundingClientRect();return r?[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]:null};skipDragOutsideOfBounds=(e,t,n)=>{let r=n.getRootNode(),i=this.getClientPoint(r,t);if(i===null)return!0;let[a,o]=i,{scale:s,domain:c,range:l}=n,u=s.x.invert(a),d=s.y.invert(o),f=e.deltaX>0&&u<c.min||e.deltaX<0&&u>c.max,p=e.deltaY>0&&d>l.max||e.deltaY<0&&d<l.min;return f||p};onDrag=(e,t)=>{let{onDrag:n,graphProps:r,disabled:i}=this.props;if((Math.abs(t.deltaX)>1||Math.abs(t.deltaY)>1)&&(this._didDrag=!0),!n||i)return;let a=this.getScaledBounds();if(t.deltaX<0&&t.deltaX<a.left||t.deltaX>0&&t.deltaX>a.right||t.deltaY<0&&t.deltaY<a.top||t.deltaY>0&&t.deltaY>a.bottom||this.skipDragOutsideOfBounds(t,e,r))return;let o=this.applyDelta({x:t.deltaX,y:t.deltaY});(o!==void 0||o!==null)&&n(o)};getDelta=e=>{let t=this.position(),n={x:t.x(e.x),y:t.y(e.y)};return M$(t.anchorPoint,n)};applyDelta=t=>{let n=this.getDelta(t);return n0(`[applyDelta] delta:`,n),e.fromDelta(this.props,n)};onStop=(e,t)=>{n0(`[onStop] dd:`,t);let{onDragStop:n,onClick:r,disabled:i}=this.props;if(n&&!i&&n(),n0(`[onStop] lastX/Y: `,t.lastX,t.lastY),!this._didDrag){if(!i&&typeof e?.stopPropagation==`function`&&e.stopPropagation(),r){n0(`call onClick`),this.setState({startX:null,startY:null});let{graphProps:t}=this.props,{scale:n,snap:i}=t;try{let[t,a]=Wh(e,e.target),o=n.x.invert(t),s=n.y.invert(a);o=i.x(o),s=i.y(s),r({x:o,y:s})}catch{r({})}}this.setState({startX:null,startY:null});return}this.setState({startX:null,startY:null})};render(){let{disabled:n,onClick:r,...i}=this.props,a=this.grid(),o=e=>e.nativeEvent.preventDefault(),s=this.state?!!this.state.startX:!1;return(0,F.jsx)(e0,{onMouseDown:o,onStart:this.onStart,onDrag:this.onDrag,onStop:this.onStop,axis:e.axis||`both`,grid:[a.x,a.y],children:(0,F.jsx)(t,{...i,disabled:n,isDragging:s,onClick:s?void 0:r})})}});function a0(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function o0(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function s0(e){let t,n,r;e.length===2?(t=e===a0||e===o0?e:c0,n=e,r=e):(t=a0,n=(t,n)=>a0(e(t),n),r=(t,n)=>e(t)-n);function i(e,r,i=0,a=e.length){if(i<a){if(t(r,r)!==0)return a;do{let t=i+a>>>1;n(e[t],r)<0?i=t+1:a=t}while(i<a)}return i}function a(e,r,i=0,a=e.length){if(i<a){if(t(r,r)!==0)return a;do{let t=i+a>>>1;n(e[t],r)<=0?i=t+1:a=t}while(i<a)}return i}function o(e,t,n=0,a=e.length){let o=i(e,t,n,a-1);return o>n&&r(e[o-1],t)>-r(e[o],t)?o-1:o}return{left:i,center:o,right:a}}function c0(){return 0}function l0(e){return e===null?NaN:+e}var u0=s0(a0),d0=u0.right;u0.left,s0(l0).center;var f0=class extends Map{constructor(e,t=g0){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),e!=null)for(let[t,n]of e)this.set(t,n)}get(e){return super.get(p0(this,e))}has(e){return super.has(p0(this,e))}set(e,t){return super.set(m0(this,e),t)}delete(e){return super.delete(h0(this,e))}};function p0({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function m0({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function h0({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function g0(e){return typeof e==`object`&&e?e.valueOf():e}var _0=Math.sqrt(50),v0=Math.sqrt(10),y0=Math.sqrt(2);function b0(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=_0?10:a>=v0?5:a>=y0?2:1,s,c,l;return i<0?(l=10**-i/o,s=Math.round(e*l),c=Math.round(t*l),s/l<e&&++s,c/l>t&&--c,l=-l):(l=10**i*o,s=Math.round(e/l),c=Math.round(t/l),s*l<e&&++s,c*l>t&&--c),c<s&&.5<=n&&n<2?b0(e,t,n*2):[s,c,l]}function x0(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];let r=t<e,[i,a,o]=r?b0(t,e,n):b0(e,t,n);if(!(a>=i))return[];let s=a-i+1,c=Array(s);if(r)if(o<0)for(let e=0;e<s;++e)c[e]=(a-e)/-o;else for(let e=0;e<s;++e)c[e]=(a-e)*o;else if(o<0)for(let e=0;e<s;++e)c[e]=(i+e)/-o;else for(let e=0;e<s;++e)c[e]=(i+e)*o;return c}function S0(e,t,n){return t=+t,e=+e,n=+n,b0(e,t,n)[2]}function C0(e,t,n){t=+t,e=+e,n=+n;let r=t<e,i=r?S0(t,e,n):S0(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function w0(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++r<i;)a[r]=e+r*n;return a}function T0(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}var E0=Symbol(`implicit`);function D0(){var e=new f0,t=[],n=[],r=E0;function i(i){let a=e.get(i);if(a===void 0){if(r!==E0)return r;e.set(i,a=t.push(i)-1)}return n[a%n.length]}return i.domain=function(n){if(!arguments.length)return t.slice();t=[],e=new f0;for(let r of n)e.has(r)||e.set(r,t.push(r)-1);return i},i.range=function(e){return arguments.length?(n=Array.from(e),i):n.slice()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return D0(t,n).unknown(r)},T0.apply(i,arguments),i}function O0(){var e=D0().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,a,o,s=!1,c=0,l=0,u=.5;delete e.unknown;function d(){var e=t().length,d=i<r,f=d?i:r,p=d?r:i;a=(p-f)/Math.max(1,e-c+l*2),s&&(a=Math.floor(a)),f+=(p-f-a*(e-c))*u,o=a*(1-c),s&&(f=Math.round(f),o=Math.round(o));var m=w0(e).map(function(e){return f+a*e});return n(d?m.reverse():m)}return e.domain=function(e){return arguments.length?(t(e),d()):t()},e.range=function(e){return arguments.length?([r,i]=e,r=+r,i=+i,d()):[r,i]},e.rangeRound=function(e){return[r,i]=e,r=+r,i=+i,s=!0,d()},e.bandwidth=function(){return o},e.step=function(){return a},e.round=function(e){return arguments.length?(s=!!e,d()):s},e.padding=function(e){return arguments.length?(c=Math.min(1,l=+e),d()):c},e.paddingInner=function(e){return arguments.length?(c=Math.min(1,e),d()):c},e.paddingOuter=function(e){return arguments.length?(l=+e,d()):l},e.align=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),d()):u},e.copy=function(){return O0(t(),[r,i]).round(s).paddingInner(c).paddingOuter(l).align(u)},T0.apply(d(),arguments)}function k0(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return k0(t())},e}function A0(){return k0(O0.apply(null,arguments).paddingInner(1))}function j0(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function M0(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function N0(){}var P0=.7,F0=1/P0,I0=`\\s*([+-]?\\d+)\\s*`,L0=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,R0=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,z0=/^#([0-9a-f]{3,8})$/,B0=RegExp(`^rgb\\(${I0},${I0},${I0}\\)$`),V0=RegExp(`^rgb\\(${R0},${R0},${R0}\\)$`),H0=RegExp(`^rgba\\(${I0},${I0},${I0},${L0}\\)$`),U0=RegExp(`^rgba\\(${R0},${R0},${R0},${L0}\\)$`),W0=RegExp(`^hsl\\(${L0},${R0},${R0}\\)$`),G0=RegExp(`^hsla\\(${L0},${R0},${R0},${L0}\\)$`),K0={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};j0(N0,Z0,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:q0,formatHex:q0,formatHex8:J0,formatHsl:Y0,formatRgb:X0,toString:X0});function q0(){return this.rgb().formatHex()}function J0(){return this.rgb().formatHex8()}function Y0(){return u2(this).formatHsl()}function X0(){return this.rgb().formatRgb()}function Z0(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=z0.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Q0(t):n===3?new n2(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?$0(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?$0(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=B0.exec(e))?new n2(t[1],t[2],t[3],1):(t=V0.exec(e))?new n2(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=H0.exec(e))?$0(t[1],t[2],t[3],t[4]):(t=U0.exec(e))?$0(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=W0.exec(e))?l2(t[1],t[2]/100,t[3]/100,1):(t=G0.exec(e))?l2(t[1],t[2]/100,t[3]/100,t[4]):K0.hasOwnProperty(e)?Q0(K0[e]):e===`transparent`?new n2(NaN,NaN,NaN,0):null}function Q0(e){return new n2(e>>16&255,e>>8&255,e&255,1)}function $0(e,t,n,r){return r<=0&&(e=t=n=NaN),new n2(e,t,n,r)}function e2(e){return e instanceof N0||(e=Z0(e)),e?(e=e.rgb(),new n2(e.r,e.g,e.b,e.opacity)):new n2}function t2(e,t,n,r){return arguments.length===1?e2(e):new n2(e,t,n,r??1)}function n2(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}j0(n2,t2,M0(N0,{brighter(e){return e=e==null?F0:F0**+e,new n2(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?P0:P0**+e,new n2(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new n2(s2(this.r),s2(this.g),s2(this.b),o2(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:r2,formatHex:r2,formatHex8:i2,formatRgb:a2,toString:a2}));function r2(){return`#${c2(this.r)}${c2(this.g)}${c2(this.b)}`}function i2(){return`#${c2(this.r)}${c2(this.g)}${c2(this.b)}${c2((isNaN(this.opacity)?1:this.opacity)*255)}`}function a2(){let e=o2(this.opacity);return`${e===1?`rgb(`:`rgba(`}${s2(this.r)}, ${s2(this.g)}, ${s2(this.b)}${e===1?`)`:`, ${e})`}`}function o2(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function s2(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function c2(e){return e=s2(e),(e<16?`0`:``)+e.toString(16)}function l2(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new f2(e,t,n,r)}function u2(e){if(e instanceof f2)return new f2(e.h,e.s,e.l,e.opacity);if(e instanceof N0||(e=Z0(e)),!e)return new f2;if(e instanceof f2)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new f2(o,s,c,e.opacity)}function d2(e,t,n,r){return arguments.length===1?u2(e):new f2(e,t,n,r??1)}function f2(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}j0(f2,d2,M0(N0,{brighter(e){return e=e==null?F0:F0**+e,new f2(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?P0:P0**+e,new f2(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new n2(h2(e>=240?e-240:e+120,i,r),h2(e,i,r),h2(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new f2(p2(this.h),m2(this.s),m2(this.l),o2(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=o2(this.opacity);return`${e===1?`hsl(`:`hsla(`}${p2(this.h)}, ${m2(this.s)*100}%, ${m2(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function p2(e){return e=(e||0)%360,e<0?e+360:e}function m2(e){return Math.max(0,Math.min(1,e||0))}function h2(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var g2=Math.PI/180,_2=180/Math.PI,v2=18,y2=.96422,b2=1,x2=.82521,S2=4/29,C2=6/29,w2=3*C2*C2,T2=C2*C2*C2;function E2(e){if(e instanceof O2)return new O2(e.l,e.a,e.b,e.opacity);if(e instanceof F2)return I2(e);e instanceof n2||(e=e2(e));var t=M2(e.r),n=M2(e.g),r=M2(e.b),i=k2((.2225045*t+.7168786*n+.0606169*r)/b2),a,o;return t===n&&n===r?a=o=i:(a=k2((.4360747*t+.3850649*n+.1430804*r)/y2),o=k2((.0139322*t+.0971045*n+.7141733*r)/x2)),new O2(116*i-16,500*(a-i),200*(i-o),e.opacity)}function D2(e,t,n,r){return arguments.length===1?E2(e):new O2(e,t,n,r??1)}function O2(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}j0(O2,D2,M0(N0,{brighter(e){return new O2(this.l+v2*(e??1),this.a,this.b,this.opacity)},darker(e){return new O2(this.l-v2*(e??1),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,n=isNaN(this.b)?e:e-this.b/200;return t=y2*A2(t),e=b2*A2(e),n=x2*A2(n),new n2(j2(3.1338561*t-1.6168667*e-.4906146*n),j2(-.9787684*t+1.9161415*e+.033454*n),j2(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}}));function k2(e){return e>T2?e**(1/3):e/w2+S2}function A2(e){return e>C2?e*e*e:w2*(e-S2)}function j2(e){return 255*(e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055)}function M2(e){return(e/=255)<=.04045?e/12.92:((e+.055)/1.055)**2.4}function N2(e){if(e instanceof F2)return new F2(e.h,e.c,e.l,e.opacity);if(e instanceof O2||(e=E2(e)),e.a===0&&e.b===0)return new F2(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*_2;return new F2(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function P2(e,t,n,r){return arguments.length===1?N2(e):new F2(e,t,n,r??1)}function F2(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}function I2(e){if(isNaN(e.h))return new O2(e.l,0,0,e.opacity);var t=e.h*g2;return new O2(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}j0(F2,P2,M0(N0,{brighter(e){return new F2(this.h,this.c,this.l+v2*(e??1),this.opacity)},darker(e){return new F2(this.h,this.c,this.l-v2*(e??1),this.opacity)},rgb(){return I2(this).rgb()}}));var L2=-.14861,R2=1.78277,z2=-.29227,B2=-.90649,V2=1.97294,H2=V2*B2,U2=V2*R2,W2=R2*z2-B2*L2;function G2(e){if(e instanceof q2)return new q2(e.h,e.s,e.l,e.opacity);e instanceof n2||(e=e2(e));var t=e.r/255,n=e.g/255,r=e.b/255,i=(W2*r+H2*t-U2*n)/(W2+H2-U2),a=r-i,o=(V2*(n-i)-z2*a)/B2,s=Math.sqrt(o*o+a*a)/(V2*i*(1-i)),c=s?Math.atan2(o,a)*_2-120:NaN;return new q2(c<0?c+360:c,s,i,e.opacity)}function K2(e,t,n,r){return arguments.length===1?G2(e):new q2(e,t,n,r??1)}function q2(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}j0(q2,K2,M0(N0,{brighter(e){return e=e==null?F0:F0**+e,new q2(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?P0:P0**+e,new q2(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*g2,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),i=Math.sin(e);return new n2(255*(t+n*(L2*r+R2*i)),255*(t+n*(z2*r+B2*i)),255*(t+V2*r*n),this.opacity)}}));var J2=e=>()=>e;function Y2(e,t){return function(n){return e+n*t}}function X2(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function Z2(e,t){var n=t-e;return n?Y2(e,n>180||n<-180?n-360*Math.round(n/360):n):J2(isNaN(e)?t:e)}function Q2(e){return(e=+e)==1?$2:function(t,n){return n-t?X2(t,n,e):J2(isNaN(t)?n:t)}}function $2(e,t){var n=t-e;return n?Y2(e,n):J2(isNaN(e)?t:e)}var e4=(function e(t){var n=Q2(t);function r(e,t){var r=n((e=t2(e)).r,(t=t2(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=$2(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function t4(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function n4(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function r4(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o;for(o=0;o<r;++o)i[o]=f4(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function i4(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function a4(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function o4(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=f4(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var s4=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,c4=new RegExp(s4.source,`g`);function l4(e){return function(){return e}}function u4(e){return function(t){return e(t)+``}}function d4(e,t){var n=s4.lastIndex=c4.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=s4.exec(e))&&(i=c4.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:a4(r,i)})),n=c4.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?u4(c[0].x):l4(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function f4(e,t){var n=typeof t,r;return t==null||n===`boolean`?J2(t):(n===`number`?a4:n===`string`?(r=Z0(t))?(t=r,e4):d4:t instanceof Z0?e4:t instanceof Date?i4:n4(t)?t4:Array.isArray(t)?r4:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?o4:a4)(e,t)}function p4(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function m4(e){return function(t,n){var r=e((t=d2(t)).h,(n=d2(n)).h),i=$2(t.s,n.s),a=$2(t.l,n.l),o=$2(t.opacity,n.opacity);return function(e){return t.h=r(e),t.s=i(e),t.l=a(e),t.opacity=o(e),t+``}}}var h4=m4(Z2),g4=m4($2);function _4(e,t){var n=$2((e=D2(e)).l,(t=D2(t)).l),r=$2(e.a,t.a),i=$2(e.b,t.b),a=$2(e.opacity,t.opacity);return function(t){return e.l=n(t),e.a=r(t),e.b=i(t),e.opacity=a(t),e+``}}function v4(e){return function(t,n){var r=e((t=P2(t)).h,(n=P2(n)).h),i=$2(t.c,n.c),a=$2(t.l,n.l),o=$2(t.opacity,n.opacity);return function(e){return t.h=r(e),t.c=i(e),t.l=a(e),t.opacity=o(e),t+``}}}var y4=v4(Z2),b4=v4($2);function x4(e){return(function t(n){n=+n;function r(t,r){var i=e((t=K2(t)).h,(r=K2(r)).h),a=$2(t.s,r.s),o=$2(t.l,r.l),s=$2(t.opacity,r.opacity);return function(e){return t.h=i(e),t.s=a(e),t.l=o(e**+n),t.opacity=s(e),t+``}}return r.gamma=t,r})(1)}var S4=x4(Z2),C4=x4($2);function w4(e){return function(){return e}}function T4(e){return+e}var E4=[0,1];function D4(e){return e}function O4(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:w4(isNaN(t)?NaN:.5)}function k4(e,t){var n;return e>t&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}function A4(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i<r?(r=O4(i,r),a=n(o,a)):(r=O4(r,i),a=n(a,o)),function(e){return a(r(e))}}function j4(e,t,n){var r=Math.min(e.length,t.length)-1,i=Array(r),a=Array(r),o=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<r;)i[o]=O4(e[o],e[o+1]),a[o]=n(t[o],t[o+1]);return function(t){var n=d0(e,t,1,r)-1;return a[n](i[n](t))}}function M4(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function N4(){var e=E4,t=E4,n=f4,r,i,a,o=D4,s,c,l;function u(){var n=Math.min(e.length,t.length);return o!==D4&&(o=k4(e[0],e[n-1])),s=n>2?j4:A4,c=l=null,d}function d(i){return i==null||isNaN(i=+i)?a:(c||=s(e.map(r),t,n))(r(o(i)))}return d.invert=function(n){return o(i((l||=s(t,e.map(r),a4))(n)))},d.domain=function(t){return arguments.length?(e=Array.from(t,T4),u()):e.slice()},d.range=function(e){return arguments.length?(t=Array.from(e),u()):t.slice()},d.rangeRound=function(e){return t=Array.from(e),n=p4,u()},d.clamp=function(e){return arguments.length?(o=e?!0:D4,u()):o!==D4},d.interpolate=function(e){return arguments.length?(n=e,u()):n},d.unknown=function(e){return arguments.length?(a=e,d):a},function(e,t){return r=e,i=t,u()}}function P4(){return N4()(D4,D4)}function F4(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function I4(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf(`e`),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function L4(e){return e=I4(Math.abs(e)),e?e[1]:NaN}function R4(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}function z4(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var B4=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function V4(e){if(!(t=B4.exec(e)))throw Error(`invalid format: `+e);var t;return new H4({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}V4.prototype=H4.prototype;function H4(e){this.fill=e.fill===void 0?` `:e.fill+``,this.align=e.align===void 0?`>`:e.align+``,this.sign=e.sign===void 0?`-`:e.sign+``,this.symbol=e.symbol===void 0?``:e.symbol+``,this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?``:e.type+``}H4.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?`0`:``)+(this.width===void 0?``:Math.max(1,this.width|0))+(this.comma?`,`:``)+(this.precision===void 0?``:`.`+Math.max(0,this.precision|0))+(this.trim?`~`:``)+this.type};function U4(e){out:for(var t=e.length,n=1,r=-1,i;n<t;++n)switch(e[n]){case`.`:r=i=n;break;case`0`:r===0&&(r=n),i=n;break;default:if(!+e[n])break out;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var W4;function G4(e,t){var n=I4(e,t);if(!n)return W4=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(W4=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join(`0`):a>0?r.slice(0,a)+`.`+r.slice(a):`0.`+Array(1-a).join(`0`)+I4(e,Math.max(0,t+a-1))[0]}function K4(e,t){var n=I4(e,t);if(!n)return e+``;var r=n[0],i=n[1];return i<0?`0.`+Array(-i).join(`0`)+r:r.length>i+1?r.slice(0,i+1)+`.`+r.slice(i+1):r+Array(i-r.length+2).join(`0`)}var q4={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:F4,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>K4(e*100,t),r:K4,s:G4,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function J4(e){return e}var Y4=Array.prototype.map,X4=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function Z4(e){var t=e.grouping===void 0||e.thousands===void 0?J4:R4(Y4.call(e.grouping,Number),e.thousands+``),n=e.currency===void 0?``:e.currency[0]+``,r=e.currency===void 0?``:e.currency[1]+``,i=e.decimal===void 0?`.`:e.decimal+``,a=e.numerals===void 0?J4:z4(Y4.call(e.numerals,String)),o=e.percent===void 0?`%`:e.percent+``,s=e.minus===void 0?`−`:e.minus+``,c=e.nan===void 0?`NaN`:e.nan+``;function l(e,l){e=V4(e);var u=e.fill,d=e.align,f=e.sign,p=e.symbol,m=e.zero,h=e.width,g=e.comma,_=e.precision,v=e.trim,y=e.type;y===`n`?(g=!0,y=`g`):q4[y]||(_===void 0&&(_=12),v=!0,y=`g`),(m||u===`0`&&d===`=`)&&(m=!0,u=`0`,d=`=`);var b=(l&&l.prefix!==void 0?l.prefix:``)+(p===`$`?n:p===`#`&&/[boxX]/.test(y)?`0`+y.toLowerCase():``),x=(p===`$`?r:/[%p]/.test(y)?o:``)+(l&&l.suffix!==void 0?l.suffix:``),S=q4[y],C=/[defgprs%]/.test(y);_=_===void 0?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function w(e){var n=b,r=x,o,l,p;if(y===`c`)r=S(e)+r,e=``;else{e=+e;var w=e<0||1/e<0;if(e=isNaN(e)?c:S(Math.abs(e),_),v&&(e=U4(e)),w&&+e==0&&f!==`+`&&(w=!1),n=(w?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&W4!==void 0?X4[8+W4/3]:``)+r+(w&&f===`(`?`)`:``),C){for(o=-1,l=e.length;++o<l;)if(p=e.charCodeAt(o),48>p||p>57){r=(p===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}g&&!m&&(e=t(e,1/0));var T=n.length+e.length+r.length,E=T<h?Array(h-T+1).join(u):``;switch(g&&m&&(e=t(E+e,E.length?h-r.length:1/0),E=``),d){case`<`:e=n+e+r+E;break;case`=`:e=n+E+e+r;break;case`^`:e=E.slice(0,T=E.length>>1)+n+e+r+E.slice(T);break;default:e=E+n+e+r;break}return a(e)}return w.toString=function(){return e+``},w}function u(e,t){var n=Math.max(-8,Math.min(8,Math.floor(L4(t)/3)))*3,r=10**-n,i=l((e=V4(e),e.type=`f`,e),{suffix:X4[8+n/3]});return function(e){return i(r*e)}}return{format:l,formatPrefix:u}}var Q4,$4,e3;t3({thousands:`,`,grouping:[3],currency:[`$`,``]});function t3(e){return Q4=Z4(e),$4=Q4.format,e3=Q4.formatPrefix,Q4}function n3(e){return Math.max(0,-L4(Math.abs(e)))}function r3(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(L4(t)/3)))*3-L4(Math.abs(e)))}function i3(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,L4(t)-L4(e))+1}function a3(e,t,n,r){var i=C0(e,t,n),a;switch(r=V4(r??`,f`),r.type){case`s`:var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=r3(i,o))&&(r.precision=a),e3(r,o);case``:case`e`:case`g`:case`p`:case`r`:r.precision==null&&!isNaN(a=i3(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type===`e`));break;case`f`:case`%`:r.precision==null&&!isNaN(a=n3(i))&&(r.precision=a-(r.type===`%`)*2);break}return $4(r)}function o3(e){var t=e.domain;return e.ticks=function(e){var n=t();return x0(n[0],n[n.length-1],e??10)},e.tickFormat=function(e,n){var r=t();return a3(r[0],r[r.length-1],e??10,n)},e.nice=function(n){n??=10;var r=t(),i=0,a=r.length-1,o=r[i],s=r[a],c,l,u=10;for(s<o&&(l=o,o=s,s=l,l=i,i=a,a=l);u-->0;){if(l=S0(o,s,n),l===c)return r[i]=o,r[a]=s,t(r);if(l>0)o=Math.floor(o/l)*l,s=Math.ceil(s/l)*l;else if(l<0)o=Math.ceil(o*l)/l,s=Math.floor(s*l)/l;else break;c=l}return e},e}function s3(){var e=P4();return e.copy=function(){return M4(e,s3())},T0.apply(e,arguments),o3(e)}var c3=new Date,l3=new Date;function u3(e,t,n,r){function i(t){return e(t=arguments.length===0?new Date:new Date(+t)),t}return i.floor=t=>(e(t=new Date(+t)),t),i.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),i.round=e=>{let t=i(e),n=i.ceil(e);return e-t<n-e?t:n},i.offset=(e,n)=>(t(e=new Date(+e),n==null?1:Math.floor(n)),e),i.range=(n,r,a)=>{let o=[];if(n=i.ceil(n),a=a==null?1:Math.floor(a),!(n<r)||!(a>0))return o;let s;do o.push(s=new Date(+n)),t(n,a),e(n);while(s<n&&n<r);return o},i.filter=n=>u3(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,r)=>{if(e>=e)if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}),n&&(i.count=(t,r)=>(c3.setTime(+t),l3.setTime(+r),e(c3),e(l3),Math.floor(n(c3,l3))),i.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?i.filter(r?t=>r(t)%e===0:t=>i.count(0,t)%e===0):i)),i}var d3=1e3,f3=d3*60,p3=f3*60,m3=p3*24,h3=m3*7;m3*30,m3*365;var g3=u3(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*d3)},(e,t)=>(t-e)/d3,e=>e.getUTCSeconds());g3.range;var _3=u3(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*d3)},(e,t)=>{e.setTime(+e+t*f3)},(e,t)=>(t-e)/f3,e=>e.getMinutes());_3.range;var v3=u3(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*f3)},(e,t)=>(t-e)/f3,e=>e.getUTCMinutes());v3.range;var y3=u3(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*d3-e.getMinutes()*f3)},(e,t)=>{e.setTime(+e+t*p3)},(e,t)=>(t-e)/p3,e=>e.getHours());y3.range;var b3=u3(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*p3)},(e,t)=>(t-e)/p3,e=>e.getUTCHours());b3.range;var x3=u3(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*f3)/m3,e=>e.getDate()-1);x3.range;var S3=u3(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/m3,e=>e.getUTCDate()-1);S3.range,u3(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/m3,e=>Math.floor(e/m3)).range;function C3(e){return u3(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+t*7)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*f3)/h3)}var w3=C3(0),T3=C3(1),E3=C3(2),D3=C3(3),O3=C3(4),k3=C3(5),A3=C3(6);w3.range,T3.range,E3.range,D3.range,O3.range,k3.range,A3.range;function j3(e){return u3(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t*7)},(e,t)=>(t-e)/h3)}var M3=j3(0),N3=j3(1),P3=j3(2),F3=j3(3),I3=j3(4),L3=j3(5),R3=j3(6);M3.range,N3.range,P3.range,F3.range,I3.range,L3.range,R3.range;var z3=u3(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());z3.range;var B3=u3(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());B3.range;var V3=u3(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());V3.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:u3(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}),V3.range;var H3=u3(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());H3.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:u3(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}),H3.range;var U3=({min:e,max:t,step:n})=>({step:n,min:parseInt(e/n)*n,max:parseInt(t/n)*n}),W3=(e,t,n,r)=>{(0,D$.default)(e.min<e.max,`domain: min must be less than max`),(0,D$.default)(t.min<t.max,`range: min must be less than max`);let i=U3(e),a=U3(t);return{scale:{x:s3().domain([e.min,e.max]).range([0,n.width]),y:s3().domain([t.max,t.min]).range([0,n.height])},snap:{x:k$.bind(null,i.min,i.max,i.step),y:k$.bind(null,a.min,a.max,a.step)},domain:e,range:t,size:n,getRootNode:r}};function G3(e){return Br(`PrivateSwitchBase`,e)}Vr(`PrivateSwitchBase`,[`root`,`checked`,`disabled`,`input`,`edgeStart`,`edgeEnd`]);var K3=e=>{let{classes:t,checked:n,disabled:r,edge:i}=e;return ca({root:[`root`,n&&`checked`,r&&`disabled`,i&&`edge${B(i)}`],input:[`input`]},G3,t)},q3=R(Ld,{name:`MuiSwitchBase`})({padding:9,borderRadius:`50%`,variants:[{props:{edge:`start`,size:`small`},style:{marginLeft:-3}},{props:({edge:e,ownerState:t})=>e===`start`&&t.size!==`small`,style:{marginLeft:-12}},{props:{edge:`end`,size:`small`},style:{marginRight:-3}},{props:({edge:e,ownerState:t})=>e===`end`&&t.size!==`small`,style:{marginRight:-12}}]}),J3=R(`input`,{name:`MuiSwitchBase`,shouldForwardProp:Co})({cursor:`inherit`,position:`absolute`,opacity:0,width:`100%`,height:`100%`,top:0,left:0,margin:0,padding:0,zIndex:1}),Y3=P.forwardRef(function(e,t){let{autoFocus:n,checked:r,checkedIcon:i,defaultChecked:a,disabled:o,disableFocusRipple:s=!1,edge:c=!1,icon:l,id:u,inputProps:d,inputRef:f,name:p,onBlur:m,onChange:h,onFocus:g,readOnly:_,required:v=!1,tabIndex:y,type:b,value:x,slots:S={},slotProps:C={},...w}=e,[T,E]=yl({controlled:r,default:!!a,name:`SwitchBase`,state:`checked`}),D=Of(),O=e=>{g&&g(e),D&&D.onFocus&&D.onFocus(e)},k=e=>{m&&m(e),D&&D.onBlur&&D.onBlur(e)},A=e=>{if(e.nativeEvent.defaultPrevented||_)return;let t=e.target.checked;E(t),h&&h(e,t)},j=o;D&&j===void 0&&(j=D.disabled);let M=b===`checkbox`||b===`radio`,ee={...e,checked:T,disabled:j,disableFocusRipple:s,edge:c},N=K3(ee),te={slots:S,slotProps:{input:d,...C}},[ne,re]=zc(`root`,{ref:t,elementType:q3,className:N.root,shouldForwardComponentProp:!0,externalForwardedProps:{...te,component:`span`,...w},getSlotProps:e=>({...e,onFocus:t=>{e.onFocus?.(t),O(t)},onBlur:t=>{e.onBlur?.(t),k(t)}}),ownerState:ee,additionalProps:{centerRipple:!0,focusRipple:!s,role:void 0,tabIndex:null}}),[ie,ae]=zc(`input`,{ref:f,elementType:J3,className:N.input,externalForwardedProps:te,getSlotProps:e=>({...e,onChange:t=>{e.onChange?.(t),A(t)}}),ownerState:ee,additionalProps:{autoFocus:n,checked:r,defaultChecked:a,disabled:j,id:M?u:void 0,name:p,readOnly:_,required:v,tabIndex:y,type:b,...b===`checkbox`&&x===void 0?{}:{value:x}}});return(0,F.jsxs)(ne,{...re,children:[(0,F.jsx)(ie,{...ae}),T?i:l]})}),X3=ml((0,F.jsx)(`path`,{d:`M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z`}),`CheckBoxOutlineBlank`),Z3=ml((0,F.jsx)(`path`,{d:`M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z`}),`CheckBox`),Q3=ml((0,F.jsx)(`path`,{d:`M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z`}),`IndeterminateCheckBox`);function $3(e){return Br(`MuiCheckbox`,e)}var e6=Vr(`MuiCheckbox`,[`root`,`checked`,`disabled`,`indeterminate`,`colorPrimary`,`colorSecondary`,`sizeSmall`,`sizeMedium`]),t6=e=>{let{classes:t,indeterminate:n,color:r,size:i}=e,a=ca({root:[`root`,n&&`indeterminate`,`color${B(r)}`,`size${B(i)}`]},$3,t);return{...t,...a}},n6=R(Y3,{shouldForwardProp:e=>Co(e)||e===`classes`,name:`MuiCheckbox`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.indeterminate&&t.indeterminate,t[`size${B(n.size)}`],n.color!=="default"&&t[`color${B(n.color)}`]]}})(Nc(({theme:e})=>({color:(e.vars||e).palette.text.secondary,variants:[{props:{color:`default`,disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity)}}},...Object.entries(e.palette).filter(Vd()).map(([t])=>({props:{color:t,disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)}}})),...Object.entries(e.palette).filter(Vd()).map(([t])=>({props:{color:t},style:{[`&.${e6.checked}, &.${e6.indeterminate}`]:{color:(e.vars||e).palette[t].main},[`&.${e6.disabled}`]:{color:(e.vars||e).palette.action.disabled}}})),{props:{disableRipple:!1},style:{"&:hover":{"@media (hover: none)":{backgroundColor:`transparent`}}}}]}))),r6=(0,F.jsx)(Z3,{}),i6=(0,F.jsx)(X3,{}),a6=(0,F.jsx)(Q3,{}),o6=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiCheckbox`}),{checkedIcon:r=r6,color:i=`primary`,icon:a=i6,indeterminate:o=!1,indeterminateIcon:s=a6,inputProps:c,size:l=`medium`,disableRipple:u=!1,className:d,slots:f={},slotProps:p={},...m}=n,h=o?s:a,g=o?s:r,_={...n,disableRipple:u,color:i,indeterminate:o,size:l},v=t6(_),y=p.input??c,[b,x]=zc(`root`,{ref:t,elementType:n6,className:I(v.root,d),shouldForwardComponentProp:!0,externalForwardedProps:{slots:f,slotProps:p,...m},ownerState:_,additionalProps:{type:`checkbox`,icon:P.cloneElement(h,{fontSize:h.props.fontSize??l}),checkedIcon:P.cloneElement(g,{fontSize:g.props.fontSize??l}),disableRipple:u,slots:f,slotProps:{input:Sl(typeof y==`function`?y(_):y,{"data-indeterminate":o,"aria-checked":o?`mixed`:void 0})}}});return(0,F.jsx)(b,{...x,classes:v})}),s6=R(gY)(()=>({fontSize:`max(1.25rem, 18px)`})),c6=R(bY)(()=>({fontSize:`max(1rem, 14px)`})),l6=({text:e,title:t,onClose:n,onConfirm:r,open:i,onCloseText:a,onConfirmText:o,disableAutoFocus:s,disableEnforceFocus:c,disableRestoreFocus:l})=>(0,F.jsxs)(xJ,{open:i,disableAutoFocus:s,disableEnforceFocus:c,disableRestoreFocus:l,onClose:n,children:[t&&(0,F.jsx)(s6,{children:t}),e&&(0,F.jsx)(Xq,{children:(0,F.jsx)(c6,{children:e})}),(0,F.jsxs)(fJ,{children:[n&&(0,F.jsx)(ff,{onClick:n,color:`primary`,children:a}),r&&(0,F.jsx)(ff,{autoFocus:!0,onClick:r,color:`primary`,children:o})]})]});l6.defaultProps={onCloseText:`CANCEL`,onConfirmText:`OK`,disableAutoFocus:!1,disableEnforceFocus:!1,disableRestoreFocus:!1},l6.propTypes={text:v.oneOfType([v.string,v.object]),title:v.string,onClose:v.func,onConfirm:v.func,open:v.bool,onConfirmText:v.string,onCloseText:v.string,disableAutoFocus:v.bool,disableEnforceFocus:v.bool,disableRestoreFocus:v.bool};function u6(e){return typeof e==`function`||typeof e==`object`&&!!e&&typeof e.$$typeof==`symbol`}function d6(e,t){return!e||u6(e)?e:u6(e.default)?e.default:t&&u6(e[t])?e[t]:t&&u6(e[t]?.default)?e[t].default:e}d6(Jf,`InputContainer`)||d6(m6.InputContainer,`InputContainer`);var f6=Op,p6=f6.default,m6=p6&&typeof p6==`object`?p6:f6,h6=o(((e,t)=>{(function(){"use strict";var e={}.hasOwnProperty;function n(){for(var e=``,t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=i(e,r(n)))}return e}function r(t){if(typeof t==`string`||typeof t==`number`)return t;if(typeof t!=`object`)return``;if(Array.isArray(t))return n.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes(`[native code]`))return t.toString();var r=``;for(var a in t)e.call(t,a)&&t[a]&&(r=i(r,a));return r}function i(e,t){return t?e?e+` `+t:e+t:e}t!==void 0&&t.exports?(n.default=n,t.exports=n):typeof define==`function`&&typeof define.amd==`object`&&define.amd?define(`classnames`,[],function(){return n}):window.classNames=n})()}));function g6(e){return function(){return e}}var _6=Math.PI,v6=2*_6,y6=1e-6,b6=v6-y6;function x6(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function S6(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return x6;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}var C6=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._=``,this._append=e==null?x6:S6(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e=+e,t=+t,n=+n,r=+r,i=+i,i<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(this._x1===null)this._append`M${this._x1=e},${this._y1=t}`;else if(d>y6)if(!(Math.abs(u*s-c*l)>y6)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((_6-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>y6&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>y6||Math.abs(this._y1-l)>y6)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%v6+v6),d>b6?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>y6&&this._append`A${n},${n},0,${+(d>=_6)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};function w6(){return new C6}w6.prototype=C6.prototype;function T6(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new C6(t)}Array.prototype.slice;function E6(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function D6(e){this._context=e}D6.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function O6(e){return new D6(e)}function k6(e){return e[0]}function A6(e){return e[1]}function j6(e,t){var n=g6(!0),r=null,i=O6,a=null,o=T6(s);e=typeof e==`function`?e:e===void 0?k6:g6(e),t=typeof t==`function`?t:t===void 0?A6:g6(t);function s(s){var c,l=(s=E6(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c<l&&n(u=s[c],c,s))===d&&((d=!d)?a.lineStart():a.lineEnd()),d&&a.point(+e(u,c,s),+t(u,c,s));if(f)return a=null,f+``||null}return s.x=function(t){return arguments.length?(e=typeof t==`function`?t:g6(+t),s):e},s.y=function(e){return arguments.length?(t=typeof e==`function`?e:g6(+e),s):t},s.defined=function(e){return arguments.length?(n=typeof e==`function`?e:g6(!!e),s):n},s.curve=function(e){return arguments.length?(i=e,r!=null&&(a=i(r)),s):i},s.context=function(e){return arguments.length?(e==null?r=a=null:a=i(r=e),s):r},s}function M6(e,t){e(t)}function N6(){let{x:e,y:t,defined:n,curve:r}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=j6();return e&&M6(i.x,e),t&&M6(i.y,t),n&&i.defined(n),r&&i.curve(r),i}var P6=l(h6());function F6(e){let{top:t=0,left:n=0,transform:r,className:i,children:a,innerRef:o,...s}=e;return(0,F.jsx)(`g`,{ref:o,className:(0,P6.default)(`visx-group`,i),transform:r||`translate(${n}, ${t})`,...s,children:a})}function I6(e){let{from:t={x:0,y:0},to:n={x:1,y:1},fill:r=`transparent`,className:i,innerRef:a,...o}=e,s=t.x===n.x||t.y===n.y;return(0,F.jsx)(`line`,{ref:a,className:(0,P6.default)(`visx-line`,i),x1:t.x,y1:t.y,x2:n.x,y2:n.y,fill:r,shapeRendering:s?`crispEdges`:`auto`,...o})}function L6(e){let{children:t,data:n=[],x:r,y:i,fill:a=`transparent`,className:o,curve:s,innerRef:c,defined:l=()=>!0,...u}=e,d=N6({x:r,y:i,defined:l,curve:s});return t?(0,F.jsx)(F.Fragment,{children:t({path:d})}):(0,F.jsx)(`path`,{ref:c,className:(0,P6.default)(`visx-linepath`,o),d:d(n)||``,fill:a,strokeLinecap:`round`,...u})}function R6(e){let{className:t,innerRef:n,...r}=e;return(0,F.jsx)(`rect`,{ref:n,className:(0,P6.default)(`visx-bar`,t),...r})}function z6(e){let{className:t,innerRef:n,...r}=e;return(0,F.jsx)(`circle`,{ref:n,className:(0,P6.default)(`visx-circle`,t),...r})}var B6=class{x=0;y=0;constructor(e){let{x:t=0,y:n=0}=e;this.x=t,this.y=n}value(){return{x:this.x,y:this.y}}toArray(){return[this.x,this.y]}};function V6(e,t){t.domain&&(`nice`in e||`quantiles`in e||`padding`in e,e.domain(t.domain))}function H6(e,t){t.range&&(`padding`in e,e.range(t.range))}function U6(e,t){`align`in e&&`align`in t&&t.align!==void 0&&e.align(t.align)}function W6(e,t){`base`in e&&`base`in t&&t.base!==void 0&&e.base(t.base)}function G6(e,t){`clamp`in e&&`clamp`in t&&t.clamp!==void 0&&e.clamp(t.clamp)}function K6(e,t){`constant`in e&&`constant`in t&&t.constant!==void 0&&e.constant(t.constant)}function q6(e,t){`exponent`in e&&`exponent`in t&&t.exponent!==void 0&&e.exponent(t.exponent)}var J6={lab:_4,hcl:y4,"hcl-long":b4,hsl:h4,"hsl-long":g4,cubehelix:S4,"cubehelix-long":C4,rgb:e4};function Y6(e){switch(e){case`lab`:case`hcl`:case`hcl-long`:case`hsl`:case`hsl-long`:case`cubehelix`:case`cubehelix-long`:case`rgb`:return J6[e];default:}let{type:t,gamma:n}=e,r=J6[t];return n===void 0?r:r.gamma(n)}function X6(e,t){if(`interpolate`in t&&`interpolate`in e&&t.interpolate!==void 0){let n=Y6(t.interpolate);e.interpolate(n)}}var Z6=new Date(Date.UTC(2020,1,2,3,4,5)),Q6=`%Y-%m-%d %H:%M`;function $6(e){return e.tickFormat(1,Q6)(Z6)===`2020-02-02 03:04`}var e8={day:x3,hour:y3,minute:_3,month:z3,second:g3,week:w3,year:V3},t8={day:S3,hour:b3,minute:v3,month:B3,second:g3,week:M3,year:H3};function n8(e,t){if(`nice`in t&&t.nice!==void 0&&`nice`in e){let{nice:n}=t;if(typeof n==`boolean`)n&&e.nice();else if(typeof n==`number`)e.nice(n);else{let t=e,r=$6(t);if(typeof n==`string`)t.nice(r?t8[n]:e8[n]);else{let{interval:e,step:i}=n,a=(r?t8[e]:e8[e]).every(i);a!=null&&t.nice(a)}}}}function r8(e,t){`padding`in e&&`padding`in t&&t.padding!==void 0&&e.padding(t.padding),`paddingInner`in e&&`paddingInner`in t&&t.paddingInner!==void 0&&e.paddingInner(t.paddingInner),`paddingOuter`in e&&`paddingOuter`in t&&t.paddingOuter!==void 0&&e.paddingOuter(t.paddingOuter)}function i8(e,t){if(t.reverse){let t=e.range().slice().reverse();`padding`in e,e.range(t)}}function a8(e,t){`round`in t&&t.round!==void 0&&(t.round&&`interpolate`in t&&t.interpolate!==void 0?console.warn(`[visx/scale/applyRound] ignoring round: scale config contains round and interpolate. only applying interpolate. config:`,t):`round`in e?e.round(t.round):`interpolate`in e&&t.round&&e.interpolate(p4))}function o8(e,t){`unknown`in e&&`unknown`in t&&t.unknown!==void 0&&e.unknown(t.unknown)}function s8(e,t){if(`zero`in t&&t.zero===!0){let[t,n]=e.domain(),r=n<t,[i,a]=r?[n,t]:[t,n],o=[Math.min(0,i),Math.max(0,a)];e.domain(r?o.reverse():o)}}var c8=[`domain`,`nice`,`zero`,`interpolate`,`round`,`range`,`reverse`,`align`,`base`,`clamp`,`constant`,`exponent`,`padding`,`unknown`],l8={domain:V6,nice:n8,zero:s8,interpolate:X6,round:a8,align:U6,base:W6,clamp:G6,constant:K6,exponent:q6,padding:r8,range:H6,reverse:i8,unknown:o8};function u8(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];let r=new Set(t),i=c8.filter(e=>r.has(e));return function(e,t){return t!==void 0&&i.forEach(n=>{l8[n](e,t)}),e}}var d8=u8(`domain`,`range`,`reverse`,`align`,`padding`,`round`);function f8(e){return d8(O0(),e)}var p8=u8(`domain`,`range`,`reverse`,`align`,`padding`,`round`);function m8(e){return p8(A0(),e)}function h8(e){if((typeof e==`function`||typeof e==`object`&&e)&&`valueOf`in e){let t=e.valueOf();if(typeof t==`number`)return t}return e}function g8(e,t){let n=e;return`ticks`in n?n.ticks(t):n.domain().filter((e,n,r)=>t==null||r.length<=t||n%Math.round((r.length-1)/t)===0)}function _8(e){return e?.toString()}function v8(e){return`bandwidth`in e?e.bandwidth():0}function y8(e){let{top:t=0,left:n=0,scale:r,width:i,stroke:a=`#eaf0f6`,strokeWidth:o=1,strokeDasharray:s,className:c,children:l,numTicks:u=10,lineStyle:d,offset:f,tickValues:p,...m}=e,h=p??g8(r,u),g=(f??0)+v8(r)/2,_=h.map((e,t)=>{let n=(h8(r(e))??0)+g;return{index:t,from:new B6({x:0,y:n}),to:new B6({x:i,y:n})}});return(0,F.jsx)(F6,{className:(0,P6.default)(`visx-rows`,c),top:t,left:n,children:l?l({lines:_}):_.map(e=>{let{from:t,to:n,index:r}=e;return(0,F.jsx)(I6,{from:t,to:n,stroke:a,strokeWidth:o,strokeDasharray:s,style:d,...m},`row-line-${r}`)})})}function b8(e){let{top:t=0,left:n=0,scale:r,height:i,stroke:a=`#eaf0f6`,strokeWidth:o=1,strokeDasharray:s,className:c,numTicks:l=10,lineStyle:u,offset:d,tickValues:f,children:p,...m}=e,h=f??g8(r,l),g=(d??0)+v8(r)/2,_=h.map((e,t)=>{let n=(h8(r(e))??0)+g;return{index:t,from:new B6({x:n,y:0}),to:new B6({x:n,y:i})}});return(0,F.jsx)(F6,{className:(0,P6.default)(`visx-columns`,c),top:t,left:n,children:p?p({lines:_}):_.map(e=>{let{from:t,to:n,index:r}=e;return(0,F.jsx)(I6,{from:t,to:n,stroke:a,strokeWidth:o,strokeDasharray:s,style:u,...m},`column-line-${r}`)})})}var x8=R(`g`)(()=>({stroke:Xl()})),S8=class extends P.Component{static propTypes={className:v.string,graphProps:C$.isRequired,xBand:v.func,columnTickValues:v.array,rowTickValues:v.array};static defaultProps={};render(){let{graphProps:e,xBand:t,rowTickValues:n,columnTickValues:r}=this.props,{scale:i={},size:a={},range:o={}}=e||{},{step:s=0,labelStep:c=0}=o,l=s&&c&&s<c,u=(e,t)=>{let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=10**Math.max(n,r);return e*i%(t*i)/i},{unlabeledLines:d,labeledLines:f}=(n||[]).reduce((e,t)=>(l&&u(t,c)!==0?e.unlabeledLines.push(t):e.labeledLines.push(t),e),{unlabeledLines:[],labeledLines:[]});return(0,F.jsxs)(x8,{children:[(0,F.jsx)(y8,{scale:i.y,width:a.width,tickValues:d,lineStyle:{stroke:$l(),strokeWidth:1}}),(0,F.jsx)(y8,{scale:i.y,width:a.width,tickValues:f,lineStyle:{stroke:d.length?Ru.GRIDLINES_COLOR:$l(),strokeWidth:1}}),(0,F.jsx)(b8,{scale:t,height:a.height,offset:t.bandwidth()/2,tickValues:r})]})}},C8=o(((e,t)=>{t.exports=n;function n(e,t,n){e instanceof RegExp&&(e=r(e,n)),t instanceof RegExp&&(t=r(t,n));var a=i(e,t,n);return a&&{start:a[0],end:a[1],pre:n.slice(0,a[0]),body:n.slice(a[0]+e.length,a[1]),post:n.slice(a[1]+t.length)}}function r(e,t){var n=t.match(e);return n?n[0]:null}n.range=i;function i(e,t,n){var r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){for(r=[],a=n.length;u>=0&&!s;)u==c?(r.push(u),c=n.indexOf(e,u+1)):r.length==1?s=[r.pop(),l]:(i=r.pop(),i<a&&(a=i,o=l),l=n.indexOf(t,u+1)),u=c<l&&c>=0?c:l;r.length&&(s=[a,o])}return s}})),w8=o(((e,t)=>{t.exports=n;function n(e,t,n){e instanceof RegExp&&(e=r(e,n)),t instanceof RegExp&&(t=r(t,n));var a=i(e,t,n);return a&&{start:a[0],end:a[1],pre:n.slice(0,a[0]),body:n.slice(a[0]+e.length,a[1]),post:n.slice(a[1]+t.length)}}function r(e,t){var n=t.match(e);return n?n[0]:null}n.range=i;function i(e,t,n){var r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],a=n.length;u>=0&&!s;)u==c?(r.push(u),c=n.indexOf(e,u+1)):r.length==1?s=[r.pop(),l]:(i=r.pop(),i<a&&(a=i,o=l),l=n.indexOf(t,u+1)),u=c<l&&c>=0?c:l;r.length&&(s=[a,o])}return s}})),T8=o(((e,t)=>{var n=w8();t.exports=r;function r(e,t,n){var r=e;return i(e,t).reduce(function(e,i){return e.replace(i.functionIdentifier+`(`+i.matches.body+`)`,a(i.matches.body,i.functionIdentifier,n,r,t))},e)}function i(e,t){var r=[],i=typeof t==`string`?RegExp(`\\b(`+t+`)\\(`):t;do{var a=i.exec(e);if(!a)return r;if(a[1]===void 0)throw Error(`Missing the first couple of parenthesis to get the function identifier in `+t);var o=a[1],s=a.index,c=n(`(`,`)`,e.substring(s));if(!c||c.start!==a[0].length-1)throw SyntaxError(o+`(): missing closing ')' in the value '`+e+`'`);r.push({matches:c,functionIdentifier:o}),e=c.post}while(i.test(e));return r}function a(e,t,n,i,a){return n(r(e,a,n),t,i)}})),E8=o(((e,t)=>{var n=function(e){this.value=e};n.math={isDegree:!0,acos:function(e){return n.math.isDegree?180/Math.PI*Math.acos(e):Math.acos(e)},add:function(e,t){return e+t},asin:function(e){return n.math.isDegree?180/Math.PI*Math.asin(e):Math.asin(e)},atan:function(e){return n.math.isDegree?180/Math.PI*Math.atan(e):Math.atan(e)},acosh:function(e){return Math.log(e+Math.sqrt(e*e-1))},asinh:function(e){return Math.log(e+Math.sqrt(e*e+1))},atanh:function(e){return Math.log((1+e)/(1-e))},C:function(e,t){var r=1,i=e-t,a=t;a<i&&(a=i,i=t);for(var o=a+1;o<=e;o++)r*=o;return r/n.math.fact(i)},changeSign:function(e){return-e},cos:function(e){return n.math.isDegree&&(e=n.math.toRadian(e)),Math.cos(e)},cosh:function(e){return(Math.E**+e+Math.E**(-1*e))/2},div:function(e,t){return e/t},fact:function(e){if(e%1!=0)return`NaN`;for(var t=1,n=2;n<=e;n++)t*=n;return t},inverse:function(e){return 1/e},log:function(e){return Math.log(e)/Math.log(10)},mod:function(e,t){return e%t},mul:function(e,t){return e*t},P:function(e,t){for(var n=1,r=Math.floor(e)-Math.floor(t)+1;r<=Math.floor(e);r++)n*=r;return n},Pi:function(e,t,n){for(var r=1,i=e;i<=t;i++)r*=Number(n.postfixEval({n:i}));return r},pow10x:function(e){for(var t=1;e--;)t*=10;return t},sigma:function(e,t,n){for(var r=0,i=e;i<=t;i++)r+=Number(n.postfixEval({n:i}));return r},sin:function(e){return n.math.isDegree&&(e=n.math.toRadian(e)),Math.sin(e)},sinh:function(e){return(Math.E**+e-Math.E**(-1*e))/2},sub:function(e,t){return e-t},tan:function(e){return n.math.isDegree&&(e=n.math.toRadian(e)),Math.tan(e)},tanh:function(e){return n.sinha(e)/n.cosha(e)},toRadian:function(e){return e*Math.PI/180},and:function(e,t){return e&t}},n.Exception=function(e){this.message=e},t.exports=n})),D8=o(((e,t)=>{var n=E8();function r(e,t){for(var n=0;n<e.length;n++)e[n]+=t;return e}for(var i=[{token:`sin`,show:`sin`,type:0,value:n.math.sin},{token:`cos`,show:`cos`,type:0,value:n.math.cos},{token:`tan`,show:`tan`,type:0,value:n.math.tan},{token:`pi`,show:`π`,type:3,value:`PI`},{token:`(`,show:`(`,type:4,value:`(`},{token:`)`,show:`)`,type:5,value:`)`},{token:`P`,show:`P`,type:10,value:n.math.P},{token:`C`,show:`C`,type:10,value:n.math.C},{token:` `,show:` `,type:14,value:` `.anchor},{token:`asin`,show:`asin`,type:0,value:n.math.asin},{token:`acos`,show:`acos`,type:0,value:n.math.acos},{token:`atan`,show:`atan`,type:0,value:n.math.atan},{token:`7`,show:`7`,type:1,value:`7`},{token:`8`,show:`8`,type:1,value:`8`},{token:`9`,show:`9`,type:1,value:`9`},{token:`int`,show:`Int`,type:0,value:Math.floor},{token:`cosh`,show:`cosh`,type:0,value:n.math.cosh},{token:`acosh`,show:`acosh`,type:0,value:n.math.acosh},{token:`ln`,show:` ln`,type:0,value:Math.log},{token:`^`,show:`^`,type:10,value:Math.pow},{token:`root`,show:`root`,type:0,value:Math.sqrt},{token:`4`,show:`4`,type:1,value:`4`},{token:`5`,show:`5`,type:1,value:`5`},{token:`6`,show:`6`,type:1,value:`6`},{token:`/`,show:`÷`,type:2,value:n.math.div},{token:`!`,show:`!`,type:7,value:n.math.fact},{token:`tanh`,show:`tanh`,type:0,value:n.math.tanh},{token:`atanh`,show:`atanh`,type:0,value:n.math.atanh},{token:`Mod`,show:` Mod `,type:2,value:n.math.mod},{token:`1`,show:`1`,type:1,value:`1`},{token:`2`,show:`2`,type:1,value:`2`},{token:`3`,show:`3`,type:1,value:`3`},{token:`*`,show:`×`,type:2,value:n.math.mul},{token:`sinh`,show:`sinh`,type:0,value:n.math.sinh},{token:`asinh`,show:`asinh`,type:0,value:n.math.asinh},{token:`e`,show:`e`,type:3,value:`E`},{token:`log`,show:` log`,type:0,value:n.math.log},{token:`0`,show:`0`,type:1,value:`0`},{token:`.`,show:`.`,type:6,value:`.`},{token:`+`,show:`+`,type:9,value:n.math.add},{token:`-`,show:`-`,type:9,value:n.math.sub},{token:`,`,show:`,`,type:11,value:`,`},{token:`Sigma`,show:`Σ`,type:12,value:n.math.sigma},{token:`n`,show:`n`,type:13,value:`n`},{token:`Pi`,show:`Π`,type:12,value:n.math.Pi},{token:`pow`,show:`pow`,type:8,value:Math.pow,numberOfArguments:2},{token:`&`,show:`&`,type:9,value:n.math.and}],a={0:11,1:0,2:3,3:0,4:0,5:0,6:0,7:11,8:11,9:1,10:10,11:0,12:11,13:0,14:-1,15:11},o=0;o<i.length;o++)i[o].precedence=a[i[o].type];var s={0:!0,1:!0,3:!0,4:!0,6:!0,8:!0,9:!0,12:!0,13:!0,14:!0,15:!0},c={0:!0,1:!0,2:!0,3:!0,4:!0,5:!0,6:!0,7:!0,8:!0,9:!0,10:!0,11:!0,12:!0,13:!0,15:!0},l={0:!0,3:!0,4:!0,8:!0,12:!0,13:!0,15:!0},u={},d={0:!0,1:!0,3:!0,4:!0,6:!0,8:!0,12:!0,13:!0,15:!0},f={1:!0},p=[[],`123789456+-*/()^!PCe0.,n &`.split(``),[`pi`,`ln`,`Pi`],[`sin`,`cos`,`tan`,`Del`,`int`,`Mod`,`log`,`pow`],[`asin`,`acos`,`atan`,`cosh`,`root`,`tanh`,`sinh`],[`acosh`,`atanh`,`asinh`,`Sigma`]];function m(e,t,n,r){for(var i=0;i<r;i++)if(e[n+i]!==t[i])return!1;return!0}n.tokenTypes={FUNCTION_WITH_ONE_ARG:0,NUMBER:1,BINARY_OPERATOR_HIGH_PRECENDENCE:2,CONSTANT:3,OPENING_PARENTHESIS:4,CLOSING_PARENTHESIS:5,DECIMAL:6,POSTFIX_FUNCTION_WITH_ONE_ARG:7,FUNCTION_WITH_N_ARGS:8,BINARY_OPERATOR_LOW_PRECENDENCE:9,BINARY_OPERATOR_PERMUTATION:10,COMMA:11,EVALUATED_FUNCTION:12,EVALUATED_FUNCTION_PARAMETER:13,SPACE:14},n.addToken=function(e){for(var t=0;t<e.length;t++){var r=e[t].token.length,o=-1;e[t].type===n.tokenTypes.FUNCTION_WITH_N_ARGS&&e[t].numberOfArguments===void 0&&(e[t].numberOfArguments=2),p[r]=p[r]||[];for(var s=0;s<p[r].length;s++)if(e[t].token===p[r][s]){o=h(p[r][s],i);break}o===-1?(i.push(e[t]),e[t].precedence=a[e[t].type],p.length<=e[t].token.length&&(p[e[t].token.length]=[]),p[e[t].token.length].push(e[t].token)):(i[o]=e[t],e[t].precedence=a[e[t].type])}};function h(e,t){for(var n=0;n<t.length;n++)if(t[n].token===e)return n;return-1}function g(e){for(var t=[],r=e.length,a,o,s,c=0;c<r;c++)if(!(c<r-1&&e[c]===` `&&e[c+1]===` `)){for(a=``,o=e.length-c>p.length-2?p.length-1:e.length-c;o>0;o--)if(p[o]!==void 0)for(s=0;s<p[o].length;s++)m(e,p[o][s],c,o)&&(a=p[o][s],s=p[o].length,o=0);if(c+=a.length-1,a===``)throw new n.Exception(`Can't understand after `+e.slice(c));t.push(i[h(a,i)])}return t}var _={value:n.math.changeSign,type:0,pre:21,show:`-`},v={value:`)`,show:`)`,type:5,pre:0},y={value:`(`,type:4,pre:0,show:`(`};n.lex=function(e,t){"use strict";var i=[y],a=[],o=e,p=s,m=0,h=u,b=``,x;t!==void 0&&n.addToken(t);var S={},C=g(o);for(x=0;x<C.length;x++){var w=C[x];if(w.type===14){if(x>0&&x<C.length-1&&C[x+1].type===1&&(C[x-1].type===1||C[x-1].type===6))throw new n.Exception(`Unexpected Space`);continue}var T=w.token,E=w.type,D=w.value,O=w.precedence,k=w.show,A=i[i.length-1],j;for(j=a.length;j--&&a[j]===0;)if([0,2,3,4,5,9,11,12,13].indexOf(E)!==-1){if(p[E]!==!0)throw new n.Exception(T+` is not allowed after `+b);i.push(v),p=c,h=d,a.pop()}if(p[E]!==!0)throw new n.Exception(T+` is not allowed after `+b);if(h[E]===!0&&(E=2,D=n.math.mul,k=`×`,O=3,--x),S={value:D,type:E,pre:O,show:k,numberOfArguments:w.numberOfArguments},E===0)p=s,h=u,r(a,2),i.push(S),C[x+1].type!==4&&(i.push(y),a.push(2));else if(E===1)A.type===1?(A.value+=D,r(a,1)):i.push(S),p=c,h=l;else if(E===2)p=s,h=u,r(a,2),i.push(S);else if(E===3)i.push(S),p=c,h=d;else if(E===4)r(a,1),m++,p=s,h=u,i.push(S);else if(E===5){if(!m)throw new n.Exception(`Closing parenthesis are more than opening one, wait What!!!`);m--,p=c,h=d,i.push(S),r(a,1)}else if(E===6){if(A.hasDec)throw new n.Exception(`Two decimals are not allowed in one number`);A.type!==1&&(A={value:0,type:1,pre:0},i.push(A)),p=f,r(a,1),h=u,A.value+=D,A.hasDec=!0}else E===7&&(p=c,h=d,r(a,1),i.push(S));E===8?(p=s,h=u,r(a,w.numberOfArguments+2),i.push(S),C[x+1].type!==4&&(i.push(y),a.push(w.numberOfArguments+2))):E===9?(A.type===9?A.value===n.math.add?(A.value=D,A.show=k,r(a,1)):A.value===n.math.sub&&k===`-`&&(A.value=n.math.add,A.show=`+`,r(a,1)):A.type!==5&&A.type!==7&&A.type!==1&&A.type!==3&&A.type!==13?T===`-`&&(p=s,h=u,r(a,2).push(2),i.push(_),i.push(y)):(i.push(S),r(a,2)),p=s,h=u):E===10?(p=s,h=u,r(a,2),i.push(S)):E===11?(p=s,h=u,i.push(S)):E===12?(p=s,h=u,r(a,6),i.push(S),C[x+1].type!==4&&(i.push(y),a.push(6))):E===13&&(p=c,h=d,i.push(S)),r(a,-1),b=T}for(j=a.length;j--;)i.push(v);if(p[5]!==!0)throw new n.Exception(`complete the expression`);for(;m--;)i.push(v);return i.push(v),new n(i)},t.exports=n})),O8=o(((e,t)=>{var n=D8();n.prototype.toPostfix=function(){"use strict";for(var e=[],t,r,i,a,o,s=[{value:`(`,type:4,pre:0}],c=this.value,l=1;l<c.length;l++)if(c[l].type===1||c[l].type===3||c[l].type===13)c[l].type===1&&(c[l].value=Number(c[l].value)),e.push(c[l]);else if(c[l].type===4)s.push(c[l]);else if(c[l].type===5)for(;(r=s.pop()).type!==4;)e.push(r);else if(c[l].type===11){for(;(r=s.pop()).type!==4;)e.push(r);s.push(r)}else{t=c[l],a=t.pre,o=s[s.length-1],i=o.pre;var u=o.value==`Math.pow`&&t.value==`Math.pow`;if(a>i)s.push(t);else{for(;i>=a&&!u||u&&a<i;)r=s.pop(),o=s[s.length-1],e.push(r),i=o.pre,u=t.value==`Math.pow`&&o.value==`Math.pow`;s.push(t)}}return new n(e)},t.exports=n})),k8=o(((e,t)=>{var n=O8();n.prototype.postfixEval=function(e){"use strict";e||={},e.PI=Math.PI,e.E=Math.E;for(var t=[],r,i,a,o=this.value,s=e.n!==void 0,c=0;c<o.length;c++)if(o[c].type===1)t.push({value:o[c].value,type:1});else if(o[c].type===3)t.push({value:e[o[c].value],type:1});else if(o[c].type===0)t[t.length-1].type===void 0?t[t.length-1].value.push(o[c]):t[t.length-1].value=o[c].value(t[t.length-1].value);else if(o[c].type===7)t[t.length-1].type===void 0?t[t.length-1].value.push(o[c]):t[t.length-1].value=o[c].value(t[t.length-1].value);else if(o[c].type===8){for(var l=[],u=0;u<o[c].numberOfArguments;u++)l.push(t.pop().value);t.push({type:1,value:o[c].value.apply(o[c],l.reverse())})}else o[c].type===10?(r=t.pop(),i=t.pop(),i.type===void 0?(i.value=i.concat(r),i.value.push(o[c]),t.push(i)):r.type===void 0?(r.unshift(i),r.push(o[c]),t.push(r)):t.push({type:1,value:o[c].value(i.value,r.value)})):o[c].type===2||o[c].type===9?(r=t.pop(),i=t.pop(),i.type===void 0?(i=i.concat(r),i.push(o[c]),t.push(i)):r.type===void 0?(r.unshift(i),r.push(o[c]),t.push(r)):t.push({type:1,value:o[c].value(i.value,r.value)})):o[c].type===12?(r=t.pop(),r.type!==void 0&&(r=[r]),i=t.pop(),a=t.pop(),t.push({type:1,value:o[c].value(a.value,i.value,new n(r))})):o[c].type===13&&(s?t.push({value:e[o[c].value],type:3}):t.push([o[c]]));if(t.length>1)throw new n.Exception(`Uncaught Syntax error`);return t[0].value>0x38d7ea4c68000?`Infinity`:parseFloat(t[0].value.toFixed(15))},n.eval=function(e,t,n){return t===void 0?this.lex(e).toPostfix().postfixEval():n===void 0?t.length===void 0?this.lex(e).toPostfix().postfixEval(t):this.lex(e,t).toPostfix().postfixEval():this.lex(e,t).toPostfix().postfixEval(n)},t.exports=n})),A8=o(((e,t)=>{var n=k8();n.prototype.formulaEval=function(){"use strict";for(var e,t,n,r=[],i=this.value,a=0;a<i.length;a++)i[a].type===1||i[a].type===3?r.push({value:i[a].type===3?i[a].show:i[a].value,type:1}):i[a].type===13?r.push({value:i[a].show,type:1}):i[a].type===0?r[r.length-1]={value:i[a].show+(i[a].show==`-`?``:`(`)+r[r.length-1].value+(i[a].show==`-`?``:`)`),type:0}:i[a].type===7?r[r.length-1]={value:(r[r.length-1].type==1?``:`(`)+r[r.length-1].value+(r[r.length-1].type==1?``:`)`)+i[a].show,type:7}:i[a].type===10?(e=r.pop(),t=r.pop(),i[a].show===`P`||i[a].show===`C`?r.push({value:`<sup>`+t.value+`</sup>`+i[a].show+`<sub>`+e.value+`</sub>`,type:10}):r.push({value:(t.type==1?``:`(`)+t.value+(t.type==1?``:`)`)+`<sup>`+e.value+`</sup>`,type:1})):i[a].type===2||i[a].type===9?(e=r.pop(),t=r.pop(),r.push({value:(t.type==1?``:`(`)+t.value+(t.type==1?``:`)`)+i[a].show+(e.type==1?``:`(`)+e.value+(e.type==1?``:`)`),type:i[a].type})):i[a].type===12&&(e=r.pop(),t=r.pop(),n=r.pop(),r.push({value:i[a].show+`(`+n.value+`,`+t.value+`,`+e.value+`)`,type:12}));return r[0].value},t.exports=n})),j8=o(((e,t)=>{var n=C8(),r=T8(),i=A8(),a=100,o=/(\+|\-|\*|\\|[^a-z]|)(\s*)(\()/g,s;t.exports=c;function c(e,t){s=0,t=10**(t===void 0?5:t),e=e.replace(/\n+/g,` `);function c(e,n,r){if(s++>a)throw s=0,Error(`Call stack overflow for `+r);if(e===``)throw Error(n+`(): '`+r+`' must contain a non-whitespace string`);e=u(e,r);var o=l(e);if(o.length>1||e.indexOf(`var(`)>-1)return n+`(`+e+`)`;var c=o[0]||``;c===`%`&&(e=e.replace(/\b[0-9\.]+%/g,function(e){return parseFloat(e.slice(0,-1))*.01}));var d=e.replace(new RegExp(c,`gi`),``),f;try{f=i.eval(d)}catch{return n+`(`+e+`)`}return c===`%`&&(f*=100),(n.length||c===`%`)&&(f=Math.round(f*t)/t),f+=c,f}function u(e,t){e=e.replace(/((?:\-[a-z]+\-)?calc)/g,``);for(var r=``,i=e,a;a=o.exec(i);){a[0].index>0&&(r+=i.substring(0,a[0].index));var s=n(`(`,`)`,i.substring([0].index));if(s.body===``)throw Error(`'`+e+`' must contain a non-whitespace string`);var l=c(s.body,``,t);r+=s.pre+l,i=s.post}return r+i}return r(e,/((?:\-[a-z]+\-)?calc)\(/,c)}function l(e){for(var t=[],n=[],r=/[\.0-9]([%a-z]+)/gi,i=r.exec(e);i;)!i||!i[1]||(n.indexOf(i[1].toLowerCase())===-1&&(t.push(i[1]),n.push(i[1].toLowerCase())),i=r.exec(e));return t}}));function M8(e,t){let n=new Map;return function(){for(var r=arguments.length,i=Array(r),a=0;a<r;a++)i[a]=arguments[a];let o=t(...i);if(n.has(o))return n.get(o);let s=e.apply(this,i);return n.set(o,s),s}}var N8=`__react_svg_text_measurement_id`;function P8(e,t){if(typeof document>`u`)return null;try{let n=document.getElementById(N8);if(!n){let e=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);e.setAttribute(`aria-hidden`,`true`),e.style.width=`0`,e.style.height=`0`,e.style.position=`absolute`,e.style.top=`-100%`,e.style.left=`-100%`,n=document.createElementNS(`http://www.w3.org/2000/svg`,`text`),n.setAttribute(`id`,N8),e.appendChild(n),document.body.appendChild(e)}return Object.assign(n.style,t),n.textContent=e,n.getComputedTextLength()}catch{return null}}var F8=M8(P8,(e,t)=>`${e}_${JSON.stringify(t)}`),I8=l(j8());function L8(e){return typeof e==`number`}function R8(e){return typeof e==`number`&&Number.isFinite(e)||typeof e==`string`}function z8(e){let{verticalAnchor:t=`end`,scaleToFit:n=!1,angle:r,width:i,lineHeight:a=`1em`,capHeight:o=`0.71em`,children:s,style:c,...l}=e,{x:u=0,y:d=0}=l,f=!R8(u)||!R8(d),{wordsWithWidth:p,spaceWidth:m}=(0,P.useMemo)(()=>({wordsWithWidth:(s==null?[]:s.toString().split(/(?:(?!\u00A0+)\s+)/)).map(e=>({word:e,wordWidth:F8(e,c)||0})),spaceWidth:F8(`\xA0`,c)||0}),[s,c]),h=(0,P.useMemo)(()=>f?[]:i||n?p.reduce((e,t)=>{let{word:r,wordWidth:a}=t,o=e[e.length-1];if(o&&(i==null||n||(o.width||0)+a+m<i))o.words.push(r),o.width=o.width||0,o.width+=a+m;else{let t={words:[r],width:a};e.push(t)}return e},[]):[{words:s==null?[]:s.toString().split(/(?:(?!\u00A0+)\s+)/)}],[f,i,n,s,p,m]);return{wordsByLines:h,startDy:(0,P.useMemo)(()=>f?``:t===`start`?(0,I8.default)(`calc(${o})`):t===`middle`?(0,I8.default)(`calc(${(h.length-1)/2} * -${a} + (${o} / 2))`):(0,I8.default)(`calc(${h.length-1} * -${a})`),[f,t,o,h.length,a]),transform:(0,P.useMemo)(()=>{let e=[];if(f)return``;if(L8(u)&&L8(d)&&L8(i)&&n&&h.length>0){let t=h[0].width||1,r=n===`shrink-only`?Math.min(i/t,1):i/t,a=r,o=u-r*u,s=d-a*d;e.push(`matrix(${r}, 0, 0, ${a}, ${o}, ${s})`)}return r&&e.push(`rotate(${r}, ${u}, ${d})`),e.length>0?e.join(` `):``},[f,u,d,i,n,h,r])}}var B8={overflow:`visible`};function V8(e){let{dx:t=0,dy:n=0,textAnchor:r=`start`,innerRef:i,innerTextRef:a,verticalAnchor:o,angle:s,lineHeight:c=`1em`,scaleToFit:l=!1,capHeight:u,width:d,...f}=e,{x:p=0,fontSize:m}=f,{wordsByLines:h,startDy:g,transform:_}=z8(e);return(0,F.jsx)(`svg`,{ref:i,x:t,y:n,fontSize:m,style:B8,children:h.length>0?(0,F.jsx)(`text`,{ref:a,transform:_,...f,textAnchor:r,children:h.map((e,t)=>(0,F.jsx)(`tspan`,{x:p,dy:t===0?g:c,children:e.words.join(` `)},t))}):null})}var H8={top:`top`,left:`left`,right:`right`,bottom:`bottom`};function U8(e){let{labelOffset:t,labelProps:n,orientation:r,range:i,tickLabelFontSize:a,tickLength:o}=e,s=r===H8.left||r===H8.top?-1:1,c,l,u;if(r===H8.top||r===H8.bottom){let e=r===H8.bottom&&typeof n.fontSize==`number`?n.fontSize:0;c=(Number(i[0])+Number(i[i.length-1]))/2,l=s*(o+t+a+e)}else c=s*((Number(i[0])+Number(i[i.length-1]))/2),l=-(o+t),u=`rotate(${s*90})`;return{x:c,y:l,transform:u}}function W8(e){let{hideTicks:t,horizontal:n,orientation:r,tickClassName:i,tickComponent:a,tickLabelProps:o,tickStroke:s=`#222`,tickTransform:c,ticks:l,strokeWidth:u,tickLineProps:d}=e;return l.map(e=>{let{value:l,index:f,from:p,to:m,formattedValue:h}=e,g=o[f]??{},_=Math.max(10,typeof g.fontSize==`number`&&g.fontSize||0),v=m.y+(n&&r!==H8.top?_:0);return(0,F.jsxs)(F6,{className:(0,P6.default)(`visx-axis-tick`,i),transform:c,children:[!t&&(0,F.jsx)(I6,{from:p,to:m,stroke:s,strokeWidth:u,strokeLinecap:`square`,...d}),a?a({...g,x:m.x,y:v,formattedValue:h}):(0,F.jsx)(V8,{x:m.x,y:v,...g,children:h})]},`visx-tick-${l}-${f}`)})}var G8={textAnchor:`middle`,fontFamily:`Arial`,fontSize:10,fill:`#222`};function K8(e){let{axisFromPoint:t,axisLineClassName:n,axisToPoint:r,hideAxisLine:i,hideTicks:a,horizontal:o,label:s=``,labelClassName:c,labelOffset:l=14,labelProps:u,orientation:d=H8.bottom,scale:f,stroke:p=`#222`,strokeDasharray:m,strokeWidth:h=1,tickClassName:g,tickComponent:_,tickLineProps:v,tickLabelProps:y,tickLength:b=8,tickStroke:x=`#222`,tickTransform:S,ticks:C,ticksComponent:w=W8}=e,T={...G8,...u},E={...G8,...typeof y==`object`?y:null},D=C.map(e=>{let{value:t,index:n}=e;return typeof y==`function`?y(t,n,C):E}),O=Math.max(10,...D.map(e=>typeof e.fontSize==`number`?e.fontSize:0));return(0,F.jsxs)(F.Fragment,{children:[w({hideTicks:a,horizontal:o,orientation:d,scale:f,tickClassName:g,tickComponent:_,tickLabelProps:D,tickStroke:x,tickTransform:S,ticks:C,strokeWidth:h,tickLineProps:v}),!i&&(0,F.jsx)(I6,{className:(0,P6.default)(`visx-axis-line`,n),from:t,to:r,stroke:p,strokeWidth:h,strokeDasharray:m}),s&&(0,F.jsx)(V8,{className:(0,P6.default)(`visx-axis-label`,c),...U8({labelOffset:l,labelProps:T,orientation:d,range:f.range(),tickLabelFontSize:O,tickLength:b}),...T,children:s})]})}function q8(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`center`,n=e;if(t!==`start`&&`bandwidth`in n){let e=n.bandwidth();return t===`center`&&(e/=2),n.round()&&(e=Math.round(e)),t=>{let r=n(t);return typeof r==`number`?r+e:r}}return e}function J8(e){let t=e;return`tickFormat`in t?t.tickFormat():_8}function Y8(e,t){let{x:n,y:r}=e;return new B6(t?{x:n,y:r}:{x:r,y:n})}function X8(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return typeof e==`number`?{start:e,end:e}:{start:0,end:0,...e}}function Z8(e){let{children:t=K8,axisClassName:n,hideAxisLine:r=!1,hideTicks:i=!1,hideZero:a=!1,innerRef:o,left:s=0,numTicks:c=10,orientation:l=H8.bottom,rangePadding:u=0,scale:d,tickFormat:f,tickLength:p=8,tickValues:m,top:h=0,...g}=e,_=f??J8(d),v=l===H8.left,y=l===H8.top,b=y||l===H8.bottom,x=q8(d),S=v||y?-1:1,C=d.range(),w=X8(u),T=Y8({x:Number(C[0])+.5-w.start,y:0},b),E=Y8({x:Number(C[C.length-1])+.5+w.end,y:0},b),D=(m??g8(d,c)).filter(e=>!a||e!==0&&e!==`0`).map((e,t)=>({value:e,index:t})),O=D.map(e=>{let{value:t,index:n}=e,r=h8(x(t));return{value:t,index:n,from:Y8({x:r,y:0},b),to:Y8({x:r,y:p*S},b),formattedValue:_(t,n,D)}});return(0,F.jsx)(F6,{className:(0,P6.default)(`visx-axis`,n),innerRef:o,top:h,left:s,children:t({...g,axisFromPoint:T,axisToPoint:E,hideAxisLine:r,hideTicks:i,hideZero:a,horizontal:b,numTicks:c,orientation:l,rangePadding:u,scale:d,tickFormat:_,tickLength:p,tickPosition:x,tickSign:S,ticks:O})})}var Q8={dx:`-0.25em`,dy:`0.25em`,fill:`#222`,fontFamily:`Arial`,fontSize:10,textAnchor:`end`};function $8(e){let{axisClassName:t,labelOffset:n=36,tickLength:r=8,tickLabelProps:i,...a}=e,o=typeof i==`function`?i:{...Q8,...i};return(0,F.jsx)(Z8,{axisClassName:(0,P6.default)(`visx-axis-left`,t),labelOffset:n,orientation:H8.left,tickLabelProps:o,tickLength:r,...a})}var e5={dy:`0.25em`,fill:`#222`,fontFamily:`Arial`,fontSize:10,textAnchor:`middle`};function t5(e){let{axisClassName:t,labelOffset:n=8,tickLength:r=8,tickLabelProps:i,...a}=e,o=typeof i==`function`?i:{...e5,...i};return(0,F.jsx)(Z8,{axisClassName:(0,P6.default)(`visx-axis-bottom`,t),labelOffset:n,orientation:H8.bottom,tickLabelProps:o,tickLength:r,...a})}var n5=ml((0,F.jsx)(`path`,{d:`M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z`}),`Close`),r5=R(hR)(({theme:e})=>({borderRadius:e.spacing(2),color:V.WHITE,fontSize:`16px`,width:`16px`,height:`16px`,padding:`2px`,border:`1px solid ${V.WHITE}`,stroke:`initial`,boxSizing:`unset`,backgroundColor:Bl(),display:`block`,"&.small":{fontSize:`10px`,width:`10px`,height:`10px`}})),i5=R(n5)(({theme:e})=>({borderRadius:e.spacing(2),color:V.WHITE,fontSize:`16px`,width:`16px`,height:`16px`,padding:`2px`,border:`1px solid ${V.WHITE}`,stroke:`initial`,boxSizing:`unset`,backgroundColor:Gl(),display:`block`,"&.small":{fontSize:`10px`,width:`10px`,height:`10px`}})),a5=({scale:e,x:t,y:n,correctness:r,interactive:i})=>{if(!r||!i)return null;let a=e?e.x(t):t,o=e?e.y(n):n,s=r.value===`correct`;return(0,F.jsx)(`foreignObject`,{x:a-11,y:o-11,width:22,height:22,children:s?(0,F.jsx)(r5,{title:r.label}):(0,F.jsx)(i5,{title:r.label})})},o5=({scale:e,x:t,correctness:n,correctData:r,label:i})=>{if(n&&n.value===`incorrect`){let a=parseFloat(r.find(e=>e.label===i)?.value);if(isNaN(a))return null;let o=e.y(a)-7.5;return(0,F.jsx)(`foreignObject`,{x:e.x(t)-7.5,y:o,width:15,height:15,children:(0,F.jsx)(r5,{className:`small`,title:n.label})})}return null},s5=({correctness:e,interactive:t})=>!e||!t?null:e.value===`correct`?(0,F.jsx)(r5,{title:e.label}):(0,F.jsx)(i5,{title:e.label});a5.propTypes={scale:v.shape({x:v.func,y:v.func}),x:v.number.isRequired,y:v.number.isRequired,correctness:v.shape({value:v.string,label:v.string}),interactive:v.bool},o5.propTypes={scale:v.shape({x:v.func,y:v.func}).isRequired,x:v.number.isRequired,correctness:v.shape({value:v.string,label:v.string}),correctData:v.arrayOf(v.shape({label:v.string,value:v.oneOfType([v.string,v.number])})),label:v.string},s5.propTypes={correctness:v.shape({value:v.string,label:v.string}),interactive:v.bool};var c5=(e,t)=>`${t}-${e.label||`-`}`,l5=(e,t,n,r)=>{let i=n||400,a=t&&t.length?t.map(c5):[`default`];switch(r){case`bar`:case`dotPlot`:case`linePlot`:return f8({range:[0,i],domain:a,padding:.2});case`histogram`:return f8({range:[0,i],domain:a,padding:0});case`lineCross`:case`lineDot`:return m8({domain:a,range:[0,i]});default:return f8({range:[0,i],domain:a,padding:0})}},u5=(e={})=>{let t=[],n=e.min;for(;n<=e.max;)t.push(n),n=Math.round((n+e.step)*1e4)/1e4;return t},d5=(e,t,n)=>{let{step:r,labelStep:i,min:a,max:o}=t||{};switch(a||=0,(!o||o<0)&&(o=t.min+1),r||=i||1,(!i||isNaN(i)&&r)&&(i=r||1),t.max=o,n){case`dotPlot`:case`linePlot`:{let n=Math.round(a),r=Math.round(o);return{domain:{...e,step:1,labelStep:1,min:0,max:1},range:{...t,min:n,max:n===r?n+1:r,labelStep:i,step:1}}}default:return{domain:{...e,step:1,labelStep:1,min:0,max:1},range:{...t,labelStep:i,step:r}}}},f5=(e,t)=>{switch(t){case`lineDot`:case`lineCross`:return{verticalLines:void 0,horizontalLines:u5(e),leftAxis:!0};case`dotPlot`:case`linePlot`:return{verticalLines:[],horizontalLines:[],leftAxis:!1};default:return{verticalLines:[],horizontalLines:u5(e),leftAxis:!0}}},p5=(e,t)=>t>=e*2?25:0,m5=e=>e<30?50:e<40?30:e<60?15:0,h5=e=>{let t,n;return e>91?(t=1.3,n=-55):e>45?(t=1.1,n=-45):e>40?(t=.5+(e-34)*.02,n=-25):e>30?(t=.5+(e-34)*.02,n=-20):(t=.5*.98**(34-e),n=-15),{scale:t,deltay:n}},g5=(e,t)=>(e-57*t)/2,_5=e=>{let t=Number.parseFloat(e);return Number.isFinite(t)?t:0},v5=(e,t)=>{let n=e??t;return typeof n==`number`?n:typeof n==`string`&&n.endsWith(`px`)?_5(n):1},y5=P.forwardRef(({className:e,inputClassName:t,inputRef:n,inputStyle:r,minWidth:i,placeholder:a,style:o,value:s,defaultValue:c,...l},u)=>{let d=(0,P.useRef)(null),f=(0,P.useRef)(n),p=(0,P.useRef)(u),m=(0,P.useRef)(null),[h,g]=(0,P.useState)(()=>v5(i,r?.minWidth));f.current=n,p.current=u;let _=(0,P.useCallback)(e=>{d.current=e,f.current?.(e);let t=p.current;typeof t==`function`?t(e):t&&(t.current=e)},[]);return(0,P.useLayoutEffect)(()=>{let e=d.current,t=m.current;if(!e||!t)return;let n=window.getComputedStyle(e);t.style.font=n.font,t.style.letterSpacing=n.letterSpacing,t.style.textTransform=n.textTransform,t.textContent=String(s??c??a??``)||` `;let o=_5(n.paddingLeft)+_5(n.paddingRight)+_5(n.borderLeftWidth)+_5(n.borderRightWidth),l=Math.ceil(t.getBoundingClientRect().width+2),u=n.boxSizing===`border-box`?l+o:l;g(Math.max(v5(i,r?.minWidth),u))},[c,t,r,i,a,s]),(0,F.jsxs)(`span`,{className:e,style:{display:`inline-block`,...o},children:[(0,F.jsx)(`input`,{...l,ref:_,className:t,placeholder:a,style:{width:h,...r},value:s,defaultValue:c}),(0,F.jsx)(`span`,{ref:m,"aria-hidden":`true`,style:{height:0,left:0,overflow:`hidden`,position:`absolute`,top:0,visibility:`hidden`,whiteSpace:`pre`}})]})});y5.displayName=`AutosizeInput`;var b5=(e=`fill`)=>({[e]:`var(--graph-disabled, ${Ll()})`,pointerEvents:`none`,border:`none`}),x5=(e=`fill`)=>({[e]:Bl(),pointerEvents:`none`,border:`solid 1px ${Bl()}`}),S5=(e=`fill`)=>({[e]:Wl(),pointerEvents:`none`,border:`solid 1px ${Wl()}`}),C5=R(`div`)({display:`flex`,flexDirection:`column`,alignItems:`center`}),w5=zl();R(`input`)(({theme:e})=>({float:`right`,fontFamily:e.typography.fontFamily,fontSize:e.typography.fontSize,border:`none`,"&.correct":x5(`color`),"&.incorrect":S5(`color`),"&.disabledMarkLabel":{backgroundColor:`transparent !important`},"&.error":{border:`2px solid ${e.palette.error.main}`}}));var T5=R(`div`)(({theme:e})=>({pointerEvents:`auto`,textAlign:`center`,fontSize:e.typography.fontSize+2,fontFamily:e.typography.fontFamily,color:Zl(),paddingTop:e.typography.fontSize/2,"&.disabledMarkLabel":{...b5(`color`),color:w5,backgroundColor:`transparent !important`},"&.error":{border:`2px solid ${e.palette.error.main}`},"&.correct":{...x5(`color`)},"&.incorrect":{...S5(`color`)}}));function E5(e){let t=e?.trim()||``;return new RegExp(/^[1-9]*[0-9]*\s?[1-9][0-9]*\/[1-9][0-9]*$/).test(t)}function D5(e){let t=e?.trim()||``,n,r=``,i=t.split(` `);n=i[1]&&i[1].includes(`/`)?i[1].split(`/`)||``:t?.split(`/`)||``;let a;if(E5(e))return i[0]&&i[1]&&(r=i[0]),a=`\\(${r}\\frac{${n[0]}}{${n[1]}}\\)`,a}var O5=e=>{let[t,n]=(0,P.useState)(null),r=(0,P.useCallback)(e=>n(e),null),{mark:i={},disabled:a,inputRef:o,barWidth:s,rotate:c,correctness:l,autoFocus:u,error:d,isHiddenLabel:f,limitCharacters:p,correctnessIndicator:m}=e,[h,g]=(0,P.useState)(i.label),[_,v]=(0,P.useState)(D5(i.label)),[y,b]=(0,P.useState)(!1),x=(0,P.useRef)(null),S=e=>{p&&e.target.value&&e.target.value.length>20||g(e.target.value)},C=()=>y===!1&&_!==void 0,w=t=>{v(D5(i.label)),b(!1),e.onChange(t.target.value)},T={};return c&&(T={width:`unset`,textAlign:`left`}),(0,P.useEffect)(()=>{g(i.label)},[i.label]),(0,P.useEffect)(()=>{let e=x.current;e&&_&&(e.innerHTML=_,hd(e))},[h,_]),(0,F.jsxs)(C5,{children:[m,C()?(0,F.jsx)(T5,{ref:e=>{x.current=e,typeof o==`function`&&o(e)},className:I({disabledMarkLabel:a,error:d,correct:i.editable&&l?.label===`correct`,incorrect:i.editable&&l?.label===`incorrect`}),onClick:()=>b(!0),style:{minWidth:s,position:`fixed`,transformOrigin:`left`,transform:`rotate(${c}deg)`,visibility:f?`hidden`:`unset`,marginTop:m?`24px`:`0`}}):(0,F.jsx)(y5,{inputRef:e=>{r(e),typeof o==`function`&&o(e)},name:`mark-label-input`,autoFocus:y||u,disabled:a,inputClassName:I(l&&i.editable?l.label:null,a&&`disabledMarkLabel`,d&&`error`),inputStyle:{minWidth:s,textAlign:`center`,background:`transparent`,boxSizing:`border-box`,paddingLeft:0,paddingRight:0,border:`none`,...a?{color:w5,WebkitTextFillColor:w5}:{},...T},value:h,style:{position:`fixed`,pointerEvents:`auto`,top:0,left:0,minWidth:s,transformOrigin:`left`,transform:`rotate(${c}deg)`,visibility:f?`hidden`:`unset`,marginTop:m?`24px`:`0`},onChange:S,onBlur:w})]})};O5.propTypes={autoFocus:v.bool,disabled:v.bool,error:v.any,onChange:v.func,graphProps:C$,inputRef:v.func,mark:v.object,barWidth:v.number,rotate:v.number,correctness:v.shape({value:v.string,label:v.string}),isHiddenLabel:v.bool,limitCharacters:v.bool,correctnessIndicator:v.node};var k5=new Set,A5=null;function j5(e){k5.add(e),!A5&&typeof document<`u`&&(A5=new MutationObserver(()=>{k5.forEach(e=>e())}),A5.observe(document.body,{childList:!0,subtree:!0}))}function M5(e){k5.delete(e),k5.size===0&&A5&&(A5.disconnect(),A5=null)}var N5=R(`text`)(({theme:e})=>({fontSize:e.typography.fontSize-2,fill:e.palette.error.main})),P5=R(o6)(()=>({color:`${lu()} !important`})),F5=R(`g`)(({theme:e})=>({"& .vx-axis-line":{stroke:Ru.AXIS_LINE_COLOR,strokeWidth:2},"& .vx-axis-tick":{fill:Ru.AXIS_TICK_COLOR,"& line":{stroke:Ru.AXIS_TICK_COLOR,strokeWidth:2},fontFamily:e.typography.body1?.fontFamily,fontSize:e.typography.fontSize,textAnchor:`middle`}})),I5=e=>({borderRadius:e.spacing(2),color:V.WHITE,fontSize:`16px`,width:`16px`,height:`16px`,padding:`2px`,border:`1px solid ${V.WHITE}`,boxSizing:`unset`}),L5={backgroundColor:Gl()},R5={backgroundColor:Bl()},z5=class extends P.Component{static propTypes={defineChart:v.bool,error:v.any};constructor(e){super(e),this.state={dialog:{open:!1}}}componentDidUpdate(e){this.props.autoFocus&&!e.autoFocus&&this.props.onAutoFocusUsed()}handleAlertDialog=(e,t)=>this.setState({dialog:{open:e}},t);changeCategory=(e,t)=>{let{categories:n,onChangeCategory:r}=this.props,i=n[e];r(e,{...i,label:t})};changeInteractive=(e,t)=>{let{categories:n,onChangeCategory:r}=this.props,i=n[e];t?r(e,{...i,interactive:!i.interactive}):this.setState({dialog:{open:!0,title:`Warning`,text:`This will remove the correct answer value that has been defined for this category.`,onConfirm:()=>this.handleAlertDialog(!1,r(e,{...i,interactive:!i.interactive})),onClose:()=>this.handleAlertDialog(!1)}})};changeEditable=(e,t)=>{let{categories:n,onChangeCategory:r}=this.props,i=n[e];t?r(e,{...i,editable:!i.editable||!1}):this.setState({dialog:{open:!0,title:`Warning`,text:`This will remove the correct answer category name that has been defined for this category.`,onConfirm:()=>this.handleAlertDialog(!1,r(e,{...i,editable:!i.editable||!1})),onClose:()=>this.handleAlertDialog(!1)}})};splitText=(e,t)=>{let n=[];for(;(e||``).length>0;){let r;e.length>t?(r=e.lastIndexOf(` `,t),r===-1&&(r=t)):r=e.length,n.push(e.substring(0,r)),e=e.substring(r).trim()}return n};render(){let{categories:e,xBand:t,bandWidth:n,barWidth:r,rotate:i,top:a,graphProps:o,defineChart:s,chartingOptions:c,x:l,y:u,formattedValue:d,changeInteractiveEnabled:f,changeEditableEnabled:p,error:m,autoFocus:h,hiddenLabelRef:g,showCorrectness:_}=this.props;if(!d)return null;let v={correctnessIcon:I5,incorrectIcon:L5,correctIcon:R5},{dialog:y}=this.state,{changeEditable:b,changeInteractive:x}=c||{},S=parseInt(d.split(`-`)[0],10),C=e[S],{editable:w,interactive:T,label:E,correctness:D}=C||{},O=t(c5({label:E},S)),k=(e||[]).reduce((e,t)=>(e&&e.label?e.label.length:0)>(t&&t.label?t.label.length:0)?e:t,{label:``}),A=m?[...new Set(Object.values(m))].join(` `):``;return(0,F.jsxs)(`g`,{children:[(0,F.jsxs)(`foreignObject`,{x:n?O:l-r/2,y:18,width:r,height:4,style:{pointerEvents:`none`,overflow:`visible`},children:[S===0&&(0,F.jsx)(O5,{isHiddenLabel:!0,inputRef:g,disabled:!0,mark:k,graphProps:o,barWidth:r}),(0,F.jsx)(O5,{autoFocus:s&&h,inputRef:e=>this.input=e,disabled:!s&&!w,mark:C,graphProps:o,onChange:e=>this.changeCategory(S,e),barWidth:r,rotate:i,correctness:D,error:m&&m[S],limitCharacters:!0,correctnessIndicator:_&&D&&(0,F.jsx)(s5,{correctness:D,interactive:T,classes:v})})]}),m&&S===0&&(0,F.jsx)(N5,{y:u+23,height:6,textAnchor:`start`,children:A}),s&&S===0&&(0,F.jsxs)(`svg`,{x:-55,style:{overflow:`visible`},children:[f&&(0,F.jsx)(`text`,{y:u+90+a,width:r,height:4,style:{position:`absolute`,pointerEvents:`none`,wordBreak:`break-word`,maxWidth:r,display:`inline-block`},children:this.splitText(x?.authoringLabel,20).map((e,t)=>(0,F.jsx)(`tspan`,{x:`0`,dy:`${t>0?`1.2em`:`.6em`}`,children:e},t))}),p&&(0,F.jsx)(`text`,{y:u+145+a,width:r,height:4,style:{position:`absolute`,pointerEvents:`none`,wordBreak:`break-word`,maxWidth:r,display:`inline-block`},children:this.splitText(b?.authoringLabel,20).map((e,t)=>(0,F.jsx)(`tspan`,{x:`0`,dy:`${t>0?`1.2em`:`.6em`}`,children:e},t))})]}),s&&f&&(0,F.jsx)(`foreignObject`,{x:l-24,y:u+80+a,width:r,height:4,style:{pointerEvents:`visible`,overflow:`visible`},children:(0,F.jsx)(P5,{style:{position:`fixed`},checked:T,onChange:e=>this.changeInteractive(S,e.target.checked)})}),s&&p&&(0,F.jsx)(`foreignObject`,{x:l-24,y:u+130+a,width:r,height:4,style:{pointerEvents:`visible`,overflow:`visible`},children:(0,F.jsx)(P5,{style:{position:`fixed`},checked:w,onChange:e=>this.changeEditable(S,e.target.checked)})}),(0,F.jsx)(`foreignObject`,{x:l-24,y:u+100+a,width:r,height:4,style:{pointerEvents:`visible`,overflow:`visible`},children:(0,F.jsx)(l6,{open:y.open,title:y.title,text:y.text,onClose:y.onClose,onConfirm:y.onConfirm})})]})}};z5.propTypes={categories:v.array,xBand:v.func,bandWidth:v.number,barWidth:v.number,rotate:v.number,top:v.number,x:v.number,y:v.number,graphProps:v.object,formattedValue:v.string,onChangeCategory:v.func,onChange:v.func,error:v.object,defineChart:v.bool,chartingOptions:v.object,changeInteractiveEnabled:v.bool,changeEditableEnabled:v.bool,autoFocus:v.bool,onAutoFocusUsed:v.func,showCorrectness:v.bool,hiddenLabelRef:v.oneOfType([v.func,v.shape({current:v.instanceOf(Element)})])};var B5=class extends P.Component{static propTypes={bottomScale:v.func,categories:v.array,defineChart:v.bool,error:v.any,graphProps:C$.isRequired,xBand:v.func,leftAxis:v.bool,onChange:v.func,onChangeCategory:v.func,top:v.number,theme:v.object,chartingOptions:v.object,changeInteractiveEnabled:v.bool,changeEditableEnabled:v.bool,autoFocus:v.bool,onAutoFocusUsed:v.func,showCorrectness:v.bool,hiddenLabelRef:v.oneOfType([v.func,v.shape({current:v.instanceOf(Element)})])};state={height:0,width:0};measureHiddenLabel=()=>{if(!this.hiddenLabelRef)return;let e=this.hiddenLabelRef.querySelector(`mjx-container`),t=this.hiddenLabelRef.querySelector(`input`),n=(e||t||this.hiddenLabelRef).getBoundingClientRect(),r=Math.floor(n.height),i=Math.floor(n.width);(r!==this.state.height||i!==this.state.width)&&this.setState({height:r,width:i})};_onDocMutation=()=>{this.hiddenLabelRef&&this.hiddenLabelRef.querySelector(`mjx-container`)&&this.measureHiddenLabel()};observeHiddenLabel=e=>{if(!e)return;let t=e.querySelector(`[data-latex], [data-raw]`);t&&hd(e),(e.querySelector(`mjx-container`)||!t)&&this.measureHiddenLabel(),j5(this._onDocMutation)};setHiddenLabelRef=e=>{e&&e!==this.hiddenLabelRef&&(this.hiddenLabelRef=e,this.observeHiddenLabel(e))};componentDidMount(){this.hiddenLabelRef&&this.observeHiddenLabel(this.hiddenLabelRef)}componentWillUnmount(){M5(this._onDocMutation),this._updateTimer&&clearTimeout(this._updateTimer)}componentDidUpdate(e){e.categories!==this.props.categories&&(this._updateTimer&&clearTimeout(this._updateTimer),this._updateTimer=setTimeout(()=>this.measureHiddenLabel(),50))}render(){let{graphProps:e,xBand:t,leftAxis:n,onChange:r,onChangeCategory:i,categories:a=[],top:o,defineChart:s,chartingOptions:c,changeInteractiveEnabled:l,changeEditableEnabled:u,theme:d,autoFocus:f,onAutoFocusUsed:p,error:m,showCorrectness:h}=this.props,{scale:g={},range:_={},domain:v={},size:y={}}=e||{},{height:b,width:x}=this.state,S=t&&typeof t.rangeRound==`function`&&t.rangeRound([0,y.width]),C=t&&typeof t.bandwidth==`function`&&t.bandwidth(),w=C||g.x&&g.x(v.max)/a.length,T=u5({..._,step:_.labelStep}),E=p5(d&&d.typography?d.typography.fontSize:14,b),D=x>w?25:0;return(0,F.jsxs)(F5,{children:[n&&(0,F.jsx)($8,{scale:g.y,tickLength:10,tickFormat:e=>e,tickValues:T,tickLabelProps:e=>({dy:4,dx:-10-(e.toLocaleString().length||1)*5})}),(0,F.jsx)(t5,{scale:S,labelProps:{y:60+o},top:g.y&&g.y(_.min),textLabelProps:()=>({textAnchor:`middle`}),tickFormat:e=>e,tickComponent:n=>{let d={hiddenLabelRef:this.setHiddenLabelRef,categories:a,xBand:t,bandWidth:C,barWidth:w,rotate:E||D,top:o,defineChart:s,chartingOptions:c,autoFocus:f,onAutoFocusUsed:p,error:m,onChangeCategory:i,changeInteractiveEnabled:l,changeEditableEnabled:u,onChange:r,graphProps:e,x:n.x,y:n.y,formattedValue:n.formattedValue,showCorrectness:h};return(0,F.jsx)(z5,{...d})},autoFocus:f,onAutoFocusUsed:p})]})}},V5=({width:e,scaleValue:t,color:n})=>(0,F.jsx)(`svg`,{x:g5(e,t),y:h5(e)?.deltay,color:n,width:e,height:e,overflow:`visible`,viewBox:`0 0 ${e} ${e}`,style:{overflow:`visible !important`},children:(0,F.jsxs)(`g`,{xmlns:`http://www.w3.org/2000/svg`,fill:`currentColor`,stroke:`currentColor`,transform:`scale(${t})`,children:[(0,F.jsx)(`circle`,{cx:`28.5`,cy:`23.5`,r:`22`,fill:`white`,stroke:`currentColor`}),(0,F.jsx)(`path`,{d:`M33.5 21.25H23.4609C22.7578 21.25 22.4062 20.4297 22.9141 19.9219L27.9141 14.9219C28.2266 14.6094 28.7344 14.6094 29.0469 14.9219L34.0469 19.9219C34.5547 20.4297 34.2031 21.25 33.5 21.25Z`,fill:`currentColor`}),(0,F.jsx)(`path`,{d:`M23.5 25.75L33.5391 25.75C34.2422 25.75 34.5938 26.5703 34.0859 27.0781L29.0859 32.0781C28.7734 32.3906 28.2656 32.3906 27.9531 32.0781L22.9531 27.0781C22.4453 26.5703 22.7969 25.75 23.5 25.75Z`,fill:`currentColor`})]})});V5.propTypes={width:v.number.isRequired,scaleValue:v.number.isRequired,color:v.string};var H5=R(`svg`)(()=>({overflow:`visible !important`})),U5=R(`ellipse`)(()=>({fill:`transparent`,clipPath:`polygon(50% 0%, 100% 0%, 100% 50%, 0% 50%, 0% 0%)`})),W5=R(hR)(()=>({backgroundColor:Bl(),borderRadius:`16px`,color:V.WHITE,fontSize:`16px`,padding:`2px`,border:`4px solid ${V.WHITE}`,width:`16px`,height:`16px`,boxSizing:`unset`})),G5=R(n5)(()=>({backgroundColor:Gl(),borderRadius:`16px`,color:V.WHITE,fontSize:`16px`,padding:`2px`,border:`4px solid ${V.WHITE}`,width:`16px`,height:`16px`,boxSizing:`unset`})),K5=({x:e,y:t,width:n,graphProps:r,interactive:i,isHovered:a,correctness:o,isPlot:s,...c})=>{let{scale:l}=r,u=h5(n)?.scale;return(0,F.jsxs)(H5,{x:e,y:l.y(t)-10,width:n,overflow:`visible`,children:[a&&!o&&i&&(0,F.jsx)(V5,{width:n,scaleValue:u,color:V.BORDER_GRAY}),i&&!o&&(0,F.jsx)(U5,{cx:n/2,cy:10,rx:n/2,ry:66,...c}),(0,F.jsx)(`defs`,{children:(0,F.jsxs)(`filter`,{id:`bottomShadow`,x:`0`,y:`0`,width:`140%`,height:`140%`,children:[(0,F.jsx)(`feGaussianBlur`,{in:`SourceAlpha`,stdDeviation:`3`}),(0,F.jsx)(`feOffset`,{dx:`0`,dy:`5`,result:`offsetblur`}),(0,F.jsx)(`feFlood`,{floodColor:`#00000033`}),(0,F.jsx)(`feComposite`,{in2:`offsetblur`,operator:`in`}),(0,F.jsxs)(`feMerge`,{children:[(0,F.jsx)(`feMergeNode`,{}),(0,F.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]})}),o&&i&&!s&&(0,F.jsx)(`foreignObject`,{x:n/2-14,y:0,width:40,height:40,children:o.value===`correct`?(0,F.jsx)(W5,{title:o.label}):(0,F.jsx)(G5,{title:o.label})})]})};K5.propTypes={x:v.number.isRequired,y:v.number.isRequired,width:v.number,graphProps:C$.isRequired,interactive:v.bool,isHovered:v.bool,correctness:v.shape({value:v.string,label:v.string}),isPlot:v.bool};var q5=K5,J5=i0({axis:`y`,fromDelta:(e,t)=>(t.x=0,j$(e).add(j$(t)).y),bounds:(e,{domain:t,range:n})=>A$({left:0,top:e.y,bottom:e.y,right:0},t,n),anchorPoint:e=>({x:e.x,y:e.y})})(q5),Y5=({dashColor:e})=>(0,F.jsxs)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,F.jsx)(`circle`,{cx:`12`,cy:`12`,r:`11`,fill:`white`,stroke:e||`#7E8494`,strokeWidth:`2`,strokeDasharray:`5 5`}),(0,F.jsxs)(`mask`,{id:`path-2-outside-1_3089_3799`,maskUnits:`userSpaceOnUse`,x:`2`,y:`3`,width:`19`,height:`18`,fill:`black`,children:[(0,F.jsx)(`rect`,{fill:`white`,x:`2`,y:`3`,width:`19`,height:`18`}),(0,F.jsx)(`path`,{d:`M12 20C9.125 20 6.5 18.5 5.0625 16C3.625 13.5312 3.625 10.5 5.0625 8C6.5 5.53125 9.125 4 12 4C14.8438 4 17.4688 5.53125 18.9062 8C20.3438 10.5 20.3438 13.5312 18.9062 16C17.4688 18.5 14.8438 20 12 20ZM15.5312 10.5312H15.5C15.8125 10.25 15.8125 9.78125 15.5 9.46875C15.2188 9.1875 14.75 9.1875 14.4688 9.46875L11 12.9688L9.53125 11.5C9.21875 11.1875 8.75 11.1875 8.46875 11.5C8.15625 11.7812 8.15625 12.25 8.46875 12.5312L10.4688 14.5312C10.75 14.8438 11.2188 14.8438 11.5312 14.5312L15.5312 10.5312Z`})]}),(0,F.jsx)(`path`,{d:`M12 20C9.125 20 6.5 18.5 5.0625 16C3.625 13.5312 3.625 10.5 5.0625 8C6.5 5.53125 9.125 4 12 4C14.8438 4 17.4688 5.53125 18.9062 8C20.3438 10.5 20.3438 13.5312 18.9062 16C17.4688 18.5 14.8438 20 12 20ZM15.5312 10.5312H15.5C15.8125 10.25 15.8125 9.78125 15.5 9.46875C15.2188 9.1875 14.75 9.1875 14.4688 9.46875L11 12.9688L9.53125 11.5C9.21875 11.1875 8.75 11.1875 8.46875 11.5C8.15625 11.7812 8.15625 12.25 8.46875 12.5312L10.4688 14.5312C10.75 14.8438 11.2188 14.8438 11.5312 14.5312L15.5312 10.5312Z`,fill:`#0EA449`}),(0,F.jsx)(`path`,{d:`M5.0625 16L5.92942 15.5015L5.92668 15.4968L5.0625 16ZM5.0625 8L4.19831 7.4968L4.19559 7.50153L5.0625 8ZM18.9062 8L19.7732 7.50152L19.7704 7.49681L18.9062 8ZM18.9062 16L18.0421 15.4968L18.0393 15.5015L18.9062 16ZM15.5312 10.5312L16.2384 11.2384L17.9455 9.53125H15.5312V10.5312ZM15.5 10.5312L14.831 9.78796L12.894 11.5312H15.5V10.5312ZM14.4688 9.46875L13.7616 8.76164L13.7585 8.76482L14.4688 9.46875ZM11 12.9688L10.2929 13.6759L11.0032 14.3861L11.7103 13.6727L11 12.9688ZM8.46875 11.5L9.13771 12.2433L9.17684 12.2081L9.21204 12.169L8.46875 11.5ZM8.46875 12.5312L9.17586 11.8241L9.15726 11.8055L9.13771 11.788L8.46875 12.5312ZM10.4688 14.5312L11.212 13.8623L11.1945 13.8427L11.1759 13.8241L10.4688 14.5312ZM12 20V19C9.479 19 7.18657 17.6879 5.92941 15.5015L5.0625 16L4.19559 16.4985C5.81343 19.3121 8.771 21 12 21V20ZM5.0625 16L5.92668 15.4968C4.6714 13.341 4.66824 10.6918 5.92941 8.49847L5.0625 8L4.19559 7.50153C2.58176 10.3082 2.5786 13.7215 4.19832 16.5032L5.0625 16ZM5.0625 8L5.92668 8.50319C7.18712 6.33851 9.48502 5 12 5V4V3C8.76498 3 5.81288 4.72399 4.19832 7.49681L5.0625 8ZM12 4V5C14.4816 5 16.7805 6.33661 18.0421 8.50319L18.9062 8L19.7704 7.49681C18.157 4.72589 15.2059 3 12 3V4ZM18.9062 8L18.0393 8.49847C19.3005 10.6918 19.2973 13.341 18.0421 15.4968L18.9062 16L19.7704 16.5032C21.3902 13.7215 21.387 10.3082 19.7732 7.50153L18.9062 8ZM18.9062 16L18.0393 15.5015C16.7811 17.6898 14.4876 19 12 19V20V21C15.1999 21 18.1564 19.3102 19.7732 16.4985L18.9062 16ZM15.5312 10.5312V9.53125H15.5V10.5312V11.5312H15.5312V10.5312ZM15.5 10.5312L16.169 11.2745C16.9447 10.5764 16.8883 9.44281 16.2071 8.76164L15.5 9.46875L14.7929 10.1759C14.7696 10.1525 14.7344 10.0966 14.7344 10.0117C14.7344 9.92377 14.7735 9.83972 14.831 9.78796L15.5 10.5312ZM15.5 9.46875L16.2071 8.76164C15.5353 8.08987 14.4334 8.08987 13.7616 8.76164L14.4688 9.46875L15.1759 10.1759C15.1167 10.235 15.0442 10.2578 14.9844 10.2578C14.9245 10.2578 14.8521 10.235 14.7929 10.1759L15.5 9.46875ZM14.4688 9.46875L13.7585 8.76482L10.2897 12.2648L11 12.9688L11.7103 13.6727L15.179 10.1727L14.4688 9.46875ZM11 12.9688L11.7071 12.2616L10.2384 10.7929L9.53125 11.5L8.82414 12.2071L10.2929 13.6759L11 12.9688ZM9.53125 11.5L10.2384 10.7929C9.55719 10.1117 8.42362 10.0553 7.72546 10.831L8.46875 11.5L9.21204 12.169C9.16028 12.2265 9.07623 12.2656 8.98828 12.2656C8.90344 12.2656 8.84748 12.2304 8.82414 12.2071L9.53125 11.5ZM8.46875 11.5L7.79979 10.7567C7.04591 11.4352 7.04591 12.5961 7.79979 13.2745L8.46875 12.5312L9.13771 11.788C9.19301 11.8377 9.23438 11.9208 9.23438 12.0156C9.23438 12.1105 9.19301 12.1935 9.13771 12.2433L8.46875 11.5ZM8.46875 12.5312L7.76164 13.2384L9.76164 15.2384L10.4688 14.5312L11.1759 13.8241L9.17586 11.8241L8.46875 12.5312ZM10.4688 14.5312L9.72546 15.2002C10.4236 15.976 11.5572 15.9195 12.2384 15.2384L11.5312 14.5312L10.8241 13.8241C10.8475 13.8008 10.9034 13.7656 10.9883 13.7656C11.0762 13.7656 11.1603 13.8048 11.212 13.8623L10.4688 14.5312ZM11.5312 14.5312L12.2384 15.2384L16.2384 11.2384L15.5312 10.5312L14.8241 9.82414L10.8241 13.8241L11.5312 14.5312Z`,fill:`white`,mask:`url(#path-2-outside-1_3089_3799)`})]});Y5.propTypes={dashColor:v.string};var X5=Uu(`pie-lib:chart:bars`),Z5=[`#006699`,`#F59B00`,`#08916D`,`#529EE0`,`#52B7D8`,`#D9A6C2`,`#FFB03B`,`#54A77B`,`#E16032`,`#4FD2D2`,`#F0E442`,`#E287B2`],Q5=[`#003754`,`#975616`,`#00503B`,`#225982`,`#1F687D`,`#825E6F`,`#996428`,`#255E44`,`#8A331F`,`#167A7A`,`#91862D`,`#894A65`],$5=(e,t,n,r,i)=>e&&t&&i?r[n%r.length]:e&&i?Ru.ROLLOVER_FILL_BAR_COLOR:t||null,e7=R(R6)(()=>({fill:V.TERTIARY})),t7=class extends P.Component{static propTypes={barColor:v.string,onChangeCategory:v.func,value:v.number,label:v.string,xBand:v.func,index:v.number.isRequired,graphProps:C$.isRequired,interactive:v.bool,correctness:v.shape({value:v.string,label:v.string}),correctData:v.array,defineChart:v.bool};constructor(e){super(e),this.state={dragValue:void 0,isHovered:!1},this.mouseX=0,this.mouseY=0}componentDidMount(){window.addEventListener(`mousemove`,this.handleMouseMove)}componentWillUnmount(){window.removeEventListener(`mousemove`,this.handleMouseMove)}handleMouseMove=e=>{this.mouseX=e.clientX,this.mouseY=e.clientY;let t=this.isMouseInsideSvgElement();this.setState({isHovered:t})};isMouseInsideSvgElement=()=>{let e=this.gRef.getBoundingClientRect();return this.mouseX>=e.left&&this.mouseX<=e.right&&this.mouseY>=e.top&&this.mouseY<=e.bottom};handleMouseEnter=()=>this.setState({isHovered:!0});handleMouseLeave=()=>this.setState({isHovered:!1});setDragValue=e=>this.setState({dragValue:e});dragStop=()=>{let{label:e,onChangeCategory:t}=this.props,{dragValue:n}=this.state;X5(`[dragStop]`,n),n!==void 0&&t({label:e,value:n}),this.setDragValue(void 0)};dragValue=(e,t)=>{X5(`[dragValue] next:`,t),this.setDragValue(t)};render(){let{graphProps:e,value:t,label:n,xBand:r,index:i,interactive:a,correctness:o,barColor:s,defineChart:c,correctData:l}=this.props,{scale:u,range:d}=e,{dragValue:f,isHovered:p}=this.state,m=$5(p,s,i,Q5,a&&!o),h=Number.isFinite(f)?f:t,g=r.bandwidth(),_=u.y(d.max-h),v=r(c5({label:n},i)),y=d.max-h,b=d.max-y,x=l?l.find(e=>e.label===n):null,S=a?J5:q5,C=!!s;return(0,F.jsxs)(`g`,{ref:e=>this.gRef=e,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,onTouchStart:this.handleMouseEnter,onTouchEnd:this.handleMouseLeave,children:[(0,F.jsx)(e7,{x:v,y:u.y(b),width:g,height:_,style:{fill:m}}),o&&o.value===`incorrect`&&(()=>{let e=parseFloat(x&&x.value);if(isNaN(e))return null;let t=u.y(d.max-e),n=_,r=Math.abs(t-n),i=u.y(e),a=t>n?mu():V.WHITE,o=t>n?i:i-r;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(e7,{x:v+2,y:o,width:g-4,height:r,style:{stroke:a,strokeWidth:2,strokeDasharray:`5,2`,fill:`none`}}),(0,F.jsx)(`foreignObject`,{x:v+g-(C?24:14),y:i-12,width:24,height:24,children:(0,F.jsx)(Y5,{dashColor:a})})]})})(),(0,F.jsx)(S,{x:v,y:h,defineChart:c,interactive:a,width:g,onDrag:e=>this.dragValue(t,e),onDragStop:this.dragStop,graphProps:e,correctness:o,isHovered:p,color:m})]})}},n7=class extends P.Component{static propTypes={data:v.array,correctData:v.array,onChangeCategory:v.func,defineChart:v.bool,xBand:v.func,graphProps:C$.isRequired,histogram:v.bool};render(){let{data:e,graphProps:t,xBand:n,onChangeCategory:r,defineChart:i,histogram:a,correctData:o}=this.props;return(0,F.jsx)(F6,{children:(e||[]).map((e,s)=>(0,F.jsx)(t7,{value:e.value,interactive:i||e.interactive,defineChart:i,label:e.label,xBand:n,index:s,onChangeCategory:e=>r(s,e),graphProps:t,correctness:e.correctness,correctData:o,barColor:a&&(Z5[s]?Z5[s]:Z5[s%Z5.length])},`bar-${e.label}-${e.value}-${s}`))})}},r7=class extends P.Component{static propTypes={data:v.array,onChange:v.func,graphProps:C$.isRequired};render(){let e=this.props,{data:t,graphProps:n}=e,{scale:r={},size:i={}}=n||{},a=l5(r.x,t,i.width,`bar`);return(0,F.jsx)(n7,{...e,xBand:a})}},i7=()=>({type:`bar`,Component:r7,name:`Bar`}),a7=class extends P.Component{static propTypes={data:v.array,onChange:v.func,graphProps:C$.isRequired};render(){let e=this.props,{data:t,graphProps:n}=e,{scale:r={},size:i={}}=n||{},a=l5(r.x,t,i.width,`histogram`);return(0,F.jsx)(n7,{...e,xBand:a,histogram:!0})}},o7=()=>({type:`histogram`,Component:a7,name:`Histogram`}),s7=R(`g`)(({theme:e})=>({color:`black`,"& .handle":{transition:`fill 200ms linear, height 200ms linear`,"&.non-interactive":b5(`fill`)},"& .transparentHandle":{height:`20px`,fill:`transparent`,stroke:`transparent`},"& .line":{stroke:V.TEXT,transition:`fill 200ms linear, height 200ms linear`,"&.non-interactive":b5(`stroke`)},"& .disabledPoint":{fill:V.BLACK+` !important`,stroke:V.BLACK+` !important`},"& .correctIcon":{backgroundColor:Bl()},"& .incorrectIcon":{backgroundColor:Gl()},"& .correctnessIcon":{borderRadius:e.spacing(2),color:V.WHITE,fontSize:`16px`,width:`16px`,height:`16px`,padding:`2px`,border:`1px solid ${V.WHITE}`,stroke:`initial`,boxSizing:`unset`},"& .smallIcon":{fontSize:`10px`,width:`10px`,height:`10px`}})),c7=class extends P.Component{static propTypes={x:v.number.isRequired,y:v.number.isRequired,width:v.number,graphProps:C$.isRequired,className:v.string,interactive:v.bool,CustomDraggableComponent:v.func,correctness:v.shape({value:v.string,label:v.string})};render(){let{x:e,y:t,graphProps:n,className:r,interactive:i,CustomDraggableComponent:a,correctness:o,...s}=this.props,{scale:c}=n;return a?(0,F.jsx)(s7,{children:(0,F.jsx)(a,{scale:c,x:e,y:t,className:I(r,!i&&`non-interactive`),correctness:o,interactive:i,...s})}):null}},l7=i0({axis:`y`,fromDelta:(e,t)=>(t.x=0,j$(e).add(j$(t)).y),bounds:(e,{domain:t,range:n})=>A$({left:0,top:e.y,bottom:e.y,right:0},t,n),anchorPoint:e=>({x:e.x,y:e.y})})(c7),u7=(e,t)=>{let{max:n}=t||{},r=e.length;return!n||!r?[]:e.map((e,t)=>({...e,x:r>1?t*(n/(r-1)):.5,y:e.value}))},d7=R(L6)(()=>({fill:`transparent`,stroke:V.TERTIARY,strokeWidth:3,transition:`stroke 200ms ease-in, stroke-width 200ms ease-in`})),f7=R(class extends P.Component{static propTypes={onChange:v.func,value:v.number,label:v.string,xBand:v.func,index:v.number.isRequired,graphProps:C$.isRequired,defineChart:v.bool,data:v.arrayOf(v.shape({label:v.string,value:v.number})),CustomDraggableComponent:v.func,correctData:v.array};static defaultProps={index:0};constructor(e){super(e),this.state={dragValue:void 0,line:u7(e.data,e.graphProps.domain)}}UNSAFE_componentWillReceiveProps(e){zp(this.props.data,e.data)||this.setState({line:u7(e.data,e.graphProps.domain)})}setDragValue=e=>this.setState({line:e});dragStop=e=>{let{onChange:t}=this.props;this.setState({dragging:!1},()=>{t(e,this.state.line[e])})};dragValue=(e,t,n)=>{let r=[...this.state.line];r[e].dragValue=n,this.setDragValue(r)};render(){let{graphProps:e,data:t,CustomDraggableComponent:n,defineChart:r,correctData:i}=this.props,{line:a,dragging:o}=this.state,{scale:s}=e,c=o?a:u7(t,e.domain);return(0,F.jsxs)(P.Fragment,{children:[(0,F.jsx)(d7,{data:c,x:e=>s.x(e.x),y:e=>s.y(e.dragValue===void 0?e.y:e.dragValue),className:`line`}),c&&c.map((t,a)=>{let o=r||t.interactive;return(0,F.jsx)(o?l7:c7,{x:t.x,y:t.dragValue===void 0?t.y:t.dragValue,interactive:o,r:6,onDragStart:()=>this.setState({dragging:!0}),onDrag:e=>this.dragValue(a,t.dragValue===void 0?t.y:t.dragValue,e),onDragStop:()=>this.dragStop(a),graphProps:e,CustomDraggableComponent:n,correctness:t.correctness,correctData:i,label:t.label},`point-${t.x}-${a}`)})]})}})(()=>({"& .line":{fill:`transparent`,stroke:V.TERTIARY,strokeWidth:3,transition:`stroke 200ms ease-in, stroke-width 200ms ease-in`}})),p7=class extends P.Component{static propTypes={data:v.array,onChange:v.func,xBand:v.func,graphProps:C$.isRequired,CustomDraggableComponent:v.func,defineChart:v.bool,correctData:v.array};changeLine=(e,t)=>{let{onChange:n}=this.props,r=[...this.props.data],{dragValue:i,value:a}=t;r[e].value=i>=0?i:a,n(r)};render(){let e=this.props;return(0,F.jsx)(F6,{children:(0,F.jsx)(f7,{...e,onChange:this.changeLine})})}},m7=R(`circle`)(()=>({})),h7=R(`circle`)(()=>({height:`20px`,fill:`transparent`,stroke:`none`,pointerEvents:`auto`})),g7=({scale:e,x:t,y:n,r,correctness:i,interactive:a,correctData:o,label:s,...c})=>{let[l,u]=P.useState(!1),d=!i&&a;return(0,F.jsxs)(`g`,{onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),onTouchStart:()=>u(!0),onTouchEnd:()=>u(!1),children:[(0,F.jsx)(h7,{cx:e.x(t),cy:e.y(n),r:r*3,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),...c}),(0,F.jsx)(m7,{cx:e.x(t),cy:e.y(n),r,correctness:i,interactive:a,...c}),(0,F.jsx)(a5,{scale:e,x:t,y:n,r,correctness:i,interactive:a}),(0,F.jsx)(o5,{scale:e,x:t,r,correctness:i,correctData:o,label:s}),l&&d&&(0,F.jsx)(`rect`,{x:e.x(t)-r*2,y:e.y(n)-r*2,width:r*4,height:r*4,stroke:V.BORDER_GRAY,strokeWidth:`1`,fill:`none`})]})};g7.propTypes={scale:v.object,x:v.number,y:v.number,r:v.number,correctness:v.shape({value:v.string,label:v.string}),interactive:v.bool,correctData:v.array,label:v.string};var _7=class extends P.Component{static propTypes={data:v.array,onChange:v.func,graphProps:C$.isRequired};render(){let e=this.props,{data:t,graphProps:n}=e,{scale:r={},size:i={}}=n||{},a=l5(r.x,t,i.width,`lineDot`);return(0,F.jsx)(p7,{...e,xBand:a,CustomDraggableComponent:g7})}},v7=()=>({type:`lineDot`,Component:_7,name:`Line Dot`}),y7=R(L6)(()=>({stroke:V.TEXT,transition:`fill 200ms linear, height 200ms linear`,"&.non-interactive":{stroke:Ll?.()||`#ccc`}})),b7=R(F6)(({correctness:e,interactive:t})=>({stroke:V.TEXT,transition:`fill 200ms linear, height 200ms linear`,...e&&!t&&{fill:`${V.BLACK} !important`,stroke:`${V.BLACK} !important`},"&.non-interactive":{stroke:Ll?.()||`#ccc`}})),x7=R(`circle`)(()=>({height:`20px`,fill:`transparent`,stroke:`transparent`})),S7=e=>{let{className:t,scale:n,x:r,y:i,r:a,correctness:o,interactive:s,correctData:c,label:l,...u}=e,[d,f]=(0,P.useState)(!1),p=a*4,m=p/2,h=n.x(r),g=n.y(i);return(0,F.jsxs)(b7,{className:t,correctness:o,interactive:s,children:[(0,F.jsx)(y7,{data:[{x:n.x(r)-a,y:n.y(i)+a},{x:n.x(r)+a,y:n.y(i)-a}],x:e=>e.x,y:e=>e.y,strokeWidth:5,style:{pointerEvents:`none`}},`point-${r}-${i}-1`),(0,F.jsx)(y7,{data:[{x:n.x(r)-a,y:n.y(i)-a},{x:n.x(r)+a,y:n.y(i)+a}],x:e=>e.x,y:e=>e.y,strokeWidth:5,style:{pointerEvents:`none`}},`point-${r}-${i}-2`),d&&(0,F.jsx)(`rect`,{x:h-m,y:g-m,width:p,height:p,stroke:V.BORDER_GRAY,fill:`none`,strokeWidth:2,pointerEvents:`none`}),(0,F.jsx)(x7,{cx:h,cy:g,r:a*2,onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),...u}),(0,F.jsx)(a5,{scale:n,x:r,y:i,r:a,correctness:o,interactive:s}),(0,F.jsx)(o5,{scale:n,x:r,r:a,correctness:o,correctData:c,label:l})]})};S7.propTypes={scale:v.object,x:v.number,y:v.number,r:v.number,className:v.string,correctness:v.shape({value:v.string,label:v.string}),interactive:v.bool,correctData:v.array,label:v.string};var C7=class extends P.Component{static propTypes={data:v.array,onChange:v.func,graphProps:C$.isRequired};render(){let e=this.props,{data:t,graphProps:n}=e,{scale:r={},size:i={}}=n||{},a=l5(r.x,t,i.width,`lineCross`);return(0,F.jsx)(p7,{...e,xBand:a,CustomDraggableComponent:S7})}},w7=()=>({type:`lineCross`,Component:C7,name:`Line Cross`}),T7=Uu(`pie-lib:chart:bars`),E7=16,D7=R(class extends P.Component{static propTypes={onChangeCategory:v.func,value:v.number,label:v.string,xBand:v.func,index:v.number.isRequired,graphProps:C$.isRequired,CustomBarElement:v.func,interactive:v.bool,correctness:v.shape({value:v.string,label:v.string}),defineChart:v.bool,correctData:v.arrayOf(v.shape({value:v.oneOfType([v.string,v.number]),label:v.string})),className:v.string};constructor(e){super(e),this.state={dragValue:void 0,isHovered:!1}}handleMouseEnter=()=>{this.setState({isHovered:!0})};handleMouseLeave=()=>{this.setState({isHovered:!1})};setDragValue=e=>this.setState({dragValue:e});dragStop=()=>{let{label:e,onChangeCategory:t}=this.props,{dragValue:n}=this.state;T7(`[dragStop]`,n),n!==void 0&&t({label:e,value:n}),this.setDragValue(void 0)};dragValue=(e,t)=>{T7(`[dragValue] next:`,t),this.setDragValue(t)};renderCorrectnessIcon=(e,t,n,r,i,a,o)=>{let s;if(n===0)s=i.y(0)-E7/2;else{let e=n-1;s=i.y(e)-(a-o)/2-o/2-E7/2}return(0,F.jsx)(`foreignObject`,{x:e+t/2-E7/2,y:s,width:E7,height:E7,children:(0,F.jsx)(hR,{className:`correctnessIcon correctIcon smallIcon`,title:r.label})})};render(){let{graphProps:e,value:t,label:n,xBand:r,index:i,CustomBarElement:a,interactive:o,correctness:s,defineChart:c,correctData:l,className:u}=this.props,{scale:d,range:f,size:p}=e,{max:m}=f||{},{dragValue:h,isHovered:g}=this.state,_=Number.isFinite(h)?h:t,v=r.bandwidth(),y=d.y(f.max-_),b=r(c5({label:n},i));T7(`label:`,n,`barX:`,b,`v: `,_,`barHeight:`,y,`barWidth: `,v);let x=[];for(let e=0;e<_;e++)x.push(e);let S=p.height/m,C=(S>v?v:S)*.8,w=o?J5:q5,T=o&&!s;return(0,F.jsx)(P.Fragment,{children:(0,F.jsxs)(`g`,{className:u,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,onTouchStart:this.handleMouseEnter,onTouchEnd:this.handleMouseLeave,children:[g&&T&&(0,F.jsx)(`rect`,{x:b,y:d.y(_),width:v,height:x?.length?S*x.length:0,stroke:V.BORDER_GRAY,strokeWidth:`4px`,fill:`transparent`}),x.map(e=>a({index:e,pointDiameter:C,barX:b,barWidth:v,pointHeight:S,label:n,value:t,scale:d})),s&&s.value===`incorrect`&&(()=>{let e=parseFloat(l[i]&&l[i].value);if(isNaN(e))return null;let o=_;if(e===0)return this.renderCorrectnessIcon(b,v,e,s,d,S,C);if(o>e){let o=[];for(let t=0;t<e;t++)o.push(t);let c=o[o.length-1],l=r(c5({label:n},i)),u=r.bandwidth(),f=p.height/m,h=(f>u?u:f)*.8;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(a,{index:c,pointDiameter:h+10,barX:l,barWidth:u,pointHeight:f,label:n,value:t,scale:d,dottedOverline:!0}),this.renderCorrectnessIcon(l,u,e,s,d,f,h)]})}let c=[];for(let t=o;t<e;t++)c.push(t);return(0,F.jsxs)(F.Fragment,{children:[c.map(e=>a({index:e,pointDiameter:C,barX:b,barWidth:v,pointHeight:S,label:n,value:t,scale:d,dottedOverline:!0})),this.renderCorrectnessIcon(b,v,e,s,d,S,C)]})})(),(0,F.jsx)(w,{x:b,y:_,interactive:o,width:v,onDrag:e=>this.dragValue(t,e),onDragStop:this.dragStop,graphProps:e,correctness:s,isHovered:g,defineChart:c,color:Zl(),isPlot:!0})]})})}})(({theme:e})=>({"& .dot":{fill:Ru.PLOT_FILL_COLOR,"&.correct":x5(`stroke`),"&.incorrect":S5(`stroke`)},"& .dotColor":{fill:Ru.PLOT_FILL_COLOR,"&.correct":x5(`fill`),"&.incorrect":S5(`fill`)},"& .line":{stroke:Ru.PLOT_FILL_COLOR,"&.correct":x5(`stroke`),"&.incorrect":S5(`stroke`)},"& .correctIcon":{backgroundColor:Bl()},"& .incorrectIcon":{backgroundColor:Gl()},"& .correctnessIcon":{borderRadius:e.spacing(2),color:V.WHITE,fontSize:`16px`,width:`16px`,height:`16px`,padding:`2px`,border:`1px solid ${V.WHITE}`,stroke:`initial`,boxSizing:`unset`,display:`block`},"& .smallIcon":{fontSize:`10px`,width:`10px`,height:`10px`}})),O7=class extends P.Component{static propTypes={data:v.array,onChangeCategory:v.func,xBand:v.func,graphProps:C$.isRequired,defineChart:v.bool,CustomBarElement:v.func,correctData:v.arrayOf(v.shape({value:v.oneOfType([v.string,v.number]),label:v.string})),className:v.string};render(){let{data:e,graphProps:t,xBand:n,CustomBarElement:r,onChangeCategory:i,defineChart:a,correctData:o}=this.props;return(0,F.jsx)(F6,{children:(e||[]).map((e,s)=>(0,F.jsx)(D7,{value:e.value,label:e.label,interactive:a||e.interactive,defineChart:a,xBand:n,index:s,onChangeCategory:e=>i(s,e),graphProps:t,CustomBarElement:r,correctness:e.correctness,correctData:o},`bar-${e.label}-${e.value}-${s}`))})}},k7=R(z6)(()=>({fill:Ru.PLOT_FILL_COLOR,"&.correct":x5(`stroke`),"&.incorrect":S5(`stroke`)})),A7=e=>{let{index:t,pointDiameter:n,barX:r,barWidth:i,pointHeight:a,label:o,value:s,scale:c,dottedOverline:l}=e,u=n/2,d=r+(i-n)/2+u,f=c.y(t)-(a-n)/2-u;return l?(0,F.jsx)(z6,{cx:d,cy:f,r:u+2,strokeDasharray:`4,4`,stroke:V.BORDER_GRAY,fill:`none`},`point-${o}-${s}-${t}`):(0,F.jsx)(k7,{cx:d,cy:f,r:u},`point-${o}-${s}-${t}`)};A7.propTypes={index:v.number,pointDiameter:v.number,barX:v.number,barWidth:v.number,pointHeight:v.number,value:v.number,label:v.string,scale:v.object,dottedOverline:v.bool};var j7=class extends P.Component{static propTypes={data:v.array,onChange:v.func,graphProps:C$.isRequired};render(){let e=this.props,{data:t,graphProps:n}=e,{scale:r={},size:i={}}=n||{},a=l5(r.x,t,i.width,`dotPlot`);return(0,F.jsx)(O7,{...e,xBand:a,CustomBarElement:A7})}},M7=()=>({type:`dotPlot`,Component:j7,name:`Dot Plot`}),N7=R(L6)(()=>({stroke:Ru.PLOT_FILL_COLOR,"&.correct":x5(`stroke`),"&.incorrect":S5(`stroke`)})),P7=e=>{let{index:t,pointDiameter:n,barX:r,barWidth:i,pointHeight:a,label:o,value:s,scale:c,dottedOverline:l}=e,u=r+(i-n)/2,d=c.y(t)-(a-n)/2;return l?(0,F.jsx)(`rect`,{x:u-2,y:d-n-2,width:n+4,height:n+4,strokeDasharray:`4,4`,stroke:V.BORDER_GRAY,fill:`none`},`point-${o}-${s}-${t}`):(0,F.jsxs)(F6,{children:[(0,F.jsx)(N7,{data:[{x:u,y:d},{x:u+n,y:d-n}],className:`line`,x:e=>e.x,y:e=>e.y,strokeWidth:n/5},`point-${o}-${s}-${t}-1`),(0,F.jsx)(N7,{data:[{x:u,y:d-n},{x:u+n,y:d}],x:e=>e.x,y:e=>e.y,strokeWidth:n/5,className:`line`},`point-${o}-${s}-${t}-2`)]})};P7.propTypes={index:v.number,pointDiameter:v.number,barX:v.number,barWidth:v.number,pointHeight:v.number,value:v.number,label:v.string,scale:v.object,dottedOverline:v.bool};var F7=class extends P.Component{static propTypes={data:v.array,onChange:v.func,graphProps:C$.isRequired};render(){let e=this.props,{data:t,graphProps:n}=e,{scale:r={},size:i={}}=n||{},a=l5(r.x,t,i.width,`linePlot`);return(0,F.jsx)(O7,{...e,xBand:a,CustomBarElement:P7})}},I7={Bar:i7,Histogram:o7,LineDot:v7,DotPlot:M7,LinePlot:()=>({type:`linePlot`,Component:F7,name:`Line Plot`}),LineCross:w7},L7=e=>typeof e==`string`,R7=()=>{let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},z7=e=>e==null?``:``+e,B7=(e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})},V7=/###/g,H7=e=>e&&e.indexOf(`###`)>-1?e.replace(V7,`.`):e,U7=e=>!e||L7(e),W7=(e,t,n)=>{let r=L7(t)?t.split(`.`):t,i=0;for(;i<r.length-1;){if(U7(e))return{};let t=H7(r[i]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++i}return U7(e)?{}:{obj:e,k:H7(r[i])}},G7=(e,t,n)=>{let{obj:r,k:i}=W7(e,t,Object);if(r!==void 0||t.length===1){r[i]=n;return}let a=t[t.length-1],o=t.slice(0,t.length-1),s=W7(e,o,Object);for(;s.obj===void 0&&o.length;)a=`${o[o.length-1]}.${a}`,o=o.slice(0,o.length-1),s=W7(e,o,Object),s?.obj&&s.obj[`${s.k}.${a}`]!==void 0&&(s.obj=void 0);s.obj[`${s.k}.${a}`]=n},K7=(e,t,n,r)=>{let{obj:i,k:a}=W7(e,t,Object);i[a]=i[a]||[],i[a].push(n)},q7=(e,t)=>{let{obj:n,k:r}=W7(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},J7=(e,t,n)=>{let r=q7(e,n);return r===void 0?q7(t,n):r},Y7=(e,t,n)=>{for(let r in t)r!==`__proto__`&&r!==`constructor`&&(r in e?L7(e[r])||e[r]instanceof String||L7(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):Y7(e[r],t[r],n):e[r]=t[r]);return e},X7=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,`\\$&`),Z7={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`,"/":`/`},Q7=e=>L7(e)?e.replace(/[&<>"'\/]/g,e=>Z7[e]):e,$7=class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){let t=this.regExpMap.get(e);if(t!==void 0)return t;let n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}},e9=[` `,`,`,`?`,`!`,`;`],t9=new $7(20),n9=(e,t,n)=>{t||=``,n||=``;let r=e9.filter(e=>t.indexOf(e)<0&&n.indexOf(e)<0);if(r.length===0)return!0;let i=t9.getRegExp(`(${r.map(e=>e===`?`?`\\?`:e).join(`|`)})`),a=!i.test(e);if(!a){let t=e.indexOf(n);t>0&&!i.test(e.substring(0,t))&&(a=!0)}return a},r9=(e,t,n=`.`)=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;let r=t.split(n),i=e;for(let e=0;e<r.length;){if(!i||typeof i!=`object`)return;let t,a=``;for(let o=e;o<r.length;++o)if(o!==e&&(a+=n),a+=r[o],t=i[a],t!==void 0){if([`string`,`number`,`boolean`].indexOf(typeof t)>-1&&o<r.length-1)continue;e+=o-e+1;break}i=t}return i},i9=e=>e?.replace(/_/g,`-`),a9={type:`logger`,log(e){this.output(`log`,e)},warn(e){this.output(`warn`,e)},error(e){this.output(`error`,e)},output(e,t){console?.[e]?.apply?.(console,t)}},o9=new class e{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||`i18next:`,this.logger=e||a9,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,`log`,``,!0)}warn(...e){return this.forward(e,`warn`,``,!0)}error(...e){return this.forward(e,`error`,``)}deprecate(...e){return this.forward(e,`warn`,`WARNING DEPRECATED: `,!0)}forward(e,t,n,r){return r&&!this.debug?null:(L7(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(t){return new e(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t||=this.options,t.prefix=t.prefix||this.prefix,new e(this.logger,t)}},s9=class{constructor(){this.observers={}}on(e,t){return e.split(` `).forEach(e=>{this.observers[e]||(this.observers[e]=new Map);let n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([e,n])=>{for(let r=0;r<n;r++)e(...t)}),this.observers[`*`]&&Array.from(this.observers[`*`].entries()).forEach(([n,r])=>{for(let i=0;i<r;i++)n.apply(n,[e,...t])})}},c9=class extends s9{constructor(e,t={ns:[`translation`],defaultNS:`translation`}){super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){let t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n,r={}){let i=r.keySeparator===void 0?this.options.keySeparator:r.keySeparator,a=r.ignoreJSONStructure===void 0?this.options.ignoreJSONStructure:r.ignoreJSONStructure,o;e.indexOf(`.`)>-1?o=e.split(`.`):(o=[e,t],n&&(Array.isArray(n)?o.push(...n):L7(n)&&i?o.push(...n.split(i)):o.push(n)));let s=q7(this.data,o);return!s&&!t&&!n&&e.indexOf(`.`)>-1&&(e=o[0],t=o[1],n=o.slice(2).join(`.`)),s||!a||!L7(n)?s:r9(this.data?.[e]?.[t],n,i)}addResource(e,t,n,r,i={silent:!1}){let a=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,o=[e,t];n&&(o=o.concat(a?n.split(a):n)),e.indexOf(`.`)>-1&&(o=e.split(`.`),r=t,t=o[1]),this.addNamespaces(t),G7(this.data,o,r),i.silent||this.emit(`added`,e,t,n,r)}addResources(e,t,n,r={silent:!1}){for(let r in n)(L7(n[r])||Array.isArray(n[r]))&&this.addResource(e,t,r,n[r],{silent:!0});r.silent||this.emit(`added`,e,t,n)}addResourceBundle(e,t,n,r,i,a={silent:!1,skipCopy:!1}){let o=[e,t];e.indexOf(`.`)>-1&&(o=e.split(`.`),r=n,n=t,t=o[1]),this.addNamespaces(t);let s=q7(this.data,o)||{};a.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?Y7(s,n,i):s={...s,...n},G7(this.data,o,s),a.silent||this.emit(`added`,e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit(`removed`,e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||=this.options.defaultNS,this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){let t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}},l9={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(e=>{t=this.processors[e]?.process(t,n,r,i)??t}),t}},u9=Symbol(`i18next/PATH_KEY`);function d9(){let e=[],t=Object.create(null),n;return t.get=(r,i)=>(n?.revoke?.(),i===u9?e:(e.push(i),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function f9(e,t){let{[u9]:n}=e(d9()),r=t?.keySeparator??`.`,i=t?.nsSeparator??`:`;if(n.length>1&&i){let e=t?.ns,a=Array.isArray(e)?e:null;if(a&&a.length>1&&a.slice(1).includes(n[0]))return`${n[0]}${i}${n.slice(1).join(r)}`}return n.join(r)}var p9={},m9=e=>!L7(e)&&typeof e!=`boolean`&&typeof e!=`number`,h9=class e extends s9{constructor(e,t={}){super(),B7([`resourceStore`,`languageUtils`,`pluralResolver`,`interpolator`,`backendConnector`,`i18nFormat`,`utils`],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.logger=o9.create(`translator`)}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){let n={...t};if(e==null)return!1;let r=this.resolve(e,n);if(r?.res===void 0)return!1;let i=m9(r.res);return!(n.returnObjects===!1&&i)}extractFromKey(e,t){let n=t.nsSeparator===void 0?this.options.nsSeparator:t.nsSeparator;n===void 0&&(n=`:`);let r=t.keySeparator===void 0?this.options.keySeparator:t.keySeparator,i=t.ns||this.options.defaultNS||[],a=n&&e.indexOf(n)>-1,o=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!n9(e,n,r);if(a&&!o){let t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:L7(i)?[i]:i};let a=e.split(n);(n!==r||n===r&&this.options.ns.indexOf(a[0])>-1)&&(i=a.shift()),e=a.join(r)}return{key:e,namespaces:L7(i)?[i]:i}}translate(t,n,r){let i=typeof n==`object`?{...n}:n;if(typeof i!=`object`&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),typeof i==`object`&&(i={...i}),i||={},t==null)return``;typeof t==`function`&&(t=f9(t,{...this.options,...i})),Array.isArray(t)||(t=[String(t)]),t=t.map(e=>typeof e==`function`?f9(e,{...this.options,...i}):String(e));let a=i.returnDetails===void 0?this.options.returnDetails:i.returnDetails,o=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,{key:s,namespaces:c}=this.extractFromKey(t[t.length-1],i),l=c[c.length-1],u=i.nsSeparator===void 0?this.options.nsSeparator:i.nsSeparator;u===void 0&&(u=`:`);let d=i.lng||this.language,f=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d?.toLowerCase()===`cimode`)return f?a?{res:`${l}${u}${s}`,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:`${l}${u}${s}`:a?{res:s,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:s;let p=this.resolve(t,i),m=p?.res,h=p?.usedKey||s,g=p?.exactUsedKey||s,_=[`[object Number]`,`[object Function]`,`[object RegExp]`],v=i.joinArrays===void 0?this.options.joinArrays:i.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject,b=i.count!==void 0&&!L7(i.count),x=e.hasDefaultValue(i),S=b?this.pluralResolver.getSuffix(d,i.count,i):``,C=i.ordinal&&b?this.pluralResolver.getSuffix(d,i.count,{ordinal:!1}):``,w=b&&!i.ordinal&&i.count===0,T=w&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${S}`]||i[`defaultValue${C}`]||i.defaultValue,E=m;y&&!m&&x&&(E=T);let D=m9(E),O=Object.prototype.toString.apply(E);if(y&&E&&D&&_.indexOf(O)<0&&!(L7(v)&&Array.isArray(E))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn(`accessing an object - but returnObjects options is not enabled!`);let e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,E,{...i,ns:c}):`key '${s} (${this.language})' returned an object instead of string.`;return a?(p.res=e,p.usedParams=this.getUsedParamsDetails(i),p):e}if(o){let e=Array.isArray(E),t=e?[]:{},n=e?g:h;for(let e in E)if(Object.prototype.hasOwnProperty.call(E,e)){let r=`${n}${o}${e}`;x&&!m?t[e]=this.translate(r,{...i,defaultValue:m9(T)?T[e]:void 0,joinArrays:!1,ns:c}):t[e]=this.translate(r,{...i,joinArrays:!1,ns:c}),t[e]===r&&(t[e]=E[e])}m=t}}else if(y&&L7(v)&&Array.isArray(m))m=m.join(v),m&&=this.extendTranslation(m,t,i,r);else{let e=!1,n=!1;!this.isValidLookup(m)&&x&&(e=!0,m=T),this.isValidLookup(m)||(n=!0,m=s);let a=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&n?void 0:m,c=x&&T!==m&&this.options.updateMissing;if(n||e||c){if(this.logger.log(c?`updateKey`:`missingKey`,d,l,s,c?T:m),o){let e=this.resolve(s,{...i,keySeparator:!1});e&&e.res&&this.logger.warn(`Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.`)}let e=[],t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo===`fallback`&&t&&t[0])for(let n=0;n<t.length;n++)e.push(t[n]);else this.options.saveMissingTo===`all`?e=this.languageUtils.toResolveHierarchy(i.lng||this.language):e.push(i.lng||this.language);let n=(e,t,n)=>{let r=x&&n!==m?n:a;this.options.missingKeyHandler?this.options.missingKeyHandler(e,l,t,r,c,i):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,l,t,r,c,i),this.emit(`missingKey`,e,l,t,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&b?e.forEach(e=>{let t=this.pluralResolver.getSuffixes(e,i);w&&i[`defaultValue${this.options.pluralSeparator}zero`]&&t.indexOf(`${this.options.pluralSeparator}zero`)<0&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{n([e],s+t,i[`defaultValue${t}`]||T)})}):n(e,s,T))}m=this.extendTranslation(m,t,i,p,r),n&&m===s&&this.options.appendNamespaceToMissingKey&&(m=`${l}${u}${s}`),(n||e)&&this.options.parseMissingKeyHandler&&(m=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${u}${s}`:s,e?m:void 0,i))}return a?(p.res=m,p.usedParams=this.getUsedParamsDetails(i),p):m}extendTranslation(e,t,n,r,i){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});let a=L7(e)&&(n?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:n.interpolation.skipOnVariables),o;if(a){let t=e.match(this.interpolator.nestingRegexp);o=t&&t.length}let s=n.replace&&!L7(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),e=this.interpolator.interpolate(e,s,n.lng||this.language||r.usedLng,n),a){let t=e.match(this.interpolator.nestingRegexp),r=t&&t.length;o<r&&(n.nest=!1)}!n.lng&&r&&r.res&&(n.lng=this.language||r.usedLng),n.nest!==!1&&(e=this.interpolator.nest(e,(...e)=>i?.[0]===e[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null):this.translate(...e,t),n)),n.interpolation&&this.interpolator.reset()}let a=n.postProcess||this.options.postProcess,o=L7(a)?[a]:a;return e!=null&&o?.length&&n.applyPostProcessor!==!1&&(e=l9.handle(o,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,t={}){let n,r,i,a,o;return L7(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(e=>typeof e==`function`?f9(e,{...this.options,...t}):e)),e.forEach(e=>{if(this.isValidLookup(n))return;let s=this.extractFromKey(e,t),c=s.key;r=c;let l=s.namespaces;this.options.fallbackNS&&(l=l.concat(this.options.fallbackNS));let u=t.count!==void 0&&!L7(t.count),d=u&&!t.ordinal&&t.count===0,f=t.context!==void 0&&(L7(t.context)||typeof t.context==`number`)&&t.context!==``,p=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);l.forEach(e=>{this.isValidLookup(n)||(o=e,!p9[`${p[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(o)&&(p9[`${p[0]}-${e}`]=!0,this.logger.warn(`key "${r}" for languages "${p.join(`, `)}" won't get resolved as namespace "${o}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`)),p.forEach(r=>{if(this.isValidLookup(n))return;a=r;let o=[c];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(o,c,r,e,t);else{let e;u&&(e=this.pluralResolver.getSuffix(r,t.count,t));let n=`${this.options.pluralSeparator}zero`,i=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(u&&(t.ordinal&&e.indexOf(i)===0&&o.push(c+e.replace(i,this.options.pluralSeparator)),o.push(c+e),d&&o.push(c+n)),f){let r=`${c}${this.options.contextSeparator||`_`}${t.context}`;o.push(r),u&&(t.ordinal&&e.indexOf(i)===0&&o.push(r+e.replace(i,this.options.pluralSeparator)),o.push(r+e),d&&o.push(r+n))}}let s;for(;s=o.pop();)this.isValidLookup(n)||(i=s,n=this.getResource(r,e,s,t))}))})}),{res:n,usedKey:r,exactUsedKey:i,usedLng:a,usedNS:o}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e===``)}getResource(e,t,n,r={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}getUsedParamsDetails(e={}){let t=[`defaultValue`,`ordinal`,`context`,`replace`,`lng`,`lngs`,`fallbackLng`,`ns`,`keySeparator`,`nsSeparator`,`returnObjects`,`returnDetails`,`joinArrays`,`postProcess`,`interpolation`],n=e.replace&&!L7(e.replace),r=n?e.replace:e;if(n&&e.count!==void 0&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!n){r={...r};for(let e of t)delete r[e]}return r}static hasDefaultValue(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&t.substring(0,12)===`defaultValue`&&e[t]!==void 0)return!0;return!1}},g9=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=o9.create(`languageUtils`)}getScriptPartFromCode(e){if(e=i9(e),!e||e.indexOf(`-`)<0)return null;let t=e.split(`-`);return t.length===2||(t.pop(),t[t.length-1].toLowerCase()===`x`)?null:this.formatLanguageCode(t.join(`-`))}getLanguagePartFromCode(e){if(e=i9(e),!e||e.indexOf(`-`)<0)return e;let t=e.split(`-`);return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(L7(e)&&e.indexOf(`-`)>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load===`languageOnly`||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;let n=this.formatLanguageCode(e);(!this.options.supportedLngs||this.isSupportedCode(n))&&(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;let n=this.getScriptPartFromCode(e);if(this.isSupportedCode(n))return t=n;let r=this.getLanguagePartFromCode(e);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(e=>{if(e===r||!(e.indexOf(`-`)<0&&r.indexOf(`-`)<0)&&(e.indexOf(`-`)>0&&r.indexOf(`-`)<0&&e.substring(0,e.indexOf(`-`))===r||e.indexOf(r)===0&&r.length>1))return e})}),t||=this.getFallbackCodes(this.options.fallbackLng)[0],t}getFallbackCodes(e,t){if(!e)return[];if(typeof e==`function`&&(e=e(t)),L7(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||=e[this.getScriptPartFromCode(t)],n||=e[this.formatLanguageCode(t)],n||=e[this.getLanguagePartFromCode(t)],n||=e.default,n||[]}toResolveHierarchy(e,t){let n=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),r=[],i=e=>{e&&(this.isSupportedCode(e)?r.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return L7(e)&&(e.indexOf(`-`)>-1||e.indexOf(`_`)>-1)?(this.options.load!==`languageOnly`&&i(this.formatLanguageCode(e)),this.options.load!==`languageOnly`&&this.options.load!==`currentOnly`&&i(this.getScriptPartFromCode(e)),this.options.load!==`currentOnly`&&i(this.getLanguagePartFromCode(e))):L7(e)&&i(this.formatLanguageCode(e)),n.forEach(e=>{r.indexOf(e)<0&&i(this.formatLanguageCode(e))}),r}},_9={zero:0,one:1,two:2,few:3,many:4,other:5},v9={select:e=>e===1?`one`:`other`,resolvedOptions:()=>({pluralCategories:[`one`,`other`]})},y9=class{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=o9.create(`pluralResolver`),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){let n=i9(e===`dev`?`en`:e),r=t.ordinal?`ordinal`:`cardinal`,i=JSON.stringify({cleanedCode:n,type:r});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let a;try{a=new Intl.PluralRules(n,{type:r})}catch{if(typeof Intl>`u`)return this.logger.error(`No Intl support, please use an Intl polyfill!`),v9;if(!e.match(/-|_/))return v9;let n=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(n,t)}return this.pluralRulesCache[i]=a,a}needsPlural(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t,n={}){return this.getSuffixes(e,n).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?n.resolvedOptions().pluralCategories.sort((e,t)=>_9[e]-_9[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:``}${e}`):[]}getSuffix(e,t,n={}){let r=this.getRule(e,n);return r?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:``}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix(`dev`,t,n))}},b9=(e,t,n,r=`.`,i=!0)=>{let a=J7(e,t,n);return!a&&i&&L7(n)&&(a=r9(e,n,r),a===void 0&&(a=r9(t,n,r))),a},x9=e=>e.replace(/\$/g,`$$$$`),S9=class{constructor(e={}){this.logger=o9.create(`interpolator`),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(e={}){e.interpolation||={escapeValue:!0};let{escape:t,escapeValue:n,useRawValueToEscape:r,prefix:i,prefixEscaped:a,suffix:o,suffixEscaped:s,formatSeparator:c,unescapeSuffix:l,unescapePrefix:u,nestingPrefix:d,nestingPrefixEscaped:f,nestingSuffix:p,nestingSuffixEscaped:m,nestingOptionsSeparator:h,maxReplaces:g,alwaysFormat:_}=e.interpolation;this.escape=t===void 0?Q7:t,this.escapeValue=n===void 0||n,this.useRawValueToEscape=r!==void 0&&r,this.prefix=i?X7(i):a||`{{`,this.suffix=o?X7(o):s||`}}`,this.formatSeparator=c||`,`,this.unescapePrefix=l?``:u||`-`,this.unescapeSuffix=this.unescapePrefix?``:l||``,this.nestingPrefix=d?X7(d):f||X7(`$t(`),this.nestingSuffix=p?X7(p):m||X7(`)`),this.nestingOptionsSeparator=h||`,`,this.maxReplaces=g||1e3,this.alwaysFormat=_!==void 0&&_,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let e=(e,t)=>e?.source===t?(e.lastIndex=0,e):new RegExp(t,`g`);this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,n,r){let i,a,o,s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=e=>{if(e.indexOf(this.formatSeparator)<0){let i=b9(t,s,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(i,void 0,n,{...r,...t,interpolationkey:e}):i}let i=e.split(this.formatSeparator),a=i.shift().trim(),o=i.join(this.formatSeparator).trim();return this.format(b9(t,s,a,this.options.keySeparator,this.options.ignoreJSONStructure),o,n,{...r,...t,interpolationkey:a})};this.resetRegExp();let l=r?.missingInterpolationHandler||this.options.missingInterpolationHandler,u=r?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:r.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>x9(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?x9(this.escape(e)):x9(e)}].forEach(t=>{for(o=0;i=t.regex.exec(e);){let n=i[1].trim();if(a=c(n),a===void 0)if(typeof l==`function`){let t=l(e,i,r);a=L7(t)?t:``}else if(r&&Object.prototype.hasOwnProperty.call(r,n))a=``;else if(u){a=i[0];continue}else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),a=``;else!L7(a)&&!this.useRawValueToEscape&&(a=z7(a));let s=t.safeValue(a);if(e=e.replace(i[0],s),u?(t.regex.lastIndex+=a.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,o++,o>=this.maxReplaces)break}}),e}nest(e,t,n={}){let r,i,a,o=(e,t)=>{let n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;let r=e.split(RegExp(`${X7(n)}[ ]*{`)),i=`{${r[1]}`;e=r[0],i=this.interpolate(i,a);let o=i.match(/'/g),s=i.match(/"/g);((o?.length??0)%2==0&&!s||(s?.length??0)%2!=0)&&(i=i.replace(/'/g,`"`));try{a=JSON.parse(i),t&&(a={...t,...a})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${i}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,e};for(;r=this.nestingRegexp.exec(e);){let s=[];a={...n},a=a.replace&&!L7(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let c=/{.*}/.test(r[1])?r[1].lastIndexOf(`}`)+1:r[1].indexOf(this.formatSeparator);if(c!==-1&&(s=r[1].slice(c).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),r[1]=r[1].slice(0,c)),i=t(o.call(this,r[1].trim(),a),a),i&&r[0]===e&&!L7(i))return i;L7(i)||(i=z7(i)),i||=(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),``),s.length&&(i=s.reduce((e,t)=>this.format(e,t,n.lng,{...n,interpolationkey:r[1].trim()}),i.trim())),e=e.replace(r[0],i),this.regexp.lastIndex=0}return e}},Nee=e=>{let t=e.toLowerCase().trim(),n={};if(e.indexOf(`(`)>-1){let r=e.split(`(`);t=r[0].toLowerCase().trim();let i=r[1].substring(0,r[1].length-1);t===`currency`&&i.indexOf(`:`)<0?n.currency||=i.trim():t===`relativetime`&&i.indexOf(`:`)<0?n.range||=i.trim():i.split(`;`).forEach(e=>{if(e){let[t,...r]=e.split(`:`),i=r.join(`:`).trim().replace(/^'+|'+$/g,``),a=t.trim();n[a]||(n[a]=i),i===`false`&&(n[a]=!1),i===`true`&&(n[a]=!0),isNaN(i)||(n[a]=parseInt(i,10))}})}return{formatName:t,formatOptions:n}},C9=e=>{let t={};return(n,r,i)=>{let a=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(a={...a,[i.interpolationkey]:void 0});let o=r+JSON.stringify(a),s=t[o];return s||(s=e(i9(r),i),t[o]=s),s(n)}},Pee=e=>(t,n,r)=>e(i9(n),r)(t),Fee=class{constructor(e={}){this.logger=o9.create(`formatter`),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||`,`;let n=t.cacheInBuiltFormats?C9:Pee;this.formats={number:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t,style:`currency`});return e=>n.format(e)}),datetime:n((e,t)=>{let n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:n((e,t)=>{let n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||`day`)}),list:n((e,t)=>{let n=new Intl.ListFormat(e,{...t});return e=>n.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=C9(t)}format(e,t,n,r={}){let i=t.split(this.formatSeparator);if(i.length>1&&i[0].indexOf(`(`)>1&&i[0].indexOf(`)`)<0&&i.find(e=>e.indexOf(`)`)>-1)){let e=i.findIndex(e=>e.indexOf(`)`)>-1);i[0]=[i[0],...i.splice(1,e)].join(this.formatSeparator)}return i.reduce((e,t)=>{let{formatName:i,formatOptions:a}=Nee(t);if(this.formats[i]){let t=e;try{let o=r?.formatParams?.[r.interpolationkey]||{},s=o.locale||o.lng||r.locale||r.lng||n;t=this.formats[i](e,s,{...a,...r,...o})}catch(e){this.logger.warn(e)}return t}else this.logger.warn(`there was no format function for ${i}`);return e},e)}},Iee=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)},Lee=class extends s9{constructor(e,t,n,r={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=o9.create(`backendConnector`),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,r.backend,r)}queueLoad(e,t,n,r){let i={},a={},o={},s={};return e.forEach(e=>{let r=!0;t.forEach(t=>{let o=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[o]=2:this.state[o]<0||(this.state[o]===1?a[o]===void 0&&(a[o]=!0):(this.state[o]=1,r=!1,a[o]===void 0&&(a[o]=!0),i[o]===void 0&&(i[o]=!0),s[t]===void 0&&(s[t]=!0)))}),r||(o[e]=!0)}),(Object.keys(i).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(i),pending:Object.keys(a),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(s)}}loaded(e,t,n){let r=e.split(`|`),i=r[0],a=r[1];t&&this.emit(`failedLoading`,i,a,t),!t&&n&&this.store.addResourceBundle(i,a,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);let o={};this.queue.forEach(n=>{K7(n.loaded,[i],a),Iee(n,e),t&&n.errors.push(t),n.pendingCount===0&&!n.done&&(Object.keys(n.loaded).forEach(e=>{o[e]||(o[e]={});let t=n.loaded[e];t.length&&t.forEach(t=>{o[e][t]===void 0&&(o[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit(`loaded`,o),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n,r=0,i=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:i,callback:a});return}this.readingCalls++;let o=(o,s)=>{if(this.readingCalls--,this.waitingReads.length>0){let e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}if(o&&s&&r<this.maxRetries){setTimeout(()=>{this.read.call(this,e,t,n,r+1,i*2,a)},i);return}a(o,s)},s=this.backend[n].bind(this.backend);if(s.length===2){try{let n=s(e,t);n&&typeof n.then==`function`?n.then(e=>o(null,e)).catch(o):o(null,n)}catch(e){o(e)}return}return s(e,t,o)}prepareLoading(e,t,n={},r){if(!this.backend)return this.logger.warn(`No backend was added via i18next.use. Will not load resources.`),r&&r();L7(e)&&(e=this.languageUtils.toResolveHierarchy(e)),L7(t)&&(t=[t]);let i=this.queueLoad(e,t,n,r);if(!i.toLoad.length)return i.pending.length||r(),null;i.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e,t=``){let n=e.split(`|`),r=n[0],i=n[1];this.read(r,i,`read`,void 0,void 0,(n,a)=>{n&&this.logger.warn(`${t}loading namespace ${i} for language ${r} failed`,n),!n&&a&&this.logger.log(`${t}loaded namespace ${i} for language ${r}`,a),this.loaded(e,n,a)})}saveMissing(e,t,n,r,i,a={},o=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(t)){this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`);return}if(!(n==null||n===``)){if(this.backend?.create){let s={...a,isUpdate:i},c=this.backend.create.bind(this.backend);if(c.length<6)try{let i;i=c.length===5?c(e,t,n,r,s):c(e,t,n,r),i&&typeof i.then==`function`?i.then(e=>o(null,e)).catch(o):o(null,i)}catch(e){o(e)}else c(e,t,n,r,o,s)}!e||!e[0]||this.store.addResource(e[0],t,n,r)}}},w9=()=>({debug:!1,initAsync:!0,ns:[`translation`],defaultNS:[`translation`],fallbackLng:[`dev`],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:`all`,preload:!1,simplifyPluralSuffix:!0,keySeparator:`.`,nsSeparator:`:`,pluralSeparator:`_`,contextSeparator:`_`,partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:`fallback`,saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]==`object`&&(t=e[1]),L7(e[1])&&(t.defaultValue=e[1]),L7(e[2])&&(t.tDescription=e[2]),typeof e[2]==`object`||typeof e[3]==`object`){let n=e[3]||e[2];Object.keys(n).forEach(e=>{t[e]=n[e]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:`{{`,suffix:`}}`,formatSeparator:`,`,unescapePrefix:`-`,nestingPrefix:`$t(`,nestingSuffix:`)`,nestingOptionsSeparator:`,`,maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),T9=e=>(L7(e.ns)&&(e.ns=[e.ns]),L7(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),L7(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.(`cimode`)<0&&(e.supportedLngs=e.supportedLngs.concat([`cimode`])),typeof e.initImmediate==`boolean`&&(e.initAsync=e.initImmediate),e),E9=()=>{},Ree=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(t=>{typeof e[t]==`function`&&(e[t]=e[t].bind(e))})},D9=`__i18next_supportNoticeShown`,zee=()=>!!(typeof globalThis<`u`&&globalThis[D9]||typeof process<`u`&&process.env&&process.env.I18NEXT_NO_SUPPORT_NOTICE||typeof process<`u`&&process.env),Bee=()=>{typeof globalThis<`u`&&(globalThis[D9]=!0)},Vee=e=>!!(e?.modules?.backend?.name?.indexOf(`Locize`)>0||e?.modules?.backend?.constructor?.name?.indexOf(`Locize`)>0||e?.options?.backend?.backends&&e.options.backend.backends.some(e=>e?.name?.indexOf(`Locize`)>0||e?.constructor?.name?.indexOf(`Locize`)>0)||e?.options?.backend?.projectId||e?.options?.backend?.backendOptions&&e.options.backend.backendOptions.some(e=>e?.projectId)),O9=class e extends s9{constructor(e={},t){if(super(),this.options=T9(e),this.services={},this.logger=o9,this.modules={external:[]},Ree(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,typeof e==`function`&&(t=e,e={}),e.defaultNS==null&&e.ns&&(L7(e.ns)?e.defaultNS=e.ns:e.ns.indexOf(`translation`)<0&&(e.defaultNS=e.ns[0]));let n=w9();this.options={...n,...this.options,...T9(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!=`function`&&(this.options.overloadTranslationOptionHandler=n.overloadTranslationOptionHandler),this.options.showSupportNotice!==!1&&!Vee(this)&&!zee()&&(typeof console<`u`&&console.info!==void 0&&console.info(`🌐 i18next is made possible by our own product, Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙`),Bee());let r=e=>e?typeof e==`function`?new e:e:null;if(!this.options.isClone){this.modules.logger?o9.init(r(this.modules.logger),this.options):o9.init(null,this.options);let e;e=this.modules.formatter?this.modules.formatter:Fee;let t=new g9(this.options);this.store=new c9(this.options.resources,this.options);let i=this.services;i.logger=o9,i.resourceStore=this.store,i.languageUtils=t,i.pluralResolver=new y9(t,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==n.interpolation.format&&this.logger.deprecate(`init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting`),e&&(!this.options.interpolation.format||this.options.interpolation.format===n.interpolation.format)&&(i.formatter=r(e),i.formatter.init&&i.formatter.init(i,this.options),this.options.interpolation.format=i.formatter.format.bind(i.formatter)),i.interpolator=new S9(this.options),i.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},i.backendConnector=new Lee(r(this.modules.backend),i.resourceStore,i,this.options),i.backendConnector.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(i.languageDetector=r(this.modules.languageDetector),i.languageDetector.init&&i.languageDetector.init(i,this.options.detection,this.options)),this.modules.i18nFormat&&(i.i18nFormat=r(this.modules.i18nFormat),i.i18nFormat.init&&i.i18nFormat.init(this)),this.translator=new h9(this.services,this.options),this.translator.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,t||=E9,this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&e[0]!==`dev`&&(this.options.lng=e[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn(`init: no languageDetector is used and no lng is defined`),[`getResource`,`hasResourceBundle`,`getResourceBundle`,`getDataByLanguage`].forEach(e=>{this[e]=(...t)=>this.store[e](...t)}),[`addResource`,`addResources`,`addResourceBundle`,`removeResourceBundle`].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});let i=R7(),a=()=>{let e=(e,n)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn(`init: i18next is already initialized. You should call init just once!`),this.isInitialized=!0,this.options.isClone||this.logger.log(`initialized`,this.options),this.emit(`initialized`,this.options),i.resolve(n),t(e,n)};if(this.languages&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?a():setTimeout(a,0),i}loadResources(e,t=E9){let n=t,r=L7(e)?e:this.language;if(typeof e==`function`&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(r?.toLowerCase()===`cimode`&&(!this.options.preload||this.options.preload.length===0))return n();let e=[],t=t=>{t&&t!==`cimode`&&this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{t!==`cimode`&&e.indexOf(t)<0&&e.push(t)})};r?t(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e)),this.options.preload?.forEach?.(e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{!e&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(e)})}else n(null)}reloadResources(e,t,n){let r=R7();return typeof e==`function`&&(n=e,e=void 0),typeof t==`function`&&(n=t,t=void 0),e||=this.languages,t||=this.options.ns,n||=E9,this.services.backendConnector.reload(e,t,e=>{r.resolve(),n(e)}),r}use(e){if(!e)throw Error(`You are passing an undefined module! Please check the object you are passing to i18next.use()`);if(!e.type)throw Error(`You are passing a wrong module! Please check the object you are passing to i18next.use()`);return e.type===`backend`&&(this.modules.backend=e),(e.type===`logger`||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type===`languageDetector`&&(this.modules.languageDetector=e),e.type===`i18nFormat`&&(this.modules.i18nFormat=e),e.type===`postProcessor`&&l9.addPostProcessor(e),e.type===`formatter`&&(this.modules.formatter=e),e.type===`3rdParty`&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!([`cimode`,`dev`].indexOf(e)>-1)){for(let e=0;e<this.languages.length;e++){let t=this.languages[e];if(!([`cimode`,`dev`].indexOf(t)>-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;let n=R7();this.emit(`languageChanging`,e);let r=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},i=(i,a)=>{a?this.isLanguageChangingTo===e&&(r(a),this.translator.changeLanguage(a),this.isLanguageChangingTo=void 0,this.emit(`languageChanged`,a),this.logger.log(`languageChanged`,a)):this.isLanguageChangingTo=void 0,n.resolve((...e)=>this.t(...e)),t&&t(i,(...e)=>this.t(...e))},a=t=>{!e&&!t&&this.services.languageDetector&&(t=[]);let n=L7(t)?t:t&&t[0],a=this.store.hasLanguageSomeTranslations(n)?n:this.services.languageUtils.getBestMatchFromCodes(L7(t)?[t]:t);a&&(this.language||r(a),this.translator.language||this.translator.changeLanguage(a),this.services.languageDetector?.cacheUserLanguage?.(a)),this.loadResources(a,e=>{i(e,a)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e),n}getFixedT(e,t,n){let r=(e,t,...i)=>{let a;a=typeof t==`object`?{...t}:this.options.overloadTranslationOptionHandler([e,t].concat(i)),a.lng=a.lng||r.lng,a.lngs=a.lngs||r.lngs,a.ns=a.ns||r.ns,a.keyPrefix!==``&&(a.keyPrefix=a.keyPrefix||n||r.keyPrefix);let o={...this.options,...a};typeof a.keyPrefix==`function`&&(a.keyPrefix=f9(a.keyPrefix,o));let s=this.options.keySeparator||`.`,c;return a.keyPrefix&&Array.isArray(e)?c=e.map(e=>(typeof e==`function`&&(e=f9(e,o)),`${a.keyPrefix}${s}${e}`)):(typeof e==`function`&&(e=f9(e,o)),c=a.keyPrefix?`${a.keyPrefix}${s}${e}`:e),this.t(c,a)};return L7(e)?r.lng=e:r.lngs=e,r.ns=t,r.keyPrefix=n,r}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn(`hasLoadedNamespace: i18next was not initialized`,this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn(`hasLoadedNamespace: i18n.languages were undefined or empty`,this.languages),!1;let n=t.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(n.toLowerCase()===`cimode`)return!0;let a=(e,t)=>{let n=this.services.backendConnector.state[`${e}|${t}`];return n===-1||n===0||n===2};if(t.precheck){let e=t.precheck(this,a);if(e!==void 0)return e}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(n,e)&&(!r||a(i,e)))}loadNamespaces(e,t){let n=R7();return this.options.ns?(L7(e)&&(e=[e]),e.forEach(e=>{this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){let n=R7();L7(e)&&(e=[e]);let r=this.options.preload||[],i=e.filter(e=>r.indexOf(e)<0&&this.services.languageUtils.isSupportedCode(e));return i.length?(this.options.preload=r.concat(i),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}dir(e){if(e||=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language),!e)return`rtl`;try{let t=new Intl.Locale(e);if(t&&t.getTextInfo){let e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch{}let t=`ar.shu.sqr.ssh.xaa.yhd.yud.aao.abh.abv.acm.acq.acw.acx.acy.adf.ads.aeb.aec.afb.ajp.apc.apd.arb.arq.ars.ary.arz.auz.avl.ayh.ayl.ayn.ayp.bbz.pga.he.iw.ps.pbt.pbu.pst.prp.prd.ug.ur.ydd.yds.yih.ji.yi.hbo.men.xmn.fa.jpr.peo.pes.prs.dv.sam.ckb`.split(`.`),n=this.services?.languageUtils||new g9(w9());return e.toLowerCase().indexOf(`-latn`)>1?`ltr`:t.indexOf(n.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf(`-arab`)>1?`rtl`:`ltr`}static createInstance(t={},n){let r=new e(t,n);return r.createInstance=e.createInstance,r}cloneInstance(t={},n=E9){let r=t.forkResourceStore;r&&delete t.forkResourceStore;let i={...this.options,...t,isClone:!0},a=new e(i);if((t.debug!==void 0||t.prefix!==void 0)&&(a.logger=a.logger.clone(t)),[`store`,`services`,`language`].forEach(e=>{a[e]=this[e]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},r&&(a.store=new c9(Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((n,r)=>(n[r]={...e[t][r]},n),e[t]),e),{}),i),a.services.resourceStore=a.store),t.interpolation){let e={...w9().interpolation,...this.options.interpolation,...t.interpolation},n={...i,interpolation:e};a.services.interpolator=new S9(n)}return a.translator=new h9(a.services,i),a.translator.on(`*`,(e,...t)=>{a.emit(e,...t)}),a.init(i,n),a.translator.options=i,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}.createInstance();O9.createInstance,O9.dir,O9.init,O9.loadResources,O9.reloadResources,O9.use,O9.changeLanguage,O9.getFixedT,O9.t,O9.exists,O9.setDefaultNamespace,O9.hasLoadedNamespace,O9.loadNamespaces,O9.loadLanguages,O9.init({fallbackLng:`en`,lng:`en`,debug:!0,resources:{en:{translation:{categorize:{limitMaxChoicesPerCategory:`You've reached the limit of {{maxChoicesPerCategory}} responses per area. To add another response, one must first be removed.`,maxChoicesPerCategoryRestriction:`To change this value to {{maxChoicesPerCategory}}, each category must have {{maxChoicesPerCategory}} or fewer answer choice[s].`},ebsr:{part:`Part {{index}}`},numberLine:{addElementLimit_one:`You can only add {{count}} element`,addElementLimit_other:`You can only add {{count}} elements`,clearAll:`Clear all`},imageClozeAssociation:{reachedLimit_one:`You’ve reached the limit of {{count}} response per area. To add another response, one must first be removed.`,reachedLimit_other:`Full`},drawingResponse:{fillColor:`Fill color`,outlineColor:`Outline color`,noFill:`No fill`,lightblue:`Light blue`,lightyellow:`Light yellow`,red:`Red`,orange:`Orange`,yellow:`Yellow`,violet:`Violet`,blue:`Blue`,green:`Green`,white:`White`,black:`Black`,onDoubleClick:`Double click to edit this text. Press Enter to submit.`},charting:{addCategory:`Add category`,actions:`Actions`,add:`Add`,delete:`Delete`,newLabel:`New label`,reachedLimit_other:`There can't be more than {{count}} categories.`,keyLegend:{incorrectAnswer:`Student incorrect answer`,correctAnswer:`Student correct answer`,correctKeyAnswer:`Answer key correct`}},graphing:{point:`Point`,circle:`Circle`,line:`Line`,parabola:`Parabola`,absolute:`Absolute Value`,exponential:`Exponential`,polygon:`Polygon`,ray:`Ray`,segment:`Segment`,sine:`Sine`,vector:`Vector`,label:`Label`,redo:`Redo`,reset:`Reset`},mathInline:{primaryCorrectWithAlternates:`Note: The answer shown above is the primary correct answer specified by the author for this item, but other answers may also be recognized as correct.`},multipleChoice:{minSelections:`Select at least {{minSelections}}.`,maxSelections_one:`Only {{maxSelections}} answer is allowed.`,maxSelections_other:`Only {{maxSelections}} answers are allowed.`,minmaxSelections_equal:`Select {{minSelections}}.`,minmaxSelections_range:`Select between {{minSelections}} and {{maxSelections}}.`},selectText:{correctAnswerSelected:`Correct`,correctAnswerNotSelected:`Correct Answer Not Selected`,incorrectSelection:`Incorrect Selection`,key:`Key`}},common:{undo:`Undo`,clearAll:`Clear all`,correct:`Correct`,incorrect:`Incorrect`,showCorrectAnswer:`Show correct answer`,hideCorrectAnswer:`Hide correct answer`,commonCorrectAnswerWithAlternates:`Note: The answer shown above is the most common correct answer for this item. One or more additional correct answers are also defined, and will also be recognized as correct.`,warning:`Warning`,showNote:`Show Note`,hideNote:`Hide Note`,cancel:`Cancel`}},es:{translation:{categorize:{limitMaxChoicesPerCategory:`Has alcanzado el límite de {{maxChoicesPerCategory}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.`,maxChoicesPerCategoryRestriction:`Para cambiar este valor a {{maxChoicesPerCategory}}, cada categoría debe tener {{maxChoicesPerCategory}} o menos opciones de respuesta`},ebsr:{part:`Parte {{index}}`},numberLine:{addElementLimit_one:`Solo puedes agregar {{count}} elemento`,addElementLimit_other:`Solo puedes agregar {{count}} elementos`,clearAll:`Borrar todo`},imageClozeAssociation:{reachedLimit_one:`Has alcanzado el límite de {{count}} respuesta por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.`,reachedLimit_other:`Lleno`},drawingResponse:{fillColor:`Color de relleno`,outlineColor:`Color del contorno`,noFill:`Sin relleno`,lightblue:`Azul claro`,lightyellow:`Amarillo claro`,red:`Rojo`,orange:`Naranja`,yellow:`Amarillo`,violet:`Violeta`,blue:`Azul`,green:`Verde`,white:`Blanco`,black:`Negro`,onDoubleClick:`Haz doble clic para revisar este texto. Presiona el botón de ingreso para enviar`},charting:{addCategory:`Añadir categoría`,actions:`Acciones`,add:`Añadir`,delete:`Eliminar`,newLabel:`Nueva etiqueta`,reachedLimit_other:`No puede haber más de {{count}} categorías.`,keyLegend:{incorrectAnswer:`Respuesta incorrecta del estudiante`,correctAnswer:`Respuesta correcta del estudiante`,correctKeyAnswer:`Clave de respuesta correcta`}},graphing:{point:`Punto`,circle:`Circulo`,line:`Línea`,parabola:`Parábola`,absolute:`Valor absoluto`,exponential:`Exponencial`,polygon:`Polígono`,ray:`Semirrecta`,segment:`Segmento `,sine:`Seno`,vector:`Vector`,label:`Etiqueta`,redo:`Rehacer`,reset:`Reiniciar`},mathInline:{primaryCorrectWithAlternates:`Nota: La respuesta que se muestra arriba es la respuesta correcta principal especificada por el autor para esta pregunta, pero también se pueden reconocer otras respuestas como correctas.`},multipleChoice:{minSelections:`Seleccione al menos {{minSelections}}.`,maxSelections_one:`Sólo se permite {{maxSelections}} respuesta.`,maxSelections_other:`Sólo se permiten {{maxSelections}} respuestas.`,minmaxSelections_equal:`Seleccione {{minSelections}}.`,minmaxSelections_range:`Seleccione entre {{minSelections}} y {{maxSelections}}.`},selectText:{correctAnswerSelected:`Respuesta Correcta`,correctAnswerNotSelected:`Respuesta Correcta No Seleccionada`,incorrectSelection:`Selección Incorrecta`,key:`Clave`}},common:{undo:`Deshacer`,clearAll:`Borrar todo`,correct:`Correct`,incorrect:`Incorrect`,showCorrectAnswer:`Mostrar respuesta correcta`,hideCorrectAnswer:`Ocultar respuesta correcta`,commonCorrectAnswerWithAlternates:`Nota: La respuesta que se muestra arriba es la respuesta correcta más común para esta pregunta. También se definen una o más respuestas correctas adicionales, y también se reconocerán como correctas.`,warning:`Advertencia`,showNote:`Mostrar Nota`,hideNote:`Ocultar Nota`,cancel:`Cancelar`}}}});var k9={translator:{...O9,t:(e,t)=>{let{lng:n}=t;switch(n){case`en_US`:case`en-US`:t.lng=`en`;break;case`es_ES`:case`es-ES`:case`es_MX`:case`es-MX`:t.lng=`es`;break;default:break}return O9.t(e,{lng:n,...t})}},languageOptions:[{value:`en_US`,label:`English (US)`},{value:`es_ES`,label:`Spanish`}]},{translator:A9}=k9,Hee=R(`div`)(()=>({alignSelf:`flex-end`})),Uee=R(`div`)(({theme:e})=>({cursor:`pointer`,fontSize:e.typography.fontSize,color:lu(),padding:e.spacing(1)})),Wee=R(cl)(({theme:e})=>({padding:e.spacing(1),display:`flex`,flexDirection:`column`,gap:e.spacing(1),"& button":{textTransform:`none`,fontSize:e.typography.fontSize,color:Il(),justifyContent:`flex-start`}})),Gee=class extends P.Component{constructor(e){super(e),this.state={actionsAnchorEl:null}}componentWillUnmount(){this.setState({actionsAnchorEl:null})}static propTypes={addCategory:v.func.isRequired,deleteCategory:v.func.isRequired,language:v.string,categories:v.array};handleActionsClick=e=>{this.setState({actionsAnchorEl:e.currentTarget})};handleActionsClose=()=>{this.setState({actionsAnchorEl:null})};handleAddCategory=()=>{let{addCategory:e}=this.props;e(),this.handleActionsClose()};handleDeleteCategory=e=>{let{deleteCategory:t}=this.props;t(e),this.handleActionsClose()};render(){let{categories:e,language:t}=this.props,{actionsAnchorEl:n}=this.state;return(0,F.jsxs)(Hee,{children:[(0,F.jsx)(Uee,{role:`button`,tabIndex:0,onClick:this.handleActionsClick,children:`Actions`}),(0,F.jsx)(Al,{open:!!n,anchorEl:n,onClose:this.handleActionsClose,anchorOrigin:{vertical:`bottom`,horizontal:`left`},transformOrigin:{vertical:`top`,horizontal:`left`},children:(0,F.jsxs)(Wee,{children:[(0,F.jsxs)(ff,{onClick:()=>this.handleAddCategory(),children:[`+ `,A9.t(`charting.add`,{lng:t})]}),e.length>0&&e.map((e,n)=>e.deletable&&!e.correctness&&(0,F.jsx)(ff,{onClick:()=>this.handleDeleteCategory(n),children:`${A9.t(`charting.delete`,{lng:t})} <${e.label||A9.t(`charting.newLabel`,{lng:t})}>`},n))]})},`actions-popover-${Math.random()}`)]})}},{translator:j9}=k9,Kee=Uu(`pie-lib:charts:chart`),qee=R(`div`)(()=>({width:`min-content`})),Jee=class extends P.Component{constructor(e){super(e),this.state={dialog:{open:!1},actionsAnchorEl:null},this.maskUid=this.generateMaskId()}static propTypes={className:v.string,chartType:v.string.isRequired,size:v.shape({width:v.number,height:v.number}),domain:v.shape({label:v.string,min:v.number,max:v.number,axisLabel:v.string}),data:v.arrayOf(v.shape({label:v.string,value:v.number})),range:v.shape({label:v.string,min:v.number,max:v.number,step:v.number,labelStep:v.number,axisLabel:v.string}),charts:v.array,labelsPlaceholders:v.object,title:v.string,titlePlaceholder:v.string,onDataChange:v.func,onChangeLabels:v.func,onChangeTitle:v.func,error:v.any,addCategoryEnabled:v.bool,showPixelGuides:v.bool,categoryDefaultLabel:v.string,categoryDefaults:v.object,defineChart:v.bool,theme:v.object,chartingOptions:v.object,changeInteractiveEnabled:v.bool,changeEditableEnabled:v.bool,language:v.string,mathMlOptions:v.object,labelsCharactersLimit:v.number,correctData:v.arrayOf(v.shape({label:v.string,value:v.number}))};static defaultProps={size:{width:480,height:480}};state={charts:[I7.Bar(),I7.Histogram(),I7.LineDot(),I7.LineCross(),I7.DotPlot(),I7.LinePlot()],autoFocus:!1};generateMaskId(){return`chart-`+(Math.random()*1e4).toFixed()}handleAlertDialog=(e,t)=>this.setState({dialog:{open:e}},t);getChart=()=>{let e=this.props.charts||this.state.charts,{chartType:t}=this.props,n=null,r=null;return t?(r=e&&e.find(e=>e.type===t),n=r&&r.Component):(r=e&&e[0],n=r&&r.Component,t=r&&r.type),{type:t,ChartComponent:n}};changeData=e=>{let{onDataChange:t}=this.props;t(e)};changeCategory=(e,t)=>{let n=parseInt(e,10);if(n>=0){let{data:e,onDataChange:r}=this.props;e[n]={...e[n],...t},r(e)}};addCategory=()=>{let{onDataChange:e,data:t,categoryDefaultLabel:n,defineChart:r,categoryDefaults:i,language:a}=this.props;(t||[]).length>19?this.setState({dialog:{open:!0,title:j9.t(`common:warning`,{lng:a}),text:j9.t(`charting.reachedLimit_other`,{count:20,lng:a}),onConfirm:()=>this.handleAlertDialog(!1)}}):(this.setState({autoFocus:!0}),e([...t,{inDefineChart:r,label:n||j9.t(`charting.newLabel`,{lng:a}),value:0,deletable:!0,editable:!i||i?.editable,interactive:!i||i?.interactive}]))};deleteCategory=e=>{let{data:t,onDataChange:n}=this.props;typeof e!=`number`||e<0||t&&t.length>0&&n(t.filter((t,n)=>n!==e))};getFilteredCategories=()=>{let{data:e,defineChart:t}=this.props;return e?e.map(e=>({...e,deletable:t||e.deletable})):[]};resetAutoFocus=()=>{this.setState({autoFocus:!1})};render(){let{domain:e={},range:t={},chartingOptions:n,size:r,title:i,onChangeTitle:a,onChangeLabels:o,labelsPlaceholders:s,titlePlaceholder:c,addCategoryEnabled:l,changeInteractiveEnabled:u,changeEditableEnabled:d,showPixelGuides:f,error:p,mathMlOptions:m={},language:h,labelsCharactersLimit:g,correctData:_}=this.props,{chartType:v}=this.props,{dialog:y}=this.state,b=this.props.defineChart||!1,{width:x,height:S}=r||{},C={left:t?.label||``,bottom:e?.label||``},{ChartComponent:w}=this.getChart(),T=this.getFilteredCategories(),E=d5(e,t,v),{verticalLines:D,horizontalLines:O,leftAxis:k}=f5(E.range,v),A={graphProps:W3(E.domain,E.range,r,()=>this.rootNode)};Kee(`[render] common:`,A);let j={x:-10,y:-75,width:x+20,height:S+130},{scale:M}=A.graphProps,ee=l5(M.x,T,x,v),N=ee.bandwidth()||M.x(E.domain.max)/T.length,te=b?160:60,ne=m5(N),re=Mp(A);return re.graphProps.size.height+=ne+te,(v===`dotPlot`||v===`linePlot`)&&_?.length&&C.bottom&&(re.graphProps.size.height+=25),(0,F.jsxs)(qee,{children:[(0,F.jsxs)(u1,{title:i,onChangeTitle:a,disabledTitle:!b,showTitle:!0,showLabels:!0,labels:C,onChangeLabels:o,labelsPlaceholders:s,titlePlaceholder:c,defineChart:b,disabledLabels:!b,isChart:!0,showPixelGuides:f,rootRef:e=>this.rootNode=e,mathMlOptions:m,labelsCharactersLimit:g,...re,children:[(0,F.jsx)(S8,{...A,xBand:ee,rowTickValues:O,columnTickValues:D}),(0,F.jsx)(B5,{autoFocus:this.state.autoFocus,onAutoFocusUsed:this.resetAutoFocus,...A,defineChart:b,categories:T,xBand:ee,leftAxis:k,onChange:this.changeData,onChangeCategory:this.changeCategory,chartingOptions:n,changeInteractiveEnabled:u,changeEditableEnabled:d,top:ne,error:p,showCorrectness:v===`linePlot`||v===`dotPlot`}),l?(0,F.jsx)(`foreignObject`,{x,y:S-16,width:x,height:S,children:(0,F.jsx)(`div`,{xmlns:`http://www.w3.org/1999/xhtml`,style:{display:`flex`,justifyContent:`flex-start`},children:(0,F.jsx)(Gee,{categories:T,addCategory:this.addCategory,deleteCategory:this.deleteCategory,language:h})})}):null,(0,F.jsx)(`mask`,{id:`${this.maskUid}`,children:(0,F.jsx)(`rect`,{...j,fill:`white`})}),(0,F.jsx)(`g`,{id:`marks`,mask:`url('#${this.maskUid}')`,children:w&&(0,F.jsx)(w,{...A,data:T,height:re.graphProps.size.height,defineChart:b,onChange:this.changeData,onChangeCategory:this.changeCategory,correctData:_})})]}),(0,F.jsx)(l6,{open:y.open,title:y.title,text:y.text,onClose:y.onClose,onConfirm:y.onConfirm})]})}},Yee=R(`div`)(({theme:e})=>({backgroundColor:V.WHITE,padding:e.spacing(2),width:`355px`,boxShadow:`inset 0px 1px 5px 0px #9297A6`,display:`flex`,flexDirection:`column`,gap:`16px`})),M9=R(`div`)(()=>({display:`flex`,alignItems:`center`,gap:`12px`})),Xee=R(`div`)(({theme:e})=>({fontSize:e.typography.h6.fontSize,fontWeight:`700`})),Zee=R(`div`)(()=>({marginLeft:`2px`})),N9=R(hR)(({theme:e})=>({backgroundColor:Bl(),borderRadius:e.spacing(2),color:V.WHITE})),Qee=R(n5)(({theme:e})=>({backgroundColor:Gl(),borderRadius:e.spacing(2),color:V.WHITE})),$ee=R(`div`)(()=>({marginLeft:`3px`,display:`flex`,alignItems:`center`,gap:`12px`})),{translator:P9}=k9,F9=({language:e})=>(0,F.jsxs)(Yee,{children:[(0,F.jsx)(Xee,{children:`Key`}),(0,F.jsxs)(M9,{children:[(0,F.jsx)(Qee,{}),(0,F.jsx)(`div`,{children:P9.t(`charting.keyLegend.incorrectAnswer`,{lng:e})})]}),(0,F.jsxs)(M9,{children:[(0,F.jsx)(N9,{}),(0,F.jsx)(`div`,{children:P9.t(`charting.keyLegend.correctAnswer`,{lng:e})})]}),(0,F.jsxs)($ee,{children:[(0,F.jsx)(N9,{fontSize:`small`}),(0,F.jsx)(Zee,{children:P9.t(`charting.keyLegend.correctKeyAnswer`,{lng:e})})]})]});F9.propTypes={language:v.string};var I9=`height ease-in 300ms, opacity ease-in 300ms`,ete=R(`div`)(()=>({position:`relative`,height:0,overflow:`hidden`,display:`flex`,visibility:`hidden`,width:0,"&.enter":{transition:I9,opacity:1,height:`auto`,width:`auto`,visibility:`visible`,minHeight:`25px`},"&.enter-done":{height:`auto`,visibility:`visible`,width:`auto`,minHeight:`25px`},"&.exit":{transition:I9,opacity:0,height:0,visibility:`visible`,width:0},"&.exit-done":{opacity:0,visibility:`hidden`,height:0,width:0}})),L9=e=>{let{show:t,children:n,className:r}=e,i=(0,P.useRef)(null);return(0,F.jsx)(Hs,{nodeRef:i,in:t,appear:!0,mountOnEnter:!1,timeout:300,classNames:{enter:`enter`,enterDone:`enter-done`,exit:`exit`,exitDone:`exit-done`},children:(0,F.jsx)(ete,{ref:i,className:r,children:n})})};L9.propTypes={show:v.bool.isRequired,className:v.string,children:v.oneOfType([v.arrayOf(v.node),v.node]).isRequired};function R9(e){return typeof e==`function`||typeof e==`object`&&!!e&&typeof e.$$typeof==`symbol`}function z9(e,t){return!e||R9(e)?e:R9(e.default)?e.default:t&&R9(e[t])?e[t]:t&&R9(e[t]?.default)?e[t].default:e}var tte=z9(ep,`Readable`)||z9(nte.Readable,`Readable`),B9=Op,V9=B9.default,nte=V9&&typeof V9==`object`?V9:B9,{translator:H9}=k9,rte={WebkitTouchCallout:`none`,WebkitUserSelect:`none`,KhtmlUserSelect:`none`,MozUserSelect:`none`,msUserSelect:`none`,userSelect:`none`},ite=R(`div`)(()=>({width:`100%`,cursor:`pointer`})),ate=R(`div`)(()=>({margin:`0 auto`,textAlign:`center`,display:`flex`})),ote=R(`div`)(()=>({width:`fit-content`,minWidth:`140px`,alignSelf:`center`,verticalAlign:`middle`,color:`var(--correct-answer-toggle-label-color, ${Il()})`,fontWeight:`normal`,...rte})),U9=R(`div`)(()=>({position:`absolute`,width:`25px`,"&.enter":{opacity:`0`},"&.enter-active":{opacity:`1`,transition:`opacity 0.3s ease-in`},"&.exit":{opacity:`1`},"&.exit-active":{opacity:`0`,transition:`opacity 0.3s ease-in`}})),ste=R(`div`)(()=>({width:`25px`,marginRight:`5px`,display:`flex`,alignItems:`center`})),cte=class e extends P.Component{static propTypes={onToggle:v.func,toggled:v.bool,show:v.bool,hideMessage:v.string,showMessage:v.string,className:v.string,language:v.string};static defaultProps={showMessage:`Show correct answer`,hideMessage:`Hide correct answer`,show:!1,toggled:!1};constructor(t){super(t),this.state={show:t.show},this.openIconRef=P.createRef(),this.closedIconRef=P.createRef(),e.defaultProps={...e.defaultProps,showMessage:H9.t(`common:showCorrectAnswer`,{lng:t.language}),hideMessage:H9.t(`common:hideCorrectAnswer`,{lng:t.language})}}onClick(){this.props.onToggle(!this.props.toggled)}onTouch(e){e.preventDefault(),this.props.onToggle(!this.props.toggled)}UNSAFE_componentWillReceiveProps(t){this.setState({show:t.show}),t.language!==this.props?.language&&(e.defaultProps={...e.defaultProps,showMessage:H9.t(`common:showCorrectAnswer`,{lng:t.language}),hideMessage:H9.t(`common:hideCorrectAnswer`,{lng:t.language})})}render(){let{className:e,toggled:t,hideMessage:n,showMessage:r}=this.props;return(0,F.jsx)(ite,{className:e,children:(0,F.jsx)(L9,{show:this.state.show,children:(0,F.jsxs)(ate,{onClick:this.onClick.bind(this),onTouchEnd:this.onTouch.bind(this),children:[(0,F.jsxs)(ste,{children:[(0,F.jsx)(Hs,{nodeRef:this.openIconRef,timeout:400,in:t,exit:!t,classNames:{enter:`enter`,enterActive:`enter-active`,exit:`exit`,exitActive:`exit-active`},children:(0,F.jsx)(U9,{ref:this.openIconRef,children:(0,F.jsx)(Ko,{open:t},`correct-open`)})}),(0,F.jsx)(Hs,{nodeRef:this.closedIconRef,timeout:5e3,in:!t,exit:t,classNames:{enter:`enter`,enterActive:`enter-active`,exit:`exit`,exitActive:`exit-active`},children:(0,F.jsx)(U9,{ref:this.closedIconRef,children:(0,F.jsx)(Ko,{open:t},`correct-closed`)})})]}),(0,F.jsx)(tte,{false:!0,children:(0,F.jsx)(ote,{"aria-hidden":!this.state.show,children:t?n:r})})]})})})}};function W9(e){return typeof e==`function`||typeof e==`object`&&!!e&&typeof e.$$typeof==`symbol`}function G9(e,t){return!e||W9(e)?e:W9(e.default)?e.default:t&&W9(e[t])?e[t]:t&&W9(e[t]?.default)?e[t].default:e}var lte=G9(Sf,`UiLayout`)||G9(X9.UiLayout,`UiLayout`),K9=G9($f,`PreviewPrompt`)||G9(X9.PreviewPrompt,`PreviewPrompt`),q9=G9(yd,`Collapsible`)||G9(X9.Collapsible,`Collapsible`),J9=Op,Y9=J9.default,X9=Y9&&typeof Y9==`object`?Y9:J9,ute=R(lte)({color:Il(),backgroundColor:iu(),overflowX:`scroll`,overflowY:`hidden`}),Z9=R(Jee)(({theme:e})=>({marginTop:e.spacing(2),marginBottom:e.spacing(2)})),dte=R(q9)(({theme:e})=>({marginBottom:e.spacing(2)})),fte=class extends P.Component{static propTypes={model:v.object.isRequired,onAnswersChange:v.func,categories:v.array};constructor(e){super(e),this.state={categories:e.categories||e.model.data,showingCorrect:!1}}componentDidUpdate(e){zp(e.categories,this.props.categories)?zp(e.model.data,this.props.model.data)||this.setState({categories:this.props.model.data}):this.setState({categories:this.props.categories})}changeData=e=>this.setState({categories:e},()=>this.props.onAnswersChange(e));toggleCorrect=e=>this.setState({showingCorrect:e});render(){let{categories:e,showingCorrect:t}=this.state,{model:n}=this.props,{teacherInstructions:r,prompt:i,chartType:a,size:o,domain:s,range:c,title:l,addCategoryEnabled:u,studentNewCategoryDefaultLabel:d,showToggle:f,rationale:p,correctAnswer:m,language:h,env:g,showKeyLegend:_}=n,{correctedAnswer:v,extraCSSRules:y}=n,b=(m?.data||[]).map(e=>({...e,interactive:!1,editable:!1})),{mode:x}=g||{};x===`view`&&(v=(v||[]).map(e=>({...e,editable:!1})));let S=n.rationale&&(ip(n.rationale)||op(n.rationale)),C=n.teacherInstructions&&(ip(n.teacherInstructions)||op(n.teacherInstructions));return(0,F.jsxs)(ute,{extraCSSRules:y,children:[C&&(0,F.jsx)(dte,{labels:{hidden:`Show Teacher Instructions`,visible:`Hide Teacher Instructions`},children:(0,F.jsx)(K9,{prompt:r})}),i&&(0,F.jsx)(K9,{className:`prompt`,prompt:i}),(0,F.jsx)(cte,{show:f,toggled:t,onToggle:this.toggleCorrect,language:h}),t&&f?(0,F.jsx)(Z9,{chartType:a,size:o,domain:s,range:c,charts:[I7.Bar(),I7.Histogram(),I7.LineDot(),I7.LineCross(),I7.DotPlot(),I7.LinePlot()],data:b||e,title:l,onDataChange:this.changeData,addCategoryEnabled:!1,categoryDefaultLabel:d,language:h,labelsPlaceholders:{}}):(0,F.jsx)(Z9,{chartType:a,size:o,domain:s,range:c,charts:[I7.Bar(),I7.Histogram(),I7.LineDot(),I7.LineCross(),I7.DotPlot(),I7.LinePlot()],data:v||e,title:l,onDataChange:this.changeData,addCategoryEnabled:u,categoryDefaultLabel:d,language:h,labelsPlaceholders:{},correctData:f?b:void 0}),!t&&_&&(0,F.jsx)(F9,{language:h}),S&&(0,F.jsx)(q9,{labels:{hidden:`Show Rationale`,visible:`Hide Rationale`},children:(0,F.jsx)(K9,{prompt:p})})]})}},Q9=class e extends CustomEvent{static{this.TYPE=`model-set`}constructor(t,n,r){super(e.TYPE,{bubbles:!0,composed:!0,detail:{complete:n,component:t,hasModel:r}}),this.component=t,this.complete=n}},pte=class e extends CustomEvent{static{this.TYPE=`session-changed`}constructor(t,n){super(e.TYPE,{bubbles:!0,composed:!0,detail:{complete:n,component:t}}),this.component=t,this.complete=n}},mte=g(),$9=class extends HTMLElement{constructor(){super(),this._root=null,this._mathObserver=null,this._mathRenderPending=!1}_scheduleMathRender=()=>{this._mathRenderPending||(this._mathRenderPending=!0,requestAnimationFrame(()=>{this._mathObserver&&this._mathObserver.disconnect(),hd(this),this._mathRenderPending=!1,setTimeout(()=>{this._mathObserver&&this._mathObserver.observe(this,{childList:!0,subtree:!0})},50)}))};_initMathObserver(){this._mathObserver||(this._mathObserver=new MutationObserver(this._scheduleMathRender),this._mathObserver.observe(this,{childList:!0,subtree:!0}))}_disconnectMathObserver(){this._mathObserver&&=(this._mathObserver.disconnect(),null)}set model(e){this._model=e,this._session&&this.isComplete(this._session.answer)?this.dispatchEvent(new Q9(this.tagName.toLowerCase(),!0,!!this._model)):this.dispatchEvent(new Q9(this.tagName.toLowerCase(),!1,!!this._model)),this._render()}set session(e){this._session=e,this._render()}get session(){return this._session}connectedCallback(){this._initMathObserver(),this._render()}isComplete=e=>Array.isArray(e)&&e.length>0;changeAnswers=e=>{this._session.answer=e,this.dispatchEvent(new pte(this.tagName.toLowerCase(),this.isComplete(this._session.answer))),this._render()};_render(){if(!this._model||!this._session)return;this._initMathObserver();let e={...this._model,data:this._model.data?[...this._model.data]:this._model.data},t=P.createElement(fte,{model:e,categories:this._session.answer,onAnswersChange:this.changeAnswers});this._root||=(0,mte.createRoot)(this),this._root.render(t)}disconnectedCallback(){this._disconnectMathObserver(),this._root&&=(this._root.unmount(),null)}};return typeof window<`u`&&!customElements.get(`charting-element`)&&customElements.define(`charting-element`,$9),$9})();
|
|
359
|
+
`,e.getElementsByTagName(`head`)[0].appendChild(n)}e.body&&R1(e.body,`react-draggable-transparent-selection`)}function I1(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{L1(e)}):L1(e)}function L1(e){if(e)try{e.body&&z1(e.body,`react-draggable-transparent-selection`);let t=e.selection;if(t)t.empty();else{let t=(e.defaultView||window).getSelection();t&&t.type!==`Caret`&&t.removeAllRanges()}}catch{}}function R1(e,t){e.classList?e.classList.add(t):e.className.match(RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function z1(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(RegExp(`(?:^|\\s)${t}(?!\\S)`,`g`),``)}function B1(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r==`string`?r:q1(r);let i=J1(e);if(typeof r==`string`){let{ownerDocument:e}=i,t=e.defaultView;if(!t)throw Error(`Cannot resolve the owner window of the draggable node.`);let n;if(n=r===`parent`?i.parentNode:i.getRootNode().querySelector(r),!(n instanceof t.HTMLElement))throw Error(`Bounds selector "`+r+`" could not find an element.`);let a=n,o=t.getComputedStyle(i),s=t.getComputedStyle(a);r={left:-i.offsetLeft+f1(s.paddingLeft)+f1(o.marginLeft),top:-i.offsetTop+f1(s.paddingTop)+f1(o.marginTop),right:D1(a)-T1(i)-i.offsetLeft+f1(s.paddingRight)-f1(o.marginRight),bottom:E1(a)-w1(i)-i.offsetTop+f1(s.paddingBottom)-f1(o.marginBottom)}}return d1(r.right)&&(t=Math.min(t,r.right)),d1(r.bottom)&&(n=Math.min(n,r.bottom)),d1(r.left)&&(t=Math.max(t,r.left)),d1(r.top)&&(n=Math.max(n,r.top)),[t,n]}function V1(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function H1(e){return e.props.axis===`both`||e.props.axis===`x`}function U1(e){return e.props.axis===`both`||e.props.axis===`y`}function W1(e,t,n){let r=typeof t==`number`?M1(e,t):null;if(typeof t==`number`&&!r)return null;let i=J1(n),a=n.props.offsetParent||i.offsetParent||i.ownerDocument.body;return O1(r||e,a,n.props.scale)}function G1(e,t,n){let r=!d1(e.lastX),i=J1(e);return r?{node:i,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:i,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function K1(e,t){let n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function q1(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function J1(e){let t=e.findDOMNode();if(!t)throw Error(`<DraggableCore>: Unmounted during event!`);return t}var Y1=typeof process<`u`&&process.env.DRAGGABLE_DEBUG?console.log.bind(console):function(){},X1={touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`},mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`}},Z1=X1.mouse,Q1=class extends P.Component{constructor(){super(...arguments),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,this.touchIdentifier=null,this.mounted=!1,this.handleDragStart=e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&(typeof e.button==`number`&&e.button!==0||e.ctrlKey))return!1;let t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw Error(`<DraggableCore> not mounted on DragStart!`);let{ownerDocument:n}=t;if(this.props.disabled||!(e.target instanceof n.defaultView.Node)||this.props.handle&&!x1(e.target,this.props.handle,t)||this.props.cancel&&x1(e.target,this.props.cancel,t))return;e.type===`touchstart`&&!this.props.allowMobileScroll&&e.preventDefault();let r=N1(e);this.touchIdentifier=r;let i=W1(e,r,this);if(i==null)return;let{x:a,y:o}=i,s=G1(this,a,o);Y1(`DraggableCore: handleDragStart: %j`,s),Y1(`calling`,this.props.onStart),!(this.props.onStart(e,s)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&F1(n,this.props.nonce),this.dragging=!0,this.lastX=a,this.lastY=o,S1(n,Z1.move,this.handleDrag),S1(n,Z1.stop,this.handleDragStop))},this.handleDrag=e=>{let t=W1(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX,t=r-this.lastY;if([e,t]=V1(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=G1(this,n,r);if(Y1(`DraggableCore: handleDrag: %j`,i),this.props.onDrag(e,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent(`mouseup`))}catch{let e=document.createEvent(`MouseEvents`);e.initMouseEvent(`mouseup`,!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(e)}return}this.lastX=n,this.lastY=r},this.handleDragStop=e=>{if(!this.dragging)return;let t=W1(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX||0,t=r-this.lastY||0;[e,t]=V1(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let i=G1(this,n,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;let a=this.findDOMNode();a&&this.props.enableUserSelectHack&&I1(a.ownerDocument),Y1(`DraggableCore: handleDragStop: %j`,i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&(Y1(`DraggableCore: Removing handlers`),C1(a.ownerDocument,Z1.move,this.handleDrag),C1(a.ownerDocument,Z1.stop,this.handleDragStop))},this.onMouseDown=e=>(Z1=X1.mouse,this.handleDragStart(e)),this.onMouseUp=e=>(Z1=X1.mouse,this.handleDragStop(e)),this.onTouchStart=e=>(Z1=X1.touch,this.handleDragStart(e)),this.onTouchEnd=e=>(Z1=X1.touch,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&S1(e,X1.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;C1(t,X1.mouse.move,this.handleDrag),C1(t,X1.touch.move,this.handleDrag),C1(t,X1.mouse.stop,this.handleDragStop),C1(t,X1.touch.stop,this.handleDragStop),C1(e,X1.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&I1(t)}}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=Ms.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):(Y1(`react-draggable: ReactDOM.findDOMNode is not available in React 19+. You must provide a nodeRef prop. See: https://github.com/react-grid-layout/react-draggable#noderef`),null)}render(){return P.cloneElement(P.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};Q1.displayName=`DraggableCore`,Q1.propTypes={allowAnyClick:v.bool,allowMobileScroll:v.bool,children:v.node.isRequired,disabled:v.bool,enableUserSelectHack:v.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:v.arrayOf(v.number),handle:v.string,cancel:v.string,nodeRef:v.object,nonce:v.string,onStart:v.func,onDrag:v.func,onStop:v.func,onMouseDown:v.func,scale:v.number,className:p1,style:p1,transform:p1},Q1.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var $1=class extends P.Component{constructor(e){super(e),this.onDragStart=(e,t)=>{if(Y1(`Draggable: onDragStart: %j`,t),this.props.onStart(e,K1(this,t))===!1)return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(e,t)=>{if(!this.state.dragging)return!1;Y1(`Draggable: onDrag: %j`,t);let n=K1(this,t),r={x:n.x,y:n.y,slackX:0,slackY:0};if(this.props.bounds){let{x:e,y:t}=r;r.x+=this.state.slackX,r.y+=this.state.slackY;let[i,a]=B1(this,r.x,r.y);r.x=i,r.y=a,r.slackX=this.state.slackX+(e-r.x),r.slackY=this.state.slackY+(t-r.y),n.x=r.x,n.y=r.y,n.deltaX=r.x-this.state.x,n.deltaY=r.y-this.state.y}if(this.props.onDrag(e,n)===!1)return!1;this.setState(r)},this.onDragStop=(e,t)=>{if(!this.state.dragging||this.props.onStop(e,K1(this,t))===!1)return!1;Y1(`Draggable: onDragStop: %j`,t);let n={dragging:!1,slackX:0,slackY:0};if(this.props.position){let{x:e,y:t}=this.props.position;n.x=e,n.y=t}this.setState(n)},this.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:{...e.position},slackX:0,slackY:0,isElementSVG:!1},e.position&&!(e.onDrag||e.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}static getDerivedStateFromProps({position:e},{prevPropsPosition:t}){return e&&(!t||e.x!==t.x||e.y!==t.y)?(Y1(`Draggable: getDerivedStateFromProps %j`,{position:e,prevPropsPosition:t}),{x:e.x,y:e.y,prevPropsPosition:{...e}}):null}componentDidMount(){window.SVGElement!==void 0&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=Ms.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):null}render(){let{axis:e,bounds:t,children:n,defaultPosition:r,defaultClassName:i,defaultClassNameDragging:a,defaultClassNameDragged:o,position:s,positionOffset:c,scale:l,...u}=this.props,d={},f=null,p=!s||this.state.dragging,m=s||r,h={x:H1(this)&&p?this.state.x:m.x,y:U1(this)&&p?this.state.y:m.y};this.state.isElementSVG?f=A1(h,c):d=k1(h,c);let g=P.Children.only(n),_=I(g.props.className||``,i,{[a]:this.state.dragging,[o]:this.state.dragged});return P.createElement(Q1,{...u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},P.cloneElement(g,{className:_,style:{...g.props.style,...d},transform:f}))}};$1.displayName=`Draggable`,$1.propTypes={...Q1.propTypes,axis:v.oneOf([`both`,`x`,`y`,`none`]),bounds:v.oneOfType([v.shape({left:v.number,right:v.number,top:v.number,bottom:v.number}),v.string,v.oneOf([!1])]),defaultClassName:v.string,defaultClassNameDragging:v.string,defaultClassNameDragged:v.string,defaultPosition:v.shape({x:v.number,y:v.number}),positionOffset:v.shape({x:v.oneOfType([v.number,v.string]),y:v.oneOfType([v.number,v.string])}),position:v.shape({x:v.number,y:v.number}),className:p1,style:p1,transform:p1},$1.defaultProps={...Q1.defaultProps,axis:`both`,bounds:!1,defaultClassName:`react-draggable`,defaultClassNameDragging:`react-draggable-dragging`,defaultClassNameDragged:`react-draggable-dragged`,defaultPosition:{x:0,y:0},scale:1};var e0=Uu(`pie-lib:plot:grid-draggable`),t0=(e,t,n)=>r=>{let i=r+e(0);return t(n+e.invert(i)).toFixed(4)*1e3/1e3},n0=e=>t=>((0,T$.default)(!!e&&Bp(e.fromDelta)&&Bp(e.bounds)&&Bp(e.anchorPoint),`You must supply an object with: { anchorPoint: Function, fromDelta: Function, bounds: Function }`),class extends P.Component{static propTypes={disabled:v.bool,onDragStart:v.func,onDrag:v.func,onDragStop:v.func,onClick:v.func,onMove:v.func,graphProps:x$.isRequired};constructor(e){super(e),this.state={startX:null,startY:null}}grid=()=>{let{graphProps:e}=this.props,{scale:t,domain:n,range:r}=e;return{x:t.x(n.step)-t.x(0),y:t.y(r.step)-t.y(0)}};onStart=e=>{let{onDragStart:t}=this.props;document.activeElement&&document.activeElement.blur(),this._didDrag=!1,this.setState({startX:e.clientX,startY:e.clientY});let n=e.target,r=e=>{n.removeEventListener(`click`,r,!0),this._didDrag&&(e.stopPropagation(),e.preventDefault())};n.addEventListener(`click`,r,!0),t&&t()};position=()=>{let{x:t,y:n}=e.anchorPoint(this.props),{graphProps:r}=this.props,{scale:i,snap:a}=r;return{anchorPoint:{x:t,y:n},x:t0(i.x,a.x,t),y:t0(i.y,a.y,n)}};tiny=(e,t)=>{let n=e.toUpperCase(),r=Math.abs(t[`client${n}`]-this.state[`start${n}`]),i=r<Math.abs(this.grid()[e])/10;return e0(`[tiny] key: `,e,`delta: `,r,`out: `,i),i};getScaledBounds=()=>{let t=e.bounds(this.props,this.props.graphProps);e0(`bounds: `,t);let n=this.grid(),r={left:t.left*n.x,right:t.right*n.x,top:t.top*n.y,bottom:t.bottom*n.y},i=Math.abs(n.y);return r={...r,top:Math.min(0,r.top)-i,bottom:Math.abs(r.bottom)+i},e0(`[getScaledBounds]: `,r),r};getClientPoint=(e,t)=>{if(!e||!t)return null;let n=e.ownerSVGElement||e;if(n&&n.createSVGPoint){let r=n.createSVGPoint();if(t.touches&&t.touches.length>0){let e=t.touches[0];r.x=e.clientX,r.y=e.clientY}else r.x=t.clientX,r.y=t.clientY;return e.getScreenCTM?(r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]):null}let r=e.getBoundingClientRect();return r?[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]:null};skipDragOutsideOfBounds=(e,t,n)=>{let r=n.getRootNode(),i=this.getClientPoint(r,t);if(i===null)return!0;let[a,o]=i,{scale:s,domain:c,range:l}=n,u=s.x.invert(a),d=s.y.invert(o),f=e.deltaX>0&&u<c.min||e.deltaX<0&&u>c.max,p=e.deltaY>0&&d>l.max||e.deltaY<0&&d<l.min;return f||p};onDrag=(e,t)=>{let{onDrag:n,graphProps:r,disabled:i}=this.props;if((Math.abs(t.deltaX)>1||Math.abs(t.deltaY)>1)&&(this._didDrag=!0),!n||i)return;let a=this.getScaledBounds();if(t.deltaX<0&&t.deltaX<a.left||t.deltaX>0&&t.deltaX>a.right||t.deltaY<0&&t.deltaY<a.top||t.deltaY>0&&t.deltaY>a.bottom||this.skipDragOutsideOfBounds(t,e,r))return;let o=this.applyDelta({x:t.deltaX,y:t.deltaY});(o!==void 0||o!==null)&&n(o)};getDelta=e=>{let t=this.position(),n={x:t.x(e.x),y:t.y(e.y)};return A$(t.anchorPoint,n)};applyDelta=t=>{let n=this.getDelta(t);return e0(`[applyDelta] delta:`,n),e.fromDelta(this.props,n)};onStop=(e,t)=>{e0(`[onStop] dd:`,t);let{onDragStop:n,onClick:r,disabled:i}=this.props;if(n&&!i&&n(),e0(`[onStop] lastX/Y: `,t.lastX,t.lastY),!this._didDrag){if(!i&&typeof e?.stopPropagation==`function`&&e.stopPropagation(),r){e0(`call onClick`),this.setState({startX:null,startY:null});let{graphProps:t}=this.props,{scale:n,snap:i}=t;try{let[t,a]=Wh(e,e.target),o=n.x.invert(t),s=n.y.invert(a);o=i.x(o),s=i.y(s),r({x:o,y:s})}catch{r({})}}this.setState({startX:null,startY:null});return}this.setState({startX:null,startY:null})};render(){let{disabled:n,onClick:r,...i}=this.props,a=this.grid(),o=e=>e.nativeEvent.preventDefault(),s=this.state?!!this.state.startX:!1;return(0,F.jsx)(Q1,{onMouseDown:o,onStart:this.onStart,onDrag:this.onDrag,onStop:this.onStop,axis:e.axis||`both`,grid:[a.x,a.y],children:(0,F.jsx)(t,{...i,disabled:n,isDragging:s,onClick:s?void 0:r})})}});function r0(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function i0(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function a0(e){let t,n,r;e.length===2?(t=e===r0||e===i0?e:o0,n=e,r=e):(t=r0,n=(t,n)=>r0(e(t),n),r=(t,n)=>e(t)-n);function i(e,r,i=0,a=e.length){if(i<a){if(t(r,r)!==0)return a;do{let t=i+a>>>1;n(e[t],r)<0?i=t+1:a=t}while(i<a)}return i}function a(e,r,i=0,a=e.length){if(i<a){if(t(r,r)!==0)return a;do{let t=i+a>>>1;n(e[t],r)<=0?i=t+1:a=t}while(i<a)}return i}function o(e,t,n=0,a=e.length){let o=i(e,t,n,a-1);return o>n&&r(e[o-1],t)>-r(e[o],t)?o-1:o}return{left:i,center:o,right:a}}function o0(){return 0}function s0(e){return e===null?NaN:+e}var c0=a0(r0),l0=c0.right;c0.left,a0(s0).center;var u0=class extends Map{constructor(e,t=m0){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),e!=null)for(let[t,n]of e)this.set(t,n)}get(e){return super.get(d0(this,e))}has(e){return super.has(d0(this,e))}set(e,t){return super.set(f0(this,e),t)}delete(e){return super.delete(p0(this,e))}};function d0({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function f0({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function p0({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function m0(e){return typeof e==`object`&&e?e.valueOf():e}var h0=Math.sqrt(50),g0=Math.sqrt(10),_0=Math.sqrt(2);function v0(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=h0?10:a>=g0?5:a>=_0?2:1,s,c,l;return i<0?(l=10**-i/o,s=Math.round(e*l),c=Math.round(t*l),s/l<e&&++s,c/l>t&&--c,l=-l):(l=10**i*o,s=Math.round(e/l),c=Math.round(t/l),s*l<e&&++s,c*l>t&&--c),c<s&&.5<=n&&n<2?v0(e,t,n*2):[s,c,l]}function y0(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];let r=t<e,[i,a,o]=r?v0(t,e,n):v0(e,t,n);if(!(a>=i))return[];let s=a-i+1,c=Array(s);if(r)if(o<0)for(let e=0;e<s;++e)c[e]=(a-e)/-o;else for(let e=0;e<s;++e)c[e]=(a-e)*o;else if(o<0)for(let e=0;e<s;++e)c[e]=(i+e)/-o;else for(let e=0;e<s;++e)c[e]=(i+e)*o;return c}function b0(e,t,n){return t=+t,e=+e,n=+n,v0(e,t,n)[2]}function x0(e,t,n){t=+t,e=+e,n=+n;let r=t<e,i=r?b0(t,e,n):b0(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function S0(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++r<i;)a[r]=e+r*n;return a}function C0(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}var w0=Symbol(`implicit`);function T0(){var e=new u0,t=[],n=[],r=w0;function i(i){let a=e.get(i);if(a===void 0){if(r!==w0)return r;e.set(i,a=t.push(i)-1)}return n[a%n.length]}return i.domain=function(n){if(!arguments.length)return t.slice();t=[],e=new u0;for(let r of n)e.has(r)||e.set(r,t.push(r)-1);return i},i.range=function(e){return arguments.length?(n=Array.from(e),i):n.slice()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return T0(t,n).unknown(r)},C0.apply(i,arguments),i}function E0(){var e=T0().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,a,o,s=!1,c=0,l=0,u=.5;delete e.unknown;function d(){var e=t().length,d=i<r,f=d?i:r,p=d?r:i;a=(p-f)/Math.max(1,e-c+l*2),s&&(a=Math.floor(a)),f+=(p-f-a*(e-c))*u,o=a*(1-c),s&&(f=Math.round(f),o=Math.round(o));var m=S0(e).map(function(e){return f+a*e});return n(d?m.reverse():m)}return e.domain=function(e){return arguments.length?(t(e),d()):t()},e.range=function(e){return arguments.length?([r,i]=e,r=+r,i=+i,d()):[r,i]},e.rangeRound=function(e){return[r,i]=e,r=+r,i=+i,s=!0,d()},e.bandwidth=function(){return o},e.step=function(){return a},e.round=function(e){return arguments.length?(s=!!e,d()):s},e.padding=function(e){return arguments.length?(c=Math.min(1,l=+e),d()):c},e.paddingInner=function(e){return arguments.length?(c=Math.min(1,e),d()):c},e.paddingOuter=function(e){return arguments.length?(l=+e,d()):l},e.align=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),d()):u},e.copy=function(){return E0(t(),[r,i]).round(s).paddingInner(c).paddingOuter(l).align(u)},C0.apply(d(),arguments)}function D0(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return D0(t())},e}function O0(){return D0(E0.apply(null,arguments).paddingInner(1))}function k0(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function A0(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function j0(){}var M0=.7,N0=1/M0,P0=`\\s*([+-]?\\d+)\\s*`,F0=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,I0=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,L0=/^#([0-9a-f]{3,8})$/,R0=RegExp(`^rgb\\(${P0},${P0},${P0}\\)$`),z0=RegExp(`^rgb\\(${I0},${I0},${I0}\\)$`),B0=RegExp(`^rgba\\(${P0},${P0},${P0},${F0}\\)$`),V0=RegExp(`^rgba\\(${I0},${I0},${I0},${F0}\\)$`),H0=RegExp(`^hsl\\(${F0},${I0},${I0}\\)$`),U0=RegExp(`^hsla\\(${F0},${I0},${I0},${F0}\\)$`),W0={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};k0(j0,Y0,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:G0,formatHex:G0,formatHex8:K0,formatHsl:q0,formatRgb:J0,toString:J0});function G0(){return this.rgb().formatHex()}function K0(){return this.rgb().formatHex8()}function q0(){return c2(this).formatHsl()}function J0(){return this.rgb().formatRgb()}function Y0(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=L0.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?X0(t):n===3?new e2(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Z0(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Z0(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=R0.exec(e))?new e2(t[1],t[2],t[3],1):(t=z0.exec(e))?new e2(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=B0.exec(e))?Z0(t[1],t[2],t[3],t[4]):(t=V0.exec(e))?Z0(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=H0.exec(e))?s2(t[1],t[2]/100,t[3]/100,1):(t=U0.exec(e))?s2(t[1],t[2]/100,t[3]/100,t[4]):W0.hasOwnProperty(e)?X0(W0[e]):e===`transparent`?new e2(NaN,NaN,NaN,0):null}function X0(e){return new e2(e>>16&255,e>>8&255,e&255,1)}function Z0(e,t,n,r){return r<=0&&(e=t=n=NaN),new e2(e,t,n,r)}function Q0(e){return e instanceof j0||(e=Y0(e)),e?(e=e.rgb(),new e2(e.r,e.g,e.b,e.opacity)):new e2}function $0(e,t,n,r){return arguments.length===1?Q0(e):new e2(e,t,n,r??1)}function e2(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}k0(e2,$0,A0(j0,{brighter(e){return e=e==null?N0:N0**+e,new e2(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?M0:M0**+e,new e2(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new e2(a2(this.r),a2(this.g),a2(this.b),i2(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:t2,formatHex:t2,formatHex8:n2,formatRgb:r2,toString:r2}));function t2(){return`#${o2(this.r)}${o2(this.g)}${o2(this.b)}`}function n2(){return`#${o2(this.r)}${o2(this.g)}${o2(this.b)}${o2((isNaN(this.opacity)?1:this.opacity)*255)}`}function r2(){let e=i2(this.opacity);return`${e===1?`rgb(`:`rgba(`}${a2(this.r)}, ${a2(this.g)}, ${a2(this.b)}${e===1?`)`:`, ${e})`}`}function i2(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function a2(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function o2(e){return e=a2(e),(e<16?`0`:``)+e.toString(16)}function s2(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new u2(e,t,n,r)}function c2(e){if(e instanceof u2)return new u2(e.h,e.s,e.l,e.opacity);if(e instanceof j0||(e=Y0(e)),!e)return new u2;if(e instanceof u2)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new u2(o,s,c,e.opacity)}function l2(e,t,n,r){return arguments.length===1?c2(e):new u2(e,t,n,r??1)}function u2(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}k0(u2,l2,A0(j0,{brighter(e){return e=e==null?N0:N0**+e,new u2(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?M0:M0**+e,new u2(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new e2(p2(e>=240?e-240:e+120,i,r),p2(e,i,r),p2(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new u2(d2(this.h),f2(this.s),f2(this.l),i2(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=i2(this.opacity);return`${e===1?`hsl(`:`hsla(`}${d2(this.h)}, ${f2(this.s)*100}%, ${f2(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function d2(e){return e=(e||0)%360,e<0?e+360:e}function f2(e){return Math.max(0,Math.min(1,e||0))}function p2(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var m2=Math.PI/180,h2=180/Math.PI,g2=18,_2=.96422,v2=1,y2=.82521,b2=4/29,x2=6/29,S2=3*x2*x2,C2=x2*x2*x2;function w2(e){if(e instanceof E2)return new E2(e.l,e.a,e.b,e.opacity);if(e instanceof N2)return P2(e);e instanceof e2||(e=Q0(e));var t=A2(e.r),n=A2(e.g),r=A2(e.b),i=D2((.2225045*t+.7168786*n+.0606169*r)/v2),a,o;return t===n&&n===r?a=o=i:(a=D2((.4360747*t+.3850649*n+.1430804*r)/_2),o=D2((.0139322*t+.0971045*n+.7141733*r)/y2)),new E2(116*i-16,500*(a-i),200*(i-o),e.opacity)}function T2(e,t,n,r){return arguments.length===1?w2(e):new E2(e,t,n,r??1)}function E2(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}k0(E2,T2,A0(j0,{brighter(e){return new E2(this.l+g2*(e??1),this.a,this.b,this.opacity)},darker(e){return new E2(this.l-g2*(e??1),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,n=isNaN(this.b)?e:e-this.b/200;return t=_2*O2(t),e=v2*O2(e),n=y2*O2(n),new e2(k2(3.1338561*t-1.6168667*e-.4906146*n),k2(-.9787684*t+1.9161415*e+.033454*n),k2(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}}));function D2(e){return e>C2?e**(1/3):e/S2+b2}function O2(e){return e>x2?e*e*e:S2*(e-b2)}function k2(e){return 255*(e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055)}function A2(e){return(e/=255)<=.04045?e/12.92:((e+.055)/1.055)**2.4}function j2(e){if(e instanceof N2)return new N2(e.h,e.c,e.l,e.opacity);if(e instanceof E2||(e=w2(e)),e.a===0&&e.b===0)return new N2(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*h2;return new N2(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function M2(e,t,n,r){return arguments.length===1?j2(e):new N2(e,t,n,r??1)}function N2(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}function P2(e){if(isNaN(e.h))return new E2(e.l,0,0,e.opacity);var t=e.h*m2;return new E2(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}k0(N2,M2,A0(j0,{brighter(e){return new N2(this.h,this.c,this.l+g2*(e??1),this.opacity)},darker(e){return new N2(this.h,this.c,this.l-g2*(e??1),this.opacity)},rgb(){return P2(this).rgb()}}));var F2=-.14861,I2=1.78277,L2=-.29227,R2=-.90649,z2=1.97294,B2=z2*R2,V2=z2*I2,H2=I2*L2-R2*F2;function U2(e){if(e instanceof G2)return new G2(e.h,e.s,e.l,e.opacity);e instanceof e2||(e=Q0(e));var t=e.r/255,n=e.g/255,r=e.b/255,i=(H2*r+B2*t-V2*n)/(H2+B2-V2),a=r-i,o=(z2*(n-i)-L2*a)/R2,s=Math.sqrt(o*o+a*a)/(z2*i*(1-i)),c=s?Math.atan2(o,a)*h2-120:NaN;return new G2(c<0?c+360:c,s,i,e.opacity)}function W2(e,t,n,r){return arguments.length===1?U2(e):new G2(e,t,n,r??1)}function G2(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}k0(G2,W2,A0(j0,{brighter(e){return e=e==null?N0:N0**+e,new G2(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?M0:M0**+e,new G2(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*m2,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),i=Math.sin(e);return new e2(255*(t+n*(F2*r+I2*i)),255*(t+n*(L2*r+R2*i)),255*(t+z2*r*n),this.opacity)}}));var K2=e=>()=>e;function q2(e,t){return function(n){return e+n*t}}function J2(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function Y2(e,t){var n=t-e;return n?q2(e,n>180||n<-180?n-360*Math.round(n/360):n):K2(isNaN(e)?t:e)}function X2(e){return(e=+e)==1?Z2:function(t,n){return n-t?J2(t,n,e):K2(isNaN(t)?n:t)}}function Z2(e,t){var n=t-e;return n?q2(e,n):K2(isNaN(e)?t:e)}var Q2=(function e(t){var n=X2(t);function r(e,t){var r=n((e=$0(e)).r,(t=$0(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=Z2(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function $2(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function e4(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function t4(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o;for(o=0;o<r;++o)i[o]=u4(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function n4(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function r4(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function i4(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=u4(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var a4=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,o4=new RegExp(a4.source,`g`);function s4(e){return function(){return e}}function c4(e){return function(t){return e(t)+``}}function l4(e,t){var n=a4.lastIndex=o4.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=a4.exec(e))&&(i=o4.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:r4(r,i)})),n=o4.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?c4(c[0].x):s4(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function u4(e,t){var n=typeof t,r;return t==null||n===`boolean`?K2(t):(n===`number`?r4:n===`string`?(r=Y0(t))?(t=r,Q2):l4:t instanceof Y0?Q2:t instanceof Date?n4:e4(t)?$2:Array.isArray(t)?t4:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?i4:r4)(e,t)}function d4(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function f4(e){return function(t,n){var r=e((t=l2(t)).h,(n=l2(n)).h),i=Z2(t.s,n.s),a=Z2(t.l,n.l),o=Z2(t.opacity,n.opacity);return function(e){return t.h=r(e),t.s=i(e),t.l=a(e),t.opacity=o(e),t+``}}}var p4=f4(Y2),m4=f4(Z2);function h4(e,t){var n=Z2((e=T2(e)).l,(t=T2(t)).l),r=Z2(e.a,t.a),i=Z2(e.b,t.b),a=Z2(e.opacity,t.opacity);return function(t){return e.l=n(t),e.a=r(t),e.b=i(t),e.opacity=a(t),e+``}}function g4(e){return function(t,n){var r=e((t=M2(t)).h,(n=M2(n)).h),i=Z2(t.c,n.c),a=Z2(t.l,n.l),o=Z2(t.opacity,n.opacity);return function(e){return t.h=r(e),t.c=i(e),t.l=a(e),t.opacity=o(e),t+``}}}var _4=g4(Y2),v4=g4(Z2);function y4(e){return(function t(n){n=+n;function r(t,r){var i=e((t=W2(t)).h,(r=W2(r)).h),a=Z2(t.s,r.s),o=Z2(t.l,r.l),s=Z2(t.opacity,r.opacity);return function(e){return t.h=i(e),t.s=a(e),t.l=o(e**+n),t.opacity=s(e),t+``}}return r.gamma=t,r})(1)}var b4=y4(Y2),x4=y4(Z2);function S4(e){return function(){return e}}function C4(e){return+e}var w4=[0,1];function T4(e){return e}function E4(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:S4(isNaN(t)?NaN:.5)}function D4(e,t){var n;return e>t&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}function O4(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i<r?(r=E4(i,r),a=n(o,a)):(r=E4(r,i),a=n(a,o)),function(e){return a(r(e))}}function k4(e,t,n){var r=Math.min(e.length,t.length)-1,i=Array(r),a=Array(r),o=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<r;)i[o]=E4(e[o],e[o+1]),a[o]=n(t[o],t[o+1]);return function(t){var n=l0(e,t,1,r)-1;return a[n](i[n](t))}}function A4(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function j4(){var e=w4,t=w4,n=u4,r,i,a,o=T4,s,c,l;function u(){var n=Math.min(e.length,t.length);return o!==T4&&(o=D4(e[0],e[n-1])),s=n>2?k4:O4,c=l=null,d}function d(i){return i==null||isNaN(i=+i)?a:(c||=s(e.map(r),t,n))(r(o(i)))}return d.invert=function(n){return o(i((l||=s(t,e.map(r),r4))(n)))},d.domain=function(t){return arguments.length?(e=Array.from(t,C4),u()):e.slice()},d.range=function(e){return arguments.length?(t=Array.from(e),u()):t.slice()},d.rangeRound=function(e){return t=Array.from(e),n=d4,u()},d.clamp=function(e){return arguments.length?(o=e?!0:T4,u()):o!==T4},d.interpolate=function(e){return arguments.length?(n=e,u()):n},d.unknown=function(e){return arguments.length?(a=e,d):a},function(e,t){return r=e,i=t,u()}}function M4(){return j4()(T4,T4)}function N4(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function P4(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf(`e`),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function F4(e){return e=P4(Math.abs(e)),e?e[1]:NaN}function I4(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}function L4(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var R4=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function z4(e){if(!(t=R4.exec(e)))throw Error(`invalid format: `+e);var t;return new B4({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}z4.prototype=B4.prototype;function B4(e){this.fill=e.fill===void 0?` `:e.fill+``,this.align=e.align===void 0?`>`:e.align+``,this.sign=e.sign===void 0?`-`:e.sign+``,this.symbol=e.symbol===void 0?``:e.symbol+``,this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?``:e.type+``}B4.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?`0`:``)+(this.width===void 0?``:Math.max(1,this.width|0))+(this.comma?`,`:``)+(this.precision===void 0?``:`.`+Math.max(0,this.precision|0))+(this.trim?`~`:``)+this.type};function V4(e){out:for(var t=e.length,n=1,r=-1,i;n<t;++n)switch(e[n]){case`.`:r=i=n;break;case`0`:r===0&&(r=n),i=n;break;default:if(!+e[n])break out;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var H4;function U4(e,t){var n=P4(e,t);if(!n)return H4=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(H4=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join(`0`):a>0?r.slice(0,a)+`.`+r.slice(a):`0.`+Array(1-a).join(`0`)+P4(e,Math.max(0,t+a-1))[0]}function W4(e,t){var n=P4(e,t);if(!n)return e+``;var r=n[0],i=n[1];return i<0?`0.`+Array(-i).join(`0`)+r:r.length>i+1?r.slice(0,i+1)+`.`+r.slice(i+1):r+Array(i-r.length+2).join(`0`)}var G4={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:N4,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>W4(e*100,t),r:W4,s:U4,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function K4(e){return e}var q4=Array.prototype.map,J4=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function Y4(e){var t=e.grouping===void 0||e.thousands===void 0?K4:I4(q4.call(e.grouping,Number),e.thousands+``),n=e.currency===void 0?``:e.currency[0]+``,r=e.currency===void 0?``:e.currency[1]+``,i=e.decimal===void 0?`.`:e.decimal+``,a=e.numerals===void 0?K4:L4(q4.call(e.numerals,String)),o=e.percent===void 0?`%`:e.percent+``,s=e.minus===void 0?`−`:e.minus+``,c=e.nan===void 0?`NaN`:e.nan+``;function l(e,l){e=z4(e);var u=e.fill,d=e.align,f=e.sign,p=e.symbol,m=e.zero,h=e.width,g=e.comma,_=e.precision,v=e.trim,y=e.type;y===`n`?(g=!0,y=`g`):G4[y]||(_===void 0&&(_=12),v=!0,y=`g`),(m||u===`0`&&d===`=`)&&(m=!0,u=`0`,d=`=`);var b=(l&&l.prefix!==void 0?l.prefix:``)+(p===`$`?n:p===`#`&&/[boxX]/.test(y)?`0`+y.toLowerCase():``),x=(p===`$`?r:/[%p]/.test(y)?o:``)+(l&&l.suffix!==void 0?l.suffix:``),S=G4[y],C=/[defgprs%]/.test(y);_=_===void 0?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function w(e){var n=b,r=x,o,l,p;if(y===`c`)r=S(e)+r,e=``;else{e=+e;var w=e<0||1/e<0;if(e=isNaN(e)?c:S(Math.abs(e),_),v&&(e=V4(e)),w&&+e==0&&f!==`+`&&(w=!1),n=(w?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&H4!==void 0?J4[8+H4/3]:``)+r+(w&&f===`(`?`)`:``),C){for(o=-1,l=e.length;++o<l;)if(p=e.charCodeAt(o),48>p||p>57){r=(p===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}g&&!m&&(e=t(e,1/0));var T=n.length+e.length+r.length,E=T<h?Array(h-T+1).join(u):``;switch(g&&m&&(e=t(E+e,E.length?h-r.length:1/0),E=``),d){case`<`:e=n+e+r+E;break;case`=`:e=n+E+e+r;break;case`^`:e=E.slice(0,T=E.length>>1)+n+e+r+E.slice(T);break;default:e=E+n+e+r;break}return a(e)}return w.toString=function(){return e+``},w}function u(e,t){var n=Math.max(-8,Math.min(8,Math.floor(F4(t)/3)))*3,r=10**-n,i=l((e=z4(e),e.type=`f`,e),{suffix:J4[8+n/3]});return function(e){return i(r*e)}}return{format:l,formatPrefix:u}}var X4,Z4,Q4;$4({thousands:`,`,grouping:[3],currency:[`$`,``]});function $4(e){return X4=Y4(e),Z4=X4.format,Q4=X4.formatPrefix,X4}function e3(e){return Math.max(0,-F4(Math.abs(e)))}function t3(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(F4(t)/3)))*3-F4(Math.abs(e)))}function n3(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,F4(t)-F4(e))+1}function r3(e,t,n,r){var i=x0(e,t,n),a;switch(r=z4(r??`,f`),r.type){case`s`:var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=t3(i,o))&&(r.precision=a),Q4(r,o);case``:case`e`:case`g`:case`p`:case`r`:r.precision==null&&!isNaN(a=n3(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type===`e`));break;case`f`:case`%`:r.precision==null&&!isNaN(a=e3(i))&&(r.precision=a-(r.type===`%`)*2);break}return Z4(r)}function i3(e){var t=e.domain;return e.ticks=function(e){var n=t();return y0(n[0],n[n.length-1],e??10)},e.tickFormat=function(e,n){var r=t();return r3(r[0],r[r.length-1],e??10,n)},e.nice=function(n){n??=10;var r=t(),i=0,a=r.length-1,o=r[i],s=r[a],c,l,u=10;for(s<o&&(l=o,o=s,s=l,l=i,i=a,a=l);u-->0;){if(l=b0(o,s,n),l===c)return r[i]=o,r[a]=s,t(r);if(l>0)o=Math.floor(o/l)*l,s=Math.ceil(s/l)*l;else if(l<0)o=Math.ceil(o*l)/l,s=Math.floor(s*l)/l;else break;c=l}return e},e}function a3(){var e=M4();return e.copy=function(){return A4(e,a3())},C0.apply(e,arguments),i3(e)}var o3=new Date,s3=new Date;function c3(e,t,n,r){function i(t){return e(t=arguments.length===0?new Date:new Date(+t)),t}return i.floor=t=>(e(t=new Date(+t)),t),i.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),i.round=e=>{let t=i(e),n=i.ceil(e);return e-t<n-e?t:n},i.offset=(e,n)=>(t(e=new Date(+e),n==null?1:Math.floor(n)),e),i.range=(n,r,a)=>{let o=[];if(n=i.ceil(n),a=a==null?1:Math.floor(a),!(n<r)||!(a>0))return o;let s;do o.push(s=new Date(+n)),t(n,a),e(n);while(s<n&&n<r);return o},i.filter=n=>c3(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,r)=>{if(e>=e)if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}),n&&(i.count=(t,r)=>(o3.setTime(+t),s3.setTime(+r),e(o3),e(s3),Math.floor(n(o3,s3))),i.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?i.filter(r?t=>r(t)%e===0:t=>i.count(0,t)%e===0):i)),i}var l3=1e3,u3=l3*60,d3=u3*60,f3=d3*24,p3=f3*7;f3*30,f3*365;var m3=c3(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*l3)},(e,t)=>(t-e)/l3,e=>e.getUTCSeconds());m3.range;var h3=c3(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*l3)},(e,t)=>{e.setTime(+e+t*u3)},(e,t)=>(t-e)/u3,e=>e.getMinutes());h3.range;var g3=c3(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*u3)},(e,t)=>(t-e)/u3,e=>e.getUTCMinutes());g3.range;var _3=c3(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*l3-e.getMinutes()*u3)},(e,t)=>{e.setTime(+e+t*d3)},(e,t)=>(t-e)/d3,e=>e.getHours());_3.range;var v3=c3(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*d3)},(e,t)=>(t-e)/d3,e=>e.getUTCHours());v3.range;var y3=c3(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*u3)/f3,e=>e.getDate()-1);y3.range;var b3=c3(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/f3,e=>e.getUTCDate()-1);b3.range,c3(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/f3,e=>Math.floor(e/f3)).range;function x3(e){return c3(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+t*7)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*u3)/p3)}var S3=x3(0),C3=x3(1),w3=x3(2),T3=x3(3),E3=x3(4),D3=x3(5),O3=x3(6);S3.range,C3.range,w3.range,T3.range,E3.range,D3.range,O3.range;function k3(e){return c3(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t*7)},(e,t)=>(t-e)/p3)}var A3=k3(0),j3=k3(1),M3=k3(2),N3=k3(3),P3=k3(4),F3=k3(5),I3=k3(6);A3.range,j3.range,M3.range,N3.range,P3.range,F3.range,I3.range;var L3=c3(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());L3.range;var R3=c3(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());R3.range;var z3=c3(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());z3.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:c3(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}),z3.range;var B3=c3(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());B3.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:c3(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}),B3.range;var V3=({min:e,max:t,step:n})=>({step:n,min:parseInt(e/n)*n,max:parseInt(t/n)*n}),H3=(e,t,n,r)=>{(0,T$.default)(e.min<e.max,`domain: min must be less than max`),(0,T$.default)(t.min<t.max,`range: min must be less than max`);let i=V3(e),a=V3(t);return{scale:{x:a3().domain([e.min,e.max]).range([0,n.width]),y:a3().domain([t.max,t.min]).range([0,n.height])},snap:{x:D$.bind(null,i.min,i.max,i.step),y:D$.bind(null,a.min,a.max,a.step)},domain:e,range:t,size:n,getRootNode:r}};function U3(e){return Br(`PrivateSwitchBase`,e)}Vr(`PrivateSwitchBase`,[`root`,`checked`,`disabled`,`input`,`edgeStart`,`edgeEnd`]);var W3=e=>{let{classes:t,checked:n,disabled:r,edge:i}=e;return ca({root:[`root`,n&&`checked`,r&&`disabled`,i&&`edge${B(i)}`],input:[`input`]},U3,t)},G3=R(Ld,{name:`MuiSwitchBase`})({padding:9,borderRadius:`50%`,variants:[{props:{edge:`start`,size:`small`},style:{marginLeft:-3}},{props:({edge:e,ownerState:t})=>e===`start`&&t.size!==`small`,style:{marginLeft:-12}},{props:{edge:`end`,size:`small`},style:{marginRight:-3}},{props:({edge:e,ownerState:t})=>e===`end`&&t.size!==`small`,style:{marginRight:-12}}]}),K3=R(`input`,{name:`MuiSwitchBase`,shouldForwardProp:Co})({cursor:`inherit`,position:`absolute`,opacity:0,width:`100%`,height:`100%`,top:0,left:0,margin:0,padding:0,zIndex:1}),q3=P.forwardRef(function(e,t){let{autoFocus:n,checked:r,checkedIcon:i,defaultChecked:a,disabled:o,disableFocusRipple:s=!1,edge:c=!1,icon:l,id:u,inputProps:d,inputRef:f,name:p,onBlur:m,onChange:h,onFocus:g,readOnly:_,required:v=!1,tabIndex:y,type:b,value:x,slots:S={},slotProps:C={},...w}=e,[T,E]=yl({controlled:r,default:!!a,name:`SwitchBase`,state:`checked`}),D=Of(),O=e=>{g&&g(e),D&&D.onFocus&&D.onFocus(e)},k=e=>{m&&m(e),D&&D.onBlur&&D.onBlur(e)},A=e=>{if(e.nativeEvent.defaultPrevented||_)return;let t=e.target.checked;E(t),h&&h(e,t)},j=o;D&&j===void 0&&(j=D.disabled);let M=b===`checkbox`||b===`radio`,ee={...e,checked:T,disabled:j,disableFocusRipple:s,edge:c},N=W3(ee),te={slots:S,slotProps:{input:d,...C}},[ne,re]=zc(`root`,{ref:t,elementType:G3,className:N.root,shouldForwardComponentProp:!0,externalForwardedProps:{...te,component:`span`,...w},getSlotProps:e=>({...e,onFocus:t=>{e.onFocus?.(t),O(t)},onBlur:t=>{e.onBlur?.(t),k(t)}}),ownerState:ee,additionalProps:{centerRipple:!0,focusRipple:!s,role:void 0,tabIndex:null}}),[ie,ae]=zc(`input`,{ref:f,elementType:K3,className:N.input,externalForwardedProps:te,getSlotProps:e=>({...e,onChange:t=>{e.onChange?.(t),A(t)}}),ownerState:ee,additionalProps:{autoFocus:n,checked:r,defaultChecked:a,disabled:j,id:M?u:void 0,name:p,readOnly:_,required:v,tabIndex:y,type:b,...b===`checkbox`&&x===void 0?{}:{value:x}}});return(0,F.jsxs)(ne,{...re,children:[(0,F.jsx)(ie,{...ae}),T?i:l]})}),J3=ml((0,F.jsx)(`path`,{d:`M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z`}),`CheckBoxOutlineBlank`),Y3=ml((0,F.jsx)(`path`,{d:`M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z`}),`CheckBox`),X3=ml((0,F.jsx)(`path`,{d:`M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z`}),`IndeterminateCheckBox`);function Z3(e){return Br(`MuiCheckbox`,e)}var Q3=Vr(`MuiCheckbox`,[`root`,`checked`,`disabled`,`indeterminate`,`colorPrimary`,`colorSecondary`,`sizeSmall`,`sizeMedium`]),$3=e=>{let{classes:t,indeterminate:n,color:r,size:i}=e,a=ca({root:[`root`,n&&`indeterminate`,`color${B(r)}`,`size${B(i)}`]},Z3,t);return{...t,...a}},e6=R(q3,{shouldForwardProp:e=>Co(e)||e===`classes`,name:`MuiCheckbox`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.indeterminate&&t.indeterminate,t[`size${B(n.size)}`],n.color!=="default"&&t[`color${B(n.color)}`]]}})(Nc(({theme:e})=>({color:(e.vars||e).palette.text.secondary,variants:[{props:{color:`default`,disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity)}}},...Object.entries(e.palette).filter(Vd()).map(([t])=>({props:{color:t,disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)}}})),...Object.entries(e.palette).filter(Vd()).map(([t])=>({props:{color:t},style:{[`&.${Q3.checked}, &.${Q3.indeterminate}`]:{color:(e.vars||e).palette[t].main},[`&.${Q3.disabled}`]:{color:(e.vars||e).palette.action.disabled}}})),{props:{disableRipple:!1},style:{"&:hover":{"@media (hover: none)":{backgroundColor:`transparent`}}}}]}))),t6=(0,F.jsx)(Y3,{}),n6=(0,F.jsx)(J3,{}),r6=(0,F.jsx)(X3,{}),i6=P.forwardRef(function(e,t){let n=cs({props:e,name:`MuiCheckbox`}),{checkedIcon:r=t6,color:i=`primary`,icon:a=n6,indeterminate:o=!1,indeterminateIcon:s=r6,inputProps:c,size:l=`medium`,disableRipple:u=!1,className:d,slots:f={},slotProps:p={},...m}=n,h=o?s:a,g=o?s:r,_={...n,disableRipple:u,color:i,indeterminate:o,size:l},v=$3(_),y=p.input??c,[b,x]=zc(`root`,{ref:t,elementType:e6,className:I(v.root,d),shouldForwardComponentProp:!0,externalForwardedProps:{slots:f,slotProps:p,...m},ownerState:_,additionalProps:{type:`checkbox`,icon:P.cloneElement(h,{fontSize:h.props.fontSize??l}),checkedIcon:P.cloneElement(g,{fontSize:g.props.fontSize??l}),disableRipple:u,slots:f,slotProps:{input:Sl(typeof y==`function`?y(_):y,{"data-indeterminate":o,"aria-checked":o?`mixed`:void 0})}}});return(0,F.jsx)(b,{...x,classes:v})}),a6=R(mY)(()=>({fontSize:`max(1.25rem, 18px)`})),o6=R(vY)(()=>({fontSize:`max(1rem, 14px)`})),s6=({text:e,title:t,onClose:n,onConfirm:r,open:i,onCloseText:a,onConfirmText:o,disableAutoFocus:s,disableEnforceFocus:c,disableRestoreFocus:l})=>(0,F.jsxs)(yJ,{open:i,disableAutoFocus:s,disableEnforceFocus:c,disableRestoreFocus:l,onClose:n,children:[t&&(0,F.jsx)(a6,{children:t}),e&&(0,F.jsx)(Jq,{children:(0,F.jsx)(o6,{children:e})}),(0,F.jsxs)(uJ,{children:[n&&(0,F.jsx)(ff,{onClick:n,color:`primary`,children:a}),r&&(0,F.jsx)(ff,{autoFocus:!0,onClick:r,color:`primary`,children:o})]})]});s6.defaultProps={onCloseText:`CANCEL`,onConfirmText:`OK`,disableAutoFocus:!1,disableEnforceFocus:!1,disableRestoreFocus:!1},s6.propTypes={text:v.oneOfType([v.string,v.object]),title:v.string,onClose:v.func,onConfirm:v.func,open:v.bool,onConfirmText:v.string,onCloseText:v.string,disableAutoFocus:v.bool,disableEnforceFocus:v.bool,disableRestoreFocus:v.bool};function c6(e){return typeof e==`function`||typeof e==`object`&&!!e&&typeof e.$$typeof==`symbol`}function l6(e,t){return!e||c6(e)?e:c6(e.default)?e.default:t&&c6(e[t])?e[t]:t&&c6(e[t]?.default)?e[t].default:e}l6(Jf,`InputContainer`)||l6(f6.InputContainer,`InputContainer`);var u6=Op,d6=u6.default,f6=d6&&typeof d6==`object`?d6:u6,p6=o(((e,t)=>{(function(){"use strict";var e={}.hasOwnProperty;function n(){for(var e=``,t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=i(e,r(n)))}return e}function r(t){if(typeof t==`string`||typeof t==`number`)return t;if(typeof t!=`object`)return``;if(Array.isArray(t))return n.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes(`[native code]`))return t.toString();var r=``;for(var a in t)e.call(t,a)&&t[a]&&(r=i(r,a));return r}function i(e,t){return t?e?e+` `+t:e+t:e}t!==void 0&&t.exports?(n.default=n,t.exports=n):typeof define==`function`&&typeof define.amd==`object`&&define.amd?define(`classnames`,[],function(){return n}):window.classNames=n})()}));function m6(e){return function(){return e}}var h6=Math.PI,g6=2*h6,_6=1e-6,v6=g6-_6;function y6(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function b6(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return y6;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}var x6=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._=``,this._append=e==null?y6:b6(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e=+e,t=+t,n=+n,r=+r,i=+i,i<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(this._x1===null)this._append`M${this._x1=e},${this._y1=t}`;else if(d>_6)if(!(Math.abs(u*s-c*l)>_6)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((h6-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>_6&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>_6||Math.abs(this._y1-l)>_6)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%g6+g6),d>v6?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>_6&&this._append`A${n},${n},0,${+(d>=h6)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};function S6(){return new x6}S6.prototype=x6.prototype;function C6(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new x6(t)}Array.prototype.slice;function w6(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function T6(e){this._context=e}T6.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function E6(e){return new T6(e)}function D6(e){return e[0]}function O6(e){return e[1]}function k6(e,t){var n=m6(!0),r=null,i=E6,a=null,o=C6(s);e=typeof e==`function`?e:e===void 0?D6:m6(e),t=typeof t==`function`?t:t===void 0?O6:m6(t);function s(s){var c,l=(s=w6(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c<l&&n(u=s[c],c,s))===d&&((d=!d)?a.lineStart():a.lineEnd()),d&&a.point(+e(u,c,s),+t(u,c,s));if(f)return a=null,f+``||null}return s.x=function(t){return arguments.length?(e=typeof t==`function`?t:m6(+t),s):e},s.y=function(e){return arguments.length?(t=typeof e==`function`?e:m6(+e),s):t},s.defined=function(e){return arguments.length?(n=typeof e==`function`?e:m6(!!e),s):n},s.curve=function(e){return arguments.length?(i=e,r!=null&&(a=i(r)),s):i},s.context=function(e){return arguments.length?(e==null?r=a=null:a=i(r=e),s):r},s}function A6(e,t){e(t)}function j6(){let{x:e,y:t,defined:n,curve:r}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=k6();return e&&A6(i.x,e),t&&A6(i.y,t),n&&i.defined(n),r&&i.curve(r),i}var M6=l(p6());function N6(e){let{top:t=0,left:n=0,transform:r,className:i,children:a,innerRef:o,...s}=e;return(0,F.jsx)(`g`,{ref:o,className:(0,M6.default)(`visx-group`,i),transform:r||`translate(${n}, ${t})`,...s,children:a})}function P6(e){let{from:t={x:0,y:0},to:n={x:1,y:1},fill:r=`transparent`,className:i,innerRef:a,...o}=e,s=t.x===n.x||t.y===n.y;return(0,F.jsx)(`line`,{ref:a,className:(0,M6.default)(`visx-line`,i),x1:t.x,y1:t.y,x2:n.x,y2:n.y,fill:r,shapeRendering:s?`crispEdges`:`auto`,...o})}function F6(e){let{children:t,data:n=[],x:r,y:i,fill:a=`transparent`,className:o,curve:s,innerRef:c,defined:l=()=>!0,...u}=e,d=j6({x:r,y:i,defined:l,curve:s});return t?(0,F.jsx)(F.Fragment,{children:t({path:d})}):(0,F.jsx)(`path`,{ref:c,className:(0,M6.default)(`visx-linepath`,o),d:d(n)||``,fill:a,strokeLinecap:`round`,...u})}function I6(e){let{className:t,innerRef:n,...r}=e;return(0,F.jsx)(`rect`,{ref:n,className:(0,M6.default)(`visx-bar`,t),...r})}function L6(e){let{className:t,innerRef:n,...r}=e;return(0,F.jsx)(`circle`,{ref:n,className:(0,M6.default)(`visx-circle`,t),...r})}var R6=class{x=0;y=0;constructor(e){let{x:t=0,y:n=0}=e;this.x=t,this.y=n}value(){return{x:this.x,y:this.y}}toArray(){return[this.x,this.y]}};function z6(e,t){t.domain&&(`nice`in e||`quantiles`in e||`padding`in e,e.domain(t.domain))}function B6(e,t){t.range&&(`padding`in e,e.range(t.range))}function V6(e,t){`align`in e&&`align`in t&&t.align!==void 0&&e.align(t.align)}function H6(e,t){`base`in e&&`base`in t&&t.base!==void 0&&e.base(t.base)}function U6(e,t){`clamp`in e&&`clamp`in t&&t.clamp!==void 0&&e.clamp(t.clamp)}function W6(e,t){`constant`in e&&`constant`in t&&t.constant!==void 0&&e.constant(t.constant)}function G6(e,t){`exponent`in e&&`exponent`in t&&t.exponent!==void 0&&e.exponent(t.exponent)}var K6={lab:h4,hcl:_4,"hcl-long":v4,hsl:p4,"hsl-long":m4,cubehelix:b4,"cubehelix-long":x4,rgb:Q2};function q6(e){switch(e){case`lab`:case`hcl`:case`hcl-long`:case`hsl`:case`hsl-long`:case`cubehelix`:case`cubehelix-long`:case`rgb`:return K6[e];default:}let{type:t,gamma:n}=e,r=K6[t];return n===void 0?r:r.gamma(n)}function J6(e,t){if(`interpolate`in t&&`interpolate`in e&&t.interpolate!==void 0){let n=q6(t.interpolate);e.interpolate(n)}}var Y6=new Date(Date.UTC(2020,1,2,3,4,5)),X6=`%Y-%m-%d %H:%M`;function Z6(e){return e.tickFormat(1,X6)(Y6)===`2020-02-02 03:04`}var Q6={day:y3,hour:_3,minute:h3,month:L3,second:m3,week:S3,year:z3},$6={day:b3,hour:v3,minute:g3,month:R3,second:m3,week:A3,year:B3};function e8(e,t){if(`nice`in t&&t.nice!==void 0&&`nice`in e){let{nice:n}=t;if(typeof n==`boolean`)n&&e.nice();else if(typeof n==`number`)e.nice(n);else{let t=e,r=Z6(t);if(typeof n==`string`)t.nice(r?$6[n]:Q6[n]);else{let{interval:e,step:i}=n,a=(r?$6[e]:Q6[e]).every(i);a!=null&&t.nice(a)}}}}function t8(e,t){`padding`in e&&`padding`in t&&t.padding!==void 0&&e.padding(t.padding),`paddingInner`in e&&`paddingInner`in t&&t.paddingInner!==void 0&&e.paddingInner(t.paddingInner),`paddingOuter`in e&&`paddingOuter`in t&&t.paddingOuter!==void 0&&e.paddingOuter(t.paddingOuter)}function n8(e,t){if(t.reverse){let t=e.range().slice().reverse();`padding`in e,e.range(t)}}function r8(e,t){`round`in t&&t.round!==void 0&&(t.round&&`interpolate`in t&&t.interpolate!==void 0?console.warn(`[visx/scale/applyRound] ignoring round: scale config contains round and interpolate. only applying interpolate. config:`,t):`round`in e?e.round(t.round):`interpolate`in e&&t.round&&e.interpolate(d4))}function i8(e,t){`unknown`in e&&`unknown`in t&&t.unknown!==void 0&&e.unknown(t.unknown)}function a8(e,t){if(`zero`in t&&t.zero===!0){let[t,n]=e.domain(),r=n<t,[i,a]=r?[n,t]:[t,n],o=[Math.min(0,i),Math.max(0,a)];e.domain(r?o.reverse():o)}}var o8=[`domain`,`nice`,`zero`,`interpolate`,`round`,`range`,`reverse`,`align`,`base`,`clamp`,`constant`,`exponent`,`padding`,`unknown`],s8={domain:z6,nice:e8,zero:a8,interpolate:J6,round:r8,align:V6,base:H6,clamp:U6,constant:W6,exponent:G6,padding:t8,range:B6,reverse:n8,unknown:i8};function c8(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];let r=new Set(t),i=o8.filter(e=>r.has(e));return function(e,t){return t!==void 0&&i.forEach(n=>{s8[n](e,t)}),e}}var l8=c8(`domain`,`range`,`reverse`,`align`,`padding`,`round`);function u8(e){return l8(E0(),e)}var d8=c8(`domain`,`range`,`reverse`,`align`,`padding`,`round`);function f8(e){return d8(O0(),e)}function p8(e){if((typeof e==`function`||typeof e==`object`&&e)&&`valueOf`in e){let t=e.valueOf();if(typeof t==`number`)return t}return e}function m8(e,t){let n=e;return`ticks`in n?n.ticks(t):n.domain().filter((e,n,r)=>t==null||r.length<=t||n%Math.round((r.length-1)/t)===0)}function h8(e){return e?.toString()}function g8(e){return`bandwidth`in e?e.bandwidth():0}function _8(e){let{top:t=0,left:n=0,scale:r,width:i,stroke:a=`#eaf0f6`,strokeWidth:o=1,strokeDasharray:s,className:c,children:l,numTicks:u=10,lineStyle:d,offset:f,tickValues:p,...m}=e,h=p??m8(r,u),g=(f??0)+g8(r)/2,_=h.map((e,t)=>{let n=(p8(r(e))??0)+g;return{index:t,from:new R6({x:0,y:n}),to:new R6({x:i,y:n})}});return(0,F.jsx)(N6,{className:(0,M6.default)(`visx-rows`,c),top:t,left:n,children:l?l({lines:_}):_.map(e=>{let{from:t,to:n,index:r}=e;return(0,F.jsx)(P6,{from:t,to:n,stroke:a,strokeWidth:o,strokeDasharray:s,style:d,...m},`row-line-${r}`)})})}function v8(e){let{top:t=0,left:n=0,scale:r,height:i,stroke:a=`#eaf0f6`,strokeWidth:o=1,strokeDasharray:s,className:c,numTicks:l=10,lineStyle:u,offset:d,tickValues:f,children:p,...m}=e,h=f??m8(r,l),g=(d??0)+g8(r)/2,_=h.map((e,t)=>{let n=(p8(r(e))??0)+g;return{index:t,from:new R6({x:n,y:0}),to:new R6({x:n,y:i})}});return(0,F.jsx)(N6,{className:(0,M6.default)(`visx-columns`,c),top:t,left:n,children:p?p({lines:_}):_.map(e=>{let{from:t,to:n,index:r}=e;return(0,F.jsx)(P6,{from:t,to:n,stroke:a,strokeWidth:o,strokeDasharray:s,style:u,...m},`column-line-${r}`)})})}var y8=R(`g`)(()=>({stroke:Xl()})),b8=class extends P.Component{static propTypes={className:v.string,graphProps:x$.isRequired,xBand:v.func,columnTickValues:v.array,rowTickValues:v.array};static defaultProps={};render(){let{graphProps:e,xBand:t,rowTickValues:n,columnTickValues:r}=this.props,{scale:i={},size:a={},range:o={}}=e||{},{step:s=0,labelStep:c=0}=o,l=s&&c&&s<c,u=(e,t)=>{let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=10**Math.max(n,r);return e*i%(t*i)/i},{unlabeledLines:d,labeledLines:f}=(n||[]).reduce((e,t)=>(l&&u(t,c)!==0?e.unlabeledLines.push(t):e.labeledLines.push(t),e),{unlabeledLines:[],labeledLines:[]});return(0,F.jsxs)(y8,{children:[(0,F.jsx)(_8,{scale:i.y,width:a.width,tickValues:d,lineStyle:{stroke:$l(),strokeWidth:1}}),(0,F.jsx)(_8,{scale:i.y,width:a.width,tickValues:f,lineStyle:{stroke:d.length?Ru.GRIDLINES_COLOR:$l(),strokeWidth:1}}),(0,F.jsx)(v8,{scale:t,height:a.height,offset:t.bandwidth()/2,tickValues:r})]})}},x8=o(((e,t)=>{t.exports=n;function n(e,t,n){e instanceof RegExp&&(e=r(e,n)),t instanceof RegExp&&(t=r(t,n));var a=i(e,t,n);return a&&{start:a[0],end:a[1],pre:n.slice(0,a[0]),body:n.slice(a[0]+e.length,a[1]),post:n.slice(a[1]+t.length)}}function r(e,t){var n=t.match(e);return n?n[0]:null}n.range=i;function i(e,t,n){var r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){for(r=[],a=n.length;u>=0&&!s;)u==c?(r.push(u),c=n.indexOf(e,u+1)):r.length==1?s=[r.pop(),l]:(i=r.pop(),i<a&&(a=i,o=l),l=n.indexOf(t,u+1)),u=c<l&&c>=0?c:l;r.length&&(s=[a,o])}return s}})),S8=o(((e,t)=>{t.exports=n;function n(e,t,n){e instanceof RegExp&&(e=r(e,n)),t instanceof RegExp&&(t=r(t,n));var a=i(e,t,n);return a&&{start:a[0],end:a[1],pre:n.slice(0,a[0]),body:n.slice(a[0]+e.length,a[1]),post:n.slice(a[1]+t.length)}}function r(e,t){var n=t.match(e);return n?n[0]:null}n.range=i;function i(e,t,n){var r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],a=n.length;u>=0&&!s;)u==c?(r.push(u),c=n.indexOf(e,u+1)):r.length==1?s=[r.pop(),l]:(i=r.pop(),i<a&&(a=i,o=l),l=n.indexOf(t,u+1)),u=c<l&&c>=0?c:l;r.length&&(s=[a,o])}return s}})),C8=o(((e,t)=>{var n=S8();t.exports=r;function r(e,t,n){var r=e;return i(e,t).reduce(function(e,i){return e.replace(i.functionIdentifier+`(`+i.matches.body+`)`,a(i.matches.body,i.functionIdentifier,n,r,t))},e)}function i(e,t){var r=[],i=typeof t==`string`?RegExp(`\\b(`+t+`)\\(`):t;do{var a=i.exec(e);if(!a)return r;if(a[1]===void 0)throw Error(`Missing the first couple of parenthesis to get the function identifier in `+t);var o=a[1],s=a.index,c=n(`(`,`)`,e.substring(s));if(!c||c.start!==a[0].length-1)throw SyntaxError(o+`(): missing closing ')' in the value '`+e+`'`);r.push({matches:c,functionIdentifier:o}),e=c.post}while(i.test(e));return r}function a(e,t,n,i,a){return n(r(e,a,n),t,i)}})),w8=o(((e,t)=>{var n=function(e){this.value=e};n.math={isDegree:!0,acos:function(e){return n.math.isDegree?180/Math.PI*Math.acos(e):Math.acos(e)},add:function(e,t){return e+t},asin:function(e){return n.math.isDegree?180/Math.PI*Math.asin(e):Math.asin(e)},atan:function(e){return n.math.isDegree?180/Math.PI*Math.atan(e):Math.atan(e)},acosh:function(e){return Math.log(e+Math.sqrt(e*e-1))},asinh:function(e){return Math.log(e+Math.sqrt(e*e+1))},atanh:function(e){return Math.log((1+e)/(1-e))},C:function(e,t){var r=1,i=e-t,a=t;a<i&&(a=i,i=t);for(var o=a+1;o<=e;o++)r*=o;return r/n.math.fact(i)},changeSign:function(e){return-e},cos:function(e){return n.math.isDegree&&(e=n.math.toRadian(e)),Math.cos(e)},cosh:function(e){return(Math.E**+e+Math.E**(-1*e))/2},div:function(e,t){return e/t},fact:function(e){if(e%1!=0)return`NaN`;for(var t=1,n=2;n<=e;n++)t*=n;return t},inverse:function(e){return 1/e},log:function(e){return Math.log(e)/Math.log(10)},mod:function(e,t){return e%t},mul:function(e,t){return e*t},P:function(e,t){for(var n=1,r=Math.floor(e)-Math.floor(t)+1;r<=Math.floor(e);r++)n*=r;return n},Pi:function(e,t,n){for(var r=1,i=e;i<=t;i++)r*=Number(n.postfixEval({n:i}));return r},pow10x:function(e){for(var t=1;e--;)t*=10;return t},sigma:function(e,t,n){for(var r=0,i=e;i<=t;i++)r+=Number(n.postfixEval({n:i}));return r},sin:function(e){return n.math.isDegree&&(e=n.math.toRadian(e)),Math.sin(e)},sinh:function(e){return(Math.E**+e-Math.E**(-1*e))/2},sub:function(e,t){return e-t},tan:function(e){return n.math.isDegree&&(e=n.math.toRadian(e)),Math.tan(e)},tanh:function(e){return n.sinha(e)/n.cosha(e)},toRadian:function(e){return e*Math.PI/180},and:function(e,t){return e&t}},n.Exception=function(e){this.message=e},t.exports=n})),T8=o(((e,t)=>{var n=w8();function r(e,t){for(var n=0;n<e.length;n++)e[n]+=t;return e}for(var i=[{token:`sin`,show:`sin`,type:0,value:n.math.sin},{token:`cos`,show:`cos`,type:0,value:n.math.cos},{token:`tan`,show:`tan`,type:0,value:n.math.tan},{token:`pi`,show:`π`,type:3,value:`PI`},{token:`(`,show:`(`,type:4,value:`(`},{token:`)`,show:`)`,type:5,value:`)`},{token:`P`,show:`P`,type:10,value:n.math.P},{token:`C`,show:`C`,type:10,value:n.math.C},{token:` `,show:` `,type:14,value:` `.anchor},{token:`asin`,show:`asin`,type:0,value:n.math.asin},{token:`acos`,show:`acos`,type:0,value:n.math.acos},{token:`atan`,show:`atan`,type:0,value:n.math.atan},{token:`7`,show:`7`,type:1,value:`7`},{token:`8`,show:`8`,type:1,value:`8`},{token:`9`,show:`9`,type:1,value:`9`},{token:`int`,show:`Int`,type:0,value:Math.floor},{token:`cosh`,show:`cosh`,type:0,value:n.math.cosh},{token:`acosh`,show:`acosh`,type:0,value:n.math.acosh},{token:`ln`,show:` ln`,type:0,value:Math.log},{token:`^`,show:`^`,type:10,value:Math.pow},{token:`root`,show:`root`,type:0,value:Math.sqrt},{token:`4`,show:`4`,type:1,value:`4`},{token:`5`,show:`5`,type:1,value:`5`},{token:`6`,show:`6`,type:1,value:`6`},{token:`/`,show:`÷`,type:2,value:n.math.div},{token:`!`,show:`!`,type:7,value:n.math.fact},{token:`tanh`,show:`tanh`,type:0,value:n.math.tanh},{token:`atanh`,show:`atanh`,type:0,value:n.math.atanh},{token:`Mod`,show:` Mod `,type:2,value:n.math.mod},{token:`1`,show:`1`,type:1,value:`1`},{token:`2`,show:`2`,type:1,value:`2`},{token:`3`,show:`3`,type:1,value:`3`},{token:`*`,show:`×`,type:2,value:n.math.mul},{token:`sinh`,show:`sinh`,type:0,value:n.math.sinh},{token:`asinh`,show:`asinh`,type:0,value:n.math.asinh},{token:`e`,show:`e`,type:3,value:`E`},{token:`log`,show:` log`,type:0,value:n.math.log},{token:`0`,show:`0`,type:1,value:`0`},{token:`.`,show:`.`,type:6,value:`.`},{token:`+`,show:`+`,type:9,value:n.math.add},{token:`-`,show:`-`,type:9,value:n.math.sub},{token:`,`,show:`,`,type:11,value:`,`},{token:`Sigma`,show:`Σ`,type:12,value:n.math.sigma},{token:`n`,show:`n`,type:13,value:`n`},{token:`Pi`,show:`Π`,type:12,value:n.math.Pi},{token:`pow`,show:`pow`,type:8,value:Math.pow,numberOfArguments:2},{token:`&`,show:`&`,type:9,value:n.math.and}],a={0:11,1:0,2:3,3:0,4:0,5:0,6:0,7:11,8:11,9:1,10:10,11:0,12:11,13:0,14:-1,15:11},o=0;o<i.length;o++)i[o].precedence=a[i[o].type];var s={0:!0,1:!0,3:!0,4:!0,6:!0,8:!0,9:!0,12:!0,13:!0,14:!0,15:!0},c={0:!0,1:!0,2:!0,3:!0,4:!0,5:!0,6:!0,7:!0,8:!0,9:!0,10:!0,11:!0,12:!0,13:!0,15:!0},l={0:!0,3:!0,4:!0,8:!0,12:!0,13:!0,15:!0},u={},d={0:!0,1:!0,3:!0,4:!0,6:!0,8:!0,12:!0,13:!0,15:!0},f={1:!0},p=[[],`123789456+-*/()^!PCe0.,n &`.split(``),[`pi`,`ln`,`Pi`],[`sin`,`cos`,`tan`,`Del`,`int`,`Mod`,`log`,`pow`],[`asin`,`acos`,`atan`,`cosh`,`root`,`tanh`,`sinh`],[`acosh`,`atanh`,`asinh`,`Sigma`]];function m(e,t,n,r){for(var i=0;i<r;i++)if(e[n+i]!==t[i])return!1;return!0}n.tokenTypes={FUNCTION_WITH_ONE_ARG:0,NUMBER:1,BINARY_OPERATOR_HIGH_PRECENDENCE:2,CONSTANT:3,OPENING_PARENTHESIS:4,CLOSING_PARENTHESIS:5,DECIMAL:6,POSTFIX_FUNCTION_WITH_ONE_ARG:7,FUNCTION_WITH_N_ARGS:8,BINARY_OPERATOR_LOW_PRECENDENCE:9,BINARY_OPERATOR_PERMUTATION:10,COMMA:11,EVALUATED_FUNCTION:12,EVALUATED_FUNCTION_PARAMETER:13,SPACE:14},n.addToken=function(e){for(var t=0;t<e.length;t++){var r=e[t].token.length,o=-1;e[t].type===n.tokenTypes.FUNCTION_WITH_N_ARGS&&e[t].numberOfArguments===void 0&&(e[t].numberOfArguments=2),p[r]=p[r]||[];for(var s=0;s<p[r].length;s++)if(e[t].token===p[r][s]){o=h(p[r][s],i);break}o===-1?(i.push(e[t]),e[t].precedence=a[e[t].type],p.length<=e[t].token.length&&(p[e[t].token.length]=[]),p[e[t].token.length].push(e[t].token)):(i[o]=e[t],e[t].precedence=a[e[t].type])}};function h(e,t){for(var n=0;n<t.length;n++)if(t[n].token===e)return n;return-1}function g(e){for(var t=[],r=e.length,a,o,s,c=0;c<r;c++)if(!(c<r-1&&e[c]===` `&&e[c+1]===` `)){for(a=``,o=e.length-c>p.length-2?p.length-1:e.length-c;o>0;o--)if(p[o]!==void 0)for(s=0;s<p[o].length;s++)m(e,p[o][s],c,o)&&(a=p[o][s],s=p[o].length,o=0);if(c+=a.length-1,a===``)throw new n.Exception(`Can't understand after `+e.slice(c));t.push(i[h(a,i)])}return t}var _={value:n.math.changeSign,type:0,pre:21,show:`-`},v={value:`)`,show:`)`,type:5,pre:0},y={value:`(`,type:4,pre:0,show:`(`};n.lex=function(e,t){"use strict";var i=[y],a=[],o=e,p=s,m=0,h=u,b=``,x;t!==void 0&&n.addToken(t);var S={},C=g(o);for(x=0;x<C.length;x++){var w=C[x];if(w.type===14){if(x>0&&x<C.length-1&&C[x+1].type===1&&(C[x-1].type===1||C[x-1].type===6))throw new n.Exception(`Unexpected Space`);continue}var T=w.token,E=w.type,D=w.value,O=w.precedence,k=w.show,A=i[i.length-1],j;for(j=a.length;j--&&a[j]===0;)if([0,2,3,4,5,9,11,12,13].indexOf(E)!==-1){if(p[E]!==!0)throw new n.Exception(T+` is not allowed after `+b);i.push(v),p=c,h=d,a.pop()}if(p[E]!==!0)throw new n.Exception(T+` is not allowed after `+b);if(h[E]===!0&&(E=2,D=n.math.mul,k=`×`,O=3,--x),S={value:D,type:E,pre:O,show:k,numberOfArguments:w.numberOfArguments},E===0)p=s,h=u,r(a,2),i.push(S),C[x+1].type!==4&&(i.push(y),a.push(2));else if(E===1)A.type===1?(A.value+=D,r(a,1)):i.push(S),p=c,h=l;else if(E===2)p=s,h=u,r(a,2),i.push(S);else if(E===3)i.push(S),p=c,h=d;else if(E===4)r(a,1),m++,p=s,h=u,i.push(S);else if(E===5){if(!m)throw new n.Exception(`Closing parenthesis are more than opening one, wait What!!!`);m--,p=c,h=d,i.push(S),r(a,1)}else if(E===6){if(A.hasDec)throw new n.Exception(`Two decimals are not allowed in one number`);A.type!==1&&(A={value:0,type:1,pre:0},i.push(A)),p=f,r(a,1),h=u,A.value+=D,A.hasDec=!0}else E===7&&(p=c,h=d,r(a,1),i.push(S));E===8?(p=s,h=u,r(a,w.numberOfArguments+2),i.push(S),C[x+1].type!==4&&(i.push(y),a.push(w.numberOfArguments+2))):E===9?(A.type===9?A.value===n.math.add?(A.value=D,A.show=k,r(a,1)):A.value===n.math.sub&&k===`-`&&(A.value=n.math.add,A.show=`+`,r(a,1)):A.type!==5&&A.type!==7&&A.type!==1&&A.type!==3&&A.type!==13?T===`-`&&(p=s,h=u,r(a,2).push(2),i.push(_),i.push(y)):(i.push(S),r(a,2)),p=s,h=u):E===10?(p=s,h=u,r(a,2),i.push(S)):E===11?(p=s,h=u,i.push(S)):E===12?(p=s,h=u,r(a,6),i.push(S),C[x+1].type!==4&&(i.push(y),a.push(6))):E===13&&(p=c,h=d,i.push(S)),r(a,-1),b=T}for(j=a.length;j--;)i.push(v);if(p[5]!==!0)throw new n.Exception(`complete the expression`);for(;m--;)i.push(v);return i.push(v),new n(i)},t.exports=n})),E8=o(((e,t)=>{var n=T8();n.prototype.toPostfix=function(){"use strict";for(var e=[],t,r,i,a,o,s=[{value:`(`,type:4,pre:0}],c=this.value,l=1;l<c.length;l++)if(c[l].type===1||c[l].type===3||c[l].type===13)c[l].type===1&&(c[l].value=Number(c[l].value)),e.push(c[l]);else if(c[l].type===4)s.push(c[l]);else if(c[l].type===5)for(;(r=s.pop()).type!==4;)e.push(r);else if(c[l].type===11){for(;(r=s.pop()).type!==4;)e.push(r);s.push(r)}else{t=c[l],a=t.pre,o=s[s.length-1],i=o.pre;var u=o.value==`Math.pow`&&t.value==`Math.pow`;if(a>i)s.push(t);else{for(;i>=a&&!u||u&&a<i;)r=s.pop(),o=s[s.length-1],e.push(r),i=o.pre,u=t.value==`Math.pow`&&o.value==`Math.pow`;s.push(t)}}return new n(e)},t.exports=n})),D8=o(((e,t)=>{var n=E8();n.prototype.postfixEval=function(e){"use strict";e||={},e.PI=Math.PI,e.E=Math.E;for(var t=[],r,i,a,o=this.value,s=e.n!==void 0,c=0;c<o.length;c++)if(o[c].type===1)t.push({value:o[c].value,type:1});else if(o[c].type===3)t.push({value:e[o[c].value],type:1});else if(o[c].type===0)t[t.length-1].type===void 0?t[t.length-1].value.push(o[c]):t[t.length-1].value=o[c].value(t[t.length-1].value);else if(o[c].type===7)t[t.length-1].type===void 0?t[t.length-1].value.push(o[c]):t[t.length-1].value=o[c].value(t[t.length-1].value);else if(o[c].type===8){for(var l=[],u=0;u<o[c].numberOfArguments;u++)l.push(t.pop().value);t.push({type:1,value:o[c].value.apply(o[c],l.reverse())})}else o[c].type===10?(r=t.pop(),i=t.pop(),i.type===void 0?(i.value=i.concat(r),i.value.push(o[c]),t.push(i)):r.type===void 0?(r.unshift(i),r.push(o[c]),t.push(r)):t.push({type:1,value:o[c].value(i.value,r.value)})):o[c].type===2||o[c].type===9?(r=t.pop(),i=t.pop(),i.type===void 0?(i=i.concat(r),i.push(o[c]),t.push(i)):r.type===void 0?(r.unshift(i),r.push(o[c]),t.push(r)):t.push({type:1,value:o[c].value(i.value,r.value)})):o[c].type===12?(r=t.pop(),r.type!==void 0&&(r=[r]),i=t.pop(),a=t.pop(),t.push({type:1,value:o[c].value(a.value,i.value,new n(r))})):o[c].type===13&&(s?t.push({value:e[o[c].value],type:3}):t.push([o[c]]));if(t.length>1)throw new n.Exception(`Uncaught Syntax error`);return t[0].value>0x38d7ea4c68000?`Infinity`:parseFloat(t[0].value.toFixed(15))},n.eval=function(e,t,n){return t===void 0?this.lex(e).toPostfix().postfixEval():n===void 0?t.length===void 0?this.lex(e).toPostfix().postfixEval(t):this.lex(e,t).toPostfix().postfixEval():this.lex(e,t).toPostfix().postfixEval(n)},t.exports=n})),O8=o(((e,t)=>{var n=D8();n.prototype.formulaEval=function(){"use strict";for(var e,t,n,r=[],i=this.value,a=0;a<i.length;a++)i[a].type===1||i[a].type===3?r.push({value:i[a].type===3?i[a].show:i[a].value,type:1}):i[a].type===13?r.push({value:i[a].show,type:1}):i[a].type===0?r[r.length-1]={value:i[a].show+(i[a].show==`-`?``:`(`)+r[r.length-1].value+(i[a].show==`-`?``:`)`),type:0}:i[a].type===7?r[r.length-1]={value:(r[r.length-1].type==1?``:`(`)+r[r.length-1].value+(r[r.length-1].type==1?``:`)`)+i[a].show,type:7}:i[a].type===10?(e=r.pop(),t=r.pop(),i[a].show===`P`||i[a].show===`C`?r.push({value:`<sup>`+t.value+`</sup>`+i[a].show+`<sub>`+e.value+`</sub>`,type:10}):r.push({value:(t.type==1?``:`(`)+t.value+(t.type==1?``:`)`)+`<sup>`+e.value+`</sup>`,type:1})):i[a].type===2||i[a].type===9?(e=r.pop(),t=r.pop(),r.push({value:(t.type==1?``:`(`)+t.value+(t.type==1?``:`)`)+i[a].show+(e.type==1?``:`(`)+e.value+(e.type==1?``:`)`),type:i[a].type})):i[a].type===12&&(e=r.pop(),t=r.pop(),n=r.pop(),r.push({value:i[a].show+`(`+n.value+`,`+t.value+`,`+e.value+`)`,type:12}));return r[0].value},t.exports=n})),k8=o(((e,t)=>{var n=x8(),r=C8(),i=O8(),a=100,o=/(\+|\-|\*|\\|[^a-z]|)(\s*)(\()/g,s;t.exports=c;function c(e,t){s=0,t=10**(t===void 0?5:t),e=e.replace(/\n+/g,` `);function c(e,n,r){if(s++>a)throw s=0,Error(`Call stack overflow for `+r);if(e===``)throw Error(n+`(): '`+r+`' must contain a non-whitespace string`);e=u(e,r);var o=l(e);if(o.length>1||e.indexOf(`var(`)>-1)return n+`(`+e+`)`;var c=o[0]||``;c===`%`&&(e=e.replace(/\b[0-9\.]+%/g,function(e){return parseFloat(e.slice(0,-1))*.01}));var d=e.replace(new RegExp(c,`gi`),``),f;try{f=i.eval(d)}catch{return n+`(`+e+`)`}return c===`%`&&(f*=100),(n.length||c===`%`)&&(f=Math.round(f*t)/t),f+=c,f}function u(e,t){e=e.replace(/((?:\-[a-z]+\-)?calc)/g,``);for(var r=``,i=e,a;a=o.exec(i);){a[0].index>0&&(r+=i.substring(0,a[0].index));var s=n(`(`,`)`,i.substring([0].index));if(s.body===``)throw Error(`'`+e+`' must contain a non-whitespace string`);var l=c(s.body,``,t);r+=s.pre+l,i=s.post}return r+i}return r(e,/((?:\-[a-z]+\-)?calc)\(/,c)}function l(e){for(var t=[],n=[],r=/[\.0-9]([%a-z]+)/gi,i=r.exec(e);i;)!i||!i[1]||(n.indexOf(i[1].toLowerCase())===-1&&(t.push(i[1]),n.push(i[1].toLowerCase())),i=r.exec(e));return t}}));function A8(e,t){let n=new Map;return function(){for(var r=arguments.length,i=Array(r),a=0;a<r;a++)i[a]=arguments[a];let o=t(...i);if(n.has(o))return n.get(o);let s=e.apply(this,i);return n.set(o,s),s}}var j8=`__react_svg_text_measurement_id`;function M8(e,t){if(typeof document>`u`)return null;try{let n=document.getElementById(j8);if(!n){let e=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);e.setAttribute(`aria-hidden`,`true`),e.style.width=`0`,e.style.height=`0`,e.style.position=`absolute`,e.style.top=`-100%`,e.style.left=`-100%`,n=document.createElementNS(`http://www.w3.org/2000/svg`,`text`),n.setAttribute(`id`,j8),e.appendChild(n),document.body.appendChild(e)}return Object.assign(n.style,t),n.textContent=e,n.getComputedTextLength()}catch{return null}}var N8=A8(M8,(e,t)=>`${e}_${JSON.stringify(t)}`),P8=l(k8());function F8(e){return typeof e==`number`}function I8(e){return typeof e==`number`&&Number.isFinite(e)||typeof e==`string`}function L8(e){let{verticalAnchor:t=`end`,scaleToFit:n=!1,angle:r,width:i,lineHeight:a=`1em`,capHeight:o=`0.71em`,children:s,style:c,...l}=e,{x:u=0,y:d=0}=l,f=!I8(u)||!I8(d),{wordsWithWidth:p,spaceWidth:m}=(0,P.useMemo)(()=>({wordsWithWidth:(s==null?[]:s.toString().split(/(?:(?!\u00A0+)\s+)/)).map(e=>({word:e,wordWidth:N8(e,c)||0})),spaceWidth:N8(`\xA0`,c)||0}),[s,c]),h=(0,P.useMemo)(()=>f?[]:i||n?p.reduce((e,t)=>{let{word:r,wordWidth:a}=t,o=e[e.length-1];if(o&&(i==null||n||(o.width||0)+a+m<i))o.words.push(r),o.width=o.width||0,o.width+=a+m;else{let t={words:[r],width:a};e.push(t)}return e},[]):[{words:s==null?[]:s.toString().split(/(?:(?!\u00A0+)\s+)/)}],[f,i,n,s,p,m]);return{wordsByLines:h,startDy:(0,P.useMemo)(()=>f?``:t===`start`?(0,P8.default)(`calc(${o})`):t===`middle`?(0,P8.default)(`calc(${(h.length-1)/2} * -${a} + (${o} / 2))`):(0,P8.default)(`calc(${h.length-1} * -${a})`),[f,t,o,h.length,a]),transform:(0,P.useMemo)(()=>{let e=[];if(f)return``;if(F8(u)&&F8(d)&&F8(i)&&n&&h.length>0){let t=h[0].width||1,r=n===`shrink-only`?Math.min(i/t,1):i/t,a=r,o=u-r*u,s=d-a*d;e.push(`matrix(${r}, 0, 0, ${a}, ${o}, ${s})`)}return r&&e.push(`rotate(${r}, ${u}, ${d})`),e.length>0?e.join(` `):``},[f,u,d,i,n,h,r])}}var R8={overflow:`visible`};function z8(e){let{dx:t=0,dy:n=0,textAnchor:r=`start`,innerRef:i,innerTextRef:a,verticalAnchor:o,angle:s,lineHeight:c=`1em`,scaleToFit:l=!1,capHeight:u,width:d,...f}=e,{x:p=0,fontSize:m}=f,{wordsByLines:h,startDy:g,transform:_}=L8(e);return(0,F.jsx)(`svg`,{ref:i,x:t,y:n,fontSize:m,style:R8,children:h.length>0?(0,F.jsx)(`text`,{ref:a,transform:_,...f,textAnchor:r,children:h.map((e,t)=>(0,F.jsx)(`tspan`,{x:p,dy:t===0?g:c,children:e.words.join(` `)},t))}):null})}var B8={top:`top`,left:`left`,right:`right`,bottom:`bottom`};function V8(e){let{labelOffset:t,labelProps:n,orientation:r,range:i,tickLabelFontSize:a,tickLength:o}=e,s=r===B8.left||r===B8.top?-1:1,c,l,u;if(r===B8.top||r===B8.bottom){let e=r===B8.bottom&&typeof n.fontSize==`number`?n.fontSize:0;c=(Number(i[0])+Number(i[i.length-1]))/2,l=s*(o+t+a+e)}else c=s*((Number(i[0])+Number(i[i.length-1]))/2),l=-(o+t),u=`rotate(${s*90})`;return{x:c,y:l,transform:u}}function H8(e){let{hideTicks:t,horizontal:n,orientation:r,tickClassName:i,tickComponent:a,tickLabelProps:o,tickStroke:s=`#222`,tickTransform:c,ticks:l,strokeWidth:u,tickLineProps:d}=e;return l.map(e=>{let{value:l,index:f,from:p,to:m,formattedValue:h}=e,g=o[f]??{},_=Math.max(10,typeof g.fontSize==`number`&&g.fontSize||0),v=m.y+(n&&r!==B8.top?_:0);return(0,F.jsxs)(N6,{className:(0,M6.default)(`visx-axis-tick`,i),transform:c,children:[!t&&(0,F.jsx)(P6,{from:p,to:m,stroke:s,strokeWidth:u,strokeLinecap:`square`,...d}),a?a({...g,x:m.x,y:v,formattedValue:h}):(0,F.jsx)(z8,{x:m.x,y:v,...g,children:h})]},`visx-tick-${l}-${f}`)})}var U8={textAnchor:`middle`,fontFamily:`Arial`,fontSize:10,fill:`#222`};function W8(e){let{axisFromPoint:t,axisLineClassName:n,axisToPoint:r,hideAxisLine:i,hideTicks:a,horizontal:o,label:s=``,labelClassName:c,labelOffset:l=14,labelProps:u,orientation:d=B8.bottom,scale:f,stroke:p=`#222`,strokeDasharray:m,strokeWidth:h=1,tickClassName:g,tickComponent:_,tickLineProps:v,tickLabelProps:y,tickLength:b=8,tickStroke:x=`#222`,tickTransform:S,ticks:C,ticksComponent:w=H8}=e,T={...U8,...u},E={...U8,...typeof y==`object`?y:null},D=C.map(e=>{let{value:t,index:n}=e;return typeof y==`function`?y(t,n,C):E}),O=Math.max(10,...D.map(e=>typeof e.fontSize==`number`?e.fontSize:0));return(0,F.jsxs)(F.Fragment,{children:[w({hideTicks:a,horizontal:o,orientation:d,scale:f,tickClassName:g,tickComponent:_,tickLabelProps:D,tickStroke:x,tickTransform:S,ticks:C,strokeWidth:h,tickLineProps:v}),!i&&(0,F.jsx)(P6,{className:(0,M6.default)(`visx-axis-line`,n),from:t,to:r,stroke:p,strokeWidth:h,strokeDasharray:m}),s&&(0,F.jsx)(z8,{className:(0,M6.default)(`visx-axis-label`,c),...V8({labelOffset:l,labelProps:T,orientation:d,range:f.range(),tickLabelFontSize:O,tickLength:b}),...T,children:s})]})}function G8(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`center`,n=e;if(t!==`start`&&`bandwidth`in n){let e=n.bandwidth();return t===`center`&&(e/=2),n.round()&&(e=Math.round(e)),t=>{let r=n(t);return typeof r==`number`?r+e:r}}return e}function K8(e){let t=e;return`tickFormat`in t?t.tickFormat():h8}function q8(e,t){let{x:n,y:r}=e;return new R6(t?{x:n,y:r}:{x:r,y:n})}function J8(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return typeof e==`number`?{start:e,end:e}:{start:0,end:0,...e}}function Y8(e){let{children:t=W8,axisClassName:n,hideAxisLine:r=!1,hideTicks:i=!1,hideZero:a=!1,innerRef:o,left:s=0,numTicks:c=10,orientation:l=B8.bottom,rangePadding:u=0,scale:d,tickFormat:f,tickLength:p=8,tickValues:m,top:h=0,...g}=e,_=f??K8(d),v=l===B8.left,y=l===B8.top,b=y||l===B8.bottom,x=G8(d),S=v||y?-1:1,C=d.range(),w=J8(u),T=q8({x:Number(C[0])+.5-w.start,y:0},b),E=q8({x:Number(C[C.length-1])+.5+w.end,y:0},b),D=(m??m8(d,c)).filter(e=>!a||e!==0&&e!==`0`).map((e,t)=>({value:e,index:t})),O=D.map(e=>{let{value:t,index:n}=e,r=p8(x(t));return{value:t,index:n,from:q8({x:r,y:0},b),to:q8({x:r,y:p*S},b),formattedValue:_(t,n,D)}});return(0,F.jsx)(N6,{className:(0,M6.default)(`visx-axis`,n),innerRef:o,top:h,left:s,children:t({...g,axisFromPoint:T,axisToPoint:E,hideAxisLine:r,hideTicks:i,hideZero:a,horizontal:b,numTicks:c,orientation:l,rangePadding:u,scale:d,tickFormat:_,tickLength:p,tickPosition:x,tickSign:S,ticks:O})})}var X8={dx:`-0.25em`,dy:`0.25em`,fill:`#222`,fontFamily:`Arial`,fontSize:10,textAnchor:`end`};function Z8(e){let{axisClassName:t,labelOffset:n=36,tickLength:r=8,tickLabelProps:i,...a}=e,o=typeof i==`function`?i:{...X8,...i};return(0,F.jsx)(Y8,{axisClassName:(0,M6.default)(`visx-axis-left`,t),labelOffset:n,orientation:B8.left,tickLabelProps:o,tickLength:r,...a})}var Q8={dy:`0.25em`,fill:`#222`,fontFamily:`Arial`,fontSize:10,textAnchor:`middle`};function $8(e){let{axisClassName:t,labelOffset:n=8,tickLength:r=8,tickLabelProps:i,...a}=e,o=typeof i==`function`?i:{...Q8,...i};return(0,F.jsx)(Y8,{axisClassName:(0,M6.default)(`visx-axis-bottom`,t),labelOffset:n,orientation:B8.bottom,tickLabelProps:o,tickLength:r,...a})}var e5=ml((0,F.jsx)(`path`,{d:`M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z`}),`Close`),t5=R(pR)(({theme:e})=>({borderRadius:e.spacing(2),color:V.WHITE,fontSize:`16px`,width:`16px`,height:`16px`,padding:`2px`,border:`1px solid ${V.WHITE}`,stroke:`initial`,boxSizing:`unset`,backgroundColor:Bl(),display:`block`,"&.small":{fontSize:`10px`,width:`10px`,height:`10px`}})),n5=R(e5)(({theme:e})=>({borderRadius:e.spacing(2),color:V.WHITE,fontSize:`16px`,width:`16px`,height:`16px`,padding:`2px`,border:`1px solid ${V.WHITE}`,stroke:`initial`,boxSizing:`unset`,backgroundColor:Gl(),display:`block`,"&.small":{fontSize:`10px`,width:`10px`,height:`10px`}})),r5=({scale:e,x:t,y:n,correctness:r,interactive:i})=>{if(!r||!i)return null;let a=e?e.x(t):t,o=e?e.y(n):n,s=r.value===`correct`;return(0,F.jsx)(`foreignObject`,{x:a-11,y:o-11,width:22,height:22,children:s?(0,F.jsx)(t5,{title:r.label}):(0,F.jsx)(n5,{title:r.label})})},i5=({scale:e,x:t,correctness:n,correctData:r,label:i})=>{if(n&&n.value===`incorrect`){let a=parseFloat(r.find(e=>e.label===i)?.value);if(isNaN(a))return null;let o=e.y(a)-7.5;return(0,F.jsx)(`foreignObject`,{x:e.x(t)-7.5,y:o,width:15,height:15,children:(0,F.jsx)(t5,{className:`small`,title:n.label})})}return null},a5=({correctness:e,interactive:t})=>!e||!t?null:e.value===`correct`?(0,F.jsx)(t5,{title:e.label}):(0,F.jsx)(n5,{title:e.label});r5.propTypes={scale:v.shape({x:v.func,y:v.func}),x:v.number.isRequired,y:v.number.isRequired,correctness:v.shape({value:v.string,label:v.string}),interactive:v.bool},i5.propTypes={scale:v.shape({x:v.func,y:v.func}).isRequired,x:v.number.isRequired,correctness:v.shape({value:v.string,label:v.string}),correctData:v.arrayOf(v.shape({label:v.string,value:v.oneOfType([v.string,v.number])})),label:v.string},a5.propTypes={correctness:v.shape({value:v.string,label:v.string}),interactive:v.bool};var o5=(e,t)=>`${t}-${e.label||`-`}`,s5=(e,t,n,r)=>{let i=n||400,a=t&&t.length?t.map(o5):[`default`];switch(r){case`bar`:case`dotPlot`:case`linePlot`:return u8({range:[0,i],domain:a,padding:.2});case`histogram`:return u8({range:[0,i],domain:a,padding:0});case`lineCross`:case`lineDot`:return f8({domain:a,range:[0,i]});default:return u8({range:[0,i],domain:a,padding:0})}},c5=(e={})=>{let t=[],n=e.min;for(;n<=e.max;)t.push(n),n=Math.round((n+e.step)*1e4)/1e4;return t},l5=(e,t,n)=>{let{step:r,labelStep:i,min:a,max:o}=t||{};switch(a||=0,(!o||o<0)&&(o=t.min+1),r||=i||1,(!i||isNaN(i)&&r)&&(i=r||1),t.max=o,n){case`dotPlot`:case`linePlot`:{let n=Math.round(a),r=Math.round(o);return{domain:{...e,step:1,labelStep:1,min:0,max:1},range:{...t,min:n,max:n===r?n+1:r,labelStep:i,step:1}}}default:return{domain:{...e,step:1,labelStep:1,min:0,max:1},range:{...t,labelStep:i,step:r}}}},u5=(e,t)=>{switch(t){case`lineDot`:case`lineCross`:return{verticalLines:void 0,horizontalLines:c5(e),leftAxis:!0};case`dotPlot`:case`linePlot`:return{verticalLines:[],horizontalLines:[],leftAxis:!1};default:return{verticalLines:[],horizontalLines:c5(e),leftAxis:!0}}},d5=(e,t)=>t>=e*2?25:0,f5=e=>e<30?50:e<40?30:e<60?15:0,p5=e=>{let t,n;return e>91?(t=1.3,n=-55):e>45?(t=1.1,n=-45):e>40?(t=.5+(e-34)*.02,n=-25):e>30?(t=.5+(e-34)*.02,n=-20):(t=.5*.98**(34-e),n=-15),{scale:t,deltay:n}},m5=(e,t)=>(e-57*t)/2,h5=e=>{let t=Number.parseFloat(e);return Number.isFinite(t)?t:0},g5=(e,t)=>{let n=e??t;return typeof n==`number`?n:typeof n==`string`&&n.endsWith(`px`)?h5(n):1},_5=P.forwardRef(({className:e,inputClassName:t,inputRef:n,inputStyle:r,minWidth:i,placeholder:a,style:o,value:s,defaultValue:c,...l},u)=>{let d=(0,P.useRef)(null),f=(0,P.useRef)(n),p=(0,P.useRef)(u),m=(0,P.useRef)(null),[h,g]=(0,P.useState)(()=>g5(i,r?.minWidth));f.current=n,p.current=u;let _=(0,P.useCallback)(e=>{d.current=e,f.current?.(e);let t=p.current;typeof t==`function`?t(e):t&&(t.current=e)},[]);return(0,P.useLayoutEffect)(()=>{let e=d.current,t=m.current;if(!e||!t)return;let n=window.getComputedStyle(e);t.style.font=n.font,t.style.letterSpacing=n.letterSpacing,t.style.textTransform=n.textTransform,t.textContent=String(s??c??a??``)||` `;let o=h5(n.paddingLeft)+h5(n.paddingRight)+h5(n.borderLeftWidth)+h5(n.borderRightWidth),l=Math.ceil(t.getBoundingClientRect().width+2),u=n.boxSizing===`border-box`?l+o:l;g(Math.max(g5(i,r?.minWidth),u))},[c,t,r,i,a,s]),(0,F.jsxs)(`span`,{className:e,style:{display:`inline-block`,...o},children:[(0,F.jsx)(`input`,{...l,ref:_,className:t,placeholder:a,style:{width:h,...r},value:s,defaultValue:c}),(0,F.jsx)(`span`,{ref:m,"aria-hidden":`true`,style:{height:0,left:0,overflow:`hidden`,position:`absolute`,top:0,visibility:`hidden`,whiteSpace:`pre`}})]})});_5.displayName=`AutosizeInput`;var v5=(e=`fill`)=>({[e]:`var(--graph-disabled, ${Ll()})`,pointerEvents:`none`,border:`none`}),y5=(e=`fill`)=>({[e]:Bl(),pointerEvents:`none`,border:`solid 1px ${Bl()}`}),b5=(e=`fill`)=>({[e]:Wl(),pointerEvents:`none`,border:`solid 1px ${Wl()}`}),x5=R(`div`)({display:`flex`,flexDirection:`column`,alignItems:`center`}),S5=zl();R(`input`)(({theme:e})=>({float:`right`,fontFamily:e.typography.fontFamily,fontSize:e.typography.fontSize,border:`none`,"&.correct":y5(`color`),"&.incorrect":b5(`color`),"&.disabledMarkLabel":{backgroundColor:`transparent !important`},"&.error":{border:`2px solid ${e.palette.error.main}`}}));var C5=R(`div`)(({theme:e})=>({pointerEvents:`auto`,textAlign:`center`,fontSize:e.typography.fontSize+2,fontFamily:e.typography.fontFamily,color:Zl(),paddingTop:e.typography.fontSize/2,"&.disabledMarkLabel":{...v5(`color`),color:S5,backgroundColor:`transparent !important`},"&.error":{border:`2px solid ${e.palette.error.main}`},"&.correct":{...y5(`color`)},"&.incorrect":{...b5(`color`)}}));function w5(e){let t=e?.trim()||``;return new RegExp(/^[1-9]*[0-9]*\s?[1-9][0-9]*\/[1-9][0-9]*$/).test(t)}function T5(e){let t=e?.trim()||``,n,r=``,i=t.split(` `);n=i[1]&&i[1].includes(`/`)?i[1].split(`/`)||``:t?.split(`/`)||``;let a;if(w5(e))return i[0]&&i[1]&&(r=i[0]),a=`\\(${r}\\frac{${n[0]}}{${n[1]}}\\)`,a}var E5=e=>{let[t,n]=(0,P.useState)(null),r=(0,P.useCallback)(e=>n(e),null),{mark:i={},disabled:a,inputRef:o,barWidth:s,rotate:c,correctness:l,autoFocus:u,error:d,isHiddenLabel:f,limitCharacters:p,correctnessIndicator:m}=e,[h,g]=(0,P.useState)(i.label),[_,v]=(0,P.useState)(T5(i.label)),[y,b]=(0,P.useState)(!1),x=(0,P.useRef)(null),S=e=>{p&&e.target.value&&e.target.value.length>20||g(e.target.value)},C=()=>y===!1&&_!==void 0,w=t=>{v(T5(i.label)),b(!1),e.onChange(t.target.value)},T={};return c&&(T={width:`unset`,textAlign:`left`}),(0,P.useEffect)(()=>{g(i.label)},[i.label]),(0,P.useEffect)(()=>{let e=x.current;e&&_&&(e.innerHTML=_,hd(e))},[h,_]),(0,F.jsxs)(x5,{children:[m,C()?(0,F.jsx)(C5,{ref:e=>{x.current=e,typeof o==`function`&&o(e)},className:I({disabledMarkLabel:a,error:d,correct:i.editable&&l?.label===`correct`,incorrect:i.editable&&l?.label===`incorrect`}),onClick:()=>b(!0),style:{minWidth:s,position:`fixed`,transformOrigin:`left`,transform:`rotate(${c}deg)`,visibility:f?`hidden`:`unset`,marginTop:m?`24px`:`0`}}):(0,F.jsx)(_5,{inputRef:e=>{r(e),typeof o==`function`&&o(e)},name:`mark-label-input`,autoFocus:y||u,disabled:a,inputClassName:I(l&&i.editable?l.label:null,a&&`disabledMarkLabel`,d&&`error`),inputStyle:{minWidth:s,textAlign:`center`,background:`transparent`,boxSizing:`border-box`,paddingLeft:0,paddingRight:0,border:`none`,...a?{color:S5,WebkitTextFillColor:S5}:{},...T},value:h,style:{position:`fixed`,pointerEvents:`auto`,top:0,left:0,minWidth:s,transformOrigin:`left`,transform:`rotate(${c}deg)`,visibility:f?`hidden`:`unset`,marginTop:m?`24px`:`0`},onChange:S,onBlur:w})]})};E5.propTypes={autoFocus:v.bool,disabled:v.bool,error:v.any,onChange:v.func,graphProps:x$,inputRef:v.func,mark:v.object,barWidth:v.number,rotate:v.number,correctness:v.shape({value:v.string,label:v.string}),isHiddenLabel:v.bool,limitCharacters:v.bool,correctnessIndicator:v.node};var D5=new Set,O5=null;function k5(e){D5.add(e),!O5&&typeof document<`u`&&(O5=new MutationObserver(()=>{D5.forEach(e=>e())}),O5.observe(document.body,{childList:!0,subtree:!0}))}function A5(e){D5.delete(e),D5.size===0&&O5&&(O5.disconnect(),O5=null)}var j5=R(`text`)(({theme:e})=>({fontSize:e.typography.fontSize-2,fill:e.palette.error.main})),M5=R(i6)(()=>({color:`${lu()} !important`})),N5=R(`g`)(({theme:e})=>({"& .vx-axis-line":{stroke:Ru.AXIS_LINE_COLOR,strokeWidth:2},"& .vx-axis-tick":{fill:Ru.AXIS_TICK_COLOR,"& line":{stroke:Ru.AXIS_TICK_COLOR,strokeWidth:2},fontFamily:e.typography.body1?.fontFamily,fontSize:e.typography.fontSize,textAnchor:`middle`}})),P5=e=>({borderRadius:e.spacing(2),color:V.WHITE,fontSize:`16px`,width:`16px`,height:`16px`,padding:`2px`,border:`1px solid ${V.WHITE}`,boxSizing:`unset`}),F5={backgroundColor:Gl()},I5={backgroundColor:Bl()},L5=class extends P.Component{static propTypes={defineChart:v.bool,error:v.any};constructor(e){super(e),this.state={dialog:{open:!1}}}componentDidUpdate(e){this.props.autoFocus&&!e.autoFocus&&this.props.onAutoFocusUsed()}handleAlertDialog=(e,t)=>this.setState({dialog:{open:e}},t);changeCategory=(e,t)=>{let{categories:n,onChangeCategory:r}=this.props,i=n[e];r(e,{...i,label:t})};changeInteractive=(e,t)=>{let{categories:n,onChangeCategory:r}=this.props,i=n[e];t?r(e,{...i,interactive:!i.interactive}):this.setState({dialog:{open:!0,title:`Warning`,text:`This will remove the correct answer value that has been defined for this category.`,onConfirm:()=>this.handleAlertDialog(!1,r(e,{...i,interactive:!i.interactive})),onClose:()=>this.handleAlertDialog(!1)}})};changeEditable=(e,t)=>{let{categories:n,onChangeCategory:r}=this.props,i=n[e];t?r(e,{...i,editable:!i.editable||!1}):this.setState({dialog:{open:!0,title:`Warning`,text:`This will remove the correct answer category name that has been defined for this category.`,onConfirm:()=>this.handleAlertDialog(!1,r(e,{...i,editable:!i.editable||!1})),onClose:()=>this.handleAlertDialog(!1)}})};splitText=(e,t)=>{let n=[];for(;(e||``).length>0;){let r;e.length>t?(r=e.lastIndexOf(` `,t),r===-1&&(r=t)):r=e.length,n.push(e.substring(0,r)),e=e.substring(r).trim()}return n};render(){let{categories:e,xBand:t,bandWidth:n,barWidth:r,rotate:i,top:a,graphProps:o,defineChart:s,chartingOptions:c,x:l,y:u,formattedValue:d,changeInteractiveEnabled:f,changeEditableEnabled:p,error:m,autoFocus:h,hiddenLabelRef:g,showCorrectness:_}=this.props;if(!d)return null;let v={correctnessIcon:P5,incorrectIcon:F5,correctIcon:I5},{dialog:y}=this.state,{changeEditable:b,changeInteractive:x}=c||{},S=parseInt(d.split(`-`)[0],10),C=e[S],{editable:w,interactive:T,label:E,correctness:D}=C||{},O=t(o5({label:E},S)),k=(e||[]).reduce((e,t)=>(e&&e.label?e.label.length:0)>(t&&t.label?t.label.length:0)?e:t,{label:``}),A=m?[...new Set(Object.values(m))].join(` `):``;return(0,F.jsxs)(`g`,{children:[(0,F.jsxs)(`foreignObject`,{x:n?O:l-r/2,y:18,width:r,height:4,style:{pointerEvents:`none`,overflow:`visible`},children:[S===0&&(0,F.jsx)(E5,{isHiddenLabel:!0,inputRef:g,disabled:!0,mark:k,graphProps:o,barWidth:r}),(0,F.jsx)(E5,{autoFocus:s&&h,inputRef:e=>this.input=e,disabled:!s&&!w,mark:C,graphProps:o,onChange:e=>this.changeCategory(S,e),barWidth:r,rotate:i,correctness:D,error:m&&m[S],limitCharacters:!0,correctnessIndicator:_&&D&&(0,F.jsx)(a5,{correctness:D,interactive:T,classes:v})})]}),m&&S===0&&(0,F.jsx)(j5,{y:u+23,height:6,textAnchor:`start`,children:A}),s&&S===0&&(0,F.jsxs)(`svg`,{x:-55,style:{overflow:`visible`},children:[f&&(0,F.jsx)(`text`,{y:u+90+a,width:r,height:4,style:{position:`absolute`,pointerEvents:`none`,wordBreak:`break-word`,maxWidth:r,display:`inline-block`},children:this.splitText(x?.authoringLabel,20).map((e,t)=>(0,F.jsx)(`tspan`,{x:`0`,dy:`${t>0?`1.2em`:`.6em`}`,children:e},t))}),p&&(0,F.jsx)(`text`,{y:u+145+a,width:r,height:4,style:{position:`absolute`,pointerEvents:`none`,wordBreak:`break-word`,maxWidth:r,display:`inline-block`},children:this.splitText(b?.authoringLabel,20).map((e,t)=>(0,F.jsx)(`tspan`,{x:`0`,dy:`${t>0?`1.2em`:`.6em`}`,children:e},t))})]}),s&&f&&(0,F.jsx)(`foreignObject`,{x:l-24,y:u+80+a,width:r,height:4,style:{pointerEvents:`visible`,overflow:`visible`},children:(0,F.jsx)(M5,{style:{position:`fixed`},checked:T,onChange:e=>this.changeInteractive(S,e.target.checked)})}),s&&p&&(0,F.jsx)(`foreignObject`,{x:l-24,y:u+130+a,width:r,height:4,style:{pointerEvents:`visible`,overflow:`visible`},children:(0,F.jsx)(M5,{style:{position:`fixed`},checked:w,onChange:e=>this.changeEditable(S,e.target.checked)})}),(0,F.jsx)(`foreignObject`,{x:l-24,y:u+100+a,width:r,height:4,style:{pointerEvents:`visible`,overflow:`visible`},children:(0,F.jsx)(s6,{open:y.open,title:y.title,text:y.text,onClose:y.onClose,onConfirm:y.onConfirm})})]})}};L5.propTypes={categories:v.array,xBand:v.func,bandWidth:v.number,barWidth:v.number,rotate:v.number,top:v.number,x:v.number,y:v.number,graphProps:v.object,formattedValue:v.string,onChangeCategory:v.func,onChange:v.func,error:v.object,defineChart:v.bool,chartingOptions:v.object,changeInteractiveEnabled:v.bool,changeEditableEnabled:v.bool,autoFocus:v.bool,onAutoFocusUsed:v.func,showCorrectness:v.bool,hiddenLabelRef:v.oneOfType([v.func,v.shape({current:v.instanceOf(Element)})])};var R5=class extends P.Component{static propTypes={bottomScale:v.func,categories:v.array,defineChart:v.bool,error:v.any,graphProps:x$.isRequired,xBand:v.func,leftAxis:v.bool,onChange:v.func,onChangeCategory:v.func,top:v.number,theme:v.object,chartingOptions:v.object,changeInteractiveEnabled:v.bool,changeEditableEnabled:v.bool,autoFocus:v.bool,onAutoFocusUsed:v.func,showCorrectness:v.bool,hiddenLabelRef:v.oneOfType([v.func,v.shape({current:v.instanceOf(Element)})])};state={height:0,width:0};measureHiddenLabel=()=>{if(!this.hiddenLabelRef)return;let e=this.hiddenLabelRef.querySelector(`mjx-container`),t=this.hiddenLabelRef.querySelector(`input`),n=(e||t||this.hiddenLabelRef).getBoundingClientRect(),r=Math.floor(n.height),i=Math.floor(n.width);(r!==this.state.height||i!==this.state.width)&&this.setState({height:r,width:i})};_onDocMutation=()=>{this.hiddenLabelRef&&this.hiddenLabelRef.querySelector(`mjx-container`)&&this.measureHiddenLabel()};observeHiddenLabel=e=>{if(!e)return;let t=e.querySelector(`[data-latex], [data-raw]`);t&&hd(e),(e.querySelector(`mjx-container`)||!t)&&this.measureHiddenLabel(),k5(this._onDocMutation)};setHiddenLabelRef=e=>{e&&e!==this.hiddenLabelRef&&(this.hiddenLabelRef=e,this.observeHiddenLabel(e))};componentDidMount(){this.hiddenLabelRef&&this.observeHiddenLabel(this.hiddenLabelRef)}componentWillUnmount(){A5(this._onDocMutation),this._updateTimer&&clearTimeout(this._updateTimer)}componentDidUpdate(e){e.categories!==this.props.categories&&(this._updateTimer&&clearTimeout(this._updateTimer),this._updateTimer=setTimeout(()=>this.measureHiddenLabel(),50))}render(){let{graphProps:e,xBand:t,leftAxis:n,onChange:r,onChangeCategory:i,categories:a=[],top:o,defineChart:s,chartingOptions:c,changeInteractiveEnabled:l,changeEditableEnabled:u,theme:d,autoFocus:f,onAutoFocusUsed:p,error:m,showCorrectness:h}=this.props,{scale:g={},range:_={},domain:v={},size:y={}}=e||{},{height:b,width:x}=this.state,S=t&&typeof t.rangeRound==`function`&&t.rangeRound([0,y.width]),C=t&&typeof t.bandwidth==`function`&&t.bandwidth(),w=C||g.x&&g.x(v.max)/a.length,T=c5({..._,step:_.labelStep}),E=d5(d&&d.typography?d.typography.fontSize:14,b),D=x>w?25:0;return(0,F.jsxs)(N5,{children:[n&&(0,F.jsx)(Z8,{scale:g.y,tickLength:10,tickFormat:e=>e,tickValues:T,tickLabelProps:e=>({dy:4,dx:-10-(e.toLocaleString().length||1)*5})}),(0,F.jsx)($8,{scale:S,labelProps:{y:60+o},top:g.y&&g.y(_.min),textLabelProps:()=>({textAnchor:`middle`}),tickFormat:e=>e,tickComponent:n=>{let d={hiddenLabelRef:this.setHiddenLabelRef,categories:a,xBand:t,bandWidth:C,barWidth:w,rotate:E||D,top:o,defineChart:s,chartingOptions:c,autoFocus:f,onAutoFocusUsed:p,error:m,onChangeCategory:i,changeInteractiveEnabled:l,changeEditableEnabled:u,onChange:r,graphProps:e,x:n.x,y:n.y,formattedValue:n.formattedValue,showCorrectness:h};return(0,F.jsx)(L5,{...d})},autoFocus:f,onAutoFocusUsed:p})]})}},z5=({width:e,scaleValue:t,color:n})=>(0,F.jsx)(`svg`,{x:m5(e,t),y:p5(e)?.deltay,color:n,width:e,height:e,overflow:`visible`,viewBox:`0 0 ${e} ${e}`,style:{overflow:`visible !important`},children:(0,F.jsxs)(`g`,{xmlns:`http://www.w3.org/2000/svg`,fill:`currentColor`,stroke:`currentColor`,transform:`scale(${t})`,children:[(0,F.jsx)(`circle`,{cx:`28.5`,cy:`23.5`,r:`22`,fill:`white`,stroke:`currentColor`}),(0,F.jsx)(`path`,{d:`M33.5 21.25H23.4609C22.7578 21.25 22.4062 20.4297 22.9141 19.9219L27.9141 14.9219C28.2266 14.6094 28.7344 14.6094 29.0469 14.9219L34.0469 19.9219C34.5547 20.4297 34.2031 21.25 33.5 21.25Z`,fill:`currentColor`}),(0,F.jsx)(`path`,{d:`M23.5 25.75L33.5391 25.75C34.2422 25.75 34.5938 26.5703 34.0859 27.0781L29.0859 32.0781C28.7734 32.3906 28.2656 32.3906 27.9531 32.0781L22.9531 27.0781C22.4453 26.5703 22.7969 25.75 23.5 25.75Z`,fill:`currentColor`})]})});z5.propTypes={width:v.number.isRequired,scaleValue:v.number.isRequired,color:v.string};var B5=R(`svg`)(()=>({overflow:`visible !important`})),V5=R(`ellipse`)(()=>({fill:`transparent`,clipPath:`polygon(50% 0%, 100% 0%, 100% 50%, 0% 50%, 0% 0%)`})),H5=R(pR)(()=>({backgroundColor:Bl(),borderRadius:`16px`,color:V.WHITE,fontSize:`16px`,padding:`2px`,border:`4px solid ${V.WHITE}`,width:`16px`,height:`16px`,boxSizing:`unset`})),U5=R(e5)(()=>({backgroundColor:Gl(),borderRadius:`16px`,color:V.WHITE,fontSize:`16px`,padding:`2px`,border:`4px solid ${V.WHITE}`,width:`16px`,height:`16px`,boxSizing:`unset`})),W5=({x:e,y:t,width:n,graphProps:r,interactive:i,isHovered:a,correctness:o,isPlot:s,...c})=>{let{scale:l}=r,u=p5(n)?.scale;return(0,F.jsxs)(B5,{x:e,y:l.y(t)-10,width:n,overflow:`visible`,children:[a&&!o&&i&&(0,F.jsx)(z5,{width:n,scaleValue:u,color:V.BORDER_GRAY}),i&&!o&&(0,F.jsx)(V5,{cx:n/2,cy:10,rx:n/2,ry:66,...c}),(0,F.jsx)(`defs`,{children:(0,F.jsxs)(`filter`,{id:`bottomShadow`,x:`0`,y:`0`,width:`140%`,height:`140%`,children:[(0,F.jsx)(`feGaussianBlur`,{in:`SourceAlpha`,stdDeviation:`3`}),(0,F.jsx)(`feOffset`,{dx:`0`,dy:`5`,result:`offsetblur`}),(0,F.jsx)(`feFlood`,{floodColor:`#00000033`}),(0,F.jsx)(`feComposite`,{in2:`offsetblur`,operator:`in`}),(0,F.jsxs)(`feMerge`,{children:[(0,F.jsx)(`feMergeNode`,{}),(0,F.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]})}),o&&i&&!s&&(0,F.jsx)(`foreignObject`,{x:n/2-14,y:0,width:40,height:40,children:o.value===`correct`?(0,F.jsx)(H5,{title:o.label}):(0,F.jsx)(U5,{title:o.label})})]})};W5.propTypes={x:v.number.isRequired,y:v.number.isRequired,width:v.number,graphProps:x$.isRequired,interactive:v.bool,isHovered:v.bool,correctness:v.shape({value:v.string,label:v.string}),isPlot:v.bool};var G5=W5,K5=n0({axis:`y`,fromDelta:(e,t)=>(t.x=0,k$(e).add(k$(t)).y),bounds:(e,{domain:t,range:n})=>O$({left:0,top:e.y,bottom:e.y,right:0},t,n),anchorPoint:e=>({x:e.x,y:e.y})})(G5),q5=({dashColor:e})=>(0,F.jsxs)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,F.jsx)(`circle`,{cx:`12`,cy:`12`,r:`11`,fill:`white`,stroke:e||`#7E8494`,strokeWidth:`2`,strokeDasharray:`5 5`}),(0,F.jsxs)(`mask`,{id:`path-2-outside-1_3089_3799`,maskUnits:`userSpaceOnUse`,x:`2`,y:`3`,width:`19`,height:`18`,fill:`black`,children:[(0,F.jsx)(`rect`,{fill:`white`,x:`2`,y:`3`,width:`19`,height:`18`}),(0,F.jsx)(`path`,{d:`M12 20C9.125 20 6.5 18.5 5.0625 16C3.625 13.5312 3.625 10.5 5.0625 8C6.5 5.53125 9.125 4 12 4C14.8438 4 17.4688 5.53125 18.9062 8C20.3438 10.5 20.3438 13.5312 18.9062 16C17.4688 18.5 14.8438 20 12 20ZM15.5312 10.5312H15.5C15.8125 10.25 15.8125 9.78125 15.5 9.46875C15.2188 9.1875 14.75 9.1875 14.4688 9.46875L11 12.9688L9.53125 11.5C9.21875 11.1875 8.75 11.1875 8.46875 11.5C8.15625 11.7812 8.15625 12.25 8.46875 12.5312L10.4688 14.5312C10.75 14.8438 11.2188 14.8438 11.5312 14.5312L15.5312 10.5312Z`})]}),(0,F.jsx)(`path`,{d:`M12 20C9.125 20 6.5 18.5 5.0625 16C3.625 13.5312 3.625 10.5 5.0625 8C6.5 5.53125 9.125 4 12 4C14.8438 4 17.4688 5.53125 18.9062 8C20.3438 10.5 20.3438 13.5312 18.9062 16C17.4688 18.5 14.8438 20 12 20ZM15.5312 10.5312H15.5C15.8125 10.25 15.8125 9.78125 15.5 9.46875C15.2188 9.1875 14.75 9.1875 14.4688 9.46875L11 12.9688L9.53125 11.5C9.21875 11.1875 8.75 11.1875 8.46875 11.5C8.15625 11.7812 8.15625 12.25 8.46875 12.5312L10.4688 14.5312C10.75 14.8438 11.2188 14.8438 11.5312 14.5312L15.5312 10.5312Z`,fill:`#0EA449`}),(0,F.jsx)(`path`,{d:`M5.0625 16L5.92942 15.5015L5.92668 15.4968L5.0625 16ZM5.0625 8L4.19831 7.4968L4.19559 7.50153L5.0625 8ZM18.9062 8L19.7732 7.50152L19.7704 7.49681L18.9062 8ZM18.9062 16L18.0421 15.4968L18.0393 15.5015L18.9062 16ZM15.5312 10.5312L16.2384 11.2384L17.9455 9.53125H15.5312V10.5312ZM15.5 10.5312L14.831 9.78796L12.894 11.5312H15.5V10.5312ZM14.4688 9.46875L13.7616 8.76164L13.7585 8.76482L14.4688 9.46875ZM11 12.9688L10.2929 13.6759L11.0032 14.3861L11.7103 13.6727L11 12.9688ZM8.46875 11.5L9.13771 12.2433L9.17684 12.2081L9.21204 12.169L8.46875 11.5ZM8.46875 12.5312L9.17586 11.8241L9.15726 11.8055L9.13771 11.788L8.46875 12.5312ZM10.4688 14.5312L11.212 13.8623L11.1945 13.8427L11.1759 13.8241L10.4688 14.5312ZM12 20V19C9.479 19 7.18657 17.6879 5.92941 15.5015L5.0625 16L4.19559 16.4985C5.81343 19.3121 8.771 21 12 21V20ZM5.0625 16L5.92668 15.4968C4.6714 13.341 4.66824 10.6918 5.92941 8.49847L5.0625 8L4.19559 7.50153C2.58176 10.3082 2.5786 13.7215 4.19832 16.5032L5.0625 16ZM5.0625 8L5.92668 8.50319C7.18712 6.33851 9.48502 5 12 5V4V3C8.76498 3 5.81288 4.72399 4.19832 7.49681L5.0625 8ZM12 4V5C14.4816 5 16.7805 6.33661 18.0421 8.50319L18.9062 8L19.7704 7.49681C18.157 4.72589 15.2059 3 12 3V4ZM18.9062 8L18.0393 8.49847C19.3005 10.6918 19.2973 13.341 18.0421 15.4968L18.9062 16L19.7704 16.5032C21.3902 13.7215 21.387 10.3082 19.7732 7.50153L18.9062 8ZM18.9062 16L18.0393 15.5015C16.7811 17.6898 14.4876 19 12 19V20V21C15.1999 21 18.1564 19.3102 19.7732 16.4985L18.9062 16ZM15.5312 10.5312V9.53125H15.5V10.5312V11.5312H15.5312V10.5312ZM15.5 10.5312L16.169 11.2745C16.9447 10.5764 16.8883 9.44281 16.2071 8.76164L15.5 9.46875L14.7929 10.1759C14.7696 10.1525 14.7344 10.0966 14.7344 10.0117C14.7344 9.92377 14.7735 9.83972 14.831 9.78796L15.5 10.5312ZM15.5 9.46875L16.2071 8.76164C15.5353 8.08987 14.4334 8.08987 13.7616 8.76164L14.4688 9.46875L15.1759 10.1759C15.1167 10.235 15.0442 10.2578 14.9844 10.2578C14.9245 10.2578 14.8521 10.235 14.7929 10.1759L15.5 9.46875ZM14.4688 9.46875L13.7585 8.76482L10.2897 12.2648L11 12.9688L11.7103 13.6727L15.179 10.1727L14.4688 9.46875ZM11 12.9688L11.7071 12.2616L10.2384 10.7929L9.53125 11.5L8.82414 12.2071L10.2929 13.6759L11 12.9688ZM9.53125 11.5L10.2384 10.7929C9.55719 10.1117 8.42362 10.0553 7.72546 10.831L8.46875 11.5L9.21204 12.169C9.16028 12.2265 9.07623 12.2656 8.98828 12.2656C8.90344 12.2656 8.84748 12.2304 8.82414 12.2071L9.53125 11.5ZM8.46875 11.5L7.79979 10.7567C7.04591 11.4352 7.04591 12.5961 7.79979 13.2745L8.46875 12.5312L9.13771 11.788C9.19301 11.8377 9.23438 11.9208 9.23438 12.0156C9.23438 12.1105 9.19301 12.1935 9.13771 12.2433L8.46875 11.5ZM8.46875 12.5312L7.76164 13.2384L9.76164 15.2384L10.4688 14.5312L11.1759 13.8241L9.17586 11.8241L8.46875 12.5312ZM10.4688 14.5312L9.72546 15.2002C10.4236 15.976 11.5572 15.9195 12.2384 15.2384L11.5312 14.5312L10.8241 13.8241C10.8475 13.8008 10.9034 13.7656 10.9883 13.7656C11.0762 13.7656 11.1603 13.8048 11.212 13.8623L10.4688 14.5312ZM11.5312 14.5312L12.2384 15.2384L16.2384 11.2384L15.5312 10.5312L14.8241 9.82414L10.8241 13.8241L11.5312 14.5312Z`,fill:`white`,mask:`url(#path-2-outside-1_3089_3799)`})]});q5.propTypes={dashColor:v.string};var J5=Uu(`pie-lib:chart:bars`),Y5=[`#006699`,`#F59B00`,`#08916D`,`#529EE0`,`#52B7D8`,`#D9A6C2`,`#FFB03B`,`#54A77B`,`#E16032`,`#4FD2D2`,`#F0E442`,`#E287B2`],X5=[`#003754`,`#975616`,`#00503B`,`#225982`,`#1F687D`,`#825E6F`,`#996428`,`#255E44`,`#8A331F`,`#167A7A`,`#91862D`,`#894A65`],Z5=(e,t,n,r,i)=>e&&t&&i?r[n%r.length]:e&&i?Ru.ROLLOVER_FILL_BAR_COLOR:t||null,Q5=R(I6)(()=>({fill:V.TERTIARY})),$5=class extends P.Component{static propTypes={barColor:v.string,onChangeCategory:v.func,value:v.number,label:v.string,xBand:v.func,index:v.number.isRequired,graphProps:x$.isRequired,interactive:v.bool,correctness:v.shape({value:v.string,label:v.string}),correctData:v.array,defineChart:v.bool};constructor(e){super(e),this.state={dragValue:void 0,isHovered:!1},this.mouseX=0,this.mouseY=0}componentDidMount(){window.addEventListener(`mousemove`,this.handleMouseMove)}componentWillUnmount(){window.removeEventListener(`mousemove`,this.handleMouseMove)}handleMouseMove=e=>{this.mouseX=e.clientX,this.mouseY=e.clientY;let t=this.isMouseInsideSvgElement();this.setState({isHovered:t})};isMouseInsideSvgElement=()=>{let e=this.gRef.getBoundingClientRect();return this.mouseX>=e.left&&this.mouseX<=e.right&&this.mouseY>=e.top&&this.mouseY<=e.bottom};handleMouseEnter=()=>this.setState({isHovered:!0});handleMouseLeave=()=>this.setState({isHovered:!1});setDragValue=e=>this.setState({dragValue:e});dragStop=()=>{let{label:e,onChangeCategory:t}=this.props,{dragValue:n}=this.state;J5(`[dragStop]`,n),n!==void 0&&t({label:e,value:n}),this.setDragValue(void 0)};dragValue=(e,t)=>{J5(`[dragValue] next:`,t),this.setDragValue(t)};render(){let{graphProps:e,value:t,label:n,xBand:r,index:i,interactive:a,correctness:o,barColor:s,defineChart:c,correctData:l}=this.props,{scale:u,range:d}=e,{dragValue:f,isHovered:p}=this.state,m=Z5(p,s,i,X5,a&&!o),h=Number.isFinite(f)?f:t,g=r.bandwidth(),_=u.y(d.max-h),v=r(o5({label:n},i)),y=d.max-h,b=d.max-y,x=l?l.find(e=>e.label===n):null,S=a?K5:G5,C=!!s;return(0,F.jsxs)(`g`,{ref:e=>this.gRef=e,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,onTouchStart:this.handleMouseEnter,onTouchEnd:this.handleMouseLeave,children:[(0,F.jsx)(Q5,{x:v,y:u.y(b),width:g,height:_,style:{fill:m}}),o&&o.value===`incorrect`&&(()=>{let e=parseFloat(x&&x.value);if(isNaN(e))return null;let t=u.y(d.max-e),n=_,r=Math.abs(t-n),i=u.y(e),a=t>n?mu():V.WHITE,o=t>n?i:i-r;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(Q5,{x:v+2,y:o,width:g-4,height:r,style:{stroke:a,strokeWidth:2,strokeDasharray:`5,2`,fill:`none`}}),(0,F.jsx)(`foreignObject`,{x:v+g-(C?24:14),y:i-12,width:24,height:24,children:(0,F.jsx)(q5,{dashColor:a})})]})})(),(0,F.jsx)(S,{x:v,y:h,defineChart:c,interactive:a,width:g,onDrag:e=>this.dragValue(t,e),onDragStop:this.dragStop,graphProps:e,correctness:o,isHovered:p,color:m})]})}},e7=class extends P.Component{static propTypes={data:v.array,correctData:v.array,onChangeCategory:v.func,defineChart:v.bool,xBand:v.func,graphProps:x$.isRequired,histogram:v.bool};render(){let{data:e,graphProps:t,xBand:n,onChangeCategory:r,defineChart:i,histogram:a,correctData:o}=this.props;return(0,F.jsx)(N6,{children:(e||[]).map((e,s)=>(0,F.jsx)($5,{value:e.value,interactive:i||e.interactive,defineChart:i,label:e.label,xBand:n,index:s,onChangeCategory:e=>r(s,e),graphProps:t,correctness:e.correctness,correctData:o,barColor:a&&(Y5[s]?Y5[s]:Y5[s%Y5.length])},`bar-${e.label}-${e.value}-${s}`))})}},t7=class extends P.Component{static propTypes={data:v.array,onChange:v.func,graphProps:x$.isRequired};render(){let e=this.props,{data:t,graphProps:n}=e,{scale:r={},size:i={}}=n||{},a=s5(r.x,t,i.width,`bar`);return(0,F.jsx)(e7,{...e,xBand:a})}},n7=()=>({type:`bar`,Component:t7,name:`Bar`}),r7=class extends P.Component{static propTypes={data:v.array,onChange:v.func,graphProps:x$.isRequired};render(){let e=this.props,{data:t,graphProps:n}=e,{scale:r={},size:i={}}=n||{},a=s5(r.x,t,i.width,`histogram`);return(0,F.jsx)(e7,{...e,xBand:a,histogram:!0})}},i7=()=>({type:`histogram`,Component:r7,name:`Histogram`}),a7=R(`g`)(({theme:e})=>({color:`black`,"& .handle":{transition:`fill 200ms linear, height 200ms linear`,"&.non-interactive":v5(`fill`)},"& .transparentHandle":{height:`20px`,fill:`transparent`,stroke:`transparent`},"& .line":{stroke:V.TEXT,transition:`fill 200ms linear, height 200ms linear`,"&.non-interactive":v5(`stroke`)},"& .disabledPoint":{fill:V.BLACK+` !important`,stroke:V.BLACK+` !important`},"& .correctIcon":{backgroundColor:Bl()},"& .incorrectIcon":{backgroundColor:Gl()},"& .correctnessIcon":{borderRadius:e.spacing(2),color:V.WHITE,fontSize:`16px`,width:`16px`,height:`16px`,padding:`2px`,border:`1px solid ${V.WHITE}`,stroke:`initial`,boxSizing:`unset`},"& .smallIcon":{fontSize:`10px`,width:`10px`,height:`10px`}})),o7=class extends P.Component{static propTypes={x:v.number.isRequired,y:v.number.isRequired,width:v.number,graphProps:x$.isRequired,className:v.string,interactive:v.bool,CustomDraggableComponent:v.func,correctness:v.shape({value:v.string,label:v.string})};render(){let{x:e,y:t,graphProps:n,className:r,interactive:i,CustomDraggableComponent:a,correctness:o,...s}=this.props,{scale:c}=n;return a?(0,F.jsx)(a7,{children:(0,F.jsx)(a,{scale:c,x:e,y:t,className:I(r,!i&&`non-interactive`),correctness:o,interactive:i,...s})}):null}},s7=n0({axis:`y`,fromDelta:(e,t)=>(t.x=0,k$(e).add(k$(t)).y),bounds:(e,{domain:t,range:n})=>O$({left:0,top:e.y,bottom:e.y,right:0},t,n),anchorPoint:e=>({x:e.x,y:e.y})})(o7),c7=(e,t)=>{let{max:n}=t||{},r=e.length;return!n||!r?[]:e.map((e,t)=>({...e,x:r>1?t*(n/(r-1)):.5,y:e.value}))},l7=R(F6)(()=>({fill:`transparent`,stroke:V.TERTIARY,strokeWidth:3,transition:`stroke 200ms ease-in, stroke-width 200ms ease-in`})),u7=R(class extends P.Component{static propTypes={onChange:v.func,value:v.number,label:v.string,xBand:v.func,index:v.number.isRequired,graphProps:x$.isRequired,defineChart:v.bool,data:v.arrayOf(v.shape({label:v.string,value:v.number})),CustomDraggableComponent:v.func,correctData:v.array};static defaultProps={index:0};constructor(e){super(e),this.state={dragValue:void 0,line:c7(e.data,e.graphProps.domain)}}UNSAFE_componentWillReceiveProps(e){zp(this.props.data,e.data)||this.setState({line:c7(e.data,e.graphProps.domain)})}setDragValue=e=>this.setState({line:e});dragStop=e=>{let{onChange:t}=this.props;this.setState({dragging:!1},()=>{t(e,this.state.line[e])})};dragValue=(e,t,n)=>{let r=[...this.state.line];r[e].dragValue=n,this.setDragValue(r)};render(){let{graphProps:e,data:t,CustomDraggableComponent:n,defineChart:r,correctData:i}=this.props,{line:a,dragging:o}=this.state,{scale:s}=e,c=o?a:c7(t,e.domain);return(0,F.jsxs)(P.Fragment,{children:[(0,F.jsx)(l7,{data:c,x:e=>s.x(e.x),y:e=>s.y(e.dragValue===void 0?e.y:e.dragValue),className:`line`}),c&&c.map((t,a)=>{let o=r||t.interactive;return(0,F.jsx)(o?s7:o7,{x:t.x,y:t.dragValue===void 0?t.y:t.dragValue,interactive:o,r:6,onDragStart:()=>this.setState({dragging:!0}),onDrag:e=>this.dragValue(a,t.dragValue===void 0?t.y:t.dragValue,e),onDragStop:()=>this.dragStop(a),graphProps:e,CustomDraggableComponent:n,correctness:t.correctness,correctData:i,label:t.label},`point-${t.x}-${a}`)})]})}})(()=>({"& .line":{fill:`transparent`,stroke:V.TERTIARY,strokeWidth:3,transition:`stroke 200ms ease-in, stroke-width 200ms ease-in`}})),d7=class extends P.Component{static propTypes={data:v.array,onChange:v.func,xBand:v.func,graphProps:x$.isRequired,CustomDraggableComponent:v.func,defineChart:v.bool,correctData:v.array};changeLine=(e,t)=>{let{onChange:n}=this.props,r=[...this.props.data],{dragValue:i,value:a}=t;r[e].value=i>=0?i:a,n(r)};render(){let e=this.props;return(0,F.jsx)(N6,{children:(0,F.jsx)(u7,{...e,onChange:this.changeLine})})}},f7=R(`circle`)(()=>({})),p7=R(`circle`)(()=>({height:`20px`,fill:`transparent`,stroke:`none`,pointerEvents:`auto`})),m7=({scale:e,x:t,y:n,r,correctness:i,interactive:a,correctData:o,label:s,...c})=>{let[l,u]=P.useState(!1),d=!i&&a;return(0,F.jsxs)(`g`,{onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),onTouchStart:()=>u(!0),onTouchEnd:()=>u(!1),children:[(0,F.jsx)(p7,{cx:e.x(t),cy:e.y(n),r:r*3,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),...c}),(0,F.jsx)(f7,{cx:e.x(t),cy:e.y(n),r,correctness:i,interactive:a,...c}),(0,F.jsx)(r5,{scale:e,x:t,y:n,r,correctness:i,interactive:a}),(0,F.jsx)(i5,{scale:e,x:t,r,correctness:i,correctData:o,label:s}),l&&d&&(0,F.jsx)(`rect`,{x:e.x(t)-r*2,y:e.y(n)-r*2,width:r*4,height:r*4,stroke:V.BORDER_GRAY,strokeWidth:`1`,fill:`none`})]})};m7.propTypes={scale:v.object,x:v.number,y:v.number,r:v.number,correctness:v.shape({value:v.string,label:v.string}),interactive:v.bool,correctData:v.array,label:v.string};var h7=class extends P.Component{static propTypes={data:v.array,onChange:v.func,graphProps:x$.isRequired};render(){let e=this.props,{data:t,graphProps:n}=e,{scale:r={},size:i={}}=n||{},a=s5(r.x,t,i.width,`lineDot`);return(0,F.jsx)(d7,{...e,xBand:a,CustomDraggableComponent:m7})}},g7=()=>({type:`lineDot`,Component:h7,name:`Line Dot`}),_7=R(F6)(()=>({stroke:V.TEXT,transition:`fill 200ms linear, height 200ms linear`,"&.non-interactive":{stroke:Ll?.()||`#ccc`}})),v7=R(N6)(({correctness:e,interactive:t})=>({stroke:V.TEXT,transition:`fill 200ms linear, height 200ms linear`,...e&&!t&&{fill:`${V.BLACK} !important`,stroke:`${V.BLACK} !important`},"&.non-interactive":{stroke:Ll?.()||`#ccc`}})),y7=R(`circle`)(()=>({height:`20px`,fill:`transparent`,stroke:`transparent`})),b7=e=>{let{className:t,scale:n,x:r,y:i,r:a,correctness:o,interactive:s,correctData:c,label:l,...u}=e,[d,f]=(0,P.useState)(!1),p=a*4,m=p/2,h=n.x(r),g=n.y(i);return(0,F.jsxs)(v7,{className:t,correctness:o,interactive:s,children:[(0,F.jsx)(_7,{data:[{x:n.x(r)-a,y:n.y(i)+a},{x:n.x(r)+a,y:n.y(i)-a}],x:e=>e.x,y:e=>e.y,strokeWidth:5,style:{pointerEvents:`none`}},`point-${r}-${i}-1`),(0,F.jsx)(_7,{data:[{x:n.x(r)-a,y:n.y(i)-a},{x:n.x(r)+a,y:n.y(i)+a}],x:e=>e.x,y:e=>e.y,strokeWidth:5,style:{pointerEvents:`none`}},`point-${r}-${i}-2`),d&&(0,F.jsx)(`rect`,{x:h-m,y:g-m,width:p,height:p,stroke:V.BORDER_GRAY,fill:`none`,strokeWidth:2,pointerEvents:`none`}),(0,F.jsx)(y7,{cx:h,cy:g,r:a*2,onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),...u}),(0,F.jsx)(r5,{scale:n,x:r,y:i,r:a,correctness:o,interactive:s}),(0,F.jsx)(i5,{scale:n,x:r,r:a,correctness:o,correctData:c,label:l})]})};b7.propTypes={scale:v.object,x:v.number,y:v.number,r:v.number,className:v.string,correctness:v.shape({value:v.string,label:v.string}),interactive:v.bool,correctData:v.array,label:v.string};var x7=class extends P.Component{static propTypes={data:v.array,onChange:v.func,graphProps:x$.isRequired};render(){let e=this.props,{data:t,graphProps:n}=e,{scale:r={},size:i={}}=n||{},a=s5(r.x,t,i.width,`lineCross`);return(0,F.jsx)(d7,{...e,xBand:a,CustomDraggableComponent:b7})}},S7=()=>({type:`lineCross`,Component:x7,name:`Line Cross`}),C7=Uu(`pie-lib:chart:bars`),w7=16,T7=R(class extends P.Component{static propTypes={onChangeCategory:v.func,value:v.number,label:v.string,xBand:v.func,index:v.number.isRequired,graphProps:x$.isRequired,CustomBarElement:v.func,interactive:v.bool,correctness:v.shape({value:v.string,label:v.string}),defineChart:v.bool,correctData:v.arrayOf(v.shape({value:v.oneOfType([v.string,v.number]),label:v.string})),className:v.string};constructor(e){super(e),this.state={dragValue:void 0,isHovered:!1}}handleMouseEnter=()=>{this.setState({isHovered:!0})};handleMouseLeave=()=>{this.setState({isHovered:!1})};setDragValue=e=>this.setState({dragValue:e});dragStop=()=>{let{label:e,onChangeCategory:t}=this.props,{dragValue:n}=this.state;C7(`[dragStop]`,n),n!==void 0&&t({label:e,value:n}),this.setDragValue(void 0)};dragValue=(e,t)=>{C7(`[dragValue] next:`,t),this.setDragValue(t)};renderCorrectnessIcon=(e,t,n,r,i,a,o)=>{let s;if(n===0)s=i.y(0)-w7/2;else{let e=n-1;s=i.y(e)-(a-o)/2-o/2-w7/2}return(0,F.jsx)(`foreignObject`,{x:e+t/2-w7/2,y:s,width:w7,height:w7,children:(0,F.jsx)(pR,{className:`correctnessIcon correctIcon smallIcon`,title:r.label})})};render(){let{graphProps:e,value:t,label:n,xBand:r,index:i,CustomBarElement:a,interactive:o,correctness:s,defineChart:c,correctData:l,className:u}=this.props,{scale:d,range:f,size:p}=e,{max:m}=f||{},{dragValue:h,isHovered:g}=this.state,_=Number.isFinite(h)?h:t,v=r.bandwidth(),y=d.y(f.max-_),b=r(o5({label:n},i));C7(`label:`,n,`barX:`,b,`v: `,_,`barHeight:`,y,`barWidth: `,v);let x=[];for(let e=0;e<_;e++)x.push(e);let S=p.height/m,C=(S>v?v:S)*.8,w=o?K5:G5,T=o&&!s;return(0,F.jsx)(P.Fragment,{children:(0,F.jsxs)(`g`,{className:u,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,onTouchStart:this.handleMouseEnter,onTouchEnd:this.handleMouseLeave,children:[g&&T&&(0,F.jsx)(`rect`,{x:b,y:d.y(_),width:v,height:x?.length?S*x.length:0,stroke:V.BORDER_GRAY,strokeWidth:`4px`,fill:`transparent`}),x.map(e=>a({index:e,pointDiameter:C,barX:b,barWidth:v,pointHeight:S,label:n,value:t,scale:d})),s&&s.value===`incorrect`&&(()=>{let e=parseFloat(l[i]&&l[i].value);if(isNaN(e))return null;let o=_;if(e===0)return this.renderCorrectnessIcon(b,v,e,s,d,S,C);if(o>e){let o=[];for(let t=0;t<e;t++)o.push(t);let c=o[o.length-1],l=r(o5({label:n},i)),u=r.bandwidth(),f=p.height/m,h=(f>u?u:f)*.8;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(a,{index:c,pointDiameter:h+10,barX:l,barWidth:u,pointHeight:f,label:n,value:t,scale:d,dottedOverline:!0}),this.renderCorrectnessIcon(l,u,e,s,d,f,h)]})}let c=[];for(let t=o;t<e;t++)c.push(t);return(0,F.jsxs)(F.Fragment,{children:[c.map(e=>a({index:e,pointDiameter:C,barX:b,barWidth:v,pointHeight:S,label:n,value:t,scale:d,dottedOverline:!0})),this.renderCorrectnessIcon(b,v,e,s,d,S,C)]})})(),(0,F.jsx)(w,{x:b,y:_,interactive:o,width:v,onDrag:e=>this.dragValue(t,e),onDragStop:this.dragStop,graphProps:e,correctness:s,isHovered:g,defineChart:c,color:Zl(),isPlot:!0})]})})}})(({theme:e})=>({"& .dot":{fill:Ru.PLOT_FILL_COLOR,"&.correct":y5(`stroke`),"&.incorrect":b5(`stroke`)},"& .dotColor":{fill:Ru.PLOT_FILL_COLOR,"&.correct":y5(`fill`),"&.incorrect":b5(`fill`)},"& .line":{stroke:Ru.PLOT_FILL_COLOR,"&.correct":y5(`stroke`),"&.incorrect":b5(`stroke`)},"& .correctIcon":{backgroundColor:Bl()},"& .incorrectIcon":{backgroundColor:Gl()},"& .correctnessIcon":{borderRadius:e.spacing(2),color:V.WHITE,fontSize:`16px`,width:`16px`,height:`16px`,padding:`2px`,border:`1px solid ${V.WHITE}`,stroke:`initial`,boxSizing:`unset`,display:`block`},"& .smallIcon":{fontSize:`10px`,width:`10px`,height:`10px`}})),E7=class extends P.Component{static propTypes={data:v.array,onChangeCategory:v.func,xBand:v.func,graphProps:x$.isRequired,defineChart:v.bool,CustomBarElement:v.func,correctData:v.arrayOf(v.shape({value:v.oneOfType([v.string,v.number]),label:v.string})),className:v.string};render(){let{data:e,graphProps:t,xBand:n,CustomBarElement:r,onChangeCategory:i,defineChart:a,correctData:o}=this.props;return(0,F.jsx)(N6,{children:(e||[]).map((e,s)=>(0,F.jsx)(T7,{value:e.value,label:e.label,interactive:a||e.interactive,defineChart:a,xBand:n,index:s,onChangeCategory:e=>i(s,e),graphProps:t,CustomBarElement:r,correctness:e.correctness,correctData:o},`bar-${e.label}-${e.value}-${s}`))})}},D7=R(L6)(()=>({fill:Ru.PLOT_FILL_COLOR,"&.correct":y5(`stroke`),"&.incorrect":b5(`stroke`)})),O7=e=>{let{index:t,pointDiameter:n,barX:r,barWidth:i,pointHeight:a,label:o,value:s,scale:c,dottedOverline:l}=e,u=n/2,d=r+(i-n)/2+u,f=c.y(t)-(a-n)/2-u;return l?(0,F.jsx)(L6,{cx:d,cy:f,r:u+2,strokeDasharray:`4,4`,stroke:V.BORDER_GRAY,fill:`none`},`point-${o}-${s}-${t}`):(0,F.jsx)(D7,{cx:d,cy:f,r:u},`point-${o}-${s}-${t}`)};O7.propTypes={index:v.number,pointDiameter:v.number,barX:v.number,barWidth:v.number,pointHeight:v.number,value:v.number,label:v.string,scale:v.object,dottedOverline:v.bool};var k7=class extends P.Component{static propTypes={data:v.array,onChange:v.func,graphProps:x$.isRequired};render(){let e=this.props,{data:t,graphProps:n}=e,{scale:r={},size:i={}}=n||{},a=s5(r.x,t,i.width,`dotPlot`);return(0,F.jsx)(E7,{...e,xBand:a,CustomBarElement:O7})}},A7=()=>({type:`dotPlot`,Component:k7,name:`Dot Plot`}),j7=R(F6)(()=>({stroke:Ru.PLOT_FILL_COLOR,"&.correct":y5(`stroke`),"&.incorrect":b5(`stroke`)})),M7=e=>{let{index:t,pointDiameter:n,barX:r,barWidth:i,pointHeight:a,label:o,value:s,scale:c,dottedOverline:l}=e,u=r+(i-n)/2,d=c.y(t)-(a-n)/2;return l?(0,F.jsx)(`rect`,{x:u-2,y:d-n-2,width:n+4,height:n+4,strokeDasharray:`4,4`,stroke:V.BORDER_GRAY,fill:`none`},`point-${o}-${s}-${t}`):(0,F.jsxs)(N6,{children:[(0,F.jsx)(j7,{data:[{x:u,y:d},{x:u+n,y:d-n}],className:`line`,x:e=>e.x,y:e=>e.y,strokeWidth:n/5},`point-${o}-${s}-${t}-1`),(0,F.jsx)(j7,{data:[{x:u,y:d-n},{x:u+n,y:d}],x:e=>e.x,y:e=>e.y,strokeWidth:n/5,className:`line`},`point-${o}-${s}-${t}-2`)]})};M7.propTypes={index:v.number,pointDiameter:v.number,barX:v.number,barWidth:v.number,pointHeight:v.number,value:v.number,label:v.string,scale:v.object,dottedOverline:v.bool};var N7=class extends P.Component{static propTypes={data:v.array,onChange:v.func,graphProps:x$.isRequired};render(){let e=this.props,{data:t,graphProps:n}=e,{scale:r={},size:i={}}=n||{},a=s5(r.x,t,i.width,`linePlot`);return(0,F.jsx)(E7,{...e,xBand:a,CustomBarElement:M7})}},P7={Bar:n7,Histogram:i7,LineDot:g7,DotPlot:A7,LinePlot:()=>({type:`linePlot`,Component:N7,name:`Line Plot`}),LineCross:S7},F7={translation:{categorize:{limitMaxChoicesPerCategory:`You've reached the limit of {{maxChoicesPerCategory}} responses per area. To add another response, one must first be removed.`,maxChoicesPerCategoryRestriction:`To change this value to {{maxChoicesPerCategory}}, each category must have {{maxChoicesPerCategory}} or fewer answer choice[s].`},ebsr:{part:`Part {{index}}`},numberLine:{addElementLimit_one:`You can only add {{count}} element`,addElementLimit_other:`You can only add {{count}} elements`,clearAll:`Clear all`},imageClozeAssociation:{reachedLimit_one:`You’ve reached the limit of {{count}} response per area. To add another response, one must first be removed.`,reachedLimit_other:`Full`},drawingResponse:{fillColor:`Fill color`,outlineColor:`Outline color`,noFill:`No fill`,lightblue:`Light blue`,lightyellow:`Light yellow`,red:`Red`,orange:`Orange`,yellow:`Yellow`,violet:`Violet`,blue:`Blue`,green:`Green`,white:`White`,black:`Black`,onDoubleClick:`Double click to edit this text. Press Enter to submit.`},charting:{addCategory:`Add category`,actions:`Actions`,add:`Add`,delete:`Delete`,newLabel:`New label`,reachedLimit_other:`There can't be more than {{count}} categories.`,keyLegend:{incorrectAnswer:`Student incorrect answer`,correctAnswer:`Student correct answer`,correctKeyAnswer:`Answer key correct`}},graphing:{point:`Point`,circle:`Circle`,line:`Line`,parabola:`Parabola`,absolute:`Absolute Value`,exponential:`Exponential`,polygon:`Polygon`,ray:`Ray`,segment:`Segment`,sine:`Sine`,vector:`Vector`,label:`Label`,redo:`Redo`,reset:`Reset`},mathInline:{primaryCorrectWithAlternates:`Note: The answer shown above is the primary correct answer specified by the author for this item, but other answers may also be recognized as correct.`},mcPopulatedBlank:{answerChoices:`Answer choices`,blankLabel:`blank`,emptyBlank:`(blank)`,blankPreSelectionHint:`The answer you choose will appear on the blank line above.`,correctAnswerSelected:`Correct answer selected`,incorrectAnswerSelected:`Incorrect answer selected`,selectedAnswerImage:`Selected answer image`,choiceImage:`Choice {{id}}`,clickToEnableAutoplay:`Click to enable audio autoplay`,audioResourceUnavailable:`Audio is enabled but no playable audio URL is configured.`,listen:`Listen`,listenSilentAlt:`Repeat instructions`,listenPlayingAlt:`Instructions are playing`,printAudio:`Audio:`,printTranscript:`Transcript:`,printKey:`(key)`},multipleChoice:{minSelections:`Select at least {{minSelections}}.`,maxSelections_one:`Only {{maxSelections}} answer is allowed.`,maxSelections_other:`Only {{maxSelections}} answers are allowed.`,minmaxSelections_equal:`Select {{minSelections}}.`,minmaxSelections_range:`Select between {{minSelections}} and {{maxSelections}}.`},selectText:{correctAnswerSelected:`Correct`,correctAnswerNotSelected:`Correct Answer Not Selected`,incorrectSelection:`Incorrect Selection`,key:`Key`},simpleCloze:{correctAnswerShown:`Correct answer`,correct:`Correct`,incorrect:`Incorrect`,unanswered:`No answer`,placeholder:`Enter your answer...`,answerInput:`Your answer`,printCorrectAnswer:`Correct answer:`,printAnswerBlank:`Answer blank`},vennClassification:{tray:`Tiles to classify`,unknownTarget:`unknown`,cancelled:`Cancelled`,returnedToTray:`{{name}} returned to tray`,placedIn:`{{name}} placed in {{target}}`,pickedUp:`Picked up {{name}}`,pickedUpWithKeyboard:`Picked up {{name}}, drop target: {{target}}. Use arrow keys to choose a drop target, Enter to drop, Escape to cancel.`,dropTarget:`Drop target: {{target}}`,unsupportedCircles_one:`This diagram cannot be shown: it has {{count}} circle, and only {{supported}} are supported.`,unsupportedCircles_other:`This diagram cannot be shown: it has {{count}} circles, and only {{supported}} are supported.`,setNumber:`Set {{number}}`,regionOnly:`{{set}} only`,regionNeither:`Neither {{first}} nor {{second}}`,regionNoneOf:`None of {{sets}}`,regionAndSeparator:` and `,tileFallbackName:`Tile`,tileNotPlaced:`not placed`,tileInRegion:`in {{region}}`,tileCorrect:`correct`,tileIncorrect:`incorrect`}},common:{undo:`Undo`,clearAll:`Clear all`,correct:`Correct`,incorrect:`Incorrect`,showCorrectAnswer:`Show correct answer`,hideCorrectAnswer:`Hide correct answer`,showTeacherInstructions:`Show Teacher Instructions`,hideTeacherInstructions:`Hide Teacher Instructions`,commonCorrectAnswerWithAlternates:`Note: The answer shown above is the most common correct answer for this item. One or more additional correct answers are also defined, and will also be recognized as correct.`,warning:`Warning`,showNote:`Show Note`,hideNote:`Hide Note`,cancel:`Cancel`}},I7={translation:{categorize:{limitMaxChoicesPerCategory:`Has alcanzado el límite de {{maxChoicesPerCategory}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.`,maxChoicesPerCategoryRestriction:`Para cambiar este valor a {{maxChoicesPerCategory}}, cada categoría debe tener {{maxChoicesPerCategory}} o menos opciones de respuesta`},ebsr:{part:`Parte {{index}}`},numberLine:{addElementLimit_one:`Solo puedes agregar {{count}} elemento`,addElementLimit_other:`Solo puedes agregar {{count}} elementos`,clearAll:`Borrar todo`},imageClozeAssociation:{reachedLimit_one:`Has alcanzado el límite de {{count}} respuesta por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.`,reachedLimit_other:`Lleno`},drawingResponse:{fillColor:`Color de relleno`,outlineColor:`Color del contorno`,noFill:`Sin relleno`,lightblue:`Azul claro`,lightyellow:`Amarillo claro`,red:`Rojo`,orange:`Naranja`,yellow:`Amarillo`,violet:`Violeta`,blue:`Azul`,green:`Verde`,white:`Blanco`,black:`Negro`,onDoubleClick:`Haz doble clic para revisar este texto. Presiona el botón de ingreso para enviar`},charting:{addCategory:`Añadir categoría`,actions:`Acciones`,add:`Añadir`,delete:`Eliminar`,newLabel:`Nueva etiqueta`,reachedLimit_other:`No puede haber más de {{count}} categorías.`,keyLegend:{incorrectAnswer:`Respuesta incorrecta del estudiante`,correctAnswer:`Respuesta correcta del estudiante`,correctKeyAnswer:`Clave de respuesta correcta`}},graphing:{point:`Punto`,circle:`Circulo`,line:`Línea`,parabola:`Parábola`,absolute:`Valor absoluto`,exponential:`Exponencial`,polygon:`Polígono`,ray:`Semirrecta`,segment:`Segmento `,sine:`Seno`,vector:`Vector`,label:`Etiqueta`,redo:`Rehacer`,reset:`Reiniciar`},mathInline:{primaryCorrectWithAlternates:`Nota: La respuesta que se muestra arriba es la respuesta correcta principal especificada por el autor para esta pregunta, pero también se pueden reconocer otras respuestas como correctas.`},mcPopulatedBlank:{answerChoices:`Opciones de respuesta`,blankLabel:`espacio en blanco`,emptyBlank:`(en blanco)`,blankPreSelectionHint:`La respuesta que elijas aparecerá en la línea en blanco de arriba.`,correctAnswerSelected:`Respuesta correcta seleccionada`,incorrectAnswerSelected:`Respuesta incorrecta seleccionada`,selectedAnswerImage:`Imagen de la respuesta seleccionada`,choiceImage:`Opción {{id}}`,clickToEnableAutoplay:`Haz clic para activar la reproducción automática del audio`,audioResourceUnavailable:`El audio está activado, pero no hay una URL de audio reproducible configurada.`,listen:`Escuchar`,listenSilentAlt:`Escuchar. Repetir las instrucciones.`,listenPlayingAlt:`Escuchar. Estas son las instrucciones.`,printAudio:`Audio:`,printTranscript:`Transcripción:`,printKey:`(clave)`},multipleChoice:{minSelections:`Seleccione al menos {{minSelections}}.`,maxSelections_one:`Sólo se permite {{maxSelections}} respuesta.`,maxSelections_other:`Sólo se permiten {{maxSelections}} respuestas.`,minmaxSelections_equal:`Seleccione {{minSelections}}.`,minmaxSelections_range:`Seleccione entre {{minSelections}} y {{maxSelections}}.`},selectText:{correctAnswerSelected:`Respuesta Correcta`,correctAnswerNotSelected:`Respuesta Correcta No Seleccionada`,incorrectSelection:`Selección Incorrecta`,key:`Clave`},simpleCloze:{correctAnswerShown:`Respuesta correcta`,correct:`Correcto`,incorrect:`Incorrecto`,unanswered:`Sin respuesta`,placeholder:`Escribe tu respuesta...`,answerInput:`Tu respuesta`,printCorrectAnswer:`Respuesta correcta:`,printAnswerBlank:`Espacio para la respuesta`},vennClassification:{tray:`Fichas para clasificar`,unknownTarget:`desconocido`,cancelled:`Cancelado`,returnedToTray:`Se devolvió {{name}} a la bandeja`,placedIn:`Se colocó {{name}} en {{target}}`,pickedUp:`Se tomó {{name}}`,pickedUpWithKeyboard:`Se tomó {{name}}, destino: {{target}}. Usa las flechas para elegir un destino, Enter para soltar y Escape para cancelar.`,dropTarget:`Destino: {{target}}`,unsupportedCircles_one:`No se puede mostrar este diagrama: tiene {{count}} círculo, y solo se admiten {{supported}}.`,unsupportedCircles_other:`No se puede mostrar este diagrama: tiene {{count}} círculos, y solo se admiten {{supported}}.`,setNumber:`Conjunto {{number}}`,regionOnly:`Solo {{set}}`,regionNeither:`Ni {{first}} ni {{second}}`,regionNoneOf:`Ninguno de {{sets}}`,regionAndSeparator:` y `,tileFallbackName:`Ficha`,tileNotPlaced:`sin colocar`,tileInRegion:`en {{region}}`,tileCorrect:`correcta`,tileIncorrect:`incorrecta`}},common:{undo:`Deshacer`,clearAll:`Borrar todo`,correct:`Correcto`,incorrect:`Incorrecto`,showCorrectAnswer:`Mostrar respuesta correcta`,hideCorrectAnswer:`Ocultar respuesta correcta`,showTeacherInstructions:`Mostrar instrucciones para el maestro`,hideTeacherInstructions:`Ocultar instrucciones para el maestro`,commonCorrectAnswerWithAlternates:`Nota: La respuesta que se muestra arriba es la respuesta correcta más común para esta pregunta. También se definen una o más respuestas correctas adicionales, y también se reconocerán como correctas.`,warning:`Advertencia`,showNote:`Mostrar Nota`,hideNote:`Ocultar Nota`,cancel:`Cancelar`}},L7=e=>typeof e==`string`,R7=()=>{let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},z7=e=>e==null?``:``+e,B7=(e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})},V7=/###/g,H7=e=>e&&e.indexOf(`###`)>-1?e.replace(V7,`.`):e,U7=e=>!e||L7(e),W7=(e,t,n)=>{let r=L7(t)?t.split(`.`):t,i=0;for(;i<r.length-1;){if(U7(e))return{};let t=H7(r[i]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++i}return U7(e)?{}:{obj:e,k:H7(r[i])}},G7=(e,t,n)=>{let{obj:r,k:i}=W7(e,t,Object);if(r!==void 0||t.length===1){r[i]=n;return}let a=t[t.length-1],o=t.slice(0,t.length-1),s=W7(e,o,Object);for(;s.obj===void 0&&o.length;)a=`${o[o.length-1]}.${a}`,o=o.slice(0,o.length-1),s=W7(e,o,Object),s?.obj&&s.obj[`${s.k}.${a}`]!==void 0&&(s.obj=void 0);s.obj[`${s.k}.${a}`]=n},K7=(e,t,n,r)=>{let{obj:i,k:a}=W7(e,t,Object);i[a]=i[a]||[],i[a].push(n)},q7=(e,t)=>{let{obj:n,k:r}=W7(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},J7=(e,t,n)=>{let r=q7(e,n);return r===void 0?q7(t,n):r},Y7=(e,t,n)=>{for(let r in t)r!==`__proto__`&&r!==`constructor`&&(r in e?L7(e[r])||e[r]instanceof String||L7(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):Y7(e[r],t[r],n):e[r]=t[r]);return e},X7=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,`\\$&`),Z7={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`,"/":`/`},Q7=e=>L7(e)?e.replace(/[&<>"'\/]/g,e=>Z7[e]):e,$7=class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){let t=this.regExpMap.get(e);if(t!==void 0)return t;let n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}},e9=[` `,`,`,`?`,`!`,`;`],t9=new $7(20),n9=(e,t,n)=>{t||=``,n||=``;let r=e9.filter(e=>t.indexOf(e)<0&&n.indexOf(e)<0);if(r.length===0)return!0;let i=t9.getRegExp(`(${r.map(e=>e===`?`?`\\?`:e).join(`|`)})`),a=!i.test(e);if(!a){let t=e.indexOf(n);t>0&&!i.test(e.substring(0,t))&&(a=!0)}return a},r9=(e,t,n=`.`)=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;let r=t.split(n),i=e;for(let e=0;e<r.length;){if(!i||typeof i!=`object`)return;let t,a=``;for(let o=e;o<r.length;++o)if(o!==e&&(a+=n),a+=r[o],t=i[a],t!==void 0){if([`string`,`number`,`boolean`].indexOf(typeof t)>-1&&o<r.length-1)continue;e+=o-e+1;break}i=t}return i},i9=e=>e?.replace(/_/g,`-`),a9={type:`logger`,log(e){this.output(`log`,e)},warn(e){this.output(`warn`,e)},error(e){this.output(`error`,e)},output(e,t){console?.[e]?.apply?.(console,t)}},o9=new class e{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||`i18next:`,this.logger=e||a9,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,`log`,``,!0)}warn(...e){return this.forward(e,`warn`,``,!0)}error(...e){return this.forward(e,`error`,``)}deprecate(...e){return this.forward(e,`warn`,`WARNING DEPRECATED: `,!0)}forward(e,t,n,r){return r&&!this.debug?null:(L7(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(t){return new e(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t||=this.options,t.prefix=t.prefix||this.prefix,new e(this.logger,t)}},s9=class{constructor(){this.observers={}}on(e,t){return e.split(` `).forEach(e=>{this.observers[e]||(this.observers[e]=new Map);let n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([e,n])=>{for(let r=0;r<n;r++)e(...t)}),this.observers[`*`]&&Array.from(this.observers[`*`].entries()).forEach(([n,r])=>{for(let i=0;i<r;i++)n.apply(n,[e,...t])})}},c9=class extends s9{constructor(e,t={ns:[`translation`],defaultNS:`translation`}){super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){let t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n,r={}){let i=r.keySeparator===void 0?this.options.keySeparator:r.keySeparator,a=r.ignoreJSONStructure===void 0?this.options.ignoreJSONStructure:r.ignoreJSONStructure,o;e.indexOf(`.`)>-1?o=e.split(`.`):(o=[e,t],n&&(Array.isArray(n)?o.push(...n):L7(n)&&i?o.push(...n.split(i)):o.push(n)));let s=q7(this.data,o);return!s&&!t&&!n&&e.indexOf(`.`)>-1&&(e=o[0],t=o[1],n=o.slice(2).join(`.`)),s||!a||!L7(n)?s:r9(this.data?.[e]?.[t],n,i)}addResource(e,t,n,r,i={silent:!1}){let a=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,o=[e,t];n&&(o=o.concat(a?n.split(a):n)),e.indexOf(`.`)>-1&&(o=e.split(`.`),r=t,t=o[1]),this.addNamespaces(t),G7(this.data,o,r),i.silent||this.emit(`added`,e,t,n,r)}addResources(e,t,n,r={silent:!1}){for(let r in n)(L7(n[r])||Array.isArray(n[r]))&&this.addResource(e,t,r,n[r],{silent:!0});r.silent||this.emit(`added`,e,t,n)}addResourceBundle(e,t,n,r,i,a={silent:!1,skipCopy:!1}){let o=[e,t];e.indexOf(`.`)>-1&&(o=e.split(`.`),r=n,n=t,t=o[1]),this.addNamespaces(t);let s=q7(this.data,o)||{};a.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?Y7(s,n,i):s={...s,...n},G7(this.data,o,s),a.silent||this.emit(`added`,e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit(`removed`,e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||=this.options.defaultNS,this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){let t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}},l9={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(e=>{t=this.processors[e]?.process(t,n,r,i)??t}),t}},u9=Symbol(`i18next/PATH_KEY`);function d9(){let e=[],t=Object.create(null),n;return t.get=(r,i)=>(n?.revoke?.(),i===u9?e:(e.push(i),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function f9(e,t){let{[u9]:n}=e(d9()),r=t?.keySeparator??`.`,i=t?.nsSeparator??`:`;if(n.length>1&&i){let e=t?.ns,a=Array.isArray(e)?e:null;if(a&&a.length>1&&a.slice(1).includes(n[0]))return`${n[0]}${i}${n.slice(1).join(r)}`}return n.join(r)}var p9={},m9=e=>!L7(e)&&typeof e!=`boolean`&&typeof e!=`number`,h9=class e extends s9{constructor(e,t={}){super(),B7([`resourceStore`,`languageUtils`,`pluralResolver`,`interpolator`,`backendConnector`,`i18nFormat`,`utils`],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.logger=o9.create(`translator`)}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){let n={...t};if(e==null)return!1;let r=this.resolve(e,n);if(r?.res===void 0)return!1;let i=m9(r.res);return!(n.returnObjects===!1&&i)}extractFromKey(e,t){let n=t.nsSeparator===void 0?this.options.nsSeparator:t.nsSeparator;n===void 0&&(n=`:`);let r=t.keySeparator===void 0?this.options.keySeparator:t.keySeparator,i=t.ns||this.options.defaultNS||[],a=n&&e.indexOf(n)>-1,o=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!n9(e,n,r);if(a&&!o){let t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:L7(i)?[i]:i};let a=e.split(n);(n!==r||n===r&&this.options.ns.indexOf(a[0])>-1)&&(i=a.shift()),e=a.join(r)}return{key:e,namespaces:L7(i)?[i]:i}}translate(t,n,r){let i=typeof n==`object`?{...n}:n;if(typeof i!=`object`&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),typeof i==`object`&&(i={...i}),i||={},t==null)return``;typeof t==`function`&&(t=f9(t,{...this.options,...i})),Array.isArray(t)||(t=[String(t)]),t=t.map(e=>typeof e==`function`?f9(e,{...this.options,...i}):String(e));let a=i.returnDetails===void 0?this.options.returnDetails:i.returnDetails,o=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,{key:s,namespaces:c}=this.extractFromKey(t[t.length-1],i),l=c[c.length-1],u=i.nsSeparator===void 0?this.options.nsSeparator:i.nsSeparator;u===void 0&&(u=`:`);let d=i.lng||this.language,f=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d?.toLowerCase()===`cimode`)return f?a?{res:`${l}${u}${s}`,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:`${l}${u}${s}`:a?{res:s,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:s;let p=this.resolve(t,i),m=p?.res,h=p?.usedKey||s,g=p?.exactUsedKey||s,_=[`[object Number]`,`[object Function]`,`[object RegExp]`],v=i.joinArrays===void 0?this.options.joinArrays:i.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject,b=i.count!==void 0&&!L7(i.count),x=e.hasDefaultValue(i),S=b?this.pluralResolver.getSuffix(d,i.count,i):``,C=i.ordinal&&b?this.pluralResolver.getSuffix(d,i.count,{ordinal:!1}):``,w=b&&!i.ordinal&&i.count===0,T=w&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${S}`]||i[`defaultValue${C}`]||i.defaultValue,E=m;y&&!m&&x&&(E=T);let D=m9(E),O=Object.prototype.toString.apply(E);if(y&&E&&D&&_.indexOf(O)<0&&!(L7(v)&&Array.isArray(E))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn(`accessing an object - but returnObjects options is not enabled!`);let e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,E,{...i,ns:c}):`key '${s} (${this.language})' returned an object instead of string.`;return a?(p.res=e,p.usedParams=this.getUsedParamsDetails(i),p):e}if(o){let e=Array.isArray(E),t=e?[]:{},n=e?g:h;for(let e in E)if(Object.prototype.hasOwnProperty.call(E,e)){let r=`${n}${o}${e}`;x&&!m?t[e]=this.translate(r,{...i,defaultValue:m9(T)?T[e]:void 0,joinArrays:!1,ns:c}):t[e]=this.translate(r,{...i,joinArrays:!1,ns:c}),t[e]===r&&(t[e]=E[e])}m=t}}else if(y&&L7(v)&&Array.isArray(m))m=m.join(v),m&&=this.extendTranslation(m,t,i,r);else{let e=!1,n=!1;!this.isValidLookup(m)&&x&&(e=!0,m=T),this.isValidLookup(m)||(n=!0,m=s);let a=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&n?void 0:m,c=x&&T!==m&&this.options.updateMissing;if(n||e||c){if(this.logger.log(c?`updateKey`:`missingKey`,d,l,s,c?T:m),o){let e=this.resolve(s,{...i,keySeparator:!1});e&&e.res&&this.logger.warn(`Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.`)}let e=[],t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo===`fallback`&&t&&t[0])for(let n=0;n<t.length;n++)e.push(t[n]);else this.options.saveMissingTo===`all`?e=this.languageUtils.toResolveHierarchy(i.lng||this.language):e.push(i.lng||this.language);let n=(e,t,n)=>{let r=x&&n!==m?n:a;this.options.missingKeyHandler?this.options.missingKeyHandler(e,l,t,r,c,i):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,l,t,r,c,i),this.emit(`missingKey`,e,l,t,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&b?e.forEach(e=>{let t=this.pluralResolver.getSuffixes(e,i);w&&i[`defaultValue${this.options.pluralSeparator}zero`]&&t.indexOf(`${this.options.pluralSeparator}zero`)<0&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{n([e],s+t,i[`defaultValue${t}`]||T)})}):n(e,s,T))}m=this.extendTranslation(m,t,i,p,r),n&&m===s&&this.options.appendNamespaceToMissingKey&&(m=`${l}${u}${s}`),(n||e)&&this.options.parseMissingKeyHandler&&(m=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${u}${s}`:s,e?m:void 0,i))}return a?(p.res=m,p.usedParams=this.getUsedParamsDetails(i),p):m}extendTranslation(e,t,n,r,i){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});let a=L7(e)&&(n?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:n.interpolation.skipOnVariables),o;if(a){let t=e.match(this.interpolator.nestingRegexp);o=t&&t.length}let s=n.replace&&!L7(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),e=this.interpolator.interpolate(e,s,n.lng||this.language||r.usedLng,n),a){let t=e.match(this.interpolator.nestingRegexp),r=t&&t.length;o<r&&(n.nest=!1)}!n.lng&&r&&r.res&&(n.lng=this.language||r.usedLng),n.nest!==!1&&(e=this.interpolator.nest(e,(...e)=>i?.[0]===e[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null):this.translate(...e,t),n)),n.interpolation&&this.interpolator.reset()}let a=n.postProcess||this.options.postProcess,o=L7(a)?[a]:a;return e!=null&&o?.length&&n.applyPostProcessor!==!1&&(e=l9.handle(o,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,t={}){let n,r,i,a,o;return L7(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(e=>typeof e==`function`?f9(e,{...this.options,...t}):e)),e.forEach(e=>{if(this.isValidLookup(n))return;let s=this.extractFromKey(e,t),c=s.key;r=c;let l=s.namespaces;this.options.fallbackNS&&(l=l.concat(this.options.fallbackNS));let u=t.count!==void 0&&!L7(t.count),d=u&&!t.ordinal&&t.count===0,f=t.context!==void 0&&(L7(t.context)||typeof t.context==`number`)&&t.context!==``,p=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);l.forEach(e=>{this.isValidLookup(n)||(o=e,!p9[`${p[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(o)&&(p9[`${p[0]}-${e}`]=!0,this.logger.warn(`key "${r}" for languages "${p.join(`, `)}" won't get resolved as namespace "${o}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`)),p.forEach(r=>{if(this.isValidLookup(n))return;a=r;let o=[c];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(o,c,r,e,t);else{let e;u&&(e=this.pluralResolver.getSuffix(r,t.count,t));let n=`${this.options.pluralSeparator}zero`,i=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(u&&(t.ordinal&&e.indexOf(i)===0&&o.push(c+e.replace(i,this.options.pluralSeparator)),o.push(c+e),d&&o.push(c+n)),f){let r=`${c}${this.options.contextSeparator||`_`}${t.context}`;o.push(r),u&&(t.ordinal&&e.indexOf(i)===0&&o.push(r+e.replace(i,this.options.pluralSeparator)),o.push(r+e),d&&o.push(r+n))}}let s;for(;s=o.pop();)this.isValidLookup(n)||(i=s,n=this.getResource(r,e,s,t))}))})}),{res:n,usedKey:r,exactUsedKey:i,usedLng:a,usedNS:o}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e===``)}getResource(e,t,n,r={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}getUsedParamsDetails(e={}){let t=[`defaultValue`,`ordinal`,`context`,`replace`,`lng`,`lngs`,`fallbackLng`,`ns`,`keySeparator`,`nsSeparator`,`returnObjects`,`returnDetails`,`joinArrays`,`postProcess`,`interpolation`],n=e.replace&&!L7(e.replace),r=n?e.replace:e;if(n&&e.count!==void 0&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!n){r={...r};for(let e of t)delete r[e]}return r}static hasDefaultValue(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&t.substring(0,12)===`defaultValue`&&e[t]!==void 0)return!0;return!1}},g9=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=o9.create(`languageUtils`)}getScriptPartFromCode(e){if(e=i9(e),!e||e.indexOf(`-`)<0)return null;let t=e.split(`-`);return t.length===2||(t.pop(),t[t.length-1].toLowerCase()===`x`)?null:this.formatLanguageCode(t.join(`-`))}getLanguagePartFromCode(e){if(e=i9(e),!e||e.indexOf(`-`)<0)return e;let t=e.split(`-`);return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(L7(e)&&e.indexOf(`-`)>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load===`languageOnly`||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;let n=this.formatLanguageCode(e);(!this.options.supportedLngs||this.isSupportedCode(n))&&(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;let n=this.getScriptPartFromCode(e);if(this.isSupportedCode(n))return t=n;let r=this.getLanguagePartFromCode(e);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(e=>{if(e===r||!(e.indexOf(`-`)<0&&r.indexOf(`-`)<0)&&(e.indexOf(`-`)>0&&r.indexOf(`-`)<0&&e.substring(0,e.indexOf(`-`))===r||e.indexOf(r)===0&&r.length>1))return e})}),t||=this.getFallbackCodes(this.options.fallbackLng)[0],t}getFallbackCodes(e,t){if(!e)return[];if(typeof e==`function`&&(e=e(t)),L7(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||=e[this.getScriptPartFromCode(t)],n||=e[this.formatLanguageCode(t)],n||=e[this.getLanguagePartFromCode(t)],n||=e.default,n||[]}toResolveHierarchy(e,t){let n=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),r=[],i=e=>{e&&(this.isSupportedCode(e)?r.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return L7(e)&&(e.indexOf(`-`)>-1||e.indexOf(`_`)>-1)?(this.options.load!==`languageOnly`&&i(this.formatLanguageCode(e)),this.options.load!==`languageOnly`&&this.options.load!==`currentOnly`&&i(this.getScriptPartFromCode(e)),this.options.load!==`currentOnly`&&i(this.getLanguagePartFromCode(e))):L7(e)&&i(this.formatLanguageCode(e)),n.forEach(e=>{r.indexOf(e)<0&&i(this.formatLanguageCode(e))}),r}},_9={zero:0,one:1,two:2,few:3,many:4,other:5},v9={select:e=>e===1?`one`:`other`,resolvedOptions:()=>({pluralCategories:[`one`,`other`]})},y9=class{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=o9.create(`pluralResolver`),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){let n=i9(e===`dev`?`en`:e),r=t.ordinal?`ordinal`:`cardinal`,i=JSON.stringify({cleanedCode:n,type:r});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let a;try{a=new Intl.PluralRules(n,{type:r})}catch{if(typeof Intl>`u`)return this.logger.error(`No Intl support, please use an Intl polyfill!`),v9;if(!e.match(/-|_/))return v9;let n=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(n,t)}return this.pluralRulesCache[i]=a,a}needsPlural(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t,n={}){return this.getSuffixes(e,n).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?n.resolvedOptions().pluralCategories.sort((e,t)=>_9[e]-_9[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:``}${e}`):[]}getSuffix(e,t,n={}){let r=this.getRule(e,n);return r?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:``}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix(`dev`,t,n))}},b9=(e,t,n,r=`.`,i=!0)=>{let a=J7(e,t,n);return!a&&i&&L7(n)&&(a=r9(e,n,r),a===void 0&&(a=r9(t,n,r))),a},x9=e=>e.replace(/\$/g,`$$$$`),S9=class{constructor(e={}){this.logger=o9.create(`interpolator`),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(e={}){e.interpolation||={escapeValue:!0};let{escape:t,escapeValue:n,useRawValueToEscape:r,prefix:i,prefixEscaped:a,suffix:o,suffixEscaped:s,formatSeparator:c,unescapeSuffix:l,unescapePrefix:u,nestingPrefix:d,nestingPrefixEscaped:f,nestingSuffix:p,nestingSuffixEscaped:m,nestingOptionsSeparator:h,maxReplaces:g,alwaysFormat:_}=e.interpolation;this.escape=t===void 0?Q7:t,this.escapeValue=n===void 0||n,this.useRawValueToEscape=r!==void 0&&r,this.prefix=i?X7(i):a||`{{`,this.suffix=o?X7(o):s||`}}`,this.formatSeparator=c||`,`,this.unescapePrefix=l?``:u||`-`,this.unescapeSuffix=this.unescapePrefix?``:l||``,this.nestingPrefix=d?X7(d):f||X7(`$t(`),this.nestingSuffix=p?X7(p):m||X7(`)`),this.nestingOptionsSeparator=h||`,`,this.maxReplaces=g||1e3,this.alwaysFormat=_!==void 0&&_,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let e=(e,t)=>e?.source===t?(e.lastIndex=0,e):new RegExp(t,`g`);this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,n,r){let i,a,o,s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=e=>{if(e.indexOf(this.formatSeparator)<0){let i=b9(t,s,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(i,void 0,n,{...r,...t,interpolationkey:e}):i}let i=e.split(this.formatSeparator),a=i.shift().trim(),o=i.join(this.formatSeparator).trim();return this.format(b9(t,s,a,this.options.keySeparator,this.options.ignoreJSONStructure),o,n,{...r,...t,interpolationkey:a})};this.resetRegExp();let l=r?.missingInterpolationHandler||this.options.missingInterpolationHandler,u=r?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:r.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>x9(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?x9(this.escape(e)):x9(e)}].forEach(t=>{for(o=0;i=t.regex.exec(e);){let n=i[1].trim();if(a=c(n),a===void 0)if(typeof l==`function`){let t=l(e,i,r);a=L7(t)?t:``}else if(r&&Object.prototype.hasOwnProperty.call(r,n))a=``;else if(u){a=i[0];continue}else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),a=``;else!L7(a)&&!this.useRawValueToEscape&&(a=z7(a));let s=t.safeValue(a);if(e=e.replace(i[0],s),u?(t.regex.lastIndex+=a.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,o++,o>=this.maxReplaces)break}}),e}nest(e,t,n={}){let r,i,a,o=(e,t)=>{let n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;let r=e.split(RegExp(`${X7(n)}[ ]*{`)),i=`{${r[1]}`;e=r[0],i=this.interpolate(i,a);let o=i.match(/'/g),s=i.match(/"/g);((o?.length??0)%2==0&&!s||(s?.length??0)%2!=0)&&(i=i.replace(/'/g,`"`));try{a=JSON.parse(i),t&&(a={...t,...a})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${i}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,e};for(;r=this.nestingRegexp.exec(e);){let s=[];a={...n},a=a.replace&&!L7(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let c=/{.*}/.test(r[1])?r[1].lastIndexOf(`}`)+1:r[1].indexOf(this.formatSeparator);if(c!==-1&&(s=r[1].slice(c).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),r[1]=r[1].slice(0,c)),i=t(o.call(this,r[1].trim(),a),a),i&&r[0]===e&&!L7(i))return i;L7(i)||(i=z7(i)),i||=(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),``),s.length&&(i=s.reduce((e,t)=>this.format(e,t,n.lng,{...n,interpolationkey:r[1].trim()}),i.trim())),e=e.replace(r[0],i),this.regexp.lastIndex=0}return e}},Fee=e=>{let t=e.toLowerCase().trim(),n={};if(e.indexOf(`(`)>-1){let r=e.split(`(`);t=r[0].toLowerCase().trim();let i=r[1].substring(0,r[1].length-1);t===`currency`&&i.indexOf(`:`)<0?n.currency||=i.trim():t===`relativetime`&&i.indexOf(`:`)<0?n.range||=i.trim():i.split(`;`).forEach(e=>{if(e){let[t,...r]=e.split(`:`),i=r.join(`:`).trim().replace(/^'+|'+$/g,``),a=t.trim();n[a]||(n[a]=i),i===`false`&&(n[a]=!1),i===`true`&&(n[a]=!0),isNaN(i)||(n[a]=parseInt(i,10))}})}return{formatName:t,formatOptions:n}},C9=e=>{let t={};return(n,r,i)=>{let a=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(a={...a,[i.interpolationkey]:void 0});let o=r+JSON.stringify(a),s=t[o];return s||(s=e(i9(r),i),t[o]=s),s(n)}},Iee=e=>(t,n,r)=>e(i9(n),r)(t),Lee=class{constructor(e={}){this.logger=o9.create(`formatter`),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||`,`;let n=t.cacheInBuiltFormats?C9:Iee;this.formats={number:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t,style:`currency`});return e=>n.format(e)}),datetime:n((e,t)=>{let n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:n((e,t)=>{let n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||`day`)}),list:n((e,t)=>{let n=new Intl.ListFormat(e,{...t});return e=>n.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=C9(t)}format(e,t,n,r={}){let i=t.split(this.formatSeparator);if(i.length>1&&i[0].indexOf(`(`)>1&&i[0].indexOf(`)`)<0&&i.find(e=>e.indexOf(`)`)>-1)){let e=i.findIndex(e=>e.indexOf(`)`)>-1);i[0]=[i[0],...i.splice(1,e)].join(this.formatSeparator)}return i.reduce((e,t)=>{let{formatName:i,formatOptions:a}=Fee(t);if(this.formats[i]){let t=e;try{let o=r?.formatParams?.[r.interpolationkey]||{},s=o.locale||o.lng||r.locale||r.lng||n;t=this.formats[i](e,s,{...a,...r,...o})}catch(e){this.logger.warn(e)}return t}else this.logger.warn(`there was no format function for ${i}`);return e},e)}},Ree=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)},zee=class extends s9{constructor(e,t,n,r={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=o9.create(`backendConnector`),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,r.backend,r)}queueLoad(e,t,n,r){let i={},a={},o={},s={};return e.forEach(e=>{let r=!0;t.forEach(t=>{let o=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[o]=2:this.state[o]<0||(this.state[o]===1?a[o]===void 0&&(a[o]=!0):(this.state[o]=1,r=!1,a[o]===void 0&&(a[o]=!0),i[o]===void 0&&(i[o]=!0),s[t]===void 0&&(s[t]=!0)))}),r||(o[e]=!0)}),(Object.keys(i).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(i),pending:Object.keys(a),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(s)}}loaded(e,t,n){let r=e.split(`|`),i=r[0],a=r[1];t&&this.emit(`failedLoading`,i,a,t),!t&&n&&this.store.addResourceBundle(i,a,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);let o={};this.queue.forEach(n=>{K7(n.loaded,[i],a),Ree(n,e),t&&n.errors.push(t),n.pendingCount===0&&!n.done&&(Object.keys(n.loaded).forEach(e=>{o[e]||(o[e]={});let t=n.loaded[e];t.length&&t.forEach(t=>{o[e][t]===void 0&&(o[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit(`loaded`,o),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n,r=0,i=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:i,callback:a});return}this.readingCalls++;let o=(o,s)=>{if(this.readingCalls--,this.waitingReads.length>0){let e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}if(o&&s&&r<this.maxRetries){setTimeout(()=>{this.read.call(this,e,t,n,r+1,i*2,a)},i);return}a(o,s)},s=this.backend[n].bind(this.backend);if(s.length===2){try{let n=s(e,t);n&&typeof n.then==`function`?n.then(e=>o(null,e)).catch(o):o(null,n)}catch(e){o(e)}return}return s(e,t,o)}prepareLoading(e,t,n={},r){if(!this.backend)return this.logger.warn(`No backend was added via i18next.use. Will not load resources.`),r&&r();L7(e)&&(e=this.languageUtils.toResolveHierarchy(e)),L7(t)&&(t=[t]);let i=this.queueLoad(e,t,n,r);if(!i.toLoad.length)return i.pending.length||r(),null;i.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e,t=``){let n=e.split(`|`),r=n[0],i=n[1];this.read(r,i,`read`,void 0,void 0,(n,a)=>{n&&this.logger.warn(`${t}loading namespace ${i} for language ${r} failed`,n),!n&&a&&this.logger.log(`${t}loaded namespace ${i} for language ${r}`,a),this.loaded(e,n,a)})}saveMissing(e,t,n,r,i,a={},o=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(t)){this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`);return}if(!(n==null||n===``)){if(this.backend?.create){let s={...a,isUpdate:i},c=this.backend.create.bind(this.backend);if(c.length<6)try{let i;i=c.length===5?c(e,t,n,r,s):c(e,t,n,r),i&&typeof i.then==`function`?i.then(e=>o(null,e)).catch(o):o(null,i)}catch(e){o(e)}else c(e,t,n,r,o,s)}!e||!e[0]||this.store.addResource(e[0],t,n,r)}}},w9=()=>({debug:!1,initAsync:!0,ns:[`translation`],defaultNS:[`translation`],fallbackLng:[`dev`],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:`all`,preload:!1,simplifyPluralSuffix:!0,keySeparator:`.`,nsSeparator:`:`,pluralSeparator:`_`,contextSeparator:`_`,partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:`fallback`,saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]==`object`&&(t=e[1]),L7(e[1])&&(t.defaultValue=e[1]),L7(e[2])&&(t.tDescription=e[2]),typeof e[2]==`object`||typeof e[3]==`object`){let n=e[3]||e[2];Object.keys(n).forEach(e=>{t[e]=n[e]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:`{{`,suffix:`}}`,formatSeparator:`,`,unescapePrefix:`-`,nestingPrefix:`$t(`,nestingSuffix:`)`,nestingOptionsSeparator:`,`,maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),T9=e=>(L7(e.ns)&&(e.ns=[e.ns]),L7(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),L7(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.(`cimode`)<0&&(e.supportedLngs=e.supportedLngs.concat([`cimode`])),typeof e.initImmediate==`boolean`&&(e.initAsync=e.initImmediate),e),E9=()=>{},Bee=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(t=>{typeof e[t]==`function`&&(e[t]=e[t].bind(e))})},D9=`__i18next_supportNoticeShown`,Vee=()=>!!(typeof globalThis<`u`&&globalThis[D9]||typeof process<`u`&&process.env&&process.env.I18NEXT_NO_SUPPORT_NOTICE||typeof process<`u`&&process.env),Hee=()=>{typeof globalThis<`u`&&(globalThis[D9]=!0)},Uee=e=>!!(e?.modules?.backend?.name?.indexOf(`Locize`)>0||e?.modules?.backend?.constructor?.name?.indexOf(`Locize`)>0||e?.options?.backend?.backends&&e.options.backend.backends.some(e=>e?.name?.indexOf(`Locize`)>0||e?.constructor?.name?.indexOf(`Locize`)>0)||e?.options?.backend?.projectId||e?.options?.backend?.backendOptions&&e.options.backend.backendOptions.some(e=>e?.projectId)),O9=class e extends s9{constructor(e={},t){if(super(),this.options=T9(e),this.services={},this.logger=o9,this.modules={external:[]},Bee(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,typeof e==`function`&&(t=e,e={}),e.defaultNS==null&&e.ns&&(L7(e.ns)?e.defaultNS=e.ns:e.ns.indexOf(`translation`)<0&&(e.defaultNS=e.ns[0]));let n=w9();this.options={...n,...this.options,...T9(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!=`function`&&(this.options.overloadTranslationOptionHandler=n.overloadTranslationOptionHandler),this.options.showSupportNotice!==!1&&!Uee(this)&&!Vee()&&(typeof console<`u`&&console.info!==void 0&&console.info(`🌐 i18next is made possible by our own product, Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙`),Hee());let r=e=>e?typeof e==`function`?new e:e:null;if(!this.options.isClone){this.modules.logger?o9.init(r(this.modules.logger),this.options):o9.init(null,this.options);let e;e=this.modules.formatter?this.modules.formatter:Lee;let t=new g9(this.options);this.store=new c9(this.options.resources,this.options);let i=this.services;i.logger=o9,i.resourceStore=this.store,i.languageUtils=t,i.pluralResolver=new y9(t,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==n.interpolation.format&&this.logger.deprecate(`init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting`),e&&(!this.options.interpolation.format||this.options.interpolation.format===n.interpolation.format)&&(i.formatter=r(e),i.formatter.init&&i.formatter.init(i,this.options),this.options.interpolation.format=i.formatter.format.bind(i.formatter)),i.interpolator=new S9(this.options),i.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},i.backendConnector=new zee(r(this.modules.backend),i.resourceStore,i,this.options),i.backendConnector.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(i.languageDetector=r(this.modules.languageDetector),i.languageDetector.init&&i.languageDetector.init(i,this.options.detection,this.options)),this.modules.i18nFormat&&(i.i18nFormat=r(this.modules.i18nFormat),i.i18nFormat.init&&i.i18nFormat.init(this)),this.translator=new h9(this.services,this.options),this.translator.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,t||=E9,this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&e[0]!==`dev`&&(this.options.lng=e[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn(`init: no languageDetector is used and no lng is defined`),[`getResource`,`hasResourceBundle`,`getResourceBundle`,`getDataByLanguage`].forEach(e=>{this[e]=(...t)=>this.store[e](...t)}),[`addResource`,`addResources`,`addResourceBundle`,`removeResourceBundle`].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});let i=R7(),a=()=>{let e=(e,n)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn(`init: i18next is already initialized. You should call init just once!`),this.isInitialized=!0,this.options.isClone||this.logger.log(`initialized`,this.options),this.emit(`initialized`,this.options),i.resolve(n),t(e,n)};if(this.languages&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?a():setTimeout(a,0),i}loadResources(e,t=E9){let n=t,r=L7(e)?e:this.language;if(typeof e==`function`&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(r?.toLowerCase()===`cimode`&&(!this.options.preload||this.options.preload.length===0))return n();let e=[],t=t=>{t&&t!==`cimode`&&this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{t!==`cimode`&&e.indexOf(t)<0&&e.push(t)})};r?t(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e)),this.options.preload?.forEach?.(e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{!e&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(e)})}else n(null)}reloadResources(e,t,n){let r=R7();return typeof e==`function`&&(n=e,e=void 0),typeof t==`function`&&(n=t,t=void 0),e||=this.languages,t||=this.options.ns,n||=E9,this.services.backendConnector.reload(e,t,e=>{r.resolve(),n(e)}),r}use(e){if(!e)throw Error(`You are passing an undefined module! Please check the object you are passing to i18next.use()`);if(!e.type)throw Error(`You are passing a wrong module! Please check the object you are passing to i18next.use()`);return e.type===`backend`&&(this.modules.backend=e),(e.type===`logger`||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type===`languageDetector`&&(this.modules.languageDetector=e),e.type===`i18nFormat`&&(this.modules.i18nFormat=e),e.type===`postProcessor`&&l9.addPostProcessor(e),e.type===`formatter`&&(this.modules.formatter=e),e.type===`3rdParty`&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!([`cimode`,`dev`].indexOf(e)>-1)){for(let e=0;e<this.languages.length;e++){let t=this.languages[e];if(!([`cimode`,`dev`].indexOf(t)>-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;let n=R7();this.emit(`languageChanging`,e);let r=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},i=(i,a)=>{a?this.isLanguageChangingTo===e&&(r(a),this.translator.changeLanguage(a),this.isLanguageChangingTo=void 0,this.emit(`languageChanged`,a),this.logger.log(`languageChanged`,a)):this.isLanguageChangingTo=void 0,n.resolve((...e)=>this.t(...e)),t&&t(i,(...e)=>this.t(...e))},a=t=>{!e&&!t&&this.services.languageDetector&&(t=[]);let n=L7(t)?t:t&&t[0],a=this.store.hasLanguageSomeTranslations(n)?n:this.services.languageUtils.getBestMatchFromCodes(L7(t)?[t]:t);a&&(this.language||r(a),this.translator.language||this.translator.changeLanguage(a),this.services.languageDetector?.cacheUserLanguage?.(a)),this.loadResources(a,e=>{i(e,a)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e),n}getFixedT(e,t,n){let r=(e,t,...i)=>{let a;a=typeof t==`object`?{...t}:this.options.overloadTranslationOptionHandler([e,t].concat(i)),a.lng=a.lng||r.lng,a.lngs=a.lngs||r.lngs,a.ns=a.ns||r.ns,a.keyPrefix!==``&&(a.keyPrefix=a.keyPrefix||n||r.keyPrefix);let o={...this.options,...a};typeof a.keyPrefix==`function`&&(a.keyPrefix=f9(a.keyPrefix,o));let s=this.options.keySeparator||`.`,c;return a.keyPrefix&&Array.isArray(e)?c=e.map(e=>(typeof e==`function`&&(e=f9(e,o)),`${a.keyPrefix}${s}${e}`)):(typeof e==`function`&&(e=f9(e,o)),c=a.keyPrefix?`${a.keyPrefix}${s}${e}`:e),this.t(c,a)};return L7(e)?r.lng=e:r.lngs=e,r.ns=t,r.keyPrefix=n,r}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn(`hasLoadedNamespace: i18next was not initialized`,this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn(`hasLoadedNamespace: i18n.languages were undefined or empty`,this.languages),!1;let n=t.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(n.toLowerCase()===`cimode`)return!0;let a=(e,t)=>{let n=this.services.backendConnector.state[`${e}|${t}`];return n===-1||n===0||n===2};if(t.precheck){let e=t.precheck(this,a);if(e!==void 0)return e}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(n,e)&&(!r||a(i,e)))}loadNamespaces(e,t){let n=R7();return this.options.ns?(L7(e)&&(e=[e]),e.forEach(e=>{this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){let n=R7();L7(e)&&(e=[e]);let r=this.options.preload||[],i=e.filter(e=>r.indexOf(e)<0&&this.services.languageUtils.isSupportedCode(e));return i.length?(this.options.preload=r.concat(i),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}dir(e){if(e||=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language),!e)return`rtl`;try{let t=new Intl.Locale(e);if(t&&t.getTextInfo){let e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch{}let t=`ar.shu.sqr.ssh.xaa.yhd.yud.aao.abh.abv.acm.acq.acw.acx.acy.adf.ads.aeb.aec.afb.ajp.apc.apd.arb.arq.ars.ary.arz.auz.avl.ayh.ayl.ayn.ayp.bbz.pga.he.iw.ps.pbt.pbu.pst.prp.prd.ug.ur.ydd.yds.yih.ji.yi.hbo.men.xmn.fa.jpr.peo.pes.prs.dv.sam.ckb`.split(`.`),n=this.services?.languageUtils||new g9(w9());return e.toLowerCase().indexOf(`-latn`)>1?`ltr`:t.indexOf(n.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf(`-arab`)>1?`rtl`:`ltr`}static createInstance(t={},n){let r=new e(t,n);return r.createInstance=e.createInstance,r}cloneInstance(t={},n=E9){let r=t.forkResourceStore;r&&delete t.forkResourceStore;let i={...this.options,...t,isClone:!0},a=new e(i);if((t.debug!==void 0||t.prefix!==void 0)&&(a.logger=a.logger.clone(t)),[`store`,`services`,`language`].forEach(e=>{a[e]=this[e]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},r&&(a.store=new c9(Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((n,r)=>(n[r]={...e[t][r]},n),e[t]),e),{}),i),a.services.resourceStore=a.store),t.interpolation){let e={...w9().interpolation,...this.options.interpolation,...t.interpolation},n={...i,interpolation:e};a.services.interpolator=new S9(n)}return a.translator=new h9(a.services,i),a.translator.on(`*`,(e,...t)=>{a.emit(e,...t)}),a.init(i,n),a.translator.options=i,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}.createInstance();O9.createInstance,O9.dir,O9.init,O9.loadResources,O9.reloadResources,O9.use,O9.changeLanguage,O9.getFixedT,O9.t,O9.exists,O9.setDefaultNamespace,O9.hasLoadedNamespace,O9.loadNamespaces,O9.loadLanguages,O9.init({fallbackLng:`en`,lng:`en`,showSupportNotice:!1,resources:{en:F7,es:I7}});var k9={translator:{...O9,t:(e,t)=>{let{lng:n}=t;switch(n){case`en_US`:case`en-US`:t.lng=`en`;break;case`es_ES`:case`es-ES`:case`es_MX`:case`es-MX`:t.lng=`es`;break;default:break}return O9.t(e,{lng:n,...t})}},languageOptions:[{value:`en_US`,label:`English (US)`},{value:`es_ES`,label:`Spanish`}]},{translator:A9}=k9,Wee=R(`div`)(()=>({alignSelf:`flex-end`})),Gee=R(`div`)(({theme:e})=>({cursor:`pointer`,fontSize:e.typography.fontSize,color:lu(),padding:e.spacing(1)})),Kee=R(cl)(({theme:e})=>({padding:e.spacing(1),display:`flex`,flexDirection:`column`,gap:e.spacing(1),"& button":{textTransform:`none`,fontSize:e.typography.fontSize,color:Il(),justifyContent:`flex-start`}})),qee=class extends P.Component{constructor(e){super(e),this.state={actionsAnchorEl:null}}componentWillUnmount(){this.setState({actionsAnchorEl:null})}static propTypes={addCategory:v.func.isRequired,deleteCategory:v.func.isRequired,language:v.string,categories:v.array};handleActionsClick=e=>{this.setState({actionsAnchorEl:e.currentTarget})};handleActionsClose=()=>{this.setState({actionsAnchorEl:null})};handleAddCategory=()=>{let{addCategory:e}=this.props;e(),this.handleActionsClose()};handleDeleteCategory=e=>{let{deleteCategory:t}=this.props;t(e),this.handleActionsClose()};render(){let{categories:e,language:t}=this.props,{actionsAnchorEl:n}=this.state;return(0,F.jsxs)(Wee,{children:[(0,F.jsx)(Gee,{role:`button`,tabIndex:0,onClick:this.handleActionsClick,children:`Actions`}),(0,F.jsx)(Al,{open:!!n,anchorEl:n,onClose:this.handleActionsClose,anchorOrigin:{vertical:`bottom`,horizontal:`left`},transformOrigin:{vertical:`top`,horizontal:`left`},children:(0,F.jsxs)(Kee,{children:[(0,F.jsxs)(ff,{onClick:()=>this.handleAddCategory(),children:[`+ `,A9.t(`charting.add`,{lng:t})]}),e.length>0&&e.map((e,n)=>e.deletable&&!e.correctness&&(0,F.jsx)(ff,{onClick:()=>this.handleDeleteCategory(n),children:`${A9.t(`charting.delete`,{lng:t})} <${e.label||A9.t(`charting.newLabel`,{lng:t})}>`},n))]})},`actions-popover-${Math.random()}`)]})}},{translator:j9}=k9,Jee=Uu(`pie-lib:charts:chart`),Yee=R(`div`)(()=>({width:`min-content`})),Xee=class extends P.Component{constructor(e){super(e),this.state={dialog:{open:!1},actionsAnchorEl:null},this.maskUid=this.generateMaskId()}static propTypes={className:v.string,chartType:v.string.isRequired,size:v.shape({width:v.number,height:v.number}),domain:v.shape({label:v.string,min:v.number,max:v.number,axisLabel:v.string}),data:v.arrayOf(v.shape({label:v.string,value:v.number})),range:v.shape({label:v.string,min:v.number,max:v.number,step:v.number,labelStep:v.number,axisLabel:v.string}),charts:v.array,labelsPlaceholders:v.object,title:v.string,titlePlaceholder:v.string,onDataChange:v.func,onChangeLabels:v.func,onChangeTitle:v.func,error:v.any,addCategoryEnabled:v.bool,showPixelGuides:v.bool,categoryDefaultLabel:v.string,categoryDefaults:v.object,defineChart:v.bool,theme:v.object,chartingOptions:v.object,changeInteractiveEnabled:v.bool,changeEditableEnabled:v.bool,language:v.string,mathMlOptions:v.object,labelsCharactersLimit:v.number,correctData:v.arrayOf(v.shape({label:v.string,value:v.number}))};static defaultProps={size:{width:480,height:480}};state={charts:[P7.Bar(),P7.Histogram(),P7.LineDot(),P7.LineCross(),P7.DotPlot(),P7.LinePlot()],autoFocus:!1};generateMaskId(){return`chart-`+(Math.random()*1e4).toFixed()}handleAlertDialog=(e,t)=>this.setState({dialog:{open:e}},t);getChart=()=>{let e=this.props.charts||this.state.charts,{chartType:t}=this.props,n=null,r=null;return t?(r=e&&e.find(e=>e.type===t),n=r&&r.Component):(r=e&&e[0],n=r&&r.Component,t=r&&r.type),{type:t,ChartComponent:n}};changeData=e=>{let{onDataChange:t}=this.props;t(e)};changeCategory=(e,t)=>{let n=parseInt(e,10);if(n>=0){let{data:e,onDataChange:r}=this.props;e[n]={...e[n],...t},r(e)}};addCategory=()=>{let{onDataChange:e,data:t,categoryDefaultLabel:n,defineChart:r,categoryDefaults:i,language:a}=this.props;(t||[]).length>19?this.setState({dialog:{open:!0,title:j9.t(`common:warning`,{lng:a}),text:j9.t(`charting.reachedLimit_other`,{count:20,lng:a}),onConfirm:()=>this.handleAlertDialog(!1)}}):(this.setState({autoFocus:!0}),e([...t,{inDefineChart:r,label:n||j9.t(`charting.newLabel`,{lng:a}),value:0,deletable:!0,editable:!i||i?.editable,interactive:!i||i?.interactive}]))};deleteCategory=e=>{let{data:t,onDataChange:n}=this.props;typeof e!=`number`||e<0||t&&t.length>0&&n(t.filter((t,n)=>n!==e))};getFilteredCategories=()=>{let{data:e,defineChart:t}=this.props;return e?e.map(e=>({...e,deletable:t||e.deletable})):[]};resetAutoFocus=()=>{this.setState({autoFocus:!1})};render(){let{domain:e={},range:t={},chartingOptions:n,size:r,title:i,onChangeTitle:a,onChangeLabels:o,labelsPlaceholders:s,titlePlaceholder:c,addCategoryEnabled:l,changeInteractiveEnabled:u,changeEditableEnabled:d,showPixelGuides:f,error:p,mathMlOptions:m={},language:h,labelsCharactersLimit:g,correctData:_}=this.props,{chartType:v}=this.props,{dialog:y}=this.state,b=this.props.defineChart||!1,{width:x,height:S}=r||{},C={left:t?.label||``,bottom:e?.label||``},{ChartComponent:w}=this.getChart(),T=this.getFilteredCategories(),E=l5(e,t,v),{verticalLines:D,horizontalLines:O,leftAxis:k}=u5(E.range,v),A={graphProps:H3(E.domain,E.range,r,()=>this.rootNode)};Jee(`[render] common:`,A);let j={x:-10,y:-75,width:x+20,height:S+130},{scale:M}=A.graphProps,ee=s5(M.x,T,x,v),N=ee.bandwidth()||M.x(E.domain.max)/T.length,te=b?160:60,ne=f5(N),re=Mp(A);return re.graphProps.size.height+=ne+te,(v===`dotPlot`||v===`linePlot`)&&_?.length&&C.bottom&&(re.graphProps.size.height+=25),(0,F.jsxs)(Yee,{children:[(0,F.jsxs)(c1,{title:i,onChangeTitle:a,disabledTitle:!b,showTitle:!0,showLabels:!0,labels:C,onChangeLabels:o,labelsPlaceholders:s,titlePlaceholder:c,defineChart:b,disabledLabels:!b,isChart:!0,showPixelGuides:f,rootRef:e=>this.rootNode=e,mathMlOptions:m,labelsCharactersLimit:g,...re,children:[(0,F.jsx)(b8,{...A,xBand:ee,rowTickValues:O,columnTickValues:D}),(0,F.jsx)(R5,{autoFocus:this.state.autoFocus,onAutoFocusUsed:this.resetAutoFocus,...A,defineChart:b,categories:T,xBand:ee,leftAxis:k,onChange:this.changeData,onChangeCategory:this.changeCategory,chartingOptions:n,changeInteractiveEnabled:u,changeEditableEnabled:d,top:ne,error:p,showCorrectness:v===`linePlot`||v===`dotPlot`}),l?(0,F.jsx)(`foreignObject`,{x,y:S-16,width:x,height:S,children:(0,F.jsx)(`div`,{xmlns:`http://www.w3.org/1999/xhtml`,style:{display:`flex`,justifyContent:`flex-start`},children:(0,F.jsx)(qee,{categories:T,addCategory:this.addCategory,deleteCategory:this.deleteCategory,language:h})})}):null,(0,F.jsx)(`mask`,{id:`${this.maskUid}`,children:(0,F.jsx)(`rect`,{...j,fill:`white`})}),(0,F.jsx)(`g`,{id:`marks`,mask:`url('#${this.maskUid}')`,children:w&&(0,F.jsx)(w,{...A,data:T,height:re.graphProps.size.height,defineChart:b,onChange:this.changeData,onChangeCategory:this.changeCategory,correctData:_})})]}),(0,F.jsx)(s6,{open:y.open,title:y.title,text:y.text,onClose:y.onClose,onConfirm:y.onConfirm})]})}},Zee=R(`div`)(({theme:e})=>({backgroundColor:V.WHITE,padding:e.spacing(2),width:`355px`,boxShadow:`inset 0px 1px 5px 0px #9297A6`,display:`flex`,flexDirection:`column`,gap:`16px`})),M9=R(`div`)(()=>({display:`flex`,alignItems:`center`,gap:`12px`})),Qee=R(`div`)(({theme:e})=>({fontSize:e.typography.h6.fontSize,fontWeight:`700`})),$ee=R(`div`)(()=>({marginLeft:`2px`})),N9=R(pR)(({theme:e})=>({backgroundColor:Bl(),borderRadius:e.spacing(2),color:V.WHITE})),ete=R(e5)(({theme:e})=>({backgroundColor:Gl(),borderRadius:e.spacing(2),color:V.WHITE})),tte=R(`div`)(()=>({marginLeft:`3px`,display:`flex`,alignItems:`center`,gap:`12px`})),{translator:P9}=k9,F9=({language:e})=>(0,F.jsxs)(Zee,{children:[(0,F.jsx)(Qee,{children:`Key`}),(0,F.jsxs)(M9,{children:[(0,F.jsx)(ete,{}),(0,F.jsx)(`div`,{children:P9.t(`charting.keyLegend.incorrectAnswer`,{lng:e})})]}),(0,F.jsxs)(M9,{children:[(0,F.jsx)(N9,{}),(0,F.jsx)(`div`,{children:P9.t(`charting.keyLegend.correctAnswer`,{lng:e})})]}),(0,F.jsxs)(tte,{children:[(0,F.jsx)(N9,{fontSize:`small`}),(0,F.jsx)($ee,{children:P9.t(`charting.keyLegend.correctKeyAnswer`,{lng:e})})]})]});F9.propTypes={language:v.string};var I9=`height ease-in 300ms, opacity ease-in 300ms`,nte=R(`div`)(()=>({position:`relative`,height:0,overflow:`hidden`,display:`flex`,visibility:`hidden`,width:0,"&.enter":{transition:I9,opacity:1,height:`auto`,width:`auto`,visibility:`visible`,minHeight:`25px`},"&.enter-done":{height:`auto`,visibility:`visible`,width:`auto`,minHeight:`25px`},"&.exit":{transition:I9,opacity:0,height:0,visibility:`visible`,width:0},"&.exit-done":{opacity:0,visibility:`hidden`,height:0,width:0}})),L9=e=>{let{show:t,children:n,className:r}=e,i=(0,P.useRef)(null);return(0,F.jsx)(Hs,{nodeRef:i,in:t,appear:!0,mountOnEnter:!1,timeout:300,classNames:{enter:`enter`,enterDone:`enter-done`,exit:`exit`,exitDone:`exit-done`},children:(0,F.jsx)(nte,{ref:i,className:r,children:n})})};L9.propTypes={show:v.bool.isRequired,className:v.string,children:v.oneOfType([v.arrayOf(v.node),v.node]).isRequired};function R9(e){return typeof e==`function`||typeof e==`object`&&!!e&&typeof e.$$typeof==`symbol`}function z9(e,t){return!e||R9(e)?e:R9(e.default)?e.default:t&&R9(e[t])?e[t]:t&&R9(e[t]?.default)?e[t].default:e}var rte=z9(ep,`Readable`)||z9(ite.Readable,`Readable`),B9=Op,V9=B9.default,ite=V9&&typeof V9==`object`?V9:B9,{translator:H9}=k9,ate={WebkitTouchCallout:`none`,WebkitUserSelect:`none`,KhtmlUserSelect:`none`,MozUserSelect:`none`,msUserSelect:`none`,userSelect:`none`},ote=R(`div`)(()=>({width:`100%`,cursor:`pointer`})),ste=R(`div`)(()=>({margin:`0 auto`,textAlign:`center`,display:`flex`})),cte=R(`div`)(()=>({width:`fit-content`,minWidth:`140px`,alignSelf:`center`,verticalAlign:`middle`,color:`var(--correct-answer-toggle-label-color, ${Il()})`,fontWeight:`normal`,...ate})),U9=R(`div`)(()=>({position:`absolute`,width:`25px`,"&.enter":{opacity:`0`},"&.enter-active":{opacity:`1`,transition:`opacity 0.3s ease-in`},"&.exit":{opacity:`1`},"&.exit-active":{opacity:`0`,transition:`opacity 0.3s ease-in`}})),lte=R(`div`)(()=>({width:`25px`,marginRight:`5px`,display:`flex`,alignItems:`center`})),ute=class e extends P.Component{static propTypes={onToggle:v.func,toggled:v.bool,show:v.bool,hideMessage:v.string,showMessage:v.string,className:v.string,language:v.string};static defaultProps={showMessage:`Show correct answer`,hideMessage:`Hide correct answer`,show:!1,toggled:!1};constructor(t){super(t),this.state={show:t.show},this.openIconRef=P.createRef(),this.closedIconRef=P.createRef(),e.defaultProps={...e.defaultProps,showMessage:H9.t(`common:showCorrectAnswer`,{lng:t.language}),hideMessage:H9.t(`common:hideCorrectAnswer`,{lng:t.language})}}onClick(){this.props.onToggle(!this.props.toggled)}onTouch(e){e.preventDefault(),this.props.onToggle(!this.props.toggled)}UNSAFE_componentWillReceiveProps(t){this.setState({show:t.show}),t.language!==this.props?.language&&(e.defaultProps={...e.defaultProps,showMessage:H9.t(`common:showCorrectAnswer`,{lng:t.language}),hideMessage:H9.t(`common:hideCorrectAnswer`,{lng:t.language})})}render(){let{className:e,toggled:t,hideMessage:n,showMessage:r}=this.props;return(0,F.jsx)(ote,{className:e,children:(0,F.jsx)(L9,{show:this.state.show,children:(0,F.jsxs)(ste,{onClick:this.onClick.bind(this),onTouchEnd:this.onTouch.bind(this),children:[(0,F.jsxs)(lte,{children:[(0,F.jsx)(Hs,{nodeRef:this.openIconRef,timeout:400,in:t,exit:!t,classNames:{enter:`enter`,enterActive:`enter-active`,exit:`exit`,exitActive:`exit-active`},children:(0,F.jsx)(U9,{ref:this.openIconRef,children:(0,F.jsx)(Ko,{open:t},`correct-open`)})}),(0,F.jsx)(Hs,{nodeRef:this.closedIconRef,timeout:5e3,in:!t,exit:t,classNames:{enter:`enter`,enterActive:`enter-active`,exit:`exit`,exitActive:`exit-active`},children:(0,F.jsx)(U9,{ref:this.closedIconRef,children:(0,F.jsx)(Ko,{open:t},`correct-closed`)})})]}),(0,F.jsx)(rte,{false:!0,children:(0,F.jsx)(cte,{"aria-hidden":!this.state.show,children:t?n:r})})]})})})}};function W9(e){return typeof e==`function`||typeof e==`object`&&!!e&&typeof e.$$typeof==`symbol`}function G9(e,t){return!e||W9(e)?e:W9(e.default)?e.default:t&&W9(e[t])?e[t]:t&&W9(e[t]?.default)?e[t].default:e}var dte=G9(Sf,`UiLayout`)||G9(X9.UiLayout,`UiLayout`),K9=G9($f,`PreviewPrompt`)||G9(X9.PreviewPrompt,`PreviewPrompt`),q9=G9(yd,`Collapsible`)||G9(X9.Collapsible,`Collapsible`),J9=Op,Y9=J9.default,X9=Y9&&typeof Y9==`object`?Y9:J9,fte=R(dte)({color:Il(),backgroundColor:iu(),overflowX:`scroll`,overflowY:`hidden`}),Z9=R(Xee)(({theme:e})=>({marginTop:e.spacing(2),marginBottom:e.spacing(2)})),pte=R(q9)(({theme:e})=>({marginBottom:e.spacing(2)})),mte=class extends P.Component{static propTypes={model:v.object.isRequired,onAnswersChange:v.func,categories:v.array};constructor(e){super(e),this.state={categories:e.categories||e.model.data,showingCorrect:!1}}componentDidUpdate(e){zp(e.categories,this.props.categories)?zp(e.model.data,this.props.model.data)||this.setState({categories:this.props.model.data}):this.setState({categories:this.props.categories})}changeData=e=>this.setState({categories:e},()=>this.props.onAnswersChange(e));toggleCorrect=e=>this.setState({showingCorrect:e});render(){let{categories:e,showingCorrect:t}=this.state,{model:n}=this.props,{teacherInstructions:r,prompt:i,chartType:a,size:o,domain:s,range:c,title:l,addCategoryEnabled:u,studentNewCategoryDefaultLabel:d,showToggle:f,rationale:p,correctAnswer:m,language:h,env:g,showKeyLegend:_}=n,{correctedAnswer:v,extraCSSRules:y}=n,b=(m?.data||[]).map(e=>({...e,interactive:!1,editable:!1})),{mode:x}=g||{};x===`view`&&(v=(v||[]).map(e=>({...e,editable:!1})));let S=n.rationale&&(ip(n.rationale)||op(n.rationale)),C=n.teacherInstructions&&(ip(n.teacherInstructions)||op(n.teacherInstructions));return(0,F.jsxs)(fte,{extraCSSRules:y,children:[C&&(0,F.jsx)(pte,{labels:{hidden:`Show Teacher Instructions`,visible:`Hide Teacher Instructions`},children:(0,F.jsx)(K9,{prompt:r})}),i&&(0,F.jsx)(K9,{className:`prompt`,prompt:i}),(0,F.jsx)(ute,{show:f,toggled:t,onToggle:this.toggleCorrect,language:h}),t&&f?(0,F.jsx)(Z9,{chartType:a,size:o,domain:s,range:c,charts:[P7.Bar(),P7.Histogram(),P7.LineDot(),P7.LineCross(),P7.DotPlot(),P7.LinePlot()],data:b||e,title:l,onDataChange:this.changeData,addCategoryEnabled:!1,categoryDefaultLabel:d,language:h,labelsPlaceholders:{}}):(0,F.jsx)(Z9,{chartType:a,size:o,domain:s,range:c,charts:[P7.Bar(),P7.Histogram(),P7.LineDot(),P7.LineCross(),P7.DotPlot(),P7.LinePlot()],data:v||e,title:l,onDataChange:this.changeData,addCategoryEnabled:u,categoryDefaultLabel:d,language:h,labelsPlaceholders:{},correctData:f?b:void 0}),!t&&_&&(0,F.jsx)(F9,{language:h}),S&&(0,F.jsx)(q9,{labels:{hidden:`Show Rationale`,visible:`Hide Rationale`},children:(0,F.jsx)(K9,{prompt:p})})]})}},Q9=class e extends CustomEvent{static{this.TYPE=`model-set`}constructor(t,n,r){super(e.TYPE,{bubbles:!0,composed:!0,detail:{complete:n,component:t,hasModel:r}}),this.component=t,this.complete=n}},hte=class e extends CustomEvent{static{this.TYPE=`session-changed`}constructor(t,n){super(e.TYPE,{bubbles:!0,composed:!0,detail:{complete:n,component:t}}),this.component=t,this.complete=n}},gte=g(),$9=class extends HTMLElement{constructor(){super(),this._root=null,this._mathObserver=null,this._mathRenderPending=!1}_scheduleMathRender=()=>{this._mathRenderPending||(this._mathRenderPending=!0,requestAnimationFrame(()=>{this._mathObserver&&this._mathObserver.disconnect(),hd(this),this._mathRenderPending=!1,setTimeout(()=>{this._mathObserver&&this._mathObserver.observe(this,{childList:!0,subtree:!0})},50)}))};_initMathObserver(){this._mathObserver||(this._mathObserver=new MutationObserver(this._scheduleMathRender),this._mathObserver.observe(this,{childList:!0,subtree:!0}))}_disconnectMathObserver(){this._mathObserver&&=(this._mathObserver.disconnect(),null)}set model(e){this._model=e,this._session&&this.isComplete(this._session.answer)?this.dispatchEvent(new Q9(this.tagName.toLowerCase(),!0,!!this._model)):this.dispatchEvent(new Q9(this.tagName.toLowerCase(),!1,!!this._model)),this._render()}set session(e){this._session=e,this._render()}get session(){return this._session}connectedCallback(){this._initMathObserver(),this._render()}isComplete=e=>Array.isArray(e)&&e.length>0;changeAnswers=e=>{this._session.answer=e,this.dispatchEvent(new hte(this.tagName.toLowerCase(),this.isComplete(this._session.answer))),this._render()};_render(){if(!this._model||!this._session)return;this._initMathObserver();let e={...this._model,data:this._model.data?[...this._model.data]:this._model.data},t=P.createElement(mte,{model:e,categories:this._session.answer,onAnswersChange:this.changeAnswers});this._root||=(0,gte.createRoot)(this),this._root.render(t)}disconnectedCallback(){this._disconnectMathObserver(),this._root&&=(this._root.unmount(),null)}};return typeof window<`u`&&!customElements.get(`charting-element`)&&customElements.define(`charting-element`,$9),$9})();
|