@iiif/vault-helpers
Advanced tools
Comparing version 0.9.6 to 0.9.7
@@ -1,2 +0,3 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var g=require("@atlas-viewer/iiif-image-api");function p(e){return{addEventListener(t,a,n,f){if(!!t)return e.setMetaValue([t.id,"eventManager",a],r=>{const c=r||[];for(const i of c)if(i.callback===n)return c;return[...c,{callback:n,scope:f}]}),n},removeEventListener(t,a,n){!t||e.setMetaValue([t.id,"eventManager",a],f=>(f||[]).filter(r=>r.callback!==n))},getListenersAsProps(t,a){const n=typeof t=="string"?{id:t}:t;if(!n||!n.id)return{};const f=e.getResourceMeta(n.id,"eventManager"),r={};if(f&&n)for(const c of Object.keys(f))r[c]=i=>{const l=e.get(n);for(const{callback:o,scope:s}of f[c]||[])(!s||a&&s.indexOf(a)!==-1)&&o(i,l)};return r}}}function v(e){return{applyStyles(t,a,n){const f=typeof t=="string"?t:t.id;return e.setMetaValue([f,"styles",a],n)},getAppliedStyles(t){const a=typeof t=="string"?t:t.id;return e.getResourceMeta(a,"styles")}}}function m(e,t={}){const a=t.imageServiceLoader||new g.ImageServiceLoader;async function n(f,r,c,i=[],l){if(typeof f=="string")return{best:g.getFixedSizeFromImage(f),fallback:[],log:[]};const o=e.get(f);if(typeof o=="string")return{best:g.getFixedSizeFromImage(o),fallback:[],log:[]};switch(o.type){case"Annotation":{const s=o.body,u=e.get(s[0]);return l&&!u.width&&(u.width=l.width,u.height=l.height),await a.getThumbnailFromResource(u,r,c,i)}case"Canvas":{const s=o;if(s.thumbnail&&s.thumbnail.length){const u=e.get(s.thumbnail[0]),h=await a.getImageCandidates(u,c);h&&h.length&&i.push(...h)}return n(s.items[0],r,c,i,{width:s.width,height:s.height})}case"AnnotationPage":return n(o.items[0],r,c,i,l);case"Choice":return n(o.items[0],r,c,i,l);case"Collection":{const u=o.items[0];return n(u,r,c,i,l)}case"Manifest":{const u=o.items[0];return n(u,r,c,i,l)}case"SpecificResource":case"Image":case"Dataset":case"Sound":case"Text":case"TextualBody":case"Video":return l&&!o.width&&(o.width=l.width,o.height=l.height),a.getThumbnailFromResource(o,r,c,i);case"Service":case"Range":case"AnnotationCollection":case"CanvasReference":case"ContentResource":return{best:void 0,fallback:[],log:[]}}return{best:void 0,fallback:[],log:[]}}return{getBestThumbnailAtSize:n}}function b(e,t,a=[],n=!1){if(!e||!t||t.length===0)return;if(t.length===1)return t[0];if(t.indexOf(e)!==-1)return e;const f=e.indexOf("-")!==-1?e.slice(0,e.indexOf("-")):null;if(f&&t.indexOf(f)!==-1)return f;for(const r of a)if(t.indexOf(r)!==-1)return r;if(!n){const c=t.map(i=>i.indexOf("-")!==-1?i.slice(0,i.indexOf("-")):null).indexOf(e);if(c!==-1)return t[c];for(const i of a){const l=i.indexOf("-")!==-1?i.slice(0,i.indexOf("-")):null,o=l?t.indexOf(l):-1;if(o!==-1)return t[o]}}return t.indexOf("none")!==-1?"none":t.indexOf("@none")!==-1?"@none":t[0]}function d(e,t,a={}){const{strictFallback:n=!1,defaultText:f="",separator:r=` | ||
`,fallbackLanguages:c=[],closest:i}=a,l=Object.keys(e||{}),o=i?t:b(t,l,c,n);if(!e)return f;if(typeof e=="string")return e;const s=o?e[o]:void 0;return s?typeof s=="string"?s:s.join(r):""}function y(e,t={}){return d(e,typeof navigator!="undefined"?navigator.language:void 0,t)}exports.buildLocaleString=d,exports.createEventsHelper=p,exports.createStylesHelper=v,exports.createThumbnailHelper=m,exports.getClosestLanguage=b,exports.getValue=y; | ||
"use strict";var ue=Object.defineProperty,pe=Object.defineProperties;var de=Object.getOwnPropertyDescriptors;var k=Object.getOwnPropertySymbols;var me=Object.prototype.hasOwnProperty,ge=Object.prototype.propertyIsEnumerable;var R=(e,t,i)=>t in e?ue(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,O=(e,t)=>{for(var i in t||(t={}))me.call(t,i)&&R(e,i,t[i]);if(k)for(var i of k(t))ge.call(t,i)&&R(e,i,t[i]);return e},F=(e,t)=>pe(e,de(t));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function ye(e){return{addEventListener(t,i,r,o){if(!!t)return e.setMetaValue([t.id,"eventManager",i],n=>{const s=n||[];for(const a of s)if(a.callback===r)return s;return[...s,{callback:r,scope:o}]}),r},removeEventListener(t,i,r){!t||e.setMetaValue([t.id,"eventManager",i],o=>(o||[]).filter(n=>n.callback!==r))},getListenersAsProps(t,i){const r=typeof t=="string"?{id:t}:t;if(!r||!r.id)return{};const o=e.getResourceMeta(r.id,"eventManager"),n={};if(o&&r)for(const s of Object.keys(o))n[s]=a=>{const f=e.get(r);for(const{callback:l,scope:c}of o[s]||[])(!c||i&&c.indexOf(i)!==-1)&&l(a,f)};return n}}}function xe(e){return{applyStyles(t,i,r){const o=typeof t=="string"?t:t.id;return e.setMetaValue([o,"styles",i],r)},getAppliedStyles(t){const i=typeof t=="string"?t:t.id;return e.getResourceMeta(i,"styles")}}}function x(e){return e.endsWith("info.json")?e:e.endsWith("/")?`${e}info.json`:`${e}/info.json`}const ve="http://library.stanford.edu/iiif/image-api/compliance.html#level0",E="http://library.stanford.edu/iiif/image-api/compliance.html#level1",H="http://library.stanford.edu/iiif/image-api/compliance.html#level2",we="http://library.stanford.edu/iiif/image-api/conformance.html#level0",$="http://library.stanford.edu/iiif/image-api/conformance.html#level1",Q="http://library.stanford.edu/iiif/image-api/conformance.html#level2",be="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0",L="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1",q="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2",Se="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0",N="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1",U="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2",Oe="http://iiif.io/api/image/1/level0.json",Fe="http://iiif.io/api/image/1/profiles/level0.json",_="http://iiif.io/api/image/1/level1.json",J="http://iiif.io/api/image/1/profiles/level1.json",V="http://iiif.io/api/image/1/level2.json",D="http://iiif.io/api/image/1/profiles/level2.json",Ae="http://iiif.io/api/image/2/level0.json",je="http://iiif.io/api/image/2/profiles/level0.json",Z="http://iiif.io/api/image/2/level1.json",G="http://iiif.io/api/image/2/profiles/level1.json",K="http://iiif.io/api/image/2/level2.json",X="http://iiif.io/api/image/2/profiles/level2.json",Ce="level0",Y="level1",ee="level2",Ie="http://iiif.io/api/image/2/level0",te="http://iiif.io/api/image/2/level1",ie="http://iiif.io/api/image/2/level2",re=[ie,H,Q,q,U,V,D,K,X,ee],ne=[...re,te,E,$,L,N,_,J,Z,G,Y],ke=[Ie,te,ie,ve,E,H,we,$,Q,be,L,q,Se,N,U,Oe,Fe,_,J,V,D,Ae,je,Z,G,K,X,Ce,Y,ee],Re={extraFormats:["jpg"],extraQualities:["default"],extraFeatures:["sizeByWhListed"]},We={extraFormats:["jpg"],extraQualities:["default"],extraFeatures:["baseUriRedirect","cors","jsonldMediaType","regionByPx","regionSquare","sizeByWhListed","sizeByH","sizeByW","sizeByWh"]},ze={extraFormats:["jpg","png"],extraQualities:["default"],extraFeatures:["baseUriRedirect","cors","jsonldMediaType","regionByPct","regionByPx","regionSquare","rotationBy90s","sizeByWhListed","sizeByConfinedWh","sizeByH","sizeByPct","sizeByW","sizeByWh"]};function Pe(e){return re.indexOf(e)!==-1?ze:ne.indexOf(e)!==-1?We:Re}function Be(e){const t=e?Array.isArray(e.profile)?e.profile:[e.profile]:[],i={extraQualities:[],extraFormats:[],extraFeatures:[]};for(let r of t)if(typeof r=="string"&&(r=Pe(r)),!!r){if(r.formats)for(const o of r.formats)i.extraFormats.indexOf(o)===-1&&i.extraFormats.push(o);if(r.qualities)for(const o of r.qualities)i.extraQualities.indexOf(o)===-1&&i.extraQualities.push(o);if(r.supports)for(const o of r.supports)i.extraFeatures.indexOf(o)===-1&&i.extraFeatures.push(o);if(r.maxHeight&&(i.maxHeight=r.maxHeight),r.maxWidth&&(i.maxWidth=r.maxWidth),r.maxArea&&(i.maxArea=r.maxArea),r.extraFormats)for(const o of r.extraFormats)i.extraFormats.indexOf(o)===-1&&i.extraFormats.push(o);if(r.extraQualities)for(const o of r.extraQualities)i.extraQualities.indexOf(o)===-1&&i.extraQualities.push(o);if(r.extraFeatures)for(const o of r.extraFeatures)i.extraFeatures.indexOf(o)===-1&&i.extraFeatures.push(o);r.maxHeight&&(i.maxHeight=r.maxHeight),r.maxWidth&&(i.maxWidth=r.maxWidth),r.maxArea&&(i.maxArea=r.maxArea)}if(e.extraFormats)for(const r of e.extraFormats)i.extraFormats.indexOf(r)===-1&&i.extraFormats.push(r);if(e.extraFeatures)for(const r of e.extraFeatures)i.extraFeatures.indexOf(r)===-1&&i.extraFeatures.push(r);if(e.extraQualities)for(const r of e.extraQualities)i.extraQualities.indexOf(r)===-1&&i.extraQualities.push(r);return i}function Me(e){try{if(e==="full")return{full:!0};if(e==="square")return{square:!0};const t=e.startsWith("pct:"),i=e.substr(t?4:0).split(",").map(r=>parseFloat(r));return{x:i[0],y:i[1],w:i[2],h:i[3],percent:t}}catch{throw new Error("Expected 'full', 'square' or 'x,y,w,h'. Found "+e)}}function Te(e){const t={upscaled:!1,max:!1,confined:!1};if(e[0]==="^"&&(t.upscaled=!0,e=e.slice(1)),e==="max"||e==="full")return t.max=!0,t.serialiseAsFull=e==="full",t;if(e[0]==="!"&&(t.confined=!0,e=e.slice(1)),e[0]==="p")return t.percentScale=parseFloat(e.slice(4)),t;const i=e.split(",").map(r=>r.trim());return i.length&&(i[0]!==""&&(t.width=parseInt(i[0],10)),i[1]!==""&&(t.height=parseInt(i[1],10))),t}function Ee(e){const t={angle:0};if(e[0]==="!"&&(t.mirror=!0,e=e.substr(1)),t.angle=parseFloat(e)%360,Number.isNaN(t.angle))throw new Error(`Invalid rotation ${e}`);return t}function He(e,t=""){const i=e.match(/^(([a-zA-Z]+):\/\/([^/]+))?((.*)+)/);if(!i)throw new Error(`Invalid or unknown input ${e}`);const r=i[2],o=i[3];let n=i[4];if(n[0]==="/"&&(n=n.substr(1)),t.length>0){if(t[0]==="/"&&(t=t.substr(1)),t!==n.substr(0,t.length))throw new Error(`Path does not start with prefix (path: ${n}, prefix: ${t})`);n=n.substr(t.length)}return{scheme:r,server:o,path:n,prefix:t}}function $e(e,t=""){const{path:i,scheme:r,server:o,prefix:n}=He(e,t),s=i.split("/").reverse(),[a,f,l,c,...p]=s,d=p.reverse().filter(Boolean).join("/");if(s.length===1||a==="")return{type:"base",scheme:r,server:o,prefix:n,identifier:d};if(a==="info.json"){const[,...g]=s;return{type:"info",scheme:r,server:o,prefix:n,identifier:g.reverse().filter(Boolean).join("/")}}const u=a.split(".");return{type:"image",scheme:r,server:o,prefix:n,identifier:d,originalPath:i,region:Me(c),size:Te(l),rotation:Ee(f),quality:u[0],format:u[1]}}function Qe(e){const t=$e(x(e.id));if(t.type!=="info")throw new Error("Invalid service URL");const i=Be(e);return{identifier:t.identifier,originalPath:"",server:t.server,prefix:t.prefix,scheme:t.scheme,type:"image",quality:i.extraQualities.indexOf("default")===-1?i.extraQualities[0]:"default",region:{full:!0},size:{max:!0,upscaled:!1,confined:!1},format:"jpg",rotation:{angle:0}}}function Le(e,t,i){const r=i.length,o=[];for(let n=0;n<r;n++){const s=i[n].width;o.push(e/s)}return o}function qe(e,t,i){const r=i.length,o=[];for(let n=0;n<r;n++){const s=i[n];o.push({width:Math.floor(e/s),height:Math.floor(t/s)})}return o}function h(e){if(e["@id"])return e["@id"];if(e.id)return e.id}function I(e){if(!e||!e.profile||!h(e))return!1;const t=Array.isArray(e.profile)?e.profile:[e.profile];for(const i of t)if(typeof i=="string"&&ke.indexOf(i)!==-1)return!0;return!1}function Ne(e){if(!I(e))return!1;const t=Array.isArray(e.profile)?e.profile:[e.profile];for(const i of t)if(typeof i=="string"){if(ne.indexOf(i)!==-1)return!0}else{const r=[...i.supports||[],...i.extraFeatures||[]];if(r.indexOf("regionByPx")!==-1&&(r.indexOf("sizeByW")!==-1||r.indexOf("sizeByWh")!==-1))return!0}return!1}function Ue(e){if(!Ne(e))return[];const t=[],i=Array.isArray(e.profile)?e.profile:[e.profile],r=i.length;for(let o=0;o<r;o++){const n=i[o];if(typeof n!="string"&&(n.maxHeight||n.maxWidth))return[{id:h(e),type:"variable",minWidth:0,minHeight:0,maxHeight:n.maxHeight||n.maxWidth,maxWidth:n.maxWidth||n.maxHeight}]}if(e.tiles){const o=e.tiles.length;for(let n=0;n<o;n++){const s=e.tiles[n];(s.height||s.width)&&t.push({id:h(e),type:"variable",minHeight:0,minWidth:0,maxHeight:s.height||s.width,maxWidth:s.width})}}return t}function W(e){const t=/^.*\/(full)\/(((\d+),(\d+)?)|max)\/(\d+)\/default\.(jpg|png|jpeg)$/,i=e.match(t);if(i){const r=i[1],o=parseInt(i[4],10),n=parseInt(i[5],10),s=i[7];if((r==="max"||r==="full")&&o&&n&&s)return{type:"fixed",id:e,height:n,width:o}}return{type:"unknown",id:e}}function _e(e){if(e["@type"])return e["@type"];if(e.type)return e.type}function j(e){if(typeof e=="string")return W(e);const t=_e(e);if(t!=="Image"&&t!=="sc:Image")return null;const i=e,r=h(i);return r?r&&i.width&&i.height?{id:r,type:"fixed",width:i.width,height:i.height,unsafe:!0}:W(r):null}function Je(e){return I(e)?(e&&e.sizes?e.sizes:[]).map(t=>({id:h(e),type:"fixed-service",height:t.height,width:t.width})):[]}function z(e){const t=[],i=e.length;for(let r=0;r<i;r++){const o=Je(e[r]);o.length&&t.push(...o);const n=Ue(e[r]);n.length&&t.push(...n)}return t}function oe(e){const t=e.service?Array.isArray(e.service)?e.service:[e.service]:[],i=t.length,r=[];for(let o=0;o<i;o++)I(t[o])&&r.push(t[o]);return r}function Ve(e,t=!0,i){const r=[],o=j(e);if(o===null)return r;const n=e;if(r.push(o),t&&n.width&&n.height){const s=[],a=oe(n);for(const f of a){const l={id:h(f),width:n.width,height:n.height};if(i.canLoadSync(l)){const c=i.loadServiceSync(l);c&&(c.height||(c.height=n.height),c.width||(c.width=n.width),s.push(...z([c])))}}if(s.length)return r.push(...s),r}return n.service&&r.push(...z(n.service)),r}function De({x:e=0,y:t=0,w:i,h:r,full:o,square:n,percent:s}){if(o)return"full";if(n)return"square";if(typeof i>"u"||typeof r>"u")throw new Error("RegionParameter: invalid region");const a=`${e},${t},${i},${r}`;return s?`pct:${a}`:a}function Ze({max:e,percentScale:t,upscaled:i,confined:r,width:o,height:n,serialiseAsFull:s}){const a=[];return i&&a.push("^"),e?(a.push(s?"full":"max"),a.join("")):(r&&a.push("!"),t&&a.push(`pct:${t}`),o&&a.push(`${o}`),a.push(","),n&&a.push(`${n}`),a.join(""))}function Ge(e){return`${e.mirror?"!":""}${(e.angle||0)%360}`}var Ke=Object.defineProperty,Xe=Object.defineProperties,Ye=Object.getOwnPropertyDescriptors,P=Object.getOwnPropertySymbols,et=Object.prototype.hasOwnProperty,tt=Object.prototype.propertyIsEnumerable,B=(e,t,i)=>t in e?Ke(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,w=(e,t)=>{for(var i in t||(t={}))et.call(t,i)&&B(e,i,t[i]);if(P)for(var i of P(t))tt.call(t,i)&&B(e,i,t[i]);return e},b=(e,t)=>Xe(e,Ye(t));function it(e,t){const i=e.prefix.startsWith("/")?e.prefix.substr(1):e.prefix,r=`${e.scheme}://${e.server}/${i?`${i}/`:""}${e.identifier}`;if(e.type==="base")return r;if(e.type==="info")return`${r}/info.json`;let{region:o,size:n,rotation:s,format:a,quality:f}=e;if(t){const l=t["@context"]?Array.isArray(t["@context"])?t["@context"]:[t["@context"]]:[],c=l.indexOf("http://iiif.io/api/image/2/context.json")!==-1,p=l.indexOf("http://iiif.io/api/image/3/context.json")!==-1;if((n.width===t.width&&!n.height||n.height===t.height&&!n.width||n.width===t.width&&n.height===t.height)&&(n=b(w({},n),{max:!0})),c&&(n.max&&!n.serialiseAsFull&&(n=b(w({},n),{serialiseAsFull:!0})),!n.max&&n.width&&n.height&&(n=b(w({},n),{height:void 0}))),p&&(n.max&&n.serialiseAsFull&&(n=b(w({},n),{serialiseAsFull:!1})),n.width&&!n.height&&t.width&&t.height)){const d=t.height/t.width;n=b(w({},n),{height:Math.ceil(n.width*d)})}}return[r,De(o),Ze(n),Ge(s),`${f}.${a}`].filter(Boolean).join("/")}function A(e,t,i){const r=Qe({id:x(h(e)),profile:"level2",type:"ImageService2"});if(r.type!=="image")throw new Error("Invalid service");return r.size.max=!1,r.size.width=t,r.size.height=i,{id:it(r),type:"fixed",width:t,height:i||e.height/(e.width||1)*t,unsafe:e.width>t}}function v(e){const t=e.replace(/(https?:\/\/)?(www.)?/i,"");return t.indexOf("/")!==-1?t.split("/")[0]:t}function rt(e,t,i){const r=e.width?e.width:e.maxWidth;return i.height<=e.maxHeight&&i.width<=e.maxWidth&&i.height>=e.minHeight&&i.width>=e.minWidth&&(!t||Math.abs(i.width-r)<Math.abs(t.width-r))}function nt(e,t){const i=[],r=Object.assign({unsafeImageService:!1,atAnyCost:!0,fallback:!0,minHeight:64,minWidth:64,maxHeight:1/0,maxWidth:1/0,returnAllOptions:!1,preferFixedSize:!1,allowUnsafe:!1,explain:!1,height:0,width:0},e),o=[],n=[];let s=null;const a=(l,c)=>{if(rt(r,c,l)){if(r.preferFixedSize&&l.unsafe){n.push(l);return}r.returnAllOptions&&c&&n.push(c),s=l}else r.returnAllOptions&&n.push(l)},f=t.length;for(let l=0;l<f;l++){const c=t[l](),p=c.length;for(let d=0;d<p;d++){const u=c[d];if(u.type==="unknown"&&r.atAnyCost&&o.push(u),u.type==="fixed"&&(u.unsafe?o.push(u):a(u,s)),u.type==="fixed-service")if(r.unsafeImageService){const g=A(u,r.width,r.height);a(g,s)}else{const g=A(u,u.width,u.height);a(g,s)}if(u.type==="variable"&&u.maxWidth){const g=A({id:u.id,type:"fixed-service",width:u.maxWidth,height:u.maxWidth},u.maxWidth);a(g,s)}}if(s&&!r.returnAllOptions){if(s.unsafe||r.allowUnsafe)continue;break}}return r.atAnyCost&&n.length===0?{best:s||o[0],fallback:o.slice(1),log:i}:r.returnAllOptions?{best:r.atAnyCost?s||n[0]||o[0]:s||n[0],fallback:[...n,...o],log:i}:{best:s||n[0]||null,fallback:s?n:n.slice(1),log:i}}var ot=Object.defineProperty,st=Object.defineProperties,at=Object.getOwnPropertyDescriptors,M=Object.getOwnPropertySymbols,lt=Object.prototype.hasOwnProperty,ct=Object.prototype.propertyIsEnumerable,T=(e,t,i)=>t in e?ot(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,ft=(e,t)=>{for(var i in t||(t={}))lt.call(t,i)&&T(e,i,t[i]);if(M)for(var i of M(t))ct.call(t,i)&&T(e,i,t[i]);return e},ht=(e,t)=>st(e,at(t));function ut(e,t,i){const r=e>t?e:t,o=i.length,n=[];for(let s=0;s<o;s++){const a=i[s];let f=a.scaleFactors[0],l=r/f;const c=[f];for(;l>=a.width;)f=f*2,c.push(f),l=l/2;n.push(ht(ft({},a),{scaleFactors:c}))}return n}function pt(e,t){if(e.length!==t.length)return!1;if(e.length===0&&t.length===0)return!0;const i=e.length;let r=!0;for(let n=0;n<i;n++){const s=e[n],a=t[n];if(s.width!==a.width||s.height!==a.height){r=!1;break}}if(r)return!0;let o=0;for(let n=0;n<i;n++)for(let s=0;s<i;s++)if(e[n].width===t[s].width&&e[n].height===t[s].height){o++;break}return o===i}var y=(e,t,i)=>new Promise((r,o)=>{var n=f=>{try{a(i.next(f))}catch(l){o(l)}},s=f=>{try{a(i.throw(f))}catch(l){o(l)}},a=f=>f.done?r(f.value):Promise.resolve(f.value).then(n,s);a((i=i.apply(e,t)).next())});class se{constructor(){this.config={verificationsRequired:1,approximateServices:!0,enableFetching:!0,disableThrottling:!1},this.fetchingCount=0,this.imageServices={},this.knownImageServers={}}setConfig(t){Object.assign(this.config,t)}sample(t,i,r=!0){const o=v(h(t)),n=x(h(t)),s=this.knownImageServers[o];return this.imageServices[n]=Object.assign(t,{real:!0}),s?this.verify(t):(this.knownImageServers[o]={verifications:0,malformed:!1,root:o,preLoaded:r,sampledId:h(t),verified:!1,server:null,result:{context:t["@context"]||[],sampledProfile:t.profile,resourceServiceRatio:i&&t.height?i.height/t.height:1,sampledSizes:t.sizes||[],sizeRatios:Le(t.width,t.height,t.sizes||[]),sampledTiles:t.tiles||[]}},!0)}preLoad(t,i=!0){this.knownImageServers[t.root]=t,i&&(this.knownImageServers[t.root].malformed=!1,this.knownImageServers[t.root].verifications=this.config.verificationsRequired)}predict(t,i=!1,r=!1){const o=t==null?void 0:t.source,n=v(h(t)),s=this.knownImageServers[n];if(!s||!s.result||!r&&(s.malformed||s.verifications<this.config.verificationsRequired))return null;const a=x(h(t));return this.imageServices[a]||(this.imageServices[a]={"@context":s.result.context,"@id":h(t),id:h(t),protocol:"http://iiif.io/api/image",tiles:(o==null?void 0:o.tiles)||ut(t.width,t.height,s.result.sampledTiles),sizes:(o==null?void 0:o.sizes)||qe(Math.round(t.width/s.result.resourceServiceRatio),Math.round(t.height/s.result.resourceServiceRatio),s.result.sizeRatios),profile:(o==null?void 0:o.profile)||s.result.sampledProfile,height:(o==null?void 0:o.height)||t.height,width:(o==null?void 0:o.width)||t.width,real:!1}),this.imageServices[a]}getThumbnailFromResource(t,i){return y(this,arguments,function*(r,o,n=!0,s=[]){const a=yield this.getImageCandidates(r,n);return nt(o,[()=>s,()=>a])})}getImageCandidates(t,i=!0){return y(this,null,function*(){const r=t;if(i&&r.height&&r.width){const o=oe(r);for(const n of o){const s={id:h(n),width:n.width?n.width:r.width,height:n.height?n.height:r.height,source:n};yield this.loadService(s)}}return Ve(t,i,this)})}verify(t){return y(this,null,function*(){const i=this.predict(t,!1,!0),r=yield this.fetchService(h(t));if(!i)return!1;const o=i.height===r.height&&i.width===r.width&&i["@context"]===r["@context"]&&pt(i.sizes||[],r.sizes||[]);if(o){const n=v(h(t));this.knownImageServers[n].verifications+=1,this.knownImageServers[n].verifications>=this.config.verificationsRequired&&(this.knownImageServers[n].verified=!0)}return o})}canLoadSync(t){const i=typeof t=="string"?t:h(t),r=x(i);if(this.imageServices[r])return!0;const o=this.knownImageServers[v(i)];return o&&!o.malformed&&o.verifications>=this.config.verificationsRequired}markAsMalformed(t){return y(this,null,function*(){return this.knownImageServers[v(h(t))].malformed=!0,this.loadService(t,!0)})}fetchService(t,i=!1){return y(this,null,function*(){const r=x(t);if(this.imageServices[r]&&(!i||this.imageServices[r].real))return this.imageServices[r];if(!this.config.enableFetching)throw new Error("Fetching is not enabled");const o=yield this.fetch(r).then(n=>n.json());return!o.id&&o["@id"]&&(o.id=o["@id"]),o.id!==t&&(o.id=t,o["@id"]&&(o["@id"]=t)),this.imageServices[r]=Object.assign(o,{real:!0}),this.imageServices[r]})}fetch(t,i){return y(this,null,function*(){return fetch(t,i)})}loadService(t,i=!1){return y(this,null,function*(){if(!this.config.disableThrottling){let n=!0;for(;n;)if(this.fetchingCount>=this.config.verificationsRequired)yield new Promise(s=>setTimeout(s,500));else{n=!1;break}}const r=this.knownImageServers[v(h(t))];if(r&&!r.malformed&&!i){yield r.result;const n=this.loadServiceSync(t);if(n)return n}this.fetchingCount++;const o=yield this.fetchService(h(t),i);return this.fetchingCount--,o.real&&this.sample(o,t),o})}loadServiceSync(t){const i=x(h(t));return this.imageServices[i]?this.imageServices[i]:this.predict(t)}}new se;function dt(e,t={}){const i=t.imageServiceLoader||new se;async function r(o,n,s,a=[],f){if(typeof o=="string")return{best:j(o),fallback:[],log:[]};const l=e.get(o);if(typeof l=="string")return{best:j(l),fallback:[],log:[]};switch(l.type){case"Annotation":{const c=l.body,p=e.get(c[0]);return f&&!p.width&&(p.width=f.width,p.height=f.height),await i.getThumbnailFromResource(p,n,s,a)}case"Canvas":{const c=l;if(c.thumbnail&&c.thumbnail.length){const p=e.get(c.thumbnail[0]),d=await i.getImageCandidates(p,s);d&&d.length&&a.push(...d)}return r(c.items[0],n,s,a,{width:c.width,height:c.height})}case"AnnotationPage":return r(l.items[0],n,s,a,f);case"Choice":return r(l.items[0],n,s,a,f);case"Collection":{const p=l.items[0];return r(p,n,s,a,f)}case"Manifest":{const p=l.items[0];return r(p,n,s,a,f)}case"SpecificResource":case"Image":case"Dataset":case"Sound":case"Text":case"TextualBody":case"Video":return f&&!l.width&&(l.width=f.width,l.height=f.height),i.getThumbnailFromResource(l,n,s,a);case"Service":case"Range":case"AnnotationCollection":case"CanvasReference":case"ContentResource":return{best:void 0,fallback:[],log:[]}}return{best:void 0,fallback:[],log:[]}}return{getBestThumbnailAtSize:r}}function ae(e,t,i=[],r=!1){if(!e||!t||t.length===0)return;if(t.length===1)return t[0];if(t.indexOf(e)!==-1)return e;const o=e.indexOf("-")!==-1?e.slice(0,e.indexOf("-")):null;if(o&&t.indexOf(o)!==-1)return o;for(const n of i)if(t.indexOf(n)!==-1)return n;if(!r){const s=t.map(a=>a.indexOf("-")!==-1?a.slice(0,a.indexOf("-")):null).indexOf(e);if(s!==-1)return t[s];for(const a of i){const f=a.indexOf("-")!==-1?a.slice(0,a.indexOf("-")):null,l=f?t.indexOf(f):-1;if(l!==-1)return t[l]}}return t.indexOf("none")!==-1?"none":t.indexOf("@none")!==-1?"@none":t[0]}function le(e,t,i={}){const{strictFallback:r=!1,defaultText:o="",separator:n=` | ||
`,fallbackLanguages:s=[],closest:a}=i,f=Object.keys(e||{}),l=a?t:ae(t,f,s,r);if(!e)return o;if(typeof e=="string")return e;const c=l?e[l]:void 0;return c?typeof c=="string"?c:c.join(n):""}function mt(e,t={}){return le(e,typeof navigator!="undefined"?navigator.language:void 0,t)}const gt=/&?(xywh=)?(pixel:|percent:|pct:)?([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?)/,yt=/&?(t=)(npt:)?([0-9]+(.[0-9]+)?)?(,([0-9]+(.[0-9]+)?))?/;function S(e){if(Array.isArray(e))return e.reduce((t,i)=>{const{selector:r,selectors:o}=S(i);return r&&(t.selector||(t.selector=r),t.selectors.push(...o)),t},{selector:null,selectors:[]});if(!e)return{selector:null,selectors:[]};if(typeof e=="string"){const[t,i]=e.split("#");return i?S({type:"FragmentSelector",value:i}):{selector:null,selectors:[]}}if(e.type==="PointSelector"&&(e.t||e.t===0)){const t={type:"TemporalSelector",temporal:{startTime:e.t}};return{selector:t,selectors:[t]}}if(e.type==="FragmentSelector"){const t=gt.exec(e.value);if(t){const r={type:"BoxSelector",spatial:{unit:t[2]==="percent:"||t[2]==="pct:"?"percent":"pixel",x:parseFloat(t[3]),y:parseFloat(t[4]),width:parseFloat(t[5]),height:parseFloat(t[6])}};return{selector:r,selectors:[r]}}const i=e.value.match(yt);if(i){const r={type:"TemporalSelector",temporal:{startTime:i[4]?parseFloat(i[4]):0,endTime:i[7]?parseFloat(i[7]):void 0}};return{selector:r,selectors:[r]}}return{selector:null,selectors:[]}}return{selector:null,selectors:[]}}function m(e,t={}){if(Array.isArray(e))return m(e[0]);if(typeof e=="string"){const[i,r]=e.split("#");return r?m({type:"SpecificResource",source:{id:i,type:"Unknown"},selector:{type:"FragmentSelector",value:r}}):{type:"SpecificResource",source:{id:i,type:t.typeMap&&t.typeMap[i]||"Unknown"},selector:null,selectors:[]}}if(e.type==="Choice"||e.type==="List"||e.type==="Composite"||e.type==="Independents")return m(e.items[0]);if(e.type==="SpecificResource"){e.source.type==="Canvas"&&e.source.partOf&&typeof e.source.partOf=="string"&&(e.source.partOf=[{id:e.source.partOf,type:"Manifest"}]);const{selector:i,selectors:r}=e.selector?S(e.selector):{selector:null,selectors:[]};return{type:"SpecificResource",source:e.source,selector:i,selectors:r}}if(e.id){e.type==="Canvas"&&e.partOf&&typeof e.partOf=="string"&&(e.partOf=[{id:e.partOf,type:"Manifest"}]);const[i,r]=e.id.split("#");return r?m({type:"SpecificResource",source:F(O({},e),{id:i}),selector:{type:"FragmentSelector",value:r}}):{type:"SpecificResource",source:F(O({},e),{id:i}),selector:null,selectors:[]}}return{type:"SpecificResource",source:e,selector:null,selectors:[]}}function C(e,t=!1){if(typeof e=="string"){if(e.startsWith("{"))try{const i=JSON.parse(e);return C(i)}catch{return[!1,{reason:"Invalid JSON"}]}return[!0]}if(Array.isArray(e)){for(const i of e){const[r,o]=C(i);if(!r&&o)return[r,o]}return[!0]}return e.type==="Annotation"?[!0]:t&&e.type==="Canvas"&&!e.partOf?[!1,{reason:"Canvas without partOf cannot be loaded"}]:[!0]}function xt(e){return fe(typeof e=="string"?e:JSON.stringify(e))}function ce(e,t){if(e=e.trim(),e[0]==="{")return t?Promise.resolve(JSON.parse(e)):JSON.parse(e);if(e.startsWith("http")){if(!t)throw new Error("Cannot fetch remote fetch with async=false in parseContentState");return fetch(e).then(i=>i.json())}return ce(he(e),t)}function fe(e){const t=encodeURIComponent(e);return(typeof btoa=="undefined"?Buffer.from(t,"utf-8").toString("base64"):btoa(t)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function he(e){const i=vt(e).replace(/-/g,"+").replace(/_/g,"/"),r=typeof atob=="undefined"?Buffer.from(i,"base64").toString("utf-8"):atob(i);return decodeURIComponent(r).trim()}function vt(e){const t=e.length%4;if(t===1)throw new Error("InvalidLengthError: Input base64url string is the wrong length to determine padding");return e+(t?"====".slice(0,4-t):"")}function wt(e){if(!e)throw new Error("Content state is empty");Array.isArray(e)||(e=[e]);let t="vault://virtual-annotation/"+new Date().getTime();const i=[];for(const r of e){if(typeof r=="string")throw new Error("Content state is a [String] type and cannot be inferred");if(r.type==="Annotation"){if(t=r.id,Array.isArray(r.motivation))for(const n of r.motivation);if(Array.isArray(r.target))for(const n of r.target){const s=m(n);i.push(s)}else{const n=m(r.target);i.push(n)}continue}const o=m(r);i.push(o)}return{id:t,type:"Annotation",motivation:["contentState",...e.motivation||[]],target:i,extensions:{}}}exports.buildLocaleString=le;exports.createEventsHelper=ye;exports.createStylesHelper=xe;exports.createThumbnailHelper=dt;exports.decodeContentState=he;exports.encodeContentState=fe;exports.expandTarget=m;exports.getClosestLanguage=ae;exports.getValue=mt;exports.normaliseContentState=wt;exports.parseContentState=ce;exports.parseSelector=S;exports.serialiseContentState=xt;exports.validateContentState=C; | ||
//# sourceMappingURL=index.js.map |
@@ -1,1 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});function u(c){return{addEventListener(t,n,e,r){if(!!t)return c.setMetaValue([t.id,"eventManager",n],o=>{const s=o||[];for(const a of s)if(a.callback===e)return s;return[...s,{callback:e,scope:r}]}),e},removeEventListener(t,n,e){!t||c.setMetaValue([t.id,"eventManager",n],r=>(r||[]).filter(o=>o.callback!==e))},getListenersAsProps(t,n){const e=typeof t=="string"?{id:t}:t;if(!e||!e.id)return{};const r=c.getResourceMeta(e.id,"eventManager"),o={};if(r&&e)for(const s of Object.keys(r))o[s]=a=>{const f=c.get(e);for(const{callback:l,scope:i}of r[s]||[])(!i||n&&i.indexOf(n)!==-1)&&l(a,f)};return o}}}exports.createEventsHelper=u; | ||
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function u(a){return{addEventListener(t,n,e,r){if(!!t)return a.setMetaValue([t.id,"eventManager",n],o=>{const s=o||[];for(const c of s)if(c.callback===e)return s;return[...s,{callback:e,scope:r}]}),e},removeEventListener(t,n,e){!t||a.setMetaValue([t.id,"eventManager",n],r=>(r||[]).filter(o=>o.callback!==e))},getListenersAsProps(t,n){const e=typeof t=="string"?{id:t}:t;if(!e||!e.id)return{};const r=a.getResourceMeta(e.id,"eventManager"),o={};if(r&&e)for(const s of Object.keys(r))o[s]=c=>{const f=a.get(e);for(const{callback:l,scope:i}of r[s]||[])(!i||n&&i.indexOf(n)!==-1)&&l(c,f)};return o}}}exports.createEventsHelper=u; | ||
//# sourceMappingURL=events.js.map |
@@ -1,2 +0,3 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});function O(t,e,i=[],l=!1){if(!t||!e||e.length===0)return;if(e.length===1)return e[0];if(e.indexOf(t)!==-1)return t;const n=t.indexOf("-")!==-1?t.slice(0,t.indexOf("-")):null;if(n&&e.indexOf(n)!==-1)return n;for(const o of i)if(e.indexOf(o)!==-1)return o;if(!l){const c=e.map(r=>r.indexOf("-")!==-1?r.slice(0,r.indexOf("-")):null).indexOf(t);if(c!==-1)return e[c];for(const r of i){const d=r.indexOf("-")!==-1?r.slice(0,r.indexOf("-")):null,f=d?e.indexOf(d):-1;if(f!==-1)return e[f]}}return e.indexOf("none")!==-1?"none":e.indexOf("@none")!==-1?"@none":e[0]}function u(t,e,i={}){const{strictFallback:l=!1,defaultText:n="",separator:o=` | ||
`,fallbackLanguages:c=[],closest:r}=i,d=Object.keys(t||{}),f=r?e:O(e,d,c,l);if(!t)return n;if(typeof t=="string")return t;const s=f?t[f]:void 0;return s?typeof s=="string"?s:s.join(o):""}function x(t,e={}){return u(t,typeof navigator!="undefined"?navigator.language:void 0,e)}exports.buildLocaleString=u,exports.getClosestLanguage=O,exports.getValue=x; | ||
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function u(t,e,f=[],l=!1){if(!t||!e||e.length===0)return;if(e.length===1)return e[0];if(e.indexOf(t)!==-1)return t;const n=t.indexOf("-")!==-1?t.slice(0,t.indexOf("-")):null;if(n&&e.indexOf(n)!==-1)return n;for(const o of f)if(e.indexOf(o)!==-1)return o;if(!l){const d=e.map(r=>r.indexOf("-")!==-1?r.slice(0,r.indexOf("-")):null).indexOf(t);if(d!==-1)return e[d];for(const r of f){const c=r.indexOf("-")!==-1?r.slice(0,r.indexOf("-")):null,i=c?e.indexOf(c):-1;if(i!==-1)return e[i]}}return e.indexOf("none")!==-1?"none":e.indexOf("@none")!==-1?"@none":e[0]}function O(t,e,f={}){const{strictFallback:l=!1,defaultText:n="",separator:o=` | ||
`,fallbackLanguages:d=[],closest:r}=f,c=Object.keys(t||{}),i=r?e:u(e,c,d,l);if(!t)return n;if(typeof t=="string")return t;const s=i?t[i]:void 0;return s?typeof s=="string"?s:s.join(o):""}function x(t,e={}){return O(t,typeof navigator!="undefined"?navigator.language:void 0,e)}exports.buildLocaleString=O;exports.getClosestLanguage=u;exports.getValue=x; | ||
//# sourceMappingURL=i18n.js.map |
@@ -1,2 +0,3 @@ | ||
(function(u,d){typeof exports=="object"&&typeof module!="undefined"?d(exports,require("@atlas-viewer/iiif-image-api")):typeof define=="function"&&define.amd?define(["exports","@atlas-viewer/iiif-image-api"],d):(u=typeof globalThis!="undefined"?globalThis:u||self,d(u.IIIFVaultHelpers={},u.iiifImageApi))})(this,function(u,d){"use strict";function m(t){return{addEventListener(e,f,n,a){if(!!e)return t.setMetaValue([e.id,"eventManager",f],r=>{const c=r||[];for(const i of c)if(i.callback===n)return c;return[...c,{callback:n,scope:a}]}),n},removeEventListener(e,f,n){!e||t.setMetaValue([e.id,"eventManager",f],a=>(a||[]).filter(r=>r.callback!==n))},getListenersAsProps(e,f){const n=typeof e=="string"?{id:e}:e;if(!n||!n.id)return{};const a=t.getResourceMeta(n.id,"eventManager"),r={};if(a&&n)for(const c of Object.keys(a))r[c]=i=>{const l=t.get(n);for(const{callback:o,scope:s}of a[c]||[])(!s||f&&s.indexOf(f)!==-1)&&o(i,l)};return r}}}function v(t){return{applyStyles(e,f,n){const a=typeof e=="string"?e:e.id;return t.setMetaValue([a,"styles",f],n)},getAppliedStyles(e){const f=typeof e=="string"?e:e.id;return t.getResourceMeta(f,"styles")}}}function y(t,e={}){const f=e.imageServiceLoader||new d.ImageServiceLoader;async function n(a,r,c,i=[],l){if(typeof a=="string")return{best:d.getFixedSizeFromImage(a),fallback:[],log:[]};const o=t.get(a);if(typeof o=="string")return{best:d.getFixedSizeFromImage(o),fallback:[],log:[]};switch(o.type){case"Annotation":{const s=o.body,h=t.get(s[0]);return l&&!h.width&&(h.width=l.width,h.height=l.height),await f.getThumbnailFromResource(h,r,c,i)}case"Canvas":{const s=o;if(s.thumbnail&&s.thumbnail.length){const h=t.get(s.thumbnail[0]),b=await f.getImageCandidates(h,c);b&&b.length&&i.push(...b)}return n(s.items[0],r,c,i,{width:s.width,height:s.height})}case"AnnotationPage":return n(o.items[0],r,c,i,l);case"Choice":return n(o.items[0],r,c,i,l);case"Collection":{const h=o.items[0];return n(h,r,c,i,l)}case"Manifest":{const h=o.items[0];return n(h,r,c,i,l)}case"SpecificResource":case"Image":case"Dataset":case"Sound":case"Text":case"TextualBody":case"Video":return l&&!o.width&&(o.width=l.width,o.height=l.height),f.getThumbnailFromResource(o,r,c,i);case"Service":case"Range":case"AnnotationCollection":case"CanvasReference":case"ContentResource":return{best:void 0,fallback:[],log:[]}}return{best:void 0,fallback:[],log:[]}}return{getBestThumbnailAtSize:n}}function g(t,e,f=[],n=!1){if(!t||!e||e.length===0)return;if(e.length===1)return e[0];if(e.indexOf(t)!==-1)return t;const a=t.indexOf("-")!==-1?t.slice(0,t.indexOf("-")):null;if(a&&e.indexOf(a)!==-1)return a;for(const r of f)if(e.indexOf(r)!==-1)return r;if(!n){const c=e.map(i=>i.indexOf("-")!==-1?i.slice(0,i.indexOf("-")):null).indexOf(t);if(c!==-1)return e[c];for(const i of f){const l=i.indexOf("-")!==-1?i.slice(0,i.indexOf("-")):null,o=l?e.indexOf(l):-1;if(o!==-1)return e[o]}}return e.indexOf("none")!==-1?"none":e.indexOf("@none")!==-1?"@none":e[0]}function p(t,e,f={}){const{strictFallback:n=!1,defaultText:a="",separator:r=` | ||
`,fallbackLanguages:c=[],closest:i}=f,l=Object.keys(t||{}),o=i?e:g(e,l,c,n);if(!t)return a;if(typeof t=="string")return t;const s=o?t[o]:void 0;return s?typeof s=="string"?s:s.join(r):""}function k(t,e={}){return p(t,typeof navigator!="undefined"?navigator.language:void 0,e)}u.buildLocaleString=p,u.createEventsHelper=m,u.createStylesHelper=v,u.createThumbnailHelper=y,u.getClosestLanguage=g,u.getValue=k,Object.defineProperty(u,"__esModule",{value:!0})}); | ||
(function(h,d){typeof exports=="object"&&typeof module!="undefined"?d(exports):typeof define=="function"&&define.amd?define(["exports"],d):(h=typeof globalThis!="undefined"?globalThis:h||self,d(h.VaultHelpers={}))})(this,function(h){"use strict";var yt=Object.defineProperty,vt=Object.defineProperties;var xt=Object.getOwnPropertyDescriptors;var pe=Object.getOwnPropertySymbols;var wt=Object.prototype.hasOwnProperty,bt=Object.prototype.propertyIsEnumerable;var de=(h,d,g)=>d in h?yt(h,d,{enumerable:!0,configurable:!0,writable:!0,value:g}):h[d]=g,R=(h,d)=>{for(var g in d||(d={}))wt.call(d,g)&&de(h,g,d[g]);if(pe)for(var g of pe(d))bt.call(d,g)&&de(h,g,d[g]);return h},W=(h,d)=>vt(h,xt(d));function d(e){return{addEventListener(t,i,r,o){if(!!t)return e.setMetaValue([t.id,"eventManager",i],n=>{const s=n||[];for(const a of s)if(a.callback===r)return s;return[...s,{callback:r,scope:o}]}),r},removeEventListener(t,i,r){!t||e.setMetaValue([t.id,"eventManager",i],o=>(o||[]).filter(n=>n.callback!==r))},getListenersAsProps(t,i){const r=typeof t=="string"?{id:t}:t;if(!r||!r.id)return{};const o=e.getResourceMeta(r.id,"eventManager"),n={};if(o&&r)for(const s of Object.keys(o))n[s]=a=>{const c=e.get(r);for(const{callback:l,scope:f}of o[s]||[])(!f||i&&f.indexOf(i)!==-1)&&l(a,c)};return n}}}function g(e){return{applyStyles(t,i,r){const o=typeof t=="string"?t:t.id;return e.setMetaValue([o,"styles",i],r)},getAppliedStyles(t){const i=typeof t=="string"?t:t.id;return e.getResourceMeta(i,"styles")}}}function x(e){return e.endsWith("info.json")?e:e.endsWith("/")?`${e}info.json`:`${e}/info.json`}const me="http://library.stanford.edu/iiif/image-api/compliance.html#level0",z="http://library.stanford.edu/iiif/image-api/compliance.html#level1",P="http://library.stanford.edu/iiif/image-api/compliance.html#level2",ge="http://library.stanford.edu/iiif/image-api/conformance.html#level0",T="http://library.stanford.edu/iiif/image-api/conformance.html#level1",B="http://library.stanford.edu/iiif/image-api/conformance.html#level2",ye="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0",M="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1",E="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2",ve="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0",H="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1",$="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2",xe="http://iiif.io/api/image/1/level0.json",we="http://iiif.io/api/image/1/profiles/level0.json",Q="http://iiif.io/api/image/1/level1.json",L="http://iiif.io/api/image/1/profiles/level1.json",q="http://iiif.io/api/image/1/level2.json",N="http://iiif.io/api/image/1/profiles/level2.json",be="http://iiif.io/api/image/2/level0.json",Se="http://iiif.io/api/image/2/profiles/level0.json",U="http://iiif.io/api/image/2/level1.json",_="http://iiif.io/api/image/2/profiles/level1.json",V="http://iiif.io/api/image/2/level2.json",J="http://iiif.io/api/image/2/profiles/level2.json",Oe="level0",D="level1",Z="level2",Fe="http://iiif.io/api/image/2/level0",G="http://iiif.io/api/image/2/level1",K="http://iiif.io/api/image/2/level2",X=[K,P,B,E,$,q,N,V,J,Z],Y=[...X,G,z,T,M,H,Q,L,U,_,D],Ae=[Fe,G,K,me,z,P,ge,T,B,ye,M,E,ve,H,$,xe,we,Q,L,q,N,be,Se,U,_,V,J,Oe,D,Z],je={extraFormats:["jpg"],extraQualities:["default"],extraFeatures:["sizeByWhListed"]},Ce={extraFormats:["jpg"],extraQualities:["default"],extraFeatures:["baseUriRedirect","cors","jsonldMediaType","regionByPx","regionSquare","sizeByWhListed","sizeByH","sizeByW","sizeByWh"]},Ie={extraFormats:["jpg","png"],extraQualities:["default"],extraFeatures:["baseUriRedirect","cors","jsonldMediaType","regionByPct","regionByPx","regionSquare","rotationBy90s","sizeByWhListed","sizeByConfinedWh","sizeByH","sizeByPct","sizeByW","sizeByWh"]};function ke(e){return X.indexOf(e)!==-1?Ie:Y.indexOf(e)!==-1?Ce:je}function Re(e){const t=e?Array.isArray(e.profile)?e.profile:[e.profile]:[],i={extraQualities:[],extraFormats:[],extraFeatures:[]};for(let r of t)if(typeof r=="string"&&(r=ke(r)),!!r){if(r.formats)for(const o of r.formats)i.extraFormats.indexOf(o)===-1&&i.extraFormats.push(o);if(r.qualities)for(const o of r.qualities)i.extraQualities.indexOf(o)===-1&&i.extraQualities.push(o);if(r.supports)for(const o of r.supports)i.extraFeatures.indexOf(o)===-1&&i.extraFeatures.push(o);if(r.maxHeight&&(i.maxHeight=r.maxHeight),r.maxWidth&&(i.maxWidth=r.maxWidth),r.maxArea&&(i.maxArea=r.maxArea),r.extraFormats)for(const o of r.extraFormats)i.extraFormats.indexOf(o)===-1&&i.extraFormats.push(o);if(r.extraQualities)for(const o of r.extraQualities)i.extraQualities.indexOf(o)===-1&&i.extraQualities.push(o);if(r.extraFeatures)for(const o of r.extraFeatures)i.extraFeatures.indexOf(o)===-1&&i.extraFeatures.push(o);r.maxHeight&&(i.maxHeight=r.maxHeight),r.maxWidth&&(i.maxWidth=r.maxWidth),r.maxArea&&(i.maxArea=r.maxArea)}if(e.extraFormats)for(const r of e.extraFormats)i.extraFormats.indexOf(r)===-1&&i.extraFormats.push(r);if(e.extraFeatures)for(const r of e.extraFeatures)i.extraFeatures.indexOf(r)===-1&&i.extraFeatures.push(r);if(e.extraQualities)for(const r of e.extraQualities)i.extraQualities.indexOf(r)===-1&&i.extraQualities.push(r);return i}function We(e){try{if(e==="full")return{full:!0};if(e==="square")return{square:!0};const t=e.startsWith("pct:"),i=e.substr(t?4:0).split(",").map(r=>parseFloat(r));return{x:i[0],y:i[1],w:i[2],h:i[3],percent:t}}catch{throw new Error("Expected 'full', 'square' or 'x,y,w,h'. Found "+e)}}function ze(e){const t={upscaled:!1,max:!1,confined:!1};if(e[0]==="^"&&(t.upscaled=!0,e=e.slice(1)),e==="max"||e==="full")return t.max=!0,t.serialiseAsFull=e==="full",t;if(e[0]==="!"&&(t.confined=!0,e=e.slice(1)),e[0]==="p")return t.percentScale=parseFloat(e.slice(4)),t;const i=e.split(",").map(r=>r.trim());return i.length&&(i[0]!==""&&(t.width=parseInt(i[0],10)),i[1]!==""&&(t.height=parseInt(i[1],10))),t}function Pe(e){const t={angle:0};if(e[0]==="!"&&(t.mirror=!0,e=e.substr(1)),t.angle=parseFloat(e)%360,Number.isNaN(t.angle))throw new Error(`Invalid rotation ${e}`);return t}function Te(e,t=""){const i=e.match(/^(([a-zA-Z]+):\/\/([^/]+))?((.*)+)/);if(!i)throw new Error(`Invalid or unknown input ${e}`);const r=i[2],o=i[3];let n=i[4];if(n[0]==="/"&&(n=n.substr(1)),t.length>0){if(t[0]==="/"&&(t=t.substr(1)),t!==n.substr(0,t.length))throw new Error(`Path does not start with prefix (path: ${n}, prefix: ${t})`);n=n.substr(t.length)}return{scheme:r,server:o,path:n,prefix:t}}function Be(e,t=""){const{path:i,scheme:r,server:o,prefix:n}=Te(e,t),s=i.split("/").reverse(),[a,c,l,f,...m]=s,y=m.reverse().filter(Boolean).join("/");if(s.length===1||a==="")return{type:"base",scheme:r,server:o,prefix:n,identifier:y};if(a==="info.json"){const[,...b]=s;return{type:"info",scheme:r,server:o,prefix:n,identifier:b.reverse().filter(Boolean).join("/")}}const p=a.split(".");return{type:"image",scheme:r,server:o,prefix:n,identifier:y,originalPath:i,region:We(f),size:ze(l),rotation:Pe(c),quality:p[0],format:p[1]}}function Me(e){const t=Be(x(e.id));if(t.type!=="info")throw new Error("Invalid service URL");const i=Re(e);return{identifier:t.identifier,originalPath:"",server:t.server,prefix:t.prefix,scheme:t.scheme,type:"image",quality:i.extraQualities.indexOf("default")===-1?i.extraQualities[0]:"default",region:{full:!0},size:{max:!0,upscaled:!1,confined:!1},format:"jpg",rotation:{angle:0}}}function Ee(e,t,i){const r=i.length,o=[];for(let n=0;n<r;n++){const s=i[n].width;o.push(e/s)}return o}function He(e,t,i){const r=i.length,o=[];for(let n=0;n<r;n++){const s=i[n];o.push({width:Math.floor(e/s),height:Math.floor(t/s)})}return o}function u(e){if(e["@id"])return e["@id"];if(e.id)return e.id}function j(e){if(!e||!e.profile||!u(e))return!1;const t=Array.isArray(e.profile)?e.profile:[e.profile];for(const i of t)if(typeof i=="string"&&Ae.indexOf(i)!==-1)return!0;return!1}function $e(e){if(!j(e))return!1;const t=Array.isArray(e.profile)?e.profile:[e.profile];for(const i of t)if(typeof i=="string"){if(Y.indexOf(i)!==-1)return!0}else{const r=[...i.supports||[],...i.extraFeatures||[]];if(r.indexOf("regionByPx")!==-1&&(r.indexOf("sizeByW")!==-1||r.indexOf("sizeByWh")!==-1))return!0}return!1}function Qe(e){if(!$e(e))return[];const t=[],i=Array.isArray(e.profile)?e.profile:[e.profile],r=i.length;for(let o=0;o<r;o++){const n=i[o];if(typeof n!="string"&&(n.maxHeight||n.maxWidth))return[{id:u(e),type:"variable",minWidth:0,minHeight:0,maxHeight:n.maxHeight||n.maxWidth,maxWidth:n.maxWidth||n.maxHeight}]}if(e.tiles){const o=e.tiles.length;for(let n=0;n<o;n++){const s=e.tiles[n];(s.height||s.width)&&t.push({id:u(e),type:"variable",minHeight:0,minWidth:0,maxHeight:s.height||s.width,maxWidth:s.width})}}return t}function ee(e){const t=/^.*\/(full)\/(((\d+),(\d+)?)|max)\/(\d+)\/default\.(jpg|png|jpeg)$/,i=e.match(t);if(i){const r=i[1],o=parseInt(i[4],10),n=parseInt(i[5],10),s=i[7];if((r==="max"||r==="full")&&o&&n&&s)return{type:"fixed",id:e,height:n,width:o}}return{type:"unknown",id:e}}function Le(e){if(e["@type"])return e["@type"];if(e.type)return e.type}function C(e){if(typeof e=="string")return ee(e);const t=Le(e);if(t!=="Image"&&t!=="sc:Image")return null;const i=e,r=u(i);return r?r&&i.width&&i.height?{id:r,type:"fixed",width:i.width,height:i.height,unsafe:!0}:ee(r):null}function qe(e){return j(e)?(e&&e.sizes?e.sizes:[]).map(t=>({id:u(e),type:"fixed-service",height:t.height,width:t.width})):[]}function te(e){const t=[],i=e.length;for(let r=0;r<i;r++){const o=qe(e[r]);o.length&&t.push(...o);const n=Qe(e[r]);n.length&&t.push(...n)}return t}function ie(e){const t=e.service?Array.isArray(e.service)?e.service:[e.service]:[],i=t.length,r=[];for(let o=0;o<i;o++)j(t[o])&&r.push(t[o]);return r}function Ne(e,t=!0,i){const r=[],o=C(e);if(o===null)return r;const n=e;if(r.push(o),t&&n.width&&n.height){const s=[],a=ie(n);for(const c of a){const l={id:u(c),width:n.width,height:n.height};if(i.canLoadSync(l)){const f=i.loadServiceSync(l);f&&(f.height||(f.height=n.height),f.width||(f.width=n.width),s.push(...te([f])))}}if(s.length)return r.push(...s),r}return n.service&&r.push(...te(n.service)),r}function Ue({x:e=0,y:t=0,w:i,h:r,full:o,square:n,percent:s}){if(o)return"full";if(n)return"square";if(typeof i>"u"||typeof r>"u")throw new Error("RegionParameter: invalid region");const a=`${e},${t},${i},${r}`;return s?`pct:${a}`:a}function _e({max:e,percentScale:t,upscaled:i,confined:r,width:o,height:n,serialiseAsFull:s}){const a=[];return i&&a.push("^"),e?(a.push(s?"full":"max"),a.join("")):(r&&a.push("!"),t&&a.push(`pct:${t}`),o&&a.push(`${o}`),a.push(","),n&&a.push(`${n}`),a.join(""))}function Ve(e){return`${e.mirror?"!":""}${(e.angle||0)%360}`}var Je=Object.defineProperty,De=Object.defineProperties,Ze=Object.getOwnPropertyDescriptors,re=Object.getOwnPropertySymbols,Ge=Object.prototype.hasOwnProperty,Ke=Object.prototype.propertyIsEnumerable,ne=(e,t,i)=>t in e?Je(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,O=(e,t)=>{for(var i in t||(t={}))Ge.call(t,i)&&ne(e,i,t[i]);if(re)for(var i of re(t))Ke.call(t,i)&&ne(e,i,t[i]);return e},F=(e,t)=>De(e,Ze(t));function Xe(e,t){const i=e.prefix.startsWith("/")?e.prefix.substr(1):e.prefix,r=`${e.scheme}://${e.server}/${i?`${i}/`:""}${e.identifier}`;if(e.type==="base")return r;if(e.type==="info")return`${r}/info.json`;let{region:o,size:n,rotation:s,format:a,quality:c}=e;if(t){const l=t["@context"]?Array.isArray(t["@context"])?t["@context"]:[t["@context"]]:[],f=l.indexOf("http://iiif.io/api/image/2/context.json")!==-1,m=l.indexOf("http://iiif.io/api/image/3/context.json")!==-1;if((n.width===t.width&&!n.height||n.height===t.height&&!n.width||n.width===t.width&&n.height===t.height)&&(n=F(O({},n),{max:!0})),f&&(n.max&&!n.serialiseAsFull&&(n=F(O({},n),{serialiseAsFull:!0})),!n.max&&n.width&&n.height&&(n=F(O({},n),{height:void 0}))),m&&(n.max&&n.serialiseAsFull&&(n=F(O({},n),{serialiseAsFull:!1})),n.width&&!n.height&&t.width&&t.height)){const y=t.height/t.width;n=F(O({},n),{height:Math.ceil(n.width*y)})}}return[r,Ue(o),_e(n),Ve(s),`${c}.${a}`].filter(Boolean).join("/")}function I(e,t,i){const r=Me({id:x(u(e)),profile:"level2",type:"ImageService2"});if(r.type!=="image")throw new Error("Invalid service");return r.size.max=!1,r.size.width=t,r.size.height=i,{id:Xe(r),type:"fixed",width:t,height:i||e.height/(e.width||1)*t,unsafe:e.width>t}}function S(e){const t=e.replace(/(https?:\/\/)?(www.)?/i,"");return t.indexOf("/")!==-1?t.split("/")[0]:t}function Ye(e,t,i){const r=e.width?e.width:e.maxWidth;return i.height<=e.maxHeight&&i.width<=e.maxWidth&&i.height>=e.minHeight&&i.width>=e.minWidth&&(!t||Math.abs(i.width-r)<Math.abs(t.width-r))}function et(e,t){const i=[],r=Object.assign({unsafeImageService:!1,atAnyCost:!0,fallback:!0,minHeight:64,minWidth:64,maxHeight:1/0,maxWidth:1/0,returnAllOptions:!1,preferFixedSize:!1,allowUnsafe:!1,explain:!1,height:0,width:0},e),o=[],n=[];let s=null;const a=(l,f)=>{if(Ye(r,f,l)){if(r.preferFixedSize&&l.unsafe){n.push(l);return}r.returnAllOptions&&f&&n.push(f),s=l}else r.returnAllOptions&&n.push(l)},c=t.length;for(let l=0;l<c;l++){const f=t[l](),m=f.length;for(let y=0;y<m;y++){const p=f[y];if(p.type==="unknown"&&r.atAnyCost&&o.push(p),p.type==="fixed"&&(p.unsafe?o.push(p):a(p,s)),p.type==="fixed-service")if(r.unsafeImageService){const b=I(p,r.width,r.height);a(b,s)}else{const b=I(p,p.width,p.height);a(b,s)}if(p.type==="variable"&&p.maxWidth){const b=I({id:p.id,type:"fixed-service",width:p.maxWidth,height:p.maxWidth},p.maxWidth);a(b,s)}}if(s&&!r.returnAllOptions){if(s.unsafe||r.allowUnsafe)continue;break}}return r.atAnyCost&&n.length===0?{best:s||o[0],fallback:o.slice(1),log:i}:r.returnAllOptions?{best:r.atAnyCost?s||n[0]||o[0]:s||n[0],fallback:[...n,...o],log:i}:{best:s||n[0]||null,fallback:s?n:n.slice(1),log:i}}var tt=Object.defineProperty,it=Object.defineProperties,rt=Object.getOwnPropertyDescriptors,oe=Object.getOwnPropertySymbols,nt=Object.prototype.hasOwnProperty,ot=Object.prototype.propertyIsEnumerable,se=(e,t,i)=>t in e?tt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,st=(e,t)=>{for(var i in t||(t={}))nt.call(t,i)&&se(e,i,t[i]);if(oe)for(var i of oe(t))ot.call(t,i)&&se(e,i,t[i]);return e},at=(e,t)=>it(e,rt(t));function lt(e,t,i){const r=e>t?e:t,o=i.length,n=[];for(let s=0;s<o;s++){const a=i[s];let c=a.scaleFactors[0],l=r/c;const f=[c];for(;l>=a.width;)c=c*2,f.push(c),l=l/2;n.push(at(st({},a),{scaleFactors:f}))}return n}function ft(e,t){if(e.length!==t.length)return!1;if(e.length===0&&t.length===0)return!0;const i=e.length;let r=!0;for(let n=0;n<i;n++){const s=e[n],a=t[n];if(s.width!==a.width||s.height!==a.height){r=!1;break}}if(r)return!0;let o=0;for(let n=0;n<i;n++)for(let s=0;s<i;s++)if(e[n].width===t[s].width&&e[n].height===t[s].height){o++;break}return o===i}var w=(e,t,i)=>new Promise((r,o)=>{var n=c=>{try{a(i.next(c))}catch(l){o(l)}},s=c=>{try{a(i.throw(c))}catch(l){o(l)}},a=c=>c.done?r(c.value):Promise.resolve(c.value).then(n,s);a((i=i.apply(e,t)).next())});class ae{constructor(){this.config={verificationsRequired:1,approximateServices:!0,enableFetching:!0,disableThrottling:!1},this.fetchingCount=0,this.imageServices={},this.knownImageServers={}}setConfig(t){Object.assign(this.config,t)}sample(t,i,r=!0){const o=S(u(t)),n=x(u(t)),s=this.knownImageServers[o];return this.imageServices[n]=Object.assign(t,{real:!0}),s?this.verify(t):(this.knownImageServers[o]={verifications:0,malformed:!1,root:o,preLoaded:r,sampledId:u(t),verified:!1,server:null,result:{context:t["@context"]||[],sampledProfile:t.profile,resourceServiceRatio:i&&t.height?i.height/t.height:1,sampledSizes:t.sizes||[],sizeRatios:Ee(t.width,t.height,t.sizes||[]),sampledTiles:t.tiles||[]}},!0)}preLoad(t,i=!0){this.knownImageServers[t.root]=t,i&&(this.knownImageServers[t.root].malformed=!1,this.knownImageServers[t.root].verifications=this.config.verificationsRequired)}predict(t,i=!1,r=!1){const o=t==null?void 0:t.source,n=S(u(t)),s=this.knownImageServers[n];if(!s||!s.result||!r&&(s.malformed||s.verifications<this.config.verificationsRequired))return null;const a=x(u(t));return this.imageServices[a]||(this.imageServices[a]={"@context":s.result.context,"@id":u(t),id:u(t),protocol:"http://iiif.io/api/image",tiles:(o==null?void 0:o.tiles)||lt(t.width,t.height,s.result.sampledTiles),sizes:(o==null?void 0:o.sizes)||He(Math.round(t.width/s.result.resourceServiceRatio),Math.round(t.height/s.result.resourceServiceRatio),s.result.sizeRatios),profile:(o==null?void 0:o.profile)||s.result.sampledProfile,height:(o==null?void 0:o.height)||t.height,width:(o==null?void 0:o.width)||t.width,real:!1}),this.imageServices[a]}getThumbnailFromResource(t,i){return w(this,arguments,function*(r,o,n=!0,s=[]){const a=yield this.getImageCandidates(r,n);return et(o,[()=>s,()=>a])})}getImageCandidates(t,i=!0){return w(this,null,function*(){const r=t;if(i&&r.height&&r.width){const o=ie(r);for(const n of o){const s={id:u(n),width:n.width?n.width:r.width,height:n.height?n.height:r.height,source:n};yield this.loadService(s)}}return Ne(t,i,this)})}verify(t){return w(this,null,function*(){const i=this.predict(t,!1,!0),r=yield this.fetchService(u(t));if(!i)return!1;const o=i.height===r.height&&i.width===r.width&&i["@context"]===r["@context"]&&ft(i.sizes||[],r.sizes||[]);if(o){const n=S(u(t));this.knownImageServers[n].verifications+=1,this.knownImageServers[n].verifications>=this.config.verificationsRequired&&(this.knownImageServers[n].verified=!0)}return o})}canLoadSync(t){const i=typeof t=="string"?t:u(t),r=x(i);if(this.imageServices[r])return!0;const o=this.knownImageServers[S(i)];return o&&!o.malformed&&o.verifications>=this.config.verificationsRequired}markAsMalformed(t){return w(this,null,function*(){return this.knownImageServers[S(u(t))].malformed=!0,this.loadService(t,!0)})}fetchService(t,i=!1){return w(this,null,function*(){const r=x(t);if(this.imageServices[r]&&(!i||this.imageServices[r].real))return this.imageServices[r];if(!this.config.enableFetching)throw new Error("Fetching is not enabled");const o=yield this.fetch(r).then(n=>n.json());return!o.id&&o["@id"]&&(o.id=o["@id"]),o.id!==t&&(o.id=t,o["@id"]&&(o["@id"]=t)),this.imageServices[r]=Object.assign(o,{real:!0}),this.imageServices[r]})}fetch(t,i){return w(this,null,function*(){return fetch(t,i)})}loadService(t,i=!1){return w(this,null,function*(){if(!this.config.disableThrottling){let n=!0;for(;n;)if(this.fetchingCount>=this.config.verificationsRequired)yield new Promise(s=>setTimeout(s,500));else{n=!1;break}}const r=this.knownImageServers[S(u(t))];if(r&&!r.malformed&&!i){yield r.result;const n=this.loadServiceSync(t);if(n)return n}this.fetchingCount++;const o=yield this.fetchService(u(t),i);return this.fetchingCount--,o.real&&this.sample(o,t),o})}loadServiceSync(t){const i=x(u(t));return this.imageServices[i]?this.imageServices[i]:this.predict(t)}}new ae;function ct(e,t={}){const i=t.imageServiceLoader||new ae;async function r(o,n,s,a=[],c){if(typeof o=="string")return{best:C(o),fallback:[],log:[]};const l=e.get(o);if(typeof l=="string")return{best:C(l),fallback:[],log:[]};switch(l.type){case"Annotation":{const f=l.body,m=e.get(f[0]);return c&&!m.width&&(m.width=c.width,m.height=c.height),await i.getThumbnailFromResource(m,n,s,a)}case"Canvas":{const f=l;if(f.thumbnail&&f.thumbnail.length){const m=e.get(f.thumbnail[0]),y=await i.getImageCandidates(m,s);y&&y.length&&a.push(...y)}return r(f.items[0],n,s,a,{width:f.width,height:f.height})}case"AnnotationPage":return r(l.items[0],n,s,a,c);case"Choice":return r(l.items[0],n,s,a,c);case"Collection":{const m=l.items[0];return r(m,n,s,a,c)}case"Manifest":{const m=l.items[0];return r(m,n,s,a,c)}case"SpecificResource":case"Image":case"Dataset":case"Sound":case"Text":case"TextualBody":case"Video":return c&&!l.width&&(l.width=c.width,l.height=c.height),i.getThumbnailFromResource(l,n,s,a);case"Service":case"Range":case"AnnotationCollection":case"CanvasReference":case"ContentResource":return{best:void 0,fallback:[],log:[]}}return{best:void 0,fallback:[],log:[]}}return{getBestThumbnailAtSize:r}}function le(e,t,i=[],r=!1){if(!e||!t||t.length===0)return;if(t.length===1)return t[0];if(t.indexOf(e)!==-1)return e;const o=e.indexOf("-")!==-1?e.slice(0,e.indexOf("-")):null;if(o&&t.indexOf(o)!==-1)return o;for(const n of i)if(t.indexOf(n)!==-1)return n;if(!r){const s=t.map(a=>a.indexOf("-")!==-1?a.slice(0,a.indexOf("-")):null).indexOf(e);if(s!==-1)return t[s];for(const a of i){const c=a.indexOf("-")!==-1?a.slice(0,a.indexOf("-")):null,l=c?t.indexOf(c):-1;if(l!==-1)return t[l]}}return t.indexOf("none")!==-1?"none":t.indexOf("@none")!==-1?"@none":t[0]}function fe(e,t,i={}){const{strictFallback:r=!1,defaultText:o="",separator:n=` | ||
`,fallbackLanguages:s=[],closest:a}=i,c=Object.keys(e||{}),l=a?t:le(t,c,s,r);if(!e)return o;if(typeof e=="string")return e;const f=l?e[l]:void 0;return f?typeof f=="string"?f:f.join(n):""}function ht(e,t={}){return fe(e,typeof navigator!="undefined"?navigator.language:void 0,t)}const ut=/&?(xywh=)?(pixel:|percent:|pct:)?([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?)/,pt=/&?(t=)(npt:)?([0-9]+(.[0-9]+)?)?(,([0-9]+(.[0-9]+)?))?/;function A(e){if(Array.isArray(e))return e.reduce((t,i)=>{const{selector:r,selectors:o}=A(i);return r&&(t.selector||(t.selector=r),t.selectors.push(...o)),t},{selector:null,selectors:[]});if(!e)return{selector:null,selectors:[]};if(typeof e=="string"){const[t,i]=e.split("#");return i?A({type:"FragmentSelector",value:i}):{selector:null,selectors:[]}}if(e.type==="PointSelector"&&(e.t||e.t===0)){const t={type:"TemporalSelector",temporal:{startTime:e.t}};return{selector:t,selectors:[t]}}if(e.type==="FragmentSelector"){const t=ut.exec(e.value);if(t){const r={type:"BoxSelector",spatial:{unit:t[2]==="percent:"||t[2]==="pct:"?"percent":"pixel",x:parseFloat(t[3]),y:parseFloat(t[4]),width:parseFloat(t[5]),height:parseFloat(t[6])}};return{selector:r,selectors:[r]}}const i=e.value.match(pt);if(i){const r={type:"TemporalSelector",temporal:{startTime:i[4]?parseFloat(i[4]):0,endTime:i[7]?parseFloat(i[7]):void 0}};return{selector:r,selectors:[r]}}return{selector:null,selectors:[]}}return{selector:null,selectors:[]}}function v(e,t={}){if(Array.isArray(e))return v(e[0]);if(typeof e=="string"){const[i,r]=e.split("#");return r?v({type:"SpecificResource",source:{id:i,type:"Unknown"},selector:{type:"FragmentSelector",value:r}}):{type:"SpecificResource",source:{id:i,type:t.typeMap&&t.typeMap[i]||"Unknown"},selector:null,selectors:[]}}if(e.type==="Choice"||e.type==="List"||e.type==="Composite"||e.type==="Independents")return v(e.items[0]);if(e.type==="SpecificResource"){e.source.type==="Canvas"&&e.source.partOf&&typeof e.source.partOf=="string"&&(e.source.partOf=[{id:e.source.partOf,type:"Manifest"}]);const{selector:i,selectors:r}=e.selector?A(e.selector):{selector:null,selectors:[]};return{type:"SpecificResource",source:e.source,selector:i,selectors:r}}if(e.id){e.type==="Canvas"&&e.partOf&&typeof e.partOf=="string"&&(e.partOf=[{id:e.partOf,type:"Manifest"}]);const[i,r]=e.id.split("#");return r?v({type:"SpecificResource",source:W(R({},e),{id:i}),selector:{type:"FragmentSelector",value:r}}):{type:"SpecificResource",source:W(R({},e),{id:i}),selector:null,selectors:[]}}return{type:"SpecificResource",source:e,selector:null,selectors:[]}}function k(e,t=!1){if(typeof e=="string"){if(e.startsWith("{"))try{const i=JSON.parse(e);return k(i)}catch{return[!1,{reason:"Invalid JSON"}]}return[!0]}if(Array.isArray(e)){for(const i of e){const[r,o]=k(i);if(!r&&o)return[r,o]}return[!0]}return e.type==="Annotation"?[!0]:t&&e.type==="Canvas"&&!e.partOf?[!1,{reason:"Canvas without partOf cannot be loaded"}]:[!0]}function dt(e){return he(typeof e=="string"?e:JSON.stringify(e))}function ce(e,t){if(e=e.trim(),e[0]==="{")return t?Promise.resolve(JSON.parse(e)):JSON.parse(e);if(e.startsWith("http")){if(!t)throw new Error("Cannot fetch remote fetch with async=false in parseContentState");return fetch(e).then(i=>i.json())}return ce(ue(e),t)}function he(e){const t=encodeURIComponent(e);return(typeof btoa=="undefined"?Buffer.from(t,"utf-8").toString("base64"):btoa(t)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function ue(e){const i=mt(e).replace(/-/g,"+").replace(/_/g,"/"),r=typeof atob=="undefined"?Buffer.from(i,"base64").toString("utf-8"):atob(i);return decodeURIComponent(r).trim()}function mt(e){const t=e.length%4;if(t===1)throw new Error("InvalidLengthError: Input base64url string is the wrong length to determine padding");return e+(t?"====".slice(0,4-t):"")}function gt(e){if(!e)throw new Error("Content state is empty");Array.isArray(e)||(e=[e]);let t="vault://virtual-annotation/"+new Date().getTime();const i=[];for(const r of e){if(typeof r=="string")throw new Error("Content state is a [String] type and cannot be inferred");if(r.type==="Annotation"){if(t=r.id,Array.isArray(r.motivation))for(const n of r.motivation);if(Array.isArray(r.target))for(const n of r.target){const s=v(n);i.push(s)}else{const n=v(r.target);i.push(n)}continue}const o=v(r);i.push(o)}return{id:t,type:"Annotation",motivation:["contentState",...e.motivation||[]],target:i,extensions:{}}}h.buildLocaleString=fe,h.createEventsHelper=d,h.createStylesHelper=g,h.createThumbnailHelper=ct,h.decodeContentState=ue,h.encodeContentState=he,h.expandTarget=v,h.getClosestLanguage=le,h.getValue=ht,h.normaliseContentState=gt,h.parseContentState=ce,h.parseSelector=A,h.serialiseContentState=dt,h.validateContentState=k,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); | ||
//# sourceMappingURL=index.umd.js.map |
@@ -1,2 +0,4 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var g=require("react-i18next"),f=require("react");function L(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var c=L(f);function v(e,t,n=[],s=!1){if(!e||!t||t.length===0)return;if(t.length===1)return t[0];if(t.indexOf(e)!==-1)return e;const r=e.indexOf("-")!==-1?e.slice(0,e.indexOf("-")):null;if(r&&t.indexOf(r)!==-1)return r;for(const i of n)if(t.indexOf(i)!==-1)return i;if(!s){const a=t.map(o=>o.indexOf("-")!==-1?o.slice(0,o.indexOf("-")):null).indexOf(e);if(a!==-1)return t[a];for(const o of n){const l=o.indexOf("-")!==-1?o.slice(0,o.indexOf("-")):null,u=l?t.indexOf(l):-1;if(u!==-1)return t[u]}}return t.indexOf("none")!==-1?"none":t.indexOf("@none")!==-1?"@none":t[0]}function O(e,t,n={}){const{strictFallback:s=!1,defaultText:r="",separator:i=` | ||
`,fallbackLanguages:a=[],closest:o}=n,l=Object.keys(e||{}),u=o?t:v(t,l,a,s);if(!e)return r;if(typeof e=="string")return e;const d=u?e[u]:void 0;return d?typeof d=="string"?d:d.join(i):""}function _({as:e,language:t,children:n,...s}){const{i18n:r}=g.useTranslation(),i=f.useMemo(()=>r.dir?r.dir(t):"ltr",[t]);return f.useMemo(()=>r.services?r.services.languageUtils.getLanguagePartFromCode(r.language)===r.services.languageUtils.getLanguagePartFromCode(t):!1,[r.language,t])?e?c.default.createElement(e,{...s},n):c.default.createElement("span",{...s},n):e?c.default.createElement(e,{...s,lang:t,dir:i},n):c.default.createElement("span",{...s,lang:t,dir:i},n)}function m(e,t=[]){const{i18n:n}=g.useTranslation(),s=n&&n.languages?n.languages:[],r=n&&n.language?n.language:"en";return f.useMemo(()=>{const i=e();return v(r,i,s)},[s,r,...t])}function x(e,t){const n=m(()=>Object.keys(e||{}),[e]);return[f.useMemo(()=>O(e,n,{defaultText:t,closest:!0}),[n,t,e]),n]}function S(){const{i18n:e}=g.useTranslation(),t=e&&e.languages?e.languages:[],n=e&&e.language?e.language:"en";return function(r,i){return O(r,n,{fallbackLanguages:t,defaultText:i})}}const E=({as:e,defaultText:t,enableDangerouslySetInnerHTML:n,children:s,...r})=>{const[i,a]=x(s,t);return a?c.default.createElement(_,{...r,as:e,language:a,title:n?void 0:i,dangerouslySetInnerHTML:n?{__html:i}:void 0},n?void 0:i):e?c.default.createElement(e,{...r},i):c.default.createElement("span",{...r,title:n?void 0:i,dangerouslySetInnerHTML:n?{__html:i}:void 0},n?void 0:i)};exports.LocaleString=E,exports.useClosestLanguage=m,exports.useCreateLocaleString=S,exports.useLocaleString=x; | ||
"use strict";var G=Object.defineProperty,H=Object.defineProperties;var J=Object.getOwnPropertyDescriptors;var N=Object.getOwnPropertySymbols;var R=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable;var k=(e,t,n)=>t in e?G(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,v=(e,t)=>{for(var n in t||(t={}))R.call(t,n)&&k(e,n,t[n]);if(N)for(var n of N(t))U.call(t,n)&&k(e,n,t[n]);return e},h=(e,t)=>H(e,J(t));var j=(e,t)=>{var n={};for(var r in e)R.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&N)for(var r of N(e))t.indexOf(r)<0&&U.call(e,r)&&(n[r]=e[r]);return n};Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var l=require("react");function Q(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var m=Q(l);function X(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Z(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function F(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ee(e,t,n){return t&&F(e.prototype,t),n&&F(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var te={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0},ne,re=m.default.createContext();function ae(){return te}var ie=function(){function e(){Z(this,e),this.usedNamespaces={}}return ee(e,[{key:"addUsedNamespaces",value:function(n){var r=this;n.forEach(function(i){r.usedNamespaces[i]||(r.usedNamespaces[i]=!0)})}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}]),e}();function ue(){return ne}function oe(){if(console&&console.warn){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];typeof n[0]=="string"&&(n[0]="react-i18next:: ".concat(n[0])),(e=console).warn.apply(e,n)}}var z={};function P(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];typeof t[0]=="string"&&z[t[0]]||(typeof t[0]=="string"&&(z[t[0]]=new Date),oe.apply(void 0,t))}function M(e,t,n){e.loadNamespaces(t,function(){if(e.isInitialized)n();else{var r=function i(){setTimeout(function(){e.off("initialized",i)},0),n()};e.on("initialized",r)}})}function se(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!t.languages||!t.languages.length)return P("i18n.languages were undefined or empty",t.languages),!0;var r=t.languages[0],i=t.options?t.options.fallbackLng:!1,o=t.languages[t.languages.length-1];if(r.toLowerCase()==="cimode")return!0;var a=function(s,f){var d=t.services.backendConnector.state["".concat(s,"|").concat(f)];return d===-1||d===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!a(t.isLanguageChangingTo,e)?!1:!!(t.hasResourceBundle(r,e)||!t.services.backendConnector.backend||a(r,e)&&(!i||a(o,e)))}function fe(e){if(Array.isArray(e))return e}function ce(e,t){var n=e==null?null:typeof Symbol!="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],i=!0,o=!1,a,u;try{for(n=n.call(e);!(i=(a=n.next()).done)&&(r.push(a.value),!(t&&r.length===t));i=!0);}catch(s){o=!0,u=s}finally{try{!i&&n.return!=null&&n.return()}finally{if(o)throw u}}return r}}function T(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function le(e,t){if(!!e){if(typeof e=="string")return T(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return T(e,t)}}function de(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. | ||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ge(e,t){return fe(e)||ce(e,t)||le(e,t)||de()}function B(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function I(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?B(Object(n),!0).forEach(function(r){X(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):B(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function L(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.i18n,r=l.useContext(re)||{},i=r.i18n,o=r.defaultNS,a=n||i||ue();if(a&&!a.reportNamespaces&&(a.reportNamespaces=new ie),!a){P("You will need to pass in an i18next instance by using initReactI18next");var u=function(p){return Array.isArray(p)?p[p.length-1]:p},s=[u,{},!1];return s.t=u,s.i18n={},s.ready=!1,s}a.options.react&&a.options.react.wait!==void 0&&P("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var f=I(I(I({},ae()),a.options.react),t),d=f.useSuspense,Y=f.keyPrefix,c=e||o||a.options&&a.options.defaultNS;c=typeof c=="string"?[c]:c||["translation"],a.reportNamespaces.addUsedNamespaces&&a.reportNamespaces.addUsedNamespaces(c);var y=(a.isInitialized||a.initializedStoreOnce)&&c.every(function(g){return se(g,a,f)});function S(){return a.getFixedT(null,f.nsMode==="fallback"?c:c[0],Y)}var $=l.useState(S),C=ge($,2),E=C[0],x=C[1],b=l.useRef(!0);l.useEffect(function(){var g=f.bindI18n,p=f.bindI18nStore;b.current=!0,!y&&!d&&M(a,c,function(){b.current&&x(S)});function w(){b.current&&x(S)}return g&&a&&a.on(g,w),p&&a&&a.store.on(p,w),function(){b.current=!1,g&&a&&g.split(" ").forEach(function(_){return a.off(_,w)}),p&&a&&p.split(" ").forEach(function(_){return a.store.off(_,w)})}},[a,c.join()]);var A=l.useRef(!0);l.useEffect(function(){b.current&&!A.current&&x(S),A.current=!1},[a]);var O=[E,a,y];if(O.t=E,O.i18n=a,O.ready=y,y||!y&&!d)return O;throw new Promise(function(g){M(a,c,function(){g()})})}function D(i){var o=i,{as:e,language:t,children:n}=o,r=j(o,["as","language","children"]);const{i18n:a}=L(),u=l.useMemo(()=>a.dir?a.dir(t):"ltr",[t]);return l.useMemo(()=>a.services?a.services.languageUtils.getLanguagePartFromCode(a.language)===a.services.languageUtils.getLanguagePartFromCode(t):!1,[a.language,t])?e?m.default.createElement(e,v({},r),n):m.default.createElement("span",v({},r),n):e?m.default.createElement(e,h(v({},r),{lang:t,dir:u}),n):m.default.createElement("span",h(v({},r),{lang:t,dir:u}),n)}function W(e,t,n=[],r=!1){if(!e||!t||t.length===0)return;if(t.length===1)return t[0];if(t.indexOf(e)!==-1)return e;const i=e.indexOf("-")!==-1?e.slice(0,e.indexOf("-")):null;if(i&&t.indexOf(i)!==-1)return i;for(const o of n)if(t.indexOf(o)!==-1)return o;if(!r){const a=t.map(u=>u.indexOf("-")!==-1?u.slice(0,u.indexOf("-")):null).indexOf(e);if(a!==-1)return t[a];for(const u of n){const s=u.indexOf("-")!==-1?u.slice(0,u.indexOf("-")):null,f=s?t.indexOf(s):-1;if(f!==-1)return t[f]}}return t.indexOf("none")!==-1?"none":t.indexOf("@none")!==-1?"@none":t[0]}function K(e,t,n={}){const{strictFallback:r=!1,defaultText:i="",separator:o=` | ||
`,fallbackLanguages:a=[],closest:u}=n,s=Object.keys(e||{}),f=u?t:W(t,s,a,r);if(!e)return i;if(typeof e=="string")return e;const d=f?e[f]:void 0;return d?typeof d=="string"?d:d.join(o):""}function q(e,t=[]){const{i18n:n}=L(),r=n&&n.languages?n.languages:[],i=n&&n.language?n.language:"en";return l.useMemo(()=>{const o=e();return W(i,o,r)},[r,i,...t])}function V(e,t){const n=q(()=>Object.keys(e||{}),[e]);return[l.useMemo(()=>K(e,n,{defaultText:t,closest:!0}),[n,t,e]),n]}const pe=o=>{var a=o,{as:e,defaultText:t,enableDangerouslySetInnerHTML:n,children:r}=a,i=j(a,["as","defaultText","enableDangerouslySetInnerHTML","children"]);const[u,s]=V(r,t);return s?m.default.createElement(D,h(v({},i),{as:e,language:s,title:n?void 0:u,dangerouslySetInnerHTML:n?{__html:u}:void 0}),n?void 0:u):e?m.default.createElement(e,v({},i),u):m.default.createElement("span",h(v({},i),{title:n?void 0:u,dangerouslySetInnerHTML:n?{__html:u}:void 0}),n?void 0:u)};function ve(){const{i18n:e}=L(),t=e&&e.languages?e.languages:[],n=e&&e.language?e.language:"en";return function(i,o){return K(i,n,{fallbackLanguages:t,defaultText:o})}}exports.LanguageString=D;exports.LocaleString=pe;exports.useClosestLanguage=q;exports.useCreateLocaleString=ve;exports.useLocaleString=V; | ||
//# sourceMappingURL=react-i18next.js.map |
@@ -1,1 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});function n(s){return{applyStyles(e,t,l){const i=typeof e=="string"?e:e.id;return s.setMetaValue([i,"styles",t],l)},getAppliedStyles(e){const t=typeof e=="string"?e:e.id;return s.getResourceMeta(t,"styles")}}}exports.createStylesHelper=n; | ||
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function n(l){return{applyStyles(e,t,s){const i=typeof e=="string"?e:e.id;return l.setMetaValue([i,"styles",t],s)},getAppliedStyles(e){const t=typeof e=="string"?e:e.id;return l.getResourceMeta(t,"styles")}}}exports.createStylesHelper=n; | ||
//# sourceMappingURL=styles.js.map |
@@ -1,1 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var u=require("@atlas-viewer/iiif-image-api");function b(l,m={}){const r=m.imageServiceLoader||new u.ImageServiceLoader;async function s(h,n,o,c=[],a){if(typeof h=="string")return{best:u.getFixedSizeFromImage(h),fallback:[],log:[]};const t=l.get(h);if(typeof t=="string")return{best:u.getFixedSizeFromImage(t),fallback:[],log:[]};switch(t.type){case"Annotation":{const e=t.body,i=l.get(e[0]);return a&&!i.width&&(i.width=a.width,i.height=a.height),await r.getThumbnailFromResource(i,n,o,c)}case"Canvas":{const e=t;if(e.thumbnail&&e.thumbnail.length){const i=l.get(e.thumbnail[0]),g=await r.getImageCandidates(i,o);g&&g.length&&c.push(...g)}return s(e.items[0],n,o,c,{width:e.width,height:e.height})}case"AnnotationPage":return s(t.items[0],n,o,c,a);case"Choice":return s(t.items[0],n,o,c,a);case"Collection":{const i=t.items[0];return s(i,n,o,c,a)}case"Manifest":{const i=t.items[0];return s(i,n,o,c,a)}case"SpecificResource":case"Image":case"Dataset":case"Sound":case"Text":case"TextualBody":case"Video":return a&&!t.width&&(t.width=a.width,t.height=a.height),r.getThumbnailFromResource(t,n,o,c);case"Service":case"Range":case"AnnotationCollection":case"CanvasReference":case"ContentResource":return{best:void 0,fallback:[],log:[]}}return{best:void 0,fallback:[],log:[]}}return{getBestThumbnailAtSize:s}}exports.createThumbnailHelper=b; | ||
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var u=require("@atlas-viewer/iiif-image-api");function b(s,m={}){const r=m.imageServiceLoader||new u.ImageServiceLoader;async function l(g,n,o,c=[],a){if(typeof g=="string")return{best:u.getFixedSizeFromImage(g),fallback:[],log:[]};const t=s.get(g);if(typeof t=="string")return{best:u.getFixedSizeFromImage(t),fallback:[],log:[]};switch(t.type){case"Annotation":{const e=t.body,i=s.get(e[0]);return a&&!i.width&&(i.width=a.width,i.height=a.height),await r.getThumbnailFromResource(i,n,o,c)}case"Canvas":{const e=t;if(e.thumbnail&&e.thumbnail.length){const i=s.get(e.thumbnail[0]),h=await r.getImageCandidates(i,o);h&&h.length&&c.push(...h)}return l(e.items[0],n,o,c,{width:e.width,height:e.height})}case"AnnotationPage":return l(t.items[0],n,o,c,a);case"Choice":return l(t.items[0],n,o,c,a);case"Collection":{const i=t.items[0];return l(i,n,o,c,a)}case"Manifest":{const i=t.items[0];return l(i,n,o,c,a)}case"SpecificResource":case"Image":case"Dataset":case"Sound":case"Text":case"TextualBody":case"Video":return a&&!t.width&&(t.width=a.width,t.height=a.height),r.getThumbnailFromResource(t,n,o,c);case"Service":case"Range":case"AnnotationCollection":case"CanvasReference":case"ContentResource":return{best:void 0,fallback:[],log:[]}}return{best:void 0,fallback:[],log:[]}}return{getBestThumbnailAtSize:l}}exports.createThumbnailHelper=b; | ||
//# sourceMappingURL=thumbnail.js.map |
{ | ||
"name": "@iiif/vault-helpers", | ||
"version": "0.9.6", | ||
"version": "0.9.7", | ||
"license": "MIT", | ||
"main": "./dist/cjs/index.js", | ||
"module": "./dist/esm/index.mjs", | ||
"types": "./dist/index.d.ts", | ||
"main": "dist/cjs/index.js", | ||
"module": "dist/esm/index.mjs", | ||
"types": ".build/types/index.d.ts", | ||
"files": [ | ||
".build", | ||
"dist" | ||
], | ||
"sideEffects": false, | ||
"exports": { | ||
@@ -25,2 +27,6 @@ ".": { | ||
}, | ||
"./react-i18next": { | ||
"require": "./dist/react-i18next/cjs/react-i18next.js", | ||
"import": "./dist/react-i18next/esm/react-i18next.mjs" | ||
}, | ||
"./styles": { | ||
@@ -33,9 +39,45 @@ "require": "./dist/styles/cjs/styles.js", | ||
"import": "./dist/thumbnail/esm/thumbnail.mjs" | ||
}, | ||
"./annotation-targets": { | ||
"require": "./dist/annotation-targets/cjs/annotation-targets.js", | ||
"import": "./dist/annotation-targets/esm/annotation-targets.mjs" | ||
}, | ||
"./content-state": { | ||
"require": "./dist/content-state/cjs/content-state.js", | ||
"import": "./dist/content-state/esm/content-state.mjs" | ||
} | ||
}, | ||
"typesVersions": { | ||
"*": { | ||
"*": [ | ||
".build/types/index.d.ts" | ||
], | ||
"events": [ | ||
".build/types/events.d.ts" | ||
], | ||
"i18n": [ | ||
".build/types/i18n.d.ts" | ||
], | ||
"react-i18next": [ | ||
".build/types/react-i18next.d.ts" | ||
], | ||
"styles": [ | ||
".build/types/styles.d.ts" | ||
], | ||
"thumbnail": [ | ||
".build/types/thumbnail.d.ts" | ||
], | ||
"annotation-targets": [ | ||
".build/types/annotation-targets.d.ts" | ||
], | ||
"content-state": [ | ||
".build/types/content-state.d.ts" | ||
] | ||
} | ||
}, | ||
"scripts": { | ||
"start": "vite demos", | ||
"build": "tsc -p . --declaration --emitDeclarationOnly && rollup -c", | ||
"prepublishOnly": "tsc -p . --declaration --emitDeclarationOnly && rollup -c", | ||
"test": "jest" | ||
"build": "tsc -p . --declaration --emitDeclarationOnly && node ./vite/build.mjs", | ||
"prepublishOnly": "tsc -p . --declaration --emitDeclarationOnly && node ./vite/build.mjs", | ||
"test": "vitest" | ||
}, | ||
@@ -51,18 +93,20 @@ "dependencies": { | ||
"devDependencies": { | ||
"@types/jest": "^27.4.0", | ||
"@types/react": "^17.0.38", | ||
"@typescript-eslint/eslint-plugin": "^5.9.1", | ||
"@typescript-eslint/parser": "^5.9.1", | ||
"@vitejs/plugin-react": "^1.3.2", | ||
"chalk": "^5.0.1", | ||
"eslint": "^8.7.0", | ||
"eslint-plugin-json": "^3.1.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"jest": "^27.4.7", | ||
"happy-dom": "^6.0.3", | ||
"prettier": "^2.5.1", | ||
"react": "17.0.2", | ||
"react-i18next": "^11.15.3", | ||
"rollup": "^2.64.0", | ||
"rollup-library-template": "^1.0.2", | ||
"ts-jest": "^27.1.3", | ||
"tslib": "^2.3.1", | ||
"typescript": "^4.5.4", | ||
"vite": "^2.9.5" | ||
"tslib": "^2.4.0", | ||
"typescript": "^4.7.4", | ||
"vite": "^2.9.14", | ||
"vitest": "^0.18.0" | ||
}, | ||
@@ -69,0 +113,0 @@ "publishConfig": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
543601
54
2676
4
18
9