vistaview 0.7.8 → 0.10.10

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.
Files changed (164) hide show
  1. package/README.md +276 -97
  2. package/dist/extensions/dailymotion-video.d.ts +2 -0
  3. package/dist/extensions/dailymotion-video.js +80 -0
  4. package/dist/extensions/dailymotion-video.umd.js +1 -0
  5. package/dist/extensions/download.d.ts +2 -0
  6. package/dist/extensions/download.js +35 -0
  7. package/dist/extensions/download.umd.js +1 -0
  8. package/dist/extensions/google-maps.d.ts +2 -0
  9. package/dist/extensions/google-maps.js +94 -0
  10. package/dist/extensions/google-maps.umd.js +1 -0
  11. package/dist/extensions/image-story.d.ts +2 -0
  12. package/dist/extensions/image-story.js +621 -0
  13. package/dist/extensions/image-story.umd.js +2 -0
  14. package/dist/extensions/logger.d.ts +2 -0
  15. package/dist/extensions/logger.js +23 -0
  16. package/dist/extensions/logger.umd.js +1 -0
  17. package/dist/extensions/mapbox.d.ts +2 -0
  18. package/dist/extensions/mapbox.js +124 -0
  19. package/dist/extensions/mapbox.umd.js +1 -0
  20. package/dist/extensions/openstreetmap.d.ts +2 -0
  21. package/dist/extensions/openstreetmap.js +125 -0
  22. package/dist/extensions/openstreetmap.umd.js +1 -0
  23. package/dist/extensions/streamable-video.d.ts +2 -0
  24. package/dist/extensions/streamable-video.js +76 -0
  25. package/dist/extensions/streamable-video.umd.js +1 -0
  26. package/dist/extensions/vidyard-video.d.ts +2 -0
  27. package/dist/extensions/vidyard-video.js +80 -0
  28. package/dist/extensions/vidyard-video.umd.js +1 -0
  29. package/dist/extensions/vimeo-video.d.ts +2 -0
  30. package/dist/extensions/vimeo-video.js +76 -0
  31. package/dist/extensions/vimeo-video.umd.js +1 -0
  32. package/dist/extensions/wistia-video.d.ts +2 -0
  33. package/dist/extensions/wistia-video.js +85 -0
  34. package/dist/extensions/wistia-video.umd.js +1 -0
  35. package/dist/extensions/youtube-video.d.ts +2 -0
  36. package/dist/extensions/youtube-video.js +88 -0
  37. package/dist/extensions/youtube-video.umd.js +1 -0
  38. package/dist/lib/components.d.ts +1 -3
  39. package/dist/lib/components.d.ts.map +1 -1
  40. package/dist/lib/defaults/image-setup.d.ts +3 -0
  41. package/dist/lib/defaults/image-setup.d.ts.map +1 -0
  42. package/dist/lib/defaults/init.d.ts.map +1 -1
  43. package/dist/lib/defaults/open.d.ts +3 -0
  44. package/dist/lib/defaults/open.d.ts.map +1 -0
  45. package/dist/lib/defaults/options.d.ts.map +1 -1
  46. package/dist/lib/defaults/transition.d.ts +1 -1
  47. package/dist/lib/defaults/transition.d.ts.map +1 -1
  48. package/dist/lib/extensions/dailymotion-video.d.ts +34 -0
  49. package/dist/lib/extensions/dailymotion-video.d.ts.map +1 -0
  50. package/dist/lib/extensions/download.d.ts +3 -0
  51. package/dist/lib/extensions/download.d.ts.map +1 -0
  52. package/dist/lib/extensions/google-maps.d.ts +49 -0
  53. package/dist/lib/extensions/google-maps.d.ts.map +1 -0
  54. package/dist/lib/extensions/image-story.d.ts +12 -0
  55. package/dist/lib/extensions/image-story.d.ts.map +1 -0
  56. package/dist/lib/extensions/logger.d.ts +3 -0
  57. package/dist/lib/extensions/logger.d.ts.map +1 -0
  58. package/dist/lib/extensions/mapbox.d.ts +53 -0
  59. package/dist/lib/extensions/mapbox.d.ts.map +1 -0
  60. package/dist/lib/extensions/openstreetmap.d.ts +51 -0
  61. package/dist/lib/extensions/openstreetmap.d.ts.map +1 -0
  62. package/dist/lib/extensions/streamable-video.d.ts +32 -0
  63. package/dist/lib/extensions/streamable-video.d.ts.map +1 -0
  64. package/dist/lib/extensions/vidyard-video.d.ts +33 -0
  65. package/dist/lib/extensions/vidyard-video.d.ts.map +1 -0
  66. package/dist/lib/extensions/vimeo-video.d.ts +36 -0
  67. package/dist/lib/extensions/vimeo-video.d.ts.map +1 -0
  68. package/dist/lib/extensions/wistia-video.d.ts +34 -0
  69. package/dist/lib/extensions/wistia-video.d.ts.map +1 -0
  70. package/dist/lib/extensions/youtube-video.d.ts +38 -0
  71. package/dist/lib/extensions/youtube-video.d.ts.map +1 -0
  72. package/dist/lib/main.d.ts +2 -2
  73. package/dist/lib/main.d.ts.map +1 -1
  74. package/dist/lib/types.d.ts +134 -42
  75. package/dist/lib/types.d.ts.map +1 -1
  76. package/dist/lib/utils/get-fitted-size.d.ts +5 -0
  77. package/dist/lib/utils/get-fitted-size.d.ts.map +1 -0
  78. package/dist/lib/utils/get-full-size-dim.d.ts +5 -0
  79. package/dist/lib/utils/get-full-size-dim.d.ts.map +1 -0
  80. package/dist/lib/utils/get-style.d.ts +5 -0
  81. package/dist/lib/utils/get-style.d.ts.map +1 -0
  82. package/dist/lib/utils/index.d.ts +3 -0
  83. package/dist/lib/utils/index.d.ts.map +1 -0
  84. package/dist/lib/utils/is-not-zero-css.d.ts +2 -0
  85. package/dist/lib/utils/is-not-zero-css.d.ts.map +1 -0
  86. package/dist/lib/utils/parse-element.d.ts +3 -0
  87. package/dist/lib/utils/parse-element.d.ts.map +1 -0
  88. package/dist/lib/vista-box.d.ts +107 -0
  89. package/dist/lib/vista-box.d.ts.map +1 -0
  90. package/dist/lib/vista-hires-transition.d.ts +32 -0
  91. package/dist/lib/vista-hires-transition.d.ts.map +1 -0
  92. package/dist/lib/vista-image-event.d.ts +23 -0
  93. package/dist/lib/vista-image-event.d.ts.map +1 -0
  94. package/dist/lib/vista-image.d.ts +33 -0
  95. package/dist/lib/vista-image.d.ts.map +1 -0
  96. package/dist/lib/{pointers.d.ts → vista-pointers.d.ts} +1 -1
  97. package/dist/lib/vista-pointers.d.ts.map +1 -0
  98. package/dist/lib/vista-state.d.ts +18 -0
  99. package/dist/lib/vista-state.d.ts.map +1 -0
  100. package/dist/lib/vista-view.d.ts +25 -28
  101. package/dist/lib/vista-view.d.ts.map +1 -1
  102. package/dist/react.d.ts +9 -9
  103. package/dist/react.d.ts.map +1 -1
  104. package/dist/react.js +59 -49
  105. package/dist/solid.d.ts +8 -11
  106. package/dist/solid.d.ts.map +1 -1
  107. package/dist/solid.js +28 -32
  108. package/dist/style.css +1 -1
  109. package/dist/styles/autumn-amber.css +1 -0
  110. package/dist/styles/autumn-amber.d.ts +1 -0
  111. package/dist/styles/cotton-candy.css +1 -0
  112. package/dist/styles/cotton-candy.d.ts +1 -0
  113. package/dist/styles/dark-rounded.css +1 -1
  114. package/dist/styles/ember-glow.css +1 -0
  115. package/dist/styles/ember-glow.d.ts +1 -0
  116. package/dist/styles/extensions/image-story.css +1 -0
  117. package/dist/styles/extensions/image-story.d.ts +1 -0
  118. package/dist/styles/forest-moss.css +1 -0
  119. package/dist/styles/forest-moss.d.ts +1 -0
  120. package/dist/styles/green-lake.css +1 -0
  121. package/dist/styles/green-lake.d.ts +1 -0
  122. package/dist/styles/ice-crystal.css +1 -0
  123. package/dist/styles/ice-crystal.d.ts +1 -0
  124. package/dist/styles/lavender-fields.css +1 -0
  125. package/dist/styles/lavender-fields.d.ts +1 -0
  126. package/dist/styles/midnight-gold.css +1 -0
  127. package/dist/styles/midnight-gold.d.ts +1 -0
  128. package/dist/styles/midnight-ocean.css +1 -0
  129. package/dist/styles/midnight-ocean.d.ts +1 -0
  130. package/dist/styles/mint-chocolate.css +1 -0
  131. package/dist/styles/mint-chocolate.d.ts +1 -0
  132. package/dist/styles/neon-nights.css +1 -0
  133. package/dist/styles/neon-nights.d.ts +1 -0
  134. package/dist/styles/paper-light.css +1 -0
  135. package/dist/styles/paper-light.d.ts +1 -0
  136. package/dist/styles/retro-arcade.css +1 -0
  137. package/dist/styles/retro-arcade.d.ts +1 -0
  138. package/dist/styles/soft-neutral.css +1 -0
  139. package/dist/styles/soft-neutral.d.ts +1 -0
  140. package/dist/styles/stark-minimal.css +1 -0
  141. package/dist/styles/stark-minimal.d.ts +1 -0
  142. package/dist/styles/strawberry.css +1 -0
  143. package/dist/styles/strawberry.d.ts +1 -0
  144. package/dist/svelte.d.ts +11 -2
  145. package/dist/svelte.d.ts.map +1 -1
  146. package/dist/svelte.js +36 -14
  147. package/dist/vista-box-CQvGrjln.js +318 -0
  148. package/dist/vistaview.d.ts +9 -2
  149. package/dist/vistaview.d.ts.map +1 -1
  150. package/dist/vistaview.js +719 -686
  151. package/dist/vistaview.umd.js +14 -7
  152. package/dist/vue.d.ts +28 -9
  153. package/dist/vue.d.ts.map +1 -1
  154. package/dist/vue.js +43 -24
  155. package/package.json +8 -3
  156. package/dist/lib/defaults/setup.d.ts +0 -3
  157. package/dist/lib/defaults/setup.d.ts.map +0 -1
  158. package/dist/lib/errors.d.ts +0 -4
  159. package/dist/lib/errors.d.ts.map +0 -1
  160. package/dist/lib/image-state.d.ts +0 -40
  161. package/dist/lib/image-state.d.ts.map +0 -1
  162. package/dist/lib/pointers.d.ts.map +0 -1
  163. package/dist/lib/utils.d.ts +0 -27
  164. package/dist/lib/utils.d.ts.map +0 -1
