import{t as e}from"./rolldown-runtime-iuO8RvI4.js";var t=e((e,t)=>{function n(e){!function(e){var t=e.languages.javascript["template-string"],n=t.pattern.source,r=t.inside.interpolation,a=r.inside["interpolation-punctuation"],o=r.pattern.source;function s(t,r){if(e.languages[t])return{pattern:RegExp("((?:"+r+")\\s*)"+n),lookbehind:!0,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},"embedded-code":{pattern:/[\s\S]+/,alias:t}}}}function i(e,t){return"___"+t.toUpperCase()+"_"+e+"___"}function p(t,n,r){var a={code:t,grammar:n,language:r};return e.hooks.run("before-tokenize",a),a.tokens=e.tokenize(a.code,a.grammar),e.hooks.run("after-tokenize",a),a.tokens}function l(t){var n={};n["interpolation-punctuation"]=a;var o=e.tokenize(t,n);if(3===o.length){var s=[1,1];s.push.apply(s,p(o[1],e.languages.javascript,"javascript")),o.splice.apply(o,s)}return new e.Token("interpolation",o,r.alias,t)}function u(t,n,r){var a=e.tokenize(t,{interpolation:{pattern:RegExp(o),lookbehind:!0}}),s=0,u={},c=p(a.map(function(e){if("string"==typeof e)return e;for(var n,a=e.content;-1!==t.indexOf(n=i(s++,r)););return u[n]=a,n}).join(""),n,r),g=Object.keys(u);return s=0,function e(t){for(var n=0;n<t.length;n++){if(s>=g.length)return;var r=t[n];if("string"==typeof r||"string"==typeof r.content){var a=g[s],o="string"==typeof r?r:r.content,i=o.indexOf(a);if(-1!==i){++s;var p=o.substring(0,i),c=l(u[a]),f=o.substring(i+a.length),y=[];if(p&&y.push(p),y.push(c),f){var v=[f];e(v),y.push.apply(y,v)}"string"==typeof r?(t.splice.apply(t,[n,1].concat(y)),n+=y.length-1):r.content=y}}else{var d=r.content;Array.isArray(d)?e(d):e([d])}}}(c),new e.Token(r,c,"language-"+r,t)}e.languages.javascript["template-string"]=[s("css",/\b(?:styled(?:\([^)]*\))?(?:\s*\.\s*\w+(?:\([^)]*\))*)*|css(?:\s*\.\s*(?:global|resolve))?|createGlobalStyle|keyframes)/.source),s("html",/\bhtml|\.\s*(?:inner|outer)HTML\s*\+?=/.source),s("svg",/\bsvg/.source),s("markdown",/\b(?:markdown|md)/.source),s("graphql",/\b(?:gql|graphql(?:\s*\.\s*experimental)?)/.source),s("sql",/\bsql/.source),t].filter(Boolean);var c={javascript:!0,js:!0,typescript:!0,ts:!0,jsx:!0,tsx:!0};function g(e){return"string"==typeof e?e:Array.isArray(e)?e.map(g).join(""):g(e.content)}e.hooks.add("after-tokenize",function(t){t.language in c&&function t(n){for(var r=0,a=n.length;r<a;r++){var o=n[r];if("string"!=typeof o){var s=o.content;if(Array.isArray(s))if("template-string"===o.type){var i=s[1];if(3===s.length&&"string"!=typeof i&&"embedded-code"===i.type){var p=g(i),l=i.alias,c=Array.isArray(l)?l[0]:l,f=e.languages[c];if(!f)continue;s[1]=u(p,f,c)}}else t(s);else"string"!=typeof s&&t([s])}}}(t.tokens)})}(e)}t.exports=n,n.displayName="jsTemplates",n.aliases=[]});export default t();