{"version":3,"file":"CopyCodeFromPanel.kj3m95N6.mjs","names":["useId","useMemo","_Fragment","useState","useRef","useCallback","useMemo"],"sources":["https:/framerusercontent.com/modules/7UlPfnKi2NQx82q6wLY4/08TLKJM7rrhUBeLAr0Ft/ReferenceScrollbar.js","https:/framerusercontent.com/modules/NdfwjQFfziiR5e4t7QNq/ZiR2ANanMWTfxbR3Q91Y/CopyCodeFromPanel.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{forwardRef,useId,useMemo}from\"react\";// User request: Create a code override export withReferenceScrollbar in ReferenceScrollbar.tsx for an existing native Framer scrolling frame. Do NOT rebuild canvas content. Need browser scrollbar CSS unavailable natively: reference thin pale lavender-gray rounded thumb approx #E4E4EF, 10px wide, transparent track, no arrows, rounded ends; style horizontal same. Preserve all existing style, props, ref and scrolling. Use scoped class CSS injected safely, no global scrollbar changes, Firefox thin scrollbar fallback. Frame overflow auto already set. Apply only wrapped frame. SSR safe. No extra dependencies. Return override id.\nexport function withReferenceScrollbar(Component){return /*#__PURE__*/forwardRef(function WithReferenceScrollbar(props,ref){const reactId=useId();const scopedClass=useMemo(()=>`reference-scrollbar-${reactId.replace(/[^a-zA-Z0-9_-]/g,\"\")}`,[reactId]);const className=props.className?`${props.className} ${scopedClass}`:scopedClass;const css=useMemo(()=>`\n@supports selector(::-webkit-scrollbar) {\n.${scopedClass} {\n  scrollbar-width: auto;\n  scrollbar-color: auto;\n}\n\n.${scopedClass}::-webkit-scrollbar {\n  -webkit-appearance: none;\n  appearance: none;\n  width: 6px;\n  height: 6px;\n}\n\n.${scopedClass}::-webkit-scrollbar:horizontal {\n  width: 6px;\n  height: 6px;\n}\n\n.${scopedClass}::-webkit-scrollbar:vertical {\n  width: 6px;\n  height: 6px;\n}\n\n.${scopedClass}::-webkit-scrollbar-track {\n  background: transparent;\n  border: none;\n  box-shadow: none;\n}\n\n.${scopedClass}::-webkit-scrollbar-track-piece {\n  background: transparent;\n  border: none;\n  box-shadow: none;\n}\n\n.${scopedClass}::-webkit-scrollbar-thumb {\n  background-color: rgba(228, 228, 239, 0.3);\n  border-radius: 999px;\n  border: none;\n  box-shadow: none;\n}\n\n.${scopedClass}::-webkit-scrollbar-thumb:hover,\n.${scopedClass}::-webkit-scrollbar-thumb:active {\n  background-color: rgba(228, 228, 239, 0.3);\n}\n\n.${scopedClass}::-webkit-scrollbar-corner {\n  background: transparent;\n}\n\n.${scopedClass}::-webkit-scrollbar-button,\n.${scopedClass}::-webkit-scrollbar-button:single-button,\n.${scopedClass}::-webkit-scrollbar-button:single-button:start,\n.${scopedClass}::-webkit-scrollbar-button:single-button:end,\n.${scopedClass}::-webkit-scrollbar-button:single-button:increment,\n.${scopedClass}::-webkit-scrollbar-button:single-button:decrement,\n.${scopedClass}::-webkit-scrollbar-button:start,\n.${scopedClass}::-webkit-scrollbar-button:end,\n.${scopedClass}::-webkit-scrollbar-button:increment,\n.${scopedClass}::-webkit-scrollbar-button:decrement {\n  width: 0;\n  height: 0;\n  display: none;\n}\n}\n\n@supports not selector(::-webkit-scrollbar) {\n.${scopedClass} {\n  scrollbar-width: thin;\n  scrollbar-color: rgba(228, 228, 239, 0.3) transparent;\n}\n}\n`,[scopedClass]);return /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"style\",{children:css}),/*#__PURE__*/_jsx(Component,{ref:ref,...props,className:className,style:props.style})]});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withReferenceScrollbar\":{\"type\":\"reactHoc\",\"name\":\"withReferenceScrollbar\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ReferenceScrollbar.map","import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,startTransition,useCallback,useEffect,useMemo,useRef,useState}from\"react\";// User request: Update CopyCodeFromPanel.tsx so the copy action always copies the entire active code snippet only. The panel now contains three code panes with ids `snippet-curl-code`, `snippet-python-code`, and `snippet-node-code`; only one is visible at a time. From the copy button, locate the nearest `#snippet-code-content` panel, find the visible pane among those three (computed style must not be display:none/visibility:hidden), use that pane’s full textContent/innerText rather than the panel content, strip line-number prefixes from every line, and copy the complete result. Preserve the current check-icon success behavior and direct button event handling.\nexport function CopyCodeFromPanel(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const resetFeedbackTimeoutRef=useRef(null);useEffect(()=>{return()=>{if(typeof window!==\"undefined\"&&resetFeedbackTimeoutRef.current!==null){window.clearTimeout(resetFeedbackTimeoutRef.current);}};},[]);const getButtonFromEvent=useCallback(event=>{if(typeof window===\"undefined\")return null;const currentTarget=event?.currentTarget;if(currentTarget instanceof HTMLElement)return currentTarget;const eventTarget=event?.target;if(eventTarget instanceof HTMLElement){return eventTarget.closest(\"button, [role='button']\");}return null;},[]);const normalizeCodeText=useCallback(rawText=>{return rawText.split(\"\\n\").map(line=>line.replace(/^\\s*\\d+\\s*/,\"\")).join(\"\\n\").trim();},[]);const isElementVisible=useCallback(element=>{if(typeof window===\"undefined\")return false;if(element.hidden)return false;if(element.getAttribute(\"aria-hidden\")===\"true\")return false;const style=window.getComputedStyle(element);if(style.display===\"none\")return false;if(style.visibility===\"hidden\")return false;if(style.opacity===\"0\")return false;const rect=element.getBoundingClientRect();return rect.width>0&&rect.height>0;},[]);const getVisibleCodePane=useCallback(snippet=>{if(typeof window===\"undefined\")return null;const paneIds=[\"snippet-curl-code\",\"snippet-python-code\",\"snippet-node-code\"];for(const paneId of paneIds){const pane=snippet.querySelector(`#${paneId}`);if(!pane)continue;if(isElementVisible(pane)){return pane;}}const fallbackCandidates=snippet.querySelectorAll(\"pre, code, [data-code-pane], [data-snippet-pane]\");for(const candidate of fallbackCandidates){if(candidate instanceof HTMLElement&&isElementVisible(candidate)){return candidate;}}return null;},[isElementVisible]);const setCopiedFeedbackTemporarily=useCallback((button,panelRoot)=>{const previousLabel=button.getAttribute(\"aria-label\")??\"Copy code\";const copyCodeIcon=panelRoot.querySelector(\"#copy-code-icon\");const copiedCodeIcon=panelRoot.querySelector(\"#copied-code-icon\");const previousCopyIconHidden=copyCodeIcon?.hidden??false;const previousCopiedIconHidden=copiedCodeIcon?.hidden??true;button.setAttribute(\"aria-label\",\"Copied code\");if(copyCodeIcon)copyCodeIcon.hidden=true;if(copiedCodeIcon)copiedCodeIcon.hidden=false;if(typeof window!==\"undefined\"){if(resetFeedbackTimeoutRef.current!==null){window.clearTimeout(resetFeedbackTimeoutRef.current);}resetFeedbackTimeoutRef.current=window.setTimeout(()=>{button.setAttribute(\"aria-label\",previousLabel);if(copyCodeIcon)copyCodeIcon.hidden=previousCopyIconHidden;if(copiedCodeIcon)copiedCodeIcon.hidden=previousCopiedIconHidden;},1600);}},[]);const copySnippetText=useCallback(async button=>{if(typeof document===\"undefined\")return;const apiCodeTabsRoot=button.closest(\"#api-code-tabs\");if(!apiCodeTabsRoot)return;const snippet=apiCodeTabsRoot.querySelector(\"#snippet-code-content\");if(!snippet)return;const visiblePane=getVisibleCodePane(snippet);if(!visiblePane)return;const rawText=visiblePane.innerText||visiblePane.textContent||\"\";const textToCopy=normalizeCodeText(rawText);if(!textToCopy)return;let copied=false;if(typeof navigator!==\"undefined\"&&navigator.clipboard?.writeText){try{await navigator.clipboard.writeText(textToCopy);copied=true;}catch(_error){copied=false;}}if(!copied&&typeof document!==\"undefined\"){const textArea=document.createElement(\"textarea\");textArea.value=textToCopy;textArea.setAttribute(\"readonly\",\"\");textArea.style.position=\"absolute\";textArea.style.left=\"-9999px\";textArea.style.opacity=\"0\";document.body.appendChild(textArea);textArea.select();copied=document.execCommand(\"copy\");document.body.removeChild(textArea);}if(copied){setCopiedFeedbackTemporarily(button,snippet);}},[getVisibleCodePane,normalizeCodeText,setCopiedFeedbackTemporarily]);const handleClick=useCallback(async event=>{if(typeof props.onClick===\"function\"){props.onClick(event);}const button=getButtonFromEvent(event);if(!button)return;await copySnippetText(button);},[copySnippetText,getButtonFromEvent,props]);const handleTap=useCallback(async event=>{if(typeof props.onTap===\"function\"){props.onTap(event);}const button=getButtonFromEvent(event);if(!button)return;await copySnippetText(button);},[copySnippetText,getButtonFromEvent,props]);const handleKeyDown=useCallback(async event=>{if(typeof props.onKeyDown===\"function\"){props.onKeyDown(event);}const key=event?.key;if(key!==\"Enter\"&&key!==\" \"&&key!==\"Spacebar\")return;const button=getButtonFromEvent(event);if(!button)return;event?.preventDefault?.();await copySnippetText(button);},[copySnippetText,getButtonFromEvent,props]);return /*#__PURE__*/_jsx(Component,{ref:ref,...props,onClick:handleClick,onTap:handleTap,onKeyDown:handleKeyDown});});}// User request: Create a code override export named withCopyCode for an existing canvas badge in the API Code Tabs component. This override must preserve the badge’s existing visual design and text while making it an accessible copy button. On click or Enter/Space, use navigator.clipboard.writeText (with a safe fallback where possible) to copy the complete code snippet matching the badge label currently rendered: CURL, PYTHON, or NODE.JS. Add a short unobtrusive copied state through an aria-label or title if feasible, but do not alter the visual layout or replace the canvas content. Ensure browser API access happens only from interaction handlers and the override is safe in canvas/SSR.\nexport function withCopyCode(Component){const SNIPPETS={CURL:`curl -X POST https://api.pline.ai/crawl \\\\\n  -H \"Authorization: Bearer $PLINE_API_KEY\" \\\\\n  -H \"Content-Type: application/json\" \\\\\n  -d '{\n    \"url\": \"https://example.com/docs\",\n    \"limit\": 500,\n    \"output\": {\n      \"markdown\": true\n    }\n  }'`,PYTHON:`import requests\n\nres = requests.post(\n    \"https://api.pline.ai/crawl\",\n    headers={\"Authorization\": f\"Bearer {API_KEY}\"},\n    json={\n        \"url\": \"https://example.com/docs\",\n        \"limit\": 500,\n        \"output\": {\n            \"markdown\": True\n        }\n    },\n)\njob = res.json()\nprint(job[\"id\"])  # poll GET /crawl/{id}`,\"NODE.JS\":`const res = await fetch(\"https://api.pline.ai/crawl\", {\n  method: \"POST\",\n  headers: {\n    Authorization: \\`Bearer \\${process.env.PLINE_API_KEY}\\`,\n    \"Content-Type\": \"application/json\",\n  },\n  body: JSON.stringify({\n    \"url\": \"https://example.com/docs\",\n    \"limit\": 500,\n    \"output\": {\n      \"markdown\": true\n    }\n  }),\n});\nconst data = await res.json();\nconsole.log(data.id); // poll GET /crawl/{id}`};return /*#__PURE__*/forwardRef((props,ref)=>{const[copied,setCopied]=useState(false);const resetTimerRef=useRef(null);useEffect(()=>{return()=>{if(typeof window!==\"undefined\"&&resetTimerRef.current!==null){window.clearTimeout(resetTimerRef.current);}};},[]);const scheduleCopiedReset=useCallback(()=>{if(typeof window===\"undefined\")return;if(resetTimerRef.current!==null){window.clearTimeout(resetTimerRef.current);}resetTimerRef.current=window.setTimeout(()=>{startTransition(()=>setCopied(false));},1400);},[]);const resolveLanguageLabel=useCallback(element=>{if(!element)return null;const idToLanguage={\"copy-curl\":\"CURL\",\"copy-python\":\"PYTHON\",\"copy-node\":\"NODE.JS\"};const elementId=element.id?.trim().toLowerCase();if(elementId&&idToLanguage[elementId]){return idToLanguage[elementId];}const raw=(element.innerText||element.textContent||\"\").trim();if(!raw)return null;const normalized=raw.toUpperCase();if(normalized.includes(\"NODE.JS\"))return\"NODE.JS\";if(normalized.includes(\"PYTHON\"))return\"PYTHON\";if(normalized.includes(\"CURL\"))return\"CURL\";return null;},[]);const copyForBadge=useCallback(async event=>{const target=(event?.currentTarget)??null;const language=resolveLanguageLabel(target);if(!language)return;const textToCopy=SNIPPETS[language];if(!textToCopy)return;let copiedSuccessfully=false;if(typeof navigator!==\"undefined\"&&navigator.clipboard?.writeText){try{await navigator.clipboard.writeText(textToCopy);copiedSuccessfully=true;}catch(_error){copiedSuccessfully=false;}}if(!copiedSuccessfully&&typeof document!==\"undefined\"){const textArea=document.createElement(\"textarea\");textArea.value=textToCopy;textArea.setAttribute(\"readonly\",\"\");textArea.style.position=\"absolute\";textArea.style.left=\"-9999px\";textArea.style.opacity=\"0\";document.body.appendChild(textArea);textArea.select();copiedSuccessfully=document.execCommand(\"copy\");document.body.removeChild(textArea);}if(copiedSuccessfully){startTransition(()=>setCopied(true));scheduleCopiedReset();}},[resolveLanguageLabel,scheduleCopiedReset]);const handleClick=useCallback(async event=>{if(typeof props.onClick===\"function\")props.onClick(event);if(typeof props.onTap===\"function\")props.onTap(event);await copyForBadge(event);},[copyForBadge,props]);const handleKeyDown=useCallback(async event=>{if(typeof props.onKeyDown===\"function\")props.onKeyDown(event);const key=event?.key;if(key!==\"Enter\"&&key!==\" \"&&key!==\"Spacebar\")return;event?.preventDefault?.();await copyForBadge(event);},[copyForBadge,props]);const accessibilityLabel=useMemo(()=>copied?\"Copied code snippet\":\"Copy code snippet\",[copied]);return /*#__PURE__*/_jsx(Component,{ref:ref,...props,role:props.role??\"button\",tabIndex:props.tabIndex??0,\"aria-label\":accessibilityLabel,title:accessibilityLabel,onClick:handleClick,onTap:handleClick,onKeyDown:handleKeyDown,style:{...props.style,cursor:props.style?.cursor??\"copy\"}});});}const API_CODE_PANES={curl:\"snippet-curl-code\",python:\"snippet-python-code\",node:\"snippet-node-code\"};const INLINE_STYLE_NONE=\"__none__\";function createMapTabOverride(language,Component){return /*#__PURE__*/forwardRef((props,ref)=>{const getTabFromEvent=useCallback(event=>{if(typeof window===\"undefined\")return null;const currentTarget=event?.currentTarget;if(currentTarget instanceof HTMLElement)return currentTarget;const eventTarget=event?.target;if(eventTarget instanceof HTMLElement){return eventTarget.closest(\"[data-api-tab-language], button, [role='tab'], [role='button']\");}return null;},[]);const storeInlineStyleSnapshot=useCallback((element,state)=>{const key=state===\"selected\"?\"data-selected-inline-style\":\"data-unselected-inline-style\";if(element.getAttribute(key)!==null)return;const inlineStyle=element.getAttribute(\"style\");element.setAttribute(key,inlineStyle??INLINE_STYLE_NONE);},[]);const restoreInlineStyleSnapshot=useCallback((element,state)=>{const key=state===\"selected\"?\"data-selected-inline-style\":\"data-unselected-inline-style\";const snapshot=element.getAttribute(key);if(snapshot===null)return;if(snapshot===INLINE_STYLE_NONE){element.removeAttribute(\"style\");return;}element.setAttribute(\"style\",snapshot);},[]);const captureCurrentTabVisualStates=useCallback(root=>{const panes={curl:root.querySelector(`#${API_CODE_PANES.curl}`),python:root.querySelector(`#${API_CODE_PANES.python}`),node:root.querySelector(`#${API_CODE_PANES.node}`)};const activeLanguage=Object.keys(panes).find(key=>{const pane=panes[key];if(!pane)return false;if(pane.hidden)return false;if(typeof window!==\"undefined\"){const style=window.getComputedStyle(pane);return style.display!==\"none\"&&style.visibility!==\"hidden\";}return true;});const tabs=root.querySelectorAll(\"[data-api-tab-language]\");tabs.forEach(tabNode=>{if(!(tabNode instanceof HTMLElement))return;const tabLanguage=tabNode.getAttribute(\"data-api-tab-language\");if(!tabLanguage)return;if(activeLanguage&&tabLanguage===activeLanguage){storeInlineStyleSnapshot(tabNode,\"selected\");}else{storeInlineStyleSnapshot(tabNode,\"unselected\");}});},[storeInlineStyleSnapshot]);const togglePaneVisibility=useCallback((pane,shouldShow)=>{const snapshotKey=\"data-visible-display-value\";const existingSnapshot=pane.getAttribute(snapshotKey);if(existingSnapshot===null){const initialInlineDisplay=pane.style.display;pane.setAttribute(snapshotKey,initialInlineDisplay||\"__auto__\");}if(shouldShow){const savedDisplay=pane.getAttribute(snapshotKey);pane.style.display=savedDisplay&&savedDisplay!==\"__auto__\"?savedDisplay:\"block\";pane.hidden=false;pane.setAttribute(\"aria-hidden\",\"false\");}else{pane.style.display=\"none\";pane.hidden=true;pane.setAttribute(\"aria-hidden\",\"true\");}},[]);const selectLanguage=useCallback((root,selectedLanguage)=>{captureCurrentTabVisualStates(root);const paneEntries=Object.entries(API_CODE_PANES);paneEntries.forEach(([lang,paneId])=>{const pane=root.querySelector(`#${paneId}`);if(!pane)return;togglePaneVisibility(pane,lang===selectedLanguage);});const tabs=root.querySelectorAll(\"[data-api-tab-language]\");tabs.forEach(tabNode=>{if(!(tabNode instanceof HTMLElement))return;const tabLanguage=tabNode.getAttribute(\"data-api-tab-language\");if(!tabLanguage)return;const isSelected=tabLanguage===selectedLanguage;tabNode.setAttribute(\"aria-selected\",isSelected?\"true\":\"false\");tabNode.setAttribute(\"tabindex\",isSelected?\"0\":\"-1\");restoreInlineStyleSnapshot(tabNode,isSelected?\"selected\":\"unselected\");});},[captureCurrentTabVisualStates,restoreInlineStyleSnapshot,togglePaneVisibility]);const activateTab=useCallback(event=>{const target=getTabFromEvent(event);if(!target)return;const root=target.closest(\"#api-code-tabs\");if(!root)return;selectLanguage(root,language);},[getTabFromEvent,language,selectLanguage]);const handleClick=useCallback(event=>{if(typeof props.onClick===\"function\")props.onClick(event);activateTab(event);},[activateTab,props]);const handleTap=useCallback(event=>{if(typeof props.onTap===\"function\")props.onTap(event);activateTab(event);},[activateTab,props]);const handleKeyDown=useCallback(event=>{if(typeof props.onKeyDown===\"function\")props.onKeyDown(event);const key=event?.key;if(key!==\"Enter\"&&key!==\" \"&&key!==\"Spacebar\")return;event?.preventDefault?.();activateTab(event);},[activateTab,props]);const ariaLabel=useMemo(()=>{if(language===\"curl\")return\"cURL\";if(language===\"python\")return\"Python\";return\"Node.js\";},[language]);return /*#__PURE__*/_jsx(Component,{ref:ref,...props,\"data-api-tab-language\":language,role:props.role??\"tab\",\"aria-selected\":props[\"aria-selected\"]??\"false\",\"aria-label\":props[\"aria-label\"]??`${ariaLabel} tab`,\"aria-controls\":API_CODE_PANES[language],tabIndex:props.tabIndex??0,onClick:handleClick,onTap:handleTap,onKeyDown:handleKeyDown});});}export function withCurlMapTab(Component){return createMapTabOverride(\"curl\",Component);}export function withPythonMapTab(Component){return createMapTabOverride(\"python\",Component);}export function withNodeMapTab(Component){return createMapTabOverride(\"node\",Component);}// Fixed text, used only when the code shown next to the button can't be read.\nconst MAP_SNIPPETS={curl:`curl -X POST https://api.pline.ai/map \\\\\n  -H \"Authorization: Bearer $PLINE_API_KEY\" \\\\\n  -H \"Content-Type: application/json\" \\\\\n  -d '{\n    \"url\": \"https://example.com\",\n    \"includeSubdomains\": true,\n    \"limit\": 5000\n  }'`,python:`import requests\n\nres = requests.post(\n    \"https://api.pline.ai/map\",\n    headers={\"Authorization\": f\"Bearer {API_KEY}\"},\n    json={\n        \"url\": \"https://example.com\",\n        \"includeSubdomains\": True,\n        \"limit\": 5000\n    },\n)\nfor link in res.json()[\"links\"]:\n    print(link[\"url\"])`,node:`const res = await fetch(\"https://api.pline.ai/map\", {\n  method: \"POST\",\n  headers: {\n    Authorization: \\`Bearer \\${process.env.PLINE_API_KEY}\\`,\n    \"Content-Type\": \"application/json\",\n  },\n  body: JSON.stringify({\n    \"url\": \"https://example.com\",\n    \"includeSubdomains\": true,\n    \"limit\": 5000\n  }),\n});\nconst data = await res.json();\nconsole.log(data.links.length);`};/* -------------------------------------------------------------------------- *//* Read the code that is currently shown next to a Copy button                *//* -------------------------------------------------------------------------- */function displayedNormalize(value){return(value||\"\").replace(/[^a-z0-9]/gi,\"\").toLowerCase();}function displayedLayerName(element){return element?displayedNormalize(element.getAttribute(\"data-framer-name\")):\"\";}function displayedTextOf(element){if(!element)return\"\";return(element.innerText??element.textContent??\"\").replace(/\\u00a0/g,\" \").trim().toLowerCase();}/** Finds the Copy button frame from whatever element was clicked. */function displayedFindCopyButton(target){let element=target;let depth=0;while(element&&depth<8){if(displayedLayerName(element)===\"copycode\"){return element;}element=element.parentElement;depth+=1;}// Fallback: the outermost element whose only text is \"Copy\".\nlet candidate=target;let found=null;depth=0;while(candidate&&depth<6){const text=displayedTextOf(candidate);if(text===\"copy\"||text===\"copied\"){found=candidate;}else if(found){break;}candidate=candidate.parentElement;depth+=1;}return found;}function displayedCountNumberedLines(text){return text.split(\"\\n\").filter(line=>/^\\s*\\d+(?: {2}| |$)/.test(line)).length;}/** The block that holds both the Copy button and the code. */function displayedFindCodeRoot(button){let element=button.parentElement;let depth=0;while(element&&depth<12){if(displayedLayerName(element)===\"markdownresult\"){return element;}element=element.parentElement;depth+=1;}element=button.parentElement;depth=0;while(element&&depth<12){const text=(element.innerText||\"\").replace(/\\u00a0/g,\" \");if(displayedCountNumberedLines(text)>=2){return element;}element=element.parentElement;depth+=1;}return null;}/** Adds one displayed line; line numbers are dropped, everything else is kept. */function displayedAddLine(target,line){// a line number on its own (separate number column)\nif(/^\\s*\\d+\\s*$/.test(line))return;// a line number in front of the code\nconst match=line.match(/^\\s*\\d+(?: {2}| )(.*)$/);target.push(match?match[1]:line);}function displayedFinish(lines){const copy=lines.slice();while(copy.length&&copy[0].trim()===\"\")copy.shift();while(copy.length&&copy[copy.length-1].trim()===\"\")copy.pop();return copy.join(\"\\n\");}/**\n * Returns the code shown in the dark code box next to the Copy button that\n * was clicked (line numbers removed), or \"\" when it can't be found.\n */function readDisplayedCode(target){if(typeof document===\"undefined\"||!target)return\"\";const button=displayedFindCopyButton(target);if(!button)return\"\";const root=displayedFindCodeRoot(button);if(!root)return\"\";const lines=[];// Every text layer that comes after the Copy button inside the block.\n// The header (\"POST/map\", \"Copy\") comes before it, the code after it.\nconst parts=Array.from(root.querySelectorAll(\"p, h1, h2, h3, h4, h5, h6\"));for(const part of parts){if(button.contains(part))continue;const position=button.compareDocumentPosition(part);if(!(position&Node.DOCUMENT_POSITION_FOLLOWING))continue;const text=(part.textContent||\"\").replace(/\\u00a0/g,\" \").replace(/\\r/g,\"\");for(const line of text.split(\"\\n\")){displayedAddLine(lines,line);}}const fromLayers=displayedFinish(lines);if(fromLayers)return fromLayers;// Fallback: the visible text after the \"Copy\" label.\nconst fallback=[];const all=(root.innerText||root.textContent||\"\").replace(/\\u00a0/g,\" \").replace(/\\r/g,\"\").split(\"\\n\");const copyIndex=all.findIndex(line=>/^\\s*(copy|copied)\\s*$/i.test(line));const body=copyIndex>=0?all.slice(copyIndex+1):all;for(const line of body){displayedAddLine(fallback,line);}return displayedFinish(fallback);}function createMapSnippetCopyOverride(language,Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[copied,setCopied]=useState(false);const resetTimerRef=useRef(null);useEffect(()=>{return()=>{if(typeof window!==\"undefined\"&&resetTimerRef.current!==null){window.clearTimeout(resetTimerRef.current);}};},[]);const copySnippet=useCallback(async event=>{// Copy exactly what the active tab shows. The fixed text is\n// only a fallback for when the shown code can't be read.\nconst target=(event?.target)??(event?.currentTarget)??null;const shown=readDisplayedCode(target);const textToCopy=shown||MAP_SNIPPETS[language];if(!textToCopy)return;let copiedSuccessfully=false;if(typeof navigator!==\"undefined\"&&navigator.clipboard?.writeText){try{await navigator.clipboard.writeText(textToCopy);copiedSuccessfully=true;}catch(_error){copiedSuccessfully=false;}}if(!copiedSuccessfully&&typeof document!==\"undefined\"){const textArea=document.createElement(\"textarea\");textArea.value=textToCopy;textArea.setAttribute(\"readonly\",\"\");textArea.style.position=\"absolute\";textArea.style.left=\"-9999px\";textArea.style.opacity=\"0\";document.body.appendChild(textArea);textArea.select();copiedSuccessfully=document.execCommand(\"copy\");document.body.removeChild(textArea);}if(copiedSuccessfully){startTransition(()=>setCopied(true));if(typeof window!==\"undefined\"){if(resetTimerRef.current!==null){window.clearTimeout(resetTimerRef.current);}resetTimerRef.current=window.setTimeout(()=>{startTransition(()=>setCopied(false));},1400);}}},[language]);const handleClick=useCallback(async event=>{if(typeof props.onClick===\"function\")props.onClick(event);await copySnippet(event);},[copySnippet,props]);const handleTap=useCallback(async event=>{if(typeof props.onTap===\"function\")props.onTap(event);await copySnippet(event);},[copySnippet,props]);const handleKeyDown=useCallback(async event=>{if(typeof props.onKeyDown===\"function\")props.onKeyDown(event);const key=event?.key;if(key!==\"Enter\"&&key!==\" \"&&key!==\"Spacebar\")return;event?.preventDefault?.();await copySnippet(event);},[copySnippet,props]);const copyLabel=useMemo(()=>{if(language===\"curl\")return\"Copy cURL map example\";if(language===\"python\")return\"Copy Python map example\";return\"Copy Node.js map example\";},[language]);const copiedLabel=useMemo(()=>{if(language===\"curl\")return\"Copied cURL map example\";if(language===\"python\")return\"Copied Python map example\";return\"Copied Node.js map example\";},[language]);const accessibilityLabel=copied?copiedLabel:copyLabel;return /*#__PURE__*/_jsx(Component,{ref:ref,...props,role:props.role??\"button\",tabIndex:props.tabIndex??0,\"aria-label\":props[\"aria-label\"]??accessibilityLabel,title:props.title??accessibilityLabel,onClick:handleClick,onTap:handleTap,onKeyDown:handleKeyDown});});}export function copyMapCurl(Component){return createMapSnippetCopyOverride(\"curl\",Component);}export function copyMapPython(Component){return createMapSnippetCopyOverride(\"python\",Component);}export function copyMapNode(Component){return createMapSnippetCopyOverride(\"node\",Component);}\nexport const __FramerMetadata__ = {\"exports\":{\"withPythonMapTab\":{\"type\":\"reactHoc\",\"name\":\"withPythonMapTab\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"copyMapNode\":{\"type\":\"reactHoc\",\"name\":\"copyMapNode\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"CopyCodeFromPanel\":{\"type\":\"reactHoc\",\"name\":\"CopyCodeFromPanel\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"copyMapPython\":{\"type\":\"reactHoc\",\"name\":\"copyMapPython\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCurlMapTab\":{\"type\":\"reactHoc\",\"name\":\"withCurlMapTab\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withNodeMapTab\":{\"type\":\"reactHoc\",\"name\":\"withNodeMapTab\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCopyCode\":{\"type\":\"reactHoc\",\"name\":\"withCopyCode\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"copyMapCurl\":{\"type\":\"reactHoc\",\"name\":\"copyMapCurl\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CopyCodeFromPanel.map"],"mappings":"sMACA,SAAgB,EAAuB,EAAU,CAAC,OAAoB,EAAW,SAAgC,EAAM,EAAI,CAAC,IAAM,EAAQA,EAAM,EAAQ,EAAYC,MAAY,uBAAuB,EAAQ,QAAQ,kBAAkB,EAAE,IAAI,CAAC,CAAO,CAAC,EAAQ,EAAU,EAAM,UAAU,GAAG,EAAM,UAAU,GAAG,IAAc,EA0E7S,OAAoB,EAAMC,EAAU,CAAC,SAAS,CAAc,EAAK,QAAQ,CAAC,SA1EyPD,MAAY;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