WordPress Charts and Graphs Lite - Version 3.9.0

Version Description

Download this release

Release Info

Developer themeisle
Plugin Icon WordPress Charts and Graphs Lite
Version 3.9.0
Comparing to
See all releases

Code changes from version 3.8.1 to 3.9.0

CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
 
 
 
 
 
 
 
 
 
1
  ##### [Version 3.8.1](https://github.com/Codeinwp/visualizer/compare/v3.8.0...v3.8.1) (2022-10-12)
2
 
3
 
1
+ #### [Version 3.9.0](https://github.com/Codeinwp/visualizer/compare/v3.8.1...v3.9.0) (2022-11-10)
2
+
3
+ - Fixed table chart decimal number issue Decimal Numbers are ignored and not displayed [#955](https://github.com/Codeinwp/visualizer/issues/955)
4
+ - Fix the scrollbar issue that happens on WP 6.1 version [WP 6.1] Chart permissions selector is not scrollable [#950](https://github.com/Codeinwp/visualizer/issues/950)
5
+ - Fix PHP Warning Warning when copy (frontend action) is enabled [#949](https://github.com/Codeinwp/visualizer/issues/949)
6
+ - Compatibility with the WPML translation plugin for translating charts [PRO feature] add support for string translations [#731](https://github.com/Codeinwp/visualizer/issues/731)
7
+ - Integration with Woocommerce Data endpoints for creating charts [PRO feature]
8
+ - Show new features on chart library page
9
+
10
  ##### [Version 3.8.1](https://github.com/Codeinwp/visualizer/compare/v3.8.0...v3.8.1) (2022-10-12)
11
 
12
 
classes/Visualizer/Gutenberg/build/block.css CHANGED
@@ -1,2 +1,2 @@
1
- .visualizer-settings{background-color:#f8f9f9;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;position:relative}.visualizer-settings .visualizer-settings__title{margin:0;padding:1.5rem 0;text-align:center;border-bottom:1px solid #e6eaee}.visualizer-settings .visualizer-settings__title .dashicon{vertical-align:top;margin-right:.25em}.visualizer-settings .visualizer-settings__content{padding:2.5em 0}.visualizer-settings .visualizer-settings__content .visualizer-settings__content-description{margin:0 0 1.5em 0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:18px;text-align:center}.visualizer-settings .visualizer-settings__content .visualizer-settings__content-option{display:flex;align-items:flex-start;flex-wrap:wrap;margin:0 auto;padding:1.25em 1.5em;max-width:80%;background:#fff;border-width:1px 1px 0;border-style:solid;border-color:#e6eaee;cursor:pointer}.visualizer-settings .visualizer-settings__content .visualizer-settings__content-option.locked{cursor:default}.visualizer-settings .visualizer-settings__content .visualizer-settings__content-option.locked:hover{background:#ffffff}.visualizer-settings .visualizer-settings__content .visualizer-settings__content-option:hover{background:#f5f5f5}.visualizer-settings .visualizer-settings__content .visualizer-settings__content-option:last-of-type{border-bottom-width:1px}.visualizer-settings .visualizer-settings__content .visualizer-settings__content-option .visualizer-settings__content-option-title{max-width:80%;display:block;font-size:1.25em}.visualizer-settings .visualizer-settings__content .visualizer-settings__content-option .visualizer-settings__content-option-icon{align-self:center;margin-left:auto;color:#b9bcc2}.visualizer-settings .visualizer-settings__content .visualizer-settings__content-option .visualizer-settings__content-option-icon .dashicon{height:25px;width:25px}.visualizer-settings .visualizer-settings__charts{text-align:center;padding-bottom:25px}.visualizer-settings .visualizer-settings__charts .visualizer-settings__charts-grid{display:grid;grid-template-columns:50% 50%}.visualizer-settings .visualizer-settings__charts .visualizer-settings__charts-grid .visualizer-settings__charts-single{margin:25px;padding-bottom:50px;background-color:#efefef;position:relative}.visualizer-settings .visualizer-settings__charts .visualizer-settings__charts-grid .visualizer-settings__charts-single .visualizer-settings__charts-title{padding:10px;font-weight:bold;text-align:center}.visualizer-settings .visualizer-settings__charts .visualizer-settings__charts-grid .visualizer-settings__charts-single .visualizer-settings__charts-footer{font-size:small}.visualizer-settings .visualizer-settings__charts .visualizer-settings__charts-grid .visualizer-settings__charts-single .visualizer-settings__charts-controls{width:100%;position:absolute;bottom:0;padding:10px;font-weight:bold;text-align:center;cursor:pointer}.visualizer-settings .visualizer-settings__charts .dataTables_wrapper{background:#fff;padding:10px}.visualizer-settings .visualizer-settings__charts .visualizer-no-charts{padding-top:25px}.visualizer-settings .visualizer-settings__chart{text-align:center}.visualizer-settings .visualizer-settings__chart .dataTables_wrapper{background:#fff;padding:10px}.visualizer-settings .visualizer-settings__controls{margin:0;padding:1.5rem 0;text-align:center;border-top:1px solid #e6eaee}.visualizer-advanced-panel.components-panel__body.is-opened>.components-panel__body-title{margin-bottom:0}.visualizer-inner-sections{background:#f8f9f9}.visualizer-inner-sections .components-panel__body-toggle:hover{background:#EEEEEE}.visualizer-inner-sections ul.visualizer-list{list-style:disc;margin-left:15px}.components-panel__body-button .components-panel__body-toggle.components-button .dashicons-admin-tools{margin:-2px 6px -2px 0}.components-panel__body-button .components-panel__body-toggle.components-button .dashicons-admin-users{margin:-2px 6px -2px 0}.components-panel__body-button .components-panel__body-toggle.components-button .components-panel__arrow{width:48px;height:48px;right:0;border-top:1px solid #ddd;transform:translateY(-50%) rotate(270deg)}.components-panel__body-button.visualizer-panel-back .components-panel__body-title{background:#f3f3f3}.components-panel__body-button.visualizer-panel-back .components-panel__body-title:hover{background:#f3f3f3}.components-panel__body-button.visualizer-panel-back .components-panel__body-title .components-panel__body-toggle{margin:10px 0;background:#fff}.components-panel__body-button.visualizer-panel-back .components-panel__body-title .components-panel__body-toggle.components-button{padding-left:60px}.components-panel__body-button.visualizer-panel-back .components-panel__body-title .components-panel__body-toggle.components-button:hover .components-panel__arrow{background:#f3f3f3;border-width:1px 1px 0 1px;border-color:#ddd;border-style:solid}.components-panel__body-button.visualizer-panel-back .components-panel__body-title .components-panel__body-toggle.components-button .components-panel__arrow{left:0;transform:translateY(-50%) rotate(90deg)}.visualizer-chart-editor{max-width:100%;margin:25px 25px 0}.visualizer-chart-editor .htEditor{margin-bottom:20px}.visualizer-chart-editor .htEditor .htRowHeaders{height:auto !important;width:auto !important}.visualizer-chart-editor .htEditor .ht_master .wtHolder{height:auto !important;width:auto !important}.visualizer-json-query-modal .components-modal__content{padding-left:0;padding-right:0}.visualizer-json-query-modal .components-modal__content .components-modal__header{margin:0}.visualizer-json-query-modal .components-icon-button{margin:10px 0}.visualizer-json-query-modal .visualizer-json-query-modal-headers-panel{padding:0 0 1em 2.2em}.visualizer-json-query-modal .visualizer-json-query-modal-headers-panel .components-base-control{display:inline-block}.visualizer-json-query-modal .visualizer-json-query-modal-headers-panel .visualizer-json-query-modal-field-separator{padding:0 10px}.visualizer-json-query-modal .viz-editor-table tbody tr:first-child{background-color:#ececec !important}.visualizer-json-query-modal .viz-editor-table tr th{background-color:#cccccc}.visualizer-json-query-modal .viz-editor-table thead tr th:nth-child(n+1){cursor:move !important}.visualizer-json-query-modal #visualizer-json-query-table{margin-bottom:10px}.visualizer-json-query-modal ul{list-style:disc;margin-left:10px}.visualizer-db-query-modal .CodeMirror-scroll{overflow:hidden !important;height:50%;margin:0;padding:0}.visualizer-db-query-modal .CodeMirror-wrap{height:200px;padding:15px;color:#fff;background:#282923;font-size:15px;margin-bottom:20px}.visualizer-db-query-modal .CodeMirror-wrap .CodeMirror-cursor{border-left:1px solid #fff !important}.visualizer-db-query-modal .CodeMirror-wrap .CodeMirror-placeholder{color:#fff}.visualizer-db-query-modal .CodeMirror-wrap pre{color:#fff !important}.visualizer-db-query-modal .CodeMirror-wrap .cm-keyword{color:#f92472 !important}.visualizer-db-query-modal .CodeMirror-wrap .cm-comment{color:#74705d !important}.visualizer-db-query-modal .CodeMirror-wrap .cm-number{color:#fff !important}.visualizer-db-query-modal .CodeMirror-wrap .cm-string{color:#fff !important}.visualizer-db-query-modal ul{list-style:disc;margin-left:10px}.visualizer-db-query-modal .db-wizard-error{color:#f00}.visualizer-db-query-modal .visualizer-db-query-actions .components-button:first-child{margin-right:10px}.htContextMenu:not(.htGhostTable){z-index:999999}.htDatepickerHolder,.CodeMirror-hints,.DTCR_clonedTable,.DTCR_pointer{z-index:999999 !important}.components-panel .components-select-control{height:auto !important}@media (min-width: 768px){.visualizer-json-query-modal{width:668px}.visualizer-db-query-modal .CodeMirror-wrap{min-width:550px}}@media (max-width: 768px){.visualizer-settings .visualizer-settings__charts .visualizer-settings__charts-grid{display:grid;grid-template-columns:100%}}
2
 
1
+ .visualizer-settings{background-color:#f8f9f9;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;position:relative}.visualizer-settings .visualizer-settings__title{margin:0;padding:1.5rem 0;text-align:center;border-bottom:1px solid #e6eaee}.visualizer-settings .visualizer-settings__title .dashicon{vertical-align:top;margin-right:.25em}.visualizer-settings .visualizer-settings__content{padding:2.5em 0}.visualizer-settings .visualizer-settings__content .visualizer-settings__content-description{margin:0 0 1.5em 0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:18px;text-align:center}.visualizer-settings .visualizer-settings__content .visualizer-settings__content-option{display:flex;align-items:flex-start;flex-wrap:wrap;margin:0 auto;padding:1.25em 1.5em;max-width:80%;background:#fff;border-width:1px 1px 0;border-style:solid;border-color:#e6eaee;cursor:pointer}.visualizer-settings .visualizer-settings__content .visualizer-settings__content-option.locked{cursor:default}.visualizer-settings .visualizer-settings__content .visualizer-settings__content-option.locked:hover{background:#ffffff}.visualizer-settings .visualizer-settings__content .visualizer-settings__content-option:hover{background:#f5f5f5}.visualizer-settings .visualizer-settings__content .visualizer-settings__content-option:last-of-type{border-bottom-width:1px}.visualizer-settings .visualizer-settings__content .visualizer-settings__content-option .visualizer-settings__content-option-title{max-width:80%;display:block;font-size:1.25em}.visualizer-settings .visualizer-settings__content .visualizer-settings__content-option .visualizer-settings__content-option-icon{align-self:center;margin-left:auto;color:#b9bcc2}.visualizer-settings .visualizer-settings__content .visualizer-settings__content-option .visualizer-settings__content-option-icon .dashicon{height:25px;width:25px}.visualizer-settings .visualizer-settings__charts{text-align:center;padding-bottom:25px}.visualizer-settings .visualizer-settings__charts .visualizer-settings__charts-grid{display:grid;grid-template-columns:50% 50%}.visualizer-settings .visualizer-settings__charts .visualizer-settings__charts-grid .visualizer-settings__charts-single{margin:25px;padding-bottom:50px;background-color:#efefef;position:relative}.visualizer-settings .visualizer-settings__charts .visualizer-settings__charts-grid .visualizer-settings__charts-single .visualizer-settings__charts-title{padding:10px;font-weight:bold;text-align:center}.visualizer-settings .visualizer-settings__charts .visualizer-settings__charts-grid .visualizer-settings__charts-single .visualizer-settings__charts-footer{font-size:small}.visualizer-settings .visualizer-settings__charts .visualizer-settings__charts-grid .visualizer-settings__charts-single .visualizer-settings__charts-controls{width:100%;position:absolute;bottom:0;padding:10px;font-weight:bold;text-align:center;cursor:pointer}.visualizer-settings .visualizer-settings__charts .dataTables_wrapper{background:#fff;padding:10px}.visualizer-settings .visualizer-settings__charts .visualizer-no-charts{padding-top:25px}.visualizer-settings .visualizer-settings__chart{text-align:center}.visualizer-settings .visualizer-settings__chart .dataTables_wrapper{background:#fff;padding:10px}.visualizer-settings .visualizer-settings__controls{margin:0;padding:1.5rem 0;text-align:center;border-top:1px solid #e6eaee}.visualizer-advanced-panel.components-panel__body.is-opened>.components-panel__body-title{margin-bottom:0}.visualizer-inner-sections{background:#f8f9f9}.visualizer-inner-sections .components-panel__body-toggle:hover{background:#EEEEEE}.visualizer-inner-sections ul.visualizer-list{list-style:disc;margin-left:15px}.components-panel__body-button .components-panel__body-toggle.components-button .dashicons-admin-tools{margin:-2px 6px -2px 0}.components-panel__body-button .components-panel__body-toggle.components-button .dashicons-admin-users{margin:-2px 6px -2px 0}.components-panel__body-button .components-panel__body-toggle.components-button .components-panel__arrow{width:48px;height:48px;right:0;border-top:1px solid #ddd;transform:translateY(-50%) rotate(270deg)}.components-panel__body-button.visualizer-panel-back .components-panel__body-title{background:#f3f3f3}.components-panel__body-button.visualizer-panel-back .components-panel__body-title:hover{background:#f3f3f3}.components-panel__body-button.visualizer-panel-back .components-panel__body-title .components-panel__body-toggle{margin:10px 0;background:#fff}.components-panel__body-button.visualizer-panel-back .components-panel__body-title .components-panel__body-toggle.components-button{padding-left:60px}.components-panel__body-button.visualizer-panel-back .components-panel__body-title .components-panel__body-toggle.components-button:hover .components-panel__arrow{background:#f3f3f3;border-width:1px 1px 0 1px;border-color:#ddd;border-style:solid}.components-panel__body-button.visualizer-panel-back .components-panel__body-title .components-panel__body-toggle.components-button .components-panel__arrow{left:0;transform:translateY(-50%) rotate(90deg)}.visualizer-chart-editor{max-width:100%;margin:25px 25px 0}.visualizer-chart-editor .htEditor{margin-bottom:20px}.visualizer-chart-editor .htEditor .htRowHeaders{height:auto !important;width:auto !important}.visualizer-chart-editor .htEditor .ht_master .wtHolder{height:auto !important;width:auto !important}.visualizer-json-query-modal .components-modal__content{padding-left:0;padding-right:0}.visualizer-json-query-modal .components-modal__content .components-modal__header{margin:0}.visualizer-json-query-modal .components-icon-button{margin:10px 0}.visualizer-json-query-modal .visualizer-json-query-modal-headers-panel{padding:0 0 1em 2.2em}.visualizer-json-query-modal .visualizer-json-query-modal-headers-panel .components-base-control{display:inline-block}.visualizer-json-query-modal .visualizer-json-query-modal-headers-panel .visualizer-json-query-modal-field-separator{padding:0 10px}.visualizer-json-query-modal .viz-editor-table tbody tr:first-child{background-color:#ececec !important}.visualizer-json-query-modal .viz-editor-table tr th{background-color:#cccccc}.visualizer-json-query-modal .viz-editor-table thead tr th:nth-child(n+1){cursor:move !important}.visualizer-json-query-modal #visualizer-json-query-table{margin-bottom:10px}.visualizer-json-query-modal ul{list-style:disc;margin-left:10px}.visualizer-db-query-modal .CodeMirror-scroll{overflow:hidden !important;height:50%;margin:0;padding:0}.visualizer-db-query-modal .CodeMirror-wrap{height:200px;padding:15px;color:#fff;background:#282923;font-size:15px;margin-bottom:20px}.visualizer-db-query-modal .CodeMirror-wrap .CodeMirror-cursor{border-left:1px solid #fff !important}.visualizer-db-query-modal .CodeMirror-wrap .CodeMirror-placeholder{color:#fff}.visualizer-db-query-modal .CodeMirror-wrap pre{color:#fff !important}.visualizer-db-query-modal .CodeMirror-wrap .cm-keyword{color:#f92472 !important}.visualizer-db-query-modal .CodeMirror-wrap .cm-comment{color:#74705d !important}.visualizer-db-query-modal .CodeMirror-wrap .cm-number{color:#fff !important}.visualizer-db-query-modal .CodeMirror-wrap .cm-string{color:#fff !important}.visualizer-db-query-modal ul{list-style:disc;margin-left:10px}.visualizer-db-query-modal .db-wizard-error{color:#f00}.visualizer-db-query-modal .visualizer-db-query-actions .components-button:first-child{margin-right:10px}.htContextMenu:not(.htGhostTable){z-index:999999}.htDatepickerHolder,.CodeMirror-hints,.DTCR_clonedTable,.DTCR_pointer{z-index:999999 !important}.vz-permission-tab select.components-select-control__input{overflow:auto !important}.components-panel .components-select-control{height:auto !important}@media (min-width: 768px){.visualizer-json-query-modal{width:668px}.visualizer-db-query-modal .CodeMirror-wrap{min-width:550px}}@media (max-width: 768px){.visualizer-settings .visualizer-settings__charts .visualizer-settings__charts-grid{display:grid;grid-template-columns:100%}}
2
 
classes/Visualizer/Gutenberg/build/block.js CHANGED
@@ -66,4 +66,4 @@ object-assign
66
  *
67
  * This source code is licensed under the MIT license found in the
68
  * LICENSE file in the root directory of this source tree.
69
- */class Cc extends r.Component{constructor(e){super(e),this.updateInternalProps=this.updateInternalProps.bind(this),this.createMarkup=this.createMarkup.bind(this),this.onClick=this.onClick.bind(this),this.onBlur=this.onBlur.bind(this),this.update=this.update.bind(this),this.getCursorPosition=this.getCursorPosition.bind(this),this.setCursorPosition=this.setCursorPosition.bind(this),this.scheduledUpdate=this.scheduledUpdate.bind(this),this.setUpdateTime=this.setUpdateTime.bind(this),this.renderLabels=this.renderLabels.bind(this),this.newSpan=this.newSpan.bind(this),this.renderErrorMessage=this.renderErrorMessage.bind(this),this.onScroll=this.onScroll.bind(this),this.showPlaceholder=this.showPlaceholder.bind(this),this.tokenize=this.tokenize.bind(this),this.onKeyPress=this.onKeyPress.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onPaste=this.onPaste.bind(this),this.stopEvent=this.stopEvent.bind(this),this.refContent=null,this.refLabels=null,this.updateInternalProps(),this.renderCount=1,this.state={prevPlaceholder:"",markupText:"",plainText:"",json:"",jsObject:void 0,lines:!1,error:!1},this.props.locale||console.warn("[react-json-editor-ajrm - Deprecation Warning] You did not provide a 'locale' prop for your JSON input - This will be required in a future version. English has been set as a default.")}updateInternalProps(){let e={},t={},n=Sc.dark_vscode_tribute;"theme"in this.props&&"string"==typeof this.props.theme&&this.props.theme in Sc&&(n=Sc[this.props.theme]),e=n,"colors"in this.props&&(e={default:"default"in this.props.colors?this.props.colors.default:e.default,string:"string"in this.props.colors?this.props.colors.string:e.string,number:"number"in this.props.colors?this.props.colors.number:e.number,colon:"colon"in this.props.colors?this.props.colors.colon:e.colon,keys:"keys"in this.props.colors?this.props.colors.keys:e.keys,keys_whiteSpace:"keys_whiteSpace"in this.props.colors?this.props.colors.keys_whiteSpace:e.keys_whiteSpace,primitive:"primitive"in this.props.colors?this.props.colors.primitive:e.primitive,error:"error"in this.props.colors?this.props.colors.error:e.error,background:"background"in this.props.colors?this.props.colors.background:e.background,background_warning:"background_warning"in this.props.colors?this.props.colors.background_warning:e.background_warning}),this.colors=e,t="style"in this.props?{outerBox:"outerBox"in this.props.style?this.props.style.outerBox:{},container:"container"in this.props.style?this.props.style.container:{},warningBox:"warningBox"in this.props.style?this.props.style.warningBox:{},errorMessage:"errorMessage"in this.props.style?this.props.style.errorMessage:{},body:"body"in this.props.style?this.props.style.body:{},labelColumn:"labelColumn"in this.props.style?this.props.style.labelColumn:{},labels:"labels"in this.props.style?this.props.style.labels:{},contentBox:"contentBox"in this.props.style?this.props.style.contentBox:{}}:{outerBox:{},container:{},warningBox:{},errorMessage:{},body:{},labelColumn:{},labels:{},contentBox:{}},this.style=t,this.confirmGood=!("confirmGood"in this.props)||this.props.confirmGood;const r=this.props.height||"610px",a=this.props.width||"479px";this.totalHeight=r,this.totalWidth=a,!("onKeyPressUpdate"in this.props)||this.props.onKeyPressUpdate?this.timer||(this.timer=setInterval(this.scheduledUpdate,100)):this.timer&&(clearInterval(this.timer),this.timer=!1),this.updateTime=!1,this.waitAfterKeyPress="waitAfterKeyPress"in this.props?this.props.waitAfterKeyPress:1e3,this.resetConfiguration="reset"in this.props&&this.props.reset}render(){const e=this.props.id,t=this.state.markupText,n=this.props.error||this.state.error,r=this.colors,o=this.style,i=this.confirmGood,s=this.totalHeight,l=this.totalWidth,u=!!this.props.error||!!n&&"token"in n;return this.renderCount++,a.a.createElement("div",{name:"outer-box",id:e&&e+"-outer-box",style:Dc({display:"block",overflow:"none",height:s,width:l,margin:0,boxSizing:"border-box",position:"relative"},o.outerBox)},i?a.a.createElement("div",{style:{opacity:u?0:1,height:"30px",width:"30px",position:"absolute",top:0,right:0,transform:"translate(-25%,25%)",pointerEvents:"none",transitionDuration:"0.2s",transitionTimingFunction:"cubic-bezier(0, 1, 0.5, 1)"}},a.a.createElement("svg",{height:"30px",width:"30px",viewBox:"0 0 100 100"},a.a.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",fill:"green",opacity:"0.85",d:"M39.363,79L16,55.49l11.347-11.419L39.694,56.49L72.983,23L84,34.085L39.363,79z"}))):void 0,a.a.createElement("div",{name:"container",id:e&&e+"-container",style:Dc({display:"block",height:s,width:l,margin:0,boxSizing:"border-box",overflow:"hidden",fontFamily:"Roboto, sans-serif"},o.container),onClick:this.onClick},a.a.createElement("div",{name:"warning-box",id:e&&e+"-warning-box",style:Dc({display:"block",overflow:"hidden",height:u?"60px":"0px",width:"100%",margin:0,backgroundColor:r.background_warning,transitionDuration:"0.2s",transitionTimingFunction:"cubic-bezier(0, 1, 0.5, 1)"},o.warningBox),onClick:this.onClick},a.a.createElement("span",{style:{display:"inline-block",height:"60px",width:"60px",margin:0,boxSizing:"border-box",overflow:"hidden",verticalAlign:"top",pointerEvents:"none"},onClick:this.onClick},a.a.createElement("div",{style:{position:"relative",top:0,left:0,height:"60px",width:"60px",margin:0,pointerEvents:"none"},onClick:this.onClick},a.a.createElement("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",pointerEvents:"none"},onClick:this.onClick},a.a.createElement("svg",{height:"25px",width:"25px",viewBox:"0 0 100 100"},a.a.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",fill:"red",d:"M73.9,5.75c0.467-0.467,1.067-0.7,1.8-0.7c0.7,0,1.283,0.233,1.75,0.7l16.8,16.8 c0.467,0.5,0.7,1.084,0.7,1.75c0,0.733-0.233,1.334-0.7,1.801L70.35,50l23.9,23.95c0.5,0.467,0.75,1.066,0.75,1.8 c0,0.667-0.25,1.25-0.75,1.75l-16.8,16.75c-0.534,0.467-1.117,0.7-1.75,0.7s-1.233-0.233-1.8-0.7L50,70.351L26.1,94.25 c-0.567,0.467-1.167,0.7-1.8,0.7c-0.667,0-1.283-0.233-1.85-0.7L5.75,77.5C5.25,77,5,76.417,5,75.75c0-0.733,0.25-1.333,0.75-1.8 L29.65,50L5.75,26.101C5.25,25.667,5,25.066,5,24.3c0-0.666,0.25-1.25,0.75-1.75l16.8-16.8c0.467-0.467,1.05-0.7,1.75-0.7 c0.733,0,1.333,0.233,1.8,0.7L50,29.65L73.9,5.75z"}))))),a.a.createElement("span",{style:{display:"inline-block",height:"60px",width:"calc(100% - 60px)",margin:0,overflow:"hidden",verticalAlign:"top",position:"absolute",pointerEvents:"none"},onClick:this.onClick},this.renderErrorMessage())),a.a.createElement("div",{name:"body",id:e&&e+"-body",style:Dc({display:"flex",overflow:"none",height:u?"calc(100% - 60px)":"100%",width:"",margin:0,resize:"none",fontFamily:"Roboto Mono, Monaco, monospace",fontSize:"11px",backgroundColor:r.background,transitionDuration:"0.2s",transitionTimingFunction:"cubic-bezier(0, 1, 0.5, 1)"},o.body),onClick:this.onClick},a.a.createElement("span",{name:"labels",id:e&&e+"-labels",ref:e=>this.refLabels=e,style:Dc({display:"inline-block",boxSizing:"border-box",verticalAlign:"top",height:"100%",width:"44px",margin:0,padding:"5px 0px 5px 10px",overflow:"hidden",color:"#D4D4D4"},o.labelColumn),onClick:this.onClick},this.renderLabels()),a.a.createElement("span",{id:e,ref:e=>this.refContent=e,contentEditable:!0,style:Dc({display:"inline-block",boxSizing:"border-box",verticalAlign:"top",height:"100%",width:"",flex:1,margin:0,padding:"5px",overflowX:"hidden",overflowY:"auto",wordWrap:"break-word",whiteSpace:"pre-line",color:"#D4D4D4",outline:"none"},o.contentBox),dangerouslySetInnerHTML:this.createMarkup(t),onKeyPress:this.onKeyPress,onKeyDown:this.onKeyDown,onClick:this.onClick,onBlur:this.onBlur,onScroll:this.onScroll,onPaste:this.onPaste,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1}))))}renderErrorMessage(){const e=this.props.locale||Pc,t=this.props.error||this.state.error,n=this.style;if(t)return a.a.createElement("p",{style:Dc({color:"red",fontSize:"12px",position:"absolute",width:"calc(100% - 60px)",height:"60px",boxSizing:"border-box",margin:0,padding:0,paddingRight:"10px",overflowWrap:"break-word",display:"flex",flexDirection:"column",justifyContent:"center"},n.errorMessage)},Ec(e.format,t))}renderLabels(){const e=this.colors,t=this.style,n=this.props.error||this.state.error,r=n?n.line:-1,o=this.state.lines?this.state.lines:1;let i=new Array(o);for(var s=0;s<o-1;s++)i[s]=s+1;return i.map(n=>{const o=n!==r?e.default:"red";return a.a.createElement("div",{key:n,style:Dc({},t.labels,{color:o})},n)})}createMarkup(e){return void 0===e?{__html:""}:{__html:""+e}}newSpan(e,t,n){let r=this.colors,a=t.type,o=t.string,i="";switch(a){case"string":case"number":case"primitive":case"error":i=r[t.type];break;case"key":i=" "===o?r.keys_whiteSpace:r.keys;break;case"symbol":i=":"===o?r.colon:r.default;break;default:i=r.default}return o.length!==o.replace(/</g,"").replace(/>/g,"").length&&(o="<xmp style=display:inline;>"+o+"</xmp>"),'<span type="'+a+'" value="'+o+'" depth="'+n+'" style="color:'+i+'">'+o+"</span>"}getCursorPosition(e){let t,n=window.getSelection(),r=-1,a=0;if(n.focusNode&&(e=>{for(;null!==e;){if(e===this.refContent)return!0;e=e.parentNode}return!1})(n.focusNode))for(t=n.focusNode,r=n.focusOffset;t&&t!==this.refContent;)if(t.previousSibling)t=t.previousSibling,e&&"BR"===t.nodeName&&a++,r+=t.textContent.length;else if(t=t.parentNode,null===t)break;return r+a}setCursorPosition(e){if([!1,null,void 0].indexOf(e)>-1)return;const t=(e,n,r)=>{if(r||((r=document.createRange()).selectNode(e),r.setStart(e,0)),0===n.count)r.setEnd(e,n.count);else if(e&&n.count>0)if(e.nodeType===Node.TEXT_NODE)e.textContent.length<n.count?n.count-=e.textContent.length:(r.setEnd(e,n.count),n.count=0);else for(var a=0;a<e.childNodes.length&&(r=t(e.childNodes[a],n,r),0!==n.count);a++);return r};e>0?(e=>{if(e<0)return;let n=window.getSelection(),r=t(this.refContent,{count:e});r&&(r.collapse(!1),n.removeAllRanges(),n.addRange(r))})(e):this.refContent.focus()}update(e=0,t=!0){const n=this.refContent,r=this.tokenize(n);"onChange"in this.props&&this.props.onChange({plainText:r.indented,markupText:r.markup,json:r.json,jsObject:r.jsObject,lines:r.lines,error:r.error});let a=this.getCursorPosition(r.error)+e;this.setState({plainText:r.indented,markupText:r.markup,json:r.json,jsObject:r.jsObject,lines:r.lines,error:r.error}),this.updateTime=!1,t&&this.setCursorPosition(a)}scheduledUpdate(){if("onKeyPressUpdate"in this.props&&!1===this.props.onKeyPressUpdate)return;const{updateTime:e}=this;!1!==e&&(e>(new Date).getTime()||this.update())}setUpdateTime(){"onKeyPressUpdate"in this.props&&!1===this.props.onKeyPressUpdate||(this.updateTime=(new Date).getTime()+this.waitAfterKeyPress)}stopEvent(e){e&&(e.preventDefault(),e.stopPropagation())}onKeyPress(e){const t=e.ctrlKey||e.metaKey;this.props.viewOnly&&!t&&this.stopEvent(e),t||this.setUpdateTime()}onKeyDown(e){const t=!!this.props.viewOnly,n=e.ctrlKey||e.metaKey;switch(e.key){case"Tab":if(this.stopEvent(e),t)break;document.execCommand("insertText",!1," "),this.setUpdateTime();break;case"Backspace":case"Delete":t&&this.stopEvent(e),this.setUpdateTime();break;case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"ArrowDown":this.setUpdateTime();break;case"a":case"c":t&&!n&&this.stopEvent(e);break;default:t&&this.stopEvent(e)}}onPaste(e){if(this.props.viewOnly)this.stopEvent(e);else{e.preventDefault();var t=e.clipboardData.getData("text/plain");document.execCommand("insertText",!1,t)}this.update()}onClick(){!("viewOnly"in this.props)||this.props.viewOnly}onBlur(){if("viewOnly"in this.props&&this.props.viewOnly)return;const e=this.refContent,t=this.tokenize(e);"onBlur"in this.props&&this.props.onBlur({plainText:t.indented,markupText:t.markup,json:t.json,jsObject:t.jsObject,lines:t.lines,error:t.error})}onScroll(e){this.refLabels.scrollTop=e.target.scrollTop}componentDidUpdate(){this.updateInternalProps(),this.showPlaceholder()}componentDidMount(){this.showPlaceholder()}componentWillUnmount(){this.timer&&clearInterval(this.timer)}showPlaceholder(){if(!("placeholder"in this.props))return;const{placeholder:e}=this.props;if([void 0,null].indexOf(e)>-1)return;const{prevPlaceholder:t,jsObject:n}=this.state,{resetConfiguration:r}=this,a=Object(Oc.getType)(e);-1===["object","array"].indexOf(a)&&xc.throwError("showPlaceholder","placeholder","either an object or an array");let o=!Object(Oc.identical)(e,t);if(o||r&&void 0!==n&&(o=!Object(Oc.identical)(e,n)),!o)return;const i=this.tokenize(e);this.setState({prevPlaceholder:e,plainText:i.indentation,markupText:i.markup,lines:i.lines,error:i.error})}tokenize(e){if("object"!=typeof e)return console.error("tokenize() expects object type properties only. Got '"+typeof e+"' type instead.");const t=this.props.locale||Pc,n=this.newSpan;if("nodeType"in e){const v=e.cloneNode(!0);if(!v.hasChildNodes())return"";const w=v.childNodes;let M={tokens_unknown:[],tokens_proto:[],tokens_split:[],tokens_fallback:[],tokens_normalize:[],tokens_merge:[],tokens_plainText:"",indented:"",json:"",jsObject:void 0,markup:""};for(var r=0;r<w.length;r++){let e=w[r],t={};switch(e.nodeName){case"SPAN":t={string:e.textContent,type:e.attributes.type.textContent},M.tokens_unknown.push(t);break;case"DIV":M.tokens_unknown.push({string:e.textContent,type:"unknown"});break;case"BR":""===e.textContent&&M.tokens_unknown.push({string:"\n",type:"unknown"});break;case"#text":M.tokens_unknown.push({string:e.wholeText,type:"unknown"});break;case"FONT":M.tokens_unknown.push({string:e.textContent,type:"unknown"});break;default:console.error("Unrecognized node:",{child:e})}}function a(e,t=""){let n={active:!1,string:"",number:"",symbol:"",space:"",delimiter:"",quarks:[]};function r(e,r){switch(r){case"symbol":case"delimiter":n.active&&n.quarks.push({string:n[n.active],type:t+"-"+n.active}),n[n.active]="",n.active=r,n[n.active]=e;break;default:r!==n.active||[n.string,e].indexOf("\n")>-1?(n.active&&n.quarks.push({string:n[n.active],type:t+"-"+n.active}),n[n.active]="",n.active=r,n[n.active]=e):n[r]+=e}}for(var a=0;a<e.length;a++){const t=e.charAt(a);switch(t){case'"':case"'":r(t,"delimiter");break;case" ":case" ":r(t,"space");break;case"{":case"}":case"[":case"]":case":":case",":r(t,"symbol");break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":"string"===n.active?r(t,"string"):r(t,"number");break;case"-":if(a<e.length-1&&"0123456789".indexOf(e.charAt(a+1))>-1){r(t,"number");break}case".":if(a<e.length-1&&a>0&&"0123456789".indexOf(e.charAt(a+1))>-1&&"0123456789".indexOf(e.charAt(a-1))>-1){r(t,"number");break}default:r(t,"string")}}return n.active&&(n.quarks.push({string:n[n.active],type:t+"-"+n.active}),n[n.active]="",n.active=!1),n.quarks}for(r=0;r<M.tokens_unknown.length;r++){let e=M.tokens_unknown[r];M.tokens_proto=M.tokens_proto.concat(a(e.string,"proto"))}function o(e,t){let n="",r="",a=!1;switch(t){case"primitive":if(-1===["true","false","null","undefined"].indexOf(e))return!1;break;case"string":if(e.length<2)return!1;if(n=e.charAt(0),r=e.charAt(e.length-1),a="'\"".indexOf(n),-1===a)return!1;if(n!==r)return!1;for(var o=0;o<e.length;o++)if(o>0&&o<e.length-1&&e.charAt(o)==="'\""[a]&&"\\"!==e.charAt(o-1))return!1;break;case"key":if(0===e.length)return!1;if(n=e.charAt(0),r=e.charAt(e.length-1),a="'\"".indexOf(n),a>-1){if(1===e.length)return!1;if(n!==r)return!1;for(o=0;o<e.length;o++)if(o>0&&o<e.length-1&&e.charAt(o)==="'\""[a]&&"\\"!==e.charAt(o-1))return!1}else{const t="'\"`.,:;{}[]&<>=~*%\\|/-+!?@^  ";for(o=0;o<t.length;o++){const n=t.charAt(o);if(e.indexOf(n)>-1)return!1}}break;case"number":for(o=0;o<e.length;o++)if(-1==="0123456789".indexOf(e.charAt(o)))if(0===o){if("-"!==e.charAt(0))return!1}else if("."!==e.charAt(o))return!1;break;case"symbol":if(e.length>1)return!1;if(-1==="{[:]},".indexOf(e))return!1;break;case"colon":if(e.length>1)return!1;if(":"!==e)return!1;break;default:return!0}return!0}for(r=0;r<M.tokens_proto.length;r++){let e=M.tokens_proto[r];-1===e.type.indexOf("proto")?o(e.string,e.type)?M.tokens_split.push(e):M.tokens_split=M.tokens_split.concat(a(e.string,"split")):M.tokens_split.push(e)}for(r=0;r<M.tokens_split.length;r++){let e=M.tokens_split[r],t=e.type,n=e.string,a=n.length,o=[];t.indexOf("-")>-1&&(t=t.slice(t.indexOf("-")+1),"string"!==t&&o.push("string"),o.push("key"),o.push("error"));let i={string:n,length:a,type:t,fallback:o};M.tokens_fallback.push(i)}function i(){const e=M.tokens_normalize.length-1;if(e<1)return!1;for(var t=e;t>=0;t--){const e=M.tokens_normalize[t];switch(e.type){case"space":case"linebreak":break;default:return e}}return!1}let k={brackets:[],stringOpen:!1,isValue:!1};for(r=0;r<M.tokens_fallback.length;r++){let e=M.tokens_fallback[r];const t=e.type,n=e.string;let a={type:t,string:n};switch(t){case"symbol":case"colon":if(k.stringOpen){k.isValue?a.type="string":a.type="key";break}switch(n){case"[":case"{":k.brackets.push(n),k.isValue="["===k.brackets[k.brackets.length-1];break;case"]":case"}":k.brackets.pop(),k.isValue="["===k.brackets[k.brackets.length-1];break;case",":if("colon"===i().type)break;k.isValue="["===k.brackets[k.brackets.length-1];break;case":":a.type="colon",k.isValue=!0}break;case"delimiter":if(k.isValue?a.type="string":a.type="key",!k.stringOpen){k.stringOpen=n;break}if(r>0){const e=M.tokens_fallback[r-1],t=e.string,n=e.type,a=t.charAt(t.length-1);if("string"===n&&"\\"===a)break}if(k.stringOpen===n){k.stringOpen=!1;break}break;case"primitive":case"string":if(["false","true","null","undefined"].indexOf(n)>-1){const e=M.tokens_normalize.length-1;if(e>=0){if("string"!==M.tokens_normalize[e].type){a.type="primitive";break}a.type="string";break}a.type="primitive";break}if("\n"===n&&!k.stringOpen){a.type="linebreak";break}k.isValue?a.type="string":a.type="key";break;case"space":case"number":k.stringOpen&&(k.isValue?a.type="string":a.type="key")}M.tokens_normalize.push(a)}for(r=0;r<M.tokens_normalize.length;r++){const e=M.tokens_normalize[r];let t={string:e.string,type:e.type,tokens:[r]};if(-1===["symbol","colon"].indexOf(e.type)&&r+1<M.tokens_normalize.length){let n=0;for(var s=r+1;s<M.tokens_normalize.length;s++){const r=M.tokens_normalize[s];if(e.type!==r.type)break;t.string+=r.string,t.tokens.push(s),n++}r+=n}M.tokens_merge.push(t)}const L="'\"",Y="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$";var l=!1,u=M.tokens_merge.length>0?1:0;function c(e,t,n=0){l={token:e,line:u,reason:t},M.tokens_merge[e+n].type="error"}function d(e,t){if(void 0===e&&console.error("tokenID argument must be an integer."),void 0===t&&console.error("options argument must be an array."),e===M.tokens_merge.length-1)return!1;for(var n=e+1;n<M.tokens_merge.length;n++){const e=M.tokens_merge[n];switch(e.type){case"space":case"linebreak":break;case"symbol":case"colon":return t.indexOf(e.string)>-1&&n;default:return!1}}return!1}function p(e,t){if(void 0===e&&console.error("tokenID argument must be an integer."),void 0===t&&console.error("options argument must be an array."),0===e)return!1;for(var n=e-1;n>=0;n--){const e=M.tokens_merge[n];switch(e.type){case"space":case"linebreak":break;case"symbol":case"colon":return t.indexOf(e.string)>-1;default:return!1}}return!1}function m(e){if(void 0===e&&console.error("tokenID argument must be an integer."),0===e)return!1;for(var t=e-1;t>=0;t--){const e=M.tokens_merge[t];switch(e.type){case"space":case"linebreak":break;default:return e.type}}return!1}k={brackets:[],stringOpen:!1,isValue:!1};let T=[];for(r=0;r<M.tokens_merge.length&&!l;r++){let e=M.tokens_merge[r],n=e.string,a=e.type,o=!1;switch(a){case"space":break;case"linebreak":u++;break;case"symbol":switch(n){case"{":case"[":if(o=p(r,["}","]"]),o){c(r,Ec(t.invalidToken.tokenSequence.prohibited,{firstToken:M.tokens_merge[o].string,secondToken:n}));break}if("["===n&&r>0&&!p(r,[":","[",","])){c(r,Ec(t.invalidToken.tokenSequence.permitted,{firstToken:"[",secondToken:[":","[",","]}));break}if("{"===n&&p(r,["{"])){c(r,Ec(t.invalidToken.double,{token:"{"}));break}k.brackets.push(n),k.isValue="["===k.brackets[k.brackets.length-1],T.push({i:r,line:u,string:n});break;case"}":case"]":if("}"===n&&"{"!==k.brackets[k.brackets.length-1]){c(r,Ec(t.brace.curly.missingOpen));break}if("}"===n&&p(r,[","])){c(r,Ec(t.invalidToken.tokenSequence.prohibited,{firstToken:",",secondToken:"}"}));break}if("]"===n&&"["!==k.brackets[k.brackets.length-1]){c(r,Ec(t.brace.square.missingOpen));break}if("]"===n&&p(r,[":"])){c(r,Ec(t.invalidToken.tokenSequence.prohibited,{firstToken:":",secondToken:"]"}));break}k.brackets.pop(),k.isValue="["===k.brackets[k.brackets.length-1],T.push({i:r,line:u,string:n});break;case",":if(o=p(r,["{"]),o){if(d(r,["}"])){c(r,Ec(t.brace.curly.cannotWrap,{token:","}));break}c(r,Ec(t.invalidToken.tokenSequence.prohibited,{firstToken:"{",secondToken:","}));break}if(d(r,["}",",","]"])){c(r,Ec(t.noTrailingOrLeadingComma));break}switch(o=m(r),o){case"key":case"colon":c(r,Ec(t.invalidToken.termSequence.prohibited,{firstTerm:"key"===o?t.types.key:t.symbols.colon,secondTerm:t.symbols.comma}));break;case"symbol":if(p(r,["{"])){c(r,Ec(t.invalidToken.tokenSequence.prohibited,{firstToken:"{",secondToken:","}));break}}k.isValue="["===k.brackets[k.brackets.length-1]}M.json+=n;break;case"colon":if(o=p(r,["["]),o&&d(r,["]"])){c(r,Ec(t.brace.square.cannotWrap,{token:":"}));break}if(o){c(r,Ec(t.invalidToken.tokenSequence.prohibited,{firstToken:"[",secondToken:":"}));break}if("key"!==m(r)){c(r,Ec(t.invalidToken.termSequence.permitted,{firstTerm:t.symbols.colon,secondTerm:t.types.key}));break}if(d(r,["}","]"])){c(r,Ec(t.invalidToken.termSequence.permitted,{firstTerm:t.symbols.colon,secondTerm:t.types.value}));break}k.isValue=!0,M.json+=n;break;case"key":case"string":let e=n.charAt(0),i=n.charAt(n.length-1);L.indexOf(e);if(-1===L.indexOf(e)&&-1!==L.indexOf(i)){c(r,Ec(t.string.missingOpen,{quote:e}));break}if(-1===L.indexOf(i)&&-1!==L.indexOf(e)){c(r,Ec(t.string.missingClose,{quote:e}));break}if(L.indexOf(e)>-1&&e!==i){c(r,Ec(t.string.missingClose,{quote:e}));break}if("string"===a&&-1===L.indexOf(e)&&-1===L.indexOf(i)){c(r,Ec(t.string.mustBeWrappedByQuotes));break}if("key"===a&&d(r,["}","]"])&&c(r,Ec(t.invalidToken.termSequence.permitted,{firstTerm:t.types.key,secondTerm:t.symbols.colon})),-1===L.indexOf(e)&&-1===L.indexOf(i))for(var h=0;h<n.length&&!l;h++){const e=n.charAt(h);if(-1===Y.indexOf(e)){c(r,Ec(t.string.nonAlphanumeric,{token:e}));break}}if("'"===e?n='"'+n.slice(1,-1)+'"':'"'!==e&&(n='"'+n+'"'),"key"===a&&"key"===m(r)){if(r>0&&!isNaN(M.tokens_merge[r-1])){M.tokens_merge[r-1]+=M.tokens_merge[r],c(r,Ec(t.key.numberAndLetterMissingQuotes));break}c(r,Ec(t.key.spaceMissingQuotes));break}if("key"===a&&!p(r,["{",","])){c(r,Ec(t.invalidToken.tokenSequence.permitted,{firstToken:a,secondToken:["{",","]}));break}if("string"===a&&!p(r,["[",":",","])){c(r,Ec(t.invalidToken.tokenSequence.permitted,{firstToken:a,secondToken:["[",":",","]}));break}if("key"===a&&k.isValue){c(r,Ec(t.string.unexpectedKey));break}if("string"===a&&!k.isValue){c(r,Ec(t.key.unexpectedString));break}M.json+=n;break;case"number":case"primitive":if(p(r,["{"]))M.tokens_merge[r].type="key",a=M.tokens_merge[r].type,n='"'+n+'"';else if("key"===m(r))M.tokens_merge[r].type="key",a=M.tokens_merge[r].type;else if(!p(r,["[",":",","])){c(r,Ec(t.invalidToken.tokenSequence.permitted,{firstToken:a,secondToken:["[",":",","]}));break}"key"!==a&&(k.isValue||(M.tokens_merge[r].type="key",a=M.tokens_merge[r].type,n='"'+n+'"')),"primitive"===a&&"undefined"===n&&c(r,Ec(t.invalidToken.useInstead,{badToken:"undefined",goodToken:"null"})),M.json+=n}}let D="";for(r=0;r<M.json.length;r++){let e=M.json.charAt(r),t="";r+1<M.json.length&&(t=M.json.charAt(r+1),"\\"===e&&"'"===t)?(D+=t,r++):D+=e}if(M.json=D,!l){const e=Math.ceil(T.length/2);let n=0,r=!1;function f(e){T.splice(e+1,1),T.splice(e,1),r||(r=!0)}for(;T.length>0;){r=!1;for(var _=0;_<T.length-1;_++){const e=T[_].string+T[_+1].string;["[]","{}"].indexOf(e)>-1&&f(_)}if(n++,!r)break;if(n>=e)break}if(T.length>0){const e=T[0].string,n=T[0].i,r="["===e?"]":"}";u=T[0].line,c(n,Ec(t.brace["]"===r?"square":"curly"].missingClose))}}if(!l&&-1===[void 0,""].indexOf(M.json))try{M.jsObject=JSON.parse(M.json)}catch(e){const n=e.message,r=n.indexOf("position");if(-1===r)throw new Error("Error parsing failed");const a=n.substring(r+9,n.length),o=parseInt(a);let i=0,s=0,d=!1,p=1,m=!1;for(;i<o&&!m&&(d=M.tokens_merge[s],"linebreak"===d.type&&p++,-1===["space","linebreak"].indexOf(d.type)&&(i+=d.string.length),!(i>=o));)s++,M.tokens_merge[s+1]||(m=!0);u=p;let h=0;for(let e=0;e<d.string.length;e++){const n=d.string.charAt(e);"\\"===n?h=h>0?h+1:1:(h%2==0&&0!==h||-1==="'\"bfnrt".indexOf(n)&&c(s,Ec(t.invalidToken.unexpected,{token:"\\"})),h=0)}l||c(s,Ec(t.invalidToken.unexpected,{token:d.string}))}let S=1,O=0;function y(e=!1){return function(e=!1){return S++,O>0||e?"<br>":""}(e)+function(){for(var e=[],t=0;t<2*O;t++)e.push("&nbsp;");return e.join("")}()}if(!l)for(r=0;r<M.tokens_merge.length;r++){const e=M.tokens_merge[r],t=e.string;switch(e.type){case"space":case"linebreak":break;case"string":case"number":case"primitive":case"error":M.markup+=(p(r,[",","["])?y():"")+n(r,e,O);break;case"key":M.markup+=y()+n(r,e,O);break;case"colon":M.markup+=n(r,e,O)+"&nbsp;";break;case"symbol":switch(t){case"[":case"{":M.markup+=(p(r,[":"])?"":y())+n(r,e,O),O++;break;case"]":case"}":O--;const t=r===M.tokens_merge.length-1,a=r>0?["[","{"].indexOf(M.tokens_merge[r-1].string)>-1?"":y(t):"";M.markup+=a+n(r,e,O);break;case",":M.markup+=n(r,e,O)}}}if(l){let e=1;function b(e){let t=0;for(var n=0;n<e.length;n++)["\n","\r"].indexOf(e[n])>-1&&t++;return t}S=1;for(r=0;r<M.tokens_merge.length;r++){const t=M.tokens_merge[r],a=t.type,o=t.string;"linebreak"===a&&S++,M.markup+=n(r,t,O),e+=b(o)}S++,e++,S<e&&(S=e)}for(r=0;r<M.tokens_merge.length;r++){let e=M.tokens_merge[r];M.indented+=e.string,-1===["space","linebreak"].indexOf(e.type)&&(M.tokens_plainText+=e.string)}if(l){"modifyErrorText"in this.props&&((g=this.props.modifyErrorText)&&"[object Function]"==={}.toString.call(g)&&(l.reason=this.props.modifyErrorText(l.reason)))}return{tokens:M.tokens_merge,noSpaces:M.tokens_plainText,indented:M.indented,json:M.json,jsObject:M.jsObject,markup:M.markup,lines:S,error:l}}var g;if(!("nodeType"in e)){let t={inputText:JSON.stringify(e),position:0,currentChar:"",tokenPrimary:"",tokenSecondary:"",brackets:[],isValue:!1,stringOpen:!1,stringStart:0,tokens:[]};function v(){return"\\"===t.currentChar}function w(){if(-1==="'\"".indexOf(t.currentChar))return!1;if(!t.stringOpen)return k(),t.stringStart=t.position,t.stringOpen=t.currentChar,!0;if(t.stringOpen===t.currentChar){k();return L(t.inputText.substring(t.stringStart,t.position+1)),t.stringOpen=!1,!0}return!1}function M(){if(-1===":,{}[]".indexOf(t.currentChar))return!1;if(t.stringOpen)return!1;switch(k(),L(t.currentChar),t.currentChar){case":":return t.isValue=!0,!0;case"{":case"[":t.brackets.push(t.currentChar);break;case"}":case"]":t.brackets.pop()}return":"!==t.currentChar&&(t.isValue="["===t.brackets[t.brackets.length-1]),!0}function k(){return 0!==t.tokenSecondary.length&&(t.tokens.push(t.tokenSecondary),t.tokenSecondary="",!0)}function L(e){return 0!==e.length&&(t.tokens.push(e),!0)}for(r=0;r<t.inputText.length;r++){t.position=r,t.currentChar=t.inputText.charAt(t.position);const e=M(),n=w(),a=v();e||n||a||t.stringOpen||(t.tokenSecondary+=t.currentChar)}let a={brackets:[],isValue:!1,tokens:[]};a.tokens=t.tokens.map(e=>{let t="",n="",r="";switch(e){case",":t="symbol",n=e,r=e,a.isValue="["===a.brackets[a.brackets.length-1];break;case":":t="symbol",n=e,r=e,a.isValue=!0;break;case"{":case"[":t="symbol",n=e,r=e,a.brackets.push(e),a.isValue="["===a.brackets[a.brackets.length-1];break;case"}":case"]":t="symbol",n=e,r=e,a.brackets.pop(),a.isValue="["===a.brackets[a.brackets.length-1];break;case"undefined":t="primitive",n=e,r=void 0;break;case"null":t="primitive",n=e,r=null;break;case"false":t="primitive",n=e,r=!1;break;case"true":t="primitive",n=e,r=!0;break;default:const i=e.charAt(0);if("'\"".indexOf(i)>-1){if(t=a.isValue?"string":"key","key"===t&&(n=function(e){if(0===e.length)return e;if(['""',"''"].indexOf(e)>-1)return"''";let t=!1;for(var n=0;n<2;n++)if([e.charAt(0),e.charAt(e.length-1)].indexOf(['"',"'"][n])>-1){t=!0;break}t&&e.length>=2&&(e=e.slice(1,-1));const r=e.replace(/\w/g,""),a=(e.replace(/\W+/g,""),((e,t)=>{let n=!1;for(var r=0;r<t.length&&(0!==r||!isNaN(t.charAt(r)));r++)if(isNaN(t.charAt(r))){n=!0;break}return!(e.length>0||n)})(r,e));if((e=>{for(var t=0;t<e.length;t++)if(["'",'"'].indexOf(e.charAt(t))>-1)return!0;return!1})(r)){let t="";const n=e.split("");for(var o=0;o<n.length;o++){let e=n[o];["'",'"'].indexOf(e)>-1&&(e="\\"+e),t+=e}e=t}return a?e:"'"+e+"'"}(e)),"string"===t){n="";const t=e.slice(1,-1).split("");for(var o=0;o<t.length;o++){let e=t[o];"'\"".indexOf(e)>-1&&(e="\\"+e),n+=e}n="'"+n+"'"}r=n;break}if(!isNaN(e)){t="number",n=e,r=Number(e);break}if(e.length>0&&!a.isValue){t="key",n=e,n.indexOf(" ")>-1&&(n="'"+n+"'"),r=n;break}}return{type:t,string:n,value:r,depth:a.brackets.length}});let o="";for(r=0;r<a.tokens.length;r++){o+=a.tokens[r].string}function Y(e){for(var t=[],n=0;n<2*e;n++)t.push(" ");return(e>0?"\n":"")+t.join("")}let i="";for(r=0;r<a.tokens.length;r++){let e=a.tokens[r];switch(e.string){case"[":case"{":const t=r<a.tokens.length-1-1?a.tokens[r+1]:"";-1==="}]".indexOf(t.string)?i+=e.string+Y(e.depth):i+=e.string;break;case"]":case"}":const n=r>0?a.tokens[r-1]:"";-1==="[{".indexOf(n.string)?i+=Y(e.depth)+e.string:i+=e.string;break;case":":i+=e.string+" ";break;case",":i+=e.string+Y(e.depth);break;default:i+=e.string}}let s=1;function T(e){var t=[];e>0&&s++;for(var n=0;n<2*e;n++)t.push("&nbsp;");return(e>0?"<br>":"")+t.join("")}let l="";const u=a.tokens.length-1;for(r=0;r<a.tokens.length;r++){let e=a.tokens[r],t=n(r,e,e.depth);switch(e.string){case"{":case"[":const n=r<a.tokens.length-1-1?a.tokens[r+1]:"";-1==="}]".indexOf(n.string)?l+=t+T(e.depth):l+=t;break;case"}":case"]":const o=r>0?a.tokens[r-1]:"";-1==="[{".indexOf(o.string)?l+=T(e.depth)+(u===r?"<br>":"")+t:l+=t;break;case":":l+=t+" ";break;case",":l+=t+T(e.depth);break;default:l+=t}}return s+=2,{tokens:a.tokens,noSpaces:o,indented:i,json:JSON.stringify(e),jsObject:e,markup:l,lines:s}}}}var Hc=Cc,zc=n(133),Ac=n.n(zc);function Rc(e){return(Rc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Nc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Fc(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Wc(e,t){return(Wc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Ic(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Uc(e);if(t){var a=Uc(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return Bc(this,n)}}function Bc(e,t){if(t&&("object"===Rc(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Jc(e)}function Jc(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Uc(e){return(Uc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Gc=wp.i18n.__,Vc=wp.element.Component,qc=wp.components,$c=qc.ExternalLink,Kc=qc.PanelBody,Zc=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Wc(e,t)}(o,e);var t,n,r,a=Ic(o);function o(){var e;return Nc(this,o),(e=a.apply(this,arguments)).isValidJSON=e.isValidJSON.bind(Jc(e)),e}return t=o,(n=[{key:"isValidJSON",value:function(e){try{JSON.parse(e)}catch(e){return!1}return!0}},{key:"render",value:function(){var e,t=this,n=this.props.chart["visualizer-settings"];return e=0<=["gauge","tabular","timeline"].indexOf(this.props.chart["visualizer-chart-type"])?this.props.chart["visualizer-chart-type"]:"".concat(this.props.chart["visualizer-chart-type"],"chart"),wp.element.createElement(Kc,{title:Gc("Manual Configuration"),initialOpen:!1,className:"visualizer-advanced-panel"},wp.element.createElement("p",null,Gc("Configure the graph by providing configuration variables right from the Google Visualization API.")),wp.element.createElement("p",null,wp.element.createElement($c,{href:"https://developers.google.com/chart/interactive/docs/gallery/".concat(e,"#configuration-options")},Gc("Google Visualization API"))),wp.element.createElement(Hc,{locale:Ac.a,theme:"light_mitsuketa_tribute",placeholder:Z(n.manual)?JSON.parse(n.manual):{},width:"100%",height:"250px",style:{errorMessage:{height:"100%",fontSize:"10px"},container:{border:"1px solid #ddd",boxShadow:"inset 0 1px 2px rgba(0,0,0,.07)"},labelColumn:{background:"#F5F5F5",width:"auto",padding:"5px 10px 5px 10px"}},onChange:function(e){!1===e.error&&(n.manual=e.json,t.props.edit(n))}}))}}])&&Fc(t.prototype,n),r&&Fc(t,r),Object.defineProperty(t,"prototype",{writable:!1}),o}(Vc);function Qc(e){return(Qc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Xc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ed(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function td(e,t){return(td=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function nd(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ad(e);if(t){var a=ad(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return rd(this,n)}}function rd(e,t){if(t&&("object"===Qc(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function ad(e){return(ad=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var od=wp.element,id=od.Component,sd=od.Fragment,ld=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&td(e,t)}(o,e);var t,n,r,a=nd(o);function o(){return Xc(this,o),a.apply(this,arguments)}return t=o,(n=[{key:"render",value:function(){var e=this.props.chart["visualizer-chart-type"],t=this.props.chart["visualizer-chart-library"];return wp.element.createElement(sd,null,wp.element.createElement(Ir,{chart:this.props.chart,attributes:this.props.attributes,edit:this.props.edit}),wp.element.createElement(Sr,{chart:this.props.chart,edit:this.props.edit}),-1>=["tabular","dataTable","gauge","geo","pie","timeline"].indexOf(e)&&wp.element.createElement(sa,{chart:this.props.chart,edit:this.props.edit}),-1>=["tabular","dataTable","gauge","geo","pie","timeline"].indexOf(e)&&wp.element.createElement(Ta,{chart:this.props.chart,edit:this.props.edit}),0<=["pie"].indexOf(e)&&wp.element.createElement(sd,null,wp.element.createElement(Ua,{chart:this.props.chart,edit:this.props.edit}),wp.element.createElement(io,{chart:this.props.chart,edit:this.props.edit})),0<=["area","scatter","line"].indexOf(e)&&wp.element.createElement(ko,{chart:this.props.chart,edit:this.props.edit}),0<=["bar","column"].indexOf(e)&&wp.element.createElement(Ao,{chart:this.props.chart,edit:this.props.edit}),0<=["candlestick"].indexOf(e)&&wp.element.createElement(Xo,{chart:this.props.chart,edit:this.props.edit}),0<=["geo"].indexOf(e)&&wp.element.createElement(sd,null,wp.element.createElement(hi,{chart:this.props.chart,edit:this.props.edit}),wp.element.createElement(Oi,{chart:this.props.chart,edit:this.props.edit}),wp.element.createElement(Ui,{chart:this.props.chart,edit:this.props.edit}),wp.element.createElement(os,{chart:this.props.chart,edit:this.props.edit})),0<=["gauge"].indexOf(e)&&wp.element.createElement(ks,{chart:this.props.chart,edit:this.props.edit}),0<=["timeline"].indexOf(e)&&wp.element.createElement(Ns,{chart:this.props.chart,edit:this.props.edit}),0<=["tabular","dataTable"].indexOf(e)&&wp.element.createElement(sd,null,wp.element.createElement(nl,{chart:this.props.chart,edit:this.props.edit}),wp.element.createElement(gl,{chart:this.props.chart,edit:this.props.edit})),0<=["combo"].indexOf(e)&&wp.element.createElement(El,{chart:this.props.chart,edit:this.props.edit}),-1>=["timeline","bubble","gauge","geo","pie","tabular","dataTable"].indexOf(e)&&wp.element.createElement(Zl,{chart:this.props.chart,edit:this.props.edit}),"tabular"===e&&"GoogleCharts"===t&&wp.element.createElement(Zl,{chart:this.props.chart,edit:this.props.edit}),0<=["bubble"].indexOf(e)&&wp.element.createElement(Su,{chart:this.props.chart,edit:this.props.edit}),0<=["pie"].indexOf(e)&&wp.element.createElement(pu,{chart:this.props.chart,edit:this.props.edit}),"DataTable"===t&&wp.element.createElement(Ju,{chart:this.props.chart,edit:this.props.edit}),"DataTable"!==t&&wp.element.createElement(uc,{chart:this.props.chart,edit:this.props.edit}),wp.element.createElement(Yc,{chart:this.props.chart,edit:this.props.edit}),"DataTable"!==t&&wp.element.createElement(Zc,{chart:this.props.chart,edit:this.props.edit}))}}])&&ed(t.prototype,n),r&&ed(t,r),Object.defineProperty(t,"prototype",{writable:!1}),o}(id);function ud(e){return(ud="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function cd(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */cd=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},a=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",i=r.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function l(e,t,n,r){var a=t&&t.prototype instanceof d?t:d,o=Object.create(a.prototype),i=new k(r||[]);return o._invoke=function(e,t,n){var r="suspendedStart";return function(a,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===a)throw o;return Y()}for(n.method=a,n.arg=o;;){var i=n.delegate;if(i){var s=v(i,n);if(s){if(s===c)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var l=u(e,t,n);if("normal"===l.type){if(r=n.done?"completed":"suspendedYield",l.arg===c)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r="completed",n.method="throw",n.arg=l.arg)}}}(e,n,i),o}function u(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var c={};function d(){}function p(){}function m(){}var h={};s(h,a,(function(){return this}));var f=Object.getPrototypeOf,_=f&&f(f(L([])));_&&_!==t&&n.call(_,a)&&(h=_);var y=m.prototype=d.prototype=Object.create(h);function b(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function g(e,t){var r;this._invoke=function(a,o){function i(){return new t((function(r,i){!function r(a,o,i,s){var l=u(e[a],e,o);if("throw"!==l.type){var c=l.arg,d=c.value;return d&&"object"==ud(d)&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){r("next",e,i,s)}),(function(e){r("throw",e,i,s)})):t.resolve(d).then((function(e){c.value=e,i(c)}),(function(e){return r("throw",e,i,s)}))}s(l.arg)}(a,o,r,i)}))}return r=r?r.then(i,i):i()}}function v(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,v(e,t),"throw"===t.method))return c;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var r=u(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,c;var a=r.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,c):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,c)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function M(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function L(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:Y}}function Y(){return{value:void 0,done:!0}}return p.prototype=m,s(y,"constructor",m),s(m,"constructor",p),p.displayName=s(m,i,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,s(e,i,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},b(g.prototype),s(g.prototype,o,(function(){return this})),e.AsyncIterator=g,e.async=function(t,n,r,a,o){void 0===o&&(o=Promise);var i=new g(l(t,n,r,a),o);return e.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},b(y),s(y,i,"Generator"),s(y,a,(function(){return this})),s(y,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=L,k.prototype={constructor:k,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(M),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return i.type="throw",i.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var s=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(s&&l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,c):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),c},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),M(n),c}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;M(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:L(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),c}},e}function dd(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function pd(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){dd(o,r,a,i,s,"next",e)}function s(e){dd(o,r,a,i,s,"throw",e)}i(void 0)}))}}function md(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hd(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function fd(e,t){return(fd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _d(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=gd(e);if(t){var a=gd(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return yd(this,n)}}function yd(e,t){if(t&&("object"===ud(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return bd(e)}function bd(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function gd(e){return(gd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var vd=wp.i18n.__,wd=wp.apiFetch,Md=wp.element,kd=Md.Component,Ld=Md.Fragment,Yd=wp.components,Td=Yd.Button,Dd=Yd.PanelBody,Sd=Yd.SelectControl,Od=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&fd(e,t)}(s,e);var t,n,r,a,o,i=_d(s);function s(){var e;return md(this,s),(e=i.apply(this,arguments)).getPermissionData=e.getPermissionData.bind(bd(e)),e.state={users:[],roles:[]},e}return t=s,(n=[{key:"componentDidMount",value:(o=pd(cd().mark((function e(){var t,n,r;return cd().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("business"!==visualizerLocalize.isPro){e.next=14;break}if(void 0===(t=this.props.chart["visualizer-permissions"]).permissions){e.next=14;break}if(void 0===t.permissions.read||void 0===t.permissions.edit){e.next=14;break}if("users"!==t.permissions.read&&"users"!==t.permissions.edit){e.next=9;break}return e.next=7,wd({path:"/visualizer/v1/get-permission-data?type=users"});case 7:n=e.sent,this.setState({users:n});case 9:if("roles"!==t.permissions.read&&"roles"!==t.permissions.edit){e.next=14;break}return e.next=12,wd({path:"/visualizer/v1/get-permission-data?type=roles"});case 12:r=e.sent,this.setState({roles:r});case 14:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"getPermissionData",value:(a=pd(cd().mark((function e(t){var n,r;return cd().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("business"!==visualizerLocalize.isPro){e.next=11;break}if("users"!==t||0!==this.state.users.length){e.next=6;break}return e.next=4,wd({path:"/visualizer/v1/get-permission-data?type=".concat(t)});case 4:n=e.sent,this.setState({users:n});case 6:if("roles"!==t||0!==this.state.roles.length){e.next=11;break}return e.next=9,wd({path:"/visualizer/v1/get-permission-data?type=".concat(t)});case 9:r=e.sent,this.setState({roles:r});case 11:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"render",value:function(){var e=this,t=this.props.chart["visualizer-permissions"];return wp.element.createElement(Ld,null,"business"===visualizerLocalize.isPro?wp.element.createElement(Dd,{title:vd("Who can see this chart?"),initialOpen:!1},wp.element.createElement(Sd,{label:vd("Select who can view the chart on the front-end."),value:t.permissions.read,options:[{value:"all",label:"All Users"},{value:"users",label:"Select Users"},{value:"roles",label:"Select Roles"}],onChange:function(n){t.permissions.read=n,e.props.edit(t),"users"!==n&&"roles"!==n||e.getPermissionData(n)}}),("users"===t.permissions.read||"roles"===t.permissions.read)&&wp.element.createElement(Sd,{multiple:!0,value:t.permissions["read-specific"],options:"users"===t.permissions.read&&this.state.users||"roles"===t.permissions.read&&this.state.roles,onChange:function(n){t.permissions["read-specific"]=n,e.props.edit(t)}})):wp.element.createElement(Dd,{title:vd("Who can see this chart?"),icon:"lock",initialOpen:!1},wp.element.createElement("p",null,vd("Upgrade your license to at least the DEVELOPER version to activate this feature!")),wp.element.createElement(Td,{isPrimary:!0,href:visualizerLocalize.proTeaser,target:"_blank"},vd("Buy Now"))),"business"===visualizerLocalize.isPro?wp.element.createElement(Dd,{title:vd("Who can edit this chart?"),initialOpen:!1},wp.element.createElement(Sd,{label:vd("Select who can edit the chart on the front-end."),value:t.permissions.edit,options:[{value:"all",label:"All Users"},{value:"users",label:"Select Users"},{value:"roles",label:"Select Roles"}],onChange:function(n){t.permissions.edit=n,e.props.edit(t),"users"!==n&&"roles"!==n||e.getPermissionData(n)}}),("users"===t.permissions.edit||"roles"===t.permissions.edit)&&wp.element.createElement(Sd,{multiple:!0,value:t.permissions["edit-specific"],options:"users"===t.permissions.edit&&this.state.users||"roles"===t.permissions.edit&&this.state.roles,onChange:function(n){t.permissions["edit-specific"]=n,e.props.edit(t)}})):wp.element.createElement(Dd,{title:vd("Who can edit this chart?"),icon:"lock",initialOpen:!1},wp.element.createElement("p",null,vd("Upgrade your license to at least the DEVELOPER version to activate this feature!")),wp.element.createElement(Td,{isPrimary:!0,href:visualizerLocalize.proTeaser,target:"_blank"},vd("Buy Now"))))}}])&&hd(t.prototype,n),r&&hd(t,r),Object.defineProperty(t,"prototype",{writable:!1}),s}(kd),jd=n(134),xd=n.n(jd),Ed=wp.components,Pd=Ed.Button,Cd=Ed.Dashicon,Hd=Ed.G,zd=Ed.Path,Ad=Ed.SVG;var Rd=function(e){var t=e.label,n=e.icon,r=e.className,a=e.isBack,o=e.onClick,i=xd()("components-panel__body","components-panel__body-button",r,{"visualizer-panel-back":a});return wp.element.createElement("div",{className:i},wp.element.createElement("h2",{className:"components-panel__body-title"},wp.element.createElement(Pd,{className:"components-panel__body-toggle",onClick:o},wp.element.createElement(Ad,{className:"components-panel__arrow",width:"24px",height:"24px",viewBox:"-12 -12 48 48",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement(Hd,null,wp.element.createElement(zd,{fill:"none",d:"M0,0h24v24H0V0z"})),wp.element.createElement(Hd,null,wp.element.createElement(zd,{d:"M7.41,8.59L12,13.17l4.59-4.58L18,10l-6,6l-6-6L7.41,8.59z"}))),n&&wp.element.createElement(Cd,{icon:n,className:"components-panel__icon"}),t)))},Nd=n(3),Fd=n.n(Nd);function Wd(e){return(Wd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Id(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Bd(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Jd(e,t){return(Jd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Ud(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Vd(e);if(t){var a=Vd(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return Gd(this,n)}}function Gd(e,t){if(t&&("object"===Wd(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Vd(e){return(Vd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var qd=lodash.startCase,$d=wp.i18n.__,Kd=wp.element,Zd=Kd.Component,Qd=Kd.Fragment,Xd=(wp.blockEditor||wp.editor).InspectorControls,ep=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Jd(e,t)}(o,e);var t,n,r,a=Ud(o);function o(){var e;return Id(this,o),(e=a.apply(this,arguments)).state={route:"home"},e}return t=o,(n=[{key:"render",value:function(){var e,t,n=this,r="undefined"!=typeof google?google.visualization.Version:"current",a=V(JSON.parse(JSON.stringify(this.props.chart)));return 0<=["gauge","tabular","timeline"].indexOf(this.props.chart["visualizer-chart-type"])?"DataTable"===a["visualizer-chart-library"]?e=a["visualizer-chart-type"]:("tabular"===(e=this.props.chart["visualizer-chart-type"])&&(e="table"),e=qd(e)):e="".concat(qd(this.props.chart["visualizer-chart-type"]),"Chart"),a["visualizer-data-exploded"]&&(t=$d("Annotations in this chart may not display here but they will display in the front end.")),wp.element.createElement(Qd,null,"home"===this.state.route&&wp.element.createElement(Xd,null,wp.element.createElement(Ie,{chart:this.props.chart,readUploadedFile:this.props.readUploadedFile}),wp.element.createElement(xt,{id:this.props.id,chart:this.props.chart,editURL:this.props.editURL,isLoading:this.props.isLoading,uploadData:this.props.uploadData,editSchedule:this.props.editSchedule,editJSONSchedule:this.props.editJSONSchedule,editJSONURL:this.props.editJSONURL,editJSONHeaders:this.props.editJSONHeaders,editJSONRoot:this.props.editJSONRoot,editJSONPaging:this.props.editJSONPaging,JSONImportData:this.props.JSONImportData}),wp.element.createElement(Qt,{getChartData:this.props.getChartData,isLoading:this.props.isLoading}),wp.element.createElement(Cn,{chart:this.props.chart,editSchedule:this.props.editDatabaseSchedule,databaseImportData:this.props.databaseImportData}),wp.element.createElement(dr,{chart:this.props.chart,editChartData:this.props.editChartData}),wp.element.createElement(Rd,{label:$d("Advanced Options"),className:"visualizer-advanced-options",icon:"admin-tools",onClick:function(){return n.setState({route:"showAdvanced"})}}),wp.element.createElement(Rd,{label:$d("Chart Permissions"),icon:"admin-users",onClick:function(){return n.setState({route:"showPermissions"})}})),("showAdvanced"===this.state.route||"showPermissions"===this.state.route)&&wp.element.createElement(Xd,null,wp.element.createElement(Rd,{label:$d("Chart Settings"),onClick:function(){return n.setState({route:"home"})},isBack:!0}),"showAdvanced"===this.state.route&&wp.element.createElement(ld,{chart:this.props.chart,attributes:this.props.attributes,edit:this.props.editSettings}),"showPermissions"===this.state.route&&wp.element.createElement(Od,{chart:this.props.chart,edit:this.props.editPermissions})),wp.element.createElement("div",{className:"visualizer-settings__chart","data-chart-type":e},null!==this.props.chart&&"DataTable"===a["visualizer-chart-library"]?wp.element.createElement(I,{id:this.props.id,rows:a["visualizer-data"],columns:a["visualizer-series"],options:a["visualizer-settings"]}):(a["visualizer-data-exploded"],wp.element.createElement(S,{chartVersion:r,chartType:e,rows:a["visualizer-data"],columns:a["visualizer-series"],options:Z(this.props.chart["visualizer-settings"].manual)?Fd()($(this.props.chart["visualizer-settings"]),JSON.parse(this.props.chart["visualizer-settings"].manual)):$(this.props.chart["visualizer-settings"]),height:"500px",formatters:X(a)})),wp.element.createElement("div",{className:"visualizer-settings__charts-footer"},wp.element.createElement("sub",null,t))))}}])&&Bd(t.prototype,n),r&&Bd(t,r),Object.defineProperty(t,"prototype",{writable:!1}),o}(Zd);function tp(e){return(tp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function np(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rp(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ap(e,t){return(ap=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function op(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=sp(e);if(t){var a=sp(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return ip(this,n)}}function ip(e,t){if(t&&("object"===tp(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function sp(e){return(sp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var lp=lodash.startCase,up=wp.i18n.__,cp=wp.element,dp=cp.Component,pp=cp.Fragment,mp=wp.components,hp=mp.Button,fp=mp.Dashicon,_p=mp.Toolbar,yp=mp.Tooltip,bp=(wp.blockEditor||wp.editor).BlockControls,gp=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ap(e,t)}(o,e);var t,n,r,a=op(o);function o(){return np(this,o),a.apply(this,arguments)}return t=o,(n=[{key:"render",value:function(){var e,t,n="undefined"!=typeof google?google.visualization.Version:"current",r=V(JSON.parse(JSON.stringify(this.props.chart)));return 0<=["gauge","tabular","timeline"].indexOf(this.props.chart["visualizer-chart-type"])?"DataTable"===r["visualizer-chart-library"]?e=r["visualizer-chart-type"]:("tabular"===(e=this.props.chart["visualizer-chart-type"])&&(e="table"),e=lp(e)):e="".concat(lp(this.props.chart["visualizer-chart-type"]),"Chart"),r["visualizer-data-exploded"]&&(t=up("Annotations in this chart may not display here but they will display in the front end.")),this.props.chart["visualizer-series"]&&0<=["date","datetime","timeofday"].indexOf(this.props.chart["visualizer-series"][0].type)&&this.props.chart["visualizer-settings"]&&""==this.props.chart["visualizer-settings"].hAxis.format&&(this.props.chart["visualizer-settings"].hAxis.format="YYYY-MM-dd"),wp.element.createElement("div",{className:this.props.className},null!==this.props.chart&&wp.element.createElement(pp,null,wp.element.createElement(bp,{key:"toolbar-controls"},wp.element.createElement(_p,{className:"components-toolbar"},wp.element.createElement(yp,{text:up("Edit Chart")},wp.element.createElement(hp,{className:"components-icon-button components-toolbar__control edit-pie-chart",onClick:this.props.editChart},wp.element.createElement(fp,{icon:"edit"}))))),"DataTable"===r["visualizer-chart-library"]?wp.element.createElement(I,{id:this.props.id,rows:r["visualizer-data"],columns:r["visualizer-series"],options:r["visualizer-settings"]}):(r["visualizer-data-exploded"],wp.element.createElement(S,{chartVersion:n,chartType:e,rows:r["visualizer-data"],columns:r["visualizer-series"],options:Z(this.props.chart["visualizer-settings"].manual)?Fd()($(this.props.chart["visualizer-settings"]),JSON.parse(this.props.chart["visualizer-settings"].manual)):$(this.props.chart["visualizer-settings"]),height:"500px",formatters:X(r)})),wp.element.createElement("div",{className:"visualizer-settings__charts-footer"},wp.element.createElement("sub",null,t))))}}])&&rp(t.prototype,n),r&&rp(t,r),Object.defineProperty(t,"prototype",{writable:!1}),o}(dp);function vp(e){return(vp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Mp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function kp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Mp(Object(n),!0).forEach((function(t){Lp(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Mp(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Lp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Yp(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Yp=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},a=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",i=r.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function l(e,t,n,r){var a=t&&t.prototype instanceof d?t:d,o=Object.create(a.prototype),i=new k(r||[]);return o._invoke=function(e,t,n){var r="suspendedStart";return function(a,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===a)throw o;return Y()}for(n.method=a,n.arg=o;;){var i=n.delegate;if(i){var s=v(i,n);if(s){if(s===c)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var l=u(e,t,n);if("normal"===l.type){if(r=n.done?"completed":"suspendedYield",l.arg===c)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r="completed",n.method="throw",n.arg=l.arg)}}}(e,n,i),o}function u(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var c={};function d(){}function p(){}function m(){}var h={};s(h,a,(function(){return this}));var f=Object.getPrototypeOf,_=f&&f(f(L([])));_&&_!==t&&n.call(_,a)&&(h=_);var y=m.prototype=d.prototype=Object.create(h);function b(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function g(e,t){var r;this._invoke=function(a,o){function i(){return new t((function(r,i){!function r(a,o,i,s){var l=u(e[a],e,o);if("throw"!==l.type){var c=l.arg,d=c.value;return d&&"object"==vp(d)&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){r("next",e,i,s)}),(function(e){r("throw",e,i,s)})):t.resolve(d).then((function(e){c.value=e,i(c)}),(function(e){return r("throw",e,i,s)}))}s(l.arg)}(a,o,r,i)}))}return r=r?r.then(i,i):i()}}function v(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,v(e,t),"throw"===t.method))return c;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var r=u(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,c;var a=r.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,c):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,c)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function M(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function L(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:Y}}function Y(){return{value:void 0,done:!0}}return p.prototype=m,s(y,"constructor",m),s(m,"constructor",p),p.displayName=s(m,i,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,s(e,i,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},b(g.prototype),s(g.prototype,o,(function(){return this})),e.AsyncIterator=g,e.async=function(t,n,r,a,o){void 0===o&&(o=Promise);var i=new g(l(t,n,r,a),o);return e.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},b(y),s(y,i,"Generator"),s(y,a,(function(){return this})),s(y,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=L,k.prototype={constructor:k,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(M),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return i.type="throw",i.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var s=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(s&&l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,c):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),c},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),M(n),c}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;M(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:L(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),c}},e}function Tp(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function Dp(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Tp(o,r,a,i,s,"next",e)}function s(e){Tp(o,r,a,i,s,"throw",e)}i(void 0)}))}}function Sp(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Op(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function jp(e,t){return(jp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function xp(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Cp(e);if(t){var a=Cp(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return Ep(this,n)}}function Ep(e,t){if(t&&("object"===vp(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Pp(e)}function Pp(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Cp(e){return(Cp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Hp=wp.i18n.__,zp=wp,Ap=zp.apiFetch,Rp=zp.apiRequest,Np=wp.element,Fp=Np.Component,Wp=Np.Fragment,Ip=wp.components,Bp=Ip.Button,Jp=Ip.ButtonGroup,Up=Ip.Dashicon,Gp=Ip.Placeholder,Vp=Ip.Notice,qp=Ip.Spinner,$p=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&jp(e,t)}(l,e);var t,n,r,a,o,i,s=xp(l);function l(){var e;return Sp(this,l),(e=s.apply(this,arguments)).getChart=e.getChart.bind(Pp(e)),e.editChart=e.editChart.bind(Pp(e)),e.editSettings=e.editSettings.bind(Pp(e)),e.editPermissions=e.editPermissions.bind(Pp(e)),e.readUploadedFile=e.readUploadedFile.bind(Pp(e)),e.editURL=e.editURL.bind(Pp(e)),e.editSchedule=e.editSchedule.bind(Pp(e)),e.editJSONSchedule=e.editJSONSchedule.bind(Pp(e)),e.editJSONURL=e.editJSONURL.bind(Pp(e)),e.editJSONHeaders=e.editJSONHeaders.bind(Pp(e)),e.editJSONRoot=e.editJSONRoot.bind(Pp(e)),e.editJSONPaging=e.editJSONPaging.bind(Pp(e)),e.JSONImportData=e.JSONImportData.bind(Pp(e)),e.editDatabaseSchedule=e.editDatabaseSchedule.bind(Pp(e)),e.databaseImportData=e.databaseImportData.bind(Pp(e)),e.uploadData=e.uploadData.bind(Pp(e)),e.getChartData=e.getChartData.bind(Pp(e)),e.editChartData=e.editChartData.bind(Pp(e)),e.updateChart=e.updateChart.bind(Pp(e)),e.state={route:e.props.attributes.route?e.props.attributes.route:"home",chart:null,isModified:!1,isLoading:!1,isScheduled:!1},e}return t=l,(n=[{key:"componentDidMount",value:(i=Dp(Yp().mark((function e(){var t;return Yp().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.props.attributes.id){e.next=5;break}return e.next=3,Ap({path:"wp/v2/visualizer/".concat(this.props.attributes.id)}).catch((function(e){}));case 3:(t=e.sent)?this.setState({chart:t.chart_data}):this.setState({route:"error"});case 5:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"getChart",value:(o=Dp(Yp().mark((function e(t){var n;return Yp().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.setState({isLoading:"getChart"});case 2:return e.next=4,Ap({path:"wp/v2/visualizer/".concat(t)});case 4:n=e.sent,this.setState({route:"chartSelect",chart:n.chart_data,isLoading:!0,isModified:!0}),this.props.setAttributes({id:t,route:"chartSelect",lazy:-1});case 7:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"editChart",value:function(){this.setState({route:"chartSelect"}),this.props.setAttributes({route:"chartSelect"})}},{key:"editSettings",value:function(e){var t=kp({},this.state.chart);t["visualizer-settings"]=e,this.setState({chart:t,isModified:!0})}},{key:"editPermissions",value:function(e){var t=kp({},this.state.chart);t["visualizer-permissions"]=e,this.setState({chart:t,isModified:!0})}},{key:"readUploadedFile",value:function(e){var t=this,n=e.current.files[0],r=new FileReader;r.onload=function(){var e=function(e,t){t=t||",";for(var n=new RegExp("(\\"+t+"|\\r?\\n|\\r|^)(?:'([^']*(?:''[^']*)*)'|([^'\\"+t+"\\r\\n]*))","gi"),r=[[]],a=null;a=n.exec(e);){var o=a[1];o.length&&o!==t&&r.push([]);var i=void 0;i=a[2]?a[2].replace(new RegExp("''","g"),"'"):a[3],r[r.length-1].push(i)}return r}(r.result);t.editChartData(e,"Visualizer_Source_Csv")},r.readAsText(n)}},{key:"editURL",value:function(e){var t=kp({},this.state.chart);t["visualizer-chart-url"]=e,this.setState({chart:t})}},{key:"editSchedule",value:function(e){var t=kp({},this.state.chart);t["visualizer-chart-schedule"]=e,this.setState({chart:t,isModified:!0})}},{key:"editJSONSchedule",value:function(e){var t=kp({},this.state.chart);t["visualizer-json-schedule"]=e,this.setState({chart:t,isModified:!0})}},{key:"editJSONURL",value:function(e){var t=kp({},this.state.chart);t["visualizer-json-url"]=e,this.setState({chart:t})}},{key:"editJSONHeaders",value:function(e){var t=kp({},this.state.chart);delete e.username,delete e.password,t["visualizer-json-headers"]=e,this.setState({chart:t})}},{key:"editJSONRoot",value:function(e){var t=kp({},this.state.chart);t["visualizer-json-root"]=e,this.setState({chart:t})}},{key:"editJSONPaging",value:function(e){var t=kp({},this.state.chart);t["visualizer-json-paging"]=e,this.setState({chart:t})}},{key:"JSONImportData",value:function(e,t,n){var r=kp({},this.state.chart);r["visualizer-source"]=e,r["visualizer-default-data"]=0,r["visualizer-series"]=t,r["visualizer-data"]=n,this.setState({chart:r,isModified:!0})}},{key:"editDatabaseSchedule",value:function(e){var t=kp({},this.state.chart);t["visualizer-db-schedule"]=e,this.setState({chart:t,isModified:!0})}},{key:"databaseImportData",value:function(e,t,n,r){var a=kp({},this.state.chart);a["visualizer-source"]=t,a["visualizer-default-data"]=0,a["visualizer-series"]=n,a["visualizer-data"]=r,a["visualizer-db-query"]=e,this.setState({chart:a,isModified:!0})}},{key:"uploadData",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.setState({isLoading:"uploadData",isScheduled:t}),Rp({path:"/visualizer/v1/upload-data?url=".concat(this.state.chart["visualizer-chart-url"]),method:"POST"}).then((function(t){if(2<=Object.keys(t).length){var n=kp({},e.state.chart);n["visualizer-source"]="Visualizer_Source_Csv_Remote",n["visualizer-default-data"]=0,n["visualizer-series"]=t.series,n["visualizer-data"]=t.data;var r=n["visualizer-series"],a=n["visualizer-settings"],o=r,i="series";return"pie"===n["visualizer-chart-type"]&&(o=n["visualizer-data"],i="slices"),o.map((function(e,t){if("pie"===n["visualizer-chart-type"]||0!==t){var r="pie"!==n["visualizer-chart-type"]?t-1:t;void 0===a[i][r]&&(a[i][r]={},a[i][r].temp=1)}})),a[i]=a[i].filter((function(e,t){return t<("pie"!==n["visualizer-chart-type"]?o.length-1:o.length)})),n["visualizer-settings"]=a,e.setState({chart:n,isModified:!0,isLoading:!1}),t}e.setState({isLoading:!1})}),(function(t){return e.setState({isLoading:!1}),t}))}},{key:"getChartData",value:(a=Dp(Yp().mark((function e(t){var n,r;return Yp().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.setState({isLoading:"getChartData"});case 2:return e.next=4,Ap({path:"wp/v2/visualizer/".concat(t)});case 4:n=e.sent,(r=kp({},this.state.chart))["visualizer-source"]="Visualizer_Source_Csv",r["visualizer-default-data"]=0,r["visualizer-series"]=n.chart_data["visualizer-series"],r["visualizer-data"]=n.chart_data["visualizer-data"],this.setState({isLoading:!1,chart:r});case 11:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"editChartData",value:function(e,t){var n=kp({},this.state.chart),r=[],a=kp({},n["visualizer-settings"]),o=n["visualizer-chart-type"];e[0].map((function(t,n){r[n]={label:t,type:e[1][n]}})),e.splice(0,2);var i=r,s="series";switch(o){case"pie":i=e,s="slices",e.map((function(e,t){switch(r[1].type){case"number":e[1]=parseFloat(e[1])}}));break;case"tabular":e.map((function(e,t){r.map((function(t,n){switch(t.type){case"boolean":"string"==typeof e[n]&&(e[n]="true"===e[n])}}))}))}i.map((function(e,t){if("pie"===o||0!==t){var n="pie"!==o?t-1:t;Array.isArray(a[s])&&void 0===a[s][n]&&(a[s][n]={},a[s][n].temp=1)}})),Array.isArray(a[s])&&(a[s]=a[s].filter((function(e,t){return t<(-1>=["pie","tabular","dataTable"].indexOf(o)?i.length-1:i.length)}))),n["visualizer-source"]=t,n["visualizer-default-data"]=0,n["visualizer-data"]=e,n["visualizer-series"]=r,n["visualizer-settings"]=a,n["visualizer-chart-url"]="",this.setState({chart:n,isModified:!0,isScheduled:!1})}},{key:"updateChart",value:function(){var e=this;this.setState({isLoading:"updateChart"});var t=this.state.chart;!1===this.state.isScheduled&&(t["visualizer-chart-schedule"]="");var n="series";"pie"===t["visualizer-chart-type"]&&(n="slices"),-1>=["bubble","timeline"].indexOf(t["visualizer-chart-type"])&&Object.keys(t["visualizer-settings"][n]).map((function(e){void 0!==t["visualizer-settings"][n][e]&&void 0!==t["visualizer-settings"][n][e].temp&&delete t["visualizer-settings"][n][e].temp})),Rp({path:"/visualizer/v1/update-chart?id=".concat(this.props.attributes.id),method:"POST",data:t}).then((function(t){return e.setState({isLoading:!1,isModified:!1}),t}),(function(e){return e}))}},{key:"render",value:function(){var e=this;return"error"===this.state.route?wp.element.createElement(Vp,{status:"error",isDismissible:!1},wp.element.createElement(Up,{icon:"chart-pie"}),Hp("This chart is not available; it might have been deleted. Please delete this block and resubmit your chart.")):"renderChart"===this.state.route&&null!==this.state.chart?wp.element.createElement(gp,{id:this.props.attributes.id,chart:this.state.chart,className:this.props.className,editChart:this.editChart}):wp.element.createElement("div",{className:"visualizer-settings"},wp.element.createElement("div",{className:"visualizer-settings__title"},wp.element.createElement(Up,{icon:"chart-pie"}),Hp("Visualizer")),"home"===this.state.route&&wp.element.createElement("div",{className:"visualizer-settings__content"},wp.element.createElement("div",{className:"visualizer-settings__content-description"},Hp("Make a new chart or display an existing one?")),wp.element.createElement("a",{href:visualizerLocalize.adminPage,target:"_blank",className:"visualizer-settings__content-option"},wp.element.createElement("span",{className:"visualizer-settings__content-option-title"},Hp("Create a new chart")),wp.element.createElement("div",{className:"visualizer-settings__content-option-icon"},wp.element.createElement(Up,{icon:"arrow-right-alt2"}))),wp.element.createElement("div",{className:"visualizer-settings__content-option",onClick:function(){e.setState({route:"showCharts"}),e.props.setAttributes({route:"showCharts"})}},wp.element.createElement("span",{className:"visualizer-settings__content-option-title"},Hp("Display an existing chart")),wp.element.createElement("div",{className:"visualizer-settings__content-option-icon"},wp.element.createElement(Up,{icon:"arrow-right-alt2"})))),("getChart"===this.state.isLoading||"chartSelect"===this.state.route&&null===this.state.chart||"renderChart"===this.state.route&&null===this.state.chart)&&wp.element.createElement(Gp,null,wp.element.createElement(qp,null)),"showCharts"===this.state.route&&!1===this.state.isLoading&&wp.element.createElement(De,{getChart:this.getChart}),"chartSelect"===this.state.route&&null!==this.state.chart&&wp.element.createElement(ep,{id:this.props.attributes.id,attributes:this.props.attributes,chart:this.state.chart,editSettings:this.editSettings,editPermissions:this.editPermissions,url:this.state.url,readUploadedFile:this.readUploadedFile,editURL:this.editURL,editSchedule:this.editSchedule,editJSONURL:this.editJSONURL,editJSONHeaders:this.editJSONHeaders,editJSONSchedule:this.editJSONSchedule,editJSONRoot:this.editJSONRoot,editJSONPaging:this.editJSONPaging,JSONImportData:this.JSONImportData,editDatabaseSchedule:this.editDatabaseSchedule,databaseImportData:this.databaseImportData,uploadData:this.uploadData,getChartData:this.getChartData,editChartData:this.editChartData,isLoading:this.state.isLoading}),wp.element.createElement("div",{className:"visualizer-settings__controls"},("showCharts"===this.state.route||"chartSelect"===this.state.route)&&wp.element.createElement(Jp,null,wp.element.createElement(Bp,{isDefault:!0,isLarge:!0,onClick:function(){var t;"showCharts"===e.state.route?t="home":"chartSelect"===e.state.route&&(t="showCharts"),e.setState({route:t,isLoading:!1}),e.props.setAttributes({route:t})}},Hp("Back")),"chartSelect"===this.state.route&&wp.element.createElement(Wp,null,!1===this.state.isModified?wp.element.createElement(Bp,{isDefault:!0,isLarge:!0,className:"visualizer-bttn-done",onClick:function(){e.setState({route:"renderChart",isModified:!0}),e.props.setAttributes({route:"renderChart"})}},Hp("Done")):wp.element.createElement(Bp,{isPrimary:!0,isLarge:!0,className:"visualizer-bttn-save",isBusy:"updateChart"===this.state.isLoading,disabled:"updateChart"===this.state.isLoading,onClick:this.updateChart},Hp("Save"))))))}}])&&Op(t.prototype,n),r&&Op(t,r),Object.defineProperty(t,"prototype",{writable:!1}),l}(Fp),Kp=(n(153),wp.i18n.__),Zp=wp.blocks.registerBlockType;t.default=Zp("visualizer/chart",{title:Kp("Visualizer Chart"),description:Kp("A simple, easy to use and quite powerful tool to create, manage and embed interactive charts into your WordPress posts and pages."),category:"common",icon:"chart-pie",keywords:[Kp("Visualizer"),Kp("Chart"),Kp("Google Charts")],attributes:{id:{type:"number"},lazy:{default:"-1",type:"string"},route:{type:"string"}},supports:{customClassName:!1},edit:$p,save:function(){return null}})}]);
66
  *
67
  * This source code is licensed under the MIT license found in the
68
  * LICENSE file in the root directory of this source tree.
69
+ */class Cc extends r.Component{constructor(e){super(e),this.updateInternalProps=this.updateInternalProps.bind(this),this.createMarkup=this.createMarkup.bind(this),this.onClick=this.onClick.bind(this),this.onBlur=this.onBlur.bind(this),this.update=this.update.bind(this),this.getCursorPosition=this.getCursorPosition.bind(this),this.setCursorPosition=this.setCursorPosition.bind(this),this.scheduledUpdate=this.scheduledUpdate.bind(this),this.setUpdateTime=this.setUpdateTime.bind(this),this.renderLabels=this.renderLabels.bind(this),this.newSpan=this.newSpan.bind(this),this.renderErrorMessage=this.renderErrorMessage.bind(this),this.onScroll=this.onScroll.bind(this),this.showPlaceholder=this.showPlaceholder.bind(this),this.tokenize=this.tokenize.bind(this),this.onKeyPress=this.onKeyPress.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onPaste=this.onPaste.bind(this),this.stopEvent=this.stopEvent.bind(this),this.refContent=null,this.refLabels=null,this.updateInternalProps(),this.renderCount=1,this.state={prevPlaceholder:"",markupText:"",plainText:"",json:"",jsObject:void 0,lines:!1,error:!1},this.props.locale||console.warn("[react-json-editor-ajrm - Deprecation Warning] You did not provide a 'locale' prop for your JSON input - This will be required in a future version. English has been set as a default.")}updateInternalProps(){let e={},t={},n=Sc.dark_vscode_tribute;"theme"in this.props&&"string"==typeof this.props.theme&&this.props.theme in Sc&&(n=Sc[this.props.theme]),e=n,"colors"in this.props&&(e={default:"default"in this.props.colors?this.props.colors.default:e.default,string:"string"in this.props.colors?this.props.colors.string:e.string,number:"number"in this.props.colors?this.props.colors.number:e.number,colon:"colon"in this.props.colors?this.props.colors.colon:e.colon,keys:"keys"in this.props.colors?this.props.colors.keys:e.keys,keys_whiteSpace:"keys_whiteSpace"in this.props.colors?this.props.colors.keys_whiteSpace:e.keys_whiteSpace,primitive:"primitive"in this.props.colors?this.props.colors.primitive:e.primitive,error:"error"in this.props.colors?this.props.colors.error:e.error,background:"background"in this.props.colors?this.props.colors.background:e.background,background_warning:"background_warning"in this.props.colors?this.props.colors.background_warning:e.background_warning}),this.colors=e,t="style"in this.props?{outerBox:"outerBox"in this.props.style?this.props.style.outerBox:{},container:"container"in this.props.style?this.props.style.container:{},warningBox:"warningBox"in this.props.style?this.props.style.warningBox:{},errorMessage:"errorMessage"in this.props.style?this.props.style.errorMessage:{},body:"body"in this.props.style?this.props.style.body:{},labelColumn:"labelColumn"in this.props.style?this.props.style.labelColumn:{},labels:"labels"in this.props.style?this.props.style.labels:{},contentBox:"contentBox"in this.props.style?this.props.style.contentBox:{}}:{outerBox:{},container:{},warningBox:{},errorMessage:{},body:{},labelColumn:{},labels:{},contentBox:{}},this.style=t,this.confirmGood=!("confirmGood"in this.props)||this.props.confirmGood;const r=this.props.height||"610px",a=this.props.width||"479px";this.totalHeight=r,this.totalWidth=a,!("onKeyPressUpdate"in this.props)||this.props.onKeyPressUpdate?this.timer||(this.timer=setInterval(this.scheduledUpdate,100)):this.timer&&(clearInterval(this.timer),this.timer=!1),this.updateTime=!1,this.waitAfterKeyPress="waitAfterKeyPress"in this.props?this.props.waitAfterKeyPress:1e3,this.resetConfiguration="reset"in this.props&&this.props.reset}render(){const e=this.props.id,t=this.state.markupText,n=this.props.error||this.state.error,r=this.colors,o=this.style,i=this.confirmGood,s=this.totalHeight,l=this.totalWidth,u=!!this.props.error||!!n&&"token"in n;return this.renderCount++,a.a.createElement("div",{name:"outer-box",id:e&&e+"-outer-box",style:Dc({display:"block",overflow:"none",height:s,width:l,margin:0,boxSizing:"border-box",position:"relative"},o.outerBox)},i?a.a.createElement("div",{style:{opacity:u?0:1,height:"30px",width:"30px",position:"absolute",top:0,right:0,transform:"translate(-25%,25%)",pointerEvents:"none",transitionDuration:"0.2s",transitionTimingFunction:"cubic-bezier(0, 1, 0.5, 1)"}},a.a.createElement("svg",{height:"30px",width:"30px",viewBox:"0 0 100 100"},a.a.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",fill:"green",opacity:"0.85",d:"M39.363,79L16,55.49l11.347-11.419L39.694,56.49L72.983,23L84,34.085L39.363,79z"}))):void 0,a.a.createElement("div",{name:"container",id:e&&e+"-container",style:Dc({display:"block",height:s,width:l,margin:0,boxSizing:"border-box",overflow:"hidden",fontFamily:"Roboto, sans-serif"},o.container),onClick:this.onClick},a.a.createElement("div",{name:"warning-box",id:e&&e+"-warning-box",style:Dc({display:"block",overflow:"hidden",height:u?"60px":"0px",width:"100%",margin:0,backgroundColor:r.background_warning,transitionDuration:"0.2s",transitionTimingFunction:"cubic-bezier(0, 1, 0.5, 1)"},o.warningBox),onClick:this.onClick},a.a.createElement("span",{style:{display:"inline-block",height:"60px",width:"60px",margin:0,boxSizing:"border-box",overflow:"hidden",verticalAlign:"top",pointerEvents:"none"},onClick:this.onClick},a.a.createElement("div",{style:{position:"relative",top:0,left:0,height:"60px",width:"60px",margin:0,pointerEvents:"none"},onClick:this.onClick},a.a.createElement("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",pointerEvents:"none"},onClick:this.onClick},a.a.createElement("svg",{height:"25px",width:"25px",viewBox:"0 0 100 100"},a.a.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",fill:"red",d:"M73.9,5.75c0.467-0.467,1.067-0.7,1.8-0.7c0.7,0,1.283,0.233,1.75,0.7l16.8,16.8 c0.467,0.5,0.7,1.084,0.7,1.75c0,0.733-0.233,1.334-0.7,1.801L70.35,50l23.9,23.95c0.5,0.467,0.75,1.066,0.75,1.8 c0,0.667-0.25,1.25-0.75,1.75l-16.8,16.75c-0.534,0.467-1.117,0.7-1.75,0.7s-1.233-0.233-1.8-0.7L50,70.351L26.1,94.25 c-0.567,0.467-1.167,0.7-1.8,0.7c-0.667,0-1.283-0.233-1.85-0.7L5.75,77.5C5.25,77,5,76.417,5,75.75c0-0.733,0.25-1.333,0.75-1.8 L29.65,50L5.75,26.101C5.25,25.667,5,25.066,5,24.3c0-0.666,0.25-1.25,0.75-1.75l16.8-16.8c0.467-0.467,1.05-0.7,1.75-0.7 c0.733,0,1.333,0.233,1.8,0.7L50,29.65L73.9,5.75z"}))))),a.a.createElement("span",{style:{display:"inline-block",height:"60px",width:"calc(100% - 60px)",margin:0,overflow:"hidden",verticalAlign:"top",position:"absolute",pointerEvents:"none"},onClick:this.onClick},this.renderErrorMessage())),a.a.createElement("div",{name:"body",id:e&&e+"-body",style:Dc({display:"flex",overflow:"none",height:u?"calc(100% - 60px)":"100%",width:"",margin:0,resize:"none",fontFamily:"Roboto Mono, Monaco, monospace",fontSize:"11px",backgroundColor:r.background,transitionDuration:"0.2s",transitionTimingFunction:"cubic-bezier(0, 1, 0.5, 1)"},o.body),onClick:this.onClick},a.a.createElement("span",{name:"labels",id:e&&e+"-labels",ref:e=>this.refLabels=e,style:Dc({display:"inline-block",boxSizing:"border-box",verticalAlign:"top",height:"100%",width:"44px",margin:0,padding:"5px 0px 5px 10px",overflow:"hidden",color:"#D4D4D4"},o.labelColumn),onClick:this.onClick},this.renderLabels()),a.a.createElement("span",{id:e,ref:e=>this.refContent=e,contentEditable:!0,style:Dc({display:"inline-block",boxSizing:"border-box",verticalAlign:"top",height:"100%",width:"",flex:1,margin:0,padding:"5px",overflowX:"hidden",overflowY:"auto",wordWrap:"break-word",whiteSpace:"pre-line",color:"#D4D4D4",outline:"none"},o.contentBox),dangerouslySetInnerHTML:this.createMarkup(t),onKeyPress:this.onKeyPress,onKeyDown:this.onKeyDown,onClick:this.onClick,onBlur:this.onBlur,onScroll:this.onScroll,onPaste:this.onPaste,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1}))))}renderErrorMessage(){const e=this.props.locale||Pc,t=this.props.error||this.state.error,n=this.style;if(t)return a.a.createElement("p",{style:Dc({color:"red",fontSize:"12px",position:"absolute",width:"calc(100% - 60px)",height:"60px",boxSizing:"border-box",margin:0,padding:0,paddingRight:"10px",overflowWrap:"break-word",display:"flex",flexDirection:"column",justifyContent:"center"},n.errorMessage)},Ec(e.format,t))}renderLabels(){const e=this.colors,t=this.style,n=this.props.error||this.state.error,r=n?n.line:-1,o=this.state.lines?this.state.lines:1;let i=new Array(o);for(var s=0;s<o-1;s++)i[s]=s+1;return i.map(n=>{const o=n!==r?e.default:"red";return a.a.createElement("div",{key:n,style:Dc({},t.labels,{color:o})},n)})}createMarkup(e){return void 0===e?{__html:""}:{__html:""+e}}newSpan(e,t,n){let r=this.colors,a=t.type,o=t.string,i="";switch(a){case"string":case"number":case"primitive":case"error":i=r[t.type];break;case"key":i=" "===o?r.keys_whiteSpace:r.keys;break;case"symbol":i=":"===o?r.colon:r.default;break;default:i=r.default}return o.length!==o.replace(/</g,"").replace(/>/g,"").length&&(o="<xmp style=display:inline;>"+o+"</xmp>"),'<span type="'+a+'" value="'+o+'" depth="'+n+'" style="color:'+i+'">'+o+"</span>"}getCursorPosition(e){let t,n=window.getSelection(),r=-1,a=0;if(n.focusNode&&(e=>{for(;null!==e;){if(e===this.refContent)return!0;e=e.parentNode}return!1})(n.focusNode))for(t=n.focusNode,r=n.focusOffset;t&&t!==this.refContent;)if(t.previousSibling)t=t.previousSibling,e&&"BR"===t.nodeName&&a++,r+=t.textContent.length;else if(t=t.parentNode,null===t)break;return r+a}setCursorPosition(e){if([!1,null,void 0].indexOf(e)>-1)return;const t=(e,n,r)=>{if(r||((r=document.createRange()).selectNode(e),r.setStart(e,0)),0===n.count)r.setEnd(e,n.count);else if(e&&n.count>0)if(e.nodeType===Node.TEXT_NODE)e.textContent.length<n.count?n.count-=e.textContent.length:(r.setEnd(e,n.count),n.count=0);else for(var a=0;a<e.childNodes.length&&(r=t(e.childNodes[a],n,r),0!==n.count);a++);return r};e>0?(e=>{if(e<0)return;let n=window.getSelection(),r=t(this.refContent,{count:e});r&&(r.collapse(!1),n.removeAllRanges(),n.addRange(r))})(e):this.refContent.focus()}update(e=0,t=!0){const n=this.refContent,r=this.tokenize(n);"onChange"in this.props&&this.props.onChange({plainText:r.indented,markupText:r.markup,json:r.json,jsObject:r.jsObject,lines:r.lines,error:r.error});let a=this.getCursorPosition(r.error)+e;this.setState({plainText:r.indented,markupText:r.markup,json:r.json,jsObject:r.jsObject,lines:r.lines,error:r.error}),this.updateTime=!1,t&&this.setCursorPosition(a)}scheduledUpdate(){if("onKeyPressUpdate"in this.props&&!1===this.props.onKeyPressUpdate)return;const{updateTime:e}=this;!1!==e&&(e>(new Date).getTime()||this.update())}setUpdateTime(){"onKeyPressUpdate"in this.props&&!1===this.props.onKeyPressUpdate||(this.updateTime=(new Date).getTime()+this.waitAfterKeyPress)}stopEvent(e){e&&(e.preventDefault(),e.stopPropagation())}onKeyPress(e){const t=e.ctrlKey||e.metaKey;this.props.viewOnly&&!t&&this.stopEvent(e),t||this.setUpdateTime()}onKeyDown(e){const t=!!this.props.viewOnly,n=e.ctrlKey||e.metaKey;switch(e.key){case"Tab":if(this.stopEvent(e),t)break;document.execCommand("insertText",!1," "),this.setUpdateTime();break;case"Backspace":case"Delete":t&&this.stopEvent(e),this.setUpdateTime();break;case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"ArrowDown":this.setUpdateTime();break;case"a":case"c":t&&!n&&this.stopEvent(e);break;default:t&&this.stopEvent(e)}}onPaste(e){if(this.props.viewOnly)this.stopEvent(e);else{e.preventDefault();var t=e.clipboardData.getData("text/plain");document.execCommand("insertText",!1,t)}this.update()}onClick(){!("viewOnly"in this.props)||this.props.viewOnly}onBlur(){if("viewOnly"in this.props&&this.props.viewOnly)return;const e=this.refContent,t=this.tokenize(e);"onBlur"in this.props&&this.props.onBlur({plainText:t.indented,markupText:t.markup,json:t.json,jsObject:t.jsObject,lines:t.lines,error:t.error})}onScroll(e){this.refLabels.scrollTop=e.target.scrollTop}componentDidUpdate(){this.updateInternalProps(),this.showPlaceholder()}componentDidMount(){this.showPlaceholder()}componentWillUnmount(){this.timer&&clearInterval(this.timer)}showPlaceholder(){if(!("placeholder"in this.props))return;const{placeholder:e}=this.props;if([void 0,null].indexOf(e)>-1)return;const{prevPlaceholder:t,jsObject:n}=this.state,{resetConfiguration:r}=this,a=Object(Oc.getType)(e);-1===["object","array"].indexOf(a)&&xc.throwError("showPlaceholder","placeholder","either an object or an array");let o=!Object(Oc.identical)(e,t);if(o||r&&void 0!==n&&(o=!Object(Oc.identical)(e,n)),!o)return;const i=this.tokenize(e);this.setState({prevPlaceholder:e,plainText:i.indentation,markupText:i.markup,lines:i.lines,error:i.error})}tokenize(e){if("object"!=typeof e)return console.error("tokenize() expects object type properties only. Got '"+typeof e+"' type instead.");const t=this.props.locale||Pc,n=this.newSpan;if("nodeType"in e){const v=e.cloneNode(!0);if(!v.hasChildNodes())return"";const w=v.childNodes;let M={tokens_unknown:[],tokens_proto:[],tokens_split:[],tokens_fallback:[],tokens_normalize:[],tokens_merge:[],tokens_plainText:"",indented:"",json:"",jsObject:void 0,markup:""};for(var r=0;r<w.length;r++){let e=w[r],t={};switch(e.nodeName){case"SPAN":t={string:e.textContent,type:e.attributes.type.textContent},M.tokens_unknown.push(t);break;case"DIV":M.tokens_unknown.push({string:e.textContent,type:"unknown"});break;case"BR":""===e.textContent&&M.tokens_unknown.push({string:"\n",type:"unknown"});break;case"#text":M.tokens_unknown.push({string:e.wholeText,type:"unknown"});break;case"FONT":M.tokens_unknown.push({string:e.textContent,type:"unknown"});break;default:console.error("Unrecognized node:",{child:e})}}function a(e,t=""){let n={active:!1,string:"",number:"",symbol:"",space:"",delimiter:"",quarks:[]};function r(e,r){switch(r){case"symbol":case"delimiter":n.active&&n.quarks.push({string:n[n.active],type:t+"-"+n.active}),n[n.active]="",n.active=r,n[n.active]=e;break;default:r!==n.active||[n.string,e].indexOf("\n")>-1?(n.active&&n.quarks.push({string:n[n.active],type:t+"-"+n.active}),n[n.active]="",n.active=r,n[n.active]=e):n[r]+=e}}for(var a=0;a<e.length;a++){const t=e.charAt(a);switch(t){case'"':case"'":r(t,"delimiter");break;case" ":case" ":r(t,"space");break;case"{":case"}":case"[":case"]":case":":case",":r(t,"symbol");break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":"string"===n.active?r(t,"string"):r(t,"number");break;case"-":if(a<e.length-1&&"0123456789".indexOf(e.charAt(a+1))>-1){r(t,"number");break}case".":if(a<e.length-1&&a>0&&"0123456789".indexOf(e.charAt(a+1))>-1&&"0123456789".indexOf(e.charAt(a-1))>-1){r(t,"number");break}default:r(t,"string")}}return n.active&&(n.quarks.push({string:n[n.active],type:t+"-"+n.active}),n[n.active]="",n.active=!1),n.quarks}for(r=0;r<M.tokens_unknown.length;r++){let e=M.tokens_unknown[r];M.tokens_proto=M.tokens_proto.concat(a(e.string,"proto"))}function o(e,t){let n="",r="",a=!1;switch(t){case"primitive":if(-1===["true","false","null","undefined"].indexOf(e))return!1;break;case"string":if(e.length<2)return!1;if(n=e.charAt(0),r=e.charAt(e.length-1),a="'\"".indexOf(n),-1===a)return!1;if(n!==r)return!1;for(var o=0;o<e.length;o++)if(o>0&&o<e.length-1&&e.charAt(o)==="'\""[a]&&"\\"!==e.charAt(o-1))return!1;break;case"key":if(0===e.length)return!1;if(n=e.charAt(0),r=e.charAt(e.length-1),a="'\"".indexOf(n),a>-1){if(1===e.length)return!1;if(n!==r)return!1;for(o=0;o<e.length;o++)if(o>0&&o<e.length-1&&e.charAt(o)==="'\""[a]&&"\\"!==e.charAt(o-1))return!1}else{const t="'\"`.,:;{}[]&<>=~*%\\|/-+!?@^  ";for(o=0;o<t.length;o++){const n=t.charAt(o);if(e.indexOf(n)>-1)return!1}}break;case"number":for(o=0;o<e.length;o++)if(-1==="0123456789".indexOf(e.charAt(o)))if(0===o){if("-"!==e.charAt(0))return!1}else if("."!==e.charAt(o))return!1;break;case"symbol":if(e.length>1)return!1;if(-1==="{[:]},".indexOf(e))return!1;break;case"colon":if(e.length>1)return!1;if(":"!==e)return!1;break;default:return!0}return!0}for(r=0;r<M.tokens_proto.length;r++){let e=M.tokens_proto[r];-1===e.type.indexOf("proto")?o(e.string,e.type)?M.tokens_split.push(e):M.tokens_split=M.tokens_split.concat(a(e.string,"split")):M.tokens_split.push(e)}for(r=0;r<M.tokens_split.length;r++){let e=M.tokens_split[r],t=e.type,n=e.string,a=n.length,o=[];t.indexOf("-")>-1&&(t=t.slice(t.indexOf("-")+1),"string"!==t&&o.push("string"),o.push("key"),o.push("error"));let i={string:n,length:a,type:t,fallback:o};M.tokens_fallback.push(i)}function i(){const e=M.tokens_normalize.length-1;if(e<1)return!1;for(var t=e;t>=0;t--){const e=M.tokens_normalize[t];switch(e.type){case"space":case"linebreak":break;default:return e}}return!1}let k={brackets:[],stringOpen:!1,isValue:!1};for(r=0;r<M.tokens_fallback.length;r++){let e=M.tokens_fallback[r];const t=e.type,n=e.string;let a={type:t,string:n};switch(t){case"symbol":case"colon":if(k.stringOpen){k.isValue?a.type="string":a.type="key";break}switch(n){case"[":case"{":k.brackets.push(n),k.isValue="["===k.brackets[k.brackets.length-1];break;case"]":case"}":k.brackets.pop(),k.isValue="["===k.brackets[k.brackets.length-1];break;case",":if("colon"===i().type)break;k.isValue="["===k.brackets[k.brackets.length-1];break;case":":a.type="colon",k.isValue=!0}break;case"delimiter":if(k.isValue?a.type="string":a.type="key",!k.stringOpen){k.stringOpen=n;break}if(r>0){const e=M.tokens_fallback[r-1],t=e.string,n=e.type,a=t.charAt(t.length-1);if("string"===n&&"\\"===a)break}if(k.stringOpen===n){k.stringOpen=!1;break}break;case"primitive":case"string":if(["false","true","null","undefined"].indexOf(n)>-1){const e=M.tokens_normalize.length-1;if(e>=0){if("string"!==M.tokens_normalize[e].type){a.type="primitive";break}a.type="string";break}a.type="primitive";break}if("\n"===n&&!k.stringOpen){a.type="linebreak";break}k.isValue?a.type="string":a.type="key";break;case"space":case"number":k.stringOpen&&(k.isValue?a.type="string":a.type="key")}M.tokens_normalize.push(a)}for(r=0;r<M.tokens_normalize.length;r++){const e=M.tokens_normalize[r];let t={string:e.string,type:e.type,tokens:[r]};if(-1===["symbol","colon"].indexOf(e.type)&&r+1<M.tokens_normalize.length){let n=0;for(var s=r+1;s<M.tokens_normalize.length;s++){const r=M.tokens_normalize[s];if(e.type!==r.type)break;t.string+=r.string,t.tokens.push(s),n++}r+=n}M.tokens_merge.push(t)}const L="'\"",Y="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$";var l=!1,u=M.tokens_merge.length>0?1:0;function c(e,t,n=0){l={token:e,line:u,reason:t},M.tokens_merge[e+n].type="error"}function d(e,t){if(void 0===e&&console.error("tokenID argument must be an integer."),void 0===t&&console.error("options argument must be an array."),e===M.tokens_merge.length-1)return!1;for(var n=e+1;n<M.tokens_merge.length;n++){const e=M.tokens_merge[n];switch(e.type){case"space":case"linebreak":break;case"symbol":case"colon":return t.indexOf(e.string)>-1&&n;default:return!1}}return!1}function p(e,t){if(void 0===e&&console.error("tokenID argument must be an integer."),void 0===t&&console.error("options argument must be an array."),0===e)return!1;for(var n=e-1;n>=0;n--){const e=M.tokens_merge[n];switch(e.type){case"space":case"linebreak":break;case"symbol":case"colon":return t.indexOf(e.string)>-1;default:return!1}}return!1}function m(e){if(void 0===e&&console.error("tokenID argument must be an integer."),0===e)return!1;for(var t=e-1;t>=0;t--){const e=M.tokens_merge[t];switch(e.type){case"space":case"linebreak":break;default:return e.type}}return!1}k={brackets:[],stringOpen:!1,isValue:!1};let T=[];for(r=0;r<M.tokens_merge.length&&!l;r++){let e=M.tokens_merge[r],n=e.string,a=e.type,o=!1;switch(a){case"space":break;case"linebreak":u++;break;case"symbol":switch(n){case"{":case"[":if(o=p(r,["}","]"]),o){c(r,Ec(t.invalidToken.tokenSequence.prohibited,{firstToken:M.tokens_merge[o].string,secondToken:n}));break}if("["===n&&r>0&&!p(r,[":","[",","])){c(r,Ec(t.invalidToken.tokenSequence.permitted,{firstToken:"[",secondToken:[":","[",","]}));break}if("{"===n&&p(r,["{"])){c(r,Ec(t.invalidToken.double,{token:"{"}));break}k.brackets.push(n),k.isValue="["===k.brackets[k.brackets.length-1],T.push({i:r,line:u,string:n});break;case"}":case"]":if("}"===n&&"{"!==k.brackets[k.brackets.length-1]){c(r,Ec(t.brace.curly.missingOpen));break}if("}"===n&&p(r,[","])){c(r,Ec(t.invalidToken.tokenSequence.prohibited,{firstToken:",",secondToken:"}"}));break}if("]"===n&&"["!==k.brackets[k.brackets.length-1]){c(r,Ec(t.brace.square.missingOpen));break}if("]"===n&&p(r,[":"])){c(r,Ec(t.invalidToken.tokenSequence.prohibited,{firstToken:":",secondToken:"]"}));break}k.brackets.pop(),k.isValue="["===k.brackets[k.brackets.length-1],T.push({i:r,line:u,string:n});break;case",":if(o=p(r,["{"]),o){if(d(r,["}"])){c(r,Ec(t.brace.curly.cannotWrap,{token:","}));break}c(r,Ec(t.invalidToken.tokenSequence.prohibited,{firstToken:"{",secondToken:","}));break}if(d(r,["}",",","]"])){c(r,Ec(t.noTrailingOrLeadingComma));break}switch(o=m(r),o){case"key":case"colon":c(r,Ec(t.invalidToken.termSequence.prohibited,{firstTerm:"key"===o?t.types.key:t.symbols.colon,secondTerm:t.symbols.comma}));break;case"symbol":if(p(r,["{"])){c(r,Ec(t.invalidToken.tokenSequence.prohibited,{firstToken:"{",secondToken:","}));break}}k.isValue="["===k.brackets[k.brackets.length-1]}M.json+=n;break;case"colon":if(o=p(r,["["]),o&&d(r,["]"])){c(r,Ec(t.brace.square.cannotWrap,{token:":"}));break}if(o){c(r,Ec(t.invalidToken.tokenSequence.prohibited,{firstToken:"[",secondToken:":"}));break}if("key"!==m(r)){c(r,Ec(t.invalidToken.termSequence.permitted,{firstTerm:t.symbols.colon,secondTerm:t.types.key}));break}if(d(r,["}","]"])){c(r,Ec(t.invalidToken.termSequence.permitted,{firstTerm:t.symbols.colon,secondTerm:t.types.value}));break}k.isValue=!0,M.json+=n;break;case"key":case"string":let e=n.charAt(0),i=n.charAt(n.length-1);L.indexOf(e);if(-1===L.indexOf(e)&&-1!==L.indexOf(i)){c(r,Ec(t.string.missingOpen,{quote:e}));break}if(-1===L.indexOf(i)&&-1!==L.indexOf(e)){c(r,Ec(t.string.missingClose,{quote:e}));break}if(L.indexOf(e)>-1&&e!==i){c(r,Ec(t.string.missingClose,{quote:e}));break}if("string"===a&&-1===L.indexOf(e)&&-1===L.indexOf(i)){c(r,Ec(t.string.mustBeWrappedByQuotes));break}if("key"===a&&d(r,["}","]"])&&c(r,Ec(t.invalidToken.termSequence.permitted,{firstTerm:t.types.key,secondTerm:t.symbols.colon})),-1===L.indexOf(e)&&-1===L.indexOf(i))for(var h=0;h<n.length&&!l;h++){const e=n.charAt(h);if(-1===Y.indexOf(e)){c(r,Ec(t.string.nonAlphanumeric,{token:e}));break}}if("'"===e?n='"'+n.slice(1,-1)+'"':'"'!==e&&(n='"'+n+'"'),"key"===a&&"key"===m(r)){if(r>0&&!isNaN(M.tokens_merge[r-1])){M.tokens_merge[r-1]+=M.tokens_merge[r],c(r,Ec(t.key.numberAndLetterMissingQuotes));break}c(r,Ec(t.key.spaceMissingQuotes));break}if("key"===a&&!p(r,["{",","])){c(r,Ec(t.invalidToken.tokenSequence.permitted,{firstToken:a,secondToken:["{",","]}));break}if("string"===a&&!p(r,["[",":",","])){c(r,Ec(t.invalidToken.tokenSequence.permitted,{firstToken:a,secondToken:["[",":",","]}));break}if("key"===a&&k.isValue){c(r,Ec(t.string.unexpectedKey));break}if("string"===a&&!k.isValue){c(r,Ec(t.key.unexpectedString));break}M.json+=n;break;case"number":case"primitive":if(p(r,["{"]))M.tokens_merge[r].type="key",a=M.tokens_merge[r].type,n='"'+n+'"';else if("key"===m(r))M.tokens_merge[r].type="key",a=M.tokens_merge[r].type;else if(!p(r,["[",":",","])){c(r,Ec(t.invalidToken.tokenSequence.permitted,{firstToken:a,secondToken:["[",":",","]}));break}"key"!==a&&(k.isValue||(M.tokens_merge[r].type="key",a=M.tokens_merge[r].type,n='"'+n+'"')),"primitive"===a&&"undefined"===n&&c(r,Ec(t.invalidToken.useInstead,{badToken:"undefined",goodToken:"null"})),M.json+=n}}let D="";for(r=0;r<M.json.length;r++){let e=M.json.charAt(r),t="";r+1<M.json.length&&(t=M.json.charAt(r+1),"\\"===e&&"'"===t)?(D+=t,r++):D+=e}if(M.json=D,!l){const e=Math.ceil(T.length/2);let n=0,r=!1;function f(e){T.splice(e+1,1),T.splice(e,1),r||(r=!0)}for(;T.length>0;){r=!1;for(var _=0;_<T.length-1;_++){const e=T[_].string+T[_+1].string;["[]","{}"].indexOf(e)>-1&&f(_)}if(n++,!r)break;if(n>=e)break}if(T.length>0){const e=T[0].string,n=T[0].i,r="["===e?"]":"}";u=T[0].line,c(n,Ec(t.brace["]"===r?"square":"curly"].missingClose))}}if(!l&&-1===[void 0,""].indexOf(M.json))try{M.jsObject=JSON.parse(M.json)}catch(e){const n=e.message,r=n.indexOf("position");if(-1===r)throw new Error("Error parsing failed");const a=n.substring(r+9,n.length),o=parseInt(a);let i=0,s=0,d=!1,p=1,m=!1;for(;i<o&&!m&&(d=M.tokens_merge[s],"linebreak"===d.type&&p++,-1===["space","linebreak"].indexOf(d.type)&&(i+=d.string.length),!(i>=o));)s++,M.tokens_merge[s+1]||(m=!0);u=p;let h=0;for(let e=0;e<d.string.length;e++){const n=d.string.charAt(e);"\\"===n?h=h>0?h+1:1:(h%2==0&&0!==h||-1==="'\"bfnrt".indexOf(n)&&c(s,Ec(t.invalidToken.unexpected,{token:"\\"})),h=0)}l||c(s,Ec(t.invalidToken.unexpected,{token:d.string}))}let S=1,O=0;function y(e=!1){return function(e=!1){return S++,O>0||e?"<br>":""}(e)+function(){for(var e=[],t=0;t<2*O;t++)e.push("&nbsp;");return e.join("")}()}if(!l)for(r=0;r<M.tokens_merge.length;r++){const e=M.tokens_merge[r],t=e.string;switch(e.type){case"space":case"linebreak":break;case"string":case"number":case"primitive":case"error":M.markup+=(p(r,[",","["])?y():"")+n(r,e,O);break;case"key":M.markup+=y()+n(r,e,O);break;case"colon":M.markup+=n(r,e,O)+"&nbsp;";break;case"symbol":switch(t){case"[":case"{":M.markup+=(p(r,[":"])?"":y())+n(r,e,O),O++;break;case"]":case"}":O--;const t=r===M.tokens_merge.length-1,a=r>0?["[","{"].indexOf(M.tokens_merge[r-1].string)>-1?"":y(t):"";M.markup+=a+n(r,e,O);break;case",":M.markup+=n(r,e,O)}}}if(l){let e=1;function b(e){let t=0;for(var n=0;n<e.length;n++)["\n","\r"].indexOf(e[n])>-1&&t++;return t}S=1;for(r=0;r<M.tokens_merge.length;r++){const t=M.tokens_merge[r],a=t.type,o=t.string;"linebreak"===a&&S++,M.markup+=n(r,t,O),e+=b(o)}S++,e++,S<e&&(S=e)}for(r=0;r<M.tokens_merge.length;r++){let e=M.tokens_merge[r];M.indented+=e.string,-1===["space","linebreak"].indexOf(e.type)&&(M.tokens_plainText+=e.string)}if(l){"modifyErrorText"in this.props&&((g=this.props.modifyErrorText)&&"[object Function]"==={}.toString.call(g)&&(l.reason=this.props.modifyErrorText(l.reason)))}return{tokens:M.tokens_merge,noSpaces:M.tokens_plainText,indented:M.indented,json:M.json,jsObject:M.jsObject,markup:M.markup,lines:S,error:l}}var g;if(!("nodeType"in e)){let t={inputText:JSON.stringify(e),position:0,currentChar:"",tokenPrimary:"",tokenSecondary:"",brackets:[],isValue:!1,stringOpen:!1,stringStart:0,tokens:[]};function v(){return"\\"===t.currentChar}function w(){if(-1==="'\"".indexOf(t.currentChar))return!1;if(!t.stringOpen)return k(),t.stringStart=t.position,t.stringOpen=t.currentChar,!0;if(t.stringOpen===t.currentChar){k();return L(t.inputText.substring(t.stringStart,t.position+1)),t.stringOpen=!1,!0}return!1}function M(){if(-1===":,{}[]".indexOf(t.currentChar))return!1;if(t.stringOpen)return!1;switch(k(),L(t.currentChar),t.currentChar){case":":return t.isValue=!0,!0;case"{":case"[":t.brackets.push(t.currentChar);break;case"}":case"]":t.brackets.pop()}return":"!==t.currentChar&&(t.isValue="["===t.brackets[t.brackets.length-1]),!0}function k(){return 0!==t.tokenSecondary.length&&(t.tokens.push(t.tokenSecondary),t.tokenSecondary="",!0)}function L(e){return 0!==e.length&&(t.tokens.push(e),!0)}for(r=0;r<t.inputText.length;r++){t.position=r,t.currentChar=t.inputText.charAt(t.position);const e=M(),n=w(),a=v();e||n||a||t.stringOpen||(t.tokenSecondary+=t.currentChar)}let a={brackets:[],isValue:!1,tokens:[]};a.tokens=t.tokens.map(e=>{let t="",n="",r="";switch(e){case",":t="symbol",n=e,r=e,a.isValue="["===a.brackets[a.brackets.length-1];break;case":":t="symbol",n=e,r=e,a.isValue=!0;break;case"{":case"[":t="symbol",n=e,r=e,a.brackets.push(e),a.isValue="["===a.brackets[a.brackets.length-1];break;case"}":case"]":t="symbol",n=e,r=e,a.brackets.pop(),a.isValue="["===a.brackets[a.brackets.length-1];break;case"undefined":t="primitive",n=e,r=void 0;break;case"null":t="primitive",n=e,r=null;break;case"false":t="primitive",n=e,r=!1;break;case"true":t="primitive",n=e,r=!0;break;default:const i=e.charAt(0);if("'\"".indexOf(i)>-1){if(t=a.isValue?"string":"key","key"===t&&(n=function(e){if(0===e.length)return e;if(['""',"''"].indexOf(e)>-1)return"''";let t=!1;for(var n=0;n<2;n++)if([e.charAt(0),e.charAt(e.length-1)].indexOf(['"',"'"][n])>-1){t=!0;break}t&&e.length>=2&&(e=e.slice(1,-1));const r=e.replace(/\w/g,""),a=(e.replace(/\W+/g,""),((e,t)=>{let n=!1;for(var r=0;r<t.length&&(0!==r||!isNaN(t.charAt(r)));r++)if(isNaN(t.charAt(r))){n=!0;break}return!(e.length>0||n)})(r,e));if((e=>{for(var t=0;t<e.length;t++)if(["'",'"'].indexOf(e.charAt(t))>-1)return!0;return!1})(r)){let t="";const n=e.split("");for(var o=0;o<n.length;o++){let e=n[o];["'",'"'].indexOf(e)>-1&&(e="\\"+e),t+=e}e=t}return a?e:"'"+e+"'"}(e)),"string"===t){n="";const t=e.slice(1,-1).split("");for(var o=0;o<t.length;o++){let e=t[o];"'\"".indexOf(e)>-1&&(e="\\"+e),n+=e}n="'"+n+"'"}r=n;break}if(!isNaN(e)){t="number",n=e,r=Number(e);break}if(e.length>0&&!a.isValue){t="key",n=e,n.indexOf(" ")>-1&&(n="'"+n+"'"),r=n;break}}return{type:t,string:n,value:r,depth:a.brackets.length}});let o="";for(r=0;r<a.tokens.length;r++){o+=a.tokens[r].string}function Y(e){for(var t=[],n=0;n<2*e;n++)t.push(" ");return(e>0?"\n":"")+t.join("")}let i="";for(r=0;r<a.tokens.length;r++){let e=a.tokens[r];switch(e.string){case"[":case"{":const t=r<a.tokens.length-1-1?a.tokens[r+1]:"";-1==="}]".indexOf(t.string)?i+=e.string+Y(e.depth):i+=e.string;break;case"]":case"}":const n=r>0?a.tokens[r-1]:"";-1==="[{".indexOf(n.string)?i+=Y(e.depth)+e.string:i+=e.string;break;case":":i+=e.string+" ";break;case",":i+=e.string+Y(e.depth);break;default:i+=e.string}}let s=1;function T(e){var t=[];e>0&&s++;for(var n=0;n<2*e;n++)t.push("&nbsp;");return(e>0?"<br>":"")+t.join("")}let l="";const u=a.tokens.length-1;for(r=0;r<a.tokens.length;r++){let e=a.tokens[r],t=n(r,e,e.depth);switch(e.string){case"{":case"[":const n=r<a.tokens.length-1-1?a.tokens[r+1]:"";-1==="}]".indexOf(n.string)?l+=t+T(e.depth):l+=t;break;case"}":case"]":const o=r>0?a.tokens[r-1]:"";-1==="[{".indexOf(o.string)?l+=T(e.depth)+(u===r?"<br>":"")+t:l+=t;break;case":":l+=t+" ";break;case",":l+=t+T(e.depth);break;default:l+=t}}return s+=2,{tokens:a.tokens,noSpaces:o,indented:i,json:JSON.stringify(e),jsObject:e,markup:l,lines:s}}}}var Hc=Cc,zc=n(133),Ac=n.n(zc);function Rc(e){return(Rc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Nc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Fc(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Wc(e,t){return(Wc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Ic(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Uc(e);if(t){var a=Uc(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return Bc(this,n)}}function Bc(e,t){if(t&&("object"===Rc(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Jc(e)}function Jc(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Uc(e){return(Uc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Gc=wp.i18n.__,Vc=wp.element.Component,qc=wp.components,$c=qc.ExternalLink,Kc=qc.PanelBody,Zc=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Wc(e,t)}(o,e);var t,n,r,a=Ic(o);function o(){var e;return Nc(this,o),(e=a.apply(this,arguments)).isValidJSON=e.isValidJSON.bind(Jc(e)),e}return t=o,(n=[{key:"isValidJSON",value:function(e){try{JSON.parse(e)}catch(e){return!1}return!0}},{key:"render",value:function(){var e,t=this,n=this.props.chart["visualizer-settings"];return e=0<=["gauge","tabular","timeline"].indexOf(this.props.chart["visualizer-chart-type"])?this.props.chart["visualizer-chart-type"]:"".concat(this.props.chart["visualizer-chart-type"],"chart"),wp.element.createElement(Kc,{title:Gc("Manual Configuration"),initialOpen:!1,className:"visualizer-advanced-panel"},wp.element.createElement("p",null,Gc("Configure the graph by providing configuration variables right from the Google Visualization API.")),wp.element.createElement("p",null,wp.element.createElement($c,{href:"https://developers.google.com/chart/interactive/docs/gallery/".concat(e,"#configuration-options")},Gc("Google Visualization API"))),wp.element.createElement(Hc,{locale:Ac.a,theme:"light_mitsuketa_tribute",placeholder:Z(n.manual)?JSON.parse(n.manual):{},width:"100%",height:"250px",style:{errorMessage:{height:"100%",fontSize:"10px"},container:{border:"1px solid #ddd",boxShadow:"inset 0 1px 2px rgba(0,0,0,.07)"},labelColumn:{background:"#F5F5F5",width:"auto",padding:"5px 10px 5px 10px"}},onChange:function(e){!1===e.error&&(n.manual=e.json,t.props.edit(n))}}))}}])&&Fc(t.prototype,n),r&&Fc(t,r),Object.defineProperty(t,"prototype",{writable:!1}),o}(Vc);function Qc(e){return(Qc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Xc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ed(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function td(e,t){return(td=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function nd(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ad(e);if(t){var a=ad(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return rd(this,n)}}function rd(e,t){if(t&&("object"===Qc(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function ad(e){return(ad=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var od=wp.element,id=od.Component,sd=od.Fragment,ld=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&td(e,t)}(o,e);var t,n,r,a=nd(o);function o(){return Xc(this,o),a.apply(this,arguments)}return t=o,(n=[{key:"render",value:function(){var e=this.props.chart["visualizer-chart-type"],t=this.props.chart["visualizer-chart-library"];return wp.element.createElement(sd,null,wp.element.createElement(Ir,{chart:this.props.chart,attributes:this.props.attributes,edit:this.props.edit}),wp.element.createElement(Sr,{chart:this.props.chart,edit:this.props.edit}),-1>=["tabular","dataTable","gauge","geo","pie","timeline"].indexOf(e)&&wp.element.createElement(sa,{chart:this.props.chart,edit:this.props.edit}),-1>=["tabular","dataTable","gauge","geo","pie","timeline"].indexOf(e)&&wp.element.createElement(Ta,{chart:this.props.chart,edit:this.props.edit}),0<=["pie"].indexOf(e)&&wp.element.createElement(sd,null,wp.element.createElement(Ua,{chart:this.props.chart,edit:this.props.edit}),wp.element.createElement(io,{chart:this.props.chart,edit:this.props.edit})),0<=["area","scatter","line"].indexOf(e)&&wp.element.createElement(ko,{chart:this.props.chart,edit:this.props.edit}),0<=["bar","column"].indexOf(e)&&wp.element.createElement(Ao,{chart:this.props.chart,edit:this.props.edit}),0<=["candlestick"].indexOf(e)&&wp.element.createElement(Xo,{chart:this.props.chart,edit:this.props.edit}),0<=["geo"].indexOf(e)&&wp.element.createElement(sd,null,wp.element.createElement(hi,{chart:this.props.chart,edit:this.props.edit}),wp.element.createElement(Oi,{chart:this.props.chart,edit:this.props.edit}),wp.element.createElement(Ui,{chart:this.props.chart,edit:this.props.edit}),wp.element.createElement(os,{chart:this.props.chart,edit:this.props.edit})),0<=["gauge"].indexOf(e)&&wp.element.createElement(ks,{chart:this.props.chart,edit:this.props.edit}),0<=["timeline"].indexOf(e)&&wp.element.createElement(Ns,{chart:this.props.chart,edit:this.props.edit}),0<=["tabular","dataTable"].indexOf(e)&&wp.element.createElement(sd,null,wp.element.createElement(nl,{chart:this.props.chart,edit:this.props.edit}),wp.element.createElement(gl,{chart:this.props.chart,edit:this.props.edit})),0<=["combo"].indexOf(e)&&wp.element.createElement(El,{chart:this.props.chart,edit:this.props.edit}),-1>=["timeline","bubble","gauge","geo","pie","tabular","dataTable"].indexOf(e)&&wp.element.createElement(Zl,{chart:this.props.chart,edit:this.props.edit}),"tabular"===e&&"GoogleCharts"===t&&wp.element.createElement(Zl,{chart:this.props.chart,edit:this.props.edit}),0<=["bubble"].indexOf(e)&&wp.element.createElement(Su,{chart:this.props.chart,edit:this.props.edit}),0<=["pie"].indexOf(e)&&wp.element.createElement(pu,{chart:this.props.chart,edit:this.props.edit}),"DataTable"===t&&wp.element.createElement(Ju,{chart:this.props.chart,edit:this.props.edit}),"DataTable"!==t&&wp.element.createElement(uc,{chart:this.props.chart,edit:this.props.edit}),wp.element.createElement(Yc,{chart:this.props.chart,edit:this.props.edit}),"DataTable"!==t&&wp.element.createElement(Zc,{chart:this.props.chart,edit:this.props.edit}))}}])&&ed(t.prototype,n),r&&ed(t,r),Object.defineProperty(t,"prototype",{writable:!1}),o}(id);function ud(e){return(ud="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function cd(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */cd=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},a=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",i=r.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function l(e,t,n,r){var a=t&&t.prototype instanceof d?t:d,o=Object.create(a.prototype),i=new k(r||[]);return o._invoke=function(e,t,n){var r="suspendedStart";return function(a,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===a)throw o;return Y()}for(n.method=a,n.arg=o;;){var i=n.delegate;if(i){var s=v(i,n);if(s){if(s===c)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var l=u(e,t,n);if("normal"===l.type){if(r=n.done?"completed":"suspendedYield",l.arg===c)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r="completed",n.method="throw",n.arg=l.arg)}}}(e,n,i),o}function u(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var c={};function d(){}function p(){}function m(){}var h={};s(h,a,(function(){return this}));var f=Object.getPrototypeOf,_=f&&f(f(L([])));_&&_!==t&&n.call(_,a)&&(h=_);var y=m.prototype=d.prototype=Object.create(h);function b(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function g(e,t){var r;this._invoke=function(a,o){function i(){return new t((function(r,i){!function r(a,o,i,s){var l=u(e[a],e,o);if("throw"!==l.type){var c=l.arg,d=c.value;return d&&"object"==ud(d)&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){r("next",e,i,s)}),(function(e){r("throw",e,i,s)})):t.resolve(d).then((function(e){c.value=e,i(c)}),(function(e){return r("throw",e,i,s)}))}s(l.arg)}(a,o,r,i)}))}return r=r?r.then(i,i):i()}}function v(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,v(e,t),"throw"===t.method))return c;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var r=u(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,c;var a=r.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,c):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,c)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function M(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function L(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:Y}}function Y(){return{value:void 0,done:!0}}return p.prototype=m,s(y,"constructor",m),s(m,"constructor",p),p.displayName=s(m,i,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,s(e,i,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},b(g.prototype),s(g.prototype,o,(function(){return this})),e.AsyncIterator=g,e.async=function(t,n,r,a,o){void 0===o&&(o=Promise);var i=new g(l(t,n,r,a),o);return e.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},b(y),s(y,i,"Generator"),s(y,a,(function(){return this})),s(y,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=L,k.prototype={constructor:k,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(M),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return i.type="throw",i.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var s=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(s&&l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,c):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),c},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),M(n),c}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;M(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:L(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),c}},e}function dd(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function pd(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){dd(o,r,a,i,s,"next",e)}function s(e){dd(o,r,a,i,s,"throw",e)}i(void 0)}))}}function md(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hd(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function fd(e,t){return(fd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _d(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=gd(e);if(t){var a=gd(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return yd(this,n)}}function yd(e,t){if(t&&("object"===ud(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return bd(e)}function bd(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function gd(e){return(gd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var vd=wp.i18n.__,wd=wp.apiFetch,Md=wp.element,kd=Md.Component,Ld=Md.Fragment,Yd=wp.components,Td=Yd.Button,Dd=Yd.PanelBody,Sd=Yd.SelectControl,Od=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&fd(e,t)}(s,e);var t,n,r,a,o,i=_d(s);function s(){var e;return md(this,s),(e=i.apply(this,arguments)).getPermissionData=e.getPermissionData.bind(bd(e)),e.state={users:[],roles:[]},e}return t=s,(n=[{key:"componentDidMount",value:(o=pd(cd().mark((function e(){var t,n,r;return cd().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("business"!==visualizerLocalize.isPro){e.next=14;break}if(void 0===(t=this.props.chart["visualizer-permissions"]).permissions){e.next=14;break}if(void 0===t.permissions.read||void 0===t.permissions.edit){e.next=14;break}if("users"!==t.permissions.read&&"users"!==t.permissions.edit){e.next=9;break}return e.next=7,wd({path:"/visualizer/v1/get-permission-data?type=users"});case 7:n=e.sent,this.setState({users:n});case 9:if("roles"!==t.permissions.read&&"roles"!==t.permissions.edit){e.next=14;break}return e.next=12,wd({path:"/visualizer/v1/get-permission-data?type=roles"});case 12:r=e.sent,this.setState({roles:r});case 14:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"getPermissionData",value:(a=pd(cd().mark((function e(t){var n,r;return cd().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("business"!==visualizerLocalize.isPro){e.next=11;break}if("users"!==t||0!==this.state.users.length){e.next=6;break}return e.next=4,wd({path:"/visualizer/v1/get-permission-data?type=".concat(t)});case 4:n=e.sent,this.setState({users:n});case 6:if("roles"!==t||0!==this.state.roles.length){e.next=11;break}return e.next=9,wd({path:"/visualizer/v1/get-permission-data?type=".concat(t)});case 9:r=e.sent,this.setState({roles:r});case 11:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"render",value:function(){var e=this,t=this.props.chart["visualizer-permissions"];return wp.element.createElement(Ld,null,"business"===visualizerLocalize.isPro?wp.element.createElement(Dd,{title:vd("Who can see this chart?"),initialOpen:!1,className:"vz-permission-tab"},wp.element.createElement(Sd,{label:vd("Select who can view the chart on the front-end."),value:t.permissions.read,options:[{value:"all",label:"All Users"},{value:"users",label:"Select Users"},{value:"roles",label:"Select Roles"}],onChange:function(n){t.permissions.read=n,e.props.edit(t),"users"!==n&&"roles"!==n||e.getPermissionData(n)}}),("users"===t.permissions.read||"roles"===t.permissions.read)&&wp.element.createElement(Sd,{multiple:!0,value:t.permissions["read-specific"],options:"users"===t.permissions.read&&this.state.users||"roles"===t.permissions.read&&this.state.roles,onChange:function(n){t.permissions["read-specific"]=n,e.props.edit(t)}})):wp.element.createElement(Dd,{title:vd("Who can see this chart?"),icon:"lock",initialOpen:!1},wp.element.createElement("p",null,vd("Upgrade your license to at least the DEVELOPER version to activate this feature!")),wp.element.createElement(Td,{isPrimary:!0,href:visualizerLocalize.proTeaser,target:"_blank"},vd("Buy Now"))),"business"===visualizerLocalize.isPro?wp.element.createElement(Dd,{title:vd("Who can edit this chart?"),initialOpen:!1,className:"vz-permission-tab"},wp.element.createElement(Sd,{label:vd("Select who can edit the chart on the front-end."),value:t.permissions.edit,options:[{value:"all",label:"All Users"},{value:"users",label:"Select Users"},{value:"roles",label:"Select Roles"}],onChange:function(n){t.permissions.edit=n,e.props.edit(t),"users"!==n&&"roles"!==n||e.getPermissionData(n)}}),("users"===t.permissions.edit||"roles"===t.permissions.edit)&&wp.element.createElement(Sd,{multiple:!0,value:t.permissions["edit-specific"],options:"users"===t.permissions.edit&&this.state.users||"roles"===t.permissions.edit&&this.state.roles,onChange:function(n){t.permissions["edit-specific"]=n,e.props.edit(t)}})):wp.element.createElement(Dd,{title:vd("Who can edit this chart?"),icon:"lock",initialOpen:!1},wp.element.createElement("p",null,vd("Upgrade your license to at least the DEVELOPER version to activate this feature!")),wp.element.createElement(Td,{isPrimary:!0,href:visualizerLocalize.proTeaser,target:"_blank"},vd("Buy Now"))))}}])&&hd(t.prototype,n),r&&hd(t,r),Object.defineProperty(t,"prototype",{writable:!1}),s}(kd),jd=n(134),xd=n.n(jd),Ed=wp.components,Pd=Ed.Button,Cd=Ed.Dashicon,Hd=Ed.G,zd=Ed.Path,Ad=Ed.SVG;var Rd=function(e){var t=e.label,n=e.icon,r=e.className,a=e.isBack,o=e.onClick,i=xd()("components-panel__body","components-panel__body-button",r,{"visualizer-panel-back":a});return wp.element.createElement("div",{className:i},wp.element.createElement("h2",{className:"components-panel__body-title"},wp.element.createElement(Pd,{className:"components-panel__body-toggle",onClick:o},wp.element.createElement(Ad,{className:"components-panel__arrow",width:"24px",height:"24px",viewBox:"-12 -12 48 48",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement(Hd,null,wp.element.createElement(zd,{fill:"none",d:"M0,0h24v24H0V0z"})),wp.element.createElement(Hd,null,wp.element.createElement(zd,{d:"M7.41,8.59L12,13.17l4.59-4.58L18,10l-6,6l-6-6L7.41,8.59z"}))),n&&wp.element.createElement(Cd,{icon:n,className:"components-panel__icon"}),t)))},Nd=n(3),Fd=n.n(Nd);function Wd(e){return(Wd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Id(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Bd(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Jd(e,t){return(Jd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Ud(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Vd(e);if(t){var a=Vd(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return Gd(this,n)}}function Gd(e,t){if(t&&("object"===Wd(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Vd(e){return(Vd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var qd=lodash.startCase,$d=wp.i18n.__,Kd=wp.element,Zd=Kd.Component,Qd=Kd.Fragment,Xd=(wp.blockEditor||wp.editor).InspectorControls,ep=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Jd(e,t)}(o,e);var t,n,r,a=Ud(o);function o(){var e;return Id(this,o),(e=a.apply(this,arguments)).state={route:"home"},e}return t=o,(n=[{key:"render",value:function(){var e,t,n=this,r="undefined"!=typeof google?google.visualization.Version:"current",a=V(JSON.parse(JSON.stringify(this.props.chart)));return 0<=["gauge","tabular","timeline"].indexOf(this.props.chart["visualizer-chart-type"])?"DataTable"===a["visualizer-chart-library"]?e=a["visualizer-chart-type"]:("tabular"===(e=this.props.chart["visualizer-chart-type"])&&(e="table"),e=qd(e)):e="".concat(qd(this.props.chart["visualizer-chart-type"]),"Chart"),a["visualizer-data-exploded"]&&(t=$d("Annotations in this chart may not display here but they will display in the front end.")),wp.element.createElement(Qd,null,"home"===this.state.route&&wp.element.createElement(Xd,null,wp.element.createElement(Ie,{chart:this.props.chart,readUploadedFile:this.props.readUploadedFile}),wp.element.createElement(xt,{id:this.props.id,chart:this.props.chart,editURL:this.props.editURL,isLoading:this.props.isLoading,uploadData:this.props.uploadData,editSchedule:this.props.editSchedule,editJSONSchedule:this.props.editJSONSchedule,editJSONURL:this.props.editJSONURL,editJSONHeaders:this.props.editJSONHeaders,editJSONRoot:this.props.editJSONRoot,editJSONPaging:this.props.editJSONPaging,JSONImportData:this.props.JSONImportData}),wp.element.createElement(Qt,{getChartData:this.props.getChartData,isLoading:this.props.isLoading}),wp.element.createElement(Cn,{chart:this.props.chart,editSchedule:this.props.editDatabaseSchedule,databaseImportData:this.props.databaseImportData}),wp.element.createElement(dr,{chart:this.props.chart,editChartData:this.props.editChartData}),wp.element.createElement(Rd,{label:$d("Advanced Options"),className:"visualizer-advanced-options",icon:"admin-tools",onClick:function(){return n.setState({route:"showAdvanced"})}}),wp.element.createElement(Rd,{label:$d("Chart Permissions"),icon:"admin-users",onClick:function(){return n.setState({route:"showPermissions"})}})),("showAdvanced"===this.state.route||"showPermissions"===this.state.route)&&wp.element.createElement(Xd,null,wp.element.createElement(Rd,{label:$d("Chart Settings"),onClick:function(){return n.setState({route:"home"})},isBack:!0}),"showAdvanced"===this.state.route&&wp.element.createElement(ld,{chart:this.props.chart,attributes:this.props.attributes,edit:this.props.editSettings}),"showPermissions"===this.state.route&&wp.element.createElement(Od,{chart:this.props.chart,edit:this.props.editPermissions})),wp.element.createElement("div",{className:"visualizer-settings__chart","data-chart-type":e},null!==this.props.chart&&"DataTable"===a["visualizer-chart-library"]?wp.element.createElement(I,{id:this.props.id,rows:a["visualizer-data"],columns:a["visualizer-series"],options:a["visualizer-settings"]}):(a["visualizer-data-exploded"],wp.element.createElement(S,{chartVersion:r,chartType:e,rows:a["visualizer-data"],columns:a["visualizer-series"],options:Z(this.props.chart["visualizer-settings"].manual)?Fd()($(this.props.chart["visualizer-settings"]),JSON.parse(this.props.chart["visualizer-settings"].manual)):$(this.props.chart["visualizer-settings"]),height:"500px",formatters:X(a)})),wp.element.createElement("div",{className:"visualizer-settings__charts-footer"},wp.element.createElement("sub",null,t))))}}])&&Bd(t.prototype,n),r&&Bd(t,r),Object.defineProperty(t,"prototype",{writable:!1}),o}(Zd);function tp(e){return(tp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function np(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rp(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ap(e,t){return(ap=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function op(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=sp(e);if(t){var a=sp(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return ip(this,n)}}function ip(e,t){if(t&&("object"===tp(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function sp(e){return(sp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var lp=lodash.startCase,up=wp.i18n.__,cp=wp.element,dp=cp.Component,pp=cp.Fragment,mp=wp.components,hp=mp.Button,fp=mp.Dashicon,_p=mp.Toolbar,yp=mp.Tooltip,bp=(wp.blockEditor||wp.editor).BlockControls,gp=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ap(e,t)}(o,e);var t,n,r,a=op(o);function o(){return np(this,o),a.apply(this,arguments)}return t=o,(n=[{key:"render",value:function(){var e,t,n="undefined"!=typeof google?google.visualization.Version:"current",r=V(JSON.parse(JSON.stringify(this.props.chart)));return 0<=["gauge","tabular","timeline"].indexOf(this.props.chart["visualizer-chart-type"])?"DataTable"===r["visualizer-chart-library"]?e=r["visualizer-chart-type"]:("tabular"===(e=this.props.chart["visualizer-chart-type"])&&(e="table"),e=lp(e)):e="".concat(lp(this.props.chart["visualizer-chart-type"]),"Chart"),r["visualizer-data-exploded"]&&(t=up("Annotations in this chart may not display here but they will display in the front end.")),this.props.chart["visualizer-series"]&&0<=["date","datetime","timeofday"].indexOf(this.props.chart["visualizer-series"][0].type)&&this.props.chart["visualizer-settings"]&&""==this.props.chart["visualizer-settings"].hAxis.format&&(this.props.chart["visualizer-settings"].hAxis.format="YYYY-MM-dd"),wp.element.createElement("div",{className:this.props.className},null!==this.props.chart&&wp.element.createElement(pp,null,wp.element.createElement(bp,{key:"toolbar-controls"},wp.element.createElement(_p,{className:"components-toolbar"},wp.element.createElement(yp,{text:up("Edit Chart")},wp.element.createElement(hp,{className:"components-icon-button components-toolbar__control edit-pie-chart",onClick:this.props.editChart},wp.element.createElement(fp,{icon:"edit"}))))),"DataTable"===r["visualizer-chart-library"]?wp.element.createElement(I,{id:this.props.id,rows:r["visualizer-data"],columns:r["visualizer-series"],options:r["visualizer-settings"]}):(r["visualizer-data-exploded"],wp.element.createElement(S,{chartVersion:n,chartType:e,rows:r["visualizer-data"],columns:r["visualizer-series"],options:Z(this.props.chart["visualizer-settings"].manual)?Fd()($(this.props.chart["visualizer-settings"]),JSON.parse(this.props.chart["visualizer-settings"].manual)):$(this.props.chart["visualizer-settings"]),height:"500px",formatters:X(r)})),wp.element.createElement("div",{className:"visualizer-settings__charts-footer"},wp.element.createElement("sub",null,t))))}}])&&rp(t.prototype,n),r&&rp(t,r),Object.defineProperty(t,"prototype",{writable:!1}),o}(dp);function vp(e){return(vp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Mp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function kp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Mp(Object(n),!0).forEach((function(t){Lp(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Mp(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Lp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Yp(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Yp=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},a=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",i=r.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function l(e,t,n,r){var a=t&&t.prototype instanceof d?t:d,o=Object.create(a.prototype),i=new k(r||[]);return o._invoke=function(e,t,n){var r="suspendedStart";return function(a,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===a)throw o;return Y()}for(n.method=a,n.arg=o;;){var i=n.delegate;if(i){var s=v(i,n);if(s){if(s===c)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var l=u(e,t,n);if("normal"===l.type){if(r=n.done?"completed":"suspendedYield",l.arg===c)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r="completed",n.method="throw",n.arg=l.arg)}}}(e,n,i),o}function u(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var c={};function d(){}function p(){}function m(){}var h={};s(h,a,(function(){return this}));var f=Object.getPrototypeOf,_=f&&f(f(L([])));_&&_!==t&&n.call(_,a)&&(h=_);var y=m.prototype=d.prototype=Object.create(h);function b(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function g(e,t){var r;this._invoke=function(a,o){function i(){return new t((function(r,i){!function r(a,o,i,s){var l=u(e[a],e,o);if("throw"!==l.type){var c=l.arg,d=c.value;return d&&"object"==vp(d)&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){r("next",e,i,s)}),(function(e){r("throw",e,i,s)})):t.resolve(d).then((function(e){c.value=e,i(c)}),(function(e){return r("throw",e,i,s)}))}s(l.arg)}(a,o,r,i)}))}return r=r?r.then(i,i):i()}}function v(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,v(e,t),"throw"===t.method))return c;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var r=u(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,c;var a=r.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,c):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,c)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function M(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function L(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:Y}}function Y(){return{value:void 0,done:!0}}return p.prototype=m,s(y,"constructor",m),s(m,"constructor",p),p.displayName=s(m,i,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,s(e,i,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},b(g.prototype),s(g.prototype,o,(function(){return this})),e.AsyncIterator=g,e.async=function(t,n,r,a,o){void 0===o&&(o=Promise);var i=new g(l(t,n,r,a),o);return e.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},b(y),s(y,i,"Generator"),s(y,a,(function(){return this})),s(y,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=L,k.prototype={constructor:k,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(M),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return i.type="throw",i.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var s=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(s&&l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,c):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),c},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),M(n),c}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;M(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:L(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),c}},e}function Tp(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function Dp(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Tp(o,r,a,i,s,"next",e)}function s(e){Tp(o,r,a,i,s,"throw",e)}i(void 0)}))}}function Sp(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Op(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function jp(e,t){return(jp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function xp(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Cp(e);if(t){var a=Cp(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return Ep(this,n)}}function Ep(e,t){if(t&&("object"===vp(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Pp(e)}function Pp(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Cp(e){return(Cp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Hp=wp.i18n.__,zp=wp,Ap=zp.apiFetch,Rp=zp.apiRequest,Np=wp.element,Fp=Np.Component,Wp=Np.Fragment,Ip=wp.components,Bp=Ip.Button,Jp=Ip.ButtonGroup,Up=Ip.Dashicon,Gp=Ip.Placeholder,Vp=Ip.Notice,qp=Ip.Spinner,$p=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&jp(e,t)}(l,e);var t,n,r,a,o,i,s=xp(l);function l(){var e;return Sp(this,l),(e=s.apply(this,arguments)).getChart=e.getChart.bind(Pp(e)),e.editChart=e.editChart.bind(Pp(e)),e.editSettings=e.editSettings.bind(Pp(e)),e.editPermissions=e.editPermissions.bind(Pp(e)),e.readUploadedFile=e.readUploadedFile.bind(Pp(e)),e.editURL=e.editURL.bind(Pp(e)),e.editSchedule=e.editSchedule.bind(Pp(e)),e.editJSONSchedule=e.editJSONSchedule.bind(Pp(e)),e.editJSONURL=e.editJSONURL.bind(Pp(e)),e.editJSONHeaders=e.editJSONHeaders.bind(Pp(e)),e.editJSONRoot=e.editJSONRoot.bind(Pp(e)),e.editJSONPaging=e.editJSONPaging.bind(Pp(e)),e.JSONImportData=e.JSONImportData.bind(Pp(e)),e.editDatabaseSchedule=e.editDatabaseSchedule.bind(Pp(e)),e.databaseImportData=e.databaseImportData.bind(Pp(e)),e.uploadData=e.uploadData.bind(Pp(e)),e.getChartData=e.getChartData.bind(Pp(e)),e.editChartData=e.editChartData.bind(Pp(e)),e.updateChart=e.updateChart.bind(Pp(e)),e.state={route:e.props.attributes.route?e.props.attributes.route:"home",chart:null,isModified:!1,isLoading:!1,isScheduled:!1},e}return t=l,(n=[{key:"componentDidMount",value:(i=Dp(Yp().mark((function e(){var t;return Yp().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.props.attributes.id){e.next=5;break}return e.next=3,Ap({path:"wp/v2/visualizer/".concat(this.props.attributes.id)}).catch((function(e){}));case 3:(t=e.sent)?this.setState({chart:t.chart_data}):this.setState({route:"error"});case 5:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"getChart",value:(o=Dp(Yp().mark((function e(t){var n;return Yp().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.setState({isLoading:"getChart"});case 2:return e.next=4,Ap({path:"wp/v2/visualizer/".concat(t)});case 4:n=e.sent,this.setState({route:"chartSelect",chart:n.chart_data,isLoading:!0,isModified:!0}),this.props.setAttributes({id:t,route:"chartSelect",lazy:-1});case 7:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"editChart",value:function(){this.setState({route:"chartSelect"}),this.props.setAttributes({route:"chartSelect"})}},{key:"editSettings",value:function(e){var t=kp({},this.state.chart);t["visualizer-settings"]=e,this.setState({chart:t,isModified:!0})}},{key:"editPermissions",value:function(e){var t=kp({},this.state.chart);t["visualizer-permissions"]=e,this.setState({chart:t,isModified:!0})}},{key:"readUploadedFile",value:function(e){var t=this,n=e.current.files[0],r=new FileReader;r.onload=function(){var e=function(e,t){t=t||",";for(var n=new RegExp("(\\"+t+"|\\r?\\n|\\r|^)(?:'([^']*(?:''[^']*)*)'|([^'\\"+t+"\\r\\n]*))","gi"),r=[[]],a=null;a=n.exec(e);){var o=a[1];o.length&&o!==t&&r.push([]);var i=void 0;i=a[2]?a[2].replace(new RegExp("''","g"),"'"):a[3],r[r.length-1].push(i)}return r}(r.result);t.editChartData(e,"Visualizer_Source_Csv")},r.readAsText(n)}},{key:"editURL",value:function(e){var t=kp({},this.state.chart);t["visualizer-chart-url"]=e,this.setState({chart:t})}},{key:"editSchedule",value:function(e){var t=kp({},this.state.chart);t["visualizer-chart-schedule"]=e,this.setState({chart:t,isModified:!0})}},{key:"editJSONSchedule",value:function(e){var t=kp({},this.state.chart);t["visualizer-json-schedule"]=e,this.setState({chart:t,isModified:!0})}},{key:"editJSONURL",value:function(e){var t=kp({},this.state.chart);t["visualizer-json-url"]=e,this.setState({chart:t})}},{key:"editJSONHeaders",value:function(e){var t=kp({},this.state.chart);delete e.username,delete e.password,t["visualizer-json-headers"]=e,this.setState({chart:t})}},{key:"editJSONRoot",value:function(e){var t=kp({},this.state.chart);t["visualizer-json-root"]=e,this.setState({chart:t})}},{key:"editJSONPaging",value:function(e){var t=kp({},this.state.chart);t["visualizer-json-paging"]=e,this.setState({chart:t})}},{key:"JSONImportData",value:function(e,t,n){var r=kp({},this.state.chart);r["visualizer-source"]=e,r["visualizer-default-data"]=0,r["visualizer-series"]=t,r["visualizer-data"]=n,this.setState({chart:r,isModified:!0})}},{key:"editDatabaseSchedule",value:function(e){var t=kp({},this.state.chart);t["visualizer-db-schedule"]=e,this.setState({chart:t,isModified:!0})}},{key:"databaseImportData",value:function(e,t,n,r){var a=kp({},this.state.chart);a["visualizer-source"]=t,a["visualizer-default-data"]=0,a["visualizer-series"]=n,a["visualizer-data"]=r,a["visualizer-db-query"]=e,this.setState({chart:a,isModified:!0})}},{key:"uploadData",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.setState({isLoading:"uploadData",isScheduled:t}),Rp({path:"/visualizer/v1/upload-data?url=".concat(this.state.chart["visualizer-chart-url"]),method:"POST"}).then((function(t){if(2<=Object.keys(t).length){var n=kp({},e.state.chart);n["visualizer-source"]="Visualizer_Source_Csv_Remote",n["visualizer-default-data"]=0,n["visualizer-series"]=t.series,n["visualizer-data"]=t.data;var r=n["visualizer-series"],a=n["visualizer-settings"],o=r,i="series";return"pie"===n["visualizer-chart-type"]&&(o=n["visualizer-data"],i="slices"),o.map((function(e,t){if("pie"===n["visualizer-chart-type"]||0!==t){var r="pie"!==n["visualizer-chart-type"]?t-1:t;void 0===a[i][r]&&(a[i][r]={},a[i][r].temp=1)}})),a[i]=a[i].filter((function(e,t){return t<("pie"!==n["visualizer-chart-type"]?o.length-1:o.length)})),n["visualizer-settings"]=a,e.setState({chart:n,isModified:!0,isLoading:!1}),t}e.setState({isLoading:!1})}),(function(t){return e.setState({isLoading:!1}),t}))}},{key:"getChartData",value:(a=Dp(Yp().mark((function e(t){var n,r;return Yp().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.setState({isLoading:"getChartData"});case 2:return e.next=4,Ap({path:"wp/v2/visualizer/".concat(t)});case 4:n=e.sent,(r=kp({},this.state.chart))["visualizer-source"]="Visualizer_Source_Csv",r["visualizer-default-data"]=0,r["visualizer-series"]=n.chart_data["visualizer-series"],r["visualizer-data"]=n.chart_data["visualizer-data"],this.setState({isLoading:!1,chart:r});case 11:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"editChartData",value:function(e,t){var n=kp({},this.state.chart),r=[],a=kp({},n["visualizer-settings"]),o=n["visualizer-chart-type"];e[0].map((function(t,n){r[n]={label:t,type:e[1][n]}})),e.splice(0,2);var i=r,s="series";switch(o){case"pie":i=e,s="slices",e.map((function(e,t){switch(r[1].type){case"number":e[1]=parseFloat(e[1])}}));break;case"tabular":e.map((function(e,t){r.map((function(t,n){switch(t.type){case"boolean":"string"==typeof e[n]&&(e[n]="true"===e[n])}}))}))}i.map((function(e,t){if("pie"===o||0!==t){var n="pie"!==o?t-1:t;Array.isArray(a[s])&&void 0===a[s][n]&&(a[s][n]={},a[s][n].temp=1)}})),Array.isArray(a[s])&&(a[s]=a[s].filter((function(e,t){return t<(-1>=["pie","tabular","dataTable"].indexOf(o)?i.length-1:i.length)}))),n["visualizer-source"]=t,n["visualizer-default-data"]=0,n["visualizer-data"]=e,n["visualizer-series"]=r,n["visualizer-settings"]=a,n["visualizer-chart-url"]="",this.setState({chart:n,isModified:!0,isScheduled:!1})}},{key:"updateChart",value:function(){var e=this;this.setState({isLoading:"updateChart"});var t=this.state.chart;!1===this.state.isScheduled&&(t["visualizer-chart-schedule"]="");var n="series";"pie"===t["visualizer-chart-type"]&&(n="slices"),-1>=["bubble","timeline"].indexOf(t["visualizer-chart-type"])&&Object.keys(t["visualizer-settings"][n]).map((function(e){void 0!==t["visualizer-settings"][n][e]&&void 0!==t["visualizer-settings"][n][e].temp&&delete t["visualizer-settings"][n][e].temp})),Rp({path:"/visualizer/v1/update-chart?id=".concat(this.props.attributes.id),method:"POST",data:t}).then((function(t){return e.setState({isLoading:!1,isModified:!1}),t}),(function(e){return e}))}},{key:"render",value:function(){var e=this;return"error"===this.state.route?wp.element.createElement(Vp,{status:"error",isDismissible:!1},wp.element.createElement(Up,{icon:"chart-pie"}),Hp("This chart is not available; it might have been deleted. Please delete this block and resubmit your chart.")):"renderChart"===this.state.route&&null!==this.state.chart?wp.element.createElement(gp,{id:this.props.attributes.id,chart:this.state.chart,className:this.props.className,editChart:this.editChart}):wp.element.createElement("div",{className:"visualizer-settings"},wp.element.createElement("div",{className:"visualizer-settings__title"},wp.element.createElement(Up,{icon:"chart-pie"}),Hp("Visualizer")),"home"===this.state.route&&wp.element.createElement("div",{className:"visualizer-settings__content"},wp.element.createElement("div",{className:"visualizer-settings__content-description"},Hp("Make a new chart or display an existing one?")),wp.element.createElement("a",{href:visualizerLocalize.adminPage,target:"_blank",className:"visualizer-settings__content-option"},wp.element.createElement("span",{className:"visualizer-settings__content-option-title"},Hp("Create a new chart")),wp.element.createElement("div",{className:"visualizer-settings__content-option-icon"},wp.element.createElement(Up,{icon:"arrow-right-alt2"}))),wp.element.createElement("div",{className:"visualizer-settings__content-option",onClick:function(){e.setState({route:"showCharts"}),e.props.setAttributes({route:"showCharts"})}},wp.element.createElement("span",{className:"visualizer-settings__content-option-title"},Hp("Display an existing chart")),wp.element.createElement("div",{className:"visualizer-settings__content-option-icon"},wp.element.createElement(Up,{icon:"arrow-right-alt2"})))),("getChart"===this.state.isLoading||"chartSelect"===this.state.route&&null===this.state.chart||"renderChart"===this.state.route&&null===this.state.chart)&&wp.element.createElement(Gp,null,wp.element.createElement(qp,null)),"showCharts"===this.state.route&&!1===this.state.isLoading&&wp.element.createElement(De,{getChart:this.getChart}),"chartSelect"===this.state.route&&null!==this.state.chart&&wp.element.createElement(ep,{id:this.props.attributes.id,attributes:this.props.attributes,chart:this.state.chart,editSettings:this.editSettings,editPermissions:this.editPermissions,url:this.state.url,readUploadedFile:this.readUploadedFile,editURL:this.editURL,editSchedule:this.editSchedule,editJSONURL:this.editJSONURL,editJSONHeaders:this.editJSONHeaders,editJSONSchedule:this.editJSONSchedule,editJSONRoot:this.editJSONRoot,editJSONPaging:this.editJSONPaging,JSONImportData:this.JSONImportData,editDatabaseSchedule:this.editDatabaseSchedule,databaseImportData:this.databaseImportData,uploadData:this.uploadData,getChartData:this.getChartData,editChartData:this.editChartData,isLoading:this.state.isLoading}),wp.element.createElement("div",{className:"visualizer-settings__controls"},("showCharts"===this.state.route||"chartSelect"===this.state.route)&&wp.element.createElement(Jp,null,wp.element.createElement(Bp,{isDefault:!0,isLarge:!0,onClick:function(){var t;"showCharts"===e.state.route?t="home":"chartSelect"===e.state.route&&(t="showCharts"),e.setState({route:t,isLoading:!1}),e.props.setAttributes({route:t})}},Hp("Back")),"chartSelect"===this.state.route&&wp.element.createElement(Wp,null,!1===this.state.isModified?wp.element.createElement(Bp,{isDefault:!0,isLarge:!0,className:"visualizer-bttn-done",onClick:function(){e.setState({route:"renderChart",isModified:!0}),e.props.setAttributes({route:"renderChart"})}},Hp("Done")):wp.element.createElement(Bp,{isPrimary:!0,isLarge:!0,className:"visualizer-bttn-save",isBusy:"updateChart"===this.state.isLoading,disabled:"updateChart"===this.state.isLoading,onClick:this.updateChart},Hp("Save"))))))}}])&&Op(t.prototype,n),r&&Op(t,r),Object.defineProperty(t,"prototype",{writable:!1}),l}(Fp),Kp=(n(153),wp.i18n.__),Zp=wp.blocks.registerBlockType;t.default=Zp("visualizer/chart",{title:Kp("Visualizer Chart"),description:Kp("A simple, easy to use and quite powerful tool to create, manage and embed interactive charts into your WordPress posts and pages."),category:"common",icon:"chart-pie",keywords:[Kp("Visualizer"),Kp("Chart"),Kp("Google Charts")],attributes:{id:{type:"number"},lazy:{default:"-1",type:"string"},route:{type:"string"}},supports:{customClassName:!1},edit:$p,save:function(){return null}})}]);
classes/Visualizer/Gutenberg/src/Components/ChartPermissions.js CHANGED
@@ -73,6 +73,7 @@ class ChartPermissions extends Component {
73
  <PanelBody
74
  title={ __( 'Who can see this chart?' ) }
75
  initialOpen={ false }
 
76
  >
77
 
78
  <SelectControl
@@ -128,6 +129,7 @@ class ChartPermissions extends Component {
128
  <PanelBody
129
  title={ __( 'Who can edit this chart?' ) }
130
  initialOpen={ false }
 
131
  >
132
 
133
  <SelectControl
73
  <PanelBody
74
  title={ __( 'Who can see this chart?' ) }
75
  initialOpen={ false }
76
+ className="vz-permission-tab"
77
  >
78
 
79
  <SelectControl
129
  <PanelBody
130
  title={ __( 'Who can edit this chart?' ) }
131
  initialOpen={ false }
132
+ className="vz-permission-tab"
133
  >
134
 
135
  <SelectControl
classes/Visualizer/Gutenberg/src/style.scss CHANGED
@@ -377,7 +377,11 @@
377
  .DTCR_pointer {
378
  z-index: 999999 !important;
379
  }
380
-
 
 
 
 
381
  .components-panel {
382
  .components-select-control {
383
  height:auto !important;
377
  .DTCR_pointer {
378
  z-index: 999999 !important;
379
  }
380
+ .vz-permission-tab {
381
+ select.components-select-control__input {
382
+ overflow:auto !important;
383
+ }
384
+ }
385
  .components-panel {
386
  .components-select-control {
387
  height:auto !important;
classes/Visualizer/Module.php CHANGED
@@ -269,7 +269,8 @@ class Visualizer_Module {
269
  $filename .= '.csv';
270
 
271
  $bom = chr( 0xEF ) . chr( 0xBB ) . chr( 0xBF );
272
- $fp = tmpfile();
 
273
  if ( null === $fp ) {
274
  $fp = fopen( wp_tempnam(), 'w+' );
275
  }
@@ -732,7 +733,7 @@ class Visualizer_Module {
732
  public static final function get_features_for_license( $plan ) {
733
  switch ( $plan ) {
734
  case 1:
735
- return array( 'import-wp', 'db-query' );
736
  case 2:
737
  return array( 'schedule-chart', 'chart-permissions' );
738
  }
269
  $filename .= '.csv';
270
 
271
  $bom = chr( 0xEF ) . chr( 0xBB ) . chr( 0xBF );
272
+ // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
273
+ $fp = @tmpfile();
274
  if ( null === $fp ) {
275
  $fp = fopen( wp_tempnam(), 'w+' );
276
  }
733
  public static final function get_features_for_license( $plan ) {
734
  switch ( $plan ) {
735
  case 1:
736
+ return array( 'import-wp', 'db-query', 'import-wc-report' );
737
  case 2:
738
  return array( 'schedule-chart', 'chart-permissions' );
739
  }
classes/Visualizer/Module/Admin.php CHANGED
@@ -74,6 +74,8 @@ class Visualizer_Module_Admin extends Visualizer_Module {
74
 
75
  $this->_addAction( 'admin_init', 'init' );
76
 
 
 
77
  if ( defined( 'TI_CYPRESS_TESTING' ) ) {
78
  $this->load_cypress_hooks();
79
  }
@@ -767,6 +769,22 @@ class Visualizer_Module_Admin extends Visualizer_Module {
767
  private function getDisplayFilters( &$query_args ) {
768
  $query = array();
769
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
770
  // add chart type filter to the query arguments
771
  $type = filter_input( INPUT_GET, 'type' );
772
  if ( $type && in_array( $type, Visualizer_Plugin::getChartTypes(), true ) ) {
@@ -1112,4 +1130,49 @@ class Visualizer_Module_Admin extends Visualizer_Module {
1112
  }
1113
  return 'yes' === get_option( 'visualizer-new-user', 'yes' ) ? false : true;
1114
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1115
  }
74
 
75
  $this->_addAction( 'admin_init', 'init' );
76
 
77
+ $this->_addAction( 'visualizer_chart_languages', 'addMultilingualSupport' );
78
+
79
  if ( defined( 'TI_CYPRESS_TESTING' ) ) {
80
  $this->load_cypress_hooks();
81
  }
769
  private function getDisplayFilters( &$query_args ) {
770
  $query = array();
771
 
772
+ if ( Visualizer_Module::is_pro() && function_exists( 'icl_get_languages' ) ) {
773
+ $current_lang = icl_get_current_language();
774
+ if ( in_array( $current_lang, array( 'all', icl_get_default_language() ), true ) ) {
775
+ $query[] = array(
776
+ 'key' => 'chart_lang',
777
+ 'compare' => 'NOT EXISTS',
778
+ );
779
+ } else {
780
+ $query[] = array(
781
+ 'key' => 'chart_lang',
782
+ 'value' => $current_lang,
783
+ 'compare' => '=',
784
+ );
785
+ }
786
+ }
787
+
788
  // add chart type filter to the query arguments
789
  $type = filter_input( INPUT_GET, 'type' );
790
  if ( $type && in_array( $type, Visualizer_Plugin::getChartTypes(), true ) ) {
1130
  }
1131
  return 'yes' === get_option( 'visualizer-new-user', 'yes' ) ? false : true;
1132
  }
1133
+
1134
+ /**
1135
+ * Multilingual Support.
1136
+ *
1137
+ * @param int $chart_id Chart ID.
1138
+ * @return bool Default false
1139
+ */
1140
+ public function addMultilingualSupport( $chart_id ) {
1141
+ if ( Visualizer_Module::is_pro() ) {
1142
+ return;
1143
+ }
1144
+ if ( function_exists( 'icl_get_languages' ) ) {
1145
+ $language = icl_get_languages();
1146
+ $current_lang = icl_get_current_language();
1147
+ $default_lang = icl_get_default_language();
1148
+ $post_info = wpml_get_language_information( null, $chart_id );
1149
+
1150
+ global $sitepress;
1151
+ $translations = array();
1152
+ if ( ! empty( $post_info ) && ( $default_lang === $post_info['language_code'] ) ) {
1153
+ $trid = $sitepress->get_element_trid( $chart_id, 'post_' . Visualizer_Plugin::CPT_VISUALIZER );
1154
+ $translations = $sitepress->get_element_translations( $trid );
1155
+ }
1156
+ if ( empty( $translations ) ) {
1157
+ return;
1158
+ }
1159
+ ?>
1160
+ <hr><div class="visualizer-languages-list only-pro">
1161
+ <?php
1162
+ foreach ( $language as $lang ) {
1163
+ $lang_code = $lang['code'];
1164
+ if ( $current_lang !== $lang_code ) {
1165
+ ?>
1166
+ <a href="javascript:;">
1167
+ <img src="<?php echo esc_url( $lang['country_flag_url'] ); ?>" alt="<?php echo esc_attr( $lang['translated_name'] ); ?>">
1168
+ </a>
1169
+ <?php
1170
+ }
1171
+ }
1172
+ ?>
1173
+ <a href="<?php echo tsdk_utmify( Visualizer_Plugin::PRO_TEASER_URL, 'wpml-support', 'visualizer_render_char' ); ?>"target="_blank"><?php esc_html_e( 'Upgrade to PRO to active this translation for charts', 'visualizer' ); ?></a>
1174
+ </div>
1175
+ <?php
1176
+ }
1177
+ }
1178
  }
classes/Visualizer/Module/Chart.php CHANGED
@@ -135,6 +135,20 @@ class Visualizer_Module_Chart extends Visualizer_Module {
135
  )
136
  );
137
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
  delete_post_meta( $chart_id, Visualizer_Plugin::CF_JSON_SCHEDULE );
139
 
140
  if ( -1 < $time ) {
@@ -246,6 +260,14 @@ class Visualizer_Module_Chart extends Visualizer_Module {
246
  add_post_meta( $chart->ID, Visualizer_Plugin::CF_JSON_PAGING, $params['paging'] );
247
  }
248
 
 
 
 
 
 
 
 
 
249
  $time = filter_input(
250
  INPUT_POST,
251
  'time',
@@ -439,7 +461,20 @@ class Visualizer_Module_Chart extends Visualizer_Module {
439
  }
440
  }
441
  if ( $success ) {
442
- wp_delete_post( $chart_id, true );
 
 
 
 
 
 
 
 
 
 
 
 
 
443
  }
444
  if ( $is_post ) {
445
  self::_sendResponse(
@@ -498,32 +533,68 @@ class Visualizer_Module_Chart extends Visualizer_Module {
498
  // check chart, if chart not exists, will create new one and redirects to the same page with proper chart id
499
  $chart_id = isset( $_GET['chart'] ) ? filter_var( $_GET['chart'], FILTER_VALIDATE_INT ) : '';
500
  if ( ! $chart_id || ! ( $chart = get_post( $chart_id ) ) || $chart->post_type !== Visualizer_Plugin::CPT_VISUALIZER ) {
501
- $this->deleteOldCharts();
502
- $default_type = isset( $_GET['type'] ) && ! empty( $_GET['type'] ) ? $_GET['type'] : 'line';
503
- $source = new Visualizer_Source_Csv( VISUALIZER_ABSPATH . DIRECTORY_SEPARATOR . 'samples' . DIRECTORY_SEPARATOR . $default_type . '.csv' );
504
- $source->fetch();
505
- $chart_id = wp_insert_post(
506
- array(
507
- 'post_type' => Visualizer_Plugin::CPT_VISUALIZER,
508
- 'post_title' => 'Visualization',
509
- 'post_author' => get_current_user_id(),
510
- 'post_status' => 'auto-draft',
511
- 'post_content' => $source->getData( get_post_meta( $chart_id, Visualizer_Plugin::CF_EDITABLE_TABLE, true ) ),
512
- )
513
- );
514
- if ( $chart_id && ! is_wp_error( $chart_id ) ) {
515
- add_post_meta( $chart_id, Visualizer_Plugin::CF_CHART_TYPE, $default_type );
516
- add_post_meta( $chart_id, Visualizer_Plugin::CF_DEFAULT_DATA, 1 );
517
- add_post_meta( $chart_id, Visualizer_Plugin::CF_SOURCE, $source->getSourceName() );
518
- add_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, $source->getSeries() );
519
- add_post_meta( $chart_id, Visualizer_Plugin::CF_CHART_LIBRARY, '' );
520
- add_post_meta(
521
- $chart_id,
522
- Visualizer_Plugin::CF_SETTINGS,
523
  array(
524
- 'focusTarget' => 'datum',
 
 
 
 
525
  )
526
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
527
  do_action( 'visualizer_pro_new_chart_defaults', $chart_id );
528
  }
529
  wp_redirect( esc_url_raw( add_query_arg( 'chart', (int) $chart_id ) ) );
@@ -832,6 +903,7 @@ class Visualizer_Module_Chart extends Visualizer_Module {
832
  'json_tag_separator' => Visualizer_Source_Json::TAG_SEPARATOR,
833
  'json_tag_separator_view' => Visualizer_Source_Json::TAG_SEPARATOR_VIEW,
834
  'is_front' => false,
 
835
  )
836
  );
837
 
135
  )
136
  );
137
 
138
+ if ( Visualizer_Module::is_pro() ) {
139
+ $is_woocommerce_report = filter_input(
140
+ INPUT_POST,
141
+ 'is_woocommerce_report',
142
+ FILTER_VALIDATE_BOOLEAN
143
+ );
144
+
145
+ if ( $is_woocommerce_report ) {
146
+ update_post_meta( $chart_id, Visualizer_Plugin::CF_IS_WOOCOMMERCE_SOURCE, true );
147
+ } else {
148
+ delete_post_meta( $chart_id, Visualizer_Plugin::CF_IS_WOOCOMMERCE_SOURCE );
149
+ }
150
+ }
151
+
152
  delete_post_meta( $chart_id, Visualizer_Plugin::CF_JSON_SCHEDULE );
153
 
154
  if ( -1 < $time ) {
260
  add_post_meta( $chart->ID, Visualizer_Plugin::CF_JSON_PAGING, $params['paging'] );
261
  }
262
 
263
+ if ( Visualizer_Module::is_pro() ) {
264
+ if ( ! empty( $params['vz_woo_source'] ) ) {
265
+ update_post_meta( $chart->ID, Visualizer_Plugin::CF_JSON_WOOCOMMERCE_SOURCE, $params['vz_woo_source'] );
266
+ } else {
267
+ delete_post_meta( $chart->ID, Visualizer_Plugin::CF_JSON_WOOCOMMERCE_SOURCE );
268
+ }
269
+ }
270
+
271
  $time = filter_input(
272
  INPUT_POST,
273
  'time',
461
  }
462
  }
463
  if ( $success ) {
464
+ if ( Visualizer_Module::is_pro() && function_exists( 'icl_get_languages' ) ) {
465
+ global $sitepress;
466
+ $trid = $sitepress->get_element_trid( $chart_id, 'post_' . Visualizer_Plugin::CPT_VISUALIZER );
467
+ $translations = $sitepress->get_element_translations( $trid );
468
+ if ( ! empty( $translations ) ) {
469
+ foreach ( $translations as $translated_post ) {
470
+ wp_delete_post( $translated_post->element_id, true );
471
+ }
472
+ } else {
473
+ wp_delete_post( $chart_id, true );
474
+ }
475
+ } else {
476
+ wp_delete_post( $chart_id, true );
477
+ }
478
  }
479
  if ( $is_post ) {
480
  self::_sendResponse(
533
  // check chart, if chart not exists, will create new one and redirects to the same page with proper chart id
534
  $chart_id = isset( $_GET['chart'] ) ? filter_var( $_GET['chart'], FILTER_VALIDATE_INT ) : '';
535
  if ( ! $chart_id || ! ( $chart = get_post( $chart_id ) ) || $chart->post_type !== Visualizer_Plugin::CPT_VISUALIZER ) {
536
+ if ( empty( $_GET['lang'] ) || empty( $_GET['parent_chart_id'] ) ) {
537
+ $this->deleteOldCharts();
538
+ $default_type = isset( $_GET['type'] ) && ! empty( $_GET['type'] ) ? $_GET['type'] : 'line';
539
+ $source = new Visualizer_Source_Csv( VISUALIZER_ABSPATH . DIRECTORY_SEPARATOR . 'samples' . DIRECTORY_SEPARATOR . $default_type . '.csv' );
540
+ $source->fetch();
541
+ $chart_id = wp_insert_post(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
542
  array(
543
+ 'post_type' => Visualizer_Plugin::CPT_VISUALIZER,
544
+ 'post_title' => 'Visualization',
545
+ 'post_author' => get_current_user_id(),
546
+ 'post_status' => 'auto-draft',
547
+ 'post_content' => $source->getData( get_post_meta( $chart_id, Visualizer_Plugin::CF_EDITABLE_TABLE, true ) ),
548
  )
549
  );
550
+ if ( $chart_id && ! is_wp_error( $chart_id ) ) {
551
+ add_post_meta( $chart_id, Visualizer_Plugin::CF_CHART_TYPE, $default_type );
552
+ add_post_meta( $chart_id, Visualizer_Plugin::CF_DEFAULT_DATA, 1 );
553
+ add_post_meta( $chart_id, Visualizer_Plugin::CF_SOURCE, $source->getSourceName() );
554
+ add_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, $source->getSeries() );
555
+ add_post_meta( $chart_id, Visualizer_Plugin::CF_CHART_LIBRARY, '' );
556
+ add_post_meta(
557
+ $chart_id,
558
+ Visualizer_Plugin::CF_SETTINGS,
559
+ array(
560
+ 'focusTarget' => 'datum',
561
+ )
562
+ );
563
+
564
+ do_action( 'visualizer_pro_new_chart_defaults', $chart_id );
565
+ }
566
+ } else {
567
+ if ( current_user_can( 'edit_posts' ) ) {
568
+ $parent_chart_id = isset( $_GET['parent_chart_id'] ) ? filter_var( $_GET['parent_chart_id'], FILTER_VALIDATE_INT ) : '';
569
+ $success = false;
570
+ if ( $parent_chart_id ) {
571
+ $parent_chart = get_post( $parent_chart_id );
572
+ $success = $parent_chart && $parent_chart->post_type === Visualizer_Plugin::CPT_VISUALIZER;
573
+ }
574
+ if ( $success ) {
575
+ $new_chart_id = wp_insert_post(
576
+ array(
577
+ 'post_type' => Visualizer_Plugin::CPT_VISUALIZER,
578
+ 'post_title' => 'Visualization',
579
+ 'post_author' => get_current_user_id(),
580
+ 'post_status' => $parent_chart->post_status,
581
+ 'post_content' => $parent_chart->post_content,
582
+ )
583
+ );
584
+
585
+ if ( is_wp_error( $new_chart_id ) ) {
586
+ do_action( 'themeisle_log_event', Visualizer_Plugin::NAME, sprintf( 'Error while cloning chart %d = %s', $parent_chart_id, print_r( $new_chart_id, true ) ), 'error', __FILE__, __LINE__ );
587
+ } else {
588
+ $post_meta = get_post_meta( $parent_chart_id );
589
+ $chart_id = $new_chart_id;
590
+ foreach ( $post_meta as $key => $value ) {
591
+ if ( strpos( $key, 'visualizer-' ) !== false ) {
592
+ add_post_meta( $new_chart_id, $key, maybe_unserialize( $value[0] ) );
593
+ }
594
+ }
595
+ }
596
+ }
597
+ }
598
  do_action( 'visualizer_pro_new_chart_defaults', $chart_id );
599
  }
600
  wp_redirect( esc_url_raw( add_query_arg( 'chart', (int) $chart_id ) ) );
903
  'json_tag_separator' => Visualizer_Source_Json::TAG_SEPARATOR,
904
  'json_tag_separator_view' => Visualizer_Source_Json::TAG_SEPARATOR_VIEW,
905
  'is_front' => false,
906
+ 'rest_base' => get_rest_url( null, 'wc/v3/reports/' ),
907
  )
908
  );
909
 
classes/Visualizer/Module/Frontend.php CHANGED
@@ -305,6 +305,17 @@ class Visualizer_Module_Frontend extends Visualizer_Module {
305
  $atts
306
  );
307
 
 
 
 
 
 
 
 
 
 
 
 
308
  $chart_data = $this->getChartData( Visualizer_Plugin::CF_CHART_CACHE, $atts['id'] );
309
  // if empty chart does not exists, then return empty string.
310
  if ( ! $chart_data ) {
@@ -319,6 +330,10 @@ class Visualizer_Module_Frontend extends Visualizer_Module {
319
  return '';
320
  }
321
 
 
 
 
 
322
  // in case revisions exist.
323
  // phpcs:ignore WordPress.CodeAnalysis.AssignmentInCondition.Found
324
  if ( true === ( $revisions = $this->undoRevisions( $chart->ID, true ) ) ) {
@@ -639,8 +654,9 @@ class Visualizer_Module_Frontend extends Visualizer_Module {
639
  // Get chart by ID.
640
  $chart = get_post( $chart_id );
641
  if ( $chart && Visualizer_Plugin::CPT_VISUALIZER === $chart->post_type ) {
642
- $settings = get_post_meta( $chart->ID, Visualizer_Plugin::CF_SETTINGS, true );
643
- $series = get_post_meta( $chart->ID, Visualizer_Plugin::CF_SERIES, true );
 
644
 
645
  if ( isset( $settings['series'] ) && ! ( count( $settings['series'] ) - count( $series ) > 1 ) ) {
646
  $diff_total_series = abs( count( $settings['series'] ) - count( $series ) );
@@ -651,11 +667,12 @@ class Visualizer_Module_Frontend extends Visualizer_Module {
651
  }
652
  }
653
  $chart_data = array(
654
- 'chart' => $chart,
655
- 'type' => get_post_meta( $chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true ),
656
- 'settings' => $settings,
657
- 'series' => $series,
658
- 'chart_image' => get_post_meta( $chart->ID, Visualizer_Plugin::CF_CHART_IMAGE, true ),
 
659
  );
660
 
661
  // Put the results in a transient. Expire after 12 hours.
305
  $atts
306
  );
307
 
308
+ if ( Visualizer_Module::is_pro() && function_exists( 'icl_get_languages' ) ) {
309
+ global $sitepress;
310
+ $locale = icl_get_current_language();
311
+ $locale = strtolower( str_replace( '_', '-', $locale ) );
312
+ $trid = $sitepress->get_element_trid( $atts['id'], 'post_' . Visualizer_Plugin::CPT_VISUALIZER );
313
+ $translations = $sitepress->get_element_translations( $trid );
314
+ if ( isset( $translations[ $locale ] ) && is_object( $translations[ $locale ] ) ) {
315
+ $atts['id'] = $translations[ $locale ]->element_id;
316
+ }
317
+ }
318
+
319
  $chart_data = $this->getChartData( Visualizer_Plugin::CF_CHART_CACHE, $atts['id'] );
320
  // if empty chart does not exists, then return empty string.
321
  if ( ! $chart_data ) {
330
  return '';
331
  }
332
 
333
+ if ( ! is_admin() && ! empty( $chart_data['is_woocommerce_report'] ) ) {
334
+ return '';
335
+ }
336
+
337
  // in case revisions exist.
338
  // phpcs:ignore WordPress.CodeAnalysis.AssignmentInCondition.Found
339
  if ( true === ( $revisions = $this->undoRevisions( $chart->ID, true ) ) ) {
654
  // Get chart by ID.
655
  $chart = get_post( $chart_id );
656
  if ( $chart && Visualizer_Plugin::CPT_VISUALIZER === $chart->post_type ) {
657
+ $settings = get_post_meta( $chart->ID, Visualizer_Plugin::CF_SETTINGS, true );
658
+ $series = get_post_meta( $chart->ID, Visualizer_Plugin::CF_SERIES, true );
659
+ $is_woocommerce_report = get_post_meta( $chart->ID, Visualizer_Plugin::CF_IS_WOOCOMMERCE_SOURCE, true );
660
 
661
  if ( isset( $settings['series'] ) && ! ( count( $settings['series'] ) - count( $series ) > 1 ) ) {
662
  $diff_total_series = abs( count( $settings['series'] ) - count( $series ) );
667
  }
668
  }
669
  $chart_data = array(
670
+ 'chart' => $chart,
671
+ 'type' => get_post_meta( $chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true ),
672
+ 'settings' => $settings,
673
+ 'series' => $series,
674
+ 'chart_image' => get_post_meta( $chart->ID, Visualizer_Plugin::CF_CHART_IMAGE, true ),
675
+ 'is_woocommerce_report' => $is_woocommerce_report,
676
  );
677
 
678
  // Put the results in a transient. Expire after 12 hours.
classes/Visualizer/Plugin.php CHANGED
@@ -28,7 +28,7 @@
28
  class Visualizer_Plugin {
29
 
30
  const NAME = 'visualizer';
31
- const VERSION = '3.8.1';
32
 
33
  // custom post types
34
  const CPT_VISUALIZER = 'visualizer';
@@ -102,6 +102,8 @@ class Visualizer_Plugin {
102
  const PRO_TEASER_TITLE = 'Check PRO version ';
103
 
104
  const CF_CHART_CACHE = 'visualizer-chart-cache';
 
 
105
 
106
  /**
107
  * Name of the option for WordPress DB.
28
  class Visualizer_Plugin {
29
 
30
  const NAME = 'visualizer';
31
+ const VERSION = '3.9.0';
32
 
33
  // custom post types
34
  const CPT_VISUALIZER = 'visualizer';
102
  const PRO_TEASER_TITLE = 'Check PRO version ';
103
 
104
  const CF_CHART_CACHE = 'visualizer-chart-cache';
105
+ const CF_JSON_WOOCOMMERCE_SOURCE = 'visualizer-woocommerce-source';
106
+ const CF_IS_WOOCOMMERCE_SOURCE = 'visualizer-is-woocommerce-source';
107
 
108
  /**
109
  * Name of the option for WordPress DB.
classes/Visualizer/Render/Layout.php CHANGED
@@ -139,6 +139,7 @@ class Visualizer_Render_Layout extends Visualizer_Render {
139
  )
140
  );
141
 
 
142
  $url = get_post_meta( $id, Visualizer_Plugin::CF_JSON_URL, true );
143
  $root = get_post_meta( $id, Visualizer_Plugin::CF_JSON_ROOT, true );
144
  $paging = get_post_meta( $id, Visualizer_Plugin::CF_JSON_PAGING, true );
@@ -171,9 +172,11 @@ class Visualizer_Render_Layout extends Visualizer_Render {
171
  name="url"
172
  value="<?php echo esc_url( $url ); ?>"
173
  placeholder="<?php esc_html_e( 'Please enter the URL', 'visualizer' ); ?>"
174
- class="visualizer-input json-form-element">
 
 
175
  <button class="button button-secondary button-small" id="visualizer-json-fetch"><?php esc_html_e( 'Fetch Endpoint', 'visualizer' ); ?></button>
176
-
177
  <div class="visualizer-json-subform">
178
  <h3 class="viz-substep <?php echo $headers_open ? 'open' : ''; ?>"><?php _e( 'Headers', 'visualizer' ); ?></h3>
179
  <div class="json-wizard-headers">
@@ -670,7 +673,12 @@ class Visualizer_Render_Layout extends Visualizer_Render {
670
  );
671
 
672
  // this will allow us to open the correct source tab by default.
673
- $source_of_chart = strtolower( get_post_meta( $chart_id, Visualizer_Plugin::CF_SOURCE, true ) );
 
 
 
 
 
674
  // both import from wp and import from db have the same source so we need to differentiate.
675
  $filter_config = get_post_meta( $chart_id, Visualizer_Plugin::CF_FILTER_CONFIG, true );
676
  // if filter config is present, then its import from wp.
@@ -920,6 +928,104 @@ class Visualizer_Render_Layout extends Visualizer_Render {
920
  </div>
921
  </li>
922
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
923
  <?php
924
  $save_query = esc_url(
925
  add_query_arg(
139
  )
140
  );
141
 
142
+ $is_wc_source = get_post_meta( $id, Visualizer_Plugin::CF_IS_WOOCOMMERCE_SOURCE, true );
143
  $url = get_post_meta( $id, Visualizer_Plugin::CF_JSON_URL, true );
144
  $root = get_post_meta( $id, Visualizer_Plugin::CF_JSON_ROOT, true );
145
  $paging = get_post_meta( $id, Visualizer_Plugin::CF_JSON_PAGING, true );
172
  name="url"
173
  value="<?php echo esc_url( $url ); ?>"
174
  placeholder="<?php esc_html_e( 'Please enter the URL', 'visualizer' ); ?>"
175
+ class="visualizer-input json-form-element"
176
+ <?php echo $is_wc_source ? 'readonly' : ''; ?>
177
+ >
178
  <button class="button button-secondary button-small" id="visualizer-json-fetch"><?php esc_html_e( 'Fetch Endpoint', 'visualizer' ); ?></button>
179
+
180
  <div class="visualizer-json-subform">
181
  <h3 class="viz-substep <?php echo $headers_open ? 'open' : ''; ?>"><?php _e( 'Headers', 'visualizer' ); ?></h3>
182
  <div class="json-wizard-headers">
673
  );
674
 
675
  // this will allow us to open the correct source tab by default.
676
+ $source_of_chart = strtolower( get_post_meta( $chart_id, Visualizer_Plugin::CF_SOURCE, true ) );
677
+ // Import from woocommerce report.
678
+ $is_woocommerce_source = strtolower( get_post_meta( $chart_id, Visualizer_Plugin::CF_IS_WOOCOMMERCE_SOURCE, true ) );
679
+ if ( ! empty( $is_woocommerce_source ) ) {
680
+ $source_of_chart .= '_wc';
681
+ }
682
  // both import from wp and import from db have the same source so we need to differentiate.
683
  $filter_config = get_post_meta( $chart_id, Visualizer_Plugin::CF_FILTER_CONFIG, true );
684
  // if filter config is present, then its import from wp.
928
  </div>
929
  </li>
930
 
931
+ <!-- import from WooCommerce -->
932
+ <?php
933
+ if ( class_exists( 'WooCommerce', false ) ) :
934
+ $wc_source = strtolower( get_post_meta( $chart_id, Visualizer_Plugin::CF_JSON_WOOCOMMERCE_SOURCE, true ) );
935
+ $wc_source_list = apply_filters(
936
+ 'visualizer_woocommerce_report_endpoints',
937
+ array(
938
+ array(
939
+ 'name' => esc_html__( 'Sales', 'visualizer' ),
940
+ 'endpoint' => esc_attr( 'sales' ),
941
+ ),
942
+ array(
943
+ 'name' => esc_html__( 'Top Sellers', 'visualizer' ),
944
+ 'endpoint' => esc_attr( 'top_sellers' ),
945
+ ),
946
+ array(
947
+ 'name' => esc_html__( 'Coupons Totals', 'visualizer' ),
948
+ 'endpoint' => esc_attr( 'coupons/totals' ),
949
+ ),
950
+ array(
951
+ 'name' => esc_html__( 'Customers Totals', 'visualizer' ),
952
+ 'endpoint' => esc_attr( 'customers/totals' ),
953
+ ),
954
+ array(
955
+ 'name' => esc_html__( 'Orders Totals', 'visualizer' ),
956
+ 'endpoint' => esc_attr( 'orders/totals' ),
957
+ ),
958
+ array(
959
+ 'name' => esc_html__( 'Products Totals', 'visualizer' ),
960
+ 'endpoint' => esc_attr( 'products/totals' ),
961
+ ),
962
+ array(
963
+ 'name' => esc_html__( 'Reviews Totals', 'visualizer' ),
964
+ 'endpoint' => esc_attr( 'reviews/totals' ),
965
+ ),
966
+ )
967
+ );
968
+ ?>
969
+ <li class="viz-group visualizer_woocommerce_source<?php echo 'visualizer_source_json_wc' === $source_of_chart ? ' open' : ''; ?> <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'import-wc-report' ); ?> ">
970
+ <h2 class="viz-group-title viz-sub-group"><?php _e( 'Import from WooCommerce Reports', 'visualizer' ); ?><span class="dashicons dashicons-lock"></span></h2>
971
+ <div class="viz-group-content edit-data-content">
972
+ <div>
973
+ <p class="viz-group-description"><?php _e( 'You can choose here to import/synchronize your chart data with a WooCommerce report API. For more info check <a href="https://woocommerce.github.io/woocommerce-rest-api-docs/?shell#reports" target="_blank" >this</a> tutorial', 'visualizer' ); ?></p>
974
+ <form id="vz-import-woo-report" action="<?php echo $upload_link; ?>" method="post" target="thehole" enctype="multipart/form-data">
975
+ <div class="remote-file-section">
976
+ <?php
977
+ $bttn_label = 'visualizer_source_json_wc' === $source_of_chart ? __( 'Modify Parameters', 'visualizer' ) : __( 'Create Parameters', 'visualizer' );
978
+ ?>
979
+ <p class="viz-group-description"><?php _e( 'How often do you want to check the URL', 'visualizer' ); ?></p>
980
+ <select name="time" id="vz-woo-time" class="visualizer-select json-form-element" data-chart="<?php echo $chart_id; ?>">
981
+ <?php
982
+ $hours = get_post_meta( $chart_id, Visualizer_Plugin::CF_JSON_SCHEDULE, true );
983
+ $schedules = apply_filters(
984
+ 'visualizer_chart_schedules', array(
985
+ '-1' => __( 'One-time', 'visualizer' ),
986
+ ),
987
+ 'json',
988
+ $chart_id
989
+ );
990
+ foreach ( $schedules as $num => $name ) {
991
+ // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
992
+ $extra = $num == $hours ? 'selected' : '';
993
+ ?>
994
+ <option value="<?php echo $num; ?>" <?php echo $extra; ?>><?php echo $name; ?></option>
995
+ <?php
996
+ }
997
+ do_action( 'visualizer_chart_schedules_spl', 'json', $chart_id, 1 );
998
+ ?>
999
+ </select>
1000
+ <p class="viz-group-description"><?php _e( 'Select report endpoint', 'visualizer' ); ?></p>
1001
+ <select name="vz_woo_source" id="vz-woo-source" class="visualizer-select json-form-element" data-chart="<?php echo $chart_id; ?>">
1002
+ <option value=""></option>
1003
+ <?php
1004
+ if ( ! empty( $wc_source_list ) ) {
1005
+ foreach ( $wc_source_list as $api ) {
1006
+ if ( isset( $api['name'] ) && $api['endpoint'] ) {
1007
+ echo sprintf( '<option value="%2$s" %3$s>%1$s</option>', $api['name'], $api['endpoint'], selected( $wc_source, $api['endpoint'], false ) ); // phpcs:ignore
1008
+ }
1009
+ }
1010
+ }
1011
+ ?>
1012
+ </select>
1013
+ </div>
1014
+
1015
+ <input type="button" id="woo-chart-button" class="button button-secondary show-chart-toggle"
1016
+ value="<?php echo $bttn_label; ?>" data-current="chart"
1017
+ data-t-filter="<?php _e( 'Show Chart', 'visualizer' ); ?>"
1018
+ data-t-chart="<?php echo $bttn_label; ?>"
1019
+ <?php empty( $wc_source ) ? 'disabled' : ''; ?>
1020
+ >
1021
+ <input type="button" id="woo-chart-save-button" class="button button-primary "
1022
+ value="<?php _e( 'Save Schedule', 'visualizer' ); ?>" <?php empty( $wc_source ) ? 'disabled' : ''; ?>>
1023
+ </form>
1024
+ <?php echo apply_filters( 'visualizer_pro_upsell', '', 'import-wc-report' ); ?>
1025
+ </div>
1026
+ </div>
1027
+ </li>
1028
+ <?php endif; ?>
1029
  <?php
1030
  $save_query = esc_url(
1031
  add_query_arg(
classes/Visualizer/Render/Library.php CHANGED
@@ -365,6 +365,7 @@ class Visualizer_Render_Library extends Visualizer_Render {
365
  }
366
  echo '<a class="visualizer-chart-action visualizer-chart-shortcode" href="javascript:;" title="', esc_attr__( 'Click to copy shortcode', 'visualizer' ), '" data-clipboard-text="', esc_attr( $shortcode ), '"><span class="dashicons dashicons-admin-page"></span></a>';
367
  echo '<span>&nbsp;</span>';
 
368
  echo '<hr><div class="visualizer-chart-status"><span title="' . __( 'Chart ID', 'visualizer' ) . '">(' . $chart_id . '):</span> <span class="visualizer-date" title="' . __( 'Last Updated', 'visualizer' ) . '">' . $chart_status['date'] . '</span><span class="visualizer-error"><i class="dashicons ' . $chart_status['icon'] . '" data-viz-error="' . esc_attr( str_replace( '"', "'", $chart_status['error'] ) ) . '" title="' . esc_attr( $chart_status['title'] ) . '"></i></span></div>';
369
  echo '</div>';
370
  echo '</div></div>';
@@ -396,6 +397,8 @@ class Visualizer_Render_Library extends Visualizer_Render {
396
  echo '<li><svg class="icon list-icon"><use xlink:href="#list-icon"></use></svg>' . __( 'Create charts from WordPress tables', 'visualizer' ) . '</li>';
397
  echo '<li><svg class="icon list-icon"><use xlink:href="#list-icon"></use></svg>' . __( 'Frontend editor', 'visualizer' ) . '</li>';
398
  echo '<li><svg class="icon list-icon"><use xlink:href="#list-icon"></use></svg>' . __( 'Private charts', 'visualizer' ) . '</li>';
 
 
399
  echo '<li><svg class="icon list-icon"><use xlink:href="#list-icon"></use></svg>' . __( 'Auto-sync with online files', 'visualizer' ) . '</li></ul>';
400
  echo '<p><a href="' . tsdk_utmify( Visualizer_Plugin::PRO_TEASER_URL, 'sidebarupsell' ) . '" target="_blank" class="button button-primary">' . __( 'View more features', 'visualizer' ) . '</a></p>';
401
  echo '</div>';
365
  }
366
  echo '<a class="visualizer-chart-action visualizer-chart-shortcode" href="javascript:;" title="', esc_attr__( 'Click to copy shortcode', 'visualizer' ), '" data-clipboard-text="', esc_attr( $shortcode ), '"><span class="dashicons dashicons-admin-page"></span></a>';
367
  echo '<span>&nbsp;</span>';
368
+ do_action( 'visualizer_chart_languages', $chart_id );
369
  echo '<hr><div class="visualizer-chart-status"><span title="' . __( 'Chart ID', 'visualizer' ) . '">(' . $chart_id . '):</span> <span class="visualizer-date" title="' . __( 'Last Updated', 'visualizer' ) . '">' . $chart_status['date'] . '</span><span class="visualizer-error"><i class="dashicons ' . $chart_status['icon'] . '" data-viz-error="' . esc_attr( str_replace( '"', "'", $chart_status['error'] ) ) . '" title="' . esc_attr( $chart_status['title'] ) . '"></i></span></div>';
370
  echo '</div>';
371
  echo '</div></div>';
397
  echo '<li><svg class="icon list-icon"><use xlink:href="#list-icon"></use></svg>' . __( 'Create charts from WordPress tables', 'visualizer' ) . '</li>';
398
  echo '<li><svg class="icon list-icon"><use xlink:href="#list-icon"></use></svg>' . __( 'Frontend editor', 'visualizer' ) . '</li>';
399
  echo '<li><svg class="icon list-icon"><use xlink:href="#list-icon"></use></svg>' . __( 'Private charts', 'visualizer' ) . '</li>';
400
+ echo '<li><svg class="icon list-icon"><use xlink:href="#list-icon"></use></svg>' . __( 'WPML support for translating charts', 'visualizer' ) . '</li>';
401
+ echo '<li><svg class="icon list-icon"><use xlink:href="#list-icon"></use></svg>' . __( 'Integration with Woocommerce Data endpoints', 'visualizer' ) . '</li>';
402
  echo '<li><svg class="icon list-icon"><use xlink:href="#list-icon"></use></svg>' . __( 'Auto-sync with online files', 'visualizer' ) . '</li></ul>';
403
  echo '<p><a href="' . tsdk_utmify( Visualizer_Plugin::PRO_TEASER_URL, 'sidebarupsell' ) . '" target="_blank" class="button button-primary">' . __( 'View more features', 'visualizer' ) . '</a></p>';
404
  echo '</div>';
classes/Visualizer/Source.php CHANGED
@@ -218,6 +218,7 @@ abstract class Visualizer_Source {
218
  }
219
  switch ( $series['type'] ) {
220
  case 'number':
 
221
  $data[ $i ] = ( is_numeric( $data[ $i ] ) ) ? floatval( $data[ $i ] ) : ( is_numeric( str_replace( ',', '', $data[ $i ] ) ) ? floatval( str_replace( ',', '', $data[ $i ] ) ) : null );
222
  break;
223
  case 'boolean':
218
  }
219
  switch ( $series['type'] ) {
220
  case 'number':
221
+ $data[ $i ] = preg_replace( '/[\x{200B}-\x{200D}\x{FEFF}]/u', '', $data[ $i ] );
222
  $data[ $i ] = ( is_numeric( $data[ $i ] ) ) ? floatval( $data[ $i ] ) : ( is_numeric( str_replace( ',', '', $data[ $i ] ) ) ? floatval( str_replace( ',', '', $data[ $i ] ) ) : null );
223
  break;
224
  case 'boolean':
css/library.css CHANGED
@@ -445,6 +445,41 @@ div#visualizer-types ul, div#visualizer-types form p {
445
  .google-visualization-controls-rangefilter {
446
  white-space: inherit !important;
447
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
448
  @media (-webkit-min-device-pixel-ratio: 2) and (min-width: 1000px) and (max-width: 1600px) {
449
  #visualizer-sidebar.one-columns .visualizer-sidebar-box ul li:nth-child(+n+7) {
450
  display: none;
445
  .google-visualization-controls-rangefilter {
446
  white-space: inherit !important;
447
  }
448
+ .visualizer-languages-list {
449
+ text-align: right;
450
+ }
451
+ .visualizer-languages-list a {
452
+ text-decoration: none;
453
+ display: inline-block;
454
+ margin-left: 3px;
455
+ padding: 0;
456
+ border: none;
457
+ outline: none;
458
+ box-shadow: none;
459
+ }
460
+ .visualizer-languages-list a:focus {
461
+ border: none;
462
+ outline: none;
463
+ box-shadow: none;
464
+ }
465
+ .visualizer-languages-list:not(.only-pro) i {
466
+ display: none;
467
+ }
468
+ .visualizer-languages-list:not(.only-pro) a:hover img {
469
+ display: none;
470
+ }
471
+ .visualizer-languages-list:not(.only-pro) a:hover img + i {
472
+ display: block;
473
+ }
474
+ .visualizer-languages-list.only-pro a:last-child {
475
+ display: none;
476
+ }
477
+ .visualizer-languages-list.only-pro:hover a:not(:last-child) {
478
+ display: none;
479
+ }
480
+ .visualizer-languages-list.only-pro:hover a:last-child {
481
+ display: block;
482
+ }
483
  @media (-webkit-min-device-pixel-ratio: 2) and (min-width: 1000px) and (max-width: 1600px) {
484
  #visualizer-sidebar.one-columns .visualizer-sidebar-box ul li:nth-child(+n+7) {
485
  display: none;
css/media.css CHANGED
@@ -1,5 +1,5 @@
1
  /*
2
- Version: 3.8.1
3
  */
4
  #visualizer-library-view {
5
  padding: 30px 10px 10px 30px;
1
  /*
2
+ Version: 3.9.0
3
  */
4
  #visualizer-library-view {
5
  padding: 30px 10px 10px 30px;
index.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Visualizer: Tables and Charts for WordPress
4
  Plugin URI: https://themeisle.com/plugins/visualizer-charts-and-graphs/
5
  Description: A simple, easy to use and quite powerful tool to create, manage and embed interactive charts into your WordPress posts and pages. The plugin uses Google Visualization API to render charts, which supports cross-browser compatibility (adopting VML for older IE versions) and cross-platform portability to iOS and new Android releases.
6
- Version: 3.8.1
7
  Author: Themeisle
8
  Author URI: http://themeisle.com
9
  Requires at least: 3.5
3
  Plugin Name: Visualizer: Tables and Charts for WordPress
4
  Plugin URI: https://themeisle.com/plugins/visualizer-charts-and-graphs/
5
  Description: A simple, easy to use and quite powerful tool to create, manage and embed interactive charts into your WordPress posts and pages. The plugin uses Google Visualization API to render charts, which supports cross-browser compatibility (adopting VML for older IE versions) and cross-platform portability to iOS and new Android releases.
6
+ Version: 3.9.0
7
  Author: Themeisle
8
  Author URI: http://themeisle.com
9
  Requires at least: 3.5
js/frame.js CHANGED
@@ -383,17 +383,23 @@
383
  });
384
 
385
  // toggle between chart and create/modify parameters
386
- $( '#json-chart-button' ).on( 'click', function(){
387
 
388
  $('body').off('visualizer:change:action').on('visualizer:change:action', function(e){
389
- var filter_button = $( '#json-chart-button' );
390
  $( '#visualizer-json-screen' ).css("z-index", "-1").hide();
391
  filter_button.val( filter_button.attr( 'data-t-chart' ) );
392
  filter_button.html( filter_button.attr( 'data-t-chart' ) );
393
  filter_button.attr( 'data-current', 'chart' );
394
  $( '#canvas' ).css("z-index", "1").show();
 
395
  });
396
 
 
 
 
 
 
397
  $('#content').css('width', 'calc(100% - 100px)');
398
  if( $(this).attr( 'data-current' ) === 'chart'){
399
  // toggle from chart to LHS form
@@ -402,6 +408,15 @@
402
  $(this).attr( 'data-current', 'filter' );
403
  $( '.visualizer-editor-lhs' ).hide();
404
  $( '#visualizer-json-screen' ).css("z-index", "9999").show();
 
 
 
 
 
 
 
 
 
405
  $( '#canvas' ).hide();
406
  }else{
407
  // toggle from LHS form to chart
@@ -410,14 +425,14 @@
410
  } );
411
 
412
  $('body').on('visualizer:json:form:submit', function() {
413
- var filter_button = $( '#json-chart-button' );
414
  $( '#visualizer-json-screen' ).css("z-index", "-1").hide();
415
  $('#canvas').lock();
416
  filter_button.val( filter_button.attr( 'data-t-chart' ) );
417
  filter_button.html( filter_button.attr( 'data-t-chart' ) );
418
  filter_button.attr( 'data-current', 'chart' );
419
  end_ajax( $( '#visualizer-json-screen' ) );
420
- $( '#canvas' ).css("z-index", "1").show();
421
  });
422
 
423
 
@@ -512,7 +527,7 @@
512
  }
513
 
514
  // populate the form elements that are in the other tabs.
515
- $('#json-conclude-form-helper .json-form-element, #json-endpoint-form .json-form-element, #json-root-form .json-form-element, #vz-import-json .json-form-element').each(function(x, y){
516
  $('#json-conclude-form').append('<input type="hidden" name="' + y.name + '" value="' + y.value + '">');
517
  });
518
 
@@ -520,17 +535,19 @@
520
  });
521
 
522
  // update the schedule
523
- $('#json-chart-save-button').on('click', function(e){
524
  e.preventDefault();
525
  $('#canvas').lock();
 
526
  $.ajax({
527
  url : ajaxurl,
528
  method : 'post',
529
  data : {
530
  'action' : visualizer.ajax['actions']['json_set_schedule'],
531
  'security' : visualizer.ajax['nonces']['json_set_schedule'],
532
- 'chart' : $('#vz-json-time').attr('data-chart'),
533
- 'time' : $('#vz-json-time').val()
 
534
  },
535
  success : function(data){
536
  // do nothing.
@@ -541,6 +558,18 @@
541
  });
542
  });
543
 
 
 
 
 
 
 
 
 
 
 
 
 
544
  }
545
 
546
  function init_editor_table() {
383
  });
384
 
385
  // toggle between chart and create/modify parameters
386
+ $( '#json-chart-button, #woo-chart-button' ).on( 'click', function(){
387
 
388
  $('body').off('visualizer:change:action').on('visualizer:change:action', function(e){
389
+ var filter_button = $( '#json-chart-button, #woo-chart-button' );
390
  $( '#visualizer-json-screen' ).css("z-index", "-1").hide();
391
  filter_button.val( filter_button.attr( 'data-t-chart' ) );
392
  filter_button.html( filter_button.attr( 'data-t-chart' ) );
393
  filter_button.attr( 'data-current', 'chart' );
394
  $( '#canvas' ).css("z-index", "1").show();
395
+ $( '#vz-import-woo-report' ).find( 'select, input' ).removeAttr( 'disabled' );
396
  });
397
 
398
+ if ( 'json-chart-button' === $( this ).attr( 'id' ) ) {
399
+ $( '#vz-import-woo-report' ).find( 'select, input' ).attr( 'disabled', true );
400
+ } else {
401
+ $( '#vz-import-woo-report' ).find( 'select, input' ).removeAttr( 'disabled' );
402
+ }
403
  $('#content').css('width', 'calc(100% - 100px)');
404
  if( $(this).attr( 'data-current' ) === 'chart'){
405
  // toggle from chart to LHS form
408
  $(this).attr( 'data-current', 'filter' );
409
  $( '.visualizer-editor-lhs' ).hide();
410
  $( '#visualizer-json-screen' ).css("z-index", "9999").show();
411
+ if ( 'woo-chart-button' === $( this ).attr( 'id' ) && '' !== $( '#vz-woo-source:visible' ).val() ) {
412
+ $( '#vz-import-json-url' ).val( visualizer.rest_base + $( '#vz-woo-source' ).val() ).attr( 'readonly', true );
413
+ } else {
414
+ if ( 'undefined' !== $( '#vz-import-json-url' ).attr( 'readonly' ) ) {
415
+ $( '#vz-import-json-url' ).val( '' ).removeAttr( 'readonly' ).removeAttr( 'value' );
416
+ $('#json-endpoint-form')[0].reset();
417
+ $('.visualizer-json-form h3.viz-step:not(.step1)').addClass('ui-state-disabled');
418
+ }
419
+ }
420
  $( '#canvas' ).hide();
421
  }else{
422
  // toggle from LHS form to chart
425
  } );
426
 
427
  $('body').on('visualizer:json:form:submit', function() {
428
+ var filter_button = $( '#json-chart-button, #woo-chart-button' );
429
  $( '#visualizer-json-screen' ).css("z-index", "-1").hide();
430
  $('#canvas').lock();
431
  filter_button.val( filter_button.attr( 'data-t-chart' ) );
432
  filter_button.html( filter_button.attr( 'data-t-chart' ) );
433
  filter_button.attr( 'data-current', 'chart' );
434
  end_ajax( $( '#visualizer-json-screen' ) );
435
+ $( '#canvas' ).removeClass('visualizer-chart-loaded').css("z-index", "1").show();
436
  });
437
 
438
 
527
  }
528
 
529
  // populate the form elements that are in the other tabs.
530
+ $('#json-conclude-form-helper .json-form-element, #json-endpoint-form .json-form-element, #json-root-form .json-form-element, #vz-import-json .json-form-element, #vz-import-woo-report .json-form-element:not(:disabled)').each(function(x, y){
531
  $('#json-conclude-form').append('<input type="hidden" name="' + y.name + '" value="' + y.value + '">');
532
  });
533
 
535
  });
536
 
537
  // update the schedule
538
+ $('#json-chart-save-button, #woo-chart-save-button').on('click', function(e){
539
  e.preventDefault();
540
  $('#canvas').lock();
541
+ var btnID = jQuery( this ).attr( 'id' );
542
  $.ajax({
543
  url : ajaxurl,
544
  method : 'post',
545
  data : {
546
  'action' : visualizer.ajax['actions']['json_set_schedule'],
547
  'security' : visualizer.ajax['nonces']['json_set_schedule'],
548
+ 'chart' : $('#vz-json-time, #vz-woo-time').attr('data-chart'),
549
+ 'time' : $('#vz-json-time, #vz-woo-time').val(),
550
+ 'is_woocommerce_report': 'woo-chart-save-button' === btnID,
551
  },
552
  success : function(data){
553
  // do nothing.
558
  });
559
  });
560
 
561
+ // Select WooCommerce report endpoint.
562
+ $( '#vz-woo-source' ).on( 'click', function( e ) {
563
+ // Trigger change action.
564
+ $( 'body' ).trigger( 'visualizer:change:action' );
565
+
566
+ if ( '' !== $( this ).val() ) {
567
+ $( '#woo-chart-button, #woo-chart-save-button' ).removeAttr( 'disabled' );
568
+ } else {
569
+ $( '#woo-chart-button, #woo-chart-save-button' ).attr( 'disabled', true );
570
+ }
571
+ } );
572
+
573
  }
574
 
575
  function init_editor_table() {
js/library.js CHANGED
@@ -92,9 +92,20 @@
92
  }
93
  });
94
 
 
 
 
 
 
 
 
 
 
 
95
  $('.add-new-chart').click(function () {
96
  var wnd = window,
97
  view = new vmv.Chart({action: vu.create});
 
98
 
99
  window.parent.addEventListener('message', function(event){
100
  switch(event.data) {
@@ -116,8 +127,11 @@
116
  });
117
 
118
  $('.visualizer-chart-edit').click(function () {
119
- var wnd = window,
120
- view = new vmv.Chart({action: vu.edit + '&chart=' + $(this).attr('data-chart')});
 
 
 
121
 
122
  wnd.send_to_editor = function () {
123
  wnd.location.href = wnd.location.href.replace(/vaction/, '');
92
  }
93
  });
94
 
95
+ $( '.visualizer-languages-list' ).on( 'click', '[data-lang_code]', function() {
96
+ if ( $(this).find( 'i' ).hasClass( 'otgs-ico-add' ) ) {
97
+ vu.create = vu.create + '&lang=' + $(this).data('lang_code') + '&parent_chart_id=' + $(this).data('chart');
98
+ $('.add-new-chart').click();
99
+ } else {
100
+ vu.edit = vu.edit + '&lang=' + $(this).data('lang_code') + '&chart=' + $(this).data('chart');
101
+ $('.visualizer-chart-edit').click();
102
+ }
103
+ } );
104
+
105
  $('.add-new-chart').click(function () {
106
  var wnd = window,
107
  view = new vmv.Chart({action: vu.create});
108
+ vu.create = vu.create.replace(/[\?&]lang=[^&]+/, '').replace(/[\?&]parent_chart_id=[^&]+/, '');
109
 
110
  window.parent.addEventListener('message', function(event){
111
  switch(event.data) {
127
  });
128
 
129
  $('.visualizer-chart-edit').click(function () {
130
+ var wnd = window;
131
+ var view = new vmv.Chart( {
132
+ action: vu.edit.indexOf('&chart') != -1 ? vu.edit : vu.edit + '&chart=' + $(this).attr('data-chart')
133
+ } );
134
+ vu.edit = vu.edit.replace(/[\?&]lang=[^&]+/, '');
135
 
136
  wnd.send_to_editor = function () {
137
  wnd.location.href = wnd.location.href.replace(/vaction/, '');
js/render-datatables.js CHANGED
@@ -247,6 +247,9 @@
247
  }
248
  if(typeof series.format.decimal !== ''){
249
  parts[1] = series.format.decimal;
 
 
 
250
  }
251
  if(typeof series.format.precision !== '' && parseInt(series.format.precision) > 0){
252
  parts[2] = series.format.precision;
247
  }
248
  if(typeof series.format.decimal !== ''){
249
  parts[1] = series.format.decimal;
250
+ if ( '' === series.format.precision ) {
251
+ series.format.precision = 2;
252
+ }
253
  }
254
  if(typeof series.format.precision !== '' && parseInt(series.format.precision) > 0){
255
  parts[2] = series.format.precision;
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: codeinwp,themeisle,marius2012,marius_codeinwp,hardeepasrani,rozroz,Madalin_ThemeIsle
3
  Tags: tables, charts, pie, visualization, graphs
4
  Requires at least: 3.5
5
- Tested up to: 6.0
6
  Requires PHP: 5.6
7
  Stable tag: trunk
8
  License: GPL v2.0 or later
@@ -163,6 +163,18 @@ Pay attention that to turn your shortcodes into graphs, your theme has to have `
163
 
164
  == Changelog ==
165
 
 
 
 
 
 
 
 
 
 
 
 
 
166
  ##### [Version 3.8.1](https://github.com/Codeinwp/visualizer/compare/v3.8.0...v3.8.1) (2022-10-12)
167
 
168
 
2
  Contributors: codeinwp,themeisle,marius2012,marius_codeinwp,hardeepasrani,rozroz,Madalin_ThemeIsle
3
  Tags: tables, charts, pie, visualization, graphs
4
  Requires at least: 3.5
5
+ Tested up to: 6.1
6
  Requires PHP: 5.6
7
  Stable tag: trunk
8
  License: GPL v2.0 or later
163
 
164
  == Changelog ==
165
 
166
+ #### [Version 3.9.0](https://github.com/Codeinwp/visualizer/compare/v3.8.1...v3.9.0) (2022-11-10)
167
+
168
+ - Fixed table chart decimal number issue Decimal Numbers are ignored and not displayed [#955](https://github.com/Codeinwp/visualizer/issues/955)
169
+ - Fix the scrollbar issue that happens on WP 6.1 version [WP 6.1] Chart permissions selector is not scrollable [#950](https://github.com/Codeinwp/visualizer/issues/950)
170
+ - Fix PHP Warning Warning when copy (frontend action) is enabled [#949](https://github.com/Codeinwp/visualizer/issues/949)
171
+ - Compatibility with the WPML translation plugin for translating charts [PRO feature] add support for string translations [#731](https://github.com/Codeinwp/visualizer/issues/731)
172
+ - Integration with Woocommerce Data endpoints for creating charts [PRO feature]
173
+ - Show new features on chart library page
174
+
175
+
176
+
177
+
178
  ##### [Version 3.8.1](https://github.com/Codeinwp/visualizer/compare/v3.8.0...v3.8.1) (2022-10-12)
179
 
180
 
vendor/autoload.php CHANGED
@@ -3,10 +3,23 @@
3
  // autoload.php @generated by Composer
4
 
5
  if (PHP_VERSION_ID < 50600) {
6
- echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
7
- exit(1);
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  }
9
 
10
  require_once __DIR__ . '/composer/autoload_real.php';
11
 
12
- return ComposerAutoloaderInitc7871f7b38ea431eb49202200227e974::getLoader();
3
  // autoload.php @generated by Composer
4
 
5
  if (PHP_VERSION_ID < 50600) {
6
+ if (!headers_sent()) {
7
+ header('HTTP/1.1 500 Internal Server Error');
8
+ }
9
+ $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
10
+ if (!ini_get('display_errors')) {
11
+ if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
12
+ fwrite(STDERR, $err);
13
+ } elseif (!headers_sent()) {
14
+ echo $err;
15
+ }
16
+ }
17
+ trigger_error(
18
+ $err,
19
+ E_USER_ERROR
20
+ );
21
  }
22
 
23
  require_once __DIR__ . '/composer/autoload_real.php';
24
 
25
+ return ComposerAutoloaderInitd8aa5b67905ce8ae7718f6219ae2a013::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInitc7871f7b38ea431eb49202200227e974
6
  {
7
  private static $loader;
8
 
@@ -24,18 +24,18 @@ class ComposerAutoloaderInitc7871f7b38ea431eb49202200227e974
24
 
25
  require __DIR__ . '/platform_check.php';
26
 
27
- spl_autoload_register(array('ComposerAutoloaderInitc7871f7b38ea431eb49202200227e974', 'loadClassLoader'), true, true);
28
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
29
- spl_autoload_unregister(array('ComposerAutoloaderInitc7871f7b38ea431eb49202200227e974', 'loadClassLoader'));
30
 
31
  require __DIR__ . '/autoload_static.php';
32
- call_user_func(\Composer\Autoload\ComposerStaticInitc7871f7b38ea431eb49202200227e974::getInitializer($loader));
33
 
34
  $loader->register(true);
35
 
36
- $includeFiles = \Composer\Autoload\ComposerStaticInitc7871f7b38ea431eb49202200227e974::$files;
37
  foreach ($includeFiles as $fileIdentifier => $file) {
38
- composerRequirec7871f7b38ea431eb49202200227e974($fileIdentifier, $file);
39
  }
40
 
41
  return $loader;
@@ -47,7 +47,7 @@ class ComposerAutoloaderInitc7871f7b38ea431eb49202200227e974
47
  * @param string $file
48
  * @return void
49
  */
50
- function composerRequirec7871f7b38ea431eb49202200227e974($fileIdentifier, $file)
51
  {
52
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
53
  $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInitd8aa5b67905ce8ae7718f6219ae2a013
6
  {
7
  private static $loader;
8
 
24
 
25
  require __DIR__ . '/platform_check.php';
26
 
27
+ spl_autoload_register(array('ComposerAutoloaderInitd8aa5b67905ce8ae7718f6219ae2a013', 'loadClassLoader'), true, true);
28
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
29
+ spl_autoload_unregister(array('ComposerAutoloaderInitd8aa5b67905ce8ae7718f6219ae2a013', 'loadClassLoader'));
30
 
31
  require __DIR__ . '/autoload_static.php';
32
+ call_user_func(\Composer\Autoload\ComposerStaticInitd8aa5b67905ce8ae7718f6219ae2a013::getInitializer($loader));
33
 
34
  $loader->register(true);
35
 
36
+ $includeFiles = \Composer\Autoload\ComposerStaticInitd8aa5b67905ce8ae7718f6219ae2a013::$files;
37
  foreach ($includeFiles as $fileIdentifier => $file) {
38
+ composerRequired8aa5b67905ce8ae7718f6219ae2a013($fileIdentifier, $file);
39
  }
40
 
41
  return $loader;
47
  * @param string $file
48
  * @return void
49
  */
50
+ function composerRequired8aa5b67905ce8ae7718f6219ae2a013($fileIdentifier, $file)
51
  {
52
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
53
  $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInitc7871f7b38ea431eb49202200227e974
8
  {
9
  public static $files = array (
10
  'abede361264e2ae69ec1eee813a101af' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/abs.php',
@@ -356,10 +356,10 @@ class ComposerStaticInitc7871f7b38ea431eb49202200227e974
356
  public static function getInitializer(ClassLoader $loader)
357
  {
358
  return \Closure::bind(function () use ($loader) {
359
- $loader->prefixLengthsPsr4 = ComposerStaticInitc7871f7b38ea431eb49202200227e974::$prefixLengthsPsr4;
360
- $loader->prefixDirsPsr4 = ComposerStaticInitc7871f7b38ea431eb49202200227e974::$prefixDirsPsr4;
361
- $loader->prefixesPsr0 = ComposerStaticInitc7871f7b38ea431eb49202200227e974::$prefixesPsr0;
362
- $loader->classMap = ComposerStaticInitc7871f7b38ea431eb49202200227e974::$classMap;
363
 
364
  }, null, ClassLoader::class);
365
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInitd8aa5b67905ce8ae7718f6219ae2a013
8
  {
9
  public static $files = array (
10
  'abede361264e2ae69ec1eee813a101af' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/abs.php',
356
  public static function getInitializer(ClassLoader $loader)
357
  {
358
  return \Closure::bind(function () use ($loader) {
359
+ $loader->prefixLengthsPsr4 = ComposerStaticInitd8aa5b67905ce8ae7718f6219ae2a013::$prefixLengthsPsr4;
360
+ $loader->prefixDirsPsr4 = ComposerStaticInitd8aa5b67905ce8ae7718f6219ae2a013::$prefixDirsPsr4;
361
+ $loader->prefixesPsr0 = ComposerStaticInitd8aa5b67905ce8ae7718f6219ae2a013::$prefixesPsr0;
362
+ $loader->classMap = ComposerStaticInitd8aa5b67905ce8ae7718f6219ae2a013::$classMap;
363
 
364
  }, null, ClassLoader::class);
365
  }
vendor/composer/installed.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php return array(
2
  'root' => array(
3
  'name' => 'codeinwp/visualizer',
4
- 'pretty_version' => 'v3.8.1',
5
- 'version' => '3.8.1.0',
6
- 'reference' => 'cce85855d65d0d465e6aec4e581579f8b357d606',
7
  'type' => 'wordpress-plugin',
8
  'install_path' => __DIR__ . '/../../',
9
  'aliases' => array(),
@@ -20,9 +20,9 @@
20
  'dev_requirement' => false,
21
  ),
22
  'codeinwp/visualizer' => array(
23
- 'pretty_version' => 'v3.8.1',
24
- 'version' => '3.8.1.0',
25
- 'reference' => 'cce85855d65d0d465e6aec4e581579f8b357d606',
26
  'type' => 'wordpress-plugin',
27
  'install_path' => __DIR__ . '/../../',
28
  'aliases' => array(),
1
  <?php return array(
2
  'root' => array(
3
  'name' => 'codeinwp/visualizer',
4
+ 'pretty_version' => 'v3.9.0',
5
+ 'version' => '3.9.0.0',
6
+ 'reference' => '9607e8c0795ac296d9e6128844f9f8f09d574946',
7
  'type' => 'wordpress-plugin',
8
  'install_path' => __DIR__ . '/../../',
9
  'aliases' => array(),
20
  'dev_requirement' => false,
21
  ),
22
  'codeinwp/visualizer' => array(
23
+ 'pretty_version' => 'v3.9.0',
24
+ 'version' => '3.9.0.0',
25
+ 'reference' => '9607e8c0795ac296d9e6128844f9f8f09d574946',
26
  'type' => 'wordpress-plugin',
27
  'install_path' => __DIR__ . '/../../',
28
  'aliases' => array(),