utils-558ca3aa.js 33 KB

12345678
  1. import{b as e,f as t,I as n,m as o,n as a,T as r,U as l,V as i,Q as s,q as u,B as c,R as d,t as f,W as m,O as p,K as h,v as g,j as v,X as b,d as y,x,y as w,e as S,N as _,Y as k,Z as B,_ as C,D as F,$ as M,a0 as T,a1 as N,a2 as I,J as P,a3 as z,a4 as E,a5 as L,a6 as O,a7 as V,A as $,a8 as H,i as j,a9 as D,aa as q,S as A}from"./index-aa713bea.js";import{L as R,r as W,s as K}from"./request-1531f574.js";import{d as Y,c as Z,r as U,g as G,j as J,w as Q,q as X,n as ee,f as te,p as ne,h as oe,a as ae,t as re,e as le,k as ie,y as se,z as ue}from"./index-274ed794.js";import{u as ce}from"./use-id-1cec4fad.js";const[de,fe]=e("button"),me=u(Y({name:de,props:t({},n,{tag:o("button"),text:String,icon:String,type:o("default"),size:o("normal"),color:String,block:Boolean,plain:Boolean,round:Boolean,square:Boolean,loading:Boolean,hairline:Boolean,disabled:Boolean,iconPrefix:String,nativeType:o("button"),loadingSize:a,loadingText:String,loadingType:String,iconPosition:o("left")}),emits:["click"],setup(e,{emit:t,slots:n}){const o=r(),a=()=>e.loading?n.loading?n.loading():Z(R,{size:e.loadingSize,type:e.loadingType,"class":fe("loading")},null):n.icon?Z("div",{"class":fe("icon")},[n.icon()]):e.icon?Z(i,{name:e.icon,"class":fe("icon"),classPrefix:e.iconPrefix},null):void 0,u=()=>{let t;if(t=e.loading?e.loadingText:n["default"]?n["default"]():e.text,t)return Z("span",{"class":fe("text")},[t])},c=()=>{const{color:t,plain:n}=e;if(t){const e={color:n?t:"white"};return n||(e.background=t),t.includes("gradient")?e.border=0:e.borderColor=t,e}},d=n=>{e.loading?s(n):e.disabled||(t("click",n),o())};return()=>{const{tag:t,type:n,size:o,block:r,round:i,plain:s,square:f,loading:m,disabled:p,hairline:h,nativeType:g,iconPosition:v}=e,b=[fe([n,o,{plain:s,block:r,round:i,square:f,loading:m,disabled:p,hairline:h}]),{[l]:h}];return Z(t,{type:g,"class":b,style:c(),disabled:p,onClick:d},{"default":()=>[Z("div",{"class":fe("content")},["left"===v&&a(),u(),"right"===v&&a()])]})}}})),[pe,he,ge]=e("picker"),ve=e=>e.find((e=>!e.disabled))||e[0];function be(e,t){for(let n=t=d(t,0,e.length);n<e.length;n++)if(!e[n].disabled)return n;for(let n=t-1;n>=0;n--)if(!e[n].disabled)return n;return 0}const ye=(e,t,n)=>void 0!==t&&!!e.find((e=>e[n.value]===t));function xe(e,t,n){const o=e.findIndex((e=>e[n.value]===t));return e[be(e,o)]}const[we,Se]=e("picker-column"),_e=Symbol(we);var ke=Y({name:we,props:{value:a,fields:f(Object),options:m(),readonly:Boolean,allowHtml:Boolean,optionHeight:f(Number),swipeDuration:f(a),visibleOptionNum:f(a)},emits:["change","clickOption","scrollInto"],setup(e,{emit:t,slots:n}){let o,a,r,l,i;const u=U(),c=U(),f=U(0),m=U(0),b=p(),y=()=>e.options.length,x=()=>e.optionHeight*(+e.visibleOptionNum-1)/2,w=n=>{let a=be(e.options,n);const r=-a*e.optionHeight,l=()=>{a>y()-1&&(a=be(e.options,n));const o=e.options[a][e.fields.value];o!==e.value&&t("change",o)};o&&r!==f.value?i=l:l(),f.value=r},S=()=>e.readonly||!e.options.length,_=t=>d(Math.round(-t/e.optionHeight),0,y()-1),k=G((()=>_(f.value))),B=()=>{o=!1,m.value=0,i&&(i(),i=null)},C=e=>{if(!S()){if(b.start(e),o){const e=function(e){const{transform:t}=window.getComputedStyle(e),n=t.slice(7,t.length-1).split(", ")[5];return Number(n)}(c.value);f.value=Math.min(0,e-x())}m.value=0,a=f.value,r=Date.now(),l=a,i=null}},F=()=>{if(S())return;const t=f.value-l,n=Date.now()-r;if(n<300&&Math.abs(t)>15)return void((t,n)=>{const o=Math.abs(t/n);t=f.value+o/.003*(t<0?-1:1);const a=_(t);m.value=+e.swipeDuration,w(a)})(t,n);const a=_(f.value);m.value=200,w(a),setTimeout((()=>{o=!1}),0)},M=()=>{const a={height:"".concat(e.optionHeight,"px")};return e.options.map(((r,l)=>{const s=r[e.fields.text],{disabled:u}=r,c=r[e.fields.value],d={role:"button",style:a,tabindex:u?-1:0,"class":[Se("item",{disabled:u,selected:c===e.value}),r.className],onClick:()=>{return n=l,void(o||S()||(i=null,m.value=200,w(n),t("clickOption",e.options[n])));var n}},f={"class":"van-ellipsis",[e.allowHtml?"innerHTML":"textContent"]:s};return Z("li",d,[n.option?n.option(r,l):Z("div",f,null)])}))};return h(_e),g({stopMomentum:B}),J((()=>{const t=o?Math.floor(-f.value/e.optionHeight):e.options.findIndex((t=>t[e.fields.value]===e.value)),n=be(e.options,t),a=-n*e.optionHeight;o&&n<t&&B(),f.value=a})),v("touchmove",(n=>{if(S())return;b.move(n),b.isVertical()&&(o=!0,s(n,!0));const i=d(a+b.deltaY.value,-y()*e.optionHeight,e.optionHeight),u=_(i);u!==k.value&&t("scrollInto",e.options[u]),f.value=i;const c=Date.now();c-r>300&&(r=c,l=i)}),{target:u}),()=>Z("div",{ref:u,"class":Se(),onTouchstartPassive:C,onTouchend:F,onTouchcancel:F},[Z("ul",{ref:c,style:{transform:"translate3d(0, ".concat(f.value+x(),"px, 0)"),transitionDuration:"".concat(m.value,"ms"),transitionProperty:m.value?"all":"none"},"class":Se("wrapper"),onTransitionend:B},[M()])])}});const[Be]=e("picker-toolbar"),Ce={title:String,cancelButtonText:String,confirmButtonText:String},Fe=["cancel","confirm","title","toolbar"],Me=Object.keys(Ce);var Te=Y({name:Be,props:Ce,emits:["confirm","cancel"],setup(e,{emit:t,slots:n}){const o=()=>t("cancel"),a=()=>t("confirm"),r=()=>{const t=e.cancelButtonText||ge("cancel");return Z("button",{type:"button","class":[he("cancel"),b],onClick:o},[n.cancel?n.cancel():t])},l=()=>{const t=e.confirmButtonText||ge("confirm");return Z("button",{type:"button","class":[he("confirm"),b],onClick:a},[n.confirm?n.confirm():t])};return()=>Z("div",{"class":he("toolbar")},[n.toolbar?n.toolbar():[r(),n.title?n.title():e.title?Z("div",{"class":[he("title"),"van-ellipsis"]},[e.title]):void 0,l()]])}});const[Ne,Ie]=e("picker-group"),Pe=Symbol(Ne);t({tabs:m(),activeTab:y(0),nextStepText:String},Ce);const ze=t({loading:Boolean,readonly:Boolean,allowHtml:Boolean,optionHeight:y(44),showToolbar:x,swipeDuration:y(1e3),visibleOptionNum:y(6)},Ce),Ee=u(Y({name:pe,props:t({},ze,{columns:m(),modelValue:m(),toolbarPosition:o("top"),columnsFieldNames:Object}),emits:["confirm","cancel","change","scrollInto","clickOption","update:modelValue"],setup(e,{emit:n,slots:o}){const a=U(),r=U(e.modelValue.slice(0)),{parent:l}=h(Pe),{children:i,linkChildren:u}=w(_e);u();const d=G((()=>{return n=e.columnsFieldNames,t({text:"text",value:"value",children:"children"},n);var n})),f=G((()=>S(e.optionHeight))),m=G((()=>function(e,t){const n=e[0];if(n){if(Array.isArray(n))return"multiple";if(t.children in n)return"cascade"}return"default"}(e.columns,d.value))),p=G((()=>{const{columns:t}=e;switch(m.value){case"multiple":return t;case"cascade":return function(e,t,n){const o=[];let a={[t.children]:e},r=0;for(;a&&a[t.children];){const e=a[t.children],l=n.value[r];a=c(l)?xe(e,l,t):void 0,!a&&e.length&&(a=xe(e,ve(e)[t.value],t)),r++,o.push(e)}return o}(t,d.value,r);default:return[t]}})),b=G((()=>p.value.some((e=>e.length)))),y=G((()=>p.value.map(((e,t)=>xe(e,r.value[t],d.value))))),x=G((()=>p.value.map(((e,t)=>e.findIndex((e=>e[d.value.value]===r.value[t])))))),C=(e,t)=>{if(r.value[e]!==t){const n=r.value.slice(0);n[e]=t,r.value=n}},F=()=>({selectedValues:r.value.slice(0),selectedOptions:y.value,selectedIndexes:x.value}),M=()=>{i.forEach((e=>e.stopMomentum()));const e=F();return ee((()=>{n("confirm",e)})),e},T=()=>n("cancel",F()),N=e=>{if(b.value){const t={height:"".concat(f.value,"px")},n={backgroundSize:"100% ".concat((e-f.value)/2,"px")};return[Z("div",{"class":he("mask"),style:n},null),Z("div",{"class":[B,he("frame")],style:t},null)]}},I=()=>{const l=f.value*+e.visibleOptionNum,i={height:"".concat(l,"px")};return Z("div",{ref:a,"class":he("columns"),style:i},[p.value.map(((a,l)=>Z(ke,{value:r.value[l],fields:d.value,options:a,readonly:e.readonly,allowHtml:e.allowHtml,optionHeight:f.value,swipeDuration:e.swipeDuration,visibleOptionNum:e.visibleOptionNum,onChange:e=>{return C(o=l,e),"cascade"===m.value&&r.value.forEach(((e,t)=>{const n=p.value[t];ye(n,e,d.value)||C(t,n.length?n[0][d.value.value]:void 0)})),void ee((()=>{n("change",t({columnIndex:o},F()))}));var o},onClickOption:e=>((e,o)=>{const a={columnIndex:o,currentOption:e};n("clickOption",t(F(),a)),n("scrollInto",a)})(e,l),onScrollInto:e=>{n("scrollInto",{currentOption:e,columnIndex:l})}},{option:o.option}))),N(l)])},P=()=>{if(e.showToolbar&&!l)return Z(Te,X(_(e,Me),{onConfirm:M,onCancel:T}),_(o,Fe))};let z;return Q(p,(e=>{e.forEach(((e,t)=>{e.length&&!ye(e,r.value[t],d.value)&&C(t,ve(e)[d.value.value])}))}),{immediate:!0}),Q((()=>e.modelValue),(e=>{k(e,r.value)||k(e,z)||(r.value=e.slice(0),z=e.slice(0))}),{deep:!0}),Q(r,(t=>{k(t,e.modelValue)||(z=t.slice(0),n("update:modelValue",z))}),{immediate:!0}),v("touchmove",s,{target:a}),g({confirm:M,getSelectedOptions:()=>y.value}),()=>{var t,n;return Z("div",{"class":he()},["top"===e.toolbarPosition?P():null,e.loading?Z(R,{"class":he("loading")},null):null,null==(t=o["columns-top"])?void 0:t.call(o),I(),null==(n=o["columns-bottom"])?void 0:n.call(o),"bottom"===e.toolbarPosition?P():null])}}}));function Le(e){return Array.isArray(e)?!e.length:0!==e&&!e}function Oe(e,t){const{message:n}=t;return N(n)?n(e,t):n||""}function Ve({target:e}){e.composing=!0}function $e({target:e}){e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}function He(e){return[...e].length}function je(e,t){return[...e].slice(0,t).join("")}const[De,qe]=e("field"),Ae={id:String,name:String,leftIcon:String,rightIcon:String,autofocus:Boolean,clearable:Boolean,maxlength:a,formatter:Function,clearIcon:o("clear"),modelValue:y(""),inputAlign:String,placeholder:String,autocomplete:String,autocapitalize:String,autocorrect:String,errorMessage:String,enterkeyhint:String,clearTrigger:o("focus"),formatTrigger:o("onChange"),spellcheck:{type:Boolean,"default":null},error:{type:Boolean,"default":null},disabled:{type:Boolean,"default":null},readonly:{type:Boolean,"default":null}},Re=u(Y({name:De,props:t({},I,Ae,{rows:a,type:o("text"),rules:Array,autosize:[Boolean,Object],labelWidth:a,labelClass:P,labelAlign:String,showWordLimit:Boolean,errorMessageAlign:String,colon:{type:Boolean,"default":null}}),emits:["blur","focus","clear","keypress","clickInput","endValidate","startValidate","clickLeftIcon","clickRightIcon","update:modelValue"],setup(e,{emit:t,slots:n}){const o=ce(),a=te({status:"unvalidated",focused:!1,validateMessage:""}),r=U(),l=U(),u=U(),{parent:d}=h(L),f=()=>{var t;return String(null!=(t=e.modelValue)?t:"")},m=t=>c(e[t])?e[t]:d&&c(d.props[t])?d.props[t]:void 0,p=G((()=>{const t=m("readonly");if(e.clearable&&!t){const t=""!==f(),n="always"===e.clearTrigger||"focus"===e.clearTrigger&&a.focused;return t&&n}return!1})),b=G((()=>u.value&&n.input?u.value():e.modelValue)),y=G((()=>{var t;const n=m("required");return"auto"===n?null==(t=e.rules)?void 0:t.some((e=>e.required)):n})),x=()=>{a.status="unvalidated",a.validateMessage=""},w=()=>t("endValidate",{status:a.status,message:a.validateMessage}),S=(n=e.rules)=>new Promise((o=>{var r;x(),n?(t("startValidate"),(r=n,r.reduce(((e,t)=>e.then((()=>{if("failed"===a.status)return;let{value:e}=b;if(t.formatter&&(e=t.formatter(e,t)),!function(e,t){if(Le(e)){if(t.required)return!1;if(!1===t.validateEmpty)return!0}return!(t.pattern&&!t.pattern.test(String(e)))}(e,t))return a.status="failed",void(a.validateMessage=Oe(e,t));if(t.validator){if(Le(e)&&!1===t.validateEmpty)return;return(n=e,o=t,new Promise((e=>{const t=o.validator(n,o);T(t)?t.then(e):e(t)}))).then((n=>{n&&"string"==typeof n?(a.status="failed",a.validateMessage=n):!1===n&&(a.status="failed",a.validateMessage=Oe(e,t))}))}var n,o}))),Promise.resolve())).then((()=>{"failed"===a.status?(o({name:e.name,message:a.validateMessage}),w()):(a.status="passed",o(),w())}))):o()})),_=t=>{if(d&&e.rules){const{validateTrigger:n}=d.props,o=O(n).includes(t),a=e.rules.filter((e=>e.trigger?O(e.trigger).includes(t):o));a.length&&S(a)}},k=(n,o="onChange")=>{const l=n;n=(t=>{var n;const{maxlength:o}=e;if(c(o)&&He(t)>+o){const e=f();if(e&&He(e)===+o)return e;const l=null==(n=r.value)?void 0:n.selectionEnd;if(a.focused&&l){const e=[...t],n=e.length-+o;return e.splice(l-n,n),e.join("")}return je(t,+o)}return t})(n);const i=He(l)-He(n);if("number"===e.type||"digit"===e.type){const t="number"===e.type;n=V(n,t,t)}let s=0;if(e.formatter&&o===e.formatTrigger){const{formatter:t,maxlength:o}=e;if(n=t(n),c(o)&&He(n)>+o&&(n=je(n,+o)),r.value&&a.focused){const{selectionEnd:e}=r.value,n=je(l,e);s=He(t(n))-He(n)}}if(r.value&&r.value.value!==n)if(a.focused){let{selectionStart:e,selectionEnd:t}=r.value;if(r.value.value=n,c(e)&&c(t)){const o=He(n);i?(e-=i,t-=i):s&&(e+=s,t+=s),r.value.setSelectionRange(Math.min(e,o),Math.min(t,o))}}else r.value.value=n;n!==e.modelValue&&t("update:modelValue",n)},B=e=>{e.target.composing||k(e.target.value)},N=()=>{var e;return null==(e=r.value)?void 0:e.blur()},I=()=>{var e;return null==(e=r.value)?void 0:e.focus()},P=()=>{const t=r.value;"textarea"===e.type&&e.autosize&&t&&function(e,t){const n=C();e.style.height="auto";let o=e.scrollHeight;if(M(t)){const{maxHeight:e,minHeight:n}=t;void 0!==e&&(o=Math.min(o,e)),void 0!==n&&(o=Math.max(o,n))}o&&(e.style.height="".concat(o,"px"),F(n))}(t,e.autosize)},j=e=>{a.focused=!0,t("focus",e),ee(P),m("readonly")&&N()},D=e=>{a.focused=!1,k(f(),"onBlur"),t("blur",e),m("readonly")||(_("onBlur"),ee(P),H())},q=e=>t("clickInput",e),A=e=>t("clickLeftIcon",e),R=e=>t("clickRightIcon",e),W=G((()=>"boolean"==typeof e.error?e.error:!(!d||!d.props.showError||"failed"!==a.status)||void 0)),K=G((()=>{const e=m("labelWidth"),t=m("labelAlign");if(e&&"top"!==t)return{width:$(e)}})),Y=n=>{13===n.keyCode&&(d&&d.props.submitOnEnter||"textarea"===e.type||s(n),"search"===e.type&&N()),t("keypress",n)},J=()=>e.id||"".concat(o,"-input"),re=()=>{const t=qe("control",[m("inputAlign"),{error:W.value,custom:!!n.input,"min-height":"textarea"===e.type&&!e.autosize}]);if(n.input)return Z("div",{"class":t,onClick:q},[n.input()]);const a={id:J(),ref:r,name:e.name,rows:void 0!==e.rows?+e.rows:void 0,"class":t,disabled:m("disabled"),readonly:m("readonly"),autofocus:e.autofocus,placeholder:e.placeholder,autocomplete:e.autocomplete,autocapitalize:e.autocapitalize,autocorrect:e.autocorrect,enterkeyhint:e.enterkeyhint,spellcheck:e.spellcheck,"aria-labelledby":e.label?"".concat(o,"-label"):void 0,onBlur:D,onFocus:j,onInput:B,onClick:q,onChange:$e,onKeypress:Y,onCompositionend:$e,onCompositionstart:Ve};return"textarea"===e.type?Z("textarea",a,null):Z("input",X("number"===(l=e.type)?{type:"text",inputmode:"decimal"}:"digit"===l?{type:"tel",inputmode:"numeric"}:{type:l},a),null);var l},le=()=>{const t=n["right-icon"];if(e.rightIcon||t)return Z("div",{"class":qe("right-icon"),onClick:R},[t?t():Z(i,{name:e.rightIcon,classPrefix:e.iconPrefix},null)])},ie=()=>{if(e.showWordLimit&&e.maxlength){const t=He(f());return Z("div",{"class":qe("word-limit")},[Z("span",{"class":qe("word-num")},[t]),ae("/"),e.maxlength])}},se=()=>{if(d&&!1===d.props.showErrorMessage)return;const t=e.errorMessage||a.validateMessage;if(t){const e=n["error-message"],o=m("errorMessageAlign");return Z("div",{"class":qe("error-message",o)},[e?e({message:t}):t])}},ue=()=>[Z("div",{"class":qe("body")},[re(),p.value&&Z(i,{ref:l,name:e.clearIcon,"class":qe("clear")},null),le(),n.button&&Z("div",{"class":qe("button")},[n.button()])]),ie(),se()];return g({blur:N,focus:I,validate:S,formValue:b,resetValidation:x,getValidationStatus:()=>a.status}),ne(z,{customValue:u,resetValidation:x,validateWithTrigger:_}),Q((()=>e.modelValue),(()=>{k(f()),x(),_("onChange"),ee(P)})),oe((()=>{k(f(),e.formatTrigger),ee(P)})),v("touchstart",(e=>{s(e),t("update:modelValue",""),t("clear",e)}),{target:G((()=>{var e;return null==(e=l.value)?void 0:e.$el}))}),()=>{const t=m("disabled"),a=m("labelAlign"),r=(()=>{const t=n["left-icon"];if(e.leftIcon||t)return Z("div",{"class":qe("left-icon"),onClick:A},[t?t():Z(i,{name:e.leftIcon,classPrefix:e.iconPrefix},null)])})();return Z(E,{size:e.size,"class":qe({error:W.value,disabled:t,["label-".concat(a)]:a}),center:e.center,border:e.border,isLink:e.isLink,clickable:e.clickable,titleStyle:K.value,valueClass:qe("value"),titleClass:[qe("label",[a,{required:y.value}]),e.labelClass],arrowDirection:e.arrowDirection},{icon:r&&"top"!==a?()=>r:null,title:()=>{const t=(()=>{const t=m("labelWidth"),a=m("labelAlign"),r=m("colon")?":":"";return n.label?[n.label(),r]:e.label?Z("label",{id:"".concat(o,"-label"),"for":n.input?void 0:J(),onClick:e=>{s(e),I()},style:"top"===a&&t?{width:$(t)}:void 0},[e.label+r]):void 0})();return"top"===a?[r,t].filter(Boolean):t||[]},value:ue,extra:n.extra})}}})),[We,Ke]=e("image"),Ye=u(Y({name:We,props:{src:String,alt:String,fit:String,position:String,round:Boolean,block:Boolean,width:a,height:a,radius:a,lazyLoad:Boolean,iconSize:a,showError:x,errorIcon:o("photo-fail"),iconPrefix:String,showLoading:x,loadingIcon:o("photo")},emits:["load","error"],setup(e,{emit:t,slots:n}){const o=U(!1),a=U(!0),r=U(),{$Lazyload:l}=re().proxy,s=G((()=>{const t={width:$(e.width),height:$(e.height)};return c(e.radius)&&(t.overflow="hidden",t.borderRadius=$(e.radius)),t}));Q((()=>e.src),(()=>{o.value=!1,a.value=!0}));const u=e=>{a.value&&(a.value=!1,t("load",e))},d=()=>{const e=new Event("load");Object.defineProperty(e,"target",{value:r.value,enumerable:!0}),u(e)},f=e=>{o.value=!0,a.value=!1,t("error",e)},m=(t,n,o)=>o?o():Z(i,{name:t,size:e.iconSize,"class":n,classPrefix:e.iconPrefix},null),p=()=>{if(o.value||!e.src)return;const t={alt:e.alt,"class":Ke("img"),style:{objectFit:e.fit,objectPosition:e.position}};return e.lazyLoad?ie(Z("img",X({ref:r},t),null),[[se("lazy"),e.src]]):Z("img",X({ref:r,src:e.src,onLoad:u,onError:f},t),null)},h=({el:e})=>{const t=()=>{e===r.value&&a.value&&d()};r.value?t():ee(t)},g=({el:e})=>{e!==r.value||o.value||f()};return l&&j&&(l.$on("loaded",h),l.$on("error",g),le((()=>{l.$off("loaded",h),l.$off("error",g)}))),oe((()=>{ee((()=>{var t;(null==(t=r.value)?void 0:t.complete)&&!e.lazyLoad&&d()}))})),()=>{var t;return Z("div",{"class":Ke({round:e.round,block:e.block}),style:s.value},[p(),a.value&&e.showLoading?Z("div",{"class":Ke("loading")},[m(e.loadingIcon,Ke("loading-icon"),n.loading)]):o.value&&e.showError?Z("div",{"class":Ke("error")},[m(e.errorIcon,Ke("error-icon"),n.error)]):void 0,null==(t=n["default"])?void 0:t.call(n)])}}})),[Ze,Ue]=e("row"),Ge=Symbol(Ze);var Je=Y({name:Ze,props:{tag:o("div"),wrap:x,align:String,gutter:y(0),justify:String},setup(e,{slots:t}){const{children:n,linkChildren:o}=w(Ge),a=G((()=>{const e=[[]];let t=0;return n.forEach(((n,o)=>{t+=Number(n.span),t>24?(e.push([o]),t-=24):e[e.length-1].push(o)})),e}));return o({spaces:G((()=>{const t=Number(e.gutter),n=[];return t?(a.value.forEach((e=>{const o=t*(e.length-1)/e.length;e.forEach(((e,a)=>{if(0===a)n.push({right:o});else{const a=t-n[e-1].right,r=o-a;n.push({left:a,right:r})}}))})),n):n}))}),()=>{const{tag:n,wrap:o,align:a,justify:r}=e;return Z(n,{"class":Ue({["align-".concat(a)]:a,["justify-".concat(r)]:r,nowrap:!o})},{"default":()=>{var e;return[null==(e=t["default"])?void 0:e.call(t)]}})}}});const[Qe,Xe]=e("col"),et=u(Y({name:Qe,props:{tag:o("div"),span:y(0),offset:a},setup(e,{slots:t}){const{parent:n,index:o}=h(Ge),a=G((()=>{if(!n)return;const{spaces:e}=n;if(e&&e.value&&e.value[o.value]){const{left:t,right:n}=e.value[o.value];return{paddingLeft:t?"".concat(t,"px"):null,paddingRight:n?"".concat(n,"px"):null}}}));return()=>{const{tag:n,span:o,offset:r}=e;return Z(n,{style:a.value,"class":Xe({[o]:o,["offset-".concat(r)]:r})},{"default":()=>{var e;return[null==(e=t["default"])?void 0:e.call(t)]}})}}})),[tt,nt]=e("count-down"),ot=u(Y({name:tt,props:{time:y(0),format:o("HH:mm:ss"),autoStart:x,millisecond:Boolean},emits:["change","finish"],setup(e,{emit:t,slots:n}){const{start:o,pause:a,reset:r,current:l}=q({time:+e.time,millisecond:e.millisecond,onChange:e=>t("change",e),onFinish:()=>t("finish")}),i=G((()=>function(e,t){const{days:n}=t;let{hours:o,minutes:a,seconds:r,milliseconds:l}=t;if(e.includes("DD")?e=e.replace("DD",D(n)):o+=24*n,e.includes("HH")?e=e.replace("HH",D(o)):a+=60*o,e.includes("mm")?e=e.replace("mm",D(a)):r+=60*a,e.includes("ss")?e=e.replace("ss",D(r)):l+=1e3*r,e.includes("S")){const t=D(l,3);e=e.includes("SSS")?e.replace("SSS",t):e.includes("SS")?e.replace("SS",t.slice(0,2)):e.replace("S",t.charAt(0))}return e}(e.format,l.value))),s=()=>{r(+e.time),e.autoStart&&o()};return Q((()=>e.time),s,{immediate:!0}),g({start:o,pause:a,reset:s}),()=>Z("div",{role:"timer","class":nt()},[n["default"]?n["default"](l.value):i.value])}})),at=u(Je),rt=Y({name:"o-img-code",props:{value:Boolean,phone:[String,Number],type:{type:String,"default":""},clientId:{type:String,"default":"cooleshow-student"}},emits:["close","sendCode"],data(){return{isSuffix:"/api-website",showStatus:!1,identifyingCode:"/api-website/code/getImageCode?phone="+this.phone,code:""}},mounted(){this.showStatus=this.value},watch:{value(e){this.showStatus=e},code(e){e.length>=4&&this.checkVerifyLoginImage()}},methods:{async updateIdentifyingCode(){const e=window.location.origin;this.identifyingCode="".concat(e).concat(this.isSuffix,"/code/getImageCode?phone=").concat(this.phone,"&token=").concat(Math.random())},async checkVerifyLoginImage(){try{if(this.code.length<4)return;await W.post(this.isSuffix+"/code/verifyImageCode",{requestType:"form",hideLoading:!0,data:{phone:this.phone,code:this.code}}),await W.post("/api-website/code/sendSmsCode",{requestType:"form",hideLoading:!0,data:{mobile:this.phone,type:this.type}}),setTimeout((()=>{K("验证码已发送")}),100),this.$emit("close"),this.$emit("sendCode")}catch(e){this.code="",setTimeout((()=>{this.updateIdentifyingCode()}),500)}}},render(){return Z(A,{show:this.showStatus,"class":"_imgCodePopup_mq980_27",closeOnClickOverlay:!1,onClose:()=>{this.$emit("close")},closeable:!0,closeIcon:"close"},{"default":()=>[Z("div",{"class":"_imgCode_mq980_1"},[Z("p",{"class":"_codeTitle_mq980_4"},[ae("输入图形验证码")]),Z(at,null,{"default":()=>[Z(et,{span:"14"},{"default":()=>[Z(Re,{placeholder:"请输入验证码",modelValue:this.code,"onUpdate:modelValue":e=>this.code=e,"class":"_field_mq980_23",autocomplete:"off"},null)]}),Z(et,{span:"10","class":"_img_mq980_1"},{"default":()=>[Z(Ye,{src:this.identifyingCode,onClick:()=>this.updateIdentifyingCode()},{loading:()=>Z(R,{type:"spinner",size:"20"},null)})]})]}),Z(at,{style:{display:"flex",justifyContent:"end"}},{"default":()=>[Z(et,{span:"10"},{"default":()=>[Z("span",{"class":"_imgChange_mq980_16",onClick:()=>this.updateIdentifyingCode()},[ae("看不清?换一换")])]})]})])]})}});var lt,it,st;
  2. /*! @preserve
  3. * numeral.js
  4. * version : 2.0.6
  5. * author : Adam Draper
  6. * license : MIT
  7. * http://adamwdraper.github.com/Numeral-js/
  8. */function ut(e){return/^((13[0-9])|(14(0|[5-7]|9))|(15([0-3]|[5-9]))|(16(2|[5-7]))|(17[0-8])|(18[0-9])|(19([0-3]|[5-9])))\d{8}$/.test(e)}it=ue,st=function(){var e,t,n,o,a,r={},l={},i={currentLocale:"en",zeroFormat:null,nullFormat:null,defaultFormat:"0,0",scalePercentBy100:!0},s={currentLocale:i.currentLocale,zeroFormat:i.zeroFormat,nullFormat:i.nullFormat,defaultFormat:i.defaultFormat,scalePercentBy100:i.scalePercentBy100};function u(e,t){this._input=e,this._value=t}return(e=function(n){var o,a,l,i;if(e.isNumeral(n))o=n.value();else if(0===n||void 0===n)o=0;else if(null===n||t.isNaN(n))o=null;else if("string"==typeof n)if(s.zeroFormat&&n===s.zeroFormat)o=0;else if(s.nullFormat&&n===s.nullFormat||!n.replace(/[^0-9]+/g,"").length)o=null;else{for(a in r)if((i="function"==typeof r[a].regexps.unformat?r[a].regexps.unformat():r[a].regexps.unformat)&&n.match(i)){l=r[a].unformat;break}o=(l=l||e._.stringToNumber)(n)}else o=Number(n)||null;return new u(n,o)}).version="2.0.6",e.isNumeral=function(e){return e instanceof u},e._=t={numberToFormat:function(t,n,o){var a,r,i,s,u,c,d,f,m=l[e.options.currentLocale],p=!1,h=!1,g="",v=1e12,b=1e9,y=1e6,x="",w=!1;if(t=t||0,i=Math.abs(t),e._.includes(n,"(")?(p=!0,n=n.replace(/[\(|\)]/g,"")):(e._.includes(n,"+")||e._.includes(n,"-"))&&(c=e._.includes(n,"+")?n.indexOf("+"):t<0?n.indexOf("-"):-1,n=n.replace(/[\+|\-]/g,"")),e._.includes(n,"a")&&(r=!!(r=n.match(/a(k|m|b|t)?/))&&r[1],e._.includes(n," a")&&(g=" "),n=n.replace(new RegExp(g+"a[kmbt]?"),""),i>=v&&!r||"t"===r?(g+=m.abbreviations.trillion,t/=v):i<v&&i>=b&&!r||"b"===r?(g+=m.abbreviations.billion,t/=b):i<b&&i>=y&&!r||"m"===r?(g+=m.abbreviations.million,t/=y):(i<y&&i>=1e3&&!r||"k"===r)&&(g+=m.abbreviations.thousand,t/=1e3)),e._.includes(n,"[.]")&&(h=!0,n=n.replace("[.]",".")),s=t.toString().split(".")[0],u=n.split(".")[1],d=n.indexOf(","),a=(n.split(".")[0].split(",")[0].match(/0/g)||[]).length,u?(e._.includes(u,"[")?(u=(u=u.replace("]","")).split("["),x=e._.toFixed(t,u[0].length+u[1].length,o,u[1].length)):x=e._.toFixed(t,u.length,o),s=x.split(".")[0],x=e._.includes(x,".")?m.delimiters.decimal+x.split(".")[1]:"",h&&0===Number(x.slice(1))&&(x="")):s=e._.toFixed(t,0,o),g&&!r&&Number(s)>=1e3&&g!==m.abbreviations.trillion)switch(s=String(Number(s)/1e3),g){case m.abbreviations.thousand:g=m.abbreviations.million;break;case m.abbreviations.million:g=m.abbreviations.billion;break;case m.abbreviations.billion:g=m.abbreviations.trillion}if(e._.includes(s,"-")&&(s=s.slice(1),w=!0),s.length<a)for(var S=a-s.length;S>0;S--)s="0"+s;return d>-1&&(s=s.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+m.delimiters.thousands)),0===n.indexOf(".")&&(s=""),f=s+x+(g||""),p?f=(p&&w?"(":"")+f+(p&&w?")":""):c>=0?f=0===c?(w?"-":"+")+f:f+(w?"-":"+"):w&&(f="-"+f),f},stringToNumber:function(e){var t,n,o,a=l[s.currentLocale],r=e,i={thousand:3,million:6,billion:9,trillion:12};if(s.zeroFormat&&e===s.zeroFormat)n=0;else if(s.nullFormat&&e===s.nullFormat||!e.replace(/[^0-9]+/g,"").length)n=null;else{for(t in n=1,"."!==a.delimiters.decimal&&(e=e.replace(/\./g,"").replace(a.delimiters.decimal,".")),i)if(o=new RegExp("[^a-zA-Z]"+a.abbreviations[t]+"(?:\\)|(\\"+a.currency.symbol+")?(?:\\))?)?$"),r.match(o)){n*=Math.pow(10,i[t]);break}n*=(e.split("-").length+Math.min(e.split("(").length-1,e.split(")").length-1))%2?1:-1,e=e.replace(/[^0-9\.]+/g,""),n*=Number(e)}return n},isNaN:function(e){return"number"==typeof e&&isNaN(e)},includes:function(e,t){return-1!==e.indexOf(t)},insert:function(e,t,n){return e.slice(0,n)+t+e.slice(n)},reduce:function(e,t){if(null===this)throw new TypeError("Array.prototype.reduce called on null or undefined");if("function"!=typeof t)throw new TypeError(t+" is not a function");var n,o=Object(e),a=o.length>>>0,r=0;if(3===arguments.length)n=arguments[2];else{for(;r<a&&!(r in o);)r++;if(r>=a)throw new TypeError("Reduce of empty array with no initial value");n=o[r++]}for(;r<a;r++)r in o&&(n=t(n,o[r],r,o));return n},multiplier:function(e){var t=e.toString().split(".");return t.length<2?1:Math.pow(10,t[1].length)},correctionFactor:function(){return Array.prototype.slice.call(arguments).reduce((function(e,n){var o=t.multiplier(n);return e>o?e:o}),1)},toFixed:function(e,t,n,o){var a,r,l,i,s=e.toString().split("."),u=t-(o||0);return a=2===s.length?Math.min(Math.max(s[1].length,u),t):u,l=Math.pow(10,a),i=(n(e+"e+"+a)/l).toFixed(a),o>t-a&&(r=new RegExp("\\.?0{1,"+(o-(t-a))+"}$"),i=i.replace(r,"")),i}},e.options=s,e.formats=r,e.locales=l,e.locale=function(e){return e&&(s.currentLocale=e.toLowerCase()),s.currentLocale},e.localeData=function(e){if(!e)return l[s.currentLocale];if(e=e.toLowerCase(),!l[e])throw new Error("Unknown locale : "+e);return l[e]},e.reset=function(){for(var e in i)s[e]=i[e]},e.zeroFormat=function(e){s.zeroFormat="string"==typeof e?e:null},e.nullFormat=function(e){s.nullFormat="string"==typeof e?e:null},e.defaultFormat=function(e){s.defaultFormat="string"==typeof e?e:"0.0"},e.register=function(e,t,n){if(t=t.toLowerCase(),this[e+"s"][t])throw new TypeError(t+" "+e+" already registered.");return this[e+"s"][t]=n,n},e.validate=function(t,n){var o,a,r,l,i,s,u,c;if("string"!=typeof t&&(t+="",console.warn),(t=t.trim()).match(/^\d+$/))return!0;if(""===t)return!1;try{u=e.localeData(n)}catch(d){u=e.localeData(e.locale())}return r=u.currency.symbol,i=u.abbreviations,o=u.delimiters.decimal,a="."===u.delimiters.thousands?"\\.":u.delimiters.thousands,!(null!==(c=t.match(/^[^\d]+/))&&(t=t.substr(1),c[0]!==r)||null!==(c=t.match(/[^\d]+$/))&&(t=t.slice(0,-1),c[0]!==i.thousand&&c[0]!==i.million&&c[0]!==i.billion&&c[0]!==i.trillion)||(s=new RegExp(a+"{2}"),t.match(/[^\d.,]/g)||(l=t.split(o)).length>2||(l.length<2?!l[0].match(/^\d+.*\d$/)||l[0].match(s):1===l[0].length?!l[0].match(/^\d+$/)||l[0].match(s)||!l[1].match(/^\d+$/):!l[0].match(/^\d+.*\d$/)||l[0].match(s)||!l[1].match(/^\d+$/))))},e.fn=u.prototype={clone:function(){return e(this)},format:function(t,n){var o,a,l,i=this._value,u=t||s.defaultFormat;if(n=n||Math.round,0===i&&null!==s.zeroFormat)a=s.zeroFormat;else if(null===i&&null!==s.nullFormat)a=s.nullFormat;else{for(o in r)if(u.match(r[o].regexps.format)){l=r[o].format;break}a=(l=l||e._.numberToFormat)(i,u,n)}return a},value:function(){return this._value},input:function(){return this._input},set:function(e){return this._value=Number(e),this},add:function(e){var n=t.correctionFactor.call(null,this._value,e);return this._value=t.reduce([this._value,e],(function(e,t,o,a){return e+Math.round(n*t)}),0)/n,this},subtract:function(e){var n=t.correctionFactor.call(null,this._value,e);return this._value=t.reduce([e],(function(e,t,o,a){return e-Math.round(n*t)}),Math.round(this._value*n))/n,this},multiply:function(e){return this._value=t.reduce([this._value,e],(function(e,n,o,a){var r=t.correctionFactor(e,n);return Math.round(e*r)*Math.round(n*r)/Math.round(r*r)}),1),this},divide:function(e){return this._value=t.reduce([this._value,e],(function(e,n,o,a){var r=t.correctionFactor(e,n);return Math.round(e*r)/Math.round(n*r)})),this},difference:function(t){return Math.abs(e(this._value).subtract(t).value())}},e.register("locale","en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(e){var t=e%10;return 1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th"},currency:{symbol:"$"}}),e.register("format","bps",{regexps:{format:/(BPS)/,unformat:/(BPS)/},format:function(t,n,o){var a,r=e._.includes(n," BPS")?" ":"";return t*=1e4,n=n.replace(/\s?BPS/,""),a=e._.numberToFormat(t,n,o),e._.includes(a,")")?((a=a.split("")).splice(-1,0,r+"BPS"),a=a.join("")):a=a+r+"BPS",a},unformat:function(t){return+(1e-4*e._.stringToNumber(t)).toFixed(15)}}),o={base:1024,suffixes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},a="("+(a=(n={base:1e3,suffixes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}).suffixes.concat(o.suffixes.filter((function(e){return n.suffixes.indexOf(e)<0}))).join("|")).replace("B","B(?!PS)")+")",e.register("format","bytes",{regexps:{format:/([0\s]i?b)/,unformat:new RegExp(a)},format:function(t,a,r){var l,i,s,u=e._.includes(a,"ib")?o:n,c=e._.includes(a," b")||e._.includes(a," ib")?" ":"";for(a=a.replace(/\s?i?b/,""),l=0;l<=u.suffixes.length;l++)if(i=Math.pow(u.base,l),s=Math.pow(u.base,l+1),null===t||0===t||t>=i&&t<s){c+=u.suffixes[l],i>0&&(t/=i);break}return e._.numberToFormat(t,a,r)+c},unformat:function(t){var a,r,l=e._.stringToNumber(t);if(l){for(a=n.suffixes.length-1;a>=0;a--){if(e._.includes(t,n.suffixes[a])){r=Math.pow(n.base,a);break}if(e._.includes(t,o.suffixes[a])){r=Math.pow(o.base,a);break}}l*=r||1}return l}}),e.register("format","currency",{regexps:{format:/(\$)/},format:function(t,n,o){var a,r,l=e.locales[e.options.currentLocale],i={before:n.match(/^([\+|\-|\(|\s|\$]*)/)[0],after:n.match(/([\+|\-|\)|\s|\$]*)$/)[0]};for(n=n.replace(/\s?\$\s?/,""),a=e._.numberToFormat(t,n,o),t>=0?(i.before=i.before.replace(/[\-\(]/,""),i.after=i.after.replace(/[\-\)]/,"")):t<0&&!e._.includes(i.before,"-")&&!e._.includes(i.before,"(")&&(i.before="-"+i.before),r=0;r<i.before.length;r++)switch(i.before[r]){case"$":a=e._.insert(a,l.currency.symbol,r);break;case" ":a=e._.insert(a," ",r+l.currency.symbol.length-1)}for(r=i.after.length-1;r>=0;r--)switch(i.after[r]){case"$":a=r===i.after.length-1?a+l.currency.symbol:e._.insert(a,l.currency.symbol,-(i.after.length-(1+r)));break;case" ":a=r===i.after.length-1?a+" ":e._.insert(a," ",-(i.after.length-(1+r)+l.currency.symbol.length-1))}return a}}),e.register("format","exponential",{regexps:{format:/(e\+|e-)/,unformat:/(e\+|e-)/},format:function(t,n,o){var a=("number"!=typeof t||e._.isNaN(t)?"0e+0":t.toExponential()).split("e");return n=n.replace(/e[\+|\-]{1}0/,""),e._.numberToFormat(Number(a[0]),n,o)+"e"+a[1]},unformat:function(t){var n=e._.includes(t,"e+")?t.split("e+"):t.split("e-"),o=Number(n[0]),a=Number(n[1]);return a=e._.includes(t,"e-")?a*=-1:a,e._.reduce([o,Math.pow(10,a)],(function(t,n,o,a){var r=e._.correctionFactor(t,n);return t*r*(n*r)/(r*r)}),1)}}),e.register("format","ordinal",{regexps:{format:/(o)/},format:function(t,n,o){var a=e.locales[e.options.currentLocale],r=e._.includes(n," o")?" ":"";return n=n.replace(/\s?o/,""),r+=a.ordinal(t),e._.numberToFormat(t,n,o)+r}}),e.register("format","percentage",{regexps:{format:/(%)/,unformat:/(%)/},format:function(t,n,o){var a,r=e._.includes(n," %")?" ":"";return e.options.scalePercentBy100&&(t*=100),n=n.replace(/\s?\%/,""),a=e._.numberToFormat(t,n,o),e._.includes(a,")")?((a=a.split("")).splice(-1,0,r+"%"),a=a.join("")):a=a+r+"%",a},unformat:function(t){var n=e._.stringToNumber(t);return e.options.scalePercentBy100?.01*n:n}}),e.register("format","time",{regexps:{format:/(:)/,unformat:/(:)/},format:function(e,t,n){var o=Math.floor(e/60/60),a=Math.floor((e-60*o*60)/60),r=Math.round(e-60*o*60-60*a);return o+":"+(a<10?"0"+a:a)+":"+(r<10?"0"+r:r)},unformat:function(e){var t=e.split(":"),n=0;return 3===t.length?(n+=60*Number(t[0])*60,n+=60*Number(t[1]),n+=Number(t[2])):2===t.length&&(n+=60*Number(t[0]),n+=Number(t[1])),Number(n)}}),e},(lt={exports:{}}).exports?lt.exports=st():it.numeral=st();export{me as B,ot as C,Re as F,rt as M,Ee as P,ut as c};