Just Learn Code

Power Up Your PowerShell Scripts with Custom Message Boxes: A Guide to Using PowerShell GUI and the MessageBox Class

PowerShell is a popular tool for system administrators and developers alike, providing command-line access to a wide range of powerful functionalities. One of the latest additions to PowerShell is the ability to create graphical user interfaces (GUIs) using the .NET framework, commonly found in Microsoft Windows applications.

The integration of PowerShell and GUI opens a whole new world of possibilities, enabling administrators and developers to create sophisticated and dynamic applications with ease. In this article, we will explore the features and benefits of PowerShell GUI and dive into the MessageBox class, one of the essential components of PowerShell GUI.

Overview of PowerShell GUI

Traditional PowerShell scripts execute commands in a command-line interface (CLI). However, modern management and automation solutions necessitate better usability and more prominent user interactions.

Although PowerShell provides a lot of functionality, it isn’t the most user-friendly tool out there for ordinary users. PowerShell GUI provides a solution to this problem.

It allows developers to design graphical user interfaces to make PowerShell scripts more user-friendly and interactive. One of the significant benefits of PowerShell GUI is easy navigation and usability.

Users who do not have a programming background will find PowerShell GUI a more straightforward and more intuitive way to interact with PowerShell scripts. PowerShell GUI also enables developers to create complex scripts that can interact with graphical objects, databases, and external APIs to perform complex tasks.

Benefits and Features of PowerShell GUI

PowerShell GUI provides a wide range of functionalities to developers. By leveraging the .NET framework’s rich set of graphical user interface components, PowerShell GUI offers robust capabilities that allow developers to design dynamic and engaging UIs that interact with PowerShell scripts.

One of the essential features of PowerShell GUI is message boxes. In PowerShell GUI, message boxes are created using the MessageBox class in the System.Windows namespace.

The MessageBox class provides various options for customizing the message, title, buttons, and icon that appear in the message box. PowerShell GUI also supports drag-and-drop functionalities and visual form designers that simplify the process of building UI applications.

Developers can also use the output of PowerShell scripts to populate form elements with data dynamically. This feature is especially useful for monitoring and alerting scenarios where data must be displayed quickly and efficiently.

The MessageBox Class in PowerShell

The MessageBox class is one of the critical components in PowerShell GUI. It allows developers to create customized message boxes that display information to users or capture input from users.

To use the MessageBox class, you must first import the PresentationFramework assembly, which holds the class.

Adding the PresentationFramework Assembly and Using the Show Method

To add the PresentationFramework assembly, you can use the Add-Type cmdlet, which loads the assembly into memory. The following code snippet demonstrates how to import the PresentationFramework assembly:

Add-Type -AssemblyName PresentationFramework

After importing the assembly, you can use the Show method to create a message box. The Show method has several constructors, which allow you to create a message box with different parameters.

The basic syntax of the Show method is:

