@takumi-rs/helpers 2.3.2 → 2.4.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/fonts-BXhtO--P.mjs +1 -0
- package/dist/fonts-DI_b5zLT.cjs +1 -0
- package/dist/html.cjs +2 -2
- package/dist/html.mjs +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/jsx.cjs +2 -2
- package/dist/jsx.mjs +2 -2
- package/dist/renderer.cjs +1 -1
- package/dist/renderer.mjs +1 -1
- package/dist/{utils-hT_pgw3g.mjs → utils-C0juSwEF.mjs} +1 -1
- package/dist/{utils-BfucapVz.cjs → utils-Ko9FNHlu.cjs} +1 -1
- package/package.json +1 -1
- package/dist/fonts-Bmi5c76G.mjs +0 -1
- package/dist/fonts-D8OaJ4MQ.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=32*1024*1024,t=/url\(\s*(['"]?)(.*?)\1\s*\)/g;async function n(e,t={}){if(t.allowUrl&&!t.allowUrl(e))throw Error(`URL blocked by allowUrl policy: ${e}`);let n=t.fetch??globalThis.fetch,i=t.timeout??5e3,a=i<=0?void 0:AbortSignal.timeout(i),o=[t.signal,t.init?.signal,a].filter(e=>e!==void 0),s=o.length?AbortSignal.any(o):void 0,c={...t.init,signal:s},l=t.allowUrl?await r(e,t.allowUrl,n,c):await n(e,c);if(!l.ok)throw Error(`HTTP ${l.status} ${l.statusText} fetching ${e}`);return l}async function r(e,t,n,r){let i=e;for(let e=0;e<5;e++){let e=await n(i,{...r,redirect:`manual`}),a=e.headers.get(`location`);if(e.status<300||e.status>=400||!a)return e;if(await e.body?.cancel().catch(()=>{}),i=new URL(a,i).toString(),!t(i))throw Error(`URL blocked by allowUrl policy: ${i}`)}throw Error(`Too many redirects fetching ${e}`)}async function i(e,t){let n=Number(e.headers.get(`content-length`));if(Number.isFinite(n)&&n>t)throw Error(`Response exceeds ${t} bytes (content-length ${n})`);let r=e.body;if(!r)return e.arrayBuffer();let i=r.getReader(),a=[],o=0;for(;;){let{done:e,value:n}=await i.read();if(e)break;if(o+=n.byteLength,o>t)throw await i.cancel().catch(()=>{}),Error(`Response exceeds ${t} bytes`);a.push(n)}let s=new Uint8Array(o),c=0;for(let e of a)s.set(e,c),c+=e.byteLength;return s.buffer}function a(e){return e.startsWith(`https://`)||e.startsWith(`http://`)}function o(e,n){if(typeof e==`string`)for(let r of e.matchAll(t)){let e=r[2]?.trim();e&&a(e)&&n.add(e)}else if(Array.isArray(e))for(let t of e)o(t,n)}function s(e){let t=new Set,n=e=>{let r=e=>{e&&(o(e.backgroundImage,t),o(e.maskImage,t))};if(r(e.style),r(e.preset),o(e.tw,t),e.type===`image`){typeof e.src==`string`&&a(e.src)&&t.add(e.src);return}if(e.type===`container`)for(let t of e.children??[])n(t)};return n(e),[...t]}function c(e,t,r){let a=r?.get(e);if(a)return a;let o=n(e,t).then(e=>i(e,t.maxBytes??33554432)).catch(t=>{throw r?.delete(e),t});return r?.set(e,o),o}async function l({node:e,sources:t=[],fetchCache:n,fetch:r,timeout:i,signal:a,maxBytes:o,allowUrl:l,throwOnError:u=!0}){let d=Array.isArray(e)?e:[e],f=new Map;for(let e of t)f.set(e.src,e);let p=[...new Set(d.flatMap(s))].filter(e=>!f.has(e)),m={fetch:r,timeout:i,signal:a,maxBytes:o,allowUrl:l},h=p.map(async e=>({src:e,data:await c(e,m,n)})),g=u?await Promise.all(h):(await Promise.allSettled(h)).filter(e=>e.status===`fulfilled`).map(e=>e.value);return[...f.values(),...g]}const u=new Map;function d(e,t,n,r){let i=new Map(r),a=n.includes(`italic`),o=a?n.includes(`normal`)?[0,1]:[1]:[void 0],s=[...a?[`ital`]:[],...i.keys(),`wght`].sort(),c=o.flatMap(e=>t.map(t=>s.map(n=>n===`ital`?String(e):n===`wght`?t:i.get(n)??``).join(`,`))).sort();return`${e}:${s.join(`,`)}@${c.join(`;`)}`}function f(e){let t=new URL(e.baseUrl??`https://fonts.googleapis.com/css2`);for(let n of e.families){if(typeof n==`string`){t.searchParams.append(`family`,d(n,[`400`],[`normal`],[]));continue}let e=n.weight??400,r=(Array.isArray(e)?[...e].sort((e,t)=>e-t):[e]).map(String),i=n.style??`normal`,a=(Array.isArray(i)?i:[i]).map(String),o=Object.entries(n.axes??{}).filter(([e])=>e!==`ital`&&e!==`wght`).map(([e,t])=>[e,String(t)]);t.searchParams.append(`family`,d(n.name,r,a,o))}return e.display&&t.searchParams.set(`display`,e.display),t.toString()}function p(e,t){return n(e,{...t,init:{headers:{"User-Agent":`Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36`}}}).then(e=>i(e,t.maxBytes??2097152)).then(e=>new TextDecoder().decode(e))}function m(e,t){let n=t.cache??u,r=n.get(e);if(r)return r;let i=p(e,t);return n.set(e,i),i.catch(()=>n.delete(e)),i}const h=/(?:\/\*\s*([^*]+?)\s*\*\/\s*)?@font-face\s*\{([^}]*)\}/g;function g(e,t,r){let a=`${e.family} ${e.subset}`,o=e.ranges.map(([e,t])=>`${e}-${t}`).join(`,`);return{name:a,subsetOf:e.family,key:`${a}:${e.weight??``}:${e.style??``}:${o}:${r??``}`,weight:e.weight,style:e.style,ranges:e.ranges,generic:r,data:()=>n(e.url,t).then(e=>i(e,t.maxBytes??33554432))}}function _(e){let t=[];for(let n of e.split(`,`)){let e=n.trim().replace(/^U\+/i,``);if(e)if(e.includes(`-`)){let[n,r]=e.split(`-`);n&&r&&t.push([parseInt(n,16),parseInt(r,16)])}else if(e.includes(`?`))t.push([parseInt(e.replace(/\?/g,`0`),16),parseInt(e.replace(/\?/g,`F`),16)]);else{let n=parseInt(e,16);t.push([n,n])}}return t}function v(e){let t=[],n=0;for(let r of e.matchAll(h)){let e=r[2];if(!e)continue;let i=e.match(/src:\s*url\(([^)]+)\)/)?.[1]?.replace(/['"]/g,``).trim(),a=e.match(/font-family:\s*['"]?([^'";]+)['"]?/)?.[1]?.trim();if(!i||!a)continue;let o=e.match(/unicode-range:\s*([^;]+)/)?.[1],s=e.match(/font-weight:\s*(\d+)(?:\s+(\d+))?/);t.push({family:a,subset:r[1]?.trim()||`subset-${n}`,url:i,weight:s&&!s[2]?Number(s[1]):void 0,style:e.match(/font-style:\s*([a-z]+)/i)?.[1],ranges:o?_(o):[]}),n+=1}return t}function y(e){let t=new Map;for(let n of e){let e=t.get(n.url)??new Set;e.add(n.weight),t.set(n.url,e)}let n=new Set,r=[];for(let i of e){if(n.has(i.url))continue;n.add(i.url);let e=(t.get(i.url)?.size??0)>1;r.push(e?{...i,weight:void 0}:i)}return r}function b(e){let t=new Set,n=e=>{for(let n of e)t.add(n.codePointAt(0))},r=e=>{e.type===`text`?n(e.text):e.type===`container`&&e.children?.forEach(r)};return typeof e==`string`?n(e):Array.isArray(e)?e.forEach(r):r(e),t}function x(e,t){if(e.length===0)return!0;for(let n of t)for(let[t,r]of e)if(n>=t&&n<=r)return!0;return!1}function S({fonts:e,source:t}){let n=b(t);return e.filter(e=>x(e.ranges??[],n))}function C(e,t={}){return{key:e,data:()=>n(e,t).then(e=>i(e,t.maxBytes??33554432))}}async function w(e){if(Array.isArray(e)&&(e={families:e}),e.families.length===0)return[];let t=await m(f(e),e),n=new Map(e.families.map((e,t)=>[typeof e==`string`?e:e.name,t])),r=new Map(e.families.flatMap(e=>typeof e==`string`||!e.generic?[]:[[e.name,e.generic]]));return y(v(t)).sort((e,t)=>(n.get(e.family)??0)-(n.get(t.family)??0)).map(t=>g(t,e,r.get(t.family)))}export{e as a,i as c,S as i,C as n,n as o,w as r,l as s,b as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=/url\(\s*(['"]?)(.*?)\1\s*\)/g;async function t(e,t={}){if(t.allowUrl&&!t.allowUrl(e))throw Error(`URL blocked by allowUrl policy: ${e}`);let r=t.fetch??globalThis.fetch,i=t.timeout??5e3,a=i<=0?void 0:AbortSignal.timeout(i),o=[t.signal,t.init?.signal,a].filter(e=>e!==void 0),s=o.length?AbortSignal.any(o):void 0,c={...t.init,signal:s},l=t.allowUrl?await n(e,t.allowUrl,r,c):await r(e,c);if(!l.ok)throw Error(`HTTP ${l.status} ${l.statusText} fetching ${e}`);return l}async function n(e,t,n,r){let i=e;for(let e=0;e<5;e++){let e=await n(i,{...r,redirect:`manual`}),a=e.headers.get(`location`);if(e.status<300||e.status>=400||!a)return e;if(await e.body?.cancel().catch(()=>{}),i=new URL(a,i).toString(),!t(i))throw Error(`URL blocked by allowUrl policy: ${i}`)}throw Error(`Too many redirects fetching ${e}`)}async function r(e,t){let n=Number(e.headers.get(`content-length`));if(Number.isFinite(n)&&n>t)throw Error(`Response exceeds ${t} bytes (content-length ${n})`);let r=e.body;if(!r)return e.arrayBuffer();let i=r.getReader(),a=[],o=0;for(;;){let{done:e,value:n}=await i.read();if(e)break;if(o+=n.byteLength,o>t)throw await i.cancel().catch(()=>{}),Error(`Response exceeds ${t} bytes`);a.push(n)}let s=new Uint8Array(o),c=0;for(let e of a)s.set(e,c),c+=e.byteLength;return s.buffer}function i(e){return e.startsWith(`https://`)||e.startsWith(`http://`)}function a(t,n){if(typeof t==`string`)for(let r of t.matchAll(e)){let e=r[2]?.trim();e&&i(e)&&n.add(e)}else if(Array.isArray(t))for(let e of t)a(e,n)}function o(e){let t=new Set,n=e=>{let r=e=>{e&&(a(e.backgroundImage,t),a(e.maskImage,t))};if(r(e.style),r(e.preset),a(e.tw,t),e.type===`image`){typeof e.src==`string`&&i(e.src)&&t.add(e.src);return}if(e.type===`container`)for(let t of e.children??[])n(t)};return n(e),[...t]}function s(e,n,i){let a=i?.get(e);if(a)return a;let o=t(e,n).then(e=>r(e,n.maxBytes??33554432)).catch(t=>{throw i?.delete(e),t});return i?.set(e,o),o}async function c({node:e,sources:t=[],fetchCache:n,fetch:r,timeout:i,signal:a,maxBytes:c,allowUrl:l,throwOnError:u=!0}){let d=Array.isArray(e)?e:[e],f=new Map;for(let e of t)f.set(e.src,e);let p=[...new Set(d.flatMap(o))].filter(e=>!f.has(e)),m={fetch:r,timeout:i,signal:a,maxBytes:c,allowUrl:l},h=p.map(async e=>({src:e,data:await s(e,m,n)})),g=u?await Promise.all(h):(await Promise.allSettled(h)).filter(e=>e.status===`fulfilled`).map(e=>e.value);return[...f.values(),...g]}const l=new Map;function u(e,t,n,r){let i=new Map(r),a=n.includes(`italic`),o=a?n.includes(`normal`)?[0,1]:[1]:[void 0],s=[...a?[`ital`]:[],...i.keys(),`wght`].sort(),c=o.flatMap(e=>t.map(t=>s.map(n=>n===`ital`?String(e):n===`wght`?t:i.get(n)??``).join(`,`))).sort();return`${e}:${s.join(`,`)}@${c.join(`;`)}`}function d(e){let t=new URL(e.baseUrl??`https://fonts.googleapis.com/css2`);for(let n of e.families){if(typeof n==`string`){t.searchParams.append(`family`,u(n,[`400`],[`normal`],[]));continue}let e=n.weight??400,r=(Array.isArray(e)?[...e].sort((e,t)=>e-t):[e]).map(String),i=n.style??`normal`,a=(Array.isArray(i)?i:[i]).map(String),o=Object.entries(n.axes??{}).filter(([e])=>e!==`ital`&&e!==`wght`).map(([e,t])=>[e,String(t)]);t.searchParams.append(`family`,u(n.name,r,a,o))}return e.display&&t.searchParams.set(`display`,e.display),t.toString()}function f(e,n){return t(e,{...n,init:{headers:{"User-Agent":`Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36`}}}).then(e=>r(e,n.maxBytes??2097152)).then(e=>new TextDecoder().decode(e))}function p(e,t){let n=t.cache??l,r=n.get(e);if(r)return r;let i=f(e,t);return n.set(e,i),i.catch(()=>n.delete(e)),i}const m=/(?:\/\*\s*([^*]+?)\s*\*\/\s*)?@font-face\s*\{([^}]*)\}/g;function h(e,n,i){let a=`${e.family} ${e.subset}`,o=e.ranges.map(([e,t])=>`${e}-${t}`).join(`,`);return{name:a,subsetOf:e.family,key:`${a}:${e.weight??``}:${e.style??``}:${o}:${i??``}`,weight:e.weight,style:e.style,ranges:e.ranges,generic:i,data:()=>t(e.url,n).then(e=>r(e,n.maxBytes??33554432))}}function g(e){let t=[];for(let n of e.split(`,`)){let e=n.trim().replace(/^U\+/i,``);if(e)if(e.includes(`-`)){let[n,r]=e.split(`-`);n&&r&&t.push([parseInt(n,16),parseInt(r,16)])}else if(e.includes(`?`))t.push([parseInt(e.replace(/\?/g,`0`),16),parseInt(e.replace(/\?/g,`F`),16)]);else{let n=parseInt(e,16);t.push([n,n])}}return t}function _(e){let t=[],n=0;for(let r of e.matchAll(m)){let e=r[2];if(!e)continue;let i=e.match(/src:\s*url\(([^)]+)\)/)?.[1]?.replace(/['"]/g,``).trim(),a=e.match(/font-family:\s*['"]?([^'";]+)['"]?/)?.[1]?.trim();if(!i||!a)continue;let o=e.match(/unicode-range:\s*([^;]+)/)?.[1],s=e.match(/font-weight:\s*(\d+)(?:\s+(\d+))?/);t.push({family:a,subset:r[1]?.trim()||`subset-${n}`,url:i,weight:s&&!s[2]?Number(s[1]):void 0,style:e.match(/font-style:\s*([a-z]+)/i)?.[1],ranges:o?g(o):[]}),n+=1}return t}function v(e){let t=new Map;for(let n of e){let e=t.get(n.url)??new Set;e.add(n.weight),t.set(n.url,e)}let n=new Set,r=[];for(let i of e){if(n.has(i.url))continue;n.add(i.url);let e=(t.get(i.url)?.size??0)>1;r.push(e?{...i,weight:void 0}:i)}return r}function y(e){let t=new Set,n=e=>{for(let n of e)t.add(n.codePointAt(0))},r=e=>{e.type===`text`?n(e.text):e.type===`container`&&e.children?.forEach(r)};return typeof e==`string`?n(e):Array.isArray(e)?e.forEach(r):r(e),t}function b(e,t){if(e.length===0)return!0;for(let n of t)for(let[t,r]of e)if(n>=t&&n<=r)return!0;return!1}function x({fonts:e,source:t}){let n=y(t);return e.filter(e=>b(e.ranges??[],n))}function S(e,n={}){return{key:e,data:()=>t(e,n).then(e=>r(e,n.maxBytes??33554432))}}async function C(e){if(Array.isArray(e)&&(e={families:e}),e.families.length===0)return[];let t=await p(d(e),e),n=new Map(e.families.map((e,t)=>[typeof e==`string`?e:e.name,t])),r=new Map(e.families.flatMap(e=>typeof e==`string`||!e.generic?[]:[[e.name,e.generic]]));return v(_(t)).sort((e,t)=>(n.get(e.family)??0)-(n.get(t.family)??0)).map(t=>h(t,e,r.get(t.family)))}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return 33554432}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return y}});
|
package/dist/html.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./helpers-4kGcvc-Q.cjs"),t=require("./utils-
|
|
2
|
-
`,preset:r?.
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./helpers-4kGcvc-Q.cjs"),t=require("./utils-Ko9FNHlu.cjs");var n=Symbol(`Fragment`),r=new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]),i=new Set([`script`,`style`]),a=/(?:<(\/?)([a-zA-Z][a-zA-Z0-9\:-]*)(?:\s([^>]*?))?((?:\s*\/)?)>|(<\!\-\-)([\s\S]*?)(\-\->)|(<\!)([\s\S]*?)(>))/gm,o=64,s=46,c=45,l=58,u=95,d=61,f=34,p=39,m=92;function h(e){return e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||e===o||e===s||e===c||e===l||e===u}function g(e){let t={};if(e){let n=`none`,r,i=``,a;for(let o=0;o<e.length;o++){let s=e.charCodeAt(o);if(n===`none`)h(s)?(r&&(t[r]=i,r=void 0,i=``),a=o,n=`key`):s===d&&r&&(n=`value`);else if(n===`key`)h(s)||(r=e.substring(a,o),n=s===d?`value`:`none`);else if(s===f||s===p){let t=s===f?`"`:`'`,r=o+1,a=e.indexOf(t,r);for(;a>0&&e.charCodeAt(a-1)===m;)a=e.indexOf(t,a+1);if(a===-1)break;i=e.substring(r,a),o=a,n=`none`}}n===`key`&&a!=null&&a<e.length&&(r=e.substring(a,e.length)),r&&(t[r]=i)}return t}function _(e){let t=typeof e==`string`?e:e.value,n,o,s,c,l,u,d,f,p,m=[];a.lastIndex=0,o=n={type:0,children:[]};let h=0;function _(){c=t.substring(h,a.lastIndex-s[0].length),c&&o.children.push({type:2,value:c,parent:o})}for(;s=a.exec(t);){if(u=s[5]||s[8],d=s[6]||s[9],f=s[7]||s[10],i.has(o.name)&&s[2]!==o.name){l=a.lastIndex-s[0].length,o.children.length>0&&(o.children[0].value+=s[0]);continue}else if(u===`<!--`){if(l=a.lastIndex-s[0].length,i.has(o.name))continue;p={type:3,value:d,parent:o,loc:[{start:l,end:l+u.length},{start:a.lastIndex-f.length,end:a.lastIndex}]},m.push(p),p.parent.children.push(p)}else if(u===`<!`)l=a.lastIndex-s[0].length,p={type:4,value:d,parent:o,loc:[{start:l,end:l+u.length},{start:a.lastIndex-f.length,end:a.lastIndex}]},m.push(p),p.parent.children.push(p);else if(s[1]!==`/`)if(_(),i.has(o.name)){h=a.lastIndex,_();continue}else p={type:1,name:s[2]+``,attributes:g(s[3]),parent:o,children:[],loc:[{start:a.lastIndex-s[0].length,end:a.lastIndex}]},m.push(p),p.parent.children.push(p),s[4]&&s[4].indexOf(`/`)>-1||r.has(p.name)?(p.loc[1]=p.loc[0],p.isSelfClosingTag=!0):o=p;else _(),s[2]+``===o.name?(p=o,o=p.parent,p.loc.push({start:a.lastIndex-s[0].length,end:a.lastIndex}),c=t.substring(p.loc[0].end,p.loc[1].start),p.children.length===0&&p.children.push({type:2,value:c,parent:o})):s[2]+``===m[m.length-1].name&&m[m.length-1].isSelfClosingTag===!0&&(p=m[m.length-1],p.loc.push({start:a.lastIndex-s[0].length,end:a.lastIndex}));h=a.lastIndex}return c=t.slice(h),o.children.push({type:2,value:c,parent:o}),n}var v=Symbol(`HTMLString`),y=Symbol(`RenderFn`);function b(e,t=[v]){let n={value:e};for(let e of t)Object.defineProperty(n,e,{value:!0,enumerable:!1,writable:!1});return n}var x={"&":`&`,"<":`<`,">":`>`};function S(e){return e.replace(/[&<>]/g,e=>x[e]||e)}function C(e){let t=``;for(let[n,r]of Object.entries(e))t+=` ${n}="${r}"`;return t}function w(e){if(e.children.length===0){let t=e;for(;t=t.parent;)if(t.name===`svg`)return!0}return!1}function T(e){let{name:t,attributes:i={}}=e,a=e.children.map(e=>E(e)).join(``);if(y in e){let t=e[y](i,b(a));return t&&t[v]?t.value:S(String(t))}if(t===n)return a;let o=w(e);return o||r.has(t)?`<${e.name}${C(i)}${o?` /`:``}>`:`<${e.name}${C(i)}>${a}</${e.name}>`}function E(e){switch(e.type){case 0:return e.children.map(e=>E(e)).join(``);case 1:return T(e);case 2:return`${e.value}`;case 3:return`<!--${e.value}-->`;case 4:return`<!${e.value}>`}}function D(e,n){let r=_(e),i={nodes:[],stylesheets:[]},a=t.u(n?.defaultStyles),o=n?.tailwindClassesProperty??`tw`;for(let e of r.children)O(e,a,o,i.nodes,i.stylesheets);return i}function O(n,r,i,a,o){if(n.type===3)return;if(n.type===2){let t=n.value??``;t&&a.push(e.l({text:t,preset:r?.span}));return}if(n.type===0){for(let e of n.children)O(e,r,i,a,o);return}if(n.type!==1)return;let s=n;if(s.name===`style`){let e=``;for(let t of s.children)t.type===2&&typeof t.value==`string`&&(e+=t.value);e&&o.push(e);return}let c=k(s,r,i);if(s.name===`br`){a.push(e.l({text:`
|
|
2
|
+
`,preset:r?.br,...c}));return}if(s.name===`img`){let t=s.attributes?.src;if(!t)throw Error(`Image element must have a 'src' prop.`);a.push(e.i({src:t,width:I(s.attributes?.width),height:I(s.attributes?.height),...c}));return}if(t.i(s.name))return;if(s.name===`svg`){a.push(e.i({src:E(s),width:I(s.attributes?.width),height:I(s.attributes?.height),...c}));return}let l=!0,u=``;for(let e of s.children)if(e.type!==3){if(e.type!==2){l=!1;break}u+=e.value??``}if(l&&u){a.push(e.l({text:u,...c}));return}let d=[];for(let e of s.children)O(e,r,i,d,o);a.push(e.t({children:d,...c}))}function k(e,n,r){let i=e.attributes?A(e.attributes):{},a=typeof i.style==`string`?P(i.style):void 0,o=t.l(i,r),s=typeof i[r]==`string`?i[r]:void 0,c=n&&e.name in n?n[e.name]:void 0;return{tagName:e.name,className:i.class,id:i.id,dir:i.dir,lang:i.lang,attributes:o,tw:s,style:a,preset:c}}function A(e){let t={};for(let n in e){let r=e[n];r!==void 0&&(t[n]=j(r))}return t}function j(e){return e.includes(`&`)?e.replace(/&(?:#(\d+)|#x([\da-fA-F]+)|([a-zA-Z][\w-]+));/g,(e,t,n,r)=>t?M(Number(t))??e:n?M(Number.parseInt(n,16))??e:N[r]??e):e}function M(e){if(!(!Number.isInteger(e)||e<0||e>1114111))try{return String.fromCodePoint(e)}catch{return}}const N={amp:`&`,apos:`'`,gt:`>`,lt:`<`,nbsp:`\xA0`,quot:`"`};function P(e){let t={};for(let n of e.split(`;`)){let[e,...r]=n.split(`:`);if(!e||r.length===0)continue;let i=e.trim(),a=r.join(`:`).trim();!i||!a||(t[F(i)]=a)}return Object.keys(t).length>0?t:void 0}function F(e){return e.startsWith(`--`)?e:e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function I(e){if(!e)return;let t=Number(e);return Number.isFinite(t)?t:void 0}function L(t){let{nodes:n,stylesheets:r}=D(t);return n.length===0?{node:e.t({}),stylesheets:r}:n.length===1&&n[0]?{node:n[0],stylesheets:r}:{node:e.t({style:{width:e.a(100),height:e.a(100)},children:n}),stylesheets:r}}exports.fromHtml=L;
|
package/dist/html.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e,i as t,l as n,t as r}from"./helpers-CVQCT1Rh.mjs";import{i,l as a,u as o}from"./utils-
|
|
2
|
-
`,preset:a?.
|
|
1
|
+
import{a as e,i as t,l as n,t as r}from"./helpers-CVQCT1Rh.mjs";import{i,l as a,u as o}from"./utils-C0juSwEF.mjs";var s=Symbol(`Fragment`),c=new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]),l=new Set([`script`,`style`]),u=/(?:<(\/?)([a-zA-Z][a-zA-Z0-9\:-]*)(?:\s([^>]*?))?((?:\s*\/)?)>|(<\!\-\-)([\s\S]*?)(\-\->)|(<\!)([\s\S]*?)(>))/gm,d=64,f=46,p=45,m=58,h=95,g=61,_=34,v=39,y=92;function b(e){return e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||e===d||e===f||e===p||e===m||e===h}function x(e){let t={};if(e){let n=`none`,r,i=``,a;for(let o=0;o<e.length;o++){let s=e.charCodeAt(o);if(n===`none`)b(s)?(r&&(t[r]=i,r=void 0,i=``),a=o,n=`key`):s===g&&r&&(n=`value`);else if(n===`key`)b(s)||(r=e.substring(a,o),n=s===g?`value`:`none`);else if(s===_||s===v){let t=s===_?`"`:`'`,r=o+1,a=e.indexOf(t,r);for(;a>0&&e.charCodeAt(a-1)===y;)a=e.indexOf(t,a+1);if(a===-1)break;i=e.substring(r,a),o=a,n=`none`}}n===`key`&&a!=null&&a<e.length&&(r=e.substring(a,e.length)),r&&(t[r]=i)}return t}function S(e){let t=typeof e==`string`?e:e.value,n,r,i,a,o,s,d,f,p,m=[];u.lastIndex=0,r=n={type:0,children:[]};let h=0;function g(){a=t.substring(h,u.lastIndex-i[0].length),a&&r.children.push({type:2,value:a,parent:r})}for(;i=u.exec(t);){if(s=i[5]||i[8],d=i[6]||i[9],f=i[7]||i[10],l.has(r.name)&&i[2]!==r.name){o=u.lastIndex-i[0].length,r.children.length>0&&(r.children[0].value+=i[0]);continue}else if(s===`<!--`){if(o=u.lastIndex-i[0].length,l.has(r.name))continue;p={type:3,value:d,parent:r,loc:[{start:o,end:o+s.length},{start:u.lastIndex-f.length,end:u.lastIndex}]},m.push(p),p.parent.children.push(p)}else if(s===`<!`)o=u.lastIndex-i[0].length,p={type:4,value:d,parent:r,loc:[{start:o,end:o+s.length},{start:u.lastIndex-f.length,end:u.lastIndex}]},m.push(p),p.parent.children.push(p);else if(i[1]!==`/`)if(g(),l.has(r.name)){h=u.lastIndex,g();continue}else p={type:1,name:i[2]+``,attributes:x(i[3]),parent:r,children:[],loc:[{start:u.lastIndex-i[0].length,end:u.lastIndex}]},m.push(p),p.parent.children.push(p),i[4]&&i[4].indexOf(`/`)>-1||c.has(p.name)?(p.loc[1]=p.loc[0],p.isSelfClosingTag=!0):r=p;else g(),i[2]+``===r.name?(p=r,r=p.parent,p.loc.push({start:u.lastIndex-i[0].length,end:u.lastIndex}),a=t.substring(p.loc[0].end,p.loc[1].start),p.children.length===0&&p.children.push({type:2,value:a,parent:r})):i[2]+``===m[m.length-1].name&&m[m.length-1].isSelfClosingTag===!0&&(p=m[m.length-1],p.loc.push({start:u.lastIndex-i[0].length,end:u.lastIndex}));h=u.lastIndex}return a=t.slice(h),r.children.push({type:2,value:a,parent:r}),n}var C=Symbol(`HTMLString`),w=Symbol(`RenderFn`);function T(e,t=[C]){let n={value:e};for(let e of t)Object.defineProperty(n,e,{value:!0,enumerable:!1,writable:!1});return n}var E={"&":`&`,"<":`<`,">":`>`};function D(e){return e.replace(/[&<>]/g,e=>E[e]||e)}function O(e){let t=``;for(let[n,r]of Object.entries(e))t+=` ${n}="${r}"`;return t}function k(e){if(e.children.length===0){let t=e;for(;t=t.parent;)if(t.name===`svg`)return!0}return!1}function A(e){let{name:t,attributes:n={}}=e,r=e.children.map(e=>j(e)).join(``);if(w in e){let t=e[w](n,T(r));return t&&t[C]?t.value:D(String(t))}if(t===s)return r;let i=k(e);return i||c.has(t)?`<${e.name}${O(n)}${i?` /`:``}>`:`<${e.name}${O(n)}>${r}</${e.name}>`}function j(e){switch(e.type){case 0:return e.children.map(e=>j(e)).join(``);case 1:return A(e);case 2:return`${e.value}`;case 3:return`<!--${e.value}-->`;case 4:return`<!${e.value}>`}}function M(e,t){let n=S(e),r={nodes:[],stylesheets:[]},i=o(t?.defaultStyles),a=t?.tailwindClassesProperty??`tw`;for(let e of n.children)N(e,i,a,r.nodes,r.stylesheets);return r}function N(e,a,o,s,c){if(e.type===3)return;if(e.type===2){let t=e.value??``;t&&s.push(n({text:t,preset:a?.span}));return}if(e.type===0){for(let t of e.children)N(t,a,o,s,c);return}if(e.type!==1)return;let l=e;if(l.name===`style`){let e=``;for(let t of l.children)t.type===2&&typeof t.value==`string`&&(e+=t.value);e&&c.push(e);return}let u=P(l,a,o);if(l.name===`br`){s.push(n({text:`
|
|
2
|
+
`,preset:a?.br,...u}));return}if(l.name===`img`){let e=l.attributes?.src;if(!e)throw Error(`Image element must have a 'src' prop.`);s.push(t({src:e,width:V(l.attributes?.width),height:V(l.attributes?.height),...u}));return}if(i(l.name))return;if(l.name===`svg`){s.push(t({src:j(l),width:V(l.attributes?.width),height:V(l.attributes?.height),...u}));return}let d=!0,f=``;for(let e of l.children)if(e.type!==3){if(e.type!==2){d=!1;break}f+=e.value??``}if(d&&f){s.push(n({text:f,...u}));return}let p=[];for(let e of l.children)N(e,a,o,p,c);s.push(r({children:p,...u}))}function P(e,t,n){let r=e.attributes?F(e.attributes):{},i=typeof r.style==`string`?z(r.style):void 0,o=a(r,n),s=typeof r[n]==`string`?r[n]:void 0,c=t&&e.name in t?t[e.name]:void 0;return{tagName:e.name,className:r.class,id:r.id,dir:r.dir,lang:r.lang,attributes:o,tw:s,style:i,preset:c}}function F(e){let t={};for(let n in e){let r=e[n];r!==void 0&&(t[n]=I(r))}return t}function I(e){return e.includes(`&`)?e.replace(/&(?:#(\d+)|#x([\da-fA-F]+)|([a-zA-Z][\w-]+));/g,(e,t,n,r)=>t?L(Number(t))??e:n?L(Number.parseInt(n,16))??e:R[r]??e):e}function L(e){if(!(!Number.isInteger(e)||e<0||e>1114111))try{return String.fromCodePoint(e)}catch{return}}const R={amp:`&`,apos:`'`,gt:`>`,lt:`<`,nbsp:`\xA0`,quot:`"`};function z(e){let t={};for(let n of e.split(`;`)){let[e,...r]=n.split(`:`);if(!e||r.length===0)continue;let i=e.trim(),a=r.join(`:`).trim();!i||!a||(t[B(i)]=a)}return Object.keys(t).length>0?t:void 0}function B(e){return e.startsWith(`--`)?e:e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function V(e){if(!e)return;let t=Number(e);return Number.isFinite(t)?t:void 0}function H(t){let{nodes:n,stylesheets:i}=M(t);return n.length===0?{node:r({}),stylesheets:i}:n.length===1&&n[0]?{node:n[0],stylesheets:i}:{node:r({style:{width:e(100),height:e(100)},children:n}),stylesheets:i}}export{H as fromHtml};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./fonts-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./fonts-DI_b5zLT.cjs"),t=require("./helpers-4kGcvc-Q.cjs");exports.collectCodepoints=e.t,exports.container=t.t,exports.defaultMaxFetchBytes=e.a,exports.em=t.n,exports.fetchOk=e.o,exports.fontFromUrl=e.n,exports.fr=t.r,exports.googleFonts=e.r,exports.image=t.i,exports.percentage=t.a,exports.prepareImages=e.s,exports.readBodyLimited=e.c,exports.rem=t.o,exports.rgba=t.s,exports.style=t.c,exports.subsetFonts=e.i,exports.text=t.l,exports.vh=t.u,exports.vw=t.d;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,c as t,i as n,n as r,o as i,r as a,s as o,t as s}from"./fonts-
|
|
1
|
+
import{a as e,c as t,i as n,n as r,o as i,r as a,s as o,t as s}from"./fonts-BXhtO--P.mjs";import{a as c,c as l,d as u,i as d,l as f,n as p,o as m,r as h,s as g,t as _,u as v}from"./helpers-CVQCT1Rh.mjs";export{s as collectCodepoints,_ as container,e as defaultMaxFetchBytes,p as em,i as fetchOk,r as fontFromUrl,h as fr,a as googleFonts,d as image,c as percentage,o as prepareImages,t as readBodyLimited,m as rem,g as rgba,l as style,n as subsetFonts,f as text,v as vh,u as vw};
|
package/dist/jsx.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./helpers-4kGcvc-Q.cjs"),t=require("./utils-
|
|
2
|
-
`,preset:r.presets?.
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./helpers-4kGcvc-Q.cjs"),t=require("./utils-Ko9FNHlu.cjs");let n;function r(e,t){return typeof e==`object`&&e&&t in e?e[t]:void 0}function i(e){return typeof e==`object`&&!!e&&`then`in e&&typeof e.then==`function`}function a(e){let t=r(e,`__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE`);if(typeof t==`object`&&t&&`H`in t){let e=t;return{get:()=>e.H,set:t=>{e.H=t}}}let n=r(r(e,`__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED`),`ReactCurrentDispatcher`);if(typeof n==`object`&&n&&`current`in n){let e=n;return{get:()=>e.current,set:t=>{e.current=t}}}return null}function o(){return n??=import(`react`).then(e=>a(e.default??e)).catch(()=>null),n}function s(e,t){return e.contexts.has(t)?e.contexts.get(t):r(t,`_currentValue`)}const c=()=>{};function l(e,t){let n=t=>s(e,t),r=0;return{readContext:n,useContext:n,use:e=>{if(i(e)){if(e.status===`fulfilled`)return e.value;throw e.status===`rejected`?e.reason:e}return n(e)},useState:e=>[typeof e==`function`?e():e,c],useReducer:(e,t,n)=>[n?n(t):t,c],useMemo:e=>e(),useCallback:e=>e,useRef:e=>({current:e}),useEffect:c,useLayoutEffect:c,useInsertionEffect:c,useImperativeHandle:c,useDebugValue:c,useDeferredValue:e=>e,useTransition:()=>[!1,c],useOptimistic:e=>[e,c],useActionState:(e,t)=>[t,c,!1],useSyncExternalStore:(e,t,n)=>(n??t)(),useId:()=>`:t${t}-${r++}:`,useCacheRefresh:()=>c,useHostTransitionStatus:()=>({pending:!1,data:null,method:null,action:null})}}async function u(e,t,n){let r=await o();if(!r)return e(t);let a=n.ids.current++;for(let o=0;;o++){let s=r.get();r.set(l(n,a));let c;try{return e(t)}catch(e){c=e}finally{r.set(s)}if(!i(c)||o>=64)throw c;await d(c)}}async function d(e){try{e.value=await e,e.status=`fulfilled`}catch(t){e.reason=t,e.status=`rejected`}}function f(e){return typeof e==`string`||typeof e==`number`}function p(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`)}function m(e){let n=[];for(let r in e)Object.hasOwn(e,r)&&n.push(`${t.t(r)}:${String(e[r]).trim()}`);return n.join(`;`)}const h=new Set(`stopColor.stopOpacity.strokeWidth.strokeDasharray.strokeDashoffset.strokeLinecap.strokeLinejoin.fillRule.clipRule.colorInterpolationFilters.floodColor.floodOpacity.accentHeight.alignmentBaseline.arabicForm.baselineShift.capHeight.clipPath.clipPathUnits.colorInterpolation.colorProfile.colorRendering.enableBackground.fillOpacity.fontFamily.fontSize.fontSizeAdjust.fontStretch.fontStyle.fontVariant.fontWeight.glyphName.glyphOrientationHorizontal.glyphOrientationVertical.horizAdvX.horizOriginX.imageRendering.letterSpacing.lightingColor.markerEnd.markerMid.markerStart.overlinePosition.overlineThickness.paintOrder.preserveAspectRatio.pointerEvents.shapeRendering.strokeMiterlimit.strokeOpacity.textAnchor.textDecoration.textRendering.transformOrigin.underlinePosition.underlineThickness.unicodeBidi.unicodeRange.unitsPerEm.vectorEffect.vertAdvY.vertOriginX.vertOriginY.vAlphabetic.vHanging.vIdeographic.vMathematical.wordSpacing.writingMode`.split(`.`));function g(e,n){if(e===`children`||n==null)return;let r;if(r=e===`className`?`class`:h.has(e)?t.t(e):e,typeof n==`boolean`)return`${r}="${String(n)}"`;if(e===`style`&&typeof n==`object`){let e=m(n);if(e)return`style="${p(e)}"`}return`${r}="${p(String(n))}"`}function _(e,t,n){let r=!1;for(let n in e){if(!Object.hasOwn(e,n))continue;let i=g(n,e[n]);i!==void 0&&(t.push(` `,i),n===`xmlns`&&(r=!0))}n&&!r&&t.push(` xmlns="http://www.w3.org/2000/svg"`)}const v=(e,n,r)=>{let i=e.props||{};if(t.n(e.type)){y(e.type(e.props),n,!1);return}if(typeof e.type==`symbol`||typeof e.type!=`string`)return;n.push(`<`,e.type),_(i,n,r&&e.type===`svg`);let a=i.children;n.push(`>`),y(a,n,!1),n.push(`</`,e.type,`>`)};function y(e,n,r){if(!(e==null||e===!1)){if(f(e)){n.push(String(e));return}if(Array.isArray(e)){for(let t of e)y(t,n,!1);return}t.c(e)&&v(e,n,r)}}function b(e){let t=[];return y(e,t,!0),t.join(``)}function x({width:e,height:t,data:n,premultiplied:r,...i}){return{type:`img`,props:{...i,src:{width:e,height:t,data:n,premultiplied:r}},key:null}}function S(){return{nodes:[],stylesheets:[]}}async function C(n,r){let i=await w(n,{defaultStyles:T(r),presets:t.u(r?.defaultStyles),tailwindClassesProperty:r?.tailwindClassesProperty??`tw`,contexts:new Map,ids:{current:0}}),a=i.nodes,o;return o=a.length===0?e.t({}):a.length===1&&a[0]!==void 0?a[0]:e.t({children:a,style:{width:e.a(100),height:e.a(100)}}),{node:o,stylesheets:i.stylesheets}}async function w(n,r){return n==null||n===!1?S():n instanceof Promise?w(await n,r):typeof n==`object`&&Symbol.iterator in n?q(n,r):t.c(n)?await B(n,r):{nodes:[e.l({text:String(n),preset:r.presets?.span})],stylesheets:[]}}function T(e){return e&&`defaultStyles`in e?e.defaultStyles??t.d:t.d}const E=Symbol.for(`react.context`),D=Symbol.for(`react.provider`),O=Symbol.for(`react.consumer`);function k(e,t){let n=e.type;if(typeof n!=`object`||!n)return;let i=r(n,`$$typeof`);if(i===D)return A(e,r(n,`_context`),t);if(i===O)return M(e,r(n,`_context`)??n,t);if(i===E)return typeof F(e)==`function`?M(e,n,t):A(e,n,t)}function A(e,t,n){let i=new Map(n.contexts);return i.set(t,r(e.props,`value`)),K(e,{...n,contexts:i})}function j(e){return typeof e==`function`}function M(e,t,n){let r=F(e);return j(r)?w(r(s(n,t)),n):K(e,n)}async function N(e,t,n){return w(await u(e,t,n),n)}function P(e,n){if(!(typeof e.type!=`object`||e.type===null)){if(t.a(e.type)&&`render`in e.type){let t=e.type;return N(e=>t.render(e,null),e.props,n)}if(t.s(e.type)&&`type`in e.type){let r=e.type.type;return t.n(r)?N(r,e.props,n):B({...e,type:r},n)}}}function F(e){if(typeof e.props==`object`&&e.props!==null&&`children`in e.props)return e.props.children}function I(e){if(!t.c(e))return;let n=F(e);if(typeof n==`string`)return n;if(typeof n==`number`)return String(n);if(Array.isArray(n)||typeof n==`object`&&n&&Symbol.iterator in n)return z(n);if(t.c(n)&&t.o(n))return I(n)}function L(e){let t=[];for(let n of e){let e=R(n);if(e===void 0)return;t.push(e)}return t.join(``)}function R(e){if(typeof e==`string`)return e;if(typeof e==`number`)return String(e);if(e==null||typeof e==`boolean`||typeof e==`symbol`)return``;if(typeof e==`object`&&Symbol.iterator in e)return L(e);if(!t.c(e))return;if(t.o(e))return R(F(e));let n=F(e);return n===void 0?``:typeof n==`object`&&n&&Symbol.iterator in n?L(n):R(n)}function z(e){let n=[],r=!1;for(let i of e){if(t.c(i))return;if(typeof i==`string`){r=!0,n.push(i);continue}if(typeof i==`number`){r=!0,n.push(String(i));continue}return}if(r)return n.join(``)}async function B(n,r){let i=k(n,r);if(i!==void 0)return i;if(t.n(n.type))return N(n.type,n.props,r);let a=P(n,r);if(a!==void 0)return a;if(t.o(n))return K(n,r);if(t.r(n,`style`)){let e=R(F(n));return{nodes:[],stylesheets:e&&e.length>0?[e]:[]}}if(typeof n.type!=`string`||t.i(n.type))return S();let o=G(n,r);if(t.r(n,`br`))return{nodes:[e.l({text:`
|
|
2
|
+
`,preset:r.presets?.br,...o})],stylesheets:[]};if(t.r(n,`img`))return{nodes:[V(n,r)],stylesheets:[]};if(t.r(n,`svg`))return{nodes:[H(n,r)],stylesheets:[]};let s=I(n);if(s!==void 0)return{nodes:[e.l({text:s,...o})],stylesheets:[]};let c=await K(n,r);return{nodes:[e.t({children:c.nodes,...o})],stylesheets:c.stylesheets}}function V(t,n){if(!t.props.src)throw Error(`Image element must have a 'src' prop.`);let r=G(t,n),i=t.props.width===void 0?void 0:Number(t.props.width),a=t.props.height===void 0?void 0:Number(t.props.height);return e.i({src:t.props.src,width:i,height:a,...r})}function H(t,n){let r=G(t,n);return e.i({src:b(t),width:t.props.width===void 0?void 0:Number(t.props.width),height:t.props.height===void 0?void 0:Number(t.props.height),...r})}function U(e,t){let n=t.presets,r=n&&typeof e.type==`string`&&e.type in n?n[e.type]:void 0,i=typeof e.props==`object`&&e.props!==null&&`style`in e.props&&typeof e.props.style==`object`&&e.props.style!==null?e.props.style:void 0;if(!i)return{preset:r};for(let e in i)if(Object.hasOwn(i,e))return{preset:r,style:i};return{preset:r}}function W(e,t){let n=t.tailwindClassesProperty;if(typeof e.props!=`object`||e.props===null||!(n in e.props))return;let r=e.props[n];if(typeof r==`string`)return r}function G(e,n){let r=e.props,{preset:i,style:a}=U(e,n),o=W(e,n),s=t.l(r,n.tailwindClassesProperty);return{tagName:typeof e.type==`string`?e.type:void 0,className:r.className??r.class,id:r.id,dir:r.dir,lang:r.lang,attributes:s,tw:o,style:a,preset:i}}function K(e,t){let n=F(e);return n===void 0?Promise.resolve(S()):w(n,t)}async function q(e,t){let n=[],r=new Set,i=0;for(let a of e){let e=i;i+=1;let o=w(a,t).then(t=>{n[e]=t}).finally(()=>r.delete(o));r.add(o),r.size>=8&&await Promise.race(r)}await Promise.all(r);let a=[],o=[];for(let e of n)e&&(a.push(...e.nodes),o.push(...e.stylesheets));return{nodes:a,stylesheets:o}}exports.Bitmap=x,exports.defaultStylePresets=t.d,exports.fromJsx=C;
|
package/dist/jsx.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e,i as t,l as n,t as r}from"./helpers-CVQCT1Rh.mjs";import{a as i,c as a,d as o,i as s,l as c,n as l,o as u,r as d,s as f,t as p,u as m}from"./utils-
|
|
2
|
-
`,preset:t.presets?.
|
|
1
|
+
import{a as e,i as t,l as n,t as r}from"./helpers-CVQCT1Rh.mjs";import{a as i,c as a,d as o,i as s,l as c,n as l,o as u,r as d,s as f,t as p,u as m}from"./utils-C0juSwEF.mjs";let h;function g(e,t){return typeof e==`object`&&e&&t in e?e[t]:void 0}function _(e){return typeof e==`object`&&!!e&&`then`in e&&typeof e.then==`function`}function v(e){let t=g(e,`__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE`);if(typeof t==`object`&&t&&`H`in t){let e=t;return{get:()=>e.H,set:t=>{e.H=t}}}let n=g(g(e,`__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED`),`ReactCurrentDispatcher`);if(typeof n==`object`&&n&&`current`in n){let e=n;return{get:()=>e.current,set:t=>{e.current=t}}}return null}function y(){return h??=import(`react`).then(e=>v(e.default??e)).catch(()=>null),h}function b(e,t){return e.contexts.has(t)?e.contexts.get(t):g(t,`_currentValue`)}const x=()=>{};function ee(e,t){let n=t=>b(e,t),r=0;return{readContext:n,useContext:n,use:e=>{if(_(e)){if(e.status===`fulfilled`)return e.value;throw e.status===`rejected`?e.reason:e}return n(e)},useState:e=>[typeof e==`function`?e():e,x],useReducer:(e,t,n)=>[n?n(t):t,x],useMemo:e=>e(),useCallback:e=>e,useRef:e=>({current:e}),useEffect:x,useLayoutEffect:x,useInsertionEffect:x,useImperativeHandle:x,useDebugValue:x,useDeferredValue:e=>e,useTransition:()=>[!1,x],useOptimistic:e=>[e,x],useActionState:(e,t)=>[t,x,!1],useSyncExternalStore:(e,t,n)=>(n??t)(),useId:()=>`:t${t}-${r++}:`,useCacheRefresh:()=>x,useHostTransitionStatus:()=>({pending:!1,data:null,method:null,action:null})}}async function te(e,t,n){let r=await y();if(!r)return e(t);let i=n.ids.current++;for(let a=0;;a++){let o=r.get();r.set(ee(n,i));let s;try{return e(t)}catch(e){s=e}finally{r.set(o)}if(!_(s)||a>=64)throw s;await S(s)}}async function S(e){try{e.value=await e,e.status=`fulfilled`}catch(t){e.reason=t,e.status=`rejected`}}function C(e){return typeof e==`string`||typeof e==`number`}function w(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`)}function T(e){let t=[];for(let n in e)Object.hasOwn(e,n)&&t.push(`${p(n)}:${String(e[n]).trim()}`);return t.join(`;`)}const E=new Set(`stopColor.stopOpacity.strokeWidth.strokeDasharray.strokeDashoffset.strokeLinecap.strokeLinejoin.fillRule.clipRule.colorInterpolationFilters.floodColor.floodOpacity.accentHeight.alignmentBaseline.arabicForm.baselineShift.capHeight.clipPath.clipPathUnits.colorInterpolation.colorProfile.colorRendering.enableBackground.fillOpacity.fontFamily.fontSize.fontSizeAdjust.fontStretch.fontStyle.fontVariant.fontWeight.glyphName.glyphOrientationHorizontal.glyphOrientationVertical.horizAdvX.horizOriginX.imageRendering.letterSpacing.lightingColor.markerEnd.markerMid.markerStart.overlinePosition.overlineThickness.paintOrder.preserveAspectRatio.pointerEvents.shapeRendering.strokeMiterlimit.strokeOpacity.textAnchor.textDecoration.textRendering.transformOrigin.underlinePosition.underlineThickness.unicodeBidi.unicodeRange.unitsPerEm.vectorEffect.vertAdvY.vertOriginX.vertOriginY.vAlphabetic.vHanging.vIdeographic.vMathematical.wordSpacing.writingMode`.split(`.`));function D(e,t){if(e===`children`||t==null)return;let n;if(n=e===`className`?`class`:E.has(e)?p(e):e,typeof t==`boolean`)return`${n}="${String(t)}"`;if(e===`style`&&typeof t==`object`){let e=T(t);if(e)return`style="${w(e)}"`}return`${n}="${w(String(t))}"`}function O(e,t,n){let r=!1;for(let n in e){if(!Object.hasOwn(e,n))continue;let i=D(n,e[n]);i!==void 0&&(t.push(` `,i),n===`xmlns`&&(r=!0))}n&&!r&&t.push(` xmlns="http://www.w3.org/2000/svg"`)}const k=(e,t,n)=>{let r=e.props||{};if(l(e.type)){A(e.type(e.props),t,!1);return}if(typeof e.type==`symbol`||typeof e.type!=`string`)return;t.push(`<`,e.type),O(r,t,n&&e.type===`svg`);let i=r.children;t.push(`>`),A(i,t,!1),t.push(`</`,e.type,`>`)};function A(e,t,n){if(!(e==null||e===!1)){if(C(e)){t.push(String(e));return}if(Array.isArray(e)){for(let n of e)A(n,t,!1);return}a(e)&&k(e,t,n)}}function j(e){let t=[];return A(e,t,!0),t.join(``)}function M({width:e,height:t,data:n,premultiplied:r,...i}){return{type:`img`,props:{...i,src:{width:e,height:t,data:n,premultiplied:r}},key:null}}function N(){return{nodes:[],stylesheets:[]}}async function P(t,n){let i=await F(t,{defaultStyles:I(n),presets:m(n?.defaultStyles),tailwindClassesProperty:n?.tailwindClassesProperty??`tw`,contexts:new Map,ids:{current:0}}),a=i.nodes,o;return o=a.length===0?r({}):a.length===1&&a[0]!==void 0?a[0]:r({children:a,style:{width:e(100),height:e(100)}}),{node:o,stylesheets:i.stylesheets}}async function F(e,t){return e==null||e===!1?N():e instanceof Promise?F(await e,t):typeof e==`object`&&Symbol.iterator in e?oe(e,t):a(e)?await Z(e,t):{nodes:[n({text:String(e),preset:t.presets?.span})],stylesheets:[]}}function I(e){return e&&`defaultStyles`in e?e.defaultStyles??o:o}const L=Symbol.for(`react.context`),R=Symbol.for(`react.provider`),z=Symbol.for(`react.consumer`);function B(e,t){let n=e.type;if(typeof n!=`object`||!n)return;let r=g(n,`$$typeof`);if(r===R)return V(e,g(n,`_context`),t);if(r===z)return U(e,g(n,`_context`)??n,t);if(r===L)return typeof K(e)==`function`?U(e,n,t):V(e,n,t)}function V(e,t,n){let r=new Map(n.contexts);return r.set(t,g(e.props,`value`)),$(e,{...n,contexts:r})}function H(e){return typeof e==`function`}function U(e,t,n){let r=K(e);return H(r)?F(r(b(n,t)),n):$(e,n)}async function W(e,t,n){return F(await te(e,t,n),n)}function G(e,t){if(!(typeof e.type!=`object`||e.type===null)){if(i(e.type)&&`render`in e.type){let n=e.type;return W(e=>n.render(e,null),e.props,t)}if(f(e.type)&&`type`in e.type){let n=e.type.type;return l(n)?W(n,e.props,t):Z({...e,type:n},t)}}}function K(e){if(typeof e.props==`object`&&e.props!==null&&`children`in e.props)return e.props.children}function q(e){if(!a(e))return;let t=K(e);if(typeof t==`string`)return t;if(typeof t==`number`)return String(t);if(Array.isArray(t)||typeof t==`object`&&t&&Symbol.iterator in t)return X(t);if(a(t)&&u(t))return q(t)}function J(e){let t=[];for(let n of e){let e=Y(n);if(e===void 0)return;t.push(e)}return t.join(``)}function Y(e){if(typeof e==`string`)return e;if(typeof e==`number`)return String(e);if(e==null||typeof e==`boolean`||typeof e==`symbol`)return``;if(typeof e==`object`&&Symbol.iterator in e)return J(e);if(!a(e))return;if(u(e))return Y(K(e));let t=K(e);return t===void 0?``:typeof t==`object`&&t&&Symbol.iterator in t?J(t):Y(t)}function X(e){let t=[],n=!1;for(let r of e){if(a(r))return;if(typeof r==`string`){n=!0,t.push(r);continue}if(typeof r==`number`){n=!0,t.push(String(r));continue}return}if(n)return t.join(``)}async function Z(e,t){let i=B(e,t);if(i!==void 0)return i;if(l(e.type))return W(e.type,e.props,t);let a=G(e,t);if(a!==void 0)return a;if(u(e))return $(e,t);if(d(e,`style`)){let t=Y(K(e));return{nodes:[],stylesheets:t&&t.length>0?[t]:[]}}if(typeof e.type!=`string`||s(e.type))return N();let o=Q(e,t);if(d(e,`br`))return{nodes:[n({text:`
|
|
2
|
+
`,preset:t.presets?.br,...o})],stylesheets:[]};if(d(e,`img`))return{nodes:[ne(e,t)],stylesheets:[]};if(d(e,`svg`))return{nodes:[re(e,t)],stylesheets:[]};let c=q(e);if(c!==void 0)return{nodes:[n({text:c,...o})],stylesheets:[]};let f=await $(e,t);return{nodes:[r({children:f.nodes,...o})],stylesheets:f.stylesheets}}function ne(e,n){if(!e.props.src)throw Error(`Image element must have a 'src' prop.`);let r=Q(e,n),i=e.props.width===void 0?void 0:Number(e.props.width),a=e.props.height===void 0?void 0:Number(e.props.height);return t({src:e.props.src,width:i,height:a,...r})}function re(e,n){let r=Q(e,n);return t({src:j(e),width:e.props.width===void 0?void 0:Number(e.props.width),height:e.props.height===void 0?void 0:Number(e.props.height),...r})}function ie(e,t){let n=t.presets,r=n&&typeof e.type==`string`&&e.type in n?n[e.type]:void 0,i=typeof e.props==`object`&&e.props!==null&&`style`in e.props&&typeof e.props.style==`object`&&e.props.style!==null?e.props.style:void 0;if(!i)return{preset:r};for(let e in i)if(Object.hasOwn(i,e))return{preset:r,style:i};return{preset:r}}function ae(e,t){let n=t.tailwindClassesProperty;if(typeof e.props!=`object`||e.props===null||!(n in e.props))return;let r=e.props[n];if(typeof r==`string`)return r}function Q(e,t){let n=e.props,{preset:r,style:i}=ie(e,t),a=ae(e,t),o=c(n,t.tailwindClassesProperty);return{tagName:typeof e.type==`string`?e.type:void 0,className:n.className??n.class,id:n.id,dir:n.dir,lang:n.lang,attributes:o,tw:a,style:i,preset:r}}function $(e,t){let n=K(e);return n===void 0?Promise.resolve(N()):F(n,t)}async function oe(e,t){let n=[],r=new Set,i=0;for(let a of e){let e=i;i+=1;let o=F(a,t).then(t=>{n[e]=t}).finally(()=>r.delete(o));r.add(o),r.size>=8&&await Promise.race(r)}await Promise.all(r);let a=[],o=[];for(let e of n)e&&(a.push(...e.nodes),o.push(...e.stylesheets));return{nodes:a,stylesheets:o}}export{M as Bitmap,o as defaultStylePresets,P as fromJsx};
|
package/dist/renderer.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./fonts-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./fonts-DI_b5zLT.cjs");function t(e){return e instanceof Uint8Array||e instanceof ArrayBuffer||typeof Buffer<`u`&&Buffer.isBuffer(e)}function n(e){return t(e)?e:typeof e.data==`function`?e.data():e.data}function r(e){return t(e)?e:`key`in e&&e.key?e.key:typeof e.data==`function`?`${e.name??``}:${e.weight??``}:${e.style??``}`:e.data}async function i(e){let{sources:t=[],cache:n}=Array.isArray(e)?{sources:e}:e,r=new Map;for(let e of t)r.set(e.src,e);return Promise.all([...r.values()].map(async({src:e,data:t,cache:r})=>({src:e,data:typeof t==`function`?await t():t,cache:r??n})))}var a=class{registerInner;byKey=new Map;byData=new WeakMap;constructor(e){this.registerInner=e}getFont(e){return typeof e==`string`?this.byKey.get(e):this.byData.get(e)}setFont(e,t){typeof e==`string`?this.byKey.set(e,t):this.byData.set(e,t)}deleteFont(e){typeof e==`string`?this.byKey.delete(e):this.byData.delete(e)}async register(i){let a=typeof i==`string`?e.n(i):i,o=r(a),s=this.getFont(o);if(s)return s;let c=n(a),l=Promise.resolve(c).then(e=>this.registerInner(t(a)?e:{...a,data:e})).catch(e=>{throw this.deleteFont(o),e});return this.setFont(o,l),l}async prepareFonts(e){if(!e)return;let t=await Promise.all(e.map(e=>this.register(e)));return[...new Set(t.flat().map(e=>e.name))]}async resolveResources(e,t,n){let r=await this.prepareFonts(e);return{images:t?await i(t):void 0,fontFamilies:n??r}}};async function o(t,n,r){let{fonts:i,fontFamilies:a,signal:o,images:s,...c}=n;o?.throwIfAborted();let l=await i,u=await t.resolveResources(l&&e.i({fonts:l,source:r}),s,a);return o?.throwIfAborted(),{options:{...c,...u},signal:o}}exports.FontRegistry=a,exports.prepareRenderInput=o,exports.resolveImageLoaders=i;
|
package/dist/renderer.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,n as t}from"./fonts-
|
|
1
|
+
import{i as e,n as t}from"./fonts-BXhtO--P.mjs";function n(e){return e instanceof Uint8Array||e instanceof ArrayBuffer||typeof Buffer<`u`&&Buffer.isBuffer(e)}function r(e){return n(e)?e:typeof e.data==`function`?e.data():e.data}function i(e){return n(e)?e:`key`in e&&e.key?e.key:typeof e.data==`function`?`${e.name??``}:${e.weight??``}:${e.style??``}`:e.data}async function a(e){let{sources:t=[],cache:n}=Array.isArray(e)?{sources:e}:e,r=new Map;for(let e of t)r.set(e.src,e);return Promise.all([...r.values()].map(async({src:e,data:t,cache:r})=>({src:e,data:typeof t==`function`?await t():t,cache:r??n})))}var o=class{registerInner;byKey=new Map;byData=new WeakMap;constructor(e){this.registerInner=e}getFont(e){return typeof e==`string`?this.byKey.get(e):this.byData.get(e)}setFont(e,t){typeof e==`string`?this.byKey.set(e,t):this.byData.set(e,t)}deleteFont(e){typeof e==`string`?this.byKey.delete(e):this.byData.delete(e)}async register(e){let a=typeof e==`string`?t(e):e,o=i(a),s=this.getFont(o);if(s)return s;let c=r(a),l=Promise.resolve(c).then(e=>this.registerInner(n(a)?e:{...a,data:e})).catch(e=>{throw this.deleteFont(o),e});return this.setFont(o,l),l}async prepareFonts(e){if(!e)return;let t=await Promise.all(e.map(e=>this.register(e)));return[...new Set(t.flat().map(e=>e.name))]}async resolveResources(e,t,n){let r=await this.prepareFonts(e);return{images:t?await a(t):void 0,fontFamilies:n??r}}};async function s(t,n,r){let{fonts:i,fontFamilies:a,signal:o,images:s,...c}=n;o?.throwIfAborted();let l=await i,u=await t.resolveResources(l&&e({fonts:l,source:r}),s,a);return o?.throwIfAborted(),{options:{...c,...u},signal:o}}export{o as FontRegistry,s as prepareRenderInput,a as resolveImageLoaders};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e={html:{display:`block`},head:{display:`none`},meta:{display:`none`},title:{display:`none`},link:{display:`none`},style:{display:`none`},script:{display:`none`},noscript:{display:`none`},datalist:{display:`none`},template:{display:`none`},body:{margin:8,display:`block`},p:{marginTop:`1em`,marginBottom:`1em`,display:`block`},blockquote:{marginTop:`1em`,marginBottom:`1em`,marginLeft:40,marginRight:40,display:`block`},figure:{marginTop:`1em`,marginBottom:`1em`,marginLeft:40,marginRight:40,display:`block`},figcaption:{display:`block`},address:{fontStyle:`italic`,display:`block`},article:{display:`block`},aside:{display:`block`},footer:{display:`block`},header:{display:`block`},hgroup:{display:`block`},main:{display:`block`},nav:{display:`block`},section:{display:`block`},center:{textAlign:`center`,display:`block`},hr:{marginTop:`0.5em`,marginBottom:`0.5em`,marginLeft:`auto`,marginRight:`auto`,borderWidth:1,display:`block`},ul:{marginTop:`1em`,marginBottom:`1em`,paddingLeft:40,display:`block`},ol:{marginTop:`1em`,marginBottom:`1em`,paddingLeft:40,display:`block`},menu:{marginTop:`1em`,marginBottom:`1em`,paddingLeft:40,display:`block`},li:{display:`block`},dl:{marginTop:`1em`,marginBottom:`1em`,display:`block`},dt:{display:`block`},dd:{marginLeft:40,display:`block`},form:{display:`block`},fieldset:{marginLeft:2,marginRight:2,paddingTop:`0.35em`,paddingRight:`0.75em`,paddingBottom:`0.625em`,paddingLeft:`0.75em`,borderWidth:2,display:`block`},legend:{paddingLeft:2,paddingRight:2,display:`block`},details:{display:`block`},summary:{display:`block`},search:{display:`block`},h1:{fontSize:`2em`,marginTop:`0.67em`,marginBottom:`0.67em`,marginLeft:0,marginRight:0,fontWeight:`bold`,display:`block`},h2:{fontSize:`1.5em`,marginTop:`0.83em`,marginBottom:`0.83em`,marginLeft:0,marginRight:0,fontWeight:`bold`,display:`block`},h3:{fontSize:`1.17em`,marginTop:`1em`,marginBottom:`1em`,marginLeft:0,marginRight:0,fontWeight:`bold`,display:`block`},h4:{marginTop:`1.33em`,marginBottom:`1.33em`,marginLeft:0,marginRight:0,fontWeight:`bold`,display:`block`},h5:{fontSize:`0.83em`,marginTop:`1.67em`,marginBottom:`1.67em`,marginLeft:0,marginRight:0,fontWeight:`bold`,display:`block`},h6:{fontSize:`0.67em`,marginTop:`2.33em`,marginBottom:`2.33em`,marginLeft:0,marginRight:0,fontWeight:`bold`,display:`block`},u:{textDecoration:`underline`},ins:{textDecoration:`underline`},strong:{fontWeight:`bolder`},b:{fontWeight:`bolder`},i:{fontStyle:`italic`},em:{fontStyle:`italic`},cite:{fontStyle:`italic`},dfn:{fontStyle:`italic`},code:{fontFamily:`monospace`},kbd:{fontFamily:`monospace`},samp:{fontFamily:`monospace`},pre:{fontFamily:`monospace`,whiteSpace:`pre`,margin:`1em 0`,display:`block`},mark:{backgroundColor:`yellow`,color:`black`},big:{fontSize:`larger`},small:{fontSize:`smaller`},s:{textDecoration:`line-through`},del:{textDecoration:`line-through`},sub:{fontSize:`smaller`,verticalAlign:`sub`},sup:{fontSize:`smaller`,verticalAlign:`super`},div:{display:`block`}};function t(t){if(t!==!1)return t??e}function n(e,t){let n;for(let r in e){if(!Object.hasOwn(e,r))continue;let i=e[r];r===`children`||r===`className`||r===`class`||r===`id`||r===`style`||r===t||r===`ref`||r===`key`||r===`dangerouslySetInnerHTML`||r===`suppressHydrationWarning`||i==null||i===!1||typeof i==`function`||typeof i==`symbol`||typeof i!=`object`&&(n??={},n[r]=i===!0?``:String(i))}return n}const r=new Set([`head`,`meta`,`link`,`style`,`script`]);function i(e){return r.has(e)}function a(e,t){return e.type===t&&`props`in e}function o(e){return e.replace(/([A-Z])/g,`-$1`).toLowerCase()}function s(e){return typeof e==`object`&&!!e&&`type`in e}function c(e){return typeof e==`function`}const l=Symbol.for(`react.forward_ref`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.fragment`);function f(e){return e.$$typeof===l}function p(e){return e.$$typeof===u}function m(e){return e.type===d}export{f as a,s as c,e as d,i,n as l,c as n,m as o,a as r,p as s,o as t,t as u};
|
|
1
|
+
const e={html:{display:`block`},head:{display:`none`},meta:{display:`none`},title:{display:`none`},link:{display:`none`},style:{display:`none`},script:{display:`none`},noscript:{display:`none`},datalist:{display:`none`},template:{display:`none`},body:{margin:8,display:`block`},p:{marginTop:`1em`,marginBottom:`1em`,display:`block`},blockquote:{marginTop:`1em`,marginBottom:`1em`,marginLeft:40,marginRight:40,display:`block`},figure:{marginTop:`1em`,marginBottom:`1em`,marginLeft:40,marginRight:40,display:`block`},figcaption:{display:`block`},address:{fontStyle:`italic`,display:`block`},article:{display:`block`},aside:{display:`block`},footer:{display:`block`},header:{display:`block`},hgroup:{display:`block`},main:{display:`block`},nav:{display:`block`},section:{display:`block`},center:{textAlign:`center`,display:`block`},hr:{marginTop:`0.5em`,marginBottom:`0.5em`,marginLeft:`auto`,marginRight:`auto`,borderWidth:1,display:`block`},ul:{marginTop:`1em`,marginBottom:`1em`,paddingLeft:40,display:`block`},ol:{marginTop:`1em`,marginBottom:`1em`,paddingLeft:40,display:`block`},menu:{marginTop:`1em`,marginBottom:`1em`,paddingLeft:40,display:`block`},li:{display:`block`},dl:{marginTop:`1em`,marginBottom:`1em`,display:`block`},dt:{display:`block`},dd:{marginLeft:40,display:`block`},form:{display:`block`},fieldset:{marginLeft:2,marginRight:2,paddingTop:`0.35em`,paddingRight:`0.75em`,paddingBottom:`0.625em`,paddingLeft:`0.75em`,borderWidth:2,display:`block`},legend:{paddingLeft:2,paddingRight:2,display:`block`},details:{display:`block`},summary:{display:`block`},search:{display:`block`},h1:{fontSize:`2em`,marginTop:`0.67em`,marginBottom:`0.67em`,marginLeft:0,marginRight:0,fontWeight:`bold`,display:`block`},h2:{fontSize:`1.5em`,marginTop:`0.83em`,marginBottom:`0.83em`,marginLeft:0,marginRight:0,fontWeight:`bold`,display:`block`},h3:{fontSize:`1.17em`,marginTop:`1em`,marginBottom:`1em`,marginLeft:0,marginRight:0,fontWeight:`bold`,display:`block`},h4:{marginTop:`1.33em`,marginBottom:`1.33em`,marginLeft:0,marginRight:0,fontWeight:`bold`,display:`block`},h5:{fontSize:`0.83em`,marginTop:`1.67em`,marginBottom:`1.67em`,marginLeft:0,marginRight:0,fontWeight:`bold`,display:`block`},h6:{fontSize:`0.67em`,marginTop:`2.33em`,marginBottom:`2.33em`,marginLeft:0,marginRight:0,fontWeight:`bold`,display:`block`},u:{textDecoration:`underline`},ins:{textDecoration:`underline`},strong:{fontWeight:`bolder`},b:{fontWeight:`bolder`},i:{fontStyle:`italic`},em:{fontStyle:`italic`},cite:{fontStyle:`italic`},dfn:{fontStyle:`italic`},code:{fontFamily:`monospace`},kbd:{fontFamily:`monospace`},samp:{fontFamily:`monospace`},pre:{fontFamily:`monospace`,whiteSpace:`pre`,margin:`1em 0`,display:`block`},br:{whiteSpace:`pre`},mark:{backgroundColor:`yellow`,color:`black`},big:{fontSize:`larger`},small:{fontSize:`smaller`},s:{textDecoration:`line-through`},del:{textDecoration:`line-through`},sub:{fontSize:`smaller`,verticalAlign:`sub`},sup:{fontSize:`smaller`,verticalAlign:`super`},div:{display:`block`}};function t(t){if(t!==!1)return t??e}function n(e,t){let n;for(let r in e){if(!Object.hasOwn(e,r))continue;let i=e[r];r===`children`||r===`className`||r===`class`||r===`id`||r===`style`||r===t||r===`ref`||r===`key`||r===`dangerouslySetInnerHTML`||r===`suppressHydrationWarning`||i==null||i===!1||typeof i==`function`||typeof i==`symbol`||typeof i!=`object`&&(n??={},n[r]=i===!0?``:String(i))}return n}const r=new Set([`head`,`meta`,`link`,`style`,`script`]);function i(e){return r.has(e)}function a(e,t){return e.type===t&&`props`in e}function o(e){return e.replace(/([A-Z])/g,`-$1`).toLowerCase()}function s(e){return typeof e==`object`&&!!e&&`type`in e}function c(e){return typeof e==`function`}const l=Symbol.for(`react.forward_ref`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.fragment`);function f(e){return e.$$typeof===l}function p(e){return e.$$typeof===u}function m(e){return e.type===d}export{f as a,s as c,e as d,i,n as l,c as n,m as o,a as r,p as s,o as t,t as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e={html:{display:`block`},head:{display:`none`},meta:{display:`none`},title:{display:`none`},link:{display:`none`},style:{display:`none`},script:{display:`none`},noscript:{display:`none`},datalist:{display:`none`},template:{display:`none`},body:{margin:8,display:`block`},p:{marginTop:`1em`,marginBottom:`1em`,display:`block`},blockquote:{marginTop:`1em`,marginBottom:`1em`,marginLeft:40,marginRight:40,display:`block`},figure:{marginTop:`1em`,marginBottom:`1em`,marginLeft:40,marginRight:40,display:`block`},figcaption:{display:`block`},address:{fontStyle:`italic`,display:`block`},article:{display:`block`},aside:{display:`block`},footer:{display:`block`},header:{display:`block`},hgroup:{display:`block`},main:{display:`block`},nav:{display:`block`},section:{display:`block`},center:{textAlign:`center`,display:`block`},hr:{marginTop:`0.5em`,marginBottom:`0.5em`,marginLeft:`auto`,marginRight:`auto`,borderWidth:1,display:`block`},ul:{marginTop:`1em`,marginBottom:`1em`,paddingLeft:40,display:`block`},ol:{marginTop:`1em`,marginBottom:`1em`,paddingLeft:40,display:`block`},menu:{marginTop:`1em`,marginBottom:`1em`,paddingLeft:40,display:`block`},li:{display:`block`},dl:{marginTop:`1em`,marginBottom:`1em`,display:`block`},dt:{display:`block`},dd:{marginLeft:40,display:`block`},form:{display:`block`},fieldset:{marginLeft:2,marginRight:2,paddingTop:`0.35em`,paddingRight:`0.75em`,paddingBottom:`0.625em`,paddingLeft:`0.75em`,borderWidth:2,display:`block`},legend:{paddingLeft:2,paddingRight:2,display:`block`},details:{display:`block`},summary:{display:`block`},search:{display:`block`},h1:{fontSize:`2em`,marginTop:`0.67em`,marginBottom:`0.67em`,marginLeft:0,marginRight:0,fontWeight:`bold`,display:`block`},h2:{fontSize:`1.5em`,marginTop:`0.83em`,marginBottom:`0.83em`,marginLeft:0,marginRight:0,fontWeight:`bold`,display:`block`},h3:{fontSize:`1.17em`,marginTop:`1em`,marginBottom:`1em`,marginLeft:0,marginRight:0,fontWeight:`bold`,display:`block`},h4:{marginTop:`1.33em`,marginBottom:`1.33em`,marginLeft:0,marginRight:0,fontWeight:`bold`,display:`block`},h5:{fontSize:`0.83em`,marginTop:`1.67em`,marginBottom:`1.67em`,marginLeft:0,marginRight:0,fontWeight:`bold`,display:`block`},h6:{fontSize:`0.67em`,marginTop:`2.33em`,marginBottom:`2.33em`,marginLeft:0,marginRight:0,fontWeight:`bold`,display:`block`},u:{textDecoration:`underline`},ins:{textDecoration:`underline`},strong:{fontWeight:`bolder`},b:{fontWeight:`bolder`},i:{fontStyle:`italic`},em:{fontStyle:`italic`},cite:{fontStyle:`italic`},dfn:{fontStyle:`italic`},code:{fontFamily:`monospace`},kbd:{fontFamily:`monospace`},samp:{fontFamily:`monospace`},pre:{fontFamily:`monospace`,whiteSpace:`pre`,margin:`1em 0`,display:`block`},mark:{backgroundColor:`yellow`,color:`black`},big:{fontSize:`larger`},small:{fontSize:`smaller`},s:{textDecoration:`line-through`},del:{textDecoration:`line-through`},sub:{fontSize:`smaller`,verticalAlign:`sub`},sup:{fontSize:`smaller`,verticalAlign:`super`},div:{display:`block`}};function t(t){if(t!==!1)return t??e}function n(e,t){let n;for(let r in e){if(!Object.hasOwn(e,r))continue;let i=e[r];r===`children`||r===`className`||r===`class`||r===`id`||r===`style`||r===t||r===`ref`||r===`key`||r===`dangerouslySetInnerHTML`||r===`suppressHydrationWarning`||i==null||i===!1||typeof i==`function`||typeof i==`symbol`||typeof i!=`object`&&(n??={},n[r]=i===!0?``:String(i))}return n}const r=new Set([`head`,`meta`,`link`,`style`,`script`]);function i(e){return r.has(e)}function a(e,t){return e.type===t&&`props`in e}function o(e){return e.replace(/([A-Z])/g,`-$1`).toLowerCase()}function s(e){return typeof e==`object`&&!!e&&`type`in e}function c(e){return typeof e==`function`}const l=Symbol.for(`react.forward_ref`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.fragment`);function f(e){return e.$$typeof===l}function p(e){return e.$$typeof===u}function m(e){return e.type===d}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return t}});
|
|
1
|
+
const e={html:{display:`block`},head:{display:`none`},meta:{display:`none`},title:{display:`none`},link:{display:`none`},style:{display:`none`},script:{display:`none`},noscript:{display:`none`},datalist:{display:`none`},template:{display:`none`},body:{margin:8,display:`block`},p:{marginTop:`1em`,marginBottom:`1em`,display:`block`},blockquote:{marginTop:`1em`,marginBottom:`1em`,marginLeft:40,marginRight:40,display:`block`},figure:{marginTop:`1em`,marginBottom:`1em`,marginLeft:40,marginRight:40,display:`block`},figcaption:{display:`block`},address:{fontStyle:`italic`,display:`block`},article:{display:`block`},aside:{display:`block`},footer:{display:`block`},header:{display:`block`},hgroup:{display:`block`},main:{display:`block`},nav:{display:`block`},section:{display:`block`},center:{textAlign:`center`,display:`block`},hr:{marginTop:`0.5em`,marginBottom:`0.5em`,marginLeft:`auto`,marginRight:`auto`,borderWidth:1,display:`block`},ul:{marginTop:`1em`,marginBottom:`1em`,paddingLeft:40,display:`block`},ol:{marginTop:`1em`,marginBottom:`1em`,paddingLeft:40,display:`block`},menu:{marginTop:`1em`,marginBottom:`1em`,paddingLeft:40,display:`block`},li:{display:`block`},dl:{marginTop:`1em`,marginBottom:`1em`,display:`block`},dt:{display:`block`},dd:{marginLeft:40,display:`block`},form:{display:`block`},fieldset:{marginLeft:2,marginRight:2,paddingTop:`0.35em`,paddingRight:`0.75em`,paddingBottom:`0.625em`,paddingLeft:`0.75em`,borderWidth:2,display:`block`},legend:{paddingLeft:2,paddingRight:2,display:`block`},details:{display:`block`},summary:{display:`block`},search:{display:`block`},h1:{fontSize:`2em`,marginTop:`0.67em`,marginBottom:`0.67em`,marginLeft:0,marginRight:0,fontWeight:`bold`,display:`block`},h2:{fontSize:`1.5em`,marginTop:`0.83em`,marginBottom:`0.83em`,marginLeft:0,marginRight:0,fontWeight:`bold`,display:`block`},h3:{fontSize:`1.17em`,marginTop:`1em`,marginBottom:`1em`,marginLeft:0,marginRight:0,fontWeight:`bold`,display:`block`},h4:{marginTop:`1.33em`,marginBottom:`1.33em`,marginLeft:0,marginRight:0,fontWeight:`bold`,display:`block`},h5:{fontSize:`0.83em`,marginTop:`1.67em`,marginBottom:`1.67em`,marginLeft:0,marginRight:0,fontWeight:`bold`,display:`block`},h6:{fontSize:`0.67em`,marginTop:`2.33em`,marginBottom:`2.33em`,marginLeft:0,marginRight:0,fontWeight:`bold`,display:`block`},u:{textDecoration:`underline`},ins:{textDecoration:`underline`},strong:{fontWeight:`bolder`},b:{fontWeight:`bolder`},i:{fontStyle:`italic`},em:{fontStyle:`italic`},cite:{fontStyle:`italic`},dfn:{fontStyle:`italic`},code:{fontFamily:`monospace`},kbd:{fontFamily:`monospace`},samp:{fontFamily:`monospace`},pre:{fontFamily:`monospace`,whiteSpace:`pre`,margin:`1em 0`,display:`block`},br:{whiteSpace:`pre`},mark:{backgroundColor:`yellow`,color:`black`},big:{fontSize:`larger`},small:{fontSize:`smaller`},s:{textDecoration:`line-through`},del:{textDecoration:`line-through`},sub:{fontSize:`smaller`,verticalAlign:`sub`},sup:{fontSize:`smaller`,verticalAlign:`super`},div:{display:`block`}};function t(t){if(t!==!1)return t??e}function n(e,t){let n;for(let r in e){if(!Object.hasOwn(e,r))continue;let i=e[r];r===`children`||r===`className`||r===`class`||r===`id`||r===`style`||r===t||r===`ref`||r===`key`||r===`dangerouslySetInnerHTML`||r===`suppressHydrationWarning`||i==null||i===!1||typeof i==`function`||typeof i==`symbol`||typeof i!=`object`&&(n??={},n[r]=i===!0?``:String(i))}return n}const r=new Set([`head`,`meta`,`link`,`style`,`script`]);function i(e){return r.has(e)}function a(e,t){return e.type===t&&`props`in e}function o(e){return e.replace(/([A-Z])/g,`-$1`).toLowerCase()}function s(e){return typeof e==`object`&&!!e&&`type`in e}function c(e){return typeof e==`function`}const l=Symbol.for(`react.forward_ref`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.fragment`);function f(e){return e.$$typeof===l}function p(e){return e.$$typeof===u}function m(e){return e.type===d}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return t}});
|
package/package.json
CHANGED
package/dist/fonts-Bmi5c76G.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=32*1024*1024,t=/url\(\s*(['"]?)(.*?)\1\s*\)/g;async function n(e,t={}){if(t.allowUrl&&!t.allowUrl(e))throw Error(`URL blocked by allowUrl policy: ${e}`);let n=t.fetch??globalThis.fetch,r=t.timeout??5e3,i=r<=0?void 0:AbortSignal.timeout(r),a=[t.signal,t.init?.signal,i].filter(e=>e!==void 0),o=a.length?AbortSignal.any(a):void 0,s=await n(e,{...t.init,signal:o});if(!s.ok)throw Error(`HTTP ${s.status} ${s.statusText} fetching ${e}`);return s}async function r(e,t){let n=Number(e.headers.get(`content-length`));if(Number.isFinite(n)&&n>t)throw Error(`Response exceeds ${t} bytes (content-length ${n})`);let r=e.body;if(!r)return e.arrayBuffer();let i=r.getReader(),a=[],o=0;for(;;){let{done:e,value:n}=await i.read();if(e)break;if(o+=n.byteLength,o>t)throw await i.cancel().catch(()=>{}),Error(`Response exceeds ${t} bytes`);a.push(n)}let s=new Uint8Array(o),c=0;for(let e of a)s.set(e,c),c+=e.byteLength;return s.buffer}function i(e){return e.startsWith(`https://`)||e.startsWith(`http://`)}function a(e,n){if(typeof e==`string`)for(let r of e.matchAll(t)){let e=r[2]?.trim();e&&i(e)&&n.add(e)}else if(Array.isArray(e))for(let t of e)a(t,n)}function o(e){let t=new Set,n=e=>{let r=e=>{e&&(a(e.backgroundImage,t),a(e.maskImage,t))};if(r(e.style),r(e.preset),a(e.tw,t),e.type===`image`){typeof e.src==`string`&&i(e.src)&&t.add(e.src);return}if(e.type===`container`)for(let t of e.children??[])n(t)};return n(e),[...t]}function s(e,t,i){let a=i?.get(e);if(a)return a;let o=n(e,t).then(e=>r(e,t.maxBytes??33554432)).catch(t=>{throw i?.delete(e),t});return i?.set(e,o),o}async function c({node:e,sources:t=[],fetchCache:n,fetch:r,timeout:i,signal:a,maxBytes:c,allowUrl:l,throwOnError:u=!0}){let d=Array.isArray(e)?e:[e],f=new Map;for(let e of t)f.set(e.src,e);let p=[...new Set(d.flatMap(o))].filter(e=>!f.has(e)),m={fetch:r,timeout:i,signal:a,maxBytes:c,allowUrl:l},h=p.map(async e=>({src:e,data:await s(e,m,n)})),g=u?await Promise.all(h):(await Promise.allSettled(h)).filter(e=>e.status===`fulfilled`).map(e=>e.value);return[...f.values(),...g]}const l=new Map;function u(e,t,n,r){let i=new Map(r),a=n.includes(`italic`),o=a?n.includes(`normal`)?[0,1]:[1]:[void 0],s=[...a?[`ital`]:[],...i.keys(),`wght`].sort(),c=o.flatMap(e=>t.map(t=>s.map(n=>n===`ital`?String(e):n===`wght`?t:i.get(n)??``).join(`,`))).sort();return`${e}:${s.join(`,`)}@${c.join(`;`)}`}function d(e){let t=new URL(e.baseUrl??`https://fonts.googleapis.com/css2`);for(let n of e.families){if(typeof n==`string`){t.searchParams.append(`family`,u(n,[`400`],[`normal`],[]));continue}let e=n.weight??400,r=(Array.isArray(e)?[...e].sort((e,t)=>e-t):[e]).map(String),i=n.style??`normal`,a=(Array.isArray(i)?i:[i]).map(String),o=Object.entries(n.axes??{}).filter(([e])=>e!==`ital`&&e!==`wght`).map(([e,t])=>[e,String(t)]);t.searchParams.append(`family`,u(n.name,r,a,o))}return e.display&&t.searchParams.set(`display`,e.display),t.toString()}function f(e,t){return n(e,{...t,init:{headers:{"User-Agent":`Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36`}}}).then(e=>r(e,t.maxBytes??2097152)).then(e=>new TextDecoder().decode(e))}function p(e,t){let n=t.cache??l,r=n.get(e);if(r)return r;let i=f(e,t);return n.set(e,i),i.catch(()=>n.delete(e)),i}const m=/(?:\/\*\s*([^*]+?)\s*\*\/\s*)?@font-face\s*\{([^}]*)\}/g;function h(e,t,i){let a=`${e.family} ${e.subset}`,o=e.ranges.map(([e,t])=>`${e}-${t}`).join(`,`);return{name:a,subsetOf:e.family,key:`${a}:${e.weight??``}:${e.style??``}:${o}:${i??``}`,weight:e.weight,style:e.style,ranges:e.ranges,generic:i,data:()=>n(e.url,t).then(e=>r(e,t.maxBytes??33554432))}}function g(e){let t=[];for(let n of e.split(`,`)){let e=n.trim().replace(/^U\+/i,``);if(e)if(e.includes(`-`)){let[n,r]=e.split(`-`);n&&r&&t.push([parseInt(n,16),parseInt(r,16)])}else if(e.includes(`?`))t.push([parseInt(e.replace(/\?/g,`0`),16),parseInt(e.replace(/\?/g,`F`),16)]);else{let n=parseInt(e,16);t.push([n,n])}}return t}function _(e){let t=[],n=0;for(let r of e.matchAll(m)){let e=r[2];if(!e)continue;let i=e.match(/src:\s*url\(([^)]+)\)/)?.[1]?.replace(/['"]/g,``).trim(),a=e.match(/font-family:\s*['"]?([^'";]+)['"]?/)?.[1]?.trim();if(!i||!a)continue;let o=e.match(/unicode-range:\s*([^;]+)/)?.[1],s=e.match(/font-weight:\s*(\d+)(?:\s+(\d+))?/);t.push({family:a,subset:r[1]?.trim()||`subset-${n}`,url:i,weight:s&&!s[2]?Number(s[1]):void 0,style:e.match(/font-style:\s*([a-z]+)/i)?.[1],ranges:o?g(o):[]}),n+=1}return t}function v(e){let t=new Map;for(let n of e){let e=t.get(n.url)??new Set;e.add(n.weight),t.set(n.url,e)}let n=new Set,r=[];for(let i of e){if(n.has(i.url))continue;n.add(i.url);let e=(t.get(i.url)?.size??0)>1;r.push(e?{...i,weight:void 0}:i)}return r}function y(e){let t=new Set,n=e=>{for(let n of e)t.add(n.codePointAt(0))},r=e=>{e.type===`text`?n(e.text):e.type===`container`&&e.children?.forEach(r)};return typeof e==`string`?n(e):Array.isArray(e)?e.forEach(r):r(e),t}function b(e,t){if(e.length===0)return!0;for(let n of t)for(let[t,r]of e)if(n>=t&&n<=r)return!0;return!1}function x({fonts:e,source:t}){let n=y(t);return e.filter(e=>b(e.ranges??[],n))}function S(e,t={}){return{key:e,data:()=>n(e,t).then(e=>r(e,t.maxBytes??33554432))}}async function C(e){if(Array.isArray(e)&&(e={families:e}),e.families.length===0)return[];let t=await p(d(e),e),n=new Map(e.families.map((e,t)=>[typeof e==`string`?e:e.name,t])),r=new Map(e.families.flatMap(e=>typeof e==`string`||!e.generic?[]:[[e.name,e.generic]]));return v(_(t)).sort((e,t)=>(n.get(e.family)??0)-(n.get(t.family)??0)).map(t=>h(t,e,r.get(t.family)))}export{e as a,r as c,x as i,S as n,n as o,C as r,c as s,y as t};
|
package/dist/fonts-D8OaJ4MQ.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=/url\(\s*(['"]?)(.*?)\1\s*\)/g;async function t(e,t={}){if(t.allowUrl&&!t.allowUrl(e))throw Error(`URL blocked by allowUrl policy: ${e}`);let n=t.fetch??globalThis.fetch,r=t.timeout??5e3,i=r<=0?void 0:AbortSignal.timeout(r),a=[t.signal,t.init?.signal,i].filter(e=>e!==void 0),o=a.length?AbortSignal.any(a):void 0,s=await n(e,{...t.init,signal:o});if(!s.ok)throw Error(`HTTP ${s.status} ${s.statusText} fetching ${e}`);return s}async function n(e,t){let n=Number(e.headers.get(`content-length`));if(Number.isFinite(n)&&n>t)throw Error(`Response exceeds ${t} bytes (content-length ${n})`);let r=e.body;if(!r)return e.arrayBuffer();let i=r.getReader(),a=[],o=0;for(;;){let{done:e,value:n}=await i.read();if(e)break;if(o+=n.byteLength,o>t)throw await i.cancel().catch(()=>{}),Error(`Response exceeds ${t} bytes`);a.push(n)}let s=new Uint8Array(o),c=0;for(let e of a)s.set(e,c),c+=e.byteLength;return s.buffer}function r(e){return e.startsWith(`https://`)||e.startsWith(`http://`)}function i(t,n){if(typeof t==`string`)for(let i of t.matchAll(e)){let e=i[2]?.trim();e&&r(e)&&n.add(e)}else if(Array.isArray(t))for(let e of t)i(e,n)}function a(e){let t=new Set,n=e=>{let a=e=>{e&&(i(e.backgroundImage,t),i(e.maskImage,t))};if(a(e.style),a(e.preset),i(e.tw,t),e.type===`image`){typeof e.src==`string`&&r(e.src)&&t.add(e.src);return}if(e.type===`container`)for(let t of e.children??[])n(t)};return n(e),[...t]}function o(e,r,i){let a=i?.get(e);if(a)return a;let o=t(e,r).then(e=>n(e,r.maxBytes??33554432)).catch(t=>{throw i?.delete(e),t});return i?.set(e,o),o}async function s({node:e,sources:t=[],fetchCache:n,fetch:r,timeout:i,signal:s,maxBytes:c,allowUrl:l,throwOnError:u=!0}){let d=Array.isArray(e)?e:[e],f=new Map;for(let e of t)f.set(e.src,e);let p=[...new Set(d.flatMap(a))].filter(e=>!f.has(e)),m={fetch:r,timeout:i,signal:s,maxBytes:c,allowUrl:l},h=p.map(async e=>({src:e,data:await o(e,m,n)})),g=u?await Promise.all(h):(await Promise.allSettled(h)).filter(e=>e.status===`fulfilled`).map(e=>e.value);return[...f.values(),...g]}const c=new Map;function l(e,t,n,r){let i=new Map(r),a=n.includes(`italic`),o=a?n.includes(`normal`)?[0,1]:[1]:[void 0],s=[...a?[`ital`]:[],...i.keys(),`wght`].sort(),c=o.flatMap(e=>t.map(t=>s.map(n=>n===`ital`?String(e):n===`wght`?t:i.get(n)??``).join(`,`))).sort();return`${e}:${s.join(`,`)}@${c.join(`;`)}`}function u(e){let t=new URL(e.baseUrl??`https://fonts.googleapis.com/css2`);for(let n of e.families){if(typeof n==`string`){t.searchParams.append(`family`,l(n,[`400`],[`normal`],[]));continue}let e=n.weight??400,r=(Array.isArray(e)?[...e].sort((e,t)=>e-t):[e]).map(String),i=n.style??`normal`,a=(Array.isArray(i)?i:[i]).map(String),o=Object.entries(n.axes??{}).filter(([e])=>e!==`ital`&&e!==`wght`).map(([e,t])=>[e,String(t)]);t.searchParams.append(`family`,l(n.name,r,a,o))}return e.display&&t.searchParams.set(`display`,e.display),t.toString()}function d(e,r){return t(e,{...r,init:{headers:{"User-Agent":`Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36`}}}).then(e=>n(e,r.maxBytes??2097152)).then(e=>new TextDecoder().decode(e))}function f(e,t){let n=t.cache??c,r=n.get(e);if(r)return r;let i=d(e,t);return n.set(e,i),i.catch(()=>n.delete(e)),i}const p=/(?:\/\*\s*([^*]+?)\s*\*\/\s*)?@font-face\s*\{([^}]*)\}/g;function m(e,r,i){let a=`${e.family} ${e.subset}`,o=e.ranges.map(([e,t])=>`${e}-${t}`).join(`,`);return{name:a,subsetOf:e.family,key:`${a}:${e.weight??``}:${e.style??``}:${o}:${i??``}`,weight:e.weight,style:e.style,ranges:e.ranges,generic:i,data:()=>t(e.url,r).then(e=>n(e,r.maxBytes??33554432))}}function h(e){let t=[];for(let n of e.split(`,`)){let e=n.trim().replace(/^U\+/i,``);if(e)if(e.includes(`-`)){let[n,r]=e.split(`-`);n&&r&&t.push([parseInt(n,16),parseInt(r,16)])}else if(e.includes(`?`))t.push([parseInt(e.replace(/\?/g,`0`),16),parseInt(e.replace(/\?/g,`F`),16)]);else{let n=parseInt(e,16);t.push([n,n])}}return t}function g(e){let t=[],n=0;for(let r of e.matchAll(p)){let e=r[2];if(!e)continue;let i=e.match(/src:\s*url\(([^)]+)\)/)?.[1]?.replace(/['"]/g,``).trim(),a=e.match(/font-family:\s*['"]?([^'";]+)['"]?/)?.[1]?.trim();if(!i||!a)continue;let o=e.match(/unicode-range:\s*([^;]+)/)?.[1],s=e.match(/font-weight:\s*(\d+)(?:\s+(\d+))?/);t.push({family:a,subset:r[1]?.trim()||`subset-${n}`,url:i,weight:s&&!s[2]?Number(s[1]):void 0,style:e.match(/font-style:\s*([a-z]+)/i)?.[1],ranges:o?h(o):[]}),n+=1}return t}function _(e){let t=new Map;for(let n of e){let e=t.get(n.url)??new Set;e.add(n.weight),t.set(n.url,e)}let n=new Set,r=[];for(let i of e){if(n.has(i.url))continue;n.add(i.url);let e=(t.get(i.url)?.size??0)>1;r.push(e?{...i,weight:void 0}:i)}return r}function v(e){let t=new Set,n=e=>{for(let n of e)t.add(n.codePointAt(0))},r=e=>{e.type===`text`?n(e.text):e.type===`container`&&e.children?.forEach(r)};return typeof e==`string`?n(e):Array.isArray(e)?e.forEach(r):r(e),t}function y(e,t){if(e.length===0)return!0;for(let n of t)for(let[t,r]of e)if(n>=t&&n<=r)return!0;return!1}function b({fonts:e,source:t}){let n=v(t);return e.filter(e=>y(e.ranges??[],n))}function x(e,r={}){return{key:e,data:()=>t(e,r).then(e=>n(e,r.maxBytes??33554432))}}async function S(e){if(Array.isArray(e)&&(e={families:e}),e.families.length===0)return[];let t=await f(u(e),e),n=new Map(e.families.map((e,t)=>[typeof e==`string`?e:e.name,t])),r=new Map(e.families.flatMap(e=>typeof e==`string`||!e.generic?[]:[[e.name,e.generic]]));return _(g(t)).sort((e,t)=>(n.get(e.family)??0)-(n.get(t.family)??0)).map(t=>m(t,e,r.get(t.family)))}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return 33554432}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return v}});
|