@wikimedia/codex
Version:
Codex Design System for Wikimedia
1 lines • 172 kB
JavaScript
(function(V,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(V=typeof globalThis!="undefined"?globalThis:V||self,t(V.codex={},V.Vue))})(this,function(V,t){"use strict";var ed=Object.defineProperty,td=Object.defineProperties;var nd=Object.getOwnPropertyDescriptors;var ut=Object.getOwnPropertySymbols;var vn=Object.prototype.hasOwnProperty,Pn=Object.prototype.propertyIsEnumerable;var Tt=(V,t,te)=>t in V?ed(V,t,{enumerable:!0,configurable:!0,writable:!0,value:te}):V[t]=te,Z=(V,t)=>{for(var te in t||(t={}))vn.call(t,te)&&Tt(V,te,t[te]);if(ut)for(var te of ut(t))Pn.call(t,te)&&Tt(V,te,t[te]);return V},ie=(V,t)=>td(V,nd(t));var ue=(V,t)=>{var te={};for(var pe in V)vn.call(V,pe)&&t.indexOf(pe)<0&&(te[pe]=V[pe]);if(V!=null&&ut)for(var pe of ut(V))t.indexOf(pe)<0&&Pn.call(V,pe)&&(te[pe]=V[pe]);return te};var Ce=(V,t,te)=>Tt(V,typeof t!="symbol"?t+"":t,te);const te='<path d="M11.53 2.3A1.85 1.85 0 0010 1.21 1.85 1.85 0 008.48 2.3L.36 16.36C-.48 17.81.21 19 1.88 19h16.24c1.67 0 2.36-1.19 1.52-2.64zM11 16H9v-2h2zm0-4H9V6h2z"/>',pe='<path d="M12.43 14.34A5 5 0 0110 15a5 5 0 113.95-2L17 16.09V3a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h10a2 2 0 001.45-.63z"/><circle cx="10" cy="10" r="3"/>',Fn='<path d="M7 14.17 2.83 10l-1.41 1.41L7 17 19 5l-1.41-1.42z"/>',zn='<path d="M10 0a10 10 0 1010 10A10 10 0 0010 0m5.66 14.24-1.41 1.41L10 11.41l-4.24 4.25-1.42-1.42L8.59 10 4.34 5.76l1.42-1.42L10 8.59l4.24-4.24 1.41 1.41L11.41 10z"/>',_n='<path d="m4.34 2.93 12.73 12.73-1.41 1.41L2.93 4.35z"/><path d="M17.07 4.34 4.34 17.07l-1.41-1.41L15.66 2.93z"/>',Kn='<path d="M10 15 2 5h16z"/>',Hn='<path d="M13.728 1H6.272L1 6.272v7.456L6.272 19h7.456L19 13.728V6.272zM11 15H9v-2h2zm0-4H9V5h2z"/>',jn='<path d="m17.5 4.75-7.5 7.5-7.5-7.5L1 6.25l9 9 9-9z"/>',Un='<path d="M2 2a2 2 0 00-2 2v12a2 2 0 002 2h16a2 2 0 002-2V4a2 2 0 00-2-2zm-.17 13 4.09-5.25 2.92 3.51L12.92 8l5.25 7z"/>',Wn='<path d="M19 3H1v14h18zM3 14l3.5-4.5 2.5 3L12.5 8l4.5 6z"/><path d="M19 5H1V3h18zm0 12H1v-2h18z"/>',qn='<path d="M8 19a1 1 0 001 1h2a1 1 0 001-1v-1H8zm9-12a7 7 0 10-12 4.9S7 14 7 15v1a1 1 0 001 1h4a1 1 0 001-1v-1c0-1 2-3.1 2-3.1A7 7 0 0017 7"/>',Qn='<path d="M10 0C4.477 0 0 4.477 0 10s4.477 10 10 10 10-4.477 10-10S15.523 0 10 0M9 5h2v2H9zm0 4h2v6H9z"/>',Gn='<path d="M3 1h2v18H3zm13.5 1.5L15 1l-9 9 9 9 1.5-1.5L9 10z"/>',Yn='<path d="M15 1h2v18h-2zM3.5 2.5 11 10l-7.5 7.5L5 19l9-9-9-9z"/>',Xn='<path d="M7 1 5.6 2.5 13 10l-7.4 7.5L7 19l9-9z"/>',Jn='<path d="m4 10 9 9 1.4-1.5L7 10l7.4-7.5L13 1z"/>',Zn='<path d="M12.2 13.6a7 7 0 111.4-1.4l5.4 5.4-1.4 1.4zM3 8a5 5 0 1010 0A5 5 0 003 8"/>',eo='<path d="M10 0 3 8h14zm0 18-7-8h14z"/>',to='<path d="M10 20a10 10 0 010-20 10 10 0 110 20m-2-5 9-8.5L15.5 5 8 12 4.5 8.5 3 10z"/>',no='<path d="m10 5 8 10H2z"/>',Lt=te,oo=pe,lo=Fn,ao=zn,Ge=_n,so=Kn,Rt=Hn,Ot=jn,io=Un,ro=Wn,vt={langCodeMap:{ar:qn},default:Qn},co={ltr:Gn,shouldFlip:!0},uo={ltr:Yn,shouldFlip:!0},Pt={ltr:Xn,shouldFlip:!0},Ft={ltr:Jn,shouldFlip:!0},po=Zn,fo=eo,zt=to,mo=no;function ho(e,n,o){if(typeof e=="string"||"path"in e)return e;if("shouldFlip"in e)return e.ltr;if("rtl"in e)return o==="rtl"?e.rtl:e.ltr;const l=n in e.langCodeMap?e.langCodeMap[n]:e.default;return typeof l=="string"||"path"in l?l:l.ltr}function go(e,n){if(typeof e=="string")return!1;if("langCodeMap"in e){const o=n in e.langCodeMap?e.langCodeMap[n]:e.default;if(typeof o=="string")return!1;e=o}if("shouldFlipExceptions"in e&&Array.isArray(e.shouldFlipExceptions)){const o=e.shouldFlipExceptions.indexOf(n);return o===void 0||o===-1}return"shouldFlip"in e?e.shouldFlip:!1}function _e(e){const n=t.ref(null);return t.onMounted(()=>{const o=window.getComputedStyle(e.value).direction;n.value=o==="ltr"||o==="rtl"?o:null}),n}function _t(e){const n=t.ref("");return t.onMounted(()=>{let o=e.value;for(;o&&o.lang==="";)o=o.parentElement;n.value=o?o.lang:null}),n}function Y(e){return n=>typeof n=="string"&&e.includes(n)}const Ke="cdx",bo=["default","progressive","destructive"],yo=["normal","primary","quiet"],Co=["small","medium","large"],wo=["x-small","small","medium"],Kt=Y(["notice","warning","error","success"]),ko=["text","search","number","email","month","password","tel","url","week","date","datetime-local","time"],fe=["default","warning","error","success"],$o=["start","center","end","number"],Bo=Y(["16:9","3:2","4:3","1:1","3:4","2:3"]),So=Y(["fill","contain","cover","none","scale-down"]),Io=Y(["top","bottom","left","right","center"]),Vo=["none","minimal","divider","outline"],Eo=120,xo=500,Ae="cdx-menu-footer-item",Ht=Symbol("CdxTabs"),jt=Symbol("CdxActiveTab"),Ut=Symbol("CdxAllowArbitrary"),Wt=Symbol("CdxFieldInputId"),Ye=Symbol("CdxFieldDescriptionId"),qt=Symbol("CdxFieldStatus"),Qt=Symbol("CdxDisabled"),No="".concat(Ke,"-no-invert"),Xe=Symbol("CdxTableRowIdentifier"),Ao=["top","bottom","both"],Gt={left:"right","left-start":"right","left-end":"right",top:"bottom","top-start":"bottom","top-end":"bottom",bottom:"top","bottom-start":"top","bottom-end":"top",right:"left","right-start":"left","right-end":"left"},Do=Y(wo),Mo=t.defineComponent({name:"CdxIcon",props:{icon:{type:[String,Object],required:!0},iconLabel:{type:String,default:""},lang:{type:String,default:null},dir:{type:String,default:null},size:{type:String,default:"medium",validator:Do}},setup(e){const n=t.ref(),o=_e(n),l=_t(n),a=t.computed(()=>{var u;return(u=e.dir)!=null?u:o.value}),d=t.computed(()=>{var u;return(u=e.lang)!=null?u:l.value}),i=t.computed(()=>({"cdx-icon--flipped":a.value==="rtl"&&d.value!==null&&go(e.icon,d.value),["cdx-icon--".concat(e.size)]:!0})),s=t.computed(()=>{var u,p;return ho(e.icon,(u=d.value)!=null?u:"",(p=a.value)!=null?p:"ltr")}),r=t.computed(()=>typeof s.value=="string"?s.value:""),c=t.computed(()=>typeof s.value!="string"?s.value.path:"");return{rootElement:n,rootClasses:i,iconSvg:r,iconPath:c}}}),z=(e,n)=>{const o=e.__vccOpts||e;for(const[l,a]of n)o[l]=a;return o},To=["aria-hidden"],Lo={key:0},Ro=["innerHTML"],Oo=["d"];function vo(e,n,o,l,a,d){return t.openBlock(),t.createElementBlock("span",{ref:"rootElement",class:t.normalizeClass(["cdx-icon",e.rootClasses])},[(t.openBlock(),t.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20","aria-hidden":e.iconLabel?void 0:!0},[e.iconLabel?(t.openBlock(),t.createElementBlock("title",Lo,t.toDisplayString(e.iconLabel),1)):t.createCommentVNode("v-if",!0),e.iconSvg?(t.openBlock(),t.createElementBlock("g",{key:1,innerHTML:e.iconSvg},null,8,Ro)):(t.openBlock(),t.createElementBlock("path",{key:2,d:e.iconPath},null,8,Oo))],8,To))],2)}const X=z(Mo,[["render",vo]]);function Yt(e){const n=[];for(const o of e)typeof o.type=="string"||typeof o.type=="object"?n.push(o):o.type!==t.Comment&&(typeof o.children=="string"&&o.children.trim()!==""?n.push(o.children):Array.isArray(o.children)&&n.push(...Yt(o.children)));return n}function Xt(e,n){return typeof e.type=="object"&&"name"in e.type?n!==void 0?e.type.name===n:!0:!1}function Po(e,n){return typeof e.type=="string"?e.type===n.toLowerCase():!1}function De(e){const n=typeof e=="function"?e():e;return n?Yt(n):[]}function Je(e,n){if(e()){t.warn(n);return}const o=t.watch(e,l=>{l&&(t.warn(n),o())})}function Jt(e,n,o){const l=t.computed(()=>{const a=De(e);if(a.length!==1)return!1;const d=a[0];return!!(typeof d=="object"&&(Xt(d,"CdxIcon")||Po(d,"svg")))});return Je(()=>l.value&&!n["aria-label"]&&!n["aria-hidden"],"".concat(o,": Icon-only buttons require one of the following attributes: aria-label or aria-hidden. See documentation at https://doc.wikimedia.org/codex/latest/components/demos/button.html#icon-only-button")),l}const Fo=Y(bo),zo=Y(yo),_o=Y(Co),Ko=t.defineComponent({name:"CdxButton",props:{action:{type:String,default:"default",validator:Fo},weight:{type:String,default:"normal",validator:zo},size:{type:String,default:"medium",validator:_o}},emits:["click"],setup(e,{emit:n,slots:o,attrs:l}){const a=t.ref(),d=Jt(o.default,l,"CdxButton"),i=t.ref(!1),s=t.computed(()=>({["cdx-button--action-".concat(e.action)]:!0,["cdx-button--weight-".concat(e.weight)]:!0,["cdx-button--size-".concat(e.size)]:!0,"cdx-button--framed":e.weight!=="quiet","cdx-button--icon-only":d.value,"cdx-button--is-active":i.value})),r=f=>{n("click",f)},c=f=>{i.value=f};function u(){c(!0)}function p(){var f;c(!1),(f=a.value)==null||f.click()}return{button:a,rootClasses:s,onClick:r,onKeyDown:u,onKeyUp:p}}});function Ho(e,n,o,l,a,d){return t.openBlock(),t.createElementBlock("button",{ref:"button",class:t.normalizeClass(["cdx-button",e.rootClasses]),onKeydown:n[0]||(n[0]=t.withKeys(t.withModifiers((...i)=>e.onKeyDown&&e.onKeyDown(...i),["prevent"]),["space","enter"])),onKeyup:n[1]||(n[1]=t.withKeys((...i)=>e.onKeyUp&&e.onKeyUp(...i),["space","enter"])),onClick:n[2]||(n[2]=(...i)=>e.onClick&&e.onClick(...i))},[t.renderSlot(e.$slots,"default")],34)}const ce=z(Ko,[["render",Ho]]);function He(e,n,o,l){return t.computed({get:()=>{var a;return(a=n.value)!=null?a:e.value},set:a=>{n.value!==null?o(l||"update:modelValue",a):e.value=a}})}const jo=Y(Vo),Uo=t.defineComponent({name:"CdxAccordion",components:{CdxButton:ce,CdxIcon:X},props:{modelValue:{type:[Boolean,null],default:null},actionAlwaysVisible:{type:Boolean,default:!1},separation:{type:String,default:"divider",validator:jo},actionIcon:{type:[String,Object],default:null},actionButtonLabel:{type:String,default:""},headingLevel:{type:String,default:"h3"}},emits:["action-button-click","update:modelValue","toggle"],setup(e,{attrs:n,emit:o}){const l=t.ref("open"in n),a=He(l,t.toRef(e,"modelValue"),o),d=()=>{o("action-button-click")},i=c=>{a.value=c.newState==="open",o("toggle",a.value)},s=t.computed(()=>e.actionIcon?a.value?!0:!!e.actionAlwaysVisible:!1),r=t.computed(()=>({"cdx-accordion--has-icon":s.value,["cdx-accordion--separation-".concat(e.separation)]:!0}));return{emitActionButtonClick:d,rootClasses:r,shouldShowActionButton:s,onToggle:i,computedOpen:a}}}),Wo=["open"],qo={class:"cdx-accordion__header__title"},Qo={class:"cdx-accordion__header__description"};function Go(e,n,o,l,a,d){const i=t.resolveComponent("cdx-icon"),s=t.resolveComponent("cdx-button");return t.openBlock(),t.createElementBlock("details",{class:t.normalizeClass(["cdx-accordion",e.rootClasses]),open:e.computedOpen||void 0,onToggle:n[1]||(n[1]=(...r)=>e.onToggle&&e.onToggle(...r))},[t.createElementVNode("summary",null,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.headingLevel),{class:"cdx-accordion__header"},{default:t.withCtx(()=>[t.createElementVNode("span",qo,[t.renderSlot(e.$slots,"title")]),t.createElementVNode("span",Qo,[t.renderSlot(e.$slots,"description")])]),_:3})),e.shouldShowActionButton?(t.openBlock(),t.createBlock(s,{key:0,class:"cdx-accordion__action","aria-label":e.actionButtonLabel,type:"button",weight:"quiet",onClick:t.withModifiers(e.emitActionButtonClick,["stop"])},{default:t.withCtx(()=>[t.createVNode(i,{icon:e.actionIcon,"icon-label":e.actionButtonLabel,size:"medium"},null,8,["icon","icon-label"])]),_:1},8,["aria-label","onClick"])):t.createCommentVNode("v-if",!0)]),t.createElementVNode("div",{class:"cdx-accordion__content",onClick:n[0]||(n[0]=t.withModifiers(()=>{},["stop"]))},[t.renderSlot(e.$slots,"default")])],42,Wo)}const Yo=z(Uo,[["render",Go]]);function Zt(e){return e.label===void 0?e.value:e.label===null?"":e.label}function en(e){const n=t.ref(),o=t.ref(),l=t.ref(new Map),a=_e(n);function d(h,g){const b=h;b&&l.value.set(g,b)}function i(h){o.value=h}function s(){o.value=void 0}function r(h,g){var S;const b=h+g,k=e.value[b];if(k)if(k.disabled)r(b,g);else{const E=(S=l.value.get(b))==null?void 0:S.$el;E==null||E.focus()}}function c(){var h;r((h=o.value)!=null?h:-1,1)}function u(){var h;r((h=o.value)!=null?h:e.value.length,-1)}function p(){a.value==="rtl"?u():c()}function f(){a.value==="rtl"?c():u()}function m(h){switch(h.key){case"ArrowRight":h.preventDefault(),p();break;case"ArrowLeft":h.preventDefault(),f();break;case"ArrowDown":h.preventDefault(),c();break;case"ArrowUp":h.preventDefault(),u();break}}return{rootElement:n,assignTemplateRef:d,onFocus:i,onBlur:s,onKeydown:m}}const Xo=t.defineComponent({name:"CdxButtonGroup",components:{CdxButton:ce,CdxIcon:X},props:{buttons:{type:Array,required:!0,validator:e=>Array.isArray(e)&&e.length>=1},disabled:{type:Boolean,default:!1}},emits:["click"],setup(e){const{rootElement:n,assignTemplateRef:o,onFocus:l,onBlur:a,onKeydown:d}=en(t.toRef(e,"buttons"));return{rootElement:n,assignTemplateRef:o,onFocus:l,onBlur:a,onKeydown:d,getButtonLabel:Zt}}}),Jo={ref:"rootElement",class:"cdx-button-group"};function Zo(e,n,o,l,a,d){const i=t.resolveComponent("cdx-icon"),s=t.resolveComponent("cdx-button");return t.openBlock(),t.createElementBlock("div",Jo,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.buttons,(r,c)=>(t.openBlock(),t.createBlock(s,{key:r.value,ref_for:!0,ref:u=>e.assignTemplateRef(u,c),disabled:r.disabled||e.disabled,"aria-label":r.ariaLabel,onClick:u=>e.$emit("click",r.value),onFocus:u=>e.onFocus(c),onBlur:e.onBlur,onKeydown:e.onKeydown},{default:t.withCtx(()=>[t.renderSlot(e.$slots,"default",{button:r},()=>[r.icon?(t.openBlock(),t.createBlock(i,{key:0,icon:r.icon},null,8,["icon"])):t.createCommentVNode("v-if",!0),t.createTextVNode(" "+t.toDisplayString(e.getButtonLabel(r)),1)])]),_:2},1032,["disabled","aria-label","onClick","onFocus","onBlur","onKeydown"]))),128))],512)}const el=z(Xo,[["render",Zo]]),tl=t.defineComponent({name:"CdxThumbnail",components:{CdxIcon:X},props:{thumbnail:{type:[Object,null],default:null},placeholderIcon:{type:[String,Object],default:ro}},setup:e=>{const n=t.ref(!1),o=t.ref({}),l=a=>{const d=a.replace(/([\\"\n])/g,"\\$1"),i=new Image;i.onload=()=>{o.value={backgroundImage:'url("'.concat(d,'")')},n.value=!0},i.onerror=()=>{n.value=!1},i.src=d};return t.onMounted(()=>{var a;(a=e.thumbnail)!=null&&a.url&&l(e.thumbnail.url)}),t.watch(t.toRef(e,"thumbnail"),(a,d)=>{if(!(a!=null&&a.url)){n.value=!1,o.value={};return}(d==null?void 0:d.url)!==a.url&&(n.value=!1,l(a.url))},{deep:!0}),{thumbnailStyle:o,thumbnailLoaded:n,NoInvertClass:No}}}),nl={class:"cdx-thumbnail"},ol={key:0,class:"cdx-thumbnail__placeholder"};function ll(e,n,o,l,a,d){const i=t.resolveComponent("cdx-icon");return t.openBlock(),t.createElementBlock("span",nl,[e.thumbnailLoaded?t.createCommentVNode("v-if",!0):(t.openBlock(),t.createElementBlock("span",ol,[t.createVNode(i,{icon:e.placeholderIcon,class:"cdx-thumbnail__placeholder__icon--vue"},null,8,["icon"])])),t.createVNode(t.Transition,{name:"cdx-thumbnail__image"},{default:t.withCtx(()=>[e.thumbnailLoaded?(t.openBlock(),t.createElementBlock("span",{key:0,style:t.normalizeStyle(e.thumbnailStyle),class:t.normalizeClass([e.NoInvertClass,"cdx-thumbnail__image"])},null,6)):t.createCommentVNode("v-if",!0)]),_:1})])}const pt=z(tl,[["render",ll]]),al=t.defineComponent({name:"CdxCard",components:{CdxIcon:X,CdxThumbnail:pt},props:{url:{type:String,default:""},icon:{type:[String,Object],default:""},thumbnail:{type:[Object,null],default:null},forceThumbnail:{type:Boolean,default:!1},customPlaceholderIcon:{type:[String,Object],default:void 0}},setup(e){const n=t.computed(()=>!!e.url),o=t.computed(()=>n.value?"a":"span"),l=t.computed(()=>n.value?e.url:void 0);return{isLink:n,contentTag:o,cardLink:l}}}),sl={class:"cdx-card__text"},il={class:"cdx-card__text__title"},rl={key:0,class:"cdx-card__text__description"},dl={key:1,class:"cdx-card__text__supporting-text"};function cl(e,n,o,l,a,d){const i=t.resolveComponent("cdx-thumbnail"),s=t.resolveComponent("cdx-icon");return t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.contentTag),{href:e.cardLink,class:t.normalizeClass(["cdx-card",{"cdx-card--is-link":e.isLink,"cdx-card--title-only":!e.$slots.description&&!e.$slots["supporting-text"]}])},{default:t.withCtx(()=>[e.thumbnail||e.forceThumbnail?(t.openBlock(),t.createBlock(i,{key:0,thumbnail:e.thumbnail,"placeholder-icon":e.customPlaceholderIcon,class:"cdx-card__thumbnail"},null,8,["thumbnail","placeholder-icon"])):e.icon?(t.openBlock(),t.createBlock(s,{key:1,icon:e.icon,class:"cdx-card__icon"},null,8,["icon"])):t.createCommentVNode("v-if",!0),t.createElementVNode("span",sl,[t.createElementVNode("span",il,[t.renderSlot(e.$slots,"title")]),e.$slots.description?(t.openBlock(),t.createElementBlock("span",rl,[t.renderSlot(e.$slots,"description")])):t.createCommentVNode("v-if",!0),e.$slots["supporting-text"]?(t.openBlock(),t.createElementBlock("span",dl,[t.renderSlot(e.$slots,"supporting-text")])):t.createCommentVNode("v-if",!0)])]),_:3},8,["href","class"])}const ul=z(al,[["render",cl]]);function ft(e){const n=t.inject(Qt,t.ref(!1));return t.computed(()=>n.value||e.value)}function se(e,n,o){const l=ft(e),a=t.inject(qt,t.ref("default")),d=t.computed(()=>n!=null&&n.value&&n.value!=="default"?n.value:a.value),i=t.inject(Wt,void 0),s=t.computed(()=>{var r;return(r=i==null?void 0:i.value)!=null?r:o});return{computedDisabled:l,computedStatus:d,computedInputId:s}}function oe(e,n=t.computed(()=>({}))){const o=t.computed(()=>{const d=ue(n.value,[]);return e.class&&e.class.split(" ").forEach(s=>{d[s]=!0}),d}),l=t.computed(()=>{if("style"in e)return e.style}),a=t.computed(()=>{const r=e,{class:d,style:i}=r;return ue(r,["class","style"])});return{rootClasses:o,rootStyle:l,otherAttrs:a}}function J(e,n,o=[]){const l=t.inject("CdxI18nFunction",void 0);return t.computed(()=>{const a=o.map(i=>typeof i=="function"?i():i.value),d=l==null?void 0:l(e,...a);return d!=null?d:typeof n=="function"?n(...a):n})}function je(e,n,o,l=[]){const a=J(n,o,l);return t.computed(()=>e.value||a.value)}const pl=t.defineComponent({name:"CdxLabel",components:{CdxIcon:X},inheritAttrs:!1,props:{icon:{type:[String,Object],default:null},optional:{type:Boolean,default:!1},optionalFlag:{type:String,default:"",validator:(e,n)=>e.length>0&&!n.optional?(console.warn("[CdxLabel]: The boolean `optional` prop is required to show the optional flag.\n\nRefer to https://doc.wikimedia.org/codex/latest/components/demos/label.html#props."),!1):!0},visuallyHidden:{type:Boolean,default:!1},isLegend:{type:Boolean,default:!1},inputId:{type:String,default:""},descriptionId:{type:String,default:""},disabled:{type:Boolean,default:!1}},setup(e,{attrs:n}){const{computedDisabled:o}=se(t.toRef(e,"disabled")),l=t.computed(()=>({"cdx-label--visually-hidden":e.visuallyHidden,"cdx-label--disabled":o.value})),{rootClasses:a,rootStyle:d,otherAttrs:i}=oe(n,l),s=je(t.toRef(e,"optionalFlag"),"cdx-label-optional-flag","(optional)");return{rootClasses:a,rootStyle:d,otherAttrs:i,translatedOptionalFlag:s}}}),fl=["for"],ml={class:"cdx-label__label__text"},hl={key:1,class:"cdx-label__label__optional-flag"},gl=["id"],bl={class:"cdx-label__label"},yl={class:"cdx-label__label__text"},Cl={key:1,class:"cdx-label__label__optional-flag"},wl={key:0,class:"cdx-label__description"};function kl(e,n,o,l,a,d){const i=t.resolveComponent("cdx-icon");return e.isLegend?(t.openBlock(),t.createElementBlock("legend",t.mergeProps({key:1,class:["cdx-label",e.rootClasses],style:e.rootStyle},e.otherAttrs),[t.createElementVNode("span",bl,[e.icon?(t.openBlock(),t.createBlock(i,{key:0,icon:e.icon,class:"cdx-label__label__icon"},null,8,["icon"])):t.createCommentVNode("v-if",!0),t.createElementVNode("span",yl,[t.renderSlot(e.$slots,"default")]),e.optionalFlag||e.optional?(t.openBlock(),t.createElementBlock("span",Cl,t.toDisplayString(" ")+" "+t.toDisplayString(e.translatedOptionalFlag),1)):t.createCommentVNode("v-if",!0)]),e.$slots.description&&e.$slots.description().length>0?(t.openBlock(),t.createElementBlock("span",wl,[t.renderSlot(e.$slots,"description")])):t.createCommentVNode("v-if",!0)],16)):(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["cdx-label",e.rootClasses]),style:t.normalizeStyle(e.rootStyle)},[t.createElementVNode("label",t.mergeProps({class:"cdx-label__label",for:e.inputId?e.inputId:void 0},e.otherAttrs),[e.icon?(t.openBlock(),t.createBlock(i,{key:0,icon:e.icon,class:"cdx-label__label__icon"},null,8,["icon"])):t.createCommentVNode("v-if",!0),t.createElementVNode("span",ml,[t.renderSlot(e.$slots,"default")]),e.optionalFlag||e.optional?(t.openBlock(),t.createElementBlock("span",hl,t.toDisplayString(" ")+" "+t.toDisplayString(e.translatedOptionalFlag),1)):t.createCommentVNode("v-if",!0)],16,fl),e.$slots.description&&e.$slots.description().length>0?(t.openBlock(),t.createElementBlock("span",{key:0,id:e.descriptionId||void 0,class:"cdx-label__description"},[t.renderSlot(e.$slots,"description")],8,gl)):t.createCommentVNode("v-if",!0)],6))}const Me=z(pl,[["render",kl]]);function Ze(e,n,o){Je(()=>De(e).length===0&&!(n!=null&&n["aria-label"])&&!(n!=null&&n["aria-labelledby"]),"".concat(o,": Inputs must have an associated label. Provide one of the following:\n - A label via the appropriate slot\n - An `aria-label` attribute set to the label text\n - An `aria-labelledby` attribute set to the ID of the label element"))}function ae(e,n,o){return t.computed({get:()=>e.value,set:l=>n(o||"update:modelValue",l)})}const $l=Y(fe),Bl=t.defineComponent({name:"CdxCheckbox",components:{CdxLabel:Me},props:{modelValue:{type:[Boolean,Array],default:!1},inputValue:{type:[String,Number,Boolean],default:!1},name:{type:String,default:null},disabled:{type:Boolean,default:!1},indeterminate:{type:Boolean,default:!1},inline:{type:Boolean,default:!1},hideLabel:{type:Boolean,default:!1},status:{type:String,default:"default",validator:$l}},emits:["update:modelValue"],setup(e,{emit:n,slots:o,attrs:l}){var f;Ze((f=o.default)==null?void 0:f.call(o),l,"CdxCheckbox");const{computedDisabled:a,computedStatus:d}=se(t.toRef(e,"disabled"),t.toRef(e,"status")),i=t.computed(()=>({"cdx-checkbox--inline":e.inline,["cdx-checkbox--status-".concat(d.value)]:!0})),s=t.computed(()=>({"cdx-checkbox__custom-input--inline":e.inline})),r=t.ref(),c=t.useId(),u=t.useId(),p=ae(t.toRef(e,"modelValue"),n);return{rootClasses:i,computedDisabled:a,input:r,checkboxId:c,descriptionId:u,wrappedModel:p,customInputClasses:s}}}),Sl={class:"cdx-checkbox__wrapper"},Il=["id","aria-describedby","value","name","disabled",".indeterminate"];function Vl(e,n,o,l,a,d){const i=t.resolveComponent("cdx-label");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["cdx-checkbox",e.rootClasses])},[t.createElementVNode("div",Sl,[t.withDirectives(t.createElementVNode("input",{id:e.checkboxId,ref:"input","onUpdate:modelValue":n[0]||(n[0]=s=>e.wrappedModel=s),class:"cdx-checkbox__input",type:"checkbox","aria-describedby":e.$slots.description&&e.$slots.description().length>0?e.descriptionId:void 0,value:e.inputValue,name:e.name,disabled:e.computedDisabled,".indeterminate":e.indeterminate},null,40,Il),[[t.vModelCheckbox,e.wrappedModel]]),n[1]||(n[1]=t.createElementVNode("span",{class:"cdx-checkbox__icon"},null,-1)),e.$slots.default&&e.$slots.default().length?(t.openBlock(),t.createBlock(i,{key:0,class:"cdx-checkbox__label","input-id":e.checkboxId,"description-id":e.$slots.description&&e.$slots.description().length>0?e.descriptionId:void 0,disabled:e.computedDisabled,"visually-hidden":e.hideLabel},t.createSlots({default:t.withCtx(()=>[t.renderSlot(e.$slots,"default")]),_:2},[e.$slots.description&&e.$slots.description().length>0?{name:"description",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"description")]),key:"0"}:void 0]),1032,["input-id","description-id","disabled","visually-hidden"])):t.createCommentVNode("v-if",!0)]),e.$slots["custom-input"]?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["cdx-checkbox__custom-input",e.customInputClasses])},[t.renderSlot(e.$slots,"custom-input")],2)):t.createCommentVNode("v-if",!0)],2)}const tn=z(Bl,[["render",Vl]]),El=["top","right","bottom","left"],ke=Math.min,re=Math.max,et=Math.round,tt=Math.floor,ge=e=>({x:e,y:e}),xl={left:"right",right:"left",bottom:"top",top:"bottom"},Nl={start:"end",end:"start"};function mt(e,n,o){return re(e,ke(n,o))}function Ie(e,n){return typeof e=="function"?e(n):e}function $e(e){return e.split("-")[0]}function Te(e){return e.split("-")[1]}function nn(e){return e==="x"?"y":"x"}function ht(e){return e==="y"?"height":"width"}function Ve(e){return["top","bottom"].includes($e(e))?"y":"x"}function gt(e){return nn(Ve(e))}function Al(e,n,o){o===void 0&&(o=!1);const l=Te(e),a=gt(e),d=ht(a);let i=a==="x"?l===(o?"end":"start")?"right":"left":l==="start"?"bottom":"top";return n.reference[d]>n.floating[d]&&(i=nt(i)),[i,nt(i)]}function Dl(e){const n=nt(e);return[bt(e),n,bt(n)]}function bt(e){return e.replace(/start|end/g,n=>Nl[n])}function Ml(e,n,o){const l=["left","right"],a=["right","left"],d=["top","bottom"],i=["bottom","top"];switch(e){case"top":case"bottom":return o?n?a:l:n?l:a;case"left":case"right":return n?d:i;default:return[]}}function Tl(e,n,o,l){const a=Te(e);let d=Ml($e(e),o==="start",l);return a&&(d=d.map(i=>i+"-"+a),n&&(d=d.concat(d.map(bt)))),d}function nt(e){return e.replace(/left|right|bottom|top/g,n=>xl[n])}function Ll(e){return Z({top:0,right:0,bottom:0,left:0},e)}function on(e){return typeof e!="number"?Ll(e):{top:e,right:e,bottom:e,left:e}}function ot(e){const{x:n,y:o,width:l,height:a}=e;return{width:l,height:a,top:o,left:n,right:n+l,bottom:o+a,x:n,y:o}}function ln(e,n,o){let{reference:l,floating:a}=e;const d=Ve(n),i=gt(n),s=ht(i),r=$e(n),c=d==="y",u=l.x+l.width/2-a.width/2,p=l.y+l.height/2-a.height/2,f=l[s]/2-a[s]/2;let m;switch(r){case"top":m={x:u,y:l.y-a.height};break;case"bottom":m={x:u,y:l.y+l.height};break;case"right":m={x:l.x+l.width,y:p};break;case"left":m={x:l.x-a.width,y:p};break;default:m={x:l.x,y:l.y}}switch(Te(n)){case"start":m[i]-=f*(o&&c?-1:1);break;case"end":m[i]+=f*(o&&c?-1:1);break}return m}const Rl=async(e,n,o)=>{const{placement:l="bottom",strategy:a="absolute",middleware:d=[],platform:i}=o,s=d.filter(Boolean),r=await(i.isRTL==null?void 0:i.isRTL(n));let c=await i.getElementRects({reference:e,floating:n,strategy:a}),{x:u,y:p}=ln(c,l,r),f=l,m={},h=0;for(let g=0;g<s.length;g++){const{name:b,fn:k}=s[g],{x:S,y:E,data:x,reset:M}=await k({x:u,y:p,initialPlacement:l,placement:f,strategy:a,middlewareData:m,rects:c,platform:i,elements:{reference:e,floating:n}});u=S!=null?S:u,p=E!=null?E:p,m=ie(Z({},m),{[b]:Z(Z({},m[b]),x)}),M&&h<=50&&(h++,typeof M=="object"&&(M.placement&&(f=M.placement),M.rects&&(c=M.rects===!0?await i.getElementRects({reference:e,floating:n,strategy:a}):M.rects),{x:u,y:p}=ln(c,f,r)),g=-1)}return{x:u,y:p,placement:f,strategy:a,middlewareData:m}};async function Ue(e,n){var o;n===void 0&&(n={});const{x:l,y:a,platform:d,rects:i,elements:s,strategy:r}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:p="floating",altBoundary:f=!1,padding:m=0}=Ie(n,e),h=on(m),b=s[f?p==="floating"?"reference":"floating":p],k=ot(await d.getClippingRect({element:(o=await(d.isElement==null?void 0:d.isElement(b)))==null||o?b:b.contextElement||await(d.getDocumentElement==null?void 0:d.getDocumentElement(s.floating)),boundary:c,rootBoundary:u,strategy:r})),S=p==="floating"?{x:l,y:a,width:i.floating.width,height:i.floating.height}:i.reference,E=await(d.getOffsetParent==null?void 0:d.getOffsetParent(s.floating)),x=await(d.isElement==null?void 0:d.isElement(E))?await(d.getScale==null?void 0:d.getScale(E))||{x:1,y:1}:{x:1,y:1},M=ot(d.convertOffsetParentRelativeRectToViewportRelativeRect?await d.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:S,offsetParent:E,strategy:r}):S);return{top:(k.top-M.top+h.top)/x.y,bottom:(M.bottom-k.bottom+h.bottom)/x.y,left:(k.left-M.left+h.left)/x.x,right:(M.right-k.right+h.right)/x.x}}const Ol=e=>({name:"arrow",options:e,async fn(n){const{x:o,y:l,placement:a,rects:d,platform:i,elements:s,middlewareData:r}=n,{element:c,padding:u=0}=Ie(e,n)||{};if(c==null)return{};const p=on(u),f={x:o,y:l},m=gt(a),h=ht(m),g=await i.getDimensions(c),b=m==="y",k=b?"top":"left",S=b?"bottom":"right",E=b?"clientHeight":"clientWidth",x=d.reference[h]+d.reference[m]-f[m]-d.floating[h],M=f[m]-d.reference[m],A=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c));let N=A?A[E]:0;(!N||!await(i.isElement==null?void 0:i.isElement(A)))&&(N=s.floating[E]||d.floating[h]);const R=x/2-M/2,y=N/2-g[h]/2-1,$=ke(p[k],y),w=ke(p[S],y),B=$,T=N-g[h]-w,F=N/2-g[h]/2+R,j=mt(B,F,T),U=!r.arrow&&Te(a)!=null&&F!==j&&d.reference[h]/2-(F<B?$:w)-g[h]/2<0,_=U?F<B?F-B:F-T:0;return{[m]:f[m]+_,data:Z({[m]:j,centerOffset:F-j-_},U&&{alignmentOffset:_}),reset:U}}}),vl=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(n){var o,l;const{placement:a,middlewareData:d,rects:i,initialPlacement:s,platform:r,elements:c}=n,F=Ie(e,n),{mainAxis:u=!0,crossAxis:p=!0,fallbackPlacements:f,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:g=!0}=F,b=ue(F,["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","fallbackAxisSideDirection","flipAlignment"]);if((o=d.arrow)!=null&&o.alignmentOffset)return{};const k=$e(a),S=Ve(s),E=$e(s)===s,x=await(r.isRTL==null?void 0:r.isRTL(c.floating)),M=f||(E||!g?[nt(s)]:Dl(s)),A=h!=="none";!f&&A&&M.push(...Tl(s,g,h,x));const N=[s,...M],R=await Ue(n,b),y=[];let $=((l=d.flip)==null?void 0:l.overflows)||[];if(u&&y.push(R[k]),p){const j=Al(a,i,x);y.push(R[j[0]],R[j[1]])}if($=[...$,{placement:a,overflows:y}],!y.every(j=>j<=0)){var w,B;const j=(((w=d.flip)==null?void 0:w.index)||0)+1,U=N[j];if(U)return{data:{index:j,overflows:$},reset:{placement:U}};let _=(B=$.filter(O=>O.overflows[0]<=0).sort((O,K)=>O.overflows[1]-K.overflows[1])[0])==null?void 0:B.placement;if(!_)switch(m){case"bestFit":{var T;const O=(T=$.filter(K=>{if(A){const W=Ve(K.placement);return W===S||W==="y"}return!0}).map(K=>[K.placement,K.overflows.filter(W=>W>0).reduce((W,I)=>W+I,0)]).sort((K,W)=>K[1]-W[1])[0])==null?void 0:T[0];O&&(_=O);break}case"initialPlacement":_=s;break}if(a!==_)return{reset:{placement:_}}}return{}}}};function an(e,n){return{top:e.top-n.height,right:e.right-n.width,bottom:e.bottom-n.height,left:e.left-n.width}}function sn(e){return El.some(n=>e[n]>=0)}const Pl=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(n){const{rects:o}=n,d=Ie(e,n),{strategy:l="referenceHidden"}=d,a=ue(d,["strategy"]);switch(l){case"referenceHidden":{const i=await Ue(n,ie(Z({},a),{elementContext:"reference"})),s=an(i,o.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:sn(s)}}}case"escaped":{const i=await Ue(n,ie(Z({},a),{altBoundary:!0})),s=an(i,o.floating);return{data:{escapedOffsets:s,escaped:sn(s)}}}default:return{}}}}};async function Fl(e,n){const{placement:o,platform:l,elements:a}=e,d=await(l.isRTL==null?void 0:l.isRTL(a.floating)),i=$e(o),s=Te(o),r=Ve(o)==="y",c=["left","top"].includes(i)?-1:1,u=d&&r?-1:1,p=Ie(n,e);let{mainAxis:f,crossAxis:m,alignmentAxis:h}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return s&&typeof h=="number"&&(m=s==="end"?h*-1:h),r?{x:m*u,y:f*c}:{x:f*c,y:m*u}}const zl=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(n){var o,l;const{x:a,y:d,placement:i,middlewareData:s}=n,r=await Fl(n,e);return i===((o=s.offset)==null?void 0:o.placement)&&(l=s.arrow)!=null&&l.alignmentOffset?{}:{x:a+r.x,y:d+r.y,data:ie(Z({},r),{placement:i})}}}},_l=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(n){const{x:o,y:l,placement:a}=n,b=Ie(e,n),{mainAxis:d=!0,crossAxis:i=!1,limiter:s={fn:k=>{let{x:S,y:E}=k;return{x:S,y:E}}}}=b,r=ue(b,["mainAxis","crossAxis","limiter"]),c={x:o,y:l},u=await Ue(n,r),p=Ve($e(a)),f=nn(p);let m=c[f],h=c[p];if(d){const k=f==="y"?"top":"left",S=f==="y"?"bottom":"right",E=m+u[k],x=m-u[S];m=mt(E,m,x)}if(i){const k=p==="y"?"top":"left",S=p==="y"?"bottom":"right",E=h+u[k],x=h-u[S];h=mt(E,h,x)}const g=s.fn(ie(Z({},n),{[f]:m,[p]:h}));return ie(Z({},g),{data:{x:g.x-o,y:g.y-l,enabled:{[f]:d,[p]:i}}})}}},Kl=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(n){var o,l;const{placement:a,rects:d,platform:i,elements:s}=n,$=Ie(e,n),{apply:r=()=>{}}=$,c=ue($,["apply"]),u=await Ue(n,c),p=$e(a),f=Te(a),m=Ve(a)==="y",{width:h,height:g}=d.floating;let b,k;p==="top"||p==="bottom"?(b=p,k=f===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(k=p,b=f==="end"?"top":"bottom");const S=g-u.top-u.bottom,E=h-u.left-u.right,x=ke(g-u[b],S),M=ke(h-u[k],E),A=!n.middlewareData.shift;let N=x,R=M;if((o=n.middlewareData.shift)!=null&&o.enabled.x&&(R=E),(l=n.middlewareData.shift)!=null&&l.enabled.y&&(N=S),A&&!f){const w=re(u.left,0),B=re(u.right,0),T=re(u.top,0),F=re(u.bottom,0);m?R=h-2*(w!==0||B!==0?w+B:re(u.left,u.right)):N=g-2*(T!==0||F!==0?T+F:re(u.top,u.bottom))}await r(ie(Z({},n),{availableWidth:R,availableHeight:N}));const y=await i.getDimensions(s.floating);return h!==y.width||g!==y.height?{reset:{rects:!0}}:{}}}};function lt(){return typeof window!="undefined"}function Ee(e){return yt(e)?(e.nodeName||"").toLowerCase():"#document"}function de(e){var n;return(e==null||(n=e.ownerDocument)==null?void 0:n.defaultView)||window}function be(e){var n;return(n=(yt(e)?e.ownerDocument:e.document)||window.document)==null?void 0:n.documentElement}function yt(e){return lt()?e instanceof Node||e instanceof de(e).Node:!1}function me(e){return lt()?e instanceof Element||e instanceof de(e).Element:!1}function ye(e){return lt()?e instanceof HTMLElement||e instanceof de(e).HTMLElement:!1}function rn(e){return!lt()||typeof ShadowRoot=="undefined"?!1:e instanceof ShadowRoot||e instanceof de(e).ShadowRoot}function We(e){const{overflow:n,overflowX:o,overflowY:l,display:a}=he(e);return/auto|scroll|overlay|hidden|clip/.test(n+l+o)&&!["inline","contents"].includes(a)}function Hl(e){return["table","td","th"].includes(Ee(e))}function at(e){return[":popover-open",":modal"].some(n=>{try{return e.matches(n)}catch(o){return!1}})}function Ct(e){const n=wt(),o=me(e)?he(e):e;return o.transform!=="none"||o.perspective!=="none"||(o.containerType?o.containerType!=="normal":!1)||!n&&(o.backdropFilter?o.backdropFilter!=="none":!1)||!n&&(o.filter?o.filter!=="none":!1)||["transform","perspective","filter"].some(l=>(o.willChange||"").includes(l))||["paint","layout","strict","content"].some(l=>(o.contain||"").includes(l))}function jl(e){let n=Be(e);for(;ye(n)&&!Le(n);){if(Ct(n))return n;if(at(n))return null;n=Be(n)}return null}function wt(){return typeof CSS=="undefined"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Le(e){return["html","body","#document"].includes(Ee(e))}function he(e){return de(e).getComputedStyle(e)}function st(e){return me(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Be(e){if(Ee(e)==="html")return e;const n=e.assignedSlot||e.parentNode||rn(e)&&e.host||be(e);return rn(n)?n.host:n}function dn(e){const n=Be(e);return Le(n)?e.ownerDocument?e.ownerDocument.body:e.body:ye(n)&&We(n)?n:dn(n)}function qe(e,n,o){var l;n===void 0&&(n=[]),o===void 0&&(o=!0);const a=dn(e),d=a===((l=e.ownerDocument)==null?void 0:l.body),i=de(a);if(d){const s=kt(i);return n.concat(i,i.visualViewport||[],We(a)?a:[],s&&o?qe(s):[])}return n.concat(a,qe(a,[],o))}function kt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function cn(e){const n=he(e);let o=parseFloat(n.width)||0,l=parseFloat(n.height)||0;const a=ye(e),d=a?e.offsetWidth:o,i=a?e.offsetHeight:l,s=et(o)!==d||et(l)!==i;return s&&(o=d,l=i),{width:o,height:l,$:s}}function $t(e){return me(e)?e:e.contextElement}function Re(e){const n=$t(e);if(!ye(n))return ge(1);const o=n.getBoundingClientRect(),{width:l,height:a,$:d}=cn(n);let i=(d?et(o.width):o.width)/l,s=(d?et(o.height):o.height)/a;return(!i||!Number.isFinite(i))&&(i=1),(!s||!Number.isFinite(s))&&(s=1),{x:i,y:s}}const Ul=ge(0);function un(e){const n=de(e);return!wt()||!n.visualViewport?Ul:{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}}function Wl(e,n,o){return n===void 0&&(n=!1),!o||n&&o!==de(e)?!1:n}function xe(e,n,o,l){n===void 0&&(n=!1),o===void 0&&(o=!1);const a=e.getBoundingClientRect(),d=$t(e);let i=ge(1);n&&(l?me(l)&&(i=Re(l)):i=Re(e));const s=Wl(d,o,l)?un(d):ge(0);let r=(a.left+s.x)/i.x,c=(a.top+s.y)/i.y,u=a.width/i.x,p=a.height/i.y;if(d){const f=de(d),m=l&&me(l)?de(l):l;let h=f,g=kt(h);for(;g&&l&&m!==h;){const b=Re(g),k=g.getBoundingClientRect(),S=he(g),E=k.left+(g.clientLeft+parseFloat(S.paddingLeft))*b.x,x=k.top+(g.clientTop+parseFloat(S.paddingTop))*b.y;r*=b.x,c*=b.y,u*=b.x,p*=b.y,r+=E,c+=x,h=de(g),g=kt(h)}}return ot({width:u,height:p,x:r,y:c})}function Bt(e,n){const o=st(e).scrollLeft;return n?n.left+o:xe(be(e)).left+o}function pn(e,n,o){o===void 0&&(o=!1);const l=e.getBoundingClientRect(),a=l.left+n.scrollLeft-(o?0:Bt(e,l)),d=l.top+n.scrollTop;return{x:a,y:d}}function ql(e){let{elements:n,rect:o,offsetParent:l,strategy:a}=e;const d=a==="fixed",i=be(l),s=n?at(n.floating):!1;if(l===i||s&&d)return o;let r={scrollLeft:0,scrollTop:0},c=ge(1);const u=ge(0),p=ye(l);if((p||!p&&!d)&&((Ee(l)!=="body"||We(i))&&(r=st(l)),ye(l))){const m=xe(l);c=Re(l),u.x=m.x+l.clientLeft,u.y=m.y+l.clientTop}const f=i&&!p&&!d?pn(i,r,!0):ge(0);return{width:o.width*c.x,height:o.height*c.y,x:o.x*c.x-r.scrollLeft*c.x+u.x+f.x,y:o.y*c.y-r.scrollTop*c.y+u.y+f.y}}function Ql(e){return Array.from(e.getClientRects())}function Gl(e){const n=be(e),o=st(e),l=e.ownerDocument.body,a=re(n.scrollWidth,n.clientWidth,l.scrollWidth,l.clientWidth),d=re(n.scrollHeight,n.clientHeight,l.scrollHeight,l.clientHeight);let i=-o.scrollLeft+Bt(e);const s=-o.scrollTop;return he(l).direction==="rtl"&&(i+=re(n.clientWidth,l.clientWidth)-a),{width:a,height:d,x:i,y:s}}function Yl(e,n){const o=de(e),l=be(e),a=o.visualViewport;let d=l.clientWidth,i=l.clientHeight,s=0,r=0;if(a){d=a.width,i=a.height;const c=wt();(!c||c&&n==="fixed")&&(s=a.offsetLeft,r=a.offsetTop)}return{width:d,height:i,x:s,y:r}}function Xl(e,n){const o=xe(e,!0,n==="fixed"),l=o.top+e.clientTop,a=o.left+e.clientLeft,d=ye(e)?Re(e):ge(1),i=e.clientWidth*d.x,s=e.clientHeight*d.y,r=a*d.x,c=l*d.y;return{width:i,height:s,x:r,y:c}}function fn(e,n,o){let l;if(n==="viewport")l=Yl(e,o);else if(n==="document")l=Gl(be(e));else if(me(n))l=Xl(n,o);else{const a=un(e);l={x:n.x-a.x,y:n.y-a.y,width:n.width,height:n.height}}return ot(l)}function mn(e,n){const o=Be(e);return o===n||!me(o)||Le(o)?!1:he(o).position==="fixed"||mn(o,n)}function Jl(e,n){const o=n.get(e);if(o)return o;let l=qe(e,[],!1).filter(s=>me(s)&&Ee(s)!=="body"),a=null;const d=he(e).position==="fixed";let i=d?Be(e):e;for(;me(i)&&!Le(i);){const s=he(i),r=Ct(i);!r&&s.position==="fixed"&&(a=null),(d?!r&&!a:!r&&s.position==="static"&&!!a&&["absolute","fixed"].includes(a.position)||We(i)&&!r&&mn(e,i))?l=l.filter(u=>u!==i):a=s,i=Be(i)}return n.set(e,l),l}function Zl(e){let{element:n,boundary:o,rootBoundary:l,strategy:a}=e;const i=[...o==="clippingAncestors"?at(n)?[]:Jl(n,this._c):[].concat(o),l],s=i[0],r=i.reduce((c,u)=>{const p=fn(n,u,a);return c.top=re(p.top,c.top),c.right=ke(p.right,c.right),c.bottom=ke(p.bottom,c.bottom),c.left=re(p.left,c.left),c},fn(n,s,a));return{width:r.right-r.left,height:r.bottom-r.top,x:r.left,y:r.top}}function ea(e){const{width:n,height:o}=cn(e);return{width:n,height:o}}function ta(e,n,o){const l=ye(n),a=be(n),d=o==="fixed",i=xe(e,!0,d,n);let s={scrollLeft:0,scrollTop:0};const r=ge(0);if(l||!l&&!d)if((Ee(n)!=="body"||We(a))&&(s=st(n)),l){const f=xe(n,!0,d,n);r.x=f.x+n.clientLeft,r.y=f.y+n.clientTop}else a&&(r.x=Bt(a));const c=a&&!l&&!d?pn(a,s):ge(0),u=i.left+s.scrollLeft-r.x-c.x,p=i.top+s.scrollTop-r.y-c.y;return{x:u,y:p,width:i.width,height:i.height}}function St(e){return he(e).position==="static"}function hn(e,n){if(!ye(e)||he(e).position==="fixed")return null;if(n)return n(e);let o=e.offsetParent;return be(e)===o&&(o=o.ownerDocument.body),o}function gn(e,n){const o=de(e);if(at(e))return o;if(!ye(e)){let a=Be(e);for(;a&&!Le(a);){if(me(a)&&!St(a))return a;a=Be(a)}return o}let l=hn(e,n);for(;l&&Hl(l)&&St(l);)l=hn(l,n);return l&&Le(l)&&St(l)&&!Ct(l)?o:l||jl(e)||o}const na=async function(e){const n=this.getOffsetParent||gn,o=this.getDimensions,l=await o(e.floating);return{reference:ta(e.reference,await n(e.floating),e.strategy),floating:{x:0,y:0,width:l.width,height:l.height}}};function oa(e){return he(e).direction==="rtl"}const la={convertOffsetParentRelativeRectToViewportRelativeRect:ql,getDocumentElement:be,getClippingRect:Zl,getOffsetParent:gn,getElementRects:na,getClientRects:Ql,getDimensions:ea,getScale:Re,isElement:me,isRTL:oa};function aa(e,n){let o=null,l;const a=be(e);function d(){var s;clearTimeout(l),(s=o)==null||s.disconnect(),o=null}function i(s,r){s===void 0&&(s=!1),r===void 0&&(r=1),d();const{left:c,top:u,width:p,height:f}=e.getBoundingClientRect();if(s||n(),!p||!f)return;const m=tt(u),h=tt(a.clientWidth-(c+p)),g=tt(a.clientHeight-(u+f)),b=tt(c),S={rootMargin:-m+"px "+-h+"px "+-g+"px "+-b+"px",threshold:re(0,ke(1,r))||1};let E=!0;function x(M){const A=M[0].intersectionRatio;if(A!==r){if(!E)return i();A?i(!1,A):l=setTimeout(()=>{i(!1,1e-7)},1e3)}E=!1}try{o=new IntersectionObserver(x,ie(Z({},S),{root:a.ownerDocument}))}catch(M){o=new IntersectionObserver(x,S)}o.observe(e)}return i(!0),d}function It(e,n,o,l){l===void 0&&(l={});const{ancestorScroll:a=!0,ancestorResize:d=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:r=!1}=l,c=$t(e),u=a||d?[...c?qe(c):[],...qe(n)]:[];u.forEach(k=>{a&&k.addEventListener("scroll",o,{passive:!0}),d&&k.addEventListener("resize",o)});const p=c&&s?aa(c,o):null;let f=-1,m=null;i&&(m=new ResizeObserver(k=>{let[S]=k;S&&S.target===c&&m&&(m.unobserve(n),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var E;(E=m)==null||E.observe(n)})),o()}),c&&!r&&m.observe(c),m.observe(n));let h,g=r?xe(e):null;r&&b();function b(){const k=xe(e);g&&(k.x!==g.x||k.y!==g.y||k.width!==g.width||k.height!==g.height)&&o(),g=k,h=requestAnimationFrame(b)}return o(),()=>{var k;u.forEach(S=>{a&&S.removeEventListener("scroll",o),d&&S.removeEventListener("resize",o)}),p==null||p(),(k=m)==null||k.disconnect(),m=null,r&&cancelAnimationFrame(h)}}const Vt=zl,sa=_l,Et=vl,bn=Kl,xt=Pl,ia=Ol,yn=(e,n,o)=>{const l=new Map,a=Z({platform:la},o),d=ie(Z({},a.platform),{_c:l});return Rl(e,n,ie(Z({},a),{platform:d}))};function ra(e){return e!=null&&typeof e=="object"&&"$el"in e}function Nt(e){if(ra(e)){const n=e.$el;return yt(n)&&Ee(n)==="#comment"?null:n}return e}function da(e){return{name:"arrow",options:e,fn(n){const o=Nt(t.unref(e.element));return o==null?{}:ia({element:o,padding:e.padding}).fn(n)}}}function Cn(e){return typeof window=="undefined"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function wn(e,n){const o=Cn(e);return Math.round(n*o)/o}function kn(e,n,o){o===void 0&&(o={});const l=o.whileElementsMounted,a=t.computed(()=>{var N;return(N=t.unref(o.open))!=null?N:!0}),d=t.computed(()=>t.unref(o.middleware)),i=t.computed(()=>{var N;return(N=t.unref(o.placement))!=null?N:"bottom"}),s=t.computed(()=>{var N;return(N=t.unref(o.strategy))!=null?N:"absolute"}),r=t.computed(()=>{var N;return(N=t.unref(o.transform))!=null?N:!0}),c=t.computed(()=>Nt(e.value)),u=t.computed(()=>Nt(n.value)),p=t.ref(0),f=t.ref(0),m=t.ref(s.value),h=t.ref(i.value),g=t.shallowRef({}),b=t.ref(!1),k=t.computed(()=>{const N={position:m.value,left:"0",top:"0"};if(!u.value)return N;const R=wn(u.value,p.value),y=wn(u.value,f.value);return r.value?Z(ie(Z({},N),{transform:"translate("+R+"px, "+y+"px)"}),Cn(u.value)>=1.5&&{willChange:"transform"}):{position:m.value,left:R+"px",top:y+"px"}});let S;function E(){c.value==null||u.value==null||yn(c.value,u.value,{middleware:d.value,placement:i.value,strategy:s.value}).then(N=>{p.value=N.x,f.value=N.y,m.value=N.strategy,h.value=N.placement,g.value=N.middlewareData,b.value=!0})}function x(){typeof S=="function"&&(S(),S=void 0)}function M(){if(x(),l===void 0){E();return}if(c.value!=null&&u.value!=null){S=l(c.value,u.value,E);return}}function A(){a.value||(b.value=!1)}return t.watch([d,i,s],E,{flush:"sync"}),t.watch([c,u],M,{flush:"sync"}),t.watch(a,A,{flush:"sync"}),t.getCurrentScope()&&t.onScopeDispose(x),{x:t.shallowReadonly(p),y:t.shallowReadonly(f),strategy:t.shallowReadonly(m),placement:t.shallowReadonly(h),middlewareData:t.shallowReadonly(g),isPositioned:t.shallowReadonly(b),floatingStyles:k,update:E}}function ca(e,n=Ke){let l=Array.from(e).reduce((d,i)=>d*31+i.charCodeAt(0)&4294967295,0);l=l>>>0;const a=l.toString(36);return"".concat(n,"-").concat(a)}const $n=new Map;class Bn{constructor(n,o){Ce(this,"referenceElement");Ce(this,"tooltipElement");Ce(this,"textContent");Ce(this,"placement");Ce(this,"autoUpdateCleanup");Ce(this,"referenceElementHandlers");Ce(this,"tooltipElementHandlers");Ce(this,"escapeHandler");Ce(this,"timeoutId");var d,i;const l=n.ownerDocument,a=this.generateTooltipId(o.textContent);this.referenceElement=n,this.textContent=o.textContent,this.placement=(d=o.placement)!=null?d:"bottom",this.timeoutId=null,this.tooltipElement=l.createElement("div"),this.tooltipElement.classList.add("cdx-tooltip"),this.tooltipElement.role="tooltip",this.tooltipElement.id=a,this.referenceElement.setAttribute("aria-describedby",a),this.tooltipElement.textContent=this.textContent,(i=this.referenceElement.parentElement)==null||i.appendChild(this.tooltipElement),this.referenceElementHandlers={},this.referenceElementHandlers.mouseenter=this.show.bind(this),this.referenceElementHandlers.mouseleave=this.hideAfterDelay.bind(this),this.referenceElementHandlers.focus=this.show.bind(this),this.referenceElementHandlers.blur=this.hide.bind(this),this.tooltipElementHandlers={},this.tooltipElementHandlers.mouseenter=this.show.bind(this),this.tooltipElementHandlers.mouseleave=this.hideAfterDelay.bind(this),this.escapeHandler=this.onKeyup.bind(this),this.addEventListeners(),this.autoUpdateCleanup=It(this.referenceElement,this.tooltipElement,()=>this.update())}generateTooltipId(n){var a;const o=n.trim(),l=(a=$n.get(o))!=null?a:0;return $n.set(o,l+1),ca(o+"-"+l,"cdx-tooltip")}isVisible(){return this.tooltipElement.style.display==="block"}show(){this.timeoutId&&clearTimeout(this.timeoutId),this.tooltipElement.style.display="block",this.tooltipElement.ownerDocument.addEventListener("keyup",this.escapeHandler)}hide(){this.tooltipElement.style.display="none",this.tooltipElement.ownerDocument.removeEventListener("keyup",this.escapeHandler)}hideAfterDelay(){this.timeoutId=setTimeout(this.hide.bind(this),250)}onKeyup(n){n.key==="Escape"&&this.isVisible()&&this.hide()}addEventListeners(){Object.keys(this.referenceElementHandlers).forEach(n=>{this.referenceElement.addEventListener(n,this.referenceElementHandlers[n])}),Object.keys(this.tooltipElementHandlers).forEach(n=>{this.tooltipElement.addEventListener(n,this.tooltipElementHandlers[n])})}removeEventListeners(){Object.keys(this.referenceElementHandlers).forEach(n=>{this.referenceElement.removeEventListener(n,this.referenceElementHandlers[n])}),Object.keys(this.tooltipElementHandlers).forEach(n=>{this.tooltipElement.removeEventListener(n,this.tooltipElementHandlers[n])})}update(){yn(this.referenceElement,this.tooltipElement,{placement:this.placement,middleware:[Vt(4),Et(),sa(),xt()]}).then(({x:n,y:o,middlewareData:l})=>{var d,i,s;const a=(i=(d=l.offset)==null?void 0:d.placement)!=null?i:this.placement;Object.assign(this.tooltipElement.style,{left:"".concat(n,"px"),top:"".concat(o,"px"),visibility:(s=l.hide)!=null&&s.referenceHidden?"hidden":"visible",transformOrigin:Gt[a]})})}updateWithOptions(n){var o;this.textContent=n.textContent,this.placement=(o=n.placement)!=null?o:this.placement,this.tooltipElement.textContent=this.textContent,this.update()}remove(){this.tooltipElement.remove(),this.autoUpdateCleanup(),this.removeEventListeners()}}const At={mounted(e,{value:n,arg:o}){n&&(typeof n=="string"&&n.trim()===""||(e.tooltip=new Bn(e,{textContent:String(n),placement:o})))},updated(e,{value:n,arg:o}){n!==null&&(e.tooltip?e.tooltip.updateWithOptions({textContent:String(n),placement:o}):e.tooltip=new Bn(e,{textContent:String(n),placement:o}))},beforeUnmount(e){e.tooltip&&e.tooltip.remove()}},ua=t.defineComponent({name:"CdxInputChip",components:{CdxButton:ce,CdxIcon:X},directives:{tooltip:At},props:{icon:{type:[String,Object],default:null},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},className:{type:String,default:""}},emits:["remove-chip","click-chip","arrow-left","arrow-right"],setup(e,{emit:n,slots:o}){const l=t.computed(()=>e.disabled?-1:0),a=t.ref(),d=t.computed(()=>({"cdx-input-chip--disabled":e.disabled,"cdx-input-chip--readonly":e.readonly,[e.className]:e.className.length>0})),i=J("cdx-input-chip-aria-description","Press Enter to edit or Delete to remove"),s=t.ref(),r=t.ref(!1),c=t.computed(()=>r.value&&s.value&&s.value.scrollWidth>s.value.clientWidth?De(o==null?void 0:o.default)[0]:null);t.onMounted(()=>{r.value=!0});function u(p){var f;switch(p.key){case"Enter":n("click-chip"),p.preventDefault(),p.stopPropagation();break;case"Escape":(f=a.value)==null||f.blur(),p.preventDefault(),p.stopPropagation();break;case"Backspace":case"Delete":n("remove-chip",p.key),p.preventDefault(),p.stopPropagation();break;case"ArrowLeft":n("arrow-left"),p.preventDefault(),p.stopPropagation();break;case"ArrowRight":n("arrow-right"),p.preventDefault(),p.stopPropagation();break}}return{rootElement:a,rootClasses:d,ariaDescription:i,onKeydown:u,cdxIconClose:Ge,tabIndex:l,tooltipContent:c,textElement:s}},methods:{focus(){this.$refs.rootElement.focus()}}}),pa=["tabindex","aria-description"],fa={ref:"textElement",class:"cdx-input-chip__text"};function ma(e,n,o,l,a,d){const i=t.resolveComponent("cdx-icon"),s=t.resolveComponent("cdx-button"),r=t.resolveDirective("tooltip");return t.withDirectives((t.openBlock(),t.createElementBlock("div",{ref:"rootElement",class:t.normalizeClass(["cdx-input-chip",e.rootClasses]),tabindex:e.tabIndex,role:"option","aria-description":e.ariaDescription,onKeydown:n[1]||(n[1]=(...c)=>e.onKeydown&&e.onKeydown(...c)),onClick:n[2]||(n[2]=c=>e.$emit("click-chip"))},[e.icon?(t.openBlock(),t.createBlock(i,{key:0,icon:e.icon