{
  "version": 3,
  "sources": ["/cdn/shop/t/10/assets/Pool_Configurator.js?cb=20260425"],
  "sourcesContent": ["import { Pool_SummaryManager } from \"./Pool_SummaryManager.js\";\nimport { Pool_DataManager } from \"./Pool_DataManager.js\";\nimport { Pool_CartManager } from \"./Pool_CartManager.js\";\nimport { Pool_Style } from \"./Pool_Style.js\";\nimport { Pool_Shape } from \"./Pool_Shape.js\";\nimport { Pool_Size } from \"./Pool_Size.js\";\nimport { Pool_Liner } from \"./Pool_Liner.js\";\nimport { Pool_Equipment } from \"./Pool_Equipment.js\";\n\nfunction PoolConfigurator() {\n    this.steps = {};\n    this.smartWizard = null;\n    this.summaryManager = new Pool_SummaryManager();\n    this.dataManager = new Pool_DataManager();\n    this.cartManager = new Pool_CartManager(this);\n\n    this.state = {\n        selectedPool: null,\n        selectedLiner: null,\n        selectedEquipment: null,\n        selectedSkimmer: null\n    };\n\n    this.init();\n}\n\n/**\n * Initializes the configurator by loading data and setting up the wizard.\n */\nPoolConfigurator.prototype.init = function () {\n    var self = this;\n\n    return this.loadInitialData().then(function () {\n        self.initSmartWizard();\n    });\n};\n\n/**\n * Fetches product data and initializes step objects.\n */\nPoolConfigurator.prototype.loadInitialData = function () {\n    var self = this;\n\n    return this.dataManager.fetchProductData().then(function (data) {\n        var pools = data.pools;\n        var liners = data.liners;\n        var skimmer = data.skimmer;\n        var filters = data.filters;\n        var pumps = data.pumps;\n\n        self.state.selectedSkimmer = Array.isArray(skimmer) ? skimmer[0] : skimmer;\n\n        self.steps = {\n            \"pool-style\": new Pool_Style(pools, self),\n            \"pool-shape\": new Pool_Shape(pools, self),\n            \"pool-size\": new Pool_Size(pools, self),\n            liner: new Pool_Liner(liners, self),\n            equipment: new Pool_Equipment(filters, pumps, self),\n            review: self.cartManager\n        };\n\n        self.loadStep(0);\n    }).catch(function (error) {\n        console.error(\"Error loading data:\", error);\n    });\n};\n\n/**\n * Initializes the SmartWizard plugin with configuration.\n */\nPoolConfigurator.prototype.initSmartWizard = function () {\n    var self = this;\n\n    this.smartWizard = $(\"#smartwizard\").smartWizard({\n        theme: \"default\",\n        autoAdjustHeight: false,\n        enableUrlHash: false,\n        toolbar: { showNextButton: false },\n        keyboard: { keyNavigation: false },\n        anchor: {\n            enableNavigation: true,\n            enableDoneState: true,\n            markPreviousStepsAsDone: true,\n            unDoneOnBackNavigation: true,\n            enableDoneStateNavigation: true\n        },\n        noForwardJumping: true,\n        enableAllSteps: false\n    });\n\n    this.smartWizard.on(\"leaveStep\", function (e, anchorObject, currentStepIndex, nextStepIndex, stepDirection) {\n        if (stepDirection === \"backward\") {\n            self.handleBackwardNavigation(nextStepIndex);\n        }\n    });\n};\n\n/**\n * Handles logic when navigating backward through the wizard.\n * @param {number} nextStepIndex - The index of the step the user is navigating to.\n */\nPoolConfigurator.prototype.handleBackwardNavigation = function (nextStepIndex) {\n    $('html, body').animate({\n        scrollTop: $('html').offset().top\n    }, 500);\n\n    if (nextStepIndex < 3) {\n        this.clearSelections([\"selectedLiner\", \"selectedEquipment\"]);\n        this.summaryManager.clearSummary();\n    }\n    if (nextStepIndex === 3) {\n        this.clearSelections([\"selectedLiner\", \"selectedEquipment\"]);\n\n        var poolLinerStep = this.steps.liner;\n        if (poolLinerStep) {\n            poolLinerStep.render();\n        }\n\n        this.summaryManager.updateSummary(\n            this.state.selectedPool,\n            this.state.selectedLiner,\n            this.state.selectedSkimmer,\n            this.state.selectedEquipment\n        );\n    }\n    if (nextStepIndex === 4) {\n        this.clearSelections([\"selectedEquipment\"]);\n        this.summaryManager.clearEquipmentSummary(\n            this.state.selectedPool,\n            this.state.selectedSkimmer,\n            this.state.selectedLiner\n        );\n    }\n\n    this.updateLayout(nextStepIndex);\n    this.unsetDoneState(nextStepIndex);\n};\n\n/**\n * Clears selected state values based on given keys.\n * @param {string[]} keys - Array of state keys to reset.\n */\nPoolConfigurator.prototype.clearSelections = function (keys) {\n    var index;\n\n    for (index = 0; index < keys.length; index += 1) {\n        this.state[keys[index]] = null;\n    }\n};\n\n/**\n * Unsets the \"done\" state for all steps ahead of the given index.\n * @param {number} nextStepIndex - Index of the step to retain the \"done\" state.\n */\nPoolConfigurator.prototype.unsetDoneState = function (nextStepIndex) {\n    var totalSteps = this.smartWizard.find(\"ul.nav\").children().length;\n    var doneSteps = [];\n    var index;\n\n    for (index = nextStepIndex + 1; index < totalSteps; index += 1) {\n        doneSteps.push(index);\n    }\n\n    this.smartWizard.smartWizard(\"unsetState\", doneSteps, \"done\");\n};\n\n/**\n *\n * Loads a specific step in the wizard.\n * @param {number} stepIndex - The index of the step to render.\n */\nPoolConfigurator.prototype.loadStep = function (stepIndex) {\n    var stepKeys = Object.keys(this.steps);\n    var stepKey = stepKeys[stepIndex];\n\n    if (this.steps[stepKey]) {\n        this.steps[stepKey].render();\n    }\n\n    this.updateLayout(stepIndex);\n};\n\n/**\n * Updates the layout based on the current step.\n * @param {number} stepIndex - The current step index.\n */\nPoolConfigurator.prototype.updateLayout = function (stepIndex) {\n    var summaryContainer = document.getElementById(\"summary\");\n    var smartWizardContainer = document.getElementById(\"smartwizard\");\n\n    if (stepIndex === 5) {\n        summaryContainer.style.display = \"none\";\n        smartWizardContainer.classList.remove(\"col-lg-10\");\n        smartWizardContainer.classList.add(\"col-lg-12\");\n    } else {\n        summaryContainer.style.display = \"block\";\n        smartWizardContainer.classList.remove(\"col-lg-12\");\n        smartWizardContainer.classList.add(\"col-lg-10\");\n    }\n};\n\n/**\n * Handles selection of an option and advances to the next step.\n * @param {string} stepKey - The key of the current step.\n */\nPoolConfigurator.prototype.handleSelection = function (stepKey) {\n    if (!this.steps[stepKey]) {\n        return;\n    }\n\n    this.loadStep(Object.keys(this.steps).indexOf(stepKey) + 1);\n    $(\"#smartwizard\").smartWizard(\"next\");\n\n    if (stepKey === \"pool-shape\") {\n        this.clearSelections([\"selectedLiner\", \"selectedEquipment\"]);\n    }\n    if (stepKey === \"liner\") {\n        this.clearSelections([\"selectedEquipment\"]);\n    }\n\n    this.updateSummaryAndCart(stepKey);\n};\n\n/**\n * Updates the summary and cart based on the current step.\n * @param {string} stepKey - The key of the step being processed.\n */\nPoolConfigurator.prototype.updateSummaryAndCart = function (stepKey) {\n    if ([\"pool-size\", \"liner\", \"equipment\"].includes(stepKey)) {\n        this.summaryManager.updateSummary(\n            this.state.selectedPool,\n            this.state.selectedLiner,\n            this.state.selectedSkimmer,\n            this.state.selectedEquipment\n        );\n    }\n\n    if (stepKey === \"equipment\") {\n        this.cartManager.updateCart(\n            this.state.selectedPool,\n            this.state.selectedLiner,\n            this.state.selectedSkimmer,\n            this.state.selectedEquipment\n        );\n    }\n};\n\ndocument.addEventListener(\"DOMContentLoaded\", function () {\n    window.poolConfigurator = new PoolConfigurator();\n});\n"],
  "mappings": "AAAA,OAAS,wBAA2B,2BACpC,OAAS,qBAAwB,wBACjC,OAAS,qBAAwB,wBACjC,OAAS,eAAkB,kBAC3B,OAAS,eAAkB,kBAC3B,OAAS,cAAiB,iBAC1B,OAAS,eAAkB,kBAC3B,OAAS,mBAAsB,sBAE/B,SAAS,kBAAmB,CACxB,KAAK,MAAQ,CAAC,EACd,KAAK,YAAc,KACnB,KAAK,eAAiB,IAAI,oBAC1B,KAAK,YAAc,IAAI,iBACvB,KAAK,YAAc,IAAI,iBAAiB,IAAI,EAE5C,KAAK,MAAQ,CACT,aAAc,KACd,cAAe,KACf,kBAAmB,KACnB,gBAAiB,IACrB,EAEA,KAAK,KAAK,CACd,CAKA,iBAAiB,UAAU,KAAO,UAAY,CAC1C,IAAI,KAAO,KAEX,OAAO,KAAK,gBAAgB,EAAE,KAAK,UAAY,CAC3C,KAAK,gBAAgB,CACzB,CAAC,CACL,EAKA,iBAAiB,UAAU,gBAAkB,UAAY,CACrD,IAAI,KAAO,KAEX,OAAO,KAAK,YAAY,iBAAiB,EAAE,KAAK,SAAU,KAAM,CAC5D,IAAI,MAAQ,KAAK,MACb,OAAS,KAAK,OACd,QAAU,KAAK,QACf,QAAU,KAAK,QACf,MAAQ,KAAK,MAEjB,KAAK,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