UNPKG

@wiris/mathtype-viewer

Version:

The MathType viewer renders all MathML and LaTeX-like formulas in a webpage using the MathType rendering engine.

2 lines 155 kB
/*! For license information please see WIRISplugins.js.LICENSE.txt */ (()=>{"use strict";var __webpack_modules__={11:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function s(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}l((i=i.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){var n,i,r,a,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.renderLatex=void 0;var o=n(975);function s(e,t){return i(this,void 0,void 0,function(){var n,i,a,s,l,c,u,d,m,f,h,p,_,g,b;return r(this,function(r){switch(r.label){case 0:n=null!==(h=t.textContent)&&void 0!==h?h:"",i=0,r.label=1;case 1:return i<n.length?(a=function(e,t){var n=t.indexOf("$$",e),i=-1==n?-1:t.indexOf("$$",n+2);return-1!=n&&-1!=i?{start:n,end:i}:null}(i,n),a?((s=n.substring(i,a.start))&&(l=document.createTextNode(s),null===(p=t.parentNode)||void 0===p||p.insertBefore(l,t)),c=n.substring(a.start+2,a.end),[4,(0,o.latexToMathml)(c,e.editorServicesRoot,e.editorServicesExtension)]):[3,3]):[3,5];case 2:return u=r.sent(),d=document.createRange().createContextualFragment(u.text),null===(_=t.parentNode)||void 0===_||_.insertBefore(d,t),i=a.end+2,[3,4];case 3:return(m=n.substring(i))&&(f=document.createTextNode(m),null===(g=t.parentNode)||void 0===g||g.insertBefore(f,t)),[3,5];case 4:return[3,1];case 5:return null===(b=t.parentNode)||void 0===b||b.removeChild(t),[2]}})})}function l(e,t){return Array.from(t).some(function(t){return t.contains(e)})}t.renderLatex=function(e,t){return i(this,void 0,void 0,function(){var n,i,o,c,u,d,m;return r(this,function(r){switch(r.label){case 0:if("false"===e.wiriseditorparselatex)return[2];if("image"!==e.viewer&&"latex"!==e.viewer)return[2];n=function(e,t){for(var n,i,r=function(e){return document.createNodeIterator(e,NodeFilter.SHOW_TEXT,function(e){return/(\$\$)(.*)(\$\$)/.test(e.nodeValue||"")?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT})}(e),a=null!==(n=e.querySelectorAll(t))&&void 0!==n?n:[],o=[];i=r.nextNode();)a.length>0&&l(i,a)||o.push(i);return o}(t,e.ignored_containers),r.label=1;case 1:r.trys.push([1,6,7,8]),i=a(n),o=i.next(),r.label=2;case 2:return o.done?[3,5]:(c=o.value,[4,s(e,c)]);case 3:r.sent(),r.label=4;case 4:return o=i.next(),[3,2];case 5:return[3,8];case 6:return u=r.sent(),d={error:u},[3,8];case 7:try{o&&!o.done&&(m=i.return)&&m.call(i)}finally{if(d)throw d.error}return[7];case 8:return[2]}})})}},33:(e,t,n)=>{n.d(t,{A:()=>i});class i{constructor(){this.cache=[]}populate(e,t){this.cache[e]=t}get(e){return!!Object.prototype.hasOwnProperty.call(this.cache,e)&&this.cache[e]}}},206:()=>{var md5,__WEBPACK_DEFAULT_EXPORT__=md5;(function(){var HxOverrides=function(){};HxOverrides.__name__=!0,HxOverrides.dateStr=function(e){var t=e.getMonth()+1,n=e.getDate(),i=e.getHours(),r=e.getMinutes(),a=e.getSeconds();return e.getFullYear()+"-"+(t<10?"0"+t:""+t)+"-"+(n<10?"0"+n:""+n)+" "+(i<10?"0"+i:""+i)+":"+(r<10?"0"+r:""+r)+":"+(a<10?"0"+a:""+a)},HxOverrides.strDate=function(e){switch(e.length){case 8:var t=e.split(":"),n=new Date;return n.setTime(0),n.setUTCHours(t[0]),n.setUTCMinutes(t[1]),n.setUTCSeconds(t[2]),n;case 10:return t=e.split("-"),new Date(t[0],t[1]-1,t[2],0,0,0);case 19:var i=(t=e.split(" "))[0].split("-"),r=t[1].split(":");return new Date(i[0],i[1]-1,i[2],r[0],r[1],r[2]);default:throw"Invalid date format : "+e}},HxOverrides.cca=function(e,t){var n=e.charCodeAt(t);if(n==n)return n},HxOverrides.substr=function(e,t,n){return null!=t&&0!=t&&null!=n&&n<0?"":(null==n&&(n=e.length),t<0?(t=e.length+t)<0&&(t=0):n<0&&(n=e.length+n-t),e.substr(t,n))},HxOverrides.remove=function(e,t){for(var n=0,i=e.length;n<i;){if(e[n]==t)return e.splice(n,1),!0;n++}return!1},HxOverrides.iter=function(e){return{cur:0,arr:e,hasNext:function(){return this.cur<this.arr.length},next:function(){return this.arr[this.cur++]}}};var IntIter=function(e,t){this.min=e,this.max=t};IntIter.__name__=!0,IntIter.prototype={next:function(){return this.min++},hasNext:function(){return this.min<this.max},__class__:IntIter};var Std=function(){};Std.__name__=!0,Std.is=function(e,t){return js.Boot.__instanceof(e,t)},Std.string=function(e){return js.Boot.__string_rec(e,"")},Std.int=function(e){return 0|e},Std.parseInt=function(e){var t=parseInt(e,10);return 0!=t||120!=HxOverrides.cca(e,1)&&88!=HxOverrides.cca(e,1)||(t=parseInt(e)),isNaN(t)?null:t},Std.parseFloat=function(e){return parseFloat(e)},Std.random=function(e){return Math.floor(Math.random()*e)};var com=com||{};com.wiris||(com.wiris={}),com.wiris.js||(com.wiris.js={}),com.wiris.js.JsPluginTools=function(){this.tryReady()},com.wiris.js.JsPluginTools.__name__=!0,com.wiris.js.JsPluginTools.main=function(){var e;e=com.wiris.js.JsPluginTools.getInstance(),haxe.Timer.delay($bind(e,e.tryReady),100)},com.wiris.js.JsPluginTools.getInstance=function(){return null==com.wiris.js.JsPluginTools.instance&&(com.wiris.js.JsPluginTools.instance=new com.wiris.js.JsPluginTools),com.wiris.js.JsPluginTools.instance},com.wiris.js.JsPluginTools.bypassEncapsulation=function(){null==window.com&&(window.com={}),null==window.com.wiris&&(window.com.wiris={}),null==window.com.wiris.js&&(window.com.wiris.js={}),null==window.com.wiris.js.JsPluginTools&&(window.com.wiris.js.JsPluginTools=com.wiris.js.JsPluginTools.getInstance())},com.wiris.js.JsPluginTools.prototype={md5encode:function(e){return haxe.Md5.encode(e)},doLoad:function(){this.ready=!0,com.wiris.js.JsPluginTools.instance=this,com.wiris.js.JsPluginTools.bypassEncapsulation()},tryReady:function(){this.ready=!1,js.Lib.document.readyState&&(this.doLoad(),this.ready=!0),this.ready||haxe.Timer.delay($bind(this,this.tryReady),100)},__class__:com.wiris.js.JsPluginTools};var haxe=haxe||{};haxe.Log=function(){},haxe.Log.__name__=!0,haxe.Log.trace=function(e,t){js.Boot.__trace(e,t)},haxe.Log.clear=function(){js.Boot.__clear_trace()},haxe.Md5=function(){},haxe.Md5.__name__=!0,haxe.Md5.encode=function(e){return(new haxe.Md5).doEncode(e)},haxe.Md5.prototype={doEncode:function(e){for(var t=this.str2blks(e),n=1732584193,i=-271733879,r=-1732584194,a=271733878,o=0;o<t.length;){var s=n,l=i,c=r,u=a;n=this.ff(n,i,r,a,t[o],7,-680876936),a=this.ff(a,n,i,r,t[o+1],12,-389564586),r=this.ff(r,a,n,i,t[o+2],17,606105819),i=this.ff(i,r,a,n,t[o+3],22,-1044525330),n=this.ff(n,i,r,a,t[o+4],7,-176418897),a=this.ff(a,n,i,r,t[o+5],12,1200080426),r=this.ff(r,a,n,i,t[o+6],17,-1473231341),i=this.ff(i,r,a,n,t[o+7],22,-45705983),n=this.ff(n,i,r,a,t[o+8],7,1770035416),a=this.ff(a,n,i,r,t[o+9],12,-1958414417),r=this.ff(r,a,n,i,t[o+10],17,-42063),i=this.ff(i,r,a,n,t[o+11],22,-1990404162),n=this.ff(n,i,r,a,t[o+12],7,1804603682),a=this.ff(a,n,i,r,t[o+13],12,-40341101),r=this.ff(r,a,n,i,t[o+14],17,-1502002290),i=this.ff(i,r,a,n,t[o+15],22,1236535329),n=this.gg(n,i,r,a,t[o+1],5,-165796510),a=this.gg(a,n,i,r,t[o+6],9,-1069501632),r=this.gg(r,a,n,i,t[o+11],14,643717713),i=this.gg(i,r,a,n,t[o],20,-373897302),n=this.gg(n,i,r,a,t[o+5],5,-701558691),a=this.gg(a,n,i,r,t[o+10],9,38016083),r=this.gg(r,a,n,i,t[o+15],14,-660478335),i=this.gg(i,r,a,n,t[o+4],20,-405537848),n=this.gg(n,i,r,a,t[o+9],5,568446438),a=this.gg(a,n,i,r,t[o+14],9,-1019803690),r=this.gg(r,a,n,i,t[o+3],14,-187363961),i=this.gg(i,r,a,n,t[o+8],20,1163531501),n=this.gg(n,i,r,a,t[o+13],5,-1444681467),a=this.gg(a,n,i,r,t[o+2],9,-51403784),r=this.gg(r,a,n,i,t[o+7],14,1735328473),i=this.gg(i,r,a,n,t[o+12],20,-1926607734),n=this.hh(n,i,r,a,t[o+5],4,-378558),a=this.hh(a,n,i,r,t[o+8],11,-2022574463),r=this.hh(r,a,n,i,t[o+11],16,1839030562),i=this.hh(i,r,a,n,t[o+14],23,-35309556),n=this.hh(n,i,r,a,t[o+1],4,-1530992060),a=this.hh(a,n,i,r,t[o+4],11,1272893353),r=this.hh(r,a,n,i,t[o+7],16,-155497632),i=this.hh(i,r,a,n,t[o+10],23,-1094730640),n=this.hh(n,i,r,a,t[o+13],4,681279174),a=this.hh(a,n,i,r,t[o],11,-358537222),r=this.hh(r,a,n,i,t[o+3],16,-722521979),i=this.hh(i,r,a,n,t[o+6],23,76029189),n=this.hh(n,i,r,a,t[o+9],4,-640364487),a=this.hh(a,n,i,r,t[o+12],11,-421815835),r=this.hh(r,a,n,i,t[o+15],16,530742520),i=this.hh(i,r,a,n,t[o+2],23,-995338651),n=this.ii(n,i,r,a,t[o],6,-198630844),a=this.ii(a,n,i,r,t[o+7],10,1126891415),r=this.ii(r,a,n,i,t[o+14],15,-1416354905),i=this.ii(i,r,a,n,t[o+5],21,-57434055),n=this.ii(n,i,r,a,t[o+12],6,1700485571),a=this.ii(a,n,i,r,t[o+3],10,-1894986606),r=this.ii(r,a,n,i,t[o+10],15,-1051523),i=this.ii(i,r,a,n,t[o+1],21,-2054922799),n=this.ii(n,i,r,a,t[o+8],6,1873313359),a=this.ii(a,n,i,r,t[o+15],10,-30611744),r=this.ii(r,a,n,i,t[o+6],15,-1560198380),i=this.ii(i,r,a,n,t[o+13],21,1309151649),n=this.ii(n,i,r,a,t[o+4],6,-145523070),a=this.ii(a,n,i,r,t[o+11],10,-1120210379),r=this.ii(r,a,n,i,t[o+2],15,718787259),i=this.ii(i,r,a,n,t[o+9],21,-343485551),n=this.addme(n,s),i=this.addme(i,l),r=this.addme(r,c),a=this.addme(a,u),o+=16}return this.rhex(n)+this.rhex(i)+this.rhex(r)+this.rhex(a)},ii:function(e,t,n,i,r,a,o){return this.cmn(this.bitXOR(n,this.bitOR(t,~i)),e,t,r,a,o)},hh:function(e,t,n,i,r,a,o){return this.cmn(this.bitXOR(this.bitXOR(t,n),i),e,t,r,a,o)},gg:function(e,t,n,i,r,a,o){return this.cmn(this.bitOR(this.bitAND(t,i),this.bitAND(n,~i)),e,t,r,a,o)},ff:function(e,t,n,i,r,a,o){return this.cmn(this.bitOR(this.bitAND(t,n),this.bitAND(~t,i)),e,t,r,a,o)},cmn:function(e,t,n,i,r,a){return this.addme(this.rol(this.addme(this.addme(t,e),this.addme(i,a)),r),n)},rol:function(e,t){return e<<t|e>>>32-t},str2blks:function(e){for(var t=1+(e.length+8>>6),n=new Array,i=0,r=16*t;i<r;)n[a=i++]=0;for(var a=0;a<e.length;)n[a>>2]|=HxOverrides.cca(e,a)<<(8*e.length+a)%4*8,a++;n[a>>2]|=128<<(8*e.length+a)%4*8;var o=8*e.length,s=16*t-2;return n[s]=255&o,n[s]|=(o>>>8&255)<<8,n[s]|=(o>>>16&255)<<16,n[s]|=(o>>>24&255)<<24,n},rhex:function(e){for(var t="",n="0123456789abcdef",i=0;i<4;){var r=i++;t+=n.charAt(e>>8*r+4&15)+n.charAt(e>>8*r&15)}return t},addme:function(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n},bitAND:function(e,t){return(e>>>1&t>>>1)<<1|1&e&t},bitXOR:function(e,t){return(e>>>1^t>>>1)<<1|1&e^1&t},bitOR:function(e,t){return(e>>>1|t>>>1)<<1|1&e|1&t},__class__:haxe.Md5},haxe.Timer=function(e){var t=this;this.id=window.setInterval(function(){t.run()},e)},haxe.Timer.__name__=!0,haxe.Timer.delay=function(e,t){var n=new haxe.Timer(t);return n.run=function(){n.stop(),e()},n},haxe.Timer.measure=function(e,t){var n=haxe.Timer.stamp(),i=e();return haxe.Log.trace(haxe.Timer.stamp()-n+"s",t),i},haxe.Timer.stamp=function(){return(new Date).getTime()/1e3},haxe.Timer.prototype={run:function(){},stop:function(){null!=this.id&&(window.clearInterval(this.id),this.id=null)},__class__:haxe.Timer};var js=js||{},$_;function $bind(e,t){var n=function(){return n.method.apply(n.scope,arguments)};return n.scope=e,n.method=t,n}js.Boot=function(){},js.Boot.__name__=!0,js.Boot.__unhtml=function(e){return e.split("&").join("&amp;").split("<").join("&lt;").split(">").join("&gt;")},js.Boot.__trace=function(e,t){var n,i=null!=t?t.fileName+":"+t.lineNumber+": ":"";i+=js.Boot.__string_rec(e,""),"undefined"!=typeof document&&null!=(n=document.getElementById("haxe:trace"))?n.innerHTML+=js.Boot.__unhtml(i)+"<br/>":"undefined"!=typeof console&&null!=console.log&&console.log(i)},js.Boot.__clear_trace=function(){var e=document.getElementById("haxe:trace");null!=e&&(e.innerHTML="")},js.Boot.isClass=function(e){return e.__name__},js.Boot.isEnum=function(e){return e.__ename__},js.Boot.getClass=function(e){return e.__class__},js.Boot.__string_rec=function(e,t){if(null==e)return"null";if(t.length>=5)return"<...>";var n=typeof e;switch("function"==n&&(e.__name__||e.__ename__)&&(n="object"),n){case"object":if(e instanceof Array){if(e.__enum__){if(2==e.length)return e[0];var i=e[0]+"(";t+="\t";for(var r=2,a=e.length;r<a;)i+=2!=(o=r++)?","+js.Boot.__string_rec(e[o],t):js.Boot.__string_rec(e[o],t);return i+")"}var o,s=e.length;for(i="[",t+="\t",a=0;a<s;){var l=a++;i+=(l>0?",":"")+js.Boot.__string_rec(e[l],t)}return i+"]"}var c;try{c=e.toString}catch(e){return"???"}if(null!=c&&c!=Object.toString){var u=e.toString();if("[object Object]"!=u)return u}var d=null;i="{\n",t+="\t";var m=null!=e.hasOwnProperty;for(var d in e)m&&!e.hasOwnProperty(d)||"prototype"!=d&&"__class__"!=d&&"__super__"!=d&&"__interfaces__"!=d&&"__properties__"!=d&&(2!=i.length&&(i+=", \n"),i+=t+d+" : "+js.Boot.__string_rec(e[d],t));return i+"\n"+(t=t.substring(1))+"}";case"function":return"<function>";case"string":return e;default:return String(e)}},js.Boot.__interfLoop=function(e,t){if(null==e)return!1;if(e==t)return!0;var n=e.__interfaces__;if(null!=n)for(var i=0,r=n.length;i<r;){var a=n[i++];if(a==t||js.Boot.__interfLoop(a,t))return!0}return js.Boot.__interfLoop(e.__super__,t)},js.Boot.__instanceof=function(e,t){try{if(e instanceof t)return t!=Array||null==e.__enum__;if(js.Boot.__interfLoop(e.__class__,t))return!0}catch(e){if(null==t)return!1}switch(t){case Int:return Math.ceil(e%2147483648)===e;case Float:return"number"==typeof e;case Bool:return!0===e||!1===e;case String:return"string"==typeof e;case Dynamic:return!0;default:return null!=e&&(t==Class&&null!=e.__name__||t==Enum&&null!=e.__ename__||e.__enum__==t)}},js.Boot.__cast=function(e,t){if(js.Boot.__instanceof(e,t))return e;throw"Cannot cast "+Std.string(e)+" to "+Std.string(t)},js.Lib=function(){},js.Lib.__name__=!0,js.Lib.debug=function(){},js.Lib.alert=function(e){alert(js.Boot.__string_rec(e,""))},js.Lib.eval=function(code){return eval(code)},js.Lib.setErrorHandler=function(e){js.Lib.onerror=e},Array.prototype.indexOf&&(HxOverrides.remove=function(e,t){var n=e.indexOf(t);return-1!=n&&(e.splice(n,1),!0)}),Math.__name__=["Math"],Math.NaN=Number.NaN,Math.NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY,Math.POSITIVE_INFINITY=Number.POSITIVE_INFINITY,Math.isFinite=function(e){return isFinite(e)},Math.isNaN=function(e){return isNaN(e)},String.prototype.__class__=String,String.__name__=!0,Array.prototype.__class__=Array,Array.__name__=!0,Date.prototype.__class__=Date,Date.__name__=["Date"];var Int={__name__:["Int"]},Dynamic={__name__:["Dynamic"]},Float=Number;Float.__name__=["Float"];var Bool=Boolean;Bool.__ename__=["Bool"];var Class={__name__:["Class"]},Enum={},Void={__ename__:["Void"]};"undefined"!=typeof document&&(js.Lib.document=document),"undefined"!=typeof window&&(js.Lib.window=window,js.Lib.window.onerror=function(e,t,n){var i=js.Lib.onerror;return null!=i&&i(e,[t+":"+n])}),com.wiris.js.JsPluginTools.main(),delete Array.prototype.__class__})(),function(){var HxOverrides=function(){};HxOverrides.__name__=!0,HxOverrides.dateStr=function(e){var t=e.getMonth()+1,n=e.getDate(),i=e.getHours(),r=e.getMinutes(),a=e.getSeconds();return e.getFullYear()+"-"+(t<10?"0"+t:""+t)+"-"+(n<10?"0"+n:""+n)+" "+(i<10?"0"+i:""+i)+":"+(r<10?"0"+r:""+r)+":"+(a<10?"0"+a:""+a)},HxOverrides.strDate=function(e){switch(e.length){case 8:var t=e.split(":"),n=new Date;return n.setTime(0),n.setUTCHours(t[0]),n.setUTCMinutes(t[1]),n.setUTCSeconds(t[2]),n;case 10:return t=e.split("-"),new Date(t[0],t[1]-1,t[2],0,0,0);case 19:var i=(t=e.split(" "))[0].split("-"),r=t[1].split(":");return new Date(i[0],i[1]-1,i[2],r[0],r[1],r[2]);default:throw"Invalid date format : "+e}},HxOverrides.cca=function(e,t){var n=e.charCodeAt(t);if(n==n)return n},HxOverrides.substr=function(e,t,n){return null!=t&&0!=t&&null!=n&&n<0?"":(null==n&&(n=e.length),t<0?(t=e.length+t)<0&&(t=0):n<0&&(n=e.length+n-t),e.substr(t,n))},HxOverrides.remove=function(e,t){for(var n=0,i=e.length;n<i;){if(e[n]==t)return e.splice(n,1),!0;n++}return!1},HxOverrides.iter=function(e){return{cur:0,arr:e,hasNext:function(){return this.cur<this.arr.length},next:function(){return this.arr[this.cur++]}}};var IntIter=function(e,t){this.min=e,this.max=t};IntIter.__name__=!0,IntIter.prototype={next:function(){return this.min++},hasNext:function(){return this.min<this.max},__class__:IntIter};var Std=function(){};Std.__name__=!0,Std.is=function(e,t){return js.Boot.__instanceof(e,t)},Std.string=function(e){return js.Boot.__string_rec(e,"")},Std.int=function(e){return 0|e},Std.parseInt=function(e){var t=parseInt(e,10);return 0!=t||120!=HxOverrides.cca(e,1)&&88!=HxOverrides.cca(e,1)||(t=parseInt(e)),isNaN(t)?null:t},Std.parseFloat=function(e){return parseFloat(e)},Std.random=function(e){return Math.floor(Math.random()*e)};var com=com||{};com.wiris||(com.wiris={}),com.wiris.js||(com.wiris.js={}),com.wiris.js.JsPluginTools=function(){this.tryReady()},com.wiris.js.JsPluginTools.__name__=!0,com.wiris.js.JsPluginTools.main=function(){var e;e=com.wiris.js.JsPluginTools.getInstance(),haxe.Timer.delay($bind(e,e.tryReady),100)},com.wiris.js.JsPluginTools.getInstance=function(){return null==com.wiris.js.JsPluginTools.instance&&(com.wiris.js.JsPluginTools.instance=new com.wiris.js.JsPluginTools),com.wiris.js.JsPluginTools.instance},com.wiris.js.JsPluginTools.bypassEncapsulation=function(){null==window.com&&(window.com={}),null==window.com.wiris&&(window.com.wiris={}),null==window.com.wiris.js&&(window.com.wiris.js={}),null==window.com.wiris.js.JsPluginTools&&(window.com.wiris.js.JsPluginTools=com.wiris.js.JsPluginTools.getInstance())},com.wiris.js.JsPluginTools.prototype={md5encode:function(e){return haxe.Md5.encode(e)},doLoad:function(){this.ready=!0,com.wiris.js.JsPluginTools.instance=this,com.wiris.js.JsPluginTools.bypassEncapsulation()},tryReady:function(){this.ready=!1,js.Lib.document.readyState&&(this.doLoad(),this.ready=!0),this.ready||haxe.Timer.delay($bind(this,this.tryReady),100)},__class__:com.wiris.js.JsPluginTools};var haxe=haxe||{};haxe.Log=function(){},haxe.Log.__name__=!0,haxe.Log.trace=function(e,t){js.Boot.__trace(e,t)},haxe.Log.clear=function(){js.Boot.__clear_trace()},haxe.Md5=function(){},haxe.Md5.__name__=!0,haxe.Md5.encode=function(e){return(new haxe.Md5).doEncode(e)},haxe.Md5.prototype={doEncode:function(e){for(var t=this.str2blks(e),n=1732584193,i=-271733879,r=-1732584194,a=271733878,o=0;o<t.length;){var s=n,l=i,c=r,u=a;n=this.ff(n,i,r,a,t[o],7,-680876936),a=this.ff(a,n,i,r,t[o+1],12,-389564586),r=this.ff(r,a,n,i,t[o+2],17,606105819),i=this.ff(i,r,a,n,t[o+3],22,-1044525330),n=this.ff(n,i,r,a,t[o+4],7,-176418897),a=this.ff(a,n,i,r,t[o+5],12,1200080426),r=this.ff(r,a,n,i,t[o+6],17,-1473231341),i=this.ff(i,r,a,n,t[o+7],22,-45705983),n=this.ff(n,i,r,a,t[o+8],7,1770035416),a=this.ff(a,n,i,r,t[o+9],12,-1958414417),r=this.ff(r,a,n,i,t[o+10],17,-42063),i=this.ff(i,r,a,n,t[o+11],22,-1990404162),n=this.ff(n,i,r,a,t[o+12],7,1804603682),a=this.ff(a,n,i,r,t[o+13],12,-40341101),r=this.ff(r,a,n,i,t[o+14],17,-1502002290),i=this.ff(i,r,a,n,t[o+15],22,1236535329),n=this.gg(n,i,r,a,t[o+1],5,-165796510),a=this.gg(a,n,i,r,t[o+6],9,-1069501632),r=this.gg(r,a,n,i,t[o+11],14,643717713),i=this.gg(i,r,a,n,t[o],20,-373897302),n=this.gg(n,i,r,a,t[o+5],5,-701558691),a=this.gg(a,n,i,r,t[o+10],9,38016083),r=this.gg(r,a,n,i,t[o+15],14,-660478335),i=this.gg(i,r,a,n,t[o+4],20,-405537848),n=this.gg(n,i,r,a,t[o+9],5,568446438),a=this.gg(a,n,i,r,t[o+14],9,-1019803690),r=this.gg(r,a,n,i,t[o+3],14,-187363961),i=this.gg(i,r,a,n,t[o+8],20,1163531501),n=this.gg(n,i,r,a,t[o+13],5,-1444681467),a=this.gg(a,n,i,r,t[o+2],9,-51403784),r=this.gg(r,a,n,i,t[o+7],14,1735328473),i=this.gg(i,r,a,n,t[o+12],20,-1926607734),n=this.hh(n,i,r,a,t[o+5],4,-378558),a=this.hh(a,n,i,r,t[o+8],11,-2022574463),r=this.hh(r,a,n,i,t[o+11],16,1839030562),i=this.hh(i,r,a,n,t[o+14],23,-35309556),n=this.hh(n,i,r,a,t[o+1],4,-1530992060),a=this.hh(a,n,i,r,t[o+4],11,1272893353),r=this.hh(r,a,n,i,t[o+7],16,-155497632),i=this.hh(i,r,a,n,t[o+10],23,-1094730640),n=this.hh(n,i,r,a,t[o+13],4,681279174),a=this.hh(a,n,i,r,t[o],11,-358537222),r=this.hh(r,a,n,i,t[o+3],16,-722521979),i=this.hh(i,r,a,n,t[o+6],23,76029189),n=this.hh(n,i,r,a,t[o+9],4,-640364487),a=this.hh(a,n,i,r,t[o+12],11,-421815835),r=this.hh(r,a,n,i,t[o+15],16,530742520),i=this.hh(i,r,a,n,t[o+2],23,-995338651),n=this.ii(n,i,r,a,t[o],6,-198630844),a=this.ii(a,n,i,r,t[o+7],10,1126891415),r=this.ii(r,a,n,i,t[o+14],15,-1416354905),i=this.ii(i,r,a,n,t[o+5],21,-57434055),n=this.ii(n,i,r,a,t[o+12],6,1700485571),a=this.ii(a,n,i,r,t[o+3],10,-1894986606),r=this.ii(r,a,n,i,t[o+10],15,-1051523),i=this.ii(i,r,a,n,t[o+1],21,-2054922799),n=this.ii(n,i,r,a,t[o+8],6,1873313359),a=this.ii(a,n,i,r,t[o+15],10,-30611744),r=this.ii(r,a,n,i,t[o+6],15,-1560198380),i=this.ii(i,r,a,n,t[o+13],21,1309151649),n=this.ii(n,i,r,a,t[o+4],6,-145523070),a=this.ii(a,n,i,r,t[o+11],10,-1120210379),r=this.ii(r,a,n,i,t[o+2],15,718787259),i=this.ii(i,r,a,n,t[o+9],21,-343485551),n=this.addme(n,s),i=this.addme(i,l),r=this.addme(r,c),a=this.addme(a,u),o+=16}return this.rhex(n)+this.rhex(i)+this.rhex(r)+this.rhex(a)},ii:function(e,t,n,i,r,a,o){return this.cmn(this.bitXOR(n,this.bitOR(t,~i)),e,t,r,a,o)},hh:function(e,t,n,i,r,a,o){return this.cmn(this.bitXOR(this.bitXOR(t,n),i),e,t,r,a,o)},gg:function(e,t,n,i,r,a,o){return this.cmn(this.bitOR(this.bitAND(t,i),this.bitAND(n,~i)),e,t,r,a,o)},ff:function(e,t,n,i,r,a,o){return this.cmn(this.bitOR(this.bitAND(t,n),this.bitAND(~t,i)),e,t,r,a,o)},cmn:function(e,t,n,i,r,a){return this.addme(this.rol(this.addme(this.addme(t,e),this.addme(i,a)),r),n)},rol:function(e,t){return e<<t|e>>>32-t},str2blks:function(e){for(var t=1+(e.length+8>>6),n=new Array,i=0,r=16*t;i<r;)n[a=i++]=0;for(var a=0;a<e.length;)n[a>>2]|=HxOverrides.cca(e,a)<<(8*e.length+a)%4*8,a++;n[a>>2]|=128<<(8*e.length+a)%4*8;var o=8*e.length,s=16*t-2;return n[s]=255&o,n[s]|=(o>>>8&255)<<8,n[s]|=(o>>>16&255)<<16,n[s]|=(o>>>24&255)<<24,n},rhex:function(e){for(var t="",n="0123456789abcdef",i=0;i<4;){var r=i++;t+=n.charAt(e>>8*r+4&15)+n.charAt(e>>8*r&15)}return t},addme:function(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n},bitAND:function(e,t){return(e>>>1&t>>>1)<<1|1&e&t},bitXOR:function(e,t){return(e>>>1^t>>>1)<<1|1&e^1&t},bitOR:function(e,t){return(e>>>1|t>>>1)<<1|1&e|1&t},__class__:haxe.Md5},haxe.Timer=function(e){var t=this;this.id=window.setInterval(function(){t.run()},e)},haxe.Timer.__name__=!0,haxe.Timer.delay=function(e,t){var n=new haxe.Timer(t);return n.run=function(){n.stop(),e()},n},haxe.Timer.measure=function(e,t){var n=haxe.Timer.stamp(),i=e();return haxe.Log.trace(haxe.Timer.stamp()-n+"s",t),i},haxe.Timer.stamp=function(){return(new Date).getTime()/1e3},haxe.Timer.prototype={run:function(){},stop:function(){null!=this.id&&(window.clearInterval(this.id),this.id=null)},__class__:haxe.Timer};var js=js||{},$_;function $bind(e,t){var n=function(){return n.method.apply(n.scope,arguments)};return n.scope=e,n.method=t,n}js.Boot=function(){},js.Boot.__name__=!0,js.Boot.__unhtml=function(e){return e.split("&").join("&amp;").split("<").join("&lt;").split(">").join("&gt;")},js.Boot.__trace=function(e,t){var n,i=null!=t?t.fileName+":"+t.lineNumber+": ":"";i+=js.Boot.__string_rec(e,""),"undefined"!=typeof document&&null!=(n=document.getElementById("haxe:trace"))?n.innerHTML+=js.Boot.__unhtml(i)+"<br/>":"undefined"!=typeof console&&null!=console.log&&console.log(i)},js.Boot.__clear_trace=function(){var e=document.getElementById("haxe:trace");null!=e&&(e.innerHTML="")},js.Boot.isClass=function(e){return e.__name__},js.Boot.isEnum=function(e){return e.__ename__},js.Boot.getClass=function(e){return e.__class__},js.Boot.__string_rec=function(e,t){if(null==e)return"null";if(t.length>=5)return"<...>";var n=typeof e;switch("function"==n&&(e.__name__||e.__ename__)&&(n="object"),n){case"object":if(e instanceof Array){if(e.__enum__){if(2==e.length)return e[0];var i=e[0]+"(";t+="\t";for(var r=2,a=e.length;r<a;)i+=2!=(o=r++)?","+js.Boot.__string_rec(e[o],t):js.Boot.__string_rec(e[o],t);return i+")"}var o,s=e.length;for(i="[",t+="\t",a=0;a<s;){var l=a++;i+=(l>0?",":"")+js.Boot.__string_rec(e[l],t)}return i+"]"}var c;try{c=e.toString}catch(e){return"???"}if(null!=c&&c!=Object.toString){var u=e.toString();if("[object Object]"!=u)return u}var d=null;i="{\n",t+="\t";var m=null!=e.hasOwnProperty;for(var d in e)m&&!e.hasOwnProperty(d)||"prototype"!=d&&"__class__"!=d&&"__super__"!=d&&"__interfaces__"!=d&&"__properties__"!=d&&(2!=i.length&&(i+=", \n"),i+=t+d+" : "+js.Boot.__string_rec(e[d],t));return i+"\n"+(t=t.substring(1))+"}";case"function":return"<function>";case"string":return e;default:return String(e)}},js.Boot.__interfLoop=function(e,t){if(null==e)return!1;if(e==t)return!0;var n=e.__interfaces__;if(null!=n)for(var i=0,r=n.length;i<r;){var a=n[i++];if(a==t||js.Boot.__interfLoop(a,t))return!0}return js.Boot.__interfLoop(e.__super__,t)},js.Boot.__instanceof=function(e,t){try{if(e instanceof t)return t!=Array||null==e.__enum__;if(js.Boot.__interfLoop(e.__class__,t))return!0}catch(e){if(null==t)return!1}switch(t){case Int:return Math.ceil(e%2147483648)===e;case Float:return"number"==typeof e;case Bool:return!0===e||!1===e;case String:return"string"==typeof e;case Dynamic:return!0;default:return null!=e&&(t==Class&&null!=e.__name__||t==Enum&&null!=e.__ename__||e.__enum__==t)}},js.Boot.__cast=function(e,t){if(js.Boot.__instanceof(e,t))return e;throw"Cannot cast "+Std.string(e)+" to "+Std.string(t)},js.Lib=function(){},js.Lib.__name__=!0,js.Lib.debug=function(){},js.Lib.alert=function(e){alert(js.Boot.__string_rec(e,""))},js.Lib.eval=function(code){return eval(code)},js.Lib.setErrorHandler=function(e){js.Lib.onerror=e},Array.prototype.indexOf&&(HxOverrides.remove=function(e,t){var n=e.indexOf(t);return-1!=n&&(e.splice(n,1),!0)}),Math.__name__=["Math"],Math.NaN=Number.NaN,Math.NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY,Math.POSITIVE_INFINITY=Number.POSITIVE_INFINITY,Math.isFinite=function(e){return isFinite(e)},Math.isNaN=function(e){return isNaN(e)},String.prototype.__class__=String,String.__name__=!0,Array.prototype.__class__=Array,Array.__name__=!0,Date.prototype.__class__=Date,Date.__name__=["Date"];var Int={__name__:["Int"]},Dynamic={__name__:["Dynamic"]},Float=Number;Float.__name__=["Float"];var Bool=Boolean;Bool.__ename__=["Bool"];var Class={__name__:["Class"]},Enum={},Void={__ename__:["Void"]};"undefined"!=typeof document&&(js.Lib.document=document),"undefined"!=typeof window&&(js.Lib.window=window,js.Lib.window.onerror=function(e,t,n){var i=js.Lib.onerror;return null!=i&&i(e,[t+":"+n])}),com.wiris.js.JsPluginTools.main()}(),delete Array.prototype.__class__},330:e=>{e.exports=JSON.parse('{"name":"@wiris/mathtype-viewer","version":"8.13.4","description":"","main":"app.js","scripts":{"build":"webpack --mode production","build-dev":"webpack --mode development","serve":"webpack serve","prepack":"yarn && npm run build"},"keywords":["typescript","course"],"author":"Integrations","license":"ISC","dependencies":{"@wiris/mathtype-html-integration-devkit":"1.17.11"},"devDependencies":{"@babel/preset-typescript":"^7.24.1","@types/jest":"^29.5.12","babel-jest":"^29.7.0","babel-loader":"^9.1.3","jest":"^29.7.0","jest-environment-jsdom":"^29.7.0","lite-server":"^2.5.4","ts-loader":"^9.4.2","webpack":"^5.75.0","webpack-cli":"^5.0.0","webpack-dev-server":"^5.0.4"}}')},443:(e,t,n)=>{n.r(t),n.d(t,{default:()=>a});var i=n(931),r=n(631);class a{static isMathmlInAttribute(e,t){const n=new RegExp("^['\"][\\s]*=[\\s]*[\\w-]+('[\\s]*(\"[^\"]*\"|'[^']*')[\\s]*=[\\s]*[\\w-]+[\\s]*')*[\\s]+gmi<"),i=e.substring(0,t).split("").reverse().join("");return n.test(i)}static safeXmlDecode(e){let{tagOpener:t}=i.A.safeXmlCharactersEntities,{tagCloser:n}=i.A.safeXmlCharactersEntities,{doubleQuote:r}=i.A.safeXmlCharactersEntities,{realDoubleQuote:a}=i.A.safeXmlCharactersEntities;e=(e=(e=(e=e.split(t).join(i.A.safeXmlCharacters.tagOpener)).split(n).join(i.A.safeXmlCharacters.tagCloser)).split(r).join(i.A.safeXmlCharacters.doubleQuote)).split(a).join(i.A.safeXmlCharacters.realDoubleQuote);const{ltElement:o}=i.A.safeBadBlackboardCharacters,{gtElement:s}=i.A.safeBadBlackboardCharacters,{ampElement:l}=i.A.safeBadBlackboardCharacters;"_wrs_blackboard"in window&&window._wrs_blackboard&&(e=(e=(e=e.split(o).join(i.A.safeGoodBlackboardCharacters.ltElement)).split(s).join(i.A.safeGoodBlackboardCharacters.gtElement)).split(l).join(i.A.safeGoodBlackboardCharacters.ampElement)),({tagOpener:t}=i.A.safeXmlCharacters),({tagCloser:n}=i.A.safeXmlCharacters),({doubleQuote:r}=i.A.safeXmlCharacters),({realDoubleQuote:a}=i.A.safeXmlCharacters);const{ampersand:c}=i.A.safeXmlCharacters,{quote:u}=i.A.safeXmlCharacters;e=(e=(e=(e=(e=e.split(t).join(i.A.xmlCharacters.tagOpener)).split(n).join(i.A.xmlCharacters.tagCloser)).split(r).join(i.A.xmlCharacters.doubleQuote)).split(c).join(i.A.xmlCharacters.ampersand)).split(u).join(i.A.xmlCharacters.quote);let d="",m=null;for(let t=0;t<e.length;t+=1){const n=e.charAt(t);null==m?"$"===n?m="":d+=n:";"===n?(d+=`&${m}`,m=null):n.match(/([a-zA-Z0-9#._-] | '-')/)?m+=n:(d+=`$${m}`,m=null,t-=1)}return d}static safeXmlEncode(e){const{tagOpener:t}=i.A.xmlCharacters,{tagCloser:n}=i.A.xmlCharacters,{doubleQuote:r}=i.A.xmlCharacters,{ampersand:a}=i.A.xmlCharacters,{quote:o}=i.A.xmlCharacters;return(e=(e=(e=(e=e.split(t).join(i.A.safeXmlCharacters.tagOpener)).split(n).join(i.A.safeXmlCharacters.tagCloser)).split(r).join(i.A.safeXmlCharacters.doubleQuote)).split(a).join(i.A.safeXmlCharacters.ampersand)).split(o).join(i.A.safeXmlCharacters.quote)}static mathMLEntities(e){let t="";for(let n=0;n<e.length;n+=1){const i=e.charAt(n);if(e.codePointAt(n)>128)t+=`&#${e.codePointAt(n)};`,e.codePointAt(n)>65535&&(n+=1);else if("&"===i){const a=e.indexOf(";",n+1);if(a>=0){const i=document.createElement("span");i.innerHTML=e.substring(n,a+1),t+=`&#${r.default.fixedCharCodeAt(i.textContent||i.innerText,0)};`,n=a}else t+=i}else t+=i}return t}static addCustomEditorClassAttribute(e,t){let n="";const i=e.indexOf("<math");if(0===i){const r=e.indexOf(">");if(-1===e.indexOf("class"))return n=`${e.substr(i,r)} class="wrs_${t}">`,n+=e.substr(r+1,e.length),n}return e}static removeCustomEditorClassAttribute(e,t){return-1===e.indexOf("class")||-1===e.indexOf(`wrs_${t}`)?e:-1!==e.indexOf(` class="wrs_${t}"`)?e.replace(` class="wrs_${t}"`,""):-1!==e.indexOf(`class="wrs_${t}"`)?e.replace(`class="wrs_${t}"`,""):e.replace(`wrs_${t}`,"")}static addAnnotation(e,t,n){let i="";if(-1!==e.indexOf("<annotation")){const r=e.indexOf("</semantics>");i=`${e.substring(0,r)}<annotation encoding="${n}">${t}</annotation>${e.substring(r)}`}else if(a.isEmpty(e)){const r=e.indexOf("/>"),a=e.indexOf(">"),o=a===r?r:a;i=`${e.substring(0,o)}><semantics><annotation encoding="${n}">${t}</annotation></semantics></math>`}else{const r=e.indexOf(">")+1,a=e.lastIndexOf("</math>"),o=e.substring(r,a);i=`${e.substring(0,r)}<semantics><mrow>${o}</mrow><annotation encoding="${n}">${t}</annotation></semantics></math>`}return i}static removeAnnotation(e,t){let n=e;const i=`<annotation encoding="${t}">`,r=e.indexOf(i);if(-1!==r){let t=!1,i=e.indexOf("<annotation");for(;-1!==i;)i!==r&&(t=!0),i=e.indexOf("<annotation",i+1);if(t){const t=e.indexOf("</annotation>",r)+13;n=e.substring(0,r)+e.substring(t)}else n=a.removeSemantics(e)}return n}static removeSemantics(e){return e.replace(/<semantics>\s*?(<mrow>)?/gm,"").replace(/(<\/mrow>)?\s*<annotation[\W\w]*?<\/semantics>/gm,"")}static removeSafeXMLSemantics(e){return e.replace(/«semantics»\s*?(«mrow»)?/gm,"").replace(/(«\/mrow»)?\s*«annotation[\W\w]*?«\/semantics»/gm,"")}static removeSemanticsOcurrences(e,t=i.A.xmlCharacters){const n=`${t.tagOpener}math`,r=`${t.tagOpener}/math${t.tagCloser}`,a=`/${t.tagCloser}`,{tagCloser:o}=t,s=`${t.tagOpener}semantics${t.tagCloser}`,l=`${t.tagOpener}annotation encoding=`;let c="",u=e.indexOf(n),d=0;for(;-1!==u;){c+=e.substring(d,u);const t=e.indexOf(r,u),i=e.indexOf(a,u),m=e.indexOf(o,u);-1!==t?d=t:i===m-1&&(d=i);const f=e.indexOf(s,u);if(-1!==f){const t=e.substring(u,f),i=e.indexOf(l,u);if(-1!==i){const a=f+s.length;c+=t+e.substring(a,i)+r,u=e.indexOf(n,u+n.length),d+=r.length}else d=u,u=e.indexOf(n,u+n.length)}else d=u,u=e.indexOf(n,u+n.length)}return c+=e.substring(d,e.length),c}static containClass(e,t){const n=e.indexOf("class");if(-1===n)return!1;const i=e.indexOf(">",n);return-1!==e.substring(n,i).indexOf(t)}static isEmpty(e){const t=e.indexOf(">"),n=e.indexOf("/>");let i=!1;if(-1!==n&&n===t-1&&(i=!0),!i){const n=new RegExp("</(.+:)?math>").exec(e);n&&(i=t+1===n.index)}return i}static encodeProperties(e){return e.replace(/\w+=".*?"/g,e=>{const t=e.indexOf('"'),n=e.substring(t+1,e.length-1),i=r.default.htmlEntities(n);return`${e.substring(0,t+1)}${i}"`})}}},480:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function s(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}l((i=i.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){var n,i,r,a,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,a=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=a.next()).done;)o.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return o},s=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var i,r=0,a=t.length;r<a;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))},l=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.serializeHtmlToXml=t.renderMathML=void 0;var c=n(975),u=l(n(443));function d(e,t){return Array.from(t).some(function(t){return t.contains(e)})}function m(e,t,n){return i(this,void 0,void 0,function(){var i,a,o;return r(this,function(r){switch(r.label){case 0:if((i=document.createElement("img")).src="data:image/svg+xml;charset=utf8,".concat(encodeURIComponent(t.content)),i.setAttribute(e.wiriseditormathmlattribute,n),i.setAttribute("class","Wirisformula"),i.setAttribute("role","math"),+t.height>0&&(i.style.verticalAlign="-"+(+t.height-+t.baseline)+"px",i.height=+t.height,i.width=+t.width),h.some(function(e){return n.includes(e)}))return[3,5];r.label=1;case 1:return r.trys.push([1,4,,5]),t.alt?[3,3]:[4,(0,c.mathml2accessible)(n,e.lang,e.editorServicesRoot,e.editorServicesExtension)];case 2:a=r.sent().text,t.alt=a,r.label=3;case 3:return i.alt=null!==(o=t.alt)&&void 0!==o?o:"",[3,5];case 4:return r.sent(),i.alt="Alternative text not available",[3,5];case 5:return[2,i]}})})}function f(e){return(new XMLSerializer).serializeToString(document.createRange().createContextualFragment(e))}t.renderMathML=function(e,t){return i(this,void 0,void 0,function(){var n,i,l,h,p,_,g,b,v,x;return r(this,function(r){switch(r.label){case 0:if("image"!==e.viewer&&"mathml"!==e.viewer)return[2];(function(e,t){var n,i,r,o,s,l,c=function(e){for(var t,n=document.createNodeIterator(e,NodeFilter.SHOW_TEXT,function(e){return/«math(.*?)«\/math»/g.test(e.nodeValue||"")?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}),i=[];t=n.nextNode();)i.push(t);return i}(e),m=null!==(r=e.querySelectorAll(t))&&void 0!==r?r:[];try{for(var f=a(c),h=f.next();!h.done;h=f.next()){var p=h.value;if(m.length>0&&d(p,m))console.log("Node is blacklisted");else{var _=u.default.safeXmlDecode(null!==(o=p.textContent)&&void 0!==o?o:""),g=document.createRange().createContextualFragment(_);null===(s=p.parentNode)||void 0===s||s.insertBefore(g,p),null===(l=p.parentNode)||void 0===l||l.removeChild(p)}}}catch(e){n={error:e}}finally{try{h&&!h.done&&(i=f.return)&&i.call(f)}finally{if(n)throw n.error}}})(t,e.ignored_containers),r.label=1;case 1:r.trys.push([1,12,13,14]),n=a(s([],o(t.getElementsByTagName("math")),!1)),i=n.next(),r.label=2;case 2:if(i.done)return[3,11];l=i.value,h=f(l.outerHTML),r.label=3;case 3:return r.trys.push([3,9,,10]),p=void 0,"true"!==e.wirispluginperformance?[3,5]:[4,(0,c.showImage)(h,e.lang,e.editorServicesRoot,e.editorServicesExtension)];case 4:return p=r.sent(),[3,7];case 5:return[4,(0,c.createImage)(h,e.lang,e.editorServicesRoot,e.editorServicesExtension)];case 6:p=r.sent(),r.label=7;case 7:return[4,m(e,p,h)];case 8:return _=r.sent(),null===(x=l.parentNode)||void 0===x||x.replaceChild(_,l),[3,10];case 9:return r.sent(),console.error("Cannot render ".concat(h,": invalid MathML format.")),[3,10];case 10:return i=n.next(),[3,2];case 11:return[3,14];case 12:return g=r.sent(),b={error:g},[3,14];case 13:try{i&&!i.done&&(v=n.return)&&v.call(n)}finally{if(b)throw b.error}return[7];case 14:return[2]}})})},t.serializeHtmlToXml=f;var h=["⟦","&#10214;","⟧","&#10215;","mscarries","mscarry","msgroup","mstack","msline","msrow"]},482:(e,t,n)=>{n.r(t),n.d(t,{default:()=>f});var i=n(631),r=n(574),a=n(443),o=n(976);class s{static removeImgDataAttributes(e){const t=[],{attributes:n}=e;Object.keys(n).forEach(e=>{const i=n[e];void 0!==i&&void 0!==i.name&&0===i.name.indexOf("data-")&&t.push(i.name)}),t.forEach(t=>{e.removeAttribute(t)})}static clone(e,t){const n=o.A.get("imageCustomEditorName");e.hasAttribute(n)||t.removeAttribute(n),[o.A.get("imageMathmlAttribute"),n,"alt","height","width","style","src","role"].forEach(n=>{const i=e.getAttribute(n);i&&t.setAttribute(n,i)})}static isSvg(e){return e.src.startsWith("data:image/svg+xml;")}static isBase64(e){return e.src.startsWith("data:image/svg+xml;base64,")||e.src.startsWith("data:image/png;base64,")}static setImgSize(e,t,n){let r,a,o,l;if(n)if(s.isSvg(e))if(s.isBase64(e)){a=e.src.substr(e.src.indexOf("base64,")+7,e.src.length),l="",o=i.default.b64ToByteArray(a,a.length);for(let e=0;e<o.length;e+=1)l+=String.fromCharCode(o[e]);r=s.getMetricsFromSvgString(l)}else r=s.getMetricsFromSvgString(t);else a=e.src.substr(e.src.indexOf("base64,")+7,e.src.length),o=i.default.b64ToByteArray(a,88),r=s.getMetricsFromBytes(o);else r=i.default.urlToAssArray(t);let c=r.cw;if(!c)return;let u=r.ch,d=r.cb;const{dpi:m}=r;m&&(c=96*c/m,u=96*u/m,d=96*d/m),e.width=c,e.height=u,e.style.verticalAlign=`-${u-d}px`}static fixAfterResize(e){e.removeAttribute("style"),e.removeAttribute("width"),e.removeAttribute("height"),e.style.maxWidth="none";const t=e=>{if(-1!==e.src.indexOf("data:image"))if(-1!==e.src.indexOf("data:image/svg+xml"))if(-1!==e.src.indexOf("data:image/svg+xml;base64,")){const t=e.getAttribute("src").substring(26),n=window.atob(t),i=encodeURIComponent(n);e.setAttribute("src",`data:image/svg+xml;charset=utf8,${i}`);const r=decodeURIComponent(e.src.substring(32,e.src.length));s.setImgSize(e,r,!0),e.setAttribute("src",`data:image/svg+xml;base64,${t}`)}else{const t=decodeURIComponent(e.src.substring(32,e.src.length));s.setImgSize(e,t,!0)}else{const t=e.src.substring(22,e.src.length);s.setImgSize(e,t,!0)}else s.setImgSize(e,e.src)};if(-1===e.src.indexOf("blob:"))t(e);else{const n=new FileReader;n.onload=function(){e.setAttribute("src",n.result),t(e)},fetch(e.src).then(e=>e.blob()).then(e=>{n.readAsDataURL(e)})}}static getMetricsFromSvgString(e){let t=e.indexOf('height="'),n=e.indexOf('"',t+8,e.length);const i=e.substring(t+8,n);t=e.indexOf('width="'),n=e.indexOf('"',t+7,e.length);const r=e.substring(t+7,n);t=e.indexOf('wrs:baseline="'),n=e.indexOf('"',t+14,e.length);const a=e.substring(t+14,n);if(void 0!==r){const e=[];return e.cw=r,e.ch=i,void 0!==a&&(e.cb=a),e}return[]}static getMetricsFromBytes(e){let t,n,r,a,o;for(i.default.readBytes(e,0,8);e.length>=4;)r=i.default.readInt32(e),1229472850===r?(t=i.default.readInt32(e),n=i.default.readInt32(e),i.default.readInt32(e),i.default.readByte(e)):1650545477===r?a=i.default.readInt32(e):1883789683===r&&(o=i.default.readInt32(e),o=Math.round(o/39.37),i.default.readInt32(e),i.default.readByte(e)),i.default.readInt32(e);if(void 0!==t){const e=[];return e.cw=t,e.ch=n,e.dpi=o,a&&(e.cb=a),e}return[]}}var l=n(33),c=n(654),u=n(565);class d{static get cache(){return d._cache}static set cache(e){d._cache=e}static mathMLToAccessible(e,t,n){void 0===t&&(t="en"),a.default.containClass(e,"wrs_chemistry")&&(n.mode="chemistry"),n.ignoreStyles=!0;let i="";if(d.cache.get(e))i=d.cache.get(e);else{n.service="mathml2accessible",n.lang=t;const r=JSON.parse(c.A.getService("service",n));"error"!==r.status?(i=r.result.text,d.cache.populate(e,i)):i=u.A.get("error_convert_accessibility")}return i}}d._cache=new l.A;var m=n(931);n(206);class f{static mathmlToImgObject(e,t,n,r){const l=e.createElement("img");l.align="middle",l.style.maxWidth="none";let u=n||{};if(u={...o.A.get("editorParameters"),...u},u.mml=t,u.lang=r,u.metrics="true",u.centerbaseline="false","base64"===o.A.get("saveMode")&&"default"===o.A.get("base64savemode")&&(u.base64=!0),l.className=o.A.get("imageClassName"),-1!==t.indexOf('class="')){let e=t.substring(t.indexOf('class="')+7,t.length);e=e.substring(0,e.indexOf('"')),e=e.substring(4,e.length),l.setAttribute(o.A.get("imageCustomEditorName"),e)}if(!o.A.get("wirisPluginPerformance")||"xml"!==o.A.get("saveMode")&&"safeXml"!==o.A.get("saveMode")){const e=f.createImageSrc(t,u);l.setAttribute(o.A.get("imageMathmlAttribute"),a.default.safeXmlEncode(t)),l.src=e,s.setImgSize(l,e,"base64"===o.A.get("saveMode")&&"default"===o.A.get("base64savemode")),o.A.get("enableAccessibility")&&(l.alt=d.mathMLToAccessible(t,r,u))}else{let e=JSON.parse(f.createShowImageSrc(u,r));if("warning"===e.status)try{e=JSON.parse(c.A.getService("showimage",u))}catch(e){return null}({result:e}=e),"png"===e.format?l.src=`data:image/png;base64,${e.content}`:l.src=`data:image/svg+xml;charset=utf8,${i.default.urlEncode(e.content)}`,l.setAttribute(o.A.get("imageMathmlAttribute"),a.default.safeXmlEncode(t)),s.setImgSize(l,e.content,!0),o.A.get("enableAccessibility")&&(void 0===e.alt?l.alt=d.mathMLToAccessible(t,r,u):l.alt=e.alt)}return void 0!==f.observer&&f.observer.observe(l),l.setAttribute("role","math"),l}static createImageSrc(e,t){"base64"===o.A.get("saveMode")&&"default"===o.A.get("base64savemode")&&(t.base64=!0);let n=c.A.getService("createimage",t);if(-1!==n.indexOf("@BASE@")){const e=c.A.getServicePath("createimage").split("/");e.pop(),n=n.split("@BASE@").join(e.join("/"))}return n}static initParse(e,t){return e=f.initParseSaveMode(e,t),f.initParseEditMode(e)}static initParseSaveMode(e,t){return o.A.get("saveMode")&&(e=r.A.parseMathmlToLatex(e,m.A.safeXmlCharacters),e=r.A.parseMathmlToLatex(e,m.A.xmlCharacters),e=f.parseMathmlToImg(e,m.A.safeXmlCharacters,t),e=f.parseMathmlToImg(e,m.A.xmlCharacters,t),"base64"===o.A.get("saveMode")&&"image"===o.A.get("base64savemode")&&(e=f.codeImgTransform(e,"base642showimage"))),e}static initParseEditMode(e){if(-1!==o.A.get("parseModes").indexOf("latex")){const t=i.default.getElementsByNameFromString(e,"img",!0),n='encoding="LaTeX">';let r=0;for(let s=0;s<t.length;s+=1){const l=e.substring(t[s].start+r,t[s].end+r);if(-1!==l.indexOf(` class="${o.A.get("imageClassName")}"`)){let c=` ${o.A.get("imageMathmlAttribute")}="`,u=l.indexOf(c);if(-1===u&&(c=' alt="',u=l.indexOf(c)),-1!==u){u+=c.length;const o=l.indexOf('"',u),d=i.default.htmlSanitize(a.default.safeXmlDecode(l.substring(u,o)));let m=d.indexOf(n);if(-1!==m){m+=n.length;const a=d.indexOf("</annotation>",m),o=d.substring(m,a),l=`$$${i.default.htmlEntitiesDecode(o)}$$`,c=e.substring(0,t[s].start+r),u=e.substring(t[s].end+r);e=c+l+u,r+=l.length-(t[s].end-t[s].start)}}}}}return e}static endParse(e){const t=f.endParseEditMode(e);return f.endParseSaveMode(t)}static endParseEditMode(e){if(-1!==o.A.get("parseModes").indexOf("latex")){let t="",n=0,s=e.indexOf("$$");for(;-1!==s;){if(t+=e.substring(n,s),n=e.indexOf("$$",s+2),-1!==n){const l=e.substring(s+2,n),c=i.default.htmlEntitiesDecode(l);let u=i.default.htmlSanitize(r.A.getMathMLFromLatex(c,!0));o.A.get("saveHandTraces")||(u=a.default.removeAnnotation(u,"application/json")),t+=u,n+=2}else t+="$$",n=s+2;s=e.indexOf("$$",n)}t+=e.substring(n,e.length),e=t}return e}static endParseSaveMode(e){const t=o.A.get("saveMode"),n=o.A.get("base64savemode");return t&&("safeXml"===t||"xml"===t?e=f.codeImgTransform(e,"img2mathml"):"base64"===t&&"image"===n&&(e=f.codeImgTransform(e,"img264"))),e}static createShowImageSrcData(e,t){const n={};["mml","color","centerbaseline","zoom","dpi","fontSize","fontFamily","defaultStretchy","backgroundColor","format"].forEach(t=>{void 0!==e[t]&&(n[t]=e[t])});const r={};return Object.keys(e).forEach(t=>{"mml"!==t&&(r[t]=e[t])}),r.formula=com.wiris.js.JsPluginTools.md5encode(i.default.propertiesToString(n)),r.lang=void 0===t?"en":t,r.version=o.A.get("version"),r}static createShowImageSrc(e,t){const n=this.createShowImageSrcData(e,t);return c.A.getService("showimage",i.default.httpBuildQuery(n),!0)}static codeImgTransform(e,t){let n="",r=0;const l=/<img/gi,c=l.source.length;for(;l.test(e);){const u=l.lastIndex-c;n+=e.substring(r,u);let d=u+1;for(;d<e.length&&r<=u;){const t=e.charAt(d);if('"'===t||"'"===t){const n=e.indexOf(t,d+1);d=-1===n?e.length:n}else">"===t&&(r=d+1);d+=1}if(r<u)return n+=e.substring(u,e.length),n;let m=e.substring(u,r);const h=i.default.createObject(m);let p,_,g=h.getAttribute(o.A.get("imageMathmlAttribute"));if("base642showimage"===t)null==g&&(g=h.getAttribute("alt")),g=a.default.safeXmlDecode(g),m=f.mathmlToImgObject(document,g,null,null),n+=i.default.createObjectCode(m);else if("img2mathml"===t)o.A.get("saveMode")&&("safeXml"===o.A.get("saveMode")?(p=!0,_=!0):"xml"===o.A.get("saveMode")&&(p=!0,_=!1)),n+=i.default.getWIRISImageOutput(m,p,_);else if("img264"===t){null===g&&(g=h.getAttribute("alt")),g=a.default.safeXmlDecode(g);const e={base64:"true"};m=f.mathmlToImgObject(document,g,e,null),s.setImgSize(m,m.src,!0),n+=i.default.createObjectCode(m)}}return n+=e.substring(r,e.length),n}static parseMathmlToImg(e,t,n){let r="";const s=`${t.tagOpener}math`,l=`${t.tagOpener}/math${t.tagCloser}`;let c=e.indexOf(s),u=0;for(;-1!==c;){r+=e.substring(u,c);const d=e.indexOf(o.A.get("imageMathmlAttribute"));if(u=e.indexOf(l,c),-1===u?u=e.length-1:u+=-1!==d?e.indexOf("/>",c):l.length,a.default.isMathmlInAttribute(e,c)||-1!==d)r+=e.substring(c,u);else{let o=e.substring(c,u);o=t.id===m.A.safeXmlCharacters.id?a.default.safeXmlDecode(o):a.default.mathMLEntities(o),r+=i.default.createObjectCode(f.mathmlToImgObject(document,o,null,n))}c=e.indexOf(s,u)}return r+=e.substring(u,e.length),r}}if("undefined"!=typeof MutationObserver){const e=new MutationObserver(e=>{e.forEach(e=>{e.oldValue===o.A.get("imageClassName")&&"class"===e.attributeName&&-1===e.target.className.indexOf(o.A.get("imageClassName"))&&(e.target.className=o.A.get("imageClassName"))})});f.observer=Object.create(e),f.observer.Config={attributes:!0,attributeOldValue:!0},f.observer.observe=function(e){Object.getPrototypeOf(this).observe(e,this.Config)}}},565:(e,t,n)=>{n.d(t,{A:()=>r});const i=JSON.parse('{"ar":{"latex":"LaTeX","cancel":"إلغاء","accept":"إدراج","manual":"الدليل","insert_math":"إدراج صيغة رياضية - MathType","insert_chem":"إدراج صيغة كيميائية - ChemType","minimize":"تصغير","maximize":"تكبير","fullscreen":"ملء الشاشة","exit_fullscreen":"الخروج من ملء الشاشة","close":"إغلاق","mathtype":"MathType","title_modalwindow":"نافذة MathType مشروطة","close_modal_warning":"هل تريد المغادرة بالتأكيد؟ ستُفقد التغييرات التي أجريتها.","latex_name_label":"صيغة Latex","browser_no_compatible":"المستعرض غير متوافق مع تقنية AJAX. الرجاء استخدام أحدث إصدار من Mozilla Firefox.","error_convert_accessibility":"حدث خطأ أثناء التحويل من MathML إلى نص قابل للاستخدام.","exception_cross_site":"البرمجة النصية للمواقع المشتركة مسموح بها لـ HTTP فقط.","exception_high_surrogate":"المركّب المرتف