"use strict";(self.webpackChunkflow_web_extension=self.webpackChunkflow_web_extension||[]).push([["32683"],{786778:function(e,r,n){n.r(r),n.d(r,{VegaLiteRenderer:()=>w});var l=n(397458),o=n(337210),a=n(652983),i=n(987050),t=n(19083),s=n(999690),u=n(87608),c=n.n(u),d=n(221330),v=n(550385),f={container:"container-_OLUx9","error-wrapper":"error-wrapper-RxMooY","error-container":"error-container-vP7LIV","error-icon":"error-icon-fsKuqb","error-text":"error-text-S1TS1I"},w=(0,a.forwardRef)(function(e,r){var{code:n,className:u,onClick:w,loading:p,onError:m}=e,x=(0,d.g1)(),[b,h]=(0,a.useState)(null),[k,C]=(0,a.useState)(null),{panzoomRef:_}=(0,v.K)(b,k,{panzoomOptions:{},enableDoubleClickZoom:!0,padding:20,fullscreenMaxWidth:800}),j=(0,a.useCallback)(()=>{var e;return null===(e=_.current)||void 0===e?void 0:e.zoomIn()},[_]),N=(0,a.useCallback)(()=>{var e;return null===(e=_.current)||void 0===e?void 0:e.zoomOut()},[_]),S=(0,a.useCallback)(()=>{var e,r;return null===(r=_.current)||void 0===r?void 0:null===(e=r.fit)||void 0===e?void 0:e.call(r)},[_]);(0,a.useImperativeHandle)(r,()=>({zoomIn:j,zoomOut:N,fit:S}));var[z,O]=(0,a.useState)(!1),Z=(0,a.useCallback)((0,s.Z)(e=>{O(!0),null==m||m(e)}),[]);return(0,a.useEffect)(()=>{if(!p&&n&&k){try{e=JSON.parse((0,t.Z)(n))}catch(e){Z(e);return}if(!e){Z(Error("parse error"));return}var e,r=null,l=0;return(0,i.ZP)(k,e,{actions:!1}).then(e=>{r=null==e?void 0:e.view,l=window.setTimeout(()=>{S(),l=window.setTimeout(S,100)},0)},e=>{Z(e)}),()=>{var e;clearTimeout(l),null==r||null===(e=r.finalize)||void 0===e||e.call(r)}}},[p,n,S,k]),(0,a.useEffect)(()=>{if(b){var e=new ResizeObserver(()=>{S()});return e.observe(b),()=>e.disconnect()}},[S,b]),(0,l.jsxs)("div",{ref:h,onClick:w,className:c()("w-full h-full relative",f.container,u),children:[(0,l.jsx)("div",{ref:C}),z?(0,l.jsx)("div",{className:f["error-wrapper"],children:(0,l.jsxs)("div",{className:f["error-container"],children:[(0,l.jsx)(o.Z,{className:f["error-icon"]}),(0,l.jsx)("div",{className:f["error-text"],children:x("reading_mindmap_toast_reAsk")})]})}):null]})})}}]);
//# sourceMappingURL=vega-lite-renderer.js.map