{"version":3,"file":"CodeBlock_2.DdaPpNq7.mjs","names":["useState","code"],"sources":["https:/framerusercontent.com/modules/0NlvrEqpincx6ZeOsrSb/WWLYvlyzLQUgiNPCBTNq/CodeBlock_2.js"],"sourcesContent":["// Create a syntax-highlighted code block component that displays code with TypeScript syntax highlighting\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useState}from\"react\";/**\n * Syntax Highlighted Code Block\n *\n * @framerIntrinsicWidth 800\n * @framerIntrinsicHeight 400\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function CodeBlock(props){const{code=`import { PlainClient, uiComponent } from '@team-plain/typescript-sdk';\n\nconst client = new PlainClient({ apiKey });\n\nawait client.createCustomerEvent({\n  title: 'Plan upgraded',\n  customerIdentifier: {\n    emailAddress: 'jane@acme.com',\n  },\n  components: [\n    uiComponent.text({\n      text: '**Acme Inc** upgraded from Starter to Enterprise. MRR: $2,400/mo',\n    }),\n    uiComponent.linkButton({\n      label: 'View in Stripe',\n      url: 'https://dashboard.stripe.com/customers/cus_4821',\n    }),\n  ],\n});`,language=\"TypeScript\",backgroundColor=\"#1a1a1a\",textColor=\"#d4d4d4\",keywordColor=\"#c586c0\",stringColor=\"#6a9955\",commentColor=\"#6a9955\",functionColor=\"#dcdcaa\",numberColor=\"#b5cea8\",showHeader=true,showCopyButton=true,borderRadius=12,padding=24,font,headerFont,style}=props;const[copied,setCopied]=useState(false);const handleCopy=()=>{if(typeof navigator!==\"undefined\"&&navigator.clipboard){navigator.clipboard.writeText(code);setCopied(true);setTimeout(()=>setCopied(false),2e3);}};const highlightSyntax=code=>{const keywords=[\"import\",\"from\",\"const\",\"await\",\"new\",\"export\",\"default\",\"function\",\"return\",\"if\",\"else\",\"for\",\"while\",\"class\",\"interface\",\"type\",\"let\",\"var\"];const keywordPattern=new RegExp(`\\\\b(${keywords.join(\"|\")})\\\\b`,\"g\");const stringPattern=/(['\"`])(?:(?=(\\\\?))\\2.)*?\\1/g;const commentPattern=/(\\/\\/.*$|\\/\\*[\\s\\S]*?\\*\\/)/gm;const functionPattern=/\\b([a-zA-Z_$][a-zA-Z0-9_$]*)\\s*\\(/g;const numberPattern=/\\b(\\d+)\\b/g;let highlighted=code;const tokens=[];let match;while((match=stringPattern.exec(code))!==null){tokens.push({start:match.index,end:match.index+match[0].length,type:\"string\"});}while((match=commentPattern.exec(code))!==null){tokens.push({start:match.index,end:match.index+match[0].length,type:\"comment\"});}while((match=functionPattern.exec(code))!==null){tokens.push({start:match.index,end:match.index+match[1].length,type:\"function\"});}while((match=numberPattern.exec(code))!==null){tokens.push({start:match.index,end:match.index+match[0].length,type:\"number\"});}while((match=keywordPattern.exec(code))!==null){const overlaps=tokens.some(token=>match.index>=token.start&&match.index<token.end);if(!overlaps){tokens.push({start:match.index,end:match.index+match[0].length,type:\"keyword\"});}}tokens.sort((a,b)=>a.start-b.start);const parts=[];let lastIndex=0;tokens.forEach(token=>{if(token.start>lastIndex){parts.push({text:code.slice(lastIndex,token.start),color:textColor});}const tokenText=code.slice(token.start,token.end);let color=textColor;switch(token.type){case\"keyword\":color=keywordColor;break;case\"string\":color=stringColor;break;case\"comment\":color=commentColor;break;case\"function\":color=functionColor;break;case\"number\":color=numberColor;break;}parts.push({text:tokenText,color});lastIndex=token.end;});if(lastIndex<code.length){parts.push({text:code.slice(lastIndex),color:textColor});}return parts;};const highlightedParts=highlightSyntax(code);return /*#__PURE__*/_jsxs(\"div\",{style:{...style,width:\"100%\",height:\"100%\",backgroundColor,borderRadius,overflow:\"hidden\",display:\"flex\",flexDirection:\"column\"},children:[showHeader&&/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",justifyContent:\"space-between\",alignItems:\"center\",padding:`${padding*.67}px ${padding}px`,borderBottom:`1px solid rgba(255, 255, 255, 0.1)`},children:[/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",alignItems:\"center\",gap:12},children:[/*#__PURE__*/_jsxs(\"svg\",{width:\"20\",height:\"20\",viewBox:\"0 0 24 24\",fill:\"none\",stroke:textColor,strokeWidth:\"2\",children:[/*#__PURE__*/_jsx(\"polyline\",{points:\"16 18 22 12 16 6\"}),/*#__PURE__*/_jsx(\"polyline\",{points:\"8 6 2 12 8 18\"})]}),/*#__PURE__*/_jsx(\"span\",{style:{color:textColor,...headerFont},children:language})]}),showCopyButton&&/*#__PURE__*/_jsx(\"button\",{onClick:handleCopy,style:{background:\"transparent\",border:\"none\",cursor:\"pointer\",padding:8,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",borderRadius:6,transition:\"background 0.2s\"},onMouseEnter:e=>{e.currentTarget.style.background=\"rgba(255, 255, 255, 0.1)\";},onMouseLeave:e=>{e.currentTarget.style.background=\"transparent\";},children:copied?/*#__PURE__*/_jsx(\"svg\",{width:\"20\",height:\"20\",viewBox:\"0 0 24 24\",fill:\"none\",stroke:\"#6a9955\",strokeWidth:\"2\",children:/*#__PURE__*/_jsx(\"polyline\",{points:\"20 6 9 17 4 12\"})}):/*#__PURE__*/_jsxs(\"svg\",{width:\"20\",height:\"20\",viewBox:\"0 0 24 24\",fill:\"none\",stroke:textColor,strokeWidth:\"2\",children:[/*#__PURE__*/_jsx(\"rect\",{x:\"9\",y:\"9\",width:\"13\",height:\"13\",rx:\"2\",ry:\"2\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1\"})]})})]}),/*#__PURE__*/_jsx(\"div\",{style:{flex:1,overflow:\"auto\",padding},children:/*#__PURE__*/_jsx(\"pre\",{style:{margin:0,...font,whiteSpace:\"pre-wrap\",wordBreak:\"break-word\"},children:highlightedParts.map((part,index)=>/*#__PURE__*/_jsx(\"span\",{style:{color:part.color},children:part.text},index))})})]});}addPropertyControls(CodeBlock,{code:{type:ControlType.String,title:\"Code\",defaultValue:`import { PlainClient, uiComponent } from '@team-plain/typescript-sdk';\n\nconst client = new PlainClient({ apiKey });\n\nawait client.createCustomerEvent({\n  title: 'Plan upgraded',\n  customerIdentifier: {\n    emailAddress: 'jane@acme.com',\n  },\n  components: [\n    uiComponent.text({\n      text: '**Acme Inc** upgraded from Starter to Enterprise. MRR: $2,400/mo',\n    }),\n    uiComponent.linkButton({\n      label: 'View in Stripe',\n      url: 'https://dashboard.stripe.com/customers/cus_4821',\n    }),\n  ],\n});`,displayTextArea:true},language:{type:ControlType.String,title:\"Language\",defaultValue:\"TypeScript\"},showHeader:{type:ControlType.Boolean,title:\"Show Header\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},showCopyButton:{type:ControlType.Boolean,title:\"Copy Button\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#1a1a1a\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#d4d4d4\"},keywordColor:{type:ControlType.Color,title:\"Keyword Color\",defaultValue:\"#c586c0\"},stringColor:{type:ControlType.Color,title:\"String Color\",defaultValue:\"#6a9955\"},commentColor:{type:ControlType.Color,title:\"Comment Color\",defaultValue:\"#6a9955\"},functionColor:{type:ControlType.Color,title:\"Function Color\",defaultValue:\"#dcdcaa\"},numberColor:{type:ControlType.Color,title:\"Number Color\",defaultValue:\"#b5cea8\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:12,min:0,max:32,step:1,unit:\"px\"},padding:{type:ControlType.Number,title:\"Padding\",defaultValue:24,min:8,max:48,step:1,unit:\"px\"},font:{type:ControlType.Font,title:\"Code Font\",defaultValue:{fontSize:\"14px\",letterSpacing:\"0em\",lineHeight:\"1.5em\"},controls:\"extended\",defaultFontType:\"monospace\"},headerFont:{type:ControlType.Font,title:\"Header Font\",defaultValue:{fontSize:\"14px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"},controls:\"extended\",defaultFontType:\"sans-serif\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CodeBlock\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerIntrinsicWidth\":\"800\",\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"400\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CodeBlock_2.map"],"mappings":"gMASG,SAAwB,EAAU,EAAM,CAAC,GAAK,CAAC,OAAK;;;;;;;;;;;;;;;;;;KAkBlD,WAAS,aAAa,kBAAgB,UAAU,YAAU,UAAU,eAAa,UAAU,cAAY,UAAU,eAAa,UAAU,gBAAc,UAAU,cAAY,UAAU,aAAW,GAAK,iBAAe,GAAK,eAAa,GAAG,UAAQ,GAAG,OAAK,aAAW,SAAO,EAAW,CAAC,EAAO,GAAWA,EAAS,GAAM,CAAO,MAAe,CAAW,IAAY,QAAa,EAAU,YAAW,EAAU,UAAU,UAAU,EAAK,CAAC,EAAU,GAAK,CAAC,eAAe,EAAU,GAAM,CAAC,IAAI,GAAo1D,GAA1zD,GAAM,CAAgK,IAAM,EAAmB,OAAO,OAAhL,CAAC,SAAS,OAAO,QAAQ,QAAQ,MAAM,SAAS,UAAU,WAAW,SAAS,KAAK,OAAO,MAAM,QAAQ,QAAQ,YAAY,OAAO,MAAM,MAAM,CAAiD,KAAK,IAAI,CAAC,MAAM,IAAI,CAAO,EAAc,+BAAqC,EAAe,+BAAqC,EAAgB,qCAA2C,EAAc,aAAwC,EAAO,EAAE,CAAK,EAAM,MAAO,EAAM,EAAc,KAAKC,EAAK,IAAI,MAAM,EAAO,KAAK,CAAC,MAAM,EAAM,MAAM,IAAI,EAAM,MAAM,EAAM,GAAG,OAAO,KAAK,SAAS,CAAC,CAAE,MAAO,EAAM,EAAe,KAAKA,EAAK,IAAI,MAAM,EAAO,KAAK,CAAC,MAAM,EAAM,MAAM,IAA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