(function(h,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("vue"),require("lodash-es"),require("dayjs"),require("ant-design-vue"),require("@purge-icons/generated")):typeof define=="function"&&define.amd?define(["exports","vue","lodash-es","dayjs","ant-design-vue","@purge-icons/generated"],s):(h=typeof globalThis<"u"?globalThis:h||self,s(h.index={},h.Vue,null,null,null,h.Iconify))})(this,function(h,s,Ye,Je,Ke,re){"use strict";const U={modelValue:{type:[String,Number],default:null},type:{type:String,default:"tabs"},showContent:{type:Boolean,default:!0},reactivable:{type:Boolean,default:!0},customWidth:{type:String,default:""},cssClass:{type:String,default:""},beforeChange:{type:Function,default:null},closeable:{type:Boolean,default:!1},addable:{type:Boolean,default:!1},tabPosition:{type:String,default:"top"}},H="g";function E(e,o,t){let n=e;return o&&(n+=`__${o}`),t&&(n+=`--${t}`),n}function B(e,o=!1){const t=o?`.${H}-${e}`:`${H}-${e}`;return{b:()=>E(t),e:r=>r?E(t,r):"",m:r=>r?E(t,"",r):"",em:(r,c)=>r&&c?E(t,r,c):""}}const _=B("tabs");function le(e,o){const{cssClass:t,tabPosition:n,customWidth:i}=s.toRefs(e),a=s.computed(()=>({[_.e("nav")]:!0,[_.em("nav",e.type)]:!0,[t.value]:!!t.value,[_.em("nav","top")]:n.value==="top",[_.em("nav","right")]:n.value==="right",[_.em("nav","bottom")]:n.value==="bottom",[_.em("nav","left")]:n.value==="left"})),l=s.computed(()=>({["custom-width"]:!!i.value})),r={width:e.customWidth?e.customWidth:""},c=s.computed(()=>["top","bottom"].includes(e.tabPosition)?{left:o.offsetLeft+"px",width:o.offsetWidth+"px"}:{top:o.offsetTop+"px",height:o.offsetHeight+"px",width:o.offsetWidth+"px"});return{ulClasses:a,aClasses:l,customStyle:r,sliderAnimationStyle:c}}function ce(e,o,t,n,i,a){const l=()=>{e.type==="slider"&&setTimeout(()=>{var f;const d=(f=a.value)==null?void 0:f.querySelector("#"+e.modelValue+".active");d&&a.value&&(["top","bottom"].includes(e.tabPosition)?n.offsetLeft=d.getBoundingClientRect().left-a.value.getBoundingClientRect().left:(n.offsetTop=d.getBoundingClientRect().top-a.value.getBoundingClientRect().top,n.offsetHeight=d.getBoundingClientRect().height),n.offsetWidth=d.getBoundingClientRect().width)})},r=d=>{let f=Promise.resolve(!0);if(typeof e.beforeChange=="function"){const p=e.beforeChange(d);typeof p<"u"&&(p.then?f=p:f=Promise.resolve(p))}return f},c=(d,f)=>{const p=d.props.id;!e.reactivable&&e.modelValue===p||r(p).then(k=>{if(!k)return;const A=t.value.find(D=>D.props.id===p);o&&A&&!A.props.disabled&&(o.state.active=p,e.type==="slider"&&f&&a&&a.value&&(["left","right"].includes(e.tabPosition)?n.offsetLeft=f.getBoundingClientRect().left-a.value.nativeElement.getBoundingClientRect().left:(n.offsetTop=f.getBoundingClientRect().top-a.value.nativeElement.getBoundingClientRect().top,n.offsetHeight=f.getBoundingClientRect().height),n.offsetWidth=f.getBoundingClientRect().width),i.emit("active-tab-change",A.props.id))})};return{update:l,activeClick:c,beforeMount:()=>{e.type!=="slider"&&e.modelValue===void 0&&t.value&&t.value.length>0&&c(t.value[0])},mounted:()=>{var d;if(e.type==="slider"&&e.modelValue===void 0&&t.value&&t.value.length>0&&t.value[0]){const f=t.value[0],p=(d=f.tabsEle)==null?void 0:d.value,k=p==null?void 0:p.getElementById(f.tabId);c(k)}},tabCanClose:d=>(e.closeable||d.closeable)&&!d.disabled}}function ue(e){return{onTabRemove:(n,i)=>{i.stopPropagation(),e.emit("tab-remove",n.props,i),e.emit("tab-change",n.props.id,"delete")},onTabAdd:()=>{e.emit("tab-add"),e.emit("tab-change",void 0,"add")}}}const P="G",de=Object.prototype.toString;function fe(e,o){return de.call(e)===`[object ${o}]`}function pe(e){return fe(e,"String")}for(let e=0;e<=15;e++)e.toString(16);/*!
 * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
 *
 * Copyright (c) 2014-2017, Jon Schlinkert.
 * Released under the MIT License.
 */function X(e){return Object.prototype.toString.call(e)==="[object Object]"}function ye(e){var o,t;return X(e)===!1?!1:(o=e.constructor,o===void 0?!0:(t=o.prototype,!(X(t)===!1||t.hasOwnProperty("isPrototypeOf")===!1)))}function R(){return R=Object.assign?Object.assign.bind():function(e){for(var o=1;o<arguments.length;o++){var t=arguments[o];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},R.apply(this,arguments)}function G(e,o){if(e==null)return{};var t,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)o.indexOf(t=a[n])>=0||(i[t]=e[t]);return i}const L={silent:!1,logLevel:"warn"},ge=["validator"],Y=Object.prototype,J=Y.toString,be=Y.hasOwnProperty,K=/^\s*function (\w+)/;function Q(e){var o;const t=(o=e==null?void 0:e.type)!==null&&o!==void 0?o:e;if(t){const n=t.toString().match(K);return n?n[1]:""}return""}const O=ye,Z=e=>e;let y=Z;process.env.NODE_ENV!=="production"&&(y=typeof console<"u"?function(o,t=L.logLevel){L.silent===!1&&console[t](`[VueTypes warn]: ${o}`)}:Z);const j=(e,o)=>be.call(e,o),me=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e},$=Array.isArray||function(e){return J.call(e)==="[object Array]"},S=e=>J.call(e)==="[object Function]",z=e=>O(e)&&j(e,"_vueTypes_name"),ee=e=>O(e)&&(j(e,"type")||["_vueTypes_name","validator","default","required"].some(o=>j(e,o)));function M(e,o){return Object.defineProperty(e.bind(o),"__original",{value:e})}function C(e,o,t=!1){let n,i=!0,a="";n=O(e)?e:{type:e};const l=z(n)?n._vueTypes_name+" - ":"";if(ee(n)&&n.type!==null){if(n.type===void 0||n.type===!0||!n.required&&o===void 0)return i;$(n.type)?(i=n.type.some(r=>C(r,o,!0)===!0),a=n.type.map(r=>Q(r)).join(" or ")):(a=Q(n),i=a==="Array"?$(o):a==="Object"?O(o):a==="String"||a==="Number"||a==="Boolean"||a==="Function"?function(r){if(r==null)return"";const c=r.constructor.toString().match(K);return c?c[1]:""}(o)===a:o instanceof n.type)}if(!i){const r=`${l}value "${o}" should be of type "${a}"`;return t===!1?(y(r),!1):r}if(j(n,"validator")&&S(n.validator)){const r=y,c=[];if(y=u=>{c.push(u)},i=n.validator(o),y=r,!i){const u=(c.length>1?"* ":"")+c.join(`
* `);return c.length=0,t===!1?(y(u),i):u}}return i}function m(e,o){const t=Object.defineProperties(o,{_vueTypes_name:{value:e,writable:!0},isRequired:{get(){return this.required=!0,this}},def:{value(i){return i===void 0?(j(this,"default")&&delete this.default,this):S(i)||C(this,i,!0)===!0?(this.default=$(i)?()=>[...i]:O(i)?()=>Object.assign({},i):i,this):(y(`${this._vueTypes_name} - invalid default value: "${i}"`),this)}}}),{validator:n}=t;return S(n)&&(t.validator=M(n,t)),t}function T(e,o){const t=m(e,o);return Object.defineProperty(t,"validate",{value(n){return S(this.validator)&&y(`${this._vueTypes_name} - calling .validate() will overwrite the current custom validator function. Validator info:
${JSON.stringify(this)}`),this.validator=M(n,this),this}})}function te(e,o,t){const n=function(c){const u={};return Object.getOwnPropertyNames(c).forEach(g=>{u[g]=Object.getOwnPropertyDescriptor(c,g)}),Object.defineProperties({},u)}(o);if(n._vueTypes_name=e,!O(t))return n;const{validator:i}=t,a=G(t,ge);if(S(i)){let{validator:c}=n;c&&(c=(r=(l=c).__original)!==null&&r!==void 0?r:l),n.validator=M(c?function(u){return c.call(this,u)&&i.call(this,u)}:i,n)}var l,r;return Object.assign(n,a)}function q(e){return e.replace(/^(?!\s*$)/gm,"  ")}const ve=()=>T("any",{}),he=()=>T("function",{type:Function}),Te=()=>T("boolean",{type:Boolean}),Oe=()=>T("string",{type:String}),Ce=()=>T("number",{type:Number}),_e=()=>T("array",{type:Array}),je=()=>T("object",{type:Object}),$e=()=>m("integer",{type:Number,validator:e=>me(e)}),Se=()=>m("symbol",{validator:e=>typeof e=="symbol"});function Ve(e,o="custom validation failed"){if(typeof e!="function")throw new TypeError("[VueTypes error]: You must provide a function as argument");return m(e.name||"<<anonymous function>>",{type:null,validator(t){const n=e(t);return n||y(`${this._vueTypes_name} - ${o}`),n}})}function we(e){if(!$(e))throw new TypeError("[VueTypes error]: You must provide an array as argument.");const o=`oneOf - value should be one of "${e.join('", "')}".`,t=e.reduce((n,i)=>{if(i!=null){const a=i.constructor;n.indexOf(a)===-1&&n.push(a)}return n},[]);return m("oneOf",{type:t.length>0?t:void 0,validator(n){const i=e.indexOf(n)!==-1;return i||y(o),i}})}function Ne(e){if(!$(e))throw new TypeError("[VueTypes error]: You must provide an array as argument");let o=!1,t=[];for(let i=0;i<e.length;i+=1){const a=e[i];if(ee(a)){if(z(a)&&a._vueTypes_name==="oneOf"&&a.type){t=t.concat(a.type);continue}if(S(a.validator)&&(o=!0),a.type===!0||!a.type){y('oneOfType - invalid usage of "true" or "null" as types.');continue}t=t.concat(a.type)}else t.push(a)}t=t.filter((i,a)=>t.indexOf(i)===a);const n=t.length>0?t:null;return m("oneOfType",o?{type:n,validator(i){const a=[],l=e.some(r=>{const c=C(z(r)&&r._vueTypes_name==="oneOf"?r.type||null:r,i,!0);return typeof c=="string"&&a.push(c),c===!0});return l||y(`oneOfType - provided value does not match any of the ${a.length} passed-in validators:
${q(a.join(`
`))}`),l}}:{type:n})}function Be(e){return m("arrayOf",{type:Array,validator(o){let t="";const n=o.every(i=>(t=C(e,i,!0),t===!0));return n||y(`arrayOf - value validation error:
${q(t)}`),n}})}function Pe(e){return m("instanceOf",{type:e})}function Re(e){return m("objectOf",{type:Object,validator(o){let t="";const n=Object.keys(o).every(i=>(t=C(e,o[i],!0),t===!0));return n||y(`objectOf - value validation error:
${q(t)}`),n}})}function xe(e){const o=Object.keys(e),t=o.filter(i=>{var a;return!((a=e[i])===null||a===void 0||!a.required)}),n=m("shape",{type:Object,validator(i){if(!O(i))return!1;const a=Object.keys(i);if(t.length>0&&t.some(l=>a.indexOf(l)===-1)){const l=t.filter(r=>a.indexOf(r)===-1);return y(l.length===1?`shape - required property "${l[0]}" is not defined.`:`shape - required properties "${l.join('", "')}" are not defined.`),!1}return a.every(l=>{if(o.indexOf(l)===-1)return this._vueTypes_isLoose===!0||(y(`shape - shape definition does not include a "${l}" property. Allowed keys: "${o.join('", "')}".`),!1);const r=C(e[l],i[l],!0);return typeof r=="string"&&y(`shape - "${l}" property validation error:
 ${q(r)}`),r===!0})}});return Object.defineProperty(n,"_vueTypes_isLoose",{writable:!0,value:!1}),Object.defineProperty(n,"loose",{get(){return this._vueTypes_isLoose=!0,this}}),n}const ke=["name","validate","getter"],Ae=(()=>{var e;return(e=class{static get any(){return ve()}static get func(){return he().def(this.defaults.func)}static get bool(){return Te().def(this.defaults.bool)}static get string(){return Oe().def(this.defaults.string)}static get number(){return Ce().def(this.defaults.number)}static get array(){return _e().def(this.defaults.array)}static get object(){return je().def(this.defaults.object)}static get integer(){return $e().def(this.defaults.integer)}static get symbol(){return Se()}static get nullable(){return{type:null}}static extend(o){if($(o))return o.forEach(c=>this.extend(c)),this;const{name:t,validate:n=!1,getter:i=!1}=o,a=G(o,ke);if(j(this,t))throw new TypeError(`[VueTypes error]: Type "${t}" already defined`);const{type:l}=a;if(z(l))return delete a.type,Object.defineProperty(this,t,i?{get:()=>te(t,l,a)}:{value(...c){const u=te(t,l,a);return u.validator&&(u.validator=u.validator.bind(u,...c)),u}});let r;return r=i?{get(){const c=Object.assign({},a);return n?T(t,c):m(t,c)},enumerable:!0}:{value(...c){const u=Object.assign({},a);let g;return g=n?T(t,u):m(t,u),u.validator&&(g.validator=u.validator.bind(g,...c)),g},enumerable:!0},Object.defineProperty(this,t,r)}}).defaults={},e.sensibleDefaults=void 0,e.config=L,e.custom=Ve,e.oneOf=we,e.instanceOf=Pe,e.oneOfType=Ne,e.arrayOf=Be,e.objectOf=Re,e.shape=xe,e.utils={validate:(o,t)=>C(t,o,!0)===!0,toType:(o,t,n=!1)=>n?T(o,t):m(o,t)},e})();function ne(e={func:()=>{},bool:!0,string:"",number:0,array:()=>[],object:()=>({}),integer:0}){var o;return(o=class extends Ae{static get sensibleDefaults(){return R({},this.defaults)}static set sensibleDefaults(t){this.defaults=t!==!1?R({},t!==!0?t:e):{}}}).defaults=R({},e),o}class Qe extends ne(){}ne({func:void 0,bool:void 0,string:void 0,number:void 0,object:void 0,integer:void 0}).extend([{name:"style",getter:!0,type:[String,Object],default:void 0},{name:"VNodeChild",getter:!0,type:void 0}]);const Ie=s.defineComponent({name:`${P}SvgIcon`,props:{prefix:{type:String,default:"icon"},name:{type:String,required:!0},size:{type:[Number,String],default:16},spin:{type:Boolean,default:!1}},setup(e){const t=B("svg-icon").b(),n=s.computed(()=>`#${e.prefix}-${e.name}`),i=s.computed(()=>{const{size:a}=e;let l=`${a}`;return l=`${l.replace("px","")}px`,{width:l,height:l}});return{symbolId:n,prefixCls:t,getStyle:i}}}),et="",oe=(e,o)=>{const t=e.__vccOpts||e;for(const[n,i]of o)t[n]=i;return t},Ee=["xlink:href"];function ze(e,o,t,n,i,a){return s.openBlock(),s.createElementBlock("svg",{class:s.normalizeClass([e.prefixCls,e.$attrs.class,e.spin&&"svg-icon-spin"]),style:s.normalizeStyle(e.getStyle),"aria-hidden":"true"},[s.createElementVNode("use",{"xlink:href":e.symbolId},null,8,Ee)],6)}const qe=oe(Ie,[["render",ze]]),ae="|svg",We=s.defineComponent({name:`${P}Icon`,components:{SvgIcon:qe},props:{icon:String,color:String,size:{type:[String,Number],default:16},spin:{type:Boolean,default:!1},prefix:{type:String,default:""}},setup(e){const o=s.ref(null),t=s.computed(()=>{var r;return(r=e.icon)==null?void 0:r.endsWith(ae)}),n=s.computed(()=>e.icon.replace(ae,"")),i=s.computed(()=>`${e.prefix?e.prefix+":":""}${e.icon}`),a=async()=>{if(s.unref(t))return;const r=s.unref(o);if(!r)return;await s.nextTick();const c=s.unref(i);if(!c)return;const u=re.renderSVG(c,{});if(u)r.textContent="",r.appendChild(u);else{const g=document.createElement("span");g.className="iconify",g.dataset.icon=c,r.textContent="",r.appendChild(g)}},l=s.computed(()=>{const{size:r,color:c}=e;let u=r;return pe(r)&&(u=parseInt(r,10)),{fontSize:`${u}px`,color:c,display:"inline-flex"}});return s.watch(()=>e.icon,a,{flush:"post"}),s.onMounted(a),{elRef:o,getWrapStyle:l,isSvgIcon:t,getSvgIcon:n}}}),tt="";function Le(e,o,t,n,i,a){const l=s.resolveComponent("SvgIcon");return e.isSvgIcon?(s.openBlock(),s.createBlock(l,{key:0,size:e.size,name:e.getSvgIcon,class:s.normalizeClass([e.$attrs.class,"anticon"]),spin:e.spin},null,8,["size","name","class","spin"])):(s.openBlock(),s.createElementBlock("span",{key:1,ref:"elRef",class:s.normalizeClass([e.$attrs.class,"app-iconify anticon",e.spin&&"app-iconify-spin"]),style:s.normalizeStyle(e.getWrapStyle)},null,6))}const x=oe(We,[["render",Le]]);x.install=function(e,o){e.component(o||x.name,x)};const nt="",Me=s.defineComponent({name:`${P}Tabs-nav`,props:U,emits:["active-tab-change","tab-remove","tab-add","tab-change"],setup(e,o){const t=B("tabs"),n=s.shallowRef(),i=s.reactive({offsetLeft:0,offsetWidth:0,offsetTop:0,offsetHeight:0,id:null}),a=s.inject("tabs"),l=s.computed(()=>Object.values((a==null?void 0:a.state.data)||{})),{ulClasses:r,aClasses:c,customStyle:u,sliderAnimationStyle:g}=le(e,i),{update:v,beforeMount:d,mounted:f,activeClick:p,tabCanClose:k}=ce(e,a,l,i,o,n),{onTabRemove:A,onTabAdd:D}=ue(o),Xe=()=>{D(),s.nextTick(()=>{n.value&&(n.value.scrollLeft=n.value.scrollWidth)})};let W=!1;const se=N=>{if(n.value){const I=N.clientX,b=n.value.scrollLeft;W=!0,n.value.addEventListener("mousemove",F=>{if(W&&n.value){const Ge=F.clientX-I;n.value.scrollLeft=b-Ge}}),n.value.addEventListener("mouseup",()=>{W=!1}),n.value.addEventListener("mouseleave",()=>{W=!1})}};return s.onUpdated(()=>v()),s.onBeforeMount(()=>d()),s.onMounted(()=>{f(),n.value&&n.value.addEventListener("mousedown",se)}),s.onUnmounted(()=>{n.value&&n.value.removeEventListener("mousedown",se)}),s.watch(()=>e.modelValue,()=>{s.nextTick(()=>{const N=l.value.find(I=>I.props.id===e.modelValue);N&&p(N)})}),()=>{const N=b=>k(b)?s.createVNode("span",{class:t.e("close-btn"),onClick:F=>A(b,F)},[s.createVNode(x,{size:"12px",icon:"ant-design:close-circle-outlined"},null)]):null,I=e.addable?s.createVNode("li",{class:t.e("new-tab"),onClick:Xe},[s.createVNode(x,{size:"12px",icon:"ant-design:plus-outlined"},null)]):null;return s.createVNode("ul",{ref:n,role:"tablist",class:r.value},[(l.value||[]).map(b=>s.createVNode("li",{role:"presentation",onClick:()=>{p(b)},class:(e.modelValue===b.props.id?"active":"")+(b.props.disabled?" disabled":""),id:b.props.id},[s.createVNode("span",{class:t.e("nav-content")},[s.createVNode("a",{role:"tab","data-toggle":b.props.id,"aria-expanded":e.modelValue===b.props.id,class:c.value,style:u},[b.slots.title?b.slots.title():s.createVNode("span",null,[b.props.title])]),N(b)])])),I,s.createVNode("div",{class:t.e(`nav-${e.type}-animation`),style:g.value},null)])}}}),ie=B("tabs");function De(e){return{onUpdateModelValue:l=>{e.emit("update:modelValue",l)},onActiveTabChange:l=>{e.emit("active-tab-change",l)},onTabRemove:(l,r)=>{e.emit("tab-remove",l,r)},onTabAdd:()=>{e.emit("tab-add")},onTabChange:(l,r)=>{e.emit("tab-change",l,r)}}}function Fe(e){return{tabsClasses:s.computed(()=>({[ie.b()]:!0,[ie.m(e.tabPosition)]:!0}))}}const V=s.defineComponent({name:`${P}Tabs`,props:U,emits:["update:modelValue","active-tab-change","tab-remove","tab-add","tab-change"],setup(e,o){const t=s.reactive({data:{},active:e.modelValue,showContent:e.showContent}),n=v=>{v.uid&&(t.data[v.uid]=v)},i=v=>{v&&delete t.data[v]};s.provide("tabs",{state:t,addTab:n,deleteTab:i});const{onUpdateModelValue:a,onActiveTabChange:l,onTabRemove:r,onTabAdd:c,onTabChange:u}=De(o),{tabsClasses:g}=Fe(e);return s.watch(()=>t.active,()=>{a(t.active)}),()=>{var f,p;const v=s.createVNode(Me,s.mergeProps(e,{onActiveTabChange:l,onTabRemove:r,onTabAdd:c,onTabChange:u}),null),d=(p=(f=o.slots).default)==null?void 0:p.call(f);return s.createVNode("div",{class:g.value},[e.tabPosition==="bottom"?[d,v]:[v,d],s.createVNode("div",{style:"clear: both"},null)])}}}),Ue={title:{type:[String,Number],default:null},id:{type:String,default:null},disabled:{type:Boolean,default:!1},closeable:{type:Boolean,default:!1}},ot="",w=s.defineComponent({name:`${P}Tab`,props:Ue,emits:[],setup(e,{slots:o}){const t=s.inject("tabs"),n=B("tab"),i=s.getCurrentInstance(),a=s.reactive({uid:i==null?void 0:i.uid,slots:o,props:e});return s.onMounted(()=>{t==null||t.addTab(a)}),s.onUnmounted(()=>{t==null||t.deleteTab(a.uid)}),()=>{var c;const{id:l}=e;return t!=null&&t.state.showContent&&t.state.active===l?s.createVNode("div",{class:n.e("content")},[s.createVNode("div",{role:"tabpanel"},[(c=o.default)==null?void 0:c.call(o)])]):null}}});V.install=function(e,o){e.component(o||V.name,V)},w.install=function(e,o){e.component(o||w.name,w)};const He={title:"Tabs 选项卡",category:"通用",status:"100%",install(e){e.component(V.name,V),e.component(w.name,w)}};h.Tab=w,h.Tabs=V,h.default=He,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
