!function(e){function t(l){if(n[l])return n[l].exports;var o=n[l]={i:l,l:!1,exports:{}};return e[l].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,l){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:l})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});n(1)},function(e,t,n){"use strict";var l=n(2),o=(n.n(l),n(3)),i=(n.n(o),wp.components),a=i.IconButton,r=i.PanelBody,c=i.TextControl,s=i.Toolbar,d=i.withNotices,m=wp.element.Fragment,p=wp.i18n.__,u=wp.blocks.registerBlockType,g=wp.editor,w=g.BlockControls,v=g.InspectorControls,b=g.BlockAlignmentToolbar,h=g.MediaPlaceholder,y=g.MediaUpload,E=g.AlignmentToolbar,f=(g.RichText,{title:{type:"array",source:"children",selector:"p"},url:{type:"string"},align:{type:"string"},width:{type:"number"},height:{type:"number"},contentAlign:{type:"string",default:"center"},id:{type:"number"}});u("cgb/block-algori-360-video",{title:p("360\xb0 Video"),description:p("Embed a 360\xb0 video file with a simple play/pause button."),icon:"format-video",category:"common",keywords:[p("algori panorama video - three sixty degree video"),p("spherical video - full-sphere video"),p("equirectangular video - VR (Virtual Reality) videography")],attributes:f,getEditWrapperProps:function(e){var t=e.align,n=e.width;if("left"===t||"center"===t||"right"===t||"wide"===t||"full"===t)return{"data-align":t,"data-resized":!!n}},edit:d(function(e){var t=e.attributes,n=e.setAttributes,l=(e.isSelected,e.className),o=e.noticeOperations,i=e.noticeUI,d=t.url,u=(t.title,t.align),g=t.width,f=t.height,_=t.contentAlign,k=t.id,N=function(e){return n({width:parseInt(e,10)})},P=function(e){return n({height:parseInt(e,10)})},V=function(e){return n({align:e})},C=function(){var e=document.getElementById("algori-360-video");e.paused?e.play():e.pause()},x=function(e){if(!e||!e.url)return void n({url:void 0,id:void 0});n({url:e.url,id:e.id})},T=wp.element.createElement(m,null,wp.element.createElement(w,null,wp.element.createElement(b,{value:u,onChange:V}),wp.element.createElement(E,{value:_,onChange:function(e){n({contentAlign:e})}}),wp.element.createElement(s,null,wp.element.createElement(y,{onSelect:x,allowedTypes:["image"],value:k,render:function(e){var t=e.open;return wp.element.createElement(a,{className:"components-toolbar__control",label:p("Edit video"),icon:"edit",onClick:t})}}))),!!d&&wp.element.createElement(v,null,wp.element.createElement(r,{title:p("360\xb0 Video Settings")},wp.element.createElement("div",{className:"core-blocks-image__dimensions"},wp.element.createElement("p",{className:"core-blocks-image__dimensions__row"},p("Video Dimensions")),wp.element.createElement("div",{className:"core-blocks-image__dimensions__row"},wp.element.createElement(c,{type:"number",className:"core-blocks-image__dimensions__width",label:p("Width"),value:void 0!==g?g:"",placeholder:600,min:1,onChange:N}),wp.element.createElement(c,{type:"number",className:"core-blocks-image__dimensions__height",label:p("Height"),value:void 0!==f?f:"",placeholder:300,min:1,onChange:P}))))));return d?wp.element.createElement(m,null,T,wp.element.createElement("div",null,wp.element.createElement("a-scene",{class:"wp-block-cgb-block-algori-360-video-embedded-scene",style:{width:g,height:f},embedded:!0},wp.element.createElement("a-assets",null,wp.element.createElement("video",{id:"algori-360-video",src:d,crossorigin:"anonymous",autoplay:"false",loop:"true"})),wp.element.createElement("a-videosphere",{src:"#algori-360-video"})),wp.element.createElement("div",{class:"wp-block-cgb-block-algori-360-video-controls",style:{width:g}},wp.element.createElement("button",{id:"algori-360-video-play-pause-btn",onClick:C},wp.element.createElement("span",{class:"dashicons-before dashicons-controls-play"},p("Play")),"\xa0|\xa0",wp.element.createElement("span",{class:"dashicons-before dashicons-controls-pause"},p("Pause")))))):wp.element.createElement(m,null,T,wp.element.createElement(h,{icon:"format-video",className:l,labels:{title:p("360 Video"),name:p("a 360\xb0 video")},onSelect:x,accept:"video/*",allowedTypes:["video"],notices:i,onError:o.createErrorNotice}))}),save:function(e){var t=e.attributes,n=(e.className,t.url),l=(t.title,t.align,t.width),o=t.height;t.contentAlign,t.id;return wp.element.createElement("div",null,wp.element.createElement("a-scene",{className:"wp-block-cgb-block-algori-360-video-embedded-scene",style:{width:l,height:o},embedded:""},wp.element.createElement("a-assets",null,wp.element.createElement("video",{id:"algori-360-video",src:n,crossorigin:"anonymous",autoplay:"false",loop:"true"})),wp.element.createElement("a-videosphere",{src:"#algori-360-video"})),wp.element.createElement("div",{className:"wp-block-cgb-block-algori-360-video-controls",style:{width:l}},wp.element.createElement("button",{id:"algori-360-video-play-pause-btn",onclick:"const algori360Video = document.getElementById('algori-360-video'); (algori360Video.paused) ? algori360Video.play() : algori360Video.pause();"},wp.element.createElement("span",{class:"dashicons-before dashicons-controls-play"},p("Play")),"\xa0|\xa0",wp.element.createElement("span",{class:"dashicons-before dashicons-controls-pause"},p("Pause")))))}})},function(e,t){},function(e,t){}]);