import { addSolutionResourceUrlToAssets , interpolate , getProp , deepSet , slugify , IModelTemplate , IHubRequestOptions , IModel } from "@esri/hub-common" ; param { Object } template param { Object } settings param { Object } transforms param { IHubRequestOptions } requestOptions export function createPageModelFromTemplate ( template , settings , transforms , hubRequestOptions ) { template . assets = addSolutionResourceUrlToAssets ( template , hubRequestOptions ) ; const pageModel = interpolate ( template , settings , transforms ) ; if ( ! pageModel . item . properties ) { pageModel . item . properties = { } ; } const parentInitiativeId = getProp ( settings , "initiative.id" ) ; if ( parentInitiativeId ) { deepSet ( pageModel , "item.properties.parentInitiativeId" , parentInitiativeId ) ; } deepSet ( pageModel , "data.values.slug" , slugify ( pageModel . item . title ) ) ; return Promise . resolve ( pageModel as IModel ) ; }