js-cloudimage-360-view 4.9.1 → 4.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- "use strict";var Si=Object.defineProperty;var Yi=(e,t,i)=>t in e?Si(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var Ie=(e,t,i)=>Yi(e,typeof t!="symbol"?t+"":t,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var Vt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Li(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ii="Expected a function",xe=NaN,Mi="[object Symbol]",Oi=/^\s+|\s+$/g,Hi=/^[-+]0x[0-9a-f]+$/i,Ri=/^0b[01]+$/i,zi=/^0o[0-7]+$/i,Zi=parseInt,Di=typeof Vt=="object"&&Vt&&Vt.Object===Object&&Vt,Bi=typeof self=="object"&&self&&self.Object===Object&&self,Gi=Di||Bi||Function("return this")(),_i=Object.prototype,Fi=_i.toString,Ni=Math.max,Wi=Math.min,le=function(){return Gi.Date.now()};function Vi(e,t,i){var o,s,n,r,a,l,c=0,h=!1,u=!1,m=!0;if(typeof e!="function")throw new TypeError(ii);t=Pe(t)||0,Kt(i)&&(h=!!i.leading,u="maxWait"in i,n=u?Ni(Pe(i.maxWait)||0,t):n,m="trailing"in i?!!i.trailing:m);function p(f){var y=o,I=s;return o=s=void 0,c=f,r=e.apply(I,y),r}function C(f){return c=f,a=setTimeout(x,t),h?p(f):r}function v(f){var y=f-l,I=f-c,T=t-y;return u?Wi(T,n-I):T}function b(f){var y=f-l,I=f-c;return l===void 0||y>=t||y<0||u&&I>=n}function x(){var f=le();if(b(f))return P(f);a=setTimeout(x,v(f))}function P(f){return a=void 0,m&&o?p(f):(o=s=void 0,r)}function w(){a!==void 0&&clearTimeout(a),c=0,o=l=s=a=void 0}function g(){return a===void 0?r:P(le())}function E(){var f=le(),y=b(f);if(o=arguments,s=this,l=f,y){if(a===void 0)return C(l);if(u)return a=setTimeout(x,t),p(l)}return a===void 0&&(a=setTimeout(x,t)),r}return E.cancel=w,E.flush=g,E}function ji(e,t,i){var o=!0,s=!0;if(typeof e!="function")throw new TypeError(ii);return Kt(i)&&(o="leading"in i?!!i.leading:o,s="trailing"in i?!!i.trailing:s),Vi(e,t,{leading:o,maxWait:t,trailing:s})}function Kt(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Ui(e){return!!e&&typeof e=="object"}function $i(e){return typeof e=="symbol"||Ui(e)&&Fi.call(e)==Mi}function Pe(e){if(typeof e=="number")return e;if($i(e))return xe;if(Kt(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Kt(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(Oi,"");var i=Ri.test(e);return i||zi.test(e)?Zi(e.slice(2),i?2:8):Hi.test(e)?xe:+e}var Ki=ji;const Ee=Li(Ki),S={SPIN_X:"spin-x",SPIN_Y:"spin-y",SPIN_XY:"spin-xy",SPIN_YX:"spin-yx"},qi=[!1,0,null,void 0,"false","0","null","undefined"],L={X:"x-axis",Y:"y-axis"},Ji=[37,39],Qi=[38,40],to=typeof navigator<"u"&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),Te=to?32:10,eo=150,io=150,oo=200,Ae=50,so=50,no=50,d={folder:"/",apiVersion:"v7",filenameX:"image-{index}.jpg",filenameY:null,imageListX:null,imageListY:null,filenameGrid:null,imageListGrid:null,indexZeroBase:0,amountX:0,amountY:0,speed:80,dragSpeed:150,draggable:!0,swipeable:!0,keys:!1,keysReverse:!1,autoplay:!1,autoplayBehavior:S.SPIN_X,playOnce:!1,autoplayReverse:!1,pointerZoom:0,pointerZoomTrigger:"dblclick",fullscreen:!1,zoomMax:5,zoomStep:.5,zoomControls:!0,zoomControlsPosition:"bottom-right",scrollHint:!0,bottomCircle:!0,bottomCircleOffset:5,ciToken:null,ciFilters:null,ciTransformation:null,lazyload:!0,dragReverse:!1,stopAtEdges:!1,stopAtEdgesX:null,stopAtEdgesY:null,imageInfo:!1,initialIconShown:!0,hotspots:null,hotspotTrigger:"hover",hide360Logo:!1,logoSrc:null,inertia:!1,pinchZoom:!0,hints:!0,theme:null,markerTheme:null,brandColor:null,hotspotTimelineOnClick:!0,aspectRatio:null,cropAspectRatio:null,cropGravity:null,onReady:null,onLoad:null,onSpin:null,onAutoplayStart:null,onAutoplayStop:null,onFullscreenOpen:null,onFullscreenClose:null,onZoomIn:null,onZoomOut:null,onDragStart:null,onDragEnd:null,onHotspotOpen:null,onHotspotClose:null,onProductClick:null,onNavigate:null,onError:null},ro=e=>({folder:A(e,"folder",d.folder),apiVersion:A(e,"api-version",d.apiVersion),filenameX:A(e,"filename")||A(e,"filename-x")||d.filenameX,filenameY:A(e,"filename-y",d.filenameY),imageListX:A(e,"image-list-x",d.imageListX),imageListY:A(e,"image-list-y",d.imageListY),filenameGrid:A(e,"filename-grid",d.filenameGrid),imageListGrid:A(e,"image-list-grid",d.imageListGrid),indexZeroBase:parseInt(A(e,"index-zero-base",d.indexZeroBase),10),amountX:parseInt(A(e,"amount-x",d.amountX),10),amountY:parseInt(A(e,"amount-y",d.amountY),10),speed:parseInt(A(e,"speed",d.speed),10),dragSpeed:parseInt(A(e,"drag-speed",d.dragSpeed),10),draggable:Y(e,"draggable",d.draggable),swipeable:Y(e,"swipeable",d.swipeable),keys:Y(e,"keys",d.keys),keysReverse:Y(e,"keys-reverse",d.keysReverse),autoplay:Y(e,"autoplay",d.autoplay),autoplayBehavior:A(e,"autoplay-behavior",d.autoplayBehavior),playOnce:Y(e,"play-once",d.playOnce),autoplayReverse:Y(e,"autoplay-reverse",d.autoplayReverse),pointerZoom:parseFloat(A(e,"pointer-zoom",d.pointerZoom)),pointerZoomTrigger:A(e,"pointer-zoom-trigger",d.pointerZoomTrigger),fullscreen:Y(e,"fullscreen")||Y(e,"full-screen",d.fullscreen),magnifier:A(e,"magnifier",null)!=null?parseFloat(A(e,"magnifier",null)):null,zoomMax:parseFloat(A(e,"zoom-max",d.zoomMax)),zoomStep:parseFloat(A(e,"zoom-step",d.zoomStep)),zoomControls:!ft(e,"zoom-controls"),zoomControlsPosition:A(e,"zoom-controls-position",d.zoomControlsPosition),scrollHint:!ft(e,"scroll-hint"),bottomCircleOffset:parseInt(A(e,"bottom-circle-offset",d.bottomCircleOffset),10),ciToken:A(e,"responsive",d.ciToken),ciFilters:A(e,"filters",d.ciFilters),ciTransformation:A(e,"transformation",d.ciTransformation),lazyload:Y(e,"lazyload",d.lazyload),dragReverse:Y(e,"drag-reverse",d.dragReverse),stopAtEdges:Y(e,"stop-at-edges",d.stopAtEdges),stopAtEdgesX:A(e,"stop-at-edges-x",null)!==null?Y(e,"stop-at-edges-x",null):null,stopAtEdgesY:A(e,"stop-at-edges-y",null)!==null?Y(e,"stop-at-edges-y",null):null,imageInfo:Y(e,"info",d.imageInfo),initialIconShown:!ft(e,"initial-icon"),bottomCircle:!ft(e,"bottom-circle"),hide360Logo:Y(e,"hide-360-logo",d.hide360Logo),logoSrc:A(e,"logo-src",d.logoSrc),inertia:Y(e,"inertia",d.inertia),pinchZoom:Y(e,"pinch-zoom",d.pinchZoom),hints:!ft(e,"hints"),theme:A(e,"theme",d.theme),markerTheme:A(e,"marker-theme",d.markerTheme),brandColor:A(e,"brand-color",d.brandColor),hotspotTrigger:A(e,"hotspot-trigger",d.hotspotTrigger),hotspotTimelineOnClick:!ft(e,"hotspot-timeline-on-click"),aspectRatio:A(e,"aspect-ratio",d.aspectRatio),cropAspectRatio:A(e,"crop-aspect-ratio",d.cropAspectRatio),cropGravity:A(e,"crop-gravity",d.cropGravity)}),ao=e=>{const t=[];e.amountX!==void 0&&e.amountX<0&&t.push("amountX should be a positive number"),e.amountY!==void 0&&e.amountY<0&&t.push("amountY should be a positive number"),e.speed!==void 0&&e.speed<=0&&t.push("speed should be a positive number"),e.dragSpeed!==void 0&&e.dragSpeed<=0&&t.push("dragSpeed should be a positive number"),e.pointerZoom!==void 0&&e.pointerZoom!==0&&(e.pointerZoom<1||e.pointerZoom>5)&&t.push("pointerZoom should be between 1 and 5 (or 0 to disable)"),e.magnifier!==void 0&&e.magnifier!==null&&e.magnifier!==0&&t.push("magnifier option is deprecated and will be ignored. Use zoomMax instead."),e.pointerZoomTrigger==="click"&&t.push('pointerZoomTrigger: "click" is deprecated. Zoom is now always triggered by double-click. Use dblclick trigger or the new zoom controls.');const i=!!(e.filenameGrid||e.imageListGrid);if(!i&&!e.folder&&!e.imageListX&&!e.imageListY&&t.push("Either folder or imageListX/imageListY is required"),!i&&e.folder&&!e.amountX&&!e.imageListX&&t.push("amountX is required when using folder (unless imageListX is provided)"),e.filenameGrid&&(!e.amountX||e.amountX<=0||!e.amountY||e.amountY<=0)&&t.push("filenameGrid requires both amountX > 0 and amountY > 0"),e.imageListGrid){(!e.amountX||e.amountX<=0||!e.amountY||e.amountY<=0)&&t.push("imageListGrid requires both amountX > 0 and amountY > 0");const s=Array.isArray(e.imageListGrid)?e.imageListGrid.flat():[];s.length&&e.amountX&&e.amountY&&s.length!==e.amountX*e.amountY&&t.push(`imageListGrid length (${s.length}) does not match amountX * amountY (${e.amountX*e.amountY})`)}const o=["spin-x","spin-y","spin-xy","spin-yx"];return e.autoplayBehavior&&!o.includes(e.autoplayBehavior)&&t.push(`autoplayBehavior should be one of: ${o.join(", ")}`),t.forEach(s=>{console.warn(`CloudImage 360: ${s}`)}),t.length===0},lo=e=>(ao(e),{folder:e.folder||d.folder,apiVersion:e.apiVersion||d.apiVersion,filenameX:e.filenameX||e.filename||d.filenameX,filenameY:e.filenameY||d.filenameY,imageListX:e.imageListX||d.imageListX,imageListY:e.imageListY||d.imageListY,filenameGrid:e.filenameGrid||d.filenameGrid,imageListGrid:e.imageListGrid||d.imageListGrid,indexZeroBase:parseInt(e.indexZeroBase??d.indexZeroBase,10),amountX:parseInt(e.amountX??d.amountX,10),amountY:parseInt(e.amountY??d.amountY,10),speed:parseInt(e.speed??d.speed,10),draggable:e.draggable??d.draggable,swipeable:e.swipeable??d.swipeable,dragSpeed:parseInt(e.dragSpeed??d.dragSpeed,10),keys:e.keys??d.keys,keysReverse:e.keysReverse??d.keysReverse,autoplay:e.autoplay??d.autoplay,autoplayBehavior:e.autoplayBehavior||d.autoplayBehavior,playOnce:e.playOnce??d.playOnce,autoplayReverse:e.autoplayReverse??d.autoplayReverse,pointerZoom:parseFloat(e.pointerZoom??d.pointerZoom),pointerZoomTrigger:e.pointerZoomTrigger||d.pointerZoomTrigger,fullscreen:e.fullscreen??d.fullscreen,magnifier:e.magnifier!=null?parseFloat(e.magnifier):null,zoomMax:parseFloat(e.zoomMax??d.zoomMax),zoomStep:parseFloat(e.zoomStep??d.zoomStep),zoomControls:e.zoomControls??d.zoomControls,zoomControlsPosition:e.zoomControlsPosition||d.zoomControlsPosition,scrollHint:e.scrollHint??d.scrollHint,bottomCircleOffset:parseInt(e.bottomCircleOffset??d.bottomCircleOffset,10),ciToken:e.ciToken||d.ciToken,ciFilters:e.ciFilters||d.ciFilters,ciTransformation:e.ciTransformation||d.ciTransformation,lazyload:e.lazyload??d.lazyload,dragReverse:e.dragReverse??d.dragReverse,stopAtEdges:e.stopAtEdges??d.stopAtEdges,stopAtEdgesX:e.stopAtEdgesX??d.stopAtEdgesX,stopAtEdgesY:e.stopAtEdgesY??d.stopAtEdgesY,imageInfo:e.imageInfo??d.imageInfo,initialIconShown:e.initialIconShown??d.initialIconShown,bottomCircle:e.bottomCircle??d.bottomCircle,hotspots:e.hotspots??d.hotspots,hotspotTrigger:e.hotspotTrigger||d.hotspotTrigger,hide360Logo:e.hide360Logo??d.hide360Logo,logoSrc:e.logoSrc||d.logoSrc,inertia:e.inertia??d.inertia,pinchZoom:e.pinchZoom??d.pinchZoom,hints:e.hints??d.hints,theme:e.theme||d.theme,markerTheme:e.markerTheme||d.markerTheme,brandColor:e.brandColor||d.brandColor,hotspotTimelineOnClick:e.hotspotTimelineOnClick??d.hotspotTimelineOnClick,aspectRatio:e.aspectRatio||d.aspectRatio,cropAspectRatio:e.cropAspectRatio||d.cropAspectRatio,cropGravity:e.cropGravity||d.cropGravity,onReady:e.onReady??d.onReady,onLoad:e.onLoad??d.onLoad,onSpin:e.onSpin??d.onSpin,onAutoplayStart:e.onAutoplayStart??d.onAutoplayStart,onAutoplayStop:e.onAutoplayStop??d.onAutoplayStop,onFullscreenOpen:e.onFullscreenOpen??d.onFullscreenOpen,onFullscreenClose:e.onFullscreenClose??d.onFullscreenClose,onZoomIn:e.onZoomIn??d.onZoomIn,onZoomOut:e.onZoomOut??d.onZoomOut,onDragStart:e.onDragStart??d.onDragStart,onDragEnd:e.onDragEnd??d.onDragEnd,onHotspotOpen:e.onHotspotOpen??d.onHotspotOpen,onHotspotClose:e.onHotspotClose??d.onHotspotClose,onProductClick:e.onProductClick??d.onProductClick,onNavigate:e.onNavigate??d.onNavigate,onError:e.onError??d.onError}),A=(e,t,i)=>e.getAttribute(t)||e.getAttribute(`data-${t}`)||i,Y=(e,t,i)=>{if(!(e.hasAttribute(t)||e.hasAttribute(`data-${t}`)))return i;const s=A(e,t,null);return s!=="false"&&s!=="0"},ft=(e,t)=>A(e,t,null)==="false",ho=(e=1)=>{const t=Math.round(window.devicePixelRatio||1);return parseInt(e)*t},co=(e,t,i)=>{try{if(new URL(e).origin.includes("cloudimg"))return e}catch{}return`https://${t}.cloudimg.io/${i}${e}`},ke=(e,t)=>e?`ar=${e}&gravity=${t||"auto"}`:"",uo=({ciTransformation:e,responsiveWidth:t,ciFilters:i})=>{const o=`width=${t}`,s=e||o,n=i?`&f=${i}`:"";return`${s}${n}`},at=(e,t)=>{const{folder:i,apiVersion:o,filename:s="",ciParams:n}=e,{ciToken:r,ciFilters:a,ciTransformation:l,cropAspectRatio:c,cropGravity:h}=n||{},u=`${i}${s}`;if(!r||!t){const w=ke(c,h);if(!w)return u;const g=u.includes("?")?"&":"?";return`${u}${g}${w}`}const m=qi.includes(o)?null:o,p=m?`${m}/`:"",C=ho(t),v=co(u,r,p),b=uo({ciTransformation:l,responsiveWidth:C,ciFilters:a}),x=ke(c,h),P=[b,x].filter(Boolean).join("&");return`${v}${P?"?":""}${P}`},qt=(e,t=0)=>(e+="",e.length>=t?e:new Array(t-e.length+1).join("0")+e),po=(e,{amount:t=0,indexZeroBase:i=0}={})=>Array.from({length:t},(o,s)=>e.replace("{index}",qt(s+1,i))),mo=(e,{amountX:t=0,amountY:i=0,indexZeroBase:o=0}={})=>{const s=[];for(let n=0;n<i;n++)for(let r=0;r<t;r++)s.push(e.replace("{indexX}",qt(r+1,o)).replace("{indexY}",qt(n+1,o)));return s},fo=typeof navigator<"u"&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),go=fo?3:6,oi=({imagesUrls:e,onFirstImageLoad:t,onImageLoad:i,onAllImagesLoad:o,onError:s,autoplayReverse:n})=>{let r=0,a=0;const l=e.length,c=[],h=[];let u=0,m=0;const p=[],C=(f,y,I=!1)=>{const T={message:`Failed to load image: ${f}`,url:f,index:y,isFirstImage:I};h.push(T),a++,s==null||s({error:T,errorCount:a,totalImages:l,errors:h})},v=()=>{r===l&&(o==null||o(c,{errorCount:a,errors:h}))},b=()=>{for(;u<go&&m<p.length;){const f=p[m];m++,x(e[f],f)}},x=(f,y)=>{u++;const I=new Image;I.crossOrigin="anonymous",I.src=f,I.onload=async()=>{try{const T=await createImageBitmap(I),k={src:f,bitmapImage:T,naturalWidth:I.naturalWidth,naturalHeight:I.naturalHeight};I.onload=null,I.onerror=null,I.src="",r++,u--,c[y]=k,i==null||i(k,y),v(),b()}catch{I.onload=null,I.onerror=null,I.src="",r++,u--,C(f,y),v(),b()}},I.onerror=()=>{I.onload=null,I.onerror=null,I.src="",r++,u--,C(f,y),v(),b()}},P=f=>{for(let y=0;y<e.length;y++)y!==f&&p.push(y);m=0,b()},w=new Image,g=n?e.length-1:0,E=e[g];w.crossOrigin="anonymous",w.src=E,w.onload=async()=>{try{const f=await createImageBitmap(w),y={src:E,bitmapImage:f,naturalWidth:w.naturalWidth,naturalHeight:w.naturalHeight};w.onload=null,w.onerror=null,w.src="",c[g]=y,r++,t==null||t(y),i==null||i(y,g),l===1?v():P(g)}catch{w.onload=null,w.onerror=null,w.src="",r++,C(E,g,!0),l===1?v():P(g)}},w.onerror=()=>{w.onload=null,w.onerror=null,w.src="",r++,C(E,g,!0),l===1?v():P(g)}},Xe=({cdnPathX:e,cdnPathY:t,configX:i,configY:o,onFirstImageLoad:s,onImageLoad:n,onAllImagesLoad:r,onError:a})=>{let l={x:!1,y:!1},c=[],h=[],u={errorCount:0,errors:[]},m={errorCount:0,errors:[]};const p=e||i.imageList.length,C=t||o.imageList.length,v=()=>{if(l.x&&l.y){const x={errorCount:u.errorCount+m.errorCount,errors:[...u.errors,...m.errors]};r==null||r(c,h,x)}},b=({cdnPath:x,config:P,orientation:w,loadedImages:g,loadStats:E,onFirstImageLoad:f})=>{const y=w===L.X,I=P.imageList.length?P.imageList:po(x,P);oi({imagesUrls:I,onFirstImageLoad:f,onImageLoad:(T,k)=>{n==null||n(T,k,w),g[k]=T},onError:T=>{a==null||a({...T,orientation:w})},onAllImagesLoad:(T,k)=>{g.length=0,T.forEach((X,O)=>{X&&(g[O]=X)}),E.errorCount=k.errorCount,E.errors=k.errors.map(X=>({...X,orientation:w})),l[y?"x":"y"]=!0,v()},autoplayReverse:P.autoplayReverse})};p?b({cdnPath:e,config:i,orientation:L.X,loadedImages:c,loadStats:u,onFirstImageLoad:s}):l.x=!0,C?b({cdnPath:t,config:o,orientation:L.Y,loadedImages:h,loadStats:m,onFirstImageLoad:p?void 0:s}):l.y=!0,!p&&!C&&v()},Se=({cdnPath:e,config:t,onFirstImageLoad:i,onImageLoad:o,onAllImagesLoad:s,onError:n})=>{const r=t.imageList&&t.imageList.length?t.imageList:mo(e,t);oi({imagesUrls:r,onFirstImageLoad:i,onImageLoad:(a,l)=>{o==null||o(a,l)},onAllImagesLoad:(a,l)=>{s==null||s(a,l)},onError:a=>{n==null||n(a)},autoplayReverse:t.autoplayReverse})},vo=`
1
+ "use strict";var Xi=Object.defineProperty;var Yi=(e,t,i)=>t in e?Xi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var Ie=(e,t,i)=>Yi(e,typeof t!="symbol"?t+"":t,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var Vt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Li(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ii="Expected a function",xe=NaN,Mi="[object Symbol]",Oi=/^\s+|\s+$/g,Hi=/^[-+]0x[0-9a-f]+$/i,Ri=/^0b[01]+$/i,zi=/^0o[0-7]+$/i,Zi=parseInt,Di=typeof Vt=="object"&&Vt&&Vt.Object===Object&&Vt,Bi=typeof self=="object"&&self&&self.Object===Object&&self,Gi=Di||Bi||Function("return this")(),_i=Object.prototype,Fi=_i.toString,Ni=Math.max,Wi=Math.min,le=function(){return Gi.Date.now()};function Vi(e,t,i){var o,s,n,r,a,l,c=0,h=!1,u=!1,m=!0;if(typeof e!="function")throw new TypeError(ii);t=Pe(t)||0,Kt(i)&&(h=!!i.leading,u="maxWait"in i,n=u?Ni(Pe(i.maxWait)||0,t):n,m="trailing"in i?!!i.trailing:m);function p(f){var y=o,I=s;return o=s=void 0,c=f,r=e.apply(I,y),r}function C(f){return c=f,a=setTimeout(x,t),h?p(f):r}function v(f){var y=f-l,I=f-c,T=t-y;return u?Wi(T,n-I):T}function b(f){var y=f-l,I=f-c;return l===void 0||y>=t||y<0||u&&I>=n}function x(){var f=le();if(b(f))return P(f);a=setTimeout(x,v(f))}function P(f){return a=void 0,m&&o?p(f):(o=s=void 0,r)}function w(){a!==void 0&&clearTimeout(a),c=0,o=l=s=a=void 0}function g(){return a===void 0?r:P(le())}function E(){var f=le(),y=b(f);if(o=arguments,s=this,l=f,y){if(a===void 0)return C(l);if(u)return a=setTimeout(x,t),p(l)}return a===void 0&&(a=setTimeout(x,t)),r}return E.cancel=w,E.flush=g,E}function ji(e,t,i){var o=!0,s=!0;if(typeof e!="function")throw new TypeError(ii);return Kt(i)&&(o="leading"in i?!!i.leading:o,s="trailing"in i?!!i.trailing:s),Vi(e,t,{leading:o,maxWait:t,trailing:s})}function Kt(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Ui(e){return!!e&&typeof e=="object"}function $i(e){return typeof e=="symbol"||Ui(e)&&Fi.call(e)==Mi}function Pe(e){if(typeof e=="number")return e;if($i(e))return xe;if(Kt(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Kt(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(Oi,"");var i=Ri.test(e);return i||zi.test(e)?Zi(e.slice(2),i?2:8):Hi.test(e)?xe:+e}var Ki=ji;const Ee=Li(Ki),Y={SPIN_X:"spin-x",SPIN_Y:"spin-y",SPIN_XY:"spin-xy",SPIN_YX:"spin-yx"},qi=[!1,0,null,void 0,"false","0","null","undefined"],L={X:"x-axis",Y:"y-axis"},Ji=[37,39],Qi=[38,40],to=typeof navigator<"u"&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),Te=to?32:10,eo=150,io=150,oo=200,Ae=50,so=50,no=50,d={folder:"/",apiVersion:"v7",filenameX:"image-{index}.jpg",filenameY:null,imageListX:null,imageListY:null,filenameGrid:null,imageListGrid:null,indexZeroBase:0,amountX:0,amountY:0,speed:80,dragSpeed:150,draggable:!0,swipeable:!0,keys:!1,keysReverse:!1,autoplay:!1,autoplayBehavior:Y.SPIN_X,playOnce:!1,autoplayReverse:!1,pointerZoom:0,pointerZoomTrigger:"dblclick",fullscreen:!1,zoomMax:5,zoomStep:.5,zoomControls:!0,zoomControlsPosition:"bottom-right",scrollHint:!0,bottomCircle:!1,bottomCircleOffset:5,ciToken:null,ciFilters:null,ciTransformation:null,lazyload:!0,dragReverse:!1,stopAtEdges:!1,stopAtEdgesX:null,stopAtEdgesY:null,imageInfo:!1,initialIconShown:!0,hotspots:null,hotspotTrigger:"hover",hide360Logo:!1,logoSrc:null,inertia:!1,pinchZoom:!0,hints:!0,theme:null,markerTheme:null,brandColor:null,hotspotTimelineOnClick:!0,aspectRatio:null,cropAspectRatio:null,cropGravity:null,onReady:null,onLoad:null,onSpin:null,onAutoplayStart:null,onAutoplayStop:null,onFullscreenOpen:null,onFullscreenClose:null,onZoomIn:null,onZoomOut:null,onDragStart:null,onDragEnd:null,onHotspotOpen:null,onHotspotClose:null,onProductClick:null,onNavigate:null,onError:null},ro=e=>({folder:A(e,"folder",d.folder),apiVersion:A(e,"api-version",d.apiVersion),filenameX:A(e,"filename")||A(e,"filename-x")||d.filenameX,filenameY:A(e,"filename-y",d.filenameY),imageListX:A(e,"image-list-x",d.imageListX),imageListY:A(e,"image-list-y",d.imageListY),filenameGrid:A(e,"filename-grid",d.filenameGrid),imageListGrid:A(e,"image-list-grid",d.imageListGrid),indexZeroBase:parseInt(A(e,"index-zero-base",d.indexZeroBase),10),amountX:parseInt(A(e,"amount-x",d.amountX),10),amountY:parseInt(A(e,"amount-y",d.amountY),10),speed:parseInt(A(e,"speed",d.speed),10),dragSpeed:parseInt(A(e,"drag-speed",d.dragSpeed),10),draggable:X(e,"draggable",d.draggable),swipeable:X(e,"swipeable",d.swipeable),keys:X(e,"keys",d.keys),keysReverse:X(e,"keys-reverse",d.keysReverse),autoplay:X(e,"autoplay",d.autoplay),autoplayBehavior:A(e,"autoplay-behavior",d.autoplayBehavior),playOnce:X(e,"play-once",d.playOnce),autoplayReverse:X(e,"autoplay-reverse",d.autoplayReverse),pointerZoom:parseFloat(A(e,"pointer-zoom",d.pointerZoom)),pointerZoomTrigger:A(e,"pointer-zoom-trigger",d.pointerZoomTrigger),fullscreen:X(e,"fullscreen")||X(e,"full-screen",d.fullscreen),magnifier:A(e,"magnifier",null)!=null?parseFloat(A(e,"magnifier",null)):null,zoomMax:parseFloat(A(e,"zoom-max",d.zoomMax)),zoomStep:parseFloat(A(e,"zoom-step",d.zoomStep)),zoomControls:!Et(e,"zoom-controls"),zoomControlsPosition:A(e,"zoom-controls-position",d.zoomControlsPosition),scrollHint:!Et(e,"scroll-hint"),bottomCircleOffset:parseInt(A(e,"bottom-circle-offset",d.bottomCircleOffset),10),ciToken:A(e,"responsive",d.ciToken),ciFilters:A(e,"filters",d.ciFilters),ciTransformation:A(e,"transformation",d.ciTransformation),lazyload:X(e,"lazyload",d.lazyload),dragReverse:X(e,"drag-reverse",d.dragReverse),stopAtEdges:X(e,"stop-at-edges",d.stopAtEdges),stopAtEdgesX:A(e,"stop-at-edges-x",null)!==null?X(e,"stop-at-edges-x",null):null,stopAtEdgesY:A(e,"stop-at-edges-y",null)!==null?X(e,"stop-at-edges-y",null):null,imageInfo:X(e,"info",d.imageInfo),initialIconShown:!Et(e,"initial-icon"),bottomCircle:X(e,"bottom-circle",d.bottomCircle),hide360Logo:X(e,"hide-360-logo",d.hide360Logo),logoSrc:A(e,"logo-src",d.logoSrc),inertia:X(e,"inertia",d.inertia),pinchZoom:X(e,"pinch-zoom",d.pinchZoom),hints:!Et(e,"hints"),theme:A(e,"theme",d.theme),markerTheme:A(e,"marker-theme",d.markerTheme),brandColor:A(e,"brand-color",d.brandColor),hotspotTrigger:A(e,"hotspot-trigger",d.hotspotTrigger),hotspotTimelineOnClick:!Et(e,"hotspot-timeline-on-click"),aspectRatio:A(e,"aspect-ratio",d.aspectRatio),cropAspectRatio:A(e,"crop-aspect-ratio",d.cropAspectRatio),cropGravity:A(e,"crop-gravity",d.cropGravity)}),ao=e=>{const t=[];e.amountX!==void 0&&e.amountX<0&&t.push("amountX should be a positive number"),e.amountY!==void 0&&e.amountY<0&&t.push("amountY should be a positive number"),e.speed!==void 0&&e.speed<=0&&t.push("speed should be a positive number"),e.dragSpeed!==void 0&&e.dragSpeed<=0&&t.push("dragSpeed should be a positive number"),e.pointerZoom!==void 0&&e.pointerZoom!==0&&(e.pointerZoom<1||e.pointerZoom>5)&&t.push("pointerZoom should be between 1 and 5 (or 0 to disable)"),e.magnifier!==void 0&&e.magnifier!==null&&e.magnifier!==0&&t.push("magnifier option is deprecated and will be ignored. Use zoomMax instead."),e.pointerZoomTrigger==="click"&&t.push('pointerZoomTrigger: "click" is deprecated. Zoom is now always triggered by double-click. Use dblclick trigger or the new zoom controls.');const i=!!(e.filenameGrid||e.imageListGrid);if(!i&&!e.folder&&!e.imageListX&&!e.imageListY&&t.push("Either folder or imageListX/imageListY is required"),!i&&e.folder&&!e.amountX&&!e.imageListX&&t.push("amountX is required when using folder (unless imageListX is provided)"),e.filenameGrid&&(!e.amountX||e.amountX<=0||!e.amountY||e.amountY<=0)&&t.push("filenameGrid requires both amountX > 0 and amountY > 0"),e.imageListGrid){(!e.amountX||e.amountX<=0||!e.amountY||e.amountY<=0)&&t.push("imageListGrid requires both amountX > 0 and amountY > 0");const s=Array.isArray(e.imageListGrid)?e.imageListGrid.flat():[];s.length&&e.amountX&&e.amountY&&s.length!==e.amountX*e.amountY&&t.push(`imageListGrid length (${s.length}) does not match amountX * amountY (${e.amountX*e.amountY})`)}const o=["spin-x","spin-y","spin-xy","spin-yx"];return e.autoplayBehavior&&!o.includes(e.autoplayBehavior)&&t.push(`autoplayBehavior should be one of: ${o.join(", ")}`),t.forEach(s=>{console.warn(`CloudImage 360: ${s}`)}),t.length===0},lo=e=>(ao(e),{folder:e.folder||d.folder,apiVersion:e.apiVersion||d.apiVersion,filenameX:e.filenameX||e.filename||d.filenameX,filenameY:e.filenameY||d.filenameY,imageListX:e.imageListX||d.imageListX,imageListY:e.imageListY||d.imageListY,filenameGrid:e.filenameGrid||d.filenameGrid,imageListGrid:e.imageListGrid||d.imageListGrid,indexZeroBase:parseInt(e.indexZeroBase??d.indexZeroBase,10),amountX:parseInt(e.amountX??d.amountX,10),amountY:parseInt(e.amountY??d.amountY,10),speed:parseInt(e.speed??d.speed,10),draggable:e.draggable??d.draggable,swipeable:e.swipeable??d.swipeable,dragSpeed:parseInt(e.dragSpeed??d.dragSpeed,10),keys:e.keys??d.keys,keysReverse:e.keysReverse??d.keysReverse,autoplay:e.autoplay??d.autoplay,autoplayBehavior:e.autoplayBehavior||d.autoplayBehavior,playOnce:e.playOnce??d.playOnce,autoplayReverse:e.autoplayReverse??d.autoplayReverse,pointerZoom:parseFloat(e.pointerZoom??d.pointerZoom),pointerZoomTrigger:e.pointerZoomTrigger||d.pointerZoomTrigger,fullscreen:e.fullscreen??d.fullscreen,magnifier:e.magnifier!=null?parseFloat(e.magnifier):null,zoomMax:parseFloat(e.zoomMax??d.zoomMax),zoomStep:parseFloat(e.zoomStep??d.zoomStep),zoomControls:e.zoomControls??d.zoomControls,zoomControlsPosition:e.zoomControlsPosition||d.zoomControlsPosition,scrollHint:e.scrollHint??d.scrollHint,bottomCircleOffset:parseInt(e.bottomCircleOffset??d.bottomCircleOffset,10),ciToken:e.ciToken||d.ciToken,ciFilters:e.ciFilters||d.ciFilters,ciTransformation:e.ciTransformation||d.ciTransformation,lazyload:e.lazyload??d.lazyload,dragReverse:e.dragReverse??d.dragReverse,stopAtEdges:e.stopAtEdges??d.stopAtEdges,stopAtEdgesX:e.stopAtEdgesX??d.stopAtEdgesX,stopAtEdgesY:e.stopAtEdgesY??d.stopAtEdgesY,imageInfo:e.imageInfo??d.imageInfo,initialIconShown:e.initialIconShown??d.initialIconShown,bottomCircle:e.bottomCircle??d.bottomCircle,hotspots:e.hotspots??d.hotspots,hotspotTrigger:e.hotspotTrigger||d.hotspotTrigger,hide360Logo:e.hide360Logo??d.hide360Logo,logoSrc:e.logoSrc||d.logoSrc,inertia:e.inertia??d.inertia,pinchZoom:e.pinchZoom??d.pinchZoom,hints:e.hints??d.hints,theme:e.theme||d.theme,markerTheme:e.markerTheme||d.markerTheme,brandColor:e.brandColor||d.brandColor,hotspotTimelineOnClick:e.hotspotTimelineOnClick??d.hotspotTimelineOnClick,aspectRatio:e.aspectRatio||d.aspectRatio,cropAspectRatio:e.cropAspectRatio||d.cropAspectRatio,cropGravity:e.cropGravity||d.cropGravity,onReady:e.onReady??d.onReady,onLoad:e.onLoad??d.onLoad,onSpin:e.onSpin??d.onSpin,onAutoplayStart:e.onAutoplayStart??d.onAutoplayStart,onAutoplayStop:e.onAutoplayStop??d.onAutoplayStop,onFullscreenOpen:e.onFullscreenOpen??d.onFullscreenOpen,onFullscreenClose:e.onFullscreenClose??d.onFullscreenClose,onZoomIn:e.onZoomIn??d.onZoomIn,onZoomOut:e.onZoomOut??d.onZoomOut,onDragStart:e.onDragStart??d.onDragStart,onDragEnd:e.onDragEnd??d.onDragEnd,onHotspotOpen:e.onHotspotOpen??d.onHotspotOpen,onHotspotClose:e.onHotspotClose??d.onHotspotClose,onProductClick:e.onProductClick??d.onProductClick,onNavigate:e.onNavigate??d.onNavigate,onError:e.onError??d.onError}),A=(e,t,i)=>e.getAttribute(t)||e.getAttribute(`data-${t}`)||i,X=(e,t,i)=>{if(!(e.hasAttribute(t)||e.hasAttribute(`data-${t}`)))return i;const s=A(e,t,null);return s!=="false"&&s!=="0"},Et=(e,t)=>A(e,t,null)==="false",ho=(e=1)=>{const t=Math.round(window.devicePixelRatio||1);return parseInt(e)*t},co=(e,t,i)=>{try{if(new URL(e).origin.includes("cloudimg"))return e}catch{}const o=e.startsWith("/")?e.slice(1):e;return`https://${t}.cloudimg.io/${i}${o}`},ke=(e,t)=>e?`ar=${e}&gravity=${t||"auto"}`:"",uo=({ciTransformation:e,responsiveWidth:t,ciFilters:i})=>{const o=`width=${t}`,s=e||o,n=i?`&f=${i}`:"";return`${s}${n}`},at=(e,t)=>{const{folder:i,apiVersion:o,filename:s="",ciParams:n}=e,{ciToken:r,ciFilters:a,ciTransformation:l,cropAspectRatio:c,cropGravity:h}=n||{},u=`${i}${s}`;if(!r||!t){const w=ke(c,h);if(!w)return u;const g=u.includes("?")?"&":"?";return`${u}${g}${w}`}const m=qi.includes(o)?null:o,p=m?`${m}/`:"",C=ho(t),v=co(u,r,p),b=uo({ciTransformation:l,responsiveWidth:C,ciFilters:a}),x=ke(c,h),P=[b,x].filter(Boolean).join("&");return`${v}${P?"?":""}${P}`},qt=(e,t=0)=>(e+="",e.length>=t?e:new Array(t-e.length+1).join("0")+e),po=(e,{amount:t=0,indexZeroBase:i=0}={})=>Array.from({length:t},(o,s)=>e.replace("{index}",qt(s+1,i))),mo=(e,{amountX:t=0,amountY:i=0,indexZeroBase:o=0}={})=>{const s=[];for(let n=0;n<i;n++)for(let r=0;r<t;r++)s.push(e.replace("{indexX}",qt(r+1,o)).replace("{indexY}",qt(n+1,o)));return s},fo=typeof navigator<"u"&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),go=fo?3:6,oi=({imagesUrls:e,onFirstImageLoad:t,onImageLoad:i,onAllImagesLoad:o,onError:s,autoplayReverse:n})=>{let r=0,a=0;const l=e.length,c=[],h=[];let u=0,m=0;const p=[],C=(f,y,I=!1)=>{const T={message:`Failed to load image: ${f}`,url:f,index:y,isFirstImage:I};h.push(T),a++,s==null||s({error:T,errorCount:a,totalImages:l,errors:h})},v=()=>{r===l&&(o==null||o(c,{errorCount:a,errors:h}))},b=()=>{for(;u<go&&m<p.length;){const f=p[m];m++,x(e[f],f)}},x=(f,y)=>{u++;const I=new Image;I.crossOrigin="anonymous",I.src=f,I.onload=async()=>{try{const T=await createImageBitmap(I),k={src:f,bitmapImage:T,naturalWidth:I.naturalWidth,naturalHeight:I.naturalHeight};I.onload=null,I.onerror=null,I.src="",r++,u--,c[y]=k,i==null||i(k,y),v(),b()}catch{I.onload=null,I.onerror=null,I.src="",r++,u--,C(f,y),v(),b()}},I.onerror=()=>{I.onload=null,I.onerror=null,I.src="",r++,u--,C(f,y),v(),b()}},P=f=>{for(let y=0;y<e.length;y++)y!==f&&p.push(y);m=0,b()},w=new Image,g=n?e.length-1:0,E=e[g];w.crossOrigin="anonymous",w.src=E,w.onload=async()=>{try{const f=await createImageBitmap(w),y={src:E,bitmapImage:f,naturalWidth:w.naturalWidth,naturalHeight:w.naturalHeight};w.onload=null,w.onerror=null,w.src="",c[g]=y,r++,t==null||t(y),i==null||i(y,g),l===1?v():P(g)}catch{w.onload=null,w.onerror=null,w.src="",r++,C(E,g,!0),l===1?v():P(g)}},w.onerror=()=>{w.onload=null,w.onerror=null,w.src="",r++,C(E,g,!0),l===1?v():P(g)}},Se=({cdnPathX:e,cdnPathY:t,configX:i,configY:o,onFirstImageLoad:s,onImageLoad:n,onAllImagesLoad:r,onError:a})=>{let l={x:!1,y:!1},c=[],h=[],u={errorCount:0,errors:[]},m={errorCount:0,errors:[]};const p=e||i.imageList.length,C=t||o.imageList.length,v=()=>{if(l.x&&l.y){const x={errorCount:u.errorCount+m.errorCount,errors:[...u.errors,...m.errors]};r==null||r(c,h,x)}},b=({cdnPath:x,config:P,orientation:w,loadedImages:g,loadStats:E,onFirstImageLoad:f})=>{const y=w===L.X,I=P.imageList.length?P.imageList:po(x,P);oi({imagesUrls:I,onFirstImageLoad:f,onImageLoad:(T,k)=>{n==null||n(T,k,w),g[k]=T},onError:T=>{a==null||a({...T,orientation:w})},onAllImagesLoad:(T,k)=>{g.length=0,T.forEach((S,O)=>{S&&(g[O]=S)}),E.errorCount=k.errorCount,E.errors=k.errors.map(S=>({...S,orientation:w})),l[y?"x":"y"]=!0,v()},autoplayReverse:P.autoplayReverse})};p?b({cdnPath:e,config:i,orientation:L.X,loadedImages:c,loadStats:u,onFirstImageLoad:s}):l.x=!0,C?b({cdnPath:t,config:o,orientation:L.Y,loadedImages:h,loadStats:m,onFirstImageLoad:p?void 0:s}):l.y=!0,!p&&!C&&v()},Xe=({cdnPath:e,config:t,onFirstImageLoad:i,onImageLoad:o,onAllImagesLoad:s,onError:n})=>{const r=t.imageList&&t.imageList.length?t.imageList:mo(e,t);oi({imagesUrls:r,onFirstImageLoad:i,onImageLoad:(a,l)=>{o==null||o(a,l)},onAllImagesLoad:(a,l)=>{s==null||s(a,l)},onError:a=>{n==null||n(a)},autoplayReverse:t.autoplayReverse})},vo=`
2
2
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1052 156" aria-hidden="true">
3
3
  <path fill="currentColor" d="M409.9,145.6c-42.7-1.7-85.5-4.4-128.1-8.4c-21.3-2-42.6-4.3-63.8-7.1c-21.2-2.8-42.4-5.9-63.4-9.7c-21.1-3.8-42-8.2-62.7-13.7c-10.3-2.8-20.6-5.8-30.7-9.4c-10.1-3.5-20.1-7.6-29.5-12.7c-4.7-2.6-9.3-5.4-13.5-8.8c-2.1-1.7-4-3.6-5.8-5.6c-1.8-2-3.3-4.3-4.3-6.8c-1.1-2.5-1.6-5.3-1.4-8c0.2-2.7,1.1-5.4,2.4-7.7c2.7-4.8,6.7-8.5,11-11.7c8.6-6.4,18.4-10.9,28.3-15c9.9-4,20.1-7.3,30.4-10.3c-10.2,3.1-20.4,6.5-30.3,10.5c-9.8,4.1-19.6,8.7-28.1,15.1c-4.2,3.2-8.2,6.9-10.7,11.6c-1.2,2.3-2.1,4.8-2.3,7.5c-0.1,2.6,0.4,5.2,1.4,7.6c2.1,4.8,5.9,8.7,10,12.1c4.1,3.3,8.7,6.1,13.4,8.6c9.4,5,19.4,8.9,29.4,12.4c10.1,3.5,20.4,6.4,30.7,9.1c20.7,5.3,41.6,9.5,62.7,13.2c21,3.6,42.2,6.6,63.4,9.2c21.2,2.6,42.5,4.8,63.7,6.6c42.6,3.7,85.2,6,127.9,7.4L409.9,145.6z"/>
4
4
  <path fill="currentColor" d="M977.1,11.6c13.8,4.1,27.4,8.8,40.4,15.2c6.4,3.2,12.7,6.9,18.3,11.5c2.7,2.4,5.3,5,7.3,8c2,3,3.3,6.6,3.3,10.3c0,3.7-1.4,7.2-3.3,10.3c-2,3.1-4.5,5.7-7.3,8.1c-2.7,2.4-5.7,4.4-8.8,6.3c-1.6,0.9-3.1,1.9-4.7,2.7l-2.4,1.3l-2.4,1.2C1004.5,93,990.8,97.8,977,102c-6.9,2.1-13.8,4-20.8,5.8c-7,1.8-14,3.5-21,5c-14.1,3.1-28.2,5.9-42.4,8.3c-28.4,4.9-57,8.8-85.6,12c-57.3,6.4-114.8,10.2-172.4,12.2c-57.6,2-115.2,2.3-172.9,0.8l0.1-4c57.5,1.8,115.1,1.9,172.6,0.2c57.5-1.7,115-5.2,172.3-11.2c28.6-3.1,57.2-6.7,85.6-11.5c14.2-2.4,28.3-5,42.4-8.1c7-1.5,14-3.1,21-4.9c7-1.7,13.9-3.6,20.8-5.7c13.8-4.1,27.4-8.8,40.3-15.2l2.4-1.2l2.4-1.3c1.6-0.8,3.1-1.8,4.7-2.7c3-1.9,6-3.9,8.7-6.2c2.7-2.3,5.2-4.9,7.2-7.9c1.9-3,3.2-6.4,3.3-10c0-3.6-1.2-7-3.1-10c-1.9-3-4.4-5.6-7.1-8c-5.5-4.7-11.7-8.3-18.1-11.6C1004.5,20.6,990.8,15.8,977.1,11.6z"/>
@@ -50,7 +50,7 @@
50
50
  </clipPath>
51
51
  </defs>
52
52
  </svg>
53
- `,wo=e=>{const t=document.createElement("div");return t.className="cloudimage-initial-icon",t.setAttribute("aria-label","360 degree view - drag to rotate"),e?(t.style.backgroundImage=`url('${e}')`,t.style.backgroundPosition="50% 50%",t.style.backgroundSize="contain",t.style.backgroundRepeat="no-repeat"):t.innerHTML=bo,t},Co=(e,t)=>{const{width:i,height:o}=t,s=document.createElement("canvas");return s.width=i,s.height=o,s.style.width="100%",s.style.height="auto",e.appendChild(s),s},si='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/><line x1="21" x2="14" y1="3" y2="10"/><line x1="3" x2="10" y1="21" y2="14"/></svg>',Io='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="4 14 10 14 10 20"/><polyline points="20 10 14 10 14 4"/><line x1="14" x2="21" y1="10" y2="3"/><line x1="3" x2="10" y1="21" y2="14"/></svg>',xo=()=>{const e=document.createElement("button");return e.className="cloudimage-360-button cloudimage-360-fullscreen-button",e.setAttribute("aria-label","View fullscreen"),e.setAttribute("type","button"),e.innerHTML=si,e},Po=(e,t)=>{e&&(e.innerHTML=t?Io:si,e.setAttribute("aria-label",t?"Exit fullscreen":"View fullscreen"))},Ye=e=>{const t=document.createElement("div");return t.className="cloudimage-360-icons-container",e.appendChild(t),t},Eo=e=>{const t=document.createElement("div");return t.className="cloudimage-360-inner-box",t.setAttribute("role","img"),t.setAttribute("aria-label","360 degree product view. Use mouse drag or arrow keys to rotate."),e.appendChild(t),t},To=e=>{const t=document.createElement("div");t.className="cloudimage-360-loader";const i=document.createElement("span");return i.className="percentage",i.innerText="0%",t.appendChild(i),e.appendChild(t),t},ue=(e,t)=>{const i=e.querySelector(t);i&&i.parentNode.removeChild(i)},Ao=()=>{const e=document.createElement("div");return e.className="cloudimage-loading-spinner",e},ko=e=>{const t=document.createElement("div");return t.className="cloudimage-360-hotspot-container",e.appendChild(t),t},Xo=e=>{const t=document.createElement("div");return t.className="cloudimage-360-sr-only",t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),e.appendChild(t),t},So=(e,t)=>{e&&(e.textContent="",setTimeout(()=>{e.textContent=t},50))},ni={drag:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2"/><path d="M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2"/><path d="M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8"/><path d="M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"/></svg>',swipe:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m18 16 4-4-4-4"/><path d="m6 8-4 4 4 4"/><path d="M8 12h8"/></svg>',click:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 9 5 12 1.8-5.2L21 14Z"/><path d="M7.2 2.2 8 5.1"/><path d="m5.1 8-2.9-.8"/><path d="M14 4.1 12 6"/><path d="m6 12-1.9 2"/></svg>',dblclick:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 9 5 12 1.8-5.2L21 14Z"/><path d="M7.2 2.2 8 5.1"/><path d="m5.1 8-2.9-.8"/><path d="M14 4.1 12 6"/><path d="m6 12-1.9 2"/><text x="1" y="22" font-size="8" font-weight="bold" fill="currentColor" stroke="none" font-family="sans-serif">2×</text></svg>',pinch:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 6l4 4"/><path d="M18 6l-4 4"/><path d="M6 18l4-4"/><path d="M18 18l-4-4"/><circle cx="12" cy="12" r="2"/></svg>',keys:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="20" height="16" x="2" y="4" rx="2"/><path d="m9 10 3 3 3-3"/></svg>',fullscreen:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/><line x1="21" x2="14" y1="3" y2="10"/><line x1="3" x2="10" y1="21" y2="14"/></svg>'},Yo={drag:"Drag to rotate",swipe:"Swipe to rotate",click:"Click to zoom",dblclick:"Double-click to zoom",pinch:"Pinch to zoom",keys:"Use arrow keys",fullscreen:"Click for fullscreen"},Lo=e=>{const t=document.createElement("div");t.className="cloudimage-360-hint-item";const i=Yo[e];return t.innerHTML=`
53
+ `,wo=e=>{const t=document.createElement("div");return t.className="cloudimage-initial-icon",t.setAttribute("aria-label","360 degree view - drag to rotate"),e?(t.style.backgroundImage=`url('${e}')`,t.style.backgroundPosition="50% 50%",t.style.backgroundSize="contain",t.style.backgroundRepeat="no-repeat"):t.innerHTML=bo,t},Co=(e,t)=>{const{width:i,height:o}=t,s=document.createElement("canvas");return s.width=i,s.height=o,s.style.width="100%",s.style.height="auto",e.appendChild(s),s},si='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/><line x1="21" x2="14" y1="3" y2="10"/><line x1="3" x2="10" y1="21" y2="14"/></svg>',Io='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="4 14 10 14 10 20"/><polyline points="20 10 14 10 14 4"/><line x1="14" x2="21" y1="10" y2="3"/><line x1="3" x2="10" y1="21" y2="14"/></svg>',xo=()=>{const e=document.createElement("button");return e.className="cloudimage-360-button cloudimage-360-fullscreen-button",e.setAttribute("aria-label","View fullscreen"),e.setAttribute("type","button"),e.innerHTML=si,e},Po=(e,t)=>{e&&(e.innerHTML=t?Io:si,e.setAttribute("aria-label",t?"Exit fullscreen":"View fullscreen"))},Ye=e=>{const t=document.createElement("div");return t.className="cloudimage-360-icons-container",e.appendChild(t),t},Eo=e=>{const t=document.createElement("div");return t.className="cloudimage-360-inner-box",t.setAttribute("role","img"),t.setAttribute("aria-label","360 degree product view. Use mouse drag or arrow keys to rotate."),e.appendChild(t),t},To=e=>{const t=document.createElement("div");t.className="cloudimage-360-loader";const i=document.createElement("span");return i.className="percentage",i.innerText="0%",t.appendChild(i),e.appendChild(t),t},ue=(e,t)=>{const i=e.querySelector(t);i&&i.parentNode.removeChild(i)},Ao=()=>{const e=document.createElement("div");return e.className="cloudimage-loading-spinner",e},ko=e=>{const t=document.createElement("div");return t.className="cloudimage-360-hotspot-container",e.appendChild(t),t},So=e=>{const t=document.createElement("div");return t.className="cloudimage-360-sr-only",t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),e.appendChild(t),t},Xo=(e,t)=>{e&&(e.textContent="",setTimeout(()=>{e.textContent=t},50))},ni={drag:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2"/><path d="M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2"/><path d="M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8"/><path d="M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"/></svg>',swipe:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m18 16 4-4-4-4"/><path d="m6 8-4 4 4 4"/><path d="M8 12h8"/></svg>',click:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 9 5 12 1.8-5.2L21 14Z"/><path d="M7.2 2.2 8 5.1"/><path d="m5.1 8-2.9-.8"/><path d="M14 4.1 12 6"/><path d="m6 12-1.9 2"/></svg>',dblclick:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 9 5 12 1.8-5.2L21 14Z"/><path d="M7.2 2.2 8 5.1"/><path d="m5.1 8-2.9-.8"/><path d="M14 4.1 12 6"/><path d="m6 12-1.9 2"/><text x="1" y="22" font-size="8" font-weight="bold" fill="currentColor" stroke="none" font-family="sans-serif">2×</text></svg>',pinch:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 6l4 4"/><path d="M18 6l-4 4"/><path d="M6 18l4-4"/><path d="M18 18l-4-4"/><circle cx="12" cy="12" r="2"/></svg>',keys:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="20" height="16" x="2" y="4" rx="2"/><path d="m9 10 3 3 3-3"/></svg>',fullscreen:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/><line x1="21" x2="14" y1="3" y2="10"/><line x1="3" x2="10" y1="21" y2="14"/></svg>'},Yo={drag:"Drag to rotate",swipe:"Swipe to rotate",click:"Click to zoom",dblclick:"Double-click to zoom",pinch:"Pinch to zoom",keys:"Use arrow keys",fullscreen:"Click for fullscreen"},Lo=e=>{const t=document.createElement("div");t.className="cloudimage-360-hint-item";const i=Yo[e];return t.innerHTML=`
54
54
  ${ni[e]}
55
55
  <span>${i}</span>
56
56
  `,t},Le=(e,t=[])=>{if(!t||t.length===0)return null;const i=document.createElement("div");i.className="cloudimage-360-hints-overlay",i.setAttribute("role","tooltip"),i.setAttribute("aria-label","Interaction hints");const o=document.createElement("div");return o.className="cloudimage-360-hints-container",t.forEach(s=>{ni[s]&&o.appendChild(Lo(s))}),i.appendChild(o),e.appendChild(i),i},Me=(e,t)=>t?["swipe","pinch"]:["drag","dblclick"],Oe=e=>{e&&e.classList.add("visible")},Mo=e=>{e&&(e.classList.remove("visible"),e.classList.add("hiding"),setTimeout(()=>{e.classList.remove("hiding")},300))},Oo=e=>{if(!e||typeof e!="object")return null;const t=Object.keys(e).map(o=>parseInt(o,10)).filter(o=>!isNaN(o)).sort((o,s)=>o-s);if(t.length===0)return null;const i=Math.floor(t.length/2);return t[i]},Ho=e=>{const t=[];return!e||!Array.isArray(e)||e.forEach((i,o)=>{const s=Oo(i.positions);s!==null&&t.push({id:i.id||`hotspot-${o}`,frame:s,label:i.label||null})}),t},Ro=400,zo=(e,t,i,o)=>{const s=document.createElement("button");s.className="cloudimage-360-hotspot-timeline-dot",s.setAttribute("type","button"),s.setAttribute("aria-label",o||`Go to hotspot at frame ${t+1}`),s.setAttribute("data-frame",t.toString()),s.setAttribute("data-hotspot-id",e);const n=i>1?t/(i-1)*100:0;if(s.style.left=`${n}%`,o){const r=document.createElement("span");r.className="cloudimage-360-hotspot-timeline-tooltip",r.textContent=o,s.appendChild(r);let a=null;s.addEventListener("mouseenter",()=>{a=setTimeout(()=>{r.classList.add("visible")},Ro)}),s.addEventListener("mouseleave",()=>{a&&(clearTimeout(a),a=null),r.classList.remove("visible")}),s.addEventListener("click",()=>{a&&(clearTimeout(a),a=null),r.classList.remove("visible")})}return s},Zo=(e,t,i)=>{const o=Ho(i);if(o.length===0)return null;const s=document.createElement("div");s.className="cloudimage-360-hotspot-timeline",s.setAttribute("role","navigation"),s.setAttribute("aria-label","Hotspot timeline navigation");const n=document.createElement("div");n.className="cloudimage-360-hotspot-timeline-track";const r=document.createElement("div");return r.className="cloudimage-360-hotspot-timeline-indicator",o.forEach(({id:a,frame:l,label:c})=>{const h=zo(a,l,t,c);n.appendChild(h)}),n.appendChild(r),s.appendChild(n),e.appendChild(s),{element:s,indicator:r,hotspotFrames:o}},He=(e,t,i)=>{if(!e)return;const o=i>1?t/(i-1)*100:0;e.style.left=`${o}%`},Do=e=>{e&&e.classList.add("visible")},Bo=e=>{e&&e.classList.remove("visible")},Ut=(e,t=[])=>{if(!e)return t;if(Array.isArray(e))return e;try{return JSON.parse(e)}catch(i){return console.warn("CloudImage 360: Failed to parse JSON:",i.message),t}},Go=(e,t)=>{const[i,o]=e.split("?");if(!o)return e;const s=new RegExp(`^${t}=|&${t}=`),n=o.split("&").filter(r=>!s.test(r)).join("&");return n?`${i}?${n}`:i},_o=e=>{const t=Go(e,"width"),i=t.includes("?")?"&":"?";return`${t}${i}width=${150*devicePixelRatio}`},Fo=e=>{const t={root:null,rootMargin:"0px",threshold:.1},i=s=>{const n=s.getAttribute("data-src");n&&(s.src=n)};new IntersectionObserver((s,n)=>{s.forEach(r=>{r.isIntersecting&&(i(r.target),n.unobserve(r.target))})},t).observe(e)},No=(e,t)=>{const i=qt(1,t);return e.replace("{index}",i).replace("{indexX}",i).replace("{indexY}",i)},Wo=(e,t)=>{const[i]=e,o=/(https?):\/\//i.test(i);return at({...t,folder:o?"":t.folder,filename:i})},Vo=(e,t)=>{const{imageList:i,indexZeroBase:o}=t;if(i.length){const s=Ut(i,null);if(s)return Wo(s,t)}return No(e,o)},Re=(e,t,i)=>{const o=new Image;return o.setAttribute(t?"data-src":"src",e),o.className=i,o.style.cssText=`
@@ -61,5 +61,5 @@
61
61
  object-fit: contain;
62
62
  object-position: center;
63
63
  filter: blur(10px);
64
- `,o},he=(e,t,i)=>{const{innerBox:o,imageList:s,lazyload:n}=t||{},[r]=s,a=r||Vo(e,t),l=_o(a),c=Re(l,n,"cloudimage-lazy"),h=Re(l,!1,"cloudimage-360-placeholder"),u=m=>{ue(o,".cloudimage-lazy"),i&&i({event:m,width:c.width,height:c.height,naturalWidth:c.naturalWidth,naturalHeight:c.naturalHeight,src:l})};c.onload=u,o.appendChild(c),o.appendChild(h),Fo(c)},jo=(e,t,i)=>{const o=e/i,s=t/i;return{zoomedWidth:o,zoomedHeight:s}},Uo=({pointerX:e,pointerY:t,imageData:i,zoomedWidth:o,zoomedHeight:s,drawWidth:n,drawHeight:r})=>{const{naturalWidth:a,naturalHeight:l}=i;let c=e/n*a-o/2,h=t/r*l-s/2;const u=Math.max(0,a-o),m=Math.max(0,l-s);return c=Math.max(0,Math.min(c,u)),h=Math.max(0,Math.min(h,m)),{zoomOffsetX:c,zoomOffsetY:h}},ze=(e,{bottom:t,top:i})=>{e?t():i()},Ze=(e,{left:t,right:i})=>{e?t():i()},$o=({autoplayBehavior:e,spinY:t,reversed:i,loopTriggers:o})=>{switch(e){case S.SPIN_XY:case S.SPIN_YX:t?ze(i,o):Ze(i,o);break;case S.SPIN_Y:ze(i,o);break;case S.SPIN_X:default:Ze(i,o)}},Ko=({autoplayBehavior:e,activeImageX:t,activeImageY:i,amountX:o,amountY:s,autoplayReverse:n,isGridMode:r=!1})=>{const a=(l,c)=>{const h=c-1;return n?l===0:l===h};if(r)switch(e){case S.SPIN_X:return a(t,o);case S.SPIN_Y:return a(i,s);case S.SPIN_XY:case S.SPIN_YX:default:return a(t,o)&&a(i,s)}switch(e){case S.SPIN_XY:case S.SPIN_Y:return a(i,s);case S.SPIN_X:case S.SPIN_YX:default:return a(t,o)}},qo=({autoplayBehavior:e,activeImageX:t,activeImageY:i,amountX:o,amountY:s,autoplayReverse:n,spinDirection:r,isGridMode:a=!1})=>{if(a)return!1;const l=t===(n?0:o-1),c=i===(n?0:s-1);return e===S.SPIN_XY||e===S.SPIN_YX?r==="x"&&l||r==="y"&&c:!1},Jo=(e,t,i)=>{if(!i)return"x";if(!t)return"y";switch(e){case S.SPIN_XY:return"x";case S.SPIN_YX:return"y";case S.SPIN_Y:return"y";case S.SPIN_X:default:return"x"}},Qo=e=>e==="x"?"y":"x",De=(e,t)=>{const i=[...Ji];return t?[...i,...Qi].includes(e):i.includes(e)},Be=({deltaX:e,deltaY:t,reversed:i,allowSpinX:o,allowSpinY:s,threshold:n=0})=>{const r=o&&!s||s&&!o?0:n,a=Math.abs(e),l=Math.abs(t);return o&&a-r>l?i?e>0?"left":"right":e>0?"right":"left":s&&l-r>a?i?t>0?"up":"down":t>0?"down":"up":null},ts=()=>"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0,es=(e,t=150)=>{let i;return function(...o){clearTimeout(i),i=setTimeout(()=>{e.apply(this,o)},t)}},is=()=>document.fullscreenEnabled||document.webkitFullscreenEnabled,ce=()=>document.fullscreenElement||document.webkitFullscreenElement,os=e=>e.requestFullscreen?e.requestFullscreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():Promise.reject(new Error("Fullscreen API not supported")),Ge=()=>document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():Promise.reject(new Error("Fullscreen API not supported")),N=1;class ss{constructor(t,{zoomMax:i=5,zoomStep:o=.5,onZoomChange:s}={}){this.container=t,this.zoomMax=i,this.zoomStep=o,this.onZoomChange=s,this.zoom=1,this.panX=0,this.panY=0,this.drawWidth=0,this.drawHeight=0,this.isPanning=!1,this.panStartX=0,this.panStartY=0,this._onWheel=this._onWheel.bind(this),this._onDblClick=this._onDblClick.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this._onMouseUp=this._onMouseUp.bind(this),this._onGestureStart=this._onGestureStart.bind(this),this._onGestureChange=this._onGestureChange.bind(this),this._onGestureEnd=this._onGestureEnd.bind(this),this._gestureBaseZoom=1,this._attach()}setDrawSize(t,i,o=!1){const s=this.drawWidth,n=this.drawHeight;this.drawWidth=t,this.drawHeight=i,o&&s&&n?(this.panX=this.panX/s*t,this.panY=this.panY/n*i,this._clampPan()):(this.panX=t/2,this.panY=i/2)}_attach(){this.container.addEventListener("wheel",this._onWheel,{passive:!1}),this.container.addEventListener("dblclick",this._onDblClick),typeof GestureEvent<"u"&&(this.container.addEventListener("gesturestart",this._onGestureStart),this.container.addEventListener("gesturechange",this._onGestureChange),this.container.addEventListener("gestureend",this._onGestureEnd))}destroy(){this.container.removeEventListener("wheel",this._onWheel),this.container.removeEventListener("dblclick",this._onDblClick),this._stopPanListeners(),typeof GestureEvent<"u"&&(this.container.removeEventListener("gesturestart",this._onGestureStart),this.container.removeEventListener("gesturechange",this._onGestureChange),this.container.removeEventListener("gestureend",this._onGestureEnd))}zoomIn(){this._applyZoom(this.zoom+this.zoomStep)}zoomOut(){this._applyZoom(this.zoom-this.zoomStep)}resetZoom(){this._applyZoom(N)}setZoom(t){this._applyZoom(t)}zoomTowardPoint(t,i,o){this._zoomTowardPoint(t,i,o)}getZoom(){return this.zoom}isZoomed(){return this.zoom>N}startPan(t,i){return this.zoom<=N?!1:(this.isPanning=!0,this.panStartX=t,this.panStartY=i,document.addEventListener("mousemove",this._onMouseMove),document.addEventListener("mouseup",this._onMouseUp),!0)}_stopPanListeners(){document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp)}_onMouseMove(t){if(!this.isPanning)return;const i=t.pageX-this.panStartX,o=t.pageY-this.panStartY;this.panStartX=t.pageX,this.panStartY=t.pageY,this._applyPan(this.panX-i,this.panY-o)}_onMouseUp(){this.isPanning=!1,this._stopPanListeners()}_onWheel(t){if(!t.ctrlKey&&!t.metaKey)return;t.preventDefault();let i=-t.deltaY;t.deltaMode===1&&(i*=40),t.deltaMode===2&&(i*=800);const o=Math.pow(2,i/300),s=this.zoom*o;this._zoomTowardPoint(s,t.clientX,t.clientY)}_onDblClick(t){t.target&&t.target.closest&&(t.target.closest(".cloudimage-360-button")||t.target.closest(".cloudimage-360-hotspot-timeline")||t.target.closest(".cloudimage-360-hotspot")||t.target.closest(".cloudimage-360-zoom-controls"))||(this.zoom>N?this._applyZoom(N):this._zoomTowardPoint(2,t.clientX,t.clientY))}_onGestureStart(t){t.preventDefault(),this._gestureBaseZoom=this.zoom}_onGestureChange(t){t.preventDefault();const i=this._gestureBaseZoom*t.scale;this._zoomTowardPoint(i,t.clientX,t.clientY)}_onGestureEnd(t){t.preventDefault()}handleKeyZoom(t){return t===187||t===107?(this.zoomIn(),!0):t===189||t===109?(this.zoomOut(),!0):t===48||t===96?(this.resetZoom(),!0):!1}handleKeyPan(t,i=50){if(this.zoom<=N)return!1;let o=0,s=0;switch(t){case 37:o=-i;break;case 39:o=i;break;case 38:s=-i;break;case 40:s=i;break;default:return!1}return this._applyPan(this.panX+o,this.panY+s),!0}applyTouchPan(t,i){this.zoom<=N||this._applyPan(this.panX-t,this.panY-i)}applyTouchZoom(t){this._applyZoom(t)}_zoomTowardPoint(t,i,o){var r;const s=Math.max(N,Math.min(t,this.zoomMax));if(s===this.zoom)return;const n=(r=this.container.querySelector("canvas"))==null?void 0:r.getBoundingClientRect();if(n){const a=(i-n.left)/n.width*this.drawWidth,l=(o-n.top)/n.height*this.drawHeight,c=s/this.zoom;this.panX=a+(this.panX-a)*c,this.panY=l+(this.panY-l)*c}this.zoom=s,this._clampPan(),this._emit()}_applyZoom(t){const i=Math.max(N,Math.min(t,this.zoomMax));i!==this.zoom&&(this.zoom=i,this.zoom<=N&&(this.panX=this.drawWidth/2,this.panY=this.drawHeight/2),this._clampPan(),this._emit())}_applyPan(t,i){this.panX=t,this.panY=i,this._clampPan(),this._emit()}_clampPan(){if(this.zoom<=N||!this.drawWidth||!this.drawHeight)return;const t=this.drawWidth/(2*this.zoom),i=this.drawHeight/(2*this.zoom);this.panX=Math.max(t,Math.min(this.panX,this.drawWidth-t)),this.panY=Math.max(i,Math.min(this.panY,this.drawHeight-i))}_emit(){typeof this.onZoomChange=="function"&&this.onZoomChange(this.zoom,this.panX,this.panY)}}class ns{constructor(t,{onPinchZoom:i,onPan:o,onDoubleTap:s,getZoom:n,zoomMax:r=5}={}){this.container=t,this.onPinchZoom=i,this.onPan=o,this.onDoubleTap=s,this.getZoom=n,this.zoomMax=r,this.isPinching=!1,this.initialPinchDistance=0,this.pinchBaseZoom=1,this.lastTouchX=0,this.lastTouchY=0,this.lastTapTime=0,this.lastTapX=0,this.lastTapY=0,this._onTouchStart=this._onTouchStart.bind(this),this._onTouchMove=this._onTouchMove.bind(this),this._onTouchEnd=this._onTouchEnd.bind(this),this._attach()}_attach(){this.container.addEventListener("touchstart",this._onTouchStart,{passive:!1}),this.container.addEventListener("touchmove",this._onTouchMove,{passive:!1}),this.container.addEventListener("touchend",this._onTouchEnd,{passive:!1})}destroy(){this.container.removeEventListener("touchstart",this._onTouchStart),this.container.removeEventListener("touchmove",this._onTouchMove),this.container.removeEventListener("touchend",this._onTouchEnd)}_getPinchDistance(t,i){const o=t.pageX-i.pageX,s=t.pageY-i.pageY;return Math.sqrt(o*o+s*s)}_onTouchStart(t){if(t.touches){if(t.touches.length===2){t.preventDefault(),this.isPinching=!0,this.initialPinchDistance=this._getPinchDistance(t.touches[0],t.touches[1]),this.pinchBaseZoom=typeof this.getZoom=="function"?this.getZoom():1;return}if(t.touches.length===1){const i=t.touches[0];this.lastTouchX=i.pageX,this.lastTouchY=i.pageY;const o=Date.now(),s=o-this.lastTapTime,n=Math.abs(i.pageX-this.lastTapX),r=Math.abs(i.pageY-this.lastTapY);if(s<300&&n<30&&r<30){t.preventDefault(),t.stopPropagation(),this.lastTapTime=0,typeof this.onDoubleTap=="function"&&this.onDoubleTap(i.clientX,i.clientY);return}this.lastTapTime=o,this.lastTapX=i.pageX,this.lastTapY=i.pageY}}}_onTouchMove(t){if(t.touches){if(this.isPinching&&t.touches.length===2){t.preventDefault();const i=this._getPinchDistance(t.touches[0],t.touches[1]);if(this.initialPinchDistance===0){this.initialPinchDistance=i;return}const o=i/this.initialPinchDistance,s=Math.max(1,Math.min(this.pinchBaseZoom*o,this.zoomMax)),n=(t.touches[0].clientX+t.touches[1].clientX)/2,r=(t.touches[0].clientY+t.touches[1].clientY)/2;typeof this.onPinchZoom=="function"&&this.onPinchZoom(s,n,r);return}if(t.touches.length===1){if((typeof this.getZoom=="function"?this.getZoom():1)<=1)return;t.preventDefault();const o=t.touches[0],s=o.pageX-this.lastTouchX,n=o.pageY-this.lastTouchY;this.lastTouchX=o.pageX,this.lastTouchY=o.pageY,typeof this.onPan=="function"&&this.onPan(s,n)}}}_onTouchEnd(t){this.isPinching&&(!t.touches||t.touches.length<2)&&(this.isPinching=!1,this.initialPinchDistance=0,t.touches&&t.touches.length===1&&(this.lastTouchX=t.touches[0].pageX,this.lastTouchY=t.touches[0].pageY))}}const rs='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="11" x2="11" y1="8" y2="14"/><line x1="8" x2="14" y1="11" y2="11"/></svg>',as='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="8" x2="14" y1="11" y2="11"/></svg>',ls='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/></svg>',hs=(e,{position:t="bottom-right",onZoomIn:i,onZoomOut:o,onReset:s,zoomMax:n=5}={})=>{const r=document.createElement("div");r.className="cloudimage-360-zoom-controls",r.setAttribute("data-position",t),r.setAttribute("role","toolbar"),r.setAttribute("aria-label","Zoom controls");const a=document.createElement("button");a.className="cloudimage-360-zoom-btn cloudimage-360-zoom-btn-in",a.setAttribute("aria-label","Zoom in"),a.innerHTML=rs,a.addEventListener("click",u=>{u.stopPropagation(),typeof i=="function"&&i()});const l=document.createElement("button");l.className="cloudimage-360-zoom-btn cloudimage-360-zoom-btn-out",l.setAttribute("aria-label","Zoom out"),l.innerHTML=as,l.disabled=!0,l.addEventListener("click",u=>{u.stopPropagation(),typeof o=="function"&&o()});const c=document.createElement("button");c.className="cloudimage-360-zoom-btn cloudimage-360-zoom-btn-reset",c.setAttribute("aria-label","Reset zoom"),c.innerHTML=ls,c.disabled=!0,c.addEventListener("click",u=>{u.stopPropagation(),typeof s=="function"&&s()});const h=document.createElement("span");return h.className="cloudimage-360-zoom-separator",r.appendChild(a),r.appendChild(l),r.appendChild(h),r.appendChild(c),e.appendChild(r),{element:r,updateState(u){a.disabled=u>=n,l.disabled=u<=1,c.disabled=u<=1},show(){r.classList.add("visible")},hide(){r.classList.remove("visible")},destroy(){r.parentNode&&r.parentNode.removeChild(r)}}},ri="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IHY9KHQsYSxlKT0+e2NvbnN0IHM9dC9lLG49YS9lO3JldHVybnt6b29tZWRXaWR0aDpzLHpvb21lZEhlaWdodDpufX0sej0oe3BvaW50ZXJYOnQscG9pbnRlclk6YSxpbWFnZURhdGE6ZSx6b29tZWRXaWR0aDpzLHpvb21lZEhlaWdodDpuLGRyYXdXaWR0aDppLGRyYXdIZWlnaHQ6Y30pPT57Y29uc3R7bmF0dXJhbFdpZHRoOmcsbmF0dXJhbEhlaWdodDp1fT1lO2xldCBmPXQvaSpnLXMvMixtPWEvYyp1LW4vMjtjb25zdCB4PU1hdGgubWF4KDAsZy1zKSxPPU1hdGgubWF4KDAsdS1uKTtyZXR1cm4gZj1NYXRoLm1heCgwLE1hdGgubWluKGYseCkpLG09TWF0aC5tYXgoMCxNYXRoLm1pbihtLE8pKSx7em9vbU9mZnNldFg6Zix6b29tT2Zmc2V0WTptfX07bGV0IG8saCxyLGQsbCx3O3NlbGYub25tZXNzYWdlPWFzeW5jIHQ9Pntjb25zdHthY3Rpb246YSxvZmZzY3JlZW46ZSxkZXZpY2VQaXhlbFJhdGlvOnMsaW1hZ2VEYXRhOm4sem9vbVNjYWxlOmkscG9pbnRlclg6Yyxwb2ludGVyWTpnLGltYWdlQXNwZWN0UmF0aW86dSxjb250YWluZXJXaWR0aDpmLGNvbnRhaW5lckhlaWdodDptfT10LmRhdGE7c3dpdGNoKGEpe2Nhc2UiaW5pdENhbnZhcyI6QyhlLHMpO2JyZWFrO2Nhc2UiYWRhcHRDYW52YXNTaXplIjpwKHUsZixtKTticmVhaztjYXNlImRyYXdJbWFnZU9uQ2FudmFzIjpJKG4saSxjLGcpO2JyZWFrfX07Y29uc3QgQz0odCxhKT0+e289dCxoPW8uZ2V0Q29udGV4dCgiMmQiKSxyPWF9LHA9KHQsYSxlKT0+e2NvbnN0IHM9YS9lO3c9dD5zLG8ud2lkdGg9YSpyLG8uaGVpZ2h0PWUqcixoLnNjYWxlKHIsciksdz8oZD1hLGw9YS90KToobD1lLGQ9ZSp0KSxoLmltYWdlU21vb3RoaW5nRW5hYmxlZD0hMCxoLmltYWdlU21vb3RoaW5nUXVhbGl0eT0iaGlnaCJ9LEk9KHQ9e30sYT0xLGU9MCxzPTApPT57Y29uc3R7Yml0bWFwSW1hZ2U6bn09dDtpZighb3x8IW4pcmV0dXJuO2xldCBpLGM7aWYodz8oaT0wLGM9KG8uaGVpZ2h0L3ItbCkvMik6KGk9KG8ud2lkdGgvci1kKS8yLGM9MCksaC5jbGVhclJlY3QoMCwwLG8ud2lkdGgsby5oZWlnaHQpLGEhPT0xKXtjb25zdHtuYXR1cmFsV2lkdGg6ZyxuYXR1cmFsSGVpZ2h0OnV9PXQse3pvb21lZFdpZHRoOmYsem9vbWVkSGVpZ2h0Om19PXYoZyx1LGEpLHt6b29tT2Zmc2V0WDp4LHpvb21PZmZzZXRZOk99PXooe3BvaW50ZXJYOmUscG9pbnRlclk6cyxpbWFnZURhdGE6dCx6b29tZWRXaWR0aDpmLHpvb21lZEhlaWdodDptLGRyYXdXaWR0aDpkLGRyYXdIZWlnaHQ6bH0pO2guZHJhd0ltYWdlKG4seCxPLGYsbSxpLGMsZCxsKX1lbHNlIGguZHJhd0ltYWdlKG4saSxjLGQsbCl9fSkoKTsKLy8jIHNvdXJjZU1hcHBpbmdVUkw9Y2FudmFzLndvcmtlci1DZzBma3BEMS5qcy5tYXAK",cs=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)),_e=typeof self<"u"&&self.Blob&&new Blob([cs(ri)],{type:"text/javascript;charset=utf-8"});function ds(e){let t;try{if(t=_e&&(self.URL||self.webkitURL).createObjectURL(_e),!t)throw"";const i=new Worker(t,{name:e==null?void 0:e.name});return i.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),i}catch{return new Worker("data:text/javascript;base64,"+ri,{name:e==null?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}class us{constructor(){this.canvas=null,this.ctx=null,this.dpr=1,this.drawWidth=0,this.drawHeight=0,this.wideImage=!1}postMessage(t){const{action:i,offscreen:o,devicePixelRatio:s,imageData:n,zoomScale:r,pointerX:a,pointerY:l,imageAspectRatio:c,containerWidth:h,containerHeight:u}=t;switch(i){case"initCanvas":this.initCanvas(o,s);break;case"adaptCanvasSize":this.adaptCanvasSize(c,h,u);break;case"drawImageOnCanvas":this.drawImageOnCanvas(n,r,a,l);break}}terminate(){var t,i;this.ctx&&this.ctx.clearRect(0,0,((t=this.canvas)==null?void 0:t.width)||0,((i=this.canvas)==null?void 0:i.height)||0),this.canvas=null,this.ctx=null}initCanvas(t,i){this.canvas=t,this.ctx=t.getContext("2d"),this.dpr=i}adaptCanvasSize(t,i,o){if(!this.canvas||!this.ctx)return;const s=i/o;this.wideImage=t>s,this.canvas.width=i*this.dpr,this.canvas.height=o*this.dpr,this.ctx.scale(this.dpr,this.dpr),this.wideImage?(this.drawWidth=i,this.drawHeight=i/t):(this.drawHeight=o,this.drawWidth=o*t),this.ctx.imageSmoothingEnabled=!0,this.ctx.imageSmoothingQuality="high"}drawImageOnCanvas(t={},i=1,o=0,s=0){const{bitmapImage:n}=t;if(!this.canvas||!this.ctx||!n)return;let r,a;if(this.wideImage?(r=0,a=(this.canvas.height/this.dpr-this.drawHeight)/2):(r=(this.canvas.width/this.dpr-this.drawWidth)/2,a=0),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),i!==1){const{naturalWidth:l,naturalHeight:c}=t,{zoomedWidth:h,zoomedHeight:u}=jo(l,c,i),{zoomOffsetX:m,zoomOffsetY:p}=Uo({pointerX:o,pointerY:s,imageData:t,zoomedWidth:h,zoomedHeight:u,drawWidth:this.drawWidth,drawHeight:this.drawHeight});this.ctx.drawImage(n,m,p,h,u,r,a,this.drawWidth,this.drawHeight)}else this.ctx.drawImage(n,r,a,this.drawWidth,this.drawHeight)}}const ps=new Set(["p","span","div","br","hr","strong","em","b","i","u","s","h1","h2","h3","h4","h5","h6","ul","ol","li","a","img","button","table","thead","tbody","tr","th","td","blockquote","pre","code","label","input","select","option","textarea","svg","path","circle","rect","line","polyline","polygon","ellipse","g","text","tspan","defs","use","symbol","clippath","mask","lineargradient","radialgradient","stop"]),Fe={a:["href","title","target","rel"],img:["src","alt","title","width","height"],button:["type","disabled","name","value"],input:["type","name","value","placeholder","disabled","readonly","checked","min","max","step"],select:["name","disabled","multiple"],option:["value","disabled","selected"],textarea:["name","placeholder","disabled","readonly","rows","cols"],label:["for"],svg:["viewbox","width","height","fill","stroke","xmlns","preserveaspectratio"],path:["d","fill","stroke","stroke-width","stroke-linecap","stroke-linejoin","transform"],circle:["cx","cy","r","fill","stroke","stroke-width"],rect:["x","y","width","height","rx","ry","fill","stroke","stroke-width"],line:["x1","y1","x2","y2","stroke","stroke-width"],polyline:["points","fill","stroke","stroke-width"],polygon:["points","fill","stroke","stroke-width"],ellipse:["cx","cy","rx","ry","fill","stroke","stroke-width"],g:["transform","fill","stroke"],text:["x","y","dx","dy","text-anchor","fill","font-size","font-family","font-weight"],tspan:["x","y","dx","dy"],use:["href","xlink:href","x","y","width","height"],lineargradient:["id","x1","y1","x2","y2","gradientunits"],radialgradient:["id","cx","cy","r","fx","fy","gradientunits"],stop:["offset","stop-color","stop-opacity"],clippath:["id"],mask:["id"],"*":["class","id","style"]},ms=[/javascript:/i,/vbscript:/i,/on\w+\s*=/i],fs=e=>{if(typeof e!="string")return"";const t=document.createElement("template");t.innerHTML=e;const i=o=>{if(Array.from(o.childNodes).forEach(i),o.nodeType===Node.ELEMENT_NODE){const n=o.tagName.toLowerCase();if(!ps.has(n)){if(n==="script"||n==="style"){o.remove();return}const l=document.createTextNode(o.textContent);o.parentNode.replaceChild(l,o);return}const r=[...Fe[n]||[],...Fe["*"]||[]];if(Array.from(o.attributes).forEach(l=>{const c=l.name.toLowerCase();if(c.startsWith("on")){o.removeAttribute(l.name);return}if(!r.includes(c)){o.removeAttribute(l.name);return}let h=l.value;ms.forEach(u=>{u.test(h)&&o.removeAttribute(l.name)})}),n==="a"){const l=o.getAttribute("href");l&&(/^(https?:|mailto:|tel:|#|\/)/i.test(l.trim())||o.removeAttribute("href")),o.getAttribute("target")==="_blank"&&o.setAttribute("rel","noopener noreferrer")}if(n==="img"){const l=o.getAttribute("src");l&&(/^(https?:|\/|data:image\/)/i.test(l.trim())||o.removeAttribute("src"))}}};return i(t.content),t.innerHTML},gs=e=>e==="y"?L.Y:L.X,vs=(e,t,i)=>e.filter(o=>t in o.positions?i==="grid"?!0:gs(o.orientation)===i:!1),ys=(e,t,i)=>{const o=document.createElement("button");if(o.id=e,o.className="cloudimage-360-hotspot cloudimage-360-hotspot--pulse",o.dataset.hotspotId=e,o.setAttribute("type","button"),o.setAttribute("aria-label",t||`Hotspot ${e}`),o.setAttribute("aria-haspopup","true"),o.setAttribute("aria-expanded","false"),i==="dot-label"&&t){o.classList.add("cloudimage-360-hotspot--dot-label");const s=document.createElement("span");s.className="cloudimage-360-hotspot-label",s.textContent=t,o.appendChild(s)}return o},bs=e=>{const t=Object.entries(e).sort(([n],[r])=>Number(n)-Number(r));let i=null,o=null;const s={};for(const[n,r]of t)if(!r)s[n]={x:i,y:o};else{const{x:a,y:l}=r;a!=null&&(i=a),l!=null&&(o=l),s[n]={x:a??i,y:l??o}}return s},ws=e=>({placement:"top",modifiers:[{name:"offset",options:{offset:[0,10]}},{name:"preventOverflow",options:{boundary:e}},{name:"flip",options:{boundary:e,fallbackPlacements:["bottom","right","left"]}}]}),Cs=(e,t,i)=>{const o=document.createElement("div");return o.className="cloudimage-360-popper",o.id=`cloudimage-360-popper-${t}`,o.dataset.popperId=t,o.setAttribute("role","tooltip"),o.setAttribute("aria-hidden","false"),typeof e=="string"&&/<\/?[a-z][\s\S]*>/i.test(e)?o.innerHTML=fs(e):o.textContent=e,(i||document.body).appendChild(o),o},Is=e=>e.map(t=>{const i={...bs(t.positions)};return{...t,initialPositions:i,positions:i}}),xs=({newWidth:e,newHeight:t,initialContainerSize:i,imageAspectRatio:o,hotspotsConfig:s})=>{const[n,r]=i;let a=e,l=t,c=0,h=0;const u=e/t;o>u?(l=e/o,h=(t-l)/2):(a=t*o,c=(e-a)/2);const p=a/n,C=l/r;return s.map(v=>{const b={};return Object.entries(v.initialPositions).forEach(([x,P])=>{b[x]={x:P.x*p+c,y:P.y*C+h}}),{...v,positions:b}})};function Ps(e){const t=[];e.image&&t.push(`<div class="ci360-popper-image-wrapper"><img class="ci360-popper-image" src="${Tt(e.image)}" alt="${Tt(e.title||"")}"></div>`);const i=[];if(e.title&&i.push(`<h3 class="ci360-popper-title">${gt(e.title)}</h3>`),e.originalPrice||e.price){let o="";e.originalPrice&&(o+=`<span class="ci360-popper-original-price">${gt(e.originalPrice)}</span>`),e.price&&(o+=`<span class="ci360-popper-price">${gt(e.price)}</span>`),i.push(`<div class="ci360-popper-price-row">${o}</div>`)}if(e.description&&i.push(`<p class="ci360-popper-description">${gt(e.description)}</p>`),e.url&&Es(e.url)){const o=e.ctaText||"View details",s=e.id?` data-product-id="${Tt(e.id)}"`:"";i.push(`<a class="ci360-popper-cta" href="${Tt(e.url)}" target="_top"${s}>${gt(String(o))}</a>`)}else if(e.id){const o=e.ctaText||"View details";i.push(`<button class="ci360-popper-cta" data-product-id="${Tt(e.id)}">${gt(String(o))}</button>`)}return i.length>0&&t.push(`<div class="ci360-popper-body">${i.join("")}</div>`),t.join("")}function de(e){return e.content?e.content:e.data?Ps(e.data):""}function gt(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Tt(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Es(e){const t=e.replace(/[\s\x00-\x1f]/g,"");return/^https?:\/\//i.test(t)||/^\/(?!\/)/.test(t)||/^#/.test(t)}var R="top",_="bottom",F="right",z="left",fe="auto",Lt=[R,_,F,z],vt="start",St="end",Ts="clippingParents",ai="viewport",At="popper",As="reference",Ne=Lt.reduce(function(e,t){return e.concat([t+"-"+vt,t+"-"+St])},[]),li=[].concat(Lt,[fe]).reduce(function(e,t){return e.concat([t,t+"-"+vt,t+"-"+St])},[]),ks="beforeRead",Xs="read",Ss="afterRead",Ys="beforeMain",Ls="main",Ms="afterMain",Os="beforeWrite",Hs="write",Rs="afterWrite",zs=[ks,Xs,Ss,Ys,Ls,Ms,Os,Hs,Rs];function j(e){return e?(e.nodeName||"").toLowerCase():null}function D(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function ht(e){var t=D(e).Element;return e instanceof t||e instanceof Element}function G(e){var t=D(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function ge(e){if(typeof ShadowRoot>"u")return!1;var t=D(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function Zs(e){var t=e.state;Object.keys(t.elements).forEach(function(i){var o=t.styles[i]||{},s=t.attributes[i]||{},n=t.elements[i];!G(n)||!j(n)||(Object.assign(n.style,o),Object.keys(s).forEach(function(r){var a=s[r];a===!1?n.removeAttribute(r):n.setAttribute(r,a===!0?"":a)}))})}function Ds(e){var t=e.state,i={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,i.popper),t.styles=i,t.elements.arrow&&Object.assign(t.elements.arrow.style,i.arrow),function(){Object.keys(t.elements).forEach(function(o){var s=t.elements[o],n=t.attributes[o]||{},r=Object.keys(t.styles.hasOwnProperty(o)?t.styles[o]:i[o]),a=r.reduce(function(l,c){return l[c]="",l},{});!G(s)||!j(s)||(Object.assign(s.style,a),Object.keys(n).forEach(function(l){s.removeAttribute(l)}))})}}const Bs={name:"applyStyles",enabled:!0,phase:"write",fn:Zs,effect:Ds,requires:["computeStyles"]};function V(e){return e.split("-")[0]}var lt=Math.max,Jt=Math.min,yt=Math.round;function pe(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function hi(){return!/^((?!chrome|android).)*safari/i.test(pe())}function bt(e,t,i){t===void 0&&(t=!1),i===void 0&&(i=!1);var o=e.getBoundingClientRect(),s=1,n=1;t&&G(e)&&(s=e.offsetWidth>0&&yt(o.width)/e.offsetWidth||1,n=e.offsetHeight>0&&yt(o.height)/e.offsetHeight||1);var r=ht(e)?D(e):window,a=r.visualViewport,l=!hi()&&i,c=(o.left+(l&&a?a.offsetLeft:0))/s,h=(o.top+(l&&a?a.offsetTop:0))/n,u=o.width/s,m=o.height/n;return{width:u,height:m,top:h,right:c+u,bottom:h+m,left:c,x:c,y:h}}function ve(e){var t=bt(e),i=e.offsetWidth,o=e.offsetHeight;return Math.abs(t.width-i)<=1&&(i=t.width),Math.abs(t.height-o)<=1&&(o=t.height),{x:e.offsetLeft,y:e.offsetTop,width:i,height:o}}function ci(e,t){var i=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(i&&ge(i)){var o=t;do{if(o&&e.isSameNode(o))return!0;o=o.parentNode||o.host}while(o)}return!1}function tt(e){return D(e).getComputedStyle(e)}function Gs(e){return["table","td","th"].indexOf(j(e))>=0}function ot(e){return((ht(e)?e.ownerDocument:e.document)||window.document).documentElement}function Qt(e){return j(e)==="html"?e:e.assignedSlot||e.parentNode||(ge(e)?e.host:null)||ot(e)}function We(e){return!G(e)||tt(e).position==="fixed"?null:e.offsetParent}function _s(e){var t=/firefox/i.test(pe()),i=/Trident/i.test(pe());if(i&&G(e)){var o=tt(e);if(o.position==="fixed")return null}var s=Qt(e);for(ge(s)&&(s=s.host);G(s)&&["html","body"].indexOf(j(s))<0;){var n=tt(s);if(n.transform!=="none"||n.perspective!=="none"||n.contain==="paint"||["transform","perspective"].indexOf(n.willChange)!==-1||t&&n.willChange==="filter"||t&&n.filter&&n.filter!=="none")return s;s=s.parentNode}return null}function Mt(e){for(var t=D(e),i=We(e);i&&Gs(i)&&tt(i).position==="static";)i=We(i);return i&&(j(i)==="html"||j(i)==="body"&&tt(i).position==="static")?t:i||_s(e)||t}function ye(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function kt(e,t,i){return lt(e,Jt(t,i))}function Fs(e,t,i){var o=kt(e,t,i);return o>i?i:o}function di(){return{top:0,right:0,bottom:0,left:0}}function ui(e){return Object.assign({},di(),e)}function pi(e,t){return t.reduce(function(i,o){return i[o]=e,i},{})}var Ns=function(t,i){return t=typeof t=="function"?t(Object.assign({},i.rects,{placement:i.placement})):t,ui(typeof t!="number"?t:pi(t,Lt))};function Ws(e){var t,i=e.state,o=e.name,s=e.options,n=i.elements.arrow,r=i.modifiersData.popperOffsets,a=V(i.placement),l=ye(a),c=[z,F].indexOf(a)>=0,h=c?"height":"width";if(!(!n||!r)){var u=Ns(s.padding,i),m=ve(n),p=l==="y"?R:z,C=l==="y"?_:F,v=i.rects.reference[h]+i.rects.reference[l]-r[l]-i.rects.popper[h],b=r[l]-i.rects.reference[l],x=Mt(n),P=x?l==="y"?x.clientHeight||0:x.clientWidth||0:0,w=v/2-b/2,g=u[p],E=P-m[h]-u[C],f=P/2-m[h]/2+w,y=kt(g,f,E),I=l;i.modifiersData[o]=(t={},t[I]=y,t.centerOffset=y-f,t)}}function Vs(e){var t=e.state,i=e.options,o=i.element,s=o===void 0?"[data-popper-arrow]":o;s!=null&&(typeof s=="string"&&(s=t.elements.popper.querySelector(s),!s)||ci(t.elements.popper,s)&&(t.elements.arrow=s))}const js={name:"arrow",enabled:!0,phase:"main",fn:Ws,effect:Vs,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function wt(e){return e.split("-")[1]}var Us={top:"auto",right:"auto",bottom:"auto",left:"auto"};function $s(e,t){var i=e.x,o=e.y,s=t.devicePixelRatio||1;return{x:yt(i*s)/s||0,y:yt(o*s)/s||0}}function Ve(e){var t,i=e.popper,o=e.popperRect,s=e.placement,n=e.variation,r=e.offsets,a=e.position,l=e.gpuAcceleration,c=e.adaptive,h=e.roundOffsets,u=e.isFixed,m=r.x,p=m===void 0?0:m,C=r.y,v=C===void 0?0:C,b=typeof h=="function"?h({x:p,y:v}):{x:p,y:v};p=b.x,v=b.y;var x=r.hasOwnProperty("x"),P=r.hasOwnProperty("y"),w=z,g=R,E=window;if(c){var f=Mt(i),y="clientHeight",I="clientWidth";if(f===D(i)&&(f=ot(i),tt(f).position!=="static"&&a==="absolute"&&(y="scrollHeight",I="scrollWidth")),f=f,s===R||(s===z||s===F)&&n===St){g=_;var T=u&&f===E&&E.visualViewport?E.visualViewport.height:f[y];v-=T-o.height,v*=l?1:-1}if(s===z||(s===R||s===_)&&n===St){w=F;var k=u&&f===E&&E.visualViewport?E.visualViewport.width:f[I];p-=k-o.width,p*=l?1:-1}}var X=Object.assign({position:a},c&&Us),O=h===!0?$s({x:p,y:v},D(i)):{x:p,y:v};if(p=O.x,v=O.y,l){var M;return Object.assign({},X,(M={},M[g]=P?"0":"",M[w]=x?"0":"",M.transform=(E.devicePixelRatio||1)<=1?"translate("+p+"px, "+v+"px)":"translate3d("+p+"px, "+v+"px, 0)",M))}return Object.assign({},X,(t={},t[g]=P?v+"px":"",t[w]=x?p+"px":"",t.transform="",t))}function Ks(e){var t=e.state,i=e.options,o=i.gpuAcceleration,s=o===void 0?!0:o,n=i.adaptive,r=n===void 0?!0:n,a=i.roundOffsets,l=a===void 0?!0:a,c={placement:V(t.placement),variation:wt(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:s,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,Ve(Object.assign({},c,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:r,roundOffsets:l})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,Ve(Object.assign({},c,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const qs={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Ks,data:{}};var jt={passive:!0};function Js(e){var t=e.state,i=e.instance,o=e.options,s=o.scroll,n=s===void 0?!0:s,r=o.resize,a=r===void 0?!0:r,l=D(t.elements.popper),c=[].concat(t.scrollParents.reference,t.scrollParents.popper);return n&&c.forEach(function(h){h.addEventListener("scroll",i.update,jt)}),a&&l.addEventListener("resize",i.update,jt),function(){n&&c.forEach(function(h){h.removeEventListener("scroll",i.update,jt)}),a&&l.removeEventListener("resize",i.update,jt)}}const Qs={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Js,data:{}};var tn={left:"right",right:"left",bottom:"top",top:"bottom"};function $t(e){return e.replace(/left|right|bottom|top/g,function(t){return tn[t]})}var en={start:"end",end:"start"};function je(e){return e.replace(/start|end/g,function(t){return en[t]})}function be(e){var t=D(e),i=t.pageXOffset,o=t.pageYOffset;return{scrollLeft:i,scrollTop:o}}function we(e){return bt(ot(e)).left+be(e).scrollLeft}function on(e,t){var i=D(e),o=ot(e),s=i.visualViewport,n=o.clientWidth,r=o.clientHeight,a=0,l=0;if(s){n=s.width,r=s.height;var c=hi();(c||!c&&t==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}return{width:n,height:r,x:a+we(e),y:l}}function sn(e){var t,i=ot(e),o=be(e),s=(t=e.ownerDocument)==null?void 0:t.body,n=lt(i.scrollWidth,i.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),r=lt(i.scrollHeight,i.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),a=-o.scrollLeft+we(e),l=-o.scrollTop;return tt(s||i).direction==="rtl"&&(a+=lt(i.clientWidth,s?s.clientWidth:0)-n),{width:n,height:r,x:a,y:l}}function Ce(e){var t=tt(e),i=t.overflow,o=t.overflowX,s=t.overflowY;return/auto|scroll|overlay|hidden/.test(i+s+o)}function mi(e){return["html","body","#document"].indexOf(j(e))>=0?e.ownerDocument.body:G(e)&&Ce(e)?e:mi(Qt(e))}function Xt(e,t){var i;t===void 0&&(t=[]);var o=mi(e),s=o===((i=e.ownerDocument)==null?void 0:i.body),n=D(o),r=s?[n].concat(n.visualViewport||[],Ce(o)?o:[]):o,a=t.concat(r);return s?a:a.concat(Xt(Qt(r)))}function me(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function nn(e,t){var i=bt(e,!1,t==="fixed");return i.top=i.top+e.clientTop,i.left=i.left+e.clientLeft,i.bottom=i.top+e.clientHeight,i.right=i.left+e.clientWidth,i.width=e.clientWidth,i.height=e.clientHeight,i.x=i.left,i.y=i.top,i}function Ue(e,t,i){return t===ai?me(on(e,i)):ht(t)?nn(t,i):me(sn(ot(e)))}function rn(e){var t=Xt(Qt(e)),i=["absolute","fixed"].indexOf(tt(e).position)>=0,o=i&&G(e)?Mt(e):e;return ht(o)?t.filter(function(s){return ht(s)&&ci(s,o)&&j(s)!=="body"}):[]}function an(e,t,i,o){var s=t==="clippingParents"?rn(e):[].concat(t),n=[].concat(s,[i]),r=n[0],a=n.reduce(function(l,c){var h=Ue(e,c,o);return l.top=lt(h.top,l.top),l.right=Jt(h.right,l.right),l.bottom=Jt(h.bottom,l.bottom),l.left=lt(h.left,l.left),l},Ue(e,r,o));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function fi(e){var t=e.reference,i=e.element,o=e.placement,s=o?V(o):null,n=o?wt(o):null,r=t.x+t.width/2-i.width/2,a=t.y+t.height/2-i.height/2,l;switch(s){case R:l={x:r,y:t.y-i.height};break;case _:l={x:r,y:t.y+t.height};break;case F:l={x:t.x+t.width,y:a};break;case z:l={x:t.x-i.width,y:a};break;default:l={x:t.x,y:t.y}}var c=s?ye(s):null;if(c!=null){var h=c==="y"?"height":"width";switch(n){case vt:l[c]=l[c]-(t[h]/2-i[h]/2);break;case St:l[c]=l[c]+(t[h]/2-i[h]/2);break}}return l}function Yt(e,t){t===void 0&&(t={});var i=t,o=i.placement,s=o===void 0?e.placement:o,n=i.strategy,r=n===void 0?e.strategy:n,a=i.boundary,l=a===void 0?Ts:a,c=i.rootBoundary,h=c===void 0?ai:c,u=i.elementContext,m=u===void 0?At:u,p=i.altBoundary,C=p===void 0?!1:p,v=i.padding,b=v===void 0?0:v,x=ui(typeof b!="number"?b:pi(b,Lt)),P=m===At?As:At,w=e.rects.popper,g=e.elements[C?P:m],E=an(ht(g)?g:g.contextElement||ot(e.elements.popper),l,h,r),f=bt(e.elements.reference),y=fi({reference:f,element:w,placement:s}),I=me(Object.assign({},w,y)),T=m===At?I:f,k={top:E.top-T.top+x.top,bottom:T.bottom-E.bottom+x.bottom,left:E.left-T.left+x.left,right:T.right-E.right+x.right},X=e.modifiersData.offset;if(m===At&&X){var O=X[s];Object.keys(k).forEach(function(M){var U=[F,_].indexOf(M)>=0?1:-1,$=[R,_].indexOf(M)>=0?"y":"x";k[M]+=O[$]*U})}return k}function ln(e,t){t===void 0&&(t={});var i=t,o=i.placement,s=i.boundary,n=i.rootBoundary,r=i.padding,a=i.flipVariations,l=i.allowedAutoPlacements,c=l===void 0?li:l,h=wt(o),u=h?a?Ne:Ne.filter(function(C){return wt(C)===h}):Lt,m=u.filter(function(C){return c.indexOf(C)>=0});m.length===0&&(m=u);var p=m.reduce(function(C,v){return C[v]=Yt(e,{placement:v,boundary:s,rootBoundary:n,padding:r})[V(v)],C},{});return Object.keys(p).sort(function(C,v){return p[C]-p[v]})}function hn(e){if(V(e)===fe)return[];var t=$t(e);return[je(e),t,je(t)]}function cn(e){var t=e.state,i=e.options,o=e.name;if(!t.modifiersData[o]._skip){for(var s=i.mainAxis,n=s===void 0?!0:s,r=i.altAxis,a=r===void 0?!0:r,l=i.fallbackPlacements,c=i.padding,h=i.boundary,u=i.rootBoundary,m=i.altBoundary,p=i.flipVariations,C=p===void 0?!0:p,v=i.allowedAutoPlacements,b=t.options.placement,x=V(b),P=x===b,w=l||(P||!C?[$t(b)]:hn(b)),g=[b].concat(w).reduce(function(it,W){return it.concat(V(W)===fe?ln(t,{placement:W,boundary:h,rootBoundary:u,padding:c,flipVariations:C,allowedAutoPlacements:v}):W)},[]),E=t.rects.reference,f=t.rects.popper,y=new Map,I=!0,T=g[0],k=0;k<g.length;k++){var X=g[k],O=V(X),M=wt(X)===vt,U=[R,_].indexOf(O)>=0,$=U?"width":"height",H=Yt(t,{placement:X,boundary:h,rootBoundary:u,altBoundary:m,padding:c}),Z=U?M?F:z:M?_:R;E[$]>f[$]&&(Z=$t(Z));var ct=$t(Z),K=[];if(n&&K.push(H[O]<=0),a&&K.push(H[Z]<=0,H[ct]<=0),K.every(function(it){return it})){T=X,I=!1;break}y.set(X,K)}if(I)for(var dt=C?3:1,ut=function(W){var nt=g.find(function(pt){var q=y.get(pt);if(q)return q.slice(0,W).every(function(Ct){return Ct})});if(nt)return T=nt,"break"},st=dt;st>0;st--){var et=ut(st);if(et==="break")break}t.placement!==T&&(t.modifiersData[o]._skip=!0,t.placement=T,t.reset=!0)}}const dn={name:"flip",enabled:!0,phase:"main",fn:cn,requiresIfExists:["offset"],data:{_skip:!1}};function $e(e,t,i){return i===void 0&&(i={x:0,y:0}),{top:e.top-t.height-i.y,right:e.right-t.width+i.x,bottom:e.bottom-t.height+i.y,left:e.left-t.width-i.x}}function Ke(e){return[R,F,_,z].some(function(t){return e[t]>=0})}function un(e){var t=e.state,i=e.name,o=t.rects.reference,s=t.rects.popper,n=t.modifiersData.preventOverflow,r=Yt(t,{elementContext:"reference"}),a=Yt(t,{altBoundary:!0}),l=$e(r,o),c=$e(a,s,n),h=Ke(l),u=Ke(c);t.modifiersData[i]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:h,hasPopperEscaped:u},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":h,"data-popper-escaped":u})}const pn={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:un};function mn(e,t,i){var o=V(e),s=[z,R].indexOf(o)>=0?-1:1,n=typeof i=="function"?i(Object.assign({},t,{placement:e})):i,r=n[0],a=n[1];return r=r||0,a=(a||0)*s,[z,F].indexOf(o)>=0?{x:a,y:r}:{x:r,y:a}}function fn(e){var t=e.state,i=e.options,o=e.name,s=i.offset,n=s===void 0?[0,0]:s,r=li.reduce(function(h,u){return h[u]=mn(u,t.rects,n),h},{}),a=r[t.placement],l=a.x,c=a.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[o]=r}const gn={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn};function vn(e){var t=e.state,i=e.name;t.modifiersData[i]=fi({reference:t.rects.reference,element:t.rects.popper,placement:t.placement})}const yn={name:"popperOffsets",enabled:!0,phase:"read",fn:vn,data:{}};function bn(e){return e==="x"?"y":"x"}function wn(e){var t=e.state,i=e.options,o=e.name,s=i.mainAxis,n=s===void 0?!0:s,r=i.altAxis,a=r===void 0?!1:r,l=i.boundary,c=i.rootBoundary,h=i.altBoundary,u=i.padding,m=i.tether,p=m===void 0?!0:m,C=i.tetherOffset,v=C===void 0?0:C,b=Yt(t,{boundary:l,rootBoundary:c,padding:u,altBoundary:h}),x=V(t.placement),P=wt(t.placement),w=!P,g=ye(x),E=bn(g),f=t.modifiersData.popperOffsets,y=t.rects.reference,I=t.rects.popper,T=typeof v=="function"?v(Object.assign({},t.rects,{placement:t.placement})):v,k=typeof T=="number"?{mainAxis:T,altAxis:T}:Object.assign({mainAxis:0,altAxis:0},T),X=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,O={x:0,y:0};if(f){if(n){var M,U=g==="y"?R:z,$=g==="y"?_:F,H=g==="y"?"height":"width",Z=f[g],ct=Z+b[U],K=Z-b[$],dt=p?-I[H]/2:0,ut=P===vt?y[H]:I[H],st=P===vt?-I[H]:-y[H],et=t.elements.arrow,it=p&&et?ve(et):{width:0,height:0},W=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:di(),nt=W[U],pt=W[$],q=kt(0,y[H],it[H]),Ct=w?y[H]/2-dt-q-nt-k.mainAxis:ut-q-nt-k.mainAxis,te=w?-y[H]/2+dt+q+pt+k.mainAxis:st+q+pt+k.mainAxis,It=t.elements.arrow&&Mt(t.elements.arrow),ee=It?g==="y"?It.clientTop||0:It.clientLeft||0:0,Ot=(M=X==null?void 0:X[g])!=null?M:0,ie=Z+Ct-Ot-ee,oe=Z+te-Ot,Ht=kt(p?Jt(ct,ie):ct,Z,p?lt(K,oe):K);f[g]=Ht,O[g]=Ht-Z}if(a){var xt,Rt=g==="x"?R:z,zt=g==="x"?_:F,J=f[E],mt=E==="y"?"height":"width",Zt=J+b[Rt],Dt=J-b[zt],Pt=[R,z].indexOf(x)!==-1,Bt=(xt=X==null?void 0:X[E])!=null?xt:0,Gt=Pt?Zt:J-y[mt]-I[mt]-Bt+k.altAxis,_t=Pt?J+y[mt]+I[mt]-Bt-k.altAxis:Dt,Ft=p&&Pt?Fs(Gt,J,_t):kt(p?Gt:Zt,J,p?_t:Dt);f[E]=Ft,O[E]=Ft-J}t.modifiersData[o]=O}}const Cn={name:"preventOverflow",enabled:!0,phase:"main",fn:wn,requiresIfExists:["offset"]};function In(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function xn(e){return e===D(e)||!G(e)?be(e):In(e)}function Pn(e){var t=e.getBoundingClientRect(),i=yt(t.width)/e.offsetWidth||1,o=yt(t.height)/e.offsetHeight||1;return i!==1||o!==1}function En(e,t,i){i===void 0&&(i=!1);var o=G(t),s=G(t)&&Pn(t),n=ot(t),r=bt(e,s,i),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(o||!o&&!i)&&((j(t)!=="body"||Ce(n))&&(a=xn(t)),G(t)?(l=bt(t,!0),l.x+=t.clientLeft,l.y+=t.clientTop):n&&(l.x=we(n))),{x:r.left+a.scrollLeft-l.x,y:r.top+a.scrollTop-l.y,width:r.width,height:r.height}}function Tn(e){var t=new Map,i=new Set,o=[];e.forEach(function(n){t.set(n.name,n)});function s(n){i.add(n.name);var r=[].concat(n.requires||[],n.requiresIfExists||[]);r.forEach(function(a){if(!i.has(a)){var l=t.get(a);l&&s(l)}}),o.push(n)}return e.forEach(function(n){i.has(n.name)||s(n)}),o}function An(e){var t=Tn(e);return zs.reduce(function(i,o){return i.concat(t.filter(function(s){return s.phase===o}))},[])}function kn(e){var t;return function(){return t||(t=new Promise(function(i){Promise.resolve().then(function(){t=void 0,i(e())})})),t}}function Xn(e){var t=e.reduce(function(i,o){var s=i[o.name];return i[o.name]=s?Object.assign({},s,o,{options:Object.assign({},s.options,o.options),data:Object.assign({},s.data,o.data)}):o,i},{});return Object.keys(t).map(function(i){return t[i]})}var qe={placement:"bottom",modifiers:[],strategy:"absolute"};function Je(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return!t.some(function(o){return!(o&&typeof o.getBoundingClientRect=="function")})}function Sn(e){e===void 0&&(e={});var t=e,i=t.defaultModifiers,o=i===void 0?[]:i,s=t.defaultOptions,n=s===void 0?qe:s;return function(a,l,c){c===void 0&&(c=n);var h={placement:"bottom",orderedModifiers:[],options:Object.assign({},qe,n),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},u=[],m=!1,p={state:h,setOptions:function(x){var P=typeof x=="function"?x(h.options):x;v(),h.options=Object.assign({},n,h.options,P),h.scrollParents={reference:ht(a)?Xt(a):a.contextElement?Xt(a.contextElement):[],popper:Xt(l)};var w=An(Xn([].concat(o,h.options.modifiers)));return h.orderedModifiers=w.filter(function(g){return g.enabled}),C(),p.update()},forceUpdate:function(){if(!m){var x=h.elements,P=x.reference,w=x.popper;if(Je(P,w)){h.rects={reference:En(P,Mt(w),h.options.strategy==="fixed"),popper:ve(w)},h.reset=!1,h.placement=h.options.placement,h.orderedModifiers.forEach(function(k){return h.modifiersData[k.name]=Object.assign({},k.data)});for(var g=0;g<h.orderedModifiers.length;g++){if(h.reset===!0){h.reset=!1,g=-1;continue}var E=h.orderedModifiers[g],f=E.fn,y=E.options,I=y===void 0?{}:y,T=E.name;typeof f=="function"&&(h=f({state:h,options:I,name:T,instance:p})||h)}}}},update:kn(function(){return new Promise(function(b){p.forceUpdate(),b(h)})}),destroy:function(){v(),m=!0}};if(!Je(a,l))return p;p.setOptions(c).then(function(b){!m&&c.onFirstUpdate&&c.onFirstUpdate(b)});function C(){h.orderedModifiers.forEach(function(b){var x=b.name,P=b.options,w=P===void 0?{}:P,g=b.effect;if(typeof g=="function"){var E=g({state:h,name:x,instance:p,options:w}),f=function(){};u.push(E||f)}})}function v(){u.forEach(function(b){return b()}),u=[]}return p}}var Yn=[Qs,yn,qs,Bs,gn,dn,Cn,js,pn],Ln=Sn({defaultModifiers:Yn});const Mn='<svg class="ci360-navigate-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6"/></svg>';class On{constructor(t,i,o,s={}){Ie(this,"updateHotspotPosition",(t,i)=>{this.currentActiveIndex=t,this.currentOrientation=i;const o=vs(this.hotspotsConfig,t,i);this.hideHotspots(),o.forEach(s=>this.updateAndShowHotspot(s,t))});this.container=i,this.popper=null,this.popperInstance=null,this.hotspotsContainer=ko(this.container),this.hotspotsConfig=Is(t),this.shouldHidePopper=!0,this.hidePopper=this.hidePopper.bind(this),this.forceHidePopper=this.forceHidePopper.bind(this),this.imageAspectRatio=o,this.popperListeners=[],this.trigger=s.trigger||"hover",this.onOpen=s.onOpen||null,this.onClose=s.onClose||null,this.onProductClick=s.onProductClick||null,this.onNavigate=s.onNavigate||null;const{containerSize:n}=t[0];this.initialContainerSize=n||[i.offsetWidth,i.offsetHeight],this.initHotspots(),this.updateHotspotsForResize(i.offsetWidth,i.offsetHeight),this.observeContainerResize()}observeContainerResize(){this.resizeObserver=new ResizeObserver(()=>{const t=this.container.offsetWidth,i=this.container.offsetHeight;this.updateHotspotsForResize(t,i)}),this.resizeObserver.observe(this.container)}updateHotspotsForResize(t,i){this.hotspotsConfig=xs({newWidth:t,newHeight:i,initialContainerSize:this.initialContainerSize,imageAspectRatio:this.imageAspectRatio,hotspotsConfig:this.hotspotsConfig}),this.updateHotspotPosition(this.currentActiveIndex,this.currentOrientation)}cleanupPopperListeners(){this.popperListeners.forEach(({element:t,event:i,handler:o})=>{t.removeEventListener(i,o)}),this.popperListeners=[]}showPopper({hotspotElement:t,content:i,id:o,keepOpen:s}){var u;this.popperInstance&&this.hidePopper();const n=ws(this.container);this.popper=Cs(i,o,this.container.parentElement),this.currentHotspotElement=t,t.setAttribute("aria-expanded","true"),t.setAttribute("aria-describedby",`cloudimage-360-popper-${o}`);const r=()=>{this.shouldHidePopper=!1},a=()=>{this.shouldHidePopper=!0,this.checkAndHidePopper()},l=()=>{this.shouldHidePopper=!0,this.checkAndHidePopper()},c=()=>{this.shouldHidePopper=!1,this.hidePopperTimeout&&clearTimeout(this.hidePopperTimeout)};if(this.popper.addEventListener("mouseenter",r),this.popper.addEventListener("mouseleave",a),t.addEventListener("mouseleave",l),t.addEventListener("mouseenter",c),this.popperListeners.push({element:this.popper,event:"mouseenter",handler:r},{element:this.popper,event:"mouseleave",handler:a},{element:t,event:"mouseleave",handler:l},{element:t,event:"mouseenter",handler:c}),this.onProductClick){const m=this.onProductClick,p=C=>{const v=C.target.closest(".ci360-popper-cta");v&&m(v.dataset.productId??"",o)};this.popper.addEventListener("click",p),this.popperListeners.push({element:this.popper,event:"click",handler:p})}const h=Ln(t,this.popper,n);h.forceUpdate(),this.popper.setAttribute("data-show",""),this.shouldHidePopper=!1,this.popperInstance={...h,keepOpen:s,instanceId:o};try{(u=this.onOpen)==null||u.call(this,o)}catch(m){console.warn("onHotspotOpen callback error:",m)}}checkAndHidePopper(){var t;this.shouldHidePopper&&!((t=this.popperInstance)!=null&&t.keepOpen)&&(this.hidePopperTimeout&&clearTimeout(this.hidePopperTimeout),this.hidePopperTimeout=setTimeout(()=>{this.shouldHidePopper&&this.hidePopper()},io))}hidePopper(){var o,s;this.hidePopperTimeout&&(clearTimeout(this.hidePopperTimeout),this.hidePopperTimeout=null);const t=(o=this.popperInstance)==null?void 0:o.instanceId;this.cleanupPopperListeners(),this.currentHotspotElement&&(this.currentHotspotElement.setAttribute("aria-expanded","false"),this.currentHotspotElement.removeAttribute("aria-describedby"),this.currentHotspotElement=null);const i=this.popperInstance;if(this.popperInstance=null,t!=null)try{(s=this.onClose)==null||s.call(this,t)}catch(n){console.warn("onHotspotClose callback error:",n)}if(this.popper){this.popper.removeAttribute("data-show"),this.popper.setAttribute("aria-hidden","true");const n=this.popper;this.popper=null,setTimeout(()=>{i==null||i.destroy(),n.remove()},oo)}else i==null||i.destroy();this.shouldHidePopper=!0}forceHidePopper(){this.shouldHidePopper=!0,this.popperInstance&&(this.popperInstance.keepOpen=!1),this.hidePopper()}createHotspot(t){const{id:i,keepOpen:o,onClick:s,label:n,markerStyle:r,navigateTo:a}=t,l=typeof a=="string"?a.trim():void 0,c=de(t),h=ys(i,n,r);if(l){h.classList.add("cloudimage-360-hotspot--navigate"),h.innerHTML=Mn;const u=n||l;h.setAttribute("role","button"),h.setAttribute("aria-label",`Navigate to ${u}`),h.setAttribute("aria-roledescription","navigation hotspot"),h.style.cursor="pointer";const m=c||(n?de({data:{title:n}}):"");m?(h.setAttribute("aria-haspopup","true"),h.addEventListener("mouseenter",()=>this.showPopper({hotspotElement:h,content:m,id:i,keepOpen:!1})),h.addEventListener("mouseleave",()=>{this.shouldHidePopper=!0,this.checkAndHidePopper()}),h.addEventListener("focus",()=>this.showPopper({hotspotElement:h,content:m,id:i,keepOpen:!1})),h.addEventListener("blur",()=>{this.shouldHidePopper=!0,this.checkAndHidePopper()})):(h.removeAttribute("aria-haspopup"),h.removeAttribute("aria-expanded"));const p=()=>{this.hidePopper(),this.onNavigate?this.onNavigate(l):console.warn(`[ci360] navigateTo hotspot "${i}" clicked but no onNavigate callback is configured.`)};h.onclick=C=>{C.stopPropagation(),p()},h.addEventListener("keydown",C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),p())}),this.hotspotsContainer.appendChild(h);return}(s||c&&this.trigger==="click")&&(h.style.cursor="pointer"),h.onclick=u=>{var m;u.stopPropagation(),c&&this.trigger==="click"&&(((m=this.popperInstance)==null?void 0:m.instanceId)===i?this.hidePopper():this.showPopper({hotspotElement:h,content:c,id:i,keepOpen:o})),s==null||s(u,this.popperInstance,i)},c&&this.trigger==="hover"&&(h.addEventListener("mouseenter",()=>this.showPopper({hotspotElement:h,content:c,id:i,keepOpen:o})),h.addEventListener("mouseleave",()=>{this.shouldHidePopper=!0,this.checkAndHidePopper()}),h.addEventListener("focus",()=>this.showPopper({hotspotElement:h,content:c,id:i,keepOpen:o})),h.addEventListener("blur",()=>{this.shouldHidePopper=!0,this.checkAndHidePopper()})),this.hotspotsContainer.appendChild(h)}hideHotspots(){this.hotspotsContainer.querySelectorAll(".cloudimage-360-hotspot").forEach(t=>{t.style.opacity=0,t.style.pointerEvents="none"})}updateAndShowHotspot(t,i){const{positions:o,id:s}=t,{x:n,y:r}=o[i]??{},a=this.hotspotsContainer.querySelector(`[data-hotspot-id="${s}"]`);a&&(a.style.translate=`${n}px ${r}px`,a.style.opacity=1,a.style.pointerEvents="all")}showHotspotById(t){const i=this.hotspotsConfig.find(n=>n.id===t);if(!i||i.navigateTo)return;const o=de(i);if(!o)return;const s=this.hotspotsContainer.querySelector(`[data-hotspot-id="${t}"]`);s&&s.style.opacity==="1"&&this.showPopper({hotspotElement:s,content:o,id:t,keepOpen:i.keepOpen})}createAllHotspots(){this.hotspotsConfig.forEach(t=>this.createHotspot(t))}initHotspots(){this.createAllHotspots()}destroy(){this.hidePopperTimeout&&clearTimeout(this.hidePopperTimeout),this.resizeObserver.disconnect(),this.hidePopper(),this.hotspotsContainer.innerHTML=""}}const Qe=typeof navigator<"u"&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);class ti{constructor(t,i){this.container=t,this.isClicked=!1,this.imagesX=[],this.imagesY=[],this.imagesGrid=[],this.isGridMode=!1;const o=Math.round(window.devicePixelRatio||1);this.devicePixelRatio=Qe?Math.min(o,2):o,this.id=t.id,this.movementStart={x:0,y:0},this.draggingDirection=null,this.isReady=!1,this.velocityX=0,this.velocityY=0,this.lastDragTime=0,this.lastDragX=0,this.lastDragY=0,this.inertiaAnimationId=null,this.hasInteracted=!1,this.touchDevice=ts(),this.dragJustEnded=!1,this.zoomPan=null,this.gestureRecognizer=null,this.zoomControlsUI=null,this.scrollHintUI=null,this.highResLoaded=!1,this.useMainThreadCanvas=Qe,this.canvasWorker=this.useMainThreadCanvas?new us:new ds,this.hotspotTimeline=null,this.hotspotTimelineIndicator=null,this.isAnimatingToFrame=!1,this.onMoveHandler=this.onMoveHandler.bind(this),this.destroy=this.destroy.bind(this),this.init(this.container,i)}closeImageBitmaps(t){!t||!Array.isArray(t)||t.forEach(i=>{var o;(o=i==null?void 0:i.bitmapImage)!=null&&o.close&&i.bitmapImage.close()})}emit(t,i={}){const o=this[t];typeof o=="function"&&o({...i,viewerId:this.id})}announce(t){So(this.ariaLiveRegion,t)}mouseDown(t){if(!this.isReady)return;const i=t.target;if(i&&i.closest&&(i.closest(".cloudimage-360-button")||i.closest(".cloudimage-360-hotspot-timeline")||i.closest(".cloudimage-360-hotspot")||i.closest(".cloudimage-360-zoom-controls")))return;const{pageX:o,pageY:s}=t;if(this.hideHints(),this.hideHotspotPopper(),this.inertiaAnimationId&&(cancelAnimationFrame(this.inertiaAnimationId),this.inertiaAnimationId=null),this.autoplayJustStopped=!1,(this.autoplay||this.loopTimeoutId)&&(this.stopAutoplay(),this.autoplay=!1,this.autoplayJustStopped=!0),this.isZoomed&&this.zoomPan){this.zoomPan.startPan(o,s);return}this.movementStart={x:o,y:s},this.isClicked=!0,this.isDragging=!1,this.inertia&&(this.velocityX=0,this.velocityY=0,this.lastDragTime=performance.now(),this.lastDragX=o,this.lastDragY=s)}mouseUp(){this.isReady&&(!this.isZoomed&&!this.autoplayJustStopped&&this.showAllIcons(),this.inertia&&this.isDragging&&(Math.abs(this.velocityX)>.1||Math.abs(this.velocityY)>.1)&&this.startInertia(),this.isDragging&&(this.emit("onDragEnd"),this.dragJustEnded=!0),this.movementStart={x:0,y:0},this.isClicked=!1,this.isDragging=!1,this.innerBox.style.cursor="grab")}startInertia(){const o=this.dragSpeed/Ae,s=o*(this.amountX/this.container.offsetWidth),n=o*(this.amountY/this.container.offsetHeight),r=()=>{if(this.velocityX*=.95,this.velocityY*=.95,Math.abs(this.velocityX)<.01&&Math.abs(this.velocityY)<.01){this.inertiaAnimationId=null;return}const a=this.velocityX*16,l=this.velocityY*16,c=Be({deltaX:a,deltaY:l,reversed:this.dragReverse,allowSpinX:this.allowSpinX,allowSpinY:this.allowSpinY});if(c){const h=this.allowSpinX?Math.max(1,Math.abs(Math.round(a*s))):0,u=this.allowSpinY?Math.max(1,Math.abs(Math.round(l*n))):0;(h>0||u>0)&&this.onMoveHandler(c,h,u)}this.inertiaAnimationId=requestAnimationFrame(r)};this.inertiaAnimationId=requestAnimationFrame(r)}drag(t,i){if(!this.isReady||!this.isClicked)return;const o=t-this.movementStart.x,s=i-this.movementStart.y;if(this.inertia){const u=performance.now(),m=u-this.lastDragTime;m>0&&m<100&&(this.velocityX=(t-this.lastDragX)/m,this.velocityY=(i-this.lastDragY)/m),this.lastDragTime=u,this.lastDragX=t,this.lastDragY=i}this.draggingDirection=Be({deltaX:o,deltaY:s,reversed:this.dragReverse,allowSpinX:this.allowSpinX,allowSpinY:this.allowSpinY})||this.draggingDirection;const n=this.dragSpeed/Ae,r=n*(this.amountX/this.container.offsetWidth),a=n*(this.amountY/this.container.offsetHeight),l=this.allowSpinX?Math.abs(Math.round(o*r)):0,c=this.allowSpinY?Math.abs(Math.round(s*a)):0;(this.allowSpinX&&l!==0||this.allowSpinY&&c!==0)&&(this.hasInteracted=!0,this.hideHotspotPopper(),this.onMoveHandler(this.draggingDirection,l,c),this.movementStart={x:t,y:i},setTimeout(()=>{this.isDragging||(this.isDragging=!0,this.emit("onDragStart"))},eo))}mouseMove(t){!this.isReady||!this.isClicked||this.isZoomed||(this.hideAllIcons(),this.drag(t.pageX,t.pageY))}mouseClick(){this.dragJustEnded=!1,this.autoplayJustStopped=!1}loadHigherQualityImages(t,i){if(this.isGridMode){const n=at(this.srcGridConfig,t);Se({cdnPath:n,config:this.srcGridConfig,onAllImagesLoad:r=>{this.closeImageBitmaps(this.imagesGrid),this.imagesGrid=r,i()},onError:r=>this.emit("onError",r)});return}const o=at(this.srcXConfig,t),s=this.allowSpinY?at(this.srcYConfig,t):null;Xe({cdnPathX:o,cdnPathY:s,configX:this.srcXConfig,configY:this.srcYConfig,onAllImagesLoad:(n,r)=>{this.closeImageBitmaps(this.imagesX),this.closeImageBitmaps(this.imagesY),this.imagesX=n,this.imagesY=r,i()},onError:n=>this.emit("onError",n)})}hideHotspots(){this.hotspotsInstance&&this.hotspotsInstance.hideHotspots()}hideHotspotPopper(){this.hotspotsInstance&&this.hotspotsInstance.forceHidePopper()}getDrawDimensions(){if(!this.canvas||!this.imageAspectRatio)return null;const t=this.canvas.clientWidth,i=t/this.imageAspectRatio,o=t/i;return this.imageAspectRatio>o?{drawWidth:t,drawHeight:t/this.imageAspectRatio}:{drawWidth:i*this.imageAspectRatio,drawHeight:i}}initZoom(){const t=this.zoomMax||5,i=this.zoomStep||.5;this.zoomPan=new ss(this.innerBox,{zoomMax:t,zoomStep:i,onZoomChange:(s,n,r)=>this.onZoomChange(s,n,r)});const o=this.getDrawDimensions();o&&this.zoomPan.setDrawSize(o.drawWidth,o.drawHeight),this.touchDevice&&this.pinchZoom!==!1&&(this.gestureRecognizer=new ns(this.innerBox,{zoomMax:t,getZoom:()=>this.zoomPan?this.zoomPan.getZoom():1,onPinchZoom:(s,n,r)=>{this.zoomPan&&(n!==void 0?this.zoomPan.zoomTowardPoint(s,n,r):this.zoomPan.applyTouchZoom(s))},onPan:(s,n)=>{this.zoomPan&&this.zoomPan.applyTouchPan(s,n)},onDoubleTap:(s,n)=>{this.zoomPan&&(this.zoomPan.isZoomed()?this.zoomPan.resetZoom():this.zoomPan.zoomTowardPoint(2,s,n))}})),this.zoomControls&&!this.touchDevice&&(this.zoomControlsUI=hs(this.innerBox,{position:this.zoomControlsPosition||"bottom-left",zoomMax:t,onZoomIn:()=>this.zoomPan&&this.zoomPan.zoomIn(),onZoomOut:()=>this.zoomPan&&this.zoomPan.zoomOut(),onReset:()=>this.zoomPan&&this.zoomPan.resetZoom()}))}onZoomChange(t,i,o){this.inertiaAnimationId&&(cancelAnimationFrame(this.inertiaAnimationId),this.inertiaAnimationId=null);const s=this.isZoomed;if(this.isZoomed=t>1,this.isZoomed&&!s){if(this.hideAllIcons(),this.hideHotspots(),this.zoomControlsUI&&this.zoomControlsUI.show(),!this.highResLoaded){this.highResLoaded=!0;const n=document.body.offsetWidth;this.loadHigherQualityImages(n,()=>{this.zoomPan&&this.updateView(this.zoomPan.getZoom(),this.zoomPan.panX,this.zoomPan.panY)})}this.emit("onZoomIn",{zoomLevel:t}),this.announce("Zoomed in. Use mouse drag or arrow keys to pan. Double-click or press 0 to reset.")}!this.isZoomed&&s&&(this.showAllIcons(),this.emit("onZoomOut"),this.announce("Zoomed out")),this.zoomControlsUI&&this.zoomControlsUI.updateState(t),this.updateView(t,i,o)}removeZoom(){this.zoomPan&&this.zoomPan.resetZoom()}toggleZoom(){this.zoomPan&&(this.isZoomed?this.zoomPan.resetZoom():this.zoomPan.setZoom(2))}touchStart(t){if(!this.isReady||!t.touches||!t.touches.length)return;const i=t.target;if(i&&i.closest&&(i.closest(".cloudimage-360-button")||i.closest(".cloudimage-360-hotspot-timeline")||i.closest(".cloudimage-360-hotspot")||i.closest(".cloudimage-360-zoom-controls")))return;if(this.hideHints(),t.touches.length>1){this.isClicked=!1;return}if(this.isZoomed)return;const{pageX:o,pageY:s}=t.touches[0];this.inertiaAnimationId&&(cancelAnimationFrame(this.inertiaAnimationId),this.inertiaAnimationId=null),(this.autoplay||this.loopTimeoutId)&&(this.stopAutoplay(),this.autoplay=!1),this.hideAllIcons(),this.hideHotspotPopper(),this.movementStart={x:o,y:s},this.isClicked=!0,this.isDragging=!1,this.inertia&&(this.velocityX=0,this.velocityY=0,this.lastDragTime=performance.now(),this.lastDragX=o,this.lastDragY=s)}touchEnd(t){this.isReady&&(this.isZoomed||this.showAllIcons(),this.inertia&&this.isDragging&&(Math.abs(this.velocityX)>.1||Math.abs(this.velocityY)>.1)&&this.startInertia(),this.movementStart={x:0,y:0},this.isClicked=!1,this.isDragging=!1)}touchMove(t){if(!this.isReady||this.isZoomed||t.touches&&t.touches.length>1||!this.isClicked||!t.touches||!t.touches[0])return;const{pageX:i,pageY:o}=t.touches[0];t.preventDefault(),this.drag(i,o)}keyDown(t){if(!this.isReady)return;const i=t.target&&t.target.tagName;if(i==="INPUT"||i==="TEXTAREA"||t.target&&t.target.isContentEditable)return;const{keyCode:o}=t,s=this.keysReverse;if(this.autoplay&&this.stopAutoplay(),this.zoomPan&&this.zoomPan.handleKeyZoom(o)){t.preventDefault(),this.hideHints();return}if(this.isZoomed&&this.zoomPan&&this.zoomPan.handleKeyPan(o,no)){t.preventDefault();return}switch(De(o,this.allowSpinY)&&(this.hasInteracted=!0,this.hideAllIcons(),this.hideHints()),o){case 37:s?this.moveLeft():this.moveRight();break;case 39:s?this.moveRight():this.moveLeft();break;case 38:this.allowSpinY&&(t.preventDefault(),s?this.moveTop():this.moveBottom());break;case 40:this.allowSpinY&&(t.preventDefault(),s?this.moveBottom():this.moveTop());break}}keyUp(t){const{keyCode:i}=t;De(i,this.allowSpinY)&&this.showAllIcons()}moveActiveXIndexUp(t){this.isGridMode||(this.orientation=L.X),this.activeImageX=(this.activeImageX+t)%this.amountX}moveActiveXIndexDown(t){this.isGridMode||(this.orientation=L.X),this.activeImageX=(this.activeImageX-t+this.amountX)%this.amountX}moveActiveYIndexUp(t){this.isGridMode||(this.orientation=L.Y),this.activeImageY=(this.activeImageY+t)%this.amountY}moveActiveYIndexDown(t){this.isGridMode||(this.orientation=L.Y),this.activeImageY=(this.activeImageY-t+this.amountY)%this.amountY}moveRight(t,i=1){const o=this.isGridMode?this.amountX-1:this.imagesX.length-1;t&&this.activeImageX>=o||(this.moveActiveXIndexUp(i),this.isZoomed||this.updateView())}moveLeft(t,i=1){t&&this.activeImageX<=0||(this.moveActiveXIndexDown(i),this.isZoomed||this.updateView())}moveTop(t,i=1){const o=this.isGridMode?this.amountY-1:this.imagesY.length-1;t&&this.activeImageY>=o||(this.moveActiveYIndexUp(i),this.isZoomed||this.updateView())}moveBottom(t,i=1){t&&this.activeImageY<=0||(this.moveActiveYIndexDown(i),this.isZoomed||this.updateView())}onMoveHandler(t,i=1,o=1){t==="right"?this.moveRight(this.stopAtEdgesX,i):t==="left"?this.moveLeft(this.stopAtEdgesX,i):t==="up"?this.moveTop(this.stopAtEdgesY,o):t==="down"&&this.moveBottom(this.stopAtEdgesY,o),this.emit("onSpin",{direction:t,activeImageX:this.activeImageX,activeImageY:this.activeImageY,amountX:this.amountX,amountY:this.amountY,isGridMode:this.isGridMode})}updateView(t,i,o){let s;if(this.isGridMode){const r=this.activeImageY*this.amountX+this.activeImageX;s=this.imagesGrid[r]}else s=this.orientation===L.X?this.imagesX[this.activeImageX]:this.imagesY[this.activeImageY];const n=this.isGridMode?this.activeImageY*this.amountX+this.activeImageX:this.orientation===L.X?this.activeImageX:this.activeImageY;this.hotspotsInstance&&!this.isZoomed&&!this.autoplay&&this.hotspotsInstance.updateHotspotPosition(n,this.isGridMode?"grid":this.orientation),this.hotspotTimelineIndicator&&(this.isGridMode||this.orientation===L.X)&&this.updateHotspotTimelinePosition(),this.drawImageOnCanvas(s,t,i,o)}updatePercentageInLoader(t=0){this.loader&&(this.loader.innerText=t+"%")}adaptCanvasSize(t){const{naturalWidth:i,naturalHeight:o}=t;this.imageAspectRatio=i/o;const s=this.canvas.clientWidth,n=s/this.imageAspectRatio;this.canvasWorker.postMessage({action:"adaptCanvasSize",devicePixelRatio:this.devicePixelRatio,imageAspectRatio:this.imageAspectRatio,containerWidth:s,containerHeight:n})}drawImageOnCanvas(t,i=1,o=0,s=0){this.pendingDrawData={imageData:t,zoomScale:i,pointerX:o,pointerY:s},this.drawFrameRequested||(this.drawFrameRequested=!0,requestAnimationFrame(()=>{if(this.drawFrameRequested=!1,this.pendingDrawData){const{imageData:n,zoomScale:r,pointerX:a,pointerY:l}=this.pendingDrawData;this.canvasWorker.postMessage({action:"drawImageOnCanvas",imageData:n,zoomScale:r,pointerX:a,pointerY:l})}}))}pushImageToSet(t,i,o){o==="grid"?this.imagesGrid[i]=t:o===L.X?this.imagesX[i]=t:this.imagesY[i]=t}calculatePercentage(){if(this.isGridMode){const o=this.amountX*this.amountY,s=this.imagesGrid.filter(Boolean).length;return Math.round(s/o*100)}const t=this.amountX+this.amountY,i=this.imagesX.filter(Boolean).length+this.imagesY.filter(Boolean).length;return Math.round(i/t*100)}onImageLoad(t,i,o){this.pushImageToSet(t,i,o),this.updatePercentageInLoader(this.calculatePercentage())}onFirstImageLoaded(t,i){this.createContainers(t),this.adaptCanvasSize(i),this.drawImageOnCanvas(i),this.setupResizeObserver()}setupResizeObserver(){if(this.resizeObserver||!this.container)return;let t=this.container.offsetWidth;this.resizeObserver=new ResizeObserver(i=>{const o=i[0];if(!o)return;const s=Math.round(o.contentRect.width);s===t||s===0||(t=s,requestAnimationFrame(()=>{let n;if(this.isGridMode?n=this.imagesGrid[this.activeImageY*this.amountX+this.activeImageX]:this.orientation===L.Y&&this.imagesY.length>0?n=this.imagesY[this.activeImageY]:n=this.imagesX[this.activeImageX],n){if(this.adaptCanvasSize(n),this.zoomPan){const r=this.getDrawDimensions();r&&this.zoomPan.setDrawSize(r.drawWidth,r.drawHeight,!0)}this.updateView()}}))}),this.resizeObserver.observe(this.container)}onAllImagesLoaded(){if(this.addAllIcons(),this.isReady=!0,this.isGridMode||(this.amountX=this.imagesX.length,this.amountY=this.imagesY.length),this.activeImageX=this.autoplayReverse?this.amountX-1:0,this.activeImageY=this.autoplayReverse?this.amountY-1:0,this.hotspots)if(this.hotspotsInstance=new On(this.hotspots,this.innerBox,this.imageAspectRatio,{trigger:this.hotspotTrigger,onOpen:this.onHotspotOpen,onClose:this.onHotspotClose,onProductClick:this.onProductClick,onNavigate:this.onNavigate}),this.addHotspotTimeline(),this.autoplay)this.hotspotsInstance.hideHotspots(),this.hideHotspotTimeline();else{const t=this.isGridMode?this.activeImageY*this.amountX+this.activeImageX:this.activeImageX,i=this.isGridMode?"grid":this.orientation;this.hotspotsInstance.updateHotspotPosition(t,i),this.showHotspotTimeline()}if(this.emit("onLoad",{imagesX:this.isGridMode?this.amountX:this.imagesX.length,imagesY:this.isGridMode?this.amountY:this.imagesY.length,...this.isGridMode&&{imagesGrid:this.imagesGrid.filter(Boolean).length}}),this.emit("onReady"),this.announce("360 degree view loaded. Use mouse drag or arrow keys to rotate."),this.hints!==!1&&!this.autoplay){const t=this.hints===!0||this.hints===void 0?Me(this.viewerConfig,this.touchDevice):this.hints;t&&t.length>0&&(this.hintsOverlay=Le(this.innerBox,t),Oe(this.hintsOverlay))}this.autoplay&&(this.hideAllIcons(),es(this.play.bind(this))())}toggleFullscreen(t){t.stopPropagation(),this.hideHotspotPopper(),ce()?Ge():os(this.container)}onFullscreenChange(){const t=ce()===this.container,i=this.container.classList.contains("cloudimage-360--fullscreen");t!==i&&(this.container.classList.toggle("cloudimage-360--fullscreen",t),Po(this.fullscreenIcon,t),t?(this.emit("onFullscreenOpen"),this.announce("Opened fullscreen mode. Press Escape to exit.")):(this.emit("onFullscreenClose"),this.announce("Exited fullscreen mode")))}play(){if(this.isClicked)return;this.hide360ViewCircleIcon(),this.emit("onAutoplayStart");let t;if(this.isGridMode){const s=this.autoplayBehavior;s==="spin-x"?t=this.amountX:s==="spin-y"?t=this.amountY:t=Math.max(this.amountX,this.amountY)}else t=this.amountX+this.amountY;const i=this.speed*36/t,o={left:this.moveLeft.bind(this),right:this.moveRight.bind(this),top:this.moveTop.bind(this),bottom:this.moveBottom.bind(this)};this.loopTimeoutId=window.setInterval(()=>{if(this.playOnce&&Ko({autoplayBehavior:this.autoplayBehavior,activeImageX:this.activeImageX,activeImageY:this.activeImageY,amountX:this.amountX,amountY:this.amountY,autoplayReverse:this.autoplayReverse,isGridMode:this.isGridMode})){this.stopAutoplay();return}if(this.isGridMode){this.gridAutoplayTick(o);return}qo({autoplayBehavior:this.autoplayBehavior,activeImageX:this.activeImageX,activeImageY:this.activeImageY,amountX:this.amountX,amountY:this.amountY,autoplayReverse:this.autoplayReverse,spinDirection:this.spinDirection})&&(this.spinDirection=Qo(this.spinDirection));const r=this.spinDirection==="y";$o({autoplayBehavior:this.autoplayBehavior,spinY:r,reversed:this.autoplayReverse,loopTriggers:o})},i)}gridAutoplayTick(t){const i=this.autoplayReverse,o=this.autoplayBehavior;if(o==="spin-x"){i?t.left():t.right();return}if(o==="spin-y"){i?t.bottom():t.top();return}if(o==="spin-xy"){const s=i?0:this.amountX-1,n=this.activeImageX===s;i?this.activeImageX=(this.activeImageX-1+this.amountX)%this.amountX:this.activeImageX=(this.activeImageX+1)%this.amountX,n&&(i?this.activeImageY=(this.activeImageY-1+this.amountY)%this.amountY:this.activeImageY=(this.activeImageY+1)%this.amountY),this.isZoomed||this.updateView(),this.emit("onSpin",{direction:i?"left":"right",activeImageX:this.activeImageX,activeImageY:this.activeImageY,amountX:this.amountX,amountY:this.amountY,isGridMode:!0});return}if(o==="spin-yx"){const s=i?0:this.amountY-1,n=this.activeImageY===s;i?this.activeImageY=(this.activeImageY-1+this.amountY)%this.amountY:this.activeImageY=(this.activeImageY+1)%this.amountY,n&&(i?this.activeImageX=(this.activeImageX-1+this.amountX)%this.amountX:this.activeImageX=(this.activeImageX+1)%this.amountX),this.isZoomed||this.updateView(),this.emit("onSpin",{direction:i?"down":"up",activeImageX:this.activeImageX,activeImageY:this.activeImageY,amountX:this.amountX,amountY:this.amountY,isGridMode:!0})}}stopAutoplay(){if(this.showAllIcons(),this.autoplay=!1,window.clearInterval(this.loopTimeoutId),this.loopTimeoutId=null,this.emit("onAutoplayStop"),this.hotspotsInstance){const t=this.isGridMode?this.activeImageY*this.amountX+this.activeImageX:this.activeImageX,i=this.isGridMode?"grid":this.orientation;this.hotspotsInstance.updateHotspotPosition(t,i),this.showHotspotTimeline()}if(this.hints!==!1&&!this.hintsOverlay&&!this.hintsHidden){const t=this.hints===!0?Me(this.viewerConfig,this.touchDevice):this.hints;t&&t.length>0&&(this.hintsOverlay=Le(this.innerBox,t),Oe(this.hintsOverlay))}}destroy(){this.stopAutoplay(),this.inertiaAnimationId&&(cancelAnimationFrame(this.inertiaAnimationId),this.inertiaAnimationId=null),this.removeEvents(),this.zoomPan&&(this.zoomPan.destroy(),this.zoomPan=null),this.gestureRecognizer&&(this.gestureRecognizer.destroy(),this.gestureRecognizer=null),this.zoomControlsUI&&(this.zoomControlsUI.destroy(),this.zoomControlsUI=null),this.scrollHintUI&&(this.scrollHintUI.destroy(),this.scrollHintUI=null),this.closeImageBitmaps(this.imagesX),this.closeImageBitmaps(this.imagesY),this.closeImageBitmaps(this.imagesGrid),this.imagesX=[],this.imagesY=[],this.imagesGrid=[],this.isGridMode=!1,this.isReady=!1,this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.canvasWorker&&(this.canvasWorker.terminate(),this.canvasWorker=null),this.hotspotsInstance&&this.hotspotsInstance.destroy(),this.hintsOverlay&&this.hintsOverlay.parentNode&&(this.hintsOverlay.parentNode.removeChild(this.hintsOverlay),this.hintsOverlay=null),this.hotspotTimeline&&this.hotspotTimeline.parentNode&&(this.hotspotTimeline.parentNode.removeChild(this.hotspotTimeline),this.hotspotTimeline=null,this.hotspotTimelineIndicator=null),this.innerBox&&this.innerBox.classList.remove("has-hotspot-timeline"),ce()===this.container&&Ge(),this.container&&(this.container.classList.remove("ci360-theme-dark","ci360-hotspot-marker-inverted","ci360-hotspot-marker-brand","cloudimage-360--fullscreen"),this.container.style.removeProperty("--ci360-hotspot-brand-color"),this.container.innerHTML="")}releaseMemory(){this.stopAutoplay(),this.closeImageBitmaps(this.imagesX),this.closeImageBitmaps(this.imagesY),this.closeImageBitmaps(this.imagesGrid),this.imagesX=[],this.imagesY=[],this.imagesGrid=[],this.isMemoryReleased=!0}reloadImages(){if(!this.isMemoryReleased)return;this.isMemoryReleased=!1;const t=this.container.offsetWidth;this.loadHigherQualityImages(t,()=>{this.updateView()})}addInitialIcon(){this.initialIcon||this.hide360Logo||(this.initialIcon=wo(this.logoSrc),this.innerBox.appendChild(this.initialIcon))}showInitialIcon(){!this.initialIcon||this.hasInteracted||(this.initialIcon.style.opacity=1)}hideInitialIcon(){this.initialIcon&&(this.initialIcon.style.opacity=0)}addFullscreenIcon(){!this.fullscreen||!is()||(this.fullscreenIcon=xo(),this.fullscreenIcon.onclick=this.toggleFullscreen.bind(this),this.iconsContainer.appendChild(this.fullscreenIcon))}showFullscreenIcon(){this.fullscreenIcon&&(this.fullscreenIcon.style.opacity=1)}hideFullscreenIcon(){this.fullscreenIcon&&(this.fullscreenIcon.style.opacity=0)}add360ViewCircleIcon(){this.view360CircleIcon||(this.view360CircleIcon=yo(this.bottomCircleOffset),this.innerBox.appendChild(this.view360CircleIcon))}show360ViewCircleIcon(){this.view360CircleIcon&&(this.view360CircleIcon.style.opacity=1)}hide360ViewCircleIcon(){this.view360CircleIcon&&(this.view360CircleIcon.style.opacity=0)}addLoadingSpinner(){this.loadingSpinner=Ao(),this.innerBox.appendChild(this.loadingSpinner)}showLoadingSpinner(){this.loadingSpinner&&(this.hideAllIcons(),this.loadingSpinner.style.opacity=1)}hideLoadingSpinner(){this.loadingSpinner&&(this.loadingSpinner.style.opacity=0)}hideHints(){!this.hintsOverlay||this.hintsHidden||(this.hintsHidden=!0,Mo(this.hintsOverlay))}addHotspotTimeline(){if(!this.hotspots||this.hotspotTimeline)return;const t=this.isGridMode?this.amountX*this.amountY:this.amountX,i=Zo(this.innerBox,t,this.hotspots);if(!i)return;this.hotspotTimeline=i.element,this.hotspotTimelineIndicator=i.indicator,this.innerBox.classList.add("has-hotspot-timeline"),this.hotspotTimeline.querySelectorAll(".cloudimage-360-hotspot-timeline-dot").forEach(s=>{s.addEventListener("click",n=>{n.stopPropagation(),this.hideAllIcons(),this.hideHints();const r=parseInt(s.getAttribute("data-frame"),10),a=s.getAttribute("data-hotspot-id");isNaN(r)||this.animateToFrame(r,a)})}),this.updateHotspotTimelinePosition()}showHotspotTimeline(){Do(this.hotspotTimeline)}hideHotspotTimeline(){Bo(this.hotspotTimeline)}updateHotspotTimelinePosition(){if(this.isGridMode){const t=this.activeImageY*this.amountX+this.activeImageX;He(this.hotspotTimelineIndicator,t,this.amountX*this.amountY)}else He(this.hotspotTimelineIndicator,this.activeImageX,this.amountX)}animateToFrame(t,i){this.hotspotsInstance&&this.hotspotsInstance.hidePopper();const o=this.isGridMode?this.activeImageY*this.amountX+this.activeImageX:this.activeImageX;if(this.isAnimatingToFrame||t===o){t===o&&i&&this.hotspotsInstance&&this.hotspotTimelineOnClick&&this.hotspotsInstance.showHotspotById(i);return}if(this.isAnimatingToFrame=!0,this.hasInteracted=!0,(this.autoplay||this.loopTimeoutId)&&(this.stopAutoplay(),this.autoplay=!1),this.inertiaAnimationId&&(cancelAnimationFrame(this.inertiaAnimationId),this.inertiaAnimationId=null),this.isGridMode){const m=this.amountX*this.amountY,p=Math.max(0,Math.min(t,m-1));this.activeImageY=Math.floor(p/this.amountX),this.activeImageX=p%this.amountX,this.isZoomed||this.updateView(),this.emit("onSpin",{direction:p>o?"right":"left",activeImageX:this.activeImageX,activeImageY:this.activeImageY,amountX:this.amountX,amountY:this.amountY,isGridMode:!0}),this.isAnimatingToFrame=!1,i&&this.hotspotsInstance&&this.hotspotTimelineOnClick&&setTimeout(()=>{this.hotspotsInstance.showHotspotById(i)},50);return}const s=this.activeImageX,n=(t-s+this.amountX)%this.amountX,r=(s-t+this.amountX)%this.amountX,a=n<=r,l=a?n:r;if(l===0){this.isAnimatingToFrame=!1;return}const c=30;let h=l;const u=()=>{if(h<=0){this.isAnimatingToFrame=!1,i&&this.hotspotsInstance&&this.hotspotTimelineOnClick&&setTimeout(()=>{this.hotspotsInstance.showHotspotById(i)},50);return}a?this.moveRight():this.moveLeft(),h--,h>0?setTimeout(u,c):(this.isAnimatingToFrame=!1,i&&this.hotspotsInstance&&this.hotspotTimelineOnClick&&setTimeout(()=>{this.hotspotsInstance.showHotspotById(i)},50))};u()}remove360ViewCircleIcon(){this.view360CircleIcon&&(this.innerBox.removeChild(this.view360CircleIcon),this.view360CircleIcon=null)}addAllIcons(){this.removeLoader(),this.iconsContainer&&(this.innerBox.style.cursor="grab",this.addLoadingSpinner(),this.addFullscreenIcon(),this.initialIconShown&&this.addInitialIcon(),this.bottomCircle&&this.add360ViewCircleIcon(),this.initZoom())}showAllIcons(){this.showInitialIcon(),this.show360ViewCircleIcon(),this.showFullscreenIcon(),this.showHotspotTimeline(),this.zoomControlsUI&&this.zoomControlsUI.show()}hideAllIcons(){this.hideInitialIcon(),this.hide360ViewCircleIcon(),this.hideFullscreenIcon(),this.zoomControlsUI&&this.zoomControlsUI.hide()}removeLoader(){this.loader&&(this.innerBox.removeChild(this.loader),this.loader=null)}attachEvents(t,i,o){t&&this.addMouseEvents(),i&&this.addTouchEvents(),o&&this.addKeyboardEvents(),this.addEscKeyHandler(),this.addFullscreenChangeHandler()}removeEvents(){this.removeMouseEvents(),this.removeTouchEvents(),this.removeKeyboardEvents(),this.removeEscKeyHandler(),this.removeFullscreenChangeHandler()}addMouseEvents(){this.boundMouseClick=this.mouseClick.bind(this),this.boundMouseDown=this.mouseDown.bind(this),this.boundMouseMove=Ee(this.mouseMove.bind(this),Te),this.boundMouseUp=this.mouseUp.bind(this),this.innerBox.addEventListener("click",this.boundMouseClick),this.innerBox.addEventListener("mousedown",this.boundMouseDown),document.addEventListener("mousemove",this.boundMouseMove),document.addEventListener("mouseup",this.boundMouseUp)}addTouchEvents(){this.boundTouchStart=this.touchStart.bind(this),this.boundTouchEnd=this.touchEnd.bind(this),this.boundTouchMove=Ee(this.touchMove.bind(this),Te),this.container.addEventListener("touchstart",this.boundTouchStart,{passive:!1}),this.container.addEventListener("touchend",this.boundTouchEnd),this.container.addEventListener("touchmove",this.boundTouchMove,{passive:!1})}addKeyboardEvents(){this.boundKeyDown=this.keyDown.bind(this),this.boundKeyUp=this.keyUp.bind(this),document.addEventListener("keydown",this.boundKeyDown),document.addEventListener("keyup",this.boundKeyUp)}addEscKeyHandler(){this.boundEscHandler=t=>{t.keyCode===27&&this.isZoomed&&this.removeZoom()},document.addEventListener("keydown",this.boundEscHandler)}removeEscKeyHandler(){document.removeEventListener("keydown",this.boundEscHandler)}addFullscreenChangeHandler(){this.boundFullscreenChange=this.onFullscreenChange.bind(this),document.addEventListener("fullscreenchange",this.boundFullscreenChange),document.addEventListener("webkitfullscreenchange",this.boundFullscreenChange)}removeFullscreenChangeHandler(){document.removeEventListener("fullscreenchange",this.boundFullscreenChange),document.removeEventListener("webkitfullscreenchange",this.boundFullscreenChange)}removeMouseEvents(){this.innerBox.removeEventListener("click",this.boundMouseClick),this.innerBox.removeEventListener("mousedown",this.boundMouseDown),document.removeEventListener("mousemove",this.boundMouseMove),document.removeEventListener("mouseup",this.boundMouseUp)}removeTouchEvents(){this.container.removeEventListener("touchstart",this.boundTouchStart),this.container.removeEventListener("touchend",this.boundTouchEnd),this.container.removeEventListener("touchmove",this.boundTouchMove)}removeKeyboardEvents(){document.removeEventListener("keydown",this.boundKeyDown),document.removeEventListener("keyup",this.boundKeyUp)}createContainers(t){if(this.iconsContainer=Ye(this.innerBox),this.canvas=Co(this.innerBox,t),this.loader=To(this.innerBox),this.ariaLiveRegion=Xo(this.innerBox),this.useMainThreadCanvas)this.canvasWorker.postMessage({action:"initCanvas",offscreen:this.canvas,devicePixelRatio:this.devicePixelRatio});else{const i=this.canvas.transferControlToOffscreen();this.canvasWorker.postMessage({action:"initCanvas",offscreen:i,devicePixelRatio:this.devicePixelRatio},[i])}ue(this.innerBox,".cloudimage-360-placeholder")}update(t){this.isReady&&(this.stopAutoplay(),this.zoomPan&&(this.zoomPan.destroy(),this.zoomPan=null),this.gestureRecognizer&&(this.gestureRecognizer.destroy(),this.gestureRecognizer=null),this.zoomControlsUI&&(this.zoomControlsUI.destroy(),this.zoomControlsUI=null),this.scrollHintUI&&(this.scrollHintUI.destroy(),this.scrollHintUI=null),this.isZoomed=!1,this.highResLoaded=!1,this.hotspotsInstance&&(this.hotspotsInstance.destroy(),this.hotspotsInstance=null),this.hotspotTimeline&&this.hotspotTimeline.parentNode&&(this.hotspotTimeline.parentNode.removeChild(this.hotspotTimeline),this.hotspotTimeline=null,this.hotspotTimelineIndicator=null),this.innerBox&&this.innerBox.classList.remove("has-hotspot-timeline"),this.hintsOverlay&&this.hintsOverlay.parentNode&&(this.hintsOverlay.parentNode.removeChild(this.hintsOverlay),this.hintsOverlay=null),this.hintsHidden=!1,ue(this.innerBox,".cloudimage-360-icons-container"),this.init(this.container,t,!0),this.iconsContainer=Ye(this.innerBox),this.onAllImagesLoaded())}init(t,i,o){const s=i?lo(i):ro(t),{folder:n,apiVersion:r,filenameX:a,filenameY:l,filenameGrid:c,imageListX:h,imageListY:u,imageListGrid:m,indexZeroBase:p,amountX:C,amountY:v,draggable:b=!0,swipeable:x=!0,keys:P,keysReverse:w,bottomCircleOffset:g,autoplay:E,autoplayBehavior:f,playOnce:y,speed:I,autoplayReverse:T,fullscreen:k,magnifier:X,pointerZoom:O,zoomMax:M,zoomStep:U,zoomControls:$,zoomControlsPosition:H,scrollHint:Z,ciToken:ct,ciFilters:K,ciTransformation:dt,lazyload:ut,dragSpeed:st,stopAtEdges:et,stopAtEdgesX:it,stopAtEdgesY:W,imageInfo:nt="black",initialIconShown:pt,bottomCircle:q,hotspots:Ct,hotspotTrigger:te="hover",dragReverse:It,hide360Logo:ee,logoSrc:Ot,inertia:ie,pinchZoom:oe,hints:Ht,theme:xt,markerTheme:Rt,brandColor:zt,hotspotTimelineOnClick:J=!0,aspectRatio:mt,cropAspectRatio:Zt,cropGravity:Dt,onReady:Pt,onLoad:Bt,onSpin:Gt,onAutoplayStart:_t,onAutoplayStop:Ft,onFullscreenOpen:gi,onFullscreenClose:vi,onZoomIn:yi,onZoomOut:bi,onDragStart:wi,onDragEnd:Ci,onHotspotOpen:Ii,onHotspotClose:xi,onProductClick:Pi,onNavigate:Ei,onError:Ti}=s,se={ciToken:ct,ciFilters:K,ciTransformation:dt,cropAspectRatio:Zt,cropGravity:Dt},ne=Ut(h,[]),re=Ut(u,[]);let rt=Ut(m,[]);rt.length&&Array.isArray(rt[0])&&(rt=rt.flat()),this.isGridMode=!!(c||rt.length);const Ai=s.zoomMax===5&&O>1?Math.min(O,5):M||5;if(this.viewerConfig=s,this.amountX=ne.length||C,this.amountY=re.length||v,this.allowSpinX=!!this.amountX,this.allowSpinY=!!this.amountY,this.isGridMode&&(this.allowSpinX=!0,this.allowSpinY=!0),this.orientation=this.allowSpinX?L.X:L.Y,this.activeImageX=T?this.amountX-1:0,this.activeImageY=T?this.amountY-1:0,this.bottomCircleOffset=g,this.autoplay=E,this.autoplayBehavior=f,this.playOnce=y,this.speed=I,this.autoplayReverse=T,this.fullscreen=k,this.zoomMax=Ai,this.zoomStep=U||.5,this.zoomControls=$??!0,this.zoomControlsPosition=H||"bottom-left",this.scrollHint=Z??!0,this.dragSpeed=Math.max(st,so),this.stopAtEdges=et,this.stopAtEdgesX=it??et,this.stopAtEdgesY=W??et,this.ciParams=se,this.apiVersion=r,this.keysReverse=w,this.info=nt,this.keys=P,this.innerBox=this.innerBox??Eo(this.container),this.container.style.aspectRatio=mt||"",this.initialIconShown=pt,this.bottomCircle=q,this.spinDirection=Jo(this.autoplayBehavior,this.allowSpinX,this.allowSpinY),this.dragReverse=It,this.hotspots=Ct,this.hotspotTrigger=te,this.onHotspotOpen=Ii,this.onHotspotClose=xi,this.onProductClick=Pi,this.onNavigate=Ei,this.hide360Logo=ee,this.logoSrc=Ot,this.inertia=ie,this.pinchZoom=oe,this.hints=Ht,this.hotspotTimelineOnClick=J,xt==="dark"?this.container.classList.add("ci360-theme-dark"):xt==="light"&&this.container.classList.remove("ci360-theme-dark"),this.container.classList.remove("ci360-hotspot-marker-inverted","ci360-hotspot-marker-brand"),Rt==="inverted"?this.container.classList.add("ci360-hotspot-marker-inverted"):Rt==="brand"&&(this.container.classList.add("ci360-hotspot-marker-brand"),zt&&this.container.style.setProperty("--ci360-hotspot-brand-color",zt)),this.onReady=Pt,this.onLoad=Bt,this.onSpin=Gt,this.onAutoplayStart=_t,this.onAutoplayStop=Ft,this.onFullscreenOpen=gi,this.onFullscreenClose=vi,this.onZoomIn=yi,this.onZoomOut=bi,this.onDragStart=wi,this.onDragEnd=Ci,this.onError=Ti,this.srcXConfig={folder:n,filename:a,imageList:ne,container:t,innerBox:this.innerBox,apiVersion:r,ciParams:se,lazyload:ut,amount:this.amountX,indexZeroBase:p,autoplayReverse:T,orientation:L.X},this.srcYConfig={...this.srcXConfig,filename:l,imageList:re,orientation:L.Y,amount:this.amountY},this.srcGridConfig={folder:n,filename:c,imageList:rt,container:t,innerBox:this.innerBox,apiVersion:r,ciParams:se,lazyload:ut,amount:this.amountX*this.amountY,amountX:this.amountX,amountY:this.amountY,indexZeroBase:p,autoplayReverse:T},o&&this.removeEvents(),this.attachEvents(b,x,P),o)return;const ae=this.container.offsetWidth;if(this.isGridMode){const Et=rt.length?null:at(this.srcGridConfig,ae),Nt=Wt=>{Se({cdnPath:Et,config:this.srcGridConfig,onImageLoad:(Q,B)=>{this.pushImageToSet(Q,B,"grid"),this.updatePercentageInLoader(this.calculatePercentage())},onFirstImageLoad:Q=>this.onFirstImageLoaded(Wt,Q),onAllImagesLoad:(Q,B)=>{this.imagesGrid=Q,B&&B.errorCount>0&&this.emit("onError",{errorCount:B.errorCount,errors:B.errors,totalImages:this.amountX*this.amountY}),this.onAllImagesLoaded()},onError:Q=>this.emit("onError",Q)})};he(Et,this.srcGridConfig,Nt)}else{const Et=this.allowSpinX&&!ne.length?at(this.srcXConfig,ae):null,Nt=this.allowSpinY&&!re.length?at(this.srcYConfig,ae):null,Wt=Q=>{Xe({cdnPathX:Et,cdnPathY:Nt,configX:this.srcXConfig,configY:this.srcYConfig,onImageLoad:(B,ki,Xi)=>this.onImageLoad(B,ki,Xi),onFirstImageLoad:B=>this.onFirstImageLoaded(Q,B),onAllImagesLoad:this.onAllImagesLoaded.bind(this),onError:B=>this.emit("onError",B)})};this.allowSpinX?he(Et,this.srcXConfig,Wt):this.allowSpinY&&he(Nt,this.srcYConfig,Wt)}}}const ei=typeof navigator<"u"&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);class Hn{constructor(){this.views=new Map,this.initAll=this.initAll.bind(this),this.getViews=this.getViews.bind(this),this.memoryObserver=null,this.memoryManagementAutoEnabled=!1}generateId(){return`ci360-${Math.random().toString(36).slice(2,11)}`}init(t,i){if(!t)return;const o=t.id||this.generateId();t.id||(t.id=o);const s=new ti(t,i);return this.views.set(o,s),ei&&!this.memoryManagementAutoEnabled&&(this.memoryManagementAutoEnabled=!0,setTimeout(()=>this.enableMemoryManagement(),100)),s}initAll(t="cloudimage-360"){[...document.querySelectorAll(`.${t}`)].filter(Boolean).forEach(o=>{const s=o.id||this.generateId();o.id||(o.id=s);const n=new ti(o);this.views.set(s,n)}),ei&&!this.memoryManagementAutoEnabled&&this.views.size>0&&(this.memoryManagementAutoEnabled=!0,setTimeout(()=>this.enableMemoryManagement(),100))}destroy(t){const i=this.getViewById(t);i&&(i.destroy(),this.views.delete(t))}destroyAll(){this.views.forEach(t=>{t.destroy()}),this.views.clear()}getViewById(t){return this.views.get(t)}getViews(){return Array.from(this.views.values())}updateView(t,i){const o=this.getViewById(t);if(!o)return null;const s={...o.viewerConfig,...i};o.destroy();const n=document.getElementById(t);return this.init(n,s)}enableMemoryManagement(t={}){this.memoryObserver&&this.memoryObserver.disconnect();const i=t.rootMargin||"200px";this.memoryObserver=new IntersectionObserver(o=>{o.forEach(s=>{const n=this.getViewById(s.target.id);n&&(s.isIntersecting?n.isMemoryReleased&&n.reloadImages():!n.isMemoryReleased&&n.isReady&&n.releaseMemory())})},{rootMargin:i}),this.views.forEach((o,s)=>{const n=document.getElementById(s);n&&this.memoryObserver.observe(n)}),this.boundVisibilityHandler=()=>{document.hidden?this.views.forEach(o=>{!o.isMemoryReleased&&o.isReady&&o.releaseMemory()}):this.views.forEach((o,s)=>{if(o.isMemoryReleased){const n=document.getElementById(s);if(n){const r=n.getBoundingClientRect();r.top<window.innerHeight&&r.bottom>0&&o.reloadImages()}}})},document.addEventListener("visibilitychange",this.boundVisibilityHandler)}disableMemoryManagement(){this.memoryObserver&&(this.memoryObserver.disconnect(),this.memoryObserver=null),this.boundVisibilityHandler&&(document.removeEventListener("visibilitychange",this.boundVisibilityHandler),this.boundVisibilityHandler=null)}}exports.default=Hn;
65
- //# sourceMappingURL=ci360-DgTNfqhd.js.map
64
+ `,o},he=(e,t,i)=>{const{innerBox:o,imageList:s,lazyload:n}=t||{},[r]=s,a=r||Vo(e,t),l=_o(a),c=Re(l,n,"cloudimage-lazy"),h=Re(l,!1,"cloudimage-360-placeholder"),u=m=>{ue(o,".cloudimage-lazy"),i&&i({event:m,width:c.width,height:c.height,naturalWidth:c.naturalWidth,naturalHeight:c.naturalHeight,src:l})};c.onload=u,o.appendChild(c),o.appendChild(h),Fo(c)},jo=(e,t,i)=>{const o=e/i,s=t/i;return{zoomedWidth:o,zoomedHeight:s}},Uo=({pointerX:e,pointerY:t,imageData:i,zoomedWidth:o,zoomedHeight:s,drawWidth:n,drawHeight:r})=>{const{naturalWidth:a,naturalHeight:l}=i;let c=e/n*a-o/2,h=t/r*l-s/2;const u=Math.max(0,a-o),m=Math.max(0,l-s);return c=Math.max(0,Math.min(c,u)),h=Math.max(0,Math.min(h,m)),{zoomOffsetX:c,zoomOffsetY:h}},ze=(e,{bottom:t,top:i})=>{e?t():i()},Ze=(e,{left:t,right:i})=>{e?t():i()},$o=({autoplayBehavior:e,spinY:t,reversed:i,loopTriggers:o})=>{switch(e){case Y.SPIN_XY:case Y.SPIN_YX:t?ze(i,o):Ze(i,o);break;case Y.SPIN_Y:ze(i,o);break;case Y.SPIN_X:default:Ze(i,o)}},Ko=({autoplayBehavior:e,activeImageX:t,activeImageY:i,amountX:o,amountY:s,autoplayReverse:n,isGridMode:r=!1})=>{const a=(l,c)=>{const h=c-1;return n?l===0:l===h};if(r)switch(e){case Y.SPIN_X:return a(t,o);case Y.SPIN_Y:return a(i,s);case Y.SPIN_XY:case Y.SPIN_YX:default:return a(t,o)&&a(i,s)}switch(e){case Y.SPIN_XY:case Y.SPIN_Y:return a(i,s);case Y.SPIN_X:case Y.SPIN_YX:default:return a(t,o)}},qo=({autoplayBehavior:e,activeImageX:t,activeImageY:i,amountX:o,amountY:s,autoplayReverse:n,spinDirection:r,isGridMode:a=!1})=>{if(a)return!1;const l=t===(n?0:o-1),c=i===(n?0:s-1);return e===Y.SPIN_XY||e===Y.SPIN_YX?r==="x"&&l||r==="y"&&c:!1},Jo=(e,t,i)=>{if(!i)return"x";if(!t)return"y";switch(e){case Y.SPIN_XY:return"x";case Y.SPIN_YX:return"y";case Y.SPIN_Y:return"y";case Y.SPIN_X:default:return"x"}},Qo=e=>e==="x"?"y":"x",De=(e,t)=>{const i=[...Ji];return t?[...i,...Qi].includes(e):i.includes(e)},Be=({deltaX:e,deltaY:t,reversed:i,allowSpinX:o,allowSpinY:s,threshold:n=0})=>{const r=o&&!s||s&&!o?0:n,a=Math.abs(e),l=Math.abs(t);return o&&a-r>l?i?e>0?"left":"right":e>0?"right":"left":s&&l-r>a?i?t>0?"up":"down":t>0?"down":"up":null},ts=()=>"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0,es=(e,t=150)=>{let i;return function(...o){clearTimeout(i),i=setTimeout(()=>{e.apply(this,o)},t)}},is=()=>document.fullscreenEnabled||document.webkitFullscreenEnabled,ce=()=>document.fullscreenElement||document.webkitFullscreenElement,os=e=>e.requestFullscreen?e.requestFullscreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():Promise.reject(new Error("Fullscreen API not supported")),Ge=()=>document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():Promise.reject(new Error("Fullscreen API not supported")),N=1;class ss{constructor(t,{zoomMax:i=5,zoomStep:o=.5,onZoomChange:s}={}){this.container=t,this.zoomMax=i,this.zoomStep=o,this.onZoomChange=s,this.zoom=1,this.panX=0,this.panY=0,this.drawWidth=0,this.drawHeight=0,this.isPanning=!1,this.panStartX=0,this.panStartY=0,this._onWheel=this._onWheel.bind(this),this._onDblClick=this._onDblClick.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this._onMouseUp=this._onMouseUp.bind(this),this._onGestureStart=this._onGestureStart.bind(this),this._onGestureChange=this._onGestureChange.bind(this),this._onGestureEnd=this._onGestureEnd.bind(this),this._gestureBaseZoom=1,this._attach()}setDrawSize(t,i,o=!1){const s=this.drawWidth,n=this.drawHeight;this.drawWidth=t,this.drawHeight=i,o&&s&&n?(this.panX=this.panX/s*t,this.panY=this.panY/n*i,this._clampPan()):(this.panX=t/2,this.panY=i/2)}_attach(){this.container.addEventListener("wheel",this._onWheel,{passive:!1}),this.container.addEventListener("dblclick",this._onDblClick),typeof GestureEvent<"u"&&(this.container.addEventListener("gesturestart",this._onGestureStart),this.container.addEventListener("gesturechange",this._onGestureChange),this.container.addEventListener("gestureend",this._onGestureEnd))}destroy(){this.container.removeEventListener("wheel",this._onWheel),this.container.removeEventListener("dblclick",this._onDblClick),this._stopPanListeners(),typeof GestureEvent<"u"&&(this.container.removeEventListener("gesturestart",this._onGestureStart),this.container.removeEventListener("gesturechange",this._onGestureChange),this.container.removeEventListener("gestureend",this._onGestureEnd))}zoomIn(){this._applyZoom(this.zoom+this.zoomStep)}zoomOut(){this._applyZoom(this.zoom-this.zoomStep)}resetZoom(){this._applyZoom(N)}setZoom(t){this._applyZoom(t)}zoomTowardPoint(t,i,o){this._zoomTowardPoint(t,i,o)}getZoom(){return this.zoom}isZoomed(){return this.zoom>N}startPan(t,i){return this.zoom<=N?!1:(this.isPanning=!0,this.panStartX=t,this.panStartY=i,document.addEventListener("mousemove",this._onMouseMove),document.addEventListener("mouseup",this._onMouseUp),!0)}_stopPanListeners(){document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp)}_onMouseMove(t){if(!this.isPanning)return;const i=t.pageX-this.panStartX,o=t.pageY-this.panStartY;this.panStartX=t.pageX,this.panStartY=t.pageY,this._applyPan(this.panX-i,this.panY-o)}_onMouseUp(){this.isPanning=!1,this._stopPanListeners()}_onWheel(t){if(!t.ctrlKey&&!t.metaKey)return;t.preventDefault();let i=-t.deltaY;t.deltaMode===1&&(i*=40),t.deltaMode===2&&(i*=800);const o=Math.pow(2,i/300),s=this.zoom*o;this._zoomTowardPoint(s,t.clientX,t.clientY)}_onDblClick(t){t.target&&t.target.closest&&(t.target.closest(".cloudimage-360-button")||t.target.closest(".cloudimage-360-hotspot-timeline")||t.target.closest(".cloudimage-360-hotspot")||t.target.closest(".cloudimage-360-zoom-controls"))||(this.zoom>N?this._applyZoom(N):this._zoomTowardPoint(2,t.clientX,t.clientY))}_onGestureStart(t){t.preventDefault(),this._gestureBaseZoom=this.zoom}_onGestureChange(t){t.preventDefault();const i=this._gestureBaseZoom*t.scale;this._zoomTowardPoint(i,t.clientX,t.clientY)}_onGestureEnd(t){t.preventDefault()}handleKeyZoom(t){return t===187||t===107?(this.zoomIn(),!0):t===189||t===109?(this.zoomOut(),!0):t===48||t===96?(this.resetZoom(),!0):!1}handleKeyPan(t,i=50){if(this.zoom<=N)return!1;let o=0,s=0;switch(t){case 37:o=-i;break;case 39:o=i;break;case 38:s=-i;break;case 40:s=i;break;default:return!1}return this._applyPan(this.panX+o,this.panY+s),!0}applyTouchPan(t,i){this.zoom<=N||this._applyPan(this.panX-t,this.panY-i)}applyTouchZoom(t){this._applyZoom(t)}_zoomTowardPoint(t,i,o){var r;const s=Math.max(N,Math.min(t,this.zoomMax));if(s===this.zoom)return;const n=(r=this.container.querySelector("canvas"))==null?void 0:r.getBoundingClientRect();if(n){const a=(i-n.left)/n.width*this.drawWidth,l=(o-n.top)/n.height*this.drawHeight,c=s/this.zoom;this.panX=a+(this.panX-a)*c,this.panY=l+(this.panY-l)*c}this.zoom=s,this._clampPan(),this._emit()}_applyZoom(t){const i=Math.max(N,Math.min(t,this.zoomMax));i!==this.zoom&&(this.zoom=i,this.zoom<=N&&(this.panX=this.drawWidth/2,this.panY=this.drawHeight/2),this._clampPan(),this._emit())}_applyPan(t,i){this.panX=t,this.panY=i,this._clampPan(),this._emit()}_clampPan(){if(this.zoom<=N||!this.drawWidth||!this.drawHeight)return;const t=this.drawWidth/(2*this.zoom),i=this.drawHeight/(2*this.zoom);this.panX=Math.max(t,Math.min(this.panX,this.drawWidth-t)),this.panY=Math.max(i,Math.min(this.panY,this.drawHeight-i))}_emit(){typeof this.onZoomChange=="function"&&this.onZoomChange(this.zoom,this.panX,this.panY)}}class ns{constructor(t,{onPinchZoom:i,onPan:o,onDoubleTap:s,getZoom:n,zoomMax:r=5}={}){this.container=t,this.onPinchZoom=i,this.onPan=o,this.onDoubleTap=s,this.getZoom=n,this.zoomMax=r,this.isPinching=!1,this.initialPinchDistance=0,this.pinchBaseZoom=1,this.lastTouchX=0,this.lastTouchY=0,this.lastTapTime=0,this.lastTapX=0,this.lastTapY=0,this._onTouchStart=this._onTouchStart.bind(this),this._onTouchMove=this._onTouchMove.bind(this),this._onTouchEnd=this._onTouchEnd.bind(this),this._attach()}_attach(){this.container.addEventListener("touchstart",this._onTouchStart,{passive:!1}),this.container.addEventListener("touchmove",this._onTouchMove,{passive:!1}),this.container.addEventListener("touchend",this._onTouchEnd,{passive:!1})}destroy(){this.container.removeEventListener("touchstart",this._onTouchStart),this.container.removeEventListener("touchmove",this._onTouchMove),this.container.removeEventListener("touchend",this._onTouchEnd)}_getPinchDistance(t,i){const o=t.pageX-i.pageX,s=t.pageY-i.pageY;return Math.sqrt(o*o+s*s)}_onTouchStart(t){if(t.touches){if(t.touches.length===2){t.preventDefault(),this.isPinching=!0,this.initialPinchDistance=this._getPinchDistance(t.touches[0],t.touches[1]),this.pinchBaseZoom=typeof this.getZoom=="function"?this.getZoom():1;return}if(t.touches.length===1){const i=t.touches[0];this.lastTouchX=i.pageX,this.lastTouchY=i.pageY;const o=Date.now(),s=o-this.lastTapTime,n=Math.abs(i.pageX-this.lastTapX),r=Math.abs(i.pageY-this.lastTapY);if(s<300&&n<30&&r<30){t.preventDefault(),t.stopPropagation(),this.lastTapTime=0,typeof this.onDoubleTap=="function"&&this.onDoubleTap(i.clientX,i.clientY);return}this.lastTapTime=o,this.lastTapX=i.pageX,this.lastTapY=i.pageY}}}_onTouchMove(t){if(t.touches){if(this.isPinching&&t.touches.length===2){t.preventDefault();const i=this._getPinchDistance(t.touches[0],t.touches[1]);if(this.initialPinchDistance===0){this.initialPinchDistance=i;return}const o=i/this.initialPinchDistance,s=Math.max(1,Math.min(this.pinchBaseZoom*o,this.zoomMax)),n=(t.touches[0].clientX+t.touches[1].clientX)/2,r=(t.touches[0].clientY+t.touches[1].clientY)/2;typeof this.onPinchZoom=="function"&&this.onPinchZoom(s,n,r);return}if(t.touches.length===1){if((typeof this.getZoom=="function"?this.getZoom():1)<=1)return;t.preventDefault();const o=t.touches[0],s=o.pageX-this.lastTouchX,n=o.pageY-this.lastTouchY;this.lastTouchX=o.pageX,this.lastTouchY=o.pageY,typeof this.onPan=="function"&&this.onPan(s,n)}}}_onTouchEnd(t){this.isPinching&&(!t.touches||t.touches.length<2)&&(this.isPinching=!1,this.initialPinchDistance=0,t.touches&&t.touches.length===1&&(this.lastTouchX=t.touches[0].pageX,this.lastTouchY=t.touches[0].pageY))}}const rs='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="11" x2="11" y1="8" y2="14"/><line x1="8" x2="14" y1="11" y2="11"/></svg>',as='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="8" x2="14" y1="11" y2="11"/></svg>',ls='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/></svg>',hs=(e,{position:t="bottom-right",onZoomIn:i,onZoomOut:o,onReset:s,zoomMax:n=5}={})=>{const r=document.createElement("div");r.className="cloudimage-360-zoom-controls",r.setAttribute("data-position",t),r.setAttribute("role","toolbar"),r.setAttribute("aria-label","Zoom controls");const a=document.createElement("button");a.className="cloudimage-360-zoom-btn cloudimage-360-zoom-btn-in",a.setAttribute("aria-label","Zoom in"),a.innerHTML=rs,a.addEventListener("click",u=>{u.stopPropagation(),typeof i=="function"&&i()});const l=document.createElement("button");l.className="cloudimage-360-zoom-btn cloudimage-360-zoom-btn-out",l.setAttribute("aria-label","Zoom out"),l.innerHTML=as,l.disabled=!0,l.addEventListener("click",u=>{u.stopPropagation(),typeof o=="function"&&o()});const c=document.createElement("button");c.className="cloudimage-360-zoom-btn cloudimage-360-zoom-btn-reset",c.setAttribute("aria-label","Reset zoom"),c.innerHTML=ls,c.disabled=!0,c.addEventListener("click",u=>{u.stopPropagation(),typeof s=="function"&&s()});const h=document.createElement("span");return h.className="cloudimage-360-zoom-separator",r.appendChild(a),r.appendChild(l),r.appendChild(h),r.appendChild(c),e.appendChild(r),{element:r,updateState(u){a.disabled=u>=n,l.disabled=u<=1,c.disabled=u<=1},show(){r.classList.add("visible")},hide(){r.classList.remove("visible")},destroy(){r.parentNode&&r.parentNode.removeChild(r)}}},ri="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IHY9KHQsYSxlKT0+e2NvbnN0IHM9dC9lLG49YS9lO3JldHVybnt6b29tZWRXaWR0aDpzLHpvb21lZEhlaWdodDpufX0sej0oe3BvaW50ZXJYOnQscG9pbnRlclk6YSxpbWFnZURhdGE6ZSx6b29tZWRXaWR0aDpzLHpvb21lZEhlaWdodDpuLGRyYXdXaWR0aDppLGRyYXdIZWlnaHQ6Y30pPT57Y29uc3R7bmF0dXJhbFdpZHRoOmcsbmF0dXJhbEhlaWdodDp1fT1lO2xldCBmPXQvaSpnLXMvMixtPWEvYyp1LW4vMjtjb25zdCB4PU1hdGgubWF4KDAsZy1zKSxPPU1hdGgubWF4KDAsdS1uKTtyZXR1cm4gZj1NYXRoLm1heCgwLE1hdGgubWluKGYseCkpLG09TWF0aC5tYXgoMCxNYXRoLm1pbihtLE8pKSx7em9vbU9mZnNldFg6Zix6b29tT2Zmc2V0WTptfX07bGV0IG8saCxyLGQsbCx3O3NlbGYub25tZXNzYWdlPWFzeW5jIHQ9Pntjb25zdHthY3Rpb246YSxvZmZzY3JlZW46ZSxkZXZpY2VQaXhlbFJhdGlvOnMsaW1hZ2VEYXRhOm4sem9vbVNjYWxlOmkscG9pbnRlclg6Yyxwb2ludGVyWTpnLGltYWdlQXNwZWN0UmF0aW86dSxjb250YWluZXJXaWR0aDpmLGNvbnRhaW5lckhlaWdodDptfT10LmRhdGE7c3dpdGNoKGEpe2Nhc2UiaW5pdENhbnZhcyI6QyhlLHMpO2JyZWFrO2Nhc2UiYWRhcHRDYW52YXNTaXplIjpwKHUsZixtKTticmVhaztjYXNlImRyYXdJbWFnZU9uQ2FudmFzIjpJKG4saSxjLGcpO2JyZWFrfX07Y29uc3QgQz0odCxhKT0+e289dCxoPW8uZ2V0Q29udGV4dCgiMmQiKSxyPWF9LHA9KHQsYSxlKT0+e2NvbnN0IHM9YS9lO3c9dD5zLG8ud2lkdGg9YSpyLG8uaGVpZ2h0PWUqcixoLnNjYWxlKHIsciksdz8oZD1hLGw9YS90KToobD1lLGQ9ZSp0KSxoLmltYWdlU21vb3RoaW5nRW5hYmxlZD0hMCxoLmltYWdlU21vb3RoaW5nUXVhbGl0eT0iaGlnaCJ9LEk9KHQ9e30sYT0xLGU9MCxzPTApPT57Y29uc3R7Yml0bWFwSW1hZ2U6bn09dDtpZighb3x8IW4pcmV0dXJuO2xldCBpLGM7aWYodz8oaT0wLGM9KG8uaGVpZ2h0L3ItbCkvMik6KGk9KG8ud2lkdGgvci1kKS8yLGM9MCksaC5jbGVhclJlY3QoMCwwLG8ud2lkdGgsby5oZWlnaHQpLGEhPT0xKXtjb25zdHtuYXR1cmFsV2lkdGg6ZyxuYXR1cmFsSGVpZ2h0OnV9PXQse3pvb21lZFdpZHRoOmYsem9vbWVkSGVpZ2h0Om19PXYoZyx1LGEpLHt6b29tT2Zmc2V0WDp4LHpvb21PZmZzZXRZOk99PXooe3BvaW50ZXJYOmUscG9pbnRlclk6cyxpbWFnZURhdGE6dCx6b29tZWRXaWR0aDpmLHpvb21lZEhlaWdodDptLGRyYXdXaWR0aDpkLGRyYXdIZWlnaHQ6bH0pO2guZHJhd0ltYWdlKG4seCxPLGYsbSxpLGMsZCxsKX1lbHNlIGguZHJhd0ltYWdlKG4saSxjLGQsbCl9fSkoKTsKLy8jIHNvdXJjZU1hcHBpbmdVUkw9Y2FudmFzLndvcmtlci1DZzBma3BEMS5qcy5tYXAK",cs=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)),_e=typeof self<"u"&&self.Blob&&new Blob([cs(ri)],{type:"text/javascript;charset=utf-8"});function ds(e){let t;try{if(t=_e&&(self.URL||self.webkitURL).createObjectURL(_e),!t)throw"";const i=new Worker(t,{name:e==null?void 0:e.name});return i.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),i}catch{return new Worker("data:text/javascript;base64,"+ri,{name:e==null?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}class us{constructor(){this.canvas=null,this.ctx=null,this.dpr=1,this.drawWidth=0,this.drawHeight=0,this.wideImage=!1}postMessage(t){const{action:i,offscreen:o,devicePixelRatio:s,imageData:n,zoomScale:r,pointerX:a,pointerY:l,imageAspectRatio:c,containerWidth:h,containerHeight:u}=t;switch(i){case"initCanvas":this.initCanvas(o,s);break;case"adaptCanvasSize":this.adaptCanvasSize(c,h,u);break;case"drawImageOnCanvas":this.drawImageOnCanvas(n,r,a,l);break}}terminate(){var t,i;this.ctx&&this.ctx.clearRect(0,0,((t=this.canvas)==null?void 0:t.width)||0,((i=this.canvas)==null?void 0:i.height)||0),this.canvas=null,this.ctx=null}initCanvas(t,i){this.canvas=t,this.ctx=t.getContext("2d"),this.dpr=i}adaptCanvasSize(t,i,o){if(!this.canvas||!this.ctx)return;const s=i/o;this.wideImage=t>s,this.canvas.width=i*this.dpr,this.canvas.height=o*this.dpr,this.ctx.scale(this.dpr,this.dpr),this.wideImage?(this.drawWidth=i,this.drawHeight=i/t):(this.drawHeight=o,this.drawWidth=o*t),this.ctx.imageSmoothingEnabled=!0,this.ctx.imageSmoothingQuality="high"}drawImageOnCanvas(t={},i=1,o=0,s=0){const{bitmapImage:n}=t;if(!this.canvas||!this.ctx||!n)return;let r,a;if(this.wideImage?(r=0,a=(this.canvas.height/this.dpr-this.drawHeight)/2):(r=(this.canvas.width/this.dpr-this.drawWidth)/2,a=0),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),i!==1){const{naturalWidth:l,naturalHeight:c}=t,{zoomedWidth:h,zoomedHeight:u}=jo(l,c,i),{zoomOffsetX:m,zoomOffsetY:p}=Uo({pointerX:o,pointerY:s,imageData:t,zoomedWidth:h,zoomedHeight:u,drawWidth:this.drawWidth,drawHeight:this.drawHeight});this.ctx.drawImage(n,m,p,h,u,r,a,this.drawWidth,this.drawHeight)}else this.ctx.drawImage(n,r,a,this.drawWidth,this.drawHeight)}}const ps=new Set(["p","span","div","br","hr","strong","em","b","i","u","s","h1","h2","h3","h4","h5","h6","ul","ol","li","a","img","button","table","thead","tbody","tr","th","td","blockquote","pre","code","label","input","select","option","textarea","svg","path","circle","rect","line","polyline","polygon","ellipse","g","text","tspan","defs","use","symbol","clippath","mask","lineargradient","radialgradient","stop"]),Fe={a:["href","title","target","rel"],img:["src","alt","title","width","height"],button:["type","disabled","name","value"],input:["type","name","value","placeholder","disabled","readonly","checked","min","max","step"],select:["name","disabled","multiple"],option:["value","disabled","selected"],textarea:["name","placeholder","disabled","readonly","rows","cols"],label:["for"],svg:["viewbox","width","height","fill","stroke","xmlns","preserveaspectratio"],path:["d","fill","stroke","stroke-width","stroke-linecap","stroke-linejoin","transform"],circle:["cx","cy","r","fill","stroke","stroke-width"],rect:["x","y","width","height","rx","ry","fill","stroke","stroke-width"],line:["x1","y1","x2","y2","stroke","stroke-width"],polyline:["points","fill","stroke","stroke-width"],polygon:["points","fill","stroke","stroke-width"],ellipse:["cx","cy","rx","ry","fill","stroke","stroke-width"],g:["transform","fill","stroke"],text:["x","y","dx","dy","text-anchor","fill","font-size","font-family","font-weight"],tspan:["x","y","dx","dy"],use:["href","xlink:href","x","y","width","height"],lineargradient:["id","x1","y1","x2","y2","gradientunits"],radialgradient:["id","cx","cy","r","fx","fy","gradientunits"],stop:["offset","stop-color","stop-opacity"],clippath:["id"],mask:["id"],"*":["class","id","style"]},ms=[/javascript:/i,/vbscript:/i,/on\w+\s*=/i],fs=e=>{if(typeof e!="string")return"";const t=document.createElement("template");t.innerHTML=e;const i=o=>{if(Array.from(o.childNodes).forEach(i),o.nodeType===Node.ELEMENT_NODE){const n=o.tagName.toLowerCase();if(!ps.has(n)){if(n==="script"||n==="style"){o.remove();return}const l=document.createTextNode(o.textContent);o.parentNode.replaceChild(l,o);return}const r=[...Fe[n]||[],...Fe["*"]||[]];if(Array.from(o.attributes).forEach(l=>{const c=l.name.toLowerCase();if(c.startsWith("on")){o.removeAttribute(l.name);return}if(!r.includes(c)){o.removeAttribute(l.name);return}let h=l.value;ms.forEach(u=>{u.test(h)&&o.removeAttribute(l.name)})}),n==="a"){const l=o.getAttribute("href");l&&(/^(https?:|mailto:|tel:|#|\/)/i.test(l.trim())||o.removeAttribute("href")),o.getAttribute("target")==="_blank"&&o.setAttribute("rel","noopener noreferrer")}if(n==="img"){const l=o.getAttribute("src");l&&(/^(https?:|\/|data:image\/)/i.test(l.trim())||o.removeAttribute("src"))}}};return i(t.content),t.innerHTML},gs=e=>e==="y"?L.Y:L.X,vs=(e,t,i)=>e.filter(o=>t in o.positions?i==="grid"?!0:gs(o.orientation)===i:!1),ys=(e,t,i)=>{const o=document.createElement("button");if(o.id=e,o.className="cloudimage-360-hotspot cloudimage-360-hotspot--pulse",o.dataset.hotspotId=e,o.setAttribute("type","button"),o.setAttribute("aria-label",t||`Hotspot ${e}`),o.setAttribute("aria-haspopup","true"),o.setAttribute("aria-expanded","false"),i==="dot-label"&&t){o.classList.add("cloudimage-360-hotspot--dot-label");const s=document.createElement("span");s.className="cloudimage-360-hotspot-label",s.textContent=t,o.appendChild(s)}return o},bs=e=>{const t=Object.entries(e).sort(([n],[r])=>Number(n)-Number(r));let i=null,o=null;const s={};for(const[n,r]of t)if(!r)s[n]={x:i,y:o};else{const{x:a,y:l}=r;a!=null&&(i=a),l!=null&&(o=l),s[n]={x:a??i,y:l??o}}return s},ws=e=>({placement:"top",modifiers:[{name:"offset",options:{offset:[0,10]}},{name:"preventOverflow",options:{boundary:e}},{name:"flip",options:{boundary:e,fallbackPlacements:["bottom","right","left"]}}]}),Cs=(e,t,i)=>{const o=document.createElement("div");return o.className="cloudimage-360-popper",o.id=`cloudimage-360-popper-${t}`,o.dataset.popperId=t,o.setAttribute("role","tooltip"),o.setAttribute("aria-hidden","false"),typeof e=="string"&&/<\/?[a-z][\s\S]*>/i.test(e)?o.innerHTML=fs(e):o.textContent=e,(i||document.body).appendChild(o),o},Is=e=>e.map(t=>{const i={...bs(t.positions)};return{...t,initialPositions:i,positions:i}}),xs=({newWidth:e,newHeight:t,initialContainerSize:i,imageAspectRatio:o,hotspotsConfig:s})=>{const[n,r]=i;let a=e,l=t,c=0,h=0;const u=e/t;o>u?(l=e/o,h=(t-l)/2):(a=t*o,c=(e-a)/2);const p=a/n,C=l/r;return s.map(v=>{const b={};return Object.entries(v.initialPositions).forEach(([x,P])=>{b[x]={x:P.x*p+c,y:P.y*C+h}}),{...v,positions:b}})};function Ps(e){const t=[];e.image&&t.push(`<div class="ci360-popper-image-wrapper"><img class="ci360-popper-image" src="${Tt(e.image)}" alt="${Tt(e.title||"")}"></div>`);const i=[];if(e.title&&i.push(`<h3 class="ci360-popper-title">${ft(e.title)}</h3>`),e.originalPrice||e.price){let o="";e.originalPrice&&(o+=`<span class="ci360-popper-original-price">${ft(e.originalPrice)}</span>`),e.price&&(o+=`<span class="ci360-popper-price">${ft(e.price)}</span>`),i.push(`<div class="ci360-popper-price-row">${o}</div>`)}if(e.description&&i.push(`<p class="ci360-popper-description">${ft(e.description)}</p>`),e.url&&Es(e.url)){const o=e.ctaText||"View details",s=e.id?` data-product-id="${Tt(e.id)}"`:"";i.push(`<a class="ci360-popper-cta" href="${Tt(e.url)}" target="_top"${s}>${ft(String(o))}</a>`)}else if(e.id){const o=e.ctaText||"View details";i.push(`<button class="ci360-popper-cta" data-product-id="${Tt(e.id)}">${ft(String(o))}</button>`)}return i.length>0&&t.push(`<div class="ci360-popper-body">${i.join("")}</div>`),t.join("")}function de(e){return e.content?e.content:e.data?Ps(e.data):""}function ft(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Tt(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Es(e){const t=e.replace(/[\s\x00-\x1f]/g,"");return/^https?:\/\//i.test(t)||/^\/(?!\/)/.test(t)||/^#/.test(t)}var R="top",_="bottom",F="right",z="left",fe="auto",Lt=[R,_,F,z],gt="start",Xt="end",Ts="clippingParents",ai="viewport",At="popper",As="reference",Ne=Lt.reduce(function(e,t){return e.concat([t+"-"+gt,t+"-"+Xt])},[]),li=[].concat(Lt,[fe]).reduce(function(e,t){return e.concat([t,t+"-"+gt,t+"-"+Xt])},[]),ks="beforeRead",Ss="read",Xs="afterRead",Ys="beforeMain",Ls="main",Ms="afterMain",Os="beforeWrite",Hs="write",Rs="afterWrite",zs=[ks,Ss,Xs,Ys,Ls,Ms,Os,Hs,Rs];function j(e){return e?(e.nodeName||"").toLowerCase():null}function D(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function ht(e){var t=D(e).Element;return e instanceof t||e instanceof Element}function G(e){var t=D(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function ge(e){if(typeof ShadowRoot>"u")return!1;var t=D(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function Zs(e){var t=e.state;Object.keys(t.elements).forEach(function(i){var o=t.styles[i]||{},s=t.attributes[i]||{},n=t.elements[i];!G(n)||!j(n)||(Object.assign(n.style,o),Object.keys(s).forEach(function(r){var a=s[r];a===!1?n.removeAttribute(r):n.setAttribute(r,a===!0?"":a)}))})}function Ds(e){var t=e.state,i={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,i.popper),t.styles=i,t.elements.arrow&&Object.assign(t.elements.arrow.style,i.arrow),function(){Object.keys(t.elements).forEach(function(o){var s=t.elements[o],n=t.attributes[o]||{},r=Object.keys(t.styles.hasOwnProperty(o)?t.styles[o]:i[o]),a=r.reduce(function(l,c){return l[c]="",l},{});!G(s)||!j(s)||(Object.assign(s.style,a),Object.keys(n).forEach(function(l){s.removeAttribute(l)}))})}}const Bs={name:"applyStyles",enabled:!0,phase:"write",fn:Zs,effect:Ds,requires:["computeStyles"]};function V(e){return e.split("-")[0]}var lt=Math.max,Jt=Math.min,vt=Math.round;function pe(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function hi(){return!/^((?!chrome|android).)*safari/i.test(pe())}function yt(e,t,i){t===void 0&&(t=!1),i===void 0&&(i=!1);var o=e.getBoundingClientRect(),s=1,n=1;t&&G(e)&&(s=e.offsetWidth>0&&vt(o.width)/e.offsetWidth||1,n=e.offsetHeight>0&&vt(o.height)/e.offsetHeight||1);var r=ht(e)?D(e):window,a=r.visualViewport,l=!hi()&&i,c=(o.left+(l&&a?a.offsetLeft:0))/s,h=(o.top+(l&&a?a.offsetTop:0))/n,u=o.width/s,m=o.height/n;return{width:u,height:m,top:h,right:c+u,bottom:h+m,left:c,x:c,y:h}}function ve(e){var t=yt(e),i=e.offsetWidth,o=e.offsetHeight;return Math.abs(t.width-i)<=1&&(i=t.width),Math.abs(t.height-o)<=1&&(o=t.height),{x:e.offsetLeft,y:e.offsetTop,width:i,height:o}}function ci(e,t){var i=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(i&&ge(i)){var o=t;do{if(o&&e.isSameNode(o))return!0;o=o.parentNode||o.host}while(o)}return!1}function tt(e){return D(e).getComputedStyle(e)}function Gs(e){return["table","td","th"].indexOf(j(e))>=0}function ot(e){return((ht(e)?e.ownerDocument:e.document)||window.document).documentElement}function Qt(e){return j(e)==="html"?e:e.assignedSlot||e.parentNode||(ge(e)?e.host:null)||ot(e)}function We(e){return!G(e)||tt(e).position==="fixed"?null:e.offsetParent}function _s(e){var t=/firefox/i.test(pe()),i=/Trident/i.test(pe());if(i&&G(e)){var o=tt(e);if(o.position==="fixed")return null}var s=Qt(e);for(ge(s)&&(s=s.host);G(s)&&["html","body"].indexOf(j(s))<0;){var n=tt(s);if(n.transform!=="none"||n.perspective!=="none"||n.contain==="paint"||["transform","perspective"].indexOf(n.willChange)!==-1||t&&n.willChange==="filter"||t&&n.filter&&n.filter!=="none")return s;s=s.parentNode}return null}function Mt(e){for(var t=D(e),i=We(e);i&&Gs(i)&&tt(i).position==="static";)i=We(i);return i&&(j(i)==="html"||j(i)==="body"&&tt(i).position==="static")?t:i||_s(e)||t}function ye(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function kt(e,t,i){return lt(e,Jt(t,i))}function Fs(e,t,i){var o=kt(e,t,i);return o>i?i:o}function di(){return{top:0,right:0,bottom:0,left:0}}function ui(e){return Object.assign({},di(),e)}function pi(e,t){return t.reduce(function(i,o){return i[o]=e,i},{})}var Ns=function(t,i){return t=typeof t=="function"?t(Object.assign({},i.rects,{placement:i.placement})):t,ui(typeof t!="number"?t:pi(t,Lt))};function Ws(e){var t,i=e.state,o=e.name,s=e.options,n=i.elements.arrow,r=i.modifiersData.popperOffsets,a=V(i.placement),l=ye(a),c=[z,F].indexOf(a)>=0,h=c?"height":"width";if(!(!n||!r)){var u=Ns(s.padding,i),m=ve(n),p=l==="y"?R:z,C=l==="y"?_:F,v=i.rects.reference[h]+i.rects.reference[l]-r[l]-i.rects.popper[h],b=r[l]-i.rects.reference[l],x=Mt(n),P=x?l==="y"?x.clientHeight||0:x.clientWidth||0:0,w=v/2-b/2,g=u[p],E=P-m[h]-u[C],f=P/2-m[h]/2+w,y=kt(g,f,E),I=l;i.modifiersData[o]=(t={},t[I]=y,t.centerOffset=y-f,t)}}function Vs(e){var t=e.state,i=e.options,o=i.element,s=o===void 0?"[data-popper-arrow]":o;s!=null&&(typeof s=="string"&&(s=t.elements.popper.querySelector(s),!s)||ci(t.elements.popper,s)&&(t.elements.arrow=s))}const js={name:"arrow",enabled:!0,phase:"main",fn:Ws,effect:Vs,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function bt(e){return e.split("-")[1]}var Us={top:"auto",right:"auto",bottom:"auto",left:"auto"};function $s(e,t){var i=e.x,o=e.y,s=t.devicePixelRatio||1;return{x:vt(i*s)/s||0,y:vt(o*s)/s||0}}function Ve(e){var t,i=e.popper,o=e.popperRect,s=e.placement,n=e.variation,r=e.offsets,a=e.position,l=e.gpuAcceleration,c=e.adaptive,h=e.roundOffsets,u=e.isFixed,m=r.x,p=m===void 0?0:m,C=r.y,v=C===void 0?0:C,b=typeof h=="function"?h({x:p,y:v}):{x:p,y:v};p=b.x,v=b.y;var x=r.hasOwnProperty("x"),P=r.hasOwnProperty("y"),w=z,g=R,E=window;if(c){var f=Mt(i),y="clientHeight",I="clientWidth";if(f===D(i)&&(f=ot(i),tt(f).position!=="static"&&a==="absolute"&&(y="scrollHeight",I="scrollWidth")),f=f,s===R||(s===z||s===F)&&n===Xt){g=_;var T=u&&f===E&&E.visualViewport?E.visualViewport.height:f[y];v-=T-o.height,v*=l?1:-1}if(s===z||(s===R||s===_)&&n===Xt){w=F;var k=u&&f===E&&E.visualViewport?E.visualViewport.width:f[I];p-=k-o.width,p*=l?1:-1}}var S=Object.assign({position:a},c&&Us),O=h===!0?$s({x:p,y:v},D(i)):{x:p,y:v};if(p=O.x,v=O.y,l){var M;return Object.assign({},S,(M={},M[g]=P?"0":"",M[w]=x?"0":"",M.transform=(E.devicePixelRatio||1)<=1?"translate("+p+"px, "+v+"px)":"translate3d("+p+"px, "+v+"px, 0)",M))}return Object.assign({},S,(t={},t[g]=P?v+"px":"",t[w]=x?p+"px":"",t.transform="",t))}function Ks(e){var t=e.state,i=e.options,o=i.gpuAcceleration,s=o===void 0?!0:o,n=i.adaptive,r=n===void 0?!0:n,a=i.roundOffsets,l=a===void 0?!0:a,c={placement:V(t.placement),variation:bt(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:s,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,Ve(Object.assign({},c,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:r,roundOffsets:l})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,Ve(Object.assign({},c,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const qs={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Ks,data:{}};var jt={passive:!0};function Js(e){var t=e.state,i=e.instance,o=e.options,s=o.scroll,n=s===void 0?!0:s,r=o.resize,a=r===void 0?!0:r,l=D(t.elements.popper),c=[].concat(t.scrollParents.reference,t.scrollParents.popper);return n&&c.forEach(function(h){h.addEventListener("scroll",i.update,jt)}),a&&l.addEventListener("resize",i.update,jt),function(){n&&c.forEach(function(h){h.removeEventListener("scroll",i.update,jt)}),a&&l.removeEventListener("resize",i.update,jt)}}const Qs={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Js,data:{}};var tn={left:"right",right:"left",bottom:"top",top:"bottom"};function $t(e){return e.replace(/left|right|bottom|top/g,function(t){return tn[t]})}var en={start:"end",end:"start"};function je(e){return e.replace(/start|end/g,function(t){return en[t]})}function be(e){var t=D(e),i=t.pageXOffset,o=t.pageYOffset;return{scrollLeft:i,scrollTop:o}}function we(e){return yt(ot(e)).left+be(e).scrollLeft}function on(e,t){var i=D(e),o=ot(e),s=i.visualViewport,n=o.clientWidth,r=o.clientHeight,a=0,l=0;if(s){n=s.width,r=s.height;var c=hi();(c||!c&&t==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}return{width:n,height:r,x:a+we(e),y:l}}function sn(e){var t,i=ot(e),o=be(e),s=(t=e.ownerDocument)==null?void 0:t.body,n=lt(i.scrollWidth,i.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),r=lt(i.scrollHeight,i.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),a=-o.scrollLeft+we(e),l=-o.scrollTop;return tt(s||i).direction==="rtl"&&(a+=lt(i.clientWidth,s?s.clientWidth:0)-n),{width:n,height:r,x:a,y:l}}function Ce(e){var t=tt(e),i=t.overflow,o=t.overflowX,s=t.overflowY;return/auto|scroll|overlay|hidden/.test(i+s+o)}function mi(e){return["html","body","#document"].indexOf(j(e))>=0?e.ownerDocument.body:G(e)&&Ce(e)?e:mi(Qt(e))}function St(e,t){var i;t===void 0&&(t=[]);var o=mi(e),s=o===((i=e.ownerDocument)==null?void 0:i.body),n=D(o),r=s?[n].concat(n.visualViewport||[],Ce(o)?o:[]):o,a=t.concat(r);return s?a:a.concat(St(Qt(r)))}function me(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function nn(e,t){var i=yt(e,!1,t==="fixed");return i.top=i.top+e.clientTop,i.left=i.left+e.clientLeft,i.bottom=i.top+e.clientHeight,i.right=i.left+e.clientWidth,i.width=e.clientWidth,i.height=e.clientHeight,i.x=i.left,i.y=i.top,i}function Ue(e,t,i){return t===ai?me(on(e,i)):ht(t)?nn(t,i):me(sn(ot(e)))}function rn(e){var t=St(Qt(e)),i=["absolute","fixed"].indexOf(tt(e).position)>=0,o=i&&G(e)?Mt(e):e;return ht(o)?t.filter(function(s){return ht(s)&&ci(s,o)&&j(s)!=="body"}):[]}function an(e,t,i,o){var s=t==="clippingParents"?rn(e):[].concat(t),n=[].concat(s,[i]),r=n[0],a=n.reduce(function(l,c){var h=Ue(e,c,o);return l.top=lt(h.top,l.top),l.right=Jt(h.right,l.right),l.bottom=Jt(h.bottom,l.bottom),l.left=lt(h.left,l.left),l},Ue(e,r,o));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function fi(e){var t=e.reference,i=e.element,o=e.placement,s=o?V(o):null,n=o?bt(o):null,r=t.x+t.width/2-i.width/2,a=t.y+t.height/2-i.height/2,l;switch(s){case R:l={x:r,y:t.y-i.height};break;case _:l={x:r,y:t.y+t.height};break;case F:l={x:t.x+t.width,y:a};break;case z:l={x:t.x-i.width,y:a};break;default:l={x:t.x,y:t.y}}var c=s?ye(s):null;if(c!=null){var h=c==="y"?"height":"width";switch(n){case gt:l[c]=l[c]-(t[h]/2-i[h]/2);break;case Xt:l[c]=l[c]+(t[h]/2-i[h]/2);break}}return l}function Yt(e,t){t===void 0&&(t={});var i=t,o=i.placement,s=o===void 0?e.placement:o,n=i.strategy,r=n===void 0?e.strategy:n,a=i.boundary,l=a===void 0?Ts:a,c=i.rootBoundary,h=c===void 0?ai:c,u=i.elementContext,m=u===void 0?At:u,p=i.altBoundary,C=p===void 0?!1:p,v=i.padding,b=v===void 0?0:v,x=ui(typeof b!="number"?b:pi(b,Lt)),P=m===At?As:At,w=e.rects.popper,g=e.elements[C?P:m],E=an(ht(g)?g:g.contextElement||ot(e.elements.popper),l,h,r),f=yt(e.elements.reference),y=fi({reference:f,element:w,placement:s}),I=me(Object.assign({},w,y)),T=m===At?I:f,k={top:E.top-T.top+x.top,bottom:T.bottom-E.bottom+x.bottom,left:E.left-T.left+x.left,right:T.right-E.right+x.right},S=e.modifiersData.offset;if(m===At&&S){var O=S[s];Object.keys(k).forEach(function(M){var U=[F,_].indexOf(M)>=0?1:-1,$=[R,_].indexOf(M)>=0?"y":"x";k[M]+=O[$]*U})}return k}function ln(e,t){t===void 0&&(t={});var i=t,o=i.placement,s=i.boundary,n=i.rootBoundary,r=i.padding,a=i.flipVariations,l=i.allowedAutoPlacements,c=l===void 0?li:l,h=bt(o),u=h?a?Ne:Ne.filter(function(C){return bt(C)===h}):Lt,m=u.filter(function(C){return c.indexOf(C)>=0});m.length===0&&(m=u);var p=m.reduce(function(C,v){return C[v]=Yt(e,{placement:v,boundary:s,rootBoundary:n,padding:r})[V(v)],C},{});return Object.keys(p).sort(function(C,v){return p[C]-p[v]})}function hn(e){if(V(e)===fe)return[];var t=$t(e);return[je(e),t,je(t)]}function cn(e){var t=e.state,i=e.options,o=e.name;if(!t.modifiersData[o]._skip){for(var s=i.mainAxis,n=s===void 0?!0:s,r=i.altAxis,a=r===void 0?!0:r,l=i.fallbackPlacements,c=i.padding,h=i.boundary,u=i.rootBoundary,m=i.altBoundary,p=i.flipVariations,C=p===void 0?!0:p,v=i.allowedAutoPlacements,b=t.options.placement,x=V(b),P=x===b,w=l||(P||!C?[$t(b)]:hn(b)),g=[b].concat(w).reduce(function(it,W){return it.concat(V(W)===fe?ln(t,{placement:W,boundary:h,rootBoundary:u,padding:c,flipVariations:C,allowedAutoPlacements:v}):W)},[]),E=t.rects.reference,f=t.rects.popper,y=new Map,I=!0,T=g[0],k=0;k<g.length;k++){var S=g[k],O=V(S),M=bt(S)===gt,U=[R,_].indexOf(O)>=0,$=U?"width":"height",H=Yt(t,{placement:S,boundary:h,rootBoundary:u,altBoundary:m,padding:c}),Z=U?M?F:z:M?_:R;E[$]>f[$]&&(Z=$t(Z));var ct=$t(Z),K=[];if(n&&K.push(H[O]<=0),a&&K.push(H[Z]<=0,H[ct]<=0),K.every(function(it){return it})){T=S,I=!1;break}y.set(S,K)}if(I)for(var dt=C?3:1,ut=function(W){var nt=g.find(function(pt){var q=y.get(pt);if(q)return q.slice(0,W).every(function(wt){return wt})});if(nt)return T=nt,"break"},st=dt;st>0;st--){var et=ut(st);if(et==="break")break}t.placement!==T&&(t.modifiersData[o]._skip=!0,t.placement=T,t.reset=!0)}}const dn={name:"flip",enabled:!0,phase:"main",fn:cn,requiresIfExists:["offset"],data:{_skip:!1}};function $e(e,t,i){return i===void 0&&(i={x:0,y:0}),{top:e.top-t.height-i.y,right:e.right-t.width+i.x,bottom:e.bottom-t.height+i.y,left:e.left-t.width-i.x}}function Ke(e){return[R,F,_,z].some(function(t){return e[t]>=0})}function un(e){var t=e.state,i=e.name,o=t.rects.reference,s=t.rects.popper,n=t.modifiersData.preventOverflow,r=Yt(t,{elementContext:"reference"}),a=Yt(t,{altBoundary:!0}),l=$e(r,o),c=$e(a,s,n),h=Ke(l),u=Ke(c);t.modifiersData[i]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:h,hasPopperEscaped:u},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":h,"data-popper-escaped":u})}const pn={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:un};function mn(e,t,i){var o=V(e),s=[z,R].indexOf(o)>=0?-1:1,n=typeof i=="function"?i(Object.assign({},t,{placement:e})):i,r=n[0],a=n[1];return r=r||0,a=(a||0)*s,[z,F].indexOf(o)>=0?{x:a,y:r}:{x:r,y:a}}function fn(e){var t=e.state,i=e.options,o=e.name,s=i.offset,n=s===void 0?[0,0]:s,r=li.reduce(function(h,u){return h[u]=mn(u,t.rects,n),h},{}),a=r[t.placement],l=a.x,c=a.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[o]=r}const gn={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn};function vn(e){var t=e.state,i=e.name;t.modifiersData[i]=fi({reference:t.rects.reference,element:t.rects.popper,placement:t.placement})}const yn={name:"popperOffsets",enabled:!0,phase:"read",fn:vn,data:{}};function bn(e){return e==="x"?"y":"x"}function wn(e){var t=e.state,i=e.options,o=e.name,s=i.mainAxis,n=s===void 0?!0:s,r=i.altAxis,a=r===void 0?!1:r,l=i.boundary,c=i.rootBoundary,h=i.altBoundary,u=i.padding,m=i.tether,p=m===void 0?!0:m,C=i.tetherOffset,v=C===void 0?0:C,b=Yt(t,{boundary:l,rootBoundary:c,padding:u,altBoundary:h}),x=V(t.placement),P=bt(t.placement),w=!P,g=ye(x),E=bn(g),f=t.modifiersData.popperOffsets,y=t.rects.reference,I=t.rects.popper,T=typeof v=="function"?v(Object.assign({},t.rects,{placement:t.placement})):v,k=typeof T=="number"?{mainAxis:T,altAxis:T}:Object.assign({mainAxis:0,altAxis:0},T),S=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,O={x:0,y:0};if(f){if(n){var M,U=g==="y"?R:z,$=g==="y"?_:F,H=g==="y"?"height":"width",Z=f[g],ct=Z+b[U],K=Z-b[$],dt=p?-I[H]/2:0,ut=P===gt?y[H]:I[H],st=P===gt?-I[H]:-y[H],et=t.elements.arrow,it=p&&et?ve(et):{width:0,height:0},W=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:di(),nt=W[U],pt=W[$],q=kt(0,y[H],it[H]),wt=w?y[H]/2-dt-q-nt-k.mainAxis:ut-q-nt-k.mainAxis,te=w?-y[H]/2+dt+q+pt+k.mainAxis:st+q+pt+k.mainAxis,Ct=t.elements.arrow&&Mt(t.elements.arrow),ee=Ct?g==="y"?Ct.clientTop||0:Ct.clientLeft||0:0,Ot=(M=S==null?void 0:S[g])!=null?M:0,ie=Z+wt-Ot-ee,oe=Z+te-Ot,Ht=kt(p?Jt(ct,ie):ct,Z,p?lt(K,oe):K);f[g]=Ht,O[g]=Ht-Z}if(a){var It,Rt=g==="x"?R:z,zt=g==="x"?_:F,J=f[E],mt=E==="y"?"height":"width",Zt=J+b[Rt],Dt=J-b[zt],xt=[R,z].indexOf(x)!==-1,Bt=(It=S==null?void 0:S[E])!=null?It:0,Gt=xt?Zt:J-y[mt]-I[mt]-Bt+k.altAxis,_t=xt?J+y[mt]+I[mt]-Bt-k.altAxis:Dt,Ft=p&&xt?Fs(Gt,J,_t):kt(p?Gt:Zt,J,p?_t:Dt);f[E]=Ft,O[E]=Ft-J}t.modifiersData[o]=O}}const Cn={name:"preventOverflow",enabled:!0,phase:"main",fn:wn,requiresIfExists:["offset"]};function In(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function xn(e){return e===D(e)||!G(e)?be(e):In(e)}function Pn(e){var t=e.getBoundingClientRect(),i=vt(t.width)/e.offsetWidth||1,o=vt(t.height)/e.offsetHeight||1;return i!==1||o!==1}function En(e,t,i){i===void 0&&(i=!1);var o=G(t),s=G(t)&&Pn(t),n=ot(t),r=yt(e,s,i),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(o||!o&&!i)&&((j(t)!=="body"||Ce(n))&&(a=xn(t)),G(t)?(l=yt(t,!0),l.x+=t.clientLeft,l.y+=t.clientTop):n&&(l.x=we(n))),{x:r.left+a.scrollLeft-l.x,y:r.top+a.scrollTop-l.y,width:r.width,height:r.height}}function Tn(e){var t=new Map,i=new Set,o=[];e.forEach(function(n){t.set(n.name,n)});function s(n){i.add(n.name);var r=[].concat(n.requires||[],n.requiresIfExists||[]);r.forEach(function(a){if(!i.has(a)){var l=t.get(a);l&&s(l)}}),o.push(n)}return e.forEach(function(n){i.has(n.name)||s(n)}),o}function An(e){var t=Tn(e);return zs.reduce(function(i,o){return i.concat(t.filter(function(s){return s.phase===o}))},[])}function kn(e){var t;return function(){return t||(t=new Promise(function(i){Promise.resolve().then(function(){t=void 0,i(e())})})),t}}function Sn(e){var t=e.reduce(function(i,o){var s=i[o.name];return i[o.name]=s?Object.assign({},s,o,{options:Object.assign({},s.options,o.options),data:Object.assign({},s.data,o.data)}):o,i},{});return Object.keys(t).map(function(i){return t[i]})}var qe={placement:"bottom",modifiers:[],strategy:"absolute"};function Je(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return!t.some(function(o){return!(o&&typeof o.getBoundingClientRect=="function")})}function Xn(e){e===void 0&&(e={});var t=e,i=t.defaultModifiers,o=i===void 0?[]:i,s=t.defaultOptions,n=s===void 0?qe:s;return function(a,l,c){c===void 0&&(c=n);var h={placement:"bottom",orderedModifiers:[],options:Object.assign({},qe,n),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},u=[],m=!1,p={state:h,setOptions:function(x){var P=typeof x=="function"?x(h.options):x;v(),h.options=Object.assign({},n,h.options,P),h.scrollParents={reference:ht(a)?St(a):a.contextElement?St(a.contextElement):[],popper:St(l)};var w=An(Sn([].concat(o,h.options.modifiers)));return h.orderedModifiers=w.filter(function(g){return g.enabled}),C(),p.update()},forceUpdate:function(){if(!m){var x=h.elements,P=x.reference,w=x.popper;if(Je(P,w)){h.rects={reference:En(P,Mt(w),h.options.strategy==="fixed"),popper:ve(w)},h.reset=!1,h.placement=h.options.placement,h.orderedModifiers.forEach(function(k){return h.modifiersData[k.name]=Object.assign({},k.data)});for(var g=0;g<h.orderedModifiers.length;g++){if(h.reset===!0){h.reset=!1,g=-1;continue}var E=h.orderedModifiers[g],f=E.fn,y=E.options,I=y===void 0?{}:y,T=E.name;typeof f=="function"&&(h=f({state:h,options:I,name:T,instance:p})||h)}}}},update:kn(function(){return new Promise(function(b){p.forceUpdate(),b(h)})}),destroy:function(){v(),m=!0}};if(!Je(a,l))return p;p.setOptions(c).then(function(b){!m&&c.onFirstUpdate&&c.onFirstUpdate(b)});function C(){h.orderedModifiers.forEach(function(b){var x=b.name,P=b.options,w=P===void 0?{}:P,g=b.effect;if(typeof g=="function"){var E=g({state:h,name:x,instance:p,options:w}),f=function(){};u.push(E||f)}})}function v(){u.forEach(function(b){return b()}),u=[]}return p}}var Yn=[Qs,yn,qs,Bs,gn,dn,Cn,js,pn],Ln=Xn({defaultModifiers:Yn});const Mn='<svg class="ci360-navigate-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6"/></svg>';class On{constructor(t,i,o,s={}){Ie(this,"updateHotspotPosition",(t,i)=>{this.currentActiveIndex=t,this.currentOrientation=i;const o=vs(this.hotspotsConfig,t,i);this.hideHotspots(),o.forEach(s=>this.updateAndShowHotspot(s,t))});this.container=i,this.popper=null,this.popperInstance=null,this.hotspotsContainer=ko(this.container),this.hotspotsConfig=Is(t),this.shouldHidePopper=!0,this.hidePopper=this.hidePopper.bind(this),this.forceHidePopper=this.forceHidePopper.bind(this),this.imageAspectRatio=o,this.popperListeners=[],this.trigger=s.trigger||"hover",this.onOpen=s.onOpen||null,this.onClose=s.onClose||null,this.onProductClick=s.onProductClick||null,this.onNavigate=s.onNavigate||null;const{containerSize:n}=t[0];this.initialContainerSize=n||[i.offsetWidth,i.offsetHeight],this.initHotspots(),this.updateHotspotsForResize(i.offsetWidth,i.offsetHeight),this.observeContainerResize()}observeContainerResize(){this.resizeObserver=new ResizeObserver(()=>{const t=this.container.offsetWidth,i=this.container.offsetHeight;this.updateHotspotsForResize(t,i)}),this.resizeObserver.observe(this.container)}updateHotspotsForResize(t,i){this.hotspotsConfig=xs({newWidth:t,newHeight:i,initialContainerSize:this.initialContainerSize,imageAspectRatio:this.imageAspectRatio,hotspotsConfig:this.hotspotsConfig}),this.updateHotspotPosition(this.currentActiveIndex,this.currentOrientation)}cleanupPopperListeners(){this.popperListeners.forEach(({element:t,event:i,handler:o})=>{t.removeEventListener(i,o)}),this.popperListeners=[]}showPopper({hotspotElement:t,content:i,id:o,keepOpen:s}){var u;this.popperInstance&&this.hidePopper();const n=ws(this.container);this.popper=Cs(i,o,this.container.parentElement),this.currentHotspotElement=t,t.setAttribute("aria-expanded","true"),t.setAttribute("aria-describedby",`cloudimage-360-popper-${o}`);const r=()=>{this.shouldHidePopper=!1},a=()=>{this.shouldHidePopper=!0,this.checkAndHidePopper()},l=()=>{this.shouldHidePopper=!0,this.checkAndHidePopper()},c=()=>{this.shouldHidePopper=!1,this.hidePopperTimeout&&clearTimeout(this.hidePopperTimeout)};if(this.popper.addEventListener("mouseenter",r),this.popper.addEventListener("mouseleave",a),t.addEventListener("mouseleave",l),t.addEventListener("mouseenter",c),this.popperListeners.push({element:this.popper,event:"mouseenter",handler:r},{element:this.popper,event:"mouseleave",handler:a},{element:t,event:"mouseleave",handler:l},{element:t,event:"mouseenter",handler:c}),this.onProductClick){const m=this.onProductClick,p=C=>{const v=C.target.closest(".ci360-popper-cta");v&&m(v.dataset.productId??"",o)};this.popper.addEventListener("click",p),this.popperListeners.push({element:this.popper,event:"click",handler:p})}const h=Ln(t,this.popper,n);h.forceUpdate(),this.popper.setAttribute("data-show",""),this.shouldHidePopper=!1,this.popperInstance={...h,keepOpen:s,instanceId:o};try{(u=this.onOpen)==null||u.call(this,o)}catch(m){console.warn("onHotspotOpen callback error:",m)}}checkAndHidePopper(){var t;this.shouldHidePopper&&!((t=this.popperInstance)!=null&&t.keepOpen)&&(this.hidePopperTimeout&&clearTimeout(this.hidePopperTimeout),this.hidePopperTimeout=setTimeout(()=>{this.shouldHidePopper&&this.hidePopper()},io))}hidePopper(){var o,s;this.hidePopperTimeout&&(clearTimeout(this.hidePopperTimeout),this.hidePopperTimeout=null);const t=(o=this.popperInstance)==null?void 0:o.instanceId;this.cleanupPopperListeners(),this.currentHotspotElement&&(this.currentHotspotElement.setAttribute("aria-expanded","false"),this.currentHotspotElement.removeAttribute("aria-describedby"),this.currentHotspotElement=null);const i=this.popperInstance;if(this.popperInstance=null,t!=null)try{(s=this.onClose)==null||s.call(this,t)}catch(n){console.warn("onHotspotClose callback error:",n)}if(this.popper){this.popper.removeAttribute("data-show"),this.popper.setAttribute("aria-hidden","true");const n=this.popper;this.popper=null,setTimeout(()=>{i==null||i.destroy(),n.remove()},oo)}else i==null||i.destroy();this.shouldHidePopper=!0}forceHidePopper(){this.shouldHidePopper=!0,this.popperInstance&&(this.popperInstance.keepOpen=!1),this.hidePopper()}createHotspot(t){const{id:i,keepOpen:o,onClick:s,label:n,markerStyle:r,navigateTo:a}=t,l=typeof a=="string"?a.trim():void 0,c=de(t),h=ys(i,n,r);if(l){h.classList.add("cloudimage-360-hotspot--navigate"),h.innerHTML=Mn;const u=n||l;h.setAttribute("role","button"),h.setAttribute("aria-label",`Navigate to ${u}`),h.setAttribute("aria-roledescription","navigation hotspot"),h.style.cursor="pointer";const m=c||(n?de({data:{title:n}}):"");m?(h.setAttribute("aria-haspopup","true"),h.addEventListener("mouseenter",()=>this.showPopper({hotspotElement:h,content:m,id:i,keepOpen:!1})),h.addEventListener("mouseleave",()=>{this.shouldHidePopper=!0,this.checkAndHidePopper()}),h.addEventListener("focus",()=>this.showPopper({hotspotElement:h,content:m,id:i,keepOpen:!1})),h.addEventListener("blur",()=>{this.shouldHidePopper=!0,this.checkAndHidePopper()})):(h.removeAttribute("aria-haspopup"),h.removeAttribute("aria-expanded"));const p=()=>{this.hidePopper(),this.onNavigate?this.onNavigate(l):console.warn(`[ci360] navigateTo hotspot "${i}" clicked but no onNavigate callback is configured.`)};h.onclick=C=>{C.stopPropagation(),p()},h.addEventListener("keydown",C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),p())}),this.hotspotsContainer.appendChild(h);return}(s||c&&this.trigger==="click")&&(h.style.cursor="pointer"),h.onclick=u=>{var m;u.stopPropagation(),c&&this.trigger==="click"&&(((m=this.popperInstance)==null?void 0:m.instanceId)===i?this.hidePopper():this.showPopper({hotspotElement:h,content:c,id:i,keepOpen:o})),s==null||s(u,this.popperInstance,i)},c&&this.trigger==="hover"&&(h.addEventListener("mouseenter",()=>this.showPopper({hotspotElement:h,content:c,id:i,keepOpen:o})),h.addEventListener("mouseleave",()=>{this.shouldHidePopper=!0,this.checkAndHidePopper()}),h.addEventListener("focus",()=>this.showPopper({hotspotElement:h,content:c,id:i,keepOpen:o})),h.addEventListener("blur",()=>{this.shouldHidePopper=!0,this.checkAndHidePopper()})),this.hotspotsContainer.appendChild(h)}hideHotspots(){this.hotspotsContainer.querySelectorAll(".cloudimage-360-hotspot").forEach(t=>{t.style.opacity=0,t.style.pointerEvents="none"})}updateAndShowHotspot(t,i){const{positions:o,id:s}=t,{x:n,y:r}=o[i]??{},a=this.hotspotsContainer.querySelector(`[data-hotspot-id="${s}"]`);a&&(a.style.translate=`${n}px ${r}px`,a.style.opacity=1,a.style.pointerEvents="all")}showHotspotById(t){const i=this.hotspotsConfig.find(n=>n.id===t);if(!i||i.navigateTo)return;const o=de(i);if(!o)return;const s=this.hotspotsContainer.querySelector(`[data-hotspot-id="${t}"]`);s&&s.style.opacity==="1"&&this.showPopper({hotspotElement:s,content:o,id:t,keepOpen:i.keepOpen})}createAllHotspots(){this.hotspotsConfig.forEach(t=>this.createHotspot(t))}initHotspots(){this.createAllHotspots()}destroy(){this.hidePopperTimeout&&clearTimeout(this.hidePopperTimeout),this.resizeObserver.disconnect(),this.hidePopper(),this.hotspotsContainer.innerHTML=""}}const Qe=typeof navigator<"u"&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);class ti{constructor(t,i){this.container=t,this.isClicked=!1,this.imagesX=[],this.imagesY=[],this.imagesGrid=[],this.isGridMode=!1;const o=Math.round(window.devicePixelRatio||1);this.devicePixelRatio=Qe?Math.min(o,2):o,this.id=t.id,this.movementStart={x:0,y:0},this.draggingDirection=null,this.isReady=!1,this.velocityX=0,this.velocityY=0,this.lastDragTime=0,this.lastDragX=0,this.lastDragY=0,this.inertiaAnimationId=null,this.hasInteracted=!1,this.touchDevice=ts(),this.dragJustEnded=!1,this.zoomPan=null,this.gestureRecognizer=null,this.zoomControlsUI=null,this.scrollHintUI=null,this.highResLoaded=!1,this.useMainThreadCanvas=Qe,this.canvasWorker=this.useMainThreadCanvas?new us:new ds,this.hotspotTimeline=null,this.hotspotTimelineIndicator=null,this.isAnimatingToFrame=!1,this.onMoveHandler=this.onMoveHandler.bind(this),this.destroy=this.destroy.bind(this),this.init(this.container,i)}closeImageBitmaps(t){!t||!Array.isArray(t)||t.forEach(i=>{var o;(o=i==null?void 0:i.bitmapImage)!=null&&o.close&&i.bitmapImage.close()})}emit(t,i={}){const o=this[t];typeof o=="function"&&o({...i,viewerId:this.id})}announce(t){Xo(this.ariaLiveRegion,t)}mouseDown(t){if(!this.isReady)return;const i=t.target;if(i&&i.closest&&(i.closest(".cloudimage-360-button")||i.closest(".cloudimage-360-hotspot-timeline")||i.closest(".cloudimage-360-hotspot")||i.closest(".cloudimage-360-zoom-controls")))return;const{pageX:o,pageY:s}=t;if(this.hideHints(),this.hideHotspotPopper(),this.inertiaAnimationId&&(cancelAnimationFrame(this.inertiaAnimationId),this.inertiaAnimationId=null),this.autoplayJustStopped=!1,(this.autoplay||this.loopTimeoutId)&&(this.stopAutoplay(),this.autoplay=!1,this.autoplayJustStopped=!0),this.isZoomed&&this.zoomPan){this.zoomPan.startPan(o,s);return}this.movementStart={x:o,y:s},this.isClicked=!0,this.isDragging=!1,this.inertia&&(this.velocityX=0,this.velocityY=0,this.lastDragTime=performance.now(),this.lastDragX=o,this.lastDragY=s)}mouseUp(){this.isReady&&(!this.isZoomed&&!this.autoplayJustStopped&&this.showAllIcons(),this.inertia&&this.isDragging&&(Math.abs(this.velocityX)>.1||Math.abs(this.velocityY)>.1)&&this.startInertia(),this.isDragging&&(this.emit("onDragEnd"),this.dragJustEnded=!0),this.movementStart={x:0,y:0},this.isClicked=!1,this.isDragging=!1,this.innerBox.style.cursor="grab")}startInertia(){const o=this.dragSpeed/Ae,s=o*(this.amountX/this.container.offsetWidth),n=o*(this.amountY/this.container.offsetHeight),r=()=>{if(this.velocityX*=.95,this.velocityY*=.95,Math.abs(this.velocityX)<.01&&Math.abs(this.velocityY)<.01){this.inertiaAnimationId=null;return}const a=this.velocityX*16,l=this.velocityY*16,c=Be({deltaX:a,deltaY:l,reversed:this.dragReverse,allowSpinX:this.allowSpinX,allowSpinY:this.allowSpinY});if(c){const h=this.allowSpinX?Math.max(1,Math.abs(Math.round(a*s))):0,u=this.allowSpinY?Math.max(1,Math.abs(Math.round(l*n))):0;(h>0||u>0)&&this.onMoveHandler(c,h,u)}this.inertiaAnimationId=requestAnimationFrame(r)};this.inertiaAnimationId=requestAnimationFrame(r)}drag(t,i){if(!this.isReady||!this.isClicked)return;const o=t-this.movementStart.x,s=i-this.movementStart.y;if(this.inertia){const u=performance.now(),m=u-this.lastDragTime;m>0&&m<100&&(this.velocityX=(t-this.lastDragX)/m,this.velocityY=(i-this.lastDragY)/m),this.lastDragTime=u,this.lastDragX=t,this.lastDragY=i}this.draggingDirection=Be({deltaX:o,deltaY:s,reversed:this.dragReverse,allowSpinX:this.allowSpinX,allowSpinY:this.allowSpinY})||this.draggingDirection;const n=this.dragSpeed/Ae,r=n*(this.amountX/this.container.offsetWidth),a=n*(this.amountY/this.container.offsetHeight),l=this.allowSpinX?Math.abs(Math.round(o*r)):0,c=this.allowSpinY?Math.abs(Math.round(s*a)):0;(this.allowSpinX&&l!==0||this.allowSpinY&&c!==0)&&(this.hasInteracted=!0,this.hideHotspotPopper(),this.onMoveHandler(this.draggingDirection,l,c),this.movementStart={x:t,y:i},setTimeout(()=>{this.isDragging||(this.isDragging=!0,this.emit("onDragStart"))},eo))}mouseMove(t){!this.isReady||!this.isClicked||this.isZoomed||(this.hideAllIcons(),this.drag(t.pageX,t.pageY))}mouseClick(){this.dragJustEnded=!1,this.autoplayJustStopped=!1}loadHigherQualityImages(t,i){if(this.isGridMode){const n=at(this.srcGridConfig,t);Xe({cdnPath:n,config:this.srcGridConfig,onAllImagesLoad:r=>{this.closeImageBitmaps(this.imagesGrid),this.imagesGrid=r,i()},onError:r=>this.emit("onError",r)});return}const o=at(this.srcXConfig,t),s=this.allowSpinY?at(this.srcYConfig,t):null;Se({cdnPathX:o,cdnPathY:s,configX:this.srcXConfig,configY:this.srcYConfig,onAllImagesLoad:(n,r)=>{this.closeImageBitmaps(this.imagesX),this.closeImageBitmaps(this.imagesY),this.imagesX=n,this.imagesY=r,i()},onError:n=>this.emit("onError",n)})}hideHotspots(){this.hotspotsInstance&&this.hotspotsInstance.hideHotspots()}hideHotspotPopper(){this.hotspotsInstance&&this.hotspotsInstance.forceHidePopper()}getDrawDimensions(){if(!this.canvas||!this.imageAspectRatio)return null;const t=this.canvas.clientWidth,i=t/this.imageAspectRatio,o=t/i;return this.imageAspectRatio>o?{drawWidth:t,drawHeight:t/this.imageAspectRatio}:{drawWidth:i*this.imageAspectRatio,drawHeight:i}}initZoom(){const t=this.zoomMax||5,i=this.zoomStep||.5;this.zoomPan=new ss(this.innerBox,{zoomMax:t,zoomStep:i,onZoomChange:(s,n,r)=>this.onZoomChange(s,n,r)});const o=this.getDrawDimensions();o&&this.zoomPan.setDrawSize(o.drawWidth,o.drawHeight),this.touchDevice&&this.pinchZoom!==!1&&(this.gestureRecognizer=new ns(this.innerBox,{zoomMax:t,getZoom:()=>this.zoomPan?this.zoomPan.getZoom():1,onPinchZoom:(s,n,r)=>{this.zoomPan&&(n!==void 0?this.zoomPan.zoomTowardPoint(s,n,r):this.zoomPan.applyTouchZoom(s))},onPan:(s,n)=>{this.zoomPan&&this.zoomPan.applyTouchPan(s,n)},onDoubleTap:(s,n)=>{this.zoomPan&&(this.zoomPan.isZoomed()?this.zoomPan.resetZoom():this.zoomPan.zoomTowardPoint(2,s,n))}})),this.zoomControls&&!this.touchDevice&&(this.zoomControlsUI=hs(this.innerBox,{position:this.zoomControlsPosition||"bottom-left",zoomMax:t,onZoomIn:()=>this.zoomPan&&this.zoomPan.zoomIn(),onZoomOut:()=>this.zoomPan&&this.zoomPan.zoomOut(),onReset:()=>this.zoomPan&&this.zoomPan.resetZoom()}))}onZoomChange(t,i,o){this.inertiaAnimationId&&(cancelAnimationFrame(this.inertiaAnimationId),this.inertiaAnimationId=null);const s=this.isZoomed;if(this.isZoomed=t>1,this.isZoomed&&!s){if(this.hideAllIcons(),this.hideHotspots(),this.zoomControlsUI&&this.zoomControlsUI.show(),!this.highResLoaded){this.highResLoaded=!0;const n=document.body.offsetWidth;this.loadHigherQualityImages(n,()=>{this.zoomPan&&this.updateView(this.zoomPan.getZoom(),this.zoomPan.panX,this.zoomPan.panY)})}this.emit("onZoomIn",{zoomLevel:t}),this.announce("Zoomed in. Use mouse drag or arrow keys to pan. Double-click or press 0 to reset.")}!this.isZoomed&&s&&(this.showAllIcons(),this.emit("onZoomOut"),this.announce("Zoomed out")),this.zoomControlsUI&&this.zoomControlsUI.updateState(t),this.updateView(t,i,o)}removeZoom(){this.zoomPan&&this.zoomPan.resetZoom()}toggleZoom(){this.zoomPan&&(this.isZoomed?this.zoomPan.resetZoom():this.zoomPan.setZoom(2))}touchStart(t){if(!this.isReady||!t.touches||!t.touches.length)return;const i=t.target;if(i&&i.closest&&(i.closest(".cloudimage-360-button")||i.closest(".cloudimage-360-hotspot-timeline")||i.closest(".cloudimage-360-hotspot")||i.closest(".cloudimage-360-zoom-controls")))return;if(this.hideHints(),t.touches.length>1){this.isClicked=!1;return}if(this.isZoomed)return;const{pageX:o,pageY:s}=t.touches[0];this.inertiaAnimationId&&(cancelAnimationFrame(this.inertiaAnimationId),this.inertiaAnimationId=null),(this.autoplay||this.loopTimeoutId)&&(this.stopAutoplay(),this.autoplay=!1),this.hideAllIcons(),this.hideHotspotPopper(),this.movementStart={x:o,y:s},this.isClicked=!0,this.isDragging=!1,this.inertia&&(this.velocityX=0,this.velocityY=0,this.lastDragTime=performance.now(),this.lastDragX=o,this.lastDragY=s)}touchEnd(t){this.isReady&&(this.isZoomed||this.showAllIcons(),this.inertia&&this.isDragging&&(Math.abs(this.velocityX)>.1||Math.abs(this.velocityY)>.1)&&this.startInertia(),this.movementStart={x:0,y:0},this.isClicked=!1,this.isDragging=!1)}touchMove(t){if(!this.isReady||this.isZoomed||t.touches&&t.touches.length>1||!this.isClicked||!t.touches||!t.touches[0])return;const{pageX:i,pageY:o}=t.touches[0];t.preventDefault(),this.drag(i,o)}keyDown(t){if(!this.isReady)return;const i=t.target&&t.target.tagName;if(i==="INPUT"||i==="TEXTAREA"||t.target&&t.target.isContentEditable)return;const{keyCode:o}=t,s=this.keysReverse;if(this.autoplay&&this.stopAutoplay(),this.zoomPan&&this.zoomPan.handleKeyZoom(o)){t.preventDefault(),this.hideHints();return}if(this.isZoomed&&this.zoomPan&&this.zoomPan.handleKeyPan(o,no)){t.preventDefault();return}switch(De(o,this.allowSpinY)&&(this.hasInteracted=!0,this.hideAllIcons(),this.hideHints()),o){case 37:s?this.moveLeft():this.moveRight();break;case 39:s?this.moveRight():this.moveLeft();break;case 38:this.allowSpinY&&(t.preventDefault(),s?this.moveTop():this.moveBottom());break;case 40:this.allowSpinY&&(t.preventDefault(),s?this.moveBottom():this.moveTop());break}}keyUp(t){const{keyCode:i}=t;De(i,this.allowSpinY)&&this.showAllIcons()}moveActiveXIndexUp(t){this.isGridMode||(this.orientation=L.X),this.activeImageX=(this.activeImageX+t)%this.amountX}moveActiveXIndexDown(t){this.isGridMode||(this.orientation=L.X),this.activeImageX=(this.activeImageX-t+this.amountX)%this.amountX}moveActiveYIndexUp(t){this.isGridMode||(this.orientation=L.Y),this.activeImageY=(this.activeImageY+t)%this.amountY}moveActiveYIndexDown(t){this.isGridMode||(this.orientation=L.Y),this.activeImageY=(this.activeImageY-t+this.amountY)%this.amountY}moveRight(t,i=1){const o=this.isGridMode?this.amountX-1:this.imagesX.length-1;t&&this.activeImageX>=o||(this.moveActiveXIndexUp(i),this.isZoomed||this.updateView())}moveLeft(t,i=1){t&&this.activeImageX<=0||(this.moveActiveXIndexDown(i),this.isZoomed||this.updateView())}moveTop(t,i=1){const o=this.isGridMode?this.amountY-1:this.imagesY.length-1;t&&this.activeImageY>=o||(this.moveActiveYIndexUp(i),this.isZoomed||this.updateView())}moveBottom(t,i=1){t&&this.activeImageY<=0||(this.moveActiveYIndexDown(i),this.isZoomed||this.updateView())}onMoveHandler(t,i=1,o=1){t==="right"?this.moveRight(this.stopAtEdgesX,i):t==="left"?this.moveLeft(this.stopAtEdgesX,i):t==="up"?this.moveTop(this.stopAtEdgesY,o):t==="down"&&this.moveBottom(this.stopAtEdgesY,o),this.emit("onSpin",{direction:t,activeImageX:this.activeImageX,activeImageY:this.activeImageY,amountX:this.amountX,amountY:this.amountY,isGridMode:this.isGridMode})}updateView(t,i,o){let s;if(this.isGridMode){const r=this.activeImageY*this.amountX+this.activeImageX;s=this.imagesGrid[r]}else s=this.orientation===L.X?this.imagesX[this.activeImageX]:this.imagesY[this.activeImageY];const n=this.isGridMode?this.activeImageY*this.amountX+this.activeImageX:this.orientation===L.X?this.activeImageX:this.activeImageY;this.hotspotsInstance&&!this.isZoomed&&!this.autoplay&&this.hotspotsInstance.updateHotspotPosition(n,this.isGridMode?"grid":this.orientation),this.hotspotTimelineIndicator&&(this.isGridMode||this.orientation===L.X)&&this.updateHotspotTimelinePosition(),this.drawImageOnCanvas(s,t,i,o)}updatePercentageInLoader(t=0){this.loader&&(this.loader.innerText=t+"%")}adaptCanvasSize(t){const{naturalWidth:i,naturalHeight:o}=t;this.imageAspectRatio=i/o;const s=this.canvas.clientWidth,n=s/this.imageAspectRatio;this.canvasWorker.postMessage({action:"adaptCanvasSize",devicePixelRatio:this.devicePixelRatio,imageAspectRatio:this.imageAspectRatio,containerWidth:s,containerHeight:n})}drawImageOnCanvas(t,i=1,o=0,s=0){this.pendingDrawData={imageData:t,zoomScale:i,pointerX:o,pointerY:s},this.drawFrameRequested||(this.drawFrameRequested=!0,requestAnimationFrame(()=>{if(this.drawFrameRequested=!1,this.pendingDrawData){const{imageData:n,zoomScale:r,pointerX:a,pointerY:l}=this.pendingDrawData;this.canvasWorker.postMessage({action:"drawImageOnCanvas",imageData:n,zoomScale:r,pointerX:a,pointerY:l})}}))}pushImageToSet(t,i,o){o==="grid"?this.imagesGrid[i]=t:o===L.X?this.imagesX[i]=t:this.imagesY[i]=t}calculatePercentage(){if(this.isGridMode){const o=this.amountX*this.amountY,s=this.imagesGrid.filter(Boolean).length;return Math.round(s/o*100)}const t=this.amountX+this.amountY,i=this.imagesX.filter(Boolean).length+this.imagesY.filter(Boolean).length;return Math.round(i/t*100)}onImageLoad(t,i,o){this.pushImageToSet(t,i,o),this.updatePercentageInLoader(this.calculatePercentage())}onFirstImageLoaded(t,i){this.createContainers(t),this.adaptCanvasSize(i),this.drawImageOnCanvas(i),this.setupResizeObserver()}setupResizeObserver(){if(this.resizeObserver||!this.container)return;let t=this.container.offsetWidth;this.resizeObserver=new ResizeObserver(i=>{const o=i[0];if(!o)return;const s=Math.round(o.contentRect.width);s===t||s===0||(t=s,requestAnimationFrame(()=>{let n;if(this.isGridMode?n=this.imagesGrid[this.activeImageY*this.amountX+this.activeImageX]:this.orientation===L.Y&&this.imagesY.length>0?n=this.imagesY[this.activeImageY]:n=this.imagesX[this.activeImageX],n){if(this.adaptCanvasSize(n),this.zoomPan){const r=this.getDrawDimensions();r&&this.zoomPan.setDrawSize(r.drawWidth,r.drawHeight,!0)}this.updateView()}}))}),this.resizeObserver.observe(this.container)}onAllImagesLoaded(){if(this.addAllIcons(),this.isReady=!0,this.isGridMode||(this.amountX=this.imagesX.length,this.amountY=this.imagesY.length),this.activeImageX=this.autoplayReverse?this.amountX-1:0,this.activeImageY=this.autoplayReverse?this.amountY-1:0,this.hotspots)if(this.hotspotsInstance=new On(this.hotspots,this.innerBox,this.imageAspectRatio,{trigger:this.hotspotTrigger,onOpen:this.onHotspotOpen,onClose:this.onHotspotClose,onProductClick:this.onProductClick,onNavigate:this.onNavigate}),this.addHotspotTimeline(),this.autoplay)this.hotspotsInstance.hideHotspots(),this.hideHotspotTimeline();else{const t=this.isGridMode?this.activeImageY*this.amountX+this.activeImageX:this.activeImageX,i=this.isGridMode?"grid":this.orientation;this.hotspotsInstance.updateHotspotPosition(t,i),this.showHotspotTimeline()}if(this.emit("onLoad",{imagesX:this.isGridMode?this.amountX:this.imagesX.length,imagesY:this.isGridMode?this.amountY:this.imagesY.length,...this.isGridMode&&{imagesGrid:this.imagesGrid.filter(Boolean).length}}),this.emit("onReady"),this.announce("360 degree view loaded. Use mouse drag or arrow keys to rotate."),this.hints!==!1&&!this.autoplay){const t=this.hints===!0||this.hints===void 0?Me(this.viewerConfig,this.touchDevice):this.hints;t&&t.length>0&&(this.hintsOverlay=Le(this.innerBox,t),Oe(this.hintsOverlay))}this.autoplay&&(this.hideAllIcons(),es(this.play.bind(this))())}toggleFullscreen(t){t.stopPropagation(),this.hideHotspotPopper(),ce()?Ge():os(this.container)}onFullscreenChange(){const t=ce()===this.container,i=this.container.classList.contains("cloudimage-360--fullscreen");t!==i&&(this.container.classList.toggle("cloudimage-360--fullscreen",t),Po(this.fullscreenIcon,t),t?(this.emit("onFullscreenOpen"),this.announce("Opened fullscreen mode. Press Escape to exit.")):(this.emit("onFullscreenClose"),this.announce("Exited fullscreen mode")))}play(){if(this.isClicked)return;this.hide360ViewCircleIcon(),this.emit("onAutoplayStart");let t;if(this.isGridMode){const s=this.autoplayBehavior;s==="spin-x"?t=this.amountX:s==="spin-y"?t=this.amountY:t=Math.max(this.amountX,this.amountY)}else t=this.amountX+this.amountY;const i=this.speed*36/t,o={left:this.moveLeft.bind(this),right:this.moveRight.bind(this),top:this.moveTop.bind(this),bottom:this.moveBottom.bind(this)};this.loopTimeoutId=window.setInterval(()=>{if(this.playOnce&&Ko({autoplayBehavior:this.autoplayBehavior,activeImageX:this.activeImageX,activeImageY:this.activeImageY,amountX:this.amountX,amountY:this.amountY,autoplayReverse:this.autoplayReverse,isGridMode:this.isGridMode})){this.stopAutoplay();return}if(this.isGridMode){this.gridAutoplayTick(o);return}qo({autoplayBehavior:this.autoplayBehavior,activeImageX:this.activeImageX,activeImageY:this.activeImageY,amountX:this.amountX,amountY:this.amountY,autoplayReverse:this.autoplayReverse,spinDirection:this.spinDirection})&&(this.spinDirection=Qo(this.spinDirection));const r=this.spinDirection==="y";$o({autoplayBehavior:this.autoplayBehavior,spinY:r,reversed:this.autoplayReverse,loopTriggers:o})},i)}gridAutoplayTick(t){const i=this.autoplayReverse,o=this.autoplayBehavior;if(o==="spin-x"){i?t.left():t.right();return}if(o==="spin-y"){i?t.bottom():t.top();return}if(o==="spin-xy"){const s=i?0:this.amountX-1,n=this.activeImageX===s;i?this.activeImageX=(this.activeImageX-1+this.amountX)%this.amountX:this.activeImageX=(this.activeImageX+1)%this.amountX,n&&(i?this.activeImageY=(this.activeImageY-1+this.amountY)%this.amountY:this.activeImageY=(this.activeImageY+1)%this.amountY),this.isZoomed||this.updateView(),this.emit("onSpin",{direction:i?"left":"right",activeImageX:this.activeImageX,activeImageY:this.activeImageY,amountX:this.amountX,amountY:this.amountY,isGridMode:!0});return}if(o==="spin-yx"){const s=i?0:this.amountY-1,n=this.activeImageY===s;i?this.activeImageY=(this.activeImageY-1+this.amountY)%this.amountY:this.activeImageY=(this.activeImageY+1)%this.amountY,n&&(i?this.activeImageX=(this.activeImageX-1+this.amountX)%this.amountX:this.activeImageX=(this.activeImageX+1)%this.amountX),this.isZoomed||this.updateView(),this.emit("onSpin",{direction:i?"down":"up",activeImageX:this.activeImageX,activeImageY:this.activeImageY,amountX:this.amountX,amountY:this.amountY,isGridMode:!0})}}stopAutoplay(){if(this.showAllIcons(),this.autoplay=!1,window.clearInterval(this.loopTimeoutId),this.loopTimeoutId=null,this.emit("onAutoplayStop"),this.hotspotsInstance){const t=this.isGridMode?this.activeImageY*this.amountX+this.activeImageX:this.activeImageX,i=this.isGridMode?"grid":this.orientation;this.hotspotsInstance.updateHotspotPosition(t,i),this.showHotspotTimeline()}if(this.hints!==!1&&!this.hintsOverlay&&!this.hintsHidden){const t=this.hints===!0?Me(this.viewerConfig,this.touchDevice):this.hints;t&&t.length>0&&(this.hintsOverlay=Le(this.innerBox,t),Oe(this.hintsOverlay))}}destroy(){this.stopAutoplay(),this.inertiaAnimationId&&(cancelAnimationFrame(this.inertiaAnimationId),this.inertiaAnimationId=null),this.removeEvents(),this.zoomPan&&(this.zoomPan.destroy(),this.zoomPan=null),this.gestureRecognizer&&(this.gestureRecognizer.destroy(),this.gestureRecognizer=null),this.zoomControlsUI&&(this.zoomControlsUI.destroy(),this.zoomControlsUI=null),this.scrollHintUI&&(this.scrollHintUI.destroy(),this.scrollHintUI=null),this.closeImageBitmaps(this.imagesX),this.closeImageBitmaps(this.imagesY),this.closeImageBitmaps(this.imagesGrid),this.imagesX=[],this.imagesY=[],this.imagesGrid=[],this.isGridMode=!1,this.isReady=!1,this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.canvasWorker&&(this.canvasWorker.terminate(),this.canvasWorker=null),this.hotspotsInstance&&this.hotspotsInstance.destroy(),this.hintsOverlay&&this.hintsOverlay.parentNode&&(this.hintsOverlay.parentNode.removeChild(this.hintsOverlay),this.hintsOverlay=null),this.hotspotTimeline&&this.hotspotTimeline.parentNode&&(this.hotspotTimeline.parentNode.removeChild(this.hotspotTimeline),this.hotspotTimeline=null,this.hotspotTimelineIndicator=null),this.innerBox&&this.innerBox.classList.remove("has-hotspot-timeline"),ce()===this.container&&Ge(),this.container&&(this.container.classList.remove("ci360-theme-dark","ci360-hotspot-marker-inverted","ci360-hotspot-marker-brand","cloudimage-360--fullscreen"),this.container.style.removeProperty("--ci360-hotspot-brand-color"),this.container.innerHTML="")}releaseMemory(){this.stopAutoplay(),this.closeImageBitmaps(this.imagesX),this.closeImageBitmaps(this.imagesY),this.closeImageBitmaps(this.imagesGrid),this.imagesX=[],this.imagesY=[],this.imagesGrid=[],this.isMemoryReleased=!0}reloadImages(){if(!this.isMemoryReleased)return;this.isMemoryReleased=!1;const t=this.container.offsetWidth;this.loadHigherQualityImages(t,()=>{this.updateView()})}addInitialIcon(){this.initialIcon||this.hide360Logo||(this.initialIcon=wo(this.logoSrc),this.innerBox.appendChild(this.initialIcon))}showInitialIcon(){!this.initialIcon||this.hasInteracted||(this.initialIcon.style.opacity=1)}hideInitialIcon(){this.initialIcon&&(this.initialIcon.style.opacity=0)}addFullscreenIcon(){!this.fullscreen||!is()||(this.fullscreenIcon=xo(),this.fullscreenIcon.onclick=this.toggleFullscreen.bind(this),this.iconsContainer.appendChild(this.fullscreenIcon))}showFullscreenIcon(){this.fullscreenIcon&&(this.fullscreenIcon.style.opacity=1)}hideFullscreenIcon(){this.fullscreenIcon&&(this.fullscreenIcon.style.opacity=0)}add360ViewCircleIcon(){this.view360CircleIcon||(this.view360CircleIcon=yo(this.bottomCircleOffset),this.innerBox.appendChild(this.view360CircleIcon))}show360ViewCircleIcon(){this.view360CircleIcon&&(this.view360CircleIcon.style.opacity=1)}hide360ViewCircleIcon(){this.view360CircleIcon&&(this.view360CircleIcon.style.opacity=0)}addLoadingSpinner(){this.loadingSpinner=Ao(),this.innerBox.appendChild(this.loadingSpinner)}showLoadingSpinner(){this.loadingSpinner&&(this.hideAllIcons(),this.loadingSpinner.style.opacity=1)}hideLoadingSpinner(){this.loadingSpinner&&(this.loadingSpinner.style.opacity=0)}hideHints(){!this.hintsOverlay||this.hintsHidden||(this.hintsHidden=!0,Mo(this.hintsOverlay))}addHotspotTimeline(){if(!this.hotspots||this.hotspotTimeline)return;const t=this.isGridMode?this.amountX*this.amountY:this.amountX,i=Zo(this.innerBox,t,this.hotspots);if(!i)return;this.hotspotTimeline=i.element,this.hotspotTimelineIndicator=i.indicator,this.innerBox.classList.add("has-hotspot-timeline"),this.hotspotTimeline.querySelectorAll(".cloudimage-360-hotspot-timeline-dot").forEach(s=>{s.addEventListener("click",n=>{n.stopPropagation(),this.hideAllIcons(),this.hideHints();const r=parseInt(s.getAttribute("data-frame"),10),a=s.getAttribute("data-hotspot-id");isNaN(r)||this.animateToFrame(r,a)})}),this.updateHotspotTimelinePosition()}showHotspotTimeline(){Do(this.hotspotTimeline)}hideHotspotTimeline(){Bo(this.hotspotTimeline)}updateHotspotTimelinePosition(){if(this.isGridMode){const t=this.activeImageY*this.amountX+this.activeImageX;He(this.hotspotTimelineIndicator,t,this.amountX*this.amountY)}else He(this.hotspotTimelineIndicator,this.activeImageX,this.amountX)}animateToFrame(t,i){this.hotspotsInstance&&this.hotspotsInstance.hidePopper();const o=this.isGridMode?this.activeImageY*this.amountX+this.activeImageX:this.activeImageX;if(this.isAnimatingToFrame||t===o){t===o&&i&&this.hotspotsInstance&&this.hotspotTimelineOnClick&&this.hotspotsInstance.showHotspotById(i);return}if(this.isAnimatingToFrame=!0,this.hasInteracted=!0,(this.autoplay||this.loopTimeoutId)&&(this.stopAutoplay(),this.autoplay=!1),this.inertiaAnimationId&&(cancelAnimationFrame(this.inertiaAnimationId),this.inertiaAnimationId=null),this.isGridMode){const m=this.amountX*this.amountY,p=Math.max(0,Math.min(t,m-1));this.activeImageY=Math.floor(p/this.amountX),this.activeImageX=p%this.amountX,this.isZoomed||this.updateView(),this.emit("onSpin",{direction:p>o?"right":"left",activeImageX:this.activeImageX,activeImageY:this.activeImageY,amountX:this.amountX,amountY:this.amountY,isGridMode:!0}),this.isAnimatingToFrame=!1,i&&this.hotspotsInstance&&this.hotspotTimelineOnClick&&setTimeout(()=>{this.hotspotsInstance.showHotspotById(i)},50);return}const s=this.activeImageX,n=(t-s+this.amountX)%this.amountX,r=(s-t+this.amountX)%this.amountX,a=n<=r,l=a?n:r;if(l===0){this.isAnimatingToFrame=!1;return}const c=30;let h=l;const u=()=>{if(h<=0){this.isAnimatingToFrame=!1,i&&this.hotspotsInstance&&this.hotspotTimelineOnClick&&setTimeout(()=>{this.hotspotsInstance.showHotspotById(i)},50);return}a?this.moveRight():this.moveLeft(),h--,h>0?setTimeout(u,c):(this.isAnimatingToFrame=!1,i&&this.hotspotsInstance&&this.hotspotTimelineOnClick&&setTimeout(()=>{this.hotspotsInstance.showHotspotById(i)},50))};u()}remove360ViewCircleIcon(){this.view360CircleIcon&&(this.innerBox.removeChild(this.view360CircleIcon),this.view360CircleIcon=null)}addAllIcons(){this.removeLoader(),this.iconsContainer&&(this.innerBox.style.cursor="grab",this.addLoadingSpinner(),this.addFullscreenIcon(),this.initialIconShown&&this.addInitialIcon(),this.bottomCircle&&this.add360ViewCircleIcon(),this.initZoom())}showAllIcons(){this.showInitialIcon(),this.show360ViewCircleIcon(),this.showFullscreenIcon(),this.showHotspotTimeline(),this.zoomControlsUI&&this.zoomControlsUI.show()}hideAllIcons(){this.hideInitialIcon(),this.hide360ViewCircleIcon(),this.hideFullscreenIcon(),this.zoomControlsUI&&this.zoomControlsUI.hide()}removeLoader(){this.loader&&(this.innerBox.removeChild(this.loader),this.loader=null)}attachEvents(t,i,o){t&&this.addMouseEvents(),i&&this.addTouchEvents(),o&&this.addKeyboardEvents(),this.addEscKeyHandler(),this.addFullscreenChangeHandler()}removeEvents(){this.removeMouseEvents(),this.removeTouchEvents(),this.removeKeyboardEvents(),this.removeEscKeyHandler(),this.removeFullscreenChangeHandler()}addMouseEvents(){this.boundMouseClick=this.mouseClick.bind(this),this.boundMouseDown=this.mouseDown.bind(this),this.boundMouseMove=Ee(this.mouseMove.bind(this),Te),this.boundMouseUp=this.mouseUp.bind(this),this.innerBox.addEventListener("click",this.boundMouseClick),this.innerBox.addEventListener("mousedown",this.boundMouseDown),document.addEventListener("mousemove",this.boundMouseMove),document.addEventListener("mouseup",this.boundMouseUp)}addTouchEvents(){this.boundTouchStart=this.touchStart.bind(this),this.boundTouchEnd=this.touchEnd.bind(this),this.boundTouchMove=Ee(this.touchMove.bind(this),Te),this.container.addEventListener("touchstart",this.boundTouchStart,{passive:!1}),this.container.addEventListener("touchend",this.boundTouchEnd),this.container.addEventListener("touchmove",this.boundTouchMove,{passive:!1})}addKeyboardEvents(){this.boundKeyDown=this.keyDown.bind(this),this.boundKeyUp=this.keyUp.bind(this),document.addEventListener("keydown",this.boundKeyDown),document.addEventListener("keyup",this.boundKeyUp)}addEscKeyHandler(){this.boundEscHandler=t=>{t.keyCode===27&&this.isZoomed&&this.removeZoom()},document.addEventListener("keydown",this.boundEscHandler)}removeEscKeyHandler(){document.removeEventListener("keydown",this.boundEscHandler)}addFullscreenChangeHandler(){this.boundFullscreenChange=this.onFullscreenChange.bind(this),document.addEventListener("fullscreenchange",this.boundFullscreenChange),document.addEventListener("webkitfullscreenchange",this.boundFullscreenChange)}removeFullscreenChangeHandler(){document.removeEventListener("fullscreenchange",this.boundFullscreenChange),document.removeEventListener("webkitfullscreenchange",this.boundFullscreenChange)}removeMouseEvents(){this.innerBox.removeEventListener("click",this.boundMouseClick),this.innerBox.removeEventListener("mousedown",this.boundMouseDown),document.removeEventListener("mousemove",this.boundMouseMove),document.removeEventListener("mouseup",this.boundMouseUp)}removeTouchEvents(){this.container.removeEventListener("touchstart",this.boundTouchStart),this.container.removeEventListener("touchend",this.boundTouchEnd),this.container.removeEventListener("touchmove",this.boundTouchMove)}removeKeyboardEvents(){document.removeEventListener("keydown",this.boundKeyDown),document.removeEventListener("keyup",this.boundKeyUp)}createContainers(t){if(this.iconsContainer=Ye(this.innerBox),this.canvas=Co(this.innerBox,t),this.loader=To(this.innerBox),this.ariaLiveRegion=So(this.innerBox),this.useMainThreadCanvas)this.canvasWorker.postMessage({action:"initCanvas",offscreen:this.canvas,devicePixelRatio:this.devicePixelRatio});else{const i=this.canvas.transferControlToOffscreen();this.canvasWorker.postMessage({action:"initCanvas",offscreen:i,devicePixelRatio:this.devicePixelRatio},[i])}ue(this.innerBox,".cloudimage-360-placeholder")}update(t){this.isReady&&(this.stopAutoplay(),this.zoomPan&&(this.zoomPan.destroy(),this.zoomPan=null),this.gestureRecognizer&&(this.gestureRecognizer.destroy(),this.gestureRecognizer=null),this.zoomControlsUI&&(this.zoomControlsUI.destroy(),this.zoomControlsUI=null),this.scrollHintUI&&(this.scrollHintUI.destroy(),this.scrollHintUI=null),this.isZoomed=!1,this.highResLoaded=!1,this.hotspotsInstance&&(this.hotspotsInstance.destroy(),this.hotspotsInstance=null),this.hotspotTimeline&&this.hotspotTimeline.parentNode&&(this.hotspotTimeline.parentNode.removeChild(this.hotspotTimeline),this.hotspotTimeline=null,this.hotspotTimelineIndicator=null),this.innerBox&&this.innerBox.classList.remove("has-hotspot-timeline"),this.hintsOverlay&&this.hintsOverlay.parentNode&&(this.hintsOverlay.parentNode.removeChild(this.hintsOverlay),this.hintsOverlay=null),this.hintsHidden=!1,ue(this.innerBox,".cloudimage-360-icons-container"),this.init(this.container,t,!0),this.iconsContainer=Ye(this.innerBox),this.onAllImagesLoaded())}init(t,i,o){const s=i?lo(i):ro(t),{folder:n,apiVersion:r,filenameX:a,filenameY:l,filenameGrid:c,imageListX:h,imageListY:u,imageListGrid:m,indexZeroBase:p,amountX:C,amountY:v,draggable:b=!0,swipeable:x=!0,keys:P,keysReverse:w,bottomCircleOffset:g,autoplay:E,autoplayBehavior:f,playOnce:y,speed:I,autoplayReverse:T,fullscreen:k,magnifier:S,pointerZoom:O,zoomMax:M,zoomStep:U,zoomControls:$,zoomControlsPosition:H,scrollHint:Z,ciToken:ct,ciFilters:K,ciTransformation:dt,lazyload:ut,dragSpeed:st,stopAtEdges:et,stopAtEdgesX:it,stopAtEdgesY:W,imageInfo:nt="black",initialIconShown:pt,bottomCircle:q,hotspots:wt,hotspotTrigger:te="hover",dragReverse:Ct,hide360Logo:ee,logoSrc:Ot,inertia:ie,pinchZoom:oe,hints:Ht,theme:It,markerTheme:Rt,brandColor:zt,hotspotTimelineOnClick:J=!0,aspectRatio:mt,cropAspectRatio:Zt,cropGravity:Dt,onReady:xt,onLoad:Bt,onSpin:Gt,onAutoplayStart:_t,onAutoplayStop:Ft,onFullscreenOpen:gi,onFullscreenClose:vi,onZoomIn:yi,onZoomOut:bi,onDragStart:wi,onDragEnd:Ci,onHotspotOpen:Ii,onHotspotClose:xi,onProductClick:Pi,onNavigate:Ei,onError:Ti}=s,se={ciToken:ct,ciFilters:K,ciTransformation:dt,cropAspectRatio:Zt,cropGravity:Dt},ne=Ut(h,[]),re=Ut(u,[]);let rt=Ut(m,[]);rt.length&&Array.isArray(rt[0])&&(rt=rt.flat()),this.isGridMode=!!(c||rt.length);const Ai=s.zoomMax===5&&O>1?Math.min(O,5):M||5;if(this.viewerConfig=s,this.amountX=ne.length||C,this.amountY=re.length||v,this.allowSpinX=!!this.amountX,this.allowSpinY=!!this.amountY,this.isGridMode&&(this.allowSpinX=!0,this.allowSpinY=!0),this.orientation=this.allowSpinX?L.X:L.Y,this.activeImageX=T?this.amountX-1:0,this.activeImageY=T?this.amountY-1:0,this.bottomCircleOffset=g,this.autoplay=E,this.autoplayBehavior=f,this.playOnce=y,this.speed=I,this.autoplayReverse=T,this.fullscreen=k,this.zoomMax=Ai,this.zoomStep=U||.5,this.zoomControls=$??!0,this.zoomControlsPosition=H||"bottom-left",this.scrollHint=Z??!0,this.dragSpeed=Math.max(st,so),this.stopAtEdges=et,this.stopAtEdgesX=it??et,this.stopAtEdgesY=W??et,this.ciParams=se,this.apiVersion=r,this.keysReverse=w,this.info=nt,this.keys=P,this.innerBox=this.innerBox??Eo(this.container),this.container.style.aspectRatio=mt||"",this.initialIconShown=pt,this.bottomCircle=q,this.spinDirection=Jo(this.autoplayBehavior,this.allowSpinX,this.allowSpinY),this.dragReverse=Ct,this.hotspots=wt,this.hotspotTrigger=te,this.onHotspotOpen=Ii,this.onHotspotClose=xi,this.onProductClick=Pi,this.onNavigate=Ei,this.hide360Logo=ee,this.logoSrc=Ot,this.inertia=ie,this.pinchZoom=oe,this.hints=Ht,this.hotspotTimelineOnClick=J,It==="dark"?this.container.classList.add("ci360-theme-dark"):It==="light"&&this.container.classList.remove("ci360-theme-dark"),this.container.classList.remove("ci360-hotspot-marker-inverted","ci360-hotspot-marker-brand"),Rt==="inverted"?this.container.classList.add("ci360-hotspot-marker-inverted"):Rt==="brand"&&(this.container.classList.add("ci360-hotspot-marker-brand"),zt&&this.container.style.setProperty("--ci360-hotspot-brand-color",zt)),this.onReady=xt,this.onLoad=Bt,this.onSpin=Gt,this.onAutoplayStart=_t,this.onAutoplayStop=Ft,this.onFullscreenOpen=gi,this.onFullscreenClose=vi,this.onZoomIn=yi,this.onZoomOut=bi,this.onDragStart=wi,this.onDragEnd=Ci,this.onError=Ti,this.srcXConfig={folder:n,filename:a,imageList:ne,container:t,innerBox:this.innerBox,apiVersion:r,ciParams:se,lazyload:ut,amount:this.amountX,indexZeroBase:p,autoplayReverse:T,orientation:L.X},this.srcYConfig={...this.srcXConfig,filename:l,imageList:re,orientation:L.Y,amount:this.amountY},this.srcGridConfig={folder:n,filename:c,imageList:rt,container:t,innerBox:this.innerBox,apiVersion:r,ciParams:se,lazyload:ut,amount:this.amountX*this.amountY,amountX:this.amountX,amountY:this.amountY,indexZeroBase:p,autoplayReverse:T},o&&this.removeEvents(),this.attachEvents(b,x,P),o)return;const ae=this.container.offsetWidth;if(this.isGridMode){const Pt=rt.length?null:at(this.srcGridConfig,ae),Nt=Wt=>{Xe({cdnPath:Pt,config:this.srcGridConfig,onImageLoad:(Q,B)=>{this.pushImageToSet(Q,B,"grid"),this.updatePercentageInLoader(this.calculatePercentage())},onFirstImageLoad:Q=>this.onFirstImageLoaded(Wt,Q),onAllImagesLoad:(Q,B)=>{this.imagesGrid=Q,B&&B.errorCount>0&&this.emit("onError",{errorCount:B.errorCount,errors:B.errors,totalImages:this.amountX*this.amountY}),this.onAllImagesLoaded()},onError:Q=>this.emit("onError",Q)})};he(Pt,this.srcGridConfig,Nt)}else{const Pt=this.allowSpinX&&!ne.length?at(this.srcXConfig,ae):null,Nt=this.allowSpinY&&!re.length?at(this.srcYConfig,ae):null,Wt=Q=>{Se({cdnPathX:Pt,cdnPathY:Nt,configX:this.srcXConfig,configY:this.srcYConfig,onImageLoad:(B,ki,Si)=>this.onImageLoad(B,ki,Si),onFirstImageLoad:B=>this.onFirstImageLoaded(Q,B),onAllImagesLoad:this.onAllImagesLoaded.bind(this),onError:B=>this.emit("onError",B)})};this.allowSpinX?he(Pt,this.srcXConfig,Wt):this.allowSpinY&&he(Nt,this.srcYConfig,Wt)}}}const ei=typeof navigator<"u"&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);class Hn{constructor(){this.views=new Map,this.initAll=this.initAll.bind(this),this.getViews=this.getViews.bind(this),this.memoryObserver=null,this.memoryManagementAutoEnabled=!1}generateId(){return`ci360-${Math.random().toString(36).slice(2,11)}`}init(t,i){if(!t)return;const o=t.id||this.generateId();t.id||(t.id=o);const s=new ti(t,i);return this.views.set(o,s),ei&&!this.memoryManagementAutoEnabled&&(this.memoryManagementAutoEnabled=!0,setTimeout(()=>this.enableMemoryManagement(),100)),s}initAll(t="cloudimage-360"){[...document.querySelectorAll(`.${t}`)].filter(Boolean).forEach(o=>{const s=o.id||this.generateId();o.id||(o.id=s);const n=new ti(o);this.views.set(s,n)}),ei&&!this.memoryManagementAutoEnabled&&this.views.size>0&&(this.memoryManagementAutoEnabled=!0,setTimeout(()=>this.enableMemoryManagement(),100))}destroy(t){const i=this.getViewById(t);i&&(i.destroy(),this.views.delete(t))}destroyAll(){this.views.forEach(t=>{t.destroy()}),this.views.clear()}getViewById(t){return this.views.get(t)}getViews(){return Array.from(this.views.values())}updateView(t,i){const o=this.getViewById(t);if(!o)return null;const s={...o.viewerConfig,...i};o.destroy();const n=document.getElementById(t);return this.init(n,s)}enableMemoryManagement(t={}){this.memoryObserver&&this.memoryObserver.disconnect();const i=t.rootMargin||"200px";this.memoryObserver=new IntersectionObserver(o=>{o.forEach(s=>{const n=this.getViewById(s.target.id);n&&(s.isIntersecting?n.isMemoryReleased&&n.reloadImages():!n.isMemoryReleased&&n.isReady&&n.releaseMemory())})},{rootMargin:i}),this.views.forEach((o,s)=>{const n=document.getElementById(s);n&&this.memoryObserver.observe(n)}),this.boundVisibilityHandler=()=>{document.hidden?this.views.forEach(o=>{!o.isMemoryReleased&&o.isReady&&o.releaseMemory()}):this.views.forEach((o,s)=>{if(o.isMemoryReleased){const n=document.getElementById(s);if(n){const r=n.getBoundingClientRect();r.top<window.innerHeight&&r.bottom>0&&o.reloadImages()}}})},document.addEventListener("visibilitychange",this.boundVisibilityHandler)}disableMemoryManagement(){this.memoryObserver&&(this.memoryObserver.disconnect(),this.memoryObserver=null),this.boundVisibilityHandler&&(document.removeEventListener("visibilitychange",this.boundVisibilityHandler),this.boundVisibilityHandler=null)}}exports.default=Hn;
65
+ //# sourceMappingURL=ci360-B2r9u7br.js.map