@esri/calcite-components
Version:
Web Components for Esri's Calcite Design System.
7 lines • 13.3 kB
JavaScript
/*!
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
* v1.5.0-next.4
*/
const e="calcite";let t,n,l=!1,s=!1;const o=e=>{const t=new URL(e,ye.t);return t.origin!==me.location.origin?t.href:t.pathname},i="s-id",c="sty-id",r="c-id",u="http://www.w3.org/1999/xlink",a={},f=e=>"object"==(e=typeof e)||"function"===e;function $(e){var t,n,l;return null!==(l=null===(n=null===(t=e.head)||void 0===t?void 0:t.querySelector('meta[name="csp-nonce"]'))||void 0===n?void 0:n.getAttribute("content"))&&void 0!==l?l:void 0}const d=(e,t,...n)=>{let l=null,s=null,o=!1,i=!1;const c=[],r=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?r(l):null!=l&&"boolean"!=typeof l&&((o="function"!=typeof e&&!f(l))&&(l+=""),o&&i?c[c.length-1].l+=l:c.push(o?h(null,l):l),i=o)};if(r(n),t){t.key&&(s=t.key);{const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}}if("function"==typeof e)return e(null===t?{}:t,c,p);const u=h(e,null);return u.o=t,c.length>0&&(u.i=c),u.u=s,u},h=(e,t)=>({$:0,h:e,l:t,m:null,i:null,o:null,u:null}),m={},p={forEach:(e,t)=>e.map(y).forEach(t),map:(e,t)=>e.map(y).map(t).map(w)},y=e=>({vattrs:e.o,vchildren:e.i,vkey:e.u,vname:e.p,vtag:e.h,vtext:e.l}),w=e=>{if("function"==typeof e.vtag){const t=Object.assign({},e.vattrs);return e.vkey&&(t.key=e.vkey),e.vname&&(t.name=e.vname),d(e.vtag,t,...e.vchildren||[])}const t=h(e.vtag,e.vtext);return t.o=e.vattrs,t.i=e.vchildren,t.u=e.vkey,t.p=e.vname,t},b=(e,t,n,l,s,o,i)=>{let c,u,a,f;if(1===o.nodeType){for(c=o.getAttribute(r),c&&(u=c.split("."),u[0]!==i&&"0"!==u[0]||(a={$:0,v:u[0],g:u[1],k:u[2],j:u[3],h:o.tagName.toLowerCase(),m:o,o:null,i:null,u:null,p:null,l:null},t.push(a),o.removeAttribute(r),e.i||(e.i=[]),e.i[a.j]=a,e=a,l&&"0"===a.k&&(l[a.j]=a.m))),f=o.childNodes.length-1;f>=0;f--)b(e,t,n,l,s,o.childNodes[f],i);if(o.shadowRoot)for(f=o.shadowRoot.childNodes.length-1;f>=0;f--)b(e,t,n,l,s,o.shadowRoot.childNodes[f],i)}else if(8===o.nodeType)u=o.nodeValue.split("."),u[1]!==i&&"0"!==u[1]||(c=u[0],a={$:0,v:u[1],g:u[2],k:u[3],j:u[4],m:o,o:null,i:null,u:null,p:null,h:null,l:null},"t"===c?(a.m=o.nextSibling,a.m&&3===a.m.nodeType&&(a.l=a.m.textContent,t.push(a),o.remove(),e.i||(e.i=[]),e.i[a.j]=a,l&&"0"===a.k&&(l[a.j]=a.m))):a.v===i&&("s"===c?(a.h="slot",o["s-sn"]=u[5]?a.p=u[5]:"",o["s-sr"]=!0,l&&(a.m=pe.createElement(a.h),a.p&&a.m.setAttribute("name",a.p),o.parentNode.insertBefore(a.m,o),o.remove(),"0"===a.k&&(l[a.j]=a.m)),n.push(a),e.i||(e.i=[]),e.i[a.j]=a):"r"===c&&l&&o.remove()));else if(e&&"style"===e.h){const t=h(null,o.textContent);t.m=o,t.j="0",e.i=[t]}},v=(e,t)=>{if(1===e.nodeType){let n=0;for(;n<e.childNodes.length;n++)v(e.childNodes[n],t);if(e.shadowRoot)for(n=0;n<e.shadowRoot.childNodes.length;n++)v(e.shadowRoot.childNodes[n],t)}else if(8===e.nodeType){const n=e.nodeValue.split(".");"o"===n[0]&&(t.set(n[1]+"."+n[2],e),e.nodeValue="",e["s-en"]=n[3])}},g=e=>ce(e).S,k=(e,t,n)=>{const l=g(e);return{emit:e=>j(l,t,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:e})}},j=(e,t,n)=>{const l=ye.ce(t,n);return e.dispatchEvent(l),l},S=new WeakMap,x=(e,t,n)=>{let l=he.get(e);ve&&n?(l=l||new CSSStyleSheet,"string"==typeof l?l=t:l.replaceSync(t)):l=t,he.set(e,l)},O=(e,t)=>{var n;let l=M(t);const s=he.get(l);if(e=11===e.nodeType?e:pe,s)if("string"==typeof s){let t,o=S.get(e=e.head||e);if(o||S.set(e,o=new Set),!o.has(l)){if(e.host&&(t=e.querySelector(`[${c}="${l}"]`)))t.innerHTML=s;else{t=pe.createElement("style"),t.innerHTML=s;const l=null!==(n=ye.O)&&void 0!==n?n:$(pe);null!=l&&t.setAttribute("nonce",l),e.insertBefore(t,e.querySelector("link"))}o&&o.add(l)}}else e.adoptedStyleSheets.includes(s)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,s]);return l},M=e=>"sc-"+e.M,C=e=>e.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g,"$1{"),L=(e,t,n,l,s,o)=>{if(n!==l){let i=ae(e,t),c=t.toLowerCase();if("class"===t){const t=e.classList,s=R(n),o=R(l);t.remove(...s.filter((e=>e&&!o.includes(e)))),t.add(...o.filter((e=>e&&!s.includes(e))))}else if("style"===t){for(const t in n)l&&null!=l[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in l)n&&l[t]===n[t]||(t.includes("-")?e.style.setProperty(t,l[t]):e.style[t]=l[t])}else if("key"===t);else if("ref"===t)l&&l(e);else if(i||"o"!==t[0]||"n"!==t[1]){const r=f(l);if((i||r&&null!==l)&&!s)try{if(e.tagName.includes("-"))e[t]=l;else{const s=null==l?"":l;"list"===t?i=!1:null!=n&&e[t]==s||(e[t]=s)}}catch(e){}let a=!1;c!==(c=c.replace(/^xlink\:?/,""))&&(t=c,a=!0),null==l||!1===l?!1===l&&""!==e.getAttribute(t)||(a?e.removeAttributeNS(u,t):e.removeAttribute(t)):(!i||4&o||s)&&!r&&(l=!0===l?"":l,a?e.setAttributeNS(u,t,l):e.setAttribute(t,l))}else t="-"===t[2]?t.slice(3):ae(me,c)?c.slice(2):c[2]+t.slice(3),n&&ye.rel(e,t,n,!1),l&&ye.ael(e,t,l,!1)}},P=/\s/,R=e=>e?e.split(P):[],E=(e,t,n,l)=>{const s=11===t.m.nodeType&&t.m.host?t.m.host:t.m,o=e&&e.o||a,i=t.o||a;for(l in o)l in i||L(s,l,o[l],void 0,n,t.$);for(l in i)L(s,l,o[l],i[l],n,t.$)},F=(e,n,s)=>{const o=n.i[s];let i,c,r=0;if(null!==o.l)i=o.m=pe.createTextNode(o.l);else{if(l||(l="svg"===o.h),i=o.m=pe.createElementNS(l?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",o.h),l&&"foreignObject"===o.h&&(l=!1),E(null,o,l),null!=t&&i["s-si"]!==t&&i.classList.add(i["s-si"]=t),o.i)for(r=0;r<o.i.length;++r)c=F(e,o,r),c&&i.appendChild(c);"svg"===o.h?l=!1:"foreignObject"===i.tagName&&(l=!0)}return i},I=(e,t,l,s,o,i)=>{let c,r=e;for(r.shadowRoot&&r.tagName===n&&(r=r.shadowRoot);o<=i;++o)s[o]&&(c=F(null,l,o),c&&(s[o].m=c,r.insertBefore(c,t)))},N=(e,t,n,l,s)=>{for(;t<=n;++t)(l=e[t])&&(s=l.m,U(l),s.remove())},W=(e,t)=>e.h===t.h&&e.u===t.u,T=(e,t)=>{const n=t.m=e.m,s=e.i,o=t.i,i=t.h,c=t.l;null===c?(l="svg"===i||"foreignObject"!==i&&l,"slot"===i||E(e,t,l),null!==s&&null!==o?((e,t,n,l)=>{let s,o,i=0,c=0,r=0,u=0,a=t.length-1,f=t[0],$=t[a],d=l.length-1,h=l[0],m=l[d];for(;i<=a&&c<=d;)if(null==f)f=t[++i];else if(null==$)$=t[--a];else if(null==h)h=l[++c];else if(null==m)m=l[--d];else if(W(f,h))T(f,h),f=t[++i],h=l[++c];else if(W($,m))T($,m),$=t[--a],m=l[--d];else if(W(f,m))T(f,m),e.insertBefore(f.m,$.m.nextSibling),f=t[++i],m=l[--d];else if(W($,h))T($,h),e.insertBefore($.m,f.m),$=t[--a],h=l[++c];else{for(r=-1,u=i;u<=a;++u)if(t[u]&&null!==t[u].u&&t[u].u===h.u){r=u;break}r>=0?(o=t[r],o.h!==h.h?s=F(t&&t[c],n,r):(T(o,h),t[r]=void 0,s=o.m),h=l[++c]):(s=F(t&&t[c],n,c),h=l[++c]),s&&f.m.parentNode.insertBefore(s,f.m)}i>a?I(e,null==l[d+1]?null:l[d+1].m,n,l,c,d):c>d&&N(t,i,a)})(n,s,t,o):null!==o?(null!==e.l&&(n.textContent=""),I(n,null,t,o,0,o.length-1)):null!==s&&N(s,0,s.length-1),l&&"svg"===i&&(l=!1)):e.l!==c&&(n.data=c)},U=e=>{e.o&&e.o.ref&&e.o.ref(null),e.i&&e.i.map(U)},A=(e,t)=>{t&&!e.C&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.C=t)))},D=(e,t)=>{if(e.$|=16,!(4&e.$))return A(e,e.L),Ce((()=>H(e,t)));e.$|=512},H=(e,t)=>{const n=e.P;let l;return t&&(e.$|=256,e.R&&(e.R.map((([e,t])=>G(n,e,t))),e.R=null),l=G(n,"componentWillLoad")),l=J(l,(()=>G(n,"componentWillRender"))),J(l,(()=>q(e,n,t)))},q=async(e,t,n)=>{const l=e.S,s=l["s-rc"];n&&(e=>{const t=e.F,n=e.S,l=t.$,s=O(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&l&&(n["s-sc"]=s,n.classList.add(s+"-h"))})(e);V(e,t),s&&(s.map((e=>e())),l["s-rc"]=void 0);{const t=l["s-p"],n=()=>_(e);0===t.length?n():(Promise.all(t).then(n),e.$|=4,t.length=0)}},V=(e,l)=>{try{l=l.render(),e.$&=-17,e.$|=2,((e,l)=>{const s=e.S,o=e.F,i=e.I||h(null,null),c=(e=>e&&e.h===m)(l)?l:d(null,null,l);n=s.tagName,o.N&&(c.o=c.o||{},o.N.map((([e,t])=>c.o[t]=s[e]))),c.h=null,c.$|=4,e.I=c,c.m=i.m=s.shadowRoot||s,t=s["s-sc"],T(i,c)})(e,l)}catch(t){fe(t,e.S)}return null},_=e=>{const t=e.S,n=e.P,l=e.L;G(n,"componentDidRender"),64&e.$||(e.$|=64,K(t),G(n,"componentDidLoad"),e.W(t),l||B()),e.T(t),e.C&&(e.C(),e.C=void 0),512&e.$&&Oe((()=>D(e,!1))),e.$&=-517},z=e=>{{const t=ce(e),n=t.S.isConnected;return n&&2==(18&t.$)&&D(t,!1),n}},B=()=>{K(pe.documentElement),Oe((()=>j(me,"appload",{detail:{namespace:e}})))},G=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){fe(e)}},J=(e,t)=>e&&e.then?e.then(t):t(),K=e=>e.setAttribute("calcite-hydrated",""),Q=(e,t,n)=>{if(t.U){e.watchers&&(t.A=e.watchers);const l=Object.entries(t.U),s=e.prototype;if(l.map((([e,[l]])=>{31&l||2&n&&32&l?Object.defineProperty(s,e,{get(){return((e,t)=>ce(this).D.get(t))(0,e)},set(n){((e,t,n,l)=>{const s=ce(e),o=s.S,i=s.D.get(t),c=s.$,r=s.P;if(n=((e,t)=>null==e||f(e)?e:4&t?"false"!==e&&(""===e||!!e):2&t?parseFloat(e):1&t?e+"":e)(n,l.U[t][0]),(!(8&c)||void 0===i)&&n!==i&&(!Number.isNaN(i)||!Number.isNaN(n))&&(s.D.set(t,n),r)){if(l.A&&128&c){const e=l.A[t];e&&e.map((e=>{try{r[e](n,i,t)}catch(e){fe(e,o)}}))}if(2==(18&c)){if(r.componentShouldUpdate&&!1===r.componentShouldUpdate(n,i,t))return;D(s,!1)}}})(this,e,n,t)},configurable:!0,enumerable:!0}):1&n&&64&l&&Object.defineProperty(s,e,{value(...t){const n=ce(this);return n.H.then((()=>n.P[e](...t)))}})})),1&n){const n=new Map;s.attributeChangedCallback=function(e,t,l){ye.jmp((()=>{const t=n.get(e);if(this.hasOwnProperty(t))l=this[t],delete this[t];else if(s.hasOwnProperty(t)&&"number"==typeof this[t]&&this[t]==l)return;this[t]=(null!==l||"boolean"!=typeof this[t])&&l}))},e.observedAttributes=l.filter((([e,t])=>15&t[0])).map((([e,l])=>{const s=l[1]||e;return n.set(s,e),512&l[0]&&t.N.push([e,s]),s}))}}return e},X=e=>{G(e,"connectedCallback")},Y=e=>{if(0==(1&ye.$)){const t=ce(e),n=t.F,l=()=>{};if(1&t.$)te(e,t,n.q),X(t.P);else{let l;if(t.$|=1,l=e.getAttribute(i),l){if(1&n.$){const t=O(e.shadowRoot,n);e.classList.remove(t+"-h",t+"-s")}((e,t,n,l)=>{const s=e.shadowRoot,o=[],c=s?[]:null,r=l.I=h(t,null);ye.V||v(pe.body,ye.V=new Map),e[i]=n,e.removeAttribute(i),b(r,o,[],c,e,e,n),o.map((e=>{const n=e.v+"."+e.g,l=ye.V.get(n),o=e.m;l&&we&&""===l["s-en"]&&l.parentNode.insertBefore(o,l.nextSibling),s||(o["s-hn"]=t,l&&(o["s-ol"]=l,o["s-ol"]["s-nr"]=o)),ye.V.delete(n)})),s&&c.map((e=>{e&&s.appendChild(e)}))})(e,n.M,l,t)}{let n=e;for(;n=n.parentNode||n.host;)if(1===n.nodeType&&n.hasAttribute("s-id")&&n["s-p"]||n["s-p"]){A(t,t.L=n);break}}n.U&&Object.entries(n.U).map((([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}})),(async(e,t,n,l,s)=>{if(0==(32&t.$)){{if(t.$|=32,(s=de(n)).then){const e=()=>{};s=await s,e()}s.isProxied||(n.A=s.watchers,Q(s,n,2),s.isProxied=!0);const e=()=>{};t.$|=8;try{new s(t)}catch(e){fe(e)}t.$&=-9,t.$|=128,e(),X(t.P)}if(s.style){let e=s.style;const t=M(n);if(!he.has(t)){const l=()=>{};x(t,e,!!(1&n.$)),l()}}}const o=t.L,i=()=>D(t,!0);o&&o["s-rc"]?o["s-rc"].push(i):i()})(0,t,n)}l()}},Z=(e,t={})=>{var n;const l=[],s=t.exclude||[],o=me.customElements,i=pe.head,r=i.querySelector("meta[charset]"),u=pe.createElement("style"),a=[],f=pe.querySelectorAll(`[${c}]`);let d,h=!0,m=0;for(Object.assign(ye,t),ye.t=new URL(t.resourcesUrl||"./",pe.baseURI).href,ye.$|=2;m<f.length;m++)x(f[m].getAttribute(c),C(f[m].innerHTML),!0);e.map((e=>{e[1].map((t=>{const n={$:t[0],M:t[1],U:t[2],q:t[3]};n.U=t[2],n.q=t[3],n.N=[],n.A={};const i=n.M,c=class extends HTMLElement{constructor(e){super(e),ue(e=this,n),1&n.$&&e.attachShadow({mode:"open",delegatesFocus:!!(16&n.$)})}connectedCallback(){d&&(clearTimeout(d),d=null),h?a.push(this):ye.jmp((()=>Y(this)))}disconnectedCallback(){ye.jmp((()=>(()=>{if(0==(1&ye.$)){const e=ce(this),t=e.P;e._&&(e._.map((e=>e())),e._=void 0),G(t,"disconnectedCallback")}})()))}componentOnReady(){return ce(this).B}};n.G=e[0],s.includes(i)||o.get(i)||(l.push(i),o.define(i,Q(c,n,1)))}))}));{u.innerHTML=l+"{visibility:hidden}[calcite-hydrated]{visibility:inherit}",u.setAttribute("data-styles","");const e=null!==(n=ye.O)&&void 0!==n?n:$(pe);null!=e&&u.setAttribute("nonce",e),i.insertBefore(u,r?r.nextSibling:i.firstChild)}h=!1,a.length?a.map((e=>e.connectedCallback())):ye.jmp((()=>d=setTimeout(B,30)))},ee=(e,t)=>t,te=(e,t,n)=>{n&&n.map((([n,l,s])=>{const o=le(e,n),i=ne(t,s),c=se(n);ye.ael(o,l,i,c),(t._=t._||[]).push((()=>ye.rel(o,l,i,c)))}))},ne=(e,t)=>n=>{try{256&e.$?e.P[t](n):(e.R=e.R||[]).push([t,n])}catch(e){fe(e)}},le=(e,t)=>4&t?pe:8&t?me:16&t?pe.body:e,se=e=>0!=(2&e),oe=e=>ye.O=e,ie=new WeakMap,ce=e=>ie.get(e),re=(e,t)=>ie.set(t.P=e,t),ue=(e,t)=>{const n={$:0,S:e,F:t,D:new Map};return n.H=new Promise((e=>n.T=e)),n.B=new Promise((e=>n.W=e)),e["s-p"]=[],e["s-rc"]=[],te(e,n,t.q),ie.set(e,n)},ae=(e,t)=>t in e,fe=(e,t)=>(0,console.error)(e,t),$e=new Map,de=e=>{const t=e.M.replace(/-/g,"_"),n=e.G,l=$e.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>($e.set(n,e),e[t])),fe)
/*!__STENCIL_STATIC_IMPORT_SWITCH__*/},he=new Map,me="undefined"!=typeof window?window:{},pe=me.document||{head:{}},ye={$:0,t:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,l)=>e.addEventListener(t,n,l),rel:(e,t,n,l)=>e.removeEventListener(t,n,l),ce:(e,t)=>new CustomEvent(e,t)},we=!0,be=e=>Promise.resolve(e),ve=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(e){}return!1})(),ge=[],ke=[],je=(e,t)=>n=>{e.push(n),s||(s=!0,t&&4&ye.$?Oe(xe):ye.raf(xe))},Se=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){fe(e)}e.length=0},xe=()=>{Se(ge),Se(ke),(s=ge.length>0)&&ye.raf(xe)},Oe=e=>be().then(e),Me=je(ge,!1),Ce=je(ke,!0);export{ee as F,m as H,e as N,g as a,Z as b,k as c,pe as d,Me as e,z as f,o as g,d as h,be as p,re as r,oe as s}