@subiz/widget-v4 4.0.57 → 4.0.61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/assets/less/chatbox.less +2 -0
  2. package/compiled_src/chatbox/Header.js +2 -0
  3. package/compiled_src/chatbox/main.js +2 -1
  4. package/compiled_src/lib.js +9 -2
  5. package/compiled_src/popup/popup.js +33 -3
  6. package/compiled_src/store/store.js +7 -5
  7. package/compiled_src/util/common.js +4 -2
  8. package/dist/{17d83c40640.178.js → 17db8166252.178.js} +0 -0
  9. package/dist/17db8166252.213.js +1 -0
  10. package/dist/{17d83c40640.362.js → 17db8166252.362.js} +0 -0
  11. package/dist/{17d83c40640.441.js → 17db8166252.441.js} +0 -0
  12. package/dist/{17d83c40640.605.js → 17db8166252.605.js} +0 -0
  13. package/dist/{17d83c40640.619.js → 17db8166252.619.js} +0 -0
  14. package/dist/{17d83c40640.678.js → 17db8166252.678.js} +0 -0
  15. package/dist/17db8166252.74.js +1 -0
  16. package/dist/{17d83c40640.782.js → 17db8166252.782.js} +0 -0
  17. package/dist/17db8166252.app.js +1 -0
  18. package/dist/{17d83c40640.index.html → 17db8166252.index.html} +2 -1
  19. package/dist/{17d83c40640.library.html → 17db8166252.library.html} +2 -1
  20. package/dist/17db8166252.library.js +1 -0
  21. package/dist/{17d83c40640.preview.html → 17db8166252.preview.html} +1 -1
  22. package/dist/17db8166252.preview.js +1 -0
  23. package/dist/17db8166252.screenshoot.js +1 -0
  24. package/dist/213.js +30 -1
  25. package/dist/74.js +4 -1
  26. package/dist/HASH +1 -1
  27. package/dist/screenshoot.html +1 -1
  28. package/dist/screenshoot.js +20 -9
  29. package/index.html +1 -0
  30. package/order.html +784 -0
  31. package/order.js +0 -0
  32. package/package.json +10 -10
  33. package/src/chatbox/Header.js +42 -34
  34. package/src/chatbox/main.js +2 -2
  35. package/src/lib.js +8 -3
  36. package/src/popup/popup.js +27 -2
  37. package/src/store/store.js +9 -5
  38. package/src/util/common.js +4 -2
  39. package/test.js +1 -0
  40. package/dist/17d83c40640.213.js +0 -1
  41. package/dist/17d83c40640.74.js +0 -1
  42. package/dist/17d83c40640.app.js +0 -1
  43. package/dist/17d83c40640.library.js +0 -1
  44. package/dist/17d83c40640.preview.js +0 -1
  45. package/dist/17d83c40640.screenshoot.js +0 -1
package/order.js ADDED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@subiz/widget-v4",
3
- "version": "4.0.57",
3
+ "version": "4.0.61",
4
4
  "main": "./compiled_src/lib.js",
5
5
  "scripts": {
6
6
  "dev": "npx webpack serve --config webpack.dev.js",
@@ -15,25 +15,25 @@
15
15
  "@subiz/storage": "0.0.8",
16
16
  "@subiz/wsclient": "^3.1.7",
17
17
  "cookie_js": "1.4.2",
18
- "core-js": "^3.19.2",
18
+ "core-js": "^3.20.0",
19
19
  "css-loader": "^5.2.6",
20
20
  "file-loader": "^6.2.0",
21
21
  "less": "^4.1.2",
22
22
  "less-loader": "^10.2.0",
23
- "marked": "^4.0.6",
24
- "preact": "^10.6.2"
23
+ "marked": "^4.0.7",
24
+ "preact": "^10.6.4"
25
25
  },
