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,EAAIuC,EAAYS,GAAIlJ,KAC1B,GACCkG,EAAG1C,EAAWf,SACdyD,EAAElF,MAAO,EAAGwC,EAAWf,UAAae,EAEpC,GAAK0C,IAAM5C,EACV0F,GAAS,OACH,GAAK9C,IAAM3C,EACjB0F,GAAS,MACH,CACNF,GAAgB,EAChB,IAAII,EAAMV,EAAYS,GAAIjI,MAC1B,IACCkI,EAAMnK,KAAKC,MAAOkK,EAClB,CAAC,MAAQ/J,GAAM,CAChB,MAAO,CAAGgK,EAAQC,GAAW5F,EAAgB6F,KAAMpD,GACnD7F,EAAY+I,GAAW/I,EAAY+I,IAAY,CAAC,EAChD/I,EAAY+I,GAAUC,GAAU,WAAcF,CAC9C,MACK,GAAW,QAANjD,EACX,SAEDzJ,EAAOyJ,GAAMuC,EAAYS,GAAIjI,KAC7B,CAED,GAAK+H,IAAYC,EAChB,MAAO,EACNvI,EAAAA,EAAAA,GAAG6G,EAAKgC,UAAW,IACf9M,EACHuK,UAAWO,EAAKP,UAChB/D,aAAc,CAAE+F,QAAQ,MAGtBC,GAAStF,EAAgB+C,IAAKa,GAE9BwB,IAAgBtM,EAAMwG,aAAe5C,GAE1C,IAAI3C,EAAQ4K,EAAWJ,aACvB,GAAKxK,EAAQ,CACZ,KAAQA,GAAQ,CACf,MAAQsF,EAAOwG,GAAchB,EAAM9K,GAC9BsF,GAAQnG,EAASc,KAAMqF,GAC5BtF,EAAQ8L,GAAalB,EAAWR,aAChC,CACDQ,EAAW/K,YACX,CAED,MAAO,EAAEmD,EAAAA,EAAAA,GAAG6G,EAAKgC,UAAW9M,EAAOI,GACnC,CAEM2L,CAAMF,EAAWmB,YACxB,CE7FgBC,CAAQnC,IACrBoC,EAAAA,EAAAA,IAASvB,EAAMX,EACf,IAPH,EDCM9B,GAENtG,QAAQC,IAAK,4BAAb,G","sources":["webpack://wp/./packages/block-library/src/utils/interactivity/portals.js","webpack://wp/./packages/block-library/src/utils/interactivity/utils.js","webpack://wp/./packages/block-library/src/utils/interactivity/store.js","webpack://wp/./packages/block-library/src/utils/interactivity/hooks.js","webpack://wp/./packages/block-library/src/utils/interactivity/directives.js","webpack://wp/./packages/block-library/src/utils/interactivity/constants.js","webpack://wp/./packages/block-library/src/utils/interactivity/vdom.js","webpack://wp/./packages/block-library/src/utils/interactivity/index.js","webpack://wp/./packages/block-library/src/utils/interactivity/hydration.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { createElement, render } from 'preact';\n\n/**\n * @param {import('../../src/index').RenderableProps<{ context: any }>} props\n */\nfunction ContextProvider( props ) {\n\tthis.getChildContext = () => props.context;\n\treturn props.children;\n}\n\n/**\n * Portal component\n *\n * @this {import('./internal').Component}\n * @param {object | null | undefined} props\n *\n * TODO: use createRoot() instead of fake root\n */\nfunction Portal( props ) {\n\tconst _this = this;\n\tconst container = props._container;\n\n\t_this.componentWillUnmount = function () {\n\t\trender( null, _this._temp );\n\t\t_this._temp = null;\n\t\t_this._container = null;\n\t};\n\n\t// When we change container we should clear our old container and\n\t// indicate a new mount.\n\tif ( _this._container && _this._container !== container ) {\n\t\t_this.componentWillUnmount();\n\t}\n\n\t// When props.vnode is undefined/false/null we are dealing with some kind of\n\t// conditional vnode. This should not trigger a render.\n\tif ( props._vnode ) {\n\t\tif ( ! _this._temp ) {\n\t\t\t_this._container = container;\n\n\t\t\t// Create a fake DOM parent node that manages a subset of `container`'s children:\n\t\t\t_this._temp = {\n\t\t\t\tnodeType: 1,\n\t\t\t\tparentNode: container,\n\t\t\t\tchildNodes: [],\n\t\t\t\tappendChild( child ) {\n\t\t\t\t\tthis.childNodes.push( child );\n\t\t\t\t\t_this._container.appendChild( child );\n\t\t\t\t},\n\t\t\t\tinsertBefore( child ) {\n\t\t\t\t\tthis.childNodes.push( child );\n\t\t\t\t\t_this._container.appendChild( child );\n\t\t\t\t},\n\t\t\t\tremoveChild( child ) {\n\t\t\t\t\tthis.childNodes.splice(\n\t\t\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\t\t\tthis.childNodes.indexOf( child ) >>> 1,\n\t\t\t\t\t\t1\n\t\t\t\t\t);\n\t\t\t\t\t_this._container.removeChild( child );\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\t// Render our wrapping element into temp.\n\t\trender(\n\t\t\tcreateElement(\n\t\t\t\tContextProvider,\n\t\t\t\t{ context: _this.context },\n\t\t\t\tprops._vnode\n\t\t\t),\n\t\t\t_this._temp\n\t\t);\n\t}\n\t// When we come from a conditional render, on a mounted\n\t// portal we should clear the DOM.\n\telse if ( _this._temp ) {\n\t\t_this.componentWillUnmount();\n\t}\n}\n\n/**\n * Create a `Portal` to continue rendering the vnode tree at a different DOM node\n *\n * @param {import('./internal').VNode} vnode The vnode to render\n * @param {import('./internal').PreactElement} container The DOM node to continue rendering in to.\n */\nexport function createPortal( vnode, container ) {\n\tconst el = createElement( Portal, {\n\t\t_vnode: vnode,\n\t\t_container: container,\n\t} );\n\tel.containerInfo = container;\n\treturn el;\n}\n","/**\n * External dependencies\n */\nimport { useRef, useEffect } from 'preact/hooks';\nimport { effect } from '@preact/signals';\n\nfunction afterNextFrame( callback ) {\n\tconst done = () => {\n\t\twindow.cancelAnimationFrame( raf );\n\t\tsetTimeout( callback );\n\t};\n\tconst raf = window.requestAnimationFrame( done );\n}\n\n// Using the mangled properties:\n// this.c: this._callback\n// this.x: this._compute\n// https://github.com/preactjs/signals/blob/main/mangle.json\nfunction createFlusher( compute, notify ) {\n\tlet flush;\n\tconst dispose = effect( function () {\n\t\tflush = this.c.bind( this );\n\t\tthis.x = compute;\n\t\tthis.c = notify;\n\t\treturn compute();\n\t} );\n\treturn { flush, dispose };\n}\n\n// Version of `useSignalEffect` with a `useEffect`-like execution. This hook\n// implementation comes from this PR:\n// https://github.com/preactjs/signals/pull/290.\n//\n// We need to include it here in this repo until the mentioned PR is merged.\nexport function useSignalEffect( cb ) {\n\tconst callback = useRef( cb );\n\tcallback.current = cb;\n\n\tuseEffect( () => {\n\t\tconst execute = () => callback.current();\n\t\tconst notify = () => afterNextFrame( eff.flush );\n\t\tconst eff = createFlusher( execute, notify );\n\t\treturn eff.dispose;\n\t}, [] );\n}\n\n// For wrapperless hydration.\n// See https://gist.github.com/developit/f4c67a2ede71dc2fab7f357f39cff28c\nexport const createRootFragment = ( parent, replaceNode ) => {\n\treplaceNode = [].concat( replaceNode );\n\tconst s = replaceNode[ replaceNode.length - 1 ].nextSibling;\n\tfunction insert( c, r ) {\n\t\tparent.insertBefore( c, r || s );\n\t}\n\treturn ( parent.__k = {\n\t\tnodeType: 1,\n\t\tparentNode: parent,\n\t\tfirstChild: replaceNode[ 0 ],\n\t\tchildNodes: replaceNode,\n\t\tinsertBefore: insert,\n\t\tappendChild: insert,\n\t\tremoveChild( c ) {\n\t\t\tparent.removeChild( c );\n\t\t},\n\t} );\n};\n","/**\n * External dependencies\n */\nimport { deepSignal } from 'deepsignal';\n\nconst isObject = ( item ) =>\n\titem && typeof item === 'object' && ! Array.isArray( item );\n\nconst deepMerge = ( target, source ) => {\n\tif ( isObject( target ) && isObject( source ) ) {\n\t\tfor ( const key in source ) {\n\t\t\tif ( isObject( source[ key ] ) ) {\n\t\t\t\tif ( ! target[ key ] ) Object.assign( target, { [ key ]: {} } );\n\t\t\t\tdeepMerge( target[ key ], source[ key ] );\n\t\t\t} else {\n\t\t\t\tObject.assign( target, { [ key ]: source[ key ] } );\n\t\t\t}\n\t\t}\n\t}\n};\n\nconst getSerializedState = () => {\n\t// TODO: change the store tag ID for a better one.\n\tconst storeTag = document.querySelector(\n\t\t`script[type=\"application/json\"]#store`\n\t);\n\tif ( ! storeTag ) return {};\n\ttry {\n\t\tconst { state } = JSON.parse( storeTag.textContent );\n\t\tif ( isObject( state ) ) return state;\n\t\tthrow Error( 'Parsed state is not an object' );\n\t} catch ( e ) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.log( e );\n\t}\n\treturn {};\n};\n\nconst rawState = getSerializedState();\nexport const rawStore = { state: deepSignal( rawState ) };\n\nexport const store = ( { state, ...block } ) => {\n\tdeepMerge( rawStore, block );\n\tdeepMerge( rawState, state );\n};\n","/**\n * External dependencies\n */\nimport { h, options, createContext, cloneElement } from 'preact';\nimport { useRef, useMemo } from 'preact/hooks';\n/**\n * Internal dependencies\n */\nimport { rawStore as store } from './store';\n\n// Main context.\nconst context = createContext( {} );\n\n// WordPress Directives.\nconst directiveMap = {};\nconst directivePriorities = {};\nexport const directive = ( name, cb, { priority = 10 } = {} ) => {\n\tdirectiveMap[ name ] = cb;\n\tdirectivePriorities[ name ] = priority;\n};\n\n// Resolve the path to some property of the store object.\nconst resolve = ( path, ctx ) => {\n\tlet current = { ...store, context: ctx };\n\tpath.split( '.' ).forEach( ( p ) => ( current = current[ p ] ) );\n\treturn current;\n};\n\n// Generate the evaluate function.\nconst getEvaluate =\n\t( { ref } = {} ) =>\n\t( path, extraArgs = {} ) => {\n\t\t// If path starts with !, remove it and save a flag.\n\t\tconst hasNegationOperator =\n\t\t\tpath[ 0 ] === '!' && !! ( path = path.slice( 1 ) );\n\t\tconst value = resolve( path, extraArgs.context );\n\t\tconst returnValue =\n\t\t\ttypeof value === 'function'\n\t\t\t\t? value( {\n\t\t\t\t\t\tref: ref.current,\n\t\t\t\t\t\t...store,\n\t\t\t\t\t\t...extraArgs,\n\t\t\t\t } )\n\t\t\t\t: value;\n\t\treturn hasNegationOperator ? ! returnValue : returnValue;\n\t};\n\n// Separate directives by priority. The resulting array contains objects\n// of directives grouped by same priority, and sorted in ascending order.\nconst usePriorityLevels = ( directives ) =>\n\tuseMemo( () => {\n\t\tconst byPriority = Object.entries( directives ).reduce(\n\t\t\t( acc, [ name, values ] ) => {\n\t\t\t\tconst priority = directivePriorities[ name ];\n\t\t\t\tif ( ! acc[ priority ] ) acc[ priority ] = {};\n\t\t\t\tacc[ priority ][ name ] = values;\n\n\t\t\t\treturn acc;\n\t\t\t},\n\t\t\t{}\n\t\t);\n\n\t\treturn Object.entries( byPriority )\n\t\t\t.sort( ( [ p1 ], [ p2 ] ) => p1 - p2 )\n\t\t\t.map( ( [ , obj ] ) => obj );\n\t}, [ directives ] );\n\n// Directive wrapper.\nconst Directive = ( { type, directives, props: originalProps } ) => {\n\tconst ref = useRef( null );\n\tconst element = h( type, { ...originalProps, ref } );\n\tconst evaluate = useMemo( () => getEvaluate( { ref } ), [] );\n\n\t// Add wrappers recursively for each priority level.\n\tconst byPriorityLevel = usePriorityLevels( directives );\n\treturn (\n\t\t\n\t);\n};\n\n// Priority level wrapper.\nconst RecursivePriorityLevel = ( {\n\tdirectives: [ directives, ...rest ],\n\telement,\n\tevaluate,\n\toriginalProps,\n} ) => {\n\t// This element needs to be a fresh copy so we are not modifying an already\n\t// rendered element with Preact's internal properties initialized. This\n\t// prevents an error with changes in `element.props.children` not being\n\t// reflected in `element.__k`.\n\telement = cloneElement( element );\n\n\t// Recursively render the wrapper for the next priority level.\n\t//\n\t// Note that, even though we're instantiating a vnode with a\n\t// `RecursivePriorityLevel` here, its render function will not be executed\n\t// just yet. Actually, it will be delayed until the current render function\n\t// has finished. That ensures directives in the current priorty level have\n\t// run (and thus modified the passed `element`) before the next level.\n\tconst children =\n\t\trest.length > 0 ? (\n\t\t\t\n\t\t) : (\n\t\t\telement\n\t\t);\n\n\tconst props = { ...originalProps, children };\n\tconst directiveArgs = { directives, props, element, context, evaluate };\n\n\tfor ( const d in directives ) {\n\t\tconst wrapper = directiveMap[ d ]?.( directiveArgs );\n\t\tif ( wrapper !== undefined ) props.children = wrapper;\n\t}\n\n\treturn props.children;\n};\n\n// Preact Options Hook called each time a vnode is created.\nconst old = options.vnode;\noptions.vnode = ( vnode ) => {\n\tif ( vnode.props.__directives ) {\n\t\tconst props = vnode.props;\n\t\tconst directives = props.__directives;\n\t\tdelete props.__directives;\n\t\tvnode.props = {\n\t\t\ttype: vnode.type,\n\t\t\tdirectives,\n\t\t\tprops,\n\t\t};\n\t\tvnode.type = Directive;\n\t}\n\n\tif ( old ) old( vnode );\n};\n","/**\n * External dependencies\n */\nimport { useContext, useMemo, useEffect } from 'preact/hooks';\nimport { deepSignal, peek } from 'deepsignal';\n/**\n * Internal dependencies\n */\nimport { createPortal } from './portals.js';\n\n/**\n * Internal dependencies\n */\nimport { useSignalEffect } from './utils';\nimport { directive } from './hooks';\n\nconst isObject = ( item ) =>\n\titem && typeof item === 'object' && ! Array.isArray( item );\n\nconst mergeDeepSignals = ( target, source ) => {\n\tfor ( const k in source ) {\n\t\tif ( typeof peek( target, k ) === 'undefined' ) {\n\t\t\ttarget[ `$${ k }` ] = source[ `$${ k }` ];\n\t\t} else if (\n\t\t\tisObject( peek( target, k ) ) &&\n\t\t\tisObject( peek( source, k ) )\n\t\t) {\n\t\t\tmergeDeepSignals(\n\t\t\t\ttarget[ `$${ k }` ].peek(),\n\t\t\t\tsource[ `$${ k }` ].peek()\n\t\t\t);\n\t\t}\n\t}\n};\n\nexport default () => {\n\t// data-wp-context\n\tdirective(\n\t\t'context',\n\t\t( {\n\t\t\tdirectives: {\n\t\t\t\tcontext: { default: context },\n\t\t\t},\n\t\t\tprops: { children },\n\t\t\tcontext: inherited,\n\t\t} ) => {\n\t\t\tconst { Provider } = inherited;\n\t\t\tconst inheritedValue = useContext( inherited );\n\t\t\tconst value = useMemo( () => {\n\t\t\t\tconst localValue = deepSignal( context );\n\t\t\t\tmergeDeepSignals( localValue, inheritedValue );\n\t\t\t\treturn localValue;\n\t\t\t}, [ context, inheritedValue ] );\n\n\t\t\treturn { children };\n\t\t},\n\t\t{ priority: 5 }\n\t);\n\n\t// data-wp-body\n\tdirective( 'body', ( { props: { children }, context: inherited } ) => {\n\t\tconst { Provider } = inherited;\n\t\tconst inheritedValue = useContext( inherited );\n\t\treturn createPortal(\n\t\t\t{ children },\n\t\t\tdocument.body\n\t\t);\n\t} );\n\n\t// data-wp-effect--[name]\n\tdirective( 'effect', ( { directives: { effect }, context, evaluate } ) => {\n\t\tconst contextValue = useContext( context );\n\t\tObject.values( effect ).forEach( ( path ) => {\n\t\t\tuseSignalEffect( () => {\n\t\t\t\treturn evaluate( path, { context: contextValue } );\n\t\t\t} );\n\t\t} );\n\t} );\n\n\t// data-wp-init--[name]\n\tdirective( 'init', ( { directives: { init }, context, evaluate } ) => {\n\t\tconst contextValue = useContext( context );\n\t\tObject.values( init ).forEach( ( path ) => {\n\t\t\tuseEffect( () => {\n\t\t\t\treturn evaluate( path, { context: contextValue } );\n\t\t\t}, [] );\n\t\t} );\n\t} );\n\n\t// data-wp-on--[event]\n\tdirective( 'on', ( { directives: { on }, element, evaluate, context } ) => {\n\t\tconst contextValue = useContext( context );\n\t\tObject.entries( on ).forEach( ( [ name, path ] ) => {\n\t\t\telement.props[ `on${ name }` ] = ( event ) => {\n\t\t\t\tevaluate( path, { event, context: contextValue } );\n\t\t\t};\n\t\t} );\n\t} );\n\n\t// data-wp-class--[classname]\n\tdirective(\n\t\t'class',\n\t\t( {\n\t\t\tdirectives: { class: className },\n\t\t\telement,\n\t\t\tevaluate,\n\t\t\tcontext,\n\t\t} ) => {\n\t\t\tconst contextValue = useContext( context );\n\t\t\tObject.keys( className )\n\t\t\t\t.filter( ( n ) => n !== 'default' )\n\t\t\t\t.forEach( ( name ) => {\n\t\t\t\t\tconst result = evaluate( className[ name ], {\n\t\t\t\t\t\tclassName: name,\n\t\t\t\t\t\tcontext: contextValue,\n\t\t\t\t\t} );\n\t\t\t\t\tconst currentClass = element.props.class || '';\n\t\t\t\t\tconst classFinder = new RegExp(\n\t\t\t\t\t\t`(^|\\\\s)${ name }(\\\\s|$)`,\n\t\t\t\t\t\t'g'\n\t\t\t\t\t);\n\t\t\t\t\tif ( ! result )\n\t\t\t\t\t\telement.props.class = currentClass\n\t\t\t\t\t\t\t.replace( classFinder, ' ' )\n\t\t\t\t\t\t\t.trim();\n\t\t\t\t\telse if ( ! classFinder.test( currentClass ) )\n\t\t\t\t\t\telement.props.class = currentClass\n\t\t\t\t\t\t\t? `${ currentClass } ${ name }`\n\t\t\t\t\t\t\t: name;\n\n\t\t\t\t\tuseEffect( () => {\n\t\t\t\t\t\t// This seems necessary because Preact doesn't change the class\n\t\t\t\t\t\t// names on the hydration, so we have to do it manually. It doesn't\n\t\t\t\t\t\t// need deps because it only needs to do it the first time.\n\t\t\t\t\t\tif ( ! result ) {\n\t\t\t\t\t\t\telement.ref.current.classList.remove( name );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\telement.ref.current.classList.add( name );\n\t\t\t\t\t\t}\n\t\t\t\t\t}, [] );\n\t\t\t\t} );\n\t\t}\n\t);\n\n\t// data-wp-bind--[attribute]\n\tdirective(\n\t\t'bind',\n\t\t( { directives: { bind }, element, context, evaluate } ) => {\n\t\t\tconst contextValue = useContext( context );\n\t\t\tObject.entries( bind )\n\t\t\t\t.filter( ( n ) => n !== 'default' )\n\t\t\t\t.forEach( ( [ attribute, path ] ) => {\n\t\t\t\t\tconst result = evaluate( path, {\n\t\t\t\t\t\tcontext: contextValue,\n\t\t\t\t\t} );\n\t\t\t\t\telement.props[ attribute ] = result;\n\n\t\t\t\t\t// This seems necessary because Preact doesn't change the attributes\n\t\t\t\t\t// on the hydration, so we have to do it manually. It doesn't need\n\t\t\t\t\t// deps because it only needs to do it the first time.\n\t\t\t\t\tuseEffect( () => {\n\t\t\t\t\t\t// aria- and data- attributes have no boolean representation.\n\t\t\t\t\t\t// A `false` value is different from the attribute not being\n\t\t\t\t\t\t// present, so we can't remove it.\n\t\t\t\t\t\t// We follow Preact's logic: https://github.com/preactjs/preact/blob/ea49f7a0f9d1ff2c98c0bdd66aa0cbc583055246/src/diff/props.js#L131C24-L136\n\t\t\t\t\t\tif ( result === false && attribute[ 4 ] !== '-' ) {\n\t\t\t\t\t\t\telement.ref.current.removeAttribute( attribute );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\telement.ref.current.setAttribute(\n\t\t\t\t\t\t\t\tattribute,\n\t\t\t\t\t\t\t\tresult === true && attribute[ 4 ] !== '-'\n\t\t\t\t\t\t\t\t\t? ''\n\t\t\t\t\t\t\t\t\t: result\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}, [] );\n\t\t\t\t} );\n\t\t}\n\t);\n\n\t// data-wp-ignore\n\tdirective(\n\t\t'ignore',\n\t\t( {\n\t\t\telement: {\n\t\t\t\ttype: Type,\n\t\t\t\tprops: { innerHTML, ...rest },\n\t\t\t},\n\t\t} ) => {\n\t\t\t// Preserve the initial inner HTML.\n\t\t\tconst cached = useMemo( () => innerHTML, [] );\n\t\t\treturn (\n\t\t\t\t\n\t\t\t);\n\t\t}\n\t);\n};\n","export const directivePrefix = 'wp';\n","/**\n * External dependencies\n */\nimport { h } from 'preact';\n/**\n * Internal dependencies\n */\nimport { directivePrefix as p } from './constants';\n\nconst ignoreAttr = `data-${ p }-ignore`;\nconst islandAttr = `data-${ p }-interactive`;\nconst fullPrefix = `data-${ p }-`;\n\n// Regular expression for directive parsing.\nconst directiveParser = new RegExp(\n\t`^data-${ p }-` + // ${p} must be a prefix string, like 'wp'.\n\t\t// Match alphanumeric characters including hyphen-separated\n\t\t// segments. It excludes underscore intentionally to prevent confusion.\n\t\t// E.g., \"custom-directive\".\n\t\t'([a-z0-9]+(?:-[a-z0-9]+)*)' +\n\t\t// (Optional) Match '--' followed by any alphanumeric charachters. It\n\t\t// excludes underscore intentionally to prevent confusion, but it can\n\t\t// contain multiple hyphens. E.g., \"--custom-prefix--with-more-info\".\n\t\t'(?:--([a-z0-9][a-z0-9-]+))?$',\n\t'i' // Case insensitive.\n);\n\nexport const hydratedIslands = new WeakSet();\n\n// Recursive function that transforms a DOM tree into vDOM.\nexport function toVdom( root ) {\n\tconst treeWalker = document.createTreeWalker(\n\t\troot,\n\t\t205 // ELEMENT + TEXT + COMMENT + CDATA_SECTION + PROCESSING_INSTRUCTION\n\t);\n\n\tfunction walk( node ) {\n\t\tconst { attributes, nodeType } = node;\n\n\t\tif ( nodeType === 3 ) return [ node.data ];\n\t\tif ( nodeType === 4 ) {\n\t\t\tconst next = treeWalker.nextSibling();\n\t\t\tnode.replaceWith( new window.Text( node.nodeValue ) );\n\t\t\treturn [ node.nodeValue, next ];\n\t\t}\n\t\tif ( nodeType === 8 || nodeType === 7 ) {\n\t\t\tconst next = treeWalker.nextSibling();\n\t\t\tnode.remove();\n\t\t\treturn [ null, next ];\n\t\t}\n\n\t\tconst props = {};\n\t\tconst children = [];\n\t\tconst directives = {};\n\t\tlet hasDirectives = false;\n\t\tlet ignore = false;\n\t\tlet island = false;\n\n\t\tfor ( let i = 0; i < attributes.length; i++ ) {\n\t\t\tconst n = attributes[ i ].name;\n\t\t\tif (\n\t\t\t\tn[ fullPrefix.length ] &&\n\t\t\t\tn.slice( 0, fullPrefix.length ) === fullPrefix\n\t\t\t) {\n\t\t\t\tif ( n === ignoreAttr ) {\n\t\t\t\t\tignore = true;\n\t\t\t\t} else if ( n === islandAttr ) {\n\t\t\t\t\tisland = true;\n\t\t\t\t} else {\n\t\t\t\t\thasDirectives = true;\n\t\t\t\t\tlet val = attributes[ i ].value;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tval = JSON.parse( val );\n\t\t\t\t\t} catch ( e ) {}\n\t\t\t\t\tconst [ , prefix, suffix ] = directiveParser.exec( n );\n\t\t\t\t\tdirectives[ prefix ] = directives[ prefix ] || {};\n\t\t\t\t\tdirectives[ prefix ][ suffix || 'default' ] = val;\n\t\t\t\t}\n\t\t\t} else if ( n === 'ref' ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tprops[ n ] = attributes[ i ].value;\n\t\t}\n\n\t\tif ( ignore && ! island )\n\t\t\treturn [\n\t\t\t\th( node.localName, {\n\t\t\t\t\t...props,\n\t\t\t\t\tinnerHTML: node.innerHTML,\n\t\t\t\t\t__directives: { ignore: true },\n\t\t\t\t} ),\n\t\t\t];\n\t\tif ( island ) hydratedIslands.add( node );\n\n\t\tif ( hasDirectives ) props.__directives = directives;\n\n\t\tlet child = treeWalker.firstChild();\n\t\tif ( child ) {\n\t\t\twhile ( child ) {\n\t\t\t\tconst [ vnode, nextChild ] = walk( child );\n\t\t\t\tif ( vnode ) children.push( vnode );\n\t\t\t\tchild = nextChild || treeWalker.nextSibling();\n\t\t\t}\n\t\t\ttreeWalker.parentNode();\n\t\t}\n\n\t\treturn [ h( node.localName, props, children ) ];\n\t}\n\n\treturn walk( treeWalker.currentNode );\n}\n","/**\n * Internal dependencies\n */\nimport registerDirectives from './directives';\nimport { init } from './hydration';\nexport { store } from './store';\n\n/**\n * Initialize the Interactivity API.\n */\nregisterDirectives();\n\ndocument.addEventListener( 'DOMContentLoaded', async () => {\n\tawait init();\n\t// eslint-disable-next-line no-console\n\tconsole.log( 'Interactivity API started' );\n} );\n","/**\n * External dependencies\n */\nimport { hydrate } from 'preact';\n/**\n * Internal dependencies\n */\nimport { toVdom, hydratedIslands } from './vdom';\nimport { createRootFragment } from './utils';\nimport { directivePrefix } from './constants';\n\nexport const init = async () => {\n\tdocument\n\t\t.querySelectorAll( `[data-${ directivePrefix }-interactive]` )\n\t\t.forEach( ( node ) => {\n\t\t\tif ( ! hydratedIslands.has( node ) ) {\n\t\t\t\tconst fragment = createRootFragment( node.parentNode, node );\n\t\t\t\tconst vdom = toVdom( node );\n\t\t\t\thydrate( vdom, fragment );\n\t\t\t}\n\t\t} );\n};\n"],"names":["ContextProvider","props","this","getChildContext","context","children","Portal","_this","container","_container","componentWillUnmount","render","_temp","_vnode","nodeType","parentNode","childNodes","appendChild","child","push","insertBefore","removeChild","splice","indexOf","createElement","isObject","item","Array","isArray","deepMerge","target","source","key","Object","assign","rawState","storeTag","document","querySelector","state","JSON","parse","textContent","Error","e","console","log","getSerializedState","rawStore","deepSignal","store","block","createContext","directiveMap","directivePriorities","directive","name","cb","priority","Directive","type","directives","originalProps","ref","useRef","element","h","evaluate","useMemo","path","extraArgs","hasNegationOperator","slice","value","ctx","current","split","forEach","p","resolve","returnValue","getEvaluate","byPriorityLevel","byPriority","entries","reduce","acc","values","sort","p1","p2","map","obj","usePriorityLevels","RecursivePriorityLevel","rest","cloneElement","length","directiveArgs","d","wrapper","undefined","old","options","vnode","__directives","mergeDeepSignals","k","peek","directivePrefix","ignoreAttr","islandAttr","fullPrefix","directiveParser","RegExp","hydratedIslands","WeakSet","default","inherited","Provider","inheritedValue","useContext","localValue","el","containerInfo","createPortal","body","effect","contextValue","callback","useEffect","eff","compute","notify","flush","dispose","c","bind","x","createFlusher","raf","window","requestAnimationFrame","cancelAnimationFrame","setTimeout","afterNextFrame","useSignalEffect","init","on","event","class","className","keys","filter","n","result","currentClass","classFinder","test","replace","trim","classList","add","remove","attribute","removeAttribute","setAttribute","Type","innerHTML","cached","dangerouslySetInnerHTML","__html","addEventListener","async","querySelectorAll","node","has","fragment","parent","replaceNode","s","concat","nextSibling","insert","r","__k","firstChild","createRootFragment","vdom","root","treeWalker","createTreeWalker","walk","attributes","data","next","replaceWith","Text","nodeValue","hasDirectives","ignore","island","i","val","prefix","suffix","exec","localName","nextChild","currentNode","toVdom","hydrate"],"sourceRoot":""}