@@ -0,0 +1,2 @@
1
+ (function(G,Q){typeof exports=="object"&&typeof module<"u"?Q(exports):typeof define=="function"&&define.amd?define(["exports"],Q):(G=typeof globalThis<"u"?globalThis:G||self,Q(G.VistaView=G.VistaView||{}))})(this,(function(G){"use strict";function Q(w){return w&&w.__esModule&&Object.prototype.hasOwnProperty.call(w,"default")?w.default:w}/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */var ye,Xe;function $e(){if(Xe)return ye;Xe=1;const{entries:w,setPrototypeOf:B,isFrozen:M,getPrototypeOf:v,getOwnPropertyDescriptor:y}=Object;let{freeze:r,seal:f,create:_}=Object,{apply:E,construct:I}=typeof Reflect<"u"&&Reflect;r||(r=function(o){return o}),f||(f=function(o){return o}),E||(E=function(o,c){for(var a=arguments.length,u=new Array(a>2?a-2:0),N=2;N<a;N++)u[N-2]=arguments[N];return o.apply(c,u)}),I||(I=function(o){for(var c=arguments.length,a=new Array(c>1?c-1:0),u=1;u<c;u++)a[u-1]=arguments[u];return new o(...a)});const d=O(Array.prototype.forEach),Ut=O(Array.prototype.lastIndexOf),Ke=O(Array.prototype.pop),ee=O(Array.prototype.push),Ft=O(Array.prototype.splice),ue=O(String.prototype.toLowerCase),Re=O(String.prototype.toString),Oe=O(String.prototype.match),te=O(String.prototype.replace),Ht=O(String.prototype.indexOf),zt=O(String.prototype.trim),x=O(Object.prototype.hasOwnProperty),R=O(RegExp.prototype.test),ne=Gt(TypeError);function O(l){return function(o){o instanceof RegExp&&(o.lastIndex=0);for(var c=arguments.length,a=new Array(c>1?c-1:0),u=1;u<c;u++)a[u-1]=arguments[u];return E(l,o,a)}}function Gt(l){return function(){for(var o=arguments.length,c=new Array(o),a=0;a<o;a++)c[a]=arguments[a];return I(l,c)}}function s(l,o){let c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ue;B&&B(l,null);let a=o.length;for(;a--;){let u=o[a];if(typeof u=="string"){const N=c(u);N!==u&&(M(o)||(o[a]=N),u=N)}l[u]=!0}return l}function Bt(l){for(let o=0;o<l.length;o++)x(l,o)||(l[o]=null);return l}function P(l){const o=_(null);for(const[c,a]of w(l))x(l,c)&&(Array.isArray(a)?o[c]=Bt(a):a&&typeof a=="object"&&a.constructor===Object?o[c]=P(a):o[c]=a);return o}function oe(l,o){for(;l!==null;){const a=y(l,o);if(a){if(a.get)return O(a.get);if(typeof a.value=="function")return O(a.value)}l=v(l)}function c(){return null}return c}const Ze=r(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),be=r(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),De=r(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Wt=r(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Ne=r(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Yt=r(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Je=r(["#text"]),Qe=r(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Ce=r(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),et=r(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),pe=r(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),jt=f(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Vt=f(/<%[\w\W]*|[\w\W]*%>/gm),Xt=f(/\$\{[\w\W]*/gm),$t=f(/^data-[\-\w.\u00B7-\uFFFF]+$/),qt=f(/^aria-[\-\w]+$/),tt=f(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Kt=f(/^(?:\w+script|data):/i),Zt=f(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),nt=f(/^html$/i),Jt=f(/^[a-z][.\w]*(-[.\w]+)+$/i);var ot=Object.freeze({__proto__:null,ARIA_ATTR:qt,ATTR_WHITESPACE:Zt,CUSTOM_ELEMENT:Jt,DATA_ATTR:$t,DOCTYPE_NAME:nt,ERB_EXPR:Vt,IS_ALLOWED_URI:tt,IS_SCRIPT_OR_DATA:Kt,MUSTACHE_EXPR:jt,TMPLIT_EXPR:Xt});const ie={element:1,text:3,progressingInstruction:7,comment:8,document:9},Qt=function(){return typeof window>"u"?null:window},en=function(o,c){if(typeof o!="object"||typeof o.createPolicy!="function")return null;let a=null;const u="data-tt-policy-suffix";c&&c.hasAttribute(u)&&(a=c.getAttribute(u));const N="dompurify"+(a?"#"+a:"");try{return o.createPolicy(N,{createHTML(j){return j},createScriptURL(j){return j}})}catch{return console.warn("TrustedTypes policy "+N+" could not be created."),null}},it=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function rt(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Qt();const o=i=>rt(i);if(o.version="3.3.1",o.removed=[],!l||!l.document||l.document.nodeType!==ie.document||!l.Element)return o.isSupported=!1,o;let{document:c}=l;const a=c,u=a.currentScript,{DocumentFragment:N,HTMLTemplateElement:j,Node:Ie,Element:at,NodeFilter:re,NamedNodeMap:nn=l.NamedNodeMap||l.MozNamedAttrMap,HTMLFormElement:on,DOMParser:rn,trustedTypes:me}=l,ae=at.prototype,an=oe(ae,"cloneNode"),sn=oe(ae,"remove"),ln=oe(ae,"nextSibling"),cn=oe(ae,"childNodes"),de=oe(ae,"parentNode");if(typeof j=="function"){const i=c.createElement("template");i.content&&i.content.ownerDocument&&(c=i.content.ownerDocument)}let b,se="";const{implementation:we,createNodeIterator:fn,createDocumentFragment:un,getElementsByTagName:pn}=c,{importNode:mn}=a;let D=it();o.isSupported=typeof w=="function"&&typeof de=="function"&&we&&we.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Me,ERB_EXPR:ve,TMPLIT_EXPR:xe,DATA_ATTR:dn,ARIA_ATTR:Tn,IS_SCRIPT_OR_DATA:hn,ATTR_WHITESPACE:st,CUSTOM_ELEMENT:En}=ot;let{IS_ALLOWED_URI:lt}=ot,g=null;const ct=s({},[...Ze,...be,...De,...Ne,...Je]);let A=null;const ft=s({},[...Qe,...Ce,...et,...pe]);let m=Object.seal(_(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),le=null,Pe=null;const V=Object.seal(_(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ut=!0,ke=!0,pt=!1,mt=!0,X=!1,Te=!0,W=!1,Ue=!1,Fe=!1,$=!1,he=!1,Ee=!1,dt=!0,Tt=!1;const gn="user-content-";let He=!0,ce=!1,q={},k=null;const ze=s({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ht=null;const Et=s({},["audio","video","img","source","image","track"]);let Ge=null;const gt=s({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ge="http://www.w3.org/1998/Math/MathML",_e="http://www.w3.org/2000/svg",F="http://www.w3.org/1999/xhtml";let K=F,Be=!1,We=null;const _n=s({},[ge,_e,F],Re);let Ae=s({},["mi","mo","mn","ms","mtext"]),Se=s({},["annotation-xml"]);const An=s({},["title","style","font","a","script"]);let fe=null;const Sn=["application/xhtml+xml","text/html"],yn="text/html";let h=null,Z=null;const Ln=c.createElement("form"),_t=function(e){return e instanceof RegExp||e instanceof Function},Ye=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Z&&Z===e)){if((!e||typeof e!="object")&&(e={}),e=P(e),fe=Sn.indexOf(e.PARSER_MEDIA_TYPE)===-1?yn:e.PARSER_MEDIA_TYPE,h=fe==="application/xhtml+xml"?Re:ue,g=x(e,"ALLOWED_TAGS")?s({},e.ALLOWED_TAGS,h):ct,A=x(e,"ALLOWED_ATTR")?s({},e.ALLOWED_ATTR,h):ft,We=x(e,"ALLOWED_NAMESPACES")?s({},e.ALLOWED_NAMESPACES,Re):_n,Ge=x(e,"ADD_URI_SAFE_ATTR")?s(P(gt),e.ADD_URI_SAFE_ATTR,h):gt,ht=x(e,"ADD_DATA_URI_TAGS")?s(P(Et),e.ADD_DATA_URI_TAGS,h):Et,k=x(e,"FORBID_CONTENTS")?s({},e.FORBID_CONTENTS,h):ze,le=x(e,"FORBID_TAGS")?s({},e.FORBID_TAGS,h):P({}),Pe=x(e,"FORBID_ATTR")?s({},e.FORBID_ATTR,h):P({}),q=x(e,"USE_PROFILES")?e.USE_PROFILES:!1,ut=e.ALLOW_ARIA_ATTR!==!1,ke=e.ALLOW_DATA_ATTR!==!1,pt=e.ALLOW_UNKNOWN_PROTOCOLS||!1,mt=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,X=e.SAFE_FOR_TEMPLATES||!1,Te=e.SAFE_FOR_XML!==!1,W=e.WHOLE_DOCUMENT||!1,$=e.RETURN_DOM||!1,he=e.RETURN_DOM_FRAGMENT||!1,Ee=e.RETURN_TRUSTED_TYPE||!1,Fe=e.FORCE_BODY||!1,dt=e.SANITIZE_DOM!==!1,Tt=e.SANITIZE_NAMED_PROPS||!1,He=e.KEEP_CONTENT!==!1,ce=e.IN_PLACE||!1,lt=e.ALLOWED_URI_REGEXP||tt,K=e.NAMESPACE||F,Ae=e.MATHML_TEXT_INTEGRATION_POINTS||Ae,Se=e.HTML_INTEGRATION_POINTS||Se,m=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&_t(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(m.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&_t(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(m.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(m.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),X&&(ke=!1),he&&($=!0),q&&(g=s({},Je),A=[],q.html===!0&&(s(g,Ze),s(A,Qe)),q.svg===!0&&(s(g,be),s(A,Ce),s(A,pe)),q.svgFilters===!0&&(s(g,De),s(A,Ce),s(A,pe)),q.mathMl===!0&&(s(g,Ne),s(A,et),s(A,pe))),e.ADD_TAGS&&(typeof e.ADD_TAGS=="function"?V.tagCheck=e.ADD_TAGS:(g===ct&&(g=P(g)),s(g,e.ADD_TAGS,h))),e.ADD_ATTR&&(typeof e.ADD_ATTR=="function"?V.attributeCheck=e.ADD_ATTR:(A===ft&&(A=P(A)),s(A,e.ADD_ATTR,h))),e.ADD_URI_SAFE_ATTR&&s(Ge,e.ADD_URI_SAFE_ATTR,h),e.FORBID_CONTENTS&&(k===ze&&(k=P(k)),s(k,e.FORBID_CONTENTS,h)),e.ADD_FORBID_CONTENTS&&(k===ze&&(k=P(k)),s(k,e.ADD_FORBID_CONTENTS,h)),He&&(g["#text"]=!0),W&&s(g,["html","head","body"]),g.table&&(s(g,["tbody"]),delete le.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw ne('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ne('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');b=e.TRUSTED_TYPES_POLICY,se=b.createHTML("")}else b===void 0&&(b=en(me,u)),b!==null&&typeof se=="string"&&(se=b.createHTML(""));r&&r(e),Z=e}},At=s({},[...be,...De,...Wt]),St=s({},[...Ne,...Yt]),Rn=function(e){let t=de(e);(!t||!t.tagName)&&(t={namespaceURI:K,tagName:"template"});const n=ue(e.tagName),p=ue(t.tagName);return We[e.namespaceURI]?e.namespaceURI===_e?t.namespaceURI===F?n==="svg":t.namespaceURI===ge?n==="svg"&&(p==="annotation-xml"||Ae[p]):!!At[n]:e.namespaceURI===ge?t.namespaceURI===F?n==="math":t.namespaceURI===_e?n==="math"&&Se[p]:!!St[n]:e.namespaceURI===F?t.namespaceURI===_e&&!Se[p]||t.namespaceURI===ge&&!Ae[p]?!1:!St[n]&&(An[n]||!At[n]):!!(fe==="application/xhtml+xml"&&We[e.namespaceURI]):!1},U=function(e){ee(o.removed,{element:e});try{de(e).removeChild(e)}catch{sn(e)}},Y=function(e,t){try{ee(o.removed,{attribute:t.getAttributeNode(e),from:t})}catch{ee(o.removed,{attribute:null,from:t})}if(t.removeAttribute(e),e==="is")if($||he)try{U(t)}catch{}else try{t.setAttribute(e,"")}catch{}},yt=function(e){let t=null,n=null;if(Fe)e="<remove></remove>"+e;else{const T=Oe(e,/^[\r\n\t ]+/);n=T&&T[0]}fe==="application/xhtml+xml"&&K===F&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const p=b?b.createHTML(e):e;if(K===F)try{t=new rn().parseFromString(p,fe)}catch{}if(!t||!t.documentElement){t=we.createDocument(K,"template",null);try{t.documentElement.innerHTML=Be?se:p}catch{}}const L=t.body||t.documentElement;return e&&n&&L.insertBefore(c.createTextNode(n),L.childNodes[0]||null),K===F?pn.call(t,W?"html":"body")[0]:W?t.documentElement:L},Lt=function(e){return fn.call(e.ownerDocument||e,e,re.SHOW_ELEMENT|re.SHOW_COMMENT|re.SHOW_TEXT|re.SHOW_PROCESSING_INSTRUCTION|re.SHOW_CDATA_SECTION,null)},je=function(e){return e instanceof on&&(typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||!(e.attributes instanceof nn)||typeof e.removeAttribute!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function")},Rt=function(e){return typeof Ie=="function"&&e instanceof Ie};function H(i,e,t){d(i,n=>{n.call(o,e,t,Z)})}const Ot=function(e){let t=null;if(H(D.beforeSanitizeElements,e,null),je(e))return U(e),!0;const n=h(e.nodeName);if(H(D.uponSanitizeElement,e,{tagName:n,allowedTags:g}),Te&&e.hasChildNodes()&&!Rt(e.firstElementChild)&&R(/<[/\w!]/g,e.innerHTML)&&R(/<[/\w!]/g,e.textContent)||e.nodeType===ie.progressingInstruction||Te&&e.nodeType===ie.comment&&R(/<[/\w]/g,e.data))return U(e),!0;if(!(V.tagCheck instanceof Function&&V.tagCheck(n))&&(!g[n]||le[n])){if(!le[n]&&Dt(n)&&(m.tagNameCheck instanceof RegExp&&R(m.tagNameCheck,n)||m.tagNameCheck instanceof Function&&m.tagNameCheck(n)))return!1;if(He&&!k[n]){const p=de(e)||e.parentNode,L=cn(e)||e.childNodes;if(L&&p){const T=L.length;for(let C=T-1;C>=0;--C){const z=an(L[C],!0);z.__removalCount=(e.__removalCount||0)+1,p.insertBefore(z,ln(e))}}}return U(e),!0}return e instanceof at&&!Rn(e)||(n==="noscript"||n==="noembed"||n==="noframes")&&R(/<\/no(script|embed|frames)/i,e.innerHTML)?(U(e),!0):(X&&e.nodeType===ie.text&&(t=e.textContent,d([Me,ve,xe],p=>{t=te(t,p," ")}),e.textContent!==t&&(ee(o.removed,{element:e.cloneNode()}),e.textContent=t)),H(D.afterSanitizeElements,e,null),!1)},bt=function(e,t,n){if(dt&&(t==="id"||t==="name")&&(n in c||n in Ln))return!1;if(!(ke&&!Pe[t]&&R(dn,t))){if(!(ut&&R(Tn,t))){if(!(V.attributeCheck instanceof Function&&V.attributeCheck(t,e))){if(!A[t]||Pe[t]){if(!(Dt(e)&&(m.tagNameCheck instanceof RegExp&&R(m.tagNameCheck,e)||m.tagNameCheck instanceof Function&&m.tagNameCheck(e))&&(m.attributeNameCheck instanceof RegExp&&R(m.attributeNameCheck,t)||m.attributeNameCheck instanceof Function&&m.attributeNameCheck(t,e))||t==="is"&&m.allowCustomizedBuiltInElements&&(m.tagNameCheck instanceof RegExp&&R(m.tagNameCheck,n)||m.tagNameCheck instanceof Function&&m.tagNameCheck(n))))return!1}else if(!Ge[t]){if(!R(lt,te(n,st,""))){if(!((t==="src"||t==="xlink:href"||t==="href")&&e!=="script"&&Ht(n,"data:")===0&&ht[e])){if(!(pt&&!R(hn,te(n,st,"")))){if(n)return!1}}}}}}}return!0},Dt=function(e){return e!=="annotation-xml"&&Oe(e,En)},Nt=function(e){H(D.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||je(e))return;const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:A,forceKeepAttr:void 0};let p=t.length;for(;p--;){const L=t[p],{name:T,namespaceURI:C,value:z}=L,J=h(T),Ve=z;let S=T==="value"?Ve:zt(Ve);if(n.attrName=J,n.attrValue=S,n.keepAttr=!0,n.forceKeepAttr=void 0,H(D.uponSanitizeAttribute,e,n),S=n.attrValue,Tt&&(J==="id"||J==="name")&&(Y(T,e),S=gn+S),Te&&R(/((--!?|])>)|<\/(style|title|textarea)/i,S)){Y(T,e);continue}if(J==="attributename"&&Oe(S,"href")){Y(T,e);continue}if(n.forceKeepAttr)continue;if(!n.keepAttr){Y(T,e);continue}if(!mt&&R(/\/>/i,S)){Y(T,e);continue}X&&d([Me,ve,xe],It=>{S=te(S,It," ")});const Ct=h(e.nodeName);if(!bt(Ct,J,S)){Y(T,e);continue}if(b&&typeof me=="object"&&typeof me.getAttributeType=="function"&&!C)switch(me.getAttributeType(Ct,J)){case"TrustedHTML":{S=b.createHTML(S);break}case"TrustedScriptURL":{S=b.createScriptURL(S);break}}if(S!==Ve)try{C?e.setAttributeNS(C,T,S):e.setAttribute(T,S),je(e)?U(e):Ke(o.removed)}catch{Y(T,e)}}H(D.afterSanitizeAttributes,e,null)},On=function i(e){let t=null;const n=Lt(e);for(H(D.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)H(D.uponSanitizeShadowNode,t,null),Ot(t),Nt(t),t.content instanceof N&&i(t.content);H(D.afterSanitizeShadowDOM,e,null)};return o.sanitize=function(i){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=null,n=null,p=null,L=null;if(Be=!i,Be&&(i="<!-->"),typeof i!="string"&&!Rt(i))if(typeof i.toString=="function"){if(i=i.toString(),typeof i!="string")throw ne("dirty is not a string, aborting")}else throw ne("toString is not a function");if(!o.isSupported)return i;if(Ue||Ye(e),o.removed=[],typeof i=="string"&&(ce=!1),ce){if(i.nodeName){const z=h(i.nodeName);if(!g[z]||le[z])throw ne("root node is forbidden and cannot be sanitized in-place")}}else if(i instanceof Ie)t=yt("<!---->"),n=t.ownerDocument.importNode(i,!0),n.nodeType===ie.element&&n.nodeName==="BODY"||n.nodeName==="HTML"?t=n:t.appendChild(n);else{if(!$&&!X&&!W&&i.indexOf("<")===-1)return b&&Ee?b.createHTML(i):i;if(t=yt(i),!t)return $?null:Ee?se:""}t&&Fe&&U(t.firstChild);const T=Lt(ce?i:t);for(;p=T.nextNode();)Ot(p),Nt(p),p.content instanceof N&&On(p.content);if(ce)return i;if($){if(he)for(L=un.call(t.ownerDocument);t.firstChild;)L.appendChild(t.firstChild);else L=t;return(A.shadowroot||A.shadowrootmode)&&(L=mn.call(a,L,!0)),L}let C=W?t.outerHTML:t.innerHTML;return W&&g["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&R(nt,t.ownerDocument.doctype.name)&&(C="<!DOCTYPE "+t.ownerDocument.doctype.name+`>
2
+ `+C),X&&d([Me,ve,xe],z=>{C=te(C,z," ")}),b&&Ee?b.createHTML(C):C},o.setConfig=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ye(i),Ue=!0},o.clearConfig=function(){Z=null,Ue=!1},o.isValidAttribute=function(i,e,t){Z||Ye({});const n=h(i),p=h(e);return bt(n,p,t)},o.addHook=function(i,e){typeof e=="function"&&ee(D[i],e)},o.removeHook=function(i,e){if(e!==void 0){const t=Ut(D[i],e);return t===-1?void 0:Ft(D[i],t,1)[0]}return Ke(D[i])},o.removeHooks=function(i){D[i]=[]},o.removeAllHooks=function(){D=it()},o}var tn=rt();return ye=tn,ye}var Le,qe;function wt(){return qe||(qe=1,Le=self.DOMPurify||(self.DOMPurify=$e().default||$e())),Le}var Mt=wt();const vt=Q(Mt),xt='<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" class="lucide lucide-chevron-up-icon lucide-chevron-up"><path d="m18 15-6-6-6 6"/></svg>';function Pt(w,B,M){const v=parseInt(w,10),y=Object.keys(B).reduce((f,_)=>{const E=parseInt(_,10);return E<v?f.before.push(_):E>v&&f.after.push(_),f},{before:[],after:[]});let r=0;for(;y.before.length+y.after.length>M;){const f=r%2===0?y.before.shift()??y.after.pop():y.after.pop()??y.before.shift();r++,f!==void 0&&delete B[f]}}function kt({getStory:w,maxStoryCache:B=5}){let M={},v="",y=null,r=null,f=null;return{name:"imageStory",control:()=>{y=document.createElement("div"),y.classList.add("vvw-story");const _=document.createElement("div");_.classList.add("vvw-story-container"),y.appendChild(_),r=document.createElement("div"),r.classList.add("vvw-story-text"),f=document.createElement("div"),f.classList.add("vvw-story-loading");const E=document.createElement("button");return E.classList.add("vvw-story-button"),E.innerHTML=xt,E.addEventListener("click",()=>{r!=null&&r.classList.contains("expanded")?(r.classList.remove("expanded"),E.classList.remove("expanded"),_.style.removeProperty("--vvw-story-height")):(r==null||r.classList.add("expanded"),E.classList.add("expanded"),requestAnimationFrame(()=>{const I=r==null?void 0:r.offsetHeight;_.style.setProperty("--vvw-story-height",`${I}px`)}))}),_.appendChild(r),_.appendChild(E),y},onClose(_){if(v!==""){const E=M[v];E&&E.onUnload&&E.onUnload()}M={},v="",y&&y.remove(),y=null,r=null,f=null},onImageView:(_,E)=>{const I=_.index.to??-1;if(v!==""&&`${I}`!==v){const d=M[v];d&&d.onUnload&&d.onUnload()}if(`${I}`in M){const d=M[`${I}`];r&&(r.innerHTML=d.content||""),d.onLoad&&d.onLoad()}else r&&(r.innerHTML=""),r&&f&&r.appendChild(f),w(I).then(d=>{d!==null?(d.content=vt.sanitize(d.content),M[`${I}`]=d,r&&(r.innerHTML=d.content||""),d.onLoad&&d.onLoad(),Pt(`${I}`,M,B)):delete M[`${I}`]})}}}G.imageStory=kt,Object.defineProperty(G,Symbol.toStringTag,{value:"Module"})}));
@@ -0,0 +1,2 @@
1
+ export * from '../lib/extensions/logger'
2
+ export {}
@@ -0,0 +1,23 @@
1
+ function n() {
2
+ return {
3
+ name: "logger",
4
+ onInitializeImage: (e) => {
5
+ console.debug("Logger: VistaView initialized with params:"), console.debug(e);
6
+ },
7
+ onContentChange: (e, o) => {
8
+ console.debug("Logger: Content changed"), console.debug(e);
9
+ },
10
+ onImageView: async (e, o) => {
11
+ console.debug("Logger: Image viewed"), console.debug(e);
12
+ },
13
+ onOpen: async (e) => {
14
+ console.debug("Logger: VistaView opened"), console.debug(e);
15
+ },
16
+ onClose: (e) => {
17
+ console.debug("Logger: VistaView closed"), console.debug(e);
18
+ }
19
+ };
20
+ }
21
+ export {
22
+ n as logger
23
+ };
@@ -0,0 +1 @@
1
+ (function(o,n){typeof exports=="object"&&typeof module<"u"?n(exports):typeof define=="function"&&define.amd?define(["exports"],n):(o=typeof globalThis<"u"?globalThis:o||self,n(o.VistaView=o.VistaView||{}))})(this,(function(o){"use strict";function n(){return{name:"logger",onInitializeImage:e=>{console.debug("Logger: VistaView initialized with params:"),console.debug(e)},onContentChange:(e,i)=>{console.debug("Logger: Content changed"),console.debug(e)},onImageView:async(e,i)=>{console.debug("Logger: Image viewed"),console.debug(e)},onOpen:async e=>{console.debug("Logger: VistaView opened"),console.debug(e)},onClose:e=>{console.debug("Logger: VistaView closed"),console.debug(e)}}}o.logger=n,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})}));
@@ -0,0 +1,2 @@
1
+ export * from '../lib/extensions/mapbox'
2
+ export {}
@@ -0,0 +1,124 @@
1
+ var c = Object.defineProperty;
2
+ var d = (o, t, e) => t in o ? c(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
+ var l = (o, t, e) => d(o, typeof t != "symbol" ? t + "" : t, e);
4
+ import { V as p } from "../vista-box-CQvGrjln.js";
5
+ function g(o) {
6
+ if (!o) return null;
7
+ try {
8
+ const t = o.match(
9
+ /(-?\d+\.?\d*),\s*(-?\d+\.?\d*),?\s*(\d+\.?\d*)?,?\s*(\d+\.?\d*)?,?\s*(\d+\.?\d*)?/
10
+ );
11
+ if (t)
12
+ return {
13
+ lng: parseFloat(t[1]),
14
+ lat: parseFloat(t[2]),
15
+ zoom: t[3] ? parseFloat(t[3]) : void 0,
16
+ bearing: t[4] ? parseFloat(t[4]) : void 0,
17
+ pitch: t[5] ? parseFloat(t[5]) : void 0
18
+ };
19
+ const e = new URL(o);
20
+ if (e.hostname.includes("mapbox.com")) {
21
+ const i = e.pathname.match(/@(-?\d+\.?\d*),(-?\d+\.?\d*),(\d+\.?\d*)?/);
22
+ if (i)
23
+ return {
24
+ lng: parseFloat(i[1]),
25
+ lat: parseFloat(i[2]),
26
+ zoom: i[3] ? parseFloat(i[3]) : void 0
27
+ };
28
+ }
29
+ } catch {
30
+ }
31
+ return null;
32
+ }
33
+ function u(o, t) {
34
+ const e = o.zoom || t.zoom || 15, i = t.width || 800, s = t.height || 600, a = t.style || "streets-v12", n = o.bearing || t.bearing || 0, r = o.pitch || t.pitch || 0, m = `pin-s+ff0000(${o.lng},${o.lat})`;
35
+ return `https://api.mapbox.com/styles/v1/mapbox/${a}/static/${m}/${o.lng},${o.lat},${e},${n},${r}/${i}x${s}@2x?access_token=${t.accessToken}`;
36
+ }
37
+ class h extends p {
38
+ constructor(e, i, s) {
39
+ var m;
40
+ super(e);
41
+ l(this, "element");
42
+ l(this, "mapboxConfig");
43
+ l(this, "location");
44
+ l(this, "thumbnailImage");
45
+ this.mapboxConfig = i, this.location = s;
46
+ const a = document.createElement("div");
47
+ a.style.position = "relative", this.thumbnailImage = document.createElement("img"), a.appendChild(this.thumbnailImage), this.thumbnailImage.src = ((m = this.origin) == null ? void 0 : m.image.src) || u(s, i), this.thumbnailImage.style.width = "100%", this.thumbnailImage.style.height = "100%", this.thumbnailImage.style.objectFit = "cover", this.thumbnailImage.classList.add("vvw--pulsing"), this.element = a, this.element.classList.add("vvw-img-hi");
48
+ const { width: n, height: r } = this.getFullSizeDim();
49
+ this.fullH = r, this.fullW = n, this.minW = this.fullW * 0.5, this.maxW = this.fullW, this.element.style.width = `${n}px`, this.element.style.height = `${r}px`, this.setSizes({ stableSize: !1, initDimension: !0 }), this.pos === 0 ? this.loadMapboxGL().then(() => {
50
+ this.initializeMap(a);
51
+ }) : this.isLoadedResolved(!0);
52
+ }
53
+ async loadMapboxGL() {
54
+ if (!window.mapboxgl) {
55
+ if (!document.querySelector(".vistaview-mapbox-gl-css")) {
56
+ const e = document.createElement("link");
57
+ e.rel = "stylesheet", e.href = "https://api.mapbox.com/mapbox-gl-js/v3.0.1/mapbox-gl.css", e.className = "vistaview-mapbox-gl-css", document.head.appendChild(e);
58
+ }
59
+ if (!document.querySelector(".vistaview-mapbox-gl-js"))
60
+ return new Promise((e, i) => {
61
+ const s = document.createElement("script");
62
+ s.src = "https://api.mapbox.com/mapbox-gl-js/v3.0.1/mapbox-gl.js", s.className = "vistaview-mapbox-gl-js", s.onload = () => e(), s.onerror = () => i(new Error("Failed to load Mapbox GL JS")), document.head.appendChild(s);
63
+ });
64
+ }
65
+ }
66
+ initializeMap(e) {
67
+ const i = window.mapboxgl;
68
+ if (!i) {
69
+ this.isLoadedRejected(new Error("Mapbox GL JS not loaded"));
70
+ return;
71
+ }
72
+ const s = document.createElement("div");
73
+ s.style.position = "absolute", s.style.top = "0", s.style.left = "0", s.style.width = "100%", s.style.height = "100%", s.style.opacity = "0", s.style.transition = "opacity 1s ease", e.appendChild(s), s.addEventListener("pointerdown", (n) => {
74
+ n.stopPropagation();
75
+ }), i.accessToken = this.mapboxConfig.accessToken;
76
+ const a = new i.Map({
77
+ container: s,
78
+ style: `mapbox://styles/mapbox/${this.mapboxConfig.style || "streets-v12"}`,
79
+ center: [this.location.lng, this.location.lat],
80
+ zoom: this.location.zoom || this.mapboxConfig.zoom || 15,
81
+ bearing: this.location.bearing || this.mapboxConfig.bearing || 0,
82
+ pitch: this.location.pitch || this.mapboxConfig.pitch || 0
83
+ });
84
+ new i.Marker({ color: "#ff0000" }).setLngLat([this.location.lng, this.location.lat]).addTo(a), a.addControl(new i.NavigationControl()), a.on("load", () => {
85
+ this.onImageReady = () => {
86
+ a.resize(), s.style.opacity = "1", this.thumbnailImage.classList.remove("vvw--pulsing");
87
+ }, this.isLoadedResolved(!0);
88
+ }), a.on("error", (n) => {
89
+ this.isLoadedRejected(n);
90
+ });
91
+ }
92
+ // Use 16:9 aspect ratio with max 800px width
93
+ getFullSizeDim() {
94
+ const e = Math.min(window.innerWidth, this.mapboxConfig.width || 800);
95
+ return {
96
+ width: e,
97
+ height: e * 9 / 16
98
+ };
99
+ }
100
+ // Override to avoid propagating content change event
101
+ setFinalTransform() {
102
+ return super.setFinalTransform({ propagateEvent: !1 });
103
+ }
104
+ }
105
+ function v(o) {
106
+ return o.accessToken || console.error("Mapbox access token is required"), {
107
+ name: "mapbox",
108
+ onInitializeImage: (t) => {
109
+ const e = t.elm.config.src, i = g(e);
110
+ if (i)
111
+ return new h(t, o, i);
112
+ },
113
+ onImageView: async (t, e) => {
114
+ const i = t.images.to[Math.floor(t.images.to.length / 2)];
115
+ i instanceof h && e.deactivateUi(["download", "zoomIn", "zoomOut"], i);
116
+ }
117
+ };
118
+ }
119
+ export {
120
+ h as VistaMapbox,
121
+ u as getMapboxStaticImage,
122
+ v as mapbox,
123
+ g as parseMapboxLocation
124
+ };
@@ -0,0 +1 @@
1
+ (function(c,m){typeof exports=="object"&&typeof module<"u"?m(exports):typeof define=="function"&&define.amd?define(["exports"],m):(c=typeof globalThis<"u"?globalThis:c||self,m(c.VistaView=c.VistaView||{}))})(this,(function(c){"use strict";var R=Object.defineProperty;var z=(c,m,f)=>m in c?R(c,m,{enumerable:!0,configurable:!0,writable:!0,value:f}):c[m]=f;var h=(c,m,f)=>z(c,typeof m!="symbol"?m+"":m,f);function m(l){const e=window.getComputedStyle(l).objectFit||"",{width:i,height:n}=l.getBoundingClientRect(),s=l.naturalWidth,a=l.naturalHeight;if(!e)return{width:i,height:n};if(!s||!a)return{width:i,height:n};const d=s/a,o=i/n;switch(e){case"fill":return{width:i,height:n};case"none":return{width:s,height:a};case"contain":return d>o?{width:i,height:i/d}:{width:n*d,height:n};case"cover":return d<o?{width:i,height:i/d}:{width:n*d,height:n};case"scale-down":{const u={width:s,height:a},r=d>o?{width:i,height:i/d}:{width:n*d,height:n};return r.width<=u.width&&r.height<=u.height?r:u}}return{width:i,height:n}}class f{static ease(t,e,i){const n=e-t,s=t+n*.2;return Math.abs(n)<i?e:s}static play(t,e,i){if(i()){requestAnimationFrame(()=>{this.play(t,e,i)});return}this.map.get(t)&&(t.element.classList.contains("vvw--load-cancelled")||requestAnimationFrame(()=>{var r,g,p,b,v,S,W,C,L,_;const n=this.map.get(t);if(!n||!t.element||t.element.classList.contains("vvw--load-cancelled"))return;const{current:s,target:a,log:d}=n;let o={};a.width!==void 0&&(o.width=this.ease(s._width,a.width,1)),a.height!==void 0&&(o.height=this.ease(s._height,a.height,1)),((r=a.transform)==null?void 0:r.x)!==void 0&&(o.transform=o.transform||{},o.transform.x=this.ease(s._transform.x,a.transform.x,1)),((g=a.transform)==null?void 0:g.y)!==void 0&&(o.transform=o.transform||{},o.transform.y=this.ease(s._transform.y,a.transform.y,1)),((p=a.transform)==null?void 0:p.scale)!==void 0&&(o.transform=o.transform||{},o.transform.scale=this.ease(s._transform.scale,a.transform.scale,.005)),((b=a.translate)==null?void 0:b.x)!==void 0&&(o.translate=o.translate||{},o.translate.x=this.ease(s._translate.x,a.translate.x,1)),((v=a.translate)==null?void 0:v.y)!==void 0&&(o.translate=o.translate||{},o.translate.y=this.ease(s._translate.y,a.translate.y,1)),o.width!==void 0&&(s.width=o.width),o.height!==void 0&&(s.height=o.height),o.translate&&(s.translate={...s.translate,...o.translate}),o.transform&&(s.transform={...s.transform,...o.transform}),(a.width===void 0||s._width===a.width)&&(a.height===void 0||s._height===a.height)&&(((S=a.transform)==null?void 0:S.x)===void 0||s._transform.x===a.transform.x)&&(((W=a.transform)==null?void 0:W.y)===void 0||s._transform.y===a.transform.y)&&(((C=a.transform)==null?void 0:C.scale)===void 0||s._transform.scale===a.transform.scale)&&(((L=a.translate)==null?void 0:L.x)===void 0||s._translate.x===a.translate.x)&&(((_=a.translate)==null?void 0:_.y)===void 0||s._translate.y===a.translate.y)?(this.map.delete(t),e()):(this.map.set(t,{current:s,target:a,log:d}),this.play(t,e,i))}))}static stop(t){const e=this.map.get(t);return this.map.delete(t),e}static start({vistaImage:t,target:e,onComplete:i,shouldWait:n}){this.stop(t),this.map.set(t,{current:t.state,target:e}),this.play(t,i,n)}}h(f,"map",new Map);class M{constructor(t){h(this,"state");h(this,"parsedSrcSet");h(this,"isReady",!1);h(this,"isThrowing",!1);h(this,"thumb",null);h(this,"pos");h(this,"index");h(this,"config");h(this,"origin");h(this,"initH",0);h(this,"initW",0);h(this,"fullH",0);h(this,"fullW",0);h(this,"maxW",0);h(this,"minW",0);h(this,"defaultWH",200);h(this,"isZoomedIn",!1);h(this,"isCancelled",!1);h(this,"isLoadedResolved",null);h(this,"isLoadedRejected",null);h(this,"isLoaded",new Promise((t,e)=>{this.isLoadedResolved=t,this.isLoadedRejected=e}));h(this,"replacement",null);h(this,"originalParent",null);h(this,"originalNextSibling",null);h(this,"originalStyle","");h(this,"thumbImage",null);h(this,"fittedSize",null);h(this,"maxZoomLevel");h(this,"vistaView");h(this,"transitionState",null);h(this,"transitionShouldWait",()=>!1);h(this,"initPointerCenter",{x:0,y:0});h(this,"onScale");var i;this.state=this.createState(),this.pos=t.pos,this.index=t.index,this.config=t.elm.config,this.parsedSrcSet=t.elm.parsedSrcSet,this.origin=t.elm.origin,this.maxZoomLevel=t.maxZoomLevel,this.vistaView=t.vistaView,this.onScale=t.onScale,t.transitionState&&(this.transitionState=t.transitionState),t.transitionShouldWait&&(this.transitionShouldWait=t.transitionShouldWait),this.initPointerCenter={x:window.innerWidth/2,y:window.innerHeight/2};const e=this.pos===0?(i=this.origin)==null?void 0:i.image:null;if(this.originalParent=(e==null?void 0:e.parentElement)||null,this.originalNextSibling=(e==null?void 0:e.nextSibling)||null,e&&this.originalParent){this.originalStyle=e.style.cssText,this.thumbImage=e;const n=e.cloneNode(!0);this.originalParent.insertBefore(n,e),this.replacement=n,this.thumb=document.createElement("div"),this.thumb.classList.add("vvw-img-lo");const{width:s,height:a}=this.thumbImage?m(this.thumbImage):{width:0,height:0};this.fittedSize={width:s,height:a},this.thumb.appendChild(e),e.style.width="100%",e.style.height="100%",e.style.objectFit=this.origin.objectFit}}createState(){const t=this;return{_t:this,_width:0,_height:0,_transform:{x:0,y:0,scale:1},_translate:{x:0,y:0},_lessThanMinWidth:!1,get width(){return this._width},set width(e){this._width=e,t.onWidthChange(e)},get height(){return this._height},set height(e){this._height=e,t.onHeightChange(e)},get transform(){return this._transform},set transform(e){this._transform=e,t.onTransformChange(e)},get translate(){return this._translate},set translate(e){this._translate=e,t.onTranslateChange(e)},get lessThanMinWidth(){return this._lessThanMinWidth},set lessThanMinWidth(e){this._lessThanMinWidth=e,t.onLessThanMinWidthChange(e)}}}onLessThanMinWidthChange(t){t?this.element.style.opacity="0.5":this.element.style.opacity=""}onTranslateChange(t){this.element.style.translate=`calc(-50% + ${t.x}px) calc(-50% + ${t.y}px)`}onTransformChange(t){const e=`translate3d(${t.x}px, ${t.y}px, 0px) scale3d(${t.scale}, ${t.scale}, 1)`;this.element.style.transform=e}onWidthChange(t){this.element.style.width=`${t}px`}onHeightChange(t){this.element.style.height=`${t}px`}onImageReady(){}animateZoom(t,e){}scaleMove(t,e,i){}momentumThrow(t){return()=>{}}async init(){await this.isLoaded;const t=this.element;this.transitionState&&this.transitionState.current.width&&this.transitionState.current.height?(this.state.width=this.transitionState.current.width,this.state.height=this.transitionState.current.height):t.classList.contains("vvw--loaded")||(this.state.width=this.initW,this.state.height=this.initH);const e=()=>{this.isCancelled||f.start({vistaImage:this,target:{width:this.fullW,height:this.fullH},onComplete:()=>{this.isCancelled||(this.isReady=!0,t.classList.add("vvw--ready"),this.onImageReady())},shouldWait:this.transitionShouldWait})};this.pos<-1||this.pos>1?(this.state.width=this.fullW,this.state.height=this.fullH,t.classList.add("vvw--loaded"),t.classList.add("vvw--ready"),this.isReady=!0):t.classList.contains("vvw--loaded")?t.classList.contains("vvw--ready")?(this.isReady=!0,this.onImageReady()):e():(t.classList.add("vvw--loaded"),setTimeout(()=>{this.isCancelled||e()},333))}getFullSizeDim(){const{width:t,height:e}=this.thumb.getBoundingClientRect(),i=t/e;let n=window.innerWidth,s=window.innerHeight;return i>window.innerWidth/window.innerHeight?s=n/i:n=s*i,{width:n,height:s}}setSizes(t={}){var d,o,u;const{stableSize:e=!0,initDimension:i}=t;if(!this.origin)return;const n=this.thumb;let s={width:this.defaultWH,height:this.defaultWH,top:0,left:0};if(n){s=(((d=this.origin)==null?void 0:d.anchor)||this.replacement).getBoundingClientRect();const r=n.style;r.width=s.width+"px",r.height=s.height+"px",r.top="50%",r.left="50%",r.translate="-50% -50%",r.position="fixed",r.objectFit=this.origin.objectFit,r.borderRadius=this.origin.borderRadius;const g=Math.min(Math.max(s.left,-s.width),window.innerWidth+s.width)-window.innerWidth/2+s.width/2,p=Math.min(Math.max(s.top,-s.height),window.innerHeight+s.height)-window.innerHeight/2+s.height/2;r.setProperty("--vvw-init-radius",r.borderRadius),r.setProperty("--vvw-pulse-radius",`calc(1.3 * ${r.borderRadius})`),r.setProperty("--vvw-init-x",`${g}px`),r.setProperty("--vvw-init-y",`${p}px`),i&&(r.setProperty("--vvw-current-x",`${g}px`),r.setProperty("--vvw-current-y",`${p}px`))}if(!i){const{width:r,height:g}=this.thumbImage?m(this.thumbImage):{width:0,height:0};this.fittedSize={width:r,height:g}}const a=this.element;if(this.initW=Math.min(((o=this.fittedSize)==null?void 0:o.width)??0,s.width),this.initH=Math.min(((u=this.fittedSize)==null?void 0:u.height)??0,s.height),a.style.setProperty("--vvw-init-w",this.initW+"px"),a.style.setProperty("--vvw-init-h",this.initH+"px"),a.style.setProperty("--vvw-init-radius",this.origin.borderRadius),a.style.objectFit="cover",!i){if(this.isReady&&!this.isCancelled){const{width:r,height:g}=this.getFullSizeDim();this.fullH=g,this.fullW=r,this.minW=this.fullW*.5}!this.isZoomedIn&&e&&this.normalize()}}normalize(){this.state.transform={x:0,y:0,scale:1},this.state.translate={x:0,y:0},this.state.width=this.fullW,this.state.height=this.fullH,this.isZoomedIn=!1}getFromParsedSrcSet(t){if(!this.parsedSrcSet||this.parsedSrcSet.length===0)return null;const e=t*(window.devicePixelRatio||1);let i=this.parsedSrcSet[this.parsedSrcSet.length-1];for(const n of this.parsedSrcSet)if(n.width>=e){i=n;break}return i.src}prepareClose(){f.stop(this),this.setFinalTransform()}cancelPendingLoad(){var t;this.isCancelled=!0,(t=this.element)==null||t.classList.add("vvw--load-cancelled")}setInitialCenter(t){this.initPointerCenter=t}destroy(){var t,e;this.originalParent&&this.thumbImage&&(this.thumbImage.style.cssText=this.originalStyle,this.originalNextSibling?this.originalParent.insertBefore(this.thumbImage,this.originalNextSibling):this.originalParent.appendChild(this.thumbImage)),this.originalParent=null,this.originalNextSibling=null,this.originalStyle="",this.thumbImage=null,this.replacement&&(this.replacement.remove(),this.replacement=null),(t=this.thumb)==null||t.remove(),(e=this.element)==null||e.remove(),this.thumb=null,this.origin=void 0,this.config={src:"",alt:""}}cloneStyleFrom(t,e){t!=null&&t.element&&(e&&(this.transitionState=e||null),t.element.classList.contains("vvw--loaded")&&(this.element.classList.add("vvw--loaded"),this.state.width=t.state.width,this.state.height=t.state.height),t.element.classList.contains("vvw--ready")&&this.element.classList.add("vvw--ready"))}toObject(){return structuredClone({config:{src:this.config.src,alt:this.config.alt,srcSet:this.config.srcSet},origin:this.origin?{src:this.origin.src,srcSet:this.origin.srcSet,borderRadius:this.origin.borderRadius,objectFit:this.origin.objectFit}:null,parsedSrcSet:this.parsedSrcSet,element:"src"in this.element?this.element.src:this.element.toString(),thumb:void 0,index:this.index,pos:this.pos,state:{width:this.state._width,height:this.state._height,transform:this.state._transform,translate:this.state._translate}})}setFinalTransform(t={}){const{propagateEvent:e=!0}=t;if(this.isReady){if(this.state.translate.x+=this.state.transform.x,this.state.translate.y+=this.state.transform.y,this.state.width*=this.state.transform.scale,this.state.height*=this.state.transform.scale,Math.abs(this.state.width-this.fullW)<1&&(this.state.width=this.fullW,this.state.height=this.fullH),Math.abs(this.state.translate.x)<1&&(this.state.translate.x=0),Math.abs(this.state.translate.y)<1&&(this.state.translate.y=0),this.state.translate={...this.state.translate},this.state.transform={x:0,y:0,scale:1},e){const i=this.toObject();this.vistaView.options.onContentChange&&this.vistaView.options.onContentChange(i,this.vistaView),this.vistaView.state.extensions.forEach(n=>{n.onContentChange&&n.onContentChange(i,this.vistaView)})}return{close:!0,cancel:()=>{}}}}}function y(l){if(!l)return null;try{const t=l.match(/(-?\d+\.?\d*),\s*(-?\d+\.?\d*),?\s*(\d+\.?\d*)?,?\s*(\d+\.?\d*)?,?\s*(\d+\.?\d*)?/);if(t)return{lng:parseFloat(t[1]),lat:parseFloat(t[2]),zoom:t[3]?parseFloat(t[3]):void 0,bearing:t[4]?parseFloat(t[4]):void 0,pitch:t[5]?parseFloat(t[5]):void 0};const e=new URL(l);if(e.hostname.includes("mapbox.com")){const i=e.pathname.match(/@(-?\d+\.?\d*),(-?\d+\.?\d*),(\d+\.?\d*)?/);if(i)return{lng:parseFloat(i[1]),lat:parseFloat(i[2]),zoom:i[3]?parseFloat(i[3]):void 0}}}catch{}return null}function x(l,t){const e=l.zoom||t.zoom||15,i=t.width||800,n=t.height||600,s=t.style||"streets-v12",a=l.bearing||t.bearing||0,d=l.pitch||t.pitch||0,o=`pin-s+ff0000(${l.lng},${l.lat})`;return`https://api.mapbox.com/styles/v1/mapbox/${s}/static/${o}/${l.lng},${l.lat},${e},${a},${d}/${i}x${n}@2x?access_token=${t.accessToken}`}class w extends M{constructor(e,i,n){var o;super(e);h(this,"element");h(this,"mapboxConfig");h(this,"location");h(this,"thumbnailImage");this.mapboxConfig=i,this.location=n;const s=document.createElement("div");s.style.position="relative",this.thumbnailImage=document.createElement("img"),s.appendChild(this.thumbnailImage),this.thumbnailImage.src=((o=this.origin)==null?void 0:o.image.src)||x(n,i),this.thumbnailImage.style.width="100%",this.thumbnailImage.style.height="100%",this.thumbnailImage.style.objectFit="cover",this.thumbnailImage.classList.add("vvw--pulsing"),this.element=s,this.element.classList.add("vvw-img-hi");const{width:a,height:d}=this.getFullSizeDim();this.fullH=d,this.fullW=a,this.minW=this.fullW*.5,this.maxW=this.fullW,this.element.style.width=`${a}px`,this.element.style.height=`${d}px`,this.setSizes({stableSize:!1,initDimension:!0}),this.pos===0?this.loadMapboxGL().then(()=>{this.initializeMap(s)}):this.isLoadedResolved(!0)}async loadMapboxGL(){if(!window.mapboxgl){if(!document.querySelector(".vistaview-mapbox-gl-css")){const e=document.createElement("link");e.rel="stylesheet",e.href="https://api.mapbox.com/mapbox-gl-js/v3.0.1/mapbox-gl.css",e.className="vistaview-mapbox-gl-css",document.head.appendChild(e)}if(!document.querySelector(".vistaview-mapbox-gl-js"))return new Promise((e,i)=>{const n=document.createElement("script");n.src="https://api.mapbox.com/mapbox-gl-js/v3.0.1/mapbox-gl.js",n.className="vistaview-mapbox-gl-js",n.onload=()=>e(),n.onerror=()=>i(new Error("Failed to load Mapbox GL JS")),document.head.appendChild(n)})}}initializeMap(e){const i=window.mapboxgl;if(!i){this.isLoadedRejected(new Error("Mapbox GL JS not loaded"));return}const n=document.createElement("div");n.style.position="absolute",n.style.top="0",n.style.left="0",n.style.width="100%",n.style.height="100%",n.style.opacity="0",n.style.transition="opacity 1s ease",e.appendChild(n),n.addEventListener("pointerdown",a=>{a.stopPropagation()}),i.accessToken=this.mapboxConfig.accessToken;const s=new i.Map({container:n,style:`mapbox://styles/mapbox/${this.mapboxConfig.style||"streets-v12"}`,center:[this.location.lng,this.location.lat],zoom:this.location.zoom||this.mapboxConfig.zoom||15,bearing:this.location.bearing||this.mapboxConfig.bearing||0,pitch:this.location.pitch||this.mapboxConfig.pitch||0});new i.Marker({color:"#ff0000"}).setLngLat([this.location.lng,this.location.lat]).addTo(s),s.addControl(new i.NavigationControl),s.on("load",()=>{this.onImageReady=()=>{s.resize(),n.style.opacity="1",this.thumbnailImage.classList.remove("vvw--pulsing")},this.isLoadedResolved(!0)}),s.on("error",a=>{this.isLoadedRejected(a)})}getFullSizeDim(){const e=Math.min(window.innerWidth,this.mapboxConfig.width||800);return{width:e,height:e*9/16}}setFinalTransform(){return super.setFinalTransform({propagateEvent:!1})}}function F(l){return l.accessToken||console.error("Mapbox access token is required"),{name:"mapbox",onInitializeImage:t=>{const e=t.elm.config.src,i=y(e);if(i)return new w(t,l,i)},onImageView:async(t,e)=>{const i=t.images.to[Math.floor(t.images.to.length/2)];i instanceof w&&e.deactivateUi(["download","zoomIn","zoomOut"],i)}}}c.VistaMapbox=w,c.getMapboxStaticImage=x,c.mapbox=F,c.parseMapboxLocation=y,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})}));
@@ -0,0 +1,2 @@
1
+ export * from '../lib/extensions/openstreetmap'
2
+ export {}
@@ -0,0 +1,125 @@
1
+ var c = Object.defineProperty;
2
+ var d = (s, i, t) => i in s ? c(s, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[i] = t;
3
+ var r = (s, i, t) => d(s, typeof i != "symbol" ? i + "" : i, t);
4
+ import { V as p } from "../vista-box-CQvGrjln.js";
5
+ function u(s) {
6
+ if (!s) return null;
7
+ try {
8
+ const i = s.match(/(-?\d+\.?\d*),\s*(-?\d+\.?\d*),?\s*(\d+\.?\d*)?/);
9
+ if (i)
10
+ return {
11
+ lat: parseFloat(i[1]),
12
+ lng: parseFloat(i[2]),
13
+ zoom: i[3] ? parseFloat(i[3]) : void 0
14
+ };
15
+ const t = new URL(s);
16
+ if (t.hostname.includes("openstreetmap.org")) {
17
+ const a = t.hash.match(/#map=(\d+\.?\d*)\/(-?\d+\.?\d*)\/(-?\d+\.?\d*)/);
18
+ if (a)
19
+ return {
20
+ zoom: parseFloat(a[1]),
21
+ lat: parseFloat(a[2]),
22
+ lng: parseFloat(a[3])
23
+ };
24
+ const e = t.searchParams.get("mlat"), o = t.searchParams.get("mlon");
25
+ if (e && o)
26
+ return {
27
+ lat: parseFloat(e),
28
+ lng: parseFloat(o)
29
+ };
30
+ }
31
+ } catch {
32
+ }
33
+ return null;
34
+ }
35
+ function g(s, i) {
36
+ const t = s.zoom || i.zoom || 15, a = s.lat, e = s.lng, o = Math.pow(2, t), n = Math.floor((e + 180) / 360 * o), l = Math.floor(
37
+ (1 - Math.log(Math.tan(a * Math.PI / 180) + 1 / Math.cos(a * Math.PI / 180)) / Math.PI) / 2 * o
38
+ );
39
+ return `https://tile.openstreetmap.org/${t}/${n}/${l}.png`;
40
+ }
41
+ class m extends p {
42
+ constructor(t, a, e) {
43
+ var h;
44
+ super(t);
45
+ r(this, "element");
46
+ r(this, "osmConfig");
47
+ r(this, "location");
48
+ r(this, "thumbnailImage");
49
+ this.osmConfig = a, this.location = e;
50
+ const o = document.createElement("div");
51
+ o.style.position = "relative", this.thumbnailImage = document.createElement("img"), o.appendChild(this.thumbnailImage), this.thumbnailImage.src = ((h = this.origin) == null ? void 0 : h.image.src) || g(e, a), this.thumbnailImage.style.width = "100%", this.thumbnailImage.style.height = "100%", this.thumbnailImage.style.objectFit = "cover", this.thumbnailImage.classList.add("vvw--pulsing"), this.element = o, this.element.classList.add("vvw-img-hi");
52
+ const { width: n, height: l } = this.getFullSizeDim();
53
+ this.fullH = l, this.fullW = n, this.minW = this.fullW * 0.5, this.maxW = this.fullW, this.element.style.width = `${n}px`, this.element.style.height = `${l}px`, this.setSizes({ stableSize: !1, initDimension: !0 }), this.pos === 0 ? this.loadLeaflet().then(() => {
54
+ this.initializeMap(o);
55
+ }) : this.isLoadedResolved(!0);
56
+ }
57
+ async loadLeaflet() {
58
+ if (!window.L) {
59
+ if (!document.querySelector(".vistaview-leaflet-css")) {
60
+ const t = document.createElement("link");
61
+ t.rel = "stylesheet", t.href = "https://unpkg.com/leaflet@1.9.4/dist/leaflet.css", t.className = "vistaview-leaflet-css", document.head.appendChild(t);
62
+ }
63
+ if (!document.querySelector(".vistaview-leaflet-js"))
64
+ return new Promise((t, a) => {
65
+ const e = document.createElement("script");
66
+ e.src = "https://unpkg.com/leaflet@1.9.4/dist/leaflet.js", e.className = "vistaview-leaflet-js", e.onload = () => t(), e.onerror = () => a(new Error("Failed to load Leaflet")), document.head.appendChild(e);
67
+ });
68
+ }
69
+ }
70
+ initializeMap(t) {
71
+ const a = window.L;
72
+ if (!a) {
73
+ this.isLoadedRejected(new Error("Leaflet not loaded"));
74
+ return;
75
+ }
76
+ const e = document.createElement("div");
77
+ e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.width = "100%", e.style.height = "100%", e.style.opacity = "0", e.style.transition = "opacity 1s ease", t.appendChild(e), e.addEventListener("pointerdown", (h) => {
78
+ h.stopPropagation();
79
+ });
80
+ const o = a.map(e, {
81
+ center: [this.location.lat, this.location.lng],
82
+ zoom: this.location.zoom || this.osmConfig.zoom || 15
83
+ }), n = this.osmConfig.tileLayer || "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", l = this.osmConfig.attribution || '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors';
84
+ a.tileLayer(n, {
85
+ attribution: l,
86
+ maxZoom: 19
87
+ }).addTo(o), a.marker([this.location.lat, this.location.lng]).addTo(o).bindPopup(`${this.location.lat}, ${this.location.lng}`), o.whenReady(() => {
88
+ this.onImageReady = () => {
89
+ o.invalidateSize(), e.style.opacity = "1", this.thumbnailImage.classList.remove("vvw--pulsing");
90
+ }, this.isLoadedResolved(!0);
91
+ });
92
+ }
93
+ // Use 16:9 aspect ratio with max 800px width
94
+ getFullSizeDim() {
95
+ const t = Math.min(window.innerWidth, this.osmConfig.width || 800);
96
+ return {
97
+ width: t,
98
+ height: t * 9 / 16
99
+ };
100
+ }
101
+ // Override to avoid propagating content change event
102
+ setFinalTransform() {
103
+ return super.setFinalTransform({ propagateEvent: !1 });
104
+ }
105
+ }
106
+ function y(s = {}) {
107
+ return {
108
+ name: "openStreetMap",
109
+ onInitializeImage: (i) => {
110
+ const t = i.elm.config.src, a = u(t);
111
+ if (a)
112
+ return new m(i, s, a);
113
+ },
114
+ onImageView: async (i, t) => {
115
+ const a = i.images.to[Math.floor(i.images.to.length / 2)];
116
+ a instanceof m && t.deactivateUi(["download", "zoomIn", "zoomOut"], a);
117
+ }
118
+ };
119
+ }
120
+ export {
121
+ m as VistaOpenStreetMap,
122
+ g as getOpenStreetMapStaticImage,
123
+ y as openStreetMap,
124
+ u as parseOpenStreetMapLocation
125
+ };
@@ -0,0 +1 @@
1
+ (function(c,m){typeof exports=="object"&&typeof module<"u"?m(exports):typeof define=="function"&&define.amd?define(["exports"],m):(c=typeof globalThis<"u"?globalThis:c||self,m(c.VistaView=c.VistaView||{}))})(this,(function(c){"use strict";var P=Object.defineProperty;var R=(c,m,g)=>m in c?P(c,m,{enumerable:!0,configurable:!0,writable:!0,value:g}):c[m]=g;var h=(c,m,g)=>R(c,typeof m!="symbol"?m+"":m,g);function m(d){const e=window.getComputedStyle(d).objectFit||"",{width:s,height:n}=d.getBoundingClientRect(),i=d.naturalWidth,a=d.naturalHeight;if(!e)return{width:s,height:n};if(!i||!a)return{width:s,height:n};const l=i/a,r=s/n;switch(e){case"fill":return{width:s,height:n};case"none":return{width:i,height:a};case"contain":return l>r?{width:s,height:s/l}:{width:n*l,height:n};case"cover":return l<r?{width:s,height:s/l}:{width:n*l,height:n};case"scale-down":{const u={width:i,height:a},o=l>r?{width:s,height:s/l}:{width:n*l,height:n};return o.width<=u.width&&o.height<=u.height?o:u}}return{width:s,height:n}}class g{static ease(t,e,s){const n=e-t,i=t+n*.2;return Math.abs(n)<s?e:i}static play(t,e,s){if(s()){requestAnimationFrame(()=>{this.play(t,e,s)});return}this.map.get(t)&&(t.element.classList.contains("vvw--load-cancelled")||requestAnimationFrame(()=>{var o,f,p,S,x,b,W,L,C,M;const n=this.map.get(t);if(!n||!t.element||t.element.classList.contains("vvw--load-cancelled"))return;const{current:i,target:a,log:l}=n;let r={};a.width!==void 0&&(r.width=this.ease(i._width,a.width,1)),a.height!==void 0&&(r.height=this.ease(i._height,a.height,1)),((o=a.transform)==null?void 0:o.x)!==void 0&&(r.transform=r.transform||{},r.transform.x=this.ease(i._transform.x,a.transform.x,1)),((f=a.transform)==null?void 0:f.y)!==void 0&&(r.transform=r.transform||{},r.transform.y=this.ease(i._transform.y,a.transform.y,1)),((p=a.transform)==null?void 0:p.scale)!==void 0&&(r.transform=r.transform||{},r.transform.scale=this.ease(i._transform.scale,a.transform.scale,.005)),((S=a.translate)==null?void 0:S.x)!==void 0&&(r.translate=r.translate||{},r.translate.x=this.ease(i._translate.x,a.translate.x,1)),((x=a.translate)==null?void 0:x.y)!==void 0&&(r.translate=r.translate||{},r.translate.y=this.ease(i._translate.y,a.translate.y,1)),r.width!==void 0&&(i.width=r.width),r.height!==void 0&&(i.height=r.height),r.translate&&(i.translate={...i.translate,...r.translate}),r.transform&&(i.transform={...i.transform,...r.transform}),(a.width===void 0||i._width===a.width)&&(a.height===void 0||i._height===a.height)&&(((b=a.transform)==null?void 0:b.x)===void 0||i._transform.x===a.transform.x)&&(((W=a.transform)==null?void 0:W.y)===void 0||i._transform.y===a.transform.y)&&(((L=a.transform)==null?void 0:L.scale)===void 0||i._transform.scale===a.transform.scale)&&(((C=a.translate)==null?void 0:C.x)===void 0||i._translate.x===a.translate.x)&&(((M=a.translate)==null?void 0:M.y)===void 0||i._translate.y===a.translate.y)?(this.map.delete(t),e()):(this.map.set(t,{current:i,target:a,log:l}),this.play(t,e,s))}))}static stop(t){const e=this.map.get(t);return this.map.delete(t),e}static start({vistaImage:t,target:e,onComplete:s,shouldWait:n}){this.stop(t),this.map.set(t,{current:t.state,target:e}),this.play(t,s,n)}}h(g,"map",new Map);class _{constructor(t){h(this,"state");h(this,"parsedSrcSet");h(this,"isReady",!1);h(this,"isThrowing",!1);h(this,"thumb",null);h(this,"pos");h(this,"index");h(this,"config");h(this,"origin");h(this,"initH",0);h(this,"initW",0);h(this,"fullH",0);h(this,"fullW",0);h(this,"maxW",0);h(this,"minW",0);h(this,"defaultWH",200);h(this,"isZoomedIn",!1);h(this,"isCancelled",!1);h(this,"isLoadedResolved",null);h(this,"isLoadedRejected",null);h(this,"isLoaded",new Promise((t,e)=>{this.isLoadedResolved=t,this.isLoadedRejected=e}));h(this,"replacement",null);h(this,"originalParent",null);h(this,"originalNextSibling",null);h(this,"originalStyle","");h(this,"thumbImage",null);h(this,"fittedSize",null);h(this,"maxZoomLevel");h(this,"vistaView");h(this,"transitionState",null);h(this,"transitionShouldWait",()=>!1);h(this,"initPointerCenter",{x:0,y:0});h(this,"onScale");var s;this.state=this.createState(),this.pos=t.pos,this.index=t.index,this.config=t.elm.config,this.parsedSrcSet=t.elm.parsedSrcSet,this.origin=t.elm.origin,this.maxZoomLevel=t.maxZoomLevel,this.vistaView=t.vistaView,this.onScale=t.onScale,t.transitionState&&(this.transitionState=t.transitionState),t.transitionShouldWait&&(this.transitionShouldWait=t.transitionShouldWait),this.initPointerCenter={x:window.innerWidth/2,y:window.innerHeight/2};const e=this.pos===0?(s=this.origin)==null?void 0:s.image:null;if(this.originalParent=(e==null?void 0:e.parentElement)||null,this.originalNextSibling=(e==null?void 0:e.nextSibling)||null,e&&this.originalParent){this.originalStyle=e.style.cssText,this.thumbImage=e;const n=e.cloneNode(!0);this.originalParent.insertBefore(n,e),this.replacement=n,this.thumb=document.createElement("div"),this.thumb.classList.add("vvw-img-lo");const{width:i,height:a}=this.thumbImage?m(this.thumbImage):{width:0,height:0};this.fittedSize={width:i,height:a},this.thumb.appendChild(e),e.style.width="100%",e.style.height="100%",e.style.objectFit=this.origin.objectFit}}createState(){const t=this;return{_t:this,_width:0,_height:0,_transform:{x:0,y:0,scale:1},_translate:{x:0,y:0},_lessThanMinWidth:!1,get width(){return this._width},set width(e){this._width=e,t.onWidthChange(e)},get height(){return this._height},set height(e){this._height=e,t.onHeightChange(e)},get transform(){return this._transform},set transform(e){this._transform=e,t.onTransformChange(e)},get translate(){return this._translate},set translate(e){this._translate=e,t.onTranslateChange(e)},get lessThanMinWidth(){return this._lessThanMinWidth},set lessThanMinWidth(e){this._lessThanMinWidth=e,t.onLessThanMinWidthChange(e)}}}onLessThanMinWidthChange(t){t?this.element.style.opacity="0.5":this.element.style.opacity=""}onTranslateChange(t){this.element.style.translate=`calc(-50% + ${t.x}px) calc(-50% + ${t.y}px)`}onTransformChange(t){const e=`translate3d(${t.x}px, ${t.y}px, 0px) scale3d(${t.scale}, ${t.scale}, 1)`;this.element.style.transform=e}onWidthChange(t){this.element.style.width=`${t}px`}onHeightChange(t){this.element.style.height=`${t}px`}onImageReady(){}animateZoom(t,e){}scaleMove(t,e,s){}momentumThrow(t){return()=>{}}async init(){await this.isLoaded;const t=this.element;this.transitionState&&this.transitionState.current.width&&this.transitionState.current.height?(this.state.width=this.transitionState.current.width,this.state.height=this.transitionState.current.height):t.classList.contains("vvw--loaded")||(this.state.width=this.initW,this.state.height=this.initH);const e=()=>{this.isCancelled||g.start({vistaImage:this,target:{width:this.fullW,height:this.fullH},onComplete:()=>{this.isCancelled||(this.isReady=!0,t.classList.add("vvw--ready"),this.onImageReady())},shouldWait:this.transitionShouldWait})};this.pos<-1||this.pos>1?(this.state.width=this.fullW,this.state.height=this.fullH,t.classList.add("vvw--loaded"),t.classList.add("vvw--ready"),this.isReady=!0):t.classList.contains("vvw--loaded")?t.classList.contains("vvw--ready")?(this.isReady=!0,this.onImageReady()):e():(t.classList.add("vvw--loaded"),setTimeout(()=>{this.isCancelled||e()},333))}getFullSizeDim(){const{width:t,height:e}=this.thumb.getBoundingClientRect(),s=t/e;let n=window.innerWidth,i=window.innerHeight;return s>window.innerWidth/window.innerHeight?i=n/s:n=i*s,{width:n,height:i}}setSizes(t={}){var l,r,u;const{stableSize:e=!0,initDimension:s}=t;if(!this.origin)return;const n=this.thumb;let i={width:this.defaultWH,height:this.defaultWH,top:0,left:0};if(n){i=(((l=this.origin)==null?void 0:l.anchor)||this.replacement).getBoundingClientRect();const o=n.style;o.width=i.width+"px",o.height=i.height+"px",o.top="50%",o.left="50%",o.translate="-50% -50%",o.position="fixed",o.objectFit=this.origin.objectFit,o.borderRadius=this.origin.borderRadius;const f=Math.min(Math.max(i.left,-i.width),window.innerWidth+i.width)-window.innerWidth/2+i.width/2,p=Math.min(Math.max(i.top,-i.height),window.innerHeight+i.height)-window.innerHeight/2+i.height/2;o.setProperty("--vvw-init-radius",o.borderRadius),o.setProperty("--vvw-pulse-radius",`calc(1.3 * ${o.borderRadius})`),o.setProperty("--vvw-init-x",`${f}px`),o.setProperty("--vvw-init-y",`${p}px`),s&&(o.setProperty("--vvw-current-x",`${f}px`),o.setProperty("--vvw-current-y",`${p}px`))}if(!s){const{width:o,height:f}=this.thumbImage?m(this.thumbImage):{width:0,height:0};this.fittedSize={width:o,height:f}}const a=this.element;if(this.initW=Math.min(((r=this.fittedSize)==null?void 0:r.width)??0,i.width),this.initH=Math.min(((u=this.fittedSize)==null?void 0:u.height)??0,i.height),a.style.setProperty("--vvw-init-w",this.initW+"px"),a.style.setProperty("--vvw-init-h",this.initH+"px"),a.style.setProperty("--vvw-init-radius",this.origin.borderRadius),a.style.objectFit="cover",!s){if(this.isReady&&!this.isCancelled){const{width:o,height:f}=this.getFullSizeDim();this.fullH=f,this.fullW=o,this.minW=this.fullW*.5}!this.isZoomedIn&&e&&this.normalize()}}normalize(){this.state.transform={x:0,y:0,scale:1},this.state.translate={x:0,y:0},this.state.width=this.fullW,this.state.height=this.fullH,this.isZoomedIn=!1}getFromParsedSrcSet(t){if(!this.parsedSrcSet||this.parsedSrcSet.length===0)return null;const e=t*(window.devicePixelRatio||1);let s=this.parsedSrcSet[this.parsedSrcSet.length-1];for(const n of this.parsedSrcSet)if(n.width>=e){s=n;break}return s.src}prepareClose(){g.stop(this),this.setFinalTransform()}cancelPendingLoad(){var t;this.isCancelled=!0,(t=this.element)==null||t.classList.add("vvw--load-cancelled")}setInitialCenter(t){this.initPointerCenter=t}destroy(){var t,e;this.originalParent&&this.thumbImage&&(this.thumbImage.style.cssText=this.originalStyle,this.originalNextSibling?this.originalParent.insertBefore(this.thumbImage,this.originalNextSibling):this.originalParent.appendChild(this.thumbImage)),this.originalParent=null,this.originalNextSibling=null,this.originalStyle="",this.thumbImage=null,this.replacement&&(this.replacement.remove(),this.replacement=null),(t=this.thumb)==null||t.remove(),(e=this.element)==null||e.remove(),this.thumb=null,this.origin=void 0,this.config={src:"",alt:""}}cloneStyleFrom(t,e){t!=null&&t.element&&(e&&(this.transitionState=e||null),t.element.classList.contains("vvw--loaded")&&(this.element.classList.add("vvw--loaded"),this.state.width=t.state.width,this.state.height=t.state.height),t.element.classList.contains("vvw--ready")&&this.element.classList.add("vvw--ready"))}toObject(){return structuredClone({config:{src:this.config.src,alt:this.config.alt,srcSet:this.config.srcSet},origin:this.origin?{src:this.origin.src,srcSet:this.origin.srcSet,borderRadius:this.origin.borderRadius,objectFit:this.origin.objectFit}:null,parsedSrcSet:this.parsedSrcSet,element:"src"in this.element?this.element.src:this.element.toString(),thumb:void 0,index:this.index,pos:this.pos,state:{width:this.state._width,height:this.state._height,transform:this.state._transform,translate:this.state._translate}})}setFinalTransform(t={}){const{propagateEvent:e=!0}=t;if(this.isReady){if(this.state.translate.x+=this.state.transform.x,this.state.translate.y+=this.state.transform.y,this.state.width*=this.state.transform.scale,this.state.height*=this.state.transform.scale,Math.abs(this.state.width-this.fullW)<1&&(this.state.width=this.fullW,this.state.height=this.fullH),Math.abs(this.state.translate.x)<1&&(this.state.translate.x=0),Math.abs(this.state.translate.y)<1&&(this.state.translate.y=0),this.state.translate={...this.state.translate},this.state.transform={x:0,y:0,scale:1},e){const s=this.toObject();this.vistaView.options.onContentChange&&this.vistaView.options.onContentChange(s,this.vistaView),this.vistaView.state.extensions.forEach(n=>{n.onContentChange&&n.onContentChange(s,this.vistaView)})}return{close:!0,cancel:()=>{}}}}}function y(d){if(!d)return null;try{const t=d.match(/(-?\d+\.?\d*),\s*(-?\d+\.?\d*),?\s*(\d+\.?\d*)?/);if(t)return{lat:parseFloat(t[1]),lng:parseFloat(t[2]),zoom:t[3]?parseFloat(t[3]):void 0};const e=new URL(d);if(e.hostname.includes("openstreetmap.org")){const s=e.hash.match(/#map=(\d+\.?\d*)\/(-?\d+\.?\d*)\/(-?\d+\.?\d*)/);if(s)return{zoom:parseFloat(s[1]),lat:parseFloat(s[2]),lng:parseFloat(s[3])};const n=e.searchParams.get("mlat"),i=e.searchParams.get("mlon");if(n&&i)return{lat:parseFloat(n),lng:parseFloat(i)}}}catch{}return null}function v(d,t){const e=d.zoom||t.zoom||15,s=d.lat,n=d.lng,i=Math.pow(2,e),a=Math.floor((n+180)/360*i),l=Math.floor((1-Math.log(Math.tan(s*Math.PI/180)+1/Math.cos(s*Math.PI/180))/Math.PI)/2*i);return`https://tile.openstreetmap.org/${e}/${a}/${l}.png`}class w extends _{constructor(e,s,n){var r;super(e);h(this,"element");h(this,"osmConfig");h(this,"location");h(this,"thumbnailImage");this.osmConfig=s,this.location=n;const i=document.createElement("div");i.style.position="relative",this.thumbnailImage=document.createElement("img"),i.appendChild(this.thumbnailImage),this.thumbnailImage.src=((r=this.origin)==null?void 0:r.image.src)||v(n,s),this.thumbnailImage.style.width="100%",this.thumbnailImage.style.height="100%",this.thumbnailImage.style.objectFit="cover",this.thumbnailImage.classList.add("vvw--pulsing"),this.element=i,this.element.classList.add("vvw-img-hi");const{width:a,height:l}=this.getFullSizeDim();this.fullH=l,this.fullW=a,this.minW=this.fullW*.5,this.maxW=this.fullW,this.element.style.width=`${a}px`,this.element.style.height=`${l}px`,this.setSizes({stableSize:!1,initDimension:!0}),this.pos===0?this.loadLeaflet().then(()=>{this.initializeMap(i)}):this.isLoadedResolved(!0)}async loadLeaflet(){if(!window.L){if(!document.querySelector(".vistaview-leaflet-css")){const e=document.createElement("link");e.rel="stylesheet",e.href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css",e.className="vistaview-leaflet-css",document.head.appendChild(e)}if(!document.querySelector(".vistaview-leaflet-js"))return new Promise((e,s)=>{const n=document.createElement("script");n.src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js",n.className="vistaview-leaflet-js",n.onload=()=>e(),n.onerror=()=>s(new Error("Failed to load Leaflet")),document.head.appendChild(n)})}}initializeMap(e){const s=window.L;if(!s){this.isLoadedRejected(new Error("Leaflet not loaded"));return}const n=document.createElement("div");n.style.position="absolute",n.style.top="0",n.style.left="0",n.style.width="100%",n.style.height="100%",n.style.opacity="0",n.style.transition="opacity 1s ease",e.appendChild(n),n.addEventListener("pointerdown",r=>{r.stopPropagation()});const i=s.map(n,{center:[this.location.lat,this.location.lng],zoom:this.location.zoom||this.osmConfig.zoom||15}),a=this.osmConfig.tileLayer||"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",l=this.osmConfig.attribution||'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors';s.tileLayer(a,{attribution:l,maxZoom:19}).addTo(i),s.marker([this.location.lat,this.location.lng]).addTo(i).bindPopup(`${this.location.lat}, ${this.location.lng}`),i.whenReady(()=>{this.onImageReady=()=>{i.invalidateSize(),n.style.opacity="1",this.thumbnailImage.classList.remove("vvw--pulsing")},this.isLoadedResolved(!0)})}getFullSizeDim(){const e=Math.min(window.innerWidth,this.osmConfig.width||800);return{width:e,height:e*9/16}}setFinalTransform(){return super.setFinalTransform({propagateEvent:!1})}}function F(d={}){return{name:"openStreetMap",onInitializeImage:t=>{const e=t.elm.config.src,s=y(e);if(s)return new w(t,d,s)},onImageView:async(t,e)=>{const s=t.images.to[Math.floor(t.images.to.length/2)];s instanceof w&&e.deactivateUi(["download","zoomIn","zoomOut"],s)}}}c.VistaOpenStreetMap=w,c.getOpenStreetMapStaticImage=v,c.openStreetMap=F,c.parseOpenStreetMapLocation=y,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})}));
@@ -0,0 +1,2 @@
1
+ export * from '../lib/extensions/streamable-video'
2
+ export {}
@@ -0,0 +1,76 @@
1
+ var u = Object.defineProperty;
2
+ var f = (e, t, i) => t in e ? u(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i;
3
+ var o = (e, t, i) => f(e, typeof t != "symbol" ? t + "" : t, i);
4
+ import { V as p } from "../vista-box-CQvGrjln.js";
5
+ function r(e) {
6
+ if (!e) return null;
7
+ const t = [/streamable\.com\/e\/([a-zA-Z0-9]+)/, /streamable\.com\/([a-zA-Z0-9]+)/];
8
+ for (const i of t) {
9
+ const l = e.match(i);
10
+ if (l && l[1])
11
+ return l[1];
12
+ }
13
+ return null;
14
+ }
15
+ function g(e) {
16
+ const t = r(e);
17
+ if (!t)
18
+ throw new Error("Invalid Streamable video URL");
19
+ return `https://cdn-cf-east.streamable.com/image/${t}.jpg`;
20
+ }
21
+ class d extends p {
22
+ constructor(i) {
23
+ var h;
24
+ super(i);
25
+ o(this, "element");
26
+ o(this, "url");
27
+ const l = i.elm.config.src;
28
+ this.url = l;
29
+ const a = document.createElement("div");
30
+ a.style.position = "relative";
31
+ const n = document.createElement("img");
32
+ a.appendChild(n), n.src = ((h = this.origin) == null ? void 0 : h.image.src) || g(l), n.style.width = "100%", n.style.height = "100%", n.style.objectFit = "cover", n.classList.add("vvw--pulsing"), this.element = a, this.element.classList.add("vvw-img-hi");
33
+ const { width: m, height: c } = this.getFullSizeDim();
34
+ if (this.fullH = c, this.fullW = m, this.minW = this.fullW * 0.5, this.maxW = this.fullW, this.element.style.width = `${m}px`, this.element.style.height = `${c}px`, this.setSizes({ stableSize: !1, initDimension: !0 }), this.pos === 0) {
35
+ const s = document.createElement("iframe");
36
+ s.frameBorder = "0", s.allow = "autoplay; fullscreen", s.allowFullscreen = !0, s.width = "100%", s.height = "100%", s.style.position = "absolute", s.style.top = "0", s.style.left = "0", s.style.opacity = "0", s.style.transition = "opacity 1s ease", s.src = `https://streamable.com/e/${r(l)}?autoplay=1`, a.appendChild(s), s.onload = () => {
37
+ s.style.opacity = "1", n.classList.remove("vvw--pulsing");
38
+ };
39
+ }
40
+ this.isLoadedResolved(!0);
41
+ }
42
+ // the default full size is the scaled thumbnail size
43
+ // so we change it to 16:9 full window width size (or max 800px)
44
+ getFullSizeDim() {
45
+ const i = Math.min(window.innerWidth, 800);
46
+ return {
47
+ width: i,
48
+ height: i * 9 / 16
49
+ };
50
+ }
51
+ // override to avoid propagating content change event
52
+ // (because no change will happen on iframe)
53
+ setFinalTransform() {
54
+ return super.setFinalTransform({ propagateEvent: !1 });
55
+ }
56
+ }
57
+ function w() {
58
+ return {
59
+ name: "streamableVideo",
60
+ onInitializeImage: (e) => {
61
+ const t = e.elm.config.src;
62
+ if (r(t))
63
+ return new d(e);
64
+ },
65
+ onImageView: async (e, t) => {
66
+ const i = e.images.to[Math.floor(e.images.to.length / 2)];
67
+ i instanceof d && t.deactivateUi(["download", "zoomIn", "zoomOut"], i);
68
+ }
69
+ };
70
+ }
71
+ export {
72
+ d as VistaStreamableVideo,
73
+ g as getStreamableThumbnail,
74
+ r as parseStreamableVideoId,
75
+ w as streamableVideo
76
+ };
@@ -0,0 +1 @@
1
+ (function(m,f){typeof exports=="object"&&typeof module<"u"?f(exports):typeof define=="function"&&define.amd?define(["exports"],f):(m=typeof globalThis<"u"?globalThis:m||self,f(m.VistaView=m.VistaView||{}))})(this,(function(m){"use strict";var F=Object.defineProperty;var P=(m,f,g)=>f in m?F(m,f,{enumerable:!0,configurable:!0,writable:!0,value:g}):m[f]=g;var h=(m,f,g)=>P(m,typeof f!="symbol"?f+"":f,g);function f(d){const e=window.getComputedStyle(d).objectFit||"",{width:s,height:a}=d.getBoundingClientRect(),i=d.naturalWidth,n=d.naturalHeight;if(!e)return{width:s,height:a};if(!i||!n)return{width:s,height:a};const c=i/n,r=s/a;switch(e){case"fill":return{width:s,height:a};case"none":return{width:i,height:n};case"contain":return c>r?{width:s,height:s/c}:{width:a*c,height:a};case"cover":return c<r?{width:s,height:s/c}:{width:a*c,height:a};case"scale-down":{const o={width:i,height:n},l=c>r?{width:s,height:s/c}:{width:a*c,height:a};return l.width<=o.width&&l.height<=o.height?l:o}}return{width:s,height:a}}class g{static ease(t,e,s){const a=e-t,i=t+a*.2;return Math.abs(a)<s?e:i}static play(t,e,s){if(s()){requestAnimationFrame(()=>{this.play(t,e,s)});return}this.map.get(t)&&(t.element.classList.contains("vvw--load-cancelled")||requestAnimationFrame(()=>{var l,u,w,S,b,x,W,_,C,L;const a=this.map.get(t);if(!a||!t.element||t.element.classList.contains("vvw--load-cancelled"))return;const{current:i,target:n,log:c}=a;let r={};n.width!==void 0&&(r.width=this.ease(i._width,n.width,1)),n.height!==void 0&&(r.height=this.ease(i._height,n.height,1)),((l=n.transform)==null?void 0:l.x)!==void 0&&(r.transform=r.transform||{},r.transform.x=this.ease(i._transform.x,n.transform.x,1)),((u=n.transform)==null?void 0:u.y)!==void 0&&(r.transform=r.transform||{},r.transform.y=this.ease(i._transform.y,n.transform.y,1)),((w=n.transform)==null?void 0:w.scale)!==void 0&&(r.transform=r.transform||{},r.transform.scale=this.ease(i._transform.scale,n.transform.scale,.005)),((S=n.translate)==null?void 0:S.x)!==void 0&&(r.translate=r.translate||{},r.translate.x=this.ease(i._translate.x,n.translate.x,1)),((b=n.translate)==null?void 0:b.y)!==void 0&&(r.translate=r.translate||{},r.translate.y=this.ease(i._translate.y,n.translate.y,1)),r.width!==void 0&&(i.width=r.width),r.height!==void 0&&(i.height=r.height),r.translate&&(i.translate={...i.translate,...r.translate}),r.transform&&(i.transform={...i.transform,...r.transform}),(n.width===void 0||i._width===n.width)&&(n.height===void 0||i._height===n.height)&&(((x=n.transform)==null?void 0:x.x)===void 0||i._transform.x===n.transform.x)&&(((W=n.transform)==null?void 0:W.y)===void 0||i._transform.y===n.transform.y)&&(((_=n.transform)==null?void 0:_.scale)===void 0||i._transform.scale===n.transform.scale)&&(((C=n.translate)==null?void 0:C.x)===void 0||i._translate.x===n.translate.x)&&(((L=n.translate)==null?void 0:L.y)===void 0||i._translate.y===n.translate.y)?(this.map.delete(t),e()):(this.map.set(t,{current:i,target:n,log:c}),this.play(t,e,s))}))}static stop(t){const e=this.map.get(t);return this.map.delete(t),e}static start({vistaImage:t,target:e,onComplete:s,shouldWait:a}){this.stop(t),this.map.set(t,{current:t.state,target:e}),this.play(t,s,a)}}h(g,"map",new Map);class R{constructor(t){h(this,"state");h(this,"parsedSrcSet");h(this,"isReady",!1);h(this,"isThrowing",!1);h(this,"thumb",null);h(this,"pos");h(this,"index");h(this,"config");h(this,"origin");h(this,"initH",0);h(this,"initW",0);h(this,"fullH",0);h(this,"fullW",0);h(this,"maxW",0);h(this,"minW",0);h(this,"defaultWH",200);h(this,"isZoomedIn",!1);h(this,"isCancelled",!1);h(this,"isLoadedResolved",null);h(this,"isLoadedRejected",null);h(this,"isLoaded",new Promise((t,e)=>{this.isLoadedResolved=t,this.isLoadedRejected=e}));h(this,"replacement",null);h(this,"originalParent",null);h(this,"originalNextSibling",null);h(this,"originalStyle","");h(this,"thumbImage",null);h(this,"fittedSize",null);h(this,"maxZoomLevel");h(this,"vistaView");h(this,"transitionState",null);h(this,"transitionShouldWait",()=>!1);h(this,"initPointerCenter",{x:0,y:0});h(this,"onScale");var s;this.state=this.createState(),this.pos=t.pos,this.index=t.index,this.config=t.elm.config,this.parsedSrcSet=t.elm.parsedSrcSet,this.origin=t.elm.origin,this.maxZoomLevel=t.maxZoomLevel,this.vistaView=t.vistaView,this.onScale=t.onScale,t.transitionState&&(this.transitionState=t.transitionState),t.transitionShouldWait&&(this.transitionShouldWait=t.transitionShouldWait),this.initPointerCenter={x:window.innerWidth/2,y:window.innerHeight/2};const e=this.pos===0?(s=this.origin)==null?void 0:s.image:null;if(this.originalParent=(e==null?void 0:e.parentElement)||null,this.originalNextSibling=(e==null?void 0:e.nextSibling)||null,e&&this.originalParent){this.originalStyle=e.style.cssText,this.thumbImage=e;const a=e.cloneNode(!0);this.originalParent.insertBefore(a,e),this.replacement=a,this.thumb=document.createElement("div"),this.thumb.classList.add("vvw-img-lo");const{width:i,height:n}=this.thumbImage?f(this.thumbImage):{width:0,height:0};this.fittedSize={width:i,height:n},this.thumb.appendChild(e),e.style.width="100%",e.style.height="100%",e.style.objectFit=this.origin.objectFit}}createState(){const t=this;return{_t:this,_width:0,_height:0,_transform:{x:0,y:0,scale:1},_translate:{x:0,y:0},_lessThanMinWidth:!1,get width(){return this._width},set width(e){this._width=e,t.onWidthChange(e)},get height(){return this._height},set height(e){this._height=e,t.onHeightChange(e)},get transform(){return this._transform},set transform(e){this._transform=e,t.onTransformChange(e)},get translate(){return this._translate},set translate(e){this._translate=e,t.onTranslateChange(e)},get lessThanMinWidth(){return this._lessThanMinWidth},set lessThanMinWidth(e){this._lessThanMinWidth=e,t.onLessThanMinWidthChange(e)}}}onLessThanMinWidthChange(t){t?this.element.style.opacity="0.5":this.element.style.opacity=""}onTranslateChange(t){this.element.style.translate=`calc(-50% + ${t.x}px) calc(-50% + ${t.y}px)`}onTransformChange(t){const e=`translate3d(${t.x}px, ${t.y}px, 0px) scale3d(${t.scale}, ${t.scale}, 1)`;this.element.style.transform=e}onWidthChange(t){this.element.style.width=`${t}px`}onHeightChange(t){this.element.style.height=`${t}px`}onImageReady(){}animateZoom(t,e){}scaleMove(t,e,s){}momentumThrow(t){return()=>{}}async init(){await this.isLoaded;const t=this.element;this.transitionState&&this.transitionState.current.width&&this.transitionState.current.height?(this.state.width=this.transitionState.current.width,this.state.height=this.transitionState.current.height):t.classList.contains("vvw--loaded")||(this.state.width=this.initW,this.state.height=this.initH);const e=()=>{this.isCancelled||g.start({vistaImage:this,target:{width:this.fullW,height:this.fullH},onComplete:()=>{this.isCancelled||(this.isReady=!0,t.classList.add("vvw--ready"),this.onImageReady())},shouldWait:this.transitionShouldWait})};this.pos<-1||this.pos>1?(this.state.width=this.fullW,this.state.height=this.fullH,t.classList.add("vvw--loaded"),t.classList.add("vvw--ready"),this.isReady=!0):t.classList.contains("vvw--loaded")?t.classList.contains("vvw--ready")?(this.isReady=!0,this.onImageReady()):e():(t.classList.add("vvw--loaded"),setTimeout(()=>{this.isCancelled||e()},333))}getFullSizeDim(){const{width:t,height:e}=this.thumb.getBoundingClientRect(),s=t/e;let a=window.innerWidth,i=window.innerHeight;return s>window.innerWidth/window.innerHeight?i=a/s:a=i*s,{width:a,height:i}}setSizes(t={}){var c,r,o;const{stableSize:e=!0,initDimension:s}=t;if(!this.origin)return;const a=this.thumb;let i={width:this.defaultWH,height:this.defaultWH,top:0,left:0};if(a){i=(((c=this.origin)==null?void 0:c.anchor)||this.replacement).getBoundingClientRect();const l=a.style;l.width=i.width+"px",l.height=i.height+"px",l.top="50%",l.left="50%",l.translate="-50% -50%",l.position="fixed",l.objectFit=this.origin.objectFit,l.borderRadius=this.origin.borderRadius;const u=Math.min(Math.max(i.left,-i.width),window.innerWidth+i.width)-window.innerWidth/2+i.width/2,w=Math.min(Math.max(i.top,-i.height),window.innerHeight+i.height)-window.innerHeight/2+i.height/2;l.setProperty("--vvw-init-radius",l.borderRadius),l.setProperty("--vvw-pulse-radius",`calc(1.3 * ${l.borderRadius})`),l.setProperty("--vvw-init-x",`${u}px`),l.setProperty("--vvw-init-y",`${w}px`),s&&(l.setProperty("--vvw-current-x",`${u}px`),l.setProperty("--vvw-current-y",`${w}px`))}if(!s){const{width:l,height:u}=this.thumbImage?f(this.thumbImage):{width:0,height:0};this.fittedSize={width:l,height:u}}const n=this.element;if(this.initW=Math.min(((r=this.fittedSize)==null?void 0:r.width)??0,i.width),this.initH=Math.min(((o=this.fittedSize)==null?void 0:o.height)??0,i.height),n.style.setProperty("--vvw-init-w",this.initW+"px"),n.style.setProperty("--vvw-init-h",this.initH+"px"),n.style.setProperty("--vvw-init-radius",this.origin.borderRadius),n.style.objectFit="cover",!s){if(this.isReady&&!this.isCancelled){const{width:l,height:u}=this.getFullSizeDim();this.fullH=u,this.fullW=l,this.minW=this.fullW*.5}!this.isZoomedIn&&e&&this.normalize()}}normalize(){this.state.transform={x:0,y:0,scale:1},this.state.translate={x:0,y:0},this.state.width=this.fullW,this.state.height=this.fullH,this.isZoomedIn=!1}getFromParsedSrcSet(t){if(!this.parsedSrcSet||this.parsedSrcSet.length===0)return null;const e=t*(window.devicePixelRatio||1);let s=this.parsedSrcSet[this.parsedSrcSet.length-1];for(const a of this.parsedSrcSet)if(a.width>=e){s=a;break}return s.src}prepareClose(){g.stop(this),this.setFinalTransform()}cancelPendingLoad(){var t;this.isCancelled=!0,(t=this.element)==null||t.classList.add("vvw--load-cancelled")}setInitialCenter(t){this.initPointerCenter=t}destroy(){var t,e;this.originalParent&&this.thumbImage&&(this.thumbImage.style.cssText=this.originalStyle,this.originalNextSibling?this.originalParent.insertBefore(this.thumbImage,this.originalNextSibling):this.originalParent.appendChild(this.thumbImage)),this.originalParent=null,this.originalNextSibling=null,this.originalStyle="",this.thumbImage=null,this.replacement&&(this.replacement.remove(),this.replacement=null),(t=this.thumb)==null||t.remove(),(e=this.element)==null||e.remove(),this.thumb=null,this.origin=void 0,this.config={src:"",alt:""}}cloneStyleFrom(t,e){t!=null&&t.element&&(e&&(this.transitionState=e||null),t.element.classList.contains("vvw--loaded")&&(this.element.classList.add("vvw--loaded"),this.state.width=t.state.width,this.state.height=t.state.height),t.element.classList.contains("vvw--ready")&&this.element.classList.add("vvw--ready"))}toObject(){return structuredClone({config:{src:this.config.src,alt:this.config.alt,srcSet:this.config.srcSet},origin:this.origin?{src:this.origin.src,srcSet:this.origin.srcSet,borderRadius:this.origin.borderRadius,objectFit:this.origin.objectFit}:null,parsedSrcSet:this.parsedSrcSet,element:"src"in this.element?this.element.src:this.element.toString(),thumb:void 0,index:this.index,pos:this.pos,state:{width:this.state._width,height:this.state._height,transform:this.state._transform,translate:this.state._translate}})}setFinalTransform(t={}){const{propagateEvent:e=!0}=t;if(this.isReady){if(this.state.translate.x+=this.state.transform.x,this.state.translate.y+=this.state.transform.y,this.state.width*=this.state.transform.scale,this.state.height*=this.state.transform.scale,Math.abs(this.state.width-this.fullW)<1&&(this.state.width=this.fullW,this.state.height=this.fullH),Math.abs(this.state.translate.x)<1&&(this.state.translate.x=0),Math.abs(this.state.translate.y)<1&&(this.state.translate.y=0),this.state.translate={...this.state.translate},this.state.transform={x:0,y:0,scale:1},e){const s=this.toObject();this.vistaView.options.onContentChange&&this.vistaView.options.onContentChange(s,this.vistaView),this.vistaView.state.extensions.forEach(a=>{a.onContentChange&&a.onContentChange(s,this.vistaView)})}return{close:!0,cancel:()=>{}}}}}function p(d){if(!d)return null;const t=[/streamable\.com\/e\/([a-zA-Z0-9]+)/,/streamable\.com\/([a-zA-Z0-9]+)/];for(const e of t){const s=d.match(e);if(s&&s[1])return s[1]}return null}function v(d){const t=p(d);if(!t)throw new Error("Invalid Streamable video URL");return`https://cdn-cf-east.streamable.com/image/${t}.jpg`}class y extends R{constructor(e){var r;super(e);h(this,"element");h(this,"url");const s=e.elm.config.src;this.url=s;const a=document.createElement("div");a.style.position="relative";const i=document.createElement("img");a.appendChild(i),i.src=((r=this.origin)==null?void 0:r.image.src)||v(s),i.style.width="100%",i.style.height="100%",i.style.objectFit="cover",i.classList.add("vvw--pulsing"),this.element=a,this.element.classList.add("vvw-img-hi");const{width:n,height:c}=this.getFullSizeDim();if(this.fullH=c,this.fullW=n,this.minW=this.fullW*.5,this.maxW=this.fullW,this.element.style.width=`${n}px`,this.element.style.height=`${c}px`,this.setSizes({stableSize:!1,initDimension:!0}),this.pos===0){const o=document.createElement("iframe");o.frameBorder="0",o.allow="autoplay; fullscreen",o.allowFullscreen=!0,o.width="100%",o.height="100%",o.style.position="absolute",o.style.top="0",o.style.left="0",o.style.opacity="0",o.style.transition="opacity 1s ease",o.src=`https://streamable.com/e/${p(s)}?autoplay=1`,a.appendChild(o),o.onload=()=>{o.style.opacity="1",i.classList.remove("vvw--pulsing")}}this.isLoadedResolved(!0)}getFullSizeDim(){const e=Math.min(window.innerWidth,800);return{width:e,height:e*9/16}}setFinalTransform(){return super.setFinalTransform({propagateEvent:!1})}}function H(){return{name:"streamableVideo",onInitializeImage:d=>{const t=d.elm.config.src;if(p(t))return new y(d)},onImageView:async(d,t)=>{const e=d.images.to[Math.floor(d.images.to.length/2)];e instanceof y&&t.deactivateUi(["download","zoomIn","zoomOut"],e)}}}m.VistaStreamableVideo=y,m.getStreamableThumbnail=v,m.parseStreamableVideoId=p,m.streamableVideo=H,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})}));
@@ -0,0 +1,2 @@
1
+ export * from '../lib/extensions/vidyard-video'
2
+ export {}