26
26
  "devDependencies": {
27
27
  "babel-loader": "^8.2.3",
28
- "@babel/core": "^7.16.0",
28
+ "@babel/core": "^7.16.5",
29
29
  "@babel/cli": "^7.16.0",
30
- "@babel/plugin-proposal-class-properties": "^7.16.0",
31
- "@babel/plugin-transform-react-jsx": "^7.16.0",
32
- "@babel/preset-env": "^7.16.4",
30
+ "@babel/plugin-proposal-class-properties": "^7.16.5",
31
+ "@babel/plugin-transform-react-jsx": "^7.16.5",
32
+ "@babel/preset-env": "^7.16.5",
33
33
  "babel-plugin-syntax-jsx": "^6.18.0",
34
34
  "html-webpack-plugin": "^5.5.0",
35
- "puppeteer": "^12.0.1",
36
- "webpack": "^5.64.4",
35
+ "puppeteer": "^13.0.0",
36
+ "webpack": "^5.65.0",
37
37
  "webpack-bundle-analyzer": "^4.5.0",
38
38
  "webpack-cli": "^4.9.1",
39
39
  "webpack-dev-server": "^4.6.0"
@@ -44,17 +44,19 @@ export default class Header extends Com {
44
44
  let state = acc.is_online ? this.props.t('agent_online') : this.props.t('agent_offline')
45
45
  let tagline = sb.get(accSetting, `tagline`, {})
46
46
  let desc = this.props.t.i18n(tagline) || accSetting.introduction || state
47
- let agentIdsJoined = sb.map(this.getAgentJoined(this.props.cid), agent => agent.id)
47
+ let agentIdsJoined = sb.map(this.getAgentJoined(this.props.cid), (agent) => agent.id)
48
48
  let cls = 'widget-header--inner widget-header--inner--collapsed'
49
49
  if (!show) cls += ' widget-header--inner--hidden'
50
50
 
51
51
  return (
52
52
  <div class={cls}>
53
53
  {this.renderBackButton()}
54
- <AgentsAvatar plugin={this.props.plugin} store={this.props.store} mode="secondary" agent_ids={agentIdsJoined} />
55
- <div class="widget-header--title-container">
56
- <div class="widget-header--title">{this.getTitle()}</div>
57
- <div class="widget-header--description" title={desc}>{desc}</div>
54
+ <AgentsAvatar plugin={this.props.plugin} store={this.props.store} mode='secondary' agent_ids={agentIdsJoined} />
55
+ <div class='widget-header--title-container'>
56
+ <div class='widget-header--title'>{this.getTitle()}</div>
57
+ <div class='widget-header--description' title={desc}>
58
+ {desc}
59
+ </div>
58
60
  </div>
59
61
  {this.renderCloseButton()}
60
62
  </div>
@@ -65,7 +67,7 @@ export default class Header extends Com {
65
67
  let accSetting = this.props.plugin.chatbox || {}
66
68
  let acc = this.props.store.matchAccount()
67
69
  let links = sb.get(accSetting, 'header.links') || []
68
- let $links = sb.map(links, link => {
70
+ let $links = sb.map(links, (link) => {
69
71
  if (!link.url || !link.type || link.type === 'subiz') return null
70
72
  if (link.type === 'email') {
71
73
  return (
@@ -79,7 +81,7 @@ export default class Header extends Com {
79
81
 
80
82
  return (
81
83
  <div>
82
- <a href={link.url} target="_blank" title={link.url} rel="noreferrer">
84
+ <a href={link.url} target='_blank' title={link.url} rel='noreferrer'>
83
85
  <i class={`social__links-logo social__links-logo--${link.type}`}></i>
84
86
  </a>
85
87
  </div>
@@ -90,7 +92,7 @@ export default class Header extends Com {
90
92
  Vui lòng hỏi chúng tôi bất cứ điều gì hoặc chia sẻ phản hồi của bạn`
91
93
  let tagline = sb.get(accSetting, `tagline`, {})
92
94
  var teamintro = this.props.t.i18n(tagline) || accSetting.introduction || this.props.t('team_intro') || DEFTEAMINTO
93
- var tags = sb.extractText(teamintro).map(tag => {
95
+ var tags = sb.extractText(teamintro).map((tag) => {
94
96
  if (tag.type === 'emoji') return <Emoji emojiCode={tag.text} />
95
97
  return tag.text
96
98
  })
@@ -99,17 +101,21 @@ Vui lòng hỏi chúng tôi bất cứ điều gì hoặc chia sẻ phản hồi
99
101
  if (!show) cls += ' widget-header--inner--hidden'
100
102
  return (
101
103
  <div class={cls}>
102
- <div class="widget-header-expand-container">
103
- <div class="widget-header--top-wrapper">
104
- <div class="widget-header--title">{this.getTitle()}</div>
104
+ <div class='widget-header-expand-container'>
105
+ <div class='widget-header--top-wrapper'>
106
+ <div class='widget-header--title'>{this.getTitle()}</div>
105
107
  {this.renderCloseButton()}
106
108
  </div>
107
- <div class="widget_header__body widget_header__body__social">
108
- <img alt="logo" class="social__account_logo" src={this.props.store.replaceFileUrl(sb.get(acc, 'logo_url'))} />
109
+ <div class='widget_header__body widget_header__body__social'>
110
+ <img
111
+ alt='logo'
112
+ class='social__account_logo'
113
+ src={this.props.store.replaceFileUrl(sb.get(acc, 'logo_url'))}
114
+ />
109
115
 
110
116
  <div>
111
- <div class="social__introduction">{tags}</div>
112
- <div class="social__links">{$links}</div>
117
+ <div class='social__introduction'>{tags}</div>
118
+ <div class='social__links'>{$links}</div>
113
119
  </div>
114
120
  </div>
115
121
  </div>
@@ -123,7 +129,7 @@ Vui lòng hỏi chúng tôi bất cứ điều gì hoặc chia sẻ phản hồi
123
129
  Vui lòng hỏi chúng tôi bất cứ điều gì hoặc chia sẻ phản hồi của bạn`
124
130
  let tagline = sb.get(accSetting, `tagline`, {})
125
131
  var teamintro = this.props.t.i18n(tagline) || accSetting.introduction || this.props.t('team_intro') || DEFTEAMINTO
126
- var tags = sb.extractText(teamintro).map(tag => {
132
+ var tags = sb.extractText(teamintro).map((tag) => {
127
133
  if (tag.type === 'emoji') return <Emoji emojiCode={tag.text} />
128
134
  return tag.text
129
135
  })
@@ -132,17 +138,17 @@ Vui lòng hỏi chúng tôi bất cứ điều gì hoặc chia sẻ phản hồi
132
138
  if (!show) cls += ' widget-header--inner--hidden'
133
139
  return (
134
140
  <div class={cls}>
135
- <div class="widget-header-expand-container">
136
- <div class="widget-header--top-wrapper">
137
- <div class="widget-header--title">{this.getTitle()}</div>
141
+ <div class='widget-header-expand-container'>
142
+ <div class='widget-header--top-wrapper'>
143
+ <div class='widget-header--title'>{this.getTitle()}</div>
138
144
  {this.renderCloseButton()}
139
145
  </div>
140
- <div class="widget_header__body">
141
- <div class="widget-header--avatar-wrapper">
142
- <AgentsAvatar plugin={this.props.plugin} store={this.props.store} mode="primary" />
146
+ <div class='widget_header__body'>
147
+ <div class='widget-header--avatar-wrapper'>
148
+ <AgentsAvatar plugin={this.props.plugin} store={this.props.store} mode='primary' />
143
149
  </div>
144
- <div class="widget-header--title-container">
145
- <div class="widget-header--description">{tags}</div>
150
+ <div class='widget-header--title-container'>
151
+ <div class='widget-header--description'>{tags}</div>
146
152
  </div>
147
153
  </div>
148
154
  </div>
@@ -170,32 +176,34 @@ Vui lòng hỏi chúng tôi bất cứ điều gì hoặc chia sẻ phản hồi
170
176
  let user = this.props.store.matchUser()
171
177
 
172
178
  let unreadcount = 0
173
- sb.map(allconvos, convo => {
179
+ sb.map(allconvos, (convo) => {
174
180
  if (convo.id == this.props.cid) return
175
181
  if (!sb.isConvoSeen(convo, user.id)) unreadcount++
176
182
  })
177
183
 
178
184
  if (unreadcount !== 0) {
179
- $unreadcount = <span class="widget-header--total-unread-convo">{unreadcount}</span>
185
+ $unreadcount = <span class='widget-header--total-unread-convo'>{unreadcount}</span>
180
186
  }
181
187
  return (
182
188
  <div
183
189
  class={`widget-header--wrap-button-back ${unreadcount ? 'widget-header--has-convo-unred' : ''}`}
184
- onClick={e => this.onBackClick(e)}>
185
- <div class="widget-header--button-back" data-tooltip={this.props.t('menu_back')}></div>
190
+ onClick={(e) => this.onBackClick(e)}>
191
+ <div class='widget-header--button-back' data-tooltip={this.props.t('menu_back')}></div>
186
192
  {$unreadcount}
187
193
  </div>
188
194
  )
189
195
  }
190
196
 
191
197
  renderCloseButton() {
198
+ let accSetting = this.props.plugin.chatbox || {}
199
+ if (accSetting.hide_close_button) return null
192
200
  return (
193
201
  <div
194
- class="widget-header--button widget-header--button-close"
202
+ class='widget-header--button widget-header--button-close'
195
203
  data-tooltip={this.props.t('close')}
196
- data-tooltip-position="bottom"
197
- onClick={e => this.onCloseClick(e)}>
198
- <span class="widget-header--button-close-icon"></span>
204
+ data-tooltip-position='bottom'
205
+ onClick={(e) => this.onCloseClick(e)}>
206
+ <span class='widget-header--button-close-icon'></span>
199
207
  </div>
200
208
  )
201
209
  }
@@ -214,9 +222,9 @@ Vui lòng hỏi chúng tôi bất cứ điều gì hoặc chia sẻ phản hồi
214
222
 
215
223
  getAgentJoined(cid) {
216
224
  var convo = this.props.store.matchConvo(cid) || {}
217
- let joined = sb.filter(convo.members, mem => mem.type === 'agent' && mem.membership === 'active')
225
+ let joined = sb.filter(convo.members, (mem) => mem.type === 'agent' && mem.membership === 'active')
218
226
  return joined
219
227
  }
220
228
  }
221
229
 
222
- let getJoinedNameMember = agents => sb.map(agents, agent => agent.name).join(', ')
230
+ let getJoinedNameMember = (agents) => sb.map(agents, (agent) => agent.name).join(', ')
@@ -59,7 +59,8 @@ export default class Main extends Com {
59
59
  Object.assign({}, this.props.store.matchLastview().opts, {view: this.props.store.matchLastview().view}),
60
60
  )
61
61
  } else {
62
- this.hideWidget()
62
+ restoreViewport()
63
+ if (!this.state.isShowWidget) this.hideWidget()
63
64
  }
64
65
  }
65
66
 
@@ -148,7 +149,6 @@ export default class Main extends Com {
148
149
  hideWidget() {
149
150
  restoreViewport()
150
151
  this.props.store.setIsOpen(false)
151
-
152
152
  this.setState({isShowWidget: false})
153
153
  }
154
154
 
package/src/lib.js CHANGED
@@ -32,9 +32,13 @@ class Widget {
32
32
  xhttp.send()
33
33
  }
34
34
 
35
- async setAccount(id, $container) {
36
- await this.store.init(id)
35
+ async waitReady(cb) {
36
+ await this.store.readyGate.entry()
37
+ cb()
38
+ }
37
39
 
40
+ async setAccount(id, $container, mask, cb) {
41
+ let outmask = await this.store.init(id, mask)
38
42
  // add container to client site
39
43
  if (!$container) $container = document.body
40
44
  this.pluginMgr = new PluginMgr(this, $container)
@@ -45,8 +49,9 @@ class Widget {
45
49
  this.pluginMgr.destroy()
46
50
  clearInterval(clean)
47
51
  }, 1000)
48
-
49
52
  this.domGate.open()
53
+ cb && cb(outmask)
54
+ return outmask
50
55
  }
51
56
 
52
57
  // deprecated
@@ -13,6 +13,7 @@ export default class Popup extends Com {
13
13
  closeAnimation: true,
14
14
  pressedSubmit: false,
15
15
  imageReady: false,
16
+ fontReady: false,
16
17
  }
17
18
 
18
19
  constructor(props) {
@@ -39,14 +40,37 @@ export default class Popup extends Com {
39
40
  }
40
41
  })
41
42
  })
43
+ delete fonts.undefined
44
+ delete fonts.null
45
+ delete fonts['']
42
46
 
43
47
  if (sb.size(images) == 0) this.setState({imageReady: true})
44
48
  // preload images and fonts
45
49
  sb.map(images, (_, image) => sb.preloadImg(image, () => this.setState({imageReady: true})))
46
50
  sb.preloadWebfonts(Object.keys(fonts))
51
+ setTimeout(async () => {
52
+ await this.waitForFont(Object.keys(fonts))
53
+ this.setState({fontReady: true})
54
+ })
47
55
  })
48
56
  }
49
57
 
58
+ async waitForFont(fonts) {
59
+ if (sb.size(fonts) == 0) return
60
+ // 2 sec timeout
61
+ let ready = {}
62
+ for (var t = 0; t < 10; t++) {
63
+ for (var i = 0; i < fonts.length; i++) {
64
+ try {
65
+ if (document.fonts.check('normal 16px ' + fonts[i])) ready[fonts[i]] = true
66
+ if (Object.keys(readycount) == fonts.length) return
67
+ } catch (e) {}
68
+ }
69
+ await sb.sleep(200)
70
+ }
71
+ return
72
+ }
73
+
50
74
  openPopup() {
51
75
  this.setState({close: false})
52
76
  }
@@ -59,7 +83,7 @@ export default class Popup extends Com {
59
83
  isFormFilled() {
60
84
  let page = sb.get(this.props.plugin.popup, `pages.${this.getPageIndex()}`)
61
85
  let form = sb.find(page.components, (com) => com.type === 'form')
62
- if (!form || !form.form) return
86
+ if (!form || !form.form) return true
63
87
 
64
88
  // fill form
65
89
  let fields = sb.get(form, 'form.fields', [])
@@ -185,7 +209,7 @@ export default class Popup extends Com {
185
209
  }
186
210
 
187
211
  if (hasConversion) {
188
- var formData = new FormData(this._formRef.current)
212
+ var formData = this._formRef.current ? new FormData(this._formRef.current) : new FormData()
189
213
  var summitFields = []
190
214
 
191
215
  let user = sb.cloneDeep(this.props.store.matchUser())
@@ -833,6 +857,7 @@ export default class Popup extends Com {
833
857
  if (!this.props.t) return null
834
858
  if (!this.state.cssready) return null
835
859
  if (!this.state.imageReady) return null
860
+ if (!this.state.fontReady) return null
836
861
  if (this.state.close) return null
837
862
 
838
863
  let popup = sb.get(this.props.plugin, 'popup', {})
@@ -276,16 +276,18 @@ export default class Store {
276
276
 
277
277
  now = () => sb.Date.now() + this.timeDiff // millisecond on server
278
278
 
279
- async init(accid) {
279
+ async init(accid, mask) {
280
280
  this.readyGate.close()
281
281
  accid = (accid || '').trim()
282
282
  this.api.setAuth({accid: accid})
283
283
 
284
284
  this.g_sync = {}
285
- let mask = '' // try to find mask in cookie
286
- try {
287
- mask = this.cookie.get('__sbmask', '')
288
- } catch (e) {}
285
+ // try to find mask in cookie
286
+ if (!mask) {
287
+ try {
288
+ mask = this.cookie.get('__sbmask', '')
289
+ } catch (e) {}
290
+ }
289
291
 
290
292
  let localstorageMask = this.kv.match('mask')
291
293
  // cookie is deleted, fallback to local storage
@@ -333,6 +335,8 @@ export default class Store {
333
335
  await this.reconnect()
334
336
  this.readyGate.open()
335
337
  this.reconnectWs(accid, userId)
338
+
339
+ return mask
336
340
  }
337
341
 
338
342
  seenQueue = [] // convoid will be seen
@@ -905,7 +905,7 @@ export function getDayName(dayOfWeek) {
905
905
  }
906
906
 
907
907
  let loadedFonts = {}
908
- export function preloadWebfonts(fonts) {
908
+ export function preloadWebfonts(fonts, done) {
909
909
  for (var i = 0; i < fonts.length; i++) {
910
910
  let font = fonts[i]
911
911
  if (!font) continue
@@ -920,7 +920,9 @@ export function preloadWebfonts(fonts) {
920
920
  // Visible - so we can measure it - but not on the screen
921
921
  node.style.position = 'absolute'
922
922
  node.style.display = 'block'
923
- node.style.fontSize = '1px'
923
+ node.style.opacity = '0.1'
924
+ node.style.color = 'transparent'
925
+ node.style.fontSize = '20px'
924
926
  node.style.height = '0px'
925
927
  node.style.width = '0px'
926
928
 
package/test.js ADDED
@@ -0,0 +1 @@
1
+ document.write('124')
@@ -1 +0,0 @@
1
- (self.webpackChunk_subiz_widget_v4=self.webpackChunk_subiz_widget_v4||[]).push([[213],{2493:(t,e,n)=>{"use strict";n.d(e,{M:()=>o,u:()=>r});var i=n(6400);n(819);class o extends i.wA{constructor(t){super(t),this._isMounted=!0,setTimeout((()=>{if(this.componentWillUnmount){let t=this.componentWillUnmount.bind(this);this.componentWillUnmount=()=>{t(),this._isMounted=!1}}}),10)}}class r extends o{constructor(t){super(t),this.setWrapperRef=this.setWrapperRef.bind(this),this.onClick=this.onClick.bind(this)}componentDidMount(){document.addEventListener("mousedown",this.onClick)}componentWillUnmount(){document.removeEventListener("mousedown",this.onClick)}setWrapperRef(t){this.wrapperRef=t}onClick(t){this.wrapperRef&&!this.wrapperRef.contains(t.target)&&this.props.onClickaway&&this.props.onClickaway()}render(){return(0,i.h)("div",{ref:this.setWrapperRef},this.props.children)}}},8213:(t,e,n)=>{"use strict";n.r(e),n.d(e,{default:()=>f});var i=n(819),o=n(2493);const r=function(){var t={},e={VIEW:"view",EASING_FUNCTION:"easing-function"},n={};n[e.VIEW]={},n[e.EASING_FUNCTION]={};var o=function(t,e){if(!n[t])return null;for(var i in e)if(e.hasOwnProperty(i)){if(n[t][i])return null;n[t][i]=e[i]}},r=function(t){var e=t.getBoundingClientRect();return!(e.bottom<0||e.top>window.scrollY+window.innerHeight)},s=function(t,e,i){if(!n[t])throw"Can't add extension with type of \""+t+'", "'+t+'" is not a valid extension type. The following types are valid: '+Bt(n);if(!/^[-a-z]+$/.test(e))throw"Can't add extension with name \""+e+'", "'+e+'" is contains invalid characters. Only lowercase alphabetical characters and dashes are allowed.';if(n[t][e])throw"Can't add extension with name \""+e+'", "'+e+'" is already added.';n[t][e]=i},a=function(t,e){if(!n[t])throw"Can't get extension with type of \""+t+'", "'+t+'" is not a valid extension type. The following types are available: '+Bt(n);if(!n[t][e])throw"Can't get extension with name \""+e+'", "'+e+'" is not available. The following extensions are available: '+Bt(n[t]);return n[t][e]},l=function(t){return{destroy:function(){t.destroyed=!0,t.frame&&cancelAnimationFrame(t.frame),t.styleObserver&&t.styleObserver.disconnect(),t.didResizeWindow&&window.removeEventListener("resize",t.didResizeWindow),t.root&&t.root.parentNode&&t.root.parentNode.removeChild(t.root)}}},p=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document.createElement("span"),n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return t.root=e,t.aligned=null,t.destroyed=!1,e&&n&&(t.root.classList.add("tick-"+n),t.root.setAttribute("data-view",n)),e&&e.dataset.layout&&(t.align=(e.dataset.layout.match(/left|right|center/)||[])[0]||"left"),{appendTo:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"last";!t.root||t.root&&t.root.parentNode||("last"!==n?("first"===n&&(0===e.childNodes.length?e.appendChild(t.root):0===e.children.length&&e.childNodes.length?e.insertBefore(t.root,e.childNodes[e.childNodes.length-1]):e.insertBefore(t.root,e.children[0])),"string"!=typeof n&&e.insertBefore(t.root,n)):e.childNodes.length&&e.childNodes[e.childNodes.length-1].nodeType===Node.TEXT_NODE?e.insertBefore(t.root,e.childNodes[e.childNodes.length-1]):e.appendChild(t.root))}}},u=function(t,e){return t.definition=e,{setDefinition:function(e){t.definition=e}}},c=function(t,e,n,i){return{draw:function(){return t.dirty?(e(t,i),d(t),t.dirty=!1,!0):(n&&n(t)&&d(t),!1)}}},d=function(t){if(!t.fit){if(!t.root||!(t.root.getAttribute("data-layout")||"").match(/fit/))return void(t.fit=!1);var e=window.getComputedStyle(t.root,null);t.fit=!0,t.fitInfo={currentFontSize:parseInt(e.getPropertyValue("font-size"),10)}}t.fitInfo.availableWidth=t.root.parentNode.clientWidth,t.fitInfo.currentWidth=t.root.scrollWidth;var n=Math.min(Math.max(4,t.fitInfo.availableWidth/t.fitInfo.currentWidth*t.fitInfo.currentFontSize),1024);Math.abs(n-t.fitInfo.currentFontSize)<=1||(t.fitInfo.currentFontSize=n,t.root.style.setProperties("fontSize",t.fitInfo.currentFontSize+"px","important"))},f=function(t){return t.dirty=!0,t.value=null,t.valueUpdateCount=0,t.isInitialValue=function(){return t.valueUpdateCount<=1},{reset:function(){t.dirty=!0,t.value=null,t.valueUpdateCount=0},update:function(e){Rt(t.value,e)||(t.value=e,t.valueUpdateCount++,t.dirty=!0)}}},h=function(t){t.didResizeWindow=function(){t.dirty=!0},window.addEventListener("resize",t.didResizeWindow)},m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},g=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},y=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),_=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},v=function(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)},b=function(t,e){var n=(t.definition||[]).concat();"right"===t.align&&n.reverse();var i=Array.isArray(t.value)?t.value.concat():"object"===m(t.value)?Ot(t.value):t.value;n.forEach((function(n){if(!n.presenter){if(t.update=e(n),!n.presenter)return;n.presenter.appendTo(t.root)}})),n.filter((function(t){return void 0!==t.presenter})).forEach((function(e){Array.isArray(i)&&t.valueMapping?t.update(e,"indexes"===t.valueMapping?"right"===t.align?i.pop():i.shift():i):e.key&&void 0!==i[e.key]?t.update(e,i[e.key]):t.update(e,i)})),t.views=n,w(t)},w=function(t){var e=!1;return t.views.filter((function(t){return void 0!==t.presenter})).forEach((function(t){t.presenter.draw()&&(e=!0)})),e},k=function(t,e,n){var i=Pt(Array.isArray(t.value)?t.value:(t.value+"").split(""));if("right"===t.align&&i.reverse(),t.definitions.length>i.length)for(;t.definitions.length>i.length;)t.definitions.pop().presenter.destroy();i.forEach((function(n,i){var o=t.definitions[i];o||(o=t.definitions[i]=ut(t.definition),t.update=e(o),o.presenter.appendTo(t.root,"right"===t.align?"first":"last"))})),i.forEach((function(e,n){return t.update(t.definitions[n],e)})),t.views=i,x(t)},x=function(t){var e=!1;return t.views.forEach((function(n,i){t.definitions[i].presenter.draw()&&(e=!0)})),e},C=function(t,e){var n=document.createElement(t);return e&&(n.className=e),n},Z=function(t,e,n){var i=new MutationObserver((function(i){e.forEach((function(o){i.filter((function(t){return e.includes(t.attributeName)})).length&&n(t.getAttribute(o))}))}));return i.observe(t,{attributes:!0}),i},z=function(t){return t instanceof HTMLElement},D=function(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";t.transforms||(t.transforms=[]);var o=t.transforms.find((function(t){return t.name===e}));o?o.value=n:t.transforms.push({name:e,value:n,unit:i}),S(t,t.transforms)},S=function(t,e){t.style.setProperty("transform",e.map((function(t){return t.name+"("+t.value+t.unit+")"})).join(" "),"important")},E={},I=function(t,e){var n=e.toString();return E[n]||(E[n]={}),E[n][t]||(E[n][t]=e(t)),E[n][t]},j=new RegExp("^[0-9]+$"),F=new RegExp("^(true|false)$"),A=new RegExp("^[0-9.]+$"),O=new RegExp("color"),P=new RegExp("shadow"),N=new RegExp("^(follow-gradient|horizontal-gradient|vertical-gradient)"),R=new RegExp("^[.0-9]+(?:ms|s){1}$"),M=new RegExp("^transition-?(?:in|out)?$"),T=new RegExp("^url\\("),U=function(t){return t?parseFloat(t)*(/ms$/.test(t)?1:1e3):0},B=function(t){return t.match(/[a-z]+(?:\(.*?\))?\s?(?:origin\(.*?\))?\s?(?:[a-z]+\(.*?\))?[ .a-z-0-9]*/g).map(W)},W=function(t){var e=t.match(/([a-z]+(?:\(.*?\))?)\s?(?:origin\((.*?)\))?\s?([a-z]+(?:\(.*?\))?)?\s?(?:([.0-9ms]+)?\s?(?:(ease-[a-z-]+))?\s?([.0-9ms]+)?)?/),n=vt(e[1]),i=void 0,o=void 0,r=void 0,s=void 0,a=void 0;return e.slice(2).filter((function(t){return void 0!==t})).forEach((function(t){R.test(t)?void 0===o?o=U(t):s=U(t):/ /.test(t)?i=t:/^ease-[a-z-]+$/.test(t)?r=t:/^[a-z]+/.test(t)&&(a=vt(t))})),a&&(o=void 0,r=void 0),{name:n.name,parameters:n.parameters,duration:o,ease:r,delay:s,origin:i,resolver:a}},V=function(t){var e=t.match(/follow-gradient|horizontal-gradient|vertical-gradient/)[0];return{type:e,colors:t.substr(e.length).match(/(?:transparent|rgb\(.*?\)|hsl\(.*?\)|hsla\(.*?\)|rgba\(.*?\)|[a-z]+|#[abcdefABCDEF\d]+)\s?(?:[\d]{1,3}%?)?/g).map(L)}},$=/\s([\d]{1,3})%?$/,L=function(t){var e=t.match($);return{offset:e?parseFloat(e[1])/100:null,value:q(t.replace($,""))}},q="undefined"==typeof document?function(t){return t}:function(t){if("transparent"===t)return"rgba(0,0,0,0)";var e=document.createElement("span");return e.style.cssText="position:absolute !important;visibility:hidden !important;color:"+t+" !important",document.body.appendChild(e),requestAnimationFrame((function(){e.parentNode.removeChild(e)})),window.getComputedStyle(e).getPropertyValue("color")},H=function(t){return"string"!=typeof t?t:t.match(/([-.\d]+(?:%|ms|s|deg|cm|em|ch|ex|q|in|mm|pc|pt|px|vh|vw|vmin|vmax)?)|[%#A-Za-z0-9,.()]+/g)},K=function(t){var e=t.split(":").map(At),n=e[0].trim().split("-").map((function(t,e){return e>0?function(t){return t.charAt(0).toUpperCase()+t.slice(1)}(t):t})).join(""),i=function(t,e){return F.test(t)?"string"==typeof t?"true"===t:t:j.test(t)?parseInt(t,10):A.test(t)?parseFloat(t):T.test(t)?1===(n=t.match(/url\((.*?)\)/g).map((function(t){return t.substring(4,t.length-1)}))).length?n[0]:n:O.test(e)?N.test(t)?I(t,V):I(t,q):P.test(e)?I(t,H):M.test(e)?"none"===t?t:I(t,B):t;var n}(e[1],e[0]);return n&&null!=i?{property:n,value:i}:null},X={"ease-out-sine":function(t){return Math.sin(t*(Math.PI/2))},"ease-out-cubic":function(t){var e=t-1;return e*e*e+1},"ease-out-bounce":function(t){var e=t/1;if(e<1/2.75)return 7.5625*e*e;if(e<2/2.75){var n=e-1.5/2.75;return 7.5625*n*n+.75}if(e<2.5/2.75){var i=e-2.25/2.75;return 7.5625*i*i+.9375}var o=e-2.625/2.75;return 7.5625*o*o+.984375}};o(e.EASING_FUNCTION,X);var Y=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.lastAppliedStyles=null,G(t,e,t.root.dataset.style),t.styleObserver=Z(t.root,["data-style"],(function(n){G(t,e,n)})),{setStyle:function(n){G(t,e,n)}}},G=function(t,e,n){t.lastAppliedStyles!==n&&(t.lastAppliedStyles=n,t.style=n?It(e,function(t){return t.split(";").filter((function(t){return t.trim().length})).map(K).filter((function(t){return null!==t})).reduce((function(t,e){return t[e.property]=e.value,t}),{})}(n)):e,t.dirty=!0)},J={text:function(){return function(t){var e={};return Object.assign({},p(e,t,"text"),f(e),c(e,(function(t){t.root.setAttribute("data-value",t.value),function(t,e){var n=t.childNodes[0];n?e!==n.nodeValue&&(n.nodeValue=e):(n=document.createTextNode(e),t.appendChild(n))}(t.root,t.value)})),l(e))}}};o(e.VIEW,J);var Q=function(t,e,n){return function(t,e,n){var i={valueMapping:null};if(t&&t.dataset.valueMapping){var o=t.dataset.valueMapping;i.valueMapping=-1!==["none","indexes"].indexOf(o)?o:null}return Object.assign({},p(i,t),h(i),f(i),u(i,e),c(i,b,w,n),l(i))}(t,e,n)},tt=function(t,e){return"-"===t[e]&&">"===t[e+1]},et=function(t){return"'"===t||'"'===t},nt=function(t){return","===t},it=function(t){return"("===t},ot=function(t){return")"===t},rt=function(t){return 0!==t.trim().length},st=function(t,e){return t.push(e.trim())},at=function(t,e){return rt(e)?(st(t,e),""):e},lt=function(t,e){return t.length&&e.push(t.length>1?t.concat():t[0]),[]},pt=function t(e,n,i){for(var o="",r=[],s=null,a=!1;e<n.length;){var l=n[e];if(it(l)){a=!1;var p=[o.trim()];l=n[e=t(e+1,n,p)],r.push(p),o=""}else{if(ot(l))return a&&o.trim().length&&(r.push([o.trim()]),o="",a=!1),rt(o)&&st(r,o),r=lt(r,i),e+1;null!==s&&l!==s?o+=l:l===s?(r.push(o),o="",s=null):et(l)?(o="",s=l):tt(n,e)?(a=!0,o.trim().length&&(r.push([o.trim()]),o=""),e+=2):nt(l)?(a&&o.trim().length&&(r.push([o.trim()]),o="",a=!1),r=lt(r,i),o=at(i,o)):o+=l,e++}}return(a&&o.trim().length||!a&&o.trim().length&&!r.length)&&(r.push([o.trim()]),o=""),lt(r,i),at(i,o),e},ut=function t(e){var n={};for(var i in e)e.hasOwnProperty(i)&&(n[i]="root"!==i?"children"!==i?"repeat"!==i?e[i]:null===e[i]?null:t(e[i]):null===e[i]?null:e[i].map(t):e[i].cloneNode());return n.presenter=null,n},ct={root:null,key:null,view:null,overlay:null,presenter:null,transform:null,layout:null,style:null,repeat:null,children:null,className:null},dt=function t(e){return Array.from(e).map((function(e){var n=It(ct,{root:e});for(var i in e.dataset)e.dataset.hasOwnProperty(i)&&void 0!==n[i]&&(n[i]=e.dataset[i]);return n.repeat?(n.repeat=t(e.children).pop(),Array.from(e.children).forEach((function(t){t.parentNode.removeChild(t)}))):e.children.length&&(n.children=t(e.children)),n}))},ft=function t(e){return e.map((function(e){return"string"==typeof(e=It(ct,e)).root?e.root=document.createElement(e.root):e.root=document.createElement("span"),e.transform&&(e.root.dataset.transform=e.transform),e.className&&(e.root.className=e.className),e.overlay&&(e.root.dataset.overlay=e.overlay),e.view?(e.root.dataset.view=e.view,e.style&&(e.root.dataset.style=e.style),e.repeat=null):(e.layout&&(e.root.dataset.layout=e.layout),e.repeat?(e.root.dataset.repeat=!0,e.repeat=t(e.children).pop()):e.children&&(e.children=t(e.children),e.children.forEach((function(t){e.root.appendChild(t.root)})))),e}))},ht=function(t){var n=!1,i=function(e,i){e.transform(i,(function(t){e.presenter.update(t)}),t),n||(n=!0,o())},o=function e(){t.baseDefinition.presenter.draw(),requestAnimationFrame(e)};return function n(o){return o.presenter=function(t,n){var i,o,s,d,m=void 0;return t.repeat?m=function(t,e,n){return function(t,e,n){var i={definitions:[]};return Object.assign({},p(i,t),f(i),u(i,e),c(i,k,x,n),l(i))}(t,e,n)}(t.root,t.repeat,n):"string"==typeof t.view?(i=t.view,o=t.root,s=t.style,m=(d=a(e.VIEW,i))?d({Extension:{Type:e,getExtension:a},Utils:{},Canvas:{},DOM:{visible:r,create:C,transform:D},Animation:{},Date:{performance:Nt},View:{rooter:p,drawer:c,updater:f,styler:Y,grouper:u,resizer:h,destroyer:l}})(o,s):null):function(t){return t.children&&t.children.length}(t)&&(m=Q(t.root,t.children,n)),m}(o,n),o.transform=yt(o.transform,t),i}(t.baseDefinition)},mt=function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];return function(e,i){!function e(o,r){n.length<=o?i(r):n[o](r,gt(e,[o+1]),t)}(0,e)}},gt=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments[2];return function(){var i=Array.from(e);return Array.prototype.push.apply(i,arguments),t.apply(n,i)}},yt=function(t,e){if(!t)return function(t,e){return e(t)};if("function"==typeof t)return t;var n=function(t){var e=[];return pt(0,t,e),e}("transform("+(/^[a-z]+$/.test(t)?t+"()":t)+")");return _t(n,e)},_t=function t(n,i){var o=n.map((function(n){var o=n.shift(),r=a(e.TRANSFORM,o)||function(t,e,n){e(t)},s=n.map((function(e){return Array.isArray(e)?"string"==typeof e[0]?t([e],i):t(e,i):Et(e)}));return r.apply(void 0,v(s))}));return mt.apply(void 0,[i].concat(v(o)))},vt=function(t){var e=t.match(/[a-z]+/)[0];return{name:e,parameters:bt(t.substring(e.length))}},bt=function(t){(t.match(/('.+?')|(".+?")|(\[.+?])|([.:\-\d\sa-zA-Z]+%?)/g)||[]).map(At).filter((function(t){return t.length})).map(Et)},wt=function(t){return t.substring(1,t.length-1)},kt=/^([\d]{4}-[\d]{1,2}-[\d]{1,2})/,xt=/^(true|false)$/,Ct=/^[\a-zA-Z]+$/,Zt=/^0[\d]+/,zt=/^('|")/,Dt=/^-?(?:\d+)?(?:\.|0\.)?[\d]+$/,St=/^(\[)/,Et=function(t){return xt.test(t)?"true"===t:St.test(t)?bt(wt(t)):kt.test(t)?dateFromISO(t):zt.test(t)?wt(t):Ct.test(t)||Zt.test(t)?t:Dt.test(t)?parseFloat(t):t},It=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=void 0,i={};for(n in t)t.hasOwnProperty(n)&&(i[n]=void 0===e[n]?t[n]:e[n]);return i},jt=function(t){var e=window,n=t.split(".");return n.forEach((function(t,i){e[n[i]]&&(e=e[n[i]])})),e!==window?e:null},Ft=function(t){return/^(?:[\w]+\s?:\s?[\w.]+,\s?)+(?:[\w]+\s?:\s?[\w.]+)$/g.test(t)?t.match(/(?:(\w+)\s?:\s?([\w.]+))/g).reduce((function(t,e){var n=e.split(":");return t[n[0]]=Et(n[1]),t}),{}):Et(t)},At=function(t){return t.trim()},Ot=function(t){return"object"===(void 0===t?"undefined":m(t))&&null!==t?i.Z.parseJSON(i.Z.stringify(t)):t},Pt=function(t){return t.slice()},Nt=function(){return window.performance.now()},Rt=function(t,e){return Mt(t)?Tt(t,e):Array.isArray(t)?Ut(t,e):t===e},Mt=function(t){return t===Object(t)},Tt=function(t,e){for(var n in t)if(!e.hasOwnProperty(n)||t[n]!==e[n])return!1;return!0},Ut=function(t,e){return t.length==e.length&&t.every((function(t,n){return t===e[n]}))},Bt=function(t){return Object.keys(t).map((function(t){return'"'+t+'"'})).join(", ")},Wt=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document.createElement("div");g(this,t),this._options=It(t.options(),e),this._element=n,this._value=null,this._observer=null,this._viewDefinition=null,this._updater=null,this._didInit=null,this._didDestroy=null,this._willDestroy=null,this._didUpdate=null,this._init()}return y(t,[{key:"isRootElement",value:function(t){return this._element===t}},{key:"destroy",value:function(){this._willDestroy(this),this._observer.disconnect(),this.baseDefinition.presenter.destroy(),this._didDestroy(this)}},{key:"redraw",value:function(){this.baseDefinition&&this.baseDefinition.presenter&&(this.baseDefinition.presenter.reset(),this.baseDefinition.presenter.draw(),this._updater(this.baseDefinition,this._value))}},{key:"_init",value:function(){var t=this;this._viewDefinition=this._options.view,this._willDestroy=this._options.willDestroy,this._didDestroy=this._options.didDestroy,this._didInit=this._options.didInit,this._didUpdate=this._options.didUpdate,this._value=this._options.value,this._element.classList.contains("tick")||this._element.classList.add("tick"),this._observer=Z(this._element,["data-value"],(function(e){t.value=e})),this._viewDefinition.root!==this._element&&(Array.from(this._viewDefinition.root.children).forEach((function(e){t._element.appendChild(e)})),this._viewDefinition.root=this._element),this._viewDefinition.view||this._viewDefinition.children||(this._viewDefinition.view="text"),this._updater=ht(this),null!==this.value&&this._update(this.value),this._element.dataset.state="initialised",this._didInit(this,this.value)}},{key:"_update",value:function(t){this._updater(this.baseDefinition,t),this._didUpdate(this,t)}},{key:"baseDefinition",get:function(){return this._viewDefinition}},{key:"root",get:function(){return this._element}},{key:"value",get:function(){return this._value},set:function(t){this._value="string"==typeof t?Ft(t):t,this._update(t)}}],[{key:"options",value:function(){return{value:null,view:null,didInit:function(t){},didUpdate:function(t,e){},willDestroy:function(t){},didDestroy:function(t){}}}}]),t}(),Vt=[],$t={value:Ft,didInit:jt,didUpdate:jt,didDestroy:jt,willDestroy:jt},Lt=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=t.dataset,o={meta:{}};for(var r in i)if(i.hasOwnProperty(r)){var s=e[r],a=i[r];s&&(a=null===(a=s(a))?Ot(n[r]):a,o[r]=a)}return o},qt=function(t){var e=Vt.filter((function(e){return e.isRootElement(t)}));return e?e[0]:null},Ht=function(){return _({},Wt.options())},Kt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;if(t&&!z(t)&&(e=t,t=void 0),!t||!qt(t)){e&&e.view&&(e.view=ft([e.view])[0]),!e&&t&&(e=Lt(t,$t,Ht())),t&&(e||(e={}),e.view||(e.view=dt([t])[0]));var n=new Wt(e,t);return Vt.push(n),n}},Xt={supported:function(){var t=window;if(void 0===t)return!1;var e=t.CSS&&t.CSS.supports,n=!!t.MSInputMethodContext&&!!document.documentMode,i=e&&CSS.supports("transform","translateX(0)");return n||e&&i&&!!["MutationObserver","requestAnimationFrame"].filter((function(e){return e in t})).length}(),options:{},DOM:{create:Kt,destroy:function(t){var e=function(t,e){for(var n=0,i=t.length;n<i;n++)if(t[n].isRootElement(e))return n;return-1}(Vt,t);return!(e<0||(Vt[e].destroy(),Vt.splice(e,1),0))},parse:function(t){var e,n=void 0,i=void 0,o=[];for(i=(e=t.querySelectorAll(".tick:not([data-state])")).length;i--;)n=e[i],o.push(Kt(n));return o},find:qt},plugin:{add:function(t,e,n){if("function"==typeof t){var i=t;return s(i.identifier.type,i.identifier.name,i)}return s(t,e,n)}}},Yt=function(t){if(!e.hasOwnProperty(t))return"continue";Xt.plugin[function(t){return t.replace(/-./g,(function(t){return t.charAt(1).toUpperCase()}))}("add-"+e[t])]=function(n,i){s(e[t],n,i)}};for(var Gt in e)Yt(Gt);return t.exports=Xt,t.exports}();var s=n(9980),a=n.n(s),l=n(6400);r.plugin.add(a());class p extends o.M{constructor(t){var e,n,i;super(t),i={flipKey:"43"},(n="state")in(e=this)?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,this.timer=setInterval((()=>{if(this.props._destroy)return this.componentWillUnmount();let t=this.props.com.countdown||{},e="cd:"+t.skin+":"+t.size+":"+this.props.plugin.popup.font_family+":";this.state.flipKey!==e&&this.setState({flipKey:e}),this.forceUpdate()}),500)}componentWillUnmount(){clearInterval(this.timer)}getCountDownDeltaSec(t){let e;if("fixed_time"===t.expire_time_type&&(e=t.fixed_time),"visit_time"===t.expire_time_type&&(e=this.props.store.pageLoaded()+6e4*t.visit_time),"repeat_daily"===t.expire_time_type&&((n=new i.Z.Date).setHours(0,0,0,0),e=n.getTime()+6e4*t.repeat_daily),"repeat_weekly"===t.expire_time_type){let r=0,s=(new i.Z.Date).getDay();if(r=0===s?"sunday"===t.repeat_weekly_weekday?0:7-(new i.Z.Date).getDay():"sunday"===t.repeat_weekly_weekday?7-s:u[t.repeat_weekly_weekday]-s,r<0)o=0;else if(0==r)(n=new i.Z.Date).setHours(0,0,0,0),e=n.getTime()+6e4*t.repeat_weekly_min;else{var n;(n=new i.Z.Date).setHours(0,0,0,0),e=n.getTime()+6e4*t.repeat_weekly_min+864e5*r}}let o=e-i.Z.Date.now();return o<0&&(o=0),Math.floor(o/1e3)||0}renderElectricCountdown(t,e,n,o,r,s,a){let p="28px";return"sm"===this.props.com.countdown.size&&(p="20px"),"lg"===this.props.com.countdown.size&&(p="40px"),(0,l.h)("div",{class:"countdown_electric"},(0,l.h)("div",{class:"countdown_electric_group"},(0,l.h)("div",{class:"countdown_electric_label"},this.props.t("hour")),(0,l.h)("div",{class:"countdown_electric_numbers"},(0,l.h)("div",{class:"countdown_electric_number",style:i.Z.js2css({font_size:p,font_family:this.props.plugin.popup.font_family})},e),(0,l.h)("div",{class:"countdown_electric_number",style:i.Z.js2css({font_size:p,font_family:this.props.plugin.popup.font_family})},n))),(0,l.h)("div",{class:"countdown_electric_group"},(0,l.h)("div",{class:"countdown_electric_label"},this.props.t("min")),(0,l.h)("div",{class:"countdown_electric_numbers"},(0,l.h)("div",{class:"countdown_electric_number",style:i.Z.js2css({font_size:p,font_family:this.props.plugin.popup.font_family})},o),(0,l.h)("div",{class:"countdown_electric_number",style:i.Z.js2css({font_size:p,font_family:this.props.plugin.popup.font_family})},r))),(0,l.h)("div",{class:"countdown_electric_group"},(0,l.h)("div",{class:"countdown_electric_label"},this.props.t("sec")),(0,l.h)("div",{class:"countdown_electric_numbers"},(0,l.h)("div",{class:"countdown_electric_number",style:i.Z.js2css({font_size:p,font_family:this.props.plugin.popup.font_family})},s),(0,l.h)("div",{class:"countdown_electric_number",style:i.Z.js2css({font_size:p,font_family:this.props.plugin.popup.font_family})},a))))}renderFlipCountdown(t,e,n,i,o,r,s){let a=null;if(t>99&&(t=99),t>0){let e=Math.floor(t/10)+"",n=t%10+"";a=(0,l.h)("div",{class:"countdown_group"},(0,l.h)(c,{key:this.state.flipKey+4,value:e+""+n,plugin:this.props.plugin,com:this.props.com}),(0,l.h)("div",{class:"countdown_label"},this.props.t("day")))}return(0,l.h)("div",{class:"countdown"},a,(0,l.h)("div",{class:"countdown_group"},(0,l.h)(c,{key:this.state.flipKey+1,value:e+""+n,plugin:this.props.plugin,com:this.props.com}),(0,l.h)("div",{class:"countdown_label"},this.props.t("hour"))),(0,l.h)("div",{class:"countdown_group"},(0,l.h)(c,{key:this.state.flipKey+2,value:i+""+o,plugin:this.props.plugin,com:this.props.com}),(0,l.h)("div",{class:"countdown_label"},this.props.t("min"))),(0,l.h)("div",{class:"countdown_group"},(0,l.h)(c,{key:this.state.flipKey+3,value:r+""+s,plugin:this.props.plugin,com:this.props.com}),(0,l.h)("div",{class:"countdown_label"},this.props.t("sec"))))}render(){let t=this.getCountDownDeltaSec(this.props.com.countdown),e=Math.floor(t/86400),n=Math.floor((t-86400*e)/3600),i=Math.floor((t-86400*e-3600*n)/60),o=t-86400*e-3600*n-60*i,r=Math.floor(o/10)+"",s=o%10+"",a=Math.floor(i/10)+"",l=i%10+"",p=Math.floor(n/10)+"",u=n%10+"";return"electric"===this.props.com.countdown.skin?this.renderElectricCountdown(e,p,u,a,l,r,s):this.renderFlipCountdown(e,p,u,a,l,r,s)}}const u={sunday:0,monday:1,tuesday:2,wednesday:3,thursday:4,friday:5,saturday:6};class c extends o.M{constructor(t){super(t),this._tickRef=(0,l.Vf)()}componentDidMount(){this._tickInstance=r.DOM.create(this._tickRef.current,{value:this.props.value})}componentDidUpdate(){this._tickInstance&&(this._tickInstance.value=this.props.value)}componentWillUnmount(){this._tickInstance&&r.DOM.destroy(this._tickRef.current)}render(){let t="28px";return"sm"===this.props.com.countdown.size&&(t="20px"),"lg"===this.props.com.countdown.size&&(t="40px"),(0,l.h)("div",{ref:this._tickRef,class:"tick"},(0,l.h)("div",{"data-repeat":"true","aria-hidden":"true"},(0,l.h)("span",{"data-view":"flip",style:i.Z.js2css({font_size:t,font_family:this.props.plugin.popup.font_family})})))}}let d=n.e(782).then(n.bind(n,9782));class f extends o.M{constructor(t){var e,n,o;super(t),o={close:!1,cssready:!1,closeAnimation:!0,pressedSubmit:!1,imageReady:!1},(n="state")in(e=this)?Object.defineProperty(e,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[n]=o,this._formRef=(0,l.Vf)(),setTimeout((()=>this.fillForm()),1e3),setTimeout((async()=>{let{body:t}=await this.props.store.sendImpression(this.props.plugin.id);this.impressionToken=i.Z.get(t,"impression_token")||""}),10),setTimeout((()=>{let t={};t[this.props.plugin.popup.font_family]=!0;let e={};i.Z.map(this.props.plugin.popup.pages,(n=>{n&&i.Z.map(n.components,(n=>{t[i.Z.get(n,"style.font_family")]=!0,t[i.Z.get(n,"mobile_style.font_family")]=!0,"image"===n.type&&n.image&&n.image.url&&n.image.url.startsWith("http")&&(e[n.image.url]=!0)}))})),0==i.Z.size(e)&&this.setState({imageReady:!0}),i.Z.map(e,((t,e)=>i.Z.preloadImg(e,(()=>this.setState({imageReady:!0}))))),i.Z.preloadWebfonts(Object.keys(t))}))}openPopup(){this.setState({close:!1})}getPageIndex(){return void 0!==this.props.plugin._page_index?this.props.plugin._page_index:this.props.pageIndex}isFormFilled(){let t=i.Z.get(this.props.plugin.popup,`pages.${this.getPageIndex()}`),e=i.Z.find(t.components,(t=>"form"===t.type));if(!e||!e.form)return;let n=i.Z.get(e,"form.fields",[]);return!i.Z.find(n,(t=>!!t.is_required&&(!this.isFieldValid(t.key,t.validate)||this.isFieldEmpty(t.key))))}fillForm(){let t=i.Z.get(this.props.plugin.popup,`pages.${this.getPageIndex()}`),e=i.Z.find(t.components,(t=>"form"===t.type));if(!e)return;let n=this.props.store.matchUser(),o=i.Z.get(n,"attributes"),r=i.Z.get(e,"form.fields",[]);i.Z.each(r,(t=>{let e=t.key;"email"===e&&(e="emails"),"phone"===e&&(e="phones"),"emails"===e&&"phones"==e&&"fullname"===e&&i.Z.map(o,(n=>{if(e===n.key){var i=this._formRef.current.elements[t.key];i&&(i.value=n.text)}}))}))}isFieldValid(t,e){if(!e)return!0;if(!this._formRef||!this._formRef.current)return!1;var n=new FormData(this._formRef.current);for(var o of n.entries())if(o[0]===t)return"email"===e?i.Z.isEmail(o[1]):"phone"===e?i.Z.isPhone(o[1]):"url"===e?i.Z.isURL(o[1]):"number"!==e||i.Z.isNumber(o[1]);return!0}isFieldEmpty(t){if(!this._formRef||!this._formRef.current)return!1;var e=new FormData(this._formRef.current);for(var n of e.entries())if(n[0]===t)return""===n[1]||void 0===n[1];return!0}renderCloseButton(){return this.props.plugin.popup.show_close_button?(0,l.h)("div",{class:"btn_close default",onClick:t=>this.setClose(!0)},(0,l.h)("svg",{class:"btn_close__icon",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24","stroke-linecap":"round","stroke-linejoin":"round"},(0,l.h)("line",{x1:"17",y1:"7",x2:"7",y2:"17",style:"stroke-width: 3 !important;"}),(0,l.h)("line",{x1:"7",y1:"7",x2:"17",y2:"17",style:"stroke-width: 3 !important;"}))):null}setClose(t){t?(document.body.style.setProperty("overflow",this.lastoverflow),this.setState({closeAnimation:!0}),setTimeout((()=>this.setState({close:!0,closeAnimation:!1})),150),this.props.plugin._dont_close&&setTimeout((()=>{this.lastoverflow=window.getComputedStyle(document.body).getPropertyValue("overflow"),document.body.style.setProperty("overflow","hidden","important"),this.setState({closeAnimation:!1,close:!1})}),1500)):(this.lastoverflow=window.getComputedStyle(document.body).getPropertyValue("overflow"),document.body.style.setProperty("overflow","hidden","important"),this.setState({closeAnimation:!1}))}onButtonClick(t,e){t.stopPropagation(),i.Z.get(this.props.plugin,"popup",{});let n=i.Z.get(this.props.plugin.popup,`pages.${this.getPageIndex()}`),o=[],r=i.Z.find(n.components,(t=>"buttons"===t.type));"background"===e&&(o=i.Z.get(n,"background_click.actions")||[]),"primary"===e&&r.buttons.primary_enabled&&(o=r.buttons.primary_actions||[]),"secondary"===e&&r.buttons.secondary_enabled&&(o=r.buttons.secondary_actions||[]);let s=!1;for(let t of o)"conversion"!==t.action&&"submit"!==t.action||(s=!0,this.setState({pressedSubmit:!0}));if(!s||this.isFormFilled()){var a=!1;for(let t of o)"submit"!==t.action&&"conversion"!==t.action||(a=!0);if(a){var l=new FormData(this._formRef.current),p=[];let t=i.Z.cloneDeep(this.props.store.matchUser());for(var u of l.entries()){let e=i.Z.get(this.props.plugin.popup,`pages.${this.getPageIndex()}`),n=i.Z.find(e.components,(t=>"form"===t.type)),o=i.Z.get(n,"form.fields",[]),r=i.Z.find(o,(t=>t.key===u[0]));if(!r.type)return;p.push({key:u[0],type:r.type,value:i.Z.stringify(u[1])});let s=u[0];"email"===s&&(s="emails"),"phone"===s&&(s="phones"),i.Z.setUserAttr(t,{key:s,text:u[1]})}this.props.store.sendConversion(this.props.plugin.id,p,this.impressionToken),this.props.store.setUser(t)}for(let t of o)"open_widget"===t.action&&this.props.showWidget("list");for(let t of o)"close"===t.action&&setTimeout((()=>this.setClose(!0)),100),"next_page"===t.action&&this.props.nextPage();for(let t of o){if(!t.url)continue;let e=t.url;if(e.startsWith("http://")||e.startsWith("https://")||(e="//"+e),"open_url"===t.action&&t.new_tab)return window.open(e,"_blank");if("open_url"===t.action&&!t.new_tab)return void(window.location.href=e)}}}renderButtons(t,e){let n=i.Z.get(this.props.plugin,"popup",{}),o=t.style||{},r=Object.assign({},o);delete r.justify_content,delete r.align_items,delete r.flex_direction,delete r.display,r.color=r.color||"#fff",r.font_weight=r.font_weight||"500",r.font_size=r.font_size||n.font_size||"14px",r.background=r.background||n.text_color;let s=null;if(t.buttons.primary_enabled&&t.buttons.primary_text){let o=Object.assign({font_size:n.font_size||"14px"},e.primary_button);i.Z.get(t,"style.background")&&(o.background=t.style.background),i.Z.get(t,"style.color")&&(o.color=t.style.color),s=(0,l.h)("div",{class:"btn btn__primary ",style:this.js2css(r),onClick:t=>this.onButtonClick(t,"primary")},this.props.t.i18n(t.buttons.i18n_primary_text)||t.buttons.primary_text)}let a=null;if(t.buttons.secondary_enabled&&t.buttons.secondary_text){let i=Object.assign({font_size:n.font_size||"14px"},e.secondary_button);a=(0,l.h)("div",{class:"btn btn__secondary",style:this.js2css(i),onClick:t=>this.onButtonClick(t,"secondary")},this.props.t.i18n(t.buttons.i18n_secondary_text)||t.buttons.secondary_text)}return(0,l.h)("div",{class:"popup_component",style:this.js2css({display:"flex",flex_direction:o.flex_direction,align_items:o.align_items})},s,(0,l.h)("div",{style:this.js2css({width:"10px",height:"1px"})}),a)}js2css(t,e){let n=this.props.plugin.popup.spacer||10;return i.Z.js2css(t,e,{"@font_size":this.props.plugin.popup.font_size,"@font_family":this.props.plugin.popup.font_family,"@text_color":this.props.plugin.popup.text_color,"@faded_text_color":this.props.plugin.popup.faded_text_color,"@primary_color":this.props.plugin.popup.primary_color,"@spacer0":n/2+"px","@spacer":n+"px","@spacer2":2*n+"px","@spacer3":3*n+"px"})}renderSingleChoiceField(t){var e="form-control form-control__select "+this.props.plugin.popup.theme;let n=i.Z.map(t.options,(n=>(0,l.h)("label",{class:e},(0,l.h)("input",{type:"radio",name:t.key,value:n.value}),(0,l.h)("span",null,this.props.t.i18n(n.i18n_label)||n.label))));return(0,l.h)(l.HY,null,n)}renderDropdownField(t){let e=i.Z.map(t.options,(t=>(0,l.h)("option",{value:t.value},t.value))),n=i.Z.get(this.props.plugin,"popup.theme");var o="form-control form-control__select "+n;return"vintage"===n?(0,l.h)("div",{class:"form-control__text_container"},(0,l.h)("div",{class:"form-control_inside_label form-label vintage"},this.props.t.i18n(t.i18n_label)||t.label),(0,l.h)("select",{class:o,name:t.key},e)):(0,l.h)("select",{class:o,name:t.key},e)}renderMutiChoiceField(t){var e="form-control form-control__check "+this.props.plugin.popup.theme;let n=i.Z.map(t.options,(n=>(0,l.h)("label",{class:e},(0,l.h)("input",{required:t.is_required,type:"checkbox",name:t.key,value:n.value}),(0,l.h)("span",null,this.props.t.i18n(n.i18n_label)||n.label))));return(0,l.h)(l.HY,null,n)}renderTextField(t){let e=i.Z.get(this.props.plugin,"popup.theme");var n="form-control form-control__text "+e;return"simple"===e?(0,l.h)("input",{type:t.type,class:"form-control form-control__text simple",key:"form_field_"+t.key,name:t.key,placeholder:this.props.t.i18n(t.i18n_label)||t.label||this.props.t.i18n(t.i18n_placeholder)||t.placeholder}):"vintage"===e?(0,l.h)("div",{class:"form-control__text_container"},(0,l.h)("div",{class:"form-control_inside_label form-label vintage"},this.props.t.i18n(t.i18n_label)||t.label),(0,l.h)("input",{type:t.type,class:n,key:"form_field_"+t.key,name:t.key,placeholder:this.props.t.i18n(t.i18n_placeholder)||t.placeholder})):(0,l.h)("input",{type:t.type,class:n,key:"form_field_"+t.key,name:t.key,placeholder:this.props.t.i18n(t.i18n_placeholder)||t.placeholder})}renderMultilineTextField(t){let e=i.Z.get(this.props.plugin,"popup.theme");var n="form-control form-control__text "+e;return"simple"===e?(0,l.h)("textarea",{rows:"3",name:t.key,type:t.type,key:"form_field_"+t.key,class:"form-control form-control__text simple",style:this.js2css({overflow:"auto",resize:"none"}),placeholder:this.props.t.i18n(t.i18n_label)||t.label||this.props.t.i18n(t.i18n_placeholder)||t.placeholder}):"vintage"===e?(0,l.h)("div",{class:"form-control__text_container"},(0,l.h)("div",{class:"form-control_inside_label form-label vintage"},t.label),(0,l.h)("textarea",{rows:"3",name:t.key,type:t.type,key:"form_field_"+t.key,class:n,style:this.js2css({overflow:"auto",resize:"none"}),placeholder:this.props.t.i18n(t.i18n_label)||t.label||this.props.t.i18n(t.i18n_placeholder)||t.placeholder})):(0,l.h)("textarea",{rows:"3",name:t.key,type:t.type,key:"form_field_"+t.key,class:n,style:this.js2css({overflow:"auto",resize:"none"}),placeholder:this.props.t.i18n(t.i18n_placeholder)||t.placeholder})}renderFormComponent(t){let e=i.Z.get(this.props.plugin,"popup",{}),n=i.Z.map(t.form.fields,(t=>"email"===t.type?this.renderTextField(t):"single-choice"===t.type?this.renderSingleChoiceField(t):"multiple-choice"===t.type?this.renderMutiChoiceField(t):"multiline-text"===t.type?this.renderMultilineTextField(t):"text"===t.type?this.renderTextField(t):"dropdown"===t.type?this.renderDropdownField(t):void 0)),o=i.Z.get(e,"theme");return n=i.Z.map(n,((n,i)=>{let r=null,s=t.form.fields[i];r=(0,l.h)("div",{class:"form-label",style:this.js2css({color:e.text_color,font_family:e.font_family,font_size:e.font_size||"14px"})},this.props.t.i18n(s.i18n_label)||s.label),"vintage"===o&&"dropdown"===s.type&&(r=null),"vintage"!==o&&"simple"!==o||"email"!==s.type&&"text"!==s.type&&"multiline-text"!==s.type||(r=null);let a=null;return this.state.pressedSubmit&&!this.isFieldValid(s.key,s.validate)&&(a=(0,l.h)("div",{class:"text__danger ",style:this.js2css({margin_top:"5px",font_family:e.font_family,font_size:e.font_size})},this.props.t("invalid_field"))),this.state.pressedSubmit&&s.is_required&&this.isFieldEmpty(s.key)&&(a=(0,l.h)("div",{class:"text__danger ",style:this.js2css({margin_top:"5px",font_family:e.font_family,font_size:e.font_size})},this.props.t("required"))),(0,l.h)("div",{class:"field"},r,n,a)})),(0,l.h)("form",{style:this.js2css(t.style),class:"form popup_component",ref:this._formRef,onClick:t=>t.stopPropagation()},n)}renderComponents(t){let e=i.Z.find(t.components,(t=>"buttons"===t.type)),n=null;e&&(n=this.renderButtons(e,t));let o=0;return i.Z.map(t.components,((t,e)=>"image"===t.type?null:(o++,"buttons"===t.type?n:"follow_facebook"===t.type?this.renderFollowFacebook(t):"social_buttons"===t.type?this.renderSocialButtons(t):"line"===t.type?this.renderLineComponent(t):"text"===t.type?this.renderTextComponent(t,1===o):"form"===t.type?this.renderFormComponent(t):"countdown"===t.type?(0,l.h)("div",{class:"popup_component",onClick:t=>t.stopPropagation()},(0,l.h)(p,{destroy:this.props.destroy,t:this.props.t,com:t,store:this.props.store,plugin:this.props.plugin})):void 0)))}renderFollowFacebook(t){if(!i.Z.get(t,"follow_facebook.url"))return null;let e=this.props.mobile&&t.mobile_style||t.style,o={display:"flex",justify_content:e.justify_content},r={};return r.font_family=e.font_family||this.props.plugin.popup.font_family,r.font_size=e.font_size||this.props.plugin.popup.font_size||"14px",(0,l.h)("div",{class:"popup_component",style:this.js2css(o),onClick:t=>t.stopPropagation()},(0,l.h)("div",{class:"follow_fb_btn"},(0,l.h)("img",{alt:"follow",class:"follow_fb_btn__img",src:n(9639)}),(0,l.h)("span",{style:this.js2css(Object.assign({white_space:"nowrap",overflow:"hidden",text_overflow:"ellipsis"},r))},this.props.t("follow_us_on_facebook"))))}renderSocialButtons(t){let e=i.Z.get(t,"social_buttons.facebook"),o=null;e&&(o=(0,l.h)("a",{href:e,class:"social_button",target:"_blank"},(0,l.h)("img",{alt:"facebook",class:"social_button__img",src:n(7435)})));let r=i.Z.get(t,"social_buttons.zalo"),s=null;r&&(s=(0,l.h)("a",{href:r,class:"social_button",target:"_blank"},(0,l.h)("img",{alt:"zalo",class:"social_button__img",src:n(7298)})));let a=this.props.mobile&&t.mobile_style||t.style;return(0,l.h)("div",{class:"social_buttons popup_component",style:this.js2css(a),onClick:t=>t.stopPropagation()},o," ",s)}renderImageComponent(t,e){let n=Object.assign({pointer_events:"none"},this.props.mobile&&t.mobile_style||t.style,{position:"absolute"});return n.z_index||(n.z_index="-1"),(0,l.h)("div",{style:this.js2css(n)},(0,l.h)("div",{id:"image_component_"+this.props.plugin.id+"_"+this.getPageIndex()+"_"+e,style:this.js2css({width:"100%",height:"100%",background_image:`url("${encodeURI(i.Z.get(t,"image.url"))}")`,background_size:n.background_size||"cover",background_position:n.background_position||"auto"})}))}renderLineComponent(t){let e=this.props.mobile&&t.mobile_style||t.style;return(0,l.h)("div",{class:"popup_component",style:this.js2css(e)})}renderTextComponent(t,e){let n=i.Z.get(this.props.plugin,"popup",{}),o=Object.assign({color:n.text_color,font_family:n.font_family,font_size:n.font_size||"14px",white_space:"pre-wrap"},this.props.mobile&&t.mobile_style||t.style);return delete o.margin_top,delete o.margin_bottom,(0,l.h)("div",{class:"text popup_component",style:this.js2css(o),onClick:t=>t.stopPropagation()},this.props.t.i18n(i.Z.get(t,"text.i18n_html"))||i.Z.get(t,"text.html"))}async refreshCSS(){let t=this.props.store.matchPlugin();if(!i.Z.find(t,(t=>t.id===this.props.plugin.id)))return;let e=(await d).default.default.toString();var n=i.Z.replaceCssVariablePlugin(e,this.props.plugin.popup);let o=i.Z.get(this.props.plugin,"popup.pages.0.extra_css",[]),r=i.Z.map(o,(t=>`#sbz92 ${t.selector} { ${this.js2css(t.style)}}`)).join("\n");n+=r,i.Z.setCss(this.props.plugin.id,this.$cssStyleDiv,n)}componentWillUnmount(){i.Z.setCss(this.props.plugin.id,this.$cssStyleDiv,"")}async componentDidMount(){this.$cssStyleDiv=document.getElementById("subiz-style-for-"+this.props.plugin.id),this.$cssStyleDiv||(this.$cssStyleDiv=document.createElement("style"),document.head.appendChild(this.$cssStyleDiv),this.$cssStyleDiv.type="text/css",this.$cssStyleDiv.id="subiz-style-for-"+this.props.plugin.id),this.props.store.onResetCSS(this,(()=>this.refreshCSS())),await this.refreshCSS(),setTimeout((()=>{this.setState({cssready:!0}),this.setClose(!1)}),50)}calculateContainerCss(t,e){let n=t.position||"center",o=Object.assign({display:"flex"},this.props.mobile&&e.mobile_style||e.style,{max_width:"85%",max_height:"85%"}),r={};return i.Z.map(["left","top","right","bottom","box_shadow","transform"],(t=>{r[t]=o[t]})),r.position="absolute","center"!==n&&n||(r.top="50%",r.transform="translateY(-50%) translateX(-50%)",r.left="50%",delete r.right,delete r.bottom),"fullscreen"===n&&(r.top=0,r.left=0,r.right=0,r.bottom=0,r.display="flex",r.align_items="center",r.background=t.background,delete r.width,delete r.height,delete r.transform),"top-left"===n&&(r.top=r.top||"0px",r.left=r.left||"0px",delete r.transform,delete r.right,delete r.bottom),"top-right"===n&&(r.top=r.top||"0px",r.right=r.right||"0px",delete r.transform,delete r.left,delete r.bottom),"top-center"===n&&(r.transform="translateX(-50%)",r.left="50%",r.top=r.top||"0px",delete r.right,delete r.bottom),"middle-left"===n&&(r.top="50%",r.transform="translateY(-50%)",r.left=r.left||"0px",delete r.right,delete r.bottom),"middle-right"===n&&(r.top="50%",r.transform="translateY(-50%)",r.right=r.right||"0px",delete r.left,delete r.bottom),"bottom-left"===n&&(r.bottom=r.bottom||"0px",r.left=r.left||"0px",delete r.transform,delete r.top,delete r.right),"bottom-right"===n&&(r.bottom=r.bottom||"0px",r.right=r.right||"0px",delete r.transform,delete r.top,delete r.left),"bottom-center"===n&&(r.bottom=r.bottom||"0px",r.transform="translateX(-50%)",r.left="50%",delete r.top,delete r.right),r.width=o.width,r.height=o.height,r.max_width=o.max_width,r.max_height=o.max_height,r.display=o.display,r.border_radius=o.border_radius,r.overflow=o.overflow,r.box_shadow=o.box_shadow,t.type&&"modal"!==t.type||(r.max_width="80%",r.max_height="95%"),"fullscreen"===n&&(r.width="100%",r.height="100%",r.max_width="100%",r.max_height="100%"),"bar"===t.type&&(r.width=o.width||"100%",r.max_width="100%"),r}render(){if(!this.props.t)return null;if(!this.state.cssready)return null;if(!this.state.imageReady)return null;if(this.state.close)return null;let t=i.Z.get(this.props.plugin,"popup",{}),e=i.Z.get(t,`pages.${this.getPageIndex()}`);if(!e)return null;let n=Object.assign({},this.props.mobile&&e.mobile_style||e.style),o=this.calculateContainerCss(t,e),r="",s=i.Z.get(this.props.plugin,"popup.position","center");"center"!==s&&s||(r="zoomInCenter",this.state.closeAnimation&&(r="zoomOutCenter")),"bottom-left"!==s&&"bottom-right"!==s||(r="fadeInUpBig"),"top-left"!==s&&"top-right"!==s||(r="fadeInDown"),"top-center"===s&&(r="fadeInDownCenter"),"middle-left"===s&&(r="fadeInLeftBig"),"middle-right"===s&&(r="fadeInRightBig"),"bottom-center"===s&&(r="fadeInUpCenter");let a=i.Z.get(e,"layout");this.props.mobile&&(a=i.Z.get(e,"mobile_layout"));let p={display:n.display,align_items:n.align_items,justify_content:n.justify_content,padding_top:n.padding_top,padding_left:n.padding_left,padding_right:n.padding_right,padding_bottom:n.padding_bottom,background:n.background||t.background||"#fff",border:n.border,overflow:"row"===a?"auto":"",max_height:"row"===a?"100%":""},u={overflow:"column"===a?"auto":"",max_height:"column"===a?"100%":"",width:"100%",position:"relative",padding_top:n.margin_top,padding_left:n.margin_left,padding_right:n.margin_right,padding_bottom:n.margin_bottom};"padding"===this.props.highlight&&(u.background="#bad14a87",p.background="#ff3d006e");let c="position: fixed !important;";this.props.plugin._preview&&(c="position: absolute !important;"),t.overlay&&(c+=" background: #000c !important;");let d=i.Z.map(e.components,((t,e)=>{if("image"===t.type)return this.renderImageComponent(t,e)}));return(0,l.h)("div",{class:"overlay",style:c},(0,l.h)("div",{class:r,style:this.js2css(o),onClick:t=>t.stopPropagation()},this.renderCloseButton(),(0,l.h)("div",{style:this.js2css(u),onClick:t=>this.onButtonClick(t,"background")},d,(0,l.h)("div",{style:this.js2css(p),form:!0},this.renderComponents(e)))))}}},9980:t=>{t.exports=function(){if(!t)var t={};var e=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();return t.exports=function(t){var n=t.DOM,i=(t.Animation.animate,t.Extension),o=t.Date.performance,r=t.View,s=r.rooter,a=r.destroyer,l=r.drawer,p=r.updater,u=r.styler,c=i.getExtension(i.Type.EASING_FUNCTION,"ease-out-cubic"),d=i.getExtension(i.Type.EASING_FUNCTION,"ease-out-sine"),f=function(t){if(t.isInitialValue()){t.root.textContent="",t.spacer=n.create("span","tick-flip-spacer"),t.root.appendChild(t.spacer);var e=n.create("span","tick-flip-shadow-top tick-flip-shadow tick-flip-front"),r=n.create("span","tick-flip-shadow-bottom tick-flip-shadow tick-flip-back");t.root.appendChild(e),t.root.appendChild(r),t.shadowCard=n.create("span","tick-flip-card-shadow"),t.root.appendChild(t.shadowCard)}if(t.spacer.textContent=t.value,t.isInitialValue()||n.visible(t.root)){var s=t.cards[t.cards.length-1];if(s&&(s.waiting=!1,s.offset=o(),s.back=t.value),t.isInitialValue()){var a=new h;a.back=t.value,a.offset=null,a.progress=1,t.root.insertBefore(a.root,t.root.firstChild),t.cards.push(a)}var l=new h;if(l.offset=null,l.progress=0,l.visual_progress=0,l.waiting=!0,l.front=t.value,l.rotate(0),t.root.insertBefore(l.root,t.root.firstChild),t.cards.push(l),!t.animating){t.animating=!0;var p=i.getExtension(i.Type.EASING_FUNCTION,t.style.flipEasing);!function e(){var i=t.cards.filter((function(t){return!t.done&&!t.waiting}));if(0!==i.length){i.forEach((function(e){null!==e.offset&&(e.progress=(o()-e.offset)/t.style.flipDuration),e.progress>=1&&(e.progress=1,e.done=!0),e.visual_progress=p(e.progress)})),i.reverse().forEach((function(t,e){var n=i[e-1];n&&t.visual_progress<=n.visual_progress&&(t.visual_progress=n.visual_progress+.01)})),i.reverse(),t.cards.forEach((function(e,n){var i=1-2*Math.abs(e.visual_progress-.5),o=1-(e.visual_progress-.5)/.5;e.shadowFront=i,e.highlightBack=o;var r=t.cards[n+1];r&&e.visual_progress>.5&&e.visual_progress>0&&(e.shadowBack=c(r.visual_progress))})),i.forEach((function(t,e){var n=t.visual_progress;n>.5&&!t.done?t.root.style.setProperty("z-index",10+e,"important"):t.root.style.removeProperty("z-index"),t.rotate(-180*n)}));var r=0,s=1;i.forEach((function(t){var e=Math.abs(t.visual_progress-.5);e<s&&(s=e,r=t.visual_progress)}));var a=d(r<.5?r/.5:(1-r)/.5);t.shadowCard.style.setProperty("opacity",a,"important"),n.transform(t.shadowCard,"scaleY",a),t.cards.filter((function(t){return t.done})).slice(0,-1).forEach((function(e){t.cards=t.cards.filter((function(t){return t!==e})),e.root.parentNode&&t.root.removeChild(e.root)})),requestAnimationFrame(e)}else t.animating=!1}()}}else t.cards.forEach((function(e){e.back=t.value,e.front=t.value}))},h=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._root=n.create("span","tick-flip-card");var e=n.create("span","tick-flip-panel-front tick-flip-front tick-flip-panel"),i=n.create("span","tick-flip-panel-front-text"),o=n.create("span","tick-flip-panel-text-wrapper");i.appendChild(o);var r=n.create("span","tick-flip-panel-front-shadow");e.appendChild(i),e.appendChild(r);var s=n.create("span","tick-flip-panel-back tick-flip-back tick-flip-panel"),a=n.create("span","tick-flip-panel-back-text"),l=n.create("span","tick-flip-panel-text-wrapper");a.appendChild(l);var p=n.create("span","tick-flip-panel-back-highlight"),u=n.create("span","tick-flip-panel-back-shadow");s.appendChild(a),s.appendChild(p),s.appendChild(u),this._root.appendChild(e),this._root.appendChild(s),this._front=e,this._back=s,this._shadowFront=r,this._shadowBack=u,this._highlightBack=p,this._textBack=l,this._textFront=o,this._frontValue=null,this._backValue=null}return e(t,[{key:"rotate",value:function(t){this._front.style.setProperty("transform","rotateX("+t+"deg)","important"),this._back.style.setProperty("transform","rotateX("+(-180+t)+"deg)","important")}},{key:"root",get:function(){return this._root}},{key:"front",set:function(t){this._frontValue=t,this._textFront.textContent=t},get:function(){return this._frontValue}},{key:"back",set:function(t){this._backValue=t,this._textBack.textContent=t},get:function(){return this._backValue}},{key:"highlightBack",set:function(t){this._highlightBack.style.setProperty("opacity",t,"important")}},{key:"shadowBack",set:function(t){this._shadowBack.style.setProperty("opacity",t,"important")}},{key:"shadowFront",set:function(t){this._shadowFront.style.setProperty("opacity",t,"important")}}]),t}();return function(t){var e={cards:[],lastCard:null,initialCard:null,shadowAbove:null,shadowBelow:null,shadowCard:null,currentValue:null,lastValue:null,front:null,back:null};return Object.assign({},s(e,t,"flip"),p(e),u(e,{flipDuration:800,flipEasing:"ease-out-bounce"}),l(e,f),a(e))}},t.exports.identifier={name:"flip",type:"view"},t.exports}()},7435:(t,e,n)=>{t.exports=n.p+"assets/img/Facebook.64607ec.png"},7298:(t,e,n)=>{t.exports=n.p+"assets/img/Zalo.6845707.png"},9639:(t,e,n)=>{t.exports=n.p+"assets/img/fb_inverse_circle.36c2cfc.png"}}]);