PageSourceSearch

https://connect.com/_next/static/immutable/chunks/388gknom6v__c.js

js connect.com collected 2026-10-02 04:56:16 UTC 45,162 bytes, 3 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,550707,e=>{"use strict";var t=e.i(843476),l=e.i(770703);e.i(513036);var n=e.i(705903);let r=(0,l.default)(()=>e.A(713254).then(e=>e.PdfPreview),{loadableGenerated:{modules:[965984]},ssr:!1,loading:()=>(0,t.jsx)("div",{"aria-hidden":!0,className:"min-h-[28rem] w-full max-w-full animate-pulse bg-muted"})}),i=(0,l.default)(()=>e.A(662328).then(e=>e.PdfCanvas),{loadableGenerated:{modules:[544911]},ssr:!1,loading:()=>(0,t.jsx)("div",{"aria-hidden":!0,className:"min-h-[28rem] w-full max-w-full animate-pulse bg-muted"})}),a=(0,l.default)(()=>e.A(659e3),{loadableGenerated:{modules:[938083]},ssr:!1,loading:()=>(0,t.jsx)("div",{"aria-hidden":!0,className:"min-h-[24rem] w-full animate-pulse rounded-frame bg-muted"})});e.s(["LazyDocumentSample",0,a,"LazyPdfCanvas",0,i,"LazyPdfPreview",0,r,"paintPdfPreview",0,function(e){return function({bytes:l,drawing:r,error:i,width:a,height:s}){return i&&!l?(0,t.jsx)("p",{role:"status",className:"p-4 text-sm text-muted-foreground",children:i}):(0,t.jsx)(n.PdfPages,{data:l,busy:r,aspect:s/a,label:e,className:"p-3"})}}])},757262,e=>{"use strict";var t=e.i(843476),l=e.i(271645),n=e.i(522016),r=e.i(618566),i=e.i(190485);e.i(513036);var a=e.i(768402),s=e.i(547147),o=e.i(534551),d=e.i(764258),c=e.i(685705),u=e.i(207675),m=e.i(308920),f=e.i(815887),p=e.i(33851),x=e.i(797334),h=e.i(297039),g=e.i(235979),b=e.i(550707),y=e.i(835657),j=e.i(81144),v=e.i(264309),v=v,w=e.i(224366),w=w,k=e.i(290254),_=e.i(249472),S=e.i(299875),D=e.i(310108);e.i(746480);var N=e.i(228888),P=e.i(240925);let C="__key";function L(e){return e?(0,N.brandDocumentLayout)(e).footer_text:""}function T(e){return(0,N.brandDocumentLayout)(e??{name:""}).page_numbers}function I(e,t,l){return{...e,footer_text:l===L(t)?null:l}}function F(e,t,l){return{...e,page_numbers:l===T(t)?null:l}}let A=0;function $(){return A+=1,`row-${A}`}function z(e){return e.map(()=>$())}function O(e){return{[C]:$(),...Object.fromEntries(Object.keys(e.fields).map(e=>[e,""]))}}function B(e){return{[C]:$(),...e}}function K(e,t){let l=e[C];return"string"==typeof l?l:`item-${t}`}function M(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,Array.isArray(t)?t.map(e=>B(e)):t]))}function E(e){if(!e.items)return[];let t=e.sample.items??[];return t.length?t.map(B):[O(e.items)]}function R(e){let t=e.sample.body;return t&&"markdown"in t?t.markdown:""}function q(e){let t=e.sample.body;if(t&&"blocks"in t)return t.blocks.map(M);let l=R(e);return l?[{type:"text",markdown:l}]:[{type:"text",markdown:""}]}let H=/^\d{4}-\d{2}-\d{2}$/,U=[["issued_on","due_on"],["period_start","period_end"],["currency","tax_rate"]];function W(e){let t=new Set(e),l=new Set,n=[];for(let r of e){if(l.has(r))continue;let e=U.find(e=>e.includes(r)),i=e?.find(e=>e!==r&&t.has(e));if(i){l.add(i),n.push([r,i]);continue}n.push([r])}return n}function Y(e,t){let l=q(t);return{...e,template_id:t.id,props:{...(0,P.templateDefaults)(t),...t.sample.props},items:E(t),markdown:R(t),blocks:l,block_keys:z(l),page:t.default_page}}function G(e,t,l){let n=[...e],r=n[t],i=n[l];return void 0===r||void 0===i||(n[t]=i,n[l]=r),n}function V(e,t,l){let n=t+l;return n<0||n>=e.blocks.length?e:{...e,blocks:G(e.blocks,t,n),block_keys:G(e.block_keys,t,n)}}function Q(e,t,l){if(e.length<t.min||e.length>t.max)return`Add between ${t.min} and ${t.max} ${l}.`;for(let[l,n]of e.entries())for(let[e,r]of Object.entries(t.fields)){let t=n[e]??"",i=e.replace("_"," ");if(r.required&&!t.trim())return`Line ${l+1} needs a ${i}.`;if(t.length>r.maxLength)return`Keep line ${l+1}'s ${i} under ${r.maxLength} characters.`}return null}function J(e,t){var l;let n,r=e.title.trim(),i=t.items;return{template_id:e.template_id,template_version:1,...r?{title:r}:{},props:(0,P.trimmedProps)(e.props,t),..."props"===t.accepts?{items:i?(l=e.items,n=Object.keys(i.fields),l.map(e=>Object.fromEntries(n.map(t=>[t,(e[t]??"").trim()])))):[]}:{body:"markdown"===e.mode?{markdown:e.markdown}:{blocks:function e(t){return Array.isArray(t)?t.map(e):"object"!=typeof t||null===t?t:Object.fromEntries(Object.entries(t).filter(([e])=>e!==C).map(([t,l])=>[t,e(l)]))}(e.blocks)}},page:e.page,...null===e.footer_text?{}:{footer_text:e.footer_text.trim()},...null===e.page_numbers?{}:{page_numbers:e.page_numbers?"on":"off"},brand_kit_id:e.kit_key===P.YOUSPOT_KIT_KEY?null:e.kit_key}}function X(e){return(0,N.brandDocumentsSummary)(e?.documents)}function Z(e,t,l){let n=J(e,l),r=(0,N.brandDocumentLayout)(t,{page_size:e.page,...null===e.footer_text?{}:{footer_text:e.footer_text},...null===e.page_numbers?{}:{page_numbers:e.page_numbers}});return{version:1,template_id:e.template_id,template_version:1,title:e.title.trim()||l.title,props:n.props,...n.items?{items:n.items}:{},...n.body?{body:n.body}:{},page:r.page_size,footer_text:r.footer_text,page_numbers:r.page_numbers,watermark:!0,kit:t}}let ee={text:"Text",markdown:"Markdown",title:"Title",name:"Name",date:"Date",label:"Label",value:"Value",cells:"Cells",columns:"Columns",rows:"Rows",items:"Stats"};function et(e){return ee[e]??e.replace("_"," ")}function el({label:e,icon:l,isDisabled:n,onPress:r}){return(0,t.jsxs)(S.TooltipTrigger,{children:[(0,t.jsx)(a.Button,{variant:"quiet","aria-label":e,className:"h-6 w-6 px-0 text-muted-foreground hover:text-foreground",isDisabled:n,onPress:r,children:l}),(0,t.jsx)(_.Tooltip,{children:e})]})}function en({block:e,name:l,field:n,onChange:r}){let i,a=(0,D.useFlag)("markdown_editor"),s="string"==typeof(i=e[l])?i:"",o=t=>{var n,i,a;return r((n=e,i=l,a=t,{...n,[i]:a}))};if("markdown"===l&&a)return(0,t.jsx)(g.default,{label:et(l),value:s,maxLength:n.maxLength,minHeight:"8rem",maxHeight:"40vh",isRequired:!0===n.required,onChange:o});let d={size:"compact",label:et(l),value:s,maxLength:n.maxLength,isRequired:!0===n.required,onChange:o};return"textarea"===n.type?(0,t.jsx)(f.TextArea,{...d,rows:"markdown"===l?6:2}):(0,t.jsx)(p.TextField,{...d,type:"text"})}function er({block:e,name:l,field:n,onChange:r}){let i,s=Array.isArray(i=e[l])?i:[],o=Object.keys(n.fields),d=t=>{var n,i,a;return r((n=e,i=l,a=t,{...n,[i]:a}))};return(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)("p",{className:"text-xs font-medium text-muted-foreground",children:et(l)}),s.map((e,l)=>(0,t.jsxs)("div",{className:"flex flex-wrap items-end gap-2",children:[o.map(r=>(0,t.jsx)(p.TextField,{size:"compact",className:"min-w-28 flex-1",label:et(r),value:e[r]??"",maxLength:n.fields[r]?.maxLength,isRequired:n.fields[r]?.required===!0,onChange:e=>d(s.map((t,n)=>n===l?{...t,[r]:e}:t))},r)),(0,t.jsx)(el,{label:"Remove",icon:(0,t.jsx)(w.default,{"aria-hidden":!0,
1className:"size-4"}),isDisabled:s.length<=n.min,onPress:()=>d(s.filter((e,t)=>t!==l))})]},K(e,l))),(0,t.jsxs)(a.Button,{variant:"secondary",className:"self-start",isDisabled:s.length>=n.max,onPress:()=>d([...s,O(n)]),children:["Add ",et(l).toLowerCase().replace(/s$/,"")]})]})}function ei({block:e,onChange:l}){if("table"!==e.type)return null;let n=y.PDF_BLOCKS.table.fields,r=n.columns,i=n.rows,s=e.columns.length,o=e.rows.map(e=>{let t=(0,y.tableCells)(e.cells);return Array.from({length:s},(e,l)=>t[l]??"")}),d=t=>l({...e,rows:t.map(e=>({cells:(0,y.joinTableCells)(e)}))}),c=t=>l({...e,columns:t.map((t,l)=>({...e.columns[l],label:t})),rows:o.map(e=>({cells:(0,y.joinTableCells)(Array.from({length:t.length},(t,l)=>e[l]??""))}))}),u=e.columns.map(e=>e.label);return(0,t.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)("p",{className:"text-xs font-medium text-muted-foreground",children:"Columns"}),(0,t.jsxs)("div",{className:"flex flex-wrap items-end gap-2",children:[e.columns.map((e,l)=>(0,t.jsx)(p.TextField,{size:"compact",className:"min-w-24 flex-1","aria-label":`Column ${l+1}`,value:e.label,maxLength:r.fields.label?.maxLength,onChange:e=>c(u.map((t,n)=>n===l?e:t))},K({...e},l))),(0,t.jsx)(a.Button,{variant:"quiet",isDisabled:u.length<=r.min,onPress:()=>c(u.slice(0,-1)),children:"Fewer"}),(0,t.jsx)(a.Button,{variant:"secondary",isDisabled:u.length>=r.max,onPress:()=>c([...u,""]),children:"Add column"})]})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)("p",{className:"text-xs font-medium text-muted-foreground",children:"Rows"}),o.map((e,l)=>(0,t.jsxs)("div",{className:"flex flex-wrap items-end gap-2",children:[e.map((e,n)=>(0,t.jsx)(p.TextField,{size:"compact",className:"min-w-24 flex-1","aria-label":`${u[n]||`Column ${n+1}`}, row ${l+1}`,value:e,onChange:e=>d(o.map((t,r)=>r===l?t.map((t,l)=>l===n?e:t):t))},`cell-${l}-${n}`)),(0,t.jsx)(el,{label:"Remove",icon:(0,t.jsx)(w.default,{"aria-hidden":!0,className:"size-4"}),isDisabled:o.length<=i.min,onPress:()=>d(o.filter((e,t)=>t!==l))})]},`row-${l}`)),(0,t.jsx)(a.Button,{variant:"secondary",className:"self-start",isDisabled:o.length>=i.max,onPress:()=>d([...o,Array.from({length:s},()=>"")]),children:"Add row"})]})]})}function ea({draft:e,setDraft:l}){let[n]=i.PDF_BLOCK_TYPES;return(0,t.jsxs)("div",{className:"flex flex-col gap-3",children:[e.blocks.map((n,r)=>{let i=y.PDF_BLOCKS[n.type],a=e=>l(t=>({...t,blocks:t.blocks.map((t,l)=>l===r?e:t)}));return(0,t.jsxs)("section",{className:"flex flex-col gap-2 rounded-lg border border-border bg-surface p-3",children:[(0,t.jsxs)("header",{className:"flex h-7 items-center gap-0.5",children:[(0,t.jsx)("h3",{className:"flex-1 text-xs font-medium",children:i.title}),(0,t.jsx)(el,{label:"Move up",icon:(0,t.jsx)(v.default,{"aria-hidden":!0,className:"size-4"}),isDisabled:0===r,onPress:()=>l(e=>V(e,r,-1))}),(0,t.jsx)(el,{label:"Move down",icon:(0,t.jsx)(j.ChevronDownIcon,{"aria-hidden":!0,className:"size-4"}),isDisabled:r===e.blocks.length-1,onPress:()=>l(e=>V(e,r,1))}),(0,t.jsx)(el,{label:"Remove",icon:(0,t.jsx)(w.default,{"aria-hidden":!0,className:"size-4"}),isDisabled:e.blocks.length<=1,onPress:()=>l(e=>(function(e,t){if(e.blocks.length<=1)return e;let l=(e,l)=>l!==t;return{...e,blocks:e.blocks.filter(l),block_keys:e.block_keys.filter(l)}})(e,r))})]}),"table"===n.type?(0,t.jsx)(ei,{block:n,onChange:a}):Object.entries(i.fields).map(([e,l])=>"items"===l.type?(0,t.jsx)(er,{block:n,name:e,field:l,onChange:a},e):(0,t.jsx)(en,{block:n,name:e,field:l,onChange:a},e))]},e.block_keys[r]??n.type)}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)(k.Select,{className:"[&_input]:h-8 [&_input]:text-sm [&_button]:h-8 [&_textarea]:text-sm min-w-40",label:"Add a block",selectedKey:n,onSelectionChange:e=>l(t=>(function(e,t){let l;return e.blocks.length>=i.PDF_LIMITS.blocks?e:{...e,blocks:[...e.blocks,(l=Object.entries(y.PDF_BLOCKS[t].fields).map(([e,t])=>[e,"items"===t.type?Array.from({length:t.min},()=>O(t)):""]),{type:t,...Object.fromEntries(l)})],block_keys:[...e.block_keys,$()]}})(t,String(e))),children:i.PDF_BLOCK_TYPES.map(e=>(0,t.jsx)(k.SelectItem,{id:e,children:y.PDF_BLOCKS[e].title},e))}),(0,t.jsxs)("p",{className:"text-sm text-muted-foreground",children:[e.blocks.length," of ",i.PDF_LIMITS.blocks," blocks"]})]})]})}var es=e.i(255456),eo=e.i(59051),eo=eo,ed=eo,ec=e.i(24037),eu=e.i(716133),em=e.i(988780);let ef={page:"flex flex-col gap-1",panel:"hidden"},ep={page:"text-xs text-muted-foreground",panel:"hidden"},ex={page:"grid gap-6 lg:grid-cols-[minmax(0,1fr)_420px]",panel:"grid gap-6"},eh={page:"flex min-w-0 flex-col gap-2 lg:sticky lg:top-6 lg:self-start",panel:"flex min-w-0 flex-col gap-2"},eg={page:"flex min-w-0 flex-col gap-3 lg:sticky lg:top-6 lg:max-h-[calc(100vh-7rem)]",panel:"flex min-w-0 flex-col gap-3"},eb={letter:"Letter",a4:"A4"},ey={edit:"Edit",preview:"Preview"},ej={markdown:"Markdown",blocks:"Blocks"},ev={description:"Description",quantity:"Qty",unit_price:"Unit price",date:"Date",amount:"Amount"},ew=new Set(["quantity","unit_price","amount","date"]);function ek({kits:e,templates:n,initial:r,savedTemplateId:a,editId:s}){var c,m,f,p;let[x,h]=(0,ec.useEditorDraft)(s,r),j=(0,es.useSavedTemplate)("pdf",n.saved??[],a),v=(0,P.kitForKey)(e,x.kit_key),w=(0,P.templateFor)(n.templates,x.template_id),[k,_]=(0,l.useState)(null),[S,N]=(0,l.useState)("edit"),{surface:C,pdfShowing:L}=(0,ec.useStudioHost)(),T="panel"===C?L??"edit":S,I=(c=x,m=h,f=w,p=k,(0,D.useFlag)("markdown_editor")&&"markdown"===c.mode&&"body"===f.accepts?(0,t.jsx)(g.default,{label:"Body",value:c.markdown,maxLength:i.PDF_LIMITS.markdown,placeholder:R(f).split("\n")[0],presentation:"inline",contentClass:i.PDF_BODY_CLASS,controlsSlot:p,minHeight:"10rem",onCh
1ange:e=>m(t=>({...t,markdown:e}))},c.template_id):null),F=!!I&&"edit"===T,A=(0,es.useStudioEditor)({kind:"pdf",mutation:(0,em.useGeneratePdf)(),problem:function(e,t,l){if(!t)return"Choose a brand kit.";if(e.title.length>i.PDF_LIMITS.title)return`Keep the title under ${i.PDF_LIMITS.title} characters.`;if((e.footer_text??"").length>i.PDF_LIMITS.footer)return`Keep the footer under ${i.PDF_LIMITS.footer} characters.`;for(let[t,n]of Object.entries(l.controls)){let l=e.props[t]??"",r=(0,P.controlProblem)(n,n.label,l);if(r)return r;if("date"===n.type&&l&&!H.test(l))return`Pick a date for ${n.label.toLowerCase()}.`}if("props"===l.accepts)return l.items?Q(e.items,l.items,"line items"):null;if("markdown"===e.mode)return e.markdown.trim()?e.markdown.length>i.PDF_LIMITS.markdown?`Keep the body under ${i.PDF_LIMITS.markdown} characters.`:null:"Write the document body.";if(!e.blocks.length)return"Add a block.";if(e.blocks.length>i.PDF_LIMITS.blocks)return`Keep the document under ${i.PDF_LIMITS.blocks} blocks.`;for(let[t,l]of e.blocks.entries()){let e=function(e,t){let l=y.PDF_BLOCKS[e.type],n=`Block ${t+1} (${l.title.toLowerCase()})`;for(let[t,r]of Object.entries(l.fields)){if("items"===r.type){let l=Q(Array.isArray(e[t])?e[t]:[],r,`${t}`);if(l)return`${n}: ${l}`;continue}let l="string"==typeof e[t]?e[t]:"";if(r.required&&!l.trim())return`${n} needs ${t.replace("_"," ")}.`;if(l.length>r.maxLength)return`${n}: keep ${t.replace("_"," ")} under ${r.maxLength} characters.`}if("table"===e.type){let t=e.rows.findIndex(t=>(0,y.tableCells)(t.cells).length>e.columns.length);if(t>=0)return`${n}: row ${t+1} has more cells than columns.`}return null}(l,t);if(e)return e}return null}(x,v,w),freeDrafts:n.free_drafts,toInput:()=>J(x,w)});return"panel"===C?(0,t.jsx)(eA,{draft:x,setDraft:h,kits:e,templates:n,template:w,kit:v,choice:j,inlineBody:I,editing:F,editor:A,setControls:_,dirty:(0,es.draftChanged)(x,r),editId:s}):(0,t.jsxs)(u.PageLayout,{width:"inherit",className:"flex flex-col gap-4",children:[(0,t.jsxs)("header",{className:ef[C],children:[(0,t.jsx)(d.Eyebrow,{children:"Studio"}),(0,t.jsx)("h1",{className:"font-display text-2xl font-medium",children:"Branded documents"})]}),(0,t.jsxs)("div",{className:ex[C],children:[(0,t.jsxs)("div",{className:eh[C],children:[I&&"page"===C?(0,t.jsx)(eS,{label:"Showing",value:T,options:["edit","preview"],labels:ey,onChange:N}):null,(0,t.jsx)("div",{className:"flex justify-center rounded-frame bg-muted p-4",children:(0,t.jsxs)("div",{className:"w-full max-w-[51rem]",children:[v&&F?(0,t.jsx)(b.LazyPdfCanvas,{payload:Z(x,v,w),body:I}):null,v&&!F?(0,t.jsx)(b.LazyPdfPreview,{payload:Z(x,v,w),paint:(0,b.paintPdfPreview)(w.title)}):null]})}),(0,t.jsx)("p",{className:ep[C],children:F?"Write in the document itself. Select text to format it, then switch to Preview for the exact pages.":`Drawn in your browser by the renderer the download uses. ${X(v)}`})]}),(0,t.jsxs)("aside",{className:eg[C],children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-4 overflow-y-auto pr-1",children:[(0,t.jsxs)(o.DisclosureGroup,{defaultExpandedKeys:["template","content"],allowsMultipleExpanded:!0,children:[(0,t.jsx)(e_,{id:"template",title:"Template",children:(0,t.jsx)(eD,{draft:x,setDraft:h,kits:e,templates:n,template:w,choice:j})}),(0,t.jsx)(e_,{id:"details",title:"Details",children:(0,t.jsx)(eI,{draft:x,setDraft:h,template:w})}),(0,t.jsxs)(e_,{id:"content",title:"Content",children:[w.items?(0,t.jsx)(eP,{draft:x,setDraft:h,spec:w.items}):null,"body"===w.accepts?(0,t.jsx)(eN,{draft:x,setDraft:h,template:w,inline:!!I,controlsRef:_}):null]}),(0,t.jsx)(e_,{id:"document",title:"Document",children:(0,t.jsx)(eF,{draft:x,setDraft:h,kit:v})})]}),(0,t.jsx)(es.RecentArtifacts,{kind:"pdf"})]}),(0,t.jsx)("div",{className:"flex flex-col gap-2 border-t border-border pt-3",children:(0,t.jsx)(es.GenerateFooter,{editor:A})})]})]})]})}function e_({id:e,title:l,children:n}){return(0,t.jsxs)(s.Disclosure,{id:e,children:[(0,t.jsx)(s.DisclosureHeader,{children:(0,t.jsx)("span",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:l})}),(0,t.jsx)(s.DisclosurePanel,{className:"[&>div]:px-0",children:(0,t.jsx)("div",{className:"flex flex-col gap-2 px-3.5 pb-2",children:n})})]})}function eS({label:e,value:l,options:n,labels:r,onChange:i}){return(0,t.jsxs)("div",{className:"flex flex-col gap-0.5 font-sans",children:[(0,t.jsx)("span",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:e}),(0,t.jsx)(h.ToggleButtonGroup,{className:"rounded-lg bg-muted p-0.5",selectionMode:"single",disallowEmptySelection:!0,selectedKeys:new Set([l]),onSelectionChange:e=>{let t=Array.from(e)[0];"string"==typeof t&&i(t)},children:n.map(e=>(0,t.jsx)(x.ToggleButton,{id:e,className:"h-7 flex-1 whitespace-nowrap rounded-md border-transparent px-2 text-xs",children:r[e]??e},e))})]})}function eD({draft:e,setDraft:l,kits:n,templates:r,template:a,choice:s}
1){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(es.TemplateSelect,{size:"compact",templates:r.templates,saved:r.saved??[],choice:s,value:e.template_id,onChange:e=>{let t=(0,P.templateFor)(r.templates,e);t&&l(e=>Y(e,t))}}),(0,t.jsx)(es.SavedTemplateNotice,{choice:s}),(0,t.jsx)(eS,{label:"Page",value:e.page,options:r.options.page,labels:eb,onChange:e=>l(t=>({...t,page:"a4"===e?"a4":"letter"}))}),(0,t.jsx)(es.BrandKitSelect,{size:"compact",kits:n,value:e.kit_key,onChange:e=>l(t=>({...t,kit_key:e}))}),(0,t.jsx)(p.TextField,{size:"compact",label:"Title",value:e.title,placeholder:a.title,maxLength:i.PDF_LIMITS.title,onChange:e=>l(t=>({...t,title:e}))})]})}function eN({draft:e,setDraft:l,template:n,inline:r,controlsRef:a,hideMode:s=!1}){let o=(0,D.useFlag)("markdown_editor"),d=R(n).split("\n")[0],c=e=>l(t=>({...t,markdown:e}));return(0,t.jsxs)(t.Fragment,{children:[s?null:(0,t.jsx)(eS,{label:"Body",value:e.mode,options:["markdown","blocks"],labels:ej,onChange:e=>l(t=>({...t,mode:"blocks"===e?"blocks":"markdown"}))}),"blocks"!==e.mode||s?null:(0,t.jsx)(ea,{draft:e,setDraft:l}),"markdown"===e.mode&&r?(0,t.jsx)("div",{ref:a}):null,"markdown"!==e.mode||r?null:o?(0,t.jsx)(g.default,{label:"Markdown",value:e.markdown,maxLength:i.PDF_LIMITS.markdown,placeholder:d,minHeight:"15rem",onChange:c},e.template_id):(0,t.jsx)(f.TextArea,{size:"compact",label:"Markdown",value:e.markdown,placeholder:d,rows:10,isRequired:!0,onChange:c})]})}function eP({draft:e,setDraft:l,spec:n}){let r=Object.keys(n.fields);return(0,t.jsxs)(t.Fragment,{children:[e.items.map((i,s)=>(0,t.jsxs)("div",{className:"flex flex-wrap items-end gap-1.5",children:[r.map(e=>(0,t.jsx)(p.TextField,{size:"compact",className:ew.has(e)?"w-20 shrink-0":"min-w-32 flex-1",label:ev[e]??e,value:i[e]??"",maxLength:n.fields[e]?.maxLength,isRequired:n.fields[e]?.required===!0,onChange:t=>l(l=>({...l,items:l.items.map((l,n)=>n===s?{...l,[e]:t}:l)}))},e)),(0,t.jsx)(a.Button,{variant:"quiet",className:"h-8 px-2 text-xs",isDisabled:e.items.length<=n.min,onPress:()=>l(e=>e.items.length<=n.min?e:{...e,items:e.items.filter((e,t)=>t!==s)}),children:"Remove"})]},K(i,s))),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(a.Button,{variant:"secondary",className:"h-8 px-2.5 text-xs",isDisabled:e.items.length>=n.max,onPress:()=>l(e=>e.items.length>=n.max?e:{...e,items:[...e.items,O(n)]}),children:"Add line item"}),(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:[e.items.length," of ",n.max]})]})]})}function eC({name:e,control:l,draft:n,setDraft:r,template:i}){let a=n.props[e]??"",s=t=>r(l=>({...l,props:{...l.props,[e]:t}}));if("date"===l.type)return(0,t.jsx)(c.IsoDatePicker,{size:"compact",label:l.label,value:a,isRequired:!0===l.required,className:"min-w-0 flex-1",onChange:s});let o={size:"compact",label:l.label,value:a,placeholder:i.sample.props[e]||l.value,maxLength:l.maxLength,isRequired:!0===l.required,onChange:s};return"textarea"===l.type?(0,t.jsx)(f.TextArea,{...o,rows:2,className:"min-w-0 flex-1"}):(0,t.jsx)(p.TextField,{...o,className:"min-w-0 flex-1",type:"text"})}function eL({draft:e,setDraft:l,template:n}){let r=W(n.fields).flat().filter(e=>n.controls[e]);return r.length?(0,t.jsx)("div",{className:"-mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-sm text-muted-foreground",children:r.map(r=>{let i=n.controls[r],a=e.props[r]??"",s=e=>l(t=>({...t,props:{...t.props,[r]:e}}));return"date"===i.type?(0,t.jsx)(c.IsoDatePicker,{size:"compact",label:i.label,value:a,isRequired:!0===i.required,
1className:"w-auto [&_[data-slot=label]]:sr-only [&>span:first-child]:sr-only [&_[role=group]]:h-7 [&_[role=group]]:cursor-text [&_[role=group]]:rounded [&_[role=group]]:border-0 [&_[role=group]]:bg-transparent [&_[role=group]]:px-1 [&_[role=group]]:text-sm [&_[role=group]]:transition-colors [&_[role=group]:hover]:bg-muted/60 [&_[role=group]:focus-within]:bg-muted/60 [&_[role=group]:focus-within]:ring-2 [&_[role=group]:focus-within]:ring-primary/25",onChange:s},r):(0,t.jsx)("input",{"aria-label":i.label,value:a,placeholder:`Add ${i.label.toLowerCase()}`,maxLength:i.maxLength,onChange:e=>s(e.target.value),className:`${eo.PANEL_INLINE_EDIT} min-w-24 max-w-72 py-0.5 text-sm text-muted-foreground [field-sizing:content]`},r)})}):null}function eT({draft:e,setDraft:l,kit:r}){let s=L(r);return(0,t.jsxs)("div",{className:"flex flex-col gap-2 text-sm",children:[(0,t.jsxs)("label",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"w-20 shrink-0 text-xs text-muted-foreground",children:"Footer text"}),(0,t.jsx)("input",{value:e.footer_text??"",placeholder:s||"No footer",maxLength:i.PDF_LIMITS.footer,onChange:e=>l(t=>I(t,r,e.target.value)),className:"min-w-0 flex-1 border-0 bg-transparent p-0 text-sm outline-none placeholder:text-muted-foreground/60"}),null===e.footer_text?null:(0,t.jsx)(a.Button,{variant:"quiet",className:"h-6 shrink-0 px-2 text-xs",onPress:()=>l(e=>({...e,footer_text:null})),children:"Reset"})]}),(0,t.jsx)(m.Switch,{isSelected:e.page_numbers??T(r),onChange:e=>l(t=>F(t,r,e)),className:"text-sm",children:"Page numbers"}),(0,t.jsxs)("p",{className:"m-0 text-xs text-muted-foreground",children:[X(r)," ",(0,t.jsx)(n.default,{href:(0,eu.brandSettingsHref)("/studio/pdf"),className:"text-primary hover:underline",children:"Edit in brand kit"})]})]})}function eI({draft:e,setDraft:l,template:n}){return(0,t.jsx)("div",{className:"flex flex-col gap-2",children:W(n.fields).map(r=>(0,t.jsx)("div",{className:"flex items-end gap-2",children:r.map(r=>{let i=n.controls[r];return i?(0,t.jsx)(eC,{name:r,control:i,draft:e,setDraft:l,template:n},r):null})},r.join("-")))})}function eF({draft:e,setDraft:l,kit:r}){let s,o=L(r);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("dl",{className:"m-0 flex flex-col gap-1 text-xs",children:(s=(0,N.resolveBrandDocuments)(r?.documents),N.BRAND_DOCUMENT_LAYOUT_KEYS.map(e=>({key:e,label:N.BRAND_DOCUMENT_FIELD_LABELS[e],value:(0,N.brandDocumentValueLabel)(s[e])}))).map(e=>(0,t.jsxs)("div",{className:"flex items-baseline justify-between gap-3",children:[(0,t.jsx)("dt",{className:"text-muted-foreground",children:e.label}),(0,t.jsx)("dd",{className:"m-0 text-foreground",children:e.value})]},e.key))}),(0,t.jsx)(n.default,{href:(0,eu.brandSettingsHref)("/studio/pdf"),className:"text-xs text-primary hover:underline",children:"Change it in your brand kit"}),(0,t.jsx)(p.TextField,{size:"compact",label:"Footer text",value:e.footer_text??"",placeholder:o||"No footer",maxLength:i.PDF_LIMITS.footer,onChange:e=>l(t=>I(t,r,e))}),null===e.footer_text?null:(0,t.jsx)(a.Button,{variant:"quiet",className:"h-7 self-start px-2 text-xs",onPress:()=>l(e=>({...e,footer_text:null})),children:"Use the brand footer"}),(0,t.jsx)(m.Switch,{isSelected:e.page_numbers??T(r),onChange:e=>l(t=>F(t,r,e)),children:"Page numbers"})]})}function eA({draft:e,setDraft:l,kits:n,templates:r,template:a,kit:s,choice:o,inlineBody:d,editing:c,editor:u,setControls:m,dirty:f,editId:p}){return(0,t.jsxs)("div",{className:es.PANEL_FORM,children:[(0,t.jsx)(es.InlineTitle,{value:e.title,placeholder:a.title,maxLength:i.PDF_LIMITS.title,onChange:e=>l(t=>({...t,title:e}))}),(0,t.jsx)(eL,{draft:e,setDraft:l,template:a}),(0,t.jsxs)("div",{className:es.PANEL_CHIPS,children:[(0,t.jsx)(es.TemplateSelect,{size:"compact",templates:r.templates,saved:r.saved??[],choice:o,value:e.template_id,onChange:e=>{let t=(0,P.templateFor)(r.templates,e);t&&l(e=>Y(e,t))}}),(0,t.jsx)(es.ChipSelect,{label:"Page",value:e.page,options:r.options.page,labels:eb,onChange:e=>l(t=>({...t,page:"a4"===e?"a4":"letter"}))}),(0,t.jsx)(es.BrandKitSelect,{size:"compact",kits:n,value:e.kit_key,onChange:e=>l(t=>({...t,kit_key:e}))}),(0,t.jsxs)(es.MoreFields,{children:["body"===a.accepts?(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(ed.QuietSegmented,{label:"Body",value:e.mode,options:["markdown","blocks"],labels:ej,onChange:e=>l(t=>({...t,mode:"blocks"===e?"blocks":"markdown"}))}),(0,t.jsx)("div",{ref:m,className:e.markdown.length>.9*i.PDF_LIMITS.markdown?"flex items-center [&>div]:flex-row [&>div]:items-center [&>div]:gap-2 [&_button]:h-6 [&_button]:px-2 [&_button]:text-xs [&>div>*:not(:first-child)]:text-xs":"flex items-center [&>div]:flex-row [&>div]:items-center [&>div]:gap-2 [&>div>*:not(:first-child)]:hidden [&_button]:h-6 [&_button]:px-2 [&_button]:text-xs"})]}):null,(0,t.jsx)(eT,{draft:e,setDraft:l,kit:s})]})]}),(0,t.jsx)(es.SavedTemplateNotice,{choice:o}),a.items?(0,t.jsx)(eP,{draft:e,setDraft:l,spec:a.items}):null,"body"===a.accepts?(0,t.jsx)(e$,{draft:e,setDraft:l,template:a,inline:!!d,setControls:m}):null,s?(0,t.jsx)(ez,{draft:e,kit:s,template:a,inlineBody:c?d:null}):null,(0,t.jsx)(es.PanelFooter,{editor:u,template:{saved:r.saved??[],editId:p,dirty:f,name:e.title||a.title}})]})}function e$({draft:e,setDraft:l,template:n,inline:r,setControls:i}
1){return"blocks"===e.mode?(0,t.jsx)(ea,{draft:e,setDraft:l}):r?null:(0,t.jsx)(eN,{draft:e,setDraft:l,template:n,inline:!1,controlsRef:i,hideMode:!0})}function ez({draft:e,kit:l,template:n,inlineBody:r}){return(0,t.jsx)("div",{className:"w-full rounded-lg bg-muted",children:r?(0,t.jsx)("div",{className:"p-3",children:(0,t.jsx)(b.LazyPdfCanvas,{payload:Z(e,l,n),body:r,matchPreview:!0})}):(0,t.jsx)(b.LazyPdfPreview,{payload:Z(e,l,n),paint:(0,b.paintPdfPreview)(n.title)})})}e.s(["PdfDraftPreview",0,function({draft:e}){let l=(0,em.useStudioBrandKits)(),n=(0,em.usePdfTemplates)(),r=l.data?(0,P.kitForKey)(l.data,e.kit_key):null,i=n.data?(0,P.templateFor)(n.data.templates,e.template_id):null;return r&&i?(0,t.jsx)("div",{className:"w-full rounded-lg bg-muted",children:(0,t.jsx)(b.LazyPdfPreview,{payload:Z(e,r,i),paint:(0,b.paintPdfPreview)(i.title)})}):(0,t.jsx)("div",{"aria-hidden":!0,className:"aspect-[612/792] w-full animate-pulse rounded-lg bg-muted"})},"default",0,function({editId:e}){let l=(0,es.useReturnedBrandKit)(),n=(0,r.useSearchParams)().get("template"),i=(0,P.generatorGate)({availability:(0,em.useStudioAvailability)("pdf"),kits:(0,em.useStudioBrandKits)(),templates:(0,em.usePdfTemplates)(),source:(0,em.useArtifact)(e??""),editId:e,fresh:(e,t)=>(function(e,t,l){let n=(0,P.templateFor)(t,"invoice")??t[0];if(!n)return null;let r=q(n);return{template_id:n.id,title:"",props:{...(0,P.templateDefaults)(n),...n.sample.props},items:E(n),mode:"markdown",markdown:R(n),blocks:r,block_keys:z(r),kit_key:(0,P.defaultKitKey)(e,l),page:n.default_page,footer_text:null,page_numbers:null}})(e,t.templates,l),fromArtifact:(e,t,l)=>(function(e,t,l){if("pdf"!==t.kind)return null;let n=t.inputs,r=n?(0,P.templateFor)(l,n.template_id):null;if(!n||!r)return null;let i=n.brand_kit_id??P.YOUSPOT_KIT_KEY;if(!(0,P.kitForKey)(e,i))return null;let a=n.body,s=a&&"blocks"in a?a.blocks:null,o=s?.length?s.map(M):q(r);return{template_id:r.id,title:n.title??"",props:{...(0,P.templateDefaults)(r),...n.props},items:n.items?.length?n.items.map(B):E(r),mode:s?"blocks":"markdown",markdown:a&&"markdown"in a?a.markdown:R(r),blocks:o,block_keys:z(o),kit_key:i,page:n.page??r.default_page,footer_text:n.footer_text??null,page_numbers:void 0===n.page_numbers?null:"on"===n.page_numbers}})(e,t,l.templates)});return"ready"===i.kind?(0,t.jsx)(ek,{kits:i.kits,templates:i.templates,initial:i.initial,savedTemplateId:n,editId:e},`${e??"new"}:${n??""}`):(0,t.jsx)(es.GeneratorNotice,{kind:"pdf",gate:i})}],757262)},716133,e=>{"use strict";var t=e.i(743412);let l="brand",n=new Set(t.ARTIFACT_KIND_LIST.map(e=>t.ARTIFACT_KINDS[e].studioPath));e.s(["brandReturnHref",0,function(e,t){return e&&n.has(e)?`${e}?brand_kit=${encodeURIComponent(t)}`:null},"brandSettingsHref",0,function(e){let t=new URLSearchParams({section:l});return e&&n.has(e)&&t.set("return",e),`/user/settings?${t.toString()}#${l}`}])},467595,e=>{"use strict";let t=(0,e.i(235884).default)("bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]);e.s(["default",0,t])},81144,e=>{"use strict";var t=e.i(436970);e.s(["ChevronDownIcon",()=>t.default])},264309,e=>{"use strict";let t=(0,e.i(235884).default)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);e.s(["default",0,t])},786541,e=>{"use strict";var t=e.i(228888),l=e.i(571996);function n(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function r(e,t,l){let n=new Set(t);Object.keys(e).some(e=>!n.has(e))&&l()}function i(e,t,{multiline:l=!1}={}){if("string"!=typeof e||Array.from(e).length>t)return!1;let n=l?e.replaceAll("\n","").replaceAll("	",""):e;return!/[\p{Cc}\p{Cs}]/u.test(n)}e.s(["assertKeys",0,r,"isRecord",0,n,"validateRenderKit",0,function(e,a,s,o){if(!n(e))return a("Invalid brand kit");let d=()=>a(o.unexpected);if(r(e,l.BRAND_KIT_KEYS,d),void 0!==e.documents&&!(0,t.isBrandDocuments)(e.documents))return a("Invalid brand documents");let c={...e,review_state:e.review_state??"confirmed"},{domain:u,fontMaxLength:m}=o;return!(0,l.isBrandKit)(c)||!i(c.name,120)||!c.name.trim()||!(null===c.domain||i(c.domain,253)&&(!u||u.test(c.domain)))||!n(c.colors)||!n(c.fonts)||c.radius.length>16||void 0!==m&&l.BRAND_KIT_FONT_ROLES.some(e=>!i(c.fonts[e],m))?a("Invalid brand kit"):(r(c.colors,l.BRAND_KIT_COLOR_KEYS,d),r(c.fonts,l.BRAND_KIT_FONT_ROLES,d),o.fonts?.(c),s(c.logo_url),s(c.logo_dark_url),c)}])},394600,e=>{"use strict";e.i(746480);var t=e.i(571996);e.i(786541);let l=/^(https?:\/\/|mailto:)/i;function n(e){let t=e.trim();return l.test(t)&&!/[\s"'<>]/.test(t)?t:null}function r(e){return null!==e&&/^https:\/\//.test(e)&&n(e)?e:null}function i(e){return e.split("\n").map(e=>`> ${e}`).join("\n")}let a={heading:e=>`## ${e.text}`,text:e=>e.markdown,button:e=>`[${e.label}](${e.url})`,image:e=>`![${e.alt}](${e.url})`,stats:e=>e.items.map(e=>`- **${e.value}** ${e.label}`).join("\n"),steps:e=>e.items.map((e,t)=>`${t+1}. **${e.title}**${e.text?` ${e.text}`:""}`).join("\n"),lines:e=>["| Item | Amount |","| --- | --- |",...e.items.map(e=>`| ${e.label} | ${e.value} |`),...e.total?[`| **Total** | **${e.total}** |`]:[]].join("\n"),quote:e=>e.attribution?`${i(e.text)}
2>
3> _${e.attribution}_`:i(e.text),divider:()=>"---"};e.s(["brandEmailSourceMarkdown",0,function(e){return"markdown"in e?e.markdown:e.blocks.map(e=>a[e.type](e)).join("\n\n")},"escapeHtml",0,function(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#39;")},"keyed",0,function(e){let t=new Map;return e.map((e,l)=>
3{let n=JSON.stringify(e),r=t.get(n)??0;return t.set(n,r+1),{key:`${n}#${r}`,item:e,position:l}})},"renderKit",0,function(e){return{...Object.fromEntries(t.BRAND_KIT_KEYS.filter(t=>t in e).map(t=>[t,e[t]])),logo_url:r(e.logo_url),logo_dark_url:r(e.logo_dark_url)}},"safeHref",0,n])},835657,678779,147147,e=>{"use strict";var t=e.i(843476),l=e.i(394600);function n(e){return`youspot-pdf-markdown-${e}`}e.s(["markdownSlotClass",0,n],678779);let r="Made with YouSpot ",i={breakInside:"avoid"},a={fontVariantNumeric:"tabular-nums"};function s(e,t){return"muted"===t?e.color.muted:"primary"===t?e.color.primary:e.color.foreground}function o(e){return{fontFamily:e.font.body,fontSize:e.size.small,fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase",color:e.color.muted}}function d({theme:e,angle:l}){var n;let i=l??(n=e.page.width,-Math.round(180*Math.atan2(e.page.height,n)/Math.PI));return(0,t.jsx)("div",{style:{display:"flex",position:"fixed",top:0,right:0,bottom:0,left:0,alignItems:"center",justifyContent:"center",pointerEvents:"none",zIndex:-1},children:(0,t.jsx)("div",{style:{display:"flex",flexShrink:0,justifyContent:"center",textAlign:"center",transform:`rotate(${i}deg)`,transformOrigin:"center",fontFamily:e.font.sans,fontSize:Math.round(e.page.width/14),fontWeight:400,letterSpacing:"0.02em",whiteSpace:"nowrap",opacity:.08,color:e.color.muted},children:r})})}function c({theme:e}){return(0,t.jsx)("div",{style:{display:"flex",padding:"1px 6px",borderRadius:e.radius,border:`1px solid ${e.color.primary}`,fontFamily:e.font.body,fontSize:e.size.tiny,fontWeight:700,letterSpacing:"0.06em",textTransform:"uppercase",color:e.color.primary},children:"Draft"})}function u({theme:e,style:l}){return(0,t.jsx)("div",{style:{display:"flex",height:1,width:"100%",backgroundColor:e.color.border,...l}})}function m({theme:e}){if("none"===e.accent)return null;let l="band"===e.accent;return(0,t.jsx)("div",{style:{display:"flex",height:l?3:1,width:"100%",backgroundColor:l?e.color.primary:e.color.border}})}function f({theme:e,height:l=28}){return e.logo?(0,t.jsx)("img",{src:e.logo,alt:"",style:{height:l,maxWidth:200}}):null}function p({theme:e}){return(0,t.jsx)("div",{style:{fontFamily:e.font.heading,fontSize:20,fontWeight:700,lineHeight:1.2,color:e.color.foreground},children:e.brandName})}function x({theme:e}){return e.logo?(0,t.jsx)(f,{theme:e}):(0,t.jsx)(p,{theme:e})}function h({theme:e,kind:l,compact:n=!1,watermark:r=!1}){return(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:n?5:10,width:"100%",paddingLeft:e.space.side,paddingRight:e.space.side},children:[(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%"},children:[n?(0,t.jsx)("div",{style:{fontFamily:e.font.heading,fontSize:e.size.small,fontWeight:700,color:e.color.foreground},children:e.brandName}):(0,t.jsx)(x,{theme:e}),(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:8},children:[(0,t.jsx)("div",{style:o(e),children:l}),r&&!e.hideDraftChip?(0,t.jsx)(c,{theme:e}):null]})]}),(0,t.jsx)(m,{theme:e})]})}function g({theme:e,children:l}){return(0,t.jsx)("div",{style:{fontFamily:e.font.body,fontSize:e.size.heading,fontWeight:600,lineHeight:1.3,color:e.color.foreground},children:l})}function b(e,t){let l="right"===t.align;return{display:"flex",width:t.width,flexGrow:+!t.width,flexShrink:0,padding:"7px 10px",justifyContent:l?"flex-end":"flex-start",textAlign:l?"right":"left",fontSize:e.size.small,...l?a:{}}}function y({theme:e,columns:l,rows:n}){return(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"column",width:"100%"},children:[(0,t.jsx)("div",{style:{display:"flex",flexDirection:"row",width:"100%",backgroundColor:e.color.accent,borderBottom:`1px solid ${e.color.border}`,...i},children:l.map(l=>(0,t.jsx)("div",{style:{...b(e,l),...o(e),width:l.width},children:l.header},l.key))}),n.map(n=>(0,t.jsx)("div",{style:{display:"flex",flexDirection:"row",width:"100%",borderBottom:`1px solid ${e.color.border}`,...i},children:l.map(l=>(0,t.jsx)("div",{style:{...b(e,l),color:e.color.foreground},children:n.cells[l.key]??""},l.key))},n.key))]})}function j(){return(0,t.jsx)("span",{className:"pageNumber"})}function v(){return(0,t.jsx)("span",{className:"totalPages"})}function w({theme:e}){return(0,t.jsx)("div",{style:{display:"flex",breakAfter:"page",he
3ight:e.space.row}})}function k({theme:e,items:l}){return l.length?(0,t.jsx)("div",{style:{display:"flex",flexDirection:"row",gap:e.space.block,width:"100%",...i},children:l.map(l=>(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"column",flexGrow:1,flexBasis:0,gap:4,paddingLeft:10,borderLeft:`2px solid ${e.color.border}`},children:[(0,t.jsx)("div",{style:{fontFamily:e.font.heading,fontSize:e.size.title,fontWeight:700,color:e.color.foreground,...a},children:l.value}),(0,t.jsx)("div",{style:o(e),children:l.label})]},`${l.label}:${l.value}`))}):null}function _({theme:e,title:l,children:n}){return(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6,width:"100%",padding:14,borderLeft:`3px solid ${e.color.primary}`,backgroundColor:e.color.accent,...i},children:[l?.trim()?(0,t.jsx)(g,{theme:e,children:l}):null,n]})}function S({theme:e,name:l,title:n,date:r}){return(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6,width:300,paddingTop:e.space.block,...i},children:[(0,t.jsx)(u,{theme:e}),(0,t.jsx)("div",{style:{fontSize:e.size.body,fontWeight:600,color:e.color.foreground},children:l}),[n,r].filter(e=>e?.trim()).map(l=>(0,t.jsx)("div",{style:{fontSize:e.size.small,color:e.color.muted},children:l},l))]})}let D="Page {page} of {total}";function N({theme:e,format:n=D}){let r=n.split(/(\{page\}|\{total\})/);return(0,t.jsx)("div",{style:{display:"flex",flexDirection:"row",gap:3,fontSize:e.size.small,color:e.color.muted},children:(0,l.keyed)(r.filter(Boolean)).map(({key:e,item:l})=>"{page}"===l?(0,t.jsx)(j,{},e):"{total}"===l?(0,t.jsx)(v,{},e):(0,t.jsx)("span",{children:l},e))})}e.s(["Callout",0,_,"Display",0,function({theme:e,children:l}){return(0,t.jsx)("div",{style:{fontFamily:e.font.heading,fontSize:e.size.display,fontWeight:700,lineHeight:1.15,letterSpacing:"-0.01em",color:e.color.foreground},children:l})},"Heading",0,g,"KeyValue",0,function({theme:e,rows:l}){let n=l.filter(e=>e.value.trim());return n.length?(0,t.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:6,...i},children:n.map(l=>(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"row",gap:12},children:[(0,t.jsx)("div",{style:{...o(e),width:120,flexShrink:0},children:l.label}),(0,t.jsx)("div",{style:{fontSize:e.size.body,fontWeight:"primary"===l.tone?600:400,color:s(e,l.tone??"default")},children:l.value})]},l.label))}):null},"Label",0,function({theme:e,children:l}){return(0,t.jsx)("div",{style:o(e),children:l})},"Lines",0,function({theme:e,text:l,tone:n="default",size:r}){let a=l.split("\n").filter(e=>e.trim());return a.length?(0,t.jsx)("div",{style:{display:"flex",flexDirection:"column",...i},children:a.map((l,i)=>(0,t.jsx)("div",{style:{fontSize:r??e.size.body,lineHeight:1.5,color:s(e,n)},children:l},`${i}:${l}`))}):null},"MarkdownSlot",0,function({theme:e,index:l}){return(0,t.jsx)("div",{className:n(l),style:{display:"flex",flexDirection:"column",width:"100%",color:e.color.foreground}})},"PageBreak",0,w,"PageFooter",0,function({theme:e,format:l=D,watermark:n=!1}){let i=e.footer.text.trim();return i||e.footer.pageNumbers||n?(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6,width:"100%",paddingLeft:e.space.side,paddingRight:e.space.side},children:[(0,t.jsx)(u,{theme:e}),(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:12,width:"100%",fontSize:e.size.small,color:e.color.muted},children:[i?(0,t.jsx)("div",{style:{display:"flex",overflow:"hidden"},children:i}):null,n?(0,t.jsx)("div",{style:{display:"flex",flexShrink:0,justifyContent:"center",fontFamily:e.font.sans,fontWeight:400,whiteSpace:"nowrap",opacity:.5},children:r}):null,e.footer.pageNumbers?(0,t.jsx)(N,{theme:e,format:l}):null]})]}):null},"PageHeader",0,function({theme:e,kind:l,watermark:n=!1}){return(0,t.jsx)(h,{theme:e,kind:l,watermark:n})},"Row",0,function({theme:e,children:l,style:n}){return(0,t.jsx)("div",{style:{display:"flex",flexDirection:"row",alignItems:"flex-start",justifyContent:"space-between",gap:e.space.block,width:"100%",...n},children:l})},"Rule",0,u,"Sheet",0,function({theme:e,children:l,style:n,watermark:r=!1}){return(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:e.space.block,width:"100%",fontFamily:e.font.body,fontSize:e.size.body,lineHeight:1.5,color:e.color.foreground,...n},children:[r?(0,t.jsx)(d,{theme:e}):null,l]})},"Signature",0,S,"Stack",0,function({theme:e,children:l,style:n}){return(0,t.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:e.space.row,...n},children:l})},"Stats",0,k,"Subtitle",0,function({theme:e,children:l}){return(0,t.jsx)("div",{style:{fontSize:e.size.heading,lineHeight:1.4,color:e.color.muted},children:l})},"Table",0,y,"Text",0,function({theme:e,tone:l="default",size:n,children:r,style:i}){return(0,t.jsx)("div",{style:{fontSize:n??e.size.body,color:s(e,l),...i},children:r})},"Totals",0,function({theme:e,rows:l,total:n}){return(0,t.jsx)("div",{style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",...i},children:(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:260},children:[l.map(l=>(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between"},children:[(0,t.jsx)("div",{style:{fontSize:e.size.small,color:e.color.muted},children:l.label}),(0,t.jsx)("div",{style:{fontSize:e.size.small,color:e.color.foreground,...a},children:l.value})]},l.label)),(0,t.jsx)(u,{theme:e}),(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between"},children:[(0,t.jsx)("div",{style:{...o(e),color:e.color.foreground},children:n.label}),(0,t.jsx)("div",{style:{fontFamily:e.font.body,fontSize:e.size.heading,fontWeight:700,color:e.color.primary,...a},children:n.value})]})]})})}],147147);var P=e.i(190485);let C=e=>({type:"text",maxLength:e,required:!0}),L=e=>({type:"text",maxLength:e});function T(e){let t=[],l="";for(let n=0;n<e.length;n+=1){let r=e[n],i=e[n+1];if("\\"===r&&("|"===i||"\\"===i)){l+=i,n+=1;continue}if("|"===r){t.push(l.trim()),l="";continue}l+=r}return t.push(l.trim()),t}let I={heading:{type:"heading",title:"Heading",description:"A section heading.",fields:{text:C(P.PDF_LIMITS.text)},render:(e,l)=>(0,t.jsx)(g,{theme:l,children:e.text})},text:{type:"text",title:"Text",description:"Paragraphs, lists, links and tables written in Markdown.",fields:{markdown:{type:"textarea",maxLength:P.PDF_LIMITS.markdown,required:!0}},render:(e,t,l)=>l.markdown(e.markdown)},table:{type:"table",title:"Table",description:"Column headings and rows, each row's cells separated by a vertical bar (write a literal bar as \\|). The heading row does not repeat after a page break, so split a long table with a page break block.",fields:{columns:{type:"items",fields:{label:C(60)},min:2,max:6},rows:{type:"items",fields:{cells:C(P.PDF_LIMITS.textarea)},min:1,max:40}},render:(e,l)=>(0,t.jsx)(y,{theme:l,columns:e.columns.map((e,t)=>({key:String(t),header:e.label,align:0===t?"left":"right"})),rows:e.rows.map((t,l)=>{let n=T(t.cells);return{key:`${l}:${t.cells}`,cells:Object.fromEntries(e.columns.map((e,t)=>
3[String(t),n[t]??""]))}})})},stats:{type:"stats",title:"Stats",description:"Up to four numbers with labels, side by side.",fields:{items:{type:"items",fields:{label:C(60),value:C(40)},min:1,max:4}},render:(e,l)=>(0,t.jsx)(k,{theme:l,items:e.items})},callout:{type:"callout",title:"Callout",description:"A short aside in the brand accent, with an optional title.",fields:{title:L(P.PDF_LIMITS.text),markdown:{type:"textarea",maxLength:P.PDF_LIMITS.textarea,required:!0}},render:(e,l,n)=>(0,t.jsx)(_,{theme:l,title:e.title,children:n.markdown(e.markdown)})},signature:{type:"signature",title:"Signature",description:"A signature line with a name, a title and a date.",fields:{name:C(80),title:L(80),date:L(40)},render:(e,l)=>(0,t.jsx)(S,{theme:l,name:e.name,title:e.title,date:e.date})},page_break:{type:"page_break",title:"Page break",description:"Starts the next block on a new page.",fields:{},render:(e,l)=>(0,t.jsx)(w,{theme:l})}};Object.values(I).map(e=>({type:e.type,title:e.title,description:e.description,fields:e.fields})),e.s(["PDF_BLOCKS",0,I,"joinTableCells",0,function(e){return e.map(e=>e.replaceAll("\\","\\\\").replaceAll("|","\\|")).join(" | ")},"renderPdfBlock",0,function(e,t,l){return I[e.type].render(e,t,l)},"tableCells",0,T],835657)},190485,e=>{"use strict";e.i(746480);var t=e.i(228888);t.BRAND_DOCUMENT_OPTIONS.page_size,t.BRAND_DOCUMENT_OPTIONS,t.BRAND_DOCUMENT_DEFAULTS,t.BRAND_DOCUMENT_KEYS,e.s(["PDF_BLOCK_TYPES",0,["heading","text","table","stats","callout","signature","page_break"],"PDF_BODY_CLASS",0,"youspot-pdf-body","PDF_LIMITS",0,{title:200,footer:120,text:200,textarea:1e3,markdown:4e4,items:30,blocks:40},"PDF_PAGE_DIMENSIONS",0,{letter:{width:816,height:1056},a4:{width:794,height:1123}},"PdfValidationError",0,class extends Error{constructor(e){super(e),this.name="PdfValidationError"}}])}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.