{"version":3,"file":"scripts/chunks/_app_app_scripts_core_views_O31-article-text_ts.4ee1534a73a50421144f.mjs","mappings":"gLAaA,WAAeA,EAAAA,EAAAA,GAAgB,wBAXfC,IACd,MAAMC,EAAkCD,EAAGE,cAAc,6BACnDC,EAAkCH,EAAGE,cAAc,qBACnDE,EAA2BH,GAAoBI,aAC/CC,EAA2BH,GAAoBE,aAEjDC,EAA2BF,GAC7BD,EAAmBI,UAAUC,OAAO,cACtC,IAGmE,M,wDCX9D,MAAMT,EAAkB,SAACU,EAAcC,EAA4BC,GAAyC,IAAnBC,IAAOC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,KAAAA,UAAA,GACrG,MAAMG,EAAWC,SAASC,iBAAiBN,EAAU,IAAIH,IAASA,GAsBlE,MAAO,CAAEU,OApBMA,KACb,GAAGC,QAAQC,KAAKL,GAAWhB,IACa,MAAlCA,EAAGsB,QAAQC,qBAAgCvB,EAAGsB,QAAQC,oBAAoBC,SAASf,KACrFC,EAAOV,GACPA,EAAGsB,QAAQC,oBAAsB,GAAGvB,EAAGsB,QAAQC,qBAAuB,MAAMd,IAC9E,GACA,EAcaE,QAXOc,KAClBd,GACF,GAAGS,QAAQC,KAAKL,GAAWhB,IACzBW,IACIX,EAAGsB,QAAQC,sBACbvB,EAAGsB,QAAQC,oBAAsBvB,EAAGsB,QAAQC,oBAAoBG,QAAQjB,EAAM,IAChF,GAEJ,EAIJ,C","sources":["webpack://rockworld/./app/scripts/core/views/O31-article-text.ts","webpack://rockworld/./app/scripts/core/views/vanilla/elementsFactory.ts"],"sourcesContent":["import { elementsFactory } from './vanilla/elementsFactory';\r\n\r\nconst render = (el: Element): void => {\r\n  const articleTextSection: HTMLElement = el.querySelector('.O31-article-text-section');\r\n  const socialShareSection: HTMLElement = el.querySelector('.O27-social-links');\r\n  const articleTextSectionHeight = articleTextSection?.offsetHeight;\r\n  const socialShareSectionHeight = socialShareSection?.offsetHeight;\r\n\r\n  if (socialShareSectionHeight > articleTextSectionHeight) {\r\n    socialShareSection.classList.remove('is-attached');\r\n  }\r\n};\r\n\r\nexport default elementsFactory('js-O-31-article-text', render).create;\r\n","import type { FuncCreateElements } from './types';\r\n\r\nexport const elementsFactory = (name: string, render: FuncCreateElements, destroy?: () => void, isClass = true) => {\r\n  const elements = document.querySelectorAll(isClass ? `.${name}` : name);\r\n\r\n  const create = () => {\r\n    [].forEach.call(elements, (el: HTMLElement) => {\r\n      if (el.dataset.initilaizedElements == null || !el.dataset.initilaizedElements.includes(name)) {\r\n        render(el);\r\n        el.dataset.initilaizedElements = `${el.dataset.initilaizedElements ?? ''} ${name}`;\r\n      }\r\n    });\r\n  };\r\n\r\n  const destroyElements = () => {\r\n    if (destroy) {\r\n      [].forEach.call(elements, (el: { dataset: { initilaizedElements: string } }) => {\r\n        destroy();\r\n        if (el.dataset.initilaizedElements) {\r\n          el.dataset.initilaizedElements = el.dataset.initilaizedElements.replace(name, '');\r\n        }\r\n      });\r\n    }\r\n  };\r\n\r\n  return { create, destroy: destroyElements };\r\n};\r\n"],"names":["elementsFactory","el","articleTextSection","querySelector","socialShareSection","articleTextSectionHeight","offsetHeight","socialShareSectionHeight","classList","remove","name","render","destroy","isClass","arguments","length","undefined","elements","document","querySelectorAll","create","forEach","call","dataset","initilaizedElements","includes","destroyElements","replace"],"sourceRoot":""}