digi-mathchem-editor 1.0.28 → 1.0.29

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.
@@ -7538,6 +7538,20 @@ const Z = "data-mathfield-shadow-styles", ot = `
7538
7538
  overflow: visible !important;
7539
7539
  contain: none !important;
7540
7540
  }
7541
+ .ML__notation {
7542
+ position: absolute !important;
7543
+ line-height: 0 !important;
7544
+ box-sizing: border-box !important;
7545
+ }
7546
+ .ML__notation svg {
7547
+ position: absolute !important;
7548
+ overflow: visible !important;
7549
+ top: 0 !important;
7550
+ left: 0 !important;
7551
+ width: 100% !important;
7552
+ height: 100% !important;
7553
+ pointer-events: none !important;
7554
+ }
7541
7555
  .wide-circle {
7542
7556
  display: inline-block !important;
7543
7557
  transform: scaleX(1.5) !important;
@@ -7978,7 +7992,7 @@ class dt {
7978
7992
  this.close();
7979
7993
  }
7980
7994
  }
7981
- const mt = "1.0.28", E = {
7995
+ const mt = "1.0.29", E = {
7982
7996
  version: mt
7983
7997
  };
7984
7998
  typeof window < "u" && (window.MathfieldElement ? window.MathfieldElement.fontsDirectory = "https://cdn.jsdelivr.net/npm/mathlive/dist/fonts" : V && (V.fontsDirectory = "https://cdn.jsdelivr.net/npm/mathlive/dist/fonts"));
@@ -91,6 +91,20 @@
91
91
  overflow: visible !important;
92
92
  contain: none !important;
93
93
  }
94
+ .ML__notation {
95
+ position: absolute !important;
96
+ line-height: 0 !important;
97
+ box-sizing: border-box !important;
98
+ }
99
+ .ML__notation svg {
100
+ position: absolute !important;
101
+ overflow: visible !important;
102
+ top: 0 !important;
103
+ left: 0 !important;
104
+ width: 100% !important;
105
+ height: 100% !important;
106
+ pointer-events: none !important;
107
+ }
94
108
  .wide-circle {
95
109
  display: inline-block !important;
96
110
  transform: scaleX(1.5) !important;
@@ -393,4 +407,4 @@
393
407
  .ML__latex, .ML__content, .ML__container, .ML__virtual-keyboard-toggle { cursor: pointer !important; }
394
408
  `:""}
395
409
  ${X}
