UNPKG

@zklogic/draw.io

Version:

Draw.IO - Graph Editor integration in Angular-cli

1 lines 14.1 kB
MathJax.Hub.Register.StartupHook("Sre Ready",(function(){var e,t,a=MathJax.Hub.config.menuSettings,i={};MathJax.Hub.Register.StartupHook("MathEvents Ready",(function(){e=MathJax.Extension.MathEvents.Event.False,t=MathJax.Extension.MathEvents.Event.KEY}));var n=MathJax.Extension.explorer={version:"1.6.0",dependents:[],defaults:{walker:"table",highlight:"none",background:"blue",foreground:"black",speech:!0,generation:"lazy",subtitle:!1,ruleset:"mathspeak-default"},eagerComplexity:80,prefix:"Assistive-",hook:null,locHook:null,oldrules:null,addMenuOption:function(e,t){a[n.prefix+e]=t},addDefaults:function(){for(var e,t=MathJax.Hub.CombineConfig("explorer",n.defaults),i=Object.keys(t),o=0;e=i[o];o++)void 0===a[n.prefix+e]&&n.addMenuOption(e,t[e]);n.setSpeechOption(),s.Reset()},setOption:function(e,t){a[n.prefix+e]!==t&&(n.addMenuOption(e,t),s.Reset())},getOption:function(e){return a[n.prefix+e]},speechOption:function(e){n.oldrules!==e.value&&(n.setSpeechOption(),s.Regenerate())},setSpeechOption:function(){var e=a[n.prefix+"ruleset"],t=e.split("-");sre.System.getInstance().setupEngine({locale:MathJax.Localization.locale,domain:n.Domain(t[0]),style:t[1]}),n.oldrules=e},Domain:function(e){switch(e){case"chromevox":return"default";case"clearspeak":return"clearspeak";default:return"mathspeak"}},Enable:function(e,t){a.explorer=!0,t&&(i.explorer=!0),MathJax.Extension.collapsible.Enable(!1,t),MathJax.Extension.AssistiveMML&&(MathJax.Extension.AssistiveMML.config.disabled=!0,a.assistiveMML=!1,t&&(i.assistiveMML=!1)),this.DisableMenus(!1),this.hook||(this.hook=MathJax.Hub.Register.MessageHook("New Math",["Register",this.Explorer])),this.locHook||(this.locHook=MathJax.Hub.Register.MessageHook("Locale Reset",["RemoveSpeech",this.Explorer])),e&&MathJax.Hub.Queue(["Reprocess",MathJax.Hub])},Disable:function(e,t){a.explorer=!1,t&&(i.explorer=!1),this.DisableMenus(!0),this.hook&&(MathJax.Hub.UnRegister.MessageHook(this.hook),this.hook=null);for(var n=this.dependents.length-1;0<=n;n--){var o=this.dependents[n];o.Disable&&o.Disable(!1,t)}},DisableMenus:function(e){if(MathJax.Menu){var t=MathJax.Menu.menu.FindId("Accessibility","Explorer");if(t){for(var i,o=(t=t.submenu).items,r=2;i=o[r];r++)i.disabled=e;e||!t.FindId("SpeechOutput")||a[n.prefix+"speech"]||(t.FindId("Subtitles").disabled=!0)}}},Dependent:function(e){this.dependents.push(e)}},o=MathJax.Object.Subclass({div:null,inner:null,Init:function(){this.div=o.Create("assertive"),this.inner=MathJax.HTML.addElement(this.div,"div")},Add:function(){o.added||(document.body.appendChild(this.div),o.added=!0)},Show:function(e,t){this.div.classList.add("MJX_LiveRegion_Show");var a=e.getBoundingClientRect(),i=a.bottom+10+window.pageYOffset,n=a.left+window.pageXOffset;this.div.style.top=i+"px",this.div.style.left=n+"px";var o=t.colorString();this.inner.style.backgroundColor=o.background,this.inner.style.color=o.foreground},Hide:function(e){this.div.classList.remove("MJX_LiveRegion_Show")},Clear:function(){this.Update(""),this.inner.style.top="",this.inner.style.backgroundColor=""},Update:function(e){n.getOption("speech")&&o.Update(this.inner,e)}},{ANNOUNCE:"Navigatable Math in page. Explore with enter or shift space and arrow keys. Expand or collapse elements hitting enter.",announced:!1,added:!1,styles:{".MJX_LiveRegion":{position:"absolute",top:"0",height:"1px",width:"1px",padding:"1px",overflow:"hidden"},".MJX_LiveRegion_Show":{top:"0",position:"absolute",width:"auto",height:"auto",padding:"0px 0px",opacity:1,"z-index":"202",left:0,right:0,margin:"0 auto","background-color":"white","box-shadow":"0px 10px 20px #888",border:"2px solid #CCCCCC"}},Create:function(e){var t=MathJax.HTML.Element("div",{className:"MJX_LiveRegion"});return t.setAttribute("aria-live",e),t},Update:MathJax.Hub.Browser.isPC?function(e,t){e.textContent="",setTimeout((function(){e.textContent=t}),100)}:function(e,t){e.textContent="",e.textContent=t},Announce:function(){var e;n.getOption("speech")&&(o.announced=!0,MathJax.Ajax.Styles(o.styles),e=o.Create("polite"),document.body.appendChild(e),o.Update(e,o.ANNOUNCE),setTimeout((function(){document.body.removeChild(e)}),1e3))}});MathJax.Extension.explorer.LiveRegion=o;var r=MathJax.Ajax.fileURL(MathJax.Ajax.config.path.a11y),s=MathJax.Extension.explorer.Explorer={liveRegion:o(),walker:null,highlighter:null,hoverer:null,flamer:null,speechDiv:null,earconFile:r+"/invalid_keypress"+(-1!==["Firefox","Chrome","Opera"].indexOf(MathJax.Hub.Browser.name)?".ogg":".mp3"),expanded:!1,focusoutEvent:MathJax.Hub.Browser.isFirefox?"blur":"focusout",focusinEvent:"focus",ignoreFocusOut:!1,jaxCache:{},messageID:null,Reset:function(){s.FlameEnriched()},Register:function(e){var t,a;!n.hook||(t=document.getElementById(e[1]))&&t.id&&(a=MathJax.Hub.getJaxFor(t.id))&&a.enriched&&(s.StateChange(t.id,a),s.liveRegion.Add(),s.AddEvent(t))},StateChange:function(e,t){s.GetHighlighter(.2);var a=s.jaxCache[e];a&&a===t.root||(a&&sre.Walker.resetState(e+"-Frame"),s.jaxCache[e]=t.root)},AddAria:function(e){e.setAttribute("role","application"),e.setAttribute("aria-label","Math")},AddHook:function(e){s.RemoveHook(),s.hook=MathJax.Hub.Register.MessageHook("End Math",(function(t){var a=t[1].id+"-Frame",i=document.getElementById(a);e&&a===s.expanded&&(s.ActivateWalker(i,e),i.focus(),s.expanded=!1)}))},RemoveHook:function(){s.hook&&(MathJax.Hub.UnRegister.MessageHook(s.hook),s.hook=null)},AddMessage:function(){return MathJax.Message.Set("Generating Speech Output")},RemoveMessage:function(e){e&&MathJax.Message.Clear(e)},AddEvent:function(e){var t,a=e.id+"-Frame",i=e.previousSibling;i&&(t=i.id!==a?i.firstElementChild:i,s.AddAria(t),s.AddMouseEvents(t),"MathJax_MathML"===t.className&&(t=t.firstElementChild),t&&(t.onkeydown=s.Keydown,s.Flame(t),t.addEventListener(s.focusinEvent,(function(e){n.hook&&(o.announced||o.Announce())})),t.addEventListener(s.focusoutEvent,(function(e){n.hook&&(s.ignoreFocusOut&&(s.ignoreFocusOut=!1,"enter"===s.walker.moved)?e.target.focus():s.walker&&s.DeactivateWalker())})),n.getOption("speech")&&s.AddSpeech(t)))},AddSpeech:function(e){var t=e.id,a=MathJax.Hub.getJaxFor(t).root.toMathML();if(e.getAttribute("haslabel")||s.AddMathLabel(a,t),!e.getAttribute("hasspeech"))switch(MathJax.Hub.config.explorer.generation){case"eager":s.AddSpeechEager(a,t);break;case"mixed":e.querySelectorAll("[data-semantic-complexity]").length>=n.eagerComplexity&&s.AddSpeechEager(a,t)}},AddSpeechLazy:function(e){var t=new sre.TreeSpeechGenerator;t.setRebuilt(s.walker.getRebuilt()),t.getSpeech(s.walker.rootNode,s.walker.getXml()),e.setAttribute("hasspeech","true")},AddSpeechEager:function(e,t){s.MakeSpeechTask(e,t,sre.TreeSpeechGenerator,(function(e,t){e.setAttribute("hasspeech","true")}),5)},AddMathLabel:function(e,t){s.MakeSpeechTask(e,t,sre.SummarySpeechGenerator,(function(e,t){e.setAttribute("haslabel","true"),e.setAttribute("aria-label",t)}),5)},MakeSpeechTask:function(e,t,a,i,n){var o=s.AddMessage();setTimeout((function(){var n=new a,r=document.getElementById(t),l=new sre.DummyWalker(r,n,s.highlighter,e).speech();l&&i(r,l),s.RemoveMessage(o)}),n)},Keydown:function(a){var i=a.keyCode;if(i===t.ESCAPE){if(!s.walker)return;return s.RemoveHook(),s.DeactivateWalker(),void e(a)}if(s.walker&&s.walker.isActive()){i=i===t.RETURN?t.DASH:i,void 0!==s.walker.modifier&&(s.walker.modifier=a.shiftKey);var o=s.walker.move(i);if(null===o)return;if(o){if("expand"===s.walker.moved){if(s.expanded=s.walker.node.id,MathJax.Hub.Browser.isEdge)return s.ignoreFocusOut=!0,void s.DeactivateWalker();if(MathJax.Hub.Browser.isFirefox||MathJax.Hub.Browser.isMSIE)return void s.DeactivateWalker()}s.liveRegion.Update(s.walker.speech()),s.Highlight()}else s.PlayEarcon();e(a)}else{var r=a.target;if(i===t.SPACE&&!a.shiftKey)return MathJax.Extension.MathEvents.Event.ContextMenu(a,r),void e(a);if(n.hook&&(i===t.RETURN||i===t.SPACE&&a.shiftKey)){var l=MathJax.Hub.getJaxFor(r);return s.ActivateWalker(r,l),s.AddHook(l),void e(a)}}},GetHighlighter:function(e){s.highlighter=sre.HighlighterFactory.highlighter({color:n.getOption("background"),alpha:e},{color:n.getOption("foreground"),alpha:1},{renderer:MathJax.Hub.outputJax["jax/mml"][0].id,browser:MathJax.Hub.Browser.name})},AddMouseEvents:function(e){sre.HighlighterFactory.addEvents(e,{mouseover:s.MouseOver,mouseout:s.MouseOut},{renderer:MathJax.Hub.outputJax["jax/mml"][0].id,browser:MathJax.Hub.Browser.name})},MouseOver:function(t){var a;"none"!==n.getOption("highlight")&&("hover"===n.getOption("highlight")&&(a=t.currentTarget,s.GetHighlighter(.1),s.highlighter.highlight([a]),s.hoverer=!0),e(t))},MouseOut:function(t){return s.hoverer&&(s.highlighter.unhighlight(),s.hoverer=!1),e(t)},Flame:function(e){if("flame"===n.getOption("highlight"))return s.GetHighlighter(.05),s.highlighter.highlightAll(e),void(s.flamer=!0)},UnFlame:function(){s.flamer&&(s.highlighter.unhighlightAll(),s.flamer=null)},FlameEnriched:function(){s.UnFlame();for(var e,t=0,a=MathJax.Hub.getAllJax();e=a[t];t++)s.Flame(e.SourceElement().previousSibling)},Walkers:{syntactic:sre.SyntaxWalker,table:sre.TableWalker,semantic:sre.SemanticWalker,none:sre.DummyWalker},ActivateWalker:function(e,t){var a=n.getOption("speech"),i=n.getOption("walker")?s.Walkers[MathJax.Hub.config.explorer.walker]:s.Walkers.none,o=a?new sre.DirectSpeechGenerator:new sre.DummySpeechGenerator,r=sre.System.getInstance().engineSetup();o.setOptions({locale:r.locale,domain:r.domain,style:r.style,modality:"speech"}),s.GetHighlighter(.2),s.walker=new i(e,o,s.highlighter,t.root.toMathML()),a&&!e.getAttribute("hasspeech")&&s.AddSpeechLazy(e),s.walker.activate(),a&&(n.getOption("subtitle")&&s.liveRegion.Show(e,s.highlighter),s.liveRegion.Update(s.walker.speech())),s.Highlight(),s.ignoreFocusOut&&setTimeout((function(){s.ignoreFocusOut=!1}),500)},DeactivateWalker:function(){var e=sre.System.getInstance().engineSetup(),t="clearspeak"===e.domain?"default":e.style;n.setOption("ruleset",e.domain+"-"+t),s.liveRegion.Clear(),s.liveRegion.Hide(),s.Unhighlight(),s.currentHighlight=null,s.walker.deactivate(),s.walker=null},Highlight:function(){s.Unhighlight(),s.highlighter.highlight(s.walker.getFocus().getNodes())},Unhighlight:function(){s.highlighter.unhighlight()},PlayEarcon:function(){new Audio(s.earconFile).play()},SpeechOutput:function(){s.Reset(),["Subtitles"].forEach((function(e){var t=MathJax.Menu.menu.FindId("Accessibility","Explorer",e);t&&(t.disabled=!t.disabled)})),s.Regenerate()},RemoveSpeech:function(){n.setSpeechOption();for(var e,t=0,a=MathJax.Hub.getAllJax();e=a[t];t++){var i=document.getElementById(e.inputID+"-Frame");i&&(i.removeAttribute("hasspeech"),i.removeAttribute("haslabel"))}},Regenerate:function(){for(var e,t=0,a=MathJax.Hub.getAllJax();e=a[t];t++){var i=document.getElementById(e.inputID+"-Frame");i&&(i.removeAttribute("hasspeech"),s.AddSpeech(i))}},Startup:function(){var e=MathJax.Extension.collapsible;e&&e.Dependent(n),n.addDefaults()}};MathJax.Hub.Register.StartupHook("End Extensions",(function(){n[!1===a.explorer?"Disable":"Enable"](),MathJax.Hub.Startup.signal.Post("Explorer Ready"),MathJax.Hub.Register.StartupHook("MathMenu Ready",(function(){i=MathJax.Menu.cookie;var e,t=MathJax.Menu.ITEM,o=MathJax.Menu.menu,r={action:s.Reset},l={action:n.speechOption},h=t.SUBMENU(["Explorer","Explorer"],t.CHECKBOX(["Active","Active"],"explorer",{action:function(e){n[a.explorer?"Enable":"Disable"](!0,!0),MathJax.Menu.saveCookie()}}),t.RULE(),t.CHECKBOX(["Walker","Walker"],"Assistive-walker"),t.SUBMENU(["Highlight","Highlight"],t.RADIO(["none","None"],"Assistive-highlight",r),t.RADIO(["hover","Hover"],"Assistive-highlight",r),t.RADIO(["flame","Flame"],"Assistive-highlight",r)),t.SUBMENU(["Background","Background"],t.RADIO(["blue","Blue"],"Assistive-background",r),t.RADIO(["red","Red"],"Assistive-background",r),t.RADIO(["green","Green"],"Assistive-background",r),t.RADIO(["yellow","Yellow"],"Assistive-background",r),t.RADIO(["cyan","Cyan"],"Assistive-background",r),t.RADIO(["magenta","Magenta"],"Assistive-background",r),t.RADIO(["white","White"],"Assistive-background",r),t.RADIO(["black","Black"],"Assistive-background",r)),t.SUBMENU(["Foreground","Foreground"],t.RADIO(["black","Black"],"Assistive-foreground",r),t.RADIO(["white","White"],"Assistive-foreground",r),t.RADIO(["magenta","Magenta"],"Assistive-foreground",r),t.RADIO(["cyan","Cyan"],"Assistive-foreground",r),t.RADIO(["yellow","Yellow"],"Assistive-foreground",r),t.RADIO(["green","Green"],"Assistive-foreground",r),t.RADIO(["red","Red"],"Assistive-foreground",r),t.RADIO(["blue","Blue"],"Assistive-foreground",r)),t.RULE(),t.CHECKBOX(["SpeechOutput","Speech Output"],"Assistive-speech",{action:s.SpeechOutput}),t.CHECKBOX(["Subtitles","Subtitles"],"Assistive-subtitle",{disabled:!a["Assistive-speech"]}),t.RULE(),t.SUBMENU(["Mathspeak","Mathspeak Rules"],t.RADIO(["mathspeak-default","Verbose"],"Assistive-ruleset",l),t.RADIO(["mathspeak-brief","Brief"],"Assistive-ruleset",l),t.RADIO(["mathspeak-sbrief","Superbrief"],"Assistive-ruleset",l)),t.RADIO(["clearspeak-default","Clearspeak Rules"],"Assistive-ruleset",l),t.SUBMENU(["Chromevox","ChromeVox Rules"],t.RADIO(["chromevox-default","Verbose"],"Assistive-ruleset",l),t.RADIO(["chromevox-alternative","Alternative"],"Assistive-ruleset",l))),u=(o.FindId("Accessibility")||{}).submenu;u?null!==(e=u.IndexOfId("Explorer"))?u.items[e]=h:(e=u.IndexOfId("CollapsibleMath"),u.items.splice(e+1,0,h)):(e=o.IndexOfId("CollapsibleMath"),o.items.splice(e+1,0,h)),a.explorer||n.DisableMenus(!0)}),20)}),20)})),MathJax.Hub.Register.StartupHook("SVG Jax Ready",(function(){MathJax.Hub.Config({SVG:{addMMLclasses:!0}});var e,t=MathJax.OutputJax.SVG;parseFloat(t.version)<2.7&&(e=t.getJaxFromMath,t.Augment({getJaxFromMath:function(t){return t.parentNode.className.match(/MathJax_SVG_Display/)&&(t=t.parentNode),e.call(this,t)}}))})),MathJax.Ajax.config.path.a11y||(MathJax.Ajax.config.path.a11y=MathJax.Hub.config.root+"/extensions/a11y"),MathJax.Ajax.Require("[a11y]/collapsible.js"),MathJax.Hub.Register.StartupHook("Collapsible Ready",(function(){MathJax.Extension.explorer.Explorer.Startup(),MathJax.Ajax.loadComplete("[a11y]/explorer.js")}));