openstack-uicore-foundation 4.2.9 → 4.2.10

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 (153) hide show
  1. package/lib/components/ajaxloader.js +1 -1
  2. package/lib/components/ajaxloader.js.map +1 -1
  3. package/lib/components/attendance-tracker.js +1 -1
  4. package/lib/components/attendance-tracker.js.map +1 -1
  5. package/lib/components/bulk-actions-selector.js +1 -1
  6. package/lib/components/bulk-actions-selector.js.map +1 -1
  7. package/lib/components/circle-button.js +1 -1
  8. package/lib/components/circle-button.js.map +1 -1
  9. package/lib/components/clock.js +1 -1
  10. package/lib/components/clock.js.map +1 -1
  11. package/lib/components/exclusive-wrapper.js +1 -1
  12. package/lib/components/exclusive-wrapper.js.map +1 -1
  13. package/lib/components/extra-questions.js +1 -1
  14. package/lib/components/extra-questions.js.map +1 -1
  15. package/lib/components/forms/rsvp-form.js +1 -1
  16. package/lib/components/forms/rsvp-form.js.map +1 -1
  17. package/lib/components/forms/simple-form.js +1 -1
  18. package/lib/components/forms/simple-form.js.map +1 -1
  19. package/lib/components/free-text-search.js +1 -1
  20. package/lib/components/free-text-search.js.map +1 -1
  21. package/lib/components/google-map.js +1 -1
  22. package/lib/components/google-map.js.map +1 -1
  23. package/lib/components/index.js +1 -1
  24. package/lib/components/index.js.map +1 -1
  25. package/lib/components/inputs/access-levels-input.js +1 -1
  26. package/lib/components/inputs/access-levels-input.js.map +1 -1
  27. package/lib/components/inputs/action-dropdown.js +1 -1
  28. package/lib/components/inputs/action-dropdown.js.map +1 -1
  29. package/lib/components/inputs/attendee-input.js +1 -1
  30. package/lib/components/inputs/attendee-input.js.map +1 -1
  31. package/lib/components/inputs/checkbox-list.js +1 -1
  32. package/lib/components/inputs/checkbox-list.js.map +1 -1
  33. package/lib/components/inputs/company-input-v2.js +1 -1
  34. package/lib/components/inputs/company-input-v2.js.map +1 -1
  35. package/lib/components/inputs/company-input.js +1 -1
  36. package/lib/components/inputs/company-input.js.map +1 -1
  37. package/lib/components/inputs/country-dropdown.js +1 -1
  38. package/lib/components/inputs/country-dropdown.js.map +1 -1
  39. package/lib/components/inputs/country-input.js +1 -1
  40. package/lib/components/inputs/country-input.js.map +1 -1
  41. package/lib/components/inputs/datetimepicker.js +1 -1
  42. package/lib/components/inputs/datetimepicker.js.map +1 -1
  43. package/lib/components/inputs/dropdown.js +1 -1
  44. package/lib/components/inputs/dropdown.js.map +1 -1
  45. package/lib/components/inputs/editor-input.js +1 -1
  46. package/lib/components/inputs/editor-input.js.map +1 -1
  47. package/lib/components/inputs/event-input.js +1 -1
  48. package/lib/components/inputs/event-input.js.map +1 -1
  49. package/lib/components/inputs/free-multi-text-input.js +1 -1
  50. package/lib/components/inputs/free-multi-text-input.js.map +1 -1
  51. package/lib/components/inputs/group-input.js +1 -1
  52. package/lib/components/inputs/group-input.js.map +1 -1
  53. package/lib/components/inputs/grouped-dropdown.js +1 -1
  54. package/lib/components/inputs/grouped-dropdown.js.map +1 -1
  55. package/lib/components/inputs/language-input.js +1 -1
  56. package/lib/components/inputs/language-input.js.map +1 -1
  57. package/lib/components/inputs/member-input.js +1 -1
  58. package/lib/components/inputs/member-input.js.map +1 -1
  59. package/lib/components/inputs/operator-input.js +1 -1
  60. package/lib/components/inputs/operator-input.js.map +1 -1
  61. package/lib/components/inputs/organization-input.js +1 -1
  62. package/lib/components/inputs/organization-input.js.map +1 -1
  63. package/lib/components/inputs/promocode-input.js +1 -1
  64. package/lib/components/inputs/promocode-input.js.map +1 -1
  65. package/lib/components/inputs/radio-list.js +1 -1
  66. package/lib/components/inputs/radio-list.js.map +1 -1
  67. package/lib/components/inputs/registration-company-input.js +1 -1
  68. package/lib/components/inputs/registration-company-input.js.map +1 -1
  69. package/lib/components/inputs/speaker-input.js +1 -1
  70. package/lib/components/inputs/speaker-input.js.map +1 -1
  71. package/lib/components/inputs/sponsor-input.js +1 -1
  72. package/lib/components/inputs/sponsor-input.js.map +1 -1
  73. package/lib/components/inputs/stepped-select.js +1 -1
  74. package/lib/components/inputs/stepped-select.js.map +1 -1
  75. package/lib/components/inputs/summit-days-select.js +1 -1
  76. package/lib/components/inputs/summit-days-select.js.map +1 -1
  77. package/lib/components/inputs/summit-input.js +1 -1
  78. package/lib/components/inputs/summit-input.js.map +1 -1
  79. package/lib/components/inputs/summit-venues-select.js +1 -1
  80. package/lib/components/inputs/summit-venues-select.js.map +1 -1
  81. package/lib/components/inputs/tag-input.js +1 -1
  82. package/lib/components/inputs/tag-input.js.map +1 -1
  83. package/lib/components/inputs/text-input.js +1 -1
  84. package/lib/components/inputs/text-input.js.map +1 -1
  85. package/lib/components/inputs/textarea-input.js +1 -1
  86. package/lib/components/inputs/textarea-input.js.map +1 -1
  87. package/lib/components/inputs/ticket-types-input.js +1 -1
  88. package/lib/components/inputs/ticket-types-input.js.map +1 -1
  89. package/lib/components/inputs/upload-input-v2.js +1 -1
  90. package/lib/components/inputs/upload-input-v2.js.map +1 -1
  91. package/lib/components/inputs/upload-input.js +1 -1
  92. package/lib/components/inputs/upload-input.js.map +1 -1
  93. package/lib/components/progressive-img.js +1 -1
  94. package/lib/components/progressive-img.js.map +1 -1
  95. package/lib/components/raw-html.js +1 -1
  96. package/lib/components/raw-html.js.map +1 -1
  97. package/lib/components/schedule-builder-view.js +1 -1
  98. package/lib/components/schedule-builder-view.js.map +1 -1
  99. package/lib/components/sections/panel.js +1 -1
  100. package/lib/components/sections/panel.js.map +1 -1
  101. package/lib/components/simple-link-list.js +1 -1
  102. package/lib/components/simple-link-list.js.map +1 -1
  103. package/lib/components/sponsored-project-input.js +1 -1
  104. package/lib/components/sponsored-project-input.js.map +1 -1
  105. package/lib/components/summit-dropdown.js +1 -1
  106. package/lib/components/summit-dropdown.js.map +1 -1
  107. package/lib/components/table-editable.js +1 -1
  108. package/lib/components/table-editable.js.map +1 -1
  109. package/lib/components/table-selectable.js +1 -1
  110. package/lib/components/table-selectable.js.map +1 -1
  111. package/lib/components/table-sortable.js +1 -1
  112. package/lib/components/table-sortable.js.map +1 -1
  113. package/lib/components/table.js +1 -1
  114. package/lib/components/table.js.map +1 -1
  115. package/lib/components/video-stream.js +1 -1
  116. package/lib/components/video-stream.js.map +1 -1
  117. package/lib/css/components/extra-questions.css +1 -1
  118. package/lib/css/components/extra-questions.css.map +1 -1
  119. package/lib/css/components/free-text-search.css +1 -1
  120. package/lib/css/components/free-text-search.css.map +1 -1
  121. package/lib/css/components/index.css +1 -1
  122. package/lib/css/components/index.css.map +1 -1
  123. package/lib/i18n.js +1 -1
  124. package/lib/i18n.js.map +1 -1
  125. package/lib/models/index.js +1 -1
  126. package/lib/models/index.js.map +1 -1
  127. package/lib/models/summit-event.js +1 -1
  128. package/lib/models/summit-event.js.map +1 -1
  129. package/lib/security/abstract-auth-callback-route-v2.js +1 -1
  130. package/lib/security/abstract-auth-callback-route-v2.js.map +1 -1
  131. package/lib/security/abstract-auth-callback-route.js +1 -1
  132. package/lib/security/abstract-auth-callback-route.js.map +1 -1
  133. package/lib/security/actions.js +1 -1
  134. package/lib/security/actions.js.map +1 -1
  135. package/lib/security/methods.js +1 -1
  136. package/lib/security/methods.js.map +1 -1
  137. package/lib/security/reducers.js +1 -1
  138. package/lib/security/reducers.js.map +1 -1
  139. package/lib/security/session-checker.js +1 -1
  140. package/lib/security/session-checker.js.map +1 -1
  141. package/lib/utils/actions.js +1 -1
  142. package/lib/utils/actions.js.map +1 -1
  143. package/lib/utils/fragment-parser.js +1 -1
  144. package/lib/utils/fragment-parser.js.map +1 -1
  145. package/lib/utils/methods.js +1 -1
  146. package/lib/utils/methods.js.map +1 -1
  147. package/lib/utils/query-actions.js +1 -1
  148. package/lib/utils/query-actions.js.map +1 -1
  149. package/lib/utils/questions-set.js +1 -1
  150. package/lib/utils/questions-set.js.map +1 -1
  151. package/lib/utils/reducers.js +1 -1
  152. package/lib/utils/reducers.js.map +1 -1
  153. package/package.json +2 -2
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(()=>(()=>{"use strict";var e={1186:(e,t,i)=>{i.d(t,{default:()=>n});var s=i(8779),o=i.n(s);function r(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,s)}return i}class n{constructor(){this.originalHash="",this.hash={}}convertToHash(e){let t=(e=e.substr(1).toLowerCase()).split("&"),i={};for(let e of t){if(e=e.split("="),2!==e.length)continue;let t=e[1].trim();""!==t&&("true"!==t&&"false"!==t||(e[1]="true"==t),i[e[0]]=e[1])}return i}clearParams(){this.originalHash="",this.hash={}}getParam(e){return"undefined"!=typeof window&&this.originalHash!==window.location.hash&&(this.originalHash=window.location.hash,this.hash=this.convertToHash(this.originalHash)),this.hash.hasOwnProperty(e)?this.hash[e]:null}getParams(){return"undefined"!=typeof window&&this.originalHash!==window.location.hash&&(this.originalHash=window.location.hash,this.hash=this.convertToHash(this.originalHash)),function(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?r(Object(i),!0).forEach((function(t){o()(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):r(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}({},this.hash)}deleteParam(e){var t=this.getParams();this.clearParams();for(let i in t)i!=e&&(this.hash[i]=t[i])}deleteParams(e){var t=this.getParams();this.clearParams();for(let i in t)e.includes(i)||(this.hash[i]=t[i])}setParam(e,t){return"undefined"!=typeof window&&this.originalHash!==window.location.hash&&(this.originalHash=window.location.hash,this.hash=this.convertToHash(this.originalHash)),null!==t&&""!==t?this.hash[e]=t:delete this.hash[e],this}serialize(){let e="";for(let t in this.hash){""!==e&&(e+="&"),e+=t+"="+this.hash[t]}return e}}},6793:(e,t,i)=>{i.d(t,{getTimeServiceUrl:()=>s});i(8362),i(6530);const s=()=>"undefined"!=typeof window?window.TIMEINTERVALSINCE1970_API_URL||process.env.TIMEINTERVALSINCE1970_API_URL:null},8779:e=>{e.exports=require("@babel/runtime/helpers/defineProperty")},8362:e=>{e.exports=require("moment-timezone")},6689:e=>{e.exports=require("react")},6530:e=>{e.exports=require("urijs")}},t={};function i(s){var o=t[s];if(void 0!==o)return o.exports;var r=t[s]={exports:{}};return e[s](r,r.exports,i),r.exports}(()=>{i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t}})(),(()=>{i.d=(e,t)=>{for(var s in t)i.o(t,s)&&!i.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})}})(),(()=>{i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var s={};return(()=>{i.r(s),i.d(s,{default:()=>p});var e=i(8779),t=i.n(e),o=i(6689),r=i.n(o),n=i(8362),a=i.n(n),h=i(1186),l=i(6793);class c extends r().Component{constructor(e){super(e),t()(this,"processServerTimeResponse",((e,t)=>{const i=a()().unix();let s=i;e&&(s=e.timestamp+(i-t)),this._isMounted&&(console.log(`Clock::processServerTimeResponse setting timestamp ${s}`),this.setState({timestamp:s})),this.props.onTick&&this.props.onTick(s)})),t()(this,"processServerTimeResponseError",(()=>{let e=a()().unix();this._isMounted&&(console.log(`Clock::processServerTimeResponseError setting timestamp ${e}`),this.setState({timestamp:e})),this.props.onTick&&this.props.onTick(e)})),t()(this,"getServerTime",(()=>{const e=(0,l.getTimeServiceUrl)();return fetch(`${e}`).then((async e=>200===e.status?e.json():Promise.reject(null))).catch((e=>(console.log(e),Promise.reject(e))))})),t()(this,"tick",(()=>{const{timestamp:e}=this.state;null!==e&&(this.props.onTick&&this.props.onTick(e+1),this._isMounted&&this.setState({timestamp:e+1}))})),t()(this,"now",(()=>this.state.timestamp)),this.fragmentParser=new h.default,this.interval=null,this.state={timestamp:null,manualSet:!1},this._isMounted=!1,this.onVisibilityChange=this.onVisibilityChange.bind(this)}componentDidMount(){this._isMounted=!0;const{timezone:e="UTC",now:t}=this.props,i=this.fragmentParser.getParam("now"),s=a().tz(i,"YYYY-MM-DD,hh:mm:ss",e);let o=null,r=!1;if(s.isValid())o=s.valueOf()/1e3,console.log(`Clock::componentDidMount nowQS ${i} is valid setting timestamp ${o}`),r=!0;else if(t)o=t;else{const e=a()().unix();this.getServerTime().then((t=>this.processServerTimeResponse(t,e))).catch((()=>this.processServerTimeResponseError()))}o&&(this.setState({timestamp:o,manualSet:r}),this.props.onTick&&this.props.onTick(o)),this.interval=setInterval(this.tick,1e3),document.addEventListener("visibilitychange",this.onVisibilityChange,!1)}onVisibilityChange(){const e=document.visibilityState,{manualSet:t}=this.state;if("visible"===e){if(console.log(`Clock::onVisibilityChange manualSet ${t}`),t)return;const e=a()().unix();this.getServerTime().then((t=>this.processServerTimeResponse(t,e))).catch((()=>this.processServerTimeResponseError()))}}componentWillUnmount(){this._isMounted=!1,clearInterval(this.interval),document.removeEventListener("visibilitychange",this.onVisibilityChange),this.interval=null}render(){const{display:e,timezone:t="UTC"}=this.props,{timestamp:i}=this.state;return e&&i?r().createElement("div",{style:{marginTop:"50px",textAlign:"center",fontSize:"20px"}},a().tz(1e3*i,t).format("YYYY-MM-DD hh:mm:ss")):null}}const p=c})(),s})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(()=>(()=>{"use strict";var e={8311:(e,t,i)=>{i.d(t,{default:()=>n});var s=i(1116),o=i.n(s);function r(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,s)}return i}class n{constructor(){this.originalHash="",this.hash={}}convertToHash(e){let t=(e=e.substr(1).toLowerCase()).split("&"),i={};for(let e of t){if(e=e.split("="),2!==e.length)continue;let t=e[1].trim();""!==t&&("true"!==t&&"false"!==t||(e[1]="true"==t),i[e[0]]=e[1])}return i}clearParams(){this.originalHash="",this.hash={}}getParam(e){return"undefined"!=typeof window&&this.originalHash!==window.location.hash&&(this.originalHash=window.location.hash,this.hash=this.convertToHash(this.originalHash)),this.hash.hasOwnProperty(e)?this.hash[e]:null}getParams(){return"undefined"!=typeof window&&this.originalHash!==window.location.hash&&(this.originalHash=window.location.hash,this.hash=this.convertToHash(this.originalHash)),function(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?r(Object(i),!0).forEach((function(t){o()(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):r(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}({},this.hash)}deleteParam(e){var t=this.getParams();this.clearParams();for(let i in t)i!=e&&(this.hash[i]=t[i])}deleteParams(e){var t=this.getParams();this.clearParams();for(let i in t)e.includes(i)||(this.hash[i]=t[i])}setParam(e,t){return"undefined"!=typeof window&&this.originalHash!==window.location.hash&&(this.originalHash=window.location.hash,this.hash=this.convertToHash(this.originalHash)),null!==t&&""!==t?this.hash[e]=t:delete this.hash[e],this}serialize(){let e="";for(let t in this.hash){""!==e&&(e+="&"),e+=t+"="+this.hash[t]}return e}}},9558:(e,t,i)=>{i.d(t,{getTimeServiceUrl:()=>s});i(5812),i(8041);const s=()=>"undefined"!=typeof window?window.TIMEINTERVALSINCE1970_API_URL||process.env.TIMEINTERVALSINCE1970_API_URL:null},1116:e=>{e.exports=require("@babel/runtime/helpers/defineProperty")},5812:e=>{e.exports=require("moment-timezone")},2015:e=>{e.exports=require("react")},8041:e=>{e.exports=require("urijs")}},t={};function i(s){var o=t[s];if(void 0!==o)return o.exports;var r=t[s]={exports:{}};return e[s](r,r.exports,i),r.exports}(()=>{i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t}})(),(()=>{i.d=(e,t)=>{for(var s in t)i.o(t,s)&&!i.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})}})(),(()=>{i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var s={};i.r(s),i.d(s,{default:()=>m});var o=i(1116),r=i.n(o),n=i(2015),a=i.n(n),h=i(5812),l=i.n(h),c=i(8311),p=i(9558);class u extends a().Component{constructor(e){super(e),r()(this,"processServerTimeResponse",((e,t)=>{const i=l()().unix();let s=i;e&&(s=e.timestamp+(i-t)),this._isMounted&&(console.log(`Clock::processServerTimeResponse setting timestamp ${s}`),this.setState({timestamp:s})),this.props.onTick&&this.props.onTick(s)})),r()(this,"processServerTimeResponseError",(()=>{let e=l()().unix();this._isMounted&&(console.log(`Clock::processServerTimeResponseError setting timestamp ${e}`),this.setState({timestamp:e})),this.props.onTick&&this.props.onTick(e)})),r()(this,"getServerTime",(()=>{const e=(0,p.getTimeServiceUrl)();return fetch(`${e}`).then((async e=>200===e.status?e.json():Promise.reject(null))).catch((e=>(console.log(e),Promise.reject(e))))})),r()(this,"tick",(()=>{const{timestamp:e}=this.state;null!==e&&(this.props.onTick&&this.props.onTick(e+1),this._isMounted&&this.setState({timestamp:e+1}))})),r()(this,"now",(()=>this.state.timestamp)),this.fragmentParser=new c.default,this.interval=null,this.state={timestamp:null,manualSet:!1},this._isMounted=!1,this.onVisibilityChange=this.onVisibilityChange.bind(this)}componentDidMount(){this._isMounted=!0;const{timezone:e="UTC",now:t}=this.props,i=this.fragmentParser.getParam("now"),s=l().tz(i,"YYYY-MM-DD,hh:mm:ss",e);let o=null,r=!1;if(s.isValid())o=s.valueOf()/1e3,console.log(`Clock::componentDidMount nowQS ${i} is valid setting timestamp ${o}`),r=!0;else if(t)o=t;else{const e=l()().unix();this.getServerTime().then((t=>this.processServerTimeResponse(t,e))).catch((()=>this.processServerTimeResponseError()))}o&&(this.setState({timestamp:o,manualSet:r}),this.props.onTick&&this.props.onTick(o)),this.interval=setInterval(this.tick,1e3),document.addEventListener("visibilitychange",this.onVisibilityChange,!1)}onVisibilityChange(){const e=document.visibilityState,{manualSet:t}=this.state;if("visible"===e){if(console.log(`Clock::onVisibilityChange manualSet ${t}`),t)return;const e=l()().unix();this.getServerTime().then((t=>this.processServerTimeResponse(t,e))).catch((()=>this.processServerTimeResponseError()))}}componentWillUnmount(){this._isMounted=!1,clearInterval(this.interval),document.removeEventListener("visibilitychange",this.onVisibilityChange),this.interval=null}render(){const{display:e,timezone:t="UTC"}=this.props,{timestamp:i}=this.state;return e&&i?a().createElement("div",{style:{marginTop:"50px",textAlign:"center",fontSize:"20px"}},l().tz(1e3*i,t).format("YYYY-MM-DD hh:mm:ss")):null}}const m=u;return s})()));
2
2
  //# sourceMappingURL=clock.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"components/clock.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,8BAA+B,GAAIH,GAChB,iBAAZC,QACdA,QAAQ,+BAAiCD,IAEzCD,EAAK,+BAAiCC,GACvC,CATD,CASGK,MAAM,I,qTCRM,MAAMC,EAEjBC,cACIF,KAAKG,aAAe,GACpBH,KAAKI,KAAe,CAAC,CACxB,CAEDC,cAAcC,GAGV,IAAIC,GADJD,EAAaA,EAAQE,OAAO,GAA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GAAYzC,EAGb,yBAAK0C,MAAO,CAACC,UAAW,OAAQC,UAAW,SAAUC,SAAU,SAC1D/C,IAAAA,GAAsB,IAAZE,EAAkBuB,GAAUuB,OAAO,wBAJnB,IAOtC,EAIL,S","sources":["webpack://openstack-uicore-foundation/webpack/universalModuleDefinition","webpack://openstack-uicore-foundation/./src/components/fragment-parser.js","webpack://openstack-uicore-foundation/./src/utils/methods.js","webpack://openstack-uicore-foundation/external commonjs \"@babel/runtime/helpers/defineProperty\"","webpack://openstack-uicore-foundation/external commonjs \"moment-timezone\"","webpack://openstack-uicore-foundation/external commonjs \"react\"","webpack://openstack-uicore-foundation/external commonjs \"urijs\"","webpack://openstack-uicore-foundation/webpack/bootstrap","webpack://openstack-uicore-foundation/webpack/runtime/compat get default export","webpack://openstack-uicore-foundation/webpack/runtime/define property getters","webpack://openstack-uicore-foundation/webpack/runtime/hasOwnProperty shorthand","webpack://openstack-uicore-foundation/webpack/runtime/make namespace object","webpack://openstack-uicore-foundation/./src/components/clock.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"openstack-uicore-foundation\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"openstack-uicore-foundation\"] = factory();\n\telse\n\t\troot[\"openstack-uicore-foundation\"] = factory();\n})(this, () => {\nreturn ","\nexport default class FragmentParser {\n\n constructor(){\n this.originalHash = '';\n this.hash = {};\n }\n\n convertToHash(strHash)\n {\n strHash = strHash.substr(1).toLowerCase();\n let params = strHash.split('&');\n let res = {};\n for(let param of params)\n {\n param = param.split('=');\n if(param.length !== 2) continue;\n let val = param[1].trim();\n if(val === '') continue;\n\n if (val === 'true' || val === 'false')\n param[1] = val == 'true';\n\n res[param[0]] = param[1];\n }\n return res;\n }\n\n clearParams(){\n this.originalHash = '';\n this.hash = {};\n }\n\n getParam(key){\n if(typeof window !== 'undefined' && this.originalHash !== window.location.hash){\n this.originalHash = window.location.hash;\n this.hash = this.convertToHash(this.originalHash);\n }\n\n if(!this.hash.hasOwnProperty(key) ) return null;\n return this.hash[key];\n }\n\n getParams(){\n if(typeof window !== 'undefined' && this.originalHash !== window.location.hash){\n this.originalHash = window.location.hash;\n this.hash = this.convertToHash(this.originalHash);\n }\n\n return { ... this.hash };\n }\n\n deleteParam(param){\n var hash = this.getParams();\n this.clearParams();\n for(let key in hash) {\n if(key == param) continue;\n this.hash[key] = hash[key];\n }\n }\n\n deleteParams(params){\n var hash = this.getParams();\n this.clearParams();\n for(let key in hash) {\n if(params.includes(key)) continue;\n this.hash[key] = hash[key];\n }\n }\n\n setParam(key, value){\n if(typeof window !== 'undefined' && this.originalHash !== window.location.hash){\n this.originalHash = window.location.hash;\n this.hash = this.convertToHash(this.originalHash);\n }\n if(value !== null && value !== '')\n this.hash[key] = value;\n else\n delete this.hash[key];\n return this;\n }\n\n serialize(){\n let res = '';\n for(let key in this.hash)\n {\n let val = this.hash[key];\n if(res !== '') res += '&';\n res += key+'='+val;\n }\n return res;\n }\n}\n","/**\n * Copyright 2018 OpenStack Foundation\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n **/\n\nimport moment from 'moment-timezone';\nimport URI from \"urijs\";\n\nexport const findElementPos = (obj) => {\n var curtop = -70;\n if (obj.offsetParent) {\n do {\n curtop += obj.offsetTop;\n } while (obj = obj.offsetParent);\n return [curtop];\n }\n};\n\nexport const epochToMoment = (atime) => {\n if(!atime) return atime;\n atime = atime * 1000;\n return moment(atime);\n};\n\nexport const epochToMomentTimeZone = (atime, time_zone) => {\n if(!atime) return atime;\n atime = atime * 1000;\n return moment(atime).tz(time_zone);\n};\n\nexport const formatEpoch = (atime, format = 'M/D/YYYY h:mm a') => {\n if(!atime) return atime;\n return epochToMoment(atime).format(format);\n};\n\nexport const parseLocationHour = (hour) => {\n let parsedHour = hour.toString();\n if(parsedHour.length < 4) parsedHour = `0${parsedHour}`;\n parsedHour = parsedHour.match(/.{2}/g);\n parsedHour = parsedHour.join(':');\n return parsedHour;\n}\n\nexport const objectToQueryString = (obj) => {\n var str = \"\";\n for (var key in obj) {\n if (str != \"\") {\n str += \"&\";\n }\n str += key + \"=\" + encodeURIComponent(obj[key]);\n }\n\n return str;\n};\n\nexport const getBackURL = () => {\n let url = URI(window.location.href);\n let query = url.search(true);\n let fragment = url.fragment();\n let backUrl = query.hasOwnProperty('BackUrl') ? query['BackUrl'] : null;\n if(backUrl != null && fragment != null && fragment != ''){\n backUrl += `#${fragment}`;\n }\n return backUrl;\n};\n\nexport const toSlug = (text) =>{\n text = text.toLowerCase();\n return text.replace(/[^a-zA-Z0-9]+/g,'_');\n}\n\nexport const getAuthCallback = () => {\n if(typeof window !== 'undefined') {\n return `${window.location.origin}/auth/callback`;\n }\n return null;\n};\n\nexport const getCurrentLocation = () => {\n let location = '';\n if(typeof window !== 'undefined') {\n location = window.location;\n // check if we are on iframe\n if (window.top)\n location = window.top.location;\n }\n return location;\n};\n\nexport const getOrigin = () => {\n if(typeof window !== 'undefined') {\n return window.location.origin;\n }\n return null;\n};\n\nexport const getCurrentPathName = () => {\n if(typeof window !== 'undefined') {\n return window.location.pathname;\n }\n return null;\n};\n\nexport const getCurrentHref = () => {\n if(typeof window !== 'undefined') {\n return window.location.href;\n }\n return null;\n};\n\nexport const getAllowedUserGroups = () => {\n if(typeof window !== 'undefined') {\n return window.ALLOWED_USER_GROUPS || '';\n }\n return null;\n};\n\nexport const buildAPIBaseUrl = (relativeUrl) => {\n if(typeof window !== 'undefined'){\n return `${window.API_BASE_URL}${relativeUrl}`;\n }\n return null``;\n};\n\nexport const putOnLocalStorage = (key, value) => {\n if(typeof window !== 'undefined') {\n window.localStorage.setItem(key, value);\n }\n};\n\nexport const getFromLocalStorage = (key, removeIt) => {\n if(typeof window !== 'undefined') {\n let val = window.localStorage.getItem(key);\n if(removeIt){\n console.log(`getFromLocalStorage removing key ${key}`);\n removeFromLocalStorage(key);\n }\n return val;\n }\n return null;\n};\n\nexport const removeFromLocalStorage = (key) => {\n if(typeof window !== 'undefined') {\n window.localStorage.removeItem(key);\n }\n}\n\nexport const isClearingSessionState = () => {\n if(typeof window !== 'undefined') {\n return window.clearing_session_state;\n }\n return false;\n};\n\nexport const setSessionClearingState = (val) => {\n if(typeof window !== 'undefined') {\n window.clearing_session_state = val;\n }\n};\n\nexport const getCurrentUserLanguage = () => {\n let language = 'en';\n if(typeof navigator !== 'undefined') {\n language = (navigator.languages && navigator.languages[0]) || navigator.language || navigator.userLanguage;\n }\n return language;\n};\n\nexport const scrollToError = (errors) => {\n if(Object.keys(errors).length > 0) {\n const firstError = Object.keys(errors)[0];\n const firstNode = document.getElementById(firstError);\n if (firstNode) window.scrollTo(0, findElementPos(firstNode));\n }\n};\n\nexport const hasErrors = (field, errors) => {\n if(field in errors) {\n return errors[field];\n }\n return '';\n};\n\nexport const shallowEqual = (object1, object2) => {\n const keys1 = Object.keys(object1);\n const keys2 = Object.keys(object2);\n\n if (keys1.length !== keys2.length) {\n return false;\n }\n\n for (let key of keys1) {\n if (object1[key] !== object2[key]) {\n return false;\n }\n }\n\n return true;\n};\n\nexport const arraysEqual = (a1, a2) =>\n a1.length === a2.length && a1.every((o, idx) => shallowEqual(o, a2[idx]));\n\nexport const isEmpty = (obj) => {\n return Object.keys(obj).length === 0;\n};\n\n\nexport const base64URLEncode = (str) => {\n return str\n .toString('base64')\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_')\n .replace(/=/g, '')\n}\n\nexport const retryPromise = async (\n cb,\n maxNumberOfRetries = 3\n) => {\n for (let i = 0; i < maxNumberOfRetries; i++) {\n if (await cb()) {\n return true;\n }\n }\n\n return false;\n}\n\nexport const getTimeServiceUrl = () => {\n if(typeof window !== 'undefined') {\n return window.TIMEINTERVALSINCE1970_API_URL || process.env.TIMEINTERVALSINCE1970_API_URL;\n }\n return null;\n};\n\nexport const getEventLocation = (event, summitVenueCount, summitShowLocDate = null, nowUtc = null) => {\n const shouldShowVenues = (summitShowLocDate && nowUtc) ? summitShowLocDate * 1000 < nowUtc : true;\n const locationName = [];\n const { location } = event;\n\n if (!shouldShowVenues) return 'TBA';\n\n if (!location) return 'TBA';\n\n if (summitVenueCount > 1 && location.venue?.name) locationName.push(location.venue.name);\n if (location.floor?.name) locationName.push(location.floor.name);\n if (location.name) locationName.push(location.name);\n\n return locationName.length > 0 ? locationName.join(' - ') : 'TBA';\n};\n\nexport const getEventHosts = (event) => {\n let hosts = [];\n if (event.speakers?.length > 0) {\n hosts = [...event.speakers];\n }\n if (event.moderator) hosts.push(event.moderator);\n\n return hosts;\n};\n\nconst loadImage = async url => {\n const img = document.createElement('img')\n img.src = url\n img.crossOrigin = 'anonymous'\n\n return new Promise((resolve, reject) => {\n img.onload = () => resolve(img)\n img.onerror = reject\n })\n}\n\nexport const convertSVGtoImg = async (svgUrl) => {\n const img = await loadImage(svgUrl)\n const newWidth = 100\n const newHeight = Math.floor(img.naturalHeight * 100 / img.naturalWidth)\n\n const canvas = document.createElement('canvas')\n canvas.width = newWidth\n canvas.height = newHeight\n canvas.getContext('2d').drawImage(img, 0, 0, newWidth, newHeight)\n\n const url = await canvas.toDataURL(`image/png`, 1.0)\n console.log(url, newWidth, newHeight);\n return {url, width: newWidth, height: newHeight}\n}\n","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"moment-timezone\");","module.exports = require(\"react\");","module.exports = require(\"urijs\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/**\n * Copyright 2020 OpenStack Foundation\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n **/\nimport React from 'react';\nimport moment from \"moment-timezone\";\nimport FragmentParser from \"./fragment-parser\";\nimport {getTimeServiceUrl} from '../utils/methods';\n\n/**\n * class Clock\n */\nclass Clock extends React.Component {\n\n constructor(props) {\n super(props);\n this.fragmentParser = new FragmentParser();\n this.interval = null;\n this.state = {\n timestamp: null,\n manualSet : false,\n }\n this._isMounted = false;\n this.onVisibilityChange = this.onVisibilityChange.bind(this);\n }\n\n /**\n * @param response\n * @param localBefore\n */\n processServerTimeResponse = (response, localBefore) => {\n const localAfter = moment().unix();\n let timestamp = localAfter;\n if (response) {\n timestamp = response.timestamp + (localAfter - localBefore);\n }\n if(this._isMounted) {\n console.log(`Clock::processServerTimeResponse setting timestamp ${timestamp}`)\n this.setState({timestamp});\n }\n if(this.props.onTick)\n this.props.onTick(timestamp);\n }\n\n processServerTimeResponseError = () => {\n const localAfter = moment().unix();\n let timestamp = localAfter;\n if(this._isMounted) {\n console.log(`Clock::processServerTimeResponseError setting timestamp ${timestamp}`)\n this.setState({timestamp});\n }\n if(this.props.onTick)\n this.props.onTick(timestamp);\n }\n\n componentDidMount() {\n this._isMounted = true;\n const {timezone = 'UTC', now} = this.props;\n const nowQS = this.fragmentParser.getParam('now');\n const momentQS = moment.tz(nowQS, 'YYYY-MM-DD,hh:mm:ss', timezone);\n let timestamp = null;\n let manualSet = false;\n if (momentQS.isValid()) {\n timestamp = momentQS.valueOf() / 1000;\n console.log(`Clock::componentDidMount nowQS ${nowQS} is valid setting timestamp ${timestamp}`);\n manualSet = true;\n } else if (now) {\n timestamp = now\n } else {\n const localBefore = moment().unix();\n this.getServerTime()\n .then((response) => this.processServerTimeResponse(response, localBefore))\n .catch(() => this.processServerTimeResponseError())\n }\n\n if(timestamp) {\n this.setState({timestamp, manualSet});\n if(this.props.onTick)\n this.props.onTick(timestamp);\n }\n\n this.interval = setInterval(this.tick, 1000);\n document.addEventListener(\"visibilitychange\", this.onVisibilityChange, false)\n }\n\n onVisibilityChange() {\n const visibilityState = document.visibilityState;\n const {manualSet} = this.state;\n if (visibilityState === \"visible\") {\n console.log(`Clock::onVisibilityChange manualSet ${manualSet}`)\n if(manualSet) return;\n const localBefore = moment().unix();\n this.getServerTime()\n .then((response) => this.processServerTimeResponse(response, localBefore))\n .catch(() => this.processServerTimeResponseError());\n }\n }\n\n componentWillUnmount() {\n this._isMounted = false;\n clearInterval(this.interval);\n document.removeEventListener(\"visibilitychange\", this.onVisibilityChange)\n this.interval = null;\n }\n\n getServerTime = () => {\n const timeServiceUrl = getTimeServiceUrl();\n return fetch(`${timeServiceUrl}`).then(async (response) => {\n if (response.status === 200) {\n return response.json();\n }\n return Promise.reject(null);\n })\n .catch(err => {\n console.log(err);\n return Promise.reject(err);\n });\n };\n\n tick = () => {\n const {timestamp} = this.state;\n if (timestamp !== null) {\n if(this.props.onTick)\n this.props.onTick(timestamp + 1);\n if(this._isMounted)\n this.setState({timestamp: timestamp + 1})\n }\n };\n\n // epoch utc time in seconds\n now = () => {\n return this.state.timestamp;\n };\n\n render() {\n const {display, timezone = 'UTC'} = this.props;\n const {timestamp} = this.state;\n\n if (!display || !timestamp) return null;\n\n return (\n <div style={{marginTop: '50px', textAlign: 'center', fontSize: '20px'}}>\n {moment.tz(timestamp * 1000, timezone).format('YYYY-MM-DD hh:mm:ss')}\n </div>\n );\n }\n\n}\n\nexport default Clock;\n"],"names":["root","factory","exports","module","define","amd","this","FragmentParser","constructor","originalHash","hash","convertToHash","strHash","params","substr","toLowerCase","split","res","param","length","val","trim","clearParams","getParam","key","window","location","hasOwnProperty","getParams","deleteParam","deleteParams","includes","setParam","value","serialize","getTimeServiceUrl","TIMEINTERVALSINCE1970_API_URL","process","env","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","n","getter","__esModule","d","a","definition","o","Object","defineProperty","enumerable","get","obj","prop","prototype","call","r","Symbol","toStringTag","Clock","React","props","super","response","localBefore","localAfter","moment","unix","timestamp","_isMounted","console","log","setState","onTick","timeServiceUrl","fetch","then","async","status","json","Promise","reject","catch","err","state","fragmentParser","interval","manualSet","onVisibilityChange","bind","componentDidMount","timezone","now","nowQS","momentQS","isValid","valueOf","getServerTime","processServerTimeResponse","processServerTimeResponseError","setInterval","tick","document","addEventListener","visibilityState","componentWillUnmount","clearInterval","removeEventListener","render","display","style","marginTop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gB,EAAkBF,SAASE,iBAC3B,UAACjB,GAAatF,KAAKmF,MACzB,GAAwB,YAApBoB,EAA+B,CAE/B,GADAlC,QAAQC,IAAK,uCAAsCgB,KAChDA,EAAW,OACd,MAAMvB,EAAcE,MAASC,OAC7BlE,KAAKgG,gBACArB,MAAMb,GAAa9D,KAAKiG,0BAA0BnC,EAAUC,KAC5DkB,OAAM,IAAMjF,KAAKkG,kCACzB,CACJ,CAEDM,oBAAAA,GACIxG,KAAKoE,YAAa,EAClBqC,cAAczG,KAAKqF,UACnBgB,SAASK,oBAAoB,mBAAoB1G,KAAKuF,oBACtDvF,KAAKqF,SAAW,IACnB,CA+BDsB,MAAAA,GACI,MAAM,QAACC,EAAD,SAAUlB,EAAW,OAAS1F,KAAK4D,OACnC,UAACO,GAAanE,KAAKmF,MAEzB,OAAKyB,GAAYzC,EAGb,yBAAK0C,MAAO,CAACC,UAAW,OAAQC,UAAW,SAAUC,SAAU,SAC1D/C,IAAAA,GAAsB,IAAZE,EAAkBuB,GAAUuB,OAAO,wBAJnB,IAOtC,EAIL,U","sources":["webpack://openstack-uicore-foundation/webpack/universalModuleDefinition","webpack://openstack-uicore-foundation/./src/components/fragment-parser.js","webpack://openstack-uicore-foundation/./src/utils/methods.js","webpack://openstack-uicore-foundation/external commonjs \"@babel/runtime/helpers/defineProperty\"","webpack://openstack-uicore-foundation/external commonjs \"moment-timezone\"","webpack://openstack-uicore-foundation/external commonjs \"react\"","webpack://openstack-uicore-foundation/external commonjs \"urijs\"","webpack://openstack-uicore-foundation/webpack/bootstrap","webpack://openstack-uicore-foundation/webpack/runtime/compat get default export","webpack://openstack-uicore-foundation/webpack/runtime/define property getters","webpack://openstack-uicore-foundation/webpack/runtime/hasOwnProperty shorthand","webpack://openstack-uicore-foundation/webpack/runtime/make namespace object","webpack://openstack-uicore-foundation/./src/components/clock.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"openstack-uicore-foundation\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"openstack-uicore-foundation\"] = factory();\n\telse\n\t\troot[\"openstack-uicore-foundation\"] = factory();\n})(this, () => {\nreturn ","\nexport default class FragmentParser {\n\n constructor(){\n this.originalHash = '';\n this.hash = {};\n }\n\n convertToHash(strHash)\n {\n strHash = strHash.substr(1).toLowerCase();\n let params = strHash.split('&');\n let res = {};\n for(let param of params)\n {\n param = param.split('=');\n if(param.length !== 2) continue;\n let val = param[1].trim();\n if(val === '') continue;\n\n if (val === 'true' || val === 'false')\n param[1] = val == 'true';\n\n res[param[0]] = param[1];\n }\n return res;\n }\n\n clearParams(){\n this.originalHash = '';\n this.hash = {};\n }\n\n getParam(key){\n if(typeof window !== 'undefined' && this.originalHash !== window.location.hash){\n this.originalHash = window.location.hash;\n this.hash = this.convertToHash(this.originalHash);\n }\n\n if(!this.hash.hasOwnProperty(key) ) return null;\n return this.hash[key];\n }\n\n getParams(){\n if(typeof window !== 'undefined' && this.originalHash !== window.location.hash){\n this.originalHash = window.location.hash;\n this.hash = this.convertToHash(this.originalHash);\n }\n\n return { ... this.hash };\n }\n\n deleteParam(param){\n var hash = this.getParams();\n this.clearParams();\n for(let key in hash) {\n if(key == param) continue;\n this.hash[key] = hash[key];\n }\n }\n\n deleteParams(params){\n var hash = this.getParams();\n this.clearParams();\n for(let key in hash) {\n if(params.includes(key)) continue;\n this.hash[key] = hash[key];\n }\n }\n\n setParam(key, value){\n if(typeof window !== 'undefined' && this.originalHash !== window.location.hash){\n this.originalHash = window.location.hash;\n this.hash = this.convertToHash(this.originalHash);\n }\n if(value !== null && value !== '')\n this.hash[key] = value;\n else\n delete this.hash[key];\n return this;\n }\n\n serialize(){\n let res = '';\n for(let key in this.hash)\n {\n let val = this.hash[key];\n if(res !== '') res += '&';\n res += key+'='+val;\n }\n return res;\n }\n}\n","/**\n * Copyright 2018 OpenStack Foundation\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n **/\n\nimport moment from 'moment-timezone';\nimport URI from \"urijs\";\n\nexport const findElementPos = (obj) => {\n var curtop = -70;\n if (obj.offsetParent) {\n do {\n curtop += obj.offsetTop;\n } while (obj = obj.offsetParent);\n return [curtop];\n }\n};\n\nexport const epochToMoment = (atime) => {\n if(!atime) return atime;\n atime = atime * 1000;\n return moment(atime);\n};\n\nexport const epochToMomentTimeZone = (atime, time_zone) => {\n if(!atime) return atime;\n atime = atime * 1000;\n return moment(atime).tz(time_zone);\n};\n\nexport const formatEpoch = (atime, format = 'M/D/YYYY h:mm a') => {\n if(!atime) return atime;\n return epochToMoment(atime).format(format);\n};\n\nexport const parseLocationHour = (hour) => {\n let parsedHour = hour.toString();\n if(parsedHour.length < 4) parsedHour = `0${parsedHour}`;\n parsedHour = parsedHour.match(/.{2}/g);\n parsedHour = parsedHour.join(':');\n return parsedHour;\n}\n\nexport const objectToQueryString = (obj) => {\n var str = \"\";\n for (var key in obj) {\n if (str != \"\") {\n str += \"&\";\n }\n str += key + \"=\" + encodeURIComponent(obj[key]);\n }\n\n return str;\n};\n\nexport const getBackURL = () => {\n let url = URI(window.location.href);\n let query = url.search(true);\n let fragment = url.fragment();\n let backUrl = query.hasOwnProperty('BackUrl') ? query['BackUrl'] : null;\n if(backUrl != null && fragment != null && fragment != ''){\n backUrl += `#${fragment}`;\n }\n return backUrl;\n};\n\nexport const toSlug = (text) =>{\n text = text.toLowerCase();\n return text.replace(/[^a-zA-Z0-9]+/g,'_');\n}\n\nexport const getAuthCallback = () => {\n if(typeof window !== 'undefined') {\n return `${window.location.origin}/auth/callback`;\n }\n return null;\n};\n\nexport const getCurrentLocation = () => {\n let location = '';\n if(typeof window !== 'undefined') {\n location = window.location;\n // check if we are on iframe\n if (window.top)\n location = window.top.location;\n }\n return location;\n};\n\nexport const getOrigin = () => {\n if(typeof window !== 'undefined') {\n return window.location.origin;\n }\n return null;\n};\n\nexport const getCurrentPathName = () => {\n if(typeof window !== 'undefined') {\n return window.location.pathname;\n }\n return null;\n};\n\nexport const getCurrentHref = () => {\n if(typeof window !== 'undefined') {\n return window.location.href;\n }\n return null;\n};\n\nexport const getAllowedUserGroups = () => {\n if(typeof window !== 'undefined') {\n return window.ALLOWED_USER_GROUPS || '';\n }\n return null;\n};\n\nexport const buildAPIBaseUrl = (relativeUrl) => {\n if(typeof window !== 'undefined'){\n return `${window.API_BASE_URL}${relativeUrl}`;\n }\n return null``;\n};\n\nexport const putOnLocalStorage = (key, value) => {\n if(typeof window !== 'undefined') {\n window.localStorage.setItem(key, value);\n }\n};\n\nexport const getFromLocalStorage = (key, removeIt) => {\n if(typeof window !== 'undefined') {\n let val = window.localStorage.getItem(key);\n if(removeIt){\n console.log(`getFromLocalStorage removing key ${key}`);\n removeFromLocalStorage(key);\n }\n return val;\n }\n return null;\n};\n\nexport const removeFromLocalStorage = (key) => {\n if(typeof window !== 'undefined') {\n window.localStorage.removeItem(key);\n }\n}\n\nexport const isClearingSessionState = () => {\n if(typeof window !== 'undefined') {\n return window.clearing_session_state;\n }\n return false;\n};\n\nexport const setSessionClearingState = (val) => {\n if(typeof window !== 'undefined') {\n window.clearing_session_state = val;\n }\n};\n\nexport const getCurrentUserLanguage = () => {\n let language = 'en';\n if(typeof navigator !== 'undefined') {\n language = (navigator.languages && navigator.languages[0]) || navigator.language || navigator.userLanguage;\n }\n return language;\n};\n\nexport const scrollToError = (errors) => {\n if(Object.keys(errors).length > 0) {\n const firstError = Object.keys(errors)[0];\n const firstNode = document.getElementById(firstError);\n if (firstNode) window.scrollTo(0, findElementPos(firstNode));\n }\n};\n\nexport const hasErrors = (field, errors) => {\n if(field in errors) {\n return errors[field];\n }\n return '';\n};\n\nexport const shallowEqual = (object1, object2) => {\n const keys1 = Object.keys(object1);\n const keys2 = Object.keys(object2);\n\n if (keys1.length !== keys2.length) {\n return false;\n }\n\n for (let key of keys1) {\n if (object1[key] !== object2[key]) {\n return false;\n }\n }\n\n return true;\n};\n\nexport const arraysEqual = (a1, a2) =>\n a1.length === a2.length && a1.every((o, idx) => shallowEqual(o, a2[idx]));\n\nexport const isEmpty = (obj) => {\n return Object.keys(obj).length === 0;\n};\n\n\nexport const base64URLEncode = (str) => {\n return str\n .toString('base64')\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_')\n .replace(/=/g, '')\n}\n\nexport const retryPromise = async (\n cb,\n maxNumberOfRetries = 3\n) => {\n for (let i = 0; i < maxNumberOfRetries; i++) {\n if (await cb()) {\n return true;\n }\n }\n\n return false;\n}\n\nexport const getTimeServiceUrl = () => {\n if(typeof window !== 'undefined') {\n return window.TIMEINTERVALSINCE1970_API_URL || process.env.TIMEINTERVALSINCE1970_API_URL;\n }\n return null;\n};\n\nexport const getEventLocation = (event, summitVenueCount, summitShowLocDate = null, nowUtc = null) => {\n const shouldShowVenues = (summitShowLocDate && nowUtc) ? summitShowLocDate * 1000 < nowUtc : true;\n const locationName = [];\n const { location } = event;\n\n if (!shouldShowVenues) return 'TBA';\n\n if (!location) return 'TBA';\n\n if (summitVenueCount > 1 && location.venue?.name) locationName.push(location.venue.name);\n if (location.floor?.name) locationName.push(location.floor.name);\n if (location.name) locationName.push(location.name);\n\n return locationName.length > 0 ? locationName.join(' - ') : 'TBA';\n};\n\nexport const getEventHosts = (event) => {\n let hosts = [];\n if (event.speakers?.length > 0) {\n hosts = [...event.speakers];\n }\n if (event.moderator) hosts.push(event.moderator);\n\n return hosts;\n};\n\nconst loadImage = async url => {\n const img = document.createElement('img')\n img.src = url\n img.crossOrigin = 'anonymous'\n\n return new Promise((resolve, reject) => {\n img.onload = () => resolve(img)\n img.onerror = reject\n })\n}\n\nexport const convertSVGtoImg = async (svgUrl) => {\n const img = await loadImage(svgUrl)\n const newWidth = 100\n const newHeight = Math.floor(img.naturalHeight * 100 / img.naturalWidth)\n\n const canvas = document.createElement('canvas')\n canvas.width = newWidth\n canvas.height = newHeight\n canvas.getContext('2d').drawImage(img, 0, 0, newWidth, newHeight)\n\n const url = await canvas.toDataURL(`image/png`, 1.0)\n console.log(url, newWidth, newHeight);\n return {url, width: newWidth, height: newHeight}\n}\n","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"moment-timezone\");","module.exports = require(\"react\");","module.exports = require(\"urijs\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/**\n * Copyright 2020 OpenStack Foundation\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n **/\nimport React from 'react';\nimport moment from \"moment-timezone\";\nimport FragmentParser from \"./fragment-parser\";\nimport {getTimeServiceUrl} from '../utils/methods';\n\n/**\n * class Clock\n */\nclass Clock extends React.Component {\n\n constructor(props) {\n super(props);\n this.fragmentParser = new FragmentParser();\n this.interval = null;\n this.state = {\n timestamp: null,\n manualSet : false,\n }\n this._isMounted = false;\n this.onVisibilityChange = this.onVisibilityChange.bind(this);\n }\n\n /**\n * @param response\n * @param localBefore\n */\n processServerTimeResponse = (response, localBefore) => {\n const localAfter = moment().unix();\n let timestamp = localAfter;\n if (response) {\n timestamp = response.timestamp + (localAfter - localBefore);\n }\n if(this._isMounted) {\n console.log(`Clock::processServerTimeResponse setting timestamp ${timestamp}`)\n this.setState({timestamp});\n }\n if(this.props.onTick)\n this.props.onTick(timestamp);\n }\n\n processServerTimeResponseError = () => {\n const localAfter = moment().unix();\n let timestamp = localAfter;\n if(this._isMounted) {\n console.log(`Clock::processServerTimeResponseError setting timestamp ${timestamp}`)\n this.setState({timestamp});\n }\n if(this.props.onTick)\n this.props.onTick(timestamp);\n }\n\n componentDidMount() {\n this._isMounted = true;\n const {timezone = 'UTC', now} = this.props;\n const nowQS = this.fragmentParser.getParam('now');\n const momentQS = moment.tz(nowQS, 'YYYY-MM-DD,hh:mm:ss', timezone);\n let timestamp = null;\n let manualSet = false;\n if (momentQS.isValid()) {\n timestamp = momentQS.valueOf() / 1000;\n console.log(`Clock::componentDidMount nowQS ${nowQS} is valid setting timestamp ${timestamp}`);\n manualSet = true;\n } else if (now) {\n timestamp = now\n } else {\n const localBefore = moment().unix();\n this.getServerTime()\n .then((response) => this.processServerTimeResponse(response, localBefore))\n .catch(() => this.processServerTimeResponseError())\n }\n\n if(timestamp) {\n this.setState({timestamp, manualSet});\n if(this.props.onTick)\n this.props.onTick(timestamp);\n }\n\n this.interval = setInterval(this.tick, 1000);\n document.addEventListener(\"visibilitychange\", this.onVisibilityChange, false)\n }\n\n onVisibilityChange() {\n const visibilityState = document.visibilityState;\n const {manualSet} = this.state;\n if (visibilityState === \"visible\") {\n console.log(`Clock::onVisibilityChange manualSet ${manualSet}`)\n if(manualSet) return;\n const localBefore = moment().unix();\n this.getServerTime()\n .then((response) => this.processServerTimeResponse(response, localBefore))\n .catch(() => this.processServerTimeResponseError());\n }\n }\n\n componentWillUnmount() {\n this._isMounted = false;\n clearInterval(this.interval);\n document.removeEventListener(\"visibilitychange\", this.onVisibilityChange)\n this.interval = null;\n }\n\n getServerTime = () => {\n const timeServiceUrl = getTimeServiceUrl();\n return fetch(`${timeServiceUrl}`).then(async (response) => {\n if (response.status === 200) {\n return response.json();\n }\n return Promise.reject(null);\n })\n .catch(err => {\n console.log(err);\n return Promise.reject(err);\n });\n };\n\n tick = () => {\n const {timestamp} = this.state;\n if (timestamp !== null) {\n if(this.props.onTick)\n this.props.onTick(timestamp + 1);\n if(this._isMounted)\n this.setState({timestamp: timestamp + 1})\n }\n };\n\n // epoch utc time in seconds\n now = () => {\n return this.state.timestamp;\n };\n\n render() {\n const {display, timezone = 'UTC'} = this.props;\n const {timestamp} = this.state;\n\n if (!display || !timestamp) return null;\n\n return (\n <div style={{marginTop: '50px', textAlign: 'center', fontSize: '20px'}}>\n {moment.tz(timestamp * 1000, timezone).format('YYYY-MM-DD hh:mm:ss')}\n </div>\n );\n }\n\n}\n\nexport default Clock;\n"],"names":["root","factory","exports","module","define","amd","this","FragmentParser","constructor","originalHash","hash","convertToHash","strHash","params","substr","toLowerCase","split","res","param","length","val","trim","clearParams","getParam","key","window","location","hasOwnProperty","getParams","deleteParam","deleteParams","includes","setParam","value","serialize","getTimeServiceUrl","TIMEINTERVALSINCE1970_API_URL","process","env","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","n","getter","__esModule","d","a","definition","o","Object","defineProperty","enumerable","get","obj","prop","prototype","call","r","Symbol","toStringTag","Clock","React","props","super","response","localBefore","localAfter","moment","unix","timestamp","_isMounted","console","log","setState","onTick","timeServiceUrl","fetch","then","async","status","json","Promise","reject","catch","err","state","fragmentParser","interval","manualSet","onVisibilityChange","bind","componentDidMount","timezone","now","nowQS","momentQS","isValid","valueOf","getServerTime","processServerTimeResponse","processServerTimeResponseError","setInterval","tick","document","addEventListener","visibilityState","componentWillUnmount","clearInterval","removeEventListener","render","display","style","marginTop","textAlign","fontSize","format"],"sourceRoot":""}
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(()=>(()=>{"use strict";var e={6689:e=>{e.exports=require("react")}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,o),i.exports}(()=>{o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t}})(),(()=>{o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}})(),(()=>{o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var r={};return(()=>{o.r(r),o.d(r,{default:()=>n});var e=o(6689),t=o.n(e);class n extends t().Component{constructor(e){super(e),this.showField=this.showField.bind(this)}showField(){let{name:e}=this.props,t=window.EXCLUSIVE_SECTIONS;return!!t&&t.includes(e)}render(){let{children:e}=this.props;return this.showField()?e:null}}})(),r})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(()=>(()=>{"use strict";var e={2015:e=>{e.exports=require("react")}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,o),i.exports}(()=>{o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t}})(),(()=>{o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}})(),(()=>{o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var r={};o.r(r),o.d(r,{default:()=>s});var n=o(2015),i=o.n(n);class s extends i().Component{constructor(e){super(e),this.showField=this.showField.bind(this)}showField(){let{name:e}=this.props,t=window.EXCLUSIVE_SECTIONS;return!!t&&t.includes(e)}render(){let{children:e}=this.props;return this.showField()?e:null}}return r})()));
2
2
  //# sourceMappingURL=exclusive-wrapper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"components/exclusive-wrapper.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,8BAA+B,GAAIH,GAChB,iBAAZC,QACdA,QAAQ,+BAAiCD,IAEzCD,EAAK,+BAAiCC,GACvC,CATD,CASGK,MAAM,I,mCCTTH,EAAOD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","webpack://openstack-uicore-foundation/external commonjs \"react\"","webpack://openstack-uicore-foundation/webpack/bootstrap","webpack://openstack-uicore-foundation/webpack/runtime/compat get default export","webpack://openstack-uicore-foundation/webpack/runtime/define property getters","webpack://openstack-uicore-foundation/webpack/runtime/hasOwnProperty shorthand","webpack://openstack-uicore-foundation/webpack/runtime/make namespace object","webpack://openstack-uicore-foundation/./src/components/exclusive-wrapper.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"openstack-uicore-foundation\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"openstack-uicore-foundation\"] = factory();\n\telse\n\t\troot[\"openstack-uicore-foundation\"] = factory();\n})(this, () => {\nreturn ","module.exports = require(\"react\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/**\n * Copyright 2019 OpenStack Foundation\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n **/\n\nimport React from 'react'\n\n\nexport default class Exclusive extends React.Component {\n\n constructor(props) {\n super(props);\n\n this.showField = this.showField.bind(this);\n }\n\n showField() {\n let {name} = this.props;\n let exclusiveSections = window.EXCLUSIVE_SECTIONS;\n\n return exclusiveSections ? exclusiveSections.includes(name) : false;\n }\n\n render() {\n let {children} = this.props;\n\n if (this.showField()) {\n return children;\n }\n\n return null;\n\n }\n}\n"],"names":["root","factory","exports","module","define","amd","this","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","Exclusive","React","constructor","props","super","showField","bind","name","exclusiveSections","window","EXCLUSIVE_SECTIONS","includes","render","children"],"sourceRoot":""}
