1/*! 2 * jQuery Once v2.2.3 - http://github.com/robloach/jquery-once 3 * @license MIT, GPL-2.0 4 * http://opensource.org/licenses/MIT 5 * http://opensource.org/licenses/GPL-2.0 6 */ 7(function(e){"use strict";if(typeof exports==="object"&&typeof exports.nodeName!=="string"){e(require("jquery"))}else if(typeof define==="function"&&define.amd){define(["jquery"],e)}else{e(jQuery)}})(function(t){"use strict";var r=function(e){e=e||"once";if(typeof e!=="string"){throw new TypeError("The jQuery Once id parameter must be a string")}return e};t.fn.once=function(e){var n="jquery-once-"+r(e);return this.filter(function(){return t(this).data(n)!==true}).data(n,true)};t.fn.removeOnce=function(e){return this.findOnce(e).removeData("jquery-once-"+r(e))};t.fn.findOnce=function(e){var n="jquery-once-"+r(e);return this.filter(function(){return t(this).data(n)===true})}}); 8 9/*! jQuery UI - v1.12.1 - 2017-03-31 10* http://jqueryui.com 11* Copyright jQuery Foundation and other contributors; Licensed */ 12!function(a){"function"==typeof define&&define.amd?define(["jquery","./version"],a):a(jQuery)}(function(a){return a.extend(a.expr[":"],{data:a.expr.createPseudo?a.expr.createPseudo(function(b){return function(c){return!!a.data(c,b)}}):function(b,c,d){return!!a.data(b,d[3])}})});; 13/*! jQuery UI - v1.12.1 - 2017-03-31 14* http://jqueryui.com 15* Copyright jQuery Foundation and other contributors; Licensed */ 16!function(a){"function"==typeof define&&define.amd?define(["jquery","./version"],a):a(jQuery)}(function(a){return a.fn.extend({disableSelection:function(){var a="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.on(a+".ui-disableSelection",function(a){a.preventDefault()})}}(),enableSelection:function(){return this.off(".ui-disableSelection")}})});; 17/*! jQuery UI - v1.12.1 - 2017-03-31 18* http://jqueryui.com 19* Copyright jQuery Foundation and other contributors; Licensed */ 20!function(a){"function"==typeof define&&define.amd?define(["jquery","./version"],a):a(jQuery)}(function(a){return a.fn.form=function(){return"string"==typeof this[0].form?this.closest("form"):a(this[0].form)}});; 21/*! jQuery UI - v1.12.1 - 2017-03-31 22* http://jqueryui.com 23* Copyright jQuery Foundation and other contributors; Licensed */ 24!function(a){"function"==typeof define&&define.amd?define(["jquery","./version","./escape-selector"],a):a(jQuery)}(function(a){return a.fn.labels=function(){var b,c,d,e,f;return this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(e=this.eq(0).parents("label"),d=this.attr("id"),d&&(b=this.eq(0).parents().last(),f=b.add(b.length?b.siblings():this.siblings()),c="label[for='"+a.ui.escapeSelector(d)+"']",e=e.add(f.find(c).addBack(c))),this.pushStack(e))}});; 25/*! jQuery UI - v1.12.1 - 2017-03-31 26* http://jqueryui.com 27* Copyright jQuery Foundation and other contributors; Licensed */ 28!function(a){"function"==typeof define&&define.amd?define(["jquery","./version"],a):a(jQuery)}(function(a){"1.7"===a.fn.jquery.substring(0,3)&&(a.each(["Width","Height"],function(b,c){function d(b,c,d,f){return a.each(e,function(){c-=parseFloat(a.css(b,"padding"+this))||0,d&&(c-=parseFloat(a.css(b,"border"+this+"Width"))||0),f&&(c-=parseFloat(a.css(b,"margin"+this))||0)}),c}var e="Width"===c?["Left","Right"]:["Top","Bottom"],f=c.toLowerCase(),g={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};a.fn["inner"+c]=function(b){return void 0===b?g["inner"+c].call(this):this.each(function(){a(this).css(f,d(this,b)+"px")})},a.fn["outer"+c]=function(b,e){return"number"!=typeof b?g["outer"+c].call(this,b):this.each(function(){a(this).css(f,d(this,b,!0,e)+"px")})}}),a.fn.addBack=function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))})});; 29/*! jQuery UI - v1.12.1 - 2017-03-31 30* http://jqueryui.com 31* Copyright jQuery Foundation and other contributors; Licensed */ 32!function(a){"function"==typeof define&&define.amd?define(["jquery","./version"],a):a(jQuery)}(function(a){return a.fn.scrollParent=function(b){var c=this.css("position"),d="absolute"===c,e=b?/(auto|scroll|hidden)/:/(auto|scroll)/,f=this.parents().filter(function(){var b=a(this);return(!d||"static"!==b.css("position"))&&e.test(b.css("overflow")+b.css("overflow-y")+b.css("overflow-x"))}).eq(0);return"fixed"!==c&&f.length?f:a(this[0].ownerDocument||document)}});; 33/*! jQuery UI - v1.12.1 - 2017-03-31 34* http://jqueryui.com 35* Copyright jQuery Foundation and other contributors; Licensed */ 36!function(a){"function"==typeof define&&define.amd?define(["jquery","./version","./focusable"],a):a(jQuery)}(function(a){return a.extend(a.expr[":"],{tabbable:function(b){var c=a.attr(b,"tabindex"),d=null!=c;return(!d||c>=0)&&a.ui.focusable(b,d)}})});;
vendor: 5,292 bytes, lines 37-72
37/*! jQuery UI - v1.12.1 - 2017-03-31 38* http://jqueryui.com 39* Copyright jQuery Foundation and other contributors; Licensed */ 40!function(a){"function"==typeof define&&define.amd?define(["jquery","./version"],a):a(jQuery)}(function(a){return a.fn.extend({uniqueId:function(){var a=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++a)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&a(this).removeAttr("id")})}})});; 41/*! jQuery UI - v1.12.1 - 2017-03-31 42* http://jqueryui.com 43* Copyright jQuery Foundation and other contributors; Licensed */ 44!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){return a.ui=a.ui||{},a.ui.version="1.12.1"});; 45/*! jQuery UI - v1.12.1 - 2017-03-31 46* http://jqueryui.com 47* Copyright jQuery Foundation and other contributors; Licensed */ 48!function(a){"function"==typeof define&&define.amd?define(["jquery","./version"],a):a(jQuery)}(function(a){return a.ui.escapeSelector=function(){var a=/([!"#$%&'()*+,.\/:;<=>?@[\]^`{|}~])/g;return function(b){return b.replace(a,"\\$1")}}()});; 49/*! jQuery UI - v1.12.1 - 2017-03-31 50* http://jqueryui.com 51* Copyright jQuery Foundation and other contributors; Licensed */ 52!function(a){"function"==typeof define&&define.amd?define(["jquery","./version"],a):a(jQuery)}(function(a){function b(a){for(var b=a.css("visibility");"inherit"===b;)a=a.parent(),b=a.css("visibility");return"hidden"!==b}return a.ui.focusable=function(c,d){var e,f,g,h,i,j=c.nodeName.toLowerCase();return"area"===j?(e=c.parentNode,f=e.name,!(!c.href||!f||"map"!==e.nodeName.toLowerCase())&&(g=a("img[usemap='#"+f+"']"),g.length>0&&g.is(":visible"))):(/^(input|select|textarea|button|object)$/.test(j)?(h=!c.disabled,h&&(i=a(c).closest("fieldset")[0],i&&(h=!i.disabled))):h="a"===j?c.href||d:d,h&&a(c).is(":visible")&&b(a(c)))},a.extend(a.expr[":"],{focusable:function(b){return a.ui.focusable(b,null!=a.attr(b,"tabindex"))}}),a.ui.focusable});; 53/*! jQuery UI - v1.12.1 - 2017-03-31 54* http://jqueryui.com 55* Copyright jQuery Foundation and other contributors; Licensed */ 56!function(a){"function"==typeof define&&define.amd?define(["jquery","./version"],a):a(jQuery)}(function(a){return a.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}});; 57/*! jQuery UI - v1.12.1 - 2017-03-31 58* http://jqueryui.com 59* Copyright jQuery Foundation and other contributors; Licensed */ 60!function(a){"function"==typeof define&&define.amd?define(["jquery","./version"],a):a(jQuery)}(function(a){return a.ui.plugin={add:function(b,c,d){var e,f=a.ui[b].prototype;for(e in d)f.plugins[e]=f.plugins[e]||[],f.plugins[e].push([c,d[e]])},call:function(a,b,c,d){var e,f=a.plugins[b];if(f&&(d||a.element[0].parentNode&&11!==a.element[0].parentNode.nodeType))for(e=0;e<f.length;e++)a.options[f[e][0]]&&f[e][1].apply(a.element,c)}}});; 61/*! jQuery UI - v1.12.1 - 2017-03-31 62* http://jqueryui.com 63* Copyright jQuery Foundation and other contributors; Licensed */ 64!function(a){"function"==typeof define&&define.amd?define(["jquery","./version"],a):a(jQuery)}(function(a){return a.ui.safeActiveElement=function(a){var b;try{b=a.activeElement}catch(c){b=a.body}return b||(b=a.body),b.nodeName||(b=a.body),b}});; 65/*! jQuery UI - v1.12.1 - 2017-03-31 66* http://jqueryui.com 67* Copyright jQuery Foundation and other contributors; Licensed */ 68!function(a){"function"==typeof define&&define.amd?define(["jquery","./version"],a):a(jQuery)}(function(a){return a.ui.safeBlur=function(b){b&&"body"!==b.nodeName.toLowerCase()&&a(b).trigger("blur")}});; 69/*! jQuery UI - v1.12.1 - 2017-03-31 70* http://jqueryui.com 71* Copyright jQuery Foundation and other contributors; Licensed */ 72!function(a){"function"==typeof define&&define.amd?define(["jquery","./version"],a):a(jQuery)}(function(a){var b=0,c=Array.prototype.slice;return a.cleanData=function(b){return function(c){var d,e,f;for(f=0;null!=(e=c[f]);f++)try{d=a._data(e,"events"),d&&d.remove&&a(e).triggerHandler("remove")}catch(g){}b(c)}}(a.cleanData),a.widget=function(b,c,d){var e,f,g,h={},i=b.split(".")[0];b=b.split(".")[1];var j=i+"-"+b;return d||(d=c,c=a.Widget),a.isArray(d)&&(d=a.extend.apply(null,[{}].concat(d))),a.expr[":"][j.toLowerCase()]=function(b){return!!a.data(b,j)},a[i]=a[i]||{},e=a[i][b],f=a[i][b]=function(a,b){return this._createWidget?void(arguments.length&&this._createWidget(a,b)):new f(a,b)},a.extend(f,e,{version:d.version,_proto:a.extend({},d),_childConstructors:[]}),g=new c,g.options=a.widget.extend({},g.options),a.each(d,function(b,d){return a.isFunction(d)?void(h[b]=function(){function a(){return c.prototype[b].apply(this,arguments)}function e(a){return c.prototype[b].apply(this,a)}return function(){var b,c=this._super,f=this._superApply;return this._super=a,this._superApply=e,b=d.apply(this,arguments),this._super=c,this._superApply=f,b}}()):void(h[b]=d)}),f.prototype=a.widget.extend(g,{widgetEventPrefix:e?g.widgetEventPrefix||b:b},h,{constructor:f,namespace:i,widgetName:b,widgetFullName:j}),e?(a.each(e._childConstructors,function(b,c){var d=c.prototype;a.widget(d.namespace+"."+d.widgetName,f,c._proto)}),delete e._childConstructors):c._childConstructors.push(f),a.widget.bridge(b,f),f}
vendor: 9,338 bytes, lines 72-192
72,a.widget.extend=function(b){for(var d,e,f=c.call(arguments,1),g=0,h=f.length;g<h;g++)for(d in f[g])e=f[g][d],f[g].hasOwnProperty(d)&&void 0!==e&&(a.isPlainObject(e)?b[d]=a.isPlainObject(b[d])?a.widget.extend({},b[d],e):a.widget.extend({},e):b[d]=e);return b},a.widget.bridge=function(b,d){var e=d.prototype.widgetFullName||b;a.fn[b]=function(f){var g="string"==typeof f,h=c.call(arguments,1),i=this;return g?this.length||"instance"!==f?this.each(function(){var c,d=a.data(this,e);return"instance"===f?(i=d,!1):d?a.isFunction(d[f])&&"_"!==f.charAt(0)?(c=d[f].apply(d,h),c!==d&&void 0!==c?(i=c&&c.jquery?i.pushStack(c.get()):c,!1):void 0):a.error("no such method '"+f+"' for "+b+" widget instance"):a.error("cannot call methods on "+b+" prior to initialization; attempted to call method '"+f+"'")}):i=void 0:(h.length&&(f=a.widget.extend.apply(null,[f].concat(h))),this.each(function(){var b=a.data(this,e);b?(b.option(f||{}),b._init&&b._init()):a.data(this,e,new d(f,this))})),i}},a.Widget=function(){},a.Widget._childConstructors=[],a.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:!1,create:null},_createWidget:function(c,d){d=a(d||this.defaultElement||this)[0],this.element=a(d),this.uuid=b++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=a(),this.hoverable=a(),this.focusable=a(),this.classesElementLookup={},d!==this&&(a.data(d,this.widgetFullName,this),this._on(!0,this.element,{remove:function(a){a.target===d&&this.destroy()}}),this.document=a(d.style?d.ownerDocument:d.document||d),this.window=a(this.document[0].defaultView||this.document[0].parentWindow)),this.options=a.widget.extend({},this.options,this._getCreateOptions(),c),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:a.noop,_create:a.noop,_init:a.noop,destroy:function(){var b=this;this._destroy(),a.each(this.classesElementLookup,function(a,c){b._removeClass(c,a)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:a.noop,widget:function(){return this.element},option:function(b,c){var d,e,f,g=b;if(0===arguments.length)return a.widget.extend({},this.options);if("string"==typeof b)if(g={},d=b.split("."),b=d.shift(),d.length){for(e=g[b]=a.widget.extend({},this.options[b]),f=0;f<d.length-1;f++)e[d[f]]=e[d[f]]||{},e=e[d[f]];if(b=d.pop(),1===arguments.length)return void 0===e[b]?null:e[b];e[b]=c}else{if(1===arguments.length)return void 0===this.options[b]?null:this.options[b];g[b]=c}return this._setOptions(g),this},_setOptions:function(a){var b;for(b in a)this._setOption(b,a[b]);return this},_setOption:function(a,b){return"classes"===a&&this._setOptionClasses(b),this.options[a]=b,"disabled"===a&&this._setOptionDisabled(b),this},_setOptionClasses:function(b){var c,d,e;for(c in b)e=this.classesElementLookup[c],b[c]!==this.options.classes[c]&&e&&e.length&&(d=a(e.get()),this._removeClass(e,c),d.addClass(this._classes({element:d,keys:c,classes:b,add:!0})))},_setOptionDisabled:function(a){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!a),a&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(b){function c(c,f){var g,h;for(h=0;h<c.length;h++)g=e.classesElementLookup[c[h]]||a(),g=a(b.add?a.unique(g.get().concat(b.element.get())):g.not(b.element).get()),e.classesElementLookup[c[h]]=g,d.push(c[h]),f&&b.classes[c[h]]&&d.push(b.classes[c[h]])}var d=[],e=this;return b=a.extend({element:this.element,classes:this.options.classes||{}},b),this._on(b.element,{remove:"_untrackClassesElement"}),b.keys&&c(b.keys.match(/\S+/g)||[],!0),b.extra&&c(b.extra.match(/\S+/g)||[]),d.join(" ")},_untrackClassesElement:function(b){var c=this;a.each(c.classesElementLookup,function(d,e){a.inArray(b.target,e)!==-1&&(c.classesElementLookup[d]=a(e.not(b.target).get()))})},_removeClass:function(a,b,c){return this._toggleClass(a,b,c,!1)},_addClass:function(a,b,c){return this._toggleClass(a,b,c,!0)},_toggleClass:function(a,b,c,d){d="boolean"==typeof d?d:c;var e="string"==typeof a||null===a,f={extra:e?b:c,keys:e?a:b,element:e?this.element:a,add:d};return f.element.toggleClass(this._classes(f),d),this},_on:function(b,c,d){var e,f=this;"boolean"!=typeof b&&(d=c,c=b,b=!1),d?(c=e=a(c),this.bindings=this.bindings.add(c)):(d=c,c=this.element,e=this.widget()),a.each(d,function(d,g){function h(){if(b||f.options.disabled!==!0&&!a(this).hasClass("ui-state-disabled"))return("string"==typeof g?f[g]:g).apply(f,arguments)}"string"!=typeof g&&(h.guid=g.guid=g.guid||h.guid||a.guid++);var i=d.match(/^([\w:-]*)\s*(.*)$/),j=i[1]+f.eventNamespace,k=i[2];k?e.on(j,k,h):c.on(j,h)})},_off:function(b,c){c=(c||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,b.off(c).off(c),this.bindings=a(this.bindings.not(b).get()),this.focusable=a(this.focusable.not(b).get()),this.hoverable=a(this.hoverable.not(b).get())},_delay:function(a,b){function c(){return("string"==typeof a?d[a]:a).apply(d,arguments)}var d=this;return setTimeout(c,b||0)},_hoverable:function(b){this.hoverable=this.hoverable.add(b),this._on(b,{mouseenter:function(b){this._addClass(a(b.currentTarget),null,"ui-state-hover")},mouseleave:function(b){this._removeClass(a(b.currentTarget),null,"ui-state-hover")}})},_focusable:function(b){this.focusable=this.focusable.add(b),this._on(b,{focusin:function(b){this._addClass(a(b.currentTarget),null,"ui-state-focus")},focusout:function(b){this._removeClass(a(b.currentTarget),null,"ui-state-focus")}})},_trigger:function(b,c,d){var e,f,g=this.options[b];if(d=d||{},c=a.Event(c),c.type=(b===this.widgetEventPrefix?b:this.widgetEventPrefix+b).toLowerCase(),c.target=this.element[0],f=c.originalEvent)for(e in f)e in c||(c[e]=f[e]);return this.element.trigger(c,d),!(a.isFunction(g)&&g.apply(this.element[0],[c].concat(d))===!1||c.isDefaultPrevented())}},a.each({show:"fadeIn",hide:"fadeOut"},function(b,c){a.Widget.prototype["_"+b]=function(d,e,f){"string"==typeof e&&(e={effect:e});var g,h=e?e===!0||"number"==typeof e?c:e.effect||c:b;e=e||{},"number"==typeof e&&(e={duration:e}),g=!a.isEmptyObject(e),e.complete=f,e.delay&&d.delay(e.delay),g&&a.effects&&a.effects.effect[h]?d[b](e):h!==b&&d[h]?d[h](e.duration,e.easing,f):d.queue(function(c){a(this)[b](),f&&f.call(d[0]),c()})}}),a.widget});; 73let consentController; 74 75const Consent = class Consent { 76 userConsent; 77 78 dataLayerPolicies = { 79 measurement_cookies: "analytics_storage", 80 targeting_cookies: "ad_storage", 81 experience_cookies: "personalization_storage", 82 }; 83 84 constructor(consent) { 85 consentController = this; 86 consentController.userConsent = consent ?? []; 87 88 89 } 90 91 refreshGTMConsent(isConsentUpdate) { 92 consentController.pushDataLayerEvent( 93 consentController.gatherGTMConsent(), 94 isConsentUpdate 95 ); 96 } 97 98 pushDataLayerEvent(consent, isConsentUpdate) { 99 const dataLayer = window.top.dataLayer || []; 100 101 if (isConsentUpdate) { 102 consent.event = "consent.update"; 103 dataLayer.push(consent); 104 } 105 106 //console.log("CONSENTS: ", consent); 107 108 window.top.dataLayer = dataLayer; 109 } 110 111 gatherGTMConsent() { 112 let dataLayerConsent = {}; 113 114 for (const policyName in consentController.dataLayerPolicies) { 115 dataLayerConsent[ 116 consentController.dataLayerPolicies[policyName] 117 ] = policyName in consentController.userConsent && 118 consentController.userConsent[policyName] 119 ? "granted" 120 : "denied"; 121 } 122 //console.log(dataLayerConsent); 123 return dataLayerConsent; 124 } 125}; 126; 127let cookieController; 128 129const Cookies = class Cookies { 130 consentCookie; 131 132 constructor() { 133 cookieController = this; 134 } 135 136 /** 137 * Extracts and sets the ppgm cookie or an empty string to `this.consentCookie`. 138 */ 139 refreshCurrentConsent() { 140 cookieController.consentCookie = cookieController.extractConsentCookie(); 141 } 142 143 extractConsentCookie() { 144 const foundCookie = 145 cookieController.extractAllCookies().trust_ppgm_consent ?? {}; 146 147 if (!foundCookie.length) { 148 return foundCookie; 149 } 150 151 let parsedCookies; 152 153 try { 154 parsedCookies = JSON.parse(foundCookie); 155 } catch (error) { 156 if (error instanceof SyntaxError) { 157 parsedCookies = JSON.parse(unescape(foundCookie)); 158 } 159 } 160 161 return parsedCookies ?? {}; 162 } 163 164 extractAllCookies() { 165 return document.cookie.split(";").reduce((cookies, cookie) => { 166 const [name, value] = cookie.split("=").map((c) => c.trim()); 167 cookies[name] = value; 168 return cookies; 169 }, {}); 170 } 171}; 172; 173window.addEventListener("load", () => { 174 175 window.cookieCtrl = new Cookies; 176 cookieCtrl.refreshCurrentConsent(); 177 178 window.consentCtrl = new Consent( 179 cookieCtrl.consentCookie 180 ); 181 182 // This is the initial script checking gtm consent, we are creating consent. 183 consentCtrl.refreshGTMConsent(false); 184}, false); 185; 186let modalController; 187 188const Modal = class Modal { 189 190 191 instance = null; 192 cookiesAccepted = false;
193 194 consents = null; 195 196 allPolicies = this.getFromPPGMData('policy_popup_data'); 197 generalData = this.getFromPPGMData('general_popup_data'); 198 199 requiredPolicies = [ 'privacy', 'terms_of_use', 'technical_cookies' ]; 200 201 cookieCtrl; 202 consentCtrl; 203 204 popup; 205 modal; 206 207 constructor(windowVariableName) { 208 modalController = this; 209 this.modal = windowVariableName; 210 } 211 212 static getInstance(windowVariableName = ''){ 213 214 if(!this.instance) 215 this.instance = new Modal(windowVariableName) 216 217 return this.instance 218 } 219 220 init() { 221 window.addEventListener('load', this.onLoad, false); 222 } 223 224 run() { 225 //console.log(modalController.userAction().myJson) 226 modalController.necessaryCookiesAccepted(); 227 modalController.buildPopupOnPage(); 228 modalController.addResizeListener(); 229 } 230 231 onLoad() { 232 if (!modalController.necessaryCookiesAccepted()) { 233 modalController.updateCounter('none', 'none') 234 modalController.buildPopupOnPage(); 235 modalController.addResizeListener(); 236 } 237 } 238 239 necessaryCookiesAccepted() { 240 modalController.cookieCtrl = window.cookieCtrl instanceof Cookies ? window.cookieCtrl : new Cookies(); 241 242 if (!modalController.cookieCtrl.consentCookie) { 243 modalController.cookieCtrl.refreshCurrentConsent(); 244 } 245 246 modalController.consents = modalController.cookieCtrl.consentCookie; 247 248 return modalController.mandatoryConsentGiven(); 249 } 250 251 mandatoryConsentGiven() { 252 let result = true; 253 254 modalController.requiredPolicies.map((policyName) => { 255 if (!modalController.consents[policyName]) { 256 result = false;
257 } 258 }); 259 260 return result; 261 } 262 263 getFromPPGMData(sector) { 264 console.log(drupalSettings) 265 return drupalSettings.trust_ppgm[sector]; 266 } 267 268 buildPopupOnPage() { 269 270 modalController.popup = document.createElement('div'); 271 modalController.popup.id = 'modalControllerContainer'; 272 modalController.popup.innerHTML = modalController.loadPopupContent(); 273 document.querySelector('body').appendChild(modalController.popup); 274 new bootstrap.Modal(document.querySelector('#modalController'), { 275 keyboard: false, 276 backdrop: 'static' 277 }).toggle() 278 279 } 280 281 loadPopupContent() { 282 const mainPopupContent = modalController.generalData; 283 const policyCheckboxes = modalController.buildPolicyLayout(); 284 285 const objectRef = 'window.' + modalController.modal; 286 287 return ` 288 <div 289 class="modal fade" 290 id="modalController" 291 tabindex="-1" 292 aria-labelledby="modalControllerLabel" 293 aria-hidden="true" 294 data-keyboard="false" 295 data-backdrop="static" 296 > 297 <div class="modal-dialog"> 298 <div class="modal-content"> 299 <div class="modal-body"> 300 <h5 class="modal-title" id="modalControllerLabel"> 301 ${mainPopupContent.popup_label} 302 </h5> 303 ${mainPopupContent.popup_text} 304 <a onclick="location.href='${modalController.generalData.policy_form_url}'" class="btn-link"> 305 ${mainPopupContent.popup_link_label} 306 </a> 307 308 ${policyCheckboxes} 309 </div> 310 <div class="modal-footer" id="actionBtns"> 311 <button 312 type="button" 313 class="btn btn-success" 314 data-bs-dismiss="modal" 315 onclick="${objectRef}.actOnAllPolicyConsents(false)" 316 > 317 Accept technical cookies 318 319 </button> 320 <button 321 type="button" 322 class="btn" 323 id="managePreferencesBtn" 324 onclick="${objectRef}.managePreferences()" 325 > 326 Manage preferences 327 </button> 328 <button 329 type="button" 330 data-bs-dismiss="modal" 331 class="btn btn-success" 332 onclick="${objectRef}.actOnAllPolicyConsents(true)" 333 > 334 Accept all cookies 335 336 </button> 337 </div> 338 </div> 339 </div> 340 </div> 341 `; 342 } 343 344 buildPolicyLayout() { 345 const requiredPolicyMarkup = modalController.buildRequiredPolicies(); 346 const optionalPolicyMarkup = modalController.buildOptionalPolicies(); 347 348 return ` 349 <div class="accordion" id="manageGDPRPreferences"> 350 ${requiredPolicyMarkup} 351 ${optionalPolicyMarkup} 352 </div> 353 `; 354 } 355 356 buildRequiredPolicies() { 357 const policyData = modalController.allPolicies['technical_cookies']; 358 //const label = 'Strictly Necessary'; 359 //const guid = label.split(' ').join(''); 360 361 // Set up the default accordion row builder function parameter 362 /*const policyData = { 363 // Appended as part of the accordion row id used for accordion manipulation 364 guid, 365 // Appended as the switch id of the strictly necessary cookies, used for consent verification 366 policy: guid.charAt(0).toLowerCase() + guid.slice(1), 367 // Disable the switches 368 mandatoryAttributes: 'checked disabled', 369 // Accordion row label 370 popup_label: label, 371 // Accordion container text 372 popup_text: 373 'These trackers are used for activities that are strictly necassary to operate or deliver the service you requested from us and, therefore, do not require you to consent.' 374 };*/ 375 376 377 // Return the accordion row markup. 378 return modalController.buildAccordionRow({ 379 ...policyData, 380 policy:'technical_cookies', 381 mandatoryAttributes: 'checked disabled' 382 }); 383 } 384 385 buildOptionalPolicies() { 386 let policyCheckboxes = ''; 387 388 for (const policy in modalController.allPolicies) { 389 if (!modalController.isPolicyRequired(policy)) { 390 const policyData = modalController.allPolicies[policy]; 391 policyCheckboxes += modalController.buildAccordionRow({ 392 ...policyData, 393 policy, 394 mandatoryAttributes: '' 395 }); 396 } 397 } 398 399 return policyCheckboxes; 400 } 401
402 isPolicyRequired(shortPolicyName) { 403 return modalController.requiredPolicies.includes(shortPolicyName); 404 } 405 406 buildAccordionRow(policyData) { 407 const guid = typeof policyData.guid === 'string' ? `'${policyData.guid}'` : policyData.guid; 408 409 if (!modalController.isPolicyRequired(policyData.policy) && modalController.consents[policyData.policy]) 410 policyData.mandatoryAttributes = 'checked'; 411 const tmp = guid.slice(1, -1); 412 413 414 return ` 415 <div class="accordion-item"> 416 <h5 class="accordion-header" id="heading${policyData.guid}"> 417 <button 418 class="accordion-button" 419 type="button" 420 onclick="window.${modalController.modal}.toggleAccordionRow(event, ${guid})" 421 aria-expanded="false" 422 aria-controls="collapse${policyData.guid}" 423 > 424 <section class="accordionLabelInput"> 425 <p class="h6">${policyData.popup_label}</p> 426 427 <div class="form-check form-switch"> 428 429 <input 430 class="form-check-input accordionInput" 431 type="checkbox" 432 id="${policyData.policy}" 433 ${policyData.mandatoryAttributes} 434 /> 435 436 </div> 437 </section> 438 </button> 439 </h5> 440 <div 441 id="collapse${policyData.guid}" 442 class="accordion-collapse collapse" 443 aria-labelledby="heading${policyData.guid}" 444 data-bs-parent="#manageGDPRPreferences" 445 > 446 <div class="accordion-body">${policyData.popup_text}</div> 447 </div> 448 </div> 449 `; 450 } 451 452 addResizeListener() { 453 setTimeout(() => modalController.setModalMargin(), 200); 454 455 window.addEventListener('resize', modalController.setModalMargin); 456 457 jQuery('.accordion-button').click(function() { 458 jQuery(this).toggleClass('actives'); 459 jQuery('.accordion-button').not(this).removeClass('actives'); 460 }); 461 462 463 } 464 465 setModalMargin() { 466 document.querySelector('div.modal-body').style.marginTop = 467 document.querySelector('h5#modalControllerLabel').clientHeight >= 50 ? '3rem' : 0; 468 } 469 470 managePreferences() { 471 const managePrefBtn = jQuery('#managePreferencesBtn'); 472 473 managePrefBtn.html(managePrefBtn.html().replace('Manage', 'Save')); 474 managePrefBtn.attr('onclick', `window.${modalController.modal}.savePreferences()`); 475 476 jQuery('#actionBtns').fadeIn(); 477 jQuery('#manageGDPRPreferences').fadeIn(); 478 } 479 480 savePreferences() { 481 let consents = {}; 482
483 const strictlyNecessaryCookiesCheckbox = modalController.getStrictlyNecessaryCookieCheckbox(); 484 485 for (const policy in modalController.allPolicies) { 486 const checkbox = !modalController.isPolicyRequired(policy) 487 ? document.getElementById(policy) 488 : strictlyNecessaryCookiesCheckbox; 489 let val = checkbox && checkbox.checked; 490 //remove null value in case of the checkbox are not shown 491 /*if (!val) { 492 val = false; 493 }*/ 494 consents[policy] = val; 495 } 496 497 modalController.consentCtrl = new Consent(consents); 498 modalController.consentCtrl.refreshGTMConsent(true); 499 500 this.updateCounter(true, true) 501 502 modalController.saveCookieAndReload(consents); 503 } 504 505 getStrictlyNecessaryCookieCheckbox() { 506 return document.querySelector('#strictlyNecessary'); 507 } 508 509 saveCookieAndReload(consents) { 510 511 for (const policy in modalController.allPolicies) { 512 513 consents[policy] = modalController.isPolicyRequired(policy) ? true : consents[policy]; 514 } 515 516 let expirationDate = new Date(); 517 518 expirationDate.setMonth(expirationDate.getMonth() + 6); 519 520 const domainName = window.location.hostname; 521 522 document.cookie = 523 'trust_ppgm_consent=' + 524 JSON.stringify(consents) + 525 '; path=/; expires=' + 526 expirationDate.toUTCString() + 527 '; domain=.'+domainName; 528 529 modalController.popup.style.display = 'none'; 530 document.querySelector('body').removeChild(modalController.popup); 531 jQuery('.modal-backdrop').remove(); 532 document.body.style.overflow = 'auto'; 533 //window.location.reload(); 534 } 535 536 actOnAllPolicyCheckboxes(stateToSet) {
537 const strictlyNecessaryCookies = modalController.getStrictlyNecessaryCookieCheckbox(); 538 539 for (const policy in modalController.allPolicies) { 540 let checkbox = modalController.isPolicyRequired(policy) 541 ? strictlyNecessaryCookies 542 : document.getElementById(policy); 543 544 //some checkbox could be null TODO put true also in checkbox that is not present 545 if (checkbox) { 546 if (checkbox.checked !== stateToSet) { 547 checkbox.checked = stateToSet; 548 } 549 } 550 } 551 } 552 553 actOnAllPolicyConsents(shouldAccept) { 554 modalController.actOnAllPolicyCheckboxes(shouldAccept); 555 556 this.updateCounter(shouldAccept, false) 557 558 setTimeout(() => { 559 let consents = {}; 560 561 for (const policy in modalController.allPolicies) { 562 consents[policy] = !shouldAccept ? modalController.isPolicyRequired(policy) : true; 563 } 564 565 modalController.consentCtrl = new Consent(consents); 566 modalController.consentCtrl.refreshGTMConsent(true); 567 568 modalController.saveCookieAndReload(consents); 569 }, 500) 570 } 571 572 /** 573 * This function toggles the collapsed accordion row if the element which was clicked has no id. 574 * The above allows us to maintain standard bootstrap behaviour 575 * whilst ignoring clicks on the checkboxes since they have ids. 576 * 577 * Pid (policy id) is numeric unless it's the strictly necessary cookies. 578 */ 579 toggleAccordionRow(e, pid) { 580 if (e.target.id == '') { 581 jQuery('#collapse' + pid).collapse('toggle'); 582 } 583 584 585 } 586 587 updateCounter(accept, custom) { 588 let data = { 589 "accept":accept, 590 "custom":custom 591 } 592 fetch('https://ppg-api.trust-itservices.dev/counter/' + this.getFromPPGMData('project_pk') + '/', 593 { 594 method: 'PUT', // *GET, POST, PUT, DELETE, etc. 595 mode: 'cors', // no-cors, *cors, same-origin 596 cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached 597 credentials: 'same-origin', // include, *same-origin, omit 598 headers: { 599 'Content-Type': 'application/json', 600 // 'Content-Type': 'application/x-www-form-urlencoded', 601 }, 602 body: JSON.stringify(data) 603 }) 604 .then(res => {}) 605 .catch(error => { 606 console.error('There has been a problem with your fetch operation:', error); 607 }) 608 } 609 610 611}; 612 613 614; 615const modalWindowName = "ppgmModal"; 616 617window[modalWindowName] = Modal.getInstance(modalWindowName); 618 619window[modalWindowName].init(); 620; 621/** 622 * @file 623 * CKEditor Accordion functionality. 624 */ 625 626(function ($, Drupal, drupalSettings) { 627 'use strict'; 628 Drupal.behaviors.ckeditorAccordion = { 629 attach: function (context, settings) { 630 631 // Create accordion functionality if the required elements exist is available. 632 var $ckeditorAccordion = $('.ckeditor-accordion'); 633 if ($ckeditorAccordion.length > 0) { 634 // Create simple accordion mechanism for each tab. 635 $ckeditorAccordion.each(function () { 636 var $accordion = $(this); 637 if ($accordion.hasClass('styled')) { 638 return; 639 } 640 641 // The first one is the correct one. 642 if (!drupalSettings.ckeditorAccordion.accordionStyle.collapseAll) { 643 $accordion.children('dt:first').addClass('active'); 644 $accordion.children('dd:first').addClass('active'); 645 $accordion.children('dd:first').css('display', 'block'); 646 } 647 648 // Turn the accordion tabs to links so that the content is accessible & can be traversed using keyboard. 649 $accordion.children('dt').each(function () { 650 var $tab = $(this); 651 var tabText = $tab.text().trim(); 652 var toggleClass = $tab.hasClass('active') ? ' active' : ''; 653 $tab.html('<a class="ckeditor-accordion-toggler" href="#"><span class="ckeditor-accordion-toggle' + toggleClass + '"></span>' + tabText + '</a>'); 654 }); 655 656 // Wrap the accordion in a div element so that quick edit function shows the source correctly. 657 $accordion.addClass('styled').removeClass('ckeditor-accordion').wrap('<div class="ckeditor-accordion-container"></div>'); 658 659 // Trigger an ckeditorAccordionAttached event to let other frameworks know that the accordion has been attached.
660 $accordion.trigger('ckeditorAccordionAttached'); 661 }); 662 663 // Add click event to body once because quick edits & ajax calls might reset the HTML. 664 $('body').once('ckeditorAccordionToggleEvent').on('click', '.ckeditor-accordion-toggler', function (e) { 665 var $t = $(this).parent(); 666 var $parent = $t.parent(); 667 668 // Clicking on open element, close it. 669 if ($t.hasClass('active')) { 670 $t.removeClass('active'); 671 $t.next().slideUp(); 672 } 673 else { 674 if(!drupalSettings.ckeditorAccordion.accordionStyle.keepRowsOpen) { 675 // Remove active classes. 676 $parent.children('dt.active').removeClass('active').children('a').removeClass('active'); 677 $parent.children('dd.active').slideUp(function () { 678 $(this).removeClass('active'); 679 }); 680 } 681 682 // Show the selected tab. 683 $t.addClass('active'); 684 $t.next().slideDown(300).addClass('active'); 685 } 686 687 // Don't add hash to url. 688 e.preventDefault(); 689 }); 690 } 691 } 692 }; 693})(jQuery, Drupal, drupalSettings); 694; 695/** 696* DO NOT EDIT THIS FILE. 697* See the following change record for more information, 698* https://www.drupal.org/node/2815083 699* @preserve 700**/ 701 702Drupal.debounce = function (func, wait, immediate) { 703 var timeout = void 0; 704 var result = void 0; 705 return function () { 706 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { 707 args[_key] = arguments[_key]; 708 } 709 710 var context = this; 711 var later = function later() { 712 timeout = null; 713 if (!immediate) { 714 result = func.apply(context, args); 715 } 716 }; 717 var callNow = immediate && !timeout; 718 clearTimeout(timeout); 719 timeout = setTimeout(later, wait); 720 if (callNow) { 721 result = func.apply(context, args); 722 } 723 return result; 724 }; 725};; 726/** 727* DO NOT EDIT THIS FILE. 728* See the following change record for more information, 729* https://www.drupal.org/node/2815083 730* @preserve 731**/ 732 733(function ($, Drupal, debounce) { 734 $.fn.drupalGetSummary = function () { 735 var callback = this.data('summaryCallback'); 736 return this[0] && callback ? $.trim(callback(this[0])) : ''; 737 }; 738 739 $.fn.drupalSetSummary = function (callback) { 740 var self = this; 741 742 if (typeof callback !== 'function') { 743 var val = callback; 744 callback = function callback() { 745 return val; 746 }; 747 } 748 749 return this.data('summaryCallback', callback).off('formUpdated.summary').on('formUpdated.summary', function () { 750 self.trigger('summaryUpdated'); 751 }).trigger('summaryUpdated'); 752 }; 753 754 Drupal.behaviors.formSingleSubmit = { 755 attach: function attach() { 756 function onFormSubmit(e) { 757 var $form = $(e.currentTarget); 758 var formValues = $form.serialize(); 759 var previousValues = $form.attr('data-drupal-form-submit-last'); 760 if (previousValues === formValues) { 761 e.preventDefault(); 762 } else { 763 $form.attr('data-drupal-form-submit-last', formValues); 764 } 765 } 766 767 $('body').once('form-single-submit').on('submit.singleSubmit', 'form:not([method~="GET"])', onFormSubmit); 768 } 769 }; 770 771 function triggerFormUpdated(element) { 772 $(element).trigger('formUpdated'); 773 } 774 775 function fieldsList(form) { 776 var $fieldList = $(form).find('[name]').map(function (index, element) { 777 return element.getAttribute('id'); 778 }); 779 780 return $.makeArray($fieldList); 781 } 782 783 Drupal.behaviors.formUpdated = { 784 attach: function attach(context) { 785 var $context = $(context); 786 var contextIsForm = $context.is('form'); 787 var $forms = (contextIsForm ? $context : $context.find('form')).once('form-updated'); 788 var formFields = void 0; 789 790 if ($forms.length) { 791 $.makeArray($forms).forEach(function (form) { 792 var events = 'change.formUpdated input.formUpdated '; 793 var eventHandler = debounce(function (event) { 794 triggerFormUpdated(event.target); 795 }, 300); 796 formFields = fieldsList(form).join(','); 797 798 form.setAttribute('data-drupal-form-fields', formFields); 799 $(form).on(events, eventHandler); 800 }); 801 } 802 803 if (contextIsForm) { 804 formFields = fieldsList(context).join(','); 805 806 var currentFields = $(context).attr('data-drupal-form-fields'); 807 808 if (formFields !== currentFields) { 809 triggerFormUpdated(context); 810 } 811 } 812 }, 813 detach: function detach(context, settings, trigger) { 814 var $context = $(context);
815 var contextIsForm = $context.is('form'); 816 if (trigger === 'unload') { 817 var $forms = (contextIsForm ? $context : $context.find('form')).removeOnce('form-updated'); 818 if ($forms.length) { 819 $.makeArray($forms).forEach(function (form) { 820 form.removeAttribute('data-drupal-form-fields'); 821 $(form).off('.formUpdated'); 822 }); 823 } 824 } 825 } 826 }; 827 828 Drupal.behaviors.fillUserInfoFromBrowser = { 829 attach: function attach(context, settings) { 830 var userInfo = ['name', 'mail', 'homepage']; 831 var $forms = $('[data-user-info-from-browser]').once('user-info-from-browser'); 832 if ($forms.length) { 833 userInfo.forEach(function (info) { 834 var $element = $forms.find('[name=' + info + ']'); 835 var browserData = localStorage.getItem('Drupal.visitor.' + info); 836 var emptyOrDefault = $element.val() === '' || $element.attr('data-drupal-default-value') === $element.val(); 837 if ($element.length && emptyOrDefault && browserData) { 838 $element.val(browserData); 839 } 840 }); 841 } 842 $forms.on('submit', function () { 843 userInfo.forEach(function (info) { 844 var $element = $forms.find('[name=' + info + ']'); 845 if ($element.length) { 846 localStorage.setItem('Drupal.visitor.' + info, $element.val()); 847 } 848 }); 849 }); 850 } 851 }; 852 853 var handleFragmentLinkClickOrHashChange = function handleFragmentLinkClickOrHashChange(e) { 854 var url = void 0; 855 if (e.type === 'click') { 856 url = e.currentTarget.location ? e.currentTarget.location : e.currentTarget; 857 } else { 858 url = window.location; 859 } 860 var hash = url.hash.substr(1); 861 if (hash) { 862 var $target = $('#' + hash); 863 $('body').trigger('formFragmentLinkClickOrHashChange', [$target]); 864 865 setTimeout(function () { 866 return $target.trigger('focus'); 867 }, 300); 868 } 869 }; 870 871 var debouncedHandleFragmentLinkClickOrHashChange = debounce(handleFragmentLinkClickOrHashChange, 300, true); 872 873 $(window).on('hashchange.form-fragment', debouncedHandleFragmentLinkClickOrHashChange); 874 875 $(document).on('click.form-fragment', 'a[href*="#"]', debouncedHandleFragmentLinkClickOrHashChange); 876})(jQuery, Drupal, Drupal.debounce);; 877/** 878 * @file 879 * Webform behaviors. 880 */ 881 882(function ($, Drupal) { 883 884 'use strict'; 885 886 // Trigger Drupal's attaching of behaviors after the page is 887 // completely loaded. 888 // @see https://stackoverflow.com/questions/37838430/detect-if-page-is-load-from-back-button 889 // @see https://stackoverflow.com/questions/20899274/how-to-refresh-page-on-back-button-click/20899422#20899422 890 var isChrome = (/chrom(e|ium)/.test(window.navigator.userAgent.toLowerCase())); 891 if (isChrome) { 892 // Track back button in navigation. 893 // @see https://stackoverflow.com/questions/37838430/detect-if-page-is-load-from-back-button 894 var backButton = false; 895 if (window.performance) { 896 var navEntries = window.performance.getEntriesByType('navigation'); 897 if (navEntries.length > 0 && navEntries[0].type === 'back_forward') { 898 backButton = true; 899 } 900 else if (window.performance.navigation 901 && window.performance.navigation.type === window.performance.navigation.TYPE_BACK_FORWARD) { 902 backButton = true; 903 } 904 } 905 906 // If the back button is pressed, delay Drupal's attaching of behaviors. 907 if (backButton) { 908 var attachBehaviors = Drupal.attachBehaviors; 909 Drupal.attachBehaviors = function (context, settings) { 910 setTimeout(function (context, settings) { 911 attachBehaviors(context, settings); 912 }, 300); 913 }; 914 } 915 } 916 917})(jQuery, Drupal); 918; 919/** 920* DO NOT EDIT THIS FILE. 921* See the following change record for more information, 922* https://www.drupal.org/node/2815083 923* @preserve 924**/ 925 926(function ($, Drupal) { 927 var states = { 928 postponed: [] 929 }; 930 931 Drupal.states = states; 932 933 function invert(a, invertState) { 934 return invertState && typeof a !== 'undefined' ? !a : a; 935 } 936 937 function _compare2(a, b) { 938 if (a === b) { 939 return typeof a === 'undefined' ? a : true; 940 } 941 942 return typeof a === 'undefined' || typeof b === 'undefined'; 943 } 944 945 function ternary(a, b) { 946 if (typeof a === 'undefined') { 947 return b; 948 } 949 if (typeof b === 'undefined') { 950 return a; 951 } 952 953 return a && b; 954 } 955 956 Drupal.behaviors.states = { 957 attach: function attach(context, settings) { 958 var $states = $(context).find('[data-drupal-states]'); 959 var il = $states.length; 960 961 var _loop = function _loop(i) { 962 var config = JSON.parse($states[i].getAttribute('data-drupal-states')); 963 Object.keys(config || {}
963).forEach(function (state) { 964 new states.Dependent({ 965 element: $($states[i]), 966 state: states.State.sanitize(state), 967 constraints: config[state] 968 }); 969 }); 970 }; 971 972 for (var i = 0; i < il; i++) { 973 _loop(i); 974 } 975 976 while (states.postponed.length) { 977 states.postponed.shift()(); 978 } 979 } 980 }; 981 982 states.Dependent = function (args) { 983 var _this = this; 984 985 $.extend(this, { values: {}, oldValue: null }, args); 986 987 this.dependees = this.getDependees(); 988 Object.keys(this.dependees || {}).forEach(function (selector) { 989 _this.initializeDependee(selector, _this.dependees[selector]); 990 }); 991 }; 992 993 states.Dependent.comparisons = { 994 RegExp: function RegExp(reference, value) { 995 return reference.test(value); 996 }, 997 Function: function Function(reference, value) { 998 return reference(value); 999 }, 1000 Number: function Number(reference, value) { 1001 return typeof value === 'string' ? _compare2(reference.toString(), value) : _compare2(reference, value); 1002 } 1003 }; 1004 1005 states.Dependent.prototype = { 1006 initializeDependee: function initializeDependee(selector, dependeeStates) { 1007 var _this2 = this; 1008 1009 this.values[selector] = {}; 1010 1011 Object.keys(dependeeStates).forEach(function (i) { 1012 var state = dependeeStates[i]; 1013 1014 if ($.inArray(state, dependeeStates) === -1) { 1015 return; 1016 } 1017 1018 state = states.State.sanitize(state); 1019 1020 _this2.values[selector][state.name] = null; 1021 1022 $(selector).on('state:' + state, { selector: selector, state: state }, function (e) { 1023 _this2.update(e.data.selector, e.data.state, e.value); 1024 }); 1025 1026 new states.Trigger({ selector: selector, state: state }); 1027 }); 1028 }, 1029 compare: function compare(reference, selector, state) { 1030 var value = this.values[selector][state.name]; 1031 if (reference.constructor.name in states.Dependent.comparisons) { 1032 return states.Dependent.comparisons[reference.constructor.name](reference, value); 1033 } 1034 1035 return _compare2(reference, value); 1036 }, 1037 update: function update(selector, state, value) { 1038 if (value !== this.values[selector][state.name]) { 1039 this.values[selector][state.name] = value; 1040 this.reevaluate(); 1041 } 1042 }, 1043 reevaluate: function reevaluate() { 1044 var value = this.verifyConstraints(this.constraints); 1045 1046 if (value !== this.oldValue) { 1047 this.oldValue = value; 1048 1049 value = invert(value, this.state.invert); 1050 1051 this.element.trigger({ 1052 type: 'state:' + this.state, 1053 value: value, 1054 trigger: true 1055 }); 1056 } 1057 }, 1058 verifyConstraints: function verifyConstraints(constraints, selector) { 1059 var result = void 0; 1060 if ($.isArray(constraints)) { 1061 var hasXor = $.inArray('xor', constraints) === -1; 1062 var len = constraints.length; 1063 for (var i = 0; i < len; i++) { 1064 if (constraints[i] !== 'xor') { 1065 var constraint = this.checkConstraints(constraints[i], selector, i); 1066 1067 if (constraint && (hasXor || result)) { 1068 return hasXor; 1069 } 1070 result = result || constraint; 1071 } 1072 } 1073 } else if ($.isPlainObject(constraints)) { 1074 for (var n in constraints) { 1075 if (constraints.hasOwnProperty(n)) { 1076 result = ternary(result, this.checkConstraints(constraints[n], selector, n)); 1077 1078 if (result === false) { 1079 return false; 1080 } 1081 } 1082 } 1083 } 1084 return result; 1085 }, 1086 checkConstraints: function checkConstraints(value, selector, state) { 1087 if (typeof state !== 'string' || /[0-9]/.test(state[0])) { 1088 state = null; 1089 } else if (typeof selector === 'undefined') { 1090 selector = state; 1091 state = null; 1092 } 1093 1094 if (state !== null) { 1095 state = states.State.sanitize(state); 1096 return invert(this.compare(value, selector, state), state.invert); 1097 } 1098 1099 return this.verifyConstraints(value, selector); 1100 }, 1101 getDependees: function getDependees() { 1102 var cache = {}; 1103 1104 var _compare = this.compare; 1105 this.compare = function (reference, selector, state) { 1106 (cache[selector] || (cache[selector] = [])).push(state.name); 1107 }; 1108 1109 this.verifyConstraints(this.constraints); 1110 1111 this.compare = _compare; 1112 1113 return cache; 1114 } 1115 }; 1116 1117 states.Trigger = function (args) { 1118 $.extend(this, args); 1119 1120 if (this.state in states.Trigger.states) { 1121 this.element = $(this.selector); 1122 1123 if (!this.element.data('trigger:' + this.state)) { 1124 this.initialize(); 1125 } 1126 } 1127 }; 1128 1129 states.Trigger.prototype = { 1130 initialize: function initialize() { 1131 var _this3 = this; 1132 1133 var trigger = states.Trigger.states[this.state]; 1134 1135 if (typeof trigger === 'function') { 1136 trigger.call(window, this.element); 1137 } else { 1138 Object.keys(trigger || {}
1138).forEach(function (event) { 1139 _this3.defaultTrigger(event, trigger[event]); 1140 }); 1141 } 1142 1143 this.element.data('trigger:' + this.state, true); 1144 }, 1145 defaultTrigger: function defaultTrigger(event, valueFn) { 1146 var oldValue = valueFn.call(this.element); 1147 1148 this.element.on(event, $.proxy(function (e) { 1149 var value = valueFn.call(this.element, e); 1150 1151 if (oldValue !== value) { 1152 this.element.trigger({ 1153 type: 'state:' + this.state, 1154 value: value, 1155 oldValue: oldValue 1156 }); 1157 oldValue = value; 1158 } 1159 }, this)); 1160 1161 states.postponed.push($.proxy(function () { 1162 this.element.trigger({ 1163 type: 'state:' + this.state, 1164 value: oldValue, 1165 oldValue: null 1166 }); 1167 }, this)); 1168 } 1169 }; 1170 1171 states.Trigger.states = { 1172 empty: { 1173 keyup: function keyup() { 1174 return this.val() === ''; 1175 } 1176 }, 1177 1178 checked: { 1179 change: function change() { 1180 var checked = false; 1181 this.each(function () { 1182 checked = $(this).prop('checked'); 1183 1184 return !checked; 1185 }); 1186 return checked; 1187 } 1188 }, 1189 1190 value: { 1191 keyup: function keyup() { 1192 if (this.length > 1) { 1193 return this.filter(':checked').val() || false; 1194 } 1195 return this.val(); 1196 }, 1197 change: function change() { 1198 if (this.length > 1) { 1199 return this.filter(':checked').val() || false; 1200 } 1201 return this.val(); 1202 } 1203 }, 1204 1205 collapsed: { 1206 collapsed: function collapsed(e) { 1207 return typeof e !== 'undefined' && 'value' in e ? e.value : !this.is('[open]'); 1208 } 1209 } 1210 }; 1211 1212 states.State = function (state) { 1213 this.pristine = state; 1214 this.name = state; 1215 1216 var process = true; 1217 do { 1218 while (this.name.charAt(0) === '!') { 1219 this.name = this.name.substring(1); 1220 this.invert = !this.invert; 1221 } 1222 1223 if (this.name in states.State.aliases) { 1224 this.name = states.State.aliases[this.name]; 1225 } else { 1226 process = false; 1227 } 1228 } while (process); 1229 }; 1230 1231 states.State.sanitize = function (state) { 1232 if (state instanceof states.State) { 1233 return state; 1234 } 1235 1236 return new states.State(state); 1237 }; 1238 1239 states.State.aliases = { 1240 enabled: '!disabled', 1241 invisible: '!visible', 1242 invalid: '!valid', 1243 untouched: '!touched', 1244 optional: '!required', 1245 filled: '!empty', 1246 unchecked: '!checked', 1247 irrelevant: '!relevant', 1248 expanded: '!collapsed', 1249 open: '!collapsed', 1250 closed: 'collapsed', 1251 readwrite: '!readonly' 1252 }; 1253 1254 states.State.prototype = { 1255 invert: false, 1256 1257 toString: function toString() { 1258 return this.name; 1259 } 1260 }; 1261 1262 var $document = $(document); 1263 $document.on('state:disabled', function (e) { 1264 if (e.trigger) { 1265 $(e.target).prop('disabled', e.value).closest('.js-form-item, .js-form-submit, .js-form-wrapper').toggleClass('form-disabled', e.value).find('select, input, textarea').prop('disabled', e.value); 1266 } 1267 }); 1268 1269 $document.on('state:required', function (e) { 1270 if (e.trigger) { 1271 if (e.value) { 1272 var label = 'label' + (e.target.id ? '[for=' + e.target.id + ']' : ''); 1273 var $label = $(e.target).attr({ required: 'required', 'aria-required': 'true' }).closest('.js-form-item, .js-form-wrapper').find(label); 1274 1275 if (!$label.hasClass('js-form-required').length) { 1276 $label.addClass('js-form-required form-required'); 1277 } 1278 } else { 1279 $(e.target).removeAttr('required aria-required').closest('.js-form-item, .js-form-wrapper').find('label.js-form-required').removeClass('js-form-required form-required'); 1280 } 1281 } 1282 }); 1283 1284 $document.on('state:visible', function (e) { 1285 if (e.trigger) { 1286 $(e.target).closest('.js-form-item, .js-form-submit, .js-form-wrapper').toggle(e.value); 1287 } 1288 }); 1289 1290 $document.on('state:checked', function (e) { 1291 if (e.trigger) { 1292 $(e.target).prop('checked', e.value); 1293 } 1294 }); 1295 1296 $document.on('state:collapsed', function (e) { 1297 if (e.trigger) { 1298 if ($(e.target).is('[open]') === e.value) { 1299 $(e.target).find('> summary').trigger('click'); 1300 } 1301 } 1302 }); 1303})(jQuery, Drupal);; 1304/** 1305 * @file 1306 * JavaScript behaviors for custom webform #states. 1307 */ 1308 1309(function ($, Drupal) { 1310 1311 'use strict'; 1312 1313 Drupal.webform = Drupal.webform || {}; 1314 Drupal.webform.states = Drupal.webform.states || {}; 1315 Drupal.webform.states.slideDown = Drupal.webform.states.slideDown || {}; 1316 Drupal.webform.states.slideDown.duration = 'slow'; 1317 Drupal.webform.states.slideUp = Drupal.webform.states.slideUp || {}; 1318 Drupal.webform.states.slideUp.duration = 'fast'; 1319 1320 /* ************************************************************************ */ 1321 // jQuery functions. 1322 /* ************************************************************************ */ 1323 1324 /** 1325 * Check if an element has a specified data attribute. 1326 * 1327 * @param {string} data 1328 * The data attribute name. 1329 * 1330 * @return {boolean} 1331 * TRUE if an element has a specified data attribute. 1332 */ 1333 $.fn.hasData = function (data) { 1334 return (typeof this.data(data) !== 'undefined'); 1335 }; 1336 1337 /**
1338 * Check if element is within the webform or not. 1339 * 1340 * @return {boolean} 1341 * TRUE if element is within the webform. 1342 */ 1343 $.fn.isWebform = function () { 1344 return $(this).closest('form[id^="webform"], form[data-is-webform]').length ? true : false; 1345 }; 1346 1347 /** 1348 * Check if element is to be treated as a webform element. 1349 * 1350 * @return {boolean} 1351 * TRUE if element is to be treated as a webform element. 1352 */ 1353 $.fn.isWebformElement = function () { 1354 return ($(this).isWebform() || $(this).closest('[data-is-webform-element]').length) ? true : false; 1355 }; 1356 1357 /* ************************************************************************ */ 1358 // Trigger. 1359 /* ************************************************************************ */ 1360 1361 // The change event is triggered by cut-n-paste and select menus. 1362 // Issue #2445271: #states element empty check not triggered on mouse 1363 // based paste. 1364 // @see https://www.drupal.org/node/2445271 1365 Drupal.states.Trigger.states.empty.change = function change() { 1366 return this.val() === ''; 1367 }; 1368 1369 /* ************************************************************************ */ 1370 // Dependents. 1371 /* ************************************************************************ */ 1372 1373 1374 // Apply solution included in #1962800 patch. 1375 // Issue #1962800: Form #states not working with literal integers as 1376 // values in IE11. 1377 // @see https://www.drupal.org/project/drupal/issues/1962800 1378 // @see https://www.drupal.org/files/issues/core-states-not-working-with-integers-ie11_1962800_46.patch 1379 // 1380 // This issue causes pattern, less than, and greater than support to break. 1381 // @see https://www.drupal.org/project/webform/issues/2981724 1382 var states = Drupal.states; 1383 Drupal.states.Dependent.prototype.compare = function compare(reference, selector, state) { 1384 var value = this.values[selector][state.name]; 1385 1386 var name = reference.constructor.name; 1387 if (!name) { 1388 name = $.type(reference); 1389 1390 name = name.charAt(0).toUpperCase() + name.slice(1); 1391 } 1392 if (name in states.Dependent.comparisons) { 1393 return states.Dependent.comparisons[name](reference, value); 1394 } 1395 1396 if (reference.constructor.name in states.Dependent.comparisons) { 1397 return states.Dependent.comparisons[reference.constructor.name](reference, value); 1398 } 1399 1400 return _compare2(reference, value); 1401 }; 1402 function _compare2(a, b) { 1403 if (a === b) { 1404 return typeof a === 'undefined' ? a : true; 1405 } 1406 1407 return typeof a === 'undefined' || typeof b === 'undefined'; 1408 } 1409 1410 // Adds pattern, less than, and greater than support to #state API. 1411 // @see http://drupalsun.com/julia-evans/2012/03/09/extending-form-api-states-regular-expressions 1412 Drupal.states.Dependent.comparisons.Object = function (reference, value) { 1413 if ('pattern' in reference) { 1414 return (new RegExp(reference['pattern'])).test(value); 1415 } 1416 else if ('!pattern' in reference) { 1417 return !((new RegExp(reference['!pattern'])).test(value)); 1418 } 1419 else if ('less' in reference) { 1420 return (value !== '' && parseFloat(reference['less']) > parseFloat(value)); 1421 } 1422 else if ('less_equal' in reference) { 1423 return (value !== '' && parseFloat(reference['less_equal']) >= parseFloat(value)); 1424 } 1425 else if ('greater' in reference) { 1426 return (value !== '' && parseFloat(reference['greater']) < parseFloat(value)); 1427 } 1428 else if ('greater_equal' in reference) { 1429 return (value !== '' && parseFloat(reference['greater_equal']) <= parseFloat(value)); 1430 } 1431 else if ('between' in reference || '!between' in reference) { 1432 if (value === '') { 1433 return false; 1434 } 1435 1436 var between = reference['between'] || reference['!between']; 1437 var betweenParts = between.split(':'); 1438 var greater = betweenParts[0]; 1439 var less = (typeof betweenParts[1] !== 'undefined') ? betweenParts[1] : null; 1440 var isGreaterThan = (greater === null || greater === '' || parseFloat(value) >= parseFloat(greater)); 1441 var isLessThan = (less === null || less === '' || parseFloat(value) <= parseFloat(less)); 1442 var result = (isGreaterThan && isLessThan); 1443 return (reference['!between']) ? !result : result; 1444 } 1445 else { 1446 return reference.indexOf(value) !== false; 1447 } 1448 }; 1449 1450 /* ************************************************************************ */ 1451 // States events. 1452 /* ************************************************************************ */ 1453 1454 var $document = $(document); 1455 1456 $document.on('state:required', function (e) { 1457 if (e.trigger && $(e.target).isWebformElement()) { 1458 var $target = $(e.target); 1459 // Fix #required file upload. 1460 // @see Issue #2860529: Conditional required File upload field don't work. 1461 toggleRequired($target.find('input[type="file"]'), e.value); 1462 1463 // Fix #required for radios. 1464 // @see Issue #2856795: If radio buttons are required but not filled form is nevertheless submitted. 1465 if ($target.is('.js-form-type-radios, .js-form-type-webform-radios-other, .js-webform-type-radios, .js-webform-type-webform-radios-other')) { 1466 toggleRequired($target.find('input[type="radio"]'), e.value); 1467 } 1468 1469 // Fix #required for checkboxes. 1470 // @see Issue #2938414: Checkboxes don't support #states required. 1471 // @see checkboxRequiredhandler 1472 if ($target.is('.js-form-type-checkboxes, .js-form-type-webform-checkboxes-other, .js-webform-type-checkboxes, .js-webform-type-webform-checkboxes-other')) { 1473 var $checkboxes = $target.find('input[type="checkbox"]'); 1474 if (e.value) { 1475 // Add event handler. 1476 $checkboxes.on('click', statesCheckboxesRequiredEventHandler); 1477 // Initialize and add required attribute. 1478 checkboxesRequired($target); 1479 } 1480 else { 1481 // Remove event handler. 1482 $checkboxes.off('click', statesCheckboxesRequiredEventHandler); 1483 // Remove required attribute. 1484 toggleRequired($checkboxes, false); 1485 } 1486 } 1487 1488 // Fix required label for elements without the for attribute. 1489 // @see Issue #3145300: Conditional Visible Select Other not working. 1490 if ($target.is('.js-form-type-webform-select-other, .js-webform-type-webform-select-other')) { 1491 var $select = $target.find('select'); 1492 toggleRequired($select, e.value); 1493 copyRequireMessage($target, $select); 1494 } 1495 if ($target.find('> label:not([for])').length) { 1496 $target.find('> label').toggleClass('js-form-required form-required', e.value); 1497 } 1498 1499 // Fix required label for checkboxes and radios. 1500 // @see Issue #2938414: Checkboxes don't support #states required 1501 // @see Issue #2731991: Setting required on radios marks all options required. 1502 // @see Issue #2856315: Conditional Logic - Requiring Radios in a Fieldset. 1503 // Fix #required for fieldsets. 1504 // @see Issue #2977569: Hidden fieldsets that become visible with conditional logic cannot be made required. 1505 if ($target.is('.js-webform-type-radios, .js-webform-type-checkboxes, fieldset')) { 1506 $target.find('legend span.fieldset-legend:not(.visually-hidden)').toggleClass('js-form-required form-required', e.value); 1507 } 1508 1509 // Issue #2986017: Fieldsets shouldn't have required attribute. 1510 if ($target.is('fieldset')) { 1511 $target.removeAttr('required aria-required'); 1512 } 1513 } 1514 }); 1515 1516 $document.on('state:checked', function (e) { 1517 if (e.trigger) { 1518 $(e.target).trigger('change'); 1519 } 1520 }); 1521 1522 $document.on('state:readonly', function (e) { 1523 if (e.trigger && $(e.target).isWebformElement()) { 1524 $(e.target).prop('readonly', e.value).closest('.js-form-item, .js-form-wrapper').toggleClass('webform-readonly', e.value).find('input, textarea').prop('readonly', e.value); 1525 1526 // Trigger webform:readonly. 1527 $(e.target).trigger('webform:readonly') 1528 .find('select, input, textarea, button').trigger('webform:readonly'); 1529 } 1530 }); 1531 1532 $document.on('state:visible state:visible-slide', function (e) { 1533 if (e.trigger && $(e.target).isWebformElement()) { 1534 if (e.value) { 1535 $(':input', e.target).addBack().each(function () { 1536 restoreValueAndRequired(this); 1537 triggerEventHandlers(this); 1538 }); 1539 } 1540 else { 1541 // @see https://www.sitepoint.com/jquery-function-clear-form-data/ 1542 $(':input', e.target).addBack().each(function () { 1543 backupValueAndRequired(this); 1544 clearValueAndRequired(this); 1545 triggerEventHandlers(this); 1546 }); 1547 } 1548 } 1549 }); 1550 1551 $document.on('state:visible-slide', function (e) { 1552 if (e.trigger && $(e.target).isWebformElement()) { 1553 var effect = e.value ? 'slideDown' : 'slideUp'; 1554 var duration = Drupal.webform.states[effect].duration; 1555 $(e.target).closest('.js-form-item, .js-form-submit, .js-form-wrapper')[effect](duration); 1556 } 1557 }); 1558 Drupal.states.State.aliases['invisible-slide'] = '!visible-slide'; 1559 1560 $document.on('state:disabled', function (e) { 1561 if (e.trigger && $(e.target).isWebformElement()) { 1562 // Make sure disabled property is set before triggering webform:disabled. 1563 // Copied from: core/misc/states.js 1564 $(e.target) 1565 .prop('disabled', e.value) 1566 .closest('.js-form-item, .js-form-submit, .js-form-wrapper').toggleClass('form-disabled', e.value) 1567 .find('select, input, textarea, button').prop('disabled', e.value); 1568 1569 // Never disable hidden file[fids] because the existing values will 1570 // be completely lost when the webform is submitted. 1571 var fileElements = $(e.target) 1572 .find(':input[type="hidden"][name$="[fids]"]'); 1573 if (fileElements.length) { 1574 // Remove 'disabled' attribute from fieldset which will block 1575 // all disabled elements from being submitted. 1576 if ($(e.target).is('fieldset')) { 1577 $(e.target).prop('disabled', false); 1578 } 1579 fileElements.removeAttr('disabled'); 1580 } 1581 1582 // Trigger webform:disabled. 1583 $(e.target).trigger('webform:disabled') 1584 .find('select, input, textarea, button').trigger('webform:disabled'); 1585 } 1586 }); 1587 1588 /* ************************************************************************ */ 1589 // Behaviors. 1590 /* ************************************************************************ */ 1591 1592 /** 1593 * Adds HTML5 validation to required checkboxes. 1594 * 1595 * @type {Drupal~behavior} 1596 * 1597 * @see https://www.drupal.org/project/webform/issues/3068998 1598 */ 1599 Drupal.behaviors.webformCheckboxesRequired = { 1600 attach: function (context) { 1601 $('.js-form-type-checkboxes.required, .js-form-type-webform-checkboxes-other.required, .js-webform-type-checkboxes.required, .js-webform-type-webform-checkboxes-other.required, .js-webform-type-webform-radios-other.checkboxes', context) 1602 .once('webform-checkboxes-required') 1603 .each(function () { 1604 var $element = $(this); 1605 $element.find('input[type="checkbox"]').on('click', statesCheckboxesRequiredEventHandler); 1606 setTimeout(function () {checkboxesRequired($element);}); 1607 }); 1608 } 1609 }; 1610 1611 /** 1612 * Adds HTML5 validation to required radios. 1613 * 1614 * @type {Drupal~behavior} 1615 * 1616 * @see https://www.drupal.org/project/webform/issues/2856795 1617 */ 1618 Drupal.behaviors.webformRadiosRequired = { 1619 attach: function (context) { 1620 $('.js-form-type-radios, .js-form-type-webform-radios-other, .js-webform-type-radios, .js-webform-type-webform-radios-other', context) 1621 .once('webform-radios-required') 1622 .each(function () { 1623 var $element = $(this); 1624 setTimeout(function () {radiosRequired($element);}); 1625 }); 1626 } 1627 }; 1628 1629 /** 1630 * Add HTML5 multiple checkboxes required validation. 1631 * 1632 * @param {jQuery} $element
1633 * An jQuery object containing HTML5 radios. 1634 * 1635 * @see https://stackoverflow.com/a/37825072/145846 1636 */ 1637 function checkboxesRequired($element) { 1638 var $firstCheckbox = $element.find('input[type="checkbox"]').first(); 1639 var isChecked = $element.find('input[type="checkbox"]').is(':checked'); 1640 toggleRequired($firstCheckbox, !isChecked); 1641 copyRequireMessage($element, $firstCheckbox); 1642 } 1643 1644 /** 1645 * Add HTML5 radios required validation. 1646 * 1647 * @param {jQuery} $element 1648 * An jQuery object containing HTML5 radios. 1649 * 1650 * @see https://www.drupal.org/project/webform/issues/2856795 1651 */ 1652 function radiosRequired($element) { 1653 var $radios = $element.find('input[type="radio"]'); 1654 var isRequired = $element.hasClass('required'); 1655 toggleRequired($radios, isRequired); 1656 copyRequireMessage($element, $radios); 1657 } 1658 1659 /* ************************************************************************ */ 1660 // Event handlers. 1661 /* ************************************************************************ */ 1662 1663 /** 1664 * Trigger #states API HTML5 multiple checkboxes required validation. 1665 * 1666 * @see https://stackoverflow.com/a/37825072/145846 1667 */ 1668 function statesCheckboxesRequiredEventHandler() { 1669 var $element = $(this).closest('.js-webform-type-checkboxes, .js-webform-type-webform-checkboxes-other'); 1670 checkboxesRequired($element); 1671 } 1672 1673 /** 1674 * Trigger an input's event handlers. 1675 * 1676 * @param {element} input 1677 * An input. 1678 */ 1679 function triggerEventHandlers(input) { 1680 var $input = $(input); 1681 var type = input.type; 1682 var tag = input.tagName.toLowerCase(); 1683 // Add 'webform.states' as extra parameter to event handlers. 1684 // @see Drupal.behaviors.webformUnsaved 1685 var extraParameters = ['webform.states']; 1686 if (type === 'checkbox' || type === 'radio') { 1687 $input 1688 .trigger('change', extraParameters) 1689 .trigger('blur', extraParameters); 1690 } 1691 else if (tag === 'select') { 1692 // Do not trigger the onchange event for Address element's country code 1693 // when it is initialized. 1694 // @see \Drupal\address\Element\Country 1695 if ($input.closest('.webform-type-address').length) { 1696 if (!$input.data('webform-states-address-initialized') 1697 && $input.attr('autocomplete') === 'country' 1698 && $input.val() === $input.find("option[selected]").attr('value')) { 1699 return; 1700 } 1701 $input.data('webform-states-address-initialized', true); 1702 } 1703 1704 $input 1705 .trigger('change', extraParameters) 1706 .trigger('blur', extraParameters); 1707 } 1708 else if (type !== 'submit' && type !== 'button' && type !== 'file') { 1709 // Make sure input mask is removed and then reset when value is restored. 1710 // @see https://www.drupal.org/project/webform/issues/3124155 1711 // @see https://www.drupal.org/project/webform/issues/3202795 1712 var hasInputMask = ($.fn.inputmask && $input.hasClass('js-webform-input-mask')); 1713 hasInputMask && $input.inputmask('remove'); 1714 1715 $input 1716 .trigger('input', extraParameters) 1717 .trigger('change', extraParameters) 1718 .trigger('keydown', extraParameters) 1719 .trigger('keyup', extraParameters) 1720 .trigger('blur', extraParameters); 1721 1722 hasInputMask && $input.inputmask(); 1723 } 1724 } 1725 1726 /* ************************************************************************ */ 1727 // Backup and restore value functions. 1728 /* ************************************************************************ */ 1729 1730 /** 1731 * Backup an input's current value and required attribute 1732 * 1733 * @param {element} input 1734 * An input. 1735 */ 1736 function backupValueAndRequired(input) { 1737 var $input = $(input); 1738 var type = input.type; 1739 var tag = input.tagName.toLowerCase(); // Normalize case. 1740 1741 // Backup required. 1742 if ($input.prop('required') && !$input.hasData('webform-required')) { 1743 $input.data('webform-required', true); 1744 } 1745 1746 // Backup value. 1747 if (!$input.hasData('webform-value')) { 1748 if (type === 'checkbox' || type === 'radio') { 1749 $input.data('webform-value', $input.prop('checked')); 1750 } 1751 else if (tag === 'select') { 1752 var values = []; 1753 $input.find('option:selected').each(function (i, option) { 1754 values[i] = option.value; 1755 }); 1756 $input.data('webform-value', values); 1757 } 1758 else if (type !== 'submit' && type !== 'button') { 1759 $input.data('webform-value', input.value); 1760 } 1761 } 1762 } 1763 1764 /** 1765 * Restore an input's value and required attribute. 1766 * 1767 * @param {element} input 1768 * An input. 1769 */ 1770 function restoreValueAndRequired(input) { 1771 var $input = $(input); 1772 1773 // Restore value. 1774 var value = $input.data('webform-value'); 1775 if (typeof value !== 'undefined') { 1776 var type = input.type; 1777 var tag = input.tagName.toLowerCase(); // Normalize case. 1778 1779 if (type === 'checkbox' || type === 'radio') { 1780 $input.prop('checked', value); 1781 } 1782 else if (tag === 'select') { 1783 $.each(value, function (i, option_value) { 1784 // Prevent "Syntax error, unrecognized expression" error by 1785 // escaping single quotes. 1786 // @see https://forum.jquery.com/topic/escape-characters-prior-to-using-selector 1787 option_value = option_value.replace(/'/g, "\\\'"); 1788 $input.find("option[value='" + option_value + "']").prop('selected', true); 1789 }); 1790 } 1791 else if (type !== 'submit' && type !== 'button') { 1792 input.value = value; 1793 } 1794 $input.removeData('webform-value'); 1795 } 1796 1797 // Restore required. 1798 var required = $input.data('webform-required'); 1799 if (typeof required !== 'undefined') { 1800 if (required) { 1801 $input.prop('required', true); 1802 } 1803 $input.removeData('webform-required'); 1804 } 1805 } 1806 1807 /** 1808 * Clear an input's value and required attributes. 1809 * 1810 * @param {element} input 1811 * An input. 1812 */ 1813 function clearValueAndRequired(input) { 1814 var $input = $(input); 1815 1816 // Check for #states no clear attribute.
1817 // @see https://css-tricks.com/snippets/jquery/make-an-jquery-hasattr/ 1818 if ($input.closest('[data-webform-states-no-clear]').length) { 1819 return; 1820 } 1821 1822 // Clear value. 1823 var type = input.type; 1824 var tag = input.tagName.toLowerCase(); // Normalize case. 1825 if (type === 'checkbox' || type === 'radio') { 1826 $input.prop('checked', false); 1827 } 1828 else if (tag === 'select') { 1829 if ($input.find('option[value=""]').length) { 1830 $input.val(''); 1831 } 1832 else { 1833 input.selectedIndex = -1; 1834 } 1835 } 1836 else if (type !== 'submit' && type !== 'button') { 1837 input.value = (type === 'color') ? '#000000' : ''; 1838 } 1839 1840 // Clear required. 1841 $input.prop('required', false); 1842 } 1843 1844 /* ************************************************************************ */ 1845 // Helper functions. 1846 /* ************************************************************************ */ 1847 1848 /** 1849 * Toggle an input's required attributes. 1850 * 1851 * @param {element} $input 1852 * An input. 1853 * @param {boolean} required 1854 * Is input required. 1855 */ 1856 function toggleRequired($input, required) { 1857 if (required) { 1858 $input.attr({'required': 'required', 'aria-required': 'true'}); 1859 } 1860 else { 1861 $input.removeAttr('required aria-required'); 1862 } 1863 } 1864 1865 /** 1866 * Copy the clientside_validation.module's message. 1867 * 1868 * @param {jQuery} $source 1869 * The source element. 1870 * @param {jQuery} $destination 1871 * The destination element. 1872 */ 1873 function copyRequireMessage($source, $destination) { 1874 if ($source.attr('data-msg-required')) { 1875 $destination.attr('data-msg-required', $source.attr('data-msg-required')); 1876 } 1877 } 1878 1879})(jQuery, Drupal); 1880; 1881/** 1882 * @file 1883 * JavaScript behaviors for webforms. 1884 */ 1885 1886(function ($, Drupal) { 1887 1888 'use strict'; 1889 1890 /** 1891 * Remove single submit event listener. 1892 * 1893 * @type {Drupal~behavior} 1894 * 1895 * @prop {Drupal~behaviorAttach} attach 1896 * Attaches the behavior for removing single submit event listener. 1897 * 1898 * @see Drupal.behaviors.formSingleSubmit 1899 */ 1900 Drupal.behaviors.webformRemoveFormSingleSubmit = { 1901 attach: function attach() { 1902 function onFormSubmit(e) { 1903 var $form = $(e.currentTarget); 1904 $form.removeAttr('data-drupal-form-submit-last'); 1905 } 1906 $('body') 1907 .once('webform-single-submit') 1908 .on('submit.singleSubmit', 'form.webform-remove-single-submit', onFormSubmit); 1909 } 1910 }; 1911 1912 /** 1913 * Prevent webform autosubmit on wizard pages. 1914 * 1915 * @type {Drupal~behavior} 1916 * 1917 * @prop {Drupal~behaviorAttach} attach 1918 * Attaches the behavior for disabling webform autosubmit. 1919 * Wizard pages need to be progressed with the Previous or Next buttons, 1920 * not by pressing Enter. 1921 */ 1922 Drupal.behaviors.webformDisableAutoSubmit = { 1923 attach: function (context) { 1924 // Not using context so that inputs loaded via Ajax will have autosubmit 1925 // disabled. 1926 // @see http://stackoverflow.com/questions/11235622/jquery-disable-form-submit-on-enter 1927 $('.js-webform-disable-autosubmit input') 1928 .not(':button, :submit, :reset, :image, :file') 1929 .once('webform-disable-autosubmit') 1930 .on('keyup keypress', function (e) { 1931 if (e.which === 13) { 1932 e.preventDefault(); 1933 return false; 1934 } 1935 }); 1936 } 1937 }; 1938 1939 /** 1940 * Skip client-side validation when submit button is pressed. 1941 * 1942 * @type {Drupal~behavior} 1943 * 1944 * @prop {Drupal~behaviorAttach} attach 1945 * Attaches the behavior for the skipping client-side validation. 1946 * 1947 * @deprecated in Webform 8.x-5.x and will be removed in Webform 8.x-6.x. 1948 * Use 'formnovalidate' attribute instead. 1949 */ 1950 Drupal.behaviors.webformSubmitNoValidate = { 1951 attach: function (context) { 1952 $(context).find(':submit.js-webform-novalidate') 1953 .once('webform-novalidate') 1954 .attr('formnovalidate', 'formnovalidate'); 1955 } 1956 }; 1957 1958 /** 1959 * Custom required and pattern validation error messages. 1960 * 1961 * @type {Drupal~behavior} 1962 * 1963 * @prop {Drupal~behaviorAttach} attach 1964 * Attaches the behavior for the webform custom required and pattern 1965 * validation error messages. 1966 * 1967 * @see http://stackoverflow.com/questions/5272433/html5-form-required-attribute-set-custom-validation-message 1968 **/ 1969 Drupal.behaviors.webformRequiredError = { 1970 attach: function (context) { 1971 $(context).find(':input[data-webform-required-error], :input[data-webform-pattern-error]').once('webform-required-error') 1972 .on('invalid', function () { 1973 this.setCustomValidity(''); 1974 if (this.valid) { 1975 return; 1976 } 1977 1978 if (this.validity.patternMismatch && $(this).attr('data-webform-pattern-error')) { 1979 this.setCustomValidity($(this).attr('data-webform-pattern-error')); 1980 } 1981 else if (this.validity.valueMissing && $(this).attr('data-webform-required-error')) { 1982 this.setCustomValidity($(this).attr('data-webform-required-error')); 1983 } 1984 }) 1985 .on('input change', function () { 1986 // Find all related elements by name and reset custom validity. 1987 // This specifically applies to required radios and checkboxes. 1988 var name = $(this).attr('name'); 1989 $(this.form).find(':input[name="' + name + '"]').each(function () { 1990 this.setCustomValidity(''); 1991 }); 1992 }); 1993 } 1994 }; 1995 1996 // When #state:required is triggered we need to reset the target elements 1997 // custom validity. 1998 $(document).on('state:required', function (e) { 1999 $(e.target).filter('[data-webform-required-error]') 2000 .each(function () {this.setCustomValidity('');}); 2001 }); 2002 2003})(jQuery, Drupal); 2004; 2005/** 2006 * @file 2007 * JavaScript behaviors for details element. 2008 */ 2009 2010(function ($, Drupal) { 2011 2012 'use strict'; 2013 2014 // Determine if local storage exists and is enabled. 2015 // This approach is copied from Modernizr. 2016 // @see https://github.com/Modernizr/Modernizr/blob/c56fb8b09515f629806ca44742932902ac145302/modernizr.js#L696-731 2017 var hasLocalStorage = (function () { 2018 try { 2019 localStorage.setItem('webform', 'webform'); 2020 localStorage.removeItem('webform'); 2021 return true; 2022 } 2023 catch (e) { 2024 return false;
2025 } 2026 }()); 2027 2028 /** 2029 * Attach handler to save details open/close state. 2030 * 2031 * @type {Drupal~behavior} 2032 */ 2033 Drupal.behaviors.webformDetailsSave = { 2034 attach: function (context) { 2035 if (!hasLocalStorage) { 2036 return; 2037 } 2038 2039 // Summary click event handler. 2040 $('details > summary', context).once('webform-details-summary-save').on('click', function () { 2041 var $details = $(this).parent(); 2042 2043 // @see https://css-tricks.com/snippets/jquery/make-an-jquery-hasattr/ 2044 if ($details[0].hasAttribute('data-webform-details-nosave')) { 2045 return; 2046 } 2047 2048 var name = Drupal.webformDetailsSaveGetName($details); 2049 if (!name) { 2050 return; 2051 } 2052 2053 var open = ($details.attr('open') !== 'open') ? '1' : '0'; 2054 localStorage.setItem(name, open); 2055 }); 2056 2057 // Initialize details open state via local storage. 2058 $('details', context).once('webform-details-save').each(function () { 2059 var $details = $(this); 2060 2061 var name = Drupal.webformDetailsSaveGetName($details); 2062 if (!name) { 2063 return; 2064 } 2065 2066 var open = localStorage.getItem(name); 2067 if (open === null) { 2068 return; 2069 } 2070 2071 if (open === '1') { 2072 $details.attr('open', 'open'); 2073 } 2074 else { 2075 $details.removeAttr('open'); 2076 } 2077 }); 2078 } 2079 2080 }; 2081 2082 /** 2083 * Get the name used to store the state of details element. 2084 * 2085 * @param {jQuery} $details 2086 * A details element. 2087 * 2088 * @return {string} 2089 * The name used to store the state of details element. 2090 */ 2091 Drupal.webformDetailsSaveGetName = function ($details) { 2092 if (!hasLocalStorage) { 2093 return ''; 2094 } 2095 2096 // Ignore details that are vertical tabs pane. 2097 if ($details.hasClass('vertical-tabs__pane')) { 2098 return ''; 2099 } 2100 2101 // Any details element not included a webform must have define its own id. 2102 var webformId = $details.attr('data-webform-element-id'); 2103 if (webformId) { 2104 return 'Drupal.webform.' + webformId.replace('--', '.'); 2105 } 2106 2107 var detailsId = $details.attr('id'); 2108 if (!detailsId) { 2109 return ''; 2110 } 2111 2112 var $form = $details.parents('form'); 2113 if (!$form.length || !$form.attr('id')) { 2114 return ''; 2115 } 2116 2117 var formId = $form.attr('id'); 2118 if (!formId) { 2119 return ''; 2120 } 2121 2122 // ISSUE: When Drupal renders a webform in a modal dialog it appends a unique 2123 // identifier to webform ids and details ids. (i.e. my-form--FeSFISegTUI) 2124 // WORKAROUND: Remove the unique id that delimited using double dashes. 2125 formId = formId.replace(/--.+?$/, '').replace(/-/g, '_'); 2126 detailsId = detailsId.replace(/--.+?$/, '').replace(/-/g, '_'); 2127 return 'Drupal.webform.' + formId + '.' + detailsId; 2128 }; 2129 2130})(jQuery, Drupal); 2131; 2132/** 2133* DO NOT EDIT THIS FILE. 2134* See the following change record for more information, 2135* https://www.drupal.org/node/2815083 2136* @preserve 2137**/ 2138 2139(function (Drupal, debounce) { 2140 var liveElement = void 0; 2141 var announcements = []; 2142 2143 Drupal.behaviors.drupalAnnounce = { 2144 attach: function attach(context) { 2145 if (!liveElement) { 2146 liveElement = document.createElement('div'); 2147 liveElement.id = 'drupal-live-announce'; 2148 liveElement.className = 'visually-hidden'; 2149 liveElement.setAttribute('aria-live', 'polite'); 2150 liveElement.setAttribute('aria-busy', 'false'); 2151 document.body.appendChild(liveElement); 2152 } 2153 } 2154 }; 2155 2156 function announce() { 2157 var text = []; 2158 var priority = 'polite'; 2159 var announcement = void 0; 2160 2161 var il = announcements.length; 2162 for (var i = 0; i < il; i++) { 2163 announcement = announcements.pop(); 2164 text.unshift(announcement.text); 2165 2166 if (announcement.priority === 'assertive') { 2167 priority = 'assertive'; 2168 } 2169 } 2170 2171 if (text.length) { 2172 liveElement.innerHTML = ''; 2173 2174 liveElement.setAttribute('aria-busy', 'true'); 2175 2176 liveElement.setAttribute('aria-live', priority); 2177 2178 liveElement.innerHTML = text.join('\n'); 2179 2180 liveElement.setAttribute('aria-busy', 'false'); 2181 } 2182 } 2183 2184 Drupal.announce = function (text, priority) { 2185 announcements.push({ 2186 text: text, 2187 priority: priority 2188 }); 2189 2190 return debounce(announce, 200)(); 2191 }; 2192})(Drupal, Drupal.debounce);; 2193/** 2194 * @file 2195 * JavaScript behaviors for details element. 2196 */ 2197 2198(function ($, Drupal) { 2199 2200 'use strict'; 2201 2202 Drupal.webform = Drupal.webform || {}; 2203 Drupal.webform.detailsToggle = Drupal.webform.detailsToggle || {}; 2204 Drupal.webform.detailsToggle.options = Drupal.webform.detailsToggle.options || {}; 2205 2206 /** 2207 * Attach handler to toggle details open/close state. 2208 * 2209 * @type {Drupal~behavior} 2210 */ 2211 Drupal.behaviors.webformDetailsToggle = { 2212 attach: function (context) { 2213 $('.js-webform-details-toggle', context).once('webform-details-toggle').each(function () { 2214 var $form = $(this); 2215 var $tabs = $form.find('.webform-tabs'); 2216 2217 // Get only the main details elements and ignore all nested details. 2218 var selector = ($tabs.length) ? '.webform-tab' : '.js-webform-details-toggle, .webform-elements'; 2219 var $details = $form.find('details').filter(function () { 2220 var $parents = $(this).parentsUntil(selector); 2221 return ($parents.find('details').length === 0); 2222 }); 2223 2224 // Toggle is only useful when there are two or more details elements. 2225 if ($details.length < 2) { 2226 return; 2227 } 2228 2229 var options = $.extend({ 2230 button: '<button type="button" class="webform-details-toggle-state"></button>' 2231 }, Drupal.webform.detailsToggle.options); 2232 2233 // Create toggle buttons. 2234 var $toggle = $(options.button) 2235 .attr('title', Drupal.t('Toggle details widget state.')) 2236 .on('click', function (e) { 2237 // Get details that are not vertical tabs pane. 2238 var $details = $form.find('details:not(.vertical-tabs__pane)'); 2239 var open; 2240 if (Drupal.webform.detailsToggle.isFormDetailsOpen($form)) { 2241 $details.removeAttr('open'); 2242 open = 0; 2243 } 2244 else { 2245 $details.attr('open', 'open'); 2246 open = 1; 2247 } 2248 Drupal.webform.detailsToggle.setDetailsToggleLabel($form); 2249 2250 // Set the saved states for all the details elements. 2251 // @see webform.element.details.save.js 2252 if (Drupal.webformDetailsSaveGetName) { 2253 $details.each(function () { 2254 // Note: Drupal.webformDetailsSaveGetName checks if localStorage 2255 // exists and is enabled. 2256 // @see webform.element.details.save.js 2257 var name = Drupal.webformDetailsSaveGetName($(this)); 2258 if (name) {
2259 localStorage.setItem(name, open); 2260 } 2261 }); 2262 } 2263 }) 2264 .wrap('<div class="webform-details-toggle-state-wrapper"></div>') 2265 .parent(); 2266 2267 if ($tabs.length) { 2268 // Add toggle state before the tabs. 2269 $tabs.find('.item-list:first-child').eq(0).before($toggle); 2270 } 2271 else { 2272 // Add toggle state link to first details element. 2273 $details.eq(0).before($toggle); 2274 } 2275 2276 Drupal.webform.detailsToggle.setDetailsToggleLabel($form); 2277 }); 2278 } 2279 }; 2280 2281 /** 2282 * Determine if a webform's details are all opened. 2283 * 2284 * @param {jQuery} $form 2285 * A webform. 2286 * 2287 * @return {boolean} 2288 * TRUE if a webform's details are all opened. 2289 */ 2290 Drupal.webform.detailsToggle.isFormDetailsOpen = function ($form) { 2291 return ($form.find('details[open]').length === $form.find('details').length); 2292 }; 2293 2294 /** 2295 * Set a webform's details toggle state widget label. 2296 * 2297 * @param {jQuery} $form 2298 * A webform. 2299 */ 2300 Drupal.webform.detailsToggle.setDetailsToggleLabel = function ($form) { 2301 var isOpen = Drupal.webform.detailsToggle.isFormDetailsOpen($form); 2302 2303 var label = (isOpen) ? Drupal.t('Collapse all') : Drupal.t('Expand all'); 2304 $form.find('.webform-details-toggle-state').html(label); 2305 2306 var text = (isOpen) ? Drupal.t('All details have been expanded.') : Drupal.t('All details have been collapsed.'); 2307 Drupal.announce(text); 2308 }; 2309 2310})(jQuery, Drupal); 2311; 2312/** 2313 * @file 2314 * JavaScript behaviors for message element integration. 2315 */ 2316 2317(function ($, Drupal) { 2318 2319 'use strict'; 2320 2321 // Determine if local storage exists and is enabled. 2322 // This approach is copied from Modernizr. 2323 // @see https://github.com/Modernizr/Modernizr/blob/c56fb8b09515f629806ca44742932902ac145302/modernizr.js#L696-731 2324 var hasLocalStorage = (function () { 2325 try { 2326 localStorage.setItem('webform', 'webform'); 2327 localStorage.removeItem('webform'); 2328 return true; 2329 } 2330 catch (e) { 2331 return false; 2332 } 2333 }()); 2334 2335 // Determine if session storage exists and is enabled. 2336 // This approach is copied from Modernizr. 2337 // @see https://github.com/Modernizr/Modernizr/blob/c56fb8b09515f629806ca44742932902ac145302/modernizr.js#L696-731 2338 var hasSessionStorage = (function () { 2339 try { 2340 sessionStorage.setItem('webform', 'webform'); 2341 sessionStorage.removeItem('webform'); 2342 return true; 2343 } 2344 catch (e) { 2345 return false; 2346 } 2347 }()); 2348 2349 /** 2350 * Behavior for handler message close. 2351 * 2352 * @type {Drupal~behavior} 2353 */ 2354 Drupal.behaviors.webformMessageClose = { 2355 attach: function (context) { 2356 $(context).find('.js-webform-message--close').once('webform-message--close').each(function () { 2357 var $element = $(this); 2358 2359 var id = $element.attr('data-message-id'); 2360 var storage = $element.attr('data-message-storage'); 2361 var effect = $element.attr('data-message-close-effect') || 'hide'; 2362 switch (effect) { 2363 case 'slide': effect = 'slideUp'; break; 2364 2365 case 'fade': effect = 'fadeOut'; break; 2366 } 2367 2368 // Check storage status. 2369 if (isClosed($element, storage, id)) { 2370 return; 2371 } 2372 2373 // Only show element if it's style is not set to 'display: none'. 2374 if ($element.attr('style') !== 'display: none;') { 2375 $element.show(); 2376 } 2377 2378 $element.find('.js-webform-message__link').on('click', function (event) { 2379 $element[effect](); 2380 setClosed($element, storage, id); 2381 $element.trigger('close'); 2382 event.preventDefault(); 2383 }); 2384 }); 2385 } 2386 }; 2387 2388 function isClosed($element, storage, id) { 2389 if (!id || !storage) { 2390 return false; 2391 } 2392 2393 switch (storage) { 2394 case 'local': 2395 if (hasLocalStorage) { 2396 return localStorage.getItem('Drupal.webform.message.' + id) || false; 2397 } 2398 return false; 2399 2400 case 'session': 2401 if (hasSessionStorage) { 2402 return sessionStorage.getItem('Drupal.webform.message.' + id) || false; 2403 } 2404 return false;
2405 2406 default: 2407 return false; 2408 } 2409 } 2410 2411 function setClosed($element, storage, id) { 2412 if (!id || !storage) { 2413 return; 2414 } 2415 2416 switch (storage) { 2417 case 'local': 2418 if (hasLocalStorage) { 2419 localStorage.setItem('Drupal.webform.message.' + id, true); 2420 } 2421 break; 2422 2423 case 'session': 2424 if (hasSessionStorage) { 2425 sessionStorage.setItem('Drupal.webform.message.' + id, true); 2426 } 2427 break; 2428 2429 case 'user': 2430 case 'state': 2431 case 'custom': 2432 $.get($element.find('.js-webform-message__link').attr('href')); 2433 return true; 2434 } 2435 } 2436 2437})(jQuery, Drupal); 2438; 2439/** 2440* DO NOT EDIT THIS FILE. 2441* See the following change record for more information, 2442* https://www.drupal.org/node/2815083 2443* @preserve 2444**/ 2445 2446(function ($, Drupal) { 2447 Drupal.theme.progressBar = function (id) { 2448 return '<div id="' + id + '" class="progress" aria-live="polite">' + '<div class="progress__label"> </div>' + '<div class="progress__track"><div class="progress__bar"></div></div>' + '<div class="progress__percentage"></div>' + '<div class="progress__description"> </div>' + '</div>'; 2449 }; 2450 2451 Drupal.ProgressBar = function (id, updateCallback, method, errorCallback) { 2452 this.id = id; 2453 this.method = method || 'GET'; 2454 this.updateCallback = updateCallback; 2455 this.errorCallback = errorCallback; 2456 2457 this.element = $(Drupal.theme('progressBar', id)); 2458 }; 2459 2460 $.extend(Drupal.ProgressBar.prototype, { 2461 setProgress: function setProgress(percentage, message, label) { 2462 if (percentage >= 0 && percentage <= 100) { 2463 $(this.element).find('div.progress__bar').css('width', percentage + '%'); 2464 $(this.element).find('div.progress__percentage').html(percentage + '%'); 2465 } 2466 $('div.progress__description', this.element).html(message); 2467 $('div.progress__label', this.element).html(label); 2468 if (this.updateCallback) { 2469 this.updateCallback(percentage, message, this); 2470 } 2471 }, 2472 startMonitoring: function startMonitoring(uri, delay) { 2473 this.delay = delay; 2474 this.uri = uri; 2475 this.sendPing(); 2476 }, 2477 stopMonitoring: function stopMonitoring() { 2478 clearTimeout(this.timer); 2479 2480 this.uri = null; 2481 }, 2482 sendPing: function sendPing() { 2483 if (this.timer) { 2484 clearTimeout(this.timer); 2485 } 2486 if (this.uri) { 2487 var pb = this; 2488 2489 var uri = this.uri; 2490 if (uri.indexOf('?') === -1) { 2491 uri += '?'; 2492 } else { 2493 uri += '&'; 2494 } 2495 uri += '_format=json'; 2496 $.ajax({ 2497 type: this.method, 2498 url: uri, 2499 data: '', 2500 dataType: 'json', 2501 success: function success(progress) { 2502 if (progress.status === 0) { 2503 pb.displayError(progress.data); 2504 return; 2505 } 2506 2507 pb.setProgress(progress.percentage, progress.message, progress.label); 2508 2509 pb.timer = setTimeout(function () { 2510 pb.sendPing(); 2511 }, pb.delay); 2512 }, 2513 error: function error(xmlhttp) { 2514 var e = new Drupal.AjaxError(xmlhttp, pb.uri); 2515 pb.displayError('<pre>' + e.message + '</pre>'); 2516 } 2517 }); 2518 } 2519 }, 2520 displayError: function displayError(string) { 2521 var error = $('<div class="messages messages--error"></div>').html(string); 2522 $(this.element).before(error).hide(); 2523 2524 if (this.errorCallback) { 2525 this.errorCallback(this); 2526 } 2527 } 2528 }); 2529})(jQuery, Drupal);; 2530/** 2531* DO NOT EDIT THIS FILE. 2532* See the following change record for more information, 2533* https://www.drupal.org/node/2815083 2534* @preserve 2535**/ 2536 2537(function (Drupal) { 2538 Drupal.behaviors.responsiveImageAJAX = { 2539 attach: function attach() { 2540 if (window.picturefill) { 2541 window.picturefill(); 2542 } 2543 } 2544 }; 2545})(Drupal);; 2546/** 2547* DO NOT EDIT THIS FILE. 2548* See the following change record for more information, 2549* https://www.drupal.org/node/2815083 2550* @preserve 2551**/ 2552function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } 2553 2554(function ($, window, Drupal, drupalSettings) { 2555 Drupal.behaviors.AJAX = { 2556 attach: function attach(context, settings) { 2557 function loadAjaxBehavior(base) { 2558 var elementSettings = settings.ajax[base]; 2559 if (typeof elementSettings.selector === 'undefined') { 2560 elementSettings.selector = '#' + base; 2561 } 2562 $(elementSettings.selector).once('drupal-ajax').each(function () { 2563 elementSettings.element = this; 2564 elementSettings.base = base; 2565 Drupal.ajax(elementSettings); 2566 }); 2567 } 2568 2569 Object.keys(settings.ajax || {}
2569).forEach(function (base) { 2570 return loadAjaxBehavior(base); 2571 }); 2572 2573 Drupal.ajax.bindAjaxLinks(document.body); 2574 2575 $('.use-ajax-submit').once('ajax').each(function () { 2576 var elementSettings = {}; 2577 2578 elementSettings.url = $(this.form).attr('action'); 2579 2580 elementSettings.setClick = true; 2581 2582 elementSettings.event = 'click'; 2583 2584 elementSettings.progress = { type: 'throbber' }; 2585 elementSettings.base = $(this).attr('id'); 2586 elementSettings.element = this; 2587 2588 Drupal.ajax(elementSettings); 2589 }); 2590 }, 2591 detach: function detach(context, settings, trigger) { 2592 if (trigger === 'unload') { 2593 Drupal.ajax.expired().forEach(function (instance) { 2594 Drupal.ajax.instances[instance.instanceIndex] = null; 2595 }); 2596 } 2597 } 2598 }; 2599 2600 Drupal.AjaxError = function (xmlhttp, uri, customMessage) { 2601 var statusCode = void 0; 2602 var statusText = void 0; 2603 var responseText = void 0; 2604 if (xmlhttp.status) { 2605 statusCode = '\n' + Drupal.t('An AJAX HTTP error occurred.') + '\n' + Drupal.t('HTTP Result Code: !status', { 2606 '!status': xmlhttp.status 2607 }); 2608 } else { 2609 statusCode = '\n' + Drupal.t('An AJAX HTTP request terminated abnormally.'); 2610 } 2611 statusCode += '\n' + Drupal.t('Debugging information follows.'); 2612 var pathText = '\n' + Drupal.t('Path: !uri', { '!uri': uri }); 2613 statusText = ''; 2614 2615 try { 2616 statusText = '\n' + Drupal.t('StatusText: !statusText', { 2617 '!statusText': $.trim(xmlhttp.statusText) 2618 }); 2619 } catch (e) {} 2620 2621 responseText = ''; 2622 2623 try { 2624 responseText = '\n' + Drupal.t('ResponseText: !responseText', { 2625 '!responseText': $.trim(xmlhttp.responseText) 2626 }); 2627 } catch (e) {} 2628 2629 responseText = responseText.replace(/<("[^"]*"|'[^']*'|[^'">])*>/gi, ''); 2630 responseText = responseText.replace(/[\n]+\s+/g, '\n'); 2631 2632 var readyStateText = xmlhttp.status === 0 ? '\n' + Drupal.t('ReadyState: !readyState', { 2633 '!readyState': xmlhttp.readyState 2634 }) : ''; 2635 2636 customMessage = customMessage ? '\n' + Drupal.t('CustomMessage: !customMessage', { 2637 '!customMessage': customMessage 2638 }) : ''; 2639 2640 this.message = statusCode + pathText + statusText + customMessage + responseText + readyStateText; 2641 2642 this.name = 'AjaxError'; 2643 }; 2644 2645 Drupal.AjaxError.prototype = new Error(); 2646 Drupal.AjaxError.prototype.constructor = Drupal.AjaxError; 2647 2648 Drupal.ajax = function (settings) { 2649 if (arguments.length !== 1) { 2650 throw new Error('Drupal.ajax() function must be called with one configuration object only'); 2651 } 2652 2653 var base = settings.base || false; 2654 var element = settings.element || false; 2655 delete settings.base; 2656 delete settings.element; 2657 2658 if (!settings.progress && !element) { 2659 settings.progress = false; 2660 } 2661 2662 var ajax = new Drupal.Ajax(base, element, settings); 2663 ajax.instanceIndex = Drupal.ajax.instances.length; 2664 Drupal.ajax.instances.push(ajax); 2665 2666 return ajax; 2667 }; 2668 2669 Drupal.ajax.instances = []; 2670 2671 Drupal.ajax.expired = function () { 2672 return Drupal.ajax.instances.filter(function (instance) { 2673 return instance && instance.element !== false && !document.body.contains(instance.element); 2674 }); 2675 }; 2676 2677 Drupal.ajax.bindAjaxLinks = function (element) { 2678 $(element).find('.use-ajax').once('ajax').each(function (i, ajaxLink) { 2679 var $linkElement = $(ajaxLink); 2680 2681 var elementSettings = { 2682 progress: { type: 'throbber' }, 2683 dialogType: $linkElement.data('dialog-type'), 2684 dialog: $linkElement.data('dialog-options'), 2685 dialogRenderer: $linkElement.data('dialog-renderer'), 2686 base: $linkElement.attr('id'), 2687 element: ajaxLink 2688 }; 2689 var href = $linkElement.attr('href'); 2690 2691 if (href) { 2692 elementSettings.url = href; 2693 elementSettings.event = 'click'; 2694 } 2695 Drupal.ajax(elementSettings); 2696 }); 2697 }; 2698 2699 Drupal.Ajax = function (base, element, elementSettings) { 2700 var defaults = { 2701 event: element ? 'mousedown' : null, 2702 keypress: true, 2703 selector: base ? '#' + base : null, 2704 effect: 'none', 2705 speed: 'none', 2706 method: 'replaceWith', 2707 progress: { 2708 type: 'throbber', 2709 message: Drupal.t('Please wait...') 2710 }, 2711 submit: { 2712 js: true 2713 } 2714 }; 2715 2716 $.extend(this, defaults, elementSettings); 2717 2718 this.commands = new Drupal.AjaxCommands(); 2719 2720 this.instanceIndex = false;
2721 2722 if (this.wrapper) { 2723 this.wrapper = '#' + this.wrapper; 2724 } 2725 2726 this.element = element; 2727 2728 this.element_settings = elementSettings; 2729 2730 this.elementSettings = elementSettings; 2731 2732 if (this.element && this.element.form) { 2733 this.$form = $(this.element.form); 2734 } 2735 2736 if (!this.url) { 2737 var $element = $(this.element); 2738 if ($element.is('a')) { 2739 this.url = $element.attr('href'); 2740 } else if (this.element && element.form) { 2741 this.url = this.$form.attr('action'); 2742 } 2743 } 2744 2745 var originalUrl = this.url; 2746 2747 this.url = this.url.replace(/\/nojs(\/|$|\?|#)/, '/ajax$1'); 2748 2749 if (drupalSettings.ajaxTrustedUrl[originalUrl]) { 2750 drupalSettings.ajaxTrustedUrl[this.url] = true; 2751 } 2752 2753 var ajax = this; 2754 2755 ajax.options = { 2756 url: ajax.url, 2757 data: ajax.submit, 2758 beforeSerialize: function beforeSerialize(elementSettings, options) { 2759 return ajax.beforeSerialize(elementSettings, options); 2760 }, 2761 beforeSubmit: function beforeSubmit(formValues, elementSettings, options) { 2762 ajax.ajaxing = true; 2763 return ajax.beforeSubmit(formValues, elementSettings, options); 2764 }, 2765 beforeSend: function beforeSend(xmlhttprequest, options) { 2766 ajax.ajaxing = true; 2767 return ajax.beforeSend(xmlhttprequest, options); 2768 }, 2769 success: function success(response, status, xmlhttprequest) { 2770 if (typeof response === 'string') { 2771 response = $.parseJSON(response); 2772 } 2773 2774 if (response !== null && !drupalSettings.ajaxTrustedUrl[ajax.url]) { 2775 if (xmlhttprequest.getResponseHeader('X-Drupal-Ajax-Token') !== '1') { 2776 var customMessage = Drupal.t('The response failed verification so will not be processed.'); 2777 return ajax.error(xmlhttprequest, ajax.url, customMessage); 2778 } 2779 } 2780 2781 return ajax.success(response, status); 2782 }, 2783 complete: function complete(xmlhttprequest, status) { 2784 ajax.ajaxing = false; 2785 if (status === 'error' || status === 'parsererror') { 2786 return ajax.error(xmlhttprequest, ajax.url); 2787 } 2788 }, 2789 2790 dataType: 'json', 2791 jsonp: false, 2792 type: 'POST' 2793 }; 2794 2795 if (elementSettings.dialog) { 2796 ajax.options.data.dialogOptions = elementSettings.dialog; 2797 } 2798 2799 if (ajax.options.url.indexOf('?') === -1) { 2800 ajax.options.url += '?'; 2801 } else { 2802 ajax.options.url += '&'; 2803 } 2804 2805 var wrapper = 'drupal_' + (elementSettings.dialogType || 'ajax'); 2806 if (elementSettings.dialogRenderer) { 2807 wrapper += '.' + elementSettings.dialogRenderer; 2808 } 2809 ajax.options.url += Drupal.ajax.WRAPPER_FORMAT + '=' + wrapper; 2810 2811 $(ajax.element).on(elementSettings.event, function (event) { 2812 if (!drupalSettings.ajaxTrustedUrl[ajax.url] && !Drupal.url.isLocal(ajax.url)) { 2813 throw new Error(Drupal.t('The callback URL is not local and not trusted: !url', { 2814 '!url': ajax.url 2815 })); 2816 } 2817 return ajax.eventResponse(this, event); 2818 }); 2819 2820 if (elementSettings.keypress) { 2821 $(ajax.element).on('keypress', function (event) { 2822 return ajax.keypressResponse(this, event); 2823 }); 2824 } 2825 2826 if (elementSettings.prevent) { 2827 $(ajax.element).on(elementSettings.prevent, false); 2828 } 2829 }; 2830 2831 Drupal.ajax.WRAPPER_FORMAT = '_wrapper_format'; 2832 2833 Drupal.Ajax.AJAX_REQUEST_PARAMETER = '_drupal_ajax'; 2834 2835 Drupal.Ajax.prototype.execute = function () { 2836 if (this.ajaxing) { 2837 return; 2838 } 2839 2840 try { 2841 this.beforeSerialize(this.element, this.options); 2842 2843 return $.ajax(this.options); 2844 } catch (e) { 2845 this.ajaxing = false; 2846 window.alert('An error occurred while attempting to process ' + this.options.url + ': ' + e.message); 2847 2848 return $.Deferred().reject(); 2849 } 2850 }; 2851 2852 Drupal.Ajax.prototype.keypressResponse = function (element, event) { 2853 var ajax = this; 2854 2855 if (event.which === 13 || event.which === 32 && element.type !== 'text' && element.type !== 'textarea' && element.type !== 'tel' && element.type !== 'number') { 2856 event.preventDefault(); 2857 event.stopPropagation(); 2858 $(element).trigger(ajax.elementSettings.event); 2859 } 2860 }; 2861 2862 Drupal.Ajax.prototype.eventResponse = function (element, event) { 2863 event.preventDefault(); 2864 event.stopPropagation(); 2865 2866 var ajax = this; 2867 2868 if (ajax.ajaxing) { 2869 return; 2870 } 2871 2872 try { 2873 if (ajax.$form) { 2874 if (ajax.setClick) { 2875 element.form.clk = element; 2876 } 2877 2878 ajax.$form.ajaxSubmit(ajax.options); 2879 } else { 2880 ajax.beforeSerialize(ajax.element, ajax.options); 2881 $.ajax(ajax.options); 2882 } 2883 } catch (e) { 2884 ajax.ajaxing = false;
2885 window.alert('An error occurred while attempting to process ' + ajax.options.url + ': ' + e.message); 2886 } 2887 }; 2888 2889 Drupal.Ajax.prototype.beforeSerialize = function (element, options) { 2890 if (this.$form && document.body.contains(this.$form.get(0))) { 2891 var settings = this.settings || drupalSettings; 2892 Drupal.detachBehaviors(this.$form.get(0), settings, 'serialize'); 2893 } 2894 2895 options.data[Drupal.Ajax.AJAX_REQUEST_PARAMETER] = 1; 2896 2897 var pageState = drupalSettings.ajaxPageState; 2898 options.data['ajax_page_state[theme]'] = pageState.theme; 2899 options.data['ajax_page_state[theme_token]'] = pageState.theme_token; 2900 options.data['ajax_page_state[libraries]'] = pageState.libraries; 2901 }; 2902 2903 Drupal.Ajax.prototype.beforeSubmit = function (formValues, element, options) {}; 2904 2905 Drupal.Ajax.prototype.beforeSend = function (xmlhttprequest, options) { 2906 if (this.$form) { 2907 options.extraData = options.extraData || {}; 2908 2909 options.extraData.ajax_iframe_upload = '1'; 2910 2911 var v = $.fieldValue(this.element); 2912 if (v !== null) { 2913 options.extraData[this.element.name] = v; 2914 } 2915 } 2916 2917 $(this.element).prop('disabled', true); 2918 2919 if (!this.progress || !this.progress.type) { 2920 return; 2921 } 2922 2923 var progressIndicatorMethod = 'setProgressIndicator' + this.progress.type.slice(0, 1).toUpperCase() + this.progress.type.slice(1).toLowerCase(); 2924 if (progressIndicatorMethod in this && typeof this[progressIndicatorMethod] === 'function') { 2925 this[progressIndicatorMethod].call(this); 2926 } 2927 }; 2928 2929 Drupal.theme.ajaxProgressThrobber = function (message) { 2930 var messageMarkup = typeof message === 'string' ? Drupal.theme('ajaxProgressMessage', message) : ''; 2931 var throbber = '<div class="throbber"> </div>'; 2932 2933 return '<div class="ajax-progress ajax-progress-throbber">' + throbber + messageMarkup + '</div>'; 2934 }; 2935 2936 Drupal.theme.ajaxProgressIndicatorFullscreen = function () { 2937 return '<div class="ajax-progress ajax-progress-fullscreen"> </div>'; 2938 }; 2939 2940 Drupal.theme.ajaxProgressMessage = function (message) { 2941 return '<div class="message">' + message + '</div>'; 2942 }; 2943 2944 Drupal.theme.ajaxProgressBar = function ($element) { 2945 return $('<div class="ajax-progress ajax-progress-bar"></div>').append($element); 2946 }; 2947 2948 Drupal.Ajax.prototype.setProgressIndicatorBar = function () { 2949 var progressBar = new Drupal.ProgressBar('ajax-progress-' + this.element.id, $.noop, this.progress.method, $.noop); 2950 if (this.progress.message) { 2951 progressBar.setProgress(-1, this.progress.message); 2952 } 2953 if (this.progress.url) { 2954 progressBar.startMonitoring(this.progress.url, this.progress.interval || 1500); 2955 } 2956 this.progress.element = $(Drupal.theme('ajaxProgressBar', progressBar.element)); 2957 this.progress.object = progressBar; 2958 $(this.element).after(this.progress.element); 2959 }; 2960 2961 Drupal.Ajax.prototype.setProgressIndicatorThrobber = function () { 2962 this.progress.element = $(Drupal.theme('ajaxProgressThrobber', this.progress.message)); 2963 $(this.element).after(this.progress.element); 2964 }; 2965 2966 Drupal.Ajax.prototype.setProgressIndicatorFullscreen = function () { 2967 this.progress.element = $(Drupal.theme('ajaxProgressIndicatorFullscreen')); 2968 $('body').append(this.progress.element); 2969 }; 2970 2971 Drupal.Ajax.prototype.success = function (response, status) { 2972 var _this = this; 2973 2974 if (this.progress.element) { 2975 $(this.progress.element).remove(); 2976 } 2977 if (this.progress.object) { 2978 this.progress.object.stopMonitoring(); 2979 } 2980 $(this.element).prop('disabled', false); 2981 2982 var elementParents = $(this.element).parents('[data-drupal-selector]').addBack().toArray(); 2983 2984 var focusChanged = false; 2985 Object.keys(response || {}).forEach(function (i) { 2986 if (response[i].command && _this.commands[response[i].command]) { 2987 _this.commands[response[i].command](_this, response[i], status); 2988 if (response[i].command === 'invoke' && response[i].method === 'focus') { 2989 focusChanged = true; 2990 } 2991 } 2992 }); 2993 2994 if (!focusChanged && this.element && !$(this.element).data('disable-refocus')) { 2995 var target = false;
2996 2997 for (var n = elementParents.length - 1; !target && n >= 0; n--) { 2998 target = document.querySelector('[data-drupal-selector="' + elementParents[n].getAttribute('data-drupal-selector') + '"]'); 2999 } 3000 3001 if (target) { 3002 $(target).trigger('focus'); 3003 } 3004 } 3005 3006 if (this.$form && document.body.contains(this.$form.get(0))) { 3007 var settings = this.settings || drupalSettings; 3008 Drupal.attachBehaviors(this.$form.get(0), settings); 3009 } 3010 3011 this.settings = null; 3012 }; 3013 3014 Drupal.Ajax.prototype.getEffect = function (response) { 3015 var type = response.effect || this.effect; 3016 var speed = response.speed || this.speed; 3017 3018 var effect = {}; 3019 if (type === 'none') { 3020 effect.showEffect = 'show'; 3021 effect.hideEffect = 'hide'; 3022 effect.showSpeed = ''; 3023 } else if (type === 'fade') { 3024 effect.showEffect = 'fadeIn'; 3025 effect.hideEffect = 'fadeOut'; 3026 effect.showSpeed = speed; 3027 } else { 3028 effect.showEffect = type + 'Toggle'; 3029 effect.hideEffect = type + 'Toggle'; 3030 effect.showSpeed = speed; 3031 } 3032 3033 return effect; 3034 }; 3035 3036 Drupal.Ajax.prototype.error = function (xmlhttprequest, uri, customMessage) { 3037 if (this.progress.element) { 3038 $(this.progress.element).remove(); 3039 } 3040 if (this.progress.object) { 3041 this.progress.object.stopMonitoring(); 3042 } 3043 3044 $(this.wrapper).show(); 3045 3046 $(this.element).prop('disabled', false); 3047 3048 if (this.$form && document.body.contains(this.$form.get(0))) { 3049 var settings = this.settings || drupalSettings; 3050 Drupal.attachBehaviors(this.$form.get(0), settings); 3051 } 3052 throw new Drupal.AjaxError(xmlhttprequest, uri, customMessage); 3053 }; 3054 3055 Drupal.theme.ajaxWrapperNewContent = function ($newContent, ajax, response) { 3056 return (response.effect || ajax.effect) !== 'none' && $newContent.filter(function (i) { 3057 return !($newContent[i].nodeName === '#comment' || $newContent[i].nodeName === '#text' && /^(\s|\n|\r)*$/.test($newContent[i].textContent)); 3058 }).length > 1 ? Drupal.theme('ajaxWrapperMultipleRootElements', $newContent) : $newContent; 3059 }; 3060 3061 Drupal.theme.ajaxWrapperMultipleRootElements = function ($elements) { 3062 return $('<div></div>').append($elements); 3063 }; 3064 3065 Drupal.AjaxCommands = function () {}; 3066 Drupal.AjaxCommands.prototype = { 3067 insert: function insert(ajax, response) { 3068 var $wrapper = response.selector ? $(response.selector) : $(ajax.wrapper); 3069 var method = response.method || ajax.method; 3070 var effect = ajax.getEffect(response); 3071 3072 var settings = response.settings || ajax.settings || drupalSettings; 3073 3074 var $newContent = $($.parseHTML(response.data, document, true)); 3075 3076 $newContent = Drupal.theme('ajaxWrapperNewContent', $newContent, ajax, response); 3077 3078 switch (method) { 3079 case 'html': 3080 case 'replaceWith': 3081 case 'replaceAll': 3082 case 'empty': 3083 case 'remove': 3084 Drupal.detachBehaviors($wrapper.get(0), settings); 3085 break; 3086 default: 3087 break; 3088 } 3089 3090 $wrapper[method]($newContent); 3091 3092 if (effect.showEffect !== 'show') { 3093 $newContent.hide(); 3094 } 3095 3096 var $ajaxNewContent = $newContent.find('.ajax-new-content'); 3097 if ($ajaxNewContent.length) { 3098 $ajaxNewContent.hide(); 3099 $newContent.show(); 3100 $ajaxNewContent[effect.showEffect](effect.showSpeed); 3101 } else if (effect.showEffect !== 'show') { 3102 $newContent[effect.showEffect](effect.showSpeed); 3103 } 3104 3105 if ($newContent.parents('html').length) { 3106 $newContent.each(function (index, element) { 3107 if (element.nodeType === Node.ELEMENT_NODE) { 3108 Drupal.attachBehaviors(element, settings); 3109 } 3110 }); 3111 } 3112 }, 3113 remove: function remove(ajax, response, status) { 3114 var settings = response.settings || ajax.settings || drupalSettings; 3115 $(response.selector).each(function () { 3116 Drupal.detachBehaviors(this, settings); 3117 }).remove(); 3118 }, 3119 changed: function changed(ajax, response, status) { 3120 var $element = $(response.selector); 3121 if (!$element.hasClass('ajax-changed')) { 3122 $element.addClass('ajax-changed'); 3123 if (response.asterisk) { 3124 $element.find(response.asterisk).append(' <abbr class="ajax-changed" title="' + Drupal.t('Changed') + '">*</abbr> '); 3125 } 3126 } 3127 }, 3128 alert: function alert(ajax, response, status) { 3129 window.alert(response.text, response.title); 3130 }, 3131 announce: function announce(ajax, response) { 3132 if (response.priority) { 3133 Drupal.announce(response.text, response.priority); 3134 } else { 3135 Drupal.announce(response.text); 3136 } 3137 }, 3138 redirect: function redirect(ajax, response, status) { 3139 window.location = response.url; 3140 }, 3141 css: function css(ajax, response, status) { 3142 $(response.selector).css(response.argument); 3143 }, 3144 settings: function settings(ajax, response, status) { 3145 var ajaxSettings = drupalSettings.ajax; 3146 3147 if (ajaxSettings) {
3148 Drupal.ajax.expired().forEach(function (instance) { 3149 3150 if (instance.selector) { 3151 var selector = instance.selector.replace('#', ''); 3152 if (selector in ajaxSettings) { 3153 delete ajaxSettings[selector]; 3154 } 3155 } 3156 }); 3157 } 3158 3159 if (response.merge) { 3160 $.extend(true, drupalSettings, response.settings); 3161 } else { 3162 ajax.settings = response.settings; 3163 } 3164 }, 3165 data: function data(ajax, response, status) { 3166 $(response.selector).data(response.name, response.value); 3167 }, 3168 invoke: function invoke(ajax, response, status) { 3169 var $element = $(response.selector); 3170 $element[response.method].apply($element, _toConsumableArray(response.args)); 3171 }, 3172 restripe: function restripe(ajax, response, status) { 3173 $(response.selector).find('> tbody > tr:visible, > tr:visible').removeClass('odd even').filter(':even').addClass('odd').end().filter(':odd').addClass('even'); 3174 }, 3175 update_build_id: function update_build_id(ajax, response, status) { 3176 $('input[name="form_build_id"][value="' + response.old + '"]').val(response.new); 3177 }, 3178 add_css: function add_css(ajax, response, status) { 3179 $('head').prepend(response.data); 3180 }, 3181 message: function message(ajax, response) { 3182 var messages = new Drupal.Message(document.querySelector(response.messageWrapperQuerySelector)); 3183 if (response.clearPrevious) { 3184 messages.clear(); 3185 } 3186 messages.add(response.message, response.messageOptions); 3187 } 3188 }; 3189})(jQuery, window, Drupal, drupalSettings);; 3190/** 3191* DO NOT EDIT THIS FILE. 3192* See the following change record for more information, 3193* https://www.drupal.org/node/2815083 3194* @preserve 3195**/ 3196 3197(function (Drupal) { 3198 Drupal.theme.ajaxProgressBar = function ($element) { 3199 return $element.addClass('ajax-progress ajax-progress-bar'); 3200 }; 3201})(Drupal);; 3202/** 3203* DO NOT EDIT THIS FILE. 3204* See the following change record for more information, 3205* https://www.drupal.org/node/2815083 3206* @preserve 3207**/ 3208 3209(function ($, Drupal, debounce) { 3210 var offsets = { 3211 top: 0, 3212 right: 0, 3213 bottom: 0, 3214 left: 0 3215 }; 3216 3217 function getRawOffset(el, edge) { 3218 var $el = $(el); 3219 var documentElement = document.documentElement; 3220 var displacement = 0; 3221 var horizontal = edge === 'left' || edge === 'right'; 3222 3223 var placement = $el.offset()[horizontal ? 'left' : 'top']; 3224 3225 placement -= window['scroll' + (horizontal ? 'X' : 'Y')] || document.documentElement['scroll' + (horizontal ? 'Left' : 'Top')] || 0; 3226 3227 switch (edge) { 3228 case 'top': 3229 displacement = placement + $el.outerHeight(); 3230 break; 3231 3232 case 'left': 3233 displacement = placement + $el.outerWidth(); 3234 break; 3235 3236 case 'bottom': 3237 displacement = documentElement.clientHeight - placement; 3238 break; 3239 3240 case 'right': 3241 displacement = documentElement.clientWidth - placement; 3242 break; 3243 3244 default: 3245 displacement = 0; 3246 } 3247 return displacement; 3248 } 3249 3250 function calculateOffset(edge) { 3251 var edgeOffset = 0; 3252 var displacingElements = document.querySelectorAll('[data-offset-' + edge + ']'); 3253 var n = displacingElements.length; 3254 for (var i = 0; i < n; i++) { 3255 var el = displacingElements[i]; 3256 3257 if (el.style.display === 'none') { 3258 continue; 3259 } 3260 3261 var displacement = parseInt(el.getAttribute('data-offset-' + edge), 10); 3262 3263 if (isNaN(displacement)) { 3264 displacement = getRawOffset(el, edge); 3265 } 3266 3267 edgeOffset = Math.max(edgeOffset, displacement); 3268 } 3269 3270 return edgeOffset; 3271 } 3272 3273 function calculateOffsets() { 3274 return { 3275 top: calculateOffset('top'), 3276 right: calculateOffset('right'), 3277 bottom: calculateOffset('bottom'), 3278 left: calculateOffset('left') 3279 }; 3280 } 3281 3282 function displace(broadcast) { 3283 offsets = calculateOffsets(); 3284 Drupal.displace.offsets = offsets; 3285 if (typeof broadcast === 'undefined' || broadcast) { 3286 $(document).trigger('drupalViewportOffsetChange', offsets); 3287 } 3288 return offsets; 3289 } 3290 3291 Drupal.behaviors.drupalDisplace = { 3292 attach: function attach() { 3293 if (this.displaceProcessed) { 3294 return; 3295 } 3296 this.displaceProcessed = true; 3297 3298 $(window).on('resize.drupalDisplace', debounce(displace, 200)); 3299 } 3300 }; 3301 3302 Drupal.displace = displace; 3303 $.extend(Drupal.displace, { 3304 offsets: offsets, 3305 3306 calculateOffset: calculateOffset 3307 }); 3308})(jQuery, Drupal, Drupal.debounce);; 3309/*! jQuery UI - v1.12.1 - 2017-03-31 3310* http://jqueryui.com 3311* Copyright jQuery Foundation and other contributors; Licensed */ 3312!function(a){"function"==typeof define&&define.amd?define(["jquery","./form","./version"],a):a(jQuery)}(function(a){return a.ui.formResetMixin={_formResetHandler:function(){var b=a(this);setTimeout(function(){var c=b.data("ui-form-reset-instances");a.each(c,function(){this.refresh()})})},_bindFormResetHandler:function(){if(this.form=this.element.form(),this.form.length){var a=this.form.data("ui-form-reset-instances")||[];a.length||this.form.on("reset.ui-form-reset",this._formResetHandler),a.push(this),this.form.data("ui-form-reset-instances",a)}},_unbindFormResetHandler:function(){if(this.form.length){var b=this.form.data("ui-form-reset-instances");b.splice(a.inArray(this,b),1),b.length?this.form.data("ui-form-reset-instances",b):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset")}}}});; 3313/*! jQuery UI - v1.12.1 - 2017-03-31 3314* http://jqueryui.com 3315* Copyright jQuery Foundation and other contributors; Licensed */ 3316!function(a){"function"==typeof define&&define.amd?define(["jquery","../escape-selector","../form-reset-mixin","../labels","../widget"],a):a(jQuery)}(function(a){return a.widget("ui.checkboxradio",[a.ui.formResetMixin,{version:"1.12.1",options:{disabled:null,label:null,icon:!0,classes:{"ui-checkboxradio-label":"ui-corner-all","ui-checkboxradio-icon":"ui-corner-all"}},_getCreateOptions:function(){var b,c,d=this,e=this._super()||{};return this._readType(),c=this.element.labels(),this.label=a(c[c.length-1]),this.label.length||a.error("No label found for checkboxradio widget"),this.originalLabel="",this.label.contents().not(this.element[0]).each(function(){d.originalLabel+=3===this.nodeType?a(this).text():this.outerHTML}),this.originalLabel&&(e.label=this.originalLabel),b=this.element[0].disabled,null!=b&&(e.disabled=b),e},_create:function(){var a=this.element[0].checked;this._bindFormResetHandler(),null==this.options.disabled&&(this.options.disabled=this.element[0].disabled),this._setOption("disabled",this.options.disabled),this._addClass("ui-checkboxradio","ui-helper-hidden-accessible"),this._addClass(this.label,"ui-checkboxradio-label","ui-button ui-widget"),"radio"===this.type&&this._addClass(this.label,"ui-checkboxradio-radio-label"),this.options.label&&this.options.label!==this.originalLabel?this._updateLabel():this.originalLabel&&(this.options.label=this.originalLabel),this._enhance(),a&&(this._addClass(this.label,"ui-checkboxradio-checked","ui-state-active"),this.icon&&this._addClass(this.icon,null,"ui-state-hover")),this._on({change:"_toggleClasses",focus:function(){this._addClass(this.label,null,"ui-state-focus ui-visual-focus")},blur:function(){this._removeClass(this.label,null,"ui-state-focus ui-visual-focus")}})},_readType:function(){var b=this.element[0].nodeName.toLowerCase();
vendor: 1,436 bytes, line 3316
3316this.type=this.element[0].type,"input"===b&&/radio|checkbox/.test(this.type)||a.error("Can't create checkboxradio on element.nodeName="+b+" and element.type="+this.type)},_enhance:function(){this._updateIcon(this.element[0].checked)},widget:function(){return this.label},_getRadioGroup:function(){var b,c=this.element[0].name,d="input[name='"+a.ui.escapeSelector(c)+"']";return c?(b=this.form.length?a(this.form[0].elements).filter(d):a(d).filter(function(){return 0===a(this).form().length}),b.not(this.element)):a([])},_toggleClasses:function(){var b=this.element[0].checked;this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",b),this.options.icon&&"checkbox"===this.type&&this._toggleClass(this.icon,null,"ui-icon-check ui-state-checked",b)._toggleClass(this.icon,null,"ui-icon-blank",!b),"radio"===this.type&&this._getRadioGroup().each(function(){var b=a(this).checkboxradio("instance");b&&b._removeClass(b.label,"ui-checkboxradio-checked","ui-state-active")})},_destroy:function(){this._unbindFormResetHandler(),this.icon&&(this.icon.remove(),this.iconSpace.remove())},_setOption:function(a,b){if("label"!==a||b)return this._super(a,b),"disabled"===a?(this._toggleClass(this.label,null,"ui-state-disabled",b),void(this.element[0].disabled=b)):void this.refresh()},_updateIcon:function(b){var c="ui-icon ui-icon-background ";this.options.icon?(this.icon||(this.icon=a("<span>"),this.iconSpace=a("<span> </span>
vendor: 5,364 bytes, lines 3316-3320
3316"),this._addClass(this.iconSpace,"ui-checkboxradio-icon-space")),"checkbox"===this.type?(c+=b?"ui-icon-check ui-state-checked":"ui-icon-blank",this._removeClass(this.icon,null,b?"ui-icon-blank":"ui-icon-check")):c+="ui-icon-blank",this._addClass(this.icon,"ui-checkboxradio-icon",c),b||this._removeClass(this.icon,null,"ui-icon-check ui-state-checked"),this.icon.prependTo(this.label).after(this.iconSpace)):void 0!==this.icon&&(this.icon.remove(),this.iconSpace.remove(),delete this.icon)},_updateLabel:function(){var a=this.label.contents().not(this.element[0]);this.icon&&(a=a.not(this.icon[0])),this.iconSpace&&(a=a.not(this.iconSpace[0])),a.remove(),this.label.append(this.options.label)},refresh:function(){var a=this.element[0].checked,b=this.element[0].disabled;this._updateIcon(a),this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",a),null!==this.options.label&&this._updateLabel(),b!==this.options.disabled&&this._setOptions({disabled:b})}}]),a.ui.checkboxradio});; 3317/*! jQuery UI - v1.12.1 - 2017-03-31 3318* http://jqueryui.com 3319* Copyright jQuery Foundation and other contributors; Licensed */ 3320!function(a){"function"==typeof define&&define.amd?define(["jquery","../widget"],a):a(jQuery)}(function(a){var b=/ui-corner-([a-z]){2,6}/g;return a.widget("ui.controlgroup",{version:"1.12.1",defaultElement:"<div>",options:{direction:"horizontal",disabled:null,onlyVisible:!0,items:{button:"input[type=button], input[type=submit], input[type=reset], button, a",controlgroupLabel:".ui-controlgroup-label",checkboxradio:"input[type='checkbox'], input[type='radio']",selectmenu:"select",spinner:".ui-spinner-input"}},_create:function(){this._enhance()},_enhance:function(){this.element.attr("role","toolbar"),this.refresh()},_destroy:function(){this._callChildMethod("destroy"),this.childWidgets.removeData("ui-controlgroup-data"),this.element.removeAttr("role"),this.options.items.controlgroupLabel&&this.element.find(this.options.items.controlgroupLabel).find(".ui-controlgroup-label-contents").contents().unwrap()},_initWidgets:function(){var b=this,c=[];a.each(this.options.items,function(d,e){var f,g={};if(e)return"controlgroupLabel"===d?(f=b.element.find(e),f.each(function(){var b=a(this);b.children(".ui-controlgroup-label-contents").length||b.contents().wrapAll("<span class='ui-controlgroup-label-contents'></span>")}),b._addClass(f,null,"ui-widget ui-widget-content ui-state-default"),void(c=c.concat(f.get()))):void(a.fn[d]&&(g=b["_"+d+"Options"]?b["_"+d+"Options"]("middle"):{classes:{}},b.element.find(e).each(function(){var e=a(this),f=e[d]("instance"),h=a.widget.extend({},g);if("button"!==d||!e.parent(".ui-spinner").length){f||(f=e[d]()[d]("instance")),f&&(h.classes=b._resolveClassesValues(h.classes,f)),e[d](h);var i=e[d]("widget");a.data(i[0],"ui-controlgroup-data",f?f:e[d]("instance")),c.push(i[0])}})))}),this.childWidgets=a(a.unique(c)),this._addClass(this.childWidgets,"ui-controlgroup-item")},_callChildMethod:function(b){this.childWidgets.each(function(){var c=a(this),d=c.data("ui-controlgroup-data");d&&d[b]&&d[b]()})},_updateCornerClass:function(a,b){var c="ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all",d=this._buildSimpleOptions(b,"label").classes.label;this._removeClass(a,null,c),this._addClass(a,null,d)},_buildSimpleOptions:function(a,b){var c="vertical"===this.options.direction,d={classes:{}};return d.classes[b]={middle:"",first:"ui-corner-"+(c?"top":"left"),last:"ui-corner-"+(c?"bottom":"right"),only:"ui-corner-all"}[a],d},_spinnerOptions:function(a){var b=this._buildSimpleOptions(a,"ui-spinner");return b.classes["ui-spinner-up"]="",b.classes["ui-spinner-down"]="",b},_buttonOptions:function(a){return this._buildSimpleOptions(a,"ui-button")},_checkboxradioOptions:function(a){return this._buildSimpleOptions(a,"ui-checkboxradio-label")},_selectmenuOptions:function(a){var b="vertical"===this.options.direction;return{width:!!b&&"auto",classes:{middle:{"ui-selectmenu-button-open":"","ui-selectmenu-button-closed":""},first:{"ui-selectmenu-button-open":"ui-corner-"+(b?"top":"tl"),"ui-selectmenu-button-closed":"ui-corner-"+(b?"top":"left")},last:{"ui-selectmenu-button-open":b?"":"ui-corner-tr","ui-selectmenu-button-closed":"ui-corner-"+(b?"bottom":"right")},only:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"}}[a]}},_resolveClassesValues:function(c,d){var e={};return a.each(c,function(f){var g=d.options.classes[f]||"";g=a.trim(g.replace(b,"")),e[f]=(g+" "+c[f]).replace(/\s+/g," ")}),e},_setOption:function(a,b){return"direction"===a&&this._removeClass("ui-controlgroup-"+this.options.direction),this._super(a,b),"disabled"===a?void this._callChildMethod(b?"disable":"enable"):void this.refresh()},refresh:function(){var b,c=this;this._addClass("ui-controlgroup ui-controlgroup-"+this.options.direction),"horizontal"===this.options.direction&&this._addClass(null,"ui-helper-clearfix"),this._initWidgets(),b=this.childWidgets,this.options.onlyVisible&&(b=b.filter(":visible")),b.length&&(a.each(["first","last"],function(a,d){var e=b[d]().data("ui-controlgroup-data");if(e&&c["_"+e.widgetName+"Options"]){var f=c["_"+e.widgetName+"Options"](1===b.length?"only":d);f.classes=c._resolveClassesValues(f.classes,e),e.element[e.widgetName](f)}else c._updateCornerClass(b[d](),d)}),this._callChildMethod("refresh"))}})});;
vendor: 2,197 bytes, lines 3321-3324
3321/*! jQuery UI - v1.12.1 - 2017-03-31 3322* http://jqueryui.com 3323* Copyright jQuery Foundation and other contributors; Licensed */ 3324!function(a){"function"==typeof define&&define.amd?define(["jquery","./controlgroup","./checkboxradio","../keycode","../widget"],a):a(jQuery)}(function(a){return a.widget("ui.button",{version:"1.12.1",defaultElement:"<button>",options:{classes:{"ui-button":"ui-corner-all"},disabled:null,icon:null,iconPosition:"beginning",label:null,showLabel:!0},_getCreateOptions:function(){var a,b=this._super()||{};return this.isInput=this.element.is("input"),a=this.element[0].disabled,null!=a&&(b.disabled=a),this.originalLabel=this.isInput?this.element.val():this.element.html(),this.originalLabel&&(b.label=this.originalLabel),b},_create:function(){!this.option.showLabel&!this.options.icon&&(this.options.showLabel=!0),null==this.options.disabled&&(this.options.disabled=this.element[0].disabled||!1),this.hasTitle=!!this.element.attr("title"),this.options.label&&this.options.label!==this.originalLabel&&(this.isInput?this.element.val(this.options.label):this.element.html(this.options.label)),this._addClass("ui-button","ui-widget"),this._setOption("disabled",this.options.disabled),this._enhance(),this.element.is("a")&&this._on({keyup:function(b){b.keyCode===a.ui.keyCode.SPACE&&(b.preventDefault(),this.element[0].click?this.element[0].click():this.element.trigger("click"))}})},_enhance:function(){this.element.is("button")||this.element.attr("role","button"),this.options.icon&&(this._updateIcon("icon",this.options.icon),this._updateTooltip())},_updateTooltip:function(){this.title=this.element.attr("title"),this.options.showLabel||this.title||this.element.attr("title",this.options.label)},_updateIcon:function(b,c){var d="iconPosition"!==b,e=d?this.options.iconPosition:c,f="top"===e||"bottom"===e;this.icon?d&&this._removeClass(this.icon,null,this.options.icon):(this.icon=a("<span>"),this._addClass(this.icon,"ui-button-icon","ui-icon"),this.options.showLabel||this._addClass("ui-button-icon-only")),d&&this._addClass(this.icon,null,c),this._attachIcon(e),f?(this._addClass(this.icon,null,"ui-widget-icon-block"),this.iconSpace&&this.iconSpace.remove()):(this.iconS
vendor: 7,041 bytes, lines 3324-3332
3324pace||(this.iconSpace=a("<span> </span>"),this._addClass(this.iconSpace,"ui-button-icon-space")),this._removeClass(this.icon,null,"ui-wiget-icon-block"),this._attachIconSpace(e))},_destroy:function(){this.element.removeAttr("role"),this.icon&&this.icon.remove(),this.iconSpace&&this.iconSpace.remove(),this.hasTitle||this.element.removeAttr("title")},_attachIconSpace:function(a){this.icon[/^(?:end|bottom)/.test(a)?"before":"after"](this.iconSpace)},_attachIcon:function(a){this.element[/^(?:end|bottom)/.test(a)?"append":"prepend"](this.icon)},_setOptions:function(a){var b=void 0===a.showLabel?this.options.showLabel:a.showLabel,c=void 0===a.icon?this.options.icon:a.icon;b||c||(a.showLabel=!0),this._super(a)},_setOption:function(a,b){"icon"===a&&(b?this._updateIcon(a,b):this.icon&&(this.icon.remove(),this.iconSpace&&this.iconSpace.remove())),"iconPosition"===a&&this._updateIcon(a,b),"showLabel"===a&&(this._toggleClass("ui-button-icon-only",null,!b),this._updateTooltip()),"label"===a&&(this.isInput?this.element.val(b):(this.element.html(b),this.icon&&(this._attachIcon(this.options.iconPosition),this._attachIconSpace(this.options.iconPosition)))),this._super(a,b),"disabled"===a&&(this._toggleClass(null,"ui-state-disabled",b),this.element[0].disabled=b,b&&this.element.blur())},refresh:function(){var a=this.element.is("input, button")?this.element[0].disabled:this.element.hasClass("ui-button-disabled");a!==this.options.disabled&&this._setOptions({disabled:a}),this._updateTooltip()}}),a.uiBackCompat!==!1&&(a.widget("ui.button",a.ui.button,{options:{text:!0,icons:{primary:null,secondary:null}},_create:function(){this.options.showLabel&&!this.options.text&&(this.options.showLabel=this.options.text),!this.options.showLabel&&this.options.text&&(this.options.text=this.options.showLabel),this.options.icon||!this.options.icons.primary&&!this.options.icons.secondary?this.options.icon&&(this.options.icons.primary=this.options.icon):this.options.icons.primary?this.options.icon=this.options.icons.primary:(this.options.icon=this.options.icons.secondary,this.options.iconPosition="end"),this._super()},_setOption:function(a,b){return"text"===a?void this._super("showLabel",b):("showLabel"===a&&(this.options.text=b),"icon"===a&&(this.options.icons.primary=b),"icons"===a&&(b.primary?(this._super("icon",b.primary),this._super("iconPosition","beginning")):b.secondary&&(this._super("icon",b.secondary),this._super("iconPosition","end"))),void this._superApply(arguments))}}),a.fn.button=function(b){return function(){return!this.length||this.length&&"INPUT"!==this[0].tagName||this.length&&"INPUT"===this[0].tagName&&"checkbox"!==this.attr("type")&&"radio"!==this.attr("type")?b.apply(this,arguments):(a.ui.checkboxradio||a.error("Checkboxradio widget missing"),0===arguments.length?this.checkboxradio({icon:!1}):this.checkboxradio.apply(this,arguments))}}(a.fn.button),a.fn.buttonset=function(){return a.ui.controlgroup||a.error("Controlgroup widget missing"),"option"===arguments[0]&&"items"===arguments[1]&&arguments[2]?this.controlgroup.apply(this,[arguments[0],"items.button",arguments[2]]):"option"===arguments[0]&&"items"===arguments[1]?this.controlgroup.apply(this,[arguments[0],"items.button"]):("object"==typeof arguments[0]&&arguments[0].items&&(arguments[0].items={button:arguments[0].items}),this.controlgroup.apply(this,arguments))}),a.ui.button});; 3325/*! jQuery UI - v1.12.1 - 2017-03-31 3326* http://jqueryui.com 3327* Copyright jQuery Foundation and other contributors; Licensed */ 3328!function(a){"function"==typeof define&&define.amd?define(["jquery","./version"],a):a(jQuery)}(function(a){return a.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase())});; 3329/*! jQuery UI - v1.12.1 - 2017-03-31 3330* http://jqueryui.com 3331* Copyright jQuery Foundation and other contributors; Licensed */ 3332!function(a){"function"==typeof define&&define.amd?define(["jquery","../ie","../version","../widget"],a):a(jQuery)}(function(a){var b=!1;return a(document).on("mouseup",function(){b=!1}),a.widget("ui.mouse",{version:"1.12.1",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var b=this;this.element.on("mousedown."+this.widgetName,function(a){return b._mouseDown(a)}).on("click."+this.widgetName,function(c){if(!0===a.data(c.target,b.widgetName+".preventClickEvent"))return a.removeData(c.target,b.widgetName+".preventClickEvent"),c.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(c){if(!b){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(c),this._mouseDownEvent=c;var d=this,e=1===c.which,f=!("string"!=typeof this.options.cancel||!c.target.nodeName)&&a(c.target).closest(this.options.cancel).length;return!(e&&!f&&this._mouseCapture(c))||(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){d.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(c)&&this._mouseDelayMet(c)&&(this._mouseStarted=this._mouseStart(c)!==!1,!this._mouseStarted)?(c.preventDefault(),!0):(!0===a.data(c.target,this.widgetName+".preventClickEvent")&&a.removeData(c.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(a){return d._mouseMove(a)},this._mouseUpDelegate=function(a){return d._mouseUp(a)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),c.preventDefault(),b=!0,!0))}},_mouseMove:function(b){if(this._mouseMoved){if(a.ui.ie&&(!document.documentMode||document.documentMode<9)&&!b.button)return this._mouseUp(b);if(!b.which)if(b.originalEvent.altKey||b.originalEvent.ctrlKey||b.originalEvent.metaKey||b.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(b)}return(b.which||b.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(b),b.preventDefault()):(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,b)!==!1,this._mouseStarted?this._mouseDrag(b):this._mouseUp(b)),!this._mouseStarted)},_mouseUp:function(c){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,c.target===this._mouseDownEvent.target&&a.data(c.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(c)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,b=!1,c.preventDefault()},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})});;
vendor: 5,705 bytes, lines 3333-3336
3333/*! jQuery UI - v1.12.1 - 2017-03-31 3334* http://jqueryui.com 3335* Copyright jQuery Foundation and other contributors; Licensed */ 3336!function(a){"function"==typeof define&&define.amd?define(["jquery","./mouse","../data","../plugin","../safe-active-element","../safe-blur","../scroll-parent","../version","../widget"],a):a(jQuery)}(function(a){return a.widget("ui.draggable",a.ui.mouse,{version:"1.12.1",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this._addClass("ui-draggable"),this._setHandleClassName(),this._mouseInit()},_setOption:function(a,b){this._super(a,b),"handle"===a&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){return(this.helper||this.element).is(".ui-draggable-dragging")?void(this.destroyOnClear=!0):(this._removeHandleClassName(),void this._mouseDestroy())},_mouseCapture:function(b){var c=this.options;return!(this.helper||c.disabled||a(b.target).closest(".ui-resizable-handle").length>0)&&(this.handle=this._getHandle(b),!!this.handle&&(this._blurActiveElement(b),this._blockFrames(c.iframeFix===!0?"iframe":c.iframeFix),!0))},_blockFrames:function(b){this.iframeBlocks=this.document.find(b).map(function(){var b=a(this);return a("<div>").css("position","absolute").appendTo(b.parent()).outerWidth(b.outerWidth()).outerHeight(b.outerHeight()).offset(b.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(b){var c=a.ui.safeActiveElement(this.document[0]),d=a(b.target);d.closest(c).length||a.ui.safeBlur(c)},_mouseStart:function(b){var c=this.options;return this.helper=this._createHelper(b),this._addClass(this.helper,"ui-draggable-dragging"),this._cacheHelperProportions(),a.ui.ddmanager&&(a.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=this.helper.parents().filter(function(){return"fixed"===a(this).css("position")}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(b),this.originalPosition=this.position=this._generatePosition(b,!1),this.originalPageX=b.pageX,this.originalPageY=b.pageY,c.cursorAt&&this._adjustOffsetFromHelper(c.cursorAt),this._setContainment(),this._trigger("start",b)===!1?(this._clear(),!1):(this._cacheHelperProportions(),a.ui.ddmanager&&!c.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b),this._mouseDrag(b,!0),a.ui.ddmanager&&a.ui.ddmanager.dragStart(this,b),!0)},_refreshOffsets:function(a){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:a.pageX-this.offset.left,top:a.pageY-this.offset.top}},_mouseDrag:function(b,c){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(b,!0),this.positionAbs=this._convertPositionTo("absolute"),!c){var d=this._uiHash();if(this._trigger("drag",b,d)===!1)return this._mouseUp(new a.Event("mouseup",b)),!1;this.position=d.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",a.ui.ddmanager&&a.ui.ddmanager.drag(this,b),!1},_mouseStop:function(b){var c=this,d=!1;return a.ui.ddmanager&&!this.options.dropBehaviour&&(d=a.ui.ddmanager.drop(this,b)),this.dropped&&(d=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!d||"valid"===this.options.revert&&d||this.options.revert===!0||a.isFunction(this.options.revert)&&this.options.revert.call(this.element,d)?a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){c._trigger("stop",b)!==!1&&c._clear()}):this._trigger("stop",b)!==!1&&this._clear(),!1},_mouseUp:function(b){return this._unblockFrames(),a.ui.ddmanager&&a.ui.ddmanager.dragStop(this,b),this.handleElement.is(b.target)&&this.element.trigger("focus"),a.ui.mouse.prototype._mouseUp.call(this,b)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp(new a.Event("mouseup",{target:this.element[0]})):this._clear(),this},_getHandle:function(b){return!this.options.handle||!!a(b.target).closest(this.element.find(this.options.handle)).length},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this._addClass(this.handleElement,"ui-draggable-handle")},_removeHandleClassName:function(){this._removeClass(this.handleElement,"ui-draggable-handle")},_createHelper:function(b){var c=this.options,d=a.isFunction(c.helper),e=d?a(c.helper.apply(this.element[0],[b])):"clone"===c.helper?this.element.clone().removeAttr("id"):this.element;return e.parents("body").length||e.appendTo("parent"===c.appendTo?this.element[0].parentNode:c.appendTo),d&&e[0]===this.element[0]&&this._setPositionRelative(),e[0]===this.element[0]||/(fixed|absolute)/.test(e.css("position"))||e.css("position","absolute"),e},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(b){"string"==typeof b&&(b=b.split(" ")),a.isArray(b)&&(b={left:+b[0],top:+b[1]||0}
vendor: 4,649 bytes, line 3336
3336),"left"in b&&(this.offset.click.left=b.left+this.margins.left),"right"in b&&(this.offset.click.left=this.helperProportions.width-b.right+this.margins.left),"top"in b&&(this.offset.click.top=b.top+this.margins.top),"bottom"in b&&(this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top)},_isRootNode:function(a){return/(html|body)/i.test(a.tagName)||a===this.document[0]},_getParentOffset:function(){var b=this.offsetParent.offset(),c=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==c&&a.contains(this.scrollParent[0],this.offsetParent[0])&&(b.left+=this.scrollParent.scrollLeft(),b.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(b={top:0,left:0}),{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var a=this.element.position(),b=this._isRootNode(this.scrollParent[0]);return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+(b?0:this.scrollParent.scrollTop()),left:a.left-(parseInt(this.helper.css("left"),10)||0)+(b?0:this.scrollParent.scrollLeft())}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var b,c,d,e=this.options,f=this.document[0];return this.relativeContainer=null,e.containment?"window"===e.containment?void(this.containment=[a(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,a(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,a(window).scrollLeft()+a(window).width()-this.helperProportions.width-this.margins.left,a(window).scrollTop()+(a(window).height()||f.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]):"document"===e.containment?void(this.containment=[0,0,a(f).width()-this.helperProportions.width-this.margins.left,(a(f).height()||f.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]):e.containment.constructor===Array?void(this.containment=e.containment):("parent"===e.containment&&(e.containment=this.helper[0].parentNode),c=a(e.containment),d=c[0],void(d&&(b=/(scroll|auto)/.test(c.css("overflow")),this.containment=[(parseInt(c.css("borderLeftWidth"),10)||0)+(parseInt(c.css("paddingLeft"),10)||0),(parseInt(c.css("borderTopWidth"),10)||0)+(parseInt(c.css("paddingTop"),10)||0),(b?Math.max(d.scrollWidth,d.offsetWidth):d.offsetWidth)-(parseInt(c.css("borderRightWidth"),10)||0)-(parseInt(c.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(b?Math.max(d.scrollHeight,d.offsetHeight):d.offsetHeight)-(parseInt(c.css("borderBottomWidth"),10)||0)-(parseInt(c.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=c))):void(this.containment=null)},_convertPositionTo:function(a,b){b||(b=this.position);var c="absolute"===a?1:-1,d=this._isRootNode(this.scrollParent[0]);return{top:b.top+this.offset.relative.top*c+this.offset.parent.top*c-("fixed"===this.cssPosition?-this.offset.scroll.top:d?0:this.offset.scroll.top)*c,left:b.left+this.offset.relative.left*c+this.offset.parent.left*c-("fixed"===this.cssPosition?-this.offset.scroll.left:d?0:this.offset.scroll.left)*c}},_generatePosition:function(a,b){var c,d,e,f,g=this.options,h=this._isRootNode(this.scrollParent[0]),i=a.pageX,j=a.pageY;return h&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),b&&(this.containment&&(this.relativeContainer?(d=this.relativeContainer.offset(),c=[this.containment[0]+d.left,this.containment[1]+d.top,this.containment[2]+d.left,this.containment[3]+d.top]):c=this.containment,a.pageX-this.offset.click.left<c[0]&&(i=c[0]+this.offset.click.left),a.pageY-this.offset.click.top<c[1]&&(j=c[1]+this.offset.click.top),a.pageX-this.offset.click.left>c[2]&&(i=c[2]+this.offset.click.left),a.pageY-this.offset.click.top>c[3]&&(j=c[3]+this.offset.click.top)),g.grid&&(e=g.grid[1]?this.originalPageY+Math.round((j-this.originalPageY)/g.grid[1])*g.grid[1]:this.originalPageY,j=c?e-this.offset.click.top>=c[1]||e-this.offset.click.top>c[3]?e:e-this.offset.click.top>=c[1]?e-g.grid[1]:e+g.grid[1]:e,f=g.grid[0]?this.originalPageX+Math.round((i-this.originalPageX)
vendor: 5,728 bytes, line 3336
3336/g.grid[0])*g.grid[0]:this.originalPageX,i=c?f-this.offset.click.left>=c[0]||f-this.offset.click.left>c[2]?f:f-this.offset.click.left>=c[0]?f-g.grid[0]:f+g.grid[0]:f),"y"===g.axis&&(i=this.originalPageX),"x"===g.axis&&(j=this.originalPageY)),{top:j-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:h?0:this.offset.scroll.top),left:i-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:h?0:this.offset.scroll.left)}},_clear:function(){this._removeClass(this.helper,"ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_trigger:function(b,c,d){return d=d||this._uiHash(),a.ui.plugin.call(this,b,[c,d,this],!0),/^(drag|start|stop)/.test(b)&&(this.positionAbs=this._convertPositionTo("absolute"),d.offset=this.positionAbs),a.Widget.prototype._trigger.call(this,b,c,d)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),a.ui.plugin.add("draggable","connectToSortable",{start:function(b,c,d){var e=a.extend({},c,{item:d.element});d.sortables=[],a(d.options.connectToSortable).each(function(){var c=a(this).sortable("instance");c&&!c.options.disabled&&(d.sortables.push(c),c.refreshPositions(),c._trigger("activate",b,e))})},stop:function(b,c,d){var e=a.extend({},c,{item:d.element});d.cancelHelperRemoval=!1,a.each(d.sortables,function(){var a=this;a.isOver?(a.isOver=0,d.cancelHelperRemoval=!0,a.cancelHelperRemoval=!1,a._storedCSS={position:a.placeholder.css("position"),top:a.placeholder.css("top"),left:a.placeholder.css("left")},a._mouseStop(b),a.options.helper=a.options._helper):(a.cancelHelperRemoval=!0,a._trigger("deactivate",b,e))})},drag:function(b,c,d){a.each(d.sortables,function(){var e=!1,f=this;f.positionAbs=d.positionAbs,f.helperProportions=d.helperProportions,f.offset.click=d.offset.click,f._intersectsWith(f.containerCache)&&(e=!0,a.each(d.sortables,function(){return this.positionAbs=d.positionAbs,this.helperProportions=d.helperProportions,this.offset.click=d.offset.click,this!==f&&this._intersectsWith(this.containerCache)&&a.contains(f.element[0],this.element[0])&&(e=!1),e})),e?(f.isOver||(f.isOver=1,d._parent=c.helper.parent(),f.currentItem=c.helper.appendTo(f.element).data("ui-sortable-item",!0),f.options._helper=f.options.helper,f.options.helper=function(){return c.helper[0]},b.target=f.currentItem[0],f._mouseCapture(b,!0),f._mouseStart(b,!0,!0),f.offset.click.top=d.offset.click.top,f.offset.click.left=d.offset.click.left,f.offset.parent.left-=d.offset.parent.left-f.offset.parent.left,f.offset.parent.top-=d.offset.parent.top-f.offset.parent.top,d._trigger("toSortable",b),d.dropped=f.element,a.each(d.sortables,function(){this.refreshPositions()}),d.currentItem=d.element,f.fromOutside=d),f.currentItem&&(f._mouseDrag(b),c.position=f.position)):f.isOver&&(f.isOver=0,f.cancelHelperRemoval=!0,f.options._revert=f.options.revert,f.options.revert=!1,f._trigger("out",b,f._uiHash(f)),f._mouseStop(b,!0),f.options.revert=f.options._revert,f.options.helper=f.options._helper,f.placeholder&&f.placeholder.remove(),c.helper.appendTo(d._parent),d._refreshOffsets(b),c.position=d._generatePosition(b,!0),d._trigger("fromSortable",b),d.dropped=!1,a.each(d.sortables,function(){this.refreshPositions()}))})}}),a.ui.plugin.add("draggable","cursor",{start:function(b,c,d){var e=a("body"),f=d.options;e.css("cursor")&&(f._cursor=e.css("cursor")),e.css("cursor",f.cursor)},stop:function(b,c,d){var e=d.options;e._cursor&&a("body").css("cursor",e._cursor)}}),a.ui.plugin.add("draggable","opacity",{start:function(b,c,d){var e=a(c.helper),f=d.options;e.css("opacity")&&(f._opacity=e.css("opacity")),e.css("opacity",f.opacity)},stop:function(b,c,d){var e=d.options;e._opacity&&a(c.helper).css("opacity",e._opacity)}}),a.ui.plugin.add("draggable","scroll",{start:function(a,b,c){c.scrollParentNotHidden||(c.scrollParentNotHidden=c.helper.scrollParent(!1)),c.scrollParentNotHidden[0]!==c.document[0]&&"HTML"!==c.scrollParentNotHidden[0].tagName&&(c.overflowOffset=c.scrollParentNotHidden.offset())},drag:function(b,c,d){var e=d.options,f=!1,g=d.scrollParentNotHidden[0],h=d.document[0];g!==h&&"HTML"!==g.tagName?(e.axis&&"x"===e.axis||(d.overflowOffset.top+g.offsetHeight-b.pageY<e.scrollSensitivity?g.scrollTop=f=g.scrollTop+e.scrollSpeed:b.pageY-d.overflowOffset.top<e.scrollSensitivity&&(g.scrollTop=f=g.scrollTop-e.scrollSpeed)),e.axis&&"y"===e.axis||(d.overflowOffset.left+g.offsetWidth-b.pageX<e.scrollSensitivity?g.scrollLeft=f=g.scrollLeft+e.scrollSpeed:b.pageX-d.overflowOffset.left<e.scrollSensitivity&&(g.scrollLeft=f=g.scrollLeft-e.scrollSpeed))):(e.axis&&"x"===e.axis||(b.pageY-a(h).scrollTop()<e.scrollSensitivity?f=a(h).scrollTop(a(h).scrollTop()-e.scrollSpeed):a(window).height()-(b.pageY-a(h).scrollTop())<e.scrollSensitivity&&(f=a(h).scrollTop(a(h).scrollTop()+e.scrollSpeed))),e.axis&&"y"===e.axis||(b.pageX-a(h).scrollLeft()<e.scrollSensitivity?f=a(h).scrollLeft(a(h).scrollLeft()-e.scrollSpeed):a(window).width()-(b.pageX-a(h).scrollLeft())<e.scrollSensitivity&&(f=a(h).scrollLeft(a(h).scrollLeft()+e.scrollSpeed)))),f!==!1&&a.ui.ddmanager&&!e.dropBehaviour&&a.ui.ddmanager.prepareOffsets(d,b)}}),a.ui.plugin.add("draggable","snap",{start:function(b,c,d){var e=d.options;d.snapElements=[],a(e.snap.constructor!==String?e.snap.items||":data(ui-draggable)":e.snap).each(function(){var b=a(this),c=b.offset();this!==d.element[0]&&d.snapElements.push({item:this,width:b.outerWidth(),height:b.outerHeight(),top:c.top,left
vendor: 5,816 bytes, lines 3336-3340
3336:c.left})})},drag:function(b,c,d){var e,f,g,h,i,j,k,l,m,n,o=d.options,p=o.snapTolerance,q=c.offset.left,r=q+d.helperProportions.width,s=c.offset.top,t=s+d.helperProportions.height;for(m=d.snapElements.length-1;m>=0;m--)i=d.snapElements[m].left-d.margins.left,j=i+d.snapElements[m].width,k=d.snapElements[m].top-d.margins.top,l=k+d.snapElements[m].height,r<i-p||q>j+p||t<k-p||s>l+p||!a.contains(d.snapElements[m].item.ownerDocument,d.snapElements[m].item)?(d.snapElements[m].snapping&&d.options.snap.release&&d.options.snap.release.call(d.element,b,a.extend(d._uiHash(),{snapItem:d.snapElements[m].item})),d.snapElements[m].snapping=!1):("inner"!==o.snapMode&&(e=Math.abs(k-t)<=p,f=Math.abs(l-s)<=p,g=Math.abs(i-r)<=p,h=Math.abs(j-q)<=p,e&&(c.position.top=d._convertPositionTo("relative",{top:k-d.helperProportions.height,left:0}).top),f&&(c.position.top=d._convertPositionTo("relative",{top:l,left:0}).top),g&&(c.position.left=d._convertPositionTo("relative",{top:0,left:i-d.helperProportions.width}).left),h&&(c.position.left=d._convertPositionTo("relative",{top:0,left:j}).left)),n=e||f||g||h,"outer"!==o.snapMode&&(e=Math.abs(k-s)<=p,f=Math.abs(l-t)<=p,g=Math.abs(i-q)<=p,h=Math.abs(j-r)<=p,e&&(c.position.top=d._convertPositionTo("relative",{top:k,left:0}).top),f&&(c.position.top=d._convertPositionTo("relative",{top:l-d.helperProportions.height,left:0}).top),g&&(c.position.left=d._convertPositionTo("relative",{top:0,left:i}).left),h&&(c.position.left=d._convertPositionTo("relative",{top:0,left:j-d.helperProportions.width}).left)),!d.snapElements[m].snapping&&(e||f||g||h||n)&&d.options.snap.snap&&d.options.snap.snap.call(d.element,b,a.extend(d._uiHash(),{snapItem:d.snapElements[m].item})),d.snapElements[m].snapping=e||f||g||h||n)}}),a.ui.plugin.add("draggable","stack",{start:function(b,c,d){var e,f=d.options,g=a.makeArray(a(f.stack)).sort(function(b,c){return(parseInt(a(b).css("zIndex"),10)||0)-(parseInt(a(c).css("zIndex"),10)||0)});g.length&&(e=parseInt(a(g[0]).css("zIndex"),10)||0,a(g).each(function(b){a(this).css("zIndex",e+b)}),this.css("zIndex",e+g.length))}}),a.ui.plugin.add("draggable","zIndex",{start:function(b,c,d){var e=a(c.helper),f=d.options;e.css("zIndex")&&(f._zIndex=e.css("zIndex")),e.css("zIndex",f.zIndex)},stop:function(b,c,d){var e=d.options;e._zIndex&&a(c.helper).css("zIndex",e._zIndex)}}),a.ui.draggable});; 3337/*! jQuery UI - v1.12.1 - 2017-03-31 3338* http://jqueryui.com 3339* Copyright jQuery Foundation and other contributors; Licensed */ 3340!function(a){"function"==typeof define&&define.amd?define(["jquery","./version"],a):a(jQuery)}(function(a){return function(){function b(a,b,c){return[parseFloat(a[0])*(l.test(a[0])?b/100:1),parseFloat(a[1])*(l.test(a[1])?c/100:1)]}function c(b,c){return parseInt(a.css(b,c),10)||0}function d(b){var c=b[0];return 9===c.nodeType?{width:b.width(),height:b.height(),offset:{top:0,left:0}}:a.isWindow(c)?{width:b.width(),height:b.height(),offset:{top:b.scrollTop(),left:b.scrollLeft()}}:c.preventDefault?{width:0,height:0,offset:{top:c.pageY,left:c.pageX}}:{width:b.outerWidth(),height:b.outerHeight(),offset:b.offset()}}var e,f=Math.max,g=Math.abs,h=/left|center|right/,i=/top|center|bottom/,j=/[\+\-]\d+(\.[\d]+)?%?/,k=/^\w+/,l=/%$/,m=a.fn.position;a.position={scrollbarWidth:function(){if(void 0!==e)return e;var b,c,d=a("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),f=d.children()[0];return a("body").append(d),b=f.offsetWidth,d.css("overflow","scroll"),c=f.offsetWidth,b===c&&(c=d[0].clientWidth),d.remove(),e=b-c},getScrollInfo:function(b){var c=b.isWindow||b.isDocument?"":b.element.css("overflow-x"),d=b.isWindow||b.isDocument?"":b.element.css("overflow-y"),e="scroll"===c||"auto"===c&&b.width<b.element[0].scrollWidth,f="scroll"===d||"auto"===d&&b.height<b.element[0].scrollHeight;return{width:f?a.position.scrollbarWidth():0,height:e?a.position.scrollbarWidth():0}},getWithinInfo:function(b){var c=a(b||window),d=a.isWindow(c[0]),e=!!c[0]&&9===c[0].nodeType,f=!d&&!e;return{element:c,isWindow:d,isDocument:e,offset:f?a(b).offset():{left:0,top:0},scrollLeft:c.scrollLeft(),scrollTop:c.scrollTop(),width:c.outerWidth(),height:c.outerHeight()}}},a.fn.position=function(e){if(!e||!e.of)return m.apply(this,arguments);e=a.extend({},e);var l,n,o,p,q,r,s=a(e.of),t=a.position.getWithinInfo(e.within),u=a.position.getScrollInfo(t),v=(e.collision||"flip").split(" "),w={};return r=d(s),s[0].preventDefault&&(e.at="left top"),n=r.width,o=r.height,p=r.offset,q=a.extend({},p),a.each(["my","at"],function(){var a,b,c=(e[this]||"").split(" ");1===c.length&&(c=h.test(c[0])?c.concat(["center"]):i.test(c[0])?["center"].concat(c):["center","center"]),c[0]=h.test(c[0])?c[0]:"center",c[1]=i.test(c[1])?c[1]:"center",a=j.exec(c[0]),b=j.exec(c[1]),w[this]=[a?a[0]:0,b?b[0]:0],e[this]=[k.exec(c[0])[0],k.exec(c[1])[0]]}),1===v.length&&(v[1]=v[0]),"right"===e.at[0]?q.left+=n:"center"===e.at[0]&&(q.left+=n/2),"bottom"===e.at[1]?q.top+=o:"center"===e.at[1]&&(q.top+=o/2),l=b(w.at,n,o),q.left+=l[0],q.top+=l[1],this.each(function(){var d,h,i=a(this),j=i.outerWidth(),k=i.outerHeight(),m=c(this,"marginLeft"),r=c(this,"marginTop"),x=j+m+c(this,"marginRight")+u.width,y=k+r+c(this,"marginBottom")+u.height,z=a.extend({},q),A=b(w.my,i.outerWidth(),i.outerHeight());"right"===e.my[0]?z.left-=j:"center"===e.my[0]&&(z.left-=j/2),"bottom"===e.my[1]?z.top-=k:"center"===e.my[1]&&(z.top-=k/2),z.left+=A[0],z.top+=A[1],d={marginLeft:m,marginTop:r},a.each(["left","top"],function(b,c){a.ui.position[v[b]]&&a.ui.position[v[b]][c](z,{targetWidth:n,targetHeight:o,elemWidth:j,elemHeight:k,collisionPosition:d,collisionWidth:x,collisionHeight:y,offset:[l[0]+A[0],l[1]+A[1]],my:e.my,at:e.at,within:t,elem:i})}),e.using&&(h=function(a){var b=p.left-z.left,c=b+n-j,d=p.top-z.to
vendor: 1,339 bytes, line 3340
3340p,h=d+o-k,l={target:{element:s,left:p.left,top:p.top,width:n,height:o},element:{element:i,left:z.left,top:z.top,width:j,height:k},horizontal:c<0?"left":b>0?"right":"center",vertical:h<0?"top":d>0?"bottom":"middle"};n<j&&g(b+c)<n&&(l.horizontal="center"),o<k&&g(d+h)<o&&(l.vertical="middle"),f(g(b),g(c))>f(g(d),g(h))?l.important="horizontal":l.important="vertical",e.using.call(this,a,l)}),i.offset(a.extend(z,{using:h}))})},a.ui.position={fit:{left:function(a,b){var c,d=b.within,e=d.isWindow?d.scrollLeft:d.offset.left,g=d.width,h=a.left-b.collisionPosition.marginLeft,i=e-h,j=h+b.collisionWidth-g-e;b.collisionWidth>g?i>0&&j<=0?(c=a.left+i+b.collisionWidth-g-e,a.left+=i-c):j>0&&i<=0?a.left=e:i>j?a.left=e+g-b.collisionWidth:a.left=e:i>0?a.left+=i:j>0?a.left-=j:a.left=f(a.left-h,a.left)},top:function(a,b){var c,d=b.within,e=d.isWindow?d.scrollTop:d.offset.top,g=b.within.height,h=a.top-b.collisionPosition.marginTop,i=e-h,j=h+b.collisionHeight-g-e;b.collisionHeight>g?i>0&&j<=0?(c=a.top+i+b.collisionHeight-g-e,a.top+=i-c):j>0&&i<=0?a.top=e:i>j?a.top=e+g-b.collisionHeight:a.top=e:i>0?a.top+=i:j>0?a.top-=j:a.top=f(a.top-h,a.top)}},flip:{left:function(a,b){var c,d,e=b.within,f=e.offset.left+e.scrollLeft,h=e.width,i=e.isWindow?e.scrollLeft:e.offset.left,j=a.left-b.collisionPosition.marginLeft,k=j-i,l=j+b.collisionWidth-h-i,m="left"
vendor: 5,361 bytes, lines 3340-3344
3340===b.my[0]?-b.elemWidth:"right"===b.my[0]?b.elemWidth:0,n="left"===b.at[0]?b.targetWidth:"right"===b.at[0]?-b.targetWidth:0,o=-2*b.offset[0];k<0?(c=a.left+m+n+o+b.collisionWidth-h-f,(c<0||c<g(k))&&(a.left+=m+n+o)):l>0&&(d=a.left-b.collisionPosition.marginLeft+m+n+o-i,(d>0||g(d)<l)&&(a.left+=m+n+o))},top:function(a,b){var c,d,e=b.within,f=e.offset.top+e.scrollTop,h=e.height,i=e.isWindow?e.scrollTop:e.offset.top,j=a.top-b.collisionPosition.marginTop,k=j-i,l=j+b.collisionHeight-h-i,m="top"===b.my[1],n=m?-b.elemHeight:"bottom"===b.my[1]?b.elemHeight:0,o="top"===b.at[1]?b.targetHeight:"bottom"===b.at[1]?-b.targetHeight:0,p=-2*b.offset[1];k<0?(d=a.top+n+o+p+b.collisionHeight-h-f,(d<0||d<g(k))&&(a.top+=n+o+p)):l>0&&(c=a.top-b.collisionPosition.marginTop+n+o+p-i,(c>0||g(c)<l)&&(a.top+=n+o+p))}},flipfit:{left:function(){a.ui.position.flip.left.apply(this,arguments),a.ui.position.fit.left.apply(this,arguments)},top:function(){a.ui.position.flip.top.apply(this,arguments),a.ui.position.fit.top.apply(this,arguments)}}}}(),a.ui.position});; 3341/*! jQuery UI - v1.12.1 - 2017-03-31 3342* http://jqueryui.com 3343* Copyright jQuery Foundation and other contributors; Licensed */ 3344!function(a){"function"==typeof define&&define.amd?define(["jquery","./mouse","../disable-selection","../plugin","../version","../widget"],a):a(jQuery)}(function(a){return a.widget("ui.resizable",a.ui.mouse,{version:"1.12.1",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,classes:{"ui-resizable-se":"ui-icon ui-icon-gripsmall-diagonal-se"},containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(a){return parseFloat(a)||0},_isNumber:function(a){return!isNaN(parseFloat(a))},_hasScroll:function(b,c){if("hidden"===a(b).css("overflow"))return!1;var d=c&&"left"===c?"scrollLeft":"scrollTop",e=!1;return b[d]>0||(b[d]=1,e=b[d]>0,b[d]=0,e)},_create:function(){var b,c=this.options,d=this;this._addClass("ui-resizable"),a.extend(this,{_aspectRatio:!!c.aspectRatio,aspectRatio:c.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:c.helper||c.ghost||c.animate?c.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(a("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,b={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")},this.element.css(b),this.originalElement.css("margin",0),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css(b),this._proportionallyResize()),this._setupHandles(),c.autoHide&&a(this.element).on("mouseenter",function(){c.disabled||(d._removeClass("ui-resizable-autohide"),d._handles.show())}).on("mouseleave",function(){c.disabled||d.resizing||(d._addClass("ui-resizable-autohide"),d._handles.hide())}),this._mouseInit()},_destroy:function(){this._mouseDestroy();var b,c=function(b){a(b).removeData("resizable").removeData("ui-resizable").off(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(c(this.element),b=this.element,this.originalElement.css({position:b.css("position"),width:b.outerWidth(),height:b.outerHeight(),top:b.css("top"),left:b.css("left")}).insertAfter(b),b.remove()),this.originalElement.css("resize",this.originalResizeStyle),c(this.originalElement),this},_setOption:function(a,b){switch(this._super(a,b),a){case"handles":this._removeHandles(),this._setupHandles()}},_setupHandles:function(){var b,c,d,e,f,g=this.options,h=this;if(this.handles=g.handles||(a(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=a(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),d=this.handles.split(","),this.handles={},c=0;c<d.length;c++)b=a.trim(d[c]),e="ui-resizable-"+b,f=a("<div>"),this._addClass(f,"ui-resizable-handle "+e),f.css({zIndex:g.zIndex}),this.handles[b]=".ui-resizable-"+b,this.element.append(f);this._renderAxis=function(b){var c,d,e,f;b=b||this.element;for(c in this.handles)this.handles[c].constructor===String?this.handles[c]=this.element.children(this.handles[c]).first().show():(this.handles[c].jquery||this.handles[c].nodeType)&&(this.handles[c]=a(this.handles[c]),this._on(this.handles[c],{mousedown:h._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(d=a(this.handles[c],this.element),f=/sw|ne|nw|se|n|s/.test(c)?d.outerHeight():d.outerWidth(),e=["padding",/ne|nw|n
vendor: 4,356 bytes, line 3344
3344/.test(c)?"Top":/se|sw|s/.test(c)?"Bottom":/^e$/.test(c)?"Right":"Left"].join(""),b.css(e,f),this._proportionallyResize()),this._handles=this._handles.add(this.handles[c])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.on("mouseover",function(){h.resizing||(this.className&&(f=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),h.axis=f&&f[1]?f[1]:"se")}),g.autoHide&&(this._handles.hide(),this._addClass("ui-resizable-autohide"))},_removeHandles:function(){this._handles.remove()},_mouseCapture:function(b){var c,d,e=!1;for(c in this.handles)d=a(this.handles[c])[0],(d===b.target||a.contains(d,b.target))&&(e=!0);return!this.options.disabled&&e},_mouseStart:function(b){var c,d,e,f=this.options,g=this.element;return this.resizing=!0,this._renderProxy(),c=this._num(this.helper.css("left")),d=this._num(this.helper.css("top")),f.containment&&(c+=a(f.containment).scrollLeft()||0,d+=a(f.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:c,top:d},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:g.width(),height:g.height()},this.originalSize=this._helper?{width:g.outerWidth(),height:g.outerHeight()}:{width:g.width(),height:g.height()},this.sizeDiff={width:g.outerWidth()-g.width(),height:g.outerHeight()-g.height()},this.originalPosition={left:c,top:d},this.originalMousePosition={left:b.pageX,top:b.pageY},this.aspectRatio="number"==typeof f.aspectRatio?f.aspectRatio:this.originalSize.width/this.originalSize.height||1,e=a(".ui-resizable-"+this.axis).css("cursor"),a("body").css("cursor","auto"===e?this.axis+"-resize":e),this._addClass("ui-resizable-resizing"),this._propagate("start",b),!0},_mouseDrag:function(b){var c,d,e=this.originalMousePosition,f=this.axis,g=b.pageX-e.left||0,h=b.pageY-e.top||0,i=this._change[f];return this._updatePrevProperties(),!!i&&(c=i.apply(this,[b,g,h]),this._updateVirtualBoundaries(b.shiftKey),(this._aspectRatio||b.shiftKey)&&(c=this._updateRatio(c,b)),c=this._respectSize(c,b),this._updateCache(c),this._propagate("resize",b),d=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),a.isEmptyObject(d)||(this._updatePrevProperties(),this._trigger("resize",b,this.ui()),this._applyChanges()),!1)},_mouseStop:function(b){this.resizing=!1;var c,d,e,f,g,h,i,j=this.options,k=this;return this._helper&&(c=this._proportionallyResizeElements,d=c.length&&/textarea/i.test(c[0].nodeName),e=d&&this._hasScroll(c[0],"left")?0:k.sizeDiff.height,f=d?0:k.sizeDiff.width,g={width:k.helper.width()-f,height:k.helper.height()-e},h=parseFloat(k.element.css("left"))+(k.position.left-k.originalPosition.left)||null,i=parseFloat(k.element.css("top"))+(k.position.top-k.originalPosition.top)||null,j.animate||this.element.css(a.extend(g,{top:i,left:h})),k.helper.height(k.size.height),k.helper.width(k.size.width),this._helper&&!j.animate&&this._proportionallyResize()),a("body").css("cursor","auto"),this._removeClass("ui-resizable-resizing"),this._propagate("stop",b),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var a={};return this.position.top!==this.prevPosition.top&&(a.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(a.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(a.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(a.height=this.size.height+"px"),this.helper.css(a),a},_updateVirtualBoundaries:function(a){var b,c,d,e,f,g=this.options;f={minWidth:this._isNumber(g.minWidth)?g.minWidth:0,maxWidth:this._isNumber(g.maxWidth)?g.maxWidth:1/0,minHeight:this._isNumber(g.minHeight)?g.minHeight:0,maxHeight:this._isNumber(g.maxHeight)?g.maxHeight:1/0},(this._aspectRatio||a)&&(b=f.minHeight*this.aspectRatio,d=f.minWidth/this.aspectRatio,c=f.maxHeight*this.aspectRatio,e=f.maxWidth/this.aspectRatio,b>f.minWidth&&(f.minWidth=b),d>f.minHeight&&(f.minHeight=d),c<f.maxWidth&&(f.maxWidth=c),e<f.maxHeight&&(f.maxHeight=e)),this._vBoundaries=f},_updateCache:function(a){this.offset=this.helper.offset(),this._isNumber(a.left)&&(this.position.left
vendor: 16,027 bytes, lines 3344-3348
3344=a.left),this._isNumber(a.top)&&(this.position.top=a.top),this._isNumber(a.height)&&(this.size.height=a.height),this._isNumber(a.width)&&(this.size.width=a.width)},_updateRatio:function(a){var b=this.position,c=this.size,d=this.axis;return this._isNumber(a.height)?a.width=a.height*this.aspectRatio:this._isNumber(a.width)&&(a.height=a.width/this.aspectRatio),"sw"===d&&(a.left=b.left+(c.width-a.width),a.top=null),"nw"===d&&(a.top=b.top+(c.height-a.height),a.left=b.left+(c.width-a.width)),a},_respectSize:function(a){var b=this._vBoundaries,c=this.axis,d=this._isNumber(a.width)&&b.maxWidth&&b.maxWidth<a.width,e=this._isNumber(a.height)&&b.maxHeight&&b.maxHeight<a.height,f=this._isNumber(a.width)&&b.minWidth&&b.minWidth>a.width,g=this._isNumber(a.height)&&b.minHeight&&b.minHeight>a.height,h=this.originalPosition.left+this.originalSize.width,i=this.originalPosition.top+this.originalSize.height,j=/sw|nw|w/.test(c),k=/nw|ne|n/.test(c);return f&&(a.width=b.minWidth),g&&(a.height=b.minHeight),d&&(a.width=b.maxWidth),e&&(a.height=b.maxHeight),f&&j&&(a.left=h-b.minWidth),d&&j&&(a.left=h-b.maxWidth),g&&k&&(a.top=i-b.minHeight),e&&k&&(a.top=i-b.maxHeight),a.width||a.height||a.left||!a.top?a.width||a.height||a.top||!a.left||(a.left=null):a.top=null,a},_getPaddingPlusBorderDimensions:function(a){for(var b=0,c=[],d=[a.css("borderTopWidth"),a.css("borderRightWidth"),a.css("borderBottomWidth"),a.css("borderLeftWidth")],e=[a.css("paddingTop"),a.css("paddingRight"),a.css("paddingBottom"),a.css("paddingLeft")];b<4;b++)c[b]=parseFloat(d[b])||0,c[b]+=parseFloat(e[b])||0;return{height:c[0]+c[2],width:c[1]+c[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var a,b=0,c=this.helper||this.element;b<this._proportionallyResizeElements.length;b++)a=this._proportionallyResizeElements[b],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(a)),a.css({height:c.height()-this.outerDimensions.height||0,width:c.width()-this.outerDimensions.width||0})},_renderProxy:function(){var b=this.element,c=this.options;this.elementOffset=b.offset(),this._helper?(this.helper=this.helper||a("<div style='overflow:hidden;'></div>"),this._addClass(this.helper,this._helper),this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++c.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(a,b){return{width:this.originalSize.width+b}},w:function(a,b){var c=this.originalSize,d=this.originalPosition;return{left:d.left+b,width:c.width-b}},n:function(a,b,c){var d=this.originalSize,e=this.originalPosition;return{top:e.top+c,height:d.height-c}},s:function(a,b,c){return{height:this.originalSize.height+c}},se:function(b,c,d){return a.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,c,d]))},sw:function(b,c,d){return a.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,c,d]))},ne:function(b,c,d){return a.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[b,c,d]))},nw:function(b,c,d){return a.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,c,d]))}},_propagate:function(b,c){a.ui.plugin.call(this,b,[c,this.ui()]),"resize"!==b&&this._trigger(b,c,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),a.ui.plugin.add("resizable","animate",{stop:function(b){var c=a(this).resizable("instance"),d=c.options,e=c._proportionallyResizeElements,f=e.length&&/textarea/i.test(e[0].nodeName),g=f&&c._hasScroll(e[0],"left")?0:c.sizeDiff.height,h=f?0:c.sizeDiff.width,i={width:c.size.width-h,height:c.size.height-g},j=parseFloat(c.element.css("left"))+(c.position.left-c.originalPosition.left)||null,k=parseFloat(c.element.css("top"))+(c.position.top-c.originalPosition.top)||null;c.element.animate(a.extend(i,k&&j?{top:k,left:j}:{}),{duration:d.animateDuration,easing:d.animateEasing,step:function(){var d={width:parseFloat(c.element.css("width")),height:parseFloat(c.element.css("height")),top:parseFloat(c.element.css("top")),left:parseFloat(c.element.css("left"))};e&&e.length&&a(e[0]).css({width:d.width,height:d.height}),c._updateCache(d),c._propagate("resize",b)}})}}),a.ui.plugin.add("resizable","containment",{start:function(){var b,c,d,e,f,g,h,i=a(this).resizable("instance"),j=i.options,k=i.element,l=j.containment,m=l instanceof a?l.get(0):/parent/.test(l)?k.parent().get(0):l;m&&(i.containerElement=a(m),/document/.test(l)||l===document?(i.containerOffset={left:0,top:0},i.containerPosition={left:0,top:0},i.parentData={element:a(document),left:0,top:0,width:a(document).width(),height:a(document).height()||document.body.parentNode.scrollHeight}):(b=a(m),c=[],a(["Top","Right","Left","Bottom"]).each(function(a,d){c[a]=i._num(b.css("padding"+d))}),i.containerOffset=b.offset(),i.containerPosition=b.position(),i.containerSize={height:b.innerHeight()-c[3],width:b.innerWidth()-c[1]},d=i.containerOffset,e=i.containerSize.height,f=i.containerSize.width,g=i._hasScroll(m,"left")?m.scrollWidth:f,h=i._hasScroll(m)?m.scrollHeight:e,i.parentData={element:m,left:d.left,top:d.top,width:g,height:h}))},resize:function(b){var c,d,e,f,g=a(this).resizable("instance"),h=g.options,i=g.containerOffset,j=g.position,k=g._aspectRatio||b.shiftKey,l={top:0,left:0},m=g.containerElement,n=!0;m[0]!==document&&/static/.test(m.css("position"))&&(l=i),j.left<(g._helper?i.left:0)&&(g.size.width=g.size.width+(g._helper?g.position.left-i.left:g.position.left-l.left),k&&(g.size.height=g.size.width/g.aspectRatio,n=!1),g.position.left=h.helper?i.left:0),j.top<(g._helper?i.top:0)&&(g.size.height=g.size.height+(g._helper?g.position.top-i.top:g.position.top),k&&(g.size.width=g.size.height*g.aspectRatio,n=!1),g.position.top=g._helper?i.top:0),e=g.containerElement.get(0)===g.element.parent().get(0),f=/relative|absolute/.test(g.containerElement.css("position")),e&&f?(g.offset.left=g.parentData.left+g.position.left,g.offset.top=g.parentData.top+g.position.top):(g.offset.left=g.element.offset().left,g.offset.top=g.element.offset().top),c=Math.abs(g.sizeDiff.width+(g._helper?g.offset.left-l.left:g.offset.left-i.left)),d=Math.abs(g.sizeDiff.height+(g._helper?g.offset.top-l.top:g.offset.top-i.top)),c+g.size.width>=g.parentData.width&&(g.size.width=g.parentData.width-c,k&&(g.size.height=g.size.width/g.aspectRatio,n=!1)),d+g.size.height>=g.parentData.height&&(g.size.height=g.parentData.height-d,k&&(g.size.width=g.size.height*g.aspectRatio,n=!1)),n||(g.position.left=g.prevPosition.left,g.position.top=g.prevPosition.top,g.size.width=g.prevSize.width,g.size.height=g.prevSize.height)},stop:function(){var b=a(this).resizable("instance"),c=b.options,d=b.containerOffset,e=b.containerPosition,f=b.containerElement,g=a(b.helper),h=g.offset(),i=g.outerWidth()-b.sizeDiff.width,j=g.outerHeight()-b.sizeDiff.height;b._helper&&!c.animate&&/relative/.test(f.css("position"))&&a(this).css({left:h.left-e.left-d.left,width:i,height:j}),b._helper&&!c.animate&&/static/.test(f.css("position"))&&a(this).css({left:h.left-e.left-d.left,width:i,height:j})}}),a.ui.plugin.add("resizable","alsoResize",{start:function(){var b=a(this).resizable("instance"),c=b.options;a(c.alsoResize).each(function(){var b=a(this);b.data("ui-resizable-alsoresize",{width:parseFloat(b.width()),height:parseFloat(b.height()),left:parseFloat(b.css("left")),top:parseFloat(b.css("top"))})})},resize:function(b,c){var d=a(this).resizable("instance"),e=d.options,f=d.originalSize,g=d.originalPosition,h={height:d.size.height-f.height||0,width:d.size.width-f.width||0,top:d.position.top-g.top||0,left:d.position.left-g.left||0};a(e.alsoResize).each(function(){var b=a(this),d=a(this).data("ui-resizable-alsoresize"),e={},f=b.parents(c.originalElement[0]).length?["width","height"]:["width","height","top","left"];a.each(f,function(a,b){var c=(d[b]||0)+(h[b]||0);c&&c>=0&&(e[b]=c||null)}),b.css(e)})},stop:function(){a(this).removeData("ui-resizable-alsoresize")}}),a.ui.plugin.add("resizable","ghost",{start:function(){var b=a(this).resizable("instance"),c=b.size;b.ghost=b.originalElement.clone(),b.ghost.css({opacity:.25,display:"block",position:"relative",height:c.height,width:c.width,margin:0,left:0,top:0}),b._addClass(b.ghost,"ui-resizable-ghost"),a.uiBackCompat!==!1&&"string"==typeof b.options.ghost&&b.ghost.addClass(this.options.ghost),b.ghost.appendTo(b.helper)},resize:function(){var b=a(this).resizable("instance");b.ghost&&b.ghost.css({position:"relative",height:b.size.height,width:b.size.width})},stop:function(){var b=a(this).resizable("instance");b.ghost&&b.helper&&b.helper.get(0).removeChild(b.ghost.get(0))}}),a.ui.plugin.add("resizable","grid",{resize:function(){var b,c=a(this).resizable("instance"),d=c.options,e=c.size,f=c.originalSize,g=c.originalPosition,h=c.axis,i="number"==typeof d.grid?[d.grid,d.grid]:d.grid,j=i[0]||1,k=i[1]||1,l=Math.round((e.width-f.width)/j)*j,m=Math.round((e.height-f.height)/k)*k,n=f.width+l,o=f.height+m,p=d.maxWidth&&d.maxWidth<n,q=d.maxHeight&&d.maxHeight<o,r=d.minWidth&&d.minWidth>n,s=d.minHeight&&d.minHeight>o;d.grid=i,r&&(n+=j),s&&(o+=k),p&&(n-=j),q&&(o-=k),/^(se|s|e)$/.test(h)?(c.size.width=n,c.size.height=o):/^(ne)$/.test(h)?(c.size.width=n,c.size.height=o,c.position.top=g.top-m):/^(sw)$/.test(h)?(c.size.width=n,c.size.height=o,c.position.left=g.left-l):((o-k<=0||n-j<=0)&&(b=c._getPaddingPlusBorderDimensions(this)),o-k>0?(c.size.height=o,c.position.top=g.top-m):(o=k-b.height,c.size.height=o,c.position.top=g.top+f.height-o),n-j>0?(c.size.width=n,c.position.left=g.left-l):(n=j-b.width,c.size.width=n,c.position.left=g.left+f.width-n))}}),a.ui.resizable});; 3345/*! jQuery UI - v1.12.1 - 2017-03-31 3346* http://jqueryui.com 3347* Copyright jQuery Foundation and other contributors; Licensed */ 3348!function(a){"function"==typeof define&&define.amd?define(["jquery","./button","./draggable","./mouse","./resizable","../focusable","../keycode","../position","../safe-active-element","../safe-blur","../tabbable","../unique-id","../version","../widget"],a):a(jQuery)}(function(a){return a.widget("ui.dialog",{version:"1.12.1",options:{appendTo:"body",autoOpen:!0,buttons:[],classes:{"ui-dialog":"ui-corner-all","ui-dialog-titlebar":"ui-corner-all"},closeOnEscape:!0,closeText:"Close",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(b){var c=a(this).css(b).offset().top;c<0&&a(this).css("top",b.top-c)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},sizeRelatedOptions:{buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},resizableRelatedOptions:{maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),null==this.options.title&&null!=this.originalTitle&&(this.options.title=this.originalTitle),this.options.disabled&&(this.options.disabled=!1),this._createWrapper(),this.element.show().removeAttr("title").appendTo(this.uiDialog),this._addClass("ui-dialog-content","ui-widget-content"),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&a.fn.draggable&&this._makeDraggable(),this.options.resizable&&a.fn.resizable&&this._makeResizable(),this._isOpen=!1,this._trackFocus()},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var b=this.options.appendTo;return b&&(b.jquery||b.nodeType)?a(b):this.document.find(b||"body").eq(0)},_destroy:function(){var a,b=this.originalPosition;this._untrackInstance(),this._destroyOverlay(),this.element.removeUniqueId().css(this.originalCss).detach(),this.uiDialog.remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),a=b.parent.children().eq(b.index),a.length&&a[0]!==this.element[0]?a.before(this.element):b.parent.append(this.element)},widget:function(){return this.uiDialog},disable:a.noop,enable:a.noop,close:function(b){var c=this;this._isOpen&&this._trigger("beforeClose",b)!==!1&&(this._isOpen=!1,this._focusedElement=null,this._destroyOverlay(),this._untrackInstance(),this.opener.filter(":focusable").trigger("focus").length||a.ui.safeBlur(a.ui.safeActiveElement(this.document[0])),this._hide(this.uiDialog,this.options.hide,function(){c._trigger("close",b)}))},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(b,c){var d=!1,e=this.uiDialog.siblings(".ui-front:visible").map(function(){return+a(this).css("z-index")}).get(),f=Math.max.apply(null,e);return f>=+this.uiDialog.css("z-index")&&(this.uiDialog.css("z-index",f+1),d=!0),d&&!c&&this._trigger("focus",b),d},open:function(){var b=this;return this._isOpen?void(this._moveToTop()&&this._focusTabbable()):(this._isOpen=!0,this.opener=a(a.ui.safeActiveElement(this.document[0])),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this.overlay&&this.overlay.css("z-index",this.uiDialog.css("z-index")-1),this._show(this.uiDialog,this.options.show,function(){b._focusTabbable(),b._trigger("focus")}),this._makeFocusTarget(),void this._trigger("open"))},_focusTabbable:function(){var a=this._focusedElement;a||(a=this.element.find("[autofocus]")),a.length||(a=this.element.find(":tabbable")),a.length||(a=this.uiDialogButtonPane.find(":tabbable")),a.length||(a=this.uiDialogTitlebarClose.filter(":tabbable")),a.length||(a=this.uiDialog),a.eq(0).trigger("focus")},_keepFocus:function(b){function c(){var b=a.ui.safeActiveElement(this.document[0]),c=this.uiDialog[0]===b||a.contains(this.uiDialog[0],b);c||this._focusTabbable()}b.preventDefault(),c.call(this),this._delay(c)},_createWrapper:function(){this.uiDialog=a("<div>").hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._addClass(this.uiDialog,"ui-dialog","ui-widget ui-widget-content ui-front"),this._on(this.uiDialog,{keydown:function(b){if(this.options.closeOnEscape&&!b.isDefaultPrevented()&&b.keyCode&&b.keyCode===a.ui.keyCode.ESCAPE)return b.preventDefault(),void this.close(b);if(b.keyCode===a.ui.keyCode.TAB&&!b.isDefaultPrevented()){var c=this.uiDialog.find(":tabbable"),d=c.filter(":first"),e=c.filter(":last");b.target!==e[0]&&b.target!==this.uiDialog[0]||b.shiftKey?b.target!==d[0]&&b.target!==this.uiDialog[0]||!b.shiftKey||(this._delay(function(){e.trigger("focus")}),b.preventDefault()):(this._delay(function(){d.trigger("focus")}),b.preventDefault())}},mousedown:function(a){this._moveToTop(a)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var b;this.uiDialogTitlebar=a("<div>"),this._addClass(this.uiDialogTitlebar,"ui-dialog-titlebar","ui-widget-header ui-helper-clearfix"),this._on(this.uiDialogTitlebar,{mousedown:function(b){a(b.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.trigger("focus")}}),this.uiDialogTitlebarClose=a("<button type='button'></button>").button({label:a("<a>").text(this.options.closeText).html(),icon:"ui-icon-closethick",showLabel:!1}).appendTo(this.uiDialogTitlebar),this._addClass(this.uiDialogTitlebarClose,"ui-dialog-titlebar-close"),this._on(this.uiDialogTitlebarClose,{click:function(a){a.preventDefault(),this.close(a)}}),b=a("<span>").uniqueId().prependTo(this.uiDialogTitlebar),this._addClass(b,"ui-dialog-title"),this._title(b),this.uiDialogTitlebar.prepe
vendor: 5,802 bytes, line 3348
3348ndTo(this.uiDialog),this.uiDialog.attr({"aria-labelledby":b.attr("id")})},_title:function(a){this.options.title?a.text(this.options.title):a.html(" ")},_createButtonPane:function(){this.uiDialogButtonPane=a("<div>"),this._addClass(this.uiDialogButtonPane,"ui-dialog-buttonpane","ui-widget-content ui-helper-clearfix"),this.uiButtonSet=a("<div>").appendTo(this.uiDialogButtonPane),this._addClass(this.uiButtonSet,"ui-dialog-buttonset"),this._createButtons()},_createButtons:function(){var b=this,c=this.options.buttons;return this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),a.isEmptyObject(c)||a.isArray(c)&&!c.length?void this._removeClass(this.uiDialog,"ui-dialog-buttons"):(a.each(c,function(c,d){var e,f;d=a.isFunction(d)?{click:d,text:c}:d,d=a.extend({type:"button"},d),e=d.click,f={icon:d.icon,iconPosition:d.iconPosition,showLabel:d.showLabel,icons:d.icons,text:d.text},delete d.click,delete d.icon,delete d.iconPosition,delete d.showLabel,delete d.icons,"boolean"==typeof d.text&&delete d.text,a("<button></button>",d).button(f).appendTo(b.uiButtonSet).on("click",function(){e.apply(b.element[0],arguments)})}),this._addClass(this.uiDialog,"ui-dialog-buttons"),void this.uiDialogButtonPane.appendTo(this.uiDialog))},_makeDraggable:function(){function b(a){return{position:a.position,offset:a.offset}}var c=this,d=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(d,e){c._addClass(a(this),"ui-dialog-dragging"),c._blockFrames(),c._trigger("dragStart",d,b(e))},drag:function(a,d){c._trigger("drag",a,b(d))},stop:function(e,f){var g=f.offset.left-c.document.scrollLeft(),h=f.offset.top-c.document.scrollTop();d.position={my:"left top",at:"left"+(g>=0?"+":"")+g+" top"+(h>=0?"+":"")+h,of:c.window},c._removeClass(a(this),"ui-dialog-dragging"),c._unblockFrames(),c._trigger("dragStop",e,b(f))}})},_makeResizable:function(){function b(a){return{originalPosition:a.originalPosition,originalSize:a.originalSize,position:a.position,size:a.size}}var c=this,d=this.options,e=d.resizable,f=this.uiDialog.css("position"),g="string"==typeof e?e:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:d.maxWidth,maxHeight:d.maxHeight,minWidth:d.minWidth,minHeight:this._minHeight(),handles:g,start:function(d,e){c._addClass(a(this),"ui-dialog-resizing"),c._blockFrames(),c._trigger("resizeStart",d,b(e))},resize:function(a,d){c._trigger("resize",a,b(d))},stop:function(e,f){var g=c.uiDialog.offset(),h=g.left-c.document.scrollLeft(),i=g.top-c.document.scrollTop();d.height=c.uiDialog.height(),d.width=c.uiDialog.width(),d.position={my:"left top",at:"left"+(h>=0?"+":"")+h+" top"+(i>=0?"+":"")+i,of:c.window},c._removeClass(a(this),"ui-dialog-resizing"),c._unblockFrames(),c._trigger("resizeStop",e,b(f))}}).css("position",f)},_trackFocus:function(){this._on(this.widget(),{focusin:function(b){this._makeFocusTarget(),this._focusedElement=a(b.target)}})},_makeFocusTarget:function(){this._untrackInstance(),this._trackingInstances().unshift(this)},_untrackInstance:function(){var b=this._trackingInstances(),c=a.inArray(this,b);c!==-1&&b.splice(c,1)},_trackingInstances:function(){var a=this.document.data("ui-dialog-instances");return a||(a=[],this.document.data("ui-dialog-instances",a)),a},_minHeight:function(){var a=this.options;return"auto"===a.height?a.minHeight:Math.min(a.minHeight,a.height)},_position:function(){var a=this.uiDialog.is(":visible");a||this.uiDialog.show(),this.uiDialog.position(this.options.position),a||this.uiDialog.hide()},_setOptions:function(b){var c=this,d=!1,e={};a.each(b,function(a,b){c._setOption(a,b),a in c.sizeRelatedOptions&&(d=!0),a in c.resizableRelatedOptions&&(e[a]=b)}),d&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",e)},_setOption:function(b,c){var d,e,f=this.uiDialog;"disabled"!==b&&(this._super(b,c),"appendTo"===b&&this.uiDialog.appendTo(this._appendTo()),"buttons"===b&&this._createButtons(),"closeText"===b&&this.uiDialogTitlebarClose.button({label:a("<a>").text(""+this.options.closeText).html()}),"draggable"===b&&(d=f.is(":data(ui-draggable)"),d&&!c&&f.draggable("destroy"),!d&&c&&this._makeDraggable()),"position"===b&&this._position(),"resizable"===b&&(e=f.is(":data(ui-resizable)"),e&&!c&&f.resizable("destroy"),e&&"string"==typeof c&&f.resizable("option","handles",c),e||c===!1||this._makeResizable()),"title"===b&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var a,b,c,d=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),d.minWidth>d.width&&(d.width=d.minWidth),a=this.uiDialog.css({height:"auto",width:d.width}).outerHeight(),b=Math.max(0,d.minHeight-a),c="number"==typeof d.maxHeight?Math.max(0,d.maxHeight-a):"none","auto"===d.height?this.element.css({minHeight:b,maxHeight:c,height:"auto"}):this.element.height(Math.max(0,d.height-a)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var b=a(this);return a("<div>").css({position:"absolute",width:b.outerWidth(),height:b.outerHeight()}).appendTo(b.parent()).offset(b.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(b){return!!a(b.target).closest(".ui-dialog").length||!!a(b.target).closest(".ui-datepicker").length},_createOverlay:function(){if(this.options.modal){var b=!0;this._delay(function(){b=!1}),this.document.data("ui-dialog-overlays")||this._on(this.document,{focusin:function(a){b||this._allowInteraction(a)||
3348(a.preventDefault(),this._trackingInstances()[0]._focusTabbable())}}),this.overlay=a("<div>").appendTo(this._appendTo()),this._addClass(this.overlay,null,"ui-widget-overlay ui-front"),this._on(this.overlay,{mousedown:"_keepFocus"}),this.document.data("ui-dialog-overlays",(this.document.data("ui-dialog-overlays")||0)+1)}},_destroyOverlay:function(){if(this.options.modal&&this.overlay){var a=this.document.data("ui-dialog-overlays")-1;a?this.document.data("ui-dialog-overlays",a):(this._off(this.document,"focusin"),this.document.removeData("ui-dialog-overlays")),this.overlay.remove(),this.overlay=null}}}),a.uiBackCompat!==!1&&a.widget("ui.dialog",a.ui.dialog,{options:{dialogClass:""},_createWrapper:function(){this._super(),this.uiDialog.addClass(this.options.dialogClass)},_setOption:function(a,b){"dialogClass"===a&&this.uiDialog.removeClass(this.options.dialogClass).addClass(b),this._superApply(arguments)}}),a.ui.dialog});; 3349/** 3350* DO NOT EDIT THIS FILE. 3351* See the following change record for more information, 3352* https://www.drupal.org/node/2815083 3353* @preserve 3354**/ 3355 3356(function ($, Drupal, drupalSettings) { 3357 drupalSettings.dialog = { 3358 autoOpen: true, 3359 dialogClass: '', 3360 3361 buttonClass: 'button', 3362 buttonPrimaryClass: 'button--primary', 3363 close: function close(event) { 3364 Drupal.dialog(event.target).close(); 3365 Drupal.detachBehaviors(event.target, null, 'unload'); 3366 } 3367 }; 3368 3369 Drupal.dialog = function (element, options) { 3370 var undef = void 0; 3371 var $element = $(element); 3372 var dialog = { 3373 open: false, 3374 returnValue: undef 3375 }; 3376 3377 function openDialog(settings) { 3378 settings = $.extend({}, drupalSettings.dialog, options, settings); 3379 3380 $(window).trigger('dialog:beforecreate', [dialog, $element, settings]); 3381 $element.dialog(settings); 3382 dialog.open = true; 3383 $(window).trigger('dialog:aftercreate', [dialog, $element, settings]); 3384 } 3385 3386 function closeDialog(value) { 3387 $(window).trigger('dialog:beforeclose', [dialog, $element]); 3388 $element.dialog('close'); 3389 dialog.returnValue = value; 3390 dialog.open = false; 3391 $(window).trigger('dialog:afterclose', [dialog, $element]); 3392 } 3393 3394 dialog.show = function () { 3395 openDialog({ modal: false }); 3396 }; 3397 dialog.showModal = function () { 3398 openDialog({ modal: true }); 3399 }; 3400 dialog.close = closeDialog; 3401 3402 return dialog; 3403 }; 3404})(jQuery, Drupal, drupalSettings);; 3405/** 3406* DO NOT EDIT THIS FILE. 3407* See the following change record for more information, 3408* https://www.drupal.org/node/2815083 3409* @preserve 3410**/ 3411 3412(function ($, Drupal, drupalSettings, debounce, displace) { 3413 drupalSettings.dialog = $.extend({ autoResize: true, maxHeight: '95%' }, drupalSettings.dialog); 3414 3415 function resetPosition(options) { 3416 var offsets = displace.offsets; 3417 var left = offsets.left - offsets.right; 3418 var top = offsets.top - offsets.bottom; 3419 3420 var leftString = (left > 0 ? '+' : '-') + Math.abs(Math.round(left / 2)) + 'px'; 3421 var topString = (top > 0 ? '+' : '-') + Math.abs(Math.round(top / 2)) + 'px'; 3422 options.position = { 3423 my: 'center' + (left !== 0 ? leftString : '') + ' center' + (top !== 0 ? topString : ''), 3424 of: window 3425 }; 3426 return options; 3427 } 3428 3429 function resetSize(event) { 3430 var positionOptions = ['width', 'height', 'minWidth', 'minHeight', 'maxHeight', 'maxWidth', 'position']; 3431 var adjustedOptions = {}; 3432 var windowHeight = $(window).height(); 3433 var option = void 0; 3434 var optionValue = void 0; 3435 var adjustedValue = void 0; 3436 for (var n = 0; n < positionOptions.length; n++) { 3437 option = positionOptions[n]; 3438 optionValue = event.data.settings[option]; 3439 if (optionValue) { 3440 if (typeof optionValue === 'string' && /%$/.test(optionValue) && /height/i.test(option)) { 3441 windowHeight -= displace.offsets.top + displace.offsets.bottom; 3442 adjustedValue = parseInt(0.01 * parseInt(optionValue, 10) * windowHeight, 10); 3443 3444 if (option === 'height' && event.data.$element.parent().outerHeight() < adjustedValue) { 3445 adjustedValue = 'auto'; 3446 } 3447 adjustedOptions[option] = adjustedValue; 3448 } 3449 } 3450 } 3451 3452 if (!event.data.settings.modal) { 3453 adjustedOptions = resetPosition(adjustedOptions); 3454 } 3455 event.data.$element.dialog('option', adjustedOptions).trigger('dialogContentResize'); 3456 } 3457 3458 $(window).on({ 3459 'dialog:aftercreate': function dialogAftercreate(event, dialog, $element, settings) { 3460 var autoResize = debounce(resetSize, 20); 3461 var eventData = { settings: settings, $element: $element }; 3462 if (settings.autoResize === true || settings.autoResize === 'true') { 3463 $element.dialog('option', { resizable: false, draggable: false }).dialog('widget').css('position', 'fixed'); 3464 $(window).on('resize.dialogResize scroll.dialogResize', eventData, autoResize).trigger('resize.dialogResize'); 3465 $(document).on('drupalViewportOffsetChange.dialogResize', eventData, autoResize); 3466 } 3467 }, 3468 'dialog:beforeclose': function dialogBeforeclose(event, dialog, $element) { 3469 $(window).off('.dialogResize'); 3470 $(document).off('.dialogResize'); 3471 } 3472 }); 3473})(jQuery, Drupal, drupalSettings, Drupal.debounce, Drupal.displace);; 3474/** 3475* DO NOT EDIT THIS FILE. 3476* See the following change record for more information, 3477* https://www.drupal.org/node/2815083 3478* @preserve 3479**/ 3480 3481(function ($) { 3482 $.widget('ui.dialog', $.ui.dialog, { 3483 options: { 3484 buttonClass: 'button', 3485 buttonPrimaryClass: 'button--primary' 3486 }, 3487 _createButtons: function _createButtons() { 3488 var opts = this.options; 3489 var primaryIndex = void 0; 3490 var index = void 0; 3491 var il = opts.buttons.length; 3492 for (index = 0; index < il; index++) { 3493 if (opts.buttons[index].primary && opts.buttons[index].primary === true) { 3494 primaryIndex = index; 3495 delete opts.buttons[index].primary; 3496 break; 3497 } 3498 } 3499 this._super(); 3500 var $buttons = this.uiButtonSet.children().addClass(opts.buttonClass); 3501 if (typeof primaryIndex !== 'undefined') { 3502 $buttons.eq(index).addClass(opts.buttonPrimaryClass); 3503 } 3504 } 3505 }); 3506})(jQuery);; 3507/** 3508* DO NOT EDIT THIS FILE. 3509* See the following change record for more information, 3510* https://www.drupal.org/node/2815083 3511* @preserve 3512**/ 3513 3514(function ($, Drupal) { 3515 Drupal.behaviors.dialog = { 3516 attach: function attach(context, settings) { 3517 var $context = $(context); 3518 3519 if (!$('#drupal-modal').length) { 3520 $('<div id="drupal-modal" class="ui-front"></div>').hide().appendTo('body'); 3521 } 3522 3523 var $dialog = $context.closest('.ui-dialog-content'); 3524 if ($dialog.length) { 3525 if ($dialog.dialog('option', 'drupalAutoButtons')) { 3526 $dialog.trigger('dialogButtonsChange'); 3527 } 3528 3529 $dialog.dialog('widget').trigger('focus'); 3530 } 3531 3532 var originalClose = settings.dialog.close; 3533 3534 settings.dialog.close = function (event) { 3535 for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 3536 args[_key - 1] = arguments[_key]; 3537 } 3538 3539 originalClose.apply(settings.dialog, [event].concat(args)); 3540 $(event.target).remove(); 3541 }; 3542 }, 3543 prepareDialogButtons: function prepareDialogButtons($dialog) { 3544 var buttons = []; 3545 var $buttons = $dialog.find('.form-actions input[type=submit], .form-actions a.button'); 3546 $buttons.each(function () { 3547 var $originalButton = $(this).css({ display: 'none' }); 3548 buttons.push({ 3549 text: $originalButton.html() || $originalButton.attr('value'), 3550 class: $originalButton.attr('class'), 3551 click: function click(e) { 3552 if ($originalButton.is('a')) { 3553 $originalButton[0].click(); 3554 } else { 3555 $originalButton.trigger('mousedown').trigger('mouseup').trigger('click'); 3556 e.preventDefault(); 3557 } 3558 } 3559 }); 3560 }); 3561 return buttons; 3562 } 3563 }; 3564 3565 Drupal.AjaxCommands.prototype.openDialog = function (ajax, response, status) { 3566 if (!response.selector) { 3567 return false;
3568 } 3569 var $dialog = $(response.selector); 3570 if (!$dialog.length) { 3571 $dialog = $('<div id="' + response.selector.replace(/^#/, '') + '" class="ui-front"></div>').appendTo('body'); 3572 } 3573 3574 if (!ajax.wrapper) { 3575 ajax.wrapper = $dialog.attr('id'); 3576 } 3577 3578 response.command = 'insert'; 3579 response.method = 'html'; 3580 ajax.commands.insert(ajax, response, status); 3581 3582 if (!response.dialogOptions.buttons) { 3583 response.dialogOptions.drupalAutoButtons = true; 3584 response.dialogOptions.buttons = Drupal.behaviors.dialog.prepareDialogButtons($dialog); 3585 } 3586 3587 $dialog.on('dialogButtonsChange', function () { 3588 var buttons = Drupal.behaviors.dialog.prepareDialogButtons($dialog); 3589 $dialog.dialog('option', 'buttons', buttons); 3590 }); 3591 3592 response.dialogOptions = response.dialogOptions || {}; 3593 var dialog = Drupal.dialog($dialog.get(0), response.dialogOptions); 3594 if (response.dialogOptions.modal) { 3595 dialog.showModal(); 3596 } else { 3597 dialog.show(); 3598 } 3599 3600 $dialog.parent().find('.ui-dialog-buttonset').addClass('form-actions'); 3601 }; 3602 3603 Drupal.AjaxCommands.prototype.closeDialog = function (ajax, response, status) { 3604 var $dialog = $(response.selector); 3605 if ($dialog.length) { 3606 Drupal.dialog($dialog.get(0)).close(); 3607 if (!response.persist) { 3608 $dialog.remove(); 3609 } 3610 } 3611 3612 $dialog.off('dialogButtonsChange'); 3613 }; 3614 3615 Drupal.AjaxCommands.prototype.setDialogOption = function (ajax, response, status) { 3616 var $dialog = $(response.selector); 3617 if ($dialog.length) { 3618 $dialog.dialog('option', response.optionName, response.optionValue); 3619 } 3620 }; 3621 3622 $(window).on('dialog:aftercreate', function (e, dialog, $element, settings) { 3623 $element.on('click.dialog', '.dialog-cancel', function (e) { 3624 dialog.close('cancel'); 3625 e.preventDefault(); 3626 e.stopPropagation(); 3627 }); 3628 }); 3629 3630 $(window).on('dialog:beforeclose', function (e, dialog, $element) { 3631 $element.off('.dialog'); 3632 }); 3633})(jQuery, Drupal);; 3634/** 3635 * @file 3636 * JavaScript behaviors for terms of service. 3637 */ 3638 3639(function ($, Drupal) { 3640 3641 'use strict'; 3642 3643 // @see http://api.jqueryui.com/dialog/ 3644 Drupal.webform = Drupal.webform || {}; 3645 Drupal.webform.termsOfServiceModal = Drupal.webform.termsOfServiceModal || {}; 3646 Drupal.webform.termsOfServiceModal.options = Drupal.webform.termsOfServiceModal.options || {}; 3647 3648 /** 3649 * Initialize terms of service element. 3650 * 3651 * @type {Drupal~behavior} 3652 */ 3653 Drupal.behaviors.webformTermsOfService = { 3654 attach: function (context) { 3655 $(context).find('.js-form-type-webform-terms-of-service').once('webform-terms-of-service').each(function () { 3656 var $element = $(this); 3657 var $a = $element.find('label a'); 3658 var $details = $element.find('.webform-terms-of-service-details'); 3659 3660 var type = $element.attr('data-webform-terms-of-service-type'); 3661 3662 // Initialize the modal. 3663 if (type === 'modal') { 3664 // Move details title to attribute. 3665 var $title = $element.find('.webform-terms-of-service-details--title'); 3666 if ($title.length) { 3667 $details.attr('title', $title.text()); 3668 $title.remove(); 3669 } 3670 3671 var options = $.extend({ 3672 modal: true, 3673 autoOpen: false, 3674 minWidth: 600, 3675 maxWidth: 800 3676 }, Drupal.webform.termsOfServiceModal.options); 3677 $details.dialog(options); 3678 } 3679 3680 // Add aria-* attributes. 3681 if (type !== 'modal') { 3682 $a.attr({ 3683 'aria-expanded': false, 3684 'aria-controls': $details.attr('id') 3685 }); 3686 } 3687 3688 // Set event handlers. 3689 $a.on('click', openDetails) 3690 .on('keydown', function (event) { 3691 // Space or Return. 3692 if (event.which === 32 || event.which === 13) { 3693 openDetails(event); 3694 } 3695 }); 3696 3697 function openDetails(event) { 3698 if (type === 'modal') { 3699 $details.dialog('open'); 3700 } 3701 else { 3702 var expanded = ($a.attr('aria-expanded') === 'true'); 3703 3704 // Toggle `aria-expanded` attributes on link. 3705 $a.attr('aria-expanded', !expanded); 3706 3707 // Toggle details. 3708 $details[expanded ? 'slideUp' : 'slideDown'](); 3709 } 3710 event.preventDefault(); 3711 } 3712 }); 3713 } 3714 }; 3715 3716})(jQuery, Drupal); 3717;
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.