{"version":3,"sources":["webpack:///./src/ktu/js/components/Component.js","webpack:///./src/ktu/js/components/GenericHero.js"],"names":["domTree","WeakMap","configuration","Component","el","config","arguments","length","undefined","_classCallCheck","this","Error","$el","jQuery","$","set","hasOwnProperty","dom","setupDefaults","addListeners","get","elements","_component","__webpack_require__","GenericHero","_this","_possibleConstructorReturn","__proto__","Object","getPrototypeOf","call","initHero","next","hasClass","addClass"],"mappings":"ohBAAA,IAAMA,EAAU,IAAIC,QACdC,EAAgB,IAAID,QA4BpBE,aAOJ,SAAAA,EAAYC,GAAgB,IAAZC,EAAYC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,MAC1B,+FAD0BG,CAAAC,KAAAP,QACR,IAAPC,EACT,MAAM,IAAIO,MAAM,wEASlBD,KAAKE,IAAMR,aAAcS,EAAST,EAAKU,EAAEV,GAEjB,IAApBM,KAAKE,IAAIL,SAEbP,EAAQe,IAAIL,SACZR,EAAca,IAAIL,KAAML,GAEpBK,KAAKL,OAAOW,eAAe,SAC7BN,KAAKO,IAAMP,KAAKL,OAAOY,KAGzBP,KAAKQ,gBACLR,KAAKS,0IAuCL,OAAOjB,EAAckB,IAAIV,gCA6BnBW,GACNA,OACKX,KAAKO,IACLI,GAGLrB,EAAQe,IAAIL,KAAMW,mBAYlB,OAAOrB,EAAQoB,IAAIV,yBAIRP,sWCrJfmB,EAAAC,EAAA,6CACMC,cACJ,SAAAA,EAAYpB,gGAAIK,CAAAC,KAAAc,GAAA,IAAAC,mKAAAC,CAAAhB,MAAAc,EAAAG,WAAAC,OAAAC,eAAAL,IAAAM,KAAApB,KACRN,IADQ,OAEdqB,EAAKM,WAFSN,sXAOVf,KAAKE,IAAIoB,OAAOC,SAAS,eAC3BvB,KAAKE,IAAIsB,SAAS,+CAMTV","file":"36.f379f4d1047b25f510df.js","sourcesContent":["const domTree = new WeakMap();\nconst configuration = new WeakMap();\n\n/**\n * Component is a class that should be extended for every component that's being made. It\n * is a helper class to keep the code uniform.\n *\n * __PLEASE NOTE__: This is only to be extended, not instantiated.\n *\n * @example\n * import Component from 'component';\n *\n * class Foo extends Component {\n *   construction(el){\n *     super(el);\n *   }\n *\n *   setupDefaults(){\n *     // ...defaults go here\n *   }\n *\n *   addListeners(){\n *     // ...listeners go here\n *   }\n * }\n *\n * // Create a new Foo component\n * new Foo('.foo');\n */\nclass Component {\n  /**\n   * Component constructor - see {@link config} on how to pass in additional configuration to the constructor\n   *\n   * @param {string|Object} el - Main DOM element, you can pass a string such as `'.foo'` __or__ a jQuery object such as `$('.foo')`\n   * @param {Object} [config={ }] - Additional component configuration; reachable with `this.config`\n   */\n  constructor(el, config = {}){\n    if (typeof el === 'undefined') {\n      throw new Error('You must provide an element as a String type or a jQuery object type');\n    }\n\n    /**\n     * Main class element, this will be a jQuery instance\n     * This can be reachable at any time in your superclass with `this.$el`\n     *\n     * @type {Object}\n     */\n    this.$el = el instanceof jQuery ? el : $(el);\n\n    if (this.$el.length === 0) return;\n\n    domTree.set(this, {});\n    configuration.set(this, config);\n\n    if (this.config.hasOwnProperty('dom')) {\n      this.dom = this.config.dom;\n    }\n\n    this.setupDefaults();\n    this.addListeners();\n  }\n\n  /**\n   * This method is used for override;\n   * It's called directly after the element and configuration have been set up\n   * @abstract\n   */\n  setupDefaults(){}\n\n  /**\n   * This method is used for override;\n   * It's called directly after `setupDefaults()`, so everything is ready and setup at this point.\n   * @abstract\n   */\n  addListeners(){}\n\n  /**\n   * Get component configuration\n   *\n   * @example\n   * class Foo extends Component {\n   *   construction(el, config){\n   *     super(el, config);\n   *   }\n   *\n   *   setupDefaults(){\n   *     console.log(this.config.name); // Outputs \"Foo\"\n   *   }\n   * }\n   *\n   * // Create a new Foo component with some configuration\n   * new Foo('.foo', {\n   *   name: 'Foo'\n   * });\n   *\n   * @type {Object}\n   */\n  get config(){\n    return configuration.get(this);\n  }\n\n  /**\n   * Set DOM object\n   *\n   * @example\n   * class Foo extends Component {\n   *   construction(el){\n   *     super(el);\n   *   }\n   *\n   *   setupDefaults(){\n   *     this.dom = {\n   *       $container: this.$el.find('.container')\n   *     }\n   *   }\n   *\n   *   addListeners(){\n   *     //DOM object is available\n   *     console.log(this.dom.$container);\n   *   }\n   * }\n   *\n   * // Create a new Foo component\n   * new Foo('.foo');\n   *\n   * @type {Object}\n   */\n  set dom(elements){\n    elements = {\n      ...this.dom,\n      ...elements\n    };\n\n    domTree.set(this, elements);\n  }\n\n  /**\n   * Get DOM object\n   *\n   * @example\n   * this.dom\n   *\n   * @type {Object}\n   */\n  get dom(){\n    return domTree.get(this);\n  }\n}\n\nexport default Component;\n\n\n\n// WEBPACK FOOTER //\n// ./src/ktu/js/components/Component.js","import Component from 'component';\nclass GenericHero extends Component {\n  constructor(el) {\n    super(el);\n    this.initHero();\n  }\n\n  initHero() {\n    const _that = this;\n    if (this.$el.next().hasClass('form-offer')){\n      this.$el.addClass('generic-hero--offer-form');\n    }\n\n  }\n}\n\nexport default GenericHero;\n\n\n\n\n// WEBPACK FOOTER //\n// ./src/ktu/js/components/GenericHero.js"],"sourceRoot":""}