@jaredwray/fumanchu 4.3.0 → 4.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,11 +1,3142 @@
1
- import y from"handlebars";var un=(n,e)=>Array.isArray(n)?n.slice(e):[],bn=(n,e)=>Array.isArray(n)?n.slice(0,-e):[],g=n=>n==null?[]:Array.isArray(n)?n:[n],dn=(n,e)=>{if(Array.isArray(n))return typeof e!="number"?n[0]:n.slice(0,e)},hn=(n,e)=>{if(!Array.isArray(n)&&typeof n!="string")return;if(typeof e!="number"){let t=n;return t[t.length-1]}let r=Math.abs(e);return n.slice(-r)},wn=n=>n&&typeof n=="object"&&!Array.isArray(n)?Object.keys(n).length:typeof n=="string"||Array.isArray(n)?n.length:0,jn=(n,e=", ")=>typeof n=="string"?n:Array.isArray(n)?n.join(e):"",kn=function(n,e){if(!Array.isArray(n)||!e||typeof e.fn!="function")return e?.inverse?e.inverse(this)??"":"";if(n.length===0)return e.inverse?e.inverse(this)??"":"";let r=n.length,t=e.hash??{},o=e.data?{...e.data}:void 0,s="";for(let i=0;i<r;i++){let c=n[i],l={index:i,total:r,isFirst:i===0,isLast:i===r-1},fn={...o?{...o}:{},...t,...l},H;c!=null&&typeof c=="object"?H={...c,...t,...l}:H={value:c,...t,...l},s+=e.fn(H,{data:fn})}return s},$=[{name:"after",category:"array",compatibility:["browser","nodejs"],fn:un},{name:"before",category:"array",compatibility:["browser","nodejs"],fn:bn},{name:"arrayify",category:"array",compatibility:["browser","nodejs"],fn:g},{name:"first",category:"array",compatibility:["browser","nodejs"],fn:dn},{name:"last",category:"array",compatibility:["browser","nodejs"],fn:hn},{name:"length",category:"array",compatibility:["browser","nodejs"],fn:wn},{name:"join",category:"array",compatibility:["browser","nodejs"],fn:jn},{name:"forEach",category:"array",compatibility:["browser","nodejs"],fn:kn}];import Hn from"fs";import xn from"path";import R from"html-tag";import On from"to-gfm-code-block";var An=(n,e)=>{let r=typeof e=="string"?e:xn.extname(n).slice(1),t=Hn.readFileSync(n,"utf8");return(r==="markdown"||r==="md")&&(r="markdown",t=t.split("`").join("&#x60")),`${On(t,r).trim()}
2
- `},Nn=n=>R("script",{src:`https://gist.github.com/${n}.js`}),$n=n=>{if(!n||!n.id)throw new Error("jsfiddle helper expects an `id`");let{id:e,width:r="100%",height:t="300",skin:o="/presentation/",tabs:s="result,js,html,css",allowfullscreen:i="allowfullscreen",frameborder:c="0"}=n,l=`http://jsfiddle.net/${e}/embedded/${s}${o}`;return R("iframe",{width:r,height:t,src:l,allowfullscreen:i,frameborder:c})},S=[{name:"embed",category:"code",compatibility:["nodejs"],fn:An},{name:"gist",category:"code",compatibility:["browser","nodejs"],fn:Nn},{name:"jsfiddle",category:"code",compatibility:["browser","nodejs"],fn:$n}];var Rn=n=>n==null?!0:Array.isArray(n)?n.length===0:typeof n=="object"?Object.keys(n).length===0:!1,Sn=(n,e,r)=>{if(Array.isArray(n)){let t="";for(let o=0;o<n.length;o++)t+=e(n[o],o);return t}if(n&&typeof n=="object"){let t="";for(let o of Object.keys(n))t+=e(n[o],o);return t}return r?r():""},F=[{name:"isEmpty",category:"collection",compatibility:["browser","nodejs"],fn:Rn},{name:"iterate",category:"collection",compatibility:["browser","nodejs"],fn:Sn}];var Fn=(...n)=>n.every(Boolean),En=(n,e,r)=>{switch(e){case"==":return n==r;case"===":return n===r;case"!=":return n!=r;case"!==":return n!==r;case"<":return n<r;case">":return n>r;case"<=":return n<=r;case">=":return n>=r;case"typeof":return typeof n===r;default:throw new Error(`helper {{compare}}: invalid operator: '${e}'`)}},Tn=(n,e,r=0)=>n==null?!1:typeof n=="string"||Array.isArray(n)?n.indexOf(e,r)>-1:typeof n=="object"?e in n:!1,Bn=(...n)=>{for(let e of n)if(e!=null)return e;return""},Mn=(n,e)=>n===e,_n=(n,e)=>n>e,Cn=(n,e)=>n>=e,zn=(n,e)=>n==null||e==null?!1:Array.isArray(n)||typeof n=="string"?n.indexOf(e)>-1:typeof n=="object"?e in n:!1,E=(n,e)=>{if(!n)return!0;let r=Array.isArray(e)?e:e!=null?[e]:["0","false","nada","nil","nay","nah","negative","no","none","nope","nul","null","nix","nyet","uh-uh","veto","zero"],t=typeof n=="string"?n.toLowerCase():null;for(let o of r)if(o===n||t!=null&&o===t)return!0;return!1},Ln=n=>E(n),Pn=n=>!E(n),Un=n=>typeof n=="number"&&n%2===0,In=(n,e)=>typeof n=="number"&&typeof e=="number"&&e%n===0,vn=n=>typeof n=="number"&&Math.abs(n%2)===1,Jn=(n,e)=>n==e,qn=(n,e)=>n!=e,Dn=(n,e)=>n<e,Yn=(n,e)=>n<=e,Wn=(n,e)=>!n&&!e,Gn=n=>!n,Qn=(...n)=>n.some(Boolean),Zn=(n,e)=>n!==e,Kn=(n,e)=>n<=e,Vn=(n,e)=>n>=e,Xn=(n,e)=>n<e,ne=(n,e)=>n>e,T=[{name:"and",category:"comparison",compatibility:["browser","nodejs"],fn:Fn},{name:"compare",category:"comparison",compatibility:["browser","nodejs"],fn:En},{name:"contains",category:"comparison",compatibility:["browser","nodejs"],fn:Tn},{name:"default",category:"comparison",compatibility:["browser","nodejs"],fn:Bn},{name:"eq",category:"comparison",compatibility:["browser","nodejs"],fn:Mn},{name:"gt",category:"comparison",compatibility:["browser","nodejs"],fn:_n},{name:"gte",category:"comparison",compatibility:["browser","nodejs"],fn:Cn},{name:"has",category:"comparison",compatibility:["browser","nodejs"],fn:zn},{name:"isFalsey",category:"comparison",compatibility:["browser","nodejs"],fn:Ln},{name:"isTruthy",category:"comparison",compatibility:["browser","nodejs"],fn:Pn},{name:"ifEven",category:"comparison",compatibility:["browser","nodejs"],fn:Un},{name:"ifNth",category:"comparison",compatibility:["browser","nodejs"],fn:In},{name:"ifOdd",category:"comparison",compatibility:["browser","nodejs"],fn:vn},{name:"is",category:"comparison",compatibility:["browser","nodejs"],fn:Jn},{name:"isnt",category:"comparison",compatibility:["browser","nodejs"],fn:qn},{name:"lt",category:"comparison",compatibility:["browser","nodejs"],fn:Dn},{name:"lte",category:"comparison",compatibility:["browser","nodejs"],fn:Yn},{name:"neither",category:"comparison",compatibility:["browser","nodejs"],fn:Wn},{name:"not",category:"comparison",compatibility:["browser","nodejs"],fn:Gn},{name:"or",category:"comparison",compatibility:["browser","nodejs"],fn:Qn},{name:"unlessEq",category:"comparison",compatibility:["browser","nodejs"],fn:Zn},{name:"unlessGt",category:"comparison",compatibility:["browser","nodejs"],fn:Kn},{name:"unlessLt",category:"comparison",compatibility:["browser","nodejs"],fn:Vn},{name:"unlessGteq",category:"comparison",compatibility:["browser","nodejs"],fn:Xn},{name:"unlessLteq",category:"comparison",compatibility:["browser","nodejs"],fn:ne}];import{parseDate as ee}from"chrono-node";import re from"dayjs";var te=()=>new Date().getFullYear().toString(),oe=n=>n.replace(/yyyy/g,"YYYY").replace(/yy/g,"YY").replace(/dd/g,"DD").replace(/mm/g,"MM").replace(/hh/g,"HH").replace(/ss/g,"SS"),B=(n,e)=>{let r=ee(n);if(!r)throw new Error(`Unable to parse date: ${n}`);let t=oe(e);return re(r).format(t)},M=[{name:"year",category:"date",compatibility:["browser","nodejs"],fn:te},{name:"date",category:"date",compatibility:["browser","nodejs"],fn:B},{name:"moment",category:"date",compatibility:["browser","nodejs"],fn:B}];import x from"fs";import se from"path";import ie from"is-glob";import ae from"micromatch";var ce=(n,e)=>{if(n==null)return"0 B";let r=typeof n=="number"?n:n.length??0;if(!r)return"0 B";let t=typeof e=="number"?e:2,o=["B","kB","MB","GB","TB","PB","EB","ZB","YB"],s=10**t,i=o.length-1;do{let c=10**(i*3);if(c<=r+1)return`${Math.round(r*s/c)/s} ${o[i]}`}while(--i>=0);return`${r} B`},pe=n=>x.readFileSync(n,"utf8"),me=n=>!!(n&&typeof n=="object"&&"hash"in n),le=(n,e)=>{let r=x.readdirSync(n).map(o=>se.join(n,o)),t=me(e)?void 0:e;if(typeof t=="function")return t(r);if(t instanceof RegExp)return r.filter(o=>t.test(o));if(typeof t=="string"){if(ie(t))return ae(r,t);if(t==="isFile"||t==="isDirectory")return r.filter(o=>{let s=x.statSync(o);return t==="isFile"?s.isFile():s.isDirectory()})}return r},_=[{name:"fileSize",category:"fs",compatibility:["nodejs"],fn:ce},{name:"read",category:"fs",compatibility:["nodejs"],fn:pe},{name:"readdir",category:"fs",compatibility:["nodejs"],fn:le}];import O from"path";import C from"html-tag";import ye from"striptags";var f=(n={})=>Object.keys(n).map(e=>`${e}="${String(n[e]).replace(/^['"]|["']$/g,"")}"`).join(" "),ge=n=>{let e=f(n?.hash??{});return e.trim()?` ${e}`:""},fe=function(n,e){arguments.length<2&&(e=n,n=[]);let r=g(n??[]),t="";return this&&this.options&&(t=this.options.assets||""),e?.hash?.href&&(r=g(e.hash.href)),r.map(o=>{let s=O.extname(o),i=o;return/(^\/\/)|(:\/\/)/.test(o)||(i=O.posix.join(t,o)),s===".less"?`<link type="text/css" rel="stylesheet/less" href="${i}">`:`<link type="text/css" rel="stylesheet" href="${i}">`}).join(`
3
- `)},ue=n=>{if(n&&typeof n=="object"&&!Array.isArray(n)){let r=f(n.hash??{});return`<script${r?` ${r}`:""}></script>`}return typeof n=="string"?`<script src="${n}"></script>`:g(n).map(r=>O.extname(r)===".coffee"?C("script",{type:"text/coffeescript",src:r}):C("script",{src:r})).join(`
4
- `)},be=n=>typeof n!="string"?"":ye(n).trim(),de=(n,e)=>{let r=f(e.hash??{}),t=n.map(s=>typeof s=="string"?s:e.fn(s));return`${r?`<ul ${r}>`:"<ul>"}${t.map(s=>`<li>${s}</li>`).join(`
5
- `)}</ul>`},he=(n,e)=>{let r=f(e.hash??{}),t=n.map(s=>typeof s=="string"?s:e.fn(s));return`${r?`<ol ${r}>`:"<ol>"}${t.map(s=>`<li>${s}</li>`).join(`
6
- `)}</ol>`},we=n=>{let e="",r="",t=n.full||!1,o={alt:n.alt,src:n.thumbnail,width:n.size.width,height:n.size.height},s={id:`image-${n.id}`},i={href:t,rel:"thumbnail"};return n.classes&&(n.classes.image&&(o.class=n.classes.image.join(" ")),n.classes.figure&&(s.class=n.classes.figure.join(" ")),n.classes.link&&(i.class=n.classes.link.join(" "))),e+=`<figure ${f(s)}>
7
- `,r+=`<img ${f(o)}>
8
- `,t?e+=`<a ${f(i)}>
9
- ${r}</a>
10
- `:e+=r,n.caption&&(e+=`<figcaption>${n.caption}</figcaption>
11
- `),e+="</figure>",e},z=[{name:"attr",category:"html",compatibility:["browser","nodejs"],fn:ge},{name:"css",category:"html",compatibility:["nodejs"],fn:fe},{name:"js",category:"html",compatibility:["nodejs"],fn:ue},{name:"sanitize",category:"html",compatibility:["browser","nodejs"],fn:be},{name:"ul",category:"html",compatibility:["browser","nodejs"],fn:de},{name:"ol",category:"html",compatibility:["browser","nodejs"],fn:he},{name:"thumbnailImage",category:"html",compatibility:["browser","nodejs"],fn:we}];var u=(n,e)=>{if(!n||typeof n!="object")return;let r=Array.isArray(e)?e:e.split("."),t=n;for(let o of r){if(t==null||typeof t!="object")return;t=t[o]}return t},A=(n,e)=>{if(!n||typeof n!="object")return;let r=Array.isArray(e)?e:e.split(".");if(r.length===0)return;let t=n;for(let s=0;s<r.length-1;s++){if(t==null||typeof t!="object")return;t=t[r[s]]}let o=r[r.length-1];if(!(t==null||typeof t!="object"||!(o in t)))return{[o]:t[o]}};var je=function(n,e,r){if(e&&typeof e=="object"&&"hash"in e&&r===void 0&&(r=e,e={}),typeof n!="string")throw new Error('{{i18n}} helper expected "key" to be a string');let t={...this,...e,...r?.hash??{}},o=t.language||t.lang;if(typeof o!="string")throw new TypeError('{{i18n}} helper expected "language" to be a string');let s=t[o];if(typeof s>"u")throw new Error(`{{i18n}} helper cannot find language "${o}"`);let i=u(s,n);if(typeof i>"u")throw new Error('{{i18n}} helper cannot find property "'+String(n)+'" for language "'+o+'"');return String(i)},L=[{name:"i18n",category:"i18n",compatibility:["browser","nodejs"],fn:je}];var ke=(n,e,r,t)=>{let o=n>1||n===0?r:e;return t?`${n} ${o}`:o},He=n=>{let e=Math.abs(Math.round(Number(n))),r=String(n),t=e%100;if([11,12,13].includes(t))return`${r}th`;switch(e%10){case 1:return`${r}st`;case 2:return`${r}nd`;case 3:return`${r}rd`;default:return`${r}th`}},P=[{name:"inflect",category:"inflection",compatibility:["browser","nodejs"],fn:ke},{name:"ordinalize",category:"inflection",compatibility:["browser","nodejs"],fn:He}];import xe from"logging-helpers";var{log:Oe,ok:Ae,success:Ne,info:$e,warning:Re,warn:Se,error:Fe,danger:Ee,bold:Te,_debug:Be,_inspect:Me}=xe,U=[{name:"log",category:"logging",compatibility:["nodejs"],fn:Oe},{name:"ok",category:"logging",compatibility:["nodejs"],fn:Ae},{name:"success",category:"logging",compatibility:["nodejs"],fn:Ne},{name:"info",category:"logging",compatibility:["nodejs"],fn:$e},{name:"warning",category:"logging",compatibility:["nodejs"],fn:Re},{name:"warn",category:"logging",compatibility:["nodejs"],fn:Se},{name:"error",category:"logging",compatibility:["nodejs"],fn:Fe},{name:"danger",category:"logging",compatibility:["nodejs"],fn:Ee},{name:"bold",category:"logging",compatibility:["nodejs"],fn:Te},{name:"_debug",category:"logging",compatibility:["nodejs"],fn:Be},{name:"_inspect",category:"logging",compatibility:["nodejs"],fn:Me}];import I from"micromatch";var v=(n,e,r)=>{let t=typeof e=="string"?e.split(/, */):e;return I(n,t,r)},_e=(n,e,r)=>I.isMatch(n,e,r),Ce=(...n)=>(console.log("the {{mm}} helper is depcrecated and will be removed"),console.log("in handlebars-helpers v1.0.0, please use the {{match}}"),console.log("helper instead."),v(...n)),J=[{name:"match",category:"match",compatibility:["browser","nodejs"],fn:v},{name:"isMatch",category:"match",compatibility:["browser","nodejs"],fn:_e},{name:"mm",category:"match",compatibility:["browser","nodejs"],fn:Ce}];var j=n=>typeof n=="number"&&!Number.isNaN(n)||typeof n=="string"&&n.trim()!==""&&!Number.isNaN(Number(n)),a=(n,e="expected a number")=>{if(j(n))return Number(n);throw new TypeError(e)},ze=n=>{let e=a(n);return Math.abs(e)},Le=(n,e)=>j(n)&&j(e)?Number(n)+Number(e):"",Pe=(...n)=>{let e=n.flat().map(r=>Number(r));return D(e)/e.length},Ue=n=>{let e=a(n);return Math.ceil(e)},Ie=(n,e)=>{let r=a(n,"expected the first argument to be a number"),t=a(e,"expected the second argument to be a number");return r/t},ve=n=>{let e=a(n);return Math.floor(e)},Je=(n,e)=>{let r=a(n,"expected the first argument to be a number"),t=a(e,"expected the second argument to be a number");return r-t},qe=(n,e)=>{let r=a(n,"expected the first argument to be a number"),t=a(e,"expected the second argument to be a number");return r%t},q=(n,e)=>{let r=a(n,"expected the first argument to be a number"),t=a(e,"expected the second argument to be a number");return r*t},De=(n,e)=>{let r=a(n,"expected the first argument to be a number"),t=a(e,"expected the second argument to be a number");return r+t},Ye=(n,e)=>{let r=a(n,"expected minimum to be a number"),t=a(e,"expected maximum to be a number");return r+Math.floor(Math.random()*(t-r+1))},We=(n,e)=>n%e,Ge=n=>{let e=a(n);return Math.round(e)},Qe=(n,e)=>{let r=a(n,"expected the first argument to be a number"),t=a(e,"expected the second argument to be a number");return r-t},D=(...n)=>{let e=n.flat(),r=0;for(let t of e)j(t)&&(r+=Number(t));return r},Ze=(n,e)=>q(n,e),Y=[{name:"abs",category:"math",compatibility:["browser","nodejs"],fn:ze},{name:"add",category:"math",compatibility:["browser","nodejs"],fn:Le},{name:"avg",category:"math",compatibility:["browser","nodejs"],fn:Pe},{name:"ceil",category:"math",compatibility:["browser","nodejs"],fn:Ue},{name:"divide",category:"math",compatibility:["browser","nodejs"],fn:Ie},{name:"floor",category:"math",compatibility:["browser","nodejs"],fn:ve},{name:"minus",category:"math",compatibility:["browser","nodejs"],fn:Je},{name:"modulo",category:"math",compatibility:["browser","nodejs"],fn:qe},{name:"multiply",category:"math",compatibility:["browser","nodejs"],fn:q},{name:"plus",category:"math",compatibility:["browser","nodejs"],fn:De},{name:"random",category:"math",compatibility:["browser","nodejs"],fn:Ye},{name:"remainder",category:"math",compatibility:["browser","nodejs"],fn:We},{name:"round",category:"math",compatibility:["browser","nodejs"],fn:Ge},{name:"subtract",category:"math",compatibility:["browser","nodejs"],fn:Qe},{name:"sum",category:"math",compatibility:["browser","nodejs"],fn:D},{name:"times",category:"math",compatibility:["browser","nodejs"],fn:Ze}];import N from"fs";import Ke from"path";import Ve from"process";import Xe from"ent";import nr from"handlebars";import{Remarkable as er}from"remarkable";var W=function(n,e){typeof n=="object"&&n&&"fn"in n&&typeof n.fn=="function"?(e=n,n=n.fn(this)):typeof n!="string"&&(n="");let r={cwd:Ve.cwd(),...e},t=new er({breaks:!0,html:!0,langPrefix:"lang-",typographer:!1,xhtmlOut:!1}),o=n;if(o&&o.length>0){let s=Ke.resolve(r.cwd,o);N.existsSync(s)&&N.statSync(s).isFile()&&(o=N.readFileSync(s,"utf8"))}return new nr.SafeString(Xe.decode(t.render(o)))},G=[{name:"md",category:"markdown",compatibility:["nodejs"],fn:W},{name:"markdown",category:"markdown",compatibility:["nodejs"],fn:W}];import rr from"handlebars-helper-create-frame";import tr from"handlebars-utils";import or from"kind-of";var sr=rr;function ir(n,e,r){return u(tr.options(this,e,r),n)}function ar(n){return n.fn(this)}var cr=or;function pr(n){return n.hash&&Object.keys(n.hash).length?n.fn(n.hash):n.inverse(this)}var Q=[{name:"frame",category:"misc",compatibility:["browser","nodejs"],fn:sr},{name:"option",category:"misc",compatibility:["browser","nodejs"],fn:ir},{name:"noop",category:"misc",compatibility:["browser","nodejs"],fn:ar},{name:"typeOf",category:"misc",compatibility:["browser","nodejs"],fn:cr},{name:"withHash",category:"misc",compatibility:["browser","nodejs"],fn:pr}];var h=n=>typeof n=="number"&&!Number.isNaN(n),mr=(n,e)=>{if(n==null)return"0 B";let r;if(typeof n=="string"){if(r=n.length,!r)return"0 B"}else if(h(n))r=Number(n);else if(typeof n.length=="number"){if(r=n.length,!r)return"0 B"}else return"0 B";let t=typeof e=="number"&&!Number.isNaN(e)?e:2,o=["B","kB","MB","GB","TB","PB","EB","ZB","YB"],s=10**t;for(let i=o.length-1;i>=0;i--){let c=10**(i*3);if(c<=r+1)return`${Math.round(r*s/c)/s} ${o[i]}`}return`${r}`},lr=n=>n.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1,"),yr=n=>{let e=n.toString();return`(${e.substr(0,3)}) ${e.substr(3,3)}-${e.substr(6,4)}`},gr=(n,e)=>{let r=h(n)?Number(n):0,o=10**(typeof e=="number"&&!Number.isNaN(e)?e:2),s=["k","m","b","t","q"];for(let i=s.length-1;i>=0;i--){let c=10**((i+1)*3);if(c<=r+1)return`${Math.round(r*o/c)/o}${s[i]}`}return`${r}`},fr=(n,e)=>{let r=h(n)?Number(n):0,t=typeof e=="number"&&!Number.isNaN(e)?e:0;return Number(r).toExponential(t)},ur=(n,e)=>{let r=h(n)?Number(n):0,t=typeof e=="number"&&!Number.isNaN(e)?e:0;return Number(r).toFixed(t)},br=n=>parseFloat(String(n)),dr=n=>parseInt(String(n),10),hr=(n,e)=>{let r=h(n)?Number(n):0,t=typeof e=="number"&&!Number.isNaN(e)?e:1;return Number(r).toPrecision(t)},Z=[{name:"bytes",category:"number",compatibility:["browser","nodejs"],fn:mr},{name:"addCommas",category:"number",compatibility:["browser","nodejs"],fn:lr},{name:"phoneNumber",category:"number",compatibility:["browser","nodejs"],fn:yr},{name:"toAbbr",category:"number",compatibility:["browser","nodejs"],fn:gr},{name:"toExponential",category:"number",compatibility:["browser","nodejs"],fn:fr},{name:"toFixed",category:"number",compatibility:["browser","nodejs"],fn:ur},{name:"toFloat",category:"number",compatibility:["browser","nodejs"],fn:br},{name:"toInt",category:"number",compatibility:["browser","nodejs"],fn:dr},{name:"toPrecision",category:"number",compatibility:["browser","nodejs"],fn:hr}];var k=n=>!!(n&&typeof n=="object"&&"hash"in n),K=(n,e)=>({...n?.data||{},...e}),wr=(...n)=>{let e=[...n];if(e.length&&k(e[e.length-1])){let t=e.pop();e.push(t.hash)}let r={};for(let t of e)t&&typeof t=="object"&&!Array.isArray(t)&&Object.assign(r,t);return r},jr=(n,e)=>{if(!k(e))return e?.inverse?.(n)??"";let r=K(e,e.hash||{}),t="";for(let o in n)r.key=o,t+=e.fn(n[o],{data:r});return t},kr=(n,e)=>{if(!k(e))return e?.inverse?.(n)??"";let r=K(e,e.hash||{}),t="";for(let o in n)Object.hasOwn(n,o)&&(r.key=o,t+=e.fn(n[o],{data:r}));return t},Hr=(...n)=>{let e=[];for(let r of n)(typeof r=="string"||typeof r=="number")&&e.push(r);return e.join(".")},xr=(n,e,r)=>{let t=u(e,n);return r&&typeof r.fn=="function"?t?r.fn(t):r.inverse?.(e):t},Or=(n,e)=>A(e,n),Ar=(n,e)=>Object.hasOwn(n,e),Nr=n=>!!n&&typeof n=="object"&&!Array.isArray(n),V=n=>JSON.parse(n),X=(n,e)=>JSON.stringify(n,null,typeof e=="number"?e:0),$r=(n,...e)=>{let r=[n,...e];if(r.length&&k(r[r.length-1])){let t=r.pop();r.push(t.hash)}return Object.assign(...r)},Rr=V,Sr=X,Fr=(n,e,r)=>{let t=g(n),o={};for(let s of t)o=Object.assign({},o,A(e,s));return r&&typeof r.fn=="function"?Object.keys(o).length?r.fn(o):r.inverse?.(e):o},nn=[{name:"extend",category:"object",compatibility:["browser","nodejs"],fn:wr},{name:"forIn",category:"object",compatibility:["browser","nodejs"],fn:jr},{name:"forOwn",category:"object",compatibility:["browser","nodejs"],fn:kr},{name:"toPath",category:"object",compatibility:["browser","nodejs"],fn:Hr},{name:"get",category:"object",compatibility:["browser","nodejs"],fn:xr},{name:"getObject",category:"object",compatibility:["browser","nodejs"],fn:Or},{name:"hasOwn",category:"object",compatibility:["browser","nodejs"],fn:Ar},{name:"isObject",category:"object",compatibility:["browser","nodejs"],fn:Nr},{name:"JSONparse",category:"object",compatibility:["browser","nodejs"],fn:V},{name:"JSONstringify",category:"object",compatibility:["browser","nodejs"],fn:X},{name:"merge",category:"object",compatibility:["browser","nodejs"],fn:$r},{name:"parseJSON",category:"object",compatibility:["browser","nodejs"],fn:Rr},{name:"pick",category:"object",compatibility:["browser","nodejs"],fn:Fr},{name:"stringify",category:"object",compatibility:["browser","nodejs"],fn:Sr}];import m from"path";var Er=(n,e,r)=>{let t=Object.prototype.toString.call(r).slice(8,-1).toLowerCase();return`Expected ${n} to be of type ${e}, but got ${t}`},p=(n,e)=>{if(typeof e!="string")throw new TypeError(Er(n,"string",e));return e},Tr=function(n,e){let r=p("filepath",n),t=e?.data?.root?.cwd??this?.cwd??process.cwd();return m.resolve(t,r)},Br=n=>{let e=p("filepath",n);return m.dirname(e)},Mr=(n,e)=>{let r=p("first path",n),t=p("second path",e);return m.relative(m.dirname(r),t)},_r=n=>{let e=p("filepath",n);return m.basename(e)},Cr=n=>{let e=p("filepath",n);return m.basename(e,m.extname(e))},zr=n=>{let e=p("filepath",n);return m.extname(e)},Lr=function(n,...e){let r,t=e[e.length-1];typeof t=="object"&&t&&"data"in t&&(r=e.pop());let s=[r?.data?.root?.cwd??this?.cwd??process.cwd(),p("filepath",n),...e.map((i,c)=>p(`path${c}`,i))];return m.resolve(...s)},Pr=(n,e,r)=>{let t=p("filepath",n),o=Number(e),s=Number(r);return t.split(/[\\/]+/).slice(o,s).join("/")},en=[{name:"absolute",category:"path",compatibility:["nodejs"],fn:Tr},{name:"dirname",category:"path",compatibility:["nodejs"],fn:Br},{name:"relative",category:"path",compatibility:["nodejs"],fn:Mr},{name:"basename",category:"path",compatibility:["nodejs"],fn:_r},{name:"stem",category:"path",compatibility:["nodejs"],fn:Cr},{name:"extname",category:"path",compatibility:["nodejs"],fn:zr},{name:"resolve",category:"path",compatibility:["nodejs"],fn:Lr},{name:"segments",category:"path",compatibility:["nodejs"],fn:Pr}];import Ur from"handlebars-utils";var Ir=(n,e,r)=>{let t=Ur.options({},e,r);return new RegExp(n,t.flags)},vr=(n,e)=>{if(typeof n!="string")return!1;if(!(e instanceof RegExp))throw new TypeError("expected a regular expression");return e.test(n)},rn=[{name:"toRegex",category:"regex",compatibility:["browser","nodejs"],fn:Ir},{name:"test",category:"regex",compatibility:["browser","nodejs"],fn:vr}];var tn=n=>n.trim().replace(/^[-_.\W\s]+|[-_.\W\s]+$/g,""),b=(n,e)=>n.length===1?n.toLowerCase():tn(n).toLowerCase().replace(/[-_.\W\s]+(\w|$)/g,(t,o)=>e(o)),Jr=(n,e)=>typeof n=="string"&&typeof e=="string"?n+e:n,qr=n=>typeof n=="string"?b(n,e=>e.toUpperCase()):"",on=n=>typeof n!="string"||n.length===0?"":n.charAt(0).toUpperCase()+n.slice(1),Dr=n=>typeof n!="string"?"":n.replace(/\w\S*/g,e=>on(e)),Yr=(n,e)=>{if(typeof n!="string")return"";let r="";for(let t=0;t<e;t++)r+="&nbsp;";return r+n+r},Wr=n=>typeof n=="string"?tn(n):"",Gr=n=>typeof n=="string"?b(n,e=>`-${e}`):"",Qr=n=>typeof n=="string"?b(n,e=>`.${e}`):"",sn=(n,e,r)=>typeof n=="string"?(typeof r!="string"&&(r=""),n.length>e?n.slice(0,e-r.length)+r:n):"",Zr=(n,e)=>typeof n=="string"?n.length<=e?n:`${sn(n,e)}\u2026`:"",Kr=n=>typeof n=="string"?n.split(" ").join("-"):"",Vr=n=>typeof n=="string",an=n=>typeof n=="object"&&n!==null&&"fn"in n&&typeof n.fn=="function"?String(n.fn()).toLowerCase():typeof n!="string"?"":n.toLowerCase(),Xr=(...n)=>an(...n),nt=(n,e)=>{if(typeof n!="string")return"";let r=e.length,t=n.indexOf(e,0),o=0;for(;t>-1;)o++,t=n.indexOf(e,t+r);return o},et=n=>{if(typeof n!="string")return"";let e=b(n,r=>r.toUpperCase());return e.charAt(0).toUpperCase()+e.slice(1)},rt=n=>typeof n=="string"?b(n,e=>`/${e}`):"",tt=(n,e)=>typeof n!="string"?"":(typeof e!="string"&&(e=" "),n.split(e).join("+")),ot=(n,e)=>typeof n=="string"&&typeof e=="string"?e+n:n,st=(n,e)=>typeof n!="string"?"":typeof e!="string"?n:n.split(e).join(""),it=(n,e)=>typeof n!="string"?"":typeof e!="string"?n:n.replace(e,""),at=(n,e,r)=>typeof n!="string"?"":typeof e!="string"?n:(typeof r!="string"&&(r=""),n.split(e).join(r)),ct=(n,e,r)=>typeof n!="string"?"":typeof e!="string"?n:(typeof r!="string"&&(r=""),n.replace(e,r)),pt=n=>typeof n=="string"?n.split("").reverse().join(""):"",mt=n=>typeof n!="string"?"":n.replace(/((?:\S[^.?!]*)[.?!]*)/g,e=>e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()),lt=n=>typeof n=="string"?b(n,e=>`_${e}`):"",yt=n=>typeof n=="string"?n.trim():"",gt=n=>typeof n=="string"?n.replace(/^\s+/,""):"",ft=n=>typeof n=="string"?n.replace(/\s+$/,""):"",ut=(n,e,r)=>{if(typeof n=="string"&&typeof e=="number"&&Number.isFinite(e)){typeof r!="string"&&(r="...");let t=Math.trunc(e),o=n.split(" ");return t<o.length&&(o=o.slice(0,t)),o.join(" ").trim()+r}return""},bt=ut,cn=n=>typeof n=="object"&&n!==null&&"fn"in n&&typeof n.fn=="function"?String(n.fn()).toUpperCase():typeof n!="string"?"":n.toUpperCase(),dt=(...n)=>cn(...n),pn=[{name:"append",category:"string",compatibility:["browser","nodejs"],fn:Jr},{name:"camelcase",category:"string",compatibility:["browser","nodejs"],fn:qr},{name:"capitalize",category:"string",compatibility:["browser","nodejs"],fn:on},{name:"capitalizeAll",category:"string",compatibility:["browser","nodejs"],fn:Dr},{name:"center",category:"string",compatibility:["browser","nodejs"],fn:Yr},{name:"chop",category:"string",compatibility:["browser","nodejs"],fn:Wr},{name:"dashcase",category:"string",compatibility:["browser","nodejs"],fn:Gr},{name:"dotcase",category:"string",compatibility:["browser","nodejs"],fn:Qr},{name:"ellipsis",category:"string",compatibility:["browser","nodejs"],fn:Zr},{name:"hyphenate",category:"string",compatibility:["browser","nodejs"],fn:Kr},{name:"isString",category:"string",compatibility:["browser","nodejs"],fn:Vr},{name:"lowercase",category:"string",compatibility:["browser","nodejs"],fn:an},{name:"downcase",category:"string",compatibility:["browser","nodejs"],fn:Xr},{name:"occurrences",category:"string",compatibility:["browser","nodejs"],fn:nt},{name:"pascalcase",category:"string",compatibility:["browser","nodejs"],fn:et},{name:"pathcase",category:"string",compatibility:["browser","nodejs"],fn:rt},{name:"plusify",category:"string",compatibility:["browser","nodejs"],fn:tt},{name:"prepend",category:"string",compatibility:["browser","nodejs"],fn:ot},{name:"remove",category:"string",compatibility:["browser","nodejs"],fn:st},{name:"removeFirst",category:"string",compatibility:["browser","nodejs"],fn:it},{name:"replace",category:"string",compatibility:["browser","nodejs"],fn:at},{name:"replaceFirst",category:"string",compatibility:["browser","nodejs"],fn:ct},{name:"reverse",category:"string",compatibility:["browser","nodejs"],fn:pt},{name:"sentence",category:"string",compatibility:["browser","nodejs"],fn:mt},{name:"snakecase",category:"string",compatibility:["browser","nodejs"],fn:lt},{name:"trim",category:"string",compatibility:["browser","nodejs"],fn:yt},{name:"trimLeft",category:"string",compatibility:["browser","nodejs"],fn:gt},{name:"trimRight",category:"string",compatibility:["browser","nodejs"],fn:ft},{name:"truncate",category:"string",compatibility:["browser","nodejs"],fn:sn},{name:"truncateWords",category:"string",compatibility:["browser","nodejs"],fn:bt},{name:"uppercase",category:"string",compatibility:["browser","nodejs"],fn:cn},{name:"upcase",category:"string",compatibility:["browser","nodejs"],fn:dt}];import{escape as ht}from"querystring";import{format as wt,parse as mn,resolve as jt}from"url";var w=["browser","nodejs"],ln=n=>{if(typeof n=="string")return encodeURIComponent(n)},kt=n=>{if(typeof n=="string")return ht(n)},yn=n=>{if(typeof n=="string")return decodeURIComponent(n)};function Ht(...n){return ln.apply(this,n)}function xt(...n){return yn.apply(this,n)}var Ot=(n,e)=>jt(String(n),String(e)),At=n=>mn(String(n)),Nt=n=>{if(typeof n=="string")return n.split("?")[0]},$t=n=>{if(typeof n=="string"){let e=mn(n);return e.protocol="",wt(e)}},gn=[{name:"encodeURI",category:"url",compatibility:w,fn:ln},{name:"escape",category:"url",compatibility:["nodejs"],fn:kt},{name:"decodeURI",category:"url",compatibility:w,fn:yn},{name:"url_encode",category:"url",compatibility:w,fn:Ht},{name:"url_decode",category:"url",compatibility:w,fn:xt},{name:"urlResolve",category:"url",compatibility:["nodejs"],fn:Ot},{name:"urlParse",category:"url",compatibility:["nodejs"],fn:At},{name:"stripQuerystring",category:"url",compatibility:w,fn:Nt},{name:"stripProtocol",category:"url",compatibility:["nodejs"],fn:$t}];var d=class{_helpers=[];constructor(){this.init()}get helpers(){return this._helpers}init(){this.registerHelpers($),this.registerHelpers(F),this.registerHelpers(M),this.registerHelpers(_),this.registerHelpers(S),this.registerHelpers(G),this.registerHelpers(z),this.registerHelpers(T),this.registerHelpers(L),this.registerHelpers(P),this.registerHelpers(U),this.registerHelpers(J),this.registerHelpers(Y),this.registerHelpers(Q),this.registerHelpers(Z),this.registerHelpers(en),this.registerHelpers(rn),this.registerHelpers(pn),this.registerHelpers(gn),this.registerHelpers(nn)}register(e){return this.has(e.name)||this._helpers.push(e),!1}registerHelpers(e){for(let r of e)this.register(r)}has(e){return this._helpers.some(r=>r.name===e)}filter(e){let r=this._helpers;return e.names&&(r=r.filter(t=>e.names?.includes(t.name))),e.categories&&(r=r.filter(t=>e.categories?.includes(t.category))),e.compatibility&&(r=r.filter(t=>t.compatibility?.some(o=>e.compatibility?.includes(o)))),r}load(e,r){let t=this._helpers;r&&(t=this.filter(r));for(let o of t)e.registerHelper(o.name,o.fn)}swap(e){for(let r of this._helpers)e.unregisterHelper(r.name),e.registerHelper(r.name,r.fn)}};var Xo=y,ns=y.create();function es(n){new d().load(n.handlebars??n.hbs)}async function rs(){let n=new d,e=y.create();return Object.keys(y.partials).length>0&&e.registerPartial(y.partials),n.load(e),process.env.NODE_ENV==="development"&&console.warn("createHandlebars will be deprecated in future versions, use `fumanchu` instead."),e}function ts(n){let e=new d,r=y.create();return n?.handlebars?r=n.handlebars:Object.keys(y.partials).length>0&&r.registerPartial(y.partials),e.load(r),r}export{Xo as Handlebars,d as HelperRegistry,rs as createHandlebars,ts as fumanchu,ns as handlebars,es as helpers};
1
+ // src/index.ts
2
+ import HandlebarsLib from "handlebars";
3
+
4
+ // src/helpers/array.ts
5
+ var after = (array, n) => {
6
+ if (!Array.isArray(array)) return [];
7
+ return array.slice(n);
8
+ };
9
+ var before = (array, n) => {
10
+ if (!Array.isArray(array)) return [];
11
+ return array.slice(0, -n);
12
+ };
13
+ var arrayify = (value) => {
14
+ if (value == null) return [];
15
+ return Array.isArray(value) ? value : [value];
16
+ };
17
+ var first = (array, n) => {
18
+ if (!Array.isArray(array)) return void 0;
19
+ if (typeof n !== "number") {
20
+ return array[0];
21
+ }
22
+ return array.slice(0, n);
23
+ };
24
+ var last = (value, n) => {
25
+ if (!Array.isArray(value) && typeof value !== "string") {
26
+ return void 0;
27
+ }
28
+ if (typeof n !== "number") {
29
+ const array = value;
30
+ return array[array.length - 1];
31
+ }
32
+ const start = Math.abs(n);
33
+ if (typeof value === "string") {
34
+ return value.slice(-start);
35
+ }
36
+ return value.slice(-start);
37
+ };
38
+ var length = (value) => {
39
+ if (value && typeof value === "object" && !Array.isArray(value)) {
40
+ return Object.keys(value).length;
41
+ }
42
+ if (typeof value === "string" || Array.isArray(value)) {
43
+ return value.length;
44
+ }
45
+ return 0;
46
+ };
47
+ var join = (array, separator = ", ") => {
48
+ if (typeof array === "string") return array;
49
+ if (!Array.isArray(array)) return "";
50
+ return array.join(separator);
51
+ };
52
+ var forEach = function(collection, options2) {
53
+ if (!Array.isArray(collection) || !options2 || typeof options2.fn !== "function") {
54
+ return options2?.inverse ? options2.inverse(this) ?? "" : "";
55
+ }
56
+ if (collection.length === 0) {
57
+ return options2.inverse ? options2.inverse(this) ?? "" : "";
58
+ }
59
+ const total = collection.length;
60
+ const hash = options2.hash ?? {};
61
+ const baseData = options2.data ? { ...options2.data } : void 0;
62
+ let result = "";
63
+ for (let index = 0; index < total; index++) {
64
+ const value = collection[index];
65
+ const meta = {
66
+ index,
67
+ total,
68
+ isFirst: index === 0,
69
+ isLast: index === total - 1
70
+ };
71
+ const data = {
72
+ ...baseData ? { ...baseData } : {},
73
+ ...hash,
74
+ ...meta
75
+ };
76
+ let context;
77
+ if (value != null && typeof value === "object") {
78
+ context = { ...value, ...hash, ...meta };
79
+ } else {
80
+ context = { value, ...hash, ...meta };
81
+ }
82
+ result += options2.fn(context, { data });
83
+ }
84
+ return result;
85
+ };
86
+ var inArray = function(array, value, options2) {
87
+ if (!Array.isArray(array) || !options2) {
88
+ return "";
89
+ }
90
+ const found = array.includes(value);
91
+ if (found && options2.fn) {
92
+ return options2.fn(this);
93
+ }
94
+ if (!found && options2.inverse) {
95
+ return options2.inverse(this);
96
+ }
97
+ return "";
98
+ };
99
+ var isArray = (value) => {
100
+ return Array.isArray(value);
101
+ };
102
+ var itemAt = (array, idx) => {
103
+ if (!Array.isArray(array)) return void 0;
104
+ return array[idx];
105
+ };
106
+ var equalsLength = function(value, targetLength, options2) {
107
+ const actualLength = length(value);
108
+ const isEqual = actualLength === targetLength;
109
+ if (options2 && (options2.fn || options2.inverse)) {
110
+ if (isEqual && options2.fn) {
111
+ return options2.fn(this);
112
+ }
113
+ if (!isEqual && options2.inverse) {
114
+ return options2.inverse(this);
115
+ }
116
+ return "";
117
+ }
118
+ return isEqual;
119
+ };
120
+ var some = function(array, iter, options2) {
121
+ if (!Array.isArray(array) || typeof iter !== "function" || !options2) {
122
+ return options2?.inverse ? options2.inverse(this) ?? "" : "";
123
+ }
124
+ const hasSome = array.some(iter);
125
+ if (hasSome && options2.fn) {
126
+ return options2.fn(this);
127
+ }
128
+ if (!hasSome && options2.inverse) {
129
+ return options2.inverse(this);
130
+ }
131
+ return "";
132
+ };
133
+ var eachIndex = function(array, options2) {
134
+ if (!Array.isArray(array) || !options2 || typeof options2.fn !== "function") {
135
+ return options2?.inverse ? options2.inverse(this) ?? "" : "";
136
+ }
137
+ if (array.length === 0) {
138
+ return options2.inverse ? options2.inverse(this) ?? "" : "";
139
+ }
140
+ let result = "";
141
+ for (let index = 0; index < array.length; index++) {
142
+ const context = {
143
+ item: array[index],
144
+ index
145
+ };
146
+ result += options2.fn(context);
147
+ }
148
+ return result;
149
+ };
150
+ var withAfter = function(array, idx, options2) {
151
+ if (!Array.isArray(array) || !options2 || typeof options2.fn !== "function") {
152
+ return "";
153
+ }
154
+ const sliced = array.slice(idx + 1);
155
+ if (sliced.length === 0) {
156
+ return options2.inverse ? options2.inverse(this) ?? "" : "";
157
+ }
158
+ let result = "";
159
+ for (const item of sliced) {
160
+ result += options2.fn(item);
161
+ }
162
+ return result;
163
+ };
164
+ var withBefore = function(array, idx, options2) {
165
+ if (!Array.isArray(array) || !options2 || typeof options2.fn !== "function") {
166
+ return "";
167
+ }
168
+ const sliced = array.slice(0, idx);
169
+ if (sliced.length === 0) {
170
+ return options2.inverse ? options2.inverse(this) ?? "" : "";
171
+ }
172
+ let result = "";
173
+ for (const item of sliced) {
174
+ result += options2.fn(item);
175
+ }
176
+ return result;
177
+ };
178
+ var withFirst = function(array, n, options2) {
179
+ let count = 1;
180
+ let opts = options2;
181
+ if (typeof n === "object" && n !== null && !Array.isArray(n)) {
182
+ opts = n;
183
+ } else if (typeof n === "number") {
184
+ count = n;
185
+ }
186
+ if (!Array.isArray(array) || !opts || typeof opts.fn !== "function") {
187
+ return "";
188
+ }
189
+ if (array.length === 0) {
190
+ return opts.inverse ? opts.inverse(this) ?? "" : "";
191
+ }
192
+ const items = array.slice(0, count);
193
+ let result = "";
194
+ for (const item of items) {
195
+ result += opts.fn(item);
196
+ }
197
+ return result;
198
+ };
199
+ var withLast = function(array, n, options2) {
200
+ let count = 1;
201
+ let opts = options2;
202
+ if (typeof n === "object" && n !== null && !Array.isArray(n)) {
203
+ opts = n;
204
+ } else if (typeof n === "number") {
205
+ count = n;
206
+ }
207
+ if (!Array.isArray(array) || !opts || typeof opts.fn !== "function") {
208
+ return "";
209
+ }
210
+ if (array.length === 0) {
211
+ return opts.inverse ? opts.inverse(this) ?? "" : "";
212
+ }
213
+ const items = array.slice(-count);
214
+ let result = "";
215
+ for (const item of items) {
216
+ result += opts.fn(item);
217
+ }
218
+ return result;
219
+ };
220
+ var withGroup = function(array, size, options2) {
221
+ if (!Array.isArray(array) || typeof size !== "number" || size <= 0 || !options2 || typeof options2.fn !== "function") {
222
+ return "";
223
+ }
224
+ if (array.length === 0) {
225
+ return options2.inverse ? options2.inverse(this) ?? "" : "";
226
+ }
227
+ let result = "";
228
+ const groups = [];
229
+ for (let i = 0; i < array.length; i += size) {
230
+ groups.push(array.slice(i, i + size));
231
+ }
232
+ for (const group of groups) {
233
+ result += options2.fn(group);
234
+ }
235
+ return result;
236
+ };
237
+ var withSort = function(array, prop, options2) {
238
+ let sortProp;
239
+ let opts = options2;
240
+ if (typeof prop === "object" && prop !== null && !Array.isArray(prop)) {
241
+ opts = prop;
242
+ } else if (typeof prop === "string") {
243
+ sortProp = prop;
244
+ }
245
+ if (!Array.isArray(array) || !opts || typeof opts.fn !== "function") {
246
+ return "";
247
+ }
248
+ if (array.length === 0) {
249
+ return opts.inverse ? opts.inverse(this) ?? "" : "";
250
+ }
251
+ const sorted = [...array];
252
+ if (sortProp) {
253
+ sorted.sort((a, b) => {
254
+ const aVal = a?.[sortProp];
255
+ const bVal = b?.[sortProp];
256
+ if (aVal === bVal) return 0;
257
+ if (aVal == null) return 1;
258
+ if (bVal == null) return -1;
259
+ if (typeof aVal === "string" && typeof bVal === "string") {
260
+ return aVal.localeCompare(bVal);
261
+ }
262
+ return aVal < bVal ? -1 : 1;
263
+ });
264
+ } else {
265
+ sorted.sort((a, b) => {
266
+ if (a === b) return 0;
267
+ if (a == null) return 1;
268
+ if (b == null) return -1;
269
+ if (typeof a === "string" && typeof b === "string") {
270
+ return a.localeCompare(b);
271
+ }
272
+ return a < b ? -1 : 1;
273
+ });
274
+ }
275
+ const shouldReverse = opts.hash?.reverse === true || opts.hash?.reverse === "true";
276
+ if (shouldReverse) {
277
+ sorted.reverse();
278
+ }
279
+ let result = "";
280
+ for (const item of sorted) {
281
+ result += opts.fn(item);
282
+ }
283
+ return result;
284
+ };
285
+ var filter = function(array, value, options2) {
286
+ if (!Array.isArray(array) || !options2) {
287
+ return options2?.inverse ? options2.inverse(this) ?? "" : "";
288
+ }
289
+ const filtered = array.filter((item) => item === value);
290
+ if (filtered.length > 0 && options2.fn) {
291
+ return options2.fn(this);
292
+ }
293
+ if (filtered.length === 0 && options2.inverse) {
294
+ return options2.inverse(this);
295
+ }
296
+ return "";
297
+ };
298
+ var map = (array, fn) => {
299
+ if (!Array.isArray(array) || typeof fn !== "function") {
300
+ return [];
301
+ }
302
+ return array.map(fn);
303
+ };
304
+ var pluck = (collection, prop) => {
305
+ if (!Array.isArray(collection) || typeof prop !== "string") {
306
+ return [];
307
+ }
308
+ return collection.map((item) => {
309
+ if (item == null || typeof item !== "object") {
310
+ return void 0;
311
+ }
312
+ const parts = prop.split(".");
313
+ let value = item;
314
+ for (const part of parts) {
315
+ if (value == null || typeof value !== "object") {
316
+ return void 0;
317
+ }
318
+ value = value[part];
319
+ }
320
+ return value;
321
+ });
322
+ };
323
+ var reverse = (value) => {
324
+ if (typeof value === "string") {
325
+ return value.split("").reverse().join("");
326
+ }
327
+ if (Array.isArray(value)) {
328
+ return [...value].reverse();
329
+ }
330
+ return void 0;
331
+ };
332
+ var sort = (array, key) => {
333
+ if (!Array.isArray(array)) {
334
+ return [];
335
+ }
336
+ const sorted = [...array];
337
+ if (typeof key === "function") {
338
+ sorted.sort(key);
339
+ } else if (typeof key === "string") {
340
+ sorted.sort((a, b) => {
341
+ const aVal = a?.[key];
342
+ const bVal = b?.[key];
343
+ if (aVal === bVal) return 0;
344
+ if (aVal == null) return 1;
345
+ if (bVal == null) return -1;
346
+ if (typeof aVal === "string" && typeof bVal === "string") {
347
+ return aVal.localeCompare(bVal);
348
+ }
349
+ return aVal < bVal ? -1 : 1;
350
+ });
351
+ } else {
352
+ sorted.sort((a, b) => {
353
+ if (a === b) return 0;
354
+ if (a == null) return 1;
355
+ if (b == null) return -1;
356
+ if (typeof a === "string" && typeof b === "string") {
357
+ return a.localeCompare(b);
358
+ }
359
+ return a < b ? -1 : 1;
360
+ });
361
+ }
362
+ return sorted;
363
+ };
364
+ var sortBy = (array, ...props) => {
365
+ if (!Array.isArray(array) || props.length === 0) {
366
+ return [];
367
+ }
368
+ const sorted = [...array];
369
+ sorted.sort((a, b) => {
370
+ for (const prop of props) {
371
+ const aVal = a?.[prop];
372
+ const bVal = b?.[prop];
373
+ if (aVal === bVal) continue;
374
+ if (aVal == null) return 1;
375
+ if (bVal == null) return -1;
376
+ if (typeof aVal === "string" && typeof bVal === "string") {
377
+ const result = aVal.localeCompare(bVal);
378
+ if (result !== 0) return result;
379
+ } else {
380
+ return aVal < bVal ? -1 : 1;
381
+ }
382
+ }
383
+ return 0;
384
+ });
385
+ return sorted;
386
+ };
387
+ var unique = function(array, options2) {
388
+ if (!Array.isArray(array)) {
389
+ if (!options2) {
390
+ return [];
391
+ }
392
+ return options2.inverse ? options2.inverse(this) ?? "" : "";
393
+ }
394
+ const uniqueArray = [...new Set(array)];
395
+ if (!options2) {
396
+ return uniqueArray;
397
+ }
398
+ if (uniqueArray.length === 0 && options2.inverse) {
399
+ return options2.inverse(this);
400
+ }
401
+ if (uniqueArray.length > 0 && options2.fn) {
402
+ let result = "";
403
+ for (const item of uniqueArray) {
404
+ result += options2.fn(item);
405
+ }
406
+ return result;
407
+ }
408
+ return "";
409
+ };
410
+ var helpers = [
411
+ {
412
+ name: "after",
413
+ category: "array",
414
+ compatibility: ["browser", "nodejs"],
415
+ fn: after
416
+ },
417
+ {
418
+ name: "before",
419
+ category: "array",
420
+ compatibility: ["browser", "nodejs"],
421
+ fn: before
422
+ },
423
+ {
424
+ name: "arrayify",
425
+ category: "array",
426
+ compatibility: ["browser", "nodejs"],
427
+ fn: arrayify
428
+ },
429
+ {
430
+ name: "first",
431
+ category: "array",
432
+ compatibility: ["browser", "nodejs"],
433
+ fn: first
434
+ },
435
+ {
436
+ name: "last",
437
+ category: "array",
438
+ compatibility: ["browser", "nodejs"],
439
+ fn: last
440
+ },
441
+ {
442
+ name: "length",
443
+ category: "array",
444
+ compatibility: ["browser", "nodejs"],
445
+ fn: length
446
+ },
447
+ {
448
+ name: "join",
449
+ category: "array",
450
+ compatibility: ["browser", "nodejs"],
451
+ fn: join
452
+ },
453
+ {
454
+ name: "forEach",
455
+ category: "array",
456
+ compatibility: ["browser", "nodejs"],
457
+ fn: forEach
458
+ },
459
+ {
460
+ name: "inArray",
461
+ category: "array",
462
+ compatibility: ["browser", "nodejs"],
463
+ fn: inArray
464
+ },
465
+ {
466
+ name: "isArray",
467
+ category: "array",
468
+ compatibility: ["browser", "nodejs"],
469
+ fn: isArray
470
+ },
471
+ {
472
+ name: "itemAt",
473
+ category: "array",
474
+ compatibility: ["browser", "nodejs"],
475
+ fn: itemAt
476
+ },
477
+ {
478
+ name: "equalsLength",
479
+ category: "array",
480
+ compatibility: ["browser", "nodejs"],
481
+ fn: equalsLength
482
+ },
483
+ {
484
+ name: "some",
485
+ category: "array",
486
+ compatibility: ["browser", "nodejs"],
487
+ fn: some
488
+ },
489
+ {
490
+ name: "eachIndex",
491
+ category: "array",
492
+ compatibility: ["browser", "nodejs"],
493
+ fn: eachIndex
494
+ },
495
+ {
496
+ name: "withAfter",
497
+ category: "array",
498
+ compatibility: ["browser", "nodejs"],
499
+ fn: withAfter
500
+ },
501
+ {
502
+ name: "withBefore",
503
+ category: "array",
504
+ compatibility: ["browser", "nodejs"],
505
+ fn: withBefore
506
+ },
507
+ {
508
+ name: "withFirst",
509
+ category: "array",
510
+ compatibility: ["browser", "nodejs"],
511
+ fn: withFirst
512
+ },
513
+ {
514
+ name: "withLast",
515
+ category: "array",
516
+ compatibility: ["browser", "nodejs"],
517
+ fn: withLast
518
+ },
519
+ {
520
+ name: "withGroup",
521
+ category: "array",
522
+ compatibility: ["browser", "nodejs"],
523
+ fn: withGroup
524
+ },
525
+ {
526
+ name: "withSort",
527
+ category: "array",
528
+ compatibility: ["browser", "nodejs"],
529
+ fn: withSort
530
+ },
531
+ {
532
+ name: "filter",
533
+ category: "array",
534
+ compatibility: ["browser", "nodejs"],
535
+ fn: filter
536
+ },
537
+ {
538
+ name: "map",
539
+ category: "array",
540
+ compatibility: ["browser", "nodejs"],
541
+ fn: map
542
+ },
543
+ {
544
+ name: "pluck",
545
+ category: "array",
546
+ compatibility: ["browser", "nodejs"],
547
+ fn: pluck
548
+ },
549
+ {
550
+ name: "reverse",
551
+ category: "array",
552
+ compatibility: ["browser", "nodejs"],
553
+ fn: reverse
554
+ },
555
+ {
556
+ name: "sort",
557
+ category: "array",
558
+ compatibility: ["browser", "nodejs"],
559
+ fn: sort
560
+ },
561
+ {
562
+ name: "sortBy",
563
+ category: "array",
564
+ compatibility: ["browser", "nodejs"],
565
+ fn: sortBy
566
+ },
567
+ {
568
+ name: "unique",
569
+ category: "array",
570
+ compatibility: ["browser", "nodejs"],
571
+ fn: unique
572
+ }
573
+ ];
574
+
575
+ // src/helpers/code.ts
576
+ import fs from "fs";
577
+ import path from "path";
578
+ import tag from "html-tag";
579
+ import codeBlock from "to-gfm-code-block";
580
+ var embed = (filepath, language) => {
581
+ let ext = typeof language === "string" ? language : path.extname(filepath).slice(1);
582
+ let code = fs.readFileSync(filepath, "utf8");
583
+ if (ext === "markdown" || ext === "md") {
584
+ ext = "markdown";
585
+ code = code.split("`").join("&#x60");
586
+ }
587
+ return `${codeBlock(code, ext).trim()}
588
+ `;
589
+ };
590
+ var gist = (id) => {
591
+ return tag("script", { src: `https://gist.github.com/${id}.js` });
592
+ };
593
+ var jsfiddle = (options2) => {
594
+ if (!options2 || !options2.id) {
595
+ throw new Error("jsfiddle helper expects an `id`");
596
+ }
597
+ const {
598
+ id,
599
+ width = "100%",
600
+ height = "300",
601
+ skin = "/presentation/",
602
+ tabs = "result,js,html,css",
603
+ allowfullscreen = "allowfullscreen",
604
+ frameborder = "0"
605
+ } = options2;
606
+ const src = `http://jsfiddle.net/${id}/embedded/${tabs}${skin}`;
607
+ return tag("iframe", { width, height, src, allowfullscreen, frameborder });
608
+ };
609
+ var helpers2 = [
610
+ {
611
+ name: "embed",
612
+ category: "code",
613
+ compatibility: ["nodejs"],
614
+ fn: embed
615
+ },
616
+ {
617
+ name: "gist",
618
+ category: "code",
619
+ compatibility: ["browser", "nodejs"],
620
+ fn: gist
621
+ },
622
+ {
623
+ name: "jsfiddle",
624
+ category: "code",
625
+ compatibility: ["browser", "nodejs"],
626
+ fn: jsfiddle
627
+ }
628
+ ];
629
+
630
+ // src/helpers/collection.ts
631
+ var isEmpty = (collection) => {
632
+ if (collection == null) return true;
633
+ if (Array.isArray(collection)) return collection.length === 0;
634
+ if (typeof collection === "object")
635
+ return Object.keys(collection).length === 0;
636
+ return false;
637
+ };
638
+ var iterate = (collection, fn, inverse) => {
639
+ if (Array.isArray(collection)) {
640
+ let result = "";
641
+ for (let i = 0; i < collection.length; i++) {
642
+ result += fn(collection[i], i);
643
+ }
644
+ return result;
645
+ }
646
+ if (collection && typeof collection === "object") {
647
+ let result = "";
648
+ for (const key of Object.keys(collection)) {
649
+ result += fn(collection[key], key);
650
+ }
651
+ return result;
652
+ }
653
+ return inverse ? inverse() : "";
654
+ };
655
+ var helpers3 = [
656
+ {
657
+ name: "isEmpty",
658
+ category: "collection",
659
+ compatibility: ["browser", "nodejs"],
660
+ fn: isEmpty
661
+ },
662
+ {
663
+ name: "iterate",
664
+ category: "collection",
665
+ compatibility: ["browser", "nodejs"],
666
+ fn: iterate
667
+ }
668
+ ];
669
+
670
+ // src/helpers/comparison.ts
671
+ var and = (...values) => values.every(Boolean);
672
+ var compare = (a, operator, b) => {
673
+ switch (operator) {
674
+ case "==":
675
+ return a == b;
676
+ case "===":
677
+ return a === b;
678
+ case "!=":
679
+ return a != b;
680
+ case "!==":
681
+ return a !== b;
682
+ case "<":
683
+ return a < b;
684
+ case ">":
685
+ return a > b;
686
+ case "<=":
687
+ return a <= b;
688
+ case ">=":
689
+ return a >= b;
690
+ case "typeof":
691
+ return typeof a === b;
692
+ default:
693
+ throw new Error(`helper {{compare}}: invalid operator: '${operator}'`);
694
+ }
695
+ };
696
+ var contains = (collection, value, startIndex = 0) => {
697
+ if (collection == null) return false;
698
+ if (typeof collection === "string" || Array.isArray(collection)) {
699
+ return collection.indexOf(value, startIndex) > -1;
700
+ }
701
+ if (typeof collection === "object") {
702
+ return value in collection;
703
+ }
704
+ return false;
705
+ };
706
+ var defaultHelper = (...values) => {
707
+ for (const val of values) {
708
+ if (val != null) return val;
709
+ }
710
+ return "";
711
+ };
712
+ var eq = (a, b) => a === b;
713
+ var gt = (a, b) => a > b;
714
+ var gte = (a, b) => a >= b;
715
+ var has = (value, pattern) => {
716
+ if (value == null || pattern == null) return false;
717
+ if (Array.isArray(value) || typeof value === "string") {
718
+ return value.indexOf(pattern) > -1;
719
+ }
720
+ if (typeof value === "object") {
721
+ return pattern in value;
722
+ }
723
+ return false;
724
+ };
725
+ var falsey = (val, keywords) => {
726
+ if (!val) return true;
727
+ const words = Array.isArray(keywords) ? keywords : keywords != null ? [keywords] : [
728
+ "0",
729
+ "false",
730
+ "nada",
731
+ "nil",
732
+ "nay",
733
+ "nah",
734
+ "negative",
735
+ "no",
736
+ "none",
737
+ "nope",
738
+ "nul",
739
+ "null",
740
+ "nix",
741
+ "nyet",
742
+ "uh-uh",
743
+ "veto",
744
+ "zero"
745
+ ];
746
+ const lower = typeof val === "string" ? val.toLowerCase() : null;
747
+ for (const word of words) {
748
+ if (word === val) return true;
749
+ if (lower != null && word === lower) return true;
750
+ }
751
+ return false;
752
+ };
753
+ var isFalsey = (val) => falsey(val);
754
+ var isTruthy = (val) => !falsey(val);
755
+ var ifEven = (num) => typeof num === "number" && num % 2 === 0;
756
+ var ifNth = (a, b) => typeof a === "number" && typeof b === "number" && b % a === 0;
757
+ var ifOdd = (val) => typeof val === "number" && Math.abs(val % 2) === 1;
758
+ var is = (a, b) => a == b;
759
+ var isnt = (a, b) => a != b;
760
+ var lt = (a, b) => a < b;
761
+ var lte = (a, b) => a <= b;
762
+ var neither = (a, b) => !a && !b;
763
+ var not = (val) => !val;
764
+ var or = (...values) => values.some(Boolean);
765
+ var unlessEq = (a, b) => a !== b;
766
+ var unlessGt = (a, b) => a <= b;
767
+ var unlessLt = (a, b) => a >= b;
768
+ var unlessGteq = (a, b) => a < b;
769
+ var unlessLteq = (a, b) => a > b;
770
+ var helpers4 = [
771
+ {
772
+ name: "and",
773
+ category: "comparison",
774
+ compatibility: ["browser", "nodejs"],
775
+ fn: and
776
+ },
777
+ {
778
+ name: "compare",
779
+ category: "comparison",
780
+ compatibility: ["browser", "nodejs"],
781
+ fn: compare
782
+ },
783
+ {
784
+ name: "contains",
785
+ category: "comparison",
786
+ compatibility: ["browser", "nodejs"],
787
+ fn: contains
788
+ },
789
+ {
790
+ name: "default",
791
+ category: "comparison",
792
+ compatibility: ["browser", "nodejs"],
793
+ fn: defaultHelper
794
+ },
795
+ {
796
+ name: "eq",
797
+ category: "comparison",
798
+ compatibility: ["browser", "nodejs"],
799
+ fn: eq
800
+ },
801
+ {
802
+ name: "gt",
803
+ category: "comparison",
804
+ compatibility: ["browser", "nodejs"],
805
+ fn: gt
806
+ },
807
+ {
808
+ name: "gte",
809
+ category: "comparison",
810
+ compatibility: ["browser", "nodejs"],
811
+ fn: gte
812
+ },
813
+ {
814
+ name: "has",
815
+ category: "comparison",
816
+ compatibility: ["browser", "nodejs"],
817
+ fn: has
818
+ },
819
+ {
820
+ name: "isFalsey",
821
+ category: "comparison",
822
+ compatibility: ["browser", "nodejs"],
823
+ fn: isFalsey
824
+ },
825
+ {
826
+ name: "isTruthy",
827
+ category: "comparison",
828
+ compatibility: ["browser", "nodejs"],
829
+ fn: isTruthy
830
+ },
831
+ {
832
+ name: "ifEven",
833
+ category: "comparison",
834
+ compatibility: ["browser", "nodejs"],
835
+ fn: ifEven
836
+ },
837
+ {
838
+ name: "ifNth",
839
+ category: "comparison",
840
+ compatibility: ["browser", "nodejs"],
841
+ fn: ifNth
842
+ },
843
+ {
844
+ name: "ifOdd",
845
+ category: "comparison",
846
+ compatibility: ["browser", "nodejs"],
847
+ fn: ifOdd
848
+ },
849
+ {
850
+ name: "is",
851
+ category: "comparison",
852
+ compatibility: ["browser", "nodejs"],
853
+ fn: is
854
+ },
855
+ {
856
+ name: "isnt",
857
+ category: "comparison",
858
+ compatibility: ["browser", "nodejs"],
859
+ fn: isnt
860
+ },
861
+ {
862
+ name: "lt",
863
+ category: "comparison",
864
+ compatibility: ["browser", "nodejs"],
865
+ fn: lt
866
+ },
867
+ {
868
+ name: "lte",
869
+ category: "comparison",
870
+ compatibility: ["browser", "nodejs"],
871
+ fn: lte
872
+ },
873
+ {
874
+ name: "neither",
875
+ category: "comparison",
876
+ compatibility: ["browser", "nodejs"],
877
+ fn: neither
878
+ },
879
+ {
880
+ name: "not",
881
+ category: "comparison",
882
+ compatibility: ["browser", "nodejs"],
883
+ fn: not
884
+ },
885
+ {
886
+ name: "or",
887
+ category: "comparison",
888
+ compatibility: ["browser", "nodejs"],
889
+ fn: or
890
+ },
891
+ {
892
+ name: "unlessEq",
893
+ category: "comparison",
894
+ compatibility: ["browser", "nodejs"],
895
+ fn: unlessEq
896
+ },
897
+ {
898
+ name: "unlessGt",
899
+ category: "comparison",
900
+ compatibility: ["browser", "nodejs"],
901
+ fn: unlessGt
902
+ },
903
+ {
904
+ name: "unlessLt",
905
+ category: "comparison",
906
+ compatibility: ["browser", "nodejs"],
907
+ fn: unlessLt
908
+ },
909
+ {
910
+ name: "unlessGteq",
911
+ category: "comparison",
912
+ compatibility: ["browser", "nodejs"],
913
+ fn: unlessGteq
914
+ },
915
+ {
916
+ name: "unlessLteq",
917
+ category: "comparison",
918
+ compatibility: ["browser", "nodejs"],
919
+ fn: unlessLteq
920
+ }
921
+ ];
922
+
923
+ // src/helpers/date.ts
924
+ import { parseDate } from "chrono-node";
925
+ import dayjs from "dayjs";
926
+ import isBetween from "dayjs/plugin/isBetween.js";
927
+ import relativeTime from "dayjs/plugin/relativeTime.js";
928
+ import timezone from "dayjs/plugin/timezone.js";
929
+ import utc from "dayjs/plugin/utc.js";
930
+ dayjs.extend(relativeTime);
931
+ dayjs.extend(isBetween);
932
+ dayjs.extend(utc);
933
+ dayjs.extend(timezone);
934
+ var parseDateInput = (input) => {
935
+ if (!input) {
936
+ return dayjs();
937
+ }
938
+ if (typeof input === "string") {
939
+ const parsed = parseDate(input);
940
+ if (parsed) {
941
+ return dayjs(parsed);
942
+ }
943
+ return dayjs(input);
944
+ }
945
+ return dayjs(input);
946
+ };
947
+ var year = () => (/* @__PURE__ */ new Date()).getFullYear().toString();
948
+ var convertFormatString = (format2) => {
949
+ return format2.replace(/yyyy/g, "YYYY").replace(/yy/g, "YY").replace(/dd/g, "DD").replace(/mm/g, "MM").replace(/hh/g, "HH");
950
+ };
951
+ var date = (humanReadableDate, formatString) => {
952
+ const defaultFormat = "YYYY-MM-DD";
953
+ const format2 = formatString || defaultFormat;
954
+ const parsedDate = parseDateInput(humanReadableDate);
955
+ if (!parsedDate.isValid()) {
956
+ throw new Error(`Unable to parse date: ${humanReadableDate}`);
957
+ }
958
+ const convertedFormat = convertFormatString(format2);
959
+ return parsedDate.format(convertedFormat);
960
+ };
961
+ var timestamp = () => {
962
+ return Date.now().toString();
963
+ };
964
+ var now = (formatString) => {
965
+ const defaultFormat = "YYYY-MM-DD HH:mm:ss";
966
+ const format2 = formatString || defaultFormat;
967
+ const convertedFormat = convertFormatString(format2);
968
+ return dayjs().format(convertedFormat);
969
+ };
970
+ var fromNow = (dateInput) => {
971
+ const parsed = parseDateInput(dateInput);
972
+ if (!parsed.isValid()) {
973
+ throw new Error(`Unable to parse date: ${dateInput}`);
974
+ }
975
+ return parsed.fromNow();
976
+ };
977
+ var toNow = (dateInput) => {
978
+ const parsed = parseDateInput(dateInput);
979
+ if (!parsed.isValid()) {
980
+ throw new Error(`Unable to parse date: ${dateInput}`);
981
+ }
982
+ return parsed.toNow();
983
+ };
984
+ var ago = (dateInput) => {
985
+ return fromNow(dateInput);
986
+ };
987
+ var dateAdd = (dateInput, amount, unit) => {
988
+ const parsed = parseDateInput(dateInput);
989
+ if (!parsed.isValid()) {
990
+ throw new Error(`Unable to parse date: ${dateInput}`);
991
+ }
992
+ return parsed.add(amount, unit).format("YYYY-MM-DD HH:mm:ss");
993
+ };
994
+ var dateSubtract = (dateInput, amount, unit) => {
995
+ const parsed = parseDateInput(dateInput);
996
+ if (!parsed.isValid()) {
997
+ throw new Error(`Unable to parse date: ${dateInput}`);
998
+ }
999
+ return parsed.subtract(amount, unit).format("YYYY-MM-DD HH:mm:ss");
1000
+ };
1001
+ var startOf = (dateInput, unit) => {
1002
+ const parsed = parseDateInput(dateInput);
1003
+ if (!parsed.isValid()) {
1004
+ throw new Error(`Unable to parse date: ${dateInput}`);
1005
+ }
1006
+ return parsed.startOf(unit).format("YYYY-MM-DD HH:mm:ss");
1007
+ };
1008
+ var endOf = (dateInput, unit) => {
1009
+ const parsed = parseDateInput(dateInput);
1010
+ if (!parsed.isValid()) {
1011
+ throw new Error(`Unable to parse date: ${dateInput}`);
1012
+ }
1013
+ return parsed.endOf(unit).format("YYYY-MM-DD HH:mm:ss");
1014
+ };
1015
+ var isBefore = (date1, date2) => {
1016
+ const parsed1 = parseDateInput(date1);
1017
+ const parsed2 = parseDateInput(date2);
1018
+ if (!parsed1.isValid() || !parsed2.isValid()) {
1019
+ throw new Error(`Unable to parse dates: ${date1}, ${date2}`);
1020
+ }
1021
+ return parsed1.isBefore(parsed2);
1022
+ };
1023
+ var isAfter = (date1, date2) => {
1024
+ const parsed1 = parseDateInput(date1);
1025
+ const parsed2 = parseDateInput(date2);
1026
+ if (!parsed1.isValid() || !parsed2.isValid()) {
1027
+ throw new Error(`Unable to parse dates: ${date1}, ${date2}`);
1028
+ }
1029
+ return parsed1.isAfter(parsed2);
1030
+ };
1031
+ var isSame = (date1, date2, unit) => {
1032
+ const parsed1 = parseDateInput(date1);
1033
+ const parsed2 = parseDateInput(date2);
1034
+ if (!parsed1.isValid() || !parsed2.isValid()) {
1035
+ throw new Error(`Unable to parse dates: ${date1}, ${date2}`);
1036
+ }
1037
+ return parsed1.isSame(parsed2, unit);
1038
+ };
1039
+ var isBetweenDates = (dateInput, startDate, endDate) => {
1040
+ const parsed = parseDateInput(dateInput);
1041
+ const parsedStart = parseDateInput(startDate);
1042
+ const parsedEnd = parseDateInput(endDate);
1043
+ if (!parsed.isValid() || !parsedStart.isValid() || !parsedEnd.isValid()) {
1044
+ throw new Error(
1045
+ `Unable to parse dates: ${dateInput}, ${startDate}, ${endDate}`
1046
+ );
1047
+ }
1048
+ return parsed.isBetween(parsedStart, parsedEnd, null, "[]");
1049
+ };
1050
+ var diff = (date1, date2, unit) => {
1051
+ const parsed1 = parseDateInput(date1);
1052
+ const parsed2 = parseDateInput(date2);
1053
+ if (!parsed1.isValid() || !parsed2.isValid()) {
1054
+ throw new Error(`Unable to parse dates: ${date1}, ${date2}`);
1055
+ }
1056
+ return parsed1.diff(parsed2, unit);
1057
+ };
1058
+ var toISOString = (dateInput) => {
1059
+ const parsed = parseDateInput(dateInput);
1060
+ if (!parsed.isValid()) {
1061
+ throw new Error(`Unable to parse date: ${dateInput}`);
1062
+ }
1063
+ return parsed.toISOString();
1064
+ };
1065
+ var dateTimezone = (dateInput, timezoneStr, formatString) => {
1066
+ const defaultFormat = "YYYY-MM-DD HH:mm:ss";
1067
+ const format2 = formatString || defaultFormat;
1068
+ const convertedFormat = convertFormatString(format2);
1069
+ const parsed = parseDateInput(dateInput);
1070
+ if (!parsed.isValid()) {
1071
+ throw new Error(`Unable to parse date: ${dateInput}`);
1072
+ }
1073
+ return parsed.tz(timezoneStr).format(convertedFormat);
1074
+ };
1075
+ var dateLocale = (dateInput, locale, formatString) => {
1076
+ const defaultFormat = "YYYY-MM-DD HH:mm:ss";
1077
+ const format2 = formatString || defaultFormat;
1078
+ const convertedFormat = convertFormatString(format2);
1079
+ const parsed = parseDateInput(dateInput);
1080
+ if (!parsed.isValid()) {
1081
+ throw new Error(`Unable to parse date: ${dateInput}`);
1082
+ }
1083
+ return parsed.locale(locale).format(convertedFormat);
1084
+ };
1085
+ var helpers5 = [
1086
+ {
1087
+ name: "year",
1088
+ category: "date",
1089
+ compatibility: ["browser", "nodejs"],
1090
+ fn: year
1091
+ },
1092
+ {
1093
+ name: "date",
1094
+ category: "date",
1095
+ compatibility: ["browser", "nodejs"],
1096
+ fn: date
1097
+ },
1098
+ {
1099
+ /* Adding this in for legacy support */
1100
+ name: "moment",
1101
+ category: "date",
1102
+ compatibility: ["browser", "nodejs"],
1103
+ fn: date
1104
+ },
1105
+ {
1106
+ name: "timestamp",
1107
+ category: "date",
1108
+ compatibility: ["browser", "nodejs"],
1109
+ fn: timestamp
1110
+ },
1111
+ {
1112
+ name: "now",
1113
+ category: "date",
1114
+ compatibility: ["browser", "nodejs"],
1115
+ fn: now
1116
+ },
1117
+ {
1118
+ name: "fromNow",
1119
+ category: "date",
1120
+ compatibility: ["browser", "nodejs"],
1121
+ fn: fromNow
1122
+ },
1123
+ {
1124
+ name: "toNow",
1125
+ category: "date",
1126
+ compatibility: ["browser", "nodejs"],
1127
+ fn: toNow
1128
+ },
1129
+ {
1130
+ name: "ago",
1131
+ category: "date",
1132
+ compatibility: ["browser", "nodejs"],
1133
+ fn: ago
1134
+ },
1135
+ {
1136
+ name: "dateAdd",
1137
+ category: "date",
1138
+ compatibility: ["browser", "nodejs"],
1139
+ fn: dateAdd
1140
+ },
1141
+ {
1142
+ name: "dateSubtract",
1143
+ category: "date",
1144
+ compatibility: ["browser", "nodejs"],
1145
+ fn: dateSubtract
1146
+ },
1147
+ {
1148
+ name: "startOf",
1149
+ category: "date",
1150
+ compatibility: ["browser", "nodejs"],
1151
+ fn: startOf
1152
+ },
1153
+ {
1154
+ name: "endOf",
1155
+ category: "date",
1156
+ compatibility: ["browser", "nodejs"],
1157
+ fn: endOf
1158
+ },
1159
+ {
1160
+ name: "isBefore",
1161
+ category: "date",
1162
+ compatibility: ["browser", "nodejs"],
1163
+ fn: isBefore
1164
+ },
1165
+ {
1166
+ name: "isAfter",
1167
+ category: "date",
1168
+ compatibility: ["browser", "nodejs"],
1169
+ fn: isAfter
1170
+ },
1171
+ {
1172
+ name: "isSame",
1173
+ category: "date",
1174
+ compatibility: ["browser", "nodejs"],
1175
+ fn: isSame
1176
+ },
1177
+ {
1178
+ name: "isBetween",
1179
+ category: "date",
1180
+ compatibility: ["browser", "nodejs"],
1181
+ fn: isBetweenDates
1182
+ },
1183
+ {
1184
+ name: "diff",
1185
+ category: "date",
1186
+ compatibility: ["browser", "nodejs"],
1187
+ fn: diff
1188
+ },
1189
+ {
1190
+ name: "toISOString",
1191
+ category: "date",
1192
+ compatibility: ["browser", "nodejs"],
1193
+ fn: toISOString
1194
+ },
1195
+ {
1196
+ name: "dateTimezone",
1197
+ category: "date",
1198
+ compatibility: ["browser", "nodejs"],
1199
+ fn: dateTimezone
1200
+ },
1201
+ {
1202
+ name: "dateLocale",
1203
+ category: "date",
1204
+ compatibility: ["browser", "nodejs"],
1205
+ fn: dateLocale
1206
+ }
1207
+ ];
1208
+
1209
+ // src/helpers/fs.ts
1210
+ import fs2 from "fs";
1211
+ import path2 from "path";
1212
+ import isGlob from "is-glob";
1213
+ import micromatch from "micromatch";
1214
+ var fileSize = (value, precision) => {
1215
+ if (value == null) return "0 B";
1216
+ const number = typeof value === "number" ? value : value.length ?? 0;
1217
+ if (!number) return "0 B";
1218
+ const precisionNumber = typeof precision === "number" ? precision : 2;
1219
+ const abbr = ["B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
1220
+ const factor = 10 ** precisionNumber;
1221
+ let i = abbr.length - 1;
1222
+ do {
1223
+ const size = 10 ** (i * 3);
1224
+ if (size <= number + 1) {
1225
+ const num = Math.round(number * factor / size) / factor;
1226
+ return `${num} ${abbr[i]}`;
1227
+ }
1228
+ } while (--i >= 0);
1229
+ return `${number} B`;
1230
+ };
1231
+ var read = (filepath) => {
1232
+ return fs2.readFileSync(filepath, "utf8");
1233
+ };
1234
+ var isOptions = (value) => {
1235
+ return Boolean(
1236
+ value && typeof value === "object" && "hash" in value
1237
+ );
1238
+ };
1239
+ var readdir = (dir, filter2) => {
1240
+ const files = fs2.readdirSync(dir).map((fp) => path2.join(dir, fp));
1241
+ const filterArg = isOptions(filter2) ? void 0 : filter2;
1242
+ if (typeof filterArg === "function") {
1243
+ return filterArg(files);
1244
+ }
1245
+ if (filterArg instanceof RegExp) {
1246
+ return files.filter((fp) => filterArg.test(fp));
1247
+ }
1248
+ if (typeof filterArg === "string") {
1249
+ if (isGlob(filterArg)) {
1250
+ return micromatch(files, filterArg);
1251
+ }
1252
+ if (filterArg === "isFile" || filterArg === "isDirectory") {
1253
+ return files.filter((fp) => {
1254
+ const stat = fs2.statSync(fp);
1255
+ return filterArg === "isFile" ? stat.isFile() : stat.isDirectory();
1256
+ });
1257
+ }
1258
+ }
1259
+ return files;
1260
+ };
1261
+ var helpers6 = [
1262
+ {
1263
+ name: "fileSize",
1264
+ category: "fs",
1265
+ compatibility: ["nodejs"],
1266
+ fn: fileSize
1267
+ },
1268
+ {
1269
+ name: "read",
1270
+ category: "fs",
1271
+ compatibility: ["nodejs"],
1272
+ fn: read
1273
+ },
1274
+ {
1275
+ name: "readdir",
1276
+ category: "fs",
1277
+ compatibility: ["nodejs"],
1278
+ fn: readdir
1279
+ }
1280
+ ];
1281
+
1282
+ // src/helpers/html.ts
1283
+ import path3 from "path";
1284
+ import tag2 from "html-tag";
1285
+ import striptags from "striptags";
1286
+ var parseAttributes = (hash = {}) => Object.keys(hash).map((key) => `${key}="${String(hash[key]).replace(/^['"]|["']$/g, "")}"`).join(" ");
1287
+ var attr = (options2) => {
1288
+ const val = parseAttributes(options2?.hash ?? {});
1289
+ return val.trim() ? ` ${val}` : "";
1290
+ };
1291
+ var css = function(list, options2) {
1292
+ if (arguments.length < 2) {
1293
+ options2 = list;
1294
+ list = [];
1295
+ }
1296
+ let styles = arrayify(list ?? []);
1297
+ let assets = "";
1298
+ if (this && this.options) {
1299
+ assets = this.options.assets || "";
1300
+ }
1301
+ if (options2?.hash?.href) {
1302
+ styles = arrayify(options2.hash.href);
1303
+ }
1304
+ return styles.map((item) => {
1305
+ const ext = path3.extname(item);
1306
+ let fp = item;
1307
+ if (!/(^\/\/)|(:\/\/)/.test(item)) {
1308
+ fp = path3.posix.join(assets, item);
1309
+ }
1310
+ if (ext === ".less") {
1311
+ return `<link type="text/css" rel="stylesheet/less" href="${fp}">`;
1312
+ }
1313
+ return `<link type="text/css" rel="stylesheet" href="${fp}">`;
1314
+ }).join("\n");
1315
+ };
1316
+ var js = (context) => {
1317
+ if (context && typeof context === "object" && !Array.isArray(context)) {
1318
+ const attrStr = parseAttributes(context.hash ?? {});
1319
+ return `<script${attrStr ? ` ${attrStr}` : ""}></script>`;
1320
+ }
1321
+ if (typeof context === "string") {
1322
+ return `<script src="${context}"></script>`;
1323
+ }
1324
+ const items = arrayify(context);
1325
+ return items.map(
1326
+ (fp) => path3.extname(fp) === ".coffee" ? tag2("script", { type: "text/coffeescript", src: fp }) : tag2("script", { src: fp })
1327
+ ).join("\n");
1328
+ };
1329
+ var sanitize = (str) => {
1330
+ if (typeof str !== "string") return "";
1331
+ return striptags(str).trim();
1332
+ };
1333
+ var ul = (context, options2) => {
1334
+ const attrs = parseAttributes(options2.hash ?? {});
1335
+ const items = context.map(
1336
+ (item) => typeof item === "string" ? item : options2.fn(item)
1337
+ );
1338
+ const open = attrs ? `<ul ${attrs}>` : "<ul>";
1339
+ return `${open}${items.map((i) => `<li>${i}</li>`).join("\n")}</ul>`;
1340
+ };
1341
+ var ol = (context, options2) => {
1342
+ const attrs = parseAttributes(options2.hash ?? {});
1343
+ const items = context.map(
1344
+ (item) => typeof item === "string" ? item : options2.fn(item)
1345
+ );
1346
+ const open = attrs ? `<ol ${attrs}>` : "<ol>";
1347
+ return `${open}${items.map((i) => `<li>${i}</li>`).join("\n")}</ol>`;
1348
+ };
1349
+ var thumbnailImage = (context) => {
1350
+ let figure = "";
1351
+ let image = "";
1352
+ const link = context.full || false;
1353
+ const imageAttributes = {
1354
+ alt: context.alt,
1355
+ src: context.thumbnail,
1356
+ width: context.size.width,
1357
+ height: context.size.height
1358
+ };
1359
+ const figureAttributes = { id: `image-${context.id}` };
1360
+ const linkAttributes = { href: link, rel: "thumbnail" };
1361
+ if (context.classes) {
1362
+ if (context.classes.image) {
1363
+ imageAttributes.class = context.classes.image.join(" ");
1364
+ }
1365
+ if (context.classes.figure) {
1366
+ figureAttributes.class = context.classes.figure.join(" ");
1367
+ }
1368
+ if (context.classes.link) {
1369
+ linkAttributes.class = context.classes.link.join(" ");
1370
+ }
1371
+ }
1372
+ figure += `<figure ${parseAttributes(figureAttributes)}>
1373
+ `;
1374
+ image += `<img ${parseAttributes(imageAttributes)}>
1375
+ `;
1376
+ if (link) {
1377
+ figure += `<a ${parseAttributes(linkAttributes)}>
1378
+ ${image}</a>
1379
+ `;
1380
+ } else {
1381
+ figure += image;
1382
+ }
1383
+ if (context.caption) {
1384
+ figure += `<figcaption>${context.caption}</figcaption>
1385
+ `;
1386
+ }
1387
+ figure += "</figure>";
1388
+ return figure;
1389
+ };
1390
+ var helpers7 = [
1391
+ {
1392
+ name: "attr",
1393
+ category: "html",
1394
+ compatibility: ["browser", "nodejs"],
1395
+ fn: attr
1396
+ },
1397
+ {
1398
+ name: "css",
1399
+ category: "html",
1400
+ compatibility: ["nodejs"],
1401
+ fn: css
1402
+ },
1403
+ {
1404
+ name: "js",
1405
+ category: "html",
1406
+ compatibility: ["nodejs"],
1407
+ fn: js
1408
+ },
1409
+ {
1410
+ name: "sanitize",
1411
+ category: "html",
1412
+ compatibility: ["browser", "nodejs"],
1413
+ fn: sanitize
1414
+ },
1415
+ {
1416
+ name: "ul",
1417
+ category: "html",
1418
+ compatibility: ["browser", "nodejs"],
1419
+ fn: ul
1420
+ },
1421
+ {
1422
+ name: "ol",
1423
+ category: "html",
1424
+ compatibility: ["browser", "nodejs"],
1425
+ fn: ol
1426
+ },
1427
+ {
1428
+ name: "thumbnailImage",
1429
+ category: "html",
1430
+ compatibility: ["browser", "nodejs"],
1431
+ fn: thumbnailImage
1432
+ }
1433
+ ];
1434
+
1435
+ // src/utils.ts
1436
+ var get = (object, path6) => {
1437
+ if (!object || typeof object !== "object") return void 0;
1438
+ const keys = Array.isArray(path6) ? path6 : path6.split(".");
1439
+ let result = object;
1440
+ for (const key of keys) {
1441
+ if (result == null || typeof result !== "object") return void 0;
1442
+ result = result[key];
1443
+ }
1444
+ return result;
1445
+ };
1446
+ var getObject = (object, path6) => {
1447
+ if (!object || typeof object !== "object") return void 0;
1448
+ const keys = Array.isArray(path6) ? path6 : path6.split(".");
1449
+ if (keys.length === 0) return void 0;
1450
+ let current = object;
1451
+ for (let i = 0; i < keys.length - 1; i++) {
1452
+ if (current == null || typeof current !== "object") return void 0;
1453
+ current = current[keys[i]];
1454
+ }
1455
+ const finalKey = keys[keys.length - 1];
1456
+ if (current == null || typeof current !== "object" || !(finalKey in current)) {
1457
+ return void 0;
1458
+ }
1459
+ return { [finalKey]: current[finalKey] };
1460
+ };
1461
+ var options = (thisArg, locals, opts) => {
1462
+ const result = {};
1463
+ if (thisArg && typeof thisArg === "object" && thisArg.options) {
1464
+ Object.assign(result, thisArg.options);
1465
+ }
1466
+ if (locals && typeof locals === "object") {
1467
+ if ("hash" in locals) {
1468
+ Object.assign(result, locals.hash);
1469
+ } else {
1470
+ Object.assign(result, locals);
1471
+ }
1472
+ }
1473
+ if (opts && typeof opts === "object") {
1474
+ if ("hash" in opts) {
1475
+ Object.assign(result, opts.hash);
1476
+ } else {
1477
+ Object.assign(result, opts);
1478
+ }
1479
+ }
1480
+ return result;
1481
+ };
1482
+
1483
+ // src/helpers/i18n.ts
1484
+ var i18n = function(prop, locals, options2) {
1485
+ if (locals && typeof locals === "object" && "hash" in locals && options2 === void 0) {
1486
+ options2 = locals;
1487
+ locals = {};
1488
+ }
1489
+ if (typeof prop !== "string") {
1490
+ throw new Error('{{i18n}} helper expected "key" to be a string');
1491
+ }
1492
+ const context = {
1493
+ ...this,
1494
+ ...locals,
1495
+ ...options2?.hash ?? {}
1496
+ };
1497
+ const lang = context.language || context.lang;
1498
+ if (typeof lang !== "string") {
1499
+ throw new TypeError('{{i18n}} helper expected "language" to be a string');
1500
+ }
1501
+ const cache = context[lang];
1502
+ if (typeof cache === "undefined") {
1503
+ throw new Error(`{{i18n}} helper cannot find language "${lang}"`);
1504
+ }
1505
+ const result = get(cache, prop);
1506
+ if (typeof result === "undefined") {
1507
+ throw new Error(
1508
+ '{{i18n}} helper cannot find property "' + String(prop) + '" for language "' + lang + '"'
1509
+ );
1510
+ }
1511
+ return String(result);
1512
+ };
1513
+ var helpers8 = [
1514
+ {
1515
+ name: "i18n",
1516
+ category: "i18n",
1517
+ compatibility: ["browser", "nodejs"],
1518
+ fn: i18n
1519
+ }
1520
+ ];
1521
+
1522
+ // src/helpers/inflection.ts
1523
+ var inflect = (count, singular, plural, includeCount) => {
1524
+ const word = count > 1 || count === 0 ? plural : singular;
1525
+ return includeCount ? `${count} ${word}` : word;
1526
+ };
1527
+ var ordinalize = (value) => {
1528
+ const num = Math.abs(Math.round(Number(value)));
1529
+ const str = String(value);
1530
+ const res = num % 100;
1531
+ if ([11, 12, 13].includes(res)) {
1532
+ return `${str}th`;
1533
+ }
1534
+ switch (num % 10) {
1535
+ case 1:
1536
+ return `${str}st`;
1537
+ case 2:
1538
+ return `${str}nd`;
1539
+ case 3:
1540
+ return `${str}rd`;
1541
+ default:
1542
+ return `${str}th`;
1543
+ }
1544
+ };
1545
+ var helpers9 = [
1546
+ {
1547
+ name: "inflect",
1548
+ category: "inflection",
1549
+ compatibility: ["browser", "nodejs"],
1550
+ fn: inflect
1551
+ },
1552
+ {
1553
+ name: "ordinalize",
1554
+ category: "inflection",
1555
+ compatibility: ["browser", "nodejs"],
1556
+ fn: ordinalize
1557
+ }
1558
+ ];
1559
+
1560
+ // src/helpers/logging.ts
1561
+ var colors = {
1562
+ green: (str) => `\x1B[32m${str}\x1B[0m`,
1563
+ cyan: (str) => `\x1B[36m${str}\x1B[0m`,
1564
+ yellow: (str) => `\x1B[33m${str}\x1B[0m`,
1565
+ red: (str) => `\x1B[31m${str}\x1B[0m`,
1566
+ bold: (str) => `\x1B[1m${str}\x1B[0m`
1567
+ };
1568
+ function cleanArgs(args) {
1569
+ const last2 = args[args.length - 1];
1570
+ if (args.length > 1 && typeof last2 === "object" && last2 !== null && "hash" in last2) {
1571
+ return args.slice(0, -1);
1572
+ }
1573
+ return args;
1574
+ }
1575
+ function log(...args) {
1576
+ const cleanedArgs = cleanArgs(args);
1577
+ console.log(...cleanedArgs);
1578
+ return "";
1579
+ }
1580
+ function ok(...args) {
1581
+ const cleanedArgs = cleanArgs(args);
1582
+ const message = cleanedArgs.join(" ");
1583
+ console.log(colors.green(`\u2713 ${message}`));
1584
+ return "";
1585
+ }
1586
+ function success(...args) {
1587
+ const cleanedArgs = cleanArgs(args);
1588
+ const message = cleanedArgs.map((arg) => String(arg)).join(" ");
1589
+ console.log(colors.green(message));
1590
+ return "";
1591
+ }
1592
+ function info(...args) {
1593
+ const cleanedArgs = cleanArgs(args);
1594
+ const message = cleanedArgs.map((arg) => String(arg)).join(" ");
1595
+ console.log(colors.cyan(message));
1596
+ return "";
1597
+ }
1598
+ function warning(...args) {
1599
+ const cleanedArgs = cleanArgs(args);
1600
+ const message = cleanedArgs.map((arg) => String(arg)).join(" ");
1601
+ console.error(colors.yellow(message));
1602
+ return "";
1603
+ }
1604
+ var warn = warning;
1605
+ function error(...args) {
1606
+ const cleanedArgs = cleanArgs(args);
1607
+ const message = cleanedArgs.map((arg) => String(arg)).join(" ");
1608
+ console.error(colors.red(message));
1609
+ return "";
1610
+ }
1611
+ var danger = error;
1612
+ function bold(...args) {
1613
+ const cleanedArgs = cleanArgs(args);
1614
+ const message = cleanedArgs.map((arg) => String(arg)).join(" ");
1615
+ console.error(colors.bold(message));
1616
+ return "";
1617
+ }
1618
+ function _debug(...args) {
1619
+ const separator = "\u2500".repeat(50);
1620
+ console.error(colors.cyan(separator));
1621
+ if (args.length > 0) {
1622
+ const cleanedArgs = cleanArgs(args);
1623
+ console.error(colors.cyan("VALUE:"), cleanedArgs[0]);
1624
+ }
1625
+ if (this && Object.keys(this).length > 0) {
1626
+ console.error(colors.cyan("CONTEXT:"), this);
1627
+ }
1628
+ console.error(colors.cyan(separator));
1629
+ return "";
1630
+ }
1631
+ function _inspect(context, options2) {
1632
+ const val = JSON.stringify(context, null, 2);
1633
+ const type = options2?.hash?.type || "html";
1634
+ return switchOutput(type, val);
1635
+ }
1636
+ function switchOutput(type, json) {
1637
+ if (type[0] === ".") {
1638
+ type = type.slice(1);
1639
+ }
1640
+ switch (type) {
1641
+ case "md":
1642
+ return `
1643
+ \`\`\`json
1644
+ ${json}
1645
+ \`\`\`
1646
+ `;
1647
+ case "html":
1648
+ return `<div class="highlight highlight-json">
1649
+ <pre><code>
1650
+ ${json}</code></pre></div>`;
1651
+ default:
1652
+ return json;
1653
+ }
1654
+ }
1655
+ var helpers10 = [
1656
+ {
1657
+ name: "log",
1658
+ category: "logging",
1659
+ compatibility: ["nodejs"],
1660
+ fn: log
1661
+ },
1662
+ {
1663
+ name: "ok",
1664
+ category: "logging",
1665
+ compatibility: ["nodejs"],
1666
+ fn: ok
1667
+ },
1668
+ {
1669
+ name: "success",
1670
+ category: "logging",
1671
+ compatibility: ["nodejs"],
1672
+ fn: success
1673
+ },
1674
+ {
1675
+ name: "info",
1676
+ category: "logging",
1677
+ compatibility: ["nodejs"],
1678
+ fn: info
1679
+ },
1680
+ {
1681
+ name: "warning",
1682
+ category: "logging",
1683
+ compatibility: ["nodejs"],
1684
+ fn: warning
1685
+ },
1686
+ {
1687
+ name: "warn",
1688
+ category: "logging",
1689
+ compatibility: ["nodejs"],
1690
+ fn: warn
1691
+ },
1692
+ {
1693
+ name: "error",
1694
+ category: "logging",
1695
+ compatibility: ["nodejs"],
1696
+ fn: error
1697
+ },
1698
+ {
1699
+ name: "danger",
1700
+ category: "logging",
1701
+ compatibility: ["nodejs"],
1702
+ fn: danger
1703
+ },
1704
+ {
1705
+ name: "bold",
1706
+ category: "logging",
1707
+ compatibility: ["nodejs"],
1708
+ fn: bold
1709
+ },
1710
+ {
1711
+ name: "_debug",
1712
+ category: "logging",
1713
+ compatibility: ["nodejs"],
1714
+ fn: _debug
1715
+ },
1716
+ {
1717
+ name: "_inspect",
1718
+ category: "logging",
1719
+ compatibility: ["nodejs"],
1720
+ fn: _inspect
1721
+ }
1722
+ ];
1723
+
1724
+ // src/helpers/match.ts
1725
+ import micromatch2 from "micromatch";
1726
+ var match = (files, patterns, options2) => {
1727
+ const pats = typeof patterns === "string" ? patterns.split(/, */) : patterns;
1728
+ return micromatch2(files, pats, options2);
1729
+ };
1730
+ var isMatch = (filepath, pattern, options2) => {
1731
+ return micromatch2.isMatch(filepath, pattern, options2);
1732
+ };
1733
+ var mm = (...args) => {
1734
+ console.log("the {{mm}} helper is depcrecated and will be removed");
1735
+ console.log("in handlebars-helpers v1.0.0, please use the {{match}}");
1736
+ console.log("helper instead.");
1737
+ return match(...args);
1738
+ };
1739
+ var helpers11 = [
1740
+ {
1741
+ name: "match",
1742
+ category: "match",
1743
+ compatibility: ["browser", "nodejs"],
1744
+ fn: match
1745
+ },
1746
+ {
1747
+ name: "isMatch",
1748
+ category: "match",
1749
+ compatibility: ["browser", "nodejs"],
1750
+ fn: isMatch
1751
+ },
1752
+ {
1753
+ name: "mm",
1754
+ category: "match",
1755
+ compatibility: ["browser", "nodejs"],
1756
+ fn: mm
1757
+ }
1758
+ ];
1759
+
1760
+ // src/helpers/math.ts
1761
+ var isNumeric = (value) => typeof value === "number" && !Number.isNaN(value) || typeof value === "string" && value.trim() !== "" && !Number.isNaN(Number(value));
1762
+ var toNumber = (value, message = "expected a number") => {
1763
+ if (isNumeric(value)) {
1764
+ return Number(value);
1765
+ }
1766
+ throw new TypeError(message);
1767
+ };
1768
+ var abs = (value) => {
1769
+ const num = toNumber(value);
1770
+ return Math.abs(num);
1771
+ };
1772
+ var add = (a, b) => {
1773
+ if (isNumeric(a) && isNumeric(b)) {
1774
+ return Number(a) + Number(b);
1775
+ }
1776
+ return "";
1777
+ };
1778
+ var avg = (...values) => {
1779
+ const flat = values.flat().map((n) => Number(n));
1780
+ return sum(flat) / flat.length;
1781
+ };
1782
+ var ceil = (value) => {
1783
+ const num = toNumber(value);
1784
+ return Math.ceil(num);
1785
+ };
1786
+ var divide = (a, b) => {
1787
+ const numA = toNumber(a, "expected the first argument to be a number");
1788
+ const numB = toNumber(b, "expected the second argument to be a number");
1789
+ return numA / numB;
1790
+ };
1791
+ var floor = (value) => {
1792
+ const num = toNumber(value);
1793
+ return Math.floor(num);
1794
+ };
1795
+ var minus = (a, b) => {
1796
+ const numA = toNumber(a, "expected the first argument to be a number");
1797
+ const numB = toNumber(b, "expected the second argument to be a number");
1798
+ return numA - numB;
1799
+ };
1800
+ var modulo = (a, b) => {
1801
+ const numA = toNumber(a, "expected the first argument to be a number");
1802
+ const numB = toNumber(b, "expected the second argument to be a number");
1803
+ return numA % numB;
1804
+ };
1805
+ var multiply = (a, b) => {
1806
+ const numA = toNumber(a, "expected the first argument to be a number");
1807
+ const numB = toNumber(b, "expected the second argument to be a number");
1808
+ return numA * numB;
1809
+ };
1810
+ var plus = (a, b) => {
1811
+ const numA = toNumber(a, "expected the first argument to be a number");
1812
+ const numB = toNumber(b, "expected the second argument to be a number");
1813
+ return numA + numB;
1814
+ };
1815
+ var random = (min, max) => {
1816
+ const minNum = toNumber(min, "expected minimum to be a number");
1817
+ const maxNum = toNumber(max, "expected maximum to be a number");
1818
+ return minNum + Math.floor(Math.random() * (maxNum - minNum + 1));
1819
+ };
1820
+ var remainder = (a, b) => a % b;
1821
+ var round = (value) => {
1822
+ const num = toNumber(value);
1823
+ return Math.round(num);
1824
+ };
1825
+ var subtract = (a, b) => {
1826
+ const numA = toNumber(a, "expected the first argument to be a number");
1827
+ const numB = toNumber(b, "expected the second argument to be a number");
1828
+ return numA - numB;
1829
+ };
1830
+ var sum = (...values) => {
1831
+ const flat = values.flat();
1832
+ let total = 0;
1833
+ for (const value of flat) {
1834
+ if (isNumeric(value)) {
1835
+ total += Number(value);
1836
+ }
1837
+ }
1838
+ return total;
1839
+ };
1840
+ var times = (a, b) => multiply(a, b);
1841
+ var helpers12 = [
1842
+ {
1843
+ name: "abs",
1844
+ category: "math",
1845
+ compatibility: ["browser", "nodejs"],
1846
+ fn: abs
1847
+ },
1848
+ {
1849
+ name: "add",
1850
+ category: "math",
1851
+ compatibility: ["browser", "nodejs"],
1852
+ fn: add
1853
+ },
1854
+ {
1855
+ name: "avg",
1856
+ category: "math",
1857
+ compatibility: ["browser", "nodejs"],
1858
+ fn: avg
1859
+ },
1860
+ {
1861
+ name: "ceil",
1862
+ category: "math",
1863
+ compatibility: ["browser", "nodejs"],
1864
+ fn: ceil
1865
+ },
1866
+ {
1867
+ name: "divide",
1868
+ category: "math",
1869
+ compatibility: ["browser", "nodejs"],
1870
+ fn: divide
1871
+ },
1872
+ {
1873
+ name: "floor",
1874
+ category: "math",
1875
+ compatibility: ["browser", "nodejs"],
1876
+ fn: floor
1877
+ },
1878
+ {
1879
+ name: "minus",
1880
+ category: "math",
1881
+ compatibility: ["browser", "nodejs"],
1882
+ fn: minus
1883
+ },
1884
+ {
1885
+ name: "modulo",
1886
+ category: "math",
1887
+ compatibility: ["browser", "nodejs"],
1888
+ fn: modulo
1889
+ },
1890
+ {
1891
+ name: "multiply",
1892
+ category: "math",
1893
+ compatibility: ["browser", "nodejs"],
1894
+ fn: multiply
1895
+ },
1896
+ {
1897
+ name: "plus",
1898
+ category: "math",
1899
+ compatibility: ["browser", "nodejs"],
1900
+ fn: plus
1901
+ },
1902
+ {
1903
+ name: "random",
1904
+ category: "math",
1905
+ compatibility: ["browser", "nodejs"],
1906
+ fn: random
1907
+ },
1908
+ {
1909
+ name: "remainder",
1910
+ category: "math",
1911
+ compatibility: ["browser", "nodejs"],
1912
+ fn: remainder
1913
+ },
1914
+ {
1915
+ name: "round",
1916
+ category: "math",
1917
+ compatibility: ["browser", "nodejs"],
1918
+ fn: round
1919
+ },
1920
+ {
1921
+ name: "subtract",
1922
+ category: "math",
1923
+ compatibility: ["browser", "nodejs"],
1924
+ fn: subtract
1925
+ },
1926
+ {
1927
+ name: "sum",
1928
+ category: "math",
1929
+ compatibility: ["browser", "nodejs"],
1930
+ fn: sum
1931
+ },
1932
+ {
1933
+ name: "times",
1934
+ category: "math",
1935
+ compatibility: ["browser", "nodejs"],
1936
+ fn: times
1937
+ }
1938
+ ];
1939
+
1940
+ // src/helpers/md.ts
1941
+ import fs3 from "fs";
1942
+ import path4 from "path";
1943
+ import process2 from "process";
1944
+ import ent from "ent";
1945
+ import Handlebars from "handlebars";
1946
+ import { Remarkable } from "remarkable";
1947
+ var renderMarkdown = function(input, options2) {
1948
+ if (typeof input === "object" && input && "fn" in input && typeof input.fn === "function") {
1949
+ options2 = input;
1950
+ input = input.fn(this);
1951
+ } else if (typeof input !== "string") {
1952
+ input = "";
1953
+ }
1954
+ const options_ = { cwd: process2.cwd(), ...options2 };
1955
+ const md = new Remarkable({
1956
+ breaks: true,
1957
+ html: true,
1958
+ langPrefix: "lang-",
1959
+ typographer: false,
1960
+ xhtmlOut: false
1961
+ });
1962
+ let string_ = input;
1963
+ if (string_ && string_.length > 0) {
1964
+ const filepath = path4.resolve(options_.cwd, string_);
1965
+ if (fs3.existsSync(filepath) && fs3.statSync(filepath).isFile()) {
1966
+ string_ = fs3.readFileSync(filepath, "utf8");
1967
+ }
1968
+ }
1969
+ return new Handlebars.SafeString(ent.decode(md.render(string_)));
1970
+ };
1971
+ var helpers13 = [
1972
+ {
1973
+ name: "md",
1974
+ category: "markdown",
1975
+ compatibility: ["nodejs"],
1976
+ fn: renderMarkdown
1977
+ },
1978
+ {
1979
+ name: "markdown",
1980
+ category: "markdown",
1981
+ compatibility: ["nodejs"],
1982
+ fn: renderMarkdown
1983
+ }
1984
+ ];
1985
+
1986
+ // src/helpers/misc.ts
1987
+ import Handlebars2 from "handlebars";
1988
+ import kindOf from "kind-of";
1989
+ function frame(context, options2) {
1990
+ if (typeof context === "object" && context !== null && "hash" in context) {
1991
+ options2 = context;
1992
+ context = options2.data;
1993
+ }
1994
+ const data = Handlebars2.createFrame(context || {});
1995
+ if (typeof options2 !== "object" || options2 === null) {
1996
+ options2 = {};
1997
+ }
1998
+ if (options2.hash && typeof options2.hash === "object") {
1999
+ Object.assign(data, options2.hash);
2000
+ }
2001
+ return options2.fn(this, { data });
2002
+ }
2003
+ function option(prop, locals, opts) {
2004
+ return get(options(this, locals, opts), prop);
2005
+ }
2006
+ function noop(options2) {
2007
+ return options2.fn(this);
2008
+ }
2009
+ var typeOf = kindOf;
2010
+ function withHash(options2) {
2011
+ if (options2.hash && Object.keys(options2.hash).length) {
2012
+ return options2.fn(options2.hash);
2013
+ }
2014
+ return options2.inverse(this);
2015
+ }
2016
+ var helpers14 = [
2017
+ {
2018
+ name: "frame",
2019
+ category: "misc",
2020
+ compatibility: ["browser", "nodejs"],
2021
+ fn: frame
2022
+ },
2023
+ {
2024
+ name: "option",
2025
+ category: "misc",
2026
+ compatibility: ["browser", "nodejs"],
2027
+ fn: option
2028
+ },
2029
+ {
2030
+ name: "noop",
2031
+ category: "misc",
2032
+ compatibility: ["browser", "nodejs"],
2033
+ fn: noop
2034
+ },
2035
+ {
2036
+ name: "typeOf",
2037
+ category: "misc",
2038
+ compatibility: ["browser", "nodejs"],
2039
+ fn: typeOf
2040
+ },
2041
+ {
2042
+ name: "withHash",
2043
+ category: "misc",
2044
+ compatibility: ["browser", "nodejs"],
2045
+ fn: withHash
2046
+ }
2047
+ ];
2048
+
2049
+ // src/helpers/number.ts
2050
+ var isNumeric2 = (value) => typeof value === "number" && !Number.isNaN(value);
2051
+ var bytes = (value, precision) => {
2052
+ if (value == null) return "0 B";
2053
+ let num;
2054
+ if (typeof value === "string") {
2055
+ num = value.length;
2056
+ if (!num) return "0 B";
2057
+ } else if (isNumeric2(value)) {
2058
+ num = Number(value);
2059
+ } else if (typeof value.length === "number") {
2060
+ num = value.length;
2061
+ if (!num) return "0 B";
2062
+ } else {
2063
+ return "0 B";
2064
+ }
2065
+ const prec = typeof precision === "number" && !Number.isNaN(precision) ? precision : 2;
2066
+ const abbr = ["B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
2067
+ const factor = 10 ** prec;
2068
+ for (let i = abbr.length - 1; i >= 0; i--) {
2069
+ const size = 10 ** (i * 3);
2070
+ if (size <= num + 1) {
2071
+ const val = Math.round(num * factor / size) / factor;
2072
+ return `${val} ${abbr[i]}`;
2073
+ }
2074
+ }
2075
+ return `${num}`;
2076
+ };
2077
+ var addCommas = (num) => num.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
2078
+ var phoneNumber = (num) => {
2079
+ const str = num.toString();
2080
+ return `(${str.substr(0, 3)}) ${str.substr(3, 3)}-${str.substr(6, 4)}`;
2081
+ };
2082
+ var toAbbr = (value, precision) => {
2083
+ const num = isNumeric2(value) ? Number(value) : 0;
2084
+ const prec = typeof precision === "number" && !Number.isNaN(precision) ? precision : 2;
2085
+ const factor = 10 ** prec;
2086
+ const abbr = ["k", "m", "b", "t", "q"];
2087
+ for (let i = abbr.length - 1; i >= 0; i--) {
2088
+ const size = 10 ** ((i + 1) * 3);
2089
+ if (size <= num + 1) {
2090
+ const val = Math.round(num * factor / size) / factor;
2091
+ return `${val}${abbr[i]}`;
2092
+ }
2093
+ }
2094
+ return `${num}`;
2095
+ };
2096
+ var toExponential = (value, digits) => {
2097
+ const num = isNumeric2(value) ? Number(value) : 0;
2098
+ const d = typeof digits === "number" && !Number.isNaN(digits) ? digits : 0;
2099
+ return Number(num).toExponential(d);
2100
+ };
2101
+ var toFixed = (value, digits) => {
2102
+ const num = isNumeric2(value) ? Number(value) : 0;
2103
+ const d = typeof digits === "number" && !Number.isNaN(digits) ? digits : 0;
2104
+ return Number(num).toFixed(d);
2105
+ };
2106
+ var toFloat = (value) => parseFloat(String(value));
2107
+ var toInt = (value) => parseInt(String(value), 10);
2108
+ var toPrecision = (value, precision) => {
2109
+ const num = isNumeric2(value) ? Number(value) : 0;
2110
+ const prec = typeof precision === "number" && !Number.isNaN(precision) ? precision : 1;
2111
+ return Number(num).toPrecision(prec);
2112
+ };
2113
+ var helpers15 = [
2114
+ {
2115
+ name: "bytes",
2116
+ category: "number",
2117
+ compatibility: ["browser", "nodejs"],
2118
+ fn: bytes
2119
+ },
2120
+ {
2121
+ name: "addCommas",
2122
+ category: "number",
2123
+ compatibility: ["browser", "nodejs"],
2124
+ fn: addCommas
2125
+ },
2126
+ {
2127
+ name: "phoneNumber",
2128
+ category: "number",
2129
+ compatibility: ["browser", "nodejs"],
2130
+ fn: phoneNumber
2131
+ },
2132
+ {
2133
+ name: "toAbbr",
2134
+ category: "number",
2135
+ compatibility: ["browser", "nodejs"],
2136
+ fn: toAbbr
2137
+ },
2138
+ {
2139
+ name: "toExponential",
2140
+ category: "number",
2141
+ compatibility: ["browser", "nodejs"],
2142
+ fn: toExponential
2143
+ },
2144
+ {
2145
+ name: "toFixed",
2146
+ category: "number",
2147
+ compatibility: ["browser", "nodejs"],
2148
+ fn: toFixed
2149
+ },
2150
+ {
2151
+ name: "toFloat",
2152
+ category: "number",
2153
+ compatibility: ["browser", "nodejs"],
2154
+ fn: toFloat
2155
+ },
2156
+ {
2157
+ name: "toInt",
2158
+ category: "number",
2159
+ compatibility: ["browser", "nodejs"],
2160
+ fn: toInt
2161
+ },
2162
+ {
2163
+ name: "toPrecision",
2164
+ category: "number",
2165
+ compatibility: ["browser", "nodejs"],
2166
+ fn: toPrecision
2167
+ }
2168
+ ];
2169
+
2170
+ // src/helpers/object.ts
2171
+ var isOptions2 = (value) => {
2172
+ return Boolean(value && typeof value === "object" && "hash" in value);
2173
+ };
2174
+ var createFrame = (options2, hash) => ({
2175
+ ...options2?.data || {},
2176
+ ...hash
2177
+ });
2178
+ var extend = (...objects) => {
2179
+ const args = [...objects];
2180
+ if (args.length && isOptions2(args[args.length - 1])) {
2181
+ const opts = args.pop();
2182
+ args.push(opts.hash);
2183
+ }
2184
+ const result = {};
2185
+ for (const obj of args) {
2186
+ if (obj && typeof obj === "object" && !Array.isArray(obj)) {
2187
+ Object.assign(result, obj);
2188
+ }
2189
+ }
2190
+ return result;
2191
+ };
2192
+ var forIn = (obj, options2) => {
2193
+ if (!isOptions2(options2)) {
2194
+ return options2?.inverse?.(obj) ?? "";
2195
+ }
2196
+ const data = createFrame(options2, options2.hash || {});
2197
+ let result = "";
2198
+ for (const key in obj) {
2199
+ data.key = key;
2200
+ result += options2.fn(obj[key], { data });
2201
+ }
2202
+ return result;
2203
+ };
2204
+ var forOwn = (obj, options2) => {
2205
+ if (!isOptions2(options2)) {
2206
+ return options2?.inverse?.(obj) ?? "";
2207
+ }
2208
+ const data = createFrame(options2, options2.hash || {});
2209
+ let result = "";
2210
+ for (const key in obj) {
2211
+ if (Object.hasOwn(obj, key)) {
2212
+ data.key = key;
2213
+ result += options2.fn(obj[key], { data });
2214
+ }
2215
+ }
2216
+ return result;
2217
+ };
2218
+ var toPath = (...prop) => {
2219
+ const parts = [];
2220
+ for (const p of prop) {
2221
+ if (typeof p === "string" || typeof p === "number") {
2222
+ parts.push(p);
2223
+ }
2224
+ }
2225
+ return parts.join(".");
2226
+ };
2227
+ var getHelper = (prop, context, options2) => {
2228
+ const val = get(context, prop);
2229
+ if (options2 && typeof options2.fn === "function") {
2230
+ return val ? options2.fn(val) : options2.inverse?.(context);
2231
+ }
2232
+ return val;
2233
+ };
2234
+ var getObjectHelper = (prop, context) => {
2235
+ return getObject(context, prop);
2236
+ };
2237
+ var hasOwn = (context, key) => {
2238
+ return Object.hasOwn(context, key);
2239
+ };
2240
+ var isObject = (value) => {
2241
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
2242
+ };
2243
+ var JSONparse = (str) => {
2244
+ return JSON.parse(str);
2245
+ };
2246
+ var JSONstringify = (obj, indent) => {
2247
+ const ind = typeof indent === "number" ? indent : 0;
2248
+ return JSON.stringify(obj, null, ind);
2249
+ };
2250
+ var merge = (context, ...objects) => {
2251
+ const args = [context, ...objects];
2252
+ if (args.length && isOptions2(args[args.length - 1])) {
2253
+ const opts = args.pop();
2254
+ args.push(opts.hash);
2255
+ }
2256
+ return Object.assign(...args);
2257
+ };
2258
+ var parseJSON = JSONparse;
2259
+ var stringify = JSONstringify;
2260
+ var pick = (props, context, options2) => {
2261
+ const keys = arrayify(props);
2262
+ let result = {};
2263
+ for (const key of keys) {
2264
+ result = Object.assign({}, result, getObject(context, key));
2265
+ }
2266
+ if (options2 && typeof options2.fn === "function") {
2267
+ if (Object.keys(result).length) {
2268
+ return options2.fn(result);
2269
+ }
2270
+ return options2.inverse?.(context);
2271
+ }
2272
+ return result;
2273
+ };
2274
+ var helpers16 = [
2275
+ {
2276
+ name: "extend",
2277
+ category: "object",
2278
+ compatibility: ["browser", "nodejs"],
2279
+ fn: extend
2280
+ },
2281
+ {
2282
+ name: "forIn",
2283
+ category: "object",
2284
+ compatibility: ["browser", "nodejs"],
2285
+ fn: forIn
2286
+ },
2287
+ {
2288
+ name: "forOwn",
2289
+ category: "object",
2290
+ compatibility: ["browser", "nodejs"],
2291
+ fn: forOwn
2292
+ },
2293
+ {
2294
+ name: "toPath",
2295
+ category: "object",
2296
+ compatibility: ["browser", "nodejs"],
2297
+ fn: toPath
2298
+ },
2299
+ {
2300
+ name: "get",
2301
+ category: "object",
2302
+ compatibility: ["browser", "nodejs"],
2303
+ fn: getHelper
2304
+ },
2305
+ {
2306
+ name: "getObject",
2307
+ category: "object",
2308
+ compatibility: ["browser", "nodejs"],
2309
+ fn: getObjectHelper
2310
+ },
2311
+ {
2312
+ name: "hasOwn",
2313
+ category: "object",
2314
+ compatibility: ["browser", "nodejs"],
2315
+ fn: hasOwn
2316
+ },
2317
+ {
2318
+ name: "isObject",
2319
+ category: "object",
2320
+ compatibility: ["browser", "nodejs"],
2321
+ fn: isObject
2322
+ },
2323
+ {
2324
+ name: "JSONparse",
2325
+ category: "object",
2326
+ compatibility: ["browser", "nodejs"],
2327
+ fn: JSONparse
2328
+ },
2329
+ {
2330
+ name: "JSONstringify",
2331
+ category: "object",
2332
+ compatibility: ["browser", "nodejs"],
2333
+ fn: JSONstringify
2334
+ },
2335
+ {
2336
+ name: "merge",
2337
+ category: "object",
2338
+ compatibility: ["browser", "nodejs"],
2339
+ fn: merge
2340
+ },
2341
+ {
2342
+ name: "parseJSON",
2343
+ category: "object",
2344
+ compatibility: ["browser", "nodejs"],
2345
+ fn: parseJSON
2346
+ },
2347
+ {
2348
+ name: "pick",
2349
+ category: "object",
2350
+ compatibility: ["browser", "nodejs"],
2351
+ fn: pick
2352
+ },
2353
+ {
2354
+ name: "stringify",
2355
+ category: "object",
2356
+ compatibility: ["browser", "nodejs"],
2357
+ fn: stringify
2358
+ }
2359
+ ];
2360
+
2361
+ // src/helpers/path.ts
2362
+ import path5 from "path";
2363
+ var expectedType = (variableName, expectedType2, variableValue) => {
2364
+ const actualType = Object.prototype.toString.call(variableValue).slice(8, -1).toLowerCase();
2365
+ return `Expected ${variableName} to be of type ${expectedType2}, but got ${actualType}`;
2366
+ };
2367
+ var assertString = (name, value) => {
2368
+ if (typeof value !== "string") {
2369
+ throw new TypeError(expectedType(name, "string", value));
2370
+ }
2371
+ return value;
2372
+ };
2373
+ var absolute = function(filepath, options2) {
2374
+ const fp = assertString("filepath", filepath);
2375
+ const cwd = options2?.data?.root?.cwd ?? this?.cwd ?? process.cwd();
2376
+ return path5.resolve(cwd, fp);
2377
+ };
2378
+ var dirname = (filepath) => {
2379
+ const fp = assertString("filepath", filepath);
2380
+ return path5.dirname(fp);
2381
+ };
2382
+ var relative = (a, b) => {
2383
+ const from = assertString("first path", a);
2384
+ const to = assertString("second path", b);
2385
+ return path5.relative(path5.dirname(from), to);
2386
+ };
2387
+ var basename = (filepath) => {
2388
+ const fp = assertString("filepath", filepath);
2389
+ return path5.basename(fp);
2390
+ };
2391
+ var stem = (filepath) => {
2392
+ const fp = assertString("filepath", filepath);
2393
+ return path5.basename(fp, path5.extname(fp));
2394
+ };
2395
+ var extname = (filepath) => {
2396
+ const fp = assertString("filepath", filepath);
2397
+ return path5.extname(fp);
2398
+ };
2399
+ var resolveFn = function(filepath, ...paths) {
2400
+ let options2;
2401
+ const last2 = paths[paths.length - 1];
2402
+ if (typeof last2 === "object" && last2 && "data" in last2) {
2403
+ options2 = paths.pop();
2404
+ }
2405
+ const cwd = options2?.data?.root?.cwd ?? this?.cwd ?? process.cwd();
2406
+ const all2 = [
2407
+ cwd,
2408
+ assertString("filepath", filepath),
2409
+ ...paths.map((p, i) => assertString(`path${i}`, p))
2410
+ ];
2411
+ return path5.resolve(...all2);
2412
+ };
2413
+ var segments = (filepath, a, b) => {
2414
+ const fp = assertString("filepath", filepath);
2415
+ const start = Number(a);
2416
+ const end = Number(b);
2417
+ const segmentsArr = fp.split(/[\\/]+/);
2418
+ return segmentsArr.slice(start, end).join("/");
2419
+ };
2420
+ var helpers17 = [
2421
+ {
2422
+ name: "absolute",
2423
+ category: "path",
2424
+ compatibility: ["nodejs"],
2425
+ fn: absolute
2426
+ },
2427
+ {
2428
+ name: "dirname",
2429
+ category: "path",
2430
+ compatibility: ["nodejs"],
2431
+ fn: dirname
2432
+ },
2433
+ {
2434
+ name: "relative",
2435
+ category: "path",
2436
+ compatibility: ["nodejs"],
2437
+ fn: relative
2438
+ },
2439
+ {
2440
+ name: "basename",
2441
+ category: "path",
2442
+ compatibility: ["nodejs"],
2443
+ fn: basename
2444
+ },
2445
+ {
2446
+ name: "stem",
2447
+ category: "path",
2448
+ compatibility: ["nodejs"],
2449
+ fn: stem
2450
+ },
2451
+ {
2452
+ name: "extname",
2453
+ category: "path",
2454
+ compatibility: ["nodejs"],
2455
+ fn: extname
2456
+ },
2457
+ {
2458
+ name: "resolve",
2459
+ category: "path",
2460
+ compatibility: ["nodejs"],
2461
+ fn: resolveFn
2462
+ },
2463
+ {
2464
+ name: "segments",
2465
+ category: "path",
2466
+ compatibility: ["nodejs"],
2467
+ fn: segments
2468
+ }
2469
+ ];
2470
+
2471
+ // src/helpers/regex.ts
2472
+ var toRegex = (str, locals, opts) => {
2473
+ const mergedOpts = options({}, locals, opts);
2474
+ return new RegExp(str, mergedOpts.flags);
2475
+ };
2476
+ var test = (str, regex) => {
2477
+ if (typeof str !== "string") {
2478
+ return false;
2479
+ }
2480
+ if (!(regex instanceof RegExp)) {
2481
+ throw new TypeError("expected a regular expression");
2482
+ }
2483
+ return regex.test(str);
2484
+ };
2485
+ var helpers18 = [
2486
+ {
2487
+ name: "toRegex",
2488
+ category: "regex",
2489
+ compatibility: ["browser", "nodejs"],
2490
+ fn: toRegex
2491
+ },
2492
+ {
2493
+ name: "test",
2494
+ category: "regex",
2495
+ compatibility: ["browser", "nodejs"],
2496
+ fn: test
2497
+ }
2498
+ ];
2499
+
2500
+ // src/helpers/string.ts
2501
+ var chop = (str) => str.trim().replace(/^[-_.\W\s]+|[-_.\W\s]+$/g, "");
2502
+ var changecase = (str, fn) => {
2503
+ if (str.length === 1) return str.toLowerCase();
2504
+ const res = chop(str).toLowerCase();
2505
+ return res.replace(/[-_.\W\s]+(\w|$)/g, (_, ch) => fn(ch));
2506
+ };
2507
+ var append = (str, suffix) => {
2508
+ if (typeof str === "string" && typeof suffix === "string") {
2509
+ return str + suffix;
2510
+ }
2511
+ return str;
2512
+ };
2513
+ var camelcase = (str) => typeof str === "string" ? changecase(str, (ch) => ch.toUpperCase()) : "";
2514
+ var capitalize = (str) => {
2515
+ if (typeof str !== "string" || str.length === 0) return "";
2516
+ return str.charAt(0).toUpperCase() + str.slice(1);
2517
+ };
2518
+ var capitalizeAll = (str) => {
2519
+ if (typeof str !== "string") return "";
2520
+ return str.replace(/\w\S*/g, (word) => capitalize(word));
2521
+ };
2522
+ var center = (str, spaces) => {
2523
+ if (typeof str !== "string") return "";
2524
+ let space = "";
2525
+ for (let i = 0; i < spaces; i++) {
2526
+ space += "&nbsp;";
2527
+ }
2528
+ return space + str + space;
2529
+ };
2530
+ var chopStr = (str) => typeof str === "string" ? chop(str) : "";
2531
+ var dashcase = (str) => typeof str === "string" ? changecase(str, (ch) => `-${ch}`) : "";
2532
+ var dotcase = (str) => typeof str === "string" ? changecase(str, (ch) => `.${ch}`) : "";
2533
+ var truncate = (str, limit, suffix) => {
2534
+ if (typeof str === "string") {
2535
+ if (typeof suffix !== "string") {
2536
+ suffix = "";
2537
+ }
2538
+ if (str.length > limit) {
2539
+ return str.slice(0, limit - suffix.length) + suffix;
2540
+ }
2541
+ return str;
2542
+ }
2543
+ return "";
2544
+ };
2545
+ var ellipsis = (str, limit) => {
2546
+ if (typeof str === "string") {
2547
+ if (str.length <= limit) {
2548
+ return str;
2549
+ }
2550
+ return `${truncate(str, limit)}\u2026`;
2551
+ }
2552
+ return "";
2553
+ };
2554
+ var hyphenate = (str) => typeof str === "string" ? str.split(" ").join("-") : "";
2555
+ var isString = (value) => typeof value === "string";
2556
+ var lowercase = (str) => {
2557
+ if (typeof str === "object" && str !== null && "fn" in str && typeof str.fn === "function") {
2558
+ return String(str.fn()).toLowerCase();
2559
+ }
2560
+ if (typeof str !== "string") return "";
2561
+ return str.toLowerCase();
2562
+ };
2563
+ var downcase = (str) => lowercase(str);
2564
+ var occurrences = (str, substring) => {
2565
+ if (typeof str !== "string") return "";
2566
+ const len = substring.length;
2567
+ let pos = str.indexOf(substring, 0);
2568
+ let n = 0;
2569
+ while (pos > -1) {
2570
+ n++;
2571
+ pos = str.indexOf(substring, pos + len);
2572
+ }
2573
+ return n;
2574
+ };
2575
+ var pascalcase = (str) => {
2576
+ if (typeof str !== "string") return "";
2577
+ const res = changecase(str, (ch) => ch.toUpperCase());
2578
+ return res.charAt(0).toUpperCase() + res.slice(1);
2579
+ };
2580
+ var pathcase = (str) => typeof str === "string" ? changecase(str, (ch) => `/${ch}`) : "";
2581
+ var plusify = (str, ch) => {
2582
+ if (typeof str !== "string") return "";
2583
+ if (typeof ch !== "string") ch = " ";
2584
+ return str.split(ch).join("+");
2585
+ };
2586
+ var prepend = (str, prefix) => {
2587
+ return typeof str === "string" && typeof prefix === "string" ? prefix + str : str;
2588
+ };
2589
+ var remove = (str, ch) => {
2590
+ if (typeof str !== "string") return "";
2591
+ if (typeof ch !== "string") return str;
2592
+ return str.split(ch).join("");
2593
+ };
2594
+ var removeFirst = (str, ch) => {
2595
+ if (typeof str !== "string") return "";
2596
+ if (typeof ch !== "string") return str;
2597
+ return str.replace(ch, "");
2598
+ };
2599
+ var replace = (str, a, b) => {
2600
+ if (typeof str !== "string") return "";
2601
+ if (typeof a !== "string") return str;
2602
+ if (typeof b !== "string") b = "";
2603
+ return str.split(a).join(b);
2604
+ };
2605
+ var replaceFirst = (str, a, b) => {
2606
+ if (typeof str !== "string") return "";
2607
+ if (typeof a !== "string") return str;
2608
+ if (typeof b !== "string") b = "";
2609
+ return str.replace(a, b);
2610
+ };
2611
+ var reverse2 = (str) => typeof str === "string" ? str.split("").reverse().join("") : "";
2612
+ var sentence = (str) => {
2613
+ if (typeof str !== "string") return "";
2614
+ return str.replace(
2615
+ /((?:\S[^.?!]*)[.?!]*)/g,
2616
+ (txt) => txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase()
2617
+ );
2618
+ };
2619
+ var snakecase = (str) => typeof str === "string" ? changecase(str, (ch) => `_${ch}`) : "";
2620
+ var trim = (str) => typeof str === "string" ? str.trim() : "";
2621
+ var trimLeft = (str) => typeof str === "string" ? str.replace(/^\s+/, "") : "";
2622
+ var trimRight = (str) => typeof str === "string" ? str.replace(/\s+$/, "") : "";
2623
+ var truncateWords = (str, count, suffix) => {
2624
+ if (typeof str === "string" && typeof count === "number" && Number.isFinite(count)) {
2625
+ if (typeof suffix !== "string") {
2626
+ suffix = "...";
2627
+ }
2628
+ const num = Math.trunc(count);
2629
+ let arr = str.split(" ");
2630
+ if (num < arr.length) {
2631
+ arr = arr.slice(0, num);
2632
+ }
2633
+ const val = arr.join(" ").trim();
2634
+ return val + suffix;
2635
+ }
2636
+ return "";
2637
+ };
2638
+ var truncateWordsAlias = truncateWords;
2639
+ var uppercase = (str) => {
2640
+ if (typeof str === "object" && str !== null && "fn" in str && typeof str.fn === "function") {
2641
+ return String(str.fn()).toUpperCase();
2642
+ }
2643
+ if (typeof str !== "string") return "";
2644
+ return str.toUpperCase();
2645
+ };
2646
+ var upcase = (str) => uppercase(str);
2647
+ var split = (str, character) => {
2648
+ if (typeof str !== "string") return "";
2649
+ if (typeof character !== "string") character = "";
2650
+ return str.split(character);
2651
+ };
2652
+ var startsWith = (prefix, testString, _options) => {
2653
+ if (typeof prefix !== "string" || typeof testString !== "string") {
2654
+ return false;
2655
+ }
2656
+ return testString.startsWith(prefix);
2657
+ };
2658
+ var titleize = (str) => {
2659
+ if (typeof str !== "string") return "";
2660
+ return str.replace(/\w\S*/g, (word) => {
2661
+ return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
2662
+ });
2663
+ };
2664
+ var raw = (options2) => {
2665
+ if (options2 && typeof options2.fn === "function") {
2666
+ return options2.fn();
2667
+ }
2668
+ return "";
2669
+ };
2670
+ var helpers19 = [
2671
+ {
2672
+ name: "append",
2673
+ category: "string",
2674
+ compatibility: ["browser", "nodejs"],
2675
+ fn: append
2676
+ },
2677
+ {
2678
+ name: "camelcase",
2679
+ category: "string",
2680
+ compatibility: ["browser", "nodejs"],
2681
+ fn: camelcase
2682
+ },
2683
+ {
2684
+ name: "capitalize",
2685
+ category: "string",
2686
+ compatibility: ["browser", "nodejs"],
2687
+ fn: capitalize
2688
+ },
2689
+ {
2690
+ name: "capitalizeAll",
2691
+ category: "string",
2692
+ compatibility: ["browser", "nodejs"],
2693
+ fn: capitalizeAll
2694
+ },
2695
+ {
2696
+ name: "center",
2697
+ category: "string",
2698
+ compatibility: ["browser", "nodejs"],
2699
+ fn: center
2700
+ },
2701
+ {
2702
+ name: "chop",
2703
+ category: "string",
2704
+ compatibility: ["browser", "nodejs"],
2705
+ fn: chopStr
2706
+ },
2707
+ {
2708
+ name: "dashcase",
2709
+ category: "string",
2710
+ compatibility: ["browser", "nodejs"],
2711
+ fn: dashcase
2712
+ },
2713
+ {
2714
+ name: "dotcase",
2715
+ category: "string",
2716
+ compatibility: ["browser", "nodejs"],
2717
+ fn: dotcase
2718
+ },
2719
+ {
2720
+ name: "ellipsis",
2721
+ category: "string",
2722
+ compatibility: ["browser", "nodejs"],
2723
+ fn: ellipsis
2724
+ },
2725
+ {
2726
+ name: "hyphenate",
2727
+ category: "string",
2728
+ compatibility: ["browser", "nodejs"],
2729
+ fn: hyphenate
2730
+ },
2731
+ {
2732
+ name: "isString",
2733
+ category: "string",
2734
+ compatibility: ["browser", "nodejs"],
2735
+ fn: isString
2736
+ },
2737
+ {
2738
+ name: "lowercase",
2739
+ category: "string",
2740
+ compatibility: ["browser", "nodejs"],
2741
+ fn: lowercase
2742
+ },
2743
+ {
2744
+ name: "downcase",
2745
+ category: "string",
2746
+ compatibility: ["browser", "nodejs"],
2747
+ fn: downcase
2748
+ },
2749
+ {
2750
+ name: "occurrences",
2751
+ category: "string",
2752
+ compatibility: ["browser", "nodejs"],
2753
+ fn: occurrences
2754
+ },
2755
+ {
2756
+ name: "pascalcase",
2757
+ category: "string",
2758
+ compatibility: ["browser", "nodejs"],
2759
+ fn: pascalcase
2760
+ },
2761
+ {
2762
+ name: "pathcase",
2763
+ category: "string",
2764
+ compatibility: ["browser", "nodejs"],
2765
+ fn: pathcase
2766
+ },
2767
+ {
2768
+ name: "plusify",
2769
+ category: "string",
2770
+ compatibility: ["browser", "nodejs"],
2771
+ fn: plusify
2772
+ },
2773
+ {
2774
+ name: "prepend",
2775
+ category: "string",
2776
+ compatibility: ["browser", "nodejs"],
2777
+ fn: prepend
2778
+ },
2779
+ {
2780
+ name: "remove",
2781
+ category: "string",
2782
+ compatibility: ["browser", "nodejs"],
2783
+ fn: remove
2784
+ },
2785
+ {
2786
+ name: "removeFirst",
2787
+ category: "string",
2788
+ compatibility: ["browser", "nodejs"],
2789
+ fn: removeFirst
2790
+ },
2791
+ {
2792
+ name: "replace",
2793
+ category: "string",
2794
+ compatibility: ["browser", "nodejs"],
2795
+ fn: replace
2796
+ },
2797
+ {
2798
+ name: "replaceFirst",
2799
+ category: "string",
2800
+ compatibility: ["browser", "nodejs"],
2801
+ fn: replaceFirst
2802
+ },
2803
+ {
2804
+ name: "reverse",
2805
+ category: "string",
2806
+ compatibility: ["browser", "nodejs"],
2807
+ fn: reverse2
2808
+ },
2809
+ {
2810
+ name: "sentence",
2811
+ category: "string",
2812
+ compatibility: ["browser", "nodejs"],
2813
+ fn: sentence
2814
+ },
2815
+ {
2816
+ name: "snakecase",
2817
+ category: "string",
2818
+ compatibility: ["browser", "nodejs"],
2819
+ fn: snakecase
2820
+ },
2821
+ {
2822
+ name: "trim",
2823
+ category: "string",
2824
+ compatibility: ["browser", "nodejs"],
2825
+ fn: trim
2826
+ },
2827
+ {
2828
+ name: "trimLeft",
2829
+ category: "string",
2830
+ compatibility: ["browser", "nodejs"],
2831
+ fn: trimLeft
2832
+ },
2833
+ {
2834
+ name: "trimRight",
2835
+ category: "string",
2836
+ compatibility: ["browser", "nodejs"],
2837
+ fn: trimRight
2838
+ },
2839
+ {
2840
+ name: "truncate",
2841
+ category: "string",
2842
+ compatibility: ["browser", "nodejs"],
2843
+ fn: truncate
2844
+ },
2845
+ {
2846
+ name: "truncateWords",
2847
+ category: "string",
2848
+ compatibility: ["browser", "nodejs"],
2849
+ fn: truncateWordsAlias
2850
+ },
2851
+ {
2852
+ name: "uppercase",
2853
+ category: "string",
2854
+ compatibility: ["browser", "nodejs"],
2855
+ fn: uppercase
2856
+ },
2857
+ {
2858
+ name: "upcase",
2859
+ category: "string",
2860
+ compatibility: ["browser", "nodejs"],
2861
+ fn: upcase
2862
+ },
2863
+ {
2864
+ name: "split",
2865
+ category: "string",
2866
+ compatibility: ["browser", "nodejs"],
2867
+ fn: split
2868
+ },
2869
+ {
2870
+ name: "startsWith",
2871
+ category: "string",
2872
+ compatibility: ["browser", "nodejs"],
2873
+ fn: startsWith
2874
+ },
2875
+ {
2876
+ name: "titleize",
2877
+ category: "string",
2878
+ compatibility: ["browser", "nodejs"],
2879
+ fn: titleize
2880
+ },
2881
+ {
2882
+ name: "raw",
2883
+ category: "string",
2884
+ compatibility: ["browser", "nodejs"],
2885
+ fn: raw
2886
+ }
2887
+ ];
2888
+
2889
+ // src/helpers/url.ts
2890
+ import { escape as qsEscape } from "querystring";
2891
+ import { format, parse, resolve } from "url";
2892
+ var all = ["browser", "nodejs"];
2893
+ var encodeUri = (str) => {
2894
+ if (typeof str === "string") {
2895
+ return encodeURIComponent(str);
2896
+ }
2897
+ };
2898
+ var escapeFn = (str) => {
2899
+ if (typeof str === "string") {
2900
+ return qsEscape(str);
2901
+ }
2902
+ };
2903
+ var decodeUri = (str) => {
2904
+ if (typeof str === "string") {
2905
+ return decodeURIComponent(str);
2906
+ }
2907
+ };
2908
+ function urlEncode(...args) {
2909
+ return encodeUri.apply(this, args);
2910
+ }
2911
+ function urlDecode(...args) {
2912
+ return decodeUri.apply(this, args);
2913
+ }
2914
+ var urlResolve = (base, href) => resolve(String(base), String(href));
2915
+ var urlParse = (str) => parse(String(str));
2916
+ var stripQuerystring = (str) => {
2917
+ if (typeof str === "string") {
2918
+ return str.split("?")[0];
2919
+ }
2920
+ };
2921
+ var stripProtocol = (str) => {
2922
+ if (typeof str === "string") {
2923
+ const parsed = parse(str);
2924
+ parsed.protocol = "";
2925
+ return format(parsed);
2926
+ }
2927
+ };
2928
+ var helpers20 = [
2929
+ {
2930
+ name: "encodeURI",
2931
+ category: "url",
2932
+ compatibility: all,
2933
+ fn: encodeUri
2934
+ },
2935
+ {
2936
+ name: "escape",
2937
+ category: "url",
2938
+ compatibility: ["nodejs"],
2939
+ fn: escapeFn
2940
+ },
2941
+ {
2942
+ name: "decodeURI",
2943
+ category: "url",
2944
+ compatibility: all,
2945
+ fn: decodeUri
2946
+ },
2947
+ {
2948
+ name: "url_encode",
2949
+ category: "url",
2950
+ compatibility: all,
2951
+ fn: urlEncode
2952
+ },
2953
+ {
2954
+ name: "url_decode",
2955
+ category: "url",
2956
+ compatibility: all,
2957
+ fn: urlDecode
2958
+ },
2959
+ {
2960
+ name: "urlResolve",
2961
+ category: "url",
2962
+ compatibility: ["nodejs"],
2963
+ fn: urlResolve
2964
+ },
2965
+ {
2966
+ name: "urlParse",
2967
+ category: "url",
2968
+ compatibility: ["nodejs"],
2969
+ fn: urlParse
2970
+ },
2971
+ {
2972
+ name: "stripQuerystring",
2973
+ category: "url",
2974
+ compatibility: all,
2975
+ fn: stripQuerystring
2976
+ },
2977
+ {
2978
+ name: "stripProtocol",
2979
+ category: "url",
2980
+ compatibility: ["nodejs"],
2981
+ fn: stripProtocol
2982
+ }
2983
+ ];
2984
+
2985
+ // src/helper-registry.ts
2986
+ var HelperRegistry = class {
2987
+ _helpers = [];
2988
+ constructor() {
2989
+ this.init();
2990
+ }
2991
+ /**
2992
+ * Get all registered helpers.
2993
+ * @returns {Helper[]} The array of registered helpers.
2994
+ */
2995
+ get helpers() {
2996
+ return this._helpers;
2997
+ }
2998
+ /**
2999
+ * Initialize the helper registry. This is performed during the construction of the registry such as new HelperRegistry().
3000
+ */
3001
+ init() {
3002
+ this.registerHelpers(helpers);
3003
+ this.registerHelpers(helpers3);
3004
+ this.registerHelpers(helpers5);
3005
+ this.registerHelpers(helpers6);
3006
+ this.registerHelpers(helpers2);
3007
+ this.registerHelpers(helpers13);
3008
+ this.registerHelpers(helpers7);
3009
+ this.registerHelpers(helpers4);
3010
+ this.registerHelpers(helpers8);
3011
+ this.registerHelpers(helpers9);
3012
+ this.registerHelpers(helpers10);
3013
+ this.registerHelpers(helpers11);
3014
+ this.registerHelpers(helpers12);
3015
+ this.registerHelpers(helpers14);
3016
+ this.registerHelpers(helpers15);
3017
+ this.registerHelpers(helpers17);
3018
+ this.registerHelpers(helpers18);
3019
+ this.registerHelpers(helpers19);
3020
+ this.registerHelpers(helpers20);
3021
+ this.registerHelpers(helpers16);
3022
+ }
3023
+ /**
3024
+ * Register a helper.
3025
+ * @param {Helper} helper The helper to register.
3026
+ * @returns True if the helper was registered, false otherwise.
3027
+ */
3028
+ register(helper) {
3029
+ const result = false;
3030
+ if (!this.has(helper.name)) {
3031
+ this._helpers.push(helper);
3032
+ }
3033
+ return result;
3034
+ }
3035
+ /**
3036
+ * Register multiple helpers.
3037
+ * @param {Helper[]} helpers The array of helpers to register.
3038
+ */
3039
+ registerHelpers(helpers22) {
3040
+ for (const helper of helpers22) {
3041
+ this.register(helper);
3042
+ }
3043
+ }
3044
+ /**
3045
+ * Check if a helper is registered.
3046
+ * @param name The name of the helper.
3047
+ * @returns True if the helper is registered, false otherwise.
3048
+ */
3049
+ has(name) {
3050
+ return this._helpers.some((helper) => helper.name === name);
3051
+ }
3052
+ /**
3053
+ * Filter helpers by the given criteria.
3054
+ * @param filter The filter criteria.
3055
+ * @returns The filtered helpers.
3056
+ */
3057
+ filter(filter2) {
3058
+ let result = this._helpers;
3059
+ if (filter2.names) {
3060
+ result = result.filter((helper) => filter2.names?.includes(helper.name));
3061
+ }
3062
+ if (filter2.categories) {
3063
+ result = result.filter(
3064
+ (helper) => filter2.categories?.includes(helper.category)
3065
+ );
3066
+ }
3067
+ if (filter2.compatibility) {
3068
+ result = result.filter(
3069
+ (helper) => helper.compatibility?.some((c) => filter2.compatibility?.includes(c))
3070
+ );
3071
+ }
3072
+ return result;
3073
+ }
3074
+ /**
3075
+ * Load Handlebars helpers.
3076
+ * @param {Handlebars} handlebars The Handlebars instance.
3077
+ * @returns {void}
3078
+ */
3079
+ load(handlebars2, filters) {
3080
+ let helpers22 = this._helpers;
3081
+ if (filters) {
3082
+ helpers22 = this.filter(filters);
3083
+ }
3084
+ for (const helper of helpers22) {
3085
+ handlebars2.registerHelper(helper.name, helper.fn);
3086
+ }
3087
+ }
3088
+ /**
3089
+ * Swap Handlebars helpers. This is used when you want to swap out legacy helpers for fumanchu helpers.
3090
+ * @param handlebars The Handlebars instance.
3091
+ * @returns {void}
3092
+ */
3093
+ swap(handlebars2) {
3094
+ for (const helper of this._helpers) {
3095
+ handlebars2.unregisterHelper(helper.name);
3096
+ handlebars2.registerHelper(helper.name, helper.fn);
3097
+ }
3098
+ }
3099
+ };
3100
+
3101
+ // src/index.ts
3102
+ var Handlebars3 = HandlebarsLib;
3103
+ var handlebars = HandlebarsLib.create();
3104
+ function helpers21(options2) {
3105
+ const registry = new HelperRegistry();
3106
+ registry.load(options2.handlebars ?? options2.hbs);
3107
+ }
3108
+ async function createHandlebars() {
3109
+ const registry = new HelperRegistry();
3110
+ const handlebars2 = HandlebarsLib.create();
3111
+ if (Object.keys(HandlebarsLib.partials).length > 0) {
3112
+ handlebars2.registerPartial(HandlebarsLib.partials);
3113
+ }
3114
+ registry.load(handlebars2);
3115
+ if (process.env.NODE_ENV === "development") {
3116
+ console.warn(
3117
+ "createHandlebars will be deprecated in future versions, use `fumanchu` instead."
3118
+ );
3119
+ }
3120
+ return handlebars2;
3121
+ }
3122
+ function fumanchu(options2) {
3123
+ const registry = new HelperRegistry();
3124
+ let handlebars2 = HandlebarsLib.create();
3125
+ if (options2?.handlebars) {
3126
+ handlebars2 = options2.handlebars;
3127
+ } else if (Object.keys(HandlebarsLib.partials).length > 0) {
3128
+ handlebars2.registerPartial(HandlebarsLib.partials);
3129
+ }
3130
+ registry.load(handlebars2);
3131
+ return handlebars2;
3132
+ }
3133
+ export {
3134
+ Handlebars3 as Handlebars,
3135
+ HelperRegistry,
3136
+ createHandlebars,
3137
+ fumanchu,
3138
+ handlebars,
3139
+ helpers21 as helpers
3140
+ };
3141
+ /* v8 ignore next -- @preserve */
3142
+ /* c8 ignore next -- @preserve */