UNPKG

chrome-devtools-frontend

Version:
24 lines (23 loc) • 8.62 kB
/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const t=globalThis,e=t=>t,s=t.trustedTypes,i=s?s.createPolicy("lit-html",{createHTML:t=>t}):void 0,n="$lit$",o=`lit$${Math.random().toFixed(9).slice(2)}$`,h="?"+o,r=`<${h}>`,$=document,l=()=>$.createComment(""),A=t=>null===t||"object"!=typeof t&&"function"!=typeof t,_=Array.isArray,c="[ \t\n\f\r]",a=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,d=/-->/g,p=/>/g,u=RegExp(`>|${c}(?:([^\\s"'>=/]+)(${c}*=${c}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),g=/'/g,f=/"/g,v=/^(?:script|style|textarea|title)$/i,m=Symbol.for("lit-noChange"),y=Symbol.for("lit-nothing"),H=new WeakMap,N=$.createTreeWalker($,129);function x(t,e){if(!_(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==i?i.createHTML(e):e}const T=(t,e)=>{const s=t.length-1,i=[];let h,$=2===e?"<svg>":3===e?"<math>":"",l=a;for(let e=0;e<s;e++){const s=t[e];let A,_,c=-1,m=0;for(;m<s.length&&(l.lastIndex=m,_=l.exec(s),null!==_);)m=l.lastIndex,l===a?"!--"===_[1]?l=d:void 0!==_[1]?l=p:void 0!==_[2]?(v.test(_[2])&&(h=RegExp("</"+_[2],"g")),l=u):void 0!==_[3]&&(l=u):l===u?">"===_[0]?(l=h??a,c=-1):void 0===_[1]?c=-2:(c=l.lastIndex-_[2].length,A=_[1],l=void 0===_[3]?u:'"'===_[3]?f:g):l===f||l===g?l=u:l===d||l===p?l=a:(l=u,h=void 0);const y=l===u&&t[e+1].startsWith("/>")?" ":"";$+=l===a?s+r:c>=0?(i.push(A),s.slice(0,c)+n+s.slice(c)+o+y):s+o+(-2===c?e:y)}return[x(t,$+(t[s]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),i]};class C{constructor({strings:t,_$litType$:e},i){let r;this.parts=[];let $=0,A=0;const _=t.length-1,c=this.parts,[a,d]=T(t,e);if(this.el=C.createElement(a,i),N.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(r=N.nextNode())&&c.length<_;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(n)){const e=d[A++],s=r.getAttribute(t).split(o),i=/([.?@])?(.*)/.exec(e);c.push({type:1,index:$,name:i[2],strings:s,ctor:"."===i[1]?S:"?"===i[1]?w:"@"===i[1]?U:I}),r.removeAttribute(t)}else t.startsWith(o)&&(c.push({type:6,index:$}),r.removeAttribute(t));if(v.test(r.tagName)){const t=r.textContent.split(o),e=t.length-1;if(e>0){r.textContent=s?s.emptyScript:"";for(let s=0;s<e;s++)r.append(t[s],l()),N.nextNode(),c.push({type:2,index:++$});r.append(t[e],l())}}}else if(8===r.nodeType)if(r.data===h)c.push({type:2,index:$});else{let t=-1;for(;-1!==(t=r.data.indexOf(o,t+1));)c.push({type:7,index:$}),t+=o.length-1}$++}}static createElement(t,e){const s=$.createElement("template");return s.innerHTML=t,s}}function M(t,e,s=t,i){if(e===m)return e;let n=void 0!==i?s._$Co?.[i]:s._$Cl;const o=A(e)?void 0:e._$litDirective$;return n?.constructor!==o&&(n?._$AO?.(!1),void 0===o?n=void 0:(n=new o(t),n._$AT(t,s,i)),void 0!==i?(s._$Co??=[])[i]=n:s._$Cl=n),void 0!==n&&(e=M(t,n._$AS(t,e.values),n,i)),e}class b{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??$).importNode(e,!0);N.currentNode=i;let n=N.nextNode(),o=0,h=0,r=s[0];for(;void 0!==r;){if(o===r.index){let e;2===r.type?e=new E(n,n.nextSibling,this,t):1===r.type?e=new r.ctor(n,r.name,r.strings,this,t):6===r.type&&(e=new O(n,this,t)),this._$AV.push(e),r=s[++h]}o!==r?.index&&(n=N.nextNode(),o++)}return N.currentNode=$,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 E{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,i){this.type=2,this._$AH=y,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=M(this,t,e),A(t)?t===y||null==t||""===t?(this._$AH!==y&&this._$AR(),this._$AH=y):t!==this._$AH&&t!==m&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>_(t)||"function"==typeof t?.[Symbol.iterator])(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!==y&&A(this._$AH)?this._$AA.nextSibling.data=t:this.T($.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=C.createElement(x(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(e);else{const t=new b(i,this),s=t.u(this.options);t.p(e),this.T(s),this._$AH=t}}_$AC(t){let e=H.get(t.strings);return void 0===e&&H.set(t.strings,e=new C(t)),e}k(t){_(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 E(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,s){for(this._$AP?.(!1,!0,s);t!==this._$AB;){const s=e(t).nextSibling;e(t).remove(),t=s}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class I{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,i,n){this.type=1,this._$AH=y,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=y}_$AI(t,e=this,s,i){const n=this.strings;let o=!1;if(void 0===n)t=M(this,t,e,0),o=!A(t)||t!==this._$AH&&t!==m,o&&(this._$AH=t);else{const i=t;let h,r;for(t=n[0],h=0;h<n.length-1;h++)r=M(this,i[s+h],e,h),r===m&&(r=this._$AH[h]),o||=!A(r)||r!==this._$AH[h],r===y?t=y:t!==y&&(t+=(r??"")+n[h+1]),this._$AH[h]=r}o&&!i&&this.j(t)}j(t){t===y?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class S extends I{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===y?void 0:t}}class w extends I{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==y)}}class U extends I{constructor(t,e,s,i,n){super(t,e,s,i,n),this.type=5}_$AI(t,e=this){if((t=M(this,t,e,0)??y)===m)return;const s=this._$AH,i=t===y&&s!==y||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==y&&(s===y||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 O{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){M(this,t)}}const R=t.litHtmlPolyfillSupport;R?.(C,E),(t.litHtmlVersions??=[]).push("3.3.2"); /** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const B={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},D=t=>(...e)=>({_$litDirective$:t,values:e}); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */class L{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 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const P=(t,e)=>{const s=t._$AN;if(void 0===s)return!1;for(const t of s)t._$AO?.(e,!1),P(t,e);return!0},k=t=>{let e,s;do{if(void 0===(e=t._$AM))break;s=e._$AN,s.delete(t),t=e}while(0===s?.size)},V=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),z(e)}};function W(t){void 0!==this._$AN?(k(this),this._$AM=t,V(this)):this._$AM=t}function j(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++)P(i[t],!1),k(i[t]);else null!=i&&(P(i,!1),k(i));else P(this,t)}const z=t=>{t.type==B.CHILD&&(t._$AP??=j,t._$AQ??=W)};class Z extends L{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,s){super._$AT(t,e,s),V(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(P(this,t),k(this))}setValue(t){if((t=>void 0===t.strings)(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(){}}export{Z as AsyncDirective,L as Directive,B as PartType,D as directive}; //# sourceMappingURL=async-directive.js.map