{"version":3,"file":"HKStdxPe.js","sources":["../../../../../../node_modules/svelte/src/internal/client/dom/blocks/if.js"],"sourcesContent":["/** @import { Effect, TemplateNode } from '#client' */\nimport { EFFECT_TRANSPARENT } from '../../constants.js';\nimport {\n\thydrate_next,\n\thydrate_node,\n\thydrating,\n\tremove_nodes,\n\tset_hydrate_node,\n\tset_hydrating\n} from '../hydration.js';\nimport { block, branch, pause_effect, resume_effect } from '../../reactivity/effects.js';\nimport { HYDRATION_START_ELSE, UNINITIALIZED } from '../../../../constants.js';\n\n/**\n * @param {TemplateNode} node\n * @param {(branch: (fn: (anchor: Node) => void, flag?: boolean) => void) => void} fn\n * @param {boolean} [elseif] True if this is an `{:else if ...}` block rather than an `{#if ...}`, as that affects which transitions are considered 'local'\n * @returns {void}\n */\nexport function if_block(node, fn, elseif = false) {\n\tif (hydrating) {\n\t\thydrate_next();\n\t}\n\n\tvar anchor = node;\n\n\t/** @type {Effect | null} */\n\tvar consequent_effect = null;\n\n\t/** @type {Effect | null} */\n\tvar alternate_effect = null;\n\n\t/** @type {UNINITIALIZED | boolean | null} */\n\tvar condition = UNINITIALIZED;\n\n\tvar flags = elseif ? EFFECT_TRANSPARENT : 0;\n\n\tvar has_branch = false;\n\n\tconst set_branch = (/** @type {(anchor: Node) => void} */ fn, flag = true) => {\n\t\thas_branch = true;\n\t\tupdate_branch(flag, fn);\n\t};\n\n\tconst update_branch = (\n\t\t/** @type {boolean | null} */ new_condition,\n\t\t/** @type {null | ((anchor: Node) => void)} */ fn\n\t) => {\n\t\tif (condition === (condition = new_condition)) return;\n\n\t\t/** Whether or not there was a hydration mismatch. Needs to be a `let` or else it isn't treeshaken out */\n\t\tlet mismatch = false;\n\n\t\tif (hydrating) {\n\t\t\tconst is_else = /** @type {Comment} */ (anchor).data === HYDRATION_START_ELSE;\n\n\t\t\tif (!!condition === is_else) {\n\t\t\t\t// Hydration mismatch: remove everything inside the anchor and start fresh.\n\t\t\t\t// This could happen with `{#if browser}...{/if}`, for example\n\t\t\t\tanchor = remove_nodes();\n\n\t\t\t\tset_hydrate_node(anchor);\n\t\t\t\tset_hydrating(false);\n\t\t\t\tmismatch = true;\n\t\t\t}\n\t\t}\n\n\t\tif (condition) {\n\t\t\tif (consequent_effect) {\n\t\t\t\tresume_effect(consequent_effect);\n\t\t\t} else if (fn) {\n\t\t\t\tconsequent_effect = branch(() => fn(anchor));\n\t\t\t}\n\n\t\t\tif (alternate_effect) {\n\t\t\t\tpause_effect(alternate_effect, () => {\n\t\t\t\t\talternate_effect = null;\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\tif (alternate_effect) {\n\t\t\t\tresume_effect(alternate_effect);\n\t\t\t} else if (fn) {\n\t\t\t\talternate_effect = branch(() => fn(anchor));\n\t\t\t}\n\n\t\t\tif (consequent_effect) {\n\t\t\t\tpause_effect(consequent_effect, () => {\n\t\t\t\t\tconsequent_effect = null;\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tif (mismatch) {\n\t\t\t// continue in hydration mode\n\t\t\tset_hydrating(true);\n\t\t}\n\t};\n\n\tblock(() => {\n\t\thas_branch = false;\n\t\tfn(set_branch);\n\t\tif (!has_branch) {\n\t\t\tupdate_branch(null, null);\n\t\t}\n\t}, flags);\n\n\tif (hydrating) {\n\t\tanchor = hydrate_node;\n\t}\n}\n"],"names":["if_block","node","fn","elseif","hydrating","hydrate_next","anchor","consequent_effect","alternate_effect","condition","UNINITIALIZED","flags","EFFECT_TRANSPARENT","has_branch","set_branch","flag","update_branch","new_condition","mismatch","is_else","HYDRATION_START_ELSE","remove_nodes","set_hydrate_node","set_hydrating","resume_effect","branch","pause_effect","block","hydrate_node"],"mappings":"sHAmBO,SAASA,EAASC,EAAMC,EAAIC,EAAS,GAAO,CAC9CC,GACHC,EAAc,EAGf,IAAIC,EAASL,EAGTM,EAAoB,KAGpBC,EAAmB,KAGnBC,EAAYC,EAEZC,EAAQR,EAASS,EAAqB,EAEtCC,EAAa,GAEjB,MAAMC,EAAa,CAAuCZ,EAAIa,EAAO,KAAS,CAC7EF,EAAa,GACbG,EAAcD,EAAMb,CAAE,CACtB,EAEKc,EAAgB,CACSC,EACiBf,IAC3C,CACJ,GAAIO,KAAeA,EAAYQ,GAAgB,OAG/C,IAAIC,EAAW,GAEf,GAAId,EAAW,CACd,MAAMe,EAAkCb,EAAQ,OAASc,EAErD,CAAC,CAACX,IAAcU,IAGnBb,EAASe,EAAc,EAEvBC,EAAiBhB,CAAM,EACvBiB,EAAc,EAAK,EACnBL,EAAW,GAEf,CAEMT,GACCF,EACHiB,EAAcjB,CAAiB,EACrBL,IACVK,EAAoBkB,EAAO,IAAMvB,EAAGI,CAAM,CAAC,GAGxCE,GACHkB,EAAalB,EAAkB,IAAM,CACpCA,EAAmB,IACxB,CAAK,IAGEA,EACHgB,EAAchB,CAAgB,EACpBN,IACVM,EAAmBiB,EAAO,IAAMvB,EAAGI,CAAM,CAAC,GAGvCC,GACHmB,EAAanB,EAAmB,IAAM,CACrCA,EAAoB,IACzB,CAAK,GAICW,GAEHK,EAAc,EAAI,CAEnB,EAEDI,EAAM,IAAM,CACXd,EAAa,GACbX,EAAGY,CAAU,EACRD,GACJG,EAAc,KAAM,IAAI,CAEzB,EAAEL,CAAK,EAEJP,IACHE,EAASsB,EAEX","x_google_ignoreList":[0]}