chunk-IOZKU7B2.js 66 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953
  1. // node_modules/@stencil/core/internal/app-data/index.js
  2. var BUILD = {
  3. allRenderFn: false,
  4. cmpDidLoad: true,
  5. cmpDidUnload: false,
  6. cmpDidUpdate: true,
  7. cmpDidRender: true,
  8. cmpWillLoad: true,
  9. cmpWillUpdate: true,
  10. cmpWillRender: true,
  11. connectedCallback: true,
  12. disconnectedCallback: true,
  13. element: true,
  14. event: true,
  15. hasRenderFn: true,
  16. lifecycle: true,
  17. hostListener: true,
  18. hostListenerTargetWindow: true,
  19. hostListenerTargetDocument: true,
  20. hostListenerTargetBody: true,
  21. hostListenerTargetParent: false,
  22. hostListenerTarget: true,
  23. member: true,
  24. method: true,
  25. mode: true,
  26. observeAttribute: true,
  27. prop: true,
  28. propMutable: true,
  29. reflect: true,
  30. scoped: true,
  31. shadowDom: true,
  32. slot: true,
  33. cssAnnotations: true,
  34. state: true,
  35. style: true,
  36. svg: true,
  37. updatable: true,
  38. vdomAttribute: true,
  39. vdomXlink: true,
  40. vdomClass: true,
  41. vdomFunctional: true,
  42. vdomKey: true,
  43. vdomListener: true,
  44. vdomRef: true,
  45. vdomPropOrAttr: true,
  46. vdomRender: true,
  47. vdomStyle: true,
  48. vdomText: true,
  49. watchCallback: true,
  50. taskQueue: true,
  51. hotModuleReplacement: false,
  52. isDebug: false,
  53. isDev: false,
  54. isTesting: false,
  55. hydrateServerSide: false,
  56. hydrateClientSide: false,
  57. lifecycleDOMEvents: false,
  58. lazyLoad: false,
  59. profile: false,
  60. slotRelocation: true,
  61. appendChildSlotFix: false,
  62. cloneNodeFix: false,
  63. hydratedAttribute: false,
  64. hydratedClass: true,
  65. safari10: false,
  66. scriptDataOpts: false,
  67. scopedSlotTextContentFix: false,
  68. shadowDomShim: false,
  69. slotChildNodesFix: false,
  70. invisiblePrehydration: true,
  71. propBoolean: true,
  72. propNumber: true,
  73. propString: true,
  74. cssVarShim: false,
  75. constructableCSS: true,
  76. cmpShouldUpdate: true,
  77. devTools: false,
  78. dynamicImportShim: false,
  79. shadowDelegatesFocus: true,
  80. initializeNextTick: false,
  81. asyncLoading: false,
  82. asyncQueue: false,
  83. transformTagName: false,
  84. attachStyles: true
  85. };
  86. var NAMESPACE = "app";
  87. // node_modules/@stencil/core/internal/client/index.js
  88. var scopeId;
  89. var contentRef;
  90. var hostTagName;
  91. var customError;
  92. var i = 0;
  93. var useNativeShadowDom = false;
  94. var checkSlotFallbackVisibility = false;
  95. var checkSlotRelocate = false;
  96. var isSvgMode = false;
  97. var renderingRef = null;
  98. var queueCongestion = 0;
  99. var queuePending = false;
  100. var Build = {
  101. isDev: BUILD.isDev ? true : false,
  102. isBrowser: true,
  103. isServer: false,
  104. isTesting: BUILD.isTesting ? true : false
  105. };
  106. var getAssetPath = (path) => {
  107. const assetUrl = new URL(path, plt.$resourcesUrl$);
  108. return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
  109. };
  110. var setAssetPath = (path) => plt.$resourcesUrl$ = path;
  111. var createTime = (fnName, tagName = "") => {
  112. if (BUILD.profile && performance.mark) {
  113. const key = `st:${fnName}:${tagName}:${i++}`;
  114. performance.mark(key);
  115. return () => performance.measure(`[Stencil] ${fnName}() <${tagName}>`, key);
  116. } else {
  117. return () => {
  118. return;
  119. };
  120. }
  121. };
  122. var uniqueTime = (key, measureText) => {
  123. if (BUILD.profile && performance.mark) {
  124. if (performance.getEntriesByName(key).length === 0) {
  125. performance.mark(key);
  126. }
  127. return () => {
  128. if (performance.getEntriesByName(measureText).length === 0) {
  129. performance.measure(measureText, key);
  130. }
  131. };
  132. } else {
  133. return () => {
  134. return;
  135. };
  136. }
  137. };
  138. var CONTENT_REF_ID = "r";
  139. var ORG_LOCATION_ID = "o";
  140. var SLOT_NODE_ID = "s";
  141. var TEXT_NODE_ID = "t";
  142. var HYDRATE_ID = "s-id";
  143. var HYDRATED_STYLE_ID = "sty-id";
  144. var HYDRATE_CHILD_ID = "c-id";
  145. var XLINK_NS = "http://www.w3.org/1999/xlink";
  146. var EMPTY_OBJ = {};
  147. var SVG_NS = "http://www.w3.org/2000/svg";
  148. var HTML_NS = "http://www.w3.org/1999/xhtml";
  149. var isDef = (v) => v != null;
  150. var isComplexType = (o) => {
  151. o = typeof o;
  152. return o === "object" || o === "function";
  153. };
  154. var h = (nodeName, vnodeData, ...children) => {
  155. let child = null;
  156. let key = null;
  157. let slotName = null;
  158. let simple = false;
  159. let lastSimple = false;
  160. const vNodeChildren = [];
  161. const walk = (c) => {
  162. for (let i2 = 0; i2 < c.length; i2++) {
  163. child = c[i2];
  164. if (Array.isArray(child)) {
  165. walk(child);
  166. } else if (child != null && typeof child !== "boolean") {
  167. if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
  168. child = String(child);
  169. } else if (BUILD.isDev && typeof nodeName !== "function" && child.$flags$ === void 0) {
  170. consoleDevError(`vNode passed as children has unexpected type.
  171. Make sure it's using the correct h() function.
  172. Empty objects can also be the cause, look for JSX comments that became objects.`);
  173. }
  174. if (simple && lastSimple) {
  175. vNodeChildren[vNodeChildren.length - 1].$text$ += child;
  176. } else {
  177. vNodeChildren.push(simple ? newVNode(null, child) : child);
  178. }
  179. lastSimple = simple;
  180. }
  181. }
  182. };
  183. walk(children);
  184. if (vnodeData) {
  185. if (BUILD.isDev && nodeName === "input") {
  186. validateInputProperties(vnodeData);
  187. }
  188. if (BUILD.vdomKey && vnodeData.key) {
  189. key = vnodeData.key;
  190. }
  191. if (BUILD.slotRelocation && vnodeData.name) {
  192. slotName = vnodeData.name;
  193. }
  194. if (BUILD.vdomClass) {
  195. const classData = vnodeData.className || vnodeData.class;
  196. if (classData) {
  197. vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
  198. }
  199. }
  200. }
  201. if (BUILD.isDev && vNodeChildren.some(isHost)) {
  202. consoleDevError(`The <Host> must be the single root component. Make sure:
  203. - You are NOT using hostData() and <Host> in the same component.
  204. - <Host> is used once, and it's the single root component of the render() function.`);
  205. }
  206. if (BUILD.vdomFunctional && typeof nodeName === "function") {
  207. return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
  208. }
  209. const vnode = newVNode(nodeName, null);
  210. vnode.$attrs$ = vnodeData;
  211. if (vNodeChildren.length > 0) {
  212. vnode.$children$ = vNodeChildren;
  213. }
  214. if (BUILD.vdomKey) {
  215. vnode.$key$ = key;
  216. }
  217. if (BUILD.slotRelocation) {
  218. vnode.$name$ = slotName;
  219. }
  220. return vnode;
  221. };
  222. var newVNode = (tag, text) => {
  223. const vnode = {
  224. $flags$: 0,
  225. $tag$: tag,
  226. $text$: text,
  227. $elm$: null,
  228. $children$: null
  229. };
  230. if (BUILD.vdomAttribute) {
  231. vnode.$attrs$ = null;
  232. }
  233. if (BUILD.vdomKey) {
  234. vnode.$key$ = null;
  235. }
  236. if (BUILD.slotRelocation) {
  237. vnode.$name$ = null;
  238. }
  239. return vnode;
  240. };
  241. var Host = {};
  242. var isHost = (node) => node && node.$tag$ === Host;
  243. var vdomFnUtils = {
  244. forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
  245. map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate)
  246. };
  247. var convertToPublic = (node) => ({
  248. vattrs: node.$attrs$,
  249. vchildren: node.$children$,
  250. vkey: node.$key$,
  251. vname: node.$name$,
  252. vtag: node.$tag$,
  253. vtext: node.$text$
  254. });
  255. var convertToPrivate = (node) => {
  256. if (typeof node.vtag === "function") {
  257. const vnodeData = Object.assign({}, node.vattrs);
  258. if (node.vkey) {
  259. vnodeData.key = node.vkey;
  260. }
  261. if (node.vname) {
  262. vnodeData.name = node.vname;
  263. }
  264. return h(node.vtag, vnodeData, ...node.vchildren || []);
  265. }
  266. const vnode = newVNode(node.vtag, node.vtext);
  267. vnode.$attrs$ = node.vattrs;
  268. vnode.$children$ = node.vchildren;
  269. vnode.$key$ = node.vkey;
  270. vnode.$name$ = node.vname;
  271. return vnode;
  272. };
  273. var validateInputProperties = (inputElm) => {
  274. const props = Object.keys(inputElm);
  275. const value = props.indexOf("value");
  276. if (value === -1) {
  277. return;
  278. }
  279. const typeIndex = props.indexOf("type");
  280. const minIndex = props.indexOf("min");
  281. const maxIndex = props.indexOf("max");
  282. const stepIndex = props.indexOf("step");
  283. if (value < typeIndex || value < minIndex || value < maxIndex || value < stepIndex) {
  284. consoleDevWarn(`The "value" prop of <input> should be set after "min", "max", "type" and "step"`);
  285. }
  286. };
  287. var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
  288. const endHydrate = createTime("hydrateClient", tagName);
  289. const shadowRoot = hostElm.shadowRoot;
  290. const childRenderNodes = [];
  291. const slotNodes = [];
  292. const shadowRootNodes = BUILD.shadowDom && shadowRoot ? [] : null;
  293. const vnode = hostRef.$vnode$ = newVNode(tagName, null);
  294. if (!plt.$orgLocNodes$) {
  295. initializeDocumentHydrate(doc.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map());
  296. }
  297. hostElm[HYDRATE_ID] = hostId;
  298. hostElm.removeAttribute(HYDRATE_ID);
  299. clientHydrate(vnode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, hostElm, hostId);
  300. childRenderNodes.map((c) => {
  301. const orgLocationId = c.$hostId$ + "." + c.$nodeId$;
  302. const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
  303. const node = c.$elm$;
  304. if (orgLocationNode && supportsShadow && orgLocationNode["s-en"] === "") {
  305. orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
  306. }
  307. if (!shadowRoot) {
  308. node["s-hn"] = tagName;
  309. if (orgLocationNode) {
  310. node["s-ol"] = orgLocationNode;
  311. node["s-ol"]["s-nr"] = node;
  312. }
  313. }
  314. plt.$orgLocNodes$.delete(orgLocationId);
  315. });
  316. if (BUILD.shadowDom && shadowRoot) {
  317. shadowRootNodes.map((shadowRootNode) => {
  318. if (shadowRootNode) {
  319. shadowRoot.appendChild(shadowRootNode);
  320. }
  321. });
  322. }
  323. endHydrate();
  324. };
  325. var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId) => {
  326. let childNodeType;
  327. let childIdSplt;
  328. let childVNode;
  329. let i2;
  330. if (node.nodeType === 1) {
  331. childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
  332. if (childNodeType) {
  333. childIdSplt = childNodeType.split(".");
  334. if (childIdSplt[0] === hostId || childIdSplt[0] === "0") {
  335. childVNode = {
  336. $flags$: 0,
  337. $hostId$: childIdSplt[0],
  338. $nodeId$: childIdSplt[1],
  339. $depth$: childIdSplt[2],
  340. $index$: childIdSplt[3],
  341. $tag$: node.tagName.toLowerCase(),
  342. $elm$: node,
  343. $attrs$: null,
  344. $children$: null,
  345. $key$: null,
  346. $name$: null,
  347. $text$: null
  348. };
  349. childRenderNodes.push(childVNode);
  350. node.removeAttribute(HYDRATE_CHILD_ID);
  351. if (!parentVNode.$children$) {
  352. parentVNode.$children$ = [];
  353. }
  354. parentVNode.$children$[childVNode.$index$] = childVNode;
  355. parentVNode = childVNode;
  356. if (shadowRootNodes && childVNode.$depth$ === "0") {
  357. shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
  358. }
  359. }
  360. }
  361. for (i2 = node.childNodes.length - 1; i2 >= 0; i2--) {
  362. clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.childNodes[i2], hostId);
  363. }
  364. if (node.shadowRoot) {
  365. for (i2 = node.shadowRoot.childNodes.length - 1; i2 >= 0; i2--) {
  366. clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.shadowRoot.childNodes[i2], hostId);
  367. }
  368. }
  369. } else if (node.nodeType === 8) {
  370. childIdSplt = node.nodeValue.split(".");
  371. if (childIdSplt[1] === hostId || childIdSplt[1] === "0") {
  372. childNodeType = childIdSplt[0];
  373. childVNode = {
  374. $flags$: 0,
  375. $hostId$: childIdSplt[1],
  376. $nodeId$: childIdSplt[2],
  377. $depth$: childIdSplt[3],
  378. $index$: childIdSplt[4],
  379. $elm$: node,
  380. $attrs$: null,
  381. $children$: null,
  382. $key$: null,
  383. $name$: null,
  384. $tag$: null,
  385. $text$: null
  386. };
  387. if (childNodeType === TEXT_NODE_ID) {
  388. childVNode.$elm$ = node.nextSibling;
  389. if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3) {
  390. childVNode.$text$ = childVNode.$elm$.textContent;
  391. childRenderNodes.push(childVNode);
  392. node.remove();
  393. if (!parentVNode.$children$) {
  394. parentVNode.$children$ = [];
  395. }
  396. parentVNode.$children$[childVNode.$index$] = childVNode;
  397. if (shadowRootNodes && childVNode.$depth$ === "0") {
  398. shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
  399. }
  400. }
  401. } else if (childVNode.$hostId$ === hostId) {
  402. if (childNodeType === SLOT_NODE_ID) {
  403. childVNode.$tag$ = "slot";
  404. if (childIdSplt[5]) {
  405. node["s-sn"] = childVNode.$name$ = childIdSplt[5];
  406. } else {
  407. node["s-sn"] = "";
  408. }
  409. node["s-sr"] = true;
  410. if (BUILD.shadowDom && shadowRootNodes) {
  411. childVNode.$elm$ = doc.createElement(childVNode.$tag$);
  412. if (childVNode.$name$) {
  413. childVNode.$elm$.setAttribute("name", childVNode.$name$);
  414. }
  415. node.parentNode.insertBefore(childVNode.$elm$, node);
  416. node.remove();
  417. if (childVNode.$depth$ === "0") {
  418. shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
  419. }
  420. }
  421. slotNodes.push(childVNode);
  422. if (!parentVNode.$children$) {
  423. parentVNode.$children$ = [];
  424. }
  425. parentVNode.$children$[childVNode.$index$] = childVNode;
  426. } else if (childNodeType === CONTENT_REF_ID) {
  427. if (BUILD.shadowDom && shadowRootNodes) {
  428. node.remove();
  429. } else if (BUILD.slotRelocation) {
  430. hostElm["s-cr"] = node;
  431. node["s-cn"] = true;
  432. }
  433. }
  434. }
  435. }
  436. } else if (parentVNode && parentVNode.$tag$ === "style") {
  437. const vnode = newVNode(null, node.textContent);
  438. vnode.$elm$ = node;
  439. vnode.$index$ = "0";
  440. parentVNode.$children$ = [vnode];
  441. }
  442. };
  443. var initializeDocumentHydrate = (node, orgLocNodes) => {
  444. if (node.nodeType === 1) {
  445. let i2 = 0;
  446. for (; i2 < node.childNodes.length; i2++) {
  447. initializeDocumentHydrate(node.childNodes[i2], orgLocNodes);
  448. }
  449. if (node.shadowRoot) {
  450. for (i2 = 0; i2 < node.shadowRoot.childNodes.length; i2++) {
  451. initializeDocumentHydrate(node.shadowRoot.childNodes[i2], orgLocNodes);
  452. }
  453. }
  454. } else if (node.nodeType === 8) {
  455. const childIdSplt = node.nodeValue.split(".");
  456. if (childIdSplt[0] === ORG_LOCATION_ID) {
  457. orgLocNodes.set(childIdSplt[1] + "." + childIdSplt[2], node);
  458. node.nodeValue = "";
  459. node["s-en"] = childIdSplt[3];
  460. }
  461. }
  462. };
  463. var computeMode = (elm) => modeResolutionChain.map((h2) => h2(elm)).find((m) => !!m);
  464. var parsePropertyValue = (propValue, propType) => {
  465. if (propValue != null && !isComplexType(propValue)) {
  466. if (BUILD.propBoolean && propType & 4) {
  467. return propValue === "false" ? false : propValue === "" || !!propValue;
  468. }
  469. if (BUILD.propNumber && propType & 2) {
  470. return parseFloat(propValue);
  471. }
  472. if (BUILD.propString && propType & 1) {
  473. return String(propValue);
  474. }
  475. return propValue;
  476. }
  477. return propValue;
  478. };
  479. var getElement = (ref) => BUILD.lazyLoad ? getHostRef(ref).$hostElement$ : ref;
  480. var createEvent = (ref, name, flags) => {
  481. const elm = getElement(ref);
  482. return {
  483. emit: (detail) => {
  484. if (BUILD.isDev && !elm.isConnected) {
  485. consoleDevWarn(`The "${name}" event was emitted, but the dispatcher node is no longer connected to the dom.`);
  486. }
  487. return emitEvent(elm, name, {
  488. bubbles: !!(flags & 4),
  489. composed: !!(flags & 2),
  490. cancelable: !!(flags & 1),
  491. detail
  492. });
  493. }
  494. };
  495. };
  496. var emitEvent = (elm, name, opts) => {
  497. const ev = plt.ce(name, opts);
  498. elm.dispatchEvent(ev);
  499. return ev;
  500. };
  501. var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
  502. var registerStyle = (scopeId2, cssText, allowCS) => {
  503. let style = styles.get(scopeId2);
  504. if (supportsConstructableStylesheets && allowCS) {
  505. style = style || new CSSStyleSheet();
  506. if (typeof style === "string") {
  507. style = cssText;
  508. } else {
  509. style.replaceSync(cssText);
  510. }
  511. } else {
  512. style = cssText;
  513. }
  514. styles.set(scopeId2, style);
  515. };
  516. var addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
  517. let scopeId2 = getScopeId(cmpMeta, mode);
  518. const style = styles.get(scopeId2);
  519. if (!BUILD.attachStyles) {
  520. return scopeId2;
  521. }
  522. styleContainerNode = styleContainerNode.nodeType === 11 ? styleContainerNode : doc;
  523. if (style) {
  524. if (typeof style === "string") {
  525. styleContainerNode = styleContainerNode.head || styleContainerNode;
  526. let appliedStyles = rootAppliedStyles.get(styleContainerNode);
  527. let styleElm;
  528. if (!appliedStyles) {
  529. rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
  530. }
  531. if (!appliedStyles.has(scopeId2)) {
  532. if (BUILD.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
  533. styleElm.innerHTML = style;
  534. } else {
  535. if (BUILD.cssVarShim && plt.$cssShim$) {
  536. styleElm = plt.$cssShim$.createHostStyle(hostElm, scopeId2, style, !!(cmpMeta.$flags$ & 10));
  537. const newScopeId = styleElm["s-sc"];
  538. if (newScopeId) {
  539. scopeId2 = newScopeId;
  540. appliedStyles = null;
  541. }
  542. } else {
  543. styleElm = doc.createElement("style");
  544. styleElm.innerHTML = style;
  545. }
  546. if (BUILD.hydrateServerSide || BUILD.hotModuleReplacement) {
  547. styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
  548. }
  549. styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector("link"));
  550. }
  551. if (appliedStyles) {
  552. appliedStyles.add(scopeId2);
  553. }
  554. }
  555. } else if (BUILD.constructableCSS && !styleContainerNode.adoptedStyleSheets.includes(style)) {
  556. styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
  557. }
  558. }
  559. return scopeId2;
  560. };
  561. var attachStyles = (hostRef) => {
  562. const cmpMeta = hostRef.$cmpMeta$;
  563. const elm = hostRef.$hostElement$;
  564. const flags = cmpMeta.$flags$;
  565. const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
  566. const scopeId2 = addStyle(BUILD.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta, hostRef.$modeName$, elm);
  567. if ((BUILD.shadowDom || BUILD.scoped) && BUILD.cssAnnotations && flags & 10) {
  568. elm["s-sc"] = scopeId2;
  569. elm.classList.add(scopeId2 + "-h");
  570. if (BUILD.scoped && flags & 2) {
  571. elm.classList.add(scopeId2 + "-s");
  572. }
  573. }
  574. endAttachStyles();
  575. };
  576. var getScopeId = (cmp, mode) => "sc-" + (BUILD.mode && mode && cmp.$flags$ & 32 ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
  577. var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
  578. if (oldValue !== newValue) {
  579. let isProp = isMemberInElement(elm, memberName);
  580. let ln = memberName.toLowerCase();
  581. if (BUILD.vdomClass && memberName === "class") {
  582. const classList = elm.classList;
  583. const oldClasses = parseClassList(oldValue);
  584. const newClasses = parseClassList(newValue);
  585. classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
  586. classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
  587. } else if (BUILD.vdomStyle && memberName === "style") {
  588. if (BUILD.updatable) {
  589. for (const prop in oldValue) {
  590. if (!newValue || newValue[prop] == null) {
  591. if (!BUILD.hydrateServerSide && prop.includes("-")) {
  592. elm.style.removeProperty(prop);
  593. } else {
  594. elm.style[prop] = "";
  595. }
  596. }
  597. }
  598. }
  599. for (const prop in newValue) {
  600. if (!oldValue || newValue[prop] !== oldValue[prop]) {
  601. if (!BUILD.hydrateServerSide && prop.includes("-")) {
  602. elm.style.setProperty(prop, newValue[prop]);
  603. } else {
  604. elm.style[prop] = newValue[prop];
  605. }
  606. }
  607. }
  608. } else if (BUILD.vdomKey && memberName === "key")
  609. ;
  610. else if (BUILD.vdomRef && memberName === "ref") {
  611. if (newValue) {
  612. newValue(elm);
  613. }
  614. } else if (BUILD.vdomListener && (BUILD.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
  615. if (memberName[2] === "-") {
  616. memberName = memberName.slice(3);
  617. } else if (isMemberInElement(win, ln)) {
  618. memberName = ln.slice(2);
  619. } else {
  620. memberName = ln[2] + memberName.slice(3);
  621. }
  622. if (oldValue) {
  623. plt.rel(elm, memberName, oldValue, false);
  624. }
  625. if (newValue) {
  626. plt.ael(elm, memberName, newValue, false);
  627. }
  628. } else if (BUILD.vdomPropOrAttr) {
  629. const isComplex = isComplexType(newValue);
  630. if ((isProp || isComplex && newValue !== null) && !isSvg) {
  631. try {
  632. if (!elm.tagName.includes("-")) {
  633. const n = newValue == null ? "" : newValue;
  634. if (memberName === "list") {
  635. isProp = false;
  636. } else if (oldValue == null || elm[memberName] != n) {
  637. elm[memberName] = n;
  638. }
  639. } else {
  640. elm[memberName] = newValue;
  641. }
  642. } catch (e) {
  643. }
  644. }
  645. let xlink = false;
  646. if (BUILD.vdomXlink) {
  647. if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
  648. memberName = ln;
  649. xlink = true;
  650. }
  651. }
  652. if (newValue == null || newValue === false) {
  653. if (newValue !== false || elm.getAttribute(memberName) === "") {
  654. if (BUILD.vdomXlink && xlink) {
  655. elm.removeAttributeNS(XLINK_NS, memberName);
  656. } else {
  657. elm.removeAttribute(memberName);
  658. }
  659. }
  660. } else if ((!isProp || flags & 4 || isSvg) && !isComplex) {
  661. newValue = newValue === true ? "" : newValue;
  662. if (BUILD.vdomXlink && xlink) {
  663. elm.setAttributeNS(XLINK_NS, memberName, newValue);
  664. } else {
  665. elm.setAttribute(memberName, newValue);
  666. }
  667. }
  668. }
  669. }
  670. };
  671. var parseClassListRegex = /\s/;
  672. var parseClassList = (value) => !value ? [] : value.split(parseClassListRegex);
  673. var updateElement = (oldVnode, newVnode, isSvgMode2, memberName) => {
  674. const elm = newVnode.$elm$.nodeType === 11 && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
  675. const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || EMPTY_OBJ;
  676. const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
  677. if (BUILD.updatable) {
  678. for (memberName in oldVnodeAttrs) {
  679. if (!(memberName in newVnodeAttrs)) {
  680. setAccessor(elm, memberName, oldVnodeAttrs[memberName], void 0, isSvgMode2, newVnode.$flags$);
  681. }
  682. }
  683. }
  684. for (memberName in newVnodeAttrs) {
  685. setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode2, newVnode.$flags$);
  686. }
  687. };
  688. var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
  689. const newVNode2 = newParentVNode.$children$[childIndex];
  690. let i2 = 0;
  691. let elm;
  692. let childNode;
  693. let oldVNode;
  694. if (BUILD.slotRelocation && !useNativeShadowDom) {
  695. checkSlotRelocate = true;
  696. if (newVNode2.$tag$ === "slot") {
  697. if (scopeId) {
  698. parentElm.classList.add(scopeId + "-s");
  699. }
  700. newVNode2.$flags$ |= newVNode2.$children$ ? 2 : 1;
  701. }
  702. }
  703. if (BUILD.isDev && newVNode2.$elm$) {
  704. consoleDevError(`The JSX ${newVNode2.$text$ !== null ? `"${newVNode2.$text$}" text` : `"${newVNode2.$tag$}" element`} node should not be shared within the same renderer. The renderer caches element lookups in order to improve performance. However, a side effect from this is that the exact same JSX node should not be reused. For more information please see https://stenciljs.com/docs/templating-jsx#avoid-shared-jsx-nodes`);
  705. }
  706. if (BUILD.vdomText && newVNode2.$text$ !== null) {
  707. elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
  708. } else if (BUILD.slotRelocation && newVNode2.$flags$ & 1) {
  709. elm = newVNode2.$elm$ = BUILD.isDebug || BUILD.hydrateServerSide ? slotReferenceDebugNode(newVNode2) : doc.createTextNode("");
  710. } else {
  711. if (BUILD.svg && !isSvgMode) {
  712. isSvgMode = newVNode2.$tag$ === "svg";
  713. }
  714. elm = newVNode2.$elm$ = BUILD.svg ? doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, BUILD.slotRelocation && newVNode2.$flags$ & 2 ? "slot-fb" : newVNode2.$tag$) : doc.createElement(BUILD.slotRelocation && newVNode2.$flags$ & 2 ? "slot-fb" : newVNode2.$tag$);
  715. if (BUILD.svg && isSvgMode && newVNode2.$tag$ === "foreignObject") {
  716. isSvgMode = false;
  717. }
  718. if (BUILD.vdomAttribute) {
  719. updateElement(null, newVNode2, isSvgMode);
  720. }
  721. if ((BUILD.shadowDom || BUILD.scoped) && isDef(scopeId) && elm["s-si"] !== scopeId) {
  722. elm.classList.add(elm["s-si"] = scopeId);
  723. }
  724. if (newVNode2.$children$) {
  725. for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
  726. childNode = createElm(oldParentVNode, newVNode2, i2, elm);
  727. if (childNode) {
  728. elm.appendChild(childNode);
  729. }
  730. }
  731. }
  732. if (BUILD.svg) {
  733. if (newVNode2.$tag$ === "svg") {
  734. isSvgMode = false;
  735. } else if (elm.tagName === "foreignObject") {
  736. isSvgMode = true;
  737. }
  738. }
  739. }
  740. if (BUILD.slotRelocation) {
  741. elm["s-hn"] = hostTagName;
  742. if (newVNode2.$flags$ & (2 | 1)) {
  743. elm["s-sr"] = true;
  744. elm["s-cr"] = contentRef;
  745. elm["s-sn"] = newVNode2.$name$ || "";
  746. oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
  747. if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
  748. putBackInOriginalLocation(oldParentVNode.$elm$, false);
  749. }
  750. }
  751. }
  752. return elm;
  753. };
  754. var putBackInOriginalLocation = (parentElm, recursive) => {
  755. plt.$flags$ |= 1;
  756. const oldSlotChildNodes = parentElm.childNodes;
  757. for (let i2 = oldSlotChildNodes.length - 1; i2 >= 0; i2--) {
  758. const childNode = oldSlotChildNodes[i2];
  759. if (childNode["s-hn"] !== hostTagName && childNode["s-ol"]) {
  760. parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
  761. childNode["s-ol"].remove();
  762. childNode["s-ol"] = void 0;
  763. checkSlotRelocate = true;
  764. }
  765. if (recursive) {
  766. putBackInOriginalLocation(childNode, recursive);
  767. }
  768. }
  769. plt.$flags$ &= ~1;
  770. };
  771. var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
  772. let containerElm = BUILD.slotRelocation && parentElm["s-cr"] && parentElm["s-cr"].parentNode || parentElm;
  773. let childNode;
  774. if (BUILD.shadowDom && containerElm.shadowRoot && containerElm.tagName === hostTagName) {
  775. containerElm = containerElm.shadowRoot;
  776. }
  777. for (; startIdx <= endIdx; ++startIdx) {
  778. if (vnodes[startIdx]) {
  779. childNode = createElm(null, parentVNode, startIdx, parentElm);
  780. if (childNode) {
  781. vnodes[startIdx].$elm$ = childNode;
  782. containerElm.insertBefore(childNode, BUILD.slotRelocation ? referenceNode(before) : before);
  783. }
  784. }
  785. }
  786. };
  787. var removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
  788. for (; startIdx <= endIdx; ++startIdx) {
  789. if (vnode = vnodes[startIdx]) {
  790. elm = vnode.$elm$;
  791. callNodeRefs(vnode);
  792. if (BUILD.slotRelocation) {
  793. checkSlotFallbackVisibility = true;
  794. if (elm["s-ol"]) {
  795. elm["s-ol"].remove();
  796. } else {
  797. putBackInOriginalLocation(elm, true);
  798. }
  799. }
  800. elm.remove();
  801. }
  802. }
  803. };
  804. var updateChildren = (parentElm, oldCh, newVNode2, newCh) => {
  805. let oldStartIdx = 0;
  806. let newStartIdx = 0;
  807. let idxInOld = 0;
  808. let i2 = 0;
  809. let oldEndIdx = oldCh.length - 1;
  810. let oldStartVnode = oldCh[0];
  811. let oldEndVnode = oldCh[oldEndIdx];
  812. let newEndIdx = newCh.length - 1;
  813. let newStartVnode = newCh[0];
  814. let newEndVnode = newCh[newEndIdx];
  815. let node;
  816. let elmToMove;
  817. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  818. if (oldStartVnode == null) {
  819. oldStartVnode = oldCh[++oldStartIdx];
  820. } else if (oldEndVnode == null) {
  821. oldEndVnode = oldCh[--oldEndIdx];
  822. } else if (newStartVnode == null) {
  823. newStartVnode = newCh[++newStartIdx];
  824. } else if (newEndVnode == null) {
  825. newEndVnode = newCh[--newEndIdx];
  826. } else if (isSameVnode(oldStartVnode, newStartVnode)) {
  827. patch(oldStartVnode, newStartVnode);
  828. oldStartVnode = oldCh[++oldStartIdx];
  829. newStartVnode = newCh[++newStartIdx];
  830. } else if (isSameVnode(oldEndVnode, newEndVnode)) {
  831. patch(oldEndVnode, newEndVnode);
  832. oldEndVnode = oldCh[--oldEndIdx];
  833. newEndVnode = newCh[--newEndIdx];
  834. } else if (isSameVnode(oldStartVnode, newEndVnode)) {
  835. if (BUILD.slotRelocation && (oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
  836. putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
  837. }
  838. patch(oldStartVnode, newEndVnode);
  839. parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
  840. oldStartVnode = oldCh[++oldStartIdx];
  841. newEndVnode = newCh[--newEndIdx];
  842. } else if (isSameVnode(oldEndVnode, newStartVnode)) {
  843. if (BUILD.slotRelocation && (oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
  844. putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
  845. }
  846. patch(oldEndVnode, newStartVnode);
  847. parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
  848. oldEndVnode = oldCh[--oldEndIdx];
  849. newStartVnode = newCh[++newStartIdx];
  850. } else {
  851. idxInOld = -1;
  852. if (BUILD.vdomKey) {
  853. for (i2 = oldStartIdx; i2 <= oldEndIdx; ++i2) {
  854. if (oldCh[i2] && oldCh[i2].$key$ !== null && oldCh[i2].$key$ === newStartVnode.$key$) {
  855. idxInOld = i2;
  856. break;
  857. }
  858. }
  859. }
  860. if (BUILD.vdomKey && idxInOld >= 0) {
  861. elmToMove = oldCh[idxInOld];
  862. if (elmToMove.$tag$ !== newStartVnode.$tag$) {
  863. node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld, parentElm);
  864. } else {
  865. patch(elmToMove, newStartVnode);
  866. oldCh[idxInOld] = void 0;
  867. node = elmToMove.$elm$;
  868. }
  869. newStartVnode = newCh[++newStartIdx];
  870. } else {
  871. node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx, parentElm);
  872. newStartVnode = newCh[++newStartIdx];
  873. }
  874. if (node) {
  875. if (BUILD.slotRelocation) {
  876. parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
  877. } else {
  878. oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
  879. }
  880. }
  881. }
  882. }
  883. if (oldStartIdx > oldEndIdx) {
  884. addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode2, newCh, newStartIdx, newEndIdx);
  885. } else if (BUILD.updatable && newStartIdx > newEndIdx) {
  886. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  887. }
  888. };
  889. var isSameVnode = (leftVNode, rightVNode) => {
  890. if (leftVNode.$tag$ === rightVNode.$tag$) {
  891. if (BUILD.slotRelocation && leftVNode.$tag$ === "slot") {
  892. return leftVNode.$name$ === rightVNode.$name$;
  893. }
  894. if (BUILD.vdomKey) {
  895. return leftVNode.$key$ === rightVNode.$key$;
  896. }
  897. return true;
  898. }
  899. return false;
  900. };
  901. var referenceNode = (node) => {
  902. return node && node["s-ol"] || node;
  903. };
  904. var parentReferenceNode = (node) => (node["s-ol"] ? node["s-ol"] : node).parentNode;
  905. var patch = (oldVNode, newVNode2) => {
  906. const elm = newVNode2.$elm$ = oldVNode.$elm$;
  907. const oldChildren = oldVNode.$children$;
  908. const newChildren = newVNode2.$children$;
  909. const tag = newVNode2.$tag$;
  910. const text = newVNode2.$text$;
  911. let defaultHolder;
  912. if (!BUILD.vdomText || text === null) {
  913. if (BUILD.svg) {
  914. isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
  915. }
  916. if (BUILD.vdomAttribute || BUILD.reflect) {
  917. if (BUILD.slot && tag === "slot")
  918. ;
  919. else {
  920. updateElement(oldVNode, newVNode2, isSvgMode);
  921. }
  922. }
  923. if (BUILD.updatable && oldChildren !== null && newChildren !== null) {
  924. updateChildren(elm, oldChildren, newVNode2, newChildren);
  925. } else if (newChildren !== null) {
  926. if (BUILD.updatable && BUILD.vdomText && oldVNode.$text$ !== null) {
  927. elm.textContent = "";
  928. }
  929. addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1);
  930. } else if (BUILD.updatable && oldChildren !== null) {
  931. removeVnodes(oldChildren, 0, oldChildren.length - 1);
  932. }
  933. if (BUILD.svg && isSvgMode && tag === "svg") {
  934. isSvgMode = false;
  935. }
  936. } else if (BUILD.vdomText && BUILD.slotRelocation && (defaultHolder = elm["s-cr"])) {
  937. defaultHolder.parentNode.textContent = text;
  938. } else if (BUILD.vdomText && oldVNode.$text$ !== text) {
  939. elm.data = text;
  940. }
  941. };
  942. var updateFallbackSlotVisibility = (elm) => {
  943. const childNodes = elm.childNodes;
  944. let childNode;
  945. let i2;
  946. let ilen;
  947. let j;
  948. let slotNameAttr;
  949. let nodeType;
  950. for (i2 = 0, ilen = childNodes.length; i2 < ilen; i2++) {
  951. childNode = childNodes[i2];
  952. if (childNode.nodeType === 1) {
  953. if (childNode["s-sr"]) {
  954. slotNameAttr = childNode["s-sn"];
  955. childNode.hidden = false;
  956. for (j = 0; j < ilen; j++) {
  957. nodeType = childNodes[j].nodeType;
  958. if (childNodes[j]["s-hn"] !== childNode["s-hn"] || slotNameAttr !== "") {
  959. if (nodeType === 1 && slotNameAttr === childNodes[j].getAttribute("slot")) {
  960. childNode.hidden = true;
  961. break;
  962. }
  963. } else {
  964. if (nodeType === 1 || nodeType === 3 && childNodes[j].textContent.trim() !== "") {
  965. childNode.hidden = true;
  966. break;
  967. }
  968. }
  969. }
  970. }
  971. updateFallbackSlotVisibility(childNode);
  972. }
  973. }
  974. };
  975. var relocateNodes = [];
  976. var relocateSlotContent = (elm) => {
  977. let childNode;
  978. let node;
  979. let hostContentNodes;
  980. let slotNameAttr;
  981. let relocateNodeData;
  982. let j;
  983. let i2 = 0;
  984. const childNodes = elm.childNodes;
  985. const ilen = childNodes.length;
  986. for (; i2 < ilen; i2++) {
  987. childNode = childNodes[i2];
  988. if (childNode["s-sr"] && (node = childNode["s-cr"]) && node.parentNode) {
  989. hostContentNodes = node.parentNode.childNodes;
  990. slotNameAttr = childNode["s-sn"];
  991. for (j = hostContentNodes.length - 1; j >= 0; j--) {
  992. node = hostContentNodes[j];
  993. if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"]) {
  994. if (isNodeLocatedInSlot(node, slotNameAttr)) {
  995. relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
  996. checkSlotFallbackVisibility = true;
  997. node["s-sn"] = node["s-sn"] || slotNameAttr;
  998. if (relocateNodeData) {
  999. relocateNodeData.$slotRefNode$ = childNode;
  1000. } else {
  1001. relocateNodes.push({
  1002. $slotRefNode$: childNode,
  1003. $nodeToRelocate$: node
  1004. });
  1005. }
  1006. if (node["s-sr"]) {
  1007. relocateNodes.map((relocateNode) => {
  1008. if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node["s-sn"])) {
  1009. relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
  1010. if (relocateNodeData && !relocateNode.$slotRefNode$) {
  1011. relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
  1012. }
  1013. }
  1014. });
  1015. }
  1016. } else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
  1017. relocateNodes.push({
  1018. $nodeToRelocate$: node
  1019. });
  1020. }
  1021. }
  1022. }
  1023. }
  1024. if (childNode.nodeType === 1) {
  1025. relocateSlotContent(childNode);
  1026. }
  1027. }
  1028. };
  1029. var isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
  1030. if (nodeToRelocate.nodeType === 1) {
  1031. if (nodeToRelocate.getAttribute("slot") === null && slotNameAttr === "") {
  1032. return true;
  1033. }
  1034. if (nodeToRelocate.getAttribute("slot") === slotNameAttr) {
  1035. return true;
  1036. }
  1037. return false;
  1038. }
  1039. if (nodeToRelocate["s-sn"] === slotNameAttr) {
  1040. return true;
  1041. }
  1042. return slotNameAttr === "";
  1043. };
  1044. var callNodeRefs = (vNode) => {
  1045. if (BUILD.vdomRef) {
  1046. vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
  1047. vNode.$children$ && vNode.$children$.map(callNodeRefs);
  1048. }
  1049. };
  1050. var renderVdom = (hostRef, renderFnResults) => {
  1051. const hostElm = hostRef.$hostElement$;
  1052. const cmpMeta = hostRef.$cmpMeta$;
  1053. const oldVNode = hostRef.$vnode$ || newVNode(null, null);
  1054. const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
  1055. hostTagName = hostElm.tagName;
  1056. if (BUILD.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) {
  1057. throw new Error(`The <Host> must be the single root component.
  1058. Looks like the render() function of "${hostTagName.toLowerCase()}" is returning an array that contains the <Host>.
  1059. The render() function should look like this instead:
  1060. render() {
  1061. // Do not return an array
  1062. return (
  1063. <Host>{content}</Host>
  1064. );
  1065. }
  1066. `);
  1067. }
  1068. if (BUILD.reflect && cmpMeta.$attrsToReflect$) {
  1069. rootVnode.$attrs$ = rootVnode.$attrs$ || {};
  1070. cmpMeta.$attrsToReflect$.map(([propName, attribute]) => rootVnode.$attrs$[attribute] = hostElm[propName]);
  1071. }
  1072. rootVnode.$tag$ = null;
  1073. rootVnode.$flags$ |= 4;
  1074. hostRef.$vnode$ = rootVnode;
  1075. rootVnode.$elm$ = oldVNode.$elm$ = BUILD.shadowDom ? hostElm.shadowRoot || hostElm : hostElm;
  1076. if (BUILD.scoped || BUILD.shadowDom) {
  1077. scopeId = hostElm["s-sc"];
  1078. }
  1079. if (BUILD.slotRelocation) {
  1080. contentRef = hostElm["s-cr"];
  1081. useNativeShadowDom = supportsShadow && (cmpMeta.$flags$ & 1) !== 0;
  1082. checkSlotFallbackVisibility = false;
  1083. }
  1084. patch(oldVNode, rootVnode);
  1085. if (BUILD.slotRelocation) {
  1086. plt.$flags$ |= 1;
  1087. if (checkSlotRelocate) {
  1088. relocateSlotContent(rootVnode.$elm$);
  1089. let relocateData;
  1090. let nodeToRelocate;
  1091. let orgLocationNode;
  1092. let parentNodeRef;
  1093. let insertBeforeNode;
  1094. let refNode;
  1095. let i2 = 0;
  1096. for (; i2 < relocateNodes.length; i2++) {
  1097. relocateData = relocateNodes[i2];
  1098. nodeToRelocate = relocateData.$nodeToRelocate$;
  1099. if (!nodeToRelocate["s-ol"]) {
  1100. orgLocationNode = BUILD.isDebug || BUILD.hydrateServerSide ? originalLocationDebugNode(nodeToRelocate) : doc.createTextNode("");
  1101. orgLocationNode["s-nr"] = nodeToRelocate;
  1102. nodeToRelocate.parentNode.insertBefore(nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
  1103. }
  1104. }
  1105. for (i2 = 0; i2 < relocateNodes.length; i2++) {
  1106. relocateData = relocateNodes[i2];
  1107. nodeToRelocate = relocateData.$nodeToRelocate$;
  1108. if (relocateData.$slotRefNode$) {
  1109. parentNodeRef = relocateData.$slotRefNode$.parentNode;
  1110. insertBeforeNode = relocateData.$slotRefNode$.nextSibling;
  1111. orgLocationNode = nodeToRelocate["s-ol"];
  1112. while (orgLocationNode = orgLocationNode.previousSibling) {
  1113. refNode = orgLocationNode["s-nr"];
  1114. if (refNode && refNode["s-sn"] === nodeToRelocate["s-sn"] && parentNodeRef === refNode.parentNode) {
  1115. refNode = refNode.nextSibling;
  1116. if (!refNode || !refNode["s-nr"]) {
  1117. insertBeforeNode = refNode;
  1118. break;
  1119. }
  1120. }
  1121. }
  1122. if (!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode || nodeToRelocate.nextSibling !== insertBeforeNode) {
  1123. if (nodeToRelocate !== insertBeforeNode) {
  1124. if (!nodeToRelocate["s-hn"] && nodeToRelocate["s-ol"]) {
  1125. nodeToRelocate["s-hn"] = nodeToRelocate["s-ol"].parentNode.nodeName;
  1126. }
  1127. parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
  1128. }
  1129. }
  1130. } else {
  1131. if (nodeToRelocate.nodeType === 1) {
  1132. nodeToRelocate.hidden = true;
  1133. }
  1134. }
  1135. }
  1136. }
  1137. if (checkSlotFallbackVisibility) {
  1138. updateFallbackSlotVisibility(rootVnode.$elm$);
  1139. }
  1140. plt.$flags$ &= ~1;
  1141. relocateNodes.length = 0;
  1142. }
  1143. };
  1144. var slotReferenceDebugNode = (slotVNode) => doc.createComment(`<slot${slotVNode.$name$ ? ' name="' + slotVNode.$name$ + '"' : ""}> (host=${hostTagName.toLowerCase()})`);
  1145. var originalLocationDebugNode = (nodeToRelocate) => doc.createComment(`org-location for ` + (nodeToRelocate.localName ? `<${nodeToRelocate.localName}> (host=${nodeToRelocate["s-hn"]})` : `[${nodeToRelocate.textContent}]`));
  1146. var attachToAncestor = (hostRef, ancestorComponent) => {
  1147. if (BUILD.asyncLoading && ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
  1148. ancestorComponent["s-p"].push(new Promise((r) => hostRef.$onRenderResolve$ = r));
  1149. }
  1150. };
  1151. var scheduleUpdate = (hostRef, isInitialLoad) => {
  1152. if (BUILD.taskQueue && BUILD.updatable) {
  1153. hostRef.$flags$ |= 16;
  1154. }
  1155. if (BUILD.asyncLoading && hostRef.$flags$ & 4) {
  1156. hostRef.$flags$ |= 512;
  1157. return;
  1158. }
  1159. attachToAncestor(hostRef, hostRef.$ancestorComponent$);
  1160. const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
  1161. return BUILD.taskQueue ? writeTask(dispatch) : dispatch();
  1162. };
  1163. var dispatchHooks = (hostRef, isInitialLoad) => {
  1164. const elm = hostRef.$hostElement$;
  1165. const endSchedule = createTime("scheduleUpdate", hostRef.$cmpMeta$.$tagName$);
  1166. const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
  1167. let promise;
  1168. if (isInitialLoad) {
  1169. if (BUILD.lazyLoad && BUILD.hostListener) {
  1170. hostRef.$flags$ |= 256;
  1171. if (hostRef.$queuedListeners$) {
  1172. hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
  1173. hostRef.$queuedListeners$ = null;
  1174. }
  1175. }
  1176. emitLifecycleEvent(elm, "componentWillLoad");
  1177. if (BUILD.cmpWillLoad) {
  1178. promise = safeCall(instance, "componentWillLoad");
  1179. }
  1180. } else {
  1181. emitLifecycleEvent(elm, "componentWillUpdate");
  1182. if (BUILD.cmpWillUpdate) {
  1183. promise = safeCall(instance, "componentWillUpdate");
  1184. }
  1185. }
  1186. emitLifecycleEvent(elm, "componentWillRender");
  1187. if (BUILD.cmpWillRender) {
  1188. promise = then(promise, () => safeCall(instance, "componentWillRender"));
  1189. }
  1190. endSchedule();
  1191. return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
  1192. };
  1193. var updateComponent = async (hostRef, instance, isInitialLoad) => {
  1194. const elm = hostRef.$hostElement$;
  1195. const endUpdate = createTime("update", hostRef.$cmpMeta$.$tagName$);
  1196. const rc = elm["s-rc"];
  1197. if (BUILD.style && isInitialLoad) {
  1198. attachStyles(hostRef);
  1199. }
  1200. const endRender = createTime("render", hostRef.$cmpMeta$.$tagName$);
  1201. if (BUILD.isDev) {
  1202. hostRef.$flags$ |= 1024;
  1203. }
  1204. if (BUILD.hydrateServerSide) {
  1205. await callRender(hostRef, instance, elm);
  1206. } else {
  1207. callRender(hostRef, instance, elm);
  1208. }
  1209. if (BUILD.cssVarShim && plt.$cssShim$) {
  1210. plt.$cssShim$.updateHost(elm);
  1211. }
  1212. if (BUILD.isDev) {
  1213. hostRef.$renderCount$++;
  1214. hostRef.$flags$ &= ~1024;
  1215. }
  1216. if (BUILD.hydrateServerSide) {
  1217. try {
  1218. serverSideConnected(elm);
  1219. if (isInitialLoad) {
  1220. if (hostRef.$cmpMeta$.$flags$ & 1) {
  1221. elm["s-en"] = "";
  1222. } else if (hostRef.$cmpMeta$.$flags$ & 2) {
  1223. elm["s-en"] = "c";
  1224. }
  1225. }
  1226. } catch (e) {
  1227. consoleError(e, elm);
  1228. }
  1229. }
  1230. if (BUILD.asyncLoading && rc) {
  1231. rc.map((cb) => cb());
  1232. elm["s-rc"] = void 0;
  1233. }
  1234. endRender();
  1235. endUpdate();
  1236. if (BUILD.asyncLoading) {
  1237. const childrenPromises = elm["s-p"];
  1238. const postUpdate = () => postUpdateComponent(hostRef);
  1239. if (childrenPromises.length === 0) {
  1240. postUpdate();
  1241. } else {
  1242. Promise.all(childrenPromises).then(postUpdate);
  1243. hostRef.$flags$ |= 4;
  1244. childrenPromises.length = 0;
  1245. }
  1246. } else {
  1247. postUpdateComponent(hostRef);
  1248. }
  1249. };
  1250. var callRender = (hostRef, instance, elm) => {
  1251. const allRenderFn = BUILD.allRenderFn ? true : false;
  1252. const lazyLoad = BUILD.lazyLoad ? true : false;
  1253. const taskQueue = BUILD.taskQueue ? true : false;
  1254. const updatable = BUILD.updatable ? true : false;
  1255. try {
  1256. renderingRef = instance;
  1257. instance = allRenderFn ? instance.render() : instance.render && instance.render();
  1258. if (updatable && taskQueue) {
  1259. hostRef.$flags$ &= ~16;
  1260. }
  1261. if (updatable || lazyLoad) {
  1262. hostRef.$flags$ |= 2;
  1263. }
  1264. if (BUILD.hasRenderFn || BUILD.reflect) {
  1265. if (BUILD.vdomRender || BUILD.reflect) {
  1266. if (BUILD.hydrateServerSide) {
  1267. return Promise.resolve(instance).then((value) => renderVdom(hostRef, value));
  1268. } else {
  1269. renderVdom(hostRef, instance);
  1270. }
  1271. } else {
  1272. elm.textContent = instance;
  1273. }
  1274. }
  1275. } catch (e) {
  1276. consoleError(e, hostRef.$hostElement$);
  1277. }
  1278. renderingRef = null;
  1279. return null;
  1280. };
  1281. var postUpdateComponent = (hostRef) => {
  1282. const tagName = hostRef.$cmpMeta$.$tagName$;
  1283. const elm = hostRef.$hostElement$;
  1284. const endPostUpdate = createTime("postUpdate", tagName);
  1285. const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
  1286. const ancestorComponent = hostRef.$ancestorComponent$;
  1287. if (BUILD.cmpDidRender) {
  1288. if (BUILD.isDev) {
  1289. hostRef.$flags$ |= 1024;
  1290. }
  1291. safeCall(instance, "componentDidRender");
  1292. if (BUILD.isDev) {
  1293. hostRef.$flags$ &= ~1024;
  1294. }
  1295. }
  1296. emitLifecycleEvent(elm, "componentDidRender");
  1297. if (!(hostRef.$flags$ & 64)) {
  1298. hostRef.$flags$ |= 64;
  1299. if (BUILD.asyncLoading && BUILD.cssAnnotations) {
  1300. addHydratedFlag(elm);
  1301. }
  1302. if (BUILD.cmpDidLoad) {
  1303. if (BUILD.isDev) {
  1304. hostRef.$flags$ |= 2048;
  1305. }
  1306. safeCall(instance, "componentDidLoad");
  1307. if (BUILD.isDev) {
  1308. hostRef.$flags$ &= ~2048;
  1309. }
  1310. }
  1311. emitLifecycleEvent(elm, "componentDidLoad");
  1312. endPostUpdate();
  1313. if (BUILD.asyncLoading) {
  1314. hostRef.$onReadyResolve$(elm);
  1315. if (!ancestorComponent) {
  1316. appDidLoad(tagName);
  1317. }
  1318. }
  1319. } else {
  1320. if (BUILD.cmpDidUpdate) {
  1321. if (BUILD.isDev) {
  1322. hostRef.$flags$ |= 1024;
  1323. }
  1324. safeCall(instance, "componentDidUpdate");
  1325. if (BUILD.isDev) {
  1326. hostRef.$flags$ &= ~1024;
  1327. }
  1328. }
  1329. emitLifecycleEvent(elm, "componentDidUpdate");
  1330. endPostUpdate();
  1331. }
  1332. if (BUILD.hotModuleReplacement) {
  1333. elm["s-hmr-load"] && elm["s-hmr-load"]();
  1334. }
  1335. if (BUILD.method && BUILD.lazyLoad) {
  1336. hostRef.$onInstanceResolve$(elm);
  1337. }
  1338. if (BUILD.asyncLoading) {
  1339. if (hostRef.$onRenderResolve$) {
  1340. hostRef.$onRenderResolve$();
  1341. hostRef.$onRenderResolve$ = void 0;
  1342. }
  1343. if (hostRef.$flags$ & 512) {
  1344. nextTick(() => scheduleUpdate(hostRef, false));
  1345. }
  1346. hostRef.$flags$ &= ~(4 | 512);
  1347. }
  1348. };
  1349. var forceUpdate = (ref) => {
  1350. if (BUILD.updatable) {
  1351. const hostRef = getHostRef(ref);
  1352. const isConnected = hostRef.$hostElement$.isConnected;
  1353. if (isConnected && (hostRef.$flags$ & (2 | 16)) === 2) {
  1354. scheduleUpdate(hostRef, false);
  1355. }
  1356. return isConnected;
  1357. }
  1358. return false;
  1359. };
  1360. var appDidLoad = (who) => {
  1361. if (BUILD.cssAnnotations) {
  1362. addHydratedFlag(doc.documentElement);
  1363. }
  1364. if (BUILD.asyncQueue) {
  1365. plt.$flags$ |= 2;
  1366. }
  1367. nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
  1368. if (BUILD.profile && performance.measure) {
  1369. performance.measure(`[Stencil] ${NAMESPACE} initial load (by ${who})`, "st:app:start");
  1370. }
  1371. };
  1372. var safeCall = (instance, method, arg) => {
  1373. if (instance && instance[method]) {
  1374. try {
  1375. return instance[method](arg);
  1376. } catch (e) {
  1377. consoleError(e);
  1378. }
  1379. }
  1380. return void 0;
  1381. };
  1382. var then = (promise, thenFn) => {
  1383. return promise && promise.then ? promise.then(thenFn) : thenFn();
  1384. };
  1385. var emitLifecycleEvent = (elm, lifecycleName) => {
  1386. if (BUILD.lifecycleDOMEvents) {
  1387. emitEvent(elm, "stencil_" + lifecycleName, {
  1388. bubbles: true,
  1389. composed: true,
  1390. detail: {
  1391. namespace: NAMESPACE
  1392. }
  1393. });
  1394. }
  1395. };
  1396. var addHydratedFlag = (elm) => BUILD.hydratedClass ? elm.classList.add("hydrated") : BUILD.hydratedAttribute ? elm.setAttribute("hydrated", "") : void 0;
  1397. var serverSideConnected = (elm) => {
  1398. const children = elm.children;
  1399. if (children != null) {
  1400. for (let i2 = 0, ii = children.length; i2 < ii; i2++) {
  1401. const childElm = children[i2];
  1402. if (typeof childElm.connectedCallback === "function") {
  1403. childElm.connectedCallback();
  1404. }
  1405. serverSideConnected(childElm);
  1406. }
  1407. }
  1408. };
  1409. var getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
  1410. var setValue = (ref, propName, newVal, cmpMeta) => {
  1411. const hostRef = getHostRef(ref);
  1412. const elm = BUILD.lazyLoad ? hostRef.$hostElement$ : ref;
  1413. const oldVal = hostRef.$instanceValues$.get(propName);
  1414. const flags = hostRef.$flags$;
  1415. const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
  1416. newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
  1417. const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
  1418. const didValueChange = newVal !== oldVal && !areBothNaN;
  1419. if ((!BUILD.lazyLoad || !(flags & 8) || oldVal === void 0) && didValueChange) {
  1420. hostRef.$instanceValues$.set(propName, newVal);
  1421. if (BUILD.isDev) {
  1422. if (hostRef.$flags$ & 1024) {
  1423. consoleDevWarn(`The state/prop "${propName}" changed during rendering. This can potentially lead to infinite-loops and other bugs.`, "\nElement", elm, "\nNew value", newVal, "\nOld value", oldVal);
  1424. } else if (hostRef.$flags$ & 2048) {
  1425. consoleDevWarn(`The state/prop "${propName}" changed during "componentDidLoad()", this triggers extra re-renders, try to setup on "componentWillLoad()"`, "\nElement", elm, "\nNew value", newVal, "\nOld value", oldVal);
  1426. }
  1427. }
  1428. if (!BUILD.lazyLoad || instance) {
  1429. if (BUILD.watchCallback && cmpMeta.$watchers$ && flags & 128) {
  1430. const watchMethods = cmpMeta.$watchers$[propName];
  1431. if (watchMethods) {
  1432. watchMethods.map((watchMethodName) => {
  1433. try {
  1434. instance[watchMethodName](newVal, oldVal, propName);
  1435. } catch (e) {
  1436. consoleError(e, elm);
  1437. }
  1438. });
  1439. }
  1440. }
  1441. if (BUILD.updatable && (flags & (2 | 16)) === 2) {
  1442. if (BUILD.cmpShouldUpdate && instance.componentShouldUpdate) {
  1443. if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
  1444. return;
  1445. }
  1446. }
  1447. scheduleUpdate(hostRef, false);
  1448. }
  1449. }
  1450. }
  1451. };
  1452. var proxyComponent = (Cstr, cmpMeta, flags) => {
  1453. if (BUILD.member && cmpMeta.$members$) {
  1454. if (BUILD.watchCallback && Cstr.watchers) {
  1455. cmpMeta.$watchers$ = Cstr.watchers;
  1456. }
  1457. const members = Object.entries(cmpMeta.$members$);
  1458. const prototype = Cstr.prototype;
  1459. members.map(([memberName, [memberFlags]]) => {
  1460. if ((BUILD.prop || BUILD.state) && (memberFlags & 31 || (!BUILD.lazyLoad || flags & 2) && memberFlags & 32)) {
  1461. Object.defineProperty(prototype, memberName, {
  1462. get() {
  1463. return getValue(this, memberName);
  1464. },
  1465. set(newValue) {
  1466. if (BUILD.isDev) {
  1467. const ref = getHostRef(this);
  1468. if ((flags & 1) === 0 && (ref.$flags$ & 8) === 0 && (memberFlags & 31) !== 0 && (memberFlags & 1024) === 0) {
  1469. consoleDevWarn(`@Prop() "${memberName}" on <${cmpMeta.$tagName$}> is immutable but was modified from within the component.
  1470. More information: https://stenciljs.com/docs/properties#prop-mutability`);
  1471. }
  1472. }
  1473. setValue(this, memberName, newValue, cmpMeta);
  1474. },
  1475. configurable: true,
  1476. enumerable: true
  1477. });
  1478. } else if (BUILD.lazyLoad && BUILD.method && flags & 1 && memberFlags & 64) {
  1479. Object.defineProperty(prototype, memberName, {
  1480. value(...args) {
  1481. const ref = getHostRef(this);
  1482. return ref.$onInstancePromise$.then(() => ref.$lazyInstance$[memberName](...args));
  1483. }
  1484. });
  1485. }
  1486. });
  1487. if (BUILD.observeAttribute && (!BUILD.lazyLoad || flags & 1)) {
  1488. const attrNameToPropName = /* @__PURE__ */ new Map();
  1489. prototype.attributeChangedCallback = function(attrName, _oldValue, newValue) {
  1490. plt.jmp(() => {
  1491. const propName = attrNameToPropName.get(attrName);
  1492. if (this.hasOwnProperty(propName)) {
  1493. newValue = this[propName];
  1494. delete this[propName];
  1495. } else if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && this[propName] == newValue) {
  1496. return;
  1497. }
  1498. this[propName] = newValue === null && typeof this[propName] === "boolean" ? false : newValue;
  1499. });
  1500. };
  1501. Cstr.observedAttributes = members.filter(([_, m]) => m[0] & 15).map(([propName, m]) => {
  1502. const attrName = m[1] || propName;
  1503. attrNameToPropName.set(attrName, propName);
  1504. if (BUILD.reflect && m[0] & 512) {
  1505. cmpMeta.$attrsToReflect$.push([propName, attrName]);
  1506. }
  1507. return attrName;
  1508. });
  1509. }
  1510. }
  1511. return Cstr;
  1512. };
  1513. var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
  1514. if ((BUILD.lazyLoad || BUILD.hydrateServerSide || BUILD.style) && (hostRef.$flags$ & 32) === 0) {
  1515. if (BUILD.lazyLoad || BUILD.hydrateClientSide) {
  1516. hostRef.$flags$ |= 32;
  1517. Cstr = loadModule(cmpMeta, hostRef, hmrVersionId);
  1518. if (Cstr.then) {
  1519. const endLoad = uniqueTime(`st:load:${cmpMeta.$tagName$}:${hostRef.$modeName$}`, `[Stencil] Load module for <${cmpMeta.$tagName$}>`);
  1520. Cstr = await Cstr;
  1521. endLoad();
  1522. }
  1523. if ((BUILD.isDev || BUILD.isDebug) && !Cstr) {
  1524. throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
  1525. }
  1526. if (BUILD.member && !Cstr.isProxied) {
  1527. if (BUILD.watchCallback) {
  1528. cmpMeta.$watchers$ = Cstr.watchers;
  1529. }
  1530. proxyComponent(Cstr, cmpMeta, 2);
  1531. Cstr.isProxied = true;
  1532. }
  1533. const endNewInstance = createTime("createInstance", cmpMeta.$tagName$);
  1534. if (BUILD.member) {
  1535. hostRef.$flags$ |= 8;
  1536. }
  1537. try {
  1538. new Cstr(hostRef);
  1539. } catch (e) {
  1540. consoleError(e);
  1541. }
  1542. if (BUILD.member) {
  1543. hostRef.$flags$ &= ~8;
  1544. }
  1545. if (BUILD.watchCallback) {
  1546. hostRef.$flags$ |= 128;
  1547. }
  1548. endNewInstance();
  1549. fireConnectedCallback(hostRef.$lazyInstance$);
  1550. } else {
  1551. Cstr = elm.constructor;
  1552. hostRef.$flags$ |= 32;
  1553. customElements.whenDefined(cmpMeta.$tagName$).then(() => hostRef.$flags$ |= 128);
  1554. }
  1555. if (BUILD.style && Cstr.style) {
  1556. let style = Cstr.style;
  1557. if (BUILD.mode && typeof style !== "string") {
  1558. style = style[hostRef.$modeName$ = computeMode(elm)];
  1559. if (BUILD.hydrateServerSide && hostRef.$modeName$) {
  1560. elm.setAttribute("s-mode", hostRef.$modeName$);
  1561. }
  1562. }
  1563. const scopeId2 = getScopeId(cmpMeta, hostRef.$modeName$);
  1564. if (!styles.has(scopeId2)) {
  1565. const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
  1566. if (!BUILD.hydrateServerSide && BUILD.shadowDom && BUILD.shadowDomShim && cmpMeta.$flags$ & 8) {
  1567. style = await import("./shadow-css-YOETQ6TH.js").then((m) => m.scopeCss(style, scopeId2, false));
  1568. }
  1569. registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1));
  1570. endRegisterStyles();
  1571. }
  1572. }
  1573. }
  1574. const ancestorComponent = hostRef.$ancestorComponent$;
  1575. const schedule = () => scheduleUpdate(hostRef, true);
  1576. if (BUILD.asyncLoading && ancestorComponent && ancestorComponent["s-rc"]) {
  1577. ancestorComponent["s-rc"].push(schedule);
  1578. } else {
  1579. schedule();
  1580. }
  1581. };
  1582. var fireConnectedCallback = (instance) => {
  1583. if (BUILD.lazyLoad && BUILD.connectedCallback) {
  1584. safeCall(instance, "connectedCallback");
  1585. }
  1586. };
  1587. var connectedCallback = (elm) => {
  1588. if ((plt.$flags$ & 1) === 0) {
  1589. const hostRef = getHostRef(elm);
  1590. const cmpMeta = hostRef.$cmpMeta$;
  1591. const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
  1592. if (BUILD.hostListenerTargetParent) {
  1593. addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, true);
  1594. }
  1595. if (!(hostRef.$flags$ & 1)) {
  1596. hostRef.$flags$ |= 1;
  1597. let hostId;
  1598. if (BUILD.hydrateClientSide) {
  1599. hostId = elm.getAttribute(HYDRATE_ID);
  1600. if (hostId) {
  1601. if (BUILD.shadowDom && supportsShadow && cmpMeta.$flags$ & 1) {
  1602. const scopeId2 = BUILD.mode ? addStyle(elm.shadowRoot, cmpMeta, elm.getAttribute("s-mode")) : addStyle(elm.shadowRoot, cmpMeta);
  1603. elm.classList.remove(scopeId2 + "-h", scopeId2 + "-s");
  1604. }
  1605. initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
  1606. }
  1607. }
  1608. if (BUILD.slotRelocation && !hostId) {
  1609. if (BUILD.hydrateServerSide || (BUILD.slot || BUILD.shadowDom) && cmpMeta.$flags$ & (4 | 8)) {
  1610. setContentReference(elm);
  1611. }
  1612. }
  1613. if (BUILD.asyncLoading) {
  1614. let ancestorComponent = elm;
  1615. while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
  1616. if (BUILD.hydrateClientSide && ancestorComponent.nodeType === 1 && ancestorComponent.hasAttribute("s-id") && ancestorComponent["s-p"] || ancestorComponent["s-p"]) {
  1617. attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
  1618. break;
  1619. }
  1620. }
  1621. }
  1622. if (BUILD.prop && !BUILD.hydrateServerSide && cmpMeta.$members$) {
  1623. Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
  1624. if (memberFlags & 31 && elm.hasOwnProperty(memberName)) {
  1625. const value = elm[memberName];
  1626. delete elm[memberName];
  1627. elm[memberName] = value;
  1628. }
  1629. });
  1630. }
  1631. if (BUILD.initializeNextTick) {
  1632. nextTick(() => initializeComponent(elm, hostRef, cmpMeta));
  1633. } else {
  1634. initializeComponent(elm, hostRef, cmpMeta);
  1635. }
  1636. } else {
  1637. addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, false);
  1638. fireConnectedCallback(hostRef.$lazyInstance$);
  1639. }
  1640. endConnected();
  1641. }
  1642. };
  1643. var setContentReference = (elm) => {
  1644. const contentRefElm = elm["s-cr"] = doc.createComment(BUILD.isDebug ? `content-ref (host=${elm.localName})` : "");
  1645. contentRefElm["s-cn"] = true;
  1646. elm.insertBefore(contentRefElm, elm.firstChild);
  1647. };
  1648. var disconnectedCallback = (elm) => {
  1649. if ((plt.$flags$ & 1) === 0) {
  1650. const hostRef = getHostRef(elm);
  1651. const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
  1652. if (BUILD.hostListener) {
  1653. if (hostRef.$rmListeners$) {
  1654. hostRef.$rmListeners$.map((rmListener) => rmListener());
  1655. hostRef.$rmListeners$ = void 0;
  1656. }
  1657. }
  1658. if (BUILD.cssVarShim && plt.$cssShim$) {
  1659. plt.$cssShim$.removeHost(elm);
  1660. }
  1661. if (BUILD.lazyLoad && BUILD.disconnectedCallback) {
  1662. safeCall(instance, "disconnectedCallback");
  1663. }
  1664. if (BUILD.cmpDidUnload) {
  1665. safeCall(instance, "componentDidUnload");
  1666. }
  1667. }
  1668. };
  1669. var proxyCustomElement = (Cstr, compactMeta) => {
  1670. const cmpMeta = {
  1671. $flags$: compactMeta[0],
  1672. $tagName$: compactMeta[1]
  1673. };
  1674. if (BUILD.member) {
  1675. cmpMeta.$members$ = compactMeta[2];
  1676. }
  1677. if (BUILD.hostListener) {
  1678. cmpMeta.$listeners$ = compactMeta[3];
  1679. }
  1680. if (BUILD.watchCallback) {
  1681. cmpMeta.$watchers$ = Cstr.$watchers$;
  1682. }
  1683. if (BUILD.reflect) {
  1684. cmpMeta.$attrsToReflect$ = [];
  1685. }
  1686. if (BUILD.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1) {
  1687. cmpMeta.$flags$ |= 8;
  1688. }
  1689. const originalConnectedCallback = Cstr.prototype.connectedCallback;
  1690. const originalDisconnectedCallback = Cstr.prototype.disconnectedCallback;
  1691. Object.assign(Cstr.prototype, {
  1692. __registerHost() {
  1693. registerHost(this, cmpMeta);
  1694. },
  1695. connectedCallback() {
  1696. connectedCallback(this);
  1697. if (BUILD.connectedCallback && originalConnectedCallback) {
  1698. originalConnectedCallback.call(this);
  1699. }
  1700. },
  1701. disconnectedCallback() {
  1702. disconnectedCallback(this);
  1703. if (BUILD.disconnectedCallback && originalDisconnectedCallback) {
  1704. originalDisconnectedCallback.call(this);
  1705. }
  1706. },
  1707. __attachShadow() {
  1708. if (supportsShadow) {
  1709. if (BUILD.shadowDelegatesFocus) {
  1710. this.attachShadow({
  1711. mode: "open",
  1712. delegatesFocus: !!(cmpMeta.$flags$ & 16)
  1713. });
  1714. } else {
  1715. this.attachShadow({ mode: "open" });
  1716. }
  1717. } else {
  1718. this.shadowRoot = this;
  1719. }
  1720. }
  1721. });
  1722. Cstr.is = cmpMeta.$tagName$;
  1723. return proxyComponent(Cstr, cmpMeta, 1 | 2);
  1724. };
  1725. var Fragment = (_, children) => children;
  1726. var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
  1727. if (BUILD.hostListener && listeners) {
  1728. if (BUILD.hostListenerTargetParent) {
  1729. if (attachParentListeners) {
  1730. listeners = listeners.filter(([flags]) => flags & 32);
  1731. } else {
  1732. listeners = listeners.filter(([flags]) => !(flags & 32));
  1733. }
  1734. }
  1735. listeners.map(([flags, name, method]) => {
  1736. const target = BUILD.hostListenerTarget ? getHostListenerTarget(elm, flags) : elm;
  1737. const handler = hostListenerProxy(hostRef, method);
  1738. const opts = hostListenerOpts(flags);
  1739. plt.ael(target, name, handler, opts);
  1740. (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
  1741. });
  1742. }
  1743. };
  1744. var hostListenerProxy = (hostRef, methodName) => (ev) => {
  1745. try {
  1746. if (BUILD.lazyLoad) {
  1747. if (hostRef.$flags$ & 256) {
  1748. hostRef.$lazyInstance$[methodName](ev);
  1749. } else {
  1750. (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
  1751. }
  1752. } else {
  1753. hostRef.$hostElement$[methodName](ev);
  1754. }
  1755. } catch (e) {
  1756. consoleError(e);
  1757. }
  1758. };
  1759. var getHostListenerTarget = (elm, flags) => {
  1760. if (BUILD.hostListenerTargetDocument && flags & 4)
  1761. return doc;
  1762. if (BUILD.hostListenerTargetWindow && flags & 8)
  1763. return win;
  1764. if (BUILD.hostListenerTargetBody && flags & 16)
  1765. return doc.body;
  1766. if (BUILD.hostListenerTargetParent && flags & 32)
  1767. return elm.parentElement;
  1768. return elm;
  1769. };
  1770. var hostListenerOpts = (flags) => supportsListenerOptions ? {
  1771. passive: (flags & 1) !== 0,
  1772. capture: (flags & 2) !== 0
  1773. } : (flags & 2) !== 0;
  1774. var hostRefs = /* @__PURE__ */ new WeakMap();
  1775. var getHostRef = (ref) => hostRefs.get(ref);
  1776. var registerHost = (elm, cmpMeta) => {
  1777. const hostRef = {
  1778. $flags$: 0,
  1779. $hostElement$: elm,
  1780. $cmpMeta$: cmpMeta,
  1781. $instanceValues$: /* @__PURE__ */ new Map()
  1782. };
  1783. if (BUILD.isDev) {
  1784. hostRef.$renderCount$ = 0;
  1785. }
  1786. if (BUILD.method && BUILD.lazyLoad) {
  1787. hostRef.$onInstancePromise$ = new Promise((r) => hostRef.$onInstanceResolve$ = r);
  1788. }
  1789. if (BUILD.asyncLoading) {
  1790. hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
  1791. elm["s-p"] = [];
  1792. elm["s-rc"] = [];
  1793. }
  1794. addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, false);
  1795. return hostRefs.set(elm, hostRef);
  1796. };
  1797. var isMemberInElement = (elm, memberName) => memberName in elm;
  1798. var consoleError = (e, el) => (customError || console.error)(e, el);
  1799. var STENCIL_DEV_MODE = BUILD.isTesting ? ["STENCIL:"] : [
  1800. "%cstencil",
  1801. "color: white;background:#4c47ff;font-weight: bold; font-size:10px; padding:2px 6px; border-radius: 5px"
  1802. ];
  1803. var consoleDevError = (...m) => console.error(...STENCIL_DEV_MODE, ...m);
  1804. var consoleDevWarn = (...m) => console.warn(...STENCIL_DEV_MODE, ...m);
  1805. var cmpModules = /* @__PURE__ */ new Map();
  1806. var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
  1807. const exportName = cmpMeta.$tagName$.replace(/-/g, "_");
  1808. const bundleId = cmpMeta.$lazyBundleId$;
  1809. if (BUILD.isDev && typeof bundleId !== "string") {
  1810. consoleDevError(`Trying to lazily load component <${cmpMeta.$tagName$}> with style mode "${hostRef.$modeName$}", but it does not exist.`);
  1811. return void 0;
  1812. }
  1813. const module = !BUILD.hotModuleReplacement ? cmpModules.get(bundleId) : false;
  1814. if (module) {
  1815. return module[exportName];
  1816. }
  1817. return import(
  1818. /* @vite-ignore */
  1819. /* webpackInclude: /\.entry\.js$/ */
  1820. /* webpackExclude: /\.system\.entry\.js$/ */
  1821. /* webpackMode: "lazy" */
  1822. `./${bundleId}.entry.js${BUILD.hotModuleReplacement && hmrVersionId ? "?s-hmr=" + hmrVersionId : ""}`
  1823. ).then((importedModule) => {
  1824. if (!BUILD.hotModuleReplacement) {
  1825. cmpModules.set(bundleId, importedModule);
  1826. }
  1827. return importedModule[exportName];
  1828. }, consoleError);
  1829. };
  1830. var styles = /* @__PURE__ */ new Map();
  1831. var modeResolutionChain = [];
  1832. var win = typeof window !== "undefined" ? window : {};
  1833. var CSS = BUILD.cssVarShim ? win.CSS : null;
  1834. var doc = win.document || { head: {} };
  1835. var H = win.HTMLElement || class {
  1836. };
  1837. var plt = {
  1838. $flags$: 0,
  1839. $resourcesUrl$: "",
  1840. jmp: (h2) => h2(),
  1841. raf: (h2) => requestAnimationFrame(h2),
  1842. ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
  1843. rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
  1844. ce: (eventName, opts) => new CustomEvent(eventName, opts)
  1845. };
  1846. var supportsShadow = BUILD.shadowDomShim && BUILD.shadowDom ? (() => (doc.head.attachShadow + "").indexOf("[native") > -1)() : true;
  1847. var supportsListenerOptions = (() => {
  1848. let supportsListenerOptions2 = false;
  1849. try {
  1850. doc.addEventListener("e", null, Object.defineProperty({}, "passive", {
  1851. get() {
  1852. supportsListenerOptions2 = true;
  1853. }
  1854. }));
  1855. } catch (e) {
  1856. }
  1857. return supportsListenerOptions2;
  1858. })();
  1859. var promiseResolve = (v) => Promise.resolve(v);
  1860. var supportsConstructableStylesheets = BUILD.constructableCSS ? (() => {
  1861. try {
  1862. new CSSStyleSheet();
  1863. return typeof new CSSStyleSheet().replaceSync === "function";
  1864. } catch (e) {
  1865. }
  1866. return false;
  1867. })() : false;
  1868. var queueDomReads = [];
  1869. var queueDomWrites = [];
  1870. var queueDomWritesLow = [];
  1871. var queueTask = (queue, write) => (cb) => {
  1872. queue.push(cb);
  1873. if (!queuePending) {
  1874. queuePending = true;
  1875. if (write && plt.$flags$ & 4) {
  1876. nextTick(flush);
  1877. } else {
  1878. plt.raf(flush);
  1879. }
  1880. }
  1881. };
  1882. var consume = (queue) => {
  1883. for (let i2 = 0; i2 < queue.length; i2++) {
  1884. try {
  1885. queue[i2](performance.now());
  1886. } catch (e) {
  1887. consoleError(e);
  1888. }
  1889. }
  1890. queue.length = 0;
  1891. };
  1892. var consumeTimeout = (queue, timeout) => {
  1893. let i2 = 0;
  1894. let ts = 0;
  1895. while (i2 < queue.length && (ts = performance.now()) < timeout) {
  1896. try {
  1897. queue[i2++](ts);
  1898. } catch (e) {
  1899. consoleError(e);
  1900. }
  1901. }
  1902. if (i2 === queue.length) {
  1903. queue.length = 0;
  1904. } else if (i2 !== 0) {
  1905. queue.splice(0, i2);
  1906. }
  1907. };
  1908. var flush = () => {
  1909. if (BUILD.asyncQueue) {
  1910. queueCongestion++;
  1911. }
  1912. consume(queueDomReads);
  1913. if (BUILD.asyncQueue) {
  1914. const timeout = (plt.$flags$ & 6) === 2 ? performance.now() + 14 * Math.ceil(queueCongestion * (1 / 10)) : Infinity;
  1915. consumeTimeout(queueDomWrites, timeout);
  1916. consumeTimeout(queueDomWritesLow, timeout);
  1917. if (queueDomWrites.length > 0) {
  1918. queueDomWritesLow.push(...queueDomWrites);
  1919. queueDomWrites.length = 0;
  1920. }
  1921. if (queuePending = queueDomReads.length + queueDomWrites.length + queueDomWritesLow.length > 0) {
  1922. plt.raf(flush);
  1923. } else {
  1924. queueCongestion = 0;
  1925. }
  1926. } else {
  1927. consume(queueDomWrites);
  1928. if (queuePending = queueDomReads.length > 0) {
  1929. plt.raf(flush);
  1930. }
  1931. }
  1932. };
  1933. var nextTick = (cb) => promiseResolve().then(cb);
  1934. var readTask = queueTask(queueDomReads, false);
  1935. var writeTask = queueTask(queueDomWrites, true);
  1936. export {
  1937. Build,
  1938. getAssetPath,
  1939. setAssetPath,
  1940. h,
  1941. Host,
  1942. createEvent,
  1943. forceUpdate,
  1944. proxyCustomElement,
  1945. Fragment,
  1946. H
  1947. };
  1948. /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
  1949. //# sourceMappingURL=chunk-IOZKU7B2.js.map