Files
2026-10-27 22:40:37 +07:00

80 lines
16 KiB
JavaScript

import{Cn as e,Ht as t,It as n,Pt as r,Qt as i,U as a,W as o,X as s,Xt as c,Z as l,_ as u,at as d,ct as f,f as p,ft as m,jt as h,m as g,nt as _,ot as v,q as y,rt as b,st as x,xt as S,yn as C}from"./client-Be0b5AZU.js";import{c as w,l as T,o as E}from"./_plugin-vue_export-helper-C_Iw6R3j.js";import{L as D,W as O,b as k,i as A,o as j,st as ee}from"./index-DpxjEbFc.js";function M(e){return typeof e==`string`?e.endsWith(`px`)?Number(e.slice(0,e.length-2)):Number(e):e}function N(e){if(e!=null)return typeof e==`number`?`${e}px`:e.endsWith(`px`)?e:`${e}px`}function P(e,t){let n=e.trim().split(/\s+/g),r={top:n[0]};switch(n.length){case 1:r.right=n[0],r.bottom=n[0],r.left=n[0];break;case 2:r.right=n[1],r.left=n[1],r.bottom=n[0];break;case 3:r.right=n[1],r.bottom=n[2],r.left=n[1];break;case 4:r.right=n[1],r.bottom=n[2],r.left=n[3];break;default:throw Error(`[seemly/getMargin]:`+e+` is not a valid value.`)}return t===void 0?r:r[t]}function F(e,t){let[n,r]=e.split(` `);return t?t===`row`?n:r:{row:n,col:r||n}}function I(e){let{textColor2:t,primaryColorHover:n,primaryColorPressed:r,primaryColor:i,infoColor:a,successColor:o,warningColor:s,errorColor:c,baseColor:u,borderColor:d,opacityDisabled:f,tagColor:p,closeIconColor:m,closeIconColorHover:h,closeIconColorPressed:g,borderRadiusSmall:_,fontSizeMini:v,fontSizeTiny:y,fontSizeSmall:b,fontSizeMedium:x,heightMini:S,heightTiny:C,heightSmall:w,heightMedium:T,closeColorHover:E,closeColorPressed:O,buttonColor2Hover:k,buttonColor2Pressed:A,fontWeightStrong:j}=e;return Object.assign(Object.assign({},D),{closeBorderRadius:_,heightTiny:S,heightSmall:C,heightMedium:w,heightLarge:T,borderRadius:_,opacityDisabled:f,fontSizeTiny:v,fontSizeSmall:y,fontSizeMedium:b,fontSizeLarge:x,fontWeightStrong:j,textColorCheckable:t,textColorHoverCheckable:t,textColorPressedCheckable:t,textColorChecked:u,colorCheckable:`#0000`,colorHoverCheckable:k,colorPressedCheckable:A,colorChecked:i,colorCheckedHover:n,colorCheckedPressed:r,border:`1px solid ${d}`,textColor:t,color:p,colorBordered:`rgb(250, 250, 252)`,closeIconColor:m,closeIconColorHover:h,closeIconColorPressed:g,closeColorHover:E,closeColorPressed:O,borderPrimary:`1px solid ${l(i,{alpha:.3})}`,textColorPrimary:i,colorPrimary:l(i,{alpha:.12}),colorBorderedPrimary:l(i,{alpha:.1}),closeIconColorPrimary:i,closeIconColorHoverPrimary:i,closeIconColorPressedPrimary:i,closeColorHoverPrimary:l(i,{alpha:.12}),closeColorPressedPrimary:l(i,{alpha:.18}),borderInfo:`1px solid ${l(a,{alpha:.3})}`,textColorInfo:a,colorInfo:l(a,{alpha:.12}),colorBorderedInfo:l(a,{alpha:.1}),closeIconColorInfo:a,closeIconColorHoverInfo:a,closeIconColorPressedInfo:a,closeColorHoverInfo:l(a,{alpha:.12}),closeColorPressedInfo:l(a,{alpha:.18}),borderSuccess:`1px solid ${l(o,{alpha:.3})}`,textColorSuccess:o,colorSuccess:l(o,{alpha:.12}),colorBorderedSuccess:l(o,{alpha:.1}),closeIconColorSuccess:o,closeIconColorHoverSuccess:o,closeIconColorPressedSuccess:o,closeColorHoverSuccess:l(o,{alpha:.12}),closeColorPressedSuccess:l(o,{alpha:.18}),borderWarning:`1px solid ${l(s,{alpha:.35})}`,textColorWarning:s,colorWarning:l(s,{alpha:.15}),colorBorderedWarning:l(s,{alpha:.12}),closeIconColorWarning:s,closeIconColorHoverWarning:s,closeIconColorPressedWarning:s,closeColorHoverWarning:l(s,{alpha:.12}),closeColorPressedWarning:l(s,{alpha:.18}),borderError:`1px solid ${l(c,{alpha:.23})}`,textColorError:c,colorError:l(c,{alpha:.1}),colorBorderedError:l(c,{alpha:.08}),closeIconColorError:c,closeIconColorHoverError:c,closeIconColorPressedError:c,closeColorHoverError:l(c,{alpha:.12}),closeColorPressedError:l(c,{alpha:.18})})}var L={name:`Tag`,common:p,self:I},R={color:Object,type:{type:String,default:`default`},round:Boolean,size:String,closable:Boolean,disabled:{type:Boolean,default:void 0}},z=b(`tag`,`
--n-close-margin: var(--n-close-margin-top) var(--n-close-margin-right) var(--n-close-margin-bottom) var(--n-close-margin-left);
white-space: nowrap;
position: relative;
box-sizing: border-box;
cursor: default;
display: inline-flex;
align-items: center;
flex-wrap: nowrap;
padding: var(--n-padding);
border-radius: var(--n-border-radius);
color: var(--n-text-color);
background-color: var(--n-color);
transition:
border-color .3s var(--n-bezier),
background-color .3s var(--n-bezier),
color .3s var(--n-bezier),
box-shadow .3s var(--n-bezier),
opacity .3s var(--n-bezier);
line-height: 1;
height: var(--n-height);
font-size: var(--n-font-size);
`,[v(`strong`,`
font-weight: var(--n-font-weight-strong);
`),d(`border`,`
pointer-events: none;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
border-radius: inherit;
border: var(--n-border);
transition: border-color .3s var(--n-bezier);
`),d(`icon`,`
display: flex;
margin: 0 4px 0 0;
color: var(--n-text-color);
transition: color .3s var(--n-bezier);
font-size: var(--n-avatar-size-override);
`),d(`avatar`,`
display: flex;
margin: 0 6px 0 0;
`),d(`close`,`
margin: var(--n-close-margin);
transition:
background-color .3s var(--n-bezier),
color .3s var(--n-bezier);
`),v(`round`,`
padding: 0 calc(var(--n-height) / 3);
border-radius: calc(var(--n-height) / 2);
`,[d(`icon`,`
margin: 0 4px 0 calc((var(--n-height) - 8px) / -2);
`),d(`avatar`,`
margin: 0 6px 0 calc((var(--n-height) - 8px) / -2);
`),v(`closable`,`
padding: 0 calc(var(--n-height) / 4) 0 calc(var(--n-height) / 3);
`)]),v(`icon, avatar`,[v(`round`,`
padding: 0 calc(var(--n-height) / 3) 0 calc(var(--n-height) / 2);
`)]),v(`disabled`,`
cursor: not-allowed !important;
opacity: var(--n-opacity-disabled);
`),v(`checkable`,`
cursor: pointer;
box-shadow: none;
color: var(--n-text-color-checkable);
background-color: var(--n-color-checkable);
`,[x(`disabled`,[_(`&:hover`,`background-color: var(--n-color-hover-checkable);`,[x(`checked`,`color: var(--n-text-color-hover-checkable);`)]),_(`&:active`,`background-color: var(--n-color-pressed-checkable);`,[x(`checked`,`color: var(--n-text-color-pressed-checkable);`)])]),v(`checked`,`
color: var(--n-text-color-checked);
background-color: var(--n-color-checked);
`,[x(`disabled`,[_(`&:hover`,`background-color: var(--n-color-checked-hover);`),_(`&:active`,`background-color: var(--n-color-checked-pressed);`)])])])]),te=Object.assign(Object.assign(Object.assign({},g.props),R),{bordered:{type:Boolean,default:void 0},checked:Boolean,checkable:Boolean,strong:Boolean,triggerClickOnClose:Boolean,onClose:[Array,Function],onMouseenter:Function,onMouseleave:Function,"onUpdate:checked":Function,onUpdateChecked:Function,internalCloseFocusable:{type:Boolean,default:!0},internalCloseIsButtonTag:{type:Boolean,default:!0},onCheckedChange:Function}),ne=s(`n-tag`),re=h({name:`Tag`,props:te,slots:Object,setup(t){let n=C(null),{mergedBorderedRef:r,mergedClsPrefixRef:i,inlineThemeDisabled:s,mergedRtlRef:l,mergedComponentPropsRef:d}=o(t),p=S(()=>t.size||d?.value?.Tag?.size||`medium`),m=g(`Tag`,`-tag`,z,L,t,i);c(ne,{roundRef:e(t,`round`)});function h(){if(!t.disabled&&t.checkable){let{checked:e,onCheckedChange:n,onUpdateChecked:r,"onUpdate:checked":i}=t;r&&r(!e),i&&i(!e),n&&n(!e)}}function _(e){if(t.triggerClickOnClose||e.stopPropagation(),!t.disabled){let{onClose:n}=t;n&&w(n,e)}}let v={setTextContent(e){let{value:t}=n;t&&(t.textContent=e)}},y=u(`Tag`,l,i),b=S(()=>{let{type:e,color:{color:n,textColor:i}={}}=t,a=p.value,{common:{cubicBezierEaseInOut:o},self:{padding:s,closeMargin:c,borderRadius:l,opacityDisabled:u,textColorCheckable:d,textColorHoverCheckable:h,textColorPressedCheckable:g,textColorChecked:_,colorCheckable:v,colorHoverCheckable:y,colorPressedCheckable:b,colorChecked:x,colorCheckedHover:S,colorCheckedPressed:C,closeBorderRadius:w,fontWeightStrong:T,[f(`colorBordered`,e)]:E,[f(`closeSize`,a)]:D,[f(`closeIconSize`,a)]:O,[f(`fontSize`,a)]:k,[f(`height`,a)]:A,[f(`color`,e)]:j,[f(`textColor`,e)]:ee,[f(`border`,e)]:M,[f(`closeIconColor`,e)]:N,[f(`closeIconColorHover`,e)]:F,[f(`closeIconColorPressed`,e)]:I,[f(`closeColorHover`,e)]:L,[f(`closeColorPressed`,e)]:R}}=m.value,z=P(c);return{"--n-font-weight-strong":T,"--n-avatar-size-override":`calc(${A} - 8px)`,"--n-bezier":o,"--n-border-radius":l,"--n-border":M,"--n-close-icon-size":O,"--n-close-color-pressed":R,"--n-close-color-hover":L,"--n-close-border-radius":w,"--n-close-icon-color":N,"--n-close-icon-color-hover":F,"--n-close-icon-color-pressed":I,"--n-close-icon-color-disabled":N,"--n-close-margin-top":z.top,"--n-close-margin-right":z.right,"--n-close-margin-bottom":z.bottom,"--n-close-margin-left":z.left,"--n-close-size":D,"--n-color":n||(r.value?E:j),"--n-color-checkable":v,"--n-color-checked":x,"--n-color-checked-hover":S,"--n-color-checked-pressed":C,"--n-color-hover-checkable":y,"--n-color-pressed-checkable":b,"--n-font-size":k,"--n-height":A,"--n-opacity-disabled":u,"--n-padding":s,"--n-text-color":i||ee,"--n-text-color-checkable":d,"--n-text-color-checked":_,"--n-text-color-hover-checkable":h,"--n-text-color-pressed-checkable":g}}),x=s?a(`tag`,S(()=>{let e=``,{type:n,color:{color:i,textColor:a}={}}=t;return e+=n[0],e+=p.value[0],i&&(e+=`a${T(i)}`),a&&(e+=`b${T(a)}`),r.value&&(e+=`c`),e}),b,t):void 0;return Object.assign(Object.assign({},v),{rtlEnabled:y,mergedClsPrefix:i,contentRef:n,mergedBordered:r,handleClick:h,handleCloseClick:_,cssVars:s?void 0:b,themeClass:x?.themeClass,onRender:x?.onRender})},render(){var e;let{mergedClsPrefix:t,rtlEnabled:n,closable:i,color:{borderColor:a}={},round:o,onRender:s,$slots:c}=this;s?.();let l=E(c.avatar,e=>e&&r(`div`,{class:`${t}-tag__avatar`},e)),u=E(c.icon,e=>e&&r(`div`,{class:`${t}-tag__icon`},e));return r(`div`,{class:[`${t}-tag`,this.themeClass,{[`${t}-tag--rtl`]:n,[`${t}-tag--strong`]:this.strong,[`${t}-tag--disabled`]:this.disabled,[`${t}-tag--checkable`]:this.checkable,[`${t}-tag--checked`]:this.checkable&&this.checked,[`${t}-tag--round`]:o,[`${t}-tag--avatar`]:l,[`${t}-tag--icon`]:u,[`${t}-tag--closable`]:i}],style:this.cssVars,onClick:this.handleClick,onMouseenter:this.onMouseenter,onMouseleave:this.onMouseleave},u||l,r(`span`,{class:`${t}-tag__content`,ref:`contentRef`},(e=this.$slots).default?.call(e)),!this.checkable&&i?r(O,{clsPrefix:t,class:`${t}-tag__close`,disabled:this.disabled,onClick:this.handleCloseClick,focusable:this.internalCloseFocusable,round:o,isButtonTag:this.internalCloseIsButtonTag,absolute:!0}):null,!this.checkable&&this.mergedBordered?r(`div`,{class:`${t}-tag__border`,style:{borderColor:a}}):null)}});function ie(){let e=n(k,null);return e===null&&y(`use-message`,"No outer <n-message-provider /> founded. See prerequisite in https://www.naiveui.com/en-US/os-theme/components/message for more details. If you want to use `useMessage` outside setup, please check https://www.naiveui.com/zh-CN/os-theme/components/message#Q-&-A."),e}function ae(e){let t=0;for(let n=0;n<e.length;++n)e[n]===`&`&&++t;return t}var B=/\s*,(?![^(]*\))\s*/g,oe=/\s+/g;function se(e,t){let n=[];return t.split(B).forEach(t=>{let r=ae(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 ce(e,t){let n=[];return t.split(B).forEach(t=>{e.forEach(e=>{n.push((e&&e+` `)+t)})}),n}function le(e){let t=[``];return e.forEach(e=>{e&&=e.trim(),e&&(t=e.includes(`&`)?se(t,e):ce(t,e))}),t.join(`, `).replace(oe,` `)}var ue=/[A-Z]/g;function V(e){return e.replace(ue,e=>`-`+e.toLowerCase())}function de(e,t=` `){return typeof e==`object`&&e?` {
`+Object.entries(e).map(e=>t+` ${V(e[0])}: ${e[1]};`).join(`
`)+`
`+t+`}`:`: ${e};`}function fe(e,t,n){return typeof e==`function`?e({context:t.context,props:n}):e}function H(e,t,n,r){if(!t)return``;let i=fe(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=V(e),t!=null&&o.push(` ${e}${de(t)}`)}),e&&o.push(`}`),o.join(`
`)}function U(e,t,n){e&&e.forEach(e=>{if(Array.isArray(e))U(e,t,n);else if(typeof e==`function`){let r=e(t);Array.isArray(r)?U(r,t,n):r&&n(r)}else e&&n(e)})}function W(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=le(t),c=H(s,e.props,r,i);a&&c&&a.insertRule(c),!a&&c.length&&n.push(c),e.children&&U(e.children,{context:r.context,props:i},e=>{if(typeof e==`string`){let t=H(s,{raw:e},r,i);a?a.insertRule(t):n.push(t)}else W(e,t,n,r,i,a)}),t.pop(),o&&o.after&&o.after(r.context)}function G(e,t,n,r=!1){let i=[];return W(e,[],i,t,n,r?e.instance.__styleSheet:void 0),r?``:i.join(`
`)}function K(e){if(!e)return;let t=e.parentElement;t&&t.removeChild(e)}function q(e){return document.querySelector(`style[cssr-id="${e}"]`)}function pe(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 Y(e,t){e.setAttribute(`mount-count`,String(t))}function X(e,t,n,r){let{els:i}=t;if(n===void 0)i.forEach(K),t.els=[];else{let e=q(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?(K(e),t.els=i.filter(t=>t!==e)):Y(e,a-1):a===null?(K(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 me(e,t){e.push(t)}function he(e,t,n,r,i,a,o,s,c){if(o&&!c){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,G(t,e,r,o));return}let l,{els:u}=t,d;if(n===void 0&&(d=t.render(r),n=m(d)),c){c(n,d??t.render(r));return}let f=q(n);if(s||f===null){if(l=f===null?pe(n):f,d===void 0&&(d=t.render(r)),l.textContent=d,f!==null)return;if(i){let e=document.head.getElementsByTagName(`style`)[0]||null;document.head.insertBefore(l,e)}else document.head.appendChild(l);a&&Y(l,1),me(u,l)}else{let e=J(f);a?e===null?console.error(`[css-render/mount]: The style with id='${n}' has been mounted in no-count mode.`):Y(f,e+1):e!==null&&console.error(`[css-render/mount]: The style with id='${n}' has been mounted in count mode.`)}return f??l}function ge(e){return G(this,this.instance,e)}function _e(e={}){let{target:t,id:n,ssr:r,props:i,count:a=!1,head:o=!1,boost:s=!1,force:c=!1}=e;return he(this.instance,this,n??t,i,o,a,s,c,r)}function ve(e={}){let{id:t,target:n,delay:r=0,count:i=!1}=e;r===0?X(this.instance,this,t??n,i):setTimeout(()=>X(this.instance,this,t??n,i),r)}var Z=function(e,t,n,r){return{instance:e,$:t,props:n,children:r,els:[],render:ge,mount:_e,unmount:ve}},ye=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 be(e={}){let t=null,n={c:((...e)=>ye(n,...e)),use:(e,...t)=>e.install(n,...t),find:q,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:Q}=be(),xe=Q(`.xicon`,{width:`1em`,height:`1em`,display:`inline-flex`},[Q(`svg`,{width:`1em`,height:`1em`}),Q(`svg:not([fill])`,{fill:`currentColor`})]),Se=()=>{xe.mount({id:`xicons-icon`})},Ce={size:[String,Number],color:String,tag:String},$=Symbol(`IconConfigInjection`);h({name:`IconConfigProvider`,props:Ce,setup(e,{slots:t}){return c($,e),()=>i(t,`default`)}});var we=`span`,Te=h({name:`Icon`,props:Ce,setup(e,{slots:a}){let o=n($,null),s=S(()=>{let t=e.size??o?.size;if(t!==void 0)return typeof t==`number`||/^\d+$/.test(t)?`${t}px`:t}),c=S(()=>{let{color:t}=e;return t===void 0?o?o.color:void 0:t}),l=S(()=>{let{tag:t}=e;return t===void 0?o?.tag??we:t});return t(()=>{Se()}),()=>r(l.value,{class:`xicon`,style:{color:c.value,fontSize:s.value}},[i(a,`default`)])}}),Ee=ee(`ui`,()=>{let e=C([]),t=C(null),n=C(!0),r=0;async function i(){let i=j(),a=i.getToken(),o=++r;e.value=[],t.value=null,n.value=!0;try{let n=await A().GetPermissions({});if(o!==r)return;a===i.getToken()&&(e.value=n.permissions||[]),(n.environment===`prod`||n.environment===`venue`)&&(t.value=n.environment)}catch(e){if(o===r)throw e}finally{o===r&&(n.value=!1)}}return{permissions:e,environment:t,isLoadingEnvironment:n,load:i}});export{M as a,N as c,re as i,Te as n,F as o,ie as r,P as s,Ee as t};