PageSourceSearch

https://northshorescp.com/sites/northshorescp.com/files/js/js_5eWQA4LfT6xJ7o3xrOoCJnyrpBAsbEBUQ_-yvzpjuDc.js

js northshorescp.com collected 2026-10-07 23:29:56 UTC 61,208 bytes, 1,348 lines download raw bytes

1(function ($) {
2
3var DrupalAjaxErrorBehavior = DrupalAjaxErrorBehavior || {};
4
5DrupalAjaxErrorBehavior.coreDisplayAjaxError = Drupal.displayAjaxError;
6
7/**
8 * Overwrites Drupal's display ajax error handling.
9 */
10Drupal.displayAjaxError = function (message) {
11  // @see Drupal.displayAjaxError() in drupal.js
12  if (Drupal.settings.ajaxErrorBehavior.behavior == 'core') {
13    DrupalAjaxErrorBehavior.coreDisplayAjaxError(message);
14  }
15  else if (Drupal.settings.ajaxErrorBehavior.behavior == 'alert') {
16    alert(message);
17  }
18  else if (Drupal.settings.ajaxErrorBehavior.behavior == 'watchdog') {
19    $.ajax({
20      type: 'POST',
21      url: Drupal.settings.ajaxErrorBehavior.watchdog_url,
22      data: {message: message},
23    });
24
25    DrupalAjaxErrorBehavior.coreDisplayAjaxError(Drupal.settings.ajaxErrorBehavior.error);
26  }
27  else if (Drupal.settings.ajaxErrorBehavior.behavior == 'console') {
28    if (typeof(window.console) !== 'undefined') {
29      window.console.log(message);
30    }
31  }
32};
33
34})(jQuery);
35;
36(function ($) {
37    'use strict';
38    Drupal.behaviors.ACChangeEnterBehavior = {
39        attach: function (context, settings) {
40            $('input.form-autocomplete', context).once('ac-change-enter-behavior', function() {
41                $(this).keypress(function(e) {
42                    var ac = $('#autocomplete');
43                    if (e.keyCode == 13 && typeof ac[0] != 'undefined') {
44                        e.preventDefault();
45                        ac.each(function () {
46                            if(this.owner.selected == false){
47                                this.owner.selectDown();
48                            }
49                            this.owner.hidePopup();
50                        });
51                        $(this).trigger('change');
52                    }
53                });
54            });
55        }
56    };
57}(jQuery));
58;
59!(function($) {
60
61  if( !(window.Drupal) ) return;
62
63  // Extend standard String object and its prototype with some goodies
64
65  String.re = {
66    dashNotation: /-([a-z])/g,
67    htmlEntities: /[&<>"'\/]/g,
68    htmlUnEntities: /&(?:amp|lt|gt|quot|#39|#x2F);/g,
69    underscoreNotation: /_([a-z])/g,
70    camelCaseNotation: /(?!^)[A-Z](?=[a-z])/g,
71    whitespace: /\s+/g,
72    regExpMetaCharacter: /([.*+?^$=!:|\/{}()[\]]|(?:\\(?![bBdDnrsStu])))/g
73  };
74
75  var htmlEntityMap = {
76    "&": "&amp;",
77    "<": "&lt;",
78    ">": "&gt;",
79    '"': '&quot;',
80    "'": '&#39;',
81    "/": '&#x2F;'
82  }, htmlEntityMapReversed = {
83    "&amp;" : "&",
84    "&lt;"  : "<" ,
85    "&gt;"  : ">",
86    "&quot;": '"',
87    "&#39;" : "'",
88    "&#x2F;": "/"
89  };
90
91  $.extend(String.prototype, {
92      splice: function(idx, rem, s){
93        return this.slice(0,idx) + (s||'') + this.slice( idx + Math.abs(rem || 0) );
94      },
95      escapeHTML: function(){
96        return this.replace(String.re.htmlEntities, function(s){
97            return htmlEntityMap[s];
98        });
99      },
100      unescapeHTML: function(){
101        return this.replace(String.re.htmlUnEntities, function(s){
102            return htmlEntityMapReversed[s];
103        });
104      },
105      escapeRegExp: function(){
106        return this.replace( String.re.regExpMetaCharacter, "\\$1");
107      },
108      toCamelCase: function(uscore){
109        return this.replace( String.re[ uscore ? 'underscoreNotation' : 'dashNotation' ], function($0, $1){ return $1.toUpperCase(); });
110      },
111      toUnderscore: function(uscore){
112        return this.replace( String.re.camelCaseNotation, function($0){ return (uscore ? '_' : '-') + $0; }).toLowerCase();
113      },
114      upperFirstChar: function(){
115        return this.charAt(0).toUpperCase() + this.slice(1);
116      },
117      lowerFirstChar: function(){
118        return this.charAt(0).toLowerCase() + this.slice(1);
119      },
120      ltrim: function(chs){
121        chs = chs || '\\s';
122        return this.replace( new RegExp( '^[' + chs.escapeRegExp() + ']*'), '' );
123      },
124      rtrim: function(chs){
125        chs = chs || '\\s';
126        return this.replace( new RegExp( '[' + chs.escapeRegExp() + ']*$'), '' );
127      },
128      cut: function(chs){
129        chs = chs || '\\s';
130        return this.ltrim(chs).rtrim(chs);
131      },
132      namespace: function(ns) {
133        return this.trim().split(String.re.whitespace).join( '.' + ns + ' ' ) + ('.' + ns);
134      },
135      escapeParentheses: function() {
136        return this.replace('(', '\\(').replace(')', '\\)');
137      }
138  });
139
140  // Extend jQuery prototype with some useful functionality
141  $.fn.extend({
142    // copies the text to clipboard and then
143    // focuses the first element in the set of matched elements
144    copyToClipboard: function(text) {
145      var $temp = $('<input>');
146      $('body').append($temp);
147      $temp.val(text).select();
148      document.execCommand('copy');
149      $temp.remove();
150        
151      this.first().focus();
152
153      return this;
154    },
155    cycleFocusWithinModal: function () {
156      var $this = $(this);
157      var focusableElements = $this.find('input, textarea, select, button, a[href]:not([disabled]), [tabindex]').filter(':visible');
158
159      var handleKeydown = function(event) {
160        if (event.key === "Tab") {
161          var index = focusableElements.index(document.activeElement);
162
163          if (event.shiftKey) {
164            index--;
165            if (index < 0) {
166              index = focusableElements.length - 1;
167            }
168          }
169          else {
170            index++;
171            if (index >= focusableElements.length) {
172              index = 0;
173            }
174          }
175
176          focusableElements.eq(index).focus();
177          event.preventDefault();
178        }
179      };
180
181      $this.on('keydown', handleKeydown);
182    },
183    focusPrevNextElem: function (firstSelector, lastSelector) {
184      var $firstElement = $(firstSelector);
185      var $lastElement = $(lastSelector);
186
187      if ($firstElement.length === 0 || $lastElement.length === 0) {
188        console.error("First or last element not found");
189        return;
190      }
191
192      this.on('keydown', function(event) {
193        if (event.key === "Tab") {
194          var isFirstElementFocused = $(document.activeElement).is($firstElement);
195          var isLastElementFocused = $(document.activeElement).is($lastElement);
196
197          if (event.shiftKey && isFirstElementFocused) {
198            $lastElement.focus();
199            event.preventDefault();
200          }
201          else if (!event.shiftKey && isLastElementFocused) {
202            $firstElement.focus();
203            event.preventDefault();
204          }
205        }
206      });
207
208      return this;
209    }
210  });
211  
212  $.fn.ctoolsUseModalEnabledAjaxLink = function () {
213    return this.filter('.ctools-use-modal').not('.ctools-use-modal-processed').each(function() {
214      var $this = $(this)
215        , href = $.trim( $this.attr('data-href') )
216      ;
217
218      $this.addClass('ctools-use-modal-processed');
219
220      if( !href ) return;
221
222      $this.click(Drupal.CTools.Modal.clickAjaxLink);
223
224      Drupal.ajax[href] = new Drupal.ajax(href, this, {
225        url: href,
226        event: 'click',
227        progress: {type: 'throbber'}
228      });
229    });
230  };
231
232  // Add some common utility functions 
233  Drupal.utils = Drupal.utils || {}
234  $.extend(Drupal.utils, {
235    throttle: function (func, delay) {
236      var timer = null;
237
238      return function () {
239        var context = this,
240              args = arguments;
241
242        if (null === timer) {
243          timer = setTimeout(function () {
244            func.apply(context, args);
245            timer = null;
246          }, delay);
247        }
248      };
249    },
250    toInt(anything) {
251      return ~~parseInt(anything, 10);
252    },
253    isAdministrativeRole: function () {
254      var currentUserInfo = Drupal.settings && Drupal.settings.currentUser;
255
256      if (!currentUserInfo)
257        return false;
258
259      return '1' === currentUserInfo.uid || Drupal.utils.userHasRoles(currentUserInfo, ['administrator', 'manager', 'superadmin']);
260    },
261    /* Could be used as follows:
262     
263     Drupal.utils.userHasRoles( 'some role' )
264     Drupal.utils.userHasRoles( ['some role', 'another role'] )
265     Drupal.utils.userHasRoles( currentUserInfoObject, ['some role', 'another role'] )
266     
267     where currentUserInfoObject is Drupal.settings.currentUser object
268     */
269    userHasRoles: function (currentUserInfo, roles) {
270      if ('undefined' === typeof roles && ($.isArray(currentUserInfo) || 'string' === typeof currentUserInfo)) {
271        roles = currentUserInfo;
272        currentUserInfo = Drupal.settings && Drupal.settings.currentUser;
273      }
274
275      var userRoles
276            , found = false
277            ;
278
279      if (!(currentUserInfo && $.isArray(userRoles = currentUserInfo.roles) && roles))
280        return found;
281
282      roles = $.isArray(roles) ? roles : [roles];
283
284      $.each(roles, function (_, r) {
285        found = userRoles.indexOf(r) >= 0;
286        return !found; // ← break the loop as soon as found is true
287      });
288
289      return found;
290    },
291    // Returns random int value within the [min] - [max] range.
292    // [min] and [max] are inclusive
293    getRandomInt: function(min, max) {
294      var minCeiled = Math.ceil(min)
295        , maxFloored = Math.floor(max)
296      ;
297      return Math.floor(Math.random() * (maxFloored - minCeiled + 1) + minCeiled);
298    },
299    // creates inline style element with the contents of [styleString]
300    // and appends it to the head element
301    inlineStyleSheet: function (styleString) {
302      var style = document.createElement('style');
303      document.head.append(style);
304      style.textContent = styleString;
305    }
306  });
307  
308  /* Registers a module with Drupal
309   
310   Drupal module is a function that accepts the following parameters
311
312   name [required] - module name in camelCaseNotation, this name will be converted to dashed-notation
313                     and be passed to the fn as the first parameter, for example:
314
315                     'kvoModuleName' will be converted to 'kvo-module-name'
316
317                     it should be used as the event namespace when subscribing to events like this:
318
319                     $(document).on( 'click mouseleave custom-event'.namespace(eventNamespace), fn );
320
321                     this guarantees that we can unsubscribe from any event we have been subscribed
322                     previously and this will not break things within any other module, for example:
323
324                     $(document).off( 'click'.namespace(eventNamespace) );
325
326                     If we called it like this $(document).off('click');
327
328                     All 'click' event handlers from any other component / modules would be removed 
329
330   fn [ required ] - module logic goes here, this function should return another function
331                     which will be called passing Drupal.setting to it on document ready event
332
333   args [ optional ] - anything you need to be passed to the fn, it could be one thing or the array
334   
335   context [ optional ] - just in case, you might need the fn to be called with 'this' set to context
336
337   In case Drupal.registerModule is called with the same name, the previous module function will be
338   replaced with the new one. This might come in handy when we need to replace a module using JSInjector
339   for instance, for quick prototyping
340
341   Example of a module:
342
343   Drupal.registerModule('kvoModuleExample', function(eventNamespace, $) { // в†ђ eventNamespace becomes 'kvo-module-example' 
344  
345    return function(settings) { // в†ђ this function will be called on document ready
346      
347      // your code goes here
348
349      // this will be converted to 'single-event-name.kvo-module-example or.kvo-module-example space-separated-event-list.kvo-module-example'
350      $(window).on('single-event-name   or  space-separated-event-list'.namespace(eventNamespace), function(e) {
351      });
352
353    }
354
355   }, jQuery ); // в†ђ we pass parameters to our function here    
356  */
357
358  Drupal.registerModule = function(name, fn, args, context) {
359    var modules = Drupal.modules = Drupal.modules || {}
360      , moduleInitFn
361    ;
362
363    args = $.isArray(args) ?
364      args : ('undefined' !== typeof args ?
365      [args] : []);
366
367    // convert module name from camel case
368    // to dash separated name which could be used
369    // as an event namespace within the module
370    // and push it into the args list
371    args.unshift( name.toUnderscore() );
372
373
374    $.isFunction( fn ) &&
375      (moduleInitFn = fn.apply(context, args.slice()));
376
377    if( !$.isFunction(moduleInitFn) ) return;
378
379    modules[ name ] = {init: moduleInitFn }
380  }
381
382  // Initialize all previously registered modules
383  // on document ready event
384  
385  $(function() {
386
387    if( !(Drupal && Drupal.modules) ) return;
388
389    $.each(Drupal.modules, function() {
390        if ($.isFunction(this.init)) {
391            this.init( Drupal.settings || {} );
392        }
393    });
394  });
395  $.extend(Drupal.behaviors, {
396  kvoFontAwesomeIconPicker: {
397      attach: (function() {
398        var fontawesomeIcons = [
399              {title: 'fas fa-question', searchTerms: ['question']},
400              {title: 'fas fa-magnifying-glass', searchTerms: ['magnifying glass']},
401              {title: 'far fa-map-location-dot', searchTerms: ['location']},
402              {title: 'far fa-map', searchTerms: ['map']},
403              {title: 'fas fa-link', searchTerms: ['link']},
404              {title: 'fas fa-thumbtack', searchTerms: ['thumbtack']},
405              {title: 'fas fa-comment', searchTerms: ['comment']},
406              {title: 'fas fa-comments', searchTerms: ['comment']},
407              {title: 'far fa-lightbulb-on', searchTerms: ['lightbulb']},
408              {title: 'far fa-lightbulb', searchTerms: ['lightbulb']},
409              {title: 'fa-brands fa-youtube', searchTerms: ['youtube']},
410              {title: 'fas fa-play', searchTerms: ['play']},
411              {title: 'far fa-film', searchTerms: ['film']},
412              {title: 'far fa-message-exclamation', searchTerms: ['message', 'exclamation']},
413              {title: 'fas fa-triangle-exclamation', searchTerms: ['triangle', 'exclamation']},
414              {title: 'fas fa-circle-exclamation', searchTerms: ['circle', 'exclamation']},
415              {title: 'fas fa-comment-exclamation', searchTerms: ['comment', 'exclamation']},
416              {title: 'fas fa-octagon-exclamation', searchTerms: ['octagon', 'exclamation']},
417              {title: 'fas fa-circle-info', searchTerms: ['circle', 'info']},
418              {title: 'fas fa-info', searchTerms: ['info']},
419              {title: 'fas fa-envelope', searchTerms: ['envelope']},
420              {title: 'fas fa-users', searchTerms: ['users']},
421              {title: 'fas fa-poll-people', searchTerms: ['people']},
422              {title: 'fas fa-handshake', searchTerms: ['handshake']},
423              {title: 'fas fa-bullhorn', searchTerms: ['bullhorn']},
424              {title: 'far fa-megaphone', searchTerms: ['megaphone']},
425              {title: 'fas fa-angles-down', searchTerms: ['angles', 'down']},
426              {title: 'fas fa-angles-up', searchTerms: ['angles', 'up']},
427              {title: 'fas fa-arrow-up-right-and-arrow-down-left-from-center', searchTerms: ['arrow', 'up', 'right', 'down', 'left']},
428              {title: 'fas fa-arrow-up', searchTerms: ['arrow', 'up']},
429              {title: 'fas fa-street-view', searchTerms: ['street']},
430              {title: 'fas fa-location-question', searchTerms: ['location', 'question']},
431              {title: 'far fa-clipboard-question', searchTerms: ['clipboard', 'question']},
432              {title: 'far fa-bookmark', searchTerms: ['bookmark']},
433              {title: 'far fa-calendar-days', searchTerms: ['calendar', 'day']},
434              {title: 'fas fa-gavel', searchTerms: ['gavel']},
435              {title: 'far fa-location-dot', searchTerms: ['location']},
436              {title: 'far fa-signs-post', searchTerms: ['sign']},
437              {title: 'fas fa-binoculars', searchTerms: ['binoculars']},
438              {title: 'far fa-image', searchTerms: ['image']},
439              {title: 'fas fa-images', searchTerms: ['image']},
440              {title: 'fas fa-file-image', searchTerms: ['file']},
441              {title: 'fas fa-compass-drafting', searchTerms: ['compass']},
442              {title: 'far fa-clapperboard-play', searchTerms: ['clapperboard']},
443              {title: 'fas fa-high-definition', searchTerms: ['definition']},
444              {title: 'fas fa-audio-description', searchTerms: ['audio']},
445              {title: 'fas fa-hands-asl-interpreting', searchTerms: ['hands']},
446              {title: 'fas fa-closed-captioning', searchTerms: ['closed', 'captioning']},
447              {title: 'far fa-headphones', searchTerms: ['headphones']},
448              {title: 'fas fa-volume', searchTerms: ['volume']},
449              {title: 'fas fa-microphone-stand', searchTerms: ['microphone']},
450              {title: 'fas fa-microphone-lines', searchTerms: ['microphone']},
451              {title: 'far fa-ear-listen', searchTerms: ['ear', 'listen']},
452              {title: 'fas fa-ear-deaf', searchTerms: ['ear', 'deaf']},
453              {title: 'fas fa-chart-simple', searchTerms: ['chart']},
454              {title: 'fas fa-chart-line-up', searchTerms: ['chart']},
455              {title: 'fas fa-chart-area', searchTerms: ['chart']},
456              {title: 'far fa-chart-pie', searchTerms: ['chart']},
457              {title: 'fas fa-chart-line', searchTerms: ['chart']},
458              {title: 'fas fa-infinity', searchTerms: ['infinity']},
459              {title: 'fas fa-check', searchTerms: ['check']},
460              {title: 'fas fa-check-double', searchTerms: ['check', 'double']},
461              {title: 'fas fa-octagon-check', searchTerms: ['octagon', 'check']},
462              {title: 'fas fa-list', searchTerms: ['list']},
463              {title: 'fas fa-clipboard-list-check', searchTerms: ['list', 'check']},
464              {title: 'fas fa-bars', searchTerms: ['bars']},
465              {title: 'fa-brands fa-twitter', searchTerms: ['twitter']},
466              {title: 'fas fa-wand-magic-sparkles', searchTerms: ['wand', 'magic', 'sparkles']},
467              {title: 'fas fa-person-hiking', searchTerms: ['person', 'hiking']},
468              {title: 'far fa-bicycle', searchTerms: ['bicycle']},
469              {title: 'fas fa-person-walking', searchTerms: ['person', 'walking']},
470              {title: 'fas fa-wheelchair-move', searchTerms: ['wheelchair', 'move']},
471              {title: 'far fa-planet-moon', searchTerms: ['planet', 'moon']},
472            ]
473          , templates = {
474              search: '' +
475                '<div class="input-group">' +
476                  '<input type="search" class="form-control iconpicker-search" placeholder="Type to filter" />' +
477                  '<a href="javascript:void(0);" onclick="return false;" class="input-group-addon reset">Reset</a>' +
478                '</div>'
479            }
480        ;
481
482        return function (context, settings) {
483          var $iconPickers = $('.icp')
484            , eventNamespace = 'kvo-fa-iconpicker'
485            , iconList
486          ;
487
488          if ( !$iconPickers.length ) return;
489
490          $iconPickers.once('icp', function() {
491
492            var $iconPicker = $(this)
493              , $container = $iconPicker.closest('.field-type-text')
494              , $hiddenInput = $container.find('.icp-target')
495              , $pickedIcon = $iconPicker.find('i')
496              , $searchField
497            ;
498
499            iconList = iconList || fontawesomeIcons.concat(jQuery.iconpicker.defaultOptions.icons);
500
501            $iconPicker.iconpicker({
502              icons: iconList
503              , templates: templates
504            }).on('iconpickerSelected'.namespace(eventNamespace), function (e) {
505              $hiddenInput.val( e.iconpickerInstance.options.fullClassFormatter( e.iconpickerValue ) );
506            });
507
508            // search input is added by iconpicker, so it is not
509            // available before calling the constructor 
510            $searchField = $container.find('.iconpicker-search')
511              .on('click'.namespace(eventNamespace), function (e) { e.stopPropagation(); });
512
513            $container
514            .on('click'.namespace(eventNamespace), '.iconpicker-container .reset', function (e) {
515
516              $hiddenInput.val('');
517              $container.find('.iconpicker-selected').removeClass('iconpicker-selected bg-primary');
518              // TODO: why we keep these classes,
519              // there is no such a FA icon with this className
520              $pickedIcon.removeClass().addClass('fa fa-fw');
521              $searchField.val('').trigger('keyup');
522            })
523            .on('click'.namespace(eventNamespace), '.iconpicker-item', function(e){ e.preventDefault() });
524          });
525        };
526      })()
527    },
528    kvoSelectPicker: {
529      attach: (function() {
530        return function (context, settings) {
531          var $selectPicker = $('.selectpicker');
532          $selectPicker.once('selectpicker', function() {
533            $selectPicker.selectpicker();
534          });
535    
536        };
537      })()
538    }
539  });
540})(jQuery);;
541Drupal.registerModule('kvoContrastSwitcher', function (eventNamespace, $) {
542
543        function contrastSwitcherHtml(className) {
544          return `
545              <div class="kvo-contrast-switcher nav-tooltip${ className ? (' ' + className) : '' }" role="switch" aria-checked="false" aria-label="Increase Contrast" tabindex="0" data-original-title="High Contrast Mode" data-placement="top">
546                  <div class="track">
547                      <div class="increased-contrast switch">
548                          <svg aria-hidden="true" class="icon-eye" viewBox="0 0 409.6 216.06" xmlns="http://www.w3.org/2000/svg">
549                            <path class="filled" d="M409.6,194.39c-2.09,3-3.8,6.39-6.34,9-34.57,35-74,63-119.95,81.1-31.43,12.37-64,18-97.87,14.6-26.52-2.66-51.66-10.39-75.69-21.61-39-18.24-73.27-43.37-103.41-74.09-2.53-2.58-4.25-5.95-6.34-9v-4.8c2.09-3,3.8-6.38,6.34-9,34.57-35,74-63,120-81.11,31.43-12.36,64-18,97.87-14.59,26.52,2.66,51.66,10.39,75.69,21.61,39,18.23,73.27,43.37,103.41,74.09,2.53,2.57,4.25,6,6.34,9ZM204.67,276c46.14.11,84-37.65,84.12-83.86s-37.65-84-83.86-84.11-84,37.64-84.12,83.86S158.46,275.87,204.67,276Z" transform="translate(0 -83.96)"/>
550                            <path class="outline" d="M409.6,194.39c-2.09,3-3.8,6.39-6.34,9-34.57,35-74,63-119.95,81.1-31.43,12.37-64,18-97.87,14.6-26.52-2.66-51.66-10.39-75.69-21.61-39-18.24-73.27-43.37-103.41-74.09-2.53-2.58-4.25-5.95-6.34-9v-4.8c2.09-3,3.8-6.38,6.34-9,34.57-35,74-63,120-81.11,31.43-12.36,64-18,97.87-14.59,26.52,2.66,51.66,10.39,75.69,21.61,39,18.23,73.27,43.37,103.41,74.09,2.53,2.57,4.25,6,6.34,9ZM204.67,276c46.14.11,84-37.65,84.12-83.86s-37.65-84-83.86-84.11-84,37.64-84.12,83.86S158.46,275.87,204.67,276ZM96.84,191.78c0-21.9,6.44-42,18.17-60.55-32.08,15.51-60.33,36-86.07,60.8,25.72,24.76,54,45.27,86,60.66C103.14,234,96.8,213.81,96.84,191.78Zm197.79-60.16q36.66,60.47-.34,121.4c21.82-8.58,66.44-40.24,86-60.92C366,174.76,306.16,132.67,294.63,131.62Z" transform="translate(0 -83.96)"/>
551                            <path class="contrast" d="M204.82,253a61,61,0,1,1,0-122Z" transform="translate(0 -83.96)"/>
552                          </svg>
553                      </div>
554                      <div class="normal-mode switch">
555                          <svg aria-hidden="true" class="icon-eye" viewBox="0 0 409.6 216.06" xmlns="http://www.w3.org/2000/svg">
556                            <path class="filled" d="M409.6,194.39c-2.09,3-3.8,6.39-6.34,9-34.57,35-74,63-119.95,81.1-31.43,12.37-64,18-97.87,14.6-26.52-2.66-51.66-10.39-75.69-21.61-39-18.24-73.27-43.37-103.41-74.09-2.53-2.58-4.25-5.95-6.34-9v-4.8c2.09-3,3.8-6.38,6.34-9,34.57-35,74-63,120-81.11,31.43-12.36,64-18,97.87-14.59,26.52,2.66,51.66,10.39,75.69,21.61,39,18.23,73.27,43.37,103.41,74.09,2.53,2.57,4.25,6,6.34,9ZM204.67,276c46.14.11,84-37.65,84.12-83.86s-37.65-84-83.86-84.11-84,37.64-84.12,83.86S158.46,275.87,204.67,276Z" transform="translate(0 -83.96)"/>
557                            <path class="outline" d="M409.6,194.39c-2.09,3-3.8,6.39-6.34,9-34.57,35-74,63-119.95,81.1-31.43,12.37-64,18-97.87,14.6-26.52-2.66-51.66-10.39-75.69-21.61-39-18.24-73.27-43.37-103.41-74.09-2.53-2.58-4.25-5.95-6.34-9v-4.8c2.09-3,3.8-6.38,6.34-9,34.57-35,74-63,120-81.11,31.43-12.36,64-18,97.87-14.59,26.52,2.66,51.66,10.39,75.69,21.61,39,18.23,73.27,43.37,103.41,74.09,2.53,2.57,4.25,6,6.34,9ZM204.67,276c46.14.11,84-37.65,84.12-83.86s-37.65-84-83.86-84.11-84,37.64-84.12,83.86S158.46,275.87,204.67,276ZM96.84,191.78c0-21.9,6.44-42,18.17-60.55-32.08,15.51-60.33,36-86.07,60.8,25.72,24.76,54,45.27,86,60.66C103.14,234,96.8,213.81,96.84,191.78Zm197.79-60.16q36.66,60.47-.34,121.4c21.82-8.58,66.44-40.24,86-60.92C366,174.76,306.16,132.67,294.63,131.62Z" transform="translate(0 -83.96)"/>
558                            <path class="normal" d="M211.65,166.37c-3.53,7-3,12.7,1.44,17.21s10.08,5.1,17.19,1.63c2.85,7,1,20.58-9.87,28.39A26.66,26.66,0,0,1,181.52,179C187.48,168.37,200.41,162.92,211.65,166.37Z" transform="translate(0 -83.96)"/>
559                          </svg>
560                      </div>
561                  </div>
562              </div>
563          `;
564        };
565
566        function isWithinIframe() {
567          try {
568            return window.self !== window.top;
569          }
570          catch (e) {
571            return true;
572          }
573        };
574
575        return function (settings) {
576          if ($('body').hasClass('page-admin')) return;
577          var urlParams = new URLSearchParams(location.search)
578                , withinIframe = (urlParams.has('iframe') && 'true' === urlParams.get('iframe')) || isWithinIframe()
579                , hasPdfJs = !!window.PDFViewerApplication
580                , placeWithinDocument = withinIframe && hasPdfJs
581                , className = placeWithinDocument ? 'document-switcher' : ''
582                , method = placeWithinDocument ? 'insertBefore' : 'appendTo'
583                , targetElement = placeWithinDocument ? '.document-container .powered-by' : 'body'
584                , $constrastSwitcher = $(contrastSwitcherHtml(className))[method](targetElement)
585                , $html = $('html')
586                ;
587          $(document).on('click', '.kvo-contrast-switcher', function () {
588            var isOn;
589            $html.toggleClass('kvo-high-contrast-mode');
590            $constrastSwitcher.toggleClass('is-increased-contrast-mode');
591            isOn = $html.is('.kvo-high-contrast-mode');
592            $constrastSwitcher.attr({
593              'aria-checked': isOn ? 'true' : 'false',
594              'aria-label': isOn ? 'Decrease Contrast' : 'Increase Contrast',
595              'data-original-title': isOn ? 'Normal Contrast Mode' : 'High Contrast Mode'
596            });
597          }).on('keyup', '.kvo-contrast-switcher', function (e) {
598            var key = e.keyCode || e.which;
599            if (13 /* Enter */ === key || 32 /* Space */ === key) {
600              $constrastSwitcher.click();
601            }
602          });
603          // TODO: Use cookie or local storage to restore state
604        };
605      }, [jQuery]);
606
607
608  Drupal.registerModule('kvoDocCommentsGoogleTranslateWidgetProxyDecorator', function(eventNamespace, $) {
609
610    var GT_IGNORE_CLASS_NAME = 'skiptranslate'
611      , KVO_GT_DISABLED_FOR_PDF_DOCS_CLASS_NAME = 'kvo-gt-disabled-for-pdf-docs'
612      // pause between the two clicks of the bridge-language bounce
613      , GT_BRIDGE_DELAY = 400
614      // how long we wait for scrolling to settle before asking GT for a pass
615      , GT_RETRANSLATE_DEBOUNCE = 1200
616      // hard floor between two passes: each pass costs two GT API calls and
617      // re-renders the whole page, so this should not be lowered casually
618      , GT_RETRANSLATE_MIN_INTERVAL = 4000
619      , GT_VIEWAREA_THROTTLE = 300
620      // marks a text layer we have already submitted to GT
621      , GT_PASS_ATTRIBUTE = 'data-kvo-gt-pass'
622    ;
623
624    function until(predicate, interval, attempts) {
625        predicate = $.isFunction(predicate) ? predicate : function() { return true };
626        interval = interval || 100;
627        attempts = attempts || 100;
628
629        return $.Deferred(function(deferred) {
630            var done = deferred.resolve;
631
632            poll();
633
634            function poll() {
635                if( !attempts-- ) {
636                    deferred.reject();
637                    return;
638                }
639
640                // console.log('polling: ', interval, attempts);
641                predicate() ? done() : setTimeout(poll, interval);
642            }
643
644        }).promise();
645    }
646
647    // TODO: a candidate for adding to Drupal.utils
648    function isWithinIframe() {
649        try {
650            return window.self !== window.top;
651        } catch (e) {
652            return true;
653        }
654    }
655
656    function inlineStyleSheet(styleString) {
657        var style = document.createElement('style');
658        document.head.append(style);
659        style.textContent = styleString;
660    }
661
662    function normalizeURIParam(str) {
663        return decodeURIComponent(str.replace(/\+/g, ' '));
664    }
665
666    function validateLangSourceTargetStringParam(param, method, config) {
667
668        if (param = normalizeURIParam(param).match("^\\((([a-zA-Z\\-_]*)\\|)?([a-zA-Z\\-_]*)\\)|^/(([a-zA-Z\\-_]*)/)?([a-zA-Z\\-_]*)")) {
669
670            if (param[3])
671                return config.src = param[2],
672                config.target = param[3],
673                config.enabledVia = method,
674                true;
675
676            if (param[6])
677                return config.src = param[5],
678                config.target = param[6],
679                config.enabledVia = method,
680                true;
681        }
682
683        return false;
684    }
685
686    function languageSwitcherHtml(listItemsHtml) {
687        return `
688        <div class="kvo-language-switcher-container">
689            <div class="kvo-language-switcher">
690                <button class="kvo-language-switcher-current-language" type="button" aria-expanded="false" aria-controls="kvo-language-switcher-language-menu" aria-haspopup="true">
691                    <svg aria-hidden="true" class="icon-translate" viewBox="0 0 384.05 384" xmlns="http://www.w3.org/2000/svg">
692                        <g class="arrows">
693                            <path d="M384.05,118.5c-.91-5.51-1.53-11.09-2.77-16.52-10-43.47-45.65-74.74-89.86-78.92-1.23-.11-2.45-.32-4.19-.54,1-1.11,1.64-1.92,2.36-2.68C296,13.07,294.39,4.65,285.9.66a4.85,4.85,0,0,1-.85-.66H279.8c-1.8,1.08-3.89,1.86-5.36,3.28-7.7,7.5-15.33,15.06-22.81,22.78a10.77,10.77,0,0,0,0,15.54q11.2,11.59,22.8,22.8a11.1,11.1,0,0,0,15.84-.14c4.18-4.28,4.24-10.9.12-15.62-.82-.94-1.68-1.84-2.85-3.12,24,.78,47.94,15.07,61.43,36.26,8.2,12.87,12.05,27,12.46,42.19.21,7.94,7,13,14.33,10.94,4.59-1.3,6.62-4.93,8.3-8.91Z" transform="translate(0)"/>
694                            <path d="M60.37,327c-24.28-15.57-36.9-37.88-37.81-66.75-.22-6.9-5-11.95-11.4-11.86S0,253.6.09,260.49c0,3.36.31,6.73.63,10.08,4,42.25,36.75,79.06,78.37,88,5.65,1.21,11.41,1.95,17.47,3-1.11,1.18-2,2.14-3,3.15-4.28,4.78-4.22,11.61.14,15.88a11.07,11.07,0,0,0,15.57.1q11.75-11.29,23.05-23.05a10.58,10.58,0,0,0,.43-14.69q-11.7-12.37-24.1-24.1c-4.21-4-11-3.37-15,.6a11.36,11.36,0,0,0-.57,15.33c.85,1,1.8,2,3.38,3.72C82.88,337.51,71.05,333.81,60.37,327Z" transform="translate(0)"/>
695                        </g>
696                        <path class="outline" d="M29.3,0H192.05a2.64,2.64,0,0,0,.64.38C212.2,5.31,221.27,17,221.27,37.28q0,60.38,0,120.74v4.76h4c10.38,0,20.75-.11,31.12.07,2.75.05,4.11-.83,5.45-3.23,13-23.17,32.87-36.69,58.79-41.54,7.56-1.41,13.6,3.66,13.75,11.47s0,15.75,0,23.62c0,3.09,0,6.18,0,9.63,5.89,0,11.37-.24,16.82,0,13.32.71,23.24,7,29.26,19,1.61,3.19,2.38,6.79,3.54,10.2V354.75a5.54,5.54,0,0,0-.49,1c-5,19.18-16.65,28.24-36.39,28.24H199.08c-22.12,0-36.25-14.17-36.25-36.36q0-60.92,0-121.85v-4.57c-12.11,0-23.72.08-35.32-.06-2.56,0-3.91.76-5.19,3.05C109.54,247.13,90,260.75,64.36,265.72c-8.79,1.7-14.64-3.24-14.68-12.22,0-9.38,0-18.75,0-28.12V221.2c-5.93,0-11.29.12-16.65,0A33.51,33.51,0,0,1,.12,188Q-.1,110.54.15,33.12C.2,20.07,6.67,10.24,18.09,4,21.53,2.12,25.55,1.3,29.3,0ZM185.52,221.41c-.08.73-.18,1.21-.18,1.68q0,63.37,0,126.75c0,7.08,4.93,11.65,12.32,11.65q75.73,0,151.49,0c7.77,0,12.37-4.59,12.37-12.35q0-75.75,0-151.49c0-7.75-4.62-12.32-12.38-12.36s-15.75,0-23.62,0c-9.58,0-13.6-4.05-13.6-13.69,0-9.09,0-18.17,0-27.86-2.05.92-3.63,1.55-5.14,2.32a58.26,58.26,0,0,0-28.14,30.42c-2.59,6.24-6.82,9-13.58,8.87-10.49-.24-21-.06-31.5-.06H221.73C217.45,210.6,208.42,219.63,185.52,221.41ZM72.16,240.14c1.12-.39,1.59-.53,2-.72.92-.4,1.83-.8,2.73-1.24a58.94,58.94,0,0,0,28.66-30.9c2.48-5.94,6.51-8.65,13-8.61,22.49.14,45,.07,67.47.05,8.05,0,12.73-4.54,12.73-12.41q0-75.74,0-151.46c0-7.74-4.64-12.34-12.39-12.34q-75.72,0-151.45,0c-7.77,0-12.36,4.59-12.36,12.35q0,75.73,0,151.46c0,7.75,4.6,12.35,12.34,12.39,8.12,0,16.25,0,24.37,0q12.87,0,12.89,12.88C72.18,221,72.16,230.3,72.16,240.14Zm257.69,77.4c0,6-3.45,10.51-8.25,11.79A10.91,10.91,0,0,1,308.83,324c-2.58-4.7-4.74-9.63-7.36-14.31a5,5,0,0,0-3.59-2.25c-16.24-.15-32.48-.06-48.72-.14a3.76,3.76,0,0,0-4,2.54c-2,4.3-4.17,8.52-6.34,12.73-3.4,6.61-9.54,9-15.52,6.07s-7.87-9.53-4.64-16q22.05-44.22,44.15-88.41c2.21-4.42,5.58-7.15,10.53-7.17s8.38,2.62,10.59,7.05q22.14,44.37,44.32,88.72A28.67,28.67,0,0,1,329.85,317.54ZM289.1,284.68l-15.67-31.27c-5.35,10.72-10.37,20.81-15.59,31.27ZM128.9,137.53c6.2,3.33,13.49,5.27,21,6.43,2.09.32,4.22.44,6.34.63,6.46.59,11.13,5.58,10.83,11.6A11.41,11.41,0,0,1,154.66,167c-14.68-.87-28.57-4.61-41.22-12.25-2.16-1.3-3.58-1.18-5.65.06-12.68,7.6-26.56,11.34-41.24,12.19a11.39,11.39,0,0,1-12.32-10.53c-.49-6.1,4.28-11.33,10.94-11.84a73.16,73.16,0,0,0,28.07-7.43c-9.65-12.6-14.22-26.92-16-42.5-3.91,0-7.52.06-11.12,0C59.28,94.55,54.39,90,54.21,83.75S59.09,72.34,66,72.23c10.25-.15,20.5,0,30.74,0,.73,0,1.46-.1,2.69-.19,0-2.25-.1-4.33,0-6.4.35-6.72,5.28-11.6,11.46-11.43s10.68,4.89,11,11.51c.09,2,0,4,0,6.31,1.66.08,3,.2,4.29.2,9.75,0,19.5-.1,29.25.06,6.37.1,10.82,4.16,11.59,10.1a11.17,11.17,0,0,1-7.84,11.81,18.82,18.82,0,0,1-4.81.51c-3.35.08-6.7,0-9.59,0-2,7.81-3.35,15.36-6,22.44S132.35,130.55,128.9,137.53ZM121.08,95h-21c1.27,10.22,4.26,19.37,10.6,27.74A55.76,55.76,0,0,0,121.08,95Z" transform="translate(0)"/>
697                        <path class="filled" d="M185.52,221.41c-.08.73-.18,1.21-.18,1.68q0,63.37,0,126.75c0,7.08,4.93,11.65,12.32,11.65q75.73,0,151.49,0c7.77,0,12.37-4.59,12.37-12.35q0-75.75,0-151.49c0-7.75-4.62-12.32-12.38-12.3
6976s-15.75,0-23.62,0c-9.58,0-13.6-4.05-13.6-13.69,0-9.09,0-18.17,0-27.86-2.05.92-3.63,1.55-5.14,2.32a58.26,58.26,0,0,0-28.14,30.42c-2.59,6.24-6.82,9-13.58,8.87-10.49-.24-21-.06-31.5-.06H221.73C217.45,210.6,208.42,219.63,185.52,221.41Zm144.33,96.13c0,6-3.45,10.51-8.25,11.79A10.91,10.91,0,0,1,308.83,324c-2.58-4.7-4.74-9.63-7.36-14.31a5,5,0,0,0-3.59-2.25c-16.24-.15-32.48-.06-48.72-.14a3.76,3.76,0,0,0-4,2.54c-2,4.3-4.17,8.52-6.34,12.73-3.4,6.61-9.54,9-15.52,6.07s-7.87-9.53-4.64-16q22.05-44.22,44.15-88.41c2.21-4.42,5.58-7.15,10.53-7.17s8.38,2.62,10.59,7.05q22.14,44.37,44.32,88.72A28.67,28.67,0,0,1,329.85,317.54ZM289.1,284.68l-15.67-31.27c-5.35,10.72-10.37,20.81-15.59,31.27Zm-67.83-121.9V158q0-60.38,0-120.74c0-20.26-9.07-32-28.58-36.9a2.64,2.64,0,0,1-.64-.38H29.3c-3.75,1.3-7.77,2.12-11.21,4C6.67,10.24.2,20.07.15,33.12Q-.15,110.54.12,188A33.51,33.51,0,0,0,33,221.18c5.36.14,10.72,0,16.65,0v4.18c0,9.37,0,18.74,0,28.12,0,9,5.89,13.92,14.68,12.22,25.64-5,45.18-18.59,58-41.51,1.28-2.29,2.63-3.08,5.19-3.05,11.6.14,23.21.06,35.32.06l22.7.19c22.9-1.78,31.93-10.81,36.21-36.13ZM154.66,167c-14.68-.87-28.57-4.61-41.22-12.25-2.16-1.3-3.58-1.18-5.65.06-12.68,7.6-26.56,11.34-41.24,12.19a11.39,11.39,0,0,1-12.32-10.53c-.49-6.1,4.28-11.33,10.94-11.84a73.16,73.16,0,0,0,28.07-7.43c-9.65-12.6-14.22-26.92-16-42.5-3.91,0-7.52.06-11.12,0C59.28,94.55,54.39,90,54.21,83.75S59.09,72.34,66,72.23c10.25-.15,20.5,0,30.74,0,.73,0,1.46-.1,2.69-.19,0-2.25-.1-4.33,0-6.4.35-6.72,5.28-11.6,11.46-11.43s10.68,4.89,11,11.51c.09,2,0,4,0,6.31,1.66.08,3,.2,4.29.2,9.75,0,19.5-.1,29.25.06,6.37.1,10.82,4.16,11.59,10.1a11.17,11.17,0,0,1-7.84,11.81,18.82,18.82,0,0,1-4.81.51c-3.35.08-6.7,0-9.59,0-2,7.81-3.35,15.36-6,22.44s-6.44,13.42-9.89,20.4c6.2,3.33,13.49,5.27,21,6.43,2.09.32,4.22.44,6.34.63,6.46.59,11.13,5.58,10.83,11.6A11.41,11.41,0,0,1,154.66,167ZM100.12,95h21a55.76,55.76,0,0,1-10.36,27.74C104.38,114.36,101.39,105.21,100.12,95Z" transform="translate(0)"/>
698                    </svg>
699                    <span class="current-language-label ${ GT_IGNORE_CLASS_NAME } hidden-xs"></span>
700                    <svg aria-hidden="true" class="icon-arrow hidden-xs" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="m12 15-5-5h10Z"></path></svg>
701                </button>
702                <div id="kvo-language-switcher-language-menu" role="menu">
703                    <ul role="presentation">
704                        ${ listItemsHtml || ''}
705                    </ul> 
706                </div>
707            </div>
708        </div>`;
709    }
710
711    function languageSwitcherListItemHtml(item) {
712        return `
713        <li role="presentation" class="${ item.value ? GT_IGNORE_CLASS_NAME : '' }">
714            <a href="#" data-lang="${item.value || ''}" role="menuitem">${ item.label || '' }${ !item.value ? '<i class="fas fa-xmark" aria-hidden="true"></i>' : '' }</a>
715        </li>`;
716    }
717
718    function languageSwitcherStyles() {
719        return `
720
721        /* TWEAK started */
722        #kvo-language-switcher-language-menu ul li:first-child a:after {
723            content: none !important;
724        }
725
726        html.${KVO_GT_DISABLED_FOR_PDF_DOCS_CLASS_NAME} .kvo-language-switcher-container { display: none !important; }
727
728        /* TWEAK ended */
729
730        #google_translate_element,
731        iframe.${ GT_IGNORE_CLASS_NAME }[title], /* ← .VIpgJd-ZVi9od-xl07Ob-OEVmcd */
732        div.${ GT_IGNORE_CLASS_NAME } > iframe.${ GT_IGNORE_CLASS_NAME } {
733            display: none !important;
734        }
735
736        .translated-ltr body,
737        .translated-rtl body {
738            top: 0 !important;
739        }
740
741        .translated-ltr:not(.${KVO_GT_DISABLED_FOR_PDF_DOCS_CLASS_NAME}) .node-type-document .pdfViewer .text,
742        .translated-rtl:not(.${KVO_GT_DISABLED_FOR_PDF_DOCS_CLASS_NAME}) .node-type-document .pdfViewer .text,
743        .translated-ltr:not(.${KVO_GT_DISABLED_FOR_PDF_DOCS_CLASS_NAME}) .node-type-document .pdfViewer .text span,
744        .translated-rtl:not(.${KVO_GT_DISABLED_FOR_PDF_DOCS_CLASS_NAME}) .node-type-document .pdfViewer .text span,
745        .translated-ltr:not(.${KVO_GT_DISABLED_FOR_PDF_DOCS_CLASS_NAME}
745) .node-type-document .pdfViewer .textLayer span,
746        .translated-rtl:not(.${KVO_GT_DISABLED_FOR_PDF_DOCS_CLASS_NAME}) .node-type-document .pdfViewer .textLayer span {
747            color: #222;
748            background: #fff;
749        }
750
751        html:not(.${KVO_GT_DISABLED_FOR_PDF_DOCS_CLASS_NAME}) .pdfViewer .page canvas:last-child,
752        .translated-ltr:not(.${KVO_GT_DISABLED_FOR_PDF_DOCS_CLASS_NAME}) .pdfViewer .page canvas:first-child,
753        .translated-rtl:not(.${KVO_GT_DISABLED_FOR_PDF_DOCS_CLASS_NAME}) .pdfViewer .page canvas:first-child {
754            display: none;
755        }
756
757        .translated-ltr:not(.${KVO_GT_DISABLED_FOR_PDF_DOCS_CLASS_NAME}) .pdfViewer .page canvas:last-child,
758        .translated-rtl:not(.${KVO_GT_DISABLED_FOR_PDF_DOCS_CLASS_NAME}) .pdfViewer .page canvas:last-child {
759            display: block;
760        }
761        `;
762    }
763
764    // Google Translate keeps its state in the `googtrans` cookie, which it sets
765    // on several domain / path combinations. All of them have to be dropped,
766    // otherwise the widget silently restores the previous translation.
767    function clearGoogtrans() {
768        var COOKIE_NAME = 'googtrans'
769          , EXPIRED = 'expires=Thu, 01 Jan 1970 00:00:00 GMT'
770          , host = window.location.hostname
771          , parts = host.split('.')
772          , domains = ['', host, '.' + host]
773          , root
774        ;
775
776        if( parts.length > 2 ) {
777            root = parts.slice(-2).join('.');
778            domains.push(root, '.' + root);
779        }
780
781        domains.forEach(function(domain) {
782            var d = domain ? '; domain=' + domain : '';
783
784            document.cookie = COOKIE_NAME + '=; path=/' + d + '; ' + EXPIRED;
785            document.cookie = COOKIE_NAME + '=; path=' + window.location.pathname + d + '; ' + EXPIRED;
786        });
787    }
788
789    // 'Show Original'. The widget's own restore routine is no longer reachable
790    // from the outside (see the note on retranslateCurrentLanguage below),
791    // so we drop the cookie and let the page render untranslated.
792    function resetTranslation() {
793        clearGoogtrans();
794        window.location.reload();
795    }
796
797    function ammend(proto, fnName, substitute) {
798        if( !(proto && proto[ fnName ] && 'function' === typeof substitute) ) return;
799
800        proto[ fnName ] = (function(original) {
801            return function() {
802                var args = Array.prototype.slice.call(arguments);
803                return substitute.call(this, original, args);
804            };
805        })( proto[ fnName ] );
806    }
807
808    /* The four functions below are the pdf.js ammended prototype functions, don't call them manually */
809
810    function pageViewResetAmmended(originalFn, args) {
811        var params = null == args[0] ? {
812              keepZoomLayer: false,
813              keepAnnotationLayer: false,
814              keepAnnotationEditorLayer: false,
815              keepXfaLayer: false,
816              keepTextLayer: false
817            } : args[0]
818          , zoomLayerNode = (params.keepZoomLayer && this.zoomLayer) || null
819        ;
820
821        if (!zoomLayerNode) {
822            if (this.kvoGraphicsCanvas) {
823                // Zeroing the width and height causes Firefox to release graphics
824                // resources immediately, which can greatly reduce memory consumption.
825                this.kvoGraphicsCanvas.width = 0;
826                this.kvoGraphicsCanvas.height = 0;
827                delete this.kvoGraphicsCanvas;
828            }
829        }
830
831        return originalFn.apply(this, args);
832    }
833
834    function transportGetRenderingIntentAmmended(originalFn, args) { /* intent, annotationMode = AnnotationMode.ENABLE, printAnnotationStorage = null, isOpList = false*/
835        var returnedValue
836          , callOrigin = args.length === 3 ? 'render' :
837                (args.length === 4 ? 'getOperatorList' : 'getAnnotations')
838            // we can determine from which method the ._transport.getRenderingIntent was called
839            // by the number of parameters
840          , isGraphicsOnlyMode = args.length >= 3 && 'display_graphics' === args[0]
841        ;
842
843
844        if( isGraphicsOnlyMode ) {
845            args[0] = 'display';
846        }
847
848        returnedValue = originalFn.apply(this, args);
849
850        if( isGraphicsOnlyMode ) {
851            returnedValue.cacheKey = 'kvo-graphics_' + returnedValue.cacheKey
852        }
853        return returnedValue;
854    }
855
856    function pagePumpOperatorListAmmended(originalFn, args) {
857        var params = args[0]
858          , isGraphicsOnlyLayer = -1 !== params.cacheKey.indexOf('kvo-graphics')
859          , intentState
860        ;
861
862        if(isGraphicsOnlyLayer) {
863            intentState = this._intentStates.get(params.cacheKey);
864            intentState.kvoIsGraphicsOnlyLayer = isGraphicsOnlyLayer
865        }
866
867        return originalFn.apply(this, args);
868    }
869
870    function pageRenderPageChunkAmmended(originalFn, args) { /* operatorListChunk, intentState */
871        var operatorListChunk = args[0]
872          , intentState = args[1]
873          , isGraphicsLayer = !!intentState.kvoIsGraphicsOnlyLayer
874          , textRendering = !!intentState.kvoWithinTextRenderSequence
875          , fnArray = []
876          , argsArray = []
877          , OPS = pdfjsLib.OPS
878          , i
879          , length
880          , op
881        ;
882
883        if( !isGraphicsLayer ) return originalFn.apply(this, args);
884
885        // filter operator list based on the cacheKey value
886        // Add the new chunk to the current operator list.
887        for (i = 0, length = operatorListChunk.length; i < length; ++i) {
888            op = operatorListChunk.fnArray[i];
889
890            if( OPS.beginText === op ) {
891                intentState.kvoWithinTextRenderSequence = textRendering = true;
892            }
893
894            // TODO: do we need the first condition since above we bail in case this is not a graphics layer?
895            if( (textRendering && !isGraphicsLayer) || (!textRendering && isGraphicsLayer) ) {
896                fnArray.push(operatorListChunk.fnArray[i]);
897                argsArray.push(operatorListChunk.argsArray[i]);
898            }
899
900            if( OPS.endText === op ) {
901                intentState.kvoWithinTextRenderSequence = textRendering = false;
902            }
903        }
904
905
906        // re-assign the filtered array to the operator chunk parameter
907        operatorListChunk.fnArray = fnArray;
908        operatorListChunk.argsArray = argsArray;
909        operatorListChunk.length = fnArray.length;
910
911
912        // pass the modified OPList to the original function
913        return originalFn.apply(this, args);
914    }
915
916    function tryAmmendPdfJsPrototypes() {
917        var pdfDocument = PDFViewerApplication.pdfDocument
918          , proto = pdfDocument && Object.getPrototypeOf( pdfDocument )
919          , pageView
920        ;
921
922        if( !proto ) return;
923
924        proto._isKvoAmmended = true;
925
926        if( pageView = PDFViewerApplication.pdfViewer.getPageView(0) ) {
927            proto = Object.getPrototypeOf( pageView );
928            ammend(proto, 'reset', pageViewResetAmmended);
929        }
930
931        proto = Object.getPrototypeOf( pdfDocument._transport );
932
933        ammend(proto, 'getRenderingIntent', transportGetRenderingIntentAmmended);
934
935        pdfDocument.getPage(1).then(function(page) {
936            proto = Object.getPrototypeOf( page );
937
938            ammend(proto, '_pumpOperatorList', pagePumpOperatorListAmmended);
939            ammend(proto, '_renderPageChunk', pageRenderPageChunkAmmended);
940        });
941    }
942
943    function renderPageGraphicsCanvasLayer(pageView, pageNumber) {
944
945        if( !(pageView.canvas && pageView.pdfPage) ) return;
946
947        var $canvasWrapper = $(pageView.canvas).closest('.canvasWrapper')
948          , canvas
949          , style
950          , ctx
951          , transform
952          , renderContext
953          , renderTask
954        ;
955
956        if( !$canvasWrapper.length ) return;
957
958        canvas = document.createElement('canvas');
959        // Keep the canvas hidden until the first draw callback, or until drawing
960        // is complete when `!this.renderingQueue`, to prevent black flickering.
961        canvas.hidden = true;
962        canvas.setAttribute('role', 'presentation');
963        // need this to remove our canvas from the memory while user scrolls
964        // pdf.js renders only couple of pages at a time to preserve memory
965        pageView.kvoGraphicsCanvas = canvas;
966
967        $canvasWrapper.append(canvas);
968
969        ctx = canvas.getContext('2d', { alpha: false });
970
971        canvas.width = pageView.canvas.width;
972        canvas.height = pageView.canvas.height;
973
974        style = canvas.style;
975
976        style.width = pageView.canvas.style.width;
977        style.height = pageView.canvas.style.height;
978
979        transform = pageView.outputScale.scaled ?
980            [pageView.outputScale.sx, 0, 0, pageView.outputScale.sy, 0, 0]
981            : null;
982
983        renderContext = {
984            canvasContext: ctx,
985            intent: 'display_graphics',
986            transform: transform,
987            viewport: pageView.viewport,
988            annotationMode: 2, // ← AnnotationMode.DISABLE, the default is 2 - AnnotationMode.ENABLE_FORMS
989            optionalContentConfigPromise: pageView._optionalContentConfigPromise,
990            // annotationCanvasMap: pageView._annotationCanvasMap,
991            pageColors: pageView.pageColors
992        };
993
994        renderTask = pageView.pdfPage.render(renderContext);
995        // renderTask.onContinue = renderContinueCallback;
996        renderTask.promise.finally(function() { canvas.hidden = false; } );
997    }
998
999    return function(settings) {
1000
1001        // if there is still no Google Translate at this point or the page is embedded - do nothing 
1002       if (typeof google === 'undefined' || !google.translate || isWithinIframe()) {
1003            return;
1004        }
1005
1006        var $html = $('html')
1007          , $gtLanguageMenuDropdown
1008          , $gtLanguageMenuItems
1009          , gtIsEnabled
1010          , gtIsEnabledVia = {
1011                // ?/#googtrans(en|zh-CN)
1012                url: function() {
1013                    var matches = window.location.href.match(/#.*googtrans(.*)/);
1014                    return matches && matches[1];
1015                },
1016                // ; googtrans=/en/zh-CN;
1017                cookie: function() {
1018                    var matches = document.cookie.match(/(^|; )googtrans=(.*?)(;|$)/);
1019                    return matches && matches[2];
1020                }
1021            }
1022          , config = {}
1023          , lngToNodeMap
1024          , gtBridgeNode
1025          , retranslateInProgress = false
1026          , lastRetranslateAt = 0
1027          , autoRetranslateTimer
1028          , $languageSwitcherButton
1029          , $languageSwitcherLanguageMenuItems
1030          , kvoDocumentLoadedHandler = function(e, pdfjsOriginalEvent) {
1031                // if we have successfully changed the pdf.js prototypes
1032                tryAmmendPdfJsPrototypes();
1033                // unsubscribe off of this event
1034                $(window).off('kvo-pages-init'.namespace(eventNamespace), kvoDocumentLoadedHandler);
1035            }
1036          , GTForPDFDocsIsDisabled = window.PDFViewerApplication && $('#viewer.pdfViewer').is(`.${GT_IGNORE_CLASS_NAME}`)
1037        ;
1038
1039        // Picks the language node we bounce through to force a full GT pass.
1040        // English is preferred: the intermediate state is then the original
1041        // text rather than some unrelated third language.
1042        function pickBridgeNode(target) {
1043            var node = gtBridgeNode || null;
1044
1045            !node &&
1046                $.each(lngToNodeMap || {}, function(lang, data) {
1047                    if( lang === target ) return true; // ← keep looking
1048
1049                    node = data.node;
1050                    return false;
1051                });
1052
1053            return node;
1054        }
1055
1056        // Note this re-translates the whole page, not just the new layers: it
1057        // is expensive, hence the throttling in scheduleAutoRetranslate below.
1058        function forceRetranslateRenderedPages(onDone) {
1059            var targetData = lngToNodeMap && lngToNodeMap[ config.target ]
1060              , bridge = pickBridgeNode( config.target )
1061            ;
1062
1063            if( retranslateInProgress || !(targetData && bridge) ) return false;
1064
1065            retranslateInProgress = true;
1066
1067            try {
1068                bridge.click();
1069            } catch (e) {
1070                retranslateInProgress = false;
1071                return false;
1072            }
1073
1074            setTimeout(function() {
1075
1076                try {
1077                    targetData.node.click();
1078                } catch (e) { /* the menu iframe went away - nothing we can do */ }
1079
1080                setTimeout(function() {
1081                    retranslateInProgress = false;
1082                    lastRetranslateAt = Date.now();
1083
1084                    $.isFunction(onDone) && onDone();
1085                }, GT_BRIDGE_DELAY);
1086
1087            }, GT_BRIDGE_DELAY);
1088
1089            return true;
1090        }
1091
1092        function hasPendingTextLayers() {
1093            var pending = false;
1094
1095            $('#viewer .textLayer').each(function() {
1096                if( this.hasAttribute(GT_PASS_ATTRIBUTE) ) return;
1097                if( !this.querySelector('.text') ) return;
1098                if( this.querySelector('font') ) return;
1099                if( !isTextLayerWithinViewport(this) ) return;
1100
1101                pending = true;
1102                return false;
1103            });
1104
1105            return pending;
1106        }
1107        
1108        function isTextLayerWithinViewport(layer) {
1109            var container = document.getElementById('viewerContainer')
1110              , containerRect
1111              , rect
1112            ;
1113
1114            if( !container ) return true;
1115
1116            containerRect = container.getBoundingClientRect();
1117            rect = layer.getBoundingClientRect();
1118
1119            return rect.bottom > containerRect.top && rect.top < containerRect.bottom;
1120        }
1121
1122        function markTextLayersAsPassed() {
1123            $('#viewer .textLayer').each(function() {
1124                this.setAttribute(GT_PASS_ATTRIBUTE, '1');
1125            });
1126        }
1127
1128        function scheduleAutoRetranslate() {
1129            // the page is showing the original - nothing to do
1130            if( !$html.is('.translated-ltr,.translated-rtl') ) return;
1131
1132            clearTimeout(autoRetranslateTimer);
1133
1134            autoRetranslateTimer = setTimeout(function() {
1135                var sinceLast = Date.now() - lastRetranslateAt;
1136
1137                // a pass is running - re-arm and let it finish first
1138                if( retranslateInProgress ) {
1139                    scheduleAutoRetranslate();
1140                    return;
1141                }
1142
1143                if( sinceLast < GT_RETRANSLATE_MIN_INTERVAL ) {
1144                    autoRetranslateTimer = setTimeout(scheduleAutoRetranslate, GT_RETRANSLATE_MIN_INTERVAL - sinceLast);
1145                    return;
1146                }
1147
1148                if( !hasPendingTextLayers() ) return;
1149
1150                forceRetranslateRenderedPages(markTextLayersAsPassed);
1151
1152            }, GT_RETRANSLATE_DEBOUNCE);
1153        }
1154
1155        GTForPDFDocsIsDisabled &&
1156            $html.addClass(KVO_GT_DISABLED_FOR_PDF_DOCS_CLASS_NAME);
1157
1158        // in case there is a PDF document on the page - translate it as well
1159        window.PDFViewerApplication && !GTForPDFDocsIsDisabled &&
1160            $(window)
1161            // this event is fired once the first pdf page data is loaded / fetched
1162            .on('kvo-pages-init'.namespace(eventNamespace), kvoDocumentLoadedHandler)
1163            .on('kvo-page-render'.namespace(eventNamespace), function(e, pdfjsOriginalEvent) {
1164                renderPageGraphicsCanvasLayer(pdfjsOriginalEvent.source, pdfjsOriginalEvent.pageNumber);
1165            })
1166            // a new text layer has just been rendered - it needs a GT pass
1167            .on('kvo-document-textlayer-rendered'.namespace(eventNamespace), scheduleAutoRetranslate)
1168            // covers the case where a layer was rendered before GT had put the
1169            // 'translated-*' class on <html> and the event above was swallowed
1170            .on('kvo-update-viewarea'.namespace(eventNamespace), Drupal.utils.throttle(scheduleAutoRetranslate, GT_VIEWAREA_THROTTLE));
1171
1172        // the same race, but on the very first load: catch the moment GT marks
1173        // the document as translated and run a single catch-up pass
1174        window.PDFViewerApplication && !GTForPDFDocsIsDisabled &&
1175            new MutationObserver(function(mutations, observer) {
1176                if( !$html.is('.translated-ltr,.translated-rtl') ) return;
1177
1178                observer.disconnect();
1179                scheduleAutoRetranslate();
1180            }).observe(document.documentElement, { attributes: true, attributeFilter: ['class'] });
1181
1182        // check to see if the Google Translate is enabled
1183        $.each(gtIsEnabledVia, function(method, _) {
1184            var param = gtIsEnabledVia[ method ]();
1185
1186            gtIsEnabled = !!(param && validateLangSourceTargetStringParam(param, method, config))
1187
1188            return !gtIsEnabled;
1188 // ← first found method (i.e. url or cookie) wins
1189        });
1190
1191        // We need to make sure that the source language of translation is always English.
1192        // So, we do not allow this method of enabling Google Translate
1193        // since the user may put something like #googtrans(zh-CN|es) in URL hash
1194        // meaning: please translate this page from Simplified Chinese to Spanish
1195        // and this will actually trigger Google Translate
1196        /*
1197        // ALLOW GT via URL
1198        if( gtIsEnabled && 'url' === config.enabledVia ) {
1199            window.location.hash = config.src = config.target = '';
1200        }
1201        */
1202
1203        if( '#googtrans-reset' === window.location.hash ) {
1204            history.replaceState(null, '', window.location.pathname + window.location.search);
1205            clearGoogtrans();
1206            window.location.reload();
1207            return;
1208        }
1209
1210        inlineStyleSheet( languageSwitcherStyles() );
1211
1212        // wait until Google Translate Widget is ready
1213        // and all the UI elements are rendered
1214        until(function() {
1215
1216            return !!(google.translate.TranslateElement &&
1217            ($gtLanguageMenuDropdown = $(`iframe.${ GT_IGNORE_CLASS_NAME }[title]`)).length &&
1218            ($gtLanguageMenuItems = $gtLanguageMenuDropdown.contents().find('table a')).length); 
1219
1220        }).fail(function() {
1221            console.log('It seems that GT has failed to start');
1222        }).done(function() {
1223
1224            var $languageSwitcher
1225              , $languageSwitcherButtonLabel
1226              , languageListHtml = languageSwitcherListItemHtml({label: 'Show Original', value: ''})
1227            ;
1228
1229            $gtLanguageMenuItems.each(function() {
1230                var languages = Drupal.settings.gtLanguages;
1231
1232                if( !this.value ) return;
1233
1234                if( 'en' === this.value ) {
1235                    gtBridgeNode = this;
1236                    return;
1237                }
1238
1239                if( !languages[this.value] ) return;
1240
1241                var $this = $(this)
1242                  , $label = $this.find('.text')
1243                ;
1244
1245                lngToNodeMap = lngToNodeMap || {};
1246                lngToNodeMap[ this.value ] = { node: this, label: $label.text(), value: this.value };
1247
1248
1249                languageListHtml += languageSwitcherListItemHtml( lngToNodeMap[ this.value ] );
1250            });
1251
1252            $languageSwitcher = $(languageSwitcherHtml(languageListHtml));
1253            $languageSwitcherButton = $languageSwitcher.find('.kvo-language-switcher-current-language');
1254            $languageSwitcherButtonLabel = $languageSwitcher.find('.current-language-label');
1255            $languageSwitcherLanguageMenuItems = $languageSwitcher.find('[role="menuitem"]');
1256
1257            setCurrentLanguage(config.target);
1258
1259            $languageSwitcher.on('click', 'li a', function(e) {
1260
1261                e.preventDefault();
1262
1263                var $this = $(this)
1264                  , nextLang = $this.attr('data-lang')
1265                  , prevLang = config.target
1266                  , nextLangData
1267                ;
1268
1269                // hide the menu on menu item click
1270                showLanguageMenu(false);
1271
1272                if( nextLang === prevLang ) return;
1273
1274                nextLangData = lngToNodeMap[ nextLang ];
1275
1276                $languageSwitcherLanguageMenuItems.filter('[aria-current]').removeAttr('aria-current');
1277
1278                // 'Show Original' - there is no language node behind it
1279                if( !nextLangData ) {
1280                    resetTranslation();
1281                    return;
1282                }
1283
1284                $this.attr('aria-current', 'true');
1285
1286                nextLangData.node.click();
1287
1288                setCurrentLanguage(nextLang);
1289                config.target = nextLang;
1290
1291                // a real language change is a full GT pass on its own
1292                lastRetranslateAt = Date.now();
1293                markTextLayersAsPassed();
1294
1295            }).on('click', '.kvo-language-switcher-current-language', function(e) {
1296                e.preventDefault();
1297                showLanguageMenu('true' !== $languageSwitcherButton.attr('aria-expanded'));
1298            }).on('keydown', '[role="menuitem"]', function(e) {
1299                var $this = $(this)
1300                  , key = e.keyCode || e.which
1301                  , isUp = 38 === key
1302                  , isDown = 40 === key
1303                  , $next
1304                  , $visible
1305                ;
1306
1307                if ( !(isUp || isDown) ) return;
1308
1309                $next = $this.closest('li')[ isUp ? 'prev' : 'next' ](':visible').find('a');
1310
1311                if( !$next.length ) {
1312                    $visible = $languageSwitcherLanguageMenuItems.filter(':visible');
1313                    $next = $visible.eq( isUp ? $visible.length - 1  : 0 );
1314                }
1315
1316                $next.focus();
1317
1318            }).on('keyup', '.kvo-language-switcher-current-language, [role="menuitem"]', function(e) {
1319                var $this = $(this)
1320                  , isMenuItem = $this.is('[role="menuitem"]')
1321                  , key = e.keyCode || e.which
1322                  , isExpanded = 'true' === $languageSwitcherButton.attr('aria-expanded')
1323                ;
1324
1325                if( !(isExpanded && 27 /* Escape */ === key) ) return;
1326
1327                $languageSwitcherButton.click();
1328
1329                isMenuItem &&
1330                    $languageSwitcherButton.focus();
1331
1332            }).appendTo('body');
1333
1334            window.PDFViewerApplication && !GTForPDFDocsIsDisabled &&
1335                scheduleAutoRetranslate();
1336
1337            function showLanguageMenu(show) {
1338                $languageSwitcherButton.attr('aria-expanded', show ? 'true' : 'false');
1339            }
1340
1341            function setCurrentLanguage(lang) {
1342                var langData = lngToNodeMap && lngToNodeMap[ lang ];
1343                $languageSwitcherButtonLabel.text( langData ? langData.label : 'English' );
1344            }
1345
1346        });
1347    };
1348}, [jQuery]);;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.