generated from VLADIMIR/template_frontend
10 lines
5.7 KiB
JavaScript
10 lines
5.7 KiB
JavaScript
import{J as e,K as t,M as n,P as r,b as i,d as a,i as o,k as s,n as c,z as l}from"./client-CIA34cBM.js";import{t as u}from"./index-BgHbihDp.js";function d(){let e=u();return f(e.refreshTokenAction,e.getToken)}function f(e,t){return o(p(e,c(t)))}function p(e,t){return async n=>{let r;try{r=await t(n)}catch{await e(),r=await t(n)}if(r&&typeof r==`object`&&`code`in r&&r.code!==0)throw Error(`message`in r&&typeof r.message==`string`?r.message:`Ошибка запроса`);return r}}function m(e){let t=0;for(let n=0;n<e.length;++n)e[n]===`&`&&++t;return t}var h=/\s*,(?![^(]*\))\s*/g,g=/\s+/g;function _(e,t){let n=[];return t.split(h).forEach(t=>{let r=m(t);if(!r){e.forEach(e=>{n.push((e&&e+` `)+t)});return}else if(r===1){e.forEach(e=>{n.push(t.replace(`&`,e))});return}let i=[t];for(;r--;){let t=[];i.forEach(n=>{e.forEach(e=>{t.push(n.replace(`&`,e))})}),i=t}i.forEach(e=>n.push(e))}),n}function v(e,t){let n=[];return t.split(h).forEach(t=>{e.forEach(e=>{n.push((e&&e+` `)+t)})}),n}function y(e){let t=[``];return e.forEach(e=>{e&&=e.trim(),e&&(t=e.includes(`&`)?_(t,e):v(t,e))}),t.join(`, `).replace(g,` `)}var b=/[A-Z]/g;function x(e){return e.replace(b,e=>`-`+e.toLowerCase())}function S(e,t=` `){return typeof e==`object`&&e?` {
|
|
`+Object.entries(e).map(e=>t+` ${x(e[0])}: ${e[1]};`).join(`
|
|
`)+`
|
|
`+t+`}`:`: ${e};`}function C(e,t,n){return typeof e==`function`?e({context:t.context,props:n}):e}function w(e,t,n,r){if(!t)return``;let i=C(t,n,r);if(!i)return``;if(typeof i==`string`)return`${e} {\n${i}\n}`;let a=Object.keys(i);if(a.length===0)return n.config.keepEmptyBlock?e+` {
|
|
}`:``;let o=e?[e+` {`]:[];return a.forEach(e=>{let t=i[e];if(e===`raw`){o.push(`
|
|
`+t+`
|
|
`);return}e=x(e),t!=null&&o.push(` ${e}${S(t)}`)}),e&&o.push(`}`),o.join(`
|
|
`)}function T(e,t,n){e&&e.forEach(e=>{if(Array.isArray(e))T(e,t,n);else if(typeof e==`function`){let r=e(t);Array.isArray(r)?T(r,t,n):r&&n(r)}else e&&n(e)})}function E(e,t,n,r,i,a){let o=e.$;!o||typeof o==`string`?t.push(o):typeof o==`function`?t.push(o({context:r.context,props:i})):(o.before&&o.before(r.context),!o.$||typeof o.$==`string`?t.push(o.$):o.$&&t.push(o.$({context:r.context,props:i})));let s=y(t),c=w(s,e.props,r,i);a&&c&&a.insertRule(c),!a&&c.length&&n.push(c),e.children&&T(e.children,{context:r.context,props:i},e=>{if(typeof e==`string`){let t=w(s,{raw:e},r,i);a?a.insertRule(t):n.push(t)}else E(e,t,n,r,i,a)}),t.pop(),o&&o.after&&o.after(r.context)}function D(e,t,n,r=!1){let i=[];return E(e,[],i,t,n,r?e.instance.__styleSheet:void 0),r?``:i.join(`
|
|
|
|
`)}function O(e){if(!e)return;let t=e.parentElement;t&&t.removeChild(e)}function k(e){return document.querySelector(`style[cssr-id="${e}"]`)}function A(e){let t=document.createElement(`style`);return t.setAttribute(`cssr-id`,e),t}window&&(window.__cssrContext={});function j(e){let t=e.getAttribute(`mount-count`);return t===null?null:Number(t)}function M(e,t){e.setAttribute(`mount-count`,String(t))}function N(e,t,n,r){let{els:i}=t;if(n===void 0)i.forEach(O),t.els=[];else{let e=k(n);if(e&&i.includes(e)){let a=j(e);r?a===null?console.error(`[css-render/unmount]: The style with target='${n}' is mounted in count mode.`):a<=1?(O(e),t.els=i.filter(t=>t!==e)):M(e,a-1):a===null?(O(e),t.els=i.filter(t=>t!==e)):console.error(`[css-render/unmount]: The style with target='${n}' is mounted in no-count mode.`)}}}function P(e,t){e.push(t)}function F(e,t,n,r,i,o,s,c,l){if(s&&!l){if(n===void 0){console.error("[css-render/mount]: `id` is required in `boost` mode.");return}let i=window.__cssrContext;i[n]||(i[n]=!0,D(t,e,r,s));return}let u,{els:d}=t,f;if(n===void 0&&(f=t.render(r),n=a(f)),l){l(n,f??t.render(r));return}let p=k(n);if(c||p===null){if(u=p===null?A(n):p,f===void 0&&(f=t.render(r)),u.textContent=f,p!==null)return;if(i){let e=document.head.getElementsByTagName(`style`)[0]||null;document.head.insertBefore(u,e)}else document.head.appendChild(u);o&&M(u,1),P(d,u)}else{let e=j(p);o?e===null?console.error(`[css-render/mount]: The style with id='${n}' has been mounted in no-count mode.`):M(p,e+1):e!==null&&console.error(`[css-render/mount]: The style with id='${n}' has been mounted in count mode.`)}return p??u}function I(e){return D(this,this.instance,e)}function L(e={}){let{target:t,id:n,ssr:r,props:i,count:a=!1,head:o=!1,boost:s=!1,force:c=!1}=e;return F(this.instance,this,n??t,i,o,a,s,c,r)}function R(e={}){let{id:t,target:n,delay:r=0,count:i=!1}=e;r===0?N(this.instance,this,t??n,i):setTimeout(()=>N(this.instance,this,t??n,i),r)}var z=function(e,t,n,r){return{instance:e,$:t,props:n,children:r,els:[],render:I,mount:L,unmount:R}},B=function(e,t,n,r){return Array.isArray(t)?z(e,{$:null},null,t):Array.isArray(n)?z(e,t,null,n):Array.isArray(r)?z(e,t,n,r):z(e,t,n,null)};function V(e={}){let t=null,n={c:((...e)=>B(n,...e)),use:(e,...t)=>e.install(n,...t),find:k,context:{},config:e,get __styleSheet(){if(!t){let e=document.createElement(`style`);return document.head.appendChild(e),t=document.styleSheets[document.styleSheets.length-1],t}return t}};return n}var{c:H}=V(),U=H(`.xicon`,{width:`1em`,height:`1em`,display:`inline-flex`},[H(`svg`,{width:`1em`,height:`1em`}),H(`svg:not([fill])`,{fill:`currentColor`})]),W=()=>{U.mount({id:`xicons-icon`})},G={size:[String,Number],color:String,tag:String},K=Symbol(`IconConfigInjection`);s({name:`IconConfigProvider`,props:G,setup(n,{slots:r}){return t(K,n),()=>e(r,`default`)}});var q=`span`,J=s({name:`Icon`,props:G,setup(t,{slots:a}){let o=r(K,null),s=i(()=>{let e=t.size??o?.size;if(e!==void 0)return typeof e==`number`||/^\d+$/.test(e)?`${e}px`:e}),c=i(()=>{let{color:e}=t;return e===void 0?o?o.color:void 0:e}),u=i(()=>{let{tag:e}=t;return e===void 0?o?.tag??q:e});return l(()=>{W()}),()=>n(u.value,{class:`xicon`,style:{color:c.value,fontSize:s.value}},[e(a,`default`)])}});export{d as n,J as t}; |