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MC,GAAcC,EAAAA,EAAAA,cAAclB,OAAOmB,SAASC,MAC5CC,GAAwBC,EAAAA,EAAAA,iBAC7BtB,OAAOmB,SAASC,QACbhC,OAAOmC,KAAMN,IAEXO,GAASC,EAAAA,EAAAA,cAAcJ,EAAuBN,GACpD,OAAOF,EAAuBjB,KAAMa,EAASe,EAAQR,EACrD,EAKD,UCvBMU,GAAgBC,EAAAA,EAAAA,iBAChBC,GAAiBD,EAAAA,EAAAA,iBAUvB,SAASE,EAAuBV,GAC/B,MAAMW,EAAe,IAAIC,gBAAiBZ,EAASa,QACnD,MAAO,IACHb,EACHJ,OAAQ3B,OAAO6C,YAAaH,EAAaI,WAE1C,CChCD,MAAM,EAA+BlC,OAAW,GAAe,aCKlD,KAAEmC,EAAF,OAAQC,IACpBC,EAAAA,EAAAA,kDACC,+GACA,qBCFWC,EAAc,CAAC,EAC5BH,EAAMG,EAAa,CAClBC,WHcM,WACN,OAAOC,EAAAA,EAAAA,YAAYZ,EACnB,EGfAa,YHSM,WACN,OAAOD,EAAAA,EAAAA,YAAYd,EACnB,EGVAgB,eHwBM,UAAyB,SAAEC,IACjC,MAAQxB,EAAUyB,IAAgBC,EAAAA,EAAAA,WAAU,IAC3ChB,EAAuBpB,EAAAA,YASxB,OANAqC,EAAAA,EAAAA,YAAW,IACHrC,EAAAA,QAAgB,EAAIU,SAAU4B,MACpCH,EAAaf,EAAuBkB,GAApC,KAEC,KAGF,mBAACnB,EAAeoB,SAAhB,CAAyBjD,MAAQU,IAChC,mBAACiB,EAAcsB,SAAf,CAAwBjD,MAAQoB,GAC7BwB,GAIL,K","sources":["webpack://wp/webpack/bootstrap","webpack://wp/webpack/runtime/define property getters","webpack://wp/webpack/runtime/hasOwnProperty shorthand","webpack://wp/webpack/runtime/make namespace object","webpack://wp/external window [\"wp\",\"element\"]","webpack://wp/./node_modules/@babel/runtime/helpers/esm/extends.js","webpack://wp/external window [\"wp\",\"url\"]","webpack://wp/./packages/router/build-module/@wordpress/router/src/history.js","webpack://wp/./packages/router/build-module/@wordpress/router/src/router.js","webpack://wp/external window [\"wp\",\"privateApis\"]","webpack://wp/./packages/router/build-module/@wordpress/router/src/lock-unlock.js","webpack://wp/./packages/router/build-module/@wordpress/router/src/private-apis.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = window[\"wp\"][\"element\"];","export default function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}","const __WEBPACK_NAMESPACE_OBJECT__ = window[\"wp\"][\"url\"];","/**\n * External dependencies\n */\nimport { createBrowserHistory } from 'history';\n\n/**\n * WordPress dependencies\n */\nimport { addQueryArgs, getQueryArgs, removeQueryArgs } from '@wordpress/url';\n\nconst history = createBrowserHistory();\n\nconst originalHistoryPush = history.push;\nconst originalHistoryReplace = history.replace;\n\nfunction push( params, state ) {\n\tconst currentArgs = getQueryArgs( window.location.href );\n\tconst currentUrlWithoutArgs = removeQueryArgs(\n\t\twindow.location.href,\n\t\t...Object.keys( currentArgs )\n\t);\n\tconst newUrl = addQueryArgs( currentUrlWithoutArgs, params );\n\treturn originalHistoryPush.call( history, newUrl, state );\n}\n\nfunction replace( params, state ) {\n\tconst currentArgs = getQueryArgs( window.location.href );\n\tconst currentUrlWithoutArgs = removeQueryArgs(\n\t\twindow.location.href,\n\t\t...Object.keys( currentArgs )\n\t);\n\tconst newUrl = addQueryArgs( currentUrlWithoutArgs, params );\n\treturn originalHistoryReplace.call( history, newUrl, state );\n}\n\nhistory.push = push;\nhistory.replace = replace;\n\nexport default history;\n","/**\n * WordPress dependencies\n */\nimport {\n\tcreateContext,\n\tuseState,\n\tuseEffect,\n\tuseContext,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport history from './history';\n\nconst RoutesContext = createContext();\nconst HistoryContext = createContext();\n\nexport function useLocation() {\n\treturn useContext( RoutesContext );\n}\n\nexport function useHistory() {\n\treturn useContext( HistoryContext );\n}\n\nfunction getLocationWithParams( location ) {\n\tconst searchParams = new URLSearchParams( location.search );\n\treturn {\n\t\t...location,\n\t\tparams: Object.fromEntries( searchParams.entries() ),\n\t};\n}\n\nexport function RouterProvider( { children } ) {\n\tconst [ location, setLocation ] = useState( () =>\n\t\tgetLocationWithParams( history.location )\n\t);\n\n\tuseEffect( () => {\n\t\treturn history.listen( ( { location: updatedLocation } ) => {\n\t\t\tsetLocation( getLocationWithParams( updatedLocation ) );\n\t\t} );\n\t}, [] );\n\n\treturn (\n\t\t<HistoryContext.Provider value={ history }>\n\t\t\t<RoutesContext.Provider value={ location }>\n\t\t\t\t{ children }\n\t\t\t</RoutesContext.Provider>\n\t\t</HistoryContext.Provider>\n\t);\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = window[\"wp\"][\"privateApis\"];","/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',\n\t\t'@wordpress/router'\n\t);\n","/**\n * Internal dependencies\n */\nimport { useHistory, useLocation, RouterProvider } from './router';\nimport { lock } from './lock-unlock';\n\nexport const privateApis = {};\nlock( privateApis, {\n\tuseHistory,\n\tuseLocation,\n\tRouterProvider,\n} );\n"],"names":["__webpack_require__","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","window","assign","target","i","arguments","length","source","apply","this","history","createBrowserHistory","originalHistoryPush","push","originalHistoryReplace","replace","params","state","currentArgs","getQueryArgs","location","href","currentUrlWithoutArgs","removeQueryArgs","keys","newUrl","addQueryArgs","RoutesContext","createContext","HistoryContext","getLocationWithParams","searchParams","URLSearchParams","search","fromEntries","entries","lock","unlock","__dangerousOptInToUnstableAPIsOnlyForCoreModules","privateApis","useHistory","useContext","useLocation","RouterProvider","children","setLocation","useState","useEffect","updatedLocation","Provider"],"sourceRoot":""}