"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(e,o)=>{for(var r in o)__defProp(e,r,{get:o[r],enumerable:!0})},__copyProps=(e,o,r,t)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let a of __getOwnPropNames(o))__hasOwnProp.call(e,a)||a===r||__defProp(e,a,{get:()=>o[a],enumerable:!(t=__getOwnPropDesc(o,a))||t.enumerable});return e},__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),variable_product_tour_exports={};__export(variable_product_tour_exports,{VariableProductTour:()=>VariableProductTour}),module.exports=__toCommonJS(variable_product_tour_exports);var import_element=require("@wordpress/element"),import_i18n=require("@wordpress/i18n"),import_components=require("@woocommerce/components"),import_data=require("@woocommerce/data"),import_tracks=require("@woocommerce/tracks"),import_data2=require("@wordpress/data"),import_core_data=require("@wordpress/core-data"),import_constants=require("../../../constants");const VariableProductTour=()=>{const[e,o]=(0,import_element.useState)(!1),r=(0,import_core_data.useEntityId)("postType","product"),t=(0,import_element.useRef)(),a=(0,import_element.useMemo)(()=>({product_id:r,page:1,per_page:import_constants.DEFAULT_VARIATION_PER_PAGE_OPTION,order:"asc",orderby:"menu_order"}),[r]),{totalCount:i}=(0,import_data2.useSelect)(e=>{const{getProductVariationsTotalCount:o}=e(import_data.experimentalProductVariationsStore);return{totalCount:o(a)}},[r]),{updateUserPreferences:n,variable_product_block_tour_shown:c}=(0,import_data.useUserPreferences)(),p={placement:"top",steps:[{referenceElements:{desktop:".wp-block-woocommerce-product-variation-items-field"},focusElement:{desktop:".wp-block-woocommerce-product-variation-items-field"},meta:{name:"product-variations-2",heading:(0,import_i18n.__)("⚡️ This product now has variations","woocommerce"),descriptions:{desktop:(0,import_i18n.__)("From now on, you’ll manage pricing, shipping, and inventory for each variation individually—just like any other product in your store.","woocommerce")},primaryButton:{text:(0,import_i18n.__)("Got it","woocommerce")}}}],options:{classNames:["variation-items-product-tour"],effects:{arrowIndicator:!0,spotlight:{interactivity:{enabled:!0}}},callbacks:{onStepViewOnce:()=>{(0,import_tracks.recordEvent)("variable_product_block_tour_shown",{variable_count:i})}},popperModifiers:[{name:"offset",options:{offset:[0,32]}}]},closeHandler:()=>{n({variable_product_block_tour_shown:"yes"}),o(!1),(0,import_tracks.recordEvent)("variable_product_block_tour_dismissed")}};(0,import_element.useEffect)(()=>{const r=t.current!==i&&i>0&&0===t.current;t.current=i,r&&!e&&o(!0)},[i]);const{hasShownProductEditorTour:s}=(0,import_data2.useSelect)(e=>{const{getOption:o}=e(import_data.optionsStore);return{hasShownProductEditorTour:"yes"===o("woocommerce_block_product_tour_shown")}},[]);return"yes"!==c&&e&&s?(0,import_element.createElement)(import_components.TourKit,{config:p}):null};