(this.webpackJsonpstreamlit_component_template=this.webpackJsonpstreamlit_component_template||[]).push([[0],{17:function(e,t,n){e.exports={poButton:"style_poButton__3x8Ka"}},18:function(e,t,n){e.exports=n(26)},26:function(e,t,n){"use strict";n.r(t);var o,s=n(8),r=n.n(s),a=n(15),i=n.n(a),c=n(6),p=n(0),l=n(1),u=n(2),d=n(3),m=n(11),f=n(17),h=n.n(f);!function(e){e[e.sketchup=0]="sketchup",e[e.rhino=1]="rhino",e[e.revit=2]="revit"}(o||(o={}));var y=function(e){Object(u.a)(n,e);var t=Object(d.a)(n);function n(e){var s;Object(p.a)(this,n),(s=t.call(this,e)).render=function(){return r.a.createElement("span",null,r.a.createElement("button",{className:h.a.poButton,onClick:s._onClicked,disabled:s.props.disabled,onFocus:s._onFocus,onBlur:s._onBlur},r.a.createElement("span",null,r.a.createElement("img",{style:{margin:"0px 3px 2px 0px"},src:"./img/pollination.png",alt:"logo"})),s.state.buttonText,""!==s.state.syncToken&&" - Sync"))},s._skpHandlerFnc=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];"undefined"!=typeof window.parent.sketchup?s.props.args.is_pollination_model?window.parent.sketchup.get_model(e,{onCompleted:function(e){console.log("[POLLINATION-DEBUG]: sketchup ruby done.");var t=JSON.parse(e),n=s.props.args.sync_token;s.setState(Object(c.a)(Object(c.a)({},s.state),{},{syncToken:n,geometry:t.Geometry,identifier:t.Identifier}),(function(){return m.a.setComponentValue(s.state.geometry)}))}}):window.parent.sketchup.get_geometry(s.props.args.key,e,{onCompleted:function(e){console.log("[POLLINATION-DEBUG]: sketchup ruby done.");var t=JSON.parse(e),n=s.props.args.sync_token;s.setState(Object(c.a)(Object(c.a)({},s.state),{},{syncToken:n,geometry:t.Geometry,identifier:t.Identifier}),(function(){return m.a.setComponentValue(s.state.geometry)}))}}):console.log("[POLLINATION-DEBUG]: sketchup not found.")},s._rhinoHandlerFnc=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if("undefined"!==typeof window.parent.chrome)if("undefined"===typeof window.parent.chrome.webview)console.log("[POLLINATION-DEBUG]: webview not found.");else{var t={Geometry:null,Identifier:null},n=s.props.args.sync_token;if(s.props.args.is_pollination_model){t=window.parent.chrome.webview.hostObjects.sync.hbjson.PassPollinationModel(e);var o=JSON.parse(t.Geometry);s.setState(Object(c.a)(Object(c.a)({},s.state),{},{syncToken:n,geometry:o,identifier:t.Identifier}),(function(){return m.a.setComponentValue(s.state.geometry)}))}else{t=window.parent.chrome.webview.hostObjects.sync.geometry.PassJsonGeometry(s.props.args.key,e);var r=JSON.parse(t.Geometry);s.setState(Object(c.a)(Object(c.a)({},s.state),{},{syncToken:n,geometry:r,identifier:t.Identifier}),(function(){return m.a.setComponentValue(s.state.geometry)}))}}else console.log("[POLLINATION-DEBUG]: chrome not found.")},s._onClicked=function(){var e=s.props.args.platform;e.toLowerCase()==o[o.rhino]?s._rhinoHandlerFnc(!0):e.toLowerCase()==o[o.sketchup]&&s._skpHandlerFnc(!0)},s._onFocus=function(){s.setState({isFocused:!0})},s._onBlur=function(){s.setState({isFocused:!1})};var a=s.props.args.is_pollination_model,i=s.props.args.platform,l=s.props.args.button_text,u={geometry:"",identifier:"",isPollinationModel:a,buttonText:l||(a?"Get Pollination Model":"Get Geometry"),syncToken:s.props.args.sync_token,platform:i.toLowerCase()};return s.state=Object(c.a)({},u),s}return Object(l.a)(n,[{key:"componentDidUpdate",value:function(){if(""!==this.state.identifier&&this.props.args.sync_token!==this.state.syncToken){var e=[];if(e=(e=this.state.platform==o[o.rhino]?JSON.parse(this.state.identifier):this.state.platform==o[o.sketchup]?this.state.identifier:[]).map(String)){var t=this.props.args.sync_token.split(":",1)[0];e.includes(t)&&this.state.syncToken!==this.props.args.sync_token&&(this.state.platform==o[o.rhino]?this._rhinoHandlerFnc():this.state.platform==o[o.sketchup]&&this._skpHandlerFnc(),console.log("[POLLINATION-DEBUG]: auto-update."))}}}}]),n}(m.b),g=Object(m.c)(y);i.a.render(r.a.createElement(r.a.StrictMode,null,r.a.createElement(g,null)),document.getElementById("root"))}},[[18,1,2]]]);
//# sourceMappingURL=main.24082df1.chunk.js.map