@grasco/profile-picture 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/angular.cjs +16 -15
- package/dist/angular.cjs.map +1 -1
- package/dist/angular.d.cts +2 -0
- package/dist/angular.d.ts +2 -0
- package/dist/angular.js +16 -15
- package/dist/angular.js.map +1 -1
- package/dist/index.cjs +10 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +10 -9
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +13 -12
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +2 -0
- package/dist/react.d.ts +2 -0
- package/dist/react.js +13 -12
- package/dist/react.js.map +1 -1
- package/dist/standalone.d.ts +3 -0
- package/dist/standalone.standalone.js +8 -7
- package/dist/standalone.standalone.js.map +1 -1
- package/dist/svelte.cjs +16 -15
- package/dist/svelte.cjs.map +1 -1
- package/dist/svelte.d.cts +2 -0
- package/dist/svelte.d.ts +2 -0
- package/dist/svelte.js +16 -15
- package/dist/svelte.js.map +1 -1
- package/dist/vue.cjs +16 -15
- package/dist/vue.cjs.map +1 -1
- package/dist/vue.d.cts +2 -0
- package/dist/vue.d.ts +2 -0
- package/dist/vue.js +16 -15
- package/dist/vue.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/loadStyles.ts","../../node_modules/.bun/@lit-labs+ssr-dom-shim@1.5.1/node_modules/@lit-labs/ssr-dom-shim/src/lib/element-internals.ts","../../node_modules/.bun/@lit-labs+ssr-dom-shim@1.5.1/node_modules/@lit-labs/ssr-dom-shim/src/lib/events.ts","../../node_modules/.bun/@lit-labs+ssr-dom-shim@1.5.1/node_modules/@lit-labs/ssr-dom-shim/src/lib/css.ts","../../node_modules/.bun/@lit-labs+ssr-dom-shim@1.5.1/node_modules/@lit-labs/ssr-dom-shim/src/index.ts","../../node_modules/.bun/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/src/css-tag.ts","../../node_modules/.bun/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/src/reactive-element.ts","../../node_modules/.bun/lit-html@3.3.2/node_modules/lit-html/src/lit-html.ts","../../node_modules/.bun/lit-element@4.2.2/node_modules/lit-element/src/lit-element.ts","../../node_modules/.bun/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/src/decorators/property.ts","../../node_modules/.bun/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/src/decorators/state.ts","../../node_modules/.bun/lit-html@3.3.2/node_modules/lit-html/src/directive.ts","../../node_modules/.bun/lit-html@3.3.2/node_modules/lit-html/src/directives/style-map.ts","../src/core/types.ts","../src/core/utils.ts","../src/core/styles.ts","../src/core/ProfilePicture.ts","../src/core/ProfilePictureGroup.ts","../src/standalone.ts"],"names":["LINK_ID","loaded","loadScheduled","loadStyles","scheduleStyleInjection","cb","injectStyleLink","cssUrl","getCssUrl","link","metaUrl","currentScript","scriptUrl","ElementInternalsShim","_host","isCaptureEventListener","options","EventTarget","type","callback","eventListenersMap","eventListeners","normalizedOptions","event","composedPath","parent","stopPropagation","stopImmediatePropagation","eventPhase","target","tmpTarget","currentTarget","originalStopPropagation","originalStopImmediatePropagation","enumerableProperty","invokeEventListener","listener","eventListenerMap","finishDispatch","captureEventPath","retarget","eventTargets","eventTarget","captureEventListeners","bubbleEventPath","EventTargetShimWithRealType","EventShim","_a","_Event_cancelable","_Event_bubbles","_Event_composed","_Event_defaultPrevented","_Event_timestamp","_Event_propagationStopped","_Event_type","_Event_target","_Event_isBeingDispatched","bubbles","cancelable","composed","__classPrivateFieldSet","_type","_bubbles","_cancelable","__classPrivateFieldGet","value","CustomEventShim","_b","_CustomEvent_detail","_detail","EventShimWithRealType","CustomEventShimWithRealType","attributes","attributesForElement","element","attrs","ElementShim","name","force","init","shadowRoot","internals","HTMLElementShim","HTMLElementShimWithRealType","promiseWithResolvers","resolve","reject","res","rej","CustomElementRegistry","ctor","_element","definition","withResolvers","CustomElementRegistryShimWithRealType","customElements","global","globalThis","supportsAdoptingStyleSheets","ShadowRoot","ShadyCSS","nativeShadow","Document","prototype","CSSStyleSheet","constructionToken","Symbol","cssTagCache","WeakMap","CSSResult","cssText","strings","safeToken","this","Error","_strings","styleSheet","_styleSheet","cacheable","length","get","replaceSync","set","toString","unsafeCSS","String","adoptStyles","renderRoot","styles","adoptedStyleSheets","map","s","style","document","createElement","nonce","setAttribute","textContent","appendChild","getCompatibleStyle","sheet","rule","cssRules","is","defineProperty","getOwnPropertyDescriptor","getOwnPropertyNames","getOwnPropertySymbols","getPrototypeOf","Object","trustedTypes","emptyStringForBooleanAttribute","emptyScript","polyfillSupport","reactiveElementPolyfillSupport","JSCompiler_renameProperty","prop","_obj","defaultConverter","Boolean","Array","JSON","stringify","fromValue","Number","parse","e","notEqual","old","defaultPropertyDeclaration","attribute","converter","reflect","useDefault","hasChanged","metadata","litPropertyMetadata","ReactiveElement","initializer","__prepare","_initializers","push","observedAttributes","finalize","__attributeToPropertyMap","keys","state","hasOwnProperty","create","wrapped","elementProperties","noAccessor","key","descriptor","getPropertyDescriptor","v","oldValue","call","requestUpdate","configurable","enumerable","superCtor","Map","finalized","props","properties","propKeys","p","createProperty","attr","__attributeNameForProperty","elementStyles","finalizeStyles","isArray","Set","flat","Infinity","reverse","unshift","toLowerCase","constructor","super","__instanceProperties","isUpdatePending","hasUpdated","__reflectingProperty","__initialize","__updatePromise","Promise","enableUpdating","_$changedProperties","__saveInstanceProperties","forEach","i","controller","__controllers","add","isConnected","hostConnected","delete","instanceProperties","size","createRenderRoot","attachShadow","shadowRootOptions","connectedCallback","c","_requestedUpdate","disconnectedCallback","hostDisconnected","_old","_$attributeToProperty","attrValue","toAttribute","removeAttribute","propName","getPropertyOptions","fromAttribute","convertedValue","__defaultValues","useNewValue","newValue","hasAttribute","_$changeProperty","__enqueueUpdate","initializeValue","has","__reflectingProperties","result","scheduleUpdate","performUpdate","shouldUpdate","changedProperties","willUpdate","hostUpdate","update","__markUpdated","_$didUpdate","_changedProperties","hostUpdated","firstUpdated","updated","updateComplete","getUpdateComplete","__propertyToAttribute","mode","reactiveElementVersions","wrap","node","policy","createPolicy","createHTML","boundAttributeSuffix","marker","Math","random","toFixed","slice","markerMatch","nodeMarker","d","createTreeWalker","createMarker","createComment","isPrimitive","isIterable","iterator","SPACE_CHAR","textEndRegex","commentEndRegex","comment2EndRegex","tagEndRegex","RegExp","singleQuoteAttrEndRegex","doubleQuoteAttrEndRegex","rawTextElement","tag","values","_$litType$","html","noChange","for","nothing","templateCache","walker","trustFromTemplateString","tsa","stringFromTSA","getTemplateHtml","l","attrNames","rawTextEndRegex","regex","attrName","match","attrNameEndIndex","lastIndex","exec","test","end","startsWith","Template","parts","nodeIndex","attrNameIndex","partCount","el","currentNode","content","wrapper","firstChild","replaceWith","childNodes","nextNode","nodeType","hasAttributes","getAttributeNames","endsWith","realName","statics","getAttribute","split","m","index","PropertyPart","BooleanAttributePart","EventPart","AttributePart","tagName","append","data","indexOf","_options","innerHTML","resolveDirective","part","attributeIndex","currentDirective","__directives","__directive","nextDirectiveConstructor","_$initialize","_$resolve","TemplateInstance","template","_$parts","_$disconnectableChildren","_$template","_$parent","parentNode","_$isConnected","fragment","creationScope","importNode","partIndex","templatePart","ChildPart","nextSibling","ElementPart","_$setValue","__isConnected","startNode","endNode","_$committedValue","_$startNode","_$endNode","directiveParent","_$clear","_commitText","_commitTemplateResult","_commitNode","_commitIterable","insertBefore","_insert","createTextNode","_$getTemplate","h","_update","instance","_clone","itemParts","itemPart","item","start","from","_$notifyConnectionChanged","n","remove","fill","valueIndex","noCommit","change","_commitValue","toggleAttribute","newListener","oldListener","shouldRemoveListener","capture","once","passive","shouldAddListener","removeEventListener","addEventListener","host","handleEvent","litHtmlPolyfillSupport","litHtmlVersions","render","container","partOwnerNode","renderBefore","LitElement","renderOptions","__childPart","setConnected","litElementHydrateSupport","litElementPolyfillSupport","litElementVersions","standardProperty","context","kind","property","protoOrTarget","nameOrContext","proto","undefined","PartType","ATTRIBUTE","directive","_$litDirective$","Directive","_partInfo","__part","__attributeIndex","_part","important","importantFlag","styleMap","partInfo","styleInfo","reduce","includes","replace","_previousStyleProperties","removeProperty","isImportant","setProperty","SIZE_MAP","PRESENCE_COLORS","SHADOW_MAP","DEFAULTS","RADIUS_MAP","GROUP_DEFAULTS","cn","classes","isHexColor","color","getInitials","text","words","getInitialsFontSize","containerSize","getBadgeSize","avatarSize","hasContent","scaled","fontSize","getPresenceSize","thickness","baseSize","formatBadgeContent","max","createConicGradient","colors","hashString","str","hash","char","createProgressRingGradient","progress","filledColor","emptyColor","progressDeg","generateAvatarGradient","gradients","CLOUDY_PALETTES","generateCloudyGradient","seed","palette","h2","h3","x1","y1","x2","y2","x3","y3","getGroupAvatarSize","calculateAvatarCounts","total","showAddButton","effectiveMax","visible","hidden","calculateStackPosition","overlap","_direction","spacing","step","calculateStackZIndex","direction","calculateGroupWidth","count","formatCounterText","getCdnSizeLabel","pixelSize","constructCdnUrl","baseUrl","extCustomerId","sizeLabel","imageMode","hostname","cleanBaseUrl","filename","getVariantClasses","variant","getBorderClasses","width","getBackgroundStyles","bgColor","bgGradient","getShadowStyles","shadow","keyframes","allKeyframes","baseStyles","componentStyles","shimmerStyles","getGlowShadow","intensity","r","g","b","groupKeyframes","groupBaseStyles","groupStyles","_ProfilePicture","url","sizeValue","extCustomerIdChanged","cdnParamsChanged","bg","borderStyles","shadowStyles","glowStyles","glowColor","isInteractive","A","placeholderClass","T","o","hasExplicitBg","gradient","iconSize","hasCdnConfig","imageSrc","zoomStyle","ringWidth","ringGap","totalOffset","ringColor","hasProgress","radius","ratio","offset","position","hasIcon","hasAnyContent","badgeSize","textColor","borderRadius","icon","posOffset","positionStyles","tabIndex","__decorateClass","ProfilePicture","groupStylesInjected","injectGroupStyles","ProfilePictureGroup","children","child","getPropOrAttr","actualAttrName","propValue","borderWidthValue","borderWidth","user","B","hiddenUsers","rect","gap","dropdownWidth","dropdownHeight","viewportWidth","viewportHeight","spaceBelow","spaceAbove","spaceRight","spaceLeft","openDirection","left","top","bottom","handler","zIndex","rotation","containerRect","relativeLeft","relativeTop","relativeBottom","isTop","hasImage","status","counter","showCounter","visibleUsers","elementCount","containerWidth","counterPosition","addButtonPosition"],"mappings":"2IAkBA,IAAMA,EAAAA,CAAU,gCAEZC,CAAAA,CAAS,KAAA,CACTC,GAAgB,KAAA,CAOb,SAASC,EAAAA,EAAmB,CAOjC,GALIF,CAAAA,EAKA,OAAO,QAAA,CAAa,GAAA,CACtB,OAIF,GAAI,QAAA,CAAS,cAAA,CAAeD,EAAO,CAAA,CAAG,CACpCC,CAAAA,CAAS,IAAA,CACT,MACF,CAMA,GAHqB,QAAA,CAAS,aAAA,CAC5B,mDACF,CAAA,CACkB,CAChBA,CAAAA,CAAS,KACT,MACF,CAGKC,EAAAA,GACHA,EAAAA,CAAgB,IAAA,CAChBE,EAAAA,IAEJ,CAMA,SAASA,EAAAA,EAA+B,CAAA,CAEpC,OAAO,mBAAA,CAAwB,IAC3B,mBAAA,CACCC,CAAAA,EAAmB,UAAA,CAAWA,CAAAA,CAAI,CAAC,CAAA,EAEpC,IAAMC,EAAAA,EAAiB,EAC/B,CAKA,SAASA,IAAwB,CAE/B,GAAIL,CAAAA,EAAU,OAAO,QAAA,CAAa,GAAA,CAChC,OAGF,GAAI,QAAA,CAAS,cAAA,CAAeD,EAAO,CAAA,CAAG,CACpCC,EAAS,IAAA,CACT,MACF,CAGA,IAAMM,CAAAA,CAASC,EAAAA,GACf,GAAI,CAACD,CAAAA,CACH,OAIF,IAAME,CAAAA,CAAO,SAAS,aAAA,CAAc,MAAM,CAAA,CAC1CA,CAAAA,CAAK,EAAA,CAAKT,EAAAA,CACVS,EAAK,GAAA,CAAM,YAAA,CACXA,CAAAA,CAAK,IAAA,CAAOF,CAAAA,CACZ,QAAA,CAAS,KAAK,WAAA,CAAYE,CAAI,CAAA,CAE9BR,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DvM,CAAAA,CAAS,CAAE,IAAA,CAAM,OAAA,CAAS,UAAW,iBAAkB,CAAC,CAAA,CAAA,CAhB9C2M,CAAAA,CAgBgD,SAAA,CAAA,eAAA,CAAA,CAEAJ,CAAAA,CAAA,CAA1DvM,CAAAA,CAAS,CAAE,IAAA,CAAM,MAAA,CAAQ,SAAA,CAAW,kBAAmB,CAAC,CAAA,CAAA,CAlB9C2M,CAAAA,CAkBgD,SAAA,CAAA,gBAAA,CAAA,CAE9BJ,EAAA,CAA5BvM,CAAAA,CAAS,CAAE,IAAA,CAAM,OAAQ,CAAC,CAAA,CAAA,CApBhB2M,CAAAA,CAoBkB,SAAA,CAAA,UAAA,CAAA,CAC6BJ,EAAA,CAAzDvM,CAAAA,CAAS,CAAE,IAAA,CAAM,MAAA,CAAQ,SAAA,CAAW,iBAAkB,CAAC,GArB7C2M,CAAAA,CAqB+C,SAAA,CAAA,gBAAA,CAAA,CAGzCJ,CAAAA,CAAA,CAAhB7C,GAAM,CAAA,CAxBIiD,CAAAA,CAwBM,SAAA,CAAA,OAAA,CAAA,CACAJ,CAAAA,CAAA,CAAhB7C,CAAAA,EAAM,CAAA,CAzBIiD,CAAAA,CAyBM,SAAA,CAAA,cAAA,CAAA,CACAJ,CAAAA,CAAA,CAAhB7C,CAAAA,EAAM,CAAA,CA1BIiD,EA0BM,SAAA,CAAA,aAAA,CAAA,CAuvBd,cAAA,CAAe,GAAA,CAAI,uBAAuB,GAC7C,cAAA,CAAe,MAAA,CAAO,uBAAA,CAAyBA,CAAmB,ECp0BpElnB,EAAAA,EAAW","file":"standalone.standalone.js","sourcesContent":["/**\n * Idempotent CSS loader for @grasco/profile-picture\n *\n * Auto-injects the component's CSS via <link> tag when the module is imported.\n * Uses relative URL detection to find styles.css in the same directory as the JS file.\n *\n * Idempotency is guaranteed through 4 layers:\n * 1. Module-level flag - prevents multiple calls in same bundle\n * 2. ID check - prevents duplicates across bundles\n * 3. href pattern check - catches manually added links\n * 4. SSR guard - prevents errors in Node.js\n *\n * SSR Hydration Safety:\n * Style injection is deferred using requestIdleCallback (with setTimeout fallback)\n * to avoid DOM mutations during React/framework hydration, which would cause\n * hydration mismatch errors.\n */\n\nconst LINK_ID = \"grasco-profile-picture-styles\";\n\nlet loaded = false;\nlet loadScheduled = false;\n\n/**\n * Load the component's CSS stylesheet\n * Safe to call multiple times - will only inject once\n * Defers injection to avoid SSR hydration mismatch\n */\nexport function loadStyles(): void {\n // Skip if already loaded (module-level)\n if (loaded) {\n return;\n }\n\n // Skip if SSR (no document)\n if (typeof document === \"undefined\") {\n return;\n }\n\n // Skip if link already exists by ID (idempotency across bundles)\n if (document.getElementById(LINK_ID)) {\n loaded = true;\n return;\n }\n\n // Check if any link already points to our CSS (by href pattern)\n const existingLink = document.querySelector(\n 'link[href*=\"profile-picture\"][href$=\"styles.css\"]'\n );\n if (existingLink) {\n loaded = true;\n return;\n }\n\n // Schedule deferred injection (after hydration completes)\n if (!loadScheduled) {\n loadScheduled = true;\n scheduleStyleInjection();\n }\n}\n\n/**\n * Schedule style injection after hydration using requestIdleCallback\n * Falls back to setTimeout for browsers without requestIdleCallback support\n */\nfunction scheduleStyleInjection(): void {\n const defer =\n typeof requestIdleCallback !== \"undefined\"\n ? requestIdleCallback\n : (cb: () => void) => setTimeout(cb, 1);\n\n defer(() => injectStyleLink());\n}\n\n/**\n * Actually inject the <link> tag into the document head\n */\nfunction injectStyleLink(): void {\n // Re-check conditions in case something changed\n if (loaded || typeof document === \"undefined\") {\n return;\n }\n\n if (document.getElementById(LINK_ID)) {\n loaded = true;\n return;\n }\n\n // Get CSS URL relative to current script\n const cssUrl = getCssUrl();\n if (!cssUrl) {\n return;\n }\n\n // Inject link tag\n const link = document.createElement(\"link\");\n link.id = LINK_ID;\n link.rel = \"stylesheet\";\n link.href = cssUrl;\n document.head.appendChild(link);\n\n loaded = true;\n}\n\n/**\n * Get the CSS file URL based on the current script's location\n */\nfunction getCssUrl(): string | null {\n // Allow custom override via global variable\n if (\n typeof window !== \"undefined\" &&\n (window as unknown as Record<string, string>).__GRASCO_PROFILE_PICTURE_CSS__\n ) {\n return (window as unknown as Record<string, string>)\n .__GRASCO_PROFILE_PICTURE_CSS__;\n }\n\n // Try import.meta.url first (ESM - most reliable for bundlers)\n try {\n const metaUrl = import.meta.url;\n if (metaUrl) {\n const basePath = metaUrl.substring(0, metaUrl.lastIndexOf(\"/\") + 1);\n return `${basePath}styles.css`;\n }\n } catch {\n // import.meta.url not available\n }\n\n // Fallback: Get current script URL\n const currentScript = document.currentScript as HTMLScriptElement | null;\n if (currentScript?.src) {\n const scriptUrl = new URL(currentScript.src);\n const basePath = scriptUrl.href.substring(\n 0,\n scriptUrl.href.lastIndexOf(\"/\") + 1\n );\n return `${basePath}dist/styles.css`;\n }\n\n return null;\n}\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\ntype StringKeys<T extends object> = {\n [K in keyof T]: T[K] extends string | null ? K : never;\n}[keyof T];\n\n// Since TypeScript 5.9, ARIAMixin has properties with the type Element | null\n// or Element[] | null. However, we can only support string attributes,\n// which is why we filter for string properties.\ntype ARIAAttributeMap = {\n [K in StringKeys<ARIAMixin>]: string;\n};\n\n/**\n * Map of ARIAMixin properties to attributes\n */\nexport const ariaMixinAttributes: ARIAAttributeMap = {\n ariaAtomic: 'aria-atomic',\n ariaAutoComplete: 'aria-autocomplete',\n ariaBrailleLabel: 'aria-braillelabel',\n ariaBrailleRoleDescription: 'aria-brailleroledescription',\n ariaBusy: 'aria-busy',\n ariaChecked: 'aria-checked',\n ariaColCount: 'aria-colcount',\n ariaColIndex: 'aria-colindex',\n ariaColIndexText: 'aria-colindextext',\n ariaColSpan: 'aria-colspan',\n ariaCurrent: 'aria-current',\n ariaDescription: 'aria-description',\n ariaDisabled: 'aria-disabled',\n ariaExpanded: 'aria-expanded',\n ariaHasPopup: 'aria-haspopup',\n ariaHidden: 'aria-hidden',\n ariaInvalid: 'aria-invalid',\n ariaKeyShortcuts: 'aria-keyshortcuts',\n ariaLabel: 'aria-label',\n ariaLevel: 'aria-level',\n ariaLive: 'aria-live',\n ariaModal: 'aria-modal',\n ariaMultiLine: 'aria-multiline',\n ariaMultiSelectable: 'aria-multiselectable',\n ariaOrientation: 'aria-orientation',\n ariaPlaceholder: 'aria-placeholder',\n ariaPosInSet: 'aria-posinset',\n ariaPressed: 'aria-pressed',\n ariaReadOnly: 'aria-readonly',\n ariaRelevant: 'aria-relevant',\n ariaRequired: 'aria-required',\n ariaRoleDescription: 'aria-roledescription',\n ariaRowCount: 'aria-rowcount',\n ariaRowIndex: 'aria-rowindex',\n ariaRowIndexText: 'aria-rowindextext',\n ariaRowSpan: 'aria-rowspan',\n ariaSelected: 'aria-selected',\n ariaSetSize: 'aria-setsize',\n ariaSort: 'aria-sort',\n ariaValueMax: 'aria-valuemax',\n ariaValueMin: 'aria-valuemin',\n ariaValueNow: 'aria-valuenow',\n ariaValueText: 'aria-valuetext',\n role: 'role',\n};\n\ntype ElementInternalsInterface = ElementInternals;\n\n// Shim the global element internals object\n// Methods should be fine as noops and properties can generally\n// be while on the server.\nexport const ElementInternalsShim = class ElementInternals\n implements ElementInternalsInterface\n{\n ariaActiveDescendantElement = null;\n ariaAtomic = '';\n ariaAutoComplete = '';\n ariaBrailleLabel = '';\n ariaBrailleRoleDescription = '';\n ariaBusy = '';\n ariaChecked = '';\n ariaColCount = '';\n ariaColIndex = '';\n ariaColIndexText = '';\n ariaColSpan = '';\n ariaControlsElements = null;\n ariaCurrent = '';\n ariaDescribedByElements = null;\n ariaDescription = '';\n ariaDetailsElements = null;\n ariaDisabled = '';\n ariaErrorMessageElements = null;\n ariaExpanded = '';\n ariaFlowToElements = null;\n ariaHasPopup = '';\n ariaHidden = '';\n ariaInvalid = '';\n ariaKeyShortcuts = '';\n ariaLabel = '';\n ariaLabelledByElements = null;\n ariaLevel = '';\n ariaLive = '';\n ariaModal = '';\n ariaMultiLine = '';\n ariaMultiSelectable = '';\n ariaOrientation = '';\n ariaOwnsElements = null;\n ariaPlaceholder = '';\n ariaPosInSet = '';\n ariaPressed = '';\n ariaReadOnly = '';\n ariaRelevant = '';\n ariaRequired = '';\n ariaRoleDescription = '';\n ariaRowCount = '';\n ariaRowIndex = '';\n ariaRowIndexText = '';\n ariaRowSpan = '';\n ariaSelected = '';\n ariaSetSize = '';\n ariaSort = '';\n ariaValueMax = '';\n ariaValueMin = '';\n ariaValueNow = '';\n ariaValueText = '';\n role = '';\n __host: HTMLElement;\n get shadowRoot() {\n // Grab the shadow root instance from the Element shim\n // to ensure that the shadow root is always available\n // to the internals instance even if the mode is 'closed'\n return (this.__host as HTMLElement & {__shadowRoot: ShadowRoot})\n .__shadowRoot;\n }\n constructor(_host: HTMLElement) {\n this.__host = _host;\n }\n checkValidity() {\n // TODO(augustjk) Consider actually implementing logic.\n // See https://github.com/lit/lit/issues/3740\n console.warn(\n '`ElementInternals.checkValidity()` was called on the server.' +\n 'This method always returns true.'\n );\n return true;\n }\n form = null;\n labels = [] as unknown as NodeListOf<HTMLLabelElement>;\n reportValidity() {\n return true;\n }\n setFormValue(): void {}\n setValidity(): void {}\n states = new Set<string>();\n validationMessage = '';\n validity = {} as ValidityState;\n willValidate = true;\n};\n\nconst ElementInternalsShimWithRealType =\n ElementInternalsShim as object as typeof ElementInternals;\nexport {ElementInternalsShimWithRealType as ElementInternals};\n\nexport const HYDRATE_INTERNALS_ATTR_PREFIX = 'hydrate-internals-';\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * This is a basic implementation of an EventTarget, Event and CustomEvent.\n *\n * This is not fully spec compliant (e.g. validation),\n * but should work well enough for our use cases.\n *\n * @see https://dom.spec.whatwg.org/#eventtarget\n * @see https://dom.spec.whatwg.org/#event\n * @see https://dom.spec.whatwg.org/#customevent\n */\n\nexport interface EventTargetShimMeta {\n /**\n * The event target parent represents the previous event target for an event\n * in capture phase and the next event target for a bubbling event.\n * Note that this is not the element parent\n */\n __eventTargetParent: globalThis.EventTarget | undefined;\n /**\n * The host event target/element of this event target, if this event target\n * is inside a Shadow DOM.\n */\n __host: globalThis.EventTarget | undefined;\n}\n\nconst isCaptureEventListener = (\n options: undefined | AddEventListenerOptions | boolean\n) => (typeof options === 'boolean' ? options : (options?.capture ?? false));\n\n// Event phases\nconst NONE = 0;\nconst CAPTURING_PHASE = 1;\nconst AT_TARGET = 2;\nconst BUBBLING_PHASE = 3;\n\n// Shim the global EventTarget object\nclass EventTarget implements globalThis.EventTarget, EventTargetShimMeta {\n private __eventListeners = new Map<\n string,\n Map<EventListenerOrEventListenerObject, AddEventListenerOptions>\n >();\n private __captureEventListeners = new Map<\n string,\n Map<EventListenerOrEventListenerObject, AddEventListenerOptions>\n >();\n __eventTargetParent: EventTarget | undefined;\n __host: EventTarget | undefined;\n\n addEventListener(\n type: string,\n callback: EventListenerOrEventListenerObject | null,\n options?: AddEventListenerOptions | boolean\n ): void {\n if (callback === undefined || callback === null) {\n return;\n }\n const eventListenersMap = isCaptureEventListener(options)\n ? this.__captureEventListeners\n : this.__eventListeners;\n let eventListeners = eventListenersMap.get(type);\n if (eventListeners === undefined) {\n eventListeners = new Map();\n eventListenersMap.set(type, eventListeners);\n } else if (eventListeners.has(callback)) {\n return;\n }\n\n const normalizedOptions =\n typeof options === 'object' && options ? options : {};\n normalizedOptions.signal?.addEventListener('abort', () =>\n this.removeEventListener(type, callback, options)\n );\n eventListeners.set(callback, normalizedOptions ?? {});\n }\n removeEventListener(\n type: string,\n callback: EventListenerOrEventListenerObject | null,\n options?: EventListenerOptions | boolean\n ): void {\n if (callback === undefined || callback === null) {\n return;\n }\n const eventListenersMap = isCaptureEventListener(options)\n ? this.__captureEventListeners\n : this.__eventListeners;\n const eventListeners = eventListenersMap.get(type);\n if (eventListeners !== undefined) {\n eventListeners.delete(callback);\n if (!eventListeners.size) {\n eventListenersMap.delete(type);\n }\n }\n }\n dispatchEvent(event: Event): boolean {\n const composedPath: EventTarget[] = [this];\n let parent = this.__eventTargetParent;\n if (event.composed) {\n while (parent) {\n composedPath.push(parent);\n parent = parent.__eventTargetParent;\n }\n } else {\n // If the event is not composed and the event was dispatched inside\n // shadow DOM, we need to stop before the host of the shadow DOM.\n while (parent && parent !== this.__host) {\n composedPath.push(parent);\n parent = parent.__eventTargetParent;\n }\n }\n\n // We need to patch various properties that would either be empty or wrong\n // in this scenario.\n let stopPropagation = false;\n let stopImmediatePropagation = false;\n let eventPhase = NONE;\n let target: EventTarget | null = null;\n let tmpTarget: EventTarget | null = null;\n let currentTarget: EventTarget | null = null;\n const originalStopPropagation = event.stopPropagation;\n const originalStopImmediatePropagation = event.stopImmediatePropagation;\n Object.defineProperties(event, {\n target: {\n get() {\n return target ?? tmpTarget;\n },\n ...enumerableProperty,\n },\n srcElement: {\n get() {\n return event.target;\n },\n ...enumerableProperty,\n },\n currentTarget: {\n get() {\n return currentTarget;\n },\n ...enumerableProperty,\n },\n eventPhase: {\n get() {\n return eventPhase;\n },\n ...enumerableProperty,\n },\n composedPath: {\n value: () => composedPath,\n ...enumerableProperty,\n },\n stopPropagation: {\n value: () => {\n stopPropagation = true;\n originalStopPropagation.call(event);\n },\n ...enumerableProperty,\n },\n stopImmediatePropagation: {\n value: () => {\n stopImmediatePropagation = true;\n originalStopImmediatePropagation.call(event);\n },\n ...enumerableProperty,\n },\n });\n\n // An event handler can either be a function, an object with a handleEvent\n // method or null. This function takes care to call the event handler\n // correctly.\n const invokeEventListener = (\n listener: EventListenerOrEventListenerObject,\n options: AddEventListenerOptions,\n eventListenerMap: Map<\n EventListenerOrEventListenerObject,\n AddEventListenerOptions\n >\n ) => {\n if (typeof listener === 'function') {\n listener(event);\n } else if (typeof listener?.handleEvent === 'function') {\n listener.handleEvent(event);\n }\n if (options.once) {\n eventListenerMap.delete(listener);\n }\n };\n // When an event is finished being dispatched, which can be after the event\n // tree has been traversed or stopPropagation/stopImmediatePropagation has\n // been called. Once that is the case, the currentTarget and eventPhase\n // need to be reset and a value, representing whether the event has not\n // been prevented, needs to be returned.\n const finishDispatch = () => {\n currentTarget = null;\n eventPhase = NONE;\n return !event.defaultPrevented;\n };\n\n // An event starts with the capture order, where it starts from the top.\n // This is done even if bubbles is set to false, which is the default.\n const captureEventPath = composedPath.slice().reverse();\n // If the event target, which dispatches the event, is either in the light DOM\n // or the event is not composed, the target is always itself. If that is not\n // the case, the target needs to be retargeted: https://dom.spec.whatwg.org/#retarget\n target = !this.__host || !event.composed ? this : null;\n const retarget = (eventTargets: EventTarget[]) => {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n tmpTarget = this;\n while (tmpTarget.__host && eventTargets.includes(tmpTarget.__host)) {\n tmpTarget = tmpTarget.__host;\n }\n };\n for (const eventTarget of captureEventPath) {\n if (!target && (!tmpTarget || tmpTarget === eventTarget.__host)) {\n retarget(captureEventPath.slice(captureEventPath.indexOf(eventTarget)));\n }\n currentTarget = eventTarget;\n eventPhase = eventTarget === event.target ? AT_TARGET : CAPTURING_PHASE;\n const captureEventListeners = eventTarget.__captureEventListeners.get(\n event.type\n );\n if (captureEventListeners) {\n for (const [listener, options] of captureEventListeners) {\n invokeEventListener(listener, options, captureEventListeners);\n if (stopImmediatePropagation) {\n // Event.stopImmediatePropagation() stops any following invocation\n // of an event handler even on the same event target.\n return finishDispatch();\n }\n }\n }\n if (stopPropagation) {\n // Event.stopPropagation() stops any following invocation\n // of an event handler for any following event targets.\n return finishDispatch();\n }\n }\n\n const bubbleEventPath = event.bubbles ? composedPath : [this];\n tmpTarget = null;\n for (const eventTarget of bubbleEventPath) {\n if (\n !target &&\n (!tmpTarget || eventTarget === (tmpTarget as EventTarget).__host)\n ) {\n retarget(\n bubbleEventPath.slice(0, bubbleEventPath.indexOf(eventTarget) + 1)\n );\n }\n currentTarget = eventTarget;\n eventPhase = eventTarget === event.target ? AT_TARGET : BUBBLING_PHASE;\n const captureEventListeners = eventTarget.__eventListeners.get(\n event.type\n );\n if (captureEventListeners) {\n for (const [listener, options] of captureEventListeners) {\n invokeEventListener(listener, options, captureEventListeners);\n if (stopImmediatePropagation) {\n // Event.stopImmediatePropagation() stops any following invocation\n // of an event handler even on the same event target.\n return finishDispatch();\n }\n }\n }\n if (stopPropagation) {\n // Event.stopPropagation() stops any following invocation\n // of an event handler for any following event targets.\n return finishDispatch();\n }\n }\n return finishDispatch();\n }\n}\n\nconst EventTargetShimWithRealType =\n EventTarget as object as typeof globalThis.EventTarget;\nexport {\n EventTargetShimWithRealType as EventTarget,\n EventTargetShimWithRealType as EventTargetShim,\n};\n\n/* Adapted from Node.js https://github.com/nodejs/node/blob/main/lib/internal/event_target.js */\n\ntype EventInterface = Event;\n\nconst enumerableProperty: Record<string, unknown> = {__proto__: null};\nenumerableProperty.enumerable = true;\nObject.freeze(enumerableProperty);\n\n// TODO: Remove this when we remove support for vm modules (--experimental-vm-modules).\nconst EventShim = class Event implements EventInterface {\n #cancelable = false;\n #bubbles = false;\n #composed = false;\n #defaultPrevented = false;\n #timestamp = Date.now();\n #propagationStopped = false;\n #type: string;\n #target: globalThis.EventTarget | null;\n #isBeingDispatched: boolean;\n readonly NONE = NONE;\n readonly CAPTURING_PHASE = CAPTURING_PHASE;\n readonly AT_TARGET = AT_TARGET;\n readonly BUBBLING_PHASE = BUBBLING_PHASE;\n static readonly NONE = NONE;\n static readonly CAPTURING_PHASE = CAPTURING_PHASE;\n static readonly AT_TARGET = AT_TARGET;\n static readonly BUBBLING_PHASE = BUBBLING_PHASE;\n\n constructor(type: string, options: EventInit = {}) {\n if (arguments.length === 0)\n throw new Error(`The type argument must be specified`);\n if (typeof options !== 'object' || !options) {\n throw new Error(`The \"options\" argument must be an object`);\n }\n const {bubbles, cancelable, composed} = options;\n this.#cancelable = !!cancelable;\n this.#bubbles = !!bubbles;\n this.#composed = !!composed;\n\n this.#type = `${type}`;\n this.#target = null;\n this.#isBeingDispatched = false;\n }\n\n initEvent(_type: string, _bubbles?: boolean, _cancelable?: boolean): void {\n throw new Error('Method not implemented.');\n }\n\n stopImmediatePropagation() {\n this.stopPropagation();\n }\n\n preventDefault() {\n this.#defaultPrevented = true;\n }\n\n get target(): globalThis.EventTarget | null {\n return this.#target;\n }\n\n get currentTarget(): globalThis.EventTarget | null {\n return this.#target;\n }\n\n get srcElement(): globalThis.EventTarget | null {\n return this.#target;\n }\n\n get type(): string {\n return this.#type;\n }\n\n get cancelable(): boolean {\n return this.#cancelable;\n }\n\n get defaultPrevented(): boolean {\n return this.#cancelable && this.#defaultPrevented;\n }\n\n get timeStamp(): number {\n return this.#timestamp;\n }\n\n composedPath(): globalThis.EventTarget[] {\n return this.#isBeingDispatched ? [this.#target!] : [];\n }\n\n get returnValue(): boolean {\n return !this.#cancelable || !this.#defaultPrevented;\n }\n\n get bubbles(): boolean {\n return this.#bubbles;\n }\n\n get composed(): boolean {\n return this.#composed;\n }\n\n get eventPhase(): number {\n return this.#isBeingDispatched ? Event.AT_TARGET : Event.NONE;\n }\n\n get cancelBubble(): boolean {\n return this.#propagationStopped;\n }\n\n set cancelBubble(value) {\n if (value) {\n this.#propagationStopped = true;\n }\n }\n\n stopPropagation(): void {\n this.#propagationStopped = true;\n }\n\n get isTrusted(): boolean {\n return false;\n }\n};\n\nObject.defineProperties(EventShim.prototype, {\n initEvent: enumerableProperty,\n stopImmediatePropagation: enumerableProperty,\n preventDefault: enumerableProperty,\n target: enumerableProperty,\n currentTarget: enumerableProperty,\n srcElement: enumerableProperty,\n type: enumerableProperty,\n cancelable: enumerableProperty,\n defaultPrevented: enumerableProperty,\n timeStamp: enumerableProperty,\n composedPath: enumerableProperty,\n returnValue: enumerableProperty,\n bubbles: enumerableProperty,\n composed: enumerableProperty,\n eventPhase: enumerableProperty,\n cancelBubble: enumerableProperty,\n stopPropagation: enumerableProperty,\n isTrusted: enumerableProperty,\n});\n\ntype CustomEventInterface = CustomEvent;\n\n// TODO: Remove this when we remove support for vm modules (--experimental-vm-modules).\nconst CustomEventShim = class CustomEvent<T>\n extends EventShim\n implements CustomEventInterface\n{\n #detail: T | null;\n\n constructor(type: string, options: CustomEventInit<T> = {}) {\n super(type, options);\n this.#detail = options?.detail ?? null;\n }\n\n initCustomEvent(\n _type: string,\n _bubbles?: boolean,\n _cancelable?: boolean,\n _detail?: T\n ): void {\n throw new Error('Method not implemented.');\n }\n\n get detail(): T {\n return this.#detail!;\n }\n};\n\nObject.defineProperties(CustomEventShim.prototype, {\n detail: enumerableProperty,\n});\n\nconst EventShimWithRealType = EventShim as object as typeof Event;\nconst CustomEventShimWithRealType =\n CustomEventShim as object as typeof CustomEvent;\nexport {\n EventShimWithRealType as Event,\n EventShimWithRealType as EventShim,\n CustomEventShimWithRealType as CustomEvent,\n CustomEventShimWithRealType as CustomEventShim,\n};\n","/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * This is a limited implemenation of the CSSStyleSheet class\n * and associated functionality.\n */\n\ntype MediaListInterface = MediaList;\n\nconst MediaListShim = class MediaList\n extends Array<string>\n implements MediaListInterface\n{\n get mediaText(): string {\n return this.join(', ');\n }\n toString(): string {\n return this.mediaText;\n }\n appendMedium(medium: string): void {\n if (!this.includes(medium)) {\n this.push(medium);\n }\n }\n deleteMedium(medium: string): void {\n const index = this.indexOf(medium);\n if (index !== -1) {\n this.splice(index, 1);\n }\n }\n item(index: number): string | null {\n return this[index] ?? null;\n }\n};\nconst MediaListShimWithRealType = MediaListShim as object as typeof MediaList;\nexport {MediaListShimWithRealType as MediaList};\n\ntype StyleSheetInterface = StyleSheet;\n\nconst StyleSheetShim = class StyleSheet implements StyleSheetInterface {\n private __media = new MediaListShim();\n\n disabled: boolean = false;\n get href(): string | null {\n return null;\n }\n get media(): MediaList {\n return this.__media;\n }\n get ownerNode(): Element | ProcessingInstruction | null {\n return null;\n }\n get parentStyleSheet(): CSSStyleSheet | null {\n return null;\n }\n get title(): string | null {\n return null;\n }\n get type(): string {\n return 'text/css';\n }\n};\n\nconst StyleSheetShimWithRealType =\n StyleSheetShim as object as typeof StyleSheet;\nexport {StyleSheetShimWithRealType as StyleSheet};\n\ntype CSSRuleInterface = CSSRule;\n\nconst CSSRuleShim = class CSSRule implements CSSRuleInterface {\n static readonly STYLE_RULE: 1 = 1 as const;\n static readonly CHARSET_RULE: 2 = 2 as const;\n static readonly IMPORT_RULE: 3 = 3 as const;\n static readonly MEDIA_RULE: 4 = 4 as const;\n static readonly FONT_FACE_RULE: 5 = 5 as const;\n static readonly PAGE_RULE: 6 = 6 as const;\n static readonly NAMESPACE_RULE: 10 = 10 as const;\n static readonly KEYFRAMES_RULE: 7 = 7 as const;\n static readonly KEYFRAME_RULE: 8 = 8 as const;\n static readonly SUPPORTS_RULE: 12 = 12 as const;\n static readonly COUNTER_STYLE_RULE: 11 = 11 as const;\n static readonly FONT_FEATURE_VALUES_RULE: 14 = 14 as const;\n readonly STYLE_RULE: 1 = 1 as const;\n readonly CHARSET_RULE: 2 = 2 as const;\n readonly IMPORT_RULE: 3 = 3 as const;\n readonly MEDIA_RULE: 4 = 4 as const;\n readonly FONT_FACE_RULE: 5 = 5 as const;\n readonly PAGE_RULE: 6 = 6 as const;\n readonly NAMESPACE_RULE: 10 = 10 as const;\n readonly KEYFRAMES_RULE: 7 = 7 as const;\n readonly KEYFRAME_RULE: 8 = 8 as const;\n readonly SUPPORTS_RULE: 12 = 12 as const;\n readonly COUNTER_STYLE_RULE: 11 = 11 as const;\n readonly FONT_FEATURE_VALUES_RULE: 14 = 14 as const;\n __parentStyleSheet: CSSStyleSheet | null = null;\n\n cssText: string = '';\n get parentRule(): CSSRule | null {\n return null;\n }\n get parentStyleSheet(): CSSStyleSheet | null {\n return this.__parentStyleSheet;\n }\n get type(): number {\n return 0;\n }\n};\n\nconst CSSRuleShimWithRealType = CSSRuleShim as object as typeof CSSRule;\nexport {CSSRuleShimWithRealType as CSSRule};\n\ntype CSSRuleListInterface = CSSRuleList;\n\nconst CSSRuleListShim = class CSSRuleList\n extends Array<CSSRule>\n implements CSSRuleListInterface\n{\n item(index: number): CSSRule | null {\n return this[index] ?? null;\n }\n};\n\nconst CSSRuleListShimWithRealType =\n CSSRuleListShim as object as typeof CSSRuleList;\nexport {CSSRuleListShimWithRealType as CSSRuleList};\n\ntype CSSStyleSheetInterface = CSSStyleSheet;\n\nconst CSSStyleSheetShim = class CSSStyleSheet\n extends StyleSheetShim\n implements CSSStyleSheetInterface\n{\n private __rules = new CSSRuleListShim();\n get cssRules(): CSSRuleList {\n return this.__rules;\n }\n get ownerRule(): CSSRule | null {\n return null;\n }\n get rules(): CSSRuleList {\n return this.cssRules;\n }\n addRule(_selector?: string, _style?: string, _index?: number): number {\n throw new Error('Method not implemented.');\n }\n deleteRule(_index: number): void {\n throw new Error('Method not implemented.');\n }\n insertRule(_rule: string, _index?: number): number {\n throw new Error('Method not implemented.');\n }\n removeRule(_index?: number): void {\n throw new Error('Method not implemented.');\n }\n replace(text: string): Promise<CSSStyleSheet> {\n this.replaceSync(text);\n return Promise.resolve(this);\n }\n replaceSync(text: string): void {\n this.__rules.length = 0;\n const rule = new CSSRuleShim();\n rule.cssText = text;\n this.__rules.push(rule);\n }\n};\n\nconst CSSStyleSheetShimWithRealType =\n CSSStyleSheetShim as object as typeof CSSStyleSheet;\nexport {\n CSSStyleSheetShimWithRealType as CSSStyleSheet,\n CSSStyleSheetShimWithRealType as CSSStyleSheetShim,\n};\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nimport {ElementInternalsShim} from './lib/element-internals.js';\nimport {\n EventTargetShim,\n EventShim,\n CustomEventShim,\n EventTargetShimMeta,\n} from './lib/events.js';\n\nexport {\n ariaMixinAttributes,\n ElementInternals,\n HYDRATE_INTERNALS_ATTR_PREFIX,\n} from './lib/element-internals.js';\nexport {\n CSSRule,\n CSSRuleList,\n CSSStyleSheet,\n MediaList,\n StyleSheet,\n} from './lib/css.js';\nexport {CustomEvent, Event, EventTarget} from './lib/events.js';\n\n// In an empty Node.js vm, we need to patch the global context.\n// TODO: Remove these globalThis assignments when we remove support\n// for vm modules (--experimental-vm-modules).\nglobalThis.Event ??= EventShim;\nglobalThis.CustomEvent ??= CustomEventShim;\n\n// Internal type to be used for the event polyfill functionality.\nexport type HTMLElementWithEventMeta = HTMLElement & EventTargetShimMeta;\n\nconst attributes = new WeakMap<\n InstanceType<typeof HTMLElementShim>,\n Map<string, string>\n>();\nconst attributesForElement = (\n element: InstanceType<typeof HTMLElementShim>\n) => {\n let attrs = attributes.get(element);\n if (attrs === undefined) {\n attributes.set(element, (attrs = new Map()));\n }\n return attrs;\n};\n\n// The typings around the exports below are a little funky:\n//\n// 1. We want the `name` of the shim classes to match the real ones at runtime,\n// hence e.g. `class Element`.\n// 2. We can't shadow the global types with a simple class declaration, because\n// then we can't reference the global types for casting, hence e.g.\n// `const ElementShim = class Element`.\n// 3. We want to export the classes typed as the real ones, hence e.g.\n// `const ElementShimWithRealType = ElementShim as object as typeof Element;`.\n// 4. We want the exported names to match the real ones, hence e.g.\n// `export {ElementShimWithRealType as Element}`.\nconst ElementShim = class Element extends EventTargetShim {\n get attributes() {\n return Array.from(attributesForElement(this)).map(([name, value]) => ({\n name,\n value,\n }));\n }\n private __shadowRootMode: null | ShadowRootMode = null;\n protected __shadowRoot: null | ShadowRoot = null;\n protected __internals: null | ElementInternals = null;\n\n get shadowRoot() {\n if (this.__shadowRootMode === 'closed') {\n return null;\n }\n return this.__shadowRoot;\n }\n get localName() {\n return (this.constructor as NamedCustomHTMLElementConstructor).__localName;\n }\n get tagName() {\n return this.localName?.toUpperCase();\n }\n setAttribute(name: string, value: unknown): void {\n // Emulate browser behavior that silently casts all values to string. E.g.\n // `42` becomes `\"42\"` and `{}` becomes `\"[object Object]\"\"`.\n attributesForElement(this).set(name, String(value));\n }\n removeAttribute(name: string) {\n attributesForElement(this).delete(name);\n }\n toggleAttribute(name: string, force?: boolean): boolean {\n // Steps reference https://dom.spec.whatwg.org/#dom-element-toggleattribute\n if (this.hasAttribute(name)) {\n // Step 5\n if (force === undefined || !force) {\n this.removeAttribute(name);\n return false;\n }\n } else {\n // Step 4\n if (force === undefined || force) {\n // Step 4.1\n this.setAttribute(name, '');\n return true;\n } else {\n // Step 4.2\n return false;\n }\n }\n // Step 6\n return true;\n }\n hasAttribute(name: string) {\n return attributesForElement(this).has(name);\n }\n attachShadow(init: ShadowRootInit): ShadowRoot {\n const shadowRoot = {host: this} as object as ShadowRoot;\n this.__shadowRootMode = init.mode;\n if (init && init.mode === 'open') {\n this.__shadowRoot = shadowRoot;\n }\n return shadowRoot;\n }\n attachInternals(): ElementInternals {\n if (this.__internals !== null) {\n throw new Error(\n `Failed to execute 'attachInternals' on 'HTMLElement': ` +\n `ElementInternals for the specified element was already attached.`\n );\n }\n const internals = new ElementInternalsShim(this as unknown as HTMLElement);\n this.__internals = internals;\n return internals as ElementInternals;\n }\n getAttribute(name: string) {\n const value = attributesForElement(this).get(name);\n return value ?? null;\n }\n};\nconst ElementShimWithRealType = ElementShim as object as typeof Element;\nexport {ElementShimWithRealType as Element};\n\nconst HTMLElementShim = class HTMLElement extends ElementShim {};\nconst HTMLElementShimWithRealType =\n HTMLElementShim as object as typeof HTMLElement;\nexport {HTMLElementShimWithRealType as HTMLElement};\n\n// For convenience, we provide a global instance of a HTMLElement as an event\n// target. This facilitates registering global event handlers\n// (e.g. for @lit/context ContextProvider).\n// We use this in in the SSR render function.\n// Note, this is a bespoke element and not simply `document` or `window` since\n// user code relies on these being undefined in the server environment.\nglobalThis.litServerRoot ??= Object.defineProperty(\n new HTMLElementShimWithRealType(),\n 'localName',\n {\n // Patch localName (and tagName) to return a unique name.\n get() {\n return 'lit-server-root';\n },\n }\n);\n\ninterface CustomHTMLElementConstructor {\n new (): HTMLElement;\n observedAttributes?: string[];\n}\n\ninterface NamedCustomHTMLElementConstructor\n extends CustomHTMLElementConstructor {\n __localName: string;\n}\n\ntype CustomElementRegistration = {\n ctor: {new (): HTMLElement};\n observedAttributes: string[];\n};\n\ntype RealCustomElementRegistry = (typeof globalThis)['customElements'];\ntype RealCustomElementRegistryClass =\n (typeof globalThis)['CustomElementRegistry'];\n\n// Ponyfill for PromiseWithResolvers, remove once we can assume its presence.\ntype PromiseWithResolvers<T> = {\n promise: Promise<T>;\n resolve: (value: T) => void;\n reject: (reason?: unknown) => void;\n};\nfunction promiseWithResolvers<T>(): PromiseWithResolvers<T> {\n let resolve: (value: T) => void;\n let reject: (reason?: unknown) => void;\n const promise = new Promise<T>((res, rej) => {\n resolve = res;\n reject = rej;\n });\n return {promise, resolve: resolve!, reject: reject!};\n}\n\nclass CustomElementRegistry implements RealCustomElementRegistry {\n private __definitions = new Map<string, CustomElementRegistration>();\n private __reverseDefinitions = new Map<\n CustomHTMLElementConstructor,\n string\n >();\n private __pendingWhenDefineds = new Map<\n string,\n PromiseWithResolvers<CustomElementConstructor>\n >();\n\n define(name: string, ctor: CustomHTMLElementConstructor) {\n if (this.__definitions.has(name)) {\n if (process.env.NODE_ENV === 'development') {\n console.warn(\n `'CustomElementRegistry' already has \"${name}\" defined. ` +\n `This may have been caused by live reload or hot module ` +\n `replacement in which case it can be safely ignored.\\n` +\n `Make sure to test your application with a production build as ` +\n `repeat registrations will throw in production.`\n );\n } else {\n throw new Error(\n `Failed to execute 'define' on 'CustomElementRegistry': ` +\n `the name \"${name}\" has already been used with this registry`\n );\n }\n }\n if (this.__reverseDefinitions.has(ctor)) {\n throw new Error(\n `Failed to execute 'define' on 'CustomElementRegistry': ` +\n `the constructor has already been used with this registry for the ` +\n `tag name ${this.__reverseDefinitions.get(ctor)}`\n );\n }\n // Provide tagName and localName for the component.\n (ctor as NamedCustomHTMLElementConstructor).__localName = name;\n this.__definitions.set(name, {\n ctor,\n // Note it's important we read `observedAttributes` in case it is a getter\n // with side-effects, as is the case in Lit, where it triggers class\n // finalization.\n //\n // TODO(aomarks) To be spec compliant, we should also capture the\n // registration-time lifecycle methods like `connectedCallback`. For them\n // to be actually accessible to e.g. the Lit SSR element renderer, though,\n // we'd need to introduce a new API for accessing them (since `get` only\n // returns the constructor).\n observedAttributes: ctor.observedAttributes ?? [],\n });\n this.__reverseDefinitions.set(ctor, name);\n this.__pendingWhenDefineds.get(name)?.resolve(ctor);\n this.__pendingWhenDefineds.delete(name);\n }\n\n get(name: string) {\n const definition = this.__definitions.get(name);\n return definition?.ctor;\n }\n\n getName(ctor: CustomHTMLElementConstructor) {\n return this.__reverseDefinitions.get(ctor) ?? null;\n }\n\n upgrade(_element: HTMLElement) {\n // In SSR this doesn't make a lot of sense, so we do nothing.\n throw new Error(\n `customElements.upgrade is not currently supported in SSR. ` +\n `Please file a bug if you need it.`\n );\n }\n\n async whenDefined(name: string): Promise<CustomElementConstructor> {\n const definition = this.__definitions.get(name);\n if (definition) {\n return definition.ctor;\n }\n let withResolvers = this.__pendingWhenDefineds.get(name);\n if (!withResolvers) {\n withResolvers = promiseWithResolvers<CustomElementConstructor>();\n this.__pendingWhenDefineds.set(name, withResolvers);\n }\n return withResolvers.promise;\n }\n}\n\nconst CustomElementRegistryShimWithRealType =\n CustomElementRegistry as object as RealCustomElementRegistryClass;\nexport {CustomElementRegistryShimWithRealType as CustomElementRegistry};\n\nexport const customElements = new CustomElementRegistryShimWithRealType();\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nconst NODE_MODE = false;\n\n// Allows minifiers to rename references to globalThis\nconst global = globalThis;\n\n/**\n * Whether the current browser supports `adoptedStyleSheets`.\n */\nexport const supportsAdoptingStyleSheets: boolean =\n global.ShadowRoot &&\n (global.ShadyCSS === undefined || global.ShadyCSS.nativeShadow) &&\n 'adoptedStyleSheets' in Document.prototype &&\n 'replace' in CSSStyleSheet.prototype;\n\n/**\n * A CSSResult or native CSSStyleSheet.\n *\n * In browsers that support constructible CSS style sheets, CSSStyleSheet\n * object can be used for styling along side CSSResult from the `css`\n * template tag.\n */\nexport type CSSResultOrNative = CSSResult | CSSStyleSheet;\n\nexport type CSSResultArray = Array<CSSResultOrNative | CSSResultArray>;\n\n/**\n * A single CSSResult, CSSStyleSheet, or an array or nested arrays of those.\n */\nexport type CSSResultGroup = CSSResultOrNative | CSSResultArray;\n\nconst constructionToken = Symbol();\n\nconst cssTagCache = new WeakMap<TemplateStringsArray, CSSStyleSheet>();\n\n/**\n * A container for a string of CSS text, that may be used to create a CSSStyleSheet.\n *\n * CSSResult is the return value of `css`-tagged template literals and\n * `unsafeCSS()`. In order to ensure that CSSResults are only created via the\n * `css` tag and `unsafeCSS()`, CSSResult cannot be constructed directly.\n */\nexport class CSSResult {\n // This property needs to remain unminified.\n ['_$cssResult$'] = true;\n readonly cssText: string;\n private _styleSheet?: CSSStyleSheet;\n private _strings: TemplateStringsArray | undefined;\n\n private constructor(\n cssText: string,\n strings: TemplateStringsArray | undefined,\n safeToken: symbol\n ) {\n if (safeToken !== constructionToken) {\n throw new Error(\n 'CSSResult is not constructable. Use `unsafeCSS` or `css` instead.'\n );\n }\n this.cssText = cssText;\n this._strings = strings;\n }\n\n // This is a getter so that it's lazy. In practice, this means stylesheets\n // are not created until the first element instance is made.\n get styleSheet(): CSSStyleSheet | undefined {\n // If `supportsAdoptingStyleSheets` is true then we assume CSSStyleSheet is\n // constructable.\n let styleSheet = this._styleSheet;\n const strings = this._strings;\n if (supportsAdoptingStyleSheets && styleSheet === undefined) {\n const cacheable = strings !== undefined && strings.length === 1;\n if (cacheable) {\n styleSheet = cssTagCache.get(strings);\n }\n if (styleSheet === undefined) {\n (this._styleSheet = styleSheet = new CSSStyleSheet()).replaceSync(\n this.cssText\n );\n if (cacheable) {\n cssTagCache.set(strings, styleSheet);\n }\n }\n }\n return styleSheet;\n }\n\n toString(): string {\n return this.cssText;\n }\n}\n\ntype ConstructableCSSResult = CSSResult & {\n new (\n cssText: string,\n strings: TemplateStringsArray | undefined,\n safeToken: symbol\n ): CSSResult;\n};\n\nconst textFromCSSResult = (value: CSSResultGroup | number) => {\n // This property needs to remain unminified.\n if ((value as CSSResult)['_$cssResult$'] === true) {\n return (value as CSSResult).cssText;\n } else if (typeof value === 'number') {\n return value;\n } else {\n throw new Error(\n `Value passed to 'css' function must be a 'css' function result: ` +\n `${value}. Use 'unsafeCSS' to pass non-literal values, but take care ` +\n `to ensure page security.`\n );\n }\n};\n\n/**\n * Wrap a value for interpolation in a {@linkcode css} tagged template literal.\n *\n * This is unsafe because untrusted CSS text can be used to phone home\n * or exfiltrate data to an attacker controlled site. Take care to only use\n * this with trusted input.\n */\nexport const unsafeCSS = (value: unknown) =>\n new (CSSResult as ConstructableCSSResult)(\n typeof value === 'string' ? value : String(value),\n undefined,\n constructionToken\n );\n\n/**\n * A template literal tag which can be used with LitElement's\n * {@linkcode LitElement.styles} property to set element styles.\n *\n * For security reasons, only literal string values and number may be used in\n * embedded expressions. To incorporate non-literal values {@linkcode unsafeCSS}\n * may be used inside an expression.\n */\nexport const css = (\n strings: TemplateStringsArray,\n ...values: (CSSResultGroup | number)[]\n): CSSResult => {\n const cssText =\n strings.length === 1\n ? strings[0]\n : values.reduce(\n (acc, v, idx) => acc + textFromCSSResult(v) + strings[idx + 1],\n strings[0]\n );\n return new (CSSResult as ConstructableCSSResult)(\n cssText,\n strings,\n constructionToken\n );\n};\n\n/**\n * Applies the given styles to a `shadowRoot`. When Shadow DOM is\n * available but `adoptedStyleSheets` is not, styles are appended to the\n * `shadowRoot` to [mimic the native feature](https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/adoptedStyleSheets).\n * Note, when shimming is used, any styles that are subsequently placed into\n * the shadowRoot should be placed *before* any shimmed adopted styles. This\n * will match spec behavior that gives adopted sheets precedence over styles in\n * shadowRoot.\n */\nexport const adoptStyles = (\n renderRoot: ShadowRoot,\n styles: Array<CSSResultOrNative>\n) => {\n if (supportsAdoptingStyleSheets) {\n (renderRoot as ShadowRoot).adoptedStyleSheets = styles.map((s) =>\n s instanceof CSSStyleSheet ? s : s.styleSheet!\n );\n } else {\n for (const s of styles) {\n const style = document.createElement('style');\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const nonce = (global as any)['litNonce'];\n if (nonce !== undefined) {\n style.setAttribute('nonce', nonce);\n }\n style.textContent = (s as CSSResult).cssText;\n renderRoot.appendChild(style);\n }\n }\n};\n\nconst cssResultFromStyleSheet = (sheet: CSSStyleSheet) => {\n let cssText = '';\n for (const rule of sheet.cssRules) {\n cssText += rule.cssText;\n }\n return unsafeCSS(cssText);\n};\n\nexport const getCompatibleStyle =\n supportsAdoptingStyleSheets ||\n (NODE_MODE && global.CSSStyleSheet === undefined)\n ? (s: CSSResultOrNative) => s\n : (s: CSSResultOrNative) =>\n s instanceof CSSStyleSheet ? cssResultFromStyleSheet(s) : s;\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Use this module if you want to create your own base class extending\n * {@link ReactiveElement}.\n * @packageDocumentation\n */\n\nimport {\n getCompatibleStyle,\n adoptStyles,\n CSSResultGroup,\n CSSResultOrNative,\n} from './css-tag.js';\nimport type {\n ReactiveController,\n ReactiveControllerHost,\n} from './reactive-controller.js';\n\n// In the Node build, this import will be injected by Rollup:\n// import {HTMLElement, customElements} from '@lit-labs/ssr-dom-shim';\n\nexport * from './css-tag.js';\nexport type {\n ReactiveController,\n ReactiveControllerHost,\n} from './reactive-controller.js';\n\n/**\n * Removes the `readonly` modifier from properties in the union K.\n *\n * This is a safer way to cast a value to a type with a mutable version of a\n * readonly field, than casting to an interface with the field re-declared\n * because it preserves the type of all the fields and warns on typos.\n */\ntype Mutable<T, K extends keyof T> = Omit<T, K> & {\n -readonly [P in keyof Pick<T, K>]: P extends K ? T[P] : never;\n};\n\n// TODO (justinfagnani): Add `hasOwn` here when we ship ES2022\nconst {\n is,\n defineProperty,\n getOwnPropertyDescriptor,\n getOwnPropertyNames,\n getOwnPropertySymbols,\n getPrototypeOf,\n} = Object;\n\nconst NODE_MODE = false;\n\n// Lets a minifier replace globalThis references with a minified name\nconst global = globalThis;\n\nif (NODE_MODE) {\n global.customElements ??= customElements;\n}\n\nconst DEV_MODE = true;\n\nlet issueWarning: (code: string, warning: string) => void;\n\nconst trustedTypes = (global as unknown as {trustedTypes?: {emptyScript: ''}})\n .trustedTypes;\n\n// Temporary workaround for https://crbug.com/993268\n// Currently, any attribute starting with \"on\" is considered to be a\n// TrustedScript source. Such boolean attributes must be set to the equivalent\n// trusted emptyScript value.\nconst emptyStringForBooleanAttribute = trustedTypes\n ? (trustedTypes.emptyScript as unknown as '')\n : '';\n\nconst polyfillSupport = DEV_MODE\n ? global.reactiveElementPolyfillSupportDevMode\n : global.reactiveElementPolyfillSupport;\n\nif (DEV_MODE) {\n // Ensure warnings are issued only 1x, even if multiple versions of Lit\n // are loaded.\n global.litIssuedWarnings ??= new Set();\n\n /**\n * Issue a warning if we haven't already, based either on `code` or `warning`.\n * Warnings are disabled automatically only by `warning`; disabling via `code`\n * can be done by users.\n */\n issueWarning = (code: string, warning: string) => {\n warning += ` See https://lit.dev/msg/${code} for more information.`;\n if (\n !global.litIssuedWarnings!.has(warning) &&\n !global.litIssuedWarnings!.has(code)\n ) {\n console.warn(warning);\n global.litIssuedWarnings!.add(warning);\n }\n };\n\n queueMicrotask(() => {\n issueWarning(\n 'dev-mode',\n `Lit is in dev mode. Not recommended for production!`\n );\n\n // Issue polyfill support warning.\n if (global.ShadyDOM?.inUse && polyfillSupport === undefined) {\n issueWarning(\n 'polyfill-support-missing',\n `Shadow DOM is being polyfilled via \\`ShadyDOM\\` but ` +\n `the \\`polyfill-support\\` module has not been loaded.`\n );\n }\n });\n}\n\n/**\n * Contains types that are part of the unstable debug API.\n *\n * Everything in this API is not stable and may change or be removed in the future,\n * even on patch releases.\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace ReactiveUnstable {\n /**\n * When Lit is running in dev mode and `window.emitLitDebugLogEvents` is true,\n * we will emit 'lit-debug' events to window, with live details about the update and render\n * lifecycle. These can be useful for writing debug tooling and visualizations.\n *\n * Please be aware that running with window.emitLitDebugLogEvents has performance overhead,\n * making certain operations that are normally very cheap (like a no-op render) much slower,\n * because we must copy data and dispatch events.\n */\n // eslint-disable-next-line @typescript-eslint/no-namespace\n export namespace DebugLog {\n export type Entry = Update;\n export interface Update {\n kind: 'update';\n }\n }\n}\n\ninterface DebugLoggingWindow {\n // Even in dev mode, we generally don't want to emit these events, as that's\n // another level of cost, so only emit them when DEV_MODE is true _and_ when\n // window.emitLitDebugEvents is true.\n emitLitDebugLogEvents?: boolean;\n}\n\n/**\n * Useful for visualizing and logging insights into what the Lit template system is doing.\n *\n * Compiled out of prod mode builds.\n */\nconst debugLogEvent = DEV_MODE\n ? (event: ReactiveUnstable.DebugLog.Entry) => {\n const shouldEmit = (global as unknown as DebugLoggingWindow)\n .emitLitDebugLogEvents;\n if (!shouldEmit) {\n return;\n }\n global.dispatchEvent(\n new CustomEvent<ReactiveUnstable.DebugLog.Entry>('lit-debug', {\n detail: event,\n })\n );\n }\n : undefined;\n\n/*\n * When using Closure Compiler, JSCompiler_renameProperty(property, object) is\n * replaced at compile time by the munged name for object[property]. We cannot\n * alias this function, so we have to use a small shim that has the same\n * behavior when not compiling.\n */\n/*@__INLINE__*/\nconst JSCompiler_renameProperty = <P extends PropertyKey>(\n prop: P,\n _obj: unknown\n): P => prop;\n\n/**\n * Converts property values to and from attribute values.\n */\nexport interface ComplexAttributeConverter<Type = unknown, TypeHint = unknown> {\n /**\n * Called to convert an attribute value to a property\n * value.\n */\n fromAttribute?(value: string | null, type?: TypeHint): Type;\n\n /**\n * Called to convert a property value to an attribute\n * value.\n *\n * It returns unknown instead of string, to be compatible with\n * https://github.com/WICG/trusted-types (and similar efforts).\n */\n toAttribute?(value: Type, type?: TypeHint): unknown;\n}\n\ntype AttributeConverter<Type = unknown, TypeHint = unknown> =\n | ComplexAttributeConverter<Type>\n | ((value: string | null, type?: TypeHint) => Type);\n\n/**\n * Defines options for a property accessor.\n */\nexport interface PropertyDeclaration<Type = unknown, TypeHint = unknown> {\n /**\n * When set to `true`, indicates the property is internal private state. The\n * property should not be set by users. When using TypeScript, this property\n * should be marked as `private` or `protected`, and it is also a common\n * practice to use a leading `_` in the name. The property is not added to\n * `observedAttributes`.\n */\n readonly state?: boolean;\n\n /**\n * Indicates how and whether the property becomes an observed attribute.\n * If the value is `false`, the property is not added to `observedAttributes`.\n * If true or absent, the lowercased property name is observed (e.g. `fooBar`\n * becomes `foobar`). If a string, the string value is observed (e.g\n * `attribute: 'foo-bar'`).\n */\n readonly attribute?: boolean | string;\n\n /**\n * Indicates the type of the property. This is used only as a hint for the\n * `converter` to determine how to convert the attribute\n * to/from a property.\n */\n readonly type?: TypeHint;\n\n /**\n * Indicates how to convert the attribute to/from a property. If this value\n * is a function, it is used to convert the attribute value a the property\n * value. If it's an object, it can have keys for `fromAttribute` and\n * `toAttribute`. If no `toAttribute` function is provided and\n * `reflect` is set to `true`, the property value is set directly to the\n * attribute. A default `converter` is used if none is provided; it supports\n * `Boolean`, `String`, `Number`, `Object`, and `Array`. Note,\n * when a property changes and the converter is used to update the attribute,\n * the property is never updated again as a result of the attribute changing,\n * and vice versa.\n */\n readonly converter?: AttributeConverter<Type, TypeHint>;\n\n /**\n * Indicates if the property should reflect to an attribute.\n * If `true`, when the property is set, the attribute is set using the\n * attribute name determined according to the rules for the `attribute`\n * property option and the value of the property converted using the rules\n * from the `converter` property option.\n */\n readonly reflect?: boolean;\n\n /**\n * A function that indicates if a property should be considered changed when\n * it is set. The function should take the `newValue` and `oldValue` and\n * return `true` if an update should be requested.\n */\n hasChanged?(value: Type, oldValue: Type): boolean;\n\n /**\n * Indicates whether an accessor will be created for this property. By\n * default, an accessor will be generated for this property that requests an\n * update when set. If this flag is `true`, no accessor will be created, and\n * it will be the user's responsibility to call\n * `this.requestUpdate(propertyName, oldValue)` to request an update when\n * the property changes.\n */\n readonly noAccessor?: boolean;\n\n /**\n * Whether this property is wrapping accessors. This is set by `@property`\n * to control the initial value change and reflection logic.\n *\n * @internal\n */\n wrapped?: boolean;\n\n /**\n * When `true`, uses the initial value of the property as the default value,\n * which changes how attributes are handled:\n * - The initial value does *not* reflect, even if the `reflect` option is `true`.\n * Subsequent changes to the property will reflect, even if they are equal to the\n * default value.\n * - When the attribute is removed, the property is set to the default value\n * - The initial value will not trigger an old value in the `changedProperties` map\n * argument to update lifecycle methods.\n *\n * When set, properties must be initialized, either with a field initializer, or an\n * assignment in the constructor. Not initializing the property may lead to\n * improper handling of subsequent property assignments.\n *\n * While this behavior is opt-in, most properties that reflect to attributes should\n * use `useDefault: true` so that their initial values do not reflect.\n */\n useDefault?: boolean;\n}\n\n/**\n * Map of properties to PropertyDeclaration options. For each property an\n * accessor is made, and the property is processed according to the\n * PropertyDeclaration options.\n */\nexport interface PropertyDeclarations {\n readonly [key: string]: PropertyDeclaration;\n}\n\ntype PropertyDeclarationMap = Map<PropertyKey, PropertyDeclaration>;\n\ntype AttributeMap = Map<string, PropertyKey>;\n\n/**\n * A Map of property keys to values.\n *\n * Takes an optional type parameter T, which when specified as a non-any,\n * non-unknown type, will make the Map more strongly-typed, associating the map\n * keys with their corresponding value type on T.\n *\n * Use `PropertyValues<this>` when overriding ReactiveElement.update() and\n * other lifecycle methods in order to get stronger type-checking on keys\n * and values.\n */\n// This type is conditional so that if the parameter T is not specified, or\n// is `any`, the type will include `Map<PropertyKey, unknown>`. Since T is not\n// given in the uses of PropertyValues in this file, all uses here fallback to\n// meaning `Map<PropertyKey, unknown>`, but if a developer uses\n// `PropertyValues<this>` (or any other value for T) they will get a\n// strongly-typed Map type.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type PropertyValues<T = any> = T extends object\n ? PropertyValueMap<T>\n : Map<PropertyKey, unknown>;\n\n/**\n * Do not use, instead prefer {@linkcode PropertyValues}.\n */\n// This type must be exported such that JavaScript generated by the Google\n// Closure Compiler can import a type reference.\nexport interface PropertyValueMap<T> extends Map<PropertyKey, unknown> {\n get<K extends keyof T>(k: K): T[K] | undefined;\n set<K extends keyof T>(key: K, value: T[K]): this;\n has<K extends keyof T>(k: K): boolean;\n delete<K extends keyof T>(k: K): boolean;\n}\n\nexport const defaultConverter: ComplexAttributeConverter = {\n toAttribute(value: unknown, type?: unknown): unknown {\n switch (type) {\n case Boolean:\n value = value ? emptyStringForBooleanAttribute : null;\n break;\n case Object:\n case Array:\n // if the value is `null` or `undefined` pass this through\n // to allow removing/no change behavior.\n value = value == null ? value : JSON.stringify(value);\n break;\n }\n return value;\n },\n\n fromAttribute(value: string | null, type?: unknown) {\n let fromValue: unknown = value;\n switch (type) {\n case Boolean:\n fromValue = value !== null;\n break;\n case Number:\n fromValue = value === null ? null : Number(value);\n break;\n case Object:\n case Array:\n // Do *not* generate exception when invalid JSON is set as elements\n // don't normally complain on being mis-configured.\n // TODO(sorvell): Do generate exception in *dev mode*.\n try {\n // Assert to adhere to Bazel's \"must type assert JSON parse\" rule.\n fromValue = JSON.parse(value!) as unknown;\n } catch (e) {\n fromValue = null;\n }\n break;\n }\n return fromValue;\n },\n};\n\nexport interface HasChanged {\n (value: unknown, old: unknown): boolean;\n}\n\n/**\n * Change function that returns true if `value` is different from `oldValue`.\n * This method is used as the default for a property's `hasChanged` function.\n */\nexport const notEqual: HasChanged = (value: unknown, old: unknown): boolean =>\n !is(value, old);\n\nconst defaultPropertyDeclaration: PropertyDeclaration = {\n attribute: true,\n type: String,\n converter: defaultConverter,\n reflect: false,\n useDefault: false,\n hasChanged: notEqual,\n};\n\n/**\n * A string representing one of the supported dev mode warning categories.\n */\nexport type WarningKind =\n | 'change-in-update'\n | 'migration'\n | 'async-perform-update';\n\nexport type Initializer = (element: ReactiveElement) => void;\n\n// Temporary, until google3 is on TypeScript 5.2\ndeclare global {\n interface SymbolConstructor {\n readonly metadata: unique symbol;\n }\n}\n\n// Ensure metadata is enabled. TypeScript does not polyfill\n// Symbol.metadata, so we must ensure that it exists.\n(Symbol as {metadata: symbol}).metadata ??= Symbol('metadata');\n\ndeclare global {\n // This is public global API, do not change!\n // eslint-disable-next-line no-var\n var litPropertyMetadata: WeakMap<\n object,\n Map<PropertyKey, PropertyDeclaration>\n >;\n}\n\n// Map from a class's metadata object to property options\n// Note that we must use nullish-coalescing assignment so that we only use one\n// map even if we load multiple version of this module.\nglobal.litPropertyMetadata ??= new WeakMap<\n object,\n Map<PropertyKey, PropertyDeclaration>\n>();\n\n/**\n * Base element class which manages element properties and attributes. When\n * properties change, the `update` method is asynchronously called. This method\n * should be supplied by subclasses to render updates as desired.\n * @noInheritDoc\n */\nexport abstract class ReactiveElement\n // In the Node build, this `extends` clause will be substituted with\n // `(globalThis.HTMLElement ?? HTMLElement)`.\n //\n // This way, we will first prefer any global `HTMLElement` polyfill that the\n // user has assigned, and then fall back to the `HTMLElement` shim which has\n // been imported (see note at the top of this file about how this import is\n // generated by Rollup). Note that the `HTMLElement` variable has been\n // shadowed by this import, so it no longer refers to the global.\n extends HTMLElement\n implements ReactiveControllerHost\n{\n // Note: these are patched in only in DEV_MODE.\n /**\n * Read or set all the enabled warning categories for this class.\n *\n * This property is only used in development builds.\n *\n * @nocollapse\n * @category dev-mode\n */\n static enabledWarnings?: WarningKind[];\n\n /**\n * Enable the given warning category for this class.\n *\n * This method only exists in development builds, so it should be accessed\n * with a guard like:\n *\n * ```ts\n * // Enable for all ReactiveElement subclasses\n * ReactiveElement.enableWarning?.('migration');\n *\n * // Enable for only MyElement and subclasses\n * MyElement.enableWarning?.('migration');\n * ```\n *\n * @nocollapse\n * @category dev-mode\n */\n static enableWarning?: (warningKind: WarningKind) => void;\n\n /**\n * Disable the given warning category for this class.\n *\n * This method only exists in development builds, so it should be accessed\n * with a guard like:\n *\n * ```ts\n * // Disable for all ReactiveElement subclasses\n * ReactiveElement.disableWarning?.('migration');\n *\n * // Disable for only MyElement and subclasses\n * MyElement.disableWarning?.('migration');\n * ```\n *\n * @nocollapse\n * @category dev-mode\n */\n static disableWarning?: (warningKind: WarningKind) => void;\n\n /**\n * Adds an initializer function to the class that is called during instance\n * construction.\n *\n * This is useful for code that runs against a `ReactiveElement`\n * subclass, such as a decorator, that needs to do work for each\n * instance, such as setting up a `ReactiveController`.\n *\n * ```ts\n * const myDecorator = (target: typeof ReactiveElement, key: string) => {\n * target.addInitializer((instance: ReactiveElement) => {\n * // This is run during construction of the element\n * new MyController(instance);\n * });\n * }\n * ```\n *\n * Decorating a field will then cause each instance to run an initializer\n * that adds a controller:\n *\n * ```ts\n * class MyElement extends LitElement {\n * @myDecorator foo;\n * }\n * ```\n *\n * Initializers are stored per-constructor. Adding an initializer to a\n * subclass does not add it to a superclass. Since initializers are run in\n * constructors, initializers will run in order of the class hierarchy,\n * starting with superclasses and progressing to the instance's class.\n *\n * @nocollapse\n */\n static addInitializer(initializer: Initializer) {\n this.__prepare();\n (this._initializers ??= []).push(initializer);\n }\n\n static _initializers?: Initializer[];\n\n /*\n * Due to closure compiler ES6 compilation bugs, @nocollapse is required on\n * all static methods and properties with initializers. Reference:\n * - https://github.com/google/closure-compiler/issues/1776\n */\n\n /**\n * Maps attribute names to properties; for example `foobar` attribute to\n * `fooBar` property. Created lazily on user subclasses when finalizing the\n * class.\n * @nocollapse\n */\n private static __attributeToPropertyMap: AttributeMap;\n\n /**\n * Marks class as having been finalized, which includes creating properties\n * from `static properties`, but does *not* include all properties created\n * from decorators.\n * @nocollapse\n */\n protected static finalized: true | undefined;\n\n /**\n * Memoized list of all element properties, including any superclass\n * properties. Created lazily on user subclasses when finalizing the class.\n *\n * @nocollapse\n * @category properties\n */\n static elementProperties: PropertyDeclarationMap;\n\n /**\n * User-supplied object that maps property names to `PropertyDeclaration`\n * objects containing options for configuring reactive properties. When\n * a reactive property is set the element will update and render.\n *\n * By default properties are public fields, and as such, they should be\n * considered as primarily settable by element users, either via attribute or\n * the property itself.\n *\n * Generally, properties that are changed by the element should be private or\n * protected fields and should use the `state: true` option. Properties\n * marked as `state` do not reflect from the corresponding attribute\n *\n * However, sometimes element code does need to set a public property. This\n * should typically only be done in response to user interaction, and an event\n * should be fired informing the user; for example, a checkbox sets its\n * `checked` property when clicked and fires a `changed` event. Mutating\n * public properties should typically not be done for non-primitive (object or\n * array) properties. In other cases when an element needs to manage state, a\n * private property set with the `state: true` option should be used. When\n * needed, state properties can be initialized via public properties to\n * facilitate complex interactions.\n * @nocollapse\n * @category properties\n */\n static properties: PropertyDeclarations;\n\n /**\n * Memoized list of all element styles.\n * Created lazily on user subclasses when finalizing the class.\n * @nocollapse\n * @category styles\n */\n static elementStyles: Array<CSSResultOrNative> = [];\n\n /**\n * Array of styles to apply to the element. The styles should be defined\n * using the {@linkcode css} tag function, via constructible stylesheets, or\n * imported from native CSS module scripts.\n *\n * Note on Content Security Policy:\n *\n * Element styles are implemented with `<style>` tags when the browser doesn't\n * support adopted StyleSheets. To use such `<style>` tags with the style-src\n * CSP directive, the style-src value must either include 'unsafe-inline' or\n * `nonce-<base64-value>` with `<base64-value>` replaced be a server-generated\n * nonce.\n *\n * To provide a nonce to use on generated `<style>` elements, set\n * `window.litNonce` to a server-generated nonce in your page's HTML, before\n * loading application code:\n *\n * ```html\n * <script>\n * // Generated and unique per request:\n * window.litNonce = 'a1b2c3d4';\n * </script>\n * ```\n * @nocollapse\n * @category styles\n */\n static styles?: CSSResultGroup;\n\n /**\n * Returns a list of attributes corresponding to the registered properties.\n * @nocollapse\n * @category attributes\n */\n static get observedAttributes() {\n // Ensure we've created all properties\n this.finalize();\n // this.__attributeToPropertyMap is only undefined after finalize() in\n // ReactiveElement itself. ReactiveElement.observedAttributes is only\n // accessed with ReactiveElement as the receiver when a subclass or mixin\n // calls super.observedAttributes\n return (\n this.__attributeToPropertyMap && [...this.__attributeToPropertyMap.keys()]\n );\n }\n\n private __instanceProperties?: PropertyValues = undefined;\n\n /**\n * Creates a property accessor on the element prototype if one does not exist\n * and stores a {@linkcode PropertyDeclaration} for the property with the\n * given options. The property setter calls the property's `hasChanged`\n * property option or uses a strict identity check to determine whether or not\n * to request an update.\n *\n * This method may be overridden to customize properties; however,\n * when doing so, it's important to call `super.createProperty` to ensure\n * the property is setup correctly. This method calls\n * `getPropertyDescriptor` internally to get a descriptor to install.\n * To customize what properties do when they are get or set, override\n * `getPropertyDescriptor`. To customize the options for a property,\n * implement `createProperty` like this:\n *\n * ```ts\n * static createProperty(name, options) {\n * options = Object.assign(options, {myOption: true});\n * super.createProperty(name, options);\n * }\n * ```\n *\n * @nocollapse\n * @category properties\n */\n static createProperty(\n name: PropertyKey,\n options: PropertyDeclaration = defaultPropertyDeclaration\n ) {\n // If this is a state property, force the attribute to false.\n if (options.state) {\n (options as Mutable<PropertyDeclaration, 'attribute'>).attribute = false;\n }\n this.__prepare();\n // Whether this property is wrapping accessors.\n // Helps control the initial value change and reflection logic.\n if (this.prototype.hasOwnProperty(name)) {\n options = Object.create(options);\n options.wrapped = true;\n }\n this.elementProperties.set(name, options);\n if (!options.noAccessor) {\n const key = DEV_MODE\n ? // Use Symbol.for in dev mode to make it easier to maintain state\n // when doing HMR.\n Symbol.for(`${String(name)} (@property() cache)`)\n : Symbol();\n const descriptor = this.getPropertyDescriptor(name, key, options);\n if (descriptor !== undefined) {\n defineProperty(this.prototype, name, descriptor);\n }\n }\n }\n\n /**\n * Returns a property descriptor to be defined on the given named property.\n * If no descriptor is returned, the property will not become an accessor.\n * For example,\n *\n * ```ts\n * class MyElement extends LitElement {\n * static getPropertyDescriptor(name, key, options) {\n * const defaultDescriptor =\n * super.getPropertyDescriptor(name, key, options);\n * const setter = defaultDescriptor.set;\n * return {\n * get: defaultDescriptor.get,\n * set(value) {\n * setter.call(this, value);\n * // custom action.\n * },\n * configurable: true,\n * enumerable: true\n * }\n * }\n * }\n * ```\n *\n * @nocollapse\n * @category properties\n */\n protected static getPropertyDescriptor(\n name: PropertyKey,\n key: string | symbol,\n options: PropertyDeclaration\n ): PropertyDescriptor | undefined {\n const {get, set} = getOwnPropertyDescriptor(this.prototype, name) ?? {\n get(this: ReactiveElement) {\n return this[key as keyof typeof this];\n },\n set(this: ReactiveElement, v: unknown) {\n (this as unknown as Record<string | symbol, unknown>)[key] = v;\n },\n };\n if (DEV_MODE && get == null) {\n if ('value' in (getOwnPropertyDescriptor(this.prototype, name) ?? {})) {\n throw new Error(\n `Field ${JSON.stringify(String(name))} on ` +\n `${this.name} was declared as a reactive property ` +\n `but it's actually declared as a value on the prototype. ` +\n `Usually this is due to using @property or @state on a method.`\n );\n }\n issueWarning(\n 'reactive-property-without-getter',\n `Field ${JSON.stringify(String(name))} on ` +\n `${this.name} was declared as a reactive property ` +\n `but it does not have a getter. This will be an error in a ` +\n `future version of Lit.`\n );\n }\n return {\n get,\n set(this: ReactiveElement, value: unknown) {\n const oldValue = get?.call(this);\n set?.call(this, value);\n this.requestUpdate(name, oldValue, options);\n },\n configurable: true,\n enumerable: true,\n };\n }\n\n /**\n * Returns the property options associated with the given property.\n * These options are defined with a `PropertyDeclaration` via the `properties`\n * object or the `@property` decorator and are registered in\n * `createProperty(...)`.\n *\n * Note, this method should be considered \"final\" and not overridden. To\n * customize the options for a given property, override\n * {@linkcode createProperty}.\n *\n * @nocollapse\n * @final\n * @category properties\n */\n static getPropertyOptions(name: PropertyKey) {\n return this.elementProperties.get(name) ?? defaultPropertyDeclaration;\n }\n\n // Temporary, until google3 is on TypeScript 5.2\n declare static [Symbol.metadata]: object & Record<PropertyKey, unknown>;\n\n /**\n * Initializes static own properties of the class used in bookkeeping\n * for element properties, initializers, etc.\n *\n * Can be called multiple times by code that needs to ensure these\n * properties exist before using them.\n *\n * This method ensures the superclass is finalized so that inherited\n * property metadata can be copied down.\n * @nocollapse\n */\n private static __prepare() {\n if (\n this.hasOwnProperty(JSCompiler_renameProperty('elementProperties', this))\n ) {\n // Already prepared\n return;\n }\n // Finalize any superclasses\n const superCtor = getPrototypeOf(this) as typeof ReactiveElement;\n superCtor.finalize();\n\n // Create own set of initializers for this class if any exist on the\n // superclass and copy them down. Note, for a small perf boost, avoid\n // creating initializers unless needed.\n if (superCtor._initializers !== undefined) {\n this._initializers = [...superCtor._initializers];\n }\n // Initialize elementProperties from the superclass\n this.elementProperties = new Map(superCtor.elementProperties);\n }\n\n /**\n * Finishes setting up the class so that it's ready to be registered\n * as a custom element and instantiated.\n *\n * This method is called by the ReactiveElement.observedAttributes getter.\n * If you override the observedAttributes getter, you must either call\n * super.observedAttributes to trigger finalization, or call finalize()\n * yourself.\n *\n * @nocollapse\n */\n protected static finalize() {\n if (this.hasOwnProperty(JSCompiler_renameProperty('finalized', this))) {\n return;\n }\n this.finalized = true;\n this.__prepare();\n\n // Create properties from the static properties block:\n if (this.hasOwnProperty(JSCompiler_renameProperty('properties', this))) {\n const props = this.properties;\n const propKeys = [\n ...getOwnPropertyNames(props),\n ...getOwnPropertySymbols(props),\n ] as Array<keyof typeof props>;\n for (const p of propKeys) {\n this.createProperty(p, props[p]);\n }\n }\n\n // Create properties from standard decorator metadata:\n const metadata = this[Symbol.metadata];\n if (metadata !== null) {\n const properties = litPropertyMetadata.get(metadata);\n if (properties !== undefined) {\n for (const [p, options] of properties) {\n this.elementProperties.set(p, options);\n }\n }\n }\n\n // Create the attribute-to-property map\n this.__attributeToPropertyMap = new Map();\n for (const [p, options] of this.elementProperties) {\n const attr = this.__attributeNameForProperty(p, options);\n if (attr !== undefined) {\n this.__attributeToPropertyMap.set(attr, p);\n }\n }\n\n this.elementStyles = this.finalizeStyles(this.styles);\n\n if (DEV_MODE) {\n if (this.hasOwnProperty('createProperty')) {\n issueWarning(\n 'no-override-create-property',\n 'Overriding ReactiveElement.createProperty() is deprecated. ' +\n 'The override will not be called with standard decorators'\n );\n }\n if (this.hasOwnProperty('getPropertyDescriptor')) {\n issueWarning(\n 'no-override-get-property-descriptor',\n 'Overriding ReactiveElement.getPropertyDescriptor() is deprecated. ' +\n 'The override will not be called with standard decorators'\n );\n }\n }\n }\n\n /**\n * Options used when calling `attachShadow`. Set this property to customize\n * the options for the shadowRoot; for example, to create a closed\n * shadowRoot: `{mode: 'closed'}`.\n *\n * Note, these options are used in `createRenderRoot`. If this method\n * is customized, options should be respected if possible.\n * @nocollapse\n * @category rendering\n */\n static shadowRootOptions: ShadowRootInit = {mode: 'open'};\n\n /**\n * Takes the styles the user supplied via the `static styles` property and\n * returns the array of styles to apply to the element.\n * Override this method to integrate into a style management system.\n *\n * Styles are deduplicated preserving the _last_ instance in the list. This\n * is a performance optimization to avoid duplicated styles that can occur\n * especially when composing via subclassing. The last item is kept to try\n * to preserve the cascade order with the assumption that it's most important\n * that last added styles override previous styles.\n *\n * @nocollapse\n * @category styles\n */\n protected static finalizeStyles(\n styles?: CSSResultGroup\n ): Array<CSSResultOrNative> {\n const elementStyles = [];\n if (Array.isArray(styles)) {\n // Dedupe the flattened array in reverse order to preserve the last items.\n // Casting to Array<unknown> works around TS error that\n // appears to come from trying to flatten a type CSSResultArray.\n const set = new Set((styles as Array<unknown>).flat(Infinity).reverse());\n // Then preserve original order by adding the set items in reverse order.\n for (const s of set) {\n elementStyles.unshift(getCompatibleStyle(s as CSSResultOrNative));\n }\n } else if (styles !== undefined) {\n elementStyles.push(getCompatibleStyle(styles));\n }\n return elementStyles;\n }\n\n /**\n * Node or ShadowRoot into which element DOM should be rendered. Defaults\n * to an open shadowRoot.\n * @category rendering\n */\n readonly renderRoot!: HTMLElement | DocumentFragment;\n\n /**\n * Returns the property name for the given attribute `name`.\n * @nocollapse\n */\n private static __attributeNameForProperty(\n name: PropertyKey,\n options: PropertyDeclaration\n ) {\n const attribute = options.attribute;\n return attribute === false\n ? undefined\n : typeof attribute === 'string'\n ? attribute\n : typeof name === 'string'\n ? name.toLowerCase()\n : undefined;\n }\n\n // Initialize to an unresolved Promise so we can make sure the element has\n // connected before first update.\n private __updatePromise!: Promise<boolean>;\n\n /**\n * True if there is a pending update as a result of calling `requestUpdate()`.\n * Should only be read.\n * @category updates\n */\n isUpdatePending = false;\n\n /**\n * Is set to `true` after the first update. The element code cannot assume\n * that `renderRoot` exists before the element `hasUpdated`.\n * @category updates\n */\n hasUpdated = false;\n\n /**\n * Map with keys for any properties that have changed since the last\n * update cycle with previous values.\n *\n * @internal\n */\n _$changedProperties!: PropertyValues;\n\n /**\n * Records property default values when the\n * `useDefault` option is used.\n */\n private __defaultValues?: Map<PropertyKey, unknown>;\n\n /**\n * Properties that should be reflected when updated.\n */\n private __reflectingProperties?: Set<PropertyKey>;\n\n /**\n * Name of currently reflecting property\n */\n private __reflectingProperty: PropertyKey | null = null;\n\n /**\n * Set of controllers.\n */\n private __controllers?: Set<ReactiveController>;\n\n constructor() {\n super();\n this.__initialize();\n }\n\n /**\n * Internal only override point for customizing work done when elements\n * are constructed.\n */\n private __initialize() {\n this.__updatePromise = new Promise<boolean>(\n (res) => (this.enableUpdating = res)\n );\n this._$changedProperties = new Map();\n // This enqueues a microtask that must run before the first update, so it\n // must be called before requestUpdate()\n this.__saveInstanceProperties();\n // ensures first update will be caught by an early access of\n // `updateComplete`\n this.requestUpdate();\n (this.constructor as typeof ReactiveElement)._initializers?.forEach((i) =>\n i(this)\n );\n }\n\n /**\n * Registers a `ReactiveController` to participate in the element's reactive\n * update cycle. The element automatically calls into any registered\n * controllers during its lifecycle callbacks.\n *\n * If the element is connected when `addController()` is called, the\n * controller's `hostConnected()` callback will be immediately called.\n * @category controllers\n */\n addController(controller: ReactiveController) {\n (this.__controllers ??= new Set()).add(controller);\n // If a controller is added after the element has been connected,\n // call hostConnected. Note, re-using existence of `renderRoot` here\n // (which is set in connectedCallback) to avoid the need to track a\n // first connected state.\n if (this.renderRoot !== undefined && this.isConnected) {\n controller.hostConnected?.();\n }\n }\n\n /**\n * Removes a `ReactiveController` from the element.\n * @category controllers\n */\n removeController(controller: ReactiveController) {\n this.__controllers?.delete(controller);\n }\n\n /**\n * Fixes any properties set on the instance before upgrade time.\n * Otherwise these would shadow the accessor and break these properties.\n * The properties are stored in a Map which is played back after the\n * constructor runs.\n */\n private __saveInstanceProperties() {\n const instanceProperties = new Map<PropertyKey, unknown>();\n const elementProperties = (this.constructor as typeof ReactiveElement)\n .elementProperties;\n for (const p of elementProperties.keys() as IterableIterator<keyof this>) {\n if (this.hasOwnProperty(p)) {\n instanceProperties.set(p, this[p]);\n delete this[p];\n }\n }\n if (instanceProperties.size > 0) {\n this.__instanceProperties = instanceProperties;\n }\n }\n\n /**\n * Returns the node into which the element should render and by default\n * creates and returns an open shadowRoot. Implement to customize where the\n * element's DOM is rendered. For example, to render into the element's\n * childNodes, return `this`.\n *\n * @return Returns a node into which to render.\n * @category rendering\n */\n protected createRenderRoot(): HTMLElement | DocumentFragment {\n const renderRoot =\n this.shadowRoot ??\n this.attachShadow(\n (this.constructor as typeof ReactiveElement).shadowRootOptions\n );\n adoptStyles(\n renderRoot,\n (this.constructor as typeof ReactiveElement).elementStyles\n );\n return renderRoot;\n }\n\n /**\n * On first connection, creates the element's renderRoot, sets up\n * element styling, and enables updating.\n * @category lifecycle\n */\n connectedCallback() {\n // Create renderRoot before controllers `hostConnected`\n (this as Mutable<typeof this, 'renderRoot'>).renderRoot ??=\n this.createRenderRoot();\n this.enableUpdating(true);\n this.__controllers?.forEach((c) => c.hostConnected?.());\n }\n\n /**\n * Note, this method should be considered final and not overridden. It is\n * overridden on the element instance with a function that triggers the first\n * update.\n * @category updates\n */\n protected enableUpdating(_requestedUpdate: boolean) {}\n\n /**\n * Allows for `super.disconnectedCallback()` in extensions while\n * reserving the possibility of making non-breaking feature additions\n * when disconnecting at some point in the future.\n * @category lifecycle\n */\n disconnectedCallback() {\n this.__controllers?.forEach((c) => c.hostDisconnected?.());\n }\n\n /**\n * Synchronizes property values when attributes change.\n *\n * Specifically, when an attribute is set, the corresponding property is set.\n * You should rarely need to implement this callback. If this method is\n * overridden, `super.attributeChangedCallback(name, _old, value)` must be\n * called.\n *\n * See [responding to attribute changes](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#responding_to_attribute_changes)\n * on MDN for more information about the `attributeChangedCallback`.\n * @category attributes\n */\n attributeChangedCallback(\n name: string,\n _old: string | null,\n value: string | null\n ) {\n this._$attributeToProperty(name, value);\n }\n\n private __propertyToAttribute(name: PropertyKey, value: unknown) {\n const elemProperties: PropertyDeclarationMap = (\n this.constructor as typeof ReactiveElement\n ).elementProperties;\n const options = elemProperties.get(name)!;\n const attr = (\n this.constructor as typeof ReactiveElement\n ).__attributeNameForProperty(name, options);\n if (attr !== undefined && options.reflect === true) {\n const converter =\n (options.converter as ComplexAttributeConverter)?.toAttribute !==\n undefined\n ? (options.converter as ComplexAttributeConverter)\n : defaultConverter;\n const attrValue = converter.toAttribute!(value, options.type);\n if (\n DEV_MODE &&\n (this.constructor as typeof ReactiveElement).enabledWarnings!.includes(\n 'migration'\n ) &&\n attrValue === undefined\n ) {\n issueWarning(\n 'undefined-attribute-value',\n `The attribute value for the ${name as string} property is ` +\n `undefined on element ${this.localName}. The attribute will be ` +\n `removed, but in the previous version of \\`ReactiveElement\\`, ` +\n `the attribute would not have changed.`\n );\n }\n // Track if the property is being reflected to avoid\n // setting the property again via `attributeChangedCallback`. Note:\n // 1. this takes advantage of the fact that the callback is synchronous.\n // 2. will behave incorrectly if multiple attributes are in the reaction\n // stack at time of calling. However, since we process attributes\n // in `update` this should not be possible (or an extreme corner case\n // that we'd like to discover).\n // mark state reflecting\n this.__reflectingProperty = name;\n if (attrValue == null) {\n this.removeAttribute(attr);\n } else {\n this.setAttribute(attr, attrValue as string);\n }\n // mark state not reflecting\n this.__reflectingProperty = null;\n }\n }\n\n /** @internal */\n _$attributeToProperty(name: string, value: string | null) {\n const ctor = this.constructor as typeof ReactiveElement;\n // Note, hint this as an `AttributeMap` so closure clearly understands\n // the type; it has issues with tracking types through statics\n const propName = (ctor.__attributeToPropertyMap as AttributeMap).get(name);\n // Use tracking info to avoid reflecting a property value to an attribute\n // if it was just set because the attribute changed.\n if (propName !== undefined && this.__reflectingProperty !== propName) {\n const options = ctor.getPropertyOptions(propName);\n const converter =\n typeof options.converter === 'function'\n ? {fromAttribute: options.converter}\n : options.converter?.fromAttribute !== undefined\n ? options.converter\n : defaultConverter;\n // mark state reflecting\n this.__reflectingProperty = propName;\n const convertedValue = converter.fromAttribute!(value, options.type);\n this[propName as keyof this] =\n convertedValue ??\n this.__defaultValues?.get(propName) ??\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (convertedValue as any);\n // mark state not reflecting\n this.__reflectingProperty = null;\n }\n }\n\n /**\n * Requests an update which is processed asynchronously. This should be called\n * when an element should update based on some state not triggered by setting\n * a reactive property. In this case, pass no arguments. It should also be\n * called when manually implementing a property setter. In this case, pass the\n * property `name` and `oldValue` to ensure that any configured property\n * options are honored.\n *\n * @param name name of requesting property\n * @param oldValue old value of requesting property\n * @param options property options to use instead of the previously\n * configured options\n * @param useNewValue if true, the newValue argument is used instead of\n * reading the property value. This is important to use if the reactive\n * property is a standard private accessor, as opposed to a plain\n * property, since private members can't be dynamically read by name.\n * @param newValue the new value of the property. This is only used if\n * `useNewValue` is true.\n * @category updates\n */\n requestUpdate(\n name?: PropertyKey,\n oldValue?: unknown,\n options?: PropertyDeclaration,\n useNewValue = false,\n newValue?: unknown\n ): void {\n // If we have a property key, perform property update steps.\n if (name !== undefined) {\n if (DEV_MODE && (name as unknown) instanceof Event) {\n issueWarning(\n ``,\n `The requestUpdate() method was called with an Event as the property name. This is probably a mistake caused by binding this.requestUpdate as an event listener. Instead bind a function that will call it with no arguments: () => this.requestUpdate()`\n );\n }\n const ctor = this.constructor as typeof ReactiveElement;\n if (useNewValue === false) {\n newValue = this[name as keyof this];\n }\n options ??= ctor.getPropertyOptions(name);\n const changed =\n (options.hasChanged ?? notEqual)(newValue, oldValue) ||\n // When there is no change, check a corner case that can occur when\n // 1. there's a initial value which was not reflected\n // 2. the property is subsequently set to this value.\n // For example, `prop: {useDefault: true, reflect: true}`\n // and el.prop = 'foo'. This should be considered a change if the\n // attribute is not set because we will now reflect the property to the attribute.\n (options.useDefault &&\n options.reflect &&\n newValue === this.__defaultValues?.get(name) &&\n !this.hasAttribute(ctor.__attributeNameForProperty(name, options)!));\n if (changed) {\n this._$changeProperty(name, oldValue, options);\n } else {\n // Abort the request if the property should not be considered changed.\n return;\n }\n }\n if (this.isUpdatePending === false) {\n this.__updatePromise = this.__enqueueUpdate();\n }\n }\n\n /**\n * @internal\n */\n _$changeProperty(\n name: PropertyKey,\n oldValue: unknown,\n {useDefault, reflect, wrapped}: PropertyDeclaration,\n initializeValue?: unknown\n ) {\n // Record default value when useDefault is used. This allows us to\n // restore this value when the attribute is removed.\n if (useDefault && !(this.__defaultValues ??= new Map()).has(name)) {\n this.__defaultValues.set(\n name,\n initializeValue ?? oldValue ?? this[name as keyof this]\n );\n // if this is not wrapping an accessor, it must be an initial setting\n // and in this case we do not want to record the change or reflect.\n if (wrapped !== true || initializeValue !== undefined) {\n return;\n }\n }\n // TODO (justinfagnani): Create a benchmark of Map.has() + Map.set(\n // vs just Map.set()\n if (!this._$changedProperties.has(name)) {\n // On the initial change, the old value should be `undefined`, except\n // with `useDefault`\n if (!this.hasUpdated && !useDefault) {\n oldValue = undefined;\n }\n this._$changedProperties.set(name, oldValue);\n }\n // Add to reflecting properties set.\n // Note, it's important that every change has a chance to add the\n // property to `__reflectingProperties`. This ensures setting\n // attribute + property reflects correctly.\n if (reflect === true && this.__reflectingProperty !== name) {\n (this.__reflectingProperties ??= new Set<PropertyKey>()).add(name);\n }\n }\n\n /**\n * Sets up the element to asynchronously update.\n */\n private async __enqueueUpdate() {\n this.isUpdatePending = true;\n try {\n // Ensure any previous update has resolved before updating.\n // This `await` also ensures that property changes are batched.\n await this.__updatePromise;\n } catch (e) {\n // Refire any previous errors async so they do not disrupt the update\n // cycle. Errors are refired so developers have a chance to observe\n // them, and this can be done by implementing\n // `window.onunhandledrejection`.\n Promise.reject(e);\n }\n const result = this.scheduleUpdate();\n // If `scheduleUpdate` returns a Promise, we await it. This is done to\n // enable coordinating updates with a scheduler. Note, the result is\n // checked to avoid delaying an additional microtask unless we need to.\n if (result != null) {\n await result;\n }\n return !this.isUpdatePending;\n }\n\n /**\n * Schedules an element update. You can override this method to change the\n * timing of updates by returning a Promise. The update will await the\n * returned Promise, and you should resolve the Promise to allow the update\n * to proceed. If this method is overridden, `super.scheduleUpdate()`\n * must be called.\n *\n * For instance, to schedule updates to occur just before the next frame:\n *\n * ```ts\n * override protected async scheduleUpdate(): Promise<unknown> {\n * await new Promise((resolve) => requestAnimationFrame(() => resolve()));\n * super.scheduleUpdate();\n * }\n * ```\n * @category updates\n */\n protected scheduleUpdate(): void | Promise<unknown> {\n const result = this.performUpdate();\n if (\n DEV_MODE &&\n (this.constructor as typeof ReactiveElement).enabledWarnings!.includes(\n 'async-perform-update'\n ) &&\n typeof (result as unknown as Promise<unknown> | undefined)?.then ===\n 'function'\n ) {\n issueWarning(\n 'async-perform-update',\n `Element ${this.localName} returned a Promise from performUpdate(). ` +\n `This behavior is deprecated and will be removed in a future ` +\n `version of ReactiveElement.`\n );\n }\n return result;\n }\n\n /**\n * Performs an element update. Note, if an exception is thrown during the\n * update, `firstUpdated` and `updated` will not be called.\n *\n * Call `performUpdate()` to immediately process a pending update. This should\n * generally not be needed, but it can be done in rare cases when you need to\n * update synchronously.\n *\n * @category updates\n */\n protected performUpdate(): void {\n // Abort any update if one is not pending when this is called.\n // This can happen if `performUpdate` is called early to \"flush\"\n // the update.\n if (!this.isUpdatePending) {\n return;\n }\n debugLogEvent?.({kind: 'update'});\n if (!this.hasUpdated) {\n // Create renderRoot before first update. This occurs in `connectedCallback`\n // but is done here to support out of tree calls to `enableUpdating`/`performUpdate`.\n (this as Mutable<typeof this, 'renderRoot'>).renderRoot ??=\n this.createRenderRoot();\n if (DEV_MODE) {\n // Produce warning if any reactive properties on the prototype are\n // shadowed by class fields. Instance fields set before upgrade are\n // deleted by this point, so any own property is caused by class field\n // initialization in the constructor.\n const ctor = this.constructor as typeof ReactiveElement;\n const shadowedProperties = [...ctor.elementProperties.keys()].filter(\n (p) => this.hasOwnProperty(p) && p in getPrototypeOf(this)\n );\n if (shadowedProperties.length) {\n throw new Error(\n `The following properties on element ${this.localName} will not ` +\n `trigger updates as expected because they are set using class ` +\n `fields: ${shadowedProperties.join(', ')}. ` +\n `Native class fields and some compiled output will overwrite ` +\n `accessors used for detecting changes. See ` +\n `https://lit.dev/msg/class-field-shadowing ` +\n `for more information.`\n );\n }\n }\n // Mixin instance properties once, if they exist.\n if (this.__instanceProperties) {\n // TODO (justinfagnani): should we use the stored value? Could a new value\n // have been set since we stored the own property value?\n for (const [p, value] of this.__instanceProperties) {\n this[p as keyof this] = value as this[keyof this];\n }\n this.__instanceProperties = undefined;\n }\n // Trigger initial value reflection and populate the initial\n // `changedProperties` map, but only for the case of properties created\n // via `createProperty` on accessors, which will not have already\n // populated the `changedProperties` map since they are not set.\n // We can't know if these accessors had initializers, so we just set\n // them anyway - a difference from experimental decorators on fields and\n // standard decorators on auto-accessors.\n // For context see:\n // https://github.com/lit/lit/pull/4183#issuecomment-1711959635\n const elementProperties = (this.constructor as typeof ReactiveElement)\n .elementProperties;\n if (elementProperties.size > 0) {\n for (const [p, options] of elementProperties) {\n const {wrapped} = options;\n const value = this[p as keyof this];\n if (\n wrapped === true &&\n !this._$changedProperties.has(p) &&\n value !== undefined\n ) {\n this._$changeProperty(p, undefined, options, value);\n }\n }\n }\n }\n let shouldUpdate = false;\n const changedProperties = this._$changedProperties;\n try {\n shouldUpdate = this.shouldUpdate(changedProperties);\n if (shouldUpdate) {\n this.willUpdate(changedProperties);\n this.__controllers?.forEach((c) => c.hostUpdate?.());\n this.update(changedProperties);\n } else {\n this.__markUpdated();\n }\n } catch (e) {\n // Prevent `firstUpdated` and `updated` from running when there's an\n // update exception.\n shouldUpdate = false;\n // Ensure element can accept additional updates after an exception.\n this.__markUpdated();\n throw e;\n }\n // The update is no longer considered pending and further updates are now allowed.\n if (shouldUpdate) {\n this._$didUpdate(changedProperties);\n }\n }\n\n /**\n * Invoked before `update()` to compute values needed during the update.\n *\n * Implement `willUpdate` to compute property values that depend on other\n * properties and are used in the rest of the update process.\n *\n * ```ts\n * willUpdate(changedProperties) {\n * // only need to check changed properties for an expensive computation.\n * if (changedProperties.has('firstName') || changedProperties.has('lastName')) {\n * this.sha = computeSHA(`${this.firstName} ${this.lastName}`);\n * }\n * }\n *\n * render() {\n * return html`SHA: ${this.sha}`;\n * }\n * ```\n *\n * @category updates\n */\n protected willUpdate(_changedProperties: PropertyValues): void {}\n\n // Note, this is an override point for polyfill-support.\n // @internal\n _$didUpdate(changedProperties: PropertyValues) {\n this.__controllers?.forEach((c) => c.hostUpdated?.());\n if (!this.hasUpdated) {\n this.hasUpdated = true;\n this.firstUpdated(changedProperties);\n }\n this.updated(changedProperties);\n if (\n DEV_MODE &&\n this.isUpdatePending &&\n (this.constructor as typeof ReactiveElement).enabledWarnings!.includes(\n 'change-in-update'\n )\n ) {\n issueWarning(\n 'change-in-update',\n `Element ${this.localName} scheduled an update ` +\n `(generally because a property was set) ` +\n `after an update completed, causing a new update to be scheduled. ` +\n `This is inefficient and should be avoided unless the next update ` +\n `can only be scheduled as a side effect of the previous update.`\n );\n }\n }\n\n private __markUpdated() {\n this._$changedProperties = new Map();\n this.isUpdatePending = false;\n }\n\n /**\n * Returns a Promise that resolves when the element has completed updating.\n * The Promise value is a boolean that is `true` if the element completed the\n * update without triggering another update. The Promise result is `false` if\n * a property was set inside `updated()`. If the Promise is rejected, an\n * exception was thrown during the update.\n *\n * To await additional asynchronous work, override the `getUpdateComplete`\n * method. For example, it is sometimes useful to await a rendered element\n * before fulfilling this Promise. To do this, first await\n * `super.getUpdateComplete()`, then any subsequent state.\n *\n * @return A promise of a boolean that resolves to true if the update completed\n * without triggering another update.\n * @category updates\n */\n get updateComplete(): Promise<boolean> {\n return this.getUpdateComplete();\n }\n\n /**\n * Override point for the `updateComplete` promise.\n *\n * It is not safe to override the `updateComplete` getter directly due to a\n * limitation in TypeScript which means it is not possible to call a\n * superclass getter (e.g. `super.updateComplete.then(...)`) when the target\n * language is ES5 (https://github.com/microsoft/TypeScript/issues/338).\n * This method should be overridden instead. For example:\n *\n * ```ts\n * class MyElement extends LitElement {\n * override async getUpdateComplete() {\n * const result = await super.getUpdateComplete();\n * await this._myChild.updateComplete;\n * return result;\n * }\n * }\n * ```\n *\n * @return A promise of a boolean that resolves to true if the update completed\n * without triggering another update.\n * @category updates\n */\n protected getUpdateComplete(): Promise<boolean> {\n return this.__updatePromise;\n }\n\n /**\n * Controls whether or not `update()` should be called when the element requests\n * an update. By default, this method always returns `true`, but this can be\n * customized to control when to update.\n *\n * @param _changedProperties Map of changed properties with old values\n * @category updates\n */\n protected shouldUpdate(_changedProperties: PropertyValues): boolean {\n return true;\n }\n\n /**\n * Updates the element. This method reflects property values to attributes.\n * It can be overridden to render and keep updated element DOM.\n * Setting properties inside this method will *not* trigger\n * another update.\n *\n * @param _changedProperties Map of changed properties with old values\n * @category updates\n */\n protected update(_changedProperties: PropertyValues) {\n // The forEach() expression will only run when __reflectingProperties is\n // defined, and it returns undefined, setting __reflectingProperties to\n // undefined\n this.__reflectingProperties &&= this.__reflectingProperties.forEach((p) =>\n this.__propertyToAttribute(p, this[p as keyof this])\n ) as undefined;\n this.__markUpdated();\n }\n\n /**\n * Invoked whenever the element is updated. Implement to perform\n * post-updating tasks via DOM APIs, for example, focusing an element.\n *\n * Setting properties inside this method will trigger the element to update\n * again after this update cycle completes.\n *\n * @param _changedProperties Map of changed properties with old values\n * @category updates\n */\n protected updated(_changedProperties: PropertyValues) {}\n\n /**\n * Invoked when the element is first updated. Implement to perform one time\n * work on the element after update.\n *\n * ```ts\n * firstUpdated() {\n * this.renderRoot.getElementById('my-text-area').focus();\n * }\n * ```\n *\n * Setting properties inside this method will trigger the element to update\n * again after this update cycle completes.\n *\n * @param _changedProperties Map of changed properties with old values\n * @category updates\n */\n protected firstUpdated(_changedProperties: PropertyValues) {}\n}\n// Assigned here to work around a jscompiler bug with static fields\n// when compiling to ES5.\n// https://github.com/google/closure-compiler/issues/3177\n(ReactiveElement as unknown as Record<string, unknown>)[\n JSCompiler_renameProperty('elementProperties', ReactiveElement)\n] = new Map();\n(ReactiveElement as unknown as Record<string, unknown>)[\n JSCompiler_renameProperty('finalized', ReactiveElement)\n] = new Map();\n\n// Apply polyfills if available\npolyfillSupport?.({ReactiveElement});\n\n// Dev mode warnings...\nif (DEV_MODE) {\n // Default warning set.\n ReactiveElement.enabledWarnings = [\n 'change-in-update',\n 'async-perform-update',\n ];\n const ensureOwnWarnings = function (ctor: typeof ReactiveElement) {\n if (\n !ctor.hasOwnProperty(JSCompiler_renameProperty('enabledWarnings', ctor))\n ) {\n ctor.enabledWarnings = ctor.enabledWarnings!.slice();\n }\n };\n ReactiveElement.enableWarning = function (\n this: typeof ReactiveElement,\n warning: WarningKind\n ) {\n ensureOwnWarnings(this);\n if (!this.enabledWarnings!.includes(warning)) {\n this.enabledWarnings!.push(warning);\n }\n };\n ReactiveElement.disableWarning = function (\n this: typeof ReactiveElement,\n warning: WarningKind\n ) {\n ensureOwnWarnings(this);\n const i = this.enabledWarnings!.indexOf(warning);\n if (i >= 0) {\n this.enabledWarnings!.splice(i, 1);\n }\n };\n}\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for ReactiveElement usage.\n(global.reactiveElementVersions ??= []).push('2.1.2');\nif (DEV_MODE && global.reactiveElementVersions.length > 1) {\n queueMicrotask(() => {\n issueWarning!(\n 'multiple-versions',\n `Multiple versions of Lit loaded. Loading multiple versions ` +\n `is not recommended.`\n );\n });\n}\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n// IMPORTANT: these imports must be type-only\nimport type {Directive, DirectiveResult, PartInfo} from './directive.js';\nimport type {TrustedHTML, TrustedTypesWindow} from 'trusted-types/lib/index.js';\n\nconst DEV_MODE = true;\nconst ENABLE_EXTRA_SECURITY_HOOKS = true;\nconst ENABLE_SHADYDOM_NOPATCH = true;\nconst NODE_MODE = false;\n\n// Allows minifiers to rename references to globalThis\nconst global = globalThis;\n\n/**\n * Contains types that are part of the unstable debug API.\n *\n * Everything in this API is not stable and may change or be removed in the future,\n * even on patch releases.\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace LitUnstable {\n /**\n * When Lit is running in dev mode and `window.emitLitDebugLogEvents` is true,\n * we will emit 'lit-debug' events to window, with live details about the update and render\n * lifecycle. These can be useful for writing debug tooling and visualizations.\n *\n * Please be aware that running with window.emitLitDebugLogEvents has performance overhead,\n * making certain operations that are normally very cheap (like a no-op render) much slower,\n * because we must copy data and dispatch events.\n */\n // eslint-disable-next-line @typescript-eslint/no-namespace\n export namespace DebugLog {\n export type Entry =\n | TemplatePrep\n | TemplateInstantiated\n | TemplateInstantiatedAndUpdated\n | TemplateUpdating\n | BeginRender\n | EndRender\n | CommitPartEntry\n | SetPartValue;\n export interface TemplatePrep {\n kind: 'template prep';\n template: Template;\n strings: TemplateStringsArray;\n clonableTemplate: HTMLTemplateElement;\n parts: TemplatePart[];\n }\n export interface BeginRender {\n kind: 'begin render';\n id: number;\n value: unknown;\n container: RenderRootNode;\n options: RenderOptions | undefined;\n part: ChildPart | undefined;\n }\n export interface EndRender {\n kind: 'end render';\n id: number;\n value: unknown;\n container: RenderRootNode;\n options: RenderOptions | undefined;\n part: ChildPart;\n }\n export interface TemplateInstantiated {\n kind: 'template instantiated';\n template: Template | CompiledTemplate;\n instance: TemplateInstance;\n options: RenderOptions | undefined;\n fragment: Node;\n parts: Array<Part | undefined>;\n values: unknown[];\n }\n export interface TemplateInstantiatedAndUpdated {\n kind: 'template instantiated and updated';\n template: Template | CompiledTemplate;\n instance: TemplateInstance;\n options: RenderOptions | undefined;\n fragment: Node;\n parts: Array<Part | undefined>;\n values: unknown[];\n }\n export interface TemplateUpdating {\n kind: 'template updating';\n template: Template | CompiledTemplate;\n instance: TemplateInstance;\n options: RenderOptions | undefined;\n parts: Array<Part | undefined>;\n values: unknown[];\n }\n export interface SetPartValue {\n kind: 'set part';\n part: Part;\n value: unknown;\n valueIndex: number;\n values: unknown[];\n templateInstance: TemplateInstance;\n }\n\n export type CommitPartEntry =\n | CommitNothingToChildEntry\n | CommitText\n | CommitNode\n | CommitAttribute\n | CommitProperty\n | CommitBooleanAttribute\n | CommitEventListener\n | CommitToElementBinding;\n\n export interface CommitNothingToChildEntry {\n kind: 'commit nothing to child';\n start: ChildNode;\n end: ChildNode | null;\n parent: Disconnectable | undefined;\n options: RenderOptions | undefined;\n }\n\n export interface CommitText {\n kind: 'commit text';\n node: Text;\n value: unknown;\n options: RenderOptions | undefined;\n }\n\n export interface CommitNode {\n kind: 'commit node';\n start: Node;\n parent: Disconnectable | undefined;\n value: Node;\n options: RenderOptions | undefined;\n }\n\n export interface CommitAttribute {\n kind: 'commit attribute';\n element: Element;\n name: string;\n value: unknown;\n options: RenderOptions | undefined;\n }\n\n export interface CommitProperty {\n kind: 'commit property';\n element: Element;\n name: string;\n value: unknown;\n options: RenderOptions | undefined;\n }\n\n export interface CommitBooleanAttribute {\n kind: 'commit boolean attribute';\n element: Element;\n name: string;\n value: boolean;\n options: RenderOptions | undefined;\n }\n\n export interface CommitEventListener {\n kind: 'commit event listener';\n element: Element;\n name: string;\n value: unknown;\n oldListener: unknown;\n options: RenderOptions | undefined;\n // True if we're removing the old event listener (e.g. because settings changed, or value is nothing)\n removeListener: boolean;\n // True if we're adding a new event listener (e.g. because first render, or settings changed)\n addListener: boolean;\n }\n\n export interface CommitToElementBinding {\n kind: 'commit to element binding';\n element: Element;\n value: unknown;\n options: RenderOptions | undefined;\n }\n }\n}\n\ninterface DebugLoggingWindow {\n // Even in dev mode, we generally don't want to emit these events, as that's\n // another level of cost, so only emit them when DEV_MODE is true _and_ when\n // window.emitLitDebugEvents is true.\n emitLitDebugLogEvents?: boolean;\n}\n\n/**\n * Useful for visualizing and logging insights into what the Lit template system is doing.\n *\n * Compiled out of prod mode builds.\n */\nconst debugLogEvent = DEV_MODE\n ? (event: LitUnstable.DebugLog.Entry) => {\n const shouldEmit = (global as unknown as DebugLoggingWindow)\n .emitLitDebugLogEvents;\n if (!shouldEmit) {\n return;\n }\n global.dispatchEvent(\n new CustomEvent<LitUnstable.DebugLog.Entry>('lit-debug', {\n detail: event,\n })\n );\n }\n : undefined;\n// Used for connecting beginRender and endRender events when there are nested\n// renders when errors are thrown preventing an endRender event from being\n// called.\nlet debugLogRenderId = 0;\n\nlet issueWarning: (code: string, warning: string) => void;\n\nif (DEV_MODE) {\n global.litIssuedWarnings ??= new Set();\n\n /**\n * Issue a warning if we haven't already, based either on `code` or `warning`.\n * Warnings are disabled automatically only by `warning`; disabling via `code`\n * can be done by users.\n */\n issueWarning = (code: string, warning: string) => {\n warning += code\n ? ` See https://lit.dev/msg/${code} for more information.`\n : '';\n if (\n !global.litIssuedWarnings!.has(warning) &&\n !global.litIssuedWarnings!.has(code)\n ) {\n console.warn(warning);\n global.litIssuedWarnings!.add(warning);\n }\n };\n\n queueMicrotask(() => {\n issueWarning(\n 'dev-mode',\n `Lit is in dev mode. Not recommended for production!`\n );\n });\n}\n\nconst wrap =\n ENABLE_SHADYDOM_NOPATCH &&\n global.ShadyDOM?.inUse &&\n global.ShadyDOM?.noPatch === true\n ? (global.ShadyDOM!.wrap as <T extends Node>(node: T) => T)\n : <T extends Node>(node: T) => node;\n\nconst trustedTypes = (global as unknown as TrustedTypesWindow).trustedTypes;\n\n/**\n * Our TrustedTypePolicy for HTML which is declared using the html template\n * tag function.\n *\n * That HTML is a developer-authored constant, and is parsed with innerHTML\n * before any untrusted expressions have been mixed in. Therefor it is\n * considered safe by construction.\n */\nconst policy = trustedTypes\n ? trustedTypes.createPolicy('lit-html', {\n createHTML: (s) => s,\n })\n : undefined;\n\n/**\n * Used to sanitize any value before it is written into the DOM. This can be\n * used to implement a security policy of allowed and disallowed values in\n * order to prevent XSS attacks.\n *\n * One way of using this callback would be to check attributes and properties\n * against a list of high risk fields, and require that values written to such\n * fields be instances of a class which is safe by construction. Closure's Safe\n * HTML Types is one implementation of this technique (\n * https://github.com/google/safe-html-types/blob/master/doc/safehtml-types.md).\n * The TrustedTypes polyfill in API-only mode could also be used as a basis\n * for this technique (https://github.com/WICG/trusted-types).\n *\n * @param node The HTML node (usually either a #text node or an Element) that\n * is being written to. Note that this is just an exemplar node, the write\n * may take place against another instance of the same class of node.\n * @param name The name of an attribute or property (for example, 'href').\n * @param type Indicates whether the write that's about to be performed will\n * be to a property or a node.\n * @return A function that will sanitize this class of writes.\n */\nexport type SanitizerFactory = (\n node: Node,\n name: string,\n type: 'property' | 'attribute'\n) => ValueSanitizer;\n\n/**\n * A function which can sanitize values that will be written to a specific kind\n * of DOM sink.\n *\n * See SanitizerFactory.\n *\n * @param value The value to sanitize. Will be the actual value passed into\n * the lit-html template literal, so this could be of any type.\n * @return The value to write to the DOM. Usually the same as the input value,\n * unless sanitization is needed.\n */\nexport type ValueSanitizer = (value: unknown) => unknown;\n\nconst identityFunction: ValueSanitizer = (value: unknown) => value;\nconst noopSanitizer: SanitizerFactory = (\n _node: Node,\n _name: string,\n _type: 'property' | 'attribute'\n) => identityFunction;\n\n/** Sets the global sanitizer factory. */\nconst setSanitizer = (newSanitizer: SanitizerFactory) => {\n if (!ENABLE_EXTRA_SECURITY_HOOKS) {\n return;\n }\n if (sanitizerFactoryInternal !== noopSanitizer) {\n throw new Error(\n `Attempted to overwrite existing lit-html security policy.` +\n ` setSanitizeDOMValueFactory should be called at most once.`\n );\n }\n sanitizerFactoryInternal = newSanitizer;\n};\n\n/**\n * Only used in internal tests, not a part of the public API.\n */\nconst _testOnlyClearSanitizerFactoryDoNotCallOrElse = () => {\n sanitizerFactoryInternal = noopSanitizer;\n};\n\nconst createSanitizer: SanitizerFactory = (node, name, type) => {\n return sanitizerFactoryInternal(node, name, type);\n};\n\n// Added to an attribute name to mark the attribute as bound so we can find\n// it easily.\nconst boundAttributeSuffix = '$lit$';\n\n// This marker is used in many syntactic positions in HTML, so it must be\n// a valid element name and attribute name. We don't support dynamic names (yet)\n// but this at least ensures that the parse tree is closer to the template\n// intention.\nconst marker = `lit$${Math.random().toFixed(9).slice(2)}$`;\n\n// String used to tell if a comment is a marker comment\nconst markerMatch = '?' + marker;\n\n// Text used to insert a comment marker node. We use processing instruction\n// syntax because it's slightly smaller, but parses as a comment node.\nconst nodeMarker = `<${markerMatch}>`;\n\nconst d =\n NODE_MODE && global.document === undefined\n ? ({\n createTreeWalker() {\n return {};\n },\n } as unknown as Document)\n : document;\n\n// Creates a dynamic marker. We never have to search for these in the DOM.\nconst createMarker = () => d.createComment('');\n\n// https://tc39.github.io/ecma262/#sec-typeof-operator\ntype Primitive = null | undefined | boolean | number | string | symbol | bigint;\nconst isPrimitive = (value: unknown): value is Primitive =>\n value === null || (typeof value != 'object' && typeof value != 'function');\nconst isArray = Array.isArray;\nconst isIterable = (value: unknown): value is Iterable<unknown> =>\n isArray(value) ||\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n typeof (value as any)?.[Symbol.iterator] === 'function';\n\nconst SPACE_CHAR = `[ \\t\\n\\f\\r]`;\nconst ATTR_VALUE_CHAR = `[^ \\t\\n\\f\\r\"'\\`<>=]`;\nconst NAME_CHAR = `[^\\\\s\"'>=/]`;\n\n// These regexes represent the five parsing states that we care about in the\n// Template's HTML scanner. They match the *end* of the state they're named\n// after.\n// Depending on the match, we transition to a new state. If there's no match,\n// we stay in the same state.\n// Note that the regexes are stateful. We utilize lastIndex and sync it\n// across the multiple regexes used. In addition to the five regexes below\n// we also dynamically create a regex to find the matching end tags for raw\n// text elements.\n\n/**\n * End of text is: `<` followed by:\n * (comment start) or (tag) or (dynamic tag binding)\n */\nconst textEndRegex = /<(?:(!--|\\/[^a-zA-Z])|(\\/?[a-zA-Z][^>\\s]*)|(\\/?$))/g;\nconst COMMENT_START = 1;\nconst TAG_NAME = 2;\nconst DYNAMIC_TAG_NAME = 3;\n\nconst commentEndRegex = /-->/g;\n/**\n * Comments not started with <!--, like </{, can be ended by a single `>`\n */\nconst comment2EndRegex = />/g;\n\n/**\n * The tagEnd regex matches the end of the \"inside an opening\" tag syntax\n * position. It either matches a `>`, an attribute-like sequence, or the end\n * of the string after a space (attribute-name position ending).\n *\n * See attributes in the HTML spec:\n * https://www.w3.org/TR/html5/syntax.html#elements-attributes\n *\n * \" \\t\\n\\f\\r\" are HTML space characters:\n * https://infra.spec.whatwg.org/#ascii-whitespace\n *\n * So an attribute is:\n * * The name: any character except a whitespace character, (\"), ('), \">\",\n * \"=\", or \"/\". Note: this is different from the HTML spec which also excludes control characters.\n * * Followed by zero or more space characters\n * * Followed by \"=\"\n * * Followed by zero or more space characters\n * * Followed by:\n * * Any character except space, ('), (\"), \"<\", \">\", \"=\", (`), or\n * * (\") then any non-(\"), or\n * * (') then any non-(')\n */\nconst tagEndRegex = new RegExp(\n `>|${SPACE_CHAR}(?:(${NAME_CHAR}+)(${SPACE_CHAR}*=${SPACE_CHAR}*(?:${ATTR_VALUE_CHAR}|(\"|')|))|$)`,\n 'g'\n);\nconst ENTIRE_MATCH = 0;\nconst ATTRIBUTE_NAME = 1;\nconst SPACES_AND_EQUALS = 2;\nconst QUOTE_CHAR = 3;\n\nconst singleQuoteAttrEndRegex = /'/g;\nconst doubleQuoteAttrEndRegex = /\"/g;\n/**\n * Matches the raw text elements.\n *\n * Comments are not parsed within raw text elements, so we need to search their\n * text content for marker strings.\n */\nconst rawTextElement = /^(?:script|style|textarea|title)$/i;\n\n/** TemplateResult types */\nconst HTML_RESULT = 1;\nconst SVG_RESULT = 2;\nconst MATHML_RESULT = 3;\n\ntype ResultType = typeof HTML_RESULT | typeof SVG_RESULT | typeof MATHML_RESULT;\n\n// TemplatePart types\n// IMPORTANT: these must match the values in PartType\nconst ATTRIBUTE_PART = 1;\nconst CHILD_PART = 2;\nconst PROPERTY_PART = 3;\nconst BOOLEAN_ATTRIBUTE_PART = 4;\nconst EVENT_PART = 5;\nconst ELEMENT_PART = 6;\nconst COMMENT_PART = 7;\n\n/**\n * The return type of the template tag functions, {@linkcode html} and\n * {@linkcode svg} when it hasn't been compiled by @lit-labs/compiler.\n *\n * A `TemplateResult` object holds all the information about a template\n * expression required to render it: the template strings, expression values,\n * and type of template (html or svg).\n *\n * `TemplateResult` objects do not create any DOM on their own. To create or\n * update DOM you need to render the `TemplateResult`. See\n * [Rendering](https://lit.dev/docs/components/rendering) for more information.\n *\n */\nexport type UncompiledTemplateResult<T extends ResultType = ResultType> = {\n // This property needs to remain unminified.\n ['_$litType$']: T;\n strings: TemplateStringsArray;\n values: unknown[];\n};\n\n/**\n * This is a template result that may be either uncompiled or compiled.\n *\n * In the future, TemplateResult will be this type. If you want to explicitly\n * note that a template result is potentially compiled, you can reference this\n * type and it will continue to behave the same through the next major version\n * of Lit. This can be useful for code that wants to prepare for the next\n * major version of Lit.\n */\nexport type MaybeCompiledTemplateResult<T extends ResultType = ResultType> =\n | UncompiledTemplateResult<T>\n | CompiledTemplateResult;\n\n/**\n * The return type of the template tag functions, {@linkcode html} and\n * {@linkcode svg}.\n *\n * A `TemplateResult` object holds all the information about a template\n * expression required to render it: the template strings, expression values,\n * and type of template (html or svg).\n *\n * `TemplateResult` objects do not create any DOM on their own. To create or\n * update DOM you need to render the `TemplateResult`. See\n * [Rendering](https://lit.dev/docs/components/rendering) for more information.\n *\n * In Lit 4, this type will be an alias of\n * MaybeCompiledTemplateResult, so that code will get type errors if it assumes\n * that Lit templates are not compiled. When deliberately working with only\n * one, use either {@linkcode CompiledTemplateResult} or\n * {@linkcode UncompiledTemplateResult} explicitly.\n */\nexport type TemplateResult<T extends ResultType = ResultType> =\n UncompiledTemplateResult<T>;\n\nexport type HTMLTemplateResult = TemplateResult<typeof HTML_RESULT>;\n\nexport type SVGTemplateResult = TemplateResult<typeof SVG_RESULT>;\n\nexport type MathMLTemplateResult = TemplateResult<typeof MATHML_RESULT>;\n\n/**\n * A TemplateResult that has been compiled by @lit-labs/compiler, skipping the\n * prepare step.\n */\nexport interface CompiledTemplateResult {\n // This is a factory in order to make template initialization lazy\n // and allow ShadyRenderOptions scope to be passed in.\n // This property needs to remain unminified.\n ['_$litType$']: CompiledTemplate;\n values: unknown[];\n}\n\nexport interface CompiledTemplate extends Omit<Template, 'el'> {\n // el is overridden to be optional. We initialize it on first render\n el?: HTMLTemplateElement;\n\n // The prepared HTML string to create a template element from.\n // The type is a TemplateStringsArray to guarantee that the value came from\n // source code, preventing a JSON injection attack.\n h: TemplateStringsArray;\n}\n\n/**\n * Generates a template literal tag function that returns a TemplateResult with\n * the given result type.\n */\nconst tag =\n <T extends ResultType>(type: T) =>\n (strings: TemplateStringsArray, ...values: unknown[]): TemplateResult<T> => {\n // Warn against templates octal escape sequences\n // We do this here rather than in render so that the warning is closer to the\n // template definition.\n if (DEV_MODE && strings.some((s) => s === undefined)) {\n console.warn(\n 'Some template strings are undefined.\\n' +\n 'This is probably caused by illegal octal escape sequences.'\n );\n }\n if (DEV_MODE) {\n // Import static-html.js results in a circular dependency which g3 doesn't\n // handle. Instead we know that static values must have the field\n // `_$litStatic$`.\n if (\n values.some((val) => (val as {_$litStatic$: unknown})?.['_$litStatic$'])\n ) {\n issueWarning(\n '',\n `Static values 'literal' or 'unsafeStatic' cannot be used as values to non-static templates.\\n` +\n `Please use the static 'html' tag function. See https://lit.dev/docs/templates/expressions/#static-expressions`\n );\n }\n }\n return {\n // This property needs to remain unminified.\n ['_$litType$']: type,\n strings,\n values,\n };\n };\n\n/**\n * Interprets a template literal as an HTML template that can efficiently\n * render to and update a container.\n *\n * ```ts\n * const header = (title: string) => html`<h1>${title}</h1>`;\n * ```\n *\n * The `html` tag returns a description of the DOM to render as a value. It is\n * lazy, meaning no work is done until the template is rendered. When rendering,\n * if a template comes from the same expression as a previously rendered result,\n * it's efficiently updated instead of replaced.\n */\nexport const html = tag(HTML_RESULT);\n\n/**\n * Interprets a template literal as an SVG fragment that can efficiently render\n * to and update a container.\n *\n * ```ts\n * const rect = svg`<rect width=\"10\" height=\"10\"></rect>`;\n *\n * const myImage = html`\n * <svg viewBox=\"0 0 10 10\" xmlns=\"http://www.w3.org/2000/svg\">\n * ${rect}\n * </svg>`;\n * ```\n *\n * The `svg` *tag function* should only be used for SVG fragments, or elements\n * that would be contained **inside** an `<svg>` HTML element. A common error is\n * placing an `<svg>` *element* in a template tagged with the `svg` tag\n * function. The `<svg>` element is an HTML element and should be used within a\n * template tagged with the {@linkcode html} tag function.\n *\n * In LitElement usage, it's invalid to return an SVG fragment from the\n * `render()` method, as the SVG fragment will be contained within the element's\n * shadow root and thus not be properly contained within an `<svg>` HTML\n * element.\n */\nexport const svg = tag(SVG_RESULT);\n\n/**\n * Interprets a template literal as MathML fragment that can efficiently render\n * to and update a container.\n *\n * ```ts\n * const num = mathml`<mn>1</mn>`;\n *\n * const eq = html`\n * <math>\n * ${num}\n * </math>`;\n * ```\n *\n * The `mathml` *tag function* should only be used for MathML fragments, or\n * elements that would be contained **inside** a `<math>` HTML element. A common\n * error is placing a `<math>` *element* in a template tagged with the `mathml`\n * tag function. The `<math>` element is an HTML element and should be used\n * within a template tagged with the {@linkcode html} tag function.\n *\n * In LitElement usage, it's invalid to return an MathML fragment from the\n * `render()` method, as the MathML fragment will be contained within the\n * element's shadow root and thus not be properly contained within a `<math>`\n * HTML element.\n */\nexport const mathml = tag(MATHML_RESULT);\n\n/**\n * A sentinel value that signals that a value was handled by a directive and\n * should not be written to the DOM.\n */\nexport const noChange = Symbol.for('lit-noChange');\n\n/**\n * A sentinel value that signals a ChildPart to fully clear its content.\n *\n * ```ts\n * const button = html`${\n * user.isAdmin\n * ? html`<button>DELETE</button>`\n * : nothing\n * }`;\n * ```\n *\n * Prefer using `nothing` over other falsy values as it provides a consistent\n * behavior between various expression binding contexts.\n *\n * In child expressions, `undefined`, `null`, `''`, and `nothing` all behave the\n * same and render no nodes. In attribute expressions, `nothing` _removes_ the\n * attribute, while `undefined` and `null` will render an empty string. In\n * property expressions `nothing` becomes `undefined`.\n */\nexport const nothing = Symbol.for('lit-nothing');\n\n/**\n * The cache of prepared templates, keyed by the tagged TemplateStringsArray\n * and _not_ accounting for the specific template tag used. This means that\n * template tags cannot be dynamic - they must statically be one of html, svg,\n * or attr. This restriction simplifies the cache lookup, which is on the hot\n * path for rendering.\n */\nconst templateCache = new WeakMap<TemplateStringsArray, Template>();\n\n/**\n * Object specifying options for controlling lit-html rendering. Note that\n * while `render` may be called multiple times on the same `container` (and\n * `renderBefore` reference node) to efficiently update the rendered content,\n * only the options passed in during the first render are respected during\n * the lifetime of renders to that unique `container` + `renderBefore`\n * combination.\n */\nexport interface RenderOptions {\n /**\n * An object to use as the `this` value for event listeners. It's often\n * useful to set this to the host component rendering a template.\n */\n host?: object;\n /**\n * A DOM node before which to render content in the container.\n */\n renderBefore?: ChildNode | null;\n /**\n * Node used for cloning the template (`importNode` will be called on this\n * node). This controls the `ownerDocument` of the rendered DOM, along with\n * any inherited context. Defaults to the global `document`.\n */\n creationScope?: {importNode(node: Node, deep?: boolean): Node};\n /**\n * The initial connected state for the top-level part being rendered. If no\n * `isConnected` option is set, `AsyncDirective`s will be connected by\n * default. Set to `false` if the initial render occurs in a disconnected tree\n * and `AsyncDirective`s should see `isConnected === false` for their initial\n * render. The `part.setConnected()` method must be used subsequent to initial\n * render to change the connected state of the part.\n */\n isConnected?: boolean;\n}\n\n/**\n * The root DOM node for rendering.\n */\nexport type RenderRootNode = HTMLElement | SVGElement | DocumentFragment;\n\nconst walker = d.createTreeWalker(\n d,\n 129 /* NodeFilter.SHOW_{ELEMENT|COMMENT} */\n);\n\nlet sanitizerFactoryInternal: SanitizerFactory = noopSanitizer;\n\n//\n// Classes only below here, const variable declarations only above here...\n//\n// Keeping variable declarations and classes together improves minification.\n// Interfaces and type aliases can be interleaved freely.\n//\n\n// Type for classes that have a `_directive` or `_directives[]` field, used by\n// `resolveDirective`\nexport interface DirectiveParent {\n _$parent?: DirectiveParent;\n _$isConnected: boolean;\n __directive?: Directive;\n __directives?: Array<Directive | undefined>;\n}\n\nfunction trustFromTemplateString(\n tsa: TemplateStringsArray,\n stringFromTSA: string\n): TrustedHTML {\n // A security check to prevent spoofing of Lit template results.\n // In the future, we may be able to replace this with Array.isTemplateObject,\n // though we might need to make that check inside of the html and svg\n // functions, because precompiled templates don't come in as\n // TemplateStringArray objects.\n if (!isArray(tsa) || !tsa.hasOwnProperty('raw')) {\n let message = 'invalid template strings array';\n if (DEV_MODE) {\n message = `\n Internal Error: expected template strings to be an array\n with a 'raw' field. Faking a template strings array by\n calling html or svg like an ordinary function is effectively\n the same as calling unsafeHtml and can lead to major security\n issues, e.g. opening your code up to XSS attacks.\n If you're using the html or svg tagged template functions normally\n and still seeing this error, please file a bug at\n https://github.com/lit/lit/issues/new?template=bug_report.md\n and include information about your build tooling, if any.\n `\n .trim()\n .replace(/\\n */g, '\\n');\n }\n throw new Error(message);\n }\n return policy !== undefined\n ? policy.createHTML(stringFromTSA)\n : (stringFromTSA as unknown as TrustedHTML);\n}\n\n/**\n * Returns an HTML string for the given TemplateStringsArray and result type\n * (HTML or SVG), along with the case-sensitive bound attribute names in\n * template order. The HTML contains comment markers denoting the `ChildPart`s\n * and suffixes on bound attributes denoting the `AttributeParts`.\n *\n * @param strings template strings array\n * @param type HTML or SVG\n * @return Array containing `[html, attrNames]` (array returned for terseness,\n * to avoid object fields since this code is shared with non-minified SSR\n * code)\n */\nconst getTemplateHtml = (\n strings: TemplateStringsArray,\n type: ResultType\n): [TrustedHTML, Array<string>] => {\n // Insert makers into the template HTML to represent the position of\n // bindings. The following code scans the template strings to determine the\n // syntactic position of the bindings. They can be in text position, where\n // we insert an HTML comment, attribute value position, where we insert a\n // sentinel string and re-write the attribute name, or inside a tag where\n // we insert the sentinel string.\n const l = strings.length - 1;\n // Stores the case-sensitive bound attribute names in the order of their\n // parts. ElementParts are also reflected in this array as undefined\n // rather than a string, to disambiguate from attribute bindings.\n const attrNames: Array<string> = [];\n let html =\n type === SVG_RESULT ? '<svg>' : type === MATHML_RESULT ? '<math>' : '';\n\n // When we're inside a raw text tag (not it's text content), the regex\n // will still be tagRegex so we can find attributes, but will switch to\n // this regex when the tag ends.\n let rawTextEndRegex: RegExp | undefined;\n\n // The current parsing state, represented as a reference to one of the\n // regexes\n let regex = textEndRegex;\n\n for (let i = 0; i < l; i++) {\n const s = strings[i];\n // The index of the end of the last attribute name. When this is\n // positive at end of a string, it means we're in an attribute value\n // position and need to rewrite the attribute name.\n // We also use a special value of -2 to indicate that we encountered\n // the end of a string in attribute name position.\n let attrNameEndIndex = -1;\n let attrName: string | undefined;\n let lastIndex = 0;\n let match!: RegExpExecArray | null;\n\n // The conditions in this loop handle the current parse state, and the\n // assignments to the `regex` variable are the state transitions.\n while (lastIndex < s.length) {\n // Make sure we start searching from where we previously left off\n regex.lastIndex = lastIndex;\n match = regex.exec(s);\n if (match === null) {\n break;\n }\n lastIndex = regex.lastIndex;\n if (regex === textEndRegex) {\n if (match[COMMENT_START] === '!--') {\n regex = commentEndRegex;\n } else if (match[COMMENT_START] !== undefined) {\n // We started a weird comment, like </{\n regex = comment2EndRegex;\n } else if (match[TAG_NAME] !== undefined) {\n if (rawTextElement.test(match[TAG_NAME])) {\n // Record if we encounter a raw-text element. We'll switch to\n // this regex at the end of the tag.\n rawTextEndRegex = new RegExp(`</${match[TAG_NAME]}`, 'g');\n }\n regex = tagEndRegex;\n } else if (match[DYNAMIC_TAG_NAME] !== undefined) {\n if (DEV_MODE) {\n throw new Error(\n 'Bindings in tag names are not supported. Please use static templates instead. ' +\n 'See https://lit.dev/docs/templates/expressions/#static-expressions'\n );\n }\n regex = tagEndRegex;\n }\n } else if (regex === tagEndRegex) {\n if (match[ENTIRE_MATCH] === '>') {\n // End of a tag. If we had started a raw-text element, use that\n // regex\n regex = rawTextEndRegex ?? textEndRegex;\n // We may be ending an unquoted attribute value, so make sure we\n // clear any pending attrNameEndIndex\n attrNameEndIndex = -1;\n } else if (match[ATTRIBUTE_NAME] === undefined) {\n // Attribute name position\n attrNameEndIndex = -2;\n } else {\n attrNameEndIndex = regex.lastIndex - match[SPACES_AND_EQUALS].length;\n attrName = match[ATTRIBUTE_NAME];\n regex =\n match[QUOTE_CHAR] === undefined\n ? tagEndRegex\n : match[QUOTE_CHAR] === '\"'\n ? doubleQuoteAttrEndRegex\n : singleQuoteAttrEndRegex;\n }\n } else if (\n regex === doubleQuoteAttrEndRegex ||\n regex === singleQuoteAttrEndRegex\n ) {\n regex = tagEndRegex;\n } else if (regex === commentEndRegex || regex === comment2EndRegex) {\n regex = textEndRegex;\n } else {\n // Not one of the five state regexes, so it must be the dynamically\n // created raw text regex and we're at the close of that element.\n regex = tagEndRegex;\n rawTextEndRegex = undefined;\n }\n }\n\n if (DEV_MODE) {\n // If we have a attrNameEndIndex, which indicates that we should\n // rewrite the attribute name, assert that we're in a valid attribute\n // position - either in a tag, or a quoted attribute value.\n console.assert(\n attrNameEndIndex === -1 ||\n regex === tagEndRegex ||\n regex === singleQuoteAttrEndRegex ||\n regex === doubleQuoteAttrEndRegex,\n 'unexpected parse state B'\n );\n }\n\n // We have four cases:\n // 1. We're in text position, and not in a raw text element\n // (regex === textEndRegex): insert a comment marker.\n // 2. We have a non-negative attrNameEndIndex which means we need to\n // rewrite the attribute name to add a bound attribute suffix.\n // 3. We're at the non-first binding in a multi-binding attribute, use a\n // plain marker.\n // 4. We're somewhere else inside the tag. If we're in attribute name\n // position (attrNameEndIndex === -2), add a sequential suffix to\n // generate a unique attribute name.\n\n // Detect a binding next to self-closing tag end and insert a space to\n // separate the marker from the tag end:\n const end =\n regex === tagEndRegex && strings[i + 1].startsWith('/>') ? ' ' : '';\n html +=\n regex === textEndRegex\n ? s + nodeMarker\n : attrNameEndIndex >= 0\n ? (attrNames.push(attrName!),\n s.slice(0, attrNameEndIndex) +\n boundAttributeSuffix +\n s.slice(attrNameEndIndex)) +\n marker +\n end\n : s + marker + (attrNameEndIndex === -2 ? i : end);\n }\n\n const htmlResult: string | TrustedHTML =\n html +\n (strings[l] || '<?>') +\n (type === SVG_RESULT ? '</svg>' : type === MATHML_RESULT ? '</math>' : '');\n\n // Returned as an array for terseness\n return [trustFromTemplateString(strings, htmlResult), attrNames];\n};\n\n/** @internal */\nexport type {Template};\nclass Template {\n /** @internal */\n el!: HTMLTemplateElement;\n\n parts: Array<TemplatePart> = [];\n\n constructor(\n // This property needs to remain unminified.\n {strings, ['_$litType$']: type}: UncompiledTemplateResult,\n options?: RenderOptions\n ) {\n let node: Node | null;\n let nodeIndex = 0;\n let attrNameIndex = 0;\n const partCount = strings.length - 1;\n const parts = this.parts;\n\n // Create template element\n const [html, attrNames] = getTemplateHtml(strings, type);\n this.el = Template.createElement(html, options);\n walker.currentNode = this.el.content;\n\n // Re-parent SVG or MathML nodes into template root\n if (type === SVG_RESULT || type === MATHML_RESULT) {\n const wrapper = this.el.content.firstChild!;\n wrapper.replaceWith(...wrapper.childNodes);\n }\n\n // Walk the template to find binding markers and create TemplateParts\n while ((node = walker.nextNode()) !== null && parts.length < partCount) {\n if (node.nodeType === 1) {\n if (DEV_MODE) {\n const tag = (node as Element).localName;\n // Warn if `textarea` includes an expression and throw if `template`\n // does since these are not supported. We do this by checking\n // innerHTML for anything that looks like a marker. This catches\n // cases like bindings in textarea there markers turn into text nodes.\n if (\n /^(?:textarea|template)$/i!.test(tag) &&\n (node as Element).innerHTML.includes(marker)\n ) {\n const m =\n `Expressions are not supported inside \\`${tag}\\` ` +\n `elements. See https://lit.dev/msg/expression-in-${tag} for more ` +\n `information.`;\n if (tag === 'template') {\n throw new Error(m);\n } else issueWarning('', m);\n }\n }\n // TODO (justinfagnani): for attempted dynamic tag names, we don't\n // increment the bindingIndex, and it'll be off by 1 in the element\n // and off by two after it.\n if ((node as Element).hasAttributes()) {\n for (const name of (node as Element).getAttributeNames()) {\n if (name.endsWith(boundAttributeSuffix)) {\n const realName = attrNames[attrNameIndex++];\n const value = (node as Element).getAttribute(name)!;\n const statics = value.split(marker);\n const m = /([.?@])?(.*)/.exec(realName)!;\n parts.push({\n type: ATTRIBUTE_PART,\n index: nodeIndex,\n name: m[2],\n strings: statics,\n ctor:\n m[1] === '.'\n ? PropertyPart\n : m[1] === '?'\n ? BooleanAttributePart\n : m[1] === '@'\n ? EventPart\n : AttributePart,\n });\n (node as Element).removeAttribute(name);\n } else if (name.startsWith(marker)) {\n parts.push({\n type: ELEMENT_PART,\n index: nodeIndex,\n });\n (node as Element).removeAttribute(name);\n }\n }\n }\n // TODO (justinfagnani): benchmark the regex against testing for each\n // of the 3 raw text element names.\n if (rawTextElement.test((node as Element).tagName)) {\n // For raw text elements we need to split the text content on\n // markers, create a Text node for each segment, and create\n // a TemplatePart for each marker.\n const strings = (node as Element).textContent!.split(marker);\n const lastIndex = strings.length - 1;\n if (lastIndex > 0) {\n (node as Element).textContent = trustedTypes\n ? (trustedTypes.emptyScript as unknown as '')\n : '';\n // Generate a new text node for each literal section\n // These nodes are also used as the markers for child parts\n for (let i = 0; i < lastIndex; i++) {\n (node as Element).append(strings[i], createMarker());\n // Walk past the marker node we just added\n walker.nextNode();\n parts.push({type: CHILD_PART, index: ++nodeIndex});\n }\n // Note because this marker is added after the walker's current\n // node, it will be walked to in the outer loop (and ignored), so\n // we don't need to adjust nodeIndex here\n (node as Element).append(strings[lastIndex], createMarker());\n }\n }\n } else if (node.nodeType === 8) {\n const data = (node as Comment).data;\n if (data === markerMatch) {\n parts.push({type: CHILD_PART, index: nodeIndex});\n } else {\n let i = -1;\n while ((i = (node as Comment).data.indexOf(marker, i + 1)) !== -1) {\n // Comment node has a binding marker inside, make an inactive part\n // The binding won't work, but subsequent bindings will\n parts.push({type: COMMENT_PART, index: nodeIndex});\n // Move to the end of the match\n i += marker.length - 1;\n }\n }\n }\n nodeIndex++;\n }\n\n if (DEV_MODE) {\n // If there was a duplicate attribute on a tag, then when the tag is\n // parsed into an element the attribute gets de-duplicated. We can detect\n // this mismatch if we haven't precisely consumed every attribute name\n // when preparing the template. This works because `attrNames` is built\n // from the template string and `attrNameIndex` comes from processing the\n // resulting DOM.\n if (attrNames.length !== attrNameIndex) {\n throw new Error(\n `Detected duplicate attribute bindings. This occurs if your template ` +\n `has duplicate attributes on an element tag. For example ` +\n `\"<input ?disabled=\\${true} ?disabled=\\${false}>\" contains a ` +\n `duplicate \"disabled\" attribute. The error was detected in ` +\n `the following template: \\n` +\n '`' +\n strings.join('${...}') +\n '`'\n );\n }\n }\n\n // We could set walker.currentNode to another node here to prevent a memory\n // leak, but every time we prepare a template, we immediately render it\n // and re-use the walker in new TemplateInstance._clone().\n debugLogEvent &&\n debugLogEvent({\n kind: 'template prep',\n template: this,\n clonableTemplate: this.el,\n parts: this.parts,\n strings,\n });\n }\n\n // Overridden via `litHtmlPolyfillSupport` to provide platform support.\n /** @nocollapse */\n static createElement(html: TrustedHTML, _options?: RenderOptions) {\n const el = d.createElement('template');\n el.innerHTML = html as unknown as string;\n return el;\n }\n}\n\nexport interface Disconnectable {\n _$parent?: Disconnectable;\n _$disconnectableChildren?: Set<Disconnectable>;\n // Rather than hold connection state on instances, Disconnectables recursively\n // fetch the connection state from the RootPart they are connected in via\n // getters up the Disconnectable tree via _$parent references. This pushes the\n // cost of tracking the isConnected state to `AsyncDirectives`, and avoids\n // needing to pass all Disconnectables (parts, template instances, and\n // directives) their connection state each time it changes, which would be\n // costly for trees that have no AsyncDirectives.\n _$isConnected: boolean;\n}\n\nfunction resolveDirective(\n part: ChildPart | AttributePart | ElementPart,\n value: unknown,\n parent: DirectiveParent = part,\n attributeIndex?: number\n): unknown {\n // Bail early if the value is explicitly noChange. Note, this means any\n // nested directive is still attached and is not run.\n if (value === noChange) {\n return value;\n }\n let currentDirective =\n attributeIndex !== undefined\n ? (parent as AttributePart).__directives?.[attributeIndex]\n : (parent as ChildPart | ElementPart | Directive).__directive;\n const nextDirectiveConstructor = isPrimitive(value)\n ? undefined\n : // This property needs to remain unminified.\n (value as DirectiveResult)['_$litDirective$'];\n if (currentDirective?.constructor !== nextDirectiveConstructor) {\n // This property needs to remain unminified.\n currentDirective?.['_$notifyDirectiveConnectionChanged']?.(false);\n if (nextDirectiveConstructor === undefined) {\n currentDirective = undefined;\n } else {\n currentDirective = new nextDirectiveConstructor(part as PartInfo);\n currentDirective._$initialize(part, parent, attributeIndex);\n }\n if (attributeIndex !== undefined) {\n ((parent as AttributePart).__directives ??= [])[attributeIndex] =\n currentDirective;\n } else {\n (parent as ChildPart | Directive).__directive = currentDirective;\n }\n }\n if (currentDirective !== undefined) {\n value = resolveDirective(\n part,\n currentDirective._$resolve(part, (value as DirectiveResult).values),\n currentDirective,\n attributeIndex\n );\n }\n return value;\n}\n\nexport type {TemplateInstance};\n/**\n * An updateable instance of a Template. Holds references to the Parts used to\n * update the template instance.\n */\nclass TemplateInstance implements Disconnectable {\n _$template: Template;\n _$parts: Array<Part | undefined> = [];\n\n /** @internal */\n _$parent: ChildPart;\n /** @internal */\n _$disconnectableChildren?: Set<Disconnectable> = undefined;\n\n constructor(template: Template, parent: ChildPart) {\n this._$template = template;\n this._$parent = parent;\n }\n\n // Called by ChildPart parentNode getter\n get parentNode() {\n return this._$parent.parentNode;\n }\n\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n\n // This method is separate from the constructor because we need to return a\n // DocumentFragment and we don't want to hold onto it with an instance field.\n _clone(options: RenderOptions | undefined) {\n const {\n el: {content},\n parts: parts,\n } = this._$template;\n const fragment = (options?.creationScope ?? d).importNode(content, true);\n walker.currentNode = fragment;\n\n let node = walker.nextNode()!;\n let nodeIndex = 0;\n let partIndex = 0;\n let templatePart = parts[0];\n\n while (templatePart !== undefined) {\n if (nodeIndex === templatePart.index) {\n let part: Part | undefined;\n if (templatePart.type === CHILD_PART) {\n part = new ChildPart(\n node as HTMLElement,\n node.nextSibling,\n this,\n options\n );\n } else if (templatePart.type === ATTRIBUTE_PART) {\n part = new templatePart.ctor(\n node as HTMLElement,\n templatePart.name,\n templatePart.strings,\n this,\n options\n );\n } else if (templatePart.type === ELEMENT_PART) {\n part = new ElementPart(node as HTMLElement, this, options);\n }\n this._$parts.push(part);\n templatePart = parts[++partIndex];\n }\n if (nodeIndex !== templatePart?.index) {\n node = walker.nextNode()!;\n nodeIndex++;\n }\n }\n // We need to set the currentNode away from the cloned tree so that we\n // don't hold onto the tree even if the tree is detached and should be\n // freed.\n walker.currentNode = d;\n return fragment;\n }\n\n _update(values: Array<unknown>) {\n let i = 0;\n for (const part of this._$parts) {\n if (part !== undefined) {\n debugLogEvent &&\n debugLogEvent({\n kind: 'set part',\n part,\n value: values[i],\n valueIndex: i,\n values,\n templateInstance: this,\n });\n if ((part as AttributePart).strings !== undefined) {\n (part as AttributePart)._$setValue(values, part as AttributePart, i);\n // The number of values the part consumes is part.strings.length - 1\n // since values are in between template spans. We increment i by 1\n // later in the loop, so increment it by part.strings.length - 2 here\n i += (part as AttributePart).strings!.length - 2;\n } else {\n part._$setValue(values[i]);\n }\n }\n i++;\n }\n }\n}\n\n/*\n * Parts\n */\ntype AttributeTemplatePart = {\n readonly type: typeof ATTRIBUTE_PART;\n readonly index: number;\n readonly name: string;\n readonly ctor: typeof AttributePart;\n readonly strings: ReadonlyArray<string>;\n};\ntype ChildTemplatePart = {\n readonly type: typeof CHILD_PART;\n readonly index: number;\n};\ntype ElementTemplatePart = {\n readonly type: typeof ELEMENT_PART;\n readonly index: number;\n};\ntype CommentTemplatePart = {\n readonly type: typeof COMMENT_PART;\n readonly index: number;\n};\n\n/**\n * A TemplatePart represents a dynamic part in a template, before the template\n * is instantiated. When a template is instantiated Parts are created from\n * TemplateParts.\n */\ntype TemplatePart =\n | ChildTemplatePart\n | AttributeTemplatePart\n | ElementTemplatePart\n | CommentTemplatePart;\n\nexport type Part =\n | ChildPart\n | AttributePart\n | PropertyPart\n | BooleanAttributePart\n | ElementPart\n | EventPart;\n\nexport type {ChildPart};\nclass ChildPart implements Disconnectable {\n readonly type = CHILD_PART;\n readonly options: RenderOptions | undefined;\n _$committedValue: unknown = nothing;\n /** @internal */\n __directive?: Directive;\n /** @internal */\n _$startNode: ChildNode;\n /** @internal */\n _$endNode: ChildNode | null;\n private _textSanitizer: ValueSanitizer | undefined;\n /** @internal */\n _$parent: Disconnectable | undefined;\n /**\n * Connection state for RootParts only (i.e. ChildPart without _$parent\n * returned from top-level `render`). This field is unused otherwise. The\n * intention would be clearer if we made `RootPart` a subclass of `ChildPart`\n * with this field (and a different _$isConnected getter), but the subclass\n * caused a perf regression, possibly due to making call sites polymorphic.\n * @internal\n */\n __isConnected: boolean;\n\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n // ChildParts that are not at the root should always be created with a\n // parent; only RootChildNode's won't, so they return the local isConnected\n // state\n return this._$parent?._$isConnected ?? this.__isConnected;\n }\n\n // The following fields will be patched onto ChildParts when required by\n // AsyncDirective\n /** @internal */\n _$disconnectableChildren?: Set<Disconnectable> = undefined;\n /** @internal */\n _$notifyConnectionChanged?(\n isConnected: boolean,\n removeFromParent?: boolean,\n from?: number\n ): void;\n /** @internal */\n _$reparentDisconnectables?(parent: Disconnectable): void;\n\n constructor(\n startNode: ChildNode,\n endNode: ChildNode | null,\n parent: TemplateInstance | ChildPart | undefined,\n options: RenderOptions | undefined\n ) {\n this._$startNode = startNode;\n this._$endNode = endNode;\n this._$parent = parent;\n this.options = options;\n // Note __isConnected is only ever accessed on RootParts (i.e. when there is\n // no _$parent); the value on a non-root-part is \"don't care\", but checking\n // for parent would be more code\n this.__isConnected = options?.isConnected ?? true;\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n // Explicitly initialize for consistent class shape.\n this._textSanitizer = undefined;\n }\n }\n\n /**\n * The parent node into which the part renders its content.\n *\n * A ChildPart's content consists of a range of adjacent child nodes of\n * `.parentNode`, possibly bordered by 'marker nodes' (`.startNode` and\n * `.endNode`).\n *\n * - If both `.startNode` and `.endNode` are non-null, then the part's content\n * consists of all siblings between `.startNode` and `.endNode`, exclusively.\n *\n * - If `.startNode` is non-null but `.endNode` is null, then the part's\n * content consists of all siblings following `.startNode`, up to and\n * including the last child of `.parentNode`. If `.endNode` is non-null, then\n * `.startNode` will always be non-null.\n *\n * - If both `.endNode` and `.startNode` are null, then the part's content\n * consists of all child nodes of `.parentNode`.\n */\n get parentNode(): Node {\n let parentNode: Node = wrap(this._$startNode).parentNode!;\n const parent = this._$parent;\n if (\n parent !== undefined &&\n parentNode?.nodeType === 11 /* Node.DOCUMENT_FRAGMENT */\n ) {\n // If the parentNode is a DocumentFragment, it may be because the DOM is\n // still in the cloned fragment during initial render; if so, get the real\n // parentNode the part will be committed into by asking the parent.\n parentNode = (parent as ChildPart | TemplateInstance).parentNode;\n }\n return parentNode;\n }\n\n /**\n * The part's leading marker node, if any. See `.parentNode` for more\n * information.\n */\n get startNode(): Node | null {\n return this._$startNode;\n }\n\n /**\n * The part's trailing marker node, if any. See `.parentNode` for more\n * information.\n */\n get endNode(): Node | null {\n return this._$endNode;\n }\n\n _$setValue(value: unknown, directiveParent: DirectiveParent = this): void {\n if (DEV_MODE && this.parentNode === null) {\n throw new Error(\n `This \\`ChildPart\\` has no \\`parentNode\\` and therefore cannot accept a value. This likely means the element containing the part was manipulated in an unsupported way outside of Lit's control such that the part's marker nodes were ejected from DOM. For example, setting the element's \\`innerHTML\\` or \\`textContent\\` can do this.`\n );\n }\n value = resolveDirective(this, value, directiveParent);\n if (isPrimitive(value)) {\n // Non-rendering child values. It's important that these do not render\n // empty text nodes to avoid issues with preventing default <slot>\n // fallback content.\n if (value === nothing || value == null || value === '') {\n if (this._$committedValue !== nothing) {\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit nothing to child',\n start: this._$startNode,\n end: this._$endNode,\n parent: this._$parent,\n options: this.options,\n });\n this._$clear();\n }\n this._$committedValue = nothing;\n } else if (value !== this._$committedValue && value !== noChange) {\n this._commitText(value);\n }\n // This property needs to remain unminified.\n } else if ((value as TemplateResult)['_$litType$'] !== undefined) {\n this._commitTemplateResult(value as TemplateResult);\n } else if ((value as Node).nodeType !== undefined) {\n if (DEV_MODE && this.options?.host === value) {\n this._commitText(\n `[probable mistake: rendered a template's host in itself ` +\n `(commonly caused by writing \\${this} in a template]`\n );\n console.warn(\n `Attempted to render the template host`,\n value,\n `inside itself. This is almost always a mistake, and in dev mode `,\n `we render some warning text. In production however, we'll `,\n `render it, which will usually result in an error, and sometimes `,\n `in the element disappearing from the DOM.`\n );\n return;\n }\n this._commitNode(value as Node);\n } else if (isIterable(value)) {\n this._commitIterable(value);\n } else {\n // Fallback, will render the string representation\n this._commitText(value);\n }\n }\n\n private _insert<T extends Node>(node: T) {\n return wrap(wrap(this._$startNode).parentNode!).insertBefore(\n node,\n this._$endNode\n );\n }\n\n private _commitNode(value: Node): void {\n if (this._$committedValue !== value) {\n this._$clear();\n if (\n ENABLE_EXTRA_SECURITY_HOOKS &&\n sanitizerFactoryInternal !== noopSanitizer\n ) {\n const parentNodeName = this._$startNode.parentNode?.nodeName;\n if (parentNodeName === 'STYLE' || parentNodeName === 'SCRIPT') {\n let message = 'Forbidden';\n if (DEV_MODE) {\n if (parentNodeName === 'STYLE') {\n message =\n `Lit does not support binding inside style nodes. ` +\n `This is a security risk, as style injection attacks can ` +\n `exfiltrate data and spoof UIs. ` +\n `Consider instead using css\\`...\\` literals ` +\n `to compose styles, and do dynamic styling with ` +\n `css custom properties, ::parts, <slot>s, ` +\n `and by mutating the DOM rather than stylesheets.`;\n } else {\n message =\n `Lit does not support binding inside script nodes. ` +\n `This is a security risk, as it could allow arbitrary ` +\n `code execution.`;\n }\n }\n throw new Error(message);\n }\n }\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit node',\n start: this._$startNode,\n parent: this._$parent,\n value: value,\n options: this.options,\n });\n this._$committedValue = this._insert(value);\n }\n }\n\n private _commitText(value: unknown): void {\n // If the committed value is a primitive it means we called _commitText on\n // the previous render, and we know that this._$startNode.nextSibling is a\n // Text node. We can now just replace the text content (.data) of the node.\n if (\n this._$committedValue !== nothing &&\n isPrimitive(this._$committedValue)\n ) {\n const node = wrap(this._$startNode).nextSibling as Text;\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n if (this._textSanitizer === undefined) {\n this._textSanitizer = createSanitizer(node, 'data', 'property');\n }\n value = this._textSanitizer(value);\n }\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit text',\n node,\n value,\n options: this.options,\n });\n (node as Text).data = value as string;\n } else {\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n const textNode = d.createTextNode('');\n this._commitNode(textNode);\n // When setting text content, for security purposes it matters a lot\n // what the parent is. For example, <style> and <script> need to be\n // handled with care, while <span> does not. So first we need to put a\n // text node into the document, then we can sanitize its content.\n if (this._textSanitizer === undefined) {\n this._textSanitizer = createSanitizer(textNode, 'data', 'property');\n }\n value = this._textSanitizer(value);\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit text',\n node: textNode,\n value,\n options: this.options,\n });\n textNode.data = value as string;\n } else {\n this._commitNode(d.createTextNode(value as string));\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit text',\n node: wrap(this._$startNode).nextSibling as Text,\n value,\n options: this.options,\n });\n }\n }\n this._$committedValue = value;\n }\n\n private _commitTemplateResult(\n result: TemplateResult | CompiledTemplateResult\n ): void {\n // This property needs to remain unminified.\n const {values, ['_$litType$']: type} = result;\n // If $litType$ is a number, result is a plain TemplateResult and we get\n // the template from the template cache. If not, result is a\n // CompiledTemplateResult and _$litType$ is a CompiledTemplate and we need\n // to create the <template> element the first time we see it.\n const template: Template | CompiledTemplate =\n typeof type === 'number'\n ? this._$getTemplate(result as UncompiledTemplateResult)\n : (type.el === undefined &&\n (type.el = Template.createElement(\n trustFromTemplateString(type.h, type.h[0]),\n this.options\n )),\n type);\n\n if ((this._$committedValue as TemplateInstance)?._$template === template) {\n debugLogEvent &&\n debugLogEvent({\n kind: 'template updating',\n template,\n instance: this._$committedValue as TemplateInstance,\n parts: (this._$committedValue as TemplateInstance)._$parts,\n options: this.options,\n values,\n });\n (this._$committedValue as TemplateInstance)._update(values);\n } else {\n const instance = new TemplateInstance(template as Template, this);\n const fragment = instance._clone(this.options);\n debugLogEvent &&\n debugLogEvent({\n kind: 'template instantiated',\n template,\n instance,\n parts: instance._$parts,\n options: this.options,\n fragment,\n values,\n });\n instance._update(values);\n debugLogEvent &&\n debugLogEvent({\n kind: 'template instantiated and updated',\n template,\n instance,\n parts: instance._$parts,\n options: this.options,\n fragment,\n values,\n });\n this._commitNode(fragment);\n this._$committedValue = instance;\n }\n }\n\n // Overridden via `litHtmlPolyfillSupport` to provide platform support.\n /** @internal */\n _$getTemplate(result: UncompiledTemplateResult) {\n let template = templateCache.get(result.strings);\n if (template === undefined) {\n templateCache.set(result.strings, (template = new Template(result)));\n }\n return template;\n }\n\n private _commitIterable(value: Iterable<unknown>): void {\n // For an Iterable, we create a new InstancePart per item, then set its\n // value to the item. This is a little bit of overhead for every item in\n // an Iterable, but it lets us recurse easily and efficiently update Arrays\n // of TemplateResults that will be commonly returned from expressions like:\n // array.map((i) => html`${i}`), by reusing existing TemplateInstances.\n\n // If value is an array, then the previous render was of an\n // iterable and value will contain the ChildParts from the previous\n // render. If value is not an array, clear this part and make a new\n // array for ChildParts.\n if (!isArray(this._$committedValue)) {\n this._$committedValue = [];\n this._$clear();\n }\n\n // Lets us keep track of how many items we stamped so we can clear leftover\n // items from a previous render\n const itemParts = this._$committedValue as ChildPart[];\n let partIndex = 0;\n let itemPart: ChildPart | undefined;\n\n for (const item of value) {\n if (partIndex === itemParts.length) {\n // If no existing part, create a new one\n // TODO (justinfagnani): test perf impact of always creating two parts\n // instead of sharing parts between nodes\n // https://github.com/lit/lit/issues/1266\n itemParts.push(\n (itemPart = new ChildPart(\n this._insert(createMarker()),\n this._insert(createMarker()),\n this,\n this.options\n ))\n );\n } else {\n // Reuse an existing part\n itemPart = itemParts[partIndex];\n }\n itemPart._$setValue(item);\n partIndex++;\n }\n\n if (partIndex < itemParts.length) {\n // itemParts always have end nodes\n this._$clear(\n itemPart && wrap(itemPart._$endNode!).nextSibling,\n partIndex\n );\n // Truncate the parts array so _value reflects the current state\n itemParts.length = partIndex;\n }\n }\n\n /**\n * Removes the nodes contained within this Part from the DOM.\n *\n * @param start Start node to clear from, for clearing a subset of the part's\n * DOM (used when truncating iterables)\n * @param from When `start` is specified, the index within the iterable from\n * which ChildParts are being removed, used for disconnecting directives\n * in those Parts.\n *\n * @internal\n */\n _$clear(\n start: ChildNode | null = wrap(this._$startNode).nextSibling,\n from?: number\n ) {\n this._$notifyConnectionChanged?.(false, true, from);\n while (start !== this._$endNode) {\n // The non-null assertion is safe because if _$startNode.nextSibling is\n // null, then _$endNode is also null, and we would not have entered this\n // loop.\n const n = wrap(start!).nextSibling;\n wrap(start!).remove();\n start = n;\n }\n }\n\n /**\n * Implementation of RootPart's `isConnected`. Note that this method\n * should only be called on `RootPart`s (the `ChildPart` returned from a\n * top-level `render()` call). It has no effect on non-root ChildParts.\n * @param isConnected Whether to set\n * @internal\n */\n setConnected(isConnected: boolean) {\n if (this._$parent === undefined) {\n this.__isConnected = isConnected;\n this._$notifyConnectionChanged?.(isConnected);\n } else if (DEV_MODE) {\n throw new Error(\n 'part.setConnected() may only be called on a ' +\n 'RootPart returned from render().'\n );\n }\n }\n}\n\n/**\n * A top-level `ChildPart` returned from `render` that manages the connected\n * state of `AsyncDirective`s created throughout the tree below it.\n */\nexport interface RootPart extends ChildPart {\n /**\n * Sets the connection state for `AsyncDirective`s contained within this root\n * ChildPart.\n *\n * lit-html does not automatically monitor the connectedness of DOM rendered;\n * as such, it is the responsibility of the caller to `render` to ensure that\n * `part.setConnected(false)` is called before the part object is potentially\n * discarded, to ensure that `AsyncDirective`s have a chance to dispose of\n * any resources being held. If a `RootPart` that was previously\n * disconnected is subsequently re-connected (and its `AsyncDirective`s should\n * re-connect), `setConnected(true)` should be called.\n *\n * @param isConnected Whether directives within this tree should be connected\n * or not\n */\n setConnected(isConnected: boolean): void;\n}\n\nexport type {AttributePart};\nclass AttributePart implements Disconnectable {\n readonly type:\n | typeof ATTRIBUTE_PART\n | typeof PROPERTY_PART\n | typeof BOOLEAN_ATTRIBUTE_PART\n | typeof EVENT_PART = ATTRIBUTE_PART;\n readonly element: HTMLElement;\n readonly name: string;\n readonly options: RenderOptions | undefined;\n\n /**\n * If this attribute part represents an interpolation, this contains the\n * static strings of the interpolation. For single-value, complete bindings,\n * this is undefined.\n */\n readonly strings?: ReadonlyArray<string>;\n /** @internal */\n _$committedValue: unknown | Array<unknown> = nothing;\n /** @internal */\n __directives?: Array<Directive | undefined>;\n /** @internal */\n _$parent: Disconnectable;\n /** @internal */\n _$disconnectableChildren?: Set<Disconnectable> = undefined;\n\n protected _sanitizer: ValueSanitizer | undefined;\n\n get tagName() {\n return this.element.tagName;\n }\n\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n\n constructor(\n element: HTMLElement,\n name: string,\n strings: ReadonlyArray<string>,\n parent: Disconnectable,\n options: RenderOptions | undefined\n ) {\n this.element = element;\n this.name = name;\n this._$parent = parent;\n this.options = options;\n if (strings.length > 2 || strings[0] !== '' || strings[1] !== '') {\n this._$committedValue = new Array(strings.length - 1).fill(new String());\n this.strings = strings;\n } else {\n this._$committedValue = nothing;\n }\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n this._sanitizer = undefined;\n }\n }\n\n /**\n * Sets the value of this part by resolving the value from possibly multiple\n * values and static strings and committing it to the DOM.\n * If this part is single-valued, `this._strings` will be undefined, and the\n * method will be called with a single value argument. If this part is\n * multi-value, `this._strings` will be defined, and the method is called\n * with the value array of the part's owning TemplateInstance, and an offset\n * into the value array from which the values should be read.\n * This method is overloaded this way to eliminate short-lived array slices\n * of the template instance values, and allow a fast-path for single-valued\n * parts.\n *\n * @param value The part value, or an array of values for multi-valued parts\n * @param valueIndex the index to start reading values from. `undefined` for\n * single-valued parts\n * @param noCommit causes the part to not commit its value to the DOM. Used\n * in hydration to prime attribute parts with their first-rendered value,\n * but not set the attribute, and in SSR to no-op the DOM operation and\n * capture the value for serialization.\n *\n * @internal\n */\n _$setValue(\n value: unknown | Array<unknown>,\n directiveParent: DirectiveParent = this,\n valueIndex?: number,\n noCommit?: boolean\n ) {\n const strings = this.strings;\n\n // Whether any of the values has changed, for dirty-checking\n let change = false;\n\n if (strings === undefined) {\n // Single-value binding case\n value = resolveDirective(this, value, directiveParent, 0);\n change =\n !isPrimitive(value) ||\n (value !== this._$committedValue && value !== noChange);\n if (change) {\n this._$committedValue = value;\n }\n } else {\n // Interpolation case\n const values = value as Array<unknown>;\n value = strings[0];\n\n let i, v;\n for (i = 0; i < strings.length - 1; i++) {\n v = resolveDirective(this, values[valueIndex! + i], directiveParent, i);\n\n if (v === noChange) {\n // If the user-provided value is `noChange`, use the previous value\n v = (this._$committedValue as Array<unknown>)[i];\n }\n change ||=\n !isPrimitive(v) || v !== (this._$committedValue as Array<unknown>)[i];\n if (v === nothing) {\n value = nothing;\n } else if (value !== nothing) {\n value += (v ?? '') + strings[i + 1];\n }\n // We always record each value, even if one is `nothing`, for future\n // change detection.\n (this._$committedValue as Array<unknown>)[i] = v;\n }\n }\n if (change && !noCommit) {\n this._commitValue(value);\n }\n }\n\n /** @internal */\n _commitValue(value: unknown) {\n if (value === nothing) {\n (wrap(this.element) as Element).removeAttribute(this.name);\n } else {\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n if (this._sanitizer === undefined) {\n this._sanitizer = sanitizerFactoryInternal(\n this.element,\n this.name,\n 'attribute'\n );\n }\n value = this._sanitizer(value ?? '');\n }\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit attribute',\n element: this.element,\n name: this.name,\n value,\n options: this.options,\n });\n (wrap(this.element) as Element).setAttribute(\n this.name,\n (value ?? '') as string\n );\n }\n }\n}\n\nexport type {PropertyPart};\nclass PropertyPart extends AttributePart {\n override readonly type = PROPERTY_PART;\n\n /** @internal */\n override _commitValue(value: unknown) {\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n if (this._sanitizer === undefined) {\n this._sanitizer = sanitizerFactoryInternal(\n this.element,\n this.name,\n 'property'\n );\n }\n value = this._sanitizer(value);\n }\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit property',\n element: this.element,\n name: this.name,\n value,\n options: this.options,\n });\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (this.element as any)[this.name] = value === nothing ? undefined : value;\n }\n}\n\nexport type {BooleanAttributePart};\nclass BooleanAttributePart extends AttributePart {\n override readonly type = BOOLEAN_ATTRIBUTE_PART;\n\n /** @internal */\n override _commitValue(value: unknown) {\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit boolean attribute',\n element: this.element,\n name: this.name,\n value: !!(value && value !== nothing),\n options: this.options,\n });\n (wrap(this.element) as Element).toggleAttribute(\n this.name,\n !!value && value !== nothing\n );\n }\n}\n\ntype EventListenerWithOptions = EventListenerOrEventListenerObject &\n Partial<AddEventListenerOptions>;\n\n/**\n * An AttributePart that manages an event listener via add/removeEventListener.\n *\n * This part works by adding itself as the event listener on an element, then\n * delegating to the value passed to it. This reduces the number of calls to\n * add/removeEventListener if the listener changes frequently, such as when an\n * inline function is used as a listener.\n *\n * Because event options are passed when adding listeners, we must take case\n * to add and remove the part as a listener when the event options change.\n */\nexport type {EventPart};\nclass EventPart extends AttributePart {\n override readonly type = EVENT_PART;\n\n constructor(\n element: HTMLElement,\n name: string,\n strings: ReadonlyArray<string>,\n parent: Disconnectable,\n options: RenderOptions | undefined\n ) {\n super(element, name, strings, parent, options);\n\n if (DEV_MODE && this.strings !== undefined) {\n throw new Error(\n `A \\`<${element.localName}>\\` has a \\`@${name}=...\\` listener with ` +\n 'invalid content. Event listeners in templates must have exactly ' +\n 'one expression and no surrounding text.'\n );\n }\n }\n\n // EventPart does not use the base _$setValue/_resolveValue implementation\n // since the dirty checking is more complex\n /** @internal */\n override _$setValue(\n newListener: unknown,\n directiveParent: DirectiveParent = this\n ) {\n newListener =\n resolveDirective(this, newListener, directiveParent, 0) ?? nothing;\n if (newListener === noChange) {\n return;\n }\n const oldListener = this._$committedValue;\n\n // If the new value is nothing or any options change we have to remove the\n // part as a listener.\n const shouldRemoveListener =\n (newListener === nothing && oldListener !== nothing) ||\n (newListener as EventListenerWithOptions).capture !==\n (oldListener as EventListenerWithOptions).capture ||\n (newListener as EventListenerWithOptions).once !==\n (oldListener as EventListenerWithOptions).once ||\n (newListener as EventListenerWithOptions).passive !==\n (oldListener as EventListenerWithOptions).passive;\n\n // If the new value is not nothing and we removed the listener, we have\n // to add the part as a listener.\n const shouldAddListener =\n newListener !== nothing &&\n (oldListener === nothing || shouldRemoveListener);\n\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit event listener',\n element: this.element,\n name: this.name,\n value: newListener,\n options: this.options,\n removeListener: shouldRemoveListener,\n addListener: shouldAddListener,\n oldListener,\n });\n if (shouldRemoveListener) {\n this.element.removeEventListener(\n this.name,\n this,\n oldListener as EventListenerWithOptions\n );\n }\n if (shouldAddListener) {\n this.element.addEventListener(\n this.name,\n this,\n newListener as EventListenerWithOptions\n );\n }\n this._$committedValue = newListener;\n }\n\n handleEvent(event: Event) {\n if (typeof this._$committedValue === 'function') {\n this._$committedValue.call(this.options?.host ?? this.element, event);\n } else {\n (this._$committedValue as EventListenerObject).handleEvent(event);\n }\n }\n}\n\nexport type {ElementPart};\nclass ElementPart implements Disconnectable {\n readonly type = ELEMENT_PART;\n\n /** @internal */\n __directive?: Directive;\n\n // This is to ensure that every Part has a _$committedValue\n _$committedValue: undefined;\n\n /** @internal */\n _$parent!: Disconnectable;\n\n /** @internal */\n _$disconnectableChildren?: Set<Disconnectable> = undefined;\n\n options: RenderOptions | undefined;\n\n constructor(\n public element: Element,\n parent: Disconnectable,\n options: RenderOptions | undefined\n ) {\n this._$parent = parent;\n this.options = options;\n }\n\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n\n _$setValue(value: unknown): void {\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit to element binding',\n element: this.element,\n value,\n options: this.options,\n });\n resolveDirective(this, value);\n }\n}\n\n/**\n * END USERS SHOULD NOT RELY ON THIS OBJECT.\n *\n * Private exports for use by other Lit packages, not intended for use by\n * external users.\n *\n * We currently do not make a mangled rollup build of the lit-ssr code. In order\n * to keep a number of (otherwise private) top-level exports mangled in the\n * client side code, we export a _$LH object containing those members (or\n * helper methods for accessing private fields of those members), and then\n * re-export them for use in lit-ssr. This keeps lit-ssr agnostic to whether the\n * client-side code is being used in `dev` mode or `prod` mode.\n *\n * This has a unique name, to disambiguate it from private exports in\n * lit-element, which re-exports all of lit-html.\n *\n * @private\n */\nexport const _$LH = {\n // Used in lit-ssr\n _boundAttributeSuffix: boundAttributeSuffix,\n _marker: marker,\n _markerMatch: markerMatch,\n _HTML_RESULT: HTML_RESULT,\n _getTemplateHtml: getTemplateHtml,\n // Used in tests and private-ssr-support\n _TemplateInstance: TemplateInstance,\n _isIterable: isIterable,\n _resolveDirective: resolveDirective,\n _ChildPart: ChildPart,\n _AttributePart: AttributePart,\n _BooleanAttributePart: BooleanAttributePart,\n _EventPart: EventPart,\n _PropertyPart: PropertyPart,\n _ElementPart: ElementPart,\n};\n\n// Apply polyfills if available\nconst polyfillSupport = DEV_MODE\n ? global.litHtmlPolyfillSupportDevMode\n : global.litHtmlPolyfillSupport;\npolyfillSupport?.(Template, ChildPart);\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for lit-html usage.\n(global.litHtmlVersions ??= []).push('3.3.2');\nif (DEV_MODE && global.litHtmlVersions.length > 1) {\n queueMicrotask(() => {\n issueWarning!(\n 'multiple-versions',\n `Multiple versions of Lit loaded. ` +\n `Loading multiple versions is not recommended.`\n );\n });\n}\n\n/**\n * Renders a value, usually a lit-html TemplateResult, to the container.\n *\n * This example renders the text \"Hello, Zoe!\" inside a paragraph tag, appending\n * it to the container `document.body`.\n *\n * ```js\n * import {html, render} from 'lit';\n *\n * const name = \"Zoe\";\n * render(html`<p>Hello, ${name}!</p>`, document.body);\n * ```\n *\n * @param value Any [renderable\n * value](https://lit.dev/docs/templates/expressions/#child-expressions),\n * typically a {@linkcode TemplateResult} created by evaluating a template tag\n * like {@linkcode html} or {@linkcode svg}.\n * @param container A DOM container to render to. The first render will append\n * the rendered value to the container, and subsequent renders will\n * efficiently update the rendered value if the same result type was\n * previously rendered there.\n * @param options See {@linkcode RenderOptions} for options documentation.\n * @see\n * {@link https://lit.dev/docs/libraries/standalone-templates/#rendering-lit-html-templates| Rendering Lit HTML Templates}\n */\nexport const render = (\n value: unknown,\n container: RenderRootNode,\n options?: RenderOptions\n): RootPart => {\n if (DEV_MODE && container == null) {\n // Give a clearer error message than\n // Uncaught TypeError: Cannot read properties of null (reading\n // '_$litPart$')\n // which reads like an internal Lit error.\n throw new TypeError(`The container to render into may not be ${container}`);\n }\n const renderId = DEV_MODE ? debugLogRenderId++ : 0;\n const partOwnerNode = options?.renderBefore ?? container;\n // This property needs to remain unminified.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let part: ChildPart = (partOwnerNode as any)['_$litPart$'];\n debugLogEvent &&\n debugLogEvent({\n kind: 'begin render',\n id: renderId,\n value,\n container,\n options,\n part,\n });\n if (part === undefined) {\n const endNode = options?.renderBefore ?? null;\n // This property needs to remain unminified.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (partOwnerNode as any)['_$litPart$'] = part = new ChildPart(\n container.insertBefore(createMarker(), endNode),\n endNode,\n undefined,\n options ?? {}\n );\n }\n part._$setValue(value);\n debugLogEvent &&\n debugLogEvent({\n kind: 'end render',\n id: renderId,\n value,\n container,\n options,\n part,\n });\n return part as RootPart;\n};\n\nif (ENABLE_EXTRA_SECURITY_HOOKS) {\n render.setSanitizer = setSanitizer;\n render.createSanitizer = createSanitizer;\n if (DEV_MODE) {\n render._testOnlyClearSanitizerFactoryDoNotCallOrElse =\n _testOnlyClearSanitizerFactoryDoNotCallOrElse;\n }\n}\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * The main LitElement module, which defines the {@linkcode LitElement} base\n * class and related APIs.\n *\n * LitElement components can define a template and a set of observed\n * properties. Changing an observed property triggers a re-render of the\n * element.\n *\n * Import {@linkcode LitElement} and {@linkcode html} from this module to\n * create a component:\n *\n * ```js\n * import {LitElement, html} from 'lit-element';\n *\n * class MyElement extends LitElement {\n *\n * // Declare observed properties\n * static get properties() {\n * return {\n * adjective: {}\n * }\n * }\n *\n * constructor() {\n * this.adjective = 'awesome';\n * }\n *\n * // Define the element's template\n * render() {\n * return html`<p>your ${adjective} template here</p>`;\n * }\n * }\n *\n * customElements.define('my-element', MyElement);\n * ```\n *\n * `LitElement` extends {@linkcode ReactiveElement} and adds lit-html\n * templating. The `ReactiveElement` class is provided for users that want to\n * build their own custom element base classes that don't use lit-html.\n *\n * @packageDocumentation\n */\nimport {PropertyValues, ReactiveElement} from '@lit/reactive-element';\nimport {render, RenderOptions, noChange, RootPart} from 'lit-html';\nexport * from '@lit/reactive-element';\nexport * from 'lit-html';\n\nimport {LitUnstable} from 'lit-html';\nimport {ReactiveUnstable} from '@lit/reactive-element';\n\n/**\n * Contains types that are part of the unstable debug API.\n *\n * Everything in this API is not stable and may change or be removed in the future,\n * even on patch releases.\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Unstable {\n /**\n * When Lit is running in dev mode and `window.emitLitDebugLogEvents` is true,\n * we will emit 'lit-debug' events to window, with live details about the update and render\n * lifecycle. These can be useful for writing debug tooling and visualizations.\n *\n * Please be aware that running with window.emitLitDebugLogEvents has performance overhead,\n * making certain operations that are normally very cheap (like a no-op render) much slower,\n * because we must copy data and dispatch events.\n */\n // eslint-disable-next-line @typescript-eslint/no-namespace\n export namespace DebugLog {\n export type Entry =\n | LitUnstable.DebugLog.Entry\n | ReactiveUnstable.DebugLog.Entry;\n }\n}\n/*\n * When using Closure Compiler, JSCompiler_renameProperty(property, object) is\n * replaced at compile time by the munged name for object[property]. We cannot\n * alias this function, so we have to use a small shim that has the same\n * behavior when not compiling.\n */\n/*@__INLINE__*/\nconst JSCompiler_renameProperty = <P extends PropertyKey>(\n prop: P,\n _obj: unknown\n): P => prop;\n\nconst DEV_MODE = true;\n// Allows minifiers to rename references to globalThis\nconst global = globalThis;\n\nlet issueWarning: (code: string, warning: string) => void;\n\nif (DEV_MODE) {\n // Ensure warnings are issued only 1x, even if multiple versions of Lit\n // are loaded.\n global.litIssuedWarnings ??= new Set();\n\n /**\n * Issue a warning if we haven't already, based either on `code` or `warning`.\n * Warnings are disabled automatically only by `warning`; disabling via `code`\n * can be done by users.\n */\n issueWarning = (code: string, warning: string) => {\n warning += ` See https://lit.dev/msg/${code} for more information.`;\n if (\n !global.litIssuedWarnings!.has(warning) &&\n !global.litIssuedWarnings!.has(code)\n ) {\n console.warn(warning);\n global.litIssuedWarnings!.add(warning);\n }\n };\n}\n\n/**\n * Base element class that manages element properties and attributes, and\n * renders a lit-html template.\n *\n * To define a component, subclass `LitElement` and implement a\n * `render` method to provide the component's template. Define properties\n * using the {@linkcode LitElement.properties properties} property or the\n * {@linkcode property} decorator.\n */\nexport class LitElement extends ReactiveElement {\n // This property needs to remain unminified.\n static ['_$litElement$'] = true;\n\n /**\n * @category rendering\n */\n readonly renderOptions: RenderOptions = {host: this};\n\n private __childPart: RootPart | undefined = undefined;\n\n /**\n * @category rendering\n */\n protected override createRenderRoot() {\n const renderRoot = super.createRenderRoot();\n // When adoptedStyleSheets are shimmed, they are inserted into the\n // shadowRoot by createRenderRoot. Adjust the renderBefore node so that\n // any styles in Lit content render before adoptedStyleSheets. This is\n // important so that adoptedStyleSheets have precedence over styles in\n // the shadowRoot.\n this.renderOptions.renderBefore ??= renderRoot!.firstChild as ChildNode;\n return renderRoot;\n }\n\n /**\n * Updates the element. This method reflects property values to attributes\n * and calls `render` to render DOM via lit-html. Setting properties inside\n * this method will *not* trigger another update.\n * @param changedProperties Map of changed properties with old values\n * @category updates\n */\n protected override update(changedProperties: PropertyValues) {\n // Setting properties in `render` should not trigger an update. Since\n // updates are allowed after super.update, it's important to call `render`\n // before that.\n const value = this.render();\n if (!this.hasUpdated) {\n this.renderOptions.isConnected = this.isConnected;\n }\n super.update(changedProperties);\n this.__childPart = render(value, this.renderRoot, this.renderOptions);\n }\n\n /**\n * Invoked when the component is added to the document's DOM.\n *\n * In `connectedCallback()` you should setup tasks that should only occur when\n * the element is connected to the document. The most common of these is\n * adding event listeners to nodes external to the element, like a keydown\n * event handler added to the window.\n *\n * ```ts\n * connectedCallback() {\n * super.connectedCallback();\n * addEventListener('keydown', this._handleKeydown);\n * }\n * ```\n *\n * Typically, anything done in `connectedCallback()` should be undone when the\n * element is disconnected, in `disconnectedCallback()`.\n *\n * @category lifecycle\n */\n override connectedCallback() {\n super.connectedCallback();\n this.__childPart?.setConnected(true);\n }\n\n /**\n * Invoked when the component is removed from the document's DOM.\n *\n * This callback is the main signal to the element that it may no longer be\n * used. `disconnectedCallback()` should ensure that nothing is holding a\n * reference to the element (such as event listeners added to nodes external\n * to the element), so that it is free to be garbage collected.\n *\n * ```ts\n * disconnectedCallback() {\n * super.disconnectedCallback();\n * window.removeEventListener('keydown', this._handleKeydown);\n * }\n * ```\n *\n * An element may be re-connected after being disconnected.\n *\n * @category lifecycle\n */\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.__childPart?.setConnected(false);\n }\n\n /**\n * Invoked on each update to perform rendering tasks. This method may return\n * any value renderable by lit-html's `ChildPart` - typically a\n * `TemplateResult`. Setting properties inside this method will *not* trigger\n * the element to update.\n * @category rendering\n */\n protected render(): unknown {\n return noChange;\n }\n}\n\n/**\n * Ensure this class is marked as `finalized` as an optimization ensuring\n * it will not needlessly try to `finalize`.\n *\n * Note this property name is a string to prevent breaking Closure JS Compiler\n * optimizations. See @lit/reactive-element for more information.\n */\n(LitElement as unknown as Record<string, unknown>)[\n JSCompiler_renameProperty('finalized', LitElement)\n] = true;\n\n// Install hydration if available\nglobal.litElementHydrateSupport?.({LitElement});\n\n// Apply polyfills if available\nconst polyfillSupport = DEV_MODE\n ? global.litElementPolyfillSupportDevMode\n : global.litElementPolyfillSupport;\npolyfillSupport?.({LitElement});\n\n/**\n * END USERS SHOULD NOT RELY ON THIS OBJECT.\n *\n * Private exports for use by other Lit packages, not intended for use by\n * external users.\n *\n * We currently do not make a mangled rollup build of the lit-ssr code. In order\n * to keep a number of (otherwise private) top-level exports mangled in the\n * client side code, we export a _$LE object containing those members (or\n * helper methods for accessing private fields of those members), and then\n * re-export them for use in lit-ssr. This keeps lit-ssr agnostic to whether the\n * client-side code is being used in `dev` mode or `prod` mode.\n *\n * This has a unique name, to disambiguate it from private exports in\n * lit-html, since this module re-exports all of lit-html.\n *\n * @private\n */\nexport const _$LE = {\n _$attributeToProperty: (\n el: LitElement,\n name: string,\n value: string | null\n ) => {\n // eslint-disable-next-line\n (el as any)._$attributeToProperty(name, value);\n },\n // eslint-disable-next-line\n _$changedProperties: (el: LitElement) => (el as any)._$changedProperties,\n};\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for LitElement usage.\n(global.litElementVersions ??= []).push('4.2.2');\nif (DEV_MODE && global.litElementVersions.length > 1) {\n queueMicrotask(() => {\n issueWarning!(\n 'multiple-versions',\n `Multiple versions of Lit loaded. Loading multiple versions ` +\n `is not recommended.`\n );\n });\n}\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\n\nimport {\n type PropertyDeclaration,\n type ReactiveElement,\n defaultConverter,\n notEqual,\n} from '../reactive-element.js';\nimport type {Interface} from './base.js';\n\nconst DEV_MODE = true;\n\nlet issueWarning: (code: string, warning: string) => void;\n\nif (DEV_MODE) {\n // Ensure warnings are issued only 1x, even if multiple versions of Lit\n // are loaded.\n globalThis.litIssuedWarnings ??= new Set();\n\n /**\n * Issue a warning if we haven't already, based either on `code` or `warning`.\n * Warnings are disabled automatically only by `warning`; disabling via `code`\n * can be done by users.\n */\n issueWarning = (code: string, warning: string) => {\n warning += ` See https://lit.dev/msg/${code} for more information.`;\n if (\n !globalThis.litIssuedWarnings!.has(warning) &&\n !globalThis.litIssuedWarnings!.has(code)\n ) {\n console.warn(warning);\n globalThis.litIssuedWarnings!.add(warning);\n }\n };\n}\n\n// Overloads for property decorator so that TypeScript can infer the correct\n// return type when a decorator is used as an accessor decorator or a setter\n// decorator.\nexport type PropertyDecorator = {\n // accessor decorator signature\n <C extends Interface<ReactiveElement>, V>(\n target: ClassAccessorDecoratorTarget<C, V>,\n context: ClassAccessorDecoratorContext<C, V>\n ): ClassAccessorDecoratorResult<C, V>;\n\n // setter decorator signature\n <C extends Interface<ReactiveElement>, V>(\n target: (value: V) => void,\n context: ClassSetterDecoratorContext<C, V>\n ): (this: C, value: V) => void;\n\n // legacy decorator signature\n (\n protoOrDescriptor: Object,\n name: PropertyKey,\n descriptor?: PropertyDescriptor\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): any;\n};\n\nconst legacyProperty = (\n options: PropertyDeclaration | undefined,\n proto: Object,\n name: PropertyKey\n) => {\n const hasOwnProperty = proto.hasOwnProperty(name);\n (proto.constructor as typeof ReactiveElement).createProperty(name, options);\n // For accessors (which have a descriptor on the prototype) we need to\n // return a descriptor, otherwise TypeScript overwrites the descriptor we\n // define in createProperty() with the original descriptor. We don't do this\n // for fields, which don't have a descriptor, because this could overwrite\n // descriptor defined by other decorators.\n return hasOwnProperty\n ? Object.getOwnPropertyDescriptor(proto, name)\n : undefined;\n};\n\n// This is duplicated from a similar variable in reactive-element.ts, but\n// actually makes sense to have this default defined with the decorator, so\n// that different decorators could have different defaults.\nconst defaultPropertyDeclaration: PropertyDeclaration = {\n attribute: true,\n type: String,\n converter: defaultConverter,\n reflect: false,\n hasChanged: notEqual,\n};\n\n// Temporary type, until google3 is on TypeScript 5.2\ntype StandardPropertyContext<C, V> = (\n | ClassAccessorDecoratorContext<C, V>\n | ClassSetterDecoratorContext<C, V>\n) & {metadata: object};\n\n/**\n * Wraps a class accessor or setter so that `requestUpdate()` is called with the\n * property name and old value when the accessor is set.\n */\nexport const standardProperty = <C extends Interface<ReactiveElement>, V>(\n options: PropertyDeclaration = defaultPropertyDeclaration,\n target: ClassAccessorDecoratorTarget<C, V> | ((value: V) => void),\n context: StandardPropertyContext<C, V>\n): ClassAccessorDecoratorResult<C, V> | ((this: C, value: V) => void) => {\n const {kind, metadata} = context;\n\n if (DEV_MODE && metadata == null) {\n issueWarning(\n 'missing-class-metadata',\n `The class ${target} is missing decorator metadata. This ` +\n `could mean that you're using a compiler that supports decorators ` +\n `but doesn't support decorator metadata, such as TypeScript 5.1. ` +\n `Please update your compiler.`\n );\n }\n\n // Store the property options\n let properties = globalThis.litPropertyMetadata.get(metadata);\n if (properties === undefined) {\n globalThis.litPropertyMetadata.set(metadata, (properties = new Map()));\n }\n if (kind === 'setter') {\n options = Object.create(options);\n options.wrapped = true;\n }\n properties.set(context.name, options);\n\n if (kind === 'accessor') {\n // Standard decorators cannot dynamically modify the class, so we can't\n // replace a field with accessors. The user must use the new `accessor`\n // keyword instead.\n const {name} = context;\n return {\n set(this: ReactiveElement, v: V) {\n const oldValue = (\n target as ClassAccessorDecoratorTarget<C, V>\n ).get.call(this as unknown as C);\n (target as ClassAccessorDecoratorTarget<C, V>).set.call(\n this as unknown as C,\n v\n );\n this.requestUpdate(name, oldValue, options, true, v);\n },\n init(this: ReactiveElement, v: V): V {\n if (v !== undefined) {\n this._$changeProperty(name, undefined, options, v);\n }\n return v;\n },\n } as unknown as ClassAccessorDecoratorResult<C, V>;\n } else if (kind === 'setter') {\n const {name} = context;\n return function (this: ReactiveElement, value: V) {\n const oldValue = this[name as keyof ReactiveElement];\n (target as (value: V) => void).call(this, value);\n this.requestUpdate(name, oldValue, options, true, value);\n } as unknown as (this: C, value: V) => void;\n }\n throw new Error(`Unsupported decorator location: ${kind}`);\n};\n\n/**\n * A class field or accessor decorator which creates a reactive property that\n * reflects a corresponding attribute value. When a decorated property is set\n * the element will update and render. A {@linkcode PropertyDeclaration} may\n * optionally be supplied to configure property features.\n *\n * This decorator should only be used for public fields. As public fields,\n * properties should be considered as primarily settable by element users,\n * either via attribute or the property itself.\n *\n * Generally, properties that are changed by the element should be private or\n * protected fields and should use the {@linkcode state} decorator.\n *\n * However, sometimes element code does need to set a public property. This\n * should typically only be done in response to user interaction, and an event\n * should be fired informing the user; for example, a checkbox sets its\n * `checked` property when clicked and fires a `changed` event. Mutating public\n * properties should typically not be done for non-primitive (object or array)\n * properties. In other cases when an element needs to manage state, a private\n * property decorated via the {@linkcode state} decorator should be used. When\n * needed, state properties can be initialized via public properties to\n * facilitate complex interactions.\n *\n * ```ts\n * class MyElement {\n * @property({ type: Boolean })\n * clicked = false;\n * }\n * ```\n * @category Decorator\n * @ExportDecoratedItems\n */\nexport function property(options?: PropertyDeclaration): PropertyDecorator {\n return <C extends Interface<ReactiveElement>, V>(\n protoOrTarget:\n | object\n | ClassAccessorDecoratorTarget<C, V>\n | ((value: V) => void),\n nameOrContext:\n | PropertyKey\n | ClassAccessorDecoratorContext<C, V>\n | ClassSetterDecoratorContext<C, V>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): any => {\n return (\n typeof nameOrContext === 'object'\n ? standardProperty<C, V>(\n options,\n protoOrTarget as\n | ClassAccessorDecoratorTarget<C, V>\n | ((value: V) => void),\n nameOrContext as StandardPropertyContext<C, V>\n )\n : legacyProperty(\n options,\n protoOrTarget as Object,\n nameOrContext as PropertyKey\n )\n ) as PropertyDecorator;\n };\n}\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\n\nimport {property} from './property.js';\n\nexport interface StateDeclaration<Type = unknown> {\n /**\n * A function that indicates if a property should be considered changed when\n * it is set. The function should take the `newValue` and `oldValue` and\n * return `true` if an update should be requested.\n */\n hasChanged?(value: Type, oldValue: Type): boolean;\n}\n\n/**\n * @deprecated use StateDeclaration\n */\nexport type InternalPropertyDeclaration<Type = unknown> =\n StateDeclaration<Type>;\n\n/**\n * Declares a private or protected reactive property that still triggers\n * updates to the element when it changes. It does not reflect from the\n * corresponding attribute.\n *\n * Properties declared this way must not be used from HTML or HTML templating\n * systems, they're solely for properties internal to the element. These\n * properties may be renamed by optimization tools like closure compiler.\n * @category Decorator\n */\nexport function state(options?: StateDeclaration) {\n return property({\n ...options,\n // Add both `state` and `attribute` because we found a third party\n // controller that is keying off of PropertyOptions.state to determine\n // whether a field is a private internal property or not.\n state: true,\n attribute: false,\n });\n}\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {Disconnectable, Part} from './lit-html.js';\n\nexport {\n AttributePart,\n BooleanAttributePart,\n ChildPart,\n ElementPart,\n EventPart,\n Part,\n PropertyPart,\n} from './lit-html.js';\n\nexport interface DirectiveClass {\n new (part: PartInfo): Directive;\n}\n\n/**\n * This utility type extracts the signature of a directive class's render()\n * method so we can use it for the type of the generated directive function.\n */\nexport type DirectiveParameters<C extends Directive> = Parameters<C['render']>;\n\n/**\n * A generated directive function doesn't evaluate the directive, but just\n * returns a DirectiveResult object that captures the arguments.\n */\nexport interface DirectiveResult<C extends DirectiveClass = DirectiveClass> {\n /**\n * This property needs to remain unminified.\n * @internal\n */\n ['_$litDirective$']: C;\n /** @internal */\n values: DirectiveParameters<InstanceType<C>>;\n}\n\nexport const PartType = {\n ATTRIBUTE: 1,\n CHILD: 2,\n PROPERTY: 3,\n BOOLEAN_ATTRIBUTE: 4,\n EVENT: 5,\n ELEMENT: 6,\n} as const;\n\nexport type PartType = (typeof PartType)[keyof typeof PartType];\n\nexport interface ChildPartInfo {\n readonly type: typeof PartType.CHILD;\n}\n\nexport interface AttributePartInfo {\n readonly type:\n | typeof PartType.ATTRIBUTE\n | typeof PartType.PROPERTY\n | typeof PartType.BOOLEAN_ATTRIBUTE\n | typeof PartType.EVENT;\n readonly strings?: ReadonlyArray<string>;\n readonly name: string;\n readonly tagName: string;\n}\n\nexport interface ElementPartInfo {\n readonly type: typeof PartType.ELEMENT;\n}\n\n/**\n * Information about the part a directive is bound to.\n *\n * This is useful for checking that a directive is attached to a valid part,\n * such as with directive that can only be used on attribute bindings.\n */\nexport type PartInfo = ChildPartInfo | AttributePartInfo | ElementPartInfo;\n\n/**\n * Creates a user-facing directive function from a Directive class. This\n * function has the same parameters as the directive's render() method.\n */\nexport const directive =\n <C extends DirectiveClass>(c: C) =>\n (...values: DirectiveParameters<InstanceType<C>>): DirectiveResult<C> => ({\n // This property needs to remain unminified.\n ['_$litDirective$']: c,\n values,\n });\n\n/**\n * Base class for creating custom directives. Users should extend this class,\n * implement `render` and/or `update`, and then pass their subclass to\n * `directive`.\n */\nexport abstract class Directive implements Disconnectable {\n //@internal\n __part!: Part;\n //@internal\n __attributeIndex: number | undefined;\n //@internal\n __directive?: Directive;\n\n //@internal\n _$parent!: Disconnectable;\n\n // These will only exist on the AsyncDirective subclass\n //@internal\n _$disconnectableChildren?: Set<Disconnectable>;\n // This property needs to remain unminified.\n //@internal\n ['_$notifyDirectiveConnectionChanged']?(isConnected: boolean): void;\n\n constructor(_partInfo: PartInfo) {}\n\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n\n /** @internal */\n _$initialize(\n part: Part,\n parent: Disconnectable,\n attributeIndex: number | undefined\n ) {\n this.__part = part;\n this._$parent = parent;\n this.__attributeIndex = attributeIndex;\n }\n /** @internal */\n _$resolve(part: Part, props: Array<unknown>): unknown {\n return this.update(part, props);\n }\n\n abstract render(...props: Array<unknown>): unknown;\n\n update(_part: Part, props: Array<unknown>): unknown {\n return this.render(...props);\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {AttributePart, noChange} from '../lit-html.js';\nimport {\n directive,\n Directive,\n DirectiveParameters,\n PartInfo,\n PartType,\n} from '../directive.js';\n\n/**\n * A key-value set of CSS properties and values.\n *\n * The key should be either a valid CSS property name string, like\n * `'background-color'`, or a valid JavaScript camel case property name\n * for CSSStyleDeclaration like `backgroundColor`.\n */\nexport interface StyleInfo {\n [name: string]: string | number | undefined | null;\n}\n\nconst important = 'important';\n// The leading space is important\nconst importantFlag = ' !' + important;\n// How many characters to remove from a value, as a negative number\nconst flagTrim = 0 - importantFlag.length;\n\nclass StyleMapDirective extends Directive {\n private _previousStyleProperties?: Set<string>;\n\n constructor(partInfo: PartInfo) {\n super(partInfo);\n if (\n partInfo.type !== PartType.ATTRIBUTE ||\n partInfo.name !== 'style' ||\n (partInfo.strings?.length as number) > 2\n ) {\n throw new Error(\n 'The `styleMap` directive must be used in the `style` attribute ' +\n 'and must be the only part in the attribute.'\n );\n }\n }\n\n render(styleInfo: Readonly<StyleInfo>) {\n return Object.keys(styleInfo).reduce((style, prop) => {\n const value = styleInfo[prop];\n if (value == null) {\n return style;\n }\n // Convert property names from camel-case to dash-case, i.e.:\n // `backgroundColor` -> `background-color`\n // Vendor-prefixed names need an extra `-` appended to front:\n // `webkitAppearance` -> `-webkit-appearance`\n // Exception is any property name containing a dash, including\n // custom properties; we assume these are already dash-cased i.e.:\n // `--my-button-color` --> `--my-button-color`\n prop = prop.includes('-')\n ? prop\n : prop\n .replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, '-$&')\n .toLowerCase();\n return style + `${prop}:${value};`;\n }, '');\n }\n\n override update(part: AttributePart, [styleInfo]: DirectiveParameters<this>) {\n const {style} = part.element as HTMLElement;\n\n if (this._previousStyleProperties === undefined) {\n this._previousStyleProperties = new Set(Object.keys(styleInfo));\n return this.render(styleInfo);\n }\n\n // Remove old properties that no longer exist in styleInfo\n for (const name of this._previousStyleProperties) {\n // If the name isn't in styleInfo or it's null/undefined\n if (styleInfo[name] == null) {\n this._previousStyleProperties!.delete(name);\n if (name.includes('-')) {\n style.removeProperty(name);\n } else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (style as any)[name] = null;\n }\n }\n }\n\n // Add or update properties\n for (const name in styleInfo) {\n const value = styleInfo[name];\n if (value != null) {\n this._previousStyleProperties.add(name);\n const isImportant =\n typeof value === 'string' && value.endsWith(importantFlag);\n if (name.includes('-') || isImportant) {\n style.setProperty(\n name,\n isImportant\n ? (value as string).slice(0, flagTrim)\n : (value as string),\n isImportant ? important : ''\n );\n } else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (style as any)[name] = value;\n }\n }\n }\n return noChange;\n }\n}\n\n/**\n * A directive that applies CSS properties to an element.\n *\n * `styleMap` can only be used in the `style` attribute and must be the only\n * expression in the attribute. It takes the property names in the\n * {@link StyleInfo styleInfo} object and adds the properties to the inline\n * style of the element.\n *\n * Property names with dashes (`-`) are assumed to be valid CSS\n * property names and set on the element's style object using `setProperty()`.\n * Names without dashes are assumed to be camelCased JavaScript property names\n * and set on the element's style object using property assignment, allowing the\n * style object to translate JavaScript-style names to CSS property names.\n *\n * For example `styleMap({backgroundColor: 'red', 'border-top': '5px', '--size':\n * '0'})` sets the `background-color`, `border-top` and `--size` properties.\n *\n * @param styleInfo\n * @see {@link https://lit.dev/docs/templates/directives/#stylemap styleMap code samples on Lit.dev}\n */\nexport const styleMap = directive(StyleMapDirective);\n\n/**\n * The type of the class that powers this directive. Necessary for naming the\n * directive's return type.\n */\nexport type {StyleMapDirective};\n","/**\n * Profile Picture Component - Type Definitions\n * Apple-inspired design system with modern 2025 aesthetics\n */\n\n// ─── Size System (Apple 8pt Grid) ─────────────────────────────────────────────\nexport type Size = \"2xs\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\" | \"3xl\";\n\n// Size presets in pixels (following 8pt grid)\nexport const SIZE_MAP: Record<Size, number> = {\n \"2xs\": 20, // Inline, compact UI\n xs: 24, // Small avatars, lists\n sm: 32, // Default list items\n md: 40, // Navigation, headers\n lg: 48, // Profile sections\n xl: 64, // Profile pages\n \"2xl\": 80, // Hero sections\n \"3xl\": 120, // Profile modals\n};\n\n// ─── Visual Variants ──────────────────────────────────────────────────────────\nexport type Variant = \"circle\" | \"rounded\" | \"squircle\" | \"square\";\n\n// ─── Positioning ──────────────────────────────────────────────────────────────\nexport type Position =\n | \"top-left\"\n | \"top-center\"\n | \"top-right\"\n | \"bottom-left\"\n | \"bottom-center\"\n | \"bottom-right\";\n\n// ─── Loading & Performance ────────────────────────────────────────────────────\nexport type LoadingStrategy = \"lazy\" | \"eager\";\nexport type PlaceholderType =\n | \"shimmer\"\n | \"pulse\"\n | \"blur\"\n | \"skeleton\"\n | \"none\";\n\nexport type FallbackMode = \"initials\" | \"gradient\";\nexport type ImageMode = \"transparent\" | \"original\";\n\n// ─── Presence / Status System ─────────────────────────────────────────────────\nexport type PresenceStatus = \"online\" | \"away\" | \"busy\" | \"offline\" | \"dnd\";\n\nexport interface PresenceConfig {\n /** Current status */\n status: PresenceStatus;\n /** Show animated ring */\n animate?: boolean;\n /** Ring thickness (1-3) */\n thickness?: 1 | 2 | 3;\n}\n\n// Status colors (Apple-inspired)\nexport const PRESENCE_COLORS: Record<PresenceStatus, string> = {\n online: \"#30D158\", // Apple Green\n away: \"#FFD60A\", // Apple Yellow\n busy: \"#FF453A\", // Apple Red\n offline: \"#8E8E93\", // Apple Gray\n dnd: \"#FF453A\", // Apple Red (Do Not Disturb)\n};\n\n// ─── Badge Configuration ──────────────────────────────────────────────────────\nexport interface BadgeConfig {\n /** Badge content (text, number, or empty for dot) */\n content?: string | number;\n /** Position of the badge */\n position?: Position;\n /** Text/icon color */\n color?: string;\n /** Background color */\n bgColor?: string;\n /** Border radius (CSS value, e.g., \"8px\", \"50%\", \"9999px\") */\n borderRadius?: string;\n /** Enable pulse animation */\n pulse?: boolean;\n /** Enable glow effect */\n glow?: boolean;\n /** Max value to display (shows 99+ if exceeded) */\n max?: number;\n /** Icon to display before content (emoji, Unicode symbol, or text) */\n icon?: string;\n}\n\n// ─── Glow Effect ──────────────────────────────────────────────────────────────\nexport interface GlowConfig {\n /** Glow color (defaults to border or bg color) */\n color?: string;\n /** Intensity (0-1) */\n intensity?: number;\n /** Animate the glow */\n animate?: boolean;\n}\n\n// ─── Ring Effect (like Instagram stories) ────────────────────────────────────\nexport interface RingConfig {\n /** Show ring */\n show: boolean;\n /** Ring color or gradient */\n color?: string;\n /** Gradient colors for multi-color ring */\n gradient?: string[];\n /** Ring width */\n width?: number;\n /** Gap between ring and avatar */\n gap?: number;\n /** Animate (rotate for gradient) */\n animate?: boolean;\n /** Progress percentage (0-100) for partial fill ring */\n progress?: number;\n /** Color for unfilled portion when progress is set (defaults to gray) */\n emptyColor?: string;\n}\n\n// ─── Interactive States ───────────────────────────────────────────────────────\nexport interface InteractionConfig {\n /** Enable hover effects */\n hoverable?: boolean;\n /** Enable press/click effects */\n pressable?: boolean;\n /** Show focus ring on focus */\n focusable?: boolean;\n /** Cursor style */\n cursor?: \"pointer\" | \"default\" | \"zoom-in\";\n}\n\n// ─── Shadow Presets ───────────────────────────────────────────────────────────\nexport type ShadowPreset = \"none\" | \"sm\" | \"md\" | \"lg\" | \"glow\";\n\nexport const SHADOW_MAP: Record<ShadowPreset, string> = {\n none: \"none\",\n sm: \"0 1px 2px 0 rgba(0, 0, 0, 0.05)\",\n md: \"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)\",\n lg: \"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)\",\n glow: \"0 0 20px 0 rgba(99, 102, 241, 0.3)\",\n};\n\n// ─── Animation Presets ────────────────────────────────────────────────────────\nexport type AnimationPreset = \"none\" | \"fade\" | \"scale\" | \"slide\" | \"bounce\";\n\n// ─── Default Values ───────────────────────────────────────────────────────────\nexport const DEFAULTS = {\n size: \"md\" as Size,\n variant: \"circle\" as Variant,\n loading: \"lazy\" as LoadingStrategy,\n placeholder: \"shimmer\" as PlaceholderType,\n borderWidth: 2 as const,\n borderColor: \"#ffffff\",\n placeholderColor: \"#f3f4f6\",\n shadow: \"sm\" as ShadowPreset,\n animation: \"fade\" as AnimationPreset,\n imageMode: \"original\" as ImageMode,\n zoom: 1.2,\n} as const;\n\n// ─── CSS Custom Properties (for theming) ──────────────────────────────────────\nexport const CSS_VARS = {\n \"--pp-transition-duration\": \"200ms\",\n \"--pp-transition-timing\": \"cubic-bezier(0.4, 0, 0.2, 1)\",\n \"--pp-spring-timing\": \"cubic-bezier(0.34, 1.56, 0.64, 1)\",\n \"--pp-hover-scale\": \"1.05\",\n \"--pp-press-scale\": \"0.95\",\n \"--pp-focus-ring-color\": \"rgba(99, 102, 241, 0.5)\",\n \"--pp-focus-ring-width\": \"3px\",\n \"--pp-skeleton-base\": \"#e5e7eb\",\n \"--pp-skeleton-shine\": \"#f3f4f6\",\n} as const;\n\n// ─── Border Radius Presets ────────────────────────────────────────────────────\nexport const RADIUS_MAP: Record<Variant, string> = {\n circle: \"9999px\",\n rounded: \"12px\",\n squircle: \"30%\", // iOS app icon style\n square: \"0px\",\n};\n\n// ─── Full Component Props Interface ───────────────────────────────────────────\n/**\n * Base props interface shared across all framework wrappers.\n * This ensures type consistency between React, Vue, Svelte, and Angular.\n */\nexport interface ProfilePictureProps {\n // Core\n /** Image source URL */\n src?: string;\n /** Alt text for accessibility and fallback initials */\n alt?: string;\n /** External customer ID for CDN image loading */\n extCustomerId?: string;\n /** CDN image mode: 'transparent' for transparent background, 'original' for original background */\n imageMode?: ImageMode;\n\n // Sizing\n /** Predefined size or custom pixel value */\n size?: Size | number;\n\n // Visual\n /** Shape variant */\n variant?: Variant;\n /** Shadow preset */\n shadow?: ShadowPreset;\n\n // Border\n /** Enable border */\n border?: boolean;\n /** Border width in pixels */\n borderWidth?: 1 | 2 | 3 | 4 | 5 | 6 | 8;\n /** Border color (CSS color value) */\n borderColor?: string;\n\n // Rotation\n /** Rotation angle in degrees */\n rotation?: number;\n\n // Zoom\n /** Zoom level for the image (default: 1.4). Values > 1 zoom in, keeping the image within the crop zone */\n zoom?: number;\n\n // Background\n /** Background color (CSS color value) */\n bgColor?: string;\n /** Background gradient (CSS gradient value) */\n bgGradient?: string;\n\n // Effects\n /** Glow effect configuration */\n glow?: GlowConfig;\n /** Ring effect configuration (Instagram-style) */\n ring?: RingConfig;\n /** Presence indicator configuration */\n presence?: PresenceConfig;\n\n // Overlays\n /** Badge configuration */\n badge?: BadgeConfig;\n\n // Loading\n /** Loading strategy */\n loading?: LoadingStrategy;\n /** Placeholder type while loading */\n placeholder?: PlaceholderType;\n /** Placeholder background color */\n placeholderColor?: string;\n\n // Fallback\n /** Custom fallback text (overrides initials from alt) */\n fallback?: string;\n /** Fallback display mode: 'initials' shows letters, 'gradient' shows cloudy gradient */\n fallbackMode?: FallbackMode;\n\n // Interaction\n /** Interactive behavior configuration */\n interactive?: InteractionConfig;\n}\n\n// ─── Profile Picture Group Types ─────────────────────────────────────────────\n\n/** Direction for stacking avatars */\nexport type StackDirection = \"ltr\" | \"rtl\";\n\n/** Tooltip position relative to avatar */\nexport type TooltipPosition = \"top\" | \"bottom\" | \"left\" | \"right\";\n\n/** Tooltip configuration */\nexport interface TooltipConfig {\n /** Enable/disable tooltip (default: true) */\n enabled?: boolean;\n /** Position of tooltip relative to avatar */\n position?: TooltipPosition;\n /** Delay before showing tooltip in ms (default: 300) */\n delay?: number;\n}\n\n/** User data extracted from profile-picture elements */\nexport interface GroupUserData {\n /** User ID from data-user-id attribute */\n id?: string;\n /** User name from alt attribute */\n name: string;\n /** Image source URL */\n src?: string;\n /** External customer ID for CDN image loading */\n extCustomerId?: string;\n /** Presence status from data-status attribute */\n status?: PresenceStatus;\n /** Reference to the profile-picture element */\n element: HTMLElement;\n /** Index in the group */\n index: number;\n\n // ─── Profile Picture Props (passed through from slotted elements) ──────────\n /** Visual variant (circle, rounded, squircle, square) */\n variant?: Variant;\n /** Shadow preset */\n shadow?: ShadowPreset;\n /** Show border */\n border?: boolean;\n /** Border width (1-8) */\n borderWidth?: 1 | 2 | 3 | 4 | 5 | 6 | 8;\n /** Border color */\n borderColor?: string;\n /** Background color */\n bgColor?: string;\n /** Background gradient */\n bgGradient?: string;\n}\n\n/** Dropdown configuration for overflow users */\nexport interface DropdownConfig {\n /** Max height of dropdown in px (default: 280) */\n maxHeight?: number;\n /** Show presence indicator dots (default: true) */\n showPresence?: boolean;\n /** Dropdown position (default: 'bottom') */\n position?: \"bottom\" | \"top\";\n}\n\n/** Profile Picture Group Props */\nexport interface ProfilePictureGroupProps {\n /** Maximum visible avatars before showing counter (default: 4) */\n max?: number;\n /** Stack direction - ltr shows first on left (default: 'ltr') */\n direction?: StackDirection;\n /** Overlap amount as percentage 0-1 (default: 0.3) */\n overlap?: number;\n /** Avatar size - inherited by children (default: 'md') */\n size?: Size | number;\n /** Spacing between avatars in px (overrides overlap calculation) */\n spacing?: number;\n /** Tooltip configuration */\n tooltip?: TooltipConfig;\n /** Dropdown configuration for overflow users */\n dropdown?: DropdownConfig;\n /** Show add button (default: false) */\n showAddButton?: boolean;\n /** Add button label for accessibility */\n addButtonLabel?: string;\n /** Enable hover lift animation (default: true) */\n animated?: boolean;\n}\n\n/** Group component defaults */\nexport const GROUP_DEFAULTS = {\n max: 4,\n direction: \"ltr\" as StackDirection,\n overlap: 0.3,\n size: \"md\" as Size,\n tooltipDelay: 300,\n dropdownMaxHeight: 280,\n animated: true,\n} as const;\n","/**\n * Profile Picture Component - Utility Functions\n * Apple-inspired design system utilities\n */\n\nimport type { Size, Variant } from \"./types\";\nimport { RADIUS_MAP, SIZE_MAP } from \"./types\";\n\n/**\n * Resolve size to pixel value\n */\nexport function resolveSize(size: Size | number): number {\n if (typeof size === \"number\") {\n return size;\n }\n return SIZE_MAP[size] ?? SIZE_MAP.md;\n}\n\n/**\n * Merge class names, filtering out falsy values\n */\nexport function cn(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n\n/**\n * Check if a color value is a hex code\n */\nexport function isHexColor(color: string): boolean {\n return /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(color);\n}\n\n/**\n * Check if a value is a CSS color (not a Tailwind class)\n */\nexport function isCssColor(value: string): boolean {\n if (isHexColor(value)) {\n return true;\n }\n if (/^(rgb|hsl|oklch|oklab|lab|lch)a?\\s*\\(/.test(value)) {\n return true;\n }\n if (value.includes(\"gradient\")) {\n return true;\n }\n const namedColors = [\n \"transparent\",\n \"currentColor\",\n \"inherit\",\n \"white\",\n \"black\",\n ];\n return namedColors.includes(value.toLowerCase());\n}\n\n/**\n * Generate initials from alt text for fallback\n * Apple-style: Single letter for single word, two letters for multiple\n */\nexport function getInitials(text: string): string {\n const cleaned = text.trim().replace(/[^\\w\\s]/g, \"\");\n const words = cleaned.split(/\\s+/).filter(Boolean);\n\n if (words.length === 0) {\n return \"?\";\n }\n if (words.length === 1) {\n return words[0].slice(0, 1).toUpperCase();\n }\n return (words[0][0] + (words.at(-1)?.[0] ?? \"\")).toUpperCase();\n}\n\n/**\n * Get border radius value for variant\n */\nexport function getRadius(variant: Variant): string {\n return RADIUS_MAP[variant];\n}\n\n/**\n * Calculate optimal font size for initials based on container size\n */\nexport function getInitialsFontSize(containerSize: number): number {\n return Math.round(containerSize * 0.38);\n}\n\n/**\n * Calculate badge size relative to avatar size\n * Uses non-linear scaling to maintain visual balance:\n * - XL (64px) is the reference: ~33% ratio looks good\n * - Small avatars: proportionally smaller badges with reasonable minimums\n * - Large avatars: caps prevent oversized badges\n */\nexport function getBadgeSize(\n avatarSize: number,\n hasContent: boolean\n): { size: number; fontSize: number } {\n // Reference: XL (64px) avatar with content badge = 20px (31%)\n // Use diminishing ratio for larger sizes\n let size: number;\n\n if (hasContent) {\n // Badge with content: min 14px, max 24px\n // Scale: 31% ratio but capped\n const scaled = Math.round(avatarSize * 0.31);\n size = Math.min(24, Math.max(14, scaled));\n } else {\n // Dot badge: min 8px, max 14px\n // Scale: 22% ratio but capped\n const scaled = Math.round(avatarSize * 0.22);\n size = Math.min(14, Math.max(8, scaled));\n }\n\n // Font size: 55% of badge for better readability at small sizes\n const fontSize = Math.max(9, Math.round(size * 0.55));\n return { size, fontSize };\n}\n\n/**\n * Calculate presence indicator size\n * Uses capped scaling to maintain visual balance:\n * - Reference: XL (64px) with thickness 2 = 14px (~22%)\n * - Small avatars: min 8px for visibility\n * - Large avatars: max 18px to prevent oversizing\n */\nexport function getPresenceSize(\n avatarSize: number,\n thickness: 1 | 2 | 3\n): number {\n // Base size: 20% ratio, capped between 8-16px\n const baseSize = Math.min(16, Math.max(8, Math.round(avatarSize * 0.2)));\n // Add thickness adjustment (0, 2, or 4 pixels)\n return Math.min(18, baseSize + (thickness - 1) * 2);\n}\n\n/**\n * Format badge content (e.g., 99+ for large numbers)\n */\nexport function formatBadgeContent(\n content: string | number,\n max?: number\n): string {\n if (typeof content === \"string\") {\n return content;\n }\n if (max && content > max) {\n return `${max}+`;\n }\n return content.toString();\n}\n\n/**\n * Generate a gradient from colors array for ring effect\n */\nexport function createConicGradient(colors: string[]): string {\n if (colors.length === 0) {\n return \"transparent\";\n }\n if (colors.length === 1) {\n return colors[0];\n }\n\n const stops = colors.map((color, i) => {\n const start = (i / colors.length) * 360;\n const end = ((i + 1) / colors.length) * 360;\n return `${color} ${start}deg ${end}deg`;\n });\n\n return `conic-gradient(${stops.join(\", \")})`;\n}\n\n/**\n * Get contrast color for text on background\n * Returns white or black based on background luminance\n */\nexport function getContrastColor(bgColor: string): string {\n // Extract RGB values from hex\n if (!isHexColor(bgColor)) {\n return \"#ffffff\";\n }\n\n const hex = bgColor.replace(\"#\", \"\");\n const r = Number.parseInt(hex.slice(0, 2), 16);\n const g = Number.parseInt(hex.slice(2, 4), 16);\n const b = Number.parseInt(hex.slice(4, 6), 16);\n\n // Calculate relative luminance\n const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;\n\n return luminance > 0.5 ? \"#000000\" : \"#ffffff\";\n}\n\n/**\n * Clamp a number between min and max\n */\nexport function clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max);\n}\n\n/**\n * Generate a stable hash from string for consistent random colors\n */\nexport function hashString(str: string): number {\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n const char = str.charCodeAt(i);\n hash = (hash << 5) - hash + char;\n hash &= hash;\n }\n return Math.abs(hash);\n}\n\n/**\n * Create a progress ring gradient using conic gradient\n * @param progress Progress percentage (0-100)\n * @param filledColor Color for filled portion\n * @param emptyColor Color for empty portion\n * @returns CSS conic gradient string\n */\nexport function createProgressRingGradient(\n progress: number,\n filledColor: string,\n emptyColor: string\n): string {\n // Clamp progress to 0-100\n const clampedProgress = Math.max(0, Math.min(100, progress));\n // Convert percentage to degrees (start from top, go clockwise)\n // 0% = 0deg (top), 100% = 360deg (full circle)\n const progressDeg = (clampedProgress / 100) * 360;\n // Create conic gradient starting from top (270deg offset to start at 12 o'clock)\n // Then go clockwise: filled color from 0% to progress%, empty color from progress% to 100%\n return `conic-gradient(from 270deg, ${filledColor} 0deg ${progressDeg}deg, ${emptyColor} ${progressDeg}deg 360deg)`;\n}\n\n/**\n * Generate a gradient from name for fallback backgrounds\n */\nexport function generateAvatarGradient(name: string): string {\n const gradients = [\n \"linear-gradient(135deg, #667eea 0%, #764ba2 100%)\",\n \"linear-gradient(135deg, #f093fb 0%, #f5576c 100%)\",\n \"linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)\",\n \"linear-gradient(135deg, #43e97b 0%, #38f9d7 100%)\",\n \"linear-gradient(135deg, #fa709a 0%, #fee140 100%)\",\n \"linear-gradient(135deg, #a8edea 0%, #fed6e3 100%)\",\n \"linear-gradient(135deg, #d299c2 0%, #fef9d7 100%)\",\n \"linear-gradient(135deg, #89f7fe 0%, #66a6ff 100%)\",\n \"linear-gradient(135deg, #cd9cf2 0%, #f6f3ff 100%)\",\n \"linear-gradient(135deg, #fddb92 0%, #d1fdff 100%)\",\n ];\n\n const index = hashString(name) % gradients.length;\n return gradients[index];\n}\n\n/**\n * Curated 3-color pastel palettes for cloudy gradient fallback.\n * Each palette creates an organic, watercolor-like effect when\n * layered as overlapping radial gradients.\n */\nexport const CLOUDY_PALETTES: [string, string, string][] = [\n [\"#f4a261\", \"#e76f51\", \"#d4a5a5\"], // Warm sunset\n [\"#f2a9b0\", \"#e07a5f\", \"#d4c4a8\"], // Soft coral rose\n [\"#c9b1d0\", \"#e8a0bf\", \"#f0d1ce\"], // Dusty mauve\n [\"#89c2d9\", \"#a3c4bc\", \"#d5c6e0\"], // Ocean mist\n [\"#f7c59f\", \"#f2a07b\", \"#efcfe3\"], // Warm peach\n [\"#b5a7d5\", \"#d4a5c9\", \"#f0c3d7\"], // Lavender dream\n [\"#7ec8c8\", \"#6a9fb5\", \"#c2b5d6\"], // Cool teal\n [\"#f0b3ba\", \"#d4a5c9\", \"#c9d1d9\"], // Blush pink\n [\"#e8b960\", \"#d4956a\", \"#c9a5b8\"], // Amber cloud\n [\"#a7c4a0\", \"#c9d4a5\", \"#e0c9b1\"], // Sage pastel\n [\"#c4819b\", \"#d9a5b8\", \"#b5aed4\"], // Berry soft\n [\"#f0c27f\", \"#e0a87c\", \"#d4b5c9\"], // Golden hour\n];\n\n/**\n * Generate a cloudy, organic multi-layer radial gradient from a seed string.\n * Uses 3 overlapping radial-gradient layers with soft edges.\n * Deterministic: same seed always produces the same gradient.\n */\nexport function generateCloudyGradient(seed: string): string {\n const hash = hashString(seed);\n const palette = CLOUDY_PALETTES[hash % CLOUDY_PALETTES.length];\n\n // Derive unique positions from hash variations\n const h2 = hashString(seed + \"pos1\");\n const h3 = hashString(seed + \"pos2\");\n\n // Positions range from 20-80% to keep blobs within bounds\n const x1 = 20 + (hash % 61);\n const y1 = 20 + ((hash >> 4) % 61);\n const x2 = 20 + (h2 % 61);\n const y2 = 20 + ((h2 >> 4) % 61);\n const x3 = 20 + (h3 % 61);\n const y3 = 20 + ((h3 >> 4) % 61);\n\n return [\n `radial-gradient(circle at ${x1}% ${y1}%, ${palette[0]} 0%, transparent 70%)`,\n `radial-gradient(circle at ${x2}% ${y2}%, ${palette[1]} 0%, transparent 70%)`,\n `radial-gradient(circle at ${x3}% ${y3}%, ${palette[2]} 0%, transparent 70%)`,\n ].join(\", \");\n}\n\n/**\n * Apply will-change optimization for animations\n */\nexport function getWillChangeProperty(\n hasAnimation: boolean,\n hasHover: boolean\n): string | undefined {\n if (!(hasAnimation || hasHover)) {\n return undefined;\n }\n const properties: string[] = [];\n if (hasAnimation) {\n properties.push(\"opacity\");\n }\n if (hasHover) {\n properties.push(\"transform\");\n }\n return properties.join(\", \");\n}\n\n/**\n * Check if user prefers reduced motion\n */\nexport function prefersReducedMotion(): boolean {\n if (typeof window === \"undefined\") {\n return false;\n }\n return window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n}\n\n// ─── Profile Picture Group Utilities ─────────────────────────────────────────\n\nimport type { GroupUserData, PresenceStatus, StackDirection } from \"./types\";\nimport { GROUP_DEFAULTS } from \"./types\";\n\n/**\n * Calculate the pixel size for group avatars\n */\nexport function getGroupAvatarSize(size: Size | number): number {\n if (typeof size === \"number\") {\n return size;\n }\n return SIZE_MAP[size] ?? SIZE_MAP[GROUP_DEFAULTS.size];\n}\n\n/**\n * Calculate visible and hidden avatar counts\n */\nexport function calculateAvatarCounts(\n total: number,\n max: number,\n showAddButton: boolean\n): { visible: number; hidden: number; showCounter: boolean } {\n const effectiveMax = showAddButton ? max - 1 : max;\n\n if (total <= effectiveMax) {\n return { visible: total, hidden: 0, showCounter: false };\n }\n\n // Show (max - 1) avatars + counter\n const visible = effectiveMax - 1;\n const hidden = total - visible;\n return { visible, hidden, showCounter: true };\n}\n\n/**\n * Calculate position offset for stacked avatars\n */\nexport function calculateStackPosition(\n index: number,\n avatarSize: number,\n overlap: number,\n _direction: StackDirection,\n spacing?: number\n): number {\n const step = spacing ?? avatarSize * (1 - overlap);\n const offset = index * step;\n\n // For RTL, we need to reverse the positioning\n // This is handled at the component level by reversing the order\n return offset;\n}\n\n/**\n * Calculate z-index for stacked avatars\n * First avatar (index 0) has highest z-index to appear on top\n */\nexport function calculateStackZIndex(\n index: number,\n total: number,\n direction: StackDirection\n): number {\n if (direction === \"ltr\") {\n // LTR: First item on top (highest z-index)\n return total - index;\n }\n // RTL: Last item on top\n return index + 1;\n}\n\n/**\n * Calculate the total width of the stacked group\n */\nexport function calculateGroupWidth(\n count: number,\n avatarSize: number,\n overlap: number,\n spacing?: number\n): number {\n if (count === 0) {\n return 0;\n }\n if (count === 1) {\n return avatarSize;\n }\n\n const step = spacing ?? avatarSize * (1 - overlap);\n return avatarSize + step * (count - 1);\n}\n\n/**\n * Extract user data from a profile-picture element\n */\nexport function extractUserData(\n element: HTMLElement,\n index: number\n): GroupUserData {\n return {\n id: element.getAttribute(\"data-user-id\") ?? undefined,\n name: element.getAttribute(\"alt\") ?? `User ${index + 1}`,\n src: element.getAttribute(\"src\") ?? undefined,\n status:\n (element.getAttribute(\"data-status\") as PresenceStatus) ?? undefined,\n element,\n index,\n };\n}\n\n/**\n * Extract all user data from child profile-picture elements\n */\nexport function extractAllUserData(container: HTMLElement): GroupUserData[] {\n const children = container.querySelectorAll(\"profile-picture\");\n return Array.from(children).map((el, index) =>\n extractUserData(el as HTMLElement, index)\n );\n}\n\n/**\n * Get initials for counter display (e.g., \"+5\")\n */\nexport function formatCounterText(count: number): string {\n if (count > 99) {\n return \"+99\";\n }\n return `+${count}`;\n}\n\n/**\n * Calculate tooltip position relative to avatar\n */\nexport function calculateTooltipPosition(\n avatarRect: DOMRect,\n tooltipWidth: number,\n tooltipHeight: number,\n position: \"top\" | \"bottom\" | \"left\" | \"right\" = \"top\",\n gap = 8\n): { top: number; left: number } {\n const { top, left, width, height } = avatarRect;\n const centerX = left + width / 2;\n const centerY = top + height / 2;\n\n switch (position) {\n case \"top\":\n return {\n top: top - tooltipHeight - gap,\n left: centerX - tooltipWidth / 2,\n };\n case \"bottom\":\n return {\n top: top + height + gap,\n left: centerX - tooltipWidth / 2,\n };\n case \"left\":\n return {\n top: centerY - tooltipHeight / 2,\n left: left - tooltipWidth - gap,\n };\n case \"right\":\n return {\n top: centerY - tooltipHeight / 2,\n left: left + width + gap,\n };\n }\n}\n\n/**\n * Clamp tooltip position within viewport\n */\nexport function clampTooltipPosition(\n position: { top: number; left: number },\n tooltipWidth: number,\n tooltipHeight: number,\n padding = 8\n): { top: number; left: number } {\n const viewport = {\n width: typeof window !== \"undefined\" ? window.innerWidth : 1920,\n height: typeof window !== \"undefined\" ? window.innerHeight : 1080,\n };\n\n return {\n top: clamp(\n position.top,\n padding,\n viewport.height - tooltipHeight - padding\n ),\n left: clamp(\n position.left,\n padding,\n viewport.width - tooltipWidth - padding\n ),\n };\n}\n\n/**\n * Get CDN size label from pixel size (rounds up to next available size)\n * CDN sizes: 80, 120, 240, 480, 960\n */\nexport function getCdnSizeLabel(\n pixelSize: number\n): \"80\" | \"120\" | \"240\" | \"480\" | \"960\" {\n if (pixelSize <= 80) {\n return \"120\";\n }\n if (pixelSize <= 120) {\n return \"240\";\n }\n if (pixelSize <= 240) {\n return \"480\";\n }\n if (pixelSize <= 480) {\n return \"960\";\n }\n return \"960\";\n}\n\n/**\n * Construct CDN URL for profile picture\n * Format: {baseUrl}/api/profile-picture/cdn/{extId}_{size}_{imageMode}.webp?hostname={hostname}\n * @param imageMode - \"transparent\" for transparent background, \"original\" for original background\n */\nexport function constructCdnUrl(\n baseUrl: string,\n extCustomerId: string,\n sizeLabel: \"80\" | \"120\" | \"240\" | \"480\" | \"960\",\n imageMode: \"transparent\" | \"original\",\n hostname: string\n): string {\n // Remove trailing slash from baseUrl\n const cleanBaseUrl = baseUrl.endsWith(\"/\") ? baseUrl.slice(0, -1) : baseUrl;\n\n // Construct filename: {extId}_{size}_{imageMode}.webp\n const filename = `${extCustomerId}_${sizeLabel}_${imageMode}.webp`;\n\n // Construct full URL with hostname query parameter\n return `${cleanBaseUrl}/api/profile-picture/cdn/${filename}?hostname=${hostname}`;\n}\n","/**\n * Profile Picture Component - Styles & Animations\n * Apple-inspired design system with modern 2025 aesthetics\n */\n\nimport type { ShadowPreset, Variant } from \"./types\";\nimport { RADIUS_MAP, SHADOW_MAP } from \"./types\";\nimport { isHexColor } from \"./utils\";\n\n/**\n * Get variant-specific border radius styles\n */\nexport function getVariantStyles(variant: Variant): Record<string, string> {\n return { borderRadius: RADIUS_MAP[variant] };\n}\n\n/**\n * Get variant classes (Tailwind)\n */\nexport function getVariantClasses(variant: Variant): string {\n const variants: Record<Variant, string> = {\n circle: \"np:rounded-full\",\n rounded: \"np:rounded-xl\",\n squircle: \"np:rounded-[30%]\",\n square: \"np:rounded-none\",\n };\n return variants[variant];\n}\n\n/**\n * Get border styles\n */\nexport function getBorderClasses(\n width: 1 | 2 | 3 | 4 | 5 | 6 | 8,\n color: string\n): { className: string; style: Record<string, string> } {\n const widthClasses: Record<1 | 2 | 3 | 4 | 5 | 6 | 8, string> = {\n 1: \"np:border\",\n 2: \"np:border-2\",\n 3: \"np:border-[3px]\",\n 4: \"np:border-4\",\n 5: \"np:border-[5px]\",\n 6: \"np:border-[6px]\",\n 8: \"np:border-8\",\n };\n\n return {\n className: widthClasses[width],\n style: {\n borderColor: color,\n borderStyle: \"solid\",\n },\n };\n}\n\n/**\n * Get background styles (solid color or gradient)\n */\nexport function getBackgroundStyles(\n bgColor?: string,\n bgGradient?: string\n): { className: string; style?: Record<string, string> } {\n if (bgGradient) {\n return {\n className: \"\",\n style: { background: bgGradient },\n };\n }\n\n if (bgColor) {\n if (bgColor.includes(\"gradient\")) {\n return {\n className: \"\",\n style: { background: bgColor },\n };\n }\n return {\n className: \"\",\n style: { backgroundColor: bgColor },\n };\n }\n\n return { className: \"\", style: { backgroundColor: \"transparent\" } };\n}\n\n/**\n * Get shadow styles\n */\nexport function getShadowStyles(shadow: ShadowPreset): Record<string, string> {\n return { boxShadow: SHADOW_MAP[shadow] };\n}\n\n/**\n * CSS Keyframe animations - Apple-inspired, physics-based\n */\nexport const keyframes = {\n // Shimmer loading effect\n shimmer: `\n@keyframes pp-shimmer {\n 0% { transform: translateX(-100%); }\n 100% { transform: translateX(100%); }\n}`,\n\n // Pulse animation (gentle breathe effect)\n pulse: `\n@keyframes pp-pulse {\n 0%, 100% { opacity: 1; transform: scale(1); }\n 50% { opacity: 0.7; transform: scale(0.98); }\n}`,\n\n // Skeleton loading pulse\n skeleton: `\n@keyframes pp-skeleton {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.5; }\n}`,\n\n // Badge bounce entrance\n badgeBounce: `\n@keyframes pp-badge-bounce {\n 0% { transform: scale(0) translateY(10px); opacity: 0; }\n 50% { transform: scale(1.2) translateY(-2px); }\n 100% { transform: scale(1) translateY(0); opacity: 1; }\n}`,\n\n // Ring rotation (for gradient rings)\n ringRotate: `\n@keyframes pp-ring-rotate {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n}`,\n\n // Presence indicator pulse\n presencePulse: `\n@keyframes pp-presence-pulse {\n 0%, 100% { box-shadow: 0 0 0 0 currentColor; }\n 50% { box-shadow: 0 0 0 4px transparent; }\n}`,\n\n // Glow animation\n glow: `\n@keyframes pp-glow {\n 0%, 100% { box-shadow: 0 0 20px 0 var(--pp-glow-color, rgba(99, 102, 241, 0.3)); }\n 50% { box-shadow: 0 0 30px 5px var(--pp-glow-color, rgba(99, 102, 241, 0.5)); }\n}`,\n\n // Fade in\n fadeIn: `\n@keyframes pp-fade-in {\n from { opacity: 0; }\n to { opacity: 1; }\n}`,\n\n // Scale in (spring-like)\n scaleIn: `\n@keyframes pp-scale-in {\n 0% { transform: scale(0.8); opacity: 0; }\n 50% { transform: scale(1.05); }\n 100% { transform: scale(1); opacity: 1; }\n}`,\n};\n\n/**\n * All keyframes combined for injection\n */\nexport const allKeyframes = Object.values(keyframes).join(\"\\n\");\n\n/**\n * Component base styles\n */\nexport const baseStyles = `\n/* Profile Picture Component Styles */\n.pp-container {\n --pp-transition-duration: 200ms;\n --pp-transition-timing: cubic-bezier(0.4, 0, 0.2, 1);\n --pp-spring-timing: cubic-bezier(0.34, 1.56, 0.64, 1);\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n user-select: none;\n -webkit-user-select: none;\n flex-shrink: 0;\n}\n\n/* Inner container for image clipping - allows badges/rings to overflow */\n/* Background is applied here (not on container) to prevent sub-pixel bleed-through */\n.pp-inner {\n position: absolute;\n inset: 0;\n overflow: hidden;\n border-radius: inherit;\n}\n\n/* Interactive states */\n.pp-interactive {\n cursor: pointer;\n transition: transform var(--pp-transition-duration) var(--pp-spring-timing),\n box-shadow var(--pp-transition-duration) var(--pp-transition-timing);\n}\n\n.pp-interactive:hover {\n transform: scale(1.05);\n}\n\n.pp-interactive:active {\n transform: scale(0.95);\n}\n\n.pp-interactive:focus-visible {\n outline: none;\n box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.5);\n}\n\n/* Image styles */\n.pp-image {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n object-fit: cover;\n transition: opacity var(--pp-transition-duration) var(--pp-transition-timing);\n}\n\n.pp-image-loading {\n opacity: 0;\n}\n\n.pp-image-loaded {\n opacity: 1;\n}\n\n/* Fallback styles */\n.pp-fallback {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n font-weight: 500;\n color: rgba(255, 255, 255, 0.9);\n text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);\n font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;\n letter-spacing: 0.02em;\n}\n\n.pp-fallback-icon {\n color: rgba(156, 163, 175, 0.8);\n}\n\n/* Shimmer placeholder */\n.pp-shimmer {\n position: absolute;\n inset: 0;\n overflow: hidden;\n}\n\n.pp-shimmer::after {\n content: '';\n position: absolute;\n inset: 0;\n background: linear-gradient(\n 90deg,\n transparent 0%,\n rgba(255, 255, 255, 0.4) 50%,\n transparent 100%\n );\n animation: pp-shimmer 1.5s infinite;\n}\n\n/* Pulse placeholder */\n.pp-pulse {\n animation: pp-pulse 2s ease-in-out infinite;\n}\n\n/* Skeleton placeholder */\n.pp-skeleton {\n background: linear-gradient(90deg, #e5e7eb 0%, #f3f4f6 50%, #e5e7eb 100%);\n background-size: 200% 100%;\n animation: pp-skeleton 1.5s ease-in-out infinite;\n}\n\n/* Badge styles */\n.pp-badge {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n font-weight: 600;\n font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;\n line-height: 1;\n animation: pp-badge-bounce 0.4s var(--pp-spring-timing);\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);\n}\n\n.pp-badge-with-icon {\n gap: 4px;\n}\n\n.pp-badge-icon {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n line-height: 1;\n flex-shrink: 0;\n}\n\n.pp-badge-pulse {\n animation: pp-badge-bounce 0.4s var(--pp-spring-timing),\n pp-presence-pulse 2s ease-in-out infinite 0.4s;\n}\n\n.pp-badge-glow {\n box-shadow: 0 0 10px 2px var(--pp-badge-glow-color, currentColor);\n}\n\n/* Ring effect (Instagram-style) */\n.pp-ring {\n position: absolute;\n inset: -4px;\n border-radius: inherit;\n padding: 3px;\n background: var(--pp-ring-color, linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888));\n -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);\n mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);\n -webkit-mask-composite: xor;\n mask-composite: exclude;\n transition: background 0.3s ease;\n}\n\n.pp-ring-animated {\n animation: pp-ring-rotate 3s linear infinite;\n}\n\n.pp-ring-progress {\n /* Progress rings should not animate rotation */\n animation: none;\n}\n\n/* Presence indicator */\n.pp-presence {\n position: absolute;\n bottom: 0;\n right: 0;\n border-radius: 9999px;\n border: 2px solid white;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);\n}\n\n.pp-presence-animated {\n animation: pp-presence-pulse 2s ease-in-out infinite;\n}\n\n/* Glow effect */\n.pp-glow {\n animation: pp-glow 2s ease-in-out infinite;\n}\n\n/* Reduced motion support */\n@media (prefers-reduced-motion: reduce) {\n .pp-container,\n .pp-interactive,\n .pp-image,\n .pp-shimmer::after,\n .pp-pulse,\n .pp-skeleton,\n .pp-badge,\n .pp-ring-animated,\n .pp-presence-animated,\n .pp-glow {\n animation: none !important;\n transition: none !important;\n }\n}\n`;\n\n/**\n * All styles combined (keyframes + base styles)\n */\nexport const componentStyles = `${allKeyframes}\\n${baseStyles}`;\n\n/**\n * Shimmer styles for inline injection (legacy support)\n */\nexport const shimmerStyles = `\n@keyframes np-shimmer {\n 0% { background-position: -200% 0; }\n 100% { background-position: 200% 0; }\n}\n.np-shimmer {\n background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.4) 50%, transparent 100%);\n background-size: 200% 100%;\n animation: np-shimmer 1.5s infinite;\n}\n`;\n\n/**\n * Generate glow shadow with custom color\n */\nexport function getGlowShadow(color: string, intensity = 0.3): string {\n if (isHexColor(color)) {\n // Convert hex to rgba\n const r = Number.parseInt(color.slice(1, 3), 16);\n const g = Number.parseInt(color.slice(3, 5), 16);\n const b = Number.parseInt(color.slice(5, 7), 16);\n return `0 0 20px 0 rgba(${r}, ${g}, ${b}, ${intensity})`;\n }\n return `0 0 20px 0 ${color}`;\n}\n\n/**\n * Get shimmer classes (legacy)\n */\nexport function getShimmerClasses(): string {\n return \"np-shimmer\";\n}\n\n// ─── Profile Picture Group Styles ────────────────────────────────────────────\n\n/**\n * Group component keyframe animations\n */\nexport const groupKeyframes = `\n@keyframes ppg-tooltip-in {\n from {\n opacity: 0;\n transform: translateX(-50%) translateY(4px) scale(0.96);\n }\n to {\n opacity: 1;\n transform: translateX(-50%) translateY(0) scale(1);\n }\n}\n\n@keyframes ppg-dropdown-in {\n from {\n opacity: 0;\n transform: translateY(-6px) scale(0.95);\n }\n to {\n opacity: 1;\n transform: translateY(0) scale(1);\n }\n}\n\n@keyframes ppg-avatar-lift {\n from {\n transform: translateY(0) scale(1);\n }\n to {\n transform: translateY(-4px) scale(1.08);\n }\n}\n\n@keyframes ppg-modal-in {\n from {\n opacity: 0;\n transform: translate(-50%, -50%) scale(0.9);\n }\n to {\n opacity: 1;\n transform: translate(-50%, -50%) scale(1);\n }\n}\n\n@keyframes ppg-backdrop-in {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n`;\n\n/**\n * Group component base styles - Apple-inspired\n */\nexport const groupBaseStyles = `\n/* Profile Picture Group Container */\n.ppg-container {\n --ppg-transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);\n --ppg-spring: 300ms cubic-bezier(0.34, 1.56, 0.64, 1);\n --ppg-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);\n --ppg-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);\n --ppg-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);\n --ppg-radius: 12px;\n --ppg-counter-bg: #f5f5f7;\n --ppg-counter-text: #1d1d1f;\n --ppg-add-bg: #f5f5f7;\n --ppg-add-hover: #e8e8ed;\n --ppg-add-icon: #86868b;\n --ppg-border: rgba(0, 0, 0, 0.08);\n --ppg-tooltip-bg: rgba(29, 29, 31, 0.95);\n --ppg-tooltip-text: #ffffff;\n --ppg-dropdown-bg: #ffffff;\n --ppg-dropdown-hover: #f5f5f7;\n\n position: relative;\n display: inline-flex;\n align-items: center;\n isolation: isolate;\n}\n\n/* Avatar wrapper for positioning */\n.ppg-avatar-wrapper {\n position: absolute;\n top: 0;\n transition: transform var(--ppg-spring), z-index 0s;\n cursor: pointer;\n border-radius: 9999px;\n}\n\n.ppg-avatar-wrapper:focus-visible {\n outline: none;\n box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.4);\n}\n\n/* Hover lift animation */\n.ppg-animated .ppg-avatar-wrapper:hover {\n z-index: 100 !important;\n animation: ppg-avatar-lift var(--ppg-spring) forwards;\n}\n\n.ppg-avatar-wrapper:hover {\n z-index: 100 !important;\n}\n\n/* Nested profile-picture styling */\n.ppg-avatar-wrapper profile-picture {\n display: block;\n width: 100%;\n height: 100%;\n border-radius: inherit;\n}\n\n/* Counter button */\n.ppg-counter {\n position: absolute;\n top: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 9999px;\n background: var(--ppg-counter-bg);\n color: var(--ppg-counter-text);\n font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;\n font-weight: 600;\n font-size: 13px;\n letter-spacing: -0.01em;\n cursor: pointer;\n border: none;\n box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.95), var(--ppg-shadow-sm);\n transition: transform var(--ppg-spring), background-color var(--ppg-transition);\n user-select: none;\n -webkit-user-select: none;\n}\n\n.ppg-counter:hover {\n background: #ebebed;\n transform: scale(1.05);\n}\n\n.ppg-counter:active {\n transform: scale(0.98);\n}\n\n.ppg-counter:focus-visible {\n outline: none;\n box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.95), 0 0 0 4px rgba(0, 122, 255, 0.4);\n}\n\n/* Add button */\n.ppg-add-button {\n position: absolute;\n top: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 9999px;\n background: var(--ppg-add-bg);\n border: 2px dashed var(--ppg-border);\n cursor: pointer;\n transition: all var(--ppg-spring);\n box-shadow: var(--ppg-shadow-sm);\n}\n\n.ppg-add-button:hover {\n background: var(--ppg-add-hover);\n border-color: rgba(0, 0, 0, 0.15);\n transform: scale(1.05);\n}\n\n.ppg-add-button:active {\n transform: scale(0.98);\n}\n\n.ppg-add-button:focus-visible {\n outline: none;\n box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.4);\n}\n\n.ppg-add-icon {\n color: var(--ppg-add-icon);\n transition: color var(--ppg-transition);\n}\n\n.ppg-add-button:hover .ppg-add-icon {\n color: #1d1d1f;\n}\n\n/* Tooltip */\n.ppg-tooltip {\n position: absolute;\n z-index: 9999;\n padding: 6px 12px;\n background: var(--ppg-tooltip-bg);\n color: var(--ppg-tooltip-text);\n font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;\n font-size: 13px;\n font-weight: 500;\n border-radius: 8px;\n box-shadow: var(--ppg-shadow-lg);\n pointer-events: none;\n white-space: nowrap;\n transform: translateX(-50%);\n animation: ppg-tooltip-in 150ms ease-out forwards;\n backdrop-filter: blur(20px);\n -webkit-backdrop-filter: blur(20px);\n}\n\n.ppg-tooltip::after {\n content: '';\n position: absolute;\n width: 8px;\n height: 8px;\n background: inherit;\n transform: rotate(45deg);\n}\n\n.ppg-tooltip[data-position=\"top\"]::after {\n bottom: -4px;\n left: 50%;\n margin-left: -4px;\n}\n\n.ppg-tooltip[data-position=\"bottom\"]::after {\n top: -4px;\n left: 50%;\n margin-left: -4px;\n}\n\n/* Dropdown */\n.ppg-dropdown {\n position: absolute;\n z-index: 9998;\n right: 0;\n min-width: 220px;\n max-width: 300px;\n background: var(--ppg-dropdown-bg);\n border-radius: 14px;\n box-shadow:\n 0 4px 24px rgba(0, 0, 0, 0.12),\n 0 1px 4px rgba(0, 0, 0, 0.08),\n 0 0 0 1px var(--ppg-border);\n overflow: hidden;\n animation: ppg-dropdown-in 200ms cubic-bezier(0.32, 0.72, 0, 1) forwards;\n transform-origin: top right;\n backdrop-filter: blur(20px);\n -webkit-backdrop-filter: blur(20px);\n}\n\n.ppg-dropdown[data-position=\"bottom\"] {\n top: calc(100% + 10px);\n}\n\n.ppg-dropdown[data-position=\"top\"] {\n bottom: calc(100% + 10px);\n transform-origin: bottom right;\n}\n\n/* Modal style for mobile */\n.ppg-dropdown[data-position=\"modal\"] {\n transform-origin: center center;\n animation: ppg-modal-in 250ms cubic-bezier(0.32, 0.72, 0, 1) forwards;\n border-radius: 20px;\n}\n\n.ppg-backdrop-visible {\n background: rgba(0, 0, 0, 0.4);\n animation: ppg-backdrop-in 200ms ease-out forwards;\n}\n\n.ppg-dropdown-header {\n padding: 14px 16px 10px;\n font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;\n font-size: 11px;\n font-weight: 600;\n color: #86868b;\n text-transform: uppercase;\n letter-spacing: 0.06em;\n background: linear-gradient(to bottom, rgba(0,0,0,0.02), transparent);\n}\n\n.ppg-dropdown-list {\n overflow-y: auto;\n padding: 6px;\n scrollbar-width: thin;\n scrollbar-color: rgba(0,0,0,0.2) transparent;\n}\n\n.ppg-dropdown-list::-webkit-scrollbar {\n width: 6px;\n}\n\n.ppg-dropdown-list::-webkit-scrollbar-track {\n background: transparent;\n}\n\n.ppg-dropdown-list::-webkit-scrollbar-thumb {\n background: rgba(0,0,0,0.15);\n border-radius: 3px;\n}\n\n.ppg-dropdown-item {\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 10px 12px;\n cursor: pointer;\n border-radius: 10px;\n transition: all 150ms ease;\n margin: 2px 0;\n}\n\n.ppg-dropdown-item:hover {\n background: var(--ppg-dropdown-hover);\n transform: translateX(2px);\n}\n\n.ppg-dropdown-item:focus-visible {\n outline: none;\n background: var(--ppg-dropdown-hover);\n box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.4);\n}\n\n.ppg-dropdown-item:active {\n transform: scale(0.98);\n}\n\n.ppg-dropdown-avatar {\n flex-shrink: 0;\n width: 36px;\n height: 36px;\n border-radius: 9999px;\n object-fit: cover;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);\n border: 2px solid rgba(255, 255, 255, 0.8);\n}\n\n.ppg-dropdown-avatar-fallback {\n flex-shrink: 0;\n width: 36px;\n height: 36px;\n border-radius: 9999px;\n display: flex;\n align-items: center;\n justify-content: center;\n font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif;\n font-size: 13px;\n font-weight: 600;\n color: white;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\n border: 2px solid rgba(255, 255, 255, 0.3);\n}\n\n.ppg-dropdown-info {\n flex: 1;\n min-width: 0;\n padding-right: 4px;\n text-align: left;\n}\n\n.ppg-dropdown-name {\n font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;\n font-size: 14px;\n font-weight: 500;\n color: #1d1d1f;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n line-height: 1.3;\n text-align: left;\n}\n\n.ppg-dropdown-status {\n display: flex;\n align-items: center;\n gap: 5px;\n font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;\n font-size: 12px;\n color: #86868b;\n margin-top: 2px;\n line-height: 1.2;\n}\n\n.ppg-dropdown-presence {\n width: 7px;\n height: 7px;\n border-radius: 9999px;\n flex-shrink: 0;\n box-shadow: 0 0 0 1.5px var(--ppg-dropdown-bg);\n}\n\n.ppg-dropdown-presence[data-status=\"online\"] {\n background: #30D158;\n box-shadow: 0 0 0 1.5px var(--ppg-dropdown-bg), 0 0 6px rgba(48, 209, 88, 0.5);\n}\n\n.ppg-dropdown-presence[data-status=\"away\"] {\n background: #FFD60A;\n}\n\n.ppg-dropdown-presence[data-status=\"busy\"],\n.ppg-dropdown-presence[data-status=\"dnd\"] {\n background: #FF453A;\n}\n\n.ppg-dropdown-presence[data-status=\"offline\"] {\n background: #8E8E93;\n}\n\n/* Backdrop for dropdown */\n.ppg-backdrop {\n position: fixed;\n inset: 0;\n z-index: 9997;\n}\n\n/* Reduced motion */\n@media (prefers-reduced-motion: reduce) {\n .ppg-container,\n .ppg-avatar-wrapper,\n .ppg-counter,\n .ppg-add-button,\n .ppg-tooltip,\n .ppg-dropdown {\n animation: none !important;\n transition: none !important;\n }\n\n .ppg-animated .ppg-avatar-wrapper:hover {\n animation: none !important;\n transform: none !important;\n }\n}\n\n/* Dark mode support */\n@media (prefers-color-scheme: dark) {\n .ppg-container {\n --ppg-counter-bg: #2c2c2e;\n --ppg-counter-text: #ffffff;\n --ppg-add-bg: #2c2c2e;\n --ppg-add-hover: #3a3a3c;\n --ppg-add-icon: #98989d;\n --ppg-border: rgba(255, 255, 255, 0.1);\n --ppg-dropdown-bg: #2c2c2e;\n --ppg-dropdown-hover: #3a3a3c;\n }\n\n .ppg-avatar-wrapper profile-picture {\n box-shadow: 0 0 6px 1.5px rgb(28 28 30 / 16%), var(--ppg-shadow-sm);\n }\n\n .ppg-counter {\n box-shadow: 0 0 0 1.5px rgba(28, 28, 30, 0.95), var(--ppg-shadow-sm);\n }\n\n .ppg-counter:hover {\n background: #3a3a3c;\n }\n\n .ppg-dropdown {\n background: rgba(44, 44, 46, 0.95);\n box-shadow:\n 0 4px 24px rgba(0, 0, 0, 0.4),\n 0 1px 4px rgba(0, 0, 0, 0.2),\n 0 0 0 1px rgba(255, 255, 255, 0.08);\n }\n\n .ppg-dropdown-name {\n color: #ffffff;\n }\n\n .ppg-dropdown-header {\n color: #98989d;\n background: linear-gradient(to bottom, rgba(255,255,255,0.03), transparent);\n }\n\n .ppg-dropdown-avatar {\n border-color: rgba(255, 255, 255, 0.15);\n }\n\n .ppg-dropdown-avatar-fallback {\n border-color: rgba(255, 255, 255, 0.1);\n }\n\n .ppg-dropdown-list {\n scrollbar-color: rgba(255,255,255,0.35) transparent;\n }\n\n .ppg-dropdown-list::-webkit-scrollbar-thumb {\n background: rgba(255,255,255,0.35);\n }\n\n .ppg-dropdown-presence {\n box-shadow: 0 0 0 1.5px rgba(44, 44, 46, 0.95);\n }\n\n .ppg-dropdown-presence[data-status=\"online\"] {\n box-shadow: 0 0 0 1.5px rgba(44, 44, 46, 0.95), 0 0 6px rgba(48, 209, 88, 0.5);\n }\n}\n`;\n\n/**\n * All group styles combined\n */\nexport const groupStyles = `${groupKeyframes}\\n${groupBaseStyles}`;\n","/**\n * ProfilePicture Web Component\n * Apple-inspired design system with modern 2025 aesthetics\n *\n * A lightweight, framework-agnostic profile picture component\n * with advanced features: presence indicators, rings, and badges.\n */\n\nimport { html, LitElement, nothing } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\nimport { styleMap } from \"lit/directives/style-map.js\";\nimport {\n componentStyles,\n getBackgroundStyles,\n getBorderClasses,\n getGlowShadow,\n getShadowStyles,\n getVariantClasses,\n shimmerStyles,\n} from \"./styles\";\nimport type {\n BadgeConfig,\n GlowConfig,\n InteractionConfig,\n LoadingStrategy,\n PlaceholderType,\n Position,\n PresenceConfig,\n RingConfig,\n ShadowPreset,\n Size,\n Variant,\n} from \"./types\";\nimport { DEFAULTS, PRESENCE_COLORS, RADIUS_MAP, SIZE_MAP } from \"./types\";\nimport {\n cn,\n constructCdnUrl,\n createConicGradient,\n createProgressRingGradient,\n formatBadgeContent,\n generateAvatarGradient,\n generateCloudyGradient,\n getBadgeSize,\n getCdnSizeLabel,\n getInitials,\n getInitialsFontSize,\n getPresenceSize,\n} from \"./utils\";\n\nexport class ProfilePicture extends LitElement {\n private static stylesInjected = false;\n private static cdnBaseUrl = \"\";\n private static instances = new Set<ProfilePicture>();\n\n /**\n * Set global CDN base URL for all ProfilePicture instances\n * @example ProfilePicture.setCdnBaseUrl('https://api.example.com')\n */\n public static setCdnBaseUrl(url: string): void {\n ProfilePicture.cdnBaseUrl = url;\n // Notify all existing instances to reload if they have extCustomerId\n ProfilePicture.instances.forEach((instance) => {\n if (instance.extCustomerId && !instance.cdnImageUrl) {\n // Reset failure state (CDN base URL change = legitimate retry)\n instance.cdnLoadFailed = false;\n // Clear any scheduled retry\n if (instance.retryTimeoutId) {\n clearTimeout(instance.retryTimeoutId);\n instance.retryTimeoutId = undefined;\n }\n if (!instance.previousExtCustomerId) {\n instance.previousExtCustomerId = instance.extCustomerId;\n }\n instance.loadCdnImage();\n }\n });\n }\n\n /**\n * Get current CDN base URL\n */\n public static getCdnBaseUrl(): string {\n return ProfilePicture.cdnBaseUrl;\n }\n\n // Use Light DOM for Tailwind compatibility\n protected createRenderRoot() {\n ProfilePicture.injectStylesOnce();\n return this;\n }\n\n private static injectStylesOnce() {\n if (ProfilePicture.stylesInjected || typeof document === \"undefined\") {\n return;\n }\n\n // Defer style injection to avoid hydration mismatch in SSR frameworks\n const defer =\n typeof requestIdleCallback !== \"undefined\"\n ? requestIdleCallback\n : (cb: () => void) => setTimeout(cb, 1);\n\n defer(() => {\n // Re-check in case another instance already injected\n if (ProfilePicture.stylesInjected) {\n return;\n }\n const style = document.createElement(\"style\");\n style.textContent = componentStyles;\n document.head.appendChild(style);\n ProfilePicture.stylesInjected = true;\n });\n }\n\n // ─── Core Properties ────────────────────────────────────────────────────────\n @property({ type: String }) src = \"\";\n @property({ type: String }) alt = \"\";\n @property({ type: String, attribute: \"ext-customer-id\" })\n extCustomerId?: string;\n\n // ─── Sizing ─────────────────────────────────────────────────────────────────\n @property({ type: String }) size: Size | string = DEFAULTS.size;\n\n // ─── Visual Variant ─────────────────────────────────────────────────────────\n @property({ type: String }) variant: Variant = DEFAULTS.variant;\n\n // ─── Shadow ─────────────────────────────────────────────────────────────────\n @property({ type: String }) shadow: ShadowPreset = DEFAULTS.shadow;\n\n // ─── Border ─────────────────────────────────────────────────────────────────\n @property({ type: Boolean }) border = false;\n @property({ type: Number, attribute: \"border-width\" }) borderWidth:\n | 1\n | 2\n | 3\n | 4\n | 5\n | 6\n | 8 = DEFAULTS.borderWidth;\n @property({ type: String, attribute: \"border-color\" }) borderColor: string =\n DEFAULTS.borderColor;\n\n // ─── Rotation ───────────────────────────────────────────────────────────────\n @property({ type: Number }) rotation = 0;\n\n // ─── Zoom ─────────────────────────────────────────────────────────────────\n @property({ type: Number }) zoom: number = DEFAULTS.zoom;\n\n // ─── Background ─────────────────────────────────────────────────────────────\n @property({ type: String, attribute: \"bg-color\" }) bgColor?: string;\n @property({ type: String, attribute: \"bg-gradient\" }) bgGradient?: string;\n\n // ─── Ring Effect (Instagram-style) ──────────────────────────────────────────\n @property({\n type: Object,\n attribute: \"ring\",\n converter: {\n fromAttribute: (value: string | null): RingConfig | undefined => {\n if (!value) return undefined;\n try {\n return JSON.parse(value) as RingConfig;\n } catch {\n return undefined;\n }\n },\n toAttribute: (value: RingConfig | undefined): string | null => {\n return value ? JSON.stringify(value) : null;\n },\n },\n })\n ring?: RingConfig;\n\n // ─── Presence Indicator ─────────────────────────────────────────────────────\n @property({\n type: Object,\n attribute: \"presence\",\n converter: {\n fromAttribute: (value: string | null): PresenceConfig | undefined => {\n if (!value) return undefined;\n try {\n return JSON.parse(value) as PresenceConfig;\n } catch {\n return undefined;\n }\n },\n toAttribute: (value: PresenceConfig | undefined): string | null => {\n return value ? JSON.stringify(value) : null;\n },\n },\n })\n presence?: PresenceConfig;\n\n // ─── Glow Effect ────────────────────────────────────────────────────────────\n @property({\n type: Object,\n attribute: \"glow\",\n converter: {\n fromAttribute: (value: string | null): GlowConfig | undefined => {\n if (!value) return undefined;\n try {\n return JSON.parse(value) as GlowConfig;\n } catch {\n return undefined;\n }\n },\n toAttribute: (value: GlowConfig | undefined): string | null => {\n return value ? JSON.stringify(value) : null;\n },\n },\n })\n glow?: GlowConfig;\n\n // ─── Badge ──────────────────────────────────────────────────────────────────\n @property({\n type: Object,\n attribute: \"badge\",\n converter: {\n fromAttribute: (value: string | null): BadgeConfig | undefined => {\n if (!value) return undefined;\n try {\n return JSON.parse(value) as BadgeConfig;\n } catch {\n return undefined;\n }\n },\n toAttribute: (value: BadgeConfig | undefined): string | null => {\n return value ? JSON.stringify(value) : null;\n },\n },\n })\n badge?: BadgeConfig;\n\n // ─── Loading & Performance ──────────────────────────────────────────────────\n @property({ type: String }) loading: LoadingStrategy = DEFAULTS.loading;\n @property({ type: String }) placeholder: PlaceholderType =\n DEFAULTS.placeholder;\n @property({ type: String, attribute: \"placeholder-color\" })\n placeholderColor: string = DEFAULTS.placeholderColor;\n\n // ─── Fallback ───────────────────────────────────────────────────────────────\n @property({ type: String }) fallback?: string;\n\n // ─── Fallback Mode ────────────────────────────────────────────────────────\n @property({ type: String, attribute: \"fallback-mode\" })\n fallbackMode?: \"initials\" | \"gradient\";\n\n // ─── Image Mode ────────────────────────────────────────────────────────────\n @property({ type: String, attribute: \"image-mode\" })\n imageMode: \"transparent\" | \"original\" = \"original\";\n\n // ─── Interaction ────────────────────────────────────────────────────────────\n @property({\n type: Object,\n attribute: \"interactive\",\n converter: {\n fromAttribute: (value: string | null): InteractionConfig | undefined => {\n if (!value) return undefined;\n try {\n return JSON.parse(value) as InteractionConfig;\n } catch {\n return undefined;\n }\n },\n toAttribute: (value: InteractionConfig | undefined): string | null => {\n return value ? JSON.stringify(value) : null;\n },\n },\n })\n interactive?: InteractionConfig;\n\n // ─── Internal State ─────────────────────────────────────────────────────────\n @state() private isLoaded = false;\n @state() private hasError = false;\n @state() private cdnImageUrl?: string;\n @state() private cdnLoadFailed = false;\n private previousSrc = \"\";\n private previousExtCustomerId?: string;\n private retryTimeoutId?: ReturnType<typeof setTimeout>;\n private randomSeed = Math.random().toString(36).slice(2);\n private readonly RETRY_DELAY_MS = 30_000; // 30 seconds\n\n private get pixelSize(): number {\n const sizeValue = this.size as Size | number;\n return typeof sizeValue === \"number\"\n ? sizeValue\n : (SIZE_MAP[sizeValue as Size] ?? SIZE_MAP[DEFAULTS.size]);\n }\n\n /**\n * Resolve the seed for cloudy gradient from available identifiers.\n * Priority: extCustomerId > alt > src > random instance seed\n */\n private get gradientSeed(): string {\n return this.extCustomerId || this.alt || this.src || this.randomSeed;\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n // Register this instance\n ProfilePicture.instances.add(this);\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n // Unregister this instance\n ProfilePicture.instances.delete(this);\n // Clear any scheduled retry\n if (this.retryTimeoutId) {\n clearTimeout(this.retryTimeoutId);\n this.retryTimeoutId = undefined;\n }\n }\n\n protected firstUpdated(): void {\n // Trigger CDN loading on initial render if extCustomerId is present\n if (this.extCustomerId && ProfilePicture.cdnBaseUrl) {\n this.previousExtCustomerId = this.extCustomerId;\n this.loadCdnImage();\n }\n }\n\n protected updated(changedProperties: Map<string, unknown>): void {\n super.updated(changedProperties);\n // Handle: CDN base URL set AFTER element creation\n // (previousExtCustomerId is only set when firstUpdated or willUpdate triggers a CDN load)\n if (\n this.extCustomerId &&\n ProfilePicture.cdnBaseUrl &&\n !this.cdnImageUrl &&\n !this.previousExtCustomerId\n ) {\n this.previousExtCustomerId = this.extCustomerId;\n this.cdnLoadFailed = false;\n this.loadCdnImage();\n }\n }\n\n protected willUpdate(changedProperties: Map<string, unknown>): void {\n if (changedProperties.has(\"src\") && this.src !== this.previousSrc) {\n this.isLoaded = false;\n this.hasError = false;\n this.previousSrc = this.src;\n }\n\n // Trigger CDN loading when relevant properties change\n const extCustomerIdChanged =\n changedProperties.has(\"extCustomerId\") &&\n this.extCustomerId !== this.previousExtCustomerId;\n const cdnParamsChanged =\n changedProperties.has(\"size\") || changedProperties.has(\"imageMode\");\n\n if (extCustomerIdChanged || (cdnParamsChanged && this.extCustomerId)) {\n this.previousExtCustomerId = this.extCustomerId;\n // Reset CDN state (property change = legitimate reload)\n this.cdnImageUrl = undefined;\n this.cdnLoadFailed = false;\n this.isLoaded = false;\n this.hasError = false;\n // Clear any scheduled retry\n if (this.retryTimeoutId) {\n clearTimeout(this.retryTimeoutId);\n this.retryTimeoutId = undefined;\n }\n // Start CDN loading\n this.loadCdnImage();\n }\n }\n\n private handleLoad() {\n this.isLoaded = true;\n this.dispatchEvent(\n new CustomEvent(\"load\", { bubbles: true, composed: true })\n );\n }\n\n private handleClick(event: MouseEvent) {\n if (!this.interactive?.pressable) return;\n this.dispatchEvent(\n new CustomEvent(\"profile-picture-click\", {\n bubbles: true,\n composed: true,\n detail: {\n extCustomerId: this.extCustomerId,\n alt: this.alt,\n src: this.src,\n },\n })\n );\n }\n\n private handleKeyDown(event: KeyboardEvent) {\n if (!this.interactive?.pressable) return;\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n this.handleClick(event as unknown as MouseEvent);\n }\n }\n\n private handleError() {\n // If CDN image failed, mark it and schedule retry\n if (this.cdnImageUrl && !this.cdnLoadFailed) {\n this.cdnLoadFailed = true;\n this.cdnImageUrl = undefined;\n\n // Dispatch CDN error event\n this.dispatchEvent(\n new CustomEvent(\"cdn-error\", {\n bubbles: true,\n composed: true,\n detail: { error: \"Image load failed\" },\n })\n );\n\n // Schedule a retry after delay\n if (this.retryTimeoutId) {\n clearTimeout(this.retryTimeoutId);\n }\n this.retryTimeoutId = setTimeout(() => {\n this.retryTimeoutId = undefined;\n if (this.extCustomerId && ProfilePicture.cdnBaseUrl) {\n this.cdnLoadFailed = false;\n this.hasError = false;\n this.isLoaded = false;\n this.loadCdnImage();\n }\n }, this.RETRY_DELAY_MS);\n\n // Don't mark hasError yet - fallback (src prop) may work\n return;\n }\n\n this.hasError = true;\n this.isLoaded = true;\n this.dispatchEvent(\n new CustomEvent(\"error\", { bubbles: true, composed: true })\n );\n }\n\n /**\n * Construct CDN URL for profile picture using ext-customer-id\n * Uses direct image src binding - browser handles redirects automatically\n */\n private loadCdnImage(): void {\n // Skip if no extCustomerId or no CDN base URL configured\n if (!(this.extCustomerId && ProfilePicture.cdnBaseUrl)) {\n this.cdnLoadFailed = true;\n return;\n }\n\n // Calculate CDN parameters\n const sizeLabel = getCdnSizeLabel(this.pixelSize);\n const hostname =\n typeof window !== \"undefined\" ? window.location.hostname : \"localhost\";\n\n // Set the CDN URL directly - browser will handle redirects via img src\n this.cdnImageUrl = constructCdnUrl(\n ProfilePicture.cdnBaseUrl,\n this.extCustomerId,\n sizeLabel,\n this.imageMode,\n hostname\n );\n }\n\n private getContainerStyles() {\n const bg = getBackgroundStyles(this.bgColor, this.bgGradient);\n const borderStyles = this.border\n ? getBorderClasses(this.borderWidth, this.borderColor)\n : null;\n const shadowStyles = getShadowStyles(this.shadow);\n\n // Handle glow effect\n let glowStyles: Record<string, string> = {};\n if (this.glow) {\n const glowColor = this.glow.color ?? this.borderColor ?? \"#6366f1\";\n glowStyles = {\n \"--pp-glow-color\": glowColor,\n boxShadow: getGlowShadow(glowColor, this.glow.intensity ?? 0.3),\n };\n }\n\n const isInteractive =\n this.interactive?.hoverable || this.interactive?.pressable;\n\n return {\n classes: cn(\n \"pp-container\",\n getVariantClasses(this.variant),\n borderStyles?.className,\n isInteractive && \"pp-interactive\",\n this.glow?.animate && \"pp-glow\"\n ),\n styles: {\n width: `${this.pixelSize}px`,\n height: `${this.pixelSize}px`,\n borderRadius: RADIUS_MAP[this.variant],\n ...borderStyles?.style,\n ...shadowStyles,\n ...glowStyles,\n cursor:\n this.interactive?.cursor ?? (isInteractive ? \"pointer\" : \"default\"),\n transform: this.rotation ? `rotate(${this.rotation}deg)` : undefined,\n },\n // Background styles moved to .pp-inner to prevent sub-pixel bleed-through\n innerStyles: bg.style ?? {},\n innerClasses: bg.className,\n };\n }\n\n private renderPlaceholder() {\n if (this.isLoaded || this.placeholder === \"none\") {\n return nothing;\n }\n\n const placeholderClass = {\n shimmer: \"pp-shimmer\",\n pulse: \"pp-pulse\",\n skeleton: \"pp-skeleton\",\n blur: \"\",\n none: \"\",\n }[this.placeholder];\n\n return html`\n ${this.placeholder === \"shimmer\" ? html`<style>${shimmerStyles}</style>` : nothing}\n <div\n class=${cn(\"np:absolute np:inset-0\", placeholderClass)}\n style=${styleMap({\n backgroundColor: this.placeholderColor,\n borderRadius: \"inherit\",\n })}>\n </div>\n `;\n }\n\n private renderFallback() {\n // Check if an explicit background is set (bg-color or bg-gradient)\n // When set, the fallback should be transparent so .pp-inner's background shows through\n const hasExplicitBg = Boolean(this.bgColor || this.bgGradient);\n\n // Gradient mode: show cloudy gradient, no text\n if (this.fallbackMode === \"gradient\") {\n const gradient = generateCloudyGradient(this.gradientSeed);\n return html`\n <div\n class=\"pp-fallback np:absolute np:inset-0\"\n style=${styleMap({\n background: hasExplicitBg ? \"transparent\" : gradient,\n })}>\n </div>\n `;\n }\n\n // Use custom fallback text if provided\n if (this.fallback) {\n return html`\n <span\n class=\"pp-fallback\"\n style=${styleMap({ fontSize: `${getInitialsFontSize(this.pixelSize)}px` })}>\n ${this.fallback}\n </span>\n `;\n }\n\n // Generate initials from alt text\n if (this.alt) {\n const gradient = generateAvatarGradient(this.alt);\n return html`\n <div\n class=\"pp-fallback np:absolute np:inset-0\"\n style=${styleMap({\n background: hasExplicitBg ? \"transparent\" : gradient,\n fontSize: `${getInitialsFontSize(this.pixelSize)}px`,\n })}>\n ${getInitials(this.alt)}\n </div>\n `;\n }\n\n // Default user icon\n const iconSize = this.pixelSize * 0.5;\n return html`\n <svg\n class=\"pp-fallback-icon\"\n style=\"width: ${iconSize}px; height: ${iconSize}px;\"\n fill=\"currentColor\"\n viewBox=\"0 0 24 24\">\n <path d=\"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z\" />\n </svg>\n `;\n }\n\n private renderImage() {\n // Determine image source with CDN priority:\n // 1. CDN URL (browser handles redirects automatically via img src)\n // 2. src prop (if CDN not configured or failed)\n // 3. Fallback component\n const hasCdnConfig = Boolean(\n this.extCustomerId && ProfilePicture.cdnBaseUrl\n );\n\n let imageSrc: string | undefined;\n if (this.cdnImageUrl) {\n // CDN URL set - browser will handle redirects\n imageSrc = this.cdnImageUrl;\n } else if (!hasCdnConfig || this.cdnLoadFailed) {\n // CDN not configured or failed - use src prop\n imageSrc = this.src;\n }\n\n // No image source available - show fallback\n if (this.hasError || !imageSrc) {\n return this.renderFallback();\n }\n\n const zoomStyle = this.zoom && this.zoom !== 1\n ? styleMap({ transform: `scale(${this.zoom})` })\n : nothing;\n\n return html`\n <img\n src=${imageSrc}\n alt=${this.alt}\n loading=${this.loading}\n decoding=\"async\"\n @load=${this.handleLoad}\n @error=${this.handleError}\n class=${cn(\"pp-image\", this.isLoaded ? \"pp-image-loaded\" : \"pp-image-loading\")}\n style=${zoomStyle}\n draggable=\"false\" />\n `;\n }\n\n private renderRing() {\n if (!this.ring?.show) {\n return nothing;\n }\n\n const ringWidth = this.ring.width ?? 3;\n const ringGap = this.ring.gap ?? 3;\n const totalOffset = ringWidth + ringGap;\n\n let ringColor: string;\n const hasProgress = this.ring.progress !== undefined;\n\n if (hasProgress) {\n // Progress mode: partial fill ring\n const progress = this.ring.progress ?? 0;\n const filledColor = this.ring.color ?? \"#30D158\"; // Default green\n const emptyColor = this.ring.emptyColor ?? \"#8E8E93\"; // Default gray\n ringColor = createProgressRingGradient(progress, filledColor, emptyColor);\n } else if (this.ring.gradient && this.ring.gradient.length > 0) {\n // Multi-color gradient mode\n ringColor = createConicGradient(this.ring.gradient);\n } else {\n // Single color or default gradient\n ringColor =\n this.ring.color ??\n \"linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888)\";\n }\n\n return html`\n <div\n class=${cn(\n \"pp-ring\",\n this.ring.animate && !hasProgress && \"pp-ring-animated\",\n hasProgress && \"pp-ring-progress\"\n )}\n style=${styleMap({\n inset: `-${totalOffset}px`,\n padding: `${ringWidth}px`,\n background: ringColor,\n borderRadius: RADIUS_MAP[this.variant],\n })}>\n </div>\n `;\n }\n\n /**\n * Calculate the distance from the container edge to the avatar's visual corner point.\n * For a circle, this is the 45° point on the circumference.\n * Returns the inset in pixels where an indicator's CENTER should be placed.\n */\n private getCornerOffset(): number {\n const radius = this.pixelSize / 2;\n\n // For a circle, the 45° point from center is at (r*cos45, r*sin45)\n // Distance from container edge = r - r*cos(45°) = r * (1 - √2/2) ≈ r * 0.1464\n const variantInsetRatio: Record<Variant, number> = {\n circle: 1 - Math.SQRT2 / 2, // ~0.1464\n square: 0.0,\n rounded: 0.04,\n squircle: 0.08,\n };\n\n const ratio = variantInsetRatio[this.variant];\n return radius * ratio;\n }\n\n private renderPresence() {\n if (!this.presence) {\n return nothing;\n }\n\n const thickness = this.presence.thickness ?? 2;\n const size = getPresenceSize(this.pixelSize, thickness);\n const color = PRESENCE_COLORS[this.presence.status];\n\n // Center the indicator on the avatar's corner point\n const cornerInset = this.getCornerOffset();\n const offset = cornerInset - size / 2;\n\n return html`\n <div\n class=${cn(\"pp-presence\", this.presence.animate && \"pp-presence-animated\")}\n style=${styleMap({\n width: `${size}px`,\n height: `${size}px`,\n backgroundColor: color,\n bottom: `${offset}px`,\n right: `${offset}px`,\n color,\n })}\n title=${this.presence.status}>\n </div>\n `;\n }\n\n private renderBadge() {\n if (!this.badge) {\n return nothing;\n }\n\n const position = this.badge.position ?? \"bottom-right\";\n const hasContent = this.badge.content !== undefined;\n const hasIcon = this.badge.icon !== undefined;\n const hasAnyContent = hasContent || hasIcon;\n const { size: badgeSize, fontSize } = getBadgeSize(\n this.pixelSize,\n hasAnyContent\n );\n\n const bgColor = this.badge.bgColor ?? \"#22c55e\";\n const textColor = this.badge.color ?? \"#ffffff\";\n const borderRadius = this.badge.borderRadius ?? \"9999px\";\n\n // Format content (99+ for large numbers)\n const content =\n hasContent && this.badge.content !== undefined\n ? formatBadgeContent(this.badge.content, this.badge.max)\n : null;\n\n // Icon rendering\n const icon = hasIcon ? this.badge.icon : null;\n const iconSize = fontSize * 0.9; // Icon slightly smaller than text\n\n // Center the badge on the avatar's corner point\n const cornerInset = this.getCornerOffset();\n const offset = cornerInset - badgeSize / 2;\n const posOffset = `${offset}px`;\n\n const positionStyles: Record<Position, Record<string, string>> = {\n \"top-left\": { top: posOffset, left: posOffset },\n \"top-center\": {\n top: posOffset,\n left: \"50%\",\n transform: \"translateX(-50%)\",\n },\n \"top-right\": { top: posOffset, right: posOffset },\n \"bottom-left\": { bottom: posOffset, left: posOffset },\n \"bottom-center\": {\n bottom: posOffset,\n left: \"50%\",\n transform: \"translateX(-50%)\",\n },\n \"bottom-right\": { bottom: posOffset, right: posOffset },\n };\n\n return html`\n <div\n class=${cn(\n \"pp-badge\",\n this.badge.pulse && \"pp-badge-pulse\",\n this.badge.glow && \"pp-badge-glow\",\n hasIcon && \"pp-badge-with-icon\"\n )}\n style=${styleMap({\n width: hasAnyContent ? \"auto\" : `${badgeSize}px`,\n minWidth: `${badgeSize}px`,\n height: `${badgeSize}px`,\n padding: hasAnyContent ? \"0 6px\" : \"0\",\n fontSize: `${fontSize}px`,\n backgroundColor: bgColor,\n color: textColor,\n borderRadius,\n \"--pp-badge-glow-color\": bgColor,\n gap: hasIcon && hasContent ? \"4px\" : \"0\",\n ...positionStyles[position],\n })}>\n ${\n icon\n ? html`<span class=\"pp-badge-icon\" style=${styleMap({ fontSize: `${iconSize}px` })}>${icon}</span>`\n : nothing\n }\n ${content ?? nothing}\n </div>\n `;\n }\n\n render() {\n const container = this.getContainerStyles();\n\n const tabIndex =\n this.interactive?.focusable || this.interactive?.pressable\n ? 0\n : undefined;\n\n return html`\n <div\n class=${container.classes}\n style=${styleMap(container.styles)}\n tabindex=${tabIndex ?? nothing}\n role=${this.interactive?.pressable ? \"button\" : nothing}\n aria-label=${this.alt || nothing}\n @click=${this.handleClick}\n @keydown=${this.handleKeyDown}\n data-profile-picture>\n\n <!-- Ring Effect (behind everything) -->\n ${this.renderRing()}\n\n <!-- Inner container for image clipping -->\n <div\n class=${cn(\"pp-inner\", container.innerClasses)}\n style=${styleMap({\n borderRadius: RADIUS_MAP[this.variant],\n ...container.innerStyles,\n })}>\n <!-- Placeholder -->\n ${this.renderPlaceholder()}\n\n <!-- Main Image or Fallback -->\n ${this.renderImage()}\n </div>\n\n <!-- Badge -->\n ${this.renderBadge()}\n\n <!-- Presence Indicator -->\n ${this.renderPresence()}\n </div>\n `;\n }\n}\n\n// Export types for TypeScript users\nexport type {\n BadgeConfig,\n FallbackMode,\n GlowConfig,\n ImageMode,\n InteractionConfig,\n LoadingStrategy,\n PlaceholderType,\n Position,\n PresenceConfig,\n PresenceStatus,\n RingConfig,\n ShadowPreset,\n Size,\n Variant,\n} from \"./types\";\n\n// Register custom element with guard to prevent duplicate registration during HMR\nif (!customElements.get(\"profile-picture\")) {\n customElements.define(\"profile-picture\", ProfilePicture);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"profile-picture\": ProfilePicture;\n }\n}\n\nexport default ProfilePicture;\n","/**\n * ProfilePictureGroup Web Component\n * Apple-inspired stacked avatar group with tooltips, counter, and dropdown\n *\n * A lightweight, framework-agnostic component for displaying\n * multiple profile pictures in a visually appealing stacked layout.\n */\n\nimport { html, LitElement, nothing, render } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\nimport { styleMap } from \"lit/directives/style-map.js\";\nimport { groupStyles } from \"./styles\";\nimport type {\n DropdownConfig,\n GroupUserData,\n Size,\n StackDirection,\n TooltipConfig,\n TooltipPosition,\n} from \"./types\";\nimport { GROUP_DEFAULTS } from \"./types\";\nimport {\n calculateAvatarCounts,\n calculateGroupWidth,\n calculateStackPosition,\n calculateStackZIndex,\n cn,\n formatCounterText,\n generateAvatarGradient,\n getGroupAvatarSize,\n getInitials,\n} from \"./utils\";\n\n// Inject group styles once\nlet groupStylesInjected = false;\nfunction injectGroupStyles() {\n if (groupStylesInjected || typeof document === \"undefined\") {\n return;\n }\n\n // Defer style injection to avoid hydration mismatch in SSR frameworks\n const defer =\n typeof requestIdleCallback !== \"undefined\"\n ? requestIdleCallback\n : (cb: () => void) => setTimeout(cb, 1);\n\n defer(() => {\n // Re-check in case another call already injected\n if (groupStylesInjected) {\n return;\n }\n const style = document.createElement(\"style\");\n style.textContent = groupStyles;\n document.head.appendChild(style);\n groupStylesInjected = true;\n });\n}\n\nexport class ProfilePictureGroup extends LitElement {\n // Use Light DOM for Tailwind compatibility\n protected createRenderRoot() {\n injectGroupStyles();\n return this;\n }\n\n // ─── Core Properties ────────────────────────────────────────────────────────\n @property({ type: Number }) max = GROUP_DEFAULTS.max;\n @property({ type: String }) direction: StackDirection =\n GROUP_DEFAULTS.direction;\n @property({ type: Number }) overlap = GROUP_DEFAULTS.overlap;\n @property({ type: String }) size: Size | string = GROUP_DEFAULTS.size;\n @property({ type: Number }) spacing?: number;\n @property({ type: Object }) tooltip?: TooltipConfig;\n @property({ type: Object }) dropdown?: DropdownConfig;\n @property({ type: Boolean, attribute: \"show-add-button\" }) showAddButton =\n false;\n @property({ type: String, attribute: \"add-button-label\" }) addButtonLabel =\n \"Add user\";\n @property({ type: Boolean }) animated = GROUP_DEFAULTS.animated;\n @property({ type: Number, attribute: \"rotation-amount\" }) rotationAmount = 0;\n\n // ─── Internal State ─────────────────────────────────────────────────────────\n @state() private users: GroupUserData[] = [];\n @state() private dropdownOpen = false;\n @state() private tooltipData: {\n user: GroupUserData;\n rect: DOMRect;\n } | null = null;\n private tooltipTimeout: number | null = null;\n private slotObserver: MutationObserver | null = null;\n\n // ─── Portal State ───────────────────────────────────────────────────────────\n private portalContainer: HTMLDivElement | null = null;\n private counterRef: HTMLButtonElement | null = null;\n\n private get pixelSize(): number {\n return getGroupAvatarSize(this.size as Size | number);\n }\n\n private get tooltipEnabled(): boolean {\n return this.tooltip?.enabled !== false;\n }\n\n private get tooltipPosition(): TooltipPosition {\n return this.tooltip?.position ?? \"top\";\n }\n\n private get tooltipDelay(): number {\n return this.tooltip?.delay ?? GROUP_DEFAULTS.tooltipDelay;\n }\n\n private get dropdownMaxHeight(): number {\n return this.dropdown?.maxHeight ?? GROUP_DEFAULTS.dropdownMaxHeight;\n }\n\n private get showPresence(): boolean {\n return this.dropdown?.showPresence !== false;\n }\n\n private get dropdownPosition(): \"top\" | \"bottom\" {\n return this.dropdown?.position ?? \"bottom\";\n }\n\n // ─── Lifecycle ──────────────────────────────────────────────────────────────\n\n connectedCallback() {\n super.connectedCallback();\n this.updateUsers();\n this.setupSlotObserver();\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.slotObserver?.disconnect();\n this.clearTooltipTimeout();\n this.destroyPortal();\n }\n\n private setupSlotObserver() {\n // Watch for child element changes\n this.slotObserver = new MutationObserver(() => {\n this.updateUsers();\n });\n\n this.slotObserver.observe(this, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: [\n \"src\",\n \"alt\",\n \"ext-customer-id\",\n \"data-user-id\",\n \"data-status\",\n \"variant\",\n \"shadow\",\n \"border\",\n \"border-width\",\n \"border-color\",\n \"bg-color\",\n \"bg-gradient\",\n ],\n });\n }\n\n private updateUsers() {\n // Only select direct children profile-picture elements (slotted content),\n // not the ones we render inside the ppg-container\n const children = Array.from(this.children).filter(\n (child) =>\n child.tagName.toLowerCase() === \"profile-picture\" &&\n child.getAttribute(\"slot\") !== \"internal\"\n );\n\n this.users = children.map((el, index) => {\n // Helper to read property or attribute (React may set properties instead of attributes)\n const getPropOrAttr = (\n propName: string,\n attrName?: string\n ): string | undefined => {\n const actualAttrName = attrName ?? propName;\n // Try property first (for React compatibility)\n const propValue = (el as unknown as Record<string, unknown>)[propName];\n if (propValue !== undefined && propValue !== null && propValue !== \"\") {\n return String(propValue);\n }\n // Fall back to attribute\n return el.getAttribute(actualAttrName) ?? undefined;\n };\n\n // Extract border-width as number\n const borderWidthValue = getPropOrAttr(\"borderWidth\", \"border-width\");\n const borderWidth = borderWidthValue\n ? (Number.parseInt(String(borderWidthValue), 10) as 1 | 2 | 3 | 4)\n : undefined;\n\n return {\n // Core data\n id: getPropOrAttr(\"dataUserId\", \"data-user-id\"),\n name: getPropOrAttr(\"alt\") ?? `User ${index + 1}`,\n src: getPropOrAttr(\"src\"),\n extCustomerId: getPropOrAttr(\"extCustomerId\", \"ext-customer-id\"),\n status: getPropOrAttr(\"dataStatus\", \"data-status\") as\n | GroupUserData[\"status\"]\n | undefined,\n element: el as HTMLElement,\n index,\n\n // Profile picture props (passed through from slotted elements)\n variant: getPropOrAttr(\"variant\") as\n | GroupUserData[\"variant\"]\n | undefined,\n shadow: getPropOrAttr(\"shadow\") as GroupUserData[\"shadow\"] | undefined,\n border: Boolean(\n (el as unknown as Record<string, unknown>).border ??\n el.hasAttribute(\"border\")\n ),\n borderWidth,\n borderColor: getPropOrAttr(\"borderColor\", \"border-color\"),\n bgColor: getPropOrAttr(\"bgColor\", \"bg-color\"),\n bgGradient: getPropOrAttr(\"bgGradient\", \"bg-gradient\"),\n };\n });\n\n // Hide ALL slotted elements since we're rendering our own\n for (const user of this.users) {\n if (user.element) {\n user.element.style.display = \"none\";\n }\n }\n }\n\n // ─── Portal Management ──────────────────────────────────────────────────────\n\n private createPortal() {\n if (this.portalContainer) {\n return;\n }\n\n this.portalContainer = document.createElement(\"div\");\n this.portalContainer.className = \"ppg-portal\";\n this.portalContainer.style.cssText =\n \"position: fixed; z-index: 99999; pointer-events: none;\";\n document.body.appendChild(this.portalContainer);\n\n // Lock body scroll\n document.body.style.overflow = \"hidden\";\n }\n\n private destroyPortal() {\n if (this.portalContainer) {\n render(nothing, this.portalContainer);\n this.portalContainer.remove();\n this.portalContainer = null;\n\n // Restore body scroll\n document.body.style.overflow = \"\";\n }\n }\n\n private updatePortalContent(hiddenUsers: GroupUserData[]) {\n if (!(this.portalContainer && this.counterRef)) {\n return;\n }\n\n const rect = this.counterRef.getBoundingClientRect();\n const gap = 10;\n const dropdownWidth = 280;\n const dropdownHeight = Math.min(\n this.dropdownMaxHeight + 60, // header + padding\n hiddenUsers.length * 56 + 60 // estimate item height\n );\n\n const viewportWidth = window.innerWidth;\n const viewportHeight = window.innerHeight;\n const isMobile = viewportWidth < 480;\n\n // Mobile: centered modal style\n if (isMobile) {\n const content = html`\n <div\n class=\"ppg-backdrop ppg-backdrop-visible\"\n style=\"pointer-events: auto; background: rgba(0,0,0,0.5);\"\n @click=${this.handleBackdropClick}\n aria-hidden=\"true\"\n ></div>\n <div\n class=\"ppg-dropdown ppg-dropdown-modal\"\n style=${styleMap({\n position: \"fixed\",\n pointerEvents: \"auto\",\n top: \"50%\",\n left: \"50%\",\n transform: \"translate(-50%, -50%)\",\n width: \"calc(100vw - 32px)\",\n maxWidth: \"320px\",\n maxHeight: \"70vh\",\n })}\n data-position=\"modal\"\n role=\"menu\"\n aria-label=\"Hidden users\"\n >\n <div class=\"ppg-dropdown-header\">\n ${hiddenUsers.length} more\n </div>\n <div\n class=\"ppg-dropdown-list\"\n style=${styleMap({\n maxHeight: \"calc(70vh - 60px)\",\n })}\n >\n ${hiddenUsers.map((user) => this.renderDropdownItem(user))}\n </div>\n </div>\n `;\n render(content, this.portalContainer);\n return;\n }\n\n // Desktop: smart positioning\n const spaceBelow = viewportHeight - rect.bottom - gap;\n const spaceAbove = rect.top - gap;\n const spaceRight = viewportWidth - rect.left;\n const spaceLeft = rect.right;\n\n // Determine vertical position\n let openDirection: \"bottom\" | \"top\" = this.dropdownPosition;\n if (\n openDirection === \"bottom\" &&\n spaceBelow < dropdownHeight &&\n spaceAbove > spaceBelow\n ) {\n openDirection = \"top\";\n } else if (\n openDirection === \"top\" &&\n spaceAbove < dropdownHeight &&\n spaceBelow > spaceAbove\n ) {\n openDirection = \"bottom\";\n }\n\n // Determine horizontal position\n let left: number;\n if (spaceRight >= dropdownWidth) {\n // Align to left edge of counter\n left = rect.left;\n } else if (spaceLeft >= dropdownWidth) {\n // Align to right edge of counter\n left = rect.right - dropdownWidth;\n } else {\n // Center in viewport\n left = (viewportWidth - dropdownWidth) / 2;\n }\n\n // Clamp to viewport bounds\n left = Math.max(8, Math.min(left, viewportWidth - dropdownWidth - 8));\n\n const top = openDirection === \"bottom\" ? rect.bottom + gap : undefined;\n const bottom =\n openDirection === \"top\" ? viewportHeight - rect.top + gap : undefined;\n\n const content = html`\n <div\n class=\"ppg-backdrop\"\n style=\"pointer-events: auto;\"\n @click=${this.handleBackdropClick}\n aria-hidden=\"true\"\n ></div>\n <div\n class=\"ppg-dropdown ppg-dropdown-portal\"\n style=${styleMap({\n position: \"fixed\",\n pointerEvents: \"auto\",\n top: top !== undefined ? `${top}px` : \"auto\",\n bottom: bottom !== undefined ? `${bottom}px` : \"auto\",\n left: `${left}px`,\n width: `${dropdownWidth}px`,\n })}\n data-position=${openDirection}\n role=\"menu\"\n aria-label=\"Hidden users\"\n >\n <div class=\"ppg-dropdown-header\">\n ${hiddenUsers.length} more\n </div>\n <div\n class=\"ppg-dropdown-list\"\n style=${styleMap({\n maxHeight: `${this.dropdownMaxHeight}px`,\n })}\n >\n ${hiddenUsers.map((user) => this.renderDropdownItem(user))}\n </div>\n </div>\n `;\n\n render(content, this.portalContainer);\n }\n\n // ─── Event Handlers ─────────────────────────────────────────────────────────\n\n private handleAvatarClick(user: GroupUserData) {\n this.dispatchEvent(\n new CustomEvent(\"avatar-click\", {\n detail: { user },\n bubbles: true,\n composed: true,\n })\n );\n }\n\n private handleAvatarHover(user: GroupUserData, event: MouseEvent) {\n if (!this.tooltipEnabled) {\n return;\n }\n\n this.clearTooltipTimeout();\n const target = event.currentTarget as HTMLElement;\n\n this.tooltipTimeout = window.setTimeout(() => {\n this.tooltipData = {\n user,\n rect: target.getBoundingClientRect(),\n };\n }, this.tooltipDelay);\n\n this.dispatchEvent(\n new CustomEvent(\"avatar-hover\", {\n detail: { user },\n bubbles: true,\n composed: true,\n })\n );\n }\n\n private handleAvatarLeave() {\n this.clearTooltipTimeout();\n this.tooltipData = null;\n }\n\n private clearTooltipTimeout() {\n if (this.tooltipTimeout) {\n window.clearTimeout(this.tooltipTimeout);\n this.tooltipTimeout = null;\n }\n }\n\n private handleCounterClick(hiddenUsers: GroupUserData[]) {\n this.dropdownOpen = !this.dropdownOpen;\n\n if (this.dropdownOpen) {\n this.createPortal();\n this.updatePortalContent(hiddenUsers);\n } else {\n this.destroyPortal();\n }\n\n this.dispatchEvent(\n new CustomEvent(\"counter-click\", {\n detail: { hiddenUsers, open: this.dropdownOpen },\n bubbles: true,\n composed: true,\n })\n );\n }\n\n private readonly handleBackdropClick = () => {\n this.dropdownOpen = false;\n this.destroyPortal();\n };\n\n private handleDropdownItemClick(user: GroupUserData) {\n this.dropdownOpen = false;\n this.destroyPortal();\n\n this.dispatchEvent(\n new CustomEvent(\"dropdown-item-click\", {\n detail: { user },\n bubbles: true,\n composed: true,\n })\n );\n }\n\n private handleAddClick() {\n this.dispatchEvent(\n new CustomEvent(\"add-click\", {\n bubbles: true,\n composed: true,\n })\n );\n }\n\n private handleKeyDown(event: KeyboardEvent, handler: () => void) {\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n handler();\n }\n }\n\n // ─── Rendering ──────────────────────────────────────────────────────────────\n\n private renderAvatar(user: GroupUserData, index: number, total: number) {\n const position = calculateStackPosition(\n index,\n this.pixelSize,\n this.overlap,\n this.direction,\n this.spacing\n );\n const zIndex = calculateStackZIndex(index, total, this.direction);\n\n // Use user's variant or default to circle for groups\n const variant = user.variant ?? \"circle\";\n // Use user's shadow or default to none for cleaner stacking\n const shadow = user.shadow ?? \"none\";\n // Calculate alternating rotation\n const rotation = this.rotationAmount\n ? index % 2 === 0\n ? -this.rotationAmount\n : this.rotationAmount\n : 0;\n\n return html`\n <div\n class=\"ppg-avatar-wrapper\"\n style=${styleMap({\n left: `${position}px`,\n zIndex: String(zIndex),\n width: `${this.pixelSize}px`,\n height: `${this.pixelSize}px`,\n })}\n tabindex=\"0\"\n role=\"button\"\n aria-label=${user.name}\n @click=${() => this.handleAvatarClick(user)}\n @mouseenter=${(e: MouseEvent) => this.handleAvatarHover(user, e)}\n @mouseleave=${this.handleAvatarLeave}\n @keydown=${(e: KeyboardEvent) =>\n this.handleKeyDown(e, () => this.handleAvatarClick(user))}\n >\n ${this.renderProfilePicture(user, variant, shadow, rotation)}\n </div>\n `;\n }\n\n private renderProfilePicture(\n user: GroupUserData,\n variant: string,\n shadow: string,\n rotation: number\n ) {\n // Build the profile-picture element with only defined attributes\n // This avoids passing empty strings which might override defaults\n // Default to white background when wrapped in group\n return html`\n <profile-picture\n .src=${user.src || undefined}\n .alt=${user.name}\n .size=${this.pixelSize}\n .variant=${variant}\n .shadow=${shadow}\n .rotation=${rotation}\n .extCustomerId=${user.extCustomerId}\n ?border=${user.border}\n .borderWidth=${user.border ? (user.borderWidth ?? 2) : 2}\n .borderColor=${user.border ? (user.borderColor ?? \"#ffffff\") : \"#ffffff\"}\n .bgColor=${user.bgGradient ? undefined : (user.bgColor || undefined)}\n .bgGradient=${user.bgGradient ?? undefined}\n data-user-id=${user.id ?? \"\"}\n data-status=${user.status ?? \"\"}\n ></profile-picture>\n `;\n }\n\n private renderCounter(\n count: number,\n position: number,\n hiddenUsers: GroupUserData[]\n ) {\n return html`\n <button\n class=\"ppg-counter\"\n style=${styleMap({\n left: `${position}px`,\n width: `${this.pixelSize}px`,\n height: `${this.pixelSize}px`,\n zIndex: \"1\",\n })}\n aria-label=${`${count} more users`}\n aria-expanded=${this.dropdownOpen}\n aria-haspopup=\"true\"\n @click=${() => this.handleCounterClick(hiddenUsers)}\n >\n ${formatCounterText(count)}\n </button>\n `;\n }\n\n private renderAddButton(position: number) {\n const iconSize = Math.round(this.pixelSize * 0.4);\n\n return html`\n <button\n class=\"ppg-add-button\"\n style=${styleMap({\n left: `${position}px`,\n width: `${this.pixelSize}px`,\n height: `${this.pixelSize}px`,\n zIndex: \"1\",\n })}\n aria-label=${this.addButtonLabel}\n @click=${this.handleAddClick}\n >\n <svg\n class=\"ppg-add-icon\"\n width=${iconSize}\n height=${iconSize}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n <line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\"></line>\n <line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"></line>\n </svg>\n </button>\n `;\n }\n\n private renderTooltip() {\n if (!this.tooltipData) {\n return nothing;\n }\n\n const { user, rect } = this.tooltipData;\n const gap = 8;\n\n // Get container position for relative calculation\n const containerRect = this.getBoundingClientRect();\n\n // Calculate position relative to container\n const relativeLeft = rect.left - containerRect.left + rect.width / 2;\n const relativeTop = rect.top - containerRect.top;\n const relativeBottom = rect.bottom - containerRect.top;\n\n const isTop = this.tooltipPosition === \"top\";\n\n return html`\n <div\n class=\"ppg-tooltip\"\n style=${styleMap({\n top: isTop ? \"auto\" : `${relativeBottom + gap}px`,\n bottom: isTop\n ? `${containerRect.height - relativeTop + gap}px`\n : \"auto\",\n left: `${relativeLeft}px`,\n })}\n data-position=${this.tooltipPosition}\n role=\"tooltip\"\n >\n ${user.name}\n </div>\n `;\n }\n\n private renderDropdownItem(user: GroupUserData) {\n const gradient = generateAvatarGradient(user.name);\n const hasImage = user.src || user.extCustomerId;\n\n return html`\n <div\n class=\"ppg-dropdown-item\"\n role=\"menuitem\"\n tabindex=\"0\"\n @click=${() => this.handleDropdownItemClick(user)}\n @keydown=${(e: KeyboardEvent) =>\n this.handleKeyDown(e, () => this.handleDropdownItemClick(user))}\n >\n ${\n hasImage\n ? html`<profile-picture\n class=\"ppg-dropdown-avatar\"\n .src=${user.src || undefined}\n .alt=${user.name}\n .extCustomerId=${user.extCustomerId}\n .size=${40}\n variant=\"circle\"\n shadow=\"none\"\n ></profile-picture>`\n : html`<div\n class=\"ppg-dropdown-avatar-fallback\"\n style=${styleMap({ background: gradient })}\n >\n ${getInitials(user.name)}\n </div>`\n }\n <div class=\"ppg-dropdown-info\">\n <div class=\"ppg-dropdown-name\">${user.name}</div>\n ${\n this.showPresence && user.status\n ? html`\n <div class=\"ppg-dropdown-status\">\n <span\n class=\"ppg-dropdown-presence\"\n data-status=${user.status}\n ></span>\n ${this.formatStatus(user.status)}\n </div>\n `\n : nothing\n }\n </div>\n </div>\n `;\n }\n\n private formatStatus(status: string): string {\n const labels: Record<string, string> = {\n online: \"Online\",\n away: \"Away\",\n busy: \"Busy\",\n offline: \"Offline\",\n dnd: \"Do not disturb\",\n };\n return labels[status] ?? status;\n }\n\n protected updated(changedProperties: Map<PropertyKey, unknown>) {\n super.updated(changedProperties);\n\n // Update counter ref after render\n const counter = this.querySelector(\".ppg-counter\") as HTMLButtonElement;\n if (counter) {\n this.counterRef = counter;\n }\n\n // Update portal content if dropdown is open\n if (this.dropdownOpen && this.portalContainer) {\n const { visible } = calculateAvatarCounts(\n this.users.length,\n this.max,\n this.showAddButton\n );\n const hiddenUsers = this.users.slice(visible);\n this.updatePortalContent(hiddenUsers);\n }\n }\n\n render() {\n const { visible, hidden, showCounter } = calculateAvatarCounts(\n this.users.length,\n this.max,\n this.showAddButton\n );\n\n // Determine which users to show\n const visibleUsers =\n this.direction === \"ltr\"\n ? this.users.slice(0, visible)\n : this.users.slice(0, visible).reverse();\n\n const hiddenUsers = this.users.slice(visible);\n\n // Calculate element count for width\n let elementCount = visible;\n if (showCounter) {\n elementCount++;\n }\n if (this.showAddButton) {\n elementCount++;\n }\n\n const containerWidth = calculateGroupWidth(\n elementCount,\n this.pixelSize,\n this.overlap,\n this.spacing\n );\n\n // Calculate positions for counter and add button\n const counterPosition = showCounter\n ? calculateStackPosition(\n visible,\n this.pixelSize,\n this.overlap,\n this.direction,\n this.spacing\n )\n : 0;\n\n const addButtonPosition = calculateStackPosition(\n visible + (showCounter ? 1 : 0),\n this.pixelSize,\n this.overlap,\n this.direction,\n this.spacing\n );\n\n return html`\n <div\n class=${cn(\"ppg-container\", this.animated && \"ppg-animated\")}\n style=${styleMap({\n width: `${containerWidth}px`,\n height: `${this.pixelSize}px`,\n })}\n role=\"group\"\n aria-label=\"User avatars\"\n >\n <!-- Hidden slot for original children -->\n <slot style=\"display: none;\"></slot>\n\n <!-- Visible avatars -->\n ${visibleUsers.map((user, index) =>\n this.renderAvatar(user, index, visible)\n )}\n\n <!-- Counter -->\n ${showCounter ? this.renderCounter(hidden, counterPosition, hiddenUsers) : nothing}\n\n <!-- Add button -->\n ${this.showAddButton ? this.renderAddButton(addButtonPosition) : nothing}\n\n <!-- Tooltip -->\n ${this.renderTooltip()}\n </div>\n `;\n }\n}\n\n// Export types for TypeScript users\nexport type {\n DropdownConfig,\n GroupUserData,\n ProfilePictureGroupProps,\n StackDirection,\n TooltipConfig,\n TooltipPosition,\n} from \"./types\";\n\n// Register custom element with guard to prevent duplicate registration during HMR\nif (!customElements.get(\"profile-picture-group\")) {\n customElements.define(\"profile-picture-group\", ProfilePictureGroup);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"profile-picture-group\": ProfilePictureGroup;\n }\n}\n\nexport default ProfilePictureGroup;\n","/**\n * Standalone entry point for browser usage\n * This only includes the Lit web components without any framework wrappers\n */\n\n// Auto-load styles when module is imported\nimport { loadStyles } from \"./core/loadStyles\";\n\nloadStyles();\n\n// ProfilePicture types\nexport type {\n BadgeConfig,\n LoadingStrategy,\n PlaceholderType,\n Position,\n Size,\n Variant,\n} from \"./core/ProfilePicture\";\n\n// ProfilePictureGroup types\nexport type {\n DropdownConfig,\n GroupUserData,\n ProfilePictureGroupProps,\n StackDirection,\n TooltipConfig,\n TooltipPosition,\n} from \"./core/types\";\n\n// Import the web components to register them\nimport \"./core/ProfilePicture\";\nimport \"./core/ProfilePictureGroup\";\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/core/loadStyles.ts","../../node_modules/.bun/@lit-labs+ssr-dom-shim@1.5.1/node_modules/@lit-labs/ssr-dom-shim/src/lib/element-internals.ts","../../node_modules/.bun/@lit-labs+ssr-dom-shim@1.5.1/node_modules/@lit-labs/ssr-dom-shim/src/lib/events.ts","../../node_modules/.bun/@lit-labs+ssr-dom-shim@1.5.1/node_modules/@lit-labs/ssr-dom-shim/src/lib/css.ts","../../node_modules/.bun/@lit-labs+ssr-dom-shim@1.5.1/node_modules/@lit-labs/ssr-dom-shim/src/index.ts","../../node_modules/.bun/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/src/css-tag.ts","../../node_modules/.bun/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/src/reactive-element.ts","../../node_modules/.bun/lit-html@3.3.2/node_modules/lit-html/src/lit-html.ts","../../node_modules/.bun/lit-element@4.2.2/node_modules/lit-element/src/lit-element.ts","../../node_modules/.bun/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/src/decorators/property.ts","../../node_modules/.bun/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/src/decorators/state.ts","../../node_modules/.bun/lit-html@3.3.2/node_modules/lit-html/src/directive.ts","../../node_modules/.bun/lit-html@3.3.2/node_modules/lit-html/src/directives/style-map.ts","../src/core/types.ts","../src/core/utils.ts","../src/core/styles.ts","../src/core/ProfilePicture.ts","../src/core/ProfilePictureGroup.ts","../src/standalone.ts"],"names":["LINK_ID","loaded","loadScheduled","loadStyles","scheduleStyleInjection","cb","injectStyleLink","cssUrl","getCssUrl","link","metaUrl","currentScript","scriptUrl","ElementInternalsShim","_host","isCaptureEventListener","options","EventTarget","type","callback","eventListenersMap","eventListeners","normalizedOptions","event","composedPath","parent","stopPropagation","stopImmediatePropagation","eventPhase","target","tmpTarget","currentTarget","originalStopPropagation","originalStopImmediatePropagation","enumerableProperty","invokeEventListener","listener","eventListenerMap","finishDispatch","captureEventPath","retarget","eventTargets","eventTarget","captureEventListeners","bubbleEventPath","EventTargetShimWithRealType","EventShim","_a","_Event_cancelable","_Event_bubbles","_Event_composed","_Event_defaultPrevented","_Event_timestamp","_Event_propagationStopped","_Event_type","_Event_target","_Event_isBeingDispatched","bubbles","cancelable","composed","__classPrivateFieldSet","_type","_bubbles","_cancelable","__classPrivateFieldGet","value","CustomEventShim","_b","_CustomEvent_detail","_detail","EventShimWithRealType","CustomEventShimWithRealType","attributes","attributesForElement","element","attrs","ElementShim","name","force","init","shadowRoot","internals","HTMLElementShim","HTMLElementShimWithRealType","promiseWithResolvers","resolve","reject","res","rej","CustomElementRegistry","ctor","_element","definition","withResolvers","CustomElementRegistryShimWithRealType","customElements","global","globalThis","supportsAdoptingStyleSheets","ShadowRoot","ShadyCSS","nativeShadow","Document","prototype","CSSStyleSheet","constructionToken","Symbol","cssTagCache","WeakMap","CSSResult","cssText","strings","safeToken","this","Error","_strings","styleSheet","_styleSheet","cacheable","length","get","replaceSync","set","toString","unsafeCSS","String","adoptStyles","renderRoot","styles","adoptedStyleSheets","map","s","style","document","createElement","nonce","setAttribute","textContent","appendChild","getCompatibleStyle","sheet","rule","cssRules","is","defineProperty","getOwnPropertyDescriptor","getOwnPropertyNames","getOwnPropertySymbols","getPrototypeOf","Object","trustedTypes","emptyStringForBooleanAttribute","emptyScript","polyfillSupport","reactiveElementPolyfillSupport","JSCompiler_renameProperty","prop","_obj","defaultConverter","Boolean","Array","JSON","stringify","fromValue","Number","parse","e","notEqual","old","defaultPropertyDeclaration","attribute","converter","reflect","useDefault","hasChanged","metadata","litPropertyMetadata","ReactiveElement","initializer","__prepare","_initializers","push","observedAttributes","finalize","__attributeToPropertyMap","keys","state","hasOwnProperty","create","wrapped","elementProperties","noAccessor","key","descriptor","getPropertyDescriptor","v","oldValue","call","requestUpdate","configurable","enumerable","superCtor","Map","finalized","props","properties","propKeys","p","createProperty","attr","__attributeNameForProperty","elementStyles","finalizeStyles","isArray","Set","flat","Infinity","reverse","unshift","toLowerCase","constructor","super","__instanceProperties","isUpdatePending","hasUpdated","__reflectingProperty","__initialize","__updatePromise","Promise","enableUpdating","_$changedProperties","__saveInstanceProperties","forEach","i","controller","__controllers","add","isConnected","hostConnected","delete","instanceProperties","size","createRenderRoot","attachShadow","shadowRootOptions","connectedCallback","c","_requestedUpdate","disconnectedCallback","hostDisconnected","_old","_$attributeToProperty","attrValue","toAttribute","removeAttribute","propName","getPropertyOptions","fromAttribute","convertedValue","__defaultValues","useNewValue","newValue","hasAttribute","_$changeProperty","__enqueueUpdate","initializeValue","has","__reflectingProperties","result","scheduleUpdate","performUpdate","shouldUpdate","changedProperties","willUpdate","hostUpdate","update","__markUpdated","_$didUpdate","_changedProperties","hostUpdated","firstUpdated","updated","updateComplete","getUpdateComplete","__propertyToAttribute","mode","reactiveElementVersions","wrap","node","policy","createPolicy","createHTML","boundAttributeSuffix","marker","Math","random","toFixed","slice","markerMatch","nodeMarker","d","createTreeWalker","createMarker","createComment","isPrimitive","isIterable","iterator","SPACE_CHAR","textEndRegex","commentEndRegex","comment2EndRegex","tagEndRegex","RegExp","singleQuoteAttrEndRegex","doubleQuoteAttrEndRegex","rawTextElement","tag","values","_$litType$","html","noChange","for","nothing","templateCache","walker","trustFromTemplateString","tsa","stringFromTSA","getTemplateHtml","l","attrNames","rawTextEndRegex","regex","attrName","match","attrNameEndIndex","lastIndex","exec","test","end","startsWith","Template","parts","nodeIndex","attrNameIndex","partCount","el","currentNode","content","wrapper","firstChild","replaceWith","childNodes","nextNode","nodeType","hasAttributes","getAttributeNames","endsWith","realName","statics","getAttribute","split","m","index","PropertyPart","BooleanAttributePart","EventPart","AttributePart","tagName","append","data","indexOf","_options","innerHTML","resolveDirective","part","attributeIndex","currentDirective","__directives","__directive","nextDirectiveConstructor","_$initialize","_$resolve","TemplateInstance","template","_$parts","_$disconnectableChildren","_$template","_$parent","parentNode","_$isConnected","fragment","creationScope","importNode","partIndex","templatePart","ChildPart","nextSibling","ElementPart","_$setValue","__isConnected","startNode","endNode","_$committedValue","_$startNode","_$endNode","directiveParent","_$clear","_commitText","_commitTemplateResult","_commitNode","_commitIterable","insertBefore","_insert","createTextNode","_$getTemplate","h","_update","instance","_clone","itemParts","itemPart","item","start","from","_$notifyConnectionChanged","n","remove","fill","valueIndex","noCommit","change","_commitValue","toggleAttribute","newListener","oldListener","shouldRemoveListener","capture","once","passive","shouldAddListener","removeEventListener","addEventListener","host","handleEvent","litHtmlPolyfillSupport","litHtmlVersions","render","container","partOwnerNode","renderBefore","LitElement","renderOptions","__childPart","setConnected","litElementHydrateSupport","litElementPolyfillSupport","litElementVersions","standardProperty","context","kind","property","protoOrTarget","nameOrContext","proto","undefined","PartType","ATTRIBUTE","directive","_$litDirective$","Directive","_partInfo","__part","__attributeIndex","_part","important","importantFlag","styleMap","partInfo","styleInfo","reduce","includes","replace","_previousStyleProperties","removeProperty","isImportant","setProperty","SIZE_MAP","PRESENCE_COLORS","SHADOW_MAP","DEFAULTS","RADIUS_MAP","GROUP_DEFAULTS","cn","classes","isHexColor","color","getInitials","text","words","getInitialsFontSize","containerSize","getBadgeSize","avatarSize","hasContent","scaled","fontSize","getPresenceSize","thickness","baseSize","formatBadgeContent","max","createConicGradient","colors","hashString","str","hash","char","createProgressRingGradient","progress","filledColor","emptyColor","progressDeg","generateAvatarGradient","gradients","CLOUDY_PALETTES","generateCloudyGradient","seed","palette","h2","h3","x1","y1","x2","y2","x3","y3","getGroupAvatarSize","calculateAvatarCounts","total","showAddButton","effectiveMax","visible","hidden","calculateStackPosition","overlap","_direction","spacing","step","calculateStackZIndex","direction","calculateGroupWidth","count","formatCounterText","getCdnSizeLabel","pixelSize","constructCdnUrl","baseUrl","extCustomerId","sizeLabel","imageMode","hostname","cleanBaseUrl","filename","getVariantClasses","variant","getBorderClasses","width","getBackgroundStyles","bgColor","bgGradient","getShadowStyles","shadow","keyframes","allKeyframes","baseStyles","componentStyles","shimmerStyles","getGlowShadow","intensity","r","g","b","groupKeyframes","groupBaseStyles","groupStyles","_ProfilePicture","url","sizeValue","extCustomerIdChanged","cdnParamsChanged","bg","borderStyles","shadowStyles","glowStyles","glowColor","isInteractive","A","placeholderClass","T","o","hasExplicitBg","gradient","iconSize","hasCdnConfig","imageSrc","zoomStyle","ringWidth","ringGap","totalOffset","ringColor","hasProgress","radius","ratio","offset","position","hasIcon","hasAnyContent","badgeSize","textColor","borderRadius","icon","posOffset","positionStyles","tabIndex","__decorateClass","ProfilePicture","groupStylesInjected","injectGroupStyles","ProfilePictureGroup","children","child","getPropOrAttr","actualAttrName","propValue","borderWidthValue","borderWidth","user","B","hiddenUsers","rect","gap","dropdownWidth","dropdownHeight","viewportWidth","viewportHeight","spaceBelow","spaceAbove","spaceRight","spaceLeft","openDirection","left","top","bottom","handler","zIndex","rotation","containerRect","relativeLeft","relativeTop","relativeBottom","isTop","hasImage","status","counter","showCounter","visibleUsers","elementCount","containerWidth","counterPosition","addButtonPosition"],"mappings":"2IAkBA,IAAMA,EAAAA,CAAU,gCAEZC,CAAAA,CAAS,KAAA,CACTC,GAAgB,KAAA,CAOb,SAASC,EAAAA,EAAmB,CAOjC,GALIF,CAAAA,EAKA,OAAO,QAAA,CAAa,GAAA,CACtB,OAIF,GAAI,QAAA,CAAS,cAAA,CAAeD,EAAO,CAAA,CAAG,CACpCC,CAAAA,CAAS,IAAA,CACT,MACF,CAMA,GAHqB,QAAA,CAAS,aAAA,CAC5B,mDACF,CAAA,CACkB,CAChBA,CAAAA,CAAS,KACT,MACF,CAGKC,EAAAA,GACHA,EAAAA,CAAgB,IAAA,CAChBE,EAAAA,IAEJ,CAMA,SAASA,EAAAA,EAA+B,CAAA,CAEpC,OAAO,mBAAA,CAAwB,IAC3B,mBAAA,CACCC,CAAAA,EAAmB,UAAA,CAAWA,CAAAA,CAAI,CAAC,CAAA,EAEpC,IAAMC,EAAAA,EAAiB,EAC/B,CAKA,SAASA,IAAwB,CAE/B,GAAIL,CAAAA,EAAU,OAAO,QAAA,CAAa,GAAA,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AA,CAzBIiD,CAAAA,CAyBM,SAAA,CAAA,cAAA,CAAA,CACAJ,CAAAA,CAAA,CAAhB7C,CAAAA,EAAM,CAAA,CA1BIiD,EA0BM,SAAA,CAAA,aAAA,CAAA,CA4vBd,cAAA,CAAe,GAAA,CAAI,uBAAuB,GAC7C,cAAA,CAAe,MAAA,CAAO,uBAAA,CAAyBA,CAAmB,ECz0BpElnB,EAAAA,EAAW","file":"standalone.standalone.js","sourcesContent":["/**\n * Idempotent CSS loader for @grasco/profile-picture\n *\n * Auto-injects the component's CSS via <link> tag when the module is imported.\n * Uses relative URL detection to find styles.css in the same directory as the JS file.\n *\n * Idempotency is guaranteed through 4 layers:\n * 1. Module-level flag - prevents multiple calls in same bundle\n * 2. ID check - prevents duplicates across bundles\n * 3. href pattern check - catches manually added links\n * 4. SSR guard - prevents errors in Node.js\n *\n * SSR Hydration Safety:\n * Style injection is deferred using requestIdleCallback (with setTimeout fallback)\n * to avoid DOM mutations during React/framework hydration, which would cause\n * hydration mismatch errors.\n */\n\nconst LINK_ID = \"grasco-profile-picture-styles\";\n\nlet loaded = false;\nlet loadScheduled = false;\n\n/**\n * Load the component's CSS stylesheet\n * Safe to call multiple times - will only inject once\n * Defers injection to avoid SSR hydration mismatch\n */\nexport function loadStyles(): void {\n // Skip if already loaded (module-level)\n if (loaded) {\n return;\n }\n\n // Skip if SSR (no document)\n if (typeof document === \"undefined\") {\n return;\n }\n\n // Skip if link already exists by ID (idempotency across bundles)\n if (document.getElementById(LINK_ID)) {\n loaded = true;\n return;\n }\n\n // Check if any link already points to our CSS (by href pattern)\n const existingLink = document.querySelector(\n 'link[href*=\"profile-picture\"][href$=\"styles.css\"]'\n );\n if (existingLink) {\n loaded = true;\n return;\n }\n\n // Schedule deferred injection (after hydration completes)\n if (!loadScheduled) {\n loadScheduled = true;\n scheduleStyleInjection();\n }\n}\n\n/**\n * Schedule style injection after hydration using requestIdleCallback\n * Falls back to setTimeout for browsers without requestIdleCallback support\n */\nfunction scheduleStyleInjection(): void {\n const defer =\n typeof requestIdleCallback !== \"undefined\"\n ? requestIdleCallback\n : (cb: () => void) => setTimeout(cb, 1);\n\n defer(() => injectStyleLink());\n}\n\n/**\n * Actually inject the <link> tag into the document head\n */\nfunction injectStyleLink(): void {\n // Re-check conditions in case something changed\n if (loaded || typeof document === \"undefined\") {\n return;\n }\n\n if (document.getElementById(LINK_ID)) {\n loaded = true;\n return;\n }\n\n // Get CSS URL relative to current script\n const cssUrl = getCssUrl();\n if (!cssUrl) {\n return;\n }\n\n // Inject link tag\n const link = document.createElement(\"link\");\n link.id = LINK_ID;\n link.rel = \"stylesheet\";\n link.href = cssUrl;\n document.head.appendChild(link);\n\n loaded = true;\n}\n\n/**\n * Get the CSS file URL based on the current script's location\n */\nfunction getCssUrl(): string | null {\n // Allow custom override via global variable\n if (\n typeof window !== \"undefined\" &&\n (window as unknown as Record<string, string>).__GRASCO_PROFILE_PICTURE_CSS__\n ) {\n return (window as unknown as Record<string, string>)\n .__GRASCO_PROFILE_PICTURE_CSS__;\n }\n\n // Try import.meta.url first (ESM - most reliable for bundlers)\n try {\n const metaUrl = import.meta.url;\n if (metaUrl) {\n const basePath = metaUrl.substring(0, metaUrl.lastIndexOf(\"/\") + 1);\n return `${basePath}styles.css`;\n }\n } catch {\n // import.meta.url not available\n }\n\n // Fallback: Get current script URL\n const currentScript = document.currentScript as HTMLScriptElement | null;\n if (currentScript?.src) {\n const scriptUrl = new URL(currentScript.src);\n const basePath = scriptUrl.href.substring(\n 0,\n scriptUrl.href.lastIndexOf(\"/\") + 1\n );\n return `${basePath}dist/styles.css`;\n }\n\n return null;\n}\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\ntype StringKeys<T extends object> = {\n [K in keyof T]: T[K] extends string | null ? K : never;\n}[keyof T];\n\n// Since TypeScript 5.9, ARIAMixin has properties with the type Element | null\n// or Element[] | null. However, we can only support string attributes,\n// which is why we filter for string properties.\ntype ARIAAttributeMap = {\n [K in StringKeys<ARIAMixin>]: string;\n};\n\n/**\n * Map of ARIAMixin properties to attributes\n */\nexport const ariaMixinAttributes: ARIAAttributeMap = {\n ariaAtomic: 'aria-atomic',\n ariaAutoComplete: 'aria-autocomplete',\n ariaBrailleLabel: 'aria-braillelabel',\n ariaBrailleRoleDescription: 'aria-brailleroledescription',\n ariaBusy: 'aria-busy',\n ariaChecked: 'aria-checked',\n ariaColCount: 'aria-colcount',\n ariaColIndex: 'aria-colindex',\n ariaColIndexText: 'aria-colindextext',\n ariaColSpan: 'aria-colspan',\n ariaCurrent: 'aria-current',\n ariaDescription: 'aria-description',\n ariaDisabled: 'aria-disabled',\n ariaExpanded: 'aria-expanded',\n ariaHasPopup: 'aria-haspopup',\n ariaHidden: 'aria-hidden',\n ariaInvalid: 'aria-invalid',\n ariaKeyShortcuts: 'aria-keyshortcuts',\n ariaLabel: 'aria-label',\n ariaLevel: 'aria-level',\n ariaLive: 'aria-live',\n ariaModal: 'aria-modal',\n ariaMultiLine: 'aria-multiline',\n ariaMultiSelectable: 'aria-multiselectable',\n ariaOrientation: 'aria-orientation',\n ariaPlaceholder: 'aria-placeholder',\n ariaPosInSet: 'aria-posinset',\n ariaPressed: 'aria-pressed',\n ariaReadOnly: 'aria-readonly',\n ariaRelevant: 'aria-relevant',\n ariaRequired: 'aria-required',\n ariaRoleDescription: 'aria-roledescription',\n ariaRowCount: 'aria-rowcount',\n ariaRowIndex: 'aria-rowindex',\n ariaRowIndexText: 'aria-rowindextext',\n ariaRowSpan: 'aria-rowspan',\n ariaSelected: 'aria-selected',\n ariaSetSize: 'aria-setsize',\n ariaSort: 'aria-sort',\n ariaValueMax: 'aria-valuemax',\n ariaValueMin: 'aria-valuemin',\n ariaValueNow: 'aria-valuenow',\n ariaValueText: 'aria-valuetext',\n role: 'role',\n};\n\ntype ElementInternalsInterface = ElementInternals;\n\n// Shim the global element internals object\n// Methods should be fine as noops and properties can generally\n// be while on the server.\nexport const ElementInternalsShim = class ElementInternals\n implements ElementInternalsInterface\n{\n ariaActiveDescendantElement = null;\n ariaAtomic = '';\n ariaAutoComplete = '';\n ariaBrailleLabel = '';\n ariaBrailleRoleDescription = '';\n ariaBusy = '';\n ariaChecked = '';\n ariaColCount = '';\n ariaColIndex = '';\n ariaColIndexText = '';\n ariaColSpan = '';\n ariaControlsElements = null;\n ariaCurrent = '';\n ariaDescribedByElements = null;\n ariaDescription = '';\n ariaDetailsElements = null;\n ariaDisabled = '';\n ariaErrorMessageElements = null;\n ariaExpanded = '';\n ariaFlowToElements = null;\n ariaHasPopup = '';\n ariaHidden = '';\n ariaInvalid = '';\n ariaKeyShortcuts = '';\n ariaLabel = '';\n ariaLabelledByElements = null;\n ariaLevel = '';\n ariaLive = '';\n ariaModal = '';\n ariaMultiLine = '';\n ariaMultiSelectable = '';\n ariaOrientation = '';\n ariaOwnsElements = null;\n ariaPlaceholder = '';\n ariaPosInSet = '';\n ariaPressed = '';\n ariaReadOnly = '';\n ariaRelevant = '';\n ariaRequired = '';\n ariaRoleDescription = '';\n ariaRowCount = '';\n ariaRowIndex = '';\n ariaRowIndexText = '';\n ariaRowSpan = '';\n ariaSelected = '';\n ariaSetSize = '';\n ariaSort = '';\n ariaValueMax = '';\n ariaValueMin = '';\n ariaValueNow = '';\n ariaValueText = '';\n role = '';\n __host: HTMLElement;\n get shadowRoot() {\n // Grab the shadow root instance from the Element shim\n // to ensure that the shadow root is always available\n // to the internals instance even if the mode is 'closed'\n return (this.__host as HTMLElement & {__shadowRoot: ShadowRoot})\n .__shadowRoot;\n }\n constructor(_host: HTMLElement) {\n this.__host = _host;\n }\n checkValidity() {\n // TODO(augustjk) Consider actually implementing logic.\n // See https://github.com/lit/lit/issues/3740\n console.warn(\n '`ElementInternals.checkValidity()` was called on the server.' +\n 'This method always returns true.'\n );\n return true;\n }\n form = null;\n labels = [] as unknown as NodeListOf<HTMLLabelElement>;\n reportValidity() {\n return true;\n }\n setFormValue(): void {}\n setValidity(): void {}\n states = new Set<string>();\n validationMessage = '';\n validity = {} as ValidityState;\n willValidate = true;\n};\n\nconst ElementInternalsShimWithRealType =\n ElementInternalsShim as object as typeof ElementInternals;\nexport {ElementInternalsShimWithRealType as ElementInternals};\n\nexport const HYDRATE_INTERNALS_ATTR_PREFIX = 'hydrate-internals-';\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * This is a basic implementation of an EventTarget, Event and CustomEvent.\n *\n * This is not fully spec compliant (e.g. validation),\n * but should work well enough for our use cases.\n *\n * @see https://dom.spec.whatwg.org/#eventtarget\n * @see https://dom.spec.whatwg.org/#event\n * @see https://dom.spec.whatwg.org/#customevent\n */\n\nexport interface EventTargetShimMeta {\n /**\n * The event target parent represents the previous event target for an event\n * in capture phase and the next event target for a bubbling event.\n * Note that this is not the element parent\n */\n __eventTargetParent: globalThis.EventTarget | undefined;\n /**\n * The host event target/element of this event target, if this event target\n * is inside a Shadow DOM.\n */\n __host: globalThis.EventTarget | undefined;\n}\n\nconst isCaptureEventListener = (\n options: undefined | AddEventListenerOptions | boolean\n) => (typeof options === 'boolean' ? options : (options?.capture ?? false));\n\n// Event phases\nconst NONE = 0;\nconst CAPTURING_PHASE = 1;\nconst AT_TARGET = 2;\nconst BUBBLING_PHASE = 3;\n\n// Shim the global EventTarget object\nclass EventTarget implements globalThis.EventTarget, EventTargetShimMeta {\n private __eventListeners = new Map<\n string,\n Map<EventListenerOrEventListenerObject, AddEventListenerOptions>\n >();\n private __captureEventListeners = new Map<\n string,\n Map<EventListenerOrEventListenerObject, AddEventListenerOptions>\n >();\n __eventTargetParent: EventTarget | undefined;\n __host: EventTarget | undefined;\n\n addEventListener(\n type: string,\n callback: EventListenerOrEventListenerObject | null,\n options?: AddEventListenerOptions | boolean\n ): void {\n if (callback === undefined || callback === null) {\n return;\n }\n const eventListenersMap = isCaptureEventListener(options)\n ? this.__captureEventListeners\n : this.__eventListeners;\n let eventListeners = eventListenersMap.get(type);\n if (eventListeners === undefined) {\n eventListeners = new Map();\n eventListenersMap.set(type, eventListeners);\n } else if (eventListeners.has(callback)) {\n return;\n }\n\n const normalizedOptions =\n typeof options === 'object' && options ? options : {};\n normalizedOptions.signal?.addEventListener('abort', () =>\n this.removeEventListener(type, callback, options)\n );\n eventListeners.set(callback, normalizedOptions ?? {});\n }\n removeEventListener(\n type: string,\n callback: EventListenerOrEventListenerObject | null,\n options?: EventListenerOptions | boolean\n ): void {\n if (callback === undefined || callback === null) {\n return;\n }\n const eventListenersMap = isCaptureEventListener(options)\n ? this.__captureEventListeners\n : this.__eventListeners;\n const eventListeners = eventListenersMap.get(type);\n if (eventListeners !== undefined) {\n eventListeners.delete(callback);\n if (!eventListeners.size) {\n eventListenersMap.delete(type);\n }\n }\n }\n dispatchEvent(event: Event): boolean {\n const composedPath: EventTarget[] = [this];\n let parent = this.__eventTargetParent;\n if (event.composed) {\n while (parent) {\n composedPath.push(parent);\n parent = parent.__eventTargetParent;\n }\n } else {\n // If the event is not composed and the event was dispatched inside\n // shadow DOM, we need to stop before the host of the shadow DOM.\n while (parent && parent !== this.__host) {\n composedPath.push(parent);\n parent = parent.__eventTargetParent;\n }\n }\n\n // We need to patch various properties that would either be empty or wrong\n // in this scenario.\n let stopPropagation = false;\n let stopImmediatePropagation = false;\n let eventPhase = NONE;\n let target: EventTarget | null = null;\n let tmpTarget: EventTarget | null = null;\n let currentTarget: EventTarget | null = null;\n const originalStopPropagation = event.stopPropagation;\n const originalStopImmediatePropagation = event.stopImmediatePropagation;\n Object.defineProperties(event, {\n target: {\n get() {\n return target ?? tmpTarget;\n },\n ...enumerableProperty,\n },\n srcElement: {\n get() {\n return event.target;\n },\n ...enumerableProperty,\n },\n currentTarget: {\n get() {\n return currentTarget;\n },\n ...enumerableProperty,\n },\n eventPhase: {\n get() {\n return eventPhase;\n },\n ...enumerableProperty,\n },\n composedPath: {\n value: () => composedPath,\n ...enumerableProperty,\n },\n stopPropagation: {\n value: () => {\n stopPropagation = true;\n originalStopPropagation.call(event);\n },\n ...enumerableProperty,\n },\n stopImmediatePropagation: {\n value: () => {\n stopImmediatePropagation = true;\n originalStopImmediatePropagation.call(event);\n },\n ...enumerableProperty,\n },\n });\n\n // An event handler can either be a function, an object with a handleEvent\n // method or null. This function takes care to call the event handler\n // correctly.\n const invokeEventListener = (\n listener: EventListenerOrEventListenerObject,\n options: AddEventListenerOptions,\n eventListenerMap: Map<\n EventListenerOrEventListenerObject,\n AddEventListenerOptions\n >\n ) => {\n if (typeof listener === 'function') {\n listener(event);\n } else if (typeof listener?.handleEvent === 'function') {\n listener.handleEvent(event);\n }\n if (options.once) {\n eventListenerMap.delete(listener);\n }\n };\n // When an event is finished being dispatched, which can be after the event\n // tree has been traversed or stopPropagation/stopImmediatePropagation has\n // been called. Once that is the case, the currentTarget and eventPhase\n // need to be reset and a value, representing whether the event has not\n // been prevented, needs to be returned.\n const finishDispatch = () => {\n currentTarget = null;\n eventPhase = NONE;\n return !event.defaultPrevented;\n };\n\n // An event starts with the capture order, where it starts from the top.\n // This is done even if bubbles is set to false, which is the default.\n const captureEventPath = composedPath.slice().reverse();\n // If the event target, which dispatches the event, is either in the light DOM\n // or the event is not composed, the target is always itself. If that is not\n // the case, the target needs to be retargeted: https://dom.spec.whatwg.org/#retarget\n target = !this.__host || !event.composed ? this : null;\n const retarget = (eventTargets: EventTarget[]) => {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n tmpTarget = this;\n while (tmpTarget.__host && eventTargets.includes(tmpTarget.__host)) {\n tmpTarget = tmpTarget.__host;\n }\n };\n for (const eventTarget of captureEventPath) {\n if (!target && (!tmpTarget || tmpTarget === eventTarget.__host)) {\n retarget(captureEventPath.slice(captureEventPath.indexOf(eventTarget)));\n }\n currentTarget = eventTarget;\n eventPhase = eventTarget === event.target ? AT_TARGET : CAPTURING_PHASE;\n const captureEventListeners = eventTarget.__captureEventListeners.get(\n event.type\n );\n if (captureEventListeners) {\n for (const [listener, options] of captureEventListeners) {\n invokeEventListener(listener, options, captureEventListeners);\n if (stopImmediatePropagation) {\n // Event.stopImmediatePropagation() stops any following invocation\n // of an event handler even on the same event target.\n return finishDispatch();\n }\n }\n }\n if (stopPropagation) {\n // Event.stopPropagation() stops any following invocation\n // of an event handler for any following event targets.\n return finishDispatch();\n }\n }\n\n const bubbleEventPath = event.bubbles ? composedPath : [this];\n tmpTarget = null;\n for (const eventTarget of bubbleEventPath) {\n if (\n !target &&\n (!tmpTarget || eventTarget === (tmpTarget as EventTarget).__host)\n ) {\n retarget(\n bubbleEventPath.slice(0, bubbleEventPath.indexOf(eventTarget) + 1)\n );\n }\n currentTarget = eventTarget;\n eventPhase = eventTarget === event.target ? AT_TARGET : BUBBLING_PHASE;\n const captureEventListeners = eventTarget.__eventListeners.get(\n event.type\n );\n if (captureEventListeners) {\n for (const [listener, options] of captureEventListeners) {\n invokeEventListener(listener, options, captureEventListeners);\n if (stopImmediatePropagation) {\n // Event.stopImmediatePropagation() stops any following invocation\n // of an event handler even on the same event target.\n return finishDispatch();\n }\n }\n }\n if (stopPropagation) {\n // Event.stopPropagation() stops any following invocation\n // of an event handler for any following event targets.\n return finishDispatch();\n }\n }\n return finishDispatch();\n }\n}\n\nconst EventTargetShimWithRealType =\n EventTarget as object as typeof globalThis.EventTarget;\nexport {\n EventTargetShimWithRealType as EventTarget,\n EventTargetShimWithRealType as EventTargetShim,\n};\n\n/* Adapted from Node.js https://github.com/nodejs/node/blob/main/lib/internal/event_target.js */\n\ntype EventInterface = Event;\n\nconst enumerableProperty: Record<string, unknown> = {__proto__: null};\nenumerableProperty.enumerable = true;\nObject.freeze(enumerableProperty);\n\n// TODO: Remove this when we remove support for vm modules (--experimental-vm-modules).\nconst EventShim = class Event implements EventInterface {\n #cancelable = false;\n #bubbles = false;\n #composed = false;\n #defaultPrevented = false;\n #timestamp = Date.now();\n #propagationStopped = false;\n #type: string;\n #target: globalThis.EventTarget | null;\n #isBeingDispatched: boolean;\n readonly NONE = NONE;\n readonly CAPTURING_PHASE = CAPTURING_PHASE;\n readonly AT_TARGET = AT_TARGET;\n readonly BUBBLING_PHASE = BUBBLING_PHASE;\n static readonly NONE = NONE;\n static readonly CAPTURING_PHASE = CAPTURING_PHASE;\n static readonly AT_TARGET = AT_TARGET;\n static readonly BUBBLING_PHASE = BUBBLING_PHASE;\n\n constructor(type: string, options: EventInit = {}) {\n if (arguments.length === 0)\n throw new Error(`The type argument must be specified`);\n if (typeof options !== 'object' || !options) {\n throw new Error(`The \"options\" argument must be an object`);\n }\n const {bubbles, cancelable, composed} = options;\n this.#cancelable = !!cancelable;\n this.#bubbles = !!bubbles;\n this.#composed = !!composed;\n\n this.#type = `${type}`;\n this.#target = null;\n this.#isBeingDispatched = false;\n }\n\n initEvent(_type: string, _bubbles?: boolean, _cancelable?: boolean): void {\n throw new Error('Method not implemented.');\n }\n\n stopImmediatePropagation() {\n this.stopPropagation();\n }\n\n preventDefault() {\n this.#defaultPrevented = true;\n }\n\n get target(): globalThis.EventTarget | null {\n return this.#target;\n }\n\n get currentTarget(): globalThis.EventTarget | null {\n return this.#target;\n }\n\n get srcElement(): globalThis.EventTarget | null {\n return this.#target;\n }\n\n get type(): string {\n return this.#type;\n }\n\n get cancelable(): boolean {\n return this.#cancelable;\n }\n\n get defaultPrevented(): boolean {\n return this.#cancelable && this.#defaultPrevented;\n }\n\n get timeStamp(): number {\n return this.#timestamp;\n }\n\n composedPath(): globalThis.EventTarget[] {\n return this.#isBeingDispatched ? [this.#target!] : [];\n }\n\n get returnValue(): boolean {\n return !this.#cancelable || !this.#defaultPrevented;\n }\n\n get bubbles(): boolean {\n return this.#bubbles;\n }\n\n get composed(): boolean {\n return this.#composed;\n }\n\n get eventPhase(): number {\n return this.#isBeingDispatched ? Event.AT_TARGET : Event.NONE;\n }\n\n get cancelBubble(): boolean {\n return this.#propagationStopped;\n }\n\n set cancelBubble(value) {\n if (value) {\n this.#propagationStopped = true;\n }\n }\n\n stopPropagation(): void {\n this.#propagationStopped = true;\n }\n\n get isTrusted(): boolean {\n return false;\n }\n};\n\nObject.defineProperties(EventShim.prototype, {\n initEvent: enumerableProperty,\n stopImmediatePropagation: enumerableProperty,\n preventDefault: enumerableProperty,\n target: enumerableProperty,\n currentTarget: enumerableProperty,\n srcElement: enumerableProperty,\n type: enumerableProperty,\n cancelable: enumerableProperty,\n defaultPrevented: enumerableProperty,\n timeStamp: enumerableProperty,\n composedPath: enumerableProperty,\n returnValue: enumerableProperty,\n bubbles: enumerableProperty,\n composed: enumerableProperty,\n eventPhase: enumerableProperty,\n cancelBubble: enumerableProperty,\n stopPropagation: enumerableProperty,\n isTrusted: enumerableProperty,\n});\n\ntype CustomEventInterface = CustomEvent;\n\n// TODO: Remove this when we remove support for vm modules (--experimental-vm-modules).\nconst CustomEventShim = class CustomEvent<T>\n extends EventShim\n implements CustomEventInterface\n{\n #detail: T | null;\n\n constructor(type: string, options: CustomEventInit<T> = {}) {\n super(type, options);\n this.#detail = options?.detail ?? null;\n }\n\n initCustomEvent(\n _type: string,\n _bubbles?: boolean,\n _cancelable?: boolean,\n _detail?: T\n ): void {\n throw new Error('Method not implemented.');\n }\n\n get detail(): T {\n return this.#detail!;\n }\n};\n\nObject.defineProperties(CustomEventShim.prototype, {\n detail: enumerableProperty,\n});\n\nconst EventShimWithRealType = EventShim as object as typeof Event;\nconst CustomEventShimWithRealType =\n CustomEventShim as object as typeof CustomEvent;\nexport {\n EventShimWithRealType as Event,\n EventShimWithRealType as EventShim,\n CustomEventShimWithRealType as CustomEvent,\n CustomEventShimWithRealType as CustomEventShim,\n};\n","/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * This is a limited implemenation of the CSSStyleSheet class\n * and associated functionality.\n */\n\ntype MediaListInterface = MediaList;\n\nconst MediaListShim = class MediaList\n extends Array<string>\n implements MediaListInterface\n{\n get mediaText(): string {\n return this.join(', ');\n }\n toString(): string {\n return this.mediaText;\n }\n appendMedium(medium: string): void {\n if (!this.includes(medium)) {\n this.push(medium);\n }\n }\n deleteMedium(medium: string): void {\n const index = this.indexOf(medium);\n if (index !== -1) {\n this.splice(index, 1);\n }\n }\n item(index: number): string | null {\n return this[index] ?? null;\n }\n};\nconst MediaListShimWithRealType = MediaListShim as object as typeof MediaList;\nexport {MediaListShimWithRealType as MediaList};\n\ntype StyleSheetInterface = StyleSheet;\n\nconst StyleSheetShim = class StyleSheet implements StyleSheetInterface {\n private __media = new MediaListShim();\n\n disabled: boolean = false;\n get href(): string | null {\n return null;\n }\n get media(): MediaList {\n return this.__media;\n }\n get ownerNode(): Element | ProcessingInstruction | null {\n return null;\n }\n get parentStyleSheet(): CSSStyleSheet | null {\n return null;\n }\n get title(): string | null {\n return null;\n }\n get type(): string {\n return 'text/css';\n }\n};\n\nconst StyleSheetShimWithRealType =\n StyleSheetShim as object as typeof StyleSheet;\nexport {StyleSheetShimWithRealType as StyleSheet};\n\ntype CSSRuleInterface = CSSRule;\n\nconst CSSRuleShim = class CSSRule implements CSSRuleInterface {\n static readonly STYLE_RULE: 1 = 1 as const;\n static readonly CHARSET_RULE: 2 = 2 as const;\n static readonly IMPORT_RULE: 3 = 3 as const;\n static readonly MEDIA_RULE: 4 = 4 as const;\n static readonly FONT_FACE_RULE: 5 = 5 as const;\n static readonly PAGE_RULE: 6 = 6 as const;\n static readonly NAMESPACE_RULE: 10 = 10 as const;\n static readonly KEYFRAMES_RULE: 7 = 7 as const;\n static readonly KEYFRAME_RULE: 8 = 8 as const;\n static readonly SUPPORTS_RULE: 12 = 12 as const;\n static readonly COUNTER_STYLE_RULE: 11 = 11 as const;\n static readonly FONT_FEATURE_VALUES_RULE: 14 = 14 as const;\n readonly STYLE_RULE: 1 = 1 as const;\n readonly CHARSET_RULE: 2 = 2 as const;\n readonly IMPORT_RULE: 3 = 3 as const;\n readonly MEDIA_RULE: 4 = 4 as const;\n readonly FONT_FACE_RULE: 5 = 5 as const;\n readonly PAGE_RULE: 6 = 6 as const;\n readonly NAMESPACE_RULE: 10 = 10 as const;\n readonly KEYFRAMES_RULE: 7 = 7 as const;\n readonly KEYFRAME_RULE: 8 = 8 as const;\n readonly SUPPORTS_RULE: 12 = 12 as const;\n readonly COUNTER_STYLE_RULE: 11 = 11 as const;\n readonly FONT_FEATURE_VALUES_RULE: 14 = 14 as const;\n __parentStyleSheet: CSSStyleSheet | null = null;\n\n cssText: string = '';\n get parentRule(): CSSRule | null {\n return null;\n }\n get parentStyleSheet(): CSSStyleSheet | null {\n return this.__parentStyleSheet;\n }\n get type(): number {\n return 0;\n }\n};\n\nconst CSSRuleShimWithRealType = CSSRuleShim as object as typeof CSSRule;\nexport {CSSRuleShimWithRealType as CSSRule};\n\ntype CSSRuleListInterface = CSSRuleList;\n\nconst CSSRuleListShim = class CSSRuleList\n extends Array<CSSRule>\n implements CSSRuleListInterface\n{\n item(index: number): CSSRule | null {\n return this[index] ?? null;\n }\n};\n\nconst CSSRuleListShimWithRealType =\n CSSRuleListShim as object as typeof CSSRuleList;\nexport {CSSRuleListShimWithRealType as CSSRuleList};\n\ntype CSSStyleSheetInterface = CSSStyleSheet;\n\nconst CSSStyleSheetShim = class CSSStyleSheet\n extends StyleSheetShim\n implements CSSStyleSheetInterface\n{\n private __rules = new CSSRuleListShim();\n get cssRules(): CSSRuleList {\n return this.__rules;\n }\n get ownerRule(): CSSRule | null {\n return null;\n }\n get rules(): CSSRuleList {\n return this.cssRules;\n }\n addRule(_selector?: string, _style?: string, _index?: number): number {\n throw new Error('Method not implemented.');\n }\n deleteRule(_index: number): void {\n throw new Error('Method not implemented.');\n }\n insertRule(_rule: string, _index?: number): number {\n throw new Error('Method not implemented.');\n }\n removeRule(_index?: number): void {\n throw new Error('Method not implemented.');\n }\n replace(text: string): Promise<CSSStyleSheet> {\n this.replaceSync(text);\n return Promise.resolve(this);\n }\n replaceSync(text: string): void {\n this.__rules.length = 0;\n const rule = new CSSRuleShim();\n rule.cssText = text;\n this.__rules.push(rule);\n }\n};\n\nconst CSSStyleSheetShimWithRealType =\n CSSStyleSheetShim as object as typeof CSSStyleSheet;\nexport {\n CSSStyleSheetShimWithRealType as CSSStyleSheet,\n CSSStyleSheetShimWithRealType as CSSStyleSheetShim,\n};\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nimport {ElementInternalsShim} from './lib/element-internals.js';\nimport {\n EventTargetShim,\n EventShim,\n CustomEventShim,\n EventTargetShimMeta,\n} from './lib/events.js';\n\nexport {\n ariaMixinAttributes,\n ElementInternals,\n HYDRATE_INTERNALS_ATTR_PREFIX,\n} from './lib/element-internals.js';\nexport {\n CSSRule,\n CSSRuleList,\n CSSStyleSheet,\n MediaList,\n StyleSheet,\n} from './lib/css.js';\nexport {CustomEvent, Event, EventTarget} from './lib/events.js';\n\n// In an empty Node.js vm, we need to patch the global context.\n// TODO: Remove these globalThis assignments when we remove support\n// for vm modules (--experimental-vm-modules).\nglobalThis.Event ??= EventShim;\nglobalThis.CustomEvent ??= CustomEventShim;\n\n// Internal type to be used for the event polyfill functionality.\nexport type HTMLElementWithEventMeta = HTMLElement & EventTargetShimMeta;\n\nconst attributes = new WeakMap<\n InstanceType<typeof HTMLElementShim>,\n Map<string, string>\n>();\nconst attributesForElement = (\n element: InstanceType<typeof HTMLElementShim>\n) => {\n let attrs = attributes.get(element);\n if (attrs === undefined) {\n attributes.set(element, (attrs = new Map()));\n }\n return attrs;\n};\n\n// The typings around the exports below are a little funky:\n//\n// 1. We want the `name` of the shim classes to match the real ones at runtime,\n// hence e.g. `class Element`.\n// 2. We can't shadow the global types with a simple class declaration, because\n// then we can't reference the global types for casting, hence e.g.\n// `const ElementShim = class Element`.\n// 3. We want to export the classes typed as the real ones, hence e.g.\n// `const ElementShimWithRealType = ElementShim as object as typeof Element;`.\n// 4. We want the exported names to match the real ones, hence e.g.\n// `export {ElementShimWithRealType as Element}`.\nconst ElementShim = class Element extends EventTargetShim {\n get attributes() {\n return Array.from(attributesForElement(this)).map(([name, value]) => ({\n name,\n value,\n }));\n }\n private __shadowRootMode: null | ShadowRootMode = null;\n protected __shadowRoot: null | ShadowRoot = null;\n protected __internals: null | ElementInternals = null;\n\n get shadowRoot() {\n if (this.__shadowRootMode === 'closed') {\n return null;\n }\n return this.__shadowRoot;\n }\n get localName() {\n return (this.constructor as NamedCustomHTMLElementConstructor).__localName;\n }\n get tagName() {\n return this.localName?.toUpperCase();\n }\n setAttribute(name: string, value: unknown): void {\n // Emulate browser behavior that silently casts all values to string. E.g.\n // `42` becomes `\"42\"` and `{}` becomes `\"[object Object]\"\"`.\n attributesForElement(this).set(name, String(value));\n }\n removeAttribute(name: string) {\n attributesForElement(this).delete(name);\n }\n toggleAttribute(name: string, force?: boolean): boolean {\n // Steps reference https://dom.spec.whatwg.org/#dom-element-toggleattribute\n if (this.hasAttribute(name)) {\n // Step 5\n if (force === undefined || !force) {\n this.removeAttribute(name);\n return false;\n }\n } else {\n // Step 4\n if (force === undefined || force) {\n // Step 4.1\n this.setAttribute(name, '');\n return true;\n } else {\n // Step 4.2\n return false;\n }\n }\n // Step 6\n return true;\n }\n hasAttribute(name: string) {\n return attributesForElement(this).has(name);\n }\n attachShadow(init: ShadowRootInit): ShadowRoot {\n const shadowRoot = {host: this} as object as ShadowRoot;\n this.__shadowRootMode = init.mode;\n if (init && init.mode === 'open') {\n this.__shadowRoot = shadowRoot;\n }\n return shadowRoot;\n }\n attachInternals(): ElementInternals {\n if (this.__internals !== null) {\n throw new Error(\n `Failed to execute 'attachInternals' on 'HTMLElement': ` +\n `ElementInternals for the specified element was already attached.`\n );\n }\n const internals = new ElementInternalsShim(this as unknown as HTMLElement);\n this.__internals = internals;\n return internals as ElementInternals;\n }\n getAttribute(name: string) {\n const value = attributesForElement(this).get(name);\n return value ?? null;\n }\n};\nconst ElementShimWithRealType = ElementShim as object as typeof Element;\nexport {ElementShimWithRealType as Element};\n\nconst HTMLElementShim = class HTMLElement extends ElementShim {};\nconst HTMLElementShimWithRealType =\n HTMLElementShim as object as typeof HTMLElement;\nexport {HTMLElementShimWithRealType as HTMLElement};\n\n// For convenience, we provide a global instance of a HTMLElement as an event\n// target. This facilitates registering global event handlers\n// (e.g. for @lit/context ContextProvider).\n// We use this in in the SSR render function.\n// Note, this is a bespoke element and not simply `document` or `window` since\n// user code relies on these being undefined in the server environment.\nglobalThis.litServerRoot ??= Object.defineProperty(\n new HTMLElementShimWithRealType(),\n 'localName',\n {\n // Patch localName (and tagName) to return a unique name.\n get() {\n return 'lit-server-root';\n },\n }\n);\n\ninterface CustomHTMLElementConstructor {\n new (): HTMLElement;\n observedAttributes?: string[];\n}\n\ninterface NamedCustomHTMLElementConstructor\n extends CustomHTMLElementConstructor {\n __localName: string;\n}\n\ntype CustomElementRegistration = {\n ctor: {new (): HTMLElement};\n observedAttributes: string[];\n};\n\ntype RealCustomElementRegistry = (typeof globalThis)['customElements'];\ntype RealCustomElementRegistryClass =\n (typeof globalThis)['CustomElementRegistry'];\n\n// Ponyfill for PromiseWithResolvers, remove once we can assume its presence.\ntype PromiseWithResolvers<T> = {\n promise: Promise<T>;\n resolve: (value: T) => void;\n reject: (reason?: unknown) => void;\n};\nfunction promiseWithResolvers<T>(): PromiseWithResolvers<T> {\n let resolve: (value: T) => void;\n let reject: (reason?: unknown) => void;\n const promise = new Promise<T>((res, rej) => {\n resolve = res;\n reject = rej;\n });\n return {promise, resolve: resolve!, reject: reject!};\n}\n\nclass CustomElementRegistry implements RealCustomElementRegistry {\n private __definitions = new Map<string, CustomElementRegistration>();\n private __reverseDefinitions = new Map<\n CustomHTMLElementConstructor,\n string\n >();\n private __pendingWhenDefineds = new Map<\n string,\n PromiseWithResolvers<CustomElementConstructor>\n >();\n\n define(name: string, ctor: CustomHTMLElementConstructor) {\n if (this.__definitions.has(name)) {\n if (process.env.NODE_ENV === 'development') {\n console.warn(\n `'CustomElementRegistry' already has \"${name}\" defined. ` +\n `This may have been caused by live reload or hot module ` +\n `replacement in which case it can be safely ignored.\\n` +\n `Make sure to test your application with a production build as ` +\n `repeat registrations will throw in production.`\n );\n } else {\n throw new Error(\n `Failed to execute 'define' on 'CustomElementRegistry': ` +\n `the name \"${name}\" has already been used with this registry`\n );\n }\n }\n if (this.__reverseDefinitions.has(ctor)) {\n throw new Error(\n `Failed to execute 'define' on 'CustomElementRegistry': ` +\n `the constructor has already been used with this registry for the ` +\n `tag name ${this.__reverseDefinitions.get(ctor)}`\n );\n }\n // Provide tagName and localName for the component.\n (ctor as NamedCustomHTMLElementConstructor).__localName = name;\n this.__definitions.set(name, {\n ctor,\n // Note it's important we read `observedAttributes` in case it is a getter\n // with side-effects, as is the case in Lit, where it triggers class\n // finalization.\n //\n // TODO(aomarks) To be spec compliant, we should also capture the\n // registration-time lifecycle methods like `connectedCallback`. For them\n // to be actually accessible to e.g. the Lit SSR element renderer, though,\n // we'd need to introduce a new API for accessing them (since `get` only\n // returns the constructor).\n observedAttributes: ctor.observedAttributes ?? [],\n });\n this.__reverseDefinitions.set(ctor, name);\n this.__pendingWhenDefineds.get(name)?.resolve(ctor);\n this.__pendingWhenDefineds.delete(name);\n }\n\n get(name: string) {\n const definition = this.__definitions.get(name);\n return definition?.ctor;\n }\n\n getName(ctor: CustomHTMLElementConstructor) {\n return this.__reverseDefinitions.get(ctor) ?? null;\n }\n\n upgrade(_element: HTMLElement) {\n // In SSR this doesn't make a lot of sense, so we do nothing.\n throw new Error(\n `customElements.upgrade is not currently supported in SSR. ` +\n `Please file a bug if you need it.`\n );\n }\n\n async whenDefined(name: string): Promise<CustomElementConstructor> {\n const definition = this.__definitions.get(name);\n if (definition) {\n return definition.ctor;\n }\n let withResolvers = this.__pendingWhenDefineds.get(name);\n if (!withResolvers) {\n withResolvers = promiseWithResolvers<CustomElementConstructor>();\n this.__pendingWhenDefineds.set(name, withResolvers);\n }\n return withResolvers.promise;\n }\n}\n\nconst CustomElementRegistryShimWithRealType =\n CustomElementRegistry as object as RealCustomElementRegistryClass;\nexport {CustomElementRegistryShimWithRealType as CustomElementRegistry};\n\nexport const customElements = new CustomElementRegistryShimWithRealType();\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nconst NODE_MODE = false;\n\n// Allows minifiers to rename references to globalThis\nconst global = globalThis;\n\n/**\n * Whether the current browser supports `adoptedStyleSheets`.\n */\nexport const supportsAdoptingStyleSheets: boolean =\n global.ShadowRoot &&\n (global.ShadyCSS === undefined || global.ShadyCSS.nativeShadow) &&\n 'adoptedStyleSheets' in Document.prototype &&\n 'replace' in CSSStyleSheet.prototype;\n\n/**\n * A CSSResult or native CSSStyleSheet.\n *\n * In browsers that support constructible CSS style sheets, CSSStyleSheet\n * object can be used for styling along side CSSResult from the `css`\n * template tag.\n */\nexport type CSSResultOrNative = CSSResult | CSSStyleSheet;\n\nexport type CSSResultArray = Array<CSSResultOrNative | CSSResultArray>;\n\n/**\n * A single CSSResult, CSSStyleSheet, or an array or nested arrays of those.\n */\nexport type CSSResultGroup = CSSResultOrNative | CSSResultArray;\n\nconst constructionToken = Symbol();\n\nconst cssTagCache = new WeakMap<TemplateStringsArray, CSSStyleSheet>();\n\n/**\n * A container for a string of CSS text, that may be used to create a CSSStyleSheet.\n *\n * CSSResult is the return value of `css`-tagged template literals and\n * `unsafeCSS()`. In order to ensure that CSSResults are only created via the\n * `css` tag and `unsafeCSS()`, CSSResult cannot be constructed directly.\n */\nexport class CSSResult {\n // This property needs to remain unminified.\n ['_$cssResult$'] = true;\n readonly cssText: string;\n private _styleSheet?: CSSStyleSheet;\n private _strings: TemplateStringsArray | undefined;\n\n private constructor(\n cssText: string,\n strings: TemplateStringsArray | undefined,\n safeToken: symbol\n ) {\n if (safeToken !== constructionToken) {\n throw new Error(\n 'CSSResult is not constructable. Use `unsafeCSS` or `css` instead.'\n );\n }\n this.cssText = cssText;\n this._strings = strings;\n }\n\n // This is a getter so that it's lazy. In practice, this means stylesheets\n // are not created until the first element instance is made.\n get styleSheet(): CSSStyleSheet | undefined {\n // If `supportsAdoptingStyleSheets` is true then we assume CSSStyleSheet is\n // constructable.\n let styleSheet = this._styleSheet;\n const strings = this._strings;\n if (supportsAdoptingStyleSheets && styleSheet === undefined) {\n const cacheable = strings !== undefined && strings.length === 1;\n if (cacheable) {\n styleSheet = cssTagCache.get(strings);\n }\n if (styleSheet === undefined) {\n (this._styleSheet = styleSheet = new CSSStyleSheet()).replaceSync(\n this.cssText\n );\n if (cacheable) {\n cssTagCache.set(strings, styleSheet);\n }\n }\n }\n return styleSheet;\n }\n\n toString(): string {\n return this.cssText;\n }\n}\n\ntype ConstructableCSSResult = CSSResult & {\n new (\n cssText: string,\n strings: TemplateStringsArray | undefined,\n safeToken: symbol\n ): CSSResult;\n};\n\nconst textFromCSSResult = (value: CSSResultGroup | number) => {\n // This property needs to remain unminified.\n if ((value as CSSResult)['_$cssResult$'] === true) {\n return (value as CSSResult).cssText;\n } else if (typeof value === 'number') {\n return value;\n } else {\n throw new Error(\n `Value passed to 'css' function must be a 'css' function result: ` +\n `${value}. Use 'unsafeCSS' to pass non-literal values, but take care ` +\n `to ensure page security.`\n );\n }\n};\n\n/**\n * Wrap a value for interpolation in a {@linkcode css} tagged template literal.\n *\n * This is unsafe because untrusted CSS text can be used to phone home\n * or exfiltrate data to an attacker controlled site. Take care to only use\n * this with trusted input.\n */\nexport const unsafeCSS = (value: unknown) =>\n new (CSSResult as ConstructableCSSResult)(\n typeof value === 'string' ? value : String(value),\n undefined,\n constructionToken\n );\n\n/**\n * A template literal tag which can be used with LitElement's\n * {@linkcode LitElement.styles} property to set element styles.\n *\n * For security reasons, only literal string values and number may be used in\n * embedded expressions. To incorporate non-literal values {@linkcode unsafeCSS}\n * may be used inside an expression.\n */\nexport const css = (\n strings: TemplateStringsArray,\n ...values: (CSSResultGroup | number)[]\n): CSSResult => {\n const cssText =\n strings.length === 1\n ? strings[0]\n : values.reduce(\n (acc, v, idx) => acc + textFromCSSResult(v) + strings[idx + 1],\n strings[0]\n );\n return new (CSSResult as ConstructableCSSResult)(\n cssText,\n strings,\n constructionToken\n );\n};\n\n/**\n * Applies the given styles to a `shadowRoot`. When Shadow DOM is\n * available but `adoptedStyleSheets` is not, styles are appended to the\n * `shadowRoot` to [mimic the native feature](https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/adoptedStyleSheets).\n * Note, when shimming is used, any styles that are subsequently placed into\n * the shadowRoot should be placed *before* any shimmed adopted styles. This\n * will match spec behavior that gives adopted sheets precedence over styles in\n * shadowRoot.\n */\nexport const adoptStyles = (\n renderRoot: ShadowRoot,\n styles: Array<CSSResultOrNative>\n) => {\n if (supportsAdoptingStyleSheets) {\n (renderRoot as ShadowRoot).adoptedStyleSheets = styles.map((s) =>\n s instanceof CSSStyleSheet ? s : s.styleSheet!\n );\n } else {\n for (const s of styles) {\n const style = document.createElement('style');\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const nonce = (global as any)['litNonce'];\n if (nonce !== undefined) {\n style.setAttribute('nonce', nonce);\n }\n style.textContent = (s as CSSResult).cssText;\n renderRoot.appendChild(style);\n }\n }\n};\n\nconst cssResultFromStyleSheet = (sheet: CSSStyleSheet) => {\n let cssText = '';\n for (const rule of sheet.cssRules) {\n cssText += rule.cssText;\n }\n return unsafeCSS(cssText);\n};\n\nexport const getCompatibleStyle =\n supportsAdoptingStyleSheets ||\n (NODE_MODE && global.CSSStyleSheet === undefined)\n ? (s: CSSResultOrNative) => s\n : (s: CSSResultOrNative) =>\n s instanceof CSSStyleSheet ? cssResultFromStyleSheet(s) : s;\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Use this module if you want to create your own base class extending\n * {@link ReactiveElement}.\n * @packageDocumentation\n */\n\nimport {\n getCompatibleStyle,\n adoptStyles,\n CSSResultGroup,\n CSSResultOrNative,\n} from './css-tag.js';\nimport type {\n ReactiveController,\n ReactiveControllerHost,\n} from './reactive-controller.js';\n\n// In the Node build, this import will be injected by Rollup:\n// import {HTMLElement, customElements} from '@lit-labs/ssr-dom-shim';\n\nexport * from './css-tag.js';\nexport type {\n ReactiveController,\n ReactiveControllerHost,\n} from './reactive-controller.js';\n\n/**\n * Removes the `readonly` modifier from properties in the union K.\n *\n * This is a safer way to cast a value to a type with a mutable version of a\n * readonly field, than casting to an interface with the field re-declared\n * because it preserves the type of all the fields and warns on typos.\n */\ntype Mutable<T, K extends keyof T> = Omit<T, K> & {\n -readonly [P in keyof Pick<T, K>]: P extends K ? T[P] : never;\n};\n\n// TODO (justinfagnani): Add `hasOwn` here when we ship ES2022\nconst {\n is,\n defineProperty,\n getOwnPropertyDescriptor,\n getOwnPropertyNames,\n getOwnPropertySymbols,\n getPrototypeOf,\n} = Object;\n\nconst NODE_MODE = false;\n\n// Lets a minifier replace globalThis references with a minified name\nconst global = globalThis;\n\nif (NODE_MODE) {\n global.customElements ??= customElements;\n}\n\nconst DEV_MODE = true;\n\nlet issueWarning: (code: string, warning: string) => void;\n\nconst trustedTypes = (global as unknown as {trustedTypes?: {emptyScript: ''}})\n .trustedTypes;\n\n// Temporary workaround for https://crbug.com/993268\n// Currently, any attribute starting with \"on\" is considered to be a\n// TrustedScript source. Such boolean attributes must be set to the equivalent\n// trusted emptyScript value.\nconst emptyStringForBooleanAttribute = trustedTypes\n ? (trustedTypes.emptyScript as unknown as '')\n : '';\n\nconst polyfillSupport = DEV_MODE\n ? global.reactiveElementPolyfillSupportDevMode\n : global.reactiveElementPolyfillSupport;\n\nif (DEV_MODE) {\n // Ensure warnings are issued only 1x, even if multiple versions of Lit\n // are loaded.\n global.litIssuedWarnings ??= new Set();\n\n /**\n * Issue a warning if we haven't already, based either on `code` or `warning`.\n * Warnings are disabled automatically only by `warning`; disabling via `code`\n * can be done by users.\n */\n issueWarning = (code: string, warning: string) => {\n warning += ` See https://lit.dev/msg/${code} for more information.`;\n if (\n !global.litIssuedWarnings!.has(warning) &&\n !global.litIssuedWarnings!.has(code)\n ) {\n console.warn(warning);\n global.litIssuedWarnings!.add(warning);\n }\n };\n\n queueMicrotask(() => {\n issueWarning(\n 'dev-mode',\n `Lit is in dev mode. Not recommended for production!`\n );\n\n // Issue polyfill support warning.\n if (global.ShadyDOM?.inUse && polyfillSupport === undefined) {\n issueWarning(\n 'polyfill-support-missing',\n `Shadow DOM is being polyfilled via \\`ShadyDOM\\` but ` +\n `the \\`polyfill-support\\` module has not been loaded.`\n );\n }\n });\n}\n\n/**\n * Contains types that are part of the unstable debug API.\n *\n * Everything in this API is not stable and may change or be removed in the future,\n * even on patch releases.\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace ReactiveUnstable {\n /**\n * When Lit is running in dev mode and `window.emitLitDebugLogEvents` is true,\n * we will emit 'lit-debug' events to window, with live details about the update and render\n * lifecycle. These can be useful for writing debug tooling and visualizations.\n *\n * Please be aware that running with window.emitLitDebugLogEvents has performance overhead,\n * making certain operations that are normally very cheap (like a no-op render) much slower,\n * because we must copy data and dispatch events.\n */\n // eslint-disable-next-line @typescript-eslint/no-namespace\n export namespace DebugLog {\n export type Entry = Update;\n export interface Update {\n kind: 'update';\n }\n }\n}\n\ninterface DebugLoggingWindow {\n // Even in dev mode, we generally don't want to emit these events, as that's\n // another level of cost, so only emit them when DEV_MODE is true _and_ when\n // window.emitLitDebugEvents is true.\n emitLitDebugLogEvents?: boolean;\n}\n\n/**\n * Useful for visualizing and logging insights into what the Lit template system is doing.\n *\n * Compiled out of prod mode builds.\n */\nconst debugLogEvent = DEV_MODE\n ? (event: ReactiveUnstable.DebugLog.Entry) => {\n const shouldEmit = (global as unknown as DebugLoggingWindow)\n .emitLitDebugLogEvents;\n if (!shouldEmit) {\n return;\n }\n global.dispatchEvent(\n new CustomEvent<ReactiveUnstable.DebugLog.Entry>('lit-debug', {\n detail: event,\n })\n );\n }\n : undefined;\n\n/*\n * When using Closure Compiler, JSCompiler_renameProperty(property, object) is\n * replaced at compile time by the munged name for object[property]. We cannot\n * alias this function, so we have to use a small shim that has the same\n * behavior when not compiling.\n */\n/*@__INLINE__*/\nconst JSCompiler_renameProperty = <P extends PropertyKey>(\n prop: P,\n _obj: unknown\n): P => prop;\n\n/**\n * Converts property values to and from attribute values.\n */\nexport interface ComplexAttributeConverter<Type = unknown, TypeHint = unknown> {\n /**\n * Called to convert an attribute value to a property\n * value.\n */\n fromAttribute?(value: string | null, type?: TypeHint): Type;\n\n /**\n * Called to convert a property value to an attribute\n * value.\n *\n * It returns unknown instead of string, to be compatible with\n * https://github.com/WICG/trusted-types (and similar efforts).\n */\n toAttribute?(value: Type, type?: TypeHint): unknown;\n}\n\ntype AttributeConverter<Type = unknown, TypeHint = unknown> =\n | ComplexAttributeConverter<Type>\n | ((value: string | null, type?: TypeHint) => Type);\n\n/**\n * Defines options for a property accessor.\n */\nexport interface PropertyDeclaration<Type = unknown, TypeHint = unknown> {\n /**\n * When set to `true`, indicates the property is internal private state. The\n * property should not be set by users. When using TypeScript, this property\n * should be marked as `private` or `protected`, and it is also a common\n * practice to use a leading `_` in the name. The property is not added to\n * `observedAttributes`.\n */\n readonly state?: boolean;\n\n /**\n * Indicates how and whether the property becomes an observed attribute.\n * If the value is `false`, the property is not added to `observedAttributes`.\n * If true or absent, the lowercased property name is observed (e.g. `fooBar`\n * becomes `foobar`). If a string, the string value is observed (e.g\n * `attribute: 'foo-bar'`).\n */\n readonly attribute?: boolean | string;\n\n /**\n * Indicates the type of the property. This is used only as a hint for the\n * `converter` to determine how to convert the attribute\n * to/from a property.\n */\n readonly type?: TypeHint;\n\n /**\n * Indicates how to convert the attribute to/from a property. If this value\n * is a function, it is used to convert the attribute value a the property\n * value. If it's an object, it can have keys for `fromAttribute` and\n * `toAttribute`. If no `toAttribute` function is provided and\n * `reflect` is set to `true`, the property value is set directly to the\n * attribute. A default `converter` is used if none is provided; it supports\n * `Boolean`, `String`, `Number`, `Object`, and `Array`. Note,\n * when a property changes and the converter is used to update the attribute,\n * the property is never updated again as a result of the attribute changing,\n * and vice versa.\n */\n readonly converter?: AttributeConverter<Type, TypeHint>;\n\n /**\n * Indicates if the property should reflect to an attribute.\n * If `true`, when the property is set, the attribute is set using the\n * attribute name determined according to the rules for the `attribute`\n * property option and the value of the property converted using the rules\n * from the `converter` property option.\n */\n readonly reflect?: boolean;\n\n /**\n * A function that indicates if a property should be considered changed when\n * it is set. The function should take the `newValue` and `oldValue` and\n * return `true` if an update should be requested.\n */\n hasChanged?(value: Type, oldValue: Type): boolean;\n\n /**\n * Indicates whether an accessor will be created for this property. By\n * default, an accessor will be generated for this property that requests an\n * update when set. If this flag is `true`, no accessor will be created, and\n * it will be the user's responsibility to call\n * `this.requestUpdate(propertyName, oldValue)` to request an update when\n * the property changes.\n */\n readonly noAccessor?: boolean;\n\n /**\n * Whether this property is wrapping accessors. This is set by `@property`\n * to control the initial value change and reflection logic.\n *\n * @internal\n */\n wrapped?: boolean;\n\n /**\n * When `true`, uses the initial value of the property as the default value,\n * which changes how attributes are handled:\n * - The initial value does *not* reflect, even if the `reflect` option is `true`.\n * Subsequent changes to the property will reflect, even if they are equal to the\n * default value.\n * - When the attribute is removed, the property is set to the default value\n * - The initial value will not trigger an old value in the `changedProperties` map\n * argument to update lifecycle methods.\n *\n * When set, properties must be initialized, either with a field initializer, or an\n * assignment in the constructor. Not initializing the property may lead to\n * improper handling of subsequent property assignments.\n *\n * While this behavior is opt-in, most properties that reflect to attributes should\n * use `useDefault: true` so that their initial values do not reflect.\n */\n useDefault?: boolean;\n}\n\n/**\n * Map of properties to PropertyDeclaration options. For each property an\n * accessor is made, and the property is processed according to the\n * PropertyDeclaration options.\n */\nexport interface PropertyDeclarations {\n readonly [key: string]: PropertyDeclaration;\n}\n\ntype PropertyDeclarationMap = Map<PropertyKey, PropertyDeclaration>;\n\ntype AttributeMap = Map<string, PropertyKey>;\n\n/**\n * A Map of property keys to values.\n *\n * Takes an optional type parameter T, which when specified as a non-any,\n * non-unknown type, will make the Map more strongly-typed, associating the map\n * keys with their corresponding value type on T.\n *\n * Use `PropertyValues<this>` when overriding ReactiveElement.update() and\n * other lifecycle methods in order to get stronger type-checking on keys\n * and values.\n */\n// This type is conditional so that if the parameter T is not specified, or\n// is `any`, the type will include `Map<PropertyKey, unknown>`. Since T is not\n// given in the uses of PropertyValues in this file, all uses here fallback to\n// meaning `Map<PropertyKey, unknown>`, but if a developer uses\n// `PropertyValues<this>` (or any other value for T) they will get a\n// strongly-typed Map type.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type PropertyValues<T = any> = T extends object\n ? PropertyValueMap<T>\n : Map<PropertyKey, unknown>;\n\n/**\n * Do not use, instead prefer {@linkcode PropertyValues}.\n */\n// This type must be exported such that JavaScript generated by the Google\n// Closure Compiler can import a type reference.\nexport interface PropertyValueMap<T> extends Map<PropertyKey, unknown> {\n get<K extends keyof T>(k: K): T[K] | undefined;\n set<K extends keyof T>(key: K, value: T[K]): this;\n has<K extends keyof T>(k: K): boolean;\n delete<K extends keyof T>(k: K): boolean;\n}\n\nexport const defaultConverter: ComplexAttributeConverter = {\n toAttribute(value: unknown, type?: unknown): unknown {\n switch (type) {\n case Boolean:\n value = value ? emptyStringForBooleanAttribute : null;\n break;\n case Object:\n case Array:\n // if the value is `null` or `undefined` pass this through\n // to allow removing/no change behavior.\n value = value == null ? value : JSON.stringify(value);\n break;\n }\n return value;\n },\n\n fromAttribute(value: string | null, type?: unknown) {\n let fromValue: unknown = value;\n switch (type) {\n case Boolean:\n fromValue = value !== null;\n break;\n case Number:\n fromValue = value === null ? null : Number(value);\n break;\n case Object:\n case Array:\n // Do *not* generate exception when invalid JSON is set as elements\n // don't normally complain on being mis-configured.\n // TODO(sorvell): Do generate exception in *dev mode*.\n try {\n // Assert to adhere to Bazel's \"must type assert JSON parse\" rule.\n fromValue = JSON.parse(value!) as unknown;\n } catch (e) {\n fromValue = null;\n }\n break;\n }\n return fromValue;\n },\n};\n\nexport interface HasChanged {\n (value: unknown, old: unknown): boolean;\n}\n\n/**\n * Change function that returns true if `value` is different from `oldValue`.\n * This method is used as the default for a property's `hasChanged` function.\n */\nexport const notEqual: HasChanged = (value: unknown, old: unknown): boolean =>\n !is(value, old);\n\nconst defaultPropertyDeclaration: PropertyDeclaration = {\n attribute: true,\n type: String,\n converter: defaultConverter,\n reflect: false,\n useDefault: false,\n hasChanged: notEqual,\n};\n\n/**\n * A string representing one of the supported dev mode warning categories.\n */\nexport type WarningKind =\n | 'change-in-update'\n | 'migration'\n | 'async-perform-update';\n\nexport type Initializer = (element: ReactiveElement) => void;\n\n// Temporary, until google3 is on TypeScript 5.2\ndeclare global {\n interface SymbolConstructor {\n readonly metadata: unique symbol;\n }\n}\n\n// Ensure metadata is enabled. TypeScript does not polyfill\n// Symbol.metadata, so we must ensure that it exists.\n(Symbol as {metadata: symbol}).metadata ??= Symbol('metadata');\n\ndeclare global {\n // This is public global API, do not change!\n // eslint-disable-next-line no-var\n var litPropertyMetadata: WeakMap<\n object,\n Map<PropertyKey, PropertyDeclaration>\n >;\n}\n\n// Map from a class's metadata object to property options\n// Note that we must use nullish-coalescing assignment so that we only use one\n// map even if we load multiple version of this module.\nglobal.litPropertyMetadata ??= new WeakMap<\n object,\n Map<PropertyKey, PropertyDeclaration>\n>();\n\n/**\n * Base element class which manages element properties and attributes. When\n * properties change, the `update` method is asynchronously called. This method\n * should be supplied by subclasses to render updates as desired.\n * @noInheritDoc\n */\nexport abstract class ReactiveElement\n // In the Node build, this `extends` clause will be substituted with\n // `(globalThis.HTMLElement ?? HTMLElement)`.\n //\n // This way, we will first prefer any global `HTMLElement` polyfill that the\n // user has assigned, and then fall back to the `HTMLElement` shim which has\n // been imported (see note at the top of this file about how this import is\n // generated by Rollup). Note that the `HTMLElement` variable has been\n // shadowed by this import, so it no longer refers to the global.\n extends HTMLElement\n implements ReactiveControllerHost\n{\n // Note: these are patched in only in DEV_MODE.\n /**\n * Read or set all the enabled warning categories for this class.\n *\n * This property is only used in development builds.\n *\n * @nocollapse\n * @category dev-mode\n */\n static enabledWarnings?: WarningKind[];\n\n /**\n * Enable the given warning category for this class.\n *\n * This method only exists in development builds, so it should be accessed\n * with a guard like:\n *\n * ```ts\n * // Enable for all ReactiveElement subclasses\n * ReactiveElement.enableWarning?.('migration');\n *\n * // Enable for only MyElement and subclasses\n * MyElement.enableWarning?.('migration');\n * ```\n *\n * @nocollapse\n * @category dev-mode\n */\n static enableWarning?: (warningKind: WarningKind) => void;\n\n /**\n * Disable the given warning category for this class.\n *\n * This method only exists in development builds, so it should be accessed\n * with a guard like:\n *\n * ```ts\n * // Disable for all ReactiveElement subclasses\n * ReactiveElement.disableWarning?.('migration');\n *\n * // Disable for only MyElement and subclasses\n * MyElement.disableWarning?.('migration');\n * ```\n *\n * @nocollapse\n * @category dev-mode\n */\n static disableWarning?: (warningKind: WarningKind) => void;\n\n /**\n * Adds an initializer function to the class that is called during instance\n * construction.\n *\n * This is useful for code that runs against a `ReactiveElement`\n * subclass, such as a decorator, that needs to do work for each\n * instance, such as setting up a `ReactiveController`.\n *\n * ```ts\n * const myDecorator = (target: typeof ReactiveElement, key: string) => {\n * target.addInitializer((instance: ReactiveElement) => {\n * // This is run during construction of the element\n * new MyController(instance);\n * });\n * }\n * ```\n *\n * Decorating a field will then cause each instance to run an initializer\n * that adds a controller:\n *\n * ```ts\n * class MyElement extends LitElement {\n * @myDecorator foo;\n * }\n * ```\n *\n * Initializers are stored per-constructor. Adding an initializer to a\n * subclass does not add it to a superclass. Since initializers are run in\n * constructors, initializers will run in order of the class hierarchy,\n * starting with superclasses and progressing to the instance's class.\n *\n * @nocollapse\n */\n static addInitializer(initializer: Initializer) {\n this.__prepare();\n (this._initializers ??= []).push(initializer);\n }\n\n static _initializers?: Initializer[];\n\n /*\n * Due to closure compiler ES6 compilation bugs, @nocollapse is required on\n * all static methods and properties with initializers. Reference:\n * - https://github.com/google/closure-compiler/issues/1776\n */\n\n /**\n * Maps attribute names to properties; for example `foobar` attribute to\n * `fooBar` property. Created lazily on user subclasses when finalizing the\n * class.\n * @nocollapse\n */\n private static __attributeToPropertyMap: AttributeMap;\n\n /**\n * Marks class as having been finalized, which includes creating properties\n * from `static properties`, but does *not* include all properties created\n * from decorators.\n * @nocollapse\n */\n protected static finalized: true | undefined;\n\n /**\n * Memoized list of all element properties, including any superclass\n * properties. Created lazily on user subclasses when finalizing the class.\n *\n * @nocollapse\n * @category properties\n */\n static elementProperties: PropertyDeclarationMap;\n\n /**\n * User-supplied object that maps property names to `PropertyDeclaration`\n * objects containing options for configuring reactive properties. When\n * a reactive property is set the element will update and render.\n *\n * By default properties are public fields, and as such, they should be\n * considered as primarily settable by element users, either via attribute or\n * the property itself.\n *\n * Generally, properties that are changed by the element should be private or\n * protected fields and should use the `state: true` option. Properties\n * marked as `state` do not reflect from the corresponding attribute\n *\n * However, sometimes element code does need to set a public property. This\n * should typically only be done in response to user interaction, and an event\n * should be fired informing the user; for example, a checkbox sets its\n * `checked` property when clicked and fires a `changed` event. Mutating\n * public properties should typically not be done for non-primitive (object or\n * array) properties. In other cases when an element needs to manage state, a\n * private property set with the `state: true` option should be used. When\n * needed, state properties can be initialized via public properties to\n * facilitate complex interactions.\n * @nocollapse\n * @category properties\n */\n static properties: PropertyDeclarations;\n\n /**\n * Memoized list of all element styles.\n * Created lazily on user subclasses when finalizing the class.\n * @nocollapse\n * @category styles\n */\n static elementStyles: Array<CSSResultOrNative> = [];\n\n /**\n * Array of styles to apply to the element. The styles should be defined\n * using the {@linkcode css} tag function, via constructible stylesheets, or\n * imported from native CSS module scripts.\n *\n * Note on Content Security Policy:\n *\n * Element styles are implemented with `<style>` tags when the browser doesn't\n * support adopted StyleSheets. To use such `<style>` tags with the style-src\n * CSP directive, the style-src value must either include 'unsafe-inline' or\n * `nonce-<base64-value>` with `<base64-value>` replaced be a server-generated\n * nonce.\n *\n * To provide a nonce to use on generated `<style>` elements, set\n * `window.litNonce` to a server-generated nonce in your page's HTML, before\n * loading application code:\n *\n * ```html\n * <script>\n * // Generated and unique per request:\n * window.litNonce = 'a1b2c3d4';\n * </script>\n * ```\n * @nocollapse\n * @category styles\n */\n static styles?: CSSResultGroup;\n\n /**\n * Returns a list of attributes corresponding to the registered properties.\n * @nocollapse\n * @category attributes\n */\n static get observedAttributes() {\n // Ensure we've created all properties\n this.finalize();\n // this.__attributeToPropertyMap is only undefined after finalize() in\n // ReactiveElement itself. ReactiveElement.observedAttributes is only\n // accessed with ReactiveElement as the receiver when a subclass or mixin\n // calls super.observedAttributes\n return (\n this.__attributeToPropertyMap && [...this.__attributeToPropertyMap.keys()]\n );\n }\n\n private __instanceProperties?: PropertyValues = undefined;\n\n /**\n * Creates a property accessor on the element prototype if one does not exist\n * and stores a {@linkcode PropertyDeclaration} for the property with the\n * given options. The property setter calls the property's `hasChanged`\n * property option or uses a strict identity check to determine whether or not\n * to request an update.\n *\n * This method may be overridden to customize properties; however,\n * when doing so, it's important to call `super.createProperty` to ensure\n * the property is setup correctly. This method calls\n * `getPropertyDescriptor` internally to get a descriptor to install.\n * To customize what properties do when they are get or set, override\n * `getPropertyDescriptor`. To customize the options for a property,\n * implement `createProperty` like this:\n *\n * ```ts\n * static createProperty(name, options) {\n * options = Object.assign(options, {myOption: true});\n * super.createProperty(name, options);\n * }\n * ```\n *\n * @nocollapse\n * @category properties\n */\n static createProperty(\n name: PropertyKey,\n options: PropertyDeclaration = defaultPropertyDeclaration\n ) {\n // If this is a state property, force the attribute to false.\n if (options.state) {\n (options as Mutable<PropertyDeclaration, 'attribute'>).attribute = false;\n }\n this.__prepare();\n // Whether this property is wrapping accessors.\n // Helps control the initial value change and reflection logic.\n if (this.prototype.hasOwnProperty(name)) {\n options = Object.create(options);\n options.wrapped = true;\n }\n this.elementProperties.set(name, options);\n if (!options.noAccessor) {\n const key = DEV_MODE\n ? // Use Symbol.for in dev mode to make it easier to maintain state\n // when doing HMR.\n Symbol.for(`${String(name)} (@property() cache)`)\n : Symbol();\n const descriptor = this.getPropertyDescriptor(name, key, options);\n if (descriptor !== undefined) {\n defineProperty(this.prototype, name, descriptor);\n }\n }\n }\n\n /**\n * Returns a property descriptor to be defined on the given named property.\n * If no descriptor is returned, the property will not become an accessor.\n * For example,\n *\n * ```ts\n * class MyElement extends LitElement {\n * static getPropertyDescriptor(name, key, options) {\n * const defaultDescriptor =\n * super.getPropertyDescriptor(name, key, options);\n * const setter = defaultDescriptor.set;\n * return {\n * get: defaultDescriptor.get,\n * set(value) {\n * setter.call(this, value);\n * // custom action.\n * },\n * configurable: true,\n * enumerable: true\n * }\n * }\n * }\n * ```\n *\n * @nocollapse\n * @category properties\n */\n protected static getPropertyDescriptor(\n name: PropertyKey,\n key: string | symbol,\n options: PropertyDeclaration\n ): PropertyDescriptor | undefined {\n const {get, set} = getOwnPropertyDescriptor(this.prototype, name) ?? {\n get(this: ReactiveElement) {\n return this[key as keyof typeof this];\n },\n set(this: ReactiveElement, v: unknown) {\n (this as unknown as Record<string | symbol, unknown>)[key] = v;\n },\n };\n if (DEV_MODE && get == null) {\n if ('value' in (getOwnPropertyDescriptor(this.prototype, name) ?? {})) {\n throw new Error(\n `Field ${JSON.stringify(String(name))} on ` +\n `${this.name} was declared as a reactive property ` +\n `but it's actually declared as a value on the prototype. ` +\n `Usually this is due to using @property or @state on a method.`\n );\n }\n issueWarning(\n 'reactive-property-without-getter',\n `Field ${JSON.stringify(String(name))} on ` +\n `${this.name} was declared as a reactive property ` +\n `but it does not have a getter. This will be an error in a ` +\n `future version of Lit.`\n );\n }\n return {\n get,\n set(this: ReactiveElement, value: unknown) {\n const oldValue = get?.call(this);\n set?.call(this, value);\n this.requestUpdate(name, oldValue, options);\n },\n configurable: true,\n enumerable: true,\n };\n }\n\n /**\n * Returns the property options associated with the given property.\n * These options are defined with a `PropertyDeclaration` via the `properties`\n * object or the `@property` decorator and are registered in\n * `createProperty(...)`.\n *\n * Note, this method should be considered \"final\" and not overridden. To\n * customize the options for a given property, override\n * {@linkcode createProperty}.\n *\n * @nocollapse\n * @final\n * @category properties\n */\n static getPropertyOptions(name: PropertyKey) {\n return this.elementProperties.get(name) ?? defaultPropertyDeclaration;\n }\n\n // Temporary, until google3 is on TypeScript 5.2\n declare static [Symbol.metadata]: object & Record<PropertyKey, unknown>;\n\n /**\n * Initializes static own properties of the class used in bookkeeping\n * for element properties, initializers, etc.\n *\n * Can be called multiple times by code that needs to ensure these\n * properties exist before using them.\n *\n * This method ensures the superclass is finalized so that inherited\n * property metadata can be copied down.\n * @nocollapse\n */\n private static __prepare() {\n if (\n this.hasOwnProperty(JSCompiler_renameProperty('elementProperties', this))\n ) {\n // Already prepared\n return;\n }\n // Finalize any superclasses\n const superCtor = getPrototypeOf(this) as typeof ReactiveElement;\n superCtor.finalize();\n\n // Create own set of initializers for this class if any exist on the\n // superclass and copy them down. Note, for a small perf boost, avoid\n // creating initializers unless needed.\n if (superCtor._initializers !== undefined) {\n this._initializers = [...superCtor._initializers];\n }\n // Initialize elementProperties from the superclass\n this.elementProperties = new Map(superCtor.elementProperties);\n }\n\n /**\n * Finishes setting up the class so that it's ready to be registered\n * as a custom element and instantiated.\n *\n * This method is called by the ReactiveElement.observedAttributes getter.\n * If you override the observedAttributes getter, you must either call\n * super.observedAttributes to trigger finalization, or call finalize()\n * yourself.\n *\n * @nocollapse\n */\n protected static finalize() {\n if (this.hasOwnProperty(JSCompiler_renameProperty('finalized', this))) {\n return;\n }\n this.finalized = true;\n this.__prepare();\n\n // Create properties from the static properties block:\n if (this.hasOwnProperty(JSCompiler_renameProperty('properties', this))) {\n const props = this.properties;\n const propKeys = [\n ...getOwnPropertyNames(props),\n ...getOwnPropertySymbols(props),\n ] as Array<keyof typeof props>;\n for (const p of propKeys) {\n this.createProperty(p, props[p]);\n }\n }\n\n // Create properties from standard decorator metadata:\n const metadata = this[Symbol.metadata];\n if (metadata !== null) {\n const properties = litPropertyMetadata.get(metadata);\n if (properties !== undefined) {\n for (const [p, options] of properties) {\n this.elementProperties.set(p, options);\n }\n }\n }\n\n // Create the attribute-to-property map\n this.__attributeToPropertyMap = new Map();\n for (const [p, options] of this.elementProperties) {\n const attr = this.__attributeNameForProperty(p, options);\n if (attr !== undefined) {\n this.__attributeToPropertyMap.set(attr, p);\n }\n }\n\n this.elementStyles = this.finalizeStyles(this.styles);\n\n if (DEV_MODE) {\n if (this.hasOwnProperty('createProperty')) {\n issueWarning(\n 'no-override-create-property',\n 'Overriding ReactiveElement.createProperty() is deprecated. ' +\n 'The override will not be called with standard decorators'\n );\n }\n if (this.hasOwnProperty('getPropertyDescriptor')) {\n issueWarning(\n 'no-override-get-property-descriptor',\n 'Overriding ReactiveElement.getPropertyDescriptor() is deprecated. ' +\n 'The override will not be called with standard decorators'\n );\n }\n }\n }\n\n /**\n * Options used when calling `attachShadow`. Set this property to customize\n * the options for the shadowRoot; for example, to create a closed\n * shadowRoot: `{mode: 'closed'}`.\n *\n * Note, these options are used in `createRenderRoot`. If this method\n * is customized, options should be respected if possible.\n * @nocollapse\n * @category rendering\n */\n static shadowRootOptions: ShadowRootInit = {mode: 'open'};\n\n /**\n * Takes the styles the user supplied via the `static styles` property and\n * returns the array of styles to apply to the element.\n * Override this method to integrate into a style management system.\n *\n * Styles are deduplicated preserving the _last_ instance in the list. This\n * is a performance optimization to avoid duplicated styles that can occur\n * especially when composing via subclassing. The last item is kept to try\n * to preserve the cascade order with the assumption that it's most important\n * that last added styles override previous styles.\n *\n * @nocollapse\n * @category styles\n */\n protected static finalizeStyles(\n styles?: CSSResultGroup\n ): Array<CSSResultOrNative> {\n const elementStyles = [];\n if (Array.isArray(styles)) {\n // Dedupe the flattened array in reverse order to preserve the last items.\n // Casting to Array<unknown> works around TS error that\n // appears to come from trying to flatten a type CSSResultArray.\n const set = new Set((styles as Array<unknown>).flat(Infinity).reverse());\n // Then preserve original order by adding the set items in reverse order.\n for (const s of set) {\n elementStyles.unshift(getCompatibleStyle(s as CSSResultOrNative));\n }\n } else if (styles !== undefined) {\n elementStyles.push(getCompatibleStyle(styles));\n }\n return elementStyles;\n }\n\n /**\n * Node or ShadowRoot into which element DOM should be rendered. Defaults\n * to an open shadowRoot.\n * @category rendering\n */\n readonly renderRoot!: HTMLElement | DocumentFragment;\n\n /**\n * Returns the property name for the given attribute `name`.\n * @nocollapse\n */\n private static __attributeNameForProperty(\n name: PropertyKey,\n options: PropertyDeclaration\n ) {\n const attribute = options.attribute;\n return attribute === false\n ? undefined\n : typeof attribute === 'string'\n ? attribute\n : typeof name === 'string'\n ? name.toLowerCase()\n : undefined;\n }\n\n // Initialize to an unresolved Promise so we can make sure the element has\n // connected before first update.\n private __updatePromise!: Promise<boolean>;\n\n /**\n * True if there is a pending update as a result of calling `requestUpdate()`.\n * Should only be read.\n * @category updates\n */\n isUpdatePending = false;\n\n /**\n * Is set to `true` after the first update. The element code cannot assume\n * that `renderRoot` exists before the element `hasUpdated`.\n * @category updates\n */\n hasUpdated = false;\n\n /**\n * Map with keys for any properties that have changed since the last\n * update cycle with previous values.\n *\n * @internal\n */\n _$changedProperties!: PropertyValues;\n\n /**\n * Records property default values when the\n * `useDefault` option is used.\n */\n private __defaultValues?: Map<PropertyKey, unknown>;\n\n /**\n * Properties that should be reflected when updated.\n */\n private __reflectingProperties?: Set<PropertyKey>;\n\n /**\n * Name of currently reflecting property\n */\n private __reflectingProperty: PropertyKey | null = null;\n\n /**\n * Set of controllers.\n */\n private __controllers?: Set<ReactiveController>;\n\n constructor() {\n super();\n this.__initialize();\n }\n\n /**\n * Internal only override point for customizing work done when elements\n * are constructed.\n */\n private __initialize() {\n this.__updatePromise = new Promise<boolean>(\n (res) => (this.enableUpdating = res)\n );\n this._$changedProperties = new Map();\n // This enqueues a microtask that must run before the first update, so it\n // must be called before requestUpdate()\n this.__saveInstanceProperties();\n // ensures first update will be caught by an early access of\n // `updateComplete`\n this.requestUpdate();\n (this.constructor as typeof ReactiveElement)._initializers?.forEach((i) =>\n i(this)\n );\n }\n\n /**\n * Registers a `ReactiveController` to participate in the element's reactive\n * update cycle. The element automatically calls into any registered\n * controllers during its lifecycle callbacks.\n *\n * If the element is connected when `addController()` is called, the\n * controller's `hostConnected()` callback will be immediately called.\n * @category controllers\n */\n addController(controller: ReactiveController) {\n (this.__controllers ??= new Set()).add(controller);\n // If a controller is added after the element has been connected,\n // call hostConnected. Note, re-using existence of `renderRoot` here\n // (which is set in connectedCallback) to avoid the need to track a\n // first connected state.\n if (this.renderRoot !== undefined && this.isConnected) {\n controller.hostConnected?.();\n }\n }\n\n /**\n * Removes a `ReactiveController` from the element.\n * @category controllers\n */\n removeController(controller: ReactiveController) {\n this.__controllers?.delete(controller);\n }\n\n /**\n * Fixes any properties set on the instance before upgrade time.\n * Otherwise these would shadow the accessor and break these properties.\n * The properties are stored in a Map which is played back after the\n * constructor runs.\n */\n private __saveInstanceProperties() {\n const instanceProperties = new Map<PropertyKey, unknown>();\n const elementProperties = (this.constructor as typeof ReactiveElement)\n .elementProperties;\n for (const p of elementProperties.keys() as IterableIterator<keyof this>) {\n if (this.hasOwnProperty(p)) {\n instanceProperties.set(p, this[p]);\n delete this[p];\n }\n }\n if (instanceProperties.size > 0) {\n this.__instanceProperties = instanceProperties;\n }\n }\n\n /**\n * Returns the node into which the element should render and by default\n * creates and returns an open shadowRoot. Implement to customize where the\n * element's DOM is rendered. For example, to render into the element's\n * childNodes, return `this`.\n *\n * @return Returns a node into which to render.\n * @category rendering\n */\n protected createRenderRoot(): HTMLElement | DocumentFragment {\n const renderRoot =\n this.shadowRoot ??\n this.attachShadow(\n (this.constructor as typeof ReactiveElement).shadowRootOptions\n );\n adoptStyles(\n renderRoot,\n (this.constructor as typeof ReactiveElement).elementStyles\n );\n return renderRoot;\n }\n\n /**\n * On first connection, creates the element's renderRoot, sets up\n * element styling, and enables updating.\n * @category lifecycle\n */\n connectedCallback() {\n // Create renderRoot before controllers `hostConnected`\n (this as Mutable<typeof this, 'renderRoot'>).renderRoot ??=\n this.createRenderRoot();\n this.enableUpdating(true);\n this.__controllers?.forEach((c) => c.hostConnected?.());\n }\n\n /**\n * Note, this method should be considered final and not overridden. It is\n * overridden on the element instance with a function that triggers the first\n * update.\n * @category updates\n */\n protected enableUpdating(_requestedUpdate: boolean) {}\n\n /**\n * Allows for `super.disconnectedCallback()` in extensions while\n * reserving the possibility of making non-breaking feature additions\n * when disconnecting at some point in the future.\n * @category lifecycle\n */\n disconnectedCallback() {\n this.__controllers?.forEach((c) => c.hostDisconnected?.());\n }\n\n /**\n * Synchronizes property values when attributes change.\n *\n * Specifically, when an attribute is set, the corresponding property is set.\n * You should rarely need to implement this callback. If this method is\n * overridden, `super.attributeChangedCallback(name, _old, value)` must be\n * called.\n *\n * See [responding to attribute changes](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#responding_to_attribute_changes)\n * on MDN for more information about the `attributeChangedCallback`.\n * @category attributes\n */\n attributeChangedCallback(\n name: string,\n _old: string | null,\n value: string | null\n ) {\n this._$attributeToProperty(name, value);\n }\n\n private __propertyToAttribute(name: PropertyKey, value: unknown) {\n const elemProperties: PropertyDeclarationMap = (\n this.constructor as typeof ReactiveElement\n ).elementProperties;\n const options = elemProperties.get(name)!;\n const attr = (\n this.constructor as typeof ReactiveElement\n ).__attributeNameForProperty(name, options);\n if (attr !== undefined && options.reflect === true) {\n const converter =\n (options.converter as ComplexAttributeConverter)?.toAttribute !==\n undefined\n ? (options.converter as ComplexAttributeConverter)\n : defaultConverter;\n const attrValue = converter.toAttribute!(value, options.type);\n if (\n DEV_MODE &&\n (this.constructor as typeof ReactiveElement).enabledWarnings!.includes(\n 'migration'\n ) &&\n attrValue === undefined\n ) {\n issueWarning(\n 'undefined-attribute-value',\n `The attribute value for the ${name as string} property is ` +\n `undefined on element ${this.localName}. The attribute will be ` +\n `removed, but in the previous version of \\`ReactiveElement\\`, ` +\n `the attribute would not have changed.`\n );\n }\n // Track if the property is being reflected to avoid\n // setting the property again via `attributeChangedCallback`. Note:\n // 1. this takes advantage of the fact that the callback is synchronous.\n // 2. will behave incorrectly if multiple attributes are in the reaction\n // stack at time of calling. However, since we process attributes\n // in `update` this should not be possible (or an extreme corner case\n // that we'd like to discover).\n // mark state reflecting\n this.__reflectingProperty = name;\n if (attrValue == null) {\n this.removeAttribute(attr);\n } else {\n this.setAttribute(attr, attrValue as string);\n }\n // mark state not reflecting\n this.__reflectingProperty = null;\n }\n }\n\n /** @internal */\n _$attributeToProperty(name: string, value: string | null) {\n const ctor = this.constructor as typeof ReactiveElement;\n // Note, hint this as an `AttributeMap` so closure clearly understands\n // the type; it has issues with tracking types through statics\n const propName = (ctor.__attributeToPropertyMap as AttributeMap).get(name);\n // Use tracking info to avoid reflecting a property value to an attribute\n // if it was just set because the attribute changed.\n if (propName !== undefined && this.__reflectingProperty !== propName) {\n const options = ctor.getPropertyOptions(propName);\n const converter =\n typeof options.converter === 'function'\n ? {fromAttribute: options.converter}\n : options.converter?.fromAttribute !== undefined\n ? options.converter\n : defaultConverter;\n // mark state reflecting\n this.__reflectingProperty = propName;\n const convertedValue = converter.fromAttribute!(value, options.type);\n this[propName as keyof this] =\n convertedValue ??\n this.__defaultValues?.get(propName) ??\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (convertedValue as any);\n // mark state not reflecting\n this.__reflectingProperty = null;\n }\n }\n\n /**\n * Requests an update which is processed asynchronously. This should be called\n * when an element should update based on some state not triggered by setting\n * a reactive property. In this case, pass no arguments. It should also be\n * called when manually implementing a property setter. In this case, pass the\n * property `name` and `oldValue` to ensure that any configured property\n * options are honored.\n *\n * @param name name of requesting property\n * @param oldValue old value of requesting property\n * @param options property options to use instead of the previously\n * configured options\n * @param useNewValue if true, the newValue argument is used instead of\n * reading the property value. This is important to use if the reactive\n * property is a standard private accessor, as opposed to a plain\n * property, since private members can't be dynamically read by name.\n * @param newValue the new value of the property. This is only used if\n * `useNewValue` is true.\n * @category updates\n */\n requestUpdate(\n name?: PropertyKey,\n oldValue?: unknown,\n options?: PropertyDeclaration,\n useNewValue = false,\n newValue?: unknown\n ): void {\n // If we have a property key, perform property update steps.\n if (name !== undefined) {\n if (DEV_MODE && (name as unknown) instanceof Event) {\n issueWarning(\n ``,\n `The requestUpdate() method was called with an Event as the property name. This is probably a mistake caused by binding this.requestUpdate as an event listener. Instead bind a function that will call it with no arguments: () => this.requestUpdate()`\n );\n }\n const ctor = this.constructor as typeof ReactiveElement;\n if (useNewValue === false) {\n newValue = this[name as keyof this];\n }\n options ??= ctor.getPropertyOptions(name);\n const changed =\n (options.hasChanged ?? notEqual)(newValue, oldValue) ||\n // When there is no change, check a corner case that can occur when\n // 1. there's a initial value which was not reflected\n // 2. the property is subsequently set to this value.\n // For example, `prop: {useDefault: true, reflect: true}`\n // and el.prop = 'foo'. This should be considered a change if the\n // attribute is not set because we will now reflect the property to the attribute.\n (options.useDefault &&\n options.reflect &&\n newValue === this.__defaultValues?.get(name) &&\n !this.hasAttribute(ctor.__attributeNameForProperty(name, options)!));\n if (changed) {\n this._$changeProperty(name, oldValue, options);\n } else {\n // Abort the request if the property should not be considered changed.\n return;\n }\n }\n if (this.isUpdatePending === false) {\n this.__updatePromise = this.__enqueueUpdate();\n }\n }\n\n /**\n * @internal\n */\n _$changeProperty(\n name: PropertyKey,\n oldValue: unknown,\n {useDefault, reflect, wrapped}: PropertyDeclaration,\n initializeValue?: unknown\n ) {\n // Record default value when useDefault is used. This allows us to\n // restore this value when the attribute is removed.\n if (useDefault && !(this.__defaultValues ??= new Map()).has(name)) {\n this.__defaultValues.set(\n name,\n initializeValue ?? oldValue ?? this[name as keyof this]\n );\n // if this is not wrapping an accessor, it must be an initial setting\n // and in this case we do not want to record the change or reflect.\n if (wrapped !== true || initializeValue !== undefined) {\n return;\n }\n }\n // TODO (justinfagnani): Create a benchmark of Map.has() + Map.set(\n // vs just Map.set()\n if (!this._$changedProperties.has(name)) {\n // On the initial change, the old value should be `undefined`, except\n // with `useDefault`\n if (!this.hasUpdated && !useDefault) {\n oldValue = undefined;\n }\n this._$changedProperties.set(name, oldValue);\n }\n // Add to reflecting properties set.\n // Note, it's important that every change has a chance to add the\n // property to `__reflectingProperties`. This ensures setting\n // attribute + property reflects correctly.\n if (reflect === true && this.__reflectingProperty !== name) {\n (this.__reflectingProperties ??= new Set<PropertyKey>()).add(name);\n }\n }\n\n /**\n * Sets up the element to asynchronously update.\n */\n private async __enqueueUpdate() {\n this.isUpdatePending = true;\n try {\n // Ensure any previous update has resolved before updating.\n // This `await` also ensures that property changes are batched.\n await this.__updatePromise;\n } catch (e) {\n // Refire any previous errors async so they do not disrupt the update\n // cycle. Errors are refired so developers have a chance to observe\n // them, and this can be done by implementing\n // `window.onunhandledrejection`.\n Promise.reject(e);\n }\n const result = this.scheduleUpdate();\n // If `scheduleUpdate` returns a Promise, we await it. This is done to\n // enable coordinating updates with a scheduler. Note, the result is\n // checked to avoid delaying an additional microtask unless we need to.\n if (result != null) {\n await result;\n }\n return !this.isUpdatePending;\n }\n\n /**\n * Schedules an element update. You can override this method to change the\n * timing of updates by returning a Promise. The update will await the\n * returned Promise, and you should resolve the Promise to allow the update\n * to proceed. If this method is overridden, `super.scheduleUpdate()`\n * must be called.\n *\n * For instance, to schedule updates to occur just before the next frame:\n *\n * ```ts\n * override protected async scheduleUpdate(): Promise<unknown> {\n * await new Promise((resolve) => requestAnimationFrame(() => resolve()));\n * super.scheduleUpdate();\n * }\n * ```\n * @category updates\n */\n protected scheduleUpdate(): void | Promise<unknown> {\n const result = this.performUpdate();\n if (\n DEV_MODE &&\n (this.constructor as typeof ReactiveElement).enabledWarnings!.includes(\n 'async-perform-update'\n ) &&\n typeof (result as unknown as Promise<unknown> | undefined)?.then ===\n 'function'\n ) {\n issueWarning(\n 'async-perform-update',\n `Element ${this.localName} returned a Promise from performUpdate(). ` +\n `This behavior is deprecated and will be removed in a future ` +\n `version of ReactiveElement.`\n );\n }\n return result;\n }\n\n /**\n * Performs an element update. Note, if an exception is thrown during the\n * update, `firstUpdated` and `updated` will not be called.\n *\n * Call `performUpdate()` to immediately process a pending update. This should\n * generally not be needed, but it can be done in rare cases when you need to\n * update synchronously.\n *\n * @category updates\n */\n protected performUpdate(): void {\n // Abort any update if one is not pending when this is called.\n // This can happen if `performUpdate` is called early to \"flush\"\n // the update.\n if (!this.isUpdatePending) {\n return;\n }\n debugLogEvent?.({kind: 'update'});\n if (!this.hasUpdated) {\n // Create renderRoot before first update. This occurs in `connectedCallback`\n // but is done here to support out of tree calls to `enableUpdating`/`performUpdate`.\n (this as Mutable<typeof this, 'renderRoot'>).renderRoot ??=\n this.createRenderRoot();\n if (DEV_MODE) {\n // Produce warning if any reactive properties on the prototype are\n // shadowed by class fields. Instance fields set before upgrade are\n // deleted by this point, so any own property is caused by class field\n // initialization in the constructor.\n const ctor = this.constructor as typeof ReactiveElement;\n const shadowedProperties = [...ctor.elementProperties.keys()].filter(\n (p) => this.hasOwnProperty(p) && p in getPrototypeOf(this)\n );\n if (shadowedProperties.length) {\n throw new Error(\n `The following properties on element ${this.localName} will not ` +\n `trigger updates as expected because they are set using class ` +\n `fields: ${shadowedProperties.join(', ')}. ` +\n `Native class fields and some compiled output will overwrite ` +\n `accessors used for detecting changes. See ` +\n `https://lit.dev/msg/class-field-shadowing ` +\n `for more information.`\n );\n }\n }\n // Mixin instance properties once, if they exist.\n if (this.__instanceProperties) {\n // TODO (justinfagnani): should we use the stored value? Could a new value\n // have been set since we stored the own property value?\n for (const [p, value] of this.__instanceProperties) {\n this[p as keyof this] = value as this[keyof this];\n }\n this.__instanceProperties = undefined;\n }\n // Trigger initial value reflection and populate the initial\n // `changedProperties` map, but only for the case of properties created\n // via `createProperty` on accessors, which will not have already\n // populated the `changedProperties` map since they are not set.\n // We can't know if these accessors had initializers, so we just set\n // them anyway - a difference from experimental decorators on fields and\n // standard decorators on auto-accessors.\n // For context see:\n // https://github.com/lit/lit/pull/4183#issuecomment-1711959635\n const elementProperties = (this.constructor as typeof ReactiveElement)\n .elementProperties;\n if (elementProperties.size > 0) {\n for (const [p, options] of elementProperties) {\n const {wrapped} = options;\n const value = this[p as keyof this];\n if (\n wrapped === true &&\n !this._$changedProperties.has(p) &&\n value !== undefined\n ) {\n this._$changeProperty(p, undefined, options, value);\n }\n }\n }\n }\n let shouldUpdate = false;\n const changedProperties = this._$changedProperties;\n try {\n shouldUpdate = this.shouldUpdate(changedProperties);\n if (shouldUpdate) {\n this.willUpdate(changedProperties);\n this.__controllers?.forEach((c) => c.hostUpdate?.());\n this.update(changedProperties);\n } else {\n this.__markUpdated();\n }\n } catch (e) {\n // Prevent `firstUpdated` and `updated` from running when there's an\n // update exception.\n shouldUpdate = false;\n // Ensure element can accept additional updates after an exception.\n this.__markUpdated();\n throw e;\n }\n // The update is no longer considered pending and further updates are now allowed.\n if (shouldUpdate) {\n this._$didUpdate(changedProperties);\n }\n }\n\n /**\n * Invoked before `update()` to compute values needed during the update.\n *\n * Implement `willUpdate` to compute property values that depend on other\n * properties and are used in the rest of the update process.\n *\n * ```ts\n * willUpdate(changedProperties) {\n * // only need to check changed properties for an expensive computation.\n * if (changedProperties.has('firstName') || changedProperties.has('lastName')) {\n * this.sha = computeSHA(`${this.firstName} ${this.lastName}`);\n * }\n * }\n *\n * render() {\n * return html`SHA: ${this.sha}`;\n * }\n * ```\n *\n * @category updates\n */\n protected willUpdate(_changedProperties: PropertyValues): void {}\n\n // Note, this is an override point for polyfill-support.\n // @internal\n _$didUpdate(changedProperties: PropertyValues) {\n this.__controllers?.forEach((c) => c.hostUpdated?.());\n if (!this.hasUpdated) {\n this.hasUpdated = true;\n this.firstUpdated(changedProperties);\n }\n this.updated(changedProperties);\n if (\n DEV_MODE &&\n this.isUpdatePending &&\n (this.constructor as typeof ReactiveElement).enabledWarnings!.includes(\n 'change-in-update'\n )\n ) {\n issueWarning(\n 'change-in-update',\n `Element ${this.localName} scheduled an update ` +\n `(generally because a property was set) ` +\n `after an update completed, causing a new update to be scheduled. ` +\n `This is inefficient and should be avoided unless the next update ` +\n `can only be scheduled as a side effect of the previous update.`\n );\n }\n }\n\n private __markUpdated() {\n this._$changedProperties = new Map();\n this.isUpdatePending = false;\n }\n\n /**\n * Returns a Promise that resolves when the element has completed updating.\n * The Promise value is a boolean that is `true` if the element completed the\n * update without triggering another update. The Promise result is `false` if\n * a property was set inside `updated()`. If the Promise is rejected, an\n * exception was thrown during the update.\n *\n * To await additional asynchronous work, override the `getUpdateComplete`\n * method. For example, it is sometimes useful to await a rendered element\n * before fulfilling this Promise. To do this, first await\n * `super.getUpdateComplete()`, then any subsequent state.\n *\n * @return A promise of a boolean that resolves to true if the update completed\n * without triggering another update.\n * @category updates\n */\n get updateComplete(): Promise<boolean> {\n return this.getUpdateComplete();\n }\n\n /**\n * Override point for the `updateComplete` promise.\n *\n * It is not safe to override the `updateComplete` getter directly due to a\n * limitation in TypeScript which means it is not possible to call a\n * superclass getter (e.g. `super.updateComplete.then(...)`) when the target\n * language is ES5 (https://github.com/microsoft/TypeScript/issues/338).\n * This method should be overridden instead. For example:\n *\n * ```ts\n * class MyElement extends LitElement {\n * override async getUpdateComplete() {\n * const result = await super.getUpdateComplete();\n * await this._myChild.updateComplete;\n * return result;\n * }\n * }\n * ```\n *\n * @return A promise of a boolean that resolves to true if the update completed\n * without triggering another update.\n * @category updates\n */\n protected getUpdateComplete(): Promise<boolean> {\n return this.__updatePromise;\n }\n\n /**\n * Controls whether or not `update()` should be called when the element requests\n * an update. By default, this method always returns `true`, but this can be\n * customized to control when to update.\n *\n * @param _changedProperties Map of changed properties with old values\n * @category updates\n */\n protected shouldUpdate(_changedProperties: PropertyValues): boolean {\n return true;\n }\n\n /**\n * Updates the element. This method reflects property values to attributes.\n * It can be overridden to render and keep updated element DOM.\n * Setting properties inside this method will *not* trigger\n * another update.\n *\n * @param _changedProperties Map of changed properties with old values\n * @category updates\n */\n protected update(_changedProperties: PropertyValues) {\n // The forEach() expression will only run when __reflectingProperties is\n // defined, and it returns undefined, setting __reflectingProperties to\n // undefined\n this.__reflectingProperties &&= this.__reflectingProperties.forEach((p) =>\n this.__propertyToAttribute(p, this[p as keyof this])\n ) as undefined;\n this.__markUpdated();\n }\n\n /**\n * Invoked whenever the element is updated. Implement to perform\n * post-updating tasks via DOM APIs, for example, focusing an element.\n *\n * Setting properties inside this method will trigger the element to update\n * again after this update cycle completes.\n *\n * @param _changedProperties Map of changed properties with old values\n * @category updates\n */\n protected updated(_changedProperties: PropertyValues) {}\n\n /**\n * Invoked when the element is first updated. Implement to perform one time\n * work on the element after update.\n *\n * ```ts\n * firstUpdated() {\n * this.renderRoot.getElementById('my-text-area').focus();\n * }\n * ```\n *\n * Setting properties inside this method will trigger the element to update\n * again after this update cycle completes.\n *\n * @param _changedProperties Map of changed properties with old values\n * @category updates\n */\n protected firstUpdated(_changedProperties: PropertyValues) {}\n}\n// Assigned here to work around a jscompiler bug with static fields\n// when compiling to ES5.\n// https://github.com/google/closure-compiler/issues/3177\n(ReactiveElement as unknown as Record<string, unknown>)[\n JSCompiler_renameProperty('elementProperties', ReactiveElement)\n] = new Map();\n(ReactiveElement as unknown as Record<string, unknown>)[\n JSCompiler_renameProperty('finalized', ReactiveElement)\n] = new Map();\n\n// Apply polyfills if available\npolyfillSupport?.({ReactiveElement});\n\n// Dev mode warnings...\nif (DEV_MODE) {\n // Default warning set.\n ReactiveElement.enabledWarnings = [\n 'change-in-update',\n 'async-perform-update',\n ];\n const ensureOwnWarnings = function (ctor: typeof ReactiveElement) {\n if (\n !ctor.hasOwnProperty(JSCompiler_renameProperty('enabledWarnings', ctor))\n ) {\n ctor.enabledWarnings = ctor.enabledWarnings!.slice();\n }\n };\n ReactiveElement.enableWarning = function (\n this: typeof ReactiveElement,\n warning: WarningKind\n ) {\n ensureOwnWarnings(this);\n if (!this.enabledWarnings!.includes(warning)) {\n this.enabledWarnings!.push(warning);\n }\n };\n ReactiveElement.disableWarning = function (\n this: typeof ReactiveElement,\n warning: WarningKind\n ) {\n ensureOwnWarnings(this);\n const i = this.enabledWarnings!.indexOf(warning);\n if (i >= 0) {\n this.enabledWarnings!.splice(i, 1);\n }\n };\n}\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for ReactiveElement usage.\n(global.reactiveElementVersions ??= []).push('2.1.2');\nif (DEV_MODE && global.reactiveElementVersions.length > 1) {\n queueMicrotask(() => {\n issueWarning!(\n 'multiple-versions',\n `Multiple versions of Lit loaded. Loading multiple versions ` +\n `is not recommended.`\n );\n });\n}\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n// IMPORTANT: these imports must be type-only\nimport type {Directive, DirectiveResult, PartInfo} from './directive.js';\nimport type {TrustedHTML, TrustedTypesWindow} from 'trusted-types/lib/index.js';\n\nconst DEV_MODE = true;\nconst ENABLE_EXTRA_SECURITY_HOOKS = true;\nconst ENABLE_SHADYDOM_NOPATCH = true;\nconst NODE_MODE = false;\n\n// Allows minifiers to rename references to globalThis\nconst global = globalThis;\n\n/**\n * Contains types that are part of the unstable debug API.\n *\n * Everything in this API is not stable and may change or be removed in the future,\n * even on patch releases.\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace LitUnstable {\n /**\n * When Lit is running in dev mode and `window.emitLitDebugLogEvents` is true,\n * we will emit 'lit-debug' events to window, with live details about the update and render\n * lifecycle. These can be useful for writing debug tooling and visualizations.\n *\n * Please be aware that running with window.emitLitDebugLogEvents has performance overhead,\n * making certain operations that are normally very cheap (like a no-op render) much slower,\n * because we must copy data and dispatch events.\n */\n // eslint-disable-next-line @typescript-eslint/no-namespace\n export namespace DebugLog {\n export type Entry =\n | TemplatePrep\n | TemplateInstantiated\n | TemplateInstantiatedAndUpdated\n | TemplateUpdating\n | BeginRender\n | EndRender\n | CommitPartEntry\n | SetPartValue;\n export interface TemplatePrep {\n kind: 'template prep';\n template: Template;\n strings: TemplateStringsArray;\n clonableTemplate: HTMLTemplateElement;\n parts: TemplatePart[];\n }\n export interface BeginRender {\n kind: 'begin render';\n id: number;\n value: unknown;\n container: RenderRootNode;\n options: RenderOptions | undefined;\n part: ChildPart | undefined;\n }\n export interface EndRender {\n kind: 'end render';\n id: number;\n value: unknown;\n container: RenderRootNode;\n options: RenderOptions | undefined;\n part: ChildPart;\n }\n export interface TemplateInstantiated {\n kind: 'template instantiated';\n template: Template | CompiledTemplate;\n instance: TemplateInstance;\n options: RenderOptions | undefined;\n fragment: Node;\n parts: Array<Part | undefined>;\n values: unknown[];\n }\n export interface TemplateInstantiatedAndUpdated {\n kind: 'template instantiated and updated';\n template: Template | CompiledTemplate;\n instance: TemplateInstance;\n options: RenderOptions | undefined;\n fragment: Node;\n parts: Array<Part | undefined>;\n values: unknown[];\n }\n export interface TemplateUpdating {\n kind: 'template updating';\n template: Template | CompiledTemplate;\n instance: TemplateInstance;\n options: RenderOptions | undefined;\n parts: Array<Part | undefined>;\n values: unknown[];\n }\n export interface SetPartValue {\n kind: 'set part';\n part: Part;\n value: unknown;\n valueIndex: number;\n values: unknown[];\n templateInstance: TemplateInstance;\n }\n\n export type CommitPartEntry =\n | CommitNothingToChildEntry\n | CommitText\n | CommitNode\n | CommitAttribute\n | CommitProperty\n | CommitBooleanAttribute\n | CommitEventListener\n | CommitToElementBinding;\n\n export interface CommitNothingToChildEntry {\n kind: 'commit nothing to child';\n start: ChildNode;\n end: ChildNode | null;\n parent: Disconnectable | undefined;\n options: RenderOptions | undefined;\n }\n\n export interface CommitText {\n kind: 'commit text';\n node: Text;\n value: unknown;\n options: RenderOptions | undefined;\n }\n\n export interface CommitNode {\n kind: 'commit node';\n start: Node;\n parent: Disconnectable | undefined;\n value: Node;\n options: RenderOptions | undefined;\n }\n\n export interface CommitAttribute {\n kind: 'commit attribute';\n element: Element;\n name: string;\n value: unknown;\n options: RenderOptions | undefined;\n }\n\n export interface CommitProperty {\n kind: 'commit property';\n element: Element;\n name: string;\n value: unknown;\n options: RenderOptions | undefined;\n }\n\n export interface CommitBooleanAttribute {\n kind: 'commit boolean attribute';\n element: Element;\n name: string;\n value: boolean;\n options: RenderOptions | undefined;\n }\n\n export interface CommitEventListener {\n kind: 'commit event listener';\n element: Element;\n name: string;\n value: unknown;\n oldListener: unknown;\n options: RenderOptions | undefined;\n // True if we're removing the old event listener (e.g. because settings changed, or value is nothing)\n removeListener: boolean;\n // True if we're adding a new event listener (e.g. because first render, or settings changed)\n addListener: boolean;\n }\n\n export interface CommitToElementBinding {\n kind: 'commit to element binding';\n element: Element;\n value: unknown;\n options: RenderOptions | undefined;\n }\n }\n}\n\ninterface DebugLoggingWindow {\n // Even in dev mode, we generally don't want to emit these events, as that's\n // another level of cost, so only emit them when DEV_MODE is true _and_ when\n // window.emitLitDebugEvents is true.\n emitLitDebugLogEvents?: boolean;\n}\n\n/**\n * Useful for visualizing and logging insights into what the Lit template system is doing.\n *\n * Compiled out of prod mode builds.\n */\nconst debugLogEvent = DEV_MODE\n ? (event: LitUnstable.DebugLog.Entry) => {\n const shouldEmit = (global as unknown as DebugLoggingWindow)\n .emitLitDebugLogEvents;\n if (!shouldEmit) {\n return;\n }\n global.dispatchEvent(\n new CustomEvent<LitUnstable.DebugLog.Entry>('lit-debug', {\n detail: event,\n })\n );\n }\n : undefined;\n// Used for connecting beginRender and endRender events when there are nested\n// renders when errors are thrown preventing an endRender event from being\n// called.\nlet debugLogRenderId = 0;\n\nlet issueWarning: (code: string, warning: string) => void;\n\nif (DEV_MODE) {\n global.litIssuedWarnings ??= new Set();\n\n /**\n * Issue a warning if we haven't already, based either on `code` or `warning`.\n * Warnings are disabled automatically only by `warning`; disabling via `code`\n * can be done by users.\n */\n issueWarning = (code: string, warning: string) => {\n warning += code\n ? ` See https://lit.dev/msg/${code} for more information.`\n : '';\n if (\n !global.litIssuedWarnings!.has(warning) &&\n !global.litIssuedWarnings!.has(code)\n ) {\n console.warn(warning);\n global.litIssuedWarnings!.add(warning);\n }\n };\n\n queueMicrotask(() => {\n issueWarning(\n 'dev-mode',\n `Lit is in dev mode. Not recommended for production!`\n );\n });\n}\n\nconst wrap =\n ENABLE_SHADYDOM_NOPATCH &&\n global.ShadyDOM?.inUse &&\n global.ShadyDOM?.noPatch === true\n ? (global.ShadyDOM!.wrap as <T extends Node>(node: T) => T)\n : <T extends Node>(node: T) => node;\n\nconst trustedTypes = (global as unknown as TrustedTypesWindow).trustedTypes;\n\n/**\n * Our TrustedTypePolicy for HTML which is declared using the html template\n * tag function.\n *\n * That HTML is a developer-authored constant, and is parsed with innerHTML\n * before any untrusted expressions have been mixed in. Therefor it is\n * considered safe by construction.\n */\nconst policy = trustedTypes\n ? trustedTypes.createPolicy('lit-html', {\n createHTML: (s) => s,\n })\n : undefined;\n\n/**\n * Used to sanitize any value before it is written into the DOM. This can be\n * used to implement a security policy of allowed and disallowed values in\n * order to prevent XSS attacks.\n *\n * One way of using this callback would be to check attributes and properties\n * against a list of high risk fields, and require that values written to such\n * fields be instances of a class which is safe by construction. Closure's Safe\n * HTML Types is one implementation of this technique (\n * https://github.com/google/safe-html-types/blob/master/doc/safehtml-types.md).\n * The TrustedTypes polyfill in API-only mode could also be used as a basis\n * for this technique (https://github.com/WICG/trusted-types).\n *\n * @param node The HTML node (usually either a #text node or an Element) that\n * is being written to. Note that this is just an exemplar node, the write\n * may take place against another instance of the same class of node.\n * @param name The name of an attribute or property (for example, 'href').\n * @param type Indicates whether the write that's about to be performed will\n * be to a property or a node.\n * @return A function that will sanitize this class of writes.\n */\nexport type SanitizerFactory = (\n node: Node,\n name: string,\n type: 'property' | 'attribute'\n) => ValueSanitizer;\n\n/**\n * A function which can sanitize values that will be written to a specific kind\n * of DOM sink.\n *\n * See SanitizerFactory.\n *\n * @param value The value to sanitize. Will be the actual value passed into\n * the lit-html template literal, so this could be of any type.\n * @return The value to write to the DOM. Usually the same as the input value,\n * unless sanitization is needed.\n */\nexport type ValueSanitizer = (value: unknown) => unknown;\n\nconst identityFunction: ValueSanitizer = (value: unknown) => value;\nconst noopSanitizer: SanitizerFactory = (\n _node: Node,\n _name: string,\n _type: 'property' | 'attribute'\n) => identityFunction;\n\n/** Sets the global sanitizer factory. */\nconst setSanitizer = (newSanitizer: SanitizerFactory) => {\n if (!ENABLE_EXTRA_SECURITY_HOOKS) {\n return;\n }\n if (sanitizerFactoryInternal !== noopSanitizer) {\n throw new Error(\n `Attempted to overwrite existing lit-html security policy.` +\n ` setSanitizeDOMValueFactory should be called at most once.`\n );\n }\n sanitizerFactoryInternal = newSanitizer;\n};\n\n/**\n * Only used in internal tests, not a part of the public API.\n */\nconst _testOnlyClearSanitizerFactoryDoNotCallOrElse = () => {\n sanitizerFactoryInternal = noopSanitizer;\n};\n\nconst createSanitizer: SanitizerFactory = (node, name, type) => {\n return sanitizerFactoryInternal(node, name, type);\n};\n\n// Added to an attribute name to mark the attribute as bound so we can find\n// it easily.\nconst boundAttributeSuffix = '$lit$';\n\n// This marker is used in many syntactic positions in HTML, so it must be\n// a valid element name and attribute name. We don't support dynamic names (yet)\n// but this at least ensures that the parse tree is closer to the template\n// intention.\nconst marker = `lit$${Math.random().toFixed(9).slice(2)}$`;\n\n// String used to tell if a comment is a marker comment\nconst markerMatch = '?' + marker;\n\n// Text used to insert a comment marker node. We use processing instruction\n// syntax because it's slightly smaller, but parses as a comment node.\nconst nodeMarker = `<${markerMatch}>`;\n\nconst d =\n NODE_MODE && global.document === undefined\n ? ({\n createTreeWalker() {\n return {};\n },\n } as unknown as Document)\n : document;\n\n// Creates a dynamic marker. We never have to search for these in the DOM.\nconst createMarker = () => d.createComment('');\n\n// https://tc39.github.io/ecma262/#sec-typeof-operator\ntype Primitive = null | undefined | boolean | number | string | symbol | bigint;\nconst isPrimitive = (value: unknown): value is Primitive =>\n value === null || (typeof value != 'object' && typeof value != 'function');\nconst isArray = Array.isArray;\nconst isIterable = (value: unknown): value is Iterable<unknown> =>\n isArray(value) ||\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n typeof (value as any)?.[Symbol.iterator] === 'function';\n\nconst SPACE_CHAR = `[ \\t\\n\\f\\r]`;\nconst ATTR_VALUE_CHAR = `[^ \\t\\n\\f\\r\"'\\`<>=]`;\nconst NAME_CHAR = `[^\\\\s\"'>=/]`;\n\n// These regexes represent the five parsing states that we care about in the\n// Template's HTML scanner. They match the *end* of the state they're named\n// after.\n// Depending on the match, we transition to a new state. If there's no match,\n// we stay in the same state.\n// Note that the regexes are stateful. We utilize lastIndex and sync it\n// across the multiple regexes used. In addition to the five regexes below\n// we also dynamically create a regex to find the matching end tags for raw\n// text elements.\n\n/**\n * End of text is: `<` followed by:\n * (comment start) or (tag) or (dynamic tag binding)\n */\nconst textEndRegex = /<(?:(!--|\\/[^a-zA-Z])|(\\/?[a-zA-Z][^>\\s]*)|(\\/?$))/g;\nconst COMMENT_START = 1;\nconst TAG_NAME = 2;\nconst DYNAMIC_TAG_NAME = 3;\n\nconst commentEndRegex = /-->/g;\n/**\n * Comments not started with <!--, like </{, can be ended by a single `>`\n */\nconst comment2EndRegex = />/g;\n\n/**\n * The tagEnd regex matches the end of the \"inside an opening\" tag syntax\n * position. It either matches a `>`, an attribute-like sequence, or the end\n * of the string after a space (attribute-name position ending).\n *\n * See attributes in the HTML spec:\n * https://www.w3.org/TR/html5/syntax.html#elements-attributes\n *\n * \" \\t\\n\\f\\r\" are HTML space characters:\n * https://infra.spec.whatwg.org/#ascii-whitespace\n *\n * So an attribute is:\n * * The name: any character except a whitespace character, (\"), ('), \">\",\n * \"=\", or \"/\". Note: this is different from the HTML spec which also excludes control characters.\n * * Followed by zero or more space characters\n * * Followed by \"=\"\n * * Followed by zero or more space characters\n * * Followed by:\n * * Any character except space, ('), (\"), \"<\", \">\", \"=\", (`), or\n * * (\") then any non-(\"), or\n * * (') then any non-(')\n */\nconst tagEndRegex = new RegExp(\n `>|${SPACE_CHAR}(?:(${NAME_CHAR}+)(${SPACE_CHAR}*=${SPACE_CHAR}*(?:${ATTR_VALUE_CHAR}|(\"|')|))|$)`,\n 'g'\n);\nconst ENTIRE_MATCH = 0;\nconst ATTRIBUTE_NAME = 1;\nconst SPACES_AND_EQUALS = 2;\nconst QUOTE_CHAR = 3;\n\nconst singleQuoteAttrEndRegex = /'/g;\nconst doubleQuoteAttrEndRegex = /\"/g;\n/**\n * Matches the raw text elements.\n *\n * Comments are not parsed within raw text elements, so we need to search their\n * text content for marker strings.\n */\nconst rawTextElement = /^(?:script|style|textarea|title)$/i;\n\n/** TemplateResult types */\nconst HTML_RESULT = 1;\nconst SVG_RESULT = 2;\nconst MATHML_RESULT = 3;\n\ntype ResultType = typeof HTML_RESULT | typeof SVG_RESULT | typeof MATHML_RESULT;\n\n// TemplatePart types\n// IMPORTANT: these must match the values in PartType\nconst ATTRIBUTE_PART = 1;\nconst CHILD_PART = 2;\nconst PROPERTY_PART = 3;\nconst BOOLEAN_ATTRIBUTE_PART = 4;\nconst EVENT_PART = 5;\nconst ELEMENT_PART = 6;\nconst COMMENT_PART = 7;\n\n/**\n * The return type of the template tag functions, {@linkcode html} and\n * {@linkcode svg} when it hasn't been compiled by @lit-labs/compiler.\n *\n * A `TemplateResult` object holds all the information about a template\n * expression required to render it: the template strings, expression values,\n * and type of template (html or svg).\n *\n * `TemplateResult` objects do not create any DOM on their own. To create or\n * update DOM you need to render the `TemplateResult`. See\n * [Rendering](https://lit.dev/docs/components/rendering) for more information.\n *\n */\nexport type UncompiledTemplateResult<T extends ResultType = ResultType> = {\n // This property needs to remain unminified.\n ['_$litType$']: T;\n strings: TemplateStringsArray;\n values: unknown[];\n};\n\n/**\n * This is a template result that may be either uncompiled or compiled.\n *\n * In the future, TemplateResult will be this type. If you want to explicitly\n * note that a template result is potentially compiled, you can reference this\n * type and it will continue to behave the same through the next major version\n * of Lit. This can be useful for code that wants to prepare for the next\n * major version of Lit.\n */\nexport type MaybeCompiledTemplateResult<T extends ResultType = ResultType> =\n | UncompiledTemplateResult<T>\n | CompiledTemplateResult;\n\n/**\n * The return type of the template tag functions, {@linkcode html} and\n * {@linkcode svg}.\n *\n * A `TemplateResult` object holds all the information about a template\n * expression required to render it: the template strings, expression values,\n * and type of template (html or svg).\n *\n * `TemplateResult` objects do not create any DOM on their own. To create or\n * update DOM you need to render the `TemplateResult`. See\n * [Rendering](https://lit.dev/docs/components/rendering) for more information.\n *\n * In Lit 4, this type will be an alias of\n * MaybeCompiledTemplateResult, so that code will get type errors if it assumes\n * that Lit templates are not compiled. When deliberately working with only\n * one, use either {@linkcode CompiledTemplateResult} or\n * {@linkcode UncompiledTemplateResult} explicitly.\n */\nexport type TemplateResult<T extends ResultType = ResultType> =\n UncompiledTemplateResult<T>;\n\nexport type HTMLTemplateResult = TemplateResult<typeof HTML_RESULT>;\n\nexport type SVGTemplateResult = TemplateResult<typeof SVG_RESULT>;\n\nexport type MathMLTemplateResult = TemplateResult<typeof MATHML_RESULT>;\n\n/**\n * A TemplateResult that has been compiled by @lit-labs/compiler, skipping the\n * prepare step.\n */\nexport interface CompiledTemplateResult {\n // This is a factory in order to make template initialization lazy\n // and allow ShadyRenderOptions scope to be passed in.\n // This property needs to remain unminified.\n ['_$litType$']: CompiledTemplate;\n values: unknown[];\n}\n\nexport interface CompiledTemplate extends Omit<Template, 'el'> {\n // el is overridden to be optional. We initialize it on first render\n el?: HTMLTemplateElement;\n\n // The prepared HTML string to create a template element from.\n // The type is a TemplateStringsArray to guarantee that the value came from\n // source code, preventing a JSON injection attack.\n h: TemplateStringsArray;\n}\n\n/**\n * Generates a template literal tag function that returns a TemplateResult with\n * the given result type.\n */\nconst tag =\n <T extends ResultType>(type: T) =>\n (strings: TemplateStringsArray, ...values: unknown[]): TemplateResult<T> => {\n // Warn against templates octal escape sequences\n // We do this here rather than in render so that the warning is closer to the\n // template definition.\n if (DEV_MODE && strings.some((s) => s === undefined)) {\n console.warn(\n 'Some template strings are undefined.\\n' +\n 'This is probably caused by illegal octal escape sequences.'\n );\n }\n if (DEV_MODE) {\n // Import static-html.js results in a circular dependency which g3 doesn't\n // handle. Instead we know that static values must have the field\n // `_$litStatic$`.\n if (\n values.some((val) => (val as {_$litStatic$: unknown})?.['_$litStatic$'])\n ) {\n issueWarning(\n '',\n `Static values 'literal' or 'unsafeStatic' cannot be used as values to non-static templates.\\n` +\n `Please use the static 'html' tag function. See https://lit.dev/docs/templates/expressions/#static-expressions`\n );\n }\n }\n return {\n // This property needs to remain unminified.\n ['_$litType$']: type,\n strings,\n values,\n };\n };\n\n/**\n * Interprets a template literal as an HTML template that can efficiently\n * render to and update a container.\n *\n * ```ts\n * const header = (title: string) => html`<h1>${title}</h1>`;\n * ```\n *\n * The `html` tag returns a description of the DOM to render as a value. It is\n * lazy, meaning no work is done until the template is rendered. When rendering,\n * if a template comes from the same expression as a previously rendered result,\n * it's efficiently updated instead of replaced.\n */\nexport const html = tag(HTML_RESULT);\n\n/**\n * Interprets a template literal as an SVG fragment that can efficiently render\n * to and update a container.\n *\n * ```ts\n * const rect = svg`<rect width=\"10\" height=\"10\"></rect>`;\n *\n * const myImage = html`\n * <svg viewBox=\"0 0 10 10\" xmlns=\"http://www.w3.org/2000/svg\">\n * ${rect}\n * </svg>`;\n * ```\n *\n * The `svg` *tag function* should only be used for SVG fragments, or elements\n * that would be contained **inside** an `<svg>` HTML element. A common error is\n * placing an `<svg>` *element* in a template tagged with the `svg` tag\n * function. The `<svg>` element is an HTML element and should be used within a\n * template tagged with the {@linkcode html} tag function.\n *\n * In LitElement usage, it's invalid to return an SVG fragment from the\n * `render()` method, as the SVG fragment will be contained within the element's\n * shadow root and thus not be properly contained within an `<svg>` HTML\n * element.\n */\nexport const svg = tag(SVG_RESULT);\n\n/**\n * Interprets a template literal as MathML fragment that can efficiently render\n * to and update a container.\n *\n * ```ts\n * const num = mathml`<mn>1</mn>`;\n *\n * const eq = html`\n * <math>\n * ${num}\n * </math>`;\n * ```\n *\n * The `mathml` *tag function* should only be used for MathML fragments, or\n * elements that would be contained **inside** a `<math>` HTML element. A common\n * error is placing a `<math>` *element* in a template tagged with the `mathml`\n * tag function. The `<math>` element is an HTML element and should be used\n * within a template tagged with the {@linkcode html} tag function.\n *\n * In LitElement usage, it's invalid to return an MathML fragment from the\n * `render()` method, as the MathML fragment will be contained within the\n * element's shadow root and thus not be properly contained within a `<math>`\n * HTML element.\n */\nexport const mathml = tag(MATHML_RESULT);\n\n/**\n * A sentinel value that signals that a value was handled by a directive and\n * should not be written to the DOM.\n */\nexport const noChange = Symbol.for('lit-noChange');\n\n/**\n * A sentinel value that signals a ChildPart to fully clear its content.\n *\n * ```ts\n * const button = html`${\n * user.isAdmin\n * ? html`<button>DELETE</button>`\n * : nothing\n * }`;\n * ```\n *\n * Prefer using `nothing` over other falsy values as it provides a consistent\n * behavior between various expression binding contexts.\n *\n * In child expressions, `undefined`, `null`, `''`, and `nothing` all behave the\n * same and render no nodes. In attribute expressions, `nothing` _removes_ the\n * attribute, while `undefined` and `null` will render an empty string. In\n * property expressions `nothing` becomes `undefined`.\n */\nexport const nothing = Symbol.for('lit-nothing');\n\n/**\n * The cache of prepared templates, keyed by the tagged TemplateStringsArray\n * and _not_ accounting for the specific template tag used. This means that\n * template tags cannot be dynamic - they must statically be one of html, svg,\n * or attr. This restriction simplifies the cache lookup, which is on the hot\n * path for rendering.\n */\nconst templateCache = new WeakMap<TemplateStringsArray, Template>();\n\n/**\n * Object specifying options for controlling lit-html rendering. Note that\n * while `render` may be called multiple times on the same `container` (and\n * `renderBefore` reference node) to efficiently update the rendered content,\n * only the options passed in during the first render are respected during\n * the lifetime of renders to that unique `container` + `renderBefore`\n * combination.\n */\nexport interface RenderOptions {\n /**\n * An object to use as the `this` value for event listeners. It's often\n * useful to set this to the host component rendering a template.\n */\n host?: object;\n /**\n * A DOM node before which to render content in the container.\n */\n renderBefore?: ChildNode | null;\n /**\n * Node used for cloning the template (`importNode` will be called on this\n * node). This controls the `ownerDocument` of the rendered DOM, along with\n * any inherited context. Defaults to the global `document`.\n */\n creationScope?: {importNode(node: Node, deep?: boolean): Node};\n /**\n * The initial connected state for the top-level part being rendered. If no\n * `isConnected` option is set, `AsyncDirective`s will be connected by\n * default. Set to `false` if the initial render occurs in a disconnected tree\n * and `AsyncDirective`s should see `isConnected === false` for their initial\n * render. The `part.setConnected()` method must be used subsequent to initial\n * render to change the connected state of the part.\n */\n isConnected?: boolean;\n}\n\n/**\n * The root DOM node for rendering.\n */\nexport type RenderRootNode = HTMLElement | SVGElement | DocumentFragment;\n\nconst walker = d.createTreeWalker(\n d,\n 129 /* NodeFilter.SHOW_{ELEMENT|COMMENT} */\n);\n\nlet sanitizerFactoryInternal: SanitizerFactory = noopSanitizer;\n\n//\n// Classes only below here, const variable declarations only above here...\n//\n// Keeping variable declarations and classes together improves minification.\n// Interfaces and type aliases can be interleaved freely.\n//\n\n// Type for classes that have a `_directive` or `_directives[]` field, used by\n// `resolveDirective`\nexport interface DirectiveParent {\n _$parent?: DirectiveParent;\n _$isConnected: boolean;\n __directive?: Directive;\n __directives?: Array<Directive | undefined>;\n}\n\nfunction trustFromTemplateString(\n tsa: TemplateStringsArray,\n stringFromTSA: string\n): TrustedHTML {\n // A security check to prevent spoofing of Lit template results.\n // In the future, we may be able to replace this with Array.isTemplateObject,\n // though we might need to make that check inside of the html and svg\n // functions, because precompiled templates don't come in as\n // TemplateStringArray objects.\n if (!isArray(tsa) || !tsa.hasOwnProperty('raw')) {\n let message = 'invalid template strings array';\n if (DEV_MODE) {\n message = `\n Internal Error: expected template strings to be an array\n with a 'raw' field. Faking a template strings array by\n calling html or svg like an ordinary function is effectively\n the same as calling unsafeHtml and can lead to major security\n issues, e.g. opening your code up to XSS attacks.\n If you're using the html or svg tagged template functions normally\n and still seeing this error, please file a bug at\n https://github.com/lit/lit/issues/new?template=bug_report.md\n and include information about your build tooling, if any.\n `\n .trim()\n .replace(/\\n */g, '\\n');\n }\n throw new Error(message);\n }\n return policy !== undefined\n ? policy.createHTML(stringFromTSA)\n : (stringFromTSA as unknown as TrustedHTML);\n}\n\n/**\n * Returns an HTML string for the given TemplateStringsArray and result type\n * (HTML or SVG), along with the case-sensitive bound attribute names in\n * template order. The HTML contains comment markers denoting the `ChildPart`s\n * and suffixes on bound attributes denoting the `AttributeParts`.\n *\n * @param strings template strings array\n * @param type HTML or SVG\n * @return Array containing `[html, attrNames]` (array returned for terseness,\n * to avoid object fields since this code is shared with non-minified SSR\n * code)\n */\nconst getTemplateHtml = (\n strings: TemplateStringsArray,\n type: ResultType\n): [TrustedHTML, Array<string>] => {\n // Insert makers into the template HTML to represent the position of\n // bindings. The following code scans the template strings to determine the\n // syntactic position of the bindings. They can be in text position, where\n // we insert an HTML comment, attribute value position, where we insert a\n // sentinel string and re-write the attribute name, or inside a tag where\n // we insert the sentinel string.\n const l = strings.length - 1;\n // Stores the case-sensitive bound attribute names in the order of their\n // parts. ElementParts are also reflected in this array as undefined\n // rather than a string, to disambiguate from attribute bindings.\n const attrNames: Array<string> = [];\n let html =\n type === SVG_RESULT ? '<svg>' : type === MATHML_RESULT ? '<math>' : '';\n\n // When we're inside a raw text tag (not it's text content), the regex\n // will still be tagRegex so we can find attributes, but will switch to\n // this regex when the tag ends.\n let rawTextEndRegex: RegExp | undefined;\n\n // The current parsing state, represented as a reference to one of the\n // regexes\n let regex = textEndRegex;\n\n for (let i = 0; i < l; i++) {\n const s = strings[i];\n // The index of the end of the last attribute name. When this is\n // positive at end of a string, it means we're in an attribute value\n // position and need to rewrite the attribute name.\n // We also use a special value of -2 to indicate that we encountered\n // the end of a string in attribute name position.\n let attrNameEndIndex = -1;\n let attrName: string | undefined;\n let lastIndex = 0;\n let match!: RegExpExecArray | null;\n\n // The conditions in this loop handle the current parse state, and the\n // assignments to the `regex` variable are the state transitions.\n while (lastIndex < s.length) {\n // Make sure we start searching from where we previously left off\n regex.lastIndex = lastIndex;\n match = regex.exec(s);\n if (match === null) {\n break;\n }\n lastIndex = regex.lastIndex;\n if (regex === textEndRegex) {\n if (match[COMMENT_START] === '!--') {\n regex = commentEndRegex;\n } else if (match[COMMENT_START] !== undefined) {\n // We started a weird comment, like </{\n regex = comment2EndRegex;\n } else if (match[TAG_NAME] !== undefined) {\n if (rawTextElement.test(match[TAG_NAME])) {\n // Record if we encounter a raw-text element. We'll switch to\n // this regex at the end of the tag.\n rawTextEndRegex = new RegExp(`</${match[TAG_NAME]}`, 'g');\n }\n regex = tagEndRegex;\n } else if (match[DYNAMIC_TAG_NAME] !== undefined) {\n if (DEV_MODE) {\n throw new Error(\n 'Bindings in tag names are not supported. Please use static templates instead. ' +\n 'See https://lit.dev/docs/templates/expressions/#static-expressions'\n );\n }\n regex = tagEndRegex;\n }\n } else if (regex === tagEndRegex) {\n if (match[ENTIRE_MATCH] === '>') {\n // End of a tag. If we had started a raw-text element, use that\n // regex\n regex = rawTextEndRegex ?? textEndRegex;\n // We may be ending an unquoted attribute value, so make sure we\n // clear any pending attrNameEndIndex\n attrNameEndIndex = -1;\n } else if (match[ATTRIBUTE_NAME] === undefined) {\n // Attribute name position\n attrNameEndIndex = -2;\n } else {\n attrNameEndIndex = regex.lastIndex - match[SPACES_AND_EQUALS].length;\n attrName = match[ATTRIBUTE_NAME];\n regex =\n match[QUOTE_CHAR] === undefined\n ? tagEndRegex\n : match[QUOTE_CHAR] === '\"'\n ? doubleQuoteAttrEndRegex\n : singleQuoteAttrEndRegex;\n }\n } else if (\n regex === doubleQuoteAttrEndRegex ||\n regex === singleQuoteAttrEndRegex\n ) {\n regex = tagEndRegex;\n } else if (regex === commentEndRegex || regex === comment2EndRegex) {\n regex = textEndRegex;\n } else {\n // Not one of the five state regexes, so it must be the dynamically\n // created raw text regex and we're at the close of that element.\n regex = tagEndRegex;\n rawTextEndRegex = undefined;\n }\n }\n\n if (DEV_MODE) {\n // If we have a attrNameEndIndex, which indicates that we should\n // rewrite the attribute name, assert that we're in a valid attribute\n // position - either in a tag, or a quoted attribute value.\n console.assert(\n attrNameEndIndex === -1 ||\n regex === tagEndRegex ||\n regex === singleQuoteAttrEndRegex ||\n regex === doubleQuoteAttrEndRegex,\n 'unexpected parse state B'\n );\n }\n\n // We have four cases:\n // 1. We're in text position, and not in a raw text element\n // (regex === textEndRegex): insert a comment marker.\n // 2. We have a non-negative attrNameEndIndex which means we need to\n // rewrite the attribute name to add a bound attribute suffix.\n // 3. We're at the non-first binding in a multi-binding attribute, use a\n // plain marker.\n // 4. We're somewhere else inside the tag. If we're in attribute name\n // position (attrNameEndIndex === -2), add a sequential suffix to\n // generate a unique attribute name.\n\n // Detect a binding next to self-closing tag end and insert a space to\n // separate the marker from the tag end:\n const end =\n regex === tagEndRegex && strings[i + 1].startsWith('/>') ? ' ' : '';\n html +=\n regex === textEndRegex\n ? s + nodeMarker\n : attrNameEndIndex >= 0\n ? (attrNames.push(attrName!),\n s.slice(0, attrNameEndIndex) +\n boundAttributeSuffix +\n s.slice(attrNameEndIndex)) +\n marker +\n end\n : s + marker + (attrNameEndIndex === -2 ? i : end);\n }\n\n const htmlResult: string | TrustedHTML =\n html +\n (strings[l] || '<?>') +\n (type === SVG_RESULT ? '</svg>' : type === MATHML_RESULT ? '</math>' : '');\n\n // Returned as an array for terseness\n return [trustFromTemplateString(strings, htmlResult), attrNames];\n};\n\n/** @internal */\nexport type {Template};\nclass Template {\n /** @internal */\n el!: HTMLTemplateElement;\n\n parts: Array<TemplatePart> = [];\n\n constructor(\n // This property needs to remain unminified.\n {strings, ['_$litType$']: type}: UncompiledTemplateResult,\n options?: RenderOptions\n ) {\n let node: Node | null;\n let nodeIndex = 0;\n let attrNameIndex = 0;\n const partCount = strings.length - 1;\n const parts = this.parts;\n\n // Create template element\n const [html, attrNames] = getTemplateHtml(strings, type);\n this.el = Template.createElement(html, options);\n walker.currentNode = this.el.content;\n\n // Re-parent SVG or MathML nodes into template root\n if (type === SVG_RESULT || type === MATHML_RESULT) {\n const wrapper = this.el.content.firstChild!;\n wrapper.replaceWith(...wrapper.childNodes);\n }\n\n // Walk the template to find binding markers and create TemplateParts\n while ((node = walker.nextNode()) !== null && parts.length < partCount) {\n if (node.nodeType === 1) {\n if (DEV_MODE) {\n const tag = (node as Element).localName;\n // Warn if `textarea` includes an expression and throw if `template`\n // does since these are not supported. We do this by checking\n // innerHTML for anything that looks like a marker. This catches\n // cases like bindings in textarea there markers turn into text nodes.\n if (\n /^(?:textarea|template)$/i!.test(tag) &&\n (node as Element).innerHTML.includes(marker)\n ) {\n const m =\n `Expressions are not supported inside \\`${tag}\\` ` +\n `elements. See https://lit.dev/msg/expression-in-${tag} for more ` +\n `information.`;\n if (tag === 'template') {\n throw new Error(m);\n } else issueWarning('', m);\n }\n }\n // TODO (justinfagnani): for attempted dynamic tag names, we don't\n // increment the bindingIndex, and it'll be off by 1 in the element\n // and off by two after it.\n if ((node as Element).hasAttributes()) {\n for (const name of (node as Element).getAttributeNames()) {\n if (name.endsWith(boundAttributeSuffix)) {\n const realName = attrNames[attrNameIndex++];\n const value = (node as Element).getAttribute(name)!;\n const statics = value.split(marker);\n const m = /([.?@])?(.*)/.exec(realName)!;\n parts.push({\n type: ATTRIBUTE_PART,\n index: nodeIndex,\n name: m[2],\n strings: statics,\n ctor:\n m[1] === '.'\n ? PropertyPart\n : m[1] === '?'\n ? BooleanAttributePart\n : m[1] === '@'\n ? EventPart\n : AttributePart,\n });\n (node as Element).removeAttribute(name);\n } else if (name.startsWith(marker)) {\n parts.push({\n type: ELEMENT_PART,\n index: nodeIndex,\n });\n (node as Element).removeAttribute(name);\n }\n }\n }\n // TODO (justinfagnani): benchmark the regex against testing for each\n // of the 3 raw text element names.\n if (rawTextElement.test((node as Element).tagName)) {\n // For raw text elements we need to split the text content on\n // markers, create a Text node for each segment, and create\n // a TemplatePart for each marker.\n const strings = (node as Element).textContent!.split(marker);\n const lastIndex = strings.length - 1;\n if (lastIndex > 0) {\n (node as Element).textContent = trustedTypes\n ? (trustedTypes.emptyScript as unknown as '')\n : '';\n // Generate a new text node for each literal section\n // These nodes are also used as the markers for child parts\n for (let i = 0; i < lastIndex; i++) {\n (node as Element).append(strings[i], createMarker());\n // Walk past the marker node we just added\n walker.nextNode();\n parts.push({type: CHILD_PART, index: ++nodeIndex});\n }\n // Note because this marker is added after the walker's current\n // node, it will be walked to in the outer loop (and ignored), so\n // we don't need to adjust nodeIndex here\n (node as Element).append(strings[lastIndex], createMarker());\n }\n }\n } else if (node.nodeType === 8) {\n const data = (node as Comment).data;\n if (data === markerMatch) {\n parts.push({type: CHILD_PART, index: nodeIndex});\n } else {\n let i = -1;\n while ((i = (node as Comment).data.indexOf(marker, i + 1)) !== -1) {\n // Comment node has a binding marker inside, make an inactive part\n // The binding won't work, but subsequent bindings will\n parts.push({type: COMMENT_PART, index: nodeIndex});\n // Move to the end of the match\n i += marker.length - 1;\n }\n }\n }\n nodeIndex++;\n }\n\n if (DEV_MODE) {\n // If there was a duplicate attribute on a tag, then when the tag is\n // parsed into an element the attribute gets de-duplicated. We can detect\n // this mismatch if we haven't precisely consumed every attribute name\n // when preparing the template. This works because `attrNames` is built\n // from the template string and `attrNameIndex` comes from processing the\n // resulting DOM.\n if (attrNames.length !== attrNameIndex) {\n throw new Error(\n `Detected duplicate attribute bindings. This occurs if your template ` +\n `has duplicate attributes on an element tag. For example ` +\n `\"<input ?disabled=\\${true} ?disabled=\\${false}>\" contains a ` +\n `duplicate \"disabled\" attribute. The error was detected in ` +\n `the following template: \\n` +\n '`' +\n strings.join('${...}') +\n '`'\n );\n }\n }\n\n // We could set walker.currentNode to another node here to prevent a memory\n // leak, but every time we prepare a template, we immediately render it\n // and re-use the walker in new TemplateInstance._clone().\n debugLogEvent &&\n debugLogEvent({\n kind: 'template prep',\n template: this,\n clonableTemplate: this.el,\n parts: this.parts,\n strings,\n });\n }\n\n // Overridden via `litHtmlPolyfillSupport` to provide platform support.\n /** @nocollapse */\n static createElement(html: TrustedHTML, _options?: RenderOptions) {\n const el = d.createElement('template');\n el.innerHTML = html as unknown as string;\n return el;\n }\n}\n\nexport interface Disconnectable {\n _$parent?: Disconnectable;\n _$disconnectableChildren?: Set<Disconnectable>;\n // Rather than hold connection state on instances, Disconnectables recursively\n // fetch the connection state from the RootPart they are connected in via\n // getters up the Disconnectable tree via _$parent references. This pushes the\n // cost of tracking the isConnected state to `AsyncDirectives`, and avoids\n // needing to pass all Disconnectables (parts, template instances, and\n // directives) their connection state each time it changes, which would be\n // costly for trees that have no AsyncDirectives.\n _$isConnected: boolean;\n}\n\nfunction resolveDirective(\n part: ChildPart | AttributePart | ElementPart,\n value: unknown,\n parent: DirectiveParent = part,\n attributeIndex?: number\n): unknown {\n // Bail early if the value is explicitly noChange. Note, this means any\n // nested directive is still attached and is not run.\n if (value === noChange) {\n return value;\n }\n let currentDirective =\n attributeIndex !== undefined\n ? (parent as AttributePart).__directives?.[attributeIndex]\n : (parent as ChildPart | ElementPart | Directive).__directive;\n const nextDirectiveConstructor = isPrimitive(value)\n ? undefined\n : // This property needs to remain unminified.\n (value as DirectiveResult)['_$litDirective$'];\n if (currentDirective?.constructor !== nextDirectiveConstructor) {\n // This property needs to remain unminified.\n currentDirective?.['_$notifyDirectiveConnectionChanged']?.(false);\n if (nextDirectiveConstructor === undefined) {\n currentDirective = undefined;\n } else {\n currentDirective = new nextDirectiveConstructor(part as PartInfo);\n currentDirective._$initialize(part, parent, attributeIndex);\n }\n if (attributeIndex !== undefined) {\n ((parent as AttributePart).__directives ??= [])[attributeIndex] =\n currentDirective;\n } else {\n (parent as ChildPart | Directive).__directive = currentDirective;\n }\n }\n if (currentDirective !== undefined) {\n value = resolveDirective(\n part,\n currentDirective._$resolve(part, (value as DirectiveResult).values),\n currentDirective,\n attributeIndex\n );\n }\n return value;\n}\n\nexport type {TemplateInstance};\n/**\n * An updateable instance of a Template. Holds references to the Parts used to\n * update the template instance.\n */\nclass TemplateInstance implements Disconnectable {\n _$template: Template;\n _$parts: Array<Part | undefined> = [];\n\n /** @internal */\n _$parent: ChildPart;\n /** @internal */\n _$disconnectableChildren?: Set<Disconnectable> = undefined;\n\n constructor(template: Template, parent: ChildPart) {\n this._$template = template;\n this._$parent = parent;\n }\n\n // Called by ChildPart parentNode getter\n get parentNode() {\n return this._$parent.parentNode;\n }\n\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n\n // This method is separate from the constructor because we need to return a\n // DocumentFragment and we don't want to hold onto it with an instance field.\n _clone(options: RenderOptions | undefined) {\n const {\n el: {content},\n parts: parts,\n } = this._$template;\n const fragment = (options?.creationScope ?? d).importNode(content, true);\n walker.currentNode = fragment;\n\n let node = walker.nextNode()!;\n let nodeIndex = 0;\n let partIndex = 0;\n let templatePart = parts[0];\n\n while (templatePart !== undefined) {\n if (nodeIndex === templatePart.index) {\n let part: Part | undefined;\n if (templatePart.type === CHILD_PART) {\n part = new ChildPart(\n node as HTMLElement,\n node.nextSibling,\n this,\n options\n );\n } else if (templatePart.type === ATTRIBUTE_PART) {\n part = new templatePart.ctor(\n node as HTMLElement,\n templatePart.name,\n templatePart.strings,\n this,\n options\n );\n } else if (templatePart.type === ELEMENT_PART) {\n part = new ElementPart(node as HTMLElement, this, options);\n }\n this._$parts.push(part);\n templatePart = parts[++partIndex];\n }\n if (nodeIndex !== templatePart?.index) {\n node = walker.nextNode()!;\n nodeIndex++;\n }\n }\n // We need to set the currentNode away from the cloned tree so that we\n // don't hold onto the tree even if the tree is detached and should be\n // freed.\n walker.currentNode = d;\n return fragment;\n }\n\n _update(values: Array<unknown>) {\n let i = 0;\n for (const part of this._$parts) {\n if (part !== undefined) {\n debugLogEvent &&\n debugLogEvent({\n kind: 'set part',\n part,\n value: values[i],\n valueIndex: i,\n values,\n templateInstance: this,\n });\n if ((part as AttributePart).strings !== undefined) {\n (part as AttributePart)._$setValue(values, part as AttributePart, i);\n // The number of values the part consumes is part.strings.length - 1\n // since values are in between template spans. We increment i by 1\n // later in the loop, so increment it by part.strings.length - 2 here\n i += (part as AttributePart).strings!.length - 2;\n } else {\n part._$setValue(values[i]);\n }\n }\n i++;\n }\n }\n}\n\n/*\n * Parts\n */\ntype AttributeTemplatePart = {\n readonly type: typeof ATTRIBUTE_PART;\n readonly index: number;\n readonly name: string;\n readonly ctor: typeof AttributePart;\n readonly strings: ReadonlyArray<string>;\n};\ntype ChildTemplatePart = {\n readonly type: typeof CHILD_PART;\n readonly index: number;\n};\ntype ElementTemplatePart = {\n readonly type: typeof ELEMENT_PART;\n readonly index: number;\n};\ntype CommentTemplatePart = {\n readonly type: typeof COMMENT_PART;\n readonly index: number;\n};\n\n/**\n * A TemplatePart represents a dynamic part in a template, before the template\n * is instantiated. When a template is instantiated Parts are created from\n * TemplateParts.\n */\ntype TemplatePart =\n | ChildTemplatePart\n | AttributeTemplatePart\n | ElementTemplatePart\n | CommentTemplatePart;\n\nexport type Part =\n | ChildPart\n | AttributePart\n | PropertyPart\n | BooleanAttributePart\n | ElementPart\n | EventPart;\n\nexport type {ChildPart};\nclass ChildPart implements Disconnectable {\n readonly type = CHILD_PART;\n readonly options: RenderOptions | undefined;\n _$committedValue: unknown = nothing;\n /** @internal */\n __directive?: Directive;\n /** @internal */\n _$startNode: ChildNode;\n /** @internal */\n _$endNode: ChildNode | null;\n private _textSanitizer: ValueSanitizer | undefined;\n /** @internal */\n _$parent: Disconnectable | undefined;\n /**\n * Connection state for RootParts only (i.e. ChildPart without _$parent\n * returned from top-level `render`). This field is unused otherwise. The\n * intention would be clearer if we made `RootPart` a subclass of `ChildPart`\n * with this field (and a different _$isConnected getter), but the subclass\n * caused a perf regression, possibly due to making call sites polymorphic.\n * @internal\n */\n __isConnected: boolean;\n\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n // ChildParts that are not at the root should always be created with a\n // parent; only RootChildNode's won't, so they return the local isConnected\n // state\n return this._$parent?._$isConnected ?? this.__isConnected;\n }\n\n // The following fields will be patched onto ChildParts when required by\n // AsyncDirective\n /** @internal */\n _$disconnectableChildren?: Set<Disconnectable> = undefined;\n /** @internal */\n _$notifyConnectionChanged?(\n isConnected: boolean,\n removeFromParent?: boolean,\n from?: number\n ): void;\n /** @internal */\n _$reparentDisconnectables?(parent: Disconnectable): void;\n\n constructor(\n startNode: ChildNode,\n endNode: ChildNode | null,\n parent: TemplateInstance | ChildPart | undefined,\n options: RenderOptions | undefined\n ) {\n this._$startNode = startNode;\n this._$endNode = endNode;\n this._$parent = parent;\n this.options = options;\n // Note __isConnected is only ever accessed on RootParts (i.e. when there is\n // no _$parent); the value on a non-root-part is \"don't care\", but checking\n // for parent would be more code\n this.__isConnected = options?.isConnected ?? true;\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n // Explicitly initialize for consistent class shape.\n this._textSanitizer = undefined;\n }\n }\n\n /**\n * The parent node into which the part renders its content.\n *\n * A ChildPart's content consists of a range of adjacent child nodes of\n * `.parentNode`, possibly bordered by 'marker nodes' (`.startNode` and\n * `.endNode`).\n *\n * - If both `.startNode` and `.endNode` are non-null, then the part's content\n * consists of all siblings between `.startNode` and `.endNode`, exclusively.\n *\n * - If `.startNode` is non-null but `.endNode` is null, then the part's\n * content consists of all siblings following `.startNode`, up to and\n * including the last child of `.parentNode`. If `.endNode` is non-null, then\n * `.startNode` will always be non-null.\n *\n * - If both `.endNode` and `.startNode` are null, then the part's content\n * consists of all child nodes of `.parentNode`.\n */\n get parentNode(): Node {\n let parentNode: Node = wrap(this._$startNode).parentNode!;\n const parent = this._$parent;\n if (\n parent !== undefined &&\n parentNode?.nodeType === 11 /* Node.DOCUMENT_FRAGMENT */\n ) {\n // If the parentNode is a DocumentFragment, it may be because the DOM is\n // still in the cloned fragment during initial render; if so, get the real\n // parentNode the part will be committed into by asking the parent.\n parentNode = (parent as ChildPart | TemplateInstance).parentNode;\n }\n return parentNode;\n }\n\n /**\n * The part's leading marker node, if any. See `.parentNode` for more\n * information.\n */\n get startNode(): Node | null {\n return this._$startNode;\n }\n\n /**\n * The part's trailing marker node, if any. See `.parentNode` for more\n * information.\n */\n get endNode(): Node | null {\n return this._$endNode;\n }\n\n _$setValue(value: unknown, directiveParent: DirectiveParent = this): void {\n if (DEV_MODE && this.parentNode === null) {\n throw new Error(\n `This \\`ChildPart\\` has no \\`parentNode\\` and therefore cannot accept a value. This likely means the element containing the part was manipulated in an unsupported way outside of Lit's control such that the part's marker nodes were ejected from DOM. For example, setting the element's \\`innerHTML\\` or \\`textContent\\` can do this.`\n );\n }\n value = resolveDirective(this, value, directiveParent);\n if (isPrimitive(value)) {\n // Non-rendering child values. It's important that these do not render\n // empty text nodes to avoid issues with preventing default <slot>\n // fallback content.\n if (value === nothing || value == null || value === '') {\n if (this._$committedValue !== nothing) {\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit nothing to child',\n start: this._$startNode,\n end: this._$endNode,\n parent: this._$parent,\n options: this.options,\n });\n this._$clear();\n }\n this._$committedValue = nothing;\n } else if (value !== this._$committedValue && value !== noChange) {\n this._commitText(value);\n }\n // This property needs to remain unminified.\n } else if ((value as TemplateResult)['_$litType$'] !== undefined) {\n this._commitTemplateResult(value as TemplateResult);\n } else if ((value as Node).nodeType !== undefined) {\n if (DEV_MODE && this.options?.host === value) {\n this._commitText(\n `[probable mistake: rendered a template's host in itself ` +\n `(commonly caused by writing \\${this} in a template]`\n );\n console.warn(\n `Attempted to render the template host`,\n value,\n `inside itself. This is almost always a mistake, and in dev mode `,\n `we render some warning text. In production however, we'll `,\n `render it, which will usually result in an error, and sometimes `,\n `in the element disappearing from the DOM.`\n );\n return;\n }\n this._commitNode(value as Node);\n } else if (isIterable(value)) {\n this._commitIterable(value);\n } else {\n // Fallback, will render the string representation\n this._commitText(value);\n }\n }\n\n private _insert<T extends Node>(node: T) {\n return wrap(wrap(this._$startNode).parentNode!).insertBefore(\n node,\n this._$endNode\n );\n }\n\n private _commitNode(value: Node): void {\n if (this._$committedValue !== value) {\n this._$clear();\n if (\n ENABLE_EXTRA_SECURITY_HOOKS &&\n sanitizerFactoryInternal !== noopSanitizer\n ) {\n const parentNodeName = this._$startNode.parentNode?.nodeName;\n if (parentNodeName === 'STYLE' || parentNodeName === 'SCRIPT') {\n let message = 'Forbidden';\n if (DEV_MODE) {\n if (parentNodeName === 'STYLE') {\n message =\n `Lit does not support binding inside style nodes. ` +\n `This is a security risk, as style injection attacks can ` +\n `exfiltrate data and spoof UIs. ` +\n `Consider instead using css\\`...\\` literals ` +\n `to compose styles, and do dynamic styling with ` +\n `css custom properties, ::parts, <slot>s, ` +\n `and by mutating the DOM rather than stylesheets.`;\n } else {\n message =\n `Lit does not support binding inside script nodes. ` +\n `This is a security risk, as it could allow arbitrary ` +\n `code execution.`;\n }\n }\n throw new Error(message);\n }\n }\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit node',\n start: this._$startNode,\n parent: this._$parent,\n value: value,\n options: this.options,\n });\n this._$committedValue = this._insert(value);\n }\n }\n\n private _commitText(value: unknown): void {\n // If the committed value is a primitive it means we called _commitText on\n // the previous render, and we know that this._$startNode.nextSibling is a\n // Text node. We can now just replace the text content (.data) of the node.\n if (\n this._$committedValue !== nothing &&\n isPrimitive(this._$committedValue)\n ) {\n const node = wrap(this._$startNode).nextSibling as Text;\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n if (this._textSanitizer === undefined) {\n this._textSanitizer = createSanitizer(node, 'data', 'property');\n }\n value = this._textSanitizer(value);\n }\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit text',\n node,\n value,\n options: this.options,\n });\n (node as Text).data = value as string;\n } else {\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n const textNode = d.createTextNode('');\n this._commitNode(textNode);\n // When setting text content, for security purposes it matters a lot\n // what the parent is. For example, <style> and <script> need to be\n // handled with care, while <span> does not. So first we need to put a\n // text node into the document, then we can sanitize its content.\n if (this._textSanitizer === undefined) {\n this._textSanitizer = createSanitizer(textNode, 'data', 'property');\n }\n value = this._textSanitizer(value);\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit text',\n node: textNode,\n value,\n options: this.options,\n });\n textNode.data = value as string;\n } else {\n this._commitNode(d.createTextNode(value as string));\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit text',\n node: wrap(this._$startNode).nextSibling as Text,\n value,\n options: this.options,\n });\n }\n }\n this._$committedValue = value;\n }\n\n private _commitTemplateResult(\n result: TemplateResult | CompiledTemplateResult\n ): void {\n // This property needs to remain unminified.\n const {values, ['_$litType$']: type} = result;\n // If $litType$ is a number, result is a plain TemplateResult and we get\n // the template from the template cache. If not, result is a\n // CompiledTemplateResult and _$litType$ is a CompiledTemplate and we need\n // to create the <template> element the first time we see it.\n const template: Template | CompiledTemplate =\n typeof type === 'number'\n ? this._$getTemplate(result as UncompiledTemplateResult)\n : (type.el === undefined &&\n (type.el = Template.createElement(\n trustFromTemplateString(type.h, type.h[0]),\n this.options\n )),\n type);\n\n if ((this._$committedValue as TemplateInstance)?._$template === template) {\n debugLogEvent &&\n debugLogEvent({\n kind: 'template updating',\n template,\n instance: this._$committedValue as TemplateInstance,\n parts: (this._$committedValue as TemplateInstance)._$parts,\n options: this.options,\n values,\n });\n (this._$committedValue as TemplateInstance)._update(values);\n } else {\n const instance = new TemplateInstance(template as Template, this);\n const fragment = instance._clone(this.options);\n debugLogEvent &&\n debugLogEvent({\n kind: 'template instantiated',\n template,\n instance,\n parts: instance._$parts,\n options: this.options,\n fragment,\n values,\n });\n instance._update(values);\n debugLogEvent &&\n debugLogEvent({\n kind: 'template instantiated and updated',\n template,\n instance,\n parts: instance._$parts,\n options: this.options,\n fragment,\n values,\n });\n this._commitNode(fragment);\n this._$committedValue = instance;\n }\n }\n\n // Overridden via `litHtmlPolyfillSupport` to provide platform support.\n /** @internal */\n _$getTemplate(result: UncompiledTemplateResult) {\n let template = templateCache.get(result.strings);\n if (template === undefined) {\n templateCache.set(result.strings, (template = new Template(result)));\n }\n return template;\n }\n\n private _commitIterable(value: Iterable<unknown>): void {\n // For an Iterable, we create a new InstancePart per item, then set its\n // value to the item. This is a little bit of overhead for every item in\n // an Iterable, but it lets us recurse easily and efficiently update Arrays\n // of TemplateResults that will be commonly returned from expressions like:\n // array.map((i) => html`${i}`), by reusing existing TemplateInstances.\n\n // If value is an array, then the previous render was of an\n // iterable and value will contain the ChildParts from the previous\n // render. If value is not an array, clear this part and make a new\n // array for ChildParts.\n if (!isArray(this._$committedValue)) {\n this._$committedValue = [];\n this._$clear();\n }\n\n // Lets us keep track of how many items we stamped so we can clear leftover\n // items from a previous render\n const itemParts = this._$committedValue as ChildPart[];\n let partIndex = 0;\n let itemPart: ChildPart | undefined;\n\n for (const item of value) {\n if (partIndex === itemParts.length) {\n // If no existing part, create a new one\n // TODO (justinfagnani): test perf impact of always creating two parts\n // instead of sharing parts between nodes\n // https://github.com/lit/lit/issues/1266\n itemParts.push(\n (itemPart = new ChildPart(\n this._insert(createMarker()),\n this._insert(createMarker()),\n this,\n this.options\n ))\n );\n } else {\n // Reuse an existing part\n itemPart = itemParts[partIndex];\n }\n itemPart._$setValue(item);\n partIndex++;\n }\n\n if (partIndex < itemParts.length) {\n // itemParts always have end nodes\n this._$clear(\n itemPart && wrap(itemPart._$endNode!).nextSibling,\n partIndex\n );\n // Truncate the parts array so _value reflects the current state\n itemParts.length = partIndex;\n }\n }\n\n /**\n * Removes the nodes contained within this Part from the DOM.\n *\n * @param start Start node to clear from, for clearing a subset of the part's\n * DOM (used when truncating iterables)\n * @param from When `start` is specified, the index within the iterable from\n * which ChildParts are being removed, used for disconnecting directives\n * in those Parts.\n *\n * @internal\n */\n _$clear(\n start: ChildNode | null = wrap(this._$startNode).nextSibling,\n from?: number\n ) {\n this._$notifyConnectionChanged?.(false, true, from);\n while (start !== this._$endNode) {\n // The non-null assertion is safe because if _$startNode.nextSibling is\n // null, then _$endNode is also null, and we would not have entered this\n // loop.\n const n = wrap(start!).nextSibling;\n wrap(start!).remove();\n start = n;\n }\n }\n\n /**\n * Implementation of RootPart's `isConnected`. Note that this method\n * should only be called on `RootPart`s (the `ChildPart` returned from a\n * top-level `render()` call). It has no effect on non-root ChildParts.\n * @param isConnected Whether to set\n * @internal\n */\n setConnected(isConnected: boolean) {\n if (this._$parent === undefined) {\n this.__isConnected = isConnected;\n this._$notifyConnectionChanged?.(isConnected);\n } else if (DEV_MODE) {\n throw new Error(\n 'part.setConnected() may only be called on a ' +\n 'RootPart returned from render().'\n );\n }\n }\n}\n\n/**\n * A top-level `ChildPart` returned from `render` that manages the connected\n * state of `AsyncDirective`s created throughout the tree below it.\n */\nexport interface RootPart extends ChildPart {\n /**\n * Sets the connection state for `AsyncDirective`s contained within this root\n * ChildPart.\n *\n * lit-html does not automatically monitor the connectedness of DOM rendered;\n * as such, it is the responsibility of the caller to `render` to ensure that\n * `part.setConnected(false)` is called before the part object is potentially\n * discarded, to ensure that `AsyncDirective`s have a chance to dispose of\n * any resources being held. If a `RootPart` that was previously\n * disconnected is subsequently re-connected (and its `AsyncDirective`s should\n * re-connect), `setConnected(true)` should be called.\n *\n * @param isConnected Whether directives within this tree should be connected\n * or not\n */\n setConnected(isConnected: boolean): void;\n}\n\nexport type {AttributePart};\nclass AttributePart implements Disconnectable {\n readonly type:\n | typeof ATTRIBUTE_PART\n | typeof PROPERTY_PART\n | typeof BOOLEAN_ATTRIBUTE_PART\n | typeof EVENT_PART = ATTRIBUTE_PART;\n readonly element: HTMLElement;\n readonly name: string;\n readonly options: RenderOptions | undefined;\n\n /**\n * If this attribute part represents an interpolation, this contains the\n * static strings of the interpolation. For single-value, complete bindings,\n * this is undefined.\n */\n readonly strings?: ReadonlyArray<string>;\n /** @internal */\n _$committedValue: unknown | Array<unknown> = nothing;\n /** @internal */\n __directives?: Array<Directive | undefined>;\n /** @internal */\n _$parent: Disconnectable;\n /** @internal */\n _$disconnectableChildren?: Set<Disconnectable> = undefined;\n\n protected _sanitizer: ValueSanitizer | undefined;\n\n get tagName() {\n return this.element.tagName;\n }\n\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n\n constructor(\n element: HTMLElement,\n name: string,\n strings: ReadonlyArray<string>,\n parent: Disconnectable,\n options: RenderOptions | undefined\n ) {\n this.element = element;\n this.name = name;\n this._$parent = parent;\n this.options = options;\n if (strings.length > 2 || strings[0] !== '' || strings[1] !== '') {\n this._$committedValue = new Array(strings.length - 1).fill(new String());\n this.strings = strings;\n } else {\n this._$committedValue = nothing;\n }\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n this._sanitizer = undefined;\n }\n }\n\n /**\n * Sets the value of this part by resolving the value from possibly multiple\n * values and static strings and committing it to the DOM.\n * If this part is single-valued, `this._strings` will be undefined, and the\n * method will be called with a single value argument. If this part is\n * multi-value, `this._strings` will be defined, and the method is called\n * with the value array of the part's owning TemplateInstance, and an offset\n * into the value array from which the values should be read.\n * This method is overloaded this way to eliminate short-lived array slices\n * of the template instance values, and allow a fast-path for single-valued\n * parts.\n *\n * @param value The part value, or an array of values for multi-valued parts\n * @param valueIndex the index to start reading values from. `undefined` for\n * single-valued parts\n * @param noCommit causes the part to not commit its value to the DOM. Used\n * in hydration to prime attribute parts with their first-rendered value,\n * but not set the attribute, and in SSR to no-op the DOM operation and\n * capture the value for serialization.\n *\n * @internal\n */\n _$setValue(\n value: unknown | Array<unknown>,\n directiveParent: DirectiveParent = this,\n valueIndex?: number,\n noCommit?: boolean\n ) {\n const strings = this.strings;\n\n // Whether any of the values has changed, for dirty-checking\n let change = false;\n\n if (strings === undefined) {\n // Single-value binding case\n value = resolveDirective(this, value, directiveParent, 0);\n change =\n !isPrimitive(value) ||\n (value !== this._$committedValue && value !== noChange);\n if (change) {\n this._$committedValue = value;\n }\n } else {\n // Interpolation case\n const values = value as Array<unknown>;\n value = strings[0];\n\n let i, v;\n for (i = 0; i < strings.length - 1; i++) {\n v = resolveDirective(this, values[valueIndex! + i], directiveParent, i);\n\n if (v === noChange) {\n // If the user-provided value is `noChange`, use the previous value\n v = (this._$committedValue as Array<unknown>)[i];\n }\n change ||=\n !isPrimitive(v) || v !== (this._$committedValue as Array<unknown>)[i];\n if (v === nothing) {\n value = nothing;\n } else if (value !== nothing) {\n value += (v ?? '') + strings[i + 1];\n }\n // We always record each value, even if one is `nothing`, for future\n // change detection.\n (this._$committedValue as Array<unknown>)[i] = v;\n }\n }\n if (change && !noCommit) {\n this._commitValue(value);\n }\n }\n\n /** @internal */\n _commitValue(value: unknown) {\n if (value === nothing) {\n (wrap(this.element) as Element).removeAttribute(this.name);\n } else {\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n if (this._sanitizer === undefined) {\n this._sanitizer = sanitizerFactoryInternal(\n this.element,\n this.name,\n 'attribute'\n );\n }\n value = this._sanitizer(value ?? '');\n }\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit attribute',\n element: this.element,\n name: this.name,\n value,\n options: this.options,\n });\n (wrap(this.element) as Element).setAttribute(\n this.name,\n (value ?? '') as string\n );\n }\n }\n}\n\nexport type {PropertyPart};\nclass PropertyPart extends AttributePart {\n override readonly type = PROPERTY_PART;\n\n /** @internal */\n override _commitValue(value: unknown) {\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n if (this._sanitizer === undefined) {\n this._sanitizer = sanitizerFactoryInternal(\n this.element,\n this.name,\n 'property'\n );\n }\n value = this._sanitizer(value);\n }\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit property',\n element: this.element,\n name: this.name,\n value,\n options: this.options,\n });\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (this.element as any)[this.name] = value === nothing ? undefined : value;\n }\n}\n\nexport type {BooleanAttributePart};\nclass BooleanAttributePart extends AttributePart {\n override readonly type = BOOLEAN_ATTRIBUTE_PART;\n\n /** @internal */\n override _commitValue(value: unknown) {\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit boolean attribute',\n element: this.element,\n name: this.name,\n value: !!(value && value !== nothing),\n options: this.options,\n });\n (wrap(this.element) as Element).toggleAttribute(\n this.name,\n !!value && value !== nothing\n );\n }\n}\n\ntype EventListenerWithOptions = EventListenerOrEventListenerObject &\n Partial<AddEventListenerOptions>;\n\n/**\n * An AttributePart that manages an event listener via add/removeEventListener.\n *\n * This part works by adding itself as the event listener on an element, then\n * delegating to the value passed to it. This reduces the number of calls to\n * add/removeEventListener if the listener changes frequently, such as when an\n * inline function is used as a listener.\n *\n * Because event options are passed when adding listeners, we must take case\n * to add and remove the part as a listener when the event options change.\n */\nexport type {EventPart};\nclass EventPart extends AttributePart {\n override readonly type = EVENT_PART;\n\n constructor(\n element: HTMLElement,\n name: string,\n strings: ReadonlyArray<string>,\n parent: Disconnectable,\n options: RenderOptions | undefined\n ) {\n super(element, name, strings, parent, options);\n\n if (DEV_MODE && this.strings !== undefined) {\n throw new Error(\n `A \\`<${element.localName}>\\` has a \\`@${name}=...\\` listener with ` +\n 'invalid content. Event listeners in templates must have exactly ' +\n 'one expression and no surrounding text.'\n );\n }\n }\n\n // EventPart does not use the base _$setValue/_resolveValue implementation\n // since the dirty checking is more complex\n /** @internal */\n override _$setValue(\n newListener: unknown,\n directiveParent: DirectiveParent = this\n ) {\n newListener =\n resolveDirective(this, newListener, directiveParent, 0) ?? nothing;\n if (newListener === noChange) {\n return;\n }\n const oldListener = this._$committedValue;\n\n // If the new value is nothing or any options change we have to remove the\n // part as a listener.\n const shouldRemoveListener =\n (newListener === nothing && oldListener !== nothing) ||\n (newListener as EventListenerWithOptions).capture !==\n (oldListener as EventListenerWithOptions).capture ||\n (newListener as EventListenerWithOptions).once !==\n (oldListener as EventListenerWithOptions).once ||\n (newListener as EventListenerWithOptions).passive !==\n (oldListener as EventListenerWithOptions).passive;\n\n // If the new value is not nothing and we removed the listener, we have\n // to add the part as a listener.\n const shouldAddListener =\n newListener !== nothing &&\n (oldListener === nothing || shouldRemoveListener);\n\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit event listener',\n element: this.element,\n name: this.name,\n value: newListener,\n options: this.options,\n removeListener: shouldRemoveListener,\n addListener: shouldAddListener,\n oldListener,\n });\n if (shouldRemoveListener) {\n this.element.removeEventListener(\n this.name,\n this,\n oldListener as EventListenerWithOptions\n );\n }\n if (shouldAddListener) {\n this.element.addEventListener(\n this.name,\n this,\n newListener as EventListenerWithOptions\n );\n }\n this._$committedValue = newListener;\n }\n\n handleEvent(event: Event) {\n if (typeof this._$committedValue === 'function') {\n this._$committedValue.call(this.options?.host ?? this.element, event);\n } else {\n (this._$committedValue as EventListenerObject).handleEvent(event);\n }\n }\n}\n\nexport type {ElementPart};\nclass ElementPart implements Disconnectable {\n readonly type = ELEMENT_PART;\n\n /** @internal */\n __directive?: Directive;\n\n // This is to ensure that every Part has a _$committedValue\n _$committedValue: undefined;\n\n /** @internal */\n _$parent!: Disconnectable;\n\n /** @internal */\n _$disconnectableChildren?: Set<Disconnectable> = undefined;\n\n options: RenderOptions | undefined;\n\n constructor(\n public element: Element,\n parent: Disconnectable,\n options: RenderOptions | undefined\n ) {\n this._$parent = parent;\n this.options = options;\n }\n\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n\n _$setValue(value: unknown): void {\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit to element binding',\n element: this.element,\n value,\n options: this.options,\n });\n resolveDirective(this, value);\n }\n}\n\n/**\n * END USERS SHOULD NOT RELY ON THIS OBJECT.\n *\n * Private exports for use by other Lit packages, not intended for use by\n * external users.\n *\n * We currently do not make a mangled rollup build of the lit-ssr code. In order\n * to keep a number of (otherwise private) top-level exports mangled in the\n * client side code, we export a _$LH object containing those members (or\n * helper methods for accessing private fields of those members), and then\n * re-export them for use in lit-ssr. This keeps lit-ssr agnostic to whether the\n * client-side code is being used in `dev` mode or `prod` mode.\n *\n * This has a unique name, to disambiguate it from private exports in\n * lit-element, which re-exports all of lit-html.\n *\n * @private\n */\nexport const _$LH = {\n // Used in lit-ssr\n _boundAttributeSuffix: boundAttributeSuffix,\n _marker: marker,\n _markerMatch: markerMatch,\n _HTML_RESULT: HTML_RESULT,\n _getTemplateHtml: getTemplateHtml,\n // Used in tests and private-ssr-support\n _TemplateInstance: TemplateInstance,\n _isIterable: isIterable,\n _resolveDirective: resolveDirective,\n _ChildPart: ChildPart,\n _AttributePart: AttributePart,\n _BooleanAttributePart: BooleanAttributePart,\n _EventPart: EventPart,\n _PropertyPart: PropertyPart,\n _ElementPart: ElementPart,\n};\n\n// Apply polyfills if available\nconst polyfillSupport = DEV_MODE\n ? global.litHtmlPolyfillSupportDevMode\n : global.litHtmlPolyfillSupport;\npolyfillSupport?.(Template, ChildPart);\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for lit-html usage.\n(global.litHtmlVersions ??= []).push('3.3.2');\nif (DEV_MODE && global.litHtmlVersions.length > 1) {\n queueMicrotask(() => {\n issueWarning!(\n 'multiple-versions',\n `Multiple versions of Lit loaded. ` +\n `Loading multiple versions is not recommended.`\n );\n });\n}\n\n/**\n * Renders a value, usually a lit-html TemplateResult, to the container.\n *\n * This example renders the text \"Hello, Zoe!\" inside a paragraph tag, appending\n * it to the container `document.body`.\n *\n * ```js\n * import {html, render} from 'lit';\n *\n * const name = \"Zoe\";\n * render(html`<p>Hello, ${name}!</p>`, document.body);\n * ```\n *\n * @param value Any [renderable\n * value](https://lit.dev/docs/templates/expressions/#child-expressions),\n * typically a {@linkcode TemplateResult} created by evaluating a template tag\n * like {@linkcode html} or {@linkcode svg}.\n * @param container A DOM container to render to. The first render will append\n * the rendered value to the container, and subsequent renders will\n * efficiently update the rendered value if the same result type was\n * previously rendered there.\n * @param options See {@linkcode RenderOptions} for options documentation.\n * @see\n * {@link https://lit.dev/docs/libraries/standalone-templates/#rendering-lit-html-templates| Rendering Lit HTML Templates}\n */\nexport const render = (\n value: unknown,\n container: RenderRootNode,\n options?: RenderOptions\n): RootPart => {\n if (DEV_MODE && container == null) {\n // Give a clearer error message than\n // Uncaught TypeError: Cannot read properties of null (reading\n // '_$litPart$')\n // which reads like an internal Lit error.\n throw new TypeError(`The container to render into may not be ${container}`);\n }\n const renderId = DEV_MODE ? debugLogRenderId++ : 0;\n const partOwnerNode = options?.renderBefore ?? container;\n // This property needs to remain unminified.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let part: ChildPart = (partOwnerNode as any)['_$litPart$'];\n debugLogEvent &&\n debugLogEvent({\n kind: 'begin render',\n id: renderId,\n value,\n container,\n options,\n part,\n });\n if (part === undefined) {\n const endNode = options?.renderBefore ?? null;\n // This property needs to remain unminified.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (partOwnerNode as any)['_$litPart$'] = part = new ChildPart(\n container.insertBefore(createMarker(), endNode),\n endNode,\n undefined,\n options ?? {}\n );\n }\n part._$setValue(value);\n debugLogEvent &&\n debugLogEvent({\n kind: 'end render',\n id: renderId,\n value,\n container,\n options,\n part,\n });\n return part as RootPart;\n};\n\nif (ENABLE_EXTRA_SECURITY_HOOKS) {\n render.setSanitizer = setSanitizer;\n render.createSanitizer = createSanitizer;\n if (DEV_MODE) {\n render._testOnlyClearSanitizerFactoryDoNotCallOrElse =\n _testOnlyClearSanitizerFactoryDoNotCallOrElse;\n }\n}\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * The main LitElement module, which defines the {@linkcode LitElement} base\n * class and related APIs.\n *\n * LitElement components can define a template and a set of observed\n * properties. Changing an observed property triggers a re-render of the\n * element.\n *\n * Import {@linkcode LitElement} and {@linkcode html} from this module to\n * create a component:\n *\n * ```js\n * import {LitElement, html} from 'lit-element';\n *\n * class MyElement extends LitElement {\n *\n * // Declare observed properties\n * static get properties() {\n * return {\n * adjective: {}\n * }\n * }\n *\n * constructor() {\n * this.adjective = 'awesome';\n * }\n *\n * // Define the element's template\n * render() {\n * return html`<p>your ${adjective} template here</p>`;\n * }\n * }\n *\n * customElements.define('my-element', MyElement);\n * ```\n *\n * `LitElement` extends {@linkcode ReactiveElement} and adds lit-html\n * templating. The `ReactiveElement` class is provided for users that want to\n * build their own custom element base classes that don't use lit-html.\n *\n * @packageDocumentation\n */\nimport {PropertyValues, ReactiveElement} from '@lit/reactive-element';\nimport {render, RenderOptions, noChange, RootPart} from 'lit-html';\nexport * from '@lit/reactive-element';\nexport * from 'lit-html';\n\nimport {LitUnstable} from 'lit-html';\nimport {ReactiveUnstable} from '@lit/reactive-element';\n\n/**\n * Contains types that are part of the unstable debug API.\n *\n * Everything in this API is not stable and may change or be removed in the future,\n * even on patch releases.\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Unstable {\n /**\n * When Lit is running in dev mode and `window.emitLitDebugLogEvents` is true,\n * we will emit 'lit-debug' events to window, with live details about the update and render\n * lifecycle. These can be useful for writing debug tooling and visualizations.\n *\n * Please be aware that running with window.emitLitDebugLogEvents has performance overhead,\n * making certain operations that are normally very cheap (like a no-op render) much slower,\n * because we must copy data and dispatch events.\n */\n // eslint-disable-next-line @typescript-eslint/no-namespace\n export namespace DebugLog {\n export type Entry =\n | LitUnstable.DebugLog.Entry\n | ReactiveUnstable.DebugLog.Entry;\n }\n}\n/*\n * When using Closure Compiler, JSCompiler_renameProperty(property, object) is\n * replaced at compile time by the munged name for object[property]. We cannot\n * alias this function, so we have to use a small shim that has the same\n * behavior when not compiling.\n */\n/*@__INLINE__*/\nconst JSCompiler_renameProperty = <P extends PropertyKey>(\n prop: P,\n _obj: unknown\n): P => prop;\n\nconst DEV_MODE = true;\n// Allows minifiers to rename references to globalThis\nconst global = globalThis;\n\nlet issueWarning: (code: string, warning: string) => void;\n\nif (DEV_MODE) {\n // Ensure warnings are issued only 1x, even if multiple versions of Lit\n // are loaded.\n global.litIssuedWarnings ??= new Set();\n\n /**\n * Issue a warning if we haven't already, based either on `code` or `warning`.\n * Warnings are disabled automatically only by `warning`; disabling via `code`\n * can be done by users.\n */\n issueWarning = (code: string, warning: string) => {\n warning += ` See https://lit.dev/msg/${code} for more information.`;\n if (\n !global.litIssuedWarnings!.has(warning) &&\n !global.litIssuedWarnings!.has(code)\n ) {\n console.warn(warning);\n global.litIssuedWarnings!.add(warning);\n }\n };\n}\n\n/**\n * Base element class that manages element properties and attributes, and\n * renders a lit-html template.\n *\n * To define a component, subclass `LitElement` and implement a\n * `render` method to provide the component's template. Define properties\n * using the {@linkcode LitElement.properties properties} property or the\n * {@linkcode property} decorator.\n */\nexport class LitElement extends ReactiveElement {\n // This property needs to remain unminified.\n static ['_$litElement$'] = true;\n\n /**\n * @category rendering\n */\n readonly renderOptions: RenderOptions = {host: this};\n\n private __childPart: RootPart | undefined = undefined;\n\n /**\n * @category rendering\n */\n protected override createRenderRoot() {\n const renderRoot = super.createRenderRoot();\n // When adoptedStyleSheets are shimmed, they are inserted into the\n // shadowRoot by createRenderRoot. Adjust the renderBefore node so that\n // any styles in Lit content render before adoptedStyleSheets. This is\n // important so that adoptedStyleSheets have precedence over styles in\n // the shadowRoot.\n this.renderOptions.renderBefore ??= renderRoot!.firstChild as ChildNode;\n return renderRoot;\n }\n\n /**\n * Updates the element. This method reflects property values to attributes\n * and calls `render` to render DOM via lit-html. Setting properties inside\n * this method will *not* trigger another update.\n * @param changedProperties Map of changed properties with old values\n * @category updates\n */\n protected override update(changedProperties: PropertyValues) {\n // Setting properties in `render` should not trigger an update. Since\n // updates are allowed after super.update, it's important to call `render`\n // before that.\n const value = this.render();\n if (!this.hasUpdated) {\n this.renderOptions.isConnected = this.isConnected;\n }\n super.update(changedProperties);\n this.__childPart = render(value, this.renderRoot, this.renderOptions);\n }\n\n /**\n * Invoked when the component is added to the document's DOM.\n *\n * In `connectedCallback()` you should setup tasks that should only occur when\n * the element is connected to the document. The most common of these is\n * adding event listeners to nodes external to the element, like a keydown\n * event handler added to the window.\n *\n * ```ts\n * connectedCallback() {\n * super.connectedCallback();\n * addEventListener('keydown', this._handleKeydown);\n * }\n * ```\n *\n * Typically, anything done in `connectedCallback()` should be undone when the\n * element is disconnected, in `disconnectedCallback()`.\n *\n * @category lifecycle\n */\n override connectedCallback() {\n super.connectedCallback();\n this.__childPart?.setConnected(true);\n }\n\n /**\n * Invoked when the component is removed from the document's DOM.\n *\n * This callback is the main signal to the element that it may no longer be\n * used. `disconnectedCallback()` should ensure that nothing is holding a\n * reference to the element (such as event listeners added to nodes external\n * to the element), so that it is free to be garbage collected.\n *\n * ```ts\n * disconnectedCallback() {\n * super.disconnectedCallback();\n * window.removeEventListener('keydown', this._handleKeydown);\n * }\n * ```\n *\n * An element may be re-connected after being disconnected.\n *\n * @category lifecycle\n */\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.__childPart?.setConnected(false);\n }\n\n /**\n * Invoked on each update to perform rendering tasks. This method may return\n * any value renderable by lit-html's `ChildPart` - typically a\n * `TemplateResult`. Setting properties inside this method will *not* trigger\n * the element to update.\n * @category rendering\n */\n protected render(): unknown {\n return noChange;\n }\n}\n\n/**\n * Ensure this class is marked as `finalized` as an optimization ensuring\n * it will not needlessly try to `finalize`.\n *\n * Note this property name is a string to prevent breaking Closure JS Compiler\n * optimizations. See @lit/reactive-element for more information.\n */\n(LitElement as unknown as Record<string, unknown>)[\n JSCompiler_renameProperty('finalized', LitElement)\n] = true;\n\n// Install hydration if available\nglobal.litElementHydrateSupport?.({LitElement});\n\n// Apply polyfills if available\nconst polyfillSupport = DEV_MODE\n ? global.litElementPolyfillSupportDevMode\n : global.litElementPolyfillSupport;\npolyfillSupport?.({LitElement});\n\n/**\n * END USERS SHOULD NOT RELY ON THIS OBJECT.\n *\n * Private exports for use by other Lit packages, not intended for use by\n * external users.\n *\n * We currently do not make a mangled rollup build of the lit-ssr code. In order\n * to keep a number of (otherwise private) top-level exports mangled in the\n * client side code, we export a _$LE object containing those members (or\n * helper methods for accessing private fields of those members), and then\n * re-export them for use in lit-ssr. This keeps lit-ssr agnostic to whether the\n * client-side code is being used in `dev` mode or `prod` mode.\n *\n * This has a unique name, to disambiguate it from private exports in\n * lit-html, since this module re-exports all of lit-html.\n *\n * @private\n */\nexport const _$LE = {\n _$attributeToProperty: (\n el: LitElement,\n name: string,\n value: string | null\n ) => {\n // eslint-disable-next-line\n (el as any)._$attributeToProperty(name, value);\n },\n // eslint-disable-next-line\n _$changedProperties: (el: LitElement) => (el as any)._$changedProperties,\n};\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for LitElement usage.\n(global.litElementVersions ??= []).push('4.2.2');\nif (DEV_MODE && global.litElementVersions.length > 1) {\n queueMicrotask(() => {\n issueWarning!(\n 'multiple-versions',\n `Multiple versions of Lit loaded. Loading multiple versions ` +\n `is not recommended.`\n );\n });\n}\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\n\nimport {\n type PropertyDeclaration,\n type ReactiveElement,\n defaultConverter,\n notEqual,\n} from '../reactive-element.js';\nimport type {Interface} from './base.js';\n\nconst DEV_MODE = true;\n\nlet issueWarning: (code: string, warning: string) => void;\n\nif (DEV_MODE) {\n // Ensure warnings are issued only 1x, even if multiple versions of Lit\n // are loaded.\n globalThis.litIssuedWarnings ??= new Set();\n\n /**\n * Issue a warning if we haven't already, based either on `code` or `warning`.\n * Warnings are disabled automatically only by `warning`; disabling via `code`\n * can be done by users.\n */\n issueWarning = (code: string, warning: string) => {\n warning += ` See https://lit.dev/msg/${code} for more information.`;\n if (\n !globalThis.litIssuedWarnings!.has(warning) &&\n !globalThis.litIssuedWarnings!.has(code)\n ) {\n console.warn(warning);\n globalThis.litIssuedWarnings!.add(warning);\n }\n };\n}\n\n// Overloads for property decorator so that TypeScript can infer the correct\n// return type when a decorator is used as an accessor decorator or a setter\n// decorator.\nexport type PropertyDecorator = {\n // accessor decorator signature\n <C extends Interface<ReactiveElement>, V>(\n target: ClassAccessorDecoratorTarget<C, V>,\n context: ClassAccessorDecoratorContext<C, V>\n ): ClassAccessorDecoratorResult<C, V>;\n\n // setter decorator signature\n <C extends Interface<ReactiveElement>, V>(\n target: (value: V) => void,\n context: ClassSetterDecoratorContext<C, V>\n ): (this: C, value: V) => void;\n\n // legacy decorator signature\n (\n protoOrDescriptor: Object,\n name: PropertyKey,\n descriptor?: PropertyDescriptor\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): any;\n};\n\nconst legacyProperty = (\n options: PropertyDeclaration | undefined,\n proto: Object,\n name: PropertyKey\n) => {\n const hasOwnProperty = proto.hasOwnProperty(name);\n (proto.constructor as typeof ReactiveElement).createProperty(name, options);\n // For accessors (which have a descriptor on the prototype) we need to\n // return a descriptor, otherwise TypeScript overwrites the descriptor we\n // define in createProperty() with the original descriptor. We don't do this\n // for fields, which don't have a descriptor, because this could overwrite\n // descriptor defined by other decorators.\n return hasOwnProperty\n ? Object.getOwnPropertyDescriptor(proto, name)\n : undefined;\n};\n\n// This is duplicated from a similar variable in reactive-element.ts, but\n// actually makes sense to have this default defined with the decorator, so\n// that different decorators could have different defaults.\nconst defaultPropertyDeclaration: PropertyDeclaration = {\n attribute: true,\n type: String,\n converter: defaultConverter,\n reflect: false,\n hasChanged: notEqual,\n};\n\n// Temporary type, until google3 is on TypeScript 5.2\ntype StandardPropertyContext<C, V> = (\n | ClassAccessorDecoratorContext<C, V>\n | ClassSetterDecoratorContext<C, V>\n) & {metadata: object};\n\n/**\n * Wraps a class accessor or setter so that `requestUpdate()` is called with the\n * property name and old value when the accessor is set.\n */\nexport const standardProperty = <C extends Interface<ReactiveElement>, V>(\n options: PropertyDeclaration = defaultPropertyDeclaration,\n target: ClassAccessorDecoratorTarget<C, V> | ((value: V) => void),\n context: StandardPropertyContext<C, V>\n): ClassAccessorDecoratorResult<C, V> | ((this: C, value: V) => void) => {\n const {kind, metadata} = context;\n\n if (DEV_MODE && metadata == null) {\n issueWarning(\n 'missing-class-metadata',\n `The class ${target} is missing decorator metadata. This ` +\n `could mean that you're using a compiler that supports decorators ` +\n `but doesn't support decorator metadata, such as TypeScript 5.1. ` +\n `Please update your compiler.`\n );\n }\n\n // Store the property options\n let properties = globalThis.litPropertyMetadata.get(metadata);\n if (properties === undefined) {\n globalThis.litPropertyMetadata.set(metadata, (properties = new Map()));\n }\n if (kind === 'setter') {\n options = Object.create(options);\n options.wrapped = true;\n }\n properties.set(context.name, options);\n\n if (kind === 'accessor') {\n // Standard decorators cannot dynamically modify the class, so we can't\n // replace a field with accessors. The user must use the new `accessor`\n // keyword instead.\n const {name} = context;\n return {\n set(this: ReactiveElement, v: V) {\n const oldValue = (\n target as ClassAccessorDecoratorTarget<C, V>\n ).get.call(this as unknown as C);\n (target as ClassAccessorDecoratorTarget<C, V>).set.call(\n this as unknown as C,\n v\n );\n this.requestUpdate(name, oldValue, options, true, v);\n },\n init(this: ReactiveElement, v: V): V {\n if (v !== undefined) {\n this._$changeProperty(name, undefined, options, v);\n }\n return v;\n },\n } as unknown as ClassAccessorDecoratorResult<C, V>;\n } else if (kind === 'setter') {\n const {name} = context;\n return function (this: ReactiveElement, value: V) {\n const oldValue = this[name as keyof ReactiveElement];\n (target as (value: V) => void).call(this, value);\n this.requestUpdate(name, oldValue, options, true, value);\n } as unknown as (this: C, value: V) => void;\n }\n throw new Error(`Unsupported decorator location: ${kind}`);\n};\n\n/**\n * A class field or accessor decorator which creates a reactive property that\n * reflects a corresponding attribute value. When a decorated property is set\n * the element will update and render. A {@linkcode PropertyDeclaration} may\n * optionally be supplied to configure property features.\n *\n * This decorator should only be used for public fields. As public fields,\n * properties should be considered as primarily settable by element users,\n * either via attribute or the property itself.\n *\n * Generally, properties that are changed by the element should be private or\n * protected fields and should use the {@linkcode state} decorator.\n *\n * However, sometimes element code does need to set a public property. This\n * should typically only be done in response to user interaction, and an event\n * should be fired informing the user; for example, a checkbox sets its\n * `checked` property when clicked and fires a `changed` event. Mutating public\n * properties should typically not be done for non-primitive (object or array)\n * properties. In other cases when an element needs to manage state, a private\n * property decorated via the {@linkcode state} decorator should be used. When\n * needed, state properties can be initialized via public properties to\n * facilitate complex interactions.\n *\n * ```ts\n * class MyElement {\n * @property({ type: Boolean })\n * clicked = false;\n * }\n * ```\n * @category Decorator\n * @ExportDecoratedItems\n */\nexport function property(options?: PropertyDeclaration): PropertyDecorator {\n return <C extends Interface<ReactiveElement>, V>(\n protoOrTarget:\n | object\n | ClassAccessorDecoratorTarget<C, V>\n | ((value: V) => void),\n nameOrContext:\n | PropertyKey\n | ClassAccessorDecoratorContext<C, V>\n | ClassSetterDecoratorContext<C, V>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): any => {\n return (\n typeof nameOrContext === 'object'\n ? standardProperty<C, V>(\n options,\n protoOrTarget as\n | ClassAccessorDecoratorTarget<C, V>\n | ((value: V) => void),\n nameOrContext as StandardPropertyContext<C, V>\n )\n : legacyProperty(\n options,\n protoOrTarget as Object,\n nameOrContext as PropertyKey\n )\n ) as PropertyDecorator;\n };\n}\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\n\nimport {property} from './property.js';\n\nexport interface StateDeclaration<Type = unknown> {\n /**\n * A function that indicates if a property should be considered changed when\n * it is set. The function should take the `newValue` and `oldValue` and\n * return `true` if an update should be requested.\n */\n hasChanged?(value: Type, oldValue: Type): boolean;\n}\n\n/**\n * @deprecated use StateDeclaration\n */\nexport type InternalPropertyDeclaration<Type = unknown> =\n StateDeclaration<Type>;\n\n/**\n * Declares a private or protected reactive property that still triggers\n * updates to the element when it changes. It does not reflect from the\n * corresponding attribute.\n *\n * Properties declared this way must not be used from HTML or HTML templating\n * systems, they're solely for properties internal to the element. These\n * properties may be renamed by optimization tools like closure compiler.\n * @category Decorator\n */\nexport function state(options?: StateDeclaration) {\n return property({\n ...options,\n // Add both `state` and `attribute` because we found a third party\n // controller that is keying off of PropertyOptions.state to determine\n // whether a field is a private internal property or not.\n state: true,\n attribute: false,\n });\n}\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {Disconnectable, Part} from './lit-html.js';\n\nexport {\n AttributePart,\n BooleanAttributePart,\n ChildPart,\n ElementPart,\n EventPart,\n Part,\n PropertyPart,\n} from './lit-html.js';\n\nexport interface DirectiveClass {\n new (part: PartInfo): Directive;\n}\n\n/**\n * This utility type extracts the signature of a directive class's render()\n * method so we can use it for the type of the generated directive function.\n */\nexport type DirectiveParameters<C extends Directive> = Parameters<C['render']>;\n\n/**\n * A generated directive function doesn't evaluate the directive, but just\n * returns a DirectiveResult object that captures the arguments.\n */\nexport interface DirectiveResult<C extends DirectiveClass = DirectiveClass> {\n /**\n * This property needs to remain unminified.\n * @internal\n */\n ['_$litDirective$']: C;\n /** @internal */\n values: DirectiveParameters<InstanceType<C>>;\n}\n\nexport const PartType = {\n ATTRIBUTE: 1,\n CHILD: 2,\n PROPERTY: 3,\n BOOLEAN_ATTRIBUTE: 4,\n EVENT: 5,\n ELEMENT: 6,\n} as const;\n\nexport type PartType = (typeof PartType)[keyof typeof PartType];\n\nexport interface ChildPartInfo {\n readonly type: typeof PartType.CHILD;\n}\n\nexport interface AttributePartInfo {\n readonly type:\n | typeof PartType.ATTRIBUTE\n | typeof PartType.PROPERTY\n | typeof PartType.BOOLEAN_ATTRIBUTE\n | typeof PartType.EVENT;\n readonly strings?: ReadonlyArray<string>;\n readonly name: string;\n readonly tagName: string;\n}\n\nexport interface ElementPartInfo {\n readonly type: typeof PartType.ELEMENT;\n}\n\n/**\n * Information about the part a directive is bound to.\n *\n * This is useful for checking that a directive is attached to a valid part,\n * such as with directive that can only be used on attribute bindings.\n */\nexport type PartInfo = ChildPartInfo | AttributePartInfo | ElementPartInfo;\n\n/**\n * Creates a user-facing directive function from a Directive class. This\n * function has the same parameters as the directive's render() method.\n */\nexport const directive =\n <C extends DirectiveClass>(c: C) =>\n (...values: DirectiveParameters<InstanceType<C>>): DirectiveResult<C> => ({\n // This property needs to remain unminified.\n ['_$litDirective$']: c,\n values,\n });\n\n/**\n * Base class for creating custom directives. Users should extend this class,\n * implement `render` and/or `update`, and then pass their subclass to\n * `directive`.\n */\nexport abstract class Directive implements Disconnectable {\n //@internal\n __part!: Part;\n //@internal\n __attributeIndex: number | undefined;\n //@internal\n __directive?: Directive;\n\n //@internal\n _$parent!: Disconnectable;\n\n // These will only exist on the AsyncDirective subclass\n //@internal\n _$disconnectableChildren?: Set<Disconnectable>;\n // This property needs to remain unminified.\n //@internal\n ['_$notifyDirectiveConnectionChanged']?(isConnected: boolean): void;\n\n constructor(_partInfo: PartInfo) {}\n\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n\n /** @internal */\n _$initialize(\n part: Part,\n parent: Disconnectable,\n attributeIndex: number | undefined\n ) {\n this.__part = part;\n this._$parent = parent;\n this.__attributeIndex = attributeIndex;\n }\n /** @internal */\n _$resolve(part: Part, props: Array<unknown>): unknown {\n return this.update(part, props);\n }\n\n abstract render(...props: Array<unknown>): unknown;\n\n update(_part: Part, props: Array<unknown>): unknown {\n return this.render(...props);\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {AttributePart, noChange} from '../lit-html.js';\nimport {\n directive,\n Directive,\n DirectiveParameters,\n PartInfo,\n PartType,\n} from '../directive.js';\n\n/**\n * A key-value set of CSS properties and values.\n *\n * The key should be either a valid CSS property name string, like\n * `'background-color'`, or a valid JavaScript camel case property name\n * for CSSStyleDeclaration like `backgroundColor`.\n */\nexport interface StyleInfo {\n [name: string]: string | number | undefined | null;\n}\n\nconst important = 'important';\n// The leading space is important\nconst importantFlag = ' !' + important;\n// How many characters to remove from a value, as a negative number\nconst flagTrim = 0 - importantFlag.length;\n\nclass StyleMapDirective extends Directive {\n private _previousStyleProperties?: Set<string>;\n\n constructor(partInfo: PartInfo) {\n super(partInfo);\n if (\n partInfo.type !== PartType.ATTRIBUTE ||\n partInfo.name !== 'style' ||\n (partInfo.strings?.length as number) > 2\n ) {\n throw new Error(\n 'The `styleMap` directive must be used in the `style` attribute ' +\n 'and must be the only part in the attribute.'\n );\n }\n }\n\n render(styleInfo: Readonly<StyleInfo>) {\n return Object.keys(styleInfo).reduce((style, prop) => {\n const value = styleInfo[prop];\n if (value == null) {\n return style;\n }\n // Convert property names from camel-case to dash-case, i.e.:\n // `backgroundColor` -> `background-color`\n // Vendor-prefixed names need an extra `-` appended to front:\n // `webkitAppearance` -> `-webkit-appearance`\n // Exception is any property name containing a dash, including\n // custom properties; we assume these are already dash-cased i.e.:\n // `--my-button-color` --> `--my-button-color`\n prop = prop.includes('-')\n ? prop\n : prop\n .replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, '-$&')\n .toLowerCase();\n return style + `${prop}:${value};`;\n }, '');\n }\n\n override update(part: AttributePart, [styleInfo]: DirectiveParameters<this>) {\n const {style} = part.element as HTMLElement;\n\n if (this._previousStyleProperties === undefined) {\n this._previousStyleProperties = new Set(Object.keys(styleInfo));\n return this.render(styleInfo);\n }\n\n // Remove old properties that no longer exist in styleInfo\n for (const name of this._previousStyleProperties) {\n // If the name isn't in styleInfo or it's null/undefined\n if (styleInfo[name] == null) {\n this._previousStyleProperties!.delete(name);\n if (name.includes('-')) {\n style.removeProperty(name);\n } else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (style as any)[name] = null;\n }\n }\n }\n\n // Add or update properties\n for (const name in styleInfo) {\n const value = styleInfo[name];\n if (value != null) {\n this._previousStyleProperties.add(name);\n const isImportant =\n typeof value === 'string' && value.endsWith(importantFlag);\n if (name.includes('-') || isImportant) {\n style.setProperty(\n name,\n isImportant\n ? (value as string).slice(0, flagTrim)\n : (value as string),\n isImportant ? important : ''\n );\n } else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (style as any)[name] = value;\n }\n }\n }\n return noChange;\n }\n}\n\n/**\n * A directive that applies CSS properties to an element.\n *\n * `styleMap` can only be used in the `style` attribute and must be the only\n * expression in the attribute. It takes the property names in the\n * {@link StyleInfo styleInfo} object and adds the properties to the inline\n * style of the element.\n *\n * Property names with dashes (`-`) are assumed to be valid CSS\n * property names and set on the element's style object using `setProperty()`.\n * Names without dashes are assumed to be camelCased JavaScript property names\n * and set on the element's style object using property assignment, allowing the\n * style object to translate JavaScript-style names to CSS property names.\n *\n * For example `styleMap({backgroundColor: 'red', 'border-top': '5px', '--size':\n * '0'})` sets the `background-color`, `border-top` and `--size` properties.\n *\n * @param styleInfo\n * @see {@link https://lit.dev/docs/templates/directives/#stylemap styleMap code samples on Lit.dev}\n */\nexport const styleMap = directive(StyleMapDirective);\n\n/**\n * The type of the class that powers this directive. Necessary for naming the\n * directive's return type.\n */\nexport type {StyleMapDirective};\n","/**\n * Profile Picture Component - Type Definitions\n * Apple-inspired design system with modern 2025 aesthetics\n */\n\n// ─── Size System (Apple 8pt Grid) ─────────────────────────────────────────────\nexport type Size = \"2xs\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\" | \"3xl\";\n\n// Size presets in pixels (following 8pt grid)\nexport const SIZE_MAP: Record<Size, number> = {\n \"2xs\": 20, // Inline, compact UI\n xs: 24, // Small avatars, lists\n sm: 32, // Default list items\n md: 40, // Navigation, headers\n lg: 48, // Profile sections\n xl: 64, // Profile pages\n \"2xl\": 80, // Hero sections\n \"3xl\": 120, // Profile modals\n};\n\n// ─── Visual Variants ──────────────────────────────────────────────────────────\nexport type Variant = \"circle\" | \"rounded\" | \"squircle\" | \"square\";\n\n// ─── Positioning ──────────────────────────────────────────────────────────────\nexport type Position =\n | \"top-left\"\n | \"top-center\"\n | \"top-right\"\n | \"bottom-left\"\n | \"bottom-center\"\n | \"bottom-right\";\n\n// ─── Loading & Performance ────────────────────────────────────────────────────\nexport type LoadingStrategy = \"lazy\" | \"eager\";\nexport type PlaceholderType =\n | \"shimmer\"\n | \"pulse\"\n | \"blur\"\n | \"skeleton\"\n | \"none\";\n\nexport type FallbackMode = \"initials\" | \"gradient\";\nexport type ImageMode = \"transparent\" | \"original\";\n\n// ─── Presence / Status System ─────────────────────────────────────────────────\nexport type PresenceStatus = \"online\" | \"away\" | \"busy\" | \"offline\" | \"dnd\";\n\nexport interface PresenceConfig {\n /** Current status */\n status: PresenceStatus;\n /** Show animated ring */\n animate?: boolean;\n /** Ring thickness (1-3) */\n thickness?: 1 | 2 | 3;\n}\n\n// Status colors (Apple-inspired)\nexport const PRESENCE_COLORS: Record<PresenceStatus, string> = {\n online: \"#30D158\", // Apple Green\n away: \"#FFD60A\", // Apple Yellow\n busy: \"#FF453A\", // Apple Red\n offline: \"#8E8E93\", // Apple Gray\n dnd: \"#FF453A\", // Apple Red (Do Not Disturb)\n};\n\n// ─── Badge Configuration ──────────────────────────────────────────────────────\nexport interface BadgeConfig {\n /** Badge content (text, number, or empty for dot) */\n content?: string | number;\n /** Position of the badge */\n position?: Position;\n /** Text/icon color */\n color?: string;\n /** Background color */\n bgColor?: string;\n /** Border radius (CSS value, e.g., \"8px\", \"50%\", \"9999px\") */\n borderRadius?: string;\n /** Enable pulse animation */\n pulse?: boolean;\n /** Enable glow effect */\n glow?: boolean;\n /** Max value to display (shows 99+ if exceeded) */\n max?: number;\n /** Icon to display before content (emoji, Unicode symbol, or text) */\n icon?: string;\n}\n\n// ─── Glow Effect ──────────────────────────────────────────────────────────────\nexport interface GlowConfig {\n /** Glow color (defaults to border or bg color) */\n color?: string;\n /** Intensity (0-1) */\n intensity?: number;\n /** Animate the glow */\n animate?: boolean;\n}\n\n// ─── Ring Effect (like Instagram stories) ────────────────────────────────────\nexport interface RingConfig {\n /** Show ring */\n show: boolean;\n /** Ring color or gradient */\n color?: string;\n /** Gradient colors for multi-color ring */\n gradient?: string[];\n /** Ring width */\n width?: number;\n /** Gap between ring and avatar */\n gap?: number;\n /** Animate (rotate for gradient) */\n animate?: boolean;\n /** Progress percentage (0-100) for partial fill ring */\n progress?: number;\n /** Color for unfilled portion when progress is set (defaults to gray) */\n emptyColor?: string;\n}\n\n// ─── Interactive States ───────────────────────────────────────────────────────\nexport interface InteractionConfig {\n /** Enable hover effects */\n hoverable?: boolean;\n /** Enable press/click effects */\n pressable?: boolean;\n /** Show focus ring on focus */\n focusable?: boolean;\n /** Cursor style */\n cursor?: \"pointer\" | \"default\" | \"zoom-in\";\n}\n\n// ─── Shadow Presets ───────────────────────────────────────────────────────────\nexport type ShadowPreset = \"none\" | \"sm\" | \"md\" | \"lg\" | \"glow\";\n\nexport const SHADOW_MAP: Record<ShadowPreset, string> = {\n none: \"none\",\n sm: \"0 1px 2px 0 rgba(0, 0, 0, 0.05)\",\n md: \"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)\",\n lg: \"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)\",\n glow: \"0 0 20px 0 rgba(99, 102, 241, 0.3)\",\n};\n\n// ─── Animation Presets ────────────────────────────────────────────────────────\nexport type AnimationPreset = \"none\" | \"fade\" | \"scale\" | \"slide\" | \"bounce\";\n\n// ─── Default Values ───────────────────────────────────────────────────────────\nexport const DEFAULTS = {\n size: \"md\" as Size,\n variant: \"circle\" as Variant,\n loading: \"lazy\" as LoadingStrategy,\n placeholder: \"shimmer\" as PlaceholderType,\n borderWidth: 2 as const,\n borderColor: \"#ffffff\",\n placeholderColor: \"#f3f4f6\",\n shadow: \"sm\" as ShadowPreset,\n animation: \"fade\" as AnimationPreset,\n imageMode: \"original\" as ImageMode,\n zoom: 1.2,\n} as const;\n\n// ─── CSS Custom Properties (for theming) ──────────────────────────────────────\nexport const CSS_VARS = {\n \"--pp-transition-duration\": \"200ms\",\n \"--pp-transition-timing\": \"cubic-bezier(0.4, 0, 0.2, 1)\",\n \"--pp-spring-timing\": \"cubic-bezier(0.34, 1.56, 0.64, 1)\",\n \"--pp-hover-scale\": \"1.05\",\n \"--pp-press-scale\": \"0.95\",\n \"--pp-focus-ring-color\": \"rgba(99, 102, 241, 0.5)\",\n \"--pp-focus-ring-width\": \"3px\",\n \"--pp-skeleton-base\": \"#e5e7eb\",\n \"--pp-skeleton-shine\": \"#f3f4f6\",\n} as const;\n\n// ─── Border Radius Presets ────────────────────────────────────────────────────\nexport const RADIUS_MAP: Record<Variant, string> = {\n circle: \"9999px\",\n rounded: \"12px\",\n squircle: \"30%\", // iOS app icon style\n square: \"0px\",\n};\n\n// ─── Full Component Props Interface ───────────────────────────────────────────\n/**\n * Base props interface shared across all framework wrappers.\n * This ensures type consistency between React, Vue, Svelte, and Angular.\n */\nexport interface ProfilePictureProps {\n // Core\n /** Image source URL */\n src?: string;\n /** Alt text for accessibility and fallback initials */\n alt?: string;\n /** External customer ID for CDN image loading */\n extCustomerId?: string;\n /** CDN image mode: 'transparent' for transparent background, 'original' for original background */\n imageMode?: ImageMode;\n\n // Sizing\n /** Predefined size or custom pixel value */\n size?: Size | number;\n\n // Visual\n /** Shape variant */\n variant?: Variant;\n /** Shadow preset */\n shadow?: ShadowPreset;\n\n // Border\n /** Enable border */\n border?: boolean;\n /** Border width in pixels */\n borderWidth?: 1 | 2 | 3 | 4 | 5 | 6 | 8;\n /** Border color (CSS color value) */\n borderColor?: string;\n\n // Rotation\n /** Rotation angle in degrees */\n rotation?: number;\n\n // Zoom\n /** Zoom level for the image (default: 1.4). Values > 1 zoom in, keeping the image within the crop zone */\n zoom?: number;\n\n // Background\n /** Background color (CSS color value) */\n bgColor?: string;\n /** Background gradient (CSS gradient value) */\n bgGradient?: string;\n\n // Effects\n /** Glow effect configuration */\n glow?: GlowConfig;\n /** Ring effect configuration (Instagram-style) */\n ring?: RingConfig;\n /** Presence indicator configuration */\n presence?: PresenceConfig;\n\n // Overlays\n /** Badge configuration */\n badge?: BadgeConfig;\n\n // Loading\n /** Loading strategy */\n loading?: LoadingStrategy;\n /** Placeholder type while loading */\n placeholder?: PlaceholderType;\n /** Placeholder background color */\n placeholderColor?: string;\n\n // Fallback\n /** Custom fallback text (overrides initials from alt) */\n fallback?: string;\n /** Fallback display mode: 'initials' shows letters, 'gradient' shows cloudy gradient */\n fallbackMode?: FallbackMode;\n\n // Interaction\n /** Interactive behavior configuration */\n interactive?: InteractionConfig;\n}\n\n// ─── Profile Picture Group Types ─────────────────────────────────────────────\n\n/** Direction for stacking avatars */\nexport type StackDirection = \"ltr\" | \"rtl\";\n\n/** Tooltip position relative to avatar */\nexport type TooltipPosition = \"top\" | \"bottom\" | \"left\" | \"right\";\n\n/** Tooltip configuration */\nexport interface TooltipConfig {\n /** Enable/disable tooltip (default: true) */\n enabled?: boolean;\n /** Position of tooltip relative to avatar */\n position?: TooltipPosition;\n /** Delay before showing tooltip in ms (default: 300) */\n delay?: number;\n}\n\n/** User data extracted from profile-picture elements */\nexport interface GroupUserData {\n /** User ID from data-user-id attribute */\n id?: string;\n /** User name from alt attribute */\n name: string;\n /** Image source URL */\n src?: string;\n /** External customer ID for CDN image loading */\n extCustomerId?: string;\n /** Presence status from data-status attribute */\n status?: PresenceStatus;\n /** Reference to the profile-picture element */\n element: HTMLElement;\n /** Index in the group */\n index: number;\n\n // ─── Profile Picture Props (passed through from slotted elements) ──────────\n /** Visual variant (circle, rounded, squircle, square) */\n variant?: Variant;\n /** Shadow preset */\n shadow?: ShadowPreset;\n /** Show border */\n border?: boolean;\n /** Border width (1-8) */\n borderWidth?: 1 | 2 | 3 | 4 | 5 | 6 | 8;\n /** Border color */\n borderColor?: string;\n /** Background color */\n bgColor?: string;\n /** Background gradient */\n bgGradient?: string;\n /** CDN image mode */\n imageMode?: ImageMode;\n}\n\n/** Dropdown configuration for overflow users */\nexport interface DropdownConfig {\n /** Max height of dropdown in px (default: 280) */\n maxHeight?: number;\n /** Show presence indicator dots (default: true) */\n showPresence?: boolean;\n /** Dropdown position (default: 'bottom') */\n position?: \"bottom\" | \"top\";\n}\n\n/** Profile Picture Group Props */\nexport interface ProfilePictureGroupProps {\n /** Maximum visible avatars before showing counter (default: 4) */\n max?: number;\n /** Stack direction - ltr shows first on left (default: 'ltr') */\n direction?: StackDirection;\n /** Overlap amount as percentage 0-1 (default: 0.3) */\n overlap?: number;\n /** Avatar size - inherited by children (default: 'md') */\n size?: Size | number;\n /** Spacing between avatars in px (overrides overlap calculation) */\n spacing?: number;\n /** Tooltip configuration */\n tooltip?: TooltipConfig;\n /** Dropdown configuration for overflow users */\n dropdown?: DropdownConfig;\n /** Show add button (default: false) */\n showAddButton?: boolean;\n /** Add button label for accessibility */\n addButtonLabel?: string;\n /** Enable hover lift animation (default: true) */\n animated?: boolean;\n}\n\n/** Group component defaults */\nexport const GROUP_DEFAULTS = {\n max: 4,\n direction: \"ltr\" as StackDirection,\n overlap: 0.3,\n size: \"md\" as Size,\n tooltipDelay: 300,\n dropdownMaxHeight: 280,\n animated: true,\n} as const;\n","/**\n * Profile Picture Component - Utility Functions\n * Apple-inspired design system utilities\n */\n\nimport type { Size, Variant } from \"./types\";\nimport { RADIUS_MAP, SIZE_MAP } from \"./types\";\n\n/**\n * Resolve size to pixel value\n */\nexport function resolveSize(size: Size | number): number {\n if (typeof size === \"number\") {\n return size;\n }\n return SIZE_MAP[size] ?? SIZE_MAP.md;\n}\n\n/**\n * Merge class names, filtering out falsy values\n */\nexport function cn(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n\n/**\n * Check if a color value is a hex code\n */\nexport function isHexColor(color: string): boolean {\n return /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(color);\n}\n\n/**\n * Check if a value is a CSS color (not a Tailwind class)\n */\nexport function isCssColor(value: string): boolean {\n if (isHexColor(value)) {\n return true;\n }\n if (/^(rgb|hsl|oklch|oklab|lab|lch)a?\\s*\\(/.test(value)) {\n return true;\n }\n if (value.includes(\"gradient\")) {\n return true;\n }\n const namedColors = [\n \"transparent\",\n \"currentColor\",\n \"inherit\",\n \"white\",\n \"black\",\n ];\n return namedColors.includes(value.toLowerCase());\n}\n\n/**\n * Generate initials from alt text for fallback\n * Apple-style: Single letter for single word, two letters for multiple\n */\nexport function getInitials(text: string): string {\n const cleaned = text.trim().replace(/[^\\w\\s]/g, \"\");\n const words = cleaned.split(/\\s+/).filter(Boolean);\n\n if (words.length === 0) {\n return \"?\";\n }\n if (words.length === 1) {\n return words[0].slice(0, 1).toUpperCase();\n }\n return (words[0][0] + (words.at(-1)?.[0] ?? \"\")).toUpperCase();\n}\n\n/**\n * Get border radius value for variant\n */\nexport function getRadius(variant: Variant): string {\n return RADIUS_MAP[variant];\n}\n\n/**\n * Calculate optimal font size for initials based on container size\n */\nexport function getInitialsFontSize(containerSize: number): number {\n return Math.round(containerSize * 0.38);\n}\n\n/**\n * Calculate badge size relative to avatar size\n * Uses non-linear scaling to maintain visual balance:\n * - XL (64px) is the reference: ~33% ratio looks good\n * - Small avatars: proportionally smaller badges with reasonable minimums\n * - Large avatars: caps prevent oversized badges\n */\nexport function getBadgeSize(\n avatarSize: number,\n hasContent: boolean\n): { size: number; fontSize: number } {\n // Reference: XL (64px) avatar with content badge = 20px (31%)\n // Use diminishing ratio for larger sizes\n let size: number;\n\n if (hasContent) {\n // Badge with content: min 14px, max 24px\n // Scale: 31% ratio but capped\n const scaled = Math.round(avatarSize * 0.31);\n size = Math.min(24, Math.max(14, scaled));\n } else {\n // Dot badge: min 8px, max 14px\n // Scale: 22% ratio but capped\n const scaled = Math.round(avatarSize * 0.22);\n size = Math.min(14, Math.max(8, scaled));\n }\n\n // Font size: 55% of badge for better readability at small sizes\n const fontSize = Math.max(9, Math.round(size * 0.55));\n return { size, fontSize };\n}\n\n/**\n * Calculate presence indicator size\n * Uses capped scaling to maintain visual balance:\n * - Reference: XL (64px) with thickness 2 = 14px (~22%)\n * - Small avatars: min 8px for visibility\n * - Large avatars: max 18px to prevent oversizing\n */\nexport function getPresenceSize(\n avatarSize: number,\n thickness: 1 | 2 | 3\n): number {\n // Base size: 20% ratio, capped between 8-16px\n const baseSize = Math.min(16, Math.max(8, Math.round(avatarSize * 0.2)));\n // Add thickness adjustment (0, 2, or 4 pixels)\n return Math.min(18, baseSize + (thickness - 1) * 2);\n}\n\n/**\n * Format badge content (e.g., 99+ for large numbers)\n */\nexport function formatBadgeContent(\n content: string | number,\n max?: number\n): string {\n if (typeof content === \"string\") {\n return content;\n }\n if (max && content > max) {\n return `${max}+`;\n }\n return content.toString();\n}\n\n/**\n * Generate a gradient from colors array for ring effect\n */\nexport function createConicGradient(colors: string[]): string {\n if (colors.length === 0) {\n return \"transparent\";\n }\n if (colors.length === 1) {\n return colors[0];\n }\n\n const stops = colors.map((color, i) => {\n const start = (i / colors.length) * 360;\n const end = ((i + 1) / colors.length) * 360;\n return `${color} ${start}deg ${end}deg`;\n });\n\n return `conic-gradient(${stops.join(\", \")})`;\n}\n\n/**\n * Get contrast color for text on background\n * Returns white or black based on background luminance\n */\nexport function getContrastColor(bgColor: string): string {\n // Extract RGB values from hex\n if (!isHexColor(bgColor)) {\n return \"#ffffff\";\n }\n\n const hex = bgColor.replace(\"#\", \"\");\n const r = Number.parseInt(hex.slice(0, 2), 16);\n const g = Number.parseInt(hex.slice(2, 4), 16);\n const b = Number.parseInt(hex.slice(4, 6), 16);\n\n // Calculate relative luminance\n const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;\n\n return luminance > 0.5 ? \"#000000\" : \"#ffffff\";\n}\n\n/**\n * Clamp a number between min and max\n */\nexport function clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max);\n}\n\n/**\n * Generate a stable hash from string for consistent random colors\n */\nexport function hashString(str: string): number {\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n const char = str.charCodeAt(i);\n hash = (hash << 5) - hash + char;\n hash &= hash;\n }\n return Math.abs(hash);\n}\n\n/**\n * Create a progress ring gradient using conic gradient\n * @param progress Progress percentage (0-100)\n * @param filledColor Color for filled portion\n * @param emptyColor Color for empty portion\n * @returns CSS conic gradient string\n */\nexport function createProgressRingGradient(\n progress: number,\n filledColor: string,\n emptyColor: string\n): string {\n // Clamp progress to 0-100\n const clampedProgress = Math.max(0, Math.min(100, progress));\n // Convert percentage to degrees (start from top, go clockwise)\n // 0% = 0deg (top), 100% = 360deg (full circle)\n const progressDeg = (clampedProgress / 100) * 360;\n // Create conic gradient starting from top (270deg offset to start at 12 o'clock)\n // Then go clockwise: filled color from 0% to progress%, empty color from progress% to 100%\n return `conic-gradient(from 270deg, ${filledColor} 0deg ${progressDeg}deg, ${emptyColor} ${progressDeg}deg 360deg)`;\n}\n\n/**\n * Generate a gradient from name for fallback backgrounds\n */\nexport function generateAvatarGradient(name: string): string {\n const gradients = [\n \"linear-gradient(135deg, #667eea 0%, #764ba2 100%)\",\n \"linear-gradient(135deg, #f093fb 0%, #f5576c 100%)\",\n \"linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)\",\n \"linear-gradient(135deg, #43e97b 0%, #38f9d7 100%)\",\n \"linear-gradient(135deg, #fa709a 0%, #fee140 100%)\",\n \"linear-gradient(135deg, #a8edea 0%, #fed6e3 100%)\",\n \"linear-gradient(135deg, #d299c2 0%, #fef9d7 100%)\",\n \"linear-gradient(135deg, #89f7fe 0%, #66a6ff 100%)\",\n \"linear-gradient(135deg, #cd9cf2 0%, #f6f3ff 100%)\",\n \"linear-gradient(135deg, #fddb92 0%, #d1fdff 100%)\",\n ];\n\n const index = hashString(name) % gradients.length;\n return gradients[index];\n}\n\n/**\n * Curated 3-color pastel palettes for cloudy gradient fallback.\n * Each palette creates an organic, watercolor-like effect when\n * layered as overlapping radial gradients.\n */\nexport const CLOUDY_PALETTES: [string, string, string][] = [\n [\"#f4a261\", \"#e76f51\", \"#d4a5a5\"], // Warm sunset\n [\"#f2a9b0\", \"#e07a5f\", \"#d4c4a8\"], // Soft coral rose\n [\"#c9b1d0\", \"#e8a0bf\", \"#f0d1ce\"], // Dusty mauve\n [\"#89c2d9\", \"#a3c4bc\", \"#d5c6e0\"], // Ocean mist\n [\"#f7c59f\", \"#f2a07b\", \"#efcfe3\"], // Warm peach\n [\"#b5a7d5\", \"#d4a5c9\", \"#f0c3d7\"], // Lavender dream\n [\"#7ec8c8\", \"#6a9fb5\", \"#c2b5d6\"], // Cool teal\n [\"#f0b3ba\", \"#d4a5c9\", \"#c9d1d9\"], // Blush pink\n [\"#e8b960\", \"#d4956a\", \"#c9a5b8\"], // Amber cloud\n [\"#a7c4a0\", \"#c9d4a5\", \"#e0c9b1\"], // Sage pastel\n [\"#c4819b\", \"#d9a5b8\", \"#b5aed4\"], // Berry soft\n [\"#f0c27f\", \"#e0a87c\", \"#d4b5c9\"], // Golden hour\n];\n\n/**\n * Generate a cloudy, organic multi-layer radial gradient from a seed string.\n * Uses 3 overlapping radial-gradient layers with soft edges.\n * Deterministic: same seed always produces the same gradient.\n */\nexport function generateCloudyGradient(seed: string): string {\n const hash = hashString(seed);\n const palette = CLOUDY_PALETTES[hash % CLOUDY_PALETTES.length];\n\n // Derive unique positions from hash variations\n const h2 = hashString(seed + \"pos1\");\n const h3 = hashString(seed + \"pos2\");\n\n // Positions range from 20-80% to keep blobs within bounds\n const x1 = 20 + (hash % 61);\n const y1 = 20 + ((hash >> 4) % 61);\n const x2 = 20 + (h2 % 61);\n const y2 = 20 + ((h2 >> 4) % 61);\n const x3 = 20 + (h3 % 61);\n const y3 = 20 + ((h3 >> 4) % 61);\n\n return [\n `radial-gradient(circle at ${x1}% ${y1}%, ${palette[0]} 0%, transparent 70%)`,\n `radial-gradient(circle at ${x2}% ${y2}%, ${palette[1]} 0%, transparent 70%)`,\n `radial-gradient(circle at ${x3}% ${y3}%, ${palette[2]} 0%, transparent 70%)`,\n ].join(\", \");\n}\n\n/**\n * Apply will-change optimization for animations\n */\nexport function getWillChangeProperty(\n hasAnimation: boolean,\n hasHover: boolean\n): string | undefined {\n if (!(hasAnimation || hasHover)) {\n return undefined;\n }\n const properties: string[] = [];\n if (hasAnimation) {\n properties.push(\"opacity\");\n }\n if (hasHover) {\n properties.push(\"transform\");\n }\n return properties.join(\", \");\n}\n\n/**\n * Check if user prefers reduced motion\n */\nexport function prefersReducedMotion(): boolean {\n if (typeof window === \"undefined\") {\n return false;\n }\n return window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n}\n\n// ─── Profile Picture Group Utilities ─────────────────────────────────────────\n\nimport type { GroupUserData, PresenceStatus, StackDirection } from \"./types\";\nimport { GROUP_DEFAULTS } from \"./types\";\n\n/**\n * Calculate the pixel size for group avatars\n */\nexport function getGroupAvatarSize(size: Size | number): number {\n if (typeof size === \"number\") {\n return size;\n }\n return SIZE_MAP[size] ?? SIZE_MAP[GROUP_DEFAULTS.size];\n}\n\n/**\n * Calculate visible and hidden avatar counts\n */\nexport function calculateAvatarCounts(\n total: number,\n max: number,\n showAddButton: boolean\n): { visible: number; hidden: number; showCounter: boolean } {\n const effectiveMax = showAddButton ? max - 1 : max;\n\n if (total <= effectiveMax) {\n return { visible: total, hidden: 0, showCounter: false };\n }\n\n // Show (max - 1) avatars + counter\n const visible = effectiveMax - 1;\n const hidden = total - visible;\n return { visible, hidden, showCounter: true };\n}\n\n/**\n * Calculate position offset for stacked avatars\n */\nexport function calculateStackPosition(\n index: number,\n avatarSize: number,\n overlap: number,\n _direction: StackDirection,\n spacing?: number\n): number {\n const step = spacing ?? avatarSize * (1 - overlap);\n const offset = index * step;\n\n // For RTL, we need to reverse the positioning\n // This is handled at the component level by reversing the order\n return offset;\n}\n\n/**\n * Calculate z-index for stacked avatars\n * First avatar (index 0) has highest z-index to appear on top\n */\nexport function calculateStackZIndex(\n index: number,\n total: number,\n direction: StackDirection\n): number {\n if (direction === \"ltr\") {\n // LTR: First item on top (highest z-index)\n return total - index;\n }\n // RTL: Last item on top\n return index + 1;\n}\n\n/**\n * Calculate the total width of the stacked group\n */\nexport function calculateGroupWidth(\n count: number,\n avatarSize: number,\n overlap: number,\n spacing?: number\n): number {\n if (count === 0) {\n return 0;\n }\n if (count === 1) {\n return avatarSize;\n }\n\n const step = spacing ?? avatarSize * (1 - overlap);\n return avatarSize + step * (count - 1);\n}\n\n/**\n * Extract user data from a profile-picture element\n */\nexport function extractUserData(\n element: HTMLElement,\n index: number\n): GroupUserData {\n return {\n id: element.getAttribute(\"data-user-id\") ?? undefined,\n name: element.getAttribute(\"alt\") ?? `User ${index + 1}`,\n src: element.getAttribute(\"src\") ?? undefined,\n status:\n (element.getAttribute(\"data-status\") as PresenceStatus) ?? undefined,\n element,\n index,\n };\n}\n\n/**\n * Extract all user data from child profile-picture elements\n */\nexport function extractAllUserData(container: HTMLElement): GroupUserData[] {\n const children = container.querySelectorAll(\"profile-picture\");\n return Array.from(children).map((el, index) =>\n extractUserData(el as HTMLElement, index)\n );\n}\n\n/**\n * Get initials for counter display (e.g., \"+5\")\n */\nexport function formatCounterText(count: number): string {\n if (count > 99) {\n return \"+99\";\n }\n return `+${count}`;\n}\n\n/**\n * Calculate tooltip position relative to avatar\n */\nexport function calculateTooltipPosition(\n avatarRect: DOMRect,\n tooltipWidth: number,\n tooltipHeight: number,\n position: \"top\" | \"bottom\" | \"left\" | \"right\" = \"top\",\n gap = 8\n): { top: number; left: number } {\n const { top, left, width, height } = avatarRect;\n const centerX = left + width / 2;\n const centerY = top + height / 2;\n\n switch (position) {\n case \"top\":\n return {\n top: top - tooltipHeight - gap,\n left: centerX - tooltipWidth / 2,\n };\n case \"bottom\":\n return {\n top: top + height + gap,\n left: centerX - tooltipWidth / 2,\n };\n case \"left\":\n return {\n top: centerY - tooltipHeight / 2,\n left: left - tooltipWidth - gap,\n };\n case \"right\":\n return {\n top: centerY - tooltipHeight / 2,\n left: left + width + gap,\n };\n }\n}\n\n/**\n * Clamp tooltip position within viewport\n */\nexport function clampTooltipPosition(\n position: { top: number; left: number },\n tooltipWidth: number,\n tooltipHeight: number,\n padding = 8\n): { top: number; left: number } {\n const viewport = {\n width: typeof window !== \"undefined\" ? window.innerWidth : 1920,\n height: typeof window !== \"undefined\" ? window.innerHeight : 1080,\n };\n\n return {\n top: clamp(\n position.top,\n padding,\n viewport.height - tooltipHeight - padding\n ),\n left: clamp(\n position.left,\n padding,\n viewport.width - tooltipWidth - padding\n ),\n };\n}\n\n/**\n * Get CDN size label from pixel size (rounds up to next available size)\n * CDN sizes: 80, 120, 240, 480, 960\n */\nexport function getCdnSizeLabel(\n pixelSize: number\n): \"80\" | \"120\" | \"240\" | \"480\" | \"960\" {\n if (pixelSize <= 80) {\n return \"120\";\n }\n if (pixelSize <= 120) {\n return \"240\";\n }\n if (pixelSize <= 240) {\n return \"480\";\n }\n if (pixelSize <= 480) {\n return \"960\";\n }\n return \"960\";\n}\n\n/**\n * Construct CDN URL for profile picture\n * Format: {baseUrl}/api/profile-picture/cdn/{extId}_{size}_{imageMode}.webp?hostname={hostname}\n * @param imageMode - \"transparent\" for transparent background, \"original\" for original background\n */\nexport function constructCdnUrl(\n baseUrl: string,\n extCustomerId: string,\n sizeLabel: \"80\" | \"120\" | \"240\" | \"480\" | \"960\",\n imageMode: \"transparent\" | \"original\",\n hostname: string\n): string {\n // Remove trailing slash from baseUrl\n const cleanBaseUrl = baseUrl.endsWith(\"/\") ? baseUrl.slice(0, -1) : baseUrl;\n\n // Construct filename: {extId}_{size}_{imageMode}.webp\n const filename = `${extCustomerId}_${sizeLabel}_${imageMode}.webp`;\n\n // Construct full URL with hostname query parameter\n return `${cleanBaseUrl}/api/profile-picture/cdn/${filename}?hostname=${hostname}`;\n}\n","/**\n * Profile Picture Component - Styles & Animations\n * Apple-inspired design system with modern 2025 aesthetics\n */\n\nimport type { ShadowPreset, Variant } from \"./types\";\nimport { RADIUS_MAP, SHADOW_MAP } from \"./types\";\nimport { isHexColor } from \"./utils\";\n\n/**\n * Get variant-specific border radius styles\n */\nexport function getVariantStyles(variant: Variant): Record<string, string> {\n return { borderRadius: RADIUS_MAP[variant] };\n}\n\n/**\n * Get variant classes (Tailwind)\n */\nexport function getVariantClasses(variant: Variant): string {\n const variants: Record<Variant, string> = {\n circle: \"np:rounded-full\",\n rounded: \"np:rounded-xl\",\n squircle: \"np:rounded-[30%]\",\n square: \"np:rounded-none\",\n };\n return variants[variant];\n}\n\n/**\n * Get border styles\n */\nexport function getBorderClasses(\n width: 1 | 2 | 3 | 4 | 5 | 6 | 8,\n color: string\n): { className: string; style: Record<string, string> } {\n const widthClasses: Record<1 | 2 | 3 | 4 | 5 | 6 | 8, string> = {\n 1: \"np:border\",\n 2: \"np:border-2\",\n 3: \"np:border-[3px]\",\n 4: \"np:border-4\",\n 5: \"np:border-[5px]\",\n 6: \"np:border-[6px]\",\n 8: \"np:border-8\",\n };\n\n return {\n className: widthClasses[width],\n style: {\n borderColor: color,\n borderStyle: \"solid\",\n },\n };\n}\n\n/**\n * Get background styles (solid color or gradient)\n */\nexport function getBackgroundStyles(\n bgColor?: string,\n bgGradient?: string\n): { className: string; style?: Record<string, string> } {\n if (bgGradient) {\n return {\n className: \"\",\n style: { background: bgGradient },\n };\n }\n\n if (bgColor) {\n if (bgColor.includes(\"gradient\")) {\n return {\n className: \"\",\n style: { background: bgColor },\n };\n }\n return {\n className: \"\",\n style: { backgroundColor: bgColor },\n };\n }\n\n return { className: \"\", style: { backgroundColor: \"transparent\" } };\n}\n\n/**\n * Get shadow styles\n */\nexport function getShadowStyles(shadow: ShadowPreset): Record<string, string> {\n return { boxShadow: SHADOW_MAP[shadow] };\n}\n\n/**\n * CSS Keyframe animations - Apple-inspired, physics-based\n */\nexport const keyframes = {\n // Shimmer loading effect\n shimmer: `\n@keyframes pp-shimmer {\n 0% { transform: translateX(-100%); }\n 100% { transform: translateX(100%); }\n}`,\n\n // Pulse animation (gentle breathe effect)\n pulse: `\n@keyframes pp-pulse {\n 0%, 100% { opacity: 1; transform: scale(1); }\n 50% { opacity: 0.7; transform: scale(0.98); }\n}`,\n\n // Skeleton loading pulse\n skeleton: `\n@keyframes pp-skeleton {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.5; }\n}`,\n\n // Badge bounce entrance\n badgeBounce: `\n@keyframes pp-badge-bounce {\n 0% { transform: scale(0) translateY(10px); opacity: 0; }\n 50% { transform: scale(1.2) translateY(-2px); }\n 100% { transform: scale(1) translateY(0); opacity: 1; }\n}`,\n\n // Ring rotation (for gradient rings)\n ringRotate: `\n@keyframes pp-ring-rotate {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n}`,\n\n // Presence indicator pulse\n presencePulse: `\n@keyframes pp-presence-pulse {\n 0%, 100% { box-shadow: 0 0 0 0 currentColor; }\n 50% { box-shadow: 0 0 0 4px transparent; }\n}`,\n\n // Glow animation\n glow: `\n@keyframes pp-glow {\n 0%, 100% { box-shadow: 0 0 20px 0 var(--pp-glow-color, rgba(99, 102, 241, 0.3)); }\n 50% { box-shadow: 0 0 30px 5px var(--pp-glow-color, rgba(99, 102, 241, 0.5)); }\n}`,\n\n // Fade in\n fadeIn: `\n@keyframes pp-fade-in {\n from { opacity: 0; }\n to { opacity: 1; }\n}`,\n\n // Scale in (spring-like)\n scaleIn: `\n@keyframes pp-scale-in {\n 0% { transform: scale(0.8); opacity: 0; }\n 50% { transform: scale(1.05); }\n 100% { transform: scale(1); opacity: 1; }\n}`,\n};\n\n/**\n * All keyframes combined for injection\n */\nexport const allKeyframes = Object.values(keyframes).join(\"\\n\");\n\n/**\n * Component base styles\n */\nexport const baseStyles = `\n/* Profile Picture Component Styles */\n.pp-container {\n --pp-transition-duration: 200ms;\n --pp-transition-timing: cubic-bezier(0.4, 0, 0.2, 1);\n --pp-spring-timing: cubic-bezier(0.34, 1.56, 0.64, 1);\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n user-select: none;\n -webkit-user-select: none;\n flex-shrink: 0;\n}\n\n/* Inner container for image clipping - allows badges/rings to overflow */\n/* Background is applied here (not on container) to prevent sub-pixel bleed-through */\n.pp-inner {\n position: absolute;\n inset: 0;\n overflow: hidden;\n border-radius: inherit;\n}\n\n/* Interactive states */\n.pp-interactive {\n cursor: pointer;\n transition: transform var(--pp-transition-duration) var(--pp-spring-timing),\n box-shadow var(--pp-transition-duration) var(--pp-transition-timing);\n}\n\n.pp-interactive:hover {\n transform: scale(1.05);\n}\n\n.pp-interactive:active {\n transform: scale(0.95);\n}\n\n.pp-interactive:focus-visible {\n outline: none;\n box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.5);\n}\n\n/* Image styles */\n.pp-image {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n object-fit: cover;\n transition: opacity var(--pp-transition-duration) var(--pp-transition-timing);\n}\n\n.pp-image-loading {\n opacity: 0;\n}\n\n.pp-image-loaded {\n opacity: 1;\n}\n\n/* Fallback styles */\n.pp-fallback {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n font-weight: 500;\n color: rgba(255, 255, 255, 0.9);\n text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);\n font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;\n letter-spacing: 0.02em;\n}\n\n.pp-fallback-icon {\n color: rgba(156, 163, 175, 0.8);\n}\n\n/* Shimmer placeholder */\n.pp-shimmer {\n position: absolute;\n inset: 0;\n overflow: hidden;\n}\n\n.pp-shimmer::after {\n content: '';\n position: absolute;\n inset: 0;\n background: linear-gradient(\n 90deg,\n transparent 0%,\n rgba(255, 255, 255, 0.4) 50%,\n transparent 100%\n );\n animation: pp-shimmer 1.5s infinite;\n}\n\n/* Pulse placeholder */\n.pp-pulse {\n animation: pp-pulse 2s ease-in-out infinite;\n}\n\n/* Skeleton placeholder */\n.pp-skeleton {\n background: linear-gradient(90deg, #e5e7eb 0%, #f3f4f6 50%, #e5e7eb 100%);\n background-size: 200% 100%;\n animation: pp-skeleton 1.5s ease-in-out infinite;\n}\n\n/* Badge styles */\n.pp-badge {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n font-weight: 600;\n font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;\n line-height: 1;\n animation: pp-badge-bounce 0.4s var(--pp-spring-timing);\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);\n}\n\n.pp-badge-with-icon {\n gap: 4px;\n}\n\n.pp-badge-icon {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n line-height: 1;\n flex-shrink: 0;\n}\n\n.pp-badge-pulse {\n animation: pp-badge-bounce 0.4s var(--pp-spring-timing),\n pp-presence-pulse 2s ease-in-out infinite 0.4s;\n}\n\n.pp-badge-glow {\n box-shadow: 0 0 10px 2px var(--pp-badge-glow-color, currentColor);\n}\n\n/* Ring effect (Instagram-style) */\n.pp-ring {\n position: absolute;\n inset: -4px;\n border-radius: inherit;\n padding: 3px;\n background: var(--pp-ring-color, linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888));\n -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);\n mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);\n -webkit-mask-composite: xor;\n mask-composite: exclude;\n transition: background 0.3s ease;\n}\n\n.pp-ring-animated {\n animation: pp-ring-rotate 3s linear infinite;\n}\n\n.pp-ring-progress {\n /* Progress rings should not animate rotation */\n animation: none;\n}\n\n/* Presence indicator */\n.pp-presence {\n position: absolute;\n bottom: 0;\n right: 0;\n border-radius: 9999px;\n border: 2px solid white;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);\n}\n\n.pp-presence-animated {\n animation: pp-presence-pulse 2s ease-in-out infinite;\n}\n\n/* Glow effect */\n.pp-glow {\n animation: pp-glow 2s ease-in-out infinite;\n}\n\n/* Reduced motion support */\n@media (prefers-reduced-motion: reduce) {\n .pp-container,\n .pp-interactive,\n .pp-image,\n .pp-shimmer::after,\n .pp-pulse,\n .pp-skeleton,\n .pp-badge,\n .pp-ring-animated,\n .pp-presence-animated,\n .pp-glow {\n animation: none !important;\n transition: none !important;\n }\n}\n`;\n\n/**\n * All styles combined (keyframes + base styles)\n */\nexport const componentStyles = `${allKeyframes}\\n${baseStyles}`;\n\n/**\n * Shimmer styles for inline injection (legacy support)\n */\nexport const shimmerStyles = `\n@keyframes np-shimmer {\n 0% { background-position: -200% 0; }\n 100% { background-position: 200% 0; }\n}\n.np-shimmer {\n background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.4) 50%, transparent 100%);\n background-size: 200% 100%;\n animation: np-shimmer 1.5s infinite;\n}\n`;\n\n/**\n * Generate glow shadow with custom color\n */\nexport function getGlowShadow(color: string, intensity = 0.3): string {\n if (isHexColor(color)) {\n // Convert hex to rgba\n const r = Number.parseInt(color.slice(1, 3), 16);\n const g = Number.parseInt(color.slice(3, 5), 16);\n const b = Number.parseInt(color.slice(5, 7), 16);\n return `0 0 20px 0 rgba(${r}, ${g}, ${b}, ${intensity})`;\n }\n return `0 0 20px 0 ${color}`;\n}\n\n/**\n * Get shimmer classes (legacy)\n */\nexport function getShimmerClasses(): string {\n return \"np-shimmer\";\n}\n\n// ─── Profile Picture Group Styles ────────────────────────────────────────────\n\n/**\n * Group component keyframe animations\n */\nexport const groupKeyframes = `\n@keyframes ppg-tooltip-in {\n from {\n opacity: 0;\n transform: translateX(-50%) translateY(4px) scale(0.96);\n }\n to {\n opacity: 1;\n transform: translateX(-50%) translateY(0) scale(1);\n }\n}\n\n@keyframes ppg-dropdown-in {\n from {\n opacity: 0;\n transform: translateY(-6px) scale(0.95);\n }\n to {\n opacity: 1;\n transform: translateY(0) scale(1);\n }\n}\n\n@keyframes ppg-avatar-lift {\n from {\n transform: translateY(0) scale(1);\n }\n to {\n transform: translateY(-4px) scale(1.08);\n }\n}\n\n@keyframes ppg-modal-in {\n from {\n opacity: 0;\n transform: translate(-50%, -50%) scale(0.9);\n }\n to {\n opacity: 1;\n transform: translate(-50%, -50%) scale(1);\n }\n}\n\n@keyframes ppg-backdrop-in {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n`;\n\n/**\n * Group component base styles - Apple-inspired\n */\nexport const groupBaseStyles = `\n/* Profile Picture Group Container */\n.ppg-container {\n --ppg-transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);\n --ppg-spring: 300ms cubic-bezier(0.34, 1.56, 0.64, 1);\n --ppg-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);\n --ppg-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);\n --ppg-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);\n --ppg-radius: 12px;\n --ppg-counter-bg: #f5f5f7;\n --ppg-counter-text: #1d1d1f;\n --ppg-add-bg: #f5f5f7;\n --ppg-add-hover: #e8e8ed;\n --ppg-add-icon: #86868b;\n --ppg-border: rgba(0, 0, 0, 0.08);\n --ppg-tooltip-bg: rgba(29, 29, 31, 0.95);\n --ppg-tooltip-text: #ffffff;\n --ppg-dropdown-bg: #ffffff;\n --ppg-dropdown-hover: #f5f5f7;\n\n position: relative;\n display: inline-flex;\n align-items: center;\n isolation: isolate;\n}\n\n/* Avatar wrapper for positioning */\n.ppg-avatar-wrapper {\n position: absolute;\n top: 0;\n transition: transform var(--ppg-spring), z-index 0s;\n cursor: pointer;\n border-radius: 9999px;\n}\n\n.ppg-avatar-wrapper:focus-visible {\n outline: none;\n box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.4);\n}\n\n/* Hover lift animation */\n.ppg-animated .ppg-avatar-wrapper:hover {\n z-index: 100 !important;\n animation: ppg-avatar-lift var(--ppg-spring) forwards;\n}\n\n.ppg-avatar-wrapper:hover {\n z-index: 100 !important;\n}\n\n/* Nested profile-picture styling */\n.ppg-avatar-wrapper profile-picture {\n display: block;\n width: 100%;\n height: 100%;\n border-radius: inherit;\n}\n\n/* Counter button */\n.ppg-counter {\n position: absolute;\n top: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 9999px;\n background: var(--ppg-counter-bg);\n color: var(--ppg-counter-text);\n font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;\n font-weight: 600;\n font-size: 13px;\n letter-spacing: -0.01em;\n cursor: pointer;\n border: none;\n box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.95), var(--ppg-shadow-sm);\n transition: transform var(--ppg-spring), background-color var(--ppg-transition);\n user-select: none;\n -webkit-user-select: none;\n}\n\n.ppg-counter:hover {\n background: #ebebed;\n transform: scale(1.05);\n}\n\n.ppg-counter:active {\n transform: scale(0.98);\n}\n\n.ppg-counter:focus-visible {\n outline: none;\n box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.95), 0 0 0 4px rgba(0, 122, 255, 0.4);\n}\n\n/* Add button */\n.ppg-add-button {\n position: absolute;\n top: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 9999px;\n background: var(--ppg-add-bg);\n border: 2px dashed var(--ppg-border);\n cursor: pointer;\n transition: all var(--ppg-spring);\n box-shadow: var(--ppg-shadow-sm);\n}\n\n.ppg-add-button:hover {\n background: var(--ppg-add-hover);\n border-color: rgba(0, 0, 0, 0.15);\n transform: scale(1.05);\n}\n\n.ppg-add-button:active {\n transform: scale(0.98);\n}\n\n.ppg-add-button:focus-visible {\n outline: none;\n box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.4);\n}\n\n.ppg-add-icon {\n color: var(--ppg-add-icon);\n transition: color var(--ppg-transition);\n}\n\n.ppg-add-button:hover .ppg-add-icon {\n color: #1d1d1f;\n}\n\n/* Tooltip */\n.ppg-tooltip {\n position: absolute;\n z-index: 9999;\n padding: 6px 12px;\n background: var(--ppg-tooltip-bg);\n color: var(--ppg-tooltip-text);\n font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;\n font-size: 13px;\n font-weight: 500;\n border-radius: 8px;\n box-shadow: var(--ppg-shadow-lg);\n pointer-events: none;\n white-space: nowrap;\n transform: translateX(-50%);\n animation: ppg-tooltip-in 150ms ease-out forwards;\n backdrop-filter: blur(20px);\n -webkit-backdrop-filter: blur(20px);\n}\n\n.ppg-tooltip::after {\n content: '';\n position: absolute;\n width: 8px;\n height: 8px;\n background: inherit;\n transform: rotate(45deg);\n}\n\n.ppg-tooltip[data-position=\"top\"]::after {\n bottom: -4px;\n left: 50%;\n margin-left: -4px;\n}\n\n.ppg-tooltip[data-position=\"bottom\"]::after {\n top: -4px;\n left: 50%;\n margin-left: -4px;\n}\n\n/* Dropdown */\n.ppg-dropdown {\n position: absolute;\n z-index: 9998;\n right: 0;\n min-width: 220px;\n max-width: 300px;\n background: var(--ppg-dropdown-bg);\n border-radius: 14px;\n box-shadow:\n 0 4px 24px rgba(0, 0, 0, 0.12),\n 0 1px 4px rgba(0, 0, 0, 0.08),\n 0 0 0 1px var(--ppg-border);\n overflow: hidden;\n animation: ppg-dropdown-in 200ms cubic-bezier(0.32, 0.72, 0, 1) forwards;\n transform-origin: top right;\n backdrop-filter: blur(20px);\n -webkit-backdrop-filter: blur(20px);\n}\n\n.ppg-dropdown[data-position=\"bottom\"] {\n top: calc(100% + 10px);\n}\n\n.ppg-dropdown[data-position=\"top\"] {\n bottom: calc(100% + 10px);\n transform-origin: bottom right;\n}\n\n/* Modal style for mobile */\n.ppg-dropdown[data-position=\"modal\"] {\n transform-origin: center center;\n animation: ppg-modal-in 250ms cubic-bezier(0.32, 0.72, 0, 1) forwards;\n border-radius: 20px;\n}\n\n.ppg-backdrop-visible {\n background: rgba(0, 0, 0, 0.4);\n animation: ppg-backdrop-in 200ms ease-out forwards;\n}\n\n.ppg-dropdown-header {\n padding: 14px 16px 10px;\n font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;\n font-size: 11px;\n font-weight: 600;\n color: #86868b;\n text-transform: uppercase;\n letter-spacing: 0.06em;\n background: linear-gradient(to bottom, rgba(0,0,0,0.02), transparent);\n}\n\n.ppg-dropdown-list {\n overflow-y: auto;\n padding: 6px;\n scrollbar-width: thin;\n scrollbar-color: rgba(0,0,0,0.2) transparent;\n}\n\n.ppg-dropdown-list::-webkit-scrollbar {\n width: 6px;\n}\n\n.ppg-dropdown-list::-webkit-scrollbar-track {\n background: transparent;\n}\n\n.ppg-dropdown-list::-webkit-scrollbar-thumb {\n background: rgba(0,0,0,0.15);\n border-radius: 3px;\n}\n\n.ppg-dropdown-item {\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 10px 12px;\n cursor: pointer;\n border-radius: 10px;\n transition: all 150ms ease;\n margin: 2px 0;\n}\n\n.ppg-dropdown-item:hover {\n background: var(--ppg-dropdown-hover);\n transform: translateX(2px);\n}\n\n.ppg-dropdown-item:focus-visible {\n outline: none;\n background: var(--ppg-dropdown-hover);\n box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.4);\n}\n\n.ppg-dropdown-item:active {\n transform: scale(0.98);\n}\n\n.ppg-dropdown-avatar {\n flex-shrink: 0;\n width: 36px;\n height: 36px;\n border-radius: 9999px;\n object-fit: cover;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);\n border: 2px solid rgba(255, 255, 255, 0.8);\n}\n\n.ppg-dropdown-avatar-fallback {\n flex-shrink: 0;\n width: 36px;\n height: 36px;\n border-radius: 9999px;\n display: flex;\n align-items: center;\n justify-content: center;\n font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif;\n font-size: 13px;\n font-weight: 600;\n color: white;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\n border: 2px solid rgba(255, 255, 255, 0.3);\n}\n\n.ppg-dropdown-info {\n flex: 1;\n min-width: 0;\n padding-right: 4px;\n text-align: left;\n}\n\n.ppg-dropdown-name {\n font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;\n font-size: 14px;\n font-weight: 500;\n color: #1d1d1f;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n line-height: 1.3;\n text-align: left;\n}\n\n.ppg-dropdown-status {\n display: flex;\n align-items: center;\n gap: 5px;\n font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;\n font-size: 12px;\n color: #86868b;\n margin-top: 2px;\n line-height: 1.2;\n}\n\n.ppg-dropdown-presence {\n width: 7px;\n height: 7px;\n border-radius: 9999px;\n flex-shrink: 0;\n box-shadow: 0 0 0 1.5px var(--ppg-dropdown-bg);\n}\n\n.ppg-dropdown-presence[data-status=\"online\"] {\n background: #30D158;\n box-shadow: 0 0 0 1.5px var(--ppg-dropdown-bg), 0 0 6px rgba(48, 209, 88, 0.5);\n}\n\n.ppg-dropdown-presence[data-status=\"away\"] {\n background: #FFD60A;\n}\n\n.ppg-dropdown-presence[data-status=\"busy\"],\n.ppg-dropdown-presence[data-status=\"dnd\"] {\n background: #FF453A;\n}\n\n.ppg-dropdown-presence[data-status=\"offline\"] {\n background: #8E8E93;\n}\n\n/* Backdrop for dropdown */\n.ppg-backdrop {\n position: fixed;\n inset: 0;\n z-index: 9997;\n}\n\n/* Reduced motion */\n@media (prefers-reduced-motion: reduce) {\n .ppg-container,\n .ppg-avatar-wrapper,\n .ppg-counter,\n .ppg-add-button,\n .ppg-tooltip,\n .ppg-dropdown {\n animation: none !important;\n transition: none !important;\n }\n\n .ppg-animated .ppg-avatar-wrapper:hover {\n animation: none !important;\n transform: none !important;\n }\n}\n\n/* Dark mode support */\n@media (prefers-color-scheme: dark) {\n .ppg-container {\n --ppg-counter-bg: #2c2c2e;\n --ppg-counter-text: #ffffff;\n --ppg-add-bg: #2c2c2e;\n --ppg-add-hover: #3a3a3c;\n --ppg-add-icon: #98989d;\n --ppg-border: rgba(255, 255, 255, 0.1);\n --ppg-dropdown-bg: #2c2c2e;\n --ppg-dropdown-hover: #3a3a3c;\n }\n\n .ppg-avatar-wrapper profile-picture {\n box-shadow: 0 0 6px 1.5px rgb(28 28 30 / 16%), var(--ppg-shadow-sm);\n }\n\n .ppg-counter {\n box-shadow: 0 0 0 1.5px rgba(28, 28, 30, 0.95), var(--ppg-shadow-sm);\n }\n\n .ppg-counter:hover {\n background: #3a3a3c;\n }\n\n .ppg-dropdown {\n background: rgba(44, 44, 46, 0.95);\n box-shadow:\n 0 4px 24px rgba(0, 0, 0, 0.4),\n 0 1px 4px rgba(0, 0, 0, 0.2),\n 0 0 0 1px rgba(255, 255, 255, 0.08);\n }\n\n .ppg-dropdown-name {\n color: #ffffff;\n }\n\n .ppg-dropdown-header {\n color: #98989d;\n background: linear-gradient(to bottom, rgba(255,255,255,0.03), transparent);\n }\n\n .ppg-dropdown-avatar {\n border-color: rgba(255, 255, 255, 0.15);\n }\n\n .ppg-dropdown-avatar-fallback {\n border-color: rgba(255, 255, 255, 0.1);\n }\n\n .ppg-dropdown-list {\n scrollbar-color: rgba(255,255,255,0.35) transparent;\n }\n\n .ppg-dropdown-list::-webkit-scrollbar-thumb {\n background: rgba(255,255,255,0.35);\n }\n\n .ppg-dropdown-presence {\n box-shadow: 0 0 0 1.5px rgba(44, 44, 46, 0.95);\n }\n\n .ppg-dropdown-presence[data-status=\"online\"] {\n box-shadow: 0 0 0 1.5px rgba(44, 44, 46, 0.95), 0 0 6px rgba(48, 209, 88, 0.5);\n }\n}\n`;\n\n/**\n * All group styles combined\n */\nexport const groupStyles = `${groupKeyframes}\\n${groupBaseStyles}`;\n","/**\n * ProfilePicture Web Component\n * Apple-inspired design system with modern 2025 aesthetics\n *\n * A lightweight, framework-agnostic profile picture component\n * with advanced features: presence indicators, rings, and badges.\n */\n\nimport { html, LitElement, nothing } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\nimport { styleMap } from \"lit/directives/style-map.js\";\nimport {\n componentStyles,\n getBackgroundStyles,\n getBorderClasses,\n getGlowShadow,\n getShadowStyles,\n getVariantClasses,\n shimmerStyles,\n} from \"./styles\";\nimport type {\n BadgeConfig,\n GlowConfig,\n InteractionConfig,\n LoadingStrategy,\n PlaceholderType,\n Position,\n PresenceConfig,\n RingConfig,\n ShadowPreset,\n Size,\n Variant,\n} from \"./types\";\nimport { DEFAULTS, PRESENCE_COLORS, RADIUS_MAP, SIZE_MAP } from \"./types\";\nimport {\n cn,\n constructCdnUrl,\n createConicGradient,\n createProgressRingGradient,\n formatBadgeContent,\n generateAvatarGradient,\n generateCloudyGradient,\n getBadgeSize,\n getCdnSizeLabel,\n getInitials,\n getInitialsFontSize,\n getPresenceSize,\n} from \"./utils\";\n\nexport class ProfilePicture extends LitElement {\n private static stylesInjected = false;\n private static cdnBaseUrl = \"\";\n private static instances = new Set<ProfilePicture>();\n\n /**\n * Set global CDN base URL for all ProfilePicture instances\n * @example ProfilePicture.setCdnBaseUrl('https://api.example.com')\n */\n public static setCdnBaseUrl(url: string): void {\n ProfilePicture.cdnBaseUrl = url;\n // Notify all existing instances to reload if they have extCustomerId\n ProfilePicture.instances.forEach((instance) => {\n if (instance.extCustomerId && !instance.cdnImageUrl) {\n // Reset failure state (CDN base URL change = legitimate retry)\n instance.cdnLoadFailed = false;\n // Clear any scheduled retry\n if (instance.retryTimeoutId) {\n clearTimeout(instance.retryTimeoutId);\n instance.retryTimeoutId = undefined;\n }\n if (!instance.previousExtCustomerId) {\n instance.previousExtCustomerId = instance.extCustomerId;\n }\n instance.loadCdnImage();\n }\n });\n }\n\n /**\n * Get current CDN base URL\n */\n public static getCdnBaseUrl(): string {\n return ProfilePicture.cdnBaseUrl;\n }\n\n // Use Light DOM for Tailwind compatibility\n protected createRenderRoot() {\n ProfilePicture.injectStylesOnce();\n return this;\n }\n\n private static injectStylesOnce() {\n if (ProfilePicture.stylesInjected || typeof document === \"undefined\") {\n return;\n }\n\n // Defer style injection to avoid hydration mismatch in SSR frameworks\n const defer =\n typeof requestIdleCallback !== \"undefined\"\n ? requestIdleCallback\n : (cb: () => void) => setTimeout(cb, 1);\n\n defer(() => {\n // Re-check in case another instance already injected\n if (ProfilePicture.stylesInjected) {\n return;\n }\n const style = document.createElement(\"style\");\n style.textContent = componentStyles;\n document.head.appendChild(style);\n ProfilePicture.stylesInjected = true;\n });\n }\n\n // ─── Core Properties ────────────────────────────────────────────────────────\n @property({ type: String }) src = \"\";\n @property({ type: String }) alt = \"\";\n @property({ type: String, attribute: \"ext-customer-id\" })\n extCustomerId?: string;\n\n // ─── Sizing ─────────────────────────────────────────────────────────────────\n @property({ type: String }) size: Size | string = DEFAULTS.size;\n\n // ─── Visual Variant ─────────────────────────────────────────────────────────\n @property({ type: String }) variant: Variant = DEFAULTS.variant;\n\n // ─── Shadow ─────────────────────────────────────────────────────────────────\n @property({ type: String }) shadow: ShadowPreset = DEFAULTS.shadow;\n\n // ─── Border ─────────────────────────────────────────────────────────────────\n @property({ type: Boolean }) border = false;\n @property({ type: Number, attribute: \"border-width\" }) borderWidth:\n | 1\n | 2\n | 3\n | 4\n | 5\n | 6\n | 8 = DEFAULTS.borderWidth;\n @property({ type: String, attribute: \"border-color\" }) borderColor: string =\n DEFAULTS.borderColor;\n\n // ─── Rotation ───────────────────────────────────────────────────────────────\n @property({ type: Number }) rotation = 0;\n\n // ─── Zoom ─────────────────────────────────────────────────────────────────\n @property({ type: Number }) zoom: number = DEFAULTS.zoom;\n\n // ─── Background ─────────────────────────────────────────────────────────────\n @property({ type: String, attribute: \"bg-color\" }) bgColor?: string;\n @property({ type: String, attribute: \"bg-gradient\" }) bgGradient?: string;\n\n // ─── Ring Effect (Instagram-style) ──────────────────────────────────────────\n @property({\n type: Object,\n attribute: \"ring\",\n converter: {\n fromAttribute: (value: string | null): RingConfig | undefined => {\n if (!value) return undefined;\n try {\n return JSON.parse(value) as RingConfig;\n } catch {\n return undefined;\n }\n },\n toAttribute: (value: RingConfig | undefined): string | null => {\n return value ? JSON.stringify(value) : null;\n },\n },\n })\n ring?: RingConfig;\n\n // ─── Presence Indicator ─────────────────────────────────────────────────────\n @property({\n type: Object,\n attribute: \"presence\",\n converter: {\n fromAttribute: (value: string | null): PresenceConfig | undefined => {\n if (!value) return undefined;\n try {\n return JSON.parse(value) as PresenceConfig;\n } catch {\n return undefined;\n }\n },\n toAttribute: (value: PresenceConfig | undefined): string | null => {\n return value ? JSON.stringify(value) : null;\n },\n },\n })\n presence?: PresenceConfig;\n\n // ─── Glow Effect ────────────────────────────────────────────────────────────\n @property({\n type: Object,\n attribute: \"glow\",\n converter: {\n fromAttribute: (value: string | null): GlowConfig | undefined => {\n if (!value) return undefined;\n try {\n return JSON.parse(value) as GlowConfig;\n } catch {\n return undefined;\n }\n },\n toAttribute: (value: GlowConfig | undefined): string | null => {\n return value ? JSON.stringify(value) : null;\n },\n },\n })\n glow?: GlowConfig;\n\n // ─── Badge ──────────────────────────────────────────────────────────────────\n @property({\n type: Object,\n attribute: \"badge\",\n converter: {\n fromAttribute: (value: string | null): BadgeConfig | undefined => {\n if (!value) return undefined;\n try {\n return JSON.parse(value) as BadgeConfig;\n } catch {\n return undefined;\n }\n },\n toAttribute: (value: BadgeConfig | undefined): string | null => {\n return value ? JSON.stringify(value) : null;\n },\n },\n })\n badge?: BadgeConfig;\n\n // ─── Loading & Performance ──────────────────────────────────────────────────\n @property({ type: String }) loading: LoadingStrategy = DEFAULTS.loading;\n @property({ type: String }) placeholder: PlaceholderType =\n DEFAULTS.placeholder;\n @property({ type: String, attribute: \"placeholder-color\" })\n placeholderColor: string = DEFAULTS.placeholderColor;\n\n // ─── Fallback ───────────────────────────────────────────────────────────────\n @property({ type: String }) fallback?: string;\n\n // ─── Fallback Mode ────────────────────────────────────────────────────────\n @property({ type: String, attribute: \"fallback-mode\" })\n fallbackMode?: \"initials\" | \"gradient\";\n\n // ─── Image Mode ────────────────────────────────────────────────────────────\n @property({ type: String, attribute: \"image-mode\" })\n imageMode: \"transparent\" | \"original\" = \"original\";\n\n // ─── Interaction ────────────────────────────────────────────────────────────\n @property({\n type: Object,\n attribute: \"interactive\",\n converter: {\n fromAttribute: (value: string | null): InteractionConfig | undefined => {\n if (!value) return undefined;\n try {\n return JSON.parse(value) as InteractionConfig;\n } catch {\n return undefined;\n }\n },\n toAttribute: (value: InteractionConfig | undefined): string | null => {\n return value ? JSON.stringify(value) : null;\n },\n },\n })\n interactive?: InteractionConfig;\n\n // ─── Internal State ─────────────────────────────────────────────────────────\n @state() private isLoaded = false;\n @state() private hasError = false;\n @state() private cdnImageUrl?: string;\n @state() private cdnLoadFailed = false;\n private previousSrc = \"\";\n private previousExtCustomerId?: string;\n private retryTimeoutId?: ReturnType<typeof setTimeout>;\n private randomSeed = Math.random().toString(36).slice(2);\n private readonly RETRY_DELAY_MS = 30_000; // 30 seconds\n\n private get pixelSize(): number {\n const sizeValue = this.size as Size | number;\n return typeof sizeValue === \"number\"\n ? sizeValue\n : (SIZE_MAP[sizeValue as Size] ?? SIZE_MAP[DEFAULTS.size]);\n }\n\n /**\n * Resolve the seed for cloudy gradient from available identifiers.\n * Priority: extCustomerId > alt > src > random instance seed\n */\n private get gradientSeed(): string {\n return this.extCustomerId || this.alt || this.src || this.randomSeed;\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n // Register this instance\n ProfilePicture.instances.add(this);\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n // Unregister this instance\n ProfilePicture.instances.delete(this);\n // Clear any scheduled retry\n if (this.retryTimeoutId) {\n clearTimeout(this.retryTimeoutId);\n this.retryTimeoutId = undefined;\n }\n }\n\n protected firstUpdated(): void {\n // Trigger CDN loading on initial render if extCustomerId is present\n if (this.extCustomerId && ProfilePicture.cdnBaseUrl) {\n this.previousExtCustomerId = this.extCustomerId;\n this.loadCdnImage();\n }\n }\n\n protected updated(changedProperties: Map<string, unknown>): void {\n super.updated(changedProperties);\n // Handle: CDN base URL set AFTER element creation\n // (previousExtCustomerId is only set when firstUpdated or willUpdate triggers a CDN load)\n if (\n this.extCustomerId &&\n ProfilePicture.cdnBaseUrl &&\n !this.cdnImageUrl &&\n !this.previousExtCustomerId\n ) {\n this.previousExtCustomerId = this.extCustomerId;\n this.cdnLoadFailed = false;\n this.loadCdnImage();\n }\n }\n\n protected willUpdate(changedProperties: Map<string, unknown>): void {\n if (changedProperties.has(\"src\") && this.src !== this.previousSrc) {\n this.isLoaded = false;\n this.hasError = false;\n this.previousSrc = this.src;\n }\n\n // Trigger CDN loading when relevant properties change\n const extCustomerIdChanged =\n changedProperties.has(\"extCustomerId\") &&\n this.extCustomerId !== this.previousExtCustomerId;\n const cdnParamsChanged =\n changedProperties.has(\"size\") || changedProperties.has(\"imageMode\");\n\n if (extCustomerIdChanged || (cdnParamsChanged && this.extCustomerId)) {\n this.previousExtCustomerId = this.extCustomerId;\n // Reset CDN state (property change = legitimate reload)\n this.cdnImageUrl = undefined;\n this.cdnLoadFailed = false;\n this.isLoaded = false;\n this.hasError = false;\n // Clear any scheduled retry\n if (this.retryTimeoutId) {\n clearTimeout(this.retryTimeoutId);\n this.retryTimeoutId = undefined;\n }\n // Start CDN loading\n this.loadCdnImage();\n }\n }\n\n private handleLoad() {\n this.isLoaded = true;\n this.dispatchEvent(\n new CustomEvent(\"load\", { bubbles: true, composed: true })\n );\n }\n\n private handleClick(event: MouseEvent) {\n if (!this.interactive?.pressable) return;\n this.dispatchEvent(\n new CustomEvent(\"profile-picture-click\", {\n bubbles: true,\n composed: true,\n detail: {\n extCustomerId: this.extCustomerId,\n alt: this.alt,\n src: this.src,\n },\n })\n );\n }\n\n private handleKeyDown(event: KeyboardEvent) {\n if (!this.interactive?.pressable) return;\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n this.handleClick(event as unknown as MouseEvent);\n }\n }\n\n private handleError() {\n // If CDN image failed, mark it and schedule retry\n if (this.cdnImageUrl && !this.cdnLoadFailed) {\n this.cdnLoadFailed = true;\n this.cdnImageUrl = undefined;\n\n // Dispatch CDN error event\n this.dispatchEvent(\n new CustomEvent(\"cdn-error\", {\n bubbles: true,\n composed: true,\n detail: { error: \"Image load failed\" },\n })\n );\n\n // Schedule a retry after delay\n if (this.retryTimeoutId) {\n clearTimeout(this.retryTimeoutId);\n }\n this.retryTimeoutId = setTimeout(() => {\n this.retryTimeoutId = undefined;\n if (this.extCustomerId && ProfilePicture.cdnBaseUrl) {\n this.cdnLoadFailed = false;\n this.hasError = false;\n this.isLoaded = false;\n this.loadCdnImage();\n }\n }, this.RETRY_DELAY_MS);\n\n // Don't mark hasError yet - fallback (src prop) may work\n return;\n }\n\n this.hasError = true;\n this.isLoaded = true;\n this.dispatchEvent(\n new CustomEvent(\"error\", { bubbles: true, composed: true })\n );\n }\n\n /**\n * Construct CDN URL for profile picture using ext-customer-id\n * Uses direct image src binding - browser handles redirects automatically\n */\n private loadCdnImage(): void {\n // Skip if no extCustomerId or no CDN base URL configured\n if (!(this.extCustomerId && ProfilePicture.cdnBaseUrl)) {\n this.cdnLoadFailed = true;\n return;\n }\n\n // Calculate CDN parameters\n const sizeLabel = getCdnSizeLabel(this.pixelSize);\n const hostname =\n typeof window !== \"undefined\" ? window.location.hostname : \"localhost\";\n\n // Set the CDN URL directly - browser will handle redirects via img src\n this.cdnImageUrl = constructCdnUrl(\n ProfilePicture.cdnBaseUrl,\n this.extCustomerId,\n sizeLabel,\n this.imageMode,\n hostname\n );\n }\n\n private getContainerStyles() {\n const bg = getBackgroundStyles(this.bgColor, this.bgGradient);\n const borderStyles = this.border\n ? getBorderClasses(this.borderWidth, this.borderColor)\n : null;\n const shadowStyles = getShadowStyles(this.shadow);\n\n // Handle glow effect\n let glowStyles: Record<string, string> = {};\n if (this.glow) {\n const glowColor = this.glow.color ?? this.borderColor ?? \"#6366f1\";\n glowStyles = {\n \"--pp-glow-color\": glowColor,\n boxShadow: getGlowShadow(glowColor, this.glow.intensity ?? 0.3),\n };\n }\n\n const isInteractive =\n this.interactive?.hoverable || this.interactive?.pressable;\n\n return {\n classes: cn(\n \"pp-container\",\n getVariantClasses(this.variant),\n borderStyles?.className,\n isInteractive && \"pp-interactive\",\n this.glow?.animate && \"pp-glow\"\n ),\n styles: {\n width: `${this.pixelSize}px`,\n height: `${this.pixelSize}px`,\n borderRadius: RADIUS_MAP[this.variant],\n ...borderStyles?.style,\n ...shadowStyles,\n ...glowStyles,\n cursor:\n this.interactive?.cursor ?? (isInteractive ? \"pointer\" : \"default\"),\n transform: this.rotation ? `rotate(${this.rotation}deg)` : undefined,\n },\n // Background styles moved to .pp-inner to prevent sub-pixel bleed-through\n innerStyles: bg.style ?? {},\n innerClasses: bg.className,\n };\n }\n\n private renderPlaceholder() {\n if (this.isLoaded || this.placeholder === \"none\") {\n return nothing;\n }\n\n const placeholderClass = {\n shimmer: \"pp-shimmer\",\n pulse: \"pp-pulse\",\n skeleton: \"pp-skeleton\",\n blur: \"\",\n none: \"\",\n }[this.placeholder];\n\n return html`\n ${this.placeholder === \"shimmer\" ? html`<style>${shimmerStyles}</style>` : nothing}\n <div\n class=${cn(\"np:absolute np:inset-0\", placeholderClass)}\n style=${styleMap({\n backgroundColor: this.placeholderColor,\n borderRadius: \"inherit\",\n })}>\n </div>\n `;\n }\n\n private renderFallback() {\n // Check if an explicit background is set (bg-color or bg-gradient)\n // When set, the fallback should be transparent so .pp-inner's background shows through\n const hasExplicitBg = Boolean(this.bgColor || this.bgGradient);\n\n // Gradient mode: show cloudy gradient, no text\n if (this.fallbackMode === \"gradient\") {\n const gradient = generateCloudyGradient(this.gradientSeed);\n return html`\n <div\n class=\"pp-fallback np:absolute np:inset-0\"\n style=${styleMap({\n background: hasExplicitBg ? \"transparent\" : gradient,\n })}>\n </div>\n `;\n }\n\n // Use custom fallback text if provided\n if (this.fallback) {\n return html`\n <span\n class=\"pp-fallback\"\n style=${styleMap({ fontSize: `${getInitialsFontSize(this.pixelSize)}px` })}>\n ${this.fallback}\n </span>\n `;\n }\n\n // Generate initials from alt text\n if (this.alt) {\n const gradient = generateAvatarGradient(this.alt);\n return html`\n <div\n class=\"pp-fallback np:absolute np:inset-0\"\n style=${styleMap({\n background: hasExplicitBg ? \"transparent\" : gradient,\n fontSize: `${getInitialsFontSize(this.pixelSize)}px`,\n })}>\n ${getInitials(this.alt)}\n </div>\n `;\n }\n\n // Default user icon\n const iconSize = this.pixelSize * 0.5;\n return html`\n <svg\n class=\"pp-fallback-icon\"\n style=\"width: ${iconSize}px; height: ${iconSize}px;\"\n fill=\"currentColor\"\n viewBox=\"0 0 24 24\">\n <path d=\"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z\" />\n </svg>\n `;\n }\n\n private renderImage() {\n // Determine image source with CDN priority:\n // 1. CDN URL (browser handles redirects automatically via img src)\n // 2. src prop (if CDN not configured or failed)\n // 3. Fallback component\n const hasCdnConfig = Boolean(\n this.extCustomerId && ProfilePicture.cdnBaseUrl\n );\n\n let imageSrc: string | undefined;\n if (this.cdnImageUrl) {\n // CDN URL set - browser will handle redirects\n imageSrc = this.cdnImageUrl;\n } else if (!hasCdnConfig || this.cdnLoadFailed) {\n // CDN not configured or failed - use src prop\n imageSrc = this.src;\n }\n\n // No image source available - show fallback\n if (this.hasError || !imageSrc) {\n return this.renderFallback();\n }\n\n const zoomStyle = this.zoom && this.zoom !== 1\n ? styleMap({ transform: `scale(${this.zoom})` })\n : nothing;\n\n return html`\n <img\n src=${imageSrc}\n alt=${this.alt}\n loading=${this.loading}\n decoding=\"async\"\n @load=${this.handleLoad}\n @error=${this.handleError}\n class=${cn(\"pp-image\", this.isLoaded ? \"pp-image-loaded\" : \"pp-image-loading\")}\n style=${zoomStyle}\n draggable=\"false\" />\n `;\n }\n\n private renderRing() {\n if (!this.ring?.show) {\n return nothing;\n }\n\n const ringWidth = this.ring.width ?? 3;\n const ringGap = this.ring.gap ?? 3;\n const totalOffset = ringWidth + ringGap;\n\n let ringColor: string;\n const hasProgress = this.ring.progress !== undefined;\n\n if (hasProgress) {\n // Progress mode: partial fill ring\n const progress = this.ring.progress ?? 0;\n const filledColor = this.ring.color ?? \"#30D158\"; // Default green\n const emptyColor = this.ring.emptyColor ?? \"#8E8E93\"; // Default gray\n ringColor = createProgressRingGradient(progress, filledColor, emptyColor);\n } else if (this.ring.gradient && this.ring.gradient.length > 0) {\n // Multi-color gradient mode\n ringColor = createConicGradient(this.ring.gradient);\n } else {\n // Single color or default gradient\n ringColor =\n this.ring.color ??\n \"linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888)\";\n }\n\n return html`\n <div\n class=${cn(\n \"pp-ring\",\n this.ring.animate && !hasProgress && \"pp-ring-animated\",\n hasProgress && \"pp-ring-progress\"\n )}\n style=${styleMap({\n inset: `-${totalOffset}px`,\n padding: `${ringWidth}px`,\n background: ringColor,\n borderRadius: RADIUS_MAP[this.variant],\n })}>\n </div>\n `;\n }\n\n /**\n * Calculate the distance from the container edge to the avatar's visual corner point.\n * For a circle, this is the 45° point on the circumference.\n * Returns the inset in pixels where an indicator's CENTER should be placed.\n */\n private getCornerOffset(): number {\n const radius = this.pixelSize / 2;\n\n // For a circle, the 45° point from center is at (r*cos45, r*sin45)\n // Distance from container edge = r - r*cos(45°) = r * (1 - √2/2) ≈ r * 0.1464\n const variantInsetRatio: Record<Variant, number> = {\n circle: 1 - Math.SQRT2 / 2, // ~0.1464\n square: 0.0,\n rounded: 0.04,\n squircle: 0.08,\n };\n\n const ratio = variantInsetRatio[this.variant];\n return radius * ratio;\n }\n\n private renderPresence() {\n if (!this.presence) {\n return nothing;\n }\n\n const thickness = this.presence.thickness ?? 2;\n const size = getPresenceSize(this.pixelSize, thickness);\n const color = PRESENCE_COLORS[this.presence.status];\n\n // Center the indicator on the avatar's corner point\n const cornerInset = this.getCornerOffset();\n const offset = cornerInset - size / 2;\n\n return html`\n <div\n class=${cn(\"pp-presence\", this.presence.animate && \"pp-presence-animated\")}\n style=${styleMap({\n width: `${size}px`,\n height: `${size}px`,\n backgroundColor: color,\n bottom: `${offset}px`,\n right: `${offset}px`,\n color,\n })}\n title=${this.presence.status}>\n </div>\n `;\n }\n\n private renderBadge() {\n if (!this.badge) {\n return nothing;\n }\n\n const position = this.badge.position ?? \"bottom-right\";\n const hasContent = this.badge.content !== undefined;\n const hasIcon = this.badge.icon !== undefined;\n const hasAnyContent = hasContent || hasIcon;\n const { size: badgeSize, fontSize } = getBadgeSize(\n this.pixelSize,\n hasAnyContent\n );\n\n const bgColor = this.badge.bgColor ?? \"#22c55e\";\n const textColor = this.badge.color ?? \"#ffffff\";\n const borderRadius = this.badge.borderRadius ?? \"9999px\";\n\n // Format content (99+ for large numbers)\n const content =\n hasContent && this.badge.content !== undefined\n ? formatBadgeContent(this.badge.content, this.badge.max)\n : null;\n\n // Icon rendering\n const icon = hasIcon ? this.badge.icon : null;\n const iconSize = fontSize * 0.9; // Icon slightly smaller than text\n\n // Center the badge on the avatar's corner point\n const cornerInset = this.getCornerOffset();\n const offset = cornerInset - badgeSize / 2;\n const posOffset = `${offset}px`;\n\n const positionStyles: Record<Position, Record<string, string>> = {\n \"top-left\": { top: posOffset, left: posOffset },\n \"top-center\": {\n top: posOffset,\n left: \"50%\",\n transform: \"translateX(-50%)\",\n },\n \"top-right\": { top: posOffset, right: posOffset },\n \"bottom-left\": { bottom: posOffset, left: posOffset },\n \"bottom-center\": {\n bottom: posOffset,\n left: \"50%\",\n transform: \"translateX(-50%)\",\n },\n \"bottom-right\": { bottom: posOffset, right: posOffset },\n };\n\n return html`\n <div\n class=${cn(\n \"pp-badge\",\n this.badge.pulse && \"pp-badge-pulse\",\n this.badge.glow && \"pp-badge-glow\",\n hasIcon && \"pp-badge-with-icon\"\n )}\n style=${styleMap({\n width: hasAnyContent ? \"auto\" : `${badgeSize}px`,\n minWidth: `${badgeSize}px`,\n height: `${badgeSize}px`,\n padding: hasAnyContent ? \"0 6px\" : \"0\",\n fontSize: `${fontSize}px`,\n backgroundColor: bgColor,\n color: textColor,\n borderRadius,\n \"--pp-badge-glow-color\": bgColor,\n gap: hasIcon && hasContent ? \"4px\" : \"0\",\n ...positionStyles[position],\n })}>\n ${\n icon\n ? html`<span class=\"pp-badge-icon\" style=${styleMap({ fontSize: `${iconSize}px` })}>${icon}</span>`\n : nothing\n }\n ${content ?? nothing}\n </div>\n `;\n }\n\n render() {\n const container = this.getContainerStyles();\n\n const tabIndex =\n this.interactive?.focusable || this.interactive?.pressable\n ? 0\n : undefined;\n\n return html`\n <div\n class=${container.classes}\n style=${styleMap(container.styles)}\n tabindex=${tabIndex ?? nothing}\n role=${this.interactive?.pressable ? \"button\" : nothing}\n aria-label=${this.alt || nothing}\n @click=${this.handleClick}\n @keydown=${this.handleKeyDown}\n data-profile-picture>\n\n <!-- Ring Effect (behind everything) -->\n ${this.renderRing()}\n\n <!-- Inner container for image clipping -->\n <div\n class=${cn(\"pp-inner\", container.innerClasses)}\n style=${styleMap({\n borderRadius: RADIUS_MAP[this.variant],\n ...container.innerStyles,\n })}>\n <!-- Placeholder -->\n ${this.renderPlaceholder()}\n\n <!-- Main Image or Fallback -->\n ${this.renderImage()}\n </div>\n\n <!-- Badge -->\n ${this.renderBadge()}\n\n <!-- Presence Indicator -->\n ${this.renderPresence()}\n </div>\n `;\n }\n}\n\n// Export types for TypeScript users\nexport type {\n BadgeConfig,\n FallbackMode,\n GlowConfig,\n ImageMode,\n InteractionConfig,\n LoadingStrategy,\n PlaceholderType,\n Position,\n PresenceConfig,\n PresenceStatus,\n RingConfig,\n ShadowPreset,\n Size,\n Variant,\n} from \"./types\";\n\n// Register custom element with guard to prevent duplicate registration during HMR\nif (!customElements.get(\"profile-picture\")) {\n customElements.define(\"profile-picture\", ProfilePicture);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"profile-picture\": ProfilePicture;\n }\n}\n\nexport default ProfilePicture;\n","/**\n * ProfilePictureGroup Web Component\n * Apple-inspired stacked avatar group with tooltips, counter, and dropdown\n *\n * A lightweight, framework-agnostic component for displaying\n * multiple profile pictures in a visually appealing stacked layout.\n */\n\nimport { html, LitElement, nothing, render } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\nimport { styleMap } from \"lit/directives/style-map.js\";\nimport { groupStyles } from \"./styles\";\nimport type {\n DropdownConfig,\n GroupUserData,\n Size,\n StackDirection,\n TooltipConfig,\n TooltipPosition,\n} from \"./types\";\nimport { GROUP_DEFAULTS } from \"./types\";\nimport {\n calculateAvatarCounts,\n calculateGroupWidth,\n calculateStackPosition,\n calculateStackZIndex,\n cn,\n formatCounterText,\n generateAvatarGradient,\n getGroupAvatarSize,\n getInitials,\n} from \"./utils\";\n\n// Inject group styles once\nlet groupStylesInjected = false;\nfunction injectGroupStyles() {\n if (groupStylesInjected || typeof document === \"undefined\") {\n return;\n }\n\n // Defer style injection to avoid hydration mismatch in SSR frameworks\n const defer =\n typeof requestIdleCallback !== \"undefined\"\n ? requestIdleCallback\n : (cb: () => void) => setTimeout(cb, 1);\n\n defer(() => {\n // Re-check in case another call already injected\n if (groupStylesInjected) {\n return;\n }\n const style = document.createElement(\"style\");\n style.textContent = groupStyles;\n document.head.appendChild(style);\n groupStylesInjected = true;\n });\n}\n\nexport class ProfilePictureGroup extends LitElement {\n // Use Light DOM for Tailwind compatibility\n protected createRenderRoot() {\n injectGroupStyles();\n return this;\n }\n\n // ─── Core Properties ────────────────────────────────────────────────────────\n @property({ type: Number }) max = GROUP_DEFAULTS.max;\n @property({ type: String }) direction: StackDirection =\n GROUP_DEFAULTS.direction;\n @property({ type: Number }) overlap = GROUP_DEFAULTS.overlap;\n @property({ type: String }) size: Size | string = GROUP_DEFAULTS.size;\n @property({ type: Number }) spacing?: number;\n @property({ type: Object }) tooltip?: TooltipConfig;\n @property({ type: Object }) dropdown?: DropdownConfig;\n @property({ type: Boolean, attribute: \"show-add-button\" }) showAddButton =\n false;\n @property({ type: String, attribute: \"add-button-label\" }) addButtonLabel =\n \"Add user\";\n @property({ type: Boolean }) animated = GROUP_DEFAULTS.animated;\n @property({ type: Number, attribute: \"rotation-amount\" }) rotationAmount = 0;\n\n // ─── Internal State ─────────────────────────────────────────────────────────\n @state() private users: GroupUserData[] = [];\n @state() private dropdownOpen = false;\n @state() private tooltipData: {\n user: GroupUserData;\n rect: DOMRect;\n } | null = null;\n private tooltipTimeout: number | null = null;\n private slotObserver: MutationObserver | null = null;\n\n // ─── Portal State ───────────────────────────────────────────────────────────\n private portalContainer: HTMLDivElement | null = null;\n private counterRef: HTMLButtonElement | null = null;\n\n private get pixelSize(): number {\n return getGroupAvatarSize(this.size as Size | number);\n }\n\n private get tooltipEnabled(): boolean {\n return this.tooltip?.enabled !== false;\n }\n\n private get tooltipPosition(): TooltipPosition {\n return this.tooltip?.position ?? \"top\";\n }\n\n private get tooltipDelay(): number {\n return this.tooltip?.delay ?? GROUP_DEFAULTS.tooltipDelay;\n }\n\n private get dropdownMaxHeight(): number {\n return this.dropdown?.maxHeight ?? GROUP_DEFAULTS.dropdownMaxHeight;\n }\n\n private get showPresence(): boolean {\n return this.dropdown?.showPresence !== false;\n }\n\n private get dropdownPosition(): \"top\" | \"bottom\" {\n return this.dropdown?.position ?? \"bottom\";\n }\n\n // ─── Lifecycle ──────────────────────────────────────────────────────────────\n\n connectedCallback() {\n super.connectedCallback();\n this.updateUsers();\n this.setupSlotObserver();\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.slotObserver?.disconnect();\n this.clearTooltipTimeout();\n this.destroyPortal();\n }\n\n private setupSlotObserver() {\n // Watch for child element changes\n this.slotObserver = new MutationObserver(() => {\n this.updateUsers();\n });\n\n this.slotObserver.observe(this, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: [\n \"src\",\n \"alt\",\n \"ext-customer-id\",\n \"data-user-id\",\n \"data-status\",\n \"variant\",\n \"shadow\",\n \"border\",\n \"border-width\",\n \"border-color\",\n \"bg-color\",\n \"bg-gradient\",\n \"image-mode\",\n ],\n });\n }\n\n private updateUsers() {\n // Only select direct children profile-picture elements (slotted content),\n // not the ones we render inside the ppg-container\n const children = Array.from(this.children).filter(\n (child) =>\n child.tagName.toLowerCase() === \"profile-picture\" &&\n child.getAttribute(\"slot\") !== \"internal\"\n );\n\n this.users = children.map((el, index) => {\n // Helper to read property or attribute (React may set properties instead of attributes)\n const getPropOrAttr = (\n propName: string,\n attrName?: string\n ): string | undefined => {\n const actualAttrName = attrName ?? propName;\n // Try property first (for React compatibility)\n const propValue = (el as unknown as Record<string, unknown>)[propName];\n if (propValue !== undefined && propValue !== null && propValue !== \"\") {\n return String(propValue);\n }\n // Fall back to attribute\n return el.getAttribute(actualAttrName) ?? undefined;\n };\n\n // Extract border-width as number\n const borderWidthValue = getPropOrAttr(\"borderWidth\", \"border-width\");\n const borderWidth = borderWidthValue\n ? (Number.parseInt(String(borderWidthValue), 10) as 1 | 2 | 3 | 4)\n : undefined;\n\n return {\n // Core data\n id: getPropOrAttr(\"dataUserId\", \"data-user-id\"),\n name: getPropOrAttr(\"alt\") ?? `User ${index + 1}`,\n src: getPropOrAttr(\"src\"),\n extCustomerId: getPropOrAttr(\"extCustomerId\", \"ext-customer-id\"),\n status: getPropOrAttr(\"dataStatus\", \"data-status\") as\n | GroupUserData[\"status\"]\n | undefined,\n element: el as HTMLElement,\n index,\n\n // Profile picture props (passed through from slotted elements)\n variant: getPropOrAttr(\"variant\") as\n | GroupUserData[\"variant\"]\n | undefined,\n shadow: getPropOrAttr(\"shadow\") as GroupUserData[\"shadow\"] | undefined,\n border: Boolean(\n (el as unknown as Record<string, unknown>).border ??\n el.hasAttribute(\"border\")\n ),\n borderWidth,\n borderColor: getPropOrAttr(\"borderColor\", \"border-color\"),\n bgColor: getPropOrAttr(\"bgColor\", \"bg-color\"),\n bgGradient: getPropOrAttr(\"bgGradient\", \"bg-gradient\"),\n imageMode: getPropOrAttr(\"imageMode\", \"image-mode\") as\n | GroupUserData[\"imageMode\"]\n | undefined,\n };\n });\n\n // Hide ALL slotted elements since we're rendering our own\n for (const user of this.users) {\n if (user.element) {\n user.element.style.display = \"none\";\n }\n }\n }\n\n // ─── Portal Management ──────────────────────────────────────────────────────\n\n private createPortal() {\n if (this.portalContainer) {\n return;\n }\n\n this.portalContainer = document.createElement(\"div\");\n this.portalContainer.className = \"ppg-portal\";\n this.portalContainer.style.cssText =\n \"position: fixed; z-index: 99999; pointer-events: none;\";\n document.body.appendChild(this.portalContainer);\n\n // Lock body scroll\n document.body.style.overflow = \"hidden\";\n }\n\n private destroyPortal() {\n if (this.portalContainer) {\n render(nothing, this.portalContainer);\n this.portalContainer.remove();\n this.portalContainer = null;\n\n // Restore body scroll\n document.body.style.overflow = \"\";\n }\n }\n\n private updatePortalContent(hiddenUsers: GroupUserData[]) {\n if (!(this.portalContainer && this.counterRef)) {\n return;\n }\n\n const rect = this.counterRef.getBoundingClientRect();\n const gap = 10;\n const dropdownWidth = 280;\n const dropdownHeight = Math.min(\n this.dropdownMaxHeight + 60, // header + padding\n hiddenUsers.length * 56 + 60 // estimate item height\n );\n\n const viewportWidth = window.innerWidth;\n const viewportHeight = window.innerHeight;\n const isMobile = viewportWidth < 480;\n\n // Mobile: centered modal style\n if (isMobile) {\n const content = html`\n <div\n class=\"ppg-backdrop ppg-backdrop-visible\"\n style=\"pointer-events: auto; background: rgba(0,0,0,0.5);\"\n @click=${this.handleBackdropClick}\n aria-hidden=\"true\"\n ></div>\n <div\n class=\"ppg-dropdown ppg-dropdown-modal\"\n style=${styleMap({\n position: \"fixed\",\n pointerEvents: \"auto\",\n top: \"50%\",\n left: \"50%\",\n transform: \"translate(-50%, -50%)\",\n width: \"calc(100vw - 32px)\",\n maxWidth: \"320px\",\n maxHeight: \"70vh\",\n })}\n data-position=\"modal\"\n role=\"menu\"\n aria-label=\"Hidden users\"\n >\n <div class=\"ppg-dropdown-header\">\n ${hiddenUsers.length} more\n </div>\n <div\n class=\"ppg-dropdown-list\"\n style=${styleMap({\n maxHeight: \"calc(70vh - 60px)\",\n })}\n >\n ${hiddenUsers.map((user) => this.renderDropdownItem(user))}\n </div>\n </div>\n `;\n render(content, this.portalContainer);\n return;\n }\n\n // Desktop: smart positioning\n const spaceBelow = viewportHeight - rect.bottom - gap;\n const spaceAbove = rect.top - gap;\n const spaceRight = viewportWidth - rect.left;\n const spaceLeft = rect.right;\n\n // Determine vertical position\n let openDirection: \"bottom\" | \"top\" = this.dropdownPosition;\n if (\n openDirection === \"bottom\" &&\n spaceBelow < dropdownHeight &&\n spaceAbove > spaceBelow\n ) {\n openDirection = \"top\";\n } else if (\n openDirection === \"top\" &&\n spaceAbove < dropdownHeight &&\n spaceBelow > spaceAbove\n ) {\n openDirection = \"bottom\";\n }\n\n // Determine horizontal position\n let left: number;\n if (spaceRight >= dropdownWidth) {\n // Align to left edge of counter\n left = rect.left;\n } else if (spaceLeft >= dropdownWidth) {\n // Align to right edge of counter\n left = rect.right - dropdownWidth;\n } else {\n // Center in viewport\n left = (viewportWidth - dropdownWidth) / 2;\n }\n\n // Clamp to viewport bounds\n left = Math.max(8, Math.min(left, viewportWidth - dropdownWidth - 8));\n\n const top = openDirection === \"bottom\" ? rect.bottom + gap : undefined;\n const bottom =\n openDirection === \"top\" ? viewportHeight - rect.top + gap : undefined;\n\n const content = html`\n <div\n class=\"ppg-backdrop\"\n style=\"pointer-events: auto;\"\n @click=${this.handleBackdropClick}\n aria-hidden=\"true\"\n ></div>\n <div\n class=\"ppg-dropdown ppg-dropdown-portal\"\n style=${styleMap({\n position: \"fixed\",\n pointerEvents: \"auto\",\n top: top !== undefined ? `${top}px` : \"auto\",\n bottom: bottom !== undefined ? `${bottom}px` : \"auto\",\n left: `${left}px`,\n width: `${dropdownWidth}px`,\n })}\n data-position=${openDirection}\n role=\"menu\"\n aria-label=\"Hidden users\"\n >\n <div class=\"ppg-dropdown-header\">\n ${hiddenUsers.length} more\n </div>\n <div\n class=\"ppg-dropdown-list\"\n style=${styleMap({\n maxHeight: `${this.dropdownMaxHeight}px`,\n })}\n >\n ${hiddenUsers.map((user) => this.renderDropdownItem(user))}\n </div>\n </div>\n `;\n\n render(content, this.portalContainer);\n }\n\n // ─── Event Handlers ─────────────────────────────────────────────────────────\n\n private handleAvatarClick(user: GroupUserData) {\n this.dispatchEvent(\n new CustomEvent(\"avatar-click\", {\n detail: { user },\n bubbles: true,\n composed: true,\n })\n );\n }\n\n private handleAvatarHover(user: GroupUserData, event: MouseEvent) {\n if (!this.tooltipEnabled) {\n return;\n }\n\n this.clearTooltipTimeout();\n const target = event.currentTarget as HTMLElement;\n\n this.tooltipTimeout = window.setTimeout(() => {\n this.tooltipData = {\n user,\n rect: target.getBoundingClientRect(),\n };\n }, this.tooltipDelay);\n\n this.dispatchEvent(\n new CustomEvent(\"avatar-hover\", {\n detail: { user },\n bubbles: true,\n composed: true,\n })\n );\n }\n\n private handleAvatarLeave() {\n this.clearTooltipTimeout();\n this.tooltipData = null;\n }\n\n private clearTooltipTimeout() {\n if (this.tooltipTimeout) {\n window.clearTimeout(this.tooltipTimeout);\n this.tooltipTimeout = null;\n }\n }\n\n private handleCounterClick(hiddenUsers: GroupUserData[]) {\n this.dropdownOpen = !this.dropdownOpen;\n\n if (this.dropdownOpen) {\n this.createPortal();\n this.updatePortalContent(hiddenUsers);\n } else {\n this.destroyPortal();\n }\n\n this.dispatchEvent(\n new CustomEvent(\"counter-click\", {\n detail: { hiddenUsers, open: this.dropdownOpen },\n bubbles: true,\n composed: true,\n })\n );\n }\n\n private readonly handleBackdropClick = () => {\n this.dropdownOpen = false;\n this.destroyPortal();\n };\n\n private handleDropdownItemClick(user: GroupUserData) {\n this.dropdownOpen = false;\n this.destroyPortal();\n\n this.dispatchEvent(\n new CustomEvent(\"dropdown-item-click\", {\n detail: { user },\n bubbles: true,\n composed: true,\n })\n );\n }\n\n private handleAddClick() {\n this.dispatchEvent(\n new CustomEvent(\"add-click\", {\n bubbles: true,\n composed: true,\n })\n );\n }\n\n private handleKeyDown(event: KeyboardEvent, handler: () => void) {\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n handler();\n }\n }\n\n // ─── Rendering ──────────────────────────────────────────────────────────────\n\n private renderAvatar(user: GroupUserData, index: number, total: number) {\n const position = calculateStackPosition(\n index,\n this.pixelSize,\n this.overlap,\n this.direction,\n this.spacing\n );\n const zIndex = calculateStackZIndex(index, total, this.direction);\n\n // Use user's variant or default to circle for groups\n const variant = user.variant ?? \"circle\";\n // Use user's shadow or default to none for cleaner stacking\n const shadow = user.shadow ?? \"none\";\n // Calculate alternating rotation\n const rotation = this.rotationAmount\n ? index % 2 === 0\n ? -this.rotationAmount\n : this.rotationAmount\n : 0;\n\n return html`\n <div\n class=\"ppg-avatar-wrapper\"\n style=${styleMap({\n left: `${position}px`,\n zIndex: String(zIndex),\n width: `${this.pixelSize}px`,\n height: `${this.pixelSize}px`,\n })}\n tabindex=\"0\"\n role=\"button\"\n aria-label=${user.name}\n @click=${() => this.handleAvatarClick(user)}\n @mouseenter=${(e: MouseEvent) => this.handleAvatarHover(user, e)}\n @mouseleave=${this.handleAvatarLeave}\n @keydown=${(e: KeyboardEvent) =>\n this.handleKeyDown(e, () => this.handleAvatarClick(user))}\n >\n ${this.renderProfilePicture(user, variant, shadow, rotation)}\n </div>\n `;\n }\n\n private renderProfilePicture(\n user: GroupUserData,\n variant: string,\n shadow: string,\n rotation: number\n ) {\n // Build the profile-picture element with only defined attributes\n // This avoids passing empty strings which might override defaults\n // Default to white background when wrapped in group\n return html`\n <profile-picture\n .src=${user.src || undefined}\n .alt=${user.name}\n .size=${this.pixelSize}\n .variant=${variant}\n .shadow=${shadow}\n .rotation=${rotation}\n .extCustomerId=${user.extCustomerId}\n ?border=${user.border}\n .borderWidth=${user.border ? (user.borderWidth ?? 2) : 2}\n .borderColor=${user.border ? (user.borderColor ?? \"#ffffff\") : \"#ffffff\"}\n .bgColor=${user.bgGradient ? undefined : (user.bgColor || undefined)}\n .bgGradient=${user.bgGradient ?? undefined}\n .imageMode=${user.imageMode ?? \"original\"}\n data-user-id=${user.id ?? \"\"}\n data-status=${user.status ?? \"\"}\n ></profile-picture>\n `;\n }\n\n private renderCounter(\n count: number,\n position: number,\n hiddenUsers: GroupUserData[]\n ) {\n return html`\n <button\n class=\"ppg-counter\"\n style=${styleMap({\n left: `${position}px`,\n width: `${this.pixelSize}px`,\n height: `${this.pixelSize}px`,\n zIndex: \"1\",\n })}\n aria-label=${`${count} more users`}\n aria-expanded=${this.dropdownOpen}\n aria-haspopup=\"true\"\n @click=${() => this.handleCounterClick(hiddenUsers)}\n >\n ${formatCounterText(count)}\n </button>\n `;\n }\n\n private renderAddButton(position: number) {\n const iconSize = Math.round(this.pixelSize * 0.4);\n\n return html`\n <button\n class=\"ppg-add-button\"\n style=${styleMap({\n left: `${position}px`,\n width: `${this.pixelSize}px`,\n height: `${this.pixelSize}px`,\n zIndex: \"1\",\n })}\n aria-label=${this.addButtonLabel}\n @click=${this.handleAddClick}\n >\n <svg\n class=\"ppg-add-icon\"\n width=${iconSize}\n height=${iconSize}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n <line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\"></line>\n <line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"></line>\n </svg>\n </button>\n `;\n }\n\n private renderTooltip() {\n if (!this.tooltipData) {\n return nothing;\n }\n\n const { user, rect } = this.tooltipData;\n const gap = 8;\n\n // Get container position for relative calculation\n const containerRect = this.getBoundingClientRect();\n\n // Calculate position relative to container\n const relativeLeft = rect.left - containerRect.left + rect.width / 2;\n const relativeTop = rect.top - containerRect.top;\n const relativeBottom = rect.bottom - containerRect.top;\n\n const isTop = this.tooltipPosition === \"top\";\n\n return html`\n <div\n class=\"ppg-tooltip\"\n style=${styleMap({\n top: isTop ? \"auto\" : `${relativeBottom + gap}px`,\n bottom: isTop\n ? `${containerRect.height - relativeTop + gap}px`\n : \"auto\",\n left: `${relativeLeft}px`,\n })}\n data-position=${this.tooltipPosition}\n role=\"tooltip\"\n >\n ${user.name}\n </div>\n `;\n }\n\n private renderDropdownItem(user: GroupUserData) {\n const gradient = generateAvatarGradient(user.name);\n const hasImage = user.src || user.extCustomerId;\n\n return html`\n <div\n class=\"ppg-dropdown-item\"\n role=\"menuitem\"\n tabindex=\"0\"\n @click=${() => this.handleDropdownItemClick(user)}\n @keydown=${(e: KeyboardEvent) =>\n this.handleKeyDown(e, () => this.handleDropdownItemClick(user))}\n >\n ${\n hasImage\n ? html`<profile-picture\n class=\"ppg-dropdown-avatar\"\n .src=${user.src || undefined}\n .alt=${user.name}\n .extCustomerId=${user.extCustomerId}\n .size=${40}\n variant=\"circle\"\n shadow=\"none\"\n ></profile-picture>`\n : html`<div\n class=\"ppg-dropdown-avatar-fallback\"\n style=${styleMap({ background: gradient })}\n >\n ${getInitials(user.name)}\n </div>`\n }\n <div class=\"ppg-dropdown-info\">\n <div class=\"ppg-dropdown-name\">${user.name}</div>\n ${\n this.showPresence && user.status\n ? html`\n <div class=\"ppg-dropdown-status\">\n <span\n class=\"ppg-dropdown-presence\"\n data-status=${user.status}\n ></span>\n ${this.formatStatus(user.status)}\n </div>\n `\n : nothing\n }\n </div>\n </div>\n `;\n }\n\n private formatStatus(status: string): string {\n const labels: Record<string, string> = {\n online: \"Online\",\n away: \"Away\",\n busy: \"Busy\",\n offline: \"Offline\",\n dnd: \"Do not disturb\",\n };\n return labels[status] ?? status;\n }\n\n protected updated(changedProperties: Map<PropertyKey, unknown>) {\n super.updated(changedProperties);\n\n // Update counter ref after render\n const counter = this.querySelector(\".ppg-counter\") as HTMLButtonElement;\n if (counter) {\n this.counterRef = counter;\n }\n\n // Update portal content if dropdown is open\n if (this.dropdownOpen && this.portalContainer) {\n const { visible } = calculateAvatarCounts(\n this.users.length,\n this.max,\n this.showAddButton\n );\n const hiddenUsers = this.users.slice(visible);\n this.updatePortalContent(hiddenUsers);\n }\n }\n\n render() {\n const { visible, hidden, showCounter } = calculateAvatarCounts(\n this.users.length,\n this.max,\n this.showAddButton\n );\n\n // Determine which users to show\n const visibleUsers =\n this.direction === \"ltr\"\n ? this.users.slice(0, visible)\n : this.users.slice(0, visible).reverse();\n\n const hiddenUsers = this.users.slice(visible);\n\n // Calculate element count for width\n let elementCount = visible;\n if (showCounter) {\n elementCount++;\n }\n if (this.showAddButton) {\n elementCount++;\n }\n\n const containerWidth = calculateGroupWidth(\n elementCount,\n this.pixelSize,\n this.overlap,\n this.spacing\n );\n\n // Calculate positions for counter and add button\n const counterPosition = showCounter\n ? calculateStackPosition(\n visible,\n this.pixelSize,\n this.overlap,\n this.direction,\n this.spacing\n )\n : 0;\n\n const addButtonPosition = calculateStackPosition(\n visible + (showCounter ? 1 : 0),\n this.pixelSize,\n this.overlap,\n this.direction,\n this.spacing\n );\n\n return html`\n <div\n class=${cn(\"ppg-container\", this.animated && \"ppg-animated\")}\n style=${styleMap({\n width: `${containerWidth}px`,\n height: `${this.pixelSize}px`,\n })}\n role=\"group\"\n aria-label=\"User avatars\"\n >\n <!-- Hidden slot for original children -->\n <slot style=\"display: none;\"></slot>\n\n <!-- Visible avatars -->\n ${visibleUsers.map((user, index) =>\n this.renderAvatar(user, index, visible)\n )}\n\n <!-- Counter -->\n ${showCounter ? this.renderCounter(hidden, counterPosition, hiddenUsers) : nothing}\n\n <!-- Add button -->\n ${this.showAddButton ? this.renderAddButton(addButtonPosition) : nothing}\n\n <!-- Tooltip -->\n ${this.renderTooltip()}\n </div>\n `;\n }\n}\n\n// Export types for TypeScript users\nexport type {\n DropdownConfig,\n GroupUserData,\n ProfilePictureGroupProps,\n StackDirection,\n TooltipConfig,\n TooltipPosition,\n} from \"./types\";\n\n// Register custom element with guard to prevent duplicate registration during HMR\nif (!customElements.get(\"profile-picture-group\")) {\n customElements.define(\"profile-picture-group\", ProfilePictureGroup);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"profile-picture-group\": ProfilePictureGroup;\n }\n}\n\nexport default ProfilePictureGroup;\n","/**\n * Standalone entry point for browser usage\n * This only includes the Lit web components without any framework wrappers\n */\n\n// Auto-load styles when module is imported\nimport { loadStyles } from \"./core/loadStyles\";\n\nloadStyles();\n\n// ProfilePicture types\nexport type {\n BadgeConfig,\n LoadingStrategy,\n PlaceholderType,\n Position,\n Size,\n Variant,\n} from \"./core/ProfilePicture\";\n\n// ProfilePictureGroup types\nexport type {\n DropdownConfig,\n GroupUserData,\n ProfilePictureGroupProps,\n StackDirection,\n TooltipConfig,\n TooltipPosition,\n} from \"./core/types\";\n\n// Import the web components to register them\nimport \"./core/ProfilePicture\";\nimport \"./core/ProfilePictureGroup\";\n"]}
|