{"version":3,"file":"HideTrailingAuthorSeparator.BPycnKDL.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/f93yqfQrSmqAHQdFNi3C/p9kvhGNCbZqTbzKrnEmO/HideTrailingAuthorSeparator.js"],"sourcesContent":["// User request: Create a Framer code override export named HideTrailingAuthorSeparator for a RichText separator that renders \", \" after each repeated author. Preserve canvas text styling/layout, and on the client hide only the separator for the last rendered author entry in its collection list using tolerant parent/sibling traversal. Keep SSR/canvas safe and reduce flicker.\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,startTransition,useEffect,useRef,useState}from\"react\";function isRenderedElement(element){if(typeof window===\"undefined\")return true;const computed=window.getComputedStyle(element);return computed.display!==\"none\"&&computed.visibility!==\"hidden\";}function findEntryContext(separatorRoot){let current=separatorRoot;while(current){const candidate=current.parentElement;if(!candidate)return null;const hasSiblingEntries=candidate.previousElementSibling!==null||candidate.nextElementSibling!==null;if(hasSiblingEntries&&candidate.parentElement){return{entry:candidate,list:candidate.parentElement};}current=candidate;}return null;}export function HideTrailingAuthorSeparator(Component){return /*#__PURE__*/forwardRef(function HideTrailingAuthorSeparatorOverride(props,ref){const localRef=useRef(null);const[shouldHide,setShouldHide]=useState(false);const evaluateVisibility=()=>{if(typeof window===\"undefined\"||typeof document===\"undefined\"){return;}const root=localRef.current;if(!root)return;const context=findEntryContext(root);if(!context){startTransition(()=>setShouldHide(false));return;}const renderedEntries=Array.from(context.list.children).filter(child=>{return child instanceof HTMLElement&&isRenderedElement(child);});const isLastRendered=renderedEntries.length>0&&renderedEntries[renderedEntries.length-1]===context.entry;startTransition(()=>setShouldHide(isLastRendered));};useEffect(()=>{evaluateVisibility();},[]);useEffect(()=>{if(typeof window===\"undefined\"||typeof MutationObserver===\"undefined\"){return;}const root=localRef.current;if(!root)return;const context=findEntryContext(root);const observer=new MutationObserver(()=>{evaluateVisibility();});observer.observe(root,{childList:true,subtree:true,characterData:false,attributes:true,attributeFilter:[\"style\",\"class\",\"hidden\",\"aria-hidden\"]});if(context?.list){observer.observe(context.list,{childList:true,subtree:true,attributes:true,attributeFilter:[\"style\",\"class\",\"hidden\",\"aria-hidden\"]});}const handleResize=()=>{evaluateVisibility();};window.addEventListener(\"resize\",handleResize);return()=>{window.removeEventListener(\"resize\",handleResize);observer.disconnect();};},[]);return /*#__PURE__*/_jsx(Component,{ref:node=>{localRef.current=node;if(typeof ref===\"function\")ref(node);else if(ref)ref.current=node;},...props,style:shouldHide?{...props.style,display:\"none\"}:{...props.style}});});}\nexport const __FramerMetadata__ = {\"exports\":{\"HideTrailingAuthorSeparator\":{\"type\":\"reactHoc\",\"name\":\"HideTrailingAuthorSeparator\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HideTrailingAuthorSeparator.map"],"mappings":"uJACmH,SAAS,EAAkB,EAAQ,CAAC,GAAU,IAAS,OAAY,MAAO,GAAK,IAAM,EAAS,EAAO,iBAAiB,CAAO,EAAE,OAAO,EAAS,UAAU,QAAQ,EAAS,aAAa,QAAS,CAAC,SAAS,EAAiB,EAAc,CAAC,IAAI,EAAQ,EAAc,KAAM,GAAQ,CAAC,IAAM,EAAU,EAAQ,cAAc,GAAG,CAAC,EAAU,OAAO,KAA0G,IAA7E,EAAU,yBAAyB,MAAM,EAAU,qBAAqB,OAA2B,EAAU,cAAe,MAAM,CAAC,MAAM,EAAU,KAAK,EAAU,aAAa,EAAG,EAAQ,CAAU,CAAC,OAAO,IAAK,CAAC,SAAgB,EAA4B,EAAU,CAAC,OAAoB,EAAW,SAA6C,EAAM,EAAI,CAAC,IAAM,EAASA,EAAO,IAAI,EAAO,CAAC,EAAW,GAAeC,EAAS,EAAK,EAAQ,MAAuB,CAAC,GAAU,IAAS,QAAa,OAAO,SAAW,IAAa,OAAQ,IAAM,EAAK,EAAS,QAAQ,GAAG,CAAC,EAAK,OAAO,IAAM,EAAQ,EAAiB,CAAI,EAAE,GAAG,CAAC,EAA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