@descope/web-components-ui 3.1.5 → 3.1.7

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.
@@ -1,2 +1,2 @@
1
- "use strict";(self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[3521],{80522(e,o,t){t.r(o),t.d(o,{CodeSnippetClass:()=>le,componentName:()=>n});var r=t(75780),l=t(25964),s=t(79365),c=t(9696),a=t(97810),p=t(81365);const n=(0,a.xE)("code-snippet");class i extends((0,p.q)({componentName:n,baseSelector:":host > code"})){static get observedAttributes(){return["lang","inline"]}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML='\n <code class="hljs"></code>\n ',(0,l.fz)("\n :host {\n display: inline-block;\n width: 100%;\n }\n code {\n display: block;\n width: 100%;\n min-height: 1em;\n overflow-x: scroll;\n overflow-y: scroll;\n }\n pre {\n margin: 0;\n }\n ",this)}init(){super.init?.(),this.lang=this.getAttribute("lang"),this.isInline="true"===this.getAttribute("inline"),(0,a.Ge)(this,this.#e.bind(this))}get contentNode(){return this.shadowRoot.querySelector(this.baseSelector)}attributeChangedCallback(e,o,t){super.attributeChangedCallback?.(e,o,t),o!==t&&("inline"===e&&(this.isInline=t),"lang"===e&&(this.lang=t),this.#e())}#e(){const e=(e=>{const o=document.createElement("textarea");return o.innerHTML=e,o.value})(this.textContent),o=this.lang;if(!o)return void(this.contentNode.textContent=e);const{value:t}=r.A.highlight(e,{language:o});var l;this.contentNode.innerHTML=(l=t,this.isInline?l:`<pre>${l}</pre>`)}}const{root:h,docTag:u,keyword:d,metaKeyword:y,templateTag:C,templateVariable:m,type:g,variableLanguage:T,title:x,titleClass:b,titleClassInherited:j,titleFunction:k,attr:w,attribute:v,literal:_,meta:f,number:I,operator:S,variable:A,selectorAttr:q,selectorClass:E,selectorId:L,regexp:N,string:F,metaString:V,builtIn:B,symbol:H,comment:K,code:M,formula:P,name:z,quote:R,selectorTag:G,selectorPseudo:O,subst:Q,section:Z,bullet:$,emphasis:D,strong:J,addition:U,deletion:W,charEscape:X,link:Y,params:ee,property:oe,punctuation:te,tag:re}={root:{selector:()=>".hljs"},docTag:{selector:()=>".hljs-doctag"},keyword:{selector:()=>".hljs-keyword"},metaKeyword:{selector:()=>".hljs-meta .hljs-keyword"},templateTag:{selector:()=>".hljs-template-tag"},templateVariable:{selector:()=>".hljs-template-variable"},type:{selector:()=>".hljs-type"},variableLanguage:{selector:()=>".hljs-variable.language"},title:{selector:()=>".hljs-title"},titleClass:{selector:()=>".hljs-title.class_"},titleClassInherited:{selector:()=>".hljs-title.class_.inherited__"},titleFunction:{selector:()=>".hljs-title.function_"},attr:{selector:()=>".hljs-attr"},attribute:{selector:()=>".hljs-attribute"},literal:{selector:()=>".hljs-literal"},meta:{selector:()=>".hljs-meta"},number:{selector:()=>".hljs-number"},operator:{selector:()=>".hljs-operator"},variable:{selector:()=>".hljs-variable"},selectorAttr:{selector:()=>".hljs-selector-attr"},selectorClass:{selector:()=>".hljs-selector-class"},selectorId:{selector:()=>".hljs-selector-id"},regexp:{selector:()=>".hljs-regexp"},string:{selector:()=>".hljs-string"},metaString:{selector:()=>".hljs-meta .hljs-string"},builtIn:{selector:()=>".hljs-built_in"},symbol:{selector:()=>".hljs-symbol"},comment:{selector:()=>".hljs-comment"},code:{selector:()=>".hljs-code"},formula:{selector:()=>".hljs-formula"},name:{selector:()=>".hljs-name"},quote:{selector:()=>".hljs-quote"},selectorTag:{selector:()=>".hljs-selector-tag"},selectorPseudo:{selector:()=>".hljs-selector-pseudo"},subst:{selector:()=>".hljs-subst"},section:{selector:()=>".hljs-section"},bullet:{selector:()=>".hljs-bullet"},emphasis:{selector:()=>".hljs-emphasis"},strong:{selector:()=>".hljs-strong"},addition:{selector:()=>".hljs-addition"},deletion:{selector:()=>".hljs-deletion"},charEscape:{selector:()=>".hljs-char.escape"},link:{selector:()=>".hljs-link"},params:{selector:()=>".hljs-params"},property:{selector:()=>".hljs-property"},punctuation:{selector:()=>".hljs-punctuation"},tag:{selector:()=>".hljs-tag"}},le=(0,c.Zz)((0,s.RF)({mappings:{rootBgColor:{...h,property:"background-color"},rootTextColor:{...h,property:"color"},docTagTextColor:{...u,property:"color"},keywordTextColor:{...d,property:"color"},metaKeywordTextColor:{...y,property:"color"},templateTagTextColor:{...C,property:"color"},templateVariableTextColor:{...m,property:"color"},typeTextColor:{...g,property:"color"},variableLanguageTextColor:{...T,property:"color"},titleTextColor:{...x,property:"color"},titleClassTextColor:{...b,property:"color"},titleClassInheritedTextColor:{...j,property:"color"},titleFunctionTextColor:{...k,property:"color"},attrTextColor:{...w,property:"color"},attributeTextColor:{...v,property:"color"},literalTextColor:{..._,property:"color"},metaTextColor:{...f,property:"color"},numberTextColor:{...I,property:"color"},operatorTextColor:{...S,property:"color"},variableTextColor:{...A,property:"color"},selectorAttrTextColor:{...q,property:"color"},selectorClassTextColor:{...E,property:"color"},selectorIdTextColor:{...L,property:"color"},regexpTextColor:{...N,property:"color"},stringTextColor:{...F,property:"color"},metaStringTextColor:{...V,property:"color"},builtInTextColor:{...B,property:"color"},symbolTextColor:{...H,property:"color"},commentTextColor:{...K,property:"color"},codeTextColor:{...M,property:"color"},formulaTextColor:{...P,property:"color"},nameTextColor:{...z,property:"color"},quoteTextColor:{...R,property:"color"},selectorTagTextColor:{...G,property:"color"},selectorPseudoTextColor:{...O,property:"color"},substTextColor:{...Q,property:"color"},sectionTextColor:{...Z,property:"color"},bulletTextColor:{...$,property:"color"},emphasisTextColor:{...D,property:"color"},strongTextColor:{...J,property:"color"},additionTextColor:{...U,property:"color"},additionBgColor:{...U,property:"background-color"},deletionTextColor:{...W,property:"color"},deletionBgColor:{...W,property:"background-color"},charEscapeTextColor:{...X,property:"color"},linkTextColor:{...Y,property:"color"},paramsTextColor:{...ee,property:"color"},propertyTextColor:{...oe,property:"color"},punctuationTextColor:{...te,property:"color"},tagTextColor:{...re,property:"color"}}}),s.VO,s.tQ)(i);customElements.define(n,le)}}]);
1
+ (self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[1202,3521,6724],{25828(t){t.exports="data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iY2hlY2staWNvbiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJjdXJyZW50Q29sb3IiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj4gPHBvbHlsaW5lIHBvaW50cz0iMjAgNiA5IDE3IDQgMTIiPjwvcG9seWxpbmU+IDwvc3ZnPiA="},71957(t){t.exports="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPiA8cmVjdCB4PSI5IiB5PSI5IiB3aWR0aD0iMTMiIGhlaWdodD0iMTMiIHJ4PSIyIiByeT0iMiI+PC9yZWN0PiA8cGF0aCBkPSJNNSAxNUg0YTIgMiAwIDAgMS0yLTJWNGEyIDIgMCAwIDEgMi0yaDlhMiAyIDAgMCAxIDIgMnYxIj48L3BhdGg+IDwvc3ZnPiA="},98538(t,e,o){"use strict";o.d(e,{S:()=>c,T:()=>i});var r=o(88961),l=o(25964),s=o(8512),n=o(63200);const i=(0,l.xE)("icon"),c=(0,n.Zz)((0,r.RF)({mappings:{fill:[{},{property:s.q.cssVarList.fill}]}}),r.VO,r.tQ)((0,r.tz)({slots:[],wrappedEleName:"descope-image",style:()=>"\n :host {\n display: inline-flex;\n max-height: 100%;\n }\n ",excludeAttrsSync:["tabindex","class","style"],componentName:i}))},56737(t,e,o){"use strict";o.r(e),o.d(e,{IconClass:()=>r.S,componentName:()=>r.T}),o(53455);var r=o(98538);customElements.define(r.T,r.S)},8512(t,e,o){"use strict";o.d(e,{T:()=>c,q:()=>d});var r=o(88961),l=o(72270),s=o(63200),n=o(25964),i=o(18782);const c=(0,n.xE)("image"),a=["src","src-dark"];class p extends((0,l.qu)({componentName:c,baseSelector:"slot"})){static get observedAttributes(){return a}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML="\n\t\t<slot></slot>\n\t",(0,n.fz)("\n\t\t\t:host {\n\t\t\t\tdisplay: inline-flex;\n\t\t\t}\n :host > slot {\n width: 100%;\n height: 100%;\n\t\t\t\tbox-sizing: border-box;\n\t\t\t\tdisplay: flex;\n\t\t\t\toverflow: hidden;\n\t\t\t}\n\n ::slotted(*) {\n width: 100%;\n\t\t\t}\n\n .hidden {\n display: none;\n }\n ",this)}init(){super.init?.(),this.toggleVisibility(this.getSrc)}onThemeChange(){this.renderImage()}toggleVisibility(t){t?this.classList.remove("hidden"):this.classList.add("hidden")}get altText(){return this.getAttribute("alt")||""}get legacySrc(){return this.getAttribute("src")}get themeSrc(){return this.getAttribute(`src-${this.currentThemeName}`)}get getSrc(){return this.themeSrc||this.legacySrc}updateFillColor(t){[t,...t.querySelectorAll("*[fill]")].forEach(t=>{t.setAttribute("fill",`var(${d.cssVarList.fill}, ${t.getAttribute("fill")||"''"})`)})}renderImage(){this.toggleVisibility(this.getSrc),(0,i.m)(this.getSrc,this.altText).then(t=>{this.innerHTML="",t&&(this.updateFillColor(t),this.appendChild(t))})}shouldRender(t){const e=this.getAttribute(t);return this.getSrc===e}attributeChangedCallback(t,e,o){super.attributeChangedCallback?.(t,e,o),e!==o&&this.shouldRender(t)&&this.renderImage()}}const d=(0,s.Zz)((0,r.RF)({mappings:{fill:{},height:{selector:()=>":host"},width:{selector:()=>":host"}}}),r.VO,r.tQ)(p)},18782(t,e,o){"use strict";o.d(e,{m:()=>s});var r=o(25414);const l=t=>{const e=r.A.sanitize(t,{USE_PROFILES:{svg:!0,svgFilters:!0},ADD_TAGS:["image"],FORBID_TAGS:["defs"]});return(new DOMParser).parseFromString(e,"image/svg+xml").querySelector("svg")},s=async(t,e)=>{try{let o;if((t=>t.startsWith("data:image/svg+xml;base64,"))(t)){const e=atob(t.slice(26));o=l(e)}else if("svg"===(t=>{const e=t.match(/\.([0-9a-z]+)(?:[\\?#]|$)/i);return e?e[1]:null})(t)){const e=await fetch(t),r=await e.text();o=l(r)}else o=((t,e)=>{const o=document.createElement("img");return o.setAttribute("src",t),o.setAttribute("alt",e),o})(t,e);return o.style.setProperty("max-width","100%"),o.style.setProperty("max-height","100%"),o}catch{return null}}},53455(t,e,o){"use strict";o.r(e),o.d(e,{ImageClass:()=>r.q,componentName:()=>r.T});var r=o(8512);customElements.define(r.T,r.q)},80522(t,e,o){"use strict";o.r(e),o.d(e,{CodeSnippetClass:()=>pt,componentName:()=>y}),o(56737);var r=o(75780),l=o(25964),s=o(79365),n=o(9696),i=o(97810),c=o(81365);const a=t=>{const e=document.createElement("textarea");return e.innerHTML=t,e.value};var p=o(71957),d=o.n(p),h=o(25828),u=o.n(h);const y=(0,i.xE)("code-snippet");class g extends((0,c.q)({componentName:y,baseSelector:":host > .wrapper"})){static get observedAttributes(){return["lang","inline","copy-button"]}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML='\n <div class="wrapper">\n <code class="hljs"></code>\n </div>\n ',(0,l.fz)("\n :host {\n display: inline-block;\n width: 100%;\n }\n .wrapper {\n display: grid;\n width: 100%;\n }\n code {\n grid-area: 1 / 1;\n display: block;\n width: 100%;\n min-height: 1em;\n overflow-x: auto;\n }\n pre {\n margin: 0;\n }\n .copy-btn {\n grid-area: 1 / 1;\n place-self: start end;\n margin: 8px;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0;\n border-style: solid;\n cursor: pointer;\n opacity: 0;\n transition: opacity 150ms ease, background 150ms ease;\n }\n .wrapper:hover .copy-btn,\n .copy-btn:focus-visible {\n opacity: 1;\n }\n .copy-btn descope-icon {\n width: 16px;\n height: 16px;\n pointer-events: none;\n flex-shrink: 0;\n }\n .copy-btn .check-icon {\n display: none;\n }\n .copy-btn.copied .check-icon {\n display: block;\n }\n .copy-btn.copied descope-icon:not(.check-icon) {\n display: none;\n }\n ",this)}init(){super.init?.(),this.lang=this.getAttribute("lang"),this.isInline="true"===this.getAttribute("inline"),"true"===this.getAttribute("copy-button")&&this.#t(),(0,i.Ge)(this,this.#e.bind(this))}get contentNode(){return this.shadowRoot.querySelector("code")}attributeChangedCallback(t,e,o){super.attributeChangedCallback?.(t,e,o),e!==o&&("inline"===t&&(this.isInline=o),"lang"===t&&(this.lang=o),"copy-button"===t&&("true"===o?this.#t():this.#o()),this.#e())}#t(){if(this.shadowRoot.querySelector(".copy-btn"))return;const t=document.createElement("button");t.className="copy-btn",t.type="button",t.setAttribute("aria-label","Copy code");const e=document.createElement("descope-icon");e.setAttribute("src",d());const o=document.createElement("descope-icon");o.setAttribute("src",u()),o.classList.add("check-icon"),t.appendChild(e),t.appendChild(o),t.addEventListener("click",()=>this.#r()),this.shadowRoot.querySelector(".wrapper").appendChild(t)}#o(){this.shadowRoot.querySelector(".copy-btn")?.remove()}#r(){const t=this.shadowRoot.querySelector(".copy-btn");navigator.clipboard.writeText(a(this.textContent)).then(()=>{t.classList.add("copied"),setTimeout(()=>t.classList.remove("copied"),2e3)}).catch(()=>{})}#e(){const t=a(this.textContent),e=this.lang;if(!e)return void(this.contentNode.textContent=t);const{value:o}=r.A.highlight(t,{language:e});var l;this.contentNode.innerHTML=(l=o,this.isInline?l:`<pre>${l}</pre>`)}}const m={selector:()=>".copy-btn"},{root:b,docTag:C,keyword:x,metaKeyword:T,templateTag:I,templateVariable:v,type:j,variableLanguage:S,title:w,titleClass:A,titleClassInherited:k,titleFunction:f,attr:B,attribute:M,literal:N,meta:D,number:P,operator:L,variable:H,selectorAttr:R,selectorClass:W,selectorId:E,regexp:Z,string:z,metaString:q,builtIn:_,symbol:F,comment:G,code:J,formula:V,name:Q,quote:Y,selectorTag:O,selectorPseudo:U,subst:$,section:X,bullet:K,emphasis:tt,strong:et,addition:ot,deletion:rt,charEscape:lt,link:st,params:nt,property:it,punctuation:ct,tag:at}={root:{selector:()=>".hljs"},docTag:{selector:()=>".hljs-doctag"},keyword:{selector:()=>".hljs-keyword"},metaKeyword:{selector:()=>".hljs-meta .hljs-keyword"},templateTag:{selector:()=>".hljs-template-tag"},templateVariable:{selector:()=>".hljs-template-variable"},type:{selector:()=>".hljs-type"},variableLanguage:{selector:()=>".hljs-variable.language"},title:{selector:()=>".hljs-title"},titleClass:{selector:()=>".hljs-title.class_"},titleClassInherited:{selector:()=>".hljs-title.class_.inherited__"},titleFunction:{selector:()=>".hljs-title.function_"},attr:{selector:()=>".hljs-attr"},attribute:{selector:()=>".hljs-attribute"},literal:{selector:()=>".hljs-literal"},meta:{selector:()=>".hljs-meta"},number:{selector:()=>".hljs-number"},operator:{selector:()=>".hljs-operator"},variable:{selector:()=>".hljs-variable"},selectorAttr:{selector:()=>".hljs-selector-attr"},selectorClass:{selector:()=>".hljs-selector-class"},selectorId:{selector:()=>".hljs-selector-id"},regexp:{selector:()=>".hljs-regexp"},string:{selector:()=>".hljs-string"},metaString:{selector:()=>".hljs-meta .hljs-string"},builtIn:{selector:()=>".hljs-built_in"},symbol:{selector:()=>".hljs-symbol"},comment:{selector:()=>".hljs-comment"},code:{selector:()=>".hljs-code"},formula:{selector:()=>".hljs-formula"},name:{selector:()=>".hljs-name"},quote:{selector:()=>".hljs-quote"},selectorTag:{selector:()=>".hljs-selector-tag"},selectorPseudo:{selector:()=>".hljs-selector-pseudo"},subst:{selector:()=>".hljs-subst"},section:{selector:()=>".hljs-section"},bullet:{selector:()=>".hljs-bullet"},emphasis:{selector:()=>".hljs-emphasis"},strong:{selector:()=>".hljs-strong"},addition:{selector:()=>".hljs-addition"},deletion:{selector:()=>".hljs-deletion"},charEscape:{selector:()=>".hljs-char.escape"},link:{selector:()=>".hljs-link"},params:{selector:()=>".hljs-params"},property:{selector:()=>".hljs-property"},punctuation:{selector:()=>".hljs-punctuation"},tag:{selector:()=>".hljs-tag"}},pt=(0,n.Zz)((0,s.RF)({mappings:{rootBgColor:{...b,property:"background-color"},rootTextColor:{...b,property:"color"},docTagTextColor:{...C,property:"color"},keywordTextColor:{...x,property:"color"},metaKeywordTextColor:{...T,property:"color"},templateTagTextColor:{...I,property:"color"},templateVariableTextColor:{...v,property:"color"},typeTextColor:{...j,property:"color"},variableLanguageTextColor:{...S,property:"color"},titleTextColor:{...w,property:"color"},titleClassTextColor:{...A,property:"color"},titleClassInheritedTextColor:{...k,property:"color"},titleFunctionTextColor:{...f,property:"color"},attrTextColor:{...B,property:"color"},attributeTextColor:{...M,property:"color"},literalTextColor:{...N,property:"color"},metaTextColor:{...D,property:"color"},numberTextColor:{...P,property:"color"},operatorTextColor:{...L,property:"color"},variableTextColor:{...H,property:"color"},selectorAttrTextColor:{...R,property:"color"},selectorClassTextColor:{...W,property:"color"},selectorIdTextColor:{...E,property:"color"},regexpTextColor:{...Z,property:"color"},stringTextColor:{...z,property:"color"},metaStringTextColor:{...q,property:"color"},builtInTextColor:{..._,property:"color"},symbolTextColor:{...F,property:"color"},commentTextColor:{...G,property:"color"},codeTextColor:{...J,property:"color"},formulaTextColor:{...V,property:"color"},nameTextColor:{...Q,property:"color"},quoteTextColor:{...Y,property:"color"},selectorTagTextColor:{...O,property:"color"},selectorPseudoTextColor:{...U,property:"color"},substTextColor:{...$,property:"color"},sectionTextColor:{...X,property:"color"},bulletTextColor:{...K,property:"color"},emphasisTextColor:{...tt,property:"color"},strongTextColor:{...et,property:"color"},additionTextColor:{...ot,property:"color"},additionBgColor:{...ot,property:"background-color"},deletionTextColor:{...rt,property:"color"},deletionBgColor:{...rt,property:"background-color"},charEscapeTextColor:{...lt,property:"color"},linkTextColor:{...st,property:"color"},paramsTextColor:{...nt,property:"color"},propertyTextColor:{...it,property:"color"},punctuationTextColor:{...ct,property:"color"},tagTextColor:{...at,property:"color"},copyButtonSize:[{...m,property:"width"},{...m,property:"height"}],copyButtonBorderRadius:{...m,property:"border-radius"},copyButtonBorderWidth:{...m,property:"border-width"},copyButtonBorderColor:{...m,property:"border-color"},copyButtonBgColor:{...m,property:"background-color"},copyButtonHoverBgColor:{selector:()=>".copy-btn:hover",property:"background-color"},copyButtonColor:{...m,property:"color"}}}),s.VO,s.tQ)(g);customElements.define(y,pt)}}]);
2
2
  //# sourceMappingURL=descope-code-snippet-index-js.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"descope-code-snippet-index-js.js","mappings":"uQAAO,MCQMA,GAAgB,QAAiB,gBAE9C,MAAMC,WAAoB,EAAAC,EAAA,GAAgB,CAAEF,gBAAeG,aAAc,kBACvE,6BAAWC,GACT,MAAO,CAAC,OAAQ,SAClB,CAEA,WAAAC,GACEC,QAEAC,KAAKC,aAAa,CAAEC,KAAM,SAAUC,UAAY,0CAIhD,QACE,6RAgBAH,KAEJ,CAEA,IAAAI,GACEL,MAAMK,SAENJ,KAAKK,KAAOL,KAAKM,aAAa,QAC9BN,KAAKO,SAA2C,SAAhCP,KAAKM,aAAa,WAElC,QAAgBN,KAAMA,MAAK,EAAeQ,KAAKR,MACjD,CAEA,eAAIS,GACF,OAAOT,KAAKU,WAAWC,cAAcX,KAAKJ,aAC5C,CAEA,wBAAAgB,CAAyBC,EAAUC,EAAUC,GAC3ChB,MAAMa,2BAA2BC,EAAUC,EAAUC,GAEjDD,IAAaC,IACE,WAAbF,IACFb,KAAKO,SAAWQ,GAGD,SAAbF,IACFb,KAAKK,KAAOU,GAGdf,MAAK,IAET,CAEA,KACE,MAAMgB,EDzEY,CAACC,IACrB,MAAMC,EAAMC,SAASC,cAAc,YAEnC,OADAF,EAAIf,UAAYc,EACTC,EAAIG,OCsESC,CAAOtB,KAAKuB,aACxBC,EA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,cAAe,IAAKnD,EAAMgB,SAAU,SACpCoC,iBAAkB,IAAKnD,EAASe,SAAU,SAC1CqC,cAAe,IAAK,EAAMrC,SAAU,SACpCsC,eAAgB,IAAKnD,EAAOa,SAAU,SACtCuC,qBAAsB,IAAKnD,EAAaY,SAAU,SAClDwC,wBAAyB,IAAKnD,EAAgBW,SAAU,SACxDyC,eAAgB,IAAKnD,EAAOU,SAAU,SACtC0C,iBAAkB,IAAKnD,EAASS,SAAU,SAC1C2C,gBAAiB,IAAKnD,EAAQQ,SAAU,SACxC4C,kBAAmB,IAAKnD,EAAUO,SAAU,SAC5C6C,gBAAiB,IAAKnD,EAAQM,SAAU,SACxC8C,kBAAmB,IAAKnD,EAAUK,SAAU,SAC5C+C,gBAAiB,IAAKpD,EAAUK,SAAU,oBAC1CgD,kBAAmB,IAAKpD,EAAUI,SAAU,SAC5CiD,gBAAiB,IAAKrD,EAAUI,SAAU,oBAC1CkD,oBAAqB,IAAKrD,EAAYG,SAAU,SAChDmD,cAAe,IAAK,EAAMnD,SAAU,SACpCoD,gBAAiB,IAAKrD,GAAQC,SAAU,SACxCqD,kBAAmB,IAAKrD,GAAUA,SAAU,SAC5CsD,qBAAsB,IAAKrD,GAAaD,SAAU,SAClDuD,aAAc,IAAKrD,GAAKF,SAAU,YAGtC,KACA,KAxD8B,CAyD9B7E,GChPFqI,eAAeC,OAAOvI,EAAekF,G","sources":["webpack://@descope/web-components-ui/./src/components/descope-code-snippet/helpers.js","webpack://@descope/web-components-ui/./src/components/descope-code-snippet/CodeSnippetClass.js","webpack://@descope/web-components-ui/./src/components/descope-code-snippet/index.js"],"sourcesContent":["export const decode = (input) => {\n const txt = document.createElement('textarea');\n txt.innerHTML = input;\n return txt.value;\n};\n\nexport const tpl = (input, inline) => (inline ? input : `<pre>${input}</pre>`);\n","import hljs from 'highlight.js';\nimport { injectStyle } from '@descope-ui/common/components-helpers';\nimport { createStyleMixin, draggableMixin, componentNameValidationMixin } from '../../mixins';\nimport { compose } from '../../helpers';\nimport { getComponentName, observeChildren } from '../../helpers/componentHelpers';\nimport { createBaseClass } from '../../baseClasses/createBaseClass';\nimport { decode, tpl } from './helpers';\n\nexport const componentName = getComponentName('code-snippet');\n\nclass CodeSnippet extends createBaseClass({ componentName, baseSelector: ':host > code' }) {\n static get observedAttributes() {\n return ['lang', 'inline'];\n }\n\n constructor() {\n super();\n\n this.attachShadow({ mode: 'open' }).innerHTML = `\n <code class=\"hljs\"></code>\n `;\n\n injectStyle(\n `\n :host {\n display: inline-block;\n width: 100%;\n }\n code {\n display: block;\n width: 100%;\n min-height: 1em;\n overflow-x: scroll;\n overflow-y: scroll;\n }\n pre {\n margin: 0;\n }\n `,\n this\n );\n }\n\n init() {\n super.init?.();\n\n this.lang = this.getAttribute('lang');\n this.isInline = this.getAttribute('inline') === 'true';\n\n observeChildren(this, this.#renderSnippet.bind(this));\n }\n\n get contentNode() {\n return this.shadowRoot.querySelector(this.baseSelector);\n }\n\n attributeChangedCallback(attrName, oldValue, newValue) {\n super.attributeChangedCallback?.(attrName, oldValue, newValue);\n\n if (oldValue !== newValue) {\n if (attrName === 'inline') {\n this.isInline = newValue;\n }\n\n if (attrName === 'lang') {\n this.lang = newValue;\n }\n\n this.#renderSnippet();\n }\n }\n\n #renderSnippet() {\n const sanitized = decode(this.textContent);\n const language = this.lang;\n\n if (!language) {\n this.contentNode.textContent = sanitized;\n return;\n }\n\n const { value: highlighted } = hljs.highlight(sanitized, { language });\n\n this.contentNode.innerHTML = tpl(highlighted, this.isInline);\n }\n}\n\nconst {\n root,\n docTag,\n keyword,\n metaKeyword,\n templateTag,\n templateVariable,\n type,\n variableLanguage,\n title,\n titleClass,\n titleClassInherited,\n titleFunction,\n attr,\n attribute,\n literal,\n meta,\n number,\n operator,\n variable,\n selectorAttr,\n selectorClass,\n selectorId,\n regexp,\n string,\n metaString,\n builtIn,\n symbol,\n comment,\n code,\n formula,\n name,\n quote,\n selectorTag,\n selectorPseudo,\n subst,\n section,\n bullet,\n emphasis,\n strong,\n addition,\n deletion,\n charEscape,\n link,\n params,\n property,\n punctuation,\n tag,\n} = {\n root: { selector: () => '.hljs' },\n docTag: { selector: () => '.hljs-doctag' },\n keyword: { selector: () => '.hljs-keyword' },\n metaKeyword: { selector: () => '.hljs-meta .hljs-keyword' },\n templateTag: { selector: () => '.hljs-template-tag' },\n templateVariable: { selector: () => '.hljs-template-variable' },\n type: { selector: () => '.hljs-type' },\n variableLanguage: { selector: () => '.hljs-variable.language' },\n title: { selector: () => '.hljs-title' },\n titleClass: { selector: () => '.hljs-title.class_' },\n titleClassInherited: { selector: () => '.hljs-title.class_.inherited__' },\n titleFunction: { selector: () => '.hljs-title.function_' },\n attr: { selector: () => '.hljs-attr' },\n attribute: { selector: () => '.hljs-attribute' },\n literal: { selector: () => '.hljs-literal' },\n meta: { selector: () => '.hljs-meta' },\n number: { selector: () => '.hljs-number' },\n operator: { selector: () => '.hljs-operator' },\n variable: { selector: () => '.hljs-variable' },\n selectorAttr: { selector: () => '.hljs-selector-attr' },\n selectorClass: { selector: () => '.hljs-selector-class' },\n selectorId: { selector: () => '.hljs-selector-id' },\n regexp: { selector: () => '.hljs-regexp' },\n string: { selector: () => '.hljs-string' },\n metaString: { selector: () => '.hljs-meta .hljs-string' },\n builtIn: { selector: () => '.hljs-built_in' },\n symbol: { selector: () => '.hljs-symbol' },\n comment: { selector: () => '.hljs-comment' },\n code: { selector: () => '.hljs-code' },\n formula: { selector: () => '.hljs-formula' },\n name: { selector: () => '.hljs-name' },\n quote: { selector: () => '.hljs-quote' },\n selectorTag: { selector: () => '.hljs-selector-tag' },\n selectorPseudo: { selector: () => '.hljs-selector-pseudo' },\n subst: { selector: () => '.hljs-subst' },\n section: { selector: () => '.hljs-section' },\n bullet: { selector: () => '.hljs-bullet' },\n emphasis: { selector: () => '.hljs-emphasis' },\n strong: { selector: () => '.hljs-strong' },\n addition: { selector: () => '.hljs-addition' },\n deletion: { selector: () => '.hljs-deletion' },\n charEscape: { selector: () => '.hljs-char.escape' },\n link: { selector: () => '.hljs-link' },\n params: { selector: () => '.hljs-params' },\n property: { selector: () => '.hljs-property' },\n punctuation: { selector: () => '.hljs-punctuation' },\n tag: { selector: () => '.hljs-tag' },\n};\n\nexport const CodeSnippetClass = compose(\n createStyleMixin({\n mappings: {\n rootBgColor: { ...root, property: 'background-color' },\n rootTextColor: { ...root, property: 'color' },\n docTagTextColor: { ...docTag, property: 'color' },\n keywordTextColor: { ...keyword, property: 'color' },\n metaKeywordTextColor: { ...metaKeyword, property: 'color' },\n templateTagTextColor: { ...templateTag, property: 'color' },\n templateVariableTextColor: { ...templateVariable, property: 'color' },\n typeTextColor: { ...type, property: 'color' },\n variableLanguageTextColor: { ...variableLanguage, property: 'color' },\n titleTextColor: { ...title, property: 'color' },\n titleClassTextColor: { ...titleClass, property: 'color' },\n titleClassInheritedTextColor: { ...titleClassInherited, property: 'color' },\n titleFunctionTextColor: { ...titleFunction, property: 'color' },\n attrTextColor: { ...attr, property: 'color' },\n attributeTextColor: { ...attribute, property: 'color' },\n literalTextColor: { ...literal, property: 'color' },\n metaTextColor: { ...meta, property: 'color' },\n numberTextColor: { ...number, property: 'color' },\n operatorTextColor: { ...operator, property: 'color' },\n variableTextColor: { ...variable, property: 'color' },\n selectorAttrTextColor: { ...selectorAttr, property: 'color' },\n selectorClassTextColor: { ...selectorClass, property: 'color' },\n selectorIdTextColor: { ...selectorId, property: 'color' },\n regexpTextColor: { ...regexp, property: 'color' },\n stringTextColor: { ...string, property: 'color' },\n metaStringTextColor: { ...metaString, property: 'color' },\n builtInTextColor: { ...builtIn, property: 'color' },\n symbolTextColor: { ...symbol, property: 'color' },\n commentTextColor: { ...comment, property: 'color' },\n codeTextColor: { ...code, property: 'color' },\n formulaTextColor: { ...formula, property: 'color' },\n nameTextColor: { ...name, property: 'color' },\n quoteTextColor: { ...quote, property: 'color' },\n selectorTagTextColor: { ...selectorTag, property: 'color' },\n selectorPseudoTextColor: { ...selectorPseudo, property: 'color' },\n substTextColor: { ...subst, property: 'color' },\n sectionTextColor: { ...section, property: 'color' },\n bulletTextColor: { ...bullet, property: 'color' },\n emphasisTextColor: { ...emphasis, property: 'color' },\n strongTextColor: { ...strong, property: 'color' },\n additionTextColor: { ...addition, property: 'color' },\n additionBgColor: { ...addition, property: 'background-color' },\n deletionTextColor: { ...deletion, property: 'color' },\n deletionBgColor: { ...deletion, property: 'background-color' },\n charEscapeTextColor: { ...charEscape, property: 'color' },\n linkTextColor: { ...link, property: 'color' },\n paramsTextColor: { ...params, property: 'color' },\n propertyTextColor: { ...property, property: 'color' },\n punctuationTextColor: { ...punctuation, property: 'color' },\n tagTextColor: { ...tag, property: 'color' },\n },\n }),\n draggableMixin,\n componentNameValidationMixin\n)(CodeSnippet);\n","import { componentName, CodeSnippetClass } from './CodeSnippetClass';\n\ncustomElements.define(componentName, CodeSnippetClass);\n\nexport { CodeSnippetClass, componentName };\n"],"names":["componentName","CodeSnippet","createBaseClass","baseSelector","observedAttributes","constructor","super","this","attachShadow","mode","innerHTML","init","lang","getAttribute","isInline","bind","contentNode","shadowRoot","querySelector","attributeChangedCallback","attrName","oldValue","newValue","sanitized","input","txt","document","createElement","value","decode","textContent","language","highlighted","highlight","root","docTag","keyword","metaKeyword","templateTag","templateVariable","type","variableLanguage","title","titleClass","titleClassInherited","titleFunction","attr","attribute","literal","meta","number","operator","variable","selectorAttr","selectorClass","selectorId","regexp","string","metaString","builtIn","symbol","comment","code","formula","name","quote","selectorTag","selectorPseudo","subst","section","bullet","emphasis","strong","addition","deletion","charEscape","link","params","property","punctuation","tag","selector","CodeSnippetClass","mappings","rootBgColor","rootTextColor","docTagTextColor","keywordTextColor","metaKeywordTextColor","templateTagTextColor","templateVariableTextColor","typeTextColor","variableLanguageTextColor","titleTextColor","titleClassTextColor","titleClassInheritedTextColor","titleFunctionTextColor","attrTextColor","attributeTextColor","literalTextColor","metaTextColor","numberTextColor","operatorTextColor","variableTextColor","selectorAttrTextColor","selectorClassTextColor","selectorIdTextColor","regexpTextColor","stringTextColor","metaStringTextColor","builtInTextColor","symbolTextColor","commentTextColor","codeTextColor","formulaTextColor","nameTextColor","quoteTextColor","selectorTagTextColor","selectorPseudoTextColor","substTextColor","sectionTextColor","bulletTextColor","emphasisTextColor","strongTextColor","additionTextColor","additionBgColor","deletionTextColor","deletionBgColor","charEscapeTextColor","linkTextColor","paramsTextColor","propertyTextColor","punctuationTextColor","tagTextColor","customElements","define"],"sourceRoot":""}
1
+ {"version":3,"file":"descope-code-snippet-index-js.js","mappings":"+HAAAA,EAAOC,QAAU,gX,WCAjBD,EAAOC,QAAU,gd,oGCUV,MAAMC,GAAgB,QAAiB,QAEjCC,GAAY,SACvB,QAAiB,CACfC,SAAU,CACRC,KAAM,CAAC,CAAC,EAAG,CAAEC,SAAU,IAAWC,WAAWF,UAGjD,KACA,KAPuB,EASvB,QAAY,CACVG,MAAO,GACPC,eAAgB,gBAChBC,MAAO,IAAM,6FAMbC,iBAAkB,CAAC,WAAY,QAAS,SACxCT,kB,4GC3BJU,eAAeC,OAAO,IAAe,I,+GCQ9B,MAAMX,GAAgB,QAAiB,SAExCY,EAAW,CAAC,MAAO,YAEzB,MAAMC,WAAiB,QAAgB,CACrCb,gBACAc,aAAc,UAEd,6BAAWC,GACT,OAAOH,CACT,CAEA,WAAAI,GACEC,QAEAC,KAAKC,aAAa,CAAEC,KAAM,SAAUC,UAAY,2BAIhD,QACE,6UAoBAH,KAEJ,CAEA,IAAAI,GACEL,MAAMK,SACNJ,KAAKK,iBAAiBL,KAAKM,OAC7B,CAEA,aAAAC,GACEP,KAAKQ,aACP,CAEA,gBAAAH,CAAiBI,GACXA,EACFT,KAAKU,UAAUC,OAAO,UAEtBX,KAAKU,UAAUE,IAAI,SAEvB,CAEA,WAAIC,GACF,OAAOb,KAAKc,aAAa,QAAU,EACrC,CAEA,aAAIC,GACF,OAAOf,KAAKc,aAAa,MAC3B,CAEA,YAAIE,GACF,OAAOhB,KAAKc,aAAa,OAAOd,KAAKiB,mBACvC,C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AU,SAC1CgM,gBAAiB,IAAKhD,EAAQhJ,SAAU,SACxCiM,kBAAmB,IAAKhD,GAAUjJ,SAAU,SAC5CkM,gBAAiB,IAAKhD,GAAQlJ,SAAU,SACxCmM,kBAAmB,IAAKhD,GAAUnJ,SAAU,SAC5CoM,gBAAiB,IAAKjD,GAAUnJ,SAAU,oBAC1CqM,kBAAmB,IAAKjD,GAAUpJ,SAAU,SAC5CsM,gBAAiB,IAAKlD,GAAUpJ,SAAU,oBAC1CuM,oBAAqB,IAAKlD,GAAYrJ,SAAU,SAChDwM,cAAe,IAAK,GAAMxM,SAAU,SACpCyM,gBAAiB,IAAKlD,GAAQvJ,SAAU,SACxC0M,kBAAmB,IAAK1M,GAAUA,SAAU,SAC5C2M,qBAAsB,IAAKnD,GAAaxJ,SAAU,SAClD4M,aAAc,IAAKnD,GAAKzJ,SAAU,SAClC6M,eAAgB,CACd,IAAKjG,EAAS5G,SAAU,SACxB,IAAK4G,EAAS5G,SAAU,WAE1B8M,uBAAwB,IAAKlG,EAAS5G,SAAU,iBAChD+M,sBAAuB,IAAKnG,EAAS5G,SAAU,gBAC/CgN,sBAAuB,IAAKpG,EAAS5G,SAAU,gBAC/CiN,kBAAmB,IAAKrG,EAAS5G,SAAU,oBAC3CkN,uBAAwB,CAAEhK,SAAU,IAAM,kBAAmBlD,SAAU,oBACvEmN,gBAAiB,IAAKvG,EAAS5G,SAAU,YAG7C,KACA,KAlE8B,CAmE9BqF,GCvVF/E,eAAeC,OAAOX,EAAe8J,G","sources":["webpack://@descope/web-components-ui/./src/components/descope-code-snippet/check-icon.svg","webpack://@descope/web-components-ui/./src/components/descope-code-snippet/copy-icon.svg","webpack://@descope/web-components-ui/../components/descope-icon/src/component/IconClass.js","webpack://@descope/web-components-ui/../components/descope-icon/src/component/index.js","webpack://@descope/web-components-ui/../components/descope-image/src/component/ImageClass.js","webpack://@descope/web-components-ui/../components/descope-image/src/component/helpers.js","webpack://@descope/web-components-ui/../components/descope-image/src/component/index.js","webpack://@descope/web-components-ui/./src/components/descope-code-snippet/helpers.js","webpack://@descope/web-components-ui/./src/components/descope-code-snippet/CodeSnippetClass.js","webpack://@descope/web-components-ui/./src/components/descope-code-snippet/index.js"],"sourcesContent":["module.exports = \"data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iY2hlY2staWNvbiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJjdXJyZW50Q29sb3IiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj4gPHBvbHlsaW5lIHBvaW50cz0iMjAgNiA5IDE3IDQgMTIiPjwvcG9seWxpbmU+IDwvc3ZnPiA=\"","module.exports = \"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPiA8cmVjdCB4PSI5IiB5PSI5IiB3aWR0aD0iMTMiIGhlaWdodD0iMTMiIHJ4PSIyIiByeT0iMiI+PC9yZWN0PiA8cGF0aCBkPSJNNSAxNUg0YTIgMiAwIDAgMS0yLTJWNGEyIDIgMCAwIDEgMi0yaDlhMiAyIDAgMCAxIDIgMnYxIj48L3BhdGg+IDwvc3ZnPiA=\"","import {\n componentNameValidationMixin,\n createProxy,\n createStyleMixin,\n draggableMixin,\n} from '@descope-ui/common/components-mixins';\nimport { getComponentName } from '@descope-ui/common/components-helpers';\nimport { ImageClass } from '@descope-ui/descope-image/class';\nimport { compose } from '@descope-ui/common/utils';\n\nexport const componentName = getComponentName('icon');\n\nexport const IconClass = compose(\n createStyleMixin({\n mappings: {\n fill: [{}, { property: ImageClass.cssVarList.fill }],\n },\n }),\n draggableMixin,\n componentNameValidationMixin,\n)(\n createProxy({\n slots: [],\n wrappedEleName: 'descope-image',\n style: () => `\n :host {\n display: inline-flex;\n max-height: 100%;\n }\n `,\n excludeAttrsSync: ['tabindex', 'class', 'style'],\n componentName,\n }),\n);\n","import '@descope-ui/descope-image';\n\nimport { componentName, IconClass } from './IconClass';\n\ncustomElements.define(componentName, IconClass);\n\nexport { IconClass, componentName };\n","/* eslint-disable no-use-before-define */\nimport {\n createStyleMixin,\n draggableMixin,\n componentNameValidationMixin,\n} from '@descope-ui/common/components-mixins';\nimport { createBaseClass } from '@descope-ui/common/base-classes';\nimport { compose } from '@descope-ui/common/utils';\nimport { getComponentName } from '@descope-ui/common/components-helpers';\nimport { createImage } from './helpers';\nimport { injectStyle } from '@descope-ui/common/components-helpers';\n\nexport const componentName = getComponentName('image');\n\nconst srcAttrs = ['src', 'src-dark'];\n\nclass RawImage extends createBaseClass({\n componentName,\n baseSelector: 'slot',\n}) {\n static get observedAttributes() {\n return srcAttrs;\n }\n\n constructor() {\n super();\n\n this.attachShadow({ mode: 'open' }).innerHTML = `\n\t\t<slot></slot>\n\t`;\n\n injectStyle(\n `\n\t\t\t:host {\n\t\t\t\tdisplay: inline-flex;\n\t\t\t}\n :host > slot {\n width: 100%;\n height: 100%;\n\t\t\t\tbox-sizing: border-box;\n\t\t\t\tdisplay: flex;\n\t\t\t\toverflow: hidden;\n\t\t\t}\n\n ::slotted(*) {\n width: 100%;\n\t\t\t}\n\n .hidden {\n display: none;\n }\n `,\n this,\n );\n }\n\n init() {\n super.init?.();\n this.toggleVisibility(this.getSrc);\n }\n\n onThemeChange() {\n this.renderImage();\n }\n\n toggleVisibility(isVisible) {\n if (isVisible) {\n this.classList.remove('hidden');\n } else {\n this.classList.add('hidden');\n }\n }\n\n get altText() {\n return this.getAttribute('alt') || '';\n }\n\n get legacySrc() {\n return this.getAttribute('src');\n }\n\n get themeSrc() {\n return this.getAttribute(`src-${this.currentThemeName}`);\n }\n\n get getSrc() {\n return this.themeSrc || this.legacySrc;\n }\n\n // in order to fill an SVG with `currentColor` override all of its `fill` and `path` nodes\n // with the value from the `st-fill` attribute\n // eslint-disable-next-line class-methods-use-this\n updateFillColor(node) {\n // set fill to root node and all its relevant selectors\n const elementsToReplace = [node, ...node.querySelectorAll('*[fill]')];\n\n elementsToReplace.forEach((ele) => {\n ele.setAttribute(\n 'fill',\n `var(${ImageClass.cssVarList.fill}, ${ele.getAttribute('fill') || \"''\"})`,\n );\n });\n }\n\n renderImage() {\n this.toggleVisibility(this.getSrc);\n\n createImage(this.getSrc, this.altText).then((res) => {\n this.innerHTML = '';\n if (res) {\n this.updateFillColor(res);\n this.appendChild(res);\n }\n });\n }\n\n // render only when src attribute matches current theme\n shouldRender(src) {\n const srcVal = this.getAttribute(src);\n return this.getSrc === srcVal;\n }\n\n attributeChangedCallback(attrName, oldValue, newValue) {\n super.attributeChangedCallback?.(attrName, oldValue, newValue);\n\n if (oldValue === newValue) return;\n\n if (this.shouldRender(attrName)) {\n this.renderImage();\n }\n }\n}\n\nexport const ImageClass = compose(\n createStyleMixin({\n mappings: {\n fill: {},\n height: { selector: () => ':host' },\n width: { selector: () => ':host' },\n },\n }),\n draggableMixin,\n componentNameValidationMixin,\n)(RawImage);\n","import DOMPurify from 'dompurify';\n\nconst getFileExtension = (path) => {\n const match = path.match(/\\.([0-9a-z]+)(?:[\\\\?#]|$)/i);\n return match ? match[1] : null;\n};\n\nconst base64Prefix = 'data:image/svg+xml;base64,';\n\nconst isBase64Svg = (src) => src.startsWith(base64Prefix);\n\nconst createImgEle = (src, altText) => {\n const ele = document.createElement('img');\n ele.setAttribute('src', src);\n ele.setAttribute('alt', altText);\n return ele;\n};\n\nconst createSvgEle = (text) => {\n // we want to purify the SVG to avoid XSS attacks\n const clean = DOMPurify.sanitize(text, {\n USE_PROFILES: { svg: true, svgFilters: true },\n // allow image to render\n ADD_TAGS: ['image'],\n // forbid interactiviy via `use` tags (which are sanitized by default)\n FORBID_TAGS: ['defs']\n });\n\n const parser = new DOMParser();\n const ele = parser\n .parseFromString(clean, 'image/svg+xml')\n .querySelector('svg');\n return ele;\n};\n\nexport const createImage = async (src, altText) => {\n try {\n let ele;\n if (isBase64Svg(src)) {\n // handle base64 source\n const svgXml = atob(src.slice(base64Prefix.length));\n ele = createSvgEle(svgXml);\n } else if (getFileExtension(src) === 'svg') {\n // handle urls\n const fetchedSrc = await fetch(src);\n const text = await fetchedSrc.text();\n ele = createSvgEle(text);\n } else {\n // handle binary\n ele = createImgEle(src, altText);\n }\n\n ele.style.setProperty('max-width', '100%');\n ele.style.setProperty('max-height', '100%');\n\n return ele;\n } catch {\n return null;\n }\n};\n","import { componentName, ImageClass } from './ImageClass';\n\ncustomElements.define(componentName, ImageClass);\n\nexport { ImageClass, componentName };\n","export const decode = (input) => {\n const txt = document.createElement('textarea');\n txt.innerHTML = input;\n return txt.value;\n};\n\nexport const tpl = (input, inline) => (inline ? input : `<pre>${input}</pre>`);\n","import hljs from 'highlight.js';\nimport { injectStyle } from '@descope-ui/common/components-helpers';\nimport { createStyleMixin, draggableMixin, componentNameValidationMixin } from '../../mixins';\nimport { compose } from '../../helpers';\nimport { getComponentName, observeChildren } from '../../helpers/componentHelpers';\nimport { createBaseClass } from '../../baseClasses/createBaseClass';\nimport { decode, tpl } from './helpers';\nimport copyIconSrc from './copy-icon.svg';\nimport checkIconSrc from './check-icon.svg';\n\nexport const componentName = getComponentName('code-snippet');\n\nclass CodeSnippet extends createBaseClass({ componentName, baseSelector: ':host > .wrapper' }) {\n static get observedAttributes() {\n return ['lang', 'inline', 'copy-button'];\n }\n\n constructor() {\n super();\n\n this.attachShadow({ mode: 'open' }).innerHTML = `\n <div class=\"wrapper\">\n <code class=\"hljs\"></code>\n </div>\n `;\n\n injectStyle(\n `\n :host {\n display: inline-block;\n width: 100%;\n }\n .wrapper {\n display: grid;\n width: 100%;\n }\n code {\n grid-area: 1 / 1;\n display: block;\n width: 100%;\n min-height: 1em;\n overflow-x: auto;\n }\n pre {\n margin: 0;\n }\n .copy-btn {\n grid-area: 1 / 1;\n place-self: start end;\n margin: 8px;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0;\n border-style: solid;\n cursor: pointer;\n opacity: 0;\n transition: opacity 150ms ease, background 150ms ease;\n }\n .wrapper:hover .copy-btn,\n .copy-btn:focus-visible {\n opacity: 1;\n }\n .copy-btn descope-icon {\n width: 16px;\n height: 16px;\n pointer-events: none;\n flex-shrink: 0;\n }\n .copy-btn .check-icon {\n display: none;\n }\n .copy-btn.copied .check-icon {\n display: block;\n }\n .copy-btn.copied descope-icon:not(.check-icon) {\n display: none;\n }\n `,\n this\n );\n }\n\n init() {\n super.init?.();\n\n this.lang = this.getAttribute('lang');\n this.isInline = this.getAttribute('inline') === 'true';\n\n if (this.getAttribute('copy-button') === 'true') {\n this.#initCopyButton();\n }\n\n observeChildren(this, this.#renderSnippet.bind(this));\n }\n\n get contentNode() {\n return this.shadowRoot.querySelector('code');\n }\n\n attributeChangedCallback(attrName, oldValue, newValue) {\n super.attributeChangedCallback?.(attrName, oldValue, newValue);\n\n if (oldValue !== newValue) {\n if (attrName === 'inline') {\n this.isInline = newValue;\n }\n\n if (attrName === 'lang') {\n this.lang = newValue;\n }\n\n if (attrName === 'copy-button') {\n if (newValue === 'true') {\n this.#initCopyButton();\n } else {\n this.#destroyCopyButton();\n }\n }\n\n this.#renderSnippet();\n }\n }\n\n // ── Copy button ────────────────────────────────────────────────────────────\n\n #initCopyButton() {\n if (this.shadowRoot.querySelector('.copy-btn')) return;\n\n const btn = document.createElement('button');\n btn.className = 'copy-btn';\n btn.type = 'button';\n btn.setAttribute('aria-label', 'Copy code');\n const copyIcon = document.createElement('descope-icon');\n copyIcon.setAttribute('src', copyIconSrc);\n\n const checkIcon = document.createElement('descope-icon');\n checkIcon.setAttribute('src', checkIconSrc);\n checkIcon.classList.add('check-icon');\n\n btn.appendChild(copyIcon);\n btn.appendChild(checkIcon);\n btn.addEventListener('click', () => this.#handleCopyClick());\n\n this.shadowRoot.querySelector('.wrapper').appendChild(btn);\n }\n\n #destroyCopyButton() {\n this.shadowRoot.querySelector('.copy-btn')?.remove();\n }\n\n #handleCopyClick() {\n const btn = this.shadowRoot.querySelector('.copy-btn');\n navigator.clipboard\n .writeText(decode(this.textContent))\n .then(() => {\n btn.classList.add('copied');\n setTimeout(() => btn.classList.remove('copied'), 2000);\n })\n .catch(() => {});\n }\n\n // ── Snippet rendering ──────────────────────────────────────────────────────\n\n #renderSnippet() {\n const sanitized = decode(this.textContent);\n const language = this.lang;\n\n if (!language) {\n this.contentNode.textContent = sanitized;\n return;\n }\n\n const { value: highlighted } = hljs.highlight(sanitized, { language });\n\n this.contentNode.innerHTML = tpl(highlighted, this.isInline);\n }\n}\n\nconst copyBtn = { selector: () => '.copy-btn' };\n\nconst {\n root,\n docTag,\n keyword,\n metaKeyword,\n templateTag,\n templateVariable,\n type,\n variableLanguage,\n title,\n titleClass,\n titleClassInherited,\n titleFunction,\n attr,\n attribute,\n literal,\n meta,\n number,\n operator,\n variable,\n selectorAttr,\n selectorClass,\n selectorId,\n regexp,\n string,\n metaString,\n builtIn,\n symbol,\n comment,\n code,\n formula,\n name,\n quote,\n selectorTag,\n selectorPseudo,\n subst,\n section,\n bullet,\n emphasis,\n strong,\n addition,\n deletion,\n charEscape,\n link,\n params,\n property,\n punctuation,\n tag,\n} = {\n root: { selector: () => '.hljs' },\n docTag: { selector: () => '.hljs-doctag' },\n keyword: { selector: () => '.hljs-keyword' },\n metaKeyword: { selector: () => '.hljs-meta .hljs-keyword' },\n templateTag: { selector: () => '.hljs-template-tag' },\n templateVariable: { selector: () => '.hljs-template-variable' },\n type: { selector: () => '.hljs-type' },\n variableLanguage: { selector: () => '.hljs-variable.language' },\n title: { selector: () => '.hljs-title' },\n titleClass: { selector: () => '.hljs-title.class_' },\n titleClassInherited: { selector: () => '.hljs-title.class_.inherited__' },\n titleFunction: { selector: () => '.hljs-title.function_' },\n attr: { selector: () => '.hljs-attr' },\n attribute: { selector: () => '.hljs-attribute' },\n literal: { selector: () => '.hljs-literal' },\n meta: { selector: () => '.hljs-meta' },\n number: { selector: () => '.hljs-number' },\n operator: { selector: () => '.hljs-operator' },\n variable: { selector: () => '.hljs-variable' },\n selectorAttr: { selector: () => '.hljs-selector-attr' },\n selectorClass: { selector: () => '.hljs-selector-class' },\n selectorId: { selector: () => '.hljs-selector-id' },\n regexp: { selector: () => '.hljs-regexp' },\n string: { selector: () => '.hljs-string' },\n metaString: { selector: () => '.hljs-meta .hljs-string' },\n builtIn: { selector: () => '.hljs-built_in' },\n symbol: { selector: () => '.hljs-symbol' },\n comment: { selector: () => '.hljs-comment' },\n code: { selector: () => '.hljs-code' },\n formula: { selector: () => '.hljs-formula' },\n name: { selector: () => '.hljs-name' },\n quote: { selector: () => '.hljs-quote' },\n selectorTag: { selector: () => '.hljs-selector-tag' },\n selectorPseudo: { selector: () => '.hljs-selector-pseudo' },\n subst: { selector: () => '.hljs-subst' },\n section: { selector: () => '.hljs-section' },\n bullet: { selector: () => '.hljs-bullet' },\n emphasis: { selector: () => '.hljs-emphasis' },\n strong: { selector: () => '.hljs-strong' },\n addition: { selector: () => '.hljs-addition' },\n deletion: { selector: () => '.hljs-deletion' },\n charEscape: { selector: () => '.hljs-char.escape' },\n link: { selector: () => '.hljs-link' },\n params: { selector: () => '.hljs-params' },\n property: { selector: () => '.hljs-property' },\n punctuation: { selector: () => '.hljs-punctuation' },\n tag: { selector: () => '.hljs-tag' },\n};\n\nexport const CodeSnippetClass = compose(\n createStyleMixin({\n mappings: {\n rootBgColor: { ...root, property: 'background-color' },\n rootTextColor: { ...root, property: 'color' },\n docTagTextColor: { ...docTag, property: 'color' },\n keywordTextColor: { ...keyword, property: 'color' },\n metaKeywordTextColor: { ...metaKeyword, property: 'color' },\n templateTagTextColor: { ...templateTag, property: 'color' },\n templateVariableTextColor: { ...templateVariable, property: 'color' },\n typeTextColor: { ...type, property: 'color' },\n variableLanguageTextColor: { ...variableLanguage, property: 'color' },\n titleTextColor: { ...title, property: 'color' },\n titleClassTextColor: { ...titleClass, property: 'color' },\n titleClassInheritedTextColor: { ...titleClassInherited, property: 'color' },\n titleFunctionTextColor: { ...titleFunction, property: 'color' },\n attrTextColor: { ...attr, property: 'color' },\n attributeTextColor: { ...attribute, property: 'color' },\n literalTextColor: { ...literal, property: 'color' },\n metaTextColor: { ...meta, property: 'color' },\n numberTextColor: { ...number, property: 'color' },\n operatorTextColor: { ...operator, property: 'color' },\n variableTextColor: { ...variable, property: 'color' },\n selectorAttrTextColor: { ...selectorAttr, property: 'color' },\n selectorClassTextColor: { ...selectorClass, property: 'color' },\n selectorIdTextColor: { ...selectorId, property: 'color' },\n regexpTextColor: { ...regexp, property: 'color' },\n stringTextColor: { ...string, property: 'color' },\n metaStringTextColor: { ...metaString, property: 'color' },\n builtInTextColor: { ...builtIn, property: 'color' },\n symbolTextColor: { ...symbol, property: 'color' },\n commentTextColor: { ...comment, property: 'color' },\n codeTextColor: { ...code, property: 'color' },\n formulaTextColor: { ...formula, property: 'color' },\n nameTextColor: { ...name, property: 'color' },\n quoteTextColor: { ...quote, property: 'color' },\n selectorTagTextColor: { ...selectorTag, property: 'color' },\n selectorPseudoTextColor: { ...selectorPseudo, property: 'color' },\n substTextColor: { ...subst, property: 'color' },\n sectionTextColor: { ...section, property: 'color' },\n bulletTextColor: { ...bullet, property: 'color' },\n emphasisTextColor: { ...emphasis, property: 'color' },\n strongTextColor: { ...strong, property: 'color' },\n additionTextColor: { ...addition, property: 'color' },\n additionBgColor: { ...addition, property: 'background-color' },\n deletionTextColor: { ...deletion, property: 'color' },\n deletionBgColor: { ...deletion, property: 'background-color' },\n charEscapeTextColor: { ...charEscape, property: 'color' },\n linkTextColor: { ...link, property: 'color' },\n paramsTextColor: { ...params, property: 'color' },\n propertyTextColor: { ...property, property: 'color' },\n punctuationTextColor: { ...punctuation, property: 'color' },\n tagTextColor: { ...tag, property: 'color' },\n copyButtonSize: [\n { ...copyBtn, property: 'width' },\n { ...copyBtn, property: 'height' },\n ],\n copyButtonBorderRadius: { ...copyBtn, property: 'border-radius' },\n copyButtonBorderWidth: { ...copyBtn, property: 'border-width' },\n copyButtonBorderColor: { ...copyBtn, property: 'border-color' },\n copyButtonBgColor: { ...copyBtn, property: 'background-color' },\n copyButtonHoverBgColor: { selector: () => '.copy-btn:hover', property: 'background-color' },\n copyButtonColor: { ...copyBtn, property: 'color' },\n },\n }),\n draggableMixin,\n componentNameValidationMixin\n)(CodeSnippet);\n","import '@descope-ui/descope-icon';\nimport { componentName, CodeSnippetClass } from './CodeSnippetClass';\n\ncustomElements.define(componentName, CodeSnippetClass);\n\nexport { CodeSnippetClass, componentName };\n"],"names":["module","exports","componentName","IconClass","mappings","fill","property","cssVarList","slots","wrappedEleName","style","excludeAttrsSync","customElements","define","srcAttrs","RawImage","baseSelector","observedAttributes","constructor","super","this","attachShadow","mode","innerHTML","init","toggleVisibility","getSrc","onThemeChange","renderImage","isVisible","classList","remove","add","altText","getAttribute","legacySrc","themeSrc","currentThemeName","updateFillColor","node","querySelectorAll","forEach","ele","setAttribute","ImageClass","then","res","appendChild","shouldRender","src","srcVal","attributeChangedCallback","attrName","oldValue","newValue","height","selector","width","createSvgEle","text","clean","sanitize","USE_PROFILES","svg","svgFilters","ADD_TAGS","FORBID_TAGS","DOMParser","parseFromString","querySelector","createImage","async","startsWith","isBase64Svg","svgXml","atob","slice","base64Prefix","path","match","getFileExtension","fetchedSrc","fetch","document","createElement","createImgEle","setProperty","decode","input","txt","value","CodeSnippet","createBaseClass","lang","isInline","bind","contentNode","shadowRoot","btn","className","type","copyIcon","checkIcon","addEventListener","navigator","clipboard","writeText","textContent","setTimeout","catch","sanitized","language","highlighted","highlight","copyBtn","root","docTag","keyword","metaKeyword","templateTag","templateVariable","variableLanguage","title","titleClass","titleClassInherited","titleFunction","attr","attribute","literal","meta","number","operator","variable","selectorAttr","selectorClass","selectorId","regexp","string","metaString","builtIn","symbol","comment","code","formula","name","quote","selectorTag","selectorPseudo","subst","section","bullet","emphasis","strong","addition","deletion","charEscape","link","params","punctuation","tag","CodeSnippetClass","rootBgColor","rootTextColor","docTagTextColor","keywordTextColor","metaKeywordTextColor","templateTagTextColor","templateVariableTextColor","typeTextColor","variableLanguageTextColor","titleTextColor","titleClassTextColor","titleClassInheritedTextColor","titleFunctionTextColor","attrTextColor","attributeTextColor","literalTextColor","metaTextColor","numberTextColor","operatorTextColor","variableTextColor","selectorAttrTextColor","selectorClassTextColor","selectorIdTextColor","regexpTextColor","stringTextColor","metaStringTextColor","builtInTextColor","symbolTextColor","commentTextColor","codeTextColor","formulaTextColor","nameTextColor","quoteTextColor","selectorTagTextColor","selectorPseudoTextColor","substTextColor","sectionTextColor","bulletTextColor","emphasisTextColor","strongTextColor","additionTextColor","additionBgColor","deletionTextColor","deletionBgColor","charEscapeTextColor","linkTextColor","paramsTextColor","propertyTextColor","punctuationTextColor","tagTextColor","copyButtonSize","copyButtonBorderRadius","copyButtonBorderWidth","copyButtonBorderColor","copyButtonBgColor","copyButtonHoverBgColor","copyButtonColor"],"sourceRoot":""}
@@ -1,2 +1,2 @@
1
- "use strict";(self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[2200,3521],{80522(e,t,r){r.r(t),r.d(t,{CodeSnippetClass:()=>le,componentName:()=>c});var o=r(75780),l=r(25964),s=r(79365),n=r(9696),a=r(97810),i=r(81365);const c=(0,a.xE)("code-snippet");class d extends((0,i.q)({componentName:c,baseSelector:":host > code"})){static get observedAttributes(){return["lang","inline"]}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML='\n <code class="hljs"></code>\n ',(0,l.fz)("\n :host {\n display: inline-block;\n width: 100%;\n }\n code {\n display: block;\n width: 100%;\n min-height: 1em;\n overflow-x: scroll;\n overflow-y: scroll;\n }\n pre {\n margin: 0;\n }\n ",this)}init(){super.init?.(),this.lang=this.getAttribute("lang"),this.isInline="true"===this.getAttribute("inline"),(0,a.Ge)(this,this.#e.bind(this))}get contentNode(){return this.shadowRoot.querySelector(this.baseSelector)}attributeChangedCallback(e,t,r){super.attributeChangedCallback?.(e,t,r),t!==r&&("inline"===e&&(this.isInline=r),"lang"===e&&(this.lang=r),this.#e())}#e(){const e=(e=>{const t=document.createElement("textarea");return t.innerHTML=e,t.value})(this.textContent),t=this.lang;if(!t)return void(this.contentNode.textContent=e);const{value:r}=o.A.highlight(e,{language:t});var l;this.contentNode.innerHTML=(l=r,this.isInline?l:`<pre>${l}</pre>`)}}const{root:p,docTag:h,keyword:u,metaKeyword:m,templateTag:g,templateVariable:b,type:y,variableLanguage:C,title:x,titleClass:w,titleClassInherited:v,titleFunction:T,attr:j,attribute:_,literal:f,meta:R,number:k,operator:E,variable:I,selectorAttr:A,selectorClass:S,selectorId:D,regexp:P,string:H,metaString:L,builtIn:N,symbol:$,comment:O,code:B,formula:z,name:F,quote:q,selectorTag:M,selectorPseudo:V,subst:G,section:K,bullet:W,emphasis:J,strong:Q,addition:Z,deletion:U,charEscape:X,link:Y,params:ee,property:te,punctuation:re,tag:oe}={root:{selector:()=>".hljs"},docTag:{selector:()=>".hljs-doctag"},keyword:{selector:()=>".hljs-keyword"},metaKeyword:{selector:()=>".hljs-meta .hljs-keyword"},templateTag:{selector:()=>".hljs-template-tag"},templateVariable:{selector:()=>".hljs-template-variable"},type:{selector:()=>".hljs-type"},variableLanguage:{selector:()=>".hljs-variable.language"},title:{selector:()=>".hljs-title"},titleClass:{selector:()=>".hljs-title.class_"},titleClassInherited:{selector:()=>".hljs-title.class_.inherited__"},titleFunction:{selector:()=>".hljs-title.function_"},attr:{selector:()=>".hljs-attr"},attribute:{selector:()=>".hljs-attribute"},literal:{selector:()=>".hljs-literal"},meta:{selector:()=>".hljs-meta"},number:{selector:()=>".hljs-number"},operator:{selector:()=>".hljs-operator"},variable:{selector:()=>".hljs-variable"},selectorAttr:{selector:()=>".hljs-selector-attr"},selectorClass:{selector:()=>".hljs-selector-class"},selectorId:{selector:()=>".hljs-selector-id"},regexp:{selector:()=>".hljs-regexp"},string:{selector:()=>".hljs-string"},metaString:{selector:()=>".hljs-meta .hljs-string"},builtIn:{selector:()=>".hljs-built_in"},symbol:{selector:()=>".hljs-symbol"},comment:{selector:()=>".hljs-comment"},code:{selector:()=>".hljs-code"},formula:{selector:()=>".hljs-formula"},name:{selector:()=>".hljs-name"},quote:{selector:()=>".hljs-quote"},selectorTag:{selector:()=>".hljs-selector-tag"},selectorPseudo:{selector:()=>".hljs-selector-pseudo"},subst:{selector:()=>".hljs-subst"},section:{selector:()=>".hljs-section"},bullet:{selector:()=>".hljs-bullet"},emphasis:{selector:()=>".hljs-emphasis"},strong:{selector:()=>".hljs-strong"},addition:{selector:()=>".hljs-addition"},deletion:{selector:()=>".hljs-deletion"},charEscape:{selector:()=>".hljs-char.escape"},link:{selector:()=>".hljs-link"},params:{selector:()=>".hljs-params"},property:{selector:()=>".hljs-property"},punctuation:{selector:()=>".hljs-punctuation"},tag:{selector:()=>".hljs-tag"}},le=(0,n.Zz)((0,s.RF)({mappings:{rootBgColor:{...p,property:"background-color"},rootTextColor:{...p,property:"color"},docTagTextColor:{...h,property:"color"},keywordTextColor:{...u,property:"color"},metaKeywordTextColor:{...m,property:"color"},templateTagTextColor:{...g,property:"color"},templateVariableTextColor:{...b,property:"color"},typeTextColor:{...y,property:"color"},variableLanguageTextColor:{...C,property:"color"},titleTextColor:{...x,property:"color"},titleClassTextColor:{...w,property:"color"},titleClassInheritedTextColor:{...v,property:"color"},titleFunctionTextColor:{...T,property:"color"},attrTextColor:{...j,property:"color"},attributeTextColor:{..._,property:"color"},literalTextColor:{...f,property:"color"},metaTextColor:{...R,property:"color"},numberTextColor:{...k,property:"color"},operatorTextColor:{...E,property:"color"},variableTextColor:{...I,property:"color"},selectorAttrTextColor:{...A,property:"color"},selectorClassTextColor:{...S,property:"color"},selectorIdTextColor:{...D,property:"color"},regexpTextColor:{...P,property:"color"},stringTextColor:{...H,property:"color"},metaStringTextColor:{...L,property:"color"},builtInTextColor:{...N,property:"color"},symbolTextColor:{...$,property:"color"},commentTextColor:{...O,property:"color"},codeTextColor:{...B,property:"color"},formulaTextColor:{...z,property:"color"},nameTextColor:{...F,property:"color"},quoteTextColor:{...q,property:"color"},selectorTagTextColor:{...M,property:"color"},selectorPseudoTextColor:{...V,property:"color"},substTextColor:{...G,property:"color"},sectionTextColor:{...K,property:"color"},bulletTextColor:{...W,property:"color"},emphasisTextColor:{...J,property:"color"},strongTextColor:{...Q,property:"color"},additionTextColor:{...Z,property:"color"},additionBgColor:{...Z,property:"background-color"},deletionTextColor:{...U,property:"color"},deletionBgColor:{...U,property:"background-color"},charEscapeTextColor:{...X,property:"color"},linkTextColor:{...Y,property:"color"},paramsTextColor:{...ee,property:"color"},propertyTextColor:{...te,property:"color"},punctuationTextColor:{...re,property:"color"},tagTextColor:{...oe,property:"color"}}}),s.VO,s.tQ)(d);customElements.define(c,le)},12909(e,t,r){r.r(t),r.d(t,{componentName:()=>n});var o=r(97810),l=r(115);class s extends l.i{_defaultRenderer(e,t,r){const o=r.item[this.path]||"",l=Array.from(this.children).find(e=>{const t=e.getAttribute("data-pattern");return!t||new RegExp(t).test(o)});if(!l)return void this.__setTextContent(e,r.item[this.path]||"");const s=l.cloneNode(!0);s.textContent=o||"",e.innerHTML="",e.append(s)}}const n=(0,o.xE)("grid-custom-column");customElements.define(n,s)},92107(e,t,r){r.r(t),r.d(t,{componentName:()=>n});var o=r(97810),l=r(94591);class s extends l.v{get sortable(){return"true"===this.getAttribute("sortable")}_defaultRenderer(e,t,r){const o=t._gridValue,l=o.detailsOpenedItems?.indexOf(r.item)??-1,s=-1!==l,n=document.createElement("vaadin-icon");n.icon=s?"vaadin:angle-up":"vaadin:angle-down",n.classList.add("toggle-details-button",s?"opened":"closed"),e.innerHTML="",e.append(n),n.onclick=()=>{o.detailsOpenedItems=s?o.detailsOpenedItems.toSpliced(l,1):[...o.detailsOpenedItems,r.item]}}_defaultHeaderRenderer(e,t){this.sortable?super._defaultHeaderRenderer(e,t):this.__setTextContent(e,this.__getHeader(this.header,this.path))}}r(95260),r(37182);const n=(0,o.xE)("grid-item-details-column");customElements.define(n,s)},57641(e,t,r){r.r(t),r.d(t,{componentName:()=>i}),r(49582);var o=r(97810),l=r(49654);const s=()=>{const e=document.createElement("descope-checkbox");return e.setAttribute("bordered","true"),e.setAttribute("size","xs"),e},n=e=>!!e.items?.length&&e.selectedItems.length===e.items.length;class a extends l.${_onHeaderRendererOrBindingChanged(){}_headerRenderer(e){const t=e.parentNode;let r=e.querySelector("descope-checkbox");r||(r=s(),r.addEventListener("input",()=>{const e=n(t);t.selectedItems=e?[]:t.items}),e.appendChild(r)),r.setAttribute("checked",n(t))}_defaultRenderer(e,t,r){const o=e.parentNode;let l=e.querySelector("descope-checkbox");l||(l=s(),e.appendChild(l)),l.onchange=()=>{l.checked?o.selectItem(r.item):o.deselectItem(r.item)},l.setAttribute("checked",r.selected)}}const i=(0,o.xE)("grid-selection-column");customElements.define(i,a)},115(e,t,r){r.d(t,{i:()=>l});var o=r(94591);class l extends o.v{get sortable(){return"true"===this.getAttribute("sortable")}_defaultRenderer(e,t,r){const o=r.item[this.path]||"",l=Array.isArray(o)?o.join(", "):o;this.__setTextContent(e,l),e.title=l}_defaultHeaderRenderer(e,t){this.sortable?super._defaultHeaderRenderer(e,t):this.__setTextContent(e,this.__getHeader(this.header,this.path))}}},57148(e,t,r){r.r(t),r.d(t,{componentName:()=>s});var o=r(97810),l=r(115);const s=(0,o.xE)("grid-text-column");customElements.define(s,l.i)},38976(e,t,r){r.r(t),r.d(t,{GridClass:()=>A,componentName:()=>h}),r(6735),r(57148),r(12909),r(57641),r(92107),r(80522);var o=r(9696),l=r(97810),s=r(79365);const n=e=>{const t=Array.isArray(e);return t||console.error("data must be an array, received:",e),t},a=e=>{const t=document.createElement("div");return t.textContent=e,t.innerHTML},i=e=>(e=>e?.constructor===Object)(e)?"object":Array.isArray(e)?"array":/^\s*<[\s\S]*>/.test(e)?"xml":"text",c=(e,t)=>`<descope-code-snippet lang="${t}" class="row-details__value code">${a(e)}</descope-code-snippet>`,d=e=>`<div class="row-details__value text" title="${e}">${a(e)}</div>`,p=e=>c(JSON.stringify(e,null,2),"json"),h=(0,l.xE)("grid"),{host:u,headerRow:m,headerRowCell:g,contentRow:b,firstRow:y,sortIndicators:C,activeSortIndicator:x,selectedRow:w,rowSeparator:v,resizeHandle:T,toggleDetailsPanelButton:j,toggleDetailsPanelButtonOpened:_,toggleDetailsPanelButtonClosed:f,detailsPanel:R,detailsPanelLabels:k,selectedRowCell:E,detailsPanelContent:I}={host:{selector:()=>"vaadin-grid"},headerRow:{selector:()=>"::part(header-cell)"},headerRowCell:{selector:()=>"vaadin-grid::part(header-cell)"},contentRow:{selector:()=>"::part(cell)"},firstRow:{selector:()=>"::part(first-header-row-cell)"},selectedRow:{selector:()=>"::part(selected-row)"},selectedRowCell:{selector:()=>"::part(selected-row-cell)"},sortIndicators:{selector:()=>"vaadin-grid-sorter::part(indicators)"},activeSortIndicator:{selector:()=>"vaadin-grid-sorter[direction]"},rowSeparator:{selector:()=>"vaadin-grid::part(body-cell)"},resizeHandle:{selector:()=>"::part(resize-handle)"},toggleDetailsPanelButton:{selector:()=>"vaadin-grid vaadin-icon.toggle-details-button"},toggleDetailsPanelButtonOpened:{selector:()=>"vaadin-grid vaadin-icon.toggle-details-button.opened"},toggleDetailsPanelButtonClosed:{selector:()=>"vaadin-grid vaadin-icon.toggle-details-button.closed"},detailsPanel:{selector:()=>"vaadin-grid::part(details-cell)"},detailsPanelLabels:{selector:()=>"vaadin-grid .row-details__label"},detailsPanelContent:{selector:()=>"vaadin-grid .row-details"}},A=(0,o.Zz)((0,s.RF)({componentNameOverride:(0,l.xE)("input-wrapper")}),(0,s.RF)({mappings:{hostWidth:{selector:()=>":host",property:"width"},hostHeight:{selector:()=>":host",property:"height"},hostMinHeight:{selector:()=>":host",property:"min-height"},fontFamily:[{...m},{...b}],fontSize:[{...m},{...b}],fontWeight:{...b},valueTextColor:{...b,property:"color"},backgroundColor:[{...u,property:"background-color"},{...b,property:"background-color"}],sortIndicatorsColor:{...C,property:"color"},activeSortIndicator:{...x,property:"color"},borderColor:{...u,property:"border-color"},borderWidth:{...u,property:"border-width"},borderStyle:{...u,property:"border-style"},borderRadius:{...u,property:"border-radius"},selectedBackgroundColor:[{...w,property:"background-color"},{...E,property:"background-color"}],headerRowTextColor:{...g,property:"color"},separatorColor:[{...y,property:"border-bottom-color"},{...v,property:"border-top-color"}],resizeHandleColor:{...T,property:"background-color"},hostDirection:{...u,property:"direction",fallback:"ltr"},toggleDetailsPanelButtonSize:[{...j,property:"width"},{...j,property:"height"}],toggleDetailsPanelButtonOpenedColor:{..._,property:"color"},toggleDetailsPanelButtonClosedColor:{...f,property:"color"},toggleDetailsPanelButtonCursor:{...j,property:"cursor"},detailsPanelBackgroundColor:{...R,property:"background-color"},detailsPanelBorderTopColor:{...R,property:"border-top-color"},detailsPanelLabelsColor:{...k,property:"color"},detailsPanelLabelsFontSize:{...k,property:"font-size"},detailsPanelItemsGap:{...I,property:"grid-gap"},detailsPanelPadding:{...I,property:"padding"}}}),s.VO,s.tQ,e=>class extends e{#t;init(){super.init?.(),this.handleColumns(),this.forwardSelectedItemsChange(),this.baseElement._mapSorters=()=>{};const e=this.baseElement._updateDetailsCellHeight;this.baseElement._updateDetailsCellHeight=t=>{t&&e.call(this.baseElement,t)},this.baseElement.rowDetailsRenderer=this.#r.bind(this)}#r=async(e,t,r)=>{e.addEventListener("mousedown",e=>e.stopImmediatePropagation(),!0);const o=this.getRowDetailsTemplate(r.item);e.innerHTML="",e.append(o.content.cloneNode(!0))};getRowDetailsTemplate(e){const t=this.#t.reduce((e,{path:t,header:r})=>t&&r?{...e,[t]:r}:e,{}),r=this.rowDetailsRenderer?.(e,t)??((e,t)=>`\n <div class="row-details">\n ${Object.entries(e).map(([e,r])=>`<div class="row-details__item" >\n <div class="row-details__label">${t[e]||(0,o.wy)(e)}</div>\n ${(e=>{const t=i(e);return"object"===t?p(e):"xml"===t?(e=>c(e,"xml"))(e):"array"===t?e.some(e=>"object"===i(e))?p(e):d(e.join(",\n")):d(e)})(r)}\n </div>`).join("\n")}\n</div>\n `)(e,t);switch(!0){case r instanceof HTMLTemplateElement:return r;case"string"==typeof r:return Object.assign(document.createElement("template"),{innerHTML:r});default:throw new Error("rowDetailsRenderer should return a string or a template")}}forwardSelectedItemsChange(){this.baseElement.addEventListener("selected-items-changed",e=>{this.dispatchEvent(new CustomEvent("selected-items-changed",{bubbles:!0,composed:!0,detail:e.detail}))})}attributeChangedCallback(e,t,r){super.attributeChangedCallback?.(e,t,r),"columns"===e&&this.setColumnsDataFromAttr()}handleColumns(){this.columnsAttr?this.setColumnsDataFromAttr():this.children.length&&this.setColumnsFromChildren()}setColumnsFromChildren(){this.#t=Array.from(this.children).map(e=>({path:e.getAttribute("path"),header:e.getAttribute("header"),type:e.localName.match("^descope-grid-(\\w+)-column$")?.[1]||"text",attrs:["frozen","resizable","auto-width","status"].reduce((t,r)=>{const o=e.getAttribute(r);return o&&(t[r]=o),t},{})}))}get columnsAttr(){return this.getAttribute("columns")}setColumnsDataFromAttr(){try{const e=JSON.parse(this.columnsAttr);n(e)&&(this.columns=e)}catch(e){console.error('could not parse data string from attribute "columns" -',e.message)}}#o=({path:e,header:t,type:r,attrs:o})=>{const l=`descope-grid-${r}-column`;return`<${l} header="${t}" path="${e}" ${Object.entries(o).map(([e,t])=>`${e}="${t}"`).join(" ")}></${l}>`};get renderColumn(){return this.#o}set renderColumn(e){this.#o=e,this.renderColumns()}getColumnsTemplate(){return this.#t?.reduce?.((e,t)=>e+(this.renderColumn?.(t||{})||""),"")}reassignRowDetailsRenderer(){this.baseElement.rowDetailsRenderer=null,setTimeout(()=>{this.baseElement.rowDetailsRenderer=this.#r.bind(this)},0)}renderColumns(){const e=this.getColumnsTemplate();e&&(this.reassignRowDetailsRenderer(),this.innerHTML=e)}get grid(){return this.shadowRoot.querySelector("vaadin-grid")}get data(){return this.grid.items}set data(e){if(n(e)&&this.grid.items!==e&&(this.grid.items=e,this.grid.selectedItems)){const e=new Set(this.grid.items.map(e=>e[this.uniqueColumnId]??e)),t=this.grid.selectedItems.filter(t=>e.has(t[this.uniqueColumnId]??t));this.grid.selectedItems.length!==t.length&&(this.grid.selectedItems=t)}}get columns(){return this.#t}set columns(e){this.#t=e,this.renderColumns()}get paths(){return this.columns.map(e=>e.path)}get uniqueColumnId(){return this.getAttribute("unique-column-id")}})((0,s.tz)({delegatesFocus:!1,slots:[""],wrappedEleName:"vaadin-grid",style:()=>`\n /*css*/\n vaadin-grid {\n overflow: hidden;\n height: 100%;\n min-height: 300px;\n }\n vaadin-grid-cell-content {\n display: flex;\n }\n vaadin-grid::part(selected-row-cell) {\n background-image: none;\n box-shadow: none;\n background-color: inherit;\n }\n vaadin-grid::part(details-cell) {\n border-top-style: dashed;\n border-top-width: 1px;\n }\n vaadin-grid .row-details {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(max(200px, calc(100%/4 - var(${A.cssVarList.detailsPanelItemsGap}))), 1fr));\n width: 100%;\n }\n vaadin-grid .row-details__item:has(.row-details__value.code) {\n grid-column: 1 / -1;\n order: 2;\n }\n vaadin-grid .row-details__value.text {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: pre;\n }\n vaadin-grid .row-details__value.code {\n margin-top: 5px;\n max-height: 120px;\n overflow: scroll;\n font-size: 0.85em;\n }\n vaadin-grid vaadin-icon.toggle-details-button {\n margin: auto;\n }\n /*!css*/\n\t\t`,excludeAttrsSync:["columns","tabindex","style"],componentName:h}));customElements.define(h,A)}}]);
1
+ (self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[1202,2200,3521,6724],{25828(e){e.exports="data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iY2hlY2staWNvbiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJjdXJyZW50Q29sb3IiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj4gPHBvbHlsaW5lIHBvaW50cz0iMjAgNiA5IDE3IDQgMTIiPjwvcG9seWxpbmU+IDwvc3ZnPiA="},71957(e){e.exports="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPiA8cmVjdCB4PSI5IiB5PSI5IiB3aWR0aD0iMTMiIGhlaWdodD0iMTMiIHJ4PSIyIiByeT0iMiI+PC9yZWN0PiA8cGF0aCBkPSJNNSAxNUg0YTIgMiAwIDAgMS0yLTJWNGEyIDIgMCAwIDEgMi0yaDlhMiAyIDAgMCAxIDIgMnYxIj48L3BhdGg+IDwvc3ZnPiA="},98538(e,t,r){"use strict";r.d(t,{S:()=>a,T:()=>i});var o=r(88961),s=r(25964),l=r(8512),n=r(63200);const i=(0,s.xE)("icon"),a=(0,n.Zz)((0,o.RF)({mappings:{fill:[{},{property:l.q.cssVarList.fill}]}}),o.VO,o.tQ)((0,o.tz)({slots:[],wrappedEleName:"descope-image",style:()=>"\n :host {\n display: inline-flex;\n max-height: 100%;\n }\n ",excludeAttrsSync:["tabindex","class","style"],componentName:i}))},56737(e,t,r){"use strict";r.r(t),r.d(t,{IconClass:()=>o.S,componentName:()=>o.T}),r(53455);var o=r(98538);customElements.define(o.T,o.S)},8512(e,t,r){"use strict";r.d(t,{T:()=>a,q:()=>p});var o=r(88961),s=r(72270),l=r(63200),n=r(25964),i=r(18782);const a=(0,n.xE)("image"),c=["src","src-dark"];class d extends((0,s.qu)({componentName:a,baseSelector:"slot"})){static get observedAttributes(){return c}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML="\n\t\t<slot></slot>\n\t",(0,n.fz)("\n\t\t\t:host {\n\t\t\t\tdisplay: inline-flex;\n\t\t\t}\n :host > slot {\n width: 100%;\n height: 100%;\n\t\t\t\tbox-sizing: border-box;\n\t\t\t\tdisplay: flex;\n\t\t\t\toverflow: hidden;\n\t\t\t}\n\n ::slotted(*) {\n width: 100%;\n\t\t\t}\n\n .hidden {\n display: none;\n }\n ",this)}init(){super.init?.(),this.toggleVisibility(this.getSrc)}onThemeChange(){this.renderImage()}toggleVisibility(e){e?this.classList.remove("hidden"):this.classList.add("hidden")}get altText(){return this.getAttribute("alt")||""}get legacySrc(){return this.getAttribute("src")}get themeSrc(){return this.getAttribute(`src-${this.currentThemeName}`)}get getSrc(){return this.themeSrc||this.legacySrc}updateFillColor(e){[e,...e.querySelectorAll("*[fill]")].forEach(e=>{e.setAttribute("fill",`var(${p.cssVarList.fill}, ${e.getAttribute("fill")||"''"})`)})}renderImage(){this.toggleVisibility(this.getSrc),(0,i.m)(this.getSrc,this.altText).then(e=>{this.innerHTML="",e&&(this.updateFillColor(e),this.appendChild(e))})}shouldRender(e){const t=this.getAttribute(e);return this.getSrc===t}attributeChangedCallback(e,t,r){super.attributeChangedCallback?.(e,t,r),t!==r&&this.shouldRender(e)&&this.renderImage()}}const p=(0,l.Zz)((0,o.RF)({mappings:{fill:{},height:{selector:()=>":host"},width:{selector:()=>":host"}}}),o.VO,o.tQ)(d)},18782(e,t,r){"use strict";r.d(t,{m:()=>l});var o=r(25414);const s=e=>{const t=o.A.sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0},ADD_TAGS:["image"],FORBID_TAGS:["defs"]});return(new DOMParser).parseFromString(t,"image/svg+xml").querySelector("svg")},l=async(e,t)=>{try{let r;if((e=>e.startsWith("data:image/svg+xml;base64,"))(e)){const t=atob(e.slice(26));r=s(t)}else if("svg"===(e=>{const t=e.match(/\.([0-9a-z]+)(?:[\\?#]|$)/i);return t?t[1]:null})(e)){const t=await fetch(e),o=await t.text();r=s(o)}else r=((e,t)=>{const r=document.createElement("img");return r.setAttribute("src",e),r.setAttribute("alt",t),r})(e,t);return r.style.setProperty("max-width","100%"),r.style.setProperty("max-height","100%"),r}catch{return null}}},53455(e,t,r){"use strict";r.r(t),r.d(t,{ImageClass:()=>o.q,componentName:()=>o.T});var o=r(8512);customElements.define(o.T,o.q)},80522(e,t,r){"use strict";r.r(t),r.d(t,{CodeSnippetClass:()=>de,componentName:()=>m}),r(56737);var o=r(75780),s=r(25964),l=r(79365),n=r(9696),i=r(97810),a=r(81365);const c=e=>{const t=document.createElement("textarea");return t.innerHTML=e,t.value};var d=r(71957),p=r.n(d),h=r(25828),u=r.n(h);const m=(0,i.xE)("code-snippet");class g extends((0,a.q)({componentName:m,baseSelector:":host > .wrapper"})){static get observedAttributes(){return["lang","inline","copy-button"]}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML='\n <div class="wrapper">\n <code class="hljs"></code>\n </div>\n ',(0,s.fz)("\n :host {\n display: inline-block;\n width: 100%;\n }\n .wrapper {\n display: grid;\n width: 100%;\n }\n code {\n grid-area: 1 / 1;\n display: block;\n width: 100%;\n min-height: 1em;\n overflow-x: auto;\n }\n pre {\n margin: 0;\n }\n .copy-btn {\n grid-area: 1 / 1;\n place-self: start end;\n margin: 8px;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0;\n border-style: solid;\n cursor: pointer;\n opacity: 0;\n transition: opacity 150ms ease, background 150ms ease;\n }\n .wrapper:hover .copy-btn,\n .copy-btn:focus-visible {\n opacity: 1;\n }\n .copy-btn descope-icon {\n width: 16px;\n height: 16px;\n pointer-events: none;\n flex-shrink: 0;\n }\n .copy-btn .check-icon {\n display: none;\n }\n .copy-btn.copied .check-icon {\n display: block;\n }\n .copy-btn.copied descope-icon:not(.check-icon) {\n display: none;\n }\n ",this)}init(){super.init?.(),this.lang=this.getAttribute("lang"),this.isInline="true"===this.getAttribute("inline"),"true"===this.getAttribute("copy-button")&&this.#e(),(0,i.Ge)(this,this.#t.bind(this))}get contentNode(){return this.shadowRoot.querySelector("code")}attributeChangedCallback(e,t,r){super.attributeChangedCallback?.(e,t,r),t!==r&&("inline"===e&&(this.isInline=r),"lang"===e&&(this.lang=r),"copy-button"===e&&("true"===r?this.#e():this.#r()),this.#t())}#e(){if(this.shadowRoot.querySelector(".copy-btn"))return;const e=document.createElement("button");e.className="copy-btn",e.type="button",e.setAttribute("aria-label","Copy code");const t=document.createElement("descope-icon");t.setAttribute("src",p());const r=document.createElement("descope-icon");r.setAttribute("src",u()),r.classList.add("check-icon"),e.appendChild(t),e.appendChild(r),e.addEventListener("click",()=>this.#o()),this.shadowRoot.querySelector(".wrapper").appendChild(e)}#r(){this.shadowRoot.querySelector(".copy-btn")?.remove()}#o(){const e=this.shadowRoot.querySelector(".copy-btn");navigator.clipboard.writeText(c(this.textContent)).then(()=>{e.classList.add("copied"),setTimeout(()=>e.classList.remove("copied"),2e3)}).catch(()=>{})}#t(){const e=c(this.textContent),t=this.lang;if(!t)return void(this.contentNode.textContent=e);const{value:r}=o.A.highlight(e,{language:t});var s;this.contentNode.innerHTML=(s=r,this.isInline?s:`<pre>${s}</pre>`)}}const y={selector:()=>".copy-btn"},{root:b,docTag:C,keyword:x,metaKeyword:v,templateTag:w,templateVariable:T,type:I,variableLanguage:f,title:j,titleClass:A,titleClassInherited:S,titleFunction:_,attr:R,attribute:k,literal:E,meta:D,number:P,operator:B,variable:H,selectorAttr:N,selectorClass:L,selectorId:M,regexp:z,string:W,metaString:$,builtIn:q,symbol:F,comment:O,code:Z,formula:G,name:V,quote:J,selectorTag:Q,selectorPseudo:Y,subst:U,section:X,bullet:K,emphasis:ee,strong:te,addition:re,deletion:oe,charEscape:se,link:le,params:ne,property:ie,punctuation:ae,tag:ce}={root:{selector:()=>".hljs"},docTag:{selector:()=>".hljs-doctag"},keyword:{selector:()=>".hljs-keyword"},metaKeyword:{selector:()=>".hljs-meta .hljs-keyword"},templateTag:{selector:()=>".hljs-template-tag"},templateVariable:{selector:()=>".hljs-template-variable"},type:{selector:()=>".hljs-type"},variableLanguage:{selector:()=>".hljs-variable.language"},title:{selector:()=>".hljs-title"},titleClass:{selector:()=>".hljs-title.class_"},titleClassInherited:{selector:()=>".hljs-title.class_.inherited__"},titleFunction:{selector:()=>".hljs-title.function_"},attr:{selector:()=>".hljs-attr"},attribute:{selector:()=>".hljs-attribute"},literal:{selector:()=>".hljs-literal"},meta:{selector:()=>".hljs-meta"},number:{selector:()=>".hljs-number"},operator:{selector:()=>".hljs-operator"},variable:{selector:()=>".hljs-variable"},selectorAttr:{selector:()=>".hljs-selector-attr"},selectorClass:{selector:()=>".hljs-selector-class"},selectorId:{selector:()=>".hljs-selector-id"},regexp:{selector:()=>".hljs-regexp"},string:{selector:()=>".hljs-string"},metaString:{selector:()=>".hljs-meta .hljs-string"},builtIn:{selector:()=>".hljs-built_in"},symbol:{selector:()=>".hljs-symbol"},comment:{selector:()=>".hljs-comment"},code:{selector:()=>".hljs-code"},formula:{selector:()=>".hljs-formula"},name:{selector:()=>".hljs-name"},quote:{selector:()=>".hljs-quote"},selectorTag:{selector:()=>".hljs-selector-tag"},selectorPseudo:{selector:()=>".hljs-selector-pseudo"},subst:{selector:()=>".hljs-subst"},section:{selector:()=>".hljs-section"},bullet:{selector:()=>".hljs-bullet"},emphasis:{selector:()=>".hljs-emphasis"},strong:{selector:()=>".hljs-strong"},addition:{selector:()=>".hljs-addition"},deletion:{selector:()=>".hljs-deletion"},charEscape:{selector:()=>".hljs-char.escape"},link:{selector:()=>".hljs-link"},params:{selector:()=>".hljs-params"},property:{selector:()=>".hljs-property"},punctuation:{selector:()=>".hljs-punctuation"},tag:{selector:()=>".hljs-tag"}},de=(0,n.Zz)((0,l.RF)({mappings:{rootBgColor:{...b,property:"background-color"},rootTextColor:{...b,property:"color"},docTagTextColor:{...C,property:"color"},keywordTextColor:{...x,property:"color"},metaKeywordTextColor:{...v,property:"color"},templateTagTextColor:{...w,property:"color"},templateVariableTextColor:{...T,property:"color"},typeTextColor:{...I,property:"color"},variableLanguageTextColor:{...f,property:"color"},titleTextColor:{...j,property:"color"},titleClassTextColor:{...A,property:"color"},titleClassInheritedTextColor:{...S,property:"color"},titleFunctionTextColor:{..._,property:"color"},attrTextColor:{...R,property:"color"},attributeTextColor:{...k,property:"color"},literalTextColor:{...E,property:"color"},metaTextColor:{...D,property:"color"},numberTextColor:{...P,property:"color"},operatorTextColor:{...B,property:"color"},variableTextColor:{...H,property:"color"},selectorAttrTextColor:{...N,property:"color"},selectorClassTextColor:{...L,property:"color"},selectorIdTextColor:{...M,property:"color"},regexpTextColor:{...z,property:"color"},stringTextColor:{...W,property:"color"},metaStringTextColor:{...$,property:"color"},builtInTextColor:{...q,property:"color"},symbolTextColor:{...F,property:"color"},commentTextColor:{...O,property:"color"},codeTextColor:{...Z,property:"color"},formulaTextColor:{...G,property:"color"},nameTextColor:{...V,property:"color"},quoteTextColor:{...J,property:"color"},selectorTagTextColor:{...Q,property:"color"},selectorPseudoTextColor:{...Y,property:"color"},substTextColor:{...U,property:"color"},sectionTextColor:{...X,property:"color"},bulletTextColor:{...K,property:"color"},emphasisTextColor:{...ee,property:"color"},strongTextColor:{...te,property:"color"},additionTextColor:{...re,property:"color"},additionBgColor:{...re,property:"background-color"},deletionTextColor:{...oe,property:"color"},deletionBgColor:{...oe,property:"background-color"},charEscapeTextColor:{...se,property:"color"},linkTextColor:{...le,property:"color"},paramsTextColor:{...ne,property:"color"},propertyTextColor:{...ie,property:"color"},punctuationTextColor:{...ae,property:"color"},tagTextColor:{...ce,property:"color"},copyButtonSize:[{...y,property:"width"},{...y,property:"height"}],copyButtonBorderRadius:{...y,property:"border-radius"},copyButtonBorderWidth:{...y,property:"border-width"},copyButtonBorderColor:{...y,property:"border-color"},copyButtonBgColor:{...y,property:"background-color"},copyButtonHoverBgColor:{selector:()=>".copy-btn:hover",property:"background-color"},copyButtonColor:{...y,property:"color"}}}),l.VO,l.tQ)(g);customElements.define(m,de)},12909(e,t,r){"use strict";r.r(t),r.d(t,{componentName:()=>n});var o=r(97810),s=r(115);class l extends s.i{_defaultRenderer(e,t,r){const o=r.item[this.path]||"",s=Array.from(this.children).find(e=>{const t=e.getAttribute("data-pattern");return!t||new RegExp(t).test(o)});if(!s)return void this.__setTextContent(e,r.item[this.path]||"");const l=s.cloneNode(!0);l.textContent=o||"",e.innerHTML="",e.append(l)}}const n=(0,o.xE)("grid-custom-column");customElements.define(n,l)},92107(e,t,r){"use strict";r.r(t),r.d(t,{componentName:()=>n});var o=r(97810),s=r(94591);class l extends s.v{get sortable(){return"true"===this.getAttribute("sortable")}_defaultRenderer(e,t,r){const o=t._gridValue,s=o.detailsOpenedItems?.indexOf(r.item)??-1,l=-1!==s,n=document.createElement("vaadin-icon");n.icon=l?"vaadin:angle-up":"vaadin:angle-down",n.classList.add("toggle-details-button",l?"opened":"closed"),e.innerHTML="",e.append(n),n.onclick=()=>{o.detailsOpenedItems=l?o.detailsOpenedItems.toSpliced(s,1):[...o.detailsOpenedItems,r.item]}}_defaultHeaderRenderer(e,t){this.sortable?super._defaultHeaderRenderer(e,t):this.__setTextContent(e,this.__getHeader(this.header,this.path))}}r(95260),r(37182);const n=(0,o.xE)("grid-item-details-column");customElements.define(n,l)},57641(e,t,r){"use strict";r.r(t),r.d(t,{componentName:()=>a}),r(49582);var o=r(97810),s=r(49654);const l=()=>{const e=document.createElement("descope-checkbox");return e.setAttribute("bordered","true"),e.setAttribute("size","xs"),e},n=e=>!!e.items?.length&&e.selectedItems.length===e.items.length;class i extends s.${_onHeaderRendererOrBindingChanged(){}_headerRenderer(e){const t=e.parentNode;let r=e.querySelector("descope-checkbox");r||(r=l(),r.addEventListener("input",()=>{const e=n(t);t.selectedItems=e?[]:t.items}),e.appendChild(r)),r.setAttribute("checked",n(t))}_defaultRenderer(e,t,r){const o=e.parentNode;let s=e.querySelector("descope-checkbox");s||(s=l(),e.appendChild(s)),s.onchange=()=>{s.checked?o.selectItem(r.item):o.deselectItem(r.item)},s.setAttribute("checked",r.selected)}}const a=(0,o.xE)("grid-selection-column");customElements.define(a,i)},115(e,t,r){"use strict";r.d(t,{i:()=>s});var o=r(94591);class s extends o.v{get sortable(){return"true"===this.getAttribute("sortable")}_defaultRenderer(e,t,r){const o=r.item[this.path]||"",s=Array.isArray(o)?o.join(", "):o;this.__setTextContent(e,s),e.title=s}_defaultHeaderRenderer(e,t){this.sortable?super._defaultHeaderRenderer(e,t):this.__setTextContent(e,this.__getHeader(this.header,this.path))}}},57148(e,t,r){"use strict";r.r(t),r.d(t,{componentName:()=>l});var o=r(97810),s=r(115);const l=(0,o.xE)("grid-text-column");customElements.define(l,s.i)},38976(e,t,r){"use strict";r.r(t),r.d(t,{GridClass:()=>E,componentName:()=>u}),r(6735),r(57148),r(12909),r(57641),r(92107),r(80522);var o=r(9696),s=r(97810),l=r(79365);const n=e=>{const t=Array.isArray(e);return t||console.error("data must be an array, received:",e),t},i=e=>{const t=document.createElement("div");return t.textContent=e,t.innerHTML},a=e=>(e=>e?.constructor===Object)(e)?"object":Array.isArray(e)?"array":/^\s*<[\s\S]*>/.test(e)?"xml":"text",c=(e,t)=>`<descope-code-snippet copy-button="true" lang="${t}" class="row-details__value code">${i(e)}</descope-code-snippet>`,d=e=>`<div class="row-details__value text" title="${e}">${i(e)}</div>`,p=e=>c(JSON.stringify(e,null,2),"json"),h=e=>{const t=a(e);return"object"===t?p(e):"xml"===t?(e=>c(e,"xml"))(e):"array"===t?e.some(e=>"object"===a(e))?p(e):d(e.join(",\n")):d(e)},u=(0,s.xE)("grid"),{host:m,headerRow:g,headerRowCell:y,contentRow:b,firstRow:C,sortIndicators:x,activeSortIndicator:v,selectedRow:w,rowSeparator:T,resizeHandle:I,toggleDetailsPanelButton:f,toggleDetailsPanelButtonOpened:j,toggleDetailsPanelButtonClosed:A,detailsPanel:S,detailsPanelLabels:_,selectedRowCell:R,detailsPanelContent:k}={host:{selector:()=>"vaadin-grid"},headerRow:{selector:()=>"::part(header-cell)"},headerRowCell:{selector:()=>"vaadin-grid::part(header-cell)"},contentRow:{selector:()=>"::part(cell)"},firstRow:{selector:()=>"::part(first-header-row-cell)"},selectedRow:{selector:()=>"::part(selected-row)"},selectedRowCell:{selector:()=>"::part(selected-row-cell)"},sortIndicators:{selector:()=>"vaadin-grid-sorter::part(indicators)"},activeSortIndicator:{selector:()=>"vaadin-grid-sorter[direction]"},rowSeparator:{selector:()=>"vaadin-grid::part(body-cell)"},resizeHandle:{selector:()=>"::part(resize-handle)"},toggleDetailsPanelButton:{selector:()=>"vaadin-grid vaadin-icon.toggle-details-button"},toggleDetailsPanelButtonOpened:{selector:()=>"vaadin-grid vaadin-icon.toggle-details-button.opened"},toggleDetailsPanelButtonClosed:{selector:()=>"vaadin-grid vaadin-icon.toggle-details-button.closed"},detailsPanel:{selector:()=>"vaadin-grid::part(details-cell)"},detailsPanelLabels:{selector:()=>"vaadin-grid .row-details__label"},detailsPanelContent:{selector:()=>"vaadin-grid .row-details"}},E=(0,o.Zz)((0,l.RF)({componentNameOverride:(0,s.xE)("input-wrapper")}),(0,l.RF)({mappings:{hostWidth:{selector:()=>":host",property:"width"},hostHeight:{selector:()=>":host",property:"height"},hostMinHeight:{selector:()=>":host",property:"min-height"},fontFamily:[{...g},{...b}],fontSize:[{...g},{...b}],fontWeight:{...b},valueTextColor:{...b,property:"color"},backgroundColor:[{...m,property:"background-color"},{...b,property:"background-color"}],sortIndicatorsColor:{...x,property:"color"},activeSortIndicator:{...v,property:"color"},borderColor:{...m,property:"border-color"},borderWidth:{...m,property:"border-width"},borderStyle:{...m,property:"border-style"},borderRadius:{...m,property:"border-radius"},selectedBackgroundColor:[{...w,property:"background-color"},{...R,property:"background-color"}],headerRowTextColor:{...y,property:"color"},separatorColor:[{...C,property:"border-bottom-color"},{...T,property:"border-top-color"}],resizeHandleColor:{...I,property:"background-color"},hostDirection:{...m,property:"direction",fallback:"ltr"},toggleDetailsPanelButtonSize:[{...f,property:"width"},{...f,property:"height"}],toggleDetailsPanelButtonOpenedColor:{...j,property:"color"},toggleDetailsPanelButtonClosedColor:{...A,property:"color"},toggleDetailsPanelButtonCursor:{...f,property:"cursor"},detailsPanelBackgroundColor:{...S,property:"background-color"},detailsPanelBorderTopColor:{...S,property:"border-top-color"},detailsPanelLabelsColor:{..._,property:"color"},detailsPanelLabelsFontSize:{..._,property:"font-size"},detailsPanelItemsGap:{...k,property:"grid-gap"},detailsPanelPadding:{...k,property:"padding"}}}),l.VO,l.tQ,e=>class extends e{#s;init(){super.init?.(),this.handleColumns(),this.forwardSelectedItemsChange(),this.baseElement._mapSorters=()=>{};const e=this.baseElement._updateDetailsCellHeight;this.baseElement._updateDetailsCellHeight=t=>{t&&e.call(this.baseElement,t)},this.baseElement.rowDetailsRenderer=this.#l.bind(this),this.baseElement.addEventListener("wheel",e=>{e.target.closest("descope-code-snippet")&&e.stopPropagation()},!0)}#l=async(e,t,r)=>{e.addEventListener("mousedown",e=>e.stopImmediatePropagation(),!0);const o=this.getRowDetailsTemplate(r.item);e.innerHTML="",e.append(o.content.cloneNode(!0))};getRowDetailsTemplate(e){const t=this.#s.reduce((e,{path:t,header:r})=>t&&r?{...e,[t]:r}:e,{}),r=this.rowDetailsRenderer?.(e,t)??((e,t)=>`\n <div class="row-details">\n ${Object.entries(e).map(([e,r])=>{const s=t[e]||(0,o.wy)(e);return(e=>{const t=a(e);return"object"===t||"xml"===t||"array"===t&&e.some(e=>"object"===a(e))})(r)?`<details class="row-details__item">\n <summary class="row-details__label">${s}</summary>\n ${h(r)}\n </details>`:`<div class="row-details__item">\n <div class="row-details__label">${s}</div>\n ${h(r)}\n </div>`}).join("\n")}\n</div>\n `)(e,t);switch(!0){case r instanceof HTMLTemplateElement:return r;case"string"==typeof r:return Object.assign(document.createElement("template"),{innerHTML:r});default:throw new Error("rowDetailsRenderer should return a string or a template")}}forwardSelectedItemsChange(){this.baseElement.addEventListener("selected-items-changed",e=>{this.dispatchEvent(new CustomEvent("selected-items-changed",{bubbles:!0,composed:!0,detail:e.detail}))})}attributeChangedCallback(e,t,r){super.attributeChangedCallback?.(e,t,r),"columns"===e&&this.setColumnsDataFromAttr()}handleColumns(){this.columnsAttr?this.setColumnsDataFromAttr():this.children.length&&this.setColumnsFromChildren()}setColumnsFromChildren(){this.#s=Array.from(this.children).map(e=>({path:e.getAttribute("path"),header:e.getAttribute("header"),type:e.localName.match("^descope-grid-(\\w+)-column$")?.[1]||"text",attrs:["frozen","resizable","auto-width","status"].reduce((t,r)=>{const o=e.getAttribute(r);return o&&(t[r]=o),t},{})}))}get columnsAttr(){return this.getAttribute("columns")}setColumnsDataFromAttr(){try{const e=JSON.parse(this.columnsAttr);n(e)&&(this.columns=e)}catch(e){console.error('could not parse data string from attribute "columns" -',e.message)}}#n=({path:e,header:t,type:r,attrs:o})=>{const s=`descope-grid-${r}-column`;return`<${s} header="${t}" path="${e}" ${Object.entries(o).map(([e,t])=>`${e}="${t}"`).join(" ")}></${s}>`};get renderColumn(){return this.#n}set renderColumn(e){this.#n=e,this.renderColumns()}getColumnsTemplate(){return this.#s?.reduce?.((e,t)=>e+(this.renderColumn?.(t||{})||""),"")}reassignRowDetailsRenderer(){this.baseElement.rowDetailsRenderer=null,setTimeout(()=>{this.baseElement.rowDetailsRenderer=this.#l.bind(this)},0)}renderColumns(){const e=this.getColumnsTemplate();e&&(this.reassignRowDetailsRenderer(),this.innerHTML=e)}get grid(){return this.shadowRoot.querySelector("vaadin-grid")}get data(){return this.grid.items}set data(e){if(n(e)&&this.grid.items!==e&&(this.grid.items=e,this.grid.selectedItems)){const e=new Set(this.grid.items.map(e=>e[this.uniqueColumnId]??e)),t=this.grid.selectedItems.filter(t=>e.has(t[this.uniqueColumnId]??t));this.grid.selectedItems.length!==t.length&&(this.grid.selectedItems=t)}}get columns(){return this.#s}set columns(e){this.#s=e,this.renderColumns()}get paths(){return this.columns.map(e=>e.path)}get uniqueColumnId(){return this.getAttribute("unique-column-id")}})((0,l.tz)({delegatesFocus:!1,slots:[""],wrappedEleName:"vaadin-grid",style:()=>`\n /*css*/\n vaadin-grid {\n overflow: hidden;\n height: 100%;\n min-height: 300px;\n }\n vaadin-grid-cell-content {\n display: flex;\n }\n vaadin-grid::part(selected-row-cell) {\n background-image: none;\n box-shadow: none;\n background-color: inherit;\n }\n vaadin-grid::part(details-cell) {\n border-top-style: dashed;\n border-top-width: 1px;\n }\n vaadin-grid .row-details {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(max(200px, calc(100%/4 - var(${E.cssVarList.detailsPanelItemsGap}))), 1fr));\n width: 100%;\n }\n vaadin-grid .row-details__item:has(.row-details__value.code) {\n grid-column: 1 / -1;\n order: 2;\n }\n vaadin-grid details.row-details__item {\n padding: 0;\n }\n vaadin-grid details.row-details__item > summary.row-details__label {\n cursor: pointer;\n list-style: revert;\n display: revert;\n }\n vaadin-grid .row-details__value.text {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: pre;\n }\n vaadin-grid .row-details__value.code {\n margin-top: 5px;\n overflow-x: auto;\n font-size: 0.85em;\n }\n vaadin-grid vaadin-icon.toggle-details-button {\n margin: auto;\n }\n /*!css*/\n\t\t`,excludeAttrsSync:["columns","tabindex","style"],componentName:u}));customElements.define(u,E)}}]);
2
2
  //# sourceMappingURL=descope-grid-index-js.js.map