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,IAAIC,EAAetD,EAAES,MAEjB8C,EAAqBC,aAAY,gBACI,IAAzBxC,OAAOqC,oBAA0E,IAAhCrC,OAAOqC,cAAcI,SAC1EzC,OAAOqC,cAAcK,MACrBC,YAAW,WAAaL,EAAaM,OAAS,GAAG,KAGjDN,EAAaM,QAEjBC,cAAcN,GAEtB,GAAG,IAEHvD,EAAE8D,UAAU,oHAChB,MAEI9C,OAAOqC,cAAcU,aACrB/C,OAAOqC,cAAcJ,KAAO9B,SAAS6B,SAASC,IAEtD,IAGJjD,EAAE,qBAAqBgE,GAAG,CACtB,WAGJ,WACIhE,EAAES,MAAMwD,SAAS,eACrB,IAEAjE,EAAEY,GAAqBoD,GAAG,SAAS,SAAUE,GACzC,IAAIpD,EAAUd,EAAEkE,EAAMC,eAElB/D,EACAS,EAAeC,GAEf,wJAAwEsD,MAAK,SAAAC,GAA4B,IAAhBC,EAASD,EAAlBE,QAC5EnE,EAAYkE,EACZzD,EAAeC,EACnB,GAER,IA4CAd,EAAEmB,UAAU6C,GAAG,aAAc3D,GAAyB,SAAS6D,GACvDA,EAAMC,gBAAkBD,EAAMM,QArG9BlE,EAAiBK,OAAS,SACU,IAAzBK,OAAOqC,cACdrD,EAAE8D,UAAU,sHAEZ9C,OAAOqC,cAAcU,aACrB/C,OAAOqC,cAAcJ,KAAO9B,SAAS6B,SAASC,MAmG1D,GACJ,CAEAjD,GAAE,WACEG,GACJ,IAEAsE,EAAQtE,MAAQA,C","sources":["webpack://ui-toolkit/./sass/blocks/share.js"],"sourcesContent":["var $ = require(\"jquery\");\r\nvar Popover = require(\"./popover\");\r\n\r\nfunction Share() {\r\n let BsPopover = null;\r\n const popoverButtonSelector = \"[data-share-action='copy-url']\";\r\n const shareThisModuleSelector = \".ws-section--share-this\";\r\n const $shareThisModule = $(shareThisModuleSelector);\r\n const $lazyShareThisButtons = $(\".st-custom-button[data-network]\").filter(function () {\r\n return $(this).parents(shareThisModuleSelector).length === 0;\r\n });\r\n\r\n const $lazyPopoverButtons = $(popoverButtonSelector).filter(function () {\r\n return $(this).parents(shareThisModuleSelector).length === 0;\r\n });\r\n\r\n function initShareThis() {\r\n if ($shareThisModule.length > 0) {\r\n if (typeof window.__sharethis__ === \"undefined\") {\r\n $.getScript(\"https://platform-api.sharethis.com/js/sharethis.js#property=5a1ebf41c87cd900112f818b&product=custom-share-buttons\");\r\n } else {\r\n window.__sharethis__.initialize();\r\n window.__sharethis__.href = document.location.href;\r\n }\r\n }\r\n }\r\n\r\n // Defer intialization of ShareThis until user clicks on share button\r\n if ($lazyShareThisButtons.length > 0) {\r\n $lazyShareThisButtons.one(\"click\", function() {\r\n if (typeof window.__sharethis__ === \"undefined\") {\r\n var $shareButton = $(this);\r\n\r\n var shareThisLoadCheck = setInterval(function() {\r\n if ((typeof window.__sharethis__ !== \"undefined\") && (typeof window.__sharethis__.config !== \"undefined\")) {\r\n if (window.__sharethis__.is_ie) {\r\n setTimeout(function() { $shareButton.click(); }, 100); // IE needs a little extra help\r\n }\r\n else {\r\n $shareButton.click();\r\n }\r\n clearInterval(shareThisLoadCheck);\r\n }\r\n }, 20);\r\n\r\n $.getScript(\"https://platform-api.sharethis.com/js/sharethis.js#property=5a1ebf41c87cd900112f818b&product=custom-share-buttons\");\r\n }\r\n else {\r\n window.__sharethis__.initialize();\r\n window.__sharethis__.href = document.location.href;\r\n }\r\n });\r\n }\r\n\r\n $(\".ws-share__button\").on({\r\n \"touchstart\": addActiveClass\r\n });\r\n\r\n function addActiveClass() {\r\n $(this).addClass(\"ws-can-touch\");\r\n };\r\n\r\n $($lazyPopoverButtons).on(\"click\", function (event) {\r\n var $target = $(event.currentTarget);\r\n\r\n if (BsPopover) {\r\n onPopoverClick($target);\r\n } else {\r\n import(/* webpackChunkName: \"bspopover\" */ \"bootstrap/js/dist/popover\").then(({ default: bsPopover }) => {\r\n BsPopover = bsPopover;\r\n onPopoverClick($target);\r\n });\r\n }\r\n });\r\n\r\n function onPopoverClick($target) {\r\n copyToClipboard(document.location.href);\r\n $target.focus();\r\n Popover.notificationPopover($target);\r\n }\r\n\r\n // method taken from https://stackoverflow.com/a/33928558\r\n function copyToClipboard(text) {\r\n if (window.clipboardData && window.clipboardData.setData) {\r\n // IE specific code path to prevent textarea being shown while dialog is visible.\r\n return clipboardData.setData(\"Text\", text);\r\n } else if (document.queryCommandSupported && document.queryCommandSupported(\"copy\")) {\r\n var textarea = document.createElement(\"textarea\");\r\n textarea.textContent = text;\r\n textarea.style.position = \"fixed\"; // Prevent scrolling to bottom of page in MS Edge.\r\n textarea.contentEditable = true;\r\n textarea.readOnly = true;\r\n document.body.appendChild(textarea);\r\n // ios specific code based on this solution: https://stackoverflow.com/a/41267511\r\n if (navigator.userAgent.match(/ipad|ipod|iphone/i)) {\r\n var range = document.createRange();\r\n range.selectNodeContents(textarea);\r\n var sel = window.getSelection();\r\n sel.removeAllRanges();\r\n sel.addRange(range);\r\n textarea.setSelectionRange(0, 999);\r\n } else {\r\n textarea.select();\r\n }\r\n try {\r\n return document.execCommand(\"copy\"); // Security exception may be thrown by some browsers.\r\n } catch (ex) {\r\n if (console && console.warn) {\r\n console.warn(\"Copy to clipboard failed.\", ex);\r\n }\r\n return false;\r\n } finally {\r\n document.body.removeChild(textarea);\r\n }\r\n }\r\n };\r\n\r\n $(document).on(\"lazyloaded\", shareThisModuleSelector, function(event) {\r\n if (event.currentTarget === event.target) {\r\n initShareThis();\r\n }\r\n });\r\n}\r\n\r\n$(function () {\r\n Share();\r\n});\r\n\r\nexports.Share = Share;"],"names":["$","require","Popover","Share","BsPopover","shareThisModuleSelector","$shareThisModule","$lazyShareThisButtons","filter","this","parents","length","$lazyPopoverButtons","onPopoverClick","$target","text","window","clipboardData","setData","document","queryCommandSupported","textarea","createElement","textContent","style","position","contentEditable","readOnly","body","appendChild","navigator","userAgent","match","range","createRange","selectNodeContents","sel","getSelection","removeAllRanges","addRange","setSelectionRange","select","execCommand","ex","console","warn","removeChild","copyToClipboard","location","href","focus","notificationPopover","one","__sharethis__","$shareButton","shareThisLoadCheck","setInterval","config","is_ie","setTimeout","click","clearInterval","getScript","initialize","on","addClass","event","currentTarget","then","_ref","bsPopover","default","target","exports"],"sourceRoot":""}