@sanity/block-content-to-html
Advanced tools
Comparing version 1.3.6 to 1.3.7
{ | ||
"name": "@sanity/block-content-to-html", | ||
"description": "Function for transforming Sanity block content to HTML", | ||
"version": "1.3.6", | ||
"version": "1.3.7", | ||
"main": "lib/blocksToHtml.js", | ||
@@ -25,8 +25,8 @@ "umd": "umd/blocksToHtml.min.js", | ||
"dependencies": { | ||
"@sanity/block-content-to-hyperscript": "^1.3.3" | ||
"@sanity/block-content-to-hyperscript": "^1.3.5" | ||
}, | ||
"devDependencies": { | ||
"@sanity/block-content-tests": "^0.0.9", | ||
"@sanity/block-content-tests": "^0.0.10", | ||
"babel-cli": "^6.26.0", | ||
"babel-eslint": "^8.2.3", | ||
"babel-eslint": "^8.2.5", | ||
"babel-preset-env": "^1.7.0", | ||
@@ -38,7 +38,7 @@ "browserify": "^14.4.0", | ||
"eslint-config-sanity": "^3.0.1", | ||
"eslint-plugin-import": "^2.12.0", | ||
"eslint-plugin-import": "^2.13.0", | ||
"jest": "^22.0.4", | ||
"prettier": "^1.13.2", | ||
"prettier": "^1.13.7", | ||
"rimraf": "^2.6.2", | ||
"uglify-js": "^3.3.28", | ||
"uglify-js": "^3.4.2", | ||
"uglifyify": "^4.0.3" | ||
@@ -45,0 +45,0 @@ }, |
@@ -14,3 +14,3 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.blocksToHtml = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
},{"object-assign":21}],5:[function(require,module,exports){ | ||
"use strict";var generateHelpUrl=require("@sanity/generate-help-url"),urlBuilder=require("@sanity/image-url"),objectAssign=require("object-assign"),enc=encodeURIComponent,materializeError="You must either:\n - Pass `projectId` and `dataset` to the block renderer\n - Materialize images to include the `url` field.\n\nFor more information, see "+generateHelpUrl("block-content-image-materializing"),getQueryString=function(e){var r=e.imageOptions,t=Object.keys(r);if(!t.length)return"";return"?"+t.map(function(e){return enc(e)+"="+enc(r[e])}).join("&")},buildUrl=function(e){var r=e.node,t=e.options,n=t.projectId,i=t.dataset,o=r.asset;if(!o)throw new Error("Image does not have required `asset` property");if(o.url)return o.url+getQueryString(t);if(!n||!i)throw new Error(materializeError);if(!o._ref)throw new Error("Invalid image reference in block, no `_ref` found on `asset`");return urlBuilder(objectAssign({projectId:n,dataset:i},t.imageOptions||{})).image(o).toString()};module.exports=buildUrl; | ||
"use strict";var generateHelpUrl=require("@sanity/generate-help-url"),urlBuilder=require("@sanity/image-url"),objectAssign=require("object-assign"),enc=encodeURIComponent,materializeError="You must either:\n - Pass `projectId` and `dataset` to the block renderer\n - Materialize images to include the `url` field.\n\nFor more information, see "+generateHelpUrl("block-content-image-materializing"),getQueryString=function(e){var r=e.imageOptions,t=Object.keys(r);if(!t.length)return"";return"?"+t.map(function(e){return enc(e)+"="+enc(r[e])}).join("&")},buildUrl=function(e){var r=e.node,t=e.options,n=t.projectId,i=t.dataset,o=r.asset;if(!o)throw new Error("Image does not have required `asset` property");if(o.url)return o.url+getQueryString(t);if(!n||!i)throw new Error(materializeError);if(!o._ref)throw new Error("Invalid image reference in block, no `_ref` found on `asset`");return urlBuilder(objectAssign({projectId:n,dataset:i},t.imageOptions||{})).image(r).toString()};module.exports=buildUrl; | ||
@@ -42,3 +42,3 @@ },{"@sanity/generate-help-url":10,"@sanity/image-url":11,"object-assign":21}],6:[function(require,module,exports){ | ||
},{}],14:[function(require,module,exports){ | ||
"use strict";function parseSource(t){if(!t)return null;var e=void 0;if("string"==typeof t)e={asset:{_ref:t}};else if("string"==typeof t._ref)e={asset:t};else if(t._id)e={asset:{_ref:t._id}};else{if("object"!==_typeof(t.asset))return null;e=t}return applyDefaultHotspot(e)}function applyDefaultHotspot(t){return t.crop&&t.hotspot?t:Object.assign({crop:{left:0,top:0,bottom:0,right:0},hotspot:{x:.5,y:.5,height:1,width:1}},t)}Object.defineProperty(exports,"__esModule",{value:!0});var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};exports.default=parseSource; | ||
"use strict";function parseSource(t){if(!t)return null;var e=void 0;if("string"==typeof t&&isUrl(t))e={asset:{_ref:urlToId(t)}};else if("string"==typeof t)e={asset:{_ref:t}};else if("string"==typeof t._ref)e={asset:t};else if(t._id)e={asset:{_ref:t._id}};else if(t.asset&&t.asset.url&&!t.asset._ref)e={asset:{_ref:urlToId(t.asset.url)}};else{if("object"!==_typeof(t.asset))return null;e=t}return applyDefaultHotspot(e)}function isUrl(t){return/^https?:\/\//.test(""+t)}function urlToId(t){var e=t.split("/").slice(-1);return("image-"+_slicedToArray(e,1)[0]).replace(/\.([a-z]+)$/,"-$1")}function applyDefaultHotspot(t){return t.crop&&t.hotspot?t:Object.assign({crop:{left:0,top:0,bottom:0,right:0},hotspot:{x:.5,y:.5,height:1,width:1}},t)}Object.defineProperty(exports,"__esModule",{value:!0});var _slicedToArray=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],o=!0,n=!1,s=void 0;try{for(var i,l=t[Symbol.iterator]();!(o=(i=l.next()).done)&&(r.push(i.value),!e||r.length!==e);o=!0);}catch(t){n=!0,s=t}finally{try{!o&&l.return&&l.return()}finally{if(n)throw s}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};exports.default=parseSource; | ||
@@ -45,0 +45,0 @@ },{}],15:[function(require,module,exports){ |
@@ -1,1 +0,1 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).blocksToHtml=e()}}(function(){return function o(l,s,a){function u(n,e){if(!s[n]){if(!l[n]){var t="function"==typeof require&&require;if(!e&&t)return t(n,!0);if(c)return c(n,!0);var r=new Error("Cannot find module '"+n+"'");throw r.code="MODULE_NOT_FOUND",r}var i=s[n]={exports:{}};l[n][0].call(i.exports,function(e){var t=l[n][1][e];return u(t||e)},i,i.exports,o,l,s,a)}return s[n].exports}for(var c="function"==typeof require&&require,e=0;e<a.length;e++)u(a[e]);return u}({1:[function(e,t,n){"use strict";var r=e("@sanity/block-content-to-hyperscript"),i=r.renderNode,o=function(e){var t=r(e);return t.outerHTML||t};o.defaultSerializers=r.defaultSerializers,o.getImageUrl=r.getImageUrl,o.renderNode=i,o.h=i,t.exports=o},{"@sanity/block-content-to-hyperscript":6}],2:[function(e,t,n){"use strict";function I(e){return"block"===e._type&&e.listItem}var a=e("object-assign"),_=e("./buildMarksTree"),u=e("./nestLists"),c=e("./generateKeys"),f=e("./mergeSerializers"),h=["projectId","dataset","imageOptions"],p={imageOptions:{}};t.exports=function(k,e,t,x){var r=a({},p,e),n=Array.isArray(r.blocks)?r.blocks:[r.blocks],i=c(n),o=u(i,r.listNestMode),O=f(t,r.serializers||{}),j=h.reduce(function(e,t){var n=r[t];return void 0!==n&&(e[t]=n),e},{}),l=o.map(function r(e,t,n,i){return"list"===(w=e)._type&&w.listItem?(g=(y=e).listItem,m=y.level,v=y._key,b=y.children.map(r),k(O.list,{key:v,level:m,type:g,options:j},b)):I(e)?(h=function(e,t){for(var n=0,r=0;r<t.length;r++){if(t[r]===e)return n;I(t[r])&&n++}return n}(f=e,n),p=f._key,d=_(f).map(r),k(O.listItem,{node:f,index:h,key:p,options:j},d)):"string"==typeof(c=e)||c.marks||"span"===c._type?x(e,O,t,{serializeNode:r}):(l=t,s=i,a=_(o=e).map(function(e,t,n){return r(e,t,n,!0)}),u={key:o._key||"block-"+l,node:o,isInline:s,serializers:O,options:j},k(O.block,u,a));var o,l,s,a,u,c,f,h,p,d,y,g,m,v,b,w});if(1<l.length){var s=r.className?{className:r.className}:{};return k(O.container,s,l)}return l[0]?l[0]:"function"==typeof O.empty?k(O.empty):O.empty}},{"./buildMarksTree":3,"./generateKeys":4,"./mergeSerializers":7,"./nestLists":8,"object-assign":21}],3:[function(e,t,n){"use strict";function r(e,i,o){if(!e.marks||0===e.marks.length)return e.marks||[];var t=e.marks.reduce(function(e,t){e[t]=e[t]?e[t]+1:1;for(var n=i+1;n<o.length;n++){var r=o[n];if(!(r.marks&&Array.isArray(r.marks)&&r.marks.includes(t)))break;e[t]++}return e},{}),n=function(e,t,n){var r=e[t]||0,i=e[n]||0;if(r!==i)return i-r;var o=s.indexOf(t),l=s.indexOf(n);return o!==l?o-l:t<n?-1:n<t?1:0}.bind(null,t);return e.marks.slice().sort(n)}var s=["strong","em","code","underline","strike-through"];t.exports=function(e){var t=e.children,c=e.markDefs;if(!t||!t.length)return[];var f=t.map(r),n={_type:"span",children:[]},h=[n];return t.forEach(function(n,e){var t,r=f[e];if(r){var i=1;if(1<h.length)for(;i<h.length;i++){var o=h[i].markKey;if(!r.includes(o))break;var l=r.indexOf(o);r.splice(l,1)}var s=function(e){for(var t=e.length-1;0<=t;t--){var n=e[t];if("span"===n._type&&n.children)return n}}(h=h.slice(0,i));if(r.forEach(function(t){var e={_type:"span",_key:n._key,children:[],mark:c.find(function(e){return e._key===t})||t,markKey:t};s.children.push(e),h.push(e),s=e}),"string"==typeof(t=n).text&&Array.isArray(t.marks)){for(var a=n.text.split("\n"),u=a.length;1<u--;)a.splice(u,0,"\n");s.children=s.children.concat(a)}else s.children=s.children.concat(n)}else h[h.length-1].children.push(n)}),n.children}},{}],4:[function(e,t,n){"use strict";var r=e("object-assign");t.exports=function(e){return e.map(function(e){return e._key?e:r({_key:(t=e,function(e){var t=0,n=e.length;if(0===n)return t;for(var r=0;r<n;r++)t=(t<<5)-t+e.charCodeAt(r),t&=t;return t}(JSON.stringify(t)).toString(36).replace(/[^A-Za-z0-9]/g,""))},e);var t})}},{"object-assign":21}],5:[function(e,t,n){"use strict";var r=e("@sanity/generate-help-url"),a=e("@sanity/image-url"),u=e("object-assign"),c=encodeURIComponent,f="You must either:\n - Pass `projectId` and `dataset` to the block renderer\n - Materialize images to include the `url` field.\n\nFor more information, see "+r("block-content-image-materializing");t.exports=function(e){var t,n,r=e.node,i=e.options,o=i.projectId,l=i.dataset,s=r.asset;if(!s)throw new Error("Image does not have required `asset` property");if(s.url)return s.url+(t=i.imageOptions,(n=Object.keys(t)).length?"?"+n.map(function(e){return c(e)+"="+c(t[e])}).join("&"):"");if(!o||!l)throw new Error(f);if(!s._ref)throw new Error("Invalid image reference in block, no `_ref` found on `asset`");return a(u({projectId:o,dataset:l},i.imageOptions||{})).image(s).toString()}},{"@sanity/generate-help-url":10,"@sanity/image-url":11,"object-assign":21}],6:[function(e,t,n){"use strict";var i=e("hyperscript"),o=e("object-assign"),r=e("./getImageUrl"),l=e("./blocksToNodes"),s=e("./serializers"),a=function(e,t,n){var r=t||{};return"function"==typeof e?e(o({},r,{children:n})):i(e,r,r.children||n)},u=s(a),c=u.defaultSerializers,f=u.serializeSpan,h=function(e){return l(a,e,c,f)};h.defaultSerializers=c,h.getImageUrl=r,h.renderNode=a,t.exports=h},{"./blocksToNodes":2,"./getImageUrl":5,"./serializers":9,hyperscript:19,"object-assign":21}],7:[function(e,t,n){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l=e("object-assign");t.exports=function(r,i){return Object.keys(r).reduce(function(e,t){var n=o(r[t]);return e[t]="function"===n?void 0!==i[t]?i[t]:r[t]:"object"===n?l({},r[t],i[t]):void 0===i[t]?r[t]:i[t],e},{})}},{"object-assign":21}],8:[function(e,t,n){"use strict";function p(e){return{_type:"list",_key:e._key+"-parent",level:e.level,listItem:e.listItem,children:[e]}}function d(e){return e.children&&e.children[e.children.length-1]}function y(e,t){var n="string"==typeof t.listItem;if("list"===e._type&&e.level===t.level&&n&&e.listItem===t.listItem)return e;var r=d(e);return!!r&&y(r,t)}var g=e("object-assign");t.exports=function(e){for(var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"html",n=[],r=void 0,i=0;i<e.length;i++){var o=e[i];if(Boolean(o.listItem))if(r)if(h=r,(f=o).level===h.level&&f.listItem===h.listItem)r.children.push(o);else if(o.level>r.level){var l=p(o);if("html"===t){var s=d(r),a=g({},s,{children:s.children.concat(l)});r.children[r.children.length-1]=a}else r.children.push(l);r=l}else if(o.level<r.level){var u=y(n[n.length-1],o);if(u){(r=u).children.push(o);continue}r=p(o),n.push(r)}else if(o.listItem===r.listItem)console.warn("Unknown state encountered for block",o),n.push(o);else{var c=y(n[n.length-1],{level:o.level});if(c&&c.listItem===o.listItem){(r=c).children.push(o);continue}r=p(o),n.push(r)}else r=p(o),n.push(r);else n.push(o),r=null}var f,h;return n}},{"object-assign":21}],9:[function(e,t,n){"use strict";var l=e("object-assign"),r=e("./getImageUrl");t.exports=function(a){function e(e,t){return a(e,null,t.children)}return{defaultSerializers:{types:{block:function(e){var t=e.node.style||"normal";return/^h\d/.test(t)?a(t,null,e.children):a("blockquote"===t?"blockquote":"p",null,e.children)},image:function(e){var t=a("img",{src:r(e)});return e.isInline?t:a("figure",null,t)}},marks:{strong:e.bind(null,"strong"),em:e.bind(null,"em"),code:e.bind(null,"code"),underline:function(e){return a("span",{style:{textDecoration:"underline"}},e.children)},"strike-through":function(e){return a("del",null,e.children)},link:function(e){return a("a",{href:e.mark.href},e.children)}},list:function(e){var t="bullet"===e.type?"ul":"ol";return a(t,null,e.children)},listItem:function(e){return a("li",null,e.children)},block:function(e){var t=e.node,n=e.serializers,r=e.options,i=e.isInline,o=e.children,l=t._type,s=n.types[l];if(!s)throw new Error('Unknown block type "'+l+'", please specify a serializer for it in the `serializers.types` prop');return a(s,{node:t,options:r,isInline:i},o)},span:function(e){var t=e.node,n=t.mark,r=t.children,i="string"==typeof n?n:n._type,o=e.serializers.marks[i];return o?a(o,e.node,r):(console.warn('Unknown mark type "'+i+'", please specify a serializer for it in the `serializers.marks` prop'),a(e.serializers.markFallback,null,r))},hardBreak:function(){return a("br")},container:"div",markFallback:"span",text:void 0,empty:""},serializeSpan:function(n,e,t,r){if("\n"===n&&e.hardBreak)return a(e.hardBreak,{key:"hb-"+t});if("string"==typeof n)return e.text?a(e.text,{key:"text-"+t},n):n;var i=void 0;n.children&&(i={children:n.children.map(function(e,t){return r.serializeNode(e,t,n.children,!0)})});var o=l({},n,i);return a(e.span,{key:n._key||"span-"+t,node:o,serializers:e})}}}},{"./getImageUrl":5,"object-assign":21}],10:[function(e,t,n){t.exports=function(e){return"https://docs.sanity.io/help/"+e}},{}],11:[function(e,t,n){t.exports=e("./lib/builder").default},{"./lib/builder":12}],12:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function r(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)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}();n.default=function(e){return e&&"object"===r(e.clientConfig)?new c(null,{baseUrl:e.clientConfig.apiHost.replace(/^https:\/\/api\./,"https://cdn."),projectId:e.clientConfig.projectId,dataset:e.clientConfig.dataset}):new c(null,e)};var o,l=e("./urlForImage"),s=(o=l)&&o.__esModule?o:{default:o},a=["clip","crop","fill","fillmax","max","scale","min"],u=["top","bottom","left","right","center","focalpoint","entropy"],c=function(){function n(e,t){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,n),this.options=e?Object.assign({},e.options,t||{}):t||{}}return i(n,[{key:"withOptions",value:function(e){return new n(this,e)}},{key:"image",value:function(e){return this.withOptions({source:e})}},{key:"dataset",value:function(e){return this.withOptions({dataset:e})}},{key:"projectId",value:function(e){return this.withOptions({projectId:e})}},{key:"width",value:function(e){return this.withOptions({width:e})}},{key:"height",value:function(e){return this.withOptions({height:e})}},{key:"focalPoint",value:function(e,t){return this.withOptions({focalPoint:{x:e,y:t}})}},{key:"maxWidth",value:function(e){return this.withOptions({maxWidth:e})}},{key:"minWidth",value:function(e){return this.withOptions({minWidth:e})}},{key:"maxHeight",value:function(e){return this.withOptions({maxHeight:e})}},{key:"minHeight",value:function(e){return this.withOptions({minHeight:e})}},{key:"size",value:function(e,t){return this.withOptions({width:e,height:t})}},{key:"blur",value:function(e){return this.withOptions({blur:e})}},{key:"sharpen",value:function(e){return this.withOptions({sharpen:e})}},{key:"rect",value:function(e,t,n,r){return this.withOptions({rect:{left:e,top:t,width:n,height:r}})}},{key:"format",value:function(e){return this.withOptions({format:e})}},{key:"invert",value:function(e){return this.withOptions({invert:e})}},{key:"orientation",value:function(e){return this.withOptions({orientation:e})}},{key:"quality",value:function(e){return this.withOptions({quality:e})}},{key:"forceDownload",value:function(e){return this.withOptions({download:e})}},{key:"flipHorizontal",value:function(){return this.withOptions({flipHorizontal:!0})}},{key:"flipVertical",value:function(){return this.withOptions({flipVertical:!0})}},{key:"ignoreImageParams",value:function(){return this.withOptions({ignoreImageParams:!0})}},{key:"fit",value:function(e){if(-1===a.indexOf(e))throw new Error('Invalid fit mode "'+e+'"');return this.withOptions({fit:e})}},{key:"crop",value:function(e){if(-1===u.indexOf(e))throw new Error('Invalid crop mode "'+e+'"');return this.withOptions({crop:e})}},{key:"url",value:function(){return(0,s.default)(this.options)}},{key:"toString",value:function(){return this.url()}}]),n}()},{"./urlForImage":15}],13:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var c=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var l,s=e[Symbol.iterator]();!(r=(l=s.next()).done)&&(n.push(l.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw o}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};n.default=function(e){var t=e.split("-"),n=c(t,4),r=n[1],i=n[2],o=n[3];if(!r||!i||!o)throw new Error("Malformed asset _ref '"+e+"'. Expected an id like \""+f+'".');var l=i.split("x"),s=c(l,2),a=+s[0],u=+s[1];if(!Number.isFinite(a)||!Number.isFinite(u))throw new Error("Malformed asset _ref '"+e+"'. Expected an id like \""+f+'".');return{id:r,width:a,height:u,format:o}};var f="image-Tb9Ew8CXIwaY6R1kjMvI0uRR-2000x3000-jpg"},{}],14:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};n.default=function(e){if(!e)return null;var t,n=void 0;if("string"==typeof e)n={asset:{_ref:e}};else if("string"==typeof e._ref)n={asset:e};else if(e._id)n={asset:{_ref:e._id}};else{if("object"!==r(e.asset))return null;n=e}return(t=n).crop&&t.hotspot?t:Object.assign({crop:{left:0,top:0,bottom:0,right:0},hotspot:{x:.5,y:.5,height:1,width:1}},t)}},{}],15:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"__esModule",{value:!0}),n.parseSource=void 0;var g=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var l,s=e[Symbol.iterator]();!(r=(l=s.next()).done)&&(n.push(l.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw o}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};n.default=function(e){var t=Object.assign({},e||{}),n=t.source;delete t.source;var r=(0,m.default)(n);if(!r)return null;var i=(0,v.default)(r.asset._ref),o={left:Math.round(r.crop.left*i.width),top:Math.round(r.crop.top*i.height)};o.width=Math.round(i.width-r.crop.right*i.width-o.left),o.height=Math.round(i.height-r.crop.bottom*i.height-o.top);var l=r.hotspot.height*i.height/2,s=r.hotspot.width*i.width/2,a=r.hotspot.x*i.width,u=r.hotspot.y*i.height,c={left:a-s,top:u-l,right:a+s,bottom:u+s};return t.asset=i,t.rect||t.focalPoint||t.ignoreImageParams||t.crop||(t=Object.assign(t,function(e,t){var n={width:t.width,height:t.height};if(!t.width||!t.height)return n.rect=e.crop,n;var r=e.crop,i=e.hotspot,o=t.width/t.height;if(r.width/r.height>o){var l=r.height,s=l*o,a=r.top,u=(i.right-i.left)/2+i.left-s/2;return u<r.left?u=r.left:u+s>r.left+r.width&&(u=r.left+r.width-s),n.rect={left:Math.round(u),top:Math.round(a),width:Math.round(s),height:Math.round(l)},n}var c=r.width,f=c/o,h=r.left,p=(i.bottom-i.top)/2+i.top-f/2;return p<r.top?p=r.top:p+f>r.top+r.height&&(p=r.top+r.height-f),n.rect={left:Math.floor(h),top:Math.floor(p),width:Math.round(c),height:Math.round(f)},n}({crop:o,hotspot:c},t))),f=t,h=f.baseUrl||"https://cdn.sanity.io",p=f.asset.id+"-"+f.asset.width+"x"+f.asset.height+"."+f.asset.format,d=h+"/images/"+f.projectId+"/"+f.dataset+"/"+p,y=[],f.rect&&(0!=f.rect.left||0!=f.rect.top||f.rect.height!=f.asset.height||f.rect.width!=f.asset.width)&&y.push("rect="+f.rect.left+","+f.rect.top+","+f.rect.width+","+f.rect.height),f.focalPoint&&(y.push("fp-x="+f.focalPoint.x),y.push("fp-x="+f.focalPoint.y)),(f.flipHorizontal||f.flipVertical)&&y.push("flip="+(f.flipHorizontal?"h":"")+(f.flipVertical?"v":"")),b.forEach(function(e){var t=g(e,2),n=t[0],r=t[1];void 0!==f[n]?y.push(r+"="+encodeURIComponent(f[n])):void 0!==f[r]&&y.push(r+"="+encodeURIComponent(f[r]))}),0===y.length?d:d+"?"+y.join("&");var f,h,p,d,y};var m=r(e("./parseSource")),v=r(e("./parseAssetId")),b=[["width","w"],["height","h"],["format","fm"],["download","dl"],["blur","blur"],["sharpen","sharp"],["invert","invert"],["orientation","or"],["minHeight","min-h"],["maxHeight","max-h"],["minWidth","min-w"],["maxWidth","max-w"],["quality","q"],["fit","fit"],["crop","crop"]];n.parseSource=m.default},{"./parseAssetId":13,"./parseSource":14}],16:[function(e,t,n){},{}],17:[function(e,t,n){var c,f,h;t.exports=(f=String.prototype.split,h=/()??/.exec("")[1]===c,function(e,t,n){if("[object RegExp]"!==Object.prototype.toString.call(t))return f.call(e,t,n);var r,i,o,l,s=[],a=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.extended?"x":"")+(t.sticky?"y":""),u=0;for(t=new RegExp(t.source,a+"g"),e+="",h||(r=new RegExp("^"+t.source+"$(?!\\s)",a)),n=n===c?-1>>>0:n>>>0;(i=t.exec(e))&&!((o=i.index+i[0].length)>u&&(s.push(e.slice(u,i.index)),!h&&1<i.length&&i[0].replace(r,function(){for(var e=1;e<arguments.length-2;e++)arguments[e]===c&&(i[e]=c)}),1<i.length&&i.index<e.length&&Array.prototype.push.apply(s,i.slice(1)),l=i[0].length,u=o,s.length>=n));)t.lastIndex===i.index&&t.lastIndex++;return u===e.length?!l&&t.test("")||s.push(""):s.push(e.slice(u)),s.length>n?s.slice(0,n):s})},{}],18:[function(e,t,n){function a(e){return!!e}var u=e("indexof");t.exports=function(r){function t(e){var t=o();-1<u(t,e)||(t.push(e),l(t))}function n(e){var t=o(),n=u(t,e);-1!==n&&(t.splice(n,1),l(t))}function i(e){return-1<u(o(),e)}function o(){return function(e,t){for(var n=[],r=0;r<e.length;r++)t(e[r])&&n.push(e[r]);return n}(r.className.split(" "),a)}function l(e){var t=e.length;r.className=e.join(" "),s.length=t;for(var n=0;n<e.length;n++)s[n]=e[n];delete e[t]}var e=r.classList;if(e)return e;var s={add:t,remove:n,contains:i,toggle:function(e){return i(e)?(n(e),!1):(t(e),!0)},toString:function(){return r.className},length:0,item:function(e){return o()[e]||null}};return s}},{indexof:20}],19:[function(e,t,n){function r(){function e(){function s(r){var t,e,n;if(null==r);else if("string"==typeof r)a?a.appendChild(t=d.createTextNode(r)):(n=h(r,/([\.#]?[^\s#.]+)/),/^\.|#/.test(n[1])&&(a=d.createElement("div")),f(n,function(e){var t=e.substring(1,e.length);e&&(a?"."===e[0]?p(a).add(t):"#"===e[0]&&a.setAttribute("id",t):a=d.createElement(e))}));else if("number"==typeof r||"boolean"==typeof r||r instanceof Date||r instanceof RegExp)a.appendChild(t=d.createTextNode(r.toString()));else if(e=r,"[object Array]"==Object.prototype.toString.call(e))f(r,s);else if(c(r))a.appendChild(t=r);else if(r instanceof y)a.appendChild(t=r);else if("object"==typeof r)for(var i in r)if("function"==typeof r[i])/^on\w+/.test(i)?function(e,t){a.addEventListener?(a.addEventListener(e.substring(2),t[e],!1),u.push(function(){a.removeEventListener(e.substring(2),t[e],!1)})):(a.attachEvent(e,t[e]),u.push(function(){a.detachEvent(e,t[e])}))}(i,r):(a[i]=r[i](),u.push(r[i](function(e){a[i]=e})));else if("style"===i)if("string"==typeof r[i])a.style.cssText=r[i];else for(var o in r[i])!function(t,e){if("function"==typeof e)a.style.setProperty(t,e()),u.push(e(function(e){a.style.setProperty(t,e)}));else var n=r[i][t].match(/(.*)\W+!important\W*$/);n?a.style.setProperty(t,n[1],"important"):a.style.setProperty(t,r[i][t])}(o,r[i][o]);else if("attrs"===i)for(var l in r[i])a.setAttribute(l,r[i][l]);else"data-"===i.substr(0,5)?a.setAttribute(i,r[i]):a[i]=r[i];else"function"==typeof r&&(l=r(),a.appendChild(t=c(l)?l:d.createTextNode(l)),u.push(r(function(e){c(e)&&t.parentElement?(t.parentElement.replaceChild(e,t),t=e):t.textContent=e})));return t}for(var e=[].slice.call(arguments),a=null;e.length;)s(e.shift());return a}var u=[];return e.cleanup=function(){for(var e=0;e<u.length;e++)u[e]();u.length=0},e}function c(e){return e&&e.nodeName&&e.nodeType}function f(e,t){if(e.forEach)return e.forEach(t);for(var n=0;n<e.length;n++)t(e[n],n)}var h=e("browser-split"),p=e("class-list"),i="undefined"==typeof window?e("html-element"):window,d=i.document,y=i.Text;(t.exports=r()).context=r},{"browser-split":17,"class-list":18,"html-element":16}],20:[function(e,t,n){var r=[].indexOf;t.exports=function(e,t){if(r)return e.indexOf(t);for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1}},{}],21:[function(e,t,n){"use strict";var a=Object.getOwnPropertySymbols,u=Object.prototype.hasOwnProperty,c=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,r,i=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),o=1;o<arguments.length;o++){for(var l in n=Object(arguments[o]))u.call(n,l)&&(i[l]=n[l]);if(a){r=a(n);for(var s=0;s<r.length;s++)c.call(n,r[s])&&(i[r[s]]=n[r[s]])}}return i}},{}]},{},[1])(1)}); | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).blocksToHtml=e()}}(function(){return function o(s,a,l){function u(r,e){if(!a[r]){if(!s[r]){var t="function"==typeof require&&require;if(!e&&t)return t(r,!0);if(c)return c(r,!0);var n=new Error("Cannot find module '"+r+"'");throw n.code="MODULE_NOT_FOUND",n}var i=a[r]={exports:{}};s[r][0].call(i.exports,function(e){var t=s[r][1][e];return u(t||e)},i,i.exports,o,s,a,l)}return a[r].exports}for(var c="function"==typeof require&&require,e=0;e<l.length;e++)u(l[e]);return u}({1:[function(e,t,r){"use strict";var n=e("@sanity/block-content-to-hyperscript"),i=n.renderNode,o=function(e){var t=n(e);return t.outerHTML||t};o.defaultSerializers=n.defaultSerializers,o.getImageUrl=n.getImageUrl,o.renderNode=i,o.h=i,t.exports=o},{"@sanity/block-content-to-hyperscript":6}],2:[function(e,t,r){"use strict";function I(e){return"block"===e._type&&e.listItem}var l=e("object-assign"),_=e("./buildMarksTree"),u=e("./nestLists"),c=e("./generateKeys"),f=e("./mergeSerializers"),h=["projectId","dataset","imageOptions"],p={imageOptions:{}};t.exports=function(k,e,t,x){var n=l({},p,e),r=Array.isArray(n.blocks)?n.blocks:[n.blocks],i=c(r),o=u(i,n.listNestMode),O=f(t,n.serializers||{}),j=h.reduce(function(e,t){var r=n[t];return void 0!==r&&(e[t]=r),e},{}),s=o.map(function n(e,t,r,i){return"list"===(w=e)._type&&w.listItem?(g=(y=e).listItem,m=y.level,v=y._key,b=y.children.map(n),k(O.list,{key:v,level:m,type:g,options:j},b)):I(e)?(h=function(e,t){for(var r=0,n=0;n<t.length;n++){if(t[n]===e)return r;I(t[n])&&r++}return r}(f=e,r),p=f._key,d=_(f).map(n),k(O.listItem,{node:f,index:h,key:p,options:j},d)):"string"==typeof(c=e)||c.marks||"span"===c._type?x(e,O,t,{serializeNode:n}):(s=t,a=i,l=_(o=e).map(function(e,t,r){return n(e,t,r,!0)}),u={key:o._key||"block-"+s,node:o,isInline:a,serializers:O,options:j},k(O.block,u,l));var o,s,a,l,u,c,f,h,p,d,y,g,m,v,b,w});if(1<s.length){var a=n.className?{className:n.className}:{};return k(O.container,a,s)}return s[0]?s[0]:"function"==typeof O.empty?k(O.empty):O.empty}},{"./buildMarksTree":3,"./generateKeys":4,"./mergeSerializers":7,"./nestLists":8,"object-assign":21}],3:[function(e,t,r){"use strict";function n(e,i,o){if(!e.marks||0===e.marks.length)return e.marks||[];var t=e.marks.reduce(function(e,t){e[t]=e[t]?e[t]+1:1;for(var r=i+1;r<o.length;r++){var n=o[r];if(!(n.marks&&Array.isArray(n.marks)&&n.marks.includes(t)))break;e[t]++}return e},{}),r=function(e,t,r){var n=e[t]||0,i=e[r]||0;if(n!==i)return i-n;var o=a.indexOf(t),s=a.indexOf(r);return o!==s?o-s:t<r?-1:r<t?1:0}.bind(null,t);return e.marks.slice().sort(r)}var a=["strong","em","code","underline","strike-through"];t.exports=function(e){var t=e.children,c=e.markDefs;if(!t||!t.length)return[];var f=t.map(n),r={_type:"span",children:[]},h=[r];return t.forEach(function(r,e){var t,n=f[e];if(n){var i=1;if(1<h.length)for(;i<h.length;i++){var o=h[i].markKey;if(!n.includes(o))break;var s=n.indexOf(o);n.splice(s,1)}var a=function(e){for(var t=e.length-1;0<=t;t--){var r=e[t];if("span"===r._type&&r.children)return r}}(h=h.slice(0,i));if(n.forEach(function(t){var e={_type:"span",_key:r._key,children:[],mark:c.find(function(e){return e._key===t})||t,markKey:t};a.children.push(e),h.push(e),a=e}),"string"==typeof(t=r).text&&Array.isArray(t.marks)){for(var l=r.text.split("\n"),u=l.length;1<u--;)l.splice(u,0,"\n");a.children=a.children.concat(l)}else a.children=a.children.concat(r)}else h[h.length-1].children.push(r)}),r.children}},{}],4:[function(e,t,r){"use strict";var n=e("object-assign");t.exports=function(e){return e.map(function(e){return e._key?e:n({_key:(t=e,function(e){var t=0,r=e.length;if(0===r)return t;for(var n=0;n<r;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return t}(JSON.stringify(t)).toString(36).replace(/[^A-Za-z0-9]/g,""))},e);var t})}},{"object-assign":21}],5:[function(e,t,r){"use strict";var n=e("@sanity/generate-help-url"),l=e("@sanity/image-url"),u=e("object-assign"),c=encodeURIComponent,f="You must either:\n - Pass `projectId` and `dataset` to the block renderer\n - Materialize images to include the `url` field.\n\nFor more information, see "+n("block-content-image-materializing");t.exports=function(e){var t,r,n=e.node,i=e.options,o=i.projectId,s=i.dataset,a=n.asset;if(!a)throw new Error("Image does not have required `asset` property");if(a.url)return a.url+(t=i.imageOptions,(r=Object.keys(t)).length?"?"+r.map(function(e){return c(e)+"="+c(t[e])}).join("&"):"");if(!o||!s)throw new Error(f);if(!a._ref)throw new Error("Invalid image reference in block, no `_ref` found on `asset`");return l(u({projectId:o,dataset:s},i.imageOptions||{})).image(n).toString()}},{"@sanity/generate-help-url":10,"@sanity/image-url":11,"object-assign":21}],6:[function(e,t,r){"use strict";var i=e("hyperscript"),o=e("object-assign"),n=e("./getImageUrl"),s=e("./blocksToNodes"),a=e("./serializers"),l=function(e,t,r){var n=t||{};return"function"==typeof e?e(o({},n,{children:r})):i(e,n,n.children||r)},u=a(l),c=u.defaultSerializers,f=u.serializeSpan,h=function(e){return s(l,e,c,f)};h.defaultSerializers=c,h.getImageUrl=n,h.renderNode=l,t.exports=h},{"./blocksToNodes":2,"./getImageUrl":5,"./serializers":9,hyperscript:19,"object-assign":21}],7:[function(e,t,r){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=e("object-assign");t.exports=function(n,i){return Object.keys(n).reduce(function(e,t){var r=o(n[t]);return e[t]="function"===r?void 0!==i[t]?i[t]:n[t]:"object"===r?s({},n[t],i[t]):void 0===i[t]?n[t]:i[t],e},{})}},{"object-assign":21}],8:[function(e,t,r){"use strict";function p(e){return{_type:"list",_key:e._key+"-parent",level:e.level,listItem:e.listItem,children:[e]}}function d(e){return e.children&&e.children[e.children.length-1]}function y(e,t){var r="string"==typeof t.listItem;if("list"===e._type&&e.level===t.level&&r&&e.listItem===t.listItem)return e;var n=d(e);return!!n&&y(n,t)}var g=e("object-assign");t.exports=function(e){for(var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"html",r=[],n=void 0,i=0;i<e.length;i++){var o=e[i];if(Boolean(o.listItem))if(n)if(h=n,(f=o).level===h.level&&f.listItem===h.listItem)n.children.push(o);else if(o.level>n.level){var s=p(o);if("html"===t){var a=d(n),l=g({},a,{children:a.children.concat(s)});n.children[n.children.length-1]=l}else n.children.push(s);n=s}else if(o.level<n.level){var u=y(r[r.length-1],o);if(u){(n=u).children.push(o);continue}n=p(o),r.push(n)}else if(o.listItem===n.listItem)console.warn("Unknown state encountered for block",o),r.push(o);else{var c=y(r[r.length-1],{level:o.level});if(c&&c.listItem===o.listItem){(n=c).children.push(o);continue}n=p(o),r.push(n)}else n=p(o),r.push(n);else r.push(o),n=null}var f,h;return r}},{"object-assign":21}],9:[function(e,t,r){"use strict";var s=e("object-assign"),n=e("./getImageUrl");t.exports=function(l){function e(e,t){return l(e,null,t.children)}return{defaultSerializers:{types:{block:function(e){var t=e.node.style||"normal";return/^h\d/.test(t)?l(t,null,e.children):l("blockquote"===t?"blockquote":"p",null,e.children)},image:function(e){var t=l("img",{src:n(e)});return e.isInline?t:l("figure",null,t)}},marks:{strong:e.bind(null,"strong"),em:e.bind(null,"em"),code:e.bind(null,"code"),underline:function(e){return l("span",{style:{textDecoration:"underline"}},e.children)},"strike-through":function(e){return l("del",null,e.children)},link:function(e){return l("a",{href:e.mark.href},e.children)}},list:function(e){var t="bullet"===e.type?"ul":"ol";return l(t,null,e.children)},listItem:function(e){return l("li",null,e.children)},block:function(e){var t=e.node,r=e.serializers,n=e.options,i=e.isInline,o=e.children,s=t._type,a=r.types[s];if(!a)throw new Error('Unknown block type "'+s+'", please specify a serializer for it in the `serializers.types` prop');return l(a,{node:t,options:n,isInline:i},o)},span:function(e){var t=e.node,r=t.mark,n=t.children,i="string"==typeof r?r:r._type,o=e.serializers.marks[i];return o?l(o,e.node,n):(console.warn('Unknown mark type "'+i+'", please specify a serializer for it in the `serializers.marks` prop'),l(e.serializers.markFallback,null,n))},hardBreak:function(){return l("br")},container:"div",markFallback:"span",text:void 0,empty:""},serializeSpan:function(r,e,t,n){if("\n"===r&&e.hardBreak)return l(e.hardBreak,{key:"hb-"+t});if("string"==typeof r)return e.text?l(e.text,{key:"text-"+t},r):r;var i=void 0;r.children&&(i={children:r.children.map(function(e,t){return n.serializeNode(e,t,r.children,!0)})});var o=s({},r,i);return l(e.span,{key:r._key||"span-"+t,node:o,serializers:e})}}}},{"./getImageUrl":5,"object-assign":21}],10:[function(e,t,r){t.exports=function(e){return"https://docs.sanity.io/help/"+e}},{}],11:[function(e,t,r){t.exports=e("./lib/builder").default},{"./lib/builder":12}],12:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}}();r.default=function(e){return e&&"object"===n(e.clientConfig)?new c(null,{baseUrl:e.clientConfig.apiHost.replace(/^https:\/\/api\./,"https://cdn."),projectId:e.clientConfig.projectId,dataset:e.clientConfig.dataset}):new c(null,e)};var o,s=e("./urlForImage"),a=(o=s)&&o.__esModule?o:{default:o},l=["clip","crop","fill","fillmax","max","scale","min"],u=["top","bottom","left","right","center","focalpoint","entropy"],c=function(){function r(e,t){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,r),this.options=e?Object.assign({},e.options,t||{}):t||{}}return i(r,[{key:"withOptions",value:function(e){return new r(this,e)}},{key:"image",value:function(e){return this.withOptions({source:e})}},{key:"dataset",value:function(e){return this.withOptions({dataset:e})}},{key:"projectId",value:function(e){return this.withOptions({projectId:e})}},{key:"width",value:function(e){return this.withOptions({width:e})}},{key:"height",value:function(e){return this.withOptions({height:e})}},{key:"focalPoint",value:function(e,t){return this.withOptions({focalPoint:{x:e,y:t}})}},{key:"maxWidth",value:function(e){return this.withOptions({maxWidth:e})}},{key:"minWidth",value:function(e){return this.withOptions({minWidth:e})}},{key:"maxHeight",value:function(e){return this.withOptions({maxHeight:e})}},{key:"minHeight",value:function(e){return this.withOptions({minHeight:e})}},{key:"size",value:function(e,t){return this.withOptions({width:e,height:t})}},{key:"blur",value:function(e){return this.withOptions({blur:e})}},{key:"sharpen",value:function(e){return this.withOptions({sharpen:e})}},{key:"rect",value:function(e,t,r,n){return this.withOptions({rect:{left:e,top:t,width:r,height:n}})}},{key:"format",value:function(e){return this.withOptions({format:e})}},{key:"invert",value:function(e){return this.withOptions({invert:e})}},{key:"orientation",value:function(e){return this.withOptions({orientation:e})}},{key:"quality",value:function(e){return this.withOptions({quality:e})}},{key:"forceDownload",value:function(e){return this.withOptions({download:e})}},{key:"flipHorizontal",value:function(){return this.withOptions({flipHorizontal:!0})}},{key:"flipVertical",value:function(){return this.withOptions({flipVertical:!0})}},{key:"ignoreImageParams",value:function(){return this.withOptions({ignoreImageParams:!0})}},{key:"fit",value:function(e){if(-1===l.indexOf(e))throw new Error('Invalid fit mode "'+e+'"');return this.withOptions({fit:e})}},{key:"crop",value:function(e){if(-1===u.indexOf(e))throw new Error('Invalid crop mode "'+e+'"');return this.withOptions({crop:e})}},{key:"url",value:function(){return(0,a.default)(this.options)}},{key:"toString",value:function(){return this.url()}}]),r}()},{"./urlForImage":15}],13:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var c=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};r.default=function(e){var t=e.split("-"),r=c(t,4),n=r[1],i=r[2],o=r[3];if(!n||!i||!o)throw new Error("Malformed asset _ref '"+e+"'. Expected an id like \""+f+'".');var s=i.split("x"),a=c(s,2),l=+a[0],u=+a[1];if(!Number.isFinite(l)||!Number.isFinite(u))throw new Error("Malformed asset _ref '"+e+"'. Expected an id like \""+f+'".');return{id:n,width:l,height:u,format:o}};var f="image-Tb9Ew8CXIwaY6R1kjMvI0uRR-2000x3000-jpg"},{}],14:[function(e,t,r){"use strict";function n(e){var t=e.split("/").slice(-1);return("image-"+i(t,1)[0]).replace(/\.([a-z]+)$/,"-$1")}Object.defineProperty(r,"__esModule",{value:!0});var i=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};r.default=function(e){if(!e)return null;var t,r=void 0;if("string"==typeof e&&/^https?:\/\//.test(""+e))r={asset:{_ref:n(e)}};else if("string"==typeof e)r={asset:{_ref:e}};else if("string"==typeof e._ref)r={asset:e};else if(e._id)r={asset:{_ref:e._id}};else if(e.asset&&e.asset.url&&!e.asset._ref)r={asset:{_ref:n(e.asset.url)}};else{if("object"!==o(e.asset))return null;r=e}return(t=r).crop&&t.hotspot?t:Object.assign({crop:{left:0,top:0,bottom:0,right:0},hotspot:{x:.5,y:.5,height:1,width:1}},t)}},{}],15:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0}),r.parseSource=void 0;var g=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};r.default=function(e){var t=Object.assign({},e||{}),r=t.source;delete t.source;var n=(0,m.default)(r);if(!n)return null;var i=(0,v.default)(n.asset._ref),o={left:Math.round(n.crop.left*i.width),top:Math.round(n.crop.top*i.height)};o.width=Math.round(i.width-n.crop.right*i.width-o.left),o.height=Math.round(i.height-n.crop.bottom*i.height-o.top);var s=n.hotspot.height*i.height/2,a=n.hotspot.width*i.width/2,l=n.hotspot.x*i.width,u=n.hotspot.y*i.height,c={left:l-a,top:u-s,right:l+a,bottom:u+a};return t.asset=i,t.rect||t.focalPoint||t.ignoreImageParams||t.crop||(t=Object.assign(t,function(e,t){var r={width:t.width,height:t.height};if(!t.width||!t.height)return r.rect=e.crop,r;var n=e.crop,i=e.hotspot,o=t.width/t.height;if(n.width/n.height>o){var s=n.height,a=s*o,l=n.top,u=(i.right-i.left)/2+i.left-a/2;return u<n.left?u=n.left:u+a>n.left+n.width&&(u=n.left+n.width-a),r.rect={left:Math.round(u),top:Math.round(l),width:Math.round(a),height:Math.round(s)},r}var c=n.width,f=c/o,h=n.left,p=(i.bottom-i.top)/2+i.top-f/2;return p<n.top?p=n.top:p+f>n.top+n.height&&(p=n.top+n.height-f),r.rect={left:Math.floor(h),top:Math.floor(p),width:Math.round(c),height:Math.round(f)},r}({crop:o,hotspot:c},t))),f=t,h=f.baseUrl||"https://cdn.sanity.io",p=f.asset.id+"-"+f.asset.width+"x"+f.asset.height+"."+f.asset.format,d=h+"/images/"+f.projectId+"/"+f.dataset+"/"+p,y=[],f.rect&&(0!=f.rect.left||0!=f.rect.top||f.rect.height!=f.asset.height||f.rect.width!=f.asset.width)&&y.push("rect="+f.rect.left+","+f.rect.top+","+f.rect.width+","+f.rect.height),f.focalPoint&&(y.push("fp-x="+f.focalPoint.x),y.push("fp-x="+f.focalPoint.y)),(f.flipHorizontal||f.flipVertical)&&y.push("flip="+(f.flipHorizontal?"h":"")+(f.flipVertical?"v":"")),b.forEach(function(e){var t=g(e,2),r=t[0],n=t[1];void 0!==f[r]?y.push(n+"="+encodeURIComponent(f[r])):void 0!==f[n]&&y.push(n+"="+encodeURIComponent(f[n]))}),0===y.length?d:d+"?"+y.join("&");var f,h,p,d,y};var m=n(e("./parseSource")),v=n(e("./parseAssetId")),b=[["width","w"],["height","h"],["format","fm"],["download","dl"],["blur","blur"],["sharpen","sharp"],["invert","invert"],["orientation","or"],["minHeight","min-h"],["maxHeight","max-h"],["minWidth","min-w"],["maxWidth","max-w"],["quality","q"],["fit","fit"],["crop","crop"]];r.parseSource=m.default},{"./parseAssetId":13,"./parseSource":14}],16:[function(e,t,r){},{}],17:[function(e,t,r){var c,f,h;t.exports=(f=String.prototype.split,h=/()??/.exec("")[1]===c,function(e,t,r){if("[object RegExp]"!==Object.prototype.toString.call(t))return f.call(e,t,r);var n,i,o,s,a=[],l=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.extended?"x":"")+(t.sticky?"y":""),u=0;for(t=new RegExp(t.source,l+"g"),e+="",h||(n=new RegExp("^"+t.source+"$(?!\\s)",l)),r=r===c?-1>>>0:r>>>0;(i=t.exec(e))&&!((o=i.index+i[0].length)>u&&(a.push(e.slice(u,i.index)),!h&&1<i.length&&i[0].replace(n,function(){for(var e=1;e<arguments.length-2;e++)arguments[e]===c&&(i[e]=c)}),1<i.length&&i.index<e.length&&Array.prototype.push.apply(a,i.slice(1)),s=i[0].length,u=o,a.length>=r));)t.lastIndex===i.index&&t.lastIndex++;return u===e.length?!s&&t.test("")||a.push(""):a.push(e.slice(u)),a.length>r?a.slice(0,r):a})},{}],18:[function(e,t,r){function l(e){return!!e}var u=e("indexof");t.exports=function(n){function t(e){var t=o();-1<u(t,e)||(t.push(e),s(t))}function r(e){var t=o(),r=u(t,e);-1!==r&&(t.splice(r,1),s(t))}function i(e){return-1<u(o(),e)}function o(){return function(e,t){for(var r=[],n=0;n<e.length;n++)t(e[n])&&r.push(e[n]);return r}(n.className.split(" "),l)}function s(e){var t=e.length;n.className=e.join(" "),a.length=t;for(var r=0;r<e.length;r++)a[r]=e[r];delete e[t]}var e=n.classList;if(e)return e;var a={add:t,remove:r,contains:i,toggle:function(e){return i(e)?(r(e),!1):(t(e),!0)},toString:function(){return n.className},length:0,item:function(e){return o()[e]||null}};return a}},{indexof:20}],19:[function(e,t,r){function n(){function e(){function a(n){var t,e,r;if(null==n);else if("string"==typeof n)l?l.appendChild(t=d.createTextNode(n)):(r=h(n,/([\.#]?[^\s#.]+)/),/^\.|#/.test(r[1])&&(l=d.createElement("div")),f(r,function(e){var t=e.substring(1,e.length);e&&(l?"."===e[0]?p(l).add(t):"#"===e[0]&&l.setAttribute("id",t):l=d.createElement(e))}));else if("number"==typeof n||"boolean"==typeof n||n instanceof Date||n instanceof RegExp)l.appendChild(t=d.createTextNode(n.toString()));else if(e=n,"[object Array]"==Object.prototype.toString.call(e))f(n,a);else if(c(n))l.appendChild(t=n);else if(n instanceof y)l.appendChild(t=n);else if("object"==typeof n)for(var i in n)if("function"==typeof n[i])/^on\w+/.test(i)?function(e,t){l.addEventListener?(l.addEventListener(e.substring(2),t[e],!1),u.push(function(){l.removeEventListener(e.substring(2),t[e],!1)})):(l.attachEvent(e,t[e]),u.push(function(){l.detachEvent(e,t[e])}))}(i,n):(l[i]=n[i](),u.push(n[i](function(e){l[i]=e})));else if("style"===i)if("string"==typeof n[i])l.style.cssText=n[i];else for(var o in n[i])!function(t,e){if("function"==typeof e)l.style.setProperty(t,e()),u.push(e(function(e){l.style.setProperty(t,e)}));else var r=n[i][t].match(/(.*)\W+!important\W*$/);r?l.style.setProperty(t,r[1],"important"):l.style.setProperty(t,n[i][t])}(o,n[i][o]);else if("attrs"===i)for(var s in n[i])l.setAttribute(s,n[i][s]);else"data-"===i.substr(0,5)?l.setAttribute(i,n[i]):l[i]=n[i];else"function"==typeof n&&(s=n(),l.appendChild(t=c(s)?s:d.createTextNode(s)),u.push(n(function(e){c(e)&&t.parentElement?(t.parentElement.replaceChild(e,t),t=e):t.textContent=e})));return t}for(var e=[].slice.call(arguments),l=null;e.length;)a(e.shift());return l}var u=[];return e.cleanup=function(){for(var e=0;e<u.length;e++)u[e]();u.length=0},e}function c(e){return e&&e.nodeName&&e.nodeType}function f(e,t){if(e.forEach)return e.forEach(t);for(var r=0;r<e.length;r++)t(e[r],r)}var h=e("browser-split"),p=e("class-list"),i="undefined"==typeof window?e("html-element"):window,d=i.document,y=i.Text;(t.exports=n()).context=n},{"browser-split":17,"class-list":18,"html-element":16}],20:[function(e,t,r){var n=[].indexOf;t.exports=function(e,t){if(n)return e.indexOf(t);for(var r=0;r<e.length;++r)if(e[r]===t)return r;return-1}},{}],21:[function(e,t,r){"use strict";var l=Object.getOwnPropertySymbols,u=Object.prototype.hasOwnProperty,c=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(e){n[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var r,n,i=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),o=1;o<arguments.length;o++){for(var s in r=Object(arguments[o]))u.call(r,s)&&(i[s]=r[s]);if(l){n=l(r);for(var a=0;a<n.length;a++)c.call(r,n[a])&&(i[n[a]]=r[n[a]])}}return i}},{}]},{},[1])(1)}); |
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
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
216276
242
0