@questionable-focus/stationery-cupboard
Version:
A collection of business document templates for React applications
15 lines (11 loc) • 36.1 kB
JavaScript
;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),ze=require("react");function De(t){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(l,r,a.get?a:{enumerable:!0,get:()=>t[r]})}}return l.default=t,Object.freeze(l)}const le=De(ze),F={fontFamily:{heading:"Inter, system-ui, sans-serif",body:"Inter, system-ui, sans-serif"},fontSize:{heading1:"2rem",heading2:"1.5rem",heading3:"1.25rem",body:"1rem",small:"0.875rem"},colors:{primary:"#3b82f6",secondary:"#6b7280",accent:"#10b981",background:"#ffffff",text:"#1f2937",muted:"#9ca3af",border:"#e5e7eb",success:"#10b981",error:"#ef4444"},spacing:{xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},documents:{header:{background:"#f9fafb",color:"#1f2937"},footer:{background:"#f9fafb",color:"#1f2937"},table:{headerBackground:"#ffffff",headerColor:"#1f2937",rowBackground:"#ffffff",rowColor:"#1f2937",alternateRowBackground:"#ffffff"}}};function T(t={}){var l,r,a;return{fontFamily:{...F.fontFamily,...t.fontFamily},fontSize:{...F.fontSize,...t.fontSize},colors:{...F.colors,...t.colors},spacing:{...F.spacing,...t.spacing},documents:{header:{...F.documents.header,...(l=t.documents)==null?void 0:l.header},footer:{...F.documents.footer,...(r=t.documents)==null?void 0:r.footer},table:{...F.documents.table,...(a=t.documents)==null?void 0:a.table}}}}const Z=({theme:t={},children:l})=>{const r=T(t);return e.jsx("div",{className:"w-full max-w-4xl mx-auto p-8 print:p-0 bg-white",style:{fontFamily:r.fontFamily.body,color:r.colors.text,backgroundColor:r.colors.background},children:l})},Ie=({paymentDetails:t})=>{const l={bankName:"Bank",accountName:"Account Name",accountNumber:"Account Number",routingNumber:"Routing Number",sortCode:"Sort Code",iban:"IBAN",swiftCode:"SWIFT Code",bic:"BIC",reference:"Reference",additionalInfo:"Additional Information"},r=Object.entries(t).filter(([a,i])=>i!==void 0).map(([a])=>a);return e.jsx("div",{className:"inline-block md:ml-auto print:ml-auto",children:e.jsx("table",{className:"text-xs w-auto",children:e.jsx("tbody",{children:r.map(a=>e.jsxs("tr",{children:[e.jsx("td",{className:"pr-4 py-1 text-left text-xs font-medium text-gray-500",children:l[a]}),e.jsx("td",{className:"pl-4 py-1 text-xs whitespace-nowrap",children:t[a]})]},a))})})})},Ce=t=>Ie(t),Fe=({data:t,theme:l={},children:r})=>{const a=T(l),i=t.currency||"USD",c=t.items.reduce((y,n)=>y+n.quantity*n.unitPrice,0),p=t.taxRate?c*t.taxRate/100:0,h=t.discountAmount||0,u=c+p-h;function N(y){const n=new Date(y);return new Intl.DateTimeFormat("en-GB",{day:"numeric",month:"short",year:"numeric"}).format(n)}const j=y=>y.toLocaleString("en-US",{style:"currency",currency:i});return e.jsx(Z,{theme:l,children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900",style:{fontFamily:a.fontFamily.heading,fontSize:a.fontSize.heading1},children:"Invoice"}),e.jsxs("div",{className:"text-right",children:[t.companyDetails.logo?e.jsx("img",{src:t.companyDetails.logo,alt:"Company Logo",className:"h-16 mb-2 ml-auto"}):e.jsx("h3",{className:"text-lg font-semibold text-gray-900",style:{fontFamily:a.fontFamily.heading,fontSize:a.fontSize.heading3},children:t.companyDetails.name}),e.jsx("div",{className:"mt-1 text-xs text-gray-500",children:t.companyDetails.address.map((y,n)=>e.jsx("div",{children:y},n))}),t.companyDetails.contactInfo&&e.jsxs("div",{className:"mt-1 text-xs text-gray-500",children:[t.companyDetails.contactInfo.contactName&&e.jsx("div",{children:t.companyDetails.contactInfo.contactName}),t.companyDetails.contactInfo.phone&&e.jsx("div",{children:t.companyDetails.contactInfo.phone}),t.companyDetails.contactInfo.email&&e.jsx("div",{children:t.companyDetails.contactInfo.email}),t.companyDetails.contactInfo.website&&e.jsx("div",{children:t.companyDetails.contactInfo.website})]})]})]}),e.jsxs("div",{className:"flex justify-between mt-16",children:[e.jsxs("div",{className:"mb-8 md:mb-0 print:mb-0",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:t.clientDetails.name}),e.jsx("div",{className:"mt-1 text-sm text-gray-500",children:t.clientDetails.address.map((y,n)=>e.jsx("div",{children:y},n))}),t.clientDetails.contactInfo&&e.jsxs("div",{className:"mt-1 text-sm text-gray-500",children:[t.clientDetails.contactInfo.contactName&&e.jsx("div",{children:t.clientDetails.contactInfo.contactName}),t.clientDetails.contactInfo.phone&&e.jsx("div",{children:t.clientDetails.contactInfo.phone}),t.clientDetails.contactInfo.email&&e.jsx("div",{children:t.clientDetails.contactInfo.email}),t.clientDetails.contactInfo.website&&e.jsx("div",{children:t.clientDetails.contactInfo.website})]})]}),e.jsx("div",{className:"md:text-right print:text-right",children:e.jsx("table",{className:"md:ml-auto print:ml-auto",children:e.jsxs("tbody",{children:[e.jsxs("tr",{children:[e.jsx("th",{className:"pr-4 py-1 text-left text-xs font-medium text-gray-500",children:"Invoice reference"}),e.jsx("td",{className:"pl-4 py-1 text-xs",children:t.invoiceNumber})]}),e.jsxs("tr",{children:[e.jsx("th",{className:"pr-4 py-1 text-left text-xs font-medium text-gray-500",children:"Invoice date"}),e.jsx("td",{className:"pl-4 py-1 text-xs",children:N(t.issueDate)})]}),e.jsxs("tr",{children:[e.jsx("th",{className:"pr-4 py-1 text-left text-xs font-medium text-gray-500",children:"Due date"}),e.jsx("td",{className:"pl-4 py-1 text-xs",children:N(t.dueDate)})]})]})})})]}),e.jsx("div",{className:"mt-16",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-200",style:{backgroundColor:a.documents.table.headerBackground},children:[e.jsx("th",{className:"py-3 text-left text-sm font-medium text-gray-500 uppercase tracking-wider",children:"Item"}),e.jsx("th",{className:"py-3 text-center text-sm font-medium text-gray-500 uppercase tracking-wider w-24",children:"Qty"}),e.jsx("th",{className:"py-3 text-right text-sm font-medium text-gray-500 uppercase tracking-wider w-32",children:"Unit"}),e.jsx("th",{className:"py-3 text-right text-sm font-medium text-gray-500 uppercase tracking-wider w-32",children:"Total"})]})}),e.jsx("tbody",{children:t.items.map((y,n)=>e.jsxs("tr",{className:"border-b border-gray-100",style:{backgroundColor:n%2===0?a.documents.table.rowBackground:a.documents.table.alternateRowBackground},children:[e.jsxs("td",{className:"py-2",children:[e.jsx("div",{className:"font-medium",children:y.name}),y.description&&e.jsx("div",{className:"text-sm text-gray-500",children:y.description})]}),e.jsx("td",{className:"py-2 text-center",children:y.quantity}),e.jsx("td",{className:"py-2 text-right",children:j(y.unitPrice)}),e.jsx("td",{className:"py-2 text-right font-medium",children:j(y.quantity*y.unitPrice)})]},n))}),e.jsxs("tfoot",{children:[(t.taxRate||t.discountAmount)&&e.jsxs("tr",{children:[e.jsx("td",{colSpan:2}),e.jsx("th",{className:"pt-4 text-right text-sm font-semibold text-gray-900",children:"Subtotal"}),e.jsx("td",{className:"pt-4 text-right text-sm font-bold text-gray-900",children:j(c)})]}),t.taxRate&&e.jsxs("tr",{children:[e.jsx("td",{colSpan:2}),e.jsxs("th",{className:"py-2 text-right text-sm font-semibold text-gray-900",children:["Tax (",t.taxRate,"%)"]}),e.jsx("td",{className:"py-2 text-right text-sm font-bold text-gray-900",children:j(p)})]}),t.discountAmount&&e.jsxs("tr",{children:[e.jsx("td",{colSpan:2}),e.jsx("th",{className:"py-2 text-right text-sm font-semibold text-gray-900",children:"Discount"}),e.jsx("td",{className:"py-2 text-right text-sm font-bold text-gray-900",children:j(h)})]}),e.jsxs("tr",{children:[e.jsx("td",{colSpan:2}),e.jsx("th",{className:"py-4 text-right text-base font-semibold text-gray-900",children:"Total due"}),e.jsx("td",{className:"py-4 text-right text-xl font-bold text-gray-900",children:j(u)})]})]})]})}),e.jsxs("div",{className:"mt-16 flex flex-col md:flex-row print:flex-row justify-between",children:[t.notes&&e.jsxs("div",{className:"mb-8 md:mb-0 print:mb-0 md:w-1/2 print:w-1/2 pr-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-900 mb-2",style:{fontFamily:a.fontFamily.heading,fontSize:a.fontSize.heading3},children:"Notes"}),e.jsx("p",{className:"text-xs text-gray-600",children:t.notes})]}),t.paymentDetails&&e.jsxs("div",{className:`${t.notes?"md:w-1/2 print:w-1/2":"w-full"} md:text-right print:text-right`,children:[e.jsx("h4",{className:"text-xs font-semibold text-gray-900 mb-2",style:{fontFamily:a.fontFamily.heading,fontSize:a.fontSize.heading3},children:"Payment Details"}),e.jsx(Ce,{paymentDetails:t.paymentDetails})]})]}),r]})})};function M(){return M=Object.assign?Object.assign.bind():function(t){for(var l=1;l<arguments.length;l++){var r=arguments[l];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},M.apply(this,arguments)}const Me=["children","options"],m={blockQuote:"0",breakLine:"1",breakThematic:"2",codeBlock:"3",codeFenced:"4",codeInline:"5",footnote:"6",footnoteReference:"7",gfmTask:"8",heading:"9",headingSetext:"10",htmlBlock:"11",htmlComment:"12",htmlSelfClosing:"13",image:"14",link:"15",linkAngleBraceStyleDetector:"16",linkBareUrlDetector:"17",linkMailtoDetector:"18",newlineCoalescer:"19",orderedList:"20",paragraph:"21",ref:"22",refImage:"23",refLink:"24",table:"25",text:"27",textBolded:"28",textEmphasized:"29",textEscaped:"30",textMarked:"31",textStrikethroughed:"32",unorderedList:"33"};var K;(function(t){t[t.MAX=0]="MAX",t[t.HIGH=1]="HIGH",t[t.MED=2]="MED",t[t.LOW=3]="LOW",t[t.MIN=4]="MIN"})(K||(K={}));const Y=["allowFullScreen","allowTransparency","autoComplete","autoFocus","autoPlay","cellPadding","cellSpacing","charSet","classId","colSpan","contentEditable","contextMenu","crossOrigin","encType","formAction","formEncType","formMethod","formNoValidate","formTarget","frameBorder","hrefLang","inputMode","keyParams","keyType","marginHeight","marginWidth","maxLength","mediaGroup","minLength","noValidate","radioGroup","readOnly","rowSpan","spellCheck","srcDoc","srcLang","srcSet","tabIndex","useMap"].reduce((t,l)=>(t[l.toLowerCase()]=l,t),{class:"className",for:"htmlFor"}),ee={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},Te=["style","script"],Be=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,Ae=/mailto:/i,$e=/\n{2,}$/,ae=/^(\s*>[\s\S]*?)(?=\n\n|$)/,Le=/^ *> ?/gm,Re=/^(?:\[!([^\]]*)\]\n)?([\s\S]*)/,Oe=/^ {2,}\n/,Ue=/^(?:( *[-*_])){3,} *(?:\n *)+\n/,oe=/^(?: {1,3})?(`{3,}|~{3,}) *(\S+)? *([^\n]*?)?\n([\s\S]*?)(?:\1\n?|$)/,ce=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,Ee=/^(`+)((?:\\`|[^`])+)\1/,Pe=/^(?:\n *)*\n/,qe=/\r\n?/g,_e=/^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/,He=/^\[\^([^\]]+)]/,We=/\f/g,Ge=/^---[ \t]*\n(.|\n)*\n---[ \t]*\n/,Ze=/^\s*?\[(x|\s)\]/,ie=/^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,de=/^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,me=/^([^\n]+)\n *(=|-){3,} *(?:\n *)+\n/,W=/^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?((?:[^>]*[^/])?)>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/i,Qe=/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi,pe=/^<!--[\s\S]*?(?:-->)/,Ve=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,G=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,Xe=/^\{.*\}$/,Je=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,Ke=/^<([^ >]+@[^ >]+)>/,Ye=/^<([^ >]+:\/[^ >]+)>/,et=/-([a-z])?/gi,xe=/^(\|.*)\n(?: *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*))?\n?/,tt=/^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/,nt=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,rt=/^\[([^\]]*)\] ?\[([^\]]*)\]/,st=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,lt=/\t/g,at=/(^ *\||\| *$)/g,ot=/^ *:-+: *$/,ct=/^ *:-+ *$/,it=/^ *-+: *$/,O="((?:\\[.*?\\][([].*?[)\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|\\\\\\1|[\\s\\S])+?)",dt=new RegExp(`^([*_])\\1${O}\\1\\1(?!\\1)`),mt=new RegExp(`^([*_])${O}\\1(?!\\1)`),pt=new RegExp(`^(==)${O}\\1`),xt=new RegExp(`^(~~)${O}\\1`),ut=/^\\([^0-9A-Za-z\s])/,E=/\\([^0-9A-Za-z\s])/g,ht=/^([\s\S](?:(?! |[0-9]\.)[^*_~\-\n<`\\\[!])*)/,ft=/^\n+/,gt=/^([ \t]*)/,yt=/\\([^\\])/g,bt=/(?:^|\n)( *)$/,Q="(?:\\d+\\.)",V="(?:[*+-])";function ue(t){return"( *)("+(t===1?Q:V)+") +"}const he=ue(1),fe=ue(2);function ge(t){return new RegExp("^"+(t===1?he:fe))}const jt=ge(1),Nt=ge(2);function ye(t){return new RegExp("^"+(t===1?he:fe)+"[^\\n]*(?:\\n(?!\\1"+(t===1?Q:V)+" )[^\\n]*)*(\\n|$)","gm")}const kt=ye(1),wt=ye(2);function be(t){const l=t===1?Q:V;return new RegExp("^( *)("+l+") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1"+l+" (?!"+l+" ))\\n*|\\s*\\n*$)")}const je=be(1),Ne=be(2);function te(t,l){const r=l===1,a=r?je:Ne,i=r?kt:wt,c=r?jt:Nt;return{match:B(function(p,h){const u=bt.exec(h.prevCapture);return u&&(h.list||!h.inline&&!h.simple)?a.exec(p=u[1]+p):null}),order:1,parse(p,h,u){const N=r?+p[2]:void 0,j=p[0].replace($e,`
`).match(i);let y=!1;return{items:j.map(function(n,o){const s=c.exec(n)[0].length,x=new RegExp("^ {1,"+s+"}","gm"),d=n.replace(x,"").replace(c,""),f=o===j.length-1,g=d.indexOf(`
`)!==-1||f&&y;y=g;const k=u.inline,v=u.list;let S;u.list=!0,g?(u.inline=!1,S=L(d)+`
`):(u.inline=!0,S=L(d));const b=h(S,u);return u.inline=k,u.list=v,b}),ordered:r,start:N}},render:(p,h,u)=>t(p.ordered?"ol":"ul",{key:u.key,start:p.type===m.orderedList?p.start:void 0},p.items.map(function(N,j){return t("li",{key:j},h(N,u))}))}}const vt=new RegExp(`^\\[((?:\\[[^\\]]*\\]|[^\\[\\]]|\\](?=[^\\[]*\\]))*)\\]\\(\\s*<?((?:\\([^)]*\\)|[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['"]([\\s\\S]*?)['"])?\\s*\\)`),St=/^!\[(.*?)\]\( *((?:\([^)]*\)|[^() ])*) *"?([^)"]*)?"?\)/,ke=[ae,oe,ce,ie,me,de,xe,je,Ne],zt=[...ke,/^[^\n]+(?: \n|\n{2,})/,W,pe,G];function L(t){let l=t.length;for(;l>0&&t[l-1]<=" ";)l--;return t.slice(0,l)}function A(t){return t.replace(/[ÀÁÂÃÄÅàáâãä忯]/g,"a").replace(/[çÇ]/g,"c").replace(/[ðÐ]/g,"d").replace(/[ÈÉÊËéèêë]/g,"e").replace(/[ÏïÎîÍíÌì]/g,"i").replace(/[Ññ]/g,"n").replace(/[øØœŒÕõÔôÓóÒò]/g,"o").replace(/[ÜüÛûÚúÙù]/g,"u").replace(/[ŸÿÝý]/g,"y").replace(/[^a-z0-9- ]/gi,"").replace(/ /gi,"-").toLowerCase()}function Dt(t){return it.test(t)?"right":ot.test(t)?"center":ct.test(t)?"left":null}function ne(t,l,r,a){const i=r.inTable;r.inTable=!0;let c=[[]],p="";function h(){if(!p)return;const u=c[c.length-1];u.push.apply(u,l(p,r)),p=""}return t.trim().split(/(`[^`]*`|\\\||\|)/).filter(Boolean).forEach((u,N,j)=>{u.trim()==="|"&&(h(),a)?N!==0&&N!==j.length-1&&c.push([]):p+=u}),h(),r.inTable=i,c}function It(t,l,r){r.inline=!0;const a=t[2]?t[2].replace(at,"").split("|").map(Dt):[],i=t[3]?function(p,h,u){return p.trim().split(`
`).map(function(N){return ne(N,h,u,!0)})}(t[3],l,r):[],c=ne(t[1],l,r,!!i.length);return r.inline=!1,i.length?{align:a,cells:i,header:c,type:m.table}:{children:c,type:m.paragraph}}function re(t,l){return t.align[l]==null?{}:{textAlign:t.align[l]}}function B(t){return t.inline=1,t}function I(t){return B(function(l,r){return r.inline?t.exec(l):null})}function C(t){return B(function(l,r){return r.inline||r.simple?t.exec(l):null})}function D(t){return function(l,r){return r.inline||r.simple?null:t.exec(l)}}function $(t){return B(function(l){return t.exec(l)})}function Ct(t,l){if(l.inline||l.simple)return null;let r="";t.split(`
`).every(i=>(i+=`
`,!ke.some(c=>c.test(i))&&(r+=i,!!i.trim())));const a=L(r);return a==""?null:[r,,a]}function Ft(t){try{if(decodeURIComponent(t).replace(/[^A-Za-z0-9/:]/g,"").match(/^\s*(javascript|vbscript|data(?!:image)):/i))return null}catch{return null}return t}function se(t){return t.replace(yt,"$1")}function R(t,l,r){const a=r.inline||!1,i=r.simple||!1;r.inline=!0,r.simple=!0;const c=t(l,r);return r.inline=a,r.simple=i,c}function Mt(t,l,r){const a=r.inline||!1,i=r.simple||!1;r.inline=!1,r.simple=!0;const c=t(l,r);return r.inline=a,r.simple=i,c}function Tt(t,l,r){const a=r.inline||!1;r.inline=!1;const i=t(l,r);return r.inline=a,i}const P=(t,l,r)=>({children:R(l,t[2],r)});function q(){return{}}function _(){return null}function Bt(...t){return t.filter(Boolean).join(" ")}function H(t,l,r){let a=t;const i=l.split(".");for(;i.length&&(a=a[i[0]],a!==void 0);)i.shift();return a||r}function At(t="",l={}){function r(n,o,...s){const x=H(l.overrides,`${n}.props`,{});return l.createElement(function(d,f){const g=H(f,d);return g?typeof g=="function"||typeof g=="object"&&"render"in g?g:H(f,`${d}.component`,d):d}(n,l.overrides),M({},o,x,{className:Bt(o==null?void 0:o.className,x.className)||void 0}),...s)}function a(n){n=n.replace(Ge,"");let o=!1;l.forceInline?o=!0:l.forceBlock||(o=st.test(n)===!1);const s=N(u(o?n:`${L(n).replace(ft,"")}
`,{inline:o}));for(;typeof s[s.length-1]=="string"&&!s[s.length-1].trim();)s.pop();if(l.wrapper===null)return s;const x=l.wrapper||(o?"span":"div");let d;if(s.length>1||l.forceWrapper)d=s;else{if(s.length===1)return d=s[0],typeof d=="string"?r("span",{key:"outer"},d):d;d=null}return l.createElement(x,{key:"outer"},d)}function i(n,o){const s=o.match(Be);return s?s.reduce(function(x,d){const f=d.indexOf("=");if(f!==-1){const g=function(b){return b.indexOf("-")!==-1&&b.match(Ve)===null&&(b=b.replace(et,function(w,z){return z.toUpperCase()})),b}(d.slice(0,f)).trim(),k=function(b){const w=b[0];return(w==='"'||w==="'")&&b.length>=2&&b[b.length-1]===w?b.slice(1,-1):b}(d.slice(f+1).trim()),v=Y[g]||g;if(v==="ref")return x;const S=x[v]=function(b,w,z,ve){return w==="style"?z.split(/;\s?/).reduce(function(X,U){const J=U.slice(0,U.indexOf(":"));return X[J.trim().replace(/(-[a-z])/g,Se=>Se[1].toUpperCase())]=U.slice(J.length+1).trim(),X},{}):w==="href"||w==="src"?ve(z,b,w):(z.match(Xe)&&(z=z.slice(1,z.length-1)),z==="true"||z!=="false"&&z)}(n,g,k,l.sanitizer);typeof S=="string"&&(W.test(S)||G.test(S))&&(x[v]=a(S.trim()))}else d!=="style"&&(x[Y[d]||d]=!0);return x},{}):null}l.overrides=l.overrides||{},l.sanitizer=l.sanitizer||Ft,l.slugify=l.slugify||A,l.namedCodesToUnicode=l.namedCodesToUnicode?M({},ee,l.namedCodesToUnicode):ee,l.createElement=l.createElement||le.createElement;const c=[],p={},h={[m.blockQuote]:{match:D(ae),order:1,parse(n,o,s){const[,x,d]=n[0].replace(Le,"").match(Re);return{alert:x,children:o(d,s)}},render(n,o,s){const x={key:s.key};return n.alert&&(x.className="markdown-alert-"+l.slugify(n.alert.toLowerCase(),A),n.children.unshift({attrs:{},children:[{type:m.text,text:n.alert}],noInnerParse:!0,type:m.htmlBlock,tag:"header"})),r("blockquote",x,o(n.children,s))}},[m.breakLine]:{match:$(Oe),order:1,parse:q,render:(n,o,s)=>r("br",{key:s.key})},[m.breakThematic]:{match:D(Ue),order:1,parse:q,render:(n,o,s)=>r("hr",{key:s.key})},[m.codeBlock]:{match:D(ce),order:0,parse:n=>({lang:void 0,text:L(n[0].replace(/^ {4}/gm,"")).replace(E,"$1")}),render:(n,o,s)=>r("pre",{key:s.key},r("code",M({},n.attrs,{className:n.lang?`lang-${n.lang}`:""}),n.text))},[m.codeFenced]:{match:D(oe),order:0,parse:n=>({attrs:i("code",n[3]||""),lang:n[2]||void 0,text:n[4].replace(E,"$1"),type:m.codeBlock})},[m.codeInline]:{match:C(Ee),order:3,parse:n=>({text:n[2].replace(E,"$1")}),render:(n,o,s)=>r("code",{key:s.key},n.text)},[m.footnote]:{match:D(_e),order:0,parse:n=>(c.push({footnote:n[2],identifier:n[1]}),{}),render:_},[m.footnoteReference]:{match:I(He),order:1,parse:n=>({target:`#${l.slugify(n[1],A)}`,text:n[1]}),render:(n,o,s)=>r("a",{key:s.key,href:l.sanitizer(n.target,"a","href")},r("sup",{key:s.key},n.text))},[m.gfmTask]:{match:I(Ze),order:1,parse:n=>({completed:n[1].toLowerCase()==="x"}),render:(n,o,s)=>r("input",{checked:n.completed,key:s.key,readOnly:!0,type:"checkbox"})},[m.heading]:{match:D(l.enforceAtxHeadings?de:ie),order:1,parse:(n,o,s)=>({children:R(o,n[2],s),id:l.slugify(n[2],A),level:n[1].length}),render:(n,o,s)=>r(`h${n.level}`,{id:n.id,key:s.key},o(n.children,s))},[m.headingSetext]:{match:D(me),order:0,parse:(n,o,s)=>({children:R(o,n[1],s),level:n[2]==="="?1:2,type:m.heading})},[m.htmlBlock]:{match:$(W),order:1,parse(n,o,s){const[,x]=n[3].match(gt),d=new RegExp(`^${x}`,"gm"),f=n[3].replace(d,""),g=(k=f,zt.some(z=>z.test(k))?Tt:R);var k;const v=n[1].toLowerCase(),S=Te.indexOf(v)!==-1,b=(S?v:n[1]).trim(),w={attrs:i(b,n[2]),noInnerParse:S,tag:b};return s.inAnchor=s.inAnchor||v==="a",S?w.text=n[3]:w.children=g(o,f,s),s.inAnchor=!1,w},render:(n,o,s)=>r(n.tag,M({key:s.key},n.attrs),n.text||(n.children?o(n.children,s):""))},[m.htmlSelfClosing]:{match:$(G),order:1,parse(n){const o=n[1].trim();return{attrs:i(o,n[2]||""),tag:o}},render:(n,o,s)=>r(n.tag,M({},n.attrs,{key:s.key}))},[m.htmlComment]:{match:$(pe),order:1,parse:()=>({}),render:_},[m.image]:{match:C(St),order:1,parse:n=>({alt:n[1],target:se(n[2]),title:n[3]}),render:(n,o,s)=>r("img",{key:s.key,alt:n.alt||void 0,title:n.title||void 0,src:l.sanitizer(n.target,"img","src")})},[m.link]:{match:I(vt),order:3,parse:(n,o,s)=>({children:Mt(o,n[1],s),target:se(n[2]),title:n[3]}),render:(n,o,s)=>r("a",{key:s.key,href:l.sanitizer(n.target,"a","href"),title:n.title},o(n.children,s))},[m.linkAngleBraceStyleDetector]:{match:I(Ye),order:0,parse:n=>({children:[{text:n[1],type:m.text}],target:n[1],type:m.link})},[m.linkBareUrlDetector]:{match:B((n,o)=>o.inAnchor||l.disableAutoLink?null:I(Je)(n,o)),order:0,parse:n=>({children:[{text:n[1],type:m.text}],target:n[1],title:void 0,type:m.link})},[m.linkMailtoDetector]:{match:I(Ke),order:0,parse(n){let o=n[1],s=n[1];return Ae.test(s)||(s="mailto:"+s),{children:[{text:o.replace("mailto:",""),type:m.text}],target:s,type:m.link}}},[m.orderedList]:te(r,1),[m.unorderedList]:te(r,2),[m.newlineCoalescer]:{match:D(Pe),order:3,parse:q,render:()=>`
`},[m.paragraph]:{match:B(Ct),order:3,parse:P,render:(n,o,s)=>r("p",{key:s.key},o(n.children,s))},[m.ref]:{match:I(tt),order:0,parse:n=>(p[n[1]]={target:n[2],title:n[4]},{}),render:_},[m.refImage]:{match:C(nt),order:0,parse:n=>({alt:n[1]||void 0,ref:n[2]}),render:(n,o,s)=>p[n.ref]?r("img",{key:s.key,alt:n.alt,src:l.sanitizer(p[n.ref].target,"img","src"),title:p[n.ref].title}):null},[m.refLink]:{match:I(rt),order:0,parse:(n,o,s)=>({children:o(n[1],s),fallbackChildren:n[0],ref:n[2]}),render:(n,o,s)=>p[n.ref]?r("a",{key:s.key,href:l.sanitizer(p[n.ref].target,"a","href"),title:p[n.ref].title},o(n.children,s)):r("span",{key:s.key},n.fallbackChildren)},[m.table]:{match:D(xe),order:1,parse:It,render(n,o,s){const x=n;return r("table",{key:s.key},r("thead",null,r("tr",null,x.header.map(function(d,f){return r("th",{key:f,style:re(x,f)},o(d,s))}))),r("tbody",null,x.cells.map(function(d,f){return r("tr",{key:f},d.map(function(g,k){return r("td",{key:k,style:re(x,k)},o(g,s))}))})))}},[m.text]:{match:$(ht),order:4,parse:n=>({text:n[0].replace(Qe,(o,s)=>l.namedCodesToUnicode[s]?l.namedCodesToUnicode[s]:o)}),render:n=>n.text},[m.textBolded]:{match:C(dt),order:2,parse:(n,o,s)=>({children:o(n[2],s)}),render:(n,o,s)=>r("strong",{key:s.key},o(n.children,s))},[m.textEmphasized]:{match:C(mt),order:3,parse:(n,o,s)=>({children:o(n[2],s)}),render:(n,o,s)=>r("em",{key:s.key},o(n.children,s))},[m.textEscaped]:{match:C(ut),order:1,parse:n=>({text:n[1],type:m.text})},[m.textMarked]:{match:C(pt),order:3,parse:P,render:(n,o,s)=>r("mark",{key:s.key},o(n.children,s))},[m.textStrikethroughed]:{match:C(xt),order:3,parse:P,render:(n,o,s)=>r("del",{key:s.key},o(n.children,s))}};l.disableParsingRawHTML===!0&&(delete h[m.htmlBlock],delete h[m.htmlSelfClosing]);const u=function(n){let o=Object.keys(n);function s(x,d){let f,g,k=[],v="",S="";for(d.prevCapture=d.prevCapture||"";x;){let b=0;for(;b<o.length;){if(v=o[b],f=n[v],d.inline&&!f.match.inline){b++;continue}const w=f.match(x,d);if(w){S=w[0],d.prevCapture+=S,x=x.substring(S.length),g=f.parse(w,s,d),g.type==null&&(g.type=v),k.push(g);break}b++}}return d.prevCapture="",k}return o.sort(function(x,d){let f=n[x].order,g=n[d].order;return f!==g?f-g:x<d?-1:1}),function(x,d){return s(function(f){return f.replace(qe,`
`).replace(We,"").replace(lt," ")}(x),d)}}(h),N=(j=function(n,o){return function(s,x,d){const f=n[s.type].render;return o?o(()=>f(s,x,d),s,x,d):f(s,x,d)}}(h,l.renderRule),function n(o,s={}){if(Array.isArray(o)){const x=s.key,d=[];let f=!1;for(let g=0;g<o.length;g++){s.key=g;const k=n(o[g],s),v=typeof k=="string";v&&f?d[d.length-1]+=k:k!==null&&d.push(k),f=v}return s.key=x,d}return j(o,n,s)});var j;const y=a(t);return c.length?r("div",null,y,r("footer",{key:"footer"},c.map(function(n){return r("div",{id:l.slugify(n.identifier,A),key:n.identifier},n.identifier,N(u(n.footnote,{inline:!0})))}))):y}const $t=t=>{let{children:l="",options:r}=t,a=function(i,c){if(i==null)return{};var p,h,u={},N=Object.keys(i);for(h=0;h<N.length;h++)c.indexOf(p=N[h])>=0||(u[p]=i[p]);return u}(t,Me);return le.cloneElement(At(l,r),a)},we=({content:t,theme:l={}})=>{const r=T(l);return e.jsx($t,{options:{overrides:{h1:{component:"h1",props:{className:"text-2xl font-bold mb-4",style:{fontFamily:r.fontFamily.heading,fontSize:r.fontSize.heading1}}},h2:{component:"h2",props:{className:"text-xl font-bold mb-3",style:{fontFamily:r.fontFamily.heading,fontSize:r.fontSize.heading2}}},h3:{component:"h3",props:{className:"text-lg font-bold mb-2",style:{fontFamily:r.fontFamily.heading,fontSize:r.fontSize.heading3}}},p:{component:"p",props:{className:"mb-4",style:{fontFamily:r.fontFamily.body,fontSize:r.fontSize.body}}},ul:{component:"ul",props:{className:"list-disc pl-5 mb-4"}},ol:{component:"ol",props:{className:"list-decimal pl-5 mb-4"}},li:{component:"li",props:{className:"mb-1"}},a:{component:"a",props:{className:"text-blue-600 hover:underline",style:{color:r.colors.primary}}},blockquote:{component:"blockquote",props:{className:"border-l-4 pl-4 italic my-4",style:{borderColor:r.colors.muted}}},hr:{component:"hr",props:{className:"my-6",style:{borderColor:r.colors.border}}}}},children:t})},Lt=({data:t,theme:l={},children:r})=>{const a=T(l);return e.jsx(Z,{theme:l,children:e.jsxs("div",{className:"flex flex-col space-y-6",children:[e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold mb-2",style:{fontFamily:a.fontFamily.heading,fontSize:a.fontSize.heading1},children:t.title}),e.jsxs("div",{className:"text-gray-600",children:[e.jsxs("p",{children:["Date: ",t.date]}),e.jsxs("p",{children:["Time: ",t.startTime," - ",t.endTime]}),t.location&&e.jsxs("p",{children:["Location: ",t.location]})]})]}),(t.organizationLogo||t.organizationName)&&e.jsxs("div",{className:"text-right",children:[t.organizationLogo&&e.jsx("img",{src:t.organizationLogo,alt:"Organization Logo",className:"h-16 mb-2 ml-auto"}),t.organizationName&&e.jsx("p",{className:"font-semibold",children:t.organizationName})]})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold mb-3",style:{fontFamily:a.fontFamily.heading,fontSize:a.fontSize.heading2,color:a.colors.primary},children:"Participants"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:t.participants.map((i,c)=>e.jsxs("div",{className:"p-2 rounded",style:{backgroundColor:c%2===0?a.documents.table.rowBackground:a.documents.table.alternateRowBackground},children:[e.jsx("p",{className:"font-semibold",children:i.name}),i.role&&e.jsx("p",{className:"text-sm",children:i.role}),i.organization&&e.jsx("p",{className:"text-sm",children:i.organization}),i.email&&e.jsx("p",{className:"text-sm text-gray-500",children:i.email})]},`participants-${c}`))})]}),t.absentees&&t.absentees.length>0&&e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold mb-3",style:{fontFamily:a.fontFamily.heading,fontSize:a.fontSize.heading2,color:a.colors.secondary},children:"Absentees"}),e.jsx("ul",{className:"list-disc pl-5",children:t.absentees.map((i,c)=>e.jsxs("li",{children:[e.jsx("span",{className:"font-semibold",children:i.name}),i.role&&` (${i.role})`,i.organization&&` - ${i.organization}`]},`absentees-${c}`))})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold mb-3",style:{fontFamily:a.fontFamily.heading,fontSize:a.fontSize.heading2,color:a.colors.primary},children:"Agenda"}),e.jsx("ol",{className:"list-decimal pl-5",children:t.agendaItems.map((i,c)=>e.jsxs("li",{className:"mb-2",children:[e.jsx("span",{className:"font-semibold",children:i.title}),i.description&&e.jsx("p",{className:"text-gray-600 ml-2",children:i.description})]},`agenda-${c}`))})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold mb-3",style:{fontFamily:a.fontFamily.heading,fontSize:a.fontSize.heading2,color:a.colors.primary},children:"Meeting Minutes"}),e.jsx("div",{className:"p-4 rounded",style:{backgroundColor:a.documents.table.rowBackground},children:e.jsx(we,{content:t.minutesMarkdown,theme:l})})]}),t.actionItems&&t.actionItems.length>0&&e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold mb-3",style:{fontFamily:a.fontFamily.heading,fontSize:a.fontSize.heading2,color:a.colors.primary},children:"Action Items"}),e.jsxs("table",{className:"min-w-full border-collapse mb-4",children:[e.jsx("thead",{children:e.jsxs("tr",{style:{backgroundColor:a.documents.table.headerBackground},children:[e.jsx("th",{className:"border border-gray-300 p-2 text-left",children:"Action"}),e.jsx("th",{className:"border border-gray-300 p-2 text-left",children:"Assignee"}),e.jsx("th",{className:"border border-gray-300 p-2 text-left",children:"Due Date"}),e.jsx("th",{className:"border border-gray-300 p-2 text-left",children:"Status"})]})}),e.jsx("tbody",{children:t.actionItems.map((i,c)=>{let p;switch(i.status){case"completed":p=a.colors.success;break;case"in-progress":p=a.colors.accent;break;case"deferred":p=a.colors.secondary;break;default:p=a.colors.error}return e.jsxs("tr",{style:{backgroundColor:c%2===0?a.documents.table.rowBackground:a.documents.table.alternateRowBackground},children:[e.jsx("td",{className:"border border-gray-300 p-2",children:i.action}),e.jsx("td",{className:"border border-gray-300 p-2",children:i.assignee}),e.jsx("td",{className:"border border-gray-300 p-2",children:i.dueDate||"N/A"}),e.jsx("td",{className:"border border-gray-300 p-2",children:e.jsx("span",{className:"px-2 py-1 rounded-md text-white",style:{backgroundColor:p},children:i.status||"pending"})})]},`actions-${c}`)})})]})]}),t.followUpMeeting&&e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold mb-3",style:{fontFamily:a.fontFamily.heading,fontSize:a.fontSize.heading2,color:a.colors.primary},children:"Follow-up Meeting"}),e.jsxs("div",{className:"p-4 rounded-md",style:{backgroundColor:a.documents.table.rowBackground},children:[t.followUpMeeting.date&&e.jsxs("p",{children:[e.jsx("span",{className:"font-semibold",children:"Date: "}),t.followUpMeeting.date]}),t.followUpMeeting.time&&e.jsxs("p",{children:[e.jsx("span",{className:"font-semibold",children:"Time: "}),t.followUpMeeting.time]}),t.followUpMeeting.location&&e.jsxs("p",{children:[e.jsx("span",{className:"font-semibold",children:"Location: "}),t.followUpMeeting.location]})]})]}),r]})})},Rt=({invoices:t,theme:l={},onRowClick:r})=>{const a=T(l),i=c=>{const p=c.items.reduce((N,j)=>N+j.quantity*j.unitPrice,0),h=c.taxRate?p*c.taxRate/100:0,u=c.discountAmount||0;return p+h-u};return e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full bg-white shadow-md rounded-lg overflow-hidden",children:[e.jsx("thead",{style:{backgroundColor:a.documents.table.headerBackground},children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium uppercase tracking-wider",children:"Invoice #"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium uppercase tracking-wider",children:"Date"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium uppercase tracking-wider",children:"Due Date"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium uppercase tracking-wider",children:"Client"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium uppercase tracking-wider",children:"Amount"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium uppercase tracking-wider",children:"Status"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-200",children:t.map((c,p)=>{const N=new Date(c.dueDate)<new Date;let j="Paid",y=a.colors.success;N?(j="Overdue",y=a.colors.error):(j="Pending",y=a.colors.accent);const n=i(c),o=c.currency||"USD";return e.jsxs("tr",{className:r?"cursor-pointer hover:bg-gray-50":"",onClick:()=>r&&r(c),style:{backgroundColor:p%2===0?a.documents.table.rowBackground:a.documents.table.alternateRowBackground},children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm",children:c.invoiceNumber}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm",children:c.issueDate}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm",children:c.dueDate}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm",children:c.clientDetails.name}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm",children:n.toLocaleString("en-US",{style:"currency",currency:o})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm",children:e.jsx("span",{className:"px-2 inline-flex text-xs leading-5 font-semibold rounded-full",style:{color:y,backgroundColor:`${y}20`},children:j})})]},c.invoiceNumber)})})]})})},Ot=({meetings:t,theme:l={},onRowClick:r})=>{const a=T(l),i=c=>{if(!c.actionItems||c.actionItems.length===0)return{total:0,completed:0};const p=c.actionItems.length,h=c.actionItems.filter(u=>u.status==="completed").length;return{total:p,completed:h}};return e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full bg-white shadow-md rounded-lg overflow-hidden",children:[e.jsx("thead",{style:{backgroundColor:a.documents.table.headerBackground},children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium uppercase tracking-wider",children:"Meeting"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium uppercase tracking-wider",children:"Date"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium uppercase tracking-wider",children:"Time"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium uppercase tracking-wider",children:"Participants"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium uppercase tracking-wider",children:"Action Items"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium uppercase tracking-wider",children:"Next Meeting"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-200",children:t.map((c,p)=>{var u;const h=i(c);return e.jsxs("tr",{className:r?"cursor-pointer hover:bg-gray-50":"",onClick:()=>r&&r(c),style:{backgroundColor:p%2===0?a.documents.table.rowBackground:a.documents.table.alternateRowBackground},children:[e.jsxs("td",{className:"px-6 py-4 text-sm",children:[e.jsx("div",{className:"font-medium",children:c.title}),c.location&&e.jsx("div",{className:"text-xs text-gray-500",children:c.location})]}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm",children:c.date}),e.jsxs("td",{className:"px-6 py-4 whitespace-nowrap text-sm",children:[c.startTime," - ",c.endTime]}),e.jsxs("td",{className:"px-6 py-4 whitespace-nowrap text-sm",children:[c.participants.length," participants"]}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm",children:h.total>0?e.jsx("div",{children:e.jsxs("span",{className:"px-2 py-1 rounded-full text-xs",style:{backgroundColor:`${a.colors.primary}20`,color:a.colors.primary},children:[h.completed,"/",h.total," ","completed"]})}):e.jsx("span",{className:"text-gray-500",children:"No action items"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm",children:(u=c.followUpMeeting)!=null&&u.date?e.jsxs("div",{children:[e.jsx("div",{children:c.followUpMeeting.date}),c.followUpMeeting.time&&e.jsx("div",{className:"text-xs text-gray-500",children:c.followUpMeeting.time})]}):e.jsx("span",{className:"text-gray-500",children:"Not scheduled"})})]},p)})})]})})};exports.BaseDocument=Z;exports.Invoice=Fe;exports.InvoiceTable=Rt;exports.MarkdownRenderer=we;exports.MeetingMinutes=Lt;exports.MeetingMinutesTable=Ot;exports.defaultTheme=F;exports.mergeTheme=T;
//# sourceMappingURL=index.cjs.js.map