1(function(e){typeof define==`function`&&define.amd?define([],e):e()})(function(){var KEYS=[`if`,`if_any`,`show_when`,`show_when_any`,`unless`,`unless_any`,`hide_when`,`hide_when_any`],OPERATORS=[`equals`,`not`,`contains`,`contains_any`,`===`,`!==`,`>`,`>=`,`<`,`<=`,`custom`],ALIASES={is:`equals`,"==":`equals`,isnt:`not`,"!=":`not`,includes:`contains`,includes_any:`contains_any`},Converter_default=class{fromBlueprint(e,t=null){return Object.entries(e).flatMap(([e,n])=>this.wrap(n).map(n=>this.splitRhs(e,n,t)))}toBlueprint(e){let t={};return e.forEach(e=>{let n=e.field,r=this.combineRhs(e);n in t?t[n]=this.wrap(t[n]).concat(r):t[n]=r}),t}wrap(e){return Array.isArray(e)?e:[e]}splitRhs(e,t,n=null){return{field:this.getScopedFieldHandle(e,n),operator:this.getOperatorFromRhs(t),value:this.getValueFromRhs(t)}}getScopedFieldHandle(e,t){return e.startsWith(`$root.`)||e.startsWith(`root.`)||e.startsWith(`$parent.`)?e:t?t+e:e}getOperatorFromRhs(e){let t=`==`;return this.getOperatorsAndAliases().filter(t=>RegExp(`^${t} [^=]`).test(this.normalizeConditionString(e))).forEach(e=>t=e),this.normalizeOperator(t)}normalizeOperator(e){return ALIASES[e]?ALIASES[e]:e}getValueFromRhs(e){let t=this.normalizeConditionString(e);return this.getOperatorsAndAliases().filter(e=>RegExp(`^${e} [^=]`).test(t)).forEach(e=>t=t.replace(RegExp(`^${e}[ ]*`),``)),t}combineRhs(e){return`${e.operator?e.operator.trim():``} ${e.value.trim()}`.trim()}getOperatorsAndAliases(){return OPERATORS.concat(Object.keys(ALIASES))}normalizeConditionString(e){return e===null?`null`:e===``?`empty`:e.toString()}},ParentResolver_default=class{constructor(e){this.currentFieldPath=e}resolve(e){let t=this.getParentFieldPath(this.currentFieldPath,!0),n=this.removeOneParentKeyword(e);for(;n.startsWith(`$parent.`);)t=this.getParentFieldPath(t),n=this.removeOneParentKeyword(n);return`$root.${t?`${t}.${n}`:n}`}getParentFieldPath(e,t){let n=RegExp(`(.*?[^\\.]+)(\\.[0-9]+)*\\.[^\\.]*$`);return(t||this.isAtSetLevel(e))&&(e=e.replace(n,`$1`)),e.includes(`.`)?e.replace(n,`$1$2`):``}isAtSetLevel(e){return e.match(RegExp(`(\\.[0-9]+)$`))}removeOneParentKeyword(e){return e.replace(RegExp(`^\\$parent.`),``)}};function data_get(e,t,n=null){var r=(Array.isArray(t)?t:t.split(`.`)).reduce((e,t)=>e&&e[t],e);return r===void 0?n:r}var freeGlobal=typeof global==`object`&&global&&global.Object===Object&&global,freeSelf=typeof self==`object`&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function(`return this`)(),Symbol=root.Symbol,objectProto$1=Object.prototype,hasOwnProperty$3=objectProto$1.hasOwnProperty,nativeObjectToString$1=objectProto$1.toString,symToStringTag$1=Symbol?Symbol.toStringTag:void 0;function getRawTag(e){var t=hasOwnProperty$3.call(e,symToStringTag$1),n=e[symToStringTag$1];try{e[symToStringTag$1]=void 0;var r=!0}catch{}var i=nativeObjectToString$1.call(e);return r&&(t?e[symToStringTag$1]=n:delete e[symToStringTag$1]),i}var nativeObjectToString=Object.prototype.toString;function objectToString(e){return nativeObjectToString.call(e)}var nullTag=`[object Null]`,undefinedTag=`[object Undefined]`,symToStringTag=Symbol?Symbol.toStringTag:void 0;function baseGetTag(e){return e==null?e===void 0?undefinedTag:nullTag:symToStringTag&&symToStringTag in Object(e)?getRawTag(e):objectToString(e)}function isObjectLike(e){return typeof e==`object`&&!!e}function arrayMap(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}function isObject(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}function identity(e){return e}var asyncTag=`[object AsyncFunction]`,funcTag=`[object Function]`,genTag=`[object GeneratorFunction]`,proxyTag=`[object Proxy]`;function isFunction(e){if(!isObject(e))return!1;var t=baseGetTag(e);return t==funcTag||t==genTag||t==asyncTag||t==proxyTag}var coreJsData=root[`__core-js_shared__`],maskSrcKey=function(){var e=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function isMasked(e){return!!maskSrcKey&&maskSrcKey in e}var funcToString$1=Function.prototype.toString;function toSource(e){if(e!=null){try{return funcToString$1.call(e)}catch{}try{return e+``}catch{}}return``}var reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto=Function.prototype,objectProto=Object.prototype,funcToString=funcProto.toString,hasOwnProperty$2=objectProto.hasOwnProperty,reIsNative=RegExp(`^`+funcToString.call(hasOwnProperty$2).replace(reRegExpChar,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function baseIsNative(e){return!isObject(e)||isMasked(e)?!1:(isFunction(e)?reIsNative:reIsHostCtor).test(toSource(e))}function getValue(e,t){return e?.[t]}function getNative(e,t){var n=getValue(e,t);return baseIsNative(n)?n:void 0}function apply(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var HOT_COUNT=800,HOT_SPAN=16,nativeNow=Date.now;function shortOut(e){var t=0,n=0;return function(){var r=nativeNow(),i=HOT_SPAN-(r-n);if(n=r,i>0){if(++t>=HOT_COUNT)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function constant(e){return function(){return e}}var defineProperty=function(){try{var e=getNative(Object,`defineProperty`);return e({},``,{}),e}catch{}}(),baseSetToString=defineProperty?function(e,t){return defineProperty(e,`toString`,{configurable:!0,enumerable:!1,value:constant(t),writable:!0})}:identity,setToString=shortOut(baseSetToString);function baseFindIndex(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}function baseIsNaN(e){return e!==e}function strictIndexOf(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}function baseIndexOf(e,t,n){return t===t?strictIndexOf(e,t,n):baseFindIndex(e,baseIsNaN,n)}function arrayIncludes(e,t){return!!(e!=null&&e.length)&&baseIndexOf(e,t,0)>-1}function eq(e,t){return e===t||e!==e&&t!==t}var nativeMax=Math.max;function overRest(e,t,n){return t=nativeMax(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,a=nativeMax(r.length-t,0),o=Array(a);++i<a;)o[i]=r[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=r[i];return s[t]=n(o),apply(e,this,s)}}function baseRest(e,t){return setToString(overRest(e,t,identity),e+``)}var MAX_SAFE_INTEGER=9007199254740991;function isLength(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=MAX_SAFE_INTEGER}function isArrayLike(e){return e!=null&&isLength(e.length)&&!isFunction(e)}function baseUnary(e){return function(t){return e(t)}}var nativeCreate=getNative(Object,`create`);function hashClear(){this.__data__=nativeCreate?nativeCreate(null):{},this.size=0}function hashDelete(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}var HASH_UNDEFINED$2=`__lodash_hash_undefined__`,hasOwnProperty$1=Object.prototype.hasOwnProperty;function hashGet(e){var t=this.__data__;if(nativeCreate){var n=t[e];return n===HASH_UNDEFINED$2?void 0:n}return hasOwnProperty$1.call(t,e)?t[e]:void 0}var hasOwnProperty=Object.prototype.hasOwnProperty;function hashHas(e){var t=this.__data__;return nativeCreate?t[e]!==void 0:hasOwnProperty.call(t,e)}var HASH_UNDEFINED$1=`__lodash_hash_undefined__`;function hashSet(e,t){var n=this.__data__;return this.size+=+!this.has(e),n[e]=nativeCreate&&t===void 0?HASH_UNDEFINED$1:t,this}function Hash(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Hash.prototype.clear=hashClear,Hash.prototype.delete=hashDelete,Hash.prototype.get=hashGet,Hash.prototype.has=hashHas,Hash.prototype.set=hashSet;function listCacheClear(){this.__data__=[],this.size=0}function assocIndexOf(e,t){for(var n=e.length;n--;
vendor: 2,826 bytes, line 1
1)if(eq(e[n][0],t))return n;return-1}var splice=Array.prototype.splice;function listCacheDelete(e){var t=this.__data__,n=assocIndexOf(t,e);return n<0?!1:(n==t.length-1?t.pop():splice.call(t,n,1),--this.size,!0)}function listCacheGet(e){var t=this.__data__,n=assocIndexOf(t,e);return n<0?void 0:t[n][1]}function listCacheHas(e){return assocIndexOf(this.__data__,e)>-1}function listCacheSet(e,t){var n=this.__data__,r=assocIndexOf(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function ListCache(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}ListCache.prototype.clear=listCacheClear,ListCache.prototype.delete=listCacheDelete,ListCache.prototype.get=listCacheGet,ListCache.prototype.has=listCacheHas,ListCache.prototype.set=listCacheSet;var Map=getNative(root,`Map`);function mapCacheClear(){this.size=0,this.__data__={hash:new Hash,map:new(Map||ListCache),string:new Hash}}function isKeyable(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function getMapData(e,t){var n=e.__data__;return isKeyable(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function mapCacheDelete(e){var t=getMapData(this,e).delete(e);return this.size-=+!!t,t}function mapCacheGet(e){return getMapData(this,e).get(e)}function mapCacheHas(e){return getMapData(this,e).has(e)}function mapCacheSet(e,t){var n=getMapData(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function MapCache(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}MapCache.prototype.clear=mapCacheClear,MapCache.prototype.delete=mapCacheDelete,MapCache.prototype.get=mapCacheGet,MapCache.prototype.has=mapCacheHas,MapCache.prototype.set=mapCacheSet;var HASH_UNDEFINED=`__lodash_hash_undefined__`;function setCacheAdd(e){return this.__data__.set(e,HASH_UNDEFINED),this}function setCacheHas(e){return this.__data__.has(e)}function SetCache(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new MapCache;++t<n;)this.add(e[t])}SetCache.prototype.add=SetCache.prototype.push=setCacheAdd,SetCache.prototype.has=setCacheHas;function cacheHas(e,t){return e.has(t)}function isArrayLikeObject(e){return isObjectLike(e)&&isArrayLike(e)}function arrayIncludesWith(e,t,n){for(var r=-1,i=e==null?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}var nativeMin=Math.min;function baseIntersection(e,t,n){for(var r=n?arrayIncludesWith:arrayIncludes,i=e[0].length,a=e.length,o=a,s=Array(a),c=1/0,l=[];o--;){var u=e[o];o&&t&&(u=arrayMap(u,baseUnary(t))),c=nativeMin(u.length,c),s[o]=!n&&(t||i>=120&&u.length>=120)?new SetCache(o&&u):void 0}u=e[0];var d=-1,f=s[0];outer:for(;++d<i&&l.length<c;){var p=u[d],m=t?t(p):p;if(p=n||p!==0?p:0,!(f?cacheHas(f,m):r(l,m,n))){for(o=a;--o;){var h=s[o];if(!(h?cacheHas(h,m):r(e[o],m,n)))continue outer}
1f&&f.push(m),l.push(p)}}return l}function castArrayLikeObject(e){return isArrayLikeObject(e)?e:[]}var intersection=baseRest(function(e){var t=arrayMap(e,castArrayLikeObject);return t.length&&t[0]===e[0]?baseIntersection(t):[]}),NUMBER_SPECIFIC_COMPARISONS=[`>`,`>=`,`<`,`<=`],CUSTOM_PREFIX_RE=/^custom /,ROOT_PREFIX_RE=/^\$?root\./,isEmpty=e=>e==null?!0:typeof e==`number`?!1:Array.isArray(e)?e.length===0:Object.keys(e).length===0,isString=e=>e!=null&&typeof e.valueOf()==`string`,Validator_default=class{constructor(e,t,n,r,i,a){this.field=e,this.values=t,this.currentFieldPath=r,this.revealerFields=i,this.extraPayload=a,this.rootValues=n||!1,this.passOnAny=!1,this.showOnPass=!0,this.converter=new Converter_default,this._conditionsResolved=!1}usingRootValues(){if(!this.currentFieldPath)throw Error("[currentFieldPath] constructor param required for `usingRootValues()`");return this.rootValues=this.values,this.currentFieldPath.includes(`.`)?this.scopeValuesToParent():this}passesConditions(e){let t=e||this.getConditions();if(t===void 0)return!0;if(this.isCustomConditionWithoutTarget(t))return this.passesCustomCondition(this.prepareCondition(t));let n=this.passOnAny?this.passesAnyConditions(t):this.passesAllConditions(t);return this.showOnPass?n:!n}getConditions(){if(this._conditionsResolved)return this._setPassOnAny&&(this.passOnAny=!0),this._setShowOffPass&&(this.showOnPass=!1),this._conditions;this._conditionsResolved=!0,this._setPassOnAny=!1,this._setShowOffPass=!1,this._conditions=void 0;let e=KEYS.filter(e=>this.field[e])[0];if(!e)return;e.includes(`any`)&&(this.passOnAny=this._setPassOnAny=!0),(e.includes(`unless`)||e.includes(`hide_when`))&&(this.showOnPass=!1,this._setShowOffPass=!0);let t=this.field[e];return this._conditions=this.isCustomConditionWithoutTarget(t)?t:this.converter.fromBlueprint(t,this.field.prefix),this._conditions}isCustomConditionWithoutTarget(e){return isString(e)}passesAllConditions(e){return isEmpty(e.map(e=>this.prepareCondition(e)).filter(e=>!this.passesCondition(e)))}passesAnyConditions(e){return!isEmpty(e.map(e=>this.prepareCondition(e)).filter(e=>this.passesCondition(e)))}prepareCondition(e){if(isString(e)||e.operator===`custom`)return this.prepareCustomCondition(e);let t=this.prepareOperator(e.operator);return{lhs:this.prepareLhs(e.field,t),operator:t,rhs:this.prepareRhs(e.value,t)}}prepareOperator(e){switch(e){case null:case``:case`is`:case`equals`:return`==`;case`isnt`:case`not`:case`¯\\_(ã)_/¯`:return`!=`;case`includes`:case`contains`:return`includes`;case`includes_any`:case`contains_any`:return`includes_any`}return e}prepareLhs(e,t){let n=this.getFieldValue(e);return NUMBER_SPECIFIC_COMPARISONS.includes(t)?Number(n):t===`includes`&&!isObject(n)?n?n.toString():``:(isString(n)&&isEmpty(n)&&(n=null),isString(n)?JSON.stringify(n.trim()):n)}prepareRhs(e,t){switch(e){case`null`:return null;case`true`:return!0;case`false`:return!1}return NUMBER_SPECIFIC_COMPARISONS.includes(t)?Number(e):e===`empty`||t===`includes`||t===`includes_any`?e:isString(e)?JSON.stringify(e.trim()):e}prepareCustomCondition(e){return{functionName:this.prepareFunctionName(e.value||e),params:this.prepareParams(e.value||e),target:e.field?this.getFieldValue(e.field):null,targetHandle:e.field}}prepareFunctionName(e){return e.replace(CUSTOM_PREFIX_RE,``).split(`:`)[0]}prepareParams(e){let t=e.split(`:`)[1];return t?t.split(`,`).map(e=>e.trim()):[]}getFieldValue(e){return e.startsWith(`$parent.`)&&(e=new ParentResolver_default(this.currentFieldPath).resolve(e)),e.startsWith(`$root.`)||e.startsWith(`root.`)?data_get(this.rootValues,e.replace(ROOT_PREFIX_RE,``)):data_get(this.values,e)}passesCondition(condition){return condition.functionName?this.passesCustomCondition(condition):condition.operator===`includes`?this.passesIncludesCondition(condition):condition.operator===`includes_any`?this.passesIncludesAnyCondition(condition):(condition.rhs===`empty`&&(condition.lhs=isEmpty(condition.lhs),condition.rhs=!0),isObject(condition.lhs)?!1:eval(`${condition.lhs} ${condition.operator} ${condition.rhs}`))}passesIncludesCondition(e){return e.lhs.includes(e.rhs)}passesIncludesAnyCondition(e){let t=e.rhs.split(`,`).map(e=>e.trim());return Array.isArray(e.lhs)?intersection(e.lhs,t).length:new RegExp(t.join(`|`)).test(e.lhs)}passesCustomCondition(e){let t=Statamic.$conditions.get(e.functionName);if(typeof t!=`function`)return console.error(`Statamic field condition [${e.functionName}] was not properly defined.`),!1;let n=t({params:e.params,target:e.target,targetHandle:e.targetHandle,values:this.values,root:this.root
1Values,fieldPath:this.currentFieldPath,prefix:this.field.prefix,...this.extraPayload});return this.showOnPass?n:!n}passesNonRevealerConditions(e){let t=this.getConditions();if(this.isCustomConditionWithoutTarget(t))return this.passesConditions(t);let n=this.revealerFields||[],r=(this.getConditions()??[]).filter(t=>!n.includes(this.relativeLhsToAbsoluteFieldPath(t.field,e)));return this.passesConditions(r)}relativeLhsToAbsoluteFieldPath(e,t){return e.startsWith(`$parent.`)&&(e=new ParentResolver_default(this.currentFieldPath).resolve(e)),e.startsWith(`$root.`)||e.startsWith(`root.`)?e.replace(ROOT_PREFIX_RE,``):t?t+`.`+e:e}scopeValuesToParent(){let e=this.currentFieldPath.replace(RegExp(`.[^.]+$`),``);return this.values=data_get(this.rootValues,e),this}},FieldConditions_default=class{showField(e,t,n){return new Validator_default(e,t,null,n).usingRootValues().passesConditions()}};function bufferToBase64URLString(e){let t=new Uint8Array(e),n=``;for(let e of t)n+=String.fromCharCode(e);return btoa(n).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}function base64URLStringToBuffer(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=(4-t.length%4)%4,r=t.padEnd(t.length+n,`=`),i=atob(r),a=new ArrayBuffer(i.length),o=new Uint8Array(a);for(let e=0;e<i.length;e++)o[e]=i.charCodeAt(e);return a}function browserSupportsWebAuthn(){return _browserSupportsWebAuthnInternals.stubThis(globalThis?.PublicKeyCredential!==void 0&&typeof globalThis.PublicKeyCredential==`function`)}var _browserSupportsWebAuthnInternals={stubThis:e=>e};function toPublicKeyCredentialDescriptor(e){let{id:t}=e;return{...e,id:base64URLStringToBuffer(t),transports:e.transports}}function isValidDomain(e){return e===`localhost`||/^((xn--[a-z0-9-]+|[a-z0-9]+(-[a-z0-9]+)*)\.)+([a-z]{2,}|xn--[a-z0-9-]+)$/i.test(e)}var WebAuthnError=class extends Error{constructor({message:e,code:t,cause:n,name:r}){super(e,{cause:n}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=r??n.name,this.code=t}};function identifyRegistrationError({error:e,options:t}){let{publicKey:n}=t;if(!n)throw Error(`options was missing required publicKey property`);if(e.name===`AbortError`){if(t.signal instanceof AbortSignal)return new WebAuthnError({message:`Registration ceremony was sent an abort signal`,code:`ERROR_CEREMONY_ABORTED`,cause:e})}else if(e.name===`ConstraintError`){if(n.authenticatorSelection?.requireResidentKey===!0)return new WebAuthnError({message:`Discoverable credentials were required but no available authenticator supported it`,code:`ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT`,cause:e});if(t.mediation===`conditional`&&n.authenticatorSelection?.userVerification===`required`)return new WebAuthnError({message:`User verification was required during automatic registration but it could not be performed`,code:`ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE`,cause:e});if(n.authenticatorSelection?.userVerification===`required`)return new WebAuthnError({message:`User verification was required but no available authenticator supported it`,code:`ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT`,cause:e})}else if(e.name===`InvalidStateError`)return new WebAuthnError({message:`The authenticator was previously registered`,code:`ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED`,cause:e});else if(e.name===`NotAllowedError`)return new WebAuthnError({message:e.message,code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:e});else if(e.name===`NotSupportedError`)return n.pubKeyCredParams.filter(e=>e.type===`public-key`).length===0?new WebAuthnError({message:`No entry in pubKeyCredParams was of type "public-key"`,code:`ERROR_MALFORMED_PUBKEYCREDPARAMS`,cause:e}):new WebAuthnError({message:`No available authenticator supported any of the specified pubKeyCredParams algorithms`,code:`ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG`,cause:e});else if(e.name===`SecurityError`){let t=globalThis.location.hostname;if(!isValidDomain(t))return new WebAuthnError({message:`${globalThis.location.hostname} is an invalid domain`,code:`ERROR_INVALID_DOMAIN`,cause:e});if(n.rp.id!==t)return new WebAuthnError({message:`The RP ID "${n.rp.id}
1" is invalid for this domain`,code:`ERROR_INVALID_RP_ID`,cause:e})}else if(e.name===`TypeError`){if(n.user.id.byteLength<1||n.user.id.byteLength>64)return new WebAuthnError({message:`User ID was not between 1 and 64 characters`,code:`ERROR_INVALID_USER_ID_LENGTH`,cause:e})}else if(e.name===`UnknownError`)return new WebAuthnError({message:`The authenticator was unable to process the specified options, or could not create a new credential`,code:`ERROR_AUTHENTICATOR_GENERAL_ERROR`,cause:e});return e}var BaseWebAuthnAbortService=class{constructor(){Object.defineProperty(this,"controller",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}createNewAbortSignal(){if(this.controller){let e=Error(`Cancelling existing WebAuthn API call for new one`);e.name=`AbortError`,this.controller.abort(e)}let e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){let e=Error(`Manually cancelling existing WebAuthn API call`);e.name=`AbortError`,this.controller.abort(e),this.controller=void 0}}},WebAuthnAbortService=new BaseWebAuthnAbortService,attachments=[`cross-platform`,`platform`];function toAuthenticatorAttachment(e){if(e&&!(attachments.indexOf(e)<0))return e}async function startRegistration(e){!e.optionsJSON&&e.challenge&&(console.warn(`startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.`),e={optionsJSON:e});let{optionsJSON:t,useAutoRegister:n=!1}=e;if(!browserSupportsWebAuthn())throw Error(`WebAuthn is not supported in this browser`);let r={...t,challenge:base64URLStringToBuffer(t.challenge),user:{...t.user,id:base64URLStringToBuffer(t.user.id)},excludeCredentials:t.excludeCredentials?.map(toPublicKeyCredentialDescriptor)},i={};n&&(i.mediation=`conditional`),i.publicKey=r,i.signal=WebAuthnAbortService.createNewAbortSignal();let a;try{a=await navigator.credentials.create(i)}catch(e){throw identifyRegistrationError({error:e,options:i})}if(!a)throw Error(`Registration was not completed`);let{id:o,rawId:s,response:c,type:l}=a,u;typeof c.getTransports==`function`&&(u=c.getTransports());let d;if(typeof c.getPublicKeyAlgorithm==`function`)try{d=c.getPublicKeyAlgorithm()}catch(e){warnOnBrokenImplementation(`getPublicKeyAlgorithm()`,e)}let f;if(typeof c.getPublicKey==`function`)try{let e=c.getPublicKey();e!==null&&(f=bufferToBase64URLString(e))}catch(e){warnOnBrokenImplementation(`getPublicKey()`,e)}let p;if(typeof c.getAuthenticatorData==`function`)try{p=bufferToBase64URLString(c.getAuthenticatorData())}catch(e){warnOnBrokenImplementation(`getAuthenticatorData()`,e)}return{id:o,rawId:bufferToBase64URLString(s),response:{attestationObject:bufferToBase64URLString(c.attestationObject),clientDataJSON:bufferToBase64URLString(c.clientDataJSON),transports:u,publicKeyAlgorithm:d,publicKey:f,authenticatorData:p},type:l,clientExtensionResults:a.getClientExtensionResults(),authenticatorAttachment:toAuthenticatorAttachment(a.authenticatorAttachment)}}function warnOnBrokenImplementation(e,t){console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.\n`,t)}function browserSupportsWebAuthnAutofill(){if(!browserSupportsWebAuthn())return _browserSupportsWebAuthnAutofillInternals.stubThis(new Promise(e=>e(!1)));let e=globalThis.PublicKeyCredential;return e?.isConditionalMediationAvailable===void 0?_browserSupportsWebAuthnAutofillInternals.stubThis(new Promise(e=>e(!1))):_browserSupportsWebAuthnAutofillInternals.stubThis(e.isConditionalMediationAvailable())}var _browserSupportsWebAuthnAutofillInternals={stubThis:e=>e};function identifyAuthenticationError({error:e,options:t}){let{publicKey:n}=t;if(!n)throw Error(`options was missing required publicKey property`);if(e.name===`AbortError`){if(t.signal instanceof AbortSignal)return new WebAuthnError({message:`Authentication ceremony was sent an abort signal`,code:`ERROR_CEREMONY_ABORTED`,cause:e})}else if(e.name===`NotAllowedError`)return new WebAuthnError({message:e.message,code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:e});else if(e.name===`SecurityError`){let t=globalThis.location.hostname;if(!isValidDomain(t))return new WebAuthnError({message:`${globalThis.location.hostname}
1 is an invalid domain`,code:`ERROR_INVALID_DOMAIN`,cause:e});if(n.rpId!==t)return new WebAuthnError({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:`ERROR_INVALID_RP_ID`,cause:e})}else if(e.name===`UnknownError`)return new WebAuthnError({message:`The authenticator was unable to process the specified options, or could not create a new assertion signature`,code:`ERROR_AUTHENTICATOR_GENERAL_ERROR`,cause:e});return e}async function startAuthentication(e){!e.optionsJSON&&e.challenge&&(console.warn(`startAuthentication() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.`),e={optionsJSON:e});let{optionsJSON:t,useBrowserAutofill:n=!1,verifyBrowserAutofillInput:r=!0}=e;if(!browserSupportsWebAuthn())throw Error(`WebAuthn is not supported in this browser`);let i;t.allowCredentials?.length!==0&&(i=t.allowCredentials?.map(toPublicKeyCredentialDescriptor));let a={...t,challenge:base64URLStringToBuffer(t.challenge),allowCredentials:i},o={};if(n){if(!await browserSupportsWebAuthnAutofill())throw Error(`Browser does not support WebAuthn autofill`);if(document.querySelectorAll(`input[autocomplete$='webauthn']`).length<1&&r)throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');o.mediation=`conditional`,a.allowCredentials=[]}o.publicKey=a,o.signal=WebAuthnAbortService.createNewAbortSignal();let s;try{s=await navigator.credentials.get(o)}catch(e){throw identifyAuthenticationError({error:e,options:o})}if(!s)throw Error(`Authentication was not completed`);let{id:c,rawId:l,response:u,type:d}=s,f;return u.userHandle&&(f=bufferToBase64URLString(u.userHandle)),{id:c,rawId:bufferToBase64URLString(l),response:{authenticatorData:bufferToBase64URLString(u.authenticatorData),clientDataJSON:bufferToBase64URLString(u.clientDataJSON),signature:bufferToBase64URLString(u.signature),userHandle:f},type:d,clientExtensionResults:s.getClientExtensionResults(),authenticatorAttachment:toAuthenticatorAttachment(s.authenticatorAttachment)}}var Passkeys=class{constructor(){this.supported=browserSupportsWebAuthn(),this._waiting=!1,this._error=null,this._defaults={}}configure(e){return this._defaults=e,this}get waiting(){return this._waiting}get error(){return this._error}async authenticate(e={}){let{optionsUrl:t,verifyUrl:n,onSuccess:r,onError:i,useBrowserAutofill:a=!1,csrfToken:o}={...this._defaults,...e};a||(this._waiting=!0),this._error=null;try{let e=await fetch(t,{credentials:`same-origin`});if(!e.ok)throw Error(`Failed to fetch authentication options`);let s=await e.json(),c;try{c=await startAuthentication({optionsJSON:s,useBrowserAutofill:a})}catch(e){if(e.name===`AbortError`||e.name===`NotAllowedError`)return;console.error(e),this._error=`Authentication failed.`,i&&i({message:this._error,originalError:e});return}let l=await fetch(n,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,"X-CSRF-TOKEN":o||this._getCsrfToken()},credentials:`same-origin`,body:JSON.stringify(c)}),u=await l.json();if(!l.ok){this._error=u.message||`Verification failed.`,i&&i({message:this._error,status:l.status});return}r&&r(u)}catch(e){this._handleError(e,i)}finally{a||(this._waiting=!1)}}async register(e={}){let{optionsUrl:t,verifyUrl:n,name:r=`Passkey`,onSuccess:i,onError:a,csrfToken:o}={...this._defaults,...e};this._waiting=!0,this._error=null;try{let e=await fetch(t,{credentials:`same-origin`});if(!e.ok)throw Error(`Failed to fetch registration options`);let s=await e.json(),c;try{c=await startRegistration({optionsJSON:s})}catch(e){if(e.name===`AbortError`||e.name===`NotAllowedError`)return;console.error(e),this._error=`Registration failed.`,a&&a({message:this._error,originalError:e});return}let l=await fetch(n,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,"X-CSRF-TOKEN":o||this._getCsrfToken()},credentials:`same-origin`,body:JSON.stringify({...c,name:r})}),u=await l.json();if(!l.ok){this._error=u.message||`Verification failed.`,a&&a({message:this._error,status:l.status});return}i&&i(u)}catch(e){this._handleError(e,a)}finally{this._waiting=!1}}cancel(){WebAuthnAbortService.cancelCeremony()}initAutofill(e={}){this.supported&&this.authenticate({...e,useBrowserAutofill:!0})}_getCsrfToken(){let e=document.querySelector(`meta[name="csrf-token"]`);if(e)return e.getAttribute(`content`);let t=document.querySelector(`input[name="_token"]`);return t?t.value:``}_handleError(e,t){this._error=e.message||`Something went wrong`,t&&t({message:this._error,originalError:e})}},Statamic$1=class{constructor(){this.$conditions=new FieldConditions_default,this.$passkeys=new Passkeys}};window.Statamic=new Statamic$1});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.