[MessageBox]::Show(, , <buttons>, <icon>)</p> <p>Here,</p> <p>– <message>: The message to display in the message box. – <title>: The title of the message box.</p> </p> <p>– <buttons>: The buttons to display in the message box. – <icon>: The icon to display in the message box.</p> </p> <h2>Customizing MessageBox Parameters</h2> <p>The MessageBox class allows developers to customize the parameters of the message box to suit their specific needs. For instance, you can customize the message box to display different types of information or buttons to capture user input.</p> </p> <h2>Customizing the Message</h2> <p>The message parameter of the Show method allows developers to customize the text that appears in the message box. For instance, you can use the message parameter to display warning messages, system information, or error messages.</p> </p> <h2>Customizing the Title</h2> <p>The title parameter of the Show method allows developers to customize the title of the message box. This parameter is useful for providing context and clarity to the user about the information displayed in the message box.</p> </p> <h2>Customizing the Buttons</h2> <p>The buttons parameter of the Show method allows developers to customize the buttons that appear in the message box. You can specify different types of buttons such as OK, Yes/No, Yes/No/Cancel, Retry/Cancel, and more.</p> </p> <h2>Customizing the Icon</h2> <p>The icon parameter of the Show method allows developers to customize the icon displayed in the message box. The icon can help convey the nature of the information displayed in the message box visually.</p> </p> <h2>Conclusion</h2> <p>PowerShell GUI is a powerful addition to the PowerShell toolset, enabling developers to build interactive applications with ease. The MessageBox class is one of the essential components in PowerShell GUI, allowing developers to create custom message boxes that capture user input or display information to users.</p> </p> <p>By customizing the parameters of the message box, developers can create a wide range of message boxes that behave in different ways. PowerShell GUI and the MessageBox class can be used in various scenarios, such as monitoring and alerting, data visualization, and much more.</p> </p> <p>With more developers learning how to use PowerShell GUI and the MessageBox class, we can expect to see increased use of PowerShell in managing and automating Windows systems. In conclusion, PowerShell GUI is a powerful tool that allows developers to create graphical interfaces to interact with PowerShell scripts.</p> </p> <p>The MessageBox class is one of the fundamental components in PowerShell GUI, enabling developers to create customized message boxes that capture user input or display information to users. By customizing the parameters of the message box, developers can create a wide range of message boxes that behave differently.</p> </p> <p>PowerShell GUI and the MessageBox class can be used in various scenarios, such as monitoring and alerting, data visualization, and much more. This article emphasizes the importance of PowerShell GUI and the MessageBox class, and the various benefits they offer in terms of usability, customization, and interaction with PowerShell scripts.</p> </p> <p>It is a must-know topic for developers and system administrators who work with PowerShell and Windows systems.</p></p> </div> </div> <div class="elementor-element elementor-element-63de7e10 elementor-share-buttons--view-icon elementor-share-buttons--skin-minimal elementor-share-buttons--shape-circle elementor-share-buttons--align-center elementor-grid-0 elementor-share-buttons--color-official elementor-widget elementor-widget-share-buttons" data-id="63de7e10" data-element_type="widget" data-widget_type="share-buttons.default"> <div class="elementor-widget-container"> <link rel="stylesheet" data-pmdelayedstyle="https://www.justlearncode.com/wp-content/plugins/elementor-pro/assets/css/widget-share-buttons.min.css"> <div class="elementor-grid"> <div class="elementor-grid-item"> <div class="elementor-share-btn elementor-share-btn_facebook" role="button" tabindex="0" aria-label="Share on facebook" > <span class="elementor-share-btn__icon"> <i class="fab fa-facebook" aria-hidden="true"></i> </span> </div> </div> <div class="elementor-grid-item"> <div class="elementor-share-btn elementor-share-btn_twitter" role="button" tabindex="0" aria-label="Share on twitter" > <span class="elementor-share-btn__icon"> <i class="fab fa-twitter" aria-hidden="true"></i> </span> </div> </div> <div class="elementor-grid-item"> <div class="elementor-share-btn elementor-share-btn_pinterest" role="button" tabindex="0" aria-label="Share on pinterest" > <span class="elementor-share-btn__icon"> <i class="fab fa-pinterest" aria-hidden="true"></i> </span> </div> </div> <div class="elementor-grid-item"> <div class="elementor-share-btn elementor-share-btn_whatsapp" role="button" tabindex="0" aria-label="Share on whatsapp" > <span class="elementor-share-btn__icon"> <i class="fab fa-whatsapp" aria-hidden="true"></i> </span> </div> </div> </div> </div> </div> <div class="elementor-element elementor-element-2a325287 elementor-widget elementor-widget-heading" data-id="2a325287" data-element_type="widget" data-widget_type="heading.default"> <div class="elementor-widget-container"> <h2 class="elementor-heading-title elementor-size-default">Popular Posts</h2> </div> </div> <div class="elementor-element elementor-element-7f567dfb elementor-grid-3 elementor-grid-tablet-2 elementor-grid-mobile-1 elementor-posts--thumbnail-top elementor-widget elementor-widget-posts" data-id="7f567dfb" data-element_type="widget" data-settings="{"classic_columns":"3","classic_columns_tablet":"2","classic_columns_mobile":"1","classic_row_gap":{"unit":"px","size":35,"sizes":[]},"classic_row_gap_tablet":{"unit":"px","size":"","sizes":[]},"classic_row_gap_mobile":{"unit":"px","size":"","sizes":[]}}" data-widget_type="posts.classic"> <div class="elementor-widget-container"> <link rel="stylesheet" data-pmdelayedstyle="https://www.justlearncode.com/wp-content/plugins/elementor-pro/assets/css/widget-posts.min.css"> <div class="elementor-posts-container elementor-posts elementor-posts--skin-classic elementor-grid"> <article class="elementor-post elementor-grid-item post-153027 post type-post status-publish format-standard hentry category-vba"> <div class="elementor-post__text"> <h3 class="elementor-post__title"> <a href="https://www.justlearncode.com/mastering-the-saveas-function-in-vba-examples-and-parameters/" > Mastering the SaveAs Function in VBA: Examples and Parameters </a> </h3> </div> </article> <article class="elementor-post elementor-grid-item post-150220 post type-post status-publish format-standard hentry category-c"> <div class="elementor-post__text"> <h3 class="elementor-post__title"> <a href="https://www.justlearncode.com/mastering-const-keyword-in-c-and-connecting-mysql-database-in-java-using-eclipse-ide/" > Mastering const Keyword in C++ and Connecting MySQL Database in Java using Eclipse IDE </a> </h3> </div> </article> <article class="elementor-post elementor-grid-item post-153080 post type-post status-publish format-standard hentry category-javascript"> <div class="elementor-post__text"> <h3 class="elementor-post__title"> <a href="https://www.justlearncode.com/navigating-the-limitations-of-json-best-practices-and-solutions/" > Navigating the Limitations of JSON: Best Practices and Solutions </a> </h3> </div> </article> </div> </div> </div> </div> </div> </div> </section> </div> </div> </div> </section> </div> <div data-elementor-type="footer" data-elementor-id="581" class="elementor elementor-581 elementor-location-footer" data-elementor-post-type="elementor_library"> <section class="elementor-section elementor-top-section elementor-element elementor-element-b385a84 elementor-section-content-middle elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="b385a84" data-element_type="section" data-settings="{"background_background":"classic"}"> <div class="elementor-container elementor-column-gap-default"> <div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-2d87e876" data-id="2d87e876" data-element_type="column"> <div class="elementor-widget-wrap elementor-element-populated"> <div class="elementor-element elementor-element-32e0728b elementor-align-right elementor-tablet-align-right elementor-mobile-align-center elementor-icon-list--layout-inline elementor-widget__width-inherit elementor-widget-tablet__width-inherit elementor-list-item-link-full_width elementor-widget elementor-widget-icon-list" data-id="32e0728b" data-element_type="widget" data-widget_type="icon-list.default"> <div class="elementor-widget-container"> <ul class="elementor-icon-list-items elementor-inline-items"> <li class="elementor-icon-list-item elementor-inline-item"> <a href="https://www.justlearncode.com/terms/"> <span class="elementor-icon-list-text">Terms & Conditions</span> </a> </li> <li class="elementor-icon-list-item elementor-inline-item"> <a href="https://www.justlearncode.com/privacy-policy/"> <span class="elementor-icon-list-text">Privacy Policy</span> </a> </li> <li class="elementor-icon-list-item elementor-inline-item"> <a href="https://www.justlearncode.com/contact/"> <span class="elementor-icon-list-text">Contact</span> </a> </li> </ul> </div> </div> </div> </div> </div> </section> </div> <link rel='stylesheet' id='elementor-icons-fa-brands-css' data-pmdelayedstyle="https://www.justlearncode.com/wp-content/plugins/elementor/assets/lib/font-awesome/css/brands.min.css?ver=5.15.3" media='all' /> <script src="https://www.justlearncode.com/wp-content/themes/hello-elementor/assets/js/hello-frontend.min.js?ver=1.0.0" id="hello-theme-frontend-js" defer type="pmdelayedscript" data-cfasync="false" data-no-optimize="1" data-no-defer="1" data-no-minify="1" data-rocketlazyloadscript="1"></script> <script id="perfmatters-lazy-load-js-before"> window.lazyLoadOptions={elements_selector:"img[data-src],.perfmatters-lazy,.perfmatters-lazy-css-bg",thresholds:"0px 0px",class_loading:"pmloading",class_loaded:"pmloaded",callback_loaded:function(element){if(element.tagName==="IFRAME"){if(element.classList.contains("pmloaded")){if(typeof window.jQuery!="undefined"){if(jQuery.fn.fitVids){jQuery(element).parent().fitVids()}}}}}};window.addEventListener("LazyLoad::Initialized",function(e){var lazyLoadInstance=e.detail.instance;});function perfmattersLazyLoadYouTube(e){var t=document.createElement("iframe"),r="ID?";r+=0===e.dataset.query.length?"":e.dataset.query+"&",r+="autoplay=1",t.setAttribute("src",r.replace("ID",e.dataset.src)),t.setAttribute("frameborder","0"),t.setAttribute("allowfullscreen","1"),t.setAttribute("allow","accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"),e.replaceChild(t,e.firstChild)} </script> <script async src="https://www.justlearncode.com/wp-content/plugins/perfmatters/js/lazyload.min.js?ver=2.1.8" id="perfmatters-lazy-load-js"></script> <script src="https://www.justlearncode.com/wp-content/plugins/wp-rocket/assets/js/heartbeat.js?ver=3.15.2" id="heartbeat-js" defer type="pmdelayedscript" data-cfasync="false" data-no-optimize="1" data-no-defer="1" data-no-minify="1" data-rocketlazyloadscript="1"></script> <script src="https://www.justlearncode.com/wp-content/plugins/elementor-pro/assets/lib/smartmenus/jquery.smartmenus.min.js?ver=1.0.1" id="smartmenus-js" defer type="pmdelayedscript" data-cfasync="false" data-no-optimize="1" data-no-defer="1" data-no-minify="1" data-rocketlazyloadscript="1"></script> <script src="https://www.justlearncode.com/wp-includes/js/imagesloaded.min.js?ver=5.0.0" id="imagesloaded-js" defer type="pmdelayedscript" data-cfasync="false" data-no-optimize="1" data-no-defer="1" data-no-minify="1" data-rocketlazyloadscript="1"></script> <script src="https://www.justlearncode.com/wp-content/plugins/elementor-pro/assets/js/webpack-pro.runtime.min.js?ver=3.16.1" id="elementor-pro-webpack-runtime-js" defer type="pmdelayedscript" data-cfasync="false" data-no-optimize="1" data-no-defer="1" data-no-minify="1" data-rocketlazyloadscript="1"></script> <script src="https://www.justlearncode.com/wp-content/plugins/elementor/assets/js/webpack.runtime.min.js?ver=3.16.2" id="elementor-webpack-runtime-js" defer type="pmdelayedscript" data-cfasync="false" data-no-optimize="1" data-no-defer="1" data-no-minify="1" data-rocketlazyloadscript="1"></script> <script src="https://www.justlearncode.com/wp-content/plugins/elementor/assets/js/frontend-modules.min.js?ver=3.16.2" id="elementor-frontend-modules-js" defer type="pmdelayedscript" data-cfasync="false" data-no-optimize="1" data-no-defer="1" data-no-minify="1" data-rocketlazyloadscript="1"></script> <script src="https://www.justlearncode.com/wp-includes/js/dist/vendor/wp-polyfill-inert.min.js?ver=3.1.2" id="wp-polyfill-inert-js" defer type="pmdelayedscript" data-cfasync="false" data-no-optimize="1" data-no-defer="1" data-no-minify="1" data-rocketlazyloadscript="1"></script> <script src="https://www.justlearncode.com/wp-includes/js/dist/vendor/regenerator-runtime.min.js?ver=0.14.0" id="regenerator-runtime-js" defer type="pmdelayedscript" data-cfasync="false" data-no-optimize="1" data-no-defer="1" data-no-minify="1" data-rocketlazyloadscript="1"></script> <script src="https://www.justlearncode.com/wp-includes/js/dist/vendor/wp-polyfill.min.js?ver=3.15.0" id="wp-polyfill-js" type="pmdelayedscript" data-cfasync="false" data-no-optimize="1" data-no-defer="1" data-no-minify="1" data-rocketlazyloadscript="1"></script> <script src="https://www.justlearncode.com/wp-includes/js/dist/hooks.min.js?ver=2810c76e705dd1a53b18" id="wp-hooks-js" type="pmdelayedscript" data-cfasync="false" data-no-optimize="1" data-no-defer="1" data-no-minify="1" data-rocketlazyloadscript="1"></script> <script src="https://www.justlearncode.com/wp-includes/js/dist/i18n.min.js?ver=5e580eb46a90c2b997e6" id="wp-i18n-js" type="pmdelayedscript" data-cfasync="false" data-no-optimize="1" data-no-defer="1" data-no-minify="1" data-rocketlazyloadscript="1"></script> <script id="wp-i18n-js-after" type="pmdelayedscript" data-cfasync="false" data-no-optimize="1" data-no-defer="1" data-no-minify="1" data-rocketlazyloadscript="1"> wp.i18n.setLocaleData( { 'text direction\u0004ltr': [ 'ltr' ] } ); </script> <script id="elementor-pro-frontend-js-before" type="pmdelayedscript" data-cfasync="false" data-no-optimize="1" data-no-defer="1" data-no-minify="1" data-rocketlazyloadscript="1"> var ElementorProFrontendConfig = {"ajaxurl":"https:\/\/www.justlearncode.com\/wp-admin\/admin-ajax.php","nonce":"ee4efed753","urls":{"assets":"https:\/\/www.justlearncode.com\/wp-content\/plugins\/elementor-pro\/assets\/","rest":"https:\/\/www.justlearncode.com\/wp-json\/"},"shareButtonsNetworks":{"facebook":{"title":"Facebook","has_counter":true},"twitter":{"title":"Twitter"},"linkedin":{"title":"LinkedIn","has_counter":true},"pinterest":{"title":"Pinterest","has_counter":true},"reddit":{"title":"Reddit","has_counter":true},"vk":{"title":"VK","has_counter":true},"odnoklassniki":{"title":"OK","has_counter":true},"tumblr":{"title":"Tumblr"},"digg":{"title":"Digg"},"skype":{"title":"Skype"},"stumbleupon":{"title":"StumbleUpon","has_counter":true},"mix":{"title":"Mix"},"telegram":{"title":"Telegram"},"pocket":{"title":"Pocket","has_counter":true},"xing":{"title":"XING","has_counter":true},"whatsapp":{"title":"WhatsApp"},"email":{"title":"Email"},"print":{"title":"Print"}},"facebook_sdk":{"lang":"en_US","app_id":""},"lottie":{"defaultAnimationUrl":"https:\/\/www.justlearncode.com\/wp-content\/plugins\/elementor-pro\/modules\/lottie\/assets\/animations\/default.json"}}; </script> <script src="https://www.justlearncode.com/wp-content/plugins/elementor-pro/assets/js/frontend.min.js?ver=3.16.1" id="elementor-pro-frontend-js" defer type="pmdelayedscript" data-cfasync="false" data-no-optimize="1" data-no-defer="1" data-no-minify="1" data-rocketlazyloadscript="1"></script> <script src="https://www.justlearncode.com/wp-content/plugins/elementor/assets/lib/waypoints/waypoints.min.js?ver=4.0.2" id="elementor-waypoints-js" defer type="pmdelayedscript" data-cfasync="false" data-no-optimize="1" data-no-defer="1" data-no-minify="1" data-rocketlazyloadscript="1"></script> <script src="https://www.justlearncode.com/wp-includes/js/jquery/ui/core.min.js?ver=1.13.2" id="jquery-ui-core-js" defer type="pmdelayedscript" data-cfasync="false" data-no-optimize="1" data-no-defer="1" data-no-minify="1" data-rocketlazyloadscript="1"></script> <script id="elementor-frontend-js-before" type="pmdelayedscript" data-cfasync="false" data-no-optimize="1" data-no-defer="1" data-no-minify="1" data-rocketlazyloadscript="1"> var elementorFrontendConfig = {"environmentMode":{"edit":false,"wpPreview":false,"isScriptDebug":false},"i18n":{"shareOnFacebook":"Share on Facebook","shareOnTwitter":"Share on Twitter","pinIt":"Pin it","download":"Download","downloadImage":"Download image","fullscreen":"Fullscreen","zoom":"Zoom","share":"Share","playVideo":"Play Video","previous":"Previous","next":"Next","close":"Close","a11yCarouselWrapperAriaLabel":"Carousel | Horizontal scrolling: Arrow Left & Right","a11yCarouselPrevSlideMessage":"Previous slide","a11yCarouselNextSlideMessage":"Next slide","a11yCarouselFirstSlideMessage":"This is the first slide","a11yCarouselLastSlideMessage":"This is the last slide","a11yCarouselPaginationBulletMessage":"Go to slide"},"is_rtl":false,"breakpoints":{"xs":0,"sm":480,"md":768,"lg":1025,"xl":1440,"xxl":1600},"responsive":{"breakpoints":{"mobile":{"label":"Mobile Portrait","value":767,"default_value":767,"direction":"max","is_enabled":true},"mobile_extra":{"label":"Mobile Landscape","value":880,"default_value":880,"direction":"max","is_enabled":false},"tablet":{"label":"Tablet Portrait","value":1024,"default_value":1024,"direction":"max","is_enabled":true},"tablet_extra":{"label":"Tablet Landscape","value":1200,"default_value":1200,"direction":"max","is_enabled":false},"laptop":{"label":"Laptop","value":1366,"default_value":1366,"direction":"max","is_enabled":false},"widescreen":{"label":"Widescreen","value":2400,"default_value":2400,"direction":"min","is_enabled":false}}},"version":"3.16.2","is_static":false,"experimentalFeatures":{"e_dom_optimization":true,"e_optimized_assets_loading":true,"e_optimized_css_loading":true,"additional_custom_breakpoints":true,"e_swiper_latest":true,"theme_builder_v2":true,"hello-theme-header-footer":true,"landing-pages":true,"page-transitions":true,"notes":true,"form-submissions":true,"e_scroll_snap":true},"urls":{"assets":"https:\/\/www.justlearncode.com\/wp-content\/plugins\/elementor\/assets\/"},"swiperClass":"swiper","settings":{"page":[],"editorPreferences":[]},"kit":{"active_breakpoints":["viewport_mobile","viewport_tablet"],"lightbox_enable_counter":"yes","hello_header_logo_type":"title","hello_header_menu_layout":"horizontal","hello_footer_logo_type":"logo"},"post":{"id":155601,"title":"Power%20Up%20Your%20PowerShell%20Scripts%20with%20Custom%20Message%20Boxes%3A%20A%20Guide%20to%20Using%20PowerShell%20GUI%20and%20the%20MessageBox%20Class%20-%20Just%20Learn%20Code","excerpt":"","featuredImage":false}}; </script> <script src="https://www.justlearncode.com/wp-content/plugins/elementor/assets/js/frontend.min.js?ver=3.16.2" id="elementor-frontend-js" defer type="pmdelayedscript" data-cfasync="false" data-no-optimize="1" data-no-defer="1" data-no-minify="1" data-rocketlazyloadscript="1"></script> <script src="https://www.justlearncode.com/wp-content/plugins/elementor-pro/assets/js/elements-handlers.min.js?ver=3.16.1" id="pro-elements-handlers-js" defer type="pmdelayedscript" data-cfasync="false" data-no-optimize="1" data-no-defer="1" data-no-minify="1" data-rocketlazyloadscript="1"></script> <script type="text/javascript" id="perfmatters-delayed-scripts-js">const pmDelayClick=false;const pmDelayTimer=setTimeout(pmTriggerDOMListener,10*1000);const pmUserInteractions=["keydown","mousedown","mousemove","wheel","touchmove","touchstart","touchend"],pmDelayedScripts={normal:[],defer:[],async:[]},jQueriesArray=[],pmInterceptedClicks=[];var pmDOMLoaded=!1,pmClickTarget="";function pmTriggerDOMListener(){"undefined"!=typeof pmDelayTimer&&clearTimeout(pmDelayTimer),pmUserInteractions.forEach(function(e){window.removeEventListener(e,pmTriggerDOMListener,{passive:!0})}),document.removeEventListener("visibilitychange",pmTriggerDOMListener),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",pmTriggerDelayedScripts):pmTriggerDelayedScripts()}async function pmTriggerDelayedScripts(){pmDelayEventListeners(),pmDelayJQueryReady(),pmProcessDocumentWrite(),pmSortDelayedScripts(),pmPreloadDelayedScripts(),await pmLoadDelayedScripts(pmDelayedScripts.normal),await pmLoadDelayedScripts(pmDelayedScripts.defer),await pmLoadDelayedScripts(pmDelayedScripts.async),await pmTriggerEventListeners(),document.querySelectorAll("link[data-pmdelayedstyle]").forEach(function(e){e.setAttribute("href",e.getAttribute("data-pmdelayedstyle"))}),window.dispatchEvent(new Event("perfmatters-allScriptsLoaded")),pmReplayClicks()}function pmDelayEventListeners(){let e={};function t(t,r){function n(r){return e[t].delayedEvents.indexOf(r)>=0?"perfmatters-"+r:r}e[t]||(e[t]={originalFunctions:{add:t.addEventListener,remove:t.removeEventListener},delayedEvents:[]},t.addEventListener=function(){arguments[0]=n(arguments[0]),e[t].originalFunctions.add.apply(t,arguments)},t.removeEventListener=function(){arguments[0]=n(arguments[0]),e[t].originalFunctions.remove.apply(t,arguments)}),e[t].delayedEvents.push(r)}function r(e,t){let r=e[t];Object.defineProperty(e,t,{get:r||function(){},set:function(r){e["perfmatters"+t]=r}})}t(document,"DOMContentLoaded"),t(window,"DOMContentLoaded"),t(window,"load"),t(window,"pageshow"),t(document,"readystatechange"),r(document,"onreadystatechange"),r(window,"onload"),r(window,"onpageshow")}function pmDelayJQueryReady(){let e=window.jQuery;Object.defineProperty(window,"jQuery",{get:()=>e,set(t){if(t&&t.fn&&!jQueriesArray.includes(t)){t.fn.ready=t.fn.init.prototype.ready=function(e){pmDOMLoaded?e.bind(document)(t):document.addEventListener("perfmatters-DOMContentLoaded",function(){e.bind(document)(t)})};let r=t.fn.on;t.fn.on=t.fn.init.prototype.on=function(){if(this[0]===window){function e(e){return e=(e=(e=e.split(" ")).map(function(e){return"load"===e||0===e.indexOf("load.")?"perfmatters-jquery-load":e})).join(" ")}"string"==typeof arguments[0]||arguments[0]instanceof String?arguments[0]=e(arguments[0]):"object"==typeof arguments[0]&&Object.keys(arguments[0]).forEach(function(t){delete Object.assign(arguments[0],{[e(t)]:arguments[0][t]})[t]})}return r.apply(this,arguments),this},jQueriesArray.push(t)}e=t}})}function pmProcessDocumentWrite(){let e=new Map;document.write=document.writeln=function(t){var r=document.currentScript,n=document.createRange();let a=e.get(r);void 0===a&&(a=r.nextSibling,e.set(r,a));var i=document.createDocumentFragment();n.setStart(i,0),i.appendChild(n.createContextualFragment(t)),r.parentElement.insertBefore(i,a)}}function pmSortDelayedScripts(){document.querySelectorAll("script[type=pmdelayedscript]").forEach(function(e){e.hasAttribute("src")?e.hasAttribute("defer")&&!1!==e.defer?pmDelayedScripts.defer.push(e):e.hasAttribute("async")&&!1!==e.async?pmDelayedScripts.async.push(e):pmDelayedScripts.normal.push(e):pmDelayedScripts.normal.push(e)})}function pmPreloadDelayedScripts(){var e=document.createDocumentFragment();[...pmDelayedScripts.normal,...pmDelayedScripts.defer,...pmDelayedScripts.async].forEach(function(t){var r=t.getAttribute("src");if(r){var n=document.createElement("link");n.href=r,n.rel="preload",n.as="script",e.appendChild(n)}}),document.head.appendChild(e)}async function pmLoadDelayedScripts(e){var t=e.shift();return t?(await pmReplaceScript(t),pmLoadDelayedScripts(e)):Promise.resolve()}async function pmReplaceScript(e){return await pmNextFrame(),new Promise(function(t){let r=document.createElement("script");[...e.attributes].forEach(function(e){let t=e.nodeName;"type"!==t&&("data-type"===t&&(t="type"),r.setAttribute(t,e.nodeValue))}),e.hasAttribute("src")?(r.addEventListener("load",t),r.addEventListener("error",t)):(r.text=e.text,t()),e.parentNode.replaceChild(r,e)})}async function pmTriggerEventListeners(){pmDOMLoaded=!0,await pmNextFrame(),document.dispatchEvent(new Event("perfmatters-DOMContentLoaded")),await pmNextFrame(),window.dispatchEvent(new Event("perfmatters-DOMContentLoaded")),await pmNextFrame(),document.dispatchEvent(new Event("perfmatters-readystatechange")),await pmNextFrame(),document.perfmattersonreadystatechange&&document.perfmattersonreadystatechange(),await pmNextFrame(),window.dispatchEvent(new Event("perfmatters-load")),await pmNextFrame(),window.perfmattersonload&&window.perfmattersonload(),await pmNextFrame(),jQueriesArray.forEach(function(e){e(window).trigger("perfmatters-jquery-load")});let e=new Event("perfmatters-pageshow");e.persisted=window.pmPersisted,window.dispatchEvent(e),await pmNextFrame(),window.perfmattersonpageshow&&window.perfmattersonpageshow({persisted:window.pmPersisted})}async function pmNextFrame(){return new Promise(function(e){requestAnimationFrame(e)})}function pmClickHandler(e){e.target.removeEventListener("click",pmClickHandler),pmRenameDOMAttribute(e.target,"pm-onclick","onclick"),pmInterceptedClicks.push(e),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()}function pmReplayClicks(){window.removeEventListener("touchstart",pmTouchStartHandler,{passive:!0}),window.removeEventListener("mousedown",pmTouchStartHandler),pmInterceptedClicks.forEach(e=>{e.target.outerHTML===pmClickTarget&&e.target.dispatchEvent(new MouseEvent("click",{view:e.view,bubbles:!0,cancelable:!0}))})}function pmTouchStartHandler(e){"HTML"!==e.target.tagName&&(pmClickTarget||(pmClickTarget=e.target.outerHTML),window.addEventListener("touchend",pmTouchEndHandler),window.addEventListener("mouseup",pmTouchEndHandler),window.addEventListener("touchmove",pmTouchMoveHandler,{passive:!0}),window.addEventListener("mousemove",pmTouchMoveHandler),e.target.addEventListener("click",pmClickHandler),pmRenameDOMAttribute(e.target,"onclick","pm-onclick"))}function pmTouchMoveHandler(e){window.removeEventListener("touchend",pmTouchEndHandler),window.removeEventListener("mouseup",pmTouchEndHandler),window.removeEventListener("touchmove",pmTouchMoveHandler,{passive:!0}),window.removeEventListener("mousemove",pmTouchMoveHandler),e.target.removeEventListener("click",pmClickHandler),pmRenameDOMAttribute(e.target,"pm-onclick","onclick")}function pmTouchEndHandler(e){window.removeEventListener("touchend",pmTouchEndHandler),window.removeEventListener("mouseup",pmTouchEndHandler),window.removeEventListener("touchmove",pmTouchMoveHandler,{passive:!0}),window.removeEventListener("mousemove",pmTouchMoveHandler)}function pmRenameDOMAttribute(e,t,r){e.hasAttribute&&e.hasAttribute(t)&&(event.target.setAttribute(r,event.target.getAttribute(t)),event.target.removeAttribute(t))}window.addEventListener("pageshow",e=>{window.pmPersisted=e.persisted}),pmUserInteractions.forEach(function(e){window.addEventListener(e,pmTriggerDOMListener,{passive:!0})}),pmDelayClick&&(window.addEventListener("touchstart",pmTouchStartHandler,{passive:!0}),window.addEventListener("mousedown",pmTouchStartHandler)),document.addEventListener("visibilitychange",pmTriggerDOMListener);var pmeDeviceMode,pmeAnimationSettingsKeys,pmeCurrentAnimation;function pmeAnimation(){(pmeDeviceMode=document.createElement("span")).id="elementor-device-mode",pmeDeviceMode.setAttribute("class","elementor-screen-only"),document.body.appendChild(pmeDeviceMode),requestAnimationFrame(pmeDetectAnimations)}function pmeDetectAnimations(){pmeAnimationSettingsKeys=pmeListAnimationSettingsKeys(getComputedStyle(pmeDeviceMode,":after").content.replace(/"/g,"")),document.querySelectorAll(".elementor-invisible[data-settings]").forEach(a=>{let b=a.getBoundingClientRect();if(b.bottom>=0&&b.top<=window.innerHeight)try{pmeAnimateElement(a)}catch(c){}})}function pmeAnimateElement(a){let b=JSON.parse(a.dataset.settings),d=b._animation_delay||b.animation_delay||0,c=b[pmeAnimationSettingsKeys.find(a=>b[a])];if("none"===c)return void a.classList.remove("elementor-invisible");a.classList.remove(c),pmeCurrentAnimation&&a.classList.remove(pmeCurrentAnimation),pmeCurrentAnimation=c;let e=setTimeout(()=>{a.classList.remove("elementor-invisible"),a.classList.add("animated",c),pmeRemoveAnimationSettings(a,b)},d);window.addEventListener("perfmatters-startLoading",function(){clearTimeout(e)})}function pmeListAnimationSettingsKeys(b="mobile"){let a=[""];switch(b){case"mobile":a.unshift("_mobile");case"tablet":a.unshift("_tablet");case"desktop":a.unshift("_desktop")}let c=[];return["animation","_animation"].forEach(b=>{a.forEach(a=>{c.push(b+a)})}),c}function pmeRemoveAnimationSettings(a,b){pmeListAnimationSettingsKeys().forEach(a=>delete b[a]),a.dataset.settings=JSON.stringify(b)}document.addEventListener("DOMContentLoaded",pmeAnimation)</script></body> </html> <!-- This website is like a Rocket, isn't it? Performance optimized by WP Rocket. Learn more: https://wp-rocket.me - Debug: cached@1718615153 -->