1 |
- import{b as e,f as t,I as a,m as o,n,T as l,U as i,V as s,Q as r,q as c,B as u,R as d,t as p,W as m,O as v,K as g,v as f,j as h,X as b,d as y,x as S,y as x,e as w,N as k,Y as C,Z as I,_ as B,D as T,$ as V,a0 as H,a1 as M,a2 as z,J as O,a3 as P,a4 as E,a5 as L,a6 as _,a7 as j,A as q,a8 as A,i as D,a9 as N,aa as $,S as F}from"./index-e0856e19.js";import{L as W,u as R,r as K,s as U}from"./utils-4b852c38.js";import{d as Y,c as J,r as Q,g as X,j as Z,w as G,q as ee,n as te,f as ae,p as oe,h as ne,a as le,t as ie,e as se,k as re,A as ce}from"./index-3963321d.js";const[ue,de]=e("button"),pe=c(Y({name:ue,props:t({},a,{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:n,loadingText:String,loadingType:String,iconPosition:o("left")}),emits:["click"],setup(e,{emit:t,slots:a}){const o=l(),n=()=>e.loading?a.loading?a.loading():J(W,{size:e.loadingSize,type:e.loadingType,"class":de("loading")},null):a.icon?J("div",{"class":de("icon")},[a.icon()]):e.icon?J(s,{name:e.icon,"class":de("icon"),classPrefix:e.iconPrefix},null):void 0,c=()=>{let t;if(t=e.loading?e.loadingText:a["default"]?a["default"]():e.text,t)return J("span",{"class":de("text")},[t])},u=()=>{const{color:t,plain:a}=e;if(t){const e={color:a?t:"white"};return a||(e.background=t),t.includes("gradient")?e.border=0:e.borderColor=t,e}},d=a=>{e.loading?r(a):e.disabled||(t("click",a),o())};return()=>{const{tag:t,type:a,size:o,block:l,round:s,plain:r,square:p,loading:m,disabled:v,hairline:g,nativeType:f,iconPosition:h}=e,b=[de([a,o,{plain:r,block:l,round:s,square:p,loading:m,disabled:v,hairline:g}]),{[i]:g}];return J(t,{type:f,"class":b,style:u(),disabled:v,onClick:d},{"default":()=>[J("div",{"class":de("content")},["left"===h&&n(),c(),"right"===h&&n()])]})}}})),[me,ve,ge]=e("picker"),fe=e=>e.find((e=>!e.disabled))||e[0];function he(e,t){for(let a=t=d(t,0,e.length);a<e.length;a++)if(!e[a].disabled)return a;for(let a=t-1;a>=0;a--)if(!e[a].disabled)return a;return 0}const be=(e,t,a)=>void 0!==t&&!!e.find((e=>e[a.value]===t));function ye(e,t,a){const o=e.findIndex((e=>e[a.value]===t));return e[he(e,o)]}const[Se,xe]=e("picker-column"),we=Symbol(Se);var ke=Y({name:Se,props:{value:n,fields:p(Object),options:m(),readonly:Boolean,allowHtml:Boolean,optionHeight:p(Number),swipeDuration:p(n),visibleOptionNum:p(n)},emits:["change","clickOption","scrollInto"],setup(e,{emit:t,slots:a}){let o,n,l,i,s;const c=Q(),u=Q(),p=Q(0),m=Q(0),b=v(),y=()=>e.options.length,S=()=>e.optionHeight*(+e.visibleOptionNum-1)/2,x=a=>{let n=he(e.options,a);const l=-n*e.optionHeight,i=()=>{n>y()-1&&(n=he(e.options,a));const o=e.options[n][e.fields.value];o!==e.value&&t("change",o)};o&&l!==p.value?s=i:i(),p.value=l},w=()=>e.readonly||!e.options.length,k=t=>d(Math.round(-t/e.optionHeight),0,y()-1),C=X((()=>k(p.value))),I=()=>{o=!1,m.value=0,s&&(s(),s=null)},B=e=>{if(!w()){if(b.start(e),o){const e=function(e){const{transform:t}=window.getComputedStyle(e),a=t.slice(7,t.length-1).split(", ")[5];return Number(a)}(u.value);p.value=Math.min(0,e-S())}m.value=0,n=p.value,l=Date.now(),i=n,s=null}},T=()=>{if(w())return;const t=p.value-i,a=Date.now()-l;if(a<300&&Math.abs(t)>15)return void((t,a)=>{const o=Math.abs(t/a);t=p.value+o/.003*(t<0?-1:1);const n=k(t);m.value=+e.swipeDuration,x(n)})(t,a);const n=k(p.value);m.value=200,x(n),setTimeout((()=>{o=!1}),0)},V=()=>{const n={height:"".concat(e.optionHeight,"px")};return e.options.map(((l,i)=>{const r=l[e.fields.text],{disabled:c}=l,u=l[e.fields.value],d={role:"button",style:n,tabindex:c?-1:0,"class":[xe("item",{disabled:c,selected:u===e.value}),l.className],onClick:()=>{return a=i,void(o||w()||(s=null,m.value=200,x(a),t("clickOption",e.options[a])));var a}},p={"class":"van-ellipsis",[e.allowHtml?"innerHTML":"textContent"]:r};return J("li",d,[a.option?a.option(l,i):J("div",p,null)])}))};return g(we),f({stopMomentum:I}),Z((()=>{const t=o?Math.floor(-p.value/e.optionHeight):e.options.findIndex((t=>t[e.fields.value]===e.value)),a=he(e.options,t),n=-a*e.optionHeight;o&&a<t&&I(),p.value=n})),h("touchmove",(a=>{if(w())return;b.move(a),b.isVertical()&&(o=!0,r(a,!0));const s=d(n+b.deltaY.value,-y()*e.optionHeight,e.optionHeight),c=k(s);c!==C.value&&t("scrollInto",e.options[c]),p.value=s;const u=Date.now();u-l>300&&(l=u,i=s)}),{target:c}),()=>J("div",{ref:c,"class":xe(),onTouchstartPassive:B,onTouchend:T,onTouchcancel:T},[J("ul",{ref:u,style:{transform:"translate3d(0, ".concat(p.value+S(),"px, 0)"),transitionDuration:"".concat(m.value,"ms"),transitionProperty:m.value?"all":"none"},"class":xe("wrapper"),onTransitionend:I},[V()])])}});const[Ce]=e("picker-toolbar"),Ie={title:String,cancelButtonText:String,confirmButtonText:String},Be=["cancel","confirm","title","toolbar"],Te=Object.keys(Ie);var Ve=Y({name:Ce,props:Ie,emits:["confirm","cancel"],setup(e,{emit:t,slots:a}){const o=()=>t("cancel"),n=()=>t("confirm"),l=()=>{const t=e.cancelButtonText||ge("cancel");return J("button",{type:"button","class":[ve("cancel"),b],onClick:o},[a.cancel?a.cancel():t])},i=()=>{const t=e.confirmButtonText||ge("confirm");return J("button",{type:"button","class":[ve("confirm"),b],onClick:n},[a.confirm?a.confirm():t])};return()=>J("div",{"class":ve("toolbar")},[a.toolbar?a.toolbar():[l(),a.title?a.title():e.title?J("div",{"class":[ve("title"),"van-ellipsis"]},[e.title]):void 0,i()]])}});const[He,Me]=e("picker-group"),ze=Symbol(He);t({tabs:m(),activeTab:y(0),nextStepText:String},Ie);const Oe=t({loading:Boolean,readonly:Boolean,allowHtml:Boolean,optionHeight:y(44),showToolbar:S,swipeDuration:y(1e3),visibleOptionNum:y(6)},Ie),Pe=c(Y({name:me,props:t({},Oe,{columns:m(),modelValue:m(),toolbarPosition:o("top"),columnsFieldNames:Object}),emits:["confirm","cancel","change","scrollInto","clickOption","update:modelValue"],setup(e,{emit:a,slots:o}){const n=Q(),l=Q(e.modelValue.slice(0)),{parent:i}=g(ze),{children:s,linkChildren:c}=x(we);c();const d=X((()=>{return a=e.columnsFieldNames,t({text:"text",value:"value",children:"children"},a);var a})),p=X((()=>w(e.optionHeight))),m=X((()=>function(e,t){const a=e[0];if(a){if(Array.isArray(a))return"multiple";if(t.children in a)return"cascade"}return"default"}(e.columns,d.value))),v=X((()=>{const{columns:t}=e;switch(m.value){case"multiple":return t;case"cascade":return function(e,t,a){const o=[];let n={[t.children]:e},l=0;for(;n&&n[t.children];){const e=n[t.children],i=a.value[l];n=u(i)?ye(e,i,t):void 0,!n&&e.length&&(n=ye(e,fe(e)[t.value],t)),l++,o.push(e)}return o}(t,d.value,l);default:return[t]}})),b=X((()=>v.value.some((e=>e.length)))),y=X((()=>v.value.map(((e,t)=>ye(e,l.value[t],d.value))))),S=X((()=>v.value.map(((e,t)=>e.findIndex((e=>e[d.value.value]===l.value[t])))))),B=(e,t)=>{if(l.value[e]!==t){const a=l.value.slice(0);a[e]=t,l.value=a}},T=()=>({selectedValues:l.value.slice(0),selectedOptions:y.value,selectedIndexes:S.value}),V=()=>{s.forEach((e=>e.stopMomentum()));const e=T();return te((()=>{a("confirm",e)})),e},H=()=>a("cancel",T()),M=e=>{if(b.value){const t={height:"".concat(p.value,"px")},a={backgroundSize:"100% ".concat((e-p.value)/2,"px")};return[J("div",{"class":ve("mask"),style:a},null),J("div",{"class":[I,ve("frame")],style:t},null)]}},z=()=>{const i=p.value*+e.visibleOptionNum,s={height:"".concat(i,"px")};return J("div",{ref:n,"class":ve("columns"),style:s},[v.value.map(((n,i)=>J(ke,{value:l.value[i],fields:d.value,options:n,readonly:e.readonly,allowHtml:e.allowHtml,optionHeight:p.value,swipeDuration:e.swipeDuration,visibleOptionNum:e.visibleOptionNum,onChange:e=>{return B(o=i,e),"cascade"===m.value&&l.value.forEach(((e,t)=>{const a=v.value[t];be(a,e,d.value)||B(t,a.length?a[0][d.value.value]:void 0)})),void te((()=>{a("change",t({columnIndex:o},T()))}));var o},onClickOption:e=>((e,o)=>{const n={columnIndex:o,currentOption:e};a("clickOption",t(T(),n)),a("scrollInto",n)})(e,i),onScrollInto:e=>{a("scrollInto",{currentOption:e,columnIndex:i})}},{option:o.option}))),M(i)])},O=()=>{if(e.showToolbar&&!i)return J(Ve,ee(k(e,Te),{onConfirm:V,onCancel:H}),k(o,Be))};let P;return G(v,(e=>{e.forEach(((e,t)=>{e.length&&!be(e,l.value[t],d.value)&&B(t,fe(e)[d.value.value])}))}),{immediate:!0}),G((()=>e.modelValue),(e=>{C(e,l.value)||C(e,P)||(l.value=e.slice(0),P=e.slice(0))}),{deep:!0}),G(l,(t=>{C(t,e.modelValue)||(P=t.slice(0),a("update:modelValue",P))}),{immediate:!0}),h("touchmove",r,{target:n}),f({confirm:V,getSelectedOptions:()=>y.value}),()=>{var t,a;return J("div",{"class":ve()},["top"===e.toolbarPosition?O():null,e.loading?J(W,{"class":ve("loading")},null):null,null==(t=o["columns-top"])?void 0:t.call(o),z(),null==(a=o["columns-bottom"])?void 0:a.call(o),"bottom"===e.toolbarPosition?O():null])}}}));function Ee(e){return Array.isArray(e)?!e.length:0!==e&&!e}function Le(e,t){const{message:a}=t;return M(a)?a(e,t):a||""}function _e({target:e}){e.composing=!0}function je({target:e}){e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}function qe(e){return[...e].length}function Ae(e,t){return[...e].slice(0,t).join("")}const[De,Ne]=e("field"),$e={id:String,name:String,leftIcon:String,rightIcon:String,autofocus:Boolean,clearable:Boolean,maxlength:n,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}},Fe=c(Y({name:De,props:t({},z,$e,{rows:n,type:o("text"),rules:Array,autosize:[Boolean,Object],labelWidth:n,labelClass:O,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:a}){const o=R(),n=ae({status:"unvalidated",focused:!1,validateMessage:""}),l=Q(),i=Q(),c=Q(),{parent:d}=g(L),p=()=>{var t;return String(null!=(t=e.modelValue)?t:"")},m=t=>u(e[t])?e[t]:d&&u(d.props[t])?d.props[t]:void 0,v=X((()=>{const t=m("readonly");if(e.clearable&&!t){const t=""!==p(),a="always"===e.clearTrigger||"focus"===e.clearTrigger&&n.focused;return t&&a}return!1})),b=X((()=>c.value&&a.input?c.value():e.modelValue)),y=X((()=>{var t;const a=m("required");return"auto"===a?null==(t=e.rules)?void 0:t.some((e=>e.required)):a})),S=()=>{n.status="unvalidated",n.validateMessage=""},x=()=>t("endValidate",{status:n.status,message:n.validateMessage}),w=(a=e.rules)=>new Promise((o=>{var l;S(),a?(t("startValidate"),(l=a,l.reduce(((e,t)=>e.then((()=>{if("failed"===n.status)return;let{value:e}=b;if(t.formatter&&(e=t.formatter(e,t)),!function(e,t){if(Ee(e)){if(t.required)return!1;if(!1===t.validateEmpty)return!0}return!(t.pattern&&!t.pattern.test(String(e)))}(e,t))return n.status="failed",void(n.validateMessage=Le(e,t));if(t.validator){if(Ee(e)&&!1===t.validateEmpty)return;return(a=e,o=t,new Promise((e=>{const t=o.validator(a,o);H(t)?t.then(e):e(t)}))).then((a=>{a&&"string"==typeof a?(n.status="failed",n.validateMessage=a):!1===a&&(n.status="failed",n.validateMessage=Le(e,t))}))}var a,o}))),Promise.resolve())).then((()=>{"failed"===n.status?(o({name:e.name,message:n.validateMessage}),x()):(n.status="passed",o(),x())}))):o()})),k=t=>{if(d&&e.rules){const{validateTrigger:a}=d.props,o=_(a).includes(t),n=e.rules.filter((e=>e.trigger?_(e.trigger).includes(t):o));n.length&&w(n)}},C=(a,o="onChange")=>{const i=a;a=(t=>{var a;const{maxlength:o}=e;if(u(o)&&qe(t)>+o){const e=p();if(e&&qe(e)===+o)return e;const i=null==(a=l.value)?void 0:a.selectionEnd;if(n.focused&&i){const e=[...t],a=e.length-+o;return e.splice(i-a,a),e.join("")}return Ae(t,+o)}return t})(a);const s=qe(i)-qe(a);if("number"===e.type||"digit"===e.type){const t="number"===e.type;a=j(a,t,t)}let r=0;if(e.formatter&&o===e.formatTrigger){const{formatter:t,maxlength:o}=e;if(a=t(a),u(o)&&qe(a)>+o&&(a=Ae(a,+o)),l.value&&n.focused){const{selectionEnd:e}=l.value,a=Ae(i,e);r=qe(t(a))-qe(a)}}if(l.value&&l.value.value!==a)if(n.focused){let{selectionStart:e,selectionEnd:t}=l.value;if(l.value.value=a,u(e)&&u(t)){const o=qe(a);s?(e-=s,t-=s):r&&(e+=r,t+=r),l.value.setSelectionRange(Math.min(e,o),Math.min(t,o))}}else l.value.value=a;a!==e.modelValue&&t("update:modelValue",a)},I=e=>{e.target.composing||C(e.target.value)},M=()=>{var e;return null==(e=l.value)?void 0:e.blur()},z=()=>{var e;return null==(e=l.value)?void 0:e.focus()},O=()=>{const t=l.value;"textarea"===e.type&&e.autosize&&t&&function(e,t){const a=B();e.style.height="auto";let o=e.scrollHeight;if(V(t)){const{maxHeight:e,minHeight:a}=t;void 0!==e&&(o=Math.min(o,e)),void 0!==a&&(o=Math.max(o,a))}o&&(e.style.height="".concat(o,"px"),T(a))}(t,e.autosize)},D=e=>{n.focused=!0,t("focus",e),te(O),m("readonly")&&M()},N=e=>{n.focused=!1,C(p(),"onBlur"),t("blur",e),m("readonly")||(k("onBlur"),te(O),A())},$=e=>t("clickInput",e),F=e=>t("clickLeftIcon",e),W=e=>t("clickRightIcon",e),K=X((()=>"boolean"==typeof e.error?e.error:!(!d||!d.props.showError||"failed"!==n.status)||void 0)),U=X((()=>{const e=m("labelWidth"),t=m("labelAlign");if(e&&"top"!==t)return{width:q(e)}})),Y=a=>{13===a.keyCode&&(d&&d.props.submitOnEnter||"textarea"===e.type||r(a),"search"===e.type&&M()),t("keypress",a)},Z=()=>e.id||"".concat(o,"-input"),ie=()=>{const t=Ne("control",[m("inputAlign"),{error:K.value,custom:!!a.input,"min-height":"textarea"===e.type&&!e.autosize}]);if(a.input)return J("div",{"class":t,onClick:$},[a.input()]);const n={id:Z(),ref:l,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:N,onFocus:D,onInput:I,onClick:$,onChange:je,onKeypress:Y,onCompositionend:je,onCompositionstart:_e};return"textarea"===e.type?J("textarea",n,null):J("input",ee("number"===(i=e.type)?{type:"text",inputmode:"decimal"}:"digit"===i?{type:"tel",inputmode:"numeric"}:{type:i},n),null);var i},se=()=>{const t=a["right-icon"];if(e.rightIcon||t)return J("div",{"class":Ne("right-icon"),onClick:W},[t?t():J(s,{name:e.rightIcon,classPrefix:e.iconPrefix},null)])},re=()=>{if(e.showWordLimit&&e.maxlength){const t=qe(p());return J("div",{"class":Ne("word-limit")},[J("span",{"class":Ne("word-num")},[t]),le("/"),e.maxlength])}},ce=()=>{if(d&&!1===d.props.showErrorMessage)return;const t=e.errorMessage||n.validateMessage;if(t){const e=a["error-message"],o=m("errorMessageAlign");return J("div",{"class":Ne("error-message",o)},[e?e({message:t}):t])}},ue=()=>[J("div",{"class":Ne("body")},[ie(),v.value&&J(s,{ref:i,name:e.clearIcon,"class":Ne("clear")},null),se(),a.button&&J("div",{"class":Ne("button")},[a.button()])]),re(),ce()];return f({blur:M,focus:z,validate:w,formValue:b,resetValidation:S,getValidationStatus:()=>n.status}),oe(P,{customValue:c,resetValidation:S,validateWithTrigger:k}),G((()=>e.modelValue),(()=>{C(p()),S(),k("onChange"),te(O)})),ne((()=>{C(p(),e.formatTrigger),te(O)})),h("touchstart",(e=>{r(e),t("update:modelValue",""),t("clear",e)}),{target:X((()=>{var e;return null==(e=i.value)?void 0:e.$el}))}),()=>{const t=m("disabled"),n=m("labelAlign"),l=(()=>{const t=a["left-icon"];if(e.leftIcon||t)return J("div",{"class":Ne("left-icon"),onClick:F},[t?t():J(s,{name:e.leftIcon,classPrefix:e.iconPrefix},null)])})();return J(E,{size:e.size,"class":Ne({error:K.value,disabled:t,["label-".concat(n)]:n}),center:e.center,border:e.border,isLink:e.isLink,clickable:e.clickable,titleStyle:U.value,valueClass:Ne("value"),titleClass:[Ne("label",[n,{required:y.value}]),e.labelClass],arrowDirection:e.arrowDirection},{icon:l&&"top"!==n?()=>l:null,title:()=>{const t=(()=>{const t=m("labelWidth"),n=m("labelAlign"),l=m("colon")?":":"";return a.label?[a.label(),l]:e.label?J("label",{id:"".concat(o,"-label"),"for":a.input?void 0:Z(),onClick:e=>{r(e),z()},style:"top"===n&&t?{width:q(t)}:void 0},[e.label+l]):void 0})();return"top"===n?[l,t].filter(Boolean):t||[]},value:ue,extra:a.extra})}}})),[We,Re]=e("image"),Ke=c(Y({name:We,props:{src:String,alt:String,fit:String,position:String,round:Boolean,block:Boolean,width:n,height:n,radius:n,lazyLoad:Boolean,iconSize:n,showError:S,errorIcon:o("photo-fail"),iconPrefix:String,showLoading:S,loadingIcon:o("photo")},emits:["load","error"],setup(e,{emit:t,slots:a}){const o=Q(!1),n=Q(!0),l=Q(),{$Lazyload:i}=ie().proxy,r=X((()=>{const t={width:q(e.width),height:q(e.height)};return u(e.radius)&&(t.overflow="hidden",t.borderRadius=q(e.radius)),t}));G((()=>e.src),(()=>{o.value=!1,n.value=!0}));const c=e=>{n.value&&(n.value=!1,t("load",e))},d=()=>{const e=new Event("load");Object.defineProperty(e,"target",{value:l.value,enumerable:!0}),c(e)},p=e=>{o.value=!0,n.value=!1,t("error",e)},m=(t,a,o)=>o?o():J(s,{name:t,size:e.iconSize,"class":a,classPrefix:e.iconPrefix},null),v=()=>{if(o.value||!e.src)return;const t={alt:e.alt,"class":Re("img"),style:{objectFit:e.fit,objectPosition:e.position}};return e.lazyLoad?re(J("img",ee({ref:l},t),null),[[ce("lazy"),e.src]]):J("img",ee({ref:l,src:e.src,onLoad:c,onError:p},t),null)},g=({el:e})=>{const t=()=>{e===l.value&&n.value&&d()};l.value?t():te(t)},f=({el:e})=>{e!==l.value||o.value||p()};return i&&D&&(i.$on("loaded",g),i.$on("error",f),se((()=>{i.$off("loaded",g),i.$off("error",f)}))),ne((()=>{te((()=>{var t;(null==(t=l.value)?void 0:t.complete)&&!e.lazyLoad&&d()}))})),()=>{var t;return J("div",{"class":Re({round:e.round,block:e.block}),style:r.value},[v(),n.value&&e.showLoading?J("div",{"class":Re("loading")},[m(e.loadingIcon,Re("loading-icon"),a.loading)]):o.value&&e.showError?J("div",{"class":Re("error")},[m(e.errorIcon,Re("error-icon"),a.error)]):void 0,null==(t=a["default"])?void 0:t.call(a)])}}})),[Ue,Ye]=e("row"),Je=Symbol(Ue);var Qe=Y({name:Ue,props:{tag:o("div"),wrap:S,align:String,gutter:y(0),justify:String},setup(e,{slots:t}){const{children:a,linkChildren:o}=x(Je),n=X((()=>{const e=[[]];let t=0;return a.forEach(((a,o)=>{t+=Number(a.span),t>24?(e.push([o]),t-=24):e[e.length-1].push(o)})),e}));return o({spaces:X((()=>{const t=Number(e.gutter),a=[];return t?(n.value.forEach((e=>{const o=t*(e.length-1)/e.length;e.forEach(((e,n)=>{if(0===n)a.push({right:o});else{const n=t-a[e-1].right,l=o-n;a.push({left:n,right:l})}}))})),a):a}))}),()=>{const{tag:a,wrap:o,align:n,justify:l}=e;return J(a,{"class":Ye({["align-".concat(n)]:n,["justify-".concat(l)]:l,nowrap:!o})},{"default":()=>{var e;return[null==(e=t["default"])?void 0:e.call(t)]}})}}});const[Xe,Ze]=e("col"),Ge=c(Y({name:Xe,props:{tag:o("div"),span:y(0),offset:n},setup(e,{slots:t}){const{parent:a,index:o}=g(Je),n=X((()=>{if(!a)return;const{spaces:e}=a;if(e&&e.value&&e.value[o.value]){const{left:t,right:a}=e.value[o.value];return{paddingLeft:t?"".concat(t,"px"):null,paddingRight:a?"".concat(a,"px"):null}}}));return()=>{const{tag:a,span:o,offset:l}=e;return J(a,{style:n.value,"class":Ze({[o]:o,["offset-".concat(l)]:l})},{"default":()=>{var e;return[null==(e=t["default"])?void 0:e.call(t)]}})}}})),[et,tt]=e("count-down"),at=c(Y({name:et,props:{time:y(0),format:o("HH:mm:ss"),autoStart:S,millisecond:Boolean},emits:["change","finish"],setup(e,{emit:t,slots:a}){const{start:o,pause:n,reset:l,current:i}=$({time:+e.time,millisecond:e.millisecond,onChange:e=>t("change",e),onFinish:()=>t("finish")}),s=X((()=>function(e,t){const{days:a}=t;let{hours:o,minutes:n,seconds:l,milliseconds:i}=t;if(e.includes("DD")?e=e.replace("DD",N(a)):o+=24*a,e.includes("HH")?e=e.replace("HH",N(o)):n+=60*o,e.includes("mm")?e=e.replace("mm",N(n)):l+=60*n,e.includes("ss")?e=e.replace("ss",N(l)):i+=1e3*l,e.includes("S")){const t=N(i,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,i.value))),r=()=>{l(+e.time),e.autoStart&&o()};return G((()=>e.time),r,{immediate:!0}),f({start:o,pause:n,reset:r}),()=>J("div",{role:"timer","class":tt()},[a["default"]?a["default"](i.value):s.value])}})),ot=c(Qe),nt=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 K.post(this.isSuffix+"/code/verifyImageCode",{requestType:"form",hideLoading:!0,data:{phone:this.phone,code:this.code}}),await K.post("/api-website/code/sendSmsCode",{requestType:"form",hideLoading:!0,data:{mobile:this.phone,type:this.type}}),setTimeout((()=>{U("验证码已发送")}),100),this.$emit("close"),this.$emit("sendCode")}catch(e){this.code="",setTimeout((()=>{this.updateIdentifyingCode()}),500)}}},render(){return J(F,{show:this.showStatus,"class":"_imgCodePopup_mq980_27",closeOnClickOverlay:!1,onClose:()=>{this.$emit("close")},closeable:!0,closeIcon:"close"},{"default":()=>[J("div",{"class":"_imgCode_mq980_1"},[J("p",{"class":"_codeTitle_mq980_4"},[le("输入图形验证码")]),J(ot,null,{"default":()=>[J(Ge,{span:"14"},{"default":()=>[J(Fe,{placeholder:"请输入验证码",modelValue:this.code,"onUpdate:modelValue":e=>this.code=e,"class":"_field_mq980_23",autocomplete:"off"},null)]}),J(Ge,{span:"10","class":"_img_mq980_1"},{"default":()=>[J(Ke,{src:this.identifyingCode,onClick:()=>this.updateIdentifyingCode()},{loading:()=>J(W,{type:"spinner",size:"20"},null)})]})]}),J(ot,{style:{display:"flex",justifyContent:"flex-end"}},{"default":()=>[J(Ge,{span:"10"},{"default":()=>[J("span",{"class":"_imgChange_mq980_16",onClick:()=>this.updateIdentifyingCode()},[le("看不清?换一换")])]})]})])]})}});export{pe as B,at as C,Fe as F,nt as M,Pe as P};
|