chrome-devtools-frontend
Version:
Chrome DevTools UI
55 lines (54 loc) • 15.5 kB
JavaScript
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const t=globalThis,e=t.trustedTypes,s=e?e.createPolicy("lit-html",{createHTML:t=>t}):void 0,i="$lit$",n=`lit$${Math.random().toFixed(9).slice(2)}$`,r="?"+n,o=`<${r}>`,h=document,l=()=>h.createComment(""),c=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a=Array.isArray,d=t=>a(t)||"function"==typeof t?.[Symbol.iterator],$="[ \t\n\f\r]",u=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_=/-->/g,A=/>/g,f=RegExp(`>|${$}(?:([^\\s"'>=/]+)(${$}*=${$}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),p=/'/g,v=/"/g,g=/^(?:script|style|textarea|title)$/i,y=Symbol.for("lit-noChange"),m=Symbol.for("lit-nothing"),b=new WeakMap,x=h.createTreeWalker(h,129);function C(t,e){if(!a(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s?s.createHTML(e):e}const w=(t,e)=>{const s=t.length-1,r=[];let h,l=2===e?"<svg>":3===e?"<math>":"",c=u;for(let e=0;e<s;e++){const s=t[e];let a,d,$=-1,y=0;for(;y<s.length&&(c.lastIndex=y,d=c.exec(s),null!==d);)y=c.lastIndex,c===u?"!--"===d[1]?c=_:void 0!==d[1]?c=A:void 0!==d[2]?(g.test(d[2])&&(h=RegExp("</"+d[2],"g")),c=f):void 0!==d[3]&&(c=f):c===f?">"===d[0]?(c=h??u,$=-1):void 0===d[1]?$=-2:($=c.lastIndex-d[2].length,a=d[1],c=void 0===d[3]?f:'"'===d[3]?v:p):c===v||c===p?c=f:c===_||c===A?c=u:(c=f,h=void 0);const m=c===f&&t[e+1].startsWith("/>")?" ":"";l+=c===u?s+o:$>=0?(r.push(a),s.slice(0,$)+i+s.slice($)+n+m):s+n+(-2===$?e:m)}return[C(t,l+(t[s]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),r]};class H{constructor({strings:t,_$litType$:s},o){let h;this.parts=[];let c=0,a=0;const d=t.length-1,$=this.parts,[u,_]=w(t,s);if(this.el=H.createElement(u,o),x.currentNode=this.el.content,2===s||3===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(h=x.nextNode())&&$.length<d;){if(1===h.nodeType){if(h.hasAttributes())for(const t of h.getAttributeNames())if(t.endsWith(i)){const e=_[a++],s=h.getAttribute(t).split(n),i=/([.?@])?(.*)/.exec(e);$.push({type:1,index:c,name:i[2],strings:s,ctor:"."===i[1]?E:"?"===i[1]?U:"@"===i[1]?Y:S}),h.removeAttribute(t)}else t.startsWith(n)&&($.push({type:6,index:c}),h.removeAttribute(t));if(g.test(h.tagName)){const t=h.textContent.split(n),s=t.length-1;if(s>0){h.textContent=e?e.emptyScript:"";for(let e=0;e<s;e++)h.append(t[e],l()),x.nextNode(),$.push({type:2,index:++c});h.append(t[s],l())}}}else if(8===h.nodeType)if(h.data===r)$.push({type:2,index:c});else{let t=-1;for(;-1!==(t=h.data.indexOf(n,t+1));)$.push({type:7,index:c}),t+=n.length-1}c++}}static createElement(t,e){const s=h.createElement("template");return s.innerHTML=t,s}}function N(t,e,s=t,i){if(e===y)return e;let n=void 0!==i?s._$Co?.[i]:s._$Cl;const r=c(e)?void 0:e._$litDirective$;return n?.constructor!==r&&(n?._$AO?.(!1),void 0===r?n=void 0:(n=new r(t),n._$AT(t,s,i)),void 0!==i?(s._$Co??=[])[i]=n:s._$Cl=n),void 0!==n&&(e=N(t,n._$AS(t,e.values),n,i)),e}let M=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,i=(t?.creationScope??h).importNode(e,!0);x.currentNode=i;let n=x.nextNode(),r=0,o=0,l=s[0];for(;void 0!==l;){if(r===l.index){let e;2===l.type?e=new T(n,n.nextSibling,this,t):1===l.type?e=new l.ctor(n,l.name,l.strings,this,t):6===l.type&&(e=new I(n,this,t)),this._$AV.push(e),l=s[++o]}r!==l?.index&&(n=x.nextNode(),r++)}return x.currentNode=h,i}p(t){let e=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}};class T{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,i){this.type=2,this._$AH=m,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=N(this,t,e),c(t)?t===m||null==t||""===t?(this._$AH!==m&&this._$AR(),this._$AH=m):t!==this._$AH&&t!==y&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):d(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==m&&c(this._$AH)?this._$AA.nextSibling.data=t:this.T(h.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:s}=t,i="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=H.createElement(C(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(e);else{const t=new M(i,this),s=t.u(this.options);t.p(e),this.T(s),this._$AH=t}}_$AC(t){let e=b.get(t.strings);return void 0===e&&b.set(t.strings,e=new H(t)),e}k(t){a(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,i=0;for(const n of t)i===e.length?e.push(s=new T(this.O(l()),this.O(l()),this,this.options)):s=e[i],s._$AI(n),i++;i<e.length&&(this._$AR(s&&s._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class S{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,i,n){this.type=1,this._$AH=m,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=n,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=m}_$AI(t,e=this,s,i){const n=this.strings;let r=!1;if(void 0===n)t=N(this,t,e,0),r=!c(t)||t!==this._$AH&&t!==y,r&&(this._$AH=t);else{const i=t;let o,h;for(t=n[0],o=0;o<n.length-1;o++)h=N(this,i[s+o],e,o),h===y&&(h=this._$AH[o]),r||=!c(h)||h!==this._$AH[o],h===m?t=m:t!==m&&(t+=(h??"")+n[o+1]),this._$AH[o]=h}r&&!i&&this.j(t)}j(t){t===m?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class E extends S{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===m?void 0:t}}class U extends S{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==m)}}class Y extends S{constructor(t,e,s,i,n){super(t,e,s,i,n),this.type=5}_$AI(t,e=this){if((t=N(this,t,e,0)??m)===y)return;const s=this._$AH,i=t===m&&s!==m||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==m&&(s===m||i);i&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class I{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){N(this,t)}}const k={M:i,P:n,A:r,C:1,L:w,R:M,D:d,V:N,I:T,H:S,N:U,U:Y,B:E,F:I},P=t.litHtmlPolyfillSupport;P?.(H,T),(t.litHtmlVersions??=[]).push("3.2.1");
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const B=1,O=2,j=3,L=4,D=t=>(...e)=>({_$litDirective$:t,values:e});let R=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};
/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const W=D(class extends R{constructor(t){if(super(t),t.type!==B||"class"!==t.name||t.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter((e=>t[e])).join(" ")+" "}update(t,[e]){if(void 0===this.st){this.st=new Set,void 0!==t.strings&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in e)e[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(e)}const s=t.element.classList;for(const t of this.st)t in e||(s.remove(t),this.st.delete(t));for(const t in e){const i=!!e[t];i===this.st.has(t)||this.nt?.has(t)||(i?(s.add(t),this.st.add(t)):(s.remove(t),this.st.delete(t)))}return y}}),V=t=>t??m
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/,{I:Z}=k,z=t=>void 0===t.strings,q=()=>document.createComment(""),K=(t,e,s)=>{const i=t._$AA.parentNode,n=void 0===e?t._$AB:e._$AA;if(void 0===s){const e=i.insertBefore(q(),n),r=i.insertBefore(q(),n);s=new Z(e,r,t,t.options)}else{const e=s._$AB.nextSibling,r=s._$AM,o=r!==t;if(o){let e;s._$AQ?.(t),s._$AM=t,void 0!==s._$AP&&(e=t._$AU)!==r._$AU&&s._$AP(e)}if(e!==n||o){let t=s._$AA;for(;t!==e;){const e=t.nextSibling;i.insertBefore(t,n),t=e}}}return s},X=(t,e,s=t)=>(t._$AI(e,s),t),F={},Q=(t,e=F)=>t._$AH=e,G=t=>{t._$AP?.(!1,!0);let e=t._$AA;const s=t._$AB.nextSibling;for(;e!==s;){const t=e.nextSibling;e.remove(),e=t}},J=D(class extends R{constructor(t){if(super(t),t.type!==j&&t.type!==B&&t.type!==L)throw Error("The `live` directive is not allowed on child or event bindings");if(!z(t))throw Error("`live` bindings can only contain a single expression")}render(t){return t}update(t,[e]){if(e===y||e===m)return e;const s=t.element,i=t.name;if(t.type===j){if(e===s[i])return y}else if(t.type===L){if(!!e===s.hasAttribute(i))return y}else if(t.type===B&&s.getAttribute(i)===e+"")return y;return Q(t),e}}),tt=(t,e,s)=>{const i=new Map;for(let n=e;n<=s;n++)i.set(t[n],n);return i},et=D(class extends R{constructor(t){if(super(t),t.type!==O)throw Error("repeat() can only be used in text expressions")}dt(t,e,s){let i;void 0===s?s=e:void 0!==e&&(i=e);const n=[],r=[];let o=0;for(const e of t)n[o]=i?i(e,o):o,r[o]=s(e,o),o++;return{values:r,keys:n}}render(t,e,s){return this.dt(t,e,s).values}update(t,[e,s,i]){const n=(t=>t._$AH)(t),{values:r,keys:o}=this.dt(e,s,i);if(!Array.isArray(n))return this.ut=o,r;const h=this.ut??=[],l=[];let c,a,d=0,$=n.length-1,u=0,_=r.length-1;for(;d<=$&&u<=_;)if(null===n[d])d++;else if(null===n[$])$--;else if(h[d]===o[u])l[u]=X(n[d],r[u]),d++,u++;else if(h[$]===o[_])l[_]=X(n[$],r[_]),$--,_--;else if(h[d]===o[_])l[_]=X(n[d],r[_]),K(t,l[_+1],n[d]),d++,_--;else if(h[$]===o[u])l[u]=X(n[$],r[u]),K(t,n[d],n[$]),$--,u++;else if(void 0===c&&(c=tt(o,u,_),a=tt(h,d,$)),c.has(h[d]))if(c.has(h[$])){const e=a.get(o[u]),s=void 0!==e?n[e]:null;if(null===s){const e=K(t,n[d]);X(e,r[u]),l[u]=e}else l[u]=X(s,r[u]),K(t,n[d],s),n[e]=null;u++}else G(n[$]),$--;else G(n[d]),d++;for(;u<=_;){const e=K(t,l[_+1]);X(e,r[u]),l[u++]=e}for(;d<=$;){const t=n[d++];null!==t&&G(t)}return this.ut=o,Q(t,l),y}}),st="important",it=" !"+st,nt=D(class extends R{constructor(t){if(super(t),t.type!==B||"style"!==t.name||t.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce(((e,s)=>{const i=t[s];return null==i?e:e+`${s=s.includes("-")?s:s.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${i};`}),"")}update(t,[e]){const{style:s}=t.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(e)),this.render(e);for(const t of this.ft)null==e[t]&&(this.ft.delete(t),t.includes("-")?s.removeProperty(t):s[t]=null);for(const t in e){const i=e[t];if(null!=i){this.ft.add(t);const e="string"==typeof i&&i.endsWith(it);t.includes("-")||e?s.setProperty(t,e?i.slice(0,-11):i,e?st:""):s[t]=i}}return y}});
/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
let rt=class extends R{constructor(t){if(super(t),this.it=m,t.type!==O)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===m||null==t)return this._t=void 0,this.it=t;if(t===y)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};rt.directiveName="unsafeHTML",rt.resultType=1;const ot=D(rt),ht=(t,e)=>{const s=t._$AN;if(void 0===s)return!1;for(const t of s)t._$AO?.(e,!1),ht(t,e);return!0},lt=t=>{let e,s;do{if(void 0===(e=t._$AM))break;s=e._$AN,s.delete(t),t=e}while(0===s?.size)},ct=t=>{for(let e;e=t._$AM;t=e){let s=e._$AN;if(void 0===s)e._$AN=s=new Set;else if(s.has(t))break;s.add(t),$t(e)}};
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/function at(t){void 0!==this._$AN?(lt(this),this._$AM=t,ct(this)):this._$AM=t}function dt(t,e=!1,s=0){const i=this._$AH,n=this._$AN;if(void 0!==n&&0!==n.size)if(e)if(Array.isArray(i))for(let t=s;t<i.length;t++)ht(i[t],!1),lt(i[t]);else null!=i&&(ht(i,!1),lt(i));else ht(this,t)}const $t=t=>{t.type==O&&(t._$AP??=dt,t._$AQ??=at)};class ut extends R{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,s){super._$AT(t,e,s),ct(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(ht(this,t),lt(this))}setValue(t){if(z(this._$Ct))this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/class _t{constructor(t){this.Y=t}disconnect(){this.Y=void 0}reconnect(t){this.Y=t}deref(){return this.Y}}class At{constructor(){this.Z=void 0,this.q=void 0}get(){return this.Z}pause(){this.Z??=new Promise((t=>this.q=t))}resume(){this.q?.(),this.Z=this.q=void 0}}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const ft=t=>!(t=>null===t||"object"!=typeof t&&"function"!=typeof t)(t)&&"function"==typeof t.then,pt=1073741823;class vt extends ut{constructor(){super(...arguments),this._$Cwt=pt,this._$Cbt=[],this._$CK=new _t(this),this._$CX=new At}render(...t){return t.find((t=>!ft(t)))??y}update(t,e){const s=this._$Cbt;let i=s.length;this._$Cbt=e;const n=this._$CK,r=this._$CX;this.isConnected||this.disconnected();for(let t=0;t<e.length&&!(t>this._$Cwt);t++){const o=e[t];if(!ft(o))return this._$Cwt=t,o;t<i&&o===s[t]||(this._$Cwt=pt,i=0,Promise.resolve(o).then((async t=>{for(;r.get();)await r.get();const e=n.deref();if(void 0!==e){const s=e._$Cbt.indexOf(o);s>-1&&s<e._$Cwt&&(e._$Cwt=s,e.setValue(t))}})))}return y}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}}const gt=D(vt),yt=()=>new mt;
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/class mt{}const bt=new WeakMap,xt=D(class extends ut{render(t){return m}update(t,[e]){const s=e!==this.Y;return s&&void 0!==this.Y&&this.rt(void 0),(s||this.lt!==this.ct)&&(this.Y=e,this.ht=t.options?.host,this.rt(this.ct=t.element)),m}rt(t){if(this.isConnected||(t=void 0),"function"==typeof this.Y){const e=this.ht??globalThis;let s=bt.get(e);void 0===s&&(s=new WeakMap,bt.set(e,s)),void 0!==s.get(this.Y)&&this.Y.call(this.ht,void 0),s.set(this.Y,t),void 0!==t&&this.Y.call(this.ht,t)}else this.Y.value=t}get lt(){return"function"==typeof this.Y?bt.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});export{rt as UnsafeHTMLDirective,vt as UntilDirective,W as classMap,yt as createRef,V as ifDefined,J as live,xt as ref,et as repeat,nt as styleMap,ot as unsafeHTML,gt as until};
//# sourceMappingURL=directives.js.map