PageSourceSearch

https://aimathsolver.co/build/assets/keyboard-CPYKkn0O.js

js aimathsolver.co collected 2026-09-29 21:55:05 UTC 8,258 bytes, 1 lines download raw bytes

1import{p as f}from"./pageData-B3nQg5j2.js";const g=f("keyboard-data","isDesktopDevice",!1),p=f("keyboard-data","isChat",!1),w=f("keyboard-data","katexJsUrl");window.mathFieldInstances={};window.lastActiveMathFieldId=null;function y(){typeof window.katex>"u"?loadScript(w,function(){h()}):h(),typeof MathQuill<"u"&&typeof window.MQ>"u"&&(window.MQ=MathQuill.getInterface(2))}function I(d){document.querySelectorAll("#keyboard .buttons-other, #keyboard .buttons").forEach(l=>{l.style.display="none"}),document.getElementById(d).style.display="grid",document.querySelectorAll(".tab").forEach(l=>{l.classList.remove("active")}),document.querySelector(`button[onclick="showSection('${d}')"]`).classList.add("active"),document.getElementById("btnsForAll").style.display="grid"}document.getElementById("btnsForAll").style.display="grid";function E(){document.getElementById("statement").textContent="",window.mathFieldInstances={},window.lastActiveMathFieldId=null,document.getElementById("statement").focus()}function u(d){let l=document.getElementById(d),i=document.getSelection();if(i.rangeCount){let n=i.getRangeAt(0);if(l.contains(n.startContainer)||l.contains(n.endContainer))return!0}return!1}
1function m(d){let l=document.getElementById(d),i=document.getSelection();if(i.rangeCount){let n=i.getRangeAt(0);if(l.contains(n.startContainer)){let e=$(n.startContainer);if(e.hasClass("txtMathField"))return{id:e.attr("id"),start:n.startOffset,end:n.endOffset};if(e.parents("span.txtMathField").length)return{id:e.parents("span.txtMathField").attr("id"),start:n.startOffset,end:n.endOffset}}}return!1}function x(d){let l=m(d);if(!l){if(u(d)){let o=window.getSelection();if(o.rangeCount){let t="mq_"+Date.now()+Math.floor(Math.random()*1e3),s=o.getRangeAt(0);if(s.collapsed){let r=document.createElement("span"),c=document.createTextNode(" ");return r.className="txtMathField",r.id=t,s.insertNode(c),s.setEndAfter(c),s.insertNode(r),s.setEndAfter(r),s.insertNode(c.cloneNode()),o.removeAllRanges(),o.addRange(s),t}else{let r=document.createElement("span");return r.className="txtMathField",r.id=t,s.deleteContents(),s.insertNode(r),o.removeAllRanges(),o.addRange(s),t}}}if(window.lastActiveMathFieldId&&document.getElementById(window.lastActiveMathFieldId)&&typeof window.mathFieldInstances[window.lastActiveMathFieldId]<"u")return window.lastActiveMathFieldId;let i="mq_"+Date.now()+Math.floor(Math.random()*1e3),n=document.createElement("span"),e=document.createTextNode(" ");n.className="txtMathField",n.id=i;let a=document.getElementById(d);return a.appendChild(document.createTextNode(" ")),a.appendChild(n),a.appendChild(e),i}return l.id}function C(d,l){l!=="Left"&&(l="Right");let i=m(d);if(i&&i.id)typeof window.mathFieldInstances[i.id]<"u"&&window.mathFieldInstances[i.id].keystroke(l);else if(u(d)){let n=window.getSelection();if(n.rangeCount){let e=n.getRangeAt(0);if(e.collapsed){let a=e.startContainer,o=e.startOffset;if(l==="Left")if(o===0){let t=a.previousSibling;if(t){if(t.nodeType===Node.TEXT_NODE)t.textContent.length===0?(e.setStart(t,0),e.setStart(t,0)):(e.setStart(t,t.textContent.length-1),e.setEnd(t,t.textContent.length-1));else if(t.nodeType===Node.ELEMENT_NODE){t.classList.contains("txtMathField")&&typeof window.mathFieldInstances[t.id]<"u"&&window.mathFieldInstances[t.id].keystroke("Left");return}}else e.setStart(a,0),e.setEnd(a,0)}else e.setStart(a,o-1),e.setEnd(a,o-1);else if(o===a.textContent.length){const t=a.nextSibling;if(t){if(t.nodeType===Node.TEXT_NODE)e.setStart(t,0),e.setEnd(t,0);else if(t.nodeType===Node.ELEMENT_NODE){t.classList.contains("txtMathField")&&typeof window.mathFieldInstances[t.id]<"u"&&window.mathFieldInstances[t.id].keystroke("Right");return}}}else e.setStart(a,o+1),e.setEnd(a,o+1);n.removeAllRanges(),n.addRange(e)}else l==="Left"?e.setStart(e.startContainer,e.startOffset):e.setStart(e.endContainer,e.endOffset),e.collapse(!0),n.removeAllRanges(),n.addRange(e)}}}function S(d){let l=m(d);if(l)typeof window.mathFieldInstances[l.id]<"u"&&window.mathFieldInstances[l.id].keystroke("Backspace");else if(u(d)){let i=window.getSelection();if(i.rangeCount){let n=i.getRangeAt(0);if(n.collapsed){let e=n.startContainer,a=n.startOffset;if(e.nodeType===Node.TEXT_NODE)if(a<2){if(e.previousSibling===null)return;if(e.textContent.slice(0,a).trim()===""){let t=e.previousSibling;if(t.nodeType===Node.ELEMENT_NODE){e.parentNode.removeChild(t);return}else{let s=document.createRange();s.collapse(!0),e.textContent=e.textContent.slice(1),t.textContent=t.textContent.slice(0,-1),s.setStart(t,t.length),i.removeAllRanges(),i.addRange(s);return}}else{let t=e.textContent.slice(0,a-1),s=e.textContent.slice(a);e.textContent=t+s,n.setStart(e,a-1),n.setEnd(e,a-1),i.removeAllRanges(),i.addRange(n);return}}else{let o=e.textContent.slice(0,a-1),t=e.textContent.slice(a);e.textContent=o+t,n.setStart(e,a-1),n.setEnd(e,a-1),i.removeAllRanges(),i.addRange(n);return}}else{let e=document.createRange();e.collapse(!0),e.setStart(n.startContainer,n.startOffset),n.deleteContents(),i.removeAllRanges(),i.addRange(e)}}}}function v(){let d="";document.getElementById("statement").childNodes.forEach(i=>{i.nodeType===1&&i.classList.contains("txtMathField")&&typeof window.mathFieldInstances[i.id]<"u"?d+=window.mathFieldInstances[i.id].latex():d+=i.textContent}),document.getElementById("input_name").value=d}function F(d){let l=x("statement");document.getElementById("statement").classList.remove("placeholder");let i=document.getElementById(l);typeof mathFieldInstances[l]>"u"&&(mathFieldInstances[l]=MQ.MathField(i,{spaceBehavesLikeTab:!0,handlers:{deleteOutOf:function(e,a){let o=document.getElementById("statement"),t=a.__controller.container[0].id;o.removeChild(document.getElementById(t)),delete mathFieldInstances[t],window.lastActiveMathFieldId===t&&(window.lastActiveMathFieldId=null)},moveOutOf:function(e,a){let o=a.__controller.container[0].id;if(mathFieldInstances[o].blur(),window.lastActiveMathFieldId===o&&(window.lastActiveMathFieldId=null),e===MQ.L){let t=document.getElementById(o).previousSibling;if(t!==null)if(t.nodeType===Node.NODE_ELEMENT)window.lastActiveMathFieldId=t.id,mathFieldInstances[t.id].focus();else{let s=document.getSelection(),r=document.createRange();r.collapse(!0),r.setStart(t,t.length),s.removeAllRanges(),s.addRange(r)}}else if(e===MQ.R){let t=document.getElementById(o).nextSibling;if(t!==null)if(t.nodeType===Node.NODE_ELEMENT)window.lastActiveMathFieldId=t.id,mathFieldInstances[t.id].focus();else{let s=document.getSelection(),r=document.createRange();r.collapse(!0),r.setStart(t,0),s.removeAllRanges(),s.addRange(r)}}}}}));let n=mathFieldInstances[l];n.write(d.dataset.latexCode),n.focus(),window.lastActiveMathFieldId=l,v()}function h(){document.querySelectorAll("button.btn[data-katex-code]").forEach(l=>{katex.render(l.dataset.katexCode,l,{throwOnError:!1})})}function M(d,l){if(typeof l!="number")return;let i=d.dataset.moveTo,n=document.querySelector(d.dataset.selector),e=n.getBoundingClientRect(),a=n.querySelector("button:first-child").getBoundingClientRect(),o=n.querySelector("button:last-child").getBoundingClientRect();switch(i){case"right":if(e.x+e.width<o.x+o.width){let t=e.x-a.x;n.scrollTo(t+l,0)}break;case"left":if(e.x>a.x){let t=e.x-a.x;n.scrollTo(t-l,0)}break}}document.querySelector(".keyboard")?.addEventListener("click",function(){function d(i,n){const e=document.createElement("script");e.src=i,e.onload=n,document.head.appendChild(e)}function l(i,n=null){if(n&&document.getElementById(n))return;const e=document.createElement("link");e.rel="stylesheet",e.href=i,n&&(e.id=n),document.head.appendChild(e)}l("https://cdn.jsdelivr.net/npm/[email protected]/build/mathquill.css"),l("https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css"),d("https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js",function(){d("https://cdn.jsdelivr.net/npm/[email protected]/build/mathquill.min.js",function(){y(),document.getElementById("keyboard")?.classList.toggle("d-none"),document.getElementById("basic").style.display="grid",g&&p&&document.querySelector(".section-main")?.classList.remove("h-100")})})});window.showSection=I;window.loadKatexInInputBox=F;window.navigateKeyboardSections=M;window.clearMathField=E;window.moveCaret=C;window.imitateBackspace=S;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.