PageSourceSearch

https://math-gpt.org/_next/static/chunks/4994.02221ed42dd1cd7d.js

js math-gpt.org collected 2026-10-01 12:01:35 UTC 14,399 bytes, 1 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c81bf070-f203-4dac-b5e7-80ea41e4469f",e._sentryDebugIdIdentifier="sentry-dbid-c81bf070-f203-4dac-b5e7-80ea41e4469f")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4994],{678:(e,t,r)=>{r.d(t,{Z:()=>l});var a=r(18004);function l(){return{isMobile:(0,a.Ub)({maxWidth:640})}}},9099:(e,t,r)=>{r.d(t,{_:()=>s});var a=r(10940),l=r(98575),n=r(9084);let i="min(45dvh, ".concat(l.Eb,"px)"),s=e=>{let{aspect:t,className:r,style:l,...s}=e;return(0,a.jsx)("div",{className:(0,n.cn)("dark:border-dark-border mx-auto w-full overflow-hidden rounded-xl border-2 border-gray-300 bg-white",r),style:{aspectRatio:t,maxWidth:"calc(".concat(i," * ").concat(t,")"),...l},...s})}},33900:(e,t,r)=>{r.d(t,{A:()=>a});let a=(0,r(75500).A)("expand",[["path",{d:"m15 15 6 6",key:"1s409w"}],["path",{d:"m15 9 6-6",key:"ko1vev"}],["path",{d:"M21 16v5h-5",key:"1ck2sf"}],["path",{d:"M21 8V3h-5",key:"1qoq8a"}],["path",{d:"M3 16v5h5",key:"1t08am"}],["path",{d:"m3 21 6-6",key:"wwnumi"}],["path",{d:"M3 8V3h5",key:"1ln10m"}],["path",{d:"M9 9 3 3",key:"v551iv"}]])},34994:(e,t,r)=>{r.r(t),r.d(t,{Diagram:()=>O});var a=r(10940),l=r(62544),n=r(3729),i=r(54946);let s=n.Ikc({ir:i.vZ,fileUrl:n.YjP(),width:n.aig().optional(),height:n.aig().optional()}),c="This diagram's data is malformed and can't be rendered.";var o=r(40732),u=r(11209),d=r(7239),f=r(49222),h=r(89860),m=r(50054),g=r(51555);let b={geometry:{validate:u.tq,backend:"geogebra",display:"geogebra",editable:!1},chart:{validate:d.t,backend:"vega",display:"vega",editable:!1},plot:{validate:f.t,backend:"geogebra",display:"geogebra",editable:!0},chemistry:{validate:h.t,backend:"rdkit",display:"stored",editable:!1},circuit:{validate:m.tq,backend:"schematic",display:"stored",editable:!1},logic:{validate:g.tq,backend:"schematic",display:"stored",editable:!1}},x=e=>{let t=(0,o.e)(e.title).slice(0,80).replace(/-+$/,"");return"mathgpt-".concat(t||e.domain)},p=e=>b[e.domain].editable;var v=r(98575),w=r(33405),y=r(87082),j=r(36861),k=r(36533),N=r(9099),E=r(64459);let M=e=>{let[t,r]=(0,l.useState)(null);return(0,l.useEffect)(()=>{let t,a=e.current;if(!a)return;let l=()=>r(e=>a.clientWidth<=0||e&&8>Math.abs(e.w-a.clientWidth)?e:{w:a.clientWidth,h:a.clientHeight}),n=new ResizeObserver(()=>{clearTimeout(t),t=setTimeout(l,150)});return n.observe(a),l(),()=>{clearTimeout(t),n.disconnect()}},[e]),t};var S=r(9084);let R={scale:1,x:0,y:0},A=(e,t,r,a)=>{let l=Math.min(5,Math.max(.75,e.scale*t)),n=l/e.scale;return{scale:l,x:r-(r-e.x)*n,y:a-(a-e.y)*n}},P=e=>{let{children:t,className:r}=e,n=(0,l.useRef)(null),i=(0,l.useRef)(new Map),s=(0,l.useRef)(null),[c,o]=(0,l.useState)(R),[u,d]=(0,l.useState)(!1),f=(0,l.useRef)(R),h=(0,l.useRef)(R),m=(0,l.useRef)(null),g=(0,l.useCallback)(e=>{if(h.current=e(h.current),null!==m.current)return;let t=()=>{let e=h.current,r=f.current,a={scale:r.scale+(e.scale-r.scale)*.22,x:r.x+(e.x-r.x)*.22,y:r.y+(e.y-r.y)*.22},l=((e,t)=>.001>Math.abs(e.scale-t.scale)&&.5>Math.hypot(e.x-t.x,e.y-t.y))(a,e);f.current=l?e:a,o(f.current),m.current=l?null:requestAnimationFrame(t)};m.current=requestAnimationFrame(t)},[]),b=e=>{null!==m.current&&cancelAnimationFrame(m.current),m.current=null;let t=e(f.current);f.current=t,h.current=t,o(t)};(0,l.useEffect)(()=>()=>{null!==m.current&&cancelAnimationFrame(m.current)},[]);let x=(e,t)=>{var r;let a=null==(r=n.current)?void 0:r.getBoundingClientRect();return a?{x:e-(a.left+a.width/2),y:t-(a.top+a.height/2)}:{x:0,y:0}};(0,l.useEffect)(()=>{let e=n.current;if(!e)return;let t=e=>{e.preventDefault();let t=e.deltaY*(1===e.deltaMode?16:1),r=x(e.clientX,e.clientY);g(e=>A(e,Math.exp(-t/500),r.x,r.y))};return e.addEventListener("wheel",t,{passive:!1}),()=>e.removeEventListener("wheel",t)},[g]);let p=e=>{i.current.delete(e.pointerId),i.current.size<2&&(s.current=null),0===i.current.size&&d(!1)};return(0,a.jsx)("div",{ref:n,className:(0,S.cn)("touch-none cursor-grab overflow-hidden select-none",u&&"cursor-grabbing",r),onPointerDown:e=>{i.current.set(e.pointerId,{x:e.clientX,y:e.clientY}),e.currentTarget.setPointerCapture(e.pointerId),d(!0)},onPointerMove:e=>{let t=i.current.get(e.pointerId);if(!t)return;i.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let[r,a]=[...i.current.values()];if(a){let e=Math.hypot(r.x-a.x,r.y-a.y),t=x((r.x+a.x)/2,(r.y+a.y)/2),l=s.current;l&&b(r=>A(r,e/l,t.x,t.y)),s.current=e;return}let l=e.clientX-t.x,n=e.clientY-t.y;b(e=>({...e,x:e.x+l,y:e.y+n}))},onPointerUp:p,onPointerCancel:p,onDoubleClick:e=>{let t=x(e.clientX,e.clientY);g(e=>1!==e.scale||0!==e.x||0!==e.y?R:A(e,2,t.x,t.y))},children:(0,a.jsx)("div",{className:"h-full w-full",style:{transform:"translate(".concat(c.x,"px, ").concat(c.y,"px) scale(").concat(c.scale,")")},children:t})})};var _=r(678);let C={perspective:"AG",showAlgebraInput:!0,enableRightClick:!0,enableLabelDrags:!0,showKeyboardOnFocus:!1},L=e=>{let{state:t,viewport:n,editable:i,fixObjects:s,filename:c}=e,o=(0,l.useRef)(null),u=(0,l.useRef)(null),[d,f]=(0,l.useState)(!1),[h,m]=(0,l.useState)(null);return((0,l.useEffect)(()=>{let e=o.current;if(!e)return;let a=!1;return f(!1),m(null),(async()=>{let[{loadGeoGebra:l},{drawInto:c,GEOGEBRA_FIGURE_PARAMS:o}]=await Promise.all([r.e(3495).then(r.bind(r,33495)),r.e(1152).then(r.bind(r,21152))]),d=await l();a||new d({...o,...i?C:{},width:n.w,height:n.h,enableShiftDragZoom:!0,borderColor:"none",appletOnLoad:e=>
1{if(!a)try{if(c(e,t),s)for(let t of e.getAllObjectNames())e.setFixed(t,!0);u.current=e,f(!0)}catch(e){a||m(e instanceof Error?e.message:String(e))}}},!0).inject(e)})().catch(e=>{a||m(e instanceof Error?e.message:String(e))}),()=>{a=!0,u.current=null,e.innerHTML=""}},[t,n,i,s]),h)?(0,a.jsx)(j.w,{error:h}):(0,a.jsxs)("div",{className:"relative h-full min-w-0 flex-1",children:[!d&&(0,a.jsx)(y.E,{className:"absolute inset-0"}),(0,a.jsx)("div",{"data-testid":"geogebra-applet",ref:o,className:"h-full w-full"}),d&&(0,a.jsx)(E.s,{download:{format:"PNG",getBlob:async()=>{let e=u.current;return e?(await fetch("data:image/png;base64,".concat(e.getPNGBase64(2,!1,72)))).blob():null}},filename:c})]})};var U=r(75044);let I=async(e,t)=>{var r;let a=null!=(r=(e=>{let t=e.match(/viewBox="\s*[-\d.]+[\s,]+[-\d.]+[\s,]+([\d.]+)[\s,]+([\d.]+)/);if(!t)return null;let r=Math.round(100*Number(t[1]))/100,a=Math.round(100*Number(t[2]))/100;return r>0&&a>0?{width:r,height:a}:null})(e))?r:t;if(!a)return null;let l=Math.round(1600*a.height/a.width),n=URL.createObjectURL(new Blob([((e,t,r)=>{let a=new DOMParser().parseFromString(e,"image/svg+xml");return a.documentElement.setAttribute("width",String(1600)),a.documentElement.setAttribute("height",String(r)),new XMLSerializer().serializeToString(a.documentElement)})(e,0,l)],{type:"image/svg+xml"}));try{let e=await new Promise((e,t)=>{let r=new Image;r.onload=()=>e(r),r.onerror=()=>t(Error("could not rasterize the figure")),r.src=n}),t=(0,w.re)(1600,l),r=(0,w.uT)(t);if(!r)return null;return r.fillStyle="#fff",r.fillRect(0,0,1600,l),r.drawImage(e,0,0,1600,l),await (0,w.SZ)(t,{type:"image/png"})}finally{URL.revokeObjectURL(n)}},D=e=>{let{ir:t,fileUrl:r,width:n,height:i}=e,{signedUrl:s}=(0,U.Z)(r),[c,o]=(0,l.useState)(!1),u=n&&i?n/i:1.5;return(0,a.jsx)(k._,{caption:t.title,children:(0,a.jsxs)(N._,{aspect:u,className:"relative",children:[!c&&(0,a.jsx)(y.E,{className:"absolute inset-0"}),s&&(0,a.jsx)(P,{className:"absolute inset-0",children:(0,a.jsx)("img",{src:s,alt:t.title,draggable:!1,onLoad:()=>o(!0),className:"h-full w-full object-contain"})}),c&&(0,a.jsx)(E.s,{download:{format:"PNG",getBlob:async()=>{if(!s)return null;let e=await fetch(s);return I(await e.text(),n&&i?{width:n,height:i}:void 0)}},filename:x(t)})]})})};var z=r(72840);let F={vega:e=>{let{ir:t}=e,n=(0,l.useRef)(null),i=(0,l.useRef)(null),s=(0,l.useRef)(null),[c,o]=(0,l.useState)(!1),[u,d]=(0,l.useState)(null),[f,h]=(0,l.useState)(null),m=M(n);return((0,l.useEffect)(()=>{let e=i.current;if(!e||!m)return;let a=!1,l=null;return o(!1),d(null),h(null),(async()=>{let[{irToVegaLite:n},i,c]=await Promise.all([r.e(8229).then(r.bind(r,38229)),Promise.all([r.e(83),r.e(1739)]).then(r.bind(r,9128)),r.e(1739).then(r.bind(r,1739))]);if(a)return;let u=n(t,{w:m.w,h:Math.round(m.w*v.My/v.lR)}),f=new c.View(c.parse(i.compile(u).spec),{renderer:"svg",container:e,hover:!1});if(l=()=>void f.finalize(),await f.runAsync(),a)return;s.current=f;let h=e.querySelector("svg");if(h){let e=Number(h.getAttribute("width")),t=Number(h.getAttribute("height"));e>0&&t>0&&(h.setAttribute("viewBox","0 0 ".concat(e," ").concat(t)),h.setAttribute("preserveAspectRatio","xMidYMid meet"),h.setAttribute("width","100%"),h.setAttribute("height","100%"),d(e/t))}o(!0)})().catch(e=>{a||h(e instanceof Error?e.message:String(e))}),()=>{a=!0,s.current=null,null==l||l()}},[t,m]),f)?(0,a.jsx)(j.w,{error:f}):(0,a.jsx)(k._,{caption:t.title,children:(0,a.jsxs)(N._,{ref:n,aspect:null!=u?u:v.lR/v.My,className:"relative",children:[!c&&(0,a.jsx)(y.E,{className:"absolute inset-0"}),(0,a.jsx)(P,{className:"absolute inset-0",children:(0,a.jsx)("div",{ref:i,className:"h-full w-full [&_svg]:h-full [&_svg]:w-full"})}),c&&(0,a.jsx)(E.s,{download:{format:"PNG",getBlob:async()=>{let e=s.current;if(!e)return null;let t=await e.toCanvas(2);return await (0,w.SZ)(t,{type:"image/png"})}},filename:x(t)})]})})},geogebra:e=>{let{ir:t}=e,n=(0,l.useRef)(null),i=M(n),[s,c]=(0,l.useState)(null),[o,u]=(0,l.useState)(null),{isMobile:d}=(0,_.Z)(),f=p(t)&&!d;return((0,l.useEffect)(()=>{let e=!1;return c(null),u(null),r.e(7426).then(r.bind(r,7426)).then(r=>{let{irToGeoGebraFigures:a}=r;if(!e)try{c(a(t))}catch(e){u(e instanceof Error?e.message:String(e))}}).catch(t=>{e||u(t instanceof Error?t.message:String(t))}),()=>{e=!0}},[t]),o)?(0,a.jsx)(j.w,{error:o}):(0,a.jsx)(k._,{caption:t.title,children:(0,a.jsx)(N._,{ref:n,aspect:v.t4.w/v.t4.h,className:"flex gap-3",children:s&&i?s.map((e,r)=>(0,a.jsx)(L,{state:e,viewport:i,editable:f,fixObjects:!p(t),filename:x(t)},r)):(0,a.jsx)(y.E,{className:"h-full w-full"})})})},stored:()=>(0,a.jsx)(j.w,{error:"This figure's image is unavailable."})},O=e=>{let{content:t}=e,{value:r,error:n}=(0,z.I)(t),{parsed:o,schemaError:u}=(0,l.useMemo)(()=>
1{if(null===r)return{parsed:null,schemaError:null};let e=(e=>{if("object"==typeof e&&null!==e&&"ir"in e){var t;let r=s.partial({fileUrl:!0}).safeParse(e);return r.success?{ok:!0,value:{...r.data,fileUrl:null!=(t=r.data.fileUrl)?t:null}}:{ok:!1,error:c}}let r=i.vZ.safeParse(e);return r.success?{ok:!0,value:{ir:r.data,fileUrl:null}}:{ok:!1,error:c}})(r);return e.ok?{parsed:e.value,schemaError:null}:{parsed:null,schemaError:e.error}},[r]);if(n)return(0,a.jsx)(j.w,{error:n});if(u)return(0,a.jsx)(j.w,{error:u});if(!o)return null;let{ir:d,fileUrl:f,width:h,height:m}=o;if(f)return(0,a.jsx)(D,{ir:d,fileUrl:f,width:h,height:m});let g=F[b[d.domain].display];return(0,a.jsx)(g,{ir:d})}},36533:(e,t,r)=>{r.d(t,{_:()=>l});var a=r(10940);let l=e=>{let{caption:t,children:r}=e;return(0,a.jsxs)("div",{className:"flex w-full flex-col gap-2",children:[t&&(0,a.jsx)("div",{className:"text-center text-sm font-medium text-gray-700 dark:text-dark-text-secondary",children:t}),r]})}},36861:(e,t,r)=>{r.d(t,{w:()=>i});var a=r(10940),l=r(9084),n=r(20111);let i=e=>{let{error:t,description:r,className:i}=e;return(0,a.jsx)("div",{className:(0,l.cn)("w-full p-4",i),children:(0,a.jsxs)("div",{className:"flex flex-col p-4 bg-red-50 rounded-lg border border-red-200",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-red-600",children:[(0,a.jsx)(n.A,{className:"h-5 w-5"}),(0,a.jsx)("p",{children:t})]}),!!r&&(0,a.jsx)("span",{className:"text-sm mt-1 text-red-900",children:r})]})})}},40732:(e,t,r)=>{r.d(t,{e:()=>a});let a=e=>e.normalize("NFD").replace(/[̀-ͯ]/g,"").toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")},64459:(e,t,r)=>{r.d(t,{f:()=>f,s:()=>h});var a=r(10940),l=r(33900),n=r(90712),i=r(63007),s=r(62544),c=r(5926),o=r(9084),u=r(19273),d=r(77329);let f=e=>{let{className:t,children:r,...l}=e;return(0,a.jsx)(u.$,{variant:"ghost",size:"icon",className:(0,o.cn)("h-9 w-9 rounded-full bg-gray-200 text-[#0D2247] hover:bg-gray-100 hover:text-[#0D2247] dark:bg-dark-hover dark:text-dark-text-secondary dark:hover:bg-dark-border dark:hover:text-dark-text-secondary",t),...l,children:r})},h=e=>{let{download:t,filename:r,onOpen:o,onDownload:u,onShare:h}=e,{t:m}=(0,c.Bd)(),g=async e=>{try{let a=await t.getBlob();if(!a)throw Error("no blob");await e(a,"".concat(r,".").concat(t.format.toLowerCase()))}catch(e){d.o.error(m("artifacts.actions.exportError"))}}
1,[b,x]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{var e,t,r;let a=new File([""],"probe.png",{type:"image/png"});x(null!=(r=null==(e=(t=navigator).canShare)?void 0:e.call(t,{files:[a]}))&&r)},[]),(0,a.jsxs)("div",{className:"absolute right-1.5 bottom-1.5 flex gap-1",children:[o&&(0,a.jsx)(f,{"aria-label":m("artifacts.actions.open"),"data-testid":"artifact-open",onClick:e=>{e.stopPropagation(),o()},children:(0,a.jsx)(l.A,{size:18})}),(0,a.jsx)(f,{"aria-label":m("artifacts.actions.download"),"data-testid":"artifact-download",onClick:e=>{e.stopPropagation(),null==u||u(),g((e,t)=>{let r=URL.createObjectURL(e),a=document.createElement("a");a.href=r,a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(r)})},children:(0,a.jsx)(n.A,{size:18})}),b&&(0,a.jsx)(f,{"aria-label":m("artifacts.actions.share"),"data-testid":"artifact-share",className:"sm:hidden",onClick:e=>{e.stopPropagation(),null==h||h(),g(async(e,t)=>{navigator.share&&await navigator.share({files:[new File([e],t,{type:e.type})]}).catch(()=>{})})},children:(0,a.jsx)(i.A,{size:18})})]})}},72840:(e,t,r)=>{r.d(t,{I:()=>l});var a=r(62544);function l(e){return(0,a.useMemo)(()=>{try{return{value:JSON.parse(e),error:null}}catch(e){return{value:null,error:"Failed to parse: ".concat(e instanceof Error?e.message:String(e))}}},[e])}},98575:(e,t,r)=>{r.d(t,{Ab:()=>h,E0:()=>n,Eb:()=>i,My:()=>l,Pg:()=>f,Qu:()=>d,UH:()=>u,ct:()=>c,ft:()=>o,lR:()=>a,t4:()=>s});let a=500,l=300,n={w:500,h:300},i=360,s={w:816,h:360},c=200,o="#4c78a8",u="#d62728",d="#888888",f="#333333",h=[o,u,"#59a14f","#b07aa1"]}}]);

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.