2 lines
1.6 MiB
JavaScript
Raw Normal View History

2025-12-10 12:02:17 +08:00
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).naive={},e.Vue)}(this,function(e,t){"use strict";const n=/\s*,(?![^(]*\))\s*/g,r=/\s+/g;function o(e){let t=[""];return e.forEach(e=>{(e=e&&e.trim())&&(t=e.includes("&")?function(e,t){const r=[];return t.split(n).forEach(t=>{let n=function(e){let t=0;for(let n=0;n<e.length;++n)"&"===e[n]&&++t;return t}(t);if(!n)return void e.forEach(e=>{r.push((e&&e+" ")+t)});if(1===n)return void e.forEach(e=>{r.push(t.replace("&",e))});let o=[t];for(;n--;){const t=[];o.forEach(n=>{e.forEach(e=>{t.push(n.replace("&",e))})}),o=t}o.forEach(e=>r.push(e))}),r}(t,e):function(e,t){const r=[];return t.split(n).forEach(t=>{e.forEach(e=>{r.push((e&&e+" ")+t)})}),r}(t,e))}),t.join(", ").replace(r," ")}function a(e){if(!e)return;const t=e.parentElement;t&&t.removeChild(e)}function i(e,t){return(null!=t?t:document.head).querySelector(`style[cssr-id="${e}"]`)}function l(e){return!!e&&/^\s*@(s|m)/.test(e)}const s=/[A-Z]/g;function d(e){return e.replace(s,e=>"-"+e.toLowerCase())}function c(e,t,n,r){if(!t)return"";const o=function(e,t,n){return"function"==typeof e?e({context:t.context,props:n}):e}(t,n,r);if(!o)return"";if("string"==typeof o)return`${e} {\n${o}\n}`;const a=Object.keys(o);if(0===a.length)return n.config.keepEmptyBlock?e+" {\n}":"";const i=e?[e+" {"]:[];return a.forEach(e=>{const t=o[e];"raw"!==e?(e=d(e),null!=t&&i.push(` ${e}${function(e,t=" "){return"object"==typeof e&&null!==e?" {\n"+Object.entries(e).map(e=>t+` ${d(e[0])}: ${e[1]};`).join("\n")+"\n"+t+"}":`: ${e};`}(t)}`)):i.push("\n"+t+"\n")}),e&&i.push("}"),i.join("\n")}function u(e,t,n){e&&e.forEach(e=>{if(Array.isArray(e))u(e,t,n);else if("function"==typeof e){const r=e(t);Array.isArray(r)?u(r,t,n):r&&n(r)}else e&&n(e)})}function h(e,t,n,r,a){const i=e.$;let s="";if(i&&"string"!=typeof i)if("function"==typeof i){const e=i({context:r.context,props:a});l(e)?s=e:t.push(e)}else if(i.before&&i.before(r.context),i.$&&"string"!=typeof i.$){if(i.$){const e=i.$({context:r.context,props:a});l(e)?s=e:t.push(e)}}else l(i.$)?s=i.$:t.push(i.$);else l(i)?s=i:t.push(i);const d=o(t),p=c(d,e.props,r,a);s?n.push(`${s} {`):p.length&&n.push(p),e.children&&u(e.children,{context:r.context,props:a},e=>{if("string"==typeof e){const t=c(d,{raw:e},r,a);n.push(t)}else h(e,t,n,r,a)}),t.pop(),s&&n.push("}"),i&&i.after&&i.after(r.context)}function p(e){for(var t,n=0,r=0,o=e.length;o>=4;++r,o-=4)t=1540483477*(65535&(t=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))+(59797*(t>>>16)<<16),n=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(o){case 3:n^=(255&e.charCodeAt(r+2))<<16;case 2:n^=(255&e.charCodeAt(r+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(r)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)}function m(e,t){e.push(t)}function f(e,t,n,r,o,a,l,s,d){let c;if(void 0===n&&(c=t.render(r),n=p(c)),d)return void d.adapter(n,null!=c?c:t.render(r));void 0===s&&(s=document.head);const u=i(n,s);if(null!==u&&!a)return u;const h=null!=u?u:function(e){const t=document.createElement("style");return t.setAttribute("cssr-id",e),t}(n);if(void 0===c&&(c=t.render(r)),h.textContent=c,null!==u)return u;if(l){const e=s.querySelector(`meta[name="${l}"]`);if(e)return s.insertBefore(h,e),m(t.els,h),h}return o?s.insertBefore(h,s.querySelector("style, link")):s.appendChild(h),m(t.els,h),h}function g(e){return function(e,t,n){const r=[];return h(e,[],r,t,n),r.join("\n\n")}(this,this.instance,e)}function v(e={}){const{id:t,ssr:n,props:r,head:o=!1,force:a=!1,anchorMetaName:i,parent:l}=e;return f(this.instance,this,t,r,o,a,i,l,n)}function b(e={}){const{id:t,parent:n}=e;!function(e,t,n,r){const{els:o}=t;if(void 0===n)o.forEach(a),t.els=[];else{const e=i(n,r);e&&o.includes(e)&&(a(e),t.els=o.filter(t=>t!==e))}}(this.instance,this,t,n)}"undefined