1
+ {"version":3,"file":"components/exclusive-wrapper.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,8BAA+B,GAAIH,GAChB,iBAAZC,QACdA,QAAQ,+BAAiCD,IAEzCD,EAAK,+BAAiCC,GACvC,CATD,CASGK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V,E","sources":["webpack://openstack-uicore-foundation/webpack/universalModuleDefinition","webpack://openstack-uicore-foundation/external commonjs \"react\"","webpack://openstack-uicore-foundation/webpack/bootstrap","webpack://openstack-uicore-foundation/webpack/runtime/compat get default export","webpack://openstack-uicore-foundation/webpack/runtime/define property getters","webpack://openstack-uicore-foundation/webpack/runtime/hasOwnProperty shorthand","webpack://openstack-uicore-foundation/webpack/runtime/make namespace object","webpack://openstack-uicore-foundation/./src/components/exclusive-wrapper.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"openstack-uicore-foundation\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"openstack-uicore-foundation\"] = factory();\n\telse\n\t\troot[\"openstack-uicore-foundation\"] = factory();\n})(this, () => {\nreturn ","module.exports = require(\"react\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/**\n * Copyright 2019 OpenStack Foundation\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n **/\n\nimport React from 'react'\n\n\nexport default class Exclusive extends React.Component {\n\n constructor(props) {\n super(props);\n\n this.showField = this.showField.bind(this);\n }\n\n showField() {\n let {name} = this.props;\n let exclusiveSections = window.EXCLUSIVE_SECTIONS;\n\n return exclusiveSections ? exclusiveSections.includes(name) : false;\n }\n\n render() {\n let {children} = this.props;\n\n if (this.showField()) {\n return children;\n }\n\n return null;\n\n }\n}\n"],"names":["root","factory","exports","module","define","amd","this","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","Exclusive","React","constructor","props","super","showField","bind","name","exclusiveSections","window","EXCLUSIVE_SECTIONS","includes","render","children"],"sourceRoot":""}
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(()=>(()=>{"use strict";var e={2230:(e,t,a)=>{a.d(t,{default:()=>p});var r=a(3838),n=a.n(r),l=a(580),s=a.n(l),i=a(6689),o=a.n(i),u=a(4656),c=a.n(u),d=a(418);a(6471);const m=["onChange","value","className","options","id","children","error","disabled","name","ariaLabelledBy"];class p extends o().Component{constructor(e){super(e);let t=!!e.value&&e.value.find((t=>!e.options.map((e=>e.value)).includes(t)));this.state={otherChecked:!!t},this.handleChange=this.handleChange.bind(this),this.handleOtherCBChange=this.handleOtherCBChange.bind(this)}handleChange(e){let t=this.props.options.map((e=>e.value)),a=this.props.value?[...this.props.value]:[];if("checkbox"===e.target.type)if(e.target.checked){const t=isNaN(e.target.value)?e.target.value:parseInt(e.target.value);a.push(t)}else a=a.filter((t=>t!=e.target.value));else a=a.filter((e=>t.includes(e))),a.push(e.target.value);let r={target:{id:this.props.id,value:a,type:"checkboxlist"}};this.props.onChange(r)}handleOtherCBChange(e){this.setState({otherChecked:e.target.checked})}render(){let e,t=this.props,{onChange:a,value:r,className:l,options:s,id:i,children:u,error:p,disabled:h,name:b,ariaLabelledBy:g}=t,{otherChecked:f}=(n()(t,m),this.state),v=this.props.hasOwnProperty("inline"),y=this.props.hasOwnProperty("allowOther"),_=!!r&&r.find((e=>!s.map((e=>e.value)).includes(e))),E=this.props.hasOwnProperty("error")&&""!==p,q=this.props.hasOwnProperty("disabled")&&1==h;return e=v?{paddingLeft:"22px",marginLeft:"20px",float:"left"}:{paddingLeft:"22px",marginTop:"7px"},o().createElement("div",{id:`chl_wrapper_${i}`,"aria-labelledby":g},o().createElement("div",{className:"checkboxes-div"+(E?" error":"")},s.map((t=>{let a=!!r&&r.includes(t.value);return o().createElement("div",{className:"form-check abc-checkbox",key:"radio_key_"+t.value,style:e},o().createElement("input",{type:"checkbox",id:`cb_${i}_${t.value}`,name:b||i,checked:a,disabled:q,onChange:this.handleChange,className:"form-check-input",value:t.value}),o().createElement("label",{className:"form-check-label",htmlFor:`cb_${i}_${t.value}`},o().createElement(d.default,null,t.label)))})),y&&o().createElement("div",{className:"form-check abc-checkbox",style:e},o().createElement("input",{type:"checkbox",id:"cb_other"+i,checked:f,disabled:q,onChange:this.handleOtherCBChange,className:"form-check-input",value:"other"}),o().createElement("label",{className:"form-check-label",htmlFor:"cb_other"+i},c().translate("general.other"))),y&&f&&o().createElement("div",{style:{paddingLeft:"22px",width:"50%"}},o().createElement("input",{className:"form-control",disabled:q,onChange:this.handleChange,value:_}))),E&&o().createElement("p",{className:"error-label"},p))}}p.defaultProps={ariaLabelledBy:null},p.propTypes={id:s().string.isRequired}},401:(e,t,a)=>{a.d(t,{default:()=>g});var r=a(8213),n=a.n(r),l=a(8779),s=a.n(l),i=a(3838),o=a.n(i),u=a(6689),c=a.n(u),d=a(1929),m=a.n(d);const p=["onChange","value","className","error","clearable","disabled","overrideCSS","ariaLabelledBy"];function h(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function b(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?h(Object(a),!0).forEach((function(t){s()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):h(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}class g extends c().Component{constructor(e){super(e),this.handleChange=this.handleChange.bind(this)}handleChange(e){let t=null;t=this.props.isMulti?e?e.map((e=>e.value)):null:e?e.value:null;let a={target:{id:this.props.id,value:t,type:"dropdown"}};this.props.onChange(a)}render(){let e=this.props,{onChange:t,value:a,className:r,error:l,clearable:s,disabled:i,overrideCSS:u,ariaLabelledBy:d}=e,h=o()(e,p),g=this.props.hasOwnProperty("error")&&""!=l,f=this.props.hasOwnProperty("clearable"),v=this.props.hasOwnProperty("disabled")&&1==i,y=null,_=r;this.props.hasOwnProperty("overrideCSS")&&0!=u||(_="dropdown "+r+" "+(g?"error":"")),y=this.props.isMulti?this.props.options.filter((e=>a.includes(e.value))):a instanceof Object||null==a?a:this.props.options.find((e=>e.value==a));const E={menu:e=>b(b({},e),{},{zIndex:999})};return c().createElement("div",null,c().createElement(m(),n()({className:_,value:y,onChange:this.handleChange,isClearable:f,isDisabled:v,styles:E,"aria-labelledby":d,formatOptionLabel:e=>c().createElement("span",{dangerouslySetInnerHTML:{__html:e.label}})},h)),g&&c().createElement("p",{className:"error-label"},l))}}g.defaultProps={ariaLabelledBy:null}},7027:(e,t,a)=>{a.d(t,{default:()=>d});var r=a(3838),n=a.n(r),l=a(6689),s=a.n(l),i=a(418),o=a(580),u=a.n(o);a(6471);const c=["onChange","value","className","error","ariaLabelledBy","disabled","options","id","name"];class d extends s().Component{constructor(e){super(e),this.state={value:e.value},this.handleChange=this.handleChange.bind(this)}handleChange(e){let t={target:{id:this.props.id,value:e.target.value,type:"radio"}};this.props.onChange(t)}getLabel(e,t,a,r){return a?s().createElement("label",{className:"form-check-label",htmlFor:`radio_${t}_${e.value}`,style:{display:"inline-block"}},s().createElement(i.default,null,e.label)):r?s().createElement("label",{className:"form-check-label",htmlFor:`radio_${t}_${e.value}`},e.label):s().createElement("label",{className:"form-check-label",htmlFor:`radio_${t}_${e.value}`,style:{display:"inline-block"}},s().createElement("h4",{style:{marginTop:"0px"}},e.label),s().createElement(i.default,null,e.description))}render(){let e,t=this.props,{onChange:a,value:r,className:l,error:i,ariaLabelledBy:o,disabled:u,options:d,id:m,name:p}=t,h=(n()(t,c),this.props.hasOwnProperty("error")&&""!=i),b=this.props.hasOwnProperty("inline"),g=this.props.hasOwnProperty("simple"),f=this.props.hasOwnProperty("disabled")&&1==u;return e=b?{paddingLeft:"22px",marginLeft:"20px",float:"left"}:{paddingLeft:"22px"},s().createElement("div",{id:`rl_wrapper_${m}`,"aria-labelledby":o},d.map((t=>{let a=t.value==r;return s().createElement("div",{className:"form-check abc-radio",key:`radio_key_${m}_${t.value}`,style:e},s().createElement("input",{className:"form-check-input",type:"radio",id:`radio_${m}_${t.value}`,value:t.value,checked:a,onChange:this.handleChange,disabled:f,name:p||`radio_${m}`}),this.getLabel(t,m,b,g))})),h&&s().createElement("p",{className:"error-label"},i))}}d.defaultProps={ariaLabelledBy:null},d.propTypes={id:u().string.isRequired}},1833:(e,t,a)=>{a.d(t,{default:()=>c});var r=a(8213),n=a.n(r),l=a(3838),s=a.n(l),i=a(6689),o=a.n(i);const u=["onChange","value","className","error","ariaLabelledBy","containerClassName"];class c extends o().Component{constructor(e){super(e),this.handleChange=this.handleChange.bind(this)}componentDidUpdate(e,t,a){this.props.value!==e.value&&(this.input.value=this.props.value)}handleChange(e){this.props.onChange(e)}render(){let e=this.props,{onChange:t,value:a,className:r,error:l,ariaLabelledBy:i,containerClassName:c}=e,d=s()(e,u),m=this.props.hasOwnProperty("error")&&""!==l,p=this.props.hasOwnProperty("className")?r:"form-control",h=this.props.hasOwnProperty("containerClassName")?c:"container-form-control";return o().createElement("div",{className:h},o().createElement("input",n()({className:`${p} ${m?"error":""}`,ref:e=>{this.input=e},defaultValue:a,"aria-labelledby":i,onChange:this.handleChange},d)),m&&o().createElement("p",{className:"error-label"},l))}}c.defaultProps={ariaLabelledBy:null}},418:(e,t,a)=>{a.d(t,{default:()=>c});var r=a(8213),n=a.n(r),l=a(3838),s=a.n(l),i=a(6689),o=a.n(i);const u=["children","replaceNewLine","className"],c=e=>{let{children:t,replaceNewLine:a=!1,className:r=""}=e,l=s()(e,u);return o().createElement("span",n()({className:r,dangerouslySetInnerHTML:{__html:a?null==t?void 0:t.replace(/\n/g,"<br />"):t}},l))}},6793:(e,t,a)=>{a.d(t,{toSlug:()=>r});a(8362),a(6530);const r=e=>(e=e.toLowerCase()).replace(/[^a-zA-Z0-9]+/g,"_")},1995:(e,t,a)=>{a.d(t,{default:()=>h});var r=a(8779),n=a.n(r),l=a(6793);function s(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function i(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?s(Object(a),!0).forEach((function(t){n()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):s(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}const o="ComboBox",u="CheckBoxList",c="RadioButtonList",d=[o,u,c],m="And",p="Equal";class h{constructor(e,t=[]){n()(this,"_parseQuestion",(e=>{if(this.questionByName[(0,l.toSlug)(e.name)]=e,this.questionById[parseInt(e.id)]=e,e.hasOwnProperty("sub_question_rules"))for(let t of e.sub_question_rules)this.rules[parseInt(t.id)]=t,this._parseQuestion(t.sub_question)})),n()(this,"_parseQuestions",(()=>{for(let e of this.questions)this._parseQuestion(e)})),n()(this,"_allowsValues",(e=>d.includes(e.type))),n()(this,"_allowsValue",((e,t)=>{let a=t.value.split(",").map((e=>parseInt(e)));for(let t of a)if(!e.values.map((e=>e.id)).includes(t))return!1;return!0})),n()(this,"_getAnswerFor",(e=>{let t=Number.isInteger(e)?e:e.id,a=this.answers[t]||null;return a||null})),n()(this,"_hasValue",(e=>""!==e.value)),n()(this,"_answerContains",((e,t)=>e.value.split(",").includes(t))),n()(this,"_isSubQuestionVisible",(e=>{let t=e.answer_values_operator===m;const a=this._getAnswerFor(e.parent_question_id);if(a)switch(e.visibility_condition){case p:for(let r of e.answer_values)t=e.answer_values_operator===m?t&&this._answerContains(a,r):t||this._answerContains(a,r);break;case"NotEqual":for(let r of e.answer_values)t=e.answer_values_operator===m?t&&!this._answerContains(a,r):t||!this._answerContains(a,r)}else t=e.visibility_condition!==p;return"Visible"===e.visibility?t:!t})),n()(this,"_isAnswered",(e=>{const t=this._getAnswerFor(e);if("MainQuestion"===e.class)return!e.mandatory||!!t&&(!!this._hasValue(t)&&!(this._allowsValues(e)&&!this._allowsValue(e,t)));for(let a of e.parent_rules)if(this._isSubQuestionVisible(this.rules[a]))return!e.mandatory||!!t&&(!!this._hasValue(t)&&!(this._allowsValues(e)&&!this._allowsValue(e,t)));return!0})),n()(this,"_checkQuestion",(e=>{let t=this._isAnswered(e);if(e.hasOwnProperty("sub_question_rules"))for(let a of e.sub_question_rules)t=t&&this._checkQuestion(a.sub_question);return t})),n()(this,"_formatQuestionAnswer",(e=>{var t,a;let r={};const n=(0,l.toSlug)(e.name);let s=null===(t=this.originalAnswers.find((t=>t.question_id===e.id)))||void 0===t?void 0:t.value;if(!s&&(null==e||null===(a=e.values)||void 0===a?void 0:a.length)>0){const t=e.values.find((e=>e.is_default));t&&(s=t.id.toString())}if(s&&("CheckBox"===e.type&&(s="false"!==s&&!!s),e.type!==c&&e.type!==o||(s=parseInt(s)),e.type===u&&(s=s.split(",").map((e=>parseInt(e)))||[])),r[n]=s||"",e.type===u&&""===r[n]&&(r[n]=[]),e.hasOwnProperty("sub_question_rules"))for(let t of e.sub_question_rules){let e=this._formatQuestionAnswer(t.sub_question);r=i(i({},r),e)}return r})),n()(this,"formatAnswers",(()=>{let e={};return this.questions.forEach((t=>{let a=this._formatQuestionAnswer(t);e=i(i({},e),a)})),e})),n()(this,"completed",(()=>{let e=!0;for(let t of this.questions)e=e&&this._checkQuestion(t);return e})),n()(this,"getQuestionByName",(e=>{const t=(0,l.toSlug)(e);return this.questionByName[e]||this.questionByName[t]||null})),n()(this,"getQuestionById",(e=>this.questionById[parseInt(e)]||null)),this.questions=e,this.originalAnswers=t,this.answers=[];for(let e of this.originalAnswers)this.answers[e.question_id]=e;this.questionByName={},this.questionById={},this.rules={},this._parseQuestions()}}},8779:e=>{e.exports=require("@babel/runtime/helpers/defineProperty")},8213:e=>{e.exports=require("@babel/runtime/helpers/extends")},3838:e=>{e.exports=require("@babel/runtime/helpers/objectWithoutProperties")},6471:e=>{e.exports=require("awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css")},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},8362:e=>{e.exports=require("moment-timezone")},580:e=>{e.exports=require("prop-types")},6689:e=>{e.exports=require("react")},1929:e=>{e.exports=require("react-select")},6530:e=>{e.exports=require("urijs")}},t={};function a(r){var n=t[r];if(void 0!==n)return n.exports;var l=t[r]={exports:{}};return e[r](l,l.exports,a),l.exports}(()=>{a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t}})(),(()=>{a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}})(),(()=>{a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var r={};return(()=>{a.r(r),a.d(r,{default:()=>O});var e=a(8213),t=a.n(e),n=a(3838),l=a.n(n),s=a(6689),i=a.n(s),o=a(580),u=a.n(o),c=a(1833),d=a(401),m=a(7027),p=a(2230),h=a(1995);const b=require("react-final-form");var g=a(6793);const f="CheckBox",v="RadioButton";a(6471);const y=["input","meta","question","className","isDisabled","isRequired"],_=["input","meta","question","isDisabled","isRequired"],E=["input","meta","question","isDisabled","isRequired"],q=["input","meta","question","isDisabled","isRequired","maxValues"],w=e=>{let{input:a,meta:r,question:n,className:s,isDisabled:o,isRequired:u}=e,d=l()(e,y);return i().createElement(c.default,t()({},a,d,{containerClassName:s,name:(0,g.toSlug)(n.name),ariaLabelledBy:`${(0,g.toSlug)(n.name)} label`,id:(0,g.toSlug)(n.name),value:a.value,disabled:o,required:u,onChange:a.onChange,placeholder:n.placeholder}))},C=e=>{let{input:a,meta:r,question:n,isDisabled:s,isRequired:o}=e,u=l()(e,_);return i().createElement(m.default,t()({},a,u,{name:(0,g.toSlug)(n.name),ariaLabelledBy:`${(0,g.toSlug)(n.name)} label`,id:(0,g.toSlug)(n.name),overrideCSS:!0,value:a.value,disabled:s,required:o,onChange:a.onChange}))},S=e=>{let{input:a,meta:r,question:n,isDisabled:s,isRequired:o}=e,u=l()(e,E);return i().createElement(d.default,t()({},a,u,{name:(0,g.toSlug)(n.name),ariaLabelledBy:`${(0,g.toSlug)(n.name)} label`,id:(0,g.toSlug)(n.name),overrideCSS:!0,className:"ddl-extra-questions-container",classNamePrefix:"ddl-extra-questions",value:a.value,disabled:s,required:o,onChange:a.onChange}))},N=e=>{let{input:a,meta:r,question:n,isDisabled:s,isRequired:o,maxValues:u}=e,c=l()(e,q);return i().createElement(p.default,t()({},a,c,{id:(0,g.toSlug)(n.name),name:(0,g.toSlug)(n.name),ariaLabelledBy:`${(0,g.toSlug)(n.name)} label`,value:a.value,disabled:s,required:o,onChange:e=>{const t=e.target.value;return u>0&&t.length>u?null:a.onChange(e)}}))},k=e=>e?e=>e?void 0:"Required":()=>{},x=i().forwardRef((({extraQuestions:e,userAnswers:t,onAnswerChanges:a,className:r="questions-form",questionContainerClassName:n="question-container",questionLabelContainerClassName:l="question-label-container",questionControlContainerClassName:o="question-control-container",readOnly:u=!1,debug:c=!1,buttonText:d="Submit",RequiredErrorMessage:m="Required",ValidationErrorClassName:p="extra-question-error",allowExtraQuestionsEdit:y=!0,onError:_=(e=>console.log("form errors: ",e)),shouldScroll2FirstError:E=!0},q)=>{let x=null;const O=(0,s.useRef)({}),P=(0,s.useRef)(null),[B,L]=(0,s.useState)({});(0,s.useEffect)((()=>{F()}),[e]),(0,s.useImperativeHandle)(q,(()=>({doSubmit(){var e;null===(e=P.current)||void 0===e||e.dispatchEvent(new Event("submit",{cancelable:!0,bubbles:!0}))},scroll2QuestionById(e){H(e)}})));const j=e=>(O.current[e]||(O.current[e]=i().createRef()),O.current[e]),F=()=>{const a=new h.default(e,t);L(a.formatAnswers())},$=({when:e,rule:t,children:a})=>i().createElement(b.Field,{name:e,subscription:{value:!0}},(({input:{value:e}})=>D(t,A(e,t),a))),R=({name:e})=>i().createElement(b.Field,{name:e,subscription:{error:!0,touched:!0,submitFailed:!0}},(({meta:{error:e,touched:t,submitFailed:a}})=>e&&(t||a)?i().createElement("div",{className:p},e):null)),A=(e,t)=>{let a=t.answer_values;if(Array.isArray(e)){if(!e.length)return!1;let r="And"===t.answer_values_operator;return a.forEach((a=>{r="And"===t.answer_values_operator?r&&e.includes(parseInt(a)):r||e.includes(parseInt(a))})),r}return a.includes(e.toString())},D=(e,t,a)=>"Visible"===e.visibility?"Equal"===e.visibility_condition?t?a:(delete O.current[e.sub_question.id],null):t?(delete O.current[e.sub_question.id],null):a:"Equal"===e.visibility_condition?t?(delete O.current[e.sub_question.id],null):a:t?a:(delete O.current[e.sub_question.id],null),I=e=>{var t;const a=String.fromCharCode(160),r=null==e||null===(t=e.label)||void 0===t?void 0:t.replace(/\n/g,"<br />").replace(/<p>(.*)<\/p>/gi,"$1"),n=[f,v],l=e.mandatory&&!n.includes(e.type)?`${r}${a}<b>*</b>`:r;return i().createElement("label",{dangerouslySetInnerHTML:{__html:l},htmlFor:(0,g.toSlug)(e.name),id:`${(0,g.toSlug)(e.name)} label`})},Q=e=>{let t=e.values;const a=!y&&((e,t)=>{const a=(0,g.toSlug)(e.name);if(!t.hasOwnProperty(a))return!1;const r=t[a];return Array.isArray(r)||"string"==typeof r?r.length>0:"number"==typeof r?r>0:"boolean"==typeof r&&r})(e,B);var r,u,c,d;if("Text"===e.type)return i().createElement(s.Fragment,{key:(0,g.toSlug)(e.name)},i().createElement("div",{ref:j(e.id),className:n},i().createElement("span",{className:l},I(e)),i().createElement("div",{className:o},i().createElement(b.Field,{name:(0,g.toSlug)(e.name),question:e,isDisabled:a,isRequired:e.mandatory,validate:k(e.mandatory),component:w}),i().createElement(R,{name:(0,g.toSlug)(e.name)}))),(null===(r=e.sub_question_rules)||void 0===r?void 0:r.length)>0&&e.sub_question_rules.map((t=>i().createElement($,{key:t.id,when:(0,g.toSlug)(e.name),rule:t},Q(t.sub_question)))));if("TextArea"===e.type)return i().createElement(s.Fragment,{key:(0,g.toSlug)(e.name)},i().createElement("div",{ref:j(e.id),className:n},i().createElement("span",{className:l},I(e)),i().createElement("div",{className:o},i().createElement(b.Field,{validate:k(e.mandatory),name:(0,g.toSlug)(e.name),id:(0,g.toSlug)(e.name),disabled:a,required:e.mandatory,component:"textarea"}),i().createElement(R,{name:(0,g.toSlug)(e.name)}))),(null===(u=e.sub_question_rules)||void 0===u?void 0:u.length)>0&&e.sub_question_rules.map((t=>i().createElement($,{key:t.id,when:(0,g.toSlug)(e.name),rule:t},Q(t.sub_question)))));if(e.type===f)return i().createElement(s.Fragment,{key:(0,g.toSlug)(e.name)},i().createElement("div",{ref:j(e.id),className:`${n} checkbox-wrapper`},i().createElement("div",{className:`${o} input-wrapper`},i().createElement("div",{className:"form-check abc-checkbox"},i().createElement(b.Field,{name:(0,g.toSlug)(e.name),id:(0,g.toSlug)(e.name),validate:k(e.mandatory),disabled:a,required:e.mandatory,type:"checkbox",className:"form-check-input",component:"input"}),i().createElement("label",{className:"form-check-label",htmlFor:(0,g.toSlug)(e.name)}),e.mandatory&&i().createElement("span",{className:"checkbox-mandatory"},i().createElement("b",null,"*")))),i().createElement("span",{className:`eq-checkbox-label ${l}`},I(e))),i().createElement(R,{name:(0,g.toSlug)(e.name)}),(null===(c=e.sub_question_rules)||void 0===c?void 0:c.length)>0&&e.sub_question_rules.map((t=>i().createElement($,{key:t.id,when:(0,g.toSlug)(e.name),rule:t},Q(t.sub_question)))));if(e.type===v)return i().createElement(s.Fragment,{key:(0,g.toSlug)(e.name)},i().createElement("div",{ref:j(e.id),className:`${n} checkbox-wrapper`},i().createElement("div",{className:`${o} input-wrapper`},i().createElement("div",{className:"form-check abc-radio"},i().createElement(b.Field,{name:(0,g.toSlug)(e.name),id:(0,g.toSlug)(e.name),validate:k(e.mandatory),disabled:a,required:e.mandatory,type:"radio",className:"form-check-input",value:"true",component:"input"}),i().createElement("label",{className:"form-check-label",htmlFor:(0,g.toSlug)(e.name)}),e.mandatory&&i().createElement("span",{className:"checkbox-mandatory"},i().createElement("b",null,"*")))),i().createElement("span",{className:`eq-checkbox-label ${l}`},I(e))),i().createElement(R,{name:(0,g.toSlug)(e.name)}),(null===(d=e.sub_question_rules)||void 0===d?void 0:d.length)>0&&e.sub_question_rules.map((t=>i().createElement($,{key:t.id,when:(0,g.toSlug)(e.name),rule:t},Q(t.sub_question)))));if("RadioButtonList"===e.type){var m;const r=t.map((e=>({label:e.label,value:e.id})));return i().createElement(s.Fragment,{key:(0,g.toSlug)(e.name)},i().createElement("div",{ref:j(e.id),className:n},i().createElement("span",{className:l},I(e)),i().createElement("div",{className:o},i().createElement(b.Field,{name:(0,g.toSlug)(e.name),options:r,question:e,validate:k(e.mandatory),isDisabled:a,isRequired:e.mandatory,component:C}),i().createElement(R,{name:(0,g.toSlug)(e.name)}))),(null===(m=e.sub_question_rules)||void 0===m?void 0:m.length)>0&&e.sub_question_rules.map((t=>i().createElement($,{key:t.id,when:(0,g.toSlug)(e.name),rule:t},Q(t.sub_question)))))}if("ComboBox"===e.type||"CountryComboBox"===e.type){var p;const r=t.map((e=>({label:e.label,value:e.id})));return i().createElement(s.Fragment,{key:(0,g.toSlug)(e.name)},i().createElement("div",{ref:j(e.id),className:n},i().createElement("span",{className:l},I(e)),i().createElement("div",{className:`${o} reactSelectDropdown`},i().createElement(b.Field,{name:(0,g.toSlug)(e.name),options:r,question:e,validate:k(e.mandatory),isDisabled:a,isRequired:e.mandatory,component:S}),i().createElement(R,{name:(0,g.toSlug)(e.name)}))),(null===(p=e.sub_question_rules)||void 0===p?void 0:p.length)>0&&e.sub_question_rules.map((t=>i().createElement($,{key:t.id,when:(0,g.toSlug)(e.name),rule:t},Q(t.sub_question)))))}if("CheckBoxList"===e.type){var h;const r=t.map((e=>({label:e.label,value:e.id})));return i().createElement(s.Fragment,{key:(0,g.toSlug)(e.name)},i().createElement("div",{ref:j(e.id),className:n},i().createElement("span",{className:l},I(e)),i().createElement("div",{className:o},i().createElement(b.Field,{name:(0,g.toSlug)(e.name),className:o,validate:k(e.mandatory),options:r,question:e,maxValues:e.max_selected_values,isDisabled:a,isRequired:e.mandatory,component:N}),i().createElement(R,{name:(0,g.toSlug)(e.name)}))),(null===(h=e.sub_question_rules)||void 0===h?void 0:h.length)>0&&e.sub_question_rules.map((t=>i().createElement($,{key:t.id,when:(0,g.toSlug)(e.name),rule:t},Q(t.sub_question)))))}return null},V=(e,t,a)=>{var r;if(e.mandatory&&(e=>!!O.current[e.id])(e)){const r=(0,g.toSlug)(e.name);t.hasOwnProperty((0,g.toSlug)(r))&&""!==t[(0,g.toSlug)(r)]&&0!==t[r].length||(a[r]=m)}null===(r=e.sub_question_rules)||void 0===r||r.forEach((e=>{V(e.sub_question,t,a)}))};if(!Object.keys(B).length)return null;const T=(e,t,a)=>{var r;t.includes((0,g.toSlug)(e.name))&&a.push(e),null===(r=e.sub_question_rules)||void 0===r||r.forEach((e=>{T(e.sub_question,t,a)}))},M=t=>{const a=[];return e.forEach((e=>{T(e,t,a)})),a.sort(((e,t)=>e.order>t.order))[0]},H=e=>{const t=O.current[e];t&&t.current&&(t.current.focus(),t.current.scrollIntoView({behavior:"smooth",block:"center"}))};return Object.keys(B).length?i().createElement("div",{className:r},i().createElement(b.Form,{validate:t=>{const a={};return e.forEach((e=>{V(e,t,a)})),a},onSubmit:e=>{a(e)},initialValues:B},(({handleSubmit:t,form:a,submitting:r,pristine:n,values:l})=>(x=t,i().createElement("form",{onSubmit:e=>{const r=a.getRegisteredFields().filter((e=>a.getFieldState(e).invalid));if(r.length>0){const e=M(r);_(r,O.current[e.id],e.id),E&&(e=>{const t=M(e);t&&H(t.id)})(r)}t(e)},ref:P},u?i().createElement("fieldset",{disabled:"disabled"},e.map((e=>Q(e)))):e.map((e=>Q(e))),c&&i().createElement("pre",null,JSON.stringify(l,0,2)))))),!q&&i().createElement("button",{type:"submit",onClick:e=>{x(e)},style:{marginTop:10}},d)):null}));x.propTypes={extraQuestions:u().array.isRequired,userAnswers:u().array.isRequired,onAnswerChanges:u().func.isRequired,className:u().string,debug:u().bool,buttonText:u().string,questionContainerClassName:u().string,questionLabelContainerClassName:u().string,questionControlContainerClassName:u().string,RequiredErrorMessage:u().string,ValidationErrorClassName:u().string,allowExtraQuestionsEdit:u().bool,shouldScroll2FirstError:u().bool,readOnly:u().bool};const O=x})(),r})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(()=>(()=>{"use strict";var e={7017:(e,t,a)=>{a.d(t,{default:()=>p});var r=a(2462),n=a.n(r),l=a(9825),s=a.n(l),i=a(2015),o=a.n(i),u=a(6842),c=a.n(u),d=a(5028);a(1536);const m=["onChange","value","className","options","id","children","error","disabled","name","ariaLabelledBy"];class p extends o().Component{constructor(e){super(e);let t=!!e.value&&e.value.find((t=>!e.options.map((e=>e.value)).includes(t)));this.state={otherChecked:!!t},this.handleChange=this.handleChange.bind(this),this.handleOtherCBChange=this.handleOtherCBChange.bind(this)}handleChange(e){let t=this.props.options.map((e=>e.value)),a=this.props.value?[...this.props.value]:[];if("checkbox"===e.target.type)if(e.target.checked){const t=isNaN(e.target.value)?e.target.value:parseInt(e.target.value);a.push(t)}else a=a.filter((t=>t!=e.target.value));else a=a.filter((e=>t.includes(e))),a.push(e.target.value);let r={target:{id:this.props.id,value:a,type:"checkboxlist"}};this.props.onChange(r)}handleOtherCBChange(e){this.setState({otherChecked:e.target.checked})}render(){let e,t=this.props,{onChange:a,value:r,className:l,options:s,id:i,children:u,error:p,disabled:h,name:b,ariaLabelledBy:g}=t,{otherChecked:f}=(n()(t,m),this.state),v=this.props.hasOwnProperty("inline"),y=this.props.hasOwnProperty("allowOther"),_=!!r&&r.find((e=>!s.map((e=>e.value)).includes(e))),E=this.props.hasOwnProperty("error")&&""!==p,q=this.props.hasOwnProperty("disabled")&&1==h;return e=v?{paddingLeft:"22px",marginLeft:"20px",float:"left"}:{paddingLeft:"22px",marginTop:"7px"},o().createElement("div",{id:`chl_wrapper_${i}`,"aria-labelledby":g},o().createElement("div",{className:"checkboxes-div"+(E?" error":"")},s.map((t=>{let a=!!r&&r.includes(t.value);return o().createElement("div",{className:"form-check abc-checkbox",key:"radio_key_"+t.value,style:e},o().createElement("input",{type:"checkbox",id:`cb_${i}_${t.value}`,name:b||i,checked:a,disabled:q,onChange:this.handleChange,className:"form-check-input",value:t.value}),o().createElement("label",{className:"form-check-label",htmlFor:`cb_${i}_${t.value}`},o().createElement(d.default,null,t.label)))})),y&&o().createElement("div",{className:"form-check abc-checkbox",style:e},o().createElement("input",{type:"checkbox",id:"cb_other"+i,checked:f,disabled:q,onChange:this.handleOtherCBChange,className:"form-check-input",value:"other"}),o().createElement("label",{className:"form-check-label",htmlFor:"cb_other"+i},c().translate("general.other"))),y&&f&&o().createElement("div",{style:{paddingLeft:"22px",width:"50%"}},o().createElement("input",{className:"form-control",disabled:q,onChange:this.handleChange,value:_}))),E&&o().createElement("p",{className:"error-label"},p))}}p.defaultProps={ariaLabelledBy:null},p.propTypes={id:s().string.isRequired}},6604:(e,t,a)=>{a.d(t,{default:()=>g});var r=a(6031),n=a.n(r),l=a(1116),s=a.n(l),i=a(2462),o=a.n(i),u=a(2015),c=a.n(u),d=a(8466),m=a.n(d);const p=["onChange","value","className","error","clearable","disabled","overrideCSS","ariaLabelledBy"];function h(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function b(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?h(Object(a),!0).forEach((function(t){s()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):h(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}class g extends c().Component{constructor(e){super(e),this.handleChange=this.handleChange.bind(this)}handleChange(e){let t=null;t=this.props.isMulti?e?e.map((e=>e.value)):null:e?e.value:null;let a={target:{id:this.props.id,value:t,type:"dropdown"}};this.props.onChange(a)}render(){let e=this.props,{onChange:t,value:a,className:r,error:l,clearable:s,disabled:i,overrideCSS:u,ariaLabelledBy:d}=e,h=o()(e,p),g=this.props.hasOwnProperty("error")&&""!=l,f=this.props.hasOwnProperty("clearable"),v=this.props.hasOwnProperty("disabled")&&1==i,y=null,_=r;this.props.hasOwnProperty("overrideCSS")&&0!=u||(_="dropdown "+r+" "+(g?"error":"")),y=this.props.isMulti?this.props.options.filter((e=>a.includes(e.value))):a instanceof Object||null==a?a:this.props.options.find((e=>e.value==a));const E={menu:e=>b(b({},e),{},{zIndex:999})};return c().createElement("div",null,c().createElement(m(),n()({className:_,value:y,onChange:this.handleChange,isClearable:f,isDisabled:v,styles:E,"aria-labelledby":d,formatOptionLabel:e=>c().createElement("span",{dangerouslySetInnerHTML:{__html:e.label}})},h)),g&&c().createElement("p",{className:"error-label"},l))}}g.defaultProps={ariaLabelledBy:null}},5639:(e,t,a)=>{a.d(t,{default:()=>d});var r=a(2462),n=a.n(r),l=a(2015),s=a.n(l),i=a(5028),o=a(9825),u=a.n(o);a(1536);const c=["onChange","value","className","error","ariaLabelledBy","disabled","options","id","name"];class d extends s().Component{constructor(e){super(e),this.state={value:e.value},this.handleChange=this.handleChange.bind(this)}handleChange(e){let t={target:{id:this.props.id,value:e.target.value,type:"radio"}};this.props.onChange(t)}getLabel(e,t,a,r){return a?s().createElement("label",{className:"form-check-label",htmlFor:`radio_${t}_${e.value}`,style:{display:"inline-block"}},s().createElement(i.default,null,e.label)):r?s().createElement("label",{className:"form-check-label",htmlFor:`radio_${t}_${e.value}`},e.label):s().createElement("label",{className:"form-check-label",htmlFor:`radio_${t}_${e.value}`,style:{display:"inline-block"}},s().createElement("h4",{style:{marginTop:"0px"}},e.label),s().createElement(i.default,null,e.description))}render(){let e,t=this.props,{onChange:a,value:r,className:l,error:i,ariaLabelledBy:o,disabled:u,options:d,id:m,name:p}=t,h=(n()(t,c),this.props.hasOwnProperty("error")&&""!=i),b=this.props.hasOwnProperty("inline"),g=this.props.hasOwnProperty("simple"),f=this.props.hasOwnProperty("disabled")&&1==u;return e=b?{paddingLeft:"22px",marginLeft:"20px",float:"left"}:{paddingLeft:"22px"},s().createElement("div",{id:`rl_wrapper_${m}`,"aria-labelledby":o},d.map((t=>{let a=t.value==r;return s().createElement("div",{className:"form-check abc-radio",key:`radio_key_${m}_${t.value}`,style:e},s().createElement("input",{className:"form-check-input",type:"radio",id:`radio_${m}_${t.value}`,value:t.value,checked:a,onChange:this.handleChange,disabled:f,name:p||`radio_${m}`}),this.getLabel(t,m,b,g))})),h&&s().createElement("p",{className:"error-label"},i))}}d.defaultProps={ariaLabelledBy:null},d.propTypes={id:u().string.isRequired}},7651:(e,t,a)=>{a.d(t,{default:()=>c});var r=a(6031),n=a.n(r),l=a(2462),s=a.n(l),i=a(2015),o=a.n(i);const u=["onChange","value","className","error","ariaLabelledBy","containerClassName"];class c extends o().Component{constructor(e){super(e),this.handleChange=this.handleChange.bind(this)}componentDidUpdate(e,t,a){this.props.value!==e.value&&(this.input.value=this.props.value)}handleChange(e){this.props.onChange(e)}render(){let e=this.props,{onChange:t,value:a,className:r,error:l,ariaLabelledBy:i,containerClassName:c}=e,d=s()(e,u),m=this.props.hasOwnProperty("error")&&""!==l,p=this.props.hasOwnProperty("className")?r:"form-control",h=this.props.hasOwnProperty("containerClassName")?c:"container-form-control";return o().createElement("div",{className:h},o().createElement("input",n()({className:`${p} ${m?"error":""}`,ref:e=>{this.input=e},defaultValue:a,"aria-labelledby":i,onChange:this.handleChange},d)),m&&o().createElement("p",{className:"error-label"},l))}}c.defaultProps={ariaLabelledBy:null}},5028:(e,t,a)=>{a.d(t,{default:()=>c});var r=a(6031),n=a.n(r),l=a(2462),s=a.n(l),i=a(2015),o=a.n(i);const u=["children","replaceNewLine","className"],c=e=>{let{children:t,replaceNewLine:a=!1,className:r=""}=e,l=s()(e,u);return o().createElement("span",n()({className:r,dangerouslySetInnerHTML:{__html:a?null==t?void 0:t.replace(/\n/g,"<br />"):t}},l))}},9558:(e,t,a)=>{a.d(t,{toSlug:()=>r});a(5812),a(8041);const r=e=>(e=e.toLowerCase()).replace(/[^a-zA-Z0-9]+/g,"_")},356:(e,t,a)=>{a.d(t,{default:()=>h});var r=a(1116),n=a.n(r),l=a(9558);function s(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function i(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?s(Object(a),!0).forEach((function(t){n()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):s(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}const o="ComboBox",u="CheckBoxList",c="RadioButtonList",d=[o,u,c],m="And",p="Equal";class h{constructor(e,t=[]){n()(this,"_parseQuestion",(e=>{if(this.questionByName[(0,l.toSlug)(e.name)]=e,this.questionById[parseInt(e.id)]=e,e.hasOwnProperty("sub_question_rules"))for(let t of e.sub_question_rules)this.rules[parseInt(t.id)]=t,this._parseQuestion(t.sub_question)})),n()(this,"_parseQuestions",(()=>{for(let e of this.questions)this._parseQuestion(e)})),n()(this,"_allowsValues",(e=>d.includes(e.type))),n()(this,"_allowsValue",((e,t)=>{let a=t.value.split(",").map((e=>parseInt(e)));for(let t of a)if(!e.values.map((e=>e.id)).includes(t))return!1;return!0})),n()(this,"_getAnswerFor",(e=>{let t=Number.isInteger(e)?e:e.id,a=this.answers[t]||null;return a||null})),n()(this,"_hasValue",(e=>""!==e.value)),n()(this,"_answerContains",((e,t)=>e.value.split(",").includes(t))),n()(this,"_isSubQuestionVisible",(e=>{let t=e.answer_values_operator===m;const a=this._getAnswerFor(e.parent_question_id);if(a)switch(e.visibility_condition){case p:for(let r of e.answer_values)t=e.answer_values_operator===m?t&&this._answerContains(a,r):t||this._answerContains(a,r);break;case"NotEqual":for(let r of e.answer_values)t=e.answer_values_operator===m?t&&!this._answerContains(a,r):t||!this._answerContains(a,r)}else t=e.visibility_condition!==p;return"Visible"===e.visibility?t:!t})),n()(this,"_isAnswered",(e=>{const t=this._getAnswerFor(e);if("MainQuestion"===e.class)return!e.mandatory||!!t&&(!!this._hasValue(t)&&!(this._allowsValues(e)&&!this._allowsValue(e,t)));for(let a of e.parent_rules)if(this._isSubQuestionVisible(this.rules[a]))return!e.mandatory||!!t&&(!!this._hasValue(t)&&!(this._allowsValues(e)&&!this._allowsValue(e,t)));return!0})),n()(this,"_checkQuestion",(e=>{let t=this._isAnswered(e);if(e.hasOwnProperty("sub_question_rules"))for(let a of e.sub_question_rules)t=t&&this._checkQuestion(a.sub_question);return t})),n()(this,"_formatQuestionAnswer",(e=>{var t,a;let r={};const n=(0,l.toSlug)(e.name);let s=null===(t=this.originalAnswers.find((t=>t.question_id===e.id)))||void 0===t?void 0:t.value;if(!s&&(null==e||null===(a=e.values)||void 0===a?void 0:a.length)>0){const t=e.values.find((e=>e.is_default));t&&(s=t.id.toString())}if(s&&("CheckBox"===e.type&&(s="false"!==s&&!!s),e.type!==c&&e.type!==o||(s=parseInt(s)),e.type===u&&(s=s.split(",").map((e=>parseInt(e)))||[])),r[n]=s||"",e.type===u&&""===r[n]&&(r[n]=[]),e.hasOwnProperty("sub_question_rules"))for(let t of e.sub_question_rules){let e=this._formatQuestionAnswer(t.sub_question);r=i(i({},r),e)}return r})),n()(this,"formatAnswers",(()=>{let e={};return this.questions.forEach((t=>{let a=this._formatQuestionAnswer(t);e=i(i({},e),a)})),e})),n()(this,"completed",(()=>{let e=!0;for(let t of this.questions)e=e&&this._checkQuestion(t);return e})),n()(this,"getQuestionByName",(e=>{const t=(0,l.toSlug)(e);return this.questionByName[e]||this.questionByName[t]||null})),n()(this,"getQuestionById",(e=>this.questionById[parseInt(e)]||null)),this.questions=e,this.originalAnswers=t,this.answers=[];for(let e of this.originalAnswers)this.answers[e.question_id]=e;this.questionByName={},this.questionById={},this.rules={},this._parseQuestions()}}},1116:e=>{e.exports=require("@babel/runtime/helpers/defineProperty")},6031:e=>{e.exports=require("@babel/runtime/helpers/extends")},2462:e=>{e.exports=require("@babel/runtime/helpers/objectWithoutProperties")},1536:e=>{e.exports=require("awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css")},6842:e=>{e.exports=require("i18n-react/dist/i18n-react")},5812:e=>{e.exports=require("moment-timezone")},9825:e=>{e.exports=require("prop-types")},2015:e=>{e.exports=require("react")},8466:e=>{e.exports=require("react-select")},8041:e=>{e.exports=require("urijs")}},t={};function a(r){var n=t[r];if(void 0!==n)return n.exports;var l=t[r]={exports:{}};return e[r](l,l.exports,a),l.exports}(()=>{a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t}})(),(()=>{a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}})(),(()=>{a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var r={};a.r(r),a.d(r,{default:()=>B});var n=a(6031),l=a.n(n),s=a(2462),i=a.n(s),o=a(2015),u=a.n(o),c=a(9825),d=a.n(c),m=a(7651),p=a(6604),h=a(5639),b=a(7017),g=a(356);const f=require("react-final-form");var v=a(9558);const y="CheckBox",_="RadioButton";a(1536);const E=["input","meta","question","className","isDisabled","isRequired"],q=["input","meta","question","isDisabled","isRequired"],w=["input","meta","question","isDisabled","isRequired"],C=["input","meta","question","isDisabled","isRequired","maxValues"],S=e=>{let{input:t,meta:a,question:r,className:n,isDisabled:s,isRequired:o}=e,c=i()(e,E);return u().createElement(m.default,l()({},t,c,{containerClassName:n,name:(0,v.toSlug)(r.name),ariaLabelledBy:`${(0,v.toSlug)(r.name)} label`,id:(0,v.toSlug)(r.name),value:t.value,disabled:s,required:o,onChange:t.onChange,placeholder:r.placeholder}))},N=e=>{let{input:t,meta:a,question:r,isDisabled:n,isRequired:s}=e,o=i()(e,q);return u().createElement(h.default,l()({},t,o,{name:(0,v.toSlug)(r.name),ariaLabelledBy:`${(0,v.toSlug)(r.name)} label`,id:(0,v.toSlug)(r.name),overrideCSS:!0,value:t.value,disabled:n,required:s,onChange:t.onChange}))},k=e=>{let{input:t,meta:a,question:r,isDisabled:n,isRequired:s}=e,o=i()(e,w);return u().createElement(p.default,l()({},t,o,{name:(0,v.toSlug)(r.name),ariaLabelledBy:`${(0,v.toSlug)(r.name)} label`,id:(0,v.toSlug)(r.name),overrideCSS:!0,className:"ddl-extra-questions-container",classNamePrefix:"ddl-extra-questions",value:t.value,disabled:n,required:s,onChange:t.onChange}))},x=e=>{let{input:t,meta:a,question:r,isDisabled:n,isRequired:s,maxValues:o}=e,c=i()(e,C);return u().createElement(b.default,l()({},t,c,{id:(0,v.toSlug)(r.name),name:(0,v.toSlug)(r.name),ariaLabelledBy:`${(0,v.toSlug)(r.name)} label`,value:t.value,disabled:n,required:s,onChange:e=>{const a=e.target.value;return o>0&&a.length>o?null:t.onChange(e)}}))},O=e=>e?e=>e?void 0:"Required":()=>{},P=u().forwardRef((({extraQuestions:e,userAnswers:t,onAnswerChanges:a,className:r="questions-form",questionContainerClassName:n="question-container",questionLabelContainerClassName:l="question-label-container",questionControlContainerClassName:s="question-control-container",readOnly:i=!1,debug:c=!1,buttonText:d="Submit",RequiredErrorMessage:m="Required",ValidationErrorClassName:p="extra-question-error",allowExtraQuestionsEdit:h=!0,onError:b=e=>console.log("form errors: ",e),shouldScroll2FirstError:E=!0},q)=>{let w=null;const C=(0,o.useRef)({}),P=(0,o.useRef)(null),[B,L]=(0,o.useState)({});(0,o.useEffect)((()=>{F()}),[e]),(0,o.useImperativeHandle)(q,(()=>({doSubmit(){var e;null===(e=P.current)||void 0===e||e.dispatchEvent(new Event("submit",{cancelable:!0,bubbles:!0}))},scroll2QuestionById(e){H(e)}})));const j=e=>(C.current[e]||(C.current[e]=u().createRef()),C.current[e]),F=()=>{const a=new g.default(e,t);L(a.formatAnswers())},$=({when:e,rule:t,children:a})=>u().createElement(f.Field,{name:e,subscription:{value:!0}},(({input:{value:e}})=>D(t,A(e,t),a))),R=({name:e})=>u().createElement(f.Field,{name:e,subscription:{error:!0,touched:!0,submitFailed:!0}},(({meta:{error:e,touched:t,submitFailed:a}})=>e&&(t||a)?u().createElement("div",{className:p},e):null)),A=(e,t)=>{let a=t.answer_values;if(Array.isArray(e)){if(!e.length)return!1;let r="And"===t.answer_values_operator;return a.forEach((a=>{r="And"===t.answer_values_operator?r&&e.includes(parseInt(a)):r||e.includes(parseInt(a))})),r}return a.includes(e.toString())},D=(e,t,a)=>"Visible"===e.visibility?"Equal"===e.visibility_condition?t?a:(delete C.current[e.sub_question.id],null):t?(delete C.current[e.sub_question.id],null):a:"Equal"===e.visibility_condition?t?(delete C.current[e.sub_question.id],null):a:t?a:(delete C.current[e.sub_question.id],null),I=e=>{var t;const a=String.fromCharCode(160),r=null==e||null===(t=e.label)||void 0===t?void 0:t.replace(/\n/g,"<br />").replace(/<p>(.*)<\/p>/gi,"$1"),n=[y,_],l=e.mandatory&&!n.includes(e.type)?`${r}${a}<b>*</b>`:r;return u().createElement("label",{dangerouslySetInnerHTML:{__html:l},htmlFor:(0,v.toSlug)(e.name),id:`${(0,v.toSlug)(e.name)} label`})},Q=e=>{let t=e.values;const a=!h&&((e,t)=>{const a=(0,v.toSlug)(e.name);if(!t.hasOwnProperty(a))return!1;const r=t[a];return Array.isArray(r)||"string"==typeof r?r.length>0:"number"==typeof r?r>0:"boolean"==typeof r&&r})(e,B);var r,i,c,d;if("Text"===e.type)return u().createElement(o.Fragment,{key:(0,v.toSlug)(e.name)},u().createElement("div",{ref:j(e.id),className:n},u().createElement("span",{className:l},I(e)),u().createElement("div",{className:s},u().createElement(f.Field,{name:(0,v.toSlug)(e.name),question:e,isDisabled:a,isRequired:e.mandatory,validate:O(e.mandatory),component:S}),u().createElement(R,{name:(0,v.toSlug)(e.name)}))),(null===(r=e.sub_question_rules)||void 0===r?void 0:r.length)>0&&e.sub_question_rules.map((t=>u().createElement($,{key:t.id,when:(0,v.toSlug)(e.name),rule:t},Q(t.sub_question)))));if("TextArea"===e.type)return u().createElement(o.Fragment,{key:(0,v.toSlug)(e.name)},u().createElement("div",{ref:j(e.id),className:n},u().createElement("span",{className:l},I(e)),u().createElement("div",{className:s},u().createElement(f.Field,{validate:O(e.mandatory),name:(0,v.toSlug)(e.name),id:(0,v.toSlug)(e.name),disabled:a,required:e.mandatory,component:"textarea"}),u().createElement(R,{name:(0,v.toSlug)(e.name)}))),(null===(i=e.sub_question_rules)||void 0===i?void 0:i.length)>0&&e.sub_question_rules.map((t=>u().createElement($,{key:t.id,when:(0,v.toSlug)(e.name),rule:t},Q(t.sub_question)))));if(e.type===y)return u().createElement(o.Fragment,{key:(0,v.toSlug)(e.name)},u().createElement("div",{ref:j(e.id),className:`${n} checkbox-wrapper`},u().createElement("div",{className:`${s} input-wrapper`},u().createElement("div",{className:"form-check abc-checkbox"},u().createElement(f.Field,{name:(0,v.toSlug)(e.name),id:(0,v.toSlug)(e.name),validate:O(e.mandatory),disabled:a,required:e.mandatory,type:"checkbox",className:"form-check-input",component:"input"}),u().createElement("label",{className:"form-check-label",htmlFor:(0,v.toSlug)(e.name)}),e.mandatory&&u().createElement("span",{className:"checkbox-mandatory"},u().createElement("b",null,"*")))),u().createElement("span",{className:`eq-checkbox-label ${l}`},I(e))),u().createElement(R,{name:(0,v.toSlug)(e.name)}),(null===(c=e.sub_question_rules)||void 0===c?void 0:c.length)>0&&e.sub_question_rules.map((t=>u().createElement($,{key:t.id,when:(0,v.toSlug)(e.name),rule:t},Q(t.sub_question)))));if(e.type===_)return u().createElement(o.Fragment,{key:(0,v.toSlug)(e.name)},u().createElement("div",{ref:j(e.id),className:`${n} checkbox-wrapper`},u().createElement("div",{className:`${s} input-wrapper`},u().createElement("div",{className:"form-check abc-radio"},u().createElement(f.Field,{name:(0,v.toSlug)(e.name),id:(0,v.toSlug)(e.name),validate:O(e.mandatory),disabled:a,required:e.mandatory,type:"radio",className:"form-check-input",value:"true",component:"input"}),u().createElement("label",{className:"form-check-label",htmlFor:(0,v.toSlug)(e.name)}),e.mandatory&&u().createElement("span",{className:"checkbox-mandatory"},u().createElement("b",null,"*")))),u().createElement("span",{className:`eq-checkbox-label ${l}`},I(e))),u().createElement(R,{name:(0,v.toSlug)(e.name)}),(null===(d=e.sub_question_rules)||void 0===d?void 0:d.length)>0&&e.sub_question_rules.map((t=>u().createElement($,{key:t.id,when:(0,v.toSlug)(e.name),rule:t},Q(t.sub_question)))));if("RadioButtonList"===e.type){var m;const r=t.map((e=>({label:e.label,value:e.id})));return u().createElement(o.Fragment,{key:(0,v.toSlug)(e.name)},u().createElement("div",{ref:j(e.id),className:n},u().createElement("span",{className:l},I(e)),u().createElement("div",{className:s},u().createElement(f.Field,{name:(0,v.toSlug)(e.name),options:r,question:e,validate:O(e.mandatory),isDisabled:a,isRequired:e.mandatory,component:N}),u().createElement(R,{name:(0,v.toSlug)(e.name)}))),(null===(m=e.sub_question_rules)||void 0===m?void 0:m.length)>0&&e.sub_question_rules.map((t=>u().createElement($,{key:t.id,when:(0,v.toSlug)(e.name),rule:t},Q(t.sub_question)))))}if("ComboBox"===e.type||"CountryComboBox"===e.type){var p;const r=t.map((e=>({label:e.label,value:e.id})));return u().createElement(o.Fragment,{key:(0,v.toSlug)(e.name)},u().createElement("div",{ref:j(e.id),className:n},u().createElement("span",{className:l},I(e)),u().createElement("div",{className:`${s} reactSelectDropdown`},u().createElement(f.Field,{name:(0,v.toSlug)(e.name),options:r,question:e,validate:O(e.mandatory),isDisabled:a,isRequired:e.mandatory,component:k}),u().createElement(R,{name:(0,v.toSlug)(e.name)}))),(null===(p=e.sub_question_rules)||void 0===p?void 0:p.length)>0&&e.sub_question_rules.map((t=>u().createElement($,{key:t.id,when:(0,v.toSlug)(e.name),rule:t},Q(t.sub_question)))))}if("CheckBoxList"===e.type){var b;const r=t.map((e=>({label:e.label,value:e.id})));return u().createElement(o.Fragment,{key:(0,v.toSlug)(e.name)},u().createElement("div",{ref:j(e.id),className:n},u().createElement("span",{className:l},I(e)),u().createElement("div",{className:s},u().createElement(f.Field,{name:(0,v.toSlug)(e.name),className:s,validate:O(e.mandatory),options:r,question:e,maxValues:e.max_selected_values,isDisabled:a,isRequired:e.mandatory,component:x}),u().createElement(R,{name:(0,v.toSlug)(e.name)}))),(null===(b=e.sub_question_rules)||void 0===b?void 0:b.length)>0&&e.sub_question_rules.map((t=>u().createElement($,{key:t.id,when:(0,v.toSlug)(e.name),rule:t},Q(t.sub_question)))))}return null},V=(e,t,a)=>{var r;if(e.mandatory&&(e=>!!C.current[e.id])(e)){const r=(0,v.toSlug)(e.name);t.hasOwnProperty((0,v.toSlug)(r))&&""!==t[(0,v.toSlug)(r)]&&0!==t[r].length||(a[r]=m)}null===(r=e.sub_question_rules)||void 0===r||r.forEach((e=>{V(e.sub_question,t,a)}))};if(!Object.keys(B).length)return null;const T=(e,t,a)=>{var r;t.includes((0,v.toSlug)(e.name))&&a.push(e),null===(r=e.sub_question_rules)||void 0===r||r.forEach((e=>{T(e.sub_question,t,a)}))},M=t=>{const a=[];return e.forEach((e=>{T(e,t,a)})),a.sort(((e,t)=>e.order>t.order))[0]},H=e=>{const t=C.current[e];t&&t.current&&(t.current.focus(),t.current.scrollIntoView({behavior:"smooth",block:"center"}))};return Object.keys(B).length?u().createElement("div",{className:r},u().createElement(f.Form,{validate:t=>{const a={};return e.forEach((e=>{V(e,t,a)})),a},onSubmit:e=>{a(e)},initialValues:B},(({handleSubmit:t,form:a,submitting:r,pristine:n,values:l})=>(w=t,u().createElement("form",{onSubmit:e=>{const r=a.getRegisteredFields().filter((e=>a.getFieldState(e).invalid));if(r.length>0){const e=M(r);b(r,C.current[e.id],e.id),E&&(e=>{const t=M(e);t&&H(t.id)})(r)}t(e)},ref:P},i?u().createElement("fieldset",{disabled:"disabled"},e.map((e=>Q(e)))):e.map((e=>Q(e))),c&&u().createElement("pre",null,JSON.stringify(l,0,2)))))),!q&&u().createElement("button",{type:"submit",onClick:e=>{w(e)},style:{marginTop:10}},d)):null}));P.propTypes={extraQuestions:d().array.isRequired,userAnswers:d().array.isRequired,onAnswerChanges:d().func.isRequired,className:d().string,debug:d().bool,buttonText:d().string,questionContainerClassName:d().string,questionLabelContainerClassName:d().string,questionControlContainerClassName:d().string,RequiredErrorMessage:d().string,ValidationErrorClassName:d().string,allowExtraQuestionsEdit:d().bool,shouldScroll2FirstError:d().bool,readOnly:d().bool};const B=P;return r})()));
2
2
  //# sourceMappingURL=extra-questions.js.map