(function (Drupal, once) {
    Drupal.behaviors.pagedPrint = {
      attach(context) {
        once('pagedPrint', 'body', context).forEach(() => {
          const params = new URLSearchParams(window.location.search);
          if (params.get('print') === '1' && window.PagedPolyfill) {
            window.PagedPolyfill.preview();
          }
        });
      }
    };
  })(Drupal, once);