396
- `)}function ot(){document.querySelectorAll("math-field").forEach(N)}let U=null;function K(){U||(ot(),U=new MutationObserver(n=>{var t,e,r;for(const s of n){if(s.type==="attributes"&&((t=s.target.tagName)==null?void 0:t.toLowerCase())==="math-field"){N(s.target);continue}if(s.addedNodes)for(const o of s.addedNodes)o instanceof Element&&(((e=o.tagName)==null?void 0:e.toLowerCase())==="math-field"&&requestAnimationFrame(()=>N(o)),(r=o.querySelectorAll)==null||r.call(o,"math-field").forEach(l=>requestAnimationFrame(()=>N(l))))}}),U.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["read-only","readonly"]}))}const W=[{id:"All",name:"All"},{id:"Symbol",name:"Symbol",ranges:[[8704,8959],[9728,9983],[8592,8703],[9984,10175]]},{id:"Punctuation",name:"Punctuation",ranges:[[33,47],[58,64],[91,96],[123,126],[161,161],[171,171],[187,187],[191,191],[8208,8231],[8240,8286],[10088,10101],[10214,10223],[10627,10648],[11776,11903],[12288,12351],[65104,65135],[65281,65295],[65306,65312],[65339,65344],[65371,65381]]},{id:"Letter",name:"Letter",ranges:[[65,90],[97,122],[880,1023],[1024,1279]]},{id:"Mark",name:"Mark",ranges:[[169,169],[174,174],[8224,8231],[8240,8286],[8471,8471],[8482,8482],[9744,9746],[10003,10008],[10013,10017],[10018,10059],[10067,10074],[10081,10087],[10132,10174],[128500,128505]]},{id:"Number",name:"Number",ranges:[[48,57],[8304,8351],[8528,8591],[9312,9471],[10102,10131],[65296,65305],[120782,120831]]},{id:"Phonetic",name:"Phonetic",ranges:[[592,687],[688,767],[7424,7551],[7552,7615],[43824,43887]]},{id:"Other",name:"Other",ranges:[[8352,8399],[8448,8527],[8960,9215],[9472,9599],[9600,9631],[9632,9727],[10240,10495],[11008,11263]]}],at=(()=>{const n=[];return W.slice(1).forEach(t=>{t.ranges.forEach(e=>{for(let r=e[0];r<=e[1];r++){if(r>=127&&r<=159)continue;const s=String.fromCodePoint(r);new RegExp("\\p{C}","u").test(s)||n.push({code:r.toString(16).toUpperCase().padStart(4,"0"),char:s,category:t.id})}})}),n})();class G{constructor(t={}){this.onInsert=t.onInsert||(()=>{}),this.onClose=t.onClose||(()=>{}),this.isOpen=!1,this.searchCode="",this.selectedCategory="All",this.overlay=null,this.modal=null,this.bodyContainer=null,this.boundKeyDown=this.handleKeyDown.bind(this)}open(t=null){this.isOpen||(this.isOpen=!0,this.searchCode="",this.selectedCategory="All",this.render(t),window.addEventListener("keydown",this.boundKeyDown))}close(){this.isOpen&&(this.isOpen=!1,window.removeEventListener("keydown",this.boundKeyDown),this.overlay&&this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay),this.overlay=null,this.onClose())}handleKeyDown(t){t.key==="Escape"&&this.close()}getFilteredCharacters(){let t=at;if(this.selectedCategory!=="All"&&(t=t.filter(e=>e.category===this.selectedCategory)),this.searchCode.trim()){const e=this.searchCode.trim().toUpperCase();t=t.filter(r=>r.code.includes(e))}return t}getGroupedCharacters(t){if(this.selectedCategory!=="All"&&!this.searchCode.trim())return{[this.selectedCategory]:t};const e={};return t.forEach(r=>{e[r.category]||(e[r.category]=[]),e[r.category].push(r)}),e}render(t){if(this.overlay&&this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay),this.overlay=document.createElement("div"),this.overlay.className="scm-overlay",this.overlay.addEventListener("mousedown",l=>{l.stopPropagation(),this.close()}),this.modal=document.createElement("div"),this.modal.className="scm-modal",this.modal.addEventListener("mousedown",l=>l.stopPropagation()),t){let l=t.x-120,a=t.y;l<10&&(l=10),l+230>window.innerWidth&&(l=window.innerWidth-240),a+200>window.innerHeight&&(a=window.innerHeight-210),this.modal.style.top=`${a}px`,this.modal.style.left=`${l}px`,this.modal.style.transform="none"}else this.modal.style.top="50%",this.modal.style.left="50%",this.modal.style.transform="translate(-50%, -50%)";const e=document.createElement("div");e.className="scm-toolbar";const r=document.createElement("input");r.type="text",r.placeholder="Code",r.className="scm-code-input",r.value=this.searchCode,r.addEventListener("input",l=>{this.searchCode=l.target.value,this.updateGrid()});const s=document.createElement("select");s.className="scm-category-select",W.forEach(l=>{const a=document.createElement("option");a.value=l.id,a.textContent=l.name,s.appendChild(a)}),s.value=this.selectedCategory,s.addEventListener("change",l=>{this.selectedCategory=l.target.value,this.updateGrid()}),e.appendChild(r),e.appendChild(s),this.modal.appendChild(e);const o=document.createElement("div");o.className="scm-body",this.bodyContainer=document.createElement("div"),this.bodyContainer.className="scm-grid-container",o.appendChild(this.bodyContainer),this.modal.appendChild(o),this.updateGrid(),this.overlay.appendChild(this.modal),document.body.appendChild(this.overlay),setTimeout(()=>r.focus(),50)}updateGrid(){if(!this.bodyContainer)return;this.bodyContainer.innerHTML="";const t=this.getFilteredCharacters(),e=this.getGroupedCharacters(t),r=Object.entries(e);if(r.length===0||t.length===0){const s=document.createElement("div");s.className="scm-no-results",s.textContent="No characters found.",this.bodyContainer.appendChild(s);return}r.forEach(([s,o])=>{const l=document.createElement("div");l.className="scm-category-group";const a=document.createElement("div");a.className="scm-char-grid",o.forEach(h=>{const c=document.createElement("button");c.type="button",c.className="scm-char-btn",c.title=`U+${h.code}`,c.textContent=h.char,c.addEventListener("click",g=>{g.preventDefault(),this.onInsert(h.char),this.close()}),a.appendChild(c)}),l.appendChild(a),this.bodyContainer.appendChild(l)})}destroy(){this.close()}}const A={version:"1.0.28"};typeof window<"u"&&(window.MathfieldElement?window.MathfieldElement.fontsDirectory="https://cdn.jsdelivr.net/npm/mathlive/dist/fonts":v.MathfieldElement&&(v.MathfieldElement.fontsDirectory="https://cdn.jsdelivr.net/npm/mathlive/dist/fonts"));const O=class O{constructor(t={}){this.version=O.VERSION,this.options=t,this.onInsert=t.onInsert||(()=>{}),this.onClose=t.onClose||(()=>{}),this.mode=t.mode||"math",this.title=t.title||null,this.isOpen=!1,this.isEditing=!1,this.initialLatex="",this.activeGroup=0,this.explicitToggle=!1,this.activeStyles={bold:!1,italic:!1,fontFamily:"none",fontSize:"auto",color:"none"},this.isMaximized=!1,this.isMinimized=!1,this.position={x:0,y:0},this.isDragging=!1,this.dragStart={x:0,y:0},this.popup=null,this.mathField=null,this.tabsWrapper=null,this.itemsWrapper=null,this.activeDropdown=null,this.activeDropdownBtn=null,this.activeMatrixPopup=null,this.activeMatrixBtn=null,this.colorPickerPopup=null,this.activeColorBtn=null,this.specCharModal=null,this.boundKeyDown=this.handleGlobalKeyDown.bind(this),this.boundDocClick=this.handleDocumentClick.bind(this),this.boundMouseMove=this.handleMouseMove.bind(this),this.boundMouseUp=this.handleMouseUp.bind(this),this.boundTouchMove=this.handleTouchMove.bind(this),this.boundTouchEnd=this.handleMouseUp.bind(this),this.boundResize=this.handleWindowResize.bind(this)}getGroups(){return this.mode==="chem"?$:_}setMode(t){if(!(!t||t===this.mode)&&(this.mode=t,this.activeGroup=0,this.explicitToggle=!1,this.closeAllPopups(),this.specCharModal&&this.specCharModal.close(),this.isOpen&&this.popup)){const e=this.popup.querySelector(".cme-popup-header span");if(e){const r=this.title||(this.isEditing?this.mode==="chem"?"Edit Chemistry Formula":"Edit Math Formula":this.mode==="chem"?"Chemistry Editor":"Math Editor");e.textContent=r}this.renderTabs(),this.renderToolbarItems()}}open(t="",e=null){if(this.isOpen){e&&e!==this.mode&&this.setMode(e),this.setValue(t||""),this.initialLatex=t||"",this.isEditing=!!t;return}this.isOpen=!0,this.position={x:0,y:0},this.isDragging=!1,this.isMaximized=!1,this.isMinimized=!1,this.initialLatex=t||"",this.isEditing=!!t,e&&(this.mode=e),this.activeGroup=0,this.explicitToggle=!1,this.activeStyles={bold:!1,italic:!1,fontFamily:"none",fontSize:"auto",color:"none"},this.render(),window.addEventListener("keydown",this.boundKeyDown),document.addEventListener("mousedown",this.boundDocClick,!0),document.addEventListener("pointerdown",this.boundDocClick,!0),window.addEventListener("mousemove",this.boundMouseMove),window.addEventListener("mouseup",this.boundMouseUp),window.addEventListener("touchmove",this.boundTouchMove,{passive:!1}),window.addEventListener("touchend",this.boundTouchEnd),window.addEventListener("resize",this.boundResize)}close(){this.isOpen&&(this.isOpen=!1,window.removeEventListener("keydown",this.boundKeyDown),document.removeEventListener("mousedown",this.boundDocClick,!0),document.removeEventListener("pointerdown",this.boundDocClick,!0),window.removeEventListener("mousemove",this.boundMouseMove),window.removeEventListener("mouseup",this.boundMouseUp),window.removeEventListener("touchmove",this.boundTouchMove),window.removeEventListener("touchend",this.boundTouchEnd),window.removeEventListener("resize",this.boundResize),this.closeAllPopups(),this.specCharModal&&this.specCharModal.close(),this.popup&&this.popup.parentNode&&this.popup.parentNode.removeChild(this.popup),this.popup=null,this.mathField=null,this.onClose())}getValue(){if(!this.mathField)return"";const t=this.mathField.getValue?this.mathField.getValue("latex"):this.mathField.value||"";return st(t)}setValue(t){if(!this.mathField)return;const e=t||"";try{typeof this.mathField.setValue=="function"?this.mathField.setValue(e):this.mathField.textContent=e}catch{this.mathField.textContent=e}}handleGlobalKeyDown(t){if(t.key==="Escape"){if(this.activeDropdown||this.activeMatrixPopup||this.colorPickerPopup){this.closeAllPopups();return}this.close();return}t.key==="Enter"&&(t.ctrlKey||t.metaKey)&&(t.preventDefault(),this.handleInsert())}handleDocumentClick(t){if(!this.popup)return;const e=t.composedPath?t.composedPath():[];this.activeDropdown&&(this.activeDropdown===t.target||this.activeDropdown.contains(t.target)||e.includes(this.activeDropdown)||this.activeDropdownBtn&&(this.activeDropdownBtn===t.target||this.activeDropdownBtn.contains(t.target)||e.includes(this.activeDropdownBtn))||this.closeDropdown()),this.activeMatrixPopup&&(this.activeMatrixPopup===t.target||this.activeMatrixPopup.contains(t.target)||e.includes(this.activeMatrixPopup)||this.activeMatrixBtn&&(this.activeMatrixBtn===t.target||this.activeMatrixBtn.contains(t.target)||e.includes(this.activeMatrixBtn))||this.closeMatrixPopup()),this.colorPickerPopup&&(this.colorPickerPopup===t.target||this.colorPickerPopup.contains(t.target)||e.includes(this.colorPickerPopup)||this.activeColorBtn&&(this.activeColorBtn===t.target||this.activeColorBtn.contains(t.target)||e.includes(this.activeColorBtn))||this.closeColorPicker())}handleInsert(){let t=this.getValue();t=tt(t),t=et(t),t=rt(t),this.mode==="chem"&&(t.includes("\\displaylines")||t.includes("\\\\")||t.includes("\\class{cme-")||t.includes("\\xleftrightarrows")||t.includes("\\xleftrightharpoons")||t.includes("\\enclose")||t.includes("\\{")||t.includes("\\}")||t.includes("\\lbrace")||t.includes("\\rbrace")?/^\\ce\{[\s\S]*\}$/i.test(t.trim())&&(t=t.trim().replace(/^\\ce\{([\s\S]*)\}$/i,"$1")):t.trim()&&!t.trim().startsWith("\\ce{")&&!t.includes("\\ce{")&&(t=`\\ce{${t}}`)),this.onInsert(t),this.close()}insertAtCursor(t){if(this.closeAllPopups(),!this.mathField)return;const e=this.mathField;if(e.smartSuperscript=!1,e.focus(),typeof t=="string"){const r=D(t,this.activeStyles.bold,this.activeStyles.italic,this.activeStyles.fontFamily);e.executeCommand?e.executeCommand(["insert",r,{selectionMode:"placeholder"}]):e.insert(r)}else if(t&&t.insert){const r=t.action==="INSERT_CUSTOM"||t.directInsert?D(t.insert,this.activeStyles.bold,this.activeStyles.italic,this.activeStyles.fontFamily):t.insert;e.executeCommand?e.executeCommand(["insert",r,{selectionMode:"placeholder"}]):e.insert(r)}}getInsertStyle(){const t={};return this.activeStyles.bold&&this.activeStyles.italic?(t.variant="main",t.variantStyle="bolditalic"):this.activeStyles.bold?(t.variant="normal",t.variantStyle="bold"):this.activeStyles.italic&&(t.variant="main",t.variantStyle="italic"),this.activeStyles.fontFamily&&this.activeStyles.fontFamily!=="none"&&(t.fontFamily=this.activeStyles.fontFamily),this.activeStyles.color&&this.activeStyles.color!=="none"&&(t.color=this.activeStyles.color),t}isAllSelected(t){if(!t||t.selectionIsCollapsed)return!1;try{const e=t.model,r=(e==null?void 0:e.selection)||t.selection;if(r){const s=r.ranges||(Array.isArray(r)?[r]:[]);if(s.length>0){let o=1/0,l=-1/0;for(const h of s)Array.isArray(h)&&(o=Math.min(o,h[0],h[1]),l=Math.max(l,h[0],h[1]));const a=(e==null?void 0:e.lastOffset)||1;if(o<=1&&l>=a)return!0}}}catch{}return!1}getSelectionLatex(t){if(!t)return"";try{if(this.isAllSelected(t))return t.getValue()||t.value||"";if(t.selection){const e=t.getValue(t.selection);if(typeof e=="string")return e}}catch{}try{if(t.model&&t.model.selection){const e=t.getValue(t.model.selection);if(typeof e=="string")return e}}catch{}try{const e=t.getValue("latex-selection");if(typeof e=="string")return e}catch{}return""}checkSelectionBold(t){if(!t)return!1;if(!t.selectionIsCollapsed){const e=this.getSelectionLatex(t);if(e&&e.trim()&&/\\mathbfit\{|\\mathbf\{|\\boldsymbol\{|\\textbf\{|\\bold\{|\\bm\{|\\pmb\{/.test(e.trim()))return!0}try{if(typeof t.queryStyle=="function"){const e=t.queryStyle({variantStyle:"bold"}),r=t.queryStyle({variantStyle:"bolditalic"}),s=t.queryStyle({fontSeries:"b"});if(e==="all"||e==="some"||r==="all"||r==="some"||s==="all"||s==="some")return!0}}catch{}try{const e=t.model;if(e&&!t.selectionIsCollapsed&&(e.selection||t.selection)){const r=e.selection||t.selection,s=e.getAtoms(r,{includeChildren:!0});if(s&&s.length>0&&s.some(l=>{if(!l||l.type==="first")return!1;const a=l.style;return a?a.variantStyle==="bold"||a.variantStyle==="bolditalic"||a.fontSeries==="b"||a.variant==="bold":!1}))return!0}}catch{}return!1}checkSelectionItalic(t){if(!t)return!1;if(!t.selectionIsCollapsed){const e=this.getSelectionLatex(t);if(e&&e.trim()&&/\\mathbfit\{|\\mathit\{|\\textit\{|\\textsl\{|\\slshape\{/.test(e.trim()))return!0}try{if(typeof t.queryStyle=="function"){const e=t.queryStyle({variantStyle:"italic"}),r=t.queryStyle({variantStyle:"bolditalic"}),s=t.queryStyle({fontShape:"it"});if(e==="all"||e==="some"||r==="all"||r==="some"||s==="all"||s==="some")return!0}}catch{}try{const e=t.model;if(e&&!t.selectionIsCollapsed&&(e.selection||t.selection)){const r=e.selection||t.selection,s=e.getAtoms(r,{includeChildren:!0});if(s&&s.length>0&&s.some(l=>{if(!l||l.type==="first")return!1;const a=l.style;return a?a.variantStyle==="italic"||a.variantStyle==="bolditalic"||a.fontShape==="it":!1}))return!0}}catch{}return!1}updateStylesFromSelection(){const t=this.mathField;if(t)if(t.selectionIsCollapsed){if(this.explicitToggle)return;let e=!1;this.activeStyles.bold&&(this.activeStyles.bold=!1,e=!0),this.activeStyles.italic&&(this.activeStyles.italic=!1,e=!0),e&&this.renderToolbarItems()}else{this.explicitToggle=!1;const e=this.checkSelectionBold(t),r=this.checkSelectionItalic(t);let s=!1;this.activeStyles.bold!==e&&(this.activeStyles.bold=e,s=!0),this.activeStyles.italic!==r&&(this.activeStyles.italic=r,s=!0),s&&this.renderToolbarItems()}}render(){this.popup=document.createElement("div"),this.popup.className="cme-editor-popup"+(this.isMaximized?" maximized":"")+(this.isMinimized?" minimized":""),this.popup.addEventListener("mousedown",i=>{this.handleDocumentClick(i),i.stopPropagation()}),this.popup.addEventListener("pointerdown",i=>{this.handleDocumentClick(i)});const t=document.createElement("div");t.className="cme-popup-topbar";const e=document.createElement("div");e.className="cme-popup-header",e.style.cursor="grab";const r=this.title||(this.isEditing?this.mode==="chem"?"Edit Chemistry Formula":"Edit Math Formula":this.mode==="chem"?"Chemistry Editor":"Math Editor");e.innerHTML=`<span>${r}</span>`;const s=(i,p,b)=>{b&&b.closest&&b.closest(".cme-popup-btn")||(this.closeAllPopups(),this.specCharModal&&this.specCharModal.close(),this.isDragging=!0,this.dragStart={x:i-this.position.x,y:p-this.position.y},e.style.cursor="grabbing")};e.addEventListener("mousedown",i=>{s(i.clientX,i.clientY,i.target)}),e.addEventListener("touchstart",i=>{i.touches&&i.touches.length>0&&s(i.touches[0].clientX,i.touches[0].clientY,i.target)},{passive:!0});const o=document.createElement("div");o.className="cme-popup-controls";const l=document.createElement("button");l.type="button",l.className="cme-popup-btn",l.textContent="—",l.title="Minimize",l.addEventListener("click",()=>this.toggleMinimize());const a=document.createElement("button");a.type="button",a.className="cme-popup-btn",a.textContent="⤢",a.title="Maximize",a.addEventListener("click",()=>this.toggleMaximize()),this.minBtn=l,this.maxBtn=a;const h=document.createElement("button");h.type="button",h.className="cme-popup-btn",h.textContent="✕",h.title="Close",h.addEventListener("click",()=>this.close()),o.appendChild(l),o.appendChild(a),o.appendChild(h),t.appendChild(e),t.appendChild(o),this.popup.appendChild(t);const c=document.createElement("div");c.className="cme-toolbar",c.setAttribute("role","toolbar"),c.setAttribute("aria-label","Symbol palette"),this.tabsWrapper=document.createElement("div"),this.tabsWrapper.className="cme-toolbar-groups",this.renderTabs(),c.appendChild(this.tabsWrapper),this.itemsWrapper=document.createElement("div"),this.itemsWrapper.className="cme-toolbar-items",this.renderToolbarItems(),c.appendChild(this.itemsWrapper),this.popup.appendChild(c);const g=document.createElement("div");g.className="cme-mathfield-container",g.addEventListener("mousedown",i=>{var p,b;this.explicitToggle=!1,this.closeAllPopups(),!(this.mathField&&(i.target===this.mathField||this.mathField.contains(i.target)))&&(i.preventDefault(),(b=(p=this.mathField)==null?void 0:p.focus)==null||b.call(p))}),this.mathField=document.createElement("math-field"),this.mathField.className="cme-mathfield",this.mathField.setAttribute("tabindex","0"),this.mathField.setAttribute("math-virtual-keyboard-policy","manual"),this.mathField.setAttribute("smart-superscript","false"),this.mathField.smartSuperscript=!1,this.mathField.setAttribute("math-mode-space","\\enspace"),this.mathField.mathModeSpace="\\enspace",this.mathField.onInsertStyle=()=>this.getInsertStyle(),this.mathField.addEventListener("keydown",i=>{if(i.key==="Enter"&&!i.ctrlKey&&!i.metaKey&&!i.altKey){i.preventDefault(),i.stopPropagation(),i.stopImmediatePropagation(),this.activeStyles.bold||this.activeStyles.italic||this.activeStyles.fontFamily&&this.activeStyles.fontFamily!=="none"?this.explicitToggle=!0:this.explicitToggle=!1;const m=this.mathField;m!=null&&m.executeCommand&&m.executeCommand("addRowAfter");return}if(i.key===" "||i.code==="Space"){i.preventDefault(),i.stopPropagation(),i.stopImmediatePropagation();const m=this.mathField;m.executeCommand?m.executeCommand(["insert","\\enspace ",{selectionMode:"after"}]):m.insert&&m.insert("\\enspace ");return}if(i.key==="ArrowLeft"||i.key==="ArrowRight"||i.key==="ArrowUp"||i.key==="ArrowDown"||i.key==="Home"||i.key==="End"){this.explicitToggle=!1;return}if(!this.activeStyles.bold&&!this.activeStyles.italic&&this.activeStyles.fontFamily==="none"||i.key.length!==1||i.ctrlKey||i.metaKey||i.altKey)return;i.preventDefault(),i.stopPropagation(),i.stopImmediatePropagation();const p=D(i.key,this.activeStyles.bold,this.activeStyles.italic,this.activeStyles.fontFamily),b=this.mathField;b.executeCommand?b.executeCommand(["insert",p,{selectionMode:"after"}]):b.insert&&b.insert(p)},{capture:!0});const y=()=>{this.updateStylesFromSelection()};this.mathField.addEventListener("selection-change",y),this.mathField.addEventListener("pointerup",y),this.mathField.addEventListener("keyup",y),this.mathField.addEventListener("pointerdown",()=>{this.explicitToggle=!1,this.closeAllPopups()}),this.mathField.addEventListener("focus",()=>{this.closeAllPopups()}),g.appendChild(this.mathField),this.popup.appendChild(g);const x=document.createElement("div");x.className="cme-popup-footer";const f=document.createElement("button");f.type="button",f.className="cme-insert-btn",f.textContent=this.isEditing?"Update":"Insert",f.addEventListener("click",()=>this.handleInsert());const w=document.createElement("button");w.type="button",w.className="cme-cancel-btn",w.textContent="Cancel",w.addEventListener("click",()=>this.close()),x.appendChild(f),x.appendChild(w);const k=`v${A.version}`;if(k){const i=document.createElement("span");i.className="cme-popup-version",i.textContent=k,i.title=`Version ${A.version}`,x.appendChild(i)}this.popup.appendChild(x),document.body.appendChild(this.popup),setTimeout(()=>{if(this.mathField){K();try{this.mathField.smartSuperscript=!1,this.mathField.inlineShortcuts=Object.assign({},this.mathField.inlineShortcuts||{},{"*":"*"}),typeof this.mathField.setOptions=="function"&&this.mathField.setOptions({smartSuperscript:!1,mathModeSpace:"\\enspace",onInsertStyle:()=>this.getInsertStyle(),macros:{...window.__cme_macros||{},...B}}),this.mathField.menuItems&&Array.isArray(this.mathField.menuItems)&&(this.mathField.menuItems=this.mathField.menuItems.filter(p=>p&&p.id!=="insert-matrix"&&p.submenuClass!=="insert-matrix-submenu"))}catch{}let i=this.initialLatex||"";this.mode==="chem"&&i.startsWith("\\ce{")&&i.endsWith("}")&&(i=i.slice(4,-1)),this.setValue(i),this.mathField.focus()}},50)}clampPosition(t=this.position.x,e=this.position.y){if(!this.popup)return{x:t,y:e};const r=this.popup.getBoundingClientRect(),s=r.left-this.position.x,o=r.top-this.position.y,l=r.width,a=r.height,h=window.innerWidth,c=window.innerHeight;let g=-s,y=h-s-l,x=t;g>y?x=g:x=Math.max(g,Math.min(t,y));let f=-o,w=c-o-a,k=e;return f>w?k=f:k=Math.max(f,Math.min(e,w)),{x,y:k}}handleMouseMove(t){if(!this.isDragging||!this.popup)return;this.closeAllPopups(),this.specCharModal&&this.specCharModal.close();const e=t.clientX-this.dragStart.x,r=t.clientY-this.dragStart.y;this.position=this.clampPosition(e,r),this.popup.style.transform=`translate(${this.position.x}px, ${this.position.y}px)`}handleTouchMove(t){!this.isDragging||!t.touches||t.touches.length===0||(t.cancelable&&t.preventDefault(),this.handleMouseMove(t.touches[0]))}handleWindowResize(){if(!this.popup)return;const t=this.clampPosition(this.position.x,this.position.y);(t.x!==this.position.x||t.y!==this.position.y)&&(this.position=t,this.popup.style.transform=`translate(${this.position.x}px, ${this.position.y}px)`)}handleMouseUp(){var e;this.isDragging=!1;const t=(e=this.popup)==null?void 0:e.querySelector(".cme-popup-header");t&&(t.style.cursor="grab")}updateControlButtons(){this.maxBtn&&(this.maxBtn.textContent=this.isMaximized?"⤡":"⤢",this.maxBtn.title=this.isMaximized?"Restore":"Maximize"),this.minBtn&&(this.minBtn.title=this.isMinimized?"Restore":"Minimize")}toggleMaximize(){var t,e;this.isMaximized=!this.isMaximized,this.isMaximized&&(this.isMinimized=!1,(t=this.popup)==null||t.classList.remove("minimized")),(e=this.popup)==null||e.classList.toggle("maximized",this.isMaximized),this.position={x:0,y:0},this.popup&&(this.popup.style.transform="translate(0px, 0px)"),this.updateControlButtons()}toggleMinimize(){var t,e;this.isMinimized=!this.isMinimized,this.isMinimized&&(this.isMaximized=!1,(t=this.popup)==null||t.classList.remove("maximized")),(e=this.popup)==null||e.classList.toggle("minimized",this.isMinimized),this.position={x:0,y:0},this.popup&&(this.popup.style.transform="translate(0px, 0px)"),this.updateControlButtons()}renderTabs(){if(!this.tabsWrapper)return;this.tabsWrapper.innerHTML="",this.getGroups().forEach((e,r)=>{const s=this.activeGroup===r,o=document.createElement("button");if(o.type="button",o.className="cme-group-tab"+(s?" active":""),e.mathLabel){const l=document.createElement("math-field");l.setAttribute("read-only","true"),l.setAttribute("tabindex","-1"),l.style.pointerEvents="none",l.style.background="transparent",l.style.border="none",l.style.outline="none",l.style.fontSize=e.fontSize||(e.isMatrix?"8px":"11px"),l.style.display="inline-block",l.style.width="auto",l.style.padding="0",l.style.margin="0",l.style.boxShadow="none",l.style.color=s?"#333333":"#ffffff",l.textContent=e.mathLabel,o.appendChild(l)}else typeof e.label=="string"&&e.label.includes("<svg")?o.innerHTML=e.label:o.textContent=e.label;o.addEventListener("mousedown",l=>{l.preventDefault(),this.activeGroup=r,this.closeAllPopups(),this.renderTabs(),this.renderToolbarItems()}),this.tabsWrapper.appendChild(o)})}renderToolbarItems(){if(!this.itemsWrapper)return;this.itemsWrapper.innerHTML="";const e=this.getGroups()[this.activeGroup]||{items:[]},r=e.items||[],s=r.some(l=>l.type==="sep"),o=[];if(s){let l={cols:2,small:!1,cls:"",items:[],moreItems:null,moreCols:1};for(const a of r)a.type==="sep"?(l.items.length>0&&o.push(l),l={cols:a.cols||2,small:!!a.small,cls:a.cls||"",items:[],moreItems:a.moreItems||null,moreCols:a.moreCols||1}):l.items.push(a);l.items.length>0&&o.push(l)}else for(let a=0;a<r.length;a+=4)o.push({cols:2,small:!1,cls:"",items:r.slice(a,a+4)});o.forEach(l=>{const a=document.createElement("div");if(a.className="cme-symbol-subgroup"+(l.small?" cme-symbol-subgroup--small":"")+(l.cls?` ${l.cls}`:"")+(l.moreItems?" cme-subgroup-has-more":""),a.style.gridTemplateColumns=`repeat(${l.cols}, auto)`,a.style.position="relative",l.moreItems){const h=document.createElement("button");h.type="button",h.className="cme-more-trigger-btn",h.title="More",h.textContent="▶",h.addEventListener("mousedown",c=>c.preventDefault()),h.addEventListener("click",c=>{if(c.stopPropagation(),this.activeDropdown&&this.activeDropdownBtn===h)this.closeDropdown();else{const g=h.getBoundingClientRect();this.openDropdown(l.moreItems,g,l.moreCols||4,h)}}),a.appendChild(h)}l.items.forEach(h=>{if(h.type==="dropdown"){const k=h.label==="Font...",i=h.label==="Size",p=document.createElement("select");p.className="cme-select"+(k?" cme-select-font":"")+(i?" cme-select-size":"")+(k&&this.activeStyles.fontFamily!=="none"||i&&this.activeStyles.fontSize!=="auto"?" active":""),k?([{id:"none",label:"Font..."},{id:"roman",label:"Roman"},{id:"sans-serif",label:"Sans-Serif"},{id:"monospace",label:"Monospace"}].forEach(b=>{const m=document.createElement("option");m.value=b.id,m.textContent=b.label,p.appendChild(m)}),p.value=this.activeStyles.fontFamily,p.addEventListener("change",b=>{var m;this.activeStyles.fontFamily=b.target.value,(m=this.mathField)!=null&&m.applyStyle&&this.mathField.applyStyle({fontFamily:this.activeStyles.fontFamily==="none"?"none":this.activeStyles.fontFamily}),this.renderToolbarItems()})):i&&([{id:"auto",label:"Size"},{id:"1",label:"Tiny"},{id:"3",label:"Small"},{id:"5",label:"Normal"},{id:"7",label:"Large"},{id:"9",label:"Huge"}].forEach(b=>{const m=document.createElement("option");m.value=b.id,m.textContent=b.label,p.appendChild(m)}),p.value=this.activeStyles.fontSize,p.addEventListener("change",b=>{var m;if(this.activeStyles.fontSize=b.target.value,(m=this.mathField)!=null&&m.applyStyle){const S=this.activeStyles.fontSize==="auto"?"none":parseInt(this.activeStyles.fontSize,10);this.mathField.applyStyle({fontSize:S})}this.renderToolbarItems()})),a.appendChild(p);return}const c=h.action==="BOLD",g=h.action==="ITALIC",y=h.action==="TEXT_COLOR",x=h.action==="SPECIAL_CHARS",f=c&&this.activeStyles.bold||g&&this.activeStyles.italic||y&&this.activeStyles.color!=="none",w=document.createElement("button");w.type="button",w.className="cme-btn"+(e.isTemplate?" template":"")+(h.cls?` ${h.cls}`:"")+(f?" active":""),w.title=h.title||h.label||h.insert||"",typeof h.label=="string"&&(h.label.includes("<svg")||h.label.includes("<img")||h.label.includes("<strong")||h.label.includes("<em"))?w.innerHTML=h.label:typeof h.label=="string"&&(w.textContent=h.label),w.addEventListener("mousedown",k=>{var p,b,m,S,d,T,E,M,L,H;k.preventDefault();const i=this.mathField;if(x){this.closeAllPopups();const C=w.getBoundingClientRect();this.openSpecialCharacters(C)}else if(y)if(this.colorPickerPopup&&this.activeColorBtn===w)this.closeColorPicker();else{const C=w.getBoundingClientRect();this.openColorPicker(C,w)}else if(c){if(this.closeAllPopups(),this.explicitToggle=!0,this.activeStyles.bold=!this.activeStyles.bold,i){if(i.selectionIsCollapsed)this.activeStyles.bold||(i.styleBias="none",i.defaultStyle&&(delete i.defaultStyle.variantStyle,delete i.defaultStyle.fontSeries));else{const C=this.getSelectionLatex(i);if(C&&C.trim()){const F=z(C.trim()),I=D(F,this.activeStyles.bold,this.activeStyles.italic,this.activeStyles.fontFamily);if(this.activeStyles.bold||(i.styleBias="none",i.defaultStyle&&(delete i.defaultStyle.variantStyle,delete i.defaultStyle.fontSeries)),this.isAllSelected(i)?(i.setValue(I),i.executeCommand?i.executeCommand("selectAll"):(p=i.model)!=null&&p.setSelection&&i.model.setSelection(0,i.model.lastOffset)):i.executeCommand?i.executeCommand(["insert",I,{selectionMode:"item"}]):i.insert&&i.insert(I,{selectionMode:"item"}),!this.activeStyles.bold&&i.applyStyle)try{i.applyStyle({variantStyle:this.activeStyles.italic?"italic":"",fontSeries:"auto"},{operation:"set"})}catch{}}}i.focus()}this.renderToolbarItems()}else if(g){if(this.closeAllPopups(),this.explicitToggle=!0,this.activeStyles.italic=!this.activeStyles.italic,i){if(i.selectionIsCollapsed)this.activeStyles.italic||(i.styleBias="none",i.defaultStyle&&(delete i.defaultStyle.variantStyle,delete i.defaultStyle.fontShape));else{const C=this.getSelectionLatex(i);if(C&&C.trim()){const F=z(C.trim()),I=D(F,this.activeStyles.bold,this.activeStyles.italic,this.activeStyles.fontFamily);if(this.activeStyles.italic||(i.styleBias="none",i.defaultStyle&&(delete i.defaultStyle.variantStyle,delete i.defaultStyle.fontShape)),this.isAllSelected(i)?(i.setValue(I),i.executeCommand?i.executeCommand("selectAll"):(b=i.model)!=null&&b.setSelection&&i.model.setSelection(0,i.model.lastOffset)):i.executeCommand?i.executeCommand(["insert",I,{selectionMode:"item"}]):i.insert&&i.insert(I,{selectionMode:"item"}),!this.activeStyles.italic&&i.applyStyle)try{i.applyStyle({variantStyle:this.activeStyles.bold?"bold":"",fontShape:"auto"},{operation:"set"})}catch{}}}i.focus()}this.renderToolbarItems()}else if(h.action==="UNDO")this.closeAllPopups(),(m=i==null?void 0:i.executeCommand)==null||m.call(i,"undo");else if(h.action==="REDO")this.closeAllPopups(),(S=i==null?void 0:i.executeCommand)==null||S.call(i,"redo");else if(h.action==="CUT")this.closeAllPopups(),(d=i==null?void 0:i.focus)==null||d.call(i),(T=i==null?void 0:i.executeCommand)==null||T.call(i,"cutToClipboard");else if(h.action==="COPY")this.closeAllPopups(),(E=i==null?void 0:i.focus)==null||E.call(i),(M=i==null?void 0:i.executeCommand)==null||M.call(i,"copyToClipboard");else if(h.action==="PASTE")this.closeAllPopups(),(L=i==null?void 0:i.focus)==null||L.call(i),(H=i==null?void 0:i.executeCommand)==null||H.call(i,"pasteFromClipboard");else if(h.action==="MATRIX_HOVER")if(this.activeMatrixPopup&&this.activeMatrixBtn===w)this.closeMatrixPopup();else{const C=w.getBoundingClientRect();this.openMatrixGrid(h.matrixType||"matrix",C,w)}else this.insertAtCursor(h)}),a.appendChild(w)}),this.itemsWrapper.appendChild(a)})}openDropdown(t,e,r,s=null){this.closeAllPopups(),this.activeDropdownBtn=s,this.activeDropdown=document.createElement("div"),this.activeDropdown.className="cme-more-popup",this.activeDropdown.style.gridTemplateColumns=`repeat(${r}, auto)`,this.activeDropdown.style.left=`${e.left+e.width/2}px`,this.activeDropdown.style.top=`${e.bottom+4}px`,this.activeDropdown.style.transform="translateX(-50%)",this.activeDropdown.addEventListener("mousedown",o=>o.stopPropagation()),this.activeDropdown.addEventListener("pointerdown",o=>o.stopPropagation()),t.forEach(o=>{const l=document.createElement("button");l.type="button",l.className="cme-more-popup-btn "+(o.cls||""),l.title=o.title||o.label||o.insert||"",typeof o.label=="string"&&(o.label.includes("<svg")||o.label.includes("<img"))?l.innerHTML=o.label:l.textContent=o.label,l.addEventListener("mousedown",a=>{a.preventDefault(),this.insertAtCursor(o.insert||o),this.closeDropdown()}),this.activeDropdown.appendChild(l)}),document.body.appendChild(this.activeDropdown)}closeDropdown(){this.activeDropdown&&this.activeDropdown.parentNode&&this.activeDropdown.parentNode.removeChild(this.activeDropdown),this.activeDropdown=null,this.activeDropdownBtn=null}openMatrixGrid(t,e,r=null){this.closeAllPopups(),this.activeMatrixBtn=r,this.activeMatrixPopup=document.createElement("div"),this.activeMatrixPopup.className="cme-matrix-hover-popover ck-only",this.activeMatrixPopup.style.left=`${e.left+e.width/2}px`,this.activeMatrixPopup.style.top=`${e.bottom+6}px`,this.activeMatrixPopup.style.minHeight="auto",this.activeMatrixPopup.addEventListener("mousedown",d=>d.stopPropagation()),this.activeMatrixPopup.addEventListener("pointerdown",d=>d.stopPropagation());const s=document.createElement("div");s.className="cme-matrix-hover-title",s.textContent=t==="matrix"?"MATRIX":`${t.toUpperCase()} MATRIX`;const o=document.createElement("div");o.className="cme-matrix-hover-grid",o.style.flex="none";let l=2,a=2;const h=document.createElement("div");h.className="cme-matrix-hover-footer";const c=document.createElement("div");c.className="cme-matrix-counter";const g=document.createElement("input");g.type="number",g.className="cme-counter-val",g.min="1",g.max="10",g.value=l;const y=document.createElement("div");y.className="cme-counter-btns";const x=document.createElement("button");x.type="button",x.textContent="▲";const f=document.createElement("button");f.type="button",f.textContent="▼",y.appendChild(x),y.appendChild(f);const w=document.createElement("span");w.textContent="×";const k=document.createElement("input");k.type="number",k.className="cme-counter-val",k.min="1",k.max="10",k.value=a;const i=document.createElement("div");i.className="cme-counter-btns";const p=document.createElement("button");p.type="button",p.textContent="▲";const b=document.createElement("button");b.type="button",b.textContent="▼",i.appendChild(p),i.appendChild(b),c.appendChild(g),c.appendChild(y),c.appendChild(w),c.appendChild(k),c.appendChild(i);const m=document.createElement("button");m.type="button",m.className="cme-matrix-insert-btn",m.textContent="INSERT",h.appendChild(c),h.appendChild(m);const S=(d,T)=>{l=Math.max(1,Math.min(10,d)),a=Math.max(1,Math.min(10,T)),g.value=l,k.value=a,o.querySelectorAll(".cme-matrix-hover-cell").forEach(M=>{const L=parseInt(M.dataset.row,10),H=parseInt(M.dataset.col,10);L<=l&&H<=a?M.classList.add("selected"):M.classList.remove("selected")})};for(let d=1;d<=5;d++){const T=document.createElement("div");T.className="cme-matrix-hover-row";for(let E=1;E<=10;E++){const M=document.createElement("div");M.className="cme-matrix-hover-cell"+(d<=l&&E<=a?" selected":""),M.dataset.row=d,M.dataset.col=E,M.addEventListener("mouseenter",()=>{S(d,E)}),M.addEventListener("click",L=>{L.stopPropagation(),this.insertMatrix(t,d,E),this.closeMatrixPopup()}),T.appendChild(M)}o.appendChild(T)}g.addEventListener("input",()=>{const d=parseInt(g.value,10)||1;S(d,a)}),k.addEventListener("input",()=>{const d=parseInt(k.value,10)||1;S(l,d)}),x.addEventListener("click",d=>{d.preventDefault(),d.stopPropagation(),S(l+1,a)}),f.addEventListener("click",d=>{d.preventDefault(),d.stopPropagation(),S(l-1,a)}),p.addEventListener("click",d=>{d.preventDefault(),d.stopPropagation(),S(l,a+1)}),b.addEventListener("click",d=>{d.preventDefault(),d.stopPropagation(),S(l,a-1)}),m.addEventListener("click",d=>{d.stopPropagation(),this.insertMatrix(t,l,a),this.closeMatrixPopup()}),this.activeMatrixPopup.appendChild(s),this.activeMatrixPopup.appendChild(o),this.activeMatrixPopup.appendChild(h),document.body.appendChild(this.activeMatrixPopup)}insertMatrix(t,e,r){let s=[];for(let a=0;a<e;a++){let h=[];for(let c=0;c<r;c++)h.push("{#?}");s.push(h.join(" & "))}const o=t||"matrix",l=`\\begin{${o}}${s.join(" \\\\ ")}\\end{${o}}`;this.insertAtCursor(l)}closeMatrixPopup(){this.activeMatrixPopup&&this.activeMatrixPopup.parentNode&&this.activeMatrixPopup.parentNode.removeChild(this.activeMatrixPopup),this.activeMatrixPopup=null,this.activeMatrixBtn=null}openColorPicker(t,e=null){this.closeAllPopups(),this.activeColorBtn=e,this.colorPickerPopup=document.createElement("div"),this.colorPickerPopup.className="cme-more-popup",this.colorPickerPopup.style.gridTemplateColumns="repeat(4, auto)",this.colorPickerPopup.style.left=`${t.left+t.width/2}px`,this.colorPickerPopup.style.top=`${t.bottom+4}px`,this.colorPickerPopup.style.transform="translateX(-50%)",this.colorPickerPopup.addEventListener("mousedown",s=>s.stopPropagation()),this.colorPickerPopup.addEventListener("pointerdown",s=>s.stopPropagation()),["black","#e53935","#1e88e5","#43a047","#fb8c00","#8e24aa","#3949ab","#00acc1"].forEach(s=>{const o=document.createElement("div");o.style.width="18px",o.style.height="18px",o.style.borderRadius="50%",o.style.margin="4px",o.style.cursor="pointer",o.style.backgroundColor=s,o.style.border=this.activeStyles.color===s?"2px solid #222":"1px solid #ddd",o.addEventListener("mousedown",l=>{var a;l.preventDefault(),this.activeStyles.color=s,(a=this.mathField)!=null&&a.applyStyle&&this.mathField.applyStyle({color:s==="black"?"none":s}),this.closeColorPicker(),this.renderToolbarItems()}),this.colorPickerPopup.appendChild(o)}),document.body.appendChild(this.colorPickerPopup)}closeColorPicker(){this.colorPickerPopup&&this.colorPickerPopup.parentNode&&this.colorPickerPopup.parentNode.removeChild(this.colorPickerPopup),this.colorPickerPopup=null,this.activeColorBtn=null}openSpecialCharacters(t){this.specCharModal||(this.specCharModal=new G({onInsert:e=>{this.insertAtCursor(e)}})),this.specCharModal.open({x:t.left,y:t.bottom+6})}closeAllPopups(){this.closeDropdown(),this.closeMatrixPopup(),this.closeColorPicker()}destroy(){this.close()}};Y(O,"VERSION",A==null?void 0:A.version);let R=O,V=null;function nt(){return V||(V=new R),V}class P{constructor(t={}){this.container=t.container||null,this.latex=t.latex||"",this.editable=t.editable!==!1,this.mode=t.mode||"math",this.onUpdate=t.onUpdate||(()=>{}),this.editor=t.editor||nt(),this.element=null,this.mathField=null,this.container&&this.mount(this.container)}mount(t){this.container=t,this.element=document.createElement("span"),this.element.className="digi-math-widget"+(this.editable?"":" readonly"),this.element.setAttribute("data-latex",this.latex),this.element.title=this.editable?"Click to edit formula":"",this.mathField=document.createElement("math-field"),this.mathField.setAttribute("read-only","true"),this.mathField.textContent=this.latex,this.element.appendChild(this.mathField),this.editable&&this.element.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),this.openEditor()}),this.container.appendChild(this.element)}openEditor(){this.editor.open(this.latex,this.mode),this.editor.onInsert=t=>{this.setLatex(t),this.onUpdate(t)}}setLatex(t){if(this.latex=t||"",this.element&&this.element.setAttribute("data-latex",this.latex),this.mathField)try{typeof this.mathField.setValue=="function"?this.mathField.setValue(this.latex):this.mathField.textContent=this.latex}catch{this.mathField.textContent=this.latex}}getLatex(){return this.latex}destroy(){this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}}function ht(n){return new P(n)}if(typeof customElements<"u"&&!customElements.get("digi-math-widget")){class n extends HTMLElement{static get observedAttributes(){return["latex","editable","mode"]}connectedCallback(){const e=this.getAttribute("latex")||"",r=this.getAttribute("editable")!=="false",s=this.getAttribute("mode")||"math";this.widget=new P({container:this,latex:e,editable:r,mode:s,onUpdate:o=>{this.setAttribute("latex",o),this.dispatchEvent(new CustomEvent("latexChange",{detail:{latex:o},bubbles:!0}))}})}attributeChangedCallback(e,r,s){r!==s&&e==="latex"&&this.widget&&this.widget.setLatex(s)}disconnectedCallback(){this.widget&&this.widget.destroy()}}customElements.define("digi-math-widget",n)}const ct=A==null?void 0:A.version;u.CME_SHADOW_DOM_CSS=X,u.DigiMathChemEditor=R,u.DigiMathWidget=P,u.SpecialCharacterModal=G,u.VERSION=ct,u.createMathWidget=ht,u.default=R,u.initMathFieldCursorFix=K,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
410
+ `)}function ot(){document.querySelectorAll("math-field").forEach(N)}let U=null;function K(){U||(ot(),U=new MutationObserver(n=>{var t,e,r;for(const s of n){if(s.type==="attributes"&&((t=s.target.tagName)==null?void 0:t.toLowerCase())==="math-field"){N(s.target);continue}if(s.addedNodes)for(const o of s.addedNodes)o instanceof Element&&(((e=o.tagName)==null?void 0:e.toLowerCase())==="math-field"&&requestAnimationFrame(()=>N(o)),(r=o.querySelectorAll)==null||r.call(o,"math-field").forEach(l=>requestAnimationFrame(()=>N(l))))}}),U.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["read-only","readonly"]}))}const W=[{id:"All",name:"All"},{id:"Symbol",name:"Symbol",ranges:[[8704,8959],[9728,9983],[8592,8703],[9984,10175]]},{id:"Punctuation",name:"Punctuation",ranges:[[33,47],[58,64],[91,96],[123,126],[161,161],[171,171],[187,187],[191,191],[8208,8231],[8240,8286],[10088,10101],[10214,10223],[10627,10648],[11776,11903],[12288,12351],[65104,65135],[65281,65295],[65306,65312],[65339,65344],[65371,65381]]},{id:"Letter",name:"Letter",ranges:[[65,90],[97,122],[880,1023],[1024,1279]]},{id:"Mark",name:"Mark",ranges:[[169,169],[174,174],[8224,8231],[8240,8286],[8471,8471],[8482,8482],[9744,9746],[10003,10008],[10013,10017],[10018,10059],[10067,10074],[10081,10087],[10132,10174],[128500,128505]]},{id:"Number",name:"Number",ranges:[[48,57],[8304,8351],[8528,8591],[9312,9471],[10102,10131],[65296,65305],[120782,120831]]},{id:"Phonetic",name:"Phonetic",ranges:[[592,687],[688,767],[7424,7551],[7552,7615],[43824,43887]]},{id:"Other",name:"Other",ranges:[[8352,8399],[8448,8527],[8960,9215],[9472,9599],[9600,9631],[9632,9727],[10240,10495],[11008,11263]]}],at=(()=>{const n=[];return W.slice(1).forEach(t=>{t.ranges.forEach(e=>{for(let r=e[0];r<=e[1];r++){if(r>=127&&r<=159)continue;const s=String.fromCodePoint(r);new RegExp("\\p{C}","u").test(s)||n.push({code:r.toString(16).toUpperCase().padStart(4,"0"),char:s,category:t.id})}})}),n})();class G{constructor(t={}){this.onInsert=t.onInsert||(()=>{}),this.onClose=t.onClose||(()=>{}),this.isOpen=!1,this.searchCode="",this.selectedCategory="All",this.overlay=null,this.modal=null,this.bodyContainer=null,this.boundKeyDown=this.handleKeyDown.bind(this)}open(t=null){this.isOpen||(this.isOpen=!0,this.searchCode="",this.selectedCategory="All",this.render(t),window.addEventListener("keydown",this.boundKeyDown))}close(){this.isOpen&&(this.isOpen=!1,window.removeEventListener("keydown",this.boundKeyDown),this.overlay&&this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay),this.overlay=null,this.onClose())}handleKeyDown(t){t.key==="Escape"&&this.close()}getFilteredCharacters(){let t=at;if(this.selectedCategory!=="All"&&(t=t.filter(e=>e.category===this.selectedCategory)),this.searchCode.trim()){const e=this.searchCode.trim().toUpperCase();t=t.filter(r=>r.code.includes(e))}return t}getGroupedCharacters(t){if(this.selectedCategory!=="All"&&!this.searchCode.trim())return{[this.selectedCategory]:t};const e={};return t.forEach(r=>{e[r.category]||(e[r.category]=[]),e[r.category].push(r)}),e}render(t){if(this.overlay&&this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay),this.overlay=document.createElement("div"),this.overlay.className="scm-overlay",this.overlay.addEventListener("mousedown",l=>{l.stopPropagation(),this.close()}),this.modal=document.createElement("div"),this.modal.className="scm-modal",this.modal.addEventListener("mousedown",l=>l.stopPropagation()),t){let l=t.x-120,a=t.y;l<10&&(l=10),l+230>window.innerWidth&&(l=window.innerWidth-240),a+200>window.innerHeight&&(a=window.innerHeight-210),this.modal.style.top=`${a}px`,this.modal.style.left=`${l}px`,this.modal.style.transform="none"}else this.modal.style.top="50%",this.modal.style.left="50%",this.modal.style.transform="translate(-50%, -50%)";const e=document.createElement("div");e.className="scm-toolbar";const r=document.createElement("input");r.type="text",r.placeholder="Code",r.className="scm-code-input",r.value=this.searchCode,r.addEventListener("input",l=>{this.searchCode=l.target.value,this.updateGrid()});const s=document.createElement("select");s.className="scm-category-select",W.forEach(l=>{const a=document.createElement("option");a.value=l.id,a.textContent=l.name,s.appendChild(a)}),s.value=this.selectedCategory,s.addEventListener("change",l=>{this.selectedCategory=l.target.value,this.updateGrid()}),e.appendChild(r),e.appendChild(s),this.modal.appendChild(e);const o=document.createElement("div");o.className="scm-body",this.bodyContainer=document.createElement("div"),this.bodyContainer.className="scm-grid-container",o.appendChild(this.bodyContainer),this.modal.appendChild(o),this.updateGrid(),this.overlay.appendChild(this.modal),document.body.appendChild(this.overlay),setTimeout(()=>r.focus(),50)}updateGrid(){if(!this.bodyContainer)return;this.bodyContainer.innerHTML="";const t=this.getFilteredCharacters(),e=this.getGroupedCharacters(t),r=Object.entries(e);if(r.length===0||t.length===0){const s=document.createElement("div");s.className="scm-no-results",s.textContent="No characters found.",this.bodyContainer.appendChild(s);return}r.forEach(([s,o])=>{const l=document.createElement("div");l.className="scm-category-group";const a=document.createElement("div");a.className="scm-char-grid",o.forEach(h=>{const c=document.createElement("button");c.type="button",c.className="scm-char-btn",c.title=`U+${h.code}`,c.textContent=h.char,c.addEventListener("click",g=>{g.preventDefault(),this.onInsert(h.char),this.close()}),a.appendChild(c)}),l.appendChild(a),this.bodyContainer.appendChild(l)})}destroy(){this.close()}}const A={version:"1.0.29"};typeof window<"u"&&(window.MathfieldElement?window.MathfieldElement.fontsDirectory="https://cdn.jsdelivr.net/npm/mathlive/dist/fonts":v.MathfieldElement&&(v.MathfieldElement.fontsDirectory="https://cdn.jsdelivr.net/npm/mathlive/dist/fonts"));const O=class O{constructor(t={}){this.version=O.VERSION,this.options=t,this.onInsert=t.onInsert||(()=>{}),this.onClose=t.onClose||(()=>{}),this.mode=t.mode||"math",this.title=t.title||null,this.isOpen=!1,this.isEditing=!1,this.initialLatex="",this.activeGroup=0,this.explicitToggle=!1,this.activeStyles={bold:!1,italic:!1,fontFamily:"none",fontSize:"auto",color:"none"},this.isMaximized=!1,this.isMinimized=!1,this.position={x:0,y:0},this.isDragging=!1,this.dragStart={x:0,y:0},this.popup=null,this.mathField=null,this.tabsWrapper=null,this.itemsWrapper=null,this.activeDropdown=null,this.activeDropdownBtn=null,this.activeMatrixPopup=null,this.activeMatrixBtn=null,this.colorPickerPopup=null,this.activeColorBtn=null,this.specCharModal=null,this.boundKeyDown=this.handleGlobalKeyDown.bind(this),this.boundDocClick=this.handleDocumentClick.bind(this),this.boundMouseMove=this.handleMouseMove.bind(this),this.boundMouseUp=this.handleMouseUp.bind(this),this.boundTouchMove=this.handleTouchMove.bind(this),this.boundTouchEnd=this.handleMouseUp.bind(this),this.boundResize=this.handleWindowResize.bind(this)}getGroups(){return this.mode==="chem"?$:_}setMode(t){if(!(!t||t===this.mode)&&(this.mode=t,this.activeGroup=0,this.explicitToggle=!1,this.closeAllPopups(),this.specCharModal&&this.specCharModal.close(),this.isOpen&&this.popup)){const e=this.popup.querySelector(".cme-popup-header span");if(e){const r=this.title||(this.isEditing?this.mode==="chem"?"Edit Chemistry Formula":"Edit Math Formula":this.mode==="chem"?"Chemistry Editor":"Math Editor");e.textContent=r}this.renderTabs(),this.renderToolbarItems()}}open(t="",e=null){if(this.isOpen){e&&e!==this.mode&&this.setMode(e),this.setValue(t||""),this.initialLatex=t||"",this.isEditing=!!t;return}this.isOpen=!0,this.position={x:0,y:0},this.isDragging=!1,this.isMaximized=!1,this.isMinimized=!1,this.initialLatex=t||"",this.isEditing=!!t,e&&(this.mode=e),this.activeGroup=0,this.explicitToggle=!1,this.activeStyles={bold:!1,italic:!1,fontFamily:"none",fontSize:"auto",color:"none"},this.render(),window.addEventListener("keydown",this.boundKeyDown),document.addEventListener("mousedown",this.boundDocClick,!0),document.addEventListener("pointerdown",this.boundDocClick,!0),window.addEventListener("mousemove",this.boundMouseMove),window.addEventListener("mouseup",this.boundMouseUp),window.addEventListener("touchmove",this.boundTouchMove,{passive:!1}),window.addEventListener("touchend",this.boundTouchEnd),window.addEventListener("resize",this.boundResize)}close(){this.isOpen&&(this.isOpen=!1,window.removeEventListener("keydown",this.boundKeyDown),document.removeEventListener("mousedown",this.boundDocClick,!0),document.removeEventListener("pointerdown",this.boundDocClick,!0),window.removeEventListener("mousemove",this.boundMouseMove),window.removeEventListener("mouseup",this.boundMouseUp),window.removeEventListener("touchmove",this.boundTouchMove),window.removeEventListener("touchend",this.boundTouchEnd),window.removeEventListener("resize",this.boundResize),this.closeAllPopups(),this.specCharModal&&this.specCharModal.close(),this.popup&&this.popup.parentNode&&this.popup.parentNode.removeChild(this.popup),this.popup=null,this.mathField=null,this.onClose())}getValue(){if(!this.mathField)return"";const t=this.mathField.getValue?this.mathField.getValue("latex"):this.mathField.value||"";return st(t)}setValue(t){if(!this.mathField)return;const e=t||"";try{typeof this.mathField.setValue=="function"?this.mathField.setValue(e):this.mathField.textContent=e}catch{this.mathField.textContent=e}}handleGlobalKeyDown(t){if(t.key==="Escape"){if(this.activeDropdown||this.activeMatrixPopup||this.colorPickerPopup){this.closeAllPopups();return}this.close();return}t.key==="Enter"&&(t.ctrlKey||t.metaKey)&&(t.preventDefault(),this.handleInsert())}handleDocumentClick(t){if(!this.popup)return;const e=t.composedPath?t.composedPath():[];this.activeDropdown&&(this.activeDropdown===t.target||this.activeDropdown.contains(t.target)||e.includes(this.activeDropdown)||this.activeDropdownBtn&&(this.activeDropdownBtn===t.target||this.activeDropdownBtn.contains(t.target)||e.includes(this.activeDropdownBtn))||this.closeDropdown()),this.activeMatrixPopup&&(this.activeMatrixPopup===t.target||this.activeMatrixPopup.contains(t.target)||e.includes(this.activeMatrixPopup)||this.activeMatrixBtn&&(this.activeMatrixBtn===t.target||this.activeMatrixBtn.contains(t.target)||e.includes(this.activeMatrixBtn))||this.closeMatrixPopup()),this.colorPickerPopup&&(this.colorPickerPopup===t.target||this.colorPickerPopup.contains(t.target)||e.includes(this.colorPickerPopup)||this.activeColorBtn&&(this.activeColorBtn===t.target||this.activeColorBtn.contains(t.target)||e.includes(this.activeColorBtn))||this.closeColorPicker())}handleInsert(){let t=this.getValue();t=tt(t),t=et(t),t=rt(t),this.mode==="chem"&&(t.includes("\\displaylines")||t.includes("\\\\")||t.includes("\\class{cme-")||t.includes("\\xleftrightarrows")||t.includes("\\xleftrightharpoons")||t.includes("\\enclose")||t.includes("\\{")||t.includes("\\}")||t.includes("\\lbrace")||t.includes("\\rbrace")?/^\\ce\{[\s\S]*\}$/i.test(t.trim())&&(t=t.trim().replace(/^\\ce\{([\s\S]*)\}$/i,"$1")):t.trim()&&!t.trim().startsWith("\\ce{")&&!t.includes("\\ce{")&&(t=`\\ce{${t}}`)),this.onInsert(t),this.close()}insertAtCursor(t){if(this.closeAllPopups(),!this.mathField)return;const e=this.mathField;if(e.smartSuperscript=!1,e.focus(),typeof t=="string"){const r=D(t,this.activeStyles.bold,this.activeStyles.italic,this.activeStyles.fontFamily);e.executeCommand?e.executeCommand(["insert",r,{selectionMode:"placeholder"}]):e.insert(r)}else if(t&&t.insert){const r=t.action==="INSERT_CUSTOM"||t.directInsert?D(t.insert,this.activeStyles.bold,this.activeStyles.italic,this.activeStyles.fontFamily):t.insert;e.executeCommand?e.executeCommand(["insert",r,{selectionMode:"placeholder"}]):e.insert(r)}}getInsertStyle(){const t={};return this.activeStyles.bold&&this.activeStyles.italic?(t.variant="main",t.variantStyle="bolditalic"):this.activeStyles.bold?(t.variant="normal",t.variantStyle="bold"):this.activeStyles.italic&&(t.variant="main",t.variantStyle="italic"),this.activeStyles.fontFamily&&this.activeStyles.fontFamily!=="none"&&(t.fontFamily=this.activeStyles.fontFamily),this.activeStyles.color&&this.activeStyles.color!=="none"&&(t.color=this.activeStyles.color),t}isAllSelected(t){if(!t||t.selectionIsCollapsed)return!1;try{const e=t.model,r=(e==null?void 0:e.selection)||t.selection;if(r){const s=r.ranges||(Array.isArray(r)?[r]:[]);if(s.length>0){let o=1/0,l=-1/0;for(const h of s)Array.isArray(h)&&(o=Math.min(o,h[0],h[1]),l=Math.max(l,h[0],h[1]));const a=(e==null?void 0:e.lastOffset)||1;if(o<=1&&l>=a)return!0}}}catch{}return!1}getSelectionLatex(t){if(!t)return"";try{if(this.isAllSelected(t))return t.getValue()||t.value||"";if(t.selection){const e=t.getValue(t.selection);if(typeof e=="string")return e}}catch{}try{if(t.model&&t.model.selection){const e=t.getValue(t.model.selection);if(typeof e=="string")return e}}catch{}try{const e=t.getValue("latex-selection");if(typeof e=="string")return e}catch{}return""}checkSelectionBold(t){if(!t)return!1;if(!t.selectionIsCollapsed){const e=this.getSelectionLatex(t);if(e&&e.trim()&&/\\mathbfit\{|\\mathbf\{|\\boldsymbol\{|\\textbf\{|\\bold\{|\\bm\{|\\pmb\{/.test(e.trim()))return!0}try{if(typeof t.queryStyle=="function"){const e=t.queryStyle({variantStyle:"bold"}),r=t.queryStyle({variantStyle:"bolditalic"}),s=t.queryStyle({fontSeries:"b"});if(e==="all"||e==="some"||r==="all"||r==="some"||s==="all"||s==="some")return!0}}catch{}try{const e=t.model;if(e&&!t.selectionIsCollapsed&&(e.selection||t.selection)){const r=e.selection||t.selection,s=e.getAtoms(r,{includeChildren:!0});if(s&&s.length>0&&s.some(l=>{if(!l||l.type==="first")return!1;const a=l.style;return a?a.variantStyle==="bold"||a.variantStyle==="bolditalic"||a.fontSeries==="b"||a.variant==="bold":!1}))return!0}}catch{}return!1}checkSelectionItalic(t){if(!t)return!1;if(!t.selectionIsCollapsed){const e=this.getSelectionLatex(t);if(e&&e.trim()&&/\\mathbfit\{|\\mathit\{|\\textit\{|\\textsl\{|\\slshape\{/.test(e.trim()))return!0}try{if(typeof t.queryStyle=="function"){const e=t.queryStyle({variantStyle:"italic"}),r=t.queryStyle({variantStyle:"bolditalic"}),s=t.queryStyle({fontShape:"it"});if(e==="all"||e==="some"||r==="all"||r==="some"||s==="all"||s==="some")return!0}}catch{}try{const e=t.model;if(e&&!t.selectionIsCollapsed&&(e.selection||t.selection)){const r=e.selection||t.selection,s=e.getAtoms(r,{includeChildren:!0});if(s&&s.length>0&&s.some(l=>{if(!l||l.type==="first")return!1;const a=l.style;return a?a.variantStyle==="italic"||a.variantStyle==="bolditalic"||a.fontShape==="it":!1}))return!0}}catch{}return!1}updateStylesFromSelection(){const t=this.mathField;if(t)if(t.selectionIsCollapsed){if(this.explicitToggle)return;let e=!1;this.activeStyles.bold&&(this.activeStyles.bold=!1,e=!0),this.activeStyles.italic&&(this.activeStyles.italic=!1,e=!0),e&&this.renderToolbarItems()}else{this.explicitToggle=!1;const e=this.checkSelectionBold(t),r=this.checkSelectionItalic(t);let s=!1;this.activeStyles.bold!==e&&(this.activeStyles.bold=e,s=!0),this.activeStyles.italic!==r&&(this.activeStyles.italic=r,s=!0),s&&this.renderToolbarItems()}}render(){this.popup=document.createElement("div"),this.popup.className="cme-editor-popup"+(this.isMaximized?" maximized":"")+(this.isMinimized?" minimized":""),this.popup.addEventListener("mousedown",i=>{this.handleDocumentClick(i),i.stopPropagation()}),this.popup.addEventListener("pointerdown",i=>{this.handleDocumentClick(i)});const t=document.createElement("div");t.className="cme-popup-topbar";const e=document.createElement("div");e.className="cme-popup-header",e.style.cursor="grab";const r=this.title||(this.isEditing?this.mode==="chem"?"Edit Chemistry Formula":"Edit Math Formula":this.mode==="chem"?"Chemistry Editor":"Math Editor");e.innerHTML=`<span>${r}</span>`;const s=(i,p,b)=>{b&&b.closest&&b.closest(".cme-popup-btn")||(this.closeAllPopups(),this.specCharModal&&this.specCharModal.close(),this.isDragging=!0,this.dragStart={x:i-this.position.x,y:p-this.position.y},e.style.cursor="grabbing")};e.addEventListener("mousedown",i=>{s(i.clientX,i.clientY,i.target)}),e.addEventListener("touchstart",i=>{i.touches&&i.touches.length>0&&s(i.touches[0].clientX,i.touches[0].clientY,i.target)},{passive:!0});const o=document.createElement("div");o.className="cme-popup-controls";const l=document.createElement("button");l.type="button",l.className="cme-popup-btn",l.textContent="—",l.title="Minimize",l.addEventListener("click",()=>this.toggleMinimize());const a=document.createElement("button");a.type="button",a.className="cme-popup-btn",a.textContent="⤢",a.title="Maximize",a.addEventListener("click",()=>this.toggleMaximize()),this.minBtn=l,this.maxBtn=a;const h=document.createElement("button");h.type="button",h.className="cme-popup-btn",h.textContent="✕",h.title="Close",h.addEventListener("click",()=>this.close()),o.appendChild(l),o.appendChild(a),o.appendChild(h),t.appendChild(e),t.appendChild(o),this.popup.appendChild(t);const c=document.createElement("div");c.className="cme-toolbar",c.setAttribute("role","toolbar"),c.setAttribute("aria-label","Symbol palette"),this.tabsWrapper=document.createElement("div"),this.tabsWrapper.className="cme-toolbar-groups",this.renderTabs(),c.appendChild(this.tabsWrapper),this.itemsWrapper=document.createElement("div"),this.itemsWrapper.className="cme-toolbar-items",this.renderToolbarItems(),c.appendChild(this.itemsWrapper),this.popup.appendChild(c);const g=document.createElement("div");g.className="cme-mathfield-container",g.addEventListener("mousedown",i=>{var p,b;this.explicitToggle=!1,this.closeAllPopups(),!(this.mathField&&(i.target===this.mathField||this.mathField.contains(i.target)))&&(i.preventDefault(),(b=(p=this.mathField)==null?void 0:p.focus)==null||b.call(p))}),this.mathField=document.createElement("math-field"),this.mathField.className="cme-mathfield",this.mathField.setAttribute("tabindex","0"),this.mathField.setAttribute("math-virtual-keyboard-policy","manual"),this.mathField.setAttribute("smart-superscript","false"),this.mathField.smartSuperscript=!1,this.mathField.setAttribute("math-mode-space","\\enspace"),this.mathField.mathModeSpace="\\enspace",this.mathField.onInsertStyle=()=>this.getInsertStyle(),this.mathField.addEventListener("keydown",i=>{if(i.key==="Enter"&&!i.ctrlKey&&!i.metaKey&&!i.altKey){i.preventDefault(),i.stopPropagation(),i.stopImmediatePropagation(),this.activeStyles.bold||this.activeStyles.italic||this.activeStyles.fontFamily&&this.activeStyles.fontFamily!=="none"?this.explicitToggle=!0:this.explicitToggle=!1;const m=this.mathField;m!=null&&m.executeCommand&&m.executeCommand("addRowAfter");return}if(i.key===" "||i.code==="Space"){i.preventDefault(),i.stopPropagation(),i.stopImmediatePropagation();const m=this.mathField;m.executeCommand?m.executeCommand(["insert","\\enspace ",{selectionMode:"after"}]):m.insert&&m.insert("\\enspace ");return}if(i.key==="ArrowLeft"||i.key==="ArrowRight"||i.key==="ArrowUp"||i.key==="ArrowDown"||i.key==="Home"||i.key==="End"){this.explicitToggle=!1;return}if(!this.activeStyles.bold&&!this.activeStyles.italic&&this.activeStyles.fontFamily==="none"||i.key.length!==1||i.ctrlKey||i.metaKey||i.altKey)return;i.preventDefault(),i.stopPropagation(),i.stopImmediatePropagation();const p=D(i.key,this.activeStyles.bold,this.activeStyles.italic,this.activeStyles.fontFamily),b=this.mathField;b.executeCommand?b.executeCommand(["insert",p,{selectionMode:"after"}]):b.insert&&b.insert(p)},{capture:!0});const y=()=>{this.updateStylesFromSelection()};this.mathField.addEventListener("selection-change",y),this.mathField.addEventListener("pointerup",y),this.mathField.addEventListener("keyup",y),this.mathField.addEventListener("pointerdown",()=>{this.explicitToggle=!1,this.closeAllPopups()}),this.mathField.addEventListener("focus",()=>{this.closeAllPopups()}),g.appendChild(this.mathField),this.popup.appendChild(g);const x=document.createElement("div");x.className="cme-popup-footer";const f=document.createElement("button");f.type="button",f.className="cme-insert-btn",f.textContent=this.isEditing?"Update":"Insert",f.addEventListener("click",()=>this.handleInsert());const w=document.createElement("button");w.type="button",w.className="cme-cancel-btn",w.textContent="Cancel",w.addEventListener("click",()=>this.close()),x.appendChild(f),x.appendChild(w);const k=`v${A.version}`;if(k){const i=document.createElement("span");i.className="cme-popup-version",i.textContent=k,i.title=`Version ${A.version}`,x.appendChild(i)}this.popup.appendChild(x),document.body.appendChild(this.popup),setTimeout(()=>{if(this.mathField){K();try{this.mathField.smartSuperscript=!1,this.mathField.inlineShortcuts=Object.assign({},this.mathField.inlineShortcuts||{},{"*":"*"}),typeof this.mathField.setOptions=="function"&&this.mathField.setOptions({smartSuperscript:!1,mathModeSpace:"\\enspace",onInsertStyle:()=>this.getInsertStyle(),macros:{...window.__cme_macros||{},...B}}),this.mathField.menuItems&&Array.isArray(this.mathField.menuItems)&&(this.mathField.menuItems=this.mathField.menuItems.filter(p=>p&&p.id!=="insert-matrix"&&p.submenuClass!=="insert-matrix-submenu"))}catch{}let i=this.initialLatex||"";this.mode==="chem"&&i.startsWith("\\ce{")&&i.endsWith("}")&&(i=i.slice(4,-1)),this.setValue(i),this.mathField.focus()}},50)}clampPosition(t=this.position.x,e=this.position.y){if(!this.popup)return{x:t,y:e};const r=this.popup.getBoundingClientRect(),s=r.left-this.position.x,o=r.top-this.position.y,l=r.width,a=r.height,h=window.innerWidth,c=window.innerHeight;let g=-s,y=h-s-l,x=t;g>y?x=g:x=Math.max(g,Math.min(t,y));let f=-o,w=c-o-a,k=e;return f>w?k=f:k=Math.max(f,Math.min(e,w)),{x,y:k}}handleMouseMove(t){if(!this.isDragging||!this.popup)return;this.closeAllPopups(),this.specCharModal&&this.specCharModal.close();const e=t.clientX-this.dragStart.x,r=t.clientY-this.dragStart.y;this.position=this.clampPosition(e,r),this.popup.style.transform=`translate(${this.position.x}px, ${this.position.y}px)`}handleTouchMove(t){!this.isDragging||!t.touches||t.touches.length===0||(t.cancelable&&t.preventDefault(),this.handleMouseMove(t.touches[0]))}handleWindowResize(){if(!this.popup)return;const t=this.clampPosition(this.position.x,this.position.y);(t.x!==this.position.x||t.y!==this.position.y)&&(this.position=t,this.popup.style.transform=`translate(${this.position.x}px, ${this.position.y}px)`)}handleMouseUp(){var e;this.isDragging=!1;const t=(e=this.popup)==null?void 0:e.querySelector(".cme-popup-header");t&&(t.style.cursor="grab")}updateControlButtons(){this.maxBtn&&(this.maxBtn.textContent=this.isMaximized?"⤡":"⤢",this.maxBtn.title=this.isMaximized?"Restore":"Maximize"),this.minBtn&&(this.minBtn.title=this.isMinimized?"Restore":"Minimize")}toggleMaximize(){var t,e;this.isMaximized=!this.isMaximized,this.isMaximized&&(this.isMinimized=!1,(t=this.popup)==null||t.classList.remove("minimized")),(e=this.popup)==null||e.classList.toggle("maximized",this.isMaximized),this.position={x:0,y:0},this.popup&&(this.popup.style.transform="translate(0px, 0px)"),this.updateControlButtons()}toggleMinimize(){var t,e;this.isMinimized=!this.isMinimized,this.isMinimized&&(this.isMaximized=!1,(t=this.popup)==null||t.classList.remove("maximized")),(e=this.popup)==null||e.classList.toggle("minimized",this.isMinimized),this.position={x:0,y:0},this.popup&&(this.popup.style.transform="translate(0px, 0px)"),this.updateControlButtons()}renderTabs(){if(!this.tabsWrapper)return;this.tabsWrapper.innerHTML="",this.getGroups().forEach((e,r)=>{const s=this.activeGroup===r,o=document.createElement("button");if(o.type="button",o.className="cme-group-tab"+(s?" active":""),e.mathLabel){const l=document.createElement("math-field");l.setAttribute("read-only","true"),l.setAttribute("tabindex","-1"),l.style.pointerEvents="none",l.style.background="transparent",l.style.border="none",l.style.outline="none",l.style.fontSize=e.fontSize||(e.isMatrix?"8px":"11px"),l.style.display="inline-block",l.style.width="auto",l.style.padding="0",l.style.margin="0",l.style.boxShadow="none",l.style.color=s?"#333333":"#ffffff",l.textContent=e.mathLabel,o.appendChild(l)}else typeof e.label=="string"&&e.label.includes("<svg")?o.innerHTML=e.label:o.textContent=e.label;o.addEventListener("mousedown",l=>{l.preventDefault(),this.activeGroup=r,this.closeAllPopups(),this.renderTabs(),this.renderToolbarItems()}),this.tabsWrapper.appendChild(o)})}renderToolbarItems(){if(!this.itemsWrapper)return;this.itemsWrapper.innerHTML="";const e=this.getGroups()[this.activeGroup]||{items:[]},r=e.items||[],s=r.some(l=>l.type==="sep"),o=[];if(s){let l={cols:2,small:!1,cls:"",items:[],moreItems:null,moreCols:1};for(const a of r)a.type==="sep"?(l.items.length>0&&o.push(l),l={cols:a.cols||2,small:!!a.small,cls:a.cls||"",items:[],moreItems:a.moreItems||null,moreCols:a.moreCols||1}):l.items.push(a);l.items.length>0&&o.push(l)}else for(let a=0;a<r.length;a+=4)o.push({cols:2,small:!1,cls:"",items:r.slice(a,a+4)});o.forEach(l=>{const a=document.createElement("div");if(a.className="cme-symbol-subgroup"+(l.small?" cme-symbol-subgroup--small":"")+(l.cls?` ${l.cls}`:"")+(l.moreItems?" cme-subgroup-has-more":""),a.style.gridTemplateColumns=`repeat(${l.cols}, auto)`,a.style.position="relative",l.moreItems){const h=document.createElement("button");h.type="button",h.className="cme-more-trigger-btn",h.title="More",h.textContent="▶",h.addEventListener("mousedown",c=>c.preventDefault()),h.addEventListener("click",c=>{if(c.stopPropagation(),this.activeDropdown&&this.activeDropdownBtn===h)this.closeDropdown();else{const g=h.getBoundingClientRect();this.openDropdown(l.moreItems,g,l.moreCols||4,h)}}),a.appendChild(h)}l.items.forEach(h=>{if(h.type==="dropdown"){const k=h.label==="Font...",i=h.label==="Size",p=document.createElement("select");p.className="cme-select"+(k?" cme-select-font":"")+(i?" cme-select-size":"")+(k&&this.activeStyles.fontFamily!=="none"||i&&this.activeStyles.fontSize!=="auto"?" active":""),k?([{id:"none",label:"Font..."},{id:"roman",label:"Roman"},{id:"sans-serif",label:"Sans-Serif"},{id:"monospace",label:"Monospace"}].forEach(b=>{const m=document.createElement("option");m.value=b.id,m.textContent=b.label,p.appendChild(m)}),p.value=this.activeStyles.fontFamily,p.addEventListener("change",b=>{var m;this.activeStyles.fontFamily=b.target.value,(m=this.mathField)!=null&&m.applyStyle&&this.mathField.applyStyle({fontFamily:this.activeStyles.fontFamily==="none"?"none":this.activeStyles.fontFamily}),this.renderToolbarItems()})):i&&([{id:"auto",label:"Size"},{id:"1",label:"Tiny"},{id:"3",label:"Small"},{id:"5",label:"Normal"},{id:"7",label:"Large"},{id:"9",label:"Huge"}].forEach(b=>{const m=document.createElement("option");m.value=b.id,m.textContent=b.label,p.appendChild(m)}),p.value=this.activeStyles.fontSize,p.addEventListener("change",b=>{var m;if(this.activeStyles.fontSize=b.target.value,(m=this.mathField)!=null&&m.applyStyle){const S=this.activeStyles.fontSize==="auto"?"none":parseInt(this.activeStyles.fontSize,10);this.mathField.applyStyle({fontSize:S})}this.renderToolbarItems()})),a.appendChild(p);return}const c=h.action==="BOLD",g=h.action==="ITALIC",y=h.action==="TEXT_COLOR",x=h.action==="SPECIAL_CHARS",f=c&&this.activeStyles.bold||g&&this.activeStyles.italic||y&&this.activeStyles.color!=="none",w=document.createElement("button");w.type="button",w.className="cme-btn"+(e.isTemplate?" template":"")+(h.cls?` ${h.cls}`:"")+(f?" active":""),w.title=h.title||h.label||h.insert||"",typeof h.label=="string"&&(h.label.includes("<svg")||h.label.includes("<img")||h.label.includes("<strong")||h.label.includes("<em"))?w.innerHTML=h.label:typeof h.label=="string"&&(w.textContent=h.label),w.addEventListener("mousedown",k=>{var p,b,m,S,d,T,E,M,L,H;k.preventDefault();const i=this.mathField;if(x){this.closeAllPopups();const C=w.getBoundingClientRect();this.openSpecialCharacters(C)}else if(y)if(this.colorPickerPopup&&this.activeColorBtn===w)this.closeColorPicker();else{const C=w.getBoundingClientRect();this.openColorPicker(C,w)}else if(c){if(this.closeAllPopups(),this.explicitToggle=!0,this.activeStyles.bold=!this.activeStyles.bold,i){if(i.selectionIsCollapsed)this.activeStyles.bold||(i.styleBias="none",i.defaultStyle&&(delete i.defaultStyle.variantStyle,delete i.defaultStyle.fontSeries));else{const C=this.getSelectionLatex(i);if(C&&C.trim()){const F=z(C.trim()),I=D(F,this.activeStyles.bold,this.activeStyles.italic,this.activeStyles.fontFamily);if(this.activeStyles.bold||(i.styleBias="none",i.defaultStyle&&(delete i.defaultStyle.variantStyle,delete i.defaultStyle.fontSeries)),this.isAllSelected(i)?(i.setValue(I),i.executeCommand?i.executeCommand("selectAll"):(p=i.model)!=null&&p.setSelection&&i.model.setSelection(0,i.model.lastOffset)):i.executeCommand?i.executeCommand(["insert",I,{selectionMode:"item"}]):i.insert&&i.insert(I,{selectionMode:"item"}),!this.activeStyles.bold&&i.applyStyle)try{i.applyStyle({variantStyle:this.activeStyles.italic?"italic":"",fontSeries:"auto"},{operation:"set"})}catch{}}}i.focus()}this.renderToolbarItems()}else if(g){if(this.closeAllPopups(),this.explicitToggle=!0,this.activeStyles.italic=!this.activeStyles.italic,i){if(i.selectionIsCollapsed)this.activeStyles.italic||(i.styleBias="none",i.defaultStyle&&(delete i.defaultStyle.variantStyle,delete i.defaultStyle.fontShape));else{const C=this.getSelectionLatex(i);if(C&&C.trim()){const F=z(C.trim()),I=D(F,this.activeStyles.bold,this.activeStyles.italic,this.activeStyles.fontFamily);if(this.activeStyles.italic||(i.styleBias="none",i.defaultStyle&&(delete i.defaultStyle.variantStyle,delete i.defaultStyle.fontShape)),this.isAllSelected(i)?(i.setValue(I),i.executeCommand?i.executeCommand("selectAll"):(b=i.model)!=null&&b.setSelection&&i.model.setSelection(0,i.model.lastOffset)):i.executeCommand?i.executeCommand(["insert",I,{selectionMode:"item"}]):i.insert&&i.insert(I,{selectionMode:"item"}),!this.activeStyles.italic&&i.applyStyle)try{i.applyStyle({variantStyle:this.activeStyles.bold?"bold":"",fontShape:"auto"},{operation:"set"})}catch{}}}i.focus()}this.renderToolbarItems()}else if(h.action==="UNDO")this.closeAllPopups(),(m=i==null?void 0:i.executeCommand)==null||m.call(i,"undo");else if(h.action==="REDO")this.closeAllPopups(),(S=i==null?void 0:i.executeCommand)==null||S.call(i,"redo");else if(h.action==="CUT")this.closeAllPopups(),(d=i==null?void 0:i.focus)==null||d.call(i),(T=i==null?void 0:i.executeCommand)==null||T.call(i,"cutToClipboard");else if(h.action==="COPY")this.closeAllPopups(),(E=i==null?void 0:i.focus)==null||E.call(i),(M=i==null?void 0:i.executeCommand)==null||M.call(i,"copyToClipboard");else if(h.action==="PASTE")this.closeAllPopups(),(L=i==null?void 0:i.focus)==null||L.call(i),(H=i==null?void 0:i.executeCommand)==null||H.call(i,"pasteFromClipboard");else if(h.action==="MATRIX_HOVER")if(this.activeMatrixPopup&&this.activeMatrixBtn===w)this.closeMatrixPopup();else{const C=w.getBoundingClientRect();this.openMatrixGrid(h.matrixType||"matrix",C,w)}else this.insertAtCursor(h)}),a.appendChild(w)}),this.itemsWrapper.appendChild(a)})}openDropdown(t,e,r,s=null){this.closeAllPopups(),this.activeDropdownBtn=s,this.activeDropdown=document.createElement("div"),this.activeDropdown.className="cme-more-popup",this.activeDropdown.style.gridTemplateColumns=`repeat(${r}, auto)`,this.activeDropdown.style.left=`${e.left+e.width/2}px`,this.activeDropdown.style.top=`${e.bottom+4}px`,this.activeDropdown.style.transform="translateX(-50%)",this.activeDropdown.addEventListener("mousedown",o=>o.stopPropagation()),this.activeDropdown.addEventListener("pointerdown",o=>o.stopPropagation()),t.forEach(o=>{const l=document.createElement("button");l.type="button",l.className="cme-more-popup-btn "+(o.cls||""),l.title=o.title||o.label||o.insert||"",typeof o.label=="string"&&(o.label.includes("<svg")||o.label.includes("<img"))?l.innerHTML=o.label:l.textContent=o.label,l.addEventListener("mousedown",a=>{a.preventDefault(),this.insertAtCursor(o.insert||o),this.closeDropdown()}),this.activeDropdown.appendChild(l)}),document.body.appendChild(this.activeDropdown)}closeDropdown(){this.activeDropdown&&this.activeDropdown.parentNode&&this.activeDropdown.parentNode.removeChild(this.activeDropdown),this.activeDropdown=null,this.activeDropdownBtn=null}openMatrixGrid(t,e,r=null){this.closeAllPopups(),this.activeMatrixBtn=r,this.activeMatrixPopup=document.createElement("div"),this.activeMatrixPopup.className="cme-matrix-hover-popover ck-only",this.activeMatrixPopup.style.left=`${e.left+e.width/2}px`,this.activeMatrixPopup.style.top=`${e.bottom+6}px`,this.activeMatrixPopup.style.minHeight="auto",this.activeMatrixPopup.addEventListener("mousedown",d=>d.stopPropagation()),this.activeMatrixPopup.addEventListener("pointerdown",d=>d.stopPropagation());const s=document.createElement("div");s.className="cme-matrix-hover-title",s.textContent=t==="matrix"?"MATRIX":`${t.toUpperCase()} MATRIX`;const o=document.createElement("div");o.className="cme-matrix-hover-grid",o.style.flex="none";let l=2,a=2;const h=document.createElement("div");h.className="cme-matrix-hover-footer";const c=document.createElement("div");c.className="cme-matrix-counter";const g=document.createElement("input");g.type="number",g.className="cme-counter-val",g.min="1",g.max="10",g.value=l;const y=document.createElement("div");y.className="cme-counter-btns";const x=document.createElement("button");x.type="button",x.textContent="▲";const f=document.createElement("button");f.type="button",f.textContent="▼",y.appendChild(x),y.appendChild(f);const w=document.createElement("span");w.textContent="×";const k=document.createElement("input");k.type="number",k.className="cme-counter-val",k.min="1",k.max="10",k.value=a;const i=document.createElement("div");i.className="cme-counter-btns";const p=document.createElement("button");p.type="button",p.textContent="▲";const b=document.createElement("button");b.type="button",b.textContent="▼",i.appendChild(p),i.appendChild(b),c.appendChild(g),c.appendChild(y),c.appendChild(w),c.appendChild(k),c.appendChild(i);const m=document.createElement("button");m.type="button",m.className="cme-matrix-insert-btn",m.textContent="INSERT",h.appendChild(c),h.appendChild(m);const S=(d,T)=>{l=Math.max(1,Math.min(10,d)),a=Math.max(1,Math.min(10,T)),g.value=l,k.value=a,o.querySelectorAll(".cme-matrix-hover-cell").forEach(M=>{const L=parseInt(M.dataset.row,10),H=parseInt(M.dataset.col,10);L<=l&&H<=a?M.classList.add("selected"):M.classList.remove("selected")})};for(let d=1;d<=5;d++){const T=document.createElement("div");T.className="cme-matrix-hover-row";for(let E=1;E<=10;E++){const M=document.createElement("div");M.className="cme-matrix-hover-cell"+(d<=l&&E<=a?" selected":""),M.dataset.row=d,M.dataset.col=E,M.addEventListener("mouseenter",()=>{S(d,E)}),M.addEventListener("click",L=>{L.stopPropagation(),this.insertMatrix(t,d,E),this.closeMatrixPopup()}),T.appendChild(M)}o.appendChild(T)}g.addEventListener("input",()=>{const d=parseInt(g.value,10)||1;S(d,a)}),k.addEventListener("input",()=>{const d=parseInt(k.value,10)||1;S(l,d)}),x.addEventListener("click",d=>{d.preventDefault(),d.stopPropagation(),S(l+1,a)}),f.addEventListener("click",d=>{d.preventDefault(),d.stopPropagation(),S(l-1,a)}),p.addEventListener("click",d=>{d.preventDefault(),d.stopPropagation(),S(l,a+1)}),b.addEventListener("click",d=>{d.preventDefault(),d.stopPropagation(),S(l,a-1)}),m.addEventListener("click",d=>{d.stopPropagation(),this.insertMatrix(t,l,a),this.closeMatrixPopup()}),this.activeMatrixPopup.appendChild(s),this.activeMatrixPopup.appendChild(o),this.activeMatrixPopup.appendChild(h),document.body.appendChild(this.activeMatrixPopup)}insertMatrix(t,e,r){let s=[];for(let a=0;a<e;a++){let h=[];for(let c=0;c<r;c++)h.push("{#?}");s.push(h.join(" & "))}const o=t||"matrix",l=`\\begin{${o}}${s.join(" \\\\ ")}\\end{${o}}`;this.insertAtCursor(l)}closeMatrixPopup(){this.activeMatrixPopup&&this.activeMatrixPopup.parentNode&&this.activeMatrixPopup.parentNode.removeChild(this.activeMatrixPopup),this.activeMatrixPopup=null,this.activeMatrixBtn=null}openColorPicker(t,e=null){this.closeAllPopups(),this.activeColorBtn=e,this.colorPickerPopup=document.createElement("div"),this.colorPickerPopup.className="cme-more-popup",this.colorPickerPopup.style.gridTemplateColumns="repeat(4, auto)",this.colorPickerPopup.style.left=`${t.left+t.width/2}px`,this.colorPickerPopup.style.top=`${t.bottom+4}px`,this.colorPickerPopup.style.transform="translateX(-50%)",this.colorPickerPopup.addEventListener("mousedown",s=>s.stopPropagation()),this.colorPickerPopup.addEventListener("pointerdown",s=>s.stopPropagation()),["black","#e53935","#1e88e5","#43a047","#fb8c00","#8e24aa","#3949ab","#00acc1"].forEach(s=>{const o=document.createElement("div");o.style.width="18px",o.style.height="18px",o.style.borderRadius="50%",o.style.margin="4px",o.style.cursor="pointer",o.style.backgroundColor=s,o.style.border=this.activeStyles.color===s?"2px solid #222":"1px solid #ddd",o.addEventListener("mousedown",l=>{var a;l.preventDefault(),this.activeStyles.color=s,(a=this.mathField)!=null&&a.applyStyle&&this.mathField.applyStyle({color:s==="black"?"none":s}),this.closeColorPicker(),this.renderToolbarItems()}),this.colorPickerPopup.appendChild(o)}),document.body.appendChild(this.colorPickerPopup)}closeColorPicker(){this.colorPickerPopup&&this.colorPickerPopup.parentNode&&this.colorPickerPopup.parentNode.removeChild(this.colorPickerPopup),this.colorPickerPopup=null,this.activeColorBtn=null}openSpecialCharacters(t){this.specCharModal||(this.specCharModal=new G({onInsert:e=>{this.insertAtCursor(e)}})),this.specCharModal.open({x:t.left,y:t.bottom+6})}closeAllPopups(){this.closeDropdown(),this.closeMatrixPopup(),this.closeColorPicker()}destroy(){this.close()}};Y(O,"VERSION",A==null?void 0:A.version);let R=O,V=null;function nt(){return V||(V=new R),V}class P{constructor(t={}){this.container=t.container||null,this.latex=t.latex||"",this.editable=t.editable!==!1,this.mode=t.mode||"math",this.onUpdate=t.onUpdate||(()=>{}),this.editor=t.editor||nt(),this.element=null,this.mathField=null,this.container&&this.mount(this.container)}mount(t){this.container=t,this.element=document.createElement("span"),this.element.className="digi-math-widget"+(this.editable?"":" readonly"),this.element.setAttribute("data-latex",this.latex),this.element.title=this.editable?"Click to edit formula":"",this.mathField=document.createElement("math-field"),this.mathField.setAttribute("read-only","true"),this.mathField.textContent=this.latex,this.element.appendChild(this.mathField),this.editable&&this.element.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),this.openEditor()}),this.container.appendChild(this.element)}openEditor(){this.editor.open(this.latex,this.mode),this.editor.onInsert=t=>{this.setLatex(t),this.onUpdate(t)}}setLatex(t){if(this.latex=t||"",this.element&&this.element.setAttribute("data-latex",this.latex),this.mathField)try{typeof this.mathField.setValue=="function"?this.mathField.setValue(this.latex):this.mathField.textContent=this.latex}catch{this.mathField.textContent=this.latex}}getLatex(){return this.latex}destroy(){this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}}function ht(n){return new P(n)}if(typeof customElements<"u"&&!customElements.get("digi-math-widget")){class n extends HTMLElement{static get observedAttributes(){return["latex","editable","mode"]}connectedCallback(){const e=this.getAttribute("latex")||"",r=this.getAttribute("editable")!=="false",s=this.getAttribute("mode")||"math";this.widget=new P({container:this,latex:e,editable:r,mode:s,onUpdate:o=>{this.setAttribute("latex",o),this.dispatchEvent(new CustomEvent("latexChange",{detail:{latex:o},bubbles:!0}))}})}attributeChangedCallback(e,r,s){r!==s&&e==="latex"&&this.widget&&this.widget.setLatex(s)}disconnectedCallback(){this.widget&&this.widget.destroy()}}customElements.define("digi-math-widget",n)}const ct=A==null?void 0:A.version;u.CME_SHADOW_DOM_CSS=X,u.DigiMathChemEditor=R,u.DigiMathWidget=P,u.SpecialCharacterModal=G,u.VERSION=ct,u.createMathWidget=ht,u.default=R,u.initMathFieldCursorFix=K,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- @import"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap";.cme-flip-v{display:inline-block;transform:scaleY(-1)}.cme-prescript .ML__msubsup,.cme-prescript .ML__vlist-t,.cme-prescript .ML__vlist-r,.cme-prescript .ML__vlist,.cme-prescript .ML__vlist>span{text-align:right!important}.cme-wrapper{display:flex;flex-direction:column;border:none;border-radius:4px;overflow:visible;background:transparent;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif}.cme-tabs{display:flex;background:#f4f7f9;padding:4px 12px 0;gap:2px;border-bottom:1px solid #cccccc}.cme-tab{display:inline-flex;align-items:center;gap:6px;padding:8px 16px;border:1px solid #40596b;border-bottom:none;background:#517085;color:#fff;font-size:11px;font-weight:600;cursor:pointer;transition:background .12s,color .12s;border-top-left-radius:4px;border-top-right-radius:4px}.cme-tab:hover{background:#5b7e95}.cme-tab.active{background:#fff;color:#333;border-color:#ccc;border-bottom-color:#fff;margin-bottom:-1px;z-index:2}.cme-tab svg{width:14px;height:14px;opacity:.9}.cme-toolbar{background:#f4f7f9;padding:0;display:flex;flex-direction:column;overflow:visible;position:relative}.cme-toolbar-groups{display:flex;flex-wrap:wrap;align-items:flex-end;background:#f4f7f9;padding:8px 8px 0 13px;gap:3px;border:none}.cme-group-tab{background:linear-gradient(to bottom,#64b5f6,#42a5f5,#1e88e5);border:none;border-bottom:none;border-top-left-radius:5px;border-top-right-radius:5px;padding:0;width:44px;margin:0;font-size:11px;font-weight:700;color:#fff;cursor:pointer;white-space:nowrap;position:relative;z-index:1;height:22px;display:inline-flex;align-items:center;justify-content:center}.cme-group-tab:not(.active):hover{background:linear-gradient(to bottom,#64b5f6,#1e88e5)!important;color:#fff;box-shadow:0 -2px 6px #42a5f559}.cme-group-tab.active{background:linear-gradient(to bottom,#d8dbe0,#f4f7f9);color:#1565c0;border:1px solid #778E9A;border-bottom:none;border-top-left-radius:5px;border-top-right-radius:5px;padding:0;width:44px;margin:0 0 -2px;font-size:11px;font-weight:700;cursor:pointer;white-space:nowrap;position:relative;z-index:2;height:28px;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;box-shadow:0 -2px 8px #42a5f533}.cme-toolbar-items{background:linear-gradient(to bottom,#f4f7f9,#d8dbe0);border:1px solid #778E9A;margin:0 8px;padding:0;display:flex;flex-direction:row;align-items:stretch;gap:0;position:relative;left:5px;overflow-x:auto;overflow-y:hidden;width:calc(100% - 27px);box-sizing:border-box;height:85px;box-shadow:inset 0 1px 3px #fff9}.cme-toolbar-items::-webkit-scrollbar{height:5px}.cme-toolbar-items::-webkit-scrollbar-track{background:transparent}.cme-toolbar-items::-webkit-scrollbar-thumb{background:#b2c4d0;border-radius:3px}.cme-toolbar-items::-webkit-scrollbar-thumb:hover{background:#517085}.cme-symbol-subgroup{display:grid;grid-template-columns:repeat(2,auto);grid-template-rows:repeat(2,auto);gap:1px;padding:0 4px;border-right:1px solid #b2c4d0;flex-shrink:0;align-content:center;justify-content:center;align-items:center;margin:4px 0}.cme-symbol-subgroup:last-child{border-right:none}.cme-btn{min-width:26px;height:28px;padding:0 2px;border:1px solid transparent;border-radius:2px;background:transparent;color:#000;font-size:13px;font-weight:700;font-family:"Latin Modern Math","STIX Two Math",Times New Roman,serif;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;transition:background .1s,border-color .1s;white-space:nowrap;line-height:1;-webkit-user-select:none;user-select:none;box-sizing:border-box}.cme-btn:hover{background:#e8f4ff;border-color:#42a5f5;box-shadow:0 1px 3px #42a5f533}.cme-btn:active{background:#bbdefb;border-color:#1e88e5}.cme-btn.template{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;font-size:11px;font-weight:500;color:#000}.cme-select{height:24px;font-size:10.5px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;color:#333;background-color:#fff;border:1px solid #b2c4d0;border-radius:2px;padding:0 3px;cursor:pointer;outline:none;box-sizing:border-box;text-overflow:ellipsis;white-space:nowrap;line-height:22px;transition:border-color .12s,background-color .12s}.cme-select:hover{border-color:#42a5f5;background-color:#f0f7ff}.cme-select:focus{border-color:#1e88e5;box-shadow:0 0 0 1px #1e88e54d}.cme-select.active{border-color:#1e88e5;background-color:#e3f2fd;color:#1565c0;font-weight:600}.cme-select-font,.cme-select-size{width:75px}.cme-symbol-subgroup--small .cme-btn{min-width:22px;height:24px;font-size:14px;padding:0 1px}.cme-btn.cme-small-btn{min-width:22px!important;width:22px!important;height:22px!important;font-size:12px!important;padding:0 1px!important}.cme-dark-large .cme-btn{min-width:26px;height:28px;font-size:16px;font-weight:500;color:#151515}.cme-dark-large .cme-btn:hover{background:#e8f4ff;border-color:#42a5f5;box-shadow:0 1px 3px #42a5f533}.cme-matrix-subgroup .cme-btn{max-width:42px;height:40px;font-weight:700;font-size:12px!important}.cme-matrix-subgroup .cme-btn:hover{background:#e8f4ff;border-color:#42a5f5;box-shadow:0 1px 3px #42a5f533}.cme-more-popup-btn.cme-matrix-subgroup{min-width:12px;height:40px;font-weight:700;font-size:12px!important}.cme-more-popup-btn.cme-matrix-subgroup math-field{font-size:10px!important}.cme-trig-subgroup .cme-btn{font-size:15px;font-weight:800;min-width:32px;height:28px}.cme-matrix-subgroup math-field{font-size:10px!important}.cme-btn.chem-element{font-weight:700;font-size:12px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;color:#000;background:transparent}.cme-btn.chem-element:hover{background:#e8f4ff;border-color:#42a5f5}.pt-alkali{background-color:#ff9800!important;color:#000!important}.pt-alkaline{background-color:#ffeb3b!important;color:#000!important}.pt-transition{background-color:#fa709a!important;color:#000!important}.pt-lanthanide{background-color:#ffa07a!important;color:#000!important}.pt-actinide{background-color:#fa709a!important;color:#000!important}.pt-metalloid{background-color:#00e5ff!important;color:#000!important}.pt-nonmetal{background-color:#0f0!important;color:#000!important}.pt-noble{background-color:#84ffff!important;color:#000!important}.pt-unknown{background-color:#fff!important;color:#000!important}.pt-empty{visibility:hidden!important;pointer-events:none!important;border:none!important;background:transparent!important}.cme-more-popup-btn[class*=pt-]{font-size:11px;min-width:24px;height:20px;line-height:1;font-family:Arial,sans-serif;font-weight:700;border-radius:1px;border:1px solid rgba(0,0,0,.1);margin:0;padding:0}.cme-btn.chem-arrow,.cme-btn.chem-state{font-size:12px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;background:transparent;color:#000}.cme-btn.chem-arrow:hover,.cme-btn.chem-state:hover{background:#e8f4ff;border-color:#42a5f5}.cme-sep{width:1px;height:20px;background:#b2c4d0;margin:0 4px;flex-shrink:0}.cme-mathfield-container{background:#fff;border:1px solid #b2c4d0;border-radius:4px;margin:1px 12px;flex:1;min-height:140px;max-height:180px;overflow:auto;-webkit-overflow-scrolling:touch;touch-action:pan-y;display:block;box-sizing:border-box;position:relative}.cme-mathfield-container::-webkit-scrollbar,math-field.cme-mathfield::-webkit-scrollbar{width:8px;height:8px}.cme-mathfield-container::-webkit-scrollbar-track,math-field.cme-mathfield::-webkit-scrollbar-track{background:#fff}.cme-mathfield-container::-webkit-scrollbar-thumb,math-field.cme-mathfield::-webkit-scrollbar-thumb{background:#7c7474;border-radius:4px}.cme-mathfield-container::-webkit-scrollbar-thumb:hover,math-field.cme-mathfield::-webkit-scrollbar-thumb:hover{background:#999}math-field.cme-mathfield{display:block;width:max-content;min-width:100%;height:max-content;min-height:100%;padding:0;font-size:20px;outline:none;border:none;background:transparent;box-sizing:border-box;cursor:text;overflow:visible!important;--hue: 207;--primary-color: #1E88E5;--caret-color: #42A5F5;--selection-background-color: rgba(66, 165, 245, .18);--selection-color: #1565C0;--contains-highlight-background-color: transparent;--smart-fence-color: #1E88E5;--text-font-family: "Times New Roman", Times, serif;--highlight-inactive-color: transparent;--text-highlight-background-color: transparent}math-field.cme-mathfield:focus-within{background:#fff}math-field.cme-mathfield::part(container){min-height:40px;align-items:flex-start;padding-top:0;padding-bottom:14px;overflow:auto}math-field.cme-mathfield::part(virtual-keyboard-toggle){display:none}.cme-footer{display:flex;align-items:center;justify-content:space-between;padding:6px 12px;background:#f4f7f9;border-top:1px solid #cccccc;font-size:11px;color:#64748b;gap:8px}.cme-mode-badge{display:inline-flex;align-items:center;gap:4px;padding:2px 8px;border-radius:3px;font-weight:700;font-size:10px;text-transform:uppercase;flex-shrink:0}.cme-mode-badge.math{background:#e1f0fc;color:#005a9e}.cme-mode-badge.chem{background:#e2f6e9;color:#107c41}.cme-hint{font-size:10px;color:#888}.Input-question-box{padding:0;background:transparent;width:100%}math-field.cme-main-mathfield{display:block;width:100%;min-height:48px;max-height:150px;padding:12px;border:1px solid #cbd5e1;border-radius:8px;font-size:16px;font-family:Inter,sans-serif;box-sizing:border-box;outline:none;background:#fff;transition:border-color .2s,box-shadow .2s;cursor:text;overflow-y:auto!important;overflow-x:hidden!important;-webkit-overflow-scrolling:touch;touch-action:pan-y}math-field.cme-main-mathfield:focus-within{border-color:#778e9a;box-shadow:0 0 0 2px #5b7b9033}math-field.cme-main-mathfield::part(container){align-items:flex-start;padding-top:14px;padding-bottom:14px;overflow:auto}math-field.cme-main-mathfield::part(virtual-keyboard-toggle),math-field.cme-main-mathfield::part(menu-toggle){display:none}.cme-editor-popup{position:fixed;bottom:55px;right:24px;width:620px;height:auto;min-height:300px;background:#f4f7f9;border:1px solid #99b1c1;border-radius:6px;box-shadow:0 4px 20px #0003;z-index:99990;display:flex;flex-direction:column;overflow:visible;box-sizing:border-box;animation:slideUp .2s ease-out}@keyframes slideUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}.cme-popup-topbar{display:flex;align-items:center;justify-content:space-between;padding:6px 12px;background:linear-gradient(135deg,#42a5f5,#47a6ef);color:#fff;border-top-left-radius:5px;border-top-right-radius:5px;height:32px;box-sizing:border-box}.cme-popup-header{flex:1;display:flex;align-items:center;height:100%;font-weight:500;font-size:13px}.cme-popup-controls{display:flex;align-items:center;gap:15px;margin-left:auto}.cme-popup-btn{background:transparent;border:none;color:#fff;font-size:14px;line-height:1;cursor:pointer;opacity:.85;transition:opacity .15s;font-family:monospace;padding:0;display:flex;align-items:center;justify-content:center}.cme-popup-btn:hover{opacity:1}.cme-editor-popup.maximized{top:0!important;left:0!important;right:0!important;bottom:0!important;margin:auto!important;width:90vw!important;height:90vh!important;max-width:1000px!important;max-height:600px!important}.cme-editor-popup.maximized .cme-mathfield-container{max-height:none!important}.cme-editor-popup.maximized .cme-popup-footer{width:100%!important;right:0!important}.cme-editor-popup.minimized{top:auto!important;left:auto!important;bottom:24px!important;right:24px!important;width:300px!important;height:32px!important;min-height:0!important;overflow:hidden!important}.cme-popup-footer{padding:10px 12px;background:#f4f7f9;width:620px;position:relative;right:1px;display:flex;align-items:center;justify-content:flex-start;gap:8px;border-left:1px solid #99b1c1;border-right:1px solid #99b1c1;border-bottom:1px solid #99b1c1;border-bottom-left-radius:5px;border-bottom-right-radius:5px;box-sizing:border-box}.cme-popup-version{margin-left:auto;font-size:11px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;color:#778e9a;font-weight:500;user-select:text!important;-webkit-user-select:text!important;-moz-user-select:text!important;-ms-user-select:text!important;cursor:text;letter-spacing:.2px;padding:2px 4px;border-radius:3px}.cme-insert-btn{background:linear-gradient(135deg,#42a5f5,#1976d2);color:#fff;border:none;padding:6px 20px;border-radius:4px;font-weight:500;font-size:12px;cursor:pointer;transition:background .18s,box-shadow .18s,transform .1s;box-shadow:0 2px 10px #42a5f566}.cme-insert-btn:hover{background:linear-gradient(135deg,#1e88e5,#1565c0);box-shadow:0 4px 14px #42a5f580;transform:translateY(-1px)}.cme-cancel-btn{background:#e0e0e0;color:#333;border:1px solid #b8b8b8;padding:6px 20px;border-radius:4px;font-weight:500;font-size:12px;cursor:pointer;transition:background .15s,border-color .15s}.cme-cancel-btn:hover{background:#d4d4d4;border-color:#a6a6a6}@media (max-width: 640px){.cme-editor-popup{width:auto;left:12px;right:12px;bottom:12px}.cme-group-tab{padding:4px 6px;font-size:10px}}.cme-matrix-selector{padding:12px;display:flex;flex-direction:column;align-items:center;background:#fff;border-bottom:1px solid #cccccc}.cme-matrix-label{font-size:13px;font-weight:600;color:#1565c0;margin-bottom:8px;-webkit-user-select:none;user-select:none}.cme-matrix-grid{display:grid;grid-template-columns:repeat(10,20px);grid-template-rows:repeat(10,20px);gap:2px;justify-content:center}.cme-matrix-cell{width:20px;height:20px;border:1px solid #DDEEFF;border-radius:3px;background:#fff;cursor:pointer;transition:background .1s,border-color .1s}.cme-matrix-cell.selected{background:linear-gradient(135deg,#64b5f6,#1976d2);border-color:#1976d2}.cme-matrix-btn-wrapper{position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:100%}.cme-matrix-hover-popover{position:fixed;transform:translate(-50%);margin-top:6px;background:#fff;border:1px solid #acacac;border-radius:4px;box-shadow:0 4px 12px #00000026;padding:8px;z-index:99995;display:flex;flex-direction:column;align-items:center;gap:6px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif}.cme-matrix-hover-title{font-size:10px;font-weight:700;color:#333;text-align:center;white-space:nowrap;letter-spacing:.05em;text-transform:uppercase}.cme-matrix-hover-grid{display:flex;flex-direction:column;gap:2px;background:#f7f7f7;padding:2px;border-radius:2px;border:1px solid #d3d3d3;flex:1}.cme-matrix-hover-row{display:flex;gap:2px}.cme-matrix-hover-cell{width:14px;height:14px;border:1px solid #d3d3d3;border-radius:0;background:#fff;cursor:pointer;transition:background-color .1s,border-color .1s}.cme-matrix-hover-cell:hover{background-color:#f9e6cb;border-color:#4a90e2}.cme-matrix-hover-cell.selected{background-color:#778e9a;border-color:#4a687c}.cme-matrix-hover-footer{display:flex;align-items:center;gap:6px;flex:1;width:100%;border-top:1px solid #e2e8f0;padding-top:0;margin-top:0}.cme-matrix-counter{display:flex;align-items:center;gap:4px;font-size:20px;font-weight:900;color:#333}.cme-counter-val{width:32px;text-align:center;background:#fff;border-radius:2px;padding:1px 2px;font-family:monospace;font-size:20px;font-weight:600;color:#000;border:1px solid #d3d3d3;box-sizing:border-box}input.cme-counter-val{outline:none}input.cme-counter-val:focus{border-color:#778e9a;box-shadow:0 0 0 1px #5b7b9033}input.cme-counter-val::-webkit-outer-spin-button,input.cme-counter-val::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input.cme-counter-val[type=number]{-webkit-appearance:textfield;appearance:textfield;-moz-appearance:textfield}.cme-counter-btns{display:flex;flex-direction:column;gap:1px}.cme-counter-btns button{background:#e2e8f0;border:none;border-radius:1px;color:#334155;font-size:10px;width:16px;height:20px;cursor:pointer;display:flex;align-items:center;justify-content:center;line-height:1;padding:0;transition:background .1s}.cme-counter-btns button:hover{background:#cbd5e1;color:#778e9a}.cme-matrix-insert-btn{background:#778e9a;color:#fff;border:none;padding:2px 6px;border-radius:2px;font-weight:700;font-size:9px;cursor:pointer;transition:background .15s;text-transform:uppercase;margin-left:auto}.cme-matrix-insert-btn:hover{background:#47667a}.cme-matrix-hover-popover.ck-only{min-width:101px;min-height:120px;width:auto;height:auto;box-sizing:border-box;padding:6px;gap:4px;display:flex;flex-direction:column;align-items:stretch}.cme-matrix-hover-popover.ck-only .cme-matrix-hover-grid{display:flex;flex-direction:column;padding:2px;gap:2px;border:1px solid #acacac;border-radius:2px;overflow:hidden}.cme-matrix-hover-popover.ck-only .cme-matrix-hover-row{display:flex;gap:2px}.cme-matrix-hover-popover.ck-only .cme-matrix-hover-cell{width:12px;height:12px;flex-shrink:0;border:.5px solid #d3d3d3;border-radius:0;box-sizing:border-box}.cme-matrix-hover-popover.ck-only .cme-matrix-hover-footer{border-top:1px solid #e2e8f0;padding-top:4px;margin-top:auto;justify-content:space-around;gap:4px}.cme-matrix-hover-popover.ck-only .cme-matrix-counter{gap:2px;font-size:12px}.cme-matrix-hover-popover.ck-only input.cme-counter-val{min-width:10px;width:22px;font-size:12px;padding:0 2px;height:16px;background:#fff;border:1px solid #d3d3d3}.cme-matrix-hover-popover.ck-only .cme-counter-btns button{width:10px;height:7px;font-size:5px}.cme-btn.active,.cme-select.active{background-color:#fcf4b6!important;border-color:#e6c229!important;color:#000!important}.cme-btn,.cme-btn *,.cme-btn math-field,.cme-matrix-btn-wrapper,.cme-matrix-btn-wrapper button,.cme-matrix-btn-wrapper button *{cursor:pointer!important}.cme-group-tab,.cme-group-tab *{cursor:pointer!important}.cme-group-tab math-field{pointer-events:none!important;-webkit-user-select:none!important;user-select:none!important}.cme-subgroup-has-more{padding-right:10px}.cme-more-trigger-btn{position:absolute;top:0;right:2px;width:7px;height:100%;background:transparent;border:none;color:#1976d2;font-size:9px;cursor:pointer;display:flex;align-items:center;justify-content:flex-end;padding-bottom:3px;z-index:10;writing-mode:vertical-rl;letter-spacing:2px;transition:background .15s,color .15s;-webkit-user-select:none;user-select:none;line-height:1}.cme-more-trigger-btn:hover{background:#5fb2f7;color:#fff;border-color:#1976d2}.cme-more-popup{position:fixed;z-index:99999;background:linear-gradient(to bottom,#f5faff,#e8f4ff);border:1px solid #90CAF9;border-radius:5px;box-shadow:0 4px 14px #0000002e;padding:9px 0;display:grid;gap:1px;min-width:25px;animation:cmeMoreFadeIn .12s ease-out}@keyframes cmeMoreFadeIn{0%{opacity:0;transform:translate(-4px)}to{opacity:1;transform:translate(0)}}.cme-more-popup--shift-left{transform:translate(calc(-100% + 14px))!important}.cme-more-popup-btn{min-width:30px;height:32px;padding:0 2px;border:1px solid transparent;border-radius:3px;background:transparent;color:#000;font-size:14px;font-weight:700;font-family:"Latin Modern Math","STIX Two Math",Times New Roman,serif;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;transition:background .1s,border-color .1s;-webkit-user-select:none;user-select:none;box-sizing:border-box;white-space:nowrap}.cme-more-popup-btn:hover{background:#e8f4ff;border-color:#42a5f5;box-shadow:0 1px 3px #42a5f533}.cme-more-popup-btn:active{background:#bbdefb;border-color:#1e88e5}.cme-enclose-circle{display:inline-block;border:1px solid currentColor;border-radius:50%;padding:.1em .3em;text-align:center}.ML__bold{font-weight:700!important}.cme-bold{font-weight:700!important;font-family:inherit!important}.cme-confirm-overlay{position:absolute;top:0;left:0;width:100%;height:100%;background:#0006;z-index:99999;display:flex;align-items:center;justify-content:center;border-radius:inherit}.cme-confirm-modal{background:#fff;border-radius:4px;padding:20px;width:380px;max-width:90%;box-shadow:0 4px 12px #00000026;font-family:sans-serif;color:#333}.cme-confirm-modal p{margin:0 0 20px;font-size:14px;line-height:1.5}.cme-confirm-actions{display:flex;justify-content:flex-start;gap:10px}.cme-confirm-close-btn{background:#768a96;color:#fff;border:none;padding:8px 16px;border-radius:4px;cursor:pointer;font-size:14px}.cme-confirm-close-btn:hover{background:#627581}.cme-confirm-cancel-btn{background:#e0e0e0;color:#333;border:1px solid #ccc;padding:8px 16px;border-radius:4px;cursor:pointer;font-size:14px}.cme-confirm-cancel-btn:hover{background:#d0d0d0}.ck-math-widget{display:inline-flex!important;align-items:center!important;width:fit-content!important;max-width:100%!important;margin-left:0!important;margin-right:0!important;padding:0!important;vertical-align:middle!important;line-height:normal!important;box-sizing:border-box!important}.ck-math-widget-inner{display:inline-flex!important;align-items:center!important;width:fit-content!important;max-width:100%!important;margin:0!important;padding:0!important}.ck-math-widget math-field{display:inline-block!important;width:auto!important;max-width:100%!important;height:auto!important;min-height:unset!important;margin:0!important;padding:0!important;vertical-align:middle!important;box-sizing:content-box!important}.math-tex{display:inline!important}.ck-math-widget .ck-widget__type-around,.ck-math-widget .ck-widget__type-around__button,.ck-math-widget .ck-widget__type-around__button--before,.ck-math-widget .ck-widget__type-around__button--after,.ck-math-widget>.ck-widget__type-around>button{display:none!important;visibility:hidden!important;width:0!important;height:0!important;opacity:0!important;pointer-events:none!important}.ck.ck-editor__editable .ck-widget.ck-math-widget .ck-widget__type-around,.ck.ck-editor__editable .ck-widget.ck-math-widget .ck-widget__type-around__button{display:none!important}.ck.ck-editor__editable .ck-widget.ck-math-widget{outline:none!important;border-radius:0!important;width:fit-content!important;max-width:100%!important}.ck.ck-editor__editable .ck-widget.ck-math-widget.ck-widget_selected,.ck.ck-editor__editable .ck-widget.ck-math-widget.ck-widget_selected:focus{outline:none!important;border-radius:0!important}.ck.ck-editor__editable .ck-widget.ck-math-widget:before,.ck.ck-editor__editable .ck-widget.ck-math-widget:after{display:none!important;content:none!important}.ck.ck-editor__editable .ck-widget.ck-math-widget:hover{box-shadow:0 0 0 2px #f97316!important;border-radius:2px!important;transition:box-shadow .15s ease,border-radius .15s ease}.ck.ck-editor__editable .ck-widget.ck-math-widget.ck-widget_selected{box-shadow:0 0 0 2px #2563eb!important;border-radius:2px!important;outline:none!important;transition:box-shadow .15s ease}.ck.ck-editor__editable .ck-widget.ck-math-widget.ck-widget_selected:focus{box-shadow:0 0 0 2px #2563eb!important;border-radius:2px!important;outline:none!important}.ck.ck-editor__editable .ck-widget.ck-math-widget.ck-widget_selected:hover{box-shadow:0 0 0 2px #2563eb!important;border-radius:2px!important}.scm-overlay{position:fixed;top:0;right:0;bottom:0;left:0;z-index:99999}.scm-modal{position:absolute;background:#fff;border-radius:4px;box-shadow:0 4px 12px #00000026;width:225px;height:188.2px;display:flex;flex-direction:column;overflow:hidden;font-family:system-ui,-apple-system,sans-serif;border:1px solid #e5e7eb}.scm-toolbar{display:flex;align-items:center;gap:4px;height:20px;padding:2px 4px;background-color:#fff;border-bottom:1px solid #e5e7eb;box-sizing:border-box}.scm-code-input{width:65px;height:15px;border:1px solid #dbd6d1;border-radius:3px;font-size:11px;outline:none;box-sizing:border-box}.scm-code-input:focus{border-color:#1b75bb}.scm-category-select{flex:1;height:15px;padding:0 2px;border:1px solid #d1d5db;border-radius:3px;font-size:11px;outline:none;box-sizing:border-box}.scm-category-select:focus{border-color:#1b75bb}.scm-body{flex:1;background-color:#f9fafb;overflow:hidden}.scm-grid-container{height:100%;overflow-y:auto;padding:4px}.scm-grid-container::-webkit-scrollbar{width:6px}.scm-grid-container::-webkit-scrollbar-track{background:#f1f1f1}.scm-grid-container::-webkit-scrollbar-thumb{background:#c1c1c1;border-radius:3px}.scm-char-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(24px,1fr));gap:2px}.scm-char-btn{background:#fff;border:1px solid #e5e7eb;border-radius:2px;height:24px;display:flex;align-items:center;justify-content:center;font-size:14px;cursor:pointer;color:#111827;padding:0}.scm-char-btn:hover{background-color:#f3f4f6;border-color:#d1d5db}.scm-no-results{text-align:center;padding:16px 0;color:#6b7280;font-size:11px}.digi-math-widget{display:inline-flex;align-items:center;position:relative;vertical-align:middle;padding:2px 6px;margin:0 2px;border-radius:4px;border:1px solid transparent;background-color:#00000005;cursor:pointer;-webkit-user-select:none;user-select:none;transition:all .15s ease-in-out;box-sizing:border-box}.digi-math-widget:hover{background-color:#2e7d3214;border-color:#2e7d32;box-shadow:0 1px 3px #2e7d3233}.digi-math-widget math-field{pointer-events:none;border:none!important;background:transparent!important;padding:0!important;margin:0!important;font-size:1.05em}.digi-math-widget:after{content:"✎";font-size:10px;color:#2e7d32;margin-left:4px;opacity:0;transition:opacity .15s ease}.digi-math-widget:hover:after{opacity:1}.digi-math-widget.readonly{cursor:default;background:transparent;border-color:transparent}.digi-math-widget.readonly:hover{background:transparent;border-color:transparent;box-shadow:none}.digi-math-widget.readonly:after{display:none}
1
+ @import"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap";.cme-flip-v{display:inline-block;transform:scaleY(-1)}.cme-prescript .ML__msubsup,.cme-prescript .ML__vlist-t,.cme-prescript .ML__vlist-r,.cme-prescript .ML__vlist,.cme-prescript .ML__vlist>span{text-align:right!important}.cme-wrapper{display:flex;flex-direction:column;border:none;border-radius:4px;overflow:visible;background:transparent;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif}.cme-tabs{display:flex;background:#f4f7f9;padding:4px 12px 0;gap:2px;border-bottom:1px solid #cccccc}.cme-tab{display:inline-flex;align-items:center;gap:6px;padding:8px 16px;border:1px solid #40596b;border-bottom:none;background:#517085;color:#fff;font-size:11px;font-weight:600;cursor:pointer;transition:background .12s,color .12s;border-top-left-radius:4px;border-top-right-radius:4px}.cme-tab:hover{background:#5b7e95}.cme-tab.active{background:#fff;color:#333;border-color:#ccc;border-bottom-color:#fff;margin-bottom:-1px;z-index:2}.cme-tab svg{width:14px;height:14px;opacity:.9}.cme-toolbar{background:#f4f7f9;padding:0;display:flex;flex-direction:column;overflow:visible;position:relative}.cme-toolbar-groups{display:flex;flex-wrap:wrap;align-items:flex-end;background:#f4f7f9;padding:8px 8px 0 13px;gap:3px;border:none}.cme-group-tab{background:linear-gradient(to bottom,#64b5f6,#42a5f5,#1e88e5);border:none;border-bottom:none;border-top-left-radius:5px;border-top-right-radius:5px;padding:0;width:44px;margin:0;font-size:11px;font-weight:700;color:#fff;cursor:pointer;white-space:nowrap;position:relative;z-index:1;height:22px;display:inline-flex;align-items:center;justify-content:center}.cme-group-tab:not(.active):hover{background:linear-gradient(to bottom,#64b5f6,#1e88e5)!important;color:#fff;box-shadow:0 -2px 6px #42a5f559}.cme-group-tab.active{background:linear-gradient(to bottom,#d8dbe0,#f4f7f9);color:#1565c0;border:1px solid #778E9A;border-bottom:none;border-top-left-radius:5px;border-top-right-radius:5px;padding:0;width:44px;margin:0 0 -2px;font-size:11px;font-weight:700;cursor:pointer;white-space:nowrap;position:relative;z-index:2;height:28px;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;box-shadow:0 -2px 8px #42a5f533}.cme-toolbar-items{background:linear-gradient(to bottom,#f4f7f9,#d8dbe0);border:1px solid #778E9A;margin:0 8px;padding:0;display:flex;flex-direction:row;align-items:stretch;gap:0;position:relative;left:5px;overflow-x:auto;overflow-y:hidden;width:calc(100% - 27px);box-sizing:border-box;height:85px;box-shadow:inset 0 1px 3px #fff9}.cme-toolbar-items::-webkit-scrollbar{height:5px}.cme-toolbar-items::-webkit-scrollbar-track{background:transparent}.cme-toolbar-items::-webkit-scrollbar-thumb{background:#b2c4d0;border-radius:3px}.cme-toolbar-items::-webkit-scrollbar-thumb:hover{background:#517085}.cme-symbol-subgroup{display:grid;grid-template-columns:repeat(2,auto);grid-template-rows:repeat(2,auto);gap:1px;padding:0 4px;border-right:1px solid #b2c4d0;flex-shrink:0;align-content:center;justify-content:center;align-items:center;margin:4px 0}.cme-symbol-subgroup:last-child{border-right:none}.cme-btn{min-width:26px;height:28px;padding:0 2px;border:1px solid transparent;border-radius:2px;background:transparent;color:#000;font-size:13px;font-weight:700;font-family:"Latin Modern Math","STIX Two Math",Times New Roman,serif;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;transition:background .1s,border-color .1s;white-space:nowrap;line-height:1;-webkit-user-select:none;user-select:none;box-sizing:border-box}.cme-btn:hover{background:#e8f4ff;border-color:#42a5f5;box-shadow:0 1px 3px #42a5f533}.cme-btn:active{background:#bbdefb;border-color:#1e88e5}.cme-btn.template{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;font-size:11px;font-weight:500;color:#000}.cme-select{height:24px;font-size:10.5px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;color:#333;background-color:#fff;border:1px solid #b2c4d0;border-radius:2px;padding:0 3px;cursor:pointer;outline:none;box-sizing:border-box;text-overflow:ellipsis;white-space:nowrap;line-height:22px;transition:border-color .12s,background-color .12s}.cme-select:hover{border-color:#42a5f5;background-color:#f0f7ff}.cme-select:focus{border-color:#1e88e5;box-shadow:0 0 0 1px #1e88e54d}.cme-select.active{border-color:#1e88e5;background-color:#e3f2fd;color:#1565c0;font-weight:600}.cme-select-font,.cme-select-size{width:75px}.cme-symbol-subgroup--small .cme-btn{min-width:22px;height:24px;font-size:14px;padding:0 1px}.cme-btn.cme-small-btn{min-width:22px!important;width:22px!important;height:22px!important;font-size:12px!important;padding:0 1px!important}.cme-dark-large .cme-btn{min-width:26px;height:28px;font-size:16px;font-weight:500;color:#151515}.cme-dark-large .cme-btn:hover{background:#e8f4ff;border-color:#42a5f5;box-shadow:0 1px 3px #42a5f533}.cme-matrix-subgroup .cme-btn{max-width:42px;height:40px;font-weight:700;font-size:12px!important}.cme-matrix-subgroup .cme-btn:hover{background:#e8f4ff;border-color:#42a5f5;box-shadow:0 1px 3px #42a5f533}.cme-more-popup-btn.cme-matrix-subgroup{min-width:12px;height:40px;font-weight:700;font-size:12px!important}.cme-more-popup-btn.cme-matrix-subgroup math-field{font-size:10px!important}.cme-trig-subgroup .cme-btn{font-size:15px;font-weight:800;min-width:32px;height:28px}.cme-matrix-subgroup math-field{font-size:10px!important}.cme-btn.chem-element{font-weight:700;font-size:12px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;color:#000;background:transparent}.cme-btn.chem-element:hover{background:#e8f4ff;border-color:#42a5f5}.pt-alkali{background-color:#ff9800!important;color:#000!important}.pt-alkaline{background-color:#ffeb3b!important;color:#000!important}.pt-transition{background-color:#fa709a!important;color:#000!important}.pt-lanthanide{background-color:#ffa07a!important;color:#000!important}.pt-actinide{background-color:#fa709a!important;color:#000!important}.pt-metalloid{background-color:#00e5ff!important;color:#000!important}.pt-nonmetal{background-color:#0f0!important;color:#000!important}.pt-noble{background-color:#84ffff!important;color:#000!important}.pt-unknown{background-color:#fff!important;color:#000!important}.pt-empty{visibility:hidden!important;pointer-events:none!important;border:none!important;background:transparent!important}.cme-more-popup-btn[class*=pt-]{font-size:11px;min-width:24px;height:20px;line-height:1;font-family:Arial,sans-serif;font-weight:700;border-radius:1px;border:1px solid rgba(0,0,0,.1);margin:0;padding:0}.cme-btn.chem-arrow,.cme-btn.chem-state{font-size:12px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;background:transparent;color:#000}.cme-btn.chem-arrow:hover,.cme-btn.chem-state:hover{background:#e8f4ff;border-color:#42a5f5}.cme-sep{width:1px;height:20px;background:#b2c4d0;margin:0 4px;flex-shrink:0}.cme-mathfield-container{background:#fff;border:1px solid #b2c4d0;border-radius:4px;margin:1px 12px;flex:1;min-height:140px;max-height:180px;overflow:auto;-webkit-overflow-scrolling:touch;touch-action:pan-y;display:block;box-sizing:border-box;position:relative}.cme-mathfield-container::-webkit-scrollbar,math-field.cme-mathfield::-webkit-scrollbar{width:8px;height:8px}.cme-mathfield-container::-webkit-scrollbar-track,math-field.cme-mathfield::-webkit-scrollbar-track{background:#fff}.cme-mathfield-container::-webkit-scrollbar-thumb,math-field.cme-mathfield::-webkit-scrollbar-thumb{background:#7c7474;border-radius:4px}.cme-mathfield-container::-webkit-scrollbar-thumb:hover,math-field.cme-mathfield::-webkit-scrollbar-thumb:hover{background:#999}math-field.cme-mathfield{display:block;width:max-content;min-width:100%;height:max-content;min-height:100%;padding:0;font-size:20px;outline:none;border:none;background:transparent;box-sizing:border-box;cursor:text;overflow:visible!important;--hue: 207;--primary-color: #1E88E5;--caret-color: #42A5F5;--selection-background-color: rgba(66, 165, 245, .18);--selection-color: #1565C0;--contains-highlight-background-color: transparent;--smart-fence-color: #1E88E5;--text-font-family: "Times New Roman", Times, serif;--highlight-inactive-color: transparent;--text-highlight-background-color: transparent}math-field.cme-mathfield:focus-within{background:#fff}math-field.cme-mathfield::part(container){min-height:40px;align-items:flex-start;padding-top:0;padding-bottom:14px;overflow:auto}math-field.cme-mathfield::part(virtual-keyboard-toggle){display:none}.cme-footer{display:flex;align-items:center;justify-content:space-between;padding:6px 12px;background:#f4f7f9;border-top:1px solid #cccccc;font-size:11px;color:#64748b;gap:8px}.cme-mode-badge{display:inline-flex;align-items:center;gap:4px;padding:2px 8px;border-radius:3px;font-weight:700;font-size:10px;text-transform:uppercase;flex-shrink:0}.cme-mode-badge.math{background:#e1f0fc;color:#005a9e}.cme-mode-badge.chem{background:#e2f6e9;color:#107c41}.cme-hint{font-size:10px;color:#888}.Input-question-box{padding:0;background:transparent;width:100%}math-field.cme-main-mathfield{display:block;width:100%;min-height:48px;max-height:150px;padding:12px;border:1px solid #cbd5e1;border-radius:8px;font-size:16px;font-family:Inter,sans-serif;box-sizing:border-box;outline:none;background:#fff;transition:border-color .2s,box-shadow .2s;cursor:text;overflow-y:auto!important;overflow-x:hidden!important;-webkit-overflow-scrolling:touch;touch-action:pan-y}math-field.cme-main-mathfield:focus-within{border-color:#778e9a;box-shadow:0 0 0 2px #5b7b9033}math-field.cme-main-mathfield::part(container){align-items:flex-start;padding-top:14px;padding-bottom:14px;overflow:auto}math-field.cme-main-mathfield::part(virtual-keyboard-toggle),math-field.cme-main-mathfield::part(menu-toggle){display:none}.cme-editor-popup{position:fixed;bottom:55px;right:24px;width:620px;height:auto;min-height:300px;background:#f4f7f9;border:1px solid #99b1c1;border-radius:6px;box-shadow:0 4px 20px #0003;z-index:99990;display:flex;flex-direction:column;overflow:visible;box-sizing:border-box;animation:slideUp .2s ease-out}@keyframes slideUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}.cme-popup-topbar{display:flex;align-items:center;justify-content:space-between;padding:6px 12px;background:linear-gradient(135deg,#42a5f5,#47a6ef);color:#fff;border-top-left-radius:5px;border-top-right-radius:5px;height:32px;box-sizing:border-box}.cme-popup-header{flex:1;display:flex;align-items:center;height:100%;font-weight:500;font-size:13px}.cme-popup-controls{display:flex;align-items:center;gap:15px;margin-left:auto}.cme-popup-btn{background:transparent;border:none;color:#fff;font-size:14px;line-height:1;cursor:pointer;opacity:.85;transition:opacity .15s;font-family:monospace;padding:0;display:flex;align-items:center;justify-content:center}.cme-popup-btn:hover{opacity:1}.cme-editor-popup.maximized{top:0!important;left:0!important;right:0!important;bottom:0!important;margin:auto!important;width:90vw!important;height:90vh!important;max-width:1000px!important;max-height:600px!important}.cme-editor-popup.maximized .cme-mathfield-container{max-height:none!important}.cme-editor-popup.maximized .cme-popup-footer{width:100%!important;right:0!important}.cme-editor-popup.minimized{top:auto!important;left:auto!important;bottom:24px!important;right:24px!important;width:300px!important;height:32px!important;min-height:0!important;overflow:hidden!important}.cme-popup-footer{padding:10px 12px;background:#f4f7f9;width:620px;position:relative;right:1px;display:flex;align-items:center;justify-content:flex-start;gap:8px;border-left:1px solid #99b1c1;border-right:1px solid #99b1c1;border-bottom:1px solid #99b1c1;border-bottom-left-radius:5px;border-bottom-right-radius:5px;box-sizing:border-box}.cme-popup-version{margin-left:auto;font-size:11px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;color:#778e9a;font-weight:500;user-select:text!important;-webkit-user-select:text!important;-moz-user-select:text!important;-ms-user-select:text!important;cursor:text;letter-spacing:.2px;padding:2px 4px;border-radius:3px}.cme-insert-btn{background:linear-gradient(135deg,#42a5f5,#1976d2);color:#fff;border:none;padding:6px 20px;border-radius:4px;font-weight:500;font-size:12px;cursor:pointer;transition:background .18s,box-shadow .18s,transform .1s;box-shadow:0 2px 10px #42a5f566}.cme-insert-btn:hover{background:linear-gradient(135deg,#1e88e5,#1565c0);box-shadow:0 4px 14px #42a5f580;transform:translateY(-1px)}.cme-cancel-btn{background:#e0e0e0;color:#333;border:1px solid #b8b8b8;padding:6px 20px;border-radius:4px;font-weight:500;font-size:12px;cursor:pointer;transition:background .15s,border-color .15s}.cme-cancel-btn:hover{background:#d4d4d4;border-color:#a6a6a6}@media (max-width: 640px){.cme-editor-popup{width:auto;left:12px;right:12px;bottom:12px}.cme-group-tab{padding:4px 6px;font-size:10px}}.cme-matrix-selector{padding:12px;display:flex;flex-direction:column;align-items:center;background:#fff;border-bottom:1px solid #cccccc}.cme-matrix-label{font-size:13px;font-weight:600;color:#1565c0;margin-bottom:8px;-webkit-user-select:none;user-select:none}.cme-matrix-grid{display:grid;grid-template-columns:repeat(10,20px);grid-template-rows:repeat(10,20px);gap:2px;justify-content:center}.cme-matrix-cell{width:20px;height:20px;border:1px solid #DDEEFF;border-radius:3px;background:#fff;cursor:pointer;transition:background .1s,border-color .1s}.cme-matrix-cell.selected{background:linear-gradient(135deg,#64b5f6,#1976d2);border-color:#1976d2}.cme-matrix-btn-wrapper{position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:100%}.cme-matrix-hover-popover{position:fixed;transform:translate(-50%);margin-top:6px;background:#fff;border:1px solid #acacac;border-radius:4px;box-shadow:0 4px 12px #00000026;padding:8px;z-index:99995;display:flex;flex-direction:column;align-items:center;gap:6px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif}.cme-matrix-hover-title{font-size:10px;font-weight:700;color:#333;text-align:center;white-space:nowrap;letter-spacing:.05em;text-transform:uppercase}.cme-matrix-hover-grid{display:flex;flex-direction:column;gap:2px;background:#f7f7f7;padding:2px;border-radius:2px;border:1px solid #d3d3d3;flex:1}.cme-matrix-hover-row{display:flex;gap:2px}.cme-matrix-hover-cell{width:14px;height:14px;border:1px solid #d3d3d3;border-radius:0;background:#fff;cursor:pointer;transition:background-color .1s,border-color .1s}.cme-matrix-hover-cell:hover{background-color:#f9e6cb;border-color:#4a90e2}.cme-matrix-hover-cell.selected{background-color:#778e9a;border-color:#4a687c}.cme-matrix-hover-footer{display:flex;align-items:center;gap:6px;flex:1;width:100%;border-top:1px solid #e2e8f0;padding-top:0;margin-top:0}.cme-matrix-counter{display:flex;align-items:center;gap:4px;font-size:20px;font-weight:900;color:#333}.cme-counter-val{width:32px;text-align:center;background:#fff;border-radius:2px;padding:1px 2px;font-family:monospace;font-size:20px;font-weight:600;color:#000;border:1px solid #d3d3d3;box-sizing:border-box}input.cme-counter-val{outline:none}input.cme-counter-val:focus{border-color:#778e9a;box-shadow:0 0 0 1px #5b7b9033}input.cme-counter-val::-webkit-outer-spin-button,input.cme-counter-val::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input.cme-counter-val[type=number]{-webkit-appearance:textfield;appearance:textfield;-moz-appearance:textfield}.cme-counter-btns{display:flex;flex-direction:column;gap:1px}.cme-counter-btns button{background:#e2e8f0;border:none;border-radius:1px;color:#334155;font-size:10px;width:16px;height:20px;cursor:pointer;display:flex;align-items:center;justify-content:center;line-height:1;padding:0;transition:background .1s}.cme-counter-btns button:hover{background:#cbd5e1;color:#778e9a}.cme-matrix-insert-btn{background:#778e9a;color:#fff;border:none;padding:2px 6px;border-radius:2px;font-weight:700;font-size:9px;cursor:pointer;transition:background .15s;text-transform:uppercase;margin-left:auto}.cme-matrix-insert-btn:hover{background:#47667a}.cme-matrix-hover-popover.ck-only{min-width:101px;min-height:120px;width:auto;height:auto;box-sizing:border-box;padding:6px;gap:4px;display:flex;flex-direction:column;align-items:stretch}.cme-matrix-hover-popover.ck-only .cme-matrix-hover-grid{display:flex;flex-direction:column;padding:2px;gap:2px;border:1px solid #acacac;border-radius:2px;overflow:hidden}.cme-matrix-hover-popover.ck-only .cme-matrix-hover-row{display:flex;gap:2px}.cme-matrix-hover-popover.ck-only .cme-matrix-hover-cell{width:12px;height:12px;flex-shrink:0;border:.5px solid #d3d3d3;border-radius:0;box-sizing:border-box}.cme-matrix-hover-popover.ck-only .cme-matrix-hover-footer{border-top:1px solid #e2e8f0;padding-top:4px;margin-top:auto;justify-content:space-around;gap:4px}.cme-matrix-hover-popover.ck-only .cme-matrix-counter{gap:2px;font-size:12px}.cme-matrix-hover-popover.ck-only input.cme-counter-val{min-width:10px;width:22px;font-size:12px;padding:0 2px;height:16px;background:#fff;border:1px solid #d3d3d3}.cme-matrix-hover-popover.ck-only .cme-counter-btns button{width:10px;height:7px;font-size:5px}.cme-btn.active,.cme-select.active{background-color:#fcf4b6!important;border-color:#e6c229!important;color:#000!important}.cme-btn,.cme-btn *,.cme-btn math-field,.cme-matrix-btn-wrapper,.cme-matrix-btn-wrapper button,.cme-matrix-btn-wrapper button *{cursor:pointer!important}.cme-group-tab,.cme-group-tab *{cursor:pointer!important}.cme-group-tab math-field{pointer-events:none!important;-webkit-user-select:none!important;user-select:none!important}.cme-subgroup-has-more{padding-right:10px}.cme-more-trigger-btn{position:absolute;top:0;right:2px;width:7px;height:100%;background:transparent;border:none;color:#1976d2;font-size:9px;cursor:pointer;display:flex;align-items:center;justify-content:flex-end;padding-bottom:3px;z-index:10;writing-mode:vertical-rl;letter-spacing:2px;transition:background .15s,color .15s;-webkit-user-select:none;user-select:none;line-height:1}.cme-more-trigger-btn:hover{background:#5fb2f7;color:#fff;border-color:#1976d2}.cme-more-popup{position:fixed;z-index:99999;background:linear-gradient(to bottom,#f5faff,#e8f4ff);border:1px solid #90CAF9;border-radius:5px;box-shadow:0 4px 14px #0000002e;padding:9px 0;display:grid;gap:1px;min-width:25px;animation:cmeMoreFadeIn .12s ease-out}@keyframes cmeMoreFadeIn{0%{opacity:0;transform:translate(-4px)}to{opacity:1;transform:translate(0)}}.cme-more-popup--shift-left{transform:translate(calc(-100% + 14px))!important}.cme-more-popup-btn{min-width:30px;height:32px;padding:0 2px;border:1px solid transparent;border-radius:3px;background:transparent;color:#000;font-size:14px;font-weight:700;font-family:"Latin Modern Math","STIX Two Math",Times New Roman,serif;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;transition:background .1s,border-color .1s;-webkit-user-select:none;user-select:none;box-sizing:border-box;white-space:nowrap}.cme-more-popup-btn:hover{background:#e8f4ff;border-color:#42a5f5;box-shadow:0 1px 3px #42a5f533}.cme-more-popup-btn:active{background:#bbdefb;border-color:#1e88e5}.cme-enclose-circle{display:inline-block;border:1px solid currentColor;border-radius:50%;padding:.1em .3em;text-align:center}.ML__bold{font-weight:700!important}.cme-bold{font-weight:700!important;font-family:inherit!important}.cme-confirm-overlay{position:absolute;top:0;left:0;width:100%;height:100%;background:#0006;z-index:99999;display:flex;align-items:center;justify-content:center;border-radius:inherit}.cme-confirm-modal{background:#fff;border-radius:4px;padding:20px;width:380px;max-width:90%;box-shadow:0 4px 12px #00000026;font-family:sans-serif;color:#333}.cme-confirm-modal p{margin:0 0 20px;font-size:14px;line-height:1.5}.cme-confirm-actions{display:flex;justify-content:flex-start;gap:10px}.cme-confirm-close-btn{background:#768a96;color:#fff;border:none;padding:8px 16px;border-radius:4px;cursor:pointer;font-size:14px}.cme-confirm-close-btn:hover{background:#627581}.cme-confirm-cancel-btn{background:#e0e0e0;color:#333;border:1px solid #ccc;padding:8px 16px;border-radius:4px;cursor:pointer;font-size:14px}.cme-confirm-cancel-btn:hover{background:#d0d0d0}.ck-math-widget{display:inline-flex!important;align-items:center!important;width:fit-content!important;max-width:100%!important;margin-left:0!important;margin-right:0!important;padding:0!important;vertical-align:middle!important;line-height:normal!important;box-sizing:border-box!important}.ck-math-widget-inner{display:inline-flex!important;align-items:center!important;width:fit-content!important;max-width:100%!important;margin:0!important;padding:0!important}.ck-math-widget math-field{display:inline-block!important;width:auto!important;max-width:100%!important;height:auto!important;min-height:unset!important;margin:0!important;padding:0!important;vertical-align:middle!important;box-sizing:content-box!important}.math-tex{display:inline!important}.ck-math-widget .ck-widget__type-around,.ck-math-widget .ck-widget__type-around__button,.ck-math-widget .ck-widget__type-around__button--before,.ck-math-widget .ck-widget__type-around__button--after,.ck-math-widget>.ck-widget__type-around>button{display:none!important;visibility:hidden!important;width:0!important;height:0!important;opacity:0!important;pointer-events:none!important}.ck.ck-editor__editable .ck-widget.ck-math-widget .ck-widget__type-around,.ck.ck-editor__editable .ck-widget.ck-math-widget .ck-widget__type-around__button{display:none!important}.ck.ck-editor__editable .ck-widget.ck-math-widget{outline:none!important;border-radius:0!important;width:fit-content!important;max-width:100%!important}.ck.ck-editor__editable .ck-widget.ck-math-widget.ck-widget_selected,.ck.ck-editor__editable .ck-widget.ck-math-widget.ck-widget_selected:focus{outline:none!important;border-radius:0!important}.ck.ck-editor__editable .ck-widget.ck-math-widget:before,.ck.ck-editor__editable .ck-widget.ck-math-widget:after{display:none!important;content:none!important}.ck.ck-editor__editable .ck-widget.ck-math-widget:hover{box-shadow:0 0 0 2px #f97316!important;border-radius:2px!important;transition:box-shadow .15s ease,border-radius .15s ease}.ck.ck-editor__editable .ck-widget.ck-math-widget.ck-widget_selected{box-shadow:0 0 0 2px #2563eb!important;border-radius:2px!important;outline:none!important;transition:box-shadow .15s ease}.ck.ck-editor__editable .ck-widget.ck-math-widget.ck-widget_selected:focus{box-shadow:0 0 0 2px #2563eb!important;border-radius:2px!important;outline:none!important}.ck.ck-editor__editable .ck-widget.ck-math-widget.ck-widget_selected:hover{box-shadow:0 0 0 2px #2563eb!important;border-radius:2px!important}.ML__notation{position:absolute!important;line-height:0!important;box-sizing:border-box!important}.ML__notation svg{position:absolute!important;overflow:visible!important;top:0!important;left:0!important;width:100%!important;height:100%!important;pointer-events:none!important}.scm-overlay{position:fixed;top:0;right:0;bottom:0;left:0;z-index:99999}.scm-modal{position:absolute;background:#fff;border-radius:4px;box-shadow:0 4px 12px #00000026;width:225px;height:188.2px;display:flex;flex-direction:column;overflow:hidden;font-family:system-ui,-apple-system,sans-serif;border:1px solid #e5e7eb}.scm-toolbar{display:flex;align-items:center;gap:4px;height:20px;padding:2px 4px;background-color:#fff;border-bottom:1px solid #e5e7eb;box-sizing:border-box}.scm-code-input{width:65px;height:15px;border:1px solid #dbd6d1;border-radius:3px;font-size:11px;outline:none;box-sizing:border-box}.scm-code-input:focus{border-color:#1b75bb}.scm-category-select{flex:1;height:15px;padding:0 2px;border:1px solid #d1d5db;border-radius:3px;font-size:11px;outline:none;box-sizing:border-box}.scm-category-select:focus{border-color:#1b75bb}.scm-body{flex:1;background-color:#f9fafb;overflow:hidden}.scm-grid-container{height:100%;overflow-y:auto;padding:4px}.scm-grid-container::-webkit-scrollbar{width:6px}.scm-grid-container::-webkit-scrollbar-track{background:#f1f1f1}.scm-grid-container::-webkit-scrollbar-thumb{background:#c1c1c1;border-radius:3px}.scm-char-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(24px,1fr));gap:2px}.scm-char-btn{background:#fff;border:1px solid #e5e7eb;border-radius:2px;height:24px;display:flex;align-items:center;justify-content:center;font-size:14px;cursor:pointer;color:#111827;padding:0}.scm-char-btn:hover{background-color:#f3f4f6;border-color:#d1d5db}.scm-no-results{text-align:center;padding:16px 0;color:#6b7280;font-size:11px}.digi-math-widget{display:inline-flex;align-items:center;position:relative;vertical-align:middle;padding:2px 6px;margin:0 2px;border-radius:4px;border:1px solid transparent;background-color:#00000005;cursor:pointer;-webkit-user-select:none;user-select:none;transition:all .15s ease-in-out;box-sizing:border-box}.digi-math-widget:hover{background-color:#2e7d3214;border-color:#2e7d32;box-shadow:0 1px 3px #2e7d3233}.digi-math-widget math-field{pointer-events:none;border:none!important;background:transparent!important;padding:0!important;margin:0!important;font-size:1.05em}.digi-math-widget:after{content:"✎";font-size:10px;color:#2e7d32;margin-left:4px;opacity:0;transition:opacity .15s ease}.digi-math-widget:hover:after{opacity:1}.digi-math-widget.readonly{cursor:default;background:transparent;border-color:transparent}.digi-math-widget.readonly:hover{background:transparent;border-color:transparent;box-shadow:none}.digi-math-widget.readonly:after{display:none}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "digi-mathchem-editor",
3
- "version": "1.0.28",
3
+ "version": "1.0.29",
4
4
  "description": "Standalone Vanilla JS Math and Chemistry Editor using MathLive",
5
5
  "type": "module",
6
6
  "main": "./dist/digi-mathchem-editor.umd.js",