@trintel/zooy 1.6.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{register-Cdc1Dawc.js → register-CP6_mXMf.js} +1 -1
- package/dist/chunks/{register-BW7XFFn2.js → register-DkjYj3ib.js} +1 -1
- package/dist/chunks/zoo-CaW98OQn.js +393 -0
- package/dist/chunks/zoo-Cpc0eKfk.js +52 -0
- package/dist/zooy.cjs.js +2 -2
- package/dist/zooy.es.js +29 -33
- package/package.json +1 -1
- package/dist/chunks/zoo-B8_zFikt.js +0 -52
- package/dist/chunks/zoo-Cztpe9qH.js +0 -391
|
@@ -1 +1 @@
|
|
|
1
|
-
var St=Object.create;var K=Object.defineProperty;var At=Object.getOwnPropertyDescriptor;var Wt=Object.getOwnPropertyNames;var It=Object.getPrototypeOf,Pt=Object.prototype.hasOwnProperty;var kt=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Wt(e))!Pt.call(t,a)&&a!==n&&K(t,a,{get:()=>e[a],enumerable:!(s=At(e,a))||s.enumerable});return t};var l=(t,e,n)=>(n=t!=null?St(It(t)):{},kt(e||!t||!t.__esModule?K(n,"default",{value:t,enumerable:!0}):n,t));const m=require("./component-library-registry-BBQV6Kpv.js"),c=require("./zoo-B8_zFikt.js");let at=require("badu"),B=require("ramda");B=m.__toESM(B);let _t=require("@carbon/web-components/lib/components/data-table/defs.js");var Ct=m.__exportAll({cdsTableWrap:()=>Dt}),Q=(t,e,n)=>{const s=customElements.get("cds-table"),a=customElements.get("cds-pagination"),o=customElements.get(s.selectorTableBatchActions);customElements.get("cds-popover");const r=e.dataBinder,d=e.pagination,u=e.skeleton,A=e.querySelector(s.selectorTableToolbarSearch),W=e.querySelector(s.selectorTableBatchActions),x=e.querySelector(s.selectorTableBody),O=["button","a","input","select","textarea",'[role="button"]',".cds--table-expand",".cds--table-column-checkbox"].join(","),V=e.querySelectorAll(s.selectorHeaderCell+"[is-sortable]"),ot=e.isSortable||V.length>0,z=Symbol(),F=Symbol(),w=new Map,rt=i=>{t.listen(e,"click",p=>{const v=p.target.closest(s.selectorTableRow);if(!v||p.composedPath().some(f=>f.matches&&f.matches(O)))return;p.stopPropagation();const g=c.getSemanticAttributes(v);t.dispatchPanelEvent(i,{...g})})},ct=i=>{t.listen(e,s.eventExpandoToggle,p=>{const v=p.target,g=v.tagName==="CDS-TABLE-HEADER-ROW",f=p.detail.expanded,E={tableAttrs:n,...c.getSemanticAttributes(v),target:v,allRows:g,didExpand:f};t.dispatchPanelEvent(i,E)})},it=i=>{w.set(z,p=>{t.dispatchPanelEvent(i,p)})},lt=i=>{w.set(F,p=>{const v=p.detail.selectedRows,g=Math.min(v.length,W.totalRowsCount),f=p.target,E=c.getSemanticAttributes(f),I=v.map(c.getSemanticAttributes),_={tableAttrs:n,...E,target:f,selectCount:g,selection:I};t.dispatchPanelEvent(i,_)})},dt=i=>{t.listen(e,s.eventTableRowSelect,p=>{const v=p.target,g=p.detail.selectedRows||[],f=g.length,E=g.map(c.getSemanticAttributes),I={tableAttrs:n,...c.getSemanticAttributes(v),selectCount:f,selection:E,target:v};t.dispatchPanelEvent(i,I)})},pt=()=>{t.listen(e,s.eventBeforeSort,i=>{const p=i.target,v=i.detail.oldSortDirection,g=i.detail.sortDirection,f=c.getSemanticAttributes(p),E=f.sortField,I=g===_t.TABLE_SORT_DIRECTION.DESCENDING?`-${E}`:E;i.cancelBubble=!0,i.stopPropagation(),i.preventDefault(),x.innerHTML="",u&&u.show(),V.forEach((C,b)=>{C===p?(C.setAttribute("sort-active","true"),C.setAttribute("sort-direction",g)):(C.removeAttribute("sort-active"),C.setAttribute("sort-direction","none"))});const _={ordering:I};r.fetchData(_).then(()=>{d.setData(r),u&&u.hide()}),w.has(z)&&w.get(z)({tableAttrs:n,...f,sortNow:g,sortWas:v,sortField:E,ordering:I,target:p})})},ut=()=>{t.listen(e,s.eventTableRowSelectAll,i=>{i.detail.selectedRows.length===0&&e.querySelectorAll(s.selectorTableRow).forEach(p=>{p.disabled=!1,p.selected=!1}),w.has(F)&&w.get(F)(i)})},vt=()=>{t.listen(e,s.eventBeforeChangeSelectionAll,i=>{i.stopPropagation(),i.detail.callback&&i.detail.callback()})},mt=i=>{const p=e.querySelector("cds-table-header-row");t.listen(i,o.eventClickSelectAll,v=>{v.stopPropagation(),p.dispatchEvent(new CustomEvent(s.eventBeforeChangeSelectionAll,{bubbles:!0,cancelable:!0,composed:!0,detail:{selected:!0,callback:()=>{i.selectedRowsCount=i.totalRowsCount,e.querySelectorAll(s.selectorTableRow).forEach(g=>{g.disabled=!0})}}}))})},gt=i=>{t.listen(i,"keydown",p=>{if(p.key==="Enter"){u&&u.show(),d.totalItems=0,e.querySelector("cds-table-body").replaceChildren();const v={search:i.value||"",offset:0};r.fetchData(v).then(()=>{d.setData(r),u&&u.hide()})}})},ht=i=>{t.listen(i,s.eventSearchInput,p=>{if((p.detail.value||"")===""){const v={search:"",offset:0};u&&u.show(),r.fetchData(v).then(()=>{u&&u.hide(),d.setData(r)})}})},ft=i=>{i.caret=!1;const p=i.querySelector("cds-icon-button, button:not([slot])"),v=i.querySelectorAll("cds-checkbox"),g=i.querySelectorAll("cds-modal-footer-button"),f=[...i.querySelectorAll("cds-checkbox-group")].map(c.getSemanticAttributes).map(B.pathOr("noop",["zoo","filter","field"])).reduce((b,S)=>(b[S]=null,b),{offset:0});if(!p||!g){console.error("Improperly configured Batch Filter popover");return}new MutationObserver(()=>{i.classList.toggle("cds--overflow-menu--open",i.open)}).observe(i,{attributes:!0,attributeFilter:["open"]});const E=Symbol(),I=Symbol(),_=[...g].reduce((b,S,y)=>(S.hasAttribute("reset-filter")&&b.set(E,S),S.hasAttribute("apply-filter")&&b.set(I,S),b),new Map),C=()=>{const b=new Map;return v.forEach(S=>{const y=S.getAttribute("id");if(!y||!y.includes(":"))return;const[N,M]=y.split(":");b.has(N)||b.set(N,[]),S.checked&&b.get(N).push(M)}),b};if(_.has(E)){const b=S=>S.checked=!1;t.listen(_.get(E),"click",S=>{S.stopPropagation(),v.forEach(b),u&&u.show(),r.fetchData(f).then(()=>{d&&d.setData(r),u&&u.hide(),i.open=!1})})}_.has(I)&&t.listen(_.get(I),"click",b=>{b.stopPropagation();const S=[...C()].reduce((y,[N,M])=>(y[N]=Array.isArray(M)&&M.length===0?null:M,y),{offset:0});u&&u.show(),r.fetchData(S).then(()=>{d&&d.setData(r),u&&u.hide(),i.open=!1})}),t.listen(p,"click",b=>{b.stopPropagation(),i.open=!i.open,i.classList.toggle("cds--overflow-menu--open",i.open)})},bt=()=>{t.listen(d,a.eventPageSizeChanged,i=>{const p={limit:d.pageSize,offset:0};r.fetchData(p).then(()=>{d.setData(r)})})},Et=()=>{let i=null;t.listen(d,a.eventChangeCurrent,p=>{const{page:v}=p.detail,g=d.pageSize,f=(v-1)*g;if(f!==i){i=f;const E={limit:g,offset:f};r.fetchData(E).then(()=>{d.setData(r),u&&u.hide()})}})};r&&d&&(bt(),Et()),r&&A&&(gt(A),ht(A));const Z=e.querySelector(s.selectorTableToolbarContent);if(Z){const i=Z.querySelectorAll("cds-popover[data-batch-filter]");r&&i&&i.forEach(ft)}e.isSelectable&&(ut(),vt(),W&&mt(W)),r&&ot&&pt();const J={zoo:{event:{row:{click:rt,expand:ct,check:{one:dt,all:lt}},column:{sort:it}}}};(0,at.objToPaths)(n).forEach(([i,p])=>{B.hasPath(i,J)&&B.path(i,J)(p)})},yt=t=>{const e=document.createElement("cds-pagination");return e.backwardText="Previous page",e.forwardText="Next page",e.itemsPerPageText="Items per page:",e.pageSize=t.limit,e.size="lg",[10,25,50,100,500].forEach(n=>{const s=document.createElement("cds-select-item");s.value=n.toString(),s.textContent=n.toString(),e.appendChild(s)}),e.setData=n=>{if(n.isPaginated){const{count:s}=B.pick(["count"],n.data);e.pagesUnknown=Math.ceil(s/n.limit)>100,e.totalItems=s,e.pagesUnknown?e.formatStatusWithIndeterminateTotal=({start:a,end:o})=>`${a}–${o} of ${s} item${s<=1?"":"s"}`:delete e.formatStatusWithIndeterminateTotal}},e},xt=t=>{if(!t.parentNode){console.error("[Carbon Table] Cannot create skeleton: table has no parent node");return}const e=!!t.querySelector("cds-table-header-title"),n=!!t.querySelector("cds-table-header-description"),s=!!t.querySelector("cds-table-toolbar"),a=[...t.querySelectorAll("cds-table-header-cell")].length,o=t.hasAttribute("zebra"),r=t.getAttribute("size"),d=document.createElement("cds-table-skeleton");d.showHeader=e||n,d.showToolbar=s,d.zebra=o,d.columnCount=a,d.size=r,d.show=()=>d.classList.remove("hidden"),d.hide=()=>d.classList.add("hidden");const u=document.createElement("div");return u.classList.add("zoo-datatable-skeleton-wrapper"),t.parentNode.insertBefore(u,t),u.appendChild(d),u.appendChild(t),d},wt=(t,e)=>{const n=e.getAttribute("zoo-url-api"),s=parseInt(e.getAttribute("data-page-size")||25,10);if(n)return new c.Binder(t,n,e,{urlParams:{limit:s}})},Dt={selector:"cds-table",init:function(t){const e=c.getSemanticAttributes(t),n=this,s=wt(n,t);if((0,at.isDefAndNotNull)(s)){t.dataBinder=s;const a=xt(t);t.skeleton=a;const o=yt(s);t.pagination=o,t.after(o),s.fetchData().then(r=>{a.hide(),o.setData(s),Q(n,t,e)})}else Q(n,t,e)}},Bt=m.__exportAll({cdsPaginationWrap:()=>Nt}),Nt={selector:"cds-pagination",init:function(t){const e=this,n=customElements.get("cds-pagination");let s=null;e.listen(t,n.eventChangeCurrent,a=>{const o=a.detail.page,r=t.pageSize,d=(o-1)*r;d!==s&&(s=d,e.dispatchPanelEvent("pagination-changed-current",{detail:{page:o,pageSize:r,action:"page-change"}}))}),e.listen(t,n.eventPageSizeChanged,a=>{const o=t.pageSize;s=null,e.dispatchPanelEvent("pagination-changed-page-size",{detail:{page:1,pageSize:o,action:"page-size-change"}})})}},Mt=m.__exportAll({cdsModalBodyContentWrap:()=>Lt,cdsModalBodyWrap:()=>Rt,cdsModalCloseButWrap:()=>Ft,cdsModalFooterButWrap:()=>Ut,cdsModalFooterWrap:()=>Ht,cdsModalHeaderWrap:()=>qt,cdsModalHeadingWrap:()=>Ot,cdsModalLabelWrap:()=>zt,cdsModalWrap:()=>Tt}),Tt={selector:"cds-modal",init:function(t){const e=customElements.get("cds-modal"),n=c.getSemanticAttributes(t),s=c.getEventAttribute(t,"open-event","event");s&&this.listen(t,"cds-modal-beingopened",r=>{this.dispatchPanelEvent(s,{...n,action:"opened"})});const a=t.getAttribute("before-close-event");a&&this.listen(t,e.eventBeforeClose,r=>{this.dispatchPanelEvent(a,{...n,action:"closing",cancelable:!0})}),this.listen(t,e.eventClose,r=>{this.dispatchPanelEvent("destroy_me",{...n,action:"closed",triggeredBy:r.detail?.triggeredBy})});const o=c.getEventAttribute(t,"primary-event","event");o&&this.listen(t,"cds-modal-primary-focus",r=>{this.dispatchPanelEvent(o,{...n,action:"primary"})})}},qt={selector:"cds-modal-header"},Ot={selector:"cds-modal-heading"},zt={selector:"cds-modal-label"},Ft={selector:"cds-modal-close-button"},Rt={selector:"cds-modal-body"},Lt={selector:"cds-modal-body-content"},Ht={selector:"cds-modal-footer"},Ut={selector:"cds-modal-footer-button",init:function(t){const e=c.getSemanticAttributes(t);if(t.getAttribute("type")==="submit"){this.listen(t,"click",s=>{let a=t.closest("form");if(!a){const o=t.getAttribute("form");o&&(a=document.getElementById(o))}a&&a.requestSubmit()});return}const n=e.event;n&&this.listen(t,"click",s=>{s.stopPropagation(),this.dispatchPanelEvent(n,e)})}},jt=m.__exportAll({cdsMenuButtonWrap:()=>$t,cdsMenuWrap:()=>Gt}),Gt={selector:"cds-menu",init:function(t){const e=c.getSemanticAttributes(t),n=c.getEventAttribute(t,"open-event");n&&this.listen(t,"cds-menu-opened",a=>{this.dispatchPanelEvent(n,{...e,action:"opened"})});const s=c.getEventAttribute(t,"close-event");s&&this.listen(t,"cds-menu-closed",a=>{this.dispatchPanelEvent(s,{...e,action:"closed"})}),this.listen(t,"click",a=>{if(a.target.tagName==="CDS-MENU-ITEM"){const o=c.getSemanticAttributes(a.target),r=o.event||e.event;r&&(a.stopPropagation(),this.dispatchPanelEvent(r,{...e,...o}))}}),this.listen(t,"cds-item-changed",a=>{const o=a.detail.triggeredBy,r=c.getSemanticAttributes(o),d=r.event||e.event;d&&this.dispatchPanelEvent(d,{...e,...r,action:"selection-changed"})})}},$t={selector:"cds-menu-button",init:function(t){const e=c.getSemanticAttributes(t),n=t.querySelector("cds-menu");n&&this.listen(n,"click",s=>{if(s.target.tagName==="CDS-MENU-ITEM"){const a=c.getSemanticAttributes(s.target),o=a.event||e.event;o&&(s.stopPropagation(),this.dispatchPanelEvent(o,{...e,...a}))}})}},Vt=m.__exportAll({cdsButFabWrap:()=>Qt,cdsButtonWrap:()=>Zt,cdsComboButWrap:()=>Yt,cdsCopyButWrap:()=>Xt,cdsIconButToggleWrap:()=>Kt,cdsIconButWrap:()=>Jt}),Zt={selector:"cds-button",init:function(t){const e=c.getSemanticAttributes(t);if(t.getAttribute("type")==="submit"){this.listen(t,"click",s=>{let a=t.closest("form");if(!a){const o=t.getAttribute("form");o&&(a=document.getElementById(o))}a&&a.requestSubmit()});return}const n=e.event;n&&this.listen(t,"click",s=>{s.stopPropagation(),this.dispatchPanelEvent(n,c.getSemanticAttributes(t))})}},Jt={selector:"cds-icon-button:not([data-toggle])",event:"click",getData:(t,e)=>e},Kt={selector:"cds-icon-button[data-toggle]",init:function(t){const e=c.getSemanticAttributes(t);e.event&&this.listen(t,"click",n=>{n.stopPropagation(),t.isSelected=!t.isSelected,this.dispatchPanelEvent(e.event,{...e,isOn:t.isSelected})})}},Qt={selector:"cds-button[data-fab]",event:"click",getData:(t,e)=>e},Xt={selector:"cds-copy-button",init:function(t){const e=c.getSemanticAttributes(t),n=e.event;n&&this.listen(t,"click",a=>{a.stopPropagation(),this.dispatchPanelEvent(n,{...e,action:"copy"})});const s=t.getAttribute("success-event");if(s){const a=new MutationObserver(()=>{t.hasAttribute("feedback-shown")&&this.dispatchPanelEvent(s,{...e,action:"copied"})});a.observe(t,{attributes:!0,attributeFilter:["feedback-shown"]}),t._copyObserver=a}}},Yt={selector:"cds-combo-button",init:function(t){const e=c.getSemanticAttributes(t);e.event&&this.listen(t,"click",s=>{const a=s.composedPath(),o=a.some(d=>d.tagName==="CDS-MENU-ITEM"),r=a.some(d=>d.tagName==="CDS-ICON-BUTTON");!o&&!r&&(s.stopPropagation(),this.dispatchPanelEvent(e.event,{...e,action:"primary"}))});const n=t.querySelector("cds-menu");n&&this.listen(n,"click",s=>{if(s.target.tagName==="CDS-MENU-ITEM"){const a=c.getSemanticAttributes(s.target),o=a.event||c.getEventAttribute(t,"menu-event","event");o&&this.dispatchPanelEvent(o,{...e,...a,action:"menu-item"})}})}},te=m.__exportAll({cdsComboBoxWrap:()=>se,cdsDropdownWrap:()=>ee,cdsMultiSelectWrap:()=>ne}),ee={selector:"cds-dropdown",init:function(t){const e=customElements.get("cds-dropdown"),n=c.getSemanticAttributes(t),s=n.event;s&&this.listen(t,e.eventSelect,o=>{this.dispatchPanelEvent(s,{...n,value:t.value,selectedValue:o.detail?.item?.value,selectedText:o.detail?.item?.textContent?.trim()})});const a=t.getAttribute("toggle-event");a&&this.listen(t,e.eventToggle,o=>{this.dispatchPanelEvent(a,{...n,open:t.hasAttribute("open")})})}},se={selector:"cds-combo-box",init:function(t){const e=customElements.get("cds-combo-box"),n=c.getSemanticAttributes(t),s=n.event;s&&this.listen(t,e.eventSelect,o=>{const r=o.detail?.item;this.dispatchPanelEvent(s,{...n,value:t.value,selectedValue:r?.value,selectedText:r?.textContent?.trim()})});const a=t.getAttribute("toggle-event");a&&this.listen(t,e.eventToggle,o=>{this.dispatchPanelEvent(a,{...n,open:t.hasAttribute("open")})})}},ne={selector:"cds-multi-select",init:function(t){const e=customElements.get("cds-multi-select"),n=c.getSemanticAttributes(t),s=n.event;s&&this.listen(t,e.eventSelect,o=>{const r=t.value?t.value.split(","):[];this.dispatchPanelEvent(s,{...n,selectedItems:r})});const a=t.getAttribute("toggle-event");a&&this.listen(t,e.eventToggle,o=>{this.dispatchPanelEvent(a,{...n,open:t.hasAttribute("open")})})}},ae=m.__exportAll({cdsDatePickerWrap:()=>oe,cdsTimePickerWrap:()=>re}),oe={selector:"cds-date-picker",init:function(t){const e=customElements.get("cds-date-picker"),n=c.getSemanticAttributes(t),s=t.querySelector('cds-date-picker-input[kind="from"]'),a=t.querySelector('cds-date-picker-input[kind="to"]'),o=s&&a,r=n.event;r&&this.listen(t,e.eventChange,u=>{let A;o?A={from:s.value||"",to:a.value||""}:A=t.value,this.dispatchPanelEvent(r,{...n,value:A})});const d=t.getAttribute("error-event");d&&this.listen(t,e.eventFlatpickrError,u=>{this.dispatchPanelEvent(d,{...n,error:u.detail})})}},re={selector:"cds-time-picker",event:"cds-time-picker-changed",getData:(t,e,n)=>({...e,value:n.value})},ce=m.__exportAll({cdsFileUploaderWrap:()=>ie}),ie={selector:"cds-file-uploader",init:function(t){const e=c.getSemanticAttributes(t),n=e.event;if(n){const a=t.querySelector('input[type="file"]');a&&this.listen(a,"change",o=>{this.dispatchPanelEvent(n,{...e,files:Array.from(o.target.files||[])})})}const s=t.getAttribute("delete-event");s&&this.listen(t,"cds-file-uploader-item-deleted",a=>{this.dispatchPanelEvent(s,{...e,fileName:a.detail?.fileName,fileId:a.detail?.fileId})})}},le=m.__exportAll({cdsAccordionWrap:()=>pe,cdsContentSwitcherWrap:()=>ue,cdsTabsWrap:()=>de}),de={selector:"cds-tabs",init:function(t){const e=customElements.get("cds-tabs"),n=c.getSemanticAttributes(t),s=t.getAttribute("before-select-event");s&&this.listen(t,e.eventBeforeSelect,o=>{this.dispatchPanelEvent(s,{...n,tabValue:o.detail.value,cancelable:!0})});const a=n.event;a&&this.listen(t,e.eventSelect,o=>{const r=o.detail.item,d=c.getSemanticAttributes(r);this.dispatchPanelEvent(a,{...n,...d,tabValue:o.detail.value})})}},pe={selector:"cds-accordion",init:function(t){const e=customElements.get("cds-accordion-item"),n=c.getSemanticAttributes(t);[...t.querySelectorAll("cds-accordion-item")].forEach(s=>{const a=c.getSemanticAttributes(s),o=a.event||n.event;o&&this.listen(s,e.eventToggle,r=>{this.dispatchPanelEvent(o,{...n,...a,open:r.detail.open})})})}},ue={selector:"cds-content-switcher",init:function(t){const e=customElements.get("cds-content-switcher"),n=c.getSemanticAttributes(t),s=t.getAttribute("before-select-event");s&&this.listen(t,e.eventBeforeSelect,o=>{this.dispatchPanelEvent(s,{...n,value:o.detail.value,cancelable:!0})});const a=n.event;a&&this.listen(t,e.eventSelect,o=>{const r=o.detail.item,d=c.getSemanticAttributes(r);this.dispatchPanelEvent(a,{...n,...d,value:r.getAttribute("value")})})}},ve=m.__exportAll({cdsBreadCrumbWrap:()=>he,cdsBreadcrumbItemWrap:()=>me,cdsBreadcrumbLinkWrap:()=>ge}),me={selector:"cds-breadcrumb-item"},ge={selector:"cds-breadcrumb-link",event:"click",getData:(t,e,n)=>(t.preventDefault(),{...e,href:n.getAttribute("href")})},he={selector:"cds-breadcrumb",init:function(t){const e=this,n=c.getSemanticAttributes(t),s=n.event;if(s){const a=r=>{e.dispatchPanelEvent(s,{...n,...r})};e.listen(t,"click",r=>{const d=r.target.closest("cds-breadcrumb-link");d&&(r.preventDefault(),r.stopPropagation(),a(c.getSemanticAttributes(d)))});const o=t.querySelector("cds-overflow-menu-body");o&&e.listen(o,"cds-overflow-menu-item-clicked",r=>{r.stopPropagation(),a(c.getSemanticAttributes(r.target))})}}},fe=m.__exportAll({cdsNumberInputWrap:()=>Se,cdsPasswordInputWrap:()=>Ae,cdsSearchWrap:()=>We,cdsTextAreaWrap:()=>Ee,cdsTextInputWrap:()=>be}),be={selector:"cds-text-input",multiEvent:!0,events:[{type:"input",attrName:"event",getData:(t,e)=>({...e,value:t.currentTarget.value})},{type:"change",attrName:"change-event",getData:(t,e)=>({...e,value:t.currentTarget.value})}]},Ee={selector:"cds-textarea",multiEvent:!0,events:[{type:"input",attrName:"event",getData:(t,e)=>({...e,value:t.currentTarget.value})},{type:"change",attrName:"change-event",getData:(t,e)=>({...e,value:t.currentTarget.value})}]},Se={selector:"cds-number-input",event:"cds-number-input",getData:(t,e,n)=>({...e,value:t.detail.value,direction:t.detail.direction})},Ae={selector:"cds-password-input",multiEvent:!0,events:[{type:"input",attrName:"event",getData:(t,e)=>({...e,value:t.currentTarget.value})},{type:"change",attrName:"change-event",getData:(t,e)=>({...e,value:t.currentTarget.value})}]},We={selector:"cds-search",event:"cds-search-input",getData:(t,e,n)=>({...e,value:n.value})},Ie=m.__exportAll({cdsCheckboxWrap:()=>Pe,cdsRadioButGroupWrap:()=>ke,cdsSelectWrap:()=>Ce,cdsSliderWrap:()=>ye,cdsToggleWrap:()=>_e}),Pe={selector:"cds-checkbox",event:"cds-checkbox-changed",getData:(t,e,n)=>({...e,checked:t.detail.checked,value:n.value})},ke={selector:"cds-radio-button-group",event:"cds-radio-button-group-changed",getData:(t,e)=>({...e,value:t.detail?.value})},_e={selector:"cds-toggle",event:"cds-toggle-changed",getData:(t,e)=>({...e,isOn:t.detail.checked,value:t.detail.checked})},Ce={selector:"cds-select",event:"cds-select-selected",getData:(t,e)=>({...e,value:t.detail.value})},ye={selector:"cds-slider",init:function(t){const e=c.getSemanticAttributes(t),n=e.event;n&&this.listen(t,"cds-slider-changed",a=>{this.dispatchPanelEvent(n,{...e,value:a.detail.value})});const s=t.getAttribute("input-event");s&&this.listen(t,"cds-slider-input-changed",a=>{this.dispatchPanelEvent(s,{...e,value:a.detail.value})})}},xe=m.__exportAll({cdsFilterTagWrap:()=>Be,cdsSDismissibleTagWrap:()=>De,cdsTagsWrap:()=>we}),we={selector:"cds-tag",event:"click",getData:(t,e)=>e},De={selector:"cds-dismissible-tag",init:function(t){const e=c.getSemanticAttributes(t),n=t.getAttribute("click-event");n&&this.listen(t,"click",a=>{a.target.closest("button")||this.dispatchPanelEvent(n,{...e})});const s=e.event;s&&this.listen(t,"cds-dismissible-tag-closed",a=>{this.dispatchPanelEvent(s,{...e,action:"closed"})})}},Be={selector:"cds-filter-tag",event:"cds-filter-tag-closed",getData:(t,e)=>({...e,action:"remove"})},Ne=m.__exportAll({cdsContainedListDescriptionWrap:()=>Oe,cdsContainedListItemWrap:()=>ze,cdsContainedListWrap:()=>qe,cdsOverflowMenuWrap:()=>Me,cdsStructuredListWrap:()=>Te,cdsTreeViewWrap:()=>Fe}),Me={selector:"cds-overflow-menu",init:function(t){const e=c.getSemanticAttributes(t),n=e.event,s=t.querySelector("cds-overflow-menu-body");n&&s&&this.listen(s,"cds-overflow-menu-item-clicked",a=>{a.stopPropagation();const o=c.getSemanticAttributes(a.target);this.dispatchPanelEvent(n,{...e,...o})})}},Te={selector:"cds-structured-list",init:function(t){const e=c.getSemanticAttributes(t);[...t.querySelectorAll("cds-structured-list-row")].forEach(n=>{const s=c.getSemanticAttributes(n),a=s.event||e.event;a&&this.listen(n,"click",o=>{o.stopPropagation(),this.dispatchPanelEvent(a,{...e,...s})})}),t.hasAttribute("selection")&&this.listen(t,"cds-structured-list-selected",n=>{const s=n.detail.row,a=c.getSemanticAttributes(s),o=e.event;o&&this.dispatchPanelEvent(o,{...e,...a})})}},qe={selector:"cds-contained-list"},Oe={selector:"cds-contained-list-description"},ze={selector:"cds-contained-list-item",event:"cds-contained-list-item-click",getData:(t,e)=>e},Fe={selector:"cds-tree-view",init:function(t){const e=c.getSemanticAttributes(t);this.listen(t,"cds-tree-node-selected",s=>{const a=s.detail.node,o=c.getSemanticAttributes(a),r=o.event||e.event;r&&this.dispatchPanelEvent(r,{...e,...o,nodeId:a.id,label:a.getAttribute("label")})});const n=c.getEventAttribute(t,"expand-event");n&&this.listen(t,"cds-tree-node-expanded",s=>{this.dispatchPanelEvent(n,{...e,nodeId:s.detail.node.id,expanded:s.detail.expanded})})}},Re=m.__exportAll({cdsActionableNotificationWrap:()=>Ue,cdsInlineNotificationWrap:()=>He,cdsToastNotificationWrap:()=>Le}),Le={selector:"cds-toast-notification",event:"cds-notification-closed",getData:(t,e)=>({...e,action:"closed"})},He={selector:"cds-inline-notification",event:"cds-notification-closed",getData:(t,e)=>({...e,action:"closed"})},Ue={selector:"cds-actionable-notification",init:function(t){const e=c.getSemanticAttributes(t),n=c.getEventAttribute(t,"close-event","event");n&&this.listen(t,"cds-notification-closed",a=>{this.dispatchPanelEvent(n,{...e,action:"closed"})});const s=c.getEventAttribute(t,"action-event");s&&this.listen(t,"cds-notification-actioned",a=>{this.dispatchPanelEvent(s,{...e,action:"actioned"})})}},je=m.__exportAll({cdsClickableTileWrap:()=>$e,cdsExpandableTileWrap:()=>Ve,cdsRadioTileWrap:()=>Je,cdsSelectableTileWrap:()=>Ze,cdsTileGroupWrap:()=>Ke,cdsTileWrap:()=>Ge}),Ge={selector:"cds-tile"},$e={selector:"cds-clickable-tile",init:function(t){const e=c.getSemanticAttributes(t),n=e.event;if(n){const s=e.href||t.getAttribute("href")||"";t.removeAttribute("href"),t.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),this.dispatchPanelEvent(n,{...e,href:s})},!0)}}},Ve={selector:"cds-expandable-tile",init:function(t){const e=c.getSemanticAttributes(t),n=t.getAttribute("before-toggle-event");n&&this.listen(t,"cds-expandable-tile-beingtoggled",a=>{this.dispatchPanelEvent(n,{...e,expanded:a.detail.expanded,cancelable:!0})});const s=e.event;s&&this.listen(t,"cds-expandable-tile-toggled",a=>{this.dispatchPanelEvent(s,{...e,expanded:a.detail.expanded})})}},Ze={selector:"cds-selectable-tile",event:"cds-selectable-tile-changed",getData:(t,e,n)=>({...e,selected:t.detail.selected,value:n.value})},Je={selector:"cds-radio-tile",event:"cds-radio-tile-selected",getData:(t,e,n)=>({...e,selected:t.detail.selected,name:t.detail.name,value:n.value})},Ke={selector:"cds-tile-group",init:function(t){const e=c.getSemanticAttributes(t),n=e.event;n&&(this.listen(t,"cds-current-radio-tile-selection",s=>{const a=s.detail.target;this.dispatchPanelEvent(n,{...e,value:a?.value,name:a?.name,selected:a?.selected})}),this.listen(t,"cds-current-selectable-tile-selections",s=>{const a=s.detail.currentSelections||[];this.dispatchPanelEvent(n,{...e,values:a.map(o=>o.value),names:a.map(o=>o.name),count:a.length})}))}},Qe=m.__exportAll({cdsInlineLoadingWrap:()=>ts,cdsProgressBarWrap:()=>Xe,cdsProgressIndicatorWrap:()=>Ye}),Xe={selector:"cds-progress-bar",init:function(t){const e=c.getSemanticAttributes(t);if(e.event){const n=new MutationObserver(()=>{const s=parseFloat(t.getAttribute("value")||"0");s>=parseFloat(t.getAttribute("max")||"100")&&this.dispatchPanelEvent(e.event,{...e,value:s,status:"complete"})});n.observe(t,{attributes:!0,attributeFilter:["value"]}),t._progressObserver=n}}},Ye={selector:"cds-progress-indicator",init:function(t){const e=c.getSemanticAttributes(t);this.listen(t,"cds-progress-step-click",n=>{const s=n.target,a=c.getSemanticAttributes(s),o=a.event||e.event;o&&this.dispatchPanelEvent(o,{...e,...a,stepIndex:s.getAttribute("data-index"),stepLabel:s.getAttribute("label")})})}},ts={selector:"cds-inline-loading",init:function(t){const e=c.getSemanticAttributes(t),n=e.event;n&&this.listen(t,"cds-inline-loading-onsuccess",a=>{this.dispatchPanelEvent(n,{...e,status:"finished"})});const s=t.getAttribute("status-event");if(s){const a=new MutationObserver(o=>{o.forEach(r=>{if(r.attributeName==="status"){const d=t.getAttribute("status");this.dispatchPanelEvent(s,{...e,status:d})}})});a.observe(t,{attributes:!0,attributeFilter:["status"]}),t._statusObserver=a}}},es=m.__exportAll({cdsPopoverWrap:()=>ns,cdsToggletipWrap:()=>as,cdsTooltipWrap:()=>ss}),ss={selector:"cds-tooltip",init:function(t){const e=c.getSemanticAttributes(t),n=c.getEventAttribute(t,"open-event");n&&this.listen(t,"cds-tooltip-beingopened",a=>{this.dispatchPanelEvent(n,{...e,action:"opened"})});const s=c.getEventAttribute(t,"close-event");s&&this.listen(t,"cds-tooltip-closed",a=>{this.dispatchPanelEvent(s,{...e,action:"closed"})})}},ns={selector:"cds-popover",init:function(t){const e=c.getSemanticAttributes(t),n=c.getEventAttribute(t,"open-event");n&&this.listen(t,"cds-popover-beingopened",a=>{this.dispatchPanelEvent(n,{...e,action:"opened"})});const s=c.getEventAttribute(t,"close-event");s&&this.listen(t,"cds-popover-closed",a=>{this.dispatchPanelEvent(s,{...e,action:"closed"})})}},as={selector:"cds-toggletip",init:function(t){const e=c.getSemanticAttributes(t);if(e.event){const n=new MutationObserver(s=>{s.forEach(a=>{if(a.attributeName==="open"){const o=t.hasAttribute("open");this.dispatchPanelEvent(e.event,{...e,action:o?"opened":"closed",open:o})}})});n.observe(t,{attributes:!0,attributeFilter:["open"]}),t._toggletipObserver=n}}},os=m.__exportAll({cdsCodeSnipWrap:()=>cs,cdsLinkWrap:()=>rs}),rs={selector:"cds-link",event:"click",getData:(t,e,n)=>({...e,href:n.getAttribute("href")})},cs={selector:"cds-code-snippet",event:"cds-copy-button-clicked",getData:(t,e)=>({...e,action:"copied"})},is=m.__exportAll({cdsBadgeIndicatorWrap:()=>fs,cdsFormGroupWrap:()=>ps,cdsFormItemWrap:()=>ds,cdsFormWrap:()=>ls,cdsHeadingWrap:()=>vs,cdsIconIndicatorWrap:()=>hs,cdsIconWrap:()=>gs,cdsLoadingWrap:()=>bs,cdsSectionWrap:()=>ms,cdsSkeletonPlaceholderWrap:()=>Ss,cdsSkeletonTextWrap:()=>Es,cdsStackWrap:()=>us}),ls={selector:"cds-form"},ds={selector:"cds-form-item"},ps={selector:"cds-form-group"},us={selector:"cds-stack"},vs={selector:"cds-heading"},ms={selector:"cds-section"},gs={selector:"cds-icon"},hs={selector:"cds-icon-indicator"},fs={selector:"cds-badge-indicator"},bs={selector:"cds-loading"},Es={selector:"cds-skeleton-text"},Ss={selector:"cds-skeleton-placeholder"};function h(t){return Object.values(t).filter(e=>typeof e=="object"&&e!==null&&e.selector)}var As=[...h(Bt),...h(Ct),...h(Mt),...h(jt),...h(Vt),...h(te),...h(ae),...h(ce),...h(le),...h(ve),...h(fe),...h(Ie),...h(xe),...h(Ne),...h(Re),...h(je),...h(Qe),...h(es),...h(os),...h(is)];function Ws(){const t=new Map;return As.forEach(e=>{t.set(e.selector,e)}),t}var Is=()=>import("@carbon/web-components/es/components/accordion/index.js"),R=()=>import("@carbon/web-components/es/components/breadcrumb/index.js"),Ps=()=>import("@carbon/web-components/es/components/stack/index.js"),ks=()=>import("@carbon/web-components/es/components/structured-list/index.js"),L=()=>import("@carbon/web-components/es/components/contained-list/index.js"),D=()=>import("@carbon/web-components/es/components/tile/index.js"),_s=()=>import("@carbon/web-components/es/components/tree-view/index.js"),Cs=()=>import("@carbon/web-components/es/components/link/index.js"),ys=()=>import("@carbon/web-components/es/components/tabs/index.js"),xs=()=>import("@carbon/web-components/es/components/content-switcher/index.js"),X=()=>import("@carbon/web-components/es/components/menu/index.js"),ws=()=>import("@carbon/web-components/es/components/overflow-menu/index.js"),H=()=>import("@carbon/web-components/es/components/button/index.js"),Y=()=>import("@carbon/web-components/es/components/icon-button/index.js"),Ds=()=>import("@carbon/web-components/es/components/combo-button/index.js"),Bs=()=>import("@carbon/web-components/es/components/copy-button/index.js"),Ns=()=>import("@carbon/web-components/es/components/checkbox/index.js"),Ms=()=>import("@carbon/web-components/es/components/radio-button/index.js"),Ts=()=>import("@carbon/web-components/es/components/toggle/index.js"),U=()=>import("@carbon/web-components/es/components/select/index.js"),qs=()=>import("@carbon/web-components/es/components/slider/index.js"),j=()=>import("@carbon/web-components/es/components/text-input/index.js"),Os=()=>import("@carbon/web-components/es/components/textarea/index.js"),zs=()=>import("@carbon/web-components/es/components/number-input/index.js"),Fs=()=>import("@carbon/web-components/es/components/password-input/index.js"),tt=()=>import("@carbon/web-components/es/components/search/index.js"),Rs=()=>import("@carbon/web-components/es/components/combo-box/index.js"),Ls=()=>import("@carbon/web-components/es/components/dropdown/index.js"),Hs=()=>import("@carbon/web-components/es/components/multi-select/index.js"),Us=()=>import("@carbon/web-components/es/components/date-picker/index.js"),js=()=>import("@carbon/web-components/es/components/time-picker/index.js"),Gs=()=>import("@carbon/web-components/es/components/file-uploader/index.js"),et=()=>import("@carbon/web-components/es/components/form/index.js"),$s=()=>import("@carbon/web-components/es/components/form-group/index.js"),Vs=()=>import("@carbon/web-components/es/components/data-table/index.js"),st=()=>import("@carbon/web-components/es/components/pagination/index.js"),Zs=()=>import("@carbon/web-components/es/components/code-snippet/index.js"),G=()=>import("@carbon/web-components/es/components/tag/index.js"),Js=()=>import("@carbon/web-components/es/components/badge-indicator/index.js"),$=()=>import("@carbon/web-components/es/components/notification/index.js"),Ks=()=>import("@carbon/web-components/es/components/loading/index.js"),Qs=()=>import("@carbon/web-components/es/components/inline-loading/index.js"),Xs=()=>import("@carbon/web-components/es/components/progress-bar/index.js"),Ys=()=>import("@carbon/web-components/es/components/progress-indicator/index.js"),tn=()=>import("@carbon/web-components/es/components/skeleton-placeholder/index.js"),en=()=>import("@carbon/web-components/es/components/skeleton-text/index.js"),P=()=>import("@carbon/web-components/es/components/modal/index.js"),k=()=>import("@carbon/web-components/es/components/tooltip/index.js"),sn=()=>import("@carbon/web-components/es/components/popover/index.js"),nn=()=>import("@carbon/web-components/es/components/toggle-tip/index.js"),nt=()=>import("@carbon/web-components/es/components/heading/index.js"),an=()=>import("@carbon/web-components/es/components/icon/index.js"),on=()=>import("@carbon/web-components/es/components/icon-indicator/index.js"),q={"cds-table":[k,H,j,tt,U,st,Vs],"cds-pagination":[U,j,st],"cds-button":[k,H],"cds-icon-button:not([data-toggle])":[k,Y],"cds-icon-button[data-toggle]":[k,Y],"cds-button[data-fab]":[k,H],"cds-copy-button":[k,Bs],"cds-combo-button":[k,Ds],"cds-checkbox":[Ns],"cds-radio-button-group":[Ms],"cds-toggle":[Ts],"cds-select":[U],"cds-slider":[qs],"cds-text-input":[j],"cds-textarea":[Os],"cds-number-input":[zs],"cds-password-input":[k,Fs],"cds-search":[tt],"cds-dropdown":[Ls],"cds-combo-box":[Rs],"cds-multi-select":[Hs],"cds-date-picker":[Us],"cds-time-picker":[js],"cds-file-uploader":[Gs],"cds-tabs":[ys],"cds-accordion":[Is],"cds-content-switcher":[xs],"cds-breadcrumb":[R],"cds-breadcrumb-item":[R],"cds-breadcrumb-link":[R],"cds-menu":[X],"cds-menu-button":[X],"cds-overflow-menu":[ws],"cds-structured-list":[ks],"cds-contained-list":[L],"cds-contained-list-item":[L],"cds-contained-list-description":[L],"cds-tree-view":[_s],"cds-modal":[P],"cds-modal-header":[P],"cds-modal-heading":[P],"cds-modal-label":[P],"cds-modal-close-button":[P],"cds-modal-body":[P],"cds-modal-body-content":[P],"cds-modal-footer":[P],"cds-modal-footer-button":[P],"cds-toast-notification":[$],"cds-inline-notification":[$],"cds-actionable-notification":[$],"cds-tile":[D],"cds-tile-group":[D],"cds-clickable-tile":[D],"cds-expandable-tile":[D],"cds-selectable-tile":[D],"cds-radio-tile":[D],"cds-progress-bar":[Xs],"cds-progress-indicator":[Ys],"cds-inline-loading":[Qs],"cds-tooltip":[k],"cds-popover":[sn],"cds-toggletip":[nn],"cds-tag":[G],"cds-dismissible-tag":[G],"cds-filter-tag":[G],"cds-link":[Cs],"cds-code-snippet":[Zs],"cds-form":[et],"cds-form-item":[et],"cds-form-group":[$s],"cds-stack":[Ps],"cds-heading":[nt],"cds-section":[nt],"cds-icon":[an],"cds-icon-indicator":[on],"cds-badge-indicator":[Js],"cds-loading":[Ks],"cds-skeleton-text":[en],"cds-skeleton-placeholder":[tn]};function rn(t){const e=new Map;if(!t||!(t instanceof Element))return e;for(const s of Object.keys(T))e.set(s,[]);for(const[s]of Object.entries(T))t.matches(s)&&e.get(s).push(t);const n=t.querySelectorAll("*");for(const s of n)for(const[a]of Object.entries(T))s.matches(a)&&e.get(a).push(s);for(const[s,a]of e.entries())a.length===0&&e.delete(s);return e}function cn(t){const e=new Set;for(const[n,s]of t.entries())s.length>0&&q[n]&&q[n].forEach(a=>e.add(a));return e}async function ln(t,e){if(t.size===0)return;const n=Array.from(t).map(async s=>(e.has(s)||e.set(s,s()),e.get(s)));await Promise.all(n)}function dn(t,e){let n=0;for(const[s,a]of t.entries()){const o=T[s];a.forEach(r=>{if(o.init){o.init.call(e,r);return}if(o.multiEvent){const A=c.getSemanticAttributes(r);o.events.forEach(W=>{const x=c.getEventAttribute(r,W.attrName,"event");x&&e.listen(r,W.type,O=>{e.dispatchPanelEvent(x,W.getData(O,A,r))})});return}const d=c.getSemanticAttributes(r),u=d.event;u&&e.listen(r,o.event,A=>{A.stopPropagation();const W=o.getData(A,d,r),x=W._eventOverride||u;delete W._eventOverride,e.dispatchPanelEvent(x,W)})}),n+=a.length}return n}var T=Object.fromEntries(Ws()),pn=async function(t,e){const n=rn(t);if(n.size===0){this.debugMe("[Carbon] No Carbon components found in panel");return}this.carbonComponents||(this.carbonComponents=new Map);for(const[o,r]of n.entries())this.carbonComponents.set(o,r);const s=cn(n);if(s.size>0)try{await ln(s,e)}catch(o){console.error("[Carbon] Failed to load some component modules:",o)}const a=dn(n,this);a>0&&this.debugMe(`[Carbon] Total components initialized: ${a}`)},un=(t={})=>{const{preload:e=[]}=t,n=new Map;if(e.length>0){const s=e.filter(o=>q[o]?!0:(console.warn(`[Carbon] No import found for selector: ${o}`),!1)),a=s.flatMap(o=>q[o].map(r=>(n.has(r)||n.set(r,r()),n.get(r))));Promise.all(a).then(()=>console.debug(`[Carbon] Preloaded: ${s.join(", ")}`)).catch(o=>console.warn("[Carbon] Preload error:",o))}m.ComponentLibraryRegistry.register("carbon",{cache:n,render:async function(s,a){try{await pn.call(this,s,a)}catch(o){console.error("[Carbon] Initialization error:",o)}},dispose:function(s){},config:{version:"2.0",description:"IBM Carbon Design System Web Components"}}),console.debug("[Zooy] Carbon Design System library registered")};exports.registerCarbonLibrary=un;
|
|
1
|
+
var St=Object.create;var K=Object.defineProperty;var At=Object.getOwnPropertyDescriptor;var Wt=Object.getOwnPropertyNames;var It=Object.getPrototypeOf,Pt=Object.prototype.hasOwnProperty;var kt=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Wt(e))!Pt.call(t,a)&&a!==n&&K(t,a,{get:()=>e[a],enumerable:!(s=At(e,a))||s.enumerable});return t};var l=(t,e,n)=>(n=t!=null?St(It(t)):{},kt(e||!t||!t.__esModule?K(n,"default",{value:t,enumerable:!0}):n,t));const m=require("./component-library-registry-BBQV6Kpv.js"),c=require("./zoo-Cpc0eKfk.js");let at=require("badu"),B=require("ramda");B=m.__toESM(B);let _t=require("@carbon/web-components/lib/components/data-table/defs.js");var Ct=m.__exportAll({cdsTableWrap:()=>Dt}),Q=(t,e,n)=>{const s=customElements.get("cds-table"),a=customElements.get("cds-pagination"),o=customElements.get(s.selectorTableBatchActions);customElements.get("cds-popover");const r=e.dataBinder,d=e.pagination,u=e.skeleton,A=e.querySelector(s.selectorTableToolbarSearch),W=e.querySelector(s.selectorTableBatchActions),x=e.querySelector(s.selectorTableBody),O=["button","a","input","select","textarea",'[role="button"]',".cds--table-expand",".cds--table-column-checkbox"].join(","),V=e.querySelectorAll(s.selectorHeaderCell+"[is-sortable]"),ot=e.isSortable||V.length>0,z=Symbol(),F=Symbol(),w=new Map,rt=i=>{t.listen(e,"click",p=>{const v=p.target.closest(s.selectorTableRow);if(!v||p.composedPath().some(f=>f.matches&&f.matches(O)))return;p.stopPropagation();const g=c.getSemanticAttributes(v);t.dispatchPanelEvent(i,{...g})})},ct=i=>{t.listen(e,s.eventExpandoToggle,p=>{const v=p.target,g=v.tagName==="CDS-TABLE-HEADER-ROW",f=p.detail.expanded,E={tableAttrs:n,...c.getSemanticAttributes(v),target:v,allRows:g,didExpand:f};t.dispatchPanelEvent(i,E)})},it=i=>{w.set(z,p=>{t.dispatchPanelEvent(i,p)})},lt=i=>{w.set(F,p=>{const v=p.detail.selectedRows,g=Math.min(v.length,W.totalRowsCount),f=p.target,E=c.getSemanticAttributes(f),I=v.map(c.getSemanticAttributes),_={tableAttrs:n,...E,target:f,selectCount:g,selection:I};t.dispatchPanelEvent(i,_)})},dt=i=>{t.listen(e,s.eventTableRowSelect,p=>{const v=p.target,g=p.detail.selectedRows||[],f=g.length,E=g.map(c.getSemanticAttributes),I={tableAttrs:n,...c.getSemanticAttributes(v),selectCount:f,selection:E,target:v};t.dispatchPanelEvent(i,I)})},pt=()=>{t.listen(e,s.eventBeforeSort,i=>{const p=i.target,v=i.detail.oldSortDirection,g=i.detail.sortDirection,f=c.getSemanticAttributes(p),E=f.sortField,I=g===_t.TABLE_SORT_DIRECTION.DESCENDING?`-${E}`:E;i.cancelBubble=!0,i.stopPropagation(),i.preventDefault(),x.innerHTML="",u&&u.show(),V.forEach((C,b)=>{C===p?(C.setAttribute("sort-active","true"),C.setAttribute("sort-direction",g)):(C.removeAttribute("sort-active"),C.setAttribute("sort-direction","none"))});const _={ordering:I};r.fetchData(_).then(()=>{d.setData(r),u&&u.hide()}),w.has(z)&&w.get(z)({tableAttrs:n,...f,sortNow:g,sortWas:v,sortField:E,ordering:I,target:p})})},ut=()=>{t.listen(e,s.eventTableRowSelectAll,i=>{i.detail.selectedRows.length===0&&e.querySelectorAll(s.selectorTableRow).forEach(p=>{p.disabled=!1,p.selected=!1}),w.has(F)&&w.get(F)(i)})},vt=()=>{t.listen(e,s.eventBeforeChangeSelectionAll,i=>{i.stopPropagation(),i.detail.callback&&i.detail.callback()})},mt=i=>{const p=e.querySelector("cds-table-header-row");t.listen(i,o.eventClickSelectAll,v=>{v.stopPropagation(),p.dispatchEvent(new CustomEvent(s.eventBeforeChangeSelectionAll,{bubbles:!0,cancelable:!0,composed:!0,detail:{selected:!0,callback:()=>{i.selectedRowsCount=i.totalRowsCount,e.querySelectorAll(s.selectorTableRow).forEach(g=>{g.disabled=!0})}}}))})},gt=i=>{t.listen(i,"keydown",p=>{if(p.key==="Enter"){u&&u.show(),d.totalItems=0,e.querySelector("cds-table-body").replaceChildren();const v={search:i.value||"",offset:0};r.fetchData(v).then(()=>{d.setData(r),u&&u.hide()})}})},ht=i=>{t.listen(i,s.eventSearchInput,p=>{if((p.detail.value||"")===""){const v={search:"",offset:0};u&&u.show(),r.fetchData(v).then(()=>{u&&u.hide(),d.setData(r)})}})},ft=i=>{i.caret=!1;const p=i.querySelector("cds-icon-button, button:not([slot])"),v=i.querySelectorAll("cds-checkbox"),g=i.querySelectorAll("cds-modal-footer-button"),f=[...i.querySelectorAll("cds-checkbox-group")].map(c.getSemanticAttributes).map(B.pathOr("noop",["zoo","filter","field"])).reduce((b,S)=>(b[S]=null,b),{offset:0});if(!p||!g){console.error("Improperly configured Batch Filter popover");return}new MutationObserver(()=>{i.classList.toggle("cds--overflow-menu--open",i.open)}).observe(i,{attributes:!0,attributeFilter:["open"]});const E=Symbol(),I=Symbol(),_=[...g].reduce((b,S,y)=>(S.hasAttribute("reset-filter")&&b.set(E,S),S.hasAttribute("apply-filter")&&b.set(I,S),b),new Map),C=()=>{const b=new Map;return v.forEach(S=>{const y=S.getAttribute("id");if(!y||!y.includes(":"))return;const[N,M]=y.split(":");b.has(N)||b.set(N,[]),S.checked&&b.get(N).push(M)}),b};if(_.has(E)){const b=S=>S.checked=!1;t.listen(_.get(E),"click",S=>{S.stopPropagation(),v.forEach(b),u&&u.show(),r.fetchData(f).then(()=>{d&&d.setData(r),u&&u.hide(),i.open=!1})})}_.has(I)&&t.listen(_.get(I),"click",b=>{b.stopPropagation();const S=[...C()].reduce((y,[N,M])=>(y[N]=Array.isArray(M)&&M.length===0?null:M,y),{offset:0});u&&u.show(),r.fetchData(S).then(()=>{d&&d.setData(r),u&&u.hide(),i.open=!1})}),t.listen(p,"click",b=>{b.stopPropagation(),i.open=!i.open,i.classList.toggle("cds--overflow-menu--open",i.open)})},bt=()=>{t.listen(d,a.eventPageSizeChanged,i=>{const p={limit:d.pageSize,offset:0};r.fetchData(p).then(()=>{d.setData(r)})})},Et=()=>{let i=null;t.listen(d,a.eventChangeCurrent,p=>{const{page:v}=p.detail,g=d.pageSize,f=(v-1)*g;if(f!==i){i=f;const E={limit:g,offset:f};r.fetchData(E).then(()=>{d.setData(r),u&&u.hide()})}})};r&&d&&(bt(),Et()),r&&A&&(gt(A),ht(A));const Z=e.querySelector(s.selectorTableToolbarContent);if(Z){const i=Z.querySelectorAll("cds-popover[data-batch-filter]");r&&i&&i.forEach(ft)}e.isSelectable&&(ut(),vt(),W&&mt(W)),r&&ot&&pt();const J={zoo:{event:{row:{click:rt,expand:ct,check:{one:dt,all:lt}},column:{sort:it}}}};(0,at.objToPaths)(n).forEach(([i,p])=>{B.hasPath(i,J)&&B.path(i,J)(p)})},yt=t=>{const e=document.createElement("cds-pagination");return e.backwardText="Previous page",e.forwardText="Next page",e.itemsPerPageText="Items per page:",e.pageSize=t.limit,e.size="lg",[10,25,50,100,500].forEach(n=>{const s=document.createElement("cds-select-item");s.value=n.toString(),s.textContent=n.toString(),e.appendChild(s)}),e.setData=n=>{if(n.isPaginated){const{count:s}=B.pick(["count"],n.data);e.pagesUnknown=Math.ceil(s/n.limit)>100,e.totalItems=s,e.pagesUnknown?e.formatStatusWithIndeterminateTotal=({start:a,end:o})=>`${a}–${o} of ${s} item${s<=1?"":"s"}`:delete e.formatStatusWithIndeterminateTotal}},e},xt=t=>{if(!t.parentNode){console.error("[Carbon Table] Cannot create skeleton: table has no parent node");return}const e=!!t.querySelector("cds-table-header-title"),n=!!t.querySelector("cds-table-header-description"),s=!!t.querySelector("cds-table-toolbar"),a=[...t.querySelectorAll("cds-table-header-cell")].length,o=t.hasAttribute("zebra"),r=t.getAttribute("size"),d=document.createElement("cds-table-skeleton");d.showHeader=e||n,d.showToolbar=s,d.zebra=o,d.columnCount=a,d.size=r,d.show=()=>d.classList.remove("hidden"),d.hide=()=>d.classList.add("hidden");const u=document.createElement("div");return u.classList.add("zoo-datatable-skeleton-wrapper"),t.parentNode.insertBefore(u,t),u.appendChild(d),u.appendChild(t),d},wt=(t,e)=>{const n=e.getAttribute("zoo-url-api"),s=parseInt(e.getAttribute("data-page-size")||25,10);if(n)return new c.Binder(t,n,e,{urlParams:{limit:s}})},Dt={selector:"cds-table",init:function(t){const e=c.getSemanticAttributes(t),n=this,s=wt(n,t);if((0,at.isDefAndNotNull)(s)){t.dataBinder=s;const a=xt(t);t.skeleton=a;const o=yt(s);t.pagination=o,t.after(o),s.fetchData().then(r=>{a.hide(),o.setData(s),Q(n,t,e)})}else Q(n,t,e)}},Bt=m.__exportAll({cdsPaginationWrap:()=>Nt}),Nt={selector:"cds-pagination",init:function(t){const e=this,n=customElements.get("cds-pagination");let s=null;e.listen(t,n.eventChangeCurrent,a=>{const o=a.detail.page,r=t.pageSize,d=(o-1)*r;d!==s&&(s=d,e.dispatchPanelEvent("pagination-changed-current",{detail:{page:o,pageSize:r,action:"page-change"}}))}),e.listen(t,n.eventPageSizeChanged,a=>{const o=t.pageSize;s=null,e.dispatchPanelEvent("pagination-changed-page-size",{detail:{page:1,pageSize:o,action:"page-size-change"}})})}},Mt=m.__exportAll({cdsModalBodyContentWrap:()=>Lt,cdsModalBodyWrap:()=>Rt,cdsModalCloseButWrap:()=>Ft,cdsModalFooterButWrap:()=>Ut,cdsModalFooterWrap:()=>Ht,cdsModalHeaderWrap:()=>qt,cdsModalHeadingWrap:()=>Ot,cdsModalLabelWrap:()=>zt,cdsModalWrap:()=>Tt}),Tt={selector:"cds-modal",init:function(t){const e=customElements.get("cds-modal"),n=c.getSemanticAttributes(t),s=c.getEventAttribute(t,"open-event","event");s&&this.listen(t,"cds-modal-beingopened",r=>{this.dispatchPanelEvent(s,{...n,action:"opened"})});const a=t.getAttribute("before-close-event");a&&this.listen(t,e.eventBeforeClose,r=>{this.dispatchPanelEvent(a,{...n,action:"closing",cancelable:!0})}),this.listen(t,e.eventClose,r=>{this.dispatchPanelEvent("destroy_me",{...n,action:"closed",triggeredBy:r.detail?.triggeredBy})});const o=c.getEventAttribute(t,"primary-event","event");o&&this.listen(t,"cds-modal-primary-focus",r=>{this.dispatchPanelEvent(o,{...n,action:"primary"})})}},qt={selector:"cds-modal-header"},Ot={selector:"cds-modal-heading"},zt={selector:"cds-modal-label"},Ft={selector:"cds-modal-close-button"},Rt={selector:"cds-modal-body"},Lt={selector:"cds-modal-body-content"},Ht={selector:"cds-modal-footer"},Ut={selector:"cds-modal-footer-button",init:function(t){const e=c.getSemanticAttributes(t);if(t.getAttribute("type")==="submit"){this.listen(t,"click",s=>{let a=t.closest("form");if(!a){const o=t.getAttribute("form");o&&(a=document.getElementById(o))}a&&a.requestSubmit()});return}const n=e.event;n&&this.listen(t,"click",s=>{s.stopPropagation(),this.dispatchPanelEvent(n,e)})}},jt=m.__exportAll({cdsMenuButtonWrap:()=>$t,cdsMenuWrap:()=>Gt}),Gt={selector:"cds-menu",init:function(t){const e=c.getSemanticAttributes(t),n=c.getEventAttribute(t,"open-event");n&&this.listen(t,"cds-menu-opened",a=>{this.dispatchPanelEvent(n,{...e,action:"opened"})});const s=c.getEventAttribute(t,"close-event");s&&this.listen(t,"cds-menu-closed",a=>{this.dispatchPanelEvent(s,{...e,action:"closed"})}),this.listen(t,"click",a=>{if(a.target.tagName==="CDS-MENU-ITEM"){const o=c.getSemanticAttributes(a.target),r=o.event||e.event;r&&(a.stopPropagation(),this.dispatchPanelEvent(r,{...e,...o}))}}),this.listen(t,"cds-item-changed",a=>{const o=a.detail.triggeredBy,r=c.getSemanticAttributes(o),d=r.event||e.event;d&&this.dispatchPanelEvent(d,{...e,...r,action:"selection-changed"})})}},$t={selector:"cds-menu-button",init:function(t){const e=c.getSemanticAttributes(t),n=t.querySelector("cds-menu");n&&this.listen(n,"click",s=>{if(s.target.tagName==="CDS-MENU-ITEM"){const a=c.getSemanticAttributes(s.target),o=a.event||e.event;o&&(s.stopPropagation(),this.dispatchPanelEvent(o,{...e,...a}))}})}},Vt=m.__exportAll({cdsButFabWrap:()=>Qt,cdsButtonWrap:()=>Zt,cdsComboButWrap:()=>Yt,cdsCopyButWrap:()=>Xt,cdsIconButToggleWrap:()=>Kt,cdsIconButWrap:()=>Jt}),Zt={selector:"cds-button",init:function(t){const e=c.getSemanticAttributes(t);if(t.getAttribute("type")==="submit"){this.listen(t,"click",s=>{let a=t.closest("form");if(!a){const o=t.getAttribute("form");o&&(a=document.getElementById(o))}a&&a.requestSubmit()});return}const n=e.event;n&&this.listen(t,"click",s=>{s.stopPropagation(),this.dispatchPanelEvent(n,c.getSemanticAttributes(t))})}},Jt={selector:"cds-icon-button:not([data-toggle])",event:"click",getData:(t,e)=>e},Kt={selector:"cds-icon-button[data-toggle]",init:function(t){const e=c.getSemanticAttributes(t);e.event&&this.listen(t,"click",n=>{n.stopPropagation(),t.isSelected=!t.isSelected,this.dispatchPanelEvent(e.event,{...e,isOn:t.isSelected})})}},Qt={selector:"cds-button[data-fab]",event:"click",getData:(t,e)=>e},Xt={selector:"cds-copy-button",init:function(t){const e=c.getSemanticAttributes(t),n=e.event;n&&this.listen(t,"click",a=>{a.stopPropagation(),this.dispatchPanelEvent(n,{...e,action:"copy"})});const s=t.getAttribute("success-event");if(s){const a=new MutationObserver(()=>{t.hasAttribute("feedback-shown")&&this.dispatchPanelEvent(s,{...e,action:"copied"})});a.observe(t,{attributes:!0,attributeFilter:["feedback-shown"]}),t._copyObserver=a}}},Yt={selector:"cds-combo-button",init:function(t){const e=c.getSemanticAttributes(t);e.event&&this.listen(t,"click",s=>{const a=s.composedPath(),o=a.some(d=>d.tagName==="CDS-MENU-ITEM"),r=a.some(d=>d.tagName==="CDS-ICON-BUTTON");!o&&!r&&(s.stopPropagation(),this.dispatchPanelEvent(e.event,{...e,action:"primary"}))});const n=t.querySelector("cds-menu");n&&this.listen(n,"click",s=>{if(s.target.tagName==="CDS-MENU-ITEM"){const a=c.getSemanticAttributes(s.target),o=a.event||c.getEventAttribute(t,"menu-event","event");o&&this.dispatchPanelEvent(o,{...e,...a,action:"menu-item"})}})}},te=m.__exportAll({cdsComboBoxWrap:()=>se,cdsDropdownWrap:()=>ee,cdsMultiSelectWrap:()=>ne}),ee={selector:"cds-dropdown",init:function(t){const e=customElements.get("cds-dropdown"),n=c.getSemanticAttributes(t),s=n.event;s&&this.listen(t,e.eventSelect,o=>{this.dispatchPanelEvent(s,{...n,value:t.value,selectedValue:o.detail?.item?.value,selectedText:o.detail?.item?.textContent?.trim()})});const a=t.getAttribute("toggle-event");a&&this.listen(t,e.eventToggle,o=>{this.dispatchPanelEvent(a,{...n,open:t.hasAttribute("open")})})}},se={selector:"cds-combo-box",init:function(t){const e=customElements.get("cds-combo-box"),n=c.getSemanticAttributes(t),s=n.event;s&&this.listen(t,e.eventSelect,o=>{const r=o.detail?.item;this.dispatchPanelEvent(s,{...n,value:t.value,selectedValue:r?.value,selectedText:r?.textContent?.trim()})});const a=t.getAttribute("toggle-event");a&&this.listen(t,e.eventToggle,o=>{this.dispatchPanelEvent(a,{...n,open:t.hasAttribute("open")})})}},ne={selector:"cds-multi-select",init:function(t){const e=customElements.get("cds-multi-select"),n=c.getSemanticAttributes(t),s=n.event;s&&this.listen(t,e.eventSelect,o=>{const r=t.value?t.value.split(","):[];this.dispatchPanelEvent(s,{...n,selectedItems:r})});const a=t.getAttribute("toggle-event");a&&this.listen(t,e.eventToggle,o=>{this.dispatchPanelEvent(a,{...n,open:t.hasAttribute("open")})})}},ae=m.__exportAll({cdsDatePickerWrap:()=>oe,cdsTimePickerWrap:()=>re}),oe={selector:"cds-date-picker",init:function(t){const e=customElements.get("cds-date-picker"),n=c.getSemanticAttributes(t),s=t.querySelector('cds-date-picker-input[kind="from"]'),a=t.querySelector('cds-date-picker-input[kind="to"]'),o=s&&a,r=n.event;r&&this.listen(t,e.eventChange,u=>{let A;o?A={from:s.value||"",to:a.value||""}:A=t.value,this.dispatchPanelEvent(r,{...n,value:A})});const d=t.getAttribute("error-event");d&&this.listen(t,e.eventFlatpickrError,u=>{this.dispatchPanelEvent(d,{...n,error:u.detail})})}},re={selector:"cds-time-picker",event:"cds-time-picker-changed",getData:(t,e,n)=>({...e,value:n.value})},ce=m.__exportAll({cdsFileUploaderWrap:()=>ie}),ie={selector:"cds-file-uploader",init:function(t){const e=c.getSemanticAttributes(t),n=e.event;if(n){const a=t.querySelector('input[type="file"]');a&&this.listen(a,"change",o=>{this.dispatchPanelEvent(n,{...e,files:Array.from(o.target.files||[])})})}const s=t.getAttribute("delete-event");s&&this.listen(t,"cds-file-uploader-item-deleted",a=>{this.dispatchPanelEvent(s,{...e,fileName:a.detail?.fileName,fileId:a.detail?.fileId})})}},le=m.__exportAll({cdsAccordionWrap:()=>pe,cdsContentSwitcherWrap:()=>ue,cdsTabsWrap:()=>de}),de={selector:"cds-tabs",init:function(t){const e=customElements.get("cds-tabs"),n=c.getSemanticAttributes(t),s=t.getAttribute("before-select-event");s&&this.listen(t,e.eventBeforeSelect,o=>{this.dispatchPanelEvent(s,{...n,tabValue:o.detail.value,cancelable:!0})});const a=n.event;a&&this.listen(t,e.eventSelect,o=>{const r=o.detail.item,d=c.getSemanticAttributes(r);this.dispatchPanelEvent(a,{...n,...d,tabValue:o.detail.value})})}},pe={selector:"cds-accordion",init:function(t){const e=customElements.get("cds-accordion-item"),n=c.getSemanticAttributes(t);[...t.querySelectorAll("cds-accordion-item")].forEach(s=>{const a=c.getSemanticAttributes(s),o=a.event||n.event;o&&this.listen(s,e.eventToggle,r=>{this.dispatchPanelEvent(o,{...n,...a,open:r.detail.open})})})}},ue={selector:"cds-content-switcher",init:function(t){const e=customElements.get("cds-content-switcher"),n=c.getSemanticAttributes(t),s=t.getAttribute("before-select-event");s&&this.listen(t,e.eventBeforeSelect,o=>{this.dispatchPanelEvent(s,{...n,value:o.detail.value,cancelable:!0})});const a=n.event;a&&this.listen(t,e.eventSelect,o=>{const r=o.detail.item,d=c.getSemanticAttributes(r);this.dispatchPanelEvent(a,{...n,...d,value:r.getAttribute("value")})})}},ve=m.__exportAll({cdsBreadCrumbWrap:()=>he,cdsBreadcrumbItemWrap:()=>me,cdsBreadcrumbLinkWrap:()=>ge}),me={selector:"cds-breadcrumb-item"},ge={selector:"cds-breadcrumb-link",event:"click",getData:(t,e,n)=>(t.preventDefault(),{...e,href:n.getAttribute("href")})},he={selector:"cds-breadcrumb",init:function(t){const e=this,n=c.getSemanticAttributes(t),s=n.event;if(s){const a=r=>{e.dispatchPanelEvent(s,{...n,...r})};e.listen(t,"click",r=>{const d=r.target.closest("cds-breadcrumb-link");d&&(r.preventDefault(),r.stopPropagation(),a(c.getSemanticAttributes(d)))});const o=t.querySelector("cds-overflow-menu-body");o&&e.listen(o,"cds-overflow-menu-item-clicked",r=>{r.stopPropagation(),a(c.getSemanticAttributes(r.target))})}}},fe=m.__exportAll({cdsNumberInputWrap:()=>Se,cdsPasswordInputWrap:()=>Ae,cdsSearchWrap:()=>We,cdsTextAreaWrap:()=>Ee,cdsTextInputWrap:()=>be}),be={selector:"cds-text-input",multiEvent:!0,events:[{type:"input",attrName:"event",getData:(t,e)=>({...e,value:t.currentTarget.value})},{type:"change",attrName:"change-event",getData:(t,e)=>({...e,value:t.currentTarget.value})}]},Ee={selector:"cds-textarea",multiEvent:!0,events:[{type:"input",attrName:"event",getData:(t,e)=>({...e,value:t.currentTarget.value})},{type:"change",attrName:"change-event",getData:(t,e)=>({...e,value:t.currentTarget.value})}]},Se={selector:"cds-number-input",event:"cds-number-input",getData:(t,e,n)=>({...e,value:t.detail.value,direction:t.detail.direction})},Ae={selector:"cds-password-input",multiEvent:!0,events:[{type:"input",attrName:"event",getData:(t,e)=>({...e,value:t.currentTarget.value})},{type:"change",attrName:"change-event",getData:(t,e)=>({...e,value:t.currentTarget.value})}]},We={selector:"cds-search",event:"cds-search-input",getData:(t,e,n)=>({...e,value:n.value})},Ie=m.__exportAll({cdsCheckboxWrap:()=>Pe,cdsRadioButGroupWrap:()=>ke,cdsSelectWrap:()=>Ce,cdsSliderWrap:()=>ye,cdsToggleWrap:()=>_e}),Pe={selector:"cds-checkbox",event:"cds-checkbox-changed",getData:(t,e,n)=>({...e,checked:t.detail.checked,value:n.value})},ke={selector:"cds-radio-button-group",event:"cds-radio-button-group-changed",getData:(t,e)=>({...e,value:t.detail?.value})},_e={selector:"cds-toggle",event:"cds-toggle-changed",getData:(t,e)=>({...e,isOn:t.detail.checked,value:t.detail.checked})},Ce={selector:"cds-select",event:"cds-select-selected",getData:(t,e)=>({...e,value:t.detail.value})},ye={selector:"cds-slider",init:function(t){const e=c.getSemanticAttributes(t),n=e.event;n&&this.listen(t,"cds-slider-changed",a=>{this.dispatchPanelEvent(n,{...e,value:a.detail.value})});const s=t.getAttribute("input-event");s&&this.listen(t,"cds-slider-input-changed",a=>{this.dispatchPanelEvent(s,{...e,value:a.detail.value})})}},xe=m.__exportAll({cdsFilterTagWrap:()=>Be,cdsSDismissibleTagWrap:()=>De,cdsTagsWrap:()=>we}),we={selector:"cds-tag",event:"click",getData:(t,e)=>e},De={selector:"cds-dismissible-tag",init:function(t){const e=c.getSemanticAttributes(t),n=t.getAttribute("click-event");n&&this.listen(t,"click",a=>{a.target.closest("button")||this.dispatchPanelEvent(n,{...e})});const s=e.event;s&&this.listen(t,"cds-dismissible-tag-closed",a=>{this.dispatchPanelEvent(s,{...e,action:"closed"})})}},Be={selector:"cds-filter-tag",event:"cds-filter-tag-closed",getData:(t,e)=>({...e,action:"remove"})},Ne=m.__exportAll({cdsContainedListDescriptionWrap:()=>Oe,cdsContainedListItemWrap:()=>ze,cdsContainedListWrap:()=>qe,cdsOverflowMenuWrap:()=>Me,cdsStructuredListWrap:()=>Te,cdsTreeViewWrap:()=>Fe}),Me={selector:"cds-overflow-menu",init:function(t){const e=c.getSemanticAttributes(t),n=e.event,s=t.querySelector("cds-overflow-menu-body");n&&s&&this.listen(s,"cds-overflow-menu-item-clicked",a=>{a.stopPropagation();const o=c.getSemanticAttributes(a.target);this.dispatchPanelEvent(n,{...e,...o})})}},Te={selector:"cds-structured-list",init:function(t){const e=c.getSemanticAttributes(t);[...t.querySelectorAll("cds-structured-list-row")].forEach(n=>{const s=c.getSemanticAttributes(n),a=s.event||e.event;a&&this.listen(n,"click",o=>{o.stopPropagation(),this.dispatchPanelEvent(a,{...e,...s})})}),t.hasAttribute("selection")&&this.listen(t,"cds-structured-list-selected",n=>{const s=n.detail.row,a=c.getSemanticAttributes(s),o=e.event;o&&this.dispatchPanelEvent(o,{...e,...a})})}},qe={selector:"cds-contained-list"},Oe={selector:"cds-contained-list-description"},ze={selector:"cds-contained-list-item",event:"cds-contained-list-item-click",getData:(t,e)=>e},Fe={selector:"cds-tree-view",init:function(t){const e=c.getSemanticAttributes(t);this.listen(t,"cds-tree-node-selected",s=>{const a=s.detail.node,o=c.getSemanticAttributes(a),r=o.event||e.event;r&&this.dispatchPanelEvent(r,{...e,...o,nodeId:a.id,label:a.getAttribute("label")})});const n=c.getEventAttribute(t,"expand-event");n&&this.listen(t,"cds-tree-node-expanded",s=>{this.dispatchPanelEvent(n,{...e,nodeId:s.detail.node.id,expanded:s.detail.expanded})})}},Re=m.__exportAll({cdsActionableNotificationWrap:()=>Ue,cdsInlineNotificationWrap:()=>He,cdsToastNotificationWrap:()=>Le}),Le={selector:"cds-toast-notification",event:"cds-notification-closed",getData:(t,e)=>({...e,action:"closed"})},He={selector:"cds-inline-notification",event:"cds-notification-closed",getData:(t,e)=>({...e,action:"closed"})},Ue={selector:"cds-actionable-notification",init:function(t){const e=c.getSemanticAttributes(t),n=c.getEventAttribute(t,"close-event","event");n&&this.listen(t,"cds-notification-closed",a=>{this.dispatchPanelEvent(n,{...e,action:"closed"})});const s=c.getEventAttribute(t,"action-event");s&&this.listen(t,"cds-notification-actioned",a=>{this.dispatchPanelEvent(s,{...e,action:"actioned"})})}},je=m.__exportAll({cdsClickableTileWrap:()=>$e,cdsExpandableTileWrap:()=>Ve,cdsRadioTileWrap:()=>Je,cdsSelectableTileWrap:()=>Ze,cdsTileGroupWrap:()=>Ke,cdsTileWrap:()=>Ge}),Ge={selector:"cds-tile"},$e={selector:"cds-clickable-tile",init:function(t){const e=c.getSemanticAttributes(t),n=e.event;if(n){const s=e.href||t.getAttribute("href")||"";t.removeAttribute("href"),t.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),this.dispatchPanelEvent(n,{...e,href:s})},!0)}}},Ve={selector:"cds-expandable-tile",init:function(t){const e=c.getSemanticAttributes(t),n=t.getAttribute("before-toggle-event");n&&this.listen(t,"cds-expandable-tile-beingtoggled",a=>{this.dispatchPanelEvent(n,{...e,expanded:a.detail.expanded,cancelable:!0})});const s=e.event;s&&this.listen(t,"cds-expandable-tile-toggled",a=>{this.dispatchPanelEvent(s,{...e,expanded:a.detail.expanded})})}},Ze={selector:"cds-selectable-tile",event:"cds-selectable-tile-changed",getData:(t,e,n)=>({...e,selected:t.detail.selected,value:n.value})},Je={selector:"cds-radio-tile",event:"cds-radio-tile-selected",getData:(t,e,n)=>({...e,selected:t.detail.selected,name:t.detail.name,value:n.value})},Ke={selector:"cds-tile-group",init:function(t){const e=c.getSemanticAttributes(t),n=e.event;n&&(this.listen(t,"cds-current-radio-tile-selection",s=>{const a=s.detail.target;this.dispatchPanelEvent(n,{...e,value:a?.value,name:a?.name,selected:a?.selected})}),this.listen(t,"cds-current-selectable-tile-selections",s=>{const a=s.detail.currentSelections||[];this.dispatchPanelEvent(n,{...e,values:a.map(o=>o.value),names:a.map(o=>o.name),count:a.length})}))}},Qe=m.__exportAll({cdsInlineLoadingWrap:()=>ts,cdsProgressBarWrap:()=>Xe,cdsProgressIndicatorWrap:()=>Ye}),Xe={selector:"cds-progress-bar",init:function(t){const e=c.getSemanticAttributes(t);if(e.event){const n=new MutationObserver(()=>{const s=parseFloat(t.getAttribute("value")||"0");s>=parseFloat(t.getAttribute("max")||"100")&&this.dispatchPanelEvent(e.event,{...e,value:s,status:"complete"})});n.observe(t,{attributes:!0,attributeFilter:["value"]}),t._progressObserver=n}}},Ye={selector:"cds-progress-indicator",init:function(t){const e=c.getSemanticAttributes(t);this.listen(t,"cds-progress-step-click",n=>{const s=n.target,a=c.getSemanticAttributes(s),o=a.event||e.event;o&&this.dispatchPanelEvent(o,{...e,...a,stepIndex:s.getAttribute("data-index"),stepLabel:s.getAttribute("label")})})}},ts={selector:"cds-inline-loading",init:function(t){const e=c.getSemanticAttributes(t),n=e.event;n&&this.listen(t,"cds-inline-loading-onsuccess",a=>{this.dispatchPanelEvent(n,{...e,status:"finished"})});const s=t.getAttribute("status-event");if(s){const a=new MutationObserver(o=>{o.forEach(r=>{if(r.attributeName==="status"){const d=t.getAttribute("status");this.dispatchPanelEvent(s,{...e,status:d})}})});a.observe(t,{attributes:!0,attributeFilter:["status"]}),t._statusObserver=a}}},es=m.__exportAll({cdsPopoverWrap:()=>ns,cdsToggletipWrap:()=>as,cdsTooltipWrap:()=>ss}),ss={selector:"cds-tooltip",init:function(t){const e=c.getSemanticAttributes(t),n=c.getEventAttribute(t,"open-event");n&&this.listen(t,"cds-tooltip-beingopened",a=>{this.dispatchPanelEvent(n,{...e,action:"opened"})});const s=c.getEventAttribute(t,"close-event");s&&this.listen(t,"cds-tooltip-closed",a=>{this.dispatchPanelEvent(s,{...e,action:"closed"})})}},ns={selector:"cds-popover",init:function(t){const e=c.getSemanticAttributes(t),n=c.getEventAttribute(t,"open-event");n&&this.listen(t,"cds-popover-beingopened",a=>{this.dispatchPanelEvent(n,{...e,action:"opened"})});const s=c.getEventAttribute(t,"close-event");s&&this.listen(t,"cds-popover-closed",a=>{this.dispatchPanelEvent(s,{...e,action:"closed"})})}},as={selector:"cds-toggletip",init:function(t){const e=c.getSemanticAttributes(t);if(e.event){const n=new MutationObserver(s=>{s.forEach(a=>{if(a.attributeName==="open"){const o=t.hasAttribute("open");this.dispatchPanelEvent(e.event,{...e,action:o?"opened":"closed",open:o})}})});n.observe(t,{attributes:!0,attributeFilter:["open"]}),t._toggletipObserver=n}}},os=m.__exportAll({cdsCodeSnipWrap:()=>cs,cdsLinkWrap:()=>rs}),rs={selector:"cds-link",event:"click",getData:(t,e,n)=>({...e,href:n.getAttribute("href")})},cs={selector:"cds-code-snippet",event:"cds-copy-button-clicked",getData:(t,e)=>({...e,action:"copied"})},is=m.__exportAll({cdsBadgeIndicatorWrap:()=>fs,cdsFormGroupWrap:()=>ps,cdsFormItemWrap:()=>ds,cdsFormWrap:()=>ls,cdsHeadingWrap:()=>vs,cdsIconIndicatorWrap:()=>hs,cdsIconWrap:()=>gs,cdsLoadingWrap:()=>bs,cdsSectionWrap:()=>ms,cdsSkeletonPlaceholderWrap:()=>Ss,cdsSkeletonTextWrap:()=>Es,cdsStackWrap:()=>us}),ls={selector:"cds-form"},ds={selector:"cds-form-item"},ps={selector:"cds-form-group"},us={selector:"cds-stack"},vs={selector:"cds-heading"},ms={selector:"cds-section"},gs={selector:"cds-icon"},hs={selector:"cds-icon-indicator"},fs={selector:"cds-badge-indicator"},bs={selector:"cds-loading"},Es={selector:"cds-skeleton-text"},Ss={selector:"cds-skeleton-placeholder"};function h(t){return Object.values(t).filter(e=>typeof e=="object"&&e!==null&&e.selector)}var As=[...h(Bt),...h(Ct),...h(Mt),...h(jt),...h(Vt),...h(te),...h(ae),...h(ce),...h(le),...h(ve),...h(fe),...h(Ie),...h(xe),...h(Ne),...h(Re),...h(je),...h(Qe),...h(es),...h(os),...h(is)];function Ws(){const t=new Map;return As.forEach(e=>{t.set(e.selector,e)}),t}var Is=()=>import("@carbon/web-components/es/components/accordion/index.js"),R=()=>import("@carbon/web-components/es/components/breadcrumb/index.js"),Ps=()=>import("@carbon/web-components/es/components/stack/index.js"),ks=()=>import("@carbon/web-components/es/components/structured-list/index.js"),L=()=>import("@carbon/web-components/es/components/contained-list/index.js"),D=()=>import("@carbon/web-components/es/components/tile/index.js"),_s=()=>import("@carbon/web-components/es/components/tree-view/index.js"),Cs=()=>import("@carbon/web-components/es/components/link/index.js"),ys=()=>import("@carbon/web-components/es/components/tabs/index.js"),xs=()=>import("@carbon/web-components/es/components/content-switcher/index.js"),X=()=>import("@carbon/web-components/es/components/menu/index.js"),ws=()=>import("@carbon/web-components/es/components/overflow-menu/index.js"),H=()=>import("@carbon/web-components/es/components/button/index.js"),Y=()=>import("@carbon/web-components/es/components/icon-button/index.js"),Ds=()=>import("@carbon/web-components/es/components/combo-button/index.js"),Bs=()=>import("@carbon/web-components/es/components/copy-button/index.js"),Ns=()=>import("@carbon/web-components/es/components/checkbox/index.js"),Ms=()=>import("@carbon/web-components/es/components/radio-button/index.js"),Ts=()=>import("@carbon/web-components/es/components/toggle/index.js"),U=()=>import("@carbon/web-components/es/components/select/index.js"),qs=()=>import("@carbon/web-components/es/components/slider/index.js"),j=()=>import("@carbon/web-components/es/components/text-input/index.js"),Os=()=>import("@carbon/web-components/es/components/textarea/index.js"),zs=()=>import("@carbon/web-components/es/components/number-input/index.js"),Fs=()=>import("@carbon/web-components/es/components/password-input/index.js"),tt=()=>import("@carbon/web-components/es/components/search/index.js"),Rs=()=>import("@carbon/web-components/es/components/combo-box/index.js"),Ls=()=>import("@carbon/web-components/es/components/dropdown/index.js"),Hs=()=>import("@carbon/web-components/es/components/multi-select/index.js"),Us=()=>import("@carbon/web-components/es/components/date-picker/index.js"),js=()=>import("@carbon/web-components/es/components/time-picker/index.js"),Gs=()=>import("@carbon/web-components/es/components/file-uploader/index.js"),et=()=>import("@carbon/web-components/es/components/form/index.js"),$s=()=>import("@carbon/web-components/es/components/form-group/index.js"),Vs=()=>import("@carbon/web-components/es/components/data-table/index.js"),st=()=>import("@carbon/web-components/es/components/pagination/index.js"),Zs=()=>import("@carbon/web-components/es/components/code-snippet/index.js"),G=()=>import("@carbon/web-components/es/components/tag/index.js"),Js=()=>import("@carbon/web-components/es/components/badge-indicator/index.js"),$=()=>import("@carbon/web-components/es/components/notification/index.js"),Ks=()=>import("@carbon/web-components/es/components/loading/index.js"),Qs=()=>import("@carbon/web-components/es/components/inline-loading/index.js"),Xs=()=>import("@carbon/web-components/es/components/progress-bar/index.js"),Ys=()=>import("@carbon/web-components/es/components/progress-indicator/index.js"),tn=()=>import("@carbon/web-components/es/components/skeleton-placeholder/index.js"),en=()=>import("@carbon/web-components/es/components/skeleton-text/index.js"),P=()=>import("@carbon/web-components/es/components/modal/index.js"),k=()=>import("@carbon/web-components/es/components/tooltip/index.js"),sn=()=>import("@carbon/web-components/es/components/popover/index.js"),nn=()=>import("@carbon/web-components/es/components/toggle-tip/index.js"),nt=()=>import("@carbon/web-components/es/components/heading/index.js"),an=()=>import("@carbon/web-components/es/components/icon/index.js"),on=()=>import("@carbon/web-components/es/components/icon-indicator/index.js"),q={"cds-table":[k,H,j,tt,U,st,Vs],"cds-pagination":[U,j,st],"cds-button":[k,H],"cds-icon-button:not([data-toggle])":[k,Y],"cds-icon-button[data-toggle]":[k,Y],"cds-button[data-fab]":[k,H],"cds-copy-button":[k,Bs],"cds-combo-button":[k,Ds],"cds-checkbox":[Ns],"cds-radio-button-group":[Ms],"cds-toggle":[Ts],"cds-select":[U],"cds-slider":[qs],"cds-text-input":[j],"cds-textarea":[Os],"cds-number-input":[zs],"cds-password-input":[k,Fs],"cds-search":[tt],"cds-dropdown":[Ls],"cds-combo-box":[Rs],"cds-multi-select":[Hs],"cds-date-picker":[Us],"cds-time-picker":[js],"cds-file-uploader":[Gs],"cds-tabs":[ys],"cds-accordion":[Is],"cds-content-switcher":[xs],"cds-breadcrumb":[R],"cds-breadcrumb-item":[R],"cds-breadcrumb-link":[R],"cds-menu":[X],"cds-menu-button":[X],"cds-overflow-menu":[ws],"cds-structured-list":[ks],"cds-contained-list":[L],"cds-contained-list-item":[L],"cds-contained-list-description":[L],"cds-tree-view":[_s],"cds-modal":[P],"cds-modal-header":[P],"cds-modal-heading":[P],"cds-modal-label":[P],"cds-modal-close-button":[P],"cds-modal-body":[P],"cds-modal-body-content":[P],"cds-modal-footer":[P],"cds-modal-footer-button":[P],"cds-toast-notification":[$],"cds-inline-notification":[$],"cds-actionable-notification":[$],"cds-tile":[D],"cds-tile-group":[D],"cds-clickable-tile":[D],"cds-expandable-tile":[D],"cds-selectable-tile":[D],"cds-radio-tile":[D],"cds-progress-bar":[Xs],"cds-progress-indicator":[Ys],"cds-inline-loading":[Qs],"cds-tooltip":[k],"cds-popover":[sn],"cds-toggletip":[nn],"cds-tag":[G],"cds-dismissible-tag":[G],"cds-filter-tag":[G],"cds-link":[Cs],"cds-code-snippet":[Zs],"cds-form":[et],"cds-form-item":[et],"cds-form-group":[$s],"cds-stack":[Ps],"cds-heading":[nt],"cds-section":[nt],"cds-icon":[an],"cds-icon-indicator":[on],"cds-badge-indicator":[Js],"cds-loading":[Ks],"cds-skeleton-text":[en],"cds-skeleton-placeholder":[tn]};function rn(t){const e=new Map;if(!t||!(t instanceof Element))return e;for(const s of Object.keys(T))e.set(s,[]);for(const[s]of Object.entries(T))t.matches(s)&&e.get(s).push(t);const n=t.querySelectorAll("*");for(const s of n)for(const[a]of Object.entries(T))s.matches(a)&&e.get(a).push(s);for(const[s,a]of e.entries())a.length===0&&e.delete(s);return e}function cn(t){const e=new Set;for(const[n,s]of t.entries())s.length>0&&q[n]&&q[n].forEach(a=>e.add(a));return e}async function ln(t,e){if(t.size===0)return;const n=Array.from(t).map(async s=>(e.has(s)||e.set(s,s()),e.get(s)));await Promise.all(n)}function dn(t,e){let n=0;for(const[s,a]of t.entries()){const o=T[s];a.forEach(r=>{if(o.init){o.init.call(e,r);return}if(o.multiEvent){const A=c.getSemanticAttributes(r);o.events.forEach(W=>{const x=c.getEventAttribute(r,W.attrName,"event");x&&e.listen(r,W.type,O=>{e.dispatchPanelEvent(x,W.getData(O,A,r))})});return}const d=c.getSemanticAttributes(r),u=d.event;u&&e.listen(r,o.event,A=>{A.stopPropagation();const W=o.getData(A,d,r),x=W._eventOverride||u;delete W._eventOverride,e.dispatchPanelEvent(x,W)})}),n+=a.length}return n}var T=Object.fromEntries(Ws()),pn=async function(t,e){const n=rn(t);if(n.size===0){this.debugMe("[Carbon] No Carbon components found in panel");return}this.carbonComponents||(this.carbonComponents=new Map);for(const[o,r]of n.entries())this.carbonComponents.set(o,r);const s=cn(n);if(s.size>0)try{await ln(s,e)}catch(o){console.error("[Carbon] Failed to load some component modules:",o)}const a=dn(n,this);a>0&&this.debugMe(`[Carbon] Total components initialized: ${a}`)},un=(t={})=>{const{preload:e=[]}=t,n=new Map;if(e.length>0){const s=e.filter(o=>q[o]?!0:(console.warn(`[Carbon] No import found for selector: ${o}`),!1)),a=s.flatMap(o=>q[o].map(r=>(n.has(r)||n.set(r,r()),n.get(r))));Promise.all(a).then(()=>console.debug(`[Carbon] Preloaded: ${s.join(", ")}`)).catch(o=>console.warn("[Carbon] Preload error:",o))}m.ComponentLibraryRegistry.register("carbon",{cache:n,render:async function(s,a){try{await pn.call(this,s,a)}catch(o){console.error("[Carbon] Initialization error:",o)}},dispose:function(s){},config:{version:"2.0",description:"IBM Carbon Design System Web Components"}}),console.debug("[Zooy] Carbon Design System library registered")};exports.registerCarbonLibrary=un;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as h, t as bt } from "./component-library-registry-DB5UeqC2.js";
|
|
2
|
-
import { i as Et, n as W, r } from "./zoo-
|
|
2
|
+
import { i as Et, n as W, r } from "./zoo-CaW98OQn.js";
|
|
3
3
|
import { isDefAndNotNull as Wt, objToPaths as St } from "badu";
|
|
4
4
|
import * as _ from "ramda";
|
|
5
5
|
import { TABLE_SORT_DIRECTION as It } from "@carbon/web-components/lib/components/data-table/defs.js";
|
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
import { n as w, t as p } from "./component-library-registry-DB5UeqC2.js";
|
|
2
|
+
import { isDefAndNotNull as f } from "badu";
|
|
3
|
+
import { assocPath as k, both as _, has as v, path as g } from "ramda";
|
|
4
|
+
import { LitElement as y, css as z, html as c } from "lit";
|
|
5
|
+
var $ = {
|
|
6
|
+
json: (t) => JSON.stringify(t, null, 2),
|
|
7
|
+
tpl: (t, i, e) => {
|
|
8
|
+
const r = e?.getAttribute("zoo-bind-attr-tpl") || e?.getAttribute("zoo-bind-tpl");
|
|
9
|
+
if (!r) return t;
|
|
10
|
+
try {
|
|
11
|
+
return new Function("value", "data", `return \`${r}\`;`)(t, i);
|
|
12
|
+
} catch (a) {
|
|
13
|
+
return console.warn("[Binder] Invalid template:", r, a), t;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}, F = class {
|
|
17
|
+
#s;
|
|
18
|
+
#t;
|
|
19
|
+
#i;
|
|
20
|
+
#e = null;
|
|
21
|
+
#r;
|
|
22
|
+
constructor(t, i, e, r = {}) {
|
|
23
|
+
if (!i) throw new Error("Binder requires a URL");
|
|
24
|
+
if (!e || !(e instanceof Element)) throw new Error("Binder requires a valid rootEl Element");
|
|
25
|
+
this.#s = t, this.#t = new URL(i, window.location.origin), this.#i = e, this.#r = {
|
|
26
|
+
...$,
|
|
27
|
+
...r.formatters
|
|
28
|
+
}, r.urlParams ? this.#n(r.urlParams) : this.#a();
|
|
29
|
+
}
|
|
30
|
+
get url() {
|
|
31
|
+
return this.#t;
|
|
32
|
+
}
|
|
33
|
+
get data() {
|
|
34
|
+
return this.#e;
|
|
35
|
+
}
|
|
36
|
+
get limit() {
|
|
37
|
+
return parseInt(this.#t.searchParams.get("limit") || "0", 10);
|
|
38
|
+
}
|
|
39
|
+
get offset() {
|
|
40
|
+
return parseInt(this.#t.searchParams.get("offset") || "0", 10);
|
|
41
|
+
}
|
|
42
|
+
get isPaginated() {
|
|
43
|
+
return _(v("count"), v("results"))(this.#e);
|
|
44
|
+
}
|
|
45
|
+
#n(t) {
|
|
46
|
+
return Object.entries(t).forEach(([i, e]) => {
|
|
47
|
+
if (!f(e) || e === "" || Array.isArray(e) && e.length < 1) {
|
|
48
|
+
this.#t.searchParams.delete(i);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (Array.isArray(e)) {
|
|
52
|
+
this.#t.searchParams.set(i, e.join(","));
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
this.#t.searchParams.set(i, e);
|
|
56
|
+
}), this.#a(), this.#t;
|
|
57
|
+
}
|
|
58
|
+
#a() {
|
|
59
|
+
const t = this.#t.href.split(this.url.origin)[1].slice(1);
|
|
60
|
+
this.#i.querySelectorAll("[zoo-bind-binderurl]").forEach((i) => {
|
|
61
|
+
i.setAttribute("zoo-bind-binderurl", t);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
async fetchData(t = {}) {
|
|
65
|
+
const i = await this.#s.user.fetchJson(this.#n(t).toString(), this.#s.abortController.signal);
|
|
66
|
+
this.setData(i);
|
|
67
|
+
}
|
|
68
|
+
setData(t) {
|
|
69
|
+
this.#e = t, this.render();
|
|
70
|
+
}
|
|
71
|
+
render() {
|
|
72
|
+
if (!f(this.#e)) {
|
|
73
|
+
console.warn("[Binder] No data to render");
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
this.#a(), this.#o(this.#i, this.#e, 0), this.#c();
|
|
77
|
+
}
|
|
78
|
+
#o(t, i, e = 0, r = {}) {
|
|
79
|
+
const a = r.removeAttributes ?? !1;
|
|
80
|
+
t.querySelectorAll("[zoo-bind-attr]").forEach((s) => {
|
|
81
|
+
s.closest("[zoo-template]") || (s.getAttribute("zoo-bind-attr").split(",").forEach((n) => {
|
|
82
|
+
const [o, l] = n.split(":").map((d) => d.trim()), [h, m] = l.split("|").map((d) => d.trim());
|
|
83
|
+
let u = this.#l(i, h, e);
|
|
84
|
+
m && this.#r[m] && (u = this.#r[m](u, i, s)), f(u) && s.setAttribute(o, u);
|
|
85
|
+
}), a && (s.removeAttribute("zoo-bind-attr"), s.removeAttribute("zoo-bind-attr-tpl")));
|
|
86
|
+
}), t.querySelectorAll("[zoo-bind]").forEach((s) => {
|
|
87
|
+
if (s.closest("[zoo-template]")) return;
|
|
88
|
+
const [n, o] = s.getAttribute("zoo-bind").split("|").map((h) => h.trim());
|
|
89
|
+
let l = this.#l(i, n, e);
|
|
90
|
+
o && this.#r[o] && (l = this.#r[o](l, i, s)), s.textContent = l ?? "", a && (s.removeAttribute("zoo-bind"), s.removeAttribute("zoo-bind-tpl"));
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
#c() {
|
|
94
|
+
this.#i.querySelectorAll("[zoo-template]").forEach((t) => {
|
|
95
|
+
const i = t.getAttribute("zoo-template"), e = t.getAttribute("zoo-template-bind");
|
|
96
|
+
if (!i) {
|
|
97
|
+
console.warn("[Binder] Consumer missing template ID", t);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const r = this.#i.querySelector(`#${i}`);
|
|
101
|
+
if (!r || r.tagName !== "TEMPLATE") {
|
|
102
|
+
console.error(`[DataBinder] Template not found or invalid: ${i}`);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const a = e ? g(e.split("."), this.#e) : this.#e;
|
|
106
|
+
if (!a) {
|
|
107
|
+
console.warn(`[DataBinder] Data slice is undefined. Path: ${e}. Skipping render for this consumer.`);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (!Array.isArray(a)) {
|
|
111
|
+
console.error(`[DataBinder] Data slice is not an array. Path: ${e}`, a);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (t.innerHTML = "", a.forEach((s, n) => {
|
|
115
|
+
const o = this.#u(r, s, n);
|
|
116
|
+
t.appendChild(o);
|
|
117
|
+
}), p.has("carbon")) {
|
|
118
|
+
const s = p.get("carbon");
|
|
119
|
+
s.render.call(this.#s, t, s.cache).catch((n) => console.error("[Binder] Carbon init failed:", n));
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
#u(t, i, e) {
|
|
124
|
+
const r = t.content.cloneNode(!0);
|
|
125
|
+
return this.#o(r, i, e, { removeAttributes: !0 }), r;
|
|
126
|
+
}
|
|
127
|
+
#l(t, i, e) {
|
|
128
|
+
const r = {
|
|
129
|
+
$index: () => e,
|
|
130
|
+
$index__paged: () => this.offset + e,
|
|
131
|
+
$index1: () => e + 1,
|
|
132
|
+
$index1__paged: () => this.offset + e + 1
|
|
133
|
+
};
|
|
134
|
+
return r[i] ? r[i]() : g(i.split("."), t);
|
|
135
|
+
}
|
|
136
|
+
}, b = new Map(Object.entries({
|
|
137
|
+
event: "event",
|
|
138
|
+
endpoint: "endpoint",
|
|
139
|
+
href: "href",
|
|
140
|
+
url: "url",
|
|
141
|
+
target: "target",
|
|
142
|
+
"record-id": "recordId",
|
|
143
|
+
"zoo-sort-field": "sortField",
|
|
144
|
+
"zoo-view": "view",
|
|
145
|
+
"zoo-event": "event",
|
|
146
|
+
"zoo-href": "href"
|
|
147
|
+
})), E = (t) => {
|
|
148
|
+
let i = {};
|
|
149
|
+
return Array.from(t.attributes).forEach((e) => {
|
|
150
|
+
const r = e.name, a = e.value;
|
|
151
|
+
b.has(r) ? i[b.get(r)] = a : (r.startsWith("data-") || r.startsWith("zoo-")) && (i = k(r.split("-"), a, i));
|
|
152
|
+
}), i;
|
|
153
|
+
}, L = (t, i, e = "event") => t.getAttribute(i) || t.getAttribute(e), T = class extends y {
|
|
154
|
+
static properties = {
|
|
155
|
+
token: { type: String },
|
|
156
|
+
prefix: { type: String },
|
|
157
|
+
postfix: { type: String }
|
|
158
|
+
};
|
|
159
|
+
static styles = z`
|
|
160
|
+
:host {
|
|
161
|
+
display: inline-block;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.tag {
|
|
165
|
+
text-align: center;
|
|
166
|
+
display: inline-flex;
|
|
167
|
+
align-items: center;
|
|
168
|
+
justify-content: center;
|
|
169
|
+
line-height: initial;
|
|
170
|
+
width: max-content;
|
|
171
|
+
padding: 0.2em 1em;
|
|
172
|
+
border-radius: 1em;
|
|
173
|
+
font-size: var(--zoo-theme-chips-font-size, 0.75rem);
|
|
174
|
+
white-space: nowrap;
|
|
175
|
+
word-break: break-word;
|
|
176
|
+
box-sizing: border-box;
|
|
177
|
+
}
|
|
178
|
+
`;
|
|
179
|
+
render() {
|
|
180
|
+
const t = `${this.prefix ?? ""}${this.token ?? "default"}${this.postfix ?? ""}`;
|
|
181
|
+
return c`
|
|
182
|
+
<span
|
|
183
|
+
class="tag"
|
|
184
|
+
style="
|
|
185
|
+
background-color: var(--zoo-tag-${t}-bg, var(--zoo-tag-default-bg, #9e9e9e));
|
|
186
|
+
color: var(--zoo-tag-${t}-fg, var(--zoo-tag-default-fg, #ffffff));
|
|
187
|
+
"
|
|
188
|
+
>
|
|
189
|
+
<slot></slot>
|
|
190
|
+
</span>
|
|
191
|
+
`;
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
customElements.get("zoo-tag") || customElements.define("zoo-tag", T);
|
|
195
|
+
var x = (t) => {
|
|
196
|
+
const i = Math.floor((/* @__PURE__ */ new Date() - t) / 1e3), e = [
|
|
197
|
+
{
|
|
198
|
+
name: "year",
|
|
199
|
+
seconds: 31536e3
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
name: "month",
|
|
203
|
+
seconds: 2592e3
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
name: "week",
|
|
207
|
+
seconds: 604800
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
name: "day",
|
|
211
|
+
seconds: 86400
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
name: "hour",
|
|
215
|
+
seconds: 3600
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
name: "minute",
|
|
219
|
+
seconds: 60
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
name: "second",
|
|
223
|
+
seconds: 1
|
|
224
|
+
}
|
|
225
|
+
];
|
|
226
|
+
if (i < 0) {
|
|
227
|
+
const r = Math.abs(i);
|
|
228
|
+
for (const a of e) {
|
|
229
|
+
const s = Math.floor(r / a.seconds);
|
|
230
|
+
if (s >= 1) return new Intl.RelativeTimeFormat("en", { numeric: "auto" }).format(s, a.name);
|
|
231
|
+
}
|
|
232
|
+
return "just now";
|
|
233
|
+
}
|
|
234
|
+
for (const r of e) {
|
|
235
|
+
const a = Math.floor(i / r.seconds);
|
|
236
|
+
if (a >= 1) return new Intl.RelativeTimeFormat("en", { numeric: "auto" }).format(-a, r.name);
|
|
237
|
+
}
|
|
238
|
+
return "just now";
|
|
239
|
+
}, S = (t) => {
|
|
240
|
+
const [{ value: i }, , { value: e }, , { value: r }, , { value: a }, , { value: s }, , { value: n }] = new Intl.DateTimeFormat("en", {
|
|
241
|
+
day: "2-digit",
|
|
242
|
+
month: "short",
|
|
243
|
+
year: "2-digit",
|
|
244
|
+
hour: "2-digit",
|
|
245
|
+
minute: "2-digit",
|
|
246
|
+
second: "2-digit",
|
|
247
|
+
hourCycle: "h23"
|
|
248
|
+
}).formatToParts(t);
|
|
249
|
+
return `${e} ${i} ${r} ${a}:${s}:${n}`;
|
|
250
|
+
}, D = (t) => {
|
|
251
|
+
const [{ value: i }, , { value: e }, , { value: r }] = new Intl.DateTimeFormat("en", {
|
|
252
|
+
day: "2-digit",
|
|
253
|
+
month: "short",
|
|
254
|
+
year: "2-digit"
|
|
255
|
+
}).formatToParts(t);
|
|
256
|
+
return `${e} ${i} ${r}`;
|
|
257
|
+
}, A = class extends y {
|
|
258
|
+
static properties = {
|
|
259
|
+
timestamp: { type: Number },
|
|
260
|
+
kind: { type: String },
|
|
261
|
+
concat: { type: String }
|
|
262
|
+
};
|
|
263
|
+
static styles = z`
|
|
264
|
+
:host {
|
|
265
|
+
display: inline;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.relative {
|
|
269
|
+
color: var(--zoo-timestamp-relative-color, inherit);
|
|
270
|
+
font-weight: var(--zoo-timestamp-relative-weight, inherit);
|
|
271
|
+
font-size: var(--zoo-timestamp-relative-size, inherit);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.static {
|
|
275
|
+
color: var(--zoo-timestamp-static-color, inherit);
|
|
276
|
+
font-weight: var(--zoo-timestamp-static-weight, inherit);
|
|
277
|
+
font-size: var(--zoo-timestamp-static-size, inherit);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.separator {
|
|
281
|
+
color: var(--zoo-timestamp-separator-color, inherit);
|
|
282
|
+
}
|
|
283
|
+
`;
|
|
284
|
+
constructor() {
|
|
285
|
+
super(), this.timestamp = Date.now(), this.kind = "both", this.concat = "r (s)", this._boundTickHandler = this._onTimeTick.bind(this), this._isListening = !1;
|
|
286
|
+
}
|
|
287
|
+
_shouldListenToTicks() {
|
|
288
|
+
return this.kind === "relative" || this.kind === "both";
|
|
289
|
+
}
|
|
290
|
+
connectedCallback() {
|
|
291
|
+
super.connectedCallback(), this._updateTickListener();
|
|
292
|
+
}
|
|
293
|
+
disconnectedCallback() {
|
|
294
|
+
this._removeTickListener(), super.disconnectedCallback();
|
|
295
|
+
}
|
|
296
|
+
updated(t) {
|
|
297
|
+
super.updated(t), t.has("kind") && this._updateTickListener();
|
|
298
|
+
}
|
|
299
|
+
_updateTickListener() {
|
|
300
|
+
const t = this._shouldListenToTicks();
|
|
301
|
+
t && !this._isListening ? (document.addEventListener("zoo-tick-60", this._boundTickHandler), this._isListening = !0) : !t && this._isListening && this._removeTickListener();
|
|
302
|
+
}
|
|
303
|
+
_removeTickListener() {
|
|
304
|
+
this._isListening && (document.removeEventListener("zoo-tick-60", this._boundTickHandler), this._isListening = !1);
|
|
305
|
+
}
|
|
306
|
+
_onTimeTick() {
|
|
307
|
+
this.requestUpdate();
|
|
308
|
+
}
|
|
309
|
+
_parseTemplate(t) {
|
|
310
|
+
const i = [];
|
|
311
|
+
let e = t;
|
|
312
|
+
for (; e.length > 0; ) {
|
|
313
|
+
const r = e.indexOf("r"), a = [r, e.indexOf("s")].filter((s) => s !== -1).sort((s, n) => s - n)[0];
|
|
314
|
+
if (a === void 0) {
|
|
315
|
+
e.length > 0 && i.push({
|
|
316
|
+
type: "text",
|
|
317
|
+
value: e
|
|
318
|
+
});
|
|
319
|
+
break;
|
|
320
|
+
}
|
|
321
|
+
a > 0 && i.push({
|
|
322
|
+
type: "text",
|
|
323
|
+
value: e.substring(0, a)
|
|
324
|
+
}), a === r ? i.push({
|
|
325
|
+
type: "relative",
|
|
326
|
+
value: ""
|
|
327
|
+
}) : i.push({
|
|
328
|
+
type: "static",
|
|
329
|
+
value: ""
|
|
330
|
+
}), e = e.substring(a + 1);
|
|
331
|
+
}
|
|
332
|
+
return i;
|
|
333
|
+
}
|
|
334
|
+
_getFormattedParts() {
|
|
335
|
+
let t = this.timestamp;
|
|
336
|
+
t < 9466848e5 && (t = t * 1e3);
|
|
337
|
+
const i = new Date(t), e = x(i), r = S(i), a = D(i);
|
|
338
|
+
switch (this.kind) {
|
|
339
|
+
case "relative":
|
|
340
|
+
return [{
|
|
341
|
+
type: "relative",
|
|
342
|
+
value: e
|
|
343
|
+
}];
|
|
344
|
+
case "datetime":
|
|
345
|
+
return [{
|
|
346
|
+
type: "static",
|
|
347
|
+
value: r
|
|
348
|
+
}];
|
|
349
|
+
case "date":
|
|
350
|
+
return [{
|
|
351
|
+
type: "static",
|
|
352
|
+
value: a
|
|
353
|
+
}];
|
|
354
|
+
case "both":
|
|
355
|
+
return this._parseTemplate(this.concat).map((s) => s.type === "relative" ? {
|
|
356
|
+
type: "relative",
|
|
357
|
+
value: e
|
|
358
|
+
} : s.type === "static" ? {
|
|
359
|
+
type: "static",
|
|
360
|
+
value: r
|
|
361
|
+
} : s);
|
|
362
|
+
default:
|
|
363
|
+
return this._parseTemplate(this.concat).map((s) => s.type === "relative" ? {
|
|
364
|
+
type: "relative",
|
|
365
|
+
value: e
|
|
366
|
+
} : s.type === "static" ? {
|
|
367
|
+
type: "static",
|
|
368
|
+
value: r
|
|
369
|
+
} : s);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
render() {
|
|
373
|
+
let t = this.timestamp;
|
|
374
|
+
t < 9466848e5 && (t = t * 1e3);
|
|
375
|
+
const i = new Date(t), e = this._getFormattedParts();
|
|
376
|
+
return c`<time datetime="${i.toISOString()}">
|
|
377
|
+
${e.map((r) => r.type === "relative" ? c`<span class="relative">${r.value}</span>` : r.type === "static" ? c`<span class="static">${r.value}</span>` : c`<span class="separator">${r.value}</span>`)}
|
|
378
|
+
</time>`;
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
customElements.get("zoo-timestamp") || customElements.define("zoo-timestamp", A);
|
|
382
|
+
var M = /* @__PURE__ */ w({
|
|
383
|
+
ZooTag: () => T,
|
|
384
|
+
ZooTimestamp: () => A,
|
|
385
|
+
getEventAttribute: () => L,
|
|
386
|
+
getSemanticAttributes: () => E
|
|
387
|
+
});
|
|
388
|
+
export {
|
|
389
|
+
F as i,
|
|
390
|
+
L as n,
|
|
391
|
+
E as r,
|
|
392
|
+
M as t
|
|
393
|
+
};
|