2 lines
10 KiB
JavaScript
2 lines
10 KiB
JavaScript
(self.webpackChunklite=self.webpackChunklite||[]).push([[8286],{638:(n,t,e)=>{"use strict";e.d(t,{u:()=>d});var r=e(63038),o=e.n(r),i=e(67294),c=e(12291),a=e(85740),u=e(24087),l=e(99264),s=e(51512),f=e(15412),p=e(92154),m=function(){return null},d=function(){var n=(0,c.v9)((function(n){return n.config.isAmp}));return(0,l.c)().isBot||n?null:i.createElement(a.bZ,{name:"dont_track_user",placeholder:m},(function(n){return n?null:i.createElement(i.Fragment,null,i.createElement("script",null,"window.PARSELY = window.PARSELY || {autotrack: false}"),i.createElement(u.Z,null,(function(n){return i.createElement(v,{viewer:n})})))}))},v=function(n){var t=n.viewer,e=(0,c.v9)((function(n){var t=n.navigation;return{currentLocation:t.currentLocation,referrer:t.referrer,referrerSource:t.referrerSource}}),c.wU),r=e.currentLocation,o=e.referrer,i=e.referrerSource,a=function(n){return n?n.mediumMemberAt?"member":"user":"visitor"}(t);return g(r,o,i,a),null},g=function(n,t,e,r){var c=(0,f.G)("//d1z2jf7jlzjs58.cloudfront.net/keys/medium.com/p.js",{id:"parsely-cf"}),a=o()(c,2),u=a[0],l=a[1],s=(0,p.l)();i.useEffect((function(){u&&!l&&s({resource:function(){return window.PARSELY.beacon},callback:function(){return window.PARSELY.beacon.trackPageView({url:h(n,e),urlref:t,js:1,data:{viewerStatus:r}})},max:10})}),[n,t,u,l])};function h(n,t){if(!n)return"";if(!t)return n;var e=new URL(n),r=(0,s.P7)(t),i=r.name,c=r.dimension;if(i&&e.searchParams.set("utm_medium",i),c){var a=c.split("."),u=o()(a,3),l=u[0],f=u[1],p=u[2];l&&e.searchParams.set("utm_source",l),f&&e.searchParams.set("utm_term",f),p&&e.searchParams.set("utm_content",p)}return e.toString()}},71794:(n,t,e)=>{"use strict";e.d(t,{j7:()=>f,OO:()=>p,iI:()=>m,m3:()=>d});var r=e(28655),o=e.n(r),i=e(71439),c=e(14391),a=e(22744),u=e(50993);function l(){var n=o()(["\n fragment shortformPostMetaDescription_post on Post {\n id\n metaDescription\n seoDescription\n shortformType\n title\n ...getPostContentAsString_post\n }\n ","\n"]);return l=function(){return n},n}function s(){var n=o()(["\n fragment postMetaDescription_post on Post {\n id\n title\n seoDescription\n metaDescription\n creator {\n id\n name\n }\n collection {\n id\n name\n }\n previewContent {\n subtitle\n }\n ...getPostContentAsString_post\n }\n ","\n"]);return s=function(){return n},n}var f=function(n){return function(n){var t=n.metaDescription,e=n.seoDescription,r=n.title||"";if(e)return e;if(t)return t;var o=function(n){var t=(0,a.r4)(n,250);return t&&(0,u.N8)(t,200)}(n);if(o.length>150)return o;var i=n.previewContent&&n.previewContent.subtitle||"";if(i.length>140)return i;i.length>0&&(i+=".");var c=(r.length?r+". ":"")+i;if(c.length>140)return c;var l="“".concat(r,"” is published");return n.creator&&n.creator.name&&(l+=" by ".concat(n.creator.name)),n.collection&&n.collection.name&&(l+=" in ".concat(n.collection.name)),"".concat(i," ").concat(l,".")}(n).trim()},p=function(n,t){var e=n.metaDescription,r=n.seoDescription,o=n.shortformType,i=o===c.po.SHORTFORM_TYPE_NOTE||!o;if(r)return r;if(e)return e;if(i&&t){var l=(0,a.r4)(n,350,0);return(0,u.N8)(l,300)}return""},m=(0,i.Ps)(s(),a.bh),d=(0,i.Ps)(l(),a.bh)},22744:(n,t,e)=>{"use strict";e.d(t,{r4:()=>M,bh:()=>C,yB:()=>E,dm:()=>j,lO:()=>x,Bg:()=>R,_t:()=>k,bq:()=>N,oS:()=>I,Pz:()=>Y,ao:()=>H,p3:()=>F});var r=e(59713),o=e.n(r),i=e(28655),c=e.n(i),a=e(71439),u=e(93022),l=e(4743),s=e(14391),f=e(398),p=e(50993);function m(){var n=c()(["\n fragment shouldIndex_post on Post {\n id\n firstPublishedAt\n isLimitedState\n isShortform\n shortformType\n visibility\n ...getPostContentAsString_post\n }\n ","\n"]);return m=function(){return n},n}function d(){var n=c()(["\n fragment shortformPostTitle_post on Post {\n id\n title\n seoTitle\n ...getPostContentAsString_post\n ...appendPostContext_post\n collection {\n ...maybeAppendProductName_collection\n }\n }\n ","\n ","\n ","\n"]);return d=function(){return n},n}function v(){var n=c()(["\n fragment getTitleForPost_post on Post {\n id\n title\n ...postTitle_post\n ...getTitleDetails_post\n }\n ","\n ","\n"]);return v=function(){return n},n}function g(n,t){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),e.push.apply(e,r)}return e}function h(n){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?g(Object(e),!0).forEach((function(t){o()(n,t,e[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):g(Object(e)).forEach((function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(e,t))}))}return n}function P(){var n=c()(["\n fragment postTitle_post on Post {\n id\n title\n seoTitle\n firstPublishedAt\n ...getPostContentAsString_post\n ...appendPostContext_post\n collection {\n id\n name\n domain\n ...maybeAppendProductName_collection\n }\n creator {\n name\n }\n previewContent {\n subtitle\n }\n }\n ","\n ","\n ","\n"]);return P=function(){return n},n}function b(){var n=c()(["\n fragment maybeAppendProductName_collection on Collection {\n id\n domain\n }\n"]);return b=function(){return n},n}function y(){var n=c()(["\n fragment getTitleDetails_post on Post {\n id\n content(postMeteringOptions: $postMeteringOptions) {\n bodyModel {\n ...GetTitleIndexMap_bodyModel\n }\n }\n ...getPostContentAsString_post\n }\n ","\n ","\n"]);return y=function(){return n},n}function O(){var n=c()(["\n fragment getPostContentAsString_post on Post {\n content(postMeteringOptions: $postMeteringOptions) {\n bodyModel {\n paragraphs {\n text\n type\n mixtapeMetadata {\n href\n }\n }\n }\n }\n }\n"]);return O=function(){return n},n}function _(n,t){var e;if("undefined"==typeof Symbol||null==n[Symbol.iterator]){if(Array.isArray(n)||(e=function(n,t){if(n){if("string"==typeof n)return w(n,t);var e=Object.prototype.toString.call(n).slice(8,-1);return"Object"===e&&n.constructor&&(e=n.constructor.name),"Map"===e||"Set"===e?Array.from(n):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?w(n,t):void 0}}(n))||t&&n&&"number"==typeof n.length){e&&(n=e);var r=0,o=function(){};return{s:o,n:function(){return r>=n.length?{done:!0}:{done:!1,value:n[r++]}},e:function(n){throw n},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,c=!0,a=!1;return{s:function(){e=n[Symbol.iterator]()},n:function(){var n=e.next();return c=n.done,n},e:function(n){a=!0,i=n},f:function(){try{c||null==e.return||e.return()}finally{if(a)throw i}}}}function w(n,t){(null==t||t>n.length)&&(t=n.length);for(var e=0,r=new Array(t);e<t;e++)r[e]=n[e];return r}function S(){var n=c()(["\n fragment appendPostContext_post on Post {\n id\n sequence {\n title\n }\n collection {\n name\n }\n creator {\n name\n }\n }\n"]);return S=function(){return n},n}function T(n,t){var e,r,o;return null!==(e=t.sequence)&&void 0!==e&&e.title?n+=" - ".concat(t.sequence.title):null!==(r=t.collection)&&void 0!==r&&r.name?n+=" - ".concat(t.collection.name):null!==(o=t.creator)&&void 0!==o&&o.name&&(n+=" - ".concat(t.creator.name)),n}var A=(0,a.Ps)(S());function M(n){var t,e,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:100,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{includeMixtapeHref:!1},a=c.includeMixtapeHref,u=(null===(t=n.content)||void 0===t||null===(e=t.bodyModel)||void 0===e?void 0:e.paragraphs)||[],l="",s=_(u);try{for(s.s();!(r=s.n()).done;){var f=r.value,p=f.mixtapeMetadata,m=f.text,d=f.type;if(a&&null!=p&&p.href?l+=l?" ".concat(p.href):p.href:"P"===d&&m&&m.length>i&&(l+=l?" ".concat(m):m),l.length>o)break}}catch(n){s.e(n)}finally{s.f()}return l}var C=(0,a.Ps)(O());function E(n){var t=!1,e="";if(n.content&&n.content.bodyModel&&n.content.bodyModel.paragraphs){var r=n.content.bodyModel.paragraphs,o=(0,l.LI)(r).titleIndex;"number"==typeof o&&(e=r[o].text||"",t=!0)}return{hasTitleGraf:t,latestTitle:e}}var j=(0,a.Ps)(y(),C,l.k);function D(n,t,e){return null!=e&&e.domain?n:"".concat(n," - ").concat(t)}var L=(0,a.Ps)(b());function x(n,t){var e,r,o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=n.seoTitle,c=n.title||"",a=(null===(e=n.previewContent)||void 0===e?void 0:e.subtitle)||"";if(i)return(0,f.p)(i,n.collection&&n.collection.name,t);if(!o)return c.length>50?c:c=D(c=T(c,n),t,n.collection);c.length<33&&a&&(a=(0,p.N8)(a,40),c+=". ".concat(a)),null!==(r=n.creator)&&void 0!==r&&r.name&&(c+=" | by ".concat(n.creator.name));var l="",s=Date.now()-5184e6;n.firstPublishedAt>=s&&(l=" | ".concat((0,u.Z)(n.firstPublishedAt,"LLL, yyyy")));var m=n.collection;return m?m.domain?c+="".concat(l," | ").concat(m.name):c+=" | ".concat(m.name).concat(l," | ").concat(t):c+="".concat(l," | ").concat(t),c}var R=(0,a.Ps)(P(),C,A,L);function k(n,t){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:E(n),r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=n.title||"",i=e.latestTitle||o,c=h(h({},n),{},{title:i});return x(c,t,r).trim()}var N=(0,a.Ps)(v(),R,j);function I(n,t,e){var r=n.seoTitle,o=n.title||"";return r?(0,f.p)(r,n.collection&&n.collection.name,t):o=D(o=T(o=function(n,t,e){var r=t.shortformType,o=r===s.po.SHORTFORM_TYPE_NOTE||!r;return e||(o?n=M(t,250,0):r===s.po.SHORTFORM_TYPE_LINK&&(n=M(t,250,0,{includeMixtapeHref:!0}))),(0,p.N8)(n,200)}(o,n,e),n),t,n.collection)}var Y=(0,a.Ps)(d(),C,A,L);function H(n){var t=n.firstPublishedAt,e=n.isLimitedState,r=n.isShortform,o=n.shortformType,i=n.visibility,c=o===s.po.SHORTFORM_TYPE_NOTE||!o;return!(!t||"PUBLIC"!==i&&"LOCKED"!==i||e||r&&!(c?M(n,10,0).length>10:M(n,10,0).length>0))}var F=(0,a.Ps)(m(),C)},398:(n,t,e)=>{"use strict";e.d(t,{N:()=>r,p:()=>o});var r=function(n){return n||"Untitled story"},o=function(n,t,e){return t?"".concat(n," | ").concat(t):e?"".concat(n," | ").concat(e):n}}}]);
|
|
//# sourceMappingURL=https://stats.medium.build/lite/sourcemaps/8286.962b84f6.chunk.